index
int64
0
66.5k
func_name
stringlengths
2
5.36k
func_dep
stringlengths
16
2.19k
func
stringlengths
8
55.3k
test
stringlengths
0
7.07k
opt
stringclasses
4 values
language
stringclasses
2 values
asm
stringlengths
0
45.4k
ida_asm
stringlengths
0
44.7k
ida_pseudo
stringlengths
0
44.3k
ghidra_asm
stringlengths
0
49.1k
ghidra_pseudo
stringlengths
0
64.7k
5,582
func0
#include <assert.h> #include <math.h>
double func0(int n) { double sum = 0; for (int i = 1; i <= n; i++) { sum += i * i * i; } return round(sum / n * 1000000) / 1000000; }
int main() { assert(func0(2) == 4.5); assert(func0(3) == 12); assert(func0(1) == 1); return 0; }
O2
c
func0: endbr64 sub $0x8,%rsp test %edi,%edi jle 1288 <func0+0x68> lea 0x1(%rdi),%ecx mov $0x1,%eax pxor %xmm0,%xmm0 nopl 0x0(%rax,%rax,1) mov %eax,%edx pxor %xmm1,%xmm1 imul %eax,%edx imul %eax,%edx add $0x1,%eax cvtsi2sd %edx,%xmm1 addsd %xmm1,%xmm0 cmp %ecx,%eax jne 1240 <func0+0x20> pxor %xmm1,%xmm1 cvtsi2sd %edi,%xmm1 divsd %xmm1,%xmm0 mulsd 0xe09(%rip),%xmm0 callq 1060 <round@plt> divsd 0xdfc(%rip),%xmm0 add $0x8,%rsp retq nopl 0x0(%rax) pxor %xmm0,%xmm0 jmp 125b <func0+0x3b> xchg %ax,%ax
func0: endbr64 sub rsp, 8 test edi, edi jle short loc_1288 lea ecx, [rdi+1] mov eax, 1 pxor xmm0, xmm0 nop dword ptr [rax+rax+00000000h] loc_1240: mov edx, eax pxor xmm1, xmm1 imul edx, eax imul edx, eax add eax, 1 cvtsi2sd xmm1, edx addsd xmm0, xmm1 cmp eax, ecx jnz short loc_1240 loc_125B: pxor xmm1, xmm1 cvtsi2sd xmm1, edi divsd xmm0, xmm1 mulsd xmm0, cs:qword_2058 call _round divsd xmm0, cs:qword_2058 add rsp, 8 retn loc_1288: pxor xmm0, xmm0 jmp short loc_125B
double func0(int a1) { int v1; // eax double v2; // xmm0_8 int v3; // edx if ( a1 <= 0 ) { v2 = 0.0; } else { v1 = 1; v2 = 0.0; do { v3 = v1 * v1 * v1; ++v1; v2 = v2 + (double)v3; } while ( v1 != a1 + 1 ); } return round(v2 / (double)a1 * 1000000.0) / 1000000.0; }
func0: ENDBR64 SUB RSP,0x8 TEST EDI,EDI JLE 0x00101288 LEA ECX,[RDI + 0x1] MOV EAX,0x1 PXOR XMM0,XMM0 NOP dword ptr [RAX + RAX*0x1] LAB_00101240: MOV EDX,EAX PXOR XMM1,XMM1 IMUL EDX,EAX IMUL EDX,EAX ADD EAX,0x1 CVTSI2SD XMM1,EDX ADDSD XMM0,XMM1 CMP EAX,ECX JNZ 0x00101240 LAB_0010125b: PXOR XMM1,XMM1 CVTSI2SD XMM1,EDI DIVSD XMM0,XMM1 MULSD XMM0,qword ptr [0x00102058] CALL 0x00101060 DIVSD XMM0,qword ptr [0x00102058] ADD RSP,0x8 RET LAB_00101288: PXOR XMM0,XMM0 JMP 0x0010125b
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int param_1) { int iVar1; int iVar2; double dVar3; if (param_1 < 1) { dVar3 = 0.0; } else { iVar1 = 1; dVar3 = 0.0; do { iVar2 = iVar1 * iVar1 * iVar1; iVar1 = iVar1 + 1; dVar3 = dVar3 + (double)iVar2; } while (iVar1 != param_1 + 1); } dVar3 = round((dVar3 / (double)param_1) * _DAT_00102058); return dVar3 / _DAT_00102058; }
5,583
func0
#include <assert.h> #include <math.h>
double func0(int n) { double sum = 0; for (int i = 1; i <= n; i++) { sum += i * i * i; } return round(sum / n * 1000000) / 1000000; }
int main() { assert(func0(2) == 4.5); assert(func0(3) == 12); assert(func0(1) == 1); return 0; }
O3
c
func0: endbr64 sub $0x8,%rsp test %edi,%edi jle 1288 <func0+0x68> lea 0x1(%rdi),%ecx mov $0x1,%eax pxor %xmm0,%xmm0 nopl 0x0(%rax,%rax,1) mov %eax,%edx pxor %xmm1,%xmm1 imul %eax,%edx imul %eax,%edx add $0x1,%eax cvtsi2sd %edx,%xmm1 addsd %xmm1,%xmm0 cmp %ecx,%eax jne 1240 <func0+0x20> pxor %xmm1,%xmm1 cvtsi2sd %edi,%xmm1 divsd %xmm1,%xmm0 mulsd 0xe09(%rip),%xmm0 callq 1060 <round@plt> divsd 0xdfc(%rip),%xmm0 add $0x8,%rsp retq nopl 0x0(%rax) pxor %xmm0,%xmm0 jmp 125b <func0+0x3b> xchg %ax,%ax
func0: endbr64 sub rsp, 8 test edi, edi jle short loc_1288 lea ecx, [rdi+1] mov eax, 1 pxor xmm0, xmm0 nop dword ptr [rax+rax+00000000h] loc_1240: mov edx, eax pxor xmm1, xmm1 imul edx, eax imul edx, eax add eax, 1 cvtsi2sd xmm1, edx addsd xmm0, xmm1 cmp eax, ecx jnz short loc_1240 loc_125B: pxor xmm1, xmm1 cvtsi2sd xmm1, edi divsd xmm0, xmm1 mulsd xmm0, cs:qword_2058; x call _round divsd xmm0, cs:qword_2058 add rsp, 8 retn loc_1288: pxor xmm0, xmm0 jmp short loc_125B
double func0(int a1) { int v1; // eax double v2; // xmm0_8 int v3; // edx if ( a1 <= 0 ) { v2 = 0.0; } else { v1 = 1; v2 = 0.0; do { v3 = v1 * v1 * v1; ++v1; v2 = v2 + (double)v3; } while ( v1 != a1 + 1 ); } return round(v2 / (double)a1 * 1000000.0) / 1000000.0; }
func0: ENDBR64 SUB RSP,0x8 TEST EDI,EDI JLE 0x00101288 LEA ECX,[RDI + 0x1] MOV EAX,0x1 PXOR XMM0,XMM0 NOP dword ptr [RAX + RAX*0x1] LAB_00101240: MOV EDX,EAX PXOR XMM1,XMM1 IMUL EDX,EAX IMUL EDX,EAX ADD EAX,0x1 CVTSI2SD XMM1,EDX ADDSD XMM0,XMM1 CMP EAX,ECX JNZ 0x00101240 LAB_0010125b: PXOR XMM1,XMM1 CVTSI2SD XMM1,EDI DIVSD XMM0,XMM1 MULSD XMM0,qword ptr [0x00102058] CALL 0x00101060 DIVSD XMM0,qword ptr [0x00102058] ADD RSP,0x8 RET LAB_00101288: PXOR XMM0,XMM0 JMP 0x0010125b
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int param_1) { int iVar1; int iVar2; double dVar3; if (param_1 < 1) { dVar3 = 0.0; } else { iVar1 = 1; dVar3 = 0.0; do { iVar2 = iVar1 * iVar1 * iVar1; iVar1 = iVar1 + 1; dVar3 = dVar3 + (double)iVar2; } while (iVar1 != param_1 + 1); } dVar3 = round((dVar3 / (double)param_1) * _DAT_00102058); return dVar3 / _DAT_00102058; }
5,584
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> int max_three(int a, int b, int c) { int m = a > b ? a : b; return m > c ? m : c; }
int func0(int** gold, int m, int n) { // Allocate goldTable int** goldTable = (int**)malloc(m * sizeof(int*)); for(int i = 0; i < m; i++) { goldTable[i] = (int*)calloc(n, sizeof(int)); } for(int col = n-1; col >=0; col--) { for(int row = 0; row < m; row++) { int right = (col == n-1) ? 0 : goldTable[row][col+1]; int right_up = (row ==0 || col == n-1) ? 0 : goldTable[row-1][col+1]; int right_down = (row == m-1 || col == n-1) ? 0 : goldTable[row+1][col+1]; goldTable[row][col] = gold[row][col] + max_three(right, right_up, right_down); } } int res = goldTable[0][0]; for(int i =1; i < m; i++) { if(goldTable[i][0] > res) res = goldTable[i][0]; } // Free goldTable for(int i =0; i < m; i++) free(goldTable[i]); free(goldTable); return res; }
int main() { // Test case 1 int gold1_data[4][4] = { {1, 3, 1, 5}, {2, 2, 4, 1}, {5, 0, 2, 3}, {0, 6, 1, 2} }; int* gold1[4]; for(int i=0; i <4; i++) gold1[i] = gold1_data[i]; assert(func0(gold1, 4, 4) == 16); // Test case 2 int gold2_data[2][2] = { {10, 20}, {30, 40} }; int* gold2[2]; for(int i=0; i <2; i++) gold2[i] = gold2_data[i]; assert(func0(gold2, 2, 2) == 70); // Test case 3 int gold3_data[2][2] = { {4, 9}, {3, 7} }; int* gold3[2]; for(int i=0; i <2; i++) gold3[i] = gold3_data[i]; assert(func0(gold3, 2, 2) == 13); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x48,%rsp mov %rdi,-0x48(%rbp) mov %esi,-0x4c(%rbp) mov %edx,-0x50(%rbp) mov -0x4c(%rbp),%eax cltq shl $0x3,%rax mov %rax,%rdi callq 10d0 <malloc@plt> mov %rax,-0x18(%rbp) movl $0x0,-0x3c(%rbp) jmp 1257 <func0+0x64> mov -0x50(%rbp),%eax cltq mov -0x3c(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,8),%rcx mov -0x18(%rbp),%rdx lea (%rcx,%rdx,1),%rbx mov $0x4,%esi mov %rax,%rdi callq 10c0 <calloc@plt> mov %rax,(%rbx) addl $0x1,-0x3c(%rbp) mov -0x3c(%rbp),%eax cmp -0x4c(%rbp),%eax jl 1228 <func0+0x35> mov -0x50(%rbp),%eax sub $0x1,%eax mov %eax,-0x38(%rbp) jmpq 13c0 <func0+0x1cd> movl $0x0,-0x34(%rbp) jmpq 13b0 <func0+0x1bd> mov -0x50(%rbp),%eax sub $0x1,%eax cmp %eax,-0x38(%rbp) je 12b0 <func0+0xbd> mov -0x34(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0x38(%rbp),%edx movslq %edx,%rdx add $0x1,%rdx shl $0x2,%rdx add %rdx,%rax mov (%rax),%eax jmp 12b5 <func0+0xc2> mov $0x0,%eax mov %eax,-0x24(%rbp) cmpl $0x0,-0x34(%rbp) je 12f5 <func0+0x102> mov -0x50(%rbp),%eax sub $0x1,%eax cmp %eax,-0x38(%rbp) je 12f5 <func0+0x102> mov -0x34(%rbp),%eax cltq shl $0x3,%rax lea -0x8(%rax),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0x38(%rbp),%edx movslq %edx,%rdx add $0x1,%rdx shl $0x2,%rdx add %rdx,%rax mov (%rax),%eax jmp 12fa <func0+0x107> mov $0x0,%eax mov %eax,-0x20(%rbp) mov -0x4c(%rbp),%eax sub $0x1,%eax cmp %eax,-0x34(%rbp) je 1343 <func0+0x150> mov -0x50(%rbp),%eax sub $0x1,%eax cmp %eax,-0x38(%rbp) je 1343 <func0+0x150> mov -0x34(%rbp),%eax cltq add $0x1,%rax lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0x38(%rbp),%edx movslq %edx,%rdx add $0x1,%rdx shl $0x2,%rdx add %rdx,%rax mov (%rax),%eax jmp 1348 <func0+0x155> mov $0x0,%eax mov %eax,-0x1c(%rbp) mov -0x34(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x48(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0x38(%rbp),%edx movslq %edx,%rdx shl $0x2,%rdx add %rdx,%rax mov (%rax),%ebx mov -0x1c(%rbp),%edx mov -0x20(%rbp),%ecx mov -0x24(%rbp),%eax mov %ecx,%esi mov %eax,%edi callq 11c9 <max_three> mov -0x34(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,8),%rcx mov -0x18(%rbp),%rdx add %rcx,%rdx mov (%rdx),%rdx mov -0x38(%rbp),%ecx movslq %ecx,%rcx shl $0x2,%rcx add %rcx,%rdx add %ebx,%eax mov %eax,(%rdx) addl $0x1,-0x34(%rbp) mov -0x34(%rbp),%eax cmp -0x4c(%rbp),%eax jl 1279 <func0+0x86> subl $0x1,-0x38(%rbp) cmpl $0x0,-0x38(%rbp) jns 126d <func0+0x7a> mov -0x18(%rbp),%rax mov (%rax),%rax mov (%rax),%eax mov %eax,-0x30(%rbp) movl $0x1,-0x2c(%rbp) jmp 141d <func0+0x22a> mov -0x2c(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov (%rax),%eax cmp %eax,-0x30(%rbp) jge 1419 <func0+0x226> mov -0x2c(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov (%rax),%eax mov %eax,-0x30(%rbp) addl $0x1,-0x2c(%rbp) mov -0x2c(%rbp),%eax cmp -0x4c(%rbp),%eax jl 13df <func0+0x1ec> movl $0x0,-0x28(%rbp) jmp 1451 <func0+0x25e> mov -0x28(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov %rax,%rdi callq 1090 <free@plt> addl $0x1,-0x28(%rbp) mov -0x28(%rbp),%eax cmp -0x4c(%rbp),%eax jl 142e <func0+0x23b> mov -0x18(%rbp),%rax mov %rax,%rdi callq 1090 <free@plt> mov -0x30(%rbp),%eax add $0x48,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 48h mov [rbp+var_48], rdi mov [rbp+var_4C], esi mov [rbp+var_50], edx mov eax, [rbp+var_4C] cdqe shl rax, 3 mov rdi, rax; size call _malloc mov [rbp+ptr], rax mov [rbp+var_3C], 0 jmp short loc_1259 loc_122A: mov eax, [rbp+var_50] cdqe mov edx, [rbp+var_3C] movsxd rdx, edx lea rcx, ds:0[rdx*8] mov rdx, [rbp+ptr] lea rbx, [rcx+rdx] mov esi, 4; size mov rdi, rax; nmemb call _calloc mov [rbx], rax add [rbp+var_3C], 1 loc_1259: mov eax, [rbp+var_3C] cmp eax, [rbp+var_4C] jl short loc_122A mov eax, [rbp+var_50] sub eax, 1 mov [rbp+var_38], eax jmp loc_13C2 loc_126F: mov [rbp+var_34], 0 jmp loc_13B2 loc_127B: mov eax, [rbp+var_50] sub eax, 1 cmp [rbp+var_38], eax jz short loc_12B2 mov eax, [rbp+var_34] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rdx mov rax, [rax] mov edx, [rbp+var_38] movsxd rdx, edx add rdx, 1 shl rdx, 2 add rax, rdx mov eax, [rax] jmp short loc_12B7 loc_12B2: mov eax, 0 loc_12B7: mov [rbp+var_24], eax cmp [rbp+var_34], 0 jz short loc_12F7 mov eax, [rbp+var_50] sub eax, 1 cmp [rbp+var_38], eax jz short loc_12F7 mov eax, [rbp+var_34] cdqe shl rax, 3 lea rdx, [rax-8] mov rax, [rbp+ptr] add rax, rdx mov rax, [rax] mov edx, [rbp+var_38] movsxd rdx, edx add rdx, 1 shl rdx, 2 add rax, rdx mov eax, [rax] jmp short loc_12FC loc_12F7: mov eax, 0 loc_12FC: mov [rbp+var_20], eax mov eax, [rbp+var_4C] sub eax, 1 cmp [rbp+var_34], eax jz short loc_1345 mov eax, [rbp+var_50] sub eax, 1 cmp [rbp+var_38], eax jz short loc_1345 mov eax, [rbp+var_34] cdqe add rax, 1 lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rdx mov rax, [rax] mov edx, [rbp+var_38] movsxd rdx, edx add rdx, 1 shl rdx, 2 add rax, rdx mov eax, [rax] jmp short loc_134A loc_1345: mov eax, 0 loc_134A: mov [rbp+var_1C], eax mov eax, [rbp+var_34] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_48] add rax, rdx mov rax, [rax] mov edx, [rbp+var_38] movsxd rdx, edx shl rdx, 2 add rax, rdx mov ebx, [rax] mov edx, [rbp+var_1C] mov ecx, [rbp+var_20] mov eax, [rbp+var_24] mov esi, ecx mov edi, eax call max_three mov edx, [rbp+var_34] movsxd rdx, edx lea rcx, ds:0[rdx*8] mov rdx, [rbp+ptr] add rdx, rcx mov rdx, [rdx] mov ecx, [rbp+var_38] movsxd rcx, ecx shl rcx, 2 add rdx, rcx add eax, ebx mov [rdx], eax add [rbp+var_34], 1 loc_13B2: mov eax, [rbp+var_34] cmp eax, [rbp+var_4C] jl loc_127B sub [rbp+var_38], 1 loc_13C2: cmp [rbp+var_38], 0 jns loc_126F mov rax, [rbp+ptr] mov rax, [rax] mov eax, [rax] mov [rbp+var_30], eax mov [rbp+var_2C], 1 jmp short loc_141F loc_13E1: mov eax, [rbp+var_2C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rdx mov rax, [rax] mov eax, [rax] cmp [rbp+var_30], eax jge short loc_141B mov eax, [rbp+var_2C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rdx mov rax, [rax] mov eax, [rax] mov [rbp+var_30], eax loc_141B: add [rbp+var_2C], 1 loc_141F: mov eax, [rbp+var_2C] cmp eax, [rbp+var_4C] jl short loc_13E1 mov [rbp+var_28], 0 jmp short loc_1453 loc_1430: mov eax, [rbp+var_28] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rdx mov rax, [rax] mov rdi, rax; ptr call _free add [rbp+var_28], 1 loc_1453: mov eax, [rbp+var_28] cmp eax, [rbp+var_4C] jl short loc_1430 mov rax, [rbp+ptr] mov rdi, rax; ptr call _free mov eax, [rbp+var_30] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, int a2, int a3) { unsigned int v3; // eax unsigned int v4; // eax unsigned int v5; // eax int v6; // ebx int i; // [rsp+14h] [rbp-3Ch] int j; // [rsp+18h] [rbp-38h] int k; // [rsp+1Ch] [rbp-34h] unsigned int v12; // [rsp+20h] [rbp-30h] int m; // [rsp+24h] [rbp-2Ch] int n; // [rsp+28h] [rbp-28h] unsigned int v15; // [rsp+2Ch] [rbp-24h] unsigned int v16; // [rsp+30h] [rbp-20h] unsigned int **ptr; // [rsp+38h] [rbp-18h] ptr = (unsigned int **)malloc(8LL * a2); for ( i = 0; i < a2; ++i ) ptr[i] = (unsigned int *)calloc(a3, 4uLL); for ( j = a3 - 1; j >= 0; --j ) { for ( k = 0; k < a2; ++k ) { if ( j == a3 - 1 ) v3 = 0; else v3 = ptr[k][j + 1]; v15 = v3; if ( !k || j == a3 - 1 ) v4 = 0; else v4 = ptr[k - 1][j + 1]; v16 = v4; if ( k == a2 - 1 || j == a3 - 1 ) v5 = 0; else v5 = ptr[k + 1][j + 1]; v6 = *(_DWORD *)(4LL * j + *(_QWORD *)(8LL * k + a1)); ptr[k][j] = v6 + max_three(v15, v16, v5); } } v12 = **ptr; for ( m = 1; m < a2; ++m ) { if ( (int)v12 < (int)*ptr[m] ) v12 = *ptr[m]; } for ( n = 0; n < a2; ++n ) free(ptr[n]); free(ptr); return v12; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x48 MOV qword ptr [RBP + -0x48],RDI MOV dword ptr [RBP + -0x4c],ESI MOV dword ptr [RBP + -0x50],EDX MOV EAX,dword ptr [RBP + -0x4c] CDQE SHL RAX,0x3 MOV RDI,RAX CALL 0x001010d0 MOV qword ptr [RBP + -0x18],RAX MOV dword ptr [RBP + -0x3c],0x0 JMP 0x00101259 LAB_0010122a: MOV EAX,dword ptr [RBP + -0x50] CDQE MOV EDX,dword ptr [RBP + -0x3c] MOVSXD RDX,EDX LEA RCX,[RDX*0x8] MOV RDX,qword ptr [RBP + -0x18] LEA RBX,[RCX + RDX*0x1] MOV ESI,0x4 MOV RDI,RAX CALL 0x001010c0 MOV qword ptr [RBX],RAX ADD dword ptr [RBP + -0x3c],0x1 LAB_00101259: MOV EAX,dword ptr [RBP + -0x3c] CMP EAX,dword ptr [RBP + -0x4c] JL 0x0010122a MOV EAX,dword ptr [RBP + -0x50] SUB EAX,0x1 MOV dword ptr [RBP + -0x38],EAX JMP 0x001013c2 LAB_0010126f: MOV dword ptr [RBP + -0x34],0x0 JMP 0x001013b2 LAB_0010127b: MOV EAX,dword ptr [RBP + -0x50] SUB EAX,0x1 CMP dword ptr [RBP + -0x38],EAX JZ 0x001012b2 MOV EAX,dword ptr [RBP + -0x34] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0x38] MOVSXD RDX,EDX ADD RDX,0x1 SHL RDX,0x2 ADD RAX,RDX MOV EAX,dword ptr [RAX] JMP 0x001012b7 LAB_001012b2: MOV EAX,0x0 LAB_001012b7: MOV dword ptr [RBP + -0x24],EAX CMP dword ptr [RBP + -0x34],0x0 JZ 0x001012f7 MOV EAX,dword ptr [RBP + -0x50] SUB EAX,0x1 CMP dword ptr [RBP + -0x38],EAX JZ 0x001012f7 MOV EAX,dword ptr [RBP + -0x34] CDQE SHL RAX,0x3 LEA RDX,[RAX + -0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0x38] MOVSXD RDX,EDX ADD RDX,0x1 SHL RDX,0x2 ADD RAX,RDX MOV EAX,dword ptr [RAX] JMP 0x001012fc LAB_001012f7: MOV EAX,0x0 LAB_001012fc: MOV dword ptr [RBP + -0x20],EAX MOV EAX,dword ptr [RBP + -0x4c] SUB EAX,0x1 CMP dword ptr [RBP + -0x34],EAX JZ 0x00101345 MOV EAX,dword ptr [RBP + -0x50] SUB EAX,0x1 CMP dword ptr [RBP + -0x38],EAX JZ 0x00101345 MOV EAX,dword ptr [RBP + -0x34] CDQE ADD RAX,0x1 LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0x38] MOVSXD RDX,EDX ADD RDX,0x1 SHL RDX,0x2 ADD RAX,RDX MOV EAX,dword ptr [RAX] JMP 0x0010134a LAB_00101345: MOV EAX,0x0 LAB_0010134a: MOV dword ptr [RBP + -0x1c],EAX MOV EAX,dword ptr [RBP + -0x34] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x48] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0x38] MOVSXD RDX,EDX SHL RDX,0x2 ADD RAX,RDX MOV EBX,dword ptr [RAX] MOV EDX,dword ptr [RBP + -0x1c] MOV ECX,dword ptr [RBP + -0x20] MOV EAX,dword ptr [RBP + -0x24] MOV ESI,ECX MOV EDI,EAX CALL 0x001011c9 MOV EDX,dword ptr [RBP + -0x34] MOVSXD RDX,EDX LEA RCX,[RDX*0x8] MOV RDX,qword ptr [RBP + -0x18] ADD RDX,RCX MOV RDX,qword ptr [RDX] MOV ECX,dword ptr [RBP + -0x38] MOVSXD RCX,ECX SHL RCX,0x2 ADD RDX,RCX ADD EAX,EBX MOV dword ptr [RDX],EAX ADD dword ptr [RBP + -0x34],0x1 LAB_001013b2: MOV EAX,dword ptr [RBP + -0x34] CMP EAX,dword ptr [RBP + -0x4c] JL 0x0010127b SUB dword ptr [RBP + -0x38],0x1 LAB_001013c2: CMP dword ptr [RBP + -0x38],0x0 JNS 0x0010126f MOV RAX,qword ptr [RBP + -0x18] MOV RAX,qword ptr [RAX] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x30],EAX MOV dword ptr [RBP + -0x2c],0x1 JMP 0x0010141f LAB_001013e1: MOV EAX,dword ptr [RBP + -0x2c] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x30],EAX JGE 0x0010141b MOV EAX,dword ptr [RBP + -0x2c] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x30],EAX LAB_0010141b: ADD dword ptr [RBP + -0x2c],0x1 LAB_0010141f: MOV EAX,dword ptr [RBP + -0x2c] CMP EAX,dword ptr [RBP + -0x4c] JL 0x001013e1 MOV dword ptr [RBP + -0x28],0x0 JMP 0x00101453 LAB_00101430: MOV EAX,dword ptr [RBP + -0x28] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV RDI,RAX CALL 0x00101090 ADD dword ptr [RBP + -0x28],0x1 LAB_00101453: MOV EAX,dword ptr [RBP + -0x28] CMP EAX,dword ptr [RBP + -0x4c] JL 0x00101430 MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101090 MOV EAX,dword ptr [RBP + -0x30] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int func0(long param_1,int param_2,int param_3) { int iVar1; int4 uVar2; int4 uVar3; int4 uVar4; int iVar5; int8 *__ptr; void *pvVar6; int local_44; int local_40; int local_3c; int local_38; int local_34; int local_30; __ptr = (int8 *)malloc((long)param_2 << 3); for (local_44 = 0; local_44 < param_2; local_44 = local_44 + 1) { pvVar6 = calloc((long)param_3,4); __ptr[local_44] = pvVar6; } for (local_40 = param_3 + -1; -1 < local_40; local_40 = local_40 + -1) { for (local_3c = 0; local_3c < param_2; local_3c = local_3c + 1) { if (local_40 == param_3 + -1) { uVar2 = 0; } else { uVar2 = *(int4 *)(__ptr[local_3c] + ((long)local_40 + 1) * 4); } if ((local_3c == 0) || (local_40 == param_3 + -1)) { uVar3 = 0; } else { uVar3 = *(int4 *)(__ptr[(long)local_3c + -1] + ((long)local_40 + 1) * 4); } if ((local_3c == param_2 + -1) || (local_40 == param_3 + -1)) { uVar4 = 0; } else { uVar4 = *(int4 *)(__ptr[(long)local_3c + 1] + ((long)local_40 + 1) * 4); } iVar1 = *(int *)(*(long *)(param_1 + (long)local_3c * 8) + (long)local_40 * 4); iVar5 = max_three(uVar2,uVar3,uVar4); *(int *)(__ptr[local_3c] + (long)local_40 * 4) = iVar5 + iVar1; } } local_38 = *(int *)*__ptr; for (local_34 = 1; local_34 < param_2; local_34 = local_34 + 1) { if (local_38 < *(int *)__ptr[local_34]) { local_38 = *(int *)__ptr[local_34]; } } for (local_30 = 0; local_30 < param_2; local_30 = local_30 + 1) { free((void *)__ptr[local_30]); } free(__ptr); return local_38; }
5,585
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> int max_three(int a, int b, int c) { int m = a > b ? a : b; return m > c ? m : c; }
int func0(int** gold, int m, int n) { // Allocate goldTable int** goldTable = (int**)malloc(m * sizeof(int*)); for(int i = 0; i < m; i++) { goldTable[i] = (int*)calloc(n, sizeof(int)); } for(int col = n-1; col >=0; col--) { for(int row = 0; row < m; row++) { int right = (col == n-1) ? 0 : goldTable[row][col+1]; int right_up = (row ==0 || col == n-1) ? 0 : goldTable[row-1][col+1]; int right_down = (row == m-1 || col == n-1) ? 0 : goldTable[row+1][col+1]; goldTable[row][col] = gold[row][col] + max_three(right, right_up, right_down); } } int res = goldTable[0][0]; for(int i =1; i < m; i++) { if(goldTable[i][0] > res) res = goldTable[i][0]; } // Free goldTable for(int i =0; i < m; i++) free(goldTable[i]); free(goldTable); return res; }
int main() { // Test case 1 int gold1_data[4][4] = { {1, 3, 1, 5}, {2, 2, 4, 1}, {5, 0, 2, 3}, {0, 6, 1, 2} }; int* gold1[4]; for(int i=0; i <4; i++) gold1[i] = gold1_data[i]; assert(func0(gold1, 4, 4) == 16); // Test case 2 int gold2_data[2][2] = { {10, 20}, {30, 40} }; int* gold2[2]; for(int i=0; i <2; i++) gold2[i] = gold2_data[i]; assert(func0(gold2, 2, 2) == 70); // Test case 3 int gold3_data[2][2] = { {4, 9}, {3, 7} }; int* gold3[2]; for(int i=0; i <2; i++) gold3[i] = gold3_data[i]; assert(func0(gold3, 2, 2) == 13); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov %rdi,%rbp mov %esi,%r13d mov %edx,%r14d mov %edx,0xc(%rsp) movslq %esi,%rdi shl $0x3,%rdi callq 10d0 <malloc@plt> mov %rax,%rbx test %r13d,%r13d jle 1236 <func0+0x5c> mov %rax,%r12 lea -0x1(%r13),%eax lea 0x8(%rbx,%rax,8),%r15 movslq %r14d,%r14 mov $0x4,%esi mov %r14,%rdi callq 10c0 <calloc@plt> mov %rax,(%r12) add $0x8,%r12 cmp %r15,%r12 jne 121c <func0+0x42> mov 0xc(%rsp),%r11d sub $0x1,%r11d js 12e2 <func0+0x108> movslq %r11d,%rax lea 0x4(,%rax,4),%rdi mov %r11d,%r10d lea -0x1(%r13),%r14d mov %r14d,%r12d mov $0x0,%r15d mov $0x0,%r9d jmp 12d4 <func0+0xfa> mov %r9d,%ecx cmp %edx,%r14d je 1278 <func0+0x9e> mov 0x8(%rbx,%rdx,8),%rcx mov (%rcx,%rdi,1),%ecx cmp %esi,%eax cmovl %esi,%eax cmp %ecx,%eax cmovl %ecx,%eax mov 0x0(%rbp,%rdx,8),%rsi add (%rsi,%r8,1),%eax mov (%rbx,%rdx,8),%rcx mov %eax,(%rcx,%r8,1) lea 0x1(%rdx),%rax cmp %r12,%rdx je 12c6 <func0+0xec> mov %rax,%rdx cmp %r10d,%r11d je 12bb <func0+0xe1> mov (%rbx,%rdx,8),%rax mov (%rax,%rdi,1),%esi mov %edx,%eax test %edx,%edx je 1268 <func0+0x8e> mov -0x8(%rbx,%rdx,8),%rax mov (%rax,%rdi,1),%eax jmp 1268 <func0+0x8e> mov %r9d,%esi mov %r9d,%eax mov %r9d,%ecx jmp 1278 <func0+0x9e> sub $0x1,%r10d sub $0x4,%rdi cmp $0xffffffff,%r10d je 12e2 <func0+0x108> lea -0x4(%rdi),%r8 mov %r15,%rdx test %r13d,%r13d jg 129f <func0+0xc5> jmp 12c6 <func0+0xec> mov (%rbx),%rax mov (%rax),%r12d cmp $0x1,%r13d jle 1341 <func0+0x167> lea 0x8(%rbx),%rax lea -0x2(%r13),%edx lea 0x10(%rbx,%rdx,8),%rcx mov (%rax),%rdx mov (%rdx),%edx cmp %edx,%r12d cmovl %edx,%r12d add $0x8,%rax cmp %rax,%rcx jne 12fb <func0+0x121> mov $0x0,%ebp mov (%rbx,%rbp,8),%rdi callq 1090 <free@plt> add $0x1,%rbp cmp %ebp,%r13d jg 1315 <func0+0x13b> mov %rbx,%rdi callq 1090 <free@plt> mov %r12d,%eax add $0x18,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq jne 1327 <func0+0x14d> mov (%rbx),%rdi callq 1090 <free@plt> jmp 1327 <func0+0x14d>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 18h mov rbp, rdi mov r13d, esi mov r14d, edx mov [rsp+48h+var_3C], edx movsxd rdi, esi shl rdi, 3 call _malloc mov rbx, rax test r13d, r13d jle short loc_1234 mov r12, rax mov eax, r13d lea r15, [rbx+rax*8] movsxd r14, r14d loc_121A: mov esi, 4 mov rdi, r14 call _calloc mov [r12], rax add r12, 8 cmp r12, r15 jnz short loc_121A loc_1234: mov eax, [rsp+48h+var_3C] mov r12d, eax sub r12d, 1 js loc_12D7 movsxd rdi, eax shl rdi, 2 mov r11d, r12d mov r14d, r13d mov r10d, 0 lea r15d, [r13-1] jmp short loc_12C7 loc_125E: mov ecx, r10d cmp r15d, edx jz short loc_126E mov rcx, [rbx+rdx*8+8] mov ecx, [rcx+rdi] loc_126E: mov r9, [rbp+rdx*8+0] cmp eax, esi cmovl eax, esi cmp eax, ecx cmovl eax, ecx add eax, [r9+r8] mov rsi, [rbx+rdx*8] mov [rsi+r8], eax add rdx, 1 cmp rdx, r14 jz short loc_12B9 loc_1292: cmp r12d, r11d jz short loc_12AE mov rax, [rbx+rdx*8] mov esi, [rax+rdi] mov eax, edx test edx, edx jz short loc_125E mov rax, [rbx+rdx*8-8] mov eax, [rax+rdi] jmp short loc_125E loc_12AE: mov esi, r10d mov eax, r10d mov ecx, r10d jmp short loc_126E loc_12B9: sub r11d, 1 sub rdi, 4 cmp r11d, 0FFFFFFFFh jz short loc_12D7 loc_12C7: lea r8, [rdi-4] mov edx, 0 test r13d, r13d jg short loc_1292 jmp short loc_12B9 loc_12D7: mov rax, [rbx] mov r12d, [rax] cmp r13d, 1 jle short loc_1336 lea rax, [rbx+8] lea edx, [r13-2] lea rcx, [rbx+rdx*8+10h] loc_12F0: mov rdx, [rax] mov edx, [rdx] cmp r12d, edx cmovl r12d, edx add rax, 8 cmp rcx, rax jnz short loc_12F0 mov ebp, 0 loc_130A: mov rdi, [rbx+rbp*8] call _free add rbp, 1 cmp r13d, ebp jg short loc_130A loc_131C: mov rdi, rbx call _free mov eax, r12d add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1336: jnz short loc_131C mov rdi, [rbx] call _free jmp short loc_131C
long long func0(long long a1, int a2, int a3) { long long v6; // rax unsigned int **v7; // rbx unsigned int **v8; // r12 long long v9; // rdi int v10; // r11d int v11; // ecx int v12; // eax long long v13; // rdx int v14; // esi unsigned int v15; // r12d unsigned int **v16; // rax long long v17; // rbp v6 = malloc(8LL * a2); v7 = (unsigned int **)v6; if ( a2 > 0 ) { v8 = (unsigned int **)v6; do *v8++ = (unsigned int *)calloc(a3, 4LL); while ( v8 != &v7[a2] ); } if ( a3 - 1 >= 0 ) { v9 = a3; v10 = a3 - 1; do { v13 = 0LL; if ( a2 > 0 ) { do { if ( a3 - 1 == v10 ) { v14 = 0; v12 = 0; v11 = 0; } else { v14 = v7[v13][v9]; v12 = v13; if ( (_DWORD)v13 ) v12 = v7[v13 - 1][v9]; v11 = 0; if ( a2 - 1 != (_DWORD)v13 ) v11 = v7[v13 + 1][v9]; } if ( v12 < v14 ) v12 = v14; if ( v12 < v11 ) v12 = v11; v7[v13][v9 - 1] = *(_DWORD *)(*(_QWORD *)(a1 + 8 * v13) + v9 * 4 - 4) + v12; ++v13; } while ( v13 != a2 ); } --v10; --v9; } while ( v10 != -1 ); } v15 = **v7; if ( a2 <= 1 ) { if ( a2 == 1 ) free(*v7); } else { v16 = v7 + 1; do { if ( (int)v15 < (int)**v16 ) v15 = **v16; ++v16; } while ( &v7[(unsigned int)(a2 - 2) + 2] != v16 ); v17 = 0LL; do free(v7[v17++]); while ( a2 > (int)v17 ); } free(v7); return v15; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV RBP,RDI MOV R13D,ESI MOV R14D,EDX MOV dword ptr [RSP + 0xc],EDX MOVSXD RDI,ESI SHL RDI,0x3 CALL 0x001010d0 MOV RBX,RAX TEST R13D,R13D JLE 0x00101234 MOV R12,RAX MOV EAX,R13D LEA R15,[RBX + RAX*0x8] MOVSXD R14,R14D LAB_0010121a: MOV ESI,0x4 MOV RDI,R14 CALL 0x001010c0 MOV qword ptr [R12],RAX ADD R12,0x8 CMP R12,R15 JNZ 0x0010121a LAB_00101234: MOV EAX,dword ptr [RSP + 0xc] MOV R12D,EAX SUB R12D,0x1 JS 0x001012d7 MOVSXD RDI,EAX SHL RDI,0x2 MOV R11D,R12D MOV R14D,R13D MOV R10D,0x0 LEA R15D,[R13 + -0x1] JMP 0x001012c7 LAB_0010125e: MOV ECX,R10D CMP R15D,EDX JZ 0x0010126e MOV RCX,qword ptr [RBX + RDX*0x8 + 0x8] MOV ECX,dword ptr [RCX + RDI*0x1] LAB_0010126e: MOV R9,qword ptr [RBP + RDX*0x8] CMP EAX,ESI CMOVL EAX,ESI CMP EAX,ECX CMOVL EAX,ECX ADD EAX,dword ptr [R9 + R8*0x1] MOV RSI,qword ptr [RBX + RDX*0x8] MOV dword ptr [RSI + R8*0x1],EAX ADD RDX,0x1 CMP RDX,R14 JZ 0x001012b9 LAB_00101292: CMP R12D,R11D JZ 0x001012ae MOV RAX,qword ptr [RBX + RDX*0x8] MOV ESI,dword ptr [RAX + RDI*0x1] MOV EAX,EDX TEST EDX,EDX JZ 0x0010125e MOV RAX,qword ptr [RBX + RDX*0x8 + -0x8] MOV EAX,dword ptr [RAX + RDI*0x1] JMP 0x0010125e LAB_001012ae: MOV ESI,R10D MOV EAX,R10D MOV ECX,R10D JMP 0x0010126e LAB_001012b9: SUB R11D,0x1 SUB RDI,0x4 CMP R11D,-0x1 JZ 0x001012d7 LAB_001012c7: LEA R8,[RDI + -0x4] MOV EDX,0x0 TEST R13D,R13D JG 0x00101292 JMP 0x001012b9 LAB_001012d7: MOV RAX,qword ptr [RBX] MOV R12D,dword ptr [RAX] CMP R13D,0x1 JLE 0x00101336 LEA RAX,[RBX + 0x8] LEA EDX,[R13 + -0x2] LEA RCX,[RBX + RDX*0x8 + 0x10] LAB_001012f0: MOV RDX,qword ptr [RAX] MOV EDX,dword ptr [RDX] CMP R12D,EDX CMOVL R12D,EDX ADD RAX,0x8 CMP RCX,RAX JNZ 0x001012f0 MOV EBP,0x0 LAB_0010130a: MOV RDI,qword ptr [RBX + RBP*0x8] CALL 0x00101090 ADD RBP,0x1 CMP R13D,EBP JG 0x0010130a LAB_0010131c: MOV RDI,RBX CALL 0x00101090 MOV EAX,R12D ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101336: JNZ 0x0010131c MOV RDI,qword ptr [RBX] CALL 0x00101090 JMP 0x0010131c
int func0(long param_1,uint param_2,int param_3) { int iVar1; int8 *__ptr; void *pvVar2; int8 *puVar3; int iVar4; ulong uVar5; int iVar6; long lVar7; int iVar8; int iVar9; int iVar10; __ptr = (int8 *)malloc((long)(int)param_2 << 3); if (0 < (int)param_2) { puVar3 = __ptr; do { pvVar2 = calloc((long)param_3,4); *puVar3 = pvVar2; puVar3 = puVar3 + 1; } while (puVar3 != __ptr + param_2); } iVar10 = param_3 + -1; if (-1 < iVar10) { lVar7 = (long)param_3 << 2; iVar9 = iVar10; do { uVar5 = 0; if (0 < (int)param_2) { do { iVar8 = 0; if (iVar10 == iVar9) { iVar6 = 0; iVar1 = 0; } else { iVar6 = *(int *)(__ptr[uVar5] + lVar7); iVar4 = (int)uVar5; iVar1 = iVar4; if (iVar4 != 0) { iVar1 = *(int *)(__ptr[uVar5 - 1] + lVar7); } iVar8 = 0; if (param_2 - 1 != iVar4) { iVar8 = *(int *)(__ptr[uVar5 + 1] + lVar7); } } if (iVar1 < iVar6) { iVar1 = iVar6; } if (iVar1 < iVar8) { iVar1 = iVar8; } *(int *)(__ptr[uVar5] + lVar7 + -4) = iVar1 + *(int *)(*(long *)(param_1 + uVar5 * 8) + lVar7 + -4); uVar5 = uVar5 + 1; } while (uVar5 != param_2); } iVar9 = iVar9 + -1; lVar7 = lVar7 + -4; } while (iVar9 != -1); } iVar10 = *(int *)*__ptr; if ((int)param_2 < 2) { if (param_2 == 1) { free((void *)*__ptr); } } else { puVar3 = __ptr + 1; do { if (iVar10 < *(int *)*puVar3) { iVar10 = *(int *)*puVar3; } puVar3 = puVar3 + 1; } while (__ptr + (ulong)(param_2 - 2) + 2 != puVar3); lVar7 = 0; do { free((void *)__ptr[lVar7]); lVar7 = lVar7 + 1; } while ((int)lVar7 < (int)param_2); } free(__ptr); return iVar10; }
5,586
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> int max_three(int a, int b, int c) { int m = a > b ? a : b; return m > c ? m : c; }
int func0(int** gold, int m, int n) { // Allocate goldTable int** goldTable = (int**)malloc(m * sizeof(int*)); for(int i = 0; i < m; i++) { goldTable[i] = (int*)calloc(n, sizeof(int)); } for(int col = n-1; col >=0; col--) { for(int row = 0; row < m; row++) { int right = (col == n-1) ? 0 : goldTable[row][col+1]; int right_up = (row ==0 || col == n-1) ? 0 : goldTable[row-1][col+1]; int right_down = (row == m-1 || col == n-1) ? 0 : goldTable[row+1][col+1]; goldTable[row][col] = gold[row][col] + max_three(right, right_up, right_down); } } int res = goldTable[0][0]; for(int i =1; i < m; i++) { if(goldTable[i][0] > res) res = goldTable[i][0]; } // Free goldTable for(int i =0; i < m; i++) free(goldTable[i]); free(goldTable); return res; }
int main() { // Test case 1 int gold1_data[4][4] = { {1, 3, 1, 5}, {2, 2, 4, 1}, {5, 0, 2, 3}, {0, 6, 1, 2} }; int* gold1[4]; for(int i=0; i <4; i++) gold1[i] = gold1_data[i]; assert(func0(gold1, 4, 4) == 16); // Test case 2 int gold2_data[2][2] = { {10, 20}, {30, 40} }; int* gold2[2]; for(int i=0; i <2; i++) gold2[i] = gold2_data[i]; assert(func0(gold2, 2, 2) == 70); // Test case 3 int gold3_data[2][2] = { {4, 9}, {3, 7} }; int* gold3[2]; for(int i=0; i <2; i++) gold3[i] = gold3_data[i]; assert(func0(gold3, 2, 2) == 13); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 mov %rdi,%r12 movslq %esi,%rdi push %rbp push %rbx mov %rdi,%rbx shl $0x3,%rdi sub $0x18,%rsp mov %edx,0xc(%rsp) callq 10d0 <malloc@plt> mov %rax,%rbp test %ebx,%ebx jle 144a <func0+0x5a> mov %rax,%r15 movslq 0xc(%rsp),%r14 lea -0x1(%rbx),%eax lea 0x8(%rbp,%rax,8),%r13 mov $0x4,%esi mov %r14,%rdi add $0x8,%r15 callq 10c0 <calloc@plt> mov %rax,-0x8(%r15) cmp %r13,%r15 jne 1430 <func0+0x40> mov 0xc(%rsp),%r9d sub $0x1,%r9d js 1502 <func0+0x112> movslq %r9d,%rdi lea -0x1(%rbx),%r10d mov %r9d,%r8d shl $0x2,%rdi mov %r10,%r11 nopw 0x0(%rax,%rax,1) lea 0x4(%rdi),%rsi xor %edx,%edx test %ebx,%ebx jg 14c0 <func0+0xd0> jmp 14f0 <func0+0x100> nopl 0x0(%rax) mov -0x8(%rbp,%rdx,8),%r13 cmp %eax,0x0(%r13,%rsi,1) cmovge 0x0(%r13,%rsi,1),%eax xor %r13d,%r13d cmp %edx,%r11d je 14a2 <func0+0xb2> mov 0x8(%rbp,%rdx,8),%r13 mov 0x0(%r13,%rsi,1),%r13d mov (%r12,%rdx,8),%r14 cmp %r13d,%eax cmovl %r13d,%eax add (%r14,%rdi,1),%eax mov %eax,(%rcx,%rdi,1) lea 0x1(%rdx),%rax cmp %rdx,%r10 je 14f0 <func0+0x100> mov %rax,%rdx cmp %r8d,%r9d je 14e0 <func0+0xf0> mov 0x0(%rbp,%rdx,8),%rcx mov (%rcx,%rsi,1),%eax test %edx,%edx jne 1480 <func0+0x90> test %eax,%eax cmovs %edx,%eax jmp 1490 <func0+0xa0> nopl 0x0(%rax,%rax,1) mov 0x0(%rbp,%rdx,8),%rcx xor %eax,%eax xor %r13d,%r13d jmp 14a2 <func0+0xb2> nopl 0x0(%rax) sub $0x1,%r8d sub $0x4,%rdi cmp $0xffffffff,%r8d jne 1470 <func0+0x80> mov 0x0(%rbp),%rdi mov (%rdi),%r13d cmp $0x1,%ebx jle 156d <func0+0x17d> lea -0x2(%rbx),%edx lea 0x8(%rbp),%rax lea 0x10(%rbp,%rdx,8),%rcx nopw 0x0(%rax,%rax,1) mov (%rax),%rdx mov (%rdx),%edx cmp %edx,%r13d cmovl %edx,%r13d add $0x8,%rax cmp %rcx,%rax jne 1520 <func0+0x130> xor %r12d,%r12d jmp 1545 <func0+0x155> nopw 0x0(%rax,%rax,1) mov 0x0(%rbp,%r12,8),%rdi callq 1090 <free@plt> add $0x1,%r12 cmp %r12d,%ebx jg 1540 <func0+0x150> mov %rbp,%rdi callq 1090 <free@plt> add $0x18,%rsp mov %r13d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq jne 1553 <func0+0x163> callq 1090 <free@plt> jmp 1553 <func0+0x163> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r15 movsxd r15, esi push r14 push r13 mov r13, rdi lea rdi, ds:0[r15*8] push r12 push rbp push rbx mov rbx, r15 sub rsp, 18h mov [rsp+48h+var_3C], edx call _malloc mov rbp, rax test r15d, r15d jle short loc_145C mov r12, rax mov eax, r15d movsxd r14, [rsp+48h+var_3C] lea rax, [rbp+rax*8+0] mov [rsp+48h+var_48], rax nop dword ptr [rax+rax+00000000h] loc_1440: mov esi, 4 mov rdi, r14 add r12, 8 call _calloc mov [r12-8], rax cmp [rsp+48h+var_48], r12 jnz short loc_1440 loc_145C: mov r12d, [rsp+48h+var_3C] sub r12d, 1 js loc_1512 movsxd rdi, r12d mov r10d, r12d lea r11d, [rbx-1] shl rdi, 2 nop dword ptr [rax+00000000h] loc_1480: test ebx, ebx jle short loc_1500 lea r9d, [r10+1] xor eax, eax shl r9, 2 jmp short loc_14C8 loc_1490: mov r14, [rbp+rax*8-8] mov r14d, [r14+r9] cmp ecx, r14d cmovl ecx, r14d cmp edx, r11d jz short loc_14EA loc_14A5: mov rdx, [rbp+rax*8+8] mov edx, [rdx+r9] loc_14AE: mov r14, [r13+rax*8+0] cmp edx, ecx cmovl edx, ecx add rax, 1 add edx, [r14+rdi] mov [rsi+rdi], edx cmp r15, rax jz short loc_1500 loc_14C8: mov edx, eax cmp r12d, r10d jz short loc_14F0 mov rsi, [rbp+rax*8+0] mov ecx, [rsi+r9] test eax, eax jnz short loc_1490 xor r14d, r14d test ecx, ecx cmovs ecx, r14d cmp edx, r11d jnz short loc_14A5 loc_14EA: xor edx, edx jmp short loc_14AE loc_14F0: mov rsi, [rbp+rax*8+0] xor ecx, ecx xor edx, edx jmp short loc_14AE loc_1500: sub r10d, 1 sub rdi, 4 cmp r10d, 0FFFFFFFFh jnz loc_1480 loc_1512: mov rdi, [rbp+0] mov r13d, [rdi] cmp ebx, 1 jle short loc_157D lea edx, [rbx-2] lea rax, [rbp+8] lea rcx, [rbp+rdx*8+10h] nop word ptr [rax+rax+00h] loc_1530: mov rdx, [rax] mov edx, [rdx] cmp r13d, edx cmovl r13d, edx add rax, 8 cmp rax, rcx jnz short loc_1530 xor r12d, r12d jmp short loc_1555 loc_1550: mov rdi, [rbp+r12*8+0] loc_1555: call _free add r12, 1 cmp ebx, r12d jg short loc_1550 loc_1563: mov rdi, rbp call _free add rsp, 18h mov eax, r13d pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_157D: jnz short loc_1563 call _free jmp short loc_1563
long long func0(long long a1, int a2, int a3) { long long v3; // r15 long long v6; // rax unsigned int **v7; // rbp unsigned int **v8; // r12 int v9; // r12d int v10; // r10d int v11; // r11d long long v12; // rdi long long v13; // rax int v14; // ecx int v15; // edx long long v16; // r14 unsigned int *v17; // rsi unsigned int v18; // r13d unsigned int **v19; // rax long long v20; // r12 v3 = a2; v6 = malloc(8LL * a2); v7 = (unsigned int **)v6; if ( a2 > 0 ) { v8 = (unsigned int **)v6; do *v8++ = (unsigned int *)calloc(a3, 4LL); while ( &v7[a2] != v8 ); } v9 = a3 - 1; if ( a3 - 1 >= 0 ) { v10 = a3 - 1; v11 = a2 - 1; v12 = v9; while ( a2 <= 0 ) { LABEL_22: --v10; --v12; if ( v10 == -1 ) goto LABEL_23; } v13 = 0LL; while ( 1 ) { if ( v9 == v10 ) { v17 = v7[v13]; v14 = 0; v15 = 0; goto LABEL_12; } v17 = v7[v13]; v14 = v17[v10 + 1]; if ( (_DWORD)v13 ) { if ( v14 < (int)v7[v13 - 1][v10 + 1] ) v14 = v7[v13 - 1][v10 + 1]; if ( (_DWORD)v13 == v11 ) { LABEL_20: v15 = 0; goto LABEL_12; } } else { if ( v14 < 0 ) v14 = 0; if ( (_DWORD)v13 == v11 ) goto LABEL_20; } v15 = v7[v13 + 1][v10 + 1]; LABEL_12: v16 = *(_QWORD *)(a1 + 8 * v13); if ( v15 < v14 ) v15 = v14; ++v13; v17[v12] = *(_DWORD *)(v16 + v12 * 4) + v15; if ( v3 == v13 ) goto LABEL_22; } } LABEL_23: v18 = **v7; if ( a2 <= 1 ) { if ( a2 == 1 ) ((void (*)(void))free)(); } else { v19 = v7 + 1; do { if ( (int)v18 < (int)**v19 ) v18 = **v19; ++v19; } while ( v19 != &v7[(unsigned int)(a2 - 2) + 2] ); v20 = 0LL; do { ((void (*)(void))free)(); ++v20; } while ( a2 > (int)v20 ); } free(v7); return v18; }
func0: ENDBR64 PUSH R15 MOVSXD R15,ESI PUSH R14 PUSH R13 MOV R13,RDI LEA RDI,[R15*0x8] PUSH R12 PUSH RBP PUSH RBX MOV RBX,R15 SUB RSP,0x18 MOV dword ptr [RSP + 0xc],EDX CALL 0x001010d0 MOV RBP,RAX TEST R15D,R15D JLE 0x0010145c MOV R12,RAX MOV EAX,R15D MOVSXD R14,dword ptr [RSP + 0xc] LEA RAX,[RBP + RAX*0x8] MOV qword ptr [RSP],RAX NOP dword ptr [RAX + RAX*0x1] LAB_00101440: MOV ESI,0x4 MOV RDI,R14 ADD R12,0x8 CALL 0x001010c0 MOV qword ptr [R12 + -0x8],RAX CMP qword ptr [RSP],R12 JNZ 0x00101440 LAB_0010145c: MOV R12D,dword ptr [RSP + 0xc] SUB R12D,0x1 JS 0x00101512 MOVSXD RDI,R12D MOV R10D,R12D LEA R11D,[RBX + -0x1] SHL RDI,0x2 NOP dword ptr [RAX] LAB_00101480: TEST EBX,EBX JLE 0x00101500 LEA R9D,[R10 + 0x1] XOR EAX,EAX SHL R9,0x2 JMP 0x001014c8 LAB_00101490: MOV R14,qword ptr [RBP + RAX*0x8 + -0x8] MOV R14D,dword ptr [R14 + R9*0x1] CMP ECX,R14D CMOVL ECX,R14D CMP EDX,R11D JZ 0x001014ea LAB_001014a5: MOV RDX,qword ptr [RBP + RAX*0x8 + 0x8] MOV EDX,dword ptr [RDX + R9*0x1] LAB_001014ae: MOV R14,qword ptr [R13 + RAX*0x8] CMP EDX,ECX CMOVL EDX,ECX ADD RAX,0x1 ADD EDX,dword ptr [R14 + RDI*0x1] MOV dword ptr [RSI + RDI*0x1],EDX CMP R15,RAX JZ 0x00101500 LAB_001014c8: MOV EDX,EAX CMP R12D,R10D JZ 0x001014f0 MOV RSI,qword ptr [RBP + RAX*0x8] MOV ECX,dword ptr [RSI + R9*0x1] TEST EAX,EAX JNZ 0x00101490 XOR R14D,R14D TEST ECX,ECX CMOVS ECX,R14D CMP EDX,R11D JNZ 0x001014a5 LAB_001014ea: XOR EDX,EDX JMP 0x001014ae LAB_001014f0: MOV RSI,qword ptr [RBP + RAX*0x8] XOR ECX,ECX XOR EDX,EDX JMP 0x001014ae LAB_00101500: SUB R10D,0x1 SUB RDI,0x4 CMP R10D,-0x1 JNZ 0x00101480 LAB_00101512: MOV RDI,qword ptr [RBP] MOV R13D,dword ptr [RDI] CMP EBX,0x1 JLE 0x0010157d LEA EDX,[RBX + -0x2] LEA RAX,[RBP + 0x8] LEA RCX,[RBP + RDX*0x8 + 0x10] NOP word ptr [RAX + RAX*0x1] LAB_00101530: MOV RDX,qword ptr [RAX] MOV EDX,dword ptr [RDX] CMP R13D,EDX CMOVL R13D,EDX ADD RAX,0x8 CMP RAX,RCX JNZ 0x00101530 XOR R12D,R12D JMP 0x00101555 LAB_00101550: MOV RDI,qword ptr [RBP + R12*0x8] LAB_00101555: CALL 0x00101090 ADD R12,0x1 CMP EBX,R12D JG 0x00101550 LAB_00101563: MOV RDI,RBP CALL 0x00101090 ADD RSP,0x18 MOV EAX,R13D POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010157d: JNZ 0x00101563 CALL 0x00101090 JMP 0x00101563
int func0(long param_1,uint param_2,int param_3) { long lVar1; int8 *__ptr; void *pvVar2; long lVar3; int8 *puVar4; int iVar5; int iVar6; long lVar7; long lVar8; int *__ptr_00; long lVar9; int iVar10; int8 *puVar11; __ptr = (int8 *)malloc((long)(int)param_2 * 8); if (0 < (int)param_2) { puVar4 = __ptr; do { puVar11 = puVar4 + 1; pvVar2 = calloc((long)param_3,4); *puVar4 = pvVar2; puVar4 = puVar11; } while (__ptr + param_2 != puVar11); } param_3 = param_3 + -1; if (-1 < param_3) { lVar8 = (long)param_3 << 2; iVar10 = param_3; do { if (0 < (int)param_2) { lVar3 = 0; lVar9 = (ulong)(iVar10 + 1) * 4; do { if (param_3 == iVar10) { lVar7 = __ptr[lVar3]; iVar5 = 0; iVar6 = 0; } else { lVar7 = __ptr[lVar3]; iVar5 = *(int *)(lVar7 + lVar9); if ((int)lVar3 == 0) { if (iVar5 < 0) { iVar5 = 0; } if (param_2 != 1) { LAB_001014a5: iVar6 = *(int *)(__ptr[lVar3 + 1] + lVar9); goto LAB_001014ae; } } else { if (iVar5 < *(int *)(__ptr[lVar3 + -1] + lVar9)) { iVar5 = *(int *)(__ptr[lVar3 + -1] + lVar9); } if ((int)lVar3 != param_2 - 1) goto LAB_001014a5; } iVar6 = 0; } LAB_001014ae: lVar1 = lVar3 * 8; if (iVar6 < iVar5) { iVar6 = iVar5; } lVar3 = lVar3 + 1; *(int *)(lVar7 + lVar8) = iVar6 + *(int *)(*(long *)(param_1 + lVar1) + lVar8); } while ((int)param_2 != lVar3); } iVar10 = iVar10 + -1; lVar8 = lVar8 + -4; } while (iVar10 != -1); } __ptr_00 = (int *)*__ptr; iVar10 = *__ptr_00; if ((int)param_2 < 2) { if (param_2 == 1) { free(__ptr_00); } } else { puVar4 = __ptr + 1; do { if (iVar10 < *(int *)*puVar4) { iVar10 = *(int *)*puVar4; } puVar4 = puVar4 + 1; } while (puVar4 != __ptr + (ulong)(param_2 - 2) + 2); lVar8 = 0; while( true ) { free(__ptr_00); lVar8 = lVar8 + 1; if ((int)param_2 <= (int)lVar8) break; __ptr_00 = (int *)__ptr[lVar8]; } } free(__ptr); return iVar10; }
5,587
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> int max_three(int a, int b, int c) { int m = a > b ? a : b; return m > c ? m : c; }
int func0(int** gold, int m, int n) { // Allocate goldTable int** goldTable = (int**)malloc(m * sizeof(int*)); for(int i = 0; i < m; i++) { goldTable[i] = (int*)calloc(n, sizeof(int)); } for(int col = n-1; col >=0; col--) { for(int row = 0; row < m; row++) { int right = (col == n-1) ? 0 : goldTable[row][col+1]; int right_up = (row ==0 || col == n-1) ? 0 : goldTable[row-1][col+1]; int right_down = (row == m-1 || col == n-1) ? 0 : goldTable[row+1][col+1]; goldTable[row][col] = gold[row][col] + max_three(right, right_up, right_down); } } int res = goldTable[0][0]; for(int i =1; i < m; i++) { if(goldTable[i][0] > res) res = goldTable[i][0]; } // Free goldTable for(int i =0; i < m; i++) free(goldTable[i]); free(goldTable); return res; }
int main() { // Test case 1 int gold1_data[4][4] = { {1, 3, 1, 5}, {2, 2, 4, 1}, {5, 0, 2, 3}, {0, 6, 1, 2} }; int* gold1[4]; for(int i=0; i <4; i++) gold1[i] = gold1_data[i]; assert(func0(gold1, 4, 4) == 16); // Test case 2 int gold2_data[2][2] = { {10, 20}, {30, 40} }; int* gold2[2]; for(int i=0; i <2; i++) gold2[i] = gold2_data[i]; assert(func0(gold2, 2, 2) == 70); // Test case 3 int gold3_data[2][2] = { {4, 9}, {3, 7} }; int* gold3[2]; for(int i=0; i <2; i++) gold3[i] = gold3_data[i]; assert(func0(gold3, 2, 2) == 13); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 mov %rdi,%r12 movslq %esi,%rdi push %rbp push %rbx mov %rdi,%rbx shl $0x3,%rdi sub $0x18,%rsp mov %edx,0xc(%rsp) callq 10d0 <malloc@plt> mov %rax,%rbp test %ebx,%ebx jle 140a <func0+0x5a> mov %rax,%r13 movslq 0xc(%rsp),%r15 lea -0x1(%rbx),%eax lea 0x8(%rbp,%rax,8),%r14 mov $0x4,%esi mov %r15,%rdi add $0x8,%r13 callq 10c0 <calloc@plt> mov %rax,-0x8(%r13) cmp %r13,%r14 jne 13f0 <func0+0x40> mov 0xc(%rsp),%r13d sub $0x1,%r13d js 14bf <func0+0x10f> movslq %r13d,%rsi lea -0x1(%rbx),%r8d mov %r13d,%r10d xor %r11d,%r11d shl $0x2,%rsi mov %r8,%r9 nopl (%rax) test %ebx,%ebx jle 14ad <func0+0xfd> lea 0x4(%rsi),%rcx xor %edx,%edx cmp %r10d,%r13d jne 146d <func0+0xbd> jmpq 1540 <func0+0x190> nopl 0x0(%rax) mov 0x8(%rbp,%rdx,8),%r14 cmp %eax,(%r14,%rcx,1) cmovge (%r14,%rcx,1),%eax mov (%r12,%rdx,8),%r14 add (%r14,%rsi,1),%eax mov %eax,(%rdi,%rsi,1) lea 0x1(%rdx),%rax cmp %rdx,%r8 je 14ad <func0+0xfd> mov %rax,%rdx mov 0x0(%rbp,%rdx,8),%rdi mov %edx,%r14d mov (%rdi,%rcx,1),%eax test %edx,%edx je 1530 <func0+0x180> mov -0x8(%rbp,%rdx,8),%r15 cmp %eax,(%r15,%rcx,1) cmovge (%r15,%rcx,1),%eax cmp %r14d,%r9d jne 1448 <func0+0x98> mov (%r12,%rdx,8),%r14 test %eax,%eax cmovs %r11d,%eax add (%r14,%rsi,1),%eax mov %eax,(%rdi,%rsi,1) lea 0x1(%rdx),%rax cmp %rdx,%r8 jne 146a <func0+0xba> sub $0x1,%r10d sub $0x4,%rsi cmp $0xffffffff,%r10d jne 1430 <func0+0x80> mov 0x0(%rbp),%rdi mov (%rdi),%r13d cmp $0x1,%ebx jle 157a <func0+0x1ca> lea -0x2(%rbx),%edx lea 0x8(%rbp),%rax lea 0x10(%rbp,%rdx,8),%rcx nopl 0x0(%rax,%rax,1) mov (%rax),%rdx mov (%rdx),%edx cmp %edx,%r13d cmovl %edx,%r13d add $0x8,%rax cmp %rcx,%rax jne 14e0 <func0+0x130> xor %r12d,%r12d nopl 0x0(%rax,%rax,1) mov 0x0(%rbp,%r12,8),%rdi add $0x1,%r12 callq 1090 <free@plt> cmp %r12d,%ebx jg 1500 <func0+0x150> mov %rbp,%rdi callq 1090 <free@plt> add $0x18,%rsp mov %r13d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl (%rax) test %eax,%eax cmovs %edx,%eax jmpq 148e <func0+0xde> nopw 0x0(%rax,%rax,1) xor %eax,%eax nopw 0x0(%rax,%rax,1) mov (%r12,%rax,8),%rcx mov 0x0(%rbp,%rax,8),%rdx mov (%rcx,%rsi,1),%ecx mov %ecx,(%rdx,%rsi,1) mov %rax,%rdx add $0x1,%rax cmp %rdx,%r8 jne 1548 <func0+0x198> sub $0x1,%r10d sub $0x4,%rsi cmp $0xffffffff,%r10d jne 1430 <func0+0x80> jmpq 14bf <func0+0x10f> jne 1513 <func0+0x163> callq 1090 <free@plt> jmp 1513 <func0+0x163> nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 push r15 mov r15d, edx push r14 push r13 movsxd r13, esi push r12 lea r14, ds:0[r13*8] mov r12, rdi push rbp mov rdi, r14; size push rbx sub rsp, 28h mov dword ptr [rsp+58h+ptr], esi call _malloc mov esi, dword ptr [rsp+58h+ptr] mov rbp, rax test esi, esi jle loc_15BB lea r8d, [r15-1] movsxd rax, r15d mov r15, rbp mov [rsp+58h+ptr], rbp mov [rsp+58h+var_44], r8d lea rbx, [r14+rbp] mov rbp, rax mov [rsp+58h+var_40], r12 mov r12, r15 mov r15d, esi nop dword ptr [rax+00h] loc_1438: mov esi, 4; size mov rdi, rbp; nmemb add r12, 8 call _calloc mov [r12-8], rax cmp rbx, r12 jnz short loc_1438 movsxd rdi, [rsp+58h+var_44] mov rbp, [rsp+58h+ptr] mov esi, r15d lea r10d, [r15-1] mov r12, [rsp+58h+var_40] mov r8, rdi shl rdi, 2 mov r11d, r8d test r8d, r8d js loc_15C6 mov [rsp+58h+ptr], r14 mov r9d, r15d nop dword ptr [rax+00h] loc_1488: lea r15d, [r11+1] mov r14, [rsp+58h+ptr] xor eax, eax shl r15, 2 cmp r11d, r8d jz loc_1560 loc_14A0: xor esi, esi test rax, rax jz short loc_14B0 mov rdx, [rbp+rax*8-8] mov esi, [rdx+r15] loc_14B0: mov r14, [rbp+rax*8+0] mov edx, [r14+r15] cmp r10d, eax jz loc_1580 mov rcx, [rbp+rax*8+8] mov ecx, [rcx+r15] cmp edx, ecx cmovl edx, ecx mov rcx, [r12+rax*8] cmp edx, esi cmovl edx, esi add rax, 1 add edx, [rcx+rdi] mov [r14+rdi], edx cmp r13, rax jnz short loc_14A0 loc_14E9: sub r11d, 1 sub rdi, 4 cmp r11d, 0FFFFFFFFh jnz short loc_1488 loc_14F7: mov rax, [rbp+0] mov esi, r9d mov r13d, [rax] cmp r9d, 1 jz short loc_152D loc_1507: lea edx, [rsi-2] lea rax, [rbp+8] lea rcx, [rbp+rdx*8+10h] nop dword ptr [rax+rax+00h] loc_1518: mov rdx, [rax] mov edx, [rdx] cmp r13d, edx cmovl r13d, edx add rax, 8 cmp rax, rcx jnz short loc_1518 loc_152D: mov r12, rbp loc_1530: mov rdi, [r12]; ptr add r12, 8 call _free cmp r12, rbx jnz short loc_1530 loc_1542: mov rdi, rbp; ptr call _free add rsp, 28h mov eax, r13d pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1560: mov rcx, [r12+rax] mov rdx, [rbp+rax+0] add rax, 8 mov ecx, [rcx+rdi] mov [rdx+rdi], ecx cmp r14, rax jnz short loc_1560 jmp loc_14E9 loc_1580: xor ecx, ecx test edx, edx cmovns ecx, edx cmp ecx, esi cmovl ecx, esi mov rsi, [r12+rax*8] add rax, 1 add ecx, [rsi+rdi] mov [r14+rdi], ecx cmp r13, rax jnz loc_14A0 sub r11d, 1 sub rdi, 4 cmp r11d, 0FFFFFFFFh jnz loc_1488 jmp loc_14F7 loc_15BB: mov rax, [rax] mov r13d, [rax] jmp loc_1542 loc_15C6: mov rax, [rbp+0] mov r13d, [rax] cmp r15d, 1 jnz loc_1507 jmp loc_152D
long long func0(long long a1, int a2, int a3) { void *v4; // r13 _DWORD **v5; // rax _DWORD **v6; // rbp int v7; // r8d size_t v8; // rax void **v9; // r15 void **v10; // rbx size_t v11; // rbp void **v12; // r12 int v13; // r15d int v14; // r10d long long v15; // rdi int v16; // r11d void *v17; // rax int v18; // esi _DWORD *v19; // r14 int v20; // edx long long v21; // rcx unsigned int v22; // r13d unsigned int **v23; // rax void **v24; // r12 void *v25; // rdi long long v27; // rcx long long v28; // rdx int v29; // ecx long long v30; // rsi _DWORD **ptr; // [rsp+8h] [rbp-50h] void *ptra; // [rsp+8h] [rbp-50h] int v33; // [rsp+14h] [rbp-44h] v4 = (void *)a2; v5 = (_DWORD **)malloc(8LL * a2); v6 = v5; if ( a2 <= 0 ) { v22 = **v5; goto LABEL_23; } v7 = a3 - 1; v8 = a3; v9 = (void **)v6; ptr = v6; v33 = v7; v10 = (void **)&v6[a2]; v11 = v8; v12 = v9; v13 = a2; do *v12++ = calloc(v11, 4uLL); while ( v10 != v12 ); v6 = ptr; v14 = a2 - 1; v15 = v33; v16 = v33; if ( v33 >= 0 ) { ptra = (void *)(8LL * a2); do { while ( 1 ) { v17 = 0LL; if ( v16 != v33 ) break; do { v27 = *(_QWORD *)((char *)v17 + a1); v28 = *(_QWORD *)((char *)v17 + (_QWORD)v6); v17 = (char *)v17 + 8; *(_DWORD *)(v28 + v15 * 4) = *(_DWORD *)(v27 + v15 * 4); } while ( ptra != v17 ); LABEL_15: --v16; --v15; if ( v16 == -1 ) goto LABEL_16; } do { while ( 1 ) { v18 = 0; if ( v17 ) v18 = v6[(_QWORD)v17 - 1][v16 + 1]; v19 = v6[(_QWORD)v17]; v20 = v19[v16 + 1]; if ( v14 == (_DWORD)v17 ) break; if ( v20 < v6[(_QWORD)v17 + 1][v16 + 1] ) v20 = v6[(_QWORD)v17 + 1][v16 + 1]; v21 = *(_QWORD *)(a1 + 8LL * (_QWORD)v17); if ( v20 < v18 ) v20 = v18; v17 = (char *)v17 + 1; v19[v15] = *(_DWORD *)(v21 + v15 * 4) + v20; if ( v4 == v17 ) goto LABEL_15; } v29 = 0; if ( v20 >= 0 ) v29 = v19[v16 + 1]; if ( v29 < v18 ) v29 = v18; v30 = *(_QWORD *)(a1 + 8LL * (_QWORD)v17); v17 = (char *)v17 + 1; v19[v15] = *(_DWORD *)(v30 + v15 * 4) + v29; } while ( v4 != v17 ); --v16; --v15; } while ( v16 != -1 ); LABEL_16: a2 = v13; v22 = **v6; if ( v13 == 1 ) goto LABEL_21; goto LABEL_17; } v22 = **ptr; if ( a2 != 1 ) { LABEL_17: v23 = v6 + 1; do { if ( (int)v22 < (int)**v23 ) v22 = **v23; ++v23; } while ( v23 != &v6[(unsigned int)(a2 - 2) + 2] ); } LABEL_21: v24 = (void **)v6; do { v25 = *v24++; free(v25); } while ( v24 != v10 ); LABEL_23: free(v6); return v22; }
func0: ENDBR64 PUSH R15 MOV R15D,EDX PUSH R14 PUSH R13 MOVSXD R13,ESI PUSH R12 LEA R14,[R13*0x8] MOV R12,RDI PUSH RBP MOV RDI,R14 PUSH RBX SUB RSP,0x28 MOV dword ptr [RSP + 0x8],ESI CALL 0x001010d0 MOV ESI,dword ptr [RSP + 0x8] MOV RBP,RAX TEST ESI,ESI JLE 0x001015bb LEA R8D,[R15 + -0x1] MOVSXD RAX,R15D MOV R15,RBP MOV qword ptr [RSP + 0x8],RBP MOV dword ptr [RSP + 0x14],R8D LEA RBX,[R14 + RBP*0x1] MOV RBP,RAX MOV qword ptr [RSP + 0x18],R12 MOV R12,R15 MOV R15D,ESI NOP dword ptr [RAX] LAB_00101438: MOV ESI,0x4 MOV RDI,RBP ADD R12,0x8 CALL 0x001010c0 MOV qword ptr [R12 + -0x8],RAX CMP RBX,R12 JNZ 0x00101438 MOVSXD RDI,dword ptr [RSP + 0x14] MOV RBP,qword ptr [RSP + 0x8] MOV ESI,R15D LEA R10D,[R15 + -0x1] MOV R12,qword ptr [RSP + 0x18] MOV R8,RDI SHL RDI,0x2 MOV R11D,R8D TEST R8D,R8D JS 0x001015c6 MOV qword ptr [RSP + 0x8],R14 MOV R9D,R15D NOP dword ptr [RAX] LAB_00101488: LEA R15D,[R11 + 0x1] MOV R14,qword ptr [RSP + 0x8] XOR EAX,EAX SHL R15,0x2 CMP R11D,R8D JZ 0x00101560 LAB_001014a0: XOR ESI,ESI TEST RAX,RAX JZ 0x001014b0 MOV RDX,qword ptr [RBP + RAX*0x8 + -0x8] MOV ESI,dword ptr [RDX + R15*0x1] LAB_001014b0: MOV R14,qword ptr [RBP + RAX*0x8] MOV EDX,dword ptr [R14 + R15*0x1] CMP R10D,EAX JZ 0x00101580 MOV RCX,qword ptr [RBP + RAX*0x8 + 0x8] MOV ECX,dword ptr [RCX + R15*0x1] CMP EDX,ECX CMOVL EDX,ECX MOV RCX,qword ptr [R12 + RAX*0x8] CMP EDX,ESI CMOVL EDX,ESI ADD RAX,0x1 ADD EDX,dword ptr [RCX + RDI*0x1] MOV dword ptr [R14 + RDI*0x1],EDX CMP R13,RAX JNZ 0x001014a0 LAB_001014e9: SUB R11D,0x1 SUB RDI,0x4 CMP R11D,-0x1 JNZ 0x00101488 LAB_001014f7: MOV RAX,qword ptr [RBP] MOV ESI,R9D MOV R13D,dword ptr [RAX] CMP R9D,0x1 JZ 0x0010152d LAB_00101507: LEA EDX,[RSI + -0x2] LEA RAX,[RBP + 0x8] LEA RCX,[RBP + RDX*0x8 + 0x10] NOP dword ptr [RAX + RAX*0x1] LAB_00101518: MOV RDX,qword ptr [RAX] MOV EDX,dword ptr [RDX] CMP R13D,EDX CMOVL R13D,EDX ADD RAX,0x8 CMP RAX,RCX JNZ 0x00101518 LAB_0010152d: MOV R12,RBP LAB_00101530: MOV RDI,qword ptr [R12] ADD R12,0x8 CALL 0x00101090 CMP R12,RBX JNZ 0x00101530 LAB_00101542: MOV RDI,RBP CALL 0x00101090 ADD RSP,0x28 MOV EAX,R13D POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101560: MOV RCX,qword ptr [R12 + RAX*0x1] MOV RDX,qword ptr [RBP + RAX*0x1] ADD RAX,0x8 MOV ECX,dword ptr [RCX + RDI*0x1] MOV dword ptr [RDX + RDI*0x1],ECX CMP R14,RAX JNZ 0x00101560 JMP 0x001014e9 LAB_00101580: XOR ECX,ECX TEST EDX,EDX CMOVNS ECX,EDX CMP ECX,ESI CMOVL ECX,ESI MOV RSI,qword ptr [R12 + RAX*0x8] ADD RAX,0x1 ADD ECX,dword ptr [RSI + RDI*0x1] MOV dword ptr [R14 + RDI*0x1],ECX CMP R13,RAX JNZ 0x001014a0 SUB R11D,0x1 SUB RDI,0x4 CMP R11D,-0x1 JNZ 0x00101488 JMP 0x001014f7 LAB_001015bb: MOV RAX,qword ptr [RAX] MOV R13D,dword ptr [RAX] JMP 0x00101542 LAB_001015c6: MOV RAX,qword ptr [RBP] MOV R13D,dword ptr [RAX] CMP R15D,0x1 JNZ 0x00101507 JMP 0x0010152d
int func0(long param_1,int param_2,int param_3) { long lVar1; long *plVar2; long *plVar3; long lVar4; int8 *__ptr; void *pvVar5; size_t sVar6; int8 *puVar7; int iVar8; int iVar9; int iVar10; long lVar11; int iVar12; int iVar13; int8 *puVar14; size_t sVar15; long lVar16; sVar15 = (size_t)param_2; __ptr = (int8 *)malloc(sVar15 * 8); if (param_2 < 1) { iVar12 = *(int *)*__ptr; } else { iVar12 = param_3 + -1; puVar14 = __ptr; do { puVar7 = puVar14 + 1; pvVar5 = calloc((long)param_3,4); *puVar14 = pvVar5; puVar14 = puVar7; } while (__ptr + sVar15 != puVar7); lVar11 = (long)iVar12 << 2; iVar13 = iVar12; if (iVar12 < 0) { iVar12 = *(int *)*__ptr; } else { do { while( true ) { sVar6 = 0; lVar16 = (ulong)(iVar13 + 1) * 4; if (iVar13 != iVar12) break; do { plVar2 = (long *)(param_1 + sVar6); plVar3 = (long *)((long)__ptr + sVar6); sVar6 = sVar6 + 8; *(int4 *)(*plVar3 + lVar11) = *(int4 *)(*plVar2 + lVar11); } while (sVar15 * 8 != sVar6); LAB_001014e9: iVar13 = iVar13 + -1; lVar11 = lVar11 + -4; if (iVar13 == -1) goto LAB_001014f7; } do { while( true ) { iVar10 = 0; if (sVar6 != 0) { iVar10 = *(int *)(__ptr[sVar6 - 1] + lVar16); } lVar4 = __ptr[sVar6]; iVar9 = *(int *)(lVar4 + lVar16); if (param_2 + -1 == (int)sVar6) break; if (iVar9 < *(int *)(__ptr[sVar6 + 1] + lVar16)) { iVar9 = *(int *)(__ptr[sVar6 + 1] + lVar16); } lVar1 = sVar6 * 8; if (iVar9 < iVar10) { iVar9 = iVar10; } sVar6 = sVar6 + 1; *(int *)(lVar4 + lVar11) = iVar9 + *(int *)(*(long *)(param_1 + lVar1) + lVar11); if (sVar15 == sVar6) goto LAB_001014e9; } iVar8 = 0; if (-1 < iVar9) { iVar8 = iVar9; } if (iVar8 < iVar10) { iVar8 = iVar10; } lVar1 = sVar6 * 8; sVar6 = sVar6 + 1; *(int *)(lVar4 + lVar11) = iVar8 + *(int *)(*(long *)(param_1 + lVar1) + lVar11); } while (sVar15 != sVar6); iVar13 = iVar13 + -1; lVar11 = lVar11 + -4; } while (iVar13 != -1); LAB_001014f7: iVar12 = *(int *)*__ptr; } puVar14 = __ptr; if (param_2 != 1) { puVar7 = __ptr + 1; do { if (iVar12 < *(int *)*puVar7) { iVar12 = *(int *)*puVar7; } puVar7 = puVar7 + 1; } while (puVar7 != __ptr + (ulong)(param_2 - 2) + 2); } do { puVar7 = puVar14 + 1; free((void *)*puVar14); puVar14 = puVar7; } while (puVar7 != __ptr + sVar15); } free(__ptr); return iVar12; }
5,588
func0
#include <stdio.h> #include <assert.h> #include <string.h>
char *func0(const char *test_tuple[], int size) { static char res[100]; for (int i = 0; i < size; i++) { int length = strlen(test_tuple[i]); res[i] = test_tuple[i][length - 1]; } res[size] = '\0'; // Null-terminating the string return res; }
int main() { const char *test_tuple1[] = {"Mers", "for", "Vers"}; const char *test_tuple2[] = {"Avenge", "for", "People"}; const char *test_tuple3[] = {"Gotta", "get", "go"}; assert(strcmp(func0(test_tuple1, 3), "srs") == 0); assert(strcmp(func0(test_tuple2, 3), "ere") == 0); assert(strcmp(func0(test_tuple3, 3), "ato") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0x8(%rbp) jmp 1221 <func0+0x78> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov %rax,%rdi callq 1080 <strlen@plt> mov %eax,-0x4(%rbp) mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0x4(%rbp),%edx movslq %edx,%rdx sub $0x1,%rdx add %rdx,%rax movzbl (%rax),%edx mov -0x8(%rbp),%eax cltq lea 0x2e26(%rip),%rcx mov %dl,(%rax,%rcx,1) addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11c5 <func0+0x1c> mov -0x1c(%rbp),%eax cltq lea 0x2e0b(%rip),%rdx movb $0x0,(%rax,%rdx,1) lea 0x2e00(%rip),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_8], 0 jmp short loc_1221 loc_11C5: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] add rax, rdx mov rax, [rax] mov rdi, rax; s call _strlen mov [rbp+var_4], eax mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] add rax, rdx mov rax, [rax] mov edx, [rbp+var_4] movsxd rdx, edx sub rdx, 1 add rax, rdx movzx edx, byte ptr [rax] mov eax, [rbp+var_8] cdqe lea rcx, res_1 mov [rax+rcx], dl add [rbp+var_8], 1 loc_1221: mov eax, [rbp+var_8] cmp eax, [rbp+var_1C] jl short loc_11C5 mov eax, [rbp+var_1C] cdqe lea rdx, res_1 mov byte ptr [rax+rdx], 0 lea rax, res_1 leave retn
_BYTE * func0(long long a1, int a2) { int i; // [rsp+18h] [rbp-8h] for ( i = 0; i < a2; ++i ) res_1[i] = *(_BYTE *)((int)strlen(*(const char **)(8LL * i + a1)) - 1LL + *(_QWORD *)(8LL * i + a1)); res_1[a2] = 0; return res_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x8],0x0 JMP 0x00101221 LAB_001011c5: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV RDI,RAX CALL 0x00101080 MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0x4] MOVSXD RDX,EDX SUB RDX,0x1 ADD RAX,RDX MOVZX EDX,byte ptr [RAX] MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RCX,[0x104040] MOV byte ptr [RAX + RCX*0x1],DL ADD dword ptr [RBP + -0x8],0x1 LAB_00101221: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011c5 MOV EAX,dword ptr [RBP + -0x1c] CDQE LEA RDX,[0x104040] MOV byte ptr [RAX + RDX*0x1],0x0 LEA RAX,[0x104040] LEAVE RET
int1 * func0(long param_1,int param_2) { size_t sVar1; int local_10; for (local_10 = 0; local_10 < param_2; local_10 = local_10 + 1) { sVar1 = strlen(*(char **)(param_1 + (long)local_10 * 8)); res_1[local_10] = *(int *)(*(long *)(param_1 + (long)local_10 * 8) + (long)(int)sVar1 + -1); } res_1[param_2] = 0; return res_1; }
5,589
func0
#include <stdio.h> #include <assert.h> #include <string.h>
char *func0(const char *test_tuple[], int size) { static char res[100]; for (int i = 0; i < size; i++) { int length = strlen(test_tuple[i]); res[i] = test_tuple[i][length - 1]; } res[size] = '\0'; // Null-terminating the string return res; }
int main() { const char *test_tuple1[] = {"Mers", "for", "Vers"}; const char *test_tuple2[] = {"Avenge", "for", "People"}; const char *test_tuple3[] = {"Gotta", "get", "go"}; assert(strcmp(func0(test_tuple1, 3), "srs") == 0); assert(strcmp(func0(test_tuple2, 3), "ere") == 0); assert(strcmp(func0(test_tuple3, 3), "ato") == 0); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11ba <func0+0x51> mov %rdi,%rdx lea 0x2ec5(%rip),%r8 lea -0x1(%rsi),%eax lea 0x8(%rdi,%rax,8),%r11 mov $0xffffffffffffffff,%r10 mov $0x0,%eax mov (%rdx),%r9 mov %r10,%rcx mov %r9,%rdi repnz scas %es:(%rdi),%al not %rcx sub $0x1,%rcx movslq %ecx,%rcx movzbl -0x1(%r9,%rcx,1),%ecx mov %cl,(%r8) add $0x8,%rdx add $0x1,%r8 cmp %r11,%rdx jne 118f <func0+0x26> lea 0x2e7f(%rip),%rax movslq %esi,%rsi movb $0x0,(%rax,%rsi,1) retq
func0: endbr64 push r14 push r13 push r12 push rbp push rbx mov r14d, esi test esi, esi jle short loc_11F1 mov rbx, rdi lea rbp, res_1 lea eax, [rsi-1] lea r13, [rdi+rax*8+8] loc_11CE: mov r12, [rbx] mov rdi, r12 call _strlen cdqe movzx eax, byte ptr [r12+rax-1] mov [rbp+0], al add rbx, 8 add rbp, 1 cmp rbx, r13 jnz short loc_11CE loc_11F1: lea rax, res_1 movsxd r14, r14d mov byte ptr [rax+r14], 0 pop rbx pop rbp pop r12 pop r13 pop r14 retn
_BYTE * func0(long long *a1, int a2) { long long *v2; // rbx _BYTE *v3; // rbp long long v4; // r12 _BYTE *result; // rax if ( a2 > 0 ) { v2 = a1; v3 = res_1; do { v4 = *v2; *v3++ = *(_BYTE *)(v4 + (int)strlen(*v2++) - 1); } while ( v2 != &a1[(unsigned int)(a2 - 1) + 1] ); } result = res_1; res_1[a2] = 0; return result; }
func0: ENDBR64 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX MOV R14D,ESI TEST ESI,ESI JLE 0x001011f1 MOV RBX,RDI LEA RBP,[0x104040] LEA EAX,[RSI + -0x1] LEA R13,[RDI + RAX*0x8 + 0x8] LAB_001011ce: MOV R12,qword ptr [RBX] MOV RDI,R12 CALL 0x00101080 CDQE MOVZX EAX,byte ptr [R12 + RAX*0x1 + -0x1] MOV byte ptr [RBP],AL ADD RBX,0x8 ADD RBP,0x1 CMP RBX,R13 JNZ 0x001011ce LAB_001011f1: LEA RAX,[0x104040] MOVSXD R14,R14D MOV byte ptr [RAX + R14*0x1],0x0 POP RBX POP RBP POP R12 POP R13 POP R14 RET
void func0(int8 *param_1,int param_2) { int8 *puVar1; char *__s; size_t sVar2; char *pcVar3; if (0 < param_2) { pcVar3 = &res_1; puVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { __s = (char *)*param_1; sVar2 = strlen(__s); *pcVar3 = __s[(long)(int)sVar2 + -1]; param_1 = param_1 + 1; pcVar3 = pcVar3 + 1; } while (param_1 != puVar1); } (&res_1)[param_2] = 0; return; }
5,590
func0
#include <stdio.h> #include <assert.h> #include <string.h>
char *func0(const char *test_tuple[], int size) { static char res[100]; for (int i = 0; i < size; i++) { int length = strlen(test_tuple[i]); res[i] = test_tuple[i][length - 1]; } res[size] = '\0'; // Null-terminating the string return res; }
int main() { const char *test_tuple1[] = {"Mers", "for", "Vers"}; const char *test_tuple2[] = {"Avenge", "for", "People"}; const char *test_tuple3[] = {"Gotta", "get", "go"}; assert(strcmp(func0(test_tuple1, 3), "srs") == 0); assert(strcmp(func0(test_tuple2, 3), "ere") == 0); assert(strcmp(func0(test_tuple3, 3), "ato") == 0); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 lea 0x2d1d(%rip),%r12 push %rbp movslq %esi,%rbp push %rbx sub $0x8,%rsp test %ebp,%ebp jle 1364 <func0+0x54> lea -0x1(%rbp),%eax mov %rdi,%rbx mov %r12,%r14 lea 0x8(%rdi,%rax,8),%r13 xchg %ax,%ax mov (%rbx),%r15 add $0x8,%rbx add $0x1,%r14 mov %r15,%rdi callq 1070 <strlen@plt> cltq movzbl -0x1(%r15,%rax,1),%eax mov %al,-0x1(%r14) cmp %r13,%rbx jne 1340 <func0+0x30> movb $0x0,(%r12,%rbp,1) add $0x8,%rsp lea 0x2ccc(%rip),%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq
func0: endbr64 push r15 push r14 push r13 push r12 lea r12, res_1 push rbp movsxd rbp, esi push rbx sub rsp, 8 test ebp, ebp jle short loc_1364 lea eax, [rbp-1] mov rbx, rdi mov r14, r12 lea r13, [rdi+rax*8+8] xchg ax, ax loc_1340: mov r15, [rbx] add rbx, 8 add r14, 1 mov rdi, r15 call _strlen cdqe movzx eax, byte ptr [r15+rax-1] mov [r14-1], al cmp rbx, r13 jnz short loc_1340 loc_1364: mov byte ptr [r12+rbp], 0 add rsp, 8 mov rax, r12 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
_BYTE * func0(long long *a1, int a2) { long long *v2; // rbx _BYTE *v3; // r14 long long v4; // r15 if ( a2 > 0 ) { v2 = a1; v3 = res_1; do { v4 = *v2++; *v3++ = *(_BYTE *)(v4 + (int)strlen(v4) - 1); } while ( v2 != &a1[(unsigned int)(a2 - 1) + 1] ); } res_1[a2] = 0; return res_1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 LEA R12,[0x104040] PUSH RBP MOVSXD RBP,ESI PUSH RBX SUB RSP,0x8 TEST EBP,EBP JLE 0x00101364 LEA EAX,[RBP + -0x1] MOV RBX,RDI MOV R14,R12 LEA R13,[RDI + RAX*0x8 + 0x8] NOP LAB_00101340: MOV R15,qword ptr [RBX] ADD RBX,0x8 ADD R14,0x1 MOV RDI,R15 CALL 0x00101080 CDQE MOVZX EAX,byte ptr [R15 + RAX*0x1 + -0x1] MOV byte ptr [R14 + -0x1],AL CMP RBX,R13 JNZ 0x00101340 LAB_00101364: MOV byte ptr [R12 + RBP*0x1],0x0 ADD RSP,0x8 MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int1 * func0(int8 *param_1,int param_2) { int8 *puVar1; char *__s; size_t sVar2; char *pcVar3; if (0 < param_2) { puVar1 = param_1 + (ulong)(param_2 - 1) + 1; pcVar3 = &res_1; do { __s = (char *)*param_1; param_1 = param_1 + 1; sVar2 = strlen(__s); *pcVar3 = __s[(long)(int)sVar2 + -1]; pcVar3 = pcVar3 + 1; } while (param_1 != puVar1); } (&res_1)[param_2] = 0; return &res_1; }
5,591
func0
#include <stdio.h> #include <assert.h> #include <string.h>
char *func0(const char *test_tuple[], int size) { static char res[100]; for (int i = 0; i < size; i++) { int length = strlen(test_tuple[i]); res[i] = test_tuple[i][length - 1]; } res[size] = '\0'; // Null-terminating the string return res; }
int main() { const char *test_tuple1[] = {"Mers", "for", "Vers"}; const char *test_tuple2[] = {"Avenge", "for", "People"}; const char *test_tuple3[] = {"Gotta", "get", "go"}; assert(strcmp(func0(test_tuple1, 3), "srs") == 0); assert(strcmp(func0(test_tuple2, 3), "ere") == 0); assert(strcmp(func0(test_tuple3, 3), "ato") == 0); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 lea 0x2d0d(%rip),%r12 push %rbp movslq %esi,%rbp push %rbx sub $0x8,%rsp test %ebp,%ebp jle 1374 <func0+0x54> lea -0x1(%rbp),%eax mov %rdi,%rbx mov %r12,%r14 lea 0x8(%rdi,%rax,8),%r13 xchg %ax,%ax mov (%rbx),%r15 add $0x8,%rbx add $0x1,%r14 mov %r15,%rdi callq 1070 <strlen@plt> cltq movzbl -0x1(%r15,%rax,1),%eax mov %al,-0x1(%r14) cmp %rbx,%r13 jne 1350 <func0+0x30> movb $0x0,(%r12,%rbp,1) add $0x8,%rsp lea 0x2cbc(%rip),%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq
func0: endbr64 push r15 push r14 push r13 lea r13, res_1 push r12 movsxd r12, esi push rbp push rbx sub rsp, 8 test esi, esi jle short loc_137C lea r13, res_1 movsxd r12, esi mov rbx, rdi mov r14, r13 lea rbp, [rdi+r12*8] nop dword ptr [rax+00h] loc_1358: mov r15, [rbx] add rbx, 8 add r14, 1 mov rdi, r15; s call _strlen cdqe movzx eax, byte ptr [r15+rax-1] mov [r14-1], al cmp rbp, rbx jnz short loc_1358 loc_137C: mov byte ptr [r13+r12+0], 0 add rsp, 8 mov rax, r13 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
_BYTE * func0(const char **a1, int a2) { long long v2; // r12 const char **v3; // rbx _BYTE *v4; // r14 const char *v5; // r15 v2 = a2; if ( a2 > 0 ) { v2 = a2; v3 = a1; v4 = res_1; do { v5 = *v3++; *v4++ = v5[(int)strlen(v5) - 1]; } while ( &a1[a2] != v3 ); } res_1[v2] = 0; return res_1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 LEA R13,[0x104040] PUSH R12 MOVSXD R12,ESI PUSH RBP PUSH RBX SUB RSP,0x8 TEST ESI,ESI JLE 0x0010137c LEA R13,[0x104040] MOVSXD R12,ESI MOV RBX,RDI MOV R14,R13 LEA RBP,[RDI + R12*0x8] NOP dword ptr [RAX] LAB_00101358: MOV R15,qword ptr [RBX] ADD RBX,0x8 ADD R14,0x1 MOV RDI,R15 CALL 0x00101080 CDQE MOVZX EAX,byte ptr [R15 + RAX*0x1 + -0x1] MOV byte ptr [R14 + -0x1],AL CMP RBP,RBX JNZ 0x00101358 LAB_0010137c: MOV byte ptr [R13 + R12*0x1],0x0 ADD RSP,0x8 MOV RAX,R13 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int1 * func0(int8 *param_1,int param_2) { int8 *puVar1; char *__s; size_t sVar2; char *pcVar3; if (0 < param_2) { puVar1 = param_1 + param_2; pcVar3 = &res_1; do { __s = (char *)*param_1; param_1 = param_1 + 1; sVar2 = strlen(__s); *pcVar3 = __s[(long)(int)sVar2 + -1]; pcVar3 = pcVar3 + 1; } while (puVar1 != param_1); } (&res_1)[param_2] = 0; return &res_1; }
5,592
func0
#include <stdio.h> #include <assert.h>
int func0(char list1[][3][2], int list_length, char x) { int ctr = 0; for (int i = 0; i < list_length; i++) { for (int j = 0; j < 3; j++) { if (list1[i][j][0] == x) { ctr++; break; } } } return ctr; }
int main() { char list1[4][3][2] = {{{'1', '\0'}, {'3', '\0'}}, {{'5', '\0'}, {'7', '\0'}}, {{'1', '\0'}, {'1', '1'}}, {{'1', '\0'}, {'1', '5'}, {'7', '\0'}}}; char list2[4][3][2] = {{{'A', '\0'}, {'B', '\0'}}, {{'A', '\0'}, {'C', '\0'}}, {{'A', '\0'}, {'D', '\0'}, {'E', '\0'}}, {{'B', '\0'}, {'C', '\0'}, {'D', '\0'}}}; assert(func0(list1, 4, '1') == 3); assert(func0(list2, 4, 'A') == 3); assert(func0(list2, 4, 'E') == 1); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %edx,%eax mov %al,-0x20(%rbp) movl $0x0,-0xc(%rbp) movl $0x0,-0x8(%rbp) jmp 11d4 <func0+0x6b> movl $0x0,-0x4(%rbp) jmp 11ca <func0+0x61> mov -0x8(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax add %rax,%rax add %rdx,%rax add %rax,%rax mov %rax,%rdx mov -0x18(%rbp),%rax add %rax,%rdx mov -0x4(%rbp),%eax cltq movzbl (%rdx,%rax,2),%eax cmp %al,-0x20(%rbp) jne 11c6 <func0+0x5d> addl $0x1,-0xc(%rbp) jmp 11d0 <func0+0x67> addl $0x1,-0x4(%rbp) cmpl $0x2,-0x4(%rbp) jle 1196 <func0+0x2d> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x1c(%rbp),%eax jl 118d <func0+0x24> mov -0xc(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov eax, edx mov [rbp+var_20], al mov [rbp+var_C], 0 mov [rbp+var_8], 0 jmp short loc_11D4 loc_118D: mov [rbp+var_4], 0 jmp short loc_11CA loc_1196: mov eax, [rbp+var_8] movsxd rdx, eax mov rax, rdx add rax, rax add rax, rdx add rax, rax mov rdx, rax mov rax, [rbp+var_18] add rdx, rax mov eax, [rbp+var_4] cdqe movzx eax, byte ptr [rdx+rax*2] cmp [rbp+var_20], al jnz short loc_11C6 add [rbp+var_C], 1 jmp short loc_11D0 loc_11C6: add [rbp+var_4], 1 loc_11CA: cmp [rbp+var_4], 2 jle short loc_1196 loc_11D0: add [rbp+var_8], 1 loc_11D4: mov eax, [rbp+var_8] cmp eax, [rbp+var_1C] jl short loc_118D mov eax, [rbp+var_C] pop rbp retn
long long func0(long long a1, int a2, char a3) { unsigned int v4; // [rsp+14h] [rbp-Ch] int i; // [rsp+18h] [rbp-8h] int j; // [rsp+1Ch] [rbp-4h] v4 = 0; for ( i = 0; i < a2; ++i ) { for ( j = 0; j <= 2; ++j ) { if ( a3 == *(_BYTE *)(a1 + 6LL * i + 2LL * j) ) { ++v4; break; } } } return v4; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV EAX,EDX MOV byte ptr [RBP + -0x20],AL MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x8],0x0 JMP 0x001011d4 LAB_0010118d: MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011ca LAB_00101196: MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX MOV RAX,RDX ADD RAX,RAX ADD RAX,RDX ADD RAX,RAX MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x18] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x4] CDQE MOVZX EAX,byte ptr [RDX + RAX*0x2] CMP byte ptr [RBP + -0x20],AL JNZ 0x001011c6 ADD dword ptr [RBP + -0xc],0x1 JMP 0x001011d0 LAB_001011c6: ADD dword ptr [RBP + -0x4],0x1 LAB_001011ca: CMP dword ptr [RBP + -0x4],0x2 JLE 0x00101196 LAB_001011d0: ADD dword ptr [RBP + -0x8],0x1 LAB_001011d4: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x1c] JL 0x0010118d MOV EAX,dword ptr [RBP + -0xc] POP RBP RET
int func0(long param_1,int param_2,char param_3) { int4 local_14; int4 local_10; int4 local_c; local_14 = 0; local_10 = 0; do { if (param_2 <= local_10) { return local_14; } for (local_c = 0; local_c < 3; local_c = local_c + 1) { if (param_3 == *(char *)((long)local_10 * 6 + param_1 + (long)local_c * 2)) { local_14 = local_14 + 1; break; } } local_10 = local_10 + 1; } while( true ); }
5,593
func0
#include <stdio.h> #include <assert.h>
int func0(char list1[][3][2], int list_length, char x) { int ctr = 0; for (int i = 0; i < list_length; i++) { for (int j = 0; j < 3; j++) { if (list1[i][j][0] == x) { ctr++; break; } } } return ctr; }
int main() { char list1[4][3][2] = {{{'1', '\0'}, {'3', '\0'}}, {{'5', '\0'}, {'7', '\0'}}, {{'1', '\0'}, {'1', '1'}}, {{'1', '\0'}, {'1', '5'}, {'7', '\0'}}}; char list2[4][3][2] = {{{'A', '\0'}, {'B', '\0'}}, {{'A', '\0'}, {'C', '\0'}}, {{'A', '\0'}, {'D', '\0'}, {'E', '\0'}}, {{'B', '\0'}, {'C', '\0'}, {'D', '\0'}}}; assert(func0(list1, 4, '1') == 3); assert(func0(list2, 4, 'A') == 3); assert(func0(list2, 4, 'E') == 1); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11a6 <func0+0x3d> mov %rdi,%rax lea -0x1(%rsi),%ecx lea (%rcx,%rcx,2),%rcx lea 0x6(%rdi,%rcx,2),%rsi mov $0x0,%edi jmp 1193 <func0+0x2a> add $0x1,%edi add $0x6,%rax cmp %rsi,%rax je 11ab <func0+0x42> mov %rax,%rcx cmp (%rax),%dl je 1187 <func0+0x1e> cmp 0x2(%rax),%dl je 1187 <func0+0x1e> cmp %dl,0x4(%rcx) jne 118a <func0+0x21> jmp 1187 <func0+0x1e> mov $0x0,%edi mov %edi,%eax retq
func0: endbr64 test esi, esi jle short loc_11A6 mov rax, rdi lea ecx, [rsi-1] lea rcx, [rcx+rcx*2] lea rsi, [rdi+rcx*2+6] mov edi, 0 jmp short loc_1193 loc_1187: add edi, 1 loc_118A: add rax, 6 cmp rax, rsi jz short loc_11AB loc_1193: mov rcx, rax cmp dl, [rax] jz short loc_1187 cmp dl, [rax+2] jz short loc_1187 cmp [rcx+4], dl jnz short loc_118A jmp short loc_1187 loc_11A6: mov edi, 0 loc_11AB: mov eax, edi retn
long long func0(_BYTE *a1, int a2, char a3) { _BYTE *v3; // rax long long v4; // rsi unsigned int v5; // edi if ( a2 <= 0 ) { return 0; } else { v3 = a1; v4 = (long long)&a1[6 * (a2 - 1) + 6]; v5 = 0; do { if ( a3 == *v3 || a3 == v3[2] || v3[4] == a3 ) ++v5; v3 += 6; } while ( v3 != (_BYTE *)v4 ); } return v5; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001011a6 MOV RAX,RDI LEA ECX,[RSI + -0x1] LEA RCX,[RCX + RCX*0x2] LEA RSI,[RDI + RCX*0x2 + 0x6] MOV EDI,0x0 JMP 0x00101193 LAB_00101187: ADD EDI,0x1 LAB_0010118a: ADD RAX,0x6 CMP RAX,RSI JZ 0x001011ab LAB_00101193: MOV RCX,RAX CMP DL,byte ptr [RAX] JZ 0x00101187 CMP DL,byte ptr [RAX + 0x2] JZ 0x00101187 CMP byte ptr [RCX + 0x4],DL JNZ 0x0010118a JMP 0x00101187 LAB_001011a6: MOV EDI,0x0 LAB_001011ab: MOV EAX,EDI RET
int func0(char *param_1,int param_2,char param_3) { char *pcVar1; int iVar2; if (param_2 < 1) { iVar2 = 0; } else { pcVar1 = param_1 + (ulong)(param_2 - 1) * 6 + 6; iVar2 = 0; do { if (((param_3 == *param_1) || (param_3 == param_1[2])) || (param_1[4] == param_3)) { iVar2 = iVar2 + 1; } param_1 = param_1 + 6; } while (param_1 != pcVar1); } return iVar2; }
5,594
func0
#include <stdio.h> #include <assert.h>
int func0(char list1[][3][2], int list_length, char x) { int ctr = 0; for (int i = 0; i < list_length; i++) { for (int j = 0; j < 3; j++) { if (list1[i][j][0] == x) { ctr++; break; } } } return ctr; }
int main() { char list1[4][3][2] = {{{'1', '\0'}, {'3', '\0'}}, {{'5', '\0'}, {'7', '\0'}}, {{'1', '\0'}, {'1', '1'}}, {{'1', '\0'}, {'1', '5'}, {'7', '\0'}}}; char list2[4][3][2] = {{{'A', '\0'}, {'B', '\0'}}, {{'A', '\0'}, {'C', '\0'}}, {{'A', '\0'}, {'D', '\0'}, {'E', '\0'}}, {{'B', '\0'}, {'C', '\0'}, {'D', '\0'}}}; assert(func0(list1, 4, '1') == 3); assert(func0(list2, 4, 'A') == 3); assert(func0(list2, 4, 'E') == 1); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1386 <func0+0x46> lea -0x1(%rsi),%eax xor %r8d,%r8d lea (%rax,%rax,2),%rax lea 0x6(%rdi,%rax,2),%rax nopw 0x0(%rax,%rax,1) cmp (%rdi),%dl je 1380 <func0+0x40> cmp 0x2(%rdi),%dl je 1380 <func0+0x40> cmp %dl,0x4(%rdi) je 1380 <func0+0x40> add $0x6,%rdi cmp %rax,%rdi jne 1360 <func0+0x20> mov %r8d,%eax retq nopl 0x0(%rax,%rax,1) add $0x1,%r8d jmp 136e <func0+0x2e> xor %r8d,%r8d mov %r8d,%eax retq nopl (%rax)
func0: endbr64 test esi, esi jle short loc_1306 lea eax, [rsi-1] xor r8d, r8d lea rax, [rax+rax*2] lea rax, [rdi+rax*2+6] nop word ptr [rax+rax+00000000h] loc_12E0: cmp dl, [rdi] jz short loc_1300 cmp dl, [rdi+2] jz short loc_1300 cmp [rdi+4], dl jz short loc_1300 loc_12EE: add rdi, 6 cmp rdi, rax jnz short loc_12E0 mov eax, r8d retn loc_1300: add r8d, 1 jmp short loc_12EE loc_1306: xor r8d, r8d mov eax, r8d retn
long long func0(_BYTE *a1, int a2, char a3) { unsigned int v3; // r8d long long v4; // rax if ( a2 <= 0 ) return 0LL; v3 = 0; v4 = (long long)&a1[6 * (a2 - 1) + 6]; do { if ( a3 == *a1 || a3 == a1[2] || a1[4] == a3 ) ++v3; a1 += 6; } while ( a1 != (_BYTE *)v4 ); return v3; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101306 LEA EAX,[RSI + -0x1] XOR R8D,R8D LEA RAX,[RAX + RAX*0x2] LEA RAX,[RDI + RAX*0x2 + 0x6] NOP word ptr [RAX + RAX*0x1] LAB_001012e0: CMP DL,byte ptr [RDI] JZ 0x00101300 CMP DL,byte ptr [RDI + 0x2] JZ 0x00101300 CMP byte ptr [RDI + 0x4],DL JZ 0x00101300 LAB_001012ee: ADD RDI,0x6 CMP RDI,RAX JNZ 0x001012e0 MOV EAX,R8D RET LAB_00101300: ADD R8D,0x1 JMP 0x001012ee LAB_00101306: XOR R8D,R8D MOV EAX,R8D RET
int func0(char *param_1,int param_2,char param_3) { char *pcVar1; int iVar2; if (0 < param_2) { iVar2 = 0; pcVar1 = param_1 + (ulong)(param_2 - 1) * 6 + 6; do { if (((param_3 == *param_1) || (param_3 == param_1[2])) || (param_1[4] == param_3)) { iVar2 = iVar2 + 1; } param_1 = param_1 + 6; } while (param_1 != pcVar1); return iVar2; } return 0; }
5,595
func0
#include <stdio.h> #include <assert.h>
int func0(char list1[][3][2], int list_length, char x) { int ctr = 0; for (int i = 0; i < list_length; i++) { for (int j = 0; j < 3; j++) { if (list1[i][j][0] == x) { ctr++; break; } } } return ctr; }
int main() { char list1[4][3][2] = {{{'1', '\0'}, {'3', '\0'}}, {{'5', '\0'}, {'7', '\0'}}, {{'1', '\0'}, {'1', '1'}}, {{'1', '\0'}, {'1', '5'}, {'7', '\0'}}}; char list2[4][3][2] = {{{'A', '\0'}, {'B', '\0'}}, {{'A', '\0'}, {'C', '\0'}}, {{'A', '\0'}, {'D', '\0'}, {'E', '\0'}}, {{'B', '\0'}, {'C', '\0'}, {'D', '\0'}}}; assert(func0(list1, 4, '1') == 3); assert(func0(list2, 4, 'A') == 3); assert(func0(list2, 4, 'E') == 1); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 1476 <func0+0x46> lea -0x1(%rsi),%eax xor %r8d,%r8d lea (%rax,%rax,2),%rax lea 0x6(%rdi,%rax,2),%rax nopw 0x0(%rax,%rax,1) cmp (%rdi),%dl je 1470 <func0+0x40> cmp 0x2(%rdi),%dl je 1470 <func0+0x40> cmp 0x4(%rdi),%dl je 1470 <func0+0x40> add $0x6,%rdi cmp %rdi,%rax jne 1450 <func0+0x20> mov %r8d,%eax retq nopl 0x0(%rax,%rax,1) add $0x1,%r8d jmp 145e <func0+0x2e> xor %r8d,%r8d mov %r8d,%eax retq nopl (%rax)
func0: endbr64 test esi, esi jle short loc_117D movsxd rsi, esi xor ecx, ecx lea rax, [rsi+rsi*2] lea rax, [rdi+rax*2] nop dword ptr [rax] loc_1158: cmp dl, [rdi] jz short loc_1178 cmp dl, [rdi+2] jz short loc_1178 cmp dl, [rdi+4] jz short loc_1178 loc_1166: add rdi, 6 cmp rax, rdi jnz short loc_1158 mov eax, ecx retn loc_1178: add ecx, 1 jmp short loc_1166 loc_117D: xor ecx, ecx mov eax, ecx retn
long long func0(_BYTE *a1, int a2, char a3) { unsigned int v3; // ecx _BYTE *v4; // rax if ( a2 <= 0 ) return 0LL; v3 = 0; v4 = &a1[6 * a2]; do { if ( a3 == *a1 || a3 == a1[2] || a3 == a1[4] ) ++v3; a1 += 6; } while ( v4 != a1 ); return v3; }
func0: ENDBR64 TEST ESI,ESI JLE 0x0010117d MOVSXD RSI,ESI XOR ECX,ECX LEA RAX,[RSI + RSI*0x2] LEA RAX,[RDI + RAX*0x2] NOP dword ptr [RAX] LAB_00101158: CMP DL,byte ptr [RDI] JZ 0x00101178 CMP DL,byte ptr [RDI + 0x2] JZ 0x00101178 CMP DL,byte ptr [RDI + 0x4] JZ 0x00101178 LAB_00101166: ADD RDI,0x6 CMP RAX,RDI JNZ 0x00101158 MOV EAX,ECX RET LAB_00101178: ADD ECX,0x1 JMP 0x00101166 LAB_0010117d: XOR ECX,ECX MOV EAX,ECX RET
int func0(char *param_1,int param_2,char param_3) { char *pcVar1; int iVar2; if (0 < param_2) { iVar2 = 0; pcVar1 = param_1 + (long)param_2 * 6; do { if (((param_3 == *param_1) || (param_3 == param_1[2])) || (param_3 == param_1[4])) { iVar2 = iVar2 + 1; } param_1 = param_1 + 6; } while (pcVar1 != param_1); return iVar2; } return 0; }
5,596
func0
#include <stdio.h> #include <assert.h>
int* func0(int nums[], int size, int *odd_size) { static int odd_nums[100]; int j = 0; for (int i = 0; i < size; i++) { if (nums[i] % 2 != 0) { odd_nums[j] = nums[i]; j++; } } *odd_size = j; return odd_nums; }
int main() { int odd_size; int array1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int result1[] = {1, 3, 5, 7, 9}; int* filtered1 = func0(array1, 10, &odd_size); assert(odd_size == 5); for (int i = 0; i < odd_size; i++) { assert(filtered1[i] == result1[i]); } int array2[6] = {10, 20, 45, 67, 84, 93}; int result2[] = {45, 67, 93}; int* filtered2 = func0(array2, 6, &odd_size); assert(odd_size == 3); for (int i = 0; i < odd_size; i++) { assert(filtered2[i] == result2[i]); } int array3[7] = {5, 7, 9, 8, 6, 4, 3}; int result3[] = {5, 7, 9, 3}; int* filtered3 = func0(array3, 7, &odd_size); assert(odd_size == 4); for (int i = 0; i < odd_size; i++) { assert(filtered3[i] == result3[i]); } return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %rdx,-0x28(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 11df <func0+0x76> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax and $0x1,%eax test %eax,%eax je 11db <func0+0x72> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov -0x8(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx lea 0x2e6c(%rip),%rdx mov %eax,(%rcx,%rdx,1) addl $0x1,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 118c <func0+0x23> mov -0x28(%rbp),%rax mov -0x8(%rbp),%edx mov %edx,(%rax) lea 0x2e49(%rip),%rax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_28], rdx mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_11DF loc_118C: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] and eax, 1 test eax, eax jz short loc_11DB mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] mov edx, [rbp+var_8] movsxd rdx, edx lea rcx, ds:0[rdx*4] lea rdx, odd_nums_1 mov [rcx+rdx], eax add [rbp+var_8], 1 loc_11DB: add [rbp+var_4], 1 loc_11DF: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_118C mov rax, [rbp+var_28] mov edx, [rbp+var_8] mov [rax], edx lea rax, odd_nums_1 pop rbp retn
_DWORD * func0(long long a1, int a2, _DWORD *a3) { int v4; // [rsp+20h] [rbp-8h] int i; // [rsp+24h] [rbp-4h] v4 = 0; for ( i = 0; i < a2; ++i ) { if ( (*(_DWORD *)(4LL * i + a1) & 1) != 0 ) odd_nums_1[v4++] = *(_DWORD *)(4LL * i + a1); } *a3 = v4; return odd_nums_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011df LAB_0010118c: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] AND EAX,0x1 TEST EAX,EAX JZ 0x001011db MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV EDX,dword ptr [RBP + -0x8] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] LEA RDX,[0x104040] MOV dword ptr [RCX + RDX*0x1],EAX ADD dword ptr [RBP + -0x8],0x1 LAB_001011db: ADD dword ptr [RBP + -0x4],0x1 LAB_001011df: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x0010118c MOV RAX,qword ptr [RBP + -0x28] MOV EDX,dword ptr [RBP + -0x8] MOV dword ptr [RAX],EDX LEA RAX,[0x104040] POP RBP RET
int1 * func0(long param_1,int param_2,int *param_3) { int local_10; int local_c; local_10 = 0; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { if ((*(uint *)(param_1 + (long)local_c * 4) & 1) != 0) { *(int4 *)(odd_nums_1 + (long)local_10 * 4) = *(int4 *)(param_1 + (long)local_c * 4); local_10 = local_10 + 1; } } *param_3 = local_10; return odd_nums_1; }
5,597
func0
#include <stdio.h> #include <assert.h>
int* func0(int nums[], int size, int *odd_size) { static int odd_nums[100]; int j = 0; for (int i = 0; i < size; i++) { if (nums[i] % 2 != 0) { odd_nums[j] = nums[i]; j++; } } *odd_size = j; return odd_nums; }
int main() { int odd_size; int array1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int result1[] = {1, 3, 5, 7, 9}; int* filtered1 = func0(array1, 10, &odd_size); assert(odd_size == 5); for (int i = 0; i < odd_size; i++) { assert(filtered1[i] == result1[i]); } int array2[6] = {10, 20, 45, 67, 84, 93}; int result2[] = {45, 67, 93}; int* filtered2 = func0(array2, 6, &odd_size); assert(odd_size == 3); for (int i = 0; i < odd_size; i++) { assert(filtered2[i] == result2[i]); } int array3[7] = {5, 7, 9, 8, 6, 4, 3}; int result3[] = {5, 7, 9, 3}; int* filtered3 = func0(array3, 7, &odd_size); assert(odd_size == 4); for (int i = 0; i < odd_size; i++) { assert(filtered3[i] == result3[i]); } return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11a6 <func0+0x3d> mov %rdi,%rax lea -0x1(%rsi),%ecx lea 0x4(%rdi,%rcx,4),%rdi mov $0x0,%esi lea 0x2eb8(%rip),%r9 jmp 1193 <func0+0x2a> add $0x4,%rax cmp %rdi,%rax je 11ab <func0+0x42> mov (%rax),%ecx test $0x1,%cl je 118a <func0+0x21> movslq %esi,%r8 mov %ecx,(%r9,%r8,4) add $0x1,%esi jmp 118a <func0+0x21> mov $0x0,%esi mov %esi,(%rdx) lea 0x2e8c(%rip),%rax retq
func0: endbr64 test esi, esi jle short loc_11A6 mov rax, rdi lea ecx, [rsi-1] lea rdi, [rdi+rcx*4+4] mov esi, 0 lea r9, odd_nums_1 jmp short loc_1193 loc_118A: add rax, 4 cmp rax, rdi jz short loc_11AB loc_1193: mov ecx, [rax] test cl, 1 jz short loc_118A movsxd r8, esi mov [r9+r8*4], ecx add esi, 1 jmp short loc_118A loc_11A6: mov esi, 0 loc_11AB: mov [rdx], esi lea rax, odd_nums_1 retn
_DWORD * func0(_DWORD *a1, int a2, _DWORD *a3) { _DWORD *v3; // rax long long v4; // rdi int v5; // esi if ( a2 <= 0 ) { v5 = 0; } else { v3 = a1; v4 = (long long)&a1[a2 - 1 + 1]; v5 = 0; do { if ( (*v3 & 1) != 0 ) odd_nums_1[v5++] = *v3; ++v3; } while ( v3 != (_DWORD *)v4 ); } *a3 = v5; return odd_nums_1; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001011a6 MOV RAX,RDI LEA ECX,[RSI + -0x1] LEA RDI,[RDI + RCX*0x4 + 0x4] MOV ESI,0x0 LEA R9,[0x104040] JMP 0x00101193 LAB_0010118a: ADD RAX,0x4 CMP RAX,RDI JZ 0x001011ab LAB_00101193: MOV ECX,dword ptr [RAX] TEST CL,0x1 JZ 0x0010118a MOVSXD R8,ESI MOV dword ptr [R9 + R8*0x4],ECX ADD ESI,0x1 JMP 0x0010118a LAB_001011a6: MOV ESI,0x0 LAB_001011ab: MOV dword ptr [RDX],ESI LEA RAX,[0x104040] RET
int4 * func0(uint *param_1,int param_2,int *param_3) { uint *puVar1; int iVar2; if (param_2 < 1) { iVar2 = 0; } else { puVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar2 = 0; do { if ((*param_1 & 1) != 0) { (&odd_nums_1)[iVar2] = *param_1; iVar2 = iVar2 + 1; } param_1 = param_1 + 1; } while (param_1 != puVar1); } *param_3 = iVar2; return &odd_nums_1; }
5,598
func0
#include <stdio.h> #include <assert.h>
int* func0(int nums[], int size, int *odd_size) { static int odd_nums[100]; int j = 0; for (int i = 0; i < size; i++) { if (nums[i] % 2 != 0) { odd_nums[j] = nums[i]; j++; } } *odd_size = j; return odd_nums; }
int main() { int odd_size; int array1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int result1[] = {1, 3, 5, 7, 9}; int* filtered1 = func0(array1, 10, &odd_size); assert(odd_size == 5); for (int i = 0; i < odd_size; i++) { assert(filtered1[i] == result1[i]); } int array2[6] = {10, 20, 45, 67, 84, 93}; int result2[] = {45, 67, 93}; int* filtered2 = func0(array2, 6, &odd_size); assert(odd_size == 3); for (int i = 0; i < odd_size; i++) { assert(filtered2[i] == result2[i]); } int array3[7] = {5, 7, 9, 8, 6, 4, 3}; int result3[] = {5, 7, 9, 3}; int* filtered3 = func0(array3, 7, &odd_size); assert(odd_size == 4); for (int i = 0; i < odd_size; i++) { assert(filtered3[i] == result3[i]); } return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 14b8 <func0+0x48> lea -0x1(%rsi),%eax xor %ecx,%ecx lea 0x2bbc(%rip),%r9 lea 0x4(%rdi,%rax,4),%rsi nopl 0x0(%rax) mov (%rdi),%eax test $0x1,%al je 14a0 <func0+0x30> movslq %ecx,%r8 add $0x1,%ecx mov %eax,(%r9,%r8,4) add $0x4,%rdi cmp %rsi,%rdi jne 1490 <func0+0x20> mov %ecx,(%rdx) lea 0x2b8e(%rip),%rax retq nopl 0x0(%rax,%rax,1) xor %ecx,%ecx lea 0x2b7f(%rip),%rax mov %ecx,(%rdx) retq nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 test esi, esi jle short loc_1460 lea eax, [rsi-1] xor ecx, ecx lea r9, odd_nums_1 lea rsi, [rdi+rax*4+4] nop dword ptr [rax+00000000h] loc_1440: mov eax, [rdi] test al, 1 jz short loc_1450 movsxd r8, ecx add ecx, 1 mov [r9+r8*4], eax loc_1450: add rdi, 4 cmp rdi, rsi jnz short loc_1440 mov [rdx], ecx mov rax, r9 retn loc_1460: xor ecx, ecx lea r9, odd_nums_1 mov [rdx], ecx mov rax, r9 retn
_DWORD * func0(_DWORD *a1, int a2, _DWORD *a3) { int v3; // ecx long long v4; // rsi long long v5; // r8 if ( a2 <= 0 ) { *a3 = 0; return odd_nums_1; } else { v3 = 0; v4 = (long long)&a1[a2 - 1 + 1]; do { if ( (*a1 & 1) != 0 ) { v5 = v3++; odd_nums_1[v5] = *a1; } ++a1; } while ( a1 != (_DWORD *)v4 ); *a3 = v3; return odd_nums_1; } }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101460 LEA EAX,[RSI + -0x1] XOR ECX,ECX LEA R9,[0x104040] LEA RSI,[RDI + RAX*0x4 + 0x4] NOP dword ptr [RAX] LAB_00101440: MOV EAX,dword ptr [RDI] TEST AL,0x1 JZ 0x00101450 MOVSXD R8,ECX ADD ECX,0x1 MOV dword ptr [R9 + R8*0x4],EAX LAB_00101450: ADD RDI,0x4 CMP RDI,RSI JNZ 0x00101440 MOV dword ptr [RDX],ECX MOV RAX,R9 RET LAB_00101460: XOR ECX,ECX LEA R9,[0x104040] MOV dword ptr [RDX],ECX MOV RAX,R9 RET
int4 * func0(uint *param_1,int param_2,int *param_3) { uint *puVar1; int iVar2; long lVar3; if (0 < param_2) { iVar2 = 0; puVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if ((*param_1 & 1) != 0) { lVar3 = (long)iVar2; iVar2 = iVar2 + 1; (&odd_nums_1)[lVar3] = *param_1; } param_1 = param_1 + 1; } while (param_1 != puVar1); *param_3 = iVar2; return &odd_nums_1; } *param_3 = 0; return &odd_nums_1; }
5,599
func0
#include <stdio.h> #include <assert.h>
int* func0(int nums[], int size, int *odd_size) { static int odd_nums[100]; int j = 0; for (int i = 0; i < size; i++) { if (nums[i] % 2 != 0) { odd_nums[j] = nums[i]; j++; } } *odd_size = j; return odd_nums; }
int main() { int odd_size; int array1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int result1[] = {1, 3, 5, 7, 9}; int* filtered1 = func0(array1, 10, &odd_size); assert(odd_size == 5); for (int i = 0; i < odd_size; i++) { assert(filtered1[i] == result1[i]); } int array2[6] = {10, 20, 45, 67, 84, 93}; int result2[] = {45, 67, 93}; int* filtered2 = func0(array2, 6, &odd_size); assert(odd_size == 3); for (int i = 0; i < odd_size; i++) { assert(filtered2[i] == result2[i]); } int array3[7] = {5, 7, 9, 8, 6, 4, 3}; int result3[] = {5, 7, 9, 3}; int* filtered3 = func0(array3, 7, &odd_size); assert(odd_size == 4); for (int i = 0; i < odd_size; i++) { assert(filtered3[i] == result3[i]); } return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 1508 <func0+0x48> lea -0x1(%rsi),%eax xor %ecx,%ecx lea 0x2b6c(%rip),%r9 lea 0x4(%rdi,%rax,4),%rsi nopl 0x0(%rax) mov (%rdi),%eax test $0x1,%al je 14f0 <func0+0x30> movslq %ecx,%r8 add $0x1,%ecx mov %eax,(%r9,%r8,4) add $0x4,%rdi cmp %rsi,%rdi jne 14e0 <func0+0x20> mov %ecx,(%rdx) lea 0x2b3e(%rip),%rax retq nopl 0x0(%rax,%rax,1) xor %ecx,%ecx lea 0x2b2f(%rip),%rax mov %ecx,(%rdx) retq nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 test esi, esi jle short loc_1190 movsxd rsi, esi xor ecx, ecx lea r9, odd_nums_1 lea rsi, [rdi+rsi*4] nop dword ptr [rax+rax+00000000h] loc_1170: mov eax, [rdi] test al, 1 jz short loc_1180 movsxd r8, ecx add ecx, 1 mov [r9+r8*4], eax loc_1180: add rdi, 4 cmp rdi, rsi jnz short loc_1170 mov [rdx], ecx mov rax, r9 retn loc_1190: xor ecx, ecx lea r9, odd_nums_1 mov [rdx], ecx mov rax, r9 retn
__int128 * func0(_DWORD *a1, int a2, _DWORD *a3) { int v3; // ecx _DWORD *v4; // rsi long long v5; // r8 if ( a2 <= 0 ) { *a3 = 0; return &odd_nums_1; } else { v3 = 0; v4 = &a1[a2]; do { if ( (*a1 & 1) != 0 ) { v5 = v3++; *((_DWORD *)&odd_nums_1 + v5) = *a1; } ++a1; } while ( a1 != v4 ); *a3 = v3; return &odd_nums_1; } }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101190 MOVSXD RSI,ESI XOR ECX,ECX LEA R9,[0x104040] LEA RSI,[RDI + RSI*0x4] NOP dword ptr [RAX + RAX*0x1] LAB_00101170: MOV EAX,dword ptr [RDI] TEST AL,0x1 JZ 0x00101180 MOVSXD R8,ECX ADD ECX,0x1 MOV dword ptr [R9 + R8*0x4],EAX LAB_00101180: ADD RDI,0x4 CMP RDI,RSI JNZ 0x00101170 MOV dword ptr [RDX],ECX MOV RAX,R9 RET LAB_00101190: XOR ECX,ECX LEA R9,[0x104040] MOV dword ptr [RDX],ECX MOV RAX,R9 RET
int4 * func0(uint *param_1,int param_2,int *param_3) { uint *puVar1; int iVar2; long lVar3; if (0 < param_2) { iVar2 = 0; puVar1 = param_1 + param_2; do { if ((*param_1 & 1) != 0) { lVar3 = (long)iVar2; iVar2 = iVar2 + 1; (&odd_nums_1)[lVar3] = *param_1; } param_1 = param_1 + 1; } while (param_1 != puVar1); *param_3 = iVar2; return &odd_nums_1; } *param_3 = 0; return &odd_nums_1; }
5,600
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(const char* dt) { static char new_date[11]; int year, month, day; sscanf(dt, "%4d-%2d-%2d", &year, &month, &day); sprintf(new_date, "%02d-%02d-%4d", day, month, year); return new_date; }
int main() { assert(strcmp(func0("2026-01-02"), "02-01-2026") == 0); assert(strcmp(func0("2020-11-13"), "13-11-2020") == 0); assert(strcmp(func0("2021-04-26"), "26-04-2021") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x28(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea -0xc(%rbp),%rsi lea -0x10(%rbp),%rcx lea -0x14(%rbp),%rdx mov -0x28(%rbp),%rax mov %rsi,%r8 lea 0xe06(%rip),%rsi mov %rax,%rdi mov $0x0,%eax callq 10c0 <__isoc99_sscanf@plt> mov -0x14(%rbp),%ecx mov -0x10(%rbp),%edx mov -0xc(%rbp),%eax mov %ecx,%r8d mov %edx,%ecx mov %eax,%edx lea 0xdee(%rip),%rsi lea 0x2deb(%rip),%rdi mov $0x0,%eax callq 10d0 <sprintf@plt> lea 0x2dda(%rip),%rax mov -0x8(%rbp),%rdi xor %fs:0x28,%rdi je 1252 <func0+0x89> callq 1090 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_28], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea rsi, [rbp+var_C] lea rcx, [rbp+var_10] lea rdx, [rbp+var_14] mov rax, [rbp+var_28] mov r8, rsi lea rsi, a4d2d2d; "%4d-%2d-%2d" mov rdi, rax mov eax, 0 call ___isoc99_sscanf mov ecx, [rbp+var_14] mov edx, [rbp+var_10] mov eax, [rbp+var_C] mov r8d, ecx mov ecx, edx mov edx, eax lea rax, format; "%02d-%02d-%4d" mov rsi, rax; format lea rax, new_date_1 mov rdi, rax; s mov eax, 0 call _sprintf lea rax, new_date_1 mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_1258 call ___stack_chk_fail locret_1258: leave retn
char * func0(long long a1) { int v2; // [rsp+1Ch] [rbp-14h] BYREF int v3; // [rsp+20h] [rbp-10h] BYREF int v4; // [rsp+24h] [rbp-Ch] BYREF unsigned long long v5; // [rsp+28h] [rbp-8h] v5 = __readfsqword(0x28u); __isoc99_sscanf(a1, "%4d-%2d-%2d", &v2, &v3, &v4); sprintf(new_date_1, "%02d-%02d-%4d", v4, v3, v2); return new_date_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x28],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX LEA RSI,[RBP + -0xc] LEA RCX,[RBP + -0x10] LEA RDX,[RBP + -0x14] MOV RAX,qword ptr [RBP + -0x28] MOV R8,RSI LEA RSI,[0x102008] MOV RDI,RAX MOV EAX,0x0 CALL 0x001010c0 MOV ECX,dword ptr [RBP + -0x14] MOV EDX,dword ptr [RBP + -0x10] MOV EAX,dword ptr [RBP + -0xc] MOV R8D,ECX MOV ECX,EDX MOV EDX,EAX LEA RAX,[0x102014] MOV RSI,RAX LEA RAX,[0x104018] MOV RDI,RAX MOV EAX,0x0 CALL 0x001010d0 LEA RAX,[0x104018] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x00101258 CALL 0x00101090 LAB_00101258: LEAVE RET
int1 * func0(int8 param_1) { long in_FS_OFFSET; uint local_1c; uint local_18; uint local_14; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); __isoc99_sscanf(param_1,"%4d-%2d-%2d",&local_1c,&local_18,&local_14); sprintf(new_date_1,"%02d-%02d-%4d",(ulong)local_14,(ulong)local_18,(ulong)local_1c); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return new_date_1; }
5,601
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(const char* dt) { static char new_date[11]; int year, month, day; sscanf(dt, "%4d-%2d-%2d", &year, &month, &day); sprintf(new_date, "%02d-%02d-%4d", day, month, year); return new_date; }
int main() { assert(strcmp(func0("2026-01-02"), "02-01-2026") == 0); assert(strcmp(func0("2020-11-13"), "13-11-2020") == 0); assert(strcmp(func0("2021-04-26"), "26-04-2021") == 0); return 0; }
O1
c
func0: endbr64 push %rbx sub $0x20,%rsp mov $0x28,%ebx mov %fs:(%rbx),%rax mov %rax,0x18(%rsp) xor %eax,%eax lea 0x10(%rsp),%rcx lea 0xc(%rsp),%rdx lea 0x14(%rsp),%r8 lea 0xe2c(%rip),%rsi callq 10a0 <__isoc99_sscanf@plt> sub $0x8,%rsp mov 0x14(%rsp),%eax push %rax mov 0x20(%rsp),%r9d mov 0x24(%rsp),%r8d lea 0xe19(%rip),%rcx mov $0xb,%edx mov $0x1,%esi lea 0x2e10(%rip),%rdi mov $0x0,%eax callq 10b0 <__sprintf_chk@plt> add $0x10,%rsp mov 0x18(%rsp),%rax xor %fs:(%rbx),%rax jne 122e <func0+0x85> lea 0x2df0(%rip),%rax add $0x20,%rsp pop %rbx retq callq 1080 <__stack_chk_fail@plt>
func0: endbr64 push rbx sub rsp, 20h mov rax, fs:28h mov [rsp+28h+var_10], rax xor eax, eax lea rcx, [rsp+28h+var_18] lea rdx, [rsp+28h+var_1C] lea r8, [rsp+28h+var_14] lea rsi, a4d2d2d; "%4d-%2d-%2d" call ___isoc99_sscanf sub rsp, 8 mov eax, [rsp+30h+var_1C] push rax mov r9d, [rsp+38h+var_18] mov r8d, [rsp+38h+var_14] lea rcx, a02d02d4d; "%02d-%02d-%4d" mov edx, 0Bh mov esi, 1 lea rbx, new_date_1 mov rdi, rbx mov eax, 0 call ___sprintf_chk add rsp, 10h mov rax, [rsp+28h+var_10] sub rax, fs:28h jnz short loc_1252 mov rax, rbx add rsp, 20h pop rbx retn loc_1252: call ___stack_chk_fail
void * func0(long long a1) { int v2; // [rsp+Ch] [rbp-1Ch] BYREF int v3; // [rsp+10h] [rbp-18h] BYREF int v4; // [rsp+14h] [rbp-14h] BYREF unsigned long long v5; // [rsp+18h] [rbp-10h] v5 = __readfsqword(0x28u); __isoc99_sscanf(a1, "%4d-%2d-%2d", &v2, &v3, &v4); __sprintf_chk(&new_date_1, 1LL, 11LL, "%02d-%02d-%4d", v4, v3, v2); return &new_date_1; }
func0: ENDBR64 PUSH RBX SUB RSP,0x20 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x18],RAX XOR EAX,EAX LEA RCX,[RSP + 0x10] LEA RDX,[RSP + 0xc] LEA R8,[RSP + 0x14] LEA RSI,[0x102004] CALL 0x001010c0 SUB RSP,0x8 MOV EAX,dword ptr [RSP + 0x14] PUSH RAX MOV R9D,dword ptr [RSP + 0x20] MOV R8D,dword ptr [RSP + 0x24] LEA RCX,[0x102010] MOV EDX,0xb MOV ESI,0x1 LEA RBX,[0x104018] MOV RDI,RBX MOV EAX,0x0 CALL 0x001010d0 ADD RSP,0x10 MOV RAX,qword ptr [RSP + 0x18] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101252 MOV RAX,RBX ADD RSP,0x20 POP RBX RET LAB_00101252: CALL 0x00101090
int1 * func0(int8 param_1) { long in_FS_OFFSET; int4 local_1c; int4 local_18; int4 local_14; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); __isoc99_sscanf(param_1,"%4d-%2d-%2d",&local_1c,&local_18,&local_14); __sprintf_chk(new_date_1,1,0xb,"%02d-%02d-%4d",local_14,local_18,local_1c); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return new_date_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,602
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(const char* dt) { static char new_date[11]; int year, month, day; sscanf(dt, "%4d-%2d-%2d", &year, &month, &day); sprintf(new_date, "%02d-%02d-%4d", day, month, year); return new_date; }
int main() { assert(strcmp(func0("2026-01-02"), "02-01-2026") == 0); assert(strcmp(func0("2020-11-13"), "13-11-2020") == 0); assert(strcmp(func0("2021-04-26"), "26-04-2021") == 0); return 0; }
O2
c
func0: endbr64 sub $0x28,%rsp lea 0xd65(%rip),%rsi mov %fs:0x28,%rax mov %rax,0x18(%rsp) xor %eax,%eax lea 0x10(%rsp),%rcx lea 0xc(%rsp),%rdx lea 0x14(%rsp),%r8 callq 10a0 <__isoc99_sscanf@plt> sub $0x8,%rsp mov $0xb,%edx lea 0xd3d(%rip),%rcx mov 0x14(%rsp),%eax mov $0x1,%esi lea 0x2d35(%rip),%rdi push %rax mov 0x20(%rsp),%r9d xor %eax,%eax mov 0x24(%rsp),%r8d callq 10b0 <__sprintf_chk@plt> pop %rax pop %rdx mov 0x18(%rsp),%rax xor %fs:0x28,%rax jne 1313 <func0+0x83> lea 0x2d0a(%rip),%rax add $0x28,%rsp retq callq 1080 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r12 lea rsi, a4d2d2d; "%4d-%2d-%2d" lea r12, new_date_1 sub rsp, 20h mov rax, fs:28h mov [rsp+28h+var_10], rax xor eax, eax lea rcx, [rsp+28h+var_18] lea rdx, [rsp+28h+var_1C] lea r8, [rsp+28h+var_14] call ___isoc99_sscanf sub rsp, 8 mov edx, 0Bh mov rdi, r12 mov eax, [rsp+30h+var_1C] lea rcx, a02d02d4d; "%02d-%02d-%4d" mov esi, 1 push rax mov r9d, [rsp+38h+var_18] xor eax, eax mov r8d, [rsp+38h+var_14] call ___sprintf_chk pop rax pop rdx mov rax, [rsp+28h+var_10] sub rax, fs:28h jnz short loc_1326 add rsp, 20h mov rax, r12 pop r12 retn loc_1326: call ___stack_chk_fail
void * func0(long long a1) { int v2; // [rsp+Ch] [rbp-1Ch] BYREF int v3; // [rsp+10h] [rbp-18h] BYREF int v4; // [rsp+14h] [rbp-14h] BYREF unsigned long long v5; // [rsp+18h] [rbp-10h] v5 = __readfsqword(0x28u); __isoc99_sscanf(a1, "%4d-%2d-%2d", &v2, &v3, &v4); __sprintf_chk(&new_date_1, 1LL, 11LL, "%02d-%02d-%4d", v4, v3, v2); return &new_date_1; }
func0: ENDBR64 PUSH R12 LEA RSI,[0x102004] LEA R12,[0x104018] SUB RSP,0x20 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x18],RAX XOR EAX,EAX LEA RCX,[RSP + 0x10] LEA RDX,[RSP + 0xc] LEA R8,[RSP + 0x14] CALL 0x001010c0 SUB RSP,0x8 MOV EDX,0xb MOV RDI,R12 MOV EAX,dword ptr [RSP + 0x14] LEA RCX,[0x102010] MOV ESI,0x1 PUSH RAX MOV R9D,dword ptr [RSP + 0x20] XOR EAX,EAX MOV R8D,dword ptr [RSP + 0x24] CALL 0x001010d0 POP RAX POP RDX MOV RAX,qword ptr [RSP + 0x18] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101326 ADD RSP,0x20 MOV RAX,R12 POP R12 RET LAB_00101326: CALL 0x00101090
int1 * func0(int8 param_1) { long in_FS_OFFSET; int4 local_1c; int4 local_18; int4 local_14; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); __isoc99_sscanf(param_1,"%4d-%2d-%2d",&local_1c,&local_18,&local_14); __sprintf_chk(new_date_1,1,0xb,"%02d-%02d-%4d",local_14,local_18,local_1c); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return new_date_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,603
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(const char* dt) { static char new_date[11]; int year, month, day; sscanf(dt, "%4d-%2d-%2d", &year, &month, &day); sprintf(new_date, "%02d-%02d-%4d", day, month, year); return new_date; }
int main() { assert(strcmp(func0("2026-01-02"), "02-01-2026") == 0); assert(strcmp(func0("2020-11-13"), "13-11-2020") == 0); assert(strcmp(func0("2021-04-26"), "26-04-2021") == 0); return 0; }
O3
c
func0: endbr64 sub $0x28,%rsp lea 0xd65(%rip),%rsi mov %fs:0x28,%rax mov %rax,0x18(%rsp) xor %eax,%eax lea 0x10(%rsp),%rcx lea 0xc(%rsp),%rdx lea 0x14(%rsp),%r8 callq 10a0 <__isoc99_sscanf@plt> sub $0x8,%rsp mov $0xb,%edx lea 0xd3d(%rip),%rcx mov 0x14(%rsp),%eax mov $0x1,%esi lea 0x2d35(%rip),%rdi push %rax mov 0x20(%rsp),%r9d xor %eax,%eax mov 0x24(%rsp),%r8d callq 10b0 <__sprintf_chk@plt> pop %rax pop %rdx mov 0x18(%rsp),%rax xor %fs:0x28,%rax jne 1313 <func0+0x83> lea 0x2d0a(%rip),%rax add $0x28,%rsp retq callq 1080 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push rbx lea rsi, a4d2d2d; "%4d-%2d-%2d" lea rbx, new_date_1 sub rsp, 20h mov rax, fs:28h mov [rsp+28h+var_10], rax xor eax, eax lea rcx, [rsp+28h+var_18] lea rdx, [rsp+28h+var_1C] lea r8, [rsp+28h+var_14] call ___isoc99_sscanf sub rsp, 8 mov edx, 0Bh mov rdi, rbx mov eax, [rsp+30h+var_1C] lea rcx, a02d02d4d; "%02d-%02d-%4d" mov esi, 2 push rax mov r9d, [rsp+38h+var_18] xor eax, eax mov r8d, [rsp+38h+var_14] call ___sprintf_chk pop rax pop rdx mov rax, [rsp+28h+var_10] sub rax, fs:28h jnz short loc_1324 add rsp, 20h mov rax, rbx pop rbx retn loc_1324: call ___stack_chk_fail
void * func0(long long a1) { int v2; // [rsp+Ch] [rbp-1Ch] BYREF int v3; // [rsp+10h] [rbp-18h] BYREF int v4; // [rsp+14h] [rbp-14h] BYREF unsigned long long v5; // [rsp+18h] [rbp-10h] v5 = __readfsqword(0x28u); __isoc99_sscanf(a1, "%4d-%2d-%2d", &v2, &v3, &v4); __sprintf_chk(&new_date_1, 2LL, 11LL, "%02d-%02d-%4d", v4, v3, v2); return &new_date_1; }
func0: ENDBR64 PUSH RBX LEA RSI,[0x102004] LEA RBX,[0x104018] SUB RSP,0x20 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x18],RAX XOR EAX,EAX LEA RCX,[RSP + 0x10] LEA RDX,[RSP + 0xc] LEA R8,[RSP + 0x14] CALL 0x001010c0 SUB RSP,0x8 MOV EDX,0xb MOV RDI,RBX MOV EAX,dword ptr [RSP + 0x14] LEA RCX,[0x102010] MOV ESI,0x2 PUSH RAX MOV R9D,dword ptr [RSP + 0x20] XOR EAX,EAX MOV R8D,dword ptr [RSP + 0x24] CALL 0x001010d0 POP RAX POP RDX MOV RAX,qword ptr [RSP + 0x18] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101324 ADD RSP,0x20 MOV RAX,RBX POP RBX RET LAB_00101324: CALL 0x00101090
int1 * func0(int8 param_1) { long in_FS_OFFSET; int4 local_1c; int4 local_18; int4 local_14; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); __isoc99_sscanf(param_1,"%4d-%2d-%2d",&local_1c,&local_18,&local_14); __sprintf_chk(new_date_1,2,0xb,"%02d-%02d-%4d",local_14,local_18,local_1c); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return new_date_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,604
func0
#include <assert.h>
void func0(int my_list[], int length) { int gap = length / 2; while (gap > 0) { for (int i = gap; i < length; i++) { int current_item = my_list[i]; int j = i; while (j >= gap && my_list[j - gap] > current_item) { my_list[j] = my_list[j - gap]; j -= gap; } my_list[j] = current_item; } gap /= 2; } }
int main() { int list1[] = {12, 23, 4, 5, 3, 2, 12, 81, 56, 95}; int list2[] = {24, 22, 39, 34, 87, 73, 68}; int list3[] = {32, 30, 16, 96, 82, 83, 74}; func0(list1, 10); func0(list2, 7); func0(list3, 7); int sorted1[] = {2, 3, 4, 5, 12, 12, 23, 56, 81, 95}; int sorted2[] = {22, 24, 34, 39, 68, 73, 87}; int sorted3[] = {16, 30, 32, 74, 82, 83, 96}; for (int i = 0; i < 10; i++) { assert(list1[i] == sorted1[i]); } for (int i = 0; i < 7; i++) { assert(list2[i] == sorted2[i]); } for (int i = 0; i < 7; i++) { assert(list3[i] == sorted3[i]); } return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov -0x1c(%rbp),%eax mov %eax,%edx shr $0x1f,%edx add %edx,%eax sar %eax mov %eax,-0x10(%rbp) jmpq 124c <func0+0xe3> mov -0x10(%rbp),%eax mov %eax,-0xc(%rbp) jmpq 1231 <func0+0xc8> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov %eax,-0x4(%rbp) mov -0xc(%rbp),%eax mov %eax,-0x8(%rbp) jmp 11ee <func0+0x85> mov -0x8(%rbp),%eax sub -0x10(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0x8(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x18(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) mov -0x10(%rbp),%eax sub %eax,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x10(%rbp),%eax jl 1214 <func0+0xab> mov -0x8(%rbp),%eax sub -0x10(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax cmp %eax,-0x4(%rbp) jl 11b8 <func0+0x4f> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rax,%rdx mov -0x4(%rbp),%eax mov %eax,(%rdx) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1197 <func0+0x2e> mov -0x10(%rbp),%eax mov %eax,%edx shr $0x1f,%edx add %edx,%eax sar %eax mov %eax,-0x10(%rbp) cmpl $0x0,-0x10(%rbp) jg 118c <func0+0x23> pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov eax, [rbp+var_1C] mov edx, eax shr edx, 1Fh add eax, edx sar eax, 1 mov [rbp+var_10], eax jmp loc_124C loc_118C: mov eax, [rbp+var_10] mov [rbp+var_C], eax jmp loc_1231 loc_1197: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] mov [rbp+var_4], eax mov eax, [rbp+var_C] mov [rbp+var_8], eax jmp short loc_11EE loc_11B8: mov eax, [rbp+var_8] sub eax, [rbp+var_10] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rbp+var_8] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+var_18] add rdx, rcx mov eax, [rax] mov [rdx], eax mov eax, [rbp+var_10] sub [rbp+var_8], eax loc_11EE: mov eax, [rbp+var_8] cmp eax, [rbp+var_10] jl short loc_1214 mov eax, [rbp+var_8] sub eax, [rbp+var_10] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] cmp [rbp+var_4], eax jl short loc_11B8 loc_1214: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rdx, rax mov eax, [rbp+var_4] mov [rdx], eax add [rbp+var_C], 1 loc_1231: mov eax, [rbp+var_C] cmp eax, [rbp+var_1C] jl loc_1197 mov eax, [rbp+var_10] mov edx, eax shr edx, 1Fh add eax, edx sar eax, 1 mov [rbp+var_10], eax loc_124C: cmp [rbp+var_10], 0 jg loc_118C nop nop pop rbp retn
long long func0(long long a1, int a2) { long long result; // rax int i; // [rsp+Ch] [rbp-10h] int j; // [rsp+10h] [rbp-Ch] int k; // [rsp+14h] [rbp-8h] int v6; // [rsp+18h] [rbp-4h] result = (unsigned int)(a2 / 2); for ( i = a2 / 2; i > 0; i /= 2 ) { for ( j = i; j < a2; ++j ) { v6 = *(_DWORD *)(4LL * j + a1); for ( k = j; k >= i && v6 < *(_DWORD *)(4LL * (k - i) + a1); k -= i ) *(_DWORD *)(4LL * k + a1) = *(_DWORD *)(4LL * (k - i) + a1); *(_DWORD *)(a1 + 4LL * k) = v6; } result = (unsigned int)(i / 2); } return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV EAX,dword ptr [RBP + -0x1c] MOV EDX,EAX SHR EDX,0x1f ADD EAX,EDX SAR EAX,0x1 MOV dword ptr [RBP + -0x10],EAX JMP 0x0010124c LAB_0010118c: MOV EAX,dword ptr [RBP + -0x10] MOV dword ptr [RBP + -0xc],EAX JMP 0x00101231 LAB_00101197: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0xc] MOV dword ptr [RBP + -0x8],EAX JMP 0x001011ee LAB_001011b8: MOV EAX,dword ptr [RBP + -0x8] SUB EAX,dword ptr [RBP + -0x10] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0x8] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x18] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX MOV EAX,dword ptr [RBP + -0x10] SUB dword ptr [RBP + -0x8],EAX LAB_001011ee: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x10] JL 0x00101214 MOV EAX,dword ptr [RBP + -0x8] SUB EAX,dword ptr [RBP + -0x10] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x4],EAX JL 0x001011b8 LAB_00101214: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x4] MOV dword ptr [RDX],EAX ADD dword ptr [RBP + -0xc],0x1 LAB_00101231: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101197 MOV EAX,dword ptr [RBP + -0x10] MOV EDX,EAX SHR EDX,0x1f ADD EAX,EDX SAR EAX,0x1 MOV dword ptr [RBP + -0x10],EAX LAB_0010124c: CMP dword ptr [RBP + -0x10],0x0 JG 0x0010118c NOP NOP POP RBP RET
void func0(long param_1,int param_2) { int iVar1; int4 local_18; int4 local_14; int4 local_10; for (local_18 = param_2 / 2; 0 < local_18; local_18 = local_18 / 2) { for (local_14 = local_18; local_14 < param_2; local_14 = local_14 + 1) { iVar1 = *(int *)(param_1 + (long)local_14 * 4); local_10 = local_14; while ((local_18 <= local_10 && (iVar1 < *(int *)(param_1 + (long)(local_10 - local_18) * 4))) ) { *(int4 *)(param_1 + (long)local_10 * 4) = *(int4 *)(param_1 + (long)(local_10 - local_18) * 4); local_10 = local_10 - local_18; } *(int *)((long)local_10 * 4 + param_1) = iVar1; } } return; }
5,605
func0
#include <assert.h>
void func0(int my_list[], int length) { int gap = length / 2; while (gap > 0) { for (int i = gap; i < length; i++) { int current_item = my_list[i]; int j = i; while (j >= gap && my_list[j - gap] > current_item) { my_list[j] = my_list[j - gap]; j -= gap; } my_list[j] = current_item; } gap /= 2; } }
int main() { int list1[] = {12, 23, 4, 5, 3, 2, 12, 81, 56, 95}; int list2[] = {24, 22, 39, 34, 87, 73, 68}; int list3[] = {32, 30, 16, 96, 82, 83, 74}; func0(list1, 10); func0(list2, 7); func0(list3, 7); int sorted1[] = {2, 3, 4, 5, 12, 12, 23, 56, 81, 95}; int sorted2[] = {22, 24, 34, 39, 68, 73, 87}; int sorted3[] = {16, 30, 32, 74, 82, 83, 96}; for (int i = 0; i < 10; i++) { assert(list1[i] == sorted1[i]); } for (int i = 0; i < 7; i++) { assert(list2[i] == sorted2[i]); } for (int i = 0; i < 7; i++) { assert(list3[i] == sorted3[i]); } return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx mov %rdi,%rbx mov %esi,%ebp shr $0x1f,%esi add %ebp,%esi sar %esi cmp $0x1,%ebp jg 11d6 <func0+0x6d> pop %rbx pop %rbp pop %r12 retq movslq %edi,%rdi mov %r8d,(%rbx,%rdi,4) add $0x1,%r12d add $0x4,%r11 cmp %r12d,%ebp je 11c6 <func0+0x5d> mov (%r11),%r8d mov %r11,%rdx mov %r12d,%eax mov %r12d,%edi cmp %r12d,%esi jg 1187 <func0+0x1e> mov %eax,%edi sub %esi,%eax mov (%rdx,%r9,1),%ecx cmp %r8d,%ecx jle 1187 <func0+0x1e> mov %ecx,(%rdx) add %r10,%rdx cmp %esi,%eax jge 11ac <func0+0x43> mov %eax,%edi jmp 1187 <func0+0x1e> mov %esi,%eax shr $0x1f,%eax add %esi,%eax sar %eax cmp $0x1,%esi jle 1182 <func0+0x19> mov %eax,%esi cmp %esi,%ebp jle 11c6 <func0+0x5d> movslq %esi,%r9 lea (%rbx,%r9,4),%r11 mov %esi,%r10d neg %r10d movslq %r10d,%r10 shl $0x2,%r10 neg %r9 shl $0x2,%r9 mov %esi,%r12d jmp 119b <func0+0x32>
func0: endbr64 push r12 push rbp push rbx mov rbx, rdi mov ebp, esi shr esi, 1Fh add esi, ebp sar esi, 1 cmp ebp, 1 jg short loc_11D6 loc_1182: pop rbx pop rbp pop r12 retn loc_1187: movsxd rdi, edi mov [rbx+rdi*4], r8d add r12d, 1 add r11, 4 cmp ebp, r12d jz short loc_11C6 loc_119B: mov r8d, [r11] mov rdx, r11 mov eax, r12d mov edi, r12d cmp esi, r12d jg short loc_1187 loc_11AC: mov edi, eax sub eax, esi mov ecx, [rdx+r9] cmp ecx, r8d jle short loc_1187 mov [rdx], ecx add rdx, r10 cmp eax, esi jge short loc_11AC mov edi, eax jmp short loc_1187 loc_11C6: mov eax, esi shr eax, 1Fh add eax, esi sar eax, 1 cmp esi, 1 jle short loc_1182 mov esi, eax loc_11D6: cmp ebp, esi jle short loc_11C6 movsxd r9, esi lea r11, [rbx+r9*4] mov r10d, esi neg r10d movsxd r10, r10d shl r10, 2 neg r9 shl r9, 2 mov r12d, esi jmp short loc_119B
void func0(long long a1, int a2) { int v4; // esi int v5; // r12d _DWORD *v6; // r11 int v7; // r8d _DWORD *v8; // rdx int v9; // eax int v10; // edi int v11; // ecx v4 = a2 / 2; if ( a2 > 1 ) { while ( 1 ) { if ( a2 > v4 ) { v6 = (_DWORD *)(a1 + 4LL * v4); v5 = v4; do { v7 = *v6; v8 = v6; v9 = v5; v10 = v5; if ( v4 <= v5 ) { while ( 1 ) { v10 = v9; v9 -= v4; v11 = v8[-v4]; if ( v11 <= v7 ) break; *v8 = v11; v8 -= v4; if ( v9 < v4 ) { v10 = v9; break; } } } *(_DWORD *)(a1 + 4LL * v10) = v7; ++v5; ++v6; } while ( a2 != v5 ); } if ( v4 <= 1 ) break; v4 /= 2; } } }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RDI MOV EBP,ESI SHR ESI,0x1f ADD ESI,EBP SAR ESI,0x1 CMP EBP,0x1 JG 0x001011d6 LAB_00101182: POP RBX POP RBP POP R12 RET LAB_00101187: MOVSXD RDI,EDI MOV dword ptr [RBX + RDI*0x4],R8D ADD R12D,0x1 ADD R11,0x4 CMP EBP,R12D JZ 0x001011c6 LAB_0010119b: MOV R8D,dword ptr [R11] MOV RDX,R11 MOV EAX,R12D MOV EDI,R12D CMP ESI,R12D JG 0x00101187 LAB_001011ac: MOV EDI,EAX SUB EAX,ESI MOV ECX,dword ptr [RDX + R9*0x1] CMP ECX,R8D JLE 0x00101187 MOV dword ptr [RDX],ECX ADD RDX,R10 CMP EAX,ESI JGE 0x001011ac MOV EDI,EAX JMP 0x00101187 LAB_001011c6: MOV EAX,ESI SHR EAX,0x1f ADD EAX,ESI SAR EAX,0x1 CMP ESI,0x1 JLE 0x00101182 MOV ESI,EAX LAB_001011d6: CMP EBP,ESI JLE 0x001011c6 MOVSXD R9,ESI LEA R11,[RBX + R9*0x4] MOV R10D,ESI NEG R10D MOVSXD R10,R10D SHL R10,0x2 NEG R9 SHL R9,0x2 MOV R12D,ESI JMP 0x0010119b
void func0(long param_1,int param_2) { int iVar1; bool bVar2; int iVar3; int *piVar4; int iVar5; int *piVar6; int iVar7; iVar5 = param_2 / 2; if (1 < param_2) { do { if (iVar5 < param_2) { piVar6 = (int *)(param_1 + (long)iVar5 * 4); iVar7 = iVar5; do { iVar1 = *piVar6; piVar4 = piVar6; iVar3 = iVar7; while (iVar5 <= iVar3) { if (piVar4[-(long)iVar5] <= iVar1) break; *piVar4 = piVar4[-(long)iVar5]; piVar4 = piVar4 + -iVar5; iVar3 = iVar3 - iVar5; } *(int *)(param_1 + (long)iVar3 * 4) = iVar1; iVar7 = iVar7 + 1; piVar6 = piVar6 + 1; } while (param_2 != iVar7); } bVar2 = 1 < iVar5; iVar5 = iVar5 / 2; } while (bVar2); } return; }
5,606
func0
#include <assert.h>
void func0(int my_list[], int length) { int gap = length / 2; while (gap > 0) { for (int i = gap; i < length; i++) { int current_item = my_list[i]; int j = i; while (j >= gap && my_list[j - gap] > current_item) { my_list[j] = my_list[j - gap]; j -= gap; } my_list[j] = current_item; } gap /= 2; } }
int main() { int list1[] = {12, 23, 4, 5, 3, 2, 12, 81, 56, 95}; int list2[] = {24, 22, 39, 34, 87, 73, 68}; int list3[] = {32, 30, 16, 96, 82, 83, 74}; func0(list1, 10); func0(list2, 7); func0(list3, 7); int sorted1[] = {2, 3, 4, 5, 12, 12, 23, 56, 81, 95}; int sorted2[] = {22, 24, 34, 39, 68, 73, 87}; int sorted3[] = {16, 30, 32, 74, 82, 83, 96}; for (int i = 0; i < 10; i++) { assert(list1[i] == sorted1[i]); } for (int i = 0; i < 7; i++) { assert(list2[i] == sorted2[i]); } for (int i = 0; i < 7; i++) { assert(list3[i] == sorted3[i]); } return 0; }
O2
c
func0: endbr64 mov %esi,%r8d shr $0x1f,%r8d add %esi,%r8d sar %r8d cmp $0x1,%esi jle 14f4 <func0+0xc4> push %r14 mov %esi,%r14d push %r13 mov %rdi,%r13 push %r12 push %rbp push %rbx nopl 0x0(%rax,%rax,1) cmp %r8d,%r14d jle 14cd <func0+0x9d> mov %r8d,%r9d movslq %r8d,%r12 mov %r8d,%ebp neg %r9d lea 0x0(%r13,%r12,4),%rbx neg %r12 movslq %r9d,%r9 shl $0x2,%r12 shl $0x2,%r9 nopl 0x0(%rax) mov (%rbx),%r10d lea (%rbx,%r12,1),%rax mov %rbx,%rcx mov %ebp,%edx jmp 14ae <func0+0x7e> nopw %cs:0x0(%rax,%rax,1) mov %esi,(%rcx) add %r9,%rax lea (%rdi,%r9,1),%rcx cmp %r8d,%edx jl 14e0 <func0+0xb0> mov (%rax),%esi sub %r8d,%edx mov %rax,%r11 mov %rcx,%rdi cmp %r10d,%esi jg 14a0 <func0+0x70> add $0x1,%ebp mov %r10d,(%rdi) add $0x4,%rbx cmp %ebp,%r14d jne 1488 <func0+0x58> sar %r8d jne 1460 <func0+0x30> pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq nopl 0x0(%rax,%rax,1) mov %r11,%rdi add $0x1,%ebp add $0x4,%rbx mov %r10d,(%rdi) cmp %ebp,%r14d jne 1488 <func0+0x58> jmp 14cd <func0+0x9d> retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 mov r8d, esi shr r8d, 1Fh add r8d, esi sar r8d, 1 cmp esi, 1 jle locret_14ED push r14 push r13 mov r13d, esi push r12 mov r12, rdi push rbp push rbx nop dword ptr [rax+rax+00000000h] loc_1460: cmp r13d, r8d jle short loc_14C6 mov r9d, r8d movsxd rbp, r8d mov r14d, r8d neg r9d shl rbp, 2 movsxd r9, r9d lea rbx, [r12+rbp] shl r9, 2 loc_1480: mov rax, rbx mov r10d, [rbx] mov rcx, rbx mov edx, r14d sub rax, rbp jmp short loc_14A6 loc_1498: mov [rcx], esi add rax, r9 lea rcx, [rdi+r9] cmp edx, r8d jl short loc_14D8 loc_14A6: mov esi, [rax] sub edx, r8d mov r11, rax mov rdi, rcx cmp esi, r10d jg short loc_1498 add r14d, 1 mov [rdi], r10d add rbx, 4 cmp r13d, r14d jnz short loc_1480 loc_14C6: sar r8d, 1 jnz short loc_1460 pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_14D8: mov rdi, r11 add r14d, 1 add rbx, 4 mov [rdi], r10d cmp r13d, r14d jnz short loc_1480 jmp short loc_14C6 locret_14ED: retn
void func0(long long a1, int a2) { int v2; // r8d int v3; // r14d long long v4; // rbp _DWORD *v5; // rbx long long v6; // r9 int v7; // r10d _DWORD *v8; // rcx int v9; // edx _DWORD *v10; // rax _DWORD *v11; // r11 v2 = a2 / 2; if ( a2 > 1 ) { do { if ( a2 > v2 ) { v3 = v2; v4 = 4LL * v2; v5 = (_DWORD *)(a1 + v4); v6 = 4LL * -v2; LABEL_4: while ( 2 ) { v7 = *v5; v8 = v5; v9 = v3; v10 = &v5[v4 / 0xFFFFFFFFFFFFFFFCLL]; do { v9 -= v2; v11 = v10; if ( *v10 <= v7 ) { ++v3; *v8 = v7; ++v5; if ( a2 != v3 ) goto LABEL_4; goto LABEL_8; } *v8 = *v10; v10 = (_DWORD *)((char *)v10 + v6); v8 = (_DWORD *)((char *)v8 + v6); } while ( v9 >= v2 ); ++v3; ++v5; *v11 = v7; if ( a2 != v3 ) continue; break; } } LABEL_8: v2 >>= 1; } while ( v2 ); } }
func0: ENDBR64 MOV R8D,ESI SHR R8D,0x1f ADD R8D,ESI SAR R8D,0x1 CMP ESI,0x1 JLE 0x001014ed PUSH R14 PUSH R13 MOV R13D,ESI PUSH R12 MOV R12,RDI PUSH RBP PUSH RBX NOP dword ptr [RAX + RAX*0x1] LAB_00101460: CMP R13D,R8D JLE 0x001014c6 MOV R9D,R8D MOVSXD RBP,R8D MOV R14D,R8D NEG R9D SHL RBP,0x2 MOVSXD R9,R9D LEA RBX,[R12 + RBP*0x1] SHL R9,0x2 LAB_00101480: MOV RAX,RBX MOV R10D,dword ptr [RBX] MOV RCX,RBX MOV EDX,R14D SUB RAX,RBP JMP 0x001014a6 LAB_00101498: MOV dword ptr [RCX],ESI ADD RAX,R9 LEA RCX,[RDI + R9*0x1] CMP EDX,R8D JL 0x001014d8 LAB_001014a6: MOV ESI,dword ptr [RAX] SUB EDX,R8D MOV R11,RAX MOV RDI,RCX CMP ESI,R10D JG 0x00101498 ADD R14D,0x1 MOV dword ptr [RDI],R10D ADD RBX,0x4 CMP R13D,R14D JNZ 0x00101480 LAB_001014c6: SAR R8D,0x1 JNZ 0x00101460 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_001014d8: MOV RDI,R11 ADD R14D,0x1 ADD RBX,0x4 MOV dword ptr [RDI],R10D CMP R13D,R14D JNZ 0x00101480 JMP 0x001014c6 LAB_001014ed: RET
void func0(long param_1,int param_2) { int iVar1; int *piVar2; int *piVar3; int *piVar4; int iVar5; int *piVar6; int iVar7; int iVar8; iVar7 = param_2 / 2; if (param_2 < 2) { return; } do { if (iVar7 < param_2) { piVar6 = (int *)(param_1 + (long)iVar7 * 4); iVar8 = iVar7; do { iVar1 = *piVar6; piVar2 = piVar6 + -(long)iVar7; piVar4 = piVar6; iVar5 = iVar8; do { piVar3 = piVar2; iVar5 = iVar5 - iVar7; if (*piVar3 <= iVar1) { *piVar4 = iVar1; goto joined_r0x001014c4; } *piVar4 = *piVar3; piVar4 = piVar4 + -iVar7; piVar2 = piVar3 + -iVar7; } while (iVar7 <= iVar5); *piVar3 = iVar1; joined_r0x001014c4: piVar6 = piVar6 + 1; iVar8 = iVar8 + 1; } while (param_2 != iVar8); } iVar7 = iVar7 >> 1; if (iVar7 == 0) { return; } } while( true ); }
5,607
func0
#include <assert.h>
void func0(int my_list[], int length) { int gap = length / 2; while (gap > 0) { for (int i = gap; i < length; i++) { int current_item = my_list[i]; int j = i; while (j >= gap && my_list[j - gap] > current_item) { my_list[j] = my_list[j - gap]; j -= gap; } my_list[j] = current_item; } gap /= 2; } }
int main() { int list1[] = {12, 23, 4, 5, 3, 2, 12, 81, 56, 95}; int list2[] = {24, 22, 39, 34, 87, 73, 68}; int list3[] = {32, 30, 16, 96, 82, 83, 74}; func0(list1, 10); func0(list2, 7); func0(list3, 7); int sorted1[] = {2, 3, 4, 5, 12, 12, 23, 56, 81, 95}; int sorted2[] = {22, 24, 34, 39, 68, 73, 87}; int sorted3[] = {16, 30, 32, 74, 82, 83, 96}; for (int i = 0; i < 10; i++) { assert(list1[i] == sorted1[i]); } for (int i = 0; i < 7; i++) { assert(list2[i] == sorted2[i]); } for (int i = 0; i < 7; i++) { assert(list3[i] == sorted3[i]); } return 0; }
O3
c
func0: endbr64 mov %esi,%r8d shr $0x1f,%r8d add %esi,%r8d sar %r8d cmp $0x1,%esi jle 1514 <func0+0xc4> push %r14 mov %esi,%r14d push %r13 mov %rdi,%r13 push %r12 push %rbp push %rbx nopl 0x0(%rax,%rax,1) cmp %r8d,%r14d jle 14ed <func0+0x9d> mov %r8d,%r9d movslq %r8d,%r12 mov %r8d,%ebp neg %r9d lea 0x0(%r13,%r12,4),%rbx neg %r12 movslq %r9d,%r9 shl $0x2,%r12 shl $0x2,%r9 nopl 0x0(%rax) mov (%rbx),%r10d lea (%r12,%rbx,1),%rax mov %rbx,%rcx mov %ebp,%edx jmp 14ce <func0+0x7e> nopw %cs:0x0(%rax,%rax,1) mov %esi,(%rcx) add %r9,%rax lea (%rcx,%r9,1),%rcx cmp %edx,%r8d jg 1500 <func0+0xb0> mov (%rax),%esi sub %r8d,%edx mov %rax,%r11 mov %rcx,%rdi cmp %r10d,%esi jg 14c0 <func0+0x70> add $0x1,%ebp mov %r10d,(%rdi) add $0x4,%rbx cmp %ebp,%r14d jne 14a8 <func0+0x58> sar %r8d jne 1480 <func0+0x30> pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq nopl 0x0(%rax,%rax,1) mov %r11,%rdi add $0x1,%ebp add $0x4,%rbx mov %r10d,(%rdi) cmp %ebp,%r14d jne 14a8 <func0+0x58> jmp 14ed <func0+0x9d> retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 mov ecx, esi push r13 shr ecx, 1Fh push r12 mov r12d, esi add ecx, esi push rbp mov rbp, rdi push rbx sar ecx, 1 cmp esi, 1 jle short loc_13F7 xchg ax, ax loc_13A0: cmp r12d, ecx jle short loc_1413 movsxd r9, ecx mov r13d, ecx shl r9, 2 lea rbx, [rbp+r9+0] loc_13B4: mov rax, rbx mov r10d, [rbx] mov rsi, rbx mov edx, r13d sub rax, r9 jmp short loc_13D4 loc_13C8: mov [rsi], edi sub rax, r9 sub rsi, r9 cmp ecx, edx jg short loc_13FE loc_13D4: mov edi, [rax] sub edx, ecx mov r11, rax mov r8, rsi cmp edi, r10d jg short loc_13C8 add r13d, 1 mov [r8], r10d add rbx, 4 cmp r12d, r13d jnz short loc_13B4 loc_13F3: sar ecx, 1 jnz short loc_13A0 loc_13F7: pop rbx pop rbp pop r12 pop r13 retn loc_13FE: mov r8, r11 add r13d, 1 add rbx, 4 mov [r8], r10d cmp r12d, r13d jnz short loc_13B4 jmp short loc_13F3 loc_1413: sar ecx, 1 jmp short loc_13A0
void func0(long long a1, int a2) { int v3; // ecx int v4; // r13d long long v5; // r9 _DWORD *v6; // rbx int v7; // r10d _DWORD *v8; // rsi int v9; // edx _DWORD *v10; // rax _DWORD *v11; // r11 v3 = a2 / 2; if ( a2 > 1 ) { do { while ( a2 <= v3 ) v3 >>= 1; v4 = v3; v5 = 4LL * v3; v6 = (_DWORD *)(a1 + v5); LABEL_4: while ( 2 ) { v7 = *v6; v8 = v6; v9 = v4; v10 = &v6[v5 / 0xFFFFFFFFFFFFFFFCLL]; do { v9 -= v3; v11 = v10; if ( *v10 <= v7 ) { ++v4; *v8 = v7; ++v6; if ( a2 != v4 ) goto LABEL_4; goto LABEL_8; } *v8 = *v10; v10 = (_DWORD *)((char *)v10 - v5); v8 = (_DWORD *)((char *)v8 - v5); } while ( v3 <= v9 ); ++v4; ++v6; *v11 = v7; if ( a2 != v4 ) continue; break; } LABEL_8: v3 >>= 1; } while ( v3 ); } }
func0: ENDBR64 MOV ECX,ESI PUSH R13 SHR ECX,0x1f PUSH R12 MOV R12D,ESI ADD ECX,ESI PUSH RBP MOV RBP,RDI PUSH RBX SAR ECX,0x1 CMP ESI,0x1 JLE 0x001013f7 NOP LAB_001013a0: CMP R12D,ECX JLE 0x00101413 MOVSXD R9,ECX MOV R13D,ECX SHL R9,0x2 LEA RBX,[RBP + R9*0x1] LAB_001013b4: MOV RAX,RBX MOV R10D,dword ptr [RBX] MOV RSI,RBX MOV EDX,R13D SUB RAX,R9 JMP 0x001013d4 LAB_001013c8: MOV dword ptr [RSI],EDI SUB RAX,R9 SUB RSI,R9 CMP ECX,EDX JG 0x001013fe LAB_001013d4: MOV EDI,dword ptr [RAX] SUB EDX,ECX MOV R11,RAX MOV R8,RSI CMP EDI,R10D JG 0x001013c8 ADD R13D,0x1 MOV dword ptr [R8],R10D ADD RBX,0x4 CMP R12D,R13D JNZ 0x001013b4 LAB_001013f3: SAR ECX,0x1 JNZ 0x001013a0 LAB_001013f7: POP RBX POP RBP POP R12 POP R13 RET LAB_001013fe: MOV R8,R11 ADD R13D,0x1 ADD RBX,0x4 MOV dword ptr [R8],R10D CMP R12D,R13D JNZ 0x001013b4 JMP 0x001013f3 LAB_00101413: SAR ECX,0x1 JMP 0x001013a0
void func0(long param_1,int param_2) { int iVar1; int *piVar2; int *piVar3; int iVar4; int iVar5; int iVar6; int *piVar7; int *piVar8; long lVar9; int iVar10; iVar5 = param_2 / 2; if (1 < param_2) { do { do { iVar4 = iVar5; iVar5 = iVar4 >> 1; } while (param_2 <= iVar4); lVar9 = (long)iVar4; piVar7 = (int *)(param_1 + lVar9 * 4); iVar10 = iVar4; do { iVar1 = *piVar7; piVar2 = piVar7 + -lVar9; piVar8 = piVar7; iVar6 = iVar10; do { piVar3 = piVar2; iVar6 = iVar6 - iVar4; if (*piVar3 <= iVar1) { *piVar8 = iVar1; goto joined_r0x001013f1; } *piVar8 = *piVar3; piVar8 = piVar8 + -lVar9; piVar2 = piVar3 + -lVar9; } while (iVar4 <= iVar6); *piVar3 = iVar1; joined_r0x001013f1: piVar7 = piVar7 + 1; iVar10 = iVar10 + 1; } while (param_2 != iVar10); } while (iVar5 != 0); } return; }
5,608
func0
#include <assert.h> #include <stdio.h>
void func0(int test_tup1[], int test_tup2[], int res[], int size) { for (int i = 0; i < size; i++) { res[i] = test_tup1[i] & test_tup2[i]; } }
int main() { int res[4]; int test_tup1_1[4] = {10, 4, 6, 9}; int test_tup2_1[4] = {5, 2, 3, 3}; int expected_1[4] = {0, 0, 2, 1}; func0(test_tup1_1, test_tup2_1, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_1[i]); } int test_tup1_2[4] = {1, 2, 3, 4}; int test_tup2_2[4] = {5, 6, 7, 8}; int expected_2[4] = {1, 2, 3, 0}; func0(test_tup1_2, test_tup2_2, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_2[i]); } int test_tup1_3[4] = {8, 9, 11, 12}; int test_tup2_3[4] = {7, 13, 14, 17}; int expected_3[4] = {0, 9, 10, 0}; func0(test_tup1_3, test_tup2_3, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_3[i]); } return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %rdx,-0x28(%rbp) mov %ecx,-0x2c(%rbp) movl $0x0,-0x4(%rbp) jmp 11d1 <func0+0x68> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%ecx mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x20(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rsi mov -0x28(%rbp),%rax add %rsi,%rax and %ecx,%edx mov %edx,(%rax) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x2c(%rbp),%eax jl 1189 <func0+0x20> pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_28], rdx mov [rbp+var_2C], ecx mov [rbp+var_4], 0 jmp short loc_11D1 loc_1189: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov ecx, [rax] mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_20] add rax, rdx mov edx, [rax] mov eax, [rbp+var_4] cdqe lea rsi, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rsi and edx, ecx mov [rax], edx add [rbp+var_4], 1 loc_11D1: mov eax, [rbp+var_4] cmp eax, [rbp+var_2C] jl short loc_1189 nop nop pop rbp retn
long long func0(long long a1, long long a2, long long a3, int a4) { long long result; // rax unsigned int i; // [rsp+28h] [rbp-4h] for ( i = 0; ; ++i ) { result = i; if ( (int)i >= a4 ) break; *(_DWORD *)(4LL * (int)i + a3) = *(_DWORD *)(4LL * (int)i + a1) & *(_DWORD *)(4LL * (int)i + a2); } return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x2c],ECX MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011d1 LAB_00101189: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV ECX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RSI,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RSI AND EDX,ECX MOV dword ptr [RAX],EDX ADD dword ptr [RBP + -0x4],0x1 LAB_001011d1: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x2c] JL 0x00101189 NOP NOP POP RBP RET
void func0(long param_1,long param_2,long param_3,int param_4) { int4 local_c; for (local_c = 0; local_c < param_4; local_c = local_c + 1) { *(uint *)(param_3 + (long)local_c * 4) = *(uint *)(param_2 + (long)local_c * 4) & *(uint *)(param_1 + (long)local_c * 4); } return; }
5,609
func0
#include <assert.h> #include <stdio.h>
void func0(int test_tup1[], int test_tup2[], int res[], int size) { for (int i = 0; i < size; i++) { res[i] = test_tup1[i] & test_tup2[i]; } }
int main() { int res[4]; int test_tup1_1[4] = {10, 4, 6, 9}; int test_tup2_1[4] = {5, 2, 3, 3}; int expected_1[4] = {0, 0, 2, 1}; func0(test_tup1_1, test_tup2_1, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_1[i]); } int test_tup1_2[4] = {1, 2, 3, 4}; int test_tup2_2[4] = {5, 6, 7, 8}; int expected_2[4] = {1, 2, 3, 0}; func0(test_tup1_2, test_tup2_2, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_2[i]); } int test_tup1_3[4] = {8, 9, 11, 12}; int test_tup2_3[4] = {7, 13, 14, 17}; int expected_3[4] = {0, 9, 10, 0}; func0(test_tup1_3, test_tup2_3, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_3[i]); } return 0; }
O1
c
func0: endbr64 test %ecx,%ecx jle 118f <func0+0x26> lea -0x1(%rcx),%r8d mov $0x0,%eax mov (%rdi,%rax,4),%ecx and (%rsi,%rax,4),%ecx mov %ecx,(%rdx,%rax,4) mov %rax,%rcx add $0x1,%rax cmp %r8,%rcx jne 117a <func0+0x11> retq
func0: endbr64 test ecx, ecx jle short locret_118D mov ecx, ecx mov eax, 0 loc_1178: mov r8d, [rdi+rax*4] and r8d, [rsi+rax*4] mov [rdx+rax*4], r8d add rax, 1 cmp rax, rcx jnz short loc_1178 locret_118D: retn
void func0(long long a1, long long a2, long long a3, int a4) { long long i; // rax if ( a4 > 0 ) { for ( i = 0LL; i != a4; ++i ) *(_DWORD *)(a3 + 4 * i) = *(_DWORD *)(a2 + 4 * i) & *(_DWORD *)(a1 + 4 * i); } }
func0: ENDBR64 TEST ECX,ECX JLE 0x0010118d MOV ECX,ECX MOV EAX,0x0 LAB_00101178: MOV R8D,dword ptr [RDI + RAX*0x4] AND R8D,dword ptr [RSI + RAX*0x4] MOV dword ptr [RDX + RAX*0x4],R8D ADD RAX,0x1 CMP RAX,RCX JNZ 0x00101178 LAB_0010118d: RET
void func0(long param_1,long param_2,long param_3,uint param_4) { ulong uVar1; if (0 < (int)param_4) { uVar1 = 0; do { *(uint *)(param_3 + uVar1 * 4) = *(uint *)(param_1 + uVar1 * 4) & *(uint *)(param_2 + uVar1 * 4); uVar1 = uVar1 + 1; } while (uVar1 != param_4); } return; }
5,610
func0
#include <assert.h> #include <stdio.h>
void func0(int test_tup1[], int test_tup2[], int res[], int size) { for (int i = 0; i < size; i++) { res[i] = test_tup1[i] & test_tup2[i]; } }
int main() { int res[4]; int test_tup1_1[4] = {10, 4, 6, 9}; int test_tup2_1[4] = {5, 2, 3, 3}; int expected_1[4] = {0, 0, 2, 1}; func0(test_tup1_1, test_tup2_1, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_1[i]); } int test_tup1_2[4] = {1, 2, 3, 4}; int test_tup2_2[4] = {5, 6, 7, 8}; int expected_2[4] = {1, 2, 3, 0}; func0(test_tup1_2, test_tup2_2, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_2[i]); } int test_tup1_3[4] = {8, 9, 11, 12}; int test_tup2_3[4] = {7, 13, 14, 17}; int expected_3[4] = {0, 9, 10, 0}; func0(test_tup1_3, test_tup2_3, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_3[i]); } return 0; }
O2
c
func0: endbr64 test %ecx,%ecx jle 1165 <func0+0x25> lea -0x1(%rcx),%r8d xor %eax,%eax xchg %ax,%ax mov (%rdi,%rax,4),%ecx and (%rsi,%rax,4),%ecx mov %ecx,(%rdx,%rax,4) mov %rax,%rcx add $0x1,%rax cmp %r8,%rcx jne 1150 <func0+0x10> retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 test ecx, ecx jle short locret_1425 movsxd rcx, ecx xor eax, eax nop dword ptr [rax] loc_1410: mov r8d, [rdi+rax*4] and r8d, [rsi+rax*4] mov [rdx+rax*4], r8d add rax, 1 cmp rcx, rax jnz short loc_1410 locret_1425: retn
void func0(long long a1, long long a2, long long a3, int a4) { long long i; // rax if ( a4 > 0 ) { for ( i = 0LL; i != a4; ++i ) *(_DWORD *)(a3 + 4 * i) = *(_DWORD *)(a2 + 4 * i) & *(_DWORD *)(a1 + 4 * i); } }
func0: ENDBR64 TEST ECX,ECX JLE 0x00101425 MOVSXD RCX,ECX XOR EAX,EAX NOP dword ptr [RAX] LAB_00101410: MOV R8D,dword ptr [RDI + RAX*0x4] AND R8D,dword ptr [RSI + RAX*0x4] MOV dword ptr [RDX + RAX*0x4],R8D ADD RAX,0x1 CMP RCX,RAX JNZ 0x00101410 LAB_00101425: RET
void func0(long param_1,long param_2,long param_3,int param_4) { long lVar1; if (0 < param_4) { lVar1 = 0; do { *(uint *)(param_3 + lVar1 * 4) = *(uint *)(param_1 + lVar1 * 4) & *(uint *)(param_2 + lVar1 * 4); lVar1 = lVar1 + 1; } while (param_4 != lVar1); } return; }
5,611
func0
#include <assert.h> #include <stdio.h>
void func0(int test_tup1[], int test_tup2[], int res[], int size) { for (int i = 0; i < size; i++) { res[i] = test_tup1[i] & test_tup2[i]; } }
int main() { int res[4]; int test_tup1_1[4] = {10, 4, 6, 9}; int test_tup2_1[4] = {5, 2, 3, 3}; int expected_1[4] = {0, 0, 2, 1}; func0(test_tup1_1, test_tup2_1, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_1[i]); } int test_tup1_2[4] = {1, 2, 3, 4}; int test_tup2_2[4] = {5, 6, 7, 8}; int expected_2[4] = {1, 2, 3, 0}; func0(test_tup1_2, test_tup2_2, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_2[i]); } int test_tup1_3[4] = {8, 9, 11, 12}; int test_tup2_3[4] = {7, 13, 14, 17}; int expected_3[4] = {0, 9, 10, 0}; func0(test_tup1_3, test_tup2_3, res, 4); for (int i = 0; i < 4; i++) { assert(res[i] == expected_3[i]); } return 0; }
O3
c
func0: endbr64 test %ecx,%ecx jle 120d <func0+0xcd> lea 0xf(%rdi),%r8 lea -0x1(%rcx),%eax sub %rdx,%r8 cmp $0x1e,%r8 seta %r9b cmp $0x2,%eax seta %r8b test %r8b,%r9b je 11f0 <func0+0xb0> lea 0xf(%rsi),%r8 sub %rdx,%r8 cmp $0x1e,%r8 jbe 11f0 <func0+0xb0> mov %ecx,%r8d xor %eax,%eax shr $0x2,%r8d shl $0x4,%r8 nopl 0x0(%rax,%rax,1) movdqu (%rdi,%rax,1),%xmm0 movdqu (%rsi,%rax,1),%xmm1 pand %xmm1,%xmm0 movups %xmm0,(%rdx,%rax,1) add $0x10,%rax cmp %r8,%rax jne 1190 <func0+0x50> mov %ecx,%eax and $0xfffffffc,%eax test $0x3,%cl je 120d <func0+0xcd> mov %eax,%r8d mov (%rdi,%r8,4),%r9d and (%rsi,%r8,4),%r9d mov %r9d,(%rdx,%r8,4) lea 0x1(%rax),%r8d cmp %r8d,%ecx jle 120d <func0+0xcd> movslq %r8d,%r8 add $0x2,%eax mov (%rdi,%r8,4),%r9d and (%rsi,%r8,4),%r9d mov %r9d,(%rdx,%r8,4) cmp %eax,%ecx jle 120d <func0+0xcd> cltq mov (%rdi,%rax,4),%ecx and (%rsi,%rax,4),%ecx mov %ecx,(%rdx,%rax,4) retq mov %eax,%r8d xor %eax,%eax nopl (%rax) mov (%rdi,%rax,4),%ecx and (%rsi,%rax,4),%ecx mov %ecx,(%rdx,%rax,4) mov %rax,%rcx add $0x1,%rax cmp %r8,%rcx jne 11f8 <func0+0xb8> retq xchg %ax,%ax
func0: endbr64 movsxd rax, ecx mov r8, rsi mov rsi, rdx test eax, eax jle locret_122B cmp eax, 1 jz loc_1208 lea rcx, [rdi+4] sub rdx, rcx cmp rdx, 8 jbe loc_1208 lea rcx, [r8+4] mov rdx, rsi sub rdx, rcx cmp rdx, 8 jbe loc_1208 lea edx, [rax-1] mov r9d, eax cmp edx, 2 jbe loc_122C mov ecx, eax xor edx, edx shr ecx, 2 shl rcx, 4 nop dword ptr [rax] loc_11A0: movdqu xmm0, xmmword ptr [rdi+rdx] movdqu xmm2, xmmword ptr [r8+rdx] pand xmm0, xmm2 movups xmmword ptr [rsi+rdx], xmm0 add rdx, 10h cmp rcx, rdx jnz short loc_11A0 mov edx, eax and edx, 0FFFFFFFCh mov ecx, edx cmp eax, edx jz short locret_122B sub eax, edx mov r9d, eax cmp eax, 1 jz short loc_11F4 loc_11D1: mov eax, ecx movq xmm0, qword ptr [rdi+rax*4] movq xmm1, qword ptr [r8+rax*4] pand xmm0, xmm1 movq qword ptr [rsi+rax*4], xmm0 test r9b, 1 jz short locret_122B and r9d, 0FFFFFFFEh add edx, r9d loc_11F4: movsxd rax, edx mov edx, [rdi+rax*4] and edx, [r8+rax*4] mov [rsi+rax*4], edx retn loc_1208: lea rcx, ds:0[rax*4] xor eax, eax nop word ptr [rax+rax+00h] loc_1218: mov edx, [rdi+rax] and edx, [r8+rax] mov [rsi+rax], edx add rax, 4 cmp rax, rcx jnz short loc_1218 locret_122B: retn loc_122C: xor ecx, ecx xor edx, edx jmp short loc_11D1
long long func0(long long a1, long long a2, long long a3, int a4) { long long result; // rax int v7; // r9d long long v8; // rdx int v9; // edx unsigned int v10; // ecx long long v11; // rcx result = a4; if ( a4 > 0 ) { if ( a4 == 1 || (unsigned long long)(a3 - (a1 + 4)) <= 8 || (unsigned long long)(a3 - (a2 + 4)) <= 8 ) { v11 = 4LL * a4; result = 0LL; do { *(_DWORD *)(a3 + result) = *(_DWORD *)(a2 + result) & *(_DWORD *)(a1 + result); result += 4LL; } while ( result != v11 ); } else { v7 = a4; if ( (unsigned int)(a4 - 1) <= 2 ) { v10 = 0; v9 = 0; } else { v8 = 0LL; do { *(__m128i *)(a3 + v8) = _mm_and_si128( _mm_loadu_si128((const __m128i *)(a1 + v8)), _mm_loadu_si128((const __m128i *)(a2 + v8))); v8 += 16LL; } while ( 16LL * ((unsigned int)a4 >> 2) != v8 ); v9 = a4 & 0x7FFFFFFC; v10 = a4 & 0xFFFFFFFC; if ( (_DWORD)result == (result & 0xFFFFFFFC) ) return result; v7 = result - v9; if ( (_DWORD)result - v9 == 1 ) { LABEL_12: result = v9; *(_DWORD *)(a3 + 4LL * v9) = *(_DWORD *)(a2 + 4LL * v9) & *(_DWORD *)(a1 + 4LL * v9); return result; } } result = v10; *(_QWORD *)(a3 + 4LL * v10) = _mm_and_si128( _mm_loadl_epi64((const __m128i *)(a1 + 4LL * v10)), _mm_loadl_epi64((const __m128i *)(a2 + 4LL * v10))).m128i_u64[0]; if ( (v7 & 1) != 0 ) { v9 += v7 & 0xFFFFFFFE; goto LABEL_12; } } } return result; }
func0: ENDBR64 MOVSXD RAX,ECX MOV R8,RSI MOV RSI,RDX TEST EAX,EAX JLE 0x0010122b CMP EAX,0x1 JZ 0x00101208 LEA RCX,[RDI + 0x4] SUB RDX,RCX CMP RDX,0x8 JBE 0x00101208 LEA RCX,[R8 + 0x4] MOV RDX,RSI SUB RDX,RCX CMP RDX,0x8 JBE 0x00101208 LEA EDX,[RAX + -0x1] MOV R9D,EAX CMP EDX,0x2 JBE 0x0010122c MOV ECX,EAX XOR EDX,EDX SHR ECX,0x2 SHL RCX,0x4 NOP dword ptr [RAX] LAB_001011a0: MOVDQU XMM0,xmmword ptr [RDI + RDX*0x1] MOVDQU XMM2,xmmword ptr [R8 + RDX*0x1] PAND XMM0,XMM2 MOVUPS xmmword ptr [RSI + RDX*0x1],XMM0 ADD RDX,0x10 CMP RCX,RDX JNZ 0x001011a0 MOV EDX,EAX AND EDX,0xfffffffc MOV ECX,EDX CMP EAX,EDX JZ 0x0010122b SUB EAX,EDX MOV R9D,EAX CMP EAX,0x1 JZ 0x001011f4 LAB_001011d1: MOV EAX,ECX MOVQ XMM0,qword ptr [RDI + RAX*0x4] MOVQ XMM1,qword ptr [R8 + RAX*0x4] PAND XMM0,XMM1 MOVQ qword ptr [RSI + RAX*0x4],XMM0 TEST R9B,0x1 JZ 0x0010122b AND R9D,0xfffffffe ADD EDX,R9D LAB_001011f4: MOVSXD RAX,EDX MOV EDX,dword ptr [RDI + RAX*0x4] AND EDX,dword ptr [R8 + RAX*0x4] MOV dword ptr [RSI + RAX*0x4],EDX RET LAB_00101208: LEA RCX,[RAX*0x4] XOR EAX,EAX NOP word ptr [RAX + RAX*0x1] LAB_00101218: MOV EDX,dword ptr [RDI + RAX*0x1] AND EDX,dword ptr [R8 + RAX*0x1] MOV dword ptr [RSI + RAX*0x1],EDX ADD RAX,0x4 CMP RAX,RCX JNZ 0x00101218 LAB_0010122b: RET LAB_0010122c: XOR ECX,ECX XOR EDX,EDX JMP 0x001011d1
void func0(long param_1,long param_2,long param_3,uint param_4) { ulong uVar1; ulong uVar2; uint uVar3; long lVar4; if (0 < (int)param_4) { if (((param_4 == 1) || ((ulong)(param_3 - (param_1 + 4)) < 9)) || ((ulong)(param_3 - (param_2 + 4)) < 9)) { lVar4 = 0; do { *(uint *)(param_3 + lVar4) = *(uint *)(param_1 + lVar4) & *(uint *)(param_2 + lVar4); lVar4 = lVar4 + 4; } while (lVar4 != (long)(int)param_4 * 4); return; } if (param_4 - 1 < 3) { uVar3 = 0; } else { lVar4 = 0; do { uVar2 = ((ulong *)(param_1 + lVar4))[1]; uVar1 = ((ulong *)(param_2 + lVar4))[1]; *(ulong *)(param_3 + lVar4) = *(ulong *)(param_1 + lVar4) & *(ulong *)(param_2 + lVar4); ((ulong *)(param_3 + lVar4))[1] = uVar2 & uVar1; lVar4 = lVar4 + 0x10; } while ((ulong)(param_4 >> 2) << 4 != lVar4); uVar3 = param_4 & 0xfffffffc; if (param_4 == uVar3) { return; } param_4 = param_4 - uVar3; if (param_4 == 1) goto LAB_001011f4; } uVar2 = (ulong)uVar3; *(ulong *)(param_3 + uVar2 * 4) = *(ulong *)(param_1 + uVar2 * 4) & *(ulong *)(param_2 + uVar2 * 4); if ((param_4 & 1) != 0) { uVar3 = uVar3 + (param_4 & 0xfffffffe); LAB_001011f4: lVar4 = (long)(int)uVar3; *(uint *)(param_3 + lVar4 * 4) = *(uint *)(param_1 + lVar4 * 4) & *(uint *)(param_2 + lVar4 * 4); return; } } return; }
5,612
func0
#include <assert.h>
int func0(int a, int b, int c) { int directrix = c - ((b * b) + 1) * 4 * a; return directrix; }
int main() { assert(func0(5, 3, 2) == -198); assert(func0(9, 8, 4) == -2336); assert(func0(2, 4, 6) == -130); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) mov %edx,-0x1c(%rbp) mov -0x18(%rbp),%eax imul %eax,%eax add $0x1,%eax imul -0x14(%rbp),%eax lea 0x0(,%rax,4),%edx mov -0x1c(%rbp),%eax sub %edx,%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_18], esi mov [rbp+var_1C], edx mov eax, [rbp+var_18] imul eax, eax add eax, 1 imul eax, [rbp+var_14] lea edx, ds:0[rax*4] mov eax, [rbp+var_1C] sub eax, edx mov [rbp+var_4], eax mov eax, [rbp+var_4] pop rbp retn
long long func0(int a1, int a2, int a3) { return (unsigned int)(a3 - 4 * a1 * (a2 * a2 + 1)); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x18],ESI MOV dword ptr [RBP + -0x1c],EDX MOV EAX,dword ptr [RBP + -0x18] IMUL EAX,EAX ADD EAX,0x1 IMUL EAX,dword ptr [RBP + -0x14] LEA EDX,[RAX*0x4] MOV EAX,dword ptr [RBP + -0x1c] SUB EAX,EDX MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] POP RBP RET
int func0(int param_1,int param_2,int param_3) { return param_3 + (param_2 * param_2 + 1) * param_1 * -4; }
5,613
func0
#include <assert.h>
int func0(int a, int b, int c) { int directrix = c - ((b * b) + 1) * 4 * a; return directrix; }
int main() { assert(func0(5, 3, 2) == -198); assert(func0(9, 8, 4) == -2336); assert(func0(2, 4, 6) == -130); return 0; }
O1
c
func0: endbr64 imul %esi,%esi add $0x1,%esi imul %edi,%esi shl $0x2,%esi mov %edx,%eax sub %esi,%eax retq
func0: endbr64 imul esi, esi add esi, 1 imul esi, edi shl esi, 2 mov eax, edx sub eax, esi retn
long long func0(int a1, int a2, int a3) { return (unsigned int)(a3 - 4 * a1 * (a2 * a2 + 1)); }
func0: ENDBR64 IMUL ESI,ESI ADD ESI,0x1 IMUL ESI,EDI SHL ESI,0x2 MOV EAX,EDX SUB EAX,ESI RET
int func0(int param_1,int param_2,int param_3) { return param_3 + (param_2 * param_2 + 1) * param_1 * -4; }
5,614
func0
#include <assert.h>
int func0(int a, int b, int c) { int directrix = c - ((b * b) + 1) * 4 * a; return directrix; }
int main() { assert(func0(5, 3, 2) == -198); assert(func0(9, 8, 4) == -2336); assert(func0(2, 4, 6) == -130); return 0; }
O2
c
func0: endbr64 imul %esi,%esi mov %edx,%eax add $0x1,%esi imul %edi,%esi shl $0x2,%esi sub %esi,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 imul esi, esi mov eax, edx add esi, 1 imul esi, edi shl esi, 2 sub eax, esi retn
long long func0(int a1, int a2, int a3) { return (unsigned int)(a3 - 4 * a1 * (a2 * a2 + 1)); }
func0: ENDBR64 IMUL ESI,ESI MOV EAX,EDX ADD ESI,0x1 IMUL ESI,EDI SHL ESI,0x2 SUB EAX,ESI RET
int func0(int param_1,int param_2,int param_3) { return param_3 + (param_2 * param_2 + 1) * param_1 * -4; }
5,615
func0
#include <assert.h>
int func0(int a, int b, int c) { int directrix = c - ((b * b) + 1) * 4 * a; return directrix; }
int main() { assert(func0(5, 3, 2) == -198); assert(func0(9, 8, 4) == -2336); assert(func0(2, 4, 6) == -130); return 0; }
O3
c
func0: endbr64 imul %esi,%esi mov %edx,%eax add $0x1,%esi imul %edi,%esi shl $0x2,%esi sub %esi,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 imul esi, esi mov eax, edx add esi, 1 imul esi, edi shl esi, 2 sub eax, esi retn
long long func0(int a1, int a2, int a3) { return (unsigned int)(a3 - 4 * a1 * (a2 * a2 + 1)); }
func0: ENDBR64 IMUL ESI,ESI MOV EAX,EDX ADD ESI,0x1 IMUL ESI,EDI SHL ESI,0x2 SUB EAX,ESI RET
int func0(int param_1,int param_2,int param_3) { return param_3 + (param_2 * param_2 + 1) * param_1 * -4; }
5,616
func0
#include <assert.h>
int func0(int* list1, int size1, int* list2, int size2){ for(int i = 0; i < size1; i++){ for(int j = 0; j < size2; j++){ if(list1[i] == list2[j]){ return 1; } } } return 0; }
int main(){ int list1_a[] = {1, 2, 3, 4, 5}; int list2_a[] = {5, 6, 7, 8, 9}; assert(func0(list1_a, 5, list2_a, 5) == 1); int list1_b[] = {1, 2, 3, 4, 5}; int list2_b[] = {6, 7, 8, 9}; assert(func0(list1_b, 5, list2_b, 4) == 0); int list1_c[] = {'a', 'b', 'c'}; int list2_c[] = {'d', 'b', 'e'}; assert(func0(list1_c, 3, list2_c, 3) == 1); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %rdx,-0x28(%rbp) mov %ecx,-0x20(%rbp) movl $0x0,-0x8(%rbp) jmp 11d8 <func0+0x6f> movl $0x0,-0x4(%rbp) jmp 11cc <func0+0x63> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x28(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jne 11c8 <func0+0x5f> mov $0x1,%eax jmp 11e5 <func0+0x7c> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x20(%rbp),%eax jl 1191 <func0+0x28> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1188 <func0+0x1f> mov $0x0,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_28], rdx mov [rbp+var_20], ecx mov [rbp+var_8], 0 jmp short loc_11D8 loc_1188: mov [rbp+var_4], 0 jmp short loc_11CC loc_1191: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_4] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rcx mov eax, [rax] cmp edx, eax jnz short loc_11C8 mov eax, 1 jmp short loc_11E5 loc_11C8: add [rbp+var_4], 1 loc_11CC: mov eax, [rbp+var_4] cmp eax, [rbp+var_20] jl short loc_1191 add [rbp+var_8], 1 loc_11D8: mov eax, [rbp+var_8] cmp eax, [rbp+var_1C] jl short loc_1188 mov eax, 0 loc_11E5: pop rbp retn
long long func0(long long a1, int a2, long long a3, int a4) { int i; // [rsp+20h] [rbp-8h] int j; // [rsp+24h] [rbp-4h] for ( i = 0; i < a2; ++i ) { for ( j = 0; j < a4; ++j ) { if ( *(_DWORD *)(4LL * i + a1) == *(_DWORD *)(4LL * j + a3) ) return 1LL; } } return 0LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x20],ECX MOV dword ptr [RBP + -0x8],0x0 JMP 0x001011d8 LAB_00101188: MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011cc LAB_00101191: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JNZ 0x001011c8 MOV EAX,0x1 JMP 0x001011e5 LAB_001011c8: ADD dword ptr [RBP + -0x4],0x1 LAB_001011cc: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x20] JL 0x00101191 ADD dword ptr [RBP + -0x8],0x1 LAB_001011d8: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101188 MOV EAX,0x0 LAB_001011e5: POP RBP RET
int8 func0(long param_1,int param_2,long param_3,int param_4) { int local_10; int local_c; local_10 = 0; do { if (param_2 <= local_10) { return 0; } for (local_c = 0; local_c < param_4; local_c = local_c + 1) { if (*(int *)(param_1 + (long)local_10 * 4) == *(int *)(param_3 + (long)local_c * 4)) { return 1; } } local_10 = local_10 + 1; } while( true ); }
5,617
func0
#include <assert.h>
int func0(int* list1, int size1, int* list2, int size2){ for(int i = 0; i < size1; i++){ for(int j = 0; j < size2; j++){ if(list1[i] == list2[j]){ return 1; } } } return 0; }
int main(){ int list1_a[] = {1, 2, 3, 4, 5}; int list2_a[] = {5, 6, 7, 8, 9}; assert(func0(list1_a, 5, list2_a, 5) == 1); int list1_b[] = {1, 2, 3, 4, 5}; int list2_b[] = {6, 7, 8, 9}; assert(func0(list1_b, 5, list2_b, 4) == 0); int list1_c[] = {'a', 'b', 'c'}; int list2_c[] = {'d', 'b', 'e'}; assert(func0(list1_c, 3, list2_c, 3) == 1); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11ad <func0+0x44> mov %rdi,%r8 lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%r9 mov %rdx,%rdi lea -0x1(%rcx),%eax lea 0x4(%rdx,%rax,4),%rsi test %ecx,%ecx jle 119e <func0+0x35> mov (%r8),%edx mov %rdi,%rax cmp (%rax),%edx je 11b3 <func0+0x4a> add $0x4,%rax cmp %rsi,%rax jne 1191 <func0+0x28> add $0x4,%r8 cmp %r9,%r8 jne 1187 <func0+0x1e> mov $0x0,%eax retq mov $0x0,%eax retq mov $0x1,%eax retq
func0: endbr64 test esi, esi jle short loc_11AA mov r8, rdi lea eax, [rsi-1] lea r9, [rdi+rax*4+4] lea eax, [rcx-1] lea rdi, [rdx+rax*4+4] loc_1184: test ecx, ecx jle short loc_119B mov esi, [r8] mov rax, rdx loc_118E: cmp esi, [rax] jz short loc_11B0 add rax, 4 cmp rax, rdi jnz short loc_118E loc_119B: add r8, 4 cmp r8, r9 jnz short loc_1184 mov eax, 0 retn loc_11AA: mov eax, 0 retn loc_11B0: mov eax, 1 retn
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4) { _DWORD *v4; // r8 _DWORD *v5; // rax if ( a2 <= 0 ) return 0LL; v4 = a1; while ( a4 <= 0 ) { LABEL_7: if ( ++v4 == &a1[a2 - 1 + 1] ) return 0LL; } v5 = a3; while ( *v4 != *v5 ) { if ( ++v5 == &a3[a4 - 1 + 1] ) goto LABEL_7; } return 1LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001011aa MOV R8,RDI LEA EAX,[RSI + -0x1] LEA R9,[RDI + RAX*0x4 + 0x4] LEA EAX,[RCX + -0x1] LEA RDI,[RDX + RAX*0x4 + 0x4] LAB_00101184: TEST ECX,ECX JLE 0x0010119b MOV ESI,dword ptr [R8] MOV RAX,RDX LAB_0010118e: CMP ESI,dword ptr [RAX] JZ 0x001011b0 ADD RAX,0x4 CMP RAX,RDI JNZ 0x0010118e LAB_0010119b: ADD R8,0x4 CMP R8,R9 JNZ 0x00101184 MOV EAX,0x0 RET LAB_001011aa: MOV EAX,0x0 RET LAB_001011b0: MOV EAX,0x1 RET
int8 func0(int *param_1,int param_2,int *param_3,int param_4) { int *piVar1; int *piVar2; if (param_2 < 1) { return 0; } piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if (0 < param_4) { piVar2 = param_3; do { if (*param_1 == *piVar2) { return 1; } piVar2 = piVar2 + 1; } while (piVar2 != param_3 + (ulong)(param_4 - 1) + 1); } param_1 = param_1 + 1; } while (param_1 != piVar1); return 0; }
5,618
func0
#include <assert.h>
int func0(int* list1, int size1, int* list2, int size2){ for(int i = 0; i < size1; i++){ for(int j = 0; j < size2; j++){ if(list1[i] == list2[j]){ return 1; } } } return 0; }
int main(){ int list1_a[] = {1, 2, 3, 4, 5}; int list2_a[] = {5, 6, 7, 8, 9}; assert(func0(list1_a, 5, list2_a, 5) == 1); int list1_b[] = {1, 2, 3, 4, 5}; int list2_b[] = {6, 7, 8, 9}; assert(func0(list1_b, 5, list2_b, 4) == 0); int list1_c[] = {'a', 'b', 'c'}; int list2_c[] = {'d', 'b', 'e'}; assert(func0(list1_c, 3, list2_c, 3) == 1); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1329 <func0+0x49> lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%r9 lea -0x1(%rcx),%eax lea 0x4(%rdx,%rax,4),%r8 test %ecx,%ecx jle 1320 <func0+0x40> mov (%rdi),%esi mov %rdx,%rax jmp 1311 <func0+0x31> nopl 0x0(%rax,%rax,1) add $0x4,%rax cmp %r8,%rax je 1320 <func0+0x40> cmp (%rax),%esi jne 1308 <func0+0x28> mov $0x1,%eax retq nopl 0x0(%rax,%rax,1) add $0x4,%rdi cmp %r9,%rdi jne 12f8 <func0+0x18> xor %eax,%eax retq nopl 0x0(%rax)
func0: endbr64 test esi, esi jle short loc_1369 lea eax, [rsi-1] lea r9, [rdi+rax*4+4] lea eax, [rcx-1] lea r8, [rdx+rax*4+4] loc_1338: test ecx, ecx jle short loc_1360 mov esi, [rdi] mov rax, rdx jmp short loc_1351 loc_1348: add rax, 4 cmp rax, r8 jz short loc_1360 loc_1351: cmp esi, [rax] jnz short loc_1348 mov eax, 1 retn loc_1360: add rdi, 4 cmp rdi, r9 jnz short loc_1338 loc_1369: xor eax, eax retn
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4) { long long v4; // r9 _DWORD *v5; // rax if ( a2 <= 0 ) return 0LL; v4 = (long long)&a1[a2 - 1 + 1]; while ( a4 <= 0 ) { LABEL_8: if ( ++a1 == (_DWORD *)v4 ) return 0LL; } v5 = a3; while ( *a1 != *v5 ) { if ( ++v5 == &a3[a4 - 1 + 1] ) goto LABEL_8; } return 1LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101369 LEA EAX,[RSI + -0x1] LEA R9,[RDI + RAX*0x4 + 0x4] LEA EAX,[RCX + -0x1] LEA R8,[RDX + RAX*0x4 + 0x4] LAB_00101338: TEST ECX,ECX JLE 0x00101360 MOV ESI,dword ptr [RDI] MOV RAX,RDX JMP 0x00101351 LAB_00101348: ADD RAX,0x4 CMP RAX,R8 JZ 0x00101360 LAB_00101351: CMP ESI,dword ptr [RAX] JNZ 0x00101348 MOV EAX,0x1 RET LAB_00101360: ADD RDI,0x4 CMP RDI,R9 JNZ 0x00101338 LAB_00101369: XOR EAX,EAX RET
int8 func0(int *param_1,int param_2,int *param_3,int param_4) { int *piVar1; int *piVar2; if (0 < param_2) { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if (0 < param_4) { piVar2 = param_3; do { if (*param_1 == *piVar2) { return 1; } piVar2 = piVar2 + 1; } while (piVar2 != param_3 + (ulong)(param_4 - 1) + 1); } param_1 = param_1 + 1; } while (param_1 != piVar1); } return 0; }
5,619
func0
#include <assert.h>
int func0(int* list1, int size1, int* list2, int size2){ for(int i = 0; i < size1; i++){ for(int j = 0; j < size2; j++){ if(list1[i] == list2[j]){ return 1; } } } return 0; }
int main(){ int list1_a[] = {1, 2, 3, 4, 5}; int list2_a[] = {5, 6, 7, 8, 9}; assert(func0(list1_a, 5, list2_a, 5) == 1); int list1_b[] = {1, 2, 3, 4, 5}; int list2_b[] = {6, 7, 8, 9}; assert(func0(list1_b, 5, list2_b, 4) == 0); int list1_c[] = {'a', 'b', 'c'}; int list2_c[] = {'d', 'b', 'e'}; assert(func0(list1_c, 3, list2_c, 3) == 1); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 1249 <func0+0x49> lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%r9 lea -0x1(%rcx),%eax lea 0x4(%rdx,%rax,4),%r8 test %ecx,%ecx jle 1240 <func0+0x40> mov (%rdi),%esi mov %rdx,%rax jmp 1231 <func0+0x31> nopl 0x0(%rax,%rax,1) add $0x4,%rax cmp %r8,%rax je 1240 <func0+0x40> cmp (%rax),%esi jne 1228 <func0+0x28> mov $0x1,%eax retq nopl 0x0(%rax,%rax,1) add $0x4,%rdi cmp %r9,%rdi jne 1218 <func0+0x18> xor %eax,%eax retq nopl 0x0(%rax)
func0: endbr64 test esi, esi jle short loc_1189 movsxd rsi, esi movsxd rax, ecx lea r8, [rdi+rsi*4] lea rsi, [rdx+rax*4] loc_1156: test ecx, ecx jle short loc_1190 loc_115A: mov ecx, [rdi] mov rax, rdx jmp short loc_1171 loc_1168: add rax, 4 cmp rax, rsi jz short loc_1180 loc_1171: cmp ecx, [rax] jnz short loc_1168 mov eax, 1 retn loc_1180: add rdi, 4 cmp rdi, r8 jnz short loc_115A loc_1189: xor eax, eax retn loc_1190: add rdi, 4 cmp rdi, r8 jnz short loc_1156 jmp short loc_1189
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4) { _DWORD *v4; // r8 _DWORD *v5; // rax if ( a2 > 0 ) { v4 = &a1[a2]; while ( a4 <= 0 ) { if ( ++a1 == v4 ) return 0LL; } do { v5 = a3; do { if ( *a1 == *v5 ) return 1LL; ++v5; } while ( v5 != &a3[a4] ); ++a1; } while ( a1 != v4 ); } return 0LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101189 MOVSXD RSI,ESI MOVSXD RAX,ECX LEA R8,[RDI + RSI*0x4] LEA RSI,[RDX + RAX*0x4] LAB_00101156: TEST ECX,ECX JLE 0x00101190 LAB_0010115a: MOV ECX,dword ptr [RDI] MOV RAX,RDX JMP 0x00101171 LAB_00101168: ADD RAX,0x4 CMP RAX,RSI JZ 0x00101180 LAB_00101171: CMP ECX,dword ptr [RAX] JNZ 0x00101168 MOV EAX,0x1 RET LAB_00101180: ADD RDI,0x4 CMP RDI,R8 JNZ 0x0010115a LAB_00101189: XOR EAX,EAX RET LAB_00101190: ADD RDI,0x4 CMP RDI,R8 JNZ 0x00101156 JMP 0x00101189
int8 func0(int *param_1,int param_2,int *param_3,int param_4) { int *piVar1; int *piVar2; if (0 < param_2) { piVar1 = param_1 + param_2; do { if (0 < param_4) { do { piVar2 = param_3; do { if (*param_1 == *piVar2) { return 1; } piVar2 = piVar2 + 1; } while (piVar2 != param_3 + param_4); param_1 = param_1 + 1; } while (param_1 != piVar1); return 0; } param_1 = param_1 + 1; } while (param_1 != piVar1); } return 0; }
5,620
func0
#include <assert.h>
double func0(double base1, double base2, double height) { double median = 0.5 * (base1 + base2); return median; }
int main() { assert(func0(15, 25, 35) == 20); assert(func0(10, 20, 30) == 15); assert(func0(6, 9, 4) == 7.5); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp movsd %xmm0,-0x18(%rbp) movsd %xmm1,-0x20(%rbp) movsd %xmm2,-0x28(%rbp) movsd -0x18(%rbp),%xmm0 movapd %xmm0,%xmm1 addsd -0x20(%rbp),%xmm1 movsd 0xf1a(%rip),%xmm0 mulsd %xmm1,%xmm0 movsd %xmm0,-0x8(%rbp) movsd -0x8(%rbp),%xmm0 pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp movsd [rbp+var_18], xmm0 movsd [rbp+var_20], xmm1 movsd [rbp+var_28], xmm2 movsd xmm0, [rbp+var_18] movapd xmm1, xmm0 addsd xmm1, [rbp+var_20] movsd xmm0, cs:qword_2078 mulsd xmm0, xmm1 movsd [rbp+var_8], xmm0 movsd xmm0, [rbp+var_8] pop rbp retn
double func0(double a1, double a2) { return 0.5 * (a1 + a2); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOVSD qword ptr [RBP + -0x18],XMM0 MOVSD qword ptr [RBP + -0x20],XMM1 MOVSD qword ptr [RBP + -0x28],XMM2 MOVSD XMM0,qword ptr [RBP + -0x18] MOVAPD XMM1,XMM0 ADDSD XMM1,qword ptr [RBP + -0x20] MOVSD XMM0,qword ptr [0x00102078] MULSD XMM0,XMM1 MOVSD qword ptr [RBP + -0x8],XMM0 MOVSD XMM0,qword ptr [RBP + -0x8] POP RBP RET
double func0(double param_1,double param_2) { return DAT_00102078 * (param_1 + param_2); }
5,621
func0
#include <assert.h>
double func0(double base1, double base2, double height) { double median = 0.5 * (base1 + base2); return median; }
int main() { assert(func0(15, 25, 35) == 20); assert(func0(10, 20, 30) == 15); assert(func0(6, 9, 4) == 7.5); return 0; }
O1
c
func0: endbr64 addsd %xmm1,%xmm0 mulsd 0xecf(%rip),%xmm0 retq
func0: endbr64 addsd xmm0, xmm1 mulsd xmm0, cs:qword_2008 retn
double func0(double a1, double a2) { return (a1 + a2) * 0.5; }
func0: ENDBR64 ADDSD XMM0,XMM1 MULSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(double param_1,double param_2) { return (param_1 + param_2) * _DAT_00102008; }
5,622
func0
#include <assert.h>
double func0(double base1, double base2, double height) { double median = 0.5 * (base1 + base2); return median; }
int main() { assert(func0(15, 25, 35) == 20); assert(func0(10, 20, 30) == 15); assert(func0(6, 9, 4) == 7.5); return 0; }
O2
c
func0: endbr64 addsd %xmm1,%xmm0 mulsd 0xeb8(%rip),%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 addsd xmm0, xmm1 mulsd xmm0, cs:qword_2008 retn
double func0(double a1, double a2) { return (a1 + a2) * 0.5; }
func0: ENDBR64 ADDSD XMM0,XMM1 MULSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(double param_1,double param_2) { return (param_1 + param_2) * _DAT_00102008; }
5,623
func0
#include <assert.h>
double func0(double base1, double base2, double height) { double median = 0.5 * (base1 + base2); return median; }
int main() { assert(func0(15, 25, 35) == 20); assert(func0(10, 20, 30) == 15); assert(func0(6, 9, 4) == 7.5); return 0; }
O3
c
func0: endbr64 addsd %xmm1,%xmm0 mulsd 0xeb8(%rip),%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 addsd xmm0, xmm1 mulsd xmm0, cs:qword_2008 retn
double func0(double a1, double a2) { return (a1 + a2) * 0.5; }
func0: ENDBR64 ADDSD XMM0,XMM1 MULSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(double param_1,double param_2) { return (param_1 + param_2) * _DAT_00102008; }
5,624
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h>
void func0(int arr[], int size, int number) { // Sort the array first for (int i = 0; i < size - 1; i++) { for (int j = 0; j < size - i - 1; j++) { if (arr[j] > arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } // Check if the number is greater than the last element in the sorted array if (number > arr[size - 1]) { printf("Yes, the entered number is greater than those in the array\n"); } else { printf("No, entered number is less than those in the array\n"); } }
int main() { int arr1[] = {1, 2, 3, 4, 5}; int arr2[] = {2, 3, 4, 5, 6}; int arr3[] = {9, 7, 4, 8, 6, 1}; func0(arr1, 5, 4); // Expected output: No, entered number is less than those in the array func0(arr2, 5, 8); // Expected output: Yes, the entered number is greater than those in the array func0(arr3, 6, 11); // Expected output: Yes, the entered number is greater than those in the array return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %edx,-0x20(%rbp) movl $0x0,-0xc(%rbp) jmpq 124c <func0+0xe3> movl $0x0,-0x8(%rbp) jmpq 1236 <func0+0xcd> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x8(%rbp),%eax cltq add $0x1,%rax lea 0x0(,%rax,4),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jle 1232 <func0+0xc9> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov %eax,-0x4(%rbp) mov -0x8(%rbp),%eax cltq add $0x1,%rax lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0x8(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x18(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) mov -0x8(%rbp),%eax cltq add $0x1,%rax lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rax,%rdx mov -0x4(%rbp),%eax mov %eax,(%rdx) addl $0x1,-0x8(%rbp) mov -0x1c(%rbp),%eax sub -0xc(%rbp),%eax sub $0x1,%eax cmp %eax,-0x8(%rbp) jl 1197 <func0+0x2e> addl $0x1,-0xc(%rbp) mov -0x1c(%rbp),%eax sub $0x1,%eax cmp %eax,-0xc(%rbp) jl 118b <func0+0x22> mov -0x1c(%rbp),%eax cltq shl $0x2,%rax lea -0x4(%rax),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax cmp %eax,-0x20(%rbp) jle 1284 <func0+0x11b> lea 0xd8b(%rip),%rdi callq 1060 <puts@plt> jmp 1290 <func0+0x127> lea 0xdbd(%rip),%rdi callq 1060 <puts@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_20], edx mov [rbp+var_C], 0 jmp loc_124C loc_118B: mov [rbp+var_8], 0 jmp loc_1236 loc_1197: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_8] cdqe add rax, 1 lea rcx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rcx mov eax, [rax] cmp edx, eax jle short loc_1232 mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] mov [rbp+var_4], eax mov eax, [rbp+var_8] cdqe add rax, 1 lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rbp+var_8] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+var_18] add rdx, rcx mov eax, [rax] mov [rdx], eax mov eax, [rbp+var_8] cdqe add rax, 1 lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rdx, rax mov eax, [rbp+var_4] mov [rdx], eax loc_1232: add [rbp+var_8], 1 loc_1236: mov eax, [rbp+var_1C] sub eax, [rbp+var_C] sub eax, 1 cmp [rbp+var_8], eax jl loc_1197 add [rbp+var_C], 1 loc_124C: mov eax, [rbp+var_1C] sub eax, 1 cmp [rbp+var_C], eax jl loc_118B mov eax, [rbp+var_1C] cdqe shl rax, 2 lea rdx, [rax-4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] cmp [rbp+var_20], eax jle short loc_1287 lea rax, s; "Yes, the entered number is greater than"... mov rdi, rax; s call _puts jmp short loc_1296 loc_1287: lea rax, aNoEnteredNumbe; "No, entered number is less than those i"... mov rdi, rax; s call _puts loc_1296: nop leave retn
int func0(long long a1, int a2, int a3) { int i; // [rsp+14h] [rbp-Ch] int j; // [rsp+18h] [rbp-8h] int v6; // [rsp+1Ch] [rbp-4h] for ( i = 0; i < a2 - 1; ++i ) { for ( j = 0; j < a2 - i - 1; ++j ) { if ( *(_DWORD *)(4LL * j + a1) > *(_DWORD *)(4 * (j + 1LL) + a1) ) { v6 = *(_DWORD *)(4LL * j + a1); *(_DWORD *)(4LL * j + a1) = *(_DWORD *)(4 * (j + 1LL) + a1); *(_DWORD *)(a1 + 4 * (j + 1LL)) = v6; } } } if ( a3 <= *(_DWORD *)(4LL * a2 - 4 + a1) ) return puts("No, entered number is less than those in the array"); else return puts("Yes, the entered number is greater than those in the array"); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x20],EDX MOV dword ptr [RBP + -0xc],0x0 JMP 0x0010124c LAB_0010118b: MOV dword ptr [RBP + -0x8],0x0 JMP 0x00101236 LAB_00101197: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x8] CDQE ADD RAX,0x1 LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JLE 0x00101232 MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x8] CDQE ADD RAX,0x1 LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0x8] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x18] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX MOV EAX,dword ptr [RBP + -0x8] CDQE ADD RAX,0x1 LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x4] MOV dword ptr [RDX],EAX LAB_00101232: ADD dword ptr [RBP + -0x8],0x1 LAB_00101236: MOV EAX,dword ptr [RBP + -0x1c] SUB EAX,dword ptr [RBP + -0xc] SUB EAX,0x1 CMP dword ptr [RBP + -0x8],EAX JL 0x00101197 ADD dword ptr [RBP + -0xc],0x1 LAB_0010124c: MOV EAX,dword ptr [RBP + -0x1c] SUB EAX,0x1 CMP dword ptr [RBP + -0xc],EAX JL 0x0010118b MOV EAX,dword ptr [RBP + -0x1c] CDQE SHL RAX,0x2 LEA RDX,[RAX + -0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x20],EAX JLE 0x00101287 LEA RAX,[0x102008] MOV RDI,RAX CALL 0x00101060 JMP 0x00101296 LAB_00101287: LEA RAX,[0x102048] MOV RDI,RAX CALL 0x00101060 LAB_00101296: NOP LEAVE RET
void func0(long param_1,int param_2,int param_3) { int4 uVar1; int local_14; int local_10; for (local_14 = 0; local_14 < param_2 + -1; local_14 = local_14 + 1) { for (local_10 = 0; local_10 < (param_2 - local_14) + -1; local_10 = local_10 + 1) { if (*(int *)(param_1 + ((long)local_10 + 1) * 4) < *(int *)(param_1 + (long)local_10 * 4)) { uVar1 = *(int4 *)(param_1 + (long)local_10 * 4); *(int4 *)(param_1 + (long)local_10 * 4) = *(int4 *)(param_1 + ((long)local_10 + 1) * 4); *(int4 *)(((long)local_10 + 1) * 4 + param_1) = uVar1; } } } if (*(int *)(param_1 + (long)param_2 * 4 + -4) < param_3) { puts("Yes, the entered number is greater than those in the array"); } else { puts("No, entered number is less than those in the array"); } return; }
5,625
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h>
void func0(int arr[], int size, int number) { // Sort the array first for (int i = 0; i < size - 1; i++) { for (int j = 0; j < size - i - 1; j++) { if (arr[j] > arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } // Check if the number is greater than the last element in the sorted array if (number > arr[size - 1]) { printf("Yes, the entered number is greater than those in the array\n"); } else { printf("No, entered number is less than those in the array\n"); } }
int main() { int arr1[] = {1, 2, 3, 4, 5}; int arr2[] = {2, 3, 4, 5, 6}; int arr3[] = {9, 7, 4, 8, 6, 1}; func0(arr1, 5, 4); // Expected output: No, entered number is less than those in the array func0(arr2, 5, 8); // Expected output: Yes, the entered number is greater than those in the array func0(arr3, 6, 11); // Expected output: Yes, the entered number is greater than those in the array return 0; }
O1
c
func0: endbr64 sub $0x8,%rsp lea -0x1(%rsi),%r10d test %r10d,%r10d jle 11b4 <func0+0x4b> lea 0x4(%rdi),%r11 jmp 11a2 <func0+0x39> add $0x4,%rax cmp %r9,%rax je 119c <func0+0x33> mov (%rax),%ecx mov 0x4(%rax),%r8d cmp %r8d,%ecx jle 1180 <func0+0x17> mov %r8d,(%rax) mov %ecx,0x4(%rax) jmp 1180 <func0+0x17> sub $0x1,%r10d je 11b4 <func0+0x4b> test %r10d,%r10d jle 119c <func0+0x33> mov %rdi,%rax lea -0x1(%r10),%ecx lea (%r11,%rcx,4),%r9 jmp 1189 <func0+0x20> movslq %esi,%rsi cmp %edx,-0x4(%rdi,%rsi,4) jge 11ce <func0+0x65> lea 0xe44(%rip),%rdi callq 1060 <puts@plt> add $0x8,%rsp retq lea 0xe73(%rip),%rdi callq 1060 <puts@plt> jmp 11c9 <func0+0x60>
func0: endbr64 sub rsp, 8 mov r10, rdi lea r9d, [rsi-1] test r9d, r9d jle short loc_11B4 lea r11, [rdi+4] jmp short loc_11A2 loc_1183: add rax, 4 cmp rax, r8 jz short loc_119C loc_118C: mov ecx, [rax] mov edi, [rax+4] cmp ecx, edi jle short loc_1183 mov [rax], edi mov [rax+4], ecx jmp short loc_1183 loc_119C: sub r9d, 1 jz short loc_11B4 loc_11A2: test r9d, r9d jle short loc_119C mov rax, r10 lea ecx, [r9-1] lea r8, [r11+rcx*4] jmp short loc_118C loc_11B4: movsxd rsi, esi cmp [r10+rsi*4-4], edx jge short loc_11CF lea rdi, aYesTheEnteredN; "Yes, the entered number is greater than"... call _puts loc_11CA: add rsp, 8 retn loc_11CF: lea rdi, aNoEnteredNumbe; "No, entered number is less than those i"... call _puts jmp short loc_11CA
long long func0(int *a1, int a2, int a3) { int v4; // r9d _DWORD *v5; // r11 int *v6; // rax int v7; // ecx int v8; // edi v4 = a2 - 1; if ( a2 - 1 > 0 ) { v5 = a1 + 1; do { if ( v4 > 0 ) { v6 = a1; do { v7 = *v6; v8 = v6[1]; if ( *v6 > v8 ) { *v6 = v8; v6[1] = v7; } ++v6; } while ( v6 != &v5[v4 - 1] ); } --v4; } while ( v4 ); } if ( a1[a2 - 1] >= a3 ) return puts("No, entered number is less than those in the array"); else return puts("Yes, the entered number is greater than those in the array"); }
func0: ENDBR64 SUB RSP,0x8 MOV R10,RDI LEA R9D,[RSI + -0x1] TEST R9D,R9D JLE 0x001011b4 LEA R11,[RDI + 0x4] JMP 0x001011a2 LAB_00101183: ADD RAX,0x4 CMP RAX,R8 JZ 0x0010119c LAB_0010118c: MOV ECX,dword ptr [RAX] MOV EDI,dword ptr [RAX + 0x4] CMP ECX,EDI JLE 0x00101183 MOV dword ptr [RAX],EDI MOV dword ptr [RAX + 0x4],ECX JMP 0x00101183 LAB_0010119c: SUB R9D,0x1 JZ 0x001011b4 LAB_001011a2: TEST R9D,R9D JLE 0x0010119c MOV RAX,R10 LEA ECX,[R9 + -0x1] LEA R8,[R11 + RCX*0x4] JMP 0x0010118c LAB_001011b4: MOVSXD RSI,ESI CMP dword ptr [R10 + RSI*0x4 + -0x4],EDX JGE 0x001011cf LEA RDI,[0x102008] CALL 0x00101060 LAB_001011ca: ADD RSP,0x8 RET LAB_001011cf: LEA RDI,[0x102048] CALL 0x00101060 JMP 0x001011ca
void func0(int *param_1,int param_2,int param_3) { int iVar1; int *piVar2; int iVar3; iVar3 = param_2 + -1; if (0 < iVar3) { do { if (0 < iVar3) { piVar2 = param_1; do { iVar1 = *piVar2; if (piVar2[1] < iVar1) { *piVar2 = piVar2[1]; piVar2[1] = iVar1; } piVar2 = piVar2 + 1; } while (piVar2 != param_1 + (ulong)(iVar3 - 1) + 1); } iVar3 = iVar3 + -1; } while (iVar3 != 0); } if (param_1[(long)param_2 + -1] < param_3) { puts("Yes, the entered number is greater than those in the array"); } else { puts("No, entered number is less than those in the array"); } return; }
5,626
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h>
void func0(int arr[], int size, int number) { // Sort the array first for (int i = 0; i < size - 1; i++) { for (int j = 0; j < size - i - 1; j++) { if (arr[j] > arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } // Check if the number is greater than the last element in the sorted array if (number > arr[size - 1]) { printf("Yes, the entered number is greater than those in the array\n"); } else { printf("No, entered number is less than those in the array\n"); } }
int main() { int arr1[] = {1, 2, 3, 4, 5}; int arr2[] = {2, 3, 4, 5, 6}; int arr3[] = {9, 7, 4, 8, 6, 1}; func0(arr1, 5, 4); // Expected output: No, entered number is less than those in the array func0(arr2, 5, 8); // Expected output: Yes, the entered number is greater than those in the array func0(arr3, 6, 11); // Expected output: Yes, the entered number is greater than those in the array return 0; }
O2
c
func0: endbr64 lea -0x1(%rsi),%ecx test %ecx,%ecx jle 12a2 <func0+0x42> lea 0x4(%rdi),%r11 sub $0x1,%ecx mov %rdi,%rax mov %rcx,%r10 lea (%r11,%rcx,4),%r9 nopl (%rax) mov (%rax),%ecx mov 0x4(%rax),%r8d cmp %r8d,%ecx jle 1291 <func0+0x31> mov %r8d,(%rax) mov %ecx,0x4(%rax) add $0x4,%rax cmp %r9,%rax jne 1280 <func0+0x20> mov %r10d,%ecx test %r10d,%r10d jne 1270 <func0+0x10> movslq %esi,%rsi cmp %edx,-0x4(%rdi,%rsi,4) jge 12b7 <func0+0x57> lea 0xd56(%rip),%rdi jmpq 1060 <puts@plt> lea 0xd8a(%rip),%rdi jmpq 1060 <puts@plt> nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 lea ecx, [rsi-1] mov r10, rdi test ecx, ecx jle short loc_12A7 lea r11, [rdi+4] nop word ptr [rax+rax+00h] loc_1278: sub ecx, 1 mov rax, r10 mov r9, rcx lea r8, [r11+rcx*4] nop dword ptr [rax] loc_1288: mov ecx, [rax] mov edi, [rax+4] cmp ecx, edi jle short loc_1296 mov [rax], edi mov [rax+4], ecx loc_1296: add rax, 4 cmp rax, r8 jnz short loc_1288 mov ecx, r9d test r9d, r9d jnz short loc_1278 loc_12A7: movsxd rsi, esi cmp [r10+rsi*4-4], edx jge short loc_12BD lea rdi, aYesTheEnteredN; "Yes, the entered number is greater than"... jmp _puts loc_12BD: lea rdi, aNoEnteredNumbe; "No, entered number is less than those i"... jmp _puts
long long func0(int *a1, int a2, int a3) { int v3; // ecx _DWORD *v5; // r11 int *v6; // rax long long v7; // r9 int v8; // ecx int v9; // edi v3 = a2 - 1; if ( a2 - 1 > 0 ) { v5 = a1 + 1; do { v6 = a1; v7 = (unsigned int)(v3 - 1); do { v8 = *v6; v9 = v6[1]; if ( *v6 > v9 ) { *v6 = v9; v6[1] = v8; } ++v6; } while ( v6 != &v5[v7] ); v3 = v7; } while ( (_DWORD)v7 ); } if ( a1[a2 - 1] >= a3 ) return puts("No, entered number is less than those in the array"); else return puts("Yes, the entered number is greater than those in the array"); }
func0: ENDBR64 LEA ECX,[RSI + -0x1] MOV R10,RDI TEST ECX,ECX JLE 0x001012a7 LEA R11,[RDI + 0x4] NOP word ptr [RAX + RAX*0x1] LAB_00101278: SUB ECX,0x1 MOV RAX,R10 MOV R9,RCX LEA R8,[R11 + RCX*0x4] NOP dword ptr [RAX] LAB_00101288: MOV ECX,dword ptr [RAX] MOV EDI,dword ptr [RAX + 0x4] CMP ECX,EDI JLE 0x00101296 MOV dword ptr [RAX],EDI MOV dword ptr [RAX + 0x4],ECX LAB_00101296: ADD RAX,0x4 CMP RAX,R8 JNZ 0x00101288 MOV ECX,R9D TEST R9D,R9D JNZ 0x00101278 LAB_001012a7: MOVSXD RSI,ESI CMP dword ptr [R10 + RSI*0x4 + -0x4],EDX JGE 0x001012bd LEA RDI,[0x102008] JMP 0x00101060 LAB_001012bd: LEA RDI,[0x102048] JMP 0x00101060
void func0(int *param_1,int param_2,int param_3) { int iVar1; int *piVar2; uint uVar3; uVar3 = param_2 - 1; if (0 < (int)uVar3) { do { uVar3 = uVar3 - 1; piVar2 = param_1; do { iVar1 = *piVar2; if (piVar2[1] < iVar1) { *piVar2 = piVar2[1]; piVar2[1] = iVar1; } piVar2 = piVar2 + 1; } while (piVar2 != param_1 + (ulong)uVar3 + 1); } while (uVar3 != 0); } if (param_3 <= param_1[(long)param_2 + -1]) { puts("No, entered number is less than those in the array"); return; } puts("Yes, the entered number is greater than those in the array"); return; }
5,627
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h>
void func0(int arr[], int size, int number) { // Sort the array first for (int i = 0; i < size - 1; i++) { for (int j = 0; j < size - i - 1; j++) { if (arr[j] > arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } // Check if the number is greater than the last element in the sorted array if (number > arr[size - 1]) { printf("Yes, the entered number is greater than those in the array\n"); } else { printf("No, entered number is less than those in the array\n"); } }
int main() { int arr1[] = {1, 2, 3, 4, 5}; int arr2[] = {2, 3, 4, 5, 6}; int arr3[] = {9, 7, 4, 8, 6, 1}; func0(arr1, 5, 4); // Expected output: No, entered number is less than those in the array func0(arr2, 5, 8); // Expected output: Yes, the entered number is greater than those in the array func0(arr3, 6, 11); // Expected output: Yes, the entered number is greater than those in the array return 0; }
O3
c
func0: endbr64 lea -0x1(%rsi),%ecx test %ecx,%ecx jle 1272 <func0+0x42> lea 0x4(%rdi),%r11 sub $0x1,%ecx mov %rdi,%rax mov %rcx,%r10 lea (%r11,%rcx,4),%r9 nopl (%rax) mov (%rax),%ecx mov 0x4(%rax),%r8d cmp %r8d,%ecx jle 1261 <func0+0x31> mov %r8d,(%rax) mov %ecx,0x4(%rax) add $0x4,%rax cmp %r9,%rax jne 1250 <func0+0x20> mov %r10d,%ecx test %r10d,%r10d jne 1240 <func0+0x10> movslq %esi,%rsi cmp %edx,-0x4(%rdi,%rsi,4) jge 1287 <func0+0x57> lea 0xd86(%rip),%rdi jmpq 1060 <puts@plt> lea 0xdba(%rip),%rdi jmpq 1060 <puts@plt> nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 mov r10, rdi cmp esi, 1 jle short loc_1281 mov r9d, esi lea r11, [rdi+4] nop dword ptr [rax+rax+00h] loc_1238: cmp r9d, 1 jle short loc_12A0 lea ecx, [r9-2] mov rax, r10 lea r8, [r11+rcx*4] nop dword ptr [rax+00000000h] loc_1250: movq xmm0, qword ptr [rax] pshufd xmm1, xmm0, 0E5h movd ecx, xmm0 movd edi, xmm1 cmp edi, ecx jge short loc_126E pshufd xmm0, xmm0, 0E1h movq qword ptr [rax], xmm0 loc_126E: add rax, 4 cmp rax, r8 jnz short loc_1250 sub r9d, 1 cmp r9d, 1 jnz short loc_1238 loc_1281: movsxd rsi, esi cmp [r10+rsi*4-4], edx jge short loc_12A6 lea rdi, s; "Yes, the entered number is greater than"... jmp _puts loc_12A0: sub r9d, 1 jmp short loc_1238 loc_12A6: lea rdi, aNoEnteredNumbe; "No, entered number is less than those i"... jmp _puts
int func0(__m128i *a1, int a2, __int32 a3) { int i; // r9d __m128i *v4; // rax __m128i v5; // xmm0 if ( a2 > 1 ) { for ( i = a2; i != 1; --i ) { while ( i <= 1 ) --i; v4 = a1; do { v5 = _mm_loadl_epi64(v4); if ( _mm_cvtsi128_si32(_mm_shuffle_epi32(v5, 229)) < _mm_cvtsi128_si32(v5) ) v4->m128i_i64[0] = _mm_shuffle_epi32(v5, 225).m128i_u64[0]; v4 = (__m128i *)((char *)v4 + 4); } while ( v4 != (__m128i *)((char *)a1->m128i_i64 + 4 * (unsigned int)(i - 2) + 4) ); } } if ( a1->m128i_i32[a2 - 1] >= a3 ) return puts("No, entered number is less than those in the array"); else return puts("Yes, the entered number is greater than those in the array"); }
func0: ENDBR64 MOV R10,RDI CMP ESI,0x1 JLE 0x00101281 MOV R9D,ESI LEA R11,[RDI + 0x4] NOP dword ptr [RAX + RAX*0x1] LAB_00101238: CMP R9D,0x1 JLE 0x001012a0 LEA ECX,[R9 + -0x2] MOV RAX,R10 LEA R8,[R11 + RCX*0x4] NOP dword ptr [RAX] LAB_00101250: MOVQ XMM0,qword ptr [RAX] PSHUFD XMM1,XMM0,0xe5 MOVD ECX,XMM0 MOVD EDI,XMM1 CMP EDI,ECX JGE 0x0010126e PSHUFD XMM0,XMM0,0xe1 MOVQ qword ptr [RAX],XMM0 LAB_0010126e: ADD RAX,0x4 CMP RAX,R8 JNZ 0x00101250 SUB R9D,0x1 CMP R9D,0x1 JNZ 0x00101238 LAB_00101281: MOVSXD RSI,ESI CMP dword ptr [R10 + RSI*0x4 + -0x4],EDX JGE 0x001012a6 LEA RDI,[0x102008] JMP 0x00101060 LAB_001012a0: SUB R9D,0x1 JMP 0x00101238 LAB_001012a6: LEA RDI,[0x102048] JMP 0x00101060
void func0(int8 *param_1,int param_2,int param_3) { int8 *puVar1; int iVar2; int iVar3; int iVar4; iVar2 = param_2; if (1 < param_2) { do { for (; iVar2 < 2; iVar2 = iVar2 + -1) { } puVar1 = param_1; do { iVar3 = (int)*puVar1; iVar4 = (int)((ulong)*puVar1 >> 0x20); if (iVar4 < iVar3) { *puVar1 = CONCAT44(iVar3,iVar4); } puVar1 = (int8 *)((long)puVar1 + 4); } while (puVar1 != (int8 *)((long)param_1 + (ulong)(iVar2 - 2) * 4 + 4)); iVar2 = iVar2 + -1; } while (iVar2 != 1); } if (param_3 <= *(int *)((long)param_1 + (long)param_2 * 4 + -4)) { puts("No, entered number is less than those in the array"); return; } puts("Yes, the entered number is greater than those in the array"); return; }
5,628
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <regex.h>
const char* func0(const char* text) { regex_t regex; int ret; // Compile the regular expression pattern ret = regcomp(&regex, "ab+", REG_EXTENDED); if (ret) { return "Regex compilation failed!"; } // Execute the regular expression ret = regexec(&regex, text, 0, NULL, 0); regfree(&regex); if (ret == 0) { return "Found a match!"; } else { return "Not matched!"; } }
int main() { assert(strcmp(func0("ac"), "Not matched!") == 0); assert(strcmp(func0("dc"), "Not matched!") == 0); assert(strcmp(func0("abba"), "Found a match!") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x70,%rsp mov %rdi,-0x68(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea -0x50(%rbp),%rax mov $0x1,%edx lea 0xdf0(%rip),%rsi mov %rax,%rdi callq 10d0 <regcomp@plt> mov %eax,-0x54(%rbp) cmpl $0x0,-0x54(%rbp) je 1232 <func0+0x49> lea 0xddc(%rip),%rax jmp 1277 <func0+0x8e> mov -0x68(%rbp),%rsi lea -0x50(%rbp),%rax mov $0x0,%r8d mov $0x0,%ecx mov $0x0,%edx mov %rax,%rdi callq 10f0 <regexec@plt> mov %eax,-0x54(%rbp) lea -0x50(%rbp),%rax mov %rax,%rdi callq 10a0 <regfree@plt> cmpl $0x0,-0x54(%rbp) jne 1270 <func0+0x87> lea 0xdb8(%rip),%rax jmp 1277 <func0+0x8e> lea 0xdbe(%rip),%rax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 128b <func0+0xa2> callq 10b0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 70h mov [rbp+string], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea rax, [rbp+preg] mov edx, 1; cflags lea rcx, pattern; "ab+" mov rsi, rcx; pattern mov rdi, rax; preg call _regcomp mov [rbp+var_54], eax cmp [rbp+var_54], 0 jz short loc_1235 lea rax, aRegexCompilati; "Regex compilation failed!" jmp short loc_127A loc_1235: mov rsi, [rbp+string]; string lea rax, [rbp+preg] mov r8d, 0; eflags mov ecx, 0; pmatch mov edx, 0; nmatch mov rdi, rax; preg call _regexec mov [rbp+var_54], eax lea rax, [rbp+preg] mov rdi, rax; preg call _regfree cmp [rbp+var_54], 0 jnz short loc_1273 lea rax, aFoundAMatch; "Found a match!" jmp short loc_127A loc_1273: lea rax, s2; "Not matched!" loc_127A: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_128E call ___stack_chk_fail locret_128E: leave retn
const char * func0(const char *a1) { int v2; // [rsp+1Ch] [rbp-54h] regex_t preg; // [rsp+20h] [rbp-50h] BYREF unsigned long long v4; // [rsp+68h] [rbp-8h] v4 = __readfsqword(0x28u); if ( regcomp(&preg, "ab+", 1) ) return "Regex compilation failed!"; v2 = regexec(&preg, a1, 0LL, 0LL, 0); regfree(&preg); if ( v2 ) return "Not matched!"; else return "Found a match!"; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x70 MOV qword ptr [RBP + -0x68],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX LEA RAX,[RBP + -0x50] MOV EDX,0x1 LEA RCX,[0x102008] MOV RSI,RCX MOV RDI,RAX CALL 0x001010d0 MOV dword ptr [RBP + -0x54],EAX CMP dword ptr [RBP + -0x54],0x0 JZ 0x00101235 LEA RAX,[0x10200c] JMP 0x0010127a LAB_00101235: MOV RSI,qword ptr [RBP + -0x68] LEA RAX,[RBP + -0x50] MOV R8D,0x0 MOV ECX,0x0 MOV EDX,0x0 MOV RDI,RAX CALL 0x001010f0 MOV dword ptr [RBP + -0x54],EAX LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001010a0 CMP dword ptr [RBP + -0x54],0x0 JNZ 0x00101273 LEA RAX,[0x102026] JMP 0x0010127a LAB_00101273: LEA RAX,[0x102035] LAB_0010127a: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x0010128e CALL 0x001010b0 LAB_0010128e: LEAVE RET
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t local_58; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&local_58,"ab+",1); if (iVar1 == 0) { iVar1 = regexec(&local_58,param_1,0,(regmatch_t *)0x0,0); regfree(&local_58); if (iVar1 == 0) { pcVar2 = "Found a match!"; } else { pcVar2 = "Not matched!"; } } else { pcVar2 = "Regex compilation failed!"; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return pcVar2; }
5,629
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <regex.h>
const char* func0(const char* text) { regex_t regex; int ret; // Compile the regular expression pattern ret = regcomp(&regex, "ab+", REG_EXTENDED); if (ret) { return "Regex compilation failed!"; } // Execute the regular expression ret = regexec(&regex, text, 0, NULL, 0); regfree(&regex); if (ret == 0) { return "Found a match!"; } else { return "Not matched!"; } }
int main() { assert(strcmp(func0("ac"), "Not matched!") == 0); assert(strcmp(func0("dc"), "Not matched!") == 0); assert(strcmp(func0("abba"), "Found a match!") == 0); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x58,%rsp mov %rdi,%rbx mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov %rsp,%rdi mov $0x1,%edx lea 0xe45(%rip),%rsi callq 10c0 <regcomp@plt> mov %eax,%edx lea 0xe01(%rip),%rax test %edx,%edx je 121e <func0+0x55> mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 125c <func0+0x93> add $0x58,%rsp pop %rbx pop %rbp retq mov %rsp,%rbp mov $0x0,%r8d mov $0x0,%ecx mov $0x0,%edx mov %rbx,%rsi mov %rbp,%rdi callq 10d0 <regexec@plt> mov %eax,%ebx mov %rbp,%rdi callq 1090 <regfree@plt> test %ebx,%ebx lea 0xdcf(%rip),%rax lea 0xdd7(%rip),%rdx cmovne %rdx,%rax jmp 1207 <func0+0x3e> callq 10a0 <__stack_chk_fail@plt>
func0: endbr64 push rbp push rbx sub rsp, 58h mov rbx, rdi mov rax, fs:28h mov [rsp+68h+var_20], rax xor eax, eax mov rdi, rsp mov edx, 1 lea rsi, aAb; "ab+" call _regcomp mov edx, eax lea rax, aRegexCompilati; "Regex compilation failed!" test edx, edx jz short loc_123E loc_1227: mov rdx, [rsp+68h+var_20] sub rdx, fs:28h jnz short loc_127C add rsp, 58h pop rbx pop rbp retn loc_123E: mov rbp, rsp mov r8d, 0 mov ecx, 0 mov edx, 0 mov rsi, rbx mov rdi, rbp call _regexec mov ebx, eax mov rdi, rbp call _regfree test ebx, ebx lea rax, aFoundAMatch; "Found a match!" lea rdx, aNotMatched; "Not matched!" cmovnz rax, rdx jmp short loc_1227 loc_127C: call ___stack_chk_fail
const char * func0(long long a1) { int v1; // edx const char *result; // rax int v3; // ebx _QWORD v4[13]; // [rsp+0h] [rbp-68h] BYREF v4[9] = __readfsqword(0x28u); v1 = regcomp(v4, "ab+", 1LL); result = "Regex compilation failed!"; if ( !v1 ) { v3 = regexec(v4, a1, 0LL, 0LL, 0LL); regfree(v4); result = "Found a match!"; if ( v3 ) return "Not matched!"; } return result; }
5,630
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <regex.h>
const char* func0(const char* text) { regex_t regex; int ret; // Compile the regular expression pattern ret = regcomp(&regex, "ab+", REG_EXTENDED); if (ret) { return "Regex compilation failed!"; } // Execute the regular expression ret = regexec(&regex, text, 0, NULL, 0); regfree(&regex); if (ret == 0) { return "Found a match!"; } else { return "Not matched!"; } }
int main() { assert(strcmp(func0("ac"), "Not matched!") == 0); assert(strcmp(func0("dc"), "Not matched!") == 0); assert(strcmp(func0("abba"), "Found a match!") == 0); return 0; }
O2
c
func0: endbr64 push %r12 mov $0x1,%edx lea 0xd78(%rip),%rsi push %rbp mov %rdi,%rbp sub $0x58,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov %rsp,%r12 mov %r12,%rdi callq 10c0 <regcomp@plt> mov %eax,%r8d lea 0xd15(%rip),%rax test %r8d,%r8d jne 1321 <func0+0x71> xor %edx,%edx xor %ecx,%ecx mov %rbp,%rsi mov %r12,%rdi callq 10d0 <regexec@plt> mov %r12,%rdi mov %eax,%ebp callq 1090 <regfree@plt> test %ebp,%ebp lea 0xd08(%rip),%rax lea 0xd10(%rip),%rdx cmovne %rdx,%rax mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 1339 <func0+0x89> add $0x58,%rsp pop %rbp pop %r12 retq callq 10a0 <__stack_chk_fail@plt> xchg %ax,%ax
func0: endbr64 push r12 mov edx, 1 lea rsi, aAb; "ab+" push rbp mov rbp, rdi sub rsp, 58h mov rax, fs:28h mov [rsp+68h+var_20], rax xor eax, eax mov r12, rsp mov rdi, r12 call _regcomp mov r8d, eax lea rax, aRegexCompilati; "Regex compilation failed!" test r8d, r8d jnz short loc_1331 xor edx, edx xor ecx, ecx mov rsi, rbp mov rdi, r12 call _regexec mov rdi, r12 mov ebp, eax call _regfree test ebp, ebp lea rax, aFoundAMatch; "Found a match!" lea rdx, aNotMatched; "Not matched!" cmovnz rax, rdx loc_1331: mov rdx, [rsp+68h+var_20] sub rdx, fs:28h jnz short loc_1349 add rsp, 58h pop rbp pop r12 retn loc_1349: call ___stack_chk_fail
const char * func0(long long a1) { int v1; // r8d const char *result; // rax int v3; // ebp _QWORD v4[13]; // [rsp+0h] [rbp-68h] BYREF v4[9] = __readfsqword(0x28u); v1 = regcomp(v4, "ab+", 1LL); result = "Regex compilation failed!"; if ( !v1 ) { v3 = regexec(v4, a1, 0LL, 0LL); regfree(v4); result = "Found a match!"; if ( v3 ) return "Not matched!"; } return result; }
func0: ENDBR64 PUSH R12 MOV EDX,0x1 LEA RSI,[0x10203a] PUSH RBP MOV RBP,RDI SUB RSP,0x58 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV R12,RSP MOV RDI,R12 CALL 0x001010d0 MOV R8D,EAX LEA RAX,[0x102004] TEST R8D,R8D JNZ 0x00101331 XOR EDX,EDX XOR ECX,ECX MOV RSI,RBP MOV RDI,R12 CALL 0x001010f0 MOV RDI,R12 MOV EBP,EAX CALL 0x001010a0 TEST EBP,EBP LEA RAX,[0x10201e] LEA RDX,[0x10202d] CMOVNZ RAX,RDX LAB_00101331: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101349 ADD RSP,0x58 POP RBP POP R12 RET LAB_00101349: CALL 0x001010b0
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_68; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"ab+",1); pcVar2 = "Regex compilation failed!"; if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0); regfree(&rStack_68); pcVar2 = "Found a match!"; if (iVar1 != 0) { pcVar2 = "Not matched!"; } } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,631
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <regex.h>
const char* func0(const char* text) { regex_t regex; int ret; // Compile the regular expression pattern ret = regcomp(&regex, "ab+", REG_EXTENDED); if (ret) { return "Regex compilation failed!"; } // Execute the regular expression ret = regexec(&regex, text, 0, NULL, 0); regfree(&regex); if (ret == 0) { return "Found a match!"; } else { return "Not matched!"; } }
int main() { assert(strcmp(func0("ac"), "Not matched!") == 0); assert(strcmp(func0("dc"), "Not matched!") == 0); assert(strcmp(func0("abba"), "Found a match!") == 0); return 0; }
O3
c
func0: endbr64 push %r12 mov $0x1,%edx lea 0xd78(%rip),%rsi push %rbp mov %rdi,%rbp sub $0x58,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov %rsp,%r12 mov %r12,%rdi callq 10c0 <regcomp@plt> mov %eax,%r8d lea 0xd15(%rip),%rax test %r8d,%r8d jne 1321 <func0+0x71> xor %edx,%edx xor %ecx,%ecx mov %rbp,%rsi mov %r12,%rdi callq 10d0 <regexec@plt> mov %r12,%rdi mov %eax,%ebp callq 1090 <regfree@plt> test %ebp,%ebp lea 0xd08(%rip),%rax lea 0xd10(%rip),%rdx cmovne %rdx,%rax mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 1339 <func0+0x89> add $0x58,%rsp pop %rbp pop %r12 retq callq 10a0 <__stack_chk_fail@plt> xchg %ax,%ax
func0: endbr64 push rbp mov edx, 1; cflags lea rsi, pattern; "ab+" push rbx mov rbx, rdi sub rsp, 58h mov rax, fs:28h mov [rsp+var_s48], rax xor eax, eax mov rbp, rsp mov rdi, rbp; preg call _regcomp mov edx, eax lea rax, aRegexCompilati; "Regex compilation failed!" test edx, edx jnz short loc_1331 xor edx, edx; nmatch xor r8d, r8d; eflags xor ecx, ecx; pmatch mov rsi, rbx; string mov rdi, rbp; preg call _regexec mov rdi, rbp; preg mov ebx, eax call _regfree test ebx, ebx lea rax, s2; "Not matched!" lea rdx, aFoundAMatch; "Found a match!" cmovz rax, rdx loc_1331: mov rdx, [rsp+var_s48] sub rdx, fs:28h jnz short loc_1348 add rsp, 58h pop rbx pop rbp retn loc_1348: call ___stack_chk_fail
const char * func0(char *string) { int v1; // edx const char *result; // rax int v3; // ebx regex_t _0; // [rsp+0h] [rbp+0h] BYREF unsigned long long vars48; // [rsp+48h] [rbp+48h] vars48 = __readfsqword(0x28u); v1 = regcomp(&_0, "ab+", 1); result = "Regex compilation failed!"; if ( !v1 ) { v3 = regexec(&_0, string, 0LL, 0LL, 0); regfree(&_0); result = "Not matched!"; if ( !v3 ) return "Found a match!"; } return result; }
func0: ENDBR64 PUSH RBP MOV EDX,0x1 LEA RSI,[0x10203a] PUSH RBX MOV RBX,RDI SUB RSP,0x58 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV RBP,RSP MOV RDI,RBP CALL 0x001010d0 MOV EDX,EAX LEA RAX,[0x102004] TEST EDX,EDX JNZ 0x00101331 XOR EDX,EDX XOR R8D,R8D XOR ECX,ECX MOV RSI,RBX MOV RDI,RBP CALL 0x001010f0 MOV RDI,RBP MOV EBX,EAX CALL 0x001010a0 TEST EBX,EBX LEA RAX,[0x10202d] LEA RDX,[0x10201e] CMOVZ RAX,RDX LAB_00101331: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101348 ADD RSP,0x58 POP RBX POP RBP RET LAB_00101348: CALL 0x001010b0
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_68; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"ab+",1); pcVar2 = "Regex compilation failed!"; if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0); regfree(&rStack_68); pcVar2 = "Not matched!"; if (iVar1 == 0) { pcVar2 = "Found a match!"; } } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,632
func0
#include <assert.h>
int func0(int n) { return n % 10; }
int main() { assert(func0(123) == 3); assert(func0(25) == 5); assert(func0(30) == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov -0x4(%rbp),%ecx movslq %ecx,%rax imul $0x66666667,%rax,%rax shr $0x20,%rax mov %eax,%edx sar $0x2,%edx mov %ecx,%eax sar $0x1f,%eax sub %eax,%edx mov %edx,%eax shl $0x2,%eax add %edx,%eax add %eax,%eax sub %eax,%ecx mov %ecx,%edx mov %edx,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov ecx, [rbp+var_4] movsxd rax, ecx imul rax, 66666667h shr rax, 20h mov edx, eax sar edx, 2 mov eax, ecx sar eax, 1Fh sub edx, eax mov eax, edx shl eax, 2 add eax, edx add eax, eax sub ecx, eax mov edx, ecx mov eax, edx pop rbp retn
long long func0(int a1) { return (unsigned int)(a1 % 10); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV ECX,dword ptr [RBP + -0x4] MOVSXD RAX,ECX IMUL RAX,RAX,0x66666667 SHR RAX,0x20 MOV EDX,EAX SAR EDX,0x2 MOV EAX,ECX SAR EAX,0x1f SUB EDX,EAX MOV EAX,EDX SHL EAX,0x2 ADD EAX,EDX ADD EAX,EAX SUB ECX,EAX MOV EDX,ECX MOV EAX,EDX POP RBP RET
int func0(int param_1) { return param_1 % 10; }
5,633
func0
#include <assert.h>
int func0(int n) { return n % 10; }
int main() { assert(func0(123) == 3); assert(func0(25) == 5); assert(func0(30) == 0); return 0; }
O1
c
func0: endbr64 movslq %edi,%rax imul $0x66666667,%rax,%rax sar $0x22,%rax mov %edi,%edx sar $0x1f,%edx sub %edx,%eax lea (%rax,%rax,4),%eax add %eax,%eax sub %eax,%edi mov %edi,%eax retq
func0: endbr64 movsxd rax, edi imul rax, 66666667h sar rax, 22h mov edx, edi sar edx, 1Fh sub eax, edx lea edx, [rax+rax*4] add edx, edx mov eax, edi sub eax, edx retn
long long func0(int a1) { return (unsigned int)(a1 % 10); }
func0: ENDBR64 MOVSXD RAX,EDI IMUL RAX,RAX,0x66666667 SAR RAX,0x22 MOV EDX,EDI SAR EDX,0x1f SUB EAX,EDX LEA EDX,[RAX + RAX*0x4] ADD EDX,EDX MOV EAX,EDI SUB EAX,EDX RET
int func0(int param_1) { return param_1 % 10; }
5,634
func0
#include <assert.h>
int func0(int n) { return n % 10; }
int main() { assert(func0(123) == 3); assert(func0(25) == 5); assert(func0(30) == 0); return 0; }
O2
c
func0: endbr64 movslq %edi,%rax mov %edi,%edx imul $0x66666667,%rax,%rax sar $0x1f,%edx sar $0x22,%rax sub %edx,%eax lea (%rax,%rax,4),%eax add %eax,%eax sub %eax,%edi mov %edi,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 movsxd rax, edi mov edx, edi imul rax, 66666667h sar edx, 1Fh sar rax, 22h sub eax, edx lea edx, [rax+rax*4] mov eax, edi add edx, edx sub eax, edx retn
long long func0(int a1) { return (unsigned int)(a1 % 10); }
func0: ENDBR64 MOVSXD RAX,EDI MOV EDX,EDI IMUL RAX,RAX,0x66666667 SAR EDX,0x1f SAR RAX,0x22 SUB EAX,EDX LEA EDX,[RAX + RAX*0x4] MOV EAX,EDI ADD EDX,EDX SUB EAX,EDX RET
int func0(int param_1) { return param_1 % 10; }
5,635
func0
#include <assert.h>
int func0(int n) { return n % 10; }
int main() { assert(func0(123) == 3); assert(func0(25) == 5); assert(func0(30) == 0); return 0; }
O3
c
func0: endbr64 movslq %edi,%rax mov %edi,%edx imul $0x66666667,%rax,%rax sar $0x1f,%edx sar $0x22,%rax sub %edx,%eax lea (%rax,%rax,4),%eax add %eax,%eax sub %eax,%edi mov %edi,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 movsxd rax, edi mov edx, edi imul rax, 66666667h sar edx, 1Fh sar rax, 22h sub eax, edx lea edx, [rax+rax*4] mov eax, edi add edx, edx sub eax, edx retn
long long func0(int a1) { return (unsigned int)(a1 % 10); }
func0: ENDBR64 MOVSXD RAX,EDI MOV EDX,EDI IMUL RAX,RAX,0x66666667 SAR EDX,0x1f SAR RAX,0x22 SUB EAX,EDX LEA EDX,[RAX + RAX*0x4] MOV EAX,EDI ADD EDX,EDX SUB EAX,EDX RET
int func0(int param_1) { return param_1 % 10; }
5,636
func0
#include <assert.h>
int func0(int list1[], int size) { for (int i = 0; i < size; i++) { if (list1[i] < 0) { return list1[i]; } } return 0; // returning 0 by default if no negative number is found }
int main() { int list1[] = {-1, 4, 5, -6}; int list2[] = {-1, -2, 3, 4}; int list3[] = {-7, -6, 8, 9}; assert(func0(list1, 4) == -1); assert(func0(list2, 4) == -1); assert(func0(list3, 4) == -7); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0x4(%rbp) jmp 11b7 <func0+0x4e> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax test %eax,%eax jns 11b3 <func0+0x4a> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax jmp 11c4 <func0+0x5b> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1181 <func0+0x18> mov $0x0,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_4], 0 jmp short loc_11B7 loc_1181: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] test eax, eax jns short loc_11B3 mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] jmp short loc_11C4 loc_11B3: add [rbp+var_4], 1 loc_11B7: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1181 mov eax, 0 loc_11C4: pop rbp retn
long long func0(long long a1, int a2) { int i; // [rsp+18h] [rbp-4h] for ( i = 0; i < a2; ++i ) { if ( *(int *)(4LL * i + a1) < 0 ) return *(unsigned int *)(4LL * i + a1); } return 0LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011b7 LAB_00101181: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JNS 0x001011b3 MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] JMP 0x001011c4 LAB_001011b3: ADD dword ptr [RBP + -0x4],0x1 LAB_001011b7: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101181 MOV EAX,0x0 LAB_001011c4: POP RBP RET
int4 func0(long param_1,int param_2) { int local_c; local_c = 0; while( true ) { if (param_2 <= local_c) { return 0; } if (*(int *)(param_1 + (long)local_c * 4) < 0) break; local_c = local_c + 1; } return *(int4 *)(param_1 + (long)local_c * 4); }
5,637
func0
#include <assert.h>
int func0(int list1[], int size) { for (int i = 0; i < size; i++) { if (list1[i] < 0) { return list1[i]; } } return 0; // returning 0 by default if no negative number is found }
int main() { int list1[] = {-1, 4, 5, -6}; int list2[] = {-1, -2, 3, 4}; int list3[] = {-7, -6, 8, 9}; assert(func0(list1, 4) == -1); assert(func0(list2, 4) == -1); assert(func0(list3, 4) == -7); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 1193 <func0+0x2a> mov %rdi,%rax lea -0x1(%rsi),%edx lea 0x4(%rdi,%rdx,4),%rcx mov (%rax),%edx test %edx,%edx js 1190 <func0+0x27> add $0x4,%rax cmp %rcx,%rax jne 117c <func0+0x13> mov $0x0,%edx mov %edx,%eax retq mov $0x0,%edx jmp 1190 <func0+0x27>
func0: endbr64 test esi, esi jle short loc_1193 mov rax, rdi lea edx, [rsi-1] lea rcx, [rdi+rdx*4+4] loc_117C: mov edx, [rax] test edx, edx js short loc_1190 add rax, 4 cmp rax, rcx jnz short loc_117C mov edx, 0 loc_1190: mov eax, edx retn loc_1193: mov edx, 0 jmp short loc_1190
long long func0(unsigned int *a1, int a2) { unsigned int *v2; // rax unsigned int v3; // edx if ( a2 <= 0 ) { return 0; } else { v2 = a1; while ( 1 ) { v3 = *v2; if ( (*v2 & 0x80000000) != 0 ) break; if ( ++v2 == &a1[a2 - 1 + 1] ) return 0; } } return v3; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101193 MOV RAX,RDI LEA EDX,[RSI + -0x1] LEA RCX,[RDI + RDX*0x4 + 0x4] LAB_0010117c: MOV EDX,dword ptr [RAX] TEST EDX,EDX JS 0x00101190 ADD RAX,0x4 CMP RAX,RCX JNZ 0x0010117c MOV EDX,0x0 LAB_00101190: MOV EAX,EDX RET LAB_00101193: MOV EDX,0x0 JMP 0x00101190
int func0(int *param_1,int param_2) { int *piVar1; if (0 < param_2) { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if (*param_1 < 0) { return *param_1; } param_1 = param_1 + 1; } while (param_1 != piVar1); } return 0; }
5,638
func0
#include <assert.h>
int func0(int list1[], int size) { for (int i = 0; i < size; i++) { if (list1[i] < 0) { return list1[i]; } } return 0; // returning 0 by default if no negative number is found }
int main() { int list1[] = {-1, 4, 5, -6}; int list2[] = {-1, -2, 3, 4}; int list3[] = {-7, -6, 8, 9}; assert(func0(list1, 4) == -1); assert(func0(list2, 4) == -1); assert(func0(list3, 4) == -7); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1170 <func0+0x30> lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rdx jmp 1161 <func0+0x21> nopw 0x0(%rax,%rax,1) add $0x4,%rdi cmp %rdx,%rdi je 1170 <func0+0x30> mov (%rdi),%eax test %eax,%eax jns 1158 <func0+0x18> retq nopl 0x0(%rax,%rax,1) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 test esi, esi jle short loc_1170 lea eax, [rsi-1] lea rdx, [rdi+rax*4+4] jmp short loc_1161 loc_1158: add rdi, 4 cmp rdi, rdx jz short loc_1170 loc_1161: mov eax, [rdi] test eax, eax jns short loc_1158 retn loc_1170: xor eax, eax retn
long long func0(unsigned int *a1, int a2) { long long v2; // rdx long long result; // rax if ( a2 <= 0 ) return 0LL; v2 = (long long)&a1[a2 - 1 + 1]; while ( 1 ) { result = *a1; if ( (int)result < 0 ) break; if ( ++a1 == (unsigned int *)v2 ) return 0LL; } return result; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101170 LEA EAX,[RSI + -0x1] LEA RDX,[RDI + RAX*0x4 + 0x4] JMP 0x00101161 LAB_00101158: ADD RDI,0x4 CMP RDI,RDX JZ 0x00101170 LAB_00101161: MOV EAX,dword ptr [RDI] TEST EAX,EAX JNS 0x00101158 RET LAB_00101170: XOR EAX,EAX RET
int func0(int *param_1,int param_2) { int *piVar1; if (0 < param_2) { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if (*param_1 < 0) { return *param_1; } param_1 = param_1 + 1; } while (param_1 != piVar1); } return 0; }
5,639
func0
#include <assert.h>
int func0(int list1[], int size) { for (int i = 0; i < size; i++) { if (list1[i] < 0) { return list1[i]; } } return 0; // returning 0 by default if no negative number is found }
int main() { int list1[] = {-1, 4, 5, -6}; int list2[] = {-1, -2, 3, 4}; int list3[] = {-7, -6, 8, 9}; assert(func0(list1, 4) == -1); assert(func0(list2, 4) == -1); assert(func0(list3, 4) == -7); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 1170 <func0+0x30> lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rdx jmp 1161 <func0+0x21> nopw 0x0(%rax,%rax,1) add $0x4,%rdi cmp %rdx,%rdi je 1170 <func0+0x30> mov (%rdi),%eax test %eax,%eax jns 1158 <func0+0x18> retq nopl 0x0(%rax,%rax,1) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 test esi, esi jle short loc_1170 movsxd rsi, esi lea rdx, [rdi+rsi*4] jmp short loc_1161 loc_1158: add rdi, 4 cmp rdi, rdx jz short loc_1170 loc_1161: mov eax, [rdi] test eax, eax jns short loc_1158 retn loc_1170: xor eax, eax retn
long long func0(unsigned int *a1, int a2) { unsigned int *v2; // rdx long long result; // rax if ( a2 <= 0 ) return 0LL; v2 = &a1[a2]; while ( 1 ) { result = *a1; if ( (int)result < 0 ) break; if ( ++a1 == v2 ) return 0LL; } return result; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101170 MOVSXD RSI,ESI LEA RDX,[RDI + RSI*0x4] JMP 0x00101161 LAB_00101158: ADD RDI,0x4 CMP RDI,RDX JZ 0x00101170 LAB_00101161: MOV EAX,dword ptr [RDI] TEST EAX,EAX JNS 0x00101158 RET LAB_00101170: XOR EAX,EAX RET
int func0(int *param_1,int param_2) { int *piVar1; if (0 < param_2) { piVar1 = param_1 + param_2; do { if (*param_1 < 0) { return *param_1; } param_1 = param_1 + 1; } while (param_1 != piVar1); } return 0; }
5,640
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(char* str1) { static char str2[100]; int j = 0; for (int i = 1; i <= strlen(str1); i++) { if (i % 2 == 0) { str2[j++] = str1[i - 1]; } } str2[j] = '\0'; return str2; }
int main() { assert(strcmp(func0("python"), "yhn") == 0); assert(strcmp(func0("program"), "rga") == 0); assert(strcmp(func0("language"), "agae") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x28,%rsp mov %rdi,-0x28(%rbp) movl $0x0,-0x18(%rbp) movl $0x1,-0x14(%rbp) jmp 11e1 <func0+0x58> mov -0x14(%rbp),%eax and $0x1,%eax test %eax,%eax jne 11dd <func0+0x54> mov -0x14(%rbp),%eax cltq lea -0x1(%rax),%rdx mov -0x28(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x18(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x18(%rbp) movzbl (%rcx),%edx cltq lea 0x2e66(%rip),%rcx mov %dl,(%rax,%rcx,1) addl $0x1,-0x14(%rbp) mov -0x14(%rbp),%eax movslq %eax,%rbx mov -0x28(%rbp),%rax mov %rax,%rdi callq 1070 <strlen@plt> cmp %rax,%rbx jbe 11aa <func0+0x21> mov -0x18(%rbp),%eax cltq lea 0x2e3c(%rip),%rdx movb $0x0,(%rax,%rdx,1) lea 0x2e31(%rip),%rax add $0x28,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 28h mov [rbp+s], rdi mov [rbp+var_18], 0 mov [rbp+var_14], 1 jmp short loc_11E1 loc_11AA: mov eax, [rbp+var_14] and eax, 1 test eax, eax jnz short loc_11DD mov eax, [rbp+var_14] cdqe lea rdx, [rax-1] mov rax, [rbp+s] lea rcx, [rdx+rax] mov eax, [rbp+var_18] lea edx, [rax+1] mov [rbp+var_18], edx movzx edx, byte ptr [rcx] cdqe lea rcx, str2_1 mov [rax+rcx], dl loc_11DD: add [rbp+var_14], 1 loc_11E1: mov eax, [rbp+var_14] movsxd rbx, eax mov rax, [rbp+s] mov rdi, rax; s call _strlen cmp rax, rbx jnb short loc_11AA mov eax, [rbp+var_18] cdqe lea rdx, str2_1 mov byte ptr [rax+rdx], 0 lea rax, str2_1 mov rbx, [rbp+var_8] leave retn
_BYTE * func0(const char *a1) { int v1; // eax int v3; // [rsp+18h] [rbp-18h] int i; // [rsp+1Ch] [rbp-14h] v3 = 0; for ( i = 1; strlen(a1) >= i; ++i ) { if ( (i & 1) == 0 ) { v1 = v3++; str2_1[v1] = a1[i - 1]; } } str2_1[v3] = 0; return str2_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x28 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x18],0x0 MOV dword ptr [RBP + -0x14],0x1 JMP 0x001011e1 LAB_001011aa: MOV EAX,dword ptr [RBP + -0x14] AND EAX,0x1 TEST EAX,EAX JNZ 0x001011dd MOV EAX,dword ptr [RBP + -0x14] CDQE LEA RDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x28] LEA RCX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x18] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x18],EDX MOVZX EDX,byte ptr [RCX] CDQE LEA RCX,[0x104040] MOV byte ptr [RAX + RCX*0x1],DL LAB_001011dd: ADD dword ptr [RBP + -0x14],0x1 LAB_001011e1: MOV EAX,dword ptr [RBP + -0x14] MOVSXD RBX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RDI,RAX CALL 0x00101070 CMP RAX,RBX JNC 0x001011aa MOV EAX,dword ptr [RBP + -0x18] CDQE LEA RDX,[0x104040] MOV byte ptr [RAX + RDX*0x1],0x0 LEA RAX,[0x104040] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int1 * func0(char *param_1) { size_t sVar1; int local_20; uint local_1c; local_20 = 0; local_1c = 1; while( true ) { sVar1 = strlen(param_1); if (sVar1 < (ulong)(long)(int)local_1c) break; if ((local_1c & 1) == 0) { str2_1[local_20] = param_1[(long)(int)local_1c + -1]; local_20 = local_20 + 1; } local_1c = local_1c + 1; } str2_1[local_20] = 0; return str2_1; }
5,641
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(char* str1) { static char str2[100]; int j = 0; for (int i = 1; i <= strlen(str1); i++) { if (i % 2 == 0) { str2[j++] = str1[i - 1]; } } str2[j] = '\0'; return str2; }
int main() { assert(strcmp(func0("python"), "yhn") == 0); assert(strcmp(func0("program"), "rga") == 0); assert(strcmp(func0("language"), "agae") == 0); return 0; }
O1
c
func0: endbr64 mov %rdi,%r8 mov $0x1,%edx mov $0x0,%esi mov $0xffffffffffffffff,%r9 mov $0x0,%eax lea 0x2ed3(%rip),%r10 jmp 1173 <func0+0x2a> add $0x1,%rdx mov %r9,%rcx mov %r8,%rdi repnz scas %es:(%rdi),%al not %rcx sub $0x1,%rcx cmp %rdx,%rcx jb 119e <func0+0x55> test $0x1,%dl jne 116f <func0+0x26> movzbl -0x1(%r8,%rdx,1),%edi movslq %esi,%rcx mov %dil,(%r10,%rcx,1) lea 0x1(%rsi),%esi jmp 116f <func0+0x26> lea 0x2e9b(%rip),%rax movslq %esi,%rsi movb $0x0,(%rax,%rsi,1) retq
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov r12, rdi mov ebx, 1 mov ebp, 0 lea r13, str2_1 jmp short loc_11B1 loc_11AD: add rbx, 1 loc_11B1: mov rdi, r12 call _strlen cmp rax, rbx jb short loc_11D6 test bl, 1 jnz short loc_11AD movzx edx, byte ptr [r12+rbx-1] movsxd rax, ebp mov [r13+rax+0], dl lea ebp, [rbp+1] jmp short loc_11AD loc_11D6: lea rax, str2_1 movsxd rbp, ebp mov byte ptr [rax+rbp], 0 add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
_BYTE * func0(long long a1) { unsigned long long v1; // rbx int v2; // ebp _BYTE *result; // rax v1 = 1LL; v2 = 0; while ( strlen(a1) >= v1 ) { if ( (v1 & 1) == 0 ) str2_1[v2++] = *(_BYTE *)(a1 + v1 - 1); ++v1; } result = str2_1; str2_1[v2] = 0; return result; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R12,RDI MOV EBX,0x1 MOV EBP,0x0 LEA R13,[0x104040] JMP 0x001011b1 LAB_001011ad: ADD RBX,0x1 LAB_001011b1: MOV RDI,R12 CALL 0x00101070 CMP RAX,RBX JC 0x001011d6 TEST BL,0x1 JNZ 0x001011ad MOVZX EDX,byte ptr [R12 + RBX*0x1 + -0x1] MOVSXD RAX,EBP MOV byte ptr [R13 + RAX*0x1],DL LEA EBP,[RBP + 0x1] JMP 0x001011ad LAB_001011d6: LEA RAX,[0x104040] MOVSXD RBP,EBP MOV byte ptr [RAX + RBP*0x1],0x0 ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
void func0(char *param_1) { size_t sVar1; ulong uVar2; int iVar3; uVar2 = 1; iVar3 = 0; while( true ) { sVar1 = strlen(param_1); if (sVar1 < uVar2) break; if ((uVar2 & 1) == 0) { (&str2_1)[iVar3] = param_1[uVar2 - 1]; iVar3 = iVar3 + 1; } uVar2 = uVar2 + 1; } (&str2_1)[iVar3] = 0; return; }
5,642
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(char* str1) { static char str2[100]; int j = 0; for (int i = 1; i <= strlen(str1); i++) { if (i % 2 == 0) { str2[j++] = str1[i - 1]; } } str2[j] = '\0'; return str2; }
int main() { assert(strcmp(func0("python"), "yhn") == 0); assert(strcmp(func0("program"), "rga") == 0); assert(strcmp(func0("language"), "agae") == 0); return 0; }
O2
c
func0: endbr64 push %r13 mov %rdi,%r13 push %r12 push %rbp lea 0x2ddd(%rip),%rbp push %rbx mov $0x1,%ebx sub $0x8,%rsp callq 1060 <strlen@plt> xor %edx,%edx jmp 12a2 <func0+0x52> nopw %cs:0x0(%rax,%rax,1) test $0x1,%bl jne 129e <func0+0x4e> movzbl -0x1(%r13,%rbx,1),%eax lea 0x1(%rdx),%r12d mov %r13,%rdi mov %al,0x0(%rbp,%rdx,1) callq 1060 <strlen@plt> movslq %r12d,%rdx add $0x1,%rbx cmp %rax,%rbx jbe 1280 <func0+0x30> movb $0x0,0x0(%rbp,%rdx,1) add $0x8,%rsp lea 0x2d89(%rip),%rax pop %rbx pop %rbp pop %r12 pop %r13 retq xchg %ax,%ax
func0: endbr64 push r13 lea r13, str2_1 push r12 mov r12, rdi push rbp xor ebp, ebp push rbx mov ebx, 1 sub rsp, 8 jmp short loc_12A2 loc_1288: test bl, 1 jnz short loc_129E movzx edx, byte ptr [r12+rbx-1] movsxd rax, ebp add ebp, 1 mov [r13+rax+0], dl loc_129E: add rbx, 1 loc_12A2: mov rdi, r12 call _strlen cmp rax, rbx jnb short loc_1288 movsxd rbp, ebp mov rax, r13 mov byte ptr [r13+rbp+0], 0 add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
_BYTE * func0(long long a1) { int v1; // ebp unsigned long long i; // rbx long long v3; // rax _BYTE *result; // rax v1 = 0; for ( i = 1LL; strlen(a1) >= i; ++i ) { if ( (i & 1) == 0 ) { v3 = v1++; str2_1[v3] = *(_BYTE *)(a1 + i - 1); } } result = str2_1; str2_1[v1] = 0; return result; }
func0: ENDBR64 PUSH R13 LEA R13,[0x104040] PUSH R12 MOV R12,RDI PUSH RBP XOR EBP,EBP PUSH RBX MOV EBX,0x1 SUB RSP,0x8 JMP 0x001012a2 LAB_00101288: TEST BL,0x1 JNZ 0x0010129e MOVZX EDX,byte ptr [R12 + RBX*0x1 + -0x1] MOVSXD RAX,EBP ADD EBP,0x1 MOV byte ptr [R13 + RAX*0x1],DL LAB_0010129e: ADD RBX,0x1 LAB_001012a2: MOV RDI,R12 CALL 0x00101070 CMP RAX,RBX JNC 0x00101288 MOVSXD RBP,EBP MOV RAX,R13 MOV byte ptr [R13 + RBP*0x1],0x0 ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
int1 * func0(char *param_1) { long lVar1; size_t sVar2; ulong uVar3; int iVar4; iVar4 = 0; uVar3 = 1; while( true ) { sVar2 = strlen(param_1); if (sVar2 < uVar3) break; if ((uVar3 & 1) == 0) { lVar1 = (long)iVar4; iVar4 = iVar4 + 1; (&str2_1)[lVar1] = param_1[uVar3 - 1]; } uVar3 = uVar3 + 1; } (&str2_1)[iVar4] = 0; return &str2_1; }
5,643
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(char* str1) { static char str2[100]; int j = 0; for (int i = 1; i <= strlen(str1); i++) { if (i % 2 == 0) { str2[j++] = str1[i - 1]; } } str2[j] = '\0'; return str2; }
int main() { assert(strcmp(func0("python"), "yhn") == 0); assert(strcmp(func0("program"), "rga") == 0); assert(strcmp(func0("language"), "agae") == 0); return 0; }
O3
c
func0: endbr64 push %r13 push %r12 mov %rdi,%r12 push %rbp push %rbx sub $0x8,%rsp callq 1060 <strlen@plt> test %rax,%rax je 12d8 <func0+0x88> xor %edx,%edx mov $0x1,%ebx lea 0x2dc7(%rip),%rbp nopl 0x0(%rax) test $0x1,%bl jne 12ac <func0+0x5c> movzbl -0x1(%r12,%rbx,1),%eax mov %r12,%rdi lea 0x1(%rdx),%r13d add $0x1,%rbx mov %al,0x0(%rbp,%rdx,1) callq 1060 <strlen@plt> cmp %rax,%rbx ja 12b8 <func0+0x68> movslq %r13d,%rdx test $0x1,%bl je 1285 <func0+0x35> add $0x1,%rbx cmp %rax,%rbx jbe 1280 <func0+0x30> mov %edx,%r13d movslq %r13d,%r13 lea 0x2d7e(%rip),%rax movb $0x0,0x0(%rbp,%r13,1) add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq nopl 0x0(%rax,%rax,1) xor %r13d,%r13d lea 0x2d5e(%rip),%rbp jmp 12b8 <func0+0x68> nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 push r13 lea r13, str2_1 push r12 mov r12, rdi push rbp xor ebp, ebp push rbx mov ebx, 1 sub rsp, 8 jmp short loc_12A2 loc_1288: test bl, 1 jnz short loc_129E movzx edx, byte ptr [r12+rbx-1] movsxd rax, ebp add ebp, 1 mov [r13+rax+0], dl loc_129E: add rbx, 1 loc_12A2: mov rdi, r12; s call _strlen cmp rax, rbx jnb short loc_1288 movsxd rbp, ebp mov rax, r13 mov byte ptr [r13+rbp+0], 0 add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
_BYTE * func0(char *s) { int v1; // ebp size_t i; // rbx long long v3; // rax _BYTE *result; // rax v1 = 0; for ( i = 1LL; strlen(s) >= i; ++i ) { if ( (i & 1) == 0 ) { v3 = v1++; str2_1[v3] = s[i - 1]; } } result = str2_1; str2_1[v1] = 0; return result; }
func0: ENDBR64 PUSH R13 LEA R13,[0x104040] PUSH R12 MOV R12,RDI PUSH RBP XOR EBP,EBP PUSH RBX MOV EBX,0x1 SUB RSP,0x8 JMP 0x001012a2 LAB_00101288: TEST BL,0x1 JNZ 0x0010129e MOVZX EDX,byte ptr [R12 + RBX*0x1 + -0x1] MOVSXD RAX,EBP ADD EBP,0x1 MOV byte ptr [R13 + RAX*0x1],DL LAB_0010129e: ADD RBX,0x1 LAB_001012a2: MOV RDI,R12 CALL 0x00101070 CMP RAX,RBX JNC 0x00101288 MOVSXD RBP,EBP MOV RAX,R13 MOV byte ptr [R13 + RBP*0x1],0x0 ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
int1 * func0(char *param_1) { long lVar1; size_t sVar2; ulong uVar3; int iVar4; iVar4 = 0; uVar3 = 1; while( true ) { sVar2 = strlen(param_1); if (sVar2 < uVar3) break; if ((uVar3 & 1) == 0) { lVar1 = (long)iVar4; iVar4 = iVar4 + 1; (&str2_1)[lVar1] = param_1[uVar3 - 1]; } uVar3 = uVar3 + 1; } (&str2_1)[iVar4] = 0; return &str2_1; }
5,644
func0
#include <assert.h> #include <string.h> #include <stdlib.h> #include <stdio.h> typedef struct { int first; int second; } pair;
char* func0(pair test_list[], int len){ int res = 0; for(int idx = 0; idx < len; idx++){ for(int iidx = idx +1; iidx < len; iidx++){ if(test_list[iidx].first == test_list[idx].second && test_list[idx].second == test_list[iidx].first){ res +=1; } } } char* str = malloc(12); sprintf(str, "%d", res); return str; }
int main(){ pair test1[] = { {5,6}, {1,2}, {6,5}, {9,1}, {6,5}, {2,1} }; char* res1 = func0(test1, 6); assert(strcmp(res1, "3") == 0); free(res1); pair test2[] = { {5,6}, {1,3}, {6,5}, {9,1}, {6,5}, {2,1} }; char* res2 = func0(test2, 6); assert(strcmp(res2, "2") == 0); free(res2); pair test3[] = { {5,6}, {1,2}, {6,5}, {9,2}, {6,5}, {2,1} }; char* res3 = func0(test3, 6); assert(strcmp(res3, "4") == 0); free(res3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x28(%rbp) mov %esi,-0x2c(%rbp) movl $0x0,-0x14(%rbp) movl $0x0,-0x10(%rbp) jmpq 1290 <func0+0xa7> mov -0x10(%rbp),%eax add $0x1,%eax mov %eax,-0xc(%rbp) jmp 1284 <func0+0x9b> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x10(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x28(%rbp),%rax add %rcx,%rax mov 0x4(%rax),%eax cmp %eax,%edx jne 1280 <func0+0x97> mov -0x10(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov 0x4(%rax),%edx mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x28(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jne 1280 <func0+0x97> addl $0x1,-0x14(%rbp) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x2c(%rbp),%eax jl 121a <func0+0x31> addl $0x1,-0x10(%rbp) mov -0x10(%rbp),%eax cmp -0x2c(%rbp),%eax jl 120f <func0+0x26> mov $0xc,%edi callq 10e0 <malloc@plt> mov %rax,-0x8(%rbp) mov -0x14(%rbp),%edx mov -0x8(%rbp),%rax lea 0xd50(%rip),%rsi mov %rax,%rdi mov $0x0,%eax callq 10f0 <sprintf@plt> mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_28], rdi mov [rbp+var_2C], esi mov [rbp+var_14], 0 mov [rbp+var_10], 0 jmp loc_1290 loc_120F: mov eax, [rbp+var_10] add eax, 1 mov [rbp+var_C], eax jmp short loc_1284 loc_121A: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_28] add rax, rdx mov edx, [rax] mov eax, [rbp+var_10] cdqe lea rcx, ds:0[rax*8] mov rax, [rbp+var_28] add rax, rcx mov eax, [rax+4] cmp edx, eax jnz short loc_1280 mov eax, [rbp+var_10] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_28] add rax, rdx mov edx, [rax+4] mov eax, [rbp+var_C] cdqe lea rcx, ds:0[rax*8] mov rax, [rbp+var_28] add rax, rcx mov eax, [rax] cmp edx, eax jnz short loc_1280 add [rbp+var_14], 1 loc_1280: add [rbp+var_C], 1 loc_1284: mov eax, [rbp+var_C] cmp eax, [rbp+var_2C] jl short loc_121A add [rbp+var_10], 1 loc_1290: mov eax, [rbp+var_10] cmp eax, [rbp+var_2C] jl loc_120F mov edi, 0Ch; size call _malloc mov [rbp+s], rax mov edx, [rbp+var_14] mov rax, [rbp+s] lea rcx, format; "%d" mov rsi, rcx; format mov rdi, rax; s mov eax, 0 call _sprintf mov rax, [rbp+s] leave retn
char * func0(long long a1, int a2) { int v3; // [rsp+1Ch] [rbp-14h] int i; // [rsp+20h] [rbp-10h] int j; // [rsp+24h] [rbp-Ch] char *s; // [rsp+28h] [rbp-8h] v3 = 0; for ( i = 0; i < a2; ++i ) { for ( j = i + 1; j < a2; ++j ) { if ( *(_DWORD *)(8LL * j + a1) == *(_DWORD *)(8LL * i + a1 + 4) ) ++v3; } } s = (char *)malloc(0xCuLL); sprintf(s, "%d", v3); return s; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x2c],ESI MOV dword ptr [RBP + -0x14],0x0 MOV dword ptr [RBP + -0x10],0x0 JMP 0x00101290 LAB_0010120f: MOV EAX,dword ptr [RBP + -0x10] ADD EAX,0x1 MOV dword ptr [RBP + -0xc],EAX JMP 0x00101284 LAB_0010121a: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x10] CDQE LEA RCX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RCX MOV EAX,dword ptr [RAX + 0x4] CMP EDX,EAX JNZ 0x00101280 MOV EAX,dword ptr [RBP + -0x10] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EDX,dword ptr [RAX + 0x4] MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RCX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JNZ 0x00101280 ADD dword ptr [RBP + -0x14],0x1 LAB_00101280: ADD dword ptr [RBP + -0xc],0x1 LAB_00101284: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x2c] JL 0x0010121a ADD dword ptr [RBP + -0x10],0x1 LAB_00101290: MOV EAX,dword ptr [RBP + -0x10] CMP EAX,dword ptr [RBP + -0x2c] JL 0x0010120f MOV EDI,0xc CALL 0x001010e0 MOV qword ptr [RBP + -0x8],RAX MOV EDX,dword ptr [RBP + -0x14] MOV RAX,qword ptr [RBP + -0x8] LEA RCX,[0x102004] MOV RSI,RCX MOV RDI,RAX MOV EAX,0x0 CALL 0x001010f0 MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
char * func0(long param_1,int param_2) { char *__s; uint local_1c; int local_18; int local_14; local_1c = 0; for (local_18 = 0; local_14 = local_18, local_18 < param_2; local_18 = local_18 + 1) { while (local_14 = local_14 + 1, local_14 < param_2) { if ((*(int *)(param_1 + (long)local_14 * 8) == *(int *)(param_1 + (long)local_18 * 8 + 4)) && (*(int *)(param_1 + (long)local_18 * 8 + 4) == *(int *)(param_1 + (long)local_14 * 8))) { local_1c = local_1c + 1; } } } __s = (char *)malloc(0xc); sprintf(__s,"%d",(ulong)local_1c); return __s; }
5,645
func0
#include <assert.h> #include <string.h> #include <stdlib.h> #include <stdio.h> typedef struct { int first; int second; } pair;
char* func0(pair test_list[], int len){ int res = 0; for(int idx = 0; idx < len; idx++){ for(int iidx = idx +1; iidx < len; iidx++){ if(test_list[iidx].first == test_list[idx].second && test_list[idx].second == test_list[iidx].first){ res +=1; } } } char* str = malloc(12); sprintf(str, "%d", res); return str; }
int main(){ pair test1[] = { {5,6}, {1,2}, {6,5}, {9,1}, {6,5}, {2,1} }; char* res1 = func0(test1, 6); assert(strcmp(res1, "3") == 0); free(res1); pair test2[] = { {5,6}, {1,3}, {6,5}, {9,1}, {6,5}, {2,1} }; char* res2 = func0(test2, 6); assert(strcmp(res2, "2") == 0); free(res2); pair test3[] = { {5,6}, {1,2}, {6,5}, {9,2}, {6,5}, {2,1} }; char* res3 = func0(test3, 6); assert(strcmp(res3, "4") == 0); free(res3); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x8,%rsp test %esi,%esi jle 122d <func0+0x64> lea -0x1(%rsi),%r10d mov %r10d,%r11d add $0x1,%r11 mov %rdi,%r9 mov $0x1,%r8d mov $0x0,%ebx add $0x8,%rdi cmp %r11,%r8 je 1232 <func0+0x69> mov 0x4(%r9),%esi mov %r10d,%eax sub %r8d,%eax lea -0x1(%r8,%rax,1),%rax lea (%rdi,%rax,8),%rcx mov %r9,%rax cmp %esi,0x8(%rax) sete %dl movzbl %dl,%edx add %edx,%ebx add $0x8,%rax cmp %rcx,%rax jne 120f <func0+0x46> add $0x1,%r8 add $0x8,%r9 jmp 11f4 <func0+0x2b> mov $0x0,%ebx mov $0xc,%edi callq 10c0 <malloc@plt> mov %rax,%rbp mov %ebx,%r8d lea 0xdbb(%rip),%rcx mov $0xc,%edx mov $0x1,%esi mov %rax,%rdi mov $0x0,%eax callq 10d0 <__sprintf_chk@plt> mov %rbp,%rax add $0x8,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp push rbx sub rsp, 8 test esi, esi jle short loc_1248 lea r11d, [rsi-1] mov r9, rdi mov r8d, 0 mov ebx, 0 lea r10d, [rsi-2] add rdi, 8 loc_1211: cmp r8, r11 jz short loc_124D mov esi, [r9+4] mov eax, r10d sub eax, r8d add rax, r8 lea rcx, [rdi+rax*8] mov rax, r9 loc_122A: cmp [rax+8], esi setz dl movzx edx, dl add ebx, edx add rax, 8 cmp rax, rcx jnz short loc_122A add r8, 1 add r9, 8 jmp short loc_1211 loc_1248: mov ebx, 0 loc_124D: mov edi, 0Ch call _malloc mov rbp, rax mov r8d, ebx lea rcx, unk_2004 mov edx, 0Ch mov esi, 1 mov rdi, rax mov eax, 0 call ___sprintf_chk mov rax, rbp add rsp, 8 pop rbx pop rbp retn
long long func0(long long a1, long long a2, long long a3, long long a4, long long a5, long long a6) { long long v6; // r11 unsigned int v7; // ebx int v8; // r10d long long v9; // rdi long long v10; // rax long long v11; // rbp if ( (int)a2 <= 0 ) { v7 = 0; } else { v6 = (unsigned int)(a2 - 1); a6 = a1; a5 = 0LL; v7 = 0; v8 = a2 - 2; v9 = a1 + 8; while ( a5 != v6 ) { a2 = *(unsigned int *)(a6 + 4); a4 = v9 + 8 * (a5 + (unsigned int)(v8 - a5)); v10 = a6; do { a3 = *(_DWORD *)(v10 + 8) == (_DWORD)a2; v7 += a3; v10 += 8LL; } while ( v10 != a4 ); ++a5; a6 += 8LL; } } v11 = malloc(12LL, a2, a3, a4, a5, a6); __sprintf_chk(v11, 1LL, 12LL, &unk_2004, v7); return v11; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x8 TEST ESI,ESI JLE 0x00101248 LEA R11D,[RSI + -0x1] MOV R9,RDI MOV R8D,0x0 MOV EBX,0x0 LEA R10D,[RSI + -0x2] ADD RDI,0x8 LAB_00101211: CMP R8,R11 JZ 0x0010124d MOV ESI,dword ptr [R9 + 0x4] MOV EAX,R10D SUB EAX,R8D ADD RAX,R8 LEA RCX,[RDI + RAX*0x8] MOV RAX,R9 LAB_0010122a: CMP dword ptr [RAX + 0x8],ESI SETZ DL MOVZX EDX,DL ADD EBX,EDX ADD RAX,0x8 CMP RAX,RCX JNZ 0x0010122a ADD R8,0x1 ADD R9,0x8 JMP 0x00101211 LAB_00101248: MOV EBX,0x0 LAB_0010124d: MOV EDI,0xc CALL 0x001010e0 MOV RBP,RAX MOV R8D,EBX LEA RCX,[0x102004] MOV EDX,0xc MOV ESI,0x1 MOV RDI,RAX MOV EAX,0x0 CALL 0x001010f0 MOV RAX,RBP ADD RSP,0x8 POP RBX POP RBP RET
void * func0(long param_1,int param_2) { long lVar1; void *pvVar2; int iVar3; long lVar4; ulong uVar5; if (param_2 < 1) { iVar3 = 0; } else { iVar3 = 0; lVar4 = param_1 + 8; for (uVar5 = 0; uVar5 != param_2 - 1; uVar5 = uVar5 + 1) { lVar1 = param_1; do { iVar3 = iVar3 + (uint)(*(int *)(lVar1 + 8) == *(int *)(param_1 + 4)); lVar1 = lVar1 + 8; } while (lVar1 != lVar4 + ((uint)((param_2 + -2) - (int)uVar5) + uVar5) * 8); param_1 = param_1 + 8; } } pvVar2 = malloc(0xc); __sprintf_chk(pvVar2,1,0xc,&DAT_00102004,iVar3); return pvVar2; }
5,646
func0
#include <assert.h> #include <string.h> #include <stdlib.h> #include <stdio.h> typedef struct { int first; int second; } pair;
char* func0(pair test_list[], int len){ int res = 0; for(int idx = 0; idx < len; idx++){ for(int iidx = idx +1; iidx < len; iidx++){ if(test_list[iidx].first == test_list[idx].second && test_list[idx].second == test_list[iidx].first){ res +=1; } } } char* str = malloc(12); sprintf(str, "%d", res); return str; }
int main(){ pair test1[] = { {5,6}, {1,2}, {6,5}, {9,1}, {6,5}, {2,1} }; char* res1 = func0(test1, 6); assert(strcmp(res1, "3") == 0); free(res1); pair test2[] = { {5,6}, {1,3}, {6,5}, {9,1}, {6,5}, {2,1} }; char* res2 = func0(test2, 6); assert(strcmp(res2, "2") == 0); free(res2); pair test3[] = { {5,6}, {1,2}, {6,5}, {9,2}, {6,5}, {2,1} }; char* res3 = func0(test3, 6); assert(strcmp(res3, "4") == 0); free(res3); return 0; }
O2
c
func0: endbr64 push %r12 push %rbx sub $0x8,%rsp test %esi,%esi jle 1436 <func0+0xa6> lea -0x1(%rsi),%r10d mov %rdi,%r8 mov $0x1,%edi xor %ebx,%ebx mov %r10,%r9 add $0x1,%r10 lea 0x8(%r8),%r11 cmp %r10,%rdi je 1400 <func0+0x70> nopl 0x0(%rax) mov %r9d,%eax mov 0x4(%r8),%esi sub %edi,%eax lea -0x1(%rdi,%rax,1),%rax lea (%r11,%rax,8),%rcx mov %r8,%rax nopl (%rax) xor %edx,%edx cmp %esi,0x8(%rax) sete %dl add $0x8,%rax add %edx,%ebx cmp %rcx,%rax jne 13e0 <func0+0x50> add $0x1,%rdi add $0x8,%r8 cmp %r10,%rdi jne 13c8 <func0+0x38> mov $0xc,%edi callq 10c0 <malloc@plt> mov %ebx,%r8d mov $0xc,%edx lea 0xbeb(%rip),%rcx mov %rax,%r12 mov %rax,%rdi mov $0x1,%esi xor %eax,%eax callq 10d0 <__sprintf_chk@plt> add $0x8,%rsp mov %r12,%rax pop %rbx pop %r12 retq xor %ebx,%ebx jmp 1400 <func0+0x70> nopw 0x0(%rax,%rax,1)
func0: endbr64 push r12 push rbx sub rsp, 8 test esi, esi jle loc_142E lea r10d, [rsi-1] xor r8d, r8d lea r9d, [rsi-2] xor ebx, ebx lea r11, [rdi+8] cmp r8, r10 jz short loc_13F8 nop dword ptr [rax+00000000h] loc_13C0: mov eax, r9d mov esi, [rdi+4] sub eax, r8d add rax, r8 lea rcx, [r11+rax*8] mov rax, rdi nop dword ptr [rax+rax+00h] loc_13D8: xor edx, edx cmp [rax+8], esi setz dl add rax, 8 add ebx, edx cmp rax, rcx jnz short loc_13D8 add r8, 1 add rdi, 8 cmp r8, r10 jnz short loc_13C0 loc_13F8: mov edi, 0Ch call _malloc mov r8d, ebx mov edx, 0Ch lea rcx, unk_2004 mov r12, rax mov rdi, rax mov esi, 1 xor eax, eax call ___sprintf_chk add rsp, 8 mov rax, r12 pop rbx pop r12 retn loc_142E: xor ebx, ebx jmp short loc_13F8
long long func0(long long a1, long long a2, long long a3, long long a4, long long a5, long long a6) { long long v6; // r10 unsigned int v7; // ebx long long v8; // r11 long long v9; // rax long long v10; // r12 if ( (int)a2 <= 0 ) { v7 = 0; } else { v6 = (unsigned int)(a2 - 1); a5 = 0LL; a6 = (unsigned int)(a2 - 2); v7 = 0; v8 = a1 + 8; if ( (_DWORD)a2 != 1 ) { do { a2 = *(unsigned int *)(a1 + 4); a4 = v8 + 8 * (a5 + (unsigned int)(a6 - a5)); v9 = a1; do { a3 = *(_DWORD *)(v9 + 8) == (_DWORD)a2; v9 += 8LL; v7 += a3; } while ( v9 != a4 ); ++a5; a1 += 8LL; } while ( a5 != v6 ); } } v10 = malloc(12LL, a2, a3, a4, a5, a6); __sprintf_chk(v10, 1LL, 12LL, &unk_2004, v7); return v10; }
func0: ENDBR64 PUSH R12 PUSH RBX SUB RSP,0x8 TEST ESI,ESI JLE 0x0010142e LEA R10D,[RSI + -0x1] XOR R8D,R8D LEA R9D,[RSI + -0x2] XOR EBX,EBX LEA R11,[RDI + 0x8] CMP R8,R10 JZ 0x001013f8 NOP dword ptr [RAX] LAB_001013c0: MOV EAX,R9D MOV ESI,dword ptr [RDI + 0x4] SUB EAX,R8D ADD RAX,R8 LEA RCX,[R11 + RAX*0x8] MOV RAX,RDI NOP dword ptr [RAX + RAX*0x1] LAB_001013d8: XOR EDX,EDX CMP dword ptr [RAX + 0x8],ESI SETZ DL ADD RAX,0x8 ADD EBX,EDX CMP RAX,RCX JNZ 0x001013d8 ADD R8,0x1 ADD RDI,0x8 CMP R8,R10 JNZ 0x001013c0 LAB_001013f8: MOV EDI,0xc CALL 0x001010c0 MOV R8D,EBX MOV EDX,0xc LEA RCX,[0x102004] MOV R12,RAX MOV RDI,RAX MOV ESI,0x1 XOR EAX,EAX CALL 0x001010d0 ADD RSP,0x8 MOV RAX,R12 POP RBX POP R12 RET LAB_0010142e: XOR EBX,EBX JMP 0x001013f8
void * func0(long param_1,int param_2) { long lVar1; int *piVar2; long lVar3; void *pvVar4; int iVar5; ulong uVar6; if (param_2 < 1) { iVar5 = 0; } else { uVar6 = 0; iVar5 = 0; lVar1 = param_1 + 8; if ((ulong)(param_2 - 1) != 0) { do { lVar3 = param_1; do { piVar2 = (int *)(lVar3 + 8); lVar3 = lVar3 + 8; iVar5 = iVar5 + (uint)(*piVar2 == *(int *)(param_1 + 4)); } while (lVar3 != lVar1 + ((uint)((param_2 + -2) - (int)uVar6) + uVar6) * 8); uVar6 = uVar6 + 1; param_1 = param_1 + 8; } while (uVar6 != param_2 - 1); } } pvVar4 = malloc(0xc); __sprintf_chk(pvVar4,1,0xc,&DAT_00102004,iVar5); return pvVar4; }
5,647
func0
#include <assert.h> #include <string.h> #include <stdlib.h> #include <stdio.h> typedef struct { int first; int second; } pair;
char* func0(pair test_list[], int len){ int res = 0; for(int idx = 0; idx < len; idx++){ for(int iidx = idx +1; iidx < len; iidx++){ if(test_list[iidx].first == test_list[idx].second && test_list[idx].second == test_list[iidx].first){ res +=1; } } } char* str = malloc(12); sprintf(str, "%d", res); return str; }
int main(){ pair test1[] = { {5,6}, {1,2}, {6,5}, {9,1}, {6,5}, {2,1} }; char* res1 = func0(test1, 6); assert(strcmp(res1, "3") == 0); free(res1); pair test2[] = { {5,6}, {1,3}, {6,5}, {9,1}, {6,5}, {2,1} }; char* res2 = func0(test2, 6); assert(strcmp(res2, "2") == 0); free(res2); pair test3[] = { {5,6}, {1,2}, {6,5}, {9,2}, {6,5}, {2,1} }; char* res3 = func0(test3, 6); assert(strcmp(res3, "4") == 0); free(res3); return 0; }
O3
c
func0: endbr64 push %r12 push %rbp push %rbx test %esi,%esi jle 14a2 <func0+0x152> cmp $0x1,%esi je 14a2 <func0+0x152> lea 0x8(%rdi),%r9 xor %ebx,%ebx lea -0x1(%rsi),%r11d mov $0x1,%ecx mov $0x1,%r10d xchg %ax,%ax mov %esi,%eax mov %r11d,%edx mov -0x4(%r9),%r8d sub %ecx,%eax cmp %ecx,%esi cmovle %r10d,%eax sub %ecx,%edx cmp $0x3,%edx jbe 149b <func0+0x14b> cmp %ecx,%esi jle 149b <func0+0x14b> lea -0x1(%rax),%edx movd %r8d,%xmm4 pxor %xmm1,%xmm1 mov %r9,%rax mov %edx,%ebp pshufd $0x0,%xmm4,%xmm2 shr $0x2,%ebp shl $0x5,%rbp add %r9,%rbp nopl 0x0(%rax) movdqu (%rax),%xmm0 movdqu 0x10(%rax),%xmm3 add $0x20,%rax shufps $0x88,%xmm3,%xmm0 pcmpeqd %xmm2,%xmm0 psubd %xmm0,%xmm1 cmp %rax,%rbp jne 13c8 <func0+0x78> movdqa %xmm1,%xmm0 psrldq $0x8,%xmm0 paddd %xmm0,%xmm1 movdqa %xmm1,%xmm0 psrldq $0x4,%xmm0 paddd %xmm0,%xmm1 movd %xmm1,%eax add %eax,%ebx mov %edx,%eax and $0xfffffffc,%eax add %ecx,%eax movslq %eax,%rbp cmp (%rdi,%rbp,8),%r8d lea 0x0(,%rbp,8),%rdx sete %bpl movzbl %bpl,%ebp add %ebp,%ebx lea 0x1(%rax),%ebp cmp %ebp,%esi jle 1459 <func0+0x109> cmp 0x8(%rdi,%rdx,1),%r8d jne 1437 <func0+0xe7> add $0x1,%ebx lea 0x2(%rax),%ebp cmp %ebp,%esi jle 1459 <func0+0x109> cmp 0x10(%rdi,%rdx,1),%r8d jne 1448 <func0+0xf8> add $0x1,%ebx add $0x3,%eax cmp %esi,%eax jge 1459 <func0+0x109> cmp 0x18(%rdi,%rdx,1),%r8d jne 1459 <func0+0x109> add $0x1,%ebx add $0x1,%ecx add $0x8,%r9 cmp %ecx,%esi jne 1380 <func0+0x30> mov $0xc,%edi callq 10c0 <malloc@plt> mov %ebx,%r8d mov $0xc,%edx lea 0xb83(%rip),%rcx mov %rax,%r12 mov %rax,%rdi mov $0x1,%esi xor %eax,%eax callq 10d0 <__sprintf_chk@plt> mov %r12,%rax pop %rbx pop %rbp pop %r12 retq mov %ecx,%eax jmpq 140d <func0+0xbd> xor %ebx,%ebx jmp 1468 <func0+0x118> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push rbp push rbx sub rsp, 8 test esi, esi jle loc_14A7 cmp esi, 1 jz loc_14A7 mov r8, rdi lea r9, [rdi+8] xor ebx, ebx mov ecx, 1 lea r11d, [rsi-1] mov r10d, 1 nop dword ptr [rax+rax+00h] loc_1388: mov eax, esi mov edx, r11d mov edi, [r9-4] sub eax, ecx cmp esi, ecx cmovle eax, r10d sub edx, ecx cmp edx, 3 jbe loc_14A0 cmp esi, ecx jle loc_14A0 lea edx, [rax-1] movd xmm4, edi pxor xmm1, xmm1 mov rax, r9 mov ebp, edx pshufd xmm2, xmm4, 0 shr ebp, 2 shl rbp, 5 add rbp, r9 nop dword ptr [rax+rax+00h] loc_13D0: movdqu xmm0, xmmword ptr [rax] movdqu xmm3, xmmword ptr [rax+10h] add rax, 20h ; ' ' shufps xmm0, xmm3, 88h pcmpeqd xmm0, xmm2 psubd xmm1, xmm0 cmp rbp, rax jnz short loc_13D0 movdqa xmm0, xmm1 psrldq xmm0, 8 paddd xmm1, xmm0 movdqa xmm0, xmm1 psrldq xmm0, 4 paddd xmm1, xmm0 movd eax, xmm1 add ebx, eax mov eax, edx and eax, 0FFFFFFFCh add eax, ecx loc_1415: movsxd rbp, eax lea rdx, ds:0[rbp*8] cmp edi, [r8+rbp*8] jnz short loc_1429 add ebx, 1 loc_1429: lea ebp, [rax+1] cmp esi, ebp jle short loc_145C cmp edi, [r8+rdx+8] jnz short loc_143A add ebx, 1 loc_143A: lea ebp, [rax+2] cmp esi, ebp jle short loc_145C cmp edi, [r8+rdx+10h] jnz short loc_144B add ebx, 1 loc_144B: add eax, 3 cmp esi, eax jle short loc_145C cmp edi, [r8+rdx+18h] jnz short loc_145C add ebx, 1 loc_145C: add ecx, 1 add r9, 8 cmp esi, ecx jnz loc_1388 loc_146B: mov edi, 0Ch; size call _malloc mov r8d, ebx mov edx, 0Ch lea rcx, unk_2004 mov rbp, rax mov rdi, rax mov esi, 2 xor eax, eax call ___sprintf_chk add rsp, 8 mov rax, rbp pop rbx pop rbp retn loc_14A0: mov eax, ecx jmp loc_1415 loc_14A7: xor ebx, ebx jmp short loc_146B
void * func0(long long a1, int a2) { const __m128i *v3; // r9 unsigned int v4; // ebx int i; // ecx unsigned int v6; // edi int v7; // eax unsigned int v8; // edx __m128i v9; // xmm1 const __m128i *v10; // rax __m128i v11; // xmm2 __m128 v12; // xmm0 __m128 v13; // xmm3 __m128i v14; // xmm1 int v15; // eax long long v16; // rdx void *v17; // rbp if ( a2 < 2 ) { v4 = 0; } else { v3 = (const __m128i *)(a1 + 8); v4 = 0; for ( i = 1; i != a2; ++i ) { v6 = v3[-1].m128i_u32[3]; v7 = a2 - i; if ( a2 <= i ) v7 = 1; if ( (unsigned int)(a2 - 1 - i) <= 3 || a2 <= i ) { v15 = i; } else { v8 = v7 - 1; v9 = 0LL; v10 = v3; v11 = _mm_shuffle_epi32(_mm_cvtsi32_si128(v6), 0); do { v12 = (__m128)_mm_loadu_si128(v10); v13 = (__m128)_mm_loadu_si128(v10 + 1); v10 += 2; v9 = _mm_sub_epi32(v9, _mm_cmpeq_epi32((__m128i)_mm_shuffle_ps(v12, v13, 136), v11)); } while ( &v3[2 * (v8 >> 2)] != v10 ); v14 = _mm_add_epi32(v9, _mm_srli_si128(v9, 8)); v4 += _mm_cvtsi128_si32(_mm_add_epi32(v14, _mm_srli_si128(v14, 4))); v15 = i + (v8 & 0xFFFFFFFC); } v16 = 8LL * v15; if ( v6 == *(_DWORD *)(a1 + v16) ) ++v4; if ( a2 > v15 + 1 ) { if ( v6 == *(_DWORD *)(a1 + v16 + 8) ) ++v4; if ( a2 > v15 + 2 ) { if ( v6 == *(_DWORD *)(a1 + v16 + 16) ) ++v4; if ( a2 > v15 + 3 && v6 == *(_DWORD *)(a1 + v16 + 24) ) ++v4; } } v3 = (const __m128i *)((char *)v3 + 8); } } v17 = malloc(0xCuLL); __sprintf_chk(v17, 2LL, 12LL, &unk_2004, v4); return v17; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x8 TEST ESI,ESI JLE 0x001014a7 CMP ESI,0x1 JZ 0x001014a7 MOV R8,RDI LEA R9,[RDI + 0x8] XOR EBX,EBX MOV ECX,0x1 LEA R11D,[RSI + -0x1] MOV R10D,0x1 NOP dword ptr [RAX + RAX*0x1] LAB_00101388: MOV EAX,ESI MOV EDX,R11D MOV EDI,dword ptr [R9 + -0x4] SUB EAX,ECX CMP ESI,ECX CMOVLE EAX,R10D SUB EDX,ECX CMP EDX,0x3 JBE 0x001014a0 CMP ESI,ECX JLE 0x001014a0 LEA EDX,[RAX + -0x1] MOVD XMM4,EDI PXOR XMM1,XMM1 MOV RAX,R9 MOV EBP,EDX PSHUFD XMM2,XMM4,0x0 SHR EBP,0x2 SHL RBP,0x5 ADD RBP,R9 NOP dword ptr [RAX + RAX*0x1] LAB_001013d0: MOVDQU XMM0,xmmword ptr [RAX] MOVDQU XMM3,xmmword ptr [RAX + 0x10] ADD RAX,0x20 SHUFPS XMM0,XMM3,0x88 PCMPEQD XMM0,XMM2 PSUBD XMM1,XMM0 CMP RBP,RAX JNZ 0x001013d0 MOVDQA XMM0,XMM1 PSRLDQ XMM0,0x8 PADDD XMM1,XMM0 MOVDQA XMM0,XMM1 PSRLDQ XMM0,0x4 PADDD XMM1,XMM0 MOVD EAX,XMM1 ADD EBX,EAX MOV EAX,EDX AND EAX,0xfffffffc ADD EAX,ECX LAB_00101415: MOVSXD RBP,EAX LEA RDX,[RBP*0x8] CMP EDI,dword ptr [R8 + RBP*0x8] JNZ 0x00101429 ADD EBX,0x1 LAB_00101429: LEA EBP,[RAX + 0x1] CMP ESI,EBP JLE 0x0010145c CMP EDI,dword ptr [R8 + RDX*0x1 + 0x8] JNZ 0x0010143a ADD EBX,0x1 LAB_0010143a: LEA EBP,[RAX + 0x2] CMP ESI,EBP JLE 0x0010145c CMP EDI,dword ptr [R8 + RDX*0x1 + 0x10] JNZ 0x0010144b ADD EBX,0x1 LAB_0010144b: ADD EAX,0x3 CMP ESI,EAX JLE 0x0010145c CMP EDI,dword ptr [R8 + RDX*0x1 + 0x18] JNZ 0x0010145c ADD EBX,0x1 LAB_0010145c: ADD ECX,0x1 ADD R9,0x8 CMP ESI,ECX JNZ 0x00101388 LAB_0010146b: MOV EDI,0xc CALL 0x001010c0 MOV R8D,EBX MOV EDX,0xc LEA RCX,[0x102004] MOV RBP,RAX MOV RDI,RAX MOV ESI,0x2 XOR EAX,EAX CALL 0x001010d0 ADD RSP,0x8 MOV RAX,RBP POP RBX POP RBP RET LAB_001014a0: MOV EAX,ECX JMP 0x00101415 LAB_001014a7: XOR EBX,EBX JMP 0x0010146b
void * func0(long param_1,int param_2) { int *piVar1; long lVar2; int iVar3; int iVar4; int *piVar5; int *piVar6; int iVar7; int *piVar8; void *pvVar9; int iVar10; int iVar11; int *piVar12; int iVar13; int iVar14; int iVar15; int iVar16; if ((param_2 < 1) || (param_2 == 1)) { iVar11 = 0; } else { piVar12 = (int *)(param_1 + 8); iVar11 = 0; iVar10 = 1; do { iVar3 = piVar12[-1]; iVar7 = param_2 - iVar10; if (param_2 <= iVar10) { iVar7 = 1; } iVar13 = iVar10; if ((3 < (uint)((param_2 + -1) - iVar10)) && (iVar10 < param_2)) { iVar13 = 0; iVar14 = 0; iVar15 = 0; iVar16 = 0; piVar8 = piVar12; do { iVar4 = *piVar8; piVar5 = piVar8 + 2; piVar1 = piVar8 + 4; piVar6 = piVar8 + 6; piVar8 = piVar8 + 8; iVar13 = iVar13 + (uint)(iVar4 == iVar3); iVar14 = iVar14 + (uint)(*piVar5 == iVar3); iVar15 = iVar15 + (uint)(*piVar1 == iVar3); iVar16 = iVar16 + (uint)(*piVar6 == iVar3); } while (piVar12 + (ulong)(iVar7 - 1U >> 2) * 8 != piVar8); iVar11 = iVar11 + iVar13 + iVar15 + iVar14 + iVar16; iVar13 = (iVar7 - 1U & 0xfffffffc) + iVar10; } lVar2 = (long)iVar13 * 8; if (iVar3 == *(int *)(param_1 + (long)iVar13 * 8)) { iVar11 = iVar11 + 1; } if (iVar13 + 1 < param_2) { if (iVar3 == *(int *)(param_1 + 8 + lVar2)) { iVar11 = iVar11 + 1; } if (iVar13 + 2 < param_2) { if (iVar3 == *(int *)(param_1 + 0x10 + lVar2)) { iVar11 = iVar11 + 1; } if ((iVar13 + 3 < param_2) && (iVar3 == *(int *)(param_1 + 0x18 + lVar2))) { iVar11 = iVar11 + 1; } } } iVar10 = iVar10 + 1; piVar12 = piVar12 + 2; } while (param_2 != iVar10); } pvVar9 = malloc(0xc); __sprintf_chk(pvVar9,2,0xc,&DAT_00102004,iVar11); return pvVar9; }
5,648
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h>
int func0(int* L, int size) { char temp[256] = {0}; char numStr[20]; for (int i = 0; i < size; i++) { sprintf(numStr, "%d", L[i]); strcat(temp, numStr); } return atoi(temp); }
int main() { int arr1[] = {11, 33, 50}; assert(func0(arr1, 3) == 113350); int arr2[] = {-1, 2, 3, 4, 5, 6}; assert(func0(arr2, 6) == -123456); int arr3[] = {10, 15, 20, 25}; assert(func0(arr3, 4) == 10152025); printf("All test cases passed!\n"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x150,%rsp mov %rdi,-0x148(%rbp) mov %esi,-0x14c(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax movq $0x0,-0x110(%rbp) movq $0x0,-0x108(%rbp) movq $0x0,-0x100(%rbp) movq $0x0,-0xf8(%rbp) movq $0x0,-0xf0(%rbp) movq $0x0,-0xe8(%rbp) movq $0x0,-0xe0(%rbp) movq $0x0,-0xd8(%rbp) movq $0x0,-0xd0(%rbp) movq $0x0,-0xc8(%rbp) movq $0x0,-0xc0(%rbp) movq $0x0,-0xb8(%rbp) movq $0x0,-0xb0(%rbp) movq $0x0,-0xa8(%rbp) movq $0x0,-0xa0(%rbp) movq $0x0,-0x98(%rbp) movq $0x0,-0x90(%rbp) movq $0x0,-0x88(%rbp) movq $0x0,-0x80(%rbp) movq $0x0,-0x78(%rbp) movq $0x0,-0x70(%rbp) movq $0x0,-0x68(%rbp) movq $0x0,-0x60(%rbp) movq $0x0,-0x58(%rbp) movq $0x0,-0x50(%rbp) movq $0x0,-0x48(%rbp) movq $0x0,-0x40(%rbp) movq $0x0,-0x38(%rbp) movq $0x0,-0x30(%rbp) movq $0x0,-0x28(%rbp) movq $0x0,-0x20(%rbp) movq $0x0,-0x18(%rbp) movl $0x0,-0x134(%rbp) jmp 13ad <func0+0x1c4> mov -0x134(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x148(%rbp),%rax add %rdx,%rax mov (%rax),%edx lea -0x130(%rbp),%rax lea 0xc88(%rip),%rsi mov %rax,%rdi mov $0x0,%eax callq 10f0 <sprintf@plt> lea -0x130(%rbp),%rdx lea -0x110(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 10e0 <strcat@plt> addl $0x1,-0x134(%rbp) mov -0x134(%rbp),%eax cmp -0x14c(%rbp),%eax jl 1356 <func0+0x16d> lea -0x110(%rbp),%rax mov %rax,%rdi callq 10d0 <atoi@plt> mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 13de <func0+0x1f5> callq 10b0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 150h mov [rbp+var_148], rdi mov [rbp+var_14C], esi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov qword ptr [rbp+dest], 0 mov [rbp+var_108], 0 mov [rbp+var_100], 0 mov [rbp+var_F8], 0 mov [rbp+var_F0], 0 mov [rbp+var_E8], 0 mov [rbp+var_E0], 0 mov [rbp+var_D8], 0 mov [rbp+var_D0], 0 mov [rbp+var_C8], 0 mov [rbp+var_C0], 0 mov [rbp+var_B8], 0 mov [rbp+var_B0], 0 mov [rbp+var_A8], 0 mov [rbp+var_A0], 0 mov [rbp+var_98], 0 mov [rbp+var_90], 0 mov [rbp+var_88], 0 mov [rbp+var_80], 0 mov [rbp+var_78], 0 mov [rbp+var_70], 0 mov [rbp+var_68], 0 mov [rbp+var_60], 0 mov [rbp+var_58], 0 mov [rbp+var_50], 0 mov [rbp+var_48], 0 mov [rbp+var_40], 0 mov [rbp+var_38], 0 mov [rbp+var_30], 0 mov [rbp+var_28], 0 mov [rbp+var_20], 0 mov [rbp+var_18], 0 mov [rbp+var_134], 0 jmp short loc_13B0 loc_1356: mov eax, [rbp+var_134] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_148] add rax, rdx mov edx, [rax] lea rax, [rbp+s] lea rcx, format; "%d" mov rsi, rcx; format mov rdi, rax; s mov eax, 0 call _sprintf lea rdx, [rbp+s] lea rax, [rbp+dest] mov rsi, rdx; src mov rdi, rax; dest call _strcat add [rbp+var_134], 1 loc_13B0: mov eax, [rbp+var_134] cmp eax, [rbp+var_14C] jl short loc_1356 lea rax, [rbp+dest] mov rdi, rax; nptr call _atoi mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_13E1 call ___stack_chk_fail locret_13E1: leave retn
int func0(long long a1, int a2) { int i; // [rsp+1Ch] [rbp-134h] char s[32]; // [rsp+20h] [rbp-130h] BYREF char dest[8]; // [rsp+40h] [rbp-110h] BYREF long long v6; // [rsp+48h] [rbp-108h] long long v7; // [rsp+50h] [rbp-100h] long long v8; // [rsp+58h] [rbp-F8h] long long v9; // [rsp+60h] [rbp-F0h] long long v10; // [rsp+68h] [rbp-E8h] long long v11; // [rsp+70h] [rbp-E0h] long long v12; // [rsp+78h] [rbp-D8h] long long v13; // [rsp+80h] [rbp-D0h] long long v14; // [rsp+88h] [rbp-C8h] long long v15; // [rsp+90h] [rbp-C0h] long long v16; // [rsp+98h] [rbp-B8h] long long v17; // [rsp+A0h] [rbp-B0h] long long v18; // [rsp+A8h] [rbp-A8h] long long v19; // [rsp+B0h] [rbp-A0h] long long v20; // [rsp+B8h] [rbp-98h] long long v21; // [rsp+C0h] [rbp-90h] long long v22; // [rsp+C8h] [rbp-88h] long long v23; // [rsp+D0h] [rbp-80h] long long v24; // [rsp+D8h] [rbp-78h] long long v25; // [rsp+E0h] [rbp-70h] long long v26; // [rsp+E8h] [rbp-68h] long long v27; // [rsp+F0h] [rbp-60h] long long v28; // [rsp+F8h] [rbp-58h] long long v29; // [rsp+100h] [rbp-50h] long long v30; // [rsp+108h] [rbp-48h] long long v31; // [rsp+110h] [rbp-40h] long long v32; // [rsp+118h] [rbp-38h] long long v33; // [rsp+120h] [rbp-30h] long long v34; // [rsp+128h] [rbp-28h] long long v35; // [rsp+130h] [rbp-20h] long long v36; // [rsp+138h] [rbp-18h] unsigned long long v37; // [rsp+148h] [rbp-8h] v37 = __readfsqword(0x28u); *(_QWORD *)dest = 0LL; v6 = 0LL; v7 = 0LL; v8 = 0LL; v9 = 0LL; v10 = 0LL; v11 = 0LL; v12 = 0LL; v13 = 0LL; v14 = 0LL; v15 = 0LL; v16 = 0LL; v17 = 0LL; v18 = 0LL; v19 = 0LL; v20 = 0LL; v21 = 0LL; v22 = 0LL; v23 = 0LL; v24 = 0LL; v25 = 0LL; v26 = 0LL; v27 = 0LL; v28 = 0LL; v29 = 0LL; v30 = 0LL; v31 = 0LL; v32 = 0LL; v33 = 0LL; v34 = 0LL; v35 = 0LL; v36 = 0LL; for ( i = 0; i < a2; ++i ) { sprintf(s, "%d", *(_DWORD *)(4LL * i + a1)); strcat(dest, s); } return atoi(dest); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x150 MOV qword ptr [RBP + -0x148],RDI MOV dword ptr [RBP + -0x14c],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV qword ptr [RBP + -0x110],0x0 MOV qword ptr [RBP + -0x108],0x0 MOV qword ptr [RBP + -0x100],0x0 MOV qword ptr [RBP + -0xf8],0x0 MOV qword ptr [RBP + -0xf0],0x0 MOV qword ptr [RBP + -0xe8],0x0 MOV qword ptr [RBP + -0xe0],0x0 MOV qword ptr [RBP + -0xd8],0x0 MOV qword ptr [RBP + -0xd0],0x0 MOV qword ptr [RBP + -0xc8],0x0 MOV qword ptr [RBP + -0xc0],0x0 MOV qword ptr [RBP + -0xb8],0x0 MOV qword ptr [RBP + -0xb0],0x0 MOV qword ptr [RBP + -0xa8],0x0 MOV qword ptr [RBP + -0xa0],0x0 MOV qword ptr [RBP + -0x98],0x0 MOV qword ptr [RBP + -0x90],0x0 MOV qword ptr [RBP + -0x88],0x0 MOV qword ptr [RBP + -0x80],0x0 MOV qword ptr [RBP + -0x78],0x0 MOV qword ptr [RBP + -0x70],0x0 MOV qword ptr [RBP + -0x68],0x0 MOV qword ptr [RBP + -0x60],0x0 MOV qword ptr [RBP + -0x58],0x0 MOV qword ptr [RBP + -0x50],0x0 MOV qword ptr [RBP + -0x48],0x0 MOV qword ptr [RBP + -0x40],0x0 MOV qword ptr [RBP + -0x38],0x0 MOV qword ptr [RBP + -0x30],0x0 MOV qword ptr [RBP + -0x28],0x0 MOV qword ptr [RBP + -0x20],0x0 MOV qword ptr [RBP + -0x18],0x0 MOV dword ptr [RBP + -0x134],0x0 JMP 0x001013b0 LAB_00101356: MOV EAX,dword ptr [RBP + -0x134] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x148] ADD RAX,RDX MOV EDX,dword ptr [RAX] LEA RAX,[RBP + -0x130] LEA RCX,[0x102004] MOV RSI,RCX MOV RDI,RAX MOV EAX,0x0 CALL 0x001010f0 LEA RDX,[RBP + -0x130] LEA RAX,[RBP + -0x110] MOV RSI,RDX MOV RDI,RAX CALL 0x001010e0 ADD dword ptr [RBP + -0x134],0x1 LAB_001013b0: MOV EAX,dword ptr [RBP + -0x134] CMP EAX,dword ptr [RBP + -0x14c] JL 0x00101356 LEA RAX,[RBP + -0x110] MOV RDI,RAX CALL 0x001010d0 MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001013e1 CALL 0x001010b0 LAB_001013e1: LEAVE RET
void func0(long param_1,int param_2) { long in_FS_OFFSET; int local_13c; char local_138 [32]; char local_118 [264]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_118[0] = '\0'; local_118[1] = '\0'; local_118[2] = '\0'; local_118[3] = '\0'; local_118[4] = '\0'; local_118[5] = '\0'; local_118[6] = '\0'; local_118[7] = '\0'; local_118[8] = '\0'; local_118[9] = '\0'; local_118[10] = '\0'; local_118[0xb] = '\0'; local_118[0xc] = '\0'; local_118[0xd] = '\0'; local_118[0xe] = '\0'; local_118[0xf] = '\0'; local_118[0x10] = '\0'; local_118[0x11] = '\0'; local_118[0x12] = '\0'; local_118[0x13] = '\0'; local_118[0x14] = '\0'; local_118[0x15] = '\0'; local_118[0x16] = '\0'; local_118[0x17] = '\0'; local_118[0x18] = '\0'; local_118[0x19] = '\0'; local_118[0x1a] = '\0'; local_118[0x1b] = '\0'; local_118[0x1c] = '\0'; local_118[0x1d] = '\0'; local_118[0x1e] = '\0'; local_118[0x1f] = '\0'; local_118[0x20] = '\0'; local_118[0x21] = '\0'; local_118[0x22] = '\0'; local_118[0x23] = '\0'; local_118[0x24] = '\0'; local_118[0x25] = '\0'; local_118[0x26] = '\0'; local_118[0x27] = '\0'; local_118[0x28] = '\0'; local_118[0x29] = '\0'; local_118[0x2a] = '\0'; local_118[0x2b] = '\0'; local_118[0x2c] = '\0'; local_118[0x2d] = '\0'; local_118[0x2e] = '\0'; local_118[0x2f] = '\0'; local_118[0x30] = '\0'; local_118[0x31] = '\0'; local_118[0x32] = '\0'; local_118[0x33] = '\0'; local_118[0x34] = '\0'; local_118[0x35] = '\0'; local_118[0x36] = '\0'; local_118[0x37] = '\0'; local_118[0x38] = '\0'; local_118[0x39] = '\0'; local_118[0x3a] = '\0'; local_118[0x3b] = '\0'; local_118[0x3c] = '\0'; local_118[0x3d] = '\0'; local_118[0x3e] = '\0'; local_118[0x3f] = '\0'; local_118[0x40] = '\0'; local_118[0x41] = '\0'; local_118[0x42] = '\0'; local_118[0x43] = '\0'; local_118[0x44] = '\0'; local_118[0x45] = '\0'; local_118[0x46] = '\0'; local_118[0x47] = '\0'; local_118[0x48] = '\0'; local_118[0x49] = '\0'; local_118[0x4a] = '\0'; local_118[0x4b] = '\0'; local_118[0x4c] = '\0'; local_118[0x4d] = '\0'; local_118[0x4e] = '\0'; local_118[0x4f] = '\0'; local_118[0x50] = '\0'; local_118[0x51] = '\0'; local_118[0x52] = '\0'; local_118[0x53] = '\0'; local_118[0x54] = '\0'; local_118[0x55] = '\0'; local_118[0x56] = '\0'; local_118[0x57] = '\0'; local_118[0x58] = '\0'; local_118[0x59] = '\0'; local_118[0x5a] = '\0'; local_118[0x5b] = '\0'; local_118[0x5c] = '\0'; local_118[0x5d] = '\0'; local_118[0x5e] = '\0'; local_118[0x5f] = '\0'; local_118[0x60] = '\0'; local_118[0x61] = '\0'; local_118[0x62] = '\0'; local_118[99] = '\0'; local_118[100] = '\0'; local_118[0x65] = '\0'; local_118[0x66] = '\0'; local_118[0x67] = '\0'; local_118[0x68] = '\0'; local_118[0x69] = '\0'; local_118[0x6a] = '\0'; local_118[0x6b] = '\0'; local_118[0x6c] = '\0'; local_118[0x6d] = '\0'; local_118[0x6e] = '\0'; local_118[0x6f] = '\0'; local_118[0x70] = '\0'; local_118[0x71] = '\0'; local_118[0x72] = '\0'; local_118[0x73] = '\0'; local_118[0x74] = '\0'; local_118[0x75] = '\0'; local_118[0x76] = '\0'; local_118[0x77] = '\0'; local_118[0x78] = '\0'; local_118[0x79] = '\0'; local_118[0x7a] = '\0'; local_118[0x7b] = '\0'; local_118[0x7c] = '\0'; local_118[0x7d] = '\0'; local_118[0x7e] = '\0'; local_118[0x7f] = '\0'; local_118[0x80] = '\0'; local_118[0x81] = '\0'; local_118[0x82] = '\0'; local_118[0x83] = '\0'; local_118[0x84] = '\0'; local_118[0x85] = '\0'; local_118[0x86] = '\0'; local_118[0x87] = '\0'; local_118[0x88] = '\0'; local_118[0x89] = '\0'; local_118[0x8a] = '\0'; local_118[0x8b] = '\0'; local_118[0x8c] = '\0'; local_118[0x8d] = '\0'; local_118[0x8e] = '\0'; local_118[0x8f] = '\0'; local_118[0x90] = '\0'; local_118[0x91] = '\0'; local_118[0x92] = '\0'; local_118[0x93] = '\0'; local_118[0x94] = '\0'; local_118[0x95] = '\0'; local_118[0x96] = '\0'; local_118[0x97] = '\0'; local_118[0x98] = '\0'; local_118[0x99] = '\0'; local_118[0x9a] = '\0'; local_118[0x9b] = '\0'; local_118[0x9c] = '\0'; local_118[0x9d] = '\0'; local_118[0x9e] = '\0'; local_118[0x9f] = '\0'; local_118[0xa0] = '\0'; local_118[0xa1] = '\0'; local_118[0xa2] = '\0'; local_118[0xa3] = '\0'; local_118[0xa4] = '\0'; local_118[0xa5] = '\0'; local_118[0xa6] = '\0'; local_118[0xa7] = '\0'; local_118[0xa8] = '\0'; local_118[0xa9] = '\0'; local_118[0xaa] = '\0'; local_118[0xab] = '\0'; local_118[0xac] = '\0'; local_118[0xad] = '\0'; local_118[0xae] = '\0'; local_118[0xaf] = '\0'; local_118[0xb0] = '\0'; local_118[0xb1] = '\0'; local_118[0xb2] = '\0'; local_118[0xb3] = '\0'; local_118[0xb4] = '\0'; local_118[0xb5] = '\0'; local_118[0xb6] = '\0'; local_118[0xb7] = '\0'; local_118[0xb8] = '\0'; local_118[0xb9] = '\0'; local_118[0xba] = '\0'; local_118[0xbb] = '\0'; local_118[0xbc] = '\0'; local_118[0xbd] = '\0'; local_118[0xbe] = '\0'; local_118[0xbf] = '\0'; local_118[0xc0] = '\0'; local_118[0xc1] = '\0'; local_118[0xc2] = '\0'; local_118[0xc3] = '\0'; local_118[0xc4] = '\0'; local_118[0xc5] = '\0'; local_118[0xc6] = '\0'; local_118[199] = '\0'; local_118[200] = '\0'; local_118[0xc9] = '\0'; local_118[0xca] = '\0'; local_118[0xcb] = '\0'; local_118[0xcc] = '\0'; local_118[0xcd] = '\0'; local_118[0xce] = '\0'; local_118[0xcf] = '\0'; local_118[0xd0] = '\0'; local_118[0xd1] = '\0'; local_118[0xd2] = '\0'; local_118[0xd3] = '\0'; local_118[0xd4] = '\0'; local_118[0xd5] = '\0'; local_118[0xd6] = '\0'; local_118[0xd7] = '\0'; local_118[0xd8] = '\0'; local_118[0xd9] = '\0'; local_118[0xda] = '\0'; local_118[0xdb] = '\0'; local_118[0xdc] = '\0'; local_118[0xdd] = '\0'; local_118[0xde] = '\0'; local_118[0xdf] = '\0'; local_118[0xe0] = '\0'; local_118[0xe1] = '\0'; local_118[0xe2] = '\0'; local_118[0xe3] = '\0'; local_118[0xe4] = '\0'; local_118[0xe5] = '\0'; local_118[0xe6] = '\0'; local_118[0xe7] = '\0'; local_118[0xe8] = '\0'; local_118[0xe9] = '\0'; local_118[0xea] = '\0'; local_118[0xeb] = '\0'; local_118[0xec] = '\0'; local_118[0xed] = '\0'; local_118[0xee] = '\0'; local_118[0xef] = '\0'; local_118[0xf0] = '\0'; local_118[0xf1] = '\0'; local_118[0xf2] = '\0'; local_118[0xf3] = '\0'; local_118[0xf4] = '\0'; local_118[0xf5] = '\0'; local_118[0xf6] = '\0'; local_118[0xf7] = '\0'; local_118[0xf8] = '\0'; local_118[0xf9] = '\0'; local_118[0xfa] = '\0'; local_118[0xfb] = '\0'; local_118[0xfc] = '\0'; local_118[0xfd] = '\0'; local_118[0xfe] = '\0'; local_118[0xff] = '\0'; for (local_13c = 0; local_13c < param_2; local_13c = local_13c + 1) { sprintf(local_138,"%d",(ulong)*(uint *)(param_1 + (long)local_13c * 4)); strcat(local_118,local_138); } atoi(local_118); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return; }
5,649
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h>
int func0(int* L, int size) { char temp[256] = {0}; char numStr[20]; for (int i = 0; i < size; i++) { sprintf(numStr, "%d", L[i]); strcat(temp, numStr); } return atoi(temp); }
int main() { int arr1[] = {11, 33, 50}; assert(func0(arr1, 3) == 113350); int arr2[] = {-1, 2, 3, 4, 5, 6}; assert(func0(arr2, 6) == -123456); int arr3[] = {10, 15, 20, 25}; assert(func0(arr3, 4) == 10152025); printf("All test cases passed!\n"); return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx sub $0x130,%rsp mov %fs:0x28,%rax mov %rax,0x128(%rsp) xor %eax,%eax movq $0x0,0x20(%rsp) movq $0x0,0x28(%rsp) movq $0x0,0x30(%rsp) movq $0x0,0x38(%rsp) movq $0x0,0x40(%rsp) movq $0x0,0x48(%rsp) movq $0x0,0x50(%rsp) movq $0x0,0x58(%rsp) movq $0x0,0x60(%rsp) movq $0x0,0x68(%rsp) movq $0x0,0x70(%rsp) movq $0x0,0x78(%rsp) movq $0x0,0x80(%rsp) movq $0x0,0x88(%rsp) movq $0x0,0x90(%rsp) movq $0x0,0x98(%rsp) movq $0x0,0xa0(%rsp) movq $0x0,0xa8(%rsp) movq $0x0,0xb0(%rsp) movq $0x0,0xb8(%rsp) movq $0x0,0xc0(%rsp) movq $0x0,0xc8(%rsp) movq $0x0,0xd0(%rsp) movq $0x0,0xd8(%rsp) movq $0x0,0xe0(%rsp) movq $0x0,0xe8(%rsp) movq $0x0,0xf0(%rsp) movq $0x0,0xf8(%rsp) movq $0x0,0x100(%rsp) movq $0x0,0x108(%rsp) movq $0x0,0x110(%rsp) movq $0x0,0x118(%rsp) test %esi,%esi jle 13b5 <func0+0x1cc> mov %rdi,%rbx lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%r12 mov %rsp,%rbp mov (%rbx),%r8d lea 0xc81(%rip),%rcx mov $0x14,%edx mov $0x1,%esi mov %rbp,%rdi mov $0x0,%eax callq 10f0 <__sprintf_chk@plt> lea 0x20(%rsp),%rdi mov $0x100,%edx mov %rbp,%rsi callq 10a0 <__strcat_chk@plt> add $0x4,%rbx cmp %r12,%rbx jne 1379 <func0+0x190> lea 0x20(%rsp),%rdi mov $0xa,%edx mov $0x0,%esi callq 10e0 <strtol@plt> mov 0x128(%rsp),%rcx xor %fs:0x28,%rcx jne 13e8 <func0+0x1ff> add $0x130,%rsp pop %rbx pop %rbp pop %r12 retq callq 10c0 <__stack_chk_fail@plt>
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 138h mov rax, fs:28h mov [rsp+158h+var_30], rax xor eax, eax mov [rsp+158h+var_138], 0 mov [rsp+158h+var_130], 0 mov [rsp+158h+var_128], 0 mov [rsp+158h+var_120], 0 mov [rsp+158h+var_118], 0 mov [rsp+158h+var_110], 0 mov [rsp+158h+var_108], 0 mov [rsp+158h+var_100], 0 mov [rsp+158h+var_F8], 0 mov [rsp+158h+var_F0], 0 mov [rsp+158h+var_E8], 0 mov [rsp+158h+var_E0], 0 mov [rsp+158h+var_D8], 0 mov [rsp+158h+var_D0], 0 mov [rsp+158h+var_C8], 0 mov [rsp+158h+var_C0], 0 mov [rsp+158h+var_B8], 0 mov [rsp+158h+var_B0], 0 mov [rsp+158h+var_A8], 0 mov [rsp+158h+var_A0], 0 mov [rsp+158h+var_98], 0 mov [rsp+158h+var_90], 0 mov [rsp+158h+var_88], 0 mov [rsp+158h+var_80], 0 mov [rsp+158h+var_78], 0 mov [rsp+158h+var_70], 0 mov [rsp+158h+var_68], 0 mov [rsp+158h+var_60], 0 mov [rsp+158h+var_58], 0 mov [rsp+158h+var_50], 0 mov [rsp+158h+var_48], 0 mov [rsp+158h+var_40], 0 test esi, esi jle short loc_13BA mov rbx, rdi lea eax, [rsi-1] lea r13, [rdi+rax*4+4] lea r12, unk_2004 loc_137F: mov rbp, rsp mov r8d, [rbx] mov rcx, r12 mov edx, 14h mov esi, 1 mov rdi, rbp mov eax, 0 call ___sprintf_chk lea rdi, [rsp+158h+var_138] mov edx, 100h mov rsi, rbp call ___strcat_chk add rbx, 4 cmp rbx, r13 jnz short loc_137F loc_13BA: lea rdi, [rsp+158h+var_138] mov edx, 0Ah mov esi, 0 call _strtol mov rdx, [rsp+158h+var_30] sub rdx, fs:28h jnz short loc_13EF add rsp, 138h pop rbx pop rbp pop r12 pop r13 retn loc_13EF: call ___stack_chk_fail
long long func0(unsigned int *a1, int a2) { unsigned int *v2; // rbx _BYTE v4[32]; // [rsp+0h] [rbp-158h] BYREF _QWORD v5[39]; // [rsp+20h] [rbp-138h] BYREF v5[33] = __readfsqword(0x28u); memset(v5, 0, 256); if ( a2 > 0 ) { v2 = a1; do { __sprintf_chk(v4, 1LL, 20LL, &unk_2004, *v2); __strcat_chk(v5, v4, 256LL); ++v2; } while ( v2 != &a1[a2 - 1 + 1] ); } return strtol(v5, 0LL, 10LL); }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x138 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x128],RAX XOR EAX,EAX MOV qword ptr [RSP + 0x20],0x0 MOV qword ptr [RSP + 0x28],0x0 MOV qword ptr [RSP + 0x30],0x0 MOV qword ptr [RSP + 0x38],0x0 MOV qword ptr [RSP + 0x40],0x0 MOV qword ptr [RSP + 0x48],0x0 MOV qword ptr [RSP + 0x50],0x0 MOV qword ptr [RSP + 0x58],0x0 MOV qword ptr [RSP + 0x60],0x0 MOV qword ptr [RSP + 0x68],0x0 MOV qword ptr [RSP + 0x70],0x0 MOV qword ptr [RSP + 0x78],0x0 MOV qword ptr [RSP + 0x80],0x0 MOV qword ptr [RSP + 0x88],0x0 MOV qword ptr [RSP + 0x90],0x0 MOV qword ptr [RSP + 0x98],0x0 MOV qword ptr [RSP + 0xa0],0x0 MOV qword ptr [RSP + 0xa8],0x0 MOV qword ptr [RSP + 0xb0],0x0 MOV qword ptr [RSP + 0xb8],0x0 MOV qword ptr [RSP + 0xc0],0x0 MOV qword ptr [RSP + 0xc8],0x0 MOV qword ptr [RSP + 0xd0],0x0 MOV qword ptr [RSP + 0xd8],0x0 MOV qword ptr [RSP + 0xe0],0x0 MOV qword ptr [RSP + 0xe8],0x0 MOV qword ptr [RSP + 0xf0],0x0 MOV qword ptr [RSP + 0xf8],0x0 MOV qword ptr [RSP + 0x100],0x0 MOV qword ptr [RSP + 0x108],0x0 MOV qword ptr [RSP + 0x110],0x0 MOV qword ptr [RSP + 0x118],0x0 TEST ESI,ESI JLE 0x001013ba MOV RBX,RDI LEA EAX,[RSI + -0x1] LEA R13,[RDI + RAX*0x4 + 0x4] LEA R12,[0x102004] LAB_0010137f: MOV RBP,RSP MOV R8D,dword ptr [RBX] MOV RCX,R12 MOV EDX,0x14 MOV ESI,0x1 MOV RDI,RBP MOV EAX,0x0 CALL 0x001010f0 LEA RDI,[RSP + 0x20] MOV EDX,0x100 MOV RSI,RBP CALL 0x001010a0 ADD RBX,0x4 CMP RBX,R13 JNZ 0x0010137f LAB_001013ba: LEA RDI,[RSP + 0x20] MOV EDX,0xa MOV ESI,0x0 CALL 0x001010e0 MOV RDX,qword ptr [RSP + 0x128] SUB RDX,qword ptr FS:[0x28] JNZ 0x001013ef ADD RSP,0x138 POP RBX POP RBP POP R12 POP R13 RET LAB_001013ef: CALL 0x001010c0
void func0(int4 *param_1,int param_2) { int4 *puVar1; long in_FS_OFFSET; int1 auStack_158 [32]; char local_138 [264]; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); local_138[0] = '\0'; local_138[1] = '\0'; local_138[2] = '\0'; local_138[3] = '\0'; local_138[4] = '\0'; local_138[5] = '\0'; local_138[6] = '\0'; local_138[7] = '\0'; local_138[8] = '\0'; local_138[9] = '\0'; local_138[10] = '\0'; local_138[0xb] = '\0'; local_138[0xc] = '\0'; local_138[0xd] = '\0'; local_138[0xe] = '\0'; local_138[0xf] = '\0'; local_138[0x10] = '\0'; local_138[0x11] = '\0'; local_138[0x12] = '\0'; local_138[0x13] = '\0'; local_138[0x14] = '\0'; local_138[0x15] = '\0'; local_138[0x16] = '\0'; local_138[0x17] = '\0'; local_138[0x18] = '\0'; local_138[0x19] = '\0'; local_138[0x1a] = '\0'; local_138[0x1b] = '\0'; local_138[0x1c] = '\0'; local_138[0x1d] = '\0'; local_138[0x1e] = '\0'; local_138[0x1f] = '\0'; local_138[0x20] = '\0'; local_138[0x21] = '\0'; local_138[0x22] = '\0'; local_138[0x23] = '\0'; local_138[0x24] = '\0'; local_138[0x25] = '\0'; local_138[0x26] = '\0'; local_138[0x27] = '\0'; local_138[0x28] = '\0'; local_138[0x29] = '\0'; local_138[0x2a] = '\0'; local_138[0x2b] = '\0'; local_138[0x2c] = '\0'; local_138[0x2d] = '\0'; local_138[0x2e] = '\0'; local_138[0x2f] = '\0'; local_138[0x30] = '\0'; local_138[0x31] = '\0'; local_138[0x32] = '\0'; local_138[0x33] = '\0'; local_138[0x34] = '\0'; local_138[0x35] = '\0'; local_138[0x36] = '\0'; local_138[0x37] = '\0'; local_138[0x38] = '\0'; local_138[0x39] = '\0'; local_138[0x3a] = '\0'; local_138[0x3b] = '\0'; local_138[0x3c] = '\0'; local_138[0x3d] = '\0'; local_138[0x3e] = '\0'; local_138[0x3f] = '\0'; local_138[0x40] = '\0'; local_138[0x41] = '\0'; local_138[0x42] = '\0'; local_138[0x43] = '\0'; local_138[0x44] = '\0'; local_138[0x45] = '\0'; local_138[0x46] = '\0'; local_138[0x47] = '\0'; local_138[0x48] = '\0'; local_138[0x49] = '\0'; local_138[0x4a] = '\0'; local_138[0x4b] = '\0'; local_138[0x4c] = '\0'; local_138[0x4d] = '\0'; local_138[0x4e] = '\0'; local_138[0x4f] = '\0'; local_138[0x50] = '\0'; local_138[0x51] = '\0'; local_138[0x52] = '\0'; local_138[0x53] = '\0'; local_138[0x54] = '\0'; local_138[0x55] = '\0'; local_138[0x56] = '\0'; local_138[0x57] = '\0'; local_138[0x58] = '\0'; local_138[0x59] = '\0'; local_138[0x5a] = '\0'; local_138[0x5b] = '\0'; local_138[0x5c] = '\0'; local_138[0x5d] = '\0'; local_138[0x5e] = '\0'; local_138[0x5f] = '\0'; local_138[0x60] = '\0'; local_138[0x61] = '\0'; local_138[0x62] = '\0'; local_138[99] = '\0'; local_138[100] = '\0'; local_138[0x65] = '\0'; local_138[0x66] = '\0'; local_138[0x67] = '\0'; local_138[0x68] = '\0'; local_138[0x69] = '\0'; local_138[0x6a] = '\0'; local_138[0x6b] = '\0'; local_138[0x6c] = '\0'; local_138[0x6d] = '\0'; local_138[0x6e] = '\0'; local_138[0x6f] = '\0'; local_138[0x70] = '\0'; local_138[0x71] = '\0'; local_138[0x72] = '\0'; local_138[0x73] = '\0'; local_138[0x74] = '\0'; local_138[0x75] = '\0'; local_138[0x76] = '\0'; local_138[0x77] = '\0'; local_138[0x78] = '\0'; local_138[0x79] = '\0'; local_138[0x7a] = '\0'; local_138[0x7b] = '\0'; local_138[0x7c] = '\0'; local_138[0x7d] = '\0'; local_138[0x7e] = '\0'; local_138[0x7f] = '\0'; local_138[0x80] = '\0'; local_138[0x81] = '\0'; local_138[0x82] = '\0'; local_138[0x83] = '\0'; local_138[0x84] = '\0'; local_138[0x85] = '\0'; local_138[0x86] = '\0'; local_138[0x87] = '\0'; local_138[0x88] = '\0'; local_138[0x89] = '\0'; local_138[0x8a] = '\0'; local_138[0x8b] = '\0'; local_138[0x8c] = '\0'; local_138[0x8d] = '\0'; local_138[0x8e] = '\0'; local_138[0x8f] = '\0'; local_138[0x90] = '\0'; local_138[0x91] = '\0'; local_138[0x92] = '\0'; local_138[0x93] = '\0'; local_138[0x94] = '\0'; local_138[0x95] = '\0'; local_138[0x96] = '\0'; local_138[0x97] = '\0'; local_138[0x98] = '\0'; local_138[0x99] = '\0'; local_138[0x9a] = '\0'; local_138[0x9b] = '\0'; local_138[0x9c] = '\0'; local_138[0x9d] = '\0'; local_138[0x9e] = '\0'; local_138[0x9f] = '\0'; local_138[0xa0] = '\0'; local_138[0xa1] = '\0'; local_138[0xa2] = '\0'; local_138[0xa3] = '\0'; local_138[0xa4] = '\0'; local_138[0xa5] = '\0'; local_138[0xa6] = '\0'; local_138[0xa7] = '\0'; local_138[0xa8] = '\0'; local_138[0xa9] = '\0'; local_138[0xaa] = '\0'; local_138[0xab] = '\0'; local_138[0xac] = '\0'; local_138[0xad] = '\0'; local_138[0xae] = '\0'; local_138[0xaf] = '\0'; local_138[0xb0] = '\0'; local_138[0xb1] = '\0'; local_138[0xb2] = '\0'; local_138[0xb3] = '\0'; local_138[0xb4] = '\0'; local_138[0xb5] = '\0'; local_138[0xb6] = '\0'; local_138[0xb7] = '\0'; local_138[0xb8] = '\0'; local_138[0xb9] = '\0'; local_138[0xba] = '\0'; local_138[0xbb] = '\0'; local_138[0xbc] = '\0'; local_138[0xbd] = '\0'; local_138[0xbe] = '\0'; local_138[0xbf] = '\0'; local_138[0xc0] = '\0'; local_138[0xc1] = '\0'; local_138[0xc2] = '\0'; local_138[0xc3] = '\0'; local_138[0xc4] = '\0'; local_138[0xc5] = '\0'; local_138[0xc6] = '\0'; local_138[199] = '\0'; local_138[200] = '\0'; local_138[0xc9] = '\0'; local_138[0xca] = '\0'; local_138[0xcb] = '\0'; local_138[0xcc] = '\0'; local_138[0xcd] = '\0'; local_138[0xce] = '\0'; local_138[0xcf] = '\0'; local_138[0xd0] = '\0'; local_138[0xd1] = '\0'; local_138[0xd2] = '\0'; local_138[0xd3] = '\0'; local_138[0xd4] = '\0'; local_138[0xd5] = '\0'; local_138[0xd6] = '\0'; local_138[0xd7] = '\0'; local_138[0xd8] = '\0'; local_138[0xd9] = '\0'; local_138[0xda] = '\0'; local_138[0xdb] = '\0'; local_138[0xdc] = '\0'; local_138[0xdd] = '\0'; local_138[0xde] = '\0'; local_138[0xdf] = '\0'; local_138[0xe0] = '\0'; local_138[0xe1] = '\0'; local_138[0xe2] = '\0'; local_138[0xe3] = '\0'; local_138[0xe4] = '\0'; local_138[0xe5] = '\0'; local_138[0xe6] = '\0'; local_138[0xe7] = '\0'; local_138[0xe8] = '\0'; local_138[0xe9] = '\0'; local_138[0xea] = '\0'; local_138[0xeb] = '\0'; local_138[0xec] = '\0'; local_138[0xed] = '\0'; local_138[0xee] = '\0'; local_138[0xef] = '\0'; local_138[0xf0] = '\0'; local_138[0xf1] = '\0'; local_138[0xf2] = '\0'; local_138[0xf3] = '\0'; local_138[0xf4] = '\0'; local_138[0xf5] = '\0'; local_138[0xf6] = '\0'; local_138[0xf7] = '\0'; local_138[0xf8] = '\0'; local_138[0xf9] = '\0'; local_138[0xfa] = '\0'; local_138[0xfb] = '\0'; local_138[0xfc] = '\0'; local_138[0xfd] = '\0'; local_138[0xfe] = '\0'; local_138[0xff] = '\0'; if (0 < param_2) { puVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { __sprintf_chk(auStack_158,1,0x14,&DAT_00102004,*param_1); __strcat_chk(local_138,auStack_158,0x100); param_1 = param_1 + 1; } while (param_1 != puVar1); } strtol(local_138,(char **)0x0,10); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,650
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h>
int func0(int* L, int size) { char temp[256] = {0}; char numStr[20]; for (int i = 0; i < size; i++) { sprintf(numStr, "%d", L[i]); strcat(temp, numStr); } return atoi(temp); }
int main() { int arr1[] = {11, 33, 50}; assert(func0(arr1, 3) == 113350); int arr2[] = {-1, 2, 3, 4, 5, 6}; assert(func0(arr2, 6) == -123456); int arr3[] = {10, 15, 20, 25}; assert(func0(arr3, 4) == 10152025); printf("All test cases passed!\n"); return 0; }
O2
c
func0: endbr64 push %r14 pxor %xmm0,%xmm0 push %r13 push %r12 push %rbp push %rbx sub $0x130,%rsp mov %fs:0x28,%rax mov %rax,0x128(%rsp) xor %eax,%eax lea 0x20(%rsp),%r12 movaps %xmm0,0x20(%rsp) movaps %xmm0,0x30(%rsp) movaps %xmm0,0x40(%rsp) movaps %xmm0,0x50(%rsp) movaps %xmm0,0x60(%rsp) movaps %xmm0,0x70(%rsp) movaps %xmm0,0x80(%rsp) movaps %xmm0,0x90(%rsp) movaps %xmm0,0xa0(%rsp) movaps %xmm0,0xb0(%rsp) movaps %xmm0,0xc0(%rsp) movaps %xmm0,0xd0(%rsp) movaps %xmm0,0xe0(%rsp) movaps %xmm0,0xf0(%rsp) movaps %xmm0,0x100(%rsp) movaps %xmm0,0x110(%rsp) test %esi,%esi jle 1433 <func0+0xf3> lea -0x1(%rsi),%eax mov %rdi,%rbx lea 0x20(%rsp),%r12 mov %rsp,%rbp lea 0x4(%rdi,%rax,4),%r14 lea 0xc09(%rip),%r13 nopl 0x0(%rax,%rax,1) mov (%rbx),%r8d mov %r13,%rcx mov $0x14,%edx mov $0x1,%esi mov %rbp,%rdi xor %eax,%eax add $0x4,%rbx callq 10f0 <__sprintf_chk@plt> mov $0x100,%edx mov %rbp,%rsi mov %r12,%rdi callq 10a0 <__strcat_chk@plt> cmp %r14,%rbx jne 1400 <func0+0xc0> xor %esi,%esi mov $0xa,%edx mov %r12,%rdi callq 10e0 <strtol@plt> mov 0x128(%rsp),%rcx xor %fs:0x28,%rcx jne 1465 <func0+0x125> add $0x130,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq callq 10c0 <__stack_chk_fail@plt> nopw 0x0(%rax,%rax,1)
func0: endbr64 push r14 pxor xmm0, xmm0 push r13 push r12 push rbp push rbx sub rsp, 130h mov rax, fs:28h mov [rsp+158h+var_30], rax xor eax, eax lea r12, [rsp+158h+var_138] movaps [rsp+158h+var_138], xmm0 movaps [rsp+158h+var_128], xmm0 movaps [rsp+158h+var_118], xmm0 movaps [rsp+158h+var_108], xmm0 movaps [rsp+158h+var_F8], xmm0 movaps [rsp+158h+var_E8], xmm0 movaps [rsp+158h+var_D8], xmm0 movaps [rsp+158h+var_C8], xmm0 movaps [rsp+158h+var_B8], xmm0 movaps [rsp+158h+var_A8], xmm0 movaps [rsp+158h+var_98], xmm0 movaps [rsp+158h+var_88], xmm0 movaps [rsp+158h+var_78], xmm0 movaps [rsp+158h+var_68], xmm0 movaps [rsp+158h+var_58], xmm0 movaps [rsp+158h+var_48], xmm0 test esi, esi jle short loc_1433 lea eax, [rsi-1] mov rbx, rdi lea r13, unk_2004 mov rbp, rsp lea r14, [rdi+rax*4+4] lea r12, [rsp+158h+var_138] nop dword ptr [rax+rax+00h] loc_1400: mov r8d, [rbx] mov rcx, r13 mov edx, 14h mov esi, 1 mov rdi, rbp xor eax, eax add rbx, 4 call ___sprintf_chk mov edx, 100h mov rsi, rbp mov rdi, r12 call ___strcat_chk cmp rbx, r14 jnz short loc_1400 loc_1433: mov edx, 0Ah xor esi, esi mov rdi, r12 call _strtol mov rdx, [rsp+158h+var_30] sub rdx, fs:28h jnz short loc_1465 add rsp, 130h pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_1465: call ___stack_chk_fail
long long func0(unsigned int *a1, int a2) { unsigned int *v2; // rbx long long v3; // r8 _BYTE v5[32]; // [rsp-8h] [rbp-158h] BYREF _OWORD v6[16]; // [rsp+18h] [rbp-138h] BYREF unsigned long long v7; // [rsp+120h] [rbp-30h] v7 = __readfsqword(0x28u); memset(v6, 0, sizeof(v6)); if ( a2 > 0 ) { v2 = a1; do { v3 = *v2++; __sprintf_chk(v5, 1LL, 20LL, &unk_2004, v3); __strcat_chk(v6, v5, 256LL); } while ( v2 != &a1[a2 - 1 + 1] ); } return strtol(v6, 0LL, 10LL); }
func0: ENDBR64 PUSH R14 PXOR XMM0,XMM0 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x130 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x128],RAX XOR EAX,EAX LEA R12,[RSP + 0x20] MOVAPS xmmword ptr [RSP + 0x20],XMM0 MOVAPS xmmword ptr [RSP + 0x30],XMM0 MOVAPS xmmword ptr [RSP + 0x40],XMM0 MOVAPS xmmword ptr [RSP + 0x50],XMM0 MOVAPS xmmword ptr [RSP + 0x60],XMM0 MOVAPS xmmword ptr [RSP + 0x70],XMM0 MOVAPS xmmword ptr [RSP + 0x80],XMM0 MOVAPS xmmword ptr [RSP + 0x90],XMM0 MOVAPS xmmword ptr [RSP + 0xa0],XMM0 MOVAPS xmmword ptr [RSP + 0xb0],XMM0 MOVAPS xmmword ptr [RSP + 0xc0],XMM0 MOVAPS xmmword ptr [RSP + 0xd0],XMM0 MOVAPS xmmword ptr [RSP + 0xe0],XMM0 MOVAPS xmmword ptr [RSP + 0xf0],XMM0 MOVAPS xmmword ptr [RSP + 0x100],XMM0 MOVAPS xmmword ptr [RSP + 0x110],XMM0 TEST ESI,ESI JLE 0x00101433 LEA EAX,[RSI + -0x1] MOV RBX,RDI LEA R13,[0x102004] MOV RBP,RSP LEA R14,[RDI + RAX*0x4 + 0x4] LEA R12,[RSP + 0x20] NOP dword ptr [RAX + RAX*0x1] LAB_00101400: MOV R8D,dword ptr [RBX] MOV RCX,R13 MOV EDX,0x14 MOV ESI,0x1 MOV RDI,RBP XOR EAX,EAX ADD RBX,0x4 CALL 0x001010f0 MOV EDX,0x100 MOV RSI,RBP MOV RDI,R12 CALL 0x001010a0 CMP RBX,R14 JNZ 0x00101400 LAB_00101433: MOV EDX,0xa XOR ESI,ESI MOV RDI,R12 CALL 0x001010e0 MOV RDX,qword ptr [RSP + 0x128] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101465 ADD RSP,0x130 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_00101465: CALL 0x001010c0
void func0(int4 *param_1,int param_2) { int4 *puVar1; int4 uVar2; long in_FS_OFFSET; int1 auStack_158 [32]; int1 local_138 [16]; int1 local_128 [16]; int1 local_118 [16]; int1 local_108 [16]; int1 local_f8 [16]; int1 local_e8 [16]; int1 local_d8 [16]; int1 local_c8 [16]; int1 local_b8 [16]; int1 local_a8 [16]; int1 local_98 [16]; int1 local_88 [16]; int1 local_78 [16]; int1 local_68 [16]; int1 local_58 [16]; int1 local_48 [16]; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); local_138 = (int1 [16])0x0; local_128 = (int1 [16])0x0; local_118 = (int1 [16])0x0; local_108 = (int1 [16])0x0; local_f8 = (int1 [16])0x0; local_e8 = (int1 [16])0x0; local_d8 = (int1 [16])0x0; local_c8 = (int1 [16])0x0; local_b8 = (int1 [16])0x0; local_a8 = (int1 [16])0x0; local_98 = (int1 [16])0x0; local_88 = (int1 [16])0x0; local_78 = (int1 [16])0x0; local_68 = (int1 [16])0x0; local_58 = (int1 [16])0x0; local_48 = (int1 [16])0x0; if (0 < param_2) { puVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { uVar2 = *param_1; param_1 = param_1 + 1; __sprintf_chk(auStack_158,1,0x14,&DAT_00102004,uVar2); __strcat_chk(local_138,auStack_158,0x100); } while (param_1 != puVar1); } strtol(local_138,(char **)0x0,10); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,651
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h>
int func0(int* L, int size) { char temp[256] = {0}; char numStr[20]; for (int i = 0; i < size; i++) { sprintf(numStr, "%d", L[i]); strcat(temp, numStr); } return atoi(temp); }
int main() { int arr1[] = {11, 33, 50}; assert(func0(arr1, 3) == 113350); int arr2[] = {-1, 2, 3, 4, 5, 6}; assert(func0(arr2, 6) == -123456); int arr3[] = {10, 15, 20, 25}; assert(func0(arr3, 4) == 10152025); printf("All test cases passed!\n"); return 0; }
O3
c
func0: endbr64 push %r14 pxor %xmm0,%xmm0 push %r13 push %r12 push %rbp push %rbx sub $0x130,%rsp mov %fs:0x28,%rax mov %rax,0x128(%rsp) xor %eax,%eax lea 0x20(%rsp),%r12 movaps %xmm0,0x20(%rsp) movaps %xmm0,0x30(%rsp) movaps %xmm0,0x40(%rsp) movaps %xmm0,0x50(%rsp) movaps %xmm0,0x60(%rsp) movaps %xmm0,0x70(%rsp) movaps %xmm0,0x80(%rsp) movaps %xmm0,0x90(%rsp) movaps %xmm0,0xa0(%rsp) movaps %xmm0,0xb0(%rsp) movaps %xmm0,0xc0(%rsp) movaps %xmm0,0xd0(%rsp) movaps %xmm0,0xe0(%rsp) movaps %xmm0,0xf0(%rsp) movaps %xmm0,0x100(%rsp) movaps %xmm0,0x110(%rsp) test %esi,%esi jle 1413 <func0+0xf3> lea -0x1(%rsi),%eax mov %rdi,%rbx lea 0x20(%rsp),%r12 mov %rsp,%rbp lea 0x4(%rdi,%rax,4),%r14 lea 0xc29(%rip),%r13 nopl 0x0(%rax,%rax,1) mov (%rbx),%r8d mov %r13,%rcx mov $0x14,%edx mov $0x1,%esi mov %rbp,%rdi xor %eax,%eax add $0x4,%rbx callq 10f0 <__sprintf_chk@plt> mov $0x100,%edx mov %rbp,%rsi mov %r12,%rdi callq 10a0 <__strcat_chk@plt> cmp %r14,%rbx jne 13e0 <func0+0xc0> xor %esi,%esi mov $0xa,%edx mov %r12,%rdi callq 10e0 <strtol@plt> mov 0x128(%rsp),%rcx xor %fs:0x28,%rcx jne 1445 <func0+0x125> add $0x130,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq callq 10c0 <__stack_chk_fail@plt> nopw 0x0(%rax,%rax,1)
func0: endbr64 push r14 pxor xmm0, xmm0 push r13 push r12 push rbp push rbx sub rsp, 130h mov rax, fs:28h mov [rsp+158h+var_30], rax xor eax, eax lea r12, [rsp+158h+nptr] movaps xmmword ptr [rsp+158h+nptr], xmm0 movaps [rsp+158h+var_128], xmm0 movaps [rsp+158h+var_118], xmm0 movaps [rsp+158h+var_108], xmm0 movaps [rsp+158h+var_F8], xmm0 movaps [rsp+158h+var_E8], xmm0 movaps [rsp+158h+var_D8], xmm0 movaps [rsp+158h+var_C8], xmm0 movaps [rsp+158h+var_B8], xmm0 movaps [rsp+158h+var_A8], xmm0 movaps [rsp+158h+var_98], xmm0 movaps [rsp+158h+var_88], xmm0 movaps [rsp+158h+var_78], xmm0 movaps [rsp+158h+var_68], xmm0 movaps [rsp+158h+var_58], xmm0 movaps [rsp+158h+var_48], xmm0 test esi, esi jle short loc_1403 movsxd rsi, esi mov rbx, rdi lea r13, unk_2004 mov rbp, rsp lea r14, [rdi+rsi*4] lea r12, [rsp+158h+nptr] nop word ptr [rax+rax+00h] loc_13D0: mov r8d, [rbx] mov rcx, r13 mov edx, 14h mov esi, 2 mov rdi, rbp xor eax, eax add rbx, 4 call ___sprintf_chk mov edx, 100h mov rsi, rbp mov rdi, r12 call ___strcat_chk cmp rbx, r14 jnz short loc_13D0 loc_1403: mov edx, 0Ah; base xor esi, esi; endptr mov rdi, r12; nptr call _strtol mov rdx, [rsp+158h+var_30] sub rdx, fs:28h jnz short loc_1435 add rsp, 130h pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_1435: call ___stack_chk_fail
long long func0(unsigned int *a1, int a2) { unsigned int *v2; // rbx long long v3; // r8 _BYTE v5[32]; // [rsp-8h] [rbp-158h] BYREF char nptr[16]; // [rsp+18h] [rbp-138h] BYREF __int128 v7; // [rsp+28h] [rbp-128h] __int128 v8; // [rsp+38h] [rbp-118h] __int128 v9; // [rsp+48h] [rbp-108h] __int128 v10; // [rsp+58h] [rbp-F8h] __int128 v11; // [rsp+68h] [rbp-E8h] __int128 v12; // [rsp+78h] [rbp-D8h] __int128 v13; // [rsp+88h] [rbp-C8h] __int128 v14; // [rsp+98h] [rbp-B8h] __int128 v15; // [rsp+A8h] [rbp-A8h] __int128 v16; // [rsp+B8h] [rbp-98h] __int128 v17; // [rsp+C8h] [rbp-88h] __int128 v18; // [rsp+D8h] [rbp-78h] __int128 v19; // [rsp+E8h] [rbp-68h] __int128 v20; // [rsp+F8h] [rbp-58h] __int128 v21; // [rsp+108h] [rbp-48h] unsigned long long v22; // [rsp+120h] [rbp-30h] v22 = __readfsqword(0x28u); *(_OWORD *)nptr = 0LL; v7 = 0LL; v8 = 0LL; v9 = 0LL; v10 = 0LL; v11 = 0LL; v12 = 0LL; v13 = 0LL; v14 = 0LL; v15 = 0LL; v16 = 0LL; v17 = 0LL; v18 = 0LL; v19 = 0LL; v20 = 0LL; v21 = 0LL; if ( a2 > 0 ) { v2 = a1; do { v3 = *v2++; __sprintf_chk(v5, 2LL, 20LL, &unk_2004, v3); __strcat_chk(nptr, v5, 256LL); } while ( v2 != &a1[a2] ); } return strtol(nptr, 0LL, 10); }
func0: ENDBR64 PUSH R14 PXOR XMM0,XMM0 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x130 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x128],RAX XOR EAX,EAX LEA R12,[RSP + 0x20] MOVAPS xmmword ptr [RSP + 0x20],XMM0 MOVAPS xmmword ptr [RSP + 0x30],XMM0 MOVAPS xmmword ptr [RSP + 0x40],XMM0 MOVAPS xmmword ptr [RSP + 0x50],XMM0 MOVAPS xmmword ptr [RSP + 0x60],XMM0 MOVAPS xmmword ptr [RSP + 0x70],XMM0 MOVAPS xmmword ptr [RSP + 0x80],XMM0 MOVAPS xmmword ptr [RSP + 0x90],XMM0 MOVAPS xmmword ptr [RSP + 0xa0],XMM0 MOVAPS xmmword ptr [RSP + 0xb0],XMM0 MOVAPS xmmword ptr [RSP + 0xc0],XMM0 MOVAPS xmmword ptr [RSP + 0xd0],XMM0 MOVAPS xmmword ptr [RSP + 0xe0],XMM0 MOVAPS xmmword ptr [RSP + 0xf0],XMM0 MOVAPS xmmword ptr [RSP + 0x100],XMM0 MOVAPS xmmword ptr [RSP + 0x110],XMM0 TEST ESI,ESI JLE 0x00101403 MOVSXD RSI,ESI MOV RBX,RDI LEA R13,[0x102004] MOV RBP,RSP LEA R14,[RDI + RSI*0x4] LEA R12,[RSP + 0x20] NOP word ptr [RAX + RAX*0x1] LAB_001013d0: MOV R8D,dword ptr [RBX] MOV RCX,R13 MOV EDX,0x14 MOV ESI,0x2 MOV RDI,RBP XOR EAX,EAX ADD RBX,0x4 CALL 0x001010f0 MOV EDX,0x100 MOV RSI,RBP MOV RDI,R12 CALL 0x001010a0 CMP RBX,R14 JNZ 0x001013d0 LAB_00101403: MOV EDX,0xa XOR ESI,ESI MOV RDI,R12 CALL 0x001010e0 MOV RDX,qword ptr [RSP + 0x128] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101435 ADD RSP,0x130 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_00101435: CALL 0x001010c0
void func0(int4 *param_1,int param_2) { int4 *puVar1; int4 uVar2; long in_FS_OFFSET; int auStack_158 [32]; int local_138 [16]; int local_128 [16]; int local_118 [16]; int local_108 [16]; int local_f8 [16]; int local_e8 [16]; int local_d8 [16]; int local_c8 [16]; int local_b8 [16]; int local_a8 [16]; int local_98 [16]; int local_88 [16]; int local_78 [16]; int local_68 [16]; int local_58 [16]; int local_48 [16]; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); local_138 = (int [16])0x0; local_128 = (int [16])0x0; local_118 = (int [16])0x0; local_108 = (int [16])0x0; local_f8 = (int [16])0x0; local_e8 = (int [16])0x0; local_d8 = (int [16])0x0; local_c8 = (int [16])0x0; local_b8 = (int [16])0x0; local_a8 = (int [16])0x0; local_98 = (int [16])0x0; local_88 = (int [16])0x0; local_78 = (int [16])0x0; local_68 = (int [16])0x0; local_58 = (int [16])0x0; local_48 = (int [16])0x0; if (0 < param_2) { puVar1 = param_1 + param_2; do { uVar2 = *param_1; param_1 = param_1 + 1; __sprintf_chk(auStack_158,2,0x14,&DAT_00102004,uVar2); __strcat_chk(local_138,auStack_158,0x100); } while (param_1 != puVar1); } strtol(local_138,(char **)0x0,10); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,652
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <string.h>
int func0(const char *text, int *start, int *end, char *matched) { regex_t regex; regmatch_t match; if (regcomp(&regex, "\\w+ly", REG_EXTENDED) != 0) { return 0; // Failed to compile } if (regexec(&regex, text, 1, &match, 0) == 0) { *start = match.rm_so; *end = match.rm_eo; strncpy(matched, text + match.rm_so, match.rm_eo - match.rm_so); matched[match.rm_eo - match.rm_so] = '\0'; // Null-terminate the matched string regfree(&regex); return 1; } regfree(&regex); return 0; }
int main() { int start, end; char matched[100]; assert(func0("clearly!! we can see the sky", &start, &end, matched) && start == 0 && end == 7 && strcmp(matched, "clearly") == 0); assert(func0("seriously!! there are many roses", &start, &end, matched) && start == 0 && end == 9 && strcmp(matched, "seriously") == 0); assert(func0("unfortunately!! sita is going to home", &start, &end, matched) && start == 0 && end == 13 && strcmp(matched, "unfortunately") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp add $0xffffffffffffff80,%rsp mov %rdi,-0x68(%rbp) mov %rsi,-0x70(%rbp) mov %rdx,-0x78(%rbp) mov %rcx,-0x80(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea -0x50(%rbp),%rax mov $0x1,%edx lea 0xdc4(%rip),%rsi mov %rax,%rdi callq 10f0 <regcomp@plt> test %eax,%eax je 125a <func0+0x51> mov $0x0,%eax jmpq 12f6 <func0+0xed> lea -0x58(%rbp),%rdx mov -0x68(%rbp),%rsi lea -0x50(%rbp),%rax mov $0x0,%r8d mov %rdx,%rcx mov $0x1,%edx mov %rax,%rdi callq 1110 <regexec@plt> test %eax,%eax jne 12e5 <func0+0xdc> mov -0x58(%rbp),%edx mov -0x70(%rbp),%rax mov %edx,(%rax) mov -0x54(%rbp),%edx mov -0x78(%rbp),%rax mov %edx,(%rax) mov -0x54(%rbp),%edx mov -0x58(%rbp),%eax sub %eax,%edx mov %edx,%eax movslq %eax,%rdx mov -0x58(%rbp),%eax movslq %eax,%rcx mov -0x68(%rbp),%rax add %rax,%rcx mov -0x80(%rbp),%rax mov %rcx,%rsi mov %rax,%rdi callq 10b0 <strncpy@plt> mov -0x54(%rbp),%edx mov -0x58(%rbp),%eax sub %eax,%edx mov %edx,%eax movslq %eax,%rdx mov -0x80(%rbp),%rax add %rdx,%rax movb $0x0,(%rax) lea -0x50(%rbp),%rax mov %rax,%rdi callq 10c0 <regfree@plt> mov $0x1,%eax jmp 12f6 <func0+0xed> lea -0x50(%rbp),%rax mov %rax,%rdi callq 10c0 <regfree@plt> mov $0x0,%eax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 130a <func0+0x101> callq 10d0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp add rsp, 0FFFFFFFFFFFFFF80h mov [rbp+string], rdi mov [rbp+var_70], rsi mov [rbp+var_78], rdx mov [rbp+dest], rcx mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea rax, [rbp+preg] mov edx, 1; cflags lea rcx, pattern; "\\w+ly" mov rsi, rcx; pattern mov rdi, rax; preg call _regcomp test eax, eax jz short loc_125D mov eax, 0 jmp loc_12F5 loc_125D: lea rdx, [rbp+pmatch] mov rsi, [rbp+string]; string lea rax, [rbp+preg] mov r8d, 0; eflags mov rcx, rdx; pmatch mov edx, 1; nmatch mov rdi, rax; preg call _regexec test eax, eax jnz short loc_12E4 mov edx, [rbp+pmatch.rm_so] mov rax, [rbp+var_70] mov [rax], edx mov edx, [rbp+pmatch.rm_eo] mov rax, [rbp+var_78] mov [rax], edx mov edx, [rbp+pmatch.rm_eo] mov eax, [rbp+pmatch.rm_so] sub edx, eax movsxd rdx, edx; n mov eax, [rbp+pmatch.rm_so] movsxd rcx, eax mov rax, [rbp+string] add rcx, rax mov rax, [rbp+dest] mov rsi, rcx; src mov rdi, rax; dest call _strncpy mov edx, [rbp+pmatch.rm_eo] mov eax, [rbp+pmatch.rm_so] sub edx, eax movsxd rdx, edx mov rax, [rbp+dest] add rax, rdx mov byte ptr [rax], 0 lea rax, [rbp+preg] mov rdi, rax; preg call _regfree mov eax, 1 jmp short loc_12F5 loc_12E4: lea rax, [rbp+preg] mov rdi, rax; preg call _regfree mov eax, 0 loc_12F5: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_1309 call ___stack_chk_fail locret_1309: leave retn
long long func0(const char *a1, regoff_t *a2, regoff_t *a3, char *a4) { regmatch_t pmatch; // [rsp+28h] [rbp-58h] BYREF regex_t preg; // [rsp+30h] [rbp-50h] BYREF unsigned long long v9; // [rsp+78h] [rbp-8h] v9 = __readfsqword(0x28u); if ( regcomp(&preg, "\\w+ly", 1) ) return 0LL; if ( regexec(&preg, a1, 1uLL, &pmatch, 0) ) { regfree(&preg); return 0LL; } else { *a2 = pmatch.rm_so; *a3 = pmatch.rm_eo; strncpy(a4, &a1[pmatch.rm_so], pmatch.rm_eo - pmatch.rm_so); a4[pmatch.rm_eo - pmatch.rm_so] = 0; regfree(&preg); return 1LL; } }
func0: ENDBR64 PUSH RBP MOV RBP,RSP ADD RSP,-0x80 MOV qword ptr [RBP + -0x68],RDI MOV qword ptr [RBP + -0x70],RSI MOV qword ptr [RBP + -0x78],RDX MOV qword ptr [RBP + -0x80],RCX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX LEA RAX,[RBP + -0x50] MOV EDX,0x1 LEA RCX,[0x102008] MOV RSI,RCX MOV RDI,RAX CALL 0x001010f0 TEST EAX,EAX JZ 0x0010125d MOV EAX,0x0 JMP 0x001012f5 LAB_0010125d: LEA RDX,[RBP + -0x58] MOV RSI,qword ptr [RBP + -0x68] LEA RAX,[RBP + -0x50] MOV R8D,0x0 MOV RCX,RDX MOV EDX,0x1 MOV RDI,RAX CALL 0x00101110 TEST EAX,EAX JNZ 0x001012e4 MOV EDX,dword ptr [RBP + -0x58] MOV RAX,qword ptr [RBP + -0x70] MOV dword ptr [RAX],EDX MOV EDX,dword ptr [RBP + -0x54] MOV RAX,qword ptr [RBP + -0x78] MOV dword ptr [RAX],EDX MOV EDX,dword ptr [RBP + -0x54] MOV EAX,dword ptr [RBP + -0x58] SUB EDX,EAX MOVSXD RDX,EDX MOV EAX,dword ptr [RBP + -0x58] MOVSXD RCX,EAX MOV RAX,qword ptr [RBP + -0x68] ADD RCX,RAX MOV RAX,qword ptr [RBP + -0x80] MOV RSI,RCX MOV RDI,RAX CALL 0x001010b0 MOV EDX,dword ptr [RBP + -0x54] MOV EAX,dword ptr [RBP + -0x58] SUB EDX,EAX MOVSXD RDX,EDX MOV RAX,qword ptr [RBP + -0x80] ADD RAX,RDX MOV byte ptr [RAX],0x0 LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001010c0 MOV EAX,0x1 JMP 0x001012f5 LAB_001012e4: LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001010c0 MOV EAX,0x0 LAB_001012f5: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x00101309 CALL 0x001010d0 LAB_00101309: LEAVE RET
int8 func0(char *param_1,int *param_2,int *param_3,char *param_4) { int iVar1; int8 uVar2; long in_FS_OFFSET; regmatch_t local_60; regex_t local_58; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&local_58,"\\w+ly",1); if (iVar1 == 0) { iVar1 = regexec(&local_58,param_1,1,&local_60,0); if (iVar1 == 0) { *param_2 = local_60.rm_so; *param_3 = local_60.rm_eo; strncpy(param_4,param_1 + local_60.rm_so,(long)(local_60.rm_eo - local_60.rm_so)); param_4[local_60.rm_eo - local_60.rm_so] = '\0'; regfree(&local_58); uVar2 = 1; } else { regfree(&local_58); uVar2 = 0; } } else { uVar2 = 0; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return uVar2; }
5,653
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <string.h>
int func0(const char *text, int *start, int *end, char *matched) { regex_t regex; regmatch_t match; if (regcomp(&regex, "\\w+ly", REG_EXTENDED) != 0) { return 0; // Failed to compile } if (regexec(&regex, text, 1, &match, 0) == 0) { *start = match.rm_so; *end = match.rm_eo; strncpy(matched, text + match.rm_so, match.rm_eo - match.rm_so); matched[match.rm_eo - match.rm_so] = '\0'; // Null-terminate the matched string regfree(&regex); return 1; } regfree(&regex); return 0; }
int main() { int start, end; char matched[100]; assert(func0("clearly!! we can see the sky", &start, &end, matched) && start == 0 && end == 7 && strcmp(matched, "clearly") == 0); assert(func0("seriously!! there are many roses", &start, &end, matched) && start == 0 && end == 9 && strcmp(matched, "seriously") == 0); assert(func0("unfortunately!! sita is going to home", &start, &end, matched) && start == 0 && end == 13 && strcmp(matched, "unfortunately") == 0); return 0; }
O1
c
func0: endbr64 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x60,%rsp mov %rdi,%rbp mov %rsi,%r14 mov %rdx,%r13 mov %rcx,%r12 mov %fs:0x28,%rax mov %rax,0x58(%rsp) xor %eax,%eax lea 0x10(%rsp),%rdi mov $0x1,%edx lea 0xdde(%rip),%rsi callq 10e0 <regcomp@plt> mov $0x0,%ebx test %eax,%eax je 1253 <func0+0x6a> mov 0x58(%rsp),%rax xor %fs:0x28,%rax jne 12c0 <func0+0xd7> mov %ebx,%eax add $0x60,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq mov %eax,%ebx lea 0x8(%rsp),%rcx lea 0x10(%rsp),%rdi mov $0x0,%r8d mov $0x1,%edx mov %rbp,%rsi callq 10f0 <regexec@plt> test %eax,%eax je 1282 <func0+0x99> lea 0x10(%rsp),%rdi callq 10b0 <regfree@plt> jmp 1234 <func0+0x4b> mov 0x8(%rsp),%esi mov %esi,(%r14) mov 0xc(%rsp),%ebx mov %ebx,0x0(%r13) sub %esi,%ebx movslq %ebx,%rbx movslq %esi,%rsi add %rbp,%rsi mov %rbx,%rdx mov %r12,%rdi callq 10a0 <strncpy@plt> movb $0x0,(%r12,%rbx,1) lea 0x10(%rsp),%rdi callq 10b0 <regfree@plt> mov $0x1,%ebx jmpq 1234 <func0+0x4b> callq 10c0 <__stack_chk_fail@plt>
func0: endbr64 push r14 push r13 push r12 push rbp push rbx sub rsp, 60h mov rbp, rdi mov r14, rsi mov r13, rdx mov r12, rcx mov rax, fs:28h mov [rsp+88h+var_30], rax xor eax, eax lea rdi, [rsp+88h+var_78] mov edx, 1 lea rsi, aWLy; "\\w+ly" call _regcomp mov ebx, 0 test eax, eax jz short loc_1273 loc_1254: mov rax, [rsp+88h+var_30] sub rax, fs:28h jnz short loc_12E1 mov eax, ebx add rsp, 60h pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_1273: mov ebx, eax lea rcx, [rsp+88h+var_80] lea rdi, [rsp+88h+var_78] mov r8d, 0 mov edx, 1 mov rsi, rbp call _regexec test eax, eax jz short loc_12A2 lea rdi, [rsp+88h+var_78] call _regfree jmp short loc_1254 loc_12A2: mov eax, [rsp+88h+var_80] mov [r14], eax mov ebx, [rsp+88h+var_7C] mov [r13+0], ebx sub ebx, eax movsxd rbx, ebx cdqe lea rsi, [rbp+rax+0] mov rdx, rbx mov rdi, r12 call _strncpy mov byte ptr [r12+rbx], 0 lea rdi, [rsp+88h+var_78] call _regfree mov ebx, 1 jmp loc_1254 loc_12E1: call ___stack_chk_fail
long long func0(long long a1, _DWORD *a2, _DWORD *a3, long long a4) { unsigned int v6; // ebx int v8; // eax int v9; // ebx int v10; // ebx int v11; // [rsp+8h] [rbp-80h] BYREF int v12; // [rsp+Ch] [rbp-7Ch] _BYTE v13[72]; // [rsp+10h] [rbp-78h] BYREF unsigned long long v14; // [rsp+58h] [rbp-30h] v14 = __readfsqword(0x28u); v6 = 0; if ( !(unsigned int)regcomp(v13, "\\w+ly", 1LL) ) { v6 = 0; if ( (unsigned int)regexec(v13, a1, 1LL, &v11, 0LL) ) { regfree(v13); } else { v8 = v11; *a2 = v11; v9 = v12; *a3 = v12; v10 = v9 - v8; strncpy(a4, a1 + v8, v10); *(_BYTE *)(a4 + v10) = 0; regfree(v13); return 1; } } return v6; }
func0: ENDBR64 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x60 MOV RBP,RDI MOV R14,RSI MOV R13,RDX MOV R12,RCX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x58],RAX XOR EAX,EAX LEA RDI,[RSP + 0x10] MOV EDX,0x1 LEA RSI,[0x102004] CALL 0x001010f0 MOV EBX,0x0 TEST EAX,EAX JZ 0x00101273 LAB_00101254: MOV RAX,qword ptr [RSP + 0x58] SUB RAX,qword ptr FS:[0x28] JNZ 0x001012e1 MOV EAX,EBX ADD RSP,0x60 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_00101273: MOV EBX,EAX LEA RCX,[RSP + 0x8] LEA RDI,[RSP + 0x10] MOV R8D,0x0 MOV EDX,0x1 MOV RSI,RBP CALL 0x00101110 TEST EAX,EAX JZ 0x001012a2 LEA RDI,[RSP + 0x10] CALL 0x001010c0 JMP 0x00101254 LAB_001012a2: MOV EAX,dword ptr [RSP + 0x8] MOV dword ptr [R14],EAX MOV EBX,dword ptr [RSP + 0xc] MOV dword ptr [R13],EBX SUB EBX,EAX MOVSXD RBX,EBX CDQE LEA RSI,[RBP + RAX*0x1] MOV RDX,RBX MOV RDI,R12 CALL 0x001010b0 MOV byte ptr [R12 + RBX*0x1],0x0 LEA RDI,[RSP + 0x10] CALL 0x001010c0 MOV EBX,0x1 JMP 0x00101254 LAB_001012e1: CALL 0x001010d0
int8 func0(char *param_1,int *param_2,int *param_3,char *param_4) { int iVar1; int8 uVar2; long in_FS_OFFSET; regmatch_t local_80; regex_t local_78; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&local_78,"\\w+ly",1); uVar2 = 0; if (iVar1 == 0) { uVar2 = 0; iVar1 = regexec(&local_78,param_1,1,&local_80,0); if (iVar1 == 0) { *param_2 = local_80.rm_so; *param_3 = local_80.rm_eo; strncpy(param_4,param_1 + local_80.rm_so,(long)(local_80.rm_eo - local_80.rm_so)); param_4[local_80.rm_eo - local_80.rm_so] = '\0'; regfree(&local_78); uVar2 = 1; } else { regfree(&local_78); } } if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,654
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <string.h>
int func0(const char *text, int *start, int *end, char *matched) { regex_t regex; regmatch_t match; if (regcomp(&regex, "\\w+ly", REG_EXTENDED) != 0) { return 0; // Failed to compile } if (regexec(&regex, text, 1, &match, 0) == 0) { *start = match.rm_so; *end = match.rm_eo; strncpy(matched, text + match.rm_so, match.rm_eo - match.rm_so); matched[match.rm_eo - match.rm_so] = '\0'; // Null-terminate the matched string regfree(&regex); return 1; } regfree(&regex); return 0; }
int main() { int start, end; char matched[100]; assert(func0("clearly!! we can see the sky", &start, &end, matched) && start == 0 && end == 7 && strcmp(matched, "clearly") == 0); assert(func0("seriously!! there are many roses", &start, &end, matched) && start == 0 && end == 9 && strcmp(matched, "seriously") == 0); assert(func0("unfortunately!! sita is going to home", &start, &end, matched) && start == 0 && end == 13 && strcmp(matched, "unfortunately") == 0); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 mov %rsi,%r14 lea 0xc92(%rip),%rsi push %r13 mov %rdx,%r13 mov $0x1,%edx push %r12 xor %r12d,%r12d push %rbp mov %rcx,%rbp push %rbx mov %rdi,%rbx sub $0x68,%rsp mov %fs:0x28,%rax mov %rax,0x58(%rsp) xor %eax,%eax lea 0x10(%rsp),%r15 mov %r15,%rdi callq 10e0 <regcomp@plt> test %eax,%eax je 13d8 <func0+0x78> mov 0x58(%rsp),%rax xor %fs:0x28,%rax jne 1446 <func0+0xe6> add $0x68,%rsp mov %r12d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) xor %r8d,%r8d lea 0x8(%rsp),%rcx mov $0x1,%edx mov %rbx,%rsi mov %r15,%rdi mov %eax,%r12d callq 10f0 <regexec@plt> test %eax,%eax je 1408 <func0+0xa8> mov %r15,%rdi callq 10b0 <regfree@plt> jmp 13ae <func0+0x4e> nopl 0x0(%rax) movslq 0x8(%rsp),%rsi mov 0xc(%rsp),%r12d mov %rbp,%rdi mov %esi,(%r14) mov %r12d,0x0(%r13) sub %esi,%r12d add %rbx,%rsi movslq %r12d,%r12 mov %r12,%rdx callq 10a0 <strncpy@plt> movb $0x0,0x0(%rbp,%r12,1) mov %r15,%rdi mov $0x1,%r12d callq 10b0 <regfree@plt> jmpq 13ae <func0+0x4e> callq 10c0 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r15 push r14 mov r14, rsi lea rsi, aWLy; "\\w+ly" push r13 mov r13, rdx mov edx, 1 push r12 xor r12d, r12d push rbp mov rbp, rcx push rbx mov rbx, rdi sub rsp, 68h mov rax, fs:28h mov [rsp+98h+var_40], rax xor eax, eax lea r15, [rsp+98h+var_88] mov rdi, r15 call _regcomp test eax, eax jz short loc_13D8 loc_13AE: mov rax, [rsp+98h+var_40] sub rax, fs:28h jnz loc_1447 add rsp, 68h mov eax, r12d pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_13D8: xor r8d, r8d lea rcx, [rsp+98h+var_90] mov edx, 1 mov rsi, rbx mov rdi, r15 mov r12d, eax call _regexec test eax, eax jz short loc_1408 mov rdi, r15 call _regfree jmp short loc_13AE loc_1408: movsxd rax, [rsp+98h+var_90] mov r12d, [rsp+98h+var_8C] mov rdi, rbp mov [r14], eax lea rsi, [rbx+rax] mov [r13+0], r12d sub r12d, eax movsxd r12, r12d mov rdx, r12 call _strncpy mov byte ptr [rbp+r12+0], 0 mov rdi, r15 mov r12d, 1 call _regfree jmp loc_13AE loc_1447: call ___stack_chk_fail
long long func0(long long a1, _DWORD *a2, _DWORD *a3, long long a4) { unsigned int v5; // r12d long long v8; // rax int v9; // r12d int v10; // r12d _DWORD v11[2]; // [rsp+8h] [rbp-90h] BYREF _BYTE v12[72]; // [rsp+10h] [rbp-88h] BYREF unsigned long long v13; // [rsp+58h] [rbp-40h] v5 = 0; v13 = __readfsqword(0x28u); if ( !(unsigned int)regcomp(v12, "\\w+ly", 1LL) ) { v5 = 0; if ( !(unsigned int)regexec(v12, a1, 1LL, v11, 0LL) ) { v8 = v11[0]; v9 = v11[1]; *a2 = v11[0]; *a3 = v9; v10 = v9 - v8; strncpy(a4, a1 + v8, v10); *(_BYTE *)(a4 + v10) = 0; v5 = 1; } regfree(v12); } return v5; }
func0: ENDBR64 PUSH R15 PUSH R14 MOV R14,RSI LEA RSI,[0x102004] PUSH R13 MOV R13,RDX MOV EDX,0x1 PUSH R12 XOR R12D,R12D PUSH RBP MOV RBP,RCX PUSH RBX MOV RBX,RDI SUB RSP,0x68 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x58],RAX XOR EAX,EAX LEA R15,[RSP + 0x10] MOV RDI,R15 CALL 0x001010e0 TEST EAX,EAX JZ 0x001013d8 LAB_001013ae: MOV RAX,qword ptr [RSP + 0x58] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101447 ADD RSP,0x68 MOV EAX,R12D POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001013d8: XOR R8D,R8D LEA RCX,[RSP + 0x8] MOV EDX,0x1 MOV RSI,RBX MOV RDI,R15 MOV R12D,EAX CALL 0x001010f0 TEST EAX,EAX JZ 0x00101408 MOV RDI,R15 CALL 0x001010b0 JMP 0x001013ae LAB_00101408: MOVSXD RAX,dword ptr [RSP + 0x8] MOV R12D,dword ptr [RSP + 0xc] MOV RDI,RBP MOV dword ptr [R14],EAX LEA RSI,[RBX + RAX*0x1] MOV dword ptr [R13],R12D SUB R12D,EAX MOVSXD R12,R12D MOV RDX,R12 CALL 0x001010a0 MOV byte ptr [RBP + R12*0x1],0x0 MOV RDI,R15 MOV R12D,0x1 CALL 0x001010b0 JMP 0x001013ae LAB_00101447: CALL 0x001010c0
int8 func0(char *param_1,int *param_2,int *param_3,char *param_4) { int iVar1; int8 uVar2; long in_FS_OFFSET; regmatch_t local_90; regex_t local_88; long local_40; uVar2 = 0; local_40 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&local_88,"\\w+ly",1); if (iVar1 == 0) { uVar2 = 0; iVar1 = regexec(&local_88,param_1,1,&local_90,0); if (iVar1 == 0) { *param_2 = local_90.rm_so; *param_3 = local_90.rm_eo; strncpy(param_4,param_1 + local_90.rm_so,(long)(local_90.rm_eo - local_90.rm_so)); param_4[local_90.rm_eo - local_90.rm_so] = '\0'; uVar2 = 1; regfree(&local_88); } else { regfree(&local_88); } } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,655
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <string.h>
int func0(const char *text, int *start, int *end, char *matched) { regex_t regex; regmatch_t match; if (regcomp(&regex, "\\w+ly", REG_EXTENDED) != 0) { return 0; // Failed to compile } if (regexec(&regex, text, 1, &match, 0) == 0) { *start = match.rm_so; *end = match.rm_eo; strncpy(matched, text + match.rm_so, match.rm_eo - match.rm_so); matched[match.rm_eo - match.rm_so] = '\0'; // Null-terminate the matched string regfree(&regex); return 1; } regfree(&regex); return 0; }
int main() { int start, end; char matched[100]; assert(func0("clearly!! we can see the sky", &start, &end, matched) && start == 0 && end == 7 && strcmp(matched, "clearly") == 0); assert(func0("seriously!! there are many roses", &start, &end, matched) && start == 0 && end == 9 && strcmp(matched, "seriously") == 0); assert(func0("unfortunately!! sita is going to home", &start, &end, matched) && start == 0 && end == 13 && strcmp(matched, "unfortunately") == 0); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 mov %rsi,%r14 lea 0xc92(%rip),%rsi push %r13 mov %rdx,%r13 mov $0x1,%edx push %r12 xor %r12d,%r12d push %rbp mov %rcx,%rbp push %rbx mov %rdi,%rbx sub $0x68,%rsp mov %fs:0x28,%rax mov %rax,0x58(%rsp) xor %eax,%eax lea 0x10(%rsp),%r15 mov %r15,%rdi callq 10e0 <regcomp@plt> test %eax,%eax je 13d8 <func0+0x78> mov 0x58(%rsp),%rax xor %fs:0x28,%rax jne 1446 <func0+0xe6> add $0x68,%rsp mov %r12d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) xor %r8d,%r8d lea 0x8(%rsp),%rcx mov $0x1,%edx mov %rbx,%rsi mov %r15,%rdi mov %eax,%r12d callq 10f0 <regexec@plt> test %eax,%eax je 1408 <func0+0xa8> mov %r15,%rdi callq 10b0 <regfree@plt> jmp 13ae <func0+0x4e> nopl 0x0(%rax) movslq 0x8(%rsp),%rsi mov 0xc(%rsp),%r12d mov %rbp,%rdi mov %esi,(%r14) mov %r12d,0x0(%r13) sub %esi,%r12d add %rbx,%rsi movslq %r12d,%r12 mov %r12,%rdx callq 10a0 <strncpy@plt> movb $0x0,0x0(%rbp,%r12,1) mov %r15,%rdi mov $0x1,%r12d callq 10b0 <regfree@plt> jmpq 13ae <func0+0x4e> callq 10c0 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r14 push r13 mov r13, rsi lea rsi, pattern; "\\w+ly" push r12 mov r12, rdx mov edx, 1; cflags push rbp mov rbp, rcx push rbx mov rbx, rdi sub rsp, 60h mov rax, fs:28h mov [rsp+88h+var_30], rax xor eax, eax lea r14, [rsp+88h+preg] mov rdi, r14; preg call _regcomp test eax, eax jz short loc_13D0 loc_13A9: xor eax, eax loc_13AB: mov rdx, [rsp+88h+var_30] sub rdx, fs:28h jnz loc_143D add rsp, 60h pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_13D0: xor r8d, r8d; eflags lea rcx, [rsp+88h+pmatch]; pmatch mov edx, 1; nmatch mov rsi, rbx; string mov rdi, r14; preg call _regexec test eax, eax jz short loc_1400 mov rdi, r14; preg call _regfree jmp short loc_13A9 loc_1400: movsxd rdx, [rsp+88h+pmatch.rm_so] mov eax, [rsp+88h+pmatch.rm_eo] mov rdi, rbp; dest mov [r13+0], edx lea rsi, [rbx+rdx]; src mov [r12], eax sub eax, edx movsxd r12, eax mov rdx, r12; n call _strncpy mov byte ptr [rbp+r12+0], 0 mov rdi, r14; preg call _regfree mov eax, 1 jmp loc_13AB loc_143D: call ___stack_chk_fail
long long func0(char *string, regoff_t *a2, regoff_t *a3, char *a4) { long long rm_so; // rdx regoff_t rm_eo; // eax size_t v9; // r12 regmatch_t pmatch; // [rsp+8h] [rbp-80h] BYREF regex_t preg; // [rsp+10h] [rbp-78h] BYREF unsigned long long v12; // [rsp+58h] [rbp-30h] v12 = __readfsqword(0x28u); if ( regcomp(&preg, "\\w+ly", 1) ) return 0LL; if ( regexec(&preg, string, 1uLL, &pmatch, 0) ) { regfree(&preg); return 0LL; } rm_so = pmatch.rm_so; rm_eo = pmatch.rm_eo; *a2 = pmatch.rm_so; *a3 = rm_eo; v9 = rm_eo - (int)rm_so; strncpy(a4, &string[rm_so], v9); a4[v9] = 0; regfree(&preg); return 1LL; }
func0: ENDBR64 PUSH R14 PUSH R13 MOV R13,RSI LEA RSI,[0x102004] PUSH R12 MOV R12,RDX MOV EDX,0x1 PUSH RBP MOV RBP,RCX PUSH RBX MOV RBX,RDI SUB RSP,0x60 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x58],RAX XOR EAX,EAX LEA R14,[RSP + 0x10] MOV RDI,R14 CALL 0x001010e0 TEST EAX,EAX JZ 0x001013d0 LAB_001013a9: XOR EAX,EAX LAB_001013ab: MOV RDX,qword ptr [RSP + 0x58] SUB RDX,qword ptr FS:[0x28] JNZ 0x0010143d ADD RSP,0x60 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_001013d0: XOR R8D,R8D LEA RCX,[RSP + 0x8] MOV EDX,0x1 MOV RSI,RBX MOV RDI,R14 CALL 0x001010f0 TEST EAX,EAX JZ 0x00101400 MOV RDI,R14 CALL 0x001010b0 JMP 0x001013a9 LAB_00101400: MOVSXD RDX,dword ptr [RSP + 0x8] MOV EAX,dword ptr [RSP + 0xc] MOV RDI,RBP MOV dword ptr [R13],EDX LEA RSI,[RBX + RDX*0x1] MOV dword ptr [R12],EAX SUB EAX,EDX MOVSXD R12,EAX MOV RDX,R12 CALL 0x001010a0 MOV byte ptr [RBP + R12*0x1],0x0 MOV RDI,R14 CALL 0x001010b0 MOV EAX,0x1 JMP 0x001013ab LAB_0010143d: CALL 0x001010c0
int8 func0(char *param_1,int *param_2,int *param_3,char *param_4) { int iVar1; int8 uVar2; long in_FS_OFFSET; regmatch_t local_80; regex_t local_78; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&local_78,"\\w+ly",1); if (iVar1 == 0) { iVar1 = regexec(&local_78,param_1,1,&local_80,0); if (iVar1 == 0) { *param_2 = local_80.rm_so; *param_3 = local_80.rm_eo; strncpy(param_4,param_1 + local_80.rm_so,(long)(local_80.rm_eo - local_80.rm_so)); param_4[local_80.rm_eo - local_80.rm_so] = '\0'; regfree(&local_78); uVar2 = 1; goto LAB_001013ab; } regfree(&local_78); } uVar2 = 0; LAB_001013ab: if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,656
func0
#include <assert.h>
int func0(int l) { int surfacearea = 6 * l * l; return surfacearea; }
int main() { assert(func0(5) == 150); assert(func0(3) == 54); assert(func0(10) == 600); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov -0x14(%rbp),%eax imul %eax,%eax mov %eax,%edx mov %edx,%eax add %eax,%eax add %edx,%eax add %eax,%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov eax, [rbp+var_14] imul eax, eax mov edx, eax mov eax, edx add eax, eax add eax, edx add eax, eax mov [rbp+var_4], eax mov eax, [rbp+var_4] pop rbp retn
long long func0(int a1) { return (unsigned int)(6 * a1 * a1); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV EAX,dword ptr [RBP + -0x14] IMUL EAX,EAX MOV EDX,EAX MOV EAX,EDX ADD EAX,EAX ADD EAX,EDX ADD EAX,EAX MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] POP RBP RET
int func0(int param_1) { return param_1 * param_1 * 6; }
5,657
func0
#include <assert.h>
int func0(int l) { int surfacearea = 6 * l * l; return surfacearea; }
int main() { assert(func0(5) == 150); assert(func0(3) == 54); assert(func0(10) == 600); return 0; }
O1
c
func0: endbr64 imul %edi,%edi lea (%rdi,%rdi,2),%eax add %eax,%eax retq
func0: endbr64 imul edi, edi lea eax, [rdi+rdi*2] add eax, eax retn
long long func0(int a1) { return (unsigned int)(6 * a1 * a1); }
func0: ENDBR64 IMUL EDI,EDI LEA EAX,[RDI + RDI*0x2] ADD EAX,EAX RET
int func0(int param_1) { return param_1 * param_1 * 6; }
5,658
func0
#include <assert.h>
int func0(int l) { int surfacearea = 6 * l * l; return surfacearea; }
int main() { assert(func0(5) == 150); assert(func0(3) == 54); assert(func0(10) == 600); return 0; }
O2
c
func0: endbr64 imul %edi,%edi lea (%rdi,%rdi,2),%eax add %eax,%eax retq nopl (%rax)
func0: endbr64 imul edi, edi lea eax, [rdi+rdi*2] add eax, eax retn
long long func0(int a1) { return (unsigned int)(6 * a1 * a1); }
func0: ENDBR64 IMUL EDI,EDI LEA EAX,[RDI + RDI*0x2] ADD EAX,EAX RET
int func0(int param_1) { return param_1 * param_1 * 6; }
5,659
func0
#include <assert.h>
int func0(int l) { int surfacearea = 6 * l * l; return surfacearea; }
int main() { assert(func0(5) == 150); assert(func0(3) == 54); assert(func0(10) == 600); return 0; }
O3
c
func0: endbr64 imul %edi,%edi lea (%rdi,%rdi,2),%eax add %eax,%eax retq nopl (%rax)
func0: endbr64 imul edi, edi lea eax, [rdi+rdi*2] add eax, eax retn
long long func0(int a1) { return (unsigned int)(6 * a1 * a1); }
func0: ENDBR64 IMUL EDI,EDI LEA EAX,[RDI + RDI*0x2] ADD EAX,EAX RET
int func0(int param_1) { return param_1 * param_1 * 6; }
5,660
func0
#include <stdio.h> #include <assert.h> #include <math.h>
double func0(int nums[], int n) { int n1 = 0; for(int i = 0; i < n; i++) { if(nums[i] > 0) { n1 += 1; } } double result = ((double)n1 / n); result = round(result * 100) / 100; return result; }
int main() { int arr1[] = {0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8}; assert(func0(arr1, 13) == 0.54); int arr2[] = {2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8}; assert(func0(arr2, 13) == 0.69); int arr3[] = {2, 4, -6, -9, 11, -12, 14, -5, 17}; assert(func0(arr3, 9) == 0.56); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0x10(%rbp) movl $0x0,-0xc(%rbp) jmp 11ce <func0+0x45> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax test %eax,%eax jle 11ca <func0+0x41> addl $0x1,-0x10(%rbp) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11ac <func0+0x23> cvtsi2sdl -0x10(%rbp),%xmm0 cvtsi2sdl -0x1c(%rbp),%xmm1 divsd %xmm1,%xmm0 movsd %xmm0,-0x8(%rbp) movsd -0x8(%rbp),%xmm1 movsd 0xe9a(%rip),%xmm0 mulsd %xmm1,%xmm0 callq 1070 <round@plt> movsd 0xe89(%rip),%xmm1 divsd %xmm1,%xmm0 movsd %xmm0,-0x8(%rbp) movsd -0x8(%rbp),%xmm0 leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_10], 0 mov [rbp+var_C], 0 jmp short loc_11CE loc_11AC: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] test eax, eax jle short loc_11CA add [rbp+var_10], 1 loc_11CA: add [rbp+var_C], 1 loc_11CE: mov eax, [rbp+var_C] cmp eax, [rbp+var_1C] jl short loc_11AC pxor xmm0, xmm0 cvtsi2sd xmm0, [rbp+var_10] pxor xmm1, xmm1 cvtsi2sd xmm1, [rbp+var_1C] divsd xmm0, xmm1 movsd [rbp+var_8], xmm0 movsd xmm1, [rbp+var_8] movsd xmm0, cs:qword_2078 mulsd xmm1, xmm0 movq rax, xmm1 movq xmm0, rax; x call _round movq rax, xmm0 movsd xmm1, cs:qword_2078 movq xmm0, rax divsd xmm0, xmm1 movsd [rbp+var_8], xmm0 movsd xmm0, [rbp+var_8] leave retn
double func0(long long a1, int a2) { int v3; // [rsp+10h] [rbp-10h] int i; // [rsp+14h] [rbp-Ch] v3 = 0; for ( i = 0; i < a2; ++i ) { if ( *(int *)(4LL * i + a1) > 0 ) ++v3; } return round((double)v3 / (double)a2 * 100.0) / 100.0; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x10],0x0 MOV dword ptr [RBP + -0xc],0x0 JMP 0x001011ce LAB_001011ac: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JLE 0x001011ca ADD dword ptr [RBP + -0x10],0x1 LAB_001011ca: ADD dword ptr [RBP + -0xc],0x1 LAB_001011ce: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011ac PXOR XMM0,XMM0 CVTSI2SD XMM0,dword ptr [RBP + -0x10] PXOR XMM1,XMM1 CVTSI2SD XMM1,dword ptr [RBP + -0x1c] DIVSD XMM0,XMM1 MOVSD qword ptr [RBP + -0x8],XMM0 MOVSD XMM1,qword ptr [RBP + -0x8] MOVSD XMM0,qword ptr [0x00102078] MULSD XMM1,XMM0 MOVQ RAX,XMM1 MOVQ XMM0,RAX CALL 0x00101070 MOVQ RAX,XMM0 MOVSD XMM1,qword ptr [0x00102078] MOVQ XMM0,RAX DIVSD XMM0,XMM1 MOVSD qword ptr [RBP + -0x8],XMM0 MOVSD XMM0,qword ptr [RBP + -0x8] LEAVE RET
double func0(long param_1,int param_2) { double dVar1; int4 local_18; int4 local_14; local_18 = 0; for (local_14 = 0; local_14 < param_2; local_14 = local_14 + 1) { if (0 < *(int *)(param_1 + (long)local_14 * 4)) { local_18 = local_18 + 1; } } dVar1 = round(((double)local_18 / (double)param_2) * DAT_00102078); return dVar1 / DAT_00102078; }
5,661
func0
#include <stdio.h> #include <assert.h> #include <math.h>
double func0(int nums[], int n) { int n1 = 0; for(int i = 0; i < n; i++) { if(nums[i] > 0) { n1 += 1; } } double result = ((double)n1 / n); result = round(result * 100) / 100; return result; }
int main() { int arr1[] = {0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8}; assert(func0(arr1, 13) == 0.54); int arr2[] = {2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8}; assert(func0(arr2, 13) == 0.69); int arr3[] = {2, 4, -6, -9, 11, -12, 14, -5, 17}; assert(func0(arr3, 9) == 0.56); return 0; }
O1
c
func0: endbr64 sub $0x8,%rsp test %esi,%esi jle 11e7 <func0+0x5e> mov %rdi,%rax lea -0x1(%rsi),%edx lea 0x4(%rdi,%rdx,4),%rdi mov $0x0,%edx cmpl $0x0,(%rax) setg %cl movzbl %cl,%ecx add %ecx,%edx add $0x4,%rax cmp %rdi,%rax jne 11a5 <func0+0x1c> pxor %xmm0,%xmm0 cvtsi2sd %edx,%xmm0 pxor %xmm1,%xmm1 cvtsi2sd %esi,%xmm1 divsd %xmm1,%xmm0 mulsd 0xebb(%rip),%xmm0 callq 1070 <round@plt> divsd 0xeae(%rip),%xmm0 add $0x8,%rsp retq mov $0x0,%edx jmp 11b9 <func0+0x30>
func0: endbr64 sub rsp, 8 test esi, esi jle short loc_11E7 mov rax, rdi lea edx, [rsi-1] lea rdi, [rdi+rdx*4+4] mov edx, 0 loc_11A5: cmp dword ptr [rax], 0 setnle cl movzx ecx, cl add edx, ecx add rax, 4 cmp rax, rdi jnz short loc_11A5 loc_11B9: pxor xmm0, xmm0 cvtsi2sd xmm0, edx pxor xmm1, xmm1 cvtsi2sd xmm1, esi divsd xmm0, xmm1 mulsd xmm0, cs:qword_2070 call _round divsd xmm0, cs:qword_2070 add rsp, 8 retn loc_11E7: mov edx, 0 jmp short loc_11B9
double func0(_DWORD *a1, int a2) { _DWORD *v2; // rax long long v3; // rdi int v4; // edx if ( a2 <= 0 ) { v4 = 0; } else { v2 = a1; v3 = (long long)&a1[a2 - 1 + 1]; v4 = 0; do v4 += *v2++ > 0; while ( v2 != (_DWORD *)v3 ); } return round((double)v4 / (double)a2 * 100.0) / 100.0; }
func0: ENDBR64 SUB RSP,0x8 TEST ESI,ESI JLE 0x001011e7 MOV RAX,RDI LEA EDX,[RSI + -0x1] LEA RDI,[RDI + RDX*0x4 + 0x4] MOV EDX,0x0 LAB_001011a5: CMP dword ptr [RAX],0x0 SETG CL MOVZX ECX,CL ADD EDX,ECX ADD RAX,0x4 CMP RAX,RDI JNZ 0x001011a5 LAB_001011b9: PXOR XMM0,XMM0 CVTSI2SD XMM0,EDX PXOR XMM1,XMM1 CVTSI2SD XMM1,ESI DIVSD XMM0,XMM1 MULSD XMM0,qword ptr [0x00102070] CALL 0x00101070 DIVSD XMM0,qword ptr [0x00102070] ADD RSP,0x8 RET LAB_001011e7: MOV EDX,0x0 JMP 0x001011b9
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int *param_1,int param_2) { int *piVar1; int iVar2; double dVar3; if (param_2 < 1) { iVar2 = 0; } else { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar2 = 0; do { iVar2 = iVar2 + (uint)(0 < *param_1); param_1 = param_1 + 1; } while (param_1 != piVar1); } dVar3 = round(((double)iVar2 / (double)param_2) * _DAT_00102070); return dVar3 / _DAT_00102070; }
5,662
func0
#include <stdio.h> #include <assert.h> #include <math.h>
double func0(int nums[], int n) { int n1 = 0; for(int i = 0; i < n; i++) { if(nums[i] > 0) { n1 += 1; } } double result = ((double)n1 / n); result = round(result * 100) / 100; return result; }
int main() { int arr1[] = {0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8}; assert(func0(arr1, 13) == 0.54); int arr2[] = {2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8}; assert(func0(arr2, 13) == 0.69); int arr3[] = {2, 4, -6, -9, 11, -12, 14, -5, 17}; assert(func0(arr3, 9) == 0.56); return 0; }
O2
c
func0: endbr64 sub $0x8,%rsp test %esi,%esi jle 13f8 <func0+0x68> lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rcx xor %eax,%eax nopw %cs:0x0(%rax,%rax,1) mov (%rdi),%r8d xor %edx,%edx test %r8d,%r8d setg %dl add $0x4,%rdi add %edx,%eax cmp %rdi,%rcx jne 13b0 <func0+0x20> pxor %xmm0,%xmm0 cvtsi2sd %eax,%xmm0 pxor %xmm1,%xmm1 cvtsi2sd %esi,%xmm1 divsd %xmm1,%xmm0 mulsd 0xcae(%rip),%xmm0 callq 1070 <round@plt> divsd 0xca1(%rip),%xmm0 add $0x8,%rsp retq nopl 0x0(%rax) pxor %xmm0,%xmm0 jmp 13ce <func0+0x3e> xchg %ax,%ax
func0: endbr64 sub rsp, 8 test esi, esi jle short loc_13F8 lea eax, [rsi-1] lea rcx, [rdi+rax*4+4] xor eax, eax nop word ptr [rax+rax+00000000h] loc_13B0: mov r8d, [rdi] xor edx, edx test r8d, r8d setnle dl add rdi, 4 add eax, edx cmp rcx, rdi jnz short loc_13B0 pxor xmm0, xmm0 cvtsi2sd xmm0, eax loc_13CE: pxor xmm1, xmm1 cvtsi2sd xmm1, esi divsd xmm0, xmm1 mulsd xmm0, cs:qword_2070 call _round divsd xmm0, cs:qword_2070 add rsp, 8 retn loc_13F8: pxor xmm0, xmm0 jmp short loc_13CE
double func0(_DWORD *a1, int a2) { long long v2; // rcx int v3; // eax int v4; // edx double v5; // xmm0_8 if ( a2 <= 0 ) { v5 = 0.0; } else { v2 = (long long)&a1[a2 - 1 + 1]; v3 = 0; do { v4 = *a1++ > 0; v3 += v4; } while ( (_DWORD *)v2 != a1 ); v5 = (double)v3; } return round(v5 / (double)a2 * 100.0) / 100.0; }
func0: ENDBR64 SUB RSP,0x8 TEST ESI,ESI JLE 0x001013f8 LEA EAX,[RSI + -0x1] LEA RCX,[RDI + RAX*0x4 + 0x4] XOR EAX,EAX NOP word ptr CS:[RAX + RAX*0x1] LAB_001013b0: MOV R8D,dword ptr [RDI] XOR EDX,EDX TEST R8D,R8D SETG DL ADD RDI,0x4 ADD EAX,EDX CMP RCX,RDI JNZ 0x001013b0 PXOR XMM0,XMM0 CVTSI2SD XMM0,EAX LAB_001013ce: PXOR XMM1,XMM1 CVTSI2SD XMM1,ESI DIVSD XMM0,XMM1 MULSD XMM0,qword ptr [0x00102070] CALL 0x00101070 DIVSD XMM0,qword ptr [0x00102070] ADD RSP,0x8 RET LAB_001013f8: PXOR XMM0,XMM0 JMP 0x001013ce
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int *param_1,int param_2) { int *piVar1; int iVar2; int iVar3; double dVar4; if (param_2 < 1) { dVar4 = 0.0; } else { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar3 = 0; do { iVar2 = *param_1; param_1 = param_1 + 1; iVar3 = iVar3 + (uint)(0 < iVar2); } while (piVar1 != param_1); dVar4 = (double)iVar3; } dVar4 = round((dVar4 / (double)param_2) * _DAT_00102070); return dVar4 / _DAT_00102070; }
5,663
func0
#include <stdio.h> #include <assert.h> #include <math.h>
double func0(int nums[], int n) { int n1 = 0; for(int i = 0; i < n; i++) { if(nums[i] > 0) { n1 += 1; } } double result = ((double)n1 / n); result = round(result * 100) / 100; return result; }
int main() { int arr1[] = {0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8}; assert(func0(arr1, 13) == 0.54); int arr2[] = {2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8}; assert(func0(arr2, 13) == 0.69); int arr3[] = {2, 4, -6, -9, 11, -12, 14, -5, 17}; assert(func0(arr3, 9) == 0.56); return 0; }
O3
c
func0: endbr64 sub $0x8,%rsp test %esi,%esi jle 1418 <func0+0xf8> lea -0x1(%rsi),%eax cmp $0x3,%eax jbe 141e <func0+0xfe> mov %esi,%edx pxor %xmm0,%xmm0 mov %rdi,%rax shr $0x2,%edx movdqa %xmm0,%xmm2 shl $0x4,%rdx add %rdi,%rdx nopl 0x0(%rax,%rax,1) movdqu (%rax),%xmm1 add $0x10,%rax pcmpgtd %xmm2,%xmm1 psubd %xmm1,%xmm0 cmp %rdx,%rax jne 1358 <func0+0x38> movdqa %xmm0,%xmm1 mov %esi,%edx psrldq $0x8,%xmm1 and $0xfffffffc,%edx paddd %xmm1,%xmm0 movdqa %xmm0,%xmm1 psrldq $0x4,%xmm1 paddd %xmm1,%xmm0 movd %xmm0,%eax test $0x3,%sil je 13e3 <func0+0xc3> movslq %edx,%rcx mov (%rdi,%rcx,4),%r9d test %r9d,%r9d jle 13a5 <func0+0x85> add $0x1,%eax lea 0x1(%rdx),%ecx cmp %esi,%ecx jge 13e3 <func0+0xc3> movslq %ecx,%rcx mov (%rdi,%rcx,4),%r8d test %r8d,%r8d jle 13bb <func0+0x9b> add $0x1,%eax lea 0x2(%rdx),%ecx cmp %ecx,%esi jle 13e3 <func0+0xc3> movslq %ecx,%rcx mov (%rdi,%rcx,4),%ecx test %ecx,%ecx jle 13cf <func0+0xaf> add $0x1,%eax add $0x3,%edx cmp %edx,%esi jle 13e3 <func0+0xc3> movslq %edx,%rdx mov (%rdi,%rdx,4),%edx test %edx,%edx jle 13e3 <func0+0xc3> add $0x1,%eax pxor %xmm0,%xmm0 cvtsi2sd %eax,%xmm0 pxor %xmm1,%xmm1 cvtsi2sd %esi,%xmm1 divsd %xmm1,%xmm0 mulsd 0xc91(%rip),%xmm0 callq 1070 <round@plt> divsd 0xc84(%rip),%xmm0 add $0x8,%rsp retq nopl 0x0(%rax) pxor %xmm0,%xmm0 jmp 13eb <func0+0xcb> xor %edx,%edx xor %eax,%eax jmpq 1396 <func0+0x76> nopw 0x0(%rax,%rax,1)
func0: endbr64 sub rsp, 8 test esi, esi jle loc_1410 lea eax, [rsi-1] mov rcx, rdi cmp eax, 2 jbe loc_1416 mov edx, esi pxor xmm0, xmm0 mov rax, rdi shr edx, 2 movdqa xmm2, xmm0 shl rdx, 4 add rdx, rdi nop word ptr [rax+rax+00000000h] loc_1360: movdqu xmm1, xmmword ptr [rax] add rax, 10h pcmpgtd xmm1, xmm2 psubd xmm0, xmm1 cmp rax, rdx jnz short loc_1360 movdqa xmm1, xmm0 mov edx, esi psrldq xmm1, 8 and edx, 0FFFFFFFCh paddd xmm0, xmm1 movdqa xmm1, xmm0 psrldq xmm1, 4 paddd xmm0, xmm1 movd eax, xmm0 test sil, 3 jz short loc_13DB loc_139E: movsxd rdi, edx mov r9d, [rcx+rdi*4] lea r8, ds:0[rdi*4] test r9d, r9d jle short loc_13B5 add eax, 1 loc_13B5: lea edi, [rdx+1] cmp esi, edi jle short loc_13DB mov edi, [rcx+r8+4] test edi, edi jle short loc_13C8 add eax, 1 loc_13C8: add edx, 2 cmp esi, edx jle short loc_13DB mov edx, [rcx+r8+8] test edx, edx jle short loc_13DB add eax, 1 loc_13DB: pxor xmm0, xmm0 cvtsi2sd xmm0, eax loc_13E3: pxor xmm1, xmm1 cvtsi2sd xmm1, esi divsd xmm0, xmm1 mulsd xmm0, cs:qword_2070; x call _round divsd xmm0, cs:qword_2070 add rsp, 8 retn loc_1410: pxor xmm0, xmm0 jmp short loc_13E3 loc_1416: xor edx, edx xor eax, eax jmp short loc_139E
double func0(const __m128i *a1, int a2) { __m128i v2; // xmm0 const __m128i *v3; // rax __m128i v4; // xmm1 int v5; // edx __m128i v6; // xmm0 int v7; // eax long long v8; // r8 double v9; // xmm0_8 if ( a2 <= 0 ) { v9 = 0.0; return round(v9 / (double)a2 * 100.0) / 100.0; } if ( (unsigned int)(a2 - 1) <= 2 ) { v5 = 0; v7 = 0; LABEL_6: v8 = v5; if ( a1->m128i_i32[v8] > 0 ) ++v7; if ( a2 > v5 + 1 ) { if ( a1->m128i_i32[v8 + 1] > 0 ) ++v7; if ( a2 > v5 + 2 && a1->m128i_i32[v8 + 2] > 0 ) ++v7; } goto LABEL_14; } v2 = 0LL; v3 = a1; do { v4 = _mm_loadu_si128(v3++); v2 = _mm_sub_epi32(v2, _mm_cmpgt_epi32(v4, (__m128i)0LL)); } while ( v3 != &a1[(unsigned int)a2 >> 2] ); v5 = a2 & 0x7FFFFFFC; v6 = _mm_add_epi32(v2, _mm_srli_si128(v2, 8)); v7 = _mm_cvtsi128_si32(_mm_add_epi32(v6, _mm_srli_si128(v6, 4))); if ( (a2 & 3) != 0 ) goto LABEL_6; LABEL_14: v9 = (double)v7; return round(v9 / (double)a2 * 100.0) / 100.0; }
func0: ENDBR64 SUB RSP,0x8 TEST ESI,ESI JLE 0x00101410 LEA EAX,[RSI + -0x1] MOV RCX,RDI CMP EAX,0x2 JBE 0x00101416 MOV EDX,ESI PXOR XMM0,XMM0 MOV RAX,RDI SHR EDX,0x2 MOVDQA XMM2,XMM0 SHL RDX,0x4 ADD RDX,RDI NOP word ptr CS:[RAX + RAX*0x1] LAB_00101360: MOVDQU XMM1,xmmword ptr [RAX] ADD RAX,0x10 PCMPGTD XMM1,XMM2 PSUBD XMM0,XMM1 CMP RAX,RDX JNZ 0x00101360 MOVDQA XMM1,XMM0 MOV EDX,ESI PSRLDQ XMM1,0x8 AND EDX,0xfffffffc PADDD XMM0,XMM1 MOVDQA XMM1,XMM0 PSRLDQ XMM1,0x4 PADDD XMM0,XMM1 MOVD EAX,XMM0 TEST SIL,0x3 JZ 0x001013db LAB_0010139e: MOVSXD RDI,EDX MOV R9D,dword ptr [RCX + RDI*0x4] LEA R8,[RDI*0x4] TEST R9D,R9D JLE 0x001013b5 ADD EAX,0x1 LAB_001013b5: LEA EDI,[RDX + 0x1] CMP ESI,EDI JLE 0x001013db MOV EDI,dword ptr [RCX + R8*0x1 + 0x4] TEST EDI,EDI JLE 0x001013c8 ADD EAX,0x1 LAB_001013c8: ADD EDX,0x2 CMP ESI,EDX JLE 0x001013db MOV EDX,dword ptr [RCX + R8*0x1 + 0x8] TEST EDX,EDX JLE 0x001013db ADD EAX,0x1 LAB_001013db: PXOR XMM0,XMM0 CVTSI2SD XMM0,EAX LAB_001013e3: PXOR XMM1,XMM1 CVTSI2SD XMM1,ESI DIVSD XMM0,XMM1 MULSD XMM0,qword ptr [0x00102070] CALL 0x00101070 DIVSD XMM0,qword ptr [0x00102070] ADD RSP,0x8 RET LAB_00101410: PXOR XMM0,XMM0 JMP 0x001013e3 LAB_00101416: XOR EDX,EDX XOR EAX,EAX JMP 0x0010139e
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int *param_1,uint param_2) { int iVar1; int *piVar2; int *piVar3; int *piVar4; int *piVar5; uint uVar6; int iVar7; int iVar9; double dVar8; int iVar10; int iVar11; if ((int)param_2 < 1) { dVar8 = 0.0; goto LAB_001013e3; } if (param_2 - 1 < 3) { uVar6 = 0; iVar7 = 0; LAB_0010139e: if (0 < param_1[(int)uVar6]) { iVar7 = iVar7 + 1; } if ((int)(uVar6 + 1) < (int)param_2) { if (0 < param_1[(long)(int)uVar6 + 1]) { iVar7 = iVar7 + 1; } if (((int)(uVar6 + 2) < (int)param_2) && (0 < param_1[(long)(int)uVar6 + 2])) { iVar7 = iVar7 + 1; } } } else { iVar7 = 0; iVar9 = 0; iVar10 = 0; iVar11 = 0; piVar5 = param_1; do { iVar1 = *piVar5; piVar2 = piVar5 + 1; piVar3 = piVar5 + 2; piVar4 = piVar5 + 3; piVar5 = piVar5 + 4; iVar7 = iVar7 + (uint)(0 < iVar1); iVar9 = iVar9 + (uint)(0 < *piVar2); iVar10 = iVar10 + (uint)(0 < *piVar3); iVar11 = iVar11 + (uint)(0 < *piVar4); } while (piVar5 != param_1 + (ulong)(param_2 >> 2) * 4); uVar6 = param_2 & 0xfffffffc; iVar7 = iVar7 + iVar10 + iVar9 + iVar11; if ((param_2 & 3) != 0) goto LAB_0010139e; } dVar8 = (double)iVar7; LAB_001013e3: dVar8 = round((dVar8 / (double)(int)param_2) * _DAT_00102070); return dVar8 / _DAT_00102070; }
5,664
func0
#include <assert.h>
int func0(int list1[], int size) { int max = list1[0]; for (int i = 0; i < size; i++) { if (list1[i] < max) { max = list1[i]; } } return max; }
int main() { int arr1[] = {1, 2, 3, -4, -6}; int arr2[] = {1, 2, 3, -8, -9}; int arr3[] = {1, 2, 3, 4, -1}; assert(func0(arr1, 5) == -6); assert(func0(arr2, 5) == -9); assert(func0(arr3, 5) == -1); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov -0x18(%rbp),%rax mov (%rax),%eax mov %eax,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 11c2 <func0+0x59> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax cmp %eax,-0x8(%rbp) jle 11be <func0+0x55> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov %eax,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 118a <func0+0x21> mov -0x8(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov rax, [rbp+var_18] mov eax, [rax] mov [rbp+var_8], eax mov [rbp+var_4], 0 jmp short loc_11C2 loc_118A: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] cmp [rbp+var_8], eax jle short loc_11BE mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] mov [rbp+var_8], eax loc_11BE: add [rbp+var_4], 1 loc_11C2: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_118A mov eax, [rbp+var_8] pop rbp retn
long long func0(unsigned int *a1, int a2) { unsigned int v3; // [rsp+14h] [rbp-8h] int i; // [rsp+18h] [rbp-4h] v3 = *a1; for ( i = 0; i < a2; ++i ) { if ( (int)v3 > (int)a1[i] ) v3 = a1[i]; } return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV RAX,qword ptr [RBP + -0x18] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x8],EAX MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011c2 LAB_0010118a: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x8],EAX JLE 0x001011be MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x8],EAX LAB_001011be: ADD dword ptr [RBP + -0x4],0x1 LAB_001011c2: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x0010118a MOV EAX,dword ptr [RBP + -0x8] POP RBP RET
int func0(int *param_1,int param_2) { int local_10; int local_c; local_10 = *param_1; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { if (param_1[local_c] < local_10) { local_10 = param_1[local_c]; } } return local_10; }
5,665
func0
#include <assert.h>
int func0(int list1[], int size) { int max = list1[0]; for (int i = 0; i < size; i++) { if (list1[i] < max) { max = list1[i]; } } return max; }
int main() { int arr1[] = {1, 2, 3, -4, -6}; int arr2[] = {1, 2, 3, -8, -9}; int arr3[] = {1, 2, 3, 4, -1}; assert(func0(arr1, 5) == -6); assert(func0(arr2, 5) == -9); assert(func0(arr3, 5) == -1); return 0; }
O1
c
func0: endbr64 mov (%rdi),%edx test %esi,%esi jle 118e <func0+0x25> mov %rdi,%rax lea -0x1(%rsi),%ecx lea 0x4(%rdi,%rcx,4),%rsi mov (%rax),%ecx cmp %ecx,%edx cmovg %ecx,%edx add $0x4,%rax cmp %rsi,%rax jne 117e <func0+0x15> mov %edx,%eax retq
func0: endbr64 mov edx, [rdi] test esi, esi jle short loc_118E mov rax, rdi lea ecx, [rsi-1] lea rsi, [rdi+rcx*4+4] loc_117E: mov ecx, [rax] cmp edx, ecx cmovg edx, ecx add rax, 4 cmp rax, rsi jnz short loc_117E loc_118E: mov eax, edx retn
long long func0(unsigned int *a1, int a2) { unsigned int v2; // edx unsigned int *v3; // rax long long v4; // rsi v2 = *a1; if ( a2 > 0 ) { v3 = a1; v4 = (long long)&a1[a2 - 1 + 1]; do { if ( (int)v2 > (int)*v3 ) v2 = *v3; ++v3; } while ( v3 != (unsigned int *)v4 ); } return v2; }
func0: ENDBR64 MOV EDX,dword ptr [RDI] TEST ESI,ESI JLE 0x0010118e MOV RAX,RDI LEA ECX,[RSI + -0x1] LEA RSI,[RDI + RCX*0x4 + 0x4] LAB_0010117e: MOV ECX,dword ptr [RAX] CMP EDX,ECX CMOVG EDX,ECX ADD RAX,0x4 CMP RAX,RSI JNZ 0x0010117e LAB_0010118e: MOV EAX,EDX RET
int func0(int *param_1,int param_2) { int *piVar1; int iVar2; iVar2 = *param_1; if (0 < param_2) { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if (*param_1 < iVar2) { iVar2 = *param_1; } param_1 = param_1 + 1; } while (param_1 != piVar1); } return iVar2; }
5,666
func0
#include <assert.h>
int func0(int list1[], int size) { int max = list1[0]; for (int i = 0; i < size; i++) { if (list1[i] < max) { max = list1[i]; } } return max; }
int main() { int arr1[] = {1, 2, 3, -4, -6}; int arr2[] = {1, 2, 3, -8, -9}; int arr3[] = {1, 2, 3, 4, -1}; assert(func0(arr1, 5) == -6); assert(func0(arr2, 5) == -9); assert(func0(arr3, 5) == -1); return 0; }
O2
c
func0: endbr64 mov (%rdi),%eax test %esi,%esi jle 1170 <func0+0x30> lea -0x1(%rsi),%edx add $0x4,%rdi lea (%rdi,%rdx,4),%rcx mov %eax,%edx jmp 1166 <func0+0x26> nopl 0x0(%rax) mov (%rdi),%edx add $0x4,%rdi cmp %edx,%eax cmovg %edx,%eax cmp %rcx,%rdi jne 1160 <func0+0x20> retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 mov eax, [rdi] test esi, esi jle short locret_1170 lea edx, [rsi-1] add rdi, 4 lea rcx, [rdi+rdx*4] mov edx, eax jmp short loc_1166 loc_1160: mov edx, [rdi] add rdi, 4 loc_1166: cmp eax, edx cmovg eax, edx cmp rdi, rcx jnz short loc_1160 locret_1170: retn
long long func0(unsigned int *a1, int a2) { long long result; // rax int *v3; // rdi int *v4; // rcx int i; // edx result = *a1; if ( a2 > 0 ) { v3 = (int *)(a1 + 1); v4 = &v3[a2 - 1]; for ( i = result; ; i = *v3++ ) { if ( (int)result > i ) result = (unsigned int)i; if ( v3 == v4 ) break; } } return result; }
func0: ENDBR64 MOV EAX,dword ptr [RDI] TEST ESI,ESI JLE 0x00101170 LEA EDX,[RSI + -0x1] ADD RDI,0x4 LEA RCX,[RDI + RDX*0x4] MOV EDX,EAX JMP 0x00101166 LAB_00101160: MOV EDX,dword ptr [RDI] ADD RDI,0x4 LAB_00101166: CMP EAX,EDX CMOVG EAX,EDX CMP RDI,RCX JNZ 0x00101160 LAB_00101170: RET
void func0(int *param_1,int param_2) { int *piVar1; int iVar2; int iVar3; iVar2 = *param_1; if (0 < param_2) { param_1 = param_1 + 1; piVar1 = param_1 + (param_2 - 1); iVar3 = iVar2; while( true ) { if (iVar3 < iVar2) { iVar2 = iVar3; } if (param_1 == piVar1) break; iVar3 = *param_1; param_1 = param_1 + 1; } } return; }
5,667
func0
#include <assert.h>
int func0(int list1[], int size) { int max = list1[0]; for (int i = 0; i < size; i++) { if (list1[i] < max) { max = list1[i]; } } return max; }
int main() { int arr1[] = {1, 2, 3, -4, -6}; int arr2[] = {1, 2, 3, -8, -9}; int arr3[] = {1, 2, 3, 4, -1}; assert(func0(arr1, 5) == -6); assert(func0(arr2, 5) == -9); assert(func0(arr3, 5) == -1); return 0; }
O3
c
func0: endbr64 mov (%rdi),%eax test %esi,%esi jle 1211 <func0+0xd1> lea -0x1(%rsi),%edx cmp $0x2,%edx jbe 1219 <func0+0xd9> mov %esi,%edx movd %eax,%xmm4 mov %rdi,%rax shr $0x2,%edx pshufd $0x0,%xmm4,%xmm0 shl $0x4,%rdx add %rdi,%rdx nopw 0x0(%rax,%rax,1) movdqu (%rax),%xmm1 movdqu (%rax),%xmm3 add $0x10,%rax pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm0 pandn %xmm3,%xmm1 por %xmm1,%xmm0 cmp %rdx,%rax jne 1178 <func0+0x38> movdqa %xmm0,%xmm2 mov %esi,%edx psrldq $0x8,%xmm2 and $0xfffffffc,%edx movdqa %xmm2,%xmm1 pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm0 pandn %xmm2,%xmm1 por %xmm1,%xmm0 movdqa %xmm0,%xmm2 psrldq $0x4,%xmm2 movdqa %xmm2,%xmm1 pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm0 pandn %xmm2,%xmm1 por %xmm0,%xmm1 movd %xmm1,%eax test $0x3,%sil je 1218 <func0+0xd8> movslq %edx,%rcx mov (%rdi,%rcx,4),%ecx cmp %ecx,%eax cmovg %ecx,%eax lea 0x1(%rdx),%ecx cmp %ecx,%esi jle 1211 <func0+0xd1> movslq %ecx,%rcx mov (%rdi,%rcx,4),%ecx cmp %ecx,%eax cmovg %ecx,%eax add $0x2,%edx cmp %edx,%esi jle 1211 <func0+0xd1> movslq %edx,%rdx mov (%rdi,%rdx,4),%edx cmp %edx,%eax cmovg %edx,%eax retq nopw 0x0(%rax,%rax,1) retq xor %edx,%edx jmp 11e2 <func0+0xa2> nopl (%rax)
func0: endbr64 mov eax, [rdi] mov ecx, esi test esi, esi jle locret_1216 lea edx, [rsi-1] cmp edx, 2 jbe loc_1221 mov edx, esi movd xmm4, eax mov rax, rdi shr edx, 2 pshufd xmm0, xmm4, 0 shl rdx, 4 add rdx, rdi nop dword ptr [rax+00h] loc_1178: movdqu xmm1, xmmword ptr [rax] movdqu xmm3, xmmword ptr [rax] add rax, 10h pcmpgtd xmm1, xmm0 pand xmm0, xmm1 pandn xmm1, xmm3 por xmm0, xmm1 cmp rax, rdx jnz short loc_1178 movdqa xmm2, xmm0 mov edx, ecx psrldq xmm2, 8 and edx, 0FFFFFFFCh movdqa xmm1, xmm2 pcmpgtd xmm1, xmm0 pand xmm0, xmm1 pandn xmm1, xmm2 por xmm0, xmm1 movdqa xmm2, xmm0 psrldq xmm2, 4 movdqa xmm1, xmm2 pcmpgtd xmm1, xmm0 pand xmm0, xmm1 pandn xmm1, xmm2 por xmm1, xmm0 movd eax, xmm1 test cl, 3 jz short locret_1220 loc_11E1: movsxd rsi, edx lea r8, ds:0[rsi*4] mov esi, [rdi+rsi*4] cmp eax, esi cmovg eax, esi lea esi, [rdx+1] cmp ecx, esi jle short locret_1216 mov esi, [rdi+r8+4] cmp eax, esi cmovg eax, esi add edx, 2 cmp ecx, edx jle short locret_1216 mov edx, [rdi+r8+8] cmp eax, edx cmovg eax, edx locret_1216: retn locret_1220: retn loc_1221: xor edx, edx jmp short loc_11E1
long long func0(const __m128i *a1, int a2) { long long result; // rax __m128i v4; // xmm4 const __m128i *v5; // rax __m128i v6; // xmm0 __m128i v7; // xmm1 __m128i v8; // xmm3 __m128i v9; // xmm1 __m128i v10; // xmm2 signed int v11; // edx __m128i v12; // xmm1 __m128i v13; // xmm0 __m128i v14; // xmm2 __m128i v15; // xmm1 long long v16; // r8 int v17; // esi int v18; // esi int v19; // edx result = a1->m128i_u32[0]; if ( a2 > 0 ) { if ( (unsigned int)(a2 - 1) <= 2 ) { v11 = 0; } else { v4 = _mm_cvtsi32_si128(result); v5 = a1; v6 = _mm_shuffle_epi32(v4, 0); do { v7 = _mm_loadu_si128(v5); v8 = v7; ++v5; v9 = _mm_cmpgt_epi32(v7, v6); v6 = _mm_or_si128(_mm_and_si128(v6, v9), _mm_andnot_si128(v9, v8)); } while ( v5 != &a1[(unsigned int)a2 >> 2] ); v10 = _mm_srli_si128(v6, 8); v11 = a2 & 0xFFFFFFFC; v12 = _mm_cmpgt_epi32(v10, v6); v13 = _mm_or_si128(_mm_and_si128(v6, v12), _mm_andnot_si128(v12, v10)); v14 = _mm_srli_si128(v13, 4); v15 = _mm_cmpgt_epi32(v14, v13); result = (unsigned int)_mm_cvtsi128_si32(_mm_or_si128(_mm_andnot_si128(v15, v14), _mm_and_si128(v13, v15))); if ( (a2 & 3) == 0 ) return result; } v16 = v11; v17 = a1->m128i_i32[v16]; if ( (int)result > v17 ) result = (unsigned int)v17; if ( a2 > v11 + 1 ) { v18 = a1->m128i_i32[v16 + 1]; if ( (int)result > v18 ) result = (unsigned int)v18; if ( a2 > v11 + 2 ) { v19 = a1->m128i_i32[v16 + 2]; if ( (int)result > v19 ) return (unsigned int)v19; } } } return result; }
func0: ENDBR64 MOV EAX,dword ptr [RDI] MOV ECX,ESI TEST ESI,ESI JLE 0x00101216 LEA EDX,[RSI + -0x1] CMP EDX,0x2 JBE 0x00101221 MOV EDX,ESI MOVD XMM4,EAX MOV RAX,RDI SHR EDX,0x2 PSHUFD XMM0,XMM4,0x0 SHL RDX,0x4 ADD RDX,RDI NOP dword ptr [RAX] LAB_00101178: MOVDQU XMM1,xmmword ptr [RAX] MOVDQU XMM3,xmmword ptr [RAX] ADD RAX,0x10 PCMPGTD XMM1,XMM0 PAND XMM0,XMM1 PANDN XMM1,XMM3 POR XMM0,XMM1 CMP RAX,RDX JNZ 0x00101178 MOVDQA XMM2,XMM0 MOV EDX,ECX PSRLDQ XMM2,0x8 AND EDX,0xfffffffc MOVDQA XMM1,XMM2 PCMPGTD XMM1,XMM0 PAND XMM0,XMM1 PANDN XMM1,XMM2 POR XMM0,XMM1 MOVDQA XMM2,XMM0 PSRLDQ XMM2,0x4 MOVDQA XMM1,XMM2 PCMPGTD XMM1,XMM0 PAND XMM0,XMM1 PANDN XMM1,XMM2 POR XMM1,XMM0 MOVD EAX,XMM1 TEST CL,0x3 JZ 0x00101220 LAB_001011e1: MOVSXD RSI,EDX LEA R8,[RSI*0x4] MOV ESI,dword ptr [RDI + RSI*0x4] CMP EAX,ESI CMOVG EAX,ESI LEA ESI,[RDX + 0x1] CMP ECX,ESI JLE 0x00101216 MOV ESI,dword ptr [RDI + R8*0x1 + 0x4] CMP EAX,ESI CMOVG EAX,ESI ADD EDX,0x2 CMP ECX,EDX JLE 0x00101216 MOV EDX,dword ptr [RDI + R8*0x1 + 0x8] CMP EAX,EDX CMOVG EAX,EDX LAB_00101216: RET LAB_00101220: RET LAB_00101221: XOR EDX,EDX JMP 0x001011e1
uint func0(uint *param_1,uint param_2) { uint *puVar1; uint *puVar2; uint *puVar3; uint uVar4; uint *puVar5; uint *puVar6; uint *puVar7; uint uVar8; uint *puVar9; uint uVar10; uint uVar11; uint uVar12; uint uVar13; uVar8 = *param_1; if (0 < (int)param_2) { if (param_2 - 1 < 3) { uVar10 = 0; } else { puVar9 = param_1; uVar11 = uVar8; uVar13 = uVar8; uVar12 = uVar8; do { uVar10 = *puVar9; puVar1 = puVar9 + 1; puVar2 = puVar9 + 2; puVar3 = puVar9 + 3; uVar4 = *puVar9; puVar5 = puVar9 + 1; puVar6 = puVar9 + 2; puVar7 = puVar9 + 3; puVar9 = puVar9 + 4; uVar8 = uVar8 & -(uint)((int)uVar8 < (int)uVar10) | ~-(uint)((int)uVar8 < (int)uVar10) & uVar4; uVar11 = uVar11 & -(uint)((int)uVar11 < (int)*puVar1) | ~-(uint)((int)uVar11 < (int)*puVar1) & *puVar5; uVar13 = uVar13 & -(uint)((int)uVar13 < (int)*puVar2) | ~-(uint)((int)uVar13 < (int)*puVar2) & *puVar6; uVar12 = uVar12 & -(uint)((int)uVar12 < (int)*puVar3) | ~-(uint)((int)uVar12 < (int)*puVar3) & *puVar7; } while (puVar9 != param_1 + (ulong)(param_2 >> 2) * 4); uVar10 = param_2 & 0xfffffffc; uVar8 = uVar8 & -(uint)((int)uVar8 < (int)uVar13) | ~-(uint)((int)uVar8 < (int)uVar13) & uVar13; uVar11 = uVar11 & -(uint)((int)uVar11 < (int)uVar12) | ~-(uint)((int)uVar11 < (int)uVar12) & uVar12; uVar13 = -(uint)((int)uVar8 < (int)uVar11); uVar8 = ~uVar13 & uVar11 | uVar8 & uVar13; if ((param_2 & 3) == 0) { return uVar8; } } if ((int)param_1[(int)uVar10] < (int)uVar8) { uVar8 = param_1[(int)uVar10]; } if ((int)(uVar10 + 1) < (int)param_2) { if ((int)param_1[(long)(int)uVar10 + 1] < (int)uVar8) { uVar8 = param_1[(long)(int)uVar10 + 1]; } if (((int)(uVar10 + 2) < (int)param_2) && ((int)param_1[(long)(int)uVar10 + 2] < (int)uVar8)) { uVar8 = param_1[(long)(int)uVar10 + 2]; } } } return uVar8; }
5,668
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h>
char* func0(int test_list[][5], int rows, int K, int N) { char* result = (char*)malloc(1000 * sizeof(char)); // Allocate ample memory for the output strcpy(result, ""); // Initialize result string strcat(result, "["); for (int i = 0; i < rows; i++) { // N is the number of elements in each tuple, // i.e. every tuple in test_list has a fixed size of 5 in provided examples strcat(result, "("); for (int j = K; j < N - K; j++) { char num_str[10]; sprintf(num_str, "%d", test_list[i][j]); strcat(result, num_str); if (j < N - K - 1) strcat(result, ", "); } strcat(result, ")"); if (i < rows - 1) strcat(result, ", "); } strcat(result, "]"); return result; }
int main() { int list1[4][5] = {{5, 3, 2, 1, 4}, {3, 4, 9, 2, 1}, {9, 1, 2, 3, 5}, {4, 8, 2, 1, 7}}; int list2[4][5] = {{7, 8, 4, 9}, {11, 8, 12, 4}, {4, 1, 7, 8}, {3, 6, 9, 7}}; char* res1 = func0(list1, 4, 2, 5); char* res2 = func0(list1, 4, 1, 5); char* res3 = func0(list2, 4, 1, 4); assert(strcmp(res1, "[(2), (9), (2), (2)]") == 0); assert(strcmp(res2, "[(3, 2, 1), (4, 9, 2), (1, 2, 3), (8, 2, 1)]") == 0); assert(strcmp(res3, "[(8, 4), (8, 12), (1, 7), (6, 9)]") == 0); free(res1); free(res2); free(res3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x50,%rsp mov %rdi,-0x38(%rbp) mov %esi,-0x3c(%rbp) mov %edx,-0x40(%rbp) mov %ecx,-0x44(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax mov $0x3e8,%edi callq 10f0 <malloc@plt> mov %rax,-0x20(%rbp) mov -0x20(%rbp),%rax movb $0x0,(%rax) mov -0x20(%rbp),%rax mov $0xffffffffffffffff,%rcx mov %rax,%rdx mov $0x0,%eax mov %rdx,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rax),%rdx mov -0x20(%rbp),%rax add %rdx,%rax movw $0x5b,(%rax) movl $0x0,-0x28(%rbp) jmpq 13cc <func0+0x1c3> mov -0x20(%rbp),%rax mov $0xffffffffffffffff,%rcx mov %rax,%rdx mov $0x0,%eax mov %rdx,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rax),%rdx mov -0x20(%rbp),%rax add %rdx,%rax movw $0x28,(%rax) mov -0x40(%rbp),%eax mov %eax,-0x24(%rbp) jmpq 134e <func0+0x145> mov -0x28(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax shl $0x2,%rax mov %rax,%rdx mov -0x38(%rbp),%rax add %rax,%rdx mov -0x24(%rbp),%eax cltq mov (%rdx,%rax,4),%edx lea -0x12(%rbp),%rax lea 0xd1e(%rip),%rsi mov %rax,%rdi mov $0x0,%eax callq 1110 <sprintf@plt> lea -0x12(%rbp),%rdx mov -0x20(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1100 <strcat@plt> mov -0x44(%rbp),%eax sub -0x40(%rbp),%eax sub $0x1,%eax cmp %eax,-0x24(%rbp) jge 134a <func0+0x141> mov -0x20(%rbp),%rax mov $0xffffffffffffffff,%rcx mov %rax,%rdx mov $0x0,%eax mov %rdx,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rax),%rdx mov -0x20(%rbp),%rax add %rdx,%rax movw $0x202c,(%rax) movb $0x0,0x2(%rax) addl $0x1,-0x24(%rbp) mov -0x44(%rbp),%eax sub -0x40(%rbp),%eax cmp %eax,-0x24(%rbp) jl 12b9 <func0+0xb0> mov -0x20(%rbp),%rax mov $0xffffffffffffffff,%rcx mov %rax,%rdx mov $0x0,%eax mov %rdx,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rax),%rdx mov -0x20(%rbp),%rax add %rdx,%rax movw $0x29,(%rax) mov -0x3c(%rbp),%eax sub $0x1,%eax cmp %eax,-0x28(%rbp) jge 13c8 <func0+0x1bf> mov -0x20(%rbp),%rax mov $0xffffffffffffffff,%rcx mov %rax,%rdx mov $0x0,%eax mov %rdx,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rax),%rdx mov -0x20(%rbp),%rax add %rdx,%rax movw $0x202c,(%rax) movb $0x0,0x2(%rax) addl $0x1,-0x28(%rbp) mov -0x28(%rbp),%eax cmp -0x3c(%rbp),%eax jl 1280 <func0+0x77> mov -0x20(%rbp),%rax mov $0xffffffffffffffff,%rcx mov %rax,%rdx mov $0x0,%eax mov %rdx,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rax),%rdx mov -0x20(%rbp),%rax add %rdx,%rax movw $0x5d,(%rax) mov -0x20(%rbp),%rax mov -0x8(%rbp),%rsi xor %fs:0x28,%rsi je 141e <func0+0x215> callq 10c0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 50h mov [rbp+var_38], rdi mov [rbp+var_3C], esi mov [rbp+var_40], edx mov [rbp+var_44], ecx mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov edi, 3E8h; size call _malloc mov [rbp+s], rax mov rax, [rbp+s] mov byte ptr [rax], 0 mov rax, [rbp+s] mov rdi, rax; s call _strlen mov rdx, rax mov rax, [rbp+s] add rax, rdx mov word ptr [rax], 5Bh ; '[' mov [rbp+var_28], 0 jmp loc_1390 loc_128D: mov rax, [rbp+s] mov rdi, rax; s call _strlen mov rdx, rax mov rax, [rbp+s] add rax, rdx mov word ptr [rax], 28h ; '(' mov eax, [rbp+var_40] mov [rbp+var_24], eax jmp loc_1338 loc_12B3: mov eax, [rbp+var_28] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx shl rax, 2 mov rdx, rax mov rax, [rbp+var_38] add rdx, rax mov eax, [rbp+var_24] cdqe mov edx, [rdx+rax*4] lea rax, [rbp+src] lea rcx, format; "%d" mov rsi, rcx; format mov rdi, rax; s mov eax, 0 call _sprintf lea rdx, [rbp+src] mov rax, [rbp+s] mov rsi, rdx; src mov rdi, rax; dest call _strcat mov eax, [rbp+var_44] sub eax, [rbp+var_40] sub eax, 1 cmp [rbp+var_24], eax jge short loc_1334 mov rax, [rbp+s] mov rdi, rax; s call _strlen mov rdx, rax mov rax, [rbp+s] add rax, rdx mov word ptr [rax], 202Ch mov byte ptr [rax+2], 0 loc_1334: add [rbp+var_24], 1 loc_1338: mov eax, [rbp+var_44] sub eax, [rbp+var_40] cmp [rbp+var_24], eax jl loc_12B3 mov rax, [rbp+s] mov rdi, rax; s call _strlen mov rdx, rax mov rax, [rbp+s] add rax, rdx mov word ptr [rax], 29h ; ')' mov eax, [rbp+var_3C] sub eax, 1 cmp [rbp+var_28], eax jge short loc_138C mov rax, [rbp+s] mov rdi, rax; s call _strlen mov rdx, rax mov rax, [rbp+s] add rax, rdx mov word ptr [rax], 202Ch mov byte ptr [rax+2], 0 loc_138C: add [rbp+var_28], 1 loc_1390: mov eax, [rbp+var_28] cmp eax, [rbp+var_3C] jl loc_128D mov rax, [rbp+s] mov rdi, rax; s call _strlen mov rdx, rax mov rax, [rbp+s] add rax, rdx mov word ptr [rax], 5Dh ; ']' mov rax, [rbp+s] mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_13CF call ___stack_chk_fail locret_13CF: leave retn
char * func0(long long a1, int a2, int a3, int a4) { int i; // [rsp+28h] [rbp-28h] int j; // [rsp+2Ch] [rbp-24h] char *s; // [rsp+30h] [rbp-20h] char src[10]; // [rsp+3Eh] [rbp-12h] BYREF unsigned long long v11; // [rsp+48h] [rbp-8h] v11 = __readfsqword(0x28u); s = (char *)malloc(0x3E8uLL); *s = 0; *(_WORD *)&s[strlen(s)] = 91; for ( i = 0; i < a2; ++i ) { *(_WORD *)&s[strlen(s)] = 40; for ( j = a3; j < a4 - a3; ++j ) { sprintf(src, "%d", *(_DWORD *)(a1 + 20LL * i + 4LL * j)); strcat(s, src); if ( j < a4 - a3 - 1 ) strcpy(&s[strlen(s)], ", "); } *(_WORD *)&s[strlen(s)] = 41; if ( i < a2 - 1 ) strcpy(&s[strlen(s)], ", "); } *(_WORD *)&s[strlen(s)] = 93; return s; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x50 MOV qword ptr [RBP + -0x38],RDI MOV dword ptr [RBP + -0x3c],ESI MOV dword ptr [RBP + -0x40],EDX MOV dword ptr [RBP + -0x44],ECX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV EDI,0x3e8 CALL 0x00101110 MOV qword ptr [RBP + -0x20],RAX MOV RAX,qword ptr [RBP + -0x20] MOV byte ptr [RAX],0x0 MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x001010d0 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV word ptr [RAX],0x5b MOV dword ptr [RBP + -0x28],0x0 JMP 0x00101390 LAB_0010128d: MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x001010d0 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV word ptr [RAX],0x28 MOV EAX,dword ptr [RBP + -0x40] MOV dword ptr [RBP + -0x24],EAX JMP 0x00101338 LAB_001012b3: MOV EAX,dword ptr [RBP + -0x28] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX SHL RAX,0x2 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x38] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x24] CDQE MOV EDX,dword ptr [RDX + RAX*0x4] LEA RAX,[RBP + -0x12] LEA RCX,[0x102008] MOV RSI,RCX MOV RDI,RAX MOV EAX,0x0 CALL 0x00101130 LEA RDX,[RBP + -0x12] MOV RAX,qword ptr [RBP + -0x20] MOV RSI,RDX MOV RDI,RAX CALL 0x00101120 MOV EAX,dword ptr [RBP + -0x44] SUB EAX,dword ptr [RBP + -0x40] SUB EAX,0x1 CMP dword ptr [RBP + -0x24],EAX JGE 0x00101334 MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x001010d0 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV word ptr [RAX],0x202c MOV byte ptr [RAX + 0x2],0x0 LAB_00101334: ADD dword ptr [RBP + -0x24],0x1 LAB_00101338: MOV EAX,dword ptr [RBP + -0x44] SUB EAX,dword ptr [RBP + -0x40] CMP dword ptr [RBP + -0x24],EAX JL 0x001012b3 MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x001010d0 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV word ptr [RAX],0x29 MOV EAX,dword ptr [RBP + -0x3c] SUB EAX,0x1 CMP dword ptr [RBP + -0x28],EAX JGE 0x0010138c MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x001010d0 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV word ptr [RAX],0x202c MOV byte ptr [RAX + 0x2],0x0 LAB_0010138c: ADD dword ptr [RBP + -0x28],0x1 LAB_00101390: MOV EAX,dword ptr [RBP + -0x28] CMP EAX,dword ptr [RBP + -0x3c] JL 0x0010128d MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x001010d0 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV word ptr [RAX],0x5d MOV RAX,qword ptr [RBP + -0x20] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001013cf CALL 0x001010e0 LAB_001013cf: LEAVE RET
char * func0(long param_1,int param_2,int param_3,int param_4) { char *__s; size_t sVar1; char *pcVar2; long in_FS_OFFSET; int local_30; int local_2c; char local_1a [10]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); __s = (char *)malloc(1000); *__s = '\0'; sVar1 = strlen(__s); (__s + sVar1)[0] = '['; (__s + sVar1)[1] = '\0'; for (local_30 = 0; local_30 < param_2; local_30 = local_30 + 1) { sVar1 = strlen(__s); (__s + sVar1)[0] = '('; (__s + sVar1)[1] = '\0'; for (local_2c = param_3; local_2c < param_4 - param_3; local_2c = local_2c + 1) { sprintf(local_1a,"%d",(ulong)*(uint *)((long)local_30 * 0x14 + param_1 + (long)local_2c * 4)); strcat(__s,local_1a); if (local_2c < (param_4 - param_3) + -1) { sVar1 = strlen(__s); pcVar2 = __s + sVar1; pcVar2[0] = ','; pcVar2[1] = ' '; pcVar2[2] = '\0'; } } sVar1 = strlen(__s); (__s + sVar1)[0] = ')'; (__s + sVar1)[1] = '\0'; if (local_30 < param_2 + -1) { sVar1 = strlen(__s); pcVar2 = __s + sVar1; pcVar2[0] = ','; pcVar2[1] = ' '; pcVar2[2] = '\0'; } } sVar1 = strlen(__s); (__s + sVar1)[0] = ']'; (__s + sVar1)[1] = '\0'; if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return __s; }
5,669
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h>
char* func0(int test_list[][5], int rows, int K, int N) { char* result = (char*)malloc(1000 * sizeof(char)); // Allocate ample memory for the output strcpy(result, ""); // Initialize result string strcat(result, "["); for (int i = 0; i < rows; i++) { // N is the number of elements in each tuple, // i.e. every tuple in test_list has a fixed size of 5 in provided examples strcat(result, "("); for (int j = K; j < N - K; j++) { char num_str[10]; sprintf(num_str, "%d", test_list[i][j]); strcat(result, num_str); if (j < N - K - 1) strcat(result, ", "); } strcat(result, ")"); if (i < rows - 1) strcat(result, ", "); } strcat(result, "]"); return result; }
int main() { int list1[4][5] = {{5, 3, 2, 1, 4}, {3, 4, 9, 2, 1}, {9, 1, 2, 3, 5}, {4, 8, 2, 1, 7}}; int list2[4][5] = {{7, 8, 4, 9}, {11, 8, 12, 4}, {4, 1, 7, 8}, {3, 6, 9, 7}}; char* res1 = func0(list1, 4, 2, 5); char* res2 = func0(list1, 4, 1, 5); char* res3 = func0(list2, 4, 1, 4); assert(strcmp(res1, "[(2), (9), (2), (2)]") == 0); assert(strcmp(res2, "[(3, 2, 1), (4, 9, 2), (1, 2, 3), (8, 2, 1)]") == 0); assert(strcmp(res3, "[(8, 4), (8, 12), (1, 7), (6, 9)]") == 0); free(res1); free(res2); free(res3); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x38,%rsp mov %rdi,%rbx mov %esi,%r15d mov %esi,0x8(%rsp) mov %edx,%r14d mov %edx,0xc(%rsp) mov %ecx,%ebp mov %fs:0x28,%rax mov %rax,0x28(%rsp) xor %eax,%eax mov $0x3e8,%edi callq 10e0 <malloc@plt> mov %rax,%r13 movb $0x0,(%rax) mov $0x3e8,%edx lea 0xdca(%rip),%rsi mov %rax,%rdi callq 10a0 <__strcat_chk@plt> test %r15d,%r15d jle 1327 <func0+0x13e> mov %rbx,(%rsp) mov $0x0,%r15d sub %r14d,%ebp jmpq 12e4 <func0+0xfb> mov $0x3e8,%edx lea 0xda2(%rip),%rsi mov %r13,%rdi callq 10a0 <__strcat_chk@plt> add $0x1,%rbx cmp %ebx,%ebp jle 12b4 <func0+0xcb> mov (%r14,%rbx,4),%r8d lea 0xd84(%rip),%rcx mov $0xa,%edx mov $0x1,%esi mov %r12,%rdi mov $0x0,%eax callq 10f0 <__sprintf_chk@plt> mov $0x3e8,%edx mov %r12,%rsi mov %r13,%rdi callq 10a0 <__strcat_chk@plt> lea -0x1(%rbp),%eax cmp %ebx,%eax jle 1271 <func0+0x88> jmp 125d <func0+0x74> mov $0x3e8,%edx lea 0xd4e(%rip),%rsi mov %r13,%rdi callq 10a0 <__strcat_chk@plt> mov 0x8(%rsp),%eax sub $0x1,%eax cmp %r15d,%eax jg 1311 <func0+0x128> add $0x1,%r15d addq $0x14,(%rsp) cmp %r15d,0x8(%rsp) je 1327 <func0+0x13e> mov $0x3e8,%edx lea 0xd16(%rip),%rsi mov %r13,%rdi callq 10a0 <__strcat_chk@plt> mov 0xc(%rsp),%eax cmp %ebp,%eax jge 12b4 <func0+0xcb> mov (%rsp),%r14 movslq %eax,%rbx lea 0x1e(%rsp),%r12 jmpq 1279 <func0+0x90> mov $0x3e8,%edx lea 0xcee(%rip),%rsi mov %r13,%rdi callq 10a0 <__strcat_chk@plt> jmp 12d4 <func0+0xeb> mov $0x3e8,%edx lea 0xcf0(%rip),%rsi mov %r13,%rdi callq 10a0 <__strcat_chk@plt> mov 0x28(%rsp),%rax xor %fs:0x28,%rax jne 135d <func0+0x174> mov %r13,%rax add $0x38,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 10c0 <__stack_chk_fail@plt>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 48h mov rbx, rdi mov r14d, esi mov [rsp+78h+var_6C], esi mov [rsp+78h+var_60], edx mov [rsp+78h+var_5C], ecx mov rax, fs:28h mov [rsp+78h+var_40], rax xor eax, eax mov edi, 3E8h call _malloc mov r12, rax mov byte ptr [rax], 0 mov edx, 3E8h lea rsi, unk_2004 mov rdi, rax call ___strcat_chk test r14d, r14d jle loc_1359 mov [rsp+78h+var_68], rbx mov [rsp+78h+var_70], 0 jmp loc_1308 loc_127C: add rbx, 1 cmp r13d, ebx jle short loc_12D2 loc_1285: mov r8d, [r15+rbx*4] lea rcx, unk_2008 mov edx, 0Ah mov esi, 1 mov rdi, rbp mov eax, 0 call ___sprintf_chk mov edx, 3E8h mov rsi, rbp mov rdi, r12 call ___strcat_chk cmp r14d, ebx jle short loc_127C mov edx, 3E8h lea rsi, unk_200B mov rdi, r12 call ___strcat_chk jmp short loc_127C loc_12D2: mov edx, 3E8h lea rsi, unk_200E mov rdi, r12 call ___strcat_chk mov eax, [rsp+78h+var_6C] sub eax, 1 cmp eax, [rsp+78h+var_70] jg short loc_1343 loc_12F3: add [rsp+78h+var_70], 1 mov eax, [rsp+78h+var_70] add [rsp+78h+var_68], 14h cmp [rsp+78h+var_6C], eax jz short loc_1359 loc_1308: mov edx, 3E8h lea rsi, unk_2006 mov rdi, r12 call ___strcat_chk mov r13d, [rsp+78h+var_5C] mov eax, [rsp+78h+var_60] sub r13d, eax cmp eax, r13d jge short loc_12D2 mov r15, [rsp+78h+var_68] movsxd rbx, eax lea rbp, [rsp+78h+var_4A] lea r14d, [r13-1] jmp loc_1285 loc_1343: mov edx, 3E8h lea rsi, unk_200B mov rdi, r12 call ___strcat_chk jmp short loc_12F3 loc_1359: mov edx, 3E8h lea rsi, a2922+13h; "]" mov rdi, r12 call ___strcat_chk mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz short loc_138F mov rax, r12 add rsp, 48h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_138F: call ___stack_chk_fail
_BYTE * func0(long long a1, int a2, int a3, int a4) { _BYTE *v4; // r12 long long v5; // rbx int v6; // r13d int i; // [rsp+8h] [rbp-70h] _BYTE v12[10]; // [rsp+2Eh] [rbp-4Ah] BYREF unsigned long long v13; // [rsp+38h] [rbp-40h] v13 = __readfsqword(0x28u); v4 = (_BYTE *)malloc(1000LL); *v4 = 0; __strcat_chk(v4, &unk_2004, 1000LL); if ( a2 > 0 ) { for ( i = 0; i != a2; ++i ) { __strcat_chk(v4, &unk_2006, 1000LL); v6 = a4 - a3; if ( a3 < a4 - a3 ) { v5 = a3; do { __sprintf_chk(v12, 1LL, 10LL, &unk_2008, *(unsigned int *)(a1 + 4 * v5)); __strcat_chk(v4, v12, 1000LL); if ( v6 - 1 > (int)v5 ) __strcat_chk(v4, &unk_200B, 1000LL); ++v5; } while ( v6 > (int)v5 ); } __strcat_chk(v4, &unk_200E, 1000LL); if ( a2 - 1 > i ) __strcat_chk(v4, &unk_200B, 1000LL); a1 += 20LL; } } __strcat_chk(v4, "]", 1000LL); return v4; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x48 MOV RBX,RDI MOV R14D,ESI MOV dword ptr [RSP + 0xc],ESI MOV dword ptr [RSP + 0x18],EDX MOV dword ptr [RSP + 0x1c],ECX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x38],RAX XOR EAX,EAX MOV EDI,0x3e8 CALL 0x00101100 MOV R12,RAX MOV byte ptr [RAX],0x0 MOV EDX,0x3e8 LEA RSI,[0x102004] MOV RDI,RAX CALL 0x001010b0 TEST R14D,R14D JLE 0x00101359 MOV qword ptr [RSP + 0x10],RBX MOV dword ptr [RSP + 0x8],0x0 JMP 0x00101308 LAB_0010127c: ADD RBX,0x1 CMP R13D,EBX JLE 0x001012d2 LAB_00101285: MOV R8D,dword ptr [R15 + RBX*0x4] LEA RCX,[0x102008] MOV EDX,0xa MOV ESI,0x1 MOV RDI,RBP MOV EAX,0x0 CALL 0x00101110 MOV EDX,0x3e8 MOV RSI,RBP MOV RDI,R12 CALL 0x001010b0 CMP R14D,EBX JLE 0x0010127c MOV EDX,0x3e8 LEA RSI,[0x10200b] MOV RDI,R12 CALL 0x001010b0 JMP 0x0010127c LAB_001012d2: MOV EDX,0x3e8 LEA RSI,[0x10200e] MOV RDI,R12 CALL 0x001010b0 MOV EAX,dword ptr [RSP + 0xc] SUB EAX,0x1 CMP EAX,dword ptr [RSP + 0x8] JG 0x00101343 LAB_001012f3: ADD dword ptr [RSP + 0x8],0x1 MOV EAX,dword ptr [RSP + 0x8] ADD qword ptr [RSP + 0x10],0x14 CMP dword ptr [RSP + 0xc],EAX JZ 0x00101359 LAB_00101308: MOV EDX,0x3e8 LEA RSI,[0x102006] MOV RDI,R12 CALL 0x001010b0 MOV R13D,dword ptr [RSP + 0x1c] MOV EAX,dword ptr [RSP + 0x18] SUB R13D,EAX CMP EAX,R13D JGE 0x001012d2 MOV R15,qword ptr [RSP + 0x10] MOVSXD RBX,EAX LEA RBP,[RSP + 0x2e] LEA R14D,[R13 + -0x1] JMP 0x00101285 LAB_00101343: MOV EDX,0x3e8 LEA RSI,[0x10200b] MOV RDI,R12 CALL 0x001010b0 JMP 0x001012f3 LAB_00101359: MOV EDX,0x3e8 LEA RSI,[0x102023] MOV RDI,R12 CALL 0x001010b0 MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010138f MOV RAX,R12 ADD RSP,0x48 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010138f: CALL 0x001010d0
int1 * func0(long param_1,int param_2,int param_3,int param_4) { int1 *puVar1; long lVar2; int iVar3; long in_FS_OFFSET; int local_70; long local_68; int1 local_4a [10]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); puVar1 = (int1 *)malloc(1000); *puVar1 = 0; __strcat_chk(puVar1,&DAT_00102004,1000); if (0 < param_2) { local_70 = 0; local_68 = param_1; do { __strcat_chk(puVar1,&DAT_00102006,1000); iVar3 = param_4 - param_3; if (param_3 < iVar3) { lVar2 = (long)param_3; do { __sprintf_chk(local_4a,1,10,&DAT_00102008,*(int4 *)(local_68 + lVar2 * 4)); __strcat_chk(puVar1,local_4a,1000); if ((int)lVar2 < iVar3 + -1) { __strcat_chk(puVar1,&DAT_0010200b,1000); } lVar2 = lVar2 + 1; } while ((int)lVar2 < iVar3); } __strcat_chk(puVar1,&DAT_0010200e,1000); if (local_70 < param_2 + -1) { __strcat_chk(puVar1,&DAT_0010200b,1000); } local_70 = local_70 + 1; local_68 = local_68 + 0x14; } while (param_2 != local_70); } __strcat_chk(puVar1,"]",1000); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return puVar1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,670
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h>
char* func0(int test_list[][5], int rows, int K, int N) { char* result = (char*)malloc(1000 * sizeof(char)); // Allocate ample memory for the output strcpy(result, ""); // Initialize result string strcat(result, "["); for (int i = 0; i < rows; i++) { // N is the number of elements in each tuple, // i.e. every tuple in test_list has a fixed size of 5 in provided examples strcat(result, "("); for (int j = K; j < N - K; j++) { char num_str[10]; sprintf(num_str, "%d", test_list[i][j]); strcat(result, num_str); if (j < N - K - 1) strcat(result, ", "); } strcat(result, ")"); if (i < rows - 1) strcat(result, ", "); } strcat(result, "]"); return result; }
int main() { int list1[4][5] = {{5, 3, 2, 1, 4}, {3, 4, 9, 2, 1}, {9, 1, 2, 3, 5}, {4, 8, 2, 1, 7}}; int list2[4][5] = {{7, 8, 4, 9}, {11, 8, 12, 4}, {4, 1, 7, 8}, {3, 6, 9, 7}}; char* res1 = func0(list1, 4, 2, 5); char* res2 = func0(list1, 4, 1, 5); char* res3 = func0(list2, 4, 1, 4); assert(strcmp(res1, "[(2), (9), (2), (2)]") == 0); assert(strcmp(res2, "[(3, 2, 1), (4, 9, 2), (1, 2, 3), (8, 2, 1)]") == 0); assert(strcmp(res3, "[(8, 4), (8, 12), (1, 7), (6, 9)]") == 0); free(res1); free(res2); free(res3); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 mov %ecx,%r14d push %r13 mov %rdi,%r13 mov $0x3e8,%edi push %r12 push %rbp push %rbx mov %esi,%ebx sub $0x48,%rsp mov %edx,0x14(%rsp) mov %esi,0x1c(%rsp) mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax callq 1120 <malloc@plt> mov $0x5b,%edx mov %dx,(%rax) mov %rax,%r12 test %ebx,%ebx jle 167d <func0+0x1cd> mov 0x1c(%rsp),%eax movl $0x0,0x10(%rsp) lea 0xaf4(%rip),%r15 sub 0x14(%rsp),%r14d sub $0x1,%eax mov %eax,0x18(%rsp) xchg %ax,%ax mov $0x3e8,%edx lea 0xad8(%rip),%rsi mov %r12,%rdi callq 10c0 <__strcat_chk@plt> cmp 0x14(%rsp),%r14d jle 15fa <func0+0x14a> lea -0x1(%r14),%eax movslq 0x14(%rsp),%rbx lea 0x2e(%rsp),%rbp mov %eax,0xc(%rsp) jmp 1565 <func0+0xb5> nopl 0x0(%rax,%rax,1) add $0x1,%rbx cmp %ebx,%r14d jle 15fa <func0+0x14a> mov 0x0(%r13,%rbx,4),%r8d mov %rbp,%rdi mov %r15,%rcx mov $0xa,%edx mov $0x1,%esi xor %eax,%eax callq 1130 <__sprintf_chk@plt> mov %r12,%rdi mov (%rdi),%edx add $0x4,%rdi lea -0x1010101(%rdx),%eax not %edx and %edx,%eax and $0x80808080,%eax je 1584 <func0+0xd4> mov %eax,%edx shr $0x10,%edx test $0x8080,%eax cmove %edx,%eax lea 0x2(%rdi),%rdx cmove %rdx,%rdi mov $0x3e8,%edx mov %eax,%esi add %al,%sil mov %rbp,%rsi sbb $0x3,%rdi callq 1110 <__stpcpy_chk@plt> cmp %ebx,0xc(%rsp) jle 1558 <func0+0xa8> mov %r12,%rcx mov $0x3,%edx mov %rax,%rdi add $0x1,%rbx sub %rax,%rcx lea 0xa24(%rip),%rsi add $0x3e8,%rcx callq 1100 <__memcpy_chk@plt> cmp %ebx,%r14d jg 1565 <func0+0xb5> mov %r12,%rdi mov (%rdi),%edx add $0x4,%rdi lea -0x1010101(%rdx),%eax not %edx and %edx,%eax and $0x80808080,%eax je 15fd <func0+0x14d> mov %eax,%edx shr $0x10,%edx test $0x8080,%eax cmove %edx,%eax lea 0x2(%rdi),%rdx cmove %rdx,%rdi mov %eax,%esi add %al,%sil mov $0x29,%eax mov 0x18(%rsp),%esi sbb $0x3,%rdi mov %ax,(%rdi) add $0x1,%rdi cmp %esi,0x10(%rsp) jge 1666 <func0+0x1b6> mov %r12,%rcx mov $0x3,%edx lea 0x9b2(%rip),%rsi sub %rdi,%rcx add $0x3e8,%rcx callq 1100 <__memcpy_chk@plt> addl $0x1,0x10(%rsp) add $0x14,%r13 mov 0x10(%rsp),%eax cmp %eax,0x1c(%rsp) jne 1520 <func0+0x70> mov $0x3e8,%edx lea 0x996(%rip),%rsi mov %r12,%rdi callq 10c0 <__strcat_chk@plt> mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 16b3 <func0+0x203> add $0x48,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 10e0 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r15 push r14 push r13 mov r13d, ecx push r12 push rbp mov rbp, rdi mov edi, 3E8h push rbx mov ebx, esi sub rsp, 48h mov [rsp+78h+var_64], esi mov [rsp+78h+var_60], edx mov rax, fs:28h mov [rsp+78h+var_40], rax xor eax, eax call _malloc mov ecx, 5Bh ; '[' mov [rax], cx mov r12, rax test ebx, ebx jle loc_163D mov eax, [rsp+78h+var_64] sub r13d, [rsp+78h+var_60] mov [rsp+78h+var_68], 0 lea r14, unk_2006 sub eax, 1 mov [rsp+78h+var_5C], eax lea eax, [r13-1] mov [rsp+78h+var_6C], eax nop word ptr [rax+rax+00000000h] loc_1550: mov edx, 3E8h lea rsi, unk_2004 mov rdi, r12 call ___strcat_chk movsxd r15, [rsp+78h+var_60] lea rbx, [rsp+78h+var_4A] cmp r13d, r15d jg short loc_1581 jmp short loc_15E7 loc_1578: add r15, 1 cmp r13d, r15d jle short loc_15E7 loc_1581: mov r8d, [rbp+r15*4+0] mov edx, 0Ah mov rcx, r14 mov rdi, rbx mov esi, 1 xor eax, eax call ___sprintf_chk mov rdi, r12 call _strlen mov edx, 3E8h mov rsi, rbx lea rdi, [r12+rax] call ___stpcpy_chk cmp [rsp+78h+var_6C], r15d jle short loc_1578 mov rcx, r12 mov edx, 3 mov rdi, rax add r15, 1 sub rcx, rax lea rsi, unk_2009 add rcx, 3E8h call ___memcpy_chk cmp r13d, r15d jg short loc_1581 loc_15E7: mov rdi, r12 call _strlen mov edx, 29h ; ')' mov ebx, [rsp+78h+var_68] add rax, r12 mov [rax], dx lea rdi, [rax+1] cmp [rsp+78h+var_5C], ebx jle short loc_1626 mov rcx, r12 mov edx, 3 lea rsi, unk_2009 sub rcx, rdi add rcx, 3E8h call ___memcpy_chk loc_1626: add [rsp+78h+var_68], 1 add rbp, 14h mov eax, [rsp+78h+var_68] cmp [rsp+78h+var_64], eax jnz loc_1550 loc_163D: mov edx, 3E8h lea rsi, a2922+13h; "]" mov rdi, r12 call ___strcat_chk mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz short loc_1673 add rsp, 48h mov rax, r12 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1673: call ___stack_chk_fail
char * func0(long long a1, int a2, int a3, int a4) { char *v6; // rax char *v7; // r12 int v8; // r13d long long v9; // r15 long long v10; // rax long long v11; // rax char *v12; // rax int i; // [rsp+10h] [rbp-68h] _BYTE v16[10]; // [rsp+2Eh] [rbp-4Ah] BYREF unsigned long long v17; // [rsp+38h] [rbp-40h] v17 = __readfsqword(0x28u); v6 = (char *)malloc(1000LL); *(_WORD *)v6 = 91; v7 = v6; if ( a2 > 0 ) { v8 = a4 - a3; for ( i = 0; i != a2; ++i ) { __strcat_chk(v7, &unk_2004, 1000LL); v9 = a3; if ( v8 > a3 ) { do { while ( 1 ) { __sprintf_chk(v16, 1LL, 10LL, &unk_2006, *(unsigned int *)(a1 + 4 * v9)); v10 = strlen(v7); v11 = __stpcpy_chk(&v7[v10], v16, 1000LL); if ( v8 - 1 > (int)v9 ) break; if ( v8 <= (int)++v9 ) goto LABEL_8; } ++v9; __memcpy_chk(v11, &unk_2009, 3LL, &v7[-v11 + 1000]); } while ( v8 > (int)v9 ); } LABEL_8: v12 = &v7[strlen(v7)]; *(_WORD *)v12 = 41; if ( a2 - 1 > i ) __memcpy_chk(v12 + 1, &unk_2009, 3LL, v7 - (v12 + 1) + 1000); a1 += 20LL; } } __strcat_chk(v7, "]", 1000LL); return v7; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 MOV R13D,ECX PUSH R12 PUSH RBP MOV RBP,RDI MOV EDI,0x3e8 PUSH RBX MOV EBX,ESI SUB RSP,0x48 MOV dword ptr [RSP + 0x14],ESI MOV dword ptr [RSP + 0x18],EDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x38],RAX XOR EAX,EAX CALL 0x00101160 MOV ECX,0x5b MOV word ptr [RAX],CX MOV R12,RAX TEST EBX,EBX JLE 0x0010163d MOV EAX,dword ptr [RSP + 0x14] SUB R13D,dword ptr [RSP + 0x18] MOV dword ptr [RSP + 0x10],0x0 LEA R14,[0x102006] SUB EAX,0x1 MOV dword ptr [RSP + 0x1c],EAX LEA EAX,[R13 + -0x1] MOV dword ptr [RSP + 0xc],EAX NOP word ptr CS:[RAX + RAX*0x1] LAB_00101550: MOV EDX,0x3e8 LEA RSI,[0x102004] MOV RDI,R12 CALL 0x001010e0 MOVSXD R15,dword ptr [RSP + 0x18] LEA RBX,[RSP + 0x2e] CMP R13D,R15D JG 0x00101581 JMP 0x001015e7 LAB_00101578: ADD R15,0x1 CMP R13D,R15D JLE 0x001015e7 LAB_00101581: MOV R8D,dword ptr [RBP + R15*0x4] MOV EDX,0xa MOV RCX,R14 MOV RDI,RBX MOV ESI,0x1 XOR EAX,EAX CALL 0x00101170 MOV RDI,R12 CALL 0x00101100 MOV EDX,0x3e8 MOV RSI,RBX LEA RDI,[R12 + RAX*0x1] CALL 0x00101150 CMP dword ptr [RSP + 0xc],R15D JLE 0x00101578 MOV RCX,R12 MOV EDX,0x3 MOV RDI,RAX ADD R15,0x1 SUB RCX,RAX LEA RSI,[0x102009] ADD RCX,0x3e8 CALL 0x00101140 CMP R13D,R15D JG 0x00101581 LAB_001015e7: MOV RDI,R12 CALL 0x00101100 MOV EDX,0x29 MOV EBX,dword ptr [RSP + 0x10] ADD RAX,R12 MOV word ptr [RAX],DX LEA RDI,[RAX + 0x1] CMP dword ptr [RSP + 0x1c],EBX JLE 0x00101626 MOV RCX,R12 MOV EDX,0x3 LEA RSI,[0x102009] SUB RCX,RDI ADD RCX,0x3e8 CALL 0x00101140 LAB_00101626: ADD dword ptr [RSP + 0x10],0x1 ADD RBP,0x14 MOV EAX,dword ptr [RSP + 0x10] CMP dword ptr [RSP + 0x14],EAX JNZ 0x00101550 LAB_0010163d: MOV EDX,0x3e8 LEA RSI,[0x10201f] MOV RDI,R12 CALL 0x001010e0 MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101673 ADD RSP,0x48 MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101673: CALL 0x00101110
char * func0(long param_1,int param_2,int param_3,int param_4) { char *__s; long lVar1; size_t sVar2; char *pcVar3; long lVar4; long in_FS_OFFSET; int local_68; int1 local_4a [10]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); __s = (char *)malloc(1000); __s[0] = '['; __s[1] = '\0'; if (0 < param_2) { param_4 = param_4 - param_3; local_68 = 0; do { __strcat_chk(__s,&DAT_00102004,1000); lVar4 = (long)param_3; if (param_3 < param_4) { do { while( true ) { __sprintf_chk(local_4a,1,10,&DAT_00102006,*(int4 *)(param_1 + lVar4 * 4)); sVar2 = strlen(__s); lVar1 = __stpcpy_chk(__s + sVar2,local_4a,1000); if (param_4 + -1 <= (int)lVar4) break; lVar4 = lVar4 + 1; __memcpy_chk(lVar1,&DAT_00102009,3,__s + (1000 - lVar1)); if (param_4 <= (int)lVar4) goto LAB_001015e7; } lVar4 = lVar4 + 1; } while ((int)lVar4 < param_4); } LAB_001015e7: sVar2 = strlen(__s); pcVar3 = __s + sVar2; pcVar3[0] = ')'; pcVar3[1] = '\0'; if (local_68 < param_2 + -1) { __memcpy_chk(pcVar3 + 1,&DAT_00102009,3,__s + (1000 - (long)(pcVar3 + 1))); } local_68 = local_68 + 1; param_1 = param_1 + 0x14; } while (param_2 != local_68); } __strcat_chk(__s,"]",1000); if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return __s; }
5,671
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h>
char* func0(int test_list[][5], int rows, int K, int N) { char* result = (char*)malloc(1000 * sizeof(char)); // Allocate ample memory for the output strcpy(result, ""); // Initialize result string strcat(result, "["); for (int i = 0; i < rows; i++) { // N is the number of elements in each tuple, // i.e. every tuple in test_list has a fixed size of 5 in provided examples strcat(result, "("); for (int j = K; j < N - K; j++) { char num_str[10]; sprintf(num_str, "%d", test_list[i][j]); strcat(result, num_str); if (j < N - K - 1) strcat(result, ", "); } strcat(result, ")"); if (i < rows - 1) strcat(result, ", "); } strcat(result, "]"); return result; }
int main() { int list1[4][5] = {{5, 3, 2, 1, 4}, {3, 4, 9, 2, 1}, {9, 1, 2, 3, 5}, {4, 8, 2, 1, 7}}; int list2[4][5] = {{7, 8, 4, 9}, {11, 8, 12, 4}, {4, 1, 7, 8}, {3, 6, 9, 7}}; char* res1 = func0(list1, 4, 2, 5); char* res2 = func0(list1, 4, 1, 5); char* res3 = func0(list2, 4, 1, 4); assert(strcmp(res1, "[(2), (9), (2), (2)]") == 0); assert(strcmp(res2, "[(3, 2, 1), (4, 9, 2), (1, 2, 3), (8, 2, 1)]") == 0); assert(strcmp(res3, "[(8, 4), (8, 12), (1, 7), (6, 9)]") == 0); free(res1); free(res2); free(res3); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 mov %ecx,%r14d push %r13 push %r12 push %rbp mov %rdi,%rbp mov $0x3e8,%edi push %rbx mov %esi,%ebx sub $0x48,%rsp mov %edx,0xc(%rsp) mov %esi,0x14(%rsp) mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax callq 1120 <malloc@plt> mov $0x5b,%edx mov %dx,(%rax) mov %rax,%r12 test %ebx,%ebx jle 17e3 <func0+0x3b3> mov 0xc(%rsp),%esi mov 0x14(%rsp),%ebx mov %r14d,%eax movl $0x0,0x4(%rsp) sub %esi,%eax sub $0x1,%ebx mov %eax,0x8(%rsp) mov %ebx,0x10(%rsp) lea -0x1(%rax),%ebx sub %esi,%eax sub $0x2,%eax mov %ebx,0x18(%rsp) lea 0x2e(%rsp),%rbx mov %eax,0x1c(%rsp) nopl 0x0(%rax) lea 0xb45(%rip),%rsi mov $0x3e8,%edx mov %r12,%rdi callq 10c0 <__strcat_chk@plt> mov 0x8(%rsp),%esi cmp %esi,0xc(%rsp) jge 1760 <func0+0x330> mov 0xc(%rsp),%esi cmp %esi,0x18(%rsp) jle 1820 <func0+0x3f0> mov 0x1c(%rsp),%eax lea 0x1(%rsi),%r9d movslq %esi,%rdx lea 0xb0c(%rip),%r14 movslq %r9d,%r13 lea 0x2(%rax,%rdx,1),%rax mov %r13,%r15 mov %rax,%r13 nopl 0x0(%rax,%rax,1) mov -0x4(%rbp,%r15,4),%r8d mov %rbx,%rdi mov %r14,%rcx mov $0xa,%edx mov $0x1,%esi xor %eax,%eax callq 1130 <__sprintf_chk@plt> mov %r12,%rdi mov (%rdi),%edx add $0x4,%rdi lea -0x1010101(%rdx),%eax not %edx and %edx,%eax and $0x80808080,%eax je 152f <func0+0xff> mov %eax,%edx shr $0x10,%edx test $0x8080,%eax cmove %edx,%eax lea 0x2(%rdi),%rdx cmove %rdx,%rdi mov $0x3e8,%edx mov %eax,%esi add %al,%sil mov %rbx,%rsi sbb $0x3,%rdi callq 1110 <__stpcpy_chk@plt> mov %r12,%rcx mov $0x3,%edx lea 0xa89(%rip),%rsi sub %rax,%rcx mov %rax,%rdi add $0x3e8,%rcx callq 1100 <__memcpy_chk@plt> mov %r15d,%eax add $0x1,%r15 cmp %r13,%r15 jne 1510 <func0+0xe0> mov %eax,%r15d cmp %eax,0x8(%rsp) jle 1760 <func0+0x330> movslq %r15d,%rax mov $0xa,%edx mov $0x1,%esi mov %rbx,%rdi lea 0x0(%rbp,%rax,4),%r13 lea 0xa3b(%rip),%rcx xor %eax,%eax mov 0x0(%r13),%r8d callq 1130 <__sprintf_chk@plt> mov $0x3e8,%edx mov %rbx,%rsi mov %r12,%rdi callq 10c0 <__strcat_chk@plt> mov 0x8(%rsp),%r14d lea 0x1(%r15),%eax cmp %eax,%r14d jle 1760 <func0+0x330> mov 0x4(%r13),%r8d lea 0xa03(%rip),%rcx mov %rbx,%rdi xor %eax,%eax mov $0xa,%edx mov $0x1,%esi callq 1130 <__sprintf_chk@plt> mov $0x3e8,%edx mov %rbx,%rsi mov %r12,%rdi callq 10c0 <__strcat_chk@plt> lea 0x2(%r15),%eax cmp %eax,%r14d jle 1760 <func0+0x330> mov 0x8(%r13),%r8d lea 0x9c7(%rip),%rcx mov %rbx,%rdi xor %eax,%eax mov $0xa,%edx mov $0x1,%esi callq 1130 <__sprintf_chk@plt> mov $0x3e8,%edx mov %rbx,%rsi mov %r12,%rdi callq 10c0 <__strcat_chk@plt> lea 0x3(%r15),%eax cmp %eax,%r14d jle 1760 <func0+0x330> mov 0xc(%r13),%r8d lea 0x98b(%rip),%rcx mov %rbx,%rdi xor %eax,%eax mov $0xa,%edx mov $0x1,%esi callq 1130 <__sprintf_chk@plt> mov $0x3e8,%edx mov %rbx,%rsi mov %r12,%rdi callq 10c0 <__strcat_chk@plt> lea 0x4(%r15),%eax cmp %eax,%r14d jle 1760 <func0+0x330> mov 0x10(%r13),%r8d lea 0x94f(%rip),%rcx mov %rbx,%rdi xor %eax,%eax mov $0xa,%edx mov $0x1,%esi callq 1130 <__sprintf_chk@plt> mov $0x3e8,%edx mov %rbx,%rsi mov %r12,%rdi callq 10c0 <__strcat_chk@plt> lea 0x5(%r15),%eax cmp %eax,%r14d jle 1760 <func0+0x330> mov 0x14(%r13),%r8d lea 0x917(%rip),%rcx mov %rbx,%rdi xor %eax,%eax mov $0xa,%edx mov $0x1,%esi callq 1130 <__sprintf_chk@plt> mov $0x3e8,%edx mov %rbx,%rsi mov %r12,%rdi callq 10c0 <__strcat_chk@plt> lea 0x6(%r15),%r10d cmp %r10d,%r14d jle 1760 <func0+0x330> movslq %r10d,%r13 lea 0x8e0(%rip),%r14 mov 0x0(%rbp,%r13,4),%r8d mov %r14,%rcx mov $0xa,%edx mov %rbx,%rdi mov $0x1,%esi xor %eax,%eax add $0x1,%r13 callq 1130 <__sprintf_chk@plt> mov $0x3e8,%edx mov %rbx,%rsi mov %r12,%rdi callq 10c0 <__strcat_chk@plt> cmp %r13d,0x8(%rsp) jg 1726 <func0+0x2f6> nopl (%rax) mov %r12,%rdi mov (%rdi),%edx add $0x4,%rdi lea -0x1010101(%rdx),%eax not %edx and %edx,%eax and $0x80808080,%eax je 1763 <func0+0x333> mov %eax,%edx shr $0x10,%edx test $0x8080,%eax cmove %edx,%eax lea 0x2(%rdi),%rdx cmove %rdx,%rdi mov %eax,%esi add %al,%sil mov $0x29,%eax mov 0x10(%rsp),%esi sbb $0x3,%rdi mov %ax,(%rdi) add $0x1,%rdi cmp %esi,0x4(%rsp) jge 17cc <func0+0x39c> mov %r12,%rcx mov $0x3,%edx lea 0x84c(%rip),%rsi sub %rdi,%rcx add $0x3e8,%rcx callq 1100 <__memcpy_chk@plt> addl $0x1,0x4(%rsp) add $0x14,%rbp mov 0x4(%rsp),%eax cmp %eax,0x14(%rsp) jne 14b8 <func0+0x88> mov $0x3e8,%edx lea 0x830(%rip),%rsi mov %r12,%rdi callq 10c0 <__strcat_chk@plt> mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 1828 <func0+0x3f8> add $0x48,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) mov %esi,%r15d jmpq 15af <func0+0x17f> callq 10e0 <__stack_chk_fail@plt> nopl (%rax)
func0: endbr64 push r15 push r14 push r13 mov r13d, ecx push r12 mov r12, rdi mov edi, 3E8h; size push rbp push rbx mov ebx, esi sub rsp, 48h mov [rsp+78h+var_6C], esi mov [rsp+78h+var_70], edx mov rax, fs:28h mov [rsp+78h+var_40], rax xor eax, eax call _malloc mov ecx, 5Bh ; '[' mov [rax], cx mov r14, rax test ebx, ebx jle loc_1706 mov eax, [rsp+78h+var_70] mov edx, [rsp+78h+var_6C] mov [rsp+78h+var_74], 0 sub r13d, eax lea ebx, [rdx-1] add eax, 1 mov [rsp+78h+var_68], ebx cdqe lea ebx, [r13-1] mov [rsp+78h+var_64], ebx mov [rsp+78h+var_60], rax nop dword ptr [rax+rax+00h] loc_14E0: mov edx, 3E8h lea rsi, unk_2004 mov rdi, r14 call ___strcat_chk mov eax, [rsp+78h+var_70] cmp r13d, eax jle loc_16B0 mov ebp, eax lea rbx, [rsp+78h+var_4A] cmp [rsp+78h+var_64], eax jg loc_1740 loc_1512: movsxd rax, ebp mov edx, 0Ah mov esi, 2 mov rdi, rbx lea r15, [r12+rax*4] lea rcx, unk_2006 xor eax, eax mov r8d, [r15] call ___sprintf_chk mov edx, 3E8h mov rsi, rbx mov rdi, r14 call ___strcat_chk lea eax, [rbp+1] cmp r13d, eax jle loc_16B0 mov r8d, [r15+4] lea rcx, unk_2006 mov rdi, rbx xor eax, eax mov edx, 0Ah mov esi, 2 call ___sprintf_chk mov edx, 3E8h mov rsi, rbx mov rdi, r14 call ___strcat_chk lea eax, [rbp+2] cmp r13d, eax jle loc_16B0 mov r8d, [r15+8] lea rcx, unk_2006 mov rdi, rbx xor eax, eax mov edx, 0Ah mov esi, 2 call ___sprintf_chk mov edx, 3E8h mov rsi, rbx mov rdi, r14 call ___strcat_chk lea eax, [rbp+3] cmp r13d, eax jle loc_16B0 mov r8d, [r15+0Ch] lea rcx, unk_2006 mov rdi, rbx xor eax, eax mov edx, 0Ah mov esi, 2 call ___sprintf_chk mov edx, 3E8h mov rsi, rbx mov rdi, r14 call ___strcat_chk lea eax, [rbp+4] cmp r13d, eax jle loc_16B0 mov r8d, [r15+10h] lea rcx, unk_2006 mov rdi, rbx xor eax, eax mov edx, 0Ah mov esi, 2 call ___sprintf_chk mov edx, 3E8h mov rsi, rbx mov rdi, r14 call ___strcat_chk lea eax, [rbp+5] cmp r13d, eax jle short loc_16B0 mov r8d, [r15+14h] lea rcx, unk_2006 mov rdi, rbx xor eax, eax mov edx, 0Ah mov esi, 2 add ebp, 6 call ___sprintf_chk mov edx, 3E8h mov rsi, rbx mov rdi, r14 call ___strcat_chk cmp r13d, ebp jle short loc_16B0 movsxd rbp, ebp loc_1675: mov r8d, [r12+rbp*4] lea rcx, unk_2006 mov rdi, rbx xor eax, eax mov edx, 0Ah mov esi, 2 add rbp, 1 call ___sprintf_chk mov edx, 3E8h mov rsi, rbx mov rdi, r14 call ___strcat_chk cmp r13d, ebp jg short loc_1675 nop dword ptr [rax] loc_16B0: mov rdi, r14; s call _strlen mov edx, 29h ; ')' mov esi, [rsp+78h+var_68] add rax, r14 mov [rax], dx cmp [rsp+78h+var_74], esi jge short loc_16EF lea rdi, [rax+1] mov rcx, r14 mov edx, 3 sub rcx, rdi lea rsi, unk_2009 add rcx, 3E8h call ___memcpy_chk loc_16EF: add [rsp+78h+var_74], 1 add r12, 14h mov eax, [rsp+78h+var_74] cmp [rsp+78h+var_6C], eax jnz loc_14E0 loc_1706: mov edx, 3E8h lea rsi, s2+13h; "]" mov rdi, r14 call ___strcat_chk mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz loc_17D5 add rsp, 48h mov rax, r14 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1740: mov eax, r13d mov r15, [rsp+78h+var_60] sub eax, ebp lea edx, [rax-2] movsxd rax, ebp lea rbp, [rdx+rax+2] loc_1755: mov r8d, [r12+r15*4-4] mov edx, 0Ah mov rdi, rbx xor eax, eax lea rcx, unk_2006 mov esi, 2 call ___sprintf_chk mov rdi, r14; s call _strlen mov edx, 3E8h mov rsi, rbx lea rdi, [r14+rax] call ___stpcpy_chk mov rcx, r14 mov edx, 3 lea rsi, unk_2009 sub rcx, rax mov rdi, rax add rcx, 3E8h call ___memcpy_chk lea rax, [r15+1] cmp rax, rbp jnz short loc_17D0 mov ebp, r15d cmp r13d, r15d jg loc_1512 jmp loc_16B0 loc_17D0: mov r15, rax jmp short loc_1755 loc_17D5: call ___stack_chk_fail
const char * func0(long long a1, int a2, int a3, int a4) { char *v6; // rax const char *v7; // r14 int v8; // r13d int v9; // ebp unsigned int *v10; // r15 long long v11; // rbp long long v12; // r8 char *v13; // rax long long i; // r15 size_t v16; // rax long long v17; // rax int v18; // [rsp+4h] [rbp-74h] _BYTE v20[10]; // [rsp+2Eh] [rbp-4Ah] BYREF unsigned long long v21; // [rsp+38h] [rbp-40h] v21 = __readfsqword(0x28u); v6 = (char *)malloc(0x3E8uLL); *(_WORD *)v6 = 91; v7 = v6; if ( a2 > 0 ) { v18 = 0; v8 = a4 - a3; do { __strcat_chk(v7, &unk_2004, 1000LL); if ( v8 > a3 ) { v9 = a3; if ( v8 - 1 <= a3 ) goto LABEL_24; for ( i = a3 + 1; ; ++i ) { __sprintf_chk(v20, 2LL, 10LL, &unk_2006, *(unsigned int *)(a1 + 4 * i - 4)); v16 = strlen(v7); v17 = __stpcpy_chk(&v7[v16], v20, 1000LL); __memcpy_chk(v17, &unk_2009, 3LL, &v7[-v17 + 1000]); if ( i + 1 == (unsigned int)(v8 - a3 - 2) + (long long)a3 + 2 ) break; } v9 = i; if ( v8 > (int)i ) { LABEL_24: v10 = (unsigned int *)(a1 + 4LL * v9); __sprintf_chk(v20, 2LL, 10LL, &unk_2006, *v10); __strcat_chk(v7, v20, 1000LL); if ( v8 > v9 + 1 ) { __sprintf_chk(v20, 2LL, 10LL, &unk_2006, v10[1]); __strcat_chk(v7, v20, 1000LL); if ( v8 > v9 + 2 ) { __sprintf_chk(v20, 2LL, 10LL, &unk_2006, v10[2]); __strcat_chk(v7, v20, 1000LL); if ( v8 > v9 + 3 ) { __sprintf_chk(v20, 2LL, 10LL, &unk_2006, v10[3]); __strcat_chk(v7, v20, 1000LL); if ( v8 > v9 + 4 ) { __sprintf_chk(v20, 2LL, 10LL, &unk_2006, v10[4]); __strcat_chk(v7, v20, 1000LL); if ( v8 > v9 + 5 ) { LODWORD(v11) = v9 + 6; __sprintf_chk(v20, 2LL, 10LL, &unk_2006, v10[5]); __strcat_chk(v7, v20, 1000LL); if ( v8 > (int)v11 ) { v11 = (int)v11; do { v12 = *(unsigned int *)(a1 + 4 * v11++); __sprintf_chk(v20, 2LL, 10LL, &unk_2006, v12); __strcat_chk(v7, v20, 1000LL); } while ( v8 > (int)v11 ); } } } } } } } } v13 = (char *)&v7[strlen(v7)]; *(_WORD *)v13 = 41; if ( v18 < a2 - 1 ) __memcpy_chk(v13 + 1, &unk_2009, 3LL, v7 - (v13 + 1) + 1000); ++v18; a1 += 20LL; } while ( a2 != v18 ); } __strcat_chk(v7, "]", 1000LL); return v7; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 MOV R13D,ECX PUSH R12 MOV R12,RDI MOV EDI,0x3e8 PUSH RBP PUSH RBX MOV EBX,ESI SUB RSP,0x48 MOV dword ptr [RSP + 0xc],ESI MOV dword ptr [RSP + 0x8],EDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x38],RAX XOR EAX,EAX CALL 0x00101160 MOV ECX,0x5b MOV word ptr [RAX],CX MOV R14,RAX TEST EBX,EBX JLE 0x00101706 MOV EAX,dword ptr [RSP + 0x8] MOV EDX,dword ptr [RSP + 0xc] MOV dword ptr [RSP + 0x4],0x0 SUB R13D,EAX LEA EBX,[RDX + -0x1] ADD EAX,0x1 MOV dword ptr [RSP + 0x10],EBX CDQE LEA EBX,[R13 + -0x1] MOV dword ptr [RSP + 0x14],EBX MOV qword ptr [RSP + 0x18],RAX NOP dword ptr [RAX + RAX*0x1] LAB_001014e0: MOV EDX,0x3e8 LEA RSI,[0x102004] MOV RDI,R14 CALL 0x001010e0 MOV EAX,dword ptr [RSP + 0x8] CMP R13D,EAX JLE 0x001016b0 MOV EBP,EAX LEA RBX,[RSP + 0x2e] CMP dword ptr [RSP + 0x14],EAX JG 0x00101740 LAB_00101512: MOVSXD RAX,EBP MOV EDX,0xa MOV ESI,0x2 MOV RDI,RBX LEA R15,[R12 + RAX*0x4] LEA RCX,[0x102006] XOR EAX,EAX MOV R8D,dword ptr [R15] CALL 0x00101170 MOV EDX,0x3e8 MOV RSI,RBX MOV RDI,R14 CALL 0x001010e0 LEA EAX,[RBP + 0x1] CMP R13D,EAX JLE 0x001016b0 MOV R8D,dword ptr [R15 + 0x4] LEA RCX,[0x102006] MOV RDI,RBX XOR EAX,EAX MOV EDX,0xa MOV ESI,0x2 CALL 0x00101170 MOV EDX,0x3e8 MOV RSI,RBX MOV RDI,R14 CALL 0x001010e0 LEA EAX,[RBP + 0x2] CMP R13D,EAX JLE 0x001016b0 MOV R8D,dword ptr [R15 + 0x8] LEA RCX,[0x102006] MOV RDI,RBX XOR EAX,EAX MOV EDX,0xa MOV ESI,0x2 CALL 0x00101170 MOV EDX,0x3e8 MOV RSI,RBX MOV RDI,R14 CALL 0x001010e0 LEA EAX,[RBP + 0x3] CMP R13D,EAX JLE 0x001016b0 MOV R8D,dword ptr [R15 + 0xc] LEA RCX,[0x102006] MOV RDI,RBX XOR EAX,EAX MOV EDX,0xa MOV ESI,0x2 CALL 0x00101170 MOV EDX,0x3e8 MOV RSI,RBX MOV RDI,R14 CALL 0x001010e0 LEA EAX,[RBP + 0x4] CMP R13D,EAX JLE 0x001016b0 MOV R8D,dword ptr [R15 + 0x10] LEA RCX,[0x102006] MOV RDI,RBX XOR EAX,EAX MOV EDX,0xa MOV ESI,0x2 CALL 0x00101170 MOV EDX,0x3e8 MOV RSI,RBX MOV RDI,R14 CALL 0x001010e0 LEA EAX,[RBP + 0x5] CMP R13D,EAX JLE 0x001016b0 MOV R8D,dword ptr [R15 + 0x14] LEA RCX,[0x102006] MOV RDI,RBX XOR EAX,EAX MOV EDX,0xa MOV ESI,0x2 ADD EBP,0x6 CALL 0x00101170 MOV EDX,0x3e8 MOV RSI,RBX MOV RDI,R14 CALL 0x001010e0 CMP R13D,EBP JLE 0x001016b0 MOVSXD RBP,EBP LAB_00101675: MOV R8D,dword ptr [R12 + RBP*0x4] LEA RCX,[0x102006] MOV RDI,RBX XOR EAX,EAX MOV EDX,0xa MOV ESI,0x2 ADD RBP,0x1 CALL 0x00101170 MOV EDX,0x3e8 MOV RSI,RBX MOV RDI,R14 CALL 0x001010e0 CMP R13D,EBP JG 0x00101675 NOP dword ptr [RAX] LAB_001016b0: MOV RDI,R14 CALL 0x00101100 MOV EDX,0x29 MOV ESI,dword ptr [RSP + 0x10] ADD RAX,R14 MOV word ptr [RAX],DX CMP dword ptr [RSP + 0x4],ESI JGE 0x001016ef LEA RDI,[RAX + 0x1] MOV RCX,R14 MOV EDX,0x3 SUB RCX,RDI LEA RSI,[0x102009] ADD RCX,0x3e8 CALL 0x00101140 LAB_001016ef: ADD dword ptr [RSP + 0x4],0x1 ADD R12,0x14 MOV EAX,dword ptr [RSP + 0x4] CMP dword ptr [RSP + 0xc],EAX JNZ 0x001014e0 LAB_00101706: MOV EDX,0x3e8 LEA RSI,[0x10201f] MOV RDI,R14 CALL 0x001010e0 MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x001017d5 ADD RSP,0x48 MOV RAX,R14 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101740: MOV EAX,R13D MOV R15,qword ptr [RSP + 0x18] SUB EAX,EBP LEA EDX,[RAX + -0x2] MOVSXD RAX,EBP LEA RBP,[RDX + RAX*0x1 + 0x2] LAB_00101755: MOV R8D,dword ptr [R12 + R15*0x4 + -0x4] MOV EDX,0xa MOV RDI,RBX XOR EAX,EAX LEA RCX,[0x102006] MOV ESI,0x2 CALL 0x00101170 MOV RDI,R14 CALL 0x00101100 MOV EDX,0x3e8 MOV RSI,RBX LEA RDI,[R14 + RAX*0x1] CALL 0x00101150 MOV RCX,R14 MOV EDX,0x3 LEA RSI,[0x102009] SUB RCX,RAX MOV RDI,RAX ADD RCX,0x3e8 CALL 0x00101140 LEA RAX,[R15 + 0x1] CMP RAX,RBP JNZ 0x001017d0 MOV EBP,R15D CMP R13D,R15D JG 0x00101512 JMP 0x001016b0 LAB_001017d0: MOV R15,RAX JMP 0x00101755 LAB_001017d5: CALL 0x00101110
char * func0(long param_1,int param_2,int param_3,int param_4) { int4 *puVar1; char *__s; size_t sVar2; char *pcVar3; long lVar4; int iVar5; long lVar6; long in_FS_OFFSET; int local_74; int local_4a [10]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); __s = (char *)malloc(1000); __s[0] = '['; __s[1] = '\0'; if (0 < param_2) { local_74 = 0; param_4 = param_4 - param_3; do { __strcat_chk(__s,&DAT_00102004,1000); if (param_3 < param_4) { iVar5 = param_3; if (param_3 < param_4 + -1) { lVar4 = (long)(param_3 + 1); do { lVar6 = lVar4; __sprintf_chk(local_4a,2,10,&DAT_00102006,*(int4 *)(param_1 + -4 + lVar6 * 4)); sVar2 = strlen(__s); lVar4 = __stpcpy_chk(__s + sVar2,local_4a,1000); __memcpy_chk(lVar4,&DAT_00102009,3,__s + (1000 - lVar4)); lVar4 = lVar6 + 1; } while (lVar6 + 1 != (ulong)((param_4 - param_3) - 2) + 2 + (long)param_3); iVar5 = (int)lVar6; if (param_4 <= iVar5) goto LAB_001016b0; } puVar1 = (int4 *)(param_1 + (long)iVar5 * 4); __sprintf_chk(local_4a,2,10,&DAT_00102006,*puVar1); __strcat_chk(__s,local_4a,1000); if (iVar5 + 1 < param_4) { __sprintf_chk(local_4a,2,10,&DAT_00102006,puVar1[1]); __strcat_chk(__s,local_4a,1000); if (iVar5 + 2 < param_4) { __sprintf_chk(local_4a,2,10,&DAT_00102006,puVar1[2]); __strcat_chk(__s,local_4a,1000); if (iVar5 + 3 < param_4) { __sprintf_chk(local_4a,2,10,&DAT_00102006,puVar1[3]); __strcat_chk(__s,local_4a,1000); if (iVar5 + 4 < param_4) { __sprintf_chk(local_4a,2,10,&DAT_00102006,puVar1[4]); __strcat_chk(__s,local_4a,1000); if (iVar5 + 5 < param_4) { __sprintf_chk(local_4a,2,10,&DAT_00102006,puVar1[5]); __strcat_chk(__s,local_4a,1000); if (iVar5 + 6 < param_4) { lVar4 = (long)(iVar5 + 6); do { lVar6 = lVar4 * 4; lVar4 = lVar4 + 1; __sprintf_chk(local_4a,2,10,&DAT_00102006,*(int4 *)(param_1 + lVar6)); __strcat_chk(__s,local_4a,1000); } while ((int)lVar4 < param_4); } } } } } } } LAB_001016b0: sVar2 = strlen(__s); pcVar3 = __s + sVar2; pcVar3[0] = ')'; pcVar3[1] = '\0'; if (local_74 < param_2 + -1) { __memcpy_chk(pcVar3 + 1,&DAT_00102009,3,__s + (1000 - (long)(pcVar3 + 1))); } local_74 = local_74 + 1; param_1 = param_1 + 0x14; } while (param_2 != local_74); } __strcat_chk(__s,"]",1000); if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return __s; }
5,672
func0
#include <assert.h>
void func0(int test_tup1[][2], int test_tup2[][2], int res[][2], int num_tuples) { for (int i = 0; i < num_tuples; i++) { for (int j = 0; j < 2; j++) { res[i][j] = test_tup1[i][j] * test_tup2[i][j]; } } }
int main() { int res[4][2]; int test_tup1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test_tup2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int expected[4][2] = {{6, 21}, {12, 45}, {2, 9}, {7, 30}}; func0(test_tup1, test_tup2, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected[i][j]); } } int test_tup3[4][2] = {{2, 4}, {5, 6}, {3, 10}, {2, 11}}; int test_tup4[4][2] = {{7, 8}, {4, 10}, {2, 2}, {8, 4}}; int expected2[4][2] = {{14, 32}, {20, 60}, {6, 20}, {16, 44}}; func0(test_tup3, test_tup4, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected2[i][j]); } } int test_tup5[4][2] = {{3, 5}, {6, 7}, {4, 11}, {3, 12}}; int test_tup6[4][2] = {{8, 9}, {5, 11}, {3, 3}, {9, 5}}; int expected3[4][2] = {{24, 45}, {30, 77}, {12, 33}, {27, 60}}; func0(test_tup5, test_tup6, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected3[i][j]); } } return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %rdx,-0x28(%rbp) mov %ecx,-0x2c(%rbp) movl $0x0,-0x8(%rbp) jmp 11f8 <func0+0x8f> movl $0x0,-0x4(%rbp) jmp 11ee <func0+0x85> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rax,%rdx mov -0x4(%rbp),%eax cltq mov (%rdx,%rax,4),%edx mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x20(%rbp),%rax add %rax,%rcx mov -0x4(%rbp),%eax cltq mov (%rcx,%rax,4),%eax mov -0x8(%rbp),%ecx movslq %ecx,%rcx lea 0x0(,%rcx,8),%rsi mov -0x28(%rbp),%rcx add %rsi,%rcx imul %eax,%edx mov -0x4(%rbp),%eax cltq mov %edx,(%rcx,%rax,4) addl $0x1,-0x4(%rbp) cmpl $0x1,-0x4(%rbp) jle 1192 <func0+0x29> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x2c(%rbp),%eax jl 1189 <func0+0x20> pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_28], rdx mov [rbp+var_2C], ecx mov [rbp+var_8], 0 jmp short loc_11F8 loc_1189: mov [rbp+var_4], 0 jmp short loc_11EE loc_1192: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] add rdx, rax mov eax, [rbp+var_4] cdqe mov edx, [rdx+rax*4] mov eax, [rbp+var_8] cdqe lea rcx, ds:0[rax*8] mov rax, [rbp+var_20] add rcx, rax mov eax, [rbp+var_4] cdqe mov eax, [rcx+rax*4] mov ecx, [rbp+var_8] movsxd rcx, ecx lea rsi, ds:0[rcx*8] mov rcx, [rbp+var_28] add rcx, rsi imul edx, eax mov eax, [rbp+var_4] cdqe mov [rcx+rax*4], edx add [rbp+var_4], 1 loc_11EE: cmp [rbp+var_4], 1 jle short loc_1192 add [rbp+var_8], 1 loc_11F8: mov eax, [rbp+var_8] cmp eax, [rbp+var_2C] jl short loc_1189 nop nop pop rbp retn
long long func0(long long a1, long long a2, long long a3, int a4) { long long result; // rax unsigned int i; // [rsp+24h] [rbp-8h] int j; // [rsp+28h] [rbp-4h] for ( i = 0; ; ++i ) { result = i; if ( (int)i >= a4 ) break; for ( j = 0; j <= 1; ++j ) *(_DWORD *)(8LL * (int)i + a3 + 4LL * j) = *(_DWORD *)(a2 + 8LL * (int)i + 4LL * j) * *(_DWORD *)(a1 + 8LL * (int)i + 4LL * j); } return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x2c],ECX MOV dword ptr [RBP + -0x8],0x0 JMP 0x001011f8 LAB_00101189: MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011ee LAB_00101192: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x4] CDQE MOV EDX,dword ptr [RDX + RAX*0x4] MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RCX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x20] ADD RCX,RAX MOV EAX,dword ptr [RBP + -0x4] CDQE MOV EAX,dword ptr [RCX + RAX*0x4] MOV ECX,dword ptr [RBP + -0x8] MOVSXD RCX,ECX LEA RSI,[RCX*0x8] MOV RCX,qword ptr [RBP + -0x28] ADD RCX,RSI IMUL EDX,EAX MOV EAX,dword ptr [RBP + -0x4] CDQE MOV dword ptr [RCX + RAX*0x4],EDX ADD dword ptr [RBP + -0x4],0x1 LAB_001011ee: CMP dword ptr [RBP + -0x4],0x1 JLE 0x00101192 ADD dword ptr [RBP + -0x8],0x1 LAB_001011f8: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x2c] JL 0x00101189 NOP NOP POP RBP RET
void func0(long param_1,long param_2,long param_3,int param_4) { int4 local_10; int4 local_c; for (local_10 = 0; local_10 < param_4; local_10 = local_10 + 1) { for (local_c = 0; local_c < 2; local_c = local_c + 1) { *(int *)(param_3 + (long)local_10 * 8 + (long)local_c * 4) = *(int *)((long)local_10 * 8 + param_1 + (long)local_c * 4) * *(int *)((long)local_10 * 8 + param_2 + (long)local_c * 4); } } return; }
5,673
func0
#include <assert.h>
void func0(int test_tup1[][2], int test_tup2[][2], int res[][2], int num_tuples) { for (int i = 0; i < num_tuples; i++) { for (int j = 0; j < 2; j++) { res[i][j] = test_tup1[i][j] * test_tup2[i][j]; } } }
int main() { int res[4][2]; int test_tup1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test_tup2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int expected[4][2] = {{6, 21}, {12, 45}, {2, 9}, {7, 30}}; func0(test_tup1, test_tup2, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected[i][j]); } } int test_tup3[4][2] = {{2, 4}, {5, 6}, {3, 10}, {2, 11}}; int test_tup4[4][2] = {{7, 8}, {4, 10}, {2, 2}, {8, 4}}; int expected2[4][2] = {{14, 32}, {20, 60}, {6, 20}, {16, 44}}; func0(test_tup3, test_tup4, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected2[i][j]); } } int test_tup5[4][2] = {{3, 5}, {6, 7}, {4, 11}, {3, 12}}; int test_tup6[4][2] = {{8, 9}, {5, 11}, {3, 3}, {9, 5}}; int expected3[4][2] = {{24, 45}, {30, 77}, {12, 33}, {27, 60}}; func0(test_tup5, test_tup6, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected3[i][j]); } } return 0; }
O1
c
func0: endbr64 test %ecx,%ecx jle 119d <func0+0x34> lea -0x1(%rcx),%r8d mov $0x0,%eax mov (%rdi,%rax,8),%ecx imul (%rsi,%rax,8),%ecx mov %ecx,(%rdx,%rax,8) mov 0x4(%rdi,%rax,8),%ecx imul 0x4(%rsi,%rax,8),%ecx mov %ecx,0x4(%rdx,%rax,8) mov %rax,%rcx add $0x1,%rax cmp %r8,%rcx jne 117a <func0+0x11> retq
func0: endbr64 test ecx, ecx jle short locret_1199 mov r8d, ecx mov eax, 0 loc_1179: mov ecx, [rdi+rax*8] imul ecx, [rsi+rax*8] mov [rdx+rax*8], ecx mov ecx, [rdi+rax*8+4] imul ecx, [rsi+rax*8+4] mov [rdx+rax*8+4], ecx add rax, 1 cmp rax, r8 jnz short loc_1179 locret_1199: retn
void func0(long long a1, long long a2, long long a3, int a4) { long long i; // rax if ( a4 > 0 ) { for ( i = 0LL; i != a4; ++i ) { *(_DWORD *)(a3 + 8 * i) = *(_DWORD *)(a2 + 8 * i) * *(_DWORD *)(a1 + 8 * i); *(_DWORD *)(a3 + 8 * i + 4) = *(_DWORD *)(a2 + 8 * i + 4) * *(_DWORD *)(a1 + 8 * i + 4); } } }
func0: ENDBR64 TEST ECX,ECX JLE 0x00101199 MOV R8D,ECX MOV EAX,0x0 LAB_00101179: MOV ECX,dword ptr [RDI + RAX*0x8] IMUL ECX,dword ptr [RSI + RAX*0x8] MOV dword ptr [RDX + RAX*0x8],ECX MOV ECX,dword ptr [RDI + RAX*0x8 + 0x4] IMUL ECX,dword ptr [RSI + RAX*0x8 + 0x4] MOV dword ptr [RDX + RAX*0x8 + 0x4],ECX ADD RAX,0x1 CMP RAX,R8 JNZ 0x00101179 LAB_00101199: RET
void func0(long param_1,long param_2,long param_3,uint param_4) { ulong uVar1; if (0 < (int)param_4) { uVar1 = 0; do { *(int *)(param_3 + uVar1 * 8) = *(int *)(param_1 + uVar1 * 8) * *(int *)(param_2 + uVar1 * 8); *(int *)(param_3 + 4 + uVar1 * 8) = *(int *)(param_1 + 4 + uVar1 * 8) * *(int *)(param_2 + 4 + uVar1 * 8); uVar1 = uVar1 + 1; } while (uVar1 != param_4); } return; }
5,674
func0
#include <assert.h>
void func0(int test_tup1[][2], int test_tup2[][2], int res[][2], int num_tuples) { for (int i = 0; i < num_tuples; i++) { for (int j = 0; j < 2; j++) { res[i][j] = test_tup1[i][j] * test_tup2[i][j]; } } }
int main() { int res[4][2]; int test_tup1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test_tup2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int expected[4][2] = {{6, 21}, {12, 45}, {2, 9}, {7, 30}}; func0(test_tup1, test_tup2, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected[i][j]); } } int test_tup3[4][2] = {{2, 4}, {5, 6}, {3, 10}, {2, 11}}; int test_tup4[4][2] = {{7, 8}, {4, 10}, {2, 2}, {8, 4}}; int expected2[4][2] = {{14, 32}, {20, 60}, {6, 20}, {16, 44}}; func0(test_tup3, test_tup4, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected2[i][j]); } } int test_tup5[4][2] = {{3, 5}, {6, 7}, {4, 11}, {3, 12}}; int test_tup6[4][2] = {{8, 9}, {5, 11}, {3, 3}, {9, 5}}; int expected3[4][2] = {{24, 45}, {30, 77}, {12, 33}, {27, 60}}; func0(test_tup5, test_tup6, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected3[i][j]); } } return 0; }
O2
c
func0: endbr64 test %ecx,%ecx jle 1583 <func0+0x33> lea -0x1(%rcx),%r8d xor %eax,%eax xchg %ax,%ax mov (%rdi,%rax,8),%ecx imul (%rsi,%rax,8),%ecx mov %ecx,(%rdx,%rax,8) mov 0x4(%rdi,%rax,8),%ecx imul 0x4(%rsi,%rax,8),%ecx mov %ecx,0x4(%rdx,%rax,8) mov %rax,%rcx add $0x1,%rax cmp %rcx,%r8 jne 1560 <func0+0x10> retq nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 test ecx, ecx jle short locret_1570 movsxd r8, ecx xor eax, eax nop dword ptr [rax] loc_1550: mov ecx, [rdi+rax*8] imul ecx, [rsi+rax*8] mov [rdx+rax*8], ecx mov ecx, [rdi+rax*8+4] imul ecx, [rsi+rax*8+4] mov [rdx+rax*8+4], ecx add rax, 1 cmp r8, rax jnz short loc_1550 locret_1570: retn
void func0(long long a1, long long a2, long long a3, int a4) { long long i; // rax if ( a4 > 0 ) { for ( i = 0LL; i != a4; ++i ) { *(_DWORD *)(a3 + 8 * i) = *(_DWORD *)(a2 + 8 * i) * *(_DWORD *)(a1 + 8 * i); *(_DWORD *)(a3 + 8 * i + 4) = *(_DWORD *)(a2 + 8 * i + 4) * *(_DWORD *)(a1 + 8 * i + 4); } } }
func0: ENDBR64 TEST ECX,ECX JLE 0x00101570 MOVSXD R8,ECX XOR EAX,EAX NOP dword ptr [RAX] LAB_00101550: MOV ECX,dword ptr [RDI + RAX*0x8] IMUL ECX,dword ptr [RSI + RAX*0x8] MOV dword ptr [RDX + RAX*0x8],ECX MOV ECX,dword ptr [RDI + RAX*0x8 + 0x4] IMUL ECX,dword ptr [RSI + RAX*0x8 + 0x4] MOV dword ptr [RDX + RAX*0x8 + 0x4],ECX ADD RAX,0x1 CMP R8,RAX JNZ 0x00101550 LAB_00101570: RET
void func0(long param_1,long param_2,long param_3,int param_4) { long lVar1; if (0 < param_4) { lVar1 = 0; do { *(int *)(param_3 + lVar1 * 8) = *(int *)(param_1 + lVar1 * 8) * *(int *)(param_2 + lVar1 * 8); *(int *)(param_3 + 4 + lVar1 * 8) = *(int *)(param_1 + 4 + lVar1 * 8) * *(int *)(param_2 + 4 + lVar1 * 8); lVar1 = lVar1 + 1; } while (param_4 != lVar1); } return; }
5,675
func0
#include <assert.h>
void func0(int test_tup1[][2], int test_tup2[][2], int res[][2], int num_tuples) { for (int i = 0; i < num_tuples; i++) { for (int j = 0; j < 2; j++) { res[i][j] = test_tup1[i][j] * test_tup2[i][j]; } } }
int main() { int res[4][2]; int test_tup1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test_tup2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int expected[4][2] = {{6, 21}, {12, 45}, {2, 9}, {7, 30}}; func0(test_tup1, test_tup2, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected[i][j]); } } int test_tup3[4][2] = {{2, 4}, {5, 6}, {3, 10}, {2, 11}}; int test_tup4[4][2] = {{7, 8}, {4, 10}, {2, 2}, {8, 4}}; int expected2[4][2] = {{14, 32}, {20, 60}, {6, 20}, {16, 44}}; func0(test_tup3, test_tup4, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected2[i][j]); } } int test_tup5[4][2] = {{3, 5}, {6, 7}, {4, 11}, {3, 12}}; int test_tup6[4][2] = {{8, 9}, {5, 11}, {3, 3}, {9, 5}}; int expected3[4][2] = {{24, 45}, {30, 77}, {12, 33}, {27, 60}}; func0(test_tup5, test_tup6, res, 4); for (int i = 0; i < 4; i++) { for (int j = 0; j < 2; j++) { assert(res[i][j] == expected3[i][j]); } } return 0; }
O3
c
func0: endbr64 test %ecx,%ecx jle 155b <func0+0xeb> lea 0xf(%rsi),%rax sub %rdx,%rax cmp $0x1e,%rax seta %r8b cmp $0x1,%ecx setne %al test %al,%r8b je 152f <func0+0xbf> lea 0xf(%rdi),%rax sub %rdx,%rax cmp $0x1e,%rax jbe 152f <func0+0xbf> mov %ecx,%eax xor %r8d,%r8d shr %eax shl $0x4,%rax nopw %cs:0x0(%rax,%rax,1) movdqu (%rdi,%r8,1),%xmm0 movdqu (%rsi,%r8,1),%xmm2 movdqu (%rdi,%r8,1),%xmm1 movdqu (%rsi,%r8,1),%xmm3 psrlq $0x20,%xmm0 psrlq $0x20,%xmm2 pmuludq %xmm3,%xmm1 pmuludq %xmm2,%xmm0 pshufd $0x8,%xmm1,%xmm1 pshufd $0x8,%xmm0,%xmm0 punpckldq %xmm0,%xmm1 movups %xmm1,(%rdx,%r8,1) add $0x10,%r8 cmp %rax,%r8 jne 14c0 <func0+0x50> mov %ecx,%eax and $0xfffffffe,%eax and $0x1,%ecx je 155b <func0+0xeb> shl $0x3,%rax add %rax,%rdi add %rax,%rsi add %rdx,%rax mov (%rdi),%edx imul (%rsi),%edx mov %edx,(%rax) mov 0x4(%rdi),%edx imul 0x4(%rsi),%edx mov %edx,0x4(%rax) retq lea -0x1(%rcx),%r8d xor %ecx,%ecx nopl (%rax) mov (%rdi,%rcx,8),%eax imul (%rsi,%rcx,8),%eax mov %eax,(%rdx,%rcx,8) mov 0x4(%rdi,%rcx,8),%eax imul 0x4(%rsi,%rcx,8),%eax mov %eax,0x4(%rdx,%rcx,8) mov %rcx,%rax add $0x1,%rcx cmp %rax,%r8 jne 1538 <func0+0xc8> retq nopl 0x0(%rax)
func0: endbr64 test ecx, ecx jle locret_1220 cmp ecx, 1 jz loc_11F0 lea rax, [rdi+0Fh] sub rax, rdx cmp rax, 1Eh jbe loc_11F0 lea rax, [rsi+0Fh] sub rax, rdx cmp rax, 1Eh jbe short loc_11F0 mov r8d, ecx xor eax, eax shr r8d, 1 shl r8, 4 nop loc_1180: movdqu xmm0, xmmword ptr [rdi+rax] movdqu xmm2, xmmword ptr [rsi+rax] movdqu xmm1, xmmword ptr [rdi+rax] movdqu xmm3, xmmword ptr [rsi+rax] psrlq xmm0, 20h ; ' ' psrlq xmm2, 20h ; ' ' pmuludq xmm1, xmm3 pmuludq xmm0, xmm2 pshufd xmm1, xmm1, 8 pshufd xmm0, xmm0, 8 punpckldq xmm1, xmm0 movups xmmword ptr [rdx+rax], xmm1 add rax, 10h cmp rax, r8 jnz short loc_1180 mov eax, ecx and eax, 0FFFFFFFEh and ecx, 1 jz short locret_1220 shl rax, 3 add rdi, rax add rsi, rax add rax, rdx mov edx, [rdi] imul edx, [rsi] mov [rax], edx mov edx, [rdi+4] imul edx, [rsi+4] mov [rax+4], edx retn loc_11F0: movsxd rcx, ecx xor eax, eax lea r8, ds:0[rcx*8] nop dword ptr [rax] loc_1200: mov ecx, [rdi+rax] imul ecx, [rsi+rax] mov [rdx+rax], ecx mov ecx, [rdi+rax+4] imul ecx, [rsi+rax+4] mov [rdx+rax+4], ecx add rax, 8 cmp rax, r8 jnz short loc_1200 locret_1220: retn
void func0(long long a1, long long a2, long long a3, int a4) { long long v4; // rax long long v5; // rax _DWORD *v6; // rdi _DWORD *v7; // rsi _DWORD *v8; // rax long long v9; // rax if ( a4 > 0 ) { if ( a4 == 1 || (unsigned long long)(a1 + 15 - a3) <= 0x1E || (unsigned long long)(a2 + 15 - a3) <= 0x1E ) { v9 = 0LL; do { *(_DWORD *)(a3 + v9) = *(_DWORD *)(a2 + v9) * *(_DWORD *)(a1 + v9); *(_DWORD *)(a3 + v9 + 4) = *(_DWORD *)(a2 + v9 + 4) * *(_DWORD *)(a1 + v9 + 4); v9 += 8LL; } while ( v9 != 8LL * a4 ); } else { v4 = 0LL; do { *(__m128i *)(a3 + v4) = _mm_unpacklo_epi32( _mm_shuffle_epi32( _mm_mul_epu32( _mm_loadu_si128((const __m128i *)(a1 + v4)), _mm_loadu_si128((const __m128i *)(a2 + v4))), 8), _mm_shuffle_epi32( _mm_mul_epu32( _mm_srli_epi64(_mm_loadu_si128((const __m128i *)(a1 + v4)), 0x20u), _mm_srli_epi64(_mm_loadu_si128((const __m128i *)(a2 + v4)), 0x20u)), 8)); v4 += 16LL; } while ( v4 != 16LL * ((unsigned int)a4 >> 1) ); if ( (a4 & 1) != 0 ) { v5 = 8LL * (a4 & 0xFFFFFFFE); v6 = (_DWORD *)(v5 + a1); v7 = (_DWORD *)(v5 + a2); v8 = (_DWORD *)(a3 + v5); *v8 = *v7 * *v6; v8[1] = v7[1] * v6[1]; } } } }
func0: ENDBR64 TEST ECX,ECX JLE 0x00101220 CMP ECX,0x1 JZ 0x001011f0 LEA RAX,[RDI + 0xf] SUB RAX,RDX CMP RAX,0x1e JBE 0x001011f0 LEA RAX,[RSI + 0xf] SUB RAX,RDX CMP RAX,0x1e JBE 0x001011f0 MOV R8D,ECX XOR EAX,EAX SHR R8D,0x1 SHL R8,0x4 NOP LAB_00101180: MOVDQU XMM0,xmmword ptr [RDI + RAX*0x1] MOVDQU XMM2,xmmword ptr [RSI + RAX*0x1] MOVDQU XMM1,xmmword ptr [RDI + RAX*0x1] MOVDQU XMM3,xmmword ptr [RSI + RAX*0x1] PSRLQ XMM0,0x20 PSRLQ XMM2,0x20 PMULUDQ XMM1,XMM3 PMULUDQ XMM0,XMM2 PSHUFD XMM1,XMM1,0x8 PSHUFD XMM0,XMM0,0x8 PUNPCKLDQ XMM1,XMM0 MOVUPS xmmword ptr [RDX + RAX*0x1],XMM1 ADD RAX,0x10 CMP RAX,R8 JNZ 0x00101180 MOV EAX,ECX AND EAX,0xfffffffe AND ECX,0x1 JZ 0x00101220 SHL RAX,0x3 ADD RDI,RAX ADD RSI,RAX ADD RAX,RDX MOV EDX,dword ptr [RDI] IMUL EDX,dword ptr [RSI] MOV dword ptr [RAX],EDX MOV EDX,dword ptr [RDI + 0x4] IMUL EDX,dword ptr [RSI + 0x4] MOV dword ptr [RAX + 0x4],EDX RET LAB_001011f0: MOVSXD RCX,ECX XOR EAX,EAX LEA R8,[RCX*0x8] NOP dword ptr [RAX] LAB_00101200: MOV ECX,dword ptr [RDI + RAX*0x1] IMUL ECX,dword ptr [RSI + RAX*0x1] MOV dword ptr [RDX + RAX*0x1],ECX MOV ECX,dword ptr [RDI + RAX*0x1 + 0x4] IMUL ECX,dword ptr [RSI + RAX*0x1 + 0x4] MOV dword ptr [RDX + RAX*0x1 + 0x4],ECX ADD RAX,0x8 CMP RAX,R8 JNZ 0x00101200 LAB_00101220: RET
void func0(long param_1,long param_2,long param_3,uint param_4) { int8 *puVar1; ulong uVar2; ulong uVar3; uint uVar4; ulong uVar5; long lVar6; if (0 < (int)param_4) { if (((param_4 == 1) || ((ulong)((param_1 + 0xf) - param_3) < 0x1f)) || ((ulong)((param_2 + 0xf) - param_3) < 0x1f)) { lVar6 = 0; do { *(int *)(param_3 + lVar6) = *(int *)(param_1 + lVar6) * *(int *)(param_2 + lVar6); *(int *)(param_3 + 4 + lVar6) = *(int *)(param_1 + 4 + lVar6) * *(int *)(param_2 + 4 + lVar6); lVar6 = lVar6 + 8; } while (lVar6 != (long)(int)param_4 * 8); } else { lVar6 = 0; do { uVar2 = ((ulong *)(param_1 + lVar6))[1]; uVar3 = ((ulong *)(param_2 + lVar6))[1]; uVar5 = ((ulong *)(param_1 + lVar6))[1]; uVar4 = ((uint *)(param_2 + lVar6))[2]; puVar1 = (int8 *)(param_3 + lVar6); *puVar1 = CONCAT44((int)((*(ulong *)(param_1 + lVar6) >> 0x20) * (*(ulong *)(param_2 + lVar6) >> 0x20)), (int)((*(ulong *)(param_1 + lVar6) & 0xffffffff) * (ulong)*(uint *)(param_2 + lVar6))); *(int *)(puVar1 + 2) = (int)((uVar5 & 0xffffffff) * (ulong)uVar4); *(int *)((long)puVar1 + 0x14) = (int)((uVar2 >> 0x20) * (uVar3 >> 0x20)); lVar6 = lVar6 + 0x10; } while (lVar6 != (ulong)(param_4 >> 1) << 4); if ((param_4 & 1) != 0) { lVar6 = (ulong)(param_4 & 0xfffffffe) * 8; *(int *)(lVar6 + param_3) = *(int *)(param_1 + lVar6) * *(int *)(param_2 + lVar6); ((int *)(lVar6 + param_3))[1] = ((int *)(param_1 + lVar6))[1] * ((int *)(param_2 + lVar6))[1]; return; } } } return; }
5,676
func0
#include <assert.h>
int func0(const int *tup, int tup_size, const int *lst, int lst_size) { int count = 0; for (int i = 0; i < tup_size; i++) { for (int j = 0; j < lst_size; j++) { if (tup[i] == lst[j]) { count++; break; } } } return count; }
int main() { int tup1[] = {'a', 'a', 'c', 'b', 'd'}; int lst1[] = {'a', 'b'}; assert(func0(tup1, 5, lst1, 2) == 3); int tup2[] = {1, 2, 3, 1, 4, 6, 7, 1, 4}; int lst2[] = {1, 4, 7}; assert(func0(tup2, 9, lst2, 3) == 6); int tup3[] = {1, 2, 3, 4, 5, 6}; int lst3[] = {1, 2}; assert(func0(tup3, 6, lst3, 2) == 2); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %rdx,-0x28(%rbp) mov %ecx,-0x20(%rbp) movl $0x0,-0xc(%rbp) movl $0x0,-0x8(%rbp) jmp 11de <func0+0x75> movl $0x0,-0x4(%rbp) jmp 11d2 <func0+0x69> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x28(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jne 11ce <func0+0x65> addl $0x1,-0xc(%rbp) jmp 11da <func0+0x71> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x20(%rbp),%eax jl 1198 <func0+0x2f> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x1c(%rbp),%eax jl 118f <func0+0x26> mov -0xc(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_28], rdx mov [rbp+var_20], ecx mov [rbp+var_C], 0 mov [rbp+var_8], 0 jmp short loc_11DE loc_118F: mov [rbp+var_4], 0 jmp short loc_11D2 loc_1198: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_4] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rcx mov eax, [rax] cmp edx, eax jnz short loc_11CE add [rbp+var_C], 1 jmp short loc_11DA loc_11CE: add [rbp+var_4], 1 loc_11D2: mov eax, [rbp+var_4] cmp eax, [rbp+var_20] jl short loc_1198 loc_11DA: add [rbp+var_8], 1 loc_11DE: mov eax, [rbp+var_8] cmp eax, [rbp+var_1C] jl short loc_118F mov eax, [rbp+var_C] pop rbp retn
long long func0(long long a1, int a2, long long a3, int a4) { unsigned int v5; // [rsp+1Ch] [rbp-Ch] int i; // [rsp+20h] [rbp-8h] int j; // [rsp+24h] [rbp-4h] v5 = 0; for ( i = 0; i < a2; ++i ) { for ( j = 0; j < a4; ++j ) { if ( *(_DWORD *)(4LL * i + a1) == *(_DWORD *)(4LL * j + a3) ) { ++v5; break; } } } return v5; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x20],ECX MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x8],0x0 JMP 0x001011de LAB_0010118f: MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011d2 LAB_00101198: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JNZ 0x001011ce ADD dword ptr [RBP + -0xc],0x1 JMP 0x001011da LAB_001011ce: ADD dword ptr [RBP + -0x4],0x1 LAB_001011d2: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x20] JL 0x00101198 LAB_001011da: ADD dword ptr [RBP + -0x8],0x1 LAB_001011de: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x1c] JL 0x0010118f MOV EAX,dword ptr [RBP + -0xc] POP RBP RET
int func0(long param_1,int param_2,long param_3,int param_4) { int4 local_14; int4 local_10; int4 local_c; local_14 = 0; local_10 = 0; do { if (param_2 <= local_10) { return local_14; } for (local_c = 0; local_c < param_4; local_c = local_c + 1) { if (*(int *)(param_1 + (long)local_10 * 4) == *(int *)(param_3 + (long)local_c * 4)) { local_14 = local_14 + 1; break; } } local_10 = local_10 + 1; } while( true ); }
5,677
func0
#include <assert.h>
int func0(const int *tup, int tup_size, const int *lst, int lst_size) { int count = 0; for (int i = 0; i < tup_size; i++) { for (int j = 0; j < lst_size; j++) { if (tup[i] == lst[j]) { count++; break; } } } return count; }
int main() { int tup1[] = {'a', 'a', 'c', 'b', 'd'}; int lst1[] = {'a', 'b'}; assert(func0(tup1, 5, lst1, 2) == 3); int tup2[] = {1, 2, 3, 1, 4, 6, 7, 1, 4}; int lst2[] = {1, 4, 7}; assert(func0(tup2, 9, lst2, 3) == 6); int tup3[] = {1, 2, 3, 4, 5, 6}; int lst3[] = {1, 2}; assert(func0(tup3, 6, lst3, 2) == 2); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11b3 <func0+0x4a> mov %rdi,%r8 lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%r9 mov %rdx,%r10 lea -0x1(%rcx),%eax lea 0x4(%rdx,%rax,4),%rsi mov $0x0,%edi jmp 119a <func0+0x31> add $0x1,%edi add $0x4,%r8 cmp %r9,%r8 je 11b8 <func0+0x4f> test %ecx,%ecx jle 1191 <func0+0x28> mov (%r8),%edx mov %r10,%rax cmp (%rax),%edx je 118e <func0+0x25> add $0x4,%rax cmp %rsi,%rax jne 11a4 <func0+0x3b> jmp 1191 <func0+0x28> mov $0x0,%edi mov %edi,%eax retq
func0: endbr64 test esi, esi jle short loc_11B2 mov r8, rdi lea eax, [rsi-1] lea r10, [rdi+rax*4+4] lea eax, [rcx-1] lea rdi, [rdx+rax*4+4] mov r9d, 0 jmp short loc_1199 loc_118C: add r9d, 1 loc_1190: add r8, 4 cmp r8, r10 jz short loc_11B8 loc_1199: test ecx, ecx jle short loc_1190 mov esi, [r8] mov rax, rdx loc_11A3: cmp esi, [rax] jz short loc_118C add rax, 4 cmp rax, rdi jnz short loc_11A3 jmp short loc_1190 loc_11B2: mov r9d, 0 loc_11B8: mov eax, r9d retn
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4) { _DWORD *v4; // r8 unsigned int v5; // r9d _DWORD *v6; // rax if ( a2 <= 0 ) { return 0; } else { v4 = a1; v5 = 0; do { if ( a4 > 0 ) { v6 = a3; while ( *v4 != *v6 ) { if ( ++v6 == &a3[a4 - 1 + 1] ) goto LABEL_4; } ++v5; } LABEL_4: ++v4; } while ( v4 != &a1[a2 - 1 + 1] ); } return v5; }
5,678
func0
#include <assert.h>
int func0(const int *tup, int tup_size, const int *lst, int lst_size) { int count = 0; for (int i = 0; i < tup_size; i++) { for (int j = 0; j < lst_size; j++) { if (tup[i] == lst[j]) { count++; break; } } } return count; }
int main() { int tup1[] = {'a', 'a', 'c', 'b', 'd'}; int lst1[] = {'a', 'b'}; assert(func0(tup1, 5, lst1, 2) == 3); int tup2[] = {1, 2, 3, 1, 4, 6, 7, 1, 4}; int lst2[] = {1, 4, 7}; assert(func0(tup2, 9, lst2, 3) == 6); int tup3[] = {1, 2, 3, 4, 5, 6}; int lst3[] = {1, 2}; assert(func0(tup3, 6, lst3, 2) == 2); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 139e <func0+0x4e> lea -0x1(%rsi),%eax mov %rdi,%r8 xor %r9d,%r9d lea 0x4(%rdi,%rax,4),%r10 lea -0x1(%rcx),%eax lea 0x4(%rdx,%rax,4),%rdi xchg %ax,%ax test %ecx,%ecx jle 1391 <func0+0x41> mov (%r8),%esi mov %rdx,%rax jmp 1389 <func0+0x39> nopl 0x0(%rax) add $0x4,%rax cmp %rdi,%rax je 1391 <func0+0x41> cmp (%rax),%esi jne 1380 <func0+0x30> add $0x1,%r9d add $0x4,%r8 cmp %r10,%r8 jne 1370 <func0+0x20> mov %r9d,%eax retq xor %r9d,%r9d mov %r9d,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle short loc_137E lea eax, [rsi-1] xor r9d, r9d lea r10, [rdi+rax*4+4] lea eax, [rcx-1] lea r8, [rdx+rax*4+4] nop dword ptr [rax+rax+00h] loc_1350: test ecx, ecx jle short loc_1371 mov esi, [rdi] mov rax, rdx jmp short loc_1369 loc_1360: add rax, 4 cmp rax, r8 jz short loc_1371 loc_1369: cmp esi, [rax] jnz short loc_1360 add r9d, 1 loc_1371: add rdi, 4 cmp rdi, r10 jnz short loc_1350 mov eax, r9d retn loc_137E: xor r9d, r9d mov eax, r9d retn
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4) { unsigned int v4; // r9d long long v5; // r10 _DWORD *v6; // rax if ( a2 <= 0 ) return 0LL; v4 = 0; v5 = (long long)&a1[a2 - 1 + 1]; do { if ( a4 > 0 ) { v6 = a3; while ( *a1 != *v6 ) { if ( ++v6 == &a3[a4 - 1 + 1] ) goto LABEL_8; } ++v4; } LABEL_8: ++a1; } while ( a1 != (_DWORD *)v5 ); return v4; }
func0: ENDBR64 TEST ESI,ESI JLE 0x0010137e LEA EAX,[RSI + -0x1] XOR R9D,R9D LEA R10,[RDI + RAX*0x4 + 0x4] LEA EAX,[RCX + -0x1] LEA R8,[RDX + RAX*0x4 + 0x4] NOP dword ptr [RAX + RAX*0x1] LAB_00101350: TEST ECX,ECX JLE 0x00101371 MOV ESI,dword ptr [RDI] MOV RAX,RDX JMP 0x00101369 LAB_00101360: ADD RAX,0x4 CMP RAX,R8 JZ 0x00101371 LAB_00101369: CMP ESI,dword ptr [RAX] JNZ 0x00101360 ADD R9D,0x1 LAB_00101371: ADD RDI,0x4 CMP RDI,R10 JNZ 0x00101350 MOV EAX,R9D RET LAB_0010137e: XOR R9D,R9D MOV EAX,R9D RET
int func0(int *param_1,int param_2,int *param_3,int param_4) { int *piVar1; int *piVar2; int iVar3; if (param_2 < 1) { return 0; } iVar3 = 0; piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if (0 < param_4) { piVar2 = param_3; do { if (*param_1 == *piVar2) { iVar3 = iVar3 + 1; break; } piVar2 = piVar2 + 1; } while (piVar2 != param_3 + (ulong)(param_4 - 1) + 1); } param_1 = param_1 + 1; if (param_1 == piVar1) { return iVar3; } } while( true ); }
5,679
func0
#include <assert.h>
int func0(const int *tup, int tup_size, const int *lst, int lst_size) { int count = 0; for (int i = 0; i < tup_size; i++) { for (int j = 0; j < lst_size; j++) { if (tup[i] == lst[j]) { count++; break; } } } return count; }
int main() { int tup1[] = {'a', 'a', 'c', 'b', 'd'}; int lst1[] = {'a', 'b'}; assert(func0(tup1, 5, lst1, 2) == 3); int tup2[] = {1, 2, 3, 1, 4, 6, 7, 1, 4}; int lst2[] = {1, 4, 7}; assert(func0(tup2, 9, lst2, 3) == 6); int tup3[] = {1, 2, 3, 4, 5, 6}; int lst3[] = {1, 2}; assert(func0(tup3, 6, lst3, 2) == 2); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 132e <func0+0x4e> lea -0x1(%rsi),%eax mov %rdi,%r8 xor %r9d,%r9d lea 0x4(%rdi,%rax,4),%r10 lea -0x1(%rcx),%eax lea 0x4(%rdx,%rax,4),%rdi xchg %ax,%ax test %ecx,%ecx jle 1321 <func0+0x41> mov (%r8),%esi mov %rdx,%rax jmp 1319 <func0+0x39> nopl 0x0(%rax) add $0x4,%rax cmp %rdi,%rax je 1321 <func0+0x41> cmp (%rax),%esi jne 1310 <func0+0x30> add $0x1,%r9d add $0x4,%r8 cmp %r10,%r8 jne 1300 <func0+0x20> mov %r9d,%eax retq xor %r9d,%r9d mov %r9d,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle short loc_115C movsxd rsi, esi lea r9, [rdi+rsi*4] loc_114F: test ecx, ecx jg short loc_1163 add rdi, 4 cmp rdi, r9 jnz short loc_114F loc_115C: xor r8d, r8d mov eax, r8d retn loc_1163: movsxd rcx, ecx xor r8d, r8d lea rsi, [rdx+rcx*4] nop dword ptr [rax] loc_1170: mov ecx, [rdi] mov rax, rdx jmp short loc_1189 loc_1180: add rax, 4 cmp rax, rsi jz short loc_11A0 loc_1189: cmp ecx, [rax] jnz short loc_1180 add rdi, 4 add r8d, 1 cmp rdi, r9 jnz short loc_1170 mov eax, r8d retn loc_11A0: add rdi, 4 cmp rdi, r9 jnz short loc_1170 mov eax, r8d retn
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4) { _DWORD *v4; // r9 unsigned int v6; // r8d _DWORD *v7; // rax if ( a2 <= 0 ) return 0LL; v4 = &a1[a2]; while ( a4 <= 0 ) { if ( ++a1 == v4 ) return 0LL; } v6 = 0; LABEL_7: while ( 2 ) { v7 = a3; do { if ( *a1 == *v7 ) { ++a1; ++v6; if ( a1 != v4 ) goto LABEL_7; return v6; } ++v7; } while ( v7 != &a3[a4] ); if ( ++a1 != v4 ) continue; return v6; } }
func0: ENDBR64 TEST ESI,ESI JLE 0x0010115c MOVSXD RSI,ESI LEA R9,[RDI + RSI*0x4] LAB_0010114f: TEST ECX,ECX JG 0x00101163 ADD RDI,0x4 CMP RDI,R9 JNZ 0x0010114f LAB_0010115c: XOR R8D,R8D MOV EAX,R8D RET LAB_00101163: MOVSXD RCX,ECX XOR R8D,R8D LEA RSI,[RDX + RCX*0x4] NOP dword ptr [RAX] LAB_00101170: MOV ECX,dword ptr [RDI] MOV RAX,RDX JMP 0x00101189 LAB_00101180: ADD RAX,0x4 CMP RAX,RSI JZ 0x001011a0 LAB_00101189: CMP ECX,dword ptr [RAX] JNZ 0x00101180 ADD RDI,0x4 ADD R8D,0x1 CMP RDI,R9 JNZ 0x00101170 MOV EAX,R8D RET LAB_001011a0: ADD RDI,0x4 CMP RDI,R9 JNZ 0x00101170 MOV EAX,R8D RET
int func0(int *param_1,int param_2,int *param_3,int param_4) { int *piVar1; int *piVar2; int iVar3; if (0 < param_2) { piVar1 = param_1 + param_2; do { if (0 < param_4) { iVar3 = 0; LAB_00101170: do { piVar2 = param_3; do { if (*param_1 == *piVar2) { param_1 = param_1 + 1; iVar3 = iVar3 + 1; if (param_1 == piVar1) { return iVar3; } goto LAB_00101170; } piVar2 = piVar2 + 1; } while (piVar2 != param_3 + param_4); param_1 = param_1 + 1; if (param_1 == piVar1) { return iVar3; } } while( true ); } param_1 = param_1 + 1; } while (param_1 != piVar1); } return 0; }
5,680
func0
#include <assert.h> #include <stdio.h>
int* func0(int nums[], int size) { static int cubes[100]; for (int i = 0; i < size; i++) { cubes[i] = nums[i] * nums[i] * nums[i]; } return cubes; }
int main() { int arr1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int expected1[] = {1, 8, 27, 64, 125, 216, 343, 512, 729, 1000}; int* result1 = func0(arr1, 10); for (int i = 0; i < 10; i++) { assert(result1[i] == expected1[i]); } int arr2[] = {10, 20, 30}; int expected2[] = {1000, 8000, 27000}; int* result2 = func0(arr2, 3); for (int i = 0; i < 3; i++) { assert(result2[i] == expected2[i]); } int arr3[] = {12, 15}; int expected3[] = {1728, 3375}; int* result3 = func0(arr3, 2); for (int i = 0; i < 2; i++) { assert(result3[i] == expected3[i]); } printf("All test cases passed successfully!\n"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0x4(%rbp) jmp 1205 <func0+0x7c> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%eax imul %eax,%edx mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%eax imul %edx,%eax mov -0x4(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx lea 0x2e42(%rip),%rdx mov %eax,(%rcx,%rdx,1) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11a1 <func0+0x18> lea 0x2e2c(%rip),%rax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_4], 0 jmp short loc_1205 loc_11A1: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_4] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rcx mov eax, [rax] imul edx, eax mov eax, [rbp+var_4] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rcx mov eax, [rax] imul eax, edx mov edx, [rbp+var_4] movsxd rdx, edx lea rcx, ds:0[rdx*4] lea rdx, cubes_1 mov [rcx+rdx], eax add [rbp+var_4], 1 loc_1205: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_11A1 lea rax, cubes_1 pop rbp retn
_DWORD * func0(long long a1, int a2) { int i; // [rsp+18h] [rbp-4h] for ( i = 0; i < a2; ++i ) cubes_1[i] = *(_DWORD *)(4LL * i + a1) * *(_DWORD *)(4LL * i + a1) * *(_DWORD *)(4LL * i + a1); return cubes_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101205 LAB_001011a1: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV EAX,dword ptr [RAX] IMUL EDX,EAX MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV EAX,dword ptr [RAX] IMUL EAX,EDX MOV EDX,dword ptr [RBP + -0x4] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] LEA RDX,[0x104040] MOV dword ptr [RCX + RDX*0x1],EAX ADD dword ptr [RBP + -0x4],0x1 LAB_00101205: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011a1 LEA RAX,[0x104040] POP RBP RET
int1 * func0(long param_1,int param_2) { int local_c; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { *(int *)(cubes_1 + (long)local_c * 4) = *(int *)(param_1 + (long)local_c * 4) * *(int *)(param_1 + (long)local_c * 4) * *(int *)(param_1 + (long)local_c * 4); } return cubes_1; }
5,681
func0
#include <assert.h> #include <stdio.h>
int* func0(int nums[], int size) { static int cubes[100]; for (int i = 0; i < size; i++) { cubes[i] = nums[i] * nums[i] * nums[i]; } return cubes; }
int main() { int arr1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int expected1[] = {1, 8, 27, 64, 125, 216, 343, 512, 729, 1000}; int* result1 = func0(arr1, 10); for (int i = 0; i < 10; i++) { assert(result1[i] == expected1[i]); } int arr2[] = {10, 20, 30}; int expected2[] = {1000, 8000, 27000}; int* result2 = func0(arr2, 3); for (int i = 0; i < 3; i++) { assert(result2[i] == expected2[i]); } int arr3[] = {12, 15}; int expected3[] = {1728, 3375}; int* result3 = func0(arr3, 2); for (int i = 0; i < 2; i++) { assert(result3[i] == expected3[i]); } printf("All test cases passed successfully!\n"); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11bb <func0+0x32> lea -0x1(%rsi),%r8d mov $0x0,%eax lea 0x2e9f(%rip),%rsi mov (%rdi,%rax,4),%ecx mov %ecx,%edx imul %ecx,%edx imul %ecx,%edx mov %edx,(%rsi,%rax,4) mov %rax,%rdx add $0x1,%rax cmp %r8,%rdx jne 11a1 <func0+0x18> lea 0x2e7e(%rip),%rax retq
func0: endbr64 test esi, esi jle short loc_11B7 mov esi, esi mov eax, 0 lea r8, cubes_1 loc_119F: mov ecx, [rdi+rax*4] mov edx, ecx imul edx, ecx imul edx, ecx mov [r8+rax*4], edx add rax, 1 cmp rax, rsi jnz short loc_119F loc_11B7: lea rax, cubes_1 retn
_DWORD * func0(long long a1, int a2) { long long i; // rax if ( a2 > 0 ) { for ( i = 0LL; i != a2; ++i ) cubes_1[i] = *(_DWORD *)(a1 + 4 * i) * *(_DWORD *)(a1 + 4 * i) * *(_DWORD *)(a1 + 4 * i); } return cubes_1; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001011b7 MOV ESI,ESI MOV EAX,0x0 LEA R8,[0x104040] LAB_0010119f: MOV ECX,dword ptr [RDI + RAX*0x4] MOV EDX,ECX IMUL EDX,ECX IMUL EDX,ECX MOV dword ptr [R8 + RAX*0x4],EDX ADD RAX,0x1 CMP RAX,RSI JNZ 0x0010119f LAB_001011b7: LEA RAX,[0x104040] RET
int4 * func0(long param_1,uint param_2) { int iVar1; ulong uVar2; if (0 < (int)param_2) { uVar2 = 0; do { iVar1 = *(int *)(param_1 + uVar2 * 4); (&cubes_1)[uVar2] = iVar1 * iVar1 * iVar1; uVar2 = uVar2 + 1; } while (uVar2 != param_2); } return &cubes_1; }