Course Homepage

HW19

Write x86 64 assembly code that has equivalent branching behavior as the following Slang program:

begin main()
locals a, b, x, y
a = 5
b = 1
x = 0
head:
if a <= 0 goto a1
x = x + a
a = a - 1
goto head
a1:
x = x + b
return x
end