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
100
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
aarch64
-O0
armv8-a clang 21.1.0
bs: sub sp, sp, #32 str x0, [sp, #24] str w1, [sp, #20] str w2, [sp, #16] str wzr, [sp, #12] ldr w8, [sp, #20] subs w8, w8, #1 str w8, [sp, #8] b .LBB0_1 .LBB0_1: ldr w8, [sp, #12] ldr w9...
101
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
aarch64
-O1
armv8-a clang 21.1.0
bs: subs w8, w1, #1 b.lt .LBB0_3 mov w9, wzr .LBB0_2: sub w10, w8, w9 add w10, w9, w10, lsr #1 ldr w11, [x0, w10, uxtw #2] sub w12, w10, #1 cmp w11, w2 csel w8, w12, w8, gt csinc w9, w9, w10, gt cm...
102
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
aarch64
-O2
armv8-a clang 21.1.0
bs: subs w8, w1, #1 b.lt .LBB0_3 mov w9, wzr .LBB0_2: sub w10, w8, w9 add w10, w9, w10, lsr #1 ldr w11, [x0, w10, uxtw #2] sub w12, w10, #1 cmp w11, w2 csel w8, w12, w8, gt csinc w9, w9, w10, gt cm...
103
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
aarch64
-O3
armv8-a clang 21.1.0
bs: subs w8, w1, #1 b.lt .LBB0_3 mov w9, wzr .LBB0_2: sub w10, w8, w9 add w10, w9, w10, lsr #1 ldr w11, [x0, w10, uxtw #2] sub w12, w10, #1 cmp w11, w2 csel w8, w8, w12, le csinc w9, w9, w10, gt cm...
104
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
mips64
-O0
mips64 clang 21.1.0
bs: .Lfunc_begin0 = .Ltmp0 daddiu $sp, $sp, -48 sd $ra, 40($sp) sd $fp, 32($sp) move $fp, $sp move $1, $6 move $2, $5 sd $4, 24($fp) sw $2, 20($fp) sw $1, 16($fp) sw $zero, 12($fp) lw $1,...
105
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
mips64
-O1
mips64 clang 21.1.0
bs: .Lfunc_begin0 = .Ltmp0 daddiu $sp, $sp, -16 sd $ra, 8($sp) sd $fp, 0($sp) move $fp, $sp blez $5, .LBB0_3 addiu $2, $5, -1 addiu $3, $zero, 0 .LBB0_2: subu $1, $2, $3 srl $1, $1, 1 addu $1, $1, $3 d...
106
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
mips64
-O2
mips64 clang 21.1.0
bs: .Lfunc_begin0 = .Ltmp0 daddiu $sp, $sp, -16 sd $ra, 8($sp) sd $fp, 0($sp) move $fp, $sp blez $5, .LBB0_3 addiu $2, $5, -1 addiu $3, $zero, 0 .LBB0_2: subu $1, $2, $3 srl $1, $1, 1 addu $1, $1, $3 d...
107
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
mips64
-O3
mips64 clang 21.1.0
bs: .Lfunc_begin0 = .Ltmp0 daddiu $sp, $sp, -16 sd $ra, 8($sp) sd $fp, 0($sp) move $fp, $sp blez $5, .LBB0_3 addiu $2, $5, -1 addiu $3, $zero, 0 .LBB0_2: subu $1, $2, $3 srl $1, $1, 1 addu $1, $1, $3 d...
108
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
mips64
-O0
mips64 gcc 15.2.0
bs: daddiu $sp,$sp,-48 sd $fp,40($sp) move $fp,$sp sd $4,16($fp) move $3,$5 move $2,$6 sll $3,$3,0 sw $3,24($fp) sll $2,$2,0 sw $2,28($fp) sw $0,0($fp) lw $2,24($fp) ad...
109
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
mips64
-O1
mips64 gcc 15.2.0
bs: addiu $2,$5,-1 bltz $2,.L8 move $8,$0 b .L9 subu $5,$2,$8 .L3: .L4: slt $3,$2,$8 bne $3,$0,.L8 subu $5,$2,$8 .L9: srl $3,$5,31 addu $3,$3,$5 sra $3,$3,1 addu $3,$3,$8 ...
110
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
mips64
-O2
mips64 gcc 15.2.0
bs: addiu $2,$5,-1 bltz $2,.L11 move $8,$0 b .L10 subu $3,$2,$8 .L9: slt $3,$2,$8 bne $3,$0,.L11 subu $3,$2,$8 .L10: sra $3,$3,1 addu $3,$3,$8 dsll $7,$3,2 daddu $7,$4,$7 lw...
111
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
mips64
-O3
mips64 gcc 15.2.0
bs: addiu $2,$5,-1 bltz $2,.L11 move $8,$0 b .L10 subu $3,$2,$8 .L9: slt $3,$2,$8 bne $3,$0,.L11 subu $3,$2,$8 .L10: sra $3,$3,1 addu $3,$3,$8 dsll $7,$3,2 daddu $7,$4,$7 lw...
112
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
riscv64
-O0
RISC-V 64 clang 21.1.0
bs: addi sp, sp, -48 sd ra, 40(sp) sd s0, 32(sp) addi s0, sp, 48 sd a0, -24(s0) sw a1, -28(s0) sw a2, -32(s0) li a0, 0 sw a0, -36(s0) lw a0, -28(s0) addiw a0, a0, -1 sw a0...
113
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
riscv64
-O1
RISC-V 64 clang 21.1.0
bs: mv a3, a0 addiw a0, a1, -1 blez a1, .LBB0_7 li a1, 0 j .LBB0_3 .LBB0_2: blt a0, a1, .LBB0_7 .LBB0_3: subw a4, a0, a1 srliw a4, a4, 1 addw a5, a4, a1 slli a5, a5, 2 add a5, a5, a3 l...
114
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
riscv64
-O2
RISC-V 64 clang 21.1.0
bs: mv a3, a0 addiw a0, a1, -1 blez a1, .LBB0_7 li a1, 0 j .LBB0_3 .LBB0_2: blt a0, a1, .LBB0_7 .LBB0_3: subw a4, a0, a1 srliw a4, a4, 1 addw a5, a4, a1 slli a5, a5, 2 add a5, a5, a3 l...
115
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
riscv64
-O3
RISC-V 64 clang 21.1.0
bs: mv a3, a0 addiw a0, a1, -1 blez a1, .LBB0_7 li a1, 0 j .LBB0_3 .LBB0_2: blt a0, a1, .LBB0_7 .LBB0_3: subw a4, a0, a1 srliw a4, a4, 1 addw a5, a4, a1 slli a5, a5, 2 add a5, a5, a3 l...
116
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
riscv64
-O0
RISC-V 64 gcc 15.2.0
bs: addi sp,sp,-48 sd ra,40(sp) sd s0,32(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) sw zero,-20(s0) lw a5,-44(s0) ad...
117
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
riscv64
-O1
RISC-V 64 gcc 15.2.0
bs: mv a6,a0 addiw a0,a1,-1 blt a0,zero,.L2 li a3,0 j .L5 .L3: addiw a3,a5,1 .L4: blt a0,a3,.L2 .L5: subw a4,a0,a3 srliw a5,a4,31 addw a5,a5,a4 sraiw a5,a5,1 addw a5,a5,a3 sll...
118
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
riscv64
-O2
RISC-V 64 gcc 15.2.0
bs: addiw a1,a1,-1 blt a1,zero,.L2 li a3,0 .L5: subw a5,a1,a3 sraiw a5,a5,1 addw a5,a5,a3 slli a4,a5,2 add a4,a0,a4 lw a4,0(a4) ble a4,a2,.L3 addiw a1,a5,-1 ble a3,a1,.L5 .L2: ...
119
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
riscv64
-O3
RISC-V 64 gcc 15.2.0
bs: addiw a1,a1,-1 blt a1,zero,.L2 li a3,0 .L5: subw a5,a1,a3 sraiw a5,a5,1 addw a5,a5,a3 slli a4,a5,2 add a4,a0,a4 lw a4,0(a4) ble a4,a2,.L3 addiw a1,a5,-1 ble a3,a1,.L5 .L2: ...
120
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
x86-64
-O0
x86-64 clang 21.1.0
bs: push rbp mov rbp, rsp mov qword ptr [rbp - 8], rdi mov dword ptr [rbp - 12], esi mov dword ptr [rbp - 16], edx mov dword ptr [rbp - 20], 0 mov eax, dword ptr [rbp - 12] sub eax, 1 mov dword ptr [rbp - 24], eax...
121
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
x86-64
-O1
x86-64 clang 21.1.0
bs: lea eax, [rsi - 1] test esi, esi jle .LBB0_6 xor ecx, ecx jmp .LBB0_2 .LBB0_4: add ecx, esi inc ecx cmp ecx, eax jg .LBB0_6 .LBB0_2: mov esi, eax sub esi, ecx shr esi ...
122
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
x86-64
-O2
x86-64 clang 21.1.0
bs: lea eax, [rsi - 1] test esi, esi jle .LBB0_6 xor ecx, ecx jmp .LBB0_2 .LBB0_4: add ecx, esi inc ecx cmp ecx, eax jg .LBB0_6 .LBB0_2: mov esi, eax sub esi, ecx shr esi ...
123
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
x86-64
-O3
x86-64 clang 21.1.0
bs: lea eax, [rsi - 1] test esi, esi jle .LBB0_6 xor ecx, ecx jmp .LBB0_2 .LBB0_4: add ecx, esi inc ecx cmp ecx, eax jg .LBB0_6 .LBB0_2: mov esi, eax sub esi, ecx shr esi ...
124
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
x86-64
-O0
x86-64 gcc 15.2
bs: push rbp mov rbp, rsp mov QWORD PTR [rbp-24], rdi mov DWORD PTR [rbp-28], esi mov DWORD PTR [rbp-32], edx mov DWORD PTR [rbp-4], 0 mov eax, DWORD PTR [rbp-28] sub eax, 1 mov DWORD PTR [rbp-8], eax jmp ...
125
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
x86-64
-O1
x86-64 gcc 15.2
bs: mov eax, esi sub eax, 1 js .L1 mov r8d, 0 jmp .L5 .L3: lea r8d, [rcx+1] .L4: cmp eax, r8d jl .L1 .L5: mov esi, eax sub esi, r8d mov ecx, esi shr ecx, 31 add e...
126
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
x86-64
-O2
x86-64 gcc 15.2
bs: mov eax, esi mov r8d, edx sub eax, 1 js .L1 xor ecx, ecx jmp .L5 .L8: lea eax, [rdx-1] cmp ecx, eax jg .L1 .L5: mov edx, eax sub edx, ecx sar edx add edx, ecx...
127
4
Median of Two Sorted Arrays
Hard
/* 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The media...
x86-64
-O3
x86-64 gcc 15.2
bs: mov eax, esi mov r8d, edx sub eax, 1 js .L1 xor ecx, ecx jmp .L5 .L8: lea eax, [rdx-1] cmp ecx, eax jg .L1 .L5: mov edx, eax sub edx, ecx sar edx add edx, ecx...
128
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
aarch64
-O0
ARM64 gcc 15.2.0
longestPalindrome: stp x29, x30, [sp, -64]! mov x29, sp str x0, [sp, 24] str wzr, [sp, 48] str wzr, [sp, 44] ldr x0, [sp, 24] cmp x0, 0 beq .L2 ldr x0, [sp, 24] ldrb w0, [x0] cmp w0, 0 ...
129
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
aarch64
-O1
ARM64 gcc 15.2.0
longestPalindrome: stp x29, x30, [sp, -32]! mov x29, sp str x19, [sp, 16] mov x19, x0 cbz x0, .L1 ldrb w1, [x0] cbz w1, .L1 bl strlen mov w7, w0 cmp w0, 0 ble .L13 lsl x13, x19...
130
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
aarch64
-O2
ARM64 gcc 15.2.0
longestPalindrome: cbz x0, .L11 ldrb w1, [x0] mov x11, x0 cbz w1, .L21 stp x29, x30, [sp, -32]! mov x29, sp stp x0, x0, [sp, 16] bl strlen cmp w0, 0 ldr x11, [sp, 16] mov x12, x11 ...
131
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
aarch64
-O3
ARM64 gcc 15.2.0
longestPalindrome: cbz x0, .L26 ldrb w1, [x0] mov x11, x0 cbz w1, .L39 stp x29, x30, [sp, -32]! mov x29, sp stp x0, x0, [sp, 16] bl strlen cmp w0, 0 ldr x11, [sp, 16] mov x8, x11 b...
132
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
aarch64
-O0
armv8-a clang 21.1.0
longestPalindrome: sub sp, sp, #80 stp x29, x30, [sp, #64] add x29, sp, #64 stur x0, [x29, #-16] str wzr, [sp, #24] str wzr, [sp, #20] ldur x8, [x29, #-16] cbz x8, .LBB0_2 b .LBB0_1 .LBB0_1: ldur x8, [...
133
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
aarch64
-O1
armv8-a clang 21.1.0
longestPalindrome: cbz x0, .LBB0_20 ldrb w8, [x0] cbz w8, .LBB0_20 stp x29, x30, [sp, #-32]! str x19, [sp, #16] mov x29, sp mov x19, x0 bl strlen mov x8, x0 cmp w8, #1 b.lt .LBB0_18 ...
134
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
aarch64
-O2
armv8-a clang 21.1.0
longestPalindrome: cbz x0, .LBB0_20 ldrb w8, [x0] cbz w8, .LBB0_20 stp x29, x30, [sp, #-32]! str x19, [sp, #16] mov x29, sp mov x19, x0 bl strlen mov x8, x0 cmp w8, #1 b.lt .LBB0_18 ...
135
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
aarch64
-O3
armv8-a clang 21.1.0
longestPalindrome: cbz x0, .LBB0_20 ldrb w8, [x0] cbz w8, .LBB0_20 stp x29, x30, [sp, #-32]! str x19, [sp, #16] mov x29, sp mov x19, x0 bl strlen mov x8, x0 cmp w8, #1 b.lt .LBB0_18 ...
136
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
mips64
-O0
mips64 clang 21.1.0
longestPalindrome: .Lfunc_begin0 = .Ltmp0 daddiu $sp, $sp, -96 sd $ra, 88($sp) sd $fp, 80($sp) sd $gp, 72($sp) move $fp, $sp lui $1, %hi(%neg(%gp_rel(longestPalindrome))) daddu $1, $1, $25 daddiu $1, $1, %lo(%neg(%gp_rel(longestPa...
137
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
mips64
-O1
mips64 clang 21.1.0
longestPalindrome: .Lfunc_begin0 = .Ltmp0 daddiu $sp, $sp, -32 sd $ra, 24($sp) sd $fp, 16($sp) sd $gp, 8($sp) sd $16, 0($sp) move $fp, $sp lui $1, %hi(%neg(%gp_rel(longestPalindrome))) daddu $2, $1, $25 beqz $4, .LB...
138
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
mips64
-O2
mips64 clang 21.1.0
longestPalindrome: .Lfunc_begin0 = .Ltmp0 daddiu $sp, $sp, -32 sd $ra, 24($sp) sd $fp, 16($sp) sd $gp, 8($sp) sd $16, 0($sp) move $fp, $sp lui $1, %hi(%neg(%gp_rel(longestPalindrome))) beqz $4, .LBB0_19 daddu $2, $1...
139
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
mips64
-O3
mips64 clang 21.1.0
longestPalindrome: .Lfunc_begin0 = .Ltmp0 daddiu $sp, $sp, -32 sd $ra, 24($sp) sd $fp, 16($sp) sd $gp, 8($sp) sd $16, 0($sp) move $fp, $sp lui $1, %hi(%neg(%gp_rel(longestPalindrome))) beqz $4, .LBB0_19 daddu $2, $1...
140
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
mips64
-O0
mips64 gcc 15.2.0
longestPalindrome: daddiu $sp,$sp,-80 sd $31,72($sp) sd $fp,64($sp) sd $28,56($sp) move $fp,$sp lui $28,%hi(%neg(%gp_rel(longestPalindrome))) daddu $28,$28,$25 daddiu $28,$28,%lo(%neg(%gp_rel(longestPalindrome))) sd $...
141
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
mips64
-O1
mips64 gcc 15.2.0
longestPalindrome: daddiu $sp,$sp,-32 sd $31,24($sp) sd $28,16($sp) sd $16,8($sp) lui $28,%hi(%neg(%gp_rel(longestPalindrome))) daddu $28,$28,$25 daddiu $28,$28,%lo(%neg(%gp_rel(longestPalindrome))) beq $4,$0,.L11 move ...
142
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
mips64
-O2
mips64 gcc 15.2.0
longestPalindrome: beq $4,$0,.L11 nop daddiu $sp,$sp,-32 sd $28,16($sp) sd $16,8($sp) sd $31,24($sp) lb $2,0($4) lui $28,%hi(%neg(%gp_rel(longestPalindrome))) daddu $28,$28,$25 daddiu $28,$28,%lo(%neg(%gp_re...
143
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
mips64
-O3
mips64 gcc 15.2.0
longestPalindrome: beq $4,$0,.L11 nop daddiu $sp,$sp,-32 sd $28,16($sp) sd $16,8($sp) sd $31,24($sp) lb $2,0($4) lui $28,%hi(%neg(%gp_rel(longestPalindrome))) daddu $28,$28,$25 daddiu $28,$28,%lo(%neg(%gp_re...
144
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
riscv64
-O0
RISC-V 64 clang 21.1.0
longestPalindrome: addi sp, sp, -80 sd ra, 72(sp) sd s0, 64(sp) addi s0, sp, 80 sd a0, -32(s0) li a0, 0 sw a0, -56(s0) sw a0, -60(s0) ld a0, -32(s0) beqz a0, .LBB0_2 j .LBB0_1 .LBB0_...
145
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
riscv64
-O1
RISC-V 64 clang 21.1.0
longestPalindrome: beqz a0, .LBB0_27 lbu a1, 0(a0) beqz a1, .LBB0_27 addi sp, sp, -32 sd ra, 24(sp) sd s0, 16(sp) sd s1, 8(sp) mv s1, a0 call strlen sext.w t1, a0 blez t1, .LBB0_25 mv ...
146
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
riscv64
-O2
RISC-V 64 clang 21.1.0
longestPalindrome: beqz a0, .LBB0_27 lbu a1, 0(a0) beqz a1, .LBB0_27 addi sp, sp, -32 sd ra, 24(sp) sd s0, 16(sp) sd s1, 8(sp) mv s1, a0 call strlen sext.w t1, a0 blez t1, .LBB0_25 mv ...
147
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
riscv64
-O3
RISC-V 64 clang 21.1.0
longestPalindrome: beqz a0, .LBB0_27 lbu a1, 0(a0) beqz a1, .LBB0_27 addi sp, sp, -32 sd ra, 24(sp) sd s0, 16(sp) sd s1, 8(sp) mv s1, a0 call strlen sext.w t1, a0 blez t1, .LBB0_25 mv ...
148
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
riscv64
-O0
RISC-V 64 gcc 15.2.0
longestPalindrome: addi sp,sp,-64 sd ra,56(sp) sd s0,48(sp) addi s0,sp,64 sd a0,-56(s0) sw zero,-32(s0) sw zero,-36(s0) ld a5,-56(s0) beq a5,zero,.L2 ld a5,-56(s0) lbu a5,0(a5) ...
149
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
riscv64
-O1
RISC-V 64 gcc 15.2.0
longestPalindrome: addi sp,sp,-16 sd ra,8(sp) sd s0,0(sp) mv s0,a0 beq a0,zero,.L1 lbu a5,0(a0) beq a5,zero,.L1 call strlen sext.w a7,a0 ble a7,zero,.L13 li t4,0 li t5,0 ...
150
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
riscv64
-O2
RISC-V 64 gcc 15.2.0
longestPalindrome: beq a0,zero,.L11 lbu a5,0(a0) mv t5,a0 beq a5,zero,.L21 addi sp,sp,-32 sd ra,24(sp) sd a0,0(sp) sd a0,8(sp) call strlen ld t5,0(sp) sext.w a7,a0 mv t4,t5 ...
151
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
riscv64
-O3
RISC-V 64 gcc 15.2.0
longestPalindrome: beq a0,zero,.L11 lbu a5,0(a0) mv t5,a0 beq a5,zero,.L21 addi sp,sp,-32 sd ra,24(sp) sd a0,0(sp) sd a0,8(sp) call strlen ld t5,0(sp) sext.w a7,a0 mv t4,t5 ...
152
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
x86-64
-O0
x86-64 clang 21.1.0
longestPalindrome: push rbp mov rbp, rsp sub rsp, 48 mov qword ptr [rbp - 16], rdi mov dword ptr [rbp - 40], 0 mov dword ptr [rbp - 44], 0 cmp qword ptr [rbp - 16], 0 je .LBB0_2 mov rax, qword ptr [rbp - 16] ...
153
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
x86-64
-O1
x86-64 clang 21.1.0
longestPalindrome: push rbp push r14 push rbx mov rbx, rdi test rdi, rdi je .LBB0_21 cmp byte ptr [rbx], 0 je .LBB0_21 mov rdi, rbx call strlen@PLT xor r9d, r9d test eax, eax ...
154
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
x86-64
-O2
x86-64 clang 21.1.0
longestPalindrome: push rbp push r14 push rbx test rdi, rdi je .LBB0_18 mov rbx, rdi cmp byte ptr [rdi], 0 je .LBB0_22 mov rdi, rbx call strlen@PLT xor r9d, r9d test eax, eax ...
155
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
x86-64
-O3
x86-64 clang 21.1.0
longestPalindrome: push rbp push r14 push rbx test rdi, rdi je .LBB0_18 mov rbx, rdi cmp byte ptr [rdi], 0 je .LBB0_22 mov rdi, rbx call strlen@PLT xor r9d, r9d test eax, eax ...
156
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
x86-64
-O0
x86-64 gcc 15.2
longestPalindrome: push rbp mov rbp, rsp sub rsp, 48 mov QWORD PTR [rbp-40], rdi mov DWORD PTR [rbp-16], 0 mov DWORD PTR [rbp-20], 0 cmp QWORD PTR [rbp-40], 0 je .L2 mov rax, QWORD PTR [rbp-40] movzx ea...
157
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
x86-64
-O1
x86-64 gcc 15.2
longestPalindrome: push r14 push r12 push rbp push rbx sub rsp, 8 mov rbx, rdi test rdi, rdi je .L11 mov rax, rdi cmp BYTE PTR [rdi], 0 je .L1 call strlen mov r8d, eax ...
158
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
x86-64
-O2
x86-64 gcc 15.2
longestPalindrome: push r14 push r12 push rbp push rbx sub rsp, 8 test rdi, rdi je .L11 mov rbx, rdi mov rbp, rdi cmp BYTE PTR [rdi], 0 je .L1 call strlen mov r9, rax ...
159
5
Longest Palindromic Substring
Medium
/* 5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Output: "bb" */ char* longestPalindrome(char* s) { int sz;...
x86-64
-O3
x86-64 gcc 15.2
longestPalindrome: push r14 push r12 push rbp push rbx sub rsp, 8 test rdi, rdi je .L11 mov rbx, rdi mov rbp, rdi cmp BYTE PTR [rdi], 0 je .L1 call strlen mov r9, rax ...
160
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
aarch64
-O0
ARM64 gcc 15.2.0
convert: stp x29, x30, [sp, -80]! mov x29, sp str x0, [sp, 24] str w1, [sp, 20] str wzr, [sp, 68] ldr x0, [sp, 24] cmp x0, 0 beq .L2 ldr x0, [sp, 24] ldrb w0, [x0] cmp w0, 0 beq ...
161
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
aarch64
-O1
ARM64 gcc 15.2.0
convert: stp x29, x30, [sp, -48]! mov x29, sp stp x19, x20, [sp, 16] mov x19, x0 cbz x0, .L2 str x21, [sp, 32] mov w21, w1 ldrb w0, [x0] cmp w0, 0 ccmp w1, 1, 4, ne bne .L15 ldr ...
162
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
aarch64
-O2
ARM64 gcc 15.2.0
convert: mov x5, x0 cbz x0, .L23 ldrb w2, [x0] cmp w2, 0 ccmp w1, 1, 4, ne bne .L27 .L23: mov x0, x5 ret .L27: stp x29, x30, [sp, -48]! mov x29, sp str w1, [sp, 36] str x0, [sp, 40] ...
163
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
aarch64
-O3
ARM64 gcc 15.2.0
convert: mov x3, x0 cbz x0, .L23 ldrb w2, [x0] cmp w2, 0 ccmp w1, 1, 4, ne bne .L27 .L23: mov x0, x3 ret .L27: stp x29, x30, [sp, -48]! mov x29, sp str w1, [sp, 36] str x0, [sp, 40] ...
164
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
aarch64
-O0
armv8-a clang 21.1.0
convert: sub sp, sp, #80 stp x29, x30, [sp, #64] add x29, sp, #64 stur x0, [x29, #-16] stur w1, [x29, #-20] str wzr, [sp, #28] ldur x8, [x29, #-16] cbz x8, .LBB0_3 b .LBB0_1 .LBB0_1: ldur x8, [x29, #-16...
165
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
aarch64
-O1
armv8-a clang 21.1.0
convert: cbz x0, .LBB0_12 cmp w1, #1 b.eq .LBB0_12 ldrb w8, [x0] cbz w8, .LBB0_12 stp x29, x30, [sp, #-48]! str x21, [sp, #16] stp x20, x19, [sp, #32] mov x29, sp mov x20, x0 mov w21, w1 ...
166
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
aarch64
-O2
armv8-a clang 21.1.0
convert: cbz x0, .LBB0_12 cmp w1, #1 b.eq .LBB0_12 ldrb w8, [x0] cbz w8, .LBB0_12 stp x29, x30, [sp, #-48]! str x21, [sp, #16] stp x20, x19, [sp, #32] mov x29, sp mov x20, x0 mov w21, w1 ...
167
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
aarch64
-O3
armv8-a clang 21.1.0
convert: cbz x0, .LBB0_15 cmp w1, #1 b.eq .LBB0_15 ldrb w8, [x0] cbz w8, .LBB0_15 stp x29, x30, [sp, #-48]! str x21, [sp, #16] stp x20, x19, [sp, #32] mov x29, sp mov x20, x0 mov w21, w1 ...
168
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
mips64
-O0
mips64 clang 21.1.0
convert: .Lfunc_begin0 = .Ltmp0 daddiu $sp, $sp, -96 sd $ra, 88($sp) sd $fp, 80($sp) sd $gp, 72($sp) move $fp, $sp lui $1, %hi(%neg(%gp_rel(convert))) daddu $1, $1, $25 daddiu $1, $1, %lo(%neg(%gp_rel(convert))) sd $1...
169
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
mips64
-O1
mips64 clang 21.1.0
convert: .Lfunc_begin0 = .Ltmp0 lui $1, %hi(%neg(%gp_rel(convert))) beqz $4, .LBB0_10 daddu $2, $1, $25 addiu $1, $zero, 1 beq $5, $1, .LBB0_13 nop lbu $1, 0($4) andi $1, $1, 255 beqz $1, .LBB0_12 nop daddiu...
170
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
mips64
-O2
mips64 clang 21.1.0
convert: .Lfunc_begin0 = .Ltmp0 lui $1, %hi(%neg(%gp_rel(convert))) beqz $4, .LBB0_10 daddu $2, $1, $25 addiu $1, $zero, 1 beq $5, $1, .LBB0_13 nop lbu $1, 0($4) andi $1, $1, 255 beqz $1, .LBB0_12 nop daddiu...
171
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
mips64
-O3
mips64 clang 21.1.0
convert: .Lfunc_begin0 = .Ltmp0 lui $1, %hi(%neg(%gp_rel(convert))) beqz $4, .LBB0_14 daddu $2, $1, $25 addiu $1, $zero, 1 beq $5, $1, .LBB0_17 nop lbu $1, 0($4) andi $1, $1, 255 beqz $1, .LBB0_16 nop daddiu...
172
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
mips64
-O0
mips64 gcc 15.2.0
convert: daddiu $sp,$sp,-96 sd $31,88($sp) sd $fp,80($sp) sd $28,72($sp) move $fp,$sp lui $28,%hi(%neg(%gp_rel(convert))) daddu $28,$28,$25 daddiu $28,$28,%lo(%neg(%gp_rel(convert))) sd $4,48($fp) move $2,$...
173
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
mips64
-O1
mips64 gcc 15.2.0
convert: daddiu $sp,$sp,-48 sd $31,40($sp) sd $28,32($sp) sd $18,24($sp) sd $17,16($sp) sd $16,8($sp) lui $28,%hi(%neg(%gp_rel(convert))) daddu $28,$28,$25 daddiu $28,$28,%lo(%neg(%gp_rel(convert))) beq ...
174
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
mips64
-O2
mips64 gcc 15.2.0
convert: beq $4,$0,.L25 move $9,$4 lb $2,0($4) beq $2,$0,.L25 nop li $2,1 # 0x1 beq $5,$2,.L25 nop daddiu $sp,$sp,-48 sd $28,32($sp) lui $28,%hi(%neg(%gp_rel(convert))) ...
175
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
mips64
-O3
mips64 gcc 15.2.0
convert: beq $4,$0,.L31 move $8,$4 lb $2,0($4) beq $2,$0,.L31 nop li $2,1 # 0x1 beq $5,$2,.L31 nop daddiu $sp,$sp,-48 sd $28,32($sp) lui $28,%hi(%neg(%gp_rel(convert))) ...
176
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
riscv64
-O0
RISC-V 64 clang 21.1.0
convert: addi sp, sp, -80 sd ra, 72(sp) sd s0, 64(sp) addi s0, sp, 80 sd a0, -32(s0) sw a1, -36(s0) li a0, 0 sw a0, -52(s0) ld a0, -32(s0) beqz a0, .LBB0_3 j .LBB0_1 .LBB0_1: ...
177
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
riscv64
-O1
RISC-V 64 clang 21.1.0
convert: beqz a0, .LBB0_15 li a2, 1 beq a1, a2, .LBB0_15 lbu a2, 0(a0) beqz a2, .LBB0_15 addi sp, sp, -32 sd ra, 24(sp) sd s0, 16(sp) sd s1, 8(sp) sd s2, 0(sp) mv s2, a0 mv ...
178
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
riscv64
-O2
RISC-V 64 clang 21.1.0
convert: beqz a0, .LBB0_15 li a2, 1 beq a1, a2, .LBB0_15 lbu a2, 0(a0) beqz a2, .LBB0_15 addi sp, sp, -32 sd ra, 24(sp) sd s0, 16(sp) sd s1, 8(sp) sd s2, 0(sp) mv s2, a0 mv ...
179
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
riscv64
-O3
RISC-V 64 clang 21.1.0
convert: beqz a0, .LBB0_16 li a2, 1 beq a1, a2, .LBB0_16 lbu a2, 0(a0) beqz a2, .LBB0_16 addi sp, sp, -32 sd ra, 24(sp) sd s0, 16(sp) sd s1, 8(sp) sd s2, 0(sp) mv s2, a0 mv ...
180
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
riscv64
-O0
RISC-V 64 gcc 15.2.0
convert: addi sp,sp,-80 sd ra,72(sp) sd s0,64(sp) addi s0,sp,80 sd a0,-72(s0) mv a5,a1 sw a5,-76(s0) sw zero,-28(s0) ld a5,-72(s0) beq a5,zero,.L2 ld a5,-72(s0) lbu a5,0(...
181
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
riscv64
-O1
RISC-V 64 gcc 15.2.0
convert: addi sp,sp,-32 sd ra,24(sp) sd s0,16(sp) mv s0,a0 beq a0,zero,.L2 sd s2,0(sp) mv s2,a1 lbu a5,0(a0) beq a5,zero,.L14 addi a5,a1,-1 beq a5,zero,.L15 sd s1,8(sp) ...
182
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
riscv64
-O2
RISC-V 64 gcc 15.2.0
convert: mv a2,a0 beq a0,zero,.L22 lbu a5,0(a0) beq a5,zero,.L22 addi a5,a1,-1 beq a5,zero,.L22 addi sp,sp,-48 sd a1,16(sp) sd ra,40(sp) sd a0,24(sp) call strlen mv a6,a0 ...
183
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
riscv64
-O3
RISC-V 64 gcc 15.2.0
convert: mv a2,a0 beq a0,zero,.L24 lbu a5,0(a0) beq a5,zero,.L24 addi a5,a1,-1 beq a5,zero,.L24 addi sp,sp,-48 sd a1,16(sp) sd ra,40(sp) sd a0,24(sp) call strlen mv a7,a0 ...
184
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
x86-64
-O0
x86-64 clang 21.1.0
convert: push rbp mov rbp, rsp sub rsp, 64 mov qword ptr [rbp - 16], rdi mov dword ptr [rbp - 20], esi mov dword ptr [rbp - 36], 0 cmp qword ptr [rbp - 16], 0 je .LBB0_3 mov rax, qword ptr [rbp - 16] cmp ...
185
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
x86-64
-O1
x86-64 clang 21.1.0
convert: test rdi, rdi je .LBB0_9 push rbp push r15 push r14 push r12 push rbx mov ebx, esi cmp esi, 1 je .LBB0_13 cmp byte ptr [rdi], 0 je .LBB0_13 mov r15, rdi ...
186
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
x86-64
-O2
x86-64 clang 21.1.0
convert: test rdi, rdi je .LBB0_9 push rbp push r15 push r14 push r12 push rbx mov ebx, esi cmp esi, 1 je .LBB0_13 cmp byte ptr [rdi], 0 je .LBB0_13 mov r15, rdi ...
187
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
x86-64
-O3
x86-64 clang 21.1.0
convert: test rdi, rdi je .LBB0_12 push rbp push r15 push r14 push r13 push r12 push rbx push rax mov r14d, esi cmp esi, 1 je .LBB0_16 cmp byte ptr [rdi], 0 je ...
188
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
x86-64
-O0
x86-64 gcc 15.2
convert: push rbp mov rbp, rsp sub rsp, 64 mov QWORD PTR [rbp-56], rdi mov DWORD PTR [rbp-60], esi mov DWORD PTR [rbp-12], 0 cmp QWORD PTR [rbp-56], 0 je .L2 mov rax, QWORD PTR [rbp-56] movzx eax, BYTE ...
189
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
x86-64
-O1
x86-64 gcc 15.2
convert: push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 24 mov rbx, rdi test rdi, rdi je .L2 mov r12d, esi cmp BYTE PTR [rdi], 0 je .L2 cmp e...
190
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
x86-64
-O2
x86-64 gcc 15.2
convert: mov r8, rdi test rdi, rdi je .L18 cmp BYTE PTR [rdi], 0 je .L18 cmp esi, 1 je .L18 push r15 push r14 push r13 mov r13d, esi push r12 push rbp push ...
191
6
Zigzag Conversion
Medium
/* 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a str...
x86-64
-O3
x86-64 gcc 15.2
convert: mov r8, rdi test rdi, rdi je .L27 cmp BYTE PTR [rdi], 0 je .L27 cmp esi, 1 je .L27 push r15 push r14 push r13 push r12 push rbp push rbx mov ebx, e...
192
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...
aarch64
-O0
ARM64 gcc 15.2.0
reverse: sub sp, sp, #32 str w0, [sp, 12] str wzr, [sp, 28] b .L2 .L7: ldr w1, [sp, 12] mov w0, 10 sdiv w2, w1, w0 mov w0, w2 lsl w0, w0, 2 add w0, w0, w2 lsl w0, w0, 1 sub w0...
193
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...
aarch64
-O1
ARM64 gcc 15.2.0
reverse: mov w2, w0 cbz w0, .L1 mov w0, 0 mov w6, 10 mov w8, -2147483648 mov w5, 26215 movk w5, 0x6666, lsl 16 mov w7, 2147483647 b .L5 .L3: sub w3, w8, w1 smull x4, w3, w5 asr ...
194
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...
aarch64
-O2
ARM64 gcc 15.2.0
reverse: mov w2, w0 mov w0, 0 cbz w2, .L1 mov w5, 26215 mov w7, 52429 mov w6, 10 mov w9, -2147483648 movk w5, 0x6666, lsl 16 mov w8, 2147483647 movk w7, 0xcccc, lsl 16 b .L5 .L11: ...
195
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...
aarch64
-O3
ARM64 gcc 15.2.0
reverse: mov w2, w0 mov w0, 0 cbz w2, .L1 mov w7, 26215 mov w9, 52429 mov w8, 10 mov w11, -2147483648 movk w7, 0x6666, lsl 16 mov w10, 2147483647 movk w9, 0xcccc, lsl 16 b .L5 .L11: ...
196
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...
aarch64
-O0
armv8-a clang 21.1.0
reverse: sub sp, sp, #16 str w0, [sp, #8] str wzr, [sp] b .LBB0_1 .LBB0_1: ldr w8, [sp, #8] cbz w8, .LBB0_8 b .LBB0_2 .LBB0_2: ldr w8, [sp, #8] mov w10, #10 sdiv w9, w8, w10 mul w9, w9,...
197
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...
aarch64
-O1
armv8-a clang 21.1.0
reverse: cbz w0, .LBB0_8 mov w9, #26215 mov w8, w0 mov w0, wzr movk w9, #26214, lsl #16 mov w10, #10 mov w11, #-2147483648 b .LBB0_3 .LBB0_2: madd w0, w0, w10, w13 add w8, w8, #9 cmp w8, #...
198
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...
aarch64
-O2
armv8-a clang 21.1.0
reverse: cbz w0, .LBB0_7 mov w9, #26215 mov w11, #52429 mov w8, w0 mov w0, wzr movk w9, #26214, lsl #16 mov w10, #10 movk w11, #52428, lsl #16 b .LBB0_4 .LBB0_2: eor w14, w13, #0x80000000 umul...
199
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...
aarch64
-O3
armv8-a clang 21.1.0
reverse: cbz w0, .LBB0_7 mov w9, #26215 mov w11, #52429 mov w8, w0 mov w0, wzr movk w9, #26214, lsl #16 mov w10, #10 movk w11, #52428, lsl #16 b .LBB0_4 .LBB0_2: eor w14, w13, #0x80000000 umul...