id int64 0 14.1k | problem_id int64 1 1.31k | problem_title stringclasses 441
values | difficulty stringclasses 3
values | c_source stringclasses 441
values | architecture stringclasses 4
values | optimization stringclasses 4
values | compiler stringclasses 8
values | assembly stringlengths 31 174k |
|---|---|---|---|---|---|---|---|---|
200 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | mips64 | -O0 | mips64 clang 21.1.0 | reverse:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -32
sd $ra, 24($sp)
sd $fp, 16($sp)
move $fp, $sp
move $1, $4
sw $1, 8($fp)
sw $zero, 0($fp)
b .LBB0_1
nop
.LBB0_1:
lw $1, 8($fp)
beqz $1, .LB... |
201 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | mips64 | -O1 | mips64 clang 21.1.0 | reverse:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -16
sd $ra, 8($sp)
sd $fp, 0($sp)
move $fp, $sp
beqz $4, .LBB0_9
addiu $2, $zero, 0
lui $1, 26214
ori $3, $1, 26215
lui $1, 32767
ori $5, $1, 65535
... |
202 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | mips64 | -O2 | mips64 clang 21.1.0 | reverse:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -16
sd $ra, 8($sp)
sd $fp, 0($sp)
move $fp, $sp
beqz $4, .LBB0_8
addiu $2, $zero, 0
lui $1, 26214
ori $3, $1, 26215
lui $1, 32767
ori $5, $1, 65535
... |
203 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | mips64 | -O3 | mips64 clang 21.1.0 | reverse:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -16
sd $ra, 8($sp)
sd $fp, 0($sp)
move $fp, $sp
beqz $4, .LBB0_8
addiu $2, $zero, 0
lui $1, 26214
lui $6, 32768
ori $3, $1, 26215
lui $1, 32767
ori ... |
204 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | mips64 | -O0 | mips64 gcc 15.2.0 | reverse:
daddiu $sp,$sp,-48
sd $fp,40($sp)
move $fp,$sp
move $2,$4
sll $2,$2,0
sw $2,16($fp)
sw $0,0($fp)
b .L2
nop
.L7:
lw $4,16($fp)
move $3,$4
move $2,$3
dsll $2,$2,1... |
205 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | mips64 | -O1 | mips64 gcc 15.2.0 | reverse:
beq $4,$0,.L6
li $5,-2147483648 # 0xffffffff80000000
move $2,$0
li $6,2147418112 # 0x7fff0000
b .L5
ori $6,$6,0xffff
.L3:
subu $8,$5,$7
subu $9,$5,$7
dsll $3,$9,1
... |
206 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | mips64 | -O2 | mips64 gcc 15.2.0 | reverse:
beq $4,$0,.L15
move $2,$0
li $8,2147418112 # 0x7fff0000
li $7,-2147483648 # 0xffffffff80000000
b .L5
ori $8,$8,0xffff
.L13:
bne $6,$0,.L8
nop
addu $2,$11,$10
.L14:
... |
207 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | mips64 | -O3 | mips64 gcc 15.2.0 | reverse:
beq $4,$0,.L15
move $2,$0
li $8,2147418112 # 0x7fff0000
li $7,-2147483648 # 0xffffffff80000000
b .L5
ori $8,$8,0xffff
.L13:
bne $6,$0,.L8
nop
addu $2,$11,$10
.L14:
... |
208 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | riscv64 | -O0 | RISC-V 64 clang 21.1.0 | reverse:
addi sp, sp, -32
sd ra, 24(sp)
sd s0, 16(sp)
addi s0, sp, 32
sw a0, -24(s0)
li a0, 0
sw a0, -32(s0)
j .LBB0_1
.LBB0_1:
lw a0, -24(s0)
beqz a0, .LBB0_8
j .LBB0_2
.LBB0_2:
... |
209 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | riscv64 | -O1 | RISC-V 64 clang 21.1.0 | reverse:
beqz a0, .LBB0_8
mv a1, a0
li a0, 0
lui a2, 419430
lui a6, 524288
addi t2, a2, 1639
addi t0, a6, -1
slli t1, t2, 32
li a7, 18
j .LBB0_3
.LBB0_2:
slli a2, a0, 1
slli a0,... |
210 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | riscv64 | -O2 | RISC-V 64 clang 21.1.0 | reverse:
beqz a0, .LBB0_7
mv a1, a0
li a0, 0
lui a2, 419430
lui a6, 524288
li t0, 18
lui a3, 838861
addi a4, a2, 1639
addi t1, a6, -1
addi a7, a3, -819
slli t2, a4, 32
slli a7, a7... |
211 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | riscv64 | -O3 | RISC-V 64 clang 21.1.0 | reverse:
beqz a0, .LBB0_7
mv a1, a0
li a0, 0
lui a2, 419430
lui a6, 524288
li t0, 18
lui a3, 838861
addi a4, a2, 1639
addi t1, a6, -1
addi a7, a3, -819
slli t2, a4, 32
slli a7, a7... |
212 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | riscv64 | -O0 | RISC-V 64 gcc 15.2.0 | reverse:
addi sp,sp,-48
sd ra,40(sp)
sd s0,32(sp)
addi s0,sp,48
mv a5,a0
sw a5,-36(s0)
sw zero,-20(s0)
j .L2
.L7:
lw a5,-36(s0)
mv a4,a5
sext.w a3,a4
li a5,1717985280
... |
213 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | riscv64 | -O1 | RISC-V 64 gcc 15.2.0 | reverse:
mv a5,a0
beq a0,zero,.L6
li a0,0
li a2,1717985280
addi a2,a2,1639
li a7,-2147483648
addiw a6,a7,-1
j .L5
.L3:
subw a1,a7,a4
mul a3,a1,a2
srai a3,a3,34
sraiw a1,a1,31
... |
214 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | riscv64 | -O2 | RISC-V 64 gcc 15.2.0 | reverse:
mv a5,a0
beq a0,zero,.L8
li t1,-2147483648
li a6,1717985280
addi a6,a6,1639
addiw t3,t1,-1
li a0,0
j .L5
.L12:
mul a3,a3,a6
srai a3,a3,34
subw a3,a3,t4
blt a3,a0,.L8
... |
215 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | riscv64 | -O3 | RISC-V 64 gcc 15.2.0 | reverse:
mv a5,a0
beq a0,zero,.L8
li t1,-2147483648
li a6,1717985280
addi a6,a6,1639
addiw t3,t1,-1
li a0,0
j .L5
.L12:
mul a3,a3,a6
srai a3,a3,34
subw a3,a3,t4
blt a3,a0,.L8
... |
216 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | x86-64 | -O0 | x86-64 clang 21.1.0 | reverse:
push rbp
mov rbp, rsp
mov dword ptr [rbp - 8], edi
mov dword ptr [rbp - 16], 0
.LBB0_1:
cmp dword ptr [rbp - 8], 0
je .LBB0_8
mov eax, dword ptr [rbp - 8]
mov ecx, 10
cdq
idiv ecx
mov ... |
217 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | x86-64 | -O1 | x86-64 clang 21.1.0 | reverse:
xor eax, eax
test edi, edi
jne .LBB0_3
.LBB0_1:
ret
.LBB0_2:
lea eax, [rax + 4*rax]
lea eax, [rdx + 2*rax]
add edi, 9
cmp edi, 18
mov edi, ecx
jbe .LBB0_1
.LBB0_3:
movsxd rsi, edi
... |
218 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | x86-64 | -O2 | x86-64 clang 21.1.0 | reverse:
xor eax, eax
test edi, edi
je .LBB0_7
mov ecx, 3435973837
jmp .LBB0_4
.LBB0_2:
lea r8d, [rsi - 2147483648]
imul r8, rcx
shr r8, 35
neg r8d
cmp eax, r8d
jl .LBB0_6
.LBB0_3:
... |
219 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | x86-64 | -O3 | x86-64 clang 21.1.0 | reverse:
xor eax, eax
test edi, edi
je .LBB0_7
mov ecx, 3435973837
jmp .LBB0_4
.LBB0_2:
lea r8d, [rsi - 2147483648]
imul r8, rcx
shr r8, 35
neg r8d
cmp eax, r8d
jl .LBB0_6
.LBB0_3:
... |
220 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | x86-64 | -O0 | x86-64 gcc 15.2 | reverse:
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-20], edi
mov DWORD PTR [rbp-4], 0
jmp .L2
.L7:
mov edx, DWORD PTR [rbp-20]
movsx rax, edx
imul rax, rax, 1717986919
shr rax, 32
mov ecx, eax
sar ... |
221 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | x86-64 | -O1 | x86-64 gcc 15.2 | reverse:
mov edx, edi
test edi, edi
je .L6
mov esi, 0
mov r8d, -2147483648
mov edi, 2147483647
jmp .L5
.L3:
mov r9d, r8d
sub r9d, eax
movsx rcx, r9d
imul rcx, rcx, 1717986919
sar ... |
222 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | x86-64 | -O2 | x86-64 gcc 15.2 | reverse:
mov esi, edi
xor edi, edi
test esi, esi
je .L1
mov r8d, 3435973837
jmp .L5
.L11:
mov edx, 2147483647
sub edx, eax
imul rdx, r8
shr rdx, 35
cmp edx, edi
jl .L8
.L4:
... |
223 | 7 | Reverse Integer | Medium | /*
7. Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!
If the integer's last digit i... | x86-64 | -O3 | x86-64 gcc 15.2 | reverse:
mov esi, edi
xor edi, edi
test esi, esi
je .L1
mov r8d, 3435973837
jmp .L5
.L11:
mov edx, 2147483647
sub edx, eax
imul rdx, r8
shr rdx, 35
cmp edx, edi
jl .L8
.L4:
... |
224 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | aarch64 | -O0 | ARM64 gcc 15.2.0 | myAtoi:
sub sp, sp, #32
str x0, [sp, 8]
str wzr, [sp, 28]
str wzr, [sp, 24]
ldr x0, [sp, 8]
cmp x0, 0
bne .L4
mov w0, 0
b .L3
.L5:
ldr x0, [sp, 8]
add x0, x0, 1
str x0, [sp, ... |
225 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | aarch64 | -O1 | ARM64 gcc 15.2.0 | myAtoi:
mov x2, x0
cbz x0, .L9
ldrb w0, [x0]
cmp w0, 32
bne .L3
.L4:
ldrb w0, [x2, 1]!
cmp w0, 32
beq .L4
.L3:
add x1, x2, 2
cmp w0, 43
csel x2, x1, x2, eq
cset w5, eq
ldrb... |
226 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | aarch64 | -O2 | ARM64 gcc 15.2.0 | myAtoi:
mov x3, x0
cbz x0, .L11
ldrb w0, [x0]
cmp w0, 32
bne .L3
.L4:
ldrb w0, [x3, 1]!
cmp w0, 32
beq .L4
.L3:
add x1, x3, 2
cmp w0, 43
csel x3, x1, x3, eq
cset w0, eq
ldr... |
227 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | aarch64 | -O3 | ARM64 gcc 15.2.0 | myAtoi:
mov x2, x0
cbz x0, .L9
ldrb w1, [x0]
cmp w1, 32
bne .L3
.L4:
ldrb w1, [x2, 1]!
cmp w1, 32
beq .L4
.L3:
cmp w1, 43
beq .L20
sub w3, w1, #48
mov w5, 52429
and w... |
228 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | aarch64 | -O0 | armv8-a clang 21.1.0 | myAtoi:
sub sp, sp, #32
str x0, [sp, #16]
str wzr, [sp, #8]
str wzr, [sp, #4]
ldr x8, [sp, #16]
cbnz x8, .LBB0_2
b .LBB0_1
.LBB0_1:
str wzr, [sp, #28]
b .LBB0_20
.LBB0_2:
b .LBB0_3
.LBB0_3:
... |
229 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | aarch64 | -O1 | armv8-a clang 21.1.0 | myAtoi:
cbz x0, .LBB0_10
.LBB0_1:
ldrb w9, [x0], #1
cmp w9, #32
b.eq .LBB0_1
cmp w9, #43
mov w8, #2
csel x10, x8, xzr, eq
add x8, x0, x10
ldurb w15, [x8, #-1]
sub w8, w15, #48
cmp w8, #9
... |
230 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | aarch64 | -O2 | armv8-a clang 21.1.0 | myAtoi:
cbz x0, .LBB0_10
.LBB0_1:
ldrb w9, [x0], #1
cmp w9, #32
b.eq .LBB0_1
cmp w9, #43
mov w8, #2
csel x10, x8, xzr, eq
add x8, x0, x10
ldurb w14, [x8, #-1]
sub w8, w14, #48
cmp w8, #9
... |
231 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | aarch64 | -O3 | armv8-a clang 21.1.0 | myAtoi:
cbz x0, .LBB0_8
.LBB0_1:
ldrb w8, [x0], #1
cmp w8, #32
b.eq .LBB0_1
cmp w8, #43
mov w9, #2
csel x9, x9, xzr, eq
add x10, x0, x9
ldurb w10, [x10, #-1]
sub w11, w10, #48
cmp w11, #9
... |
232 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | mips64 | -O0 | mips64 clang 21.1.0 | myAtoi:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -48
sd $ra, 40($sp)
sd $fp, 32($sp)
move $fp, $sp
sd $4, 16($fp)
sw $zero, 8($fp)
sw $zero, 4($fp)
ld $1, 16($fp)
bnez $1, .LBB0_3
nop
b .LBB... |
233 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | mips64 | -O1 | mips64 clang 21.1.0 | myAtoi:
.Lfunc_begin0 = .Ltmp0
beqz $4, .LBB0_13
addiu $9, $zero, 0
daddiu $sp, $sp, -16
sd $ra, 8($sp)
sd $fp, 0($sp)
move $fp, $sp
addiu $3, $zero, 32
.LBB0_2:
lbu $2, 0($4)
beq $2, $3, .LBB0_2
daddiu $4, $4,... |
234 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | mips64 | -O2 | mips64 clang 21.1.0 | myAtoi:
.Lfunc_begin0 = .Ltmp0
beqz $4, .LBB0_13
addiu $10, $zero, 0
daddiu $sp, $sp, -16
sd $ra, 8($sp)
sd $fp, 0($sp)
move $fp, $sp
addiu $3, $zero, 32
.LBB0_2:
lbu $2, 0($4)
beq $2, $3, .LBB0_2
daddiu $4, $4... |
235 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | mips64 | -O3 | mips64 clang 21.1.0 | myAtoi:
.Lfunc_begin0 = .Ltmp0
beqz $4, .LBB0_15
addiu $2, $zero, 0
daddiu $sp, $sp, -16
sd $ra, 8($sp)
sd $fp, 0($sp)
move $fp, $sp
addiu $3, $zero, 32
.LBB0_2:
lbu $6, 0($4)
beq $6, $3, .LBB0_2
daddiu $4, $4,... |
236 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | mips64 | -O0 | mips64 gcc 15.2.0 | myAtoi:
daddiu $sp,$sp,-48
sd $fp,40($sp)
move $fp,$sp
sd $4,16($fp)
sw $0,0($fp)
sw $0,4($fp)
ld $2,16($fp)
bne $2,$0,.L4
nop
move $2,$0
b .L3
nop
.L5:
ld $2,16($fp)
... |
237 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | mips64 | -O1 | mips64 gcc 15.2.0 | myAtoi:
beq $4,$0,.L9
li $3,32 # 0x20
lb $2,0($4)
bnel $2,$3,.L21
li $3,43 # 0x2b
daddiu $4,$4,1
.L22:
lb $2,0($4)
beql $2,$3,.L22
daddiu $4,$4,1
li $3,43 ... |
238 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | mips64 | -O2 | mips64 gcc 15.2.0 | myAtoi:
beq $4,$0,.L11
nop
lb $3,0($4)
li $2,32 # 0x20
bne $3,$2,.L23
li $5,43 # 0x2b
.L4:
lb $3,1($4)
beq $3,$2,.L4
daddiu $4,$4,1
li $5,43 # 0x2b
.L2... |
239 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | mips64 | -O3 | mips64 gcc 15.2.0 | myAtoi:
beq $4,$0,.L10
nop
lb $3,0($4)
li $2,32 # 0x20
bnel $3,$2,.L25
li $2,43 # 0x2b
.L4:
lb $3,1($4)
beq $3,$2,.L4
daddiu $4,$4,1
li $2,43 # 0x2b
.L2... |
240 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | riscv64 | -O0 | RISC-V 64 clang 21.1.0 | myAtoi:
addi sp, sp, -64
sd ra, 56(sp)
sd s0, 48(sp)
addi s0, sp, 64
sd a0, -32(s0)
li a0, 0
sw a0, -40(s0)
sw a0, -44(s0)
ld a0, -32(s0)
bnez a0, .LBB0_2
j .LBB0_1
.LBB0_1:
... |
241 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | riscv64 | -O1 | RISC-V 64 clang 21.1.0 | myAtoi:
beqz a0, .LBB0_11
li a2, 32
.LBB0_2:
lbu a1, 0(a0)
addi a0, a0, 1
beq a1, a2, .LBB0_2
addi a2, a1, -43
seqz a2, a2
slli a2, a2, 1
add a2, a2, a0
lbu a3, -1(a2)
addi a0, a3, -48
... |
242 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | riscv64 | -O2 | RISC-V 64 clang 21.1.0 | myAtoi:
beqz a0, .LBB0_11
li a2, 32
.LBB0_2:
lbu a1, 0(a0)
addi a0, a0, 1
beq a1, a2, .LBB0_2
addi a2, a1, -43
seqz a2, a2
slli a2, a2, 1
add a2, a2, a0
lbu a4, -1(a2)
addi a0, a4, -48
... |
243 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | riscv64 | -O3 | RISC-V 64 clang 21.1.0 | myAtoi:
beqz a0, .LBB0_12
li a1, 32
.LBB0_2:
lbu a4, 0(a0)
addi a0, a0, 1
beq a4, a1, .LBB0_2
addi a1, a4, -43
seqz a5, a1
slli a7, a5, 1
add a3, a0, a7
lbu a2, -1(a3)
addi a1, a2, -48
... |
244 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | riscv64 | -O0 | RISC-V 64 gcc 15.2.0 | myAtoi:
addi sp,sp,-48
sd ra,40(sp)
sd s0,32(sp)
addi s0,sp,48
sd a0,-40(s0)
sw zero,-20(s0)
sw zero,-24(s0)
ld a5,-40(s0)
bne a5,zero,.L4
li a5,0
j .L3
.L5:
ld a5,-40(... |
245 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | riscv64 | -O1 | RISC-V 64 gcc 15.2.0 | myAtoi:
mv a4,a0
beq a0,zero,.L9
lbu a5,0(a0)
li a3,32
bne a5,a3,.L3
mv a3,a5
.L4:
addi a4,a4,1
lbu a5,0(a4)
beq a5,a3,.L4
.L3:
li a3,43
li a6,0
beq a5,a3,.L18
.L5:
... |
246 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | riscv64 | -O2 | RISC-V 64 gcc 15.2.0 | myAtoi:
mv a5,a0
beq a0,zero,.L11
lbu a4,0(a0)
li a3,32
bne a4,a3,.L3
.L4:
lbu a4,1(a5)
addi a5,a5,1
beq a4,a3,.L4
.L3:
li a3,43
li a0,0
bne a4,a3,.L5
addi a5,a5,2
li... |
247 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | riscv64 | -O3 | RISC-V 64 gcc 15.2.0 | myAtoi:
mv a5,a0
beq a0,zero,.L10
lbu a4,0(a0)
li a3,32
bne a4,a3,.L3
.L4:
lbu a4,1(a5)
addi a5,a5,1
beq a4,a3,.L4
.L3:
li a3,43
beq a4,a3,.L19
addiw a1,a4,-48
li a7,-21474836... |
248 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | x86-64 | -O0 | x86-64 clang 21.1.0 | myAtoi:
push rbp
mov rbp, rsp
mov qword ptr [rbp - 16], rdi
mov dword ptr [rbp - 24], 0
mov dword ptr [rbp - 28], 0
cmp qword ptr [rbp - 16], 0
jne .LBB0_2
mov dword ptr [rbp - 4], 0
jmp .LBB0_20
.LBB0_2:
... |
249 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | x86-64 | -O1 | x86-64 clang 21.1.0 | myAtoi:
xor eax, eax
test rdi, rdi
je .LBB0_12
.LBB0_1:
movzx ecx, byte ptr [rdi]
inc rdi
cmp cl, 32
je .LBB0_1
xor esi, esi
cmp cl, 43
sete sil
add esi, esi
movzx edx, byte ptr [r... |
250 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | x86-64 | -O2 | x86-64 clang 21.1.0 | myAtoi:
xor eax, eax
test rdi, rdi
je .LBB0_11
.LBB0_1:
movzx ecx, byte ptr [rdi]
inc rdi
cmp cl, 32
je .LBB0_1
xor edx, edx
cmp cl, 43
sete dl
add edx, edx
movzx r8d, byte ptr [rd... |
251 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | x86-64 | -O3 | x86-64 clang 21.1.0 | myAtoi:
xor eax, eax
test rdi, rdi
je .LBB0_11
.LBB0_1:
movzx edx, byte ptr [rdi]
inc rdi
cmp dl, 32
je .LBB0_1
xor esi, esi
cmp dl, 43
sete sil
add esi, esi
movzx ecx, byte ptr [r... |
252 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | x86-64 | -O0 | x86-64 gcc 15.2 | myAtoi:
push rbp
mov rbp, rsp
mov QWORD PTR [rbp-24], rdi
mov DWORD PTR [rbp-4], 0
mov DWORD PTR [rbp-8], 0
cmp QWORD PTR [rbp-24], 0
jne .L4
mov eax, 0
jmp .L3
.L5:
add QWORD PTR [rbp-24], 1
.L4:
... |
253 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | x86-64 | -O1 | x86-64 gcc 15.2 | myAtoi:
mov rcx, rdi
test rdi, rdi
je .L9
movzx eax, BYTE PTR [rdi]
cmp al, 32
jne .L3
.L4:
add rcx, 1
movzx eax, BYTE PTR [rcx]
cmp al, 32
je .L4
.L3:
lea rdx, [rcx+2]
cmp al, 43... |
254 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | x86-64 | -O2 | x86-64 gcc 15.2 | myAtoi:
test rdi, rdi
jne .L19
jmp .L11
.L4:
add rdi, 1
.L19:
movzx eax, BYTE PTR [rdi]
cmp al, 32
je .L4
cmp al, 43
lea rdx, [rdi+2]
cmove rdi, rdx
sete dl
movzx edx, dl
movs... |
255 | 8 | String to Integer (atoi) | Medium | /*
8. String to Integer (atoi)
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical ... | x86-64 | -O3 | x86-64 gcc 15.2 | myAtoi:
test rdi, rdi
jne .L19
jmp .L10
.L4:
add rdi, 1
.L19:
movzx edx, BYTE PTR [rdi]
cmp dl, 32
je .L4
cmp dl, 43
je .L21
lea ecx, [rdx-48]
xor eax, eax
mov esi, 3435973837
... |
256 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | aarch64 | -O0 | ARM64 gcc 15.2.0 | isPalindrome:
sub sp, sp, #32
str w0, [sp, 12]
str wzr, [sp, 24]
ldr w0, [sp, 12]
cmp w0, 0
bge .L2
mov w0, 0
b .L3
.L2:
ldr w0, [sp, 12]
str w0, [sp, 28]
b .L4
.L6:
ldr w1... |
257 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | aarch64 | -O1 | ARM64 gcc 15.2.0 | isPalindrome:
tbnz w0, #31, .L5
cbz w0, .L6
mov w3, w0
mov w2, 0
mov w8, 10
mov w7, 2147483647
mov w6, 26215
movk w6, 0x6666, lsl 16
.L4:
sdiv w1, w3, w8
add w1, w1, w1, lsl 2
sub w1, w3, w1,... |
258 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | aarch64 | -O2 | ARM64 gcc 15.2.0 | isPalindrome:
tbnz w0, #31, .L7
cbz w0, .L6
mov w5, 52429
mov w8, 26215
mov w4, w0
mov w3, 0
mov w7, 10
mov w6, 2147483647
movk w5, 0xcccc, lsl 16
movk w8, 0x6666, lsl 16
b .L4
.L10:
... |
259 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | aarch64 | -O3 | ARM64 gcc 15.2.0 | isPalindrome:
tbnz w0, #31, .L7
mov w5, 0
cbz w0, .L3
mov w8, 52429
mov w7, 26215
mov w4, w0
mov w10, 10
mov w9, 2147483647
movk w8, 0xcccc, lsl 16
movk w7, 0x6666, lsl 16
b .L4
.L10:
... |
260 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | aarch64 | -O0 | armv8-a clang 21.1.0 | isPalindrome:
sub sp, sp, #32
str w0, [sp, #24]
str wzr, [sp, #12]
ldr w8, [sp, #24]
tbz w8, #31, .LBB0_2
b .LBB0_1
.LBB0_1:
mov w8, wzr
and w8, w8, #0x1
and w8, w8, #0x1
strb w8, [sp, #31]
b... |
261 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | aarch64 | -O1 | armv8-a clang 21.1.0 | isPalindrome:
tbnz w0, #31, .LBB0_6
mov w8, wzr
cbz w0, .LBB0_5
mov w9, #52429
mov w10, #10
mov w11, w0
movk w9, #52428, lsl #16
.LBB0_3:
umull x12, w11, w9
lsr x12, x12, #35
msub w13, w12, w10, w11
... |
262 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | aarch64 | -O2 | armv8-a clang 21.1.0 | isPalindrome:
tbnz w0, #31, .LBB0_6
mov w8, wzr
cbz w0, .LBB0_5
mov w9, #52429
mov w10, #10
mov w11, w0
movk w9, #52428, lsl #16
.LBB0_3:
umull x12, w11, w9
lsr x12, x12, #35
msub w13, w12, w10, w11
... |
263 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | aarch64 | -O3 | armv8-a clang 21.1.0 | isPalindrome:
tbnz w0, #31, .LBB0_6
mov w8, wzr
cbz w0, .LBB0_5
mov w9, #52429
mov w10, #10
mov w11, w0
movk w9, #52428, lsl #16
.LBB0_3:
umull x12, w11, w9
lsr x12, x12, #35
msub w13, w12, w10, w11
... |
264 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | mips64 | -O0 | mips64 clang 21.1.0 | isPalindrome:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -48
sd $ra, 40($sp)
sd $fp, 32($sp)
move $fp, $sp
move $1, $4
sw $1, 24($fp)
sw $zero, 12($fp)
lw $1, 24($fp)
bgez $1, .LBB0_3
nop
b .LBB... |
265 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | mips64 | -O1 | mips64 clang 21.1.0 | isPalindrome:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -16
sd $ra, 8($sp)
sd $fp, 0($sp)
move $fp, $sp
bltz $4, .LBB0_6
nop
beqz $4, .LBB0_7
nop
addiu $2, $zero, 0
lui $1, 52428
ori $3, $1, 52429
... |
266 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | mips64 | -O2 | mips64 clang 21.1.0 | isPalindrome:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -16
sd $ra, 8($sp)
sd $fp, 0($sp)
move $fp, $sp
bltz $4, .LBB0_6
nop
beqz $4, .LBB0_7
nop
addiu $2, $zero, 0
lui $1, 52428
ori $3, $1, 52429
... |
267 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | mips64 | -O3 | mips64 clang 21.1.0 | isPalindrome:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -16
sd $ra, 8($sp)
sd $fp, 0($sp)
move $fp, $sp
bltz $4, .LBB0_6
nop
beqz $4, .LBB0_7
nop
lui $1, 52428
addiu $2, $zero, 0
addiu $5, $zero, -8
... |
268 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | mips64 | -O0 | mips64 gcc 15.2.0 | isPalindrome:
daddiu $sp,$sp,-48
sd $fp,40($sp)
move $fp,$sp
move $2,$4
sll $2,$2,0
sw $2,16($fp)
sw $0,4($fp)
lw $2,16($fp)
bgez $2,.L2
nop
move $2,$0
b .L3
nop
.L2:
... |
269 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | mips64 | -O1 | mips64 gcc 15.2.0 | isPalindrome:
bltz $4,.L5
nop
beq $4,$0,.L6
move $3,$4
move $5,$0
li $6,2147418112 # 0x7fff0000
ori $6,$6,0xffff
.L4:
dsll $2,$3,1
daddu $2,$2,$3
dsll $7,$2,4
daddu $2,$2,$7
... |
270 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | mips64 | -O2 | mips64 gcc 15.2.0 | isPalindrome:
bltz $4,.L7
nop
beq $4,$0,.L6
li $8,2147418112 # 0x7fff0000
move $5,$4
move $2,$0
b .L4
ori $8,$8,0xffff
.L11:
addu $2,$7,$6
beq $3,$0,.L3
move $5,$3
.L4:
... |
271 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | mips64 | -O3 | mips64 gcc 15.2.0 | isPalindrome:
bltz $4,.L7
nop
beq $4,$0,.L6
li $8,2147418112 # 0x7fff0000
move $5,$4
move $2,$0
b .L4
ori $8,$8,0xffff
.L11:
addu $2,$7,$6
beq $3,$0,.L3
move $5,$3
.L4:
... |
272 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | riscv64 | -O0 | RISC-V 64 clang 21.1.0 | isPalindrome:
addi sp, sp, -48
sd ra, 40(sp)
sd s0, 32(sp)
addi s0, sp, 48
sw a0, -24(s0)
li a0, 0
sw a0, -36(s0)
lw a0, -24(s0)
bgez a0, .LBB0_2
j .LBB0_1
.LBB0_1:
li a0, 0
... |
273 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | riscv64 | -O1 | RISC-V 64 clang 21.1.0 | isPalindrome:
bltz a0, .LBB0_6
li a1, 0
beqz a0, .LBB0_5
lui a2, 205
lui a7, 524288
addi a2, a2, -819
addi a7, a7, -2
slli a2, a2, 12
addi t0, a2, -819
li a6, 9
mv a4, a0
.LBB0_3:
mv ... |
274 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | riscv64 | -O2 | RISC-V 64 clang 21.1.0 | isPalindrome:
bltz a0, .LBB0_6
li a1, 0
beqz a0, .LBB0_5
lui a2, 205
lui a7, 524288
addi a2, a2, -819
addi a7, a7, -2
slli a2, a2, 12
addi t0, a2, -819
li a6, 9
mv a4, a0
.LBB0_3:
mv ... |
275 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | riscv64 | -O3 | RISC-V 64 clang 21.1.0 | isPalindrome:
bltz a0, .LBB0_6
li a1, 0
beqz a0, .LBB0_5
lui a2, 205
lui a7, 524288
addi a2, a2, -819
addi a7, a7, -2
slli a2, a2, 12
addi t0, a2, -819
li a6, 9
mv a4, a0
.LBB0_3:
mv ... |
276 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | riscv64 | -O0 | RISC-V 64 gcc 15.2.0 | isPalindrome:
addi sp,sp,-48
sd ra,40(sp)
sd s0,32(sp)
addi s0,sp,48
mv a5,a0
sw a5,-36(s0)
sw zero,-24(s0)
lw a5,-36(s0)
sext.w a5,a5
bge a5,zero,.L2
li a5,0
j .L3
.L2:
... |
277 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | riscv64 | -O1 | RISC-V 64 gcc 15.2.0 | isPalindrome:
blt a0,zero,.L5
beq a0,zero,.L6
mv a4,a0
li a1,0
li a6,1717985280
addi a6,a6,1639
li a7,-2147483648
addiw a7,a7,-1
.L4:
mul a3,a4,a6
srai a3,a3,34
sraiw a5,a4,31
subw ... |
278 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | riscv64 | -O2 | RISC-V 64 gcc 15.2.0 | isPalindrome:
blt a0,zero,.L7
beq a0,zero,.L6
li t3,-2147483648
li t1,1717985280
addi t1,t1,1639
addiw t3,t3,-1
mv a1,a0
li a7,0
j .L4
.L10:
addw a7,a2,a5
beq a1,zero,.L3
.L4:
mu... |
279 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | riscv64 | -O3 | RISC-V 64 gcc 15.2.0 | isPalindrome:
blt a0,zero,.L7
beq a0,zero,.L6
li t3,-2147483648
li t1,1717985280
addi t1,t1,1639
addiw t3,t3,-1
mv a1,a0
li a7,0
j .L4
.L10:
addw a7,a2,a5
beq a1,zero,.L3
.L4:
mu... |
280 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | x86-64 | -O0 | x86-64 clang 21.1.0 | isPalindrome:
push rbp
mov rbp, rsp
mov dword ptr [rbp - 8], edi
mov dword ptr [rbp - 20], 0
cmp dword ptr [rbp - 8], 0
jge .LBB0_2
mov byte ptr [rbp - 1], 0
jmp .LBB0_8
.LBB0_2:
mov eax, dword ptr [rbp - 8]
... |
281 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | x86-64 | -O1 | x86-64 clang 21.1.0 | isPalindrome:
xor eax, eax
test edi, edi
js .LBB0_7
je .LBB0_6
xor eax, eax
mov ecx, 3435973837
mov edx, edi
.LBB0_3:
mov esi, edx
imul rsi, rcx
shr rsi, 35
lea r8d, [rsi + rsi]
le... |
282 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | x86-64 | -O2 | x86-64 clang 21.1.0 | isPalindrome:
xor eax, eax
test edi, edi
js .LBB0_7
je .LBB0_6
xor eax, eax
mov ecx, 3435973837
mov edx, edi
.LBB0_3:
mov esi, edx
imul rsi, rcx
shr rsi, 35
lea r8d, [rsi + rsi]
le... |
283 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | x86-64 | -O3 | x86-64 clang 21.1.0 | isPalindrome:
xor eax, eax
test edi, edi
js .LBB0_7
je .LBB0_6
xor eax, eax
mov ecx, 3435973837
mov edx, edi
.LBB0_3:
mov esi, edx
imul rsi, rcx
shr rsi, 35
lea r8d, [rsi + rsi]
le... |
284 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | x86-64 | -O0 | x86-64 gcc 15.2 | isPalindrome:
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-20], edi
mov DWORD PTR [rbp-8], 0
cmp DWORD PTR [rbp-20], 0
jns .L2
mov eax, 0
jmp .L3
.L2:
mov eax, DWORD PTR [rbp-20]
mov DWORD PTR [rbp-4], eax... |
285 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | x86-64 | -O1 | x86-64 gcc 15.2 | isPalindrome:
mov r8d, edi
mov eax, 0
test edi, edi
js .L1
je .L6
mov ecx, edi
mov esi, 0
mov edi, 2147483647
.L4:
movsx rax, ecx
imul rax, rax, 1717986919
sar rax, 34
mov edx, e... |
286 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | x86-64 | -O2 | x86-64 gcc 15.2 | isPalindrome:
mov r10d, edi
xor eax, eax
test edi, edi
js .L1
je .L6
mov edx, edi
xor ecx, ecx
mov r8d, 3435973837
jmp .L4
.L10:
lea edx, [rcx+rcx*4]
lea ecx, [rax+rdx*2]
mov ... |
287 | 9 | Palindrome Number | Easy | /*
9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is ... | x86-64 | -O3 | x86-64 gcc 15.2 | isPalindrome:
mov r10d, edi
xor eax, eax
test edi, edi
js .L1
je .L6
mov edx, edi
xor ecx, ecx
mov r8d, 3435973837
jmp .L4
.L10:
lea edx, [rcx+rcx*4]
lea ecx, [rax+rdx*2]
mov ... |
288 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | aarch64 | -O0 | ARM64 gcc 15.2.0 | match_recursive:
stp x29, x30, [sp, -48]!
mov x29, sp
str x0, [sp, 40]
str x1, [sp, 32]
str x2, [sp, 24]
ldr x0, [sp, 32]
ldrb w0, [x0]
cmp w0, 0
bne .L2
ldr x0, [sp, 40]
ldrb w0, [x0]
... |
289 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | aarch64 | -O1 | ARM64 gcc 15.2.0 | match_recursive:
stp x29, x30, [sp, -48]!
mov x29, sp
stp x19, x20, [sp, 16]
mov x19, x0
ldrb w0, [x1]
cbz w0, .L18
stp x21, x22, [sp, 32]
mov x20, x1
mov x21, x2
ldrb w1, [x1, 1]
cmp w1, 42... |
290 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | aarch64 | -O2 | ARM64 gcc 15.2.0 | match_recursive:
stp x29, x30, [sp, -64]!
mov x29, sp
stp x19, x20, [sp, 16]
mov x19, x0
mov x20, x1
ldrb w3, [x1]
cbnz w3, .L2
b .L14
.L12:
cmp w1, w0
bne .L8
.L13:
add x19, x19, 1
... |
291 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | aarch64 | -O3 | ARM64 gcc 15.2.0 | match_recursive:
stp x29, x30, [sp, -64]!
mov x29, sp
stp x19, x20, [sp, 16]
mov x19, x0
mov x20, x1
ldrb w3, [x1]
cbnz w3, .L2
b .L14
.L12:
cmp w1, w0
bne .L8
.L13:
add x19, x19, 1
... |
292 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | aarch64 | -O0 | armv8-a clang 21.1.0 | match_recursive:
sub sp, sp, #48
stp x29, x30, [sp, #32]
add x29, sp, #32
str x0, [sp, #16]
str x1, [sp, #8]
str x2, [sp]
ldr x8, [sp, #8]
ldrb w8, [x8]
cbnz w8, .LBB0_2
b .LBB0_1
.LBB0_1:
ldr... |
293 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | aarch64 | -O1 | armv8-a clang 21.1.0 | match_recursive:
stp x29, x30, [sp, #-48]!
str x21, [sp, #16]
stp x20, x19, [sp, #32]
mov x29, sp
mov x19, x2
mov x20, x0
add x21, x1, #2
b .LBB0_3
.LBB0_1:
cbz w9, .LBB0_7
.LBB0_2:
add x20, x20, #1... |
294 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | aarch64 | -O2 | armv8-a clang 21.1.0 | match_recursive:
stp x29, x30, [sp, #-48]!
str x21, [sp, #16]
stp x20, x19, [sp, #32]
mov x29, sp
ldrb w8, [x1]
mov x20, x0
cbz w8, .LBB0_8
mov x19, x2
add x21, x1, #2
b .LBB0_4
.LBB0_2:
cmp ... |
295 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | aarch64 | -O3 | armv8-a clang 21.1.0 | match_recursive:
stp x29, x30, [sp, #-48]!
str x21, [sp, #16]
stp x20, x19, [sp, #32]
mov x29, sp
ldrb w8, [x1]
mov x20, x0
cbz w8, .LBB0_9
mov x19, x2
add x21, x1, #2
b .LBB0_4
.LBB0_2:
cmp ... |
296 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | mips64 | -O0 | mips64 clang 21.1.0 | match_recursive:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -64
sd $ra, 56($sp)
sd $fp, 48($sp)
sd $gp, 40($sp)
move $fp, $sp
lui $1, %hi(%neg(%gp_rel(match_recursive)))
daddu $1, $1, $25
daddiu $1, $1, %lo(%neg(%gp_rel(match_recursi... |
297 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | mips64 | -O1 | mips64 clang 21.1.0 | match_recursive:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -64
sd $ra, 56($sp)
sd $fp, 48($sp)
sd $gp, 40($sp)
sd $19, 32($sp)
sd $18, 24($sp)
sd $17, 16($sp)
sd $16, 8($sp)
move $fp, $sp
lui $1, %hi... |
298 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | mips64 | -O2 | mips64 clang 21.1.0 | match_recursive:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -64
sd $ra, 56($sp)
sd $fp, 48($sp)
sd $gp, 40($sp)
sd $19, 32($sp)
sd $18, 24($sp)
sd $17, 16($sp)
sd $16, 8($sp)
move $fp, $sp
lui $1, %hi... |
299 | 10 | Regular Expression Matching | Hard | /*
10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, c... | mips64 | -O3 | mips64 clang 21.1.0 | match_recursive:
.Lfunc_begin0 = .Ltmp0
daddiu $sp, $sp, -64
sd $ra, 56($sp)
sd $fp, 48($sp)
sd $gp, 40($sp)
sd $19, 32($sp)
sd $18, 24($sp)
sd $17, 16($sp)
sd $16, 8($sp)
move $fp, $sp
lui $1, %hi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.