/tests/gcc.c-torture/job_601_1465/bin/fprintf-1-0.asm
https://github.com/kframework/X86-64-semantics · Assembly · 557 lines · 554 code · 3 blank · 0 comment · 0 complexity · 730380da147781468db2eaf201f4b580 MD5 · raw file
- .text
- .globl strlen
- strlen:
- pushq %rbp
- movq %rsp, %rbp
- movq %rdi, -24(%rbp)
- movq $0, -8(%rbp)
- jmp L2
- L3:
- addq $1, -8(%rbp)
- L2:
- movq -24(%rbp), %rdx
- movq -8(%rbp), %rax
- addq %rdx, %rax
- movzbl (%rax), %eax
- testb %al, %al
- jne L3
- movq -8(%rbp), %rax
- popq %rbp
- ret
- .globl strcpy
- strcpy:
- pushq %rbp
- movq %rsp, %rbp
- movq %rdi, -24(%rbp)
- movq %rsi, -32(%rbp)
- movq -24(%rbp), %rax
- movq %rax, -8(%rbp)
- nop
- L6:
- movq -24(%rbp), %rax
- leaq 1(%rax), %rdx
- movq %rdx, -24(%rbp)
- movq -32(%rbp), %rdx
- leaq 1(%rdx), %rcx
- movq %rcx, -32(%rbp)
- movzbl (%rdx), %edx
- movb %dl, (%rax)
- movzbl (%rax), %eax
- testb %al, %al
- jne L6
- movq -8(%rbp), %rax
- popq %rbp
- ret
- .globl strcmp
- strcmp:
- pushq %rbp
- movq %rsp, %rbp
- movq %rdi, -8(%rbp)
- movq %rsi, -16(%rbp)
- jmp L9
- L11:
- addq $1, -8(%rbp)
- addq $1, -16(%rbp)
- L9:
- movq -8(%rbp), %rax
- movzbl (%rax), %eax
- testb %al, %al
- je L10
- movq -8(%rbp), %rax
- movzbl (%rax), %edx
- movq -16(%rbp), %rax
- movzbl (%rax), %eax
- cmpb %al, %dl
- je L11
- L10:
- movq -8(%rbp), %rax
- movzbl (%rax), %eax
- movzbl %al, %edx
- movq -16(%rbp), %rax
- movzbl (%rax), %eax
- movzbl %al, %eax
- subl %eax, %edx
- movl %edx, %eax
- popq %rbp
- ret
- .globl strchr
- strchr:
- pushq %rbp
- movq %rsp, %rbp
- movq %rdi, -8(%rbp)
- movl %esi, -12(%rbp)
- jmp L14
- L16:
- movq -8(%rbp), %rax
- leaq 1(%rax), %rdx
- movq %rdx, -8(%rbp)
- movzbl (%rax), %eax
- testb %al, %al
- jne L14
- movl $0, %eax
- jmp L15
- L14:
- movq -8(%rbp), %rax
- movzbl (%rax), %eax
- movl -12(%rbp), %edx
- cmpb %dl, %al
- jne L16
- movq -8(%rbp), %rax
- L15:
- popq %rbp
- ret
- .globl strncpy
- strncpy:
- pushq %rbp
- movq %rsp, %rbp
- movq %rdi, -24(%rbp)
- movq %rsi, -32(%rbp)
- movq %rdx, -40(%rbp)
- movq -24(%rbp), %rax
- movq %rax, -8(%rbp)
- L20:
- movq -40(%rbp), %rax
- leaq -1(%rax), %rdx
- movq %rdx, -40(%rbp)
- testq %rax, %rax
- jne L18
- movq -8(%rbp), %rax
- jmp L19
- L18:
- movq -24(%rbp), %rax
- leaq 1(%rax), %rdx
- movq %rdx, -24(%rbp)
- movq -32(%rbp), %rdx
- leaq 1(%rdx), %rcx
- movq %rcx, -32(%rbp)
- movzbl (%rdx), %edx
- movb %dl, (%rax)
- movzbl (%rax), %eax
- testb %al, %al
- jne L20
- jmp L21
- L22:
- movq -24(%rbp), %rax
- leaq 1(%rax), %rdx
- movq %rdx, -24(%rbp)
- movb $0, (%rax)
- L21:
- movq -40(%rbp), %rax
- leaq -1(%rax), %rdx
- movq %rdx, -40(%rbp)
- testq %rax, %rax
- jne L22
- movq -8(%rbp), %rax
- L19:
- popq %rbp
- ret
- .globl strncmp
- strncmp:
- pushq %rbp
- movq %rsp, %rbp
- movq %rdi, -8(%rbp)
- movq %rsi, -16(%rbp)
- movq %rdx, -24(%rbp)
- jmp L24
- L26:
- movq -8(%rbp), %rax
- leaq 1(%rax), %rdx
- movq %rdx, -8(%rbp)
- movzbl (%rax), %ecx
- movq -16(%rbp), %rax
- leaq 1(%rax), %rdx
- movq %rdx, -16(%rbp)
- movzbl (%rax), %eax
- cmpb %al, %cl
- je L24
- movq -8(%rbp), %rax
- subq $1, %rax
- movzbl (%rax), %eax
- movzbl %al, %edx
- movq -16(%rbp), %rax
- subq $1, %rax
- movzbl (%rax), %eax
- movzbl %al, %eax
- subl %eax, %edx
- movl %edx, %eax
- jmp L25
- L24:
- movq -24(%rbp), %rax
- leaq -1(%rax), %rdx
- movq %rdx, -24(%rbp)
- testq %rax, %rax
- jne L26
- movl $0, %eax
- L25:
- popq %rbp
- ret
- .globl strrchr
- strrchr:
- pushq %rbp
- movq %rsp, %rbp
- movq %rdi, -24(%rbp)
- movl %esi, -28(%rbp)
- movq $0, -8(%rbp)
- L29:
- movq -24(%rbp), %rax
- movzbl (%rax), %eax
- movl -28(%rbp), %edx
- cmpb %dl, %al
- jne L28
- movq -24(%rbp), %rax
- movq %rax, -8(%rbp)
- L28:
- movq -24(%rbp), %rax
- leaq 1(%rax), %rdx
- movq %rdx, -24(%rbp)
- movzbl (%rax), %eax
- testb %al, %al
- jne L29
- movq -8(%rbp), %rax
- popq %rbp
- ret
- .globl memcmp
- memcmp:
- pushq %rbp
- movq %rsp, %rbp
- movq %rdi, -24(%rbp)
- movq %rsi, -32(%rbp)
- movq %rdx, -40(%rbp)
- movq -24(%rbp), %rax
- movq %rax, -16(%rbp)
- movq -32(%rbp), %rax
- movq %rax, -8(%rbp)
- jmp L32
- L35:
- movq -16(%rbp), %rax
- movzbl (%rax), %edx
- movq -8(%rbp), %rax
- movzbl (%rax), %eax
- cmpb %al, %dl
- je L33
- movq -16(%rbp), %rax
- movzbl (%rax), %eax
- movzbl %al, %edx
- movq -8(%rbp), %rax
- movzbl (%rax), %eax
- movzbl %al, %eax
- subl %eax, %edx
- movl %edx, %eax
- jmp L34
- L33:
- addq $1, -16(%rbp)
- addq $1, -8(%rbp)
- L32:
- movq -40(%rbp), %rax
- leaq -1(%rax), %rdx
- movq %rdx, -40(%rbp)
- testq %rax, %rax
- jne L35
- movl $0, %eax
- L34:
- popq %rbp
- ret
- .globl __stack_chk_fail
- __stack_chk_fail:
- pushq %rbp
- movq %rsp, %rbp
- movq $-1, %rax
- jmp %rax
-
- nop
- popq %rbp
- ret
- .globl exit
- exit:
- pushq %rbp
- movq %rsp, %rbp
- movl %edi, -4(%rbp)
- movq $-1, %rax
- jmp %rax
-
- nop
- popq %rbp
- ret
- .globl abort
- abort:
- pushq %rbp
- movq %rsp, %rbp
- movq $-1, %rax
- jmp %rax
-
- nop
- popq %rbp
- ret
- .globl memset
- memset:
- pushq %rbp
- movq %rsp, %rbp
- movq %rdi, -24(%rbp)
- movl %esi, -28(%rbp)
- movq %rdx, -40(%rbp)
- movq -24(%rbp), %rax
- movq %rax, -8(%rbp)
- jmp L40
- L41:
- movq -8(%rbp), %rax
- leaq 1(%rax), %rdx
- movq %rdx, -8(%rbp)
- movl -28(%rbp), %edx
- movb %dl, (%rax)
- L40:
- movq -40(%rbp), %rax
- leaq -1(%rax), %rdx
- movq %rdx, -40(%rbp)
- testq %rax, %rax
- jne L41
- movq -24(%rbp), %rax
- popq %rbp
- ret
- .globl memcpy
- memcpy:
- pushq %rbp
- movq %rsp, %rbp
- movq %rdi, -24(%rbp)
- movq %rsi, -32(%rbp)
- movq %rdx, -40(%rbp)
- movq -24(%rbp), %rax
- movq %rax, -16(%rbp)
- movq -32(%rbp), %rax
- movq %rax, -8(%rbp)
- jmp L44
- L45:
- movq -16(%rbp), %rax
- leaq 1(%rax), %rdx
- movq %rdx, -16(%rbp)
- movq -8(%rbp), %rdx
- leaq 1(%rdx), %rcx
- movq %rcx, -8(%rbp)
- movzbl (%rdx), %edx
- movb %dl, (%rax)
- L44:
- movq -40(%rbp), %rax
- leaq -1(%rax), %rdx
- movq %rdx, -40(%rbp)
- testq %rax, %rax
- jne L45
- movq -24(%rbp), %rax
- popq %rbp
- ret
- .globl free
- free:
- pushq %rbp
- movq %rsp, %rbp
- movq %rdi, -8(%rbp)
- nop
- popq %rbp
- ret
- .globl isprint
- isprint:
- pushq %rbp
- movq %rsp, %rbp
- movl %edi, -4(%rbp)
- cmpl $96, -4(%rbp)
- jle L49
- cmpl $122, -4(%rbp)
- jg L49
- movl $1, %eax
- jmp L50
- L49:
- cmpl $64, -4(%rbp)
- jle L51
- cmpl $90, -4(%rbp)
- jg L51
- movl $1, %eax
- jmp L50
- L51:
- cmpl $47, -4(%rbp)
- jle L52
- cmpl $57, -4(%rbp)
- jg L52
- movl $1, %eax
- jmp L50
- L52:
- movl $0, %eax
- L50:
- popq %rbp
- ret
- .section .rodata
- LC0:
- .string "hello"
- LC1:
- .string "hello\n"
- LC2:
- .string "a"
- LC3:
- .string ""
- LC4:
- .string "%s"
- LC5:
- .string "%c"
- LC6:
- .string "%s\n"
- LC7:
- .string "%d\n"
- .text
- .globl main
- .globl _start
- _start:
- pushq %rbp
- movq %rsp, %rbp
- movq $stdout, %rax
- movq %rax, %rcx
- movl $5, %edx
- movl $1, %esi
- movl $LC0, %edi
- call fwrite
- movq $stdout, %rax
- movl $LC0, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- cmpl $5, %eax
- je L54
- call abort
- L54:
- movq $stdout, %rax
- movq %rax, %rcx
- movl $6, %edx
- movl $1, %esi
- movl $LC1, %edi
- call fwrite
- movq $stdout, %rax
- movl $LC1, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- cmpl $6, %eax
- je L55
- call abort
- L55:
- movq $stdout, %rax
- movq %rax, %rsi
- movl $97, %edi
- call fputc
- movq $stdout, %rax
- movl $LC2, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- cmpl $1, %eax
- je L56
- call abort
- L56:
- movq $stdout, %rax
- movl $LC3, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- testl %eax, %eax
- je L57
- call abort
- L57:
- movq $stdout, %rax
- movq %rax, %rcx
- movl $5, %edx
- movl $1, %esi
- movl $LC0, %edi
- call fwrite
- movq $stdout, %rax
- movl $LC0, %edx
- movl $LC4, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- cmpl $5, %eax
- je L58
- call abort
- L58:
- movq $stdout, %rax
- movq %rax, %rcx
- movl $6, %edx
- movl $1, %esi
- movl $LC1, %edi
- call fwrite
- movq $stdout, %rax
- movl $LC1, %edx
- movl $LC4, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- cmpl $6, %eax
- je L59
- call abort
- L59:
- movq $stdout, %rax
- movq %rax, %rsi
- movl $97, %edi
- call fputc
- movq $stdout, %rax
- movl $LC2, %edx
- movl $LC4, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- cmpl $1, %eax
- je L60
- call abort
- L60:
- movq $stdout, %rax
- movl $LC3, %edx
- movl $LC4, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- testl %eax, %eax
- je L61
- call abort
- L61:
- movq $stdout, %rax
- movq %rax, %rsi
- movl $120, %edi
- call fputc
- movq $stdout, %rax
- movl $120, %edx
- movl $LC5, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- cmpl $1, %eax
- je L62
- call abort
- L62:
- movq $stdout, %rax
- movl $LC1, %edx
- movl $LC6, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- movq $stdout, %rax
- movl $LC1, %edx
- movl $LC6, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- cmpl $7, %eax
- je L63
- call abort
- L63:
- movq $stdout, %rax
- movl $0, %edx
- movl $LC7, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- movq $stdout, %rax
- movl $0, %edx
- movl $LC7, %esi
- movq %rax, %rdi
- movl $0, %eax
- call fprintf
- cmpl $2, %eax
- je L64
- call abort
- L64:
- movl $0, %eax
- popq %rbp
- ret