167 lines
2.8 KiB
ArmAsm
167 lines
2.8 KiB
ArmAsm
.file "class.c"
|
|
.text
|
|
.globl new_class
|
|
.type new_class, @function
|
|
new_class:
|
|
.LFB6:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
subq $48, %rsp
|
|
movq %rdi, -24(%rbp)
|
|
movl %esi, -28(%rbp)
|
|
movq %rdx, -40(%rbp)
|
|
movl $80, %edi
|
|
call malloc
|
|
movq %rax, -8(%rbp)
|
|
cmpq $0, -8(%rbp)
|
|
jne .L2
|
|
movl $0, %eax
|
|
jmp .L3
|
|
.L2:
|
|
movq -8(%rbp), %rax
|
|
movq -24(%rbp), %rcx
|
|
movl $49, %edx
|
|
movq %rcx, %rsi
|
|
movq %rax, %rdi
|
|
call strncpy
|
|
movq -8(%rbp), %rax
|
|
movb $0, 49(%rax)
|
|
movq -8(%rbp), %rax
|
|
movl -28(%rbp), %edx
|
|
movl %edx, 52(%rax)
|
|
movq -8(%rbp), %rax
|
|
movq -40(%rbp), %rdx
|
|
movq %rdx, 64(%rax)
|
|
movq -8(%rbp), %rax
|
|
movl $0, 56(%rax)
|
|
movq -8(%rbp), %rax
|
|
movq $0, 72(%rax)
|
|
movq -8(%rbp), %rax
|
|
.L3:
|
|
leave
|
|
.cfi_def_cfa 7, 8
|
|
ret
|
|
.cfi_endproc
|
|
.LFE6:
|
|
.size new_class, .-new_class
|
|
.globl change_teacher
|
|
.type change_teacher, @function
|
|
change_teacher:
|
|
.LFB7:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
movq %rdi, -8(%rbp)
|
|
movq %rsi, -16(%rbp)
|
|
movq -8(%rbp), %rax
|
|
movq -16(%rbp), %rdx
|
|
movq %rdx, 64(%rax)
|
|
nop
|
|
popq %rbp
|
|
.cfi_def_cfa 7, 8
|
|
ret
|
|
.cfi_endproc
|
|
.LFE7:
|
|
.size change_teacher, .-change_teacher
|
|
.globl add_student
|
|
.type add_student, @function
|
|
add_student:
|
|
.LFB8:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
subq $32, %rsp
|
|
movq %rdi, -24(%rbp)
|
|
movq %rsi, -32(%rbp)
|
|
cmpq $0, -24(%rbp)
|
|
je .L10
|
|
cmpq $0, -32(%rbp)
|
|
je .L10
|
|
movq -24(%rbp), %rax
|
|
movl 56(%rax), %eax
|
|
addl $1, %eax
|
|
movl %eax, -4(%rbp)
|
|
movl -4(%rbp), %eax
|
|
cltq
|
|
leaq 0(,%rax,8), %rdx
|
|
movq -24(%rbp), %rax
|
|
movq 72(%rax), %rax
|
|
movq %rdx, %rsi
|
|
movq %rax, %rdi
|
|
call realloc
|
|
movq %rax, -16(%rbp)
|
|
cmpq $0, -16(%rbp)
|
|
je .L11
|
|
movq -24(%rbp), %rax
|
|
movq -16(%rbp), %rdx
|
|
movq %rdx, 72(%rax)
|
|
movq -24(%rbp), %rax
|
|
movq 72(%rax), %rdx
|
|
movq -24(%rbp), %rax
|
|
movl 56(%rax), %eax
|
|
cltq
|
|
salq $3, %rax
|
|
addq %rax, %rdx
|
|
movq -32(%rbp), %rax
|
|
movq %rax, (%rdx)
|
|
movq -24(%rbp), %rax
|
|
movl -4(%rbp), %edx
|
|
movl %edx, 56(%rax)
|
|
jmp .L5
|
|
.L10:
|
|
nop
|
|
jmp .L5
|
|
.L11:
|
|
nop
|
|
.L5:
|
|
leave
|
|
.cfi_def_cfa 7, 8
|
|
ret
|
|
.cfi_endproc
|
|
.LFE8:
|
|
.size add_student, .-add_student
|
|
.section .rodata
|
|
.LC0:
|
|
.string "Class Name: %s, Students: %d"
|
|
.text
|
|
.globl print
|
|
.type print, @function
|
|
print:
|
|
.LFB9:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
subq $32, %rsp
|
|
movq %rdi, -24(%rbp)
|
|
movq -24(%rbp), %rax
|
|
movl 56(%rax), %eax
|
|
movl %eax, -4(%rbp)
|
|
movq -24(%rbp), %rax
|
|
movl -4(%rbp), %edx
|
|
movq %rax, %rsi
|
|
movl $.LC0, %edi
|
|
movl $0, %eax
|
|
call printf
|
|
nop
|
|
leave
|
|
.cfi_def_cfa 7, 8
|
|
ret
|
|
.cfi_endproc
|
|
.LFE9:
|
|
.size print, .-print
|
|
.ident "GCC: (GNU) 15.2.1 20260123 (Red Hat 15.2.1-7)"
|
|
.section .note.GNU-stack,"",@progbits
|