Created
June 14, 2023 03:41
-
-
Save purplejacket/65b63cb7ef81ae1ecb8413eb5903ea45 to your computer and use it in GitHub Desktop.
gcc -S sort2.c -o sort2.gcc.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.section __TEXT,__text,regular,pure_instructions | |
.build_version macos, 13, 0 sdk_version 13, 1 | |
.globl _variable_sort_2 ## -- Begin function variable_sort_2 | |
.p2align 4, 0x90 | |
_variable_sort_2: ## @variable_sort_2 | |
.cfi_startproc | |
## %bb.0: | |
pushq %rbp | |
.cfi_def_cfa_offset 16 | |
.cfi_offset %rbp, -16 | |
movq %rsp, %rbp | |
.cfi_def_cfa_register %rbp | |
movl %edi, -4(%rbp) | |
movq %rsi, -16(%rbp) | |
cmpl $2, -4(%rbp) | |
jne LBB0_4 | |
## %bb.1: | |
movq -16(%rbp), %rax | |
movl (%rax), %eax | |
movq -16(%rbp), %rcx | |
cmpl 4(%rcx), %eax | |
jle LBB0_3 | |
## %bb.2: | |
movq -16(%rbp), %rax | |
movl (%rax), %eax | |
movl %eax, -20(%rbp) | |
movq -16(%rbp), %rax | |
movl 4(%rax), %ecx | |
movq -16(%rbp), %rax | |
movl %ecx, (%rax) | |
movl -20(%rbp), %ecx | |
movq -16(%rbp), %rax | |
movl %ecx, 4(%rax) | |
LBB0_3: | |
jmp LBB0_4 | |
LBB0_4: | |
popq %rbp | |
retq | |
.cfi_endproc | |
## -- End function | |
.globl _main ## -- Begin function main | |
.p2align 4, 0x90 | |
_main: ## @main | |
.cfi_startproc | |
## %bb.0: | |
pushq %rbp | |
.cfi_def_cfa_offset 16 | |
.cfi_offset %rbp, -16 | |
movq %rsp, %rbp | |
.cfi_def_cfa_register %rbp | |
subq $16, %rsp | |
movl $0, -4(%rbp) | |
xorl %edi, %edi | |
leaq _a0(%rip), %rsi | |
callq _variable_sort_2 | |
xorl %eax, %eax | |
addq $16, %rsp | |
popq %rbp | |
retq | |
.cfi_endproc | |
## -- End function | |
.zerofill __DATA,__bss,_a0,1,2 ## @a0 | |
.subsections_via_symbols |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment