Dataset Viewer
source
stringlengths 3
46
| c
stringlengths 31
48.4k
| risc_o0
stringlengths 130
91k
| risc_o1
stringlengths 130
86.5k
| risc_o2
stringlengths 130
94.6k
| risc_o3
stringlengths 130
110k
| arm_o0
stringlengths 132
111k
| arm_o1
stringlengths 132
113k
| arm_o2
stringlengths 132
135k
| arm_o3
stringlengths 132
162k
|
---|---|---|---|---|---|---|---|---|---|
1050.c
|
/*
URI Online Judge | 1050
DDD
Adapted by Neilor Tonin, URI Brazil
https://www.urionlinejudge.com.br/judge/en/problems/view/1050
Timelimit: 1
Read an integer number that is the code number for phone dialing. Then, print the destination according to the following table:
61 Brasilia
71 Salvador
11 Sao Paulo
21 Rio de Janeiro
32 Juiz de Fora
19 Campinas
27 Vitoria
31 Belo Horizonte
If the input number isn’t found in the above table, the output must be:
DDD nao cadastrado
That means “DDD not found” in Portuguese language.
Input
The input consists in a unique integer number.
Output
Print the city name corresponding to the input DDD. Print DDD nao cadastrado if doesn't exist corresponding DDD to the typed number.
@author Marcos Lima
@profile https://www.urionlinejudge.com.br/judge/pt/profile/242402
@status Accepted
@language C (gcc 4.8.5, -O2 -lm) [+0s]
@time 0.000s
@size 795 Bytes
@submission 12/7/19, 1:07:34 PM
*/
#include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
switch (n) {
case 11:
printf("Sao Paulo\n");
break;
case 19:
printf("Campinas\n");
break;
case 21:
printf("Rio de Janeiro\n");
break;
case 27:
printf("Vitoria\n");
break;
case 31:
printf("Belo Horizonte\n");
break;
case 32:
printf("Juiz de Fora\n");
break;
case 71:
printf("Salvador\n");
break;
case 61:
printf("Brasilia\n");
break;
default:
printf("DDD nao cadastrado\n");
break;
}
return 0;
}
|
.file "1050.c"
.option pic
.text
.section .rodata
.align 3
.LC0:
.string "%d"
.align 3
.LC1:
.string "Sao Paulo"
.align 3
.LC2:
.string "Campinas"
.align 3
.LC3:
.string "Rio de Janeiro"
.align 3
.LC4:
.string "Vitoria"
.align 3
.LC5:
.string "Belo Horizonte"
.align 3
.LC6:
.string "Juiz de Fora"
.align 3
.LC7:
.string "Salvador"
.align 3
.LC8:
.string "Brasilia"
.align 3
.LC9:
.string "DDD nao cadastrado"
.text
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-32
sd ra,24(sp)
sd s0,16(sp)
addi s0,sp,32
la a5,__stack_chk_guard
ld a4, 0(a5)
sd a4, -24(s0)
li a4, 0
addi a5,s0,-28
mv a1,a5
lla a0,.LC0
call __isoc99_scanf@plt
lw a5,-28(s0)
addiw a3,a5,-11
sext.w a4,a3
li a5,60
bgtu a4,a5,.L2
slli a5,a3,32
srli a5,a5,32
slli a4,a5,2
lla a5,.L4
add a5,a4,a5
lw a5,0(a5)
sext.w a4,a5
lla a5,.L4
add a5,a4,a5
jr a5
.section .rodata
.align 2
.align 2
.L4:
.word .L11-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L10-.L4
.word .L2-.L4
.word .L9-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L8-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L7-.L4
.word .L6-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L5-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L3-.L4
.text
.L11:
lla a0,.LC1
call puts@plt
j .L12
.L10:
lla a0,.LC2
call puts@plt
j .L12
.L9:
lla a0,.LC3
call puts@plt
j .L12
.L8:
lla a0,.LC4
call puts@plt
j .L12
.L7:
lla a0,.LC5
call puts@plt
j .L12
.L6:
lla a0,.LC6
call puts@plt
j .L12
.L3:
lla a0,.LC7
call puts@plt
j .L12
.L5:
lla a0,.LC8
call puts@plt
j .L12
.L2:
lla a0,.LC9
call puts@plt
nop
.L12:
li a5,0
mv a4,a5
la a5,__stack_chk_guard
ld a3, -24(s0)
ld a5, 0(a5)
xor a5, a3, a5
li a3, 0
beq a5,zero,.L14
call __stack_chk_fail@plt
.L14:
mv a0,a4
ld ra,24(sp)
ld s0,16(sp)
addi sp,sp,32
jr ra
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "1050.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "%d"
.align 3
.LC1:
.string "Sao Paulo"
.align 3
.LC2:
.string "Campinas"
.align 3
.LC3:
.string "Rio de Janeiro"
.align 3
.LC4:
.string "Vitoria"
.align 3
.LC5:
.string "Belo Horizonte"
.align 3
.LC6:
.string "Juiz de Fora"
.align 3
.LC7:
.string "Salvador"
.align 3
.LC8:
.string "Brasilia"
.align 3
.LC9:
.string "DDD nao cadastrado"
.text
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-32
sd ra,24(sp)
la a5,__stack_chk_guard
ld a4, 0(a5)
sd a4, 8(sp)
li a4, 0
addi a1,sp,4
lla a0,.LC0
call __isoc99_scanf@plt
lw a5,4(sp)
addiw a5,a5,-11
sext.w a3,a5
li a4,60
bgtu a3,a4,.L2
slli a4,a5,32
srli a5,a4,30
lla a4,.L4
add a5,a5,a4
lw a5,0(a5)
add a5,a5,a4
jr a5
.section .rodata
.align 2
.align 2
.L4:
.word .L11-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L10-.L4
.word .L2-.L4
.word .L9-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L8-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L7-.L4
.word .L6-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L5-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L3-.L4
.text
.L11:
lla a0,.LC1
call puts@plt
.L12:
la a5,__stack_chk_guard
ld a4, 8(sp)
ld a5, 0(a5)
xor a5, a4, a5
li a4, 0
bne a5,zero,.L15
li a0,0
ld ra,24(sp)
addi sp,sp,32
jr ra
.L10:
lla a0,.LC2
call puts@plt
j .L12
.L9:
lla a0,.LC3
call puts@plt
j .L12
.L8:
lla a0,.LC4
call puts@plt
j .L12
.L7:
lla a0,.LC5
call puts@plt
j .L12
.L6:
lla a0,.LC6
call puts@plt
j .L12
.L3:
lla a0,.LC7
call puts@plt
j .L12
.L5:
lla a0,.LC8
call puts@plt
j .L12
.L2:
lla a0,.LC9
call puts@plt
j .L12
.L15:
call __stack_chk_fail@plt
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "1050.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "%d"
.align 3
.LC1:
.string "Sao Paulo"
.align 3
.LC2:
.string "Campinas"
.align 3
.LC3:
.string "Rio de Janeiro"
.align 3
.LC4:
.string "Vitoria"
.align 3
.LC5:
.string "Belo Horizonte"
.align 3
.LC6:
.string "Juiz de Fora"
.align 3
.LC7:
.string "Salvador"
.align 3
.LC8:
.string "Brasilia"
.align 3
.LC9:
.string "DDD nao cadastrado"
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-32
sd s0,16(sp)
la s0,__stack_chk_guard
ld a5, 0(s0)
sd a5, 8(sp)
li a5, 0
addi a1,sp,4
lla a0,.LC0
sd ra,24(sp)
call __isoc99_scanf@plt
lw a5,4(sp)
li a4,60
addiw a5,a5,-11
sext.w a3,a5
bgtu a3,a4,.L2
slli a3,a5,32
lla a4,.L4
srli a5,a3,30
add a5,a5,a4
lw a5,0(a5)
add a5,a5,a4
jr a5
.section .rodata
.align 2
.align 2
.L4:
.word .L11-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L10-.L4
.word .L2-.L4
.word .L9-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L8-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L7-.L4
.word .L6-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L5-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L3-.L4
.section .text.startup
.L2:
lla a0,.LC9
call puts@plt
.L12:
ld a4, 8(sp)
ld a5, 0(s0)
xor a5, a4, a5
li a4, 0
bne a5,zero,.L16
ld ra,24(sp)
ld s0,16(sp)
li a0,0
addi sp,sp,32
jr ra
.L11:
lla a0,.LC1
call puts@plt
j .L12
.L10:
lla a0,.LC2
call puts@plt
j .L12
.L9:
lla a0,.LC3
call puts@plt
j .L12
.L8:
lla a0,.LC4
call puts@plt
j .L12
.L7:
lla a0,.LC5
call puts@plt
j .L12
.L6:
lla a0,.LC6
call puts@plt
j .L12
.L5:
lla a0,.LC8
call puts@plt
j .L12
.L3:
lla a0,.LC7
call puts@plt
j .L12
.L16:
call __stack_chk_fail@plt
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "1050.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "%d"
.align 3
.LC1:
.string "Sao Paulo"
.align 3
.LC2:
.string "Campinas"
.align 3
.LC3:
.string "Rio de Janeiro"
.align 3
.LC4:
.string "Vitoria"
.align 3
.LC5:
.string "Belo Horizonte"
.align 3
.LC6:
.string "Juiz de Fora"
.align 3
.LC7:
.string "Salvador"
.align 3
.LC8:
.string "Brasilia"
.align 3
.LC9:
.string "DDD nao cadastrado"
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-32
sd s0,16(sp)
la s0,__stack_chk_guard
ld a5, 0(s0)
sd a5, 8(sp)
li a5, 0
addi a1,sp,4
lla a0,.LC0
sd ra,24(sp)
call __isoc99_scanf@plt
lw a5,4(sp)
li a4,60
addiw a5,a5,-11
sext.w a3,a5
bgtu a3,a4,.L2
slli a3,a5,32
lla a4,.L4
srli a5,a3,30
add a5,a5,a4
lw a5,0(a5)
add a5,a5,a4
jr a5
.section .rodata
.align 2
.align 2
.L4:
.word .L11-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L10-.L4
.word .L2-.L4
.word .L9-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L8-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L7-.L4
.word .L6-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L5-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L2-.L4
.word .L3-.L4
.section .text.startup
.L2:
lla a0,.LC9
call puts@plt
.L12:
ld a4, 8(sp)
ld a5, 0(s0)
xor a5, a4, a5
li a4, 0
bne a5,zero,.L16
ld ra,24(sp)
ld s0,16(sp)
li a0,0
addi sp,sp,32
jr ra
.L11:
lla a0,.LC1
call puts@plt
j .L12
.L10:
lla a0,.LC2
call puts@plt
j .L12
.L9:
lla a0,.LC3
call puts@plt
j .L12
.L8:
lla a0,.LC4
call puts@plt
j .L12
.L7:
lla a0,.LC5
call puts@plt
j .L12
.L6:
lla a0,.LC6
call puts@plt
j .L12
.L5:
lla a0,.LC8
call puts@plt
j .L12
.L3:
lla a0,.LC7
call puts@plt
j .L12
.L16:
call __stack_chk_fail@plt
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "1050.c"
.text
.section .rodata
.align 3
.LC0:
.string "%d"
.align 3
.LC1:
.string "Sao Paulo"
.align 3
.LC2:
.string "Campinas"
.align 3
.LC3:
.string "Rio de Janeiro"
.align 3
.LC4:
.string "Vitoria"
.align 3
.LC5:
.string "Belo Horizonte"
.align 3
.LC6:
.string "Juiz de Fora"
.align 3
.LC7:
.string "Salvador"
.align 3
.LC8:
.string "Brasilia"
.align 3
.LC9:
.string "DDD nao cadastrado"
.text
.align 2
.global main
.type main, %function
main:
.LFB0:
.cfi_startproc
stp x29, x30, [sp, -32]!
.cfi_def_cfa_offset 32
.cfi_offset 29, -32
.cfi_offset 30, -24
mov x29, sp
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x1, [x0]
str x1, [sp, 24]
mov x1, 0
add x0, sp, 20
mov x1, x0
adrp x0, .LC0
add x0, x0, :lo12:.LC0
bl __isoc99_scanf
ldr w0, [sp, 20]
cmp w0, 71
beq .L2
cmp w0, 71
bgt .L3
cmp w0, 61
beq .L4
cmp w0, 61
bgt .L3
cmp w0, 32
beq .L5
cmp w0, 32
bgt .L3
cmp w0, 31
beq .L6
cmp w0, 31
bgt .L3
cmp w0, 27
beq .L7
cmp w0, 27
bgt .L3
cmp w0, 21
beq .L8
cmp w0, 21
bgt .L3
cmp w0, 11
beq .L9
cmp w0, 19
beq .L10
b .L3
.L9:
adrp x0, .LC1
add x0, x0, :lo12:.LC1
bl puts
b .L11
.L10:
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl puts
b .L11
.L8:
adrp x0, .LC3
add x0, x0, :lo12:.LC3
bl puts
b .L11
.L7:
adrp x0, .LC4
add x0, x0, :lo12:.LC4
bl puts
b .L11
.L6:
adrp x0, .LC5
add x0, x0, :lo12:.LC5
bl puts
b .L11
.L5:
adrp x0, .LC6
add x0, x0, :lo12:.LC6
bl puts
b .L11
.L2:
adrp x0, .LC7
add x0, x0, :lo12:.LC7
bl puts
b .L11
.L4:
adrp x0, .LC8
add x0, x0, :lo12:.LC8
bl puts
b .L11
.L3:
adrp x0, .LC9
add x0, x0, :lo12:.LC9
bl puts
nop
.L11:
mov w0, 0
mov w1, w0
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x3, [sp, 24]
ldr x2, [x0]
subs x3, x3, x2
mov x2, 0
beq .L13
bl __stack_chk_fail
.L13:
mov w0, w1
ldp x29, x30, [sp], 32
.cfi_restore 30
.cfi_restore 29
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "1050.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "%d"
.align 3
.LC1:
.string "Sao Paulo"
.align 3
.LC2:
.string "Campinas"
.align 3
.LC3:
.string "Rio de Janeiro"
.align 3
.LC4:
.string "Vitoria"
.align 3
.LC5:
.string "Belo Horizonte"
.align 3
.LC6:
.string "Juiz de Fora"
.align 3
.LC7:
.string "Salvador"
.align 3
.LC8:
.string "Brasilia"
.align 3
.LC9:
.string "DDD nao cadastrado"
.text
.align 2
.global main
.type main, %function
main:
.LFB23:
.cfi_startproc
stp x29, x30, [sp, -32]!
.cfi_def_cfa_offset 32
.cfi_offset 29, -32
.cfi_offset 30, -24
mov x29, sp
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x1, [x0]
str x1, [sp, 24]
mov x1, 0
add x1, sp, 20
adrp x0, .LC0
add x0, x0, :lo12:.LC0
bl __isoc99_scanf
ldr w0, [sp, 20]
cmp w0, 31
beq .L2
bgt .L3
cmp w0, 21
beq .L4
ble .L16
cmp w0, 27
bne .L8
adrp x0, .LC4
add x0, x0, :lo12:.LC4
bl puts
b .L13
.L16:
cmp w0, 11
beq .L6
cmp w0, 19
bne .L8
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl puts
b .L13
.L3:
cmp w0, 61
beq .L10
cmp w0, 71
bne .L17
adrp x0, .LC7
add x0, x0, :lo12:.LC7
bl puts
b .L13
.L17:
cmp w0, 32
bne .L8
adrp x0, .LC6
add x0, x0, :lo12:.LC6
bl puts
b .L13
.L6:
adrp x0, .LC1
add x0, x0, :lo12:.LC1
bl puts
.L13:
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x2, [sp, 24]
ldr x1, [x0]
subs x2, x2, x1
mov x1, 0
bne .L18
mov w0, 0
ldp x29, x30, [sp], 32
.cfi_remember_state
.cfi_restore 30
.cfi_restore 29
.cfi_def_cfa_offset 0
ret
.L4:
.cfi_restore_state
adrp x0, .LC3
add x0, x0, :lo12:.LC3
bl puts
b .L13
.L2:
adrp x0, .LC5
add x0, x0, :lo12:.LC5
bl puts
b .L13
.L10:
adrp x0, .LC8
add x0, x0, :lo12:.LC8
bl puts
b .L13
.L8:
adrp x0, .LC9
add x0, x0, :lo12:.LC9
bl puts
b .L13
.L18:
bl __stack_chk_fail
.cfi_endproc
.LFE23:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "1050.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "%d"
.align 3
.LC1:
.string "Sao Paulo"
.align 3
.LC2:
.string "Campinas"
.align 3
.LC3:
.string "Rio de Janeiro"
.align 3
.LC4:
.string "Vitoria"
.align 3
.LC5:
.string "Belo Horizonte"
.align 3
.LC6:
.string "Juiz de Fora"
.align 3
.LC7:
.string "Salvador"
.align 3
.LC8:
.string "Brasilia"
.align 3
.LC9:
.string "DDD nao cadastrado"
.section .text.startup,"ax",@progbits
.align 2
.p2align 4,,11
.global main
.type main, %function
main:
.LFB23:
.cfi_startproc
stp x29, x30, [sp, -32]!
.cfi_def_cfa_offset 32
.cfi_offset 29, -32
.cfi_offset 30, -24
adrp x2, :got:__stack_chk_guard
adrp x0, .LC0
mov x29, sp
ldr x2, [x2, #:got_lo12:__stack_chk_guard]
add x1, sp, 20
add x0, x0, :lo12:.LC0
ldr x3, [x2]
str x3, [sp, 24]
mov x3, 0
bl __isoc99_scanf
ldr w0, [sp, 20]
cmp w0, 31
beq .L2
bgt .L3
cmp w0, 21
beq .L4
ble .L17
cmp w0, 27
bne .L8
adrp x0, .LC4
add x0, x0, :lo12:.LC4
bl puts
.p2align 3,,7
.L13:
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x2, [sp, 24]
ldr x1, [x0]
subs x2, x2, x1
mov x1, 0
bne .L18
mov w0, 0
ldp x29, x30, [sp], 32
.cfi_remember_state
.cfi_restore 30
.cfi_restore 29
.cfi_def_cfa_offset 0
ret
.p2align 2,,3
.L3:
.cfi_restore_state
cmp w0, 61
beq .L10
cmp w0, 71
bne .L19
adrp x0, .LC7
add x0, x0, :lo12:.LC7
bl puts
b .L13
.p2align 2,,3
.L17:
cmp w0, 11
beq .L6
cmp w0, 19
bne .L8
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl puts
b .L13
.L19:
cmp w0, 32
bne .L8
adrp x0, .LC6
add x0, x0, :lo12:.LC6
bl puts
b .L13
.L2:
adrp x0, .LC5
add x0, x0, :lo12:.LC5
bl puts
b .L13
.L4:
adrp x0, .LC3
add x0, x0, :lo12:.LC3
bl puts
b .L13
.L8:
adrp x0, .LC9
add x0, x0, :lo12:.LC9
bl puts
b .L13
.L10:
adrp x0, .LC8
add x0, x0, :lo12:.LC8
bl puts
b .L13
.L6:
adrp x0, .LC1
add x0, x0, :lo12:.LC1
bl puts
b .L13
.L18:
bl __stack_chk_fail
.cfi_endproc
.LFE23:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "1050.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "%d"
.align 3
.LC1:
.string "Sao Paulo"
.align 3
.LC2:
.string "Campinas"
.align 3
.LC3:
.string "Rio de Janeiro"
.align 3
.LC4:
.string "Vitoria"
.align 3
.LC5:
.string "Belo Horizonte"
.align 3
.LC6:
.string "Juiz de Fora"
.align 3
.LC7:
.string "Salvador"
.align 3
.LC8:
.string "Brasilia"
.align 3
.LC9:
.string "DDD nao cadastrado"
.section .text.startup,"ax",@progbits
.align 2
.p2align 4,,11
.global main
.type main, %function
main:
.LFB23:
.cfi_startproc
stp x29, x30, [sp, -32]!
.cfi_def_cfa_offset 32
.cfi_offset 29, -32
.cfi_offset 30, -24
adrp x2, :got:__stack_chk_guard
adrp x0, .LC0
mov x29, sp
ldr x2, [x2, #:got_lo12:__stack_chk_guard]
add x1, sp, 20
add x0, x0, :lo12:.LC0
ldr x3, [x2]
str x3, [sp, 24]
mov x3, 0
bl __isoc99_scanf
ldr w0, [sp, 20]
cmp w0, 31
beq .L2
bgt .L3
cmp w0, 21
beq .L4
ble .L17
cmp w0, 27
bne .L8
adrp x0, .LC4
add x0, x0, :lo12:.LC4
bl puts
.p2align 3,,7
.L13:
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x2, [sp, 24]
ldr x1, [x0]
subs x2, x2, x1
mov x1, 0
bne .L18
mov w0, 0
ldp x29, x30, [sp], 32
.cfi_remember_state
.cfi_restore 30
.cfi_restore 29
.cfi_def_cfa_offset 0
ret
.p2align 2,,3
.L3:
.cfi_restore_state
cmp w0, 61
beq .L10
cmp w0, 71
bne .L19
adrp x0, .LC7
add x0, x0, :lo12:.LC7
bl puts
b .L13
.p2align 2,,3
.L17:
cmp w0, 11
beq .L6
cmp w0, 19
bne .L8
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl puts
b .L13
.L19:
cmp w0, 32
bne .L8
adrp x0, .LC6
add x0, x0, :lo12:.LC6
bl puts
b .L13
.L2:
adrp x0, .LC5
add x0, x0, :lo12:.LC5
bl puts
b .L13
.L4:
adrp x0, .LC3
add x0, x0, :lo12:.LC3
bl puts
b .L13
.L8:
adrp x0, .LC9
add x0, x0, :lo12:.LC9
bl puts
b .L13
.L10:
adrp x0, .LC8
add x0, x0, :lo12:.LC8
bl puts
b .L13
.L6:
adrp x0, .LC1
add x0, x0, :lo12:.LC1
bl puts
b .L13
.L18:
bl __stack_chk_fail
.cfi_endproc
.LFE23:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
pointers.c
|
void func() {
char* string = "Hello";
}
|
.file "pointers.c"
.option pic
.text
.section .rodata
.align 3
.LC0:
.string "Hello"
.text
.align 1
.globl func
.type func, @function
func:
addi sp,sp,-32
sd s0,24(sp)
addi s0,sp,32
lla a5,.LC0
sd a5,-24(s0)
nop
ld s0,24(sp)
addi sp,sp,32
jr ra
.size func, .-func
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "pointers.c"
.option pic
.text
.align 1
.globl func
.type func, @function
func:
ret
.size func, .-func
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "pointers.c"
.option pic
.text
.align 1
.globl func
.type func, @function
func:
ret
.size func, .-func
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "pointers.c"
.option pic
.text
.align 1
.globl func
.type func, @function
func:
ret
.size func, .-func
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "pointers.c"
.text
.section .rodata
.align 3
.LC0:
.string "Hello"
.text
.align 2
.global func
.type func, %function
func:
.LFB0:
.cfi_startproc
sub sp, sp, #16
.cfi_def_cfa_offset 16
adrp x0, .LC0
add x0, x0, :lo12:.LC0
str x0, [sp, 8]
nop
add sp, sp, 16
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE0:
.size func, .-func
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "pointers.c"
.text
.align 2
.global func
.type func, %function
func:
.LFB0:
.cfi_startproc
ret
.cfi_endproc
.LFE0:
.size func, .-func
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "pointers.c"
.text
.align 2
.p2align 4,,11
.global func
.type func, %function
func:
.LFB0:
.cfi_startproc
ret
.cfi_endproc
.LFE0:
.size func, .-func
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "pointers.c"
.text
.align 2
.p2align 4,,11
.global func
.type func, %function
func:
.LFB0:
.cfi_startproc
ret
.cfi_endproc
.LFE0:
.size func, .-func
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
Wstring-literal-comparison-3.c
|
/* PR c/7776 */
/* { dg-do compile } */
/* { dg-options "" } */
int test1(char *ptr)
{
return ptr == "foo";
}
int test2()
{
return "foo" != (const char*)0;
}
int test3()
{
return "foo" == (const char*)0;
}
int test4()
{
return (const char*)0 != "foo";
}
int test5()
{
return (const char*)0 == "foo";
}
|
.file "Wstring-literal-comparison-3.c"
.option pic
.text
.section .rodata
.align 3
.LC0:
.string "foo"
.text
.align 1
.globl test1
.type test1, @function
test1:
addi sp,sp,-32
sd s0,24(sp)
addi s0,sp,32
sd a0,-24(s0)
ld a4,-24(s0)
lla a5,.LC0
sub a5,a4,a5
seqz a5,a5
andi a5,a5,0xff
sext.w a5,a5
mv a0,a5
ld s0,24(sp)
addi sp,sp,32
jr ra
.size test1, .-test1
.align 1
.globl test2
.type test2, @function
test2:
addi sp,sp,-16
sd s0,8(sp)
addi s0,sp,16
li a5,1
mv a0,a5
ld s0,8(sp)
addi sp,sp,16
jr ra
.size test2, .-test2
.align 1
.globl test3
.type test3, @function
test3:
addi sp,sp,-16
sd s0,8(sp)
addi s0,sp,16
li a5,0
mv a0,a5
ld s0,8(sp)
addi sp,sp,16
jr ra
.size test3, .-test3
.align 1
.globl test4
.type test4, @function
test4:
addi sp,sp,-16
sd s0,8(sp)
addi s0,sp,16
li a5,1
mv a0,a5
ld s0,8(sp)
addi sp,sp,16
jr ra
.size test4, .-test4
.align 1
.globl test5
.type test5, @function
test5:
addi sp,sp,-16
sd s0,8(sp)
addi s0,sp,16
li a5,0
mv a0,a5
ld s0,8(sp)
addi sp,sp,16
jr ra
.size test5, .-test5
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "Wstring-literal-comparison-3.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "foo"
.text
.align 1
.globl test1
.type test1, @function
test1:
lla a5,.LC0
sub a0,a0,a5
seqz a0,a0
ret
.size test1, .-test1
.align 1
.globl test2
.type test2, @function
test2:
li a0,1
ret
.size test2, .-test2
.align 1
.globl test3
.type test3, @function
test3:
li a0,0
ret
.size test3, .-test3
.align 1
.globl test4
.type test4, @function
test4:
li a0,1
ret
.size test4, .-test4
.align 1
.globl test5
.type test5, @function
test5:
li a0,0
ret
.size test5, .-test5
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "Wstring-literal-comparison-3.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "foo"
.text
.align 1
.globl test1
.type test1, @function
test1:
lla a5,.LC0
sub a0,a0,a5
seqz a0,a0
ret
.size test1, .-test1
.align 1
.globl test2
.type test2, @function
test2:
li a0,1
ret
.size test2, .-test2
.align 1
.globl test3
.type test3, @function
test3:
li a0,0
ret
.size test3, .-test3
.align 1
.globl test4
.type test4, @function
test4:
li a0,1
ret
.size test4, .-test4
.align 1
.globl test5
.type test5, @function
test5:
li a0,0
ret
.size test5, .-test5
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "Wstring-literal-comparison-3.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "foo"
.text
.align 1
.globl test1
.type test1, @function
test1:
lla a5,.LC0
sub a0,a0,a5
seqz a0,a0
ret
.size test1, .-test1
.align 1
.globl test2
.type test2, @function
test2:
li a0,1
ret
.size test2, .-test2
.align 1
.globl test3
.type test3, @function
test3:
li a0,0
ret
.size test3, .-test3
.align 1
.globl test4
.type test4, @function
test4:
li a0,1
ret
.size test4, .-test4
.align 1
.globl test5
.type test5, @function
test5:
li a0,0
ret
.size test5, .-test5
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "Wstring-literal-comparison-3.c"
.text
.section .rodata
.align 3
.LC0:
.string "foo"
.text
.align 2
.global test1
.type test1, %function
test1:
.LFB0:
.cfi_startproc
sub sp, sp, #16
.cfi_def_cfa_offset 16
str x0, [sp, 8]
ldr x1, [sp, 8]
adrp x0, .LC0
add x0, x0, :lo12:.LC0
cmp x1, x0
cset w0, eq
and w0, w0, 255
add sp, sp, 16
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE0:
.size test1, .-test1
.align 2
.global test2
.type test2, %function
test2:
.LFB1:
.cfi_startproc
mov w0, 1
ret
.cfi_endproc
.LFE1:
.size test2, .-test2
.align 2
.global test3
.type test3, %function
test3:
.LFB2:
.cfi_startproc
mov w0, 0
ret
.cfi_endproc
.LFE2:
.size test3, .-test3
.align 2
.global test4
.type test4, %function
test4:
.LFB3:
.cfi_startproc
mov w0, 1
ret
.cfi_endproc
.LFE3:
.size test4, .-test4
.align 2
.global test5
.type test5, %function
test5:
.LFB4:
.cfi_startproc
mov w0, 0
ret
.cfi_endproc
.LFE4:
.size test5, .-test5
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "Wstring-literal-comparison-3.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "foo"
.text
.align 2
.global test1
.type test1, %function
test1:
.LFB0:
.cfi_startproc
adrp x1, .LC0
add x1, x1, :lo12:.LC0
cmp x1, x0
cset w0, eq
ret
.cfi_endproc
.LFE0:
.size test1, .-test1
.align 2
.global test2
.type test2, %function
test2:
.LFB1:
.cfi_startproc
mov w0, 1
ret
.cfi_endproc
.LFE1:
.size test2, .-test2
.align 2
.global test3
.type test3, %function
test3:
.LFB2:
.cfi_startproc
mov w0, 0
ret
.cfi_endproc
.LFE2:
.size test3, .-test3
.align 2
.global test4
.type test4, %function
test4:
.LFB3:
.cfi_startproc
mov w0, 1
ret
.cfi_endproc
.LFE3:
.size test4, .-test4
.align 2
.global test5
.type test5, %function
test5:
.LFB4:
.cfi_startproc
mov w0, 0
ret
.cfi_endproc
.LFE4:
.size test5, .-test5
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "Wstring-literal-comparison-3.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "foo"
.text
.align 2
.p2align 4,,11
.global test1
.type test1, %function
test1:
.LFB0:
.cfi_startproc
adrp x1, .LC0
add x1, x1, :lo12:.LC0
cmp x1, x0
cset w0, eq
ret
.cfi_endproc
.LFE0:
.size test1, .-test1
.align 2
.p2align 4,,11
.global test2
.type test2, %function
test2:
.LFB1:
.cfi_startproc
mov w0, 1
ret
.cfi_endproc
.LFE1:
.size test2, .-test2
.align 2
.p2align 4,,11
.global test3
.type test3, %function
test3:
.LFB2:
.cfi_startproc
mov w0, 0
ret
.cfi_endproc
.LFE2:
.size test3, .-test3
.align 2
.p2align 4,,11
.global test4
.type test4, %function
test4:
.LFB6:
.cfi_startproc
mov w0, 1
ret
.cfi_endproc
.LFE6:
.size test4, .-test4
.align 2
.p2align 4,,11
.global test5
.type test5, %function
test5:
.LFB8:
.cfi_startproc
mov w0, 0
ret
.cfi_endproc
.LFE8:
.size test5, .-test5
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "Wstring-literal-comparison-3.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "foo"
.text
.align 2
.p2align 4,,11
.global test1
.type test1, %function
test1:
.LFB0:
.cfi_startproc
adrp x1, .LC0
add x1, x1, :lo12:.LC0
cmp x1, x0
cset w0, eq
ret
.cfi_endproc
.LFE0:
.size test1, .-test1
.align 2
.p2align 4,,11
.global test2
.type test2, %function
test2:
.LFB1:
.cfi_startproc
mov w0, 1
ret
.cfi_endproc
.LFE1:
.size test2, .-test2
.align 2
.p2align 4,,11
.global test3
.type test3, %function
test3:
.LFB2:
.cfi_startproc
mov w0, 0
ret
.cfi_endproc
.LFE2:
.size test3, .-test3
.align 2
.p2align 4,,11
.global test4
.type test4, %function
test4:
.LFB6:
.cfi_startproc
mov w0, 1
ret
.cfi_endproc
.LFE6:
.size test4, .-test4
.align 2
.p2align 4,,11
.global test5
.type test5, %function
test5:
.LFB8:
.cfi_startproc
mov w0, 0
ret
.cfi_endproc
.LFE8:
.size test5, .-test5
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
hex2bin.c
|
/*
* hex2bin - converts data in hexadecimal form to binary form
*
* Copyright (C) 2013 Jonathan Buhacoff <[email protected]>
*
* BSD license.
*
* Input must contain only hex characters. Any other characters will result in an error
* printed to stderr and exit code 1. On success exit code is 0.
*
* Would be nice to add an option in the future to support hex files with
* comment lines starting with #, and to ignore blank lines and newline characters.
*
* because of how runCommand function works we now pass the hash on the command line
* Example:
*
* hex2bin hexString binaryFile
*
* change log:
* 1/24: now pass hex string as argv[1] and the binary file to write to as argv[2]
* 9/8/16: replacing sscanf banned function by hex2int()
*/
#include <stdio.h>
#include <stdlib.h>
/*
* Input: hexadecimal character in the range 0..9 or A..F case-insensitive
* Output: decimal value of input in the range 0..15
* or -1 if the input was not a valid hexadecimal character
*/
int hex2int(const char c)
{
if(c >= '0' && c<= '9') {
return c - '0';
}
else if( c >= 'A' && c <= 'F' ) {
return c - 'A' + 10;
}
else if( c >= 'a' && c <= 'f' ) {
return c - 'a' + 10;
}
else {
return -1;
}
}
int main(int argc, char **argv) {
if(argc != 3) {
printf("usuage is: hex2bin hexString binaryFile");
exit(-1);
}
int b, j=0, hex1, hex2;
FILE* outFile = fopen(argv[2],"w");
//printf("argv %s\n", argv[1]);
unsigned int iHexLen=0;
while(*(argv[1]+iHexLen) ) iHexLen++;
//printf("iHexlen %d\n", iHexLen);
if( iHexLen % 2 != 0 ) {
fprintf(stderr, "invalid hex length\n"); exit(1); // invalid length for hex
}
for(j=0; j<iHexLen-1; j=j+2) {
hex1 = hex2int(argv[1][j]);
hex2 = hex2int(argv[1][j+1]);
if(hex1 == -1 || hex2 == -1) {
fprintf(stderr, "non-hex input\n"); exit(1);
}
b = (hex1*16) + hex2;
if(outFile != NULL)
fputc(b, outFile);
//printf("b: %d\n", b);
}
if(outFile != NULL)
fclose(outFile);
exit(0);
}
|
.file "hex2bin.c"
.option pic
.text
.align 1
.globl hex2int
.type hex2int, @function
hex2int:
addi sp,sp,-32
sd s0,24(sp)
addi s0,sp,32
mv a5,a0
sb a5,-17(s0)
lbu a5,-17(s0)
andi a4,a5,0xff
li a5,47
bleu a4,a5,.L2
lbu a5,-17(s0)
andi a4,a5,0xff
li a5,57
bgtu a4,a5,.L2
lbu a5,-17(s0)
sext.w a5,a5
addiw a5,a5,-48
sext.w a5,a5
j .L3
.L2:
lbu a5,-17(s0)
andi a4,a5,0xff
li a5,64
bleu a4,a5,.L4
lbu a5,-17(s0)
andi a4,a5,0xff
li a5,70
bgtu a4,a5,.L4
lbu a5,-17(s0)
sext.w a5,a5
addiw a5,a5,-55
sext.w a5,a5
j .L3
.L4:
lbu a5,-17(s0)
andi a4,a5,0xff
li a5,96
bleu a4,a5,.L5
lbu a5,-17(s0)
andi a4,a5,0xff
li a5,102
bgtu a4,a5,.L5
lbu a5,-17(s0)
sext.w a5,a5
addiw a5,a5,-87
sext.w a5,a5
j .L3
.L5:
li a5,-1
.L3:
mv a0,a5
ld s0,24(sp)
addi sp,sp,32
jr ra
.size hex2int, .-hex2int
.section .rodata
.align 3
.LC0:
.string "usuage is: hex2bin hexString binaryFile"
.align 3
.LC1:
.string "w"
.align 3
.LC2:
.string "invalid hex length\n"
.align 3
.LC3:
.string "non-hex input\n"
.text
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-64
sd ra,56(sp)
sd s0,48(sp)
addi s0,sp,64
mv a5,a0
sd a1,-64(s0)
sw a5,-52(s0)
lw a5,-52(s0)
sext.w a4,a5
li a5,3
beq a4,a5,.L7
lla a0,.LC0
call printf@plt
li a0,-1
call exit@plt
.L7:
sw zero,-44(s0)
ld a5,-64(s0)
addi a5,a5,16
ld a5,0(a5)
lla a1,.LC1
mv a0,a5
call fopen@plt
mv a5,a0
sd a5,-24(s0)
sw zero,-40(s0)
j .L8
.L9:
lw a5,-40(s0)
addiw a5,a5,1
sw a5,-40(s0)
.L8:
ld a5,-64(s0)
addi a5,a5,8
ld a4,0(a5)
lwu a5,-40(s0)
add a5,a4,a5
lbu a5,0(a5)
bne a5,zero,.L9
lw a5,-40(s0)
andi a5,a5,1
sext.w a5,a5
beq a5,zero,.L10
la a5,stderr
ld a5,0(a5)
mv a3,a5
li a2,19
li a1,1
lla a0,.LC2
call fwrite@plt
li a0,1
call exit@plt
.L10:
sw zero,-44(s0)
j .L11
.L15:
ld a5,-64(s0)
addi a5,a5,8
ld a4,0(a5)
lw a5,-44(s0)
add a5,a4,a5
lbu a5,0(a5)
mv a0,a5
call hex2int
mv a5,a0
sw a5,-36(s0)
ld a5,-64(s0)
addi a5,a5,8
ld a4,0(a5)
lw a5,-44(s0)
addi a5,a5,1
add a5,a4,a5
lbu a5,0(a5)
mv a0,a5
call hex2int
mv a5,a0
sw a5,-32(s0)
lw a5,-36(s0)
sext.w a4,a5
li a5,-1
beq a4,a5,.L12
lw a5,-32(s0)
sext.w a4,a5
li a5,-1
bne a4,a5,.L13
.L12:
la a5,stderr
ld a5,0(a5)
mv a3,a5
li a2,14
li a1,1
lla a0,.LC3
call fwrite@plt
li a0,1
call exit@plt
.L13:
lw a5,-36(s0)
slliw a5,a5,4
sext.w a5,a5
lw a4,-32(s0)
addw a5,a4,a5
sw a5,-28(s0)
ld a5,-24(s0)
beq a5,zero,.L14
lw a5,-28(s0)
ld a1,-24(s0)
mv a0,a5
call fputc@plt
.L14:
lw a5,-44(s0)
addiw a5,a5,2
sw a5,-44(s0)
.L11:
lw a5,-40(s0)
addiw a5,a5,-1
sext.w a4,a5
lw a5,-44(s0)
bgtu a4,a5,.L15
ld a5,-24(s0)
beq a5,zero,.L16
ld a0,-24(s0)
call fclose@plt
.L16:
li a0,0
call exit@plt
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "hex2bin.c"
.option pic
.text
.align 1
.globl hex2int
.type hex2int, @function
hex2int:
addiw a5,a0,-48
andi a5,a5,0xff
li a4,9
bleu a5,a4,.L6
addiw a5,a0,-65
andi a5,a5,0xff
li a4,5
bleu a5,a4,.L7
addiw a5,a0,-97
andi a5,a5,0xff
li a4,5
bgtu a5,a4,.L5
addiw a0,a0,-87
ret
.L6:
addiw a0,a0,-48
ret
.L7:
addiw a0,a0,-55
ret
.L5:
li a0,-1
ret
.size hex2int, .-hex2int
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "usuage is: hex2bin hexString binaryFile"
.align 3
.LC1:
.string "w"
.align 3
.LC2:
.string "invalid hex length\n"
.align 3
.LC3:
.string "non-hex input\n"
.text
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-64
sd ra,56(sp)
sd s0,48(sp)
sd s1,40(sp)
sd s2,32(sp)
sd s3,24(sp)
sd s4,16(sp)
sd s5,8(sp)
sd s6,0(sp)
li a5,3
beq a0,a5,.L9
lla a1,.LC0
li a0,1
call __printf_chk@plt
li a0,-1
call exit@plt
.L9:
mv s2,a1
lla a1,.LC1
ld a0,16(s2)
call fopen@plt
mv s3,a0
ld a3,8(s2)
lbu a5,0(a3)
beq a5,zero,.L19
li a4,0
.L11:
sext.w s4,a4
addiw a5,a4,1
sext.w a4,a5
slli a5,a5,32
srli a5,a5,32
add a5,a3,a5
lbu a5,0(a5)
bne a5,zero,.L11
andi a4,a4,1
bne a4,zero,.L12
beq s4,zero,.L13
.L10:
li s5,0
li s6,-1
.L17:
ld s1,8(s2)
add s1,s1,s5
lbu a0,0(s1)
call hex2int
mv s0,a0
lbu a0,1(s1)
call hex2int
beq s0,s6,.L14
beq a0,s6,.L14
slliw s0,s0,4
addw a0,s0,a0
beq s3,zero,.L16
mv a1,s3
call fputc@plt
.L16:
addi s5,s5,2
sext.w a5,s5
bgtu s4,a5,.L17
.L13:
beq s3,zero,.L18
mv a0,s3
call fclose@plt
.L18:
li a0,0
call exit@plt
.L12:
la a5,stderr
ld a3,0(a5)
li a2,19
li a1,1
lla a0,.LC2
call fwrite@plt
li a0,1
call exit@plt
.L19:
li s4,-1
j .L10
.L14:
la a5,stderr
ld a3,0(a5)
li a2,14
li a1,1
lla a0,.LC3
call fwrite@plt
li a0,1
call exit@plt
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "hex2bin.c"
.option pic
.text
.align 1
.globl hex2int
.type hex2int, @function
hex2int:
addiw a5,a0,-48
andi a3,a5,0xff
li a4,9
bleu a3,a4,.L7
addiw a5,a0,-65
andi a5,a5,0xff
li a4,5
bleu a5,a4,.L8
addiw a5,a0,-97
andi a5,a5,0xff
bgtu a5,a4,.L5
addiw a0,a0,-87
ret
.L8:
addiw a0,a0,-55
ret
.L7:
sext.w a0,a5
ret
.L5:
li a0,-1
ret
.size hex2int, .-hex2int
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "usuage is: hex2bin hexString binaryFile"
.align 3
.LC1:
.string "w"
.align 3
.LC2:
.string "invalid hex length\n"
.align 3
.LC3:
.string "non-hex input\n"
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-64
sd ra,56(sp)
sd s0,48(sp)
sd s1,40(sp)
sd s2,32(sp)
sd s3,24(sp)
sd s4,16(sp)
sd s5,8(sp)
sd s6,0(sp)
li a5,3
beq a0,a5,.L10
lla a1,.LC0
li a0,1
call __printf_chk@plt
li a0,-1
call exit@plt
.L10:
ld a0,16(a1)
mv s0,a1
lla a1,.LC1
call fopen@plt
ld a5,8(s0)
mv s3,a0
lbu a4,0(a5)
beq a4,zero,.L26
li a3,0
.L12:
addiw a2,a3,1
slli a4,a2,32
srli a4,a4,32
add a4,a5,a4
lbu a4,0(a4)
sext.w s4,a3
sext.w a3,a2
bne a4,zero,.L12
andi a3,a3,1
bne a3,zero,.L13
beq s4,zero,.L14
.L11:
li s1,0
add a4,a5,s1
lbu a5,0(a4)
li s6,9
li s5,5
addiw a3,a5,-48
andi a2,a3,0xff
li s2,-1
bleu a2,s6,.L38
.L15:
addiw a3,a5,-65
andi a3,a3,0xff
bleu a3,s5,.L39
addiw a3,a5,-97
andi a3,a3,0xff
bgtu a3,s5,.L27
addiw a5,a5,-87
.L16:
lbu a4,1(a4)
addiw a3,a4,-48
andi a2,a3,0xff
bleu a2,s6,.L40
.L18:
addiw a3,a4,-65
andi a3,a3,0xff
bleu a3,s5,.L41
addiw a3,a4,-97
andi a3,a3,0xff
bgtu a3,s5,.L21
addiw a4,a4,-87
.L19:
beq a5,s2,.L21
.L36:
slliw a5,a5,4
addw a0,a5,a4
beq s3,zero,.L22
mv a1,s3
call fputc@plt
.L22:
addi s1,s1,2
sext.w a5,s1
bleu s4,a5,.L14
ld a5,8(s0)
add a4,a5,s1
lbu a5,0(a4)
addiw a3,a5,-48
andi a2,a3,0xff
bgtu a2,s6,.L15
.L38:
lbu a4,1(a4)
sext.w a5,a3
addiw a3,a4,-48
andi a2,a3,0xff
bgtu a2,s6,.L18
.L40:
sext.w a4,a3
bne a5,s2,.L36
.L21:
la a5,stderr
ld a3,0(a5)
li a2,14
li a1,1
lla a0,.LC3
call fwrite@plt
li a0,1
call exit@plt
.L13:
la a5,stderr
ld a3,0(a5)
li a2,19
li a1,1
lla a0,.LC2
call fwrite@plt
li a0,1
call exit@plt
.L39:
addiw a5,a5,-55
j .L16
.L41:
addiw a4,a4,-55
j .L19
.L14:
beq s3,zero,.L24
mv a0,s3
call fclose@plt
.L24:
li a0,0
call exit@plt
.L26:
li s4,-1
j .L11
.L27:
li a5,-1
j .L16
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "hex2bin.c"
.option pic
.text
.align 1
.globl hex2int
.type hex2int, @function
hex2int:
addiw a5,a0,-48
andi a3,a5,0xff
li a4,9
bleu a3,a4,.L7
addiw a5,a0,-65
andi a5,a5,0xff
li a4,5
bleu a5,a4,.L8
addiw a5,a0,-97
andi a5,a5,0xff
bgtu a5,a4,.L5
addiw a0,a0,-87
ret
.L8:
addiw a0,a0,-55
ret
.L7:
sext.w a0,a5
ret
.L5:
li a0,-1
ret
.size hex2int, .-hex2int
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "usuage is: hex2bin hexString binaryFile"
.align 3
.LC1:
.string "w"
.align 3
.LC2:
.string "invalid hex length\n"
.align 3
.LC3:
.string "non-hex input\n"
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-64
sd ra,56(sp)
sd s0,48(sp)
sd s1,40(sp)
sd s2,32(sp)
sd s3,24(sp)
sd s4,16(sp)
sd s5,8(sp)
sd s6,0(sp)
li a5,3
beq a0,a5,.L10
lla a1,.LC0
li a0,1
call __printf_chk@plt
li a0,-1
call exit@plt
.L10:
ld a0,16(a1)
mv s0,a1
lla a1,.LC1
call fopen@plt
ld a5,8(s0)
mv s1,a0
lbu a4,0(a5)
beq a4,zero,.L29
li a3,0
.L12:
addiw a2,a3,1
slli a4,a2,32
srli a4,a4,32
add a4,a5,a4
lbu a4,0(a4)
sext.w s4,a3
sext.w a3,a2
bne a4,zero,.L12
andi a3,a3,1
bne a3,zero,.L13
beq s4,zero,.L43
.L11:
li s2,0
beq s1,zero,.L40
add a4,a5,s2
lbu a5,0(a4)
li s6,9
li s5,5
addiw a3,a5,-48
andi a2,a3,0xff
li s3,-1
bleu a2,s6,.L44
.L20:
addiw a3,a5,-65
andi a3,a3,0xff
bleu a3,s5,.L45
addiw a3,a5,-97
andi a3,a3,0xff
bgtu a3,s5,.L31
addiw a5,a5,-87
.L21:
lbu a4,1(a4)
addiw a3,a4,-48
andi a2,a3,0xff
sext.w a0,a3
bleu a2,s6,.L24
addiw a3,a4,-65
andi a3,a3,0xff
addiw a0,a4,-55
bleu a3,s5,.L24
addiw a3,a4,-97
andi a3,a3,0xff
bgtu a3,s5,.L17
addiw a0,a4,-87
.L24:
beq a5,s3,.L17
slliw a5,a5,4
addw a0,a5,a0
mv a1,s1
addi s2,s2,2
call fputc@plt
sext.w a5,s2
bgeu a5,s4,.L26
ld a5,8(s0)
add a4,a5,s2
lbu a5,0(a4)
addiw a3,a5,-48
andi a2,a3,0xff
bgtu a2,s6,.L20
.L44:
sext.w a5,a3
j .L21
.L13:
la a5,stderr
ld a3,0(a5)
li a2,19
li a1,1
lla a0,.LC2
call fwrite@plt
li a0,1
call exit@plt
.L45:
addiw a5,a5,-55
j .L21
.L40:
li a3,0
li a0,9
li a2,5
j .L18
.L28:
addi a3,a3,2
sext.w a4,a3
bgeu a4,s4,.L19
.L18:
add a6,a5,a3
lbu a4,0(a6)
addiw a1,a4,-48
andi a1,a1,0xff
bleu a1,a0,.L16
addiw a1,a4,-65
andi a1,a1,0xff
bleu a1,a2,.L16
addiw a4,a4,-97
andi a4,a4,0xff
bgtu a4,a2,.L17
.L16:
lbu a4,1(a6)
addiw a1,a4,-48
andi a1,a1,0xff
bleu a1,a0,.L28
andi a4,a4,-33
addiw a4,a4,-65
andi a4,a4,0xff
bleu a4,a2,.L28
.L17:
la a5,stderr
ld a3,0(a5)
li a2,14
li a1,1
lla a0,.LC3
call fwrite@plt
li a0,1
call exit@plt
.L43:
beq s1,zero,.L19
.L26:
mv a0,s1
call fclose@plt
.L19:
li a0,0
call exit@plt
.L29:
li s4,-1
j .L11
.L31:
li a5,-1
j .L21
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "hex2bin.c"
.text
.align 2
.global hex2int
.type hex2int, %function
hex2int:
.LFB6:
.cfi_startproc
sub sp, sp, #16
.cfi_def_cfa_offset 16
strb w0, [sp, 15]
ldrb w0, [sp, 15]
cmp w0, 47
bls .L2
ldrb w0, [sp, 15]
cmp w0, 57
bhi .L2
ldrb w0, [sp, 15]
sub w0, w0, #48
b .L3
.L2:
ldrb w0, [sp, 15]
cmp w0, 64
bls .L4
ldrb w0, [sp, 15]
cmp w0, 70
bhi .L4
ldrb w0, [sp, 15]
sub w0, w0, #55
b .L3
.L4:
ldrb w0, [sp, 15]
cmp w0, 96
bls .L5
ldrb w0, [sp, 15]
cmp w0, 102
bhi .L5
ldrb w0, [sp, 15]
sub w0, w0, #87
b .L3
.L5:
mov w0, -1
.L3:
add sp, sp, 16
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE6:
.size hex2int, .-hex2int
.section .rodata
.align 3
.LC0:
.string "usuage is: hex2bin hexString binaryFile"
.align 3
.LC1:
.string "w"
.align 3
.LC2:
.string "invalid hex length\n"
.align 3
.LC3:
.string "non-hex input\n"
.text
.align 2
.global main
.type main, %function
main:
.LFB7:
.cfi_startproc
stp x29, x30, [sp, -64]!
.cfi_def_cfa_offset 64
.cfi_offset 29, -64
.cfi_offset 30, -56
mov x29, sp
str w0, [sp, 28]
str x1, [sp, 16]
ldr w0, [sp, 28]
cmp w0, 3
beq .L7
adrp x0, .LC0
add x0, x0, :lo12:.LC0
bl printf
mov w0, -1
bl exit
.L7:
str wzr, [sp, 36]
ldr x0, [sp, 16]
add x0, x0, 16
ldr x2, [x0]
adrp x0, .LC1
add x1, x0, :lo12:.LC1
mov x0, x2
bl fopen
str x0, [sp, 56]
str wzr, [sp, 40]
b .L8
.L9:
ldr w0, [sp, 40]
add w0, w0, 1
str w0, [sp, 40]
.L8:
ldr x0, [sp, 16]
add x0, x0, 8
ldr x1, [x0]
ldr w0, [sp, 40]
add x0, x1, x0
ldrb w0, [x0]
cmp w0, 0
bne .L9
ldr w0, [sp, 40]
and w0, w0, 1
cmp w0, 0
beq .L10
adrp x0, :got:stderr
ldr x0, [x0, #:got_lo12:stderr]
ldr x0, [x0]
mov x3, x0
mov x2, 19
mov x1, 1
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl fwrite
mov w0, 1
bl exit
.L10:
str wzr, [sp, 36]
b .L11
.L15:
ldr x0, [sp, 16]
add x0, x0, 8
ldr x1, [x0]
ldrsw x0, [sp, 36]
add x0, x1, x0
ldrb w0, [x0]
bl hex2int
str w0, [sp, 44]
ldr x0, [sp, 16]
add x0, x0, 8
ldr x1, [x0]
ldrsw x0, [sp, 36]
add x0, x0, 1
add x0, x1, x0
ldrb w0, [x0]
bl hex2int
str w0, [sp, 48]
ldr w0, [sp, 44]
cmn w0, #1
beq .L12
ldr w0, [sp, 48]
cmn w0, #1
bne .L13
.L12:
adrp x0, :got:stderr
ldr x0, [x0, #:got_lo12:stderr]
ldr x0, [x0]
mov x3, x0
mov x2, 14
mov x1, 1
adrp x0, .LC3
add x0, x0, :lo12:.LC3
bl fwrite
mov w0, 1
bl exit
.L13:
ldr w0, [sp, 44]
lsl w0, w0, 4
ldr w1, [sp, 48]
add w0, w1, w0
str w0, [sp, 52]
ldr x0, [sp, 56]
cmp x0, 0
beq .L14
ldr x1, [sp, 56]
ldr w0, [sp, 52]
bl fputc
.L14:
ldr w0, [sp, 36]
add w0, w0, 2
str w0, [sp, 36]
.L11:
ldr w0, [sp, 40]
sub w1, w0, #1
ldr w0, [sp, 36]
cmp w1, w0
bhi .L15
ldr x0, [sp, 56]
cmp x0, 0
beq .L16
ldr x0, [sp, 56]
bl fclose
.L16:
mov w0, 0
bl exit
.cfi_endproc
.LFE7:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "hex2bin.c"
.text
.align 2
.global hex2int
.type hex2int, %function
hex2int:
.LFB39:
.cfi_startproc
and w0, w0, 255
sub w1, w0, #48
and w1, w1, 255
cmp w1, 9
bls .L6
sub w1, w0, #65
and w1, w1, 255
cmp w1, 5
bls .L7
sub w1, w0, #97
and w1, w1, 255
cmp w1, 5
bhi .L5
sub w0, w0, #87
.L1:
ret
.L6:
sub w0, w0, #48
b .L1
.L7:
sub w0, w0, #55
b .L1
.L5:
mov w0, -1
b .L1
.cfi_endproc
.LFE39:
.size hex2int, .-hex2int
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "usuage is: hex2bin hexString binaryFile"
.align 3
.LC1:
.string "w"
.align 3
.LC2:
.string "invalid hex length\n"
.align 3
.LC3:
.string "non-hex input\n"
.text
.align 2
.global main
.type main, %function
main:
.LFB40:
.cfi_startproc
stp x29, x30, [sp, -64]!
.cfi_def_cfa_offset 64
.cfi_offset 29, -64
.cfi_offset 30, -56
mov x29, sp
cmp w0, 3
beq .L9
stp x19, x20, [sp, 16]
.cfi_remember_state
.cfi_offset 20, -40
.cfi_offset 19, -48
stp x21, x22, [sp, 32]
.cfi_offset 22, -24
.cfi_offset 21, -32
stp x23, x24, [sp, 48]
.cfi_offset 24, -8
.cfi_offset 23, -16
adrp x1, .LC0
add x1, x1, :lo12:.LC0
mov w0, 1
bl __printf_chk
mov w0, -1
bl exit
.L9:
.cfi_restore_state
stp x19, x20, [sp, 16]
.cfi_offset 20, -40
.cfi_offset 19, -48
stp x21, x22, [sp, 32]
.cfi_offset 22, -24
.cfi_offset 21, -32
stp x23, x24, [sp, 48]
.cfi_offset 24, -8
.cfi_offset 23, -16
mov x21, x1
adrp x1, .LC1
add x1, x1, :lo12:.LC1
ldr x0, [x21, 16]
bl fopen
mov x22, x0
ldr x1, [x21, 8]
ldrb w0, [x1]
cbz w0, .L18
mov w2, 0
.L11:
mov w23, w2
add w2, w2, 1
ldrb w0, [x1, w2, uxtw]
cbnz w0, .L11
tbnz x2, 0, .L12
cbz w23, .L13
.L10:
mov x24, 0
.L16:
ldr x20, [x21, 8]
ldrb w0, [x20, x24]
bl hex2int
mov w19, w0
add x20, x20, x24
ldrb w0, [x20, 1]
bl hex2int
cmn w19, #1
ccmn w0, #1, 4, ne
beq .L22
add w0, w0, w19, lsl 4
cbz x22, .L15
mov x1, x22
bl fputc
.L15:
add x24, x24, 2
cmp w23, w24
bhi .L16
.L13:
cbz x22, .L17
mov x0, x22
bl fclose
.L17:
mov w0, 0
bl exit
.L12:
adrp x0, :got:stderr
ldr x0, [x0, #:got_lo12:stderr]
ldr x3, [x0]
mov x2, 19
mov x1, 1
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl fwrite
mov w0, 1
bl exit
.L18:
mov w23, -1
b .L10
.L22:
adrp x0, :got:stderr
ldr x0, [x0, #:got_lo12:stderr]
ldr x3, [x0]
mov x2, 14
mov x1, 1
adrp x0, .LC3
add x0, x0, :lo12:.LC3
bl fwrite
mov w0, 1
bl exit
.cfi_endproc
.LFE40:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "hex2bin.c"
.text
.align 2
.p2align 4,,11
.global hex2int
.type hex2int, %function
hex2int:
.LFB39:
.cfi_startproc
and w1, w0, 255
sub w0, w1, #48
and w2, w0, 255
cmp w2, 9
bls .L1
sub w0, w1, #65
and w0, w0, 255
cmp w0, 5
bls .L7
sub w0, w1, #97
and w0, w0, 255
cmp w0, 5
bhi .L5
sub w0, w1, #87
.L1:
ret
.p2align 2,,3
.L7:
sub w0, w1, #55
ret
.L5:
mov w0, -1
ret
.cfi_endproc
.LFE39:
.size hex2int, .-hex2int
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "usuage is: hex2bin hexString binaryFile"
.align 3
.LC1:
.string "w"
.align 3
.LC2:
.string "invalid hex length\n"
.align 3
.LC3:
.string "non-hex input\n"
.section .text.startup,"ax",@progbits
.align 2
.p2align 4,,11
.global main
.type main, %function
main:
.LFB40:
.cfi_startproc
stp x29, x30, [sp, -48]!
.cfi_def_cfa_offset 48
.cfi_offset 29, -48
.cfi_offset 30, -40
mov x29, sp
stp x19, x20, [sp, 16]
.cfi_offset 20, -24
.cfi_offset 19, -32
stp x21, x22, [sp, 32]
.cfi_offset 22, -8
.cfi_offset 21, -16
cmp w0, 3
beq .L9
adrp x1, .LC0
add x1, x1, :lo12:.LC0
mov w0, 1
bl __printf_chk
mov w0, -1
bl exit
.L9:
mov x20, x1
adrp x1, .LC1
add x1, x1, :lo12:.LC1
ldr x0, [x20, 16]
bl fopen
mov x22, x0
ldr x3, [x20, 8]
ldrb w0, [x3]
cbz w0, .L25
mov w2, 0
.p2align 3,,7
.L11:
mov w21, w2
add w2, w2, 1
ldrb w4, [x3, w2, uxtw]
cbnz w4, .L11
tbnz x2, 0, .L12
cbz w21, .L13
.L10:
mov x19, 0
b .L23
.p2align 2,,3
.L16:
sub w0, w4, #97
and w0, w0, 255
cmp w0, 5
bhi .L26
sub w2, w4, #87
.L15:
add x3, x3, x19
ldrb w4, [x3, 1]
sub w3, w4, #48
and w0, w3, 255
cmp w0, 9
bls .L18
sub w3, w4, #65
and w3, w3, 255
cmp w3, 5
bls .L36
sub w0, w4, #97
and w0, w0, 255
cmp w0, 5
bhi .L20
sub w3, w4, #87
.L18:
cmn w2, #1
beq .L20
add w0, w3, w2, lsl 4
cbz x22, .L22
mov x1, x22
bl fputc
.L22:
add x19, x19, 2
cmp w21, w19
bls .L13
ldr x3, [x20, 8]
.L23:
ldrb w4, [x3, x19]
sub w2, w4, #48
and w0, w2, 255
cmp w0, 9
bls .L15
sub w2, w4, #65
and w2, w2, 255
cmp w2, 5
bhi .L16
sub w2, w4, #55
b .L15
.L12:
adrp x3, :got:stderr
mov x2, 19
mov x1, 1
adrp x0, .LC2
ldr x3, [x3, #:got_lo12:stderr]
add x0, x0, :lo12:.LC2
ldr x3, [x3]
bl fwrite
mov w0, 1
bl exit
.L13:
cbz x22, .L24
mov x0, x22
bl fclose
.L24:
mov w0, 0
bl exit
.L36:
sub w3, w4, #55
b .L18
.L20:
adrp x3, :got:stderr
mov x2, 14
mov x1, 1
adrp x0, .LC3
ldr x3, [x3, #:got_lo12:stderr]
add x0, x0, :lo12:.LC3
ldr x3, [x3]
bl fwrite
mov w0, 1
bl exit
.L25:
mov w21, -1
b .L10
.L26:
mov w2, -1
b .L15
.cfi_endproc
.LFE40:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "hex2bin.c"
.text
.align 2
.p2align 4,,11
.global hex2int
.type hex2int, %function
hex2int:
.LFB39:
.cfi_startproc
and w1, w0, 255
sub w0, w1, #48
and w2, w0, 255
cmp w2, 9
bls .L1
sub w0, w1, #65
and w0, w0, 255
cmp w0, 5
bls .L7
sub w0, w1, #97
and w0, w0, 255
cmp w0, 5
bhi .L5
sub w0, w1, #87
.L1:
ret
.p2align 2,,3
.L7:
sub w0, w1, #55
ret
.L5:
mov w0, -1
ret
.cfi_endproc
.LFE39:
.size hex2int, .-hex2int
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "usuage is: hex2bin hexString binaryFile"
.align 3
.LC1:
.string "w"
.align 3
.LC2:
.string "invalid hex length\n"
.align 3
.LC3:
.string "non-hex input\n"
.section .text.startup,"ax",@progbits
.align 2
.p2align 4,,11
.global main
.type main, %function
main:
.LFB40:
.cfi_startproc
stp x29, x30, [sp, -48]!
.cfi_def_cfa_offset 48
.cfi_offset 29, -48
.cfi_offset 30, -40
mov x29, sp
stp x19, x20, [sp, 16]
.cfi_offset 20, -24
.cfi_offset 19, -32
stp x21, x22, [sp, 32]
.cfi_offset 22, -8
.cfi_offset 21, -16
cmp w0, 3
beq .L9
adrp x1, .LC0
add x1, x1, :lo12:.LC0
mov w0, 1
bl __printf_chk
mov w0, -1
bl exit
.L9:
mov x20, x1
adrp x1, .LC1
add x1, x1, :lo12:.LC1
ldr x0, [x20, 16]
bl fopen
mov x22, x0
ldr x2, [x20, 8]
ldrb w0, [x2]
cbz w0, .L28
mov w3, 0
.p2align 3,,7
.L11:
mov w21, w3
add w3, w3, 1
ldrb w4, [x2, w3, uxtw]
cbnz w4, .L11
tbnz x3, 0, .L12
cbz w21, .L40
.L10:
mov x19, 0
cbnz x22, .L14
b .L41
.p2align 2,,3
.L21:
sub w3, w4, #97
and w3, w3, 255
cmp w3, 5
bhi .L30
sub w3, w4, #87
.L20:
add x2, x2, x19
ldrb w2, [x2, 1]
sub w0, w2, #48
and w4, w0, 255
cmp w4, 9
bls .L23
sub w4, w2, #65
sub w0, w2, #55
and w4, w4, 255
cmp w4, 5
bls .L23
sub w4, w2, #97
and w4, w4, 255
cmp w4, 5
bhi .L16
sub w0, w2, #87
.L23:
cmn w3, #1
beq .L16
add x19, x19, 2
add w0, w0, w3, lsl 4
mov x1, x22
bl fputc
cmp w21, w19
bls .L26
ldr x2, [x20, 8]
.L14:
ldrb w4, [x2, x19]
sub w3, w4, #48
and w5, w3, 255
cmp w5, 9
bls .L20
sub w3, w4, #65
and w3, w3, 255
cmp w3, 5
bhi .L21
sub w3, w4, #55
b .L20
.L12:
adrp x3, :got:stderr
mov x2, 19
mov x1, 1
adrp x0, .LC2
ldr x3, [x3, #:got_lo12:stderr]
add x0, x0, :lo12:.LC2
ldr x3, [x3]
bl fwrite
mov w0, 1
bl exit
.L40:
cbz x22, .L18
.L26:
mov x0, x22
bl fclose
.L18:
mov w0, 0
bl exit
.L41:
mov x1, 0
b .L17
.L27:
add x1, x1, 2
cmp w21, w1
bls .L18
.L17:
ldrb w0, [x2, x1]
sub w3, w0, #48
and w3, w3, 255
cmp w3, 9
bls .L15
sub w3, w0, #65
and w3, w3, 255
cmp w3, 5
bls .L15
sub w0, w0, #97
and w0, w0, 255
cmp w0, 5
bhi .L16
.L15:
add x0, x2, x1
ldrb w0, [x0, 1]
sub w3, w0, #48
and w3, w3, 255
cmp w3, 9
bls .L27
and w0, w0, -33
sub w0, w0, #65
and w0, w0, 255
cmp w0, 5
bls .L27
.L16:
adrp x3, :got:stderr
mov x2, 14
mov x1, 1
adrp x0, .LC3
ldr x3, [x3, #:got_lo12:stderr]
add x0, x0, :lo12:.LC3
ldr x3, [x3]
bl fwrite
mov w0, 1
bl exit
.L28:
mov w21, -1
b .L10
.L30:
mov w3, -1
b .L20
.cfi_endproc
.LFE40:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
ds2490.c
|
const char dtlib[] = "DS2490";
|
.file "ds2490.c"
.option pic
.text
.globl dtlib
.section .rodata
.align 3
.type dtlib, @object
.size dtlib, 7
dtlib:
.string "DS2490"
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "ds2490.c"
.option pic
.text
.globl dtlib
.section .rodata
.align 3
.type dtlib, @object
.size dtlib, 7
dtlib:
.string "DS2490"
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "ds2490.c"
.option pic
.text
.globl dtlib
.section .rodata
.align 3
.type dtlib, @object
.size dtlib, 7
dtlib:
.string "DS2490"
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "ds2490.c"
.option pic
.text
.globl dtlib
.section .rodata
.align 3
.type dtlib, @object
.size dtlib, 7
dtlib:
.string "DS2490"
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "ds2490.c"
.text
.global dtlib
.section .rodata
.align 3
.type dtlib, %object
.size dtlib, 7
dtlib:
.string "DS2490"
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "ds2490.c"
.text
.global dtlib
.section .rodata
.align 3
.type dtlib, %object
.size dtlib, 7
dtlib:
.string "DS2490"
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "ds2490.c"
.text
.global dtlib
.section .rodata
.align 3
.type dtlib, %object
.size dtlib, 7
dtlib:
.string "DS2490"
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "ds2490.c"
.text
.global dtlib
.section .rodata
.align 3
.type dtlib, %object
.size dtlib, 7
dtlib:
.string "DS2490"
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
linearsearch.c
|
#include<stdio.h>
struct Array
{
int A[10];
int size;
int length;
};
void Display(struct Array arr)
{
int i;
printf("\nElements are\n");
for(i=0;i<arr.length;i++)
printf("%d ",arr.A[i]);
}
void Append(struct Array *arr,int x)
{
if(arr->length<arr->size)
arr->A[arr->length++]=x;
}
void Insert(struct Array *arr,int index,int x)
{
int i;
if(index>=0 && index <=arr->length)
{
for(i=arr->length;i>index;i--)
arr->A[i]=arr->A[i-1];
arr->A[index]=x;
arr->length++;
}
}
void delete(struct Array *arr,int index){
if(index>=0 && index<arr->length){
for(int i=index;i<arr->length- 1;i++){
arr->A[i]=arr->A[i+ 1];
}
arr->length--;
}
}
int swap(int *x,int *y){
int temp;
temp=*x;
*x=*y;
*y=temp;
}
int linear_search(struct Array *arr,int key){
for(int i=0;i<arr->length;i++){
if(key==arr->A[i]){
swap(&arr->A[i],&arr->A[i- 1]);
return i+ 1;
//move to front/head
//swap(&arr->A[i],&arr->A[i- 1]);
}
}
return 0;
}
int main()
{
struct Array arr1={{2,3,4,5,6},10,5};
Append(&arr1,10);
Insert(&arr1,0,12);
delete(&arr1,arr1.length-1);
Display(arr1);
printf("\n");
printf("%d",linear_search(&arr1,5));
printf("\n");
Display(arr1);
return 0;
}
|
.file "linearsearch.c"
.option pic
.text
.section .rodata
.align 3
.LC0:
.string "\nElements are"
.align 3
.LC1:
.string "%d "
.text
.align 1
.globl Display
.type Display, @function
Display:
addi sp,sp,-48
sd ra,40(sp)
sd s0,32(sp)
sd s1,24(sp)
addi s0,sp,48
mv s1,a0
lla a0,.LC0
call puts@plt
sw zero,-36(s0)
j .L2
.L3:
lw a5,-36(s0)
slli a5,a5,2
add a5,s1,a5
lw a5,0(a5)
mv a1,a5
lla a0,.LC1
call printf@plt
lw a5,-36(s0)
addiw a5,a5,1
sw a5,-36(s0)
.L2:
lw a4,44(s1)
lw a5,-36(s0)
sext.w a5,a5
blt a5,a4,.L3
nop
nop
ld ra,40(sp)
ld s0,32(sp)
ld s1,24(sp)
addi sp,sp,48
jr ra
.size Display, .-Display
.align 1
.globl Append
.type Append, @function
Append:
addi sp,sp,-32
sd s0,24(sp)
addi s0,sp,32
sd a0,-24(s0)
mv a5,a1
sw a5,-28(s0)
ld a5,-24(s0)
lw a4,44(a5)
ld a5,-24(s0)
lw a5,40(a5)
bge a4,a5,.L6
ld a5,-24(s0)
lw a5,44(a5)
addiw a4,a5,1
sext.w a3,a4
ld a4,-24(s0)
sw a3,44(a4)
ld a4,-24(s0)
slli a5,a5,2
add a5,a4,a5
lw a4,-28(s0)
sw a4,0(a5)
.L6:
nop
ld s0,24(sp)
addi sp,sp,32
jr ra
.size Append, .-Append
.align 1
.globl Insert
.type Insert, @function
Insert:
addi sp,sp,-48
sd s0,40(sp)
addi s0,sp,48
sd a0,-40(s0)
mv a5,a1
mv a4,a2
sw a5,-44(s0)
mv a5,a4
sw a5,-48(s0)
lw a5,-44(s0)
sext.w a5,a5
blt a5,zero,.L11
ld a5,-40(s0)
lw a4,44(a5)
lw a5,-44(s0)
sext.w a5,a5
bgt a5,a4,.L11
ld a5,-40(s0)
lw a5,44(a5)
sw a5,-20(s0)
j .L9
.L10:
lw a5,-20(s0)
addiw a5,a5,-1
sext.w a5,a5
ld a4,-40(s0)
slli a5,a5,2
add a5,a4,a5
lw a4,0(a5)
ld a3,-40(s0)
lw a5,-20(s0)
slli a5,a5,2
add a5,a3,a5
sw a4,0(a5)
lw a5,-20(s0)
addiw a5,a5,-1
sw a5,-20(s0)
.L9:
lw a5,-20(s0)
mv a4,a5
lw a5,-44(s0)
sext.w a4,a4
sext.w a5,a5
bgt a4,a5,.L10
ld a4,-40(s0)
lw a5,-44(s0)
slli a5,a5,2
add a5,a4,a5
lw a4,-48(s0)
sw a4,0(a5)
ld a5,-40(s0)
lw a5,44(a5)
addiw a5,a5,1
sext.w a4,a5
ld a5,-40(s0)
sw a4,44(a5)
.L11:
nop
ld s0,40(sp)
addi sp,sp,48
jr ra
.size Insert, .-Insert
.align 1
.globl delete
.type delete, @function
delete:
addi sp,sp,-48
sd s0,40(sp)
addi s0,sp,48
sd a0,-40(s0)
mv a5,a1
sw a5,-44(s0)
lw a5,-44(s0)
sext.w a5,a5
blt a5,zero,.L16
ld a5,-40(s0)
lw a4,44(a5)
lw a5,-44(s0)
sext.w a5,a5
bge a5,a4,.L16
lw a5,-44(s0)
sw a5,-20(s0)
j .L14
.L15:
lw a5,-20(s0)
addiw a5,a5,1
sext.w a5,a5
ld a4,-40(s0)
slli a5,a5,2
add a5,a4,a5
lw a4,0(a5)
ld a3,-40(s0)
lw a5,-20(s0)
slli a5,a5,2
add a5,a3,a5
sw a4,0(a5)
lw a5,-20(s0)
addiw a5,a5,1
sw a5,-20(s0)
.L14:
ld a5,-40(s0)
lw a5,44(a5)
addiw a5,a5,-1
sext.w a4,a5
lw a5,-20(s0)
sext.w a5,a5
blt a5,a4,.L15
ld a5,-40(s0)
lw a5,44(a5)
addiw a5,a5,-1
sext.w a4,a5
ld a5,-40(s0)
sw a4,44(a5)
.L16:
nop
ld s0,40(sp)
addi sp,sp,48
jr ra
.size delete, .-delete
.align 1
.globl swap
.type swap, @function
swap:
addi sp,sp,-48
sd s0,40(sp)
addi s0,sp,48
sd a0,-40(s0)
sd a1,-48(s0)
ld a5,-40(s0)
lw a5,0(a5)
sw a5,-20(s0)
ld a5,-48(s0)
lw a4,0(a5)
ld a5,-40(s0)
sw a4,0(a5)
ld a5,-48(s0)
lw a4,-20(s0)
sw a4,0(a5)
nop
mv a0,a5
ld s0,40(sp)
addi sp,sp,48
jr ra
.size swap, .-swap
.align 1
.globl linear_search
.type linear_search, @function
linear_search:
addi sp,sp,-48
sd ra,40(sp)
sd s0,32(sp)
addi s0,sp,48
sd a0,-40(s0)
mv a5,a1
sw a5,-44(s0)
sw zero,-20(s0)
j .L19
.L22:
ld a4,-40(s0)
lw a5,-20(s0)
slli a5,a5,2
add a5,a4,a5
lw a4,0(a5)
lw a5,-44(s0)
sext.w a5,a5
bne a5,a4,.L20
lw a5,-20(s0)
slli a5,a5,2
ld a4,-40(s0)
add a3,a4,a5
lw a5,-20(s0)
addiw a5,a5,-1
sext.w a5,a5
slli a5,a5,2
ld a4,-40(s0)
add a5,a4,a5
mv a1,a5
mv a0,a3
call swap
lw a5,-20(s0)
addiw a5,a5,1
sext.w a5,a5
j .L21
.L20:
lw a5,-20(s0)
addiw a5,a5,1
sw a5,-20(s0)
.L19:
ld a5,-40(s0)
lw a4,44(a5)
lw a5,-20(s0)
sext.w a5,a5
blt a5,a4,.L22
li a5,0
.L21:
mv a0,a5
ld ra,40(sp)
ld s0,32(sp)
addi sp,sp,48
jr ra
.size linear_search, .-linear_search
.section .rodata
.align 3
.LC2:
.string "%d"
.text
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-128
sd ra,120(sp)
sd s0,112(sp)
addi s0,sp,128
la a5,__stack_chk_guard
ld a4, 0(a5)
sd a4, -24(s0)
li a4, 0
sd zero,-72(s0)
sd zero,-64(s0)
sd zero,-56(s0)
sd zero,-48(s0)
sd zero,-40(s0)
sd zero,-32(s0)
li a5,2
sw a5,-72(s0)
li a5,3
sw a5,-68(s0)
li a5,4
sw a5,-64(s0)
li a5,5
sw a5,-60(s0)
li a5,6
sw a5,-56(s0)
li a5,10
sw a5,-32(s0)
li a5,5
sw a5,-28(s0)
addi a5,s0,-72
li a1,10
mv a0,a5
call Append
addi a5,s0,-72
li a2,12
li a1,0
mv a0,a5
call Insert
lw a5,-28(s0)
addiw a5,a5,-1
sext.w a4,a5
addi a5,s0,-72
mv a1,a4
mv a0,a5
call delete
ld a0,-72(s0)
ld a1,-64(s0)
ld a2,-56(s0)
ld a3,-48(s0)
ld a4,-40(s0)
ld a5,-32(s0)
sd a0,-128(s0)
sd a1,-120(s0)
sd a2,-112(s0)
sd a3,-104(s0)
sd a4,-96(s0)
sd a5,-88(s0)
addi a5,s0,-128
mv a0,a5
call Display
li a0,10
call putchar@plt
addi a5,s0,-72
li a1,5
mv a0,a5
call linear_search
mv a5,a0
mv a1,a5
lla a0,.LC2
call printf@plt
li a0,10
call putchar@plt
ld a0,-72(s0)
ld a1,-64(s0)
ld a2,-56(s0)
ld a3,-48(s0)
ld a4,-40(s0)
ld a5,-32(s0)
sd a0,-128(s0)
sd a1,-120(s0)
sd a2,-112(s0)
sd a3,-104(s0)
sd a4,-96(s0)
sd a5,-88(s0)
addi a5,s0,-128
mv a0,a5
call Display
li a5,0
mv a4,a5
la a5,__stack_chk_guard
ld a3, -24(s0)
ld a5, 0(a5)
xor a5, a3, a5
li a3, 0
beq a5,zero,.L25
call __stack_chk_fail@plt
.L25:
mv a0,a4
ld ra,120(sp)
ld s0,112(sp)
addi sp,sp,128
jr ra
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "linearsearch.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "\nElements are"
.align 3
.LC1:
.string "%d "
.text
.align 1
.globl Display
.type Display, @function
Display:
addi sp,sp,-32
sd ra,24(sp)
sd s0,16(sp)
sd s1,8(sp)
sd s2,0(sp)
mv s2,a0
lw s1,44(a0)
lla a0,.LC0
call puts@plt
ble s1,zero,.L1
mv s0,s2
addiw s1,s1,-1
slli a5,s1,32
srli s1,a5,30
addi s2,s2,4
add s1,s1,s2
lla s2,.LC1
.L3:
lw a2,0(s0)
mv a1,s2
li a0,1
call __printf_chk@plt
addi s0,s0,4
bne s0,s1,.L3
.L1:
ld ra,24(sp)
ld s0,16(sp)
ld s1,8(sp)
ld s2,0(sp)
addi sp,sp,32
jr ra
.size Display, .-Display
.align 1
.globl Append
.type Append, @function
Append:
lw a5,44(a0)
lw a4,40(a0)
ble a4,a5,.L6
addiw a4,a5,1
sw a4,44(a0)
slli a5,a5,2
add a0,a0,a5
sw a1,0(a0)
.L6:
ret
.size Append, .-Append
.align 1
.globl Insert
.type Insert, @function
Insert:
blt a1,zero,.L8
lw a6,44(a0)
blt a6,a1,.L8
ble a6,a1,.L10
slli a4,a6,2
add a5,a0,a4
addi a3,a0,-4
add a3,a3,a4
addiw a4,a6,-1
subw a4,a4,a1
slli a7,a4,32
srli a4,a7,30
sub a3,a3,a4
.L11:
lw a4,-4(a5)
sw a4,0(a5)
addi a5,a5,-4
bne a5,a3,.L11
.L10:
slli a1,a1,2
add a1,a0,a1
sw a2,0(a1)
addiw a6,a6,1
sw a6,44(a0)
.L8:
ret
.size Insert, .-Insert
.align 1
.globl delete
.type delete, @function
delete:
blt a1,zero,.L13
lw a4,44(a0)
ble a4,a1,.L13
addiw a2,a4,-1
sext.w a5,a2
bge a1,a5,.L15
slli a5,a1,2
add a5,a0,a5
addiw a4,a4,-2
subw a4,a4,a1
slli a4,a4,32
srli a4,a4,32
add a4,a4,a1
slli a4,a4,2
addi a3,a0,4
add a4,a4,a3
.L16:
lw a3,4(a5)
sw a3,0(a5)
addi a5,a5,4
bne a5,a4,.L16
.L15:
sw a2,44(a0)
.L13:
ret
.size delete, .-delete
.align 1
.globl swap
.type swap, @function
swap:
lw a5,0(a0)
lw a4,0(a1)
sw a4,0(a0)
sw a5,0(a1)
ret
.size swap, .-swap
.align 1
.globl linear_search
.type linear_search, @function
linear_search:
lw a2,44(a0)
ble a2,zero,.L23
mv a4,a0
li a5,0
.L22:
lw a3,0(a4)
beq a3,a1,.L25
addiw a5,a5,1
addi a4,a4,4
bne a2,a5,.L22
li a0,0
ret
.L25:
slli a4,a5,2
add a0,a0,a4
lw a4,-4(a0)
sw a4,0(a0)
sw a3,-4(a0)
addiw a0,a5,1
ret
.L23:
li a0,0
ret
.size linear_search, .-linear_search
.section .rodata.str1.8
.align 3
.LC2:
.string "%d"
.text
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-144
sd ra,136(sp)
sd s0,128(sp)
sd s1,120(sp)
sd s2,112(sp)
la s1,__stack_chk_guard
ld a5, 0(s1)
sd a5, 104(sp)
li a5, 0
sd zero,80(sp)
sd zero,88(sp)
li a5,2
sw a5,56(sp)
li a5,3
sw a5,60(sp)
li a5,4
sw a5,64(sp)
li a5,5
sw a5,68(sp)
li a4,6
sw a4,72(sp)
li a5,10
sw a5,96(sp)
sw a4,100(sp)
sw a5,76(sp)
li a2,12
li a1,0
addi s0,sp,56
mv a0,s0
call Insert
lw a1,100(sp)
addiw a1,a1,-1
mv a0,s0
call delete
ld a5,56(sp)
sd a5,0(sp)
ld a5,64(sp)
sd a5,8(sp)
ld a5,72(sp)
sd a5,16(sp)
ld a5,80(sp)
sd a5,24(sp)
ld a5,88(sp)
sd a5,32(sp)
ld a5,96(sp)
sd a5,40(sp)
mv s2,sp
mv a0,s2
call Display
li a0,10
call putchar@plt
li a1,5
mv a0,s0
call linear_search
mv a2,a0
lla a1,.LC2
li a0,1
call __printf_chk@plt
li a0,10
call putchar@plt
ld a5,56(sp)
sd a5,0(sp)
ld a5,64(sp)
sd a5,8(sp)
ld a5,72(sp)
sd a5,16(sp)
ld a5,80(sp)
sd a5,24(sp)
ld a5,88(sp)
sd a5,32(sp)
ld a5,96(sp)
sd a5,40(sp)
mv a0,s2
call Display
ld a4, 104(sp)
ld a5, 0(s1)
xor a5, a4, a5
li a4, 0
bne a5,zero,.L29
li a0,0
ld ra,136(sp)
ld s0,128(sp)
ld s1,120(sp)
ld s2,112(sp)
addi sp,sp,144
jr ra
.L29:
call __stack_chk_fail@plt
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "linearsearch.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "\nElements are"
.align 3
.LC1:
.string "%d "
.text
.align 1
.globl Display
.type Display, @function
Display:
addi sp,sp,-32
sd s1,8(sp)
lw s1,44(a0)
sd s0,16(sp)
mv s0,a0
lla a0,.LC0
sd ra,24(sp)
sd s2,0(sp)
call puts@plt
ble s1,zero,.L1
addiw s1,s1,-1
slli a5,s1,32
srli s1,a5,30
addi a5,s0,4
add s1,s1,a5
lla s2,.LC1
.L3:
lw a2,0(s0)
mv a1,s2
addi s0,s0,4
li a0,1
call __printf_chk@plt
bne s0,s1,.L3
.L1:
ld ra,24(sp)
ld s0,16(sp)
ld s1,8(sp)
ld s2,0(sp)
addi sp,sp,32
jr ra
.size Display, .-Display
.align 1
.globl Append
.type Append, @function
Append:
lw a5,44(a0)
lw a4,40(a0)
ble a4,a5,.L7
addiw a4,a5,1
slli a5,a5,2
sw a4,44(a0)
add a0,a0,a5
sw a1,0(a0)
.L7:
ret
.size Append, .-Append
.align 1
.globl Insert
.type Insert, @function
Insert:
blt a1,zero,.L13
addi sp,sp,-48
sd s3,8(sp)
lw s3,44(a0)
sd s0,32(sp)
sd s1,24(sp)
sd ra,40(sp)
sd s2,16(sp)
mv s0,a1
mv s1,a0
bgt a1,s3,.L9
mv s2,a2
bge a1,s3,.L11
subw a2,s3,a1
addiw a2,a2,-1
slli a2,a2,32
srli a2,a2,32
neg a5,a2
addi a1,s3,-1
slli a5,a5,2
slli a1,a1,2
slli a0,s3,2
addi a2,a2,1
add a1,a1,a5
add a0,a0,a5
slli a2,a2,2
add a1,s1,a1
add a0,s1,a0
call memmove@plt
.L11:
slli s0,s0,2
add s0,s1,s0
sw s2,0(s0)
addiw s3,s3,1
sw s3,44(s1)
.L9:
ld ra,40(sp)
ld s0,32(sp)
ld s1,24(sp)
ld s2,16(sp)
ld s3,8(sp)
addi sp,sp,48
jr ra
.L13:
ret
.size Insert, .-Insert
.align 1
.globl delete
.type delete, @function
delete:
blt a1,zero,.L20
lw a5,44(a0)
addi sp,sp,-32
sd s0,16(sp)
sd ra,24(sp)
sd s1,8(sp)
mv s0,a0
bge a1,a5,.L16
addiw a4,a5,-1
mv s1,a4
bge a1,a4,.L18
addiw a2,a5,-2
subw a2,a2,a1
slli a0,a1,2
slli a5,a2,32
addi a1,a0,4
srli a2,a5,30
addi a2,a2,4
add a1,s0,a1
add a0,s0,a0
call memmove@plt
.L18:
sw s1,44(s0)
.L16:
ld ra,24(sp)
ld s0,16(sp)
ld s1,8(sp)
addi sp,sp,32
jr ra
.L20:
ret
.size delete, .-delete
.align 1
.globl swap
.type swap, @function
swap:
lw a4,0(a1)
lw a5,0(a0)
sw a4,0(a0)
sw a5,0(a1)
ret
.size swap, .-swap
.align 1
.globl linear_search
.type linear_search, @function
linear_search:
lw a3,44(a0)
mv a6,a0
ble a3,zero,.L28
mv a5,a0
li a0,0
j .L27
.L26:
addi a5,a5,4
beq a0,a3,.L28
.L27:
lw a4,0(a5)
mv a2,a0
addiw a0,a0,1
bne a4,a1,.L26
slli a2,a2,2
add a6,a6,a2
lw a5,-4(a6)
sw a1,-4(a6)
sw a5,0(a6)
ret
.L28:
li a0,0
ret
.size linear_search, .-linear_search
.section .rodata.str1.8
.align 3
.LC2:
.string "%d"
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-144
li a4,1
li a5,3
sd s0,128(sp)
sd s1,120(sp)
slli a5,a5,33
slli a3,a4,33
la s1,__stack_chk_guard
mv s0,sp
slli a4,a4,34
addi a4,a4,3
addi a3,a3,12
addi a1,a5,5
li a2,10
addi a5,a5,10
ld a6, 0(s1)
sd a6, 104(sp)
li a6, 0
mv a0,s0
sd a4,64(sp)
sd a4,8(sp)
sd ra,136(sp)
sd a3,56(sp)
sd a5,96(sp)
sd a3,0(sp)
sd a5,40(sp)
sd a2,80(sp)
sd a2,24(sp)
sd a1,72(sp)
sd a1,16(sp)
sd zero,88(sp)
sd zero,32(sp)
call Display
li a0,10
call putchar@plt
li a1,5
addi a0,sp,56
call linear_search
mv a2,a0
lla a1,.LC2
li a0,1
call __printf_chk@plt
li a0,10
call putchar@plt
ld a5,56(sp)
mv a0,s0
sd a5,0(sp)
ld a5,64(sp)
sd a5,8(sp)
ld a5,72(sp)
sd a5,16(sp)
ld a5,80(sp)
sd a5,24(sp)
ld a5,88(sp)
sd a5,32(sp)
ld a5,96(sp)
sd a5,40(sp)
call Display
ld a4, 104(sp)
ld a5, 0(s1)
xor a5, a4, a5
li a4, 0
bne a5,zero,.L33
ld ra,136(sp)
ld s0,128(sp)
ld s1,120(sp)
li a0,0
addi sp,sp,144
jr ra
.L33:
call __stack_chk_fail@plt
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "linearsearch.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "\nElements are"
.align 3
.LC1:
.string "%d "
.text
.align 1
.globl Display
.type Display, @function
Display:
addi sp,sp,-32
sd s1,8(sp)
lw s1,44(a0)
sd s0,16(sp)
mv s0,a0
lla a0,.LC0
sd ra,24(sp)
sd s2,0(sp)
call puts@plt
ble s1,zero,.L1
addiw s1,s1,-1
slli a5,s1,32
srli s1,a5,30
addi a5,s0,4
add s1,s1,a5
lla s2,.LC1
.L3:
lw a2,0(s0)
mv a1,s2
addi s0,s0,4
li a0,1
call __printf_chk@plt
bne s0,s1,.L3
.L1:
ld ra,24(sp)
ld s0,16(sp)
ld s1,8(sp)
ld s2,0(sp)
addi sp,sp,32
jr ra
.size Display, .-Display
.align 1
.globl Append
.type Append, @function
Append:
lw a5,44(a0)
lw a4,40(a0)
ble a4,a5,.L7
addiw a4,a5,1
slli a5,a5,2
sw a4,44(a0)
add a0,a0,a5
sw a1,0(a0)
.L7:
ret
.size Append, .-Append
.align 1
.globl Insert
.type Insert, @function
Insert:
blt a1,zero,.L13
addi sp,sp,-48
sd s3,8(sp)
lw s3,44(a0)
sd s0,32(sp)
sd s1,24(sp)
sd ra,40(sp)
sd s2,16(sp)
mv s0,a1
mv s1,a0
bgt a1,s3,.L9
mv s2,a2
bge a1,s3,.L11
subw a2,s3,a1
addiw a2,a2,-1
slli a2,a2,32
srli a2,a2,32
neg a5,a2
addi a1,s3,-1
slli a5,a5,2
slli a1,a1,2
slli a0,s3,2
addi a2,a2,1
add a1,a1,a5
add a0,a0,a5
slli a2,a2,2
add a1,s1,a1
add a0,s1,a0
call memmove@plt
.L11:
slli s0,s0,2
add s0,s1,s0
sw s2,0(s0)
addiw s3,s3,1
sw s3,44(s1)
.L9:
ld ra,40(sp)
ld s0,32(sp)
ld s1,24(sp)
ld s2,16(sp)
ld s3,8(sp)
addi sp,sp,48
jr ra
.L13:
ret
.size Insert, .-Insert
.align 1
.globl delete
.type delete, @function
delete:
blt a1,zero,.L20
lw a5,44(a0)
addi sp,sp,-32
sd s0,16(sp)
sd ra,24(sp)
sd s1,8(sp)
mv s0,a0
bge a1,a5,.L16
addiw a4,a5,-1
mv s1,a4
bge a1,a4,.L18
addiw a2,a5,-2
subw a2,a2,a1
slli a0,a1,2
slli a5,a2,32
addi a1,a0,4
srli a2,a5,30
addi a2,a2,4
add a1,s0,a1
add a0,s0,a0
call memmove@plt
.L18:
sw s1,44(s0)
.L16:
ld ra,24(sp)
ld s0,16(sp)
ld s1,8(sp)
addi sp,sp,32
jr ra
.L20:
ret
.size delete, .-delete
.align 1
.globl swap
.type swap, @function
swap:
lw a4,0(a1)
lw a5,0(a0)
sw a4,0(a0)
sw a5,0(a1)
ret
.size swap, .-swap
.align 1
.globl linear_search
.type linear_search, @function
linear_search:
lw a4,44(a0)
mv a5,a0
ble a4,zero,.L45
lw a3,0(a0)
beq a3,a1,.L28
li a3,1
beq a4,a3,.L45
lw a3,4(a0)
beq a3,a1,.L30
li a3,2
beq a4,a3,.L45
lw a3,8(a0)
beq a3,a1,.L32
li a3,3
beq a4,a3,.L45
lw a3,12(a0)
beq a3,a1,.L34
li a3,4
beq a4,a3,.L45
lw a3,16(a0)
beq a3,a1,.L36
li a3,5
beq a4,a3,.L45
lw a3,20(a0)
beq a3,a1,.L38
li a3,6
beq a4,a3,.L45
lw a3,24(a0)
beq a3,a1,.L40
li a3,7
beq a4,a3,.L45
lw a3,28(a0)
beq a3,a1,.L42
li a3,8
beq a4,a3,.L45
lw a3,32(a0)
beq a3,a1,.L44
li a3,9
beq a4,a3,.L45
lw a4,36(a0)
li a0,0
beq a4,a1,.L47
ret
.L45:
li a0,0
ret
.L28:
li a4,0
li a0,1
.L26:
slli a4,a4,2
add a5,a5,a4
lw a4,-4(a5)
sw a1,-4(a5)
sw a4,0(a5)
ret
.L47:
li a4,9
li a0,10
j .L26
.L30:
li a4,1
li a0,2
j .L26
.L32:
li a4,2
li a0,3
j .L26
.L34:
li a4,3
li a0,4
j .L26
.L36:
li a4,4
li a0,5
j .L26
.L38:
li a4,5
li a0,6
j .L26
.L40:
li a4,6
li a0,7
j .L26
.L42:
li a4,7
li a0,8
j .L26
.L44:
li a4,8
li a0,9
j .L26
.size linear_search, .-linear_search
.section .rodata.str1.8
.align 3
.LC2:
.string "%d"
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-144
sd s0,128(sp)
sd s1,120(sp)
li s0,5
la s1,__stack_chk_guard
li a5,3
ld a6, 0(s1)
sd a6, 104(sp)
li a6, 0
slli a3,s0,32
slli a4,s0,33
slli a5,a5,32
addi a4,a4,6
addi a3,a3,4
li a6,10
li a2,24
addi a1,sp,56
addi a5,a5,2
addi a0,sp,60
sd a4,72(sp)
sd ra,136(sp)
sw a6,96(sp)
sd a3,64(sp)
sd s2,112(sp)
sd a5,56(sp)
sd zero,80(sp)
sd zero,88(sp)
call memmove@plt
li a5,12
sw a5,56(sp)
li a5,6
sw a5,100(sp)
ld a5,56(sp)
mv s2,sp
mv a0,s2
sd a5,0(sp)
ld a5,64(sp)
sd a5,8(sp)
ld a5,72(sp)
sd a5,16(sp)
ld a5,80(sp)
sd a5,24(sp)
ld a5,88(sp)
sd a5,32(sp)
ld a5,96(sp)
sd a5,40(sp)
call Display
li a0,10
call putchar@plt
li a5,4
li a2,5
lla a1,.LC2
li a0,1
sw a5,72(sp)
sw s0,68(sp)
call __printf_chk@plt
li a0,10
call putchar@plt
ld a5,56(sp)
mv a0,s2
sd a5,0(sp)
ld a5,64(sp)
sd a5,8(sp)
ld a5,72(sp)
sd a5,16(sp)
ld a5,80(sp)
sd a5,24(sp)
ld a5,88(sp)
sd a5,32(sp)
ld a5,96(sp)
sd a5,40(sp)
call Display
ld a4, 104(sp)
ld a5, 0(s1)
xor a5, a4, a5
li a4, 0
bne a5,zero,.L51
ld ra,136(sp)
ld s0,128(sp)
ld s1,120(sp)
ld s2,112(sp)
li a0,0
addi sp,sp,144
jr ra
.L51:
call __stack_chk_fail@plt
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "linearsearch.c"
.text
.section .rodata
.align 3
.LC0:
.string "\nElements are"
.align 3
.LC1:
.string "%d "
.text
.align 2
.global Display
.type Display, %function
Display:
.LFB0:
.cfi_startproc
stp x29, x30, [sp, -48]!
.cfi_def_cfa_offset 48
.cfi_offset 29, -48
.cfi_offset 30, -40
mov x29, sp
str x19, [sp, 16]
.cfi_offset 19, -32
mov x19, x0
adrp x0, .LC0
add x0, x0, :lo12:.LC0
bl puts
str wzr, [sp, 44]
b .L2
.L3:
ldrsw x0, [sp, 44]
ldr w0, [x19, x0, lsl 2]
mov w1, w0
adrp x0, .LC1
add x0, x0, :lo12:.LC1
bl printf
ldr w0, [sp, 44]
add w0, w0, 1
str w0, [sp, 44]
.L2:
ldr w0, [x19, 44]
ldr w1, [sp, 44]
cmp w1, w0
blt .L3
nop
nop
ldr x19, [sp, 16]
ldp x29, x30, [sp], 48
.cfi_restore 30
.cfi_restore 29
.cfi_restore 19
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE0:
.size Display, .-Display
.align 2
.global Append
.type Append, %function
Append:
.LFB1:
.cfi_startproc
sub sp, sp, #16
.cfi_def_cfa_offset 16
str x0, [sp, 8]
str w1, [sp, 4]
ldr x0, [sp, 8]
ldr w1, [x0, 44]
ldr x0, [sp, 8]
ldr w0, [x0, 40]
cmp w1, w0
bge .L6
ldr x0, [sp, 8]
ldr w0, [x0, 44]
add w2, w0, 1
ldr x1, [sp, 8]
str w2, [x1, 44]
ldr x1, [sp, 8]
sxtw x0, w0
ldr w2, [sp, 4]
str w2, [x1, x0, lsl 2]
.L6:
nop
add sp, sp, 16
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE1:
.size Append, .-Append
.align 2
.global Insert
.type Insert, %function
Insert:
.LFB2:
.cfi_startproc
sub sp, sp, #32
.cfi_def_cfa_offset 32
str x0, [sp, 8]
str w1, [sp, 4]
str w2, [sp]
ldr w0, [sp, 4]
cmp w0, 0
blt .L11
ldr x0, [sp, 8]
ldr w0, [x0, 44]
ldr w1, [sp, 4]
cmp w1, w0
bgt .L11
ldr x0, [sp, 8]
ldr w0, [x0, 44]
str w0, [sp, 28]
b .L9
.L10:
ldr w0, [sp, 28]
sub w1, w0, #1
ldr x0, [sp, 8]
sxtw x1, w1
ldr w2, [x0, x1, lsl 2]
ldr x0, [sp, 8]
ldrsw x1, [sp, 28]
str w2, [x0, x1, lsl 2]
ldr w0, [sp, 28]
sub w0, w0, #1
str w0, [sp, 28]
.L9:
ldr w1, [sp, 28]
ldr w0, [sp, 4]
cmp w1, w0
bgt .L10
ldr x0, [sp, 8]
ldrsw x1, [sp, 4]
ldr w2, [sp]
str w2, [x0, x1, lsl 2]
ldr x0, [sp, 8]
ldr w0, [x0, 44]
add w1, w0, 1
ldr x0, [sp, 8]
str w1, [x0, 44]
.L11:
nop
add sp, sp, 32
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE2:
.size Insert, .-Insert
.align 2
.global delete
.type delete, %function
delete:
.LFB3:
.cfi_startproc
sub sp, sp, #32
.cfi_def_cfa_offset 32
str x0, [sp, 8]
str w1, [sp, 4]
ldr w0, [sp, 4]
cmp w0, 0
blt .L16
ldr x0, [sp, 8]
ldr w0, [x0, 44]
ldr w1, [sp, 4]
cmp w1, w0
bge .L16
ldr w0, [sp, 4]
str w0, [sp, 28]
b .L14
.L15:
ldr w0, [sp, 28]
add w1, w0, 1
ldr x0, [sp, 8]
sxtw x1, w1
ldr w2, [x0, x1, lsl 2]
ldr x0, [sp, 8]
ldrsw x1, [sp, 28]
str w2, [x0, x1, lsl 2]
ldr w0, [sp, 28]
add w0, w0, 1
str w0, [sp, 28]
.L14:
ldr x0, [sp, 8]
ldr w0, [x0, 44]
sub w0, w0, #1
ldr w1, [sp, 28]
cmp w1, w0
blt .L15
ldr x0, [sp, 8]
ldr w0, [x0, 44]
sub w1, w0, #1
ldr x0, [sp, 8]
str w1, [x0, 44]
.L16:
nop
add sp, sp, 32
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE3:
.size delete, .-delete
.align 2
.global swap
.type swap, %function
swap:
.LFB4:
.cfi_startproc
sub sp, sp, #32
.cfi_def_cfa_offset 32
str x0, [sp, 8]
str x1, [sp]
ldr x0, [sp, 8]
ldr w0, [x0]
str w0, [sp, 28]
ldr x0, [sp]
ldr w1, [x0]
ldr x0, [sp, 8]
str w1, [x0]
ldr x0, [sp]
ldr w1, [sp, 28]
str w1, [x0]
nop
add sp, sp, 32
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE4:
.size swap, .-swap
.align 2
.global linear_search
.type linear_search, %function
linear_search:
.LFB5:
.cfi_startproc
stp x29, x30, [sp, -48]!
.cfi_def_cfa_offset 48
.cfi_offset 29, -48
.cfi_offset 30, -40
mov x29, sp
str x0, [sp, 24]
str w1, [sp, 20]
str wzr, [sp, 44]
b .L19
.L22:
ldr x0, [sp, 24]
ldrsw x1, [sp, 44]
ldr w0, [x0, x1, lsl 2]
ldr w1, [sp, 20]
cmp w1, w0
bne .L20
ldrsw x0, [sp, 44]
lsl x0, x0, 2
ldr x1, [sp, 24]
add x2, x1, x0
ldr w0, [sp, 44]
sub w0, w0, #1
sxtw x0, w0
lsl x0, x0, 2
ldr x1, [sp, 24]
add x0, x1, x0
mov x1, x0
mov x0, x2
bl swap
ldr w0, [sp, 44]
add w0, w0, 1
b .L21
.L20:
ldr w0, [sp, 44]
add w0, w0, 1
str w0, [sp, 44]
.L19:
ldr x0, [sp, 24]
ldr w0, [x0, 44]
ldr w1, [sp, 44]
cmp w1, w0
blt .L22
mov w0, 0
.L21:
ldp x29, x30, [sp], 48
.cfi_restore 30
.cfi_restore 29
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE5:
.size linear_search, .-linear_search
.section .rodata
.align 3
.LC2:
.string "%d"
.text
.align 2
.global main
.type main, %function
main:
.LFB6:
.cfi_startproc
stp x29, x30, [sp, -128]!
.cfi_def_cfa_offset 128
.cfi_offset 29, -128
.cfi_offset 30, -120
mov x29, sp
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x1, [x0]
str x1, [sp, 120]
mov x1, 0
stp xzr, xzr, [sp, 72]
stp xzr, xzr, [sp, 88]
stp xzr, xzr, [sp, 104]
mov w0, 2
str w0, [sp, 72]
mov w0, 3
str w0, [sp, 76]
mov w0, 4
str w0, [sp, 80]
mov w0, 5
str w0, [sp, 84]
mov w0, 6
str w0, [sp, 88]
mov w0, 10
str w0, [sp, 112]
mov w0, 5
str w0, [sp, 116]
add x0, sp, 72
mov w1, 10
bl Append
add x0, sp, 72
mov w2, 12
mov w1, 0
bl Insert
ldr w0, [sp, 116]
sub w1, w0, #1
add x0, sp, 72
bl delete
add x0, sp, 16
add x1, sp, 72
ldp q0, q1, [x1]
stp q0, q1, [x0]
ldr q0, [x1, 32]
str q0, [x0, 32]
add x0, sp, 16
bl Display
mov w0, 10
bl putchar
add x0, sp, 72
mov w1, 5
bl linear_search
mov w1, w0
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl printf
mov w0, 10
bl putchar
add x0, sp, 16
add x1, sp, 72
ldp q0, q1, [x1]
stp q0, q1, [x0]
ldr q0, [x1, 32]
str q0, [x0, 32]
add x0, sp, 16
bl Display
mov w0, 0
mov w1, w0
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x3, [sp, 120]
ldr x2, [x0]
subs x3, x3, x2
mov x2, 0
beq .L25
bl __stack_chk_fail
.L25:
mov w0, w1
ldp x29, x30, [sp], 128
.cfi_restore 30
.cfi_restore 29
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE6:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "linearsearch.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "\nElements are"
.align 3
.LC1:
.string "%d "
.text
.align 2
.global Display
.type Display, %function
Display:
.LFB23:
.cfi_startproc
stp x29, x30, [sp, -64]!
.cfi_def_cfa_offset 64
.cfi_offset 29, -64
.cfi_offset 30, -56
mov x29, sp
stp x19, x20, [sp, 16]
stp x21, x22, [sp, 32]
.cfi_offset 19, -48
.cfi_offset 20, -40
.cfi_offset 21, -32
.cfi_offset 22, -24
mov x20, x0
ldr w21, [x0, 44]
adrp x0, .LC0
add x0, x0, :lo12:.LC0
bl puts
cmp w21, 0
ble .L1
str x23, [sp, 48]
.cfi_offset 23, -16
add w21, w21, 1
mov x19, 1
adrp x22, .LC1
add x22, x22, :lo12:.LC1
mov w23, 1
.L3:
add x1, x20, x19, lsl 2
ldr w2, [x1, -4]
mov x1, x22
mov w0, w23
bl __printf_chk
add x19, x19, 1
cmp x19, x21
bne .L3
ldr x23, [sp, 48]
.cfi_restore 23
.L1:
ldp x19, x20, [sp, 16]
ldp x21, x22, [sp, 32]
ldp x29, x30, [sp], 64
.cfi_restore 30
.cfi_restore 29
.cfi_restore 21
.cfi_restore 22
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE23:
.size Display, .-Display
.align 2
.global Append
.type Append, %function
Append:
.LFB24:
.cfi_startproc
ldr w2, [x0, 44]
ldr w3, [x0, 40]
cmp w2, w3
bge .L6
add w3, w2, 1
str w3, [x0, 44]
str w1, [x0, w2, sxtw 2]
.L6:
ret
.cfi_endproc
.LFE24:
.size Append, .-Append
.align 2
.global Insert
.type Insert, %function
Insert:
.LFB25:
.cfi_startproc
tbnz w1, #31, .L8
ldr w6, [x0, 44]
cmp w6, w1
blt .L8
ble .L10
sxtw x3, w6
sub x5, x0, #4
.L11:
ldr w4, [x5, x3, lsl 2]
str w4, [x0, x3, lsl 2]
sub x3, x3, #1
cmp w1, w3
blt .L11
.L10:
str w2, [x0, w1, sxtw 2]
add w6, w6, 1
str w6, [x0, 44]
.L8:
ret
.cfi_endproc
.LFE25:
.size Insert, .-Insert
.align 2
.global delete
.type delete, %function
delete:
.LFB26:
.cfi_startproc
tbnz w1, #31, .L13
ldr w3, [x0, 44]
cmp w3, w1
ble .L13
sub w3, w3, #1
cmp w1, w3
bge .L15
sxtw x1, w1
add x4, x0, 4
.L16:
ldr w2, [x4, x1, lsl 2]
str w2, [x0, x1, lsl 2]
add x1, x1, 1
cmp w3, w1
bgt .L16
.L15:
str w3, [x0, 44]
.L13:
ret
.cfi_endproc
.LFE26:
.size delete, .-delete
.align 2
.global swap
.type swap, %function
swap:
.LFB27:
.cfi_startproc
ldr w2, [x0]
ldr w3, [x1]
str w3, [x0]
str w2, [x1]
ret
.cfi_endproc
.LFE27:
.size swap, .-swap
.align 2
.global linear_search
.type linear_search, %function
linear_search:
.LFB28:
.cfi_startproc
ldr w5, [x0, 44]
cmp w5, 0
ble .L23
mov x2, 0
.L22:
mov w4, w2
ldr w3, [x0, x2, lsl 2]
cmp w3, w1
beq .L25
add x2, x2, 1
cmp w5, w2
bgt .L22
mov w0, 0
b .L19
.L25:
add x1, x0, w2, sxtw 2
ldr w2, [x1, -4]
str w2, [x0, w4, sxtw 2]
str w3, [x1, -4]
add w0, w4, 1
.L19:
ret
.L23:
mov w0, 0
b .L19
.cfi_endproc
.LFE28:
.size linear_search, .-linear_search
.section .rodata.str1.8
.align 3
.LC2:
.string "%d"
.text
.align 2
.global main
.type main, %function
main:
.LFB29:
.cfi_startproc
stp x29, x30, [sp, -160]!
.cfi_def_cfa_offset 160
.cfi_offset 29, -160
.cfi_offset 30, -152
mov x29, sp
stp x19, x20, [sp, 16]
stp x21, x22, [sp, 32]
.cfi_offset 19, -144
.cfi_offset 20, -136
.cfi_offset 21, -128
.cfi_offset 22, -120
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x1, [x0]
str x1, [sp, 152]
mov x1, 0
stp xzr, xzr, [sp, 128]
mov w0, 2
str w0, [sp, 104]
mov w0, 3
str w0, [sp, 108]
mov w0, 4
str w0, [sp, 112]
mov w22, 5
str w22, [sp, 116]
mov w0, 6
str w0, [sp, 120]
mov w21, 10
str w21, [sp, 144]
str w0, [sp, 148]
str w21, [sp, 124]
add x19, sp, 104
mov w2, 12
mov x0, x19
bl Insert
ldr w1, [sp, 148]
sub w1, w1, #1
mov x0, x19
bl delete
add x20, sp, 48
ldp q0, q1, [x19]
stp q0, q1, [x20]
ldr q0, [x19, 32]
str q0, [x20, 32]
mov x0, x20
bl Display
mov w0, w21
bl putchar
mov w1, w22
mov x0, x19
bl linear_search
mov w2, w0
adrp x1, .LC2
add x1, x1, :lo12:.LC2
mov w0, 1
bl __printf_chk
mov w0, w21
bl putchar
ldp q0, q1, [x19]
stp q0, q1, [x20]
ldr q0, [x19, 32]
str q0, [x20, 32]
mov x0, x20
bl Display
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x2, [sp, 152]
ldr x1, [x0]
subs x2, x2, x1
mov x1, 0
bne .L29
mov w0, 0
ldp x19, x20, [sp, 16]
ldp x21, x22, [sp, 32]
ldp x29, x30, [sp], 160
.cfi_remember_state
.cfi_restore 30
.cfi_restore 29
.cfi_restore 21
.cfi_restore 22
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.L29:
.cfi_restore_state
bl __stack_chk_fail
.cfi_endproc
.LFE29:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "linearsearch.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "\nElements are"
.align 3
.LC1:
.string "%d "
.text
.align 2
.p2align 4,,11
.global Display
.type Display, %function
Display:
.LFB23:
.cfi_startproc
stp x29, x30, [sp, -48]!
.cfi_def_cfa_offset 48
.cfi_offset 29, -48
.cfi_offset 30, -40
adrp x1, .LC0
mov x29, sp
stp x19, x20, [sp, 16]
.cfi_offset 19, -32
.cfi_offset 20, -24
mov x20, x0
add x0, x1, :lo12:.LC0
stp x21, x22, [sp, 32]
.cfi_offset 21, -16
.cfi_offset 22, -8
ldr w21, [x20, 44]
bl puts
cmp w21, 0
ble .L1
adrp x22, .LC1
add w21, w21, 1
add x22, x22, :lo12:.LC1
mov x19, 1
.p2align 3,,7
.L3:
add x2, x20, x19, lsl 2
mov x1, x22
add x19, x19, 1
mov w0, 1
ldr w2, [x2, -4]
bl __printf_chk
cmp x19, x21
bne .L3
.L1:
ldp x19, x20, [sp, 16]
ldp x21, x22, [sp, 32]
ldp x29, x30, [sp], 48
.cfi_restore 30
.cfi_restore 29
.cfi_restore 21
.cfi_restore 22
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE23:
.size Display, .-Display
.align 2
.p2align 4,,11
.global Append
.type Append, %function
Append:
.LFB24:
.cfi_startproc
ldp w3, w2, [x0, 40]
cmp w2, w3
bge .L7
add w3, w2, 1
str w3, [x0, 44]
str w1, [x0, w2, sxtw 2]
.L7:
ret
.cfi_endproc
.LFE24:
.size Append, .-Append
.align 2
.p2align 4,,11
.global Insert
.type Insert, %function
Insert:
.LFB25:
.cfi_startproc
tbnz w1, #31, .L13
stp x29, x30, [sp, -48]!
.cfi_def_cfa_offset 48
.cfi_offset 29, -48
.cfi_offset 30, -40
mov x29, sp
stp x21, x22, [sp, 32]
.cfi_offset 21, -16
.cfi_offset 22, -8
ldr w22, [x0, 44]
stp x19, x20, [sp, 16]
.cfi_offset 19, -32
.cfi_offset 20, -24
mov x20, x0
mov w19, w1
cmp w1, w22
bgt .L9
mov w21, w2
bge .L11
sub w0, w22, w1
sub w0, w0, #1
add x2, x0, 1
neg x0, x0, lsl 2
add x1, x0, w22, sxtw 2
lsl x2, x2, 2
mov x0, x1
sub x1, x1, #4
add x1, x20, x1
add x0, x20, x0
bl memmove
.L11:
str w21, [x20, w19, sxtw 2]
add w22, w22, 1
str w22, [x20, 44]
.L9:
ldp x19, x20, [sp, 16]
ldp x21, x22, [sp, 32]
ldp x29, x30, [sp], 48
.cfi_restore 30
.cfi_restore 29
.cfi_restore 21
.cfi_restore 22
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.p2align 2,,3
.L13:
ret
.cfi_endproc
.LFE25:
.size Insert, .-Insert
.align 2
.p2align 4,,11
.global delete
.type delete, %function
delete:
.LFB26:
.cfi_startproc
tbnz w1, #31, .L20
stp x29, x30, [sp, -32]!
.cfi_def_cfa_offset 32
.cfi_offset 29, -32
.cfi_offset 30, -24
mov x29, sp
stp x19, x20, [sp, 16]
.cfi_offset 19, -16
.cfi_offset 20, -8
mov x19, x0
ldr w0, [x0, 44]
cmp w1, w0
bge .L16
sub w20, w0, #1
cmp w1, w20
bge .L18
sub w2, w0, #2
sbfiz x0, x1, 2, 32
sub w2, w2, w1
add x1, x0, 4
add x2, x2, 1
add x1, x19, x1
add x0, x19, x0
lsl x2, x2, 2
bl memmove
.L18:
str w20, [x19, 44]
.L16:
ldp x19, x20, [sp, 16]
ldp x29, x30, [sp], 32
.cfi_restore 30
.cfi_restore 29
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.p2align 2,,3
.L20:
ret
.cfi_endproc
.LFE26:
.size delete, .-delete
.align 2
.p2align 4,,11
.global swap
.type swap, %function
swap:
.LFB27:
.cfi_startproc
mov x2, x0
ldr w4, [x1]
ldr w3, [x2]
str w4, [x2]
str w3, [x1]
ret
.cfi_endproc
.LFE27:
.size swap, .-swap
.align 2
.p2align 4,,11
.global linear_search
.type linear_search, %function
linear_search:
.LFB28:
.cfi_startproc
ldr w5, [x0, 44]
mov x4, x0
cmp w5, 0
ble .L28
mov x2, 0
b .L27
.p2align 2,,3
.L26:
cmp w5, w2
ble .L28
.L27:
ldr w3, [x4, x2, lsl 2]
mov w6, w2
add w0, w2, 1
add x2, x2, 1
cmp w3, w1
bne .L26
add x2, x4, w6, sxtw 2
ldr w3, [x2, -4]
str w3, [x4, w6, sxtw 2]
str w1, [x2, -4]
ret
.p2align 2,,3
.L28:
mov w0, 0
ret
.cfi_endproc
.LFE28:
.size linear_search, .-linear_search
.section .rodata.str1.8
.align 3
.LC2:
.string "%d"
.section .text.startup,"ax",@progbits
.align 2
.p2align 4,,11
.global main
.type main, %function
main:
.LFB29:
.cfi_startproc
stp x29, x30, [sp, -160]!
.cfi_def_cfa_offset 160
.cfi_offset 29, -160
.cfi_offset 30, -152
adrp x0, :got:__stack_chk_guard
mov x4, 12
mov x29, sp
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
stp x19, x20, [sp, 16]
mov x3, 3
str x21, [sp, 32]
.cfi_offset 19, -144
.cfi_offset 20, -136
.cfi_offset 21, -128
add x20, sp, 104
mov x2, 5
mov x1, 10
ldr x5, [x0]
str x5, [sp, 152]
mov x5, 0
movk x4, 0x2, lsl 32
movk x3, 0x4, lsl 32
movk x2, 0x6, lsl 32
movk x1, 0x6, lsl 32
mov x21, 10
stp x4, x3, [sp, 104]
add x19, sp, 48
mov x0, x19
stp x2, x21, [sp, 120]
stp xzr, x1, [sp, 136]
ldp q1, q2, [x20]
ldr q0, [x20, 32]
stp q1, q2, [x19]
str q0, [x19, 32]
bl Display
mov w0, w21
bl putchar
mov w1, 5
mov x0, x20
bl linear_search
adrp x1, .LC2
mov w2, w0
add x1, x1, :lo12:.LC2
mov w0, 1
bl __printf_chk
mov w0, w21
bl putchar
ldp q1, q2, [x20]
mov x0, x19
ldr q0, [x20, 32]
stp q1, q2, [x19]
str q0, [x19, 32]
bl Display
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x2, [sp, 152]
ldr x1, [x0]
subs x2, x2, x1
mov x1, 0
bne .L33
mov w0, 0
ldp x19, x20, [sp, 16]
ldr x21, [sp, 32]
ldp x29, x30, [sp], 160
.cfi_remember_state
.cfi_restore 30
.cfi_restore 29
.cfi_restore 21
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.L33:
.cfi_restore_state
bl __stack_chk_fail
.cfi_endproc
.LFE29:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "linearsearch.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "\nElements are"
.align 3
.LC1:
.string "%d "
.text
.align 2
.p2align 4,,11
.global Display
.type Display, %function
Display:
.LFB23:
.cfi_startproc
stp x29, x30, [sp, -48]!
.cfi_def_cfa_offset 48
.cfi_offset 29, -48
.cfi_offset 30, -40
adrp x1, .LC0
mov x29, sp
stp x19, x20, [sp, 16]
.cfi_offset 19, -32
.cfi_offset 20, -24
mov x20, x0
add x0, x1, :lo12:.LC0
stp x21, x22, [sp, 32]
.cfi_offset 21, -16
.cfi_offset 22, -8
ldr w21, [x20, 44]
bl puts
cmp w21, 0
ble .L1
adrp x22, .LC1
add w21, w21, 1
add x22, x22, :lo12:.LC1
mov x19, 1
.p2align 3,,7
.L3:
add x2, x20, x19, lsl 2
mov x1, x22
add x19, x19, 1
mov w0, 1
ldr w2, [x2, -4]
bl __printf_chk
cmp x19, x21
bne .L3
.L1:
ldp x19, x20, [sp, 16]
ldp x21, x22, [sp, 32]
ldp x29, x30, [sp], 48
.cfi_restore 30
.cfi_restore 29
.cfi_restore 21
.cfi_restore 22
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE23:
.size Display, .-Display
.align 2
.p2align 4,,11
.global Append
.type Append, %function
Append:
.LFB24:
.cfi_startproc
ldp w3, w2, [x0, 40]
cmp w2, w3
bge .L7
add w3, w2, 1
str w3, [x0, 44]
str w1, [x0, w2, sxtw 2]
.L7:
ret
.cfi_endproc
.LFE24:
.size Append, .-Append
.align 2
.p2align 4,,11
.global Insert
.type Insert, %function
Insert:
.LFB25:
.cfi_startproc
tbnz w1, #31, .L13
stp x29, x30, [sp, -48]!
.cfi_def_cfa_offset 48
.cfi_offset 29, -48
.cfi_offset 30, -40
mov x29, sp
stp x21, x22, [sp, 32]
.cfi_offset 21, -16
.cfi_offset 22, -8
ldr w22, [x0, 44]
stp x19, x20, [sp, 16]
.cfi_offset 19, -32
.cfi_offset 20, -24
mov x20, x0
mov w19, w1
cmp w1, w22
bgt .L9
mov w21, w2
bge .L11
sub w0, w22, w1
sub w0, w0, #1
add x2, x0, 1
neg x0, x0, lsl 2
add x1, x0, w22, sxtw 2
lsl x2, x2, 2
mov x0, x1
sub x1, x1, #4
add x1, x20, x1
add x0, x20, x0
bl memmove
.L11:
str w21, [x20, w19, sxtw 2]
add w22, w22, 1
str w22, [x20, 44]
.L9:
ldp x19, x20, [sp, 16]
ldp x21, x22, [sp, 32]
ldp x29, x30, [sp], 48
.cfi_restore 30
.cfi_restore 29
.cfi_restore 21
.cfi_restore 22
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.p2align 2,,3
.L13:
ret
.cfi_endproc
.LFE25:
.size Insert, .-Insert
.align 2
.p2align 4,,11
.global delete
.type delete, %function
delete:
.LFB26:
.cfi_startproc
tbnz w1, #31, .L20
stp x29, x30, [sp, -32]!
.cfi_def_cfa_offset 32
.cfi_offset 29, -32
.cfi_offset 30, -24
mov x29, sp
stp x19, x20, [sp, 16]
.cfi_offset 19, -16
.cfi_offset 20, -8
mov x19, x0
ldr w0, [x0, 44]
cmp w1, w0
bge .L16
sub w20, w0, #1
cmp w1, w20
bge .L18
sub w2, w0, #2
sbfiz x0, x1, 2, 32
sub w2, w2, w1
add x1, x0, 4
add x2, x2, 1
add x1, x19, x1
add x0, x19, x0
lsl x2, x2, 2
bl memmove
.L18:
str w20, [x19, 44]
.L16:
ldp x19, x20, [sp, 16]
ldp x29, x30, [sp], 32
.cfi_restore 30
.cfi_restore 29
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.p2align 2,,3
.L20:
ret
.cfi_endproc
.LFE26:
.size delete, .-delete
.align 2
.p2align 4,,11
.global swap
.type swap, %function
swap:
.LFB27:
.cfi_startproc
mov x2, x0
ldr w4, [x1]
ldr w3, [x2]
str w4, [x2]
str w3, [x1]
ret
.cfi_endproc
.LFE27:
.size swap, .-swap
.align 2
.p2align 4,,11
.global linear_search
.type linear_search, %function
linear_search:
.LFB28:
.cfi_startproc
mov x2, x0
ldr w0, [x0, 44]
cmp w0, 0
ble .L45
ldr w3, [x2]
cmp w1, w3
beq .L28
cmp w0, 1
beq .L45
ldr w3, [x2, 4]
cmp w1, w3
beq .L30
cmp w0, 2
beq .L45
ldr w3, [x2, 8]
cmp w1, w3
beq .L32
cmp w0, 3
beq .L45
ldr w3, [x2, 12]
cmp w1, w3
beq .L34
cmp w0, 4
beq .L45
ldr w3, [x2, 16]
cmp w1, w3
beq .L36
cmp w0, 5
beq .L45
ldr w3, [x2, 20]
cmp w1, w3
beq .L38
cmp w0, 6
beq .L45
ldr w3, [x2, 24]
cmp w1, w3
beq .L40
cmp w0, 7
beq .L45
ldr w3, [x2, 28]
cmp w1, w3
beq .L42
cmp w0, 8
beq .L45
ldr w3, [x2, 32]
cmp w1, w3
beq .L44
cmp w0, 9
beq .L45
ldr w3, [x2, 36]
mov w0, 0
cmp w3, w1
beq .L47
ret
.p2align 2,,3
.L45:
mov w0, 0
ret
.L28:
mov w4, 0
mov w0, 1
.L26:
add x3, x2, w4, sxtw 2
ldr w5, [x3, -4]
str w5, [x2, w4, sxtw 2]
str w1, [x3, -4]
ret
.L47:
mov w4, 9
mov w0, 10
b .L26
.L30:
mov w4, 1
mov w0, 2
b .L26
.L32:
mov w4, 2
mov w0, 3
b .L26
.L34:
mov w4, 3
mov w0, 4
b .L26
.L36:
mov w4, 4
mov w0, 5
b .L26
.L38:
mov w4, 5
mov w0, 6
b .L26
.L40:
mov w4, 6
mov w0, 7
b .L26
.L42:
mov w4, 7
mov w0, 8
b .L26
.L44:
mov w4, 8
mov w0, 9
b .L26
.cfi_endproc
.LFE28:
.size linear_search, .-linear_search
.section .rodata.str1.8
.align 3
.LC2:
.string "%d"
.section .text.startup,"ax",@progbits
.align 2
.p2align 4,,11
.global main
.type main, %function
main:
.LFB29:
.cfi_startproc
stp x29, x30, [sp, -160]!
.cfi_def_cfa_offset 160
.cfi_offset 29, -160
.cfi_offset 30, -152
adrp x1, .LC3
adrp x0, :got:__stack_chk_guard
mov x29, sp
ldr d0, [x1, #:lo12:.LC3]
adrp x1, .LC4
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
stp x19, x20, [sp, 16]
.cfi_offset 19, -144
.cfi_offset 20, -136
add x20, sp, 96
str x21, [sp, 32]
.cfi_offset 21, -128
mov x2, 24
ldr q1, [x1, #:lo12:.LC4]
ldr x3, [x0]
str x3, [sp, 152]
mov x3, 0
mov w21, 10
mov x1, x20
add x0, sp, 100
str d0, [sp, 112]
str q1, [sp, 96]
add x19, sp, 48
stp xzr, xzr, [sp, 120]
str w21, [sp, 136]
bl memmove
mov w1, 6
mov w0, 12
str w0, [sp, 96]
mov x0, x19
str w1, [sp, 140]
ldp q1, q2, [x20]
ldr q0, [x20, 32]
stp q1, q2, [x19]
str q0, [x19, 32]
bl Display
mov w0, w21
bl putchar
adrp x0, .LC5
adrp x1, .LC2
add x1, x1, :lo12:.LC2
mov w2, 5
ldr d0, [x0, #:lo12:.LC5]
mov w0, 1
str d0, [sp, 108]
bl __printf_chk
mov w0, w21
bl putchar
ldp q1, q2, [x20]
mov x0, x19
ldr q0, [x20, 32]
stp q1, q2, [x19]
str q0, [x19, 32]
bl Display
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x2, [sp, 152]
ldr x1, [x0]
subs x2, x2, x1
mov x1, 0
bne .L51
mov w0, 0
ldp x19, x20, [sp, 16]
ldr x21, [sp, 32]
ldp x29, x30, [sp], 160
.cfi_remember_state
.cfi_restore 30
.cfi_restore 29
.cfi_restore 21
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.L51:
.cfi_restore_state
bl __stack_chk_fail
.cfi_endproc
.LFE29:
.size main, .-main
.section .rodata.cst8,"aM",@progbits,8
.align 3
.LC3:
.word 6
.word 10
.section .rodata.cst16,"aM",@progbits,16
.align 4
.LC4:
.word 2
.word 3
.word 4
.word 5
.section .rodata.cst8
.align 3
.LC5:
.word 5
.word 4
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
main.c
|
/*------------------------------------------------------------
PROGRAMACIÓN AVANZADA HW01P04
Andrés César Magaña Martínez
[email protected]
--------------------------------------------------------------*/
float SumFloats (int n){
int i;
float sumf = 0.0;
for ( i=1; i<n+1; i++ )
sumf+=(1/(float)n);
return sumf;
}
double SumDoubles (int n){
int i;
float sumd = 0.0;
for ( i=1; i<n+1; i++ )
sumd+=(1/(float)n);
return sumd;
}
#include <stdio.h>
int main (int argc, const char * argv[]) {
int i, n=10;
float sumf, errorf;
double sumd, errord;
printf("n\tSuma con floats Diferencia con el valor real\n");
for ( i=1; i<n+1; i++ )
{
sumf = SumFloats(i);
errorf = 1.0-sumf;
printf("%d %.25f \t%.25f\n", i, sumf, errorf);
}
printf("\n\n");
printf("n Suma con doubles Diferencia con el valor real\n");
for ( i=1; i<n+1; i++ )
{
sumd = SumDoubles(i);
errord = 1.0-sumd;
printf( "%d %.25lf \t%.25lf\n", i, sumd, errord );
}
printf("Presione cualquier tecla para salir...\n");
getchar();
return 0;
}
|
.file "main.c"
.option pic
.text
.align 1
.globl SumFloats
.type SumFloats, @function
SumFloats:
addi sp,sp,-48
sd s0,40(sp)
addi s0,sp,48
mv a5,a0
sw a5,-36(s0)
sw zero,-20(s0)
li a5,1
sw a5,-24(s0)
j .L2
.L3:
lw a5,-36(s0)
fcvt.s.w fa5,a5
lla a5,.LC0
flw fa4,0(a5)
fdiv.s fa5,fa4,fa5
flw fa4,-20(s0)
fadd.s fa5,fa4,fa5
fsw fa5,-20(s0)
lw a5,-24(s0)
addiw a5,a5,1
sw a5,-24(s0)
.L2:
lw a5,-36(s0)
mv a4,a5
lw a5,-24(s0)
sext.w a4,a4
sext.w a5,a5
bge a4,a5,.L3
flw fa5,-20(s0)
fmv.s fa0,fa5
ld s0,40(sp)
addi sp,sp,48
jr ra
.size SumFloats, .-SumFloats
.align 1
.globl SumDoubles
.type SumDoubles, @function
SumDoubles:
addi sp,sp,-48
sd s0,40(sp)
addi s0,sp,48
mv a5,a0
sw a5,-36(s0)
sw zero,-20(s0)
li a5,1
sw a5,-24(s0)
j .L6
.L7:
lw a5,-36(s0)
fcvt.s.w fa5,a5
lla a5,.LC0
flw fa4,0(a5)
fdiv.s fa5,fa4,fa5
flw fa4,-20(s0)
fadd.s fa5,fa4,fa5
fsw fa5,-20(s0)
lw a5,-24(s0)
addiw a5,a5,1
sw a5,-24(s0)
.L6:
lw a5,-36(s0)
mv a4,a5
lw a5,-24(s0)
sext.w a4,a4
sext.w a5,a5
bge a4,a5,.L7
flw fa5,-20(s0)
fcvt.d.s fa5,fa5
fmv.d fa0,fa5
ld s0,40(sp)
addi sp,sp,48
jr ra
.size SumDoubles, .-SumDoubles
.section .rodata
.align 3
.LC1:
.string "n\tSuma con floats Diferencia con el valor real"
.align 3
.LC2:
.string "%d %.25f \t%.25f\n"
.align 3
.LC3:
.string "\n"
.align 3
.LC4:
.string "n Suma con doubles Diferencia con el valor real"
.align 3
.LC6:
.string "%d %.25lf \t%.25lf\n"
.align 3
.LC7:
.string "Presione cualquier tecla para salir..."
.text
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-64
sd ra,56(sp)
sd s0,48(sp)
addi s0,sp,64
mv a5,a0
sd a1,-64(s0)
sw a5,-52(s0)
li a5,10
sw a5,-44(s0)
lla a0,.LC1
call puts@plt
li a5,1
sw a5,-48(s0)
j .L10
.L11:
lw a5,-48(s0)
mv a0,a5
call SumFloats
fsw fa0,-40(s0)
lla a5,.LC0
flw fa4,0(a5)
flw fa5,-40(s0)
fsub.s fa5,fa4,fa5
fsw fa5,-36(s0)
flw fa5,-40(s0)
fcvt.d.s fa4,fa5
flw fa5,-36(s0)
fcvt.d.s fa5,fa5
lw a5,-48(s0)
fmv.x.d a3,fa5
fmv.x.d a2,fa4
mv a1,a5
lla a0,.LC2
call printf@plt
lw a5,-48(s0)
addiw a5,a5,1
sw a5,-48(s0)
.L10:
lw a5,-44(s0)
mv a4,a5
lw a5,-48(s0)
sext.w a4,a4
sext.w a5,a5
bge a4,a5,.L11
lla a0,.LC3
call puts@plt
lla a0,.LC4
call puts@plt
li a5,1
sw a5,-48(s0)
j .L12
.L13:
lw a5,-48(s0)
mv a0,a5
call SumDoubles
fsd fa0,-32(s0)
lla a5,.LC5
fld fa4,0(a5)
fld fa5,-32(s0)
fsub.d fa5,fa4,fa5
fsd fa5,-24(s0)
lw a5,-48(s0)
ld a3,-24(s0)
ld a2,-32(s0)
mv a1,a5
lla a0,.LC6
call printf@plt
lw a5,-48(s0)
addiw a5,a5,1
sw a5,-48(s0)
.L12:
lw a5,-44(s0)
mv a4,a5
lw a5,-48(s0)
sext.w a4,a4
sext.w a5,a5
bge a4,a5,.L13
lla a0,.LC7
call puts@plt
call getchar@plt
li a5,0
mv a0,a5
ld ra,56(sp)
ld s0,48(sp)
addi sp,sp,64
jr ra
.size main, .-main
.section .rodata
.align 2
.LC0:
.word 1065353216
.align 3
.LC5:
.word 0
.word 1072693248
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "main.c"
.option pic
.text
.align 1
.globl SumFloats
.type SumFloats, @function
SumFloats:
ble a0,zero,.L4
fcvt.s.w fa4,a0
flw fa5,.LC0,a5
fdiv.s fa5,fa5,fa4
addiw a0,a0,1
fmv.w.x fa0,zero
li a5,1
.L3:
fadd.s fa0,fa0,fa5
addiw a5,a5,1
bne a5,a0,.L3
ret
.L4:
fmv.w.x fa0,zero
ret
.size SumFloats, .-SumFloats
.align 1
.globl SumDoubles
.type SumDoubles, @function
SumDoubles:
ble a0,zero,.L9
fcvt.s.w fa4,a0
flw fa5,.LC0,a5
fdiv.s fa5,fa5,fa4
addiw a0,a0,1
fmv.w.x fa0,zero
li a5,1
.L8:
fadd.s fa0,fa0,fa5
addiw a5,a5,1
bne a5,a0,.L8
.L7:
fcvt.d.s fa0,fa0
ret
.L9:
fmv.w.x fa0,zero
j .L7
.size SumDoubles, .-SumDoubles
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC1:
.string "n\tSuma con floats Diferencia con el valor real"
.align 3
.LC2:
.string "%d %.25f \t%.25f\n"
.align 3
.LC3:
.string "\n"
.align 3
.LC4:
.string "n Suma con doubles Diferencia con el valor real"
.align 3
.LC6:
.string "%d %.25lf \t%.25lf\n"
.align 3
.LC7:
.string "Presione cualquier tecla para salir..."
.text
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-48
sd ra,40(sp)
sd s0,32(sp)
sd s1,24(sp)
sd s2,16(sp)
fsd fs0,8(sp)
lla a0,.LC1
call puts@plt
li s0,1
flw fs0,.LC0,a5
lla s2,.LC2
li s1,11
.L12:
mv a0,s0
call SumFloats
fsub.s fa5,fs0,fa0
fcvt.d.s fa5,fa5
fmv.x.d a4,fa5
fcvt.d.s fa5,fa0
fmv.x.d a3,fa5
mv a2,s0
mv a1,s2
li a0,1
call __printf_chk@plt
addiw s0,s0,1
bne s0,s1,.L12
lla a0,.LC3
call puts@plt
lla a0,.LC4
call puts@plt
li s0,1
fld fs0,.LC5,a5
lla s2,.LC6
li s1,11
.L13:
mv a0,s0
call SumDoubles
fsub.d fa5,fs0,fa0
fmv.x.d a4,fa5
fmv.x.d a3,fa0
mv a2,s0
mv a1,s2
li a0,1
call __printf_chk@plt
addiw s0,s0,1
bne s0,s1,.L13
lla a0,.LC7
call puts@plt
la a5,stdin
ld a0,0(a5)
call getc@plt
li a0,0
ld ra,40(sp)
ld s0,32(sp)
ld s1,24(sp)
ld s2,16(sp)
fld fs0,8(sp)
addi sp,sp,48
jr ra
.size main, .-main
.section .rodata.cst4,"aM",@progbits,4
.align 2
.LC0:
.word 1065353216
.section .rodata.cst8,"aM",@progbits,8
.align 3
.LC5:
.word 0
.word 1072693248
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "main.c"
.option pic
.text
.align 1
.globl SumFloats
.type SumFloats, @function
SumFloats:
ble a0,zero,.L4
fcvt.s.w fa4,a0
flw fa5,.LC0,a5
fmv.w.x fa0,zero
fdiv.s fa5,fa5,fa4
addiw a0,a0,1
li a5,1
.L3:
addiw a5,a5,1
fadd.s fa0,fa0,fa5
bne a5,a0,.L3
ret
.L4:
fmv.w.x fa0,zero
ret
.size SumFloats, .-SumFloats
.align 1
.globl SumDoubles
.type SumDoubles, @function
SumDoubles:
ble a0,zero,.L10
fcvt.s.w fa4,a0
flw fa5,.LC0,a5
fmv.w.x fa0,zero
fdiv.s fa5,fa5,fa4
addiw a0,a0,1
li a5,1
.L9:
addiw a5,a5,1
fadd.s fa0,fa0,fa5
bne a0,a5,.L9
fcvt.d.s fa0,fa0
ret
.L10:
fmv.d.x fa0,zero
ret
.size SumDoubles, .-SumDoubles
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC1:
.string "n\tSuma con floats Diferencia con el valor real"
.align 3
.LC2:
.string "%d %.25f \t%.25f\n"
.align 3
.LC3:
.string "\n"
.align 3
.LC4:
.string "n Suma con doubles Diferencia con el valor real"
.align 3
.LC6:
.string "%d %.25lf \t%.25lf\n"
.align 3
.LC7:
.string "Presione cualquier tecla para salir..."
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-48
lla a0,.LC1
sd s0,32(sp)
sd s1,24(sp)
sd s2,16(sp)
fsd fs0,8(sp)
sd ra,40(sp)
fsd fs1,0(sp)
li s0,2
call puts@plt
lla s2,.LC2
flw fs0,.LC0,a5
li s1,12
.L13:
addiw a2,s0,-1
fcvt.s.w fa4,a2
fmv.w.x fa5,zero
li a5,1
fdiv.s fa4,fs0,fa4
sext.w a4,s0
.L14:
addiw a5,a5,1
fadd.s fa5,fa5,fa4
bne a5,a4,.L14
fsub.s fa4,fs0,fa5
fcvt.d.s fa5,fa5
addiw s0,s0,1
mv a1,s2
fmv.x.d a3,fa5
fcvt.d.s fa5,fa4
li a0,1
fmv.x.d a4,fa5
call __printf_chk@plt
bne s0,s1,.L13
lla a0,.LC3
call puts@plt
lla a0,.LC4
call puts@plt
li s0,2
fld fs1,.LC5,a5
lla s2,.LC6
li s1,12
.L16:
addiw a2,s0,-1
fcvt.s.w fa4,a2
fmv.w.x fa5,zero
li a5,1
fdiv.s fa4,fs0,fa4
sext.w a4,s0
.L17:
addiw a5,a5,1
fadd.s fa5,fa5,fa4
bne a4,a5,.L17
fcvt.d.s fa5,fa5
addiw s0,s0,1
mv a1,s2
fsub.d fa4,fs1,fa5
fmv.x.d a3,fa5
li a0,1
fmv.x.d a4,fa4
call __printf_chk@plt
bne s0,s1,.L16
lla a0,.LC7
call puts@plt
la a5,stdin
ld a0,0(a5)
call getc@plt
ld ra,40(sp)
ld s0,32(sp)
ld s1,24(sp)
ld s2,16(sp)
fld fs0,8(sp)
fld fs1,0(sp)
li a0,0
addi sp,sp,48
jr ra
.size main, .-main
.section .rodata.cst4,"aM",@progbits,4
.align 2
.LC0:
.word 1065353216
.section .rodata.cst8,"aM",@progbits,8
.align 3
.LC5:
.word 0
.word 1072693248
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "main.c"
.option pic
.text
.align 1
.globl SumFloats
.type SumFloats, @function
SumFloats:
ble a0,zero,.L4
fcvt.s.w fa4,a0
flw fa5,.LC0,a5
fmv.w.x fa0,zero
fdiv.s fa5,fa5,fa4
addiw a0,a0,1
li a5,1
.L3:
addiw a5,a5,1
fadd.s fa0,fa0,fa5
bne a5,a0,.L3
ret
.L4:
fmv.w.x fa0,zero
ret
.size SumFloats, .-SumFloats
.align 1
.globl SumDoubles
.type SumDoubles, @function
SumDoubles:
ble a0,zero,.L10
fcvt.s.w fa4,a0
flw fa5,.LC0,a5
fmv.w.x fa0,zero
fdiv.s fa5,fa5,fa4
addiw a0,a0,1
li a5,1
.L9:
addiw a5,a5,1
fadd.s fa0,fa0,fa5
bne a0,a5,.L9
fcvt.d.s fa0,fa0
ret
.L10:
fmv.d.x fa0,zero
ret
.size SumDoubles, .-SumDoubles
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC1:
.string "n\tSuma con floats Diferencia con el valor real"
.align 3
.LC2:
.string "%d %.25f \t%.25f\n"
.align 3
.LC3:
.string "\n"
.align 3
.LC4:
.string "n Suma con doubles Diferencia con el valor real"
.align 3
.LC6:
.string "%d %.25lf \t%.25lf\n"
.align 3
.LC7:
.string "Presione cualquier tecla para salir..."
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-112
fsd fs1,16(sp)
fmv.w.x fs1,zero
lla a0,.LC1
sd s0,96(sp)
sd s1,88(sp)
sd s2,80(sp)
sd s3,72(sp)
sd s4,64(sp)
sd s5,56(sp)
sd s6,48(sp)
sd s7,40(sp)
fsd fs0,24(sp)
sd ra,104(sp)
fsd fs2,8(sp)
li s0,1
call puts@plt
li s1,1
flw fs0,.LC0,a5
li s2,2
li s3,3
li s4,4
li s5,5
li s6,6
li s7,7
.L13:
fcvt.s.w fa4,s0
fdiv.s fa4,fs0,fa4
fadd.s fa5,fa4,fs1
beq s0,s1,.L15
fadd.s fa5,fa5,fa4
beq s0,s2,.L15
fadd.s fa5,fa5,fa4
beq s0,s3,.L15
fadd.s fa5,fa5,fa4
beq s0,s4,.L15
fadd.s fa5,fa5,fa4
beq s0,s5,.L15
fadd.s fa5,fa5,fa4
beq s0,s6,.L15
fadd.s fa5,fa5,fa4
beq s0,s7,.L15
li a5,8
fadd.s fa5,fa5,fa4
beq s0,a5,.L15
li a5,10
fadd.s fa5,fa5,fa4
bne s0,a5,.L15
fadd.s fa5,fa5,fa4
.L15:
fsub.s fa4,fs0,fa5
fcvt.d.s fa5,fa5
mv a2,s0
lla a1,.LC2
fmv.x.d a3,fa5
fcvt.d.s fa5,fa4
li a0,1
addiw s0,s0,1
fmv.x.d a4,fa5
call __printf_chk@plt
li a5,11
bne s0,a5,.L13
lla a0,.LC3
call puts@plt
fmv.w.x fs2,zero
lla a0,.LC4
call puts@plt
li s0,1
fld fs1,.LC5,a5
li s1,1
li s2,2
li s3,3
li s4,4
li s5,5
li s6,6
li s7,7
.L17:
fcvt.s.w fa4,s0
fdiv.s fa4,fs0,fa4
fadd.s fa5,fa4,fs2
beq s0,s1,.L19
fadd.s fa5,fa5,fa4
beq s0,s2,.L19
fadd.s fa5,fa5,fa4
beq s0,s3,.L19
fadd.s fa5,fa5,fa4
beq s0,s4,.L19
fadd.s fa5,fa5,fa4
beq s0,s5,.L19
fadd.s fa5,fa5,fa4
beq s0,s6,.L19
fadd.s fa5,fa5,fa4
beq s0,s7,.L19
li a5,8
fadd.s fa5,fa5,fa4
beq s0,a5,.L19
li a5,10
fadd.s fa5,fa5,fa4
bne s0,a5,.L19
fadd.s fa5,fa5,fa4
.L19:
fcvt.d.s fa5,fa5
mv a2,s0
lla a1,.LC6
fsub.d fa4,fs1,fa5
fmv.x.d a3,fa5
li a0,1
addiw s0,s0,1
fmv.x.d a4,fa4
call __printf_chk@plt
li a5,11
bne s0,a5,.L17
lla a0,.LC7
call puts@plt
la a5,stdin
ld a0,0(a5)
call getc@plt
ld ra,104(sp)
ld s0,96(sp)
ld s1,88(sp)
ld s2,80(sp)
ld s3,72(sp)
ld s4,64(sp)
ld s5,56(sp)
ld s6,48(sp)
ld s7,40(sp)
fld fs0,24(sp)
fld fs1,16(sp)
fld fs2,8(sp)
li a0,0
addi sp,sp,112
jr ra
.size main, .-main
.section .rodata.cst4,"aM",@progbits,4
.align 2
.LC0:
.word 1065353216
.section .rodata.cst8,"aM",@progbits,8
.align 3
.LC5:
.word 0
.word 1072693248
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "main.c"
.text
.align 2
.global SumFloats
.type SumFloats, %function
SumFloats:
.LFB0:
.cfi_startproc
sub sp, sp, #32
.cfi_def_cfa_offset 32
str w0, [sp, 12]
str wzr, [sp, 28]
mov w0, 1
str w0, [sp, 24]
b .L2
.L3:
ldr s0, [sp, 12]
scvtf s0, s0
fmov s1, 1.0e+0
fdiv s0, s1, s0
ldr s1, [sp, 28]
fadd s0, s1, s0
str s0, [sp, 28]
ldr w0, [sp, 24]
add w0, w0, 1
str w0, [sp, 24]
.L2:
ldr w1, [sp, 12]
ldr w0, [sp, 24]
cmp w1, w0
bge .L3
ldr s0, [sp, 28]
add sp, sp, 32
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE0:
.size SumFloats, .-SumFloats
.align 2
.global SumDoubles
.type SumDoubles, %function
SumDoubles:
.LFB1:
.cfi_startproc
sub sp, sp, #32
.cfi_def_cfa_offset 32
str w0, [sp, 12]
str wzr, [sp, 28]
mov w0, 1
str w0, [sp, 24]
b .L6
.L7:
ldr s0, [sp, 12]
scvtf s0, s0
fmov s1, 1.0e+0
fdiv s0, s1, s0
ldr s1, [sp, 28]
fadd s0, s1, s0
str s0, [sp, 28]
ldr w0, [sp, 24]
add w0, w0, 1
str w0, [sp, 24]
.L6:
ldr w1, [sp, 12]
ldr w0, [sp, 24]
cmp w1, w0
bge .L7
ldr s0, [sp, 28]
fcvt d0, s0
add sp, sp, 32
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE1:
.size SumDoubles, .-SumDoubles
.section .rodata
.align 3
.LC0:
.string "n\tSuma con floats Diferencia con el valor real"
.align 3
.LC1:
.string "%d %.25f \t%.25f\n"
.align 3
.LC2:
.string "\n"
.align 3
.LC3:
.string "n Suma con doubles Diferencia con el valor real"
.align 3
.LC4:
.string "%d %.25lf \t%.25lf\n"
.align 3
.LC5:
.string "Presione cualquier tecla para salir..."
.text
.align 2
.global main
.type main, %function
main:
.LFB2:
.cfi_startproc
stp x29, x30, [sp, -64]!
.cfi_def_cfa_offset 64
.cfi_offset 29, -64
.cfi_offset 30, -56
mov x29, sp
str w0, [sp, 28]
str x1, [sp, 16]
mov w0, 10
str w0, [sp, 36]
adrp x0, .LC0
add x0, x0, :lo12:.LC0
bl puts
mov w0, 1
str w0, [sp, 32]
b .L10
.L11:
ldr w0, [sp, 32]
bl SumFloats
str s0, [sp, 40]
fmov s1, 1.0e+0
ldr s0, [sp, 40]
fsub s0, s1, s0
str s0, [sp, 44]
ldr s0, [sp, 40]
fcvt d2, s0
ldr s0, [sp, 44]
fcvt d0, s0
fmov d1, d0
fmov d0, d2
ldr w1, [sp, 32]
adrp x0, .LC1
add x0, x0, :lo12:.LC1
bl printf
ldr w0, [sp, 32]
add w0, w0, 1
str w0, [sp, 32]
.L10:
ldr w1, [sp, 36]
ldr w0, [sp, 32]
cmp w1, w0
bge .L11
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl puts
adrp x0, .LC3
add x0, x0, :lo12:.LC3
bl puts
mov w0, 1
str w0, [sp, 32]
b .L12
.L13:
ldr w0, [sp, 32]
bl SumDoubles
str d0, [sp, 48]
fmov d1, 1.0e+0
ldr d0, [sp, 48]
fsub d0, d1, d0
str d0, [sp, 56]
ldr d1, [sp, 56]
ldr d0, [sp, 48]
ldr w1, [sp, 32]
adrp x0, .LC4
add x0, x0, :lo12:.LC4
bl printf
ldr w0, [sp, 32]
add w0, w0, 1
str w0, [sp, 32]
.L12:
ldr w1, [sp, 36]
ldr w0, [sp, 32]
cmp w1, w0
bge .L13
adrp x0, .LC5
add x0, x0, :lo12:.LC5
bl puts
bl getchar
mov w0, 0
ldp x29, x30, [sp], 64
.cfi_restore 30
.cfi_restore 29
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE2:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "main.c"
.text
.align 2
.global SumFloats
.type SumFloats, %function
SumFloats:
.LFB0:
.cfi_startproc
cmp w0, 0
ble .L4
scvtf s0, w0
fmov s1, 1.0e+0
fdiv s1, s1, s0
add w1, w0, 1
movi v0.2s, #0
mov w0, 1
.L3:
fadd s0, s0, s1
add w0, w0, 1
cmp w0, w1
bne .L3
.L1:
ret
.L4:
movi v0.2s, #0
b .L1
.cfi_endproc
.LFE0:
.size SumFloats, .-SumFloats
.align 2
.global SumDoubles
.type SumDoubles, %function
SumDoubles:
.LFB1:
.cfi_startproc
cmp w0, 0
ble .L9
scvtf s0, w0
fmov s1, 1.0e+0
fdiv s1, s1, s0
add w1, w0, 1
movi v0.2s, #0
mov w0, 1
.L8:
fadd s0, s0, s1
add w0, w0, 1
cmp w0, w1
bne .L8
.L7:
fcvt d0, s0
ret
.L9:
movi v0.2s, #0
b .L7
.cfi_endproc
.LFE1:
.size SumDoubles, .-SumDoubles
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "n\tSuma con floats Diferencia con el valor real"
.align 3
.LC1:
.string "%d %.25f \t%.25f\n"
.align 3
.LC2:
.string "\n"
.align 3
.LC3:
.string "n Suma con doubles Diferencia con el valor real"
.align 3
.LC4:
.string "%d %.25lf \t%.25lf\n"
.align 3
.LC5:
.string "Presione cualquier tecla para salir..."
.text
.align 2
.global main
.type main, %function
main:
.LFB25:
.cfi_startproc
stp x29, x30, [sp, -48]!
.cfi_def_cfa_offset 48
.cfi_offset 29, -48
.cfi_offset 30, -40
mov x29, sp
stp x19, x20, [sp, 16]
str x21, [sp, 32]
str d8, [sp, 40]
.cfi_offset 19, -32
.cfi_offset 20, -24
.cfi_offset 21, -16
.cfi_offset 72, -8
adrp x0, .LC0
add x0, x0, :lo12:.LC0
bl puts
mov w19, 1
fmov s8, 1.0e+0
adrp x20, .LC1
add x20, x20, :lo12:.LC1
mov w21, w19
.L12:
mov w0, w19
bl SumFloats
fsub s1, s8, s0
fcvt d1, s1
fcvt d0, s0
mov w2, w19
mov x1, x20
mov w0, w21
bl __printf_chk
add w19, w19, 1
cmp w19, 11
bne .L12
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl puts
adrp x0, .LC3
add x0, x0, :lo12:.LC3
bl puts
mov w19, 1
fmov d8, 1.0e+0
adrp x20, .LC4
add x20, x20, :lo12:.LC4
mov w21, w19
.L13:
mov w0, w19
bl SumDoubles
fsub d1, d8, d0
mov w2, w19
mov x1, x20
mov w0, w21
bl __printf_chk
add w19, w19, 1
cmp w19, 11
bne .L13
adrp x0, .LC5
add x0, x0, :lo12:.LC5
bl puts
adrp x0, :got:stdin
ldr x0, [x0, #:got_lo12:stdin]
ldr x0, [x0]
bl getc
mov w0, 0
ldr d8, [sp, 40]
ldp x19, x20, [sp, 16]
ldr x21, [sp, 32]
ldp x29, x30, [sp], 48
.cfi_restore 30
.cfi_restore 29
.cfi_restore 21
.cfi_restore 19
.cfi_restore 20
.cfi_restore 72
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE25:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "main.c"
.text
.align 2
.p2align 4,,11
.global SumFloats
.type SumFloats, %function
SumFloats:
.LFB0:
.cfi_startproc
cmp w0, 0
ble .L4
scvtf s2, w0
fmov s1, 1.0e+0
movi v0.2s, #0
add w1, w0, 1
mov w0, 1
fdiv s1, s1, s2
.p2align 3,,7
.L3:
add w0, w0, 1
fadd s0, s0, s1
cmp w0, w1
bne .L3
ret
.p2align 2,,3
.L4:
movi v0.2s, #0
ret
.cfi_endproc
.LFE0:
.size SumFloats, .-SumFloats
.align 2
.p2align 4,,11
.global SumDoubles
.type SumDoubles, %function
SumDoubles:
.LFB1:
.cfi_startproc
cmp w0, 0
ble .L10
scvtf s2, w0
fmov s1, 1.0e+0
movi v0.2s, #0
add w1, w0, 1
mov w0, 1
fdiv s1, s1, s2
.p2align 3,,7
.L9:
add w0, w0, 1
fadd s0, s0, s1
cmp w1, w0
bne .L9
fcvt d0, s0
ret
.p2align 2,,3
.L10:
movi d0, #0
ret
.cfi_endproc
.LFE1:
.size SumDoubles, .-SumDoubles
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "n\tSuma con floats Diferencia con el valor real"
.align 3
.LC1:
.string "%d %.25f \t%.25f\n"
.align 3
.LC2:
.string "\n"
.align 3
.LC3:
.string "n Suma con doubles Diferencia con el valor real"
.align 3
.LC4:
.string "%d %.25lf \t%.25lf\n"
.align 3
.LC5:
.string "Presione cualquier tecla para salir..."
.section .text.startup,"ax",@progbits
.align 2
.p2align 4,,11
.global main
.type main, %function
main:
.LFB25:
.cfi_startproc
stp x29, x30, [sp, -48]!
.cfi_def_cfa_offset 48
.cfi_offset 29, -48
.cfi_offset 30, -40
adrp x0, .LC0
add x0, x0, :lo12:.LC0
mov x29, sp
stp d8, d9, [sp, 32]
.cfi_offset 72, -16
.cfi_offset 73, -8
fmov s8, 1.0e+0
stp x19, x20, [sp, 16]
.cfi_offset 19, -32
.cfi_offset 20, -24
adrp x20, .LC1
bl puts
add x20, x20, :lo12:.LC1
mov w0, 2
.p2align 3,,7
.L13:
sub w2, w0, #1
movi v0.2s, #0
mov w19, 1
scvtf s1, w2
fdiv s1, s8, s1
.p2align 3,,7
.L14:
add w19, w19, 1
fadd s0, s0, s1
cmp w19, w0
bne .L14
fsub s1, s8, s0
fcvt d0, s0
mov x1, x20
mov w0, 1
fcvt d1, s1
bl __printf_chk
add w0, w19, 1
cmp w19, 11
bne .L13
adrp x0, .LC2
adrp x20, .LC4
add x0, x0, :lo12:.LC2
add x20, x20, :lo12:.LC4
bl puts
mov w19, 2
fmov s9, 1.0e+0
fmov d8, 1.0e+0
adrp x0, .LC3
add x0, x0, :lo12:.LC3
bl puts
.p2align 3,,7
.L16:
sub w2, w19, #1
movi v0.2s, #0
mov w0, 1
scvtf s1, w2
fdiv s1, s9, s1
.p2align 3,,7
.L17:
add w0, w0, 1
fadd s0, s0, s1
cmp w19, w0
bne .L17
fcvt d0, s0
add w19, w19, 1
mov x1, x20
mov w0, 1
fsub d1, d8, d0
bl __printf_chk
cmp w19, 12
bne .L16
adrp x0, .LC5
add x0, x0, :lo12:.LC5
bl puts
adrp x0, :got:stdin
ldr x0, [x0, #:got_lo12:stdin]
ldr x0, [x0]
bl getc
mov w0, 0
ldp x19, x20, [sp, 16]
ldp d8, d9, [sp, 32]
ldp x29, x30, [sp], 48
.cfi_restore 30
.cfi_restore 29
.cfi_restore 19
.cfi_restore 20
.cfi_restore 72
.cfi_restore 73
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE25:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "main.c"
.text
.align 2
.p2align 4,,11
.global SumFloats
.type SumFloats, %function
SumFloats:
.LFB0:
.cfi_startproc
cmp w0, 0
ble .L4
scvtf s2, w0
fmov s1, 1.0e+0
movi v0.2s, #0
add w1, w0, 1
mov w0, 1
fdiv s1, s1, s2
.p2align 3,,7
.L3:
add w0, w0, 1
fadd s0, s0, s1
cmp w0, w1
bne .L3
ret
.p2align 2,,3
.L4:
movi v0.2s, #0
ret
.cfi_endproc
.LFE0:
.size SumFloats, .-SumFloats
.align 2
.p2align 4,,11
.global SumDoubles
.type SumDoubles, %function
SumDoubles:
.LFB1:
.cfi_startproc
cmp w0, 0
ble .L10
scvtf s2, w0
fmov s1, 1.0e+0
movi v0.2s, #0
add w1, w0, 1
mov w0, 1
fdiv s1, s1, s2
.p2align 3,,7
.L9:
add w0, w0, 1
fadd s0, s0, s1
cmp w1, w0
bne .L9
fcvt d0, s0
ret
.p2align 2,,3
.L10:
movi d0, #0
ret
.cfi_endproc
.LFE1:
.size SumDoubles, .-SumDoubles
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "n\tSuma con floats Diferencia con el valor real"
.align 3
.LC1:
.string "%d %.25f \t%.25f\n"
.align 3
.LC2:
.string "\n"
.align 3
.LC3:
.string "n Suma con doubles Diferencia con el valor real"
.align 3
.LC4:
.string "%d %.25lf \t%.25lf\n"
.align 3
.LC5:
.string "Presione cualquier tecla para salir..."
.section .text.startup,"ax",@progbits
.align 2
.p2align 4,,11
.global main
.type main, %function
main:
.LFB25:
.cfi_startproc
stp x29, x30, [sp, -64]!
.cfi_def_cfa_offset 64
.cfi_offset 29, -64
.cfi_offset 30, -56
adrp x0, .LC0
add x0, x0, :lo12:.LC0
mov x29, sp
stp d8, d9, [sp, 32]
.cfi_offset 72, -32
.cfi_offset 73, -24
fmov s8, 1.0e+0
stp x19, x20, [sp, 16]
.cfi_offset 19, -48
.cfi_offset 20, -40
adrp x20, .LC1
add x20, x20, :lo12:.LC1
str d10, [sp, 48]
.cfi_offset 74, -16
bl puts
movi v9.2s, #0
mov w19, 1
.p2align 3,,7
.L13:
scvtf s1, w19
fdiv s1, s8, s1
fadd s0, s1, s9
cmp w19, 1
beq .L15
fadd s0, s0, s1
cmp w19, 2
beq .L15
fadd s0, s0, s1
cmp w19, 3
beq .L15
fadd s0, s0, s1
cmp w19, 4
beq .L15
fadd s0, s0, s1
cmp w19, 5
beq .L15
fadd s0, s0, s1
cmp w19, 6
beq .L15
fadd s0, s0, s1
cmp w19, 7
beq .L15
fadd s0, s0, s1
cmp w19, 8
beq .L15
fadd s0, s0, s1
cmp w19, 10
bne .L15
fadd s0, s0, s1
.L15:
fsub s1, s8, s0
fcvt d0, s0
mov w2, w19
mov x1, x20
add w19, w19, 1
mov w0, 1
fcvt d1, s1
bl __printf_chk
cmp w19, 11
bne .L13
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl puts
adrp x20, .LC4
movi v9.2s, #0
fmov s10, 1.0e+0
adrp x0, .LC3
add x20, x20, :lo12:.LC4
add x0, x0, :lo12:.LC3
mov w19, 1
bl puts
fmov d8, 1.0e+0
.p2align 3,,7
.L17:
scvtf s1, w19
fdiv s1, s10, s1
fadd s0, s1, s9
cmp w19, 1
beq .L19
fadd s0, s0, s1
cmp w19, 2
beq .L19
fadd s0, s0, s1
cmp w19, 3
beq .L19
fadd s0, s0, s1
cmp w19, 4
beq .L19
fadd s0, s0, s1
cmp w19, 5
beq .L19
fadd s0, s0, s1
cmp w19, 6
beq .L19
fadd s0, s0, s1
cmp w19, 7
beq .L19
fadd s0, s0, s1
cmp w19, 8
beq .L19
fadd s0, s0, s1
cmp w19, 10
bne .L19
fadd s0, s0, s1
.L19:
fcvt d0, s0
mov w2, w19
mov x1, x20
add w19, w19, 1
mov w0, 1
fsub d1, d8, d0
bl __printf_chk
cmp w19, 11
bne .L17
adrp x0, .LC5
add x0, x0, :lo12:.LC5
bl puts
adrp x0, :got:stdin
ldr x0, [x0, #:got_lo12:stdin]
ldr x0, [x0]
bl getc
mov w0, 0
ldr d10, [sp, 48]
ldp x19, x20, [sp, 16]
ldp d8, d9, [sp, 32]
ldp x29, x30, [sp], 64
.cfi_restore 30
.cfi_restore 29
.cfi_restore 19
.cfi_restore 20
.cfi_restore 74
.cfi_restore 72
.cfi_restore 73
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE25:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
oppgave1.c
|
#include <stdio.h>
struct deltager
{
char navn[30];
int poeng;
};
int main(void){
struct deltager jim, tom;
printf("Navn 1: ");
scanf("%s", jim.navn);
printf("Poeng:");
scanf("%d", &jim.poeng);
printf("Navn 2: ");
scanf("%s", tom.navn);
printf("Poeng:");
scanf("%d", &tom.poeng);
if(tom.poeng<jim.poeng){
printf("%s, vinner\n", jim.navn);
} else {
printf("%s, vinner\n", tom.navn);
}
}
|
.file "oppgave1.c"
.option pic
.text
.section .rodata
.align 3
.LC0:
.string "Navn 1: "
.align 3
.LC1:
.string "%s"
.align 3
.LC2:
.string "Poeng:"
.align 3
.LC3:
.string "%d"
.align 3
.LC4:
.string "Navn 2: "
.align 3
.LC5:
.string "%s, vinner\n"
.text
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-112
sd ra,104(sp)
sd s0,96(sp)
addi s0,sp,112
la a5,__stack_chk_guard
ld a4, 0(a5)
sd a4, -24(s0)
li a4, 0
lla a0,.LC0
call printf@plt
addi a5,s0,-104
mv a1,a5
lla a0,.LC1
call __isoc99_scanf@plt
lla a0,.LC2
call printf@plt
addi a5,s0,-104
addi a5,a5,32
mv a1,a5
lla a0,.LC3
call __isoc99_scanf@plt
lla a0,.LC4
call printf@plt
addi a5,s0,-64
mv a1,a5
lla a0,.LC1
call __isoc99_scanf@plt
lla a0,.LC2
call printf@plt
addi a5,s0,-64
addi a5,a5,32
mv a1,a5
lla a0,.LC3
call __isoc99_scanf@plt
lw a4,-32(s0)
lw a5,-72(s0)
bge a4,a5,.L2
addi a5,s0,-104
mv a1,a5
lla a0,.LC5
call printf@plt
j .L3
.L2:
addi a5,s0,-64
mv a1,a5
lla a0,.LC5
call printf@plt
.L3:
li a5,0
mv a4,a5
la a5,__stack_chk_guard
ld a3, -24(s0)
ld a5, 0(a5)
xor a5, a3, a5
li a3, 0
beq a5,zero,.L5
call __stack_chk_fail@plt
.L5:
mv a0,a4
ld ra,104(sp)
ld s0,96(sp)
addi sp,sp,112
jr ra
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "oppgave1.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "Navn 1: "
.align 3
.LC1:
.string "%s"
.align 3
.LC2:
.string "Poeng:"
.align 3
.LC3:
.string "%d"
.align 3
.LC4:
.string "Navn 2: "
.align 3
.LC5:
.string "%s, vinner\n"
.text
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-112
sd ra,104(sp)
la a5,__stack_chk_guard
ld a4, 0(a5)
sd a4, 88(sp)
li a4, 0
lla a1,.LC0
li a0,1
call __printf_chk@plt
addi a1,sp,8
lla a0,.LC1
call __isoc99_scanf@plt
lla a1,.LC2
li a0,1
call __printf_chk@plt
addi a1,sp,40
lla a0,.LC3
call __isoc99_scanf@plt
lla a1,.LC4
li a0,1
call __printf_chk@plt
addi a1,sp,48
lla a0,.LC1
call __isoc99_scanf@plt
lla a1,.LC2
li a0,1
call __printf_chk@plt
addi a1,sp,80
lla a0,.LC3
call __isoc99_scanf@plt
lw a4,80(sp)
lw a5,40(sp)
bge a4,a5,.L2
addi a2,sp,8
lla a1,.LC5
li a0,1
call __printf_chk@plt
.L3:
la a5,__stack_chk_guard
ld a4, 88(sp)
ld a5, 0(a5)
xor a5, a4, a5
li a4, 0
bne a5,zero,.L6
li a0,0
ld ra,104(sp)
addi sp,sp,112
jr ra
.L2:
addi a2,sp,48
lla a1,.LC5
li a0,1
call __printf_chk@plt
j .L3
.L6:
call __stack_chk_fail@plt
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "oppgave1.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "Navn 1: "
.align 3
.LC1:
.string "%s"
.align 3
.LC2:
.string "Poeng:"
.align 3
.LC3:
.string "%d"
.align 3
.LC4:
.string "Navn 2: "
.align 3
.LC5:
.string "%s, vinner\n"
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-128
sd s0,112(sp)
la s0,__stack_chk_guard
ld a5, 0(s0)
sd a5, 88(sp)
li a5, 0
lla a1,.LC0
li a0,1
sd ra,120(sp)
sd s1,104(sp)
sd s2,96(sp)
call __printf_chk@plt
addi s2,sp,8
mv a1,s2
lla a0,.LC1
call __isoc99_scanf@plt
lla a1,.LC2
li a0,1
call __printf_chk@plt
addi a1,sp,40
lla a0,.LC3
call __isoc99_scanf@plt
lla a1,.LC4
li a0,1
call __printf_chk@plt
addi s1,sp,48
mv a1,s1
lla a0,.LC1
call __isoc99_scanf@plt
lla a1,.LC2
li a0,1
call __printf_chk@plt
addi a1,sp,80
lla a0,.LC3
call __isoc99_scanf@plt
lw a4,80(sp)
lw a5,40(sp)
bge a4,a5,.L2
mv a2,s2
lla a1,.LC5
li a0,1
call __printf_chk@plt
.L3:
ld a4, 88(sp)
ld a5, 0(s0)
xor a5, a4, a5
li a4, 0
bne a5,zero,.L7
ld ra,120(sp)
ld s0,112(sp)
ld s1,104(sp)
ld s2,96(sp)
li a0,0
addi sp,sp,128
jr ra
.L2:
mv a2,s1
lla a1,.LC5
li a0,1
call __printf_chk@plt
j .L3
.L7:
call __stack_chk_fail@plt
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.file "oppgave1.c"
.option pic
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "Navn 1: "
.align 3
.LC1:
.string "%s"
.align 3
.LC2:
.string "Poeng:"
.align 3
.LC3:
.string "%d"
.align 3
.LC4:
.string "Navn 2: "
.align 3
.LC5:
.string "%s, vinner\n"
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-128
sd s0,112(sp)
la s0,__stack_chk_guard
ld a5, 0(s0)
sd a5, 88(sp)
li a5, 0
lla a1,.LC0
li a0,1
sd ra,120(sp)
sd s1,104(sp)
sd s2,96(sp)
call __printf_chk@plt
addi s2,sp,8
mv a1,s2
lla a0,.LC1
call __isoc99_scanf@plt
lla a1,.LC2
li a0,1
call __printf_chk@plt
addi a1,sp,40
lla a0,.LC3
call __isoc99_scanf@plt
lla a1,.LC4
li a0,1
call __printf_chk@plt
addi s1,sp,48
mv a1,s1
lla a0,.LC1
call __isoc99_scanf@plt
lla a1,.LC2
li a0,1
call __printf_chk@plt
addi a1,sp,80
lla a0,.LC3
call __isoc99_scanf@plt
lw a4,80(sp)
lw a5,40(sp)
bge a4,a5,.L2
mv a2,s2
lla a1,.LC5
li a0,1
call __printf_chk@plt
.L3:
ld a4, 88(sp)
ld a5, 0(s0)
xor a5, a4, a5
li a4, 0
bne a5,zero,.L7
ld ra,120(sp)
ld s0,112(sp)
ld s1,104(sp)
ld s2,96(sp)
li a0,0
addi sp,sp,128
jr ra
.L2:
mv a2,s1
lla a1,.LC5
li a0,1
call __printf_chk@plt
j .L3
.L7:
call __stack_chk_fail@plt
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "oppgave1.c"
.text
.section .rodata
.align 3
.LC0:
.string "Navn 1: "
.align 3
.LC1:
.string "%s"
.align 3
.LC2:
.string "Poeng:"
.align 3
.LC3:
.string "%d"
.align 3
.LC4:
.string "Navn 2: "
.align 3
.LC5:
.string "%s, vinner\n"
.text
.align 2
.global main
.type main, %function
main:
.LFB0:
.cfi_startproc
stp x29, x30, [sp, -112]!
.cfi_def_cfa_offset 112
.cfi_offset 29, -112
.cfi_offset 30, -104
mov x29, sp
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x1, [x0]
str x1, [sp, 104]
mov x1, 0
adrp x0, .LC0
add x0, x0, :lo12:.LC0
bl printf
add x0, sp, 24
mov x1, x0
adrp x0, .LC1
add x0, x0, :lo12:.LC1
bl __isoc99_scanf
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl printf
add x0, sp, 24
add x0, x0, 32
mov x1, x0
adrp x0, .LC3
add x0, x0, :lo12:.LC3
bl __isoc99_scanf
adrp x0, .LC4
add x0, x0, :lo12:.LC4
bl printf
add x0, sp, 64
mov x1, x0
adrp x0, .LC1
add x0, x0, :lo12:.LC1
bl __isoc99_scanf
adrp x0, .LC2
add x0, x0, :lo12:.LC2
bl printf
add x0, sp, 64
add x0, x0, 32
mov x1, x0
adrp x0, .LC3
add x0, x0, :lo12:.LC3
bl __isoc99_scanf
ldr w1, [sp, 96]
ldr w0, [sp, 56]
cmp w1, w0
bge .L2
add x0, sp, 24
mov x1, x0
adrp x0, .LC5
add x0, x0, :lo12:.LC5
bl printf
b .L3
.L2:
add x0, sp, 64
mov x1, x0
adrp x0, .LC5
add x0, x0, :lo12:.LC5
bl printf
.L3:
mov w0, 0
mov w1, w0
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x3, [sp, 104]
ldr x2, [x0]
subs x3, x3, x2
mov x2, 0
beq .L5
bl __stack_chk_fail
.L5:
mov w0, w1
ldp x29, x30, [sp], 112
.cfi_restore 30
.cfi_restore 29
.cfi_def_cfa_offset 0
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "oppgave1.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "Navn 1: "
.align 3
.LC1:
.string "%s"
.align 3
.LC2:
.string "Poeng:"
.align 3
.LC3:
.string "%d"
.align 3
.LC4:
.string "Navn 2: "
.align 3
.LC5:
.string "%s, vinner\n"
.text
.align 2
.global main
.type main, %function
main:
.LFB23:
.cfi_startproc
stp x29, x30, [sp, -144]!
.cfi_def_cfa_offset 144
.cfi_offset 29, -144
.cfi_offset 30, -136
mov x29, sp
stp x19, x20, [sp, 16]
str x21, [sp, 32]
.cfi_offset 19, -128
.cfi_offset 20, -120
.cfi_offset 21, -112
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x1, [x0]
str x1, [sp, 136]
mov x1, 0
adrp x1, .LC0
add x1, x1, :lo12:.LC0
mov w0, 1
bl __printf_chk
adrp x21, .LC1
add x21, x21, :lo12:.LC1
add x1, sp, 56
mov x0, x21
bl __isoc99_scanf
adrp x20, .LC2
add x20, x20, :lo12:.LC2
mov x1, x20
mov w0, 1
bl __printf_chk
adrp x19, .LC3
add x19, x19, :lo12:.LC3
add x1, sp, 88
mov x0, x19
bl __isoc99_scanf
adrp x1, .LC4
add x1, x1, :lo12:.LC4
mov w0, 1
bl __printf_chk
add x1, sp, 96
mov x0, x21
bl __isoc99_scanf
mov x1, x20
mov w0, 1
bl __printf_chk
add x1, sp, 128
mov x0, x19
bl __isoc99_scanf
ldr w1, [sp, 128]
ldr w0, [sp, 88]
cmp w1, w0
bge .L2
add x2, sp, 56
adrp x1, .LC5
add x1, x1, :lo12:.LC5
mov w0, 1
bl __printf_chk
.L3:
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x2, [sp, 136]
ldr x1, [x0]
subs x2, x2, x1
mov x1, 0
bne .L6
mov w0, 0
ldp x19, x20, [sp, 16]
ldr x21, [sp, 32]
ldp x29, x30, [sp], 144
.cfi_remember_state
.cfi_restore 30
.cfi_restore 29
.cfi_restore 21
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.L2:
.cfi_restore_state
add x2, sp, 96
adrp x1, .LC5
add x1, x1, :lo12:.LC5
mov w0, 1
bl __printf_chk
b .L3
.L6:
bl __stack_chk_fail
.cfi_endproc
.LFE23:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "oppgave1.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "Navn 1: "
.align 3
.LC1:
.string "%s"
.align 3
.LC2:
.string "Poeng:"
.align 3
.LC3:
.string "%d"
.align 3
.LC4:
.string "Navn 2: "
.align 3
.LC5:
.string "%s, vinner\n"
.section .text.startup,"ax",@progbits
.align 2
.p2align 4,,11
.global main
.type main, %function
main:
.LFB23:
.cfi_startproc
stp x29, x30, [sp, -160]!
.cfi_def_cfa_offset 160
.cfi_offset 29, -160
.cfi_offset 30, -152
adrp x2, :got:__stack_chk_guard
adrp x1, .LC0
mov x29, sp
ldr x2, [x2, #:got_lo12:__stack_chk_guard]
stp x19, x20, [sp, 16]
add x1, x1, :lo12:.LC0
stp x21, x22, [sp, 32]
mov w0, 1
.cfi_offset 19, -144
.cfi_offset 20, -136
.cfi_offset 21, -128
.cfi_offset 22, -120
adrp x21, .LC1
str x23, [sp, 48]
.cfi_offset 23, -112
add x21, x21, :lo12:.LC1
add x23, sp, 72
adrp x20, .LC2
ldr x3, [x2]
str x3, [sp, 152]
mov x3, 0
add x20, x20, :lo12:.LC2
adrp x19, .LC3
add x19, x19, :lo12:.LC3
add x22, sp, 112
bl __printf_chk
mov x1, x23
mov x0, x21
bl __isoc99_scanf
mov x1, x20
mov w0, 1
bl __printf_chk
add x1, sp, 104
mov x0, x19
bl __isoc99_scanf
adrp x1, .LC4
mov w0, 1
add x1, x1, :lo12:.LC4
bl __printf_chk
mov x1, x22
mov x0, x21
bl __isoc99_scanf
mov x1, x20
mov w0, 1
bl __printf_chk
add x1, sp, 144
mov x0, x19
bl __isoc99_scanf
ldr w0, [sp, 104]
ldr w1, [sp, 144]
cmp w1, w0
bge .L2
adrp x1, .LC5
mov x2, x23
add x1, x1, :lo12:.LC5
mov w0, 1
bl __printf_chk
.L3:
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x2, [sp, 152]
ldr x1, [x0]
subs x2, x2, x1
mov x1, 0
bne .L7
mov w0, 0
ldp x19, x20, [sp, 16]
ldp x21, x22, [sp, 32]
ldr x23, [sp, 48]
ldp x29, x30, [sp], 160
.cfi_remember_state
.cfi_restore 30
.cfi_restore 29
.cfi_restore 23
.cfi_restore 21
.cfi_restore 22
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.L2:
.cfi_restore_state
mov x2, x22
adrp x1, .LC5
mov w0, 1
add x1, x1, :lo12:.LC5
bl __printf_chk
b .L3
.L7:
bl __stack_chk_fail
.cfi_endproc
.LFE23:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
.arch armv8-a
.file "oppgave1.c"
.text
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "Navn 1: "
.align 3
.LC1:
.string "%s"
.align 3
.LC2:
.string "Poeng:"
.align 3
.LC3:
.string "%d"
.align 3
.LC4:
.string "Navn 2: "
.align 3
.LC5:
.string "%s, vinner\n"
.section .text.startup,"ax",@progbits
.align 2
.p2align 4,,11
.global main
.type main, %function
main:
.LFB23:
.cfi_startproc
stp x29, x30, [sp, -160]!
.cfi_def_cfa_offset 160
.cfi_offset 29, -160
.cfi_offset 30, -152
adrp x2, :got:__stack_chk_guard
adrp x1, .LC0
mov x29, sp
ldr x2, [x2, #:got_lo12:__stack_chk_guard]
stp x19, x20, [sp, 16]
add x1, x1, :lo12:.LC0
stp x21, x22, [sp, 32]
mov w0, 1
.cfi_offset 19, -144
.cfi_offset 20, -136
.cfi_offset 21, -128
.cfi_offset 22, -120
adrp x21, .LC1
str x23, [sp, 48]
.cfi_offset 23, -112
add x21, x21, :lo12:.LC1
add x23, sp, 72
adrp x20, .LC2
ldr x3, [x2]
str x3, [sp, 152]
mov x3, 0
add x20, x20, :lo12:.LC2
adrp x19, .LC3
add x19, x19, :lo12:.LC3
add x22, sp, 112
bl __printf_chk
mov x1, x23
mov x0, x21
bl __isoc99_scanf
mov x1, x20
mov w0, 1
bl __printf_chk
add x1, sp, 104
mov x0, x19
bl __isoc99_scanf
adrp x1, .LC4
mov w0, 1
add x1, x1, :lo12:.LC4
bl __printf_chk
mov x1, x22
mov x0, x21
bl __isoc99_scanf
mov x1, x20
mov w0, 1
bl __printf_chk
add x1, sp, 144
mov x0, x19
bl __isoc99_scanf
ldr w0, [sp, 104]
ldr w1, [sp, 144]
cmp w1, w0
bge .L2
adrp x1, .LC5
mov x2, x23
add x1, x1, :lo12:.LC5
mov w0, 1
bl __printf_chk
.L3:
adrp x0, :got:__stack_chk_guard
ldr x0, [x0, #:got_lo12:__stack_chk_guard]
ldr x2, [sp, 152]
ldr x1, [x0]
subs x2, x2, x1
mov x1, 0
bne .L7
mov w0, 0
ldp x19, x20, [sp, 16]
ldp x21, x22, [sp, 32]
ldr x23, [sp, 48]
ldp x29, x30, [sp], 160
.cfi_remember_state
.cfi_restore 30
.cfi_restore 29
.cfi_restore 23
.cfi_restore 21
.cfi_restore 22
.cfi_restore 19
.cfi_restore 20
.cfi_def_cfa_offset 0
ret
.L2:
.cfi_restore_state
mov x2, x22
adrp x1, .LC5
mov w0, 1
add x1, x1, :lo12:.LC5
bl __printf_chk
b .L3
.L7:
bl __stack_chk_fail
.cfi_endproc
.LFE23:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
|
6.c
| "#include<stdio.h>\n#include<stdlib.h>\n#define size 5\nint cq[size],f=-1,r=-1,elm;\nvoid display();(...TRUNCATED) | "\t.file\t\"6.c\"\n\t.option pic\n\t.text\n\t.globl\tcq\n\t.bss\n\t.align\t3\n\t.type\tcq, @object\n(...TRUNCATED) | "\t.file\t\"6.c\"\n\t.option pic\n\t.text\n\t.align\t1\n\t.globl\tfull\n\t.type\tfull, @function\nfu(...TRUNCATED) | "\t.file\t\"6.c\"\n\t.option pic\n\t.text\n\t.section\t.rodata.str1.8,\"aMS\",@progbits,1\n\t.align\(...TRUNCATED) | "\t.file\t\"6.c\"\n\t.option pic\n\t.text\n\t.section\t.rodata.str1.8,\"aMS\",@progbits,1\n\t.align\(...TRUNCATED) | "\t.arch armv8-a\n\t.file\t\"6.c\"\n\t.text\n\t.global\tcq\n\t.bss\n\t.align\t3\n\t.type\tcq, %objec(...TRUNCATED) | "\t.arch armv8-a\n\t.file\t\"6.c\"\n\t.text\n\t.align\t2\n\t.global\tfull\n\t.type\tfull, %function\(...TRUNCATED) | "\t.arch armv8-a\n\t.file\t\"6.c\"\n\t.text\n\t.section\t.rodata.str1.8,\"aMS\",@progbits,1\n\t.alig(...TRUNCATED) | "\t.arch armv8-a\n\t.file\t\"6.c\"\n\t.text\n\t.section\t.rodata.str1.8,\"aMS\",@progbits,1\n\t.alig(...TRUNCATED) |
compile000d.c
|
int
main(int argc, char **argv)
{
if (argc || argc - 1)
return 2;
return 1;
}
| "\t.file\t\"compile000d.c\"\n\t.option pic\n\t.text\n\t.align\t1\n\t.globl\tmain\n\t.type\tmain, @fu(...TRUNCATED) | "\t.file\t\"compile000d.c\"\n\t.option pic\n\t.text\n\t.align\t1\n\t.globl\tmain\n\t.type\tmain, @fu(...TRUNCATED) | "\t.file\t\"compile000d.c\"\n\t.option pic\n\t.text\n\t.section\t.text.startup,\"ax\",@progbits\n\t.(...TRUNCATED) | "\t.file\t\"compile000d.c\"\n\t.option pic\n\t.text\n\t.section\t.text.startup,\"ax\",@progbits\n\t.(...TRUNCATED) | "\t.arch armv8-a\n\t.file\t\"compile000d.c\"\n\t.text\n\t.align\t2\n\t.global\tmain\n\t.type\tmain, (...TRUNCATED) | "\t.arch armv8-a\n\t.file\t\"compile000d.c\"\n\t.text\n\t.align\t2\n\t.global\tmain\n\t.type\tmain, (...TRUNCATED) | "\t.arch armv8-a\n\t.file\t\"compile000d.c\"\n\t.text\n\t.section\t.text.startup,\"ax\",@progbits\n\(...TRUNCATED) | "\t.arch armv8-a\n\t.file\t\"compile000d.c\"\n\t.text\n\t.section\t.text.startup,\"ax\",@progbits\n\(...TRUNCATED) |
End of preview. Expand
in Data Studio
- Downloads last month
- 3