program PointerSwap {
section module {
}
section data {
int rax = 0
int rbx = 0
int rcx = 0
int rdx = 0
int rsi = 0
int rdi = 0
int r8 = 0
string str_0 = "before swap:"
string str_1 = "after swap:"
string fmt_int = "%lld "
string fmt_str = "%s "
string newline = "\n"
ptr a = null
ptr b = null
int temp = 0
}
section code {
start:
alloc a, 8, 1
free a
alloc b, 8, 1
free b
store 25, a, 0, 1
store 75, b, 0, 1
print fmt_str, str_0
print newline
load rbx, a, 0, 1
print fmt_int, rbx
print newline
load rcx, b, 0, 1
print fmt_int, rcx
print newline
load rdx, a, 0, 1
mov temp, rdx
load rsi, b, 0, 1
store rsi, a, 0, 1
store temp, b, 0, 1
print fmt_str, str_1
print newline
load rdi, a, 0, 1
print fmt_int, rdi
print newline
load r8, b, 0, 1
print fmt_int, r8
print newline
free a
free b
done
}
}