Files
compiler-the-translators/library/reserve_release_reg.s
Scarlett 8c6372fcfd carl
2025-05-04 17:53:17 -04:00

38 lines
1.1 KiB
ArmAsm

.file "reserve_release.c"
.text
.globl main
.type main, @function
main:
.LFB0:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movl $8, %edi # move sizeof(*a) into %edi
call reserve # call alpha_lib_reg function reserve
movq %rax, -8(%rbp) # put the returned pointer on the stack at offset -8
movq -8(%rbp), %rax # put base pointer of struct (a) into %rax
movl $20, (%rax) # put value 20 into location pointed at by %rax --> (*a).x
movq -8(%rbp), %rax # put base pointer of struct (a) into %rax
movl $45, 4(%rax) # put value 45 into location 4(%rax) --> (*a).y
movq -8(%rbp), %rax # put base pointer of struct (a) into %rax
movl 4(%rax), %eax # move (*a).y into %eax
movl %eax, %edi # and then into %edi
call printInteger # call alpha_lib_reg function printInteger
movl $10, %edi # move '\n' into %edi
call printCharacter # call alpha_lib_reg function printCharacter
movq -8(%rbp), %rax # put base pointer of struct (a) into %rax
movq %rax, %rdi # and then into %rdi
call release # call alpha_lib_reg function reserve
movl $0, %eax
leave
ret
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 6.4.0"
.section .note.GNU-stack,"",@progbits