shtuff
This commit is contained in:
273
library/std.s
Normal file
273
library/std.s
Normal file
@ -0,0 +1,273 @@
|
||||
.file "alphastdio.c"
|
||||
.text
|
||||
.section .rodata
|
||||
.LC0:
|
||||
.string "%s"
|
||||
.text
|
||||
.globl printS
|
||||
.type printS, @function
|
||||
printS:
|
||||
.LFB6:
|
||||
.cfi_startproc
|
||||
pushq %rbp
|
||||
.cfi_def_cfa_offset 16
|
||||
.cfi_offset 6, -16
|
||||
movq %rsp, %rbp
|
||||
.cfi_def_cfa_register 6
|
||||
subq $16, %rsp
|
||||
movq %rdi, -8(%rbp)
|
||||
cmpq $0, -8(%rbp)
|
||||
jne .L2
|
||||
movl $-1, %eax
|
||||
jmp .L3
|
||||
.L2:
|
||||
movq -8(%rbp), %rax
|
||||
movq %rax, %rsi
|
||||
leaq .LC0(%rip), %rax
|
||||
movq %rax, %rdi
|
||||
movl $0, %eax
|
||||
call printf@PLT
|
||||
movl $0, %eax
|
||||
.L3:
|
||||
leave
|
||||
.cfi_def_cfa 7, 8
|
||||
ret
|
||||
.cfi_endproc
|
||||
.LFE6:
|
||||
.size printS, .-printS
|
||||
.section .rodata
|
||||
.LC1:
|
||||
.string "\n"
|
||||
.text
|
||||
.globl inS
|
||||
.type inS, @function
|
||||
inS:
|
||||
.LFB7:
|
||||
.cfi_startproc
|
||||
pushq %rbp
|
||||
.cfi_def_cfa_offset 16
|
||||
.cfi_offset 6, -16
|
||||
movq %rsp, %rbp
|
||||
.cfi_def_cfa_register 6
|
||||
subq $16, %rsp
|
||||
movl $100, %edi
|
||||
call malloc@PLT
|
||||
movq %rax, -8(%rbp)
|
||||
cmpq $0, -8(%rbp)
|
||||
jne .L5
|
||||
movl $0, %eax
|
||||
jmp .L6
|
||||
.L5:
|
||||
movq stdin(%rip), %rdx
|
||||
movq -8(%rbp), %rax
|
||||
movl $100, %esi
|
||||
movq %rax, %rdi
|
||||
call fgets@PLT
|
||||
testq %rax, %rax
|
||||
jne .L7
|
||||
movq -8(%rbp), %rax
|
||||
movq %rax, %rdi
|
||||
call free@PLT
|
||||
movl $0, %eax
|
||||
jmp .L6
|
||||
.L7:
|
||||
movq -8(%rbp), %rax
|
||||
leaq .LC1(%rip), %rdx
|
||||
movq %rdx, %rsi
|
||||
movq %rax, %rdi
|
||||
call strcspn@PLT
|
||||
movq -8(%rbp), %rdx
|
||||
addq %rdx, %rax
|
||||
movb $0, (%rax)
|
||||
movq -8(%rbp), %rax
|
||||
.L6:
|
||||
leave
|
||||
.cfi_def_cfa 7, 8
|
||||
ret
|
||||
.cfi_endproc
|
||||
.LFE7:
|
||||
.size inS, .-inS
|
||||
.section .rodata
|
||||
.LC2:
|
||||
.string "%d"
|
||||
.text
|
||||
.globl printI
|
||||
.type printI, @function
|
||||
printI:
|
||||
.LFB8:
|
||||
.cfi_startproc
|
||||
pushq %rbp
|
||||
.cfi_def_cfa_offset 16
|
||||
.cfi_offset 6, -16
|
||||
movq %rsp, %rbp
|
||||
.cfi_def_cfa_register 6
|
||||
subq $16, %rsp
|
||||
movl %edi, -4(%rbp)
|
||||
movl -4(%rbp), %eax
|
||||
movl %eax, %esi
|
||||
leaq .LC2(%rip), %rax
|
||||
movq %rax, %rdi
|
||||
movl $0, %eax
|
||||
call printf@PLT
|
||||
movl $0, %eax
|
||||
leave
|
||||
.cfi_def_cfa 7, 8
|
||||
ret
|
||||
.cfi_endproc
|
||||
.LFE8:
|
||||
.size printI, .-printI
|
||||
.globl inI
|
||||
.type inI, @function
|
||||
inI:
|
||||
.LFB9:
|
||||
.cfi_startproc
|
||||
pushq %rbp
|
||||
.cfi_def_cfa_offset 16
|
||||
.cfi_offset 6, -16
|
||||
movq %rsp, %rbp
|
||||
.cfi_def_cfa_register 6
|
||||
addq $-128, %rsp
|
||||
movq %fs:40, %rax
|
||||
movq %rax, -8(%rbp)
|
||||
xorl %eax, %eax
|
||||
movq stdin(%rip), %rdx
|
||||
leaq -112(%rbp), %rax
|
||||
movl $100, %esi
|
||||
movq %rax, %rdi
|
||||
call fgets@PLT
|
||||
testq %rax, %rax
|
||||
jne .L11
|
||||
movl $0, %eax
|
||||
jmp .L14
|
||||
.L11:
|
||||
leaq -116(%rbp), %rdx
|
||||
leaq -112(%rbp), %rax
|
||||
leaq .LC2(%rip), %rcx
|
||||
movq %rcx, %rsi
|
||||
movq %rax, %rdi
|
||||
movl $0, %eax
|
||||
call __isoc99_sscanf@PLT
|
||||
cmpl $1, %eax
|
||||
je .L13
|
||||
movl $0, %eax
|
||||
jmp .L14
|
||||
.L13:
|
||||
movl -116(%rbp), %eax
|
||||
.L14:
|
||||
movq -8(%rbp), %rdx
|
||||
subq %fs:40, %rdx
|
||||
je .L15
|
||||
call __stack_chk_fail@PLT
|
||||
.L15:
|
||||
leave
|
||||
.cfi_def_cfa 7, 8
|
||||
ret
|
||||
.cfi_endproc
|
||||
.LFE9:
|
||||
.size inI, .-inI
|
||||
.globl printC
|
||||
.type printC, @function
|
||||
printC:
|
||||
.LFB10:
|
||||
.cfi_startproc
|
||||
pushq %rbp
|
||||
.cfi_def_cfa_offset 16
|
||||
.cfi_offset 6, -16
|
||||
movq %rsp, %rbp
|
||||
.cfi_def_cfa_register 6
|
||||
subq $16, %rsp
|
||||
movl %edi, %eax
|
||||
movb %al, -4(%rbp)
|
||||
movsbl -4(%rbp), %eax
|
||||
movl %eax, %edi
|
||||
call putchar@PLT
|
||||
movl $0, %eax
|
||||
leave
|
||||
.cfi_def_cfa 7, 8
|
||||
ret
|
||||
.cfi_endproc
|
||||
.LFE10:
|
||||
.size printC, .-printC
|
||||
.section .rodata
|
||||
.LC3:
|
||||
.string " %c"
|
||||
.text
|
||||
.globl inC
|
||||
.type inC, @function
|
||||
inC:
|
||||
.LFB11:
|
||||
.cfi_startproc
|
||||
pushq %rbp
|
||||
.cfi_def_cfa_offset 16
|
||||
.cfi_offset 6, -16
|
||||
movq %rsp, %rbp
|
||||
.cfi_def_cfa_register 6
|
||||
subq $16, %rsp
|
||||
movq %fs:40, %rax
|
||||
movq %rax, -8(%rbp)
|
||||
xorl %eax, %eax
|
||||
leaq -9(%rbp), %rax
|
||||
movq %rax, %rsi
|
||||
leaq .LC3(%rip), %rax
|
||||
movq %rax, %rdi
|
||||
movl $0, %eax
|
||||
call __isoc99_scanf@PLT
|
||||
cmpl $1, %eax
|
||||
je .L19
|
||||
movl $0, %eax
|
||||
jmp .L21
|
||||
.L19:
|
||||
movzbl -9(%rbp), %eax
|
||||
.L21:
|
||||
movq -8(%rbp), %rdx
|
||||
subq %fs:40, %rdx
|
||||
je .L22
|
||||
call __stack_chk_fail@PLT
|
||||
.L22:
|
||||
leave
|
||||
.cfi_def_cfa 7, 8
|
||||
ret
|
||||
.cfi_endproc
|
||||
.LFE11:
|
||||
.size inC, .-inC
|
||||
.section .rodata
|
||||
.LC4:
|
||||
.string "true"
|
||||
.LC5:
|
||||
.string "false"
|
||||
.text
|
||||
.globl printB
|
||||
.type printB, @function
|
||||
printB:
|
||||
.LFB12:
|
||||
.cfi_startproc
|
||||
pushq %rbp
|
||||
.cfi_def_cfa_offset 16
|
||||
.cfi_offset 6, -16
|
||||
movq %rsp, %rbp
|
||||
.cfi_def_cfa_register 6
|
||||
subq $16, %rsp
|
||||
movl %edi, %eax
|
||||
movb %al, -4(%rbp)
|
||||
cmpb $0, -4(%rbp)
|
||||
je .L24
|
||||
leaq .LC4(%rip), %rax
|
||||
movq %rax, %rdi
|
||||
movl $0, %eax
|
||||
call printf@PLT
|
||||
jmp .L25
|
||||
.L24:
|
||||
leaq .LC5(%rip), %rax
|
||||
movq %rax, %rdi
|
||||
movl $0, %eax
|
||||
call printf@PLT
|
||||
.L25:
|
||||
movl $0, %eax
|
||||
leave
|
||||
.cfi_def_cfa 7, 8
|
||||
ret
|
||||
.cfi_endproc
|
||||
.LFE12:
|
||||
.size printB, .-printB
|
||||
.ident "GCC: (GNU) 14.2.1 20250207"
|
||||
.section .note.GNU-stack,"",@progbits
|
Reference in New Issue
Block a user