27 lines
661 B
Plaintext
27 lines
661 B
Plaintext
|
.method main
|
||
|
.args 3
|
||
|
.define a = 1
|
||
|
.define b = 2
|
||
|
|
||
|
sign: iload a // Check for negative signs
|
||
|
iflt aneg // If a is negative, go check if b is too
|
||
|
iload b
|
||
|
iflt true // If only b is negative, a > b
|
||
|
// a > b is a subset of a >= b
|
||
|
// return 1
|
||
|
|
||
|
comp: iload a // Compare the two values to check a >= b
|
||
|
iload b
|
||
|
isub
|
||
|
iflt false // If (a-b) < 0, return 0, else return 1
|
||
|
true: bipush 1 // Push 1 to top of stack and return
|
||
|
ireturn
|
||
|
|
||
|
aneg: iload b // Check if b is negative
|
||
|
iflt comp // If a and b are negative go compare them
|
||
|
// else a < b; a < b is not part of a >= b;
|
||
|
// return 0
|
||
|
|
||
|
false: bipush 0 // Push 0 to top of stack and return
|
||
|
ireturn
|