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,682
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; }
O2
c
func0: endbr64 test %esi,%esi jle 1322 <func0+0x32> lea -0x1(%rsi),%r8d xor %eax,%eax lea 0x2d3b(%rip),%rsi nopl (%rax) 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 %rdx,%r8 jne 1308 <func0+0x18> lea 0x2d17(%rip),%rax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 lea r8, cubes_1 test esi, esi jle short loc_1320 movsxd rsi, esi xor eax, eax nop dword ptr [rax+00h] loc_1308: mov ecx, [rdi+rax*4] mov edx, ecx imul edx, ecx imul edx, ecx mov [r8+rax*4], edx add rax, 1 cmp rsi, rax jnz short loc_1308 loc_1320: mov rax, r8 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 LEA R8,[0x104040] TEST ESI,ESI JLE 0x00101320 MOVSXD RSI,ESI XOR EAX,EAX NOP dword ptr [RAX] LAB_00101308: 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 RSI,RAX JNZ 0x00101308 LAB_00101320: MOV RAX,R8 RET
int4 * func0(long param_1,int param_2) { int iVar1; long lVar2; if (0 < param_2) { lVar2 = 0; do { iVar1 = *(int *)(param_1 + lVar2 * 4); (&cubes_1)[lVar2] = iVar1 * iVar1 * iVar1; lVar2 = lVar2 + 1; } while (param_2 != lVar2); } return &cubes_1; }
5,683
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; }
O3
c
func0: endbr64 test %esi,%esi jle 13bb <func0+0xeb> lea 0xf(%rdi),%rcx lea 0x2d59(%rip),%rdx sub %rdx,%rcx lea -0x1(%rsi),%eax cmp $0x1e,%rcx jbe 13c8 <func0+0xf8> cmp $0x3,%eax jbe 13c8 <func0+0xf8> mov %esi,%ecx xor %eax,%eax shr $0x2,%ecx shl $0x4,%rcx nopl 0x0(%rax,%rax,1) movdqu (%rdi,%rax,1),%xmm2 movdqa %xmm2,%xmm3 movdqa %xmm2,%xmm1 psrlq $0x20,%xmm3 pmuludq %xmm2,%xmm1 movdqa %xmm3,%xmm4 pmuludq %xmm3,%xmm4 pshufd $0x8,%xmm1,%xmm0 pshufd $0x8,%xmm4,%xmm1 punpckldq %xmm1,%xmm0 pmuludq %xmm0,%xmm2 psrlq $0x20,%xmm0 pmuludq %xmm3,%xmm0 pshufd $0x8,%xmm2,%xmm2 pshufd $0x8,%xmm0,%xmm0 punpckldq %xmm0,%xmm2 movaps %xmm2,(%rdx,%rax,1) add $0x10,%rax cmp %rcx,%rax jne 1310 <func0+0x40> mov %esi,%eax and $0xfffffffc,%eax test $0x3,%sil je 13bb <func0+0xeb> mov %eax,%ecx movslq %eax,%r9 mov (%rdi,%rcx,4),%r8d mov %r8d,%ecx imul %r8d,%ecx imul %r8d,%ecx mov %ecx,(%rdx,%r9,4) lea 0x1(%rax),%ecx cmp %ecx,%esi jle 13bb <func0+0xeb> movslq %ecx,%rcx add $0x2,%eax mov (%rdi,%rcx,4),%r9d mov %r9d,%r8d imul %r9d,%r8d imul %r9d,%r8d mov %r8d,(%rdx,%rcx,4) cmp %eax,%esi jle 13bb <func0+0xeb> cltq mov (%rdi,%rax,4),%esi mov %esi,%ecx imul %esi,%ecx imul %esi,%ecx mov %ecx,(%rdx,%rax,4) lea 0x2c7e(%rip),%rax retq nopl 0x0(%rax,%rax,1) mov %eax,%r8d xor %eax,%eax nopl (%rax) mov (%rdi,%rax,4),%esi mov %esi,%ecx imul %esi,%ecx imul %esi,%ecx mov %ecx,(%rdx,%rax,4) mov %rax,%rcx add $0x1,%rax cmp %r8,%rcx jne 13d0 <func0+0x100> lea 0x2c4f(%rip),%rax retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 movsxd rax, esi lea r8, cubes_1 test eax, eax jle short loc_1200 lea edx, [rax-1] cmp edx, 2 jbe short loc_11DA lea rcx, [rdi+4] mov rdx, r8 sub rdx, rcx cmp rdx, 8 ja short loc_1208 loc_11DA: lea rsi, ds:0[rax*4] xor eax, eax nop dword ptr [rax+00h] loc_11E8: mov ecx, [rdi+rax] mov edx, ecx imul edx, ecx imul edx, ecx mov [r8+rax], edx add rax, 4 cmp rsi, rax jnz short loc_11E8 loc_1200: mov rax, r8 retn loc_1208: mov ecx, eax xor edx, edx shr ecx, 2 shl rcx, 4 nop dword ptr [rax+rax+00h] loc_1218: movdqu xmm1, xmmword ptr [rdi+rdx] movdqa xmm2, xmm1 movdqa xmm0, xmm1 psrlq xmm2, 20h ; ' ' pmuludq xmm0, xmm1 movdqa xmm3, xmm2 pmuludq xmm3, xmm2 pshufd xmm0, xmm0, 8 pshufd xmm3, xmm3, 8 punpckldq xmm0, xmm3 pmuludq xmm1, xmm0 psrlq xmm0, 20h ; ' ' pmuludq xmm0, xmm2 pshufd xmm1, xmm1, 8 pshufd xmm0, xmm0, 8 punpckldq xmm1, xmm0 movaps xmmword ptr [r8+rdx], xmm1 add rdx, 10h cmp rdx, rcx jnz short loc_1218 mov edx, eax and edx, 0FFFFFFFCh test al, 3 jz short loc_1200 mov ecx, edx movsxd r9, edx mov esi, [rdi+rcx*4] lea r10, ds:0[rcx*4] mov ecx, esi imul ecx, esi imul ecx, esi mov [r8+r9*4], ecx lea ecx, [rdx+1] cmp eax, ecx jle loc_1200 mov r9d, [rdi+r10+4] movsxd rcx, ecx add edx, 2 mov esi, r9d imul esi, r9d imul esi, r9d mov [r8+rcx*4], esi cmp eax, edx jle loc_1200 mov ecx, [rdi+r10+8] movsxd rdx, edx mov eax, ecx imul eax, ecx imul eax, ecx mov [r8+rdx*4], eax mov rax, r8 retn
long long * func0(long long a1, int a2) { long long v2; // rsi long long v3; // rax long long v5; // rdx __m128i v6; // xmm1 __m128i v7; // xmm2 __m128i v8; // xmm0 unsigned int v9; // edx long long v10; // r10 signed int v11; // ecx int v12; // edx if ( a2 <= 0 ) return cubes_1; if ( (unsigned int)(a2 - 1) <= 2 || (unsigned long long)cubes_1 - a1 - 4 <= 8 ) { v2 = 4LL * a2; v3 = 0LL; do { *(_DWORD *)((char *)cubes_1 + v3) = *(_DWORD *)(a1 + v3) * *(_DWORD *)(a1 + v3) * *(_DWORD *)(a1 + v3); v3 += 4LL; } while ( v2 != v3 ); return cubes_1; } v5 = 0LL; do { v6 = _mm_loadu_si128((const __m128i *)(a1 + v5 * 8)); v7 = _mm_srli_epi64(v6, 0x20u); v8 = _mm_unpacklo_epi32(_mm_shuffle_epi32(_mm_mul_epu32(v6, v6), 8), _mm_shuffle_epi32(_mm_mul_epu32(v7, v7), 8)); *(__m128i *)&cubes_1[v5] = _mm_unpacklo_epi32( _mm_shuffle_epi32(_mm_mul_epu32(v6, v8), 8), _mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_epi64(v8, 0x20u), v7), 8)); v5 += 2LL; } while ( v5 != 2LL * ((unsigned int)a2 >> 2) ); v9 = a2 & 0xFFFFFFFC; if ( (a2 & 3) == 0 ) return cubes_1; v10 = 4LL * v9; *((_DWORD *)cubes_1 + (int)v9) = *(_DWORD *)(a1 + v10) * *(_DWORD *)(a1 + v10) * *(_DWORD *)(a1 + v10); v11 = v9 + 1; if ( a2 <= (int)(v9 + 1) ) return cubes_1; v12 = v9 + 2; *((_DWORD *)cubes_1 + v11) = *(_DWORD *)(a1 + v10 + 4) * *(_DWORD *)(a1 + v10 + 4) * *(_DWORD *)(a1 + v10 + 4); if ( a2 <= v12 ) return cubes_1; *((_DWORD *)cubes_1 + v12) = *(_DWORD *)(a1 + v10 + 8) * *(_DWORD *)(a1 + v10 + 8) * *(_DWORD *)(a1 + v10 + 8); return cubes_1; }
func0: ENDBR64 MOVSXD RAX,ESI LEA R8,[0x104040] TEST EAX,EAX JLE 0x00101200 LEA EDX,[RAX + -0x1] CMP EDX,0x2 JBE 0x001011da LEA RCX,[RDI + 0x4] MOV RDX,R8 SUB RDX,RCX CMP RDX,0x8 JA 0x00101208 LAB_001011da: LEA RSI,[RAX*0x4] XOR EAX,EAX NOP dword ptr [RAX] LAB_001011e8: MOV ECX,dword ptr [RDI + RAX*0x1] MOV EDX,ECX IMUL EDX,ECX IMUL EDX,ECX MOV dword ptr [R8 + RAX*0x1],EDX ADD RAX,0x4 CMP RSI,RAX JNZ 0x001011e8 LAB_00101200: MOV RAX,R8 RET LAB_00101208: MOV ECX,EAX XOR EDX,EDX SHR ECX,0x2 SHL RCX,0x4 NOP dword ptr [RAX + RAX*0x1] LAB_00101218: MOVDQU XMM1,xmmword ptr [RDI + RDX*0x1] MOVDQA XMM2,XMM1 MOVDQA XMM0,XMM1 PSRLQ XMM2,0x20 PMULUDQ XMM0,XMM1 MOVDQA XMM3,XMM2 PMULUDQ XMM3,XMM2 PSHUFD XMM0,XMM0,0x8 PSHUFD XMM3,XMM3,0x8 PUNPCKLDQ XMM0,XMM3 PMULUDQ XMM1,XMM0 PSRLQ XMM0,0x20 PMULUDQ XMM0,XMM2 PSHUFD XMM1,XMM1,0x8 PSHUFD XMM0,XMM0,0x8 PUNPCKLDQ XMM1,XMM0 MOVAPS xmmword ptr [R8 + RDX*0x1],XMM1 ADD RDX,0x10 CMP RDX,RCX JNZ 0x00101218 MOV EDX,EAX AND EDX,0xfffffffc TEST AL,0x3 JZ 0x00101200 MOV ECX,EDX MOVSXD R9,EDX MOV ESI,dword ptr [RDI + RCX*0x4] LEA R10,[RCX*0x4] MOV ECX,ESI IMUL ECX,ESI IMUL ECX,ESI MOV dword ptr [R8 + R9*0x4],ECX LEA ECX,[RDX + 0x1] CMP EAX,ECX JLE 0x00101200 MOV R9D,dword ptr [RDI + R10*0x1 + 0x4] MOVSXD RCX,ECX ADD EDX,0x2 MOV ESI,R9D IMUL ESI,R9D IMUL ESI,R9D MOV dword ptr [R8 + RCX*0x4],ESI CMP EAX,EDX JLE 0x00101200 MOV ECX,dword ptr [RDI + R10*0x1 + 0x8] MOVSXD RDX,EDX MOV EAX,ECX IMUL EAX,ECX IMUL EAX,ECX MOV dword ptr [R8 + RDX*0x4],EAX MOV RAX,R8 RET
int4 * func0(long param_1,uint param_2) { int auVar1 [16]; long lVar2; uint uVar3; int iVar4; long lVar6; int auVar5 [16]; ulong uVar7; if (0 < (int)param_2) { if ((param_2 - 1 < 3) || ((ulong)((long)&cubes_1 - (param_1 + 4)) < 9)) { lVar2 = 0; do { iVar4 = *(int *)(param_1 + lVar2); *(int *)((long)&cubes_1 + lVar2) = iVar4 * iVar4 * iVar4; lVar2 = lVar2 + 4; } while ((long)(int)param_2 * 4 - lVar2 != 0); } else { lVar2 = 0; do { auVar1 = *(int (*) [16])(param_1 + lVar2); uVar7 = auVar1._8_8_; iVar4 = auVar1._0_4_; lVar6 = (uVar7 & 0xffffffff) * (ulong)auVar1._8_4_; auVar5._8_4_ = (int4)lVar6; auVar5._0_8_ = lVar6 << 0x20; auVar5._12_4_ = (int)((uVar7 >> 0x20) * (ulong)auVar1._12_4_); *(ulong *)((long)&cubes_1 + lVar2) = CONCAT44((int)(((auVar1._0_8_ >> 0x20) * (ulong)auVar1._4_4_ & 0xffffffff) * (ulong)auVar1._4_4_),iVar4 * iVar4 * iVar4); *(int *)(&DAT_00104050 + lVar2) = (int)((uVar7 & 0xffffffff) * (auVar5._8_8_ & 0xffffffff)); *(int *)(lVar2 + 0x104054) = (int)((auVar5._8_8_ >> 0x20) * (ulong)auVar1._12_4_); lVar2 = lVar2 + 0x10; } while (lVar2 != (ulong)(param_2 >> 2) << 4); uVar3 = param_2 & 0xfffffffc; if (((long)(int)param_2 & 3U) != 0) { iVar4 = *(int *)(param_1 + (ulong)uVar3 * 4); lVar2 = (ulong)uVar3 * 4; (&cubes_1)[(int)uVar3] = iVar4 * iVar4 * iVar4; if ((int)(uVar3 + 1) < (int)param_2) { iVar4 = *(int *)(param_1 + 4 + lVar2); (&cubes_1)[(int)(uVar3 + 1)] = iVar4 * iVar4 * iVar4; if ((int)(uVar3 + 2) < (int)param_2) { iVar4 = *(int *)(param_1 + 8 + lVar2); (&cubes_1)[(int)(uVar3 + 2)] = iVar4 * iVar4 * iVar4; return &cubes_1; } } } } } return &cubes_1; }
5,684
func0
#include <assert.h>
int func0(int n) { int a = 3, b = 0, c = 2; if (n == 0) return 3; if (n == 1) return 3; if (n == 2) return 5; int sum = 5; while (n > 2) { int d = a + b; sum += d; a = b; b = c; c = d; n--; } return sum; }
int main() { assert(func0(9) == 49); assert(func0(10) == 66); assert(func0(11) == 88); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x24(%rbp) movl $0x3,-0x14(%rbp) movl $0x0,-0x10(%rbp) movl $0x2,-0xc(%rbp) cmpl $0x0,-0x24(%rbp) jne 1176 <func0+0x2d> mov $0x3,%eax jmp 11c9 <func0+0x80> cmpl $0x1,-0x24(%rbp) jne 1183 <func0+0x3a> mov $0x3,%eax jmp 11c9 <func0+0x80> cmpl $0x2,-0x24(%rbp) jne 1190 <func0+0x47> mov $0x5,%eax jmp 11c9 <func0+0x80> movl $0x5,-0x8(%rbp) jmp 11c0 <func0+0x77> mov -0x14(%rbp),%edx mov -0x10(%rbp),%eax add %edx,%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax add %eax,-0x8(%rbp) mov -0x10(%rbp),%eax mov %eax,-0x14(%rbp) mov -0xc(%rbp),%eax mov %eax,-0x10(%rbp) mov -0x4(%rbp),%eax mov %eax,-0xc(%rbp) subl $0x1,-0x24(%rbp) cmpl $0x2,-0x24(%rbp) jg 1199 <func0+0x50> mov -0x8(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_24], edi mov [rbp+var_14], 3 mov [rbp+var_10], 0 mov [rbp+var_C], 2 cmp [rbp+var_24], 0 jnz short loc_1176 mov eax, 3 jmp short loc_11C9 loc_1176: cmp [rbp+var_24], 1 jnz short loc_1183 mov eax, 3 jmp short loc_11C9 loc_1183: cmp [rbp+var_24], 2 jnz short loc_1190 mov eax, 5 jmp short loc_11C9 loc_1190: mov [rbp+var_8], 5 jmp short loc_11C0 loc_1199: mov edx, [rbp+var_14] mov eax, [rbp+var_10] add eax, edx mov [rbp+var_4], eax mov eax, [rbp+var_4] add [rbp+var_8], eax mov eax, [rbp+var_10] mov [rbp+var_14], eax mov eax, [rbp+var_C] mov [rbp+var_10], eax mov eax, [rbp+var_4] mov [rbp+var_C], eax sub [rbp+var_24], 1 loc_11C0: cmp [rbp+var_24], 2 jg short loc_1199 mov eax, [rbp+var_8] loc_11C9: pop rbp retn
long long func0(int a1) { int v2; // [rsp+0h] [rbp-24h] int v3; // [rsp+10h] [rbp-14h] int v4; // [rsp+14h] [rbp-10h] int v5; // [rsp+18h] [rbp-Ch] unsigned int v6; // [rsp+1Ch] [rbp-8h] int v7; // [rsp+20h] [rbp-4h] v2 = a1; v3 = 3; v4 = 0; v5 = 2; switch ( a1 ) { case 0: return 3LL; case 1: return 3LL; case 2: return 5LL; } v6 = 5; while ( v2 > 2 ) { v7 = v3 + v4; v6 += v3 + v4; v3 = v4; v4 = v5; v5 = v7; --v2; } return v6; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x24],EDI MOV dword ptr [RBP + -0x14],0x3 MOV dword ptr [RBP + -0x10],0x0 MOV dword ptr [RBP + -0xc],0x2 CMP dword ptr [RBP + -0x24],0x0 JNZ 0x00101176 MOV EAX,0x3 JMP 0x001011c9 LAB_00101176: CMP dword ptr [RBP + -0x24],0x1 JNZ 0x00101183 MOV EAX,0x3 JMP 0x001011c9 LAB_00101183: CMP dword ptr [RBP + -0x24],0x2 JNZ 0x00101190 MOV EAX,0x5 JMP 0x001011c9 LAB_00101190: MOV dword ptr [RBP + -0x8],0x5 JMP 0x001011c0 LAB_00101199: MOV EDX,dword ptr [RBP + -0x14] MOV EAX,dword ptr [RBP + -0x10] ADD EAX,EDX MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] ADD dword ptr [RBP + -0x8],EAX MOV EAX,dword ptr [RBP + -0x10] MOV dword ptr [RBP + -0x14],EAX MOV EAX,dword ptr [RBP + -0xc] MOV dword ptr [RBP + -0x10],EAX MOV EAX,dword ptr [RBP + -0x4] MOV dword ptr [RBP + -0xc],EAX SUB dword ptr [RBP + -0x24],0x1 LAB_001011c0: CMP dword ptr [RBP + -0x24],0x2 JG 0x00101199 MOV EAX,dword ptr [RBP + -0x8] LAB_001011c9: POP RBP RET
int func0(int param_1) { int iVar1; int4 local_2c; int4 local_1c; int4 local_18; int4 local_14; int4 local_10; local_1c = 3; local_18 = 0; local_14 = 2; if (param_1 == 0) { local_10 = 3; } else if (param_1 == 1) { local_10 = 3; } else if (param_1 == 2) { local_10 = 5; } else { local_10 = 5; for (local_2c = param_1; 2 < local_2c; local_2c = local_2c + -1) { iVar1 = local_18 + local_1c; local_10 = local_10 + iVar1; local_1c = local_18; local_18 = local_14; local_14 = iVar1; } } return local_10; }
5,685
func0
#include <assert.h>
int func0(int n) { int a = 3, b = 0, c = 2; if (n == 0) return 3; if (n == 1) return 3; if (n == 2) return 5; int sum = 5; while (n > 2) { int d = a + b; sum += d; a = b; b = c; c = d; n--; } return sum; }
int main() { assert(func0(9) == 49); assert(func0(10) == 66); assert(func0(11) == 88); return 0; }
O1
c
func0: endbr64 mov $0x3,%ecx cmp $0x1,%edi jbe 1188 <func0+0x3f> cmp $0x2,%edi jle 118b <func0+0x42> mov $0x5,%ecx mov $0x2,%r8d mov $0x0,%eax mov $0x3,%esi jmp 1176 <func0+0x2d> mov %edx,%r8d lea (%rsi,%rax,1),%edx add %edx,%ecx sub $0x1,%edi mov %eax,%esi mov %r8d,%eax cmp $0x2,%edi jne 1173 <func0+0x2a> mov %ecx,%eax retq mov $0x5,%ecx jmp 1188 <func0+0x3f>
func0: endbr64 mov ecx, 3 cmp edi, 1 jbe short loc_1188 cmp edi, 2 jle short loc_118B mov ecx, 5 mov r8d, 2 mov eax, 0 mov esi, 3 jmp short loc_1176 loc_1173: mov r8d, edx loc_1176: lea edx, [rsi+rax] add ecx, edx sub edi, 1 mov esi, eax mov eax, r8d cmp edi, 2 jnz short loc_1173 loc_1188: mov eax, ecx retn loc_118B: mov ecx, 5 jmp short loc_1188
long long func0(int a1) { unsigned int v1; // ecx int v2; // r8d int v3; // eax int v4; // esi int v5; // edx v1 = 3; if ( (unsigned int)a1 > 1 ) { if ( a1 <= 2 ) { return 5; } else { v1 = 5; v2 = 2; v3 = 0; v4 = 3; while ( 1 ) { v5 = v4 + v3; v1 += v4 + v3; --a1; v4 = v3; v3 = v2; if ( a1 == 2 ) break; v2 = v5; } } } return v1; }
func0: ENDBR64 MOV ECX,0x3 CMP EDI,0x1 JBE 0x00101188 CMP EDI,0x2 JLE 0x0010118b MOV ECX,0x5 MOV R8D,0x2 MOV EAX,0x0 MOV ESI,0x3 JMP 0x00101176 LAB_00101173: MOV R8D,EDX LAB_00101176: LEA EDX,[RSI + RAX*0x1] ADD ECX,EDX SUB EDI,0x1 MOV ESI,EAX MOV EAX,R8D CMP EDI,0x2 JNZ 0x00101173 LAB_00101188: MOV EAX,ECX RET LAB_0010118b: MOV ECX,0x5 JMP 0x00101188
int func0(uint param_1) { int iVar1; int iVar2; int iVar3; int iVar4; int iVar5; iVar3 = 3; if (1 < param_1) { if ((int)param_1 < 3) { iVar3 = 5; } else { iVar3 = 5; iVar1 = 2; iVar4 = 3; iVar2 = 0; do { iVar5 = iVar1; iVar3 = iVar3 + iVar4 + iVar2; param_1 = param_1 - 1; iVar1 = iVar4 + iVar2; iVar4 = iVar2; iVar2 = iVar5; } while (param_1 != 2); } } return iVar3; }
5,686
func0
#include <assert.h>
int func0(int n) { int a = 3, b = 0, c = 2; if (n == 0) return 3; if (n == 1) return 3; if (n == 2) return 5; int sum = 5; while (n > 2) { int d = a + b; sum += d; a = b; b = c; c = d; n--; } return sum; }
int main() { assert(func0(9) == 49); assert(func0(10) == 66); assert(func0(11) == 88); return 0; }
O2
c
func0: endbr64 mov $0x3,%r8d cmp $0x1,%edi jbe 1294 <func0+0x44> cmp $0x2,%edi jle 12a0 <func0+0x50> mov $0x2,%edx mov $0x5,%r8d xor %eax,%eax mov $0x3,%ecx nopw %cs:0x0(%rax,%rax,1) mov %edx,%esi sub $0x1,%edi lea (%rcx,%rax,1),%edx mov %eax,%ecx add %edx,%r8d mov %esi,%eax cmp $0x2,%edi jne 1280 <func0+0x30> mov %r8d,%eax retq nopl 0x0(%rax,%rax,1) mov $0x5,%r8d jmp 1294 <func0+0x44> nopl 0x0(%rax,%rax,1)
func0: endbr64 mov r8d, 3 cmp edi, 1 jbe short loc_1294 cmp edi, 2 jle short loc_12A0 mov edx, 2 mov r8d, 5 xor eax, eax mov ecx, 3 nop word ptr [rax+rax+00000000h] loc_1280: mov esi, edx sub edi, 1 lea edx, [rcx+rax] mov ecx, eax add r8d, edx mov eax, esi cmp edi, 2 jnz short loc_1280 loc_1294: mov eax, r8d retn loc_12A0: mov r8d, 5 jmp short loc_1294
long long func0(int a1) { unsigned int v1; // r8d int v2; // edx int v3; // eax int v4; // ecx int v5; // esi v1 = 3; if ( (unsigned int)a1 > 1 ) { if ( a1 <= 2 ) { return 5; } else { v2 = 2; v1 = 5; v3 = 0; v4 = 3; do { v5 = v2; --a1; v2 = v4 + v3; v4 = v3; v1 += v2; v3 = v5; } while ( a1 != 2 ); } } return v1; }
func0: ENDBR64 MOV R8D,0x3 CMP EDI,0x1 JBE 0x00101294 CMP EDI,0x2 JLE 0x001012a0 MOV EDX,0x2 MOV R8D,0x5 XOR EAX,EAX MOV ECX,0x3 NOP word ptr CS:[RAX + RAX*0x1] LAB_00101280: MOV ESI,EDX SUB EDI,0x1 LEA EDX,[RCX + RAX*0x1] MOV ECX,EAX ADD R8D,EDX MOV EAX,ESI CMP EDI,0x2 JNZ 0x00101280 LAB_00101294: MOV EAX,R8D RET LAB_001012a0: MOV R8D,0x5 JMP 0x00101294
int func0(uint param_1) { int iVar1; int iVar2; int iVar3; int iVar4; int iVar5; iVar5 = 3; if (1 < param_1) { if ((int)param_1 < 3) { iVar5 = 5; } else { iVar5 = 5; iVar1 = 2; iVar3 = 3; iVar2 = 0; do { iVar4 = iVar1; param_1 = param_1 - 1; iVar5 = iVar5 + iVar3 + iVar2; iVar1 = iVar3 + iVar2; iVar3 = iVar2; iVar2 = iVar4; } while (param_1 != 2); } } return iVar5; }
5,687
func0
#include <assert.h>
int func0(int n) { int a = 3, b = 0, c = 2; if (n == 0) return 3; if (n == 1) return 3; if (n == 2) return 5; int sum = 5; while (n > 2) { int d = a + b; sum += d; a = b; b = c; c = d; n--; } return sum; }
int main() { assert(func0(9) == 49); assert(func0(10) == 66); assert(func0(11) == 88); return 0; }
O3
c
func0: endbr64 mov $0x3,%r8d cmp $0x1,%edi jbe 1184 <func0+0x44> cmp $0x2,%edi jle 1190 <func0+0x50> mov $0x2,%edx mov $0x5,%r8d xor %eax,%eax mov $0x3,%ecx nopw %cs:0x0(%rax,%rax,1) mov %edx,%esi sub $0x1,%edi lea (%rcx,%rax,1),%edx mov %eax,%ecx add %edx,%r8d mov %esi,%eax cmp $0x2,%edi jne 1170 <func0+0x30> mov %r8d,%eax retq nopl 0x0(%rax,%rax,1) mov $0x5,%r8d jmp 1184 <func0+0x44> nopl 0x0(%rax,%rax,1)
func0: endbr64 mov ecx, 3 cmp edi, 1 jbe short loc_117D cmp edi, 2 jle short loc_1180 mov edx, 2 mov ecx, 5 xor eax, eax mov esi, 3 nop dword ptr [rax+00h] loc_1168: mov r8d, edx sub edi, 1 lea edx, [rax+rsi] mov esi, eax add ecx, edx mov eax, r8d cmp edi, 2 jnz short loc_1168 loc_117D: mov eax, ecx retn loc_1180: mov ecx, 5 jmp short loc_117D
long long func0(int a1) { unsigned int v1; // ecx int v2; // edx int v3; // eax int v4; // esi int v5; // r8d v1 = 3; if ( (unsigned int)a1 > 1 ) { if ( a1 <= 2 ) { return 5; } else { v2 = 2; v1 = 5; v3 = 0; v4 = 3; do { v5 = v2; --a1; v2 = v3 + v4; v4 = v3; v1 += v2; v3 = v5; } while ( a1 != 2 ); } } return v1; }
func0: ENDBR64 MOV ECX,0x3 CMP EDI,0x1 JBE 0x0010117d CMP EDI,0x2 JLE 0x00101180 MOV EDX,0x2 MOV ECX,0x5 XOR EAX,EAX MOV ESI,0x3 NOP dword ptr [RAX] LAB_00101168: MOV R8D,EDX SUB EDI,0x1 LEA EDX,[RAX + RSI*0x1] MOV ESI,EAX ADD ECX,EDX MOV EAX,R8D CMP EDI,0x2 JNZ 0x00101168 LAB_0010117d: MOV EAX,ECX RET LAB_00101180: MOV ECX,0x5 JMP 0x0010117d
int func0(uint param_1) { int iVar1; int iVar2; int iVar3; int iVar4; int iVar5; iVar2 = 3; if (1 < param_1) { if ((int)param_1 < 3) { iVar2 = 5; } else { iVar2 = 5; iVar4 = 2; iVar3 = 0; iVar5 = 3; do { iVar1 = iVar3; iVar3 = iVar4; param_1 = param_1 - 1; iVar4 = iVar1 + iVar5; iVar2 = iVar2 + iVar4; iVar5 = iVar1; } while (param_1 != 2); } } return iVar2; }
5,688
func0
#include <assert.h> #include <stdio.h>
char* func0(int x1, int y1, int x2, int y2, int x3, int y3) { int a = (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)); if (a == 0) { return "No"; } else { return "Yes"; } }
int main() { assert(func0(1, 5, 2, 5, 4, 6) == "Yes"); assert(func0(1, 1, 1, 4, 1, 5) == "No"); assert(func0(1, 1, 1, 1, 1, 1) == "No"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) mov %edx,-0x1c(%rbp) mov %ecx,-0x20(%rbp) mov %r8d,-0x24(%rbp) mov %r9d,-0x28(%rbp) mov -0x20(%rbp),%eax sub -0x28(%rbp),%eax imul -0x14(%rbp),%eax mov %eax,%edx mov -0x28(%rbp),%eax sub -0x18(%rbp),%eax imul -0x1c(%rbp),%eax add %eax,%edx mov -0x18(%rbp),%eax sub -0x20(%rbp),%eax imul -0x24(%rbp),%eax add %edx,%eax mov %eax,-0x4(%rbp) cmpl $0x0,-0x4(%rbp) jne 119b <func0+0x52> lea 0xe6f(%rip),%rax jmp 11a2 <func0+0x59> lea 0xe69(%rip),%rax 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 [rbp+var_20], ecx mov [rbp+var_24], r8d mov [rbp+var_28], r9d mov eax, [rbp+var_20] sub eax, [rbp+var_28] imul eax, [rbp+var_14] mov edx, eax mov eax, [rbp+var_28] sub eax, [rbp+var_18] imul eax, [rbp+var_1C] add edx, eax mov eax, [rbp+var_18] sub eax, [rbp+var_20] imul eax, [rbp+var_24] add eax, edx mov [rbp+var_4], eax cmp [rbp+var_4], 0 jnz short loc_119B lea rax, unk_2008 jmp short loc_11A2 loc_119B: lea rax, unk_200B loc_11A2: pop rbp retn
void * func0(int a1, int a2, int a3, int a4, int a5, int a6) { if ( a3 * (a6 - a2) + a1 * (a4 - a6) + a5 * (a2 - a4) ) return &unk_200B; else return &unk_2008; }
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 dword ptr [RBP + -0x20],ECX MOV dword ptr [RBP + -0x24],R8D MOV dword ptr [RBP + -0x28],R9D MOV EAX,dword ptr [RBP + -0x20] SUB EAX,dword ptr [RBP + -0x28] IMUL EAX,dword ptr [RBP + -0x14] MOV EDX,EAX MOV EAX,dword ptr [RBP + -0x28] SUB EAX,dword ptr [RBP + -0x18] IMUL EAX,dword ptr [RBP + -0x1c] ADD EDX,EAX MOV EAX,dword ptr [RBP + -0x18] SUB EAX,dword ptr [RBP + -0x20] IMUL EAX,dword ptr [RBP + -0x24] ADD EAX,EDX MOV dword ptr [RBP + -0x4],EAX CMP dword ptr [RBP + -0x4],0x0 JNZ 0x0010119b LEA RAX,[0x102008] JMP 0x001011a2 LAB_0010119b: LEA RAX,[0x10200b] LAB_001011a2: POP RBP RET
int * func0(int param_1,int param_2,int param_3,int param_4,int param_5,int param_6) { int *puVar1; if ((param_2 - param_4) * param_5 + (param_4 - param_6) * param_1 + (param_6 - param_2) * param_3 == 0) { puVar1 = &DAT_00102008; } else { puVar1 = &DAT_0010200b; } return puVar1; }
5,689
func0
#include <assert.h> #include <stdio.h>
char* func0(int x1, int y1, int x2, int y2, int x3, int y3) { int a = (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)); if (a == 0) { return "No"; } else { return "Yes"; } }
int main() { assert(func0(1, 5, 2, 5, 4, 6) == "Yes"); assert(func0(1, 1, 1, 4, 1, 5) == "No"); assert(func0(1, 1, 1, 1, 1, 1) == "No"); return 0; }
O1
c
func0: endbr64 mov %edi,%eax mov %ecx,%edi sub %r9d,%edi imul %eax,%edi sub %esi,%r9d imul %edx,%r9d add %edi,%r9d sub %ecx,%esi imul %r8d,%esi add %esi,%r9d lea 0xeb3(%rip),%rax lea 0xeaf(%rip),%rdx cmovne %rdx,%rax retq
func0: endbr64 mov eax, esi mov esi, edx mov edx, ecx sub edx, r9d imul edx, edi sub r9d, eax imul r9d, esi add edx, r9d sub eax, ecx imul eax, r8d add edx, eax lea rax, unk_2004 lea rdx, unk_2007 cmovnz rax, rdx retn
void * func0(int a1, int a2, int a3, int a4, int a5, int a6) { void *result; // rax result = &unk_2004; if ( a5 * (a2 - a4) + a3 * (a6 - a2) + a1 * (a4 - a6) ) return &unk_2007; return result; }
func0: ENDBR64 MOV EAX,ESI MOV ESI,EDX MOV EDX,ECX SUB EDX,R9D IMUL EDX,EDI SUB R9D,EAX IMUL R9D,ESI ADD EDX,R9D SUB EAX,ECX IMUL EAX,R8D ADD EDX,EAX LEA RAX,[0x102004] LEA RDX,[0x102007] CMOVNZ RAX,RDX RET
int * func0(int param_1,int param_2,int param_3,int param_4,int param_5,int param_6) { int *puVar1; puVar1 = &DAT_00102004; if ((param_4 - param_6) * param_1 + (param_6 - param_2) * param_3 + (param_2 - param_4) * param_5 != 0) { puVar1 = &DAT_00102007; } return puVar1; }
5,690
func0
#include <assert.h> #include <stdio.h>
char* func0(int x1, int y1, int x2, int y2, int x3, int y3) { int a = (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)); if (a == 0) { return "No"; } else { return "Yes"; } }
int main() { assert(func0(1, 5, 2, 5, 4, 6) == "Yes"); assert(func0(1, 1, 1, 4, 1, 5) == "No"); assert(func0(1, 1, 1, 1, 1, 1) == "No"); return 0; }
O2
c
func0: endbr64 mov %edi,%r10d mov %ecx,%edi lea 0xeb4(%rip),%rax sub %r9d,%edi sub %esi,%r9d sub %ecx,%esi imul %r10d,%edi imul %edx,%r9d lea 0xea0(%rip),%rdx imul %r8d,%esi add %edi,%r9d add %esi,%r9d cmovne %rdx,%rax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 mov r10d, edx mov edx, ecx mov eax, esi sub edx, r9d sub r9d, esi sub eax, ecx imul edx, edi imul r9d, r10d imul eax, r8d add edx, r9d add edx, eax lea rdx, unk_2007 lea rax, unk_2004 cmovnz rax, rdx retn
void * func0(int a1, int a2, int a3, int a4, int a5, int a6) { void *result; // rax result = &unk_2004; if ( a5 * (a2 - a4) + a3 * (a6 - a2) + a1 * (a4 - a6) ) return &unk_2007; return result; }
func0: ENDBR64 MOV R10D,EDX MOV EDX,ECX MOV EAX,ESI SUB EDX,R9D SUB R9D,ESI SUB EAX,ECX IMUL EDX,EDI IMUL R9D,R10D IMUL EAX,R8D ADD EDX,R9D ADD EDX,EAX LEA RDX,[0x102007] LEA RAX,[0x102004] CMOVNZ RAX,RDX RET
int * func0(int param_1,int param_2,int param_3,int param_4,int param_5,int param_6) { int *puVar1; puVar1 = &DAT_00102004; if ((param_4 - param_6) * param_1 + (param_6 - param_2) * param_3 + (param_2 - param_4) * param_5 != 0) { puVar1 = &DAT_00102007; } return puVar1; }
5,691
func0
#include <assert.h> #include <stdio.h>
char* func0(int x1, int y1, int x2, int y2, int x3, int y3) { int a = (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)); if (a == 0) { return "No"; } else { return "Yes"; } }
int main() { assert(func0(1, 5, 2, 5, 4, 6) == "Yes"); assert(func0(1, 1, 1, 4, 1, 5) == "No"); assert(func0(1, 1, 1, 1, 1, 1) == "No"); return 0; }
O3
c
func0: endbr64 mov %edi,%r10d mov %ecx,%edi lea 0xeb4(%rip),%rax sub %r9d,%edi sub %esi,%r9d sub %ecx,%esi imul %r10d,%edi imul %edx,%r9d lea 0xea0(%rip),%rdx imul %r8d,%esi add %edi,%r9d add %esi,%r9d cmovne %rdx,%rax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 mov eax, esi mov esi, edx mov edx, ecx sub edx, r9d sub r9d, eax sub eax, ecx imul edx, edi imul r9d, esi imul eax, r8d add edx, r9d add edx, eax lea rdx, unk_2004 lea rax, unk_2007 cmovz rax, rdx retn
void * func0(int a1, int a2, int a3, int a4, int a5, int a6) { void *result; // rax result = &unk_2007; if ( !(a5 * (a2 - a4) + a3 * (a6 - a2) + a1 * (a4 - a6)) ) return &unk_2004; return result; }
func0: ENDBR64 MOV EAX,ESI MOV ESI,EDX MOV EDX,ECX SUB EDX,R9D SUB R9D,EAX SUB EAX,ECX IMUL EDX,EDI IMUL R9D,ESI IMUL EAX,R8D ADD EDX,R9D ADD EDX,EAX LEA RDX,[0x102004] LEA RAX,[0x102007] CMOVZ RAX,RDX RET
int * func0(int param_1,int param_2,int param_3,int param_4,int param_5,int param_6) { int *puVar1; puVar1 = &DAT_00102007; if ((param_4 - param_6) * param_1 + (param_6 - param_2) * param_3 + (param_2 - param_4) * param_5 == 0) { puVar1 = &DAT_00102004; } return puVar1; }
5,692
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char** func0(char *str[], int n, int l, int *size) { static char *result[100]; int count = 0; for (int i = 0; i < n; ++i) { if (strlen(str[i]) == l) { result[count++] = str[i]; } } *size = count; return result; }
int main() { char *testData1[] = {"Python", "list", "exercises", "practice", "solution"}; int size; char **result = func0(testData1, 5, 8, &size); assert(size == 2); assert(strcmp(result[0], "practice") == 0); assert(strcmp(result[1], "solution") == 0); result = func0(testData1, 5, 6, &size); assert(size == 1); assert(strcmp(result[0], "Python") == 0); result = func0(testData1, 5, 9, &size); assert(size == 1); assert(strcmp(result[0], "exercises") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %edx,-0x20(%rbp) mov %rcx,-0x28(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 1237 <func0+0x8e> mov -0x4(%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 -0x20(%rbp),%edx movslq %edx,%rdx cmp %rdx,%rax jne 1233 <func0+0x8a> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x8(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x8(%rbp) mov (%rcx),%rdx cltq lea 0x0(,%rax,8),%rcx lea 0x2e11(%rip),%rax mov %rdx,(%rcx,%rax,1) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11d3 <func0+0x2a> mov -0x28(%rbp),%rax mov -0x8(%rbp),%edx mov %edx,(%rax) lea 0x2df1(%rip),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_20], edx mov [rbp+var_28], rcx mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_1239 loc_11D3: mov eax, [rbp+var_4] 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 rdx, rax mov eax, [rbp+var_20] cdqe cmp rdx, rax jnz short loc_1235 mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] lea rcx, [rdx+rax] mov eax, [rbp+var_8] lea edx, [rax+1] mov [rbp+var_8], edx mov rdx, [rcx] cdqe lea rcx, ds:0[rax*8] lea rax, result_1 mov [rcx+rax], rdx loc_1235: add [rbp+var_4], 1 loc_1239: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_11D3 mov rax, [rbp+var_28] mov edx, [rbp+var_8] mov [rax], edx lea rax, result_1 leave retn
_QWORD * func0(long long a1, int a2, int a3, _DWORD *a4) { int v4; // eax int v8; // [rsp+28h] [rbp-8h] int i; // [rsp+2Ch] [rbp-4h] v8 = 0; for ( i = 0; i < a2; ++i ) { if ( strlen(*(const char **)(8LL * i + a1)) == a3 ) { v4 = v8++; result_1[v4] = *(_QWORD *)(8LL * i + a1); } } *a4 = v8; return result_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x20],EDX MOV qword ptr [RBP + -0x28],RCX MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101239 LAB_001011d3: MOV EAX,dword ptr [RBP + -0x4] 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 RDX,RAX MOV EAX,dword ptr [RBP + -0x20] CDQE CMP RDX,RAX JNZ 0x00101235 MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] LEA RCX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x8] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x8],EDX MOV RDX,qword ptr [RCX] CDQE LEA RCX,[RAX*0x8] LEA RAX,[0x104040] MOV qword ptr [RCX + RAX*0x1],RDX LAB_00101235: ADD dword ptr [RBP + -0x4],0x1 LAB_00101239: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011d3 MOV RAX,qword ptr [RBP + -0x28] MOV EDX,dword ptr [RBP + -0x8] MOV dword ptr [RAX],EDX LEA RAX,[0x104040] LEAVE RET
int1 * func0(long param_1,int param_2,int param_3,int *param_4) { size_t sVar1; int local_10; int local_c; local_10 = 0; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { sVar1 = strlen(*(char **)(param_1 + (long)local_c * 8)); if (sVar1 == (long)param_3) { *(int8 *)(result_1 + (long)local_10 * 8) = *(int8 *)((long)local_c * 8 + param_1); local_10 = local_10 + 1; } } *param_4 = local_10; return result_1; }
5,693
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char** func0(char *str[], int n, int l, int *size) { static char *result[100]; int count = 0; for (int i = 0; i < n; ++i) { if (strlen(str[i]) == l) { result[count++] = str[i]; } } *size = count; return result; }
int main() { char *testData1[] = {"Python", "list", "exercises", "practice", "solution"}; int size; char **result = func0(testData1, 5, 8, &size); assert(size == 2); assert(strcmp(result[0], "practice") == 0); assert(strcmp(result[1], "solution") == 0); result = func0(testData1, 5, 6, &size); assert(size == 1); assert(strcmp(result[0], "Python") == 0); result = func0(testData1, 5, 9, &size); assert(size == 1); assert(strcmp(result[0], "exercises") == 0); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx mov %rcx,%rbx test %esi,%esi jle 11cd <func0+0x64> mov %rdi,%r8 lea -0x1(%rsi),%eax lea 0x8(%rdi,%rax,8),%r11 mov $0x0,%r9d mov $0xffffffffffffffff,%r10 mov $0x0,%eax movslq %edx,%rsi lea 0x2ea3(%rip),%rbp jmp 11a8 <func0+0x3f> add $0x8,%r8 cmp %r11,%r8 je 11d3 <func0+0x6a> mov (%r8),%rdx mov %r10,%rcx mov %rdx,%rdi repnz scas %es:(%rdi),%al not %rcx sub $0x1,%rcx cmp %rsi,%rcx jne 119f <func0+0x36> movslq %r9d,%rcx mov %rdx,0x0(%rbp,%rcx,8) lea 0x1(%r9),%r9d jmp 119f <func0+0x36> mov $0x0,%r9d mov %r9d,(%rbx) lea 0x2e63(%rip),%rax pop %rbx pop %rbp retq
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 18h mov [rsp+48h+var_40], rcx test esi, esi jle short loc_1207 mov rbx, rdi lea eax, [rsi-1] lea r14, [rdi+rax*8+8] mov r13d, 0 movsxd r12, edx lea r15, result_1 jmp short loc_11EA loc_11E1: add rbx, 8 cmp rbx, r14 jz short loc_120D loc_11EA: mov rbp, [rbx] mov rdi, rbp call _strlen cmp rax, r12 jnz short loc_11E1 movsxd rax, r13d mov [r15+rax*8], rbp lea r13d, [r13+1] jmp short loc_11E1 loc_1207: mov r13d, 0 loc_120D: mov rax, [rsp+48h+var_40] mov [rax], r13d lea rax, result_1 add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
_QWORD * func0(_QWORD *a1, int a2, int a3, _DWORD *a4) { _QWORD *v4; // rbx int v5; // r13d long long v6; // r12 long long v7; // rbp if ( a2 <= 0 ) { v5 = 0; } else { v4 = a1; v5 = 0; v6 = a3; do { v7 = *v4; if ( strlen(*v4) == v6 ) result_1[v5++] = v7; ++v4; } while ( v4 != &a1[(unsigned int)(a2 - 1) + 1] ); } *a4 = v5; return result_1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV qword ptr [RSP + 0x8],RCX TEST ESI,ESI JLE 0x00101207 MOV RBX,RDI LEA EAX,[RSI + -0x1] LEA R14,[RDI + RAX*0x8 + 0x8] MOV R13D,0x0 MOVSXD R12,EDX LEA R15,[0x104040] JMP 0x001011ea LAB_001011e1: ADD RBX,0x8 CMP RBX,R14 JZ 0x0010120d LAB_001011ea: MOV RBP,qword ptr [RBX] MOV RDI,RBP CALL 0x00101080 CMP RAX,R12 JNZ 0x001011e1 MOVSXD RAX,R13D MOV qword ptr [R15 + RAX*0x8],RBP LEA R13D,[R13 + 0x1] JMP 0x001011e1 LAB_00101207: MOV R13D,0x0 LAB_0010120d: MOV RAX,qword ptr [RSP + 0x8] MOV dword ptr [RAX],R13D LEA RAX,[0x104040] ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int8 * func0(int8 *param_1,int param_2,int param_3,int *param_4) { int8 *puVar1; char *__s; size_t sVar2; int iVar3; if (param_2 < 1) { iVar3 = 0; } else { puVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar3 = 0; do { __s = (char *)*param_1; sVar2 = strlen(__s); if (sVar2 == (long)param_3) { (&result_1)[iVar3] = __s; iVar3 = iVar3 + 1; } param_1 = param_1 + 1; } while (param_1 != puVar1); } *param_4 = iVar3; return &result_1; }
5,694
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char** func0(char *str[], int n, int l, int *size) { static char *result[100]; int count = 0; for (int i = 0; i < n; ++i) { if (strlen(str[i]) == l) { result[count++] = str[i]; } } *size = count; return result; }
int main() { char *testData1[] = {"Python", "list", "exercises", "practice", "solution"}; int size; char **result = func0(testData1, 5, 8, &size); assert(size == 2); assert(strcmp(result[0], "practice") == 0); assert(strcmp(result[1], "solution") == 0); result = func0(testData1, 5, 6, &size); assert(size == 1); assert(strcmp(result[0], "Python") == 0); result = func0(testData1, 5, 9, &size); assert(size == 1); assert(strcmp(result[0], "exercises") == 0); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov %rcx,0x8(%rsp) test %esi,%esi jle 1440 <func0+0x80> lea -0x1(%rsi),%eax movslq %edx,%rbp mov %rdi,%rbx xor %r12d,%r12d lea 0x8(%rdi,%rax,8),%r13 lea 0x2c4d(%rip),%r15 nopl 0x0(%rax,%rax,1) mov (%rbx),%r14 mov %r14,%rdi callq 1070 <strlen@plt> cmp %rbp,%rax jne 1413 <func0+0x53> movslq %r12d,%rax add $0x1,%r12d mov %r14,(%r15,%rax,8) add $0x8,%rbx cmp %r13,%rbx jne 13f8 <func0+0x38> mov 0x8(%rsp),%rax mov %r12d,(%rax) add $0x18,%rsp lea 0x2c11(%rip),%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw 0x0(%rax,%rax,1) xor %r12d,%r12d jmp 141c <func0+0x5c> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 18h mov [rsp+48h+var_40], rcx test esi, esi jle short loc_1450 lea eax, [rsi-1] movsxd rbp, edx mov rbx, rdi xor r12d, r12d lea r13, [rdi+rax*8+8] lea r15, result_1 nop dword ptr [rax+rax+00h] loc_1408: mov r14, [rbx] mov rdi, r14 call _strlen cmp rax, rbp jnz short loc_1423 movsxd rax, r12d add r12d, 1 mov [r15+rax*8], r14 loc_1423: add rbx, 8 cmp rbx, r13 jnz short loc_1408 loc_142C: mov rax, [rsp+48h+var_40] mov [rax], r12d add rsp, 18h mov rax, r15 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1450: xor r12d, r12d lea r15, result_1 jmp short loc_142C
_QWORD * func0(_QWORD *a1, int a2, int a3, _DWORD *a4) { long long v4; // rbp _QWORD *v5; // rbx int v6; // r12d long long v7; // r14 long long v8; // rax if ( a2 <= 0 ) { v6 = 0; } else { v4 = a3; v5 = a1; v6 = 0; do { v7 = *v5; if ( strlen(*v5) == v4 ) { v8 = v6++; result_1[v8] = v7; } ++v5; } while ( v5 != &a1[(unsigned int)(a2 - 1) + 1] ); } *a4 = v6; return result_1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV qword ptr [RSP + 0x8],RCX TEST ESI,ESI JLE 0x00101450 LEA EAX,[RSI + -0x1] MOVSXD RBP,EDX MOV RBX,RDI XOR R12D,R12D LEA R13,[RDI + RAX*0x8 + 0x8] LEA R15,[0x104040] NOP dword ptr [RAX + RAX*0x1] LAB_00101408: MOV R14,qword ptr [RBX] MOV RDI,R14 CALL 0x00101080 CMP RAX,RBP JNZ 0x00101423 MOVSXD RAX,R12D ADD R12D,0x1 MOV qword ptr [R15 + RAX*0x8],R14 LAB_00101423: ADD RBX,0x8 CMP RBX,R13 JNZ 0x00101408 LAB_0010142c: MOV RAX,qword ptr [RSP + 0x8] MOV dword ptr [RAX],R12D ADD RSP,0x18 MOV RAX,R15 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101450: XOR R12D,R12D LEA R15,[0x104040] JMP 0x0010142c
int8 * func0(int8 *param_1,int param_2,int param_3,int *param_4) { int8 *puVar1; char *__s; size_t sVar2; long lVar3; int iVar4; if (param_2 < 1) { iVar4 = 0; } else { iVar4 = 0; puVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { __s = (char *)*param_1; sVar2 = strlen(__s); if (sVar2 == (long)param_3) { lVar3 = (long)iVar4; iVar4 = iVar4 + 1; (&result_1)[lVar3] = __s; } param_1 = param_1 + 1; } while (param_1 != puVar1); } *param_4 = iVar4; return &result_1; }
5,695
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char** func0(char *str[], int n, int l, int *size) { static char *result[100]; int count = 0; for (int i = 0; i < n; ++i) { if (strlen(str[i]) == l) { result[count++] = str[i]; } } *size = count; return result; }
int main() { char *testData1[] = {"Python", "list", "exercises", "practice", "solution"}; int size; char **result = func0(testData1, 5, 8, &size); assert(size == 2); assert(strcmp(result[0], "practice") == 0); assert(strcmp(result[1], "solution") == 0); result = func0(testData1, 5, 6, &size); assert(size == 1); assert(strcmp(result[0], "Python") == 0); result = func0(testData1, 5, 9, &size); assert(size == 1); assert(strcmp(result[0], "exercises") == 0); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov %rcx,0x8(%rsp) test %esi,%esi jle 1450 <func0+0x80> lea -0x1(%rsi),%eax movslq %edx,%rbp mov %rdi,%rbx xor %r12d,%r12d lea 0x8(%rdi,%rax,8),%r13 lea 0x2c3d(%rip),%r15 nopl 0x0(%rax,%rax,1) mov (%rbx),%r14 mov %r14,%rdi callq 1070 <strlen@plt> cmp %rbp,%rax jne 1423 <func0+0x53> movslq %r12d,%rax add $0x1,%r12d mov %r14,(%r15,%rax,8) add $0x8,%rbx cmp %r13,%rbx jne 1408 <func0+0x38> mov 0x8(%rsp),%rax mov %r12d,(%rax) add $0x18,%rsp lea 0x2c01(%rip),%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw 0x0(%rax,%rax,1) xor %r12d,%r12d jmp 142c <func0+0x5c> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 18h mov [rsp+48h+var_40], rcx test esi, esi jle short loc_1450 movsxd rsi, esi movsxd rbp, edx mov rbx, rdi xor r12d, r12d lea r13, [rdi+rsi*8] lea r15, result_1 nop word ptr [rax+rax+00h] loc_1408: mov r14, [rbx] mov rdi, r14; s call _strlen cmp rax, rbp jnz short loc_1423 movsxd rax, r12d add r12d, 1 mov [r15+rax*8], r14 loc_1423: add rbx, 8 cmp rbx, r13 jnz short loc_1408 loc_142C: mov rax, [rsp+48h+var_40] mov [rax], r12d add rsp, 18h mov rax, r15 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1450: xor r12d, r12d lea r15, result_1 jmp short loc_142C
_QWORD * func0(const char **a1, int a2, int a3, _DWORD *a4) { long long v4; // rbp const char **v5; // rbx int v6; // r12d const char *v7; // r14 long long v8; // rax if ( a2 <= 0 ) { v6 = 0; } else { v4 = a3; v5 = a1; v6 = 0; do { v7 = *v5; if ( strlen(*v5) == v4 ) { v8 = v6++; result_1[v8] = v7; } ++v5; } while ( v5 != &a1[a2] ); } *a4 = v6; return result_1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV qword ptr [RSP + 0x8],RCX TEST ESI,ESI JLE 0x00101450 MOVSXD RSI,ESI MOVSXD RBP,EDX MOV RBX,RDI XOR R12D,R12D LEA R13,[RDI + RSI*0x8] LEA R15,[0x104040] NOP word ptr [RAX + RAX*0x1] LAB_00101408: MOV R14,qword ptr [RBX] MOV RDI,R14 CALL 0x00101080 CMP RAX,RBP JNZ 0x00101423 MOVSXD RAX,R12D ADD R12D,0x1 MOV qword ptr [R15 + RAX*0x8],R14 LAB_00101423: ADD RBX,0x8 CMP RBX,R13 JNZ 0x00101408 LAB_0010142c: MOV RAX,qword ptr [RSP + 0x8] MOV dword ptr [RAX],R12D ADD RSP,0x18 MOV RAX,R15 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101450: XOR R12D,R12D LEA R15,[0x104040] JMP 0x0010142c
int8 * func0(int8 *param_1,int param_2,int param_3,int *param_4) { int8 *puVar1; char *__s; size_t sVar2; long lVar3; int iVar4; if (param_2 < 1) { iVar4 = 0; } else { iVar4 = 0; puVar1 = param_1 + param_2; do { __s = (char *)*param_1; sVar2 = strlen(__s); if (sVar2 == (long)param_3) { lVar3 = (long)iVar4; iVar4 = iVar4 + 1; (&result_1)[lVar3] = __s; } param_1 = param_1 + 1; } while (param_1 != puVar1); } *param_4 = iVar4; return &result_1; }
5,696
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <ctype.h>
char* func0(char* text1) { int i = 0, j = 0; while (text1[i]) { if (!isspace((unsigned char)text1[i])) { text1[j++] = text1[i]; } i++; } text1[j] = '\0'; return text1; }
int main() { char text1[] = " Google Flutter "; char text2[] = " Google Dart "; char text3[] = " iOS Swift "; assert(strcmp(func0(text1), "GoogleFlutter") == 0); assert(strcmp(func0(text2), "GoogleDart") == 0); assert(strcmp(func0(text3), "iOSSwift") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 1223 <func0+0x7a> callq 10b0 <__ctype_b_loc@plt> mov (%rax),%rax mov -0x8(%rbp),%edx movslq %edx,%rcx mov -0x18(%rbp),%rdx add %rcx,%rdx movzbl (%rdx),%edx movzbl %dl,%edx add %rdx,%rdx add %rdx,%rax movzwl (%rax),%eax movzwl %ax,%eax and $0x2000,%eax test %eax,%eax jne 121f <func0+0x76> mov -0x8(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x4(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x4(%rbp) movslq %eax,%rdx mov -0x18(%rbp),%rax add %rax,%rdx movzbl (%rcx),%eax mov %al,(%rdx) addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax test %al,%al jne 11c9 <func0+0x20> mov -0x4(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax movb $0x0,(%rax) mov -0x18(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_1223 loc_11C9: call ___ctype_b_loc mov rax, [rax] mov edx, [rbp+var_8] movsxd rcx, edx mov rdx, [rbp+var_18] add rdx, rcx movzx edx, byte ptr [rdx] movzx edx, dl add rdx, rdx add rax, rdx movzx eax, word ptr [rax] movzx eax, ax and eax, 2000h test eax, eax jnz short loc_121F mov eax, [rbp+var_8] movsxd rdx, eax mov rax, [rbp+var_18] lea rcx, [rdx+rax] mov eax, [rbp+var_4] lea edx, [rax+1] mov [rbp+var_4], edx movsxd rdx, eax mov rax, [rbp+var_18] add rdx, rax movzx eax, byte ptr [rcx] mov [rdx], al loc_121F: add [rbp+var_8], 1 loc_1223: mov eax, [rbp+var_8] movsxd rdx, eax mov rax, [rbp+var_18] add rax, rdx movzx eax, byte ptr [rax] test al, al jnz short loc_11C9 mov eax, [rbp+var_4] movsxd rdx, eax mov rax, [rbp+var_18] add rax, rdx mov byte ptr [rax], 0 mov rax, [rbp+var_18] leave retn
long long func0(long long a1) { int v1; // eax int v3; // [rsp+18h] [rbp-8h] int v4; // [rsp+1Ch] [rbp-4h] v3 = 0; v4 = 0; while ( *(_BYTE *)(v3 + a1) ) { if ( ((*__ctype_b_loc())[*(unsigned __int8 *)(v3 + a1)] & 0x2000) == 0 ) { v1 = v4++; *(_BYTE *)(a1 + v1) = *(_BYTE *)(v3 + a1); } ++v3; } *(_BYTE *)(v4 + a1) = 0; return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101223 LAB_001011c9: CALL 0x001010b0 MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0x8] MOVSXD RCX,EDX MOV RDX,qword ptr [RBP + -0x18] ADD RDX,RCX MOVZX EDX,byte ptr [RDX] MOVZX EDX,DL ADD RDX,RDX ADD RAX,RDX MOVZX EAX,word ptr [RAX] MOVZX EAX,AX AND EAX,0x2000 TEST EAX,EAX JNZ 0x0010121f MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] LEA RCX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x4] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x4],EDX MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RDX,RAX MOVZX EAX,byte ptr [RCX] MOV byte ptr [RDX],AL LAB_0010121f: ADD dword ptr [RBP + -0x8],0x1 LAB_00101223: MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] TEST AL,AL JNZ 0x001011c9 MOV EAX,dword ptr [RBP + -0x4] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV byte ptr [RAX],0x0 MOV RAX,qword ptr [RBP + -0x18] LEAVE RET
long func0(long param_1) { ushort **ppuVar1; int local_10; int local_c; local_c = 0; for (local_10 = 0; *(char *)(param_1 + local_10) != '\0'; local_10 = local_10 + 1) { ppuVar1 = __ctype_b_loc(); if (((*ppuVar1)[*(byte *)(param_1 + local_10)] & 0x2000) == 0) { *(int *)(local_c + param_1) = *(int *)(local_10 + param_1); local_c = local_c + 1; } } *(int *)(param_1 + local_c) = 0; return param_1; }
5,697
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <ctype.h>
char* func0(char* text1) { int i = 0, j = 0; while (text1[i]) { if (!isspace((unsigned char)text1[i])) { text1[j++] = text1[i]; } i++; } text1[j] = '\0'; return text1; }
int main() { char text1[] = " Google Flutter "; char text2[] = " Google Dart "; char text3[] = " iOS Swift "; assert(strcmp(func0(text1), "GoogleFlutter") == 0); assert(strcmp(func0(text2), "GoogleDart") == 0); assert(strcmp(func0(text3), "iOSSwift") == 0); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbp movzbl (%rdi),%ebx test %bl,%bl je 11d2 <func0+0x49> callq 1090 <__ctype_b_loc@plt> lea 0x1(%rbp),%rcx mov $0x0,%edi jmp 11b9 <func0+0x30> add $0x1,%rcx movzbl -0x1(%rcx),%ebx test %bl,%bl je 11d7 <func0+0x4e> movzbl %bl,%edx mov (%rax),%rsi testb $0x20,0x1(%rsi,%rdx,2) jne 11ad <func0+0x24> movslq %edi,%rdx mov %bl,0x0(%rbp,%rdx,1) lea 0x1(%rdi),%edi jmp 11ad <func0+0x24> mov $0x0,%edi movslq %edi,%rdi movb $0x0,0x0(%rbp,%rdi,1) mov %rbp,%rax add $0x8,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp push rbx sub rsp, 8 mov rbp, rdi movzx ebx, byte ptr [rdi] test bl, bl jz short loc_11F2 call ___ctype_b_loc lea rcx, [rbp+1] mov edi, 0 jmp short loc_11D9 loc_11CD: add rcx, 1 movzx ebx, byte ptr [rcx-1] test bl, bl jz short loc_11F7 loc_11D9: movzx edx, bl mov rsi, [rax] test byte ptr [rsi+rdx*2+1], 20h jnz short loc_11CD movsxd rdx, edi mov [rbp+rdx+0], bl lea edi, [rdi+1] jmp short loc_11CD loc_11F2: mov edi, 0 loc_11F7: movsxd rdi, edi mov byte ptr [rbp+rdi+0], 0 mov rax, rbp add rsp, 8 pop rbx pop rbp retn
unsigned __int8 * func0(unsigned __int8 *a1) { unsigned __int8 v2; // bl _QWORD *v3; // rax unsigned __int8 *v4; // rcx int v5; // edi v2 = *a1; if ( *a1 ) { v3 = (_QWORD *)__ctype_b_loc(); v4 = a1 + 1; v5 = 0; do { if ( (*(_BYTE *)(*v3 + 2LL * v2 + 1) & 0x20) == 0 ) a1[v5++] = v2; v2 = *v4++; } while ( v2 ); } else { v5 = 0; } a1[v5] = 0; return a1; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBP,RDI MOVZX EBX,byte ptr [RDI] TEST BL,BL JZ 0x001011f2 CALL 0x001010b0 LEA RCX,[RBP + 0x1] MOV EDI,0x0 JMP 0x001011d9 LAB_001011cd: ADD RCX,0x1 MOVZX EBX,byte ptr [RCX + -0x1] TEST BL,BL JZ 0x001011f7 LAB_001011d9: MOVZX EDX,BL MOV RSI,qword ptr [RAX] TEST byte ptr [RSI + RDX*0x2 + 0x1],0x20 JNZ 0x001011cd MOVSXD RDX,EDI MOV byte ptr [RBP + RDX*0x1],BL LEA EDI,[RDI + 0x1] JMP 0x001011cd LAB_001011f2: MOV EDI,0x0 LAB_001011f7: MOVSXD RDI,EDI MOV byte ptr [RBP + RDI*0x1],0x0 MOV RAX,RBP ADD RSP,0x8 POP RBX POP RBP RET
byte * func0(byte *param_1) { ushort **ppuVar1; byte *pbVar2; byte bVar3; int iVar4; bVar3 = *param_1; if (bVar3 == 0) { iVar4 = 0; } else { ppuVar1 = __ctype_b_loc(); iVar4 = 0; pbVar2 = param_1 + 1; do { if ((*(byte *)((long)*ppuVar1 + (ulong)bVar3 * 2 + 1) & 0x20) == 0) { param_1[iVar4] = bVar3; iVar4 = iVar4 + 1; } bVar3 = *pbVar2; pbVar2 = pbVar2 + 1; } while (bVar3 != 0); } param_1[iVar4] = 0; return param_1; }
5,698
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <ctype.h>
char* func0(char* text1) { int i = 0, j = 0; while (text1[i]) { if (!isspace((unsigned char)text1[i])) { text1[j++] = text1[i]; } i++; } text1[j] = '\0'; return text1; }
int main() { char text1[] = " Google Flutter "; char text2[] = " Google Dart "; char text3[] = " iOS Swift "; assert(strcmp(func0(text1), "GoogleFlutter") == 0); assert(strcmp(func0(text2), "GoogleDart") == 0); assert(strcmp(func0(text3), "iOSSwift") == 0); return 0; }
O2
c
func0: endbr64 push %r12 mov %rdi,%r12 push %rbx sub $0x8,%rsp movzbl (%rdi),%ebx test %bl,%bl je 1340 <func0+0x60> callq 1090 <__ctype_b_loc@plt> lea 0x1(%r12),%rcx xor %r9d,%r9d xor %edi,%edi nopl 0x0(%rax) mov (%rax),%r8 movzbl %bl,%edx lea (%r12,%rdi,1),%rsi testb $0x20,0x1(%r8,%rdx,2) jne 1327 <func0+0x47> add $0x1,%r9d mov %bl,(%rsi) movslq %r9d,%rdi lea (%r12,%rdi,1),%rsi movzbl (%rcx),%ebx add $0x1,%rcx test %bl,%bl jne 1308 <func0+0x28> movb $0x0,(%rsi) add $0x8,%rsp mov %r12,%rax pop %rbx pop %r12 retq mov %rdi,%rsi mov %r12,%rax movb $0x0,(%rsi) add $0x8,%rsp pop %rbx pop %r12 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 push r12 mov r12, rdi push rbx sub rsp, 8 movzx ebx, byte ptr [rdi] test bl, bl jz short loc_1350 call ___ctype_b_loc lea rcx, [r12+1] xor esi, esi nop dword ptr [rax+00000000h] loc_1318: mov r8, [rax] movzx edx, bl test byte ptr [r8+rdx*2+1], 20h jnz short loc_1330 movsxd rdx, esi add esi, 1 mov [r12+rdx], bl loc_1330: movzx ebx, byte ptr [rcx] add rcx, 1 test bl, bl jnz short loc_1318 movsxd rsi, esi mov rax, r12 add rsi, r12 mov byte ptr [rsi], 0 add rsp, 8 pop rbx pop r12 retn loc_1350: mov rsi, rdi mov rax, r12 mov byte ptr [rsi], 0 add rsp, 8 pop rbx pop r12 retn
unsigned __int8 * func0(unsigned __int8 *a1) { unsigned __int8 v1; // bl _QWORD *v2; // rax unsigned __int8 *v3; // rcx int v4; // esi long long v5; // rdx unsigned __int8 *result; // rax v1 = *a1; if ( *a1 ) { v2 = (_QWORD *)__ctype_b_loc(); v3 = a1 + 1; v4 = 0; do { if ( (*(_BYTE *)(*v2 + 2LL * v1 + 1) & 0x20) == 0 ) { v5 = v4++; a1[v5] = v1; } v1 = *v3++; } while ( v1 ); result = a1; a1[v4] = 0; } else { result = a1; *a1 = 0; } return result; }
func0: ENDBR64 PUSH R12 MOV R12,RDI PUSH RBX SUB RSP,0x8 MOVZX EBX,byte ptr [RDI] TEST BL,BL JZ 0x00101350 CALL 0x001010b0 LEA RCX,[R12 + 0x1] XOR ESI,ESI NOP dword ptr [RAX] LAB_00101318: MOV R8,qword ptr [RAX] MOVZX EDX,BL TEST byte ptr [R8 + RDX*0x2 + 0x1],0x20 JNZ 0x00101330 MOVSXD RDX,ESI ADD ESI,0x1 MOV byte ptr [R12 + RDX*0x1],BL LAB_00101330: MOVZX EBX,byte ptr [RCX] ADD RCX,0x1 TEST BL,BL JNZ 0x00101318 MOVSXD RSI,ESI MOV RAX,R12 ADD RSI,R12 MOV byte ptr [RSI],0x0 ADD RSP,0x8 POP RBX POP R12 RET LAB_00101350: MOV RSI,RDI MOV RAX,R12 MOV byte ptr [RSI],0x0 ADD RSP,0x8 POP RBX POP R12 RET
byte * func0(byte *param_1) { ushort **ppuVar1; byte *pbVar2; long lVar3; byte bVar4; int iVar5; bVar4 = *param_1; if (bVar4 != 0) { ppuVar1 = __ctype_b_loc(); pbVar2 = param_1 + 1; iVar5 = 0; do { if ((*(byte *)((long)*ppuVar1 + (ulong)bVar4 * 2 + 1) & 0x20) == 0) { lVar3 = (long)iVar5; iVar5 = iVar5 + 1; param_1[lVar3] = bVar4; } bVar4 = *pbVar2; pbVar2 = pbVar2 + 1; } while (bVar4 != 0); param_1[iVar5] = 0; return param_1; } *param_1 = 0; return param_1; }
5,699
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <ctype.h>
char* func0(char* text1) { int i = 0, j = 0; while (text1[i]) { if (!isspace((unsigned char)text1[i])) { text1[j++] = text1[i]; } i++; } text1[j] = '\0'; return text1; }
int main() { char text1[] = " Google Flutter "; char text2[] = " Google Dart "; char text3[] = " iOS Swift "; assert(strcmp(func0(text1), "GoogleFlutter") == 0); assert(strcmp(func0(text2), "GoogleDart") == 0); assert(strcmp(func0(text3), "iOSSwift") == 0); return 0; }
O3
c
func0: endbr64 push %r12 mov %rdi,%r12 push %rbx sub $0x8,%rsp movzbl (%rdi),%ebx test %bl,%bl je 1358 <func0+0x78> callq 1090 <__ctype_b_loc@plt> lea 0x1(%r12),%rdx xor %r8d,%r8d xor %esi,%esi jmp 1329 <func0+0x49> nopw %cs:0x0(%rax,%rax,1) add $0x1,%rdx mov %bl,(%rcx) add $0x1,%r8d movzbl -0x1(%rdx),%ebx movslq %r8d,%rsi lea (%r12,%rsi,1),%rcx test %bl,%bl je 1346 <func0+0x66> mov (%rax),%r9 movzbl %bl,%edi lea (%r12,%rsi,1),%rcx testb $0x20,0x1(%r9,%rdi,2) je 1310 <func0+0x30> movzbl (%rdx),%ebx add $0x1,%rdx test %bl,%bl jne 132c <func0+0x4c> movb $0x0,(%rcx) add $0x8,%rsp mov %r12,%rax pop %rbx pop %r12 retq nopl 0x0(%rax) mov %rdi,%rcx mov %r12,%rax movb $0x0,(%rcx) add $0x8,%rsp pop %rbx pop %r12 retq nopl 0x0(%rax)
func0: endbr64 push rbp mov rbp, rdi push rbx sub rsp, 8 movzx ebx, byte ptr [rdi] test bl, bl jz short loc_1350 call ___ctype_b_loc lea rcx, [rbp+1] xor edx, edx jmp short loc_131E loc_1308: add rcx, 1 mov [rbp+rdx+0], bl lea esi, [rdx+1] movzx ebx, byte ptr [rcx-1] movsxd rdx, esi test bl, bl jz short loc_1337 loc_131E: mov r8, [rax] loc_1321: movzx esi, bl test byte ptr [r8+rsi*2+1], 20h jz short loc_1308 movzx ebx, byte ptr [rcx] add rcx, 1 test bl, bl jnz short loc_1321 loc_1337: add rdx, rbp mov rax, rbp mov byte ptr [rdx], 0 add rsp, 8 pop rbx pop rbp retn loc_1350: mov rdx, rdi mov rax, rbp mov byte ptr [rdx], 0 add rsp, 8 pop rbx pop rbp retn
unsigned __int8 * func0(unsigned __int8 *a1) { unsigned __int8 v1; // bl const unsigned __int16 **v2; // rax unsigned __int8 *v3; // rcx long long v4; // rdx unsigned __int8 *result; // rax v1 = *a1; if ( *a1 ) { v2 = __ctype_b_loc(); v3 = a1 + 1; v4 = 0LL; do { while ( ((*v2)[v1] & 0x2000) == 0 ) { ++v3; a1[v4] = v1; v1 = *(v3 - 1); v4 = (int)v4 + 1; if ( !v1 ) goto LABEL_6; } v1 = *v3++; } while ( v1 ); LABEL_6: result = a1; a1[v4] = 0; } else { result = a1; *a1 = 0; } return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RDI PUSH RBX SUB RSP,0x8 MOVZX EBX,byte ptr [RDI] TEST BL,BL JZ 0x00101350 CALL 0x001010b0 LEA RCX,[RBP + 0x1] XOR EDX,EDX JMP 0x0010131e LAB_00101308: ADD RCX,0x1 MOV byte ptr [RBP + RDX*0x1],BL LEA ESI,[RDX + 0x1] MOVZX EBX,byte ptr [RCX + -0x1] MOVSXD RDX,ESI TEST BL,BL JZ 0x00101337 LAB_0010131e: MOV R8,qword ptr [RAX] LAB_00101321: MOVZX ESI,BL TEST byte ptr [R8 + RSI*0x2 + 0x1],0x20 JZ 0x00101308 MOVZX EBX,byte ptr [RCX] ADD RCX,0x1 TEST BL,BL JNZ 0x00101321 LAB_00101337: ADD RDX,RBP MOV RAX,RBP MOV byte ptr [RDX],0x0 ADD RSP,0x8 POP RBX POP RBP RET LAB_00101350: MOV RDX,RDI MOV RAX,RBP MOV byte ptr [RDX],0x0 ADD RSP,0x8 POP RBX POP RBP RET
byte * func0(byte *param_1) { ushort **ppuVar1; byte *pbVar2; long lVar3; byte bVar4; bVar4 = *param_1; if (bVar4 == 0) { *param_1 = 0; return param_1; } ppuVar1 = __ctype_b_loc(); lVar3 = 0; pbVar2 = param_1 + 1; do { while ((*(byte *)((long)*ppuVar1 + (ulong)bVar4 * 2 + 1) & 0x20) != 0) { bVar4 = *pbVar2; pbVar2 = pbVar2 + 1; if (bVar4 == 0) goto LAB_00101337; } param_1[lVar3] = bVar4; bVar4 = *pbVar2; lVar3 = (long)((int)lVar3 + 1); pbVar2 = pbVar2 + 1; } while (bVar4 != 0); LAB_00101337: param_1[lVar3] = 0; return param_1; }
5,700
func0
#include <assert.h>
int func0(int actual_cost, int sale_amount) { if (sale_amount > actual_cost) { int amount = sale_amount - actual_cost; return amount; } else { return 0; // C doesn't support None, returns 0 to represent no loss. } }
int main() { assert(func0(1500, 1200) == 0); assert(func0(100, 200) == 100); assert(func0(2000, 5000) == 3000); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) mov -0x18(%rbp),%eax cmp -0x14(%rbp),%eax jle 116d <func0+0x24> mov -0x18(%rbp),%eax sub -0x14(%rbp),%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax jmp 1172 <func0+0x29> mov $0x0,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_18], esi mov eax, [rbp+var_18] cmp eax, [rbp+var_14] jle short loc_116D mov eax, [rbp+var_18] sub eax, [rbp+var_14] mov [rbp+var_4], eax mov eax, [rbp+var_4] jmp short loc_1172 loc_116D: mov eax, 0 loc_1172: pop rbp retn
long long func0(int a1, int a2) { if ( a2 <= a1 ) return 0LL; else return (unsigned int)(a2 - a1); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x18],ESI MOV EAX,dword ptr [RBP + -0x18] CMP EAX,dword ptr [RBP + -0x14] JLE 0x0010116d MOV EAX,dword ptr [RBP + -0x18] SUB EAX,dword ptr [RBP + -0x14] MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] JMP 0x00101172 LAB_0010116d: MOV EAX,0x0 LAB_00101172: POP RBP RET
int func0(int param_1,int param_2) { if (param_1 < param_2) { param_2 = param_2 - param_1; } else { param_2 = 0; } return param_2; }
5,701
func0
#include <assert.h>
int func0(int actual_cost, int sale_amount) { if (sale_amount > actual_cost) { int amount = sale_amount - actual_cost; return amount; } else { return 0; // C doesn't support None, returns 0 to represent no loss. } }
int main() { assert(func0(1500, 1200) == 0); assert(func0(100, 200) == 100); assert(func0(2000, 5000) == 3000); return 0; }
O1
c
func0: endbr64 mov %esi,%eax sub %edi,%eax cmp %edi,%esi mov $0x0,%edx cmovle %edx,%eax retq
func0: endbr64 mov eax, esi sub eax, edi cmp esi, edi mov edx, 0 cmovle eax, edx retn
long long func0(int a1, int a2) { long long result; // rax result = (unsigned int)(a2 - a1); if ( a2 <= a1 ) return 0LL; return result; }
func0: ENDBR64 MOV EAX,ESI SUB EAX,EDI CMP ESI,EDI MOV EDX,0x0 CMOVLE EAX,EDX RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = param_2 - param_1; if (param_2 <= param_1) { iVar1 = 0; } return iVar1; }
5,702
func0
#include <assert.h>
int func0(int actual_cost, int sale_amount) { if (sale_amount > actual_cost) { int amount = sale_amount - actual_cost; return amount; } else { return 0; // C doesn't support None, returns 0 to represent no loss. } }
int main() { assert(func0(1500, 1200) == 0); assert(func0(100, 200) == 100); assert(func0(2000, 5000) == 3000); return 0; }
O2
c
func0: endbr64 mov %esi,%eax mov $0x0,%edx sub %edi,%eax cmp %edi,%esi cmovle %edx,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 mov eax, esi xor edx, edx sub eax, edi cmp esi, edi cmovle eax, edx retn
long long func0(int a1, int a2) { long long result; // rax result = (unsigned int)(a2 - a1); if ( a2 <= a1 ) return 0LL; return result; }
func0: ENDBR64 MOV EAX,ESI XOR EDX,EDX SUB EAX,EDI CMP ESI,EDI CMOVLE EAX,EDX RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = param_2 - param_1; if (param_2 <= param_1) { iVar1 = 0; } return iVar1; }
5,703
func0
#include <assert.h>
int func0(int actual_cost, int sale_amount) { if (sale_amount > actual_cost) { int amount = sale_amount - actual_cost; return amount; } else { return 0; // C doesn't support None, returns 0 to represent no loss. } }
int main() { assert(func0(1500, 1200) == 0); assert(func0(100, 200) == 100); assert(func0(2000, 5000) == 3000); return 0; }
O3
c
func0: endbr64 mov %esi,%eax mov $0x0,%edx sub %edi,%eax cmp %edi,%esi cmovle %edx,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 mov eax, esi xor edx, edx sub eax, edi cmp esi, edi cmovle eax, edx retn
long long func0(int a1, int a2) { long long result; // rax result = (unsigned int)(a2 - a1); if ( a2 <= a1 ) return 0LL; return result; }
func0: ENDBR64 MOV EAX,ESI XOR EDX,EDX SUB EAX,EDI CMP ESI,EDI CMOVLE EAX,EDX RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = param_2 - param_1; if (param_2 <= param_1) { iVar1 = 0; } return iVar1; }
5,704
func0
#include <stdio.h> #include <math.h> #include <assert.h>
int func0(int n) { if (n % 2 != 0) { return 0; } int res = 1; for (int i = 2; i <= (int)(sqrt(n)) + 1; i++) { int count = 0; int curr_sum = 1; int curr_term = 1; while (n % i == 0) { count += 1; n = n / i; if (i == 2 && count == 1) { curr_sum = 0; } curr_term = curr_term * i; curr_sum = curr_sum + curr_term; } res = res * curr_sum; } if (n >= 2) { res = res * (1 + n); } return res; }
int main() { assert(func0(18) == 26); assert(func0(30) == 48); assert(func0(6) == 8); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %edi,-0x24(%rbp) mov -0x24(%rbp),%eax and $0x1,%eax test %eax,%eax je 118c <func0+0x23> mov $0x0,%eax jmpq 122d <func0+0xc4> movl $0x1,-0x14(%rbp) movl $0x2,-0x10(%rbp) jmp 11ff <func0+0x96> movl $0x0,-0xc(%rbp) movl $0x1,-0x8(%rbp) movl $0x1,-0x4(%rbp) jmp 11e4 <func0+0x7b> addl $0x1,-0xc(%rbp) mov -0x24(%rbp),%eax cltd idivl -0x10(%rbp) mov %eax,-0x24(%rbp) cmpl $0x2,-0x10(%rbp) jne 11d4 <func0+0x6b> cmpl $0x1,-0xc(%rbp) jne 11d4 <func0+0x6b> movl $0x0,-0x8(%rbp) mov -0x4(%rbp),%eax imul -0x10(%rbp),%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax add %eax,-0x8(%rbp) mov -0x24(%rbp),%eax cltd idivl -0x10(%rbp) mov %edx,%eax test %eax,%eax je 11b3 <func0+0x4a> mov -0x14(%rbp),%eax imul -0x8(%rbp),%eax mov %eax,-0x14(%rbp) addl $0x1,-0x10(%rbp) cvtsi2sdl -0x24(%rbp),%xmm0 callq 1070 <sqrt@plt> cvttsd2si %xmm0,%eax add $0x1,%eax cmp %eax,-0x10(%rbp) jle 119c <func0+0x33> cmpl $0x1,-0x24(%rbp) jle 122a <func0+0xc1> mov -0x24(%rbp),%eax lea 0x1(%rax),%edx mov -0x14(%rbp),%eax imul %edx,%eax mov %eax,-0x14(%rbp) mov -0x14(%rbp),%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_24], edi mov eax, [rbp+var_24] and eax, 1 test eax, eax jz short loc_118C mov eax, 0 jmp locret_123F loc_118C: mov [rbp+var_14], 1 mov [rbp+var_10], 2 jmp short loc_11FF loc_119C: mov [rbp+var_C], 0 mov [rbp+var_8], 1 mov [rbp+var_4], 1 jmp short loc_11E4 loc_11B3: add [rbp+var_C], 1 mov eax, [rbp+var_24] cdq idiv [rbp+var_10] mov [rbp+var_24], eax cmp [rbp+var_10], 2 jnz short loc_11D4 cmp [rbp+var_C], 1 jnz short loc_11D4 mov [rbp+var_8], 0 loc_11D4: mov eax, [rbp+var_4] imul eax, [rbp+var_10] mov [rbp+var_4], eax mov eax, [rbp+var_4] add [rbp+var_8], eax loc_11E4: mov eax, [rbp+var_24] cdq idiv [rbp+var_10] mov eax, edx test eax, eax jz short loc_11B3 mov eax, [rbp+var_14] imul eax, [rbp+var_8] mov [rbp+var_14], eax add [rbp+var_10], 1 loc_11FF: pxor xmm1, xmm1 cvtsi2sd xmm1, [rbp+var_24] movq rax, xmm1 movq xmm0, rax; x call _sqrt cvttsd2si eax, xmm0 add eax, 1 cmp [rbp+var_10], eax jle loc_119C cmp [rbp+var_24], 1 jle short loc_123C mov eax, [rbp+var_24] lea edx, [rax+1] mov eax, [rbp+var_14] imul eax, edx mov [rbp+var_14], eax loc_123C: mov eax, [rbp+var_14] locret_123F: leave retn
long long func0(int a1) { int v2; // [rsp+Ch] [rbp-24h] unsigned int v3; // [rsp+1Ch] [rbp-14h] int i; // [rsp+20h] [rbp-10h] int v5; // [rsp+24h] [rbp-Ch] int v6; // [rsp+28h] [rbp-8h] int v7; // [rsp+2Ch] [rbp-4h] v2 = a1; if ( (a1 & 1) != 0 ) return 0LL; v3 = 1; for ( i = 2; i <= (int)sqrt((double)v2) + 1; ++i ) { v5 = 0; v6 = 1; v7 = 1; while ( !(v2 % i) ) { ++v5; v2 /= i; if ( i == 2 && v5 == 1 ) v6 = 0; v7 *= i; v6 += v7; } v3 *= v6; } if ( v2 > 1 ) v3 *= v2 + 1; return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV dword ptr [RBP + -0x24],EDI MOV EAX,dword ptr [RBP + -0x24] AND EAX,0x1 TEST EAX,EAX JZ 0x0010118c MOV EAX,0x0 JMP 0x0010123f LAB_0010118c: MOV dword ptr [RBP + -0x14],0x1 MOV dword ptr [RBP + -0x10],0x2 JMP 0x001011ff LAB_0010119c: MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x8],0x1 MOV dword ptr [RBP + -0x4],0x1 JMP 0x001011e4 LAB_001011b3: ADD dword ptr [RBP + -0xc],0x1 MOV EAX,dword ptr [RBP + -0x24] CDQ IDIV dword ptr [RBP + -0x10] MOV dword ptr [RBP + -0x24],EAX CMP dword ptr [RBP + -0x10],0x2 JNZ 0x001011d4 CMP dword ptr [RBP + -0xc],0x1 JNZ 0x001011d4 MOV dword ptr [RBP + -0x8],0x0 LAB_001011d4: MOV EAX,dword ptr [RBP + -0x4] IMUL EAX,dword ptr [RBP + -0x10] MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] ADD dword ptr [RBP + -0x8],EAX LAB_001011e4: MOV EAX,dword ptr [RBP + -0x24] CDQ IDIV dword ptr [RBP + -0x10] MOV EAX,EDX TEST EAX,EAX JZ 0x001011b3 MOV EAX,dword ptr [RBP + -0x14] IMUL EAX,dword ptr [RBP + -0x8] MOV dword ptr [RBP + -0x14],EAX ADD dword ptr [RBP + -0x10],0x1 LAB_001011ff: PXOR XMM1,XMM1 CVTSI2SD XMM1,dword ptr [RBP + -0x24] MOVQ RAX,XMM1 MOVQ XMM0,RAX CALL 0x00101070 CVTTSD2SI EAX,XMM0 ADD EAX,0x1 CMP dword ptr [RBP + -0x10],EAX JLE 0x0010119c CMP dword ptr [RBP + -0x24],0x1 JLE 0x0010123c MOV EAX,dword ptr [RBP + -0x24] LEA EDX,[RAX + 0x1] MOV EAX,dword ptr [RBP + -0x14] IMUL EAX,EDX MOV dword ptr [RBP + -0x14],EAX LAB_0010123c: MOV EAX,dword ptr [RBP + -0x14] LAB_0010123f: LEAVE RET
int func0(uint param_1) { double dVar1; uint local_2c; int local_1c; int local_18; int local_14; int local_10; int local_c; if ((param_1 & 1) == 0) { local_1c = 1; local_2c = param_1; for (local_18 = 2; dVar1 = sqrt((double)(int)local_2c), local_18 <= (int)dVar1 + 1; local_18 = local_18 + 1) { local_14 = 0; local_10 = 1; local_c = 1; while ((int)local_2c % local_18 == 0) { local_14 = local_14 + 1; local_2c = (int)local_2c / local_18; if ((local_18 == 2) && (local_14 == 1)) { local_10 = 0; } local_c = local_c * local_18; local_10 = local_10 + local_c; } local_1c = local_1c * local_10; } if (1 < (int)local_2c) { local_1c = local_1c * (local_2c + 1); } } else { local_1c = 0; } return local_1c; }
5,705
func0
#include <stdio.h> #include <math.h> #include <assert.h>
int func0(int n) { if (n % 2 != 0) { return 0; } int res = 1; for (int i = 2; i <= (int)(sqrt(n)) + 1; i++) { int count = 0; int curr_sum = 1; int curr_term = 1; while (n % i == 0) { count += 1; n = n / i; if (i == 2 && count == 1) { curr_sum = 0; } curr_term = curr_term * i; curr_sum = curr_sum + curr_term; } res = res * curr_sum; } if (n >= 2) { res = res * (1 + n); } return res; }
int main() { assert(func0(18) == 26); assert(func0(30) == 48); assert(func0(6) == 8); return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx sub $0x10,%rsp mov $0x0,%r12d test $0x1,%dil jne 121b <func0+0xb2> mov %edi,%ebp mov $0x2,%ebx mov $0x1,%r12d jmp 11c1 <func0+0x58> imul %ebx,%esi add %esi,%ecx mov %ebp,%eax cltd idiv %ebx test %edx,%edx jne 11ba <func0+0x51> add $0x1,%edi mov %ebp,%eax cltd idiv %ebx mov %eax,%ebp cmp $0x2,%ebx jne 1194 <func0+0x2b> cmp $0x1,%edi cmove %r8d,%ecx jmp 1194 <func0+0x2b> imul %ecx,%r12d add $0x1,%ebx pxor %xmm0,%xmm0 cvtsi2sd %ebp,%xmm0 movapd %xmm0,%xmm1 sqrtsd %xmm1,%xmm1 movsd %xmm1,0x8(%rsp) pxor %xmm2,%xmm2 ucomisd %xmm0,%xmm2 ja 1208 <func0+0x9f> cvttsd2si 0x8(%rsp),%eax add $0x1,%eax cmp %ebx,%eax jl 120f <func0+0xa6> mov %ebp,%eax cltd idiv %ebx mov %edx,%r8d mov %edx,%edi mov $0x1,%esi mov $0x1,%ecx test %edx,%edx je 11a2 <func0+0x39> jmp 11ba <func0+0x51> callq 1070 <sqrt@plt> jmp 11e1 <func0+0x78> cmp $0x1,%ebp jle 121b <func0+0xb2> add $0x1,%ebp imul %ebp,%r12d mov %r12d,%eax add $0x10,%rsp pop %rbx pop %rbp pop %r12 retq
func0: endbr64 push r12 push rbp push rbx mov r12d, 0 test dil, 1 jnz loc_120B mov ebp, edi mov ebx, 2 mov r12d, 1 jmp short loc_11BD loc_1190: imul esi, ebx add ecx, esi mov eax, ebp cdq idiv ebx test edx, edx jnz short loc_11B6 loc_119E: add edi, 1 mov eax, ebp cdq idiv ebx mov ebp, eax cmp ebx, 2 jnz short loc_1190 cmp edi, 1 cmovz ecx, r8d jmp short loc_1190 loc_11B6: imul r12d, ecx add ebx, 1 loc_11BD: pxor xmm0, xmm0 cvtsi2sd xmm0, ebp pxor xmm1, xmm1 ucomisd xmm1, xmm0 ja short loc_11F8 sqrtsd xmm0, xmm0 loc_11D3: cvttsd2si eax, xmm0 add eax, 1 cmp eax, ebx jl short loc_11FF mov eax, ebp cdq idiv ebx mov r8d, edx mov edi, edx mov esi, 1 mov ecx, 1 test edx, edx jz short loc_119E jmp short loc_11B6 loc_11F8: call _sqrt jmp short loc_11D3 loc_11FF: cmp ebp, 1 jle short loc_120B add ebp, 1 imul r12d, ebp loc_120B: mov eax, r12d pop rbx pop rbp pop r12 retn
long long func0(int a1) { unsigned int v1; // r12d int v2; // ebp int v3; // ebx int v4; // esi int i; // ecx int v6; // edi double v7; // xmm0_8 double v8; // xmm0_8 int v9; // r8d v1 = 0; if ( (a1 & 1) == 0 ) { v2 = a1; v3 = 2; v1 = 1; while ( 1 ) { v7 = (double)v2; v8 = (double)v2 < 0.0 ? sqrt(v7) : sqrt(v7); if ( (int)v8 + 1 < v3 ) break; v9 = v2 % v3; v6 = v2 % v3; v4 = 1; for ( i = 1; !(v2 % v3); i += v4 ) { ++v6; v2 /= v3; if ( v3 == 2 && v6 == 1 ) i = v9; v4 *= v3; } v1 *= i; ++v3; } if ( v2 > 1 ) v1 *= v2 + 1; } return v1; }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX MOV R12D,0x0 TEST DIL,0x1 JNZ 0x0010120b MOV EBP,EDI MOV EBX,0x2 MOV R12D,0x1 JMP 0x001011bd LAB_00101190: IMUL ESI,EBX ADD ECX,ESI MOV EAX,EBP CDQ IDIV EBX TEST EDX,EDX JNZ 0x001011b6 LAB_0010119e: ADD EDI,0x1 MOV EAX,EBP CDQ IDIV EBX MOV EBP,EAX CMP EBX,0x2 JNZ 0x00101190 CMP EDI,0x1 CMOVZ ECX,R8D JMP 0x00101190 LAB_001011b6: IMUL R12D,ECX ADD EBX,0x1 LAB_001011bd: PXOR XMM0,XMM0 CVTSI2SD XMM0,EBP PXOR XMM1,XMM1 UCOMISD XMM1,XMM0 JA 0x001011f8 SQRTSD XMM0,XMM0 LAB_001011d3: CVTTSD2SI EAX,XMM0 ADD EAX,0x1 CMP EAX,EBX JL 0x001011ff MOV EAX,EBP CDQ IDIV EBX MOV R8D,EDX MOV EDI,EDX MOV ESI,0x1 MOV ECX,0x1 TEST EDX,EDX JZ 0x0010119e JMP 0x001011b6 LAB_001011f8: CALL 0x00101070 JMP 0x001011d3 LAB_001011ff: CMP EBP,0x1 JLE 0x0010120b ADD EBP,0x1 IMUL R12D,EBP LAB_0010120b: MOV EAX,R12D POP RBX POP RBP POP R12 RET
int func0(ulong param_1) { ulong uVar1; int iVar2; int iVar3; int iVar4; int iVar5; int iVar6; int iVar7; double dVar8; iVar7 = 0; if ((param_1 & 1) == 0) { param_1 = param_1 & 0xffffffff; iVar5 = 2; iVar7 = 1; while( true ) { iVar4 = (int)param_1; dVar8 = (double)iVar4; if (dVar8 < 0.0) { dVar8 = sqrt(dVar8); } else { dVar8 = SQRT(dVar8); } if ((int)dVar8 + 1 < iVar5) break; iVar6 = 1; iVar2 = 1; iVar4 = iVar4 % iVar5; iVar3 = iVar4; while (iVar3 == 0) { iVar4 = iVar4 + 1; uVar1 = (long)(int)param_1 / (long)iVar5; param_1 = uVar1 & 0xffffffff; if ((iVar5 == 2) && (iVar4 == 1)) { iVar2 = 0; } iVar6 = iVar6 * iVar5; iVar2 = iVar2 + iVar6; iVar3 = (int)((long)((ulong)(uint)((int)uVar1 >> 0x1f) << 0x20 | param_1) % (long)iVar5); } iVar7 = iVar7 * iVar2; iVar5 = iVar5 + 1; } if (1 < iVar4) { iVar7 = iVar7 * (iVar4 + 1); } } return iVar7; }
5,706
func0
#include <stdio.h> #include <math.h> #include <assert.h>
int func0(int n) { if (n % 2 != 0) { return 0; } int res = 1; for (int i = 2; i <= (int)(sqrt(n)) + 1; i++) { int count = 0; int curr_sum = 1; int curr_term = 1; while (n % i == 0) { count += 1; n = n / i; if (i == 2 && count == 1) { curr_sum = 0; } curr_term = curr_term * i; curr_sum = curr_sum + curr_term; } res = res * curr_sum; } if (n >= 2) { res = res * (1 + n); } return res; }
int main() { assert(func0(18) == 26); assert(func0(30) == 48); assert(func0(6) == 8); return 0; }
O2
c
func0: endbr64 test $0x1,%dil jne 1320 <func0+0x10> jmpq 1210 <func0.part.0> xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0_part_0: pxor xmm1, xmm1 push r13 pxor xmm2, xmm2 mov r13d, 1 push r12 cvtsi2sd xmm1, edi xor r12d, r12d push rbp mov ebp, edi push rbx mov ebx, 2 sub rsp, 18h nop word ptr [rax+rax+00000000h] loc_1240: ucomisd xmm2, xmm1 movapd xmm0, xmm1 ja loc_12DA sqrtsd xmm0, xmm0 loc_1252: cvttsd2si eax, xmm0 add eax, 1 cmp ebx, eax jg short loc_12C0 mov eax, ebp cdq idiv ebx test edx, edx jnz short loc_12B4 cmp ebx, 2 mov esi, 1 mov edi, 1 setz r9b xor r8d, r8d nop word ptr [rax+rax+00h] loc_1280: mov eax, ebp add r8d, 1 cdq idiv ebx mov ecx, eax mov ebp, eax cmp r8d, 1 jnz short loc_129A test r9b, r9b cmovnz esi, r12d loc_129A: imul edi, ebx mov eax, ecx cdq idiv ebx add esi, edi test edx, edx jz short loc_1280 pxor xmm1, xmm1 imul r13d, esi cvtsi2sd xmm1, ecx loc_12B4: add ebx, 1 jmp short loc_1240 loc_12C0: cmp ebp, 1 jle short loc_12CC add ebp, 1 imul r13d, ebp loc_12CC: add rsp, 18h mov eax, r13d pop rbx pop rbp pop r12 pop r13 retn loc_12DA: movsd [rsp+38h+var_30], xmm1 call _sqrt movsd xmm1, [rsp+38h+var_30] pxor xmm2, xmm2 jmp loc_1252
long long func0_part_0(int a1) { unsigned int v1; // r13d double v2; // xmm1_8 int v3; // ebp int i; // ebx double v5; // xmm0_8 int v6; // esi int v7; // edi int v8; // r8d int v9; // ecx v1 = 1; v2 = (double)a1; v3 = a1; for ( i = 2; ; ++i ) { v5 = v2 < 0.0 ? sqrt(v2) : sqrt(v2); if ( i > (int)v5 + 1 ) break; if ( !(v3 % i) ) { v6 = 1; v7 = 1; v8 = 0; do { ++v8; v9 = v3 / i; v3 /= i; if ( v8 == 1 && i == 2 ) v6 = 0; v7 *= i; v6 += v7; } while ( !(v9 % i) ); v1 *= v6; v2 = (double)v9; } } if ( v3 > 1 ) v1 *= v3 + 1; return v1; }
func0.part.0: PXOR XMM1,XMM1 PUSH R13 PXOR XMM2,XMM2 MOV R13D,0x1 PUSH R12 CVTSI2SD XMM1,EDI XOR R12D,R12D PUSH RBP MOV EBP,EDI PUSH RBX MOV EBX,0x2 SUB RSP,0x18 NOP word ptr CS:[RAX + RAX*0x1] LAB_00101240: UCOMISD XMM2,XMM1 MOVAPD XMM0,XMM1 JA 0x001012da SQRTSD XMM0,XMM0 LAB_00101252: CVTTSD2SI EAX,XMM0 ADD EAX,0x1 CMP EBX,EAX JG 0x001012c0 MOV EAX,EBP CDQ IDIV EBX TEST EDX,EDX JNZ 0x001012b4 CMP EBX,0x2 MOV ESI,0x1 MOV EDI,0x1 SETZ R9B XOR R8D,R8D NOP word ptr [RAX + RAX*0x1] LAB_00101280: MOV EAX,EBP ADD R8D,0x1 CDQ IDIV EBX MOV ECX,EAX MOV EBP,EAX CMP R8D,0x1 JNZ 0x0010129a TEST R9B,R9B CMOVNZ ESI,R12D LAB_0010129a: IMUL EDI,EBX MOV EAX,ECX CDQ IDIV EBX ADD ESI,EDI TEST EDX,EDX JZ 0x00101280 PXOR XMM1,XMM1 IMUL R13D,ESI CVTSI2SD XMM1,ECX LAB_001012b4: ADD EBX,0x1 JMP 0x00101240 LAB_001012c0: CMP EBP,0x1 JLE 0x001012cc ADD EBP,0x1 IMUL R13D,EBP LAB_001012cc: ADD RSP,0x18 MOV EAX,R13D POP RBX POP RBP POP R12 POP R13 RET LAB_001012da: MOVSD qword ptr [RSP + 0x8],XMM1 CALL 0x00101070 MOVSD XMM1,qword ptr [RSP + 0x8] PXOR XMM2,XMM2 JMP 0x00101252
int func0_part_0(uint param_1) { ulong uVar1; int iVar2; ulong uVar3; int iVar4; int iVar5; int iVar6; int iVar7; double dVar8; double __x; iVar7 = 1; __x = (double)(int)param_1; uVar3 = (ulong)param_1; iVar2 = 2; while( true ) { if (__x < 0.0) { dVar8 = sqrt(__x); } else { dVar8 = SQRT(__x); } iVar4 = (int)uVar3; if ((int)dVar8 + 1 < iVar2) break; if (iVar4 % iVar2 == 0) { iVar4 = 1; iVar5 = 1; iVar6 = 0; do { iVar6 = iVar6 + 1; uVar1 = (long)(int)uVar3 / (long)iVar2; uVar3 = uVar1 & 0xffffffff; if ((iVar6 == 1) && (iVar2 == 2)) { iVar4 = 0; } iVar5 = iVar5 * iVar2; iVar4 = iVar4 + iVar5; } while ((int)((long)((ulong)(uint)((int)uVar1 >> 0x1f) << 0x20 | uVar1 & 0xffffffff) % (long)iVar2) == 0); iVar7 = iVar7 * iVar4; __x = (double)(int)uVar1; } iVar2 = iVar2 + 1; } if (1 < iVar4) { iVar7 = iVar7 * (iVar4 + 1); } return iVar7; }
5,707
func0
#include <stdio.h> #include <math.h> #include <assert.h>
int func0(int n) { if (n % 2 != 0) { return 0; } int res = 1; for (int i = 2; i <= (int)(sqrt(n)) + 1; i++) { int count = 0; int curr_sum = 1; int curr_term = 1; while (n % i == 0) { count += 1; n = n / i; if (i == 2 && count == 1) { curr_sum = 0; } curr_term = curr_term * i; curr_sum = curr_sum + curr_term; } res = res * curr_sum; } if (n >= 2) { res = res * (1 + n); } return res; }
int main() { assert(func0(18) == 26); assert(func0(30) == 48); assert(func0(6) == 8); return 0; }
O3
c
func0: endbr64 push %r12 xor %r12d,%r12d push %rbx sub $0x28,%rsp test $0x1,%dil jne 13dc <func0+0xcc> pxor %xmm1,%xmm1 mov $0x2,%ebx mov $0x1,%r12d cvtsi2sd %edi,%xmm1 pxor %xmm3,%xmm3 ucomisd %xmm1,%xmm3 movapd %xmm1,%xmm2 sqrtsd %xmm2,%xmm2 ja 13e7 <func0+0xd7> cvttsd2si %xmm2,%eax add $0x1,%eax cmp %eax,%ebx jg 13d0 <func0+0xc0> mov %edi,%eax cltd idiv %ebx mov %edx,%esi test %edx,%edx jne 13c7 <func0+0xb7> cmp $0x2,%ebx mov $0x1,%r9d mov $0x1,%r8d sete %r10b nopl 0x0(%rax,%rax,1) mov %edi,%eax add $0x1,%esi cltd idiv %ebx mov %eax,%ecx mov %eax,%edi cmp $0x1,%esi jne 13a8 <func0+0x98> test %r10b,%r10b je 13a8 <func0+0x98> add %r8d,%r8d test $0x1,%al jne 13bb <func0+0xab> mov %r8d,%r9d jmp 1380 <func0+0x70> nopw 0x0(%rax,%rax,1) mov %ecx,%eax imul %ebx,%r8d cltd idiv %ebx add %r8d,%r9d test %edx,%edx je 1380 <func0+0x70> mov %r9d,%r8d pxor %xmm1,%xmm1 imul %r8d,%r12d cvtsi2sd %ecx,%xmm1 add $0x1,%ebx jmpq 1340 <func0+0x30> cmp $0x1,%edi jle 13dc <func0+0xcc> add $0x1,%edi imul %edi,%r12d add $0x28,%rsp mov %r12d,%eax pop %rbx pop %r12 retq movapd %xmm1,%xmm0 mov %edi,0x1c(%rsp) movsd %xmm2,0x10(%rsp) movsd %xmm1,0x8(%rsp) callq 1070 <sqrt@plt> mov 0x1c(%rsp),%edi movsd 0x10(%rsp),%xmm2 pxor %xmm3,%xmm3 movsd 0x8(%rsp),%xmm1 jmpq 1352 <func0+0x42> nopl 0x0(%rax)
func0_part_0: pxor xmm1, xmm1 push r12 pxor xmm2, xmm2 mov r12d, 1 push rbp cvtsi2sd xmm1, edi mov ebp, edi push rbx mov ebx, 2 sub rsp, 10h nop dword ptr [rax+00000000h] loc_1238: ucomisd xmm2, xmm1 movapd xmm0, xmm1; x ja loc_12E0 sqrtsd xmm0, xmm0 loc_124A: cvttsd2si eax, xmm0 add eax, 1 cmp ebx, eax jg short loc_12C8 mov eax, ebp cdq idiv ebx mov ecx, edx test edx, edx jnz short loc_12BB cmp ebx, 2 mov r8d, 1 mov edi, 1 setz r9b nop word ptr [rax+rax+00h] loc_1278: mov eax, ebp add ecx, 1 cdq idiv ebx mov esi, eax mov ebp, eax cmp ecx, 1 jnz short loc_12A0 test r9b, r9b jz short loc_12A0 lea r8d, [rdi+rdi] test al, 1 jnz short loc_12AF mov edi, r8d jmp short loc_1278 loc_12A0: mov eax, esi imul edi, ebx cdq idiv ebx add r8d, edi test edx, edx jz short loc_1278 loc_12AF: pxor xmm1, xmm1 imul r12d, r8d cvtsi2sd xmm1, esi loc_12BB: add ebx, 1 jmp loc_1238 loc_12C8: cmp ebp, 1 jle short loc_12D4 add ebp, 1 imul r12d, ebp loc_12D4: add rsp, 10h mov eax, r12d pop rbx pop rbp pop r12 retn loc_12E0: movsd [rsp+28h+var_20], xmm1 call _sqrt movsd xmm1, [rsp+28h+var_20] pxor xmm2, xmm2 jmp loc_124A
long long func0_part_0(int a1) { unsigned int v1; // r12d double v2; // xmm1_8 int v3; // ebp int i; // ebx double v5; // xmm0_8 int v6; // ecx int v7; // r8d int v8; // edi int v9; // eax int v10; // esi v1 = 1; v2 = (double)a1; v3 = a1; for ( i = 2; ; ++i ) { v5 = v2 < 0.0 ? sqrt(v2) : sqrt(v2); if ( i > (int)v5 + 1 ) break; v6 = v3 % i; if ( !(v3 % i) ) { v7 = 1; v8 = 1; do { while ( 1 ) { ++v6; v9 = v3 / i; v10 = v3 / i; v3 /= i; if ( v6 != 1 || i != 2 ) break; v7 = 2 * v8; if ( (v9 & 1) != 0 ) goto LABEL_12; v8 *= 2; } v8 *= i; v7 += v8; } while ( !(v10 % i) ); LABEL_12: v1 *= v7; v2 = (double)v10; } } if ( v3 > 1 ) v1 *= v3 + 1; return v1; }
func0.part.0: PXOR XMM1,XMM1 PUSH R12 PXOR XMM2,XMM2 MOV R12D,0x1 PUSH RBP CVTSI2SD XMM1,EDI MOV EBP,EDI PUSH RBX MOV EBX,0x2 SUB RSP,0x10 NOP dword ptr [RAX] LAB_00101238: UCOMISD XMM2,XMM1 MOVAPD XMM0,XMM1 JA 0x001012e0 SQRTSD XMM0,XMM0 LAB_0010124a: CVTTSD2SI EAX,XMM0 ADD EAX,0x1 CMP EBX,EAX JG 0x001012c8 MOV EAX,EBP CDQ IDIV EBX MOV ECX,EDX TEST EDX,EDX JNZ 0x001012bb CMP EBX,0x2 MOV R8D,0x1 MOV EDI,0x1 SETZ R9B NOP word ptr [RAX + RAX*0x1] LAB_00101278: MOV EAX,EBP ADD ECX,0x1 CDQ IDIV EBX MOV ESI,EAX MOV EBP,EAX CMP ECX,0x1 JNZ 0x001012a0 TEST R9B,R9B JZ 0x001012a0 LEA R8D,[RDI + RDI*0x1] TEST AL,0x1 JNZ 0x001012af MOV EDI,R8D JMP 0x00101278 LAB_001012a0: MOV EAX,ESI IMUL EDI,EBX CDQ IDIV EBX ADD R8D,EDI TEST EDX,EDX JZ 0x00101278 LAB_001012af: PXOR XMM1,XMM1 IMUL R12D,R8D CVTSI2SD XMM1,ESI LAB_001012bb: ADD EBX,0x1 JMP 0x00101238 LAB_001012c8: CMP EBP,0x1 JLE 0x001012d4 ADD EBP,0x1 IMUL R12D,EBP LAB_001012d4: ADD RSP,0x10 MOV EAX,R12D POP RBX POP RBP POP R12 RET LAB_001012e0: MOVSD qword ptr [RSP + 0x8],XMM1 CALL 0x00101070 MOVSD XMM1,qword ptr [RSP + 0x8] PXOR XMM2,XMM2 JMP 0x0010124a
int func0_part_0(uint param_1) { ulong uVar1; uint uVar2; int iVar4; ulong uVar5; int iVar6; int iVar7; int iVar8; double dVar9; double __x; ulong uVar3; iVar8 = 1; __x = (double)(int)param_1; uVar5 = (ulong)param_1; iVar4 = 2; do { if (__x < 0.0) { dVar9 = sqrt(__x); } else { dVar9 = SQRT(__x); } iVar7 = (int)uVar5; if ((int)dVar9 + 1 < iVar4) { if (1 < iVar7) { iVar8 = iVar8 * (iVar7 + 1); } return iVar8; } uVar3 = (long)iVar7 % (long)iVar4 & 0xffffffff; if ((int)((long)iVar7 % (long)iVar4) == 0) { iVar7 = 1; iVar6 = 1; do { while( true ) { uVar2 = (int)uVar3 + 1; uVar3 = (ulong)uVar2; uVar1 = (long)(int)uVar5 / (long)iVar4; uVar5 = uVar1 & 0xffffffff; if ((uVar2 != 1) || (iVar4 != 2)) break; iVar7 = iVar6 * 2; iVar6 = iVar7; if ((uVar1 & 1) != 0) goto LAB_001012af; } iVar7 = iVar7 + iVar6 * iVar4; iVar6 = iVar6 * iVar4; } while ((int)((long)((ulong)(uint)((int)uVar1 >> 0x1f) << 0x20 | uVar1 & 0xffffffff) % (long)iVar4) == 0); LAB_001012af: iVar8 = iVar8 * iVar7; __x = (double)(int)uVar1; } iVar4 = iVar4 + 1; } while( true ); }
5,708
func0
#include <stdio.h> #include <regex.h> #include <assert.h>
const char* func0(const char* text) { regex_t regex; int reti; char* pattern = "\\w*z.\\w*"; // Compile the regular expression reti = regcomp(&regex, pattern, REG_EXTENDED); if (reti) { fprintf(stderr, "Could not compile regex\n"); return "Regex compile error"; } // Execute the regular expression reti = regexec(&regex, text, 0, NULL, 0); // Free memory allocated to the pattern buffer regfree(&regex); // Check the result of the match if (!reti) { return "Found a match!"; } else if (reti == REG_NOMATCH) { return "Not matched!"; } else { // An error occurred char error_message[100]; regerror(reti, &regex, error_message, sizeof(error_message)); fprintf(stderr, "Regex match failed: %s\n", error_message); return "Regex match error"; } }
int main() { // Assert statements assert(func0("pythonz.") == "Found a match!"); assert(func0("xyz.") == "Found a match!"); assert(func0(" lang .") == "Not matched!"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0xd0,%rsp mov %rdi,-0xc8(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea 0xdb3(%rip),%rax mov %rax,-0xb8(%rbp) mov -0xb8(%rbp),%rcx lea -0xb0(%rbp),%rax mov $0x1,%edx mov %rcx,%rsi mov %rax,%rdi callq 10f0 <regcomp@plt> mov %eax,-0xbc(%rbp) cmpl $0x0,-0xbc(%rbp) je 12b5 <func0+0x8c> mov 0x2d90(%rip),%rax mov %rax,%rcx mov $0x18,%edx mov $0x1,%esi lea 0xd6d(%rip),%rdi callq 1130 <fwrite@plt> lea 0xd7a(%rip),%rax jmpq 1357 <func0+0x12e> mov -0xc8(%rbp),%rsi lea -0xb0(%rbp),%rax mov $0x0,%r8d mov $0x0,%ecx mov $0x0,%edx mov %rax,%rdi callq 1120 <regexec@plt> mov %eax,-0xbc(%rbp) lea -0xb0(%rbp),%rax mov %rax,%rdi callq 10c0 <regfree@plt> cmpl $0x0,-0xbc(%rbp) jne 1302 <func0+0xd9> lea 0xd3e(%rip),%rax jmp 1357 <func0+0x12e> cmpl $0x1,-0xbc(%rbp) jne 1314 <func0+0xeb> lea 0xd3b(%rip),%rax jmp 1357 <func0+0x12e> lea -0x70(%rbp),%rdx lea -0xb0(%rbp),%rsi mov -0xbc(%rbp),%eax mov $0x64,%ecx mov %eax,%edi callq 1110 <regerror@plt> mov 0x2ce8(%rip),%rax lea -0x70(%rbp),%rdx lea 0xd17(%rip),%rsi mov %rax,%rdi mov $0x0,%eax callq 1100 <fprintf@plt> lea 0xd1b(%rip),%rax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 136b <func0+0x142> callq 10d0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 0D0h mov [rbp+string], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea rax, aWZW; "\\w*z.\\w*" mov [rbp+pattern], rax mov rcx, [rbp+pattern] lea rax, [rbp+preg] mov edx, 1; cflags mov rsi, rcx; pattern mov rdi, rax; preg call _regcomp mov [rbp+errcode], eax cmp [rbp+errcode], 0 jz short loc_12B8 mov rax, cs:__bss_start mov rcx, rax; s mov edx, 18h; n mov esi, 1; size lea rax, aCouldNotCompil; "Could not compile regex\n" mov rdi, rax; ptr call _fwrite lea rax, aRegexCompileEr; "Regex compile error" jmp loc_135D loc_12B8: 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+errcode], eax lea rax, [rbp+preg] mov rdi, rax; preg call _regfree cmp [rbp+errcode], 0 jnz short loc_1305 lea rax, aFoundAMatch; "Found a match!" jmp short loc_135D loc_1305: cmp [rbp+errcode], 1 jnz short loc_1317 lea rax, aNotMatched; "Not matched!" jmp short loc_135D loc_1317: lea rdx, [rbp+errbuf]; errbuf lea rsi, [rbp+preg]; preg mov eax, [rbp+errcode] mov ecx, 64h ; 'd'; errbuf_size mov edi, eax; errcode call _regerror mov rax, cs:__bss_start lea rdx, [rbp+errbuf] lea rcx, format; "Regex match failed: %s\n" mov rsi, rcx; format mov rdi, rax; stream mov eax, 0 call _fprintf lea rax, aRegexMatchErro; "Regex match error" loc_135D: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_1371 call ___stack_chk_fail locret_1371: leave retn
const char * func0(const char *a1) { int errcode; // [rsp+14h] [rbp-BCh] regex_t preg; // [rsp+20h] [rbp-B0h] BYREF char errbuf[104]; // [rsp+60h] [rbp-70h] BYREF unsigned long long v5; // [rsp+C8h] [rbp-8h] v5 = __readfsqword(0x28u); if ( regcomp(&preg, "\\w*z.\\w*", 1) ) { fwrite("Could not compile regex\n", 1uLL, 0x18uLL, _bss_start); return "Regex compile error"; } else { errcode = regexec(&preg, a1, 0LL, 0LL, 0); regfree(&preg); if ( errcode ) { if ( errcode == 1 ) { return "Not matched!"; } else { regerror(errcode, &preg, errbuf, 0x64uLL); fprintf(_bss_start, "Regex match failed: %s\n", errbuf); return "Regex match error"; } } else { return "Found a match!"; } } }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0xd0 MOV qword ptr [RBP + -0xc8],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX LEA RAX,[0x102008] MOV qword ptr [RBP + -0xb8],RAX MOV RCX,qword ptr [RBP + -0xb8] LEA RAX,[RBP + -0xb0] MOV EDX,0x1 MOV RSI,RCX MOV RDI,RAX CALL 0x001010f0 MOV dword ptr [RBP + -0xbc],EAX CMP dword ptr [RBP + -0xbc],0x0 JZ 0x001012b8 MOV RAX,qword ptr [0x00104020] MOV RCX,RAX MOV EDX,0x18 MOV ESI,0x1 LEA RAX,[0x102011] MOV RDI,RAX CALL 0x00101130 LEA RAX,[0x10202a] JMP 0x0010135d LAB_001012b8: MOV RSI,qword ptr [RBP + -0xc8] LEA RAX,[RBP + -0xb0] MOV R8D,0x0 MOV ECX,0x0 MOV EDX,0x0 MOV RDI,RAX CALL 0x00101120 MOV dword ptr [RBP + -0xbc],EAX LEA RAX,[RBP + -0xb0] MOV RDI,RAX CALL 0x001010c0 CMP dword ptr [RBP + -0xbc],0x0 JNZ 0x00101305 LEA RAX,[0x10203e] JMP 0x0010135d LAB_00101305: CMP dword ptr [RBP + -0xbc],0x1 JNZ 0x00101317 LEA RAX,[0x10204d] JMP 0x0010135d LAB_00101317: LEA RDX,[RBP + -0x70] LEA RSI,[RBP + -0xb0] MOV EAX,dword ptr [RBP + -0xbc] MOV ECX,0x64 MOV EDI,EAX CALL 0x00101110 MOV RAX,qword ptr [0x00104020] LEA RDX,[RBP + -0x70] LEA RCX,[0x10205a] MOV RSI,RCX MOV RDI,RAX MOV EAX,0x0 CALL 0x00101100 LEA RAX,[0x102072] LAB_0010135d: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x00101371 CALL 0x001010d0 LAB_00101371: LEAVE RET
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t local_b8; char local_78 [104]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&local_b8,"\\w*z.\\w*",1); if (iVar1 == 0) { iVar1 = regexec(&local_b8,param_1,0,(regmatch_t *)0x0,0); regfree(&local_b8); if (iVar1 == 0) { pcVar2 = "Found a match!"; } else if (iVar1 == 1) { pcVar2 = "Not matched!"; } else { regerror(iVar1,&local_b8,local_78,100); fprintf(stderr,"Regex match failed: %s\n",local_78); pcVar2 = "Regex match error"; } } else { fwrite("Could not compile regex\n",1,0x18,stderr); pcVar2 = "Regex compile error"; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return pcVar2; }
5,709
func0
#include <stdio.h> #include <regex.h> #include <assert.h>
const char* func0(const char* text) { regex_t regex; int reti; char* pattern = "\\w*z.\\w*"; // Compile the regular expression reti = regcomp(&regex, pattern, REG_EXTENDED); if (reti) { fprintf(stderr, "Could not compile regex\n"); return "Regex compile error"; } // Execute the regular expression reti = regexec(&regex, text, 0, NULL, 0); // Free memory allocated to the pattern buffer regfree(&regex); // Check the result of the match if (!reti) { return "Found a match!"; } else if (reti == REG_NOMATCH) { return "Not matched!"; } else { // An error occurred char error_message[100]; regerror(reti, &regex, error_message, sizeof(error_message)); fprintf(stderr, "Regex match failed: %s\n", error_message); return "Regex match error"; } }
int main() { // Assert statements assert(func0("pythonz.") == "Found a match!"); assert(func0("xyz.") == "Found a match!"); assert(func0(" lang .") == "Not matched!"); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0xb8,%rsp mov %rdi,%rbx mov %fs:0x28,%rax mov %rax,0xa8(%rsp) xor %eax,%eax mov %rsp,%rdi mov $0x1,%edx lea 0xdeb(%rip),%rsi callq 10f0 <regcomp@plt> test %eax,%eax jne 12e3 <func0+0xba> mov %rsp,%rbp mov $0x0,%r8d mov $0x0,%ecx mov $0x0,%edx mov %rbx,%rsi mov %rbp,%rdi callq 1110 <regexec@plt> mov %eax,%ebx mov %rbp,%rdi callq 10c0 <regfree@plt> lea 0xd97(%rip),%rax test %ebx,%ebx je 1307 <func0+0xde> lea 0xd9b(%rip),%rax cmp $0x1,%ebx je 1307 <func0+0xde> lea 0x40(%rsp),%rbp mov %rsp,%rsi mov $0x64,%ecx mov %rbp,%rdx mov %ebx,%edi callq 1100 <regerror@plt> mov %rbp,%rcx lea 0xda4(%rip),%rdx mov $0x1,%esi mov 0x2d50(%rip),%rdi mov $0x0,%eax callq 1130 <__fprintf_chk@plt> lea 0xd37(%rip),%rax jmp 1307 <func0+0xde> mov 0x2d36(%rip),%rcx mov $0x18,%edx mov $0x1,%esi lea 0xd54(%rip),%rdi callq 1120 <fwrite@plt> lea 0xcfd(%rip),%rax mov 0xa8(%rsp),%rcx xor %fs:0x28,%rcx jne 1324 <func0+0xfb> add $0xb8,%rsp pop %rbx pop %rbp retq callq 10d0 <__stack_chk_fail@plt>
func0: endbr64 push rbp push rbx sub rsp, 0B8h mov rbx, rdi mov rax, fs:28h mov [rsp+0C8h+var_20], rax xor eax, eax mov rdi, rsp mov edx, 1 lea rsi, aWZW; "\\w*z.\\w*" call _regcomp test eax, eax jnz short loc_12E3 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 lea rax, aFoundAMatch; "Found a match!" test ebx, ebx jz short loc_1307 lea rax, aNotMatched; "Not matched!" cmp ebx, 1 jz short loc_1307 lea rbp, [rsp+0C8h+var_88] mov rsi, rsp mov ecx, 64h ; 'd' mov rdx, rbp mov edi, ebx call _regerror mov rcx, rbp lea rdx, aRegexMatchFail; "Regex match failed: %s\n" mov esi, 1 mov rdi, cs:stderr@GLIBC_2_2_5 mov eax, 0 call ___fprintf_chk lea rax, aRegexMatchErro; "Regex match error" jmp short loc_1307 loc_12E3: mov rcx, cs:stderr@GLIBC_2_2_5 mov edx, 18h mov esi, 1 lea rdi, aCouldNotCompil; "Could not compile regex\n" call _fwrite lea rax, aRegexCompileEr; "Regex compile error" loc_1307: mov rdx, [rsp+0C8h+var_20] sub rdx, fs:28h jnz short loc_1324 add rsp, 0B8h pop rbx pop rbp retn loc_1324: call ___stack_chk_fail
const char * func0(long long a1) { unsigned int v1; // ebx const char *result; // rax _BYTE v3[64]; // [rsp+0h] [rbp-C8h] BYREF char v4[104]; // [rsp+40h] [rbp-88h] BYREF unsigned long long v5; // [rsp+A8h] [rbp-20h] v5 = __readfsqword(0x28u); if ( (unsigned int)regcomp(v3, "\\w*z.\\w*", 1LL) ) { fwrite("Could not compile regex\n", 1LL, 24LL, stderr); return "Regex compile error"; } else { v1 = regexec(v3, a1, 0LL, 0LL, 0LL); regfree(v3); result = "Found a match!"; if ( v1 ) { result = "Not matched!"; if ( v1 != 1 ) { regerror(v1, v3, v4, 100LL); __fprintf_chk(stderr, 1LL, "Regex match failed: %s\n", v4); return "Regex match error"; } } } return result; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0xb8 MOV RBX,RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0xa8],RAX XOR EAX,EAX MOV RDI,RSP MOV EDX,0x1 LEA RSI,[0x102046] CALL 0x001010f0 TEST EAX,EAX JNZ 0x001012e3 MOV RBP,RSP MOV R8D,0x0 MOV ECX,0x0 MOV EDX,0x0 MOV RSI,RBX MOV RDI,RBP CALL 0x00101110 MOV EBX,EAX MOV RDI,RBP CALL 0x001010c0 LEA RAX,[0x102018] TEST EBX,EBX JZ 0x00101307 LEA RAX,[0x102027] CMP EBX,0x1 JZ 0x00101307 LEA RBP,[RSP + 0x40] MOV RSI,RSP MOV ECX,0x64 MOV RDX,RBP MOV EDI,EBX CALL 0x00101100 MOV RCX,RBP LEA RDX,[0x102068] MOV ESI,0x1 MOV RDI,qword ptr [0x00104020] MOV EAX,0x0 CALL 0x00101130 LEA RAX,[0x102034] JMP 0x00101307 LAB_001012e3: MOV RCX,qword ptr [0x00104020] MOV EDX,0x18 MOV ESI,0x1 LEA RDI,[0x10204f] CALL 0x00101120 LEA RAX,[0x102004] LAB_00101307: MOV RDX,qword ptr [RSP + 0xa8] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101324 ADD RSP,0xb8 POP RBX POP RBP RET LAB_00101324: CALL 0x001010d0
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_c8; char local_88 [104]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_c8,"\\w*z.\\w*",1); if (iVar1 == 0) { iVar1 = regexec(&rStack_c8,param_1,0,(regmatch_t *)0x0,0); regfree(&rStack_c8); pcVar2 = "Found a match!"; if ((iVar1 != 0) && (pcVar2 = "Not matched!", iVar1 != 1)) { regerror(iVar1,&rStack_c8,local_88,100); __fprintf_chk(stderr,1,"Regex match failed: %s\n",local_88); pcVar2 = "Regex match error"; } } else { fwrite("Could not compile regex\n",1,0x18,stderr); pcVar2 = "Regex compile error"; } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,710
func0
#include <stdio.h> #include <regex.h> #include <assert.h>
const char* func0(const char* text) { regex_t regex; int reti; char* pattern = "\\w*z.\\w*"; // Compile the regular expression reti = regcomp(&regex, pattern, REG_EXTENDED); if (reti) { fprintf(stderr, "Could not compile regex\n"); return "Regex compile error"; } // Execute the regular expression reti = regexec(&regex, text, 0, NULL, 0); // Free memory allocated to the pattern buffer regfree(&regex); // Check the result of the match if (!reti) { return "Found a match!"; } else if (reti == REG_NOMATCH) { return "Not matched!"; } else { // An error occurred char error_message[100]; regerror(reti, &regex, error_message, sizeof(error_message)); fprintf(stderr, "Regex match failed: %s\n", error_message); return "Regex match error"; } }
int main() { // Assert statements assert(func0("pythonz.") == "Found a match!"); assert(func0("xyz.") == "Found a match!"); assert(func0(" lang .") == "Not matched!"); return 0; }
O2
c
func0: endbr64 push %r13 mov $0x1,%edx lea 0xd54(%rip),%rsi push %r12 push %rbp mov %rdi,%rbp sub $0xb0,%rsp mov %fs:0x28,%rax mov %rax,0xa8(%rsp) xor %eax,%eax mov %rsp,%r12 mov %r12,%rdi callq 10f0 <regcomp@plt> test %eax,%eax jne 13b8 <func0+0xd8> mov %rbp,%rsi xor %r8d,%r8d xor %ecx,%ecx xor %edx,%edx mov %r12,%rdi callq 1110 <regexec@plt> mov %r12,%rdi mov %eax,%ebp callq 10c0 <regfree@plt> lea 0xce2(%rip),%rax test %ebp,%ebp je 1393 <func0+0xb3> lea 0xce6(%rip),%rax cmp $0x1,%ebp je 1393 <func0+0xb3> lea 0x40(%rsp),%r13 mov $0x64,%ecx mov %r12,%rsi mov %ebp,%edi mov %r13,%rdx callq 1100 <regerror@plt> mov %r13,%rcx mov $0x1,%esi xor %eax,%eax mov 0x2ca0(%rip),%rdi lea 0xce1(%rip),%rdx callq 1130 <__fprintf_chk@plt> lea 0xc85(%rip),%rax mov 0xa8(%rsp),%rcx xor %fs:0x28,%rcx jne 13de <func0+0xfe> add $0xb0,%rsp pop %rbp pop %r12 pop %r13 retq nopl 0x0(%rax,%rax,1) mov 0x2c61(%rip),%rcx mov $0x18,%edx mov $0x1,%esi lea 0xc7f(%rip),%rdi callq 1120 <fwrite@plt> lea 0xc28(%rip),%rax jmp 1393 <func0+0xb3> callq 10d0 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 push r13 mov edx, 1 lea rsi, aWZW; "\\w*z.\\w*" push r12 push rbp mov rbp, rdi sub rsp, 0B0h mov rax, fs:28h mov [rsp+0C8h+var_20], rax xor eax, eax mov r12, rsp mov rdi, r12 call _regcomp test eax, eax jnz loc_13B8 mov rsi, rbp xor r8d, r8d xor ecx, ecx xor edx, edx mov rdi, r12 call _regexec mov rdi, r12 mov ebp, eax call _regfree lea rax, aFoundAMatch; "Found a match!" test ebp, ebp jz short loc_1393 lea rax, aNotMatched; "Not matched!" cmp ebp, 1 jz short loc_1393 lea r13, [rsp+0C8h+var_88] mov ecx, 64h ; 'd' mov rsi, r12 mov edi, ebp mov rdx, r13 call _regerror mov rcx, r13 mov esi, 1 xor eax, eax mov rdi, cs:stderr@GLIBC_2_2_5 lea rdx, aRegexMatchFail; "Regex match failed: %s\n" call ___fprintf_chk lea rax, aRegexMatchErro; "Regex match error" loc_1393: mov rdx, [rsp+0C8h+var_20] sub rdx, fs:28h jnz short loc_13DE add rsp, 0B0h pop rbp pop r12 pop r13 retn loc_13B8: mov rcx, cs:stderr@GLIBC_2_2_5 mov edx, 18h mov esi, 1 lea rdi, aCouldNotCompil; "Could not compile regex\n" call _fwrite lea rax, aRegexCompileEr; "Regex compile error" jmp short loc_1393 loc_13DE: call ___stack_chk_fail
const char * func0(long long a1) { unsigned int v1; // ebp const char *result; // rax _BYTE v3[64]; // [rsp+0h] [rbp-C8h] BYREF char v4[104]; // [rsp+40h] [rbp-88h] BYREF unsigned long long v5; // [rsp+A8h] [rbp-20h] v5 = __readfsqword(0x28u); if ( (unsigned int)regcomp(v3, "\\w*z.\\w*", 1LL) ) { fwrite("Could not compile regex\n", 1LL, 24LL, stderr); return "Regex compile error"; } else { v1 = regexec(v3, a1, 0LL, 0LL, 0LL); regfree(v3); result = "Found a match!"; if ( v1 ) { result = "Not matched!"; if ( v1 != 1 ) { regerror(v1, v3, v4, 100LL); __fprintf_chk(stderr, 1LL, "Regex match failed: %s\n", v4); return "Regex match error"; } } } return result; }
func0: ENDBR64 PUSH R13 MOV EDX,0x1 LEA RSI,[0x102046] PUSH R12 PUSH RBP MOV RBP,RDI SUB RSP,0xb0 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0xa8],RAX XOR EAX,EAX MOV R12,RSP MOV RDI,R12 CALL 0x001010f0 TEST EAX,EAX JNZ 0x001013b8 MOV RSI,RBP XOR R8D,R8D XOR ECX,ECX XOR EDX,EDX MOV RDI,R12 CALL 0x00101110 MOV RDI,R12 MOV EBP,EAX CALL 0x001010c0 LEA RAX,[0x102018] TEST EBP,EBP JZ 0x00101393 LEA RAX,[0x102027] CMP EBP,0x1 JZ 0x00101393 LEA R13,[RSP + 0x40] MOV ECX,0x64 MOV RSI,R12 MOV EDI,EBP MOV RDX,R13 CALL 0x00101100 MOV RCX,R13 MOV ESI,0x1 XOR EAX,EAX MOV RDI,qword ptr [0x00104020] LEA RDX,[0x102068] CALL 0x00101130 LEA RAX,[0x102034] LAB_00101393: MOV RDX,qword ptr [RSP + 0xa8] SUB RDX,qword ptr FS:[0x28] JNZ 0x001013de ADD RSP,0xb0 POP RBP POP R12 POP R13 RET LAB_001013b8: MOV RCX,qword ptr [0x00104020] MOV EDX,0x18 MOV ESI,0x1 LEA RDI,[0x10204f] CALL 0x00101120 LEA RAX,[0x102004] JMP 0x00101393 LAB_001013de: CALL 0x001010d0
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_c8; char local_88 [104]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_c8,"\\w*z.\\w*",1); if (iVar1 == 0) { iVar1 = regexec(&rStack_c8,param_1,0,(regmatch_t *)0x0,0); regfree(&rStack_c8); pcVar2 = "Found a match!"; if ((iVar1 != 0) && (pcVar2 = "Not matched!", iVar1 != 1)) { regerror(iVar1,&rStack_c8,local_88,100); __fprintf_chk(stderr,1,"Regex match failed: %s\n",local_88); pcVar2 = "Regex match error"; } } else { fwrite("Could not compile regex\n",1,0x18,stderr); pcVar2 = "Regex compile error"; } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,711
func0
#include <stdio.h> #include <regex.h> #include <assert.h>
const char* func0(const char* text) { regex_t regex; int reti; char* pattern = "\\w*z.\\w*"; // Compile the regular expression reti = regcomp(&regex, pattern, REG_EXTENDED); if (reti) { fprintf(stderr, "Could not compile regex\n"); return "Regex compile error"; } // Execute the regular expression reti = regexec(&regex, text, 0, NULL, 0); // Free memory allocated to the pattern buffer regfree(&regex); // Check the result of the match if (!reti) { return "Found a match!"; } else if (reti == REG_NOMATCH) { return "Not matched!"; } else { // An error occurred char error_message[100]; regerror(reti, &regex, error_message, sizeof(error_message)); fprintf(stderr, "Regex match failed: %s\n", error_message); return "Regex match error"; } }
int main() { // Assert statements assert(func0("pythonz.") == "Found a match!"); assert(func0("xyz.") == "Found a match!"); assert(func0(" lang .") == "Not matched!"); return 0; }
O3
c
func0: endbr64 push %r13 mov $0x1,%edx lea 0xd54(%rip),%rsi push %r12 push %rbp mov %rdi,%rbp sub $0xb0,%rsp mov %fs:0x28,%rax mov %rax,0xa8(%rsp) xor %eax,%eax mov %rsp,%r12 mov %r12,%rdi callq 10f0 <regcomp@plt> test %eax,%eax jne 13b8 <func0+0xd8> mov %rbp,%rsi xor %r8d,%r8d xor %ecx,%ecx xor %edx,%edx mov %r12,%rdi callq 1110 <regexec@plt> mov %r12,%rdi mov %eax,%ebp callq 10c0 <regfree@plt> lea 0xce2(%rip),%rax test %ebp,%ebp je 1393 <func0+0xb3> lea 0xce6(%rip),%rax cmp $0x1,%ebp je 1393 <func0+0xb3> lea 0x40(%rsp),%r13 mov $0x64,%ecx mov %r12,%rsi mov %ebp,%edi mov %r13,%rdx callq 1100 <regerror@plt> mov %r13,%rcx mov $0x1,%esi xor %eax,%eax mov 0x2ca0(%rip),%rdi lea 0xce1(%rip),%rdx callq 1130 <__fprintf_chk@plt> lea 0xc85(%rip),%rax mov 0xa8(%rsp),%rcx xor %fs:0x28,%rcx jne 13de <func0+0xfe> add $0xb0,%rsp pop %rbp pop %r12 pop %r13 retq nopl 0x0(%rax,%rax,1) mov 0x2c61(%rip),%rcx mov $0x18,%edx mov $0x1,%esi lea 0xc7f(%rip),%rdi callq 1120 <fwrite@plt> lea 0xc28(%rip),%rax jmp 1393 <func0+0xb3> callq 10d0 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 push r12 mov edx, 1; cflags lea rsi, pattern; "\\w*z.\\w*" push rbp push rbx mov rbx, rdi sub rsp, 0B0h mov rax, fs:28h mov [rsp+var_sA8], rax xor eax, eax mov rbp, rsp mov rdi, rbp; preg call _regcomp test eax, eax jnz loc_13B8 mov rsi, rbx; string xor r8d, r8d; eflags xor ecx, ecx; pmatch xor edx, edx; nmatch mov rdi, rbp; preg call _regexec mov rdi, rbp; preg mov ebx, eax call _regfree lea rax, aFoundAMatch; "Found a match!" test ebx, ebx jz short loc_1392 lea rax, aNotMatched; "Not matched!" cmp ebx, 1 jz short loc_1392 lea r12, [rsp+errbuf] mov ecx, 64h ; 'd'; errbuf_size mov rsi, rbp; preg mov edi, ebx; errcode mov rdx, r12; errbuf call _regerror mov rcx, r12 mov esi, 2 xor eax, eax mov rdi, cs:__bss_start lea rdx, aRegexMatchFail; "Regex match failed: %s\n" call ___fprintf_chk lea rax, aRegexMatchErro; "Regex match error" loc_1392: mov rdx, [rsp+var_sA8] sub rdx, fs:28h jnz short loc_13DE add rsp, 0B0h pop rbx pop rbp pop r12 retn loc_13B8: mov rcx, cs:__bss_start; s mov edx, 18h; n mov esi, 1; size lea rdi, aCouldNotCompil; "Could not compile regex\n" call _fwrite lea rax, aRegexCompileEr; "Regex compile error" jmp short loc_1392 loc_13DE: call ___stack_chk_fail
const char * func0(char *string) { int v1; // ebx const char *result; // rax regex_t vars0; // [rsp+0h] [rbp+0h] BYREF char errbuf[104]; // [rsp+40h] [rbp+40h] BYREF unsigned long long varsA8; // [rsp+A8h] [rbp+A8h] varsA8 = __readfsqword(0x28u); if ( regcomp(&vars0, "\\w*z.\\w*", 1) ) { fwrite("Could not compile regex\n", 1uLL, 0x18uLL, _bss_start); return "Regex compile error"; } else { v1 = regexec(&vars0, string, 0LL, 0LL, 0); regfree(&vars0); result = "Found a match!"; if ( v1 ) { result = "Not matched!"; if ( v1 != 1 ) { regerror(v1, &vars0, errbuf, 0x64uLL); __fprintf_chk(_bss_start, 2LL, "Regex match failed: %s\n", errbuf); return "Regex match error"; } } } return result; }
func0: ENDBR64 PUSH R12 MOV EDX,0x1 LEA RSI,[0x102046] PUSH RBP PUSH RBX MOV RBX,RDI SUB RSP,0xb0 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0xa8],RAX XOR EAX,EAX MOV RBP,RSP MOV RDI,RBP CALL 0x001010f0 TEST EAX,EAX JNZ 0x001013b8 MOV RSI,RBX XOR R8D,R8D XOR ECX,ECX XOR EDX,EDX MOV RDI,RBP CALL 0x00101110 MOV RDI,RBP MOV EBX,EAX CALL 0x001010c0 LEA RAX,[0x102018] TEST EBX,EBX JZ 0x00101392 LEA RAX,[0x102027] CMP EBX,0x1 JZ 0x00101392 LEA R12,[RSP + 0x40] MOV ECX,0x64 MOV RSI,RBP MOV EDI,EBX MOV RDX,R12 CALL 0x00101100 MOV RCX,R12 MOV ESI,0x2 XOR EAX,EAX MOV RDI,qword ptr [0x00104020] LEA RDX,[0x102068] CALL 0x00101130 LEA RAX,[0x102034] LAB_00101392: MOV RDX,qword ptr [RSP + 0xa8] SUB RDX,qword ptr FS:[0x28] JNZ 0x001013de ADD RSP,0xb0 POP RBX POP RBP POP R12 RET LAB_001013b8: MOV RCX,qword ptr [0x00104020] MOV EDX,0x18 MOV ESI,0x1 LEA RDI,[0x10204f] CALL 0x00101120 LEA RAX,[0x102004] JMP 0x00101392 LAB_001013de: CALL 0x001010d0
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_c8; char local_88 [104]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_c8,"\\w*z.\\w*",1); if (iVar1 == 0) { iVar1 = regexec(&rStack_c8,param_1,0,(regmatch_t *)0x0,0); regfree(&rStack_c8); pcVar2 = "Found a match!"; if ((iVar1 != 0) && (pcVar2 = "Not matched!", iVar1 != 1)) { regerror(iVar1,&rStack_c8,local_88,100); __fprintf_chk(stderr,2,"Regex match failed: %s\n",local_88); pcVar2 = "Regex match error"; } } else { fwrite("Could not compile regex\n",1,0x18,stderr); pcVar2 = "Regex compile error"; } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,712
func0
#include <stdbool.h> #include <assert.h>
bool func0(int monthnum2) { if (monthnum2 == 1 || monthnum2 == 3 || monthnum2 == 5 || monthnum2 == 7 || monthnum2 == 8 || monthnum2 == 10 || monthnum2 == 12) { return true; } else { return false; } }
int main() { assert(func0(5) == true); assert(func0(2) == false); assert(func0(6) == false); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) cmpl $0x1,-0x4(%rbp) je 117e <func0+0x35> cmpl $0x3,-0x4(%rbp) je 117e <func0+0x35> cmpl $0x5,-0x4(%rbp) je 117e <func0+0x35> cmpl $0x7,-0x4(%rbp) je 117e <func0+0x35> cmpl $0x8,-0x4(%rbp) je 117e <func0+0x35> cmpl $0xa,-0x4(%rbp) je 117e <func0+0x35> cmpl $0xc,-0x4(%rbp) jne 1185 <func0+0x3c> mov $0x1,%eax jmp 118a <func0+0x41> mov $0x0,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi cmp [rbp+var_4], 1 jz short loc_117E cmp [rbp+var_4], 3 jz short loc_117E cmp [rbp+var_4], 5 jz short loc_117E cmp [rbp+var_4], 7 jz short loc_117E cmp [rbp+var_4], 8 jz short loc_117E cmp [rbp+var_4], 0Ah jz short loc_117E cmp [rbp+var_4], 0Ch jnz short loc_1185 loc_117E: mov eax, 1 jmp short loc_118A loc_1185: mov eax, 0 loc_118A: pop rbp retn
_BOOL8 func0(int a1) { return a1 == 1 || a1 == 3 || a1 == 5 || a1 == 7 || a1 == 8 || a1 == 10 || a1 == 12; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI CMP dword ptr [RBP + -0x4],0x1 JZ 0x0010117e CMP dword ptr [RBP + -0x4],0x3 JZ 0x0010117e CMP dword ptr [RBP + -0x4],0x5 JZ 0x0010117e CMP dword ptr [RBP + -0x4],0x7 JZ 0x0010117e CMP dword ptr [RBP + -0x4],0x8 JZ 0x0010117e CMP dword ptr [RBP + -0x4],0xa JZ 0x0010117e CMP dword ptr [RBP + -0x4],0xc JNZ 0x00101185 LAB_0010117e: MOV EAX,0x1 JMP 0x0010118a LAB_00101185: MOV EAX,0x0 LAB_0010118a: POP RBP RET
int8 func0(int param_1) { int8 uVar1; if ((((param_1 == 1) || (param_1 == 3)) || (param_1 == 5)) || (((param_1 == 7 || (param_1 == 8)) || ((param_1 == 10 || (param_1 == 0xc)))))) { uVar1 = 1; } else { uVar1 = 0; } return uVar1; }
5,713
func0
#include <stdbool.h> #include <assert.h>
bool func0(int monthnum2) { if (monthnum2 == 1 || monthnum2 == 3 || monthnum2 == 5 || monthnum2 == 7 || monthnum2 == 8 || monthnum2 == 10 || monthnum2 == 12) { return true; } else { return false; } }
int main() { assert(func0(5) == true); assert(func0(2) == false); assert(func0(6) == false); return 0; }
O1
c
func0: endbr64 mov %edi,%edx and $0xfffffffd,%edx mov $0x1,%eax cmp $0x1,%edx je 114f <func0+0x26> cmp $0x5,%edx je 114f <func0+0x26> cmp $0xc,%edi sete %al cmp $0x8,%edx sete %dl or %edx,%eax retq
func0: endbr64 cmp edi, 0Ch ja short loc_1140 mov eax, 15AAh mov ecx, edi shr rax, cl and eax, 1 retn loc_1140: mov eax, 0 retn
unsigned long long func0(unsigned int a1) { if ( a1 > 0xC ) return 0LL; else return (0x15AAuLL >> a1) & 1; }
func0: ENDBR64 CMP EDI,0xc JA 0x00101140 MOV EAX,0x15aa MOV ECX,EDI SHR RAX,CL AND EAX,0x1 RET LAB_00101140: MOV EAX,0x0 RET
uint func0(uint param_1) { if (param_1 < 0xd) { return (uint)(0x15aaL >> ((byte)param_1 & 0x3f)) & 1; } return 0; }
5,714
func0
#include <stdbool.h> #include <assert.h>
bool func0(int monthnum2) { if (monthnum2 == 1 || monthnum2 == 3 || monthnum2 == 5 || monthnum2 == 7 || monthnum2 == 8 || monthnum2 == 10 || monthnum2 == 12) { return true; } else { return false; } }
int main() { assert(func0(5) == true); assert(func0(2) == false); assert(func0(6) == false); return 0; }
O2
c
func0: endbr64 mov %edi,%edx mov %edi,%ecx mov $0x1,%eax and $0xfffffff9,%edx and $0xfffffffd,%ecx cmp $0x1,%edx je 1166 <func0+0x26> cmp $0x8,%ecx sete %al cmp $0xc,%edi sete %dl or %edx,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 cmp edi, 0Ch ja short loc_1160 mov ecx, edi mov eax, 15AAh shr rax, cl and eax, 1 retn loc_1160: xor eax, eax retn
unsigned long long func0(unsigned int a1) { if ( a1 > 0xC ) return 0LL; else return (0x15AAuLL >> a1) & 1; }
func0: ENDBR64 CMP EDI,0xc JA 0x00101160 MOV ECX,EDI MOV EAX,0x15aa SHR RAX,CL AND EAX,0x1 RET LAB_00101160: XOR EAX,EAX RET
uint func0(uint param_1) { if (param_1 < 0xd) { return (uint)(0x15aaL >> ((byte)param_1 & 0x3f)) & 1; } return 0; }
5,715
func0
#include <stdbool.h> #include <assert.h>
bool func0(int monthnum2) { if (monthnum2 == 1 || monthnum2 == 3 || monthnum2 == 5 || monthnum2 == 7 || monthnum2 == 8 || monthnum2 == 10 || monthnum2 == 12) { return true; } else { return false; } }
int main() { assert(func0(5) == true); assert(func0(2) == false); assert(func0(6) == false); return 0; }
O3
c
func0: endbr64 mov %edi,%edx mov %edi,%ecx mov $0x1,%eax and $0xfffffff9,%edx and $0xfffffffd,%ecx cmp $0x1,%edx je 1166 <func0+0x26> cmp $0x8,%ecx sete %al cmp $0xc,%edi sete %dl or %edx,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 xor eax, eax cmp edi, 0Ch ja short locret_1157 mov eax, 15AAh bt rax, rdi setb al locret_1157: retn
unsigned __int8 func0(unsigned long long a1) { unsigned __int8 result; // al long long v2; // rax result = 0; if ( (unsigned int)a1 <= 0xC ) { v2 = 5546LL; return _bittest64(&v2, a1); } return result; }
func0: ENDBR64 XOR EAX,EAX CMP EDI,0xc JA 0x00101157 MOV EAX,0x15aa BT RAX,RDI SETC AL LAB_00101157: RET
int8 func0(uint param_1) { int8 uVar1; uVar1 = 0; if (param_1 < 0xd) { uVar1 = CONCAT71(0x15,(0x15aaUL >> ((ulong)param_1 & 0x3f) & 1) != 0); } return uVar1; }
5,716
func0
#include <assert.h> #include <string.h> void reverse_string(char* str) { int n = strlen(str); for (int i = 0; i < n / 2; i++) { char temp = str[i]; str[i] = str[n - i - 1]; str[n - i - 1] = temp; } }
void func0(char stringlist[][50], int size) { for (int i = 0; i < size; i++) { reverse_string(stringlist[i]); } }
int main() { char list1[][50] = {"Red", "Green", "Blue", "White", "Black"}; char list2[][50] = {"john", "amal", "joel", "george"}; char list3[][50] = {"jack", "john", "mary"}; func0(list1, 5); assert(strcmp(list1[0], "deR") == 0); assert(strcmp(list1[1], "neerG") == 0); assert(strcmp(list1[2], "eulB") == 0); assert(strcmp(list1[3], "etihW") == 0); assert(strcmp(list1[4], "kcalB") == 0); func0(list2, 4); assert(strcmp(list2[0], "nhoj") == 0); assert(strcmp(list2[1], "lama") == 0); assert(strcmp(list2[2], "leoj") == 0); assert(strcmp(list2[3], "egroeg") == 0); func0(list3, 3); assert(strcmp(list3[0], "kcaj") == 0); assert(strcmp(list3[1], "nhoj") == 0); assert(strcmp(list3[2], "yram") == 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,-0x4(%rbp) jmp 128b <func0+0x50> mov -0x4(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax add %rax,%rax mov %rax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov %rax,%rdi callq 11a9 <reverse_string> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1257 <func0+0x1c> 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_4], 0 jmp short loc_128B loc_1257: mov eax, [rbp+var_4] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx add rax, rax mov rdx, rax mov rax, [rbp+var_18] add rax, rdx mov rdi, rax call reverse_string add [rbp+var_4], 1 loc_128B: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1257 nop nop leave retn
long long func0(long long a1, int a2) { long long result; // rax unsigned int i; // [rsp+1Ch] [rbp-4h] for ( i = 0; ; ++i ) { result = i; if ( (int)i >= a2 ) break; reverse_string(50LL * (int)i + a1); } return result; }
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 + -0x4],0x0 JMP 0x0010128b LAB_00101257: MOV EAX,dword ptr [RBP + -0x4] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX ADD RAX,RAX MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RDI,RAX CALL 0x001011a9 ADD dword ptr [RBP + -0x4],0x1 LAB_0010128b: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101257 NOP NOP LEAVE RET
void func0(long param_1,int param_2) { int4 local_c; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { reverse_string(param_1 + (long)local_c * 0x32); } return; }
5,717
func0
#include <assert.h> #include <string.h> void reverse_string(char* str) { int n = strlen(str); for (int i = 0; i < n / 2; i++) { char temp = str[i]; str[i] = str[n - i - 1]; str[n - i - 1] = temp; } }
void func0(char stringlist[][50], int size) { for (int i = 0; i < size; i++) { reverse_string(stringlist[i]); } }
int main() { char list1[][50] = {"Red", "Green", "Blue", "White", "Black"}; char list2[][50] = {"john", "amal", "joel", "george"}; char list3[][50] = {"jack", "john", "mary"}; func0(list1, 5); assert(strcmp(list1[0], "deR") == 0); assert(strcmp(list1[1], "neerG") == 0); assert(strcmp(list1[2], "eulB") == 0); assert(strcmp(list1[3], "etihW") == 0); assert(strcmp(list1[4], "kcalB") == 0); func0(list2, 4); assert(strcmp(list2[0], "nhoj") == 0); assert(strcmp(list2[1], "lama") == 0); assert(strcmp(list2[2], "leoj") == 0); assert(strcmp(list2[3], "egroeg") == 0); func0(list3, 3); assert(strcmp(list3[0], "kcaj") == 0); assert(strcmp(list3[1], "nhoj") == 0); assert(strcmp(list3[2], "yram") == 0); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11f0 <func0+0x31> push %rbp push %rbx mov %rdi,%rbx lea -0x1(%rsi),%eax lea (%rax,%rax,4),%rax lea (%rax,%rax,4),%rax lea 0x32(%rdi,%rax,2),%rbp mov %rbx,%rdi callq 1169 <reverse_string> add $0x32,%rbx cmp %rbp,%rbx jne 11dc <func0+0x1d> pop %rbx pop %rbp retq retq
func0: endbr64 test esi, esi jle short locret_1224 push rbp push rbx sub rsp, 8 mov rbx, rdi lea eax, [rsi-1] lea rax, [rax+rax*4] lea rax, [rax+rax*4] lea rbp, [rdi+rax*2+32h] loc_120C: mov rdi, rbx call reverse_string add rbx, 32h ; '2' cmp rbx, rbp jnz short loc_120C add rsp, 8 pop rbx pop rbp retn locret_1224: retn
long long func0(long long a1, int a2) { long long v2; // rbx long long result; // rax if ( a2 > 0 ) { v2 = a1; do { result = reverse_string(v2); v2 += 50LL; } while ( v2 != a1 + 50LL * (unsigned int)(a2 - 1) + 50 ); } return result; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101224 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBX,RDI LEA EAX,[RSI + -0x1] LEA RAX,[RAX + RAX*0x4] LEA RAX,[RAX + RAX*0x4] LEA RBP,[RDI + RAX*0x2 + 0x32] LAB_0010120c: MOV RDI,RBX CALL 0x001011a9 ADD RBX,0x32 CMP RBX,RBP JNZ 0x0010120c ADD RSP,0x8 POP RBX POP RBP RET LAB_00101224: RET
void func0(long param_1,int param_2) { long lVar1; if (0 < param_2) { lVar1 = param_1 + 0x32; do { reverse_string(param_1); param_1 = param_1 + 0x32; } while (param_1 != lVar1 + (ulong)(param_2 - 1) * 0x32); return; } return; }
5,718
func0
#include <assert.h> #include <string.h> void reverse_string(char* str) { int n = strlen(str); for (int i = 0; i < n / 2; i++) { char temp = str[i]; str[i] = str[n - i - 1]; str[n - i - 1] = temp; } }
void func0(char stringlist[][50], int size) { for (int i = 0; i < size; i++) { reverse_string(stringlist[i]); } }
int main() { char list1[][50] = {"Red", "Green", "Blue", "White", "Black"}; char list2[][50] = {"john", "amal", "joel", "george"}; char list3[][50] = {"jack", "john", "mary"}; func0(list1, 5); assert(strcmp(list1[0], "deR") == 0); assert(strcmp(list1[1], "neerG") == 0); assert(strcmp(list1[2], "eulB") == 0); assert(strcmp(list1[3], "etihW") == 0); assert(strcmp(list1[4], "kcalB") == 0); func0(list2, 4); assert(strcmp(list2[0], "nhoj") == 0); assert(strcmp(list2[1], "lama") == 0); assert(strcmp(list2[2], "leoj") == 0); assert(strcmp(list2[3], "egroeg") == 0); func0(list3, 3); assert(strcmp(list3[0], "kcaj") == 0); assert(strcmp(list3[1], "nhoj") == 0); assert(strcmp(list3[2], "yram") == 0); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1730 <func0+0x40> push %rbp lea -0x1(%rsi),%eax push %rbx lea (%rax,%rax,4),%rax mov %rdi,%rbx lea (%rax,%rax,4),%rax lea 0x32(%rdi,%rax,2),%rbp sub $0x8,%rsp nopl 0x0(%rax) mov %rbx,%rdi add $0x32,%rbx callq 16a0 <reverse_string> cmp %rbp,%rbx jne 1718 <func0+0x28> add $0x8,%rsp pop %rbx pop %rbp retq retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle short locret_16EA push rbp lea eax, [rsi-1] push rbx lea rax, [rax+rax*4] mov rbx, rdi lea rax, [rax+rax*4] lea rbp, [rdi+rax*2+32h] sub rsp, 8 nop dword ptr [rax+00000000h] loc_1698: mov rdi, rbx call _strlen mov edi, eax shr edi, 1Fh add edi, eax sar edi, 1 cmp eax, 1 jle short loc_16DA cdqe lea rdx, [rbx+rax-1] xor eax, eax nop word ptr [rax+rax+00000000h] loc_16C0: movzx esi, byte ptr [rdx] movzx ecx, byte ptr [rbx+rax] sub rdx, 1 mov [rbx+rax], sil add rax, 1 mov [rdx+1], cl cmp edi, eax jg short loc_16C0 loc_16DA: add rbx, 32h ; '2' cmp rbx, rbp jnz short loc_1698 add rsp, 8 pop rbx pop rbp retn locret_16EA: retn
void func0(long long a1, int a2) { long long v2; // rbx long long v3; // rbp int v4; // eax int v5; // edi char *v6; // rdx long long v7; // rax char v8; // si char v9; // cl if ( a2 > 0 ) { v2 = a1; v3 = a1 + 50LL * (unsigned int)(a2 - 1) + 50; do { v4 = strlen(v2); v5 = v4 / 2; if ( v4 > 1 ) { v6 = (char *)(v2 + v4 - 1); v7 = 0LL; do { v8 = *v6; v9 = *(_BYTE *)(v2 + v7); --v6; *(_BYTE *)(v2 + v7++) = v8; v6[1] = v9; } while ( v5 > (int)v7 ); } v2 += 50LL; } while ( v2 != v3 ); } }
func0: ENDBR64 TEST ESI,ESI JLE 0x001016ea PUSH RBP LEA EAX,[RSI + -0x1] PUSH RBX LEA RAX,[RAX + RAX*0x4] MOV RBX,RDI LEA RAX,[RAX + RAX*0x4] LEA RBP,[RDI + RAX*0x2 + 0x32] SUB RSP,0x8 NOP dword ptr [RAX] LAB_00101698: MOV RDI,RBX CALL 0x00101080 MOV EDI,EAX SHR EDI,0x1f ADD EDI,EAX SAR EDI,0x1 CMP EAX,0x1 JLE 0x001016da CDQE LEA RDX,[RBX + RAX*0x1 + -0x1] XOR EAX,EAX NOP word ptr [RAX + RAX*0x1] LAB_001016c0: MOVZX ESI,byte ptr [RDX] MOVZX ECX,byte ptr [RBX + RAX*0x1] SUB RDX,0x1 MOV byte ptr [RBX + RAX*0x1],SIL ADD RAX,0x1 MOV byte ptr [RDX + 0x1],CL CMP EDI,EAX JG 0x001016c0 LAB_001016da: ADD RBX,0x32 CMP RBX,RBP JNZ 0x00101698 ADD RSP,0x8 POP RBX POP RBP RET LAB_001016ea: RET
void func0(char *param_1,int param_2) { char *pcVar1; char cVar2; int iVar3; size_t sVar4; long lVar5; char *pcVar6; if (0 < param_2) { pcVar1 = param_1 + (ulong)(param_2 - 1) * 0x32 + 0x32; do { sVar4 = strlen(param_1); iVar3 = (int)sVar4; if (1 < iVar3) { lVar5 = 0; pcVar6 = param_1 + (long)iVar3 + -1; do { cVar2 = param_1[lVar5]; param_1[lVar5] = *pcVar6; lVar5 = lVar5 + 1; *pcVar6 = cVar2; pcVar6 = pcVar6 + -1; } while ((int)lVar5 < (int)(((uint)(sVar4 >> 0x1f) & 1) + iVar3) >> 1); } param_1 = param_1 + 0x32; } while (param_1 != pcVar1); return; } return; }
5,719
func0
#include <assert.h> #include <string.h> void reverse_string(char* str) { int n = strlen(str); for (int i = 0; i < n / 2; i++) { char temp = str[i]; str[i] = str[n - i - 1]; str[n - i - 1] = temp; } }
void func0(char stringlist[][50], int size) { for (int i = 0; i < size; i++) { reverse_string(stringlist[i]); } }
int main() { char list1[][50] = {"Red", "Green", "Blue", "White", "Black"}; char list2[][50] = {"john", "amal", "joel", "george"}; char list3[][50] = {"jack", "john", "mary"}; func0(list1, 5); assert(strcmp(list1[0], "deR") == 0); assert(strcmp(list1[1], "neerG") == 0); assert(strcmp(list1[2], "eulB") == 0); assert(strcmp(list1[3], "etihW") == 0); assert(strcmp(list1[4], "kcalB") == 0); func0(list2, 4); assert(strcmp(list2[0], "nhoj") == 0); assert(strcmp(list2[1], "lama") == 0); assert(strcmp(list2[2], "leoj") == 0); assert(strcmp(list2[3], "egroeg") == 0); func0(list3, 3); assert(strcmp(list3[0], "kcaj") == 0); assert(strcmp(list3[1], "nhoj") == 0); assert(strcmp(list3[2], "yram") == 0); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 17e0 <func0+0x80> push %rbp lea -0x1(%rsi),%eax push %rbx lea (%rax,%rax,4),%rax mov %rdi,%rbx lea (%rax,%rax,4),%rax lea 0x32(%rdi,%rax,2),%rbp sub $0x8,%rsp nopl 0x0(%rax) mov %rbx,%rdi callq 1070 <strlen@plt> mov %eax,%edx shr $0x1f,%edx add %eax,%edx sar %edx cmp $0x1,%eax jle 17cb <func0+0x6b> cltq lea -0x1(%rbx,%rax,1),%rcx xor %eax,%eax nopw 0x0(%rax,%rax,1) movzbl (%rcx),%edi movzbl (%rbx,%rax,1),%esi sub $0x1,%rcx mov %dil,(%rbx,%rax,1) add $0x1,%rax mov %sil,0x1(%rcx) cmp %eax,%edx jg 17b0 <func0+0x50> add $0x32,%rbx cmp %rbx,%rbp jne 1788 <func0+0x28> add $0x8,%rsp pop %rbx pop %rbp retq nopl 0x0(%rax,%rax,1) retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle short locret_184A push rbp movsxd rsi, esi push rbx lea rax, [rsi+rsi*4] mov rbx, rdi lea rax, [rax+rax*4] lea rbp, [rdi+rax*2] sub rsp, 8 loc_1800: mov rdi, rbx; s call _strlen mov edi, eax shr edi, 1Fh add edi, eax sar edi, 1 cmp eax, 1 jle short loc_183A cdqe lea rdx, [rbx+rax-1] xor eax, eax nop loc_1820: movzx esi, byte ptr [rdx] movzx ecx, byte ptr [rbx+rax] sub rdx, 1 mov [rbx+rax], sil add rax, 1 mov [rdx+1], cl cmp edi, eax jg short loc_1820 loc_183A: add rbx, 32h ; '2' cmp rbp, rbx jnz short loc_1800 add rsp, 8 pop rbx pop rbp retn locret_184A: retn
void func0(char *s, int a2) { const char *v2; // rbx char *v3; // rbp int v4; // eax int v5; // edi const char *v6; // rdx long long v7; // rax char v8; // si char v9; // cl if ( a2 > 0 ) { v2 = s; v3 = &s[50 * a2]; do { v4 = strlen(v2); v5 = v4 / 2; if ( v4 > 1 ) { v6 = &v2[v4 - 1]; v7 = 0LL; do { v8 = *v6; v9 = v2[v7]; --v6; v2[v7++] = v8; *((_BYTE *)v6 + 1) = v9; } while ( v5 > (int)v7 ); } v2 += 50; } while ( v3 != v2 ); } }
func0: ENDBR64 TEST ESI,ESI JLE 0x0010184a PUSH RBP MOVSXD RSI,ESI PUSH RBX LEA RAX,[RSI + RSI*0x4] MOV RBX,RDI LEA RAX,[RAX + RAX*0x4] LEA RBP,[RDI + RAX*0x2] SUB RSP,0x8 LAB_00101800: MOV RDI,RBX CALL 0x00101080 MOV EDI,EAX SHR EDI,0x1f ADD EDI,EAX SAR EDI,0x1 CMP EAX,0x1 JLE 0x0010183a CDQE LEA RDX,[RBX + RAX*0x1 + -0x1] XOR EAX,EAX NOP LAB_00101820: MOVZX ESI,byte ptr [RDX] MOVZX ECX,byte ptr [RBX + RAX*0x1] SUB RDX,0x1 MOV byte ptr [RBX + RAX*0x1],SIL ADD RAX,0x1 MOV byte ptr [RDX + 0x1],CL CMP EDI,EAX JG 0x00101820 LAB_0010183a: ADD RBX,0x32 CMP RBP,RBX JNZ 0x00101800 ADD RSP,0x8 POP RBX POP RBP RET LAB_0010184a: RET
void func0(char *param_1,int param_2) { char *pcVar1; char cVar2; int iVar3; size_t sVar4; long lVar5; char *pcVar6; if (0 < param_2) { pcVar1 = param_1 + (long)param_2 * 0x32; do { sVar4 = strlen(param_1); iVar3 = (int)sVar4; if (1 < iVar3) { lVar5 = 0; pcVar6 = param_1 + (long)iVar3 + -1; do { cVar2 = param_1[lVar5]; param_1[lVar5] = *pcVar6; lVar5 = lVar5 + 1; *pcVar6 = cVar2; pcVar6 = pcVar6 + -1; } while ((int)lVar5 < (int)(((uint)(sVar4 >> 0x1f) & 1) + iVar3) >> 1); } param_1 = param_1 + 0x32; } while (pcVar1 != param_1); return; } return; }
5,720
func0
#include <assert.h> #include <string.h> // Define a struct to deal with list of strings typedef struct { char **elems; int size; } StringList;
StringList func0(StringList lst) { int minIndex = 0; for (int i = 1; i < lst.size; i++) { if (strcmp(lst.elems[i], lst.elems[minIndex]) < 0) { minIndex = i; } } StringList result = { .elems = &lst.elems[minIndex], .size = 1 }; return result; }
int main() { // Test 1 char *list1[] = {"1", "1,2", "1,2,3"}; StringList lst1 = { list1, 3 }; StringList result1 = func0(lst1); assert(strcmp(result1.elems[0], "1") == 0); // Test 2 char *list2[] = {"1,1", "1,1,1", "1,2,7,8"}; StringList lst2 = { list2, 3 }; StringList result2 = func0(lst2); assert(strcmp(result2.elems[0], "1,1") == 0); // Test 3 char *list3[] = {"x", "x,y", "x,y,z"}; StringList lst3 = { list3, 3 }; StringList result3 = func0(lst3); assert(strcmp(result3.elems[0], "x") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,%rax mov %rsi,%rcx mov %rcx,%rdx mov %rax,-0x30(%rbp) mov %rdx,-0x28(%rbp) movl $0x0,-0x18(%rbp) movl $0x1,-0x14(%rbp) jmp 11f7 <func0+0x6e> mov -0x30(%rbp),%rax mov -0x18(%rbp),%edx movslq %edx,%rdx shl $0x3,%rdx add %rdx,%rax mov (%rax),%rdx mov -0x30(%rbp),%rax mov -0x14(%rbp),%ecx movslq %ecx,%rcx shl $0x3,%rcx add %rcx,%rax mov (%rax),%rax mov %rdx,%rsi mov %rax,%rdi callq 1090 <strcmp@plt> test %eax,%eax jns 11f3 <func0+0x6a> mov -0x14(%rbp),%eax mov %eax,-0x18(%rbp) addl $0x1,-0x14(%rbp) mov -0x28(%rbp),%eax cmp %eax,-0x14(%rbp) jl 11b6 <func0+0x2d> mov -0x30(%rbp),%rax mov -0x18(%rbp),%edx movslq %edx,%rdx shl $0x3,%rdx add %rdx,%rax mov %rax,-0x10(%rbp) movl $0x1,-0x8(%rbp) mov -0x10(%rbp),%rax mov -0x8(%rbp),%rdx leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov rax, rdi mov rcx, rsi mov rdx, rcx mov [rbp+var_30], rax mov [rbp+var_28], rdx mov [rbp+var_18], 0 mov [rbp+var_14], 1 jmp short loc_11F7 loc_11B6: mov rax, [rbp+var_30] mov edx, [rbp+var_18] movsxd rdx, edx shl rdx, 3 add rax, rdx mov rdx, [rax] mov rax, [rbp+var_30] mov ecx, [rbp+var_14] movsxd rcx, ecx shl rcx, 3 add rax, rcx mov rax, [rax] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jns short loc_11F3 mov eax, [rbp+var_14] mov [rbp+var_18], eax loc_11F3: add [rbp+var_14], 1 loc_11F7: mov eax, dword ptr [rbp+var_28] cmp [rbp+var_14], eax jl short loc_11B6 mov rax, [rbp+var_30] mov edx, [rbp+var_18] movsxd rdx, edx shl rdx, 3 add rax, rdx mov [rbp+var_10], rax mov dword ptr [rbp+var_8], 1 mov rax, [rbp+var_10] mov rdx, [rbp+var_8] leave retn
long long func0(long long a1, int a2) { int v3; // [rsp+18h] [rbp-18h] int i; // [rsp+1Ch] [rbp-14h] v3 = 0; for ( i = 1; i < a2; ++i ) { if ( strcmp(*(const char **)(8LL * i + a1), *(const char **)(8LL * v3 + a1)) < 0 ) v3 = i; } return 8LL * v3 + a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV RAX,RDI MOV RCX,RSI MOV RDX,RCX MOV qword ptr [RBP + -0x30],RAX MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x18],0x0 MOV dword ptr [RBP + -0x14],0x1 JMP 0x001011f7 LAB_001011b6: MOV RAX,qword ptr [RBP + -0x30] MOV EDX,dword ptr [RBP + -0x18] MOVSXD RDX,EDX SHL RDX,0x3 ADD RAX,RDX MOV RDX,qword ptr [RAX] MOV RAX,qword ptr [RBP + -0x30] MOV ECX,dword ptr [RBP + -0x14] MOVSXD RCX,ECX SHL RCX,0x3 ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV RSI,RDX MOV RDI,RAX CALL 0x00101090 TEST EAX,EAX JNS 0x001011f3 MOV EAX,dword ptr [RBP + -0x14] MOV dword ptr [RBP + -0x18],EAX LAB_001011f3: ADD dword ptr [RBP + -0x14],0x1 LAB_001011f7: MOV EAX,dword ptr [RBP + -0x28] CMP dword ptr [RBP + -0x14],EAX JL 0x001011b6 MOV RAX,qword ptr [RBP + -0x30] MOV EDX,dword ptr [RBP + -0x18] MOVSXD RDX,EDX SHL RDX,0x3 ADD RAX,RDX MOV qword ptr [RBP + -0x10],RAX MOV dword ptr [RBP + -0x8],0x1 MOV RAX,qword ptr [RBP + -0x10] MOV RDX,qword ptr [RBP + -0x8] LEAVE RET
int [16] func0(long param_1,int param_2) { int auVar1 [16]; int iVar2; int4 local_20; int4 local_1c; int4 uStack_c; local_20 = 0; for (local_1c = 1; local_1c < param_2; local_1c = local_1c + 1) { iVar2 = strcmp(*(char **)(param_1 + (long)local_1c * 8),*(char **)(param_1 + (long)local_20 * 8) ); if (iVar2 < 0) { local_20 = local_1c; } } auVar1._8_4_ = 1; auVar1._0_8_ = param_1 + (long)local_20 * 8; auVar1._12_4_ = uStack_c; return auVar1; }
5,721
func0
#include <assert.h> #include <string.h> // Define a struct to deal with list of strings typedef struct { char **elems; int size; } StringList;
StringList func0(StringList lst) { int minIndex = 0; for (int i = 1; i < lst.size; i++) { if (strcmp(lst.elems[i], lst.elems[minIndex]) < 0) { minIndex = i; } } StringList result = { .elems = &lst.elems[minIndex], .size = 1 }; return result; }
int main() { // Test 1 char *list1[] = {"1", "1,2", "1,2,3"}; StringList lst1 = { list1, 3 }; StringList result1 = func0(lst1); assert(strcmp(result1.elems[0], "1") == 0); // Test 2 char *list2[] = {"1,1", "1,1,1", "1,2,7,8"}; StringList lst2 = { list2, 3 }; StringList result2 = func0(lst2); assert(strcmp(result2.elems[0], "1,1") == 0); // Test 3 char *list3[] = {"x", "x,y", "x,y,z"}; StringList lst3 = { list3, 3 }; StringList result3 = func0(lst3); assert(strcmp(result3.elems[0], "x") == 0); return 0; }
O1
c
func0: endbr64 push %r14 push %r13 push %r12 push %rbp push %rbx mov %rdi,%r13 cmp $0x1,%esi jle 11e6 <func0+0x5d> mov %rdi,%r12 lea -0x2(%rsi),%r14d add $0x2,%r14 mov $0x1,%ebx mov $0x0,%ebp movslq %ebp,%rax mov (%r12,%rax,8),%rsi mov (%r12,%rbx,8),%rdi callq 1090 <strcmp@plt> test %eax,%eax cmovs %ebx,%ebp add $0x1,%rbx cmp %r14,%rbx jne 11b2 <func0+0x29> movslq %ebp,%rbp lea 0x0(%r13,%rbp,8),%rax mov $0x1,%edx pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq mov $0x0,%ebp jmp 11d0 <func0+0x47>
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov r12, rdi cmp esi, 1 jle short loc_11E1 mov r13d, esi mov ebx, 1 mov ebp, 0 loc_11AC: movsxd rax, ebp mov rsi, [r12+rax*8] mov rdi, [r12+rbx*8] call _strcmp test eax, eax cmovs ebp, ebx add rbx, 1 cmp rbx, r13 jnz short loc_11AC loc_11CA: movsxd rbp, ebp lea rax, [r12+rbp*8] mov edx, 1 add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_11E1: mov ebp, 0 jmp short loc_11CA
long long func0(long long a1, int a2) { long long v2; // rbx int v3; // ebp if ( a2 <= 1 ) { v3 = 0; } else { v2 = 1LL; v3 = 0; do { if ( (int)strcmp(*(_QWORD *)(a1 + 8 * v2), *(_QWORD *)(a1 + 8LL * v3)) < 0 ) v3 = v2; ++v2; } while ( v2 != a2 ); } return a1 + 8LL * v3; }
5,722
func0
#include <assert.h> #include <string.h> // Define a struct to deal with list of strings typedef struct { char **elems; int size; } StringList;
StringList func0(StringList lst) { int minIndex = 0; for (int i = 1; i < lst.size; i++) { if (strcmp(lst.elems[i], lst.elems[minIndex]) < 0) { minIndex = i; } } StringList result = { .elems = &lst.elems[minIndex], .size = 1 }; return result; }
int main() { // Test 1 char *list1[] = {"1", "1,2", "1,2,3"}; StringList lst1 = { list1, 3 }; StringList result1 = func0(lst1); assert(strcmp(result1.elems[0], "1") == 0); // Test 2 char *list2[] = {"1,1", "1,1,1", "1,2,7,8"}; StringList lst2 = { list2, 3 }; StringList result2 = func0(lst2); assert(strcmp(result2.elems[0], "1,1") == 0); // Test 3 char *list3[] = {"x", "x,y", "x,y,z"}; StringList lst3 = { list3, 3 }; StringList result3 = func0(lst3); assert(strcmp(result3.elems[0], "x") == 0); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp mov %rdi,%rbp push %rbx sub $0x8,%rsp cmp $0x1,%esi jle 1368 <func0+0x78> mov %esi,%r13d lea 0x8(%rdi),%r14 mov $0x1,%ebx xor %r15d,%r15d nopl 0x0(%rax) movslq %r15d,%rax mov (%r14),%rdi lea 0x0(%rbp,%rax,8),%r12 mov (%r12),%rsi callq 1090 <strcmp@plt> test %eax,%eax cmovs %r14,%r12 cmovs %ebx,%r15d add $0x1,%ebx add $0x8,%r14 cmp %ebx,%r13d jne 1320 <func0+0x30> add $0x8,%rsp mov %r12,%rax mov $0x1,%edx pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) mov %rdi,%r12 jmp 134a <func0+0x5a> nopl (%rax)
func0: endbr64 push r15 push r14 mov r14, rdi push r13 push r12 push rbp push rbx sub rsp, 8 cmp esi, 1 jle short loc_1368 mov r15d, esi lea rbp, [rdi+8] mov ebx, 1 xor r13d, r13d nop dword ptr [rax+00000000h] loc_1320: movsxd rax, r13d mov rdi, [rbp+0] lea r12, [r14+rax*8] mov rsi, [r12] call _strcmp test eax, eax cmovs r12, rbp cmovs r13d, ebx add ebx, 1 add rbp, 8 cmp r15d, ebx jnz short loc_1320 loc_134A: add rsp, 8 mov rax, r12 mov edx, 1 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1368: mov r12, rdi jmp short loc_134A
_QWORD * func0(long long a1, int a2) { _QWORD *v2; // rbp int v3; // ebx int v4; // r13d _QWORD *v5; // r12 if ( a2 <= 1 ) return (_QWORD *)a1; v2 = (_QWORD *)(a1 + 8); v3 = 1; v4 = 0; do { v5 = (_QWORD *)(a1 + 8LL * v4); if ( (int)strcmp(*v2, *v5) < 0 ) { v5 = v2; v4 = v3; } ++v3; ++v2; } while ( a2 != v3 ); return v5; }
func0: ENDBR64 PUSH R15 PUSH R14 MOV R14,RDI PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 CMP ESI,0x1 JLE 0x00101368 MOV R15D,ESI LEA RBP,[RDI + 0x8] MOV EBX,0x1 XOR R13D,R13D NOP dword ptr [RAX] LAB_00101320: MOVSXD RAX,R13D MOV RDI,qword ptr [RBP] LEA R12,[R14 + RAX*0x8] MOV RSI,qword ptr [R12] CALL 0x00101090 TEST EAX,EAX CMOVS R12,RBP CMOVS R13D,EBX ADD EBX,0x1 ADD RBP,0x8 CMP R15D,EBX JNZ 0x00101320 LAB_0010134a: ADD RSP,0x8 MOV RAX,R12 MOV EDX,0x1 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101368: MOV R12,RDI JMP 0x0010134a
int1 [16] func0(int8 *param_1,int param_2) { int iVar1; int iVar2; int8 *puVar3; int8 *puVar4; int iVar5; int1 auVar6 [16]; puVar4 = param_1; if (1 < param_2) { puVar3 = param_1 + 1; iVar2 = 1; iVar5 = 0; do { iVar1 = strcmp((char *)*puVar3,(char *)param_1[iVar5]); puVar4 = param_1 + iVar5; if (iVar1 < 0) { iVar5 = iVar2; puVar4 = puVar3; } iVar2 = iVar2 + 1; puVar3 = puVar3 + 1; } while (param_2 != iVar2); } auVar6._8_8_ = 1; auVar6._0_8_ = puVar4; return auVar6; }
5,723
func0
#include <assert.h> #include <string.h> // Define a struct to deal with list of strings typedef struct { char **elems; int size; } StringList;
StringList func0(StringList lst) { int minIndex = 0; for (int i = 1; i < lst.size; i++) { if (strcmp(lst.elems[i], lst.elems[minIndex]) < 0) { minIndex = i; } } StringList result = { .elems = &lst.elems[minIndex], .size = 1 }; return result; }
int main() { // Test 1 char *list1[] = {"1", "1,2", "1,2,3"}; StringList lst1 = { list1, 3 }; StringList result1 = func0(lst1); assert(strcmp(result1.elems[0], "1") == 0); // Test 2 char *list2[] = {"1,1", "1,1,1", "1,2,7,8"}; StringList lst2 = { list2, 3 }; StringList result2 = func0(lst2); assert(strcmp(result2.elems[0], "1,1") == 0); // Test 3 char *list3[] = {"x", "x,y", "x,y,z"}; StringList lst3 = { list3, 3 }; StringList result3 = func0(lst3); assert(strcmp(result3.elems[0], "x") == 0); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp mov %rdi,%rbp push %rbx sub $0x18,%rsp cmp $0x1,%esi jle 13a0 <func0+0x90> lea -0x2(%rsi),%r14d movl $0x0,0xc(%rsp) mov (%rdi),%r15 mov $0x1,%ebx add $0x2,%r14 jmp 135b <func0+0x4b> nopl 0x0(%rax) movslq 0xc(%rsp),%rax add $0x1,%rbx lea 0x0(%rbp,%rax,8),%r13 cmp %rbx,%r14 je 1384 <func0+0x74> mov 0x0(%rbp,%rbx,8),%r12 mov %r15,%rsi lea 0x0(%rbp,%rbx,8),%r13 mov %r12,%rdi callq 1090 <strcmp@plt> test %eax,%eax jns 1348 <func0+0x38> mov %ebx,0xc(%rsp) add $0x1,%rbx mov %r12,%r15 cmp %rbx,%r14 jne 135b <func0+0x4b> add $0x18,%rsp mov %r13,%rax mov $0x1,%edx pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax,%rax,1) mov %rdi,%r13 jmp 1384 <func0+0x74> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r15 push r14 push r13 push r12 push rbp mov rbp, rdi push rbx sub rsp, 8 cmp esi, 1 jle short loc_1390 mov r14, [rdi] mov r13d, esi mov ebx, 1 xor r15d, r15d jmp short loc_1351 loc_1340: movsxd rax, r15d add rbx, 1 lea rax, [rbp+rax*8+0] cmp r13, rbx jz short loc_1379 loc_1351: mov r12, [rbp+rbx*8+0] mov rsi, r14; s2 mov rdi, r12; s1 call _strcmp test eax, eax jns short loc_1340 mov r15d, ebx lea rax, [rbp+rbx*8+0] add rbx, 1 mov r14, r12 cmp r13, rbx jnz short loc_1351 loc_1379: add rsp, 8 mov edx, 1 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1390: mov rax, rdi jmp short loc_1379
const char ** func0(const char **a1, int a2) { const char *v2; // r14 long long v3; // rbx int v4; // r15d const char **result; // rax const char *v6; // r12 if ( a2 <= 1 ) return a1; v2 = *a1; v3 = 1LL; v4 = 0; do { while ( 1 ) { v6 = a1[v3]; if ( strcmp(v6, v2) < 0 ) break; ++v3; result = &a1[v4]; if ( a2 == v3 ) return result; } v4 = v3; result = &a1[v3++]; v2 = v6; } while ( a2 != v3 ); return result; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP MOV RBP,RDI PUSH RBX SUB RSP,0x8 CMP ESI,0x1 JLE 0x00101390 MOV R14,qword ptr [RDI] MOV R13D,ESI MOV EBX,0x1 XOR R15D,R15D JMP 0x00101351 LAB_00101340: MOVSXD RAX,R15D ADD RBX,0x1 LEA RAX,[RBP + RAX*0x8] CMP R13,RBX JZ 0x00101379 LAB_00101351: MOV R12,qword ptr [RBP + RBX*0x8] MOV RSI,R14 MOV RDI,R12 CALL 0x00101090 TEST EAX,EAX JNS 0x00101340 MOV R15D,EBX LEA RAX,[RBP + RBX*0x8] ADD RBX,0x1 MOV R14,R12 CMP R13,RBX JNZ 0x00101351 LAB_00101379: ADD RSP,0x8 MOV EDX,0x1 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101390: MOV RAX,RDI JMP 0x00101379
int [16] func0(int8 *param_1,uint param_2) { char *__s1; int iVar1; int8 *puVar2; int iVar3; ulong uVar4; char *__s2; int auVar5 [16]; puVar2 = param_1; if (1 < (int)param_2) { uVar4 = 1; iVar3 = 0; __s2 = (char *)*param_1; do { while( true ) { __s1 = (char *)param_1[uVar4]; iVar1 = strcmp(__s1,__s2); if (-1 < iVar1) break; iVar3 = (int)uVar4; puVar2 = param_1 + uVar4; uVar4 = uVar4 + 1; __s2 = __s1; if (param_2 == uVar4) goto LAB_00101379; } uVar4 = uVar4 + 1; puVar2 = param_1 + iVar3; } while (param_2 != uVar4); } LAB_00101379: auVar5._8_8_ = 1; auVar5._0_8_ = puVar2; return auVar5; }
5,724
func0
#include <assert.h>
int func0(int l, int b) { int area = l * b; return area; }
int main() { assert(func0(10, 20) == 200); assert(func0(10, 5) == 50); assert(func0(4, 2) == 8); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) mov -0x14(%rbp),%eax imul -0x18(%rbp),%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 eax, [rbp+var_14] imul eax, [rbp+var_18] mov [rbp+var_4], eax mov eax, [rbp+var_4] pop rbp retn
long long func0(int a1, int a2) { return (unsigned int)(a2 * a1); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x18],ESI MOV EAX,dword ptr [RBP + -0x14] IMUL EAX,dword ptr [RBP + -0x18] MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] POP RBP RET
int func0(int param_1,int param_2) { return param_1 * param_2; }
5,725
func0
#include <assert.h>
int func0(int l, int b) { int area = l * b; return area; }
int main() { assert(func0(10, 20) == 200); assert(func0(10, 5) == 50); assert(func0(4, 2) == 8); return 0; }
O1
c
func0: endbr64 mov %edi,%eax imul %esi,%eax retq
func0: endbr64 mov eax, edi imul eax, esi retn
long long func0(int a1, int a2) { return (unsigned int)(a2 * a1); }
func0: ENDBR64 MOV EAX,EDI IMUL EAX,ESI RET
int func0(int param_1,int param_2) { return param_1 * param_2; }
5,726
func0
#include <assert.h>
int func0(int l, int b) { int area = l * b; return area; }
int main() { assert(func0(10, 20) == 200); assert(func0(10, 5) == 50); assert(func0(4, 2) == 8); return 0; }
O2
c
func0: endbr64 mov %edi,%eax imul %esi,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 mov eax, edi imul eax, esi retn
long long func0(int a1, int a2) { return (unsigned int)(a2 * a1); }
func0: ENDBR64 MOV EAX,EDI IMUL EAX,ESI RET
int func0(int param_1,int param_2) { return param_1 * param_2; }
5,727
func0
#include <assert.h>
int func0(int l, int b) { int area = l * b; return area; }
int main() { assert(func0(10, 20) == 200); assert(func0(10, 5) == 50); assert(func0(4, 2) == 8); return 0; }
O3
c
func0: endbr64 mov %edi,%eax imul %esi,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 mov eax, edi imul eax, esi retn
long long func0(int a1, int a2) { return (unsigned int)(a2 * a1); }
func0: ENDBR64 MOV EAX,EDI IMUL EAX,ESI RET
int func0(int param_1,int param_2) { return param_1 * param_2; }
5,728
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <assert.h>
char* func0(const char* str1) { size_t len = strlen(str1); char* result = malloc(len + 1); if (!result) return NULL; size_t j = 0; for(size_t i = 0; i < len; i++) { if (!isupper((unsigned char)str1[i])) { result[j++] = str1[i]; } } result[j] = '\0'; return result; }
int main() { char* res1 = func0("cAstyoUrFavoRitETVshoWs"); assert(strcmp(res1, "cstyoravoitshos") == 0); free(res1); char* res2 = func0("wAtchTheinTernEtrAdIo"); assert(strcmp(res2, "wtchheinerntrdo") == 0); free(res2); char* res3 = func0("VoicESeaRchAndreComMendaTionS"); assert(strcmp(res3, "oiceachndreomendaion") == 0); free(res3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x28(%rbp) mov -0x28(%rbp),%rax mov %rax,%rdi callq 10b0 <strlen@plt> mov %rax,-0x10(%rbp) mov -0x10(%rbp),%rax add $0x1,%rax mov %rax,%rdi callq 10e0 <malloc@plt> mov %rax,-0x8(%rbp) cmpq $0x0,-0x8(%rbp) jne 122e <func0+0x45> mov $0x0,%eax jmpq 12b3 <func0+0xca> movq $0x0,-0x20(%rbp) movq $0x0,-0x18(%rbp) jmp 1297 <func0+0xae> callq 10f0 <__ctype_b_loc@plt> mov (%rax),%rax mov -0x28(%rbp),%rcx mov -0x18(%rbp),%rdx add %rcx,%rdx movzbl (%rdx),%edx movzbl %dl,%edx add %rdx,%rdx add %rdx,%rax movzwl (%rax),%eax movzwl %ax,%eax and $0x100,%eax test %eax,%eax jne 1292 <func0+0xa9> mov -0x28(%rbp),%rdx mov -0x18(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x20(%rbp),%rax lea 0x1(%rax),%rdx mov %rdx,-0x20(%rbp) mov -0x8(%rbp),%rdx add %rax,%rdx movzbl (%rcx),%eax mov %al,(%rdx) addq $0x1,-0x18(%rbp) mov -0x18(%rbp),%rax cmp -0x10(%rbp),%rax jb 1240 <func0+0x57> mov -0x8(%rbp),%rdx mov -0x20(%rbp),%rax add %rdx,%rax movb $0x0,(%rax) mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+s], rdi mov rax, [rbp+s] mov rdi, rax; s call _strlen mov [rbp+var_10], rax mov rax, [rbp+var_10] add rax, 1 mov rdi, rax; size call _malloc mov [rbp+var_8], rax cmp [rbp+var_8], 0 jnz short loc_122E mov eax, 0 jmp locret_12B3 loc_122E: mov [rbp+var_20], 0 mov [rbp+var_18], 0 jmp short loc_1297 loc_1240: call ___ctype_b_loc mov rax, [rax] mov rcx, [rbp+s] mov rdx, [rbp+var_18] add rdx, rcx movzx edx, byte ptr [rdx] movzx edx, dl add rdx, rdx add rax, rdx movzx eax, word ptr [rax] movzx eax, ax and eax, 100h test eax, eax jnz short loc_1292 mov rdx, [rbp+s] mov rax, [rbp+var_18] lea rcx, [rdx+rax] mov rax, [rbp+var_20] lea rdx, [rax+1] mov [rbp+var_20], rdx mov rdx, [rbp+var_8] add rdx, rax movzx eax, byte ptr [rcx] mov [rdx], al loc_1292: add [rbp+var_18], 1 loc_1297: mov rax, [rbp+var_18] cmp rax, [rbp+var_10] jb short loc_1240 mov rdx, [rbp+var_8] mov rax, [rbp+var_20] add rax, rdx mov byte ptr [rax], 0 mov rax, [rbp+var_8] locret_12B3: leave retn
_BYTE * func0(const char *a1) { long long v2; // rax long long v3; // [rsp+10h] [rbp-20h] size_t i; // [rsp+18h] [rbp-18h] size_t v5; // [rsp+20h] [rbp-10h] _BYTE *v6; // [rsp+28h] [rbp-8h] v5 = strlen(a1); v6 = malloc(v5 + 1); if ( !v6 ) return 0LL; v3 = 0LL; for ( i = 0LL; i < v5; ++i ) { if ( ((*__ctype_b_loc())[(unsigned __int8)a1[i]] & 0x100) == 0 ) { v2 = v3++; v6[v2] = a1[i]; } } v6[v3] = 0; return v6; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x28],RDI MOV RAX,qword ptr [RBP + -0x28] MOV RDI,RAX CALL 0x001010b0 MOV qword ptr [RBP + -0x10],RAX MOV RAX,qword ptr [RBP + -0x10] ADD RAX,0x1 MOV RDI,RAX CALL 0x001010e0 MOV qword ptr [RBP + -0x8],RAX CMP qword ptr [RBP + -0x8],0x0 JNZ 0x0010122e MOV EAX,0x0 JMP 0x001012b3 LAB_0010122e: MOV qword ptr [RBP + -0x20],0x0 MOV qword ptr [RBP + -0x18],0x0 JMP 0x00101297 LAB_00101240: CALL 0x001010f0 MOV RAX,qword ptr [RAX] MOV RCX,qword ptr [RBP + -0x28] MOV RDX,qword ptr [RBP + -0x18] ADD RDX,RCX MOVZX EDX,byte ptr [RDX] MOVZX EDX,DL ADD RDX,RDX ADD RAX,RDX MOVZX EAX,word ptr [RAX] MOVZX EAX,AX AND EAX,0x100 TEST EAX,EAX JNZ 0x00101292 MOV RDX,qword ptr [RBP + -0x28] MOV RAX,qword ptr [RBP + -0x18] LEA RCX,[RDX + RAX*0x1] MOV RAX,qword ptr [RBP + -0x20] LEA RDX,[RAX + 0x1] MOV qword ptr [RBP + -0x20],RDX MOV RDX,qword ptr [RBP + -0x8] ADD RDX,RAX MOVZX EAX,byte ptr [RCX] MOV byte ptr [RDX],AL LAB_00101292: ADD qword ptr [RBP + -0x18],0x1 LAB_00101297: MOV RAX,qword ptr [RBP + -0x18] CMP RAX,qword ptr [RBP + -0x10] JC 0x00101240 MOV RDX,qword ptr [RBP + -0x8] MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV byte ptr [RAX],0x0 MOV RAX,qword ptr [RBP + -0x8] LAB_001012b3: LEAVE RET
void * func0(char *param_1) { size_t sVar1; void *pvVar2; ushort **ppuVar3; long local_28; ulong local_20; sVar1 = strlen(param_1); pvVar2 = malloc(sVar1 + 1); if (pvVar2 == (void *)0x0) { pvVar2 = (void *)0x0; } else { local_28 = 0; for (local_20 = 0; local_20 < sVar1; local_20 = local_20 + 1) { ppuVar3 = __ctype_b_loc(); if (((*ppuVar3)[(byte)param_1[local_20]] & 0x100) == 0) { *(char *)((long)pvVar2 + local_28) = param_1[local_20]; local_28 = local_28 + 1; } } *(int *)(local_28 + (long)pvVar2) = 0; } return pvVar2; }
5,729
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <assert.h>
char* func0(const char* str1) { size_t len = strlen(str1); char* result = malloc(len + 1); if (!result) return NULL; size_t j = 0; for(size_t i = 0; i < len; i++) { if (!isupper((unsigned char)str1[i])) { result[j++] = str1[i]; } } result[j] = '\0'; return result; }
int main() { char* res1 = func0("cAstyoUrFavoRitETVshoWs"); assert(strcmp(res1, "cstyoravoitshos") == 0); free(res1); char* res2 = func0("wAtchTheinTernEtrAdIo"); assert(strcmp(res2, "wtchheinerntrdo") == 0); free(res2); char* res3 = func0("VoicESeaRchAndreComMendaTionS"); assert(strcmp(res3, "oiceachndreomendaion") == 0); free(res3); return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx mov %rdi,%r12 mov $0xffffffffffffffff,%rcx mov $0x0,%eax repnz scas %es:(%rdi),%al mov %rcx,%rdi not %rdi lea -0x1(%rdi),%rbx callq 10a0 <malloc@plt> mov %rax,%rbp test %rax,%rax je 1219 <func0+0x70> test %rbx,%rbx je 1214 <func0+0x6b> callq 10b0 <__ctype_b_loc@plt> mov (%rax),%rsi mov %r12,%rax lea (%r12,%rbx,1),%rdi mov $0x0,%ebx jmp 11fd <func0+0x54> add $0x1,%rax cmp %rdi,%rax je 1214 <func0+0x6b> movzbl (%rax),%edx movzbl %dl,%ecx testb $0x1,0x1(%rsi,%rcx,2) jne 11f4 <func0+0x4b> mov %dl,0x0(%rbp,%rbx,1) lea 0x1(%rbx),%rbx jmp 11f4 <func0+0x4b> movb $0x0,0x0(%rbp,%rbx,1) mov %rbp,%rax pop %rbx pop %rbp pop %r12 retq
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov r12, rdi call _strlen mov r13, rax mov rbx, rax lea rdi, [rax+1] call _malloc mov rbp, rax test rax, rax jz short loc_1256 test r13, r13 jz short loc_1251 call ___ctype_b_loc mov rdi, [rax] mov rax, r12 lea rsi, [r12+r13] mov ebx, 0 jmp short loc_123A loc_1231: add rax, 1 cmp rax, rsi jz short loc_1251 loc_123A: movzx edx, byte ptr [rax] movzx ecx, dl test byte ptr [rdi+rcx*2+1], 1 jnz short loc_1231 mov [rbp+rbx+0], dl lea rbx, [rbx+1] jmp short loc_1231 loc_1251: mov byte ptr [rbp+rbx+0], 0 loc_1256: mov rax, rbp add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
long long func0(_BYTE *a1) { long long v2; // r13 long long v3; // rbx long long v4; // rbp long long v5; // rdi _BYTE *v6; // rax v2 = strlen(); v3 = v2; v4 = malloc(v2 + 1); if ( v4 ) { if ( v2 ) { v5 = *(_QWORD *)__ctype_b_loc(); v6 = a1; v3 = 0LL; do { if ( (*(_BYTE *)(v5 + 2LL * (unsigned __int8)*v6 + 1) & 1) == 0 ) *(_BYTE *)(v4 + v3++) = *v6; ++v6; } while ( v6 != &a1[v2] ); } *(_BYTE *)(v4 + v3) = 0; } return v4; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R12,RDI CALL 0x001010b0 MOV R13,RAX MOV RBX,RAX LEA RDI,[RAX + 0x1] CALL 0x001010e0 MOV RBP,RAX TEST RAX,RAX JZ 0x00101256 TEST R13,R13 JZ 0x00101251 CALL 0x001010f0 MOV RDI,qword ptr [RAX] MOV RAX,R12 LEA RSI,[R12 + R13*0x1] MOV EBX,0x0 JMP 0x0010123a LAB_00101231: ADD RAX,0x1 CMP RAX,RSI JZ 0x00101251 LAB_0010123a: MOVZX EDX,byte ptr [RAX] MOVZX ECX,DL TEST byte ptr [RDI + RCX*0x2 + 0x1],0x1 JNZ 0x00101231 MOV byte ptr [RBP + RBX*0x1],DL LEA RBX,[RBX + 0x1] JMP 0x00101231 LAB_00101251: MOV byte ptr [RBP + RBX*0x1],0x0 LAB_00101256: MOV RAX,RBP ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
void * func0(byte *param_1) { byte *pbVar1; ushort *puVar2; size_t sVar3; void *pvVar4; ushort **ppuVar5; sVar3 = strlen((char *)param_1); pvVar4 = malloc(sVar3 + 1); if (pvVar4 != (void *)0x0) { if (sVar3 != 0) { ppuVar5 = __ctype_b_loc(); puVar2 = *ppuVar5; pbVar1 = param_1 + sVar3; sVar3 = 0; do { if ((*(byte *)((long)puVar2 + (ulong)*param_1 * 2 + 1) & 1) == 0) { *(byte *)((long)pvVar4 + sVar3) = *param_1; sVar3 = sVar3 + 1; } param_1 = param_1 + 1; } while (param_1 != pbVar1); } *(int1 *)((long)pvVar4 + sVar3) = 0; } return pvVar4; }
5,730
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <assert.h>
char* func0(const char* str1) { size_t len = strlen(str1); char* result = malloc(len + 1); if (!result) return NULL; size_t j = 0; for(size_t i = 0; i < len; i++) { if (!isupper((unsigned char)str1[i])) { result[j++] = str1[i]; } } result[j] = '\0'; return result; }
int main() { char* res1 = func0("cAstyoUrFavoRitETVshoWs"); assert(strcmp(res1, "cstyoravoitshos") == 0); free(res1); char* res2 = func0("wAtchTheinTernEtrAdIo"); assert(strcmp(res2, "wtchheinerntrdo") == 0); free(res2); char* res3 = func0("VoicESeaRchAndreComMendaTionS"); assert(strcmp(res3, "oiceachndreomendaion") == 0); free(res3); return 0; }
O2
c
func0: endbr64 push %r12 push %rbp push %rbx mov %rdi,%rbx callq 10a0 <strlen@plt> lea 0x1(%rax),%rdi mov %rax,%rbp callq 10c0 <malloc@plt> mov %rax,%r12 test %rax,%rax je 1337 <func0+0x67> test %rbp,%rbp je 1340 <func0+0x70> callq 10d0 <__ctype_b_loc@plt> mov %rbx,%rdi lea (%rbx,%rbp,1),%r9 xor %r8d,%r8d mov (%rax),%r10 mov %r12,%rax xchg %ax,%ax movzbl (%rdi),%ecx mov %rax,%rsi testb $0x1,0x1(%r10,%rcx,2) jne 132b <func0+0x5b> add $0x1,%r8 mov %cl,(%rax) lea (%r12,%r8,1),%rax mov %rax,%rsi add $0x1,%rdi cmp %rdi,%r9 jne 1310 <func0+0x40> movb $0x0,(%rsi) mov %r12,%rax pop %rbx pop %rbp pop %r12 retq mov %rax,%rsi jmp 1334 <func0+0x64> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r12 push rbp push rbx mov rbx, rdi call _strlen lea rdi, [rax+1] mov rbp, rax call _malloc mov r12, rax test rax, rax jz short loc_1342 test rbp, rbp jz short loc_1350 call ___ctype_b_loc lea rdi, [rbx+rbp] xor esi, esi mov r8, [rax] mov rax, rbx nop word ptr [rax+rax+00h] loc_1320: movzx ecx, byte ptr [rax] test byte ptr [r8+rcx*2+1], 1 jnz short loc_1333 mov [r12+rsi], cl add rsi, 1 loc_1333: add rax, 1 cmp rdi, rax jnz short loc_1320 add rsi, r12 loc_133F: mov byte ptr [rsi], 0 loc_1342: mov rax, r12 pop rbx pop rbp pop r12 retn loc_1350: mov rsi, rax jmp short loc_133F
long long func0(unsigned __int8 *a1) { long long v2; // rbp long long v3; // rax long long v4; // r12 unsigned __int8 *v5; // rdi long long v6; // rsi long long v7; // r8 unsigned __int8 *v8; // rax long long v9; // rcx _BYTE *v10; // rsi v2 = strlen(); v3 = malloc(v2 + 1); v4 = v3; if ( v3 ) { if ( v2 ) { v5 = &a1[v2]; v6 = 0LL; v7 = *(_QWORD *)__ctype_b_loc(); v8 = a1; do { v9 = *v8; if ( (*(_BYTE *)(v7 + 2 * v9 + 1) & 1) == 0 ) *(_BYTE *)(v4 + v6++) = v9; ++v8; } while ( v5 != v8 ); v10 = (_BYTE *)(v4 + v6); } else { v10 = (_BYTE *)v3; } *v10 = 0; } return v4; }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RDI CALL 0x001010b0 LEA RDI,[RAX + 0x1] MOV RBP,RAX CALL 0x001010e0 MOV R12,RAX TEST RAX,RAX JZ 0x00101342 TEST RBP,RBP JZ 0x00101350 CALL 0x001010f0 LEA RDI,[RBX + RBP*0x1] XOR ESI,ESI MOV R8,qword ptr [RAX] MOV RAX,RBX NOP word ptr [RAX + RAX*0x1] LAB_00101320: MOVZX ECX,byte ptr [RAX] TEST byte ptr [R8 + RCX*0x2 + 0x1],0x1 JNZ 0x00101333 MOV byte ptr [R12 + RSI*0x1],CL ADD RSI,0x1 LAB_00101333: ADD RAX,0x1 CMP RDI,RAX JNZ 0x00101320 ADD RSI,R12 LAB_0010133f: MOV byte ptr [RSI],0x0 LAB_00101342: MOV RAX,R12 POP RBX POP RBP POP R12 RET LAB_00101350: MOV RSI,RAX JMP 0x0010133f
int1 * func0(byte *param_1) { byte *pbVar1; ushort *puVar2; size_t sVar3; int1 *puVar4; ushort **ppuVar5; long lVar6; int1 *puVar7; sVar3 = strlen((char *)param_1); puVar4 = (int1 *)malloc(sVar3 + 1); if (puVar4 != (int1 *)0x0) { puVar7 = puVar4; if (sVar3 != 0) { ppuVar5 = __ctype_b_loc(); pbVar1 = param_1 + sVar3; lVar6 = 0; puVar2 = *ppuVar5; do { if ((*(byte *)((long)puVar2 + (ulong)*param_1 * 2 + 1) & 1) == 0) { puVar4[lVar6] = *param_1; lVar6 = lVar6 + 1; } param_1 = param_1 + 1; } while (pbVar1 != param_1); puVar7 = puVar4 + lVar6; } *puVar7 = 0; } return puVar4; }
5,731
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <assert.h>
char* func0(const char* str1) { size_t len = strlen(str1); char* result = malloc(len + 1); if (!result) return NULL; size_t j = 0; for(size_t i = 0; i < len; i++) { if (!isupper((unsigned char)str1[i])) { result[j++] = str1[i]; } } result[j] = '\0'; return result; }
int main() { char* res1 = func0("cAstyoUrFavoRitETVshoWs"); assert(strcmp(res1, "cstyoravoitshos") == 0); free(res1); char* res2 = func0("wAtchTheinTernEtrAdIo"); assert(strcmp(res2, "wtchheinerntrdo") == 0); free(res2); char* res3 = func0("VoicESeaRchAndreComMendaTionS"); assert(strcmp(res3, "oiceachndreomendaion") == 0); free(res3); return 0; }
O3
c
func0: endbr64 push %r12 push %rbp push %rbx mov %rdi,%rbx callq 10a0 <strlen@plt> lea 0x1(%rax),%rdi mov %rax,%rbp callq 10c0 <malloc@plt> mov %rax,%r12 test %rax,%rax je 1337 <func0+0x67> test %rbp,%rbp je 1340 <func0+0x70> callq 10d0 <__ctype_b_loc@plt> mov %rbx,%rdi lea (%rbx,%rbp,1),%r9 xor %r8d,%r8d mov (%rax),%r10 mov %r12,%rax xchg %ax,%ax movzbl (%rdi),%ecx mov %rax,%rsi testb $0x1,0x1(%r10,%rcx,2) jne 132b <func0+0x5b> add $0x1,%r8 mov %cl,(%rax) lea (%r12,%r8,1),%rax mov %rax,%rsi add $0x1,%rdi cmp %rdi,%r9 jne 1310 <func0+0x40> movb $0x0,(%rsi) mov %r12,%rax pop %rbx pop %rbp pop %r12 retq mov %rax,%rsi jmp 1334 <func0+0x64> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r12 push rbp push rbx mov rbx, rdi call _strlen lea rdi, [rax+1]; size mov rbp, rax call _malloc mov r12, rax test rax, rax jz short loc_1342 test rbp, rbp jz short loc_1350 call ___ctype_b_loc lea rdi, [rbx+rbp] xor esi, esi mov r8, [rax] mov rax, rbx nop word ptr [rax+rax+00h] loc_1320: movzx ecx, byte ptr [rax] test byte ptr [r8+rcx*2+1], 1 jnz short loc_1333 mov [r12+rsi], cl add rsi, 1 loc_1333: add rax, 1 cmp rdi, rax jnz short loc_1320 add rsi, r12 loc_133F: mov byte ptr [rsi], 0 loc_1342: mov rax, r12 pop rbx pop rbp pop r12 retn loc_1350: mov rsi, rax jmp short loc_133F
_BYTE * func0(const char *a1) { size_t v2; // rbp _BYTE *v3; // rax _BYTE *v4; // r12 unsigned __int8 *v5; // rdi long long v6; // rsi const unsigned __int16 *v7; // r8 const char *v8; // rax long long v9; // rcx _BYTE *v10; // rsi v2 = strlen(a1); v3 = malloc(v2 + 1); v4 = v3; if ( v3 ) { if ( v2 ) { v5 = (unsigned __int8 *)&a1[v2]; v6 = 0LL; v7 = *__ctype_b_loc(); v8 = a1; do { v9 = *(unsigned __int8 *)v8; if ( (v7[v9] & 0x100) == 0 ) v4[v6++] = v9; ++v8; } while ( v5 != (unsigned __int8 *)v8 ); v10 = &v4[v6]; } else { v10 = v3; } *v10 = 0; } return v4; }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RDI CALL 0x001010b0 LEA RDI,[RAX + 0x1] MOV RBP,RAX CALL 0x001010e0 MOV R12,RAX TEST RAX,RAX JZ 0x00101342 TEST RBP,RBP JZ 0x00101350 CALL 0x001010f0 LEA RDI,[RBX + RBP*0x1] XOR ESI,ESI MOV R8,qword ptr [RAX] MOV RAX,RBX NOP word ptr [RAX + RAX*0x1] LAB_00101320: MOVZX ECX,byte ptr [RAX] TEST byte ptr [R8 + RCX*0x2 + 0x1],0x1 JNZ 0x00101333 MOV byte ptr [R12 + RSI*0x1],CL ADD RSI,0x1 LAB_00101333: ADD RAX,0x1 CMP RDI,RAX JNZ 0x00101320 ADD RSI,R12 LAB_0010133f: MOV byte ptr [RSI],0x0 LAB_00101342: MOV RAX,R12 POP RBX POP RBP POP R12 RET LAB_00101350: MOV RSI,RAX JMP 0x0010133f
int * func0(byte *param_1) { byte *pbVar1; ushort *puVar2; size_t sVar3; int *puVar4; ushort **ppuVar5; long lVar6; int *puVar7; sVar3 = strlen((char *)param_1); puVar4 = (int *)malloc(sVar3 + 1); if (puVar4 != (int *)0x0) { puVar7 = puVar4; if (sVar3 != 0) { ppuVar5 = __ctype_b_loc(); pbVar1 = param_1 + sVar3; lVar6 = 0; puVar2 = *ppuVar5; do { if ((*(byte *)((long)puVar2 + (ulong)*param_1 * 2 + 1) & 1) == 0) { puVar4[lVar6] = *param_1; lVar6 = lVar6 + 1; } param_1 = param_1 + 1; } while (pbVar1 != param_1); puVar7 = puVar4 + lVar6; } *puVar7 = 0; } return puVar4; }
5,732
func0
#include <assert.h> #include <stdlib.h> #include <string.h>
int* func0(int** lst, int* sizes, int count) { int* result = malloc(count * sizeof(int)); for(int i = 0; i < count; i++) { result[i] = lst[i][0]; } return result; }
int main() { // First test case int arr1_0[] = {1, 2}; int arr1_1[] = {3, 4, 5}; int arr1_2[] = {6, 7, 8, 9}; int* lst1[] = {arr1_0, arr1_1, arr1_2}; int sizes1[] = {2, 3, 4}; int expected1[] = {1, 3, 6}; int* res1 = func0(lst1, sizes1, 3); assert(memcmp(res1, expected1, 3 * sizeof(int)) == 0); free(res1); // Second test case int arr2_0[] = {1, 2, 3}; int arr2_1[] = {4, 5}; int* lst2[] = {arr2_0, arr2_1}; int sizes2[] = {3, 2}; int expected2[] = {1, 4}; int* res2 = func0(lst2, sizes2, 2); assert(memcmp(res2, expected2, 2 * sizeof(int)) == 0); free(res2); // Third test case int arr3_0[] = {9, 8, 1}; int arr3_1[] = {1, 2}; int* lst3[] = {arr3_0, arr3_1}; int sizes3[] = {3, 2}; int expected3[] = {9, 1}; int* res3 = func0(lst3, sizes3, 2); assert(memcmp(res3, expected3, 2 * sizeof(int)) == 0); free(res3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %edx,-0x24(%rbp) mov -0x24(%rbp),%eax cltq shl $0x2,%rax mov %rax,%rdi callq 10d0 <malloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0xc(%rbp) jmp 1232 <func0+0x69> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0xc(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x8(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x24(%rbp),%eax jl 11fe <func0+0x35> mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_24], edx mov eax, [rbp+var_24] cdqe shl rax, 2 mov rdi, rax; size call _malloc mov [rbp+var_8], rax mov [rbp+var_C], 0 jmp short loc_1232 loc_11FE: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] add rax, rdx mov rax, [rax] mov edx, [rbp+var_C] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+var_8] add rdx, rcx mov eax, [rax] mov [rdx], eax add [rbp+var_C], 1 loc_1232: mov eax, [rbp+var_C] cmp eax, [rbp+var_24] jl short loc_11FE mov rax, [rbp+var_8] leave retn
_DWORD * func0(long long a1, long long a2, int a3) { int i; // [rsp+24h] [rbp-Ch] _DWORD *v6; // [rsp+28h] [rbp-8h] v6 = malloc(4LL * a3); for ( i = 0; i < a3; ++i ) v6[i] = **(_DWORD **)(8LL * i + a1); return v6; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV dword ptr [RBP + -0x24],EDX MOV EAX,dword ptr [RBP + -0x24] CDQE SHL RAX,0x2 MOV RDI,RAX CALL 0x001010d0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0xc],0x0 JMP 0x00101232 LAB_001011fe: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x8] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX ADD dword ptr [RBP + -0xc],0x1 LAB_00101232: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x24] JL 0x001011fe MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1,int8 param_2,int param_3) { void *pvVar1; int4 local_14; pvVar1 = malloc((long)param_3 << 2); for (local_14 = 0; local_14 < param_3; local_14 = local_14 + 1) { *(int4 *)((long)pvVar1 + (long)local_14 * 4) = **(int4 **)(param_1 + (long)local_14 * 8); } return pvVar1; }
5,733
func0
#include <assert.h> #include <stdlib.h> #include <string.h>
int* func0(int** lst, int* sizes, int count) { int* result = malloc(count * sizeof(int)); for(int i = 0; i < count; i++) { result[i] = lst[i][0]; } return result; }
int main() { // First test case int arr1_0[] = {1, 2}; int arr1_1[] = {3, 4, 5}; int arr1_2[] = {6, 7, 8, 9}; int* lst1[] = {arr1_0, arr1_1, arr1_2}; int sizes1[] = {2, 3, 4}; int expected1[] = {1, 3, 6}; int* res1 = func0(lst1, sizes1, 3); assert(memcmp(res1, expected1, 3 * sizeof(int)) == 0); free(res1); // Second test case int arr2_0[] = {1, 2, 3}; int arr2_1[] = {4, 5}; int* lst2[] = {arr2_0, arr2_1}; int sizes2[] = {3, 2}; int expected2[] = {1, 4}; int* res2 = func0(lst2, sizes2, 2); assert(memcmp(res2, expected2, 2 * sizeof(int)) == 0); free(res2); // Third test case int arr3_0[] = {9, 8, 1}; int arr3_1[] = {1, 2}; int* lst3[] = {arr3_0, arr3_1}; int sizes3[] = {3, 2}; int expected3[] = {9, 1}; int* res3 = func0(lst3, sizes3, 2); assert(memcmp(res3, expected3, 2 * sizeof(int)) == 0); free(res3); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbx mov %edx,%ebp movslq %edx,%rdi shl $0x2,%rdi callq 10d0 <malloc@plt> test %ebp,%ebp jle 1205 <func0+0x3c> lea -0x1(%rbp),%esi mov $0x0,%edx mov (%rbx,%rdx,8),%rcx mov (%rcx),%ecx mov %ecx,(%rax,%rdx,4) mov %rdx,%rcx add $0x1,%rdx cmp %rsi,%rcx jne 11f0 <func0+0x27> add $0x8,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp push rbx sub rsp, 8 mov rbp, rdi mov ebx, edx movsxd rdi, edx shl rdi, 2 call _malloc test ebx, ebx jle short loc_1202 mov edx, ebx mov ecx, 0 loc_11EF: mov rsi, [rbp+rcx*8+0] mov esi, [rsi] mov [rax+rcx*4], esi add rcx, 1 cmp rcx, rdx jnz short loc_11EF loc_1202: add rsp, 8 pop rbx pop rbp retn
long long func0(long long a1, long long a2, int a3) { long long result; // rax long long v5; // rcx result = malloc(4LL * a3); if ( a3 > 0 ) { v5 = 0LL; do { *(_DWORD *)(result + 4 * v5) = **(_DWORD **)(a1 + 8 * v5); ++v5; } while ( v5 != a3 ); } return result; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBP,RDI MOV EBX,EDX MOVSXD RDI,EDX SHL RDI,0x2 CALL 0x001010d0 TEST EBX,EBX JLE 0x00101202 MOV EDX,EBX MOV ECX,0x0 LAB_001011ef: MOV RSI,qword ptr [RBP + RCX*0x8] MOV ESI,dword ptr [RSI] MOV dword ptr [RAX + RCX*0x4],ESI ADD RCX,0x1 CMP RCX,RDX JNZ 0x001011ef LAB_00101202: ADD RSP,0x8 POP RBX POP RBP RET
void func0(long param_1,int8 param_2,uint param_3) { void *pvVar1; ulong uVar2; pvVar1 = malloc((long)(int)param_3 << 2); if (0 < (int)param_3) { uVar2 = 0; do { *(int4 *)((long)pvVar1 + uVar2 * 4) = **(int4 **)(param_1 + uVar2 * 8); uVar2 = uVar2 + 1; } while (uVar2 != param_3); } return; }
5,734
func0
#include <assert.h> #include <stdlib.h> #include <string.h>
int* func0(int** lst, int* sizes, int count) { int* result = malloc(count * sizeof(int)); for(int i = 0; i < count; i++) { result[i] = lst[i][0]; } return result; }
int main() { // First test case int arr1_0[] = {1, 2}; int arr1_1[] = {3, 4, 5}; int arr1_2[] = {6, 7, 8, 9}; int* lst1[] = {arr1_0, arr1_1, arr1_2}; int sizes1[] = {2, 3, 4}; int expected1[] = {1, 3, 6}; int* res1 = func0(lst1, sizes1, 3); assert(memcmp(res1, expected1, 3 * sizeof(int)) == 0); free(res1); // Second test case int arr2_0[] = {1, 2, 3}; int arr2_1[] = {4, 5}; int* lst2[] = {arr2_0, arr2_1}; int sizes2[] = {3, 2}; int expected2[] = {1, 4}; int* res2 = func0(lst2, sizes2, 2); assert(memcmp(res2, expected2, 2 * sizeof(int)) == 0); free(res2); // Third test case int arr3_0[] = {9, 8, 1}; int arr3_1[] = {1, 2}; int* lst3[] = {arr3_0, arr3_1}; int sizes3[] = {3, 2}; int expected3[] = {9, 1}; int* res3 = func0(lst3, sizes3, 2); assert(memcmp(res3, expected3, 2 * sizeof(int)) == 0); free(res3); return 0; }
O2
c
func0: endbr64 push %rbp push %rbx mov %rdi,%rbx movslq %edx,%rdi mov %rdi,%rbp shl $0x2,%rdi sub $0x8,%rsp callq 10b0 <malloc@plt> test %ebp,%ebp jle 145d <func0+0x3d> lea -0x1(%rbp),%esi xor %edx,%edx nopl (%rax) mov (%rbx,%rdx,8),%rcx mov (%rcx),%ecx mov %ecx,(%rax,%rdx,4) mov %rdx,%rcx add $0x1,%rdx cmp %rcx,%rsi jne 1448 <func0+0x28> add $0x8,%rsp pop %rbx pop %rbp retq nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 push r12 push rbp movsxd rbp, edx push rbx mov rbx, rdi lea rdi, ds:0[rbp*4] call _malloc test ebp, ebp jle short loc_140A xor edx, edx nop dword ptr [rax+00000000h] loc_13F8: mov rcx, [rbx+rdx*8] mov ecx, [rcx] mov [rax+rdx*4], ecx add rdx, 1 cmp rbp, rdx jnz short loc_13F8 loc_140A: pop rbx pop rbp pop r12 retn
long long func0(long long a1, long long a2, int a3) { long long v3; // rbp long long result; // rax long long i; // rdx v3 = a3; result = malloc(4LL * a3); if ( (int)v3 > 0 ) { for ( i = 0LL; i != v3; ++i ) *(_DWORD *)(result + 4 * i) = **(_DWORD **)(a1 + 8 * i); } return result; }
func0: ENDBR64 PUSH R12 PUSH RBP MOVSXD RBP,EDX PUSH RBX MOV RBX,RDI LEA RDI,[RBP*0x4] CALL 0x001010b0 TEST EBP,EBP JLE 0x0010140a XOR EDX,EDX NOP dword ptr [RAX] LAB_001013f8: MOV RCX,qword ptr [RBX + RDX*0x8] MOV ECX,dword ptr [RCX] MOV dword ptr [RAX + RDX*0x4],ECX ADD RDX,0x1 CMP RBP,RDX JNZ 0x001013f8 LAB_0010140a: POP RBX POP RBP POP R12 RET
void func0(long param_1,int8 param_2,int param_3) { void *pvVar1; long lVar2; pvVar1 = malloc((long)param_3 * 4); if (0 < param_3) { lVar2 = 0; do { *(int4 *)((long)pvVar1 + lVar2 * 4) = **(int4 **)(param_1 + lVar2 * 8); lVar2 = lVar2 + 1; } while (param_3 != lVar2); } return; }
5,735
func0
#include <assert.h> #include <stdlib.h> #include <string.h>
int* func0(int** lst, int* sizes, int count) { int* result = malloc(count * sizeof(int)); for(int i = 0; i < count; i++) { result[i] = lst[i][0]; } return result; }
int main() { // First test case int arr1_0[] = {1, 2}; int arr1_1[] = {3, 4, 5}; int arr1_2[] = {6, 7, 8, 9}; int* lst1[] = {arr1_0, arr1_1, arr1_2}; int sizes1[] = {2, 3, 4}; int expected1[] = {1, 3, 6}; int* res1 = func0(lst1, sizes1, 3); assert(memcmp(res1, expected1, 3 * sizeof(int)) == 0); free(res1); // Second test case int arr2_0[] = {1, 2, 3}; int arr2_1[] = {4, 5}; int* lst2[] = {arr2_0, arr2_1}; int sizes2[] = {3, 2}; int expected2[] = {1, 4}; int* res2 = func0(lst2, sizes2, 2); assert(memcmp(res2, expected2, 2 * sizeof(int)) == 0); free(res2); // Third test case int arr3_0[] = {9, 8, 1}; int arr3_1[] = {1, 2}; int* lst3[] = {arr3_0, arr3_1}; int sizes3[] = {3, 2}; int expected3[] = {9, 1}; int* res3 = func0(lst3, sizes3, 2); assert(memcmp(res3, expected3, 2 * sizeof(int)) == 0); free(res3); return 0; }
O3
c
func0: endbr64 push %rbp push %rbx mov %rdi,%rbx movslq %edx,%rdi mov %rdi,%rbp shl $0x2,%rdi sub $0x8,%rsp callq 10b0 <malloc@plt> test %ebp,%ebp jle 145d <func0+0x3d> lea -0x1(%rbp),%esi xor %edx,%edx nopl (%rax) mov (%rbx,%rdx,8),%rcx mov (%rcx),%ecx mov %ecx,(%rax,%rdx,4) mov %rdx,%rcx add $0x1,%rdx cmp %rsi,%rcx jne 1448 <func0+0x28> add $0x8,%rsp pop %rbx pop %rbp retq nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 push r12 push rbp movsxd rbp, edx push rbx mov rbx, rdi lea rdi, ds:0[rbp*4]; size call _malloc test ebp, ebp jle short loc_141A xor edx, edx nop dword ptr [rax+00000000h] loc_1408: mov rcx, [rbx+rdx*8] mov ecx, [rcx] mov [rax+rdx*4], ecx add rdx, 1 cmp rbp, rdx jnz short loc_1408 loc_141A: pop rbx pop rbp pop r12 retn
_DWORD * func0(long long a1, long long a2, int a3) { long long v3; // rbp _DWORD *result; // rax long long i; // rdx v3 = a3; result = malloc(4LL * a3); if ( (int)v3 > 0 ) { for ( i = 0LL; i != v3; ++i ) result[i] = **(_DWORD **)(a1 + 8 * i); } return result; }
func0: ENDBR64 PUSH R12 PUSH RBP MOVSXD RBP,EDX PUSH RBX MOV RBX,RDI LEA RDI,[RBP*0x4] CALL 0x001010b0 TEST EBP,EBP JLE 0x0010141a XOR EDX,EDX NOP dword ptr [RAX] LAB_00101408: MOV RCX,qword ptr [RBX + RDX*0x8] MOV ECX,dword ptr [RCX] MOV dword ptr [RAX + RDX*0x4],ECX ADD RDX,0x1 CMP RBP,RDX JNZ 0x00101408 LAB_0010141a: POP RBX POP RBP POP R12 RET
void func0(long param_1,int8 param_2,int param_3) { void *pvVar1; long lVar2; pvVar1 = malloc((long)param_3 * 4); if (0 < param_3) { lVar2 = 0; do { *(int4 *)((long)pvVar1 + lVar2 * 4) = **(int4 **)(param_1 + lVar2 * 8); lVar2 = lVar2 + 1; } while (param_3 != lVar2); } return; }
5,736
func0
#include <assert.h> #include <string.h> #include <stdio.h>
int func0(const char *str) { int upper_ctr = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] >= 'A' && str[i] <= 'Z') upper_ctr += 1; return upper_ctr; } }
int main() { assert(func0("PYthon") == 1); assert(func0("BigData") == 1); assert(func0("program") == 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 $0x0,-0x14(%rbp) mov -0x14(%rbp),%eax movslq %eax,%rbx mov -0x28(%rbp),%rax mov %rax,%rdi callq 1060 <strlen@plt> cmp %rax,%rbx jae 11d1 <func0+0x68> mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax cmp $0x40,%al jle 11cc <func0+0x63> mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax cmp $0x5a,%al jg 11cc <func0+0x63> addl $0x1,-0x18(%rbp) mov -0x18(%rbp),%eax jmp 11d1 <func0+0x68> 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], 0 nop mov eax, [rbp+var_14] movsxd rbx, eax mov rax, [rbp+s] mov rdi, rax; s call _strlen cmp rbx, rax jnb short loc_11D1 mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+s] add rax, rdx movzx eax, byte ptr [rax] cmp al, 40h ; '@' jle short loc_11CC mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+s] add rax, rdx movzx eax, byte ptr [rax] cmp al, 5Ah ; 'Z' jg short loc_11CC add [rbp+var_18], 1 loc_11CC: mov eax, [rbp+var_18] jmp short $+2 loc_11D1: mov rbx, [rbp+var_8] leave retn
size_t func0(const char *a1) { size_t result; // rax unsigned int v2; // [rsp+18h] [rbp-18h] v2 = 0; result = strlen(a1); if ( result ) { if ( *a1 > 64 ) return *a1 <= 90; return v2; } return result; }
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],0x0 NOP MOV EAX,dword ptr [RBP + -0x14] MOVSXD RBX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RDI,RAX CALL 0x00101060 CMP RBX,RAX JNC 0x001011d1 MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] CMP AL,0x40 JLE 0x001011cc MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] CMP AL,0x5a JG 0x001011cc ADD dword ptr [RBP + -0x18],0x1 LAB_001011cc: MOV EAX,dword ptr [RBP + -0x18] JMP 0x001011d1 LAB_001011d1: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
size_t func0(char *param_1) { size_t sVar1; int4 local_20; local_20 = 0; sVar1 = strlen(param_1); if (sVar1 != 0) { if (('@' < *param_1) && (*param_1 < '[')) { local_20 = 1; } sVar1 = (size_t)local_20; } return sVar1; }
5,737
func0
#include <assert.h> #include <string.h> #include <stdio.h>
int func0(const char *str) { int upper_ctr = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] >= 'A' && str[i] <= 'Z') upper_ctr += 1; return upper_ctr; } }
int main() { assert(func0("PYthon") == 1); assert(func0("BigData") == 1); assert(func0("program") == 0); return 0; }
O1
c
func0: endbr64 mov %rdi,%rdx mov $0xffffffffffffffff,%rcx mov $0x0,%eax repnz scas %es:(%rdi),%al cmp $0xfffffffffffffffe,%rcx je 1173 <func0+0x2a> movzbl (%rdx),%eax sub $0x41,%eax cmp $0x19,%al setbe %al movzbl %al,%eax retq retq
func0: endbr64 push rbx mov rbx, rdi call _strlen test rax, rax jz short loc_1189 movzx eax, byte ptr [rbx] sub eax, 41h ; 'A' cmp al, 19h setbe al movzx eax, al loc_1189: pop rbx retn
long long func0(_BYTE *a1) { long long result; // rax result = strlen(); if ( result ) return (unsigned __int8)(*a1 - 65) <= 0x19u; return result; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101060 TEST RAX,RAX JZ 0x00101189 MOVZX EAX,byte ptr [RBX] SUB EAX,0x41 CMP AL,0x19 SETBE AL MOVZX EAX,AL LAB_00101189: POP RBX RET
size_t func0(char *param_1) { size_t sVar1; sVar1 = strlen(param_1); if (sVar1 != 0) { sVar1 = (size_t)((byte)(*param_1 + 0xbfU) < 0x1a); } return sVar1; }
5,738
func0
#include <assert.h> #include <string.h> #include <stdio.h>
int func0(const char *str) { int upper_ctr = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] >= 'A' && str[i] <= 'Z') upper_ctr += 1; return upper_ctr; } }
int main() { assert(func0("PYthon") == 1); assert(func0("BigData") == 1); assert(func0("program") == 0); return 0; }
O2
c
func0: endbr64 push %rbx mov %rdi,%rbx callq 1060 <strlen@plt> test %rax,%rax je 1230 <func0+0x20> movzbl (%rbx),%eax sub $0x41,%eax cmp $0x19,%al setbe %al movzbl %al,%eax pop %rbx retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 push rbx mov rbx, rdi call _strlen test rax, rax jz short loc_1230 movzx eax, byte ptr [rbx] sub eax, 41h ; 'A' cmp al, 19h setbe al movzx eax, al loc_1230: pop rbx retn
long long func0(_BYTE *a1) { long long result; // rax result = strlen(); if ( result ) return (unsigned __int8)(*a1 - 65) <= 0x19u; return result; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101060 TEST RAX,RAX JZ 0x00101230 MOVZX EAX,byte ptr [RBX] SUB EAX,0x41 CMP AL,0x19 SETBE AL MOVZX EAX,AL LAB_00101230: POP RBX RET
size_t func0(char *param_1) { size_t sVar1; sVar1 = strlen(param_1); if (sVar1 != 0) { sVar1 = (size_t)((byte)(*param_1 + 0xbfU) < 0x1a); } return sVar1; }
5,739
func0
#include <assert.h> #include <string.h> #include <stdio.h>
int func0(const char *str) { int upper_ctr = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] >= 'A' && str[i] <= 'Z') upper_ctr += 1; return upper_ctr; } }
int main() { assert(func0("PYthon") == 1); assert(func0("BigData") == 1); assert(func0("program") == 0); return 0; }
O3
c
func0: endbr64 push %rbx mov %rdi,%rbx callq 1060 <strlen@plt> test %rax,%rax je 1230 <func0+0x20> movzbl (%rbx),%eax sub $0x41,%eax cmp $0x19,%al setbe %al movzbl %al,%eax pop %rbx retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 push rbx mov rbx, rdi call _strlen test rax, rax jz short loc_1230 movzx eax, byte ptr [rbx] sub eax, 41h ; 'A' cmp al, 19h setbe al movzx eax, al loc_1230: pop rbx retn
size_t func0(const char *a1) { size_t result; // rax result = strlen(a1); if ( result ) return (unsigned __int8)(*a1 - 65) <= 0x19u; return result; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101060 TEST RAX,RAX JZ 0x00101230 MOVZX EAX,byte ptr [RBX] SUB EAX,0x41 CMP AL,0x19 SETBE AL MOVZX EAX,AL LAB_00101230: POP RBX RET
size_t func0(char *param_1) { size_t sVar1; sVar1 = strlen(param_1); if (sVar1 != 0) { sVar1 = (size_t)((byte)(*param_1 + 0xbfU) < 0x1a); } return sVar1; }
5,740
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #define MAX_COMBINATIONS 64 #define MAX_ELEMENTS 6 #define MAX_STRING_LENGTH 10 typedef struct { char elements[MAX_ELEMENTS][MAX_STRING_LENGTH]; int size; } Combination; typedef struct { Combination combinations[MAX_COMBINATIONS]; int count; } CombinationList; // Function to generate combinations CombinationList combinations_list(char *list1[], int n) { CombinationList cl; cl.count = 0; int total = 1 << n; // 2^n combinations for(int i = 0; i < total; i++) { Combination comb; comb.size = 0; for(int j = 0; j < n; j++) { if(i & (1 << j)) { strcpy(comb.elements[comb.size++], list1[j]); } } cl.combinations[cl.count++] = comb; } return cl; } // Function to compare two CombinationLists
int func0(CombinationList a, CombinationList b) { if(a.count != b.count) return 0; for(int i = 0; i < a.count; i++) { if(a.combinations[i].size != b.combinations[i].size) return 0; for(int j = 0; j < a.combinations[i].size; j++) { if(strcmp(a.combinations[i].elements[j], b.combinations[i].elements[j]) != 0) return 0; } } return 1; }
int main() { // First assert char *list1[] = {"orange", "red", "green", "blue"}; CombinationList result1 = combinations_list(list1, 4); CombinationList expected1; expected1.count = 16; // [] expected1.combinations[0].size = 0; // ['orange'] strcpy(expected1.combinations[1].elements[0], "orange"); expected1.combinations[1].size = 1; // ['red'] strcpy(expected1.combinations[2].elements[0], "red"); expected1.combinations[2].size = 1; // ['red', 'orange'] strcpy(expected1.combinations[3].elements[0], "orange"); strcpy(expected1.combinations[3].elements[1], "red"); expected1.combinations[3].size = 2; // ['green'] strcpy(expected1.combinations[4].elements[0], "green"); expected1.combinations[4].size = 1; // ['green', 'orange'] strcpy(expected1.combinations[5].elements[0], "orange"); strcpy(expected1.combinations[5].elements[1], "green"); expected1.combinations[5].size = 2; // ['green', 'red'] strcpy(expected1.combinations[6].elements[0], "red"); strcpy(expected1.combinations[6].elements[1], "green"); expected1.combinations[6].size = 2; // ['green', 'red', 'orange'] strcpy(expected1.combinations[7].elements[0], "orange"); strcpy(expected1.combinations[7].elements[1], "red"); strcpy(expected1.combinations[7].elements[2], "green"); expected1.combinations[7].size = 3; // ['blue'] strcpy(expected1.combinations[8].elements[0], "blue"); expected1.combinations[8].size = 1; // ['blue', 'orange'] strcpy(expected1.combinations[9].elements[0], "orange"); strcpy(expected1.combinations[9].elements[1], "blue"); expected1.combinations[9].size = 2; // ['blue', 'red'] strcpy(expected1.combinations[10].elements[0], "red"); strcpy(expected1.combinations[10].elements[1], "blue"); expected1.combinations[10].size = 2; // ['blue', 'red', 'orange'] strcpy(expected1.combinations[11].elements[0], "orange"); strcpy(expected1.combinations[11].elements[1], "red"); strcpy(expected1.combinations[11].elements[2], "blue"); expected1.combinations[11].size = 3; // ['blue', 'green'] strcpy(expected1.combinations[12].elements[0], "green"); strcpy(expected1.combinations[12].elements[1], "blue"); expected1.combinations[12].size = 2; // ['blue', 'green', 'orange'] strcpy(expected1.combinations[13].elements[0], "orange"); strcpy(expected1.combinations[13].elements[1], "green"); strcpy(expected1.combinations[13].elements[2], "blue"); expected1.combinations[13].size = 3; // ['blue', 'green', 'red'] strcpy(expected1.combinations[14].elements[0], "red"); strcpy(expected1.combinations[14].elements[1], "green"); strcpy(expected1.combinations[14].elements[2], "blue"); expected1.combinations[14].size = 3; // ['blue', 'green', 'red', 'orange'] strcpy(expected1.combinations[15].elements[0], "orange"); strcpy(expected1.combinations[15].elements[1], "red"); strcpy(expected1.combinations[15].elements[2], "green"); strcpy(expected1.combinations[15].elements[3], "blue"); expected1.combinations[15].size = 4; assert(func0(result1, expected1)); // Second assert char *list2[] = {"red", "green", "blue", "white", "black", "orange"}; CombinationList result2 = combinations_list(list2, 6); CombinationList expected2; expected2.count = 64; // Due to length, this part is omitted. In practice, you would fill expected2 with all 64 combinations. // For brevity, we'll assume it's correctly filled. // You need to manually fill each combination as per the Python assert. // ... // Third assert char *list3[] = {"red", "green", "black", "orange"}; CombinationList result3 = combinations_list(list3, 4); CombinationList expected3; expected3.count = 16; // [] expected3.combinations[0].size = 0; // ['red'] strcpy(expected3.combinations[1].elements[0], "red"); expected3.combinations[1].size = 1; // ['green'] strcpy(expected3.combinations[2].elements[0], "green"); expected3.combinations[2].size = 1; // ['green', 'red'] strcpy(expected3.combinations[3].elements[0], "red"); strcpy(expected3.combinations[3].elements[1], "green"); expected3.combinations[3].size = 2; // ['black'] strcpy(expected3.combinations[4].elements[0], "black"); expected3.combinations[4].size = 1; // ['black', 'red'] strcpy(expected3.combinations[5].elements[0], "red"); strcpy(expected3.combinations[5].elements[1], "black"); expected3.combinations[5].size = 2; // ['black', 'green'] strcpy(expected3.combinations[6].elements[0], "green"); strcpy(expected3.combinations[6].elements[1], "black"); expected3.combinations[6].size = 2; // ['black', 'green', 'red'] strcpy(expected3.combinations[7].elements[0], "red"); strcpy(expected3.combinations[7].elements[1], "green"); strcpy(expected3.combinations[7].elements[2], "black"); expected3.combinations[7].size = 3; // ['orange'] strcpy(expected3.combinations[8].elements[0], "orange"); expected3.combinations[8].size = 1; // ['orange', 'red'] strcpy(expected3.combinations[9].elements[0], "red"); strcpy(expected3.combinations[9].elements[1], "orange"); expected3.combinations[9].size = 2; // ['orange', 'green'] strcpy(expected3.combinations[10].elements[0], "green"); strcpy(expected3.combinations[10].elements[1], "orange"); expected3.combinations[10].size = 2; // ['orange', 'green', 'red'] strcpy(expected3.combinations[11].elements[0], "red"); strcpy(expected3.combinations[11].elements[1], "green"); strcpy(expected3.combinations[11].elements[2], "orange"); expected3.combinations[11].size = 3; // ['orange', 'black'] strcpy(expected3.combinations[12].elements[0], "black"); strcpy(expected3.combinations[12].elements[1], "orange"); expected3.combinations[12].size = 2; // ['orange', 'black', 'red'] strcpy(expected3.combinations[13].elements[0], "red"); strcpy(expected3.combinations[13].elements[1], "black"); strcpy(expected3.combinations[13].elements[2], "orange"); expected3.combinations[13].size = 3; // ['orange', 'black', 'green'] strcpy(expected3.combinations[14].elements[0], "green"); strcpy(expected3.combinations[14].elements[1], "black"); strcpy(expected3.combinations[14].elements[2], "orange"); expected3.combinations[14].size = 3; // ['orange', 'black', 'green', 'red'] strcpy(expected3.combinations[15].elements[0], "red"); strcpy(expected3.combinations[15].elements[1], "green"); strcpy(expected3.combinations[15].elements[2], "black"); strcpy(expected3.combinations[15].elements[3], "orange"); expected3.combinations[15].size = 4; assert(func0(result3, expected3)); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov 0x1010(%rbp),%edx mov 0x2018(%rbp),%eax cmp %eax,%edx je 13da <func0+0x26> mov $0x0,%eax jmpq 14cd <func0+0x119> movl $0x0,-0x8(%rbp) jmpq 14b9 <func0+0x105> mov -0x8(%rbp),%eax cltq shl $0x6,%rax lea 0x10(%rbp),%rsi add %rsi,%rax add $0x3c,%rax mov (%rax),%edx mov -0x8(%rbp),%eax cltq shl $0x6,%rax lea 0x10(%rbp),%rdi add %rdi,%rax add $0x1044,%rax mov (%rax),%eax cmp %eax,%edx je 1422 <func0+0x6e> mov $0x0,%eax jmpq 14cd <func0+0x119> movl $0x0,-0x4(%rbp) jmp 1496 <func0+0xe2> lea 0x1018(%rbp),%rcx mov -0x4(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax add %rax,%rax mov -0x8(%rbp),%edx movslq %edx,%rdx shl $0x6,%rdx add %rdx,%rax add %rax,%rcx mov -0x4(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax add %rax,%rax mov -0x8(%rbp),%edx movslq %edx,%rdx shl $0x6,%rdx add %rdx,%rax lea 0x10(%rbp),%rsi add %rsi,%rax mov %rcx,%rsi mov %rax,%rdi callq 10b0 <strcmp@plt> test %eax,%eax je 1492 <func0+0xde> mov $0x0,%eax jmp 14cd <func0+0x119> addl $0x1,-0x4(%rbp) mov -0x8(%rbp),%eax cltq shl $0x6,%rax lea 0x10(%rbp),%rdi add %rdi,%rax add $0x3c,%rax mov (%rax),%eax cmp %eax,-0x4(%rbp) jl 142b <func0+0x77> addl $0x1,-0x8(%rbp) mov 0x1010(%rbp),%eax cmp %eax,-0x8(%rbp) jl 13e6 <func0+0x32> mov $0x1,%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 10h mov edx, [rbp+arg_1000] mov eax, [rbp+arg_2008] cmp edx, eax jz short loc_13D6 mov eax, 0 jmp locret_14C9 loc_13D6: mov [rbp+var_8], 0 jmp loc_14B5 loc_13E2: mov eax, [rbp+var_8] cdqe shl rax, 6 lea rax, [rax+10h] add rax, rbp add rax, 3Ch ; '<' mov edx, [rax] mov eax, [rbp+var_8] cdqe shl rax, 6 lea rax, [rax+10h] add rax, rbp add rax, 1044h mov eax, [rax] cmp edx, eax jz short loc_141E mov eax, 0 jmp locret_14C9 loc_141E: mov [rbp+var_4], 0 jmp short loc_1492 loc_1427: lea rcx, [rbp+arg_1008] mov eax, [rbp+var_4] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx add rax, rax mov edx, [rbp+var_8] movsxd rdx, edx shl rdx, 6 add rax, rdx add rcx, rax mov eax, [rbp+var_4] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx add rax, rax mov edx, [rbp+var_8] movsxd rdx, edx shl rdx, 6 add rax, rdx lea rax, [rax+10h] add rax, rbp mov rsi, rcx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jz short loc_148E mov eax, 0 jmp short locret_14C9 loc_148E: add [rbp+var_4], 1 loc_1492: mov eax, [rbp+var_8] cdqe shl rax, 6 lea rax, [rax+10h] add rax, rbp add rax, 3Ch ; '<' mov eax, [rax] cmp [rbp+var_4], eax jl loc_1427 add [rbp+var_8], 1 loc_14B5: mov eax, [rbp+arg_1000] cmp [rbp+var_8], eax jl loc_13E2 mov eax, 1 locret_14C9: leave retn
long long func0( long long a1, long long a2, long long a3, long long a4, long long a5, long long a6, long long a7, long long a8, long long a9, long long a10, long long a11, long long a12) { int i; // [rsp+8h] [rbp-8h] int j; // [rsp+Ch] [rbp-4h] long long savedregs; // [rsp+10h] [rbp+0h] BYREF if ( LODWORD(STACK[0x1020]) != LODWORD(STACK[0x2028]) ) return 0LL; for ( i = 0; i < SLODWORD(STACK[0x1020]); ++i ) { if ( *((_DWORD *)&a12 + 16 * (long long)i + 5) != *((_DWORD *)&STACK[0x1054] + 16 * (long long)i + 4) ) return 0LL; for ( j = 0; j < *((_DWORD *)&a12 + 16 * (long long)i + 5); ++j ) { if ( strcmp( (const char *)&savedregs + 64 * (long long)i + 10 * j + 16, (const char *)&STACK[0x1028] + 64 * (long long)i + 10 * j) ) { return 0LL; } } } return 1LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x10 MOV EDX,dword ptr [RBP + 0x1010] MOV EAX,dword ptr [RBP + 0x2018] CMP EDX,EAX JZ 0x001013d6 MOV EAX,0x0 JMP 0x001014c9 LAB_001013d6: MOV dword ptr [RBP + -0x8],0x0 JMP 0x001014b5 LAB_001013e2: MOV EAX,dword ptr [RBP + -0x8] CDQE SHL RAX,0x6 LEA RAX,[RAX + 0x10] ADD RAX,RBP ADD RAX,0x3c MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x8] CDQE SHL RAX,0x6 LEA RAX,[RAX + 0x10] ADD RAX,RBP ADD RAX,0x1044 MOV EAX,dword ptr [RAX] CMP EDX,EAX JZ 0x0010141e MOV EAX,0x0 JMP 0x001014c9 LAB_0010141e: MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101492 LAB_00101427: LEA RCX,[RBP + 0x1018] MOV EAX,dword ptr [RBP + -0x4] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX ADD RAX,RAX MOV EDX,dword ptr [RBP + -0x8] MOVSXD RDX,EDX SHL RDX,0x6 ADD RAX,RDX ADD RCX,RAX MOV EAX,dword ptr [RBP + -0x4] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX ADD RAX,RAX MOV EDX,dword ptr [RBP + -0x8] MOVSXD RDX,EDX SHL RDX,0x6 ADD RAX,RDX LEA RAX,[RAX + 0x10] ADD RAX,RBP MOV RSI,RCX MOV RDI,RAX CALL 0x001010b0 TEST EAX,EAX JZ 0x0010148e MOV EAX,0x0 JMP 0x001014c9 LAB_0010148e: ADD dword ptr [RBP + -0x4],0x1 LAB_00101492: MOV EAX,dword ptr [RBP + -0x8] CDQE SHL RAX,0x6 LEA RAX,[RAX + 0x10] ADD RAX,RBP ADD RAX,0x3c MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x4],EAX JL 0x00101427 ADD dword ptr [RBP + -0x8],0x1 LAB_001014b5: MOV EAX,dword ptr [RBP + 0x1010] CMP dword ptr [RBP + -0x8],EAX JL 0x001013e2 MOV EAX,0x1 LAB_001014c9: LEAVE RET
int8 func0(void) { int iVar1; int8 uVar2; int in_stack_00001008; int in_stack_00002010; int local_10; int local_c; if (in_stack_00001008 == in_stack_00002010) { for (local_10 = 0; local_10 < in_stack_00001008; local_10 = local_10 + 1) { if (*(int *)(&stack0x00000044 + (long)local_10 * 0x40) != *(int *)(&stack0x0000104c + (long)local_10 * 0x40)) { return 0; } for (local_c = 0; local_c < *(int *)(&stack0x00000044 + (long)local_10 * 0x40); local_c = local_c + 1) { iVar1 = strcmp(&stack0x00000008 + (long)local_c * 10 + (long)local_10 * 0x40, &stack0x00001010 + (long)local_c * 10 + (long)local_10 * 0x40); if (iVar1 != 0) { return 0; } } } uVar2 = 1; } else { uVar2 = 0; } return uVar2; }
5,741
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #define MAX_COMBINATIONS 64 #define MAX_ELEMENTS 6 #define MAX_STRING_LENGTH 10 typedef struct { char elements[MAX_ELEMENTS][MAX_STRING_LENGTH]; int size; } Combination; typedef struct { Combination combinations[MAX_COMBINATIONS]; int count; } CombinationList; // Function to generate combinations CombinationList combinations_list(char *list1[], int n) { CombinationList cl; cl.count = 0; int total = 1 << n; // 2^n combinations for(int i = 0; i < total; i++) { Combination comb; comb.size = 0; for(int j = 0; j < n; j++) { if(i & (1 << j)) { strcpy(comb.elements[comb.size++], list1[j]); } } cl.combinations[cl.count++] = comb; } return cl; } // Function to compare two CombinationLists
int func0(CombinationList a, CombinationList b) { if(a.count != b.count) return 0; for(int i = 0; i < a.count; i++) { if(a.combinations[i].size != b.combinations[i].size) return 0; for(int j = 0; j < a.combinations[i].size; j++) { if(strcmp(a.combinations[i].elements[j], b.combinations[i].elements[j]) != 0) return 0; } } return 1; }
int main() { // First assert char *list1[] = {"orange", "red", "green", "blue"}; CombinationList result1 = combinations_list(list1, 4); CombinationList expected1; expected1.count = 16; // [] expected1.combinations[0].size = 0; // ['orange'] strcpy(expected1.combinations[1].elements[0], "orange"); expected1.combinations[1].size = 1; // ['red'] strcpy(expected1.combinations[2].elements[0], "red"); expected1.combinations[2].size = 1; // ['red', 'orange'] strcpy(expected1.combinations[3].elements[0], "orange"); strcpy(expected1.combinations[3].elements[1], "red"); expected1.combinations[3].size = 2; // ['green'] strcpy(expected1.combinations[4].elements[0], "green"); expected1.combinations[4].size = 1; // ['green', 'orange'] strcpy(expected1.combinations[5].elements[0], "orange"); strcpy(expected1.combinations[5].elements[1], "green"); expected1.combinations[5].size = 2; // ['green', 'red'] strcpy(expected1.combinations[6].elements[0], "red"); strcpy(expected1.combinations[6].elements[1], "green"); expected1.combinations[6].size = 2; // ['green', 'red', 'orange'] strcpy(expected1.combinations[7].elements[0], "orange"); strcpy(expected1.combinations[7].elements[1], "red"); strcpy(expected1.combinations[7].elements[2], "green"); expected1.combinations[7].size = 3; // ['blue'] strcpy(expected1.combinations[8].elements[0], "blue"); expected1.combinations[8].size = 1; // ['blue', 'orange'] strcpy(expected1.combinations[9].elements[0], "orange"); strcpy(expected1.combinations[9].elements[1], "blue"); expected1.combinations[9].size = 2; // ['blue', 'red'] strcpy(expected1.combinations[10].elements[0], "red"); strcpy(expected1.combinations[10].elements[1], "blue"); expected1.combinations[10].size = 2; // ['blue', 'red', 'orange'] strcpy(expected1.combinations[11].elements[0], "orange"); strcpy(expected1.combinations[11].elements[1], "red"); strcpy(expected1.combinations[11].elements[2], "blue"); expected1.combinations[11].size = 3; // ['blue', 'green'] strcpy(expected1.combinations[12].elements[0], "green"); strcpy(expected1.combinations[12].elements[1], "blue"); expected1.combinations[12].size = 2; // ['blue', 'green', 'orange'] strcpy(expected1.combinations[13].elements[0], "orange"); strcpy(expected1.combinations[13].elements[1], "green"); strcpy(expected1.combinations[13].elements[2], "blue"); expected1.combinations[13].size = 3; // ['blue', 'green', 'red'] strcpy(expected1.combinations[14].elements[0], "red"); strcpy(expected1.combinations[14].elements[1], "green"); strcpy(expected1.combinations[14].elements[2], "blue"); expected1.combinations[14].size = 3; // ['blue', 'green', 'red', 'orange'] strcpy(expected1.combinations[15].elements[0], "orange"); strcpy(expected1.combinations[15].elements[1], "red"); strcpy(expected1.combinations[15].elements[2], "green"); strcpy(expected1.combinations[15].elements[3], "blue"); expected1.combinations[15].size = 4; assert(func0(result1, expected1)); // Second assert char *list2[] = {"red", "green", "blue", "white", "black", "orange"}; CombinationList result2 = combinations_list(list2, 6); CombinationList expected2; expected2.count = 64; // Due to length, this part is omitted. In practice, you would fill expected2 with all 64 combinations. // For brevity, we'll assume it's correctly filled. // You need to manually fill each combination as per the Python assert. // ... // Third assert char *list3[] = {"red", "green", "black", "orange"}; CombinationList result3 = combinations_list(list3, 4); CombinationList expected3; expected3.count = 16; // [] expected3.combinations[0].size = 0; // ['red'] strcpy(expected3.combinations[1].elements[0], "red"); expected3.combinations[1].size = 1; // ['green'] strcpy(expected3.combinations[2].elements[0], "green"); expected3.combinations[2].size = 1; // ['green', 'red'] strcpy(expected3.combinations[3].elements[0], "red"); strcpy(expected3.combinations[3].elements[1], "green"); expected3.combinations[3].size = 2; // ['black'] strcpy(expected3.combinations[4].elements[0], "black"); expected3.combinations[4].size = 1; // ['black', 'red'] strcpy(expected3.combinations[5].elements[0], "red"); strcpy(expected3.combinations[5].elements[1], "black"); expected3.combinations[5].size = 2; // ['black', 'green'] strcpy(expected3.combinations[6].elements[0], "green"); strcpy(expected3.combinations[6].elements[1], "black"); expected3.combinations[6].size = 2; // ['black', 'green', 'red'] strcpy(expected3.combinations[7].elements[0], "red"); strcpy(expected3.combinations[7].elements[1], "green"); strcpy(expected3.combinations[7].elements[2], "black"); expected3.combinations[7].size = 3; // ['orange'] strcpy(expected3.combinations[8].elements[0], "orange"); expected3.combinations[8].size = 1; // ['orange', 'red'] strcpy(expected3.combinations[9].elements[0], "red"); strcpy(expected3.combinations[9].elements[1], "orange"); expected3.combinations[9].size = 2; // ['orange', 'green'] strcpy(expected3.combinations[10].elements[0], "green"); strcpy(expected3.combinations[10].elements[1], "orange"); expected3.combinations[10].size = 2; // ['orange', 'green', 'red'] strcpy(expected3.combinations[11].elements[0], "red"); strcpy(expected3.combinations[11].elements[1], "green"); strcpy(expected3.combinations[11].elements[2], "orange"); expected3.combinations[11].size = 3; // ['orange', 'black'] strcpy(expected3.combinations[12].elements[0], "black"); strcpy(expected3.combinations[12].elements[1], "orange"); expected3.combinations[12].size = 2; // ['orange', 'black', 'red'] strcpy(expected3.combinations[13].elements[0], "red"); strcpy(expected3.combinations[13].elements[1], "black"); strcpy(expected3.combinations[13].elements[2], "orange"); expected3.combinations[13].size = 3; // ['orange', 'black', 'green'] strcpy(expected3.combinations[14].elements[0], "green"); strcpy(expected3.combinations[14].elements[1], "black"); strcpy(expected3.combinations[14].elements[2], "orange"); expected3.combinations[14].size = 3; // ['orange', 'black', 'green', 'red'] strcpy(expected3.combinations[15].elements[0], "red"); strcpy(expected3.combinations[15].elements[1], "green"); strcpy(expected3.combinations[15].elements[2], "black"); strcpy(expected3.combinations[15].elements[3], "orange"); expected3.combinations[15].size = 4; assert(func0(result3, expected3)); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov 0x1050(%rsp),%eax mov $0x0,%edx cmp 0x2058(%rsp),%eax jne 13ff <func0+0xd1> test %eax,%eax jle 13ec <func0+0xbe> lea -0x1(%rax),%eax add $0x1,%rax shl $0x6,%rax mov %rax,0x8(%rsp) mov $0x0,%r13d lea 0x8c(%rsp),%r15 lea 0x1094(%rsp),%r14 lea 0x1058(%rsp),%rax mov %rax,(%rsp) mov (%r15,%r13,1),%eax cmp (%r14,%r13,1),%eax jne 13f3 <func0+0xc5> test %eax,%eax jle 13da <func0+0xac> lea 0x50(%rsp),%rcx lea (%rcx,%r13,1),%rbx mov (%rsp),%rcx lea (%rcx,%r13,1),%rbp lea -0x1(%rax),%eax lea (%rax,%rax,4),%rax lea 0xa(%rbx,%rax,2),%r12 mov %rbp,%rsi mov %rbx,%rdi callq 10b0 <strcmp@plt> test %eax,%eax jne 13fa <func0+0xcc> add $0xa,%rbx add $0xa,%rbp cmp %r12,%rbx jne 13be <func0+0x90> add $0x40,%r13 cmp 0x8(%rsp),%r13 jne 1393 <func0+0x65> mov $0x1,%edx jmp 13ff <func0+0xd1> mov $0x1,%edx jmp 13ff <func0+0xd1> mov $0x0,%edx jmp 13ff <func0+0xd1> mov $0x0,%edx mov %edx,%eax add $0x18,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 18h mov eax, [rsp+48h+arg_1000] mov edx, 0 cmp eax, [rsp+48h+arg_2008] jnz loc_13F2 test eax, eax jle loc_13DF lea eax, [rax-1] add rax, 1 shl rax, 6 mov [rsp+48h+var_40], rax mov r13d, 0 lea r15, [rsp+48h+arg_3C] lea r14, [rsp+48h+arg_1044] lea rax, [rsp+48h+arg_1008] mov [rsp+48h+var_48], rax loc_1387: mov eax, [r15+r13] cmp eax, [r14+r13] jnz short loc_13E6 test eax, eax jle short loc_13CD lea rdx, [r13+50h] lea rbx, [rsp+rdx+48h+var_48] mov rcx, [rsp+48h+var_48] lea rbp, [rcx+r13] lea eax, [rax-1] lea rax, [rax+rax*4] lea r12, [rbx+rax*2+0Ah] loc_13B1: mov rsi, rbp mov rdi, rbx call _strcmp test eax, eax jnz short loc_13ED add rbx, 0Ah add rbp, 0Ah cmp rbx, r12 jnz short loc_13B1 loc_13CD: add r13, 40h ; '@' cmp r13, [rsp+48h+var_40] jnz short loc_1387 mov edx, 1 jmp short loc_13F2 loc_13DF: mov edx, 1 jmp short loc_13F2 loc_13E6: mov edx, 0 jmp short loc_13F2 loc_13ED: mov edx, 0 loc_13F2: mov eax, edx add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0( long long a1, long long a2, long long a3, long long a4, long long a5, long long a6, long long a7, long long a8, long long a9, long long a10, long long a11, long long a12, long long a13, long long a14) { int v14; // eax unsigned int v15; // edx unsigned long long v16; // r13 int v17; // eax char *v18; // rbx unsigned long long *v19; // rbp long long v20; // r12 unsigned long long *v22; // [rsp+0h] [rbp-48h] BYREF long long v23; // [rsp+8h] [rbp-40h] v14 = STACK[0x1050]; v15 = 0; if ( LODWORD(STACK[0x1050]) == LODWORD(STACK[0x2058]) ) { if ( v14 <= 0 ) { return 1; } else { v23 = ((unsigned int)(v14 - 1) + 1LL) << 6; v16 = 0LL; v22 = &STACK[0x1058]; while ( 1 ) { v17 = *(_DWORD *)((char *)&a14 + v16 + 4); if ( v17 != *(_DWORD *)((char *)&STACK[0x1094] + v16) ) return 0; if ( v17 > 0 ) break; LABEL_9: v16 += 64LL; if ( v16 == v23 ) return 1; } v18 = (char *)&(&v22)[v16 / 8 + 10]; v19 = &v22[v16 / 8]; v20 = (long long)&v18[10 * (v17 - 1) + 10]; while ( !(unsigned int)strcmp(v18, v19) ) { v18 += 10; v19 = (unsigned long long *)((char *)v19 + 10); if ( v18 == (char *)v20 ) goto LABEL_9; } return 0; } } return v15; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV EAX,dword ptr [RSP + 0x1050] MOV EDX,0x0 CMP EAX,dword ptr [RSP + 0x2058] JNZ 0x001013f2 TEST EAX,EAX JLE 0x001013df LEA EAX,[RAX + -0x1] ADD RAX,0x1 SHL RAX,0x6 MOV qword ptr [RSP + 0x8],RAX MOV R13D,0x0 LEA R15,[RSP + 0x8c] LEA R14,[RSP + 0x1094] LEA RAX,[RSP + 0x1058] MOV qword ptr [RSP],RAX LAB_00101387: MOV EAX,dword ptr [R15 + R13*0x1] CMP EAX,dword ptr [R14 + R13*0x1] JNZ 0x001013e6 TEST EAX,EAX JLE 0x001013cd LEA RDX,[R13 + 0x50] LEA RBX,[RSP + RDX*0x1] MOV RCX,qword ptr [RSP] LEA RBP,[RCX + R13*0x1] LEA EAX,[RAX + -0x1] LEA RAX,[RAX + RAX*0x4] LEA R12,[RBX + RAX*0x2 + 0xa] LAB_001013b1: MOV RSI,RBP MOV RDI,RBX CALL 0x001010b0 TEST EAX,EAX JNZ 0x001013ed ADD RBX,0xa ADD RBP,0xa CMP RBX,R12 JNZ 0x001013b1 LAB_001013cd: ADD R13,0x40 CMP R13,qword ptr [RSP + 0x8] JNZ 0x00101387 MOV EDX,0x1 JMP 0x001013f2 LAB_001013df: MOV EDX,0x1 JMP 0x001013f2 LAB_001013e6: MOV EDX,0x0 JMP 0x001013f2 LAB_001013ed: MOV EDX,0x0 LAB_001013f2: MOV EAX,EDX ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int8 func0(void) { int iVar1; int iVar2; int8 uVar3; char *__s1; char *__s2; long lVar4; int in_stack_00001008; int in_stack_00002010; uVar3 = 0; if (in_stack_00001008 == in_stack_00002010) { if (in_stack_00001008 < 1) { uVar3 = 1; } else { lVar4 = 0; do { iVar1 = *(int *)(&stack0x00000044 + lVar4); if (iVar1 != *(int *)(&stack0x0000104c + lVar4)) { return 0; } if (0 < iVar1) { __s1 = &stack0x00000008 + lVar4; __s2 = &stack0x00001010 + lVar4; do { iVar2 = strcmp(__s1,__s2); if (iVar2 != 0) { return 0; } __s1 = __s1 + 10; __s2 = __s2 + 10; } while (__s1 != &stack0x00000012 + (ulong)(iVar1 - 1) * 10 + lVar4); } lVar4 = lVar4 + 0x40; } while (lVar4 != ((ulong)(in_stack_00001008 - 1) + 1) * 0x40); uVar3 = 1; } } return uVar3; }
5,742
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #define MAX_COMBINATIONS 64 #define MAX_ELEMENTS 6 #define MAX_STRING_LENGTH 10 typedef struct { char elements[MAX_ELEMENTS][MAX_STRING_LENGTH]; int size; } Combination; typedef struct { Combination combinations[MAX_COMBINATIONS]; int count; } CombinationList; // Function to generate combinations CombinationList combinations_list(char *list1[], int n) { CombinationList cl; cl.count = 0; int total = 1 << n; // 2^n combinations for(int i = 0; i < total; i++) { Combination comb; comb.size = 0; for(int j = 0; j < n; j++) { if(i & (1 << j)) { strcpy(comb.elements[comb.size++], list1[j]); } } cl.combinations[cl.count++] = comb; } return cl; } // Function to compare two CombinationLists
int func0(CombinationList a, CombinationList b) { if(a.count != b.count) return 0; for(int i = 0; i < a.count; i++) { if(a.combinations[i].size != b.combinations[i].size) return 0; for(int j = 0; j < a.combinations[i].size; j++) { if(strcmp(a.combinations[i].elements[j], b.combinations[i].elements[j]) != 0) return 0; } } return 1; }
int main() { // First assert char *list1[] = {"orange", "red", "green", "blue"}; CombinationList result1 = combinations_list(list1, 4); CombinationList expected1; expected1.count = 16; // [] expected1.combinations[0].size = 0; // ['orange'] strcpy(expected1.combinations[1].elements[0], "orange"); expected1.combinations[1].size = 1; // ['red'] strcpy(expected1.combinations[2].elements[0], "red"); expected1.combinations[2].size = 1; // ['red', 'orange'] strcpy(expected1.combinations[3].elements[0], "orange"); strcpy(expected1.combinations[3].elements[1], "red"); expected1.combinations[3].size = 2; // ['green'] strcpy(expected1.combinations[4].elements[0], "green"); expected1.combinations[4].size = 1; // ['green', 'orange'] strcpy(expected1.combinations[5].elements[0], "orange"); strcpy(expected1.combinations[5].elements[1], "green"); expected1.combinations[5].size = 2; // ['green', 'red'] strcpy(expected1.combinations[6].elements[0], "red"); strcpy(expected1.combinations[6].elements[1], "green"); expected1.combinations[6].size = 2; // ['green', 'red', 'orange'] strcpy(expected1.combinations[7].elements[0], "orange"); strcpy(expected1.combinations[7].elements[1], "red"); strcpy(expected1.combinations[7].elements[2], "green"); expected1.combinations[7].size = 3; // ['blue'] strcpy(expected1.combinations[8].elements[0], "blue"); expected1.combinations[8].size = 1; // ['blue', 'orange'] strcpy(expected1.combinations[9].elements[0], "orange"); strcpy(expected1.combinations[9].elements[1], "blue"); expected1.combinations[9].size = 2; // ['blue', 'red'] strcpy(expected1.combinations[10].elements[0], "red"); strcpy(expected1.combinations[10].elements[1], "blue"); expected1.combinations[10].size = 2; // ['blue', 'red', 'orange'] strcpy(expected1.combinations[11].elements[0], "orange"); strcpy(expected1.combinations[11].elements[1], "red"); strcpy(expected1.combinations[11].elements[2], "blue"); expected1.combinations[11].size = 3; // ['blue', 'green'] strcpy(expected1.combinations[12].elements[0], "green"); strcpy(expected1.combinations[12].elements[1], "blue"); expected1.combinations[12].size = 2; // ['blue', 'green', 'orange'] strcpy(expected1.combinations[13].elements[0], "orange"); strcpy(expected1.combinations[13].elements[1], "green"); strcpy(expected1.combinations[13].elements[2], "blue"); expected1.combinations[13].size = 3; // ['blue', 'green', 'red'] strcpy(expected1.combinations[14].elements[0], "red"); strcpy(expected1.combinations[14].elements[1], "green"); strcpy(expected1.combinations[14].elements[2], "blue"); expected1.combinations[14].size = 3; // ['blue', 'green', 'red', 'orange'] strcpy(expected1.combinations[15].elements[0], "orange"); strcpy(expected1.combinations[15].elements[1], "red"); strcpy(expected1.combinations[15].elements[2], "green"); strcpy(expected1.combinations[15].elements[3], "blue"); expected1.combinations[15].size = 4; assert(func0(result1, expected1)); // Second assert char *list2[] = {"red", "green", "blue", "white", "black", "orange"}; CombinationList result2 = combinations_list(list2, 6); CombinationList expected2; expected2.count = 64; // Due to length, this part is omitted. In practice, you would fill expected2 with all 64 combinations. // For brevity, we'll assume it's correctly filled. // You need to manually fill each combination as per the Python assert. // ... // Third assert char *list3[] = {"red", "green", "black", "orange"}; CombinationList result3 = combinations_list(list3, 4); CombinationList expected3; expected3.count = 16; // [] expected3.combinations[0].size = 0; // ['red'] strcpy(expected3.combinations[1].elements[0], "red"); expected3.combinations[1].size = 1; // ['green'] strcpy(expected3.combinations[2].elements[0], "green"); expected3.combinations[2].size = 1; // ['green', 'red'] strcpy(expected3.combinations[3].elements[0], "red"); strcpy(expected3.combinations[3].elements[1], "green"); expected3.combinations[3].size = 2; // ['black'] strcpy(expected3.combinations[4].elements[0], "black"); expected3.combinations[4].size = 1; // ['black', 'red'] strcpy(expected3.combinations[5].elements[0], "red"); strcpy(expected3.combinations[5].elements[1], "black"); expected3.combinations[5].size = 2; // ['black', 'green'] strcpy(expected3.combinations[6].elements[0], "green"); strcpy(expected3.combinations[6].elements[1], "black"); expected3.combinations[6].size = 2; // ['black', 'green', 'red'] strcpy(expected3.combinations[7].elements[0], "red"); strcpy(expected3.combinations[7].elements[1], "green"); strcpy(expected3.combinations[7].elements[2], "black"); expected3.combinations[7].size = 3; // ['orange'] strcpy(expected3.combinations[8].elements[0], "orange"); expected3.combinations[8].size = 1; // ['orange', 'red'] strcpy(expected3.combinations[9].elements[0], "red"); strcpy(expected3.combinations[9].elements[1], "orange"); expected3.combinations[9].size = 2; // ['orange', 'green'] strcpy(expected3.combinations[10].elements[0], "green"); strcpy(expected3.combinations[10].elements[1], "orange"); expected3.combinations[10].size = 2; // ['orange', 'green', 'red'] strcpy(expected3.combinations[11].elements[0], "red"); strcpy(expected3.combinations[11].elements[1], "green"); strcpy(expected3.combinations[11].elements[2], "orange"); expected3.combinations[11].size = 3; // ['orange', 'black'] strcpy(expected3.combinations[12].elements[0], "black"); strcpy(expected3.combinations[12].elements[1], "orange"); expected3.combinations[12].size = 2; // ['orange', 'black', 'red'] strcpy(expected3.combinations[13].elements[0], "red"); strcpy(expected3.combinations[13].elements[1], "black"); strcpy(expected3.combinations[13].elements[2], "orange"); expected3.combinations[13].size = 3; // ['orange', 'black', 'green'] strcpy(expected3.combinations[14].elements[0], "green"); strcpy(expected3.combinations[14].elements[1], "black"); strcpy(expected3.combinations[14].elements[2], "orange"); expected3.combinations[14].size = 3; // ['orange', 'black', 'green', 'red'] strcpy(expected3.combinations[15].elements[0], "red"); strcpy(expected3.combinations[15].elements[1], "green"); strcpy(expected3.combinations[15].elements[2], "black"); strcpy(expected3.combinations[15].elements[3], "orange"); expected3.combinations[15].size = 4; assert(func0(result3, expected3)); return 0; }
O2
c
func0: endbr64 push %r15 xor %r8d,%r8d push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov 0x1050(%rsp),%eax cmp 0x2058(%rsp),%eax jne 1d52 <func0+0xa2> test %eax,%eax jle 1d73 <func0+0xc3> lea -0x1(%rax),%r13d xor %r12d,%r12d lea 0x8c(%rsp),%r15 add $0x1,%r13 lea 0x1094(%rsp),%r14 lea 0x1058(%rsp),%rbx shl $0x6,%r13 mov %r13,0x8(%rsp) mov (%r15,%r12,1),%eax cmp (%r14,%r12,1),%eax jne 1d4f <func0+0x9f> test %eax,%eax jle 1d68 <func0+0xb8> sub $0x1,%eax mov %r12,%r13 lea (%rax,%rax,4),%rax lea 0xa(%r12,%rax,2),%rbp jmp 1d39 <func0+0x89> nopl 0x0(%rax,%rax,1) add $0xa,%r13 cmp %r13,%rbp je 1d68 <func0+0xb8> lea 0x50(%rsp),%rax lea (%rbx,%r13,1),%rsi lea (%rax,%r13,1),%rdi callq 10b0 <strcmp@plt> test %eax,%eax je 1d30 <func0+0x80> xor %r8d,%r8d add $0x18,%rsp mov %r8d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) add $0x40,%r12 cmp 0x8(%rsp),%r12 jne 1d09 <func0+0x59> mov $0x1,%r8d jmp 1d52 <func0+0xa2> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r15 xor eax, eax push r14 push r13 push r12 push rbp push rbx sub rsp, 18h movsxd r13, [rsp+48h+arg_1000] cmp r13d, [rsp+48h+arg_2008] jnz short loc_1CF8 test r13d, r13d jle loc_1D1B shl r13, 6 xor r12d, r12d lea r15, [rsp+48h+arg_3C] mov [rsp+48h+var_40], r13 lea r14, [rsp+48h+arg_1044] lea rbx, [rsp+48h+arg_1008] loc_1CB3: mov eax, [r15+r12] cmp eax, [r14+r12] jnz short loc_1CF6 test eax, eax jle short loc_1D10 sub eax, 1 mov r13, r12 lea rax, [rax+rax*4] lea rbp, [r12+rax*2+0Ah] jmp short loc_1CE1 loc_1CD8: add r13, 0Ah cmp r13, rbp jz short loc_1D10 loc_1CE1: lea rax, [r13+50h] lea rsi, [rbx+r13] lea rdi, [rsp+rax+48h+var_48] call _strcmp test eax, eax jz short loc_1CD8 loc_1CF6: xor eax, eax loc_1CF8: add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1D10: add r12, 40h ; '@' cmp r12, [rsp+48h+var_40] jnz short loc_1CB3 loc_1D1B: mov eax, 1 jmp short loc_1CF8
long long func0( long long a1, long long a2, long long a3, long long a4, long long a5, long long a6, long long a7, long long a8, long long a9, long long a10, long long a11, long long a12, long long a13, long long a14) { long long result; // rax long long v15; // r13 long long v16; // r12 int v17; // eax long long v18; // r13 long long v19; // rbp _BYTE v20[8]; // [rsp+0h] [rbp-48h] BYREF long long v21; // [rsp+8h] [rbp-40h] result = 0LL; v15 = SLODWORD(STACK[0x1050]); if ( (_DWORD)v15 == LODWORD(STACK[0x2058]) ) { if ( (int)v15 <= 0 ) { return 1LL; } else { v16 = 0LL; v21 = v15 << 6; while ( 1 ) { v17 = *(_DWORD *)((char *)&a14 + v16 + 4); if ( v17 != *(_DWORD *)((char *)&STACK[0x1094] + v16) ) return 0LL; if ( v17 > 0 ) { v18 = v16; v19 = v16 + 10LL * (unsigned int)(v17 - 1) + 10; while ( !(unsigned int)strcmp(&v20[v18 + 80], (char *)&STACK[0x1058] + v18) ) { v18 += 10LL; if ( v18 == v19 ) goto LABEL_11; } return 0LL; } LABEL_11: v16 += 64LL; if ( v16 == v21 ) return 1LL; } } } return result; }
func0: ENDBR64 PUSH R15 XOR EAX,EAX PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOVSXD R13,dword ptr [RSP + 0x1050] CMP R13D,dword ptr [RSP + 0x2058] JNZ 0x00101cf8 TEST R13D,R13D JLE 0x00101d1b SHL R13,0x6 XOR R12D,R12D LEA R15,[RSP + 0x8c] MOV qword ptr [RSP + 0x8],R13 LEA R14,[RSP + 0x1094] LEA RBX,[RSP + 0x1058] LAB_00101cb3: MOV EAX,dword ptr [R15 + R12*0x1] CMP EAX,dword ptr [R14 + R12*0x1] JNZ 0x00101cf6 TEST EAX,EAX JLE 0x00101d10 SUB EAX,0x1 MOV R13,R12 LEA RAX,[RAX + RAX*0x4] LEA RBP,[R12 + RAX*0x2 + 0xa] JMP 0x00101ce1 LAB_00101cd8: ADD R13,0xa CMP R13,RBP JZ 0x00101d10 LAB_00101ce1: LEA RAX,[R13 + 0x50] LEA RSI,[RBX + R13*0x1] LEA RDI,[RSP + RAX*0x1] CALL 0x001010b0 TEST EAX,EAX JZ 0x00101cd8 LAB_00101cf6: XOR EAX,EAX LAB_00101cf8: ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101d10: ADD R12,0x40 CMP R12,qword ptr [RSP + 0x8] JNZ 0x00101cb3 LAB_00101d1b: MOV EAX,0x1 JMP 0x00101cf8
int8 func0(void) { int iVar1; int iVar2; int8 uVar3; long lVar4; long lVar5; int in_stack_00001008; int in_stack_00002010; uVar3 = 0; if (in_stack_00001008 == in_stack_00002010) { if (0 < in_stack_00001008) { lVar4 = 0; do { iVar1 = *(int *)(&stack0x00000044 + lVar4); if (iVar1 != *(int *)(&stack0x0000104c + lVar4)) { return 0; } if (0 < iVar1) { lVar5 = lVar4; do { iVar2 = strcmp(&stack0x00000008 + lVar5,&stack0x00001010 + lVar5); if (iVar2 != 0) { return 0; } lVar5 = lVar5 + 10; } while (lVar5 != lVar4 + 10 + (ulong)(iVar1 - 1) * 10); } lVar4 = lVar4 + 0x40; } while (lVar4 != (long)in_stack_00001008 << 6); } uVar3 = 1; } return uVar3; }
5,743
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #define MAX_COMBINATIONS 64 #define MAX_ELEMENTS 6 #define MAX_STRING_LENGTH 10 typedef struct { char elements[MAX_ELEMENTS][MAX_STRING_LENGTH]; int size; } Combination; typedef struct { Combination combinations[MAX_COMBINATIONS]; int count; } CombinationList; // Function to generate combinations CombinationList combinations_list(char *list1[], int n) { CombinationList cl; cl.count = 0; int total = 1 << n; // 2^n combinations for(int i = 0; i < total; i++) { Combination comb; comb.size = 0; for(int j = 0; j < n; j++) { if(i & (1 << j)) { strcpy(comb.elements[comb.size++], list1[j]); } } cl.combinations[cl.count++] = comb; } return cl; } // Function to compare two CombinationLists
int func0(CombinationList a, CombinationList b) { if(a.count != b.count) return 0; for(int i = 0; i < a.count; i++) { if(a.combinations[i].size != b.combinations[i].size) return 0; for(int j = 0; j < a.combinations[i].size; j++) { if(strcmp(a.combinations[i].elements[j], b.combinations[i].elements[j]) != 0) return 0; } } return 1; }
int main() { // First assert char *list1[] = {"orange", "red", "green", "blue"}; CombinationList result1 = combinations_list(list1, 4); CombinationList expected1; expected1.count = 16; // [] expected1.combinations[0].size = 0; // ['orange'] strcpy(expected1.combinations[1].elements[0], "orange"); expected1.combinations[1].size = 1; // ['red'] strcpy(expected1.combinations[2].elements[0], "red"); expected1.combinations[2].size = 1; // ['red', 'orange'] strcpy(expected1.combinations[3].elements[0], "orange"); strcpy(expected1.combinations[3].elements[1], "red"); expected1.combinations[3].size = 2; // ['green'] strcpy(expected1.combinations[4].elements[0], "green"); expected1.combinations[4].size = 1; // ['green', 'orange'] strcpy(expected1.combinations[5].elements[0], "orange"); strcpy(expected1.combinations[5].elements[1], "green"); expected1.combinations[5].size = 2; // ['green', 'red'] strcpy(expected1.combinations[6].elements[0], "red"); strcpy(expected1.combinations[6].elements[1], "green"); expected1.combinations[6].size = 2; // ['green', 'red', 'orange'] strcpy(expected1.combinations[7].elements[0], "orange"); strcpy(expected1.combinations[7].elements[1], "red"); strcpy(expected1.combinations[7].elements[2], "green"); expected1.combinations[7].size = 3; // ['blue'] strcpy(expected1.combinations[8].elements[0], "blue"); expected1.combinations[8].size = 1; // ['blue', 'orange'] strcpy(expected1.combinations[9].elements[0], "orange"); strcpy(expected1.combinations[9].elements[1], "blue"); expected1.combinations[9].size = 2; // ['blue', 'red'] strcpy(expected1.combinations[10].elements[0], "red"); strcpy(expected1.combinations[10].elements[1], "blue"); expected1.combinations[10].size = 2; // ['blue', 'red', 'orange'] strcpy(expected1.combinations[11].elements[0], "orange"); strcpy(expected1.combinations[11].elements[1], "red"); strcpy(expected1.combinations[11].elements[2], "blue"); expected1.combinations[11].size = 3; // ['blue', 'green'] strcpy(expected1.combinations[12].elements[0], "green"); strcpy(expected1.combinations[12].elements[1], "blue"); expected1.combinations[12].size = 2; // ['blue', 'green', 'orange'] strcpy(expected1.combinations[13].elements[0], "orange"); strcpy(expected1.combinations[13].elements[1], "green"); strcpy(expected1.combinations[13].elements[2], "blue"); expected1.combinations[13].size = 3; // ['blue', 'green', 'red'] strcpy(expected1.combinations[14].elements[0], "red"); strcpy(expected1.combinations[14].elements[1], "green"); strcpy(expected1.combinations[14].elements[2], "blue"); expected1.combinations[14].size = 3; // ['blue', 'green', 'red', 'orange'] strcpy(expected1.combinations[15].elements[0], "orange"); strcpy(expected1.combinations[15].elements[1], "red"); strcpy(expected1.combinations[15].elements[2], "green"); strcpy(expected1.combinations[15].elements[3], "blue"); expected1.combinations[15].size = 4; assert(func0(result1, expected1)); // Second assert char *list2[] = {"red", "green", "blue", "white", "black", "orange"}; CombinationList result2 = combinations_list(list2, 6); CombinationList expected2; expected2.count = 64; // Due to length, this part is omitted. In practice, you would fill expected2 with all 64 combinations. // For brevity, we'll assume it's correctly filled. // You need to manually fill each combination as per the Python assert. // ... // Third assert char *list3[] = {"red", "green", "black", "orange"}; CombinationList result3 = combinations_list(list3, 4); CombinationList expected3; expected3.count = 16; // [] expected3.combinations[0].size = 0; // ['red'] strcpy(expected3.combinations[1].elements[0], "red"); expected3.combinations[1].size = 1; // ['green'] strcpy(expected3.combinations[2].elements[0], "green"); expected3.combinations[2].size = 1; // ['green', 'red'] strcpy(expected3.combinations[3].elements[0], "red"); strcpy(expected3.combinations[3].elements[1], "green"); expected3.combinations[3].size = 2; // ['black'] strcpy(expected3.combinations[4].elements[0], "black"); expected3.combinations[4].size = 1; // ['black', 'red'] strcpy(expected3.combinations[5].elements[0], "red"); strcpy(expected3.combinations[5].elements[1], "black"); expected3.combinations[5].size = 2; // ['black', 'green'] strcpy(expected3.combinations[6].elements[0], "green"); strcpy(expected3.combinations[6].elements[1], "black"); expected3.combinations[6].size = 2; // ['black', 'green', 'red'] strcpy(expected3.combinations[7].elements[0], "red"); strcpy(expected3.combinations[7].elements[1], "green"); strcpy(expected3.combinations[7].elements[2], "black"); expected3.combinations[7].size = 3; // ['orange'] strcpy(expected3.combinations[8].elements[0], "orange"); expected3.combinations[8].size = 1; // ['orange', 'red'] strcpy(expected3.combinations[9].elements[0], "red"); strcpy(expected3.combinations[9].elements[1], "orange"); expected3.combinations[9].size = 2; // ['orange', 'green'] strcpy(expected3.combinations[10].elements[0], "green"); strcpy(expected3.combinations[10].elements[1], "orange"); expected3.combinations[10].size = 2; // ['orange', 'green', 'red'] strcpy(expected3.combinations[11].elements[0], "red"); strcpy(expected3.combinations[11].elements[1], "green"); strcpy(expected3.combinations[11].elements[2], "orange"); expected3.combinations[11].size = 3; // ['orange', 'black'] strcpy(expected3.combinations[12].elements[0], "black"); strcpy(expected3.combinations[12].elements[1], "orange"); expected3.combinations[12].size = 2; // ['orange', 'black', 'red'] strcpy(expected3.combinations[13].elements[0], "red"); strcpy(expected3.combinations[13].elements[1], "black"); strcpy(expected3.combinations[13].elements[2], "orange"); expected3.combinations[13].size = 3; // ['orange', 'black', 'green'] strcpy(expected3.combinations[14].elements[0], "green"); strcpy(expected3.combinations[14].elements[1], "black"); strcpy(expected3.combinations[14].elements[2], "orange"); expected3.combinations[14].size = 3; // ['orange', 'black', 'green', 'red'] strcpy(expected3.combinations[15].elements[0], "red"); strcpy(expected3.combinations[15].elements[1], "green"); strcpy(expected3.combinations[15].elements[2], "black"); strcpy(expected3.combinations[15].elements[3], "orange"); expected3.combinations[15].size = 4; assert(func0(result3, expected3)); return 0; }
O3
c
func0: endbr64 push %r15 xor %r8d,%r8d push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov 0x1050(%rsp),%eax cmp 0x2058(%rsp),%eax jne 1d62 <func0+0xa2> test %eax,%eax jle 1d83 <func0+0xc3> lea -0x1(%rax),%r13d xor %r12d,%r12d lea 0x8c(%rsp),%r15 add $0x1,%r13 lea 0x1094(%rsp),%r14 lea 0x1058(%rsp),%rbx shl $0x6,%r13 mov %r13,0x8(%rsp) mov (%r15,%r12,1),%eax cmp (%r14,%r12,1),%eax jne 1d5f <func0+0x9f> test %eax,%eax jle 1d78 <func0+0xb8> sub $0x1,%eax mov %r12,%r13 lea (%rax,%rax,4),%rax lea 0xa(%r12,%rax,2),%rbp jmp 1d49 <func0+0x89> nopl 0x0(%rax,%rax,1) add $0xa,%r13 cmp %r13,%rbp je 1d78 <func0+0xb8> lea 0x50(%rsp),%rax lea (%rbx,%r13,1),%rsi lea (%rax,%r13,1),%rdi callq 10b0 <strcmp@plt> test %eax,%eax je 1d40 <func0+0x80> xor %r8d,%r8d add $0x18,%rsp mov %r8d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) add $0x40,%r12 cmp 0x8(%rsp),%r12 jne 1d19 <func0+0x59> mov $0x1,%r8d jmp 1d62 <func0+0xa2> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r15 xor eax, eax push r14 push r13 push r12 push rbp push rbx sub rsp, 18h movsxd r13, [rsp+48h+arg_1000] cmp r13d, [rsp+48h+arg_2008] jnz short loc_1CA0 test r13d, r13d jle loc_1CBB shl r13, 6 xor r12d, r12d lea r15, [rsp+48h+arg_3C] mov [rsp+48h+var_40], r13 lea r14, [rsp+48h+arg_1044] lea rbx, [rsp+48h+arg_1008] loc_1C63: movsxd rax, dword ptr [r15+r12] cmp eax, [r14+r12] jnz short loc_1C9E test eax, eax jle short loc_1CB0 lea rax, [rax+rax*4] mov r13, r12 lea rbp, [r12+rax*2] jmp short loc_1C89 loc_1C80: add r13, 0Ah cmp rbp, r13 jz short loc_1CB0 loc_1C89: lea rax, [r13+50h] lea rsi, [rbx+r13]; s2 lea rdi, [rsp+rax+48h+s1]; s1 call _strcmp test eax, eax jz short loc_1C80 loc_1C9E: xor eax, eax loc_1CA0: add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1CB0: add r12, 40h ; '@' cmp [rsp+48h+var_40], r12 jnz short loc_1C63 loc_1CBB: mov eax, 1 jmp short loc_1CA0
long long func0( long long a1, long long a2, long long a3, long long a4, long long a5, long long a6, long long a7, long long a8, long long a9, long long a10, long long a11, long long a12, long long a13, long long a14) { long long result; // rax long long v15; // r13 long long v16; // r12 long long v17; // rax long long v18; // r13 long long v19; // rbp char s1[8]; // [rsp+0h] [rbp-48h] BYREF long long v21; // [rsp+8h] [rbp-40h] result = 0LL; v15 = SLODWORD(STACK[0x1050]); if ( (_DWORD)v15 == LODWORD(STACK[0x2058]) ) { if ( (int)v15 <= 0 ) { return 1LL; } else { v16 = 0LL; v21 = v15 << 6; while ( 1 ) { v17 = *(int *)((char *)&a14 + v16 + 4); if ( (_DWORD)v17 != *(_DWORD *)((char *)&STACK[0x1094] + v16) ) return 0LL; if ( (int)v17 > 0 ) { v18 = v16; v19 = v16 + 10 * v17; while ( !strcmp(&s1[v18 + 80], (const char *)&STACK[0x1058] + v18) ) { v18 += 10LL; if ( v19 == v18 ) goto LABEL_11; } return 0LL; } LABEL_11: v16 += 64LL; if ( v21 == v16 ) return 1LL; } } } return result; }
func0: ENDBR64 PUSH R15 XOR EAX,EAX PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOVSXD R13,dword ptr [RSP + 0x1050] CMP R13D,dword ptr [RSP + 0x2058] JNZ 0x00101ca0 TEST R13D,R13D JLE 0x00101cbb SHL R13,0x6 XOR R12D,R12D LEA R15,[RSP + 0x8c] MOV qword ptr [RSP + 0x8],R13 LEA R14,[RSP + 0x1094] LEA RBX,[RSP + 0x1058] LAB_00101c63: MOVSXD RAX,dword ptr [R15 + R12*0x1] CMP EAX,dword ptr [R14 + R12*0x1] JNZ 0x00101c9e TEST EAX,EAX JLE 0x00101cb0 LEA RAX,[RAX + RAX*0x4] MOV R13,R12 LEA RBP,[R12 + RAX*0x2] JMP 0x00101c89 LAB_00101c80: ADD R13,0xa CMP RBP,R13 JZ 0x00101cb0 LAB_00101c89: LEA RAX,[R13 + 0x50] LEA RSI,[RBX + R13*0x1] LEA RDI,[RSP + RAX*0x1] CALL 0x001010a0 TEST EAX,EAX JZ 0x00101c80 LAB_00101c9e: XOR EAX,EAX LAB_00101ca0: ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101cb0: ADD R12,0x40 CMP qword ptr [RSP + 0x8],R12 JNZ 0x00101c63 LAB_00101cbb: MOV EAX,0x1 JMP 0x00101ca0
int8 func0(void) { int iVar1; int iVar2; int8 uVar3; long lVar4; long lVar5; int in_stack_00001008; int in_stack_00002010; uVar3 = 0; if (in_stack_00001008 == in_stack_00002010) { if (0 < in_stack_00001008) { lVar4 = 0; do { iVar1 = *(int *)(&stack0x00000044 + lVar4); if (iVar1 != *(int *)(&stack0x0000104c + lVar4)) { return 0; } if (0 < iVar1) { lVar5 = lVar4; do { iVar2 = strcmp(&stack0x00000008 + lVar5,&stack0x00001010 + lVar5); if (iVar2 != 0) { return 0; } lVar5 = lVar5 + 10; } while (lVar4 + (long)iVar1 * 10 != lVar5); } lVar4 = lVar4 + 0x40; } while ((long)in_stack_00001008 << 6 != lVar4); } uVar3 = 1; } return uVar3; }
5,744
func0
#include <stdio.h> #include <assert.h>
int func0(int arr[], int n) { int max_ending_here = 1; int min_ending_here = 1; int max_so_far = 0; int flag = 0; for (int i = 0; i < n; i++) { if (arr[i] > 0) { max_ending_here = max_ending_here * arr[i]; min_ending_here = (min_ending_here * arr[i] < 1) ? min_ending_here * arr[i] : 1; flag = 1; } else if (arr[i] == 0) { max_ending_here = 1; min_ending_here = 1; } else { int temp = max_ending_here; max_ending_here = (min_ending_here * arr[i] > 1) ? min_ending_here * arr[i] : 1; min_ending_here = temp * arr[i]; } if (max_so_far < max_ending_here) { max_so_far = max_ending_here; } } if (flag == 0 && max_so_far == 0) { return 0; } return max_so_far; }
int main() { int arr1[] = {1, -2, -3, 0, 7, -8, -2}; int n1 = sizeof(arr1) / sizeof(arr1[0]); assert(func0(arr1, n1) == 112); int arr2[] = {6, -3, -10, 0, 2}; int n2 = sizeof(arr2) / sizeof(arr2[0]); assert(func0(arr2, n2) == 180); int arr3[] = {-2, -40, 0, -2, -3}; int n3 = sizeof(arr3) / sizeof(arr3[0]); assert(func0(arr3, n3) == 80); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x28(%rbp) mov %esi,-0x2c(%rbp) movl $0x1,-0x18(%rbp) movl $0x1,-0x14(%rbp) movl $0x0,-0x10(%rbp) movl $0x0,-0xc(%rbp) movl $0x0,-0x8(%rbp) jmpq 1291 <func0+0x128> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%eax test %eax,%eax jle 1209 <func0+0xa0> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov -0x18(%rbp),%edx imul %edx,%eax mov %eax,-0x18(%rbp) mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%eax imul -0x14(%rbp),%eax mov $0x1,%edx test %eax,%eax cmovg %edx,%eax mov %eax,-0x14(%rbp) movl $0x1,-0xc(%rbp) jmp 127f <func0+0x116> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%eax test %eax,%eax jne 1233 <func0+0xca> movl $0x1,-0x18(%rbp) movl $0x1,-0x14(%rbp) jmp 127f <func0+0x116> mov -0x18(%rbp),%eax mov %eax,-0x4(%rbp) mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%eax imul -0x14(%rbp),%eax mov $0x1,%edx test %eax,%eax cmovle %edx,%eax mov %eax,-0x18(%rbp) mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov -0x4(%rbp),%edx imul %edx,%eax mov %eax,-0x14(%rbp) mov -0x10(%rbp),%eax cmp -0x18(%rbp),%eax jge 128d <func0+0x124> mov -0x18(%rbp),%eax mov %eax,-0x10(%rbp) addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x2c(%rbp),%eax jl 11a0 <func0+0x37> cmpl $0x0,-0xc(%rbp) jne 12b0 <func0+0x147> cmpl $0x0,-0x10(%rbp) jne 12b0 <func0+0x147> mov $0x0,%eax jmp 12b3 <func0+0x14a> mov -0x10(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_28], rdi mov [rbp+var_2C], esi mov [rbp+var_18], 1 mov [rbp+var_14], 1 mov [rbp+var_10], 0 mov [rbp+var_C], 0 mov [rbp+var_8], 0 jmp loc_1291 loc_11A0: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rdx mov eax, [rax] test eax, eax jle short loc_1209 mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rdx mov eax, [rax] mov edx, [rbp+var_18] imul eax, edx mov [rbp+var_18], eax mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rdx mov eax, [rax] imul eax, [rbp+var_14] mov edx, 1 test eax, eax cmovg eax, edx mov [rbp+var_14], eax mov [rbp+var_C], 1 jmp short loc_127F loc_1209: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rdx mov eax, [rax] test eax, eax jnz short loc_1233 mov [rbp+var_18], 1 mov [rbp+var_14], 1 jmp short loc_127F loc_1233: mov eax, [rbp+var_18] mov [rbp+var_4], eax mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rdx mov eax, [rax] imul eax, [rbp+var_14] mov edx, 1 test eax, eax cmovle eax, edx mov [rbp+var_18], eax mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rdx mov eax, [rax] mov edx, [rbp+var_4] imul eax, edx mov [rbp+var_14], eax loc_127F: mov eax, [rbp+var_10] cmp eax, [rbp+var_18] jge short loc_128D mov eax, [rbp+var_18] mov [rbp+var_10], eax loc_128D: add [rbp+var_8], 1 loc_1291: mov eax, [rbp+var_8] cmp eax, [rbp+var_2C] jl loc_11A0 cmp [rbp+var_C], 0 jnz short loc_12B0 cmp [rbp+var_10], 0 jnz short loc_12B0 mov eax, 0 jmp short loc_12B3 loc_12B0: mov eax, [rbp+var_10] loc_12B3: pop rbp retn
long long func0(long long a1, int a2) { int v2; // eax int v3; // eax int v5; // [rsp+14h] [rbp-18h] int v6; // [rsp+18h] [rbp-14h] int v7; // [rsp+1Ch] [rbp-10h] int v8; // [rsp+20h] [rbp-Ch] int i; // [rsp+24h] [rbp-8h] int v10; // [rsp+28h] [rbp-4h] v5 = 1; v6 = 1; v7 = 0; v8 = 0; for ( i = 0; i < a2; ++i ) { if ( *(int *)(4LL * i + a1) <= 0 ) { if ( *(_DWORD *)(4LL * i + a1) ) { v10 = v5; v3 = v6 * *(_DWORD *)(4LL * i + a1); if ( v3 <= 0 ) v3 = 1; v5 = v3; v6 = v10 * *(_DWORD *)(4LL * i + a1); } else { v5 = 1; v6 = 1; } } else { v5 *= *(_DWORD *)(4LL * i + a1); v2 = v6 * *(_DWORD *)(4LL * i + a1); if ( v2 > 0 ) v2 = 1; v6 = v2; v8 = 1; } if ( v7 < v5 ) v7 = v5; } if ( v8 || v7 ) return (unsigned int)v7; else return 0LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x2c],ESI MOV dword ptr [RBP + -0x18],0x1 MOV dword ptr [RBP + -0x14],0x1 MOV dword ptr [RBP + -0x10],0x0 MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x8],0x0 JMP 0x00101291 LAB_001011a0: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JLE 0x00101209 MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV EDX,dword ptr [RBP + -0x18] IMUL EAX,EDX MOV dword ptr [RBP + -0x18],EAX MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EAX,dword ptr [RAX] IMUL EAX,dword ptr [RBP + -0x14] MOV EDX,0x1 TEST EAX,EAX CMOVG EAX,EDX MOV dword ptr [RBP + -0x14],EAX MOV dword ptr [RBP + -0xc],0x1 JMP 0x0010127f LAB_00101209: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JNZ 0x00101233 MOV dword ptr [RBP + -0x18],0x1 MOV dword ptr [RBP + -0x14],0x1 JMP 0x0010127f LAB_00101233: MOV EAX,dword ptr [RBP + -0x18] MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EAX,dword ptr [RAX] IMUL EAX,dword ptr [RBP + -0x14] MOV EDX,0x1 TEST EAX,EAX CMOVLE EAX,EDX MOV dword ptr [RBP + -0x18],EAX MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV EDX,dword ptr [RBP + -0x4] IMUL EAX,EDX MOV dword ptr [RBP + -0x14],EAX LAB_0010127f: MOV EAX,dword ptr [RBP + -0x10] CMP EAX,dword ptr [RBP + -0x18] JGE 0x0010128d MOV EAX,dword ptr [RBP + -0x18] MOV dword ptr [RBP + -0x10],EAX LAB_0010128d: ADD dword ptr [RBP + -0x8],0x1 LAB_00101291: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x2c] JL 0x001011a0 CMP dword ptr [RBP + -0xc],0x0 JNZ 0x001012b0 CMP dword ptr [RBP + -0x10],0x0 JNZ 0x001012b0 MOV EAX,0x0 JMP 0x001012b3 LAB_001012b0: MOV EAX,dword ptr [RBP + -0x10] LAB_001012b3: POP RBP RET
int func0(long param_1,int param_2) { bool bVar1; int iVar2; int local_20; int local_1c; int local_18; int local_10; local_20 = 1; local_1c = 1; local_18 = 0; bVar1 = false; for (local_10 = 0; local_10 < param_2; local_10 = local_10 + 1) { if (*(int *)(param_1 + (long)local_10 * 4) < 1) { if (*(int *)(param_1 + (long)local_10 * 4) == 0) { local_20 = 1; local_1c = 1; } else { iVar2 = *(int *)(param_1 + (long)local_10 * 4) * local_1c; if (iVar2 < 1) { iVar2 = 1; } local_1c = *(int *)(param_1 + (long)local_10 * 4) * local_20; local_20 = iVar2; } } else { local_1c = *(int *)(param_1 + (long)local_10 * 4) * local_1c; if (0 < local_1c) { local_1c = 1; } bVar1 = true; local_20 = *(int *)(param_1 + (long)local_10 * 4) * local_20; } if (local_18 < local_20) { local_18 = local_20; } } if ((!bVar1) && (local_18 == 0)) { local_18 = 0; } return local_18; }
5,745
func0
#include <stdio.h> #include <assert.h>
int func0(int arr[], int n) { int max_ending_here = 1; int min_ending_here = 1; int max_so_far = 0; int flag = 0; for (int i = 0; i < n; i++) { if (arr[i] > 0) { max_ending_here = max_ending_here * arr[i]; min_ending_here = (min_ending_here * arr[i] < 1) ? min_ending_here * arr[i] : 1; flag = 1; } else if (arr[i] == 0) { max_ending_here = 1; min_ending_here = 1; } else { int temp = max_ending_here; max_ending_here = (min_ending_here * arr[i] > 1) ? min_ending_here * arr[i] : 1; min_ending_here = temp * arr[i]; } if (max_so_far < max_ending_here) { max_so_far = max_ending_here; } } if (flag == 0 && max_so_far == 0) { return 0; } return max_so_far; }
int main() { int arr1[] = {1, -2, -3, 0, 7, -8, -2}; int n1 = sizeof(arr1) / sizeof(arr1[0]); assert(func0(arr1, n1) == 112); int arr2[] = {6, -3, -10, 0, 2}; int n2 = sizeof(arr2) / sizeof(arr2[0]); assert(func0(arr2, n2) == 180); int arr3[] = {-2, -40, 0, -2, -3}; int n3 = sizeof(arr3) / sizeof(arr3[0]); assert(func0(arr3, n3) == 80); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11ea <func0+0x81> mov %rdi,%rax lea -0x1(%rsi),%edx lea 0x4(%rdi,%rdx,4),%r10 mov $0x0,%r9d mov $0x0,%esi mov $0x1,%edi mov $0x1,%ecx mov $0x1,%r8d jmp 11bd <func0+0x54> je 11d6 <func0+0x6d> imul %edx,%edi mov %edi,%r11d test %edi,%edi cmovle %r8d,%r11d mov %edx,%edi imul %ecx,%edi mov %r11d,%ecx cmp %ecx,%esi cmovl %ecx,%esi add $0x4,%rax cmp %r10,%rax je 11e0 <func0+0x77> mov (%rax),%edx test %edx,%edx jle 1199 <func0+0x30> imul %edx,%ecx imul %edi,%edx test %edx,%edx mov %edx,%edi cmovg %r8d,%edi mov %r8d,%r9d jmp 11af <func0+0x46> mov %r8d,%edi mov $0x1,%ecx jmp 11af <func0+0x46> or %esi,%r9d cmove %r9d,%esi mov %esi,%eax retq mov $0x0,%esi jmp 11e7 <func0+0x7e>
func0: endbr64 test esi, esi jle short loc_11EF mov rdx, rdi lea eax, [rsi-1] lea r9, [rdi+rax*4+4] mov r8d, 0 mov esi, 0 mov edi, 1 mov eax, 1 mov r10d, 1 jmp short loc_11BA loc_1199: imul eax, ecx imul edi, ecx test edi, edi mov ecx, 1 cmovg edi, ecx mov r8d, r10d loc_11AC: cmp esi, eax cmovl esi, eax add rdx, 4 cmp rdx, r9 jz short loc_11E5 loc_11BA: mov ecx, [rdx] test ecx, ecx jg short loc_1199 jz short loc_11DB imul edi, ecx mov r11d, edi mov edi, ecx imul edi, eax test r11d, r11d mov eax, 1 cmovg eax, r11d jmp short loc_11AC loc_11DB: mov edi, r10d mov eax, 1 jmp short loc_11AC loc_11E5: or r8d, esi cmovz esi, r8d loc_11EC: mov eax, esi retn loc_11EF: mov esi, 0 jmp short loc_11EC
long long func0(int *a1, int a2) { int *v2; // rdx long long v3; // r9 int v4; // r8d int v5; // esi int v6; // edi int v7; // eax int v8; // ecx int v9; // r11d if ( a2 <= 0 ) { return 0; } else { v2 = a1; v3 = (long long)&a1[a2 - 1 + 1]; v4 = 0; v5 = 0; v6 = 1; v7 = 1; do { v8 = *v2; if ( *v2 > 0 ) { v7 *= v8; v6 *= v8; if ( v6 > 0 ) v6 = 1; v4 = 1; } else if ( v8 ) { v9 = v8 * v6; v6 = v7 * v8; v7 = 1; if ( v9 > 0 ) v7 = v9; } else { v6 = 1; v7 = 1; } if ( v5 < v7 ) v5 = v7; ++v2; } while ( v2 != (int *)v3 ); if ( !(v5 | v4) ) return 0; } return (unsigned int)v5; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001011ef MOV RDX,RDI LEA EAX,[RSI + -0x1] LEA R9,[RDI + RAX*0x4 + 0x4] MOV R8D,0x0 MOV ESI,0x0 MOV EDI,0x1 MOV EAX,0x1 MOV R10D,0x1 JMP 0x001011ba LAB_00101199: IMUL EAX,ECX IMUL EDI,ECX TEST EDI,EDI MOV ECX,0x1 CMOVG EDI,ECX MOV R8D,R10D LAB_001011ac: CMP ESI,EAX CMOVL ESI,EAX ADD RDX,0x4 CMP RDX,R9 JZ 0x001011e5 LAB_001011ba: MOV ECX,dword ptr [RDX] TEST ECX,ECX JG 0x00101199 JZ 0x001011db IMUL EDI,ECX MOV R11D,EDI MOV EDI,ECX IMUL EDI,EAX TEST R11D,R11D MOV EAX,0x1 CMOVG EAX,R11D JMP 0x001011ac LAB_001011db: MOV EDI,R10D MOV EAX,0x1 JMP 0x001011ac LAB_001011e5: OR R8D,ESI CMOVZ ESI,R8D LAB_001011ec: MOV EAX,ESI RET LAB_001011ef: MOV ESI,0x0 JMP 0x001011ec
int func0(int *param_1,int param_2) { int *piVar1; int iVar2; bool bVar3; int iVar4; int iVar5; int iVar6; int iVar7; if (param_2 < 1) { iVar5 = 0; } else { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; bVar3 = false; iVar5 = 0; iVar7 = 1; iVar4 = 1; do { iVar2 = *param_1; if (iVar2 < 1) { if (iVar2 == 0) { iVar7 = 1; iVar4 = 1; } else { iVar6 = iVar7 * iVar2; iVar7 = iVar2 * iVar4; iVar4 = 1; if (0 < iVar6) { iVar4 = iVar6; } } } else { iVar7 = iVar7 * iVar2; if (0 < iVar7) { iVar7 = 1; } bVar3 = true; iVar4 = iVar4 * iVar2; } if (iVar5 < iVar4) { iVar5 = iVar4; } param_1 = param_1 + 1; } while (param_1 != piVar1); if (!bVar3 && iVar5 == 0) { iVar5 = 0; } } return iVar5; }
5,746
func0
#include <stdio.h> #include <assert.h>
int func0(int arr[], int n) { int max_ending_here = 1; int min_ending_here = 1; int max_so_far = 0; int flag = 0; for (int i = 0; i < n; i++) { if (arr[i] > 0) { max_ending_here = max_ending_here * arr[i]; min_ending_here = (min_ending_here * arr[i] < 1) ? min_ending_here * arr[i] : 1; flag = 1; } else if (arr[i] == 0) { max_ending_here = 1; min_ending_here = 1; } else { int temp = max_ending_here; max_ending_here = (min_ending_here * arr[i] > 1) ? min_ending_here * arr[i] : 1; min_ending_here = temp * arr[i]; } if (max_so_far < max_ending_here) { max_so_far = max_ending_here; } } if (flag == 0 && max_so_far == 0) { return 0; } return max_so_far; }
int main() { int arr1[] = {1, -2, -3, 0, 7, -8, -2}; int n1 = sizeof(arr1) / sizeof(arr1[0]); assert(func0(arr1, n1) == 112); int arr2[] = {6, -3, -10, 0, 2}; int n2 = sizeof(arr2) / sizeof(arr2[0]); assert(func0(arr2, n2) == 180); int arr3[] = {-2, -40, 0, -2, -3}; int n3 = sizeof(arr3) / sizeof(arr3[0]); assert(func0(arr3, n3) == 80); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1350 <func0+0x90> lea -0x1(%rsi),%eax xor %r8d,%r8d mov $0x1,%edx mov $0x1,%r10d lea 0x4(%rdi,%rax,4),%rsi mov $0x1,%eax jmp 130c <func0+0x4c> nopl 0x0(%rax) imul %ecx,%edx imul %ecx,%eax test %edx,%edx cmovg %r10d,%edx cmp %eax,%r8d cmovl %eax,%r8d add $0x4,%rdi cmp %rsi,%rdi je 1338 <func0+0x78> mov (%rdi),%ecx test %ecx,%ecx jg 12f0 <func0+0x30> je 1340 <func0+0x80> imul %ecx,%edx test %edx,%edx mov %edx,%r9d cmovle %r10d,%r9d imul %eax,%ecx mov %r9d,%eax cmp %eax,%r8d mov %ecx,%edx cmovl %eax,%r8d add $0x4,%rdi cmp %rsi,%rdi jne 130c <func0+0x4c> mov %r8d,%eax retq nopl 0x0(%rax) mov $0x1,%edx mov $0x1,%eax jmp 12fc <func0+0x3c> nopl 0x0(%rax) xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle loc_1350 lea eax, [rsi-1] xor r8d, r8d mov edx, 1 lea rsi, [rdi+rax*4+4] mov eax, 1 jmp short loc_1308 loc_12E8: imul edx, ecx imul eax, ecx mov ecx, 1 test edx, edx cmovg edx, ecx loc_12F8: cmp r8d, eax cmovl r8d, eax add rdi, 4 cmp rdi, rsi jz short loc_1337 loc_1308: mov ecx, [rdi] test ecx, ecx jg short loc_12E8 jz short loc_1340 imul edx, ecx mov r9d, edx mov edx, ecx imul edx, eax test r9d, r9d mov eax, 1 cmovg eax, r9d cmp r8d, eax cmovl r8d, eax add rdi, 4 cmp rdi, rsi jnz short loc_1308 loc_1337: mov eax, r8d retn loc_1340: mov edx, 1 mov eax, 1 jmp short loc_12F8 loc_1350: xor r8d, r8d mov eax, r8d retn
long long func0(int *a1, int a2) { int v2; // r8d int v3; // edx long long v4; // rsi int v5; // eax int v6; // ecx int v7; // r9d if ( a2 > 0 ) { v2 = 0; v3 = 1; v4 = (long long)&a1[a2 - 1 + 1]; v5 = 1; while ( 1 ) { v6 = *a1; if ( *a1 > 0 ) break; if ( v6 ) { v7 = v6 * v3; v3 = v5 * v6; v5 = 1; if ( v7 > 0 ) v5 = v7; if ( v2 < v5 ) v2 = v5; if ( ++a1 == (int *)v4 ) return (unsigned int)v2; } else { v3 = 1; v5 = 1; LABEL_5: if ( v2 < v5 ) v2 = v5; if ( ++a1 == (int *)v4 ) return (unsigned int)v2; } } v3 *= v6; v5 *= v6; if ( v3 > 0 ) v3 = 1; goto LABEL_5; } return 0LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101350 LEA EAX,[RSI + -0x1] XOR R8D,R8D MOV EDX,0x1 LEA RSI,[RDI + RAX*0x4 + 0x4] MOV EAX,0x1 JMP 0x00101308 LAB_001012e8: IMUL EDX,ECX IMUL EAX,ECX MOV ECX,0x1 TEST EDX,EDX CMOVG EDX,ECX LAB_001012f8: CMP R8D,EAX CMOVL R8D,EAX ADD RDI,0x4 CMP RDI,RSI JZ 0x00101337 LAB_00101308: MOV ECX,dword ptr [RDI] TEST ECX,ECX JG 0x001012e8 JZ 0x00101340 IMUL EDX,ECX MOV R9D,EDX MOV EDX,ECX IMUL EDX,EAX TEST R9D,R9D MOV EAX,0x1 CMOVG EAX,R9D CMP R8D,EAX CMOVL R8D,EAX ADD RDI,0x4 CMP RDI,RSI JNZ 0x00101308 LAB_00101337: MOV EAX,R8D RET LAB_00101340: MOV EDX,0x1 MOV EAX,0x1 JMP 0x001012f8 LAB_00101350: XOR R8D,R8D MOV EAX,R8D RET
int func0(int *param_1,int param_2) { int *piVar1; int iVar2; int iVar3; int iVar4; int iVar5; int iVar6; if (param_2 < 1) { return 0; } iVar6 = 0; iVar5 = 1; piVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar3 = 1; do { iVar2 = *param_1; if (iVar2 < 1) { if (iVar2 == 0) { iVar5 = 1; iVar3 = 1; goto LAB_001012f8; } iVar4 = iVar5 * iVar2; iVar5 = iVar2 * iVar3; iVar3 = 1; if (0 < iVar4) { iVar3 = iVar4; } if (iVar6 < iVar3) { iVar6 = iVar3; } } else { iVar5 = iVar5 * iVar2; iVar3 = iVar3 * iVar2; if (0 < iVar5) { iVar5 = 1; } LAB_001012f8: if (iVar6 < iVar3) { iVar6 = iVar3; } } param_1 = param_1 + 1; if (param_1 == piVar1) { return iVar6; } } while( true ); }
5,747
func0
#include <stdio.h> #include <assert.h>
int func0(int arr[], int n) { int max_ending_here = 1; int min_ending_here = 1; int max_so_far = 0; int flag = 0; for (int i = 0; i < n; i++) { if (arr[i] > 0) { max_ending_here = max_ending_here * arr[i]; min_ending_here = (min_ending_here * arr[i] < 1) ? min_ending_here * arr[i] : 1; flag = 1; } else if (arr[i] == 0) { max_ending_here = 1; min_ending_here = 1; } else { int temp = max_ending_here; max_ending_here = (min_ending_here * arr[i] > 1) ? min_ending_here * arr[i] : 1; min_ending_here = temp * arr[i]; } if (max_so_far < max_ending_here) { max_so_far = max_ending_here; } } if (flag == 0 && max_so_far == 0) { return 0; } return max_so_far; }
int main() { int arr1[] = {1, -2, -3, 0, 7, -8, -2}; int n1 = sizeof(arr1) / sizeof(arr1[0]); assert(func0(arr1, n1) == 112); int arr2[] = {6, -3, -10, 0, 2}; int n2 = sizeof(arr2) / sizeof(arr2[0]); assert(func0(arr2, n2) == 180); int arr3[] = {-2, -40, 0, -2, -3}; int n3 = sizeof(arr3) / sizeof(arr3[0]); assert(func0(arr3, n3) == 80); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 1320 <func0+0x90> lea -0x1(%rsi),%eax xor %r8d,%r8d mov $0x1,%edx mov $0x1,%r10d lea 0x4(%rdi,%rax,4),%rsi mov $0x1,%eax jmp 12dc <func0+0x4c> nopl 0x0(%rax) imul %ecx,%edx imul %ecx,%eax test %edx,%edx cmovg %r10d,%edx cmp %eax,%r8d cmovl %eax,%r8d add $0x4,%rdi cmp %rdi,%rsi je 1308 <func0+0x78> mov (%rdi),%ecx test %ecx,%ecx jg 12c0 <func0+0x30> je 1310 <func0+0x80> imul %ecx,%edx test %edx,%edx mov %edx,%r9d cmovle %r10d,%r9d imul %eax,%ecx mov %r9d,%eax cmp %eax,%r8d mov %ecx,%edx cmovl %eax,%r8d add $0x4,%rdi cmp %rdi,%rsi jne 12dc <func0+0x4c> mov %r8d,%eax retq nopl 0x0(%rax) mov $0x1,%edx mov $0x1,%eax jmp 12cc <func0+0x3c> nopl 0x0(%rax) xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle loc_1330 movsxd rsi, esi xor r9d, r9d mov edx, 1 mov eax, 1 lea r8, [rdi+rsi*4] xor esi, esi jmp short loc_12DC loc_12B8: imul edx, ecx mov r9d, 1 imul eax, ecx mov ecx, 1 test edx, edx cmovg edx, ecx loc_12CE: cmp esi, eax cmovl esi, eax add rdi, 4 cmp r8, rdi jz short loc_1309 loc_12DC: mov ecx, [rdi] test ecx, ecx jg short loc_12B8 jz short loc_1320 imul edx, ecx imul eax, ecx mov r10d, edx test r10d, r10d mov edx, eax mov eax, 1 cmovg eax, r10d cmp esi, eax cmovl esi, eax add rdi, 4 cmp r8, rdi jnz short loc_12DC loc_1309: or r9d, esi mov eax, 0 cmovz esi, eax mov eax, esi retn loc_1320: mov edx, 1 mov eax, 1 jmp short loc_12CE loc_1330: xor esi, esi mov eax, esi retn
long long func0(int *a1, int a2) { int v2; // r9d int v3; // edx int v4; // eax int *v5; // r8 int v6; // esi int v7; // ecx int v8; // r10d if ( a2 <= 0 ) return 0LL; v2 = 0; v3 = 1; v4 = 1; v5 = &a1[a2]; v6 = 0; do { while ( 1 ) { v7 = *a1; if ( *a1 > 0 ) break; if ( !v7 ) { v3 = 1; v4 = 1; goto LABEL_5; } v8 = v7 * v3; v3 = v7 * v4; v4 = 1; if ( v8 > 0 ) v4 = v8; if ( v6 < v4 ) v6 = v4; if ( v5 == ++a1 ) goto LABEL_15; } v3 *= v7; v2 = 1; v4 *= v7; if ( v3 > 0 ) v3 = 1; LABEL_5: if ( v6 < v4 ) v6 = v4; ++a1; } while ( v5 != a1 ); LABEL_15: if ( !(v6 | v2) ) return 0; return (unsigned int)v6; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101330 MOVSXD RSI,ESI XOR R9D,R9D MOV EDX,0x1 MOV EAX,0x1 LEA R8,[RDI + RSI*0x4] XOR ESI,ESI JMP 0x001012dc LAB_001012b8: IMUL EDX,ECX MOV R9D,0x1 IMUL EAX,ECX MOV ECX,0x1 TEST EDX,EDX CMOVG EDX,ECX LAB_001012ce: CMP ESI,EAX CMOVL ESI,EAX ADD RDI,0x4 CMP R8,RDI JZ 0x00101309 LAB_001012dc: MOV ECX,dword ptr [RDI] TEST ECX,ECX JG 0x001012b8 JZ 0x00101320 IMUL EDX,ECX IMUL EAX,ECX MOV R10D,EDX TEST R10D,R10D MOV EDX,EAX MOV EAX,0x1 CMOVG EAX,R10D CMP ESI,EAX CMOVL ESI,EAX ADD RDI,0x4 CMP R8,RDI JNZ 0x001012dc LAB_00101309: OR R9D,ESI MOV EAX,0x0 CMOVZ ESI,EAX MOV EAX,ESI RET LAB_00101320: MOV EDX,0x1 MOV EAX,0x1 JMP 0x001012ce LAB_00101330: XOR ESI,ESI MOV EAX,ESI RET
int func0(int *param_1,int param_2) { int *piVar1; int iVar2; bool bVar3; int iVar4; int iVar5; int iVar6; int iVar7; if (param_2 < 1) { return 0; } bVar3 = false; iVar5 = 1; iVar4 = 1; piVar1 = param_1 + param_2; iVar7 = 0; do { iVar2 = *param_1; if (iVar2 < 1) { if (iVar2 == 0) { iVar5 = 1; iVar4 = 1; goto LAB_001012ce; } iVar6 = iVar5 * iVar2; iVar5 = iVar4 * iVar2; iVar4 = 1; if (0 < iVar6) { iVar4 = iVar6; } if (iVar7 < iVar4) { iVar7 = iVar4; } } else { iVar5 = iVar5 * iVar2; bVar3 = true; iVar4 = iVar4 * iVar2; if (0 < iVar5) { iVar5 = 1; } LAB_001012ce: if (iVar7 < iVar4) { iVar7 = iVar4; } } param_1 = param_1 + 1; if (piVar1 == param_1) { if (!bVar3 && iVar7 == 0) { iVar7 = 0; } return iVar7; } } while( true ); }
5,748
func0
#include <stdio.h> #include <stdbool.h> #include <assert.h>
bool func0(int dict[], int size, int n) { for (int i = 0; i < size; i++) { if (dict[i] != n) { return false; } } return true; }
int main() { int dict1[] = {12, 12, 12, 12}; int dictSize1 = sizeof(dict1) / sizeof(dict1[0]); assert(func0(dict1, dictSize1, 10) == false); assert(func0(dict1, dictSize1, 12) == true); assert(func0(dict1, dictSize1, 5) == false); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %edx,-0x20(%rbp) movl $0x0,-0x4(%rbp) jmp 11aa <func0+0x41> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax cmp %eax,-0x20(%rbp) je 11a6 <func0+0x3d> mov $0x0,%eax jmp 11b7 <func0+0x4e> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1184 <func0+0x1b> mov $0x1,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_20], edx mov [rbp+var_4], 0 jmp short loc_11AA loc_1184: 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_20], eax jz short loc_11A6 mov eax, 0 jmp short loc_11B7 loc_11A6: add [rbp+var_4], 1 loc_11AA: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1184 mov eax, 1 loc_11B7: pop rbp retn
long long func0(long long a1, int a2, int a3) { int i; // [rsp+1Ch] [rbp-4h] for ( i = 0; i < a2; ++i ) { if ( a3 != *(_DWORD *)(4LL * i + a1) ) return 0LL; } return 1LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x20],EDX MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011aa LAB_00101184: 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 + -0x20],EAX JZ 0x001011a6 MOV EAX,0x0 JMP 0x001011b7 LAB_001011a6: ADD dword ptr [RBP + -0x4],0x1 LAB_001011aa: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101184 MOV EAX,0x1 LAB_001011b7: POP RBP RET
int8 func0(long param_1,int param_2,int param_3) { int local_c; local_c = 0; while( true ) { if (param_2 <= local_c) { return 1; } if (param_3 != *(int *)(param_1 + (long)local_c * 4)) break; local_c = local_c + 1; } return 0; }
5,749
func0
#include <stdio.h> #include <stdbool.h> #include <assert.h>
bool func0(int dict[], int size, int n) { for (int i = 0; i < size; i++) { if (dict[i] != n) { return false; } } return true; }
int main() { int dict1[] = {12, 12, 12, 12}; int dictSize1 = sizeof(dict1) / sizeof(dict1[0]); assert(func0(dict1, dictSize1, 10) == false); assert(func0(dict1, dictSize1, 12) == true); assert(func0(dict1, dictSize1, 5) == false); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 118f <func0+0x26> mov %rdi,%rax lea -0x1(%rsi),%ecx lea 0x4(%rdi,%rcx,4),%rcx cmp %edx,(%rax) jne 1195 <func0+0x2c> add $0x4,%rax cmp %rcx,%rax jne 117c <func0+0x13> mov $0x1,%eax retq mov $0x1,%eax retq mov $0x0,%eax retq
func0: endbr64 test esi, esi jle short loc_118F mov rax, rdi lea ecx, [rsi-1] lea rcx, [rdi+rcx*4+4] loc_117C: cmp [rax], edx jnz short loc_1195 add rax, 4 cmp rax, rcx jnz short loc_117C mov eax, 1 retn loc_118F: mov eax, 1 retn loc_1195: mov eax, 0 retn
long long func0(_DWORD *a1, int a2, int a3) { _DWORD *v3; // rax if ( a2 <= 0 ) return 1LL; v3 = a1; while ( *v3 == a3 ) { if ( ++v3 == &a1[a2 - 1 + 1] ) return 1LL; } return 0LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x0010118f MOV RAX,RDI LEA ECX,[RSI + -0x1] LEA RCX,[RDI + RCX*0x4 + 0x4] LAB_0010117c: CMP dword ptr [RAX],EDX JNZ 0x00101195 ADD RAX,0x4 CMP RAX,RCX JNZ 0x0010117c MOV EAX,0x1 RET LAB_0010118f: MOV EAX,0x1 RET LAB_00101195: MOV EAX,0x0 RET
int8 func0(int *param_1,int param_2,int param_3) { int *piVar1; if (param_2 < 1) { return 1; } piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if (*param_1 != param_3) { return 0; } param_1 = param_1 + 1; } while (param_1 != piVar1); return 1; }
5,750
func0
#include <stdio.h> #include <stdbool.h> #include <assert.h>
bool func0(int dict[], int size, int n) { for (int i = 0; i < size; i++) { if (dict[i] != n) { return false; } } return true; }
int main() { int dict1[] = {12, 12, 12, 12}; int dictSize1 = sizeof(dict1) / sizeof(dict1[0]); assert(func0(dict1, dictSize1, 10) == false); assert(func0(dict1, dictSize1, 12) == true); assert(func0(dict1, dictSize1, 5) == false); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1170 <func0+0x30> lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rax jmp 1161 <func0+0x21> nopw 0x0(%rax,%rax,1) add $0x4,%rdi cmp %rax,%rdi je 1170 <func0+0x30> cmp %edx,(%rdi) je 1158 <func0+0x18> xor %eax,%eax retq nopl 0x0(%rax,%rax,1) mov $0x1,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle short loc_1170 lea eax, [rsi-1] lea rax, [rdi+rax*4+4] jmp short loc_1161 loc_1158: add rdi, 4 cmp rdi, rax jz short loc_1170 loc_1161: cmp [rdi], edx jz short loc_1158 xor eax, eax retn loc_1170: mov eax, 1 retn
long long func0(_DWORD *a1, int a2, int a3) { long long v3; // rax if ( a2 <= 0 ) return 1LL; v3 = (long long)&a1[a2 - 1 + 1]; while ( *a1 == a3 ) { if ( ++a1 == (_DWORD *)v3 ) return 1LL; } return 0LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101170 LEA EAX,[RSI + -0x1] LEA RAX,[RDI + RAX*0x4 + 0x4] JMP 0x00101161 LAB_00101158: ADD RDI,0x4 CMP RDI,RAX JZ 0x00101170 LAB_00101161: CMP dword ptr [RDI],EDX JZ 0x00101158 XOR EAX,EAX RET LAB_00101170: MOV EAX,0x1 RET
int8 func0(int *param_1,int param_2,int param_3) { int *piVar1; if (0 < param_2) { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if (*param_1 != param_3) { return 0; } param_1 = param_1 + 1; } while (param_1 != piVar1); } return 1; }
5,751
func0
#include <stdio.h> #include <stdbool.h> #include <assert.h>
bool func0(int dict[], int size, int n) { for (int i = 0; i < size; i++) { if (dict[i] != n) { return false; } } return true; }
int main() { int dict1[] = {12, 12, 12, 12}; int dictSize1 = sizeof(dict1) / sizeof(dict1[0]); assert(func0(dict1, dictSize1, 10) == false); assert(func0(dict1, dictSize1, 12) == true); assert(func0(dict1, dictSize1, 5) == false); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 1170 <func0+0x30> lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rax jmp 1161 <func0+0x21> nopw 0x0(%rax,%rax,1) add $0x4,%rdi cmp %rax,%rdi je 1170 <func0+0x30> cmp %edx,(%rdi) je 1158 <func0+0x18> xor %eax,%eax retq nopl 0x0(%rax,%rax,1) mov $0x1,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle short loc_1170 movsxd rsi, esi lea rax, [rdi+rsi*4] jmp short loc_1161 loc_1158: add rdi, 4 cmp rdi, rax jz short loc_1170 loc_1161: cmp [rdi], edx jz short loc_1158 xor eax, eax retn loc_1170: mov eax, 1 retn
long long func0(_DWORD *a1, int a2, int a3) { _DWORD *v3; // rax if ( a2 <= 0 ) return 1LL; v3 = &a1[a2]; while ( *a1 == a3 ) { if ( ++a1 == v3 ) return 1LL; } return 0LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101170 MOVSXD RSI,ESI LEA RAX,[RDI + RSI*0x4] JMP 0x00101161 LAB_00101158: ADD RDI,0x4 CMP RDI,RAX JZ 0x00101170 LAB_00101161: CMP dword ptr [RDI],EDX JZ 0x00101158 XOR EAX,EAX RET LAB_00101170: MOV EAX,0x1 RET
int8 func0(int *param_1,int param_2,int param_3) { int *piVar1; if (0 < param_2) { piVar1 = param_1 + param_2; do { if (*param_1 != param_3) { return 0; } param_1 = param_1 + 1; } while (param_1 != piVar1); } return 1; }
5,752
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> typedef struct { char *key; char *value; } Entry; typedef struct { Entry *entries; int size; } Dictionary; Dictionary drop_empty(Dictionary dict1) { Dictionary result; result.entries = (Entry *)malloc(sizeof(Entry) * dict1.size); result.size = 0; for (int i = 0; i < dict1.size; i++) { if (dict1.entries[i].value != NULL) { result.entries[result.size].key = dict1.entries[i].key; result.entries[result.size].value = dict1.entries[i].value; result.size++; } } return result; }
int func0(Dictionary dict1, Dictionary dict2) { if (dict1.size != dict2.size) return 0; for (int i = 0; i < dict1.size; i++) { int found = 0; for (int j = 0; j < dict2.size; j++) { if (dict1.entries[i].key == dict2.entries[j].key && dict1.entries[i].value == dict2.entries[j].value) { found = 1; break; } } if (!found) return 0; } return 1; }
int main() { Dictionary dict1, result, expected; dict1.size = 3; dict1.entries = (Entry[]){{"c1", "Red"}, {"c2", "Green"}, {"c3", NULL}}; expected.size = 2; expected.entries = (Entry[]){{"c1", "Red"}, {"c2", "Green"}}; result = drop_empty(dict1); assert(func0(result, expected)); dict1.size = 3; dict1.entries = (Entry[]){{"c1", "Red"}, {"c2", NULL}, {"c3", NULL}}; expected.size = 1; expected.entries = (Entry[]){{"c1", "Red"}}; result = drop_empty(dict1); assert(func0(result, expected)); dict1.size = 3; dict1.entries = (Entry[]){{"c1", NULL}, {"c2", "Green"}, {"c3", NULL}}; expected.size = 1; expected.entries = (Entry[]){{"c2", "Green"}}; result = drop_empty(dict1); assert(func0(result, expected)); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rsi,%rax mov %rdi,%r8 mov %r8,%rsi mov %r9,%rdi mov %rax,%rdi mov %rsi,-0x20(%rbp) mov %rdi,-0x18(%rbp) mov %rdx,-0x30(%rbp) mov %rcx,-0x28(%rbp) mov -0x18(%rbp),%edx mov -0x28(%rbp),%eax cmp %eax,%edx je 1295 <func0+0x3b> mov $0x0,%eax jmpq 1344 <func0+0xea> movl $0x0,-0xc(%rbp) jmpq 1333 <func0+0xd9> movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 131a <func0+0xc0> mov -0x20(%rbp),%rax mov -0xc(%rbp),%edx movslq %edx,%rdx shl $0x4,%rdx add %rdx,%rax mov (%rax),%rdx mov -0x30(%rbp),%rax mov -0x4(%rbp),%ecx movslq %ecx,%rcx shl $0x4,%rcx add %rcx,%rax mov (%rax),%rax cmp %rax,%rdx jne 1316 <func0+0xbc> mov -0x20(%rbp),%rax mov -0xc(%rbp),%edx movslq %edx,%rdx shl $0x4,%rdx add %rdx,%rax mov 0x8(%rax),%rdx mov -0x30(%rbp),%rax mov -0x4(%rbp),%ecx movslq %ecx,%rcx shl $0x4,%rcx add %rcx,%rax mov 0x8(%rax),%rax cmp %rax,%rdx jne 1316 <func0+0xbc> movl $0x1,-0x8(%rbp) jmp 1322 <func0+0xc8> addl $0x1,-0x4(%rbp) mov -0x28(%rbp),%eax cmp %eax,-0x4(%rbp) jl 12b1 <func0+0x57> cmpl $0x0,-0x8(%rbp) jne 132f <func0+0xd5> mov $0x0,%eax jmp 1344 <func0+0xea> addl $0x1,-0xc(%rbp) mov -0x18(%rbp),%eax cmp %eax,-0xc(%rbp) jl 12a1 <func0+0x47> mov $0x1,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov rax, rdi mov r8, rsi mov rsi, rax mov rdi, rdx mov rdi, r8 mov [rbp+var_20], rsi mov [rbp+var_18], rdi mov [rbp+var_30], rdx mov [rbp+var_28], rcx mov edx, dword ptr [rbp+var_18] mov eax, dword ptr [rbp+var_28] cmp edx, eax jz short loc_1295 mov eax, 0 jmp loc_1344 loc_1295: mov [rbp+var_C], 0 jmp loc_1333 loc_12A1: mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_131A loc_12B1: mov rax, [rbp+var_20] mov edx, [rbp+var_C] movsxd rdx, edx shl rdx, 4 add rax, rdx mov rdx, [rax] mov rax, [rbp+var_30] mov ecx, [rbp+var_4] movsxd rcx, ecx shl rcx, 4 add rax, rcx mov rax, [rax] cmp rdx, rax jnz short loc_1316 mov rax, [rbp+var_20] mov edx, [rbp+var_C] movsxd rdx, edx shl rdx, 4 add rax, rdx mov rdx, [rax+8] mov rax, [rbp+var_30] mov ecx, [rbp+var_4] movsxd rcx, ecx shl rcx, 4 add rax, rcx mov rax, [rax+8] cmp rdx, rax jnz short loc_1316 mov [rbp+var_8], 1 jmp short loc_1322 loc_1316: add [rbp+var_4], 1 loc_131A: mov eax, dword ptr [rbp+var_28] cmp [rbp+var_4], eax jl short loc_12B1 loc_1322: cmp [rbp+var_8], 0 jnz short loc_132F mov eax, 0 jmp short loc_1344 loc_132F: add [rbp+var_C], 1 loc_1333: mov eax, dword ptr [rbp+var_18] cmp [rbp+var_C], eax jl loc_12A1 mov eax, 1 loc_1344: pop rbp retn
long long func0(long long a1, int a2, long long a3, int a4) { int i; // [rsp+24h] [rbp-Ch] int v6; // [rsp+28h] [rbp-8h] int j; // [rsp+2Ch] [rbp-4h] if ( a2 != a4 ) return 0LL; for ( i = 0; i < a2; ++i ) { v6 = 0; for ( j = 0; j < a4; ++j ) { if ( *(_QWORD *)(16LL * i + a1) == *(_QWORD *)(16LL * j + a3) && *(_QWORD *)(16LL * i + a1 + 8) == *(_QWORD *)(16LL * j + a3 + 8) ) { v6 = 1; break; } } if ( !v6 ) return 0LL; } return 1LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV RAX,RDI MOV R8,RSI MOV RSI,RAX MOV RDI,RDX MOV RDI,R8 MOV qword ptr [RBP + -0x20],RSI MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x30],RDX MOV qword ptr [RBP + -0x28],RCX MOV EDX,dword ptr [RBP + -0x18] MOV EAX,dword ptr [RBP + -0x28] CMP EDX,EAX JZ 0x00101295 MOV EAX,0x0 JMP 0x00101344 LAB_00101295: MOV dword ptr [RBP + -0xc],0x0 JMP 0x00101333 LAB_001012a1: MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x0010131a LAB_001012b1: MOV RAX,qword ptr [RBP + -0x20] MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX SHL RDX,0x4 ADD RAX,RDX MOV RDX,qword ptr [RAX] MOV RAX,qword ptr [RBP + -0x30] MOV ECX,dword ptr [RBP + -0x4] MOVSXD RCX,ECX SHL RCX,0x4 ADD RAX,RCX MOV RAX,qword ptr [RAX] CMP RDX,RAX JNZ 0x00101316 MOV RAX,qword ptr [RBP + -0x20] MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX SHL RDX,0x4 ADD RAX,RDX MOV RDX,qword ptr [RAX + 0x8] MOV RAX,qword ptr [RBP + -0x30] MOV ECX,dword ptr [RBP + -0x4] MOVSXD RCX,ECX SHL RCX,0x4 ADD RAX,RCX MOV RAX,qword ptr [RAX + 0x8] CMP RDX,RAX JNZ 0x00101316 MOV dword ptr [RBP + -0x8],0x1 JMP 0x00101322 LAB_00101316: ADD dword ptr [RBP + -0x4],0x1 LAB_0010131a: MOV EAX,dword ptr [RBP + -0x28] CMP dword ptr [RBP + -0x4],EAX JL 0x001012b1 LAB_00101322: CMP dword ptr [RBP + -0x8],0x0 JNZ 0x0010132f MOV EAX,0x0 JMP 0x00101344 LAB_0010132f: ADD dword ptr [RBP + -0xc],0x1 LAB_00101333: MOV EAX,dword ptr [RBP + -0x18] CMP dword ptr [RBP + -0xc],EAX JL 0x001012a1 MOV EAX,0x1 LAB_00101344: POP RBP RET
int8 func0(long param_1,int param_2,long param_3,int param_4) { bool bVar1; int8 uVar2; int local_14; int local_c; if (param_2 == param_4) { for (local_14 = 0; local_14 < param_2; local_14 = local_14 + 1) { bVar1 = false; for (local_c = 0; local_c < param_4; local_c = local_c + 1) { if ((*(long *)(param_1 + (long)local_14 * 0x10) == *(long *)(param_3 + (long)local_c * 0x10) ) && (*(long *)(param_1 + (long)local_14 * 0x10 + 8) == *(long *)(param_3 + (long)local_c * 0x10 + 8))) { bVar1 = true; break; } } if (!bVar1) { return 0; } } uVar2 = 1; } else { uVar2 = 0; } return uVar2; }
5,753
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> typedef struct { char *key; char *value; } Entry; typedef struct { Entry *entries; int size; } Dictionary; Dictionary drop_empty(Dictionary dict1) { Dictionary result; result.entries = (Entry *)malloc(sizeof(Entry) * dict1.size); result.size = 0; for (int i = 0; i < dict1.size; i++) { if (dict1.entries[i].value != NULL) { result.entries[result.size].key = dict1.entries[i].key; result.entries[result.size].value = dict1.entries[i].value; result.size++; } } return result; }
int func0(Dictionary dict1, Dictionary dict2) { if (dict1.size != dict2.size) return 0; for (int i = 0; i < dict1.size; i++) { int found = 0; for (int j = 0; j < dict2.size; j++) { if (dict1.entries[i].key == dict2.entries[j].key && dict1.entries[i].value == dict2.entries[j].value) { found = 1; break; } } if (!found) return 0; } return 1; }
int main() { Dictionary dict1, result, expected; dict1.size = 3; dict1.entries = (Entry[]){{"c1", "Red"}, {"c2", "Green"}, {"c3", NULL}}; expected.size = 2; expected.entries = (Entry[]){{"c1", "Red"}, {"c2", "Green"}}; result = drop_empty(dict1); assert(func0(result, expected)); dict1.size = 3; dict1.entries = (Entry[]){{"c1", "Red"}, {"c2", NULL}, {"c3", NULL}}; expected.size = 1; expected.entries = (Entry[]){{"c1", "Red"}}; result = drop_empty(dict1); assert(func0(result, expected)); dict1.size = 3; dict1.entries = (Entry[]){{"c1", NULL}, {"c2", "Green"}, {"c3", NULL}}; expected.size = 1; expected.entries = (Entry[]){{"c2", "Green"}}; result = drop_empty(dict1); assert(func0(result, expected)); return 0; }
O1
c
func0: endbr64 mov %ecx,%r9d mov $0x0,%eax cmp %ecx,%esi jne 1274 <func0+0x7c> test %esi,%esi jle 122c <func0+0x34> mov %rdi,%r8 lea -0x1(%rsi),%eax shl $0x4,%rax lea 0x10(%rdi,%rax,1),%r10 mov %rdx,%rdi lea -0x1(%rcx),%eax shl $0x4,%rax lea 0x10(%rax,%rdx,1),%rcx jmp 1253 <func0+0x5b> mov $0x1,%eax retq add $0x10,%rax cmp %rcx,%rax je 1263 <func0+0x6b> cmp (%rax),%rdx jne 1232 <func0+0x3a> mov 0x8(%rax),%r11 cmp %r11,0x8(%rsi) jne 1232 <func0+0x3a> add $0x10,%r8 cmp %r10,%r8 je 126f <func0+0x77> test %r9d,%r9d jle 1269 <func0+0x71> mov %r8,%rsi mov (%r8),%rdx mov %rdi,%rax jmp 123b <func0+0x43> mov $0x0,%eax retq mov $0x0,%eax retq mov $0x1,%eax retq
func0: endbr64 mov r9, rdx mov r10d, ecx mov eax, 0 cmp esi, ecx jnz short locret_1274 test esi, esi jle short loc_122C mov r8, rdi lea eax, [rsi-1] shl rax, 4 lea rdi, [rdi+rax+10h] lea eax, [rcx-1] shl rax, 4 lea rcx, [rax+rdx+10h] jmp short loc_1253 loc_122C: mov eax, 1 retn loc_1232: add rax, 10h cmp rax, rcx jz short loc_1263 loc_123B: cmp rdx, [rax] jnz short loc_1232 mov r11, [rax+8] cmp [rsi+8], r11 jnz short loc_1232 add r8, 10h cmp r8, rdi jz short loc_126F loc_1253: test r10d, r10d jle short loc_1269 mov rsi, r8 mov rdx, [r8] mov rax, r9 jmp short loc_123B loc_1263: mov eax, 0 retn loc_1269: mov eax, 0 retn loc_126F: mov eax, 1 locret_1274: retn
long long func0(_QWORD *a1, int a2, _QWORD *a3, int a4) { long long result; // rax _QWORD *v6; // r8 long long v7; // rdi long long v8; // rcx _QWORD *v9; // rax result = 0LL; if ( a2 == a4 ) { if ( a2 <= 0 ) { return 1LL; } else { v6 = a1; v7 = (long long)&a1[2 * (unsigned int)(a2 - 1) + 2]; v8 = (long long)&a3[2 * (unsigned int)(a4 - 1) + 2]; while ( 2 ) { if ( a4 <= 0 ) { return 0LL; } else { v9 = a3; while ( *v6 != *v9 || v6[1] != v9[1] ) { v9 += 2; if ( v9 == (_QWORD *)v8 ) return 0LL; } v6 += 2; if ( v6 != (_QWORD *)v7 ) continue; return 1LL; } } } } return result; }
func0: ENDBR64 MOV R9,RDX MOV R10D,ECX MOV EAX,0x0 CMP ESI,ECX JNZ 0x00101274 TEST ESI,ESI JLE 0x0010122c MOV R8,RDI LEA EAX,[RSI + -0x1] SHL RAX,0x4 LEA RDI,[RDI + RAX*0x1 + 0x10] LEA EAX,[RCX + -0x1] SHL RAX,0x4 LEA RCX,[RAX + RDX*0x1 + 0x10] JMP 0x00101253 LAB_0010122c: MOV EAX,0x1 RET LAB_00101232: ADD RAX,0x10 CMP RAX,RCX JZ 0x00101263 LAB_0010123b: CMP RDX,qword ptr [RAX] JNZ 0x00101232 MOV R11,qword ptr [RAX + 0x8] CMP qword ptr [RSI + 0x8],R11 JNZ 0x00101232 ADD R8,0x10 CMP R8,RDI JZ 0x0010126f LAB_00101253: TEST R10D,R10D JLE 0x00101269 MOV RSI,R8 MOV RDX,qword ptr [R8] MOV RAX,R9 JMP 0x0010123b LAB_00101263: MOV EAX,0x0 RET LAB_00101269: MOV EAX,0x0 RET LAB_0010126f: MOV EAX,0x1 LAB_00101274: RET
int8 func0(long *param_1,int param_2,long *param_3,int param_4) { long *plVar1; int8 uVar2; long *plVar3; uVar2 = 0; if (param_2 == param_4) { if (param_2 < 1) { return 1; } plVar1 = param_1 + (ulong)(param_2 - 1) * 2 + 2; do { if (param_4 < 1) { return 0; } plVar3 = param_3; while ((*param_1 != *plVar3 || (param_1[1] != plVar3[1]))) { plVar3 = plVar3 + 2; if (plVar3 == param_3 + (ulong)(param_4 - 1) * 2 + 2) { return 0; } } param_1 = param_1 + 2; } while (param_1 != plVar1); uVar2 = 1; } return uVar2; }
5,754
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> typedef struct { char *key; char *value; } Entry; typedef struct { Entry *entries; int size; } Dictionary; Dictionary drop_empty(Dictionary dict1) { Dictionary result; result.entries = (Entry *)malloc(sizeof(Entry) * dict1.size); result.size = 0; for (int i = 0; i < dict1.size; i++) { if (dict1.entries[i].value != NULL) { result.entries[result.size].key = dict1.entries[i].key; result.entries[result.size].value = dict1.entries[i].value; result.size++; } } return result; }
int func0(Dictionary dict1, Dictionary dict2) { if (dict1.size != dict2.size) return 0; for (int i = 0; i < dict1.size; i++) { int found = 0; for (int j = 0; j < dict2.size; j++) { if (dict1.entries[i].key == dict2.entries[j].key && dict1.entries[i].value == dict2.entries[j].value) { found = 1; break; } } if (!found) return 0; } return 1; }
int main() { Dictionary dict1, result, expected; dict1.size = 3; dict1.entries = (Entry[]){{"c1", "Red"}, {"c2", "Green"}, {"c3", NULL}}; expected.size = 2; expected.entries = (Entry[]){{"c1", "Red"}, {"c2", "Green"}}; result = drop_empty(dict1); assert(func0(result, expected)); dict1.size = 3; dict1.entries = (Entry[]){{"c1", "Red"}, {"c2", NULL}, {"c3", NULL}}; expected.size = 1; expected.entries = (Entry[]){{"c1", "Red"}}; result = drop_empty(dict1); assert(func0(result, expected)); dict1.size = 3; dict1.entries = (Entry[]){{"c1", NULL}, {"c2", "Green"}, {"c3", NULL}}; expected.size = 1; expected.entries = (Entry[]){{"c2", "Green"}}; result = drop_empty(dict1); assert(func0(result, expected)); return 0; }
O2
c
func0: endbr64 mov %ecx,%r8d xor %eax,%eax cmp %ecx,%esi jne 149e <func0+0x5e> test %ecx,%ecx jle 1499 <func0+0x59> lea -0x1(%rcx),%eax shl $0x4,%rax lea 0x10(%rdi,%rax,1),%r9 lea 0x10(%rax,%rdx,1),%rsi nopw 0x0(%rax,%rax,1) test %r8d,%r8d jle 14a0 <func0+0x60> mov (%rdi),%rcx mov %rdx,%rax jmp 1481 <func0+0x41> nopl (%rax) add $0x10,%rax cmp %rsi,%rax je 14a0 <func0+0x60> cmp (%rax),%rcx jne 1478 <func0+0x38> mov 0x8(%rax),%r10 cmp %r10,0x8(%rdi) jne 1478 <func0+0x38> add $0x10,%rdi cmp %r9,%rdi jne 1468 <func0+0x28> mov $0x1,%eax retq xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 mov r8d, ecx xor eax, eax cmp esi, ecx jnz short locret_149E test ecx, ecx jle short loc_1499 lea eax, [rcx-1] shl rax, 4 lea r9, [rdi+rax+10h] lea rsi, [rax+rdx+10h] nop word ptr [rax+rax+00h] loc_1468: test r8d, r8d jle short loc_14A0 mov rcx, [rdi] mov rax, rdx jmp short loc_1481 loc_1478: add rax, 10h cmp rax, rsi jz short loc_14A0 loc_1481: cmp rcx, [rax] jnz short loc_1478 mov r10, [rax+8] cmp [rdi+8], r10 jnz short loc_1478 add rdi, 10h cmp rdi, r9 jnz short loc_1468 loc_1499: mov eax, 1 locret_149E: retn loc_14A0: xor eax, eax retn
long long func0(_QWORD *a1, int a2, _QWORD *a3, int a4) { long long result; // rax long long v5; // rax long long v6; // r9 long long v7; // rsi _QWORD *v8; // rax result = 0LL; if ( a2 == a4 ) { if ( a4 > 0 ) { v5 = 2LL * (unsigned int)(a4 - 1); v6 = (long long)&a1[v5 + 2]; v7 = (long long)&a3[v5 + 2]; while ( 2 ) { v8 = a3; while ( *a1 != *v8 || a1[1] != v8[1] ) { v8 += 2; if ( v8 == (_QWORD *)v7 ) return 0LL; } a1 += 2; if ( a1 != (_QWORD *)v6 ) continue; break; } } return 1LL; } return result; }
func0: ENDBR64 MOV R8D,ECX XOR EAX,EAX CMP ESI,ECX JNZ 0x0010149e TEST ECX,ECX JLE 0x00101499 LEA EAX,[RCX + -0x1] SHL RAX,0x4 LEA R9,[RDI + RAX*0x1 + 0x10] LEA RSI,[RAX + RDX*0x1 + 0x10] NOP word ptr [RAX + RAX*0x1] LAB_00101468: TEST R8D,R8D JLE 0x001014a0 MOV RCX,qword ptr [RDI] MOV RAX,RDX JMP 0x00101481 LAB_00101478: ADD RAX,0x10 CMP RAX,RSI JZ 0x001014a0 LAB_00101481: CMP RCX,qword ptr [RAX] JNZ 0x00101478 MOV R10,qword ptr [RAX + 0x8] CMP qword ptr [RDI + 0x8],R10 JNZ 0x00101478 ADD RDI,0x10 CMP RDI,R9 JNZ 0x00101468 LAB_00101499: MOV EAX,0x1 LAB_0010149e: RET LAB_001014a0: XOR EAX,EAX RET
int8 func0(long *param_1,int param_2,long *param_3,int param_4) { long *plVar1; long *plVar2; int8 uVar3; uVar3 = 0; if (param_2 == param_4) { if (0 < param_4) { plVar1 = param_1 + (ulong)(param_4 - 1) * 2 + 2; do { if (param_4 < 1) { return 0; } plVar2 = param_3; while ((*param_1 != *plVar2 || (param_1[1] != plVar2[1]))) { plVar2 = plVar2 + 2; if (plVar2 == param_3 + (ulong)(param_4 - 1) * 2 + 2) { return 0; } } param_1 = param_1 + 2; } while (param_1 != plVar1); } uVar3 = 1; } return uVar3; }
5,755
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> typedef struct { char *key; char *value; } Entry; typedef struct { Entry *entries; int size; } Dictionary; Dictionary drop_empty(Dictionary dict1) { Dictionary result; result.entries = (Entry *)malloc(sizeof(Entry) * dict1.size); result.size = 0; for (int i = 0; i < dict1.size; i++) { if (dict1.entries[i].value != NULL) { result.entries[result.size].key = dict1.entries[i].key; result.entries[result.size].value = dict1.entries[i].value; result.size++; } } return result; }
int func0(Dictionary dict1, Dictionary dict2) { if (dict1.size != dict2.size) return 0; for (int i = 0; i < dict1.size; i++) { int found = 0; for (int j = 0; j < dict2.size; j++) { if (dict1.entries[i].key == dict2.entries[j].key && dict1.entries[i].value == dict2.entries[j].value) { found = 1; break; } } if (!found) return 0; } return 1; }
int main() { Dictionary dict1, result, expected; dict1.size = 3; dict1.entries = (Entry[]){{"c1", "Red"}, {"c2", "Green"}, {"c3", NULL}}; expected.size = 2; expected.entries = (Entry[]){{"c1", "Red"}, {"c2", "Green"}}; result = drop_empty(dict1); assert(func0(result, expected)); dict1.size = 3; dict1.entries = (Entry[]){{"c1", "Red"}, {"c2", NULL}, {"c3", NULL}}; expected.size = 1; expected.entries = (Entry[]){{"c1", "Red"}}; result = drop_empty(dict1); assert(func0(result, expected)); dict1.size = 3; dict1.entries = (Entry[]){{"c1", NULL}, {"c2", "Green"}, {"c3", NULL}}; expected.size = 1; expected.entries = (Entry[]){{"c2", "Green"}}; result = drop_empty(dict1); assert(func0(result, expected)); return 0; }
O3
c
func0: endbr64 mov %ecx,%r8d xor %eax,%eax cmp %ecx,%esi jne 14ae <func0+0x5e> test %ecx,%ecx jle 14a9 <func0+0x59> lea -0x1(%rcx),%eax shl $0x4,%rax lea 0x10(%rdi,%rax,1),%r9 lea 0x10(%rax,%rdx,1),%rsi nopw 0x0(%rax,%rax,1) test %r8d,%r8d jle 14b0 <func0+0x60> mov (%rdi),%rcx mov %rdx,%rax jmp 1491 <func0+0x41> nopl (%rax) add $0x10,%rax cmp %rsi,%rax je 14b0 <func0+0x60> cmp (%rax),%rcx jne 1488 <func0+0x38> mov 0x8(%rax),%r10 cmp %r10,0x8(%rdi) jne 1488 <func0+0x38> add $0x10,%rdi cmp %r9,%rdi jne 1478 <func0+0x28> mov $0x1,%eax retq xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 mov r8d, ecx xor eax, eax cmp esi, ecx jnz short locret_14A9 test ecx, ecx jle short loc_14A4 movsxd rcx, ecx shl rcx, 4 lea r9, [rcx+rdi] nop dword ptr [rax+00h] loc_1470: mov rsi, [rdi] mov rax, rdx xor ecx, ecx jmp short loc_148C loc_1480: add ecx, 1 add rax, 10h cmp r8d, ecx jle short loc_14B0 loc_148C: cmp rsi, [rax] jnz short loc_1480 mov r10, [rax+8] cmp [rdi+8], r10 jnz short loc_1480 add rdi, 10h cmp rdi, r9 jnz short loc_1470 loc_14A4: mov eax, 1 locret_14A9: retn loc_14B0: xor eax, eax retn
long long func0(_QWORD *a1, int a2, _QWORD *a3, int a4) { long long result; // rax _QWORD *v6; // r9 _QWORD *v7; // rax int v8; // ecx result = 0LL; if ( a2 == a4 ) { if ( a4 > 0 ) { v6 = &a1[2 * a4]; while ( 2 ) { v7 = a3; v8 = 0; while ( *a1 != *v7 || a1[1] != v7[1] ) { ++v8; v7 += 2; if ( a4 <= v8 ) return 0LL; } a1 += 2; if ( a1 != v6 ) continue; break; } } return 1LL; } return result; }
func0: ENDBR64 MOV R8D,ECX XOR EAX,EAX CMP ESI,ECX JNZ 0x001014a9 TEST ECX,ECX JLE 0x001014a4 MOVSXD RCX,ECX SHL RCX,0x4 LEA R9,[RCX + RDI*0x1] NOP dword ptr [RAX] LAB_00101470: MOV RSI,qword ptr [RDI] MOV RAX,RDX XOR ECX,ECX JMP 0x0010148c LAB_00101480: ADD ECX,0x1 ADD RAX,0x10 CMP R8D,ECX JLE 0x001014b0 LAB_0010148c: CMP RSI,qword ptr [RAX] JNZ 0x00101480 MOV R10,qword ptr [RAX + 0x8] CMP qword ptr [RDI + 0x8],R10 JNZ 0x00101480 ADD RDI,0x10 CMP RDI,R9 JNZ 0x00101470 LAB_001014a4: MOV EAX,0x1 LAB_001014a9: RET LAB_001014b0: XOR EAX,EAX RET
int8 func0(long *param_1,int param_2,long *param_3,int param_4) { long *plVar1; long *plVar2; int8 uVar3; int iVar4; uVar3 = 0; if (param_2 == param_4) { if (0 < param_4) { plVar1 = param_1 + (long)param_4 * 2; do { iVar4 = 0; plVar2 = param_3; while ((*param_1 != *plVar2 || (param_1[1] != plVar2[1]))) { iVar4 = iVar4 + 1; plVar2 = plVar2 + 2; if (param_4 <= iVar4) { return 0; } } param_1 = param_1 + 2; } while (param_1 != plVar1); } uVar3 = 1; } return uVar3; }
5,756
func0
#include <assert.h> int find_peak_util(int arr[], int low, int high, int n) { int mid = low + (high - low) / 2; if ((mid == 0 || arr[mid - 1] <= arr[mid]) && (mid == n - 1 || arr[mid + 1] <= arr[mid])) { return mid; } else if (mid > 0 && arr[mid - 1] > arr[mid]) { return find_peak_util(arr, low, mid - 1, n); } else { return find_peak_util(arr, mid + 1, high, n); } }
int func0(int arr[], int n) { return find_peak_util(arr, 0, n - 1, n); }
int main() { int arr1[6] = {1, 3, 20, 4, 1, 0}; int arr2[5] = {2, 3, 4, 5, 6}; int arr3[6] = {8, 9, 11, 12, 14, 15}; assert(func0(arr1, 6) == 2); assert(func0(arr2, 5) == 4); assert(func0(arr3, 6) == 5); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov %rdi,-0x8(%rbp) mov %esi,-0xc(%rbp) mov -0xc(%rbp),%eax lea -0x1(%rax),%esi mov -0xc(%rbp),%edx mov -0x8(%rbp),%rax mov %edx,%ecx mov %esi,%edx mov $0x0,%esi mov %rax,%rdi callq 1169 <find_peak_util> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 10h mov [rbp+var_8], rdi mov [rbp+var_C], esi mov eax, [rbp+var_C] lea esi, [rax-1] mov edx, [rbp+var_C] mov rax, [rbp+var_8] mov ecx, edx mov edx, esi mov esi, 0 mov rdi, rax call find_peak_util leave retn
long long func0(long long a1, unsigned int a2) { return find_peak_util(a1, 0LL, a2 - 1, a2); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x10 MOV qword ptr [RBP + -0x8],RDI MOV dword ptr [RBP + -0xc],ESI MOV EAX,dword ptr [RBP + -0xc] LEA ESI,[RAX + -0x1] MOV EDX,dword ptr [RBP + -0xc] MOV RAX,qword ptr [RBP + -0x8] MOV ECX,EDX MOV EDX,ESI MOV ESI,0x0 MOV RDI,RAX CALL 0x00101169 LEAVE RET
void func0(int8 param_1,int param_2) { find_peak_util(param_1,0,param_2 + -1,param_2); return; }
5,757
func0
#include <assert.h> int find_peak_util(int arr[], int low, int high, int n) { int mid = low + (high - low) / 2; if ((mid == 0 || arr[mid - 1] <= arr[mid]) && (mid == n - 1 || arr[mid + 1] <= arr[mid])) { return mid; } else if (mid > 0 && arr[mid - 1] > arr[mid]) { return find_peak_util(arr, low, mid - 1, n); } else { return find_peak_util(arr, mid + 1, high, n); } }
int func0(int arr[], int n) { return find_peak_util(arr, 0, n - 1, n); }
int main() { int arr1[6] = {1, 3, 20, 4, 1, 0}; int arr2[5] = {2, 3, 4, 5, 6}; int arr3[6] = {8, 9, 11, 12, 14, 15}; assert(func0(arr1, 6) == 2); assert(func0(arr2, 5) == 4); assert(func0(arr3, 6) == 5); return 0; }
O1
c
func0: endbr64 sub $0x8,%rsp mov %esi,%ecx lea -0x1(%rsi),%edx mov $0x0,%esi callq 1169 <find_peak_util> add $0x8,%rsp retq
func0: endbr64 sub rsp, 8 mov ecx, esi lea edx, [rsi-1] mov esi, 0 call find_peak_util add rsp, 8 retn
long long func0(long long a1, unsigned int a2) { return find_peak_util(a1, 0LL, a2 - 1, a2); }
func0: ENDBR64 SUB RSP,0x8 MOV ECX,ESI LEA EDX,[RSI + -0x1] MOV ESI,0x0 CALL 0x00101169 ADD RSP,0x8 RET
void func0(int8 param_1,int param_2) { find_peak_util(param_1,0,param_2 + -1,param_2); return; }
5,758
func0
#include <assert.h> int find_peak_util(int arr[], int low, int high, int n) { int mid = low + (high - low) / 2; if ((mid == 0 || arr[mid - 1] <= arr[mid]) && (mid == n - 1 || arr[mid + 1] <= arr[mid])) { return mid; } else if (mid > 0 && arr[mid - 1] > arr[mid]) { return find_peak_util(arr, low, mid - 1, n); } else { return find_peak_util(arr, mid + 1, high, n); } }
int func0(int arr[], int n) { return find_peak_util(arr, 0, n - 1, n); }
int main() { int arr1[6] = {1, 3, 20, 4, 1, 0}; int arr2[5] = {2, 3, 4, 5, 6}; int arr3[6] = {8, 9, 11, 12, 14, 15}; assert(func0(arr1, 6) == 2); assert(func0(arr2, 5) == 4); assert(func0(arr3, 6) == 5); return 0; }
O2
c
func0: endbr64 mov %esi,%ecx lea -0x1(%rsi),%edx xor %esi,%esi jmpq 12d0 <find_peak_util>
func0: endbr64 mov ecx, esi lea edx, [rsi-1] xor esi, esi jmp find_peak_util
long long func0(long long a1, unsigned int a2) { return find_peak_util(a1, 0LL, a2 - 1, a2); }
func0: ENDBR64 MOV ECX,ESI LEA EDX,[RSI + -0x1] XOR ESI,ESI JMP 0x001012d0
void func0(int8 param_1,int param_2) { find_peak_util(param_1,0,param_2 + -1,param_2); return; }
5,759
func0
#include <assert.h> int find_peak_util(int arr[], int low, int high, int n) { int mid = low + (high - low) / 2; if ((mid == 0 || arr[mid - 1] <= arr[mid]) && (mid == n - 1 || arr[mid + 1] <= arr[mid])) { return mid; } else if (mid > 0 && arr[mid - 1] > arr[mid]) { return find_peak_util(arr, low, mid - 1, n); } else { return find_peak_util(arr, mid + 1, high, n); } }
int func0(int arr[], int n) { return find_peak_util(arr, 0, n - 1, n); }
int main() { int arr1[6] = {1, 3, 20, 4, 1, 0}; int arr2[5] = {2, 3, 4, 5, 6}; int arr3[6] = {8, 9, 11, 12, 14, 15}; assert(func0(arr1, 6) == 2); assert(func0(arr2, 5) == 4); assert(func0(arr3, 6) == 5); return 0; }
O3
c
func0: endbr64 mov %esi,%ecx lea -0x1(%rsi),%edx xor %esi,%esi jmpq 12a0 <find_peak_util>
func0: endbr64 mov ecx, esi lea edx, [rsi-1] xor esi, esi jmp find_peak_util
long long func0(long long a1, unsigned int a2) { return find_peak_util(a1, 0LL, a2 - 1, a2); }
func0: ENDBR64 MOV ECX,ESI LEA EDX,[RSI + -0x1] XOR ESI,ESI JMP 0x001012a0
void func0(int8 param_1,int param_2) { find_peak_util(param_1,0,param_2 + -1,param_2); return; }
5,760
func0
#include <assert.h> #include <stdio.h>
int func0(int deciNum) { int octalNum = 0; int countval = 1; int remainder; while (deciNum != 0) { remainder = deciNum % 8; octalNum += remainder * countval; countval *= 10; deciNum /= 8; } return octalNum; }
int main() { assert(func0(10) == 12); assert(func0(2) == 2); assert(func0(33) == 41); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) movl $0x0,-0xc(%rbp) movl $0x1,-0x8(%rbp) jmp 119f <func0+0x56> mov -0x14(%rbp),%eax cltd shr $0x1d,%edx add %edx,%eax and $0x7,%eax sub %edx,%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax imul -0x8(%rbp),%eax add %eax,-0xc(%rbp) mov -0x8(%rbp),%edx mov %edx,%eax shl $0x2,%eax add %edx,%eax add %eax,%eax mov %eax,-0x8(%rbp) mov -0x14(%rbp),%eax lea 0x7(%rax),%edx test %eax,%eax cmovs %edx,%eax sar $0x3,%eax mov %eax,-0x14(%rbp) cmpl $0x0,-0x14(%rbp) jne 1164 <func0+0x1b> mov -0xc(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_C], 0 mov [rbp+var_8], 1 jmp short loc_11A3 loc_1164: mov edx, [rbp+var_14] mov eax, edx sar eax, 1Fh shr eax, 1Dh add edx, eax and edx, 7 sub edx, eax mov [rbp+var_4], edx mov eax, [rbp+var_4] imul eax, [rbp+var_8] add [rbp+var_C], eax mov edx, [rbp+var_8] mov eax, edx shl eax, 2 add eax, edx add eax, eax mov [rbp+var_8], eax mov eax, [rbp+var_14] lea edx, [rax+7] test eax, eax cmovs eax, edx sar eax, 3 mov [rbp+var_14], eax loc_11A3: cmp [rbp+var_14], 0 jnz short loc_1164 mov eax, [rbp+var_C] pop rbp retn
long long func0(int a1) { unsigned int v3; // [rsp+8h] [rbp-Ch] int v4; // [rsp+Ch] [rbp-8h] v3 = 0; v4 = 1; while ( a1 ) { v3 += v4 * (a1 % 8); v4 *= 10; a1 /= 8; } return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x8],0x1 JMP 0x001011a3 LAB_00101164: MOV EDX,dword ptr [RBP + -0x14] MOV EAX,EDX SAR EAX,0x1f SHR EAX,0x1d ADD EDX,EAX AND EDX,0x7 SUB EDX,EAX MOV dword ptr [RBP + -0x4],EDX MOV EAX,dword ptr [RBP + -0x4] IMUL EAX,dword ptr [RBP + -0x8] ADD dword ptr [RBP + -0xc],EAX MOV EDX,dword ptr [RBP + -0x8] MOV EAX,EDX SHL EAX,0x2 ADD EAX,EDX ADD EAX,EAX MOV dword ptr [RBP + -0x8],EAX MOV EAX,dword ptr [RBP + -0x14] LEA EDX,[RAX + 0x7] TEST EAX,EAX CMOVS EAX,EDX SAR EAX,0x3 MOV dword ptr [RBP + -0x14],EAX LAB_001011a3: CMP dword ptr [RBP + -0x14],0x0 JNZ 0x00101164 MOV EAX,dword ptr [RBP + -0xc] POP RBP RET
int func0(int param_1) { int4 local_1c; int4 local_14; int4 local_10; local_14 = 0; local_10 = 1; for (local_1c = param_1; local_1c != 0; local_1c = local_1c >> 3) { local_14 = local_14 + (local_1c % 8) * local_10; local_10 = local_10 * 10; if (local_1c < 0) { local_1c = local_1c + 7; } } return local_14; }
5,761
func0
#include <assert.h> #include <stdio.h>
int func0(int deciNum) { int octalNum = 0; int countval = 1; int remainder; while (deciNum != 0) { remainder = deciNum % 8; octalNum += remainder * countval; countval *= 10; deciNum /= 8; } return octalNum; }
int main() { assert(func0(10) == 12); assert(func0(2) == 2); assert(func0(33) == 41); return 0; }
O1
c
func0: endbr64 mov %edi,%edx test %edi,%edi je 118c <func0+0x43> mov $0x1,%ecx mov $0x0,%r8d mov %edx,%esi sar $0x1f,%esi shr $0x1d,%esi lea (%rdx,%rsi,1),%eax and $0x7,%eax sub %esi,%eax imul %ecx,%eax add %eax,%r8d lea (%rcx,%rcx,4),%ecx add %ecx,%ecx lea 0x7(%rdx),%edi test %edx,%edx cmovns %edx,%edi sar $0x3,%edi mov %edi,%edx jne 115e <func0+0x15> mov %r8d,%eax retq mov %edi,%r8d jmp 1188 <func0+0x3f>
func0: endbr64 test edi, edi jz short loc_1187 mov edx, 1 mov esi, 0 loc_115B: mov ecx, edi sar ecx, 1Fh shr ecx, 1Dh lea eax, [rdi+rcx] and eax, 7 sub eax, ecx imul eax, edx add esi, eax lea edx, [rdx+rdx*4] add edx, edx lea eax, [rdi+7] test edi, edi cmovns eax, edi sar eax, 3 mov edi, eax jnz short loc_115B loc_1184: mov eax, esi retn loc_1187: mov esi, edi jmp short loc_1184
long long func0(int a1) { int v1; // eax int v2; // edx unsigned int v3; // esi if ( a1 ) { v2 = 1; v3 = 0; do { v3 += v2 * (a1 % 8); v2 *= 10; a1 /= 8; } while ( v1 >> 3 ); } else { return 0; } return v3; }
func0: ENDBR64 TEST EDI,EDI JZ 0x00101187 MOV EDX,0x1 MOV ESI,0x0 LAB_0010115b: MOV ECX,EDI SAR ECX,0x1f SHR ECX,0x1d LEA EAX,[RDI + RCX*0x1] AND EAX,0x7 SUB EAX,ECX IMUL EAX,EDX ADD ESI,EAX LEA EDX,[RDX + RDX*0x4] ADD EDX,EDX LEA EAX,[RDI + 0x7] TEST EDI,EDI CMOVNS EAX,EDI SAR EAX,0x3 MOV EDI,EAX JNZ 0x0010115b LAB_00101184: MOV EAX,ESI RET LAB_00101187: MOV ESI,EDI JMP 0x00101184
int func0(int param_1) { int iVar1; int iVar2; int iVar3; if (param_1 == 0) { iVar3 = 0; } else { iVar2 = 1; iVar3 = 0; do { iVar3 = iVar3 + (param_1 % 8) * iVar2; iVar2 = iVar2 * 10; iVar1 = param_1 + 7; if (-1 < param_1) { iVar1 = param_1; } param_1 = iVar1 >> 3; } while (param_1 != 0); } return iVar3; }
5,762
func0
#include <assert.h> #include <stdio.h>
int func0(int deciNum) { int octalNum = 0; int countval = 1; int remainder; while (deciNum != 0) { remainder = deciNum % 8; octalNum += remainder * countval; countval *= 10; deciNum /= 8; } return octalNum; }
int main() { assert(func0(10) == 12); assert(func0(2) == 2); assert(func0(33) == 41); return 0; }
O2
c
func0: endbr64 test %edi,%edi je 1180 <func0+0x40> mov $0x1,%edx xor %r8d,%r8d mov %edi,%ecx sar $0x1f,%ecx shr $0x1d,%ecx lea (%rdi,%rcx,1),%eax and $0x7,%eax sub %ecx,%eax imul %edx,%eax lea (%rdx,%rdx,4),%edx add %edx,%edx add %eax,%r8d test %edi,%edi lea 0x7(%rdi),%eax cmovs %eax,%edi sar $0x3,%edi jne 1150 <func0+0x10> mov %r8d,%eax retq nopl 0x0(%rax) xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 test edi, edi jz short loc_1180 mov edx, 1 xor r8d, r8d loc_1150: mov ecx, edi sar ecx, 1Fh shr ecx, 1Dh lea eax, [rdi+rcx] and eax, 7 sub eax, ecx imul eax, edx lea edx, [rdx+rdx*4] add edx, edx add r8d, eax test edi, edi lea eax, [rdi+7] cmovs edi, eax sar edi, 3 jnz short loc_1150 mov eax, r8d retn loc_1180: xor r8d, r8d mov eax, r8d retn
long long func0(int a1) { int v1; // edx unsigned int v2; // r8d int v3; // eax if ( !a1 ) return 0LL; v1 = 1; v2 = 0; do { v3 = v1 * (a1 % 8); v1 *= 10; v2 += v3; a1 /= 8; } while ( a1 ); return v2; }
func0: ENDBR64 TEST EDI,EDI JZ 0x00101180 MOV EDX,0x1 XOR R8D,R8D LAB_00101150: MOV ECX,EDI SAR ECX,0x1f SHR ECX,0x1d LEA EAX,[RDI + RCX*0x1] AND EAX,0x7 SUB EAX,ECX IMUL EAX,EDX LEA EDX,[RDX + RDX*0x4] ADD EDX,EDX ADD R8D,EAX TEST EDI,EDI LEA EAX,[RDI + 0x7] CMOVS EDI,EAX SAR EDI,0x3 JNZ 0x00101150 MOV EAX,R8D RET LAB_00101180: XOR R8D,R8D MOV EAX,R8D RET
int func0(int param_1) { int iVar1; int iVar2; int iVar3; if (param_1 != 0) { iVar2 = 1; iVar3 = 0; do { iVar1 = (param_1 % 8) * iVar2; iVar2 = iVar2 * 10; iVar3 = iVar3 + iVar1; if (param_1 < 0) { param_1 = param_1 + 7; } param_1 = param_1 >> 3; } while (param_1 != 0); return iVar3; } return 0; }
5,763
func0
#include <assert.h> #include <stdio.h>
int func0(int deciNum) { int octalNum = 0; int countval = 1; int remainder; while (deciNum != 0) { remainder = deciNum % 8; octalNum += remainder * countval; countval *= 10; deciNum /= 8; } return octalNum; }
int main() { assert(func0(10) == 12); assert(func0(2) == 2); assert(func0(33) == 41); return 0; }
O3
c
func0: endbr64 test %edi,%edi je 1180 <func0+0x40> mov $0x1,%edx xor %r8d,%r8d mov %edi,%ecx sar $0x1f,%ecx shr $0x1d,%ecx lea (%rdi,%rcx,1),%eax and $0x7,%eax sub %ecx,%eax imul %edx,%eax lea (%rdx,%rdx,4),%edx add %edx,%edx add %eax,%r8d test %edi,%edi lea 0x7(%rdi),%eax cmovs %eax,%edi sar $0x3,%edi jne 1150 <func0+0x10> mov %r8d,%eax retq nopl 0x0(%rax) xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 test edi, edi jz short loc_1180 mov edx, 1 xor esi, esi nop loc_1150: mov ecx, edi sar ecx, 1Fh shr ecx, 1Dh lea eax, [rdi+rcx] and eax, 7 sub eax, ecx imul eax, edx lea edx, [rdx+rdx*4] add edx, edx add esi, eax test edi, edi lea eax, [rdi+7] cmovs edi, eax sar edi, 3 jnz short loc_1150 mov eax, esi retn loc_1180: xor esi, esi mov eax, esi retn
long long func0(int a1) { int v1; // edx unsigned int v2; // esi int v3; // eax if ( !a1 ) return 0LL; v1 = 1; v2 = 0; do { v3 = v1 * (a1 % 8); v1 *= 10; v2 += v3; a1 /= 8; } while ( a1 ); return v2; }
func0: ENDBR64 TEST EDI,EDI JZ 0x00101180 MOV EDX,0x1 XOR ESI,ESI NOP LAB_00101150: MOV ECX,EDI SAR ECX,0x1f SHR ECX,0x1d LEA EAX,[RDI + RCX*0x1] AND EAX,0x7 SUB EAX,ECX IMUL EAX,EDX LEA EDX,[RDX + RDX*0x4] ADD EDX,EDX ADD ESI,EAX TEST EDI,EDI LEA EAX,[RDI + 0x7] CMOVS EDI,EAX SAR EDI,0x3 JNZ 0x00101150 MOV EAX,ESI RET LAB_00101180: XOR ESI,ESI MOV EAX,ESI RET
int func0(int param_1) { int iVar1; int iVar2; int iVar3; if (param_1 != 0) { iVar2 = 1; iVar3 = 0; do { iVar1 = (param_1 % 8) * iVar2; iVar2 = iVar2 * 10; iVar3 = iVar3 + iVar1; if (param_1 < 0) { param_1 = param_1 + 7; } param_1 = param_1 >> 3; } while (param_1 != 0); return iVar3; } return 0; }
5,764
func0
#include <stdio.h> #include <assert.h>
int func0(int arr[], int n) { int mpis[n]; for (int i = 0; i < n; i++) { mpis[i] = arr[i]; } for (int i = 1; i < n; i++) { for (int j = 0; j < i; j++) { if (arr[i] > arr[j] && mpis[i] < (mpis[j] * arr[i])) { mpis[i] = mpis[j] * arr[i]; } } } int maxVal = mpis[0]; for (int i = 1; i < n; i++) { if (mpis[i] > maxVal) { maxVal = mpis[i]; } } return maxVal; }
int main() { int arr1[] = {3, 100, 4, 5, 150, 6}; int arr2[] = {4, 42, 55, 68, 80}; int arr3[] = {10, 22, 9, 33, 21, 50, 41, 60}; assert(func0(arr1, 6) == 45000); assert(func0(arr2, 5) == 50265600); assert(func0(arr3, 8) == 21780000); printf("All tests passed!\n"); 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 %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax mov %rsp,%rax mov %rax,%rdi mov -0x4c(%rbp),%eax movslq %eax,%rdx sub $0x1,%rdx mov %rdx,-0x28(%rbp) movslq %eax,%rdx mov %rdx,%r8 mov $0x0,%r9d movslq %eax,%rdx mov %rdx,%rcx mov $0x0,%ebx cltq lea 0x0(,%rax,4),%rdx mov $0x10,%eax sub $0x1,%rax add %rdx,%rax mov $0x10,%ebx mov $0x0,%edx div %rbx imul $0x10,%rax,%rax mov %rax,%rdx and $0xfffffffffffff000,%rdx mov %rsp,%rbx sub %rdx,%rbx mov %rbx,%rdx cmp %rdx,%rsp je 1228 <func0+0x9f> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) jmp 1211 <func0+0x88> mov %rax,%rdx and $0xfff,%edx sub %rdx,%rsp mov %rax,%rdx and $0xfff,%edx test %rdx,%rdx je 1252 <func0+0xc9> and $0xfff,%eax sub $0x8,%rax add %rsp,%rax orq $0x0,(%rax) mov %rsp,%rax add $0x3,%rax shr $0x2,%rax shl $0x2,%rax mov %rax,-0x20(%rbp) movl $0x0,-0x30(%rbp) jmp 1295 <func0+0x10c> mov -0x30(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x48(%rbp),%rax add %rdx,%rax mov (%rax),%ecx mov -0x20(%rbp),%rax mov -0x30(%rbp),%edx movslq %edx,%rdx mov %ecx,(%rax,%rdx,4) addl $0x1,-0x30(%rbp) mov -0x30(%rbp),%eax cmp -0x4c(%rbp),%eax jl 126e <func0+0xe5> movl $0x1,-0x34(%rbp) jmpq 1365 <func0+0x1dc> movl $0x0,-0x38(%rbp) jmpq 1355 <func0+0x1cc> mov -0x34(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x48(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x38(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x48(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jle 1351 <func0+0x1c8> mov -0x20(%rbp),%rax mov -0x34(%rbp),%edx movslq %edx,%rdx mov (%rax,%rdx,4),%ecx mov -0x20(%rbp),%rax mov -0x38(%rbp),%edx movslq %edx,%rdx mov (%rax,%rdx,4),%edx mov -0x34(%rbp),%eax cltq lea 0x0(,%rax,4),%rsi mov -0x48(%rbp),%rax add %rsi,%rax mov (%rax),%eax imul %edx,%eax cmp %eax,%ecx jge 1351 <func0+0x1c8> mov -0x20(%rbp),%rax mov -0x38(%rbp),%edx movslq %edx,%rdx mov (%rax,%rdx,4),%edx mov -0x34(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x48(%rbp),%rax add %rcx,%rax mov (%rax),%eax mov %edx,%ecx imul %eax,%ecx mov -0x20(%rbp),%rax mov -0x34(%rbp),%edx movslq %edx,%rdx mov %ecx,(%rax,%rdx,4) addl $0x1,-0x38(%rbp) mov -0x38(%rbp),%eax cmp -0x34(%rbp),%eax jl 12b5 <func0+0x12c> addl $0x1,-0x34(%rbp) mov -0x34(%rbp),%eax cmp -0x4c(%rbp),%eax jl 12a9 <func0+0x120> mov -0x20(%rbp),%rax mov (%rax),%eax mov %eax,-0x3c(%rbp) movl $0x1,-0x2c(%rbp) jmp 13a9 <func0+0x220> mov -0x20(%rbp),%rax mov -0x2c(%rbp),%edx movslq %edx,%rdx mov (%rax,%rdx,4),%eax cmp %eax,-0x3c(%rbp) jge 13a5 <func0+0x21c> mov -0x20(%rbp),%rax mov -0x2c(%rbp),%edx movslq %edx,%rdx mov (%rax,%rdx,4),%eax mov %eax,-0x3c(%rbp) addl $0x1,-0x2c(%rbp) mov -0x2c(%rbp),%eax cmp -0x4c(%rbp),%eax jl 1383 <func0+0x1fa> mov -0x3c(%rbp),%eax mov %rdi,%rsp mov -0x18(%rbp),%rsi xor %fs:0x28,%rsi je 13cb <func0+0x242> callq 1080 <__stack_chk_fail@plt> mov -0x8(%rbp),%rbx leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_38], rdi mov [rbp+var_3C], esi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov rax, rsp mov rdi, rax mov eax, [rbp+var_3C] movsxd rdx, eax sub rdx, 1 mov [rbp+var_18], rdx cdqe lea rdx, ds:0[rax*4] mov eax, 10h sub rax, 1 add rax, rdx mov esi, 10h mov edx, 0 div rsi imul rax, 10h mov rcx, rax and rcx, 0FFFFFFFFFFFFF000h mov rdx, rsp sub rdx, rcx loc_11F6: cmp rsp, rdx jz short loc_120D sub rsp, 1000h or [rsp+1040h+var_48], 0 jmp short loc_11F6 loc_120D: mov rdx, rax and edx, 0FFFh sub rsp, rdx mov rdx, rax and edx, 0FFFh test rdx, rdx jz short loc_1237 and eax, 0FFFh sub rax, 8 add rax, rsp or qword ptr [rax], 0 loc_1237: mov rax, rsp add rax, 3 shr rax, 2 shl rax, 2 mov [rbp+var_10], rax mov [rbp+var_2C], 0 jmp short loc_127A loc_1253: mov eax, [rbp+var_2C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_38] add rax, rdx mov ecx, [rax] mov rax, [rbp+var_10] mov edx, [rbp+var_2C] movsxd rdx, edx mov [rax+rdx*4], ecx add [rbp+var_2C], 1 loc_127A: mov eax, [rbp+var_2C] cmp eax, [rbp+var_3C] jl short loc_1253 mov [rbp+var_28], 1 jmp loc_134A loc_128E: mov [rbp+var_24], 0 jmp loc_133A loc_129A: mov eax, [rbp+var_28] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_38] add rax, rdx mov edx, [rax] mov eax, [rbp+var_24] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_38] add rax, rcx mov eax, [rax] cmp edx, eax jle short loc_1336 mov rax, [rbp+var_10] mov edx, [rbp+var_28] movsxd rdx, edx mov ecx, [rax+rdx*4] mov rax, [rbp+var_10] mov edx, [rbp+var_24] movsxd rdx, edx mov edx, [rax+rdx*4] mov eax, [rbp+var_28] cdqe lea rsi, ds:0[rax*4] mov rax, [rbp+var_38] add rax, rsi mov eax, [rax] imul eax, edx cmp ecx, eax jge short loc_1336 mov rax, [rbp+var_10] mov edx, [rbp+var_24] movsxd rdx, edx mov edx, [rax+rdx*4] mov eax, [rbp+var_28] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_38] add rax, rcx mov eax, [rax] mov ecx, edx imul ecx, eax mov rax, [rbp+var_10] mov edx, [rbp+var_28] movsxd rdx, edx mov [rax+rdx*4], ecx loc_1336: add [rbp+var_24], 1 loc_133A: mov eax, [rbp+var_24] cmp eax, [rbp+var_28] jl loc_129A add [rbp+var_28], 1 loc_134A: mov eax, [rbp+var_28] cmp eax, [rbp+var_3C] jl loc_128E mov rax, [rbp+var_10] mov eax, [rax] mov [rbp+var_20], eax mov [rbp+var_1C], 1 jmp short loc_138E loc_1368: mov rax, [rbp+var_10] mov edx, [rbp+var_1C] movsxd rdx, edx mov eax, [rax+rdx*4] cmp [rbp+var_20], eax jge short loc_138A mov rax, [rbp+var_10] mov edx, [rbp+var_1C] movsxd rdx, edx mov eax, [rax+rdx*4] mov [rbp+var_20], eax loc_138A: add [rbp+var_1C], 1 loc_138E: mov eax, [rbp+var_1C] cmp eax, [rbp+var_3C] jl short loc_1368 mov eax, [rbp+var_20] mov rsp, rdi mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_13B0 call ___stack_chk_fail locret_13B0: leave retn
long long func0(long long a1, int a2) { unsigned long long v2; // rax void *v3; // rsp _BYTE v5[4]; // [rsp+8h] [rbp-40h] BYREF int v6; // [rsp+Ch] [rbp-3Ch] long long v7; // [rsp+10h] [rbp-38h] int i; // [rsp+1Ch] [rbp-2Ch] int j; // [rsp+20h] [rbp-28h] int k; // [rsp+24h] [rbp-24h] unsigned int v11; // [rsp+28h] [rbp-20h] int m; // [rsp+2Ch] [rbp-1Ch] long long v13; // [rsp+30h] [rbp-18h] unsigned int *v14; // [rsp+38h] [rbp-10h] unsigned long long v15; // [rsp+40h] [rbp-8h] v7 = a1; v6 = a2; v15 = __readfsqword(0x28u); v13 = a2 - 1LL; v2 = 16 * ((4LL * a2 + 15) / 0x10uLL); while ( v5 != &v5[-(v2 & 0xFFFFFFFFFFFFF000LL)] ) ; v3 = alloca(v2 & 0xFFF); if ( (v2 & 0xFFF) != 0 ) *(_QWORD *)&v5[(v2 & 0xFFF) - 8] = *(_QWORD *)&v5[(v2 & 0xFFF) - 8]; v14 = (unsigned int *)v5; for ( i = 0; i < v6; ++i ) v14[i] = *(_DWORD *)(4LL * i + v7); for ( j = 1; j < v6; ++j ) { for ( k = 0; k < j; ++k ) { if ( *(_DWORD *)(4LL * j + v7) > *(_DWORD *)(4LL * k + v7) && (int)v14[j] < (int)(v14[k] * *(_DWORD *)(4LL * j + v7)) ) { v14[j] = *(_DWORD *)(4LL * j + v7) * v14[k]; } } } v11 = *v14; for ( m = 1; m < v6; ++m ) { if ( (int)v11 < (int)v14[m] ) v11 = v14[m]; } return v11; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x38],RDI MOV dword ptr [RBP + -0x3c],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV RAX,RSP MOV RDI,RAX MOV EAX,dword ptr [RBP + -0x3c] MOVSXD RDX,EAX SUB RDX,0x1 MOV qword ptr [RBP + -0x18],RDX CDQE LEA RDX,[RAX*0x4] MOV EAX,0x10 SUB RAX,0x1 ADD RAX,RDX MOV ESI,0x10 MOV EDX,0x0 DIV RSI IMUL RAX,RAX,0x10 MOV RCX,RAX AND RCX,-0x1000 MOV RDX,RSP SUB RDX,RCX LAB_001011f6: CMP RSP,RDX JZ 0x0010120d SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 JMP 0x001011f6 LAB_0010120d: MOV RDX,RAX AND EDX,0xfff SUB RSP,RDX MOV RDX,RAX AND EDX,0xfff TEST RDX,RDX JZ 0x00101237 AND EAX,0xfff SUB RAX,0x8 ADD RAX,RSP OR qword ptr [RAX],0x0 LAB_00101237: MOV RAX,RSP ADD RAX,0x3 SHR RAX,0x2 SHL RAX,0x2 MOV qword ptr [RBP + -0x10],RAX MOV dword ptr [RBP + -0x2c],0x0 JMP 0x0010127a LAB_00101253: MOV EAX,dword ptr [RBP + -0x2c] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x38] ADD RAX,RDX MOV ECX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x2c] MOVSXD RDX,EDX MOV dword ptr [RAX + RDX*0x4],ECX ADD dword ptr [RBP + -0x2c],0x1 LAB_0010127a: MOV EAX,dword ptr [RBP + -0x2c] CMP EAX,dword ptr [RBP + -0x3c] JL 0x00101253 MOV dword ptr [RBP + -0x28],0x1 JMP 0x0010134a LAB_0010128e: MOV dword ptr [RBP + -0x24],0x0 JMP 0x0010133a LAB_0010129a: MOV EAX,dword ptr [RBP + -0x28] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x38] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x24] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x38] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JLE 0x00101336 MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x28] MOVSXD RDX,EDX MOV ECX,dword ptr [RAX + RDX*0x4] MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x24] MOVSXD RDX,EDX MOV EDX,dword ptr [RAX + RDX*0x4] MOV EAX,dword ptr [RBP + -0x28] CDQE LEA RSI,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x38] ADD RAX,RSI MOV EAX,dword ptr [RAX] IMUL EAX,EDX CMP ECX,EAX JGE 0x00101336 MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x24] MOVSXD RDX,EDX MOV EDX,dword ptr [RAX + RDX*0x4] MOV EAX,dword ptr [RBP + -0x28] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x38] ADD RAX,RCX MOV EAX,dword ptr [RAX] MOV ECX,EDX IMUL ECX,EAX MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x28] MOVSXD RDX,EDX MOV dword ptr [RAX + RDX*0x4],ECX LAB_00101336: ADD dword ptr [RBP + -0x24],0x1 LAB_0010133a: MOV EAX,dword ptr [RBP + -0x24] CMP EAX,dword ptr [RBP + -0x28] JL 0x0010129a ADD dword ptr [RBP + -0x28],0x1 LAB_0010134a: MOV EAX,dword ptr [RBP + -0x28] CMP EAX,dword ptr [RBP + -0x3c] JL 0x0010128e MOV RAX,qword ptr [RBP + -0x10] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x20],EAX MOV dword ptr [RBP + -0x1c],0x1 JMP 0x0010138e LAB_00101368: MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x1c] MOVSXD RDX,EDX MOV EAX,dword ptr [RAX + RDX*0x4] CMP dword ptr [RBP + -0x20],EAX JGE 0x0010138a MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x1c] MOVSXD RDX,EDX MOV EAX,dword ptr [RAX + RDX*0x4] MOV dword ptr [RBP + -0x20],EAX LAB_0010138a: ADD dword ptr [RBP + -0x1c],0x1 LAB_0010138e: MOV EAX,dword ptr [RBP + -0x1c] CMP EAX,dword ptr [RBP + -0x3c] JL 0x00101368 MOV EAX,dword ptr [RBP + -0x20] MOV RSP,RDI MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001013b0 CALL 0x00101080 LAB_001013b0: LEAVE RET
int func0(long param_1,int param_2) { long lVar1; ulong uVar2; int *puVar3; long in_FS_OFFSET; int auStack_48 [4]; int local_44; long local_40; int local_34; int local_30; int local_2c; int local_28; int local_24; long local_20; int *local_18; long local_10; local_40 = param_1; local_44 = param_2; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_20 = (long)param_2 + -1; uVar2 = (((long)param_2 * 4 + 0xfU) / 0x10) * 0x10; for (puVar3 = auStack_48; puVar3 != auStack_48 + -(uVar2 & 0xfffffffffffff000); puVar3 = puVar3 + -0x1000) { *(int8 *)(puVar3 + -8) = *(int8 *)(puVar3 + -8); } lVar1 = -(ulong)((uint)uVar2 & 0xfff); if ((uVar2 & 0xfff) != 0) { *(int8 *)(puVar3 + ((ulong)((uint)uVar2 & 0xfff) - 8) + lVar1) = *(int8 *)(puVar3 + ((ulong)((uint)uVar2 & 0xfff) - 8) + lVar1); } for (local_34 = 0; local_34 < local_44; local_34 = local_34 + 1) { *(int4 *)(puVar3 + (long)local_34 * 4 + lVar1) = *(int4 *)(local_40 + (long)local_34 * 4); } for (local_30 = 1; local_30 < local_44; local_30 = local_30 + 1) { for (local_2c = 0; local_2c < local_30; local_2c = local_2c + 1) { if (*(int *)(local_40 + (long)local_2c * 4) < *(int *)(local_40 + (long)local_30 * 4)) { if (*(int *)(puVar3 + (long)local_30 * 4 + lVar1) < *(int *)(local_40 + (long)local_30 * 4) * *(int *)(puVar3 + (long)local_2c * 4 + lVar1)) { *(int *)(puVar3 + (long)local_30 * 4 + lVar1) = *(int *)(puVar3 + (long)local_2c * 4 + lVar1) * *(int *)(local_40 + (long)local_30 * 4); } } } } local_28 = *(int *)(puVar3 + lVar1); for (local_24 = 1; local_24 < local_44; local_24 = local_24 + 1) { if (local_28 < *(int *)(puVar3 + (long)local_24 * 4 + lVar1)) { local_28 = *(int *)(puVar3 + (long)local_24 * 4 + lVar1); } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { local_18 = puVar3 + lVar1; /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_28; }
5,765
func0
#include <stdio.h> #include <assert.h>
int func0(int arr[], int n) { int mpis[n]; for (int i = 0; i < n; i++) { mpis[i] = arr[i]; } for (int i = 1; i < n; i++) { for (int j = 0; j < i; j++) { if (arr[i] > arr[j] && mpis[i] < (mpis[j] * arr[i])) { mpis[i] = mpis[j] * arr[i]; } } } int maxVal = mpis[0]; for (int i = 1; i < n; i++) { if (mpis[i] > maxVal) { maxVal = mpis[i]; } } return maxVal; }
int main() { int arr1[] = {3, 100, 4, 5, 150, 6}; int arr2[] = {4, 42, 55, 68, 80}; int arr3[] = {10, 22, 9, 33, 21, 50, 41, 60}; assert(func0(arr1, 6) == 45000); assert(func0(arr2, 5) == 50265600); assert(func0(arr3, 8) == 21780000); printf("All tests passed!\n"); return 0; }
O1
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x18,%rsp mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax movslq %esi,%rax lea 0xf(,%rax,4),%rax mov %rax,%rdx and $0xfffffffffffffff0,%rdx and $0xfffffffffffff000,%rax mov %rsp,%rbx sub %rax,%rbx mov %rbx,%rax cmp %rax,%rsp je 11dd <func0+0x54> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) jmp 11c6 <func0+0x3d> mov %rdx,%rax and $0xfff,%eax sub %rax,%rsp test %rax,%rax je 11f3 <func0+0x6a> orq $0x0,-0x8(%rsp,%rax,1) lea 0x3(%rsp),%r10 mov %r10,%r11 shr $0x2,%r11 and $0xfffffffffffffffc,%r10 mov %r10,%r8 test %esi,%esi jle 1225 <func0+0x9c> lea -0x1(%rsi),%ecx mov $0x0,%eax mov (%rdi,%rax,4),%edx mov %edx,(%r8,%rax,4) mov %rax,%rdx add $0x1,%rax cmp %rcx,%rdx jne 1212 <func0+0x89> cmp $0x1,%esi jle 12a8 <func0+0x11f> lea -0x2(%rsi),%ebx lea 0x2(%rbx),%r9 mov $0x1,%edx jmp 1262 <func0+0xd9> add $0x1,%rax cmp %rdx,%rax je 1259 <func0+0xd0> cmp (%rdi,%rax,4),%ecx jle 1238 <func0+0xaf> mov %ecx,%esi imul (%r8,%rax,4),%esi cmp %esi,(%r8,%rdx,4) jge 1238 <func0+0xaf> mov %esi,(%r8,%rdx,4) jmp 1238 <func0+0xaf> add $0x1,%rdx cmp %r9,%rdx je 1270 <func0+0xe7> test %edx,%edx jle 1259 <func0+0xd0> mov (%rdi,%rdx,4),%ecx mov $0x0,%eax jmp 1241 <func0+0xb8> mov 0x0(,%r11,4),%edx lea 0x4(%r10),%rax lea 0x8(%r10,%rbx,4),%rsi mov (%rax),%ecx cmp %ecx,%edx cmovl %ecx,%edx add $0x4,%rax cmp %rsi,%rax jne 1281 <func0+0xf8> mov -0x18(%rbp),%rax xor %fs:0x28,%rax jne 12b2 <func0+0x129> mov %edx,%eax mov -0x8(%rbp),%rbx leaveq retq mov 0x0(,%r11,4),%edx jmp 1291 <func0+0x108> callq 1080 <__stack_chk_fail@plt>
func0: endbr64 push rbp mov rbp, rsp sub rsp, 10h mov r9d, esi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax movsxd rax, esi lea rax, ds:0Fh[rax*4] mov rcx, rax and rcx, 0FFFFFFFFFFFFFFF0h and rax, 0FFFFFFFFFFFFF000h mov rdx, rsp sub rdx, rax loc_11C5: cmp rsp, rdx jz short loc_11DC sub rsp, 1000h or [rsp+1010h+var_18], 0 jmp short loc_11C5 loc_11DC: mov rax, rcx and eax, 0FFFh sub rsp, rax test rax, rax jz short loc_11F2 or [rsp+rax+10h+var_18], 0 loc_11F2: lea rsi, [rsp+10h+var_D] mov r11, rsi shr r11, 2 and rsi, 0FFFFFFFFFFFFFFFCh test r9d, r9d jle short loc_121E mov ecx, r9d mov eax, 0 loc_120F: mov edx, [rdi+rax*4] mov [rsi+rax*4], edx add rax, 1 cmp rax, rcx jnz short loc_120F loc_121E: cmp r9d, 1 jle short loc_129F lea r10d, [r9-2] mov r9d, r9d mov edx, 1 jmp short loc_125D loc_1232: add rax, 1 cmp rax, rdx jz short loc_1254 loc_123B: cmp ecx, [rdi+rax*4] jle short loc_1232 mov r8d, ecx imul r8d, [rsi+rax*4] cmp [rsi+rdx*4], r8d jge short loc_1232 mov [rsi+rdx*4], r8d jmp short loc_1232 loc_1254: add rdx, 1 cmp rdx, r9 jz short loc_126B loc_125D: test edx, edx jle short loc_1254 mov ecx, [rdi+rdx*4] mov eax, 0 jmp short loc_123B loc_126B: mov edx, ds:dword_0[r11*4] lea rax, [rsi+4] lea rsi, [rsi+r10*4+8] loc_127C: mov ecx, [rax] cmp edx, ecx cmovl edx, ecx add rax, 4 cmp rax, rsi jnz short loc_127C loc_128C: mov rax, [rbp+var_8] sub rax, fs:28h jnz short loc_12A9 mov eax, edx leave retn loc_129F: mov edx, ds:dword_0[r11*4] jmp short loc_128C loc_12A9: call ___stack_chk_fail
long long func0(long long a1, int a2) { signed long long v2; // rax void *v3; // rsp long long i; // rax long long j; // rdx long long v6; // rax int v7; // r8d int v8; // ecx unsigned int v9; // edx int *v10; // rax long long v12; // [rsp+0h] [rbp-18h] unsigned int v13; // [rsp+8h] [rbp-10h] BYREF int v14; // [rsp+Ch] [rbp-Ch] BYREF unsigned long long v15; // [rsp+10h] [rbp-8h] BYREF v15 = __readfsqword(0x28u); while ( &v13 != (unsigned int *)((char *)&v13 - ((4LL * a2 + 15) & 0xFFFFFFFFFFFFF000LL)) ) ; v2 = (4 * (_WORD)a2 + 15) & 0xFF0; v3 = alloca(v2); if ( ((4 * (_WORD)a2 + 15) & 0xFF0) != 0 ) *(long long *)((char *)&v12 + v2) = *(long long *)((char *)&v12 + v2); if ( a2 > 0 ) { for ( i = 0LL; i != a2; ++i ) *(&v13 + i) = *(_DWORD *)(a1 + 4 * i); } if ( a2 <= 1 ) { return v13; } else { for ( j = 1LL; j != a2; ++j ) { if ( (int)j > 0 ) { v8 = *(_DWORD *)(a1 + 4 * j); v6 = 0LL; do { if ( v8 > *(_DWORD *)(a1 + 4 * v6) ) { v7 = *(&v13 + v6) * v8; if ( (int)*(&v13 + j) < v7 ) *(&v13 + j) = v7; } ++v6; } while ( v6 != j ); } } v9 = v13; v10 = &v14; do { if ( (int)v9 < *v10 ) v9 = *v10; ++v10; } while ( v10 != (int *)((char *)&v15 + 4 * (unsigned int)(a2 - 2)) ); } return v9; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x10 MOV R9D,ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOVSXD RAX,ESI LEA RAX,[0xf + RAX*0x4] MOV RCX,RAX AND RCX,-0x10 AND RAX,-0x1000 MOV RDX,RSP SUB RDX,RAX LAB_001011c5: CMP RSP,RDX JZ 0x001011dc SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 JMP 0x001011c5 LAB_001011dc: MOV RAX,RCX AND EAX,0xfff SUB RSP,RAX TEST RAX,RAX JZ 0x001011f2 OR qword ptr [RSP + RAX*0x1 + -0x8],0x0 LAB_001011f2: LEA RSI,[RSP + 0x3] MOV R11,RSI SHR R11,0x2 AND RSI,-0x4 TEST R9D,R9D JLE 0x0010121e MOV ECX,R9D MOV EAX,0x0 LAB_0010120f: MOV EDX,dword ptr [RDI + RAX*0x4] MOV dword ptr [RSI + RAX*0x4],EDX ADD RAX,0x1 CMP RAX,RCX JNZ 0x0010120f LAB_0010121e: CMP R9D,0x1 JLE 0x0010129f LEA R10D,[R9 + -0x2] MOV R9D,R9D MOV EDX,0x1 JMP 0x0010125d LAB_00101232: ADD RAX,0x1 CMP RAX,RDX JZ 0x00101254 LAB_0010123b: CMP ECX,dword ptr [RDI + RAX*0x4] JLE 0x00101232 MOV R8D,ECX IMUL R8D,dword ptr [RSI + RAX*0x4] CMP dword ptr [RSI + RDX*0x4],R8D JGE 0x00101232 MOV dword ptr [RSI + RDX*0x4],R8D JMP 0x00101232 LAB_00101254: ADD RDX,0x1 CMP RDX,R9 JZ 0x0010126b LAB_0010125d: TEST EDX,EDX JLE 0x00101254 MOV ECX,dword ptr [RDI + RDX*0x4] MOV EAX,0x0 JMP 0x0010123b LAB_0010126b: MOV EDX,dword ptr [R11*0x4] LEA RAX,[RSI + 0x4] LEA RSI,[RSI + R10*0x4 + 0x8] LAB_0010127c: MOV ECX,dword ptr [RAX] CMP EDX,ECX CMOVL EDX,ECX ADD RAX,0x4 CMP RAX,RSI JNZ 0x0010127c LAB_0010128c: MOV RAX,qword ptr [RBP + -0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x001012a9 MOV EAX,EDX LEAVE RET LAB_0010129f: MOV EDX,dword ptr [R11*0x4] JMP 0x0010128c LAB_001012a9: CALL 0x00101080
int func0(long param_1,uint param_2) { long lVar1; ulong uVar2; ulong uVar3; int *piVar4; int iVar5; int1 *puVar6; int iVar7; long in_FS_OFFSET; int1 auStack_18 [8]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); uVar2 = (long)(int)param_2 * 4 + 0xf; for (puVar6 = auStack_18; puVar6 != auStack_18 + -(uVar2 & 0xfffffffffffff000); puVar6 = puVar6 + -0x1000) { *(int8 *)(puVar6 + -8) = *(int8 *)(puVar6 + -8); } uVar2 = (ulong)((uint)uVar2 & 0xff0); lVar1 = -uVar2; if (uVar2 != 0) { *(int8 *)(puVar6 + -8) = *(int8 *)(puVar6 + -8); } if (0 < (int)param_2) { uVar2 = 0; do { *(int4 *)(puVar6 + uVar2 * 4 + lVar1) = *(int4 *)(param_1 + uVar2 * 4); uVar2 = uVar2 + 1; } while (uVar2 != param_2); } if ((int)param_2 < 2) { iVar5 = *(int *)(((ulong)(puVar6 + lVar1 + 3) >> 2) * 4); } else { uVar2 = 1; do { if (0 < (int)uVar2) { iVar5 = *(int *)(param_1 + uVar2 * 4); uVar3 = 0; do { if (*(int *)(param_1 + uVar3 * 4) < iVar5) { iVar7 = iVar5 * *(int *)(puVar6 + uVar3 * 4 + lVar1); if (*(int *)(puVar6 + uVar2 * 4 + lVar1) < iVar7) { *(int *)(puVar6 + uVar2 * 4 + lVar1) = iVar7; } } uVar3 = uVar3 + 1; } while (uVar3 != uVar2); } uVar2 = uVar2 + 1; } while (uVar2 != param_2); iVar5 = *(int *)(((ulong)(puVar6 + lVar1 + 3) >> 2) * 4); piVar4 = (int *)(puVar6 + lVar1 + 4); do { if (iVar5 < *piVar4) { iVar5 = *piVar4; } piVar4 = piVar4 + 1; } while (piVar4 != (int *)(puVar6 + (ulong)(param_2 - 2) * 4 + lVar1 + 8)); } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar5; } /* WARNING: Subroutine does not return */ *(code **)(puVar6 + lVar1 + -8) = main; __stack_chk_fail(); }
5,766
func0
#include <stdio.h> #include <assert.h>
int func0(int arr[], int n) { int mpis[n]; for (int i = 0; i < n; i++) { mpis[i] = arr[i]; } for (int i = 1; i < n; i++) { for (int j = 0; j < i; j++) { if (arr[i] > arr[j] && mpis[i] < (mpis[j] * arr[i])) { mpis[i] = mpis[j] * arr[i]; } } } int maxVal = mpis[0]; for (int i = 1; i < n; i++) { if (mpis[i] > maxVal) { maxVal = mpis[i]; } } return maxVal; }
int main() { int arr1[] = {3, 100, 4, 5, 150, 6}; int arr2[] = {4, 42, 55, 68, 80}; int arr3[] = {10, 22, 9, 33, 21, 50, 41, 60}; assert(func0(arr1, 6) == 45000); assert(func0(arr2, 5) == 50265600); assert(func0(arr3, 8) == 21780000); printf("All tests passed!\n"); return 0; }
O2
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax movslq %esi,%rax mov %rsp,%rcx lea 0xf(,%rax,4),%rax mov %rax,%rdx and $0xfffffffffffff000,%rax sub %rax,%rcx and $0xfffffffffffffff0,%rdx mov %rcx,%rax cmp %rax,%rsp je 1356 <func0+0x56> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 1341 <func0+0x41> and $0xfff,%edx sub %rdx,%rsp test %rdx,%rdx jne 141e <func0+0x11e> lea 0x3(%rsp),%r8 lea -0x1(%rsi),%ecx xor %eax,%eax mov %r8,%r9 and $0xfffffffffffffffc,%r8 shr $0x2,%r9 test %esi,%esi jle 1429 <func0+0x129> nopl (%rax) mov (%rdi,%rax,4),%edx mov %edx,(%r8,%rax,4) mov %rax,%rdx add $0x1,%rax cmp %rcx,%rdx jne 1388 <func0+0x88> mov 0x0(,%r9,4),%r9d cmp $0x1,%esi jle 140a <func0+0x10a> lea -0x2(%rsi),%r11d mov $0x1,%edx lea 0x2(%r11),%r10 nopl (%rax) mov (%rdi,%rdx,4),%ecx xor %eax,%eax nopl (%rax) cmp (%rdi,%rax,4),%ecx jle 13d6 <func0+0xd6> mov (%r8,%rax,4),%esi imul %ecx,%esi cmp %esi,(%r8,%rdx,4) jge 13d6 <func0+0xd6> mov %esi,(%r8,%rdx,4) add $0x1,%rax cmp %rdx,%rax jne 13c0 <func0+0xc0> lea 0x1(%rax),%rdx cmp %rdx,%r10 jne 13b8 <func0+0xb8> lea 0x4(%r8),%rax lea 0x8(%r8,%r11,4),%rcx nopl 0x0(%rax) mov (%rax),%edx cmp %edx,%r9d cmovl %edx,%r9d add $0x4,%rax cmp %rax,%rcx jne 13f8 <func0+0xf8> mov -0x8(%rbp),%rax xor %fs:0x28,%rax jne 1433 <func0+0x133> leaveq mov %r9d,%eax retq orq $0x0,-0x8(%rsp,%rdx,1) jmpq 1368 <func0+0x68> mov 0x0(,%r9,4),%r9d jmp 140a <func0+0x10a> callq 1080 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push rbp movsxd rdx, esi mov rbp, rsp push r13 push r12 mov r12, rdx push rbx mov rbx, rdi sub rsp, 18h mov rax, fs:28h mov [rbp+var_28], rax xor eax, eax lea rax, ds:0Fh[rdx*4] mov rsi, rsp mov rcx, rax and rax, 0FFFFFFFFFFFFF000h sub rsi, rax and rcx, 0FFFFFFFFFFFFFFF0h cmp rsp, rsi jz short loc_137E loc_1369: sub rsp, 1000h or [rsp+1030h+var_38], 0 cmp rsp, rsi jnz short loc_1369 loc_137E: and ecx, 0FFFh sub rsp, rcx test rcx, rcx jnz loc_143F loc_1390: lea rdi, [rsp+1030h+var_102D] mov r13, rdi and rdi, 0FFFFFFFFFFFFFFFCh shr r13, 2 test r12d, r12d jle loc_144A shl rdx, 2 mov rsi, rbx call _memcpy mov r8d, ds:dword_0[r13*4] mov rdi, rax cmp r12d, 1 jle short loc_1422 lea r10d, [r12-2] mov r9d, r12d mov edx, 1 nop dword ptr [rax+rax+00h] loc_13D8: mov ecx, [rbx+rdx*4] xor eax, eax nop dword ptr [rax] loc_13E0: cmp ecx, [rbx+rax*4] jle short loc_13F3 mov esi, [rdi+rax*4] imul esi, ecx cmp [rdi+rdx*4], esi jge short loc_13F3 mov [rdi+rdx*4], esi loc_13F3: add rax, 1 cmp rax, rdx jnz short loc_13E0 lea rdx, [rax+1] cmp rdx, r9 jnz short loc_13D8 lea rax, [rdi+4] lea rcx, [rdi+r10*4+8] xchg ax, ax loc_1410: mov edx, [rax] cmp r8d, edx cmovl r8d, edx add rax, 4 cmp rcx, rax jnz short loc_1410 loc_1422: mov rax, [rbp+var_28] sub rax, fs:28h jnz short loc_1454 lea rsp, [rbp-18h] mov eax, r8d pop rbx pop r12 pop r13 pop rbp retn loc_143F: or [rsp+rcx+1030h+var_1038], 0 jmp loc_1390 loc_144A: mov r8d, ds:dword_0[r13*4] jmp short loc_1422 loc_1454: call ___stack_chk_fail
long long func0(long long a1, int a2) { long long v2; // rdx long long v5; // rcx unsigned long long v6; // rax _DWORD *v7; // rsi __int16 v8; // cx signed long long v9; // rcx void *v10; // rsp long long v11; // rax unsigned int v12; // r8d long long v13; // rdi long long v14; // rdx int v15; // ecx long long v16; // rax int v17; // esi unsigned int *v18; // rax _DWORD v21[1022]; // [rsp+8h] [rbp-1030h] BYREF _QWORD v22[6]; // [rsp+1008h] [rbp-30h] BYREF v2 = a2; v22[1] = __readfsqword(0x28u); v5 = 4LL * a2 + 15; v6 = v5 & 0xFFFFFFFFFFFFF000LL; v7 = (_DWORD *)((char *)v22 - (v5 & 0xFFFFFFFFFFFFF000LL)); v8 = v5 & 0xFFF0; if ( v22 != (_QWORD *)((char *)v22 - v6) ) { while ( v21 != v7 ) ; } v9 = v8 & 0xFFF; v10 = alloca(v9); if ( v9 ) *(_QWORD *)((char *)&v21[-2] + v9) = *(_QWORD *)((char *)&v21[-2] + v9); if ( a2 <= 0 ) { return v21[0]; } else { v11 = memcpy(v21, a1, 4 * v2); v12 = v21[0]; v13 = v11; if ( a2 > 1 ) { v14 = 1LL; do { v15 = *(_DWORD *)(a1 + 4 * v14); v16 = 0LL; do { if ( v15 > *(_DWORD *)(a1 + 4 * v16) ) { v17 = v15 * *(_DWORD *)(v13 + 4 * v16); if ( *(_DWORD *)(v13 + 4 * v14) < v17 ) *(_DWORD *)(v13 + 4 * v14) = v17; } ++v16; } while ( v16 != v14 ); v14 = v16 + 1; } while ( v16 + 1 != a2 ); v18 = (unsigned int *)(v13 + 4); do { if ( (int)v12 < (int)*v18 ) v12 = *v18; ++v18; } while ( (unsigned int *)(v13 + 4LL * (unsigned int)(a2 - 2) + 8) != v18 ); } } return v12; }
func0: ENDBR64 PUSH RBP MOVSXD RDX,ESI MOV RBP,RSP PUSH R13 PUSH R12 MOV R12,RDX PUSH RBX MOV RBX,RDI SUB RSP,0x18 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x28],RAX XOR EAX,EAX LEA RAX,[0xf + RDX*0x4] MOV RSI,RSP MOV RCX,RAX AND RAX,-0x1000 SUB RSI,RAX AND RCX,-0x10 CMP RSP,RSI JZ 0x0010137e LAB_00101369: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RSI JNZ 0x00101369 LAB_0010137e: AND ECX,0xfff SUB RSP,RCX TEST RCX,RCX JNZ 0x0010143f LAB_00101390: LEA RDI,[RSP + 0x3] MOV R13,RDI AND RDI,-0x4 SHR R13,0x2 TEST R12D,R12D JLE 0x0010144a SHL RDX,0x2 MOV RSI,RBX CALL 0x001010b0 MOV R8D,dword ptr [R13*0x4] MOV RDI,RAX CMP R12D,0x1 JLE 0x00101422 LEA R10D,[R12 + -0x2] MOV R9D,R12D MOV EDX,0x1 NOP dword ptr [RAX + RAX*0x1] LAB_001013d8: MOV ECX,dword ptr [RBX + RDX*0x4] XOR EAX,EAX NOP dword ptr [RAX] LAB_001013e0: CMP ECX,dword ptr [RBX + RAX*0x4] JLE 0x001013f3 MOV ESI,dword ptr [RDI + RAX*0x4] IMUL ESI,ECX CMP dword ptr [RDI + RDX*0x4],ESI JGE 0x001013f3 MOV dword ptr [RDI + RDX*0x4],ESI LAB_001013f3: ADD RAX,0x1 CMP RAX,RDX JNZ 0x001013e0 LEA RDX,[RAX + 0x1] CMP RDX,R9 JNZ 0x001013d8 LEA RAX,[RDI + 0x4] LEA RCX,[RDI + R10*0x4 + 0x8] NOP LAB_00101410: MOV EDX,dword ptr [RAX] CMP R8D,EDX CMOVL R8D,EDX ADD RAX,0x4 CMP RCX,RAX JNZ 0x00101410 LAB_00101422: MOV RAX,qword ptr [RBP + -0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101454 LEA RSP,[RBP + -0x18] MOV EAX,R8D POP RBX POP R12 POP R13 POP RBP RET LAB_0010143f: OR qword ptr [RSP + RCX*0x1 + -0x8],0x0 JMP 0x00101390 LAB_0010144a: MOV R8D,dword ptr [R13*0x4] JMP 0x00101422 LAB_00101454: CALL 0x00101090
int func0(void *param_1,uint param_2) { int iVar1; long lVar2; int1 *puVar3; ulong uVar4; void *pvVar5; ulong uVar6; int *piVar7; ulong uVar8; int1 *puVar9; int iVar11; int iVar12; long in_FS_OFFSET; int1 auStack_38 [8]; long local_30; int1 *puVar10; puVar9 = auStack_38; local_30 = *(long *)(in_FS_OFFSET + 0x28); uVar8 = (long)(int)param_2 * 4 + 0xf; puVar10 = auStack_38; puVar3 = auStack_38; while (puVar10 != auStack_38 + -(uVar8 & 0xfffffffffffff000)) { puVar9 = puVar3 + -0x1000; *(int8 *)(puVar3 + -8) = *(int8 *)(puVar3 + -8); puVar10 = puVar3 + -0x1000; puVar3 = puVar3 + -0x1000; } uVar8 = (ulong)((uint)uVar8 & 0xff0); lVar2 = -uVar8; if (uVar8 != 0) { *(int8 *)(puVar9 + -8) = *(int8 *)(puVar9 + -8); } if ((int)param_2 < 1) { iVar12 = *(int *)(((ulong)(puVar9 + lVar2 + 3) >> 2) * 4); } else { *(int8 *)(puVar9 + lVar2 + -8) = 0x1013b5; pvVar5 = memcpy(puVar9 + lVar2,param_1,(long)(int)param_2 << 2); iVar12 = *(int *)(((ulong)(puVar9 + lVar2 + 3) >> 2) * 4); if (1 < (int)param_2) { uVar8 = 1; do { iVar1 = *(int *)((long)param_1 + uVar8 * 4); uVar4 = 0; do { uVar6 = uVar4; if ((*(int *)((long)param_1 + uVar6 * 4) < iVar1) && (iVar11 = *(int *)((long)pvVar5 + uVar6 * 4) * iVar1, *(int *)((long)pvVar5 + uVar8 * 4) < iVar11)) { *(int *)((long)pvVar5 + uVar8 * 4) = iVar11; } uVar4 = uVar6 + 1; } while (uVar6 + 1 != uVar8); uVar8 = uVar6 + 2; } while (uVar8 != param_2); piVar7 = (int *)((long)pvVar5 + 4); do { if (iVar12 < *piVar7) { iVar12 = *piVar7; } piVar7 = piVar7 + 1; } while ((int *)((long)pvVar5 + (ulong)(param_2 - 2) * 4 + 8) != piVar7); } } if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(int8 *)(puVar9 + lVar2 + -8) = 0x101459; __stack_chk_fail(); } return iVar12; }
5,767
func0
#include <stdio.h> #include <assert.h>
int func0(int arr[], int n) { int mpis[n]; for (int i = 0; i < n; i++) { mpis[i] = arr[i]; } for (int i = 1; i < n; i++) { for (int j = 0; j < i; j++) { if (arr[i] > arr[j] && mpis[i] < (mpis[j] * arr[i])) { mpis[i] = mpis[j] * arr[i]; } } } int maxVal = mpis[0]; for (int i = 1; i < n; i++) { if (mpis[i] > maxVal) { maxVal = mpis[i]; } } return maxVal; }
int main() { int arr1[] = {3, 100, 4, 5, 150, 6}; int arr2[] = {4, 42, 55, 68, 80}; int arr3[] = {10, 22, 9, 33, 21, 50, 41, 60}; assert(func0(arr1, 6) == 45000); assert(func0(arr2, 5) == 50265600); assert(func0(arr3, 8) == 21780000); printf("All tests passed!\n"); return 0; }
O3
c
func0: endbr64 push %rbp mov %rsp,%rbp push %r14 push %r13 push %r12 mov %esi,%r12d push %rbx mov %rdi,%rbx sub $0x10,%rsp mov %fs:0x28,%rax mov %rax,-0x28(%rbp) xor %eax,%eax movslq %esi,%rax mov %rsp,%rdi lea 0xf(,%rax,4),%rax mov %rax,%rdx and $0xfffffffffffff000,%rax sub %rax,%rdi and $0xfffffffffffffff0,%rdx mov %rdi,%rax cmp %rax,%rsp je 1343 <func0+0x63> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 132e <func0+0x4e> and $0xfff,%edx sub %rdx,%rsp test %rdx,%rdx jne 14d8 <func0+0x1f8> lea 0x3(%rsp),%rdi mov %rdi,%r14 and $0xfffffffffffffffc,%rdi shr $0x2,%r14 test %r12d,%r12d jle 14e3 <func0+0x203> lea -0x1(%r12),%eax mov %rbx,%rsi lea 0x4(,%rax,4),%rdx mov %rax,%r13 callq 10b0 <memcpy@plt> mov 0x0(,%r14,4),%r8d mov %rax,%rdi cmp $0x1,%r12d jle 14b9 <func0+0x1d9> lea -0x2(%r12),%r9d mov $0x1,%edx mov %r9,%r10 add $0x2,%r9 nopl 0x0(%rax) mov (%rbx,%rdx,4),%ecx xor %eax,%eax nopl (%rax) cmp (%rbx,%rax,4),%ecx jle 13cb <func0+0xeb> mov (%rdi,%rax,4),%esi imul %ecx,%esi cmp %esi,(%rdi,%rdx,4) jge 13cb <func0+0xeb> mov %esi,(%rdi,%rdx,4) add $0x1,%rax cmp %rdx,%rax jne 13b8 <func0+0xd8> lea 0x1(%rax),%rdx cmp %r9,%rdx jne 13b0 <func0+0xd0> cmp $0x2,%r10d jbe 14ed <func0+0x20d> mov %r13d,%edx movd %r8d,%xmm4 mov %rdi,%rax shr $0x2,%edx pshufd $0x0,%xmm4,%xmm2 shl $0x4,%rdx add %rdi,%rdx nopl 0x0(%rax) movdqu 0x4(%rax),%xmm0 add $0x10,%rax movdqa %xmm0,%xmm1 pcmpgtd %xmm2,%xmm1 pand %xmm1,%xmm0 pandn %xmm2,%xmm1 movdqa %xmm1,%xmm2 por %xmm0,%xmm2 cmp %rdx,%rax jne 1408 <func0+0x128> movdqa %xmm2,%xmm0 mov %r13d,%edx psrldq $0x8,%xmm0 and $0xfffffffc,%edx movdqa %xmm0,%xmm1 movdqa %xmm0,%xmm3 lea 0x1(%rdx),%eax pcmpgtd %xmm2,%xmm1 movdqa %xmm1,%xmm0 pand %xmm1,%xmm3 pandn %xmm2,%xmm0 por %xmm3,%xmm0 movdqa %xmm0,%xmm2 psrldq $0x4,%xmm2 movdqa %xmm2,%xmm1 pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm2 pandn %xmm0,%xmm1 por %xmm2,%xmm1 movd %xmm1,%r8d cmp %r13d,%edx je 14b9 <func0+0x1d9> movslq %eax,%rdx mov (%rdi,%rdx,4),%edx cmp %edx,%r8d cmovl %edx,%r8d lea 0x1(%rax),%edx cmp %edx,%r12d jle 14b9 <func0+0x1d9> movslq %edx,%rdx mov (%rdi,%rdx,4),%edx cmp %edx,%r8d cmovl %edx,%r8d add $0x2,%eax cmp %eax,%r12d jle 14b9 <func0+0x1d9> cltq mov (%rdi,%rax,4),%eax cmp %eax,%r8d cmovl %eax,%r8d mov -0x28(%rbp),%rax xor %fs:0x28,%rax jne 14f4 <func0+0x214> lea -0x20(%rbp),%rsp mov %r8d,%eax pop %rbx pop %r12 pop %r13 pop %r14 pop %rbp retq orq $0x0,-0x8(%rsp,%rdx,1) jmpq 1355 <func0+0x75> mov 0x0(,%r14,4),%r8d jmp 14b9 <func0+0x1d9> mov $0x1,%eax jmp 1483 <func0+0x1a3> callq 1090 <__stack_chk_fail@plt> nopl 0x0(%rax)
func0: endbr64 push rbp mov rbp, rsp push r15 push r14 push r13 push r12 mov r12d, esi push rbx mov rbx, rdi sub rsp, 18h mov rax, fs:28h mov [rbp+var_38], rax xor eax, eax movsxd rax, esi mov rcx, rsp lea rax, ds:0Fh[rax*4] mov rdx, rax and rax, 0FFFFFFFFFFFFF000h sub rcx, rax and rdx, 0FFFFFFFFFFFFFFF0h cmp rsp, rcx jz short loc_1342 loc_132D: sub rsp, 1000h or [rsp+1040h+var_48], 0 cmp rsp, rcx jnz short loc_132D loc_1342: and edx, 0FFFh sub rsp, rdx test rdx, rdx jnz loc_14C9 loc_1354: lea rdi, [rsp+1040h+var_103D] mov r14, rdi and rdi, 0FFFFFFFFFFFFFFFCh; dest shr r14, 2 test r12d, r12d jle loc_14DB mov r15d, r12d mov rsi, rbx; src lea r13d, [r12-1] shl r15, 2 mov rdx, r15; n call _memcpy mov r8d, ds:dword_0[r14*4] mov rdi, rax cmp r12d, 1 jz loc_14A8 lea r9d, [r12-2] mov edx, 4 nop dword ptr [rax+rax+00h] loc_13A8: mov ecx, [rbx+rdx] xor eax, eax nop dword ptr [rax] loc_13B0: cmp ecx, [rbx+rax] jle short loc_13C3 mov esi, [rdi+rax] imul esi, ecx cmp [rdi+rdx], esi jge short loc_13C3 mov [rdi+rdx], esi loc_13C3: add rax, 4 cmp rax, rdx jnz short loc_13B0 lea rdx, [rax+4] cmp rdx, r15 jnz short loc_13A8 cmp r9d, 2 jbe loc_14D4 mov edx, r13d movd xmm3, r8d mov rax, rdi shr edx, 2 pshufd xmm2, xmm3, 0 shl rdx, 4 add rdx, rdi nop dword ptr [rax+00000000h] loc_1400: movdqu xmm0, xmmword ptr [rax+4] add rax, 10h movdqa xmm1, xmm0 pcmpgtd xmm1, xmm2 pand xmm0, xmm1 pandn xmm1, xmm2 movdqa xmm2, xmm1 por xmm2, xmm0 cmp rdx, rax jnz short loc_1400 movdqa xmm1, xmm2 mov eax, r13d psrldq xmm1, 8 and eax, 0FFFFFFFCh movdqa xmm0, xmm1 add eax, 1 and r13d, 3 pcmpgtd xmm0, xmm2 pand xmm1, xmm0 pandn xmm0, xmm2 por xmm0, xmm1 movdqa xmm2, xmm0 psrldq xmm2, 4 movdqa xmm1, xmm2 pcmpgtd xmm1, xmm0 pand xmm2, xmm1 pandn xmm1, xmm0 por xmm1, xmm2 movd r8d, xmm1 jz short loc_14A8 loc_1474: movsxd rdx, eax lea rdx, [rdi+rdx*4] mov ecx, [rdx] cmp r8d, ecx cmovl r8d, ecx lea ecx, [rax+1] cmp r12d, ecx jle short loc_14A8 mov ecx, [rdx+4] cmp r8d, ecx cmovl r8d, ecx add eax, 2 cmp r12d, eax jle short loc_14A8 mov eax, [rdx+8] cmp r8d, eax cmovl r8d, eax loc_14A8: mov rax, [rbp+var_38] sub rax, fs:28h jnz short loc_14E5 lea rsp, [rbp-28h] mov eax, r8d pop rbx pop r12 pop r13 pop r14 pop r15 pop rbp retn loc_14C9: or [rsp+rdx+1040h+var_1048], 0 jmp loc_1354 loc_14D4: mov eax, 1 jmp short loc_1474 loc_14DB: mov r8d, ds:dword_0[r14*4] jmp short loc_14A8 loc_14E5: call ___stack_chk_fail
long long func0(char *src, int a2) { long long v4; // rdx _DWORD *v5; // rcx __int16 v6; // dx signed long long v7; // rdx void *v8; // rsp unsigned int v9; // r13d char *v10; // rax signed int v11; // r8d char *v12; // rdi long long v13; // rdx int v14; // ecx long long v15; // rax int v16; // esi char *v17; // rax __m128i v18; // xmm2 __m128i v19; // xmm0 __m128i v20; // xmm1 __m128i v21; // xmm1 signed int v22; // eax __m128i v23; // xmm0 __m128i v24; // xmm0 __m128i v25; // xmm2 __m128i v26; // xmm1 signed int *v27; // rdx _DWORD v30[1022]; // [rsp+8h] [rbp-1040h] BYREF _QWORD v31[8]; // [rsp+1008h] [rbp-40h] BYREF v31[1] = __readfsqword(0x28u); v4 = 4LL * a2 + 15; v5 = (_DWORD *)((char *)v31 - (v4 & 0xFFFFFFFFFFFFF000LL)); v6 = v4 & 0xFFF0; if ( v31 != (_QWORD *)v5 ) { while ( v30 != v5 ) ; } v7 = v6 & 0xFFF; v8 = alloca(v7); if ( v7 ) *(_QWORD *)((char *)&v30[-2] + v7) = *(_QWORD *)((char *)&v30[-2] + v7); if ( a2 <= 0 ) return (unsigned int)v30[0]; v9 = a2 - 1; v10 = (char *)memcpy(v30, src, 4LL * (unsigned int)a2); v11 = v30[0]; v12 = v10; if ( a2 != 1 ) { v13 = 4LL; do { v14 = *(_DWORD *)&src[v13]; v15 = 0LL; do { if ( v14 > *(_DWORD *)&src[v15] ) { v16 = v14 * *(_DWORD *)&v12[v15]; if ( *(_DWORD *)&v12[v13] < v16 ) *(_DWORD *)&v12[v13] = v16; } v15 += 4LL; } while ( v15 != v13 ); v13 = v15 + 4; } while ( v15 + 4 != 4LL * (unsigned int)a2 ); if ( (unsigned int)(a2 - 2) <= 2 ) { v22 = 1; } else { v17 = v12; v18 = _mm_shuffle_epi32(_mm_cvtsi32_si128(v11), 0); do { v19 = _mm_loadu_si128((const __m128i *)(v17 + 4)); v17 += 16; v20 = _mm_cmpgt_epi32(v19, v18); v18 = _mm_or_si128(_mm_andnot_si128(v20, v18), _mm_and_si128(v19, v20)); } while ( &v12[16 * (v9 >> 2)] != v17 ); v21 = _mm_srli_si128(v18, 8); v22 = (v9 & 0xFFFFFFFC) + 1; v23 = _mm_cmpgt_epi32(v21, v18); v24 = _mm_or_si128(_mm_andnot_si128(v23, v18), _mm_and_si128(v21, v23)); v25 = _mm_srli_si128(v24, 4); v26 = _mm_cmpgt_epi32(v25, v24); v11 = _mm_cvtsi128_si32(_mm_or_si128(_mm_andnot_si128(v26, v24), _mm_and_si128(v25, v26))); if ( (v9 & 3) == 0 ) return (unsigned int)v11; } v27 = (signed int *)&v12[4 * v22]; if ( v11 < *v27 ) v11 = *v27; if ( a2 > v22 + 1 ) { if ( v11 < v27[1] ) v11 = v27[1]; if ( a2 > v22 + 2 && v11 < v27[2] ) return (unsigned int)v27[2]; } } return (unsigned int)v11; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R15 PUSH R14 PUSH R13 PUSH R12 MOV R12D,ESI PUSH RBX MOV RBX,RDI SUB RSP,0x18 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x38],RAX XOR EAX,EAX MOVSXD RAX,ESI MOV RCX,RSP LEA RAX,[0xf + RAX*0x4] MOV RDX,RAX AND RAX,-0x1000 SUB RCX,RAX AND RDX,-0x10 CMP RSP,RCX JZ 0x00101342 LAB_0010132d: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RCX JNZ 0x0010132d LAB_00101342: AND EDX,0xfff SUB RSP,RDX TEST RDX,RDX JNZ 0x001014c9 LAB_00101354: LEA RDI,[RSP + 0x3] MOV R14,RDI AND RDI,-0x4 SHR R14,0x2 TEST R12D,R12D JLE 0x001014db MOV R15D,R12D MOV RSI,RBX LEA R13D,[R12 + -0x1] SHL R15,0x2 MOV RDX,R15 CALL 0x001010b0 MOV R8D,dword ptr [R14*0x4] MOV RDI,RAX CMP R12D,0x1 JZ 0x001014a8 LEA R9D,[R12 + -0x2] MOV EDX,0x4 NOP dword ptr [RAX + RAX*0x1] LAB_001013a8: MOV ECX,dword ptr [RBX + RDX*0x1] XOR EAX,EAX NOP dword ptr [RAX] LAB_001013b0: CMP ECX,dword ptr [RBX + RAX*0x1] JLE 0x001013c3 MOV ESI,dword ptr [RDI + RAX*0x1] IMUL ESI,ECX CMP dword ptr [RDI + RDX*0x1],ESI JGE 0x001013c3 MOV dword ptr [RDI + RDX*0x1],ESI LAB_001013c3: ADD RAX,0x4 CMP RAX,RDX JNZ 0x001013b0 LEA RDX,[RAX + 0x4] CMP RDX,R15 JNZ 0x001013a8 CMP R9D,0x2 JBE 0x001014d4 MOV EDX,R13D MOVD XMM3,R8D MOV RAX,RDI SHR EDX,0x2 PSHUFD XMM2,XMM3,0x0 SHL RDX,0x4 ADD RDX,RDI NOP dword ptr [RAX] LAB_00101400: MOVDQU XMM0,xmmword ptr [RAX + 0x4] ADD RAX,0x10 MOVDQA XMM1,XMM0 PCMPGTD XMM1,XMM2 PAND XMM0,XMM1 PANDN XMM1,XMM2 MOVDQA XMM2,XMM1 POR XMM2,XMM0 CMP RDX,RAX JNZ 0x00101400 MOVDQA XMM1,XMM2 MOV EAX,R13D PSRLDQ XMM1,0x8 AND EAX,0xfffffffc MOVDQA XMM0,XMM1 ADD EAX,0x1 AND R13D,0x3 PCMPGTD XMM0,XMM2 PAND XMM1,XMM0 PANDN XMM0,XMM2 POR XMM0,XMM1 MOVDQA XMM2,XMM0 PSRLDQ XMM2,0x4 MOVDQA XMM1,XMM2 PCMPGTD XMM1,XMM0 PAND XMM2,XMM1 PANDN XMM1,XMM0 POR XMM1,XMM2 MOVD R8D,XMM1 JZ 0x001014a8 LAB_00101474: MOVSXD RDX,EAX LEA RDX,[RDI + RDX*0x4] MOV ECX,dword ptr [RDX] CMP R8D,ECX CMOVL R8D,ECX LEA ECX,[RAX + 0x1] CMP R12D,ECX JLE 0x001014a8 MOV ECX,dword ptr [RDX + 0x4] CMP R8D,ECX CMOVL R8D,ECX ADD EAX,0x2 CMP R12D,EAX JLE 0x001014a8 MOV EAX,dword ptr [RDX + 0x8] CMP R8D,EAX CMOVL R8D,EAX LAB_001014a8: MOV RAX,qword ptr [RBP + -0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x001014e5 LEA RSP,[RBP + -0x28] MOV EAX,R8D POP RBX POP R12 POP R13 POP R14 POP R15 POP RBP RET LAB_001014c9: OR qword ptr [RSP + RDX*0x1 + -0x8],0x0 JMP 0x00101354 LAB_001014d4: MOV EAX,0x1 JMP 0x00101474 LAB_001014db: MOV R8D,dword ptr [R14*0x4] JMP 0x001014a8 LAB_001014e5: CALL 0x00101090
uint func0(void *param_1,uint param_2) { uint *puVar1; long lVar2; uint *puVar3; uint *puVar4; uint *puVar5; int *puVar6; size_t sVar7; int iVar8; void *pvVar9; size_t sVar10; void *pvVar11; ulong uVar12; size_t sVar13; int *puVar14; int iVar16; uint uVar17; uint uVar18; long in_FS_OFFSET; uint uVar19; uint uVar20; uint uVar21; uint uVar22; uint uVar23; uint uVar24; uint uVar25; int auStack_48 [8]; long local_40; int *puVar15; puVar14 = auStack_48; local_40 = *(long *)(in_FS_OFFSET + 0x28); uVar12 = (long)(int)param_2 * 4 + 0xf; puVar15 = auStack_48; puVar6 = auStack_48; while (puVar15 != auStack_48 + -(uVar12 & 0xfffffffffffff000)) { puVar14 = puVar6 + -0x1000; *(int8 *)(puVar6 + -8) = *(int8 *)(puVar6 + -8); puVar15 = puVar6 + -0x1000; puVar6 = puVar6 + -0x1000; } uVar12 = (ulong)((uint)uVar12 & 0xff0); lVar2 = -uVar12; if (uVar12 != 0) { *(int8 *)(puVar14 + -8) = *(int8 *)(puVar14 + -8); } if ((int)param_2 < 1) { uVar17 = *(uint *)(((ulong)(puVar14 + lVar2 + 3) >> 2) * 4); } else { uVar18 = param_2 - 1; *(int8 *)(puVar14 + lVar2 + -8) = 0x101384; pvVar9 = memcpy(puVar14 + lVar2,param_1,(ulong)param_2 << 2); uVar17 = *(uint *)(((ulong)(puVar14 + lVar2 + 3) >> 2) * 4); if (param_2 != 1) { sVar13 = 4; do { iVar8 = *(int *)((long)param_1 + sVar13); sVar7 = 0; do { sVar10 = sVar7; if ((*(int *)((long)param_1 + sVar10) < iVar8) && (iVar16 = *(int *)((long)pvVar9 + sVar10) * iVar8, *(int *)((long)pvVar9 + sVar13) < iVar16)) { *(int *)((long)pvVar9 + sVar13) = iVar16; } sVar7 = sVar10 + 4; } while (sVar10 + 4 != sVar13); sVar13 = sVar10 + 8; } while (sVar13 != (ulong)param_2 << 2); if (param_2 - 2 < 3) { iVar8 = 1; } else { pvVar11 = pvVar9; uVar24 = uVar17; uVar20 = uVar17; uVar25 = uVar17; do { puVar1 = (uint *)((long)pvVar11 + 4); puVar3 = (uint *)((long)pvVar11 + 8); puVar4 = (uint *)((long)pvVar11 + 0xc); puVar5 = (uint *)((long)pvVar11 + 0x10); pvVar11 = (void *)((long)pvVar11 + 0x10); uVar19 = -(uint)((int)uVar17 < (int)*puVar1); uVar21 = -(uint)((int)uVar24 < (int)*puVar3); uVar22 = -(uint)((int)uVar20 < (int)*puVar4); uVar23 = -(uint)((int)uVar25 < (int)*puVar5); uVar17 = ~uVar19 & uVar17 | *puVar1 & uVar19; uVar24 = ~uVar21 & uVar24 | *puVar3 & uVar21; uVar20 = ~uVar22 & uVar20 | *puVar4 & uVar22; uVar25 = ~uVar23 & uVar25 | *puVar5 & uVar23; } while ((void *)((ulong)(uVar18 >> 2) * 0x10 + (long)pvVar9) != pvVar11); iVar8 = (uVar18 & 0xfffffffc) + 1; uVar17 = ~-(uint)((int)uVar17 < (int)uVar20) & uVar17 | uVar20 & -(uint)((int)uVar17 < (int)uVar20); uVar24 = ~-(uint)((int)uVar24 < (int)uVar25) & uVar24 | uVar25 & -(uint)((int)uVar24 < (int)uVar25); uVar20 = -(uint)((int)uVar17 < (int)uVar24); uVar17 = ~uVar20 & uVar17 | uVar24 & uVar20; if ((uVar18 & 3) == 0) goto LAB_001014a8; } puVar1 = (uint *)((long)pvVar9 + (long)iVar8 * 4); if ((int)uVar17 < (int)*puVar1) { uVar17 = *puVar1; } if (iVar8 + 1 < (int)param_2) { if ((int)uVar17 < (int)puVar1[1]) { uVar17 = puVar1[1]; } if ((iVar8 + 2 < (int)param_2) && ((int)uVar17 < (int)puVar1[2])) { uVar17 = puVar1[2]; } } } } LAB_001014a8: if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(int8 *)(puVar14 + lVar2 + -8) = 0x1014ea; __stack_chk_fail(); } return uVar17; }
5,768
func0
#include <stdio.h> #include <assert.h>
int func0(int price[], int n, int k) { int final_profit[k + 1][n]; for (int i = 0; i <= k; i++) { for (int j = 0; j < n; j++) { if (i == 0 || j == 0) { final_profit[i][j] = 0; } else { int max_so_far = 0; for (int x = 0; x < j; x++) { int curr_price = price[j] - price[x] + final_profit[i-1][x]; if (max_so_far < curr_price) { max_so_far = curr_price; } } final_profit[i][j] = (final_profit[i][j-1] > max_so_far) ? final_profit[i][j-1] : max_so_far; } } } return final_profit[k][n-1]; }
int main() { int prices1[] = {1, 5, 2, 3, 7, 6, 4, 5}; int n1 = sizeof(prices1) / sizeof(prices1[0]); assert(func0(prices1, n1, 3) == 10); int prices2[] = {2, 4, 7, 5, 4, 3, 5}; int n2 = sizeof(prices2) / sizeof(prices2[0]); assert(func0(prices2, n2, 2) == 7); int prices3[] = {10, 6, 8, 4, 2}; int n3 = sizeof(prices3) / sizeof(prices3[0]); assert(func0(prices3, n3, 2) == 2); printf("All tests passed.\n"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %r15 push %r14 push %r13 push %r12 push %rbx sub $0x78,%rsp mov %rdi,-0x78(%rbp) mov %esi,-0x7c(%rbp) mov %edx,-0x80(%rbp) mov %fs:0x28,%rax mov %rax,-0x38(%rbp) xor %eax,%eax mov %rsp,%rax mov %rax,-0x98(%rbp) mov -0x7c(%rbp),%ecx mov -0x80(%rbp),%eax lea 0x1(%rax),%edi movslq %ecx,%rax sub $0x1,%rax mov %rax,-0x50(%rbp) movslq %ecx,%rax mov %rax,-0x90(%rbp) movq $0x0,-0x88(%rbp) movslq %ecx,%rax lea 0x0(,%rax,4),%rsi movslq %edi,%rax sub $0x1,%rax mov %rax,-0x48(%rbp) movslq %ecx,%rax mov %rax,%r14 mov $0x0,%r15d movslq %edi,%rax mov %rax,%r12 mov $0x0,%r13d mov %r15,%rdx imul %r12,%rdx mov %r13,%rax imul %r14,%rax lea (%rdx,%rax,1),%rbx mov %r14,%rax mul %r12 add %rdx,%rbx mov %rbx,%rdx movslq %ecx,%rax mov %rax,%r10 mov $0x0,%r11d movslq %edi,%rax mov %rax,%r8 mov $0x0,%r9d mov %r11,%rdx imul %r8,%rdx mov %r9,%rax imul %r10,%rax lea (%rdx,%rax,1),%rbx mov %r10,%rax mul %r8 lea (%rbx,%rdx,1),%r8 mov %r8,%rdx movslq %ecx,%rdx movslq %edi,%rax imul %rdx,%rax lea 0x0(,%rax,4),%rdx mov $0x10,%eax sub $0x1,%rax add %rdx,%rax mov $0x10,%ebx mov $0x0,%edx div %rbx imul $0x10,%rax,%rax mov %rax,%rdx and $0xfffffffffffff000,%rdx mov %rsp,%rbx sub %rdx,%rbx mov %rbx,%rdx cmp %rdx,%rsp je 12c6 <func0+0x13d> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) jmp 12af <func0+0x126> mov %rax,%rdx and $0xfff,%edx sub %rdx,%rsp mov %rax,%rdx and $0xfff,%edx test %rdx,%rdx je 12f0 <func0+0x167> and $0xfff,%eax sub $0x8,%rax add %rsp,%rax orq $0x0,(%rax) mov %rsp,%rax add $0x3,%rax shr $0x2,%rax shl $0x2,%rax mov %rax,-0x40(%rbp) movl $0x0,-0x58(%rbp) jmpq 1437 <func0+0x2ae> movl $0x0,-0x5c(%rbp) jmpq 1427 <func0+0x29e> cmpl $0x0,-0x58(%rbp) je 1327 <func0+0x19e> cmpl $0x0,-0x5c(%rbp) jne 1351 <func0+0x1c8> mov %rsi,%rdi shr $0x2,%rdi mov -0x40(%rbp),%rax mov -0x5c(%rbp),%edx movslq %edx,%rcx mov -0x58(%rbp),%edx movslq %edx,%rdx imul %rdi,%rdx add %rcx,%rdx movl $0x0,(%rax,%rdx,4) jmpq 1423 <func0+0x29a> movl $0x0,-0x60(%rbp) movl $0x0,-0x64(%rbp) jmp 13cd <func0+0x244> mov -0x5c(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x78(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x64(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x78(%rbp),%rax add %rcx,%rax mov (%rax),%eax mov %edx,%edi sub %eax,%edi mov %rsi,%r8 shr $0x2,%r8 mov -0x58(%rbp),%eax lea -0x1(%rax),%r9d mov -0x40(%rbp),%rax mov -0x64(%rbp),%edx movslq %edx,%rcx movslq %r9d,%rdx imul %r8,%rdx add %rcx,%rdx mov (%rax,%rdx,4),%eax add %edi,%eax mov %eax,-0x54(%rbp) mov -0x60(%rbp),%eax cmp -0x54(%rbp),%eax jge 13c9 <func0+0x240> mov -0x54(%rbp),%eax mov %eax,-0x60(%rbp) addl $0x1,-0x64(%rbp) mov -0x64(%rbp),%eax cmp -0x5c(%rbp),%eax jl 1361 <func0+0x1d8> mov %rsi,%rdi shr $0x2,%rdi mov -0x5c(%rbp),%eax lea -0x1(%rax),%edx mov -0x40(%rbp),%rax movslq %edx,%rcx mov -0x58(%rbp),%edx movslq %edx,%rdx imul %rdi,%rdx add %rcx,%rdx mov (%rax,%rdx,4),%eax mov %rsi,%r8 shr $0x2,%r8 cmp %eax,-0x60(%rbp) cmovge -0x60(%rbp),%eax mov %eax,%edx mov -0x40(%rbp),%rax mov -0x5c(%rbp),%ecx movslq %ecx,%rdi mov -0x58(%rbp),%ecx movslq %ecx,%rcx imul %r8,%rcx add %rdi,%rcx mov %edx,(%rax,%rcx,4) addl $0x1,-0x5c(%rbp) mov -0x5c(%rbp),%eax cmp -0x7c(%rbp),%eax jl 131b <func0+0x192> addl $0x1,-0x58(%rbp) mov -0x58(%rbp),%eax cmp -0x80(%rbp),%eax jle 130f <func0+0x186> shr $0x2,%rsi mov -0x7c(%rbp),%eax lea -0x1(%rax),%edx mov -0x40(%rbp),%rax movslq %edx,%rcx mov -0x80(%rbp),%edx movslq %edx,%rdx imul %rsi,%rdx add %rcx,%rdx mov (%rax,%rdx,4),%eax mov -0x98(%rbp),%rsp mov -0x38(%rbp),%rsi xor %fs:0x28,%rsi je 147f <func0+0x2f6> callq 1080 <__stack_chk_fail@plt> lea -0x28(%rbp),%rsp pop %rbx pop %r12 pop %r13 pop %r14 pop %r15 pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 58h mov [rbp+var_58], rdi mov [rbp+var_5C], esi mov [rbp+var_60], edx mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax mov rax, rsp mov r11, rax mov esi, [rbp+var_5C] mov eax, [rbp+var_60] lea r8d, [rax+1] movsxd rax, esi sub rax, 1 mov [rbp+var_30], rax movsxd rax, esi lea rdi, ds:0[rax*4] movsxd rax, r8d sub rax, 1 mov [rbp+var_28], rax movsxd rax, esi mov rcx, rax mov ebx, 0 movsxd rax, r8d mov rax, rax mov edx, 0 mov r10, rbx imul r10, rax mov r9, rdx imul r9, rcx add r9, r10 mul rcx lea rcx, [r9+rdx] mov rdx, rcx movsxd rax, esi mov rcx, rax mov ebx, 0 movsxd rax, r8d mov rax, rax mov edx, 0 mov r10, rbx imul r10, rax mov r9, rdx imul r9, rcx add r9, r10 mul rcx lea rcx, [r9+rdx] mov rdx, rcx movsxd rdx, esi movsxd rax, r8d imul rax, rdx lea rdx, ds:0[rax*4] mov eax, 10h sub rax, 1 add rax, rdx mov ebx, 10h mov edx, 0 div rbx imul rax, 10h mov rcx, rax and rcx, 0FFFFFFFFFFFFF000h mov rdx, rsp sub rdx, rcx loc_1281: cmp rsp, rdx jz short loc_1298 sub rsp, 1000h or [rsp+1060h+var_68], 0 jmp short loc_1281 loc_1298: mov rdx, rax and edx, 0FFFh sub rsp, rdx mov rdx, rax and edx, 0FFFh test rdx, rdx jz short loc_12C2 and eax, 0FFFh sub rax, 8 add rax, rsp or qword ptr [rax], 0 loc_12C2: mov rax, rsp add rax, 3 shr rax, 2 shl rax, 2 mov [rbp+var_20], rax mov [rbp+var_44], 0 jmp loc_140A loc_12E1: mov [rbp+var_40], 0 jmp loc_13FA loc_12ED: cmp [rbp+var_44], 0 jz short loc_12F9 cmp [rbp+var_40], 0 jnz short loc_1323 loc_12F9: mov rsi, rdi shr rsi, 2 mov rax, [rbp+var_20] mov edx, [rbp+var_40] movsxd rcx, edx mov edx, [rbp+var_44] movsxd rdx, edx imul rdx, rsi add rdx, rcx mov dword ptr [rax+rdx*4], 0 jmp loc_13F6 loc_1323: mov [rbp+var_3C], 0 mov [rbp+var_38], 0 jmp short loc_13A1 loc_1333: mov eax, [rbp+var_40] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_58] add rax, rdx mov edx, [rax] mov eax, [rbp+var_38] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_58] add rax, rcx mov eax, [rax] sub edx, eax mov r8d, edx mov rsi, rdi shr rsi, 2 mov eax, [rbp+var_44] lea r9d, [rax-1] mov rax, [rbp+var_20] mov edx, [rbp+var_38] movsxd rcx, edx movsxd rdx, r9d imul rdx, rsi add rdx, rcx mov eax, [rax+rdx*4] add eax, r8d mov [rbp+var_34], eax mov eax, [rbp+var_3C] cmp eax, [rbp+var_34] jge short loc_139D mov eax, [rbp+var_34] mov [rbp+var_3C], eax loc_139D: add [rbp+var_38], 1 loc_13A1: mov eax, [rbp+var_38] cmp eax, [rbp+var_40] jl short loc_1333 mov rsi, rdi shr rsi, 2 mov eax, [rbp+var_40] lea edx, [rax-1] mov rax, [rbp+var_20] movsxd rcx, edx mov edx, [rbp+var_44] movsxd rdx, edx imul rdx, rsi add rdx, rcx mov edx, [rax+rdx*4] mov r8, rdi shr r8, 2 mov eax, [rbp+var_3C] cmp edx, eax cmovl edx, eax mov rax, [rbp+var_20] mov ecx, [rbp+var_40] movsxd rsi, ecx mov ecx, [rbp+var_44] movsxd rcx, ecx imul rcx, r8 add rcx, rsi mov [rax+rcx*4], edx loc_13F6: add [rbp+var_40], 1 loc_13FA: mov eax, [rbp+var_40] cmp eax, [rbp+var_5C] jl loc_12ED add [rbp+var_44], 1 loc_140A: mov eax, [rbp+var_44] cmp eax, [rbp+var_60] jle loc_12E1 shr rdi, 2 mov rsi, rdi mov eax, [rbp+var_5C] lea edx, [rax-1] mov rax, [rbp+var_20] movsxd rcx, edx mov edx, [rbp+var_60] movsxd rdx, edx imul rdx, rsi add rdx, rcx mov eax, [rax+rdx*4] mov rsp, r11 mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_1451 call ___stack_chk_fail loc_1451: mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, int a2, int a3) { unsigned long long v3; // rdi unsigned long long v4; // rax void *v5; // rsp int v6; // edx int v8; // [rsp+8h] [rbp-60h] BYREF int v9; // [rsp+Ch] [rbp-5Ch] long long v10; // [rsp+10h] [rbp-58h] int i; // [rsp+24h] [rbp-44h] int j; // [rsp+28h] [rbp-40h] int v13; // [rsp+2Ch] [rbp-3Ch] int k; // [rsp+30h] [rbp-38h] int v15; // [rsp+34h] [rbp-34h] long long v16; // [rsp+38h] [rbp-30h] long long v17; // [rsp+40h] [rbp-28h] int *v18; // [rsp+48h] [rbp-20h] unsigned long long v19; // [rsp+50h] [rbp-18h] v10 = a1; v9 = a2; v8 = a3; v19 = __readfsqword(0x28u); v16 = a2 - 1LL; v3 = 4LL * a2; v17 = a3 + 1 - 1LL; v4 = 16 * ((4 * a2 * (long long)(a3 + 1) + 15) / 0x10uLL); while ( &v8 != (int *)((char *)&v8 - (v4 & 0xFFFFFFFFFFFFF000LL)) ) ; v5 = alloca(v4 & 0xFFF); if ( (v4 & 0xFFF) != 0 ) *(_QWORD *)((char *)&v8 + (v4 & 0xFFF) - 8) = *(_QWORD *)((char *)&v8 + (v4 & 0xFFF) - 8); v18 = &v8; for ( i = 0; i <= v8; ++i ) { for ( j = 0; j < v9; ++j ) { if ( i && j ) { v13 = 0; for ( k = 0; k < j; ++k ) { v15 = *(_DWORD *)(4LL * j + v10) - *(_DWORD *)(4LL * k + v10) + v18[k + (v3 >> 2) * (i - 1)]; if ( v13 < v15 ) v13 = v15; } v6 = v18[j - 1 + (v3 >> 2) * i]; if ( v6 < v13 ) v6 = v13; v18[j + (v3 >> 2) * i] = v6; } else { v18[j + (v3 >> 2) * i] = 0; } } } return (unsigned int)v18[v9 - 1 + (v3 >> 2) * v8]; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x58 MOV qword ptr [RBP + -0x58],RDI MOV dword ptr [RBP + -0x5c],ESI MOV dword ptr [RBP + -0x60],EDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV RAX,RSP MOV R11,RAX MOV ESI,dword ptr [RBP + -0x5c] MOV EAX,dword ptr [RBP + -0x60] LEA R8D,[RAX + 0x1] MOVSXD RAX,ESI SUB RAX,0x1 MOV qword ptr [RBP + -0x30],RAX MOVSXD RAX,ESI LEA RDI,[RAX*0x4] MOVSXD RAX,R8D SUB RAX,0x1 MOV qword ptr [RBP + -0x28],RAX MOVSXD RAX,ESI MOV RCX,RAX MOV EBX,0x0 MOVSXD RAX,R8D MOV RAX,RAX MOV EDX,0x0 MOV R10,RBX IMUL R10,RAX MOV R9,RDX IMUL R9,RCX ADD R9,R10 MUL RCX LEA RCX,[R9 + RDX*0x1] MOV RDX,RCX MOVSXD RAX,ESI MOV RCX,RAX MOV EBX,0x0 MOVSXD RAX,R8D MOV RAX,RAX MOV EDX,0x0 MOV R10,RBX IMUL R10,RAX MOV R9,RDX IMUL R9,RCX ADD R9,R10 MUL RCX LEA RCX,[R9 + RDX*0x1] MOV RDX,RCX MOVSXD RDX,ESI MOVSXD RAX,R8D IMUL RAX,RDX LEA RDX,[RAX*0x4] MOV EAX,0x10 SUB RAX,0x1 ADD RAX,RDX MOV EBX,0x10 MOV EDX,0x0 DIV RBX IMUL RAX,RAX,0x10 MOV RCX,RAX AND RCX,-0x1000 MOV RDX,RSP SUB RDX,RCX LAB_00101281: CMP RSP,RDX JZ 0x00101298 SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 JMP 0x00101281 LAB_00101298: MOV RDX,RAX AND EDX,0xfff SUB RSP,RDX MOV RDX,RAX AND EDX,0xfff TEST RDX,RDX JZ 0x001012c2 AND EAX,0xfff SUB RAX,0x8 ADD RAX,RSP OR qword ptr [RAX],0x0 LAB_001012c2: MOV RAX,RSP ADD RAX,0x3 SHR RAX,0x2 SHL RAX,0x2 MOV qword ptr [RBP + -0x20],RAX MOV dword ptr [RBP + -0x44],0x0 JMP 0x0010140a LAB_001012e1: MOV dword ptr [RBP + -0x40],0x0 JMP 0x001013fa LAB_001012ed: CMP dword ptr [RBP + -0x44],0x0 JZ 0x001012f9 CMP dword ptr [RBP + -0x40],0x0 JNZ 0x00101323 LAB_001012f9: MOV RSI,RDI SHR RSI,0x2 MOV RAX,qword ptr [RBP + -0x20] MOV EDX,dword ptr [RBP + -0x40] MOVSXD RCX,EDX MOV EDX,dword ptr [RBP + -0x44] MOVSXD RDX,EDX IMUL RDX,RSI ADD RDX,RCX MOV dword ptr [RAX + RDX*0x4],0x0 JMP 0x001013f6 LAB_00101323: MOV dword ptr [RBP + -0x3c],0x0 MOV dword ptr [RBP + -0x38],0x0 JMP 0x001013a1 LAB_00101333: MOV EAX,dword ptr [RBP + -0x40] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x58] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x38] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x58] ADD RAX,RCX MOV EAX,dword ptr [RAX] SUB EDX,EAX MOV R8D,EDX MOV RSI,RDI SHR RSI,0x2 MOV EAX,dword ptr [RBP + -0x44] LEA R9D,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x20] MOV EDX,dword ptr [RBP + -0x38] MOVSXD RCX,EDX MOVSXD RDX,R9D IMUL RDX,RSI ADD RDX,RCX MOV EAX,dword ptr [RAX + RDX*0x4] ADD EAX,R8D MOV dword ptr [RBP + -0x34],EAX MOV EAX,dword ptr [RBP + -0x3c] CMP EAX,dword ptr [RBP + -0x34] JGE 0x0010139d MOV EAX,dword ptr [RBP + -0x34] MOV dword ptr [RBP + -0x3c],EAX LAB_0010139d: ADD dword ptr [RBP + -0x38],0x1 LAB_001013a1: MOV EAX,dword ptr [RBP + -0x38] CMP EAX,dword ptr [RBP + -0x40] JL 0x00101333 MOV RSI,RDI SHR RSI,0x2 MOV EAX,dword ptr [RBP + -0x40] LEA EDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x20] MOVSXD RCX,EDX MOV EDX,dword ptr [RBP + -0x44] MOVSXD RDX,EDX IMUL RDX,RSI ADD RDX,RCX MOV EDX,dword ptr [RAX + RDX*0x4] MOV R8,RDI SHR R8,0x2 MOV EAX,dword ptr [RBP + -0x3c] CMP EDX,EAX CMOVL EDX,EAX MOV RAX,qword ptr [RBP + -0x20] MOV ECX,dword ptr [RBP + -0x40] MOVSXD RSI,ECX MOV ECX,dword ptr [RBP + -0x44] MOVSXD RCX,ECX IMUL RCX,R8 ADD RCX,RSI MOV dword ptr [RAX + RCX*0x4],EDX LAB_001013f6: ADD dword ptr [RBP + -0x40],0x1 LAB_001013fa: MOV EAX,dword ptr [RBP + -0x40] CMP EAX,dword ptr [RBP + -0x5c] JL 0x001012ed ADD dword ptr [RBP + -0x44],0x1 LAB_0010140a: MOV EAX,dword ptr [RBP + -0x44] CMP EAX,dword ptr [RBP + -0x60] JLE 0x001012e1 SHR RDI,0x2 MOV RSI,RDI MOV EAX,dword ptr [RBP + -0x5c] LEA EDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x20] MOVSXD RCX,EDX MOV EDX,dword ptr [RBP + -0x60] MOVSXD RDX,EDX IMUL RDX,RSI ADD RDX,RCX MOV EAX,dword ptr [RAX + RDX*0x4] MOV RSP,R11 MOV RDX,qword ptr [RBP + -0x18] SUB RDX,qword ptr FS:[0x28] JZ 0x00101451 CALL 0x00101080 LAB_00101451: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int4 func0(long param_1,int param_2,int param_3) { long lVar1; int iVar2; ulong uVar3; ulong uVar4; int *piVar5; long in_FS_OFFSET; int local_68; int local_64; long local_60; int local_4c; int local_48; int local_44; int local_40; int local_3c; long local_38; long local_30; int *local_28; long local_20; local_60 = param_1; local_64 = param_2; local_68 = param_3; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_38 = (long)param_2 + -1; uVar3 = (ulong)param_2; local_30 = (long)(param_3 + 1) + -1; uVar4 = (((long)(param_3 + 1) * (long)param_2 * 4 + 0xfU) / 0x10) * 0x10; for (piVar5 = &local_68; piVar5 != (int *)((long)&local_68 - (uVar4 & 0xfffffffffffff000)); piVar5 = (int *)((long)piVar5 + -0x1000)) { *(int8 *)((long)piVar5 + -8) = *(int8 *)((long)piVar5 + -8); } lVar1 = -(ulong)((uint)uVar4 & 0xfff); if ((uVar4 & 0xfff) != 0) { *(int8 *)((long)piVar5 + ((ulong)((uint)uVar4 & 0xfff) - 8) + lVar1) = *(int8 *)((long)piVar5 + ((ulong)((uint)uVar4 & 0xfff) - 8) + lVar1); } for (local_4c = 0; local_4c <= local_68; local_4c = local_4c + 1) { for (local_48 = 0; local_48 < local_64; local_48 = local_48 + 1) { if ((local_4c == 0) || (local_48 == 0)) { *(int4 *) ((long)piVar5 + ((long)local_4c * (uVar3 & 0x3fffffffffffffff) + (long)local_48) * 4 + lVar1) = 0; } else { local_44 = 0; for (local_40 = 0; local_40 < local_48; local_40 = local_40 + 1) { local_3c = *(int *)((long)piVar5 + ((long)(local_4c + -1) * (uVar3 & 0x3fffffffffffffff) + (long)local_40) * 4 + lVar1) + (*(int *)(local_60 + (long)local_48 * 4) - *(int *)(local_60 + (long)local_40 * 4)); if (local_44 < local_3c) { local_44 = local_3c; } } iVar2 = *(int *)((long)piVar5 + ((long)local_4c * (uVar3 & 0x3fffffffffffffff) + (long)(local_48 + -1)) * 4 + lVar1); if (*(int *)((long)piVar5 + ((long)local_4c * (uVar3 & 0x3fffffffffffffff) + (long)(local_48 + -1)) * 4 + lVar1) < local_44) { iVar2 = local_44; } *(int *)((long)piVar5 + ((long)local_4c * (uVar3 & 0x3fffffffffffffff) + (long)local_48) * 4 + lVar1) = iVar2; } } } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { local_28 = (int *)((long)piVar5 + lVar1); /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return *(int4 *) ((long)piVar5 + ((long)local_68 * (uVar3 & 0x3fffffffffffffff) + (long)(local_64 + -1)) * 4 + lVar1); }
5,769
func0
#include <stdio.h> #include <assert.h>
int func0(int price[], int n, int k) { int final_profit[k + 1][n]; for (int i = 0; i <= k; i++) { for (int j = 0; j < n; j++) { if (i == 0 || j == 0) { final_profit[i][j] = 0; } else { int max_so_far = 0; for (int x = 0; x < j; x++) { int curr_price = price[j] - price[x] + final_profit[i-1][x]; if (max_so_far < curr_price) { max_so_far = curr_price; } } final_profit[i][j] = (final_profit[i][j-1] > max_so_far) ? final_profit[i][j-1] : max_so_far; } } } return final_profit[k][n-1]; }
int main() { int prices1[] = {1, 5, 2, 3, 7, 6, 4, 5}; int n1 = sizeof(prices1) / sizeof(prices1[0]); assert(func0(prices1, n1, 3) == 10); int prices2[] = {2, 4, 7, 5, 4, 3, 5}; int n2 = sizeof(prices2) / sizeof(prices2[0]); assert(func0(prices2, n2, 2) == 7); int prices3[] = {10, 6, 8, 4, 2}; int n3 = sizeof(prices3) / sizeof(prices3[0]); assert(func0(prices3, n3, 2) == 2); printf("All tests passed.\n"); return 0; }
O1
c
func0: endbr64 push %rbp mov %rsp,%rbp push %r15 push %r14 push %r13 push %r12 push %rbx sub $0x28,%rsp mov %esi,%r14d mov %edx,%eax mov %edx,-0x48(%rbp) mov %fs:0x28,%rbx mov %rbx,-0x38(%rbp) xor %ebx,%ebx movslq %esi,%rdx lea 0x0(,%rdx,4),%r15 add $0x1,%eax cltq imul %rdx,%rax lea 0xf(,%rax,4),%rax mov %rax,%rdx and $0xfffffffffffffff0,%rdx and $0xfffffffffffff000,%rax mov %rsp,%rbx sub %rax,%rbx mov %rbx,%rax cmp %rax,%rsp je 11fe <func0+0x75> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) jmp 11e7 <func0+0x5e> mov %rdx,%rax and $0xfff,%eax sub %rax,%rsp test %rax,%rax je 1214 <func0+0x8b> orq $0x0,-0x8(%rsp,%rax,1) mov %rsp,%rbx mov %rbx,-0x50(%rbp) mov -0x48(%rbp),%eax test %eax,%eax js 12c2 <func0+0x139> mov %rbx,%r13 mov %rbx,%r8 sub %r15,%r8 add $0x1,%eax mov %eax,-0x44(%rbp) mov $0x0,%r11d lea -0x1(%r14),%r12d jmp 12b6 <func0+0x12d> movl $0x0,0x0(%r13,%rsi,4) lea 0x1(%rsi),%rax cmp %r12,%rsi je 12a3 <func0+0x11a> mov %rax,%rsi test %r11d,%r11d je 1241 <func0+0xb8> test %esi,%esi je 1241 <func0+0xb8> mov $0x0,%ecx test %esi,%esi jle 1295 <func0+0x10c> mov (%rdi,%rsi,4),%r10d lea -0x1(%rsi),%r9d mov $0x0,%eax mov $0x0,%ecx mov %r10d,%edx sub (%rdi,%rax,4),%edx add (%r8,%rax,4),%edx cmp %edx,%ecx cmovl %edx,%ecx mov %rax,%rdx add $0x1,%rax cmp %r9,%rdx jne 127a <func0+0xf1> cmp %ecx,-0x4(%rbx,%rsi,4) cmovge -0x4(%rbx,%rsi,4),%ecx mov %ecx,(%rbx,%rsi,4) jmp 124a <func0+0xc1> add $0x1,%r11d add %r15,%r13 add %r15,%rbx add %r15,%r8 cmp -0x44(%rbp),%r11d je 12c2 <func0+0x139> mov $0x0,%esi test %r14d,%r14d jg 1256 <func0+0xcd> jmp 12a3 <func0+0x11a> lea -0x1(%r14),%eax movslq %eax,%rdx movslq -0x48(%rbp),%rax shr $0x2,%r15 imul %rax,%r15 lea (%rdx,%r15,1),%rax mov -0x50(%rbp),%rbx mov (%rbx,%rax,4),%eax mov -0x38(%rbp),%rbx xor %fs:0x28,%rbx jne 12fe <func0+0x175> lea -0x28(%rbp),%rsp pop %rbx pop %r12 pop %r13 pop %r14 pop %r15 pop %rbp retq callq 1080 <__stack_chk_fail@plt>
func0: endbr64 push rbp mov rbp, rsp push r15 push r14 push r13 push r12 push rbx sub rsp, 38h mov r14d, esi mov ebx, edx mov [rbp+var_4C], edx mov rax, fs:28h mov [rbp+var_38], rax xor eax, eax movsxd rdx, esi lea rax, ds:0[rdx*4] mov [rbp+var_48], rax lea eax, [rbx+1] cdqe imul rax, rdx lea rax, ds:0Fh[rax*4] mov rcx, rax and rcx, 0FFFFFFFFFFFFFFF0h and rax, 0FFFFFFFFFFFFF000h mov rdx, rsp sub rdx, rax loc_11E8: cmp rsp, rdx jz short loc_11FF sub rsp, 1000h or [rsp+1060h+var_68], 0 jmp short loc_11E8 loc_11FF: mov rax, rcx and eax, 0FFFh sub rsp, rax test rax, rax jz short loc_1215 or [rsp+rax+60h+var_68], 0 loc_1215: mov r13, rsp mov [rbp+var_58], r13 mov eax, [rbp+var_4C] test eax, eax js loc_12C3 mov r12, r13 mov r8, r13 sub r8, [rbp+var_48] lea r15d, [rax+1] mov r11d, 0 mov ebx, r14d jmp short loc_12B7 loc_1240: mov dword ptr [r12+rsi*4], 0 loc_1248: add rsi, 1 cmp rsi, rbx jz short loc_12A1 loc_1251: test r11d, r11d jz short loc_1240 test esi, esi jz short loc_1240 mov ecx, 0 test esi, esi jle short loc_1290 mov r10d, [rdi+rsi*4] lea r9d, [rsi-1] mov eax, 0 mov ecx, 0 loc_1275: mov edx, r10d sub edx, [rdi+rax*4] add edx, [r8+rax*4] cmp ecx, edx cmovl ecx, edx mov rdx, rax add rax, 1 cmp rdx, r9 jnz short loc_1275 loc_1290: mov eax, [r13+rsi*4-4] cmp eax, ecx cmovl eax, ecx mov [r13+rsi*4+0], eax jmp short loc_1248 loc_12A1: add r11d, 1 mov rax, [rbp+var_48] add r12, rax add r13, rax add r8, rax cmp r11d, r15d jz short loc_12C3 loc_12B7: mov esi, 0 test r14d, r14d jg short loc_1251 jmp short loc_12A1 loc_12C3: lea eax, [r14-1] movsxd rdx, eax movsxd rcx, [rbp+var_4C] mov rax, [rbp+var_48] shr rax, 2 imul rax, rcx add rax, rdx mov rbx, [rbp+var_58] mov eax, [rbx+rax*4] mov rdx, [rbp+var_38] sub rdx, fs:28h jnz short loc_1302 lea rsp, [rbp-28h] pop rbx pop r12 pop r13 pop r14 pop r15 pop rbp retn loc_1302: call ___stack_chk_fail
long long func0(long long a1, int a2, int a3) { __int16 v4; // cx long long *v5; // rdx signed long long v6; // rax void *v7; // rsp long long *v8; // r13 long long *v9; // r12 char *v10; // r8 int v11; // r15d int v12; // r11d long long v13; // rsi int v14; // ecx int v15; // r10d long long v16; // rax long long v17; // rdx int v18; // eax long long v20; // [rsp+0h] [rbp-68h] long long v21; // [rsp+8h] [rbp-60h] BYREF long long *v22; // [rsp+10h] [rbp-58h] int v23; // [rsp+1Ch] [rbp-4Ch] unsigned long long v24; // [rsp+20h] [rbp-48h] unsigned long long v25; // [rsp+30h] [rbp-38h] v23 = a3; v25 = __readfsqword(0x28u); v24 = 4LL * a2; v4 = (4 * a2 * (a3 + 1) + 15) & 0xFFF0; v5 = (long long *)((char *)&v21 - ((4 * a2 * (long long)(a3 + 1) + 15) & 0xFFFFFFFFFFFFF000LL)); while ( &v21 != v5 ) ; v6 = v4 & 0xFFF; v7 = alloca(v6); if ( (v4 & 0xFFF) != 0 ) *(long long *)((char *)&v20 + v6) = *(long long *)((char *)&v20 + v6); v8 = &v21; v22 = &v21; if ( v23 >= 0 ) { v9 = &v21; v10 = (char *)&v21 - v24; v11 = v23 + 1; v12 = 0; do { v13 = 0LL; if ( a2 > 0 ) { do { if ( v12 && (_DWORD)v13 ) { v14 = 0; if ( (int)v13 > 0 ) { v16 = 0LL; v14 = 0; do { v15 = *(_DWORD *)(a1 + 4 * v13); if ( v14 < *(_DWORD *)&v10[4 * v16] + v15 - *(_DWORD *)(a1 + 4 * v16) ) v14 = *(_DWORD *)&v10[4 * v16] + v15 - *(_DWORD *)(a1 + 4 * v16); v17 = v16++; } while ( v17 != (_DWORD)v13 - 1 ); } v18 = *((_DWORD *)v8 + v13 - 1); if ( v18 < v14 ) v18 = v14; *((_DWORD *)v8 + v13) = v18; } else { *((_DWORD *)v9 + v13) = 0; } ++v13; } while ( v13 != a2 ); } ++v12; v9 = (long long *)((char *)v9 + v24); v8 = (long long *)((char *)v8 + v24); v10 += v24; } while ( v12 != v11 ); } return *((unsigned int *)v22 + a2 + v23 * (v24 >> 2) - 1); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBX SUB RSP,0x38 MOV R14D,ESI MOV EBX,EDX MOV dword ptr [RBP + -0x4c],EDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x38],RAX XOR EAX,EAX MOVSXD RDX,ESI LEA RAX,[RDX*0x4] MOV qword ptr [RBP + -0x48],RAX LEA EAX,[RBX + 0x1] CDQE IMUL RAX,RDX LEA RAX,[0xf + RAX*0x4] MOV RCX,RAX AND RCX,-0x10 AND RAX,-0x1000 MOV RDX,RSP SUB RDX,RAX LAB_001011e8: CMP RSP,RDX JZ 0x001011ff SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 JMP 0x001011e8 LAB_001011ff: MOV RAX,RCX AND EAX,0xfff SUB RSP,RAX TEST RAX,RAX JZ 0x00101215 OR qword ptr [RSP + RAX*0x1 + -0x8],0x0 LAB_00101215: MOV R13,RSP MOV qword ptr [RBP + -0x58],R13 MOV EAX,dword ptr [RBP + -0x4c] TEST EAX,EAX JS 0x001012c3 MOV R12,R13 MOV R8,R13 SUB R8,qword ptr [RBP + -0x48] LEA R15D,[RAX + 0x1] MOV R11D,0x0 MOV EBX,R14D JMP 0x001012b7 LAB_00101240: MOV dword ptr [R12 + RSI*0x4],0x0 LAB_00101248: ADD RSI,0x1 CMP RSI,RBX JZ 0x001012a1 LAB_00101251: TEST R11D,R11D JZ 0x00101240 TEST ESI,ESI JZ 0x00101240 MOV ECX,0x0 TEST ESI,ESI JLE 0x00101290 MOV R10D,dword ptr [RDI + RSI*0x4] LEA R9D,[RSI + -0x1] MOV EAX,0x0 MOV ECX,0x0 LAB_00101275: MOV EDX,R10D SUB EDX,dword ptr [RDI + RAX*0x4] ADD EDX,dword ptr [R8 + RAX*0x4] CMP ECX,EDX CMOVL ECX,EDX MOV RDX,RAX ADD RAX,0x1 CMP RDX,R9 JNZ 0x00101275 LAB_00101290: MOV EAX,dword ptr [R13 + RSI*0x4 + -0x4] CMP EAX,ECX CMOVL EAX,ECX MOV dword ptr [R13 + RSI*0x4],EAX JMP 0x00101248 LAB_001012a1: ADD R11D,0x1 MOV RAX,qword ptr [RBP + -0x48] ADD R12,RAX ADD R13,RAX ADD R8,RAX CMP R11D,R15D JZ 0x001012c3 LAB_001012b7: MOV ESI,0x0 TEST R14D,R14D JG 0x00101251 JMP 0x001012a1 LAB_001012c3: LEA EAX,[R14 + -0x1] MOVSXD RDX,EAX MOVSXD RCX,dword ptr [RBP + -0x4c] MOV RAX,qword ptr [RBP + -0x48] SHR RAX,0x2 IMUL RAX,RCX ADD RAX,RDX MOV RBX,qword ptr [RBP + -0x58] MOV EAX,dword ptr [RBX + RAX*0x4] MOV RDX,qword ptr [RBP + -0x38] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101302 LEA RSP,[RBP + -0x28] POP RBX POP R12 POP R13 POP R14 POP R15 POP RBP RET LAB_00101302: CALL 0x00101080
int4 func0(long param_1,uint param_2,int param_3) { int iVar1; long lVar2; ulong uVar3; int iVar4; int iVar5; int1 *puVar6; int iVar7; ulong uVar8; int1 *puVar9; int iVar10; int1 *puVar11; int1 *puVar12; long in_FS_OFFSET; bool bVar13; int1 auStack_68 [8]; int1 *local_60; int local_54; ulong local_50; long local_40; local_54 = param_3; local_40 = *(long *)(in_FS_OFFSET + 0x28); local_50 = (long)(int)param_2 * 4; uVar8 = (long)(param_3 + 1) * (long)(int)param_2 * 4 + 0xf; for (puVar6 = auStack_68; puVar6 != auStack_68 + -(uVar8 & 0xfffffffffffff000); puVar6 = puVar6 + -0x1000) { *(int8 *)(puVar6 + -8) = *(int8 *)(puVar6 + -8); } uVar8 = (ulong)((uint)uVar8 & 0xff0); lVar2 = -uVar8; puVar11 = puVar6 + lVar2; puVar12 = puVar6 + lVar2; if (uVar8 != 0) { *(int8 *)(puVar6 + -8) = *(int8 *)(puVar6 + -8); } local_60 = puVar6 + lVar2; if (-1 < local_54) { puVar9 = puVar6 + (lVar2 - local_50); iVar1 = local_54 + 1; iVar10 = 0; do { uVar8 = 0; if (0 < (int)param_2) { do { if ((iVar10 == 0) || (iVar7 = (int)uVar8, iVar7 == 0)) { *(int4 *)(puVar11 + uVar8 * 4) = 0; } else { iVar4 = 0; if (0 < iVar7) { iVar4 = 0; uVar3 = 0; do { iVar5 = (*(int *)(param_1 + uVar8 * 4) - *(int *)(param_1 + uVar3 * 4)) + *(int *)(puVar9 + uVar3 * 4); if (iVar4 < iVar5) { iVar4 = iVar5; } bVar13 = uVar3 != iVar7 - 1; uVar3 = uVar3 + 1; } while (bVar13); } iVar7 = *(int *)(puVar12 + uVar8 * 4 + -4); if (*(int *)(puVar12 + uVar8 * 4 + -4) < iVar4) { iVar7 = iVar4; } *(int *)(puVar12 + uVar8 * 4) = iVar7; } uVar8 = uVar8 + 1; } while (uVar8 != param_2); } iVar10 = iVar10 + 1; puVar11 = puVar11 + local_50; puVar12 = puVar12 + local_50; puVar9 = puVar9 + local_50; } while (iVar10 != iVar1); } if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(code **)(puVar6 + lVar2 + -8) = main; __stack_chk_fail(); } return *(int4 *) (local_60 + ((local_50 >> 2) * (long)local_54 + (long)(int)(param_2 - 1)) * 4); }
5,770
func0
#include <stdio.h> #include <assert.h>
int func0(int price[], int n, int k) { int final_profit[k + 1][n]; for (int i = 0; i <= k; i++) { for (int j = 0; j < n; j++) { if (i == 0 || j == 0) { final_profit[i][j] = 0; } else { int max_so_far = 0; for (int x = 0; x < j; x++) { int curr_price = price[j] - price[x] + final_profit[i-1][x]; if (max_so_far < curr_price) { max_so_far = curr_price; } } final_profit[i][j] = (final_profit[i][j-1] > max_so_far) ? final_profit[i][j-1] : max_so_far; } } } return final_profit[k][n-1]; }
int main() { int prices1[] = {1, 5, 2, 3, 7, 6, 4, 5}; int n1 = sizeof(prices1) / sizeof(prices1[0]); assert(func0(prices1, n1, 3) == 10); int prices2[] = {2, 4, 7, 5, 4, 3, 5}; int n2 = sizeof(prices2) / sizeof(prices2[0]); assert(func0(prices2, n2, 2) == 7); int prices3[] = {10, 6, 8, 4, 2}; int n3 = sizeof(prices3) / sizeof(prices3[0]); assert(func0(prices3, n3, 2) == 2); printf("All tests passed.\n"); return 0; }
O2
c
func0: endbr64 push %rbp mov %edx,%eax mov %rdi,%r9 add $0x1,%eax mov %rsp,%rbp push %r15 push %r14 mov %esi,%r14d push %r13 push %r12 push %rbx sub $0x48,%rsp mov %edx,-0x50(%rbp) movslq %esi,%rdx mov %fs:0x28,%rbx mov %rbx,-0x38(%rbp) xor %ebx,%ebx mov %eax,-0x4c(%rbp) cltq lea 0x0(,%rdx,4),%rbx imul %rdx,%rax mov %rbx,-0x48(%rbp) mov %rsp,%rbx lea 0xf(,%rax,4),%rax mov %rax,%rdx and $0xfffffffffffff000,%rax sub %rax,%rbx and $0xfffffffffffffff0,%rdx mov %rbx,%rax cmp %rax,%rsp je 13a2 <func0+0x82> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 138d <func0+0x6d> and $0xfff,%edx sub %rdx,%rsp test %rdx,%rdx jne 14be <func0+0x19e> mov -0x48(%rbp),%rax mov %rsp,-0x60(%rbp) shr $0x2,%rax mov %rax,-0x58(%rbp) mov -0x50(%rbp),%eax test %eax,%eax js 14c9 <func0+0x1a9> mov -0x58(%rbp),%rax mov -0x60(%rbp),%rbx xor %r13d,%r13d neg %rax lea (%rbx,%rax,4),%r11 lea -0x1(%r14),%ebx mov %ebx,-0x64(%rbp) nopl 0x0(%rax,%rax,1) mov -0x48(%rbp),%rax lea (%r11,%rax,1),%r15 test %r14d,%r14d jle 1478 <func0+0x158> mov -0x48(%rbp),%rax test %r13d,%r13d sete %r12b xor %esi,%esi lea (%r11,%rax,1),%r15 mov %r15,%rdi jmp 142e <func0+0x10e> nopl 0x0(%rax,%rax,1) movl $0x0,(%rdi) lea 0x1(%rsi),%rax add $0x4,%rdi cmp %rbx,%rsi je 1478 <func0+0x158> mov %rax,%rsi mov %esi,%r8d test %esi,%esi je 1418 <func0+0xf8> test %r12b,%r12b jne 1418 <func0+0xf8> mov (%r9,%rsi,4),%r10d xor %eax,%eax xor %ecx,%ecx nopw 0x0(%rax,%rax,1) mov %r10d,%edx sub (%r9,%rax,4),%edx add (%r11,%rax,4),%edx cmp %edx,%ecx cmovl %edx,%ecx add $0x1,%rax cmp %eax,%r8d jg 1448 <func0+0x128> cmp %ecx,-0x4(%rdi) cmovge -0x4(%rdi),%ecx lea 0x1(%rsi),%rax add $0x4,%rdi mov %ecx,-0x4(%rdi) cmp %rbx,%rsi jne 142b <func0+0x10b> add $0x1,%r13d mov %r15,%r11 cmp -0x4c(%rbp),%r13d jne 13f0 <func0+0xd0> movslq -0x50(%rbp),%rax imul -0x58(%rbp),%rax movslq -0x64(%rbp),%rdx mov -0x60(%rbp),%rbx add %rdx,%rax mov (%rbx,%rax,4),%eax mov -0x38(%rbp),%rbx xor %fs:0x28,%rbx jne 14d2 <func0+0x1b2> lea -0x28(%rbp),%rsp pop %rbx pop %r12 pop %r13 pop %r14 pop %r15 pop %rbp retq orq $0x0,-0x8(%rsp,%rdx,1) jmpq 13b4 <func0+0x94> lea -0x1(%r14),%eax mov %eax,-0x64(%rbp) jmp 1489 <func0+0x169> callq 1080 <__stack_chk_fail@plt> nopw 0x0(%rax,%rax,1)
func0: endbr64 push rbp mov r8, rdi mov rbp, rsp push r15 push r14 push r13 push r12 push rbx movsxd rbx, esi mov r14, rbx lea r15, ds:0[rbx*4] sub rsp, 38h mov [rbp+var_44], edx mov rax, fs:28h mov [rbp+var_38], rax xor eax, eax lea eax, [rdx+1] mov rdx, rsp cdqe imul rax, rbx lea rax, ds:0Fh[rax*4] mov rcx, rax and rax, 0FFFFFFFFFFFFF000h sub rdx, rax and rcx, 0FFFFFFFFFFFFFFF0h cmp rsp, rdx jz short loc_1396 loc_1381: sub rsp, 1000h or [rsp+1060h+var_68], 0 cmp rsp, rdx jnz short loc_1381 loc_1396: and ecx, 0FFFh sub rsp, rcx test rcx, rcx jnz loc_148B loc_13A8: mov rax, r15 mov edx, [rbp+var_44] mov rdi, rsp shr rax, 2 mov [rbp+var_58], rdi mov [rbp+var_50], rax test edx, edx js loc_1454 neg rax mov r11, rdi xor r13d, r13d lea r10, [rdi+rax*4] nop word ptr [rax+rax+00h] loc_13D8: test r13d, r13d setz r12b xor esi, esi test r14d, r14d jle short loc_140A nop word ptr [rax+rax+00000000h] loc_13F0: mov edi, esi test esi, esi jz short loc_13FB test r12b, r12b jz short loc_1420 loc_13FB: xor ecx, ecx loc_13FD: mov [r11+rsi*4], ecx add rsi, 1 cmp rbx, rsi jnz short loc_13F0 loc_140A: lea eax, [r13+1] add r11, r15 add r10, r15 cmp [rbp+var_44], r13d jz short loc_1454 mov r13d, eax jmp short loc_13D8 loc_1420: mov r9d, [r8+rsi*4] xor eax, eax xor ecx, ecx nop dword ptr [rax+rax+00000000h] loc_1430: mov edx, r9d sub edx, [r8+rax*4] add edx, [r10+rax*4] cmp ecx, edx cmovl ecx, edx add rax, 1 cmp edi, eax jg short loc_1430 mov eax, [r11+rsi*4-4] cmp ecx, eax cmovl ecx, eax jmp short loc_13FD loc_1454: movsxd rdx, [rbp+var_44] imul rdx, [rbp+var_50] lea eax, [r14-1] mov rbx, [rbp+var_58] cdqe add rax, rdx mov eax, [rbx+rax*4] mov rdx, [rbp+var_38] sub rdx, fs:28h jnz short loc_1496 lea rsp, [rbp-28h] pop rbx pop r12 pop r13 pop r14 pop r15 pop rbp retn loc_148B: or [rsp+rcx+1060h+var_1068], 0 jmp loc_13A8 loc_1496: call ___stack_chk_fail
long long func0(long long a1, int a2, int a3) { long long v3; // rbx unsigned long long v5; // r15 long long v6; // rcx long long *v7; // rdx __int16 v8; // cx signed long long v9; // rcx void *v10; // rsp _BYTE *v11; // r11 int v12; // r13d _BYTE *v13; // r10 long long v14; // rsi int v15; // ecx int v16; // r9d long long v17; // rax _BYTE v20[4088]; // [rsp+8h] [rbp-1060h] BYREF long long v21; // [rsp+1008h] [rbp-60h] BYREF _BYTE *v22; // [rsp+1010h] [rbp-58h] unsigned long long v23; // [rsp+1018h] [rbp-50h] int v24; // [rsp+1024h] [rbp-44h] unsigned long long v25; // [rsp+1030h] [rbp-38h] v3 = a2; v5 = 4LL * a2; v24 = a3; v25 = __readfsqword(0x28u); v6 = 4 * a2 * (long long)(a3 + 1) + 15; v7 = (long long *)((char *)&v21 - (v6 & 0xFFFFFFFFFFFFF000LL)); v8 = v6 & 0xFFF0; if ( &v21 != v7 ) { while ( v20 != (_BYTE *)v7 ) ; } v9 = v8 & 0xFFF; v10 = alloca(v9); if ( v9 ) *(_QWORD *)&v20[v9 - 8] = *(_QWORD *)&v20[v9 - 8]; v22 = v20; v23 = v5 >> 2; if ( v24 >= 0 ) { v11 = v20; v12 = 0; v13 = &v20[-4 * (v5 >> 2)]; while ( 1 ) { v14 = 0LL; if ( a2 > 0 ) { do { if ( (_DWORD)v14 && v12 ) { v17 = 0LL; v15 = 0; do { v16 = *(_DWORD *)(a1 + 4 * v14); if ( v15 < *(_DWORD *)&v13[4 * v17] + v16 - *(_DWORD *)(a1 + 4 * v17) ) v15 = *(_DWORD *)&v13[4 * v17] + v16 - *(_DWORD *)(a1 + 4 * v17); ++v17; } while ( (int)v14 > (int)v17 ); if ( v15 < *(_DWORD *)&v11[4 * v14 - 4] ) v15 = *(_DWORD *)&v11[4 * v14 - 4]; } else { v15 = 0; } *(_DWORD *)&v11[4 * v14++] = v15; } while ( v3 != v14 ); } v11 += v5; v13 += v5; if ( v24 == v12 ) break; ++v12; } } return *(unsigned int *)&v22[4 * v23 * v24 - 4 + 4 * a2]; }
func0: ENDBR64 PUSH RBP MOV R8,RDI MOV RBP,RSP PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBX MOVSXD RBX,ESI MOV R14,RBX LEA R15,[RBX*0x4] SUB RSP,0x38 MOV dword ptr [RBP + -0x44],EDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x38],RAX XOR EAX,EAX LEA EAX,[RDX + 0x1] MOV RDX,RSP CDQE IMUL RAX,RBX LEA RAX,[0xf + RAX*0x4] MOV RCX,RAX AND RAX,-0x1000 SUB RDX,RAX AND RCX,-0x10 CMP RSP,RDX JZ 0x00101396 LAB_00101381: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RDX JNZ 0x00101381 LAB_00101396: AND ECX,0xfff SUB RSP,RCX TEST RCX,RCX JNZ 0x0010148b LAB_001013a8: MOV RAX,R15 MOV EDX,dword ptr [RBP + -0x44] MOV RDI,RSP SHR RAX,0x2 MOV qword ptr [RBP + -0x58],RDI MOV qword ptr [RBP + -0x50],RAX TEST EDX,EDX JS 0x00101454 NEG RAX MOV R11,RDI XOR R13D,R13D LEA R10,[RDI + RAX*0x4] NOP word ptr [RAX + RAX*0x1] LAB_001013d8: TEST R13D,R13D SETZ R12B XOR ESI,ESI TEST R14D,R14D JLE 0x0010140a NOP word ptr CS:[RAX + RAX*0x1] LAB_001013f0: MOV EDI,ESI TEST ESI,ESI JZ 0x001013fb TEST R12B,R12B JZ 0x00101420 LAB_001013fb: XOR ECX,ECX LAB_001013fd: MOV dword ptr [R11 + RSI*0x4],ECX ADD RSI,0x1 CMP RBX,RSI JNZ 0x001013f0 LAB_0010140a: LEA EAX,[R13 + 0x1] ADD R11,R15 ADD R10,R15 CMP dword ptr [RBP + -0x44],R13D JZ 0x00101454 MOV R13D,EAX JMP 0x001013d8 LAB_00101420: MOV R9D,dword ptr [R8 + RSI*0x4] XOR EAX,EAX XOR ECX,ECX NOP dword ptr [RAX + RAX*0x1] LAB_00101430: MOV EDX,R9D SUB EDX,dword ptr [R8 + RAX*0x4] ADD EDX,dword ptr [R10 + RAX*0x4] CMP ECX,EDX CMOVL ECX,EDX ADD RAX,0x1 CMP EDI,EAX JG 0x00101430 MOV EAX,dword ptr [R11 + RSI*0x4 + -0x4] CMP ECX,EAX CMOVL ECX,EAX JMP 0x001013fd LAB_00101454: MOVSXD RDX,dword ptr [RBP + -0x44] IMUL RDX,qword ptr [RBP + -0x50] LEA EAX,[R14 + -0x1] MOV RBX,qword ptr [RBP + -0x58] CDQE ADD RAX,RDX MOV EAX,dword ptr [RBX + RAX*0x4] MOV RDX,qword ptr [RBP + -0x38] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101496 LEA RSP,[RBP + -0x28] POP RBX POP R12 POP R13 POP R14 POP R15 POP RBP RET LAB_0010148b: OR qword ptr [RSP + RCX*0x1 + -0x8],0x0 JMP 0x001013a8 LAB_00101496: CALL 0x00101080
int4 func0(long param_1,int param_2,int param_3) { long lVar1; long lVar2; int iVar3; int iVar4; ulong uVar5; int1 *puVar6; ulong uVar8; int1 *puVar9; int1 *puVar10; int iVar11; long in_FS_OFFSET; bool bVar12; int1 auStack_68 [8]; int1 *local_60; ulong local_58; int local_4c; long local_40; int1 *puVar7; uVar5 = (ulong)param_2; puVar6 = auStack_68; local_40 = *(long *)(in_FS_OFFSET + 0x28); uVar8 = (long)(param_3 + 1) * uVar5 * 4 + 0xf; puVar7 = auStack_68; puVar10 = auStack_68; while (puVar7 != auStack_68 + -(uVar8 & 0xfffffffffffff000)) { puVar6 = puVar10 + -0x1000; *(int8 *)(puVar10 + -8) = *(int8 *)(puVar10 + -8); puVar7 = puVar10 + -0x1000; puVar10 = puVar10 + -0x1000; } uVar8 = (ulong)((uint)uVar8 & 0xff0); lVar1 = -uVar8; local_60 = puVar6 + lVar1; puVar10 = puVar6 + lVar1; if (uVar8 != 0) { *(int8 *)(puVar6 + -8) = *(int8 *)(puVar6 + -8); } local_58 = uVar5 & 0x3fffffffffffffff; if (-1 < param_3) { puVar9 = puVar6 + local_58 * -4 + lVar1; iVar11 = 0; do { uVar8 = 0; if (0 < param_2) { do { if (((int)uVar8 == 0) || (iVar11 == 0)) { iVar3 = 0; } else { lVar2 = 0; iVar3 = 0; do { iVar4 = (*(int *)(param_1 + uVar8 * 4) - *(int *)(param_1 + lVar2 * 4)) + *(int *)(puVar9 + lVar2 * 4); if (iVar3 < iVar4) { iVar3 = iVar4; } lVar2 = lVar2 + 1; } while ((int)lVar2 < (int)uVar8); if (iVar3 < *(int *)(puVar10 + uVar8 * 4 + -4)) { iVar3 = *(int *)(puVar10 + uVar8 * 4 + -4); } } *(int *)(puVar10 + uVar8 * 4) = iVar3; uVar8 = uVar8 + 1; } while (uVar5 != uVar8); } puVar10 = puVar10 + uVar5 * 4; puVar9 = puVar9 + uVar5 * 4; bVar12 = param_3 != iVar11; iVar11 = iVar11 + 1; } while (bVar12); } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return *(int4 *)(puVar6 + ((long)(param_2 + -1) + (long)param_3 * local_58) * 4 + lVar1); } /* WARNING: Subroutine does not return */ *(int8 *)(puVar6 + lVar1 + -8) = 0x10149b; local_4c = param_3; __stack_chk_fail(); }
5,771
func0
#include <stdio.h> #include <assert.h>
int func0(int price[], int n, int k) { int final_profit[k + 1][n]; for (int i = 0; i <= k; i++) { for (int j = 0; j < n; j++) { if (i == 0 || j == 0) { final_profit[i][j] = 0; } else { int max_so_far = 0; for (int x = 0; x < j; x++) { int curr_price = price[j] - price[x] + final_profit[i-1][x]; if (max_so_far < curr_price) { max_so_far = curr_price; } } final_profit[i][j] = (final_profit[i][j-1] > max_so_far) ? final_profit[i][j-1] : max_so_far; } } } return final_profit[k][n-1]; }
int main() { int prices1[] = {1, 5, 2, 3, 7, 6, 4, 5}; int n1 = sizeof(prices1) / sizeof(prices1[0]); assert(func0(prices1, n1, 3) == 10); int prices2[] = {2, 4, 7, 5, 4, 3, 5}; int n2 = sizeof(prices2) / sizeof(prices2[0]); assert(func0(prices2, n2, 2) == 7); int prices3[] = {10, 6, 8, 4, 2}; int n3 = sizeof(prices3) / sizeof(prices3[0]); assert(func0(prices3, n3, 2) == 2); printf("All tests passed.\n"); return 0; }
O3
c
func0: endbr64 push %rbp mov %edx,%eax add $0x1,%eax cltq mov %rsp,%rbp push %r15 push %r14 push %r13 push %r12 push %rbx sub $0x58,%rsp mov %edx,-0x58(%rbp) movslq %esi,%rdx imul %rdx,%rax mov %fs:0x28,%rbx mov %rbx,-0x38(%rbp) xor %ebx,%ebx lea 0x0(,%rdx,4),%rbx lea 0xf(,%rax,4),%rax mov %rbx,-0x70(%rbp) mov %rsp,%rbx mov %rax,%rdx and $0xfffffffffffff000,%rax sub %rax,%rbx and $0xfffffffffffffff0,%rdx mov %rbx,%rax cmp %rax,%rsp je 1349 <func0+0x79> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 1334 <func0+0x64> and $0xfff,%edx sub %rdx,%rsp test %rdx,%rdx jne 159a <func0+0x2ca> mov -0x70(%rbp),%rax mov -0x58(%rbp),%edx mov %rsp,%r15 shr $0x2,%rax mov %rax,-0x68(%rbp) test %edx,%edx js 15a5 <func0+0x2d5> test %esi,%esi jle 15a5 <func0+0x2d5> neg %rax lea -0x1(%rsi),%r12d movl $0xffffffff,-0x54(%rbp) lea (%r15,%rax,4),%rax mov %r12d,-0x74(%rbp) mov %rax,-0x60(%rbp) nopw 0x0(%rax,%rax,1) mov -0x54(%rbp),%eax mov -0x70(%rbp),%rsi movslq %eax,%rcx add $0x1,%eax sete %r13b mov %eax,-0x54(%rbp) imul -0x68(%rbp),%rcx mov -0x60(%rbp),%rax mov %rax,%r10 add %rsi,%rax mov %rcx,%r14 mov %rax,-0x60(%rbp) mov %rax,%rdx xor %eax,%eax mov %r10,-0x48(%rbp) jmp 13f2 <func0+0x122> nopl (%rax) movl $0x0,(%rdx) lea 0x1(%rax),%rcx add $0x4,%rdx cmp %r12,%rax je 154c <func0+0x27c> mov %rcx,%rax mov %eax,%esi test %eax,%eax je 13d8 <func0+0x108> test %r13b,%r13b jne 13d8 <func0+0x108> test %eax,%eax mov $0x1,%r11d mov (%rdi,%rax,4),%r9d cmovg %eax,%r11d cmp $0x3,%eax jle 1590 <func0+0x2c0> mov %r11d,%r8d movd %r9d,%xmm6 mov -0x48(%rbp),%r10 xor %ecx,%ecx shr $0x2,%r8d pshufd $0x0,%xmm6,%xmm3 pxor %xmm0,%xmm0 shl $0x4,%r8 nopl (%rax) movdqu (%rdi,%rcx,1),%xmm4 movdqu (%r10,%rcx,1),%xmm5 movdqa %xmm3,%xmm2 add $0x10,%rcx psubd %xmm4,%xmm2 paddd %xmm5,%xmm2 movdqa %xmm2,%xmm1 pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm2 pandn %xmm0,%xmm1 movdqa %xmm1,%xmm0 por %xmm2,%xmm0 cmp %r8,%rcx jne 1438 <func0+0x168> movdqa %xmm0,%xmm2 mov %r11d,%r8d mov %r10,-0x48(%rbp) psrldq $0x8,%xmm2 and $0xfffffffc,%r8d and $0x3,%r11d movdqa %xmm2,%xmm1 pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm2 pandn %xmm0,%xmm1 movdqa %xmm1,%xmm0 por %xmm2,%xmm0 movdqa %xmm0,%xmm2 psrldq $0x4,%xmm2 movdqa %xmm2,%xmm1 pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm2 pandn %xmm0,%xmm1 por %xmm2,%xmm1 movd %xmm1,%ecx je 1531 <func0+0x261> movslq %r8d,%r11 lea 0x0(,%r11,4),%rbx mov %rbx,%r10 mov %r9d,%ebx sub (%rdi,%r11,4),%ebx add %r14,%r11 add (%r15,%r11,4),%ebx lea 0x1(%r8),%r11d cmp %ebx,%ecx cmovl %ebx,%ecx cmp %esi,%r11d jge 1531 <func0+0x261> mov %r10,%rbx movslq %r11d,%r11 mov %r10,-0x50(%rbp) mov %r9d,%r10d add %r14,%r11 sub 0x4(%rdi,%rbx,1),%r10d mov %r10d,%ebx add (%r15,%r11,4),%ebx cmp %ebx,%ecx cmovl %ebx,%ecx add $0x2,%r8d cmp %esi,%r8d jge 1531 <func0+0x261> mov -0x50(%rbp),%rbx movslq %r8d,%r8 add %r14,%r8 sub 0x8(%rdi,%rbx,1),%r9d add (%r15,%r8,4),%r9d cmp %r9d,%ecx cmovl %r9d,%ecx cmp %ecx,-0x4(%rdx) cmovge -0x4(%rdx),%ecx add $0x4,%rdx mov %ecx,-0x4(%rdx) lea 0x1(%rax),%rcx cmp %r12,%rax jne 13ef <func0+0x11f> mov -0x58(%rbp),%esi cmp %esi,-0x54(%rbp) jne 13a0 <func0+0xd0> movslq -0x58(%rbp),%rax imul -0x68(%rbp),%rax movslq -0x74(%rbp),%rdx add %rdx,%rax mov -0x38(%rbp),%rsi xor %fs:0x28,%rsi mov (%r15,%rax,4),%eax jne 15ad <func0+0x2dd> lea -0x28(%rbp),%rsp pop %rbx pop %r12 pop %r13 pop %r14 pop %r15 pop %rbp retq nopw 0x0(%rax,%rax,1) xor %ecx,%ecx xor %r8d,%r8d jmpq 14c3 <func0+0x1f3> orq $0x0,-0x8(%rsp,%rdx,1) jmpq 135b <func0+0x8b> lea -0x1(%rsi),%eax mov %eax,-0x74(%rbp) jmp 1558 <func0+0x288> callq 1080 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 push rbp mov rcx, rdi mov rbp, rsp push r15 push r14 push r13 movsxd r13, edx push r12 movsxd r12, esi push rbx mov rax, r12 lea r11, ds:0[r12*4] sub rsp, 48h mov rdx, fs:28h mov [rbp+var_38], rdx xor edx, edx lea edx, [r13+1] mov rsi, rsp movsxd rdx, edx imul rdx, r12 lea rdx, ds:0Fh[rdx*4] mov rdi, rdx and rdx, 0FFFFFFFFFFFFF000h sub rsi, rdx and rdi, 0FFFFFFFFFFFFFFF0h cmp rsp, rsi jz short loc_1349 loc_1334: sub rsp, 1000h or [rsp+1070h+var_78], 0 cmp rsp, rsi jnz short loc_1334 loc_1349: and edi, 0FFFh sub rsp, rdi test rdi, rdi jnz loc_1576 loc_135B: mov rsi, r11 mov r15, rsp shr rsi, 2 test r13d, r13d js loc_140B test eax, eax jle loc_140B mov rdx, rsi mov [rbp+var_68], rsi mov r10, r15 mov r9d, 0FFFFFFFFh mov [rbp+var_6C], eax neg rdx mov [rbp+var_60], r13d lea r8, [r15+rdx*4] mov [rbp+var_50], r15 nop dword ptr [rax+rax+00000000h] loc_13A0: mov rdi, [rbp+var_68] movsxd rbx, r9d add r9d, 1 mov [rbp+var_58], r11 setz r14b mov [rbp+var_5C], r9d xor eax, eax imul rbx, rdi mov [rbp+var_48], r8 nop dword ptr [rax+00000000h] loc_13C8: mov r9d, eax test eax, eax jz short loc_13D4 test r14b, r14b jz short loc_1440 loc_13D4: xor edx, edx loc_13D6: mov [r10+rax*4], edx add rax, 1 cmp r12, rax jnz short loc_13C8 mov r11, [rbp+var_58] mov r8, [rbp+var_48] mov r9d, [rbp+var_5C] mov eax, [rbp+var_60] add r10, r11 add r8, r11 cmp r9d, eax jnz short loc_13A0 movsxd r13, eax mov rsi, [rbp+var_68] mov eax, [rbp+var_6C] mov r15, [rbp+var_50] loc_140B: imul r13, rsi sub eax, 1 cdqe add rax, r13 mov eax, [r15+rax*4] mov rdx, [rbp+var_38] sub rdx, fs:28h jnz loc_1581 lea rsp, [rbp-28h] pop rbx pop r12 pop r13 pop r14 pop r15 pop rbp retn loc_1440: mov edi, [rcx+rax*4] mov r11d, eax cmp rax, 3 jbe loc_1570 mov esi, eax movd xmm6, edi mov r8, [rbp+var_48] xor edx, edx shr esi, 2 pshufd xmm3, xmm6, 0 pxor xmm2, xmm2 shl rsi, 4 nop dword ptr [rax+00h] loc_1470: movdqu xmm4, xmmword ptr [rcx+rdx] movdqu xmm5, xmmword ptr [r8+rdx] movdqa xmm0, xmm3 add rdx, 10h psubd xmm0, xmm4 paddd xmm0, xmm5 movdqa xmm1, xmm0 pcmpgtd xmm1, xmm2 pand xmm0, xmm1 pandn xmm1, xmm2 movdqa xmm2, xmm1 por xmm2, xmm0 cmp rsi, rdx jnz short loc_1470 movdqa xmm1, xmm2 mov esi, r11d mov [rbp+var_48], r8 psrldq xmm1, 8 and esi, 0FFFFFFFCh and r11d, 3 movdqa xmm0, xmm1 pcmpgtd xmm0, xmm2 pand xmm1, xmm0 pandn xmm0, xmm2 por xmm0, xmm1 movdqa xmm2, xmm0 psrldq xmm2, 4 movdqa xmm1, xmm2 pcmpgtd xmm1, xmm0 pand xmm2, xmm1 pandn xmm1, xmm0 por xmm1, xmm2 movd edx, xmm1 jz short loc_1558 loc_14F6: movsxd r11, esi mov r8, [rbp+var_50] mov r13d, edi lea r15, ds:0[r11*4] sub r13d, [rcx+r11*4] add r11, rbx add r13d, [r8+r11*4] lea r11d, [rsi+1] cmp edx, r13d cmovl edx, r13d cmp r11d, r9d jge short loc_1558 movsxd r11, r11d mov r13d, edi sub r13d, [rcx+r15+4] add r11, rbx add r13d, [r8+r11*4] cmp edx, r13d cmovl edx, r13d add esi, 2 cmp esi, r9d jge short loc_1558 movsxd rsi, esi sub edi, [rcx+r15+8] add rsi, rbx add edi, [r8+rsi*4] cmp edx, edi cmovl edx, edi loc_1558: mov esi, [r10+rax*4-4] cmp edx, esi cmovl edx, esi jmp loc_13D6 loc_1570: xor esi, esi xor edx, edx jmp short loc_14F6 loc_1576: or [rsp+rdi+1070h+var_1078], 0 jmp loc_135B loc_1581: call ___stack_chk_fail
long long func0(long long a1, int a2, int a3) { long long v4; // r13 long long v5; // r12 int v6; // eax unsigned long long v7; // r11 long long v8; // rdi _BYTE *v9; // rsi __int16 v10; // di signed long long v11; // rdi void *v12; // rsp _BYTE *v13; // r15 unsigned long long v14; // rsi _BYTE *v15; // r10 int v16; // r9d _BYTE *v17; // r8 unsigned long long v18; // rax unsigned long long v19; // rbx int v20; // edx unsigned int v22; // edi long long v23; // rdx __m128i v24; // xmm3 __m128i v25; // xmm2 __m128i v26; // xmm4 __m128i v27; // xmm5 __m128i v28; // xmm0 __m128i v29; // xmm1 __m128i v30; // xmm1 int v31; // esi __m128i v32; // xmm0 __m128i v33; // xmm0 __m128i v34; // xmm2 __m128i v35; // xmm1 long long v36; // r15 int v37; // r11d int v38; // esi int v39; // edi _BYTE v41[4088]; // [rsp+8h] [rbp-1070h] BYREF _BYTE v42[4]; // [rsp+1008h] [rbp-70h] BYREF int v43; // [rsp+100Ch] [rbp-6Ch] unsigned long long v44; // [rsp+1010h] [rbp-68h] int v45; // [rsp+1018h] [rbp-60h] int v46; // [rsp+101Ch] [rbp-5Ch] unsigned long long v47; // [rsp+1020h] [rbp-58h] _BYTE *v48; // [rsp+1028h] [rbp-50h] _BYTE *v49; // [rsp+1030h] [rbp-48h] unsigned long long v50; // [rsp+1040h] [rbp-38h] v4 = a3; v5 = a2; v6 = a2; v7 = 4LL * a2; v50 = __readfsqword(0x28u); v8 = 4 * a2 * (long long)(a3 + 1) + 15; v9 = &v42[-(v8 & 0xFFFFFFFFFFFFF000LL)]; v10 = v8 & 0xFFF0; if ( v42 != v9 ) { while ( v41 != v9 ) ; } v11 = v10 & 0xFFF; v12 = alloca(v11); if ( v11 ) *(_QWORD *)&v41[v11 - 8] = *(_QWORD *)&v41[v11 - 8]; v13 = v41; v14 = v7 >> 2; if ( a3 >= 0 && v6 > 0 ) { v44 = v7 >> 2; v15 = v41; v16 = -1; v43 = v6; v45 = a3; v17 = &v41[-4 * v14]; v48 = v41; while ( 1 ) { v47 = v7; v46 = v16 + 1; v18 = 0LL; v19 = v44 * v16; v49 = v17; do { if ( !(_DWORD)v18 || v16 == -1 ) { v20 = 0; goto LABEL_12; } v22 = *(_DWORD *)(a1 + 4 * v18); if ( v18 <= 3 ) { v31 = 0; v20 = 0; LABEL_20: v36 = 4LL * v31; v37 = v31 + 1; if ( v20 < (int)(*(_DWORD *)&v48[4 * v19 + 4 * v31] + v22 - *(_DWORD *)(a1 + v36)) ) v20 = *(_DWORD *)&v48[4 * v19 + 4 * v31] + v22 - *(_DWORD *)(a1 + 4LL * v31); if ( v37 < (int)v18 ) { if ( v20 < (int)(*(_DWORD *)&v48[4 * v19 + 4 * v37] + v22 - *(_DWORD *)(a1 + v36 + 4)) ) v20 = *(_DWORD *)&v48[4 * v19 + 4 * v37] + v22 - *(_DWORD *)(a1 + v36 + 4); v38 = v31 + 2; if ( v38 < (int)v18 ) { v39 = *(_DWORD *)&v48[4 * v19 + 4 * v38] + v22 - *(_DWORD *)(a1 + v36 + 8); if ( v20 < v39 ) v20 = v39; } } goto LABEL_28; } v23 = 0LL; v24 = _mm_shuffle_epi32(_mm_cvtsi32_si128(v22), 0); v25 = 0LL; do { v26 = _mm_loadu_si128((const __m128i *)(a1 + v23)); v27 = _mm_loadu_si128((const __m128i *)&v49[v23]); v23 += 16LL; v28 = _mm_add_epi32(_mm_sub_epi32(v24, v26), v27); v29 = _mm_cmpgt_epi32(v28, v25); v25 = _mm_or_si128(_mm_andnot_si128(v29, v25), _mm_and_si128(v28, v29)); } while ( 16LL * ((unsigned int)v18 >> 2) != v23 ); v30 = _mm_srli_si128(v25, 8); v31 = v18 & 0xFFFFFFFC; v32 = _mm_cmpgt_epi32(v30, v25); v33 = _mm_or_si128(_mm_andnot_si128(v32, v25), _mm_and_si128(v30, v32)); v34 = _mm_srli_si128(v33, 4); v35 = _mm_cmpgt_epi32(v34, v33); v20 = _mm_cvtsi128_si32(_mm_or_si128(_mm_andnot_si128(v35, v33), _mm_and_si128(v34, v35))); if ( (v18 & 3) != 0 ) goto LABEL_20; LABEL_28: if ( v20 < *(_DWORD *)&v15[4 * v18 - 4] ) v20 = *(_DWORD *)&v15[4 * v18 - 4]; LABEL_12: *(_DWORD *)&v15[4 * v18++] = v20; } while ( v5 != v18 ); v7 = v47; v16 = v46; v15 += v47; v17 = &v49[v47]; if ( v46 == v45 ) { v4 = v45; v14 = v44; v6 = v43; v13 = v48; return *(unsigned int *)&v13[4 * v14 * v4 - 4 + 4 * v6]; } } } return *(unsigned int *)&v13[4 * v14 * v4 - 4 + 4 * v6]; }
func0: ENDBR64 PUSH RBP MOV RCX,RDI MOV RBP,RSP PUSH R15 PUSH R14 PUSH R13 MOVSXD R13,EDX PUSH R12 MOVSXD R12,ESI PUSH RBX MOV RAX,R12 LEA R11,[R12*0x4] SUB RSP,0x48 MOV RDX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x38],RDX XOR EDX,EDX LEA EDX,[R13 + 0x1] MOV RSI,RSP MOVSXD RDX,EDX IMUL RDX,R12 LEA RDX,[0xf + RDX*0x4] MOV RDI,RDX AND RDX,-0x1000 SUB RSI,RDX AND RDI,-0x10 CMP RSP,RSI JZ 0x00101349 LAB_00101334: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RSI JNZ 0x00101334 LAB_00101349: AND EDI,0xfff SUB RSP,RDI TEST RDI,RDI JNZ 0x00101576 LAB_0010135b: MOV RSI,R11 MOV R15,RSP SHR RSI,0x2 TEST R13D,R13D JS 0x0010140b TEST EAX,EAX JLE 0x0010140b MOV RDX,RSI MOV qword ptr [RBP + -0x68],RSI MOV R10,R15 MOV R9D,0xffffffff MOV dword ptr [RBP + -0x6c],EAX NEG RDX MOV dword ptr [RBP + -0x60],R13D LEA R8,[R15 + RDX*0x4] MOV qword ptr [RBP + -0x50],R15 NOP dword ptr [RAX + RAX*0x1] LAB_001013a0: MOV RDI,qword ptr [RBP + -0x68] MOVSXD RBX,R9D ADD R9D,0x1 MOV qword ptr [RBP + -0x58],R11 SETZ R14B MOV dword ptr [RBP + -0x5c],R9D XOR EAX,EAX IMUL RBX,RDI MOV qword ptr [RBP + -0x48],R8 NOP dword ptr [RAX] LAB_001013c8: MOV R9D,EAX TEST EAX,EAX JZ 0x001013d4 TEST R14B,R14B JZ 0x00101440 LAB_001013d4: XOR EDX,EDX LAB_001013d6: MOV dword ptr [R10 + RAX*0x4],EDX ADD RAX,0x1 CMP R12,RAX JNZ 0x001013c8 MOV R11,qword ptr [RBP + -0x58] MOV R8,qword ptr [RBP + -0x48] MOV R9D,dword ptr [RBP + -0x5c] MOV EAX,dword ptr [RBP + -0x60] ADD R10,R11 ADD R8,R11 CMP R9D,EAX JNZ 0x001013a0 MOVSXD R13,EAX MOV RSI,qword ptr [RBP + -0x68] MOV EAX,dword ptr [RBP + -0x6c] MOV R15,qword ptr [RBP + -0x50] LAB_0010140b: IMUL R13,RSI SUB EAX,0x1 CDQE ADD RAX,R13 MOV EAX,dword ptr [R15 + RAX*0x4] MOV RDX,qword ptr [RBP + -0x38] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101581 LEA RSP,[RBP + -0x28] POP RBX POP R12 POP R13 POP R14 POP R15 POP RBP RET LAB_00101440: MOV EDI,dword ptr [RCX + RAX*0x4] MOV R11D,EAX CMP RAX,0x3 JBE 0x00101570 MOV ESI,EAX MOVD XMM6,EDI MOV R8,qword ptr [RBP + -0x48] XOR EDX,EDX SHR ESI,0x2 PSHUFD XMM3,XMM6,0x0 PXOR XMM2,XMM2 SHL RSI,0x4 NOP dword ptr [RAX] LAB_00101470: MOVDQU XMM4,xmmword ptr [RCX + RDX*0x1] MOVDQU XMM5,xmmword ptr [R8 + RDX*0x1] MOVDQA XMM0,XMM3 ADD RDX,0x10 PSUBD XMM0,XMM4 PADDD XMM0,XMM5 MOVDQA XMM1,XMM0 PCMPGTD XMM1,XMM2 PAND XMM0,XMM1 PANDN XMM1,XMM2 MOVDQA XMM2,XMM1 POR XMM2,XMM0 CMP RSI,RDX JNZ 0x00101470 MOVDQA XMM1,XMM2 MOV ESI,R11D MOV qword ptr [RBP + -0x48],R8 PSRLDQ XMM1,0x8 AND ESI,0xfffffffc AND R11D,0x3 MOVDQA XMM0,XMM1 PCMPGTD XMM0,XMM2 PAND XMM1,XMM0 PANDN XMM0,XMM2 POR XMM0,XMM1 MOVDQA XMM2,XMM0 PSRLDQ XMM2,0x4 MOVDQA XMM1,XMM2 PCMPGTD XMM1,XMM0 PAND XMM2,XMM1 PANDN XMM1,XMM0 POR XMM1,XMM2 MOVD EDX,XMM1 JZ 0x00101558 LAB_001014f6: MOVSXD R11,ESI MOV R8,qword ptr [RBP + -0x50] MOV R13D,EDI LEA R15,[R11*0x4] SUB R13D,dword ptr [RCX + R11*0x4] ADD R11,RBX ADD R13D,dword ptr [R8 + R11*0x4] LEA R11D,[RSI + 0x1] CMP EDX,R13D CMOVL EDX,R13D CMP R11D,R9D JGE 0x00101558 MOVSXD R11,R11D MOV R13D,EDI SUB R13D,dword ptr [RCX + R15*0x1 + 0x4] ADD R11,RBX ADD R13D,dword ptr [R8 + R11*0x4] CMP EDX,R13D CMOVL EDX,R13D ADD ESI,0x2 CMP ESI,R9D JGE 0x00101558 MOVSXD RSI,ESI SUB EDI,dword ptr [RCX + R15*0x1 + 0x8] ADD RSI,RBX ADD EDI,dword ptr [R8 + RSI*0x4] CMP EDX,EDI CMOVL EDX,EDI LAB_00101558: MOV ESI,dword ptr [R10 + RAX*0x4 + -0x4] CMP EDX,ESI CMOVL EDX,ESI JMP 0x001013d6 LAB_00101570: XOR ESI,ESI XOR EDX,EDX JMP 0x001014f6 LAB_00101576: OR qword ptr [RSP + RDI*0x1 + -0x8],0x0 JMP 0x0010135b LAB_00101581: CALL 0x00101080
int4 func0(long param_1,int param_2,int param_3) { int *piVar1; int *piVar2; long lVar3; int iVar4; long lVar5; int *puVar6; ulong uVar7; uint uVar8; long lVar9; long lVar10; int *puVar11; ulong uVar13; uint uVar14; int *puVar15; ulong uVar16; uint uVar17; long in_FS_OFFSET; uint uVar18; uint uVar19; uint uVar20; uint uVar21; uint uVar22; uint uVar23; uint uVar24; uint uVar25; uint uVar26; uint uVar27; int auStack_78 [4]; int local_74; ulong local_70; int local_68; int local_64; long local_60; int *local_58; int *local_50; long local_40; int *puVar12; uVar16 = (ulong)param_2; lVar3 = uVar16 * 4; puVar11 = auStack_78; local_40 = *(long *)(in_FS_OFFSET + 0x28); uVar13 = (long)(param_3 + 1) * uVar16 * 4 + 0xf; puVar12 = auStack_78; puVar15 = auStack_78; while (puVar12 != auStack_78 + -(uVar13 & 0xfffffffffffff000)) { puVar11 = puVar15 + -0x1000; *(int8 *)(puVar15 + -8) = *(int8 *)(puVar15 + -8); puVar12 = puVar15 + -0x1000; puVar15 = puVar15 + -0x1000; } uVar13 = (ulong)((uint)uVar13 & 0xff0); lVar5 = -uVar13; puVar15 = puVar11 + lVar5; if (uVar13 != 0) { *(int8 *)(puVar11 + -8) = *(int8 *)(puVar11 + -8); } uVar13 = uVar16 & 0x3fffffffffffffff; if ((-1 < param_3) && (0 < param_2)) { local_64 = -1; puVar6 = puVar11 + uVar13 * -4 + lVar5; do { local_50 = puVar6; lVar10 = (long)local_64; local_64 = local_64 + 1; uVar7 = 0; lVar10 = lVar10 * uVar13; do { uVar14 = (uint)uVar7; if ((uVar14 == 0) || (local_64 == 0)) { uVar8 = 0; } else { iVar4 = *(int *)(param_1 + uVar7 * 4); if (uVar7 < 4) { uVar18 = 0; uVar8 = 0; LAB_001014f6: lVar9 = (long)(int)uVar18; uVar17 = (iVar4 - *(int *)(param_1 + lVar9 * 4)) + *(int *)(puVar11 + (lVar9 + lVar10) * 4 + lVar5); if ((int)uVar8 < (int)uVar17) { uVar8 = uVar17; } if ((int)(uVar18 + 1) < (int)uVar14) { uVar17 = (iVar4 - *(int *)(param_1 + 4 + lVar9 * 4)) + *(int *)(puVar11 + ((int)(uVar18 + 1) + lVar10) * 4 + lVar5); if ((int)uVar8 < (int)uVar17) { uVar8 = uVar17; } if (((int)(uVar18 + 2) < (int)uVar14) && (uVar14 = (iVar4 - *(int *)(param_1 + 8 + lVar9 * 4)) + *(int *)(puVar11 + ((int)(uVar18 + 2) + lVar10) * 4 + lVar5), (int)uVar8 < (int)uVar14)) { uVar8 = uVar14; } } } else { lVar9 = 0; uVar8 = 0; uVar17 = 0; uVar23 = 0; uVar27 = 0; do { piVar1 = (int *)(param_1 + lVar9); piVar2 = (int *)(local_50 + lVar9); lVar9 = lVar9 + 0x10; uVar18 = (iVar4 - *piVar1) + *piVar2; uVar19 = (iVar4 - piVar1[1]) + piVar2[1]; uVar20 = (iVar4 - piVar1[2]) + piVar2[2]; uVar21 = (iVar4 - piVar1[3]) + piVar2[3]; uVar22 = -(uint)((int)uVar8 < (int)uVar18); uVar24 = -(uint)((int)uVar17 < (int)uVar19); uVar25 = -(uint)((int)uVar23 < (int)uVar20); uVar26 = -(uint)((int)uVar27 < (int)uVar21); uVar8 = ~uVar22 & uVar8 | uVar18 & uVar22; uVar17 = ~uVar24 & uVar17 | uVar19 & uVar24; uVar23 = ~uVar25 & uVar23 | uVar20 & uVar25; uVar27 = ~uVar26 & uVar27 | uVar21 & uVar26; } while ((uVar7 >> 2 & 0x3fffffff) << 4 != lVar9); uVar18 = uVar14 & 0xfffffffc; uVar8 = ~-(uint)((int)uVar8 < (int)uVar23) & uVar8 | uVar23 & -(uint)((int)uVar8 < (int)uVar23); uVar17 = ~-(uint)((int)uVar17 < (int)uVar27) & uVar17 | uVar27 & -(uint)((int)uVar17 < (int)uVar27); uVar23 = -(uint)((int)uVar8 < (int)uVar17); uVar8 = ~uVar23 & uVar8 | uVar17 & uVar23; if ((uVar7 & 3) != 0) goto LAB_001014f6; } if ((int)uVar8 < (int)*(uint *)(puVar15 + uVar7 * 4 + -4)) { uVar8 = *(uint *)(puVar15 + uVar7 * 4 + -4); } } *(uint *)(puVar15 + uVar7 * 4) = uVar8; uVar7 = uVar7 + 1; } while (uVar16 != uVar7); puVar15 = puVar15 + lVar3; puVar6 = local_50 + lVar3; local_74 = param_2; local_70 = uVar13; local_68 = param_3; local_60 = lVar3; local_58 = puVar11 + lVar5; } while (local_64 != param_3); } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return *(int4 *)(puVar11 + ((long)(param_2 + -1) + (long)param_3 * uVar13) * 4 + lVar5); } /* WARNING: Subroutine does not return */ *(int8 *)(puVar11 + lVar5 + -8) = 0x101586; __stack_chk_fail(); }
5,772
func0
#include <assert.h> #include <stdio.h>
void func0(const int test_tup[], int size, int result[]) { for (int i = 0; i < size - 1; i++) { result[i] = test_tup[i] + test_tup[i + 1]; } }
int main() { int result[4]; int test1[] = {1, 5, 7, 8, 10}; func0(test1, 5, result); assert(result[0] == 6 && result[1] == 12 && result[2] == 15 && result[3] == 18); int test2[] = {2, 6, 8, 9, 11}; func0(test2, 5, result); assert(result[0] == 8 && result[1] == 14 && result[2] == 17 && result[3] == 20); int test3[] = {3, 7, 9, 10, 12}; func0(test3, 5, result); assert(result[0] == 10 && result[1] == 16 && result[2] == 19 && result[3] == 22); 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,-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 add $0x1,%rax lea 0x0(,%rax,4),%rdx mov -0x18(%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 add %ecx,%edx mov %edx,(%rax) addl $0x1,-0x4(%rbp) mov -0x1c(%rbp),%eax sub $0x1,%eax cmp %eax,-0x4(%rbp) jl 1185 <func0+0x1c> 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_4], 0 jmp short loc_11D1 loc_1185: 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 add rax, 1 lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] 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 add edx, ecx mov [rax], edx add [rbp+var_4], 1 loc_11D1: mov eax, [rbp+var_1C] sub eax, 1 cmp [rbp+var_4], eax jl short loc_1185 nop nop pop rbp retn
long long func0(long long a1, int a2, long long a3) { long long result; // rax int i; // [rsp+24h] [rbp-4h] for ( i = 0; ; ++i ) { result = (unsigned int)(a2 - 1); if ( i >= (int)result ) break; *(_DWORD *)(4LL * i + a3) = *(_DWORD *)(4LL * i + a1) + *(_DWORD *)(4 * (i + 1LL) + a1); } return result; }
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 + -0x4],0x0 JMP 0x001011d1 LAB_00101185: 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 ADD RAX,0x1 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 RSI,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RSI ADD EDX,ECX MOV dword ptr [RAX],EDX ADD dword ptr [RBP + -0x4],0x1 LAB_001011d1: MOV EAX,dword ptr [RBP + -0x1c] SUB EAX,0x1 CMP dword ptr [RBP + -0x4],EAX JL 0x00101185 NOP NOP POP RBP RET
void func0(long param_1,int param_2,long param_3) { int4 local_c; for (local_c = 0; local_c < param_2 + -1; local_c = local_c + 1) { *(int *)(param_3 + (long)local_c * 4) = *(int *)(param_1 + ((long)local_c + 1) * 4) + *(int *)(param_1 + (long)local_c * 4); } return; }
5,773
func0
#include <assert.h> #include <stdio.h>
void func0(const int test_tup[], int size, int result[]) { for (int i = 0; i < size - 1; i++) { result[i] = test_tup[i] + test_tup[i + 1]; } }
int main() { int result[4]; int test1[] = {1, 5, 7, 8, 10}; func0(test1, 5, result); assert(result[0] == 6 && result[1] == 12 && result[2] == 15 && result[3] == 18); int test2[] = {2, 6, 8, 9, 11}; func0(test2, 5, result); assert(result[0] == 8 && result[1] == 14 && result[2] == 17 && result[3] == 20); int test3[] = {3, 7, 9, 10, 12}; func0(test3, 5, result); assert(result[0] == 10 && result[1] == 16 && result[2] == 19 && result[3] == 22); return 0; }
O1
c
func0: endbr64 cmp $0x1,%esi jle 1190 <func0+0x27> lea -0x2(%rsi),%esi mov $0x0,%eax mov 0x4(%rdi,%rax,4),%ecx add (%rdi,%rax,4),%ecx mov %ecx,(%rdx,%rax,4) mov %rax,%rcx add $0x1,%rax cmp %rsi,%rcx jne 117a <func0+0x11> retq
func0: endbr64 cmp esi, 1 jle short locret_1190 lea esi, [rsi-2] mov eax, 0 loc_117A: mov ecx, [rdi+rax*4+4] add ecx, [rdi+rax*4] mov [rdx+rax*4], ecx mov rcx, rax add rax, 1 cmp rcx, rsi jnz short loc_117A locret_1190: retn
void func0(long long a1, int a2, long long a3) { long long v3; // rsi long long v4; // rax long long v5; // rcx if ( a2 > 1 ) { v3 = (unsigned int)(a2 - 2); v4 = 0LL; do { *(_DWORD *)(a3 + 4 * v4) = *(_DWORD *)(a1 + 4 * v4) + *(_DWORD *)(a1 + 4 * v4 + 4); v5 = v4++; } while ( v5 != v3 ); } }
func0: ENDBR64 CMP ESI,0x1 JLE 0x00101190 LEA ESI,[RSI + -0x2] MOV EAX,0x0 LAB_0010117a: MOV ECX,dword ptr [RDI + RAX*0x4 + 0x4] ADD ECX,dword ptr [RDI + RAX*0x4] MOV dword ptr [RDX + RAX*0x4],ECX MOV RCX,RAX ADD RAX,0x1 CMP RCX,RSI JNZ 0x0010117a LAB_00101190: RET
void func0(long param_1,int param_2,long param_3) { ulong uVar1; bool bVar2; if (1 < param_2) { uVar1 = 0; do { *(int *)(param_3 + uVar1 * 4) = *(int *)(param_1 + 4 + uVar1 * 4) + *(int *)(param_1 + uVar1 * 4); bVar2 = uVar1 != param_2 - 2; uVar1 = uVar1 + 1; } while (bVar2); } return; }
5,774
func0
#include <assert.h> #include <stdio.h>
void func0(const int test_tup[], int size, int result[]) { for (int i = 0; i < size - 1; i++) { result[i] = test_tup[i] + test_tup[i + 1]; } }
int main() { int result[4]; int test1[] = {1, 5, 7, 8, 10}; func0(test1, 5, result); assert(result[0] == 6 && result[1] == 12 && result[2] == 15 && result[3] == 18); int test2[] = {2, 6, 8, 9, 11}; func0(test2, 5, result); assert(result[0] == 8 && result[1] == 14 && result[2] == 17 && result[3] == 20); int test3[] = {3, 7, 9, 10, 12}; func0(test3, 5, result); assert(result[0] == 10 && result[1] == 16 && result[2] == 19 && result[3] == 22); return 0; }
O2
c
func0: endbr64 cmp $0x1,%esi jle 1166 <func0+0x26> sub $0x2,%esi xor %eax,%eax xchg %ax,%ax mov 0x4(%rdi,%rax,4),%ecx add (%rdi,%rax,4),%ecx mov %ecx,(%rdx,%rax,4) mov %rax,%rcx add $0x1,%rax cmp %rsi,%rcx jne 1150 <func0+0x10> retq nopw 0x0(%rax,%rax,1)
func0: endbr64 cmp esi, 1 jle short locret_1346 sub esi, 2 xor eax, eax xchg ax, ax loc_1330: mov ecx, [rdi+rax*4+4] add ecx, [rdi+rax*4] mov [rdx+rax*4], ecx mov rcx, rax add rax, 1 cmp rcx, rsi jnz short loc_1330 locret_1346: retn
void func0(long long a1, int a2, long long a3) { long long v3; // rsi long long v4; // rax long long v5; // rcx if ( a2 > 1 ) { v3 = (unsigned int)(a2 - 2); v4 = 0LL; do { *(_DWORD *)(a3 + 4 * v4) = *(_DWORD *)(a1 + 4 * v4) + *(_DWORD *)(a1 + 4 * v4 + 4); v5 = v4++; } while ( v5 != v3 ); } }
func0: ENDBR64 CMP ESI,0x1 JLE 0x00101346 SUB ESI,0x2 XOR EAX,EAX NOP LAB_00101330: MOV ECX,dword ptr [RDI + RAX*0x4 + 0x4] ADD ECX,dword ptr [RDI + RAX*0x4] MOV dword ptr [RDX + RAX*0x4],ECX MOV RCX,RAX ADD RAX,0x1 CMP RCX,RSI JNZ 0x00101330 LAB_00101346: RET
void func0(long param_1,int param_2,long param_3) { ulong uVar1; bool bVar2; if (1 < param_2) { uVar1 = 0; do { *(int *)(param_3 + uVar1 * 4) = *(int *)(param_1 + 4 + uVar1 * 4) + *(int *)(param_1 + uVar1 * 4); bVar2 = uVar1 != param_2 - 2; uVar1 = uVar1 + 1; } while (bVar2); } return; }
5,775
func0
#include <assert.h> #include <stdio.h>
void func0(const int test_tup[], int size, int result[]) { for (int i = 0; i < size - 1; i++) { result[i] = test_tup[i] + test_tup[i + 1]; } }
int main() { int result[4]; int test1[] = {1, 5, 7, 8, 10}; func0(test1, 5, result); assert(result[0] == 6 && result[1] == 12 && result[2] == 15 && result[3] == 18); int test2[] = {2, 6, 8, 9, 11}; func0(test2, 5, result); assert(result[0] == 8 && result[1] == 14 && result[2] == 17 && result[3] == 20); int test3[] = {3, 7, 9, 10, 12}; func0(test3, 5, result); assert(result[0] == 10 && result[1] == 16 && result[2] == 19 && result[3] == 22); return 0; }
O3
c
func0: endbr64 lea -0x1(%rsi),%r8d test %r8d,%r8d jle 11fe <func0+0xbe> lea 0x10(%rdx),%rax sub $0x2,%esi cmp %rax,%rdi lea 0x14(%rdi),%rax setae %cl cmp %rax,%rdx setae %al or %al,%cl je 11e0 <func0+0xa0> cmp $0x2,%esi jbe 11e0 <func0+0xa0> mov %r8d,%ecx xor %eax,%eax shr $0x2,%ecx shl $0x4,%rcx nopl (%rax) movdqu (%rdi,%rax,1),%xmm0 movdqu 0x4(%rdi,%rax,1),%xmm1 paddd %xmm1,%xmm0 movups %xmm0,(%rdx,%rax,1) add $0x10,%rax cmp %rcx,%rax jne 1180 <func0+0x40> mov %r8d,%eax and $0xfffffffc,%eax test $0x3,%r8b je 11fe <func0+0xbe> movslq %eax,%rcx mov (%rdi,%rcx,4),%esi add 0x4(%rdi,%rcx,4),%esi mov %esi,(%rdx,%rcx,4) lea 0x1(%rax),%ecx cmp %ecx,%r8d jle 11fe <func0+0xbe> movslq %ecx,%rcx add $0x2,%eax mov (%rdi,%rcx,4),%esi add 0x4(%rdi,%rcx,4),%esi mov %esi,(%rdx,%rcx,4) cmp %eax,%r8d jle 11fe <func0+0xbe> cltq mov (%rdi,%rax,4),%ecx add 0x4(%rdi,%rax,4),%ecx mov %ecx,(%rdx,%rax,4) retq xor %eax,%eax nopw 0x0(%rax,%rax,1) mov 0x4(%rdi,%rax,4),%ecx add (%rdi,%rax,4),%ecx mov %ecx,(%rdx,%rax,4) mov %rax,%rcx add $0x1,%rax cmp %rsi,%rcx jne 11e8 <func0+0xa8> retq
func0: endbr64 mov rcx, rdi mov rdi, rdx cmp esi, 1 jle short locret_1188 cmp esi, 2 jz short loc_1164 lea rdx, [rcx+4] mov rax, rdi sub rax, rdx cmp rax, 0Ch ja short loc_1190 loc_1164: sub esi, 1 xor eax, eax nop dword ptr [rax+00000000h] loc_1170: mov edx, [rcx+rax*4+4] add edx, [rcx+rax*4] mov [rdi+rax*4], edx add rax, 1 cmp rsi, rax jnz short loc_1170 retn locret_1188: retn loc_1190: lea edx, [rsi-1] lea eax, [rsi-2] mov r8d, edx cmp eax, 2 jbe short loc_120F shr r8d, 2 xor eax, eax shl r8, 4 nop dword ptr [rax+rax+00000000h] loc_11B0: movdqu xmm0, xmmword ptr [rcx+rax] movdqu xmm2, xmmword ptr [rcx+rax+4] paddd xmm0, xmm2 movups xmmword ptr [rdi+rax], xmm0 add rax, 10h cmp rax, r8 jnz short loc_11B0 test dl, 3 jz short locret_1188 and edx, 0FFFFFFFCh sub esi, edx mov eax, edx lea r8d, [rsi-1] cmp esi, 2 jz short loc_1202 loc_11E1: movq xmm0, qword ptr [rcx+rdx*4+4] movq xmm1, qword ptr [rcx+rdx*4] paddd xmm0, xmm1 movq qword ptr [rdi+rdx*4], xmm0 test r8b, 1 jz short locret_1188 and r8d, 0FFFFFFFEh add eax, r8d loc_1202: cdqe mov edx, [rcx+rax*4] add edx, [rcx+rax*4+4] mov [rdi+rax*4], edx retn loc_120F: xor edx, edx xor eax, eax jmp short loc_11E1
void func0(long long a1, int a2, long long a3) { long long v5; // rsi long long v6; // rax int v7; // edx unsigned int v8; // r8d long long v9; // rax long long v10; // r8 long long v11; // rdx int v12; // esi int v13; // eax if ( a2 > 1 ) { if ( a2 == 2 || (unsigned long long)(a3 - (a1 + 4)) <= 0xC ) { v5 = (unsigned int)(a2 - 1); v6 = 0LL; do { *(_DWORD *)(a3 + 4 * v6) = *(_DWORD *)(a1 + 4 * v6) + *(_DWORD *)(a1 + 4 * v6 + 4); ++v6; } while ( v5 != v6 ); return; } v7 = a2 - 1; v8 = a2 - 1; if ( (unsigned int)(a2 - 2) <= 2 ) { v11 = 0LL; v13 = 0; LABEL_13: *(_QWORD *)(a3 + 4 * v11) = _mm_add_epi32( _mm_loadl_epi64((const __m128i *)(a1 + 4 * v11 + 4)), _mm_loadl_epi64((const __m128i *)(a1 + 4 * v11))).m128i_u64[0]; if ( (v8 & 1) == 0 ) return; v13 += v8 & 0xFFFFFFFE; LABEL_15: *(_DWORD *)(a3 + 4LL * v13) = *(_DWORD *)(a1 + 4LL * v13 + 4) + *(_DWORD *)(a1 + 4LL * v13); return; } v9 = 0LL; v10 = 16LL * (v8 >> 2); do { *(__m128i *)(a3 + v9) = _mm_add_epi32( _mm_loadu_si128((const __m128i *)(a1 + v9)), _mm_loadu_si128((const __m128i *)(a1 + v9 + 4))); v9 += 16LL; } while ( v9 != v10 ); if ( (v7 & 3) != 0 ) { v11 = v7 & 0xFFFFFFFC; v12 = a2 - v11; v13 = v11; v8 = v12 - 1; if ( v12 == 2 ) goto LABEL_15; goto LABEL_13; } } }
func0: ENDBR64 MOV RCX,RDI MOV RDI,RDX CMP ESI,0x1 JLE 0x00101188 CMP ESI,0x2 JZ 0x00101164 LEA RDX,[RCX + 0x4] MOV RAX,RDI SUB RAX,RDX CMP RAX,0xc JA 0x00101190 LAB_00101164: SUB ESI,0x1 XOR EAX,EAX NOP dword ptr [RAX] LAB_00101170: MOV EDX,dword ptr [RCX + RAX*0x4 + 0x4] ADD EDX,dword ptr [RCX + RAX*0x4] MOV dword ptr [RDI + RAX*0x4],EDX ADD RAX,0x1 CMP RSI,RAX JNZ 0x00101170 RET LAB_00101188: RET LAB_00101190: LEA EDX,[RSI + -0x1] LEA EAX,[RSI + -0x2] MOV R8D,EDX CMP EAX,0x2 JBE 0x0010120f SHR R8D,0x2 XOR EAX,EAX SHL R8,0x4 NOP dword ptr [RAX + RAX*0x1] LAB_001011b0: MOVDQU XMM0,xmmword ptr [RCX + RAX*0x1] MOVDQU XMM2,xmmword ptr [RCX + RAX*0x1 + 0x4] PADDD XMM0,XMM2 MOVUPS xmmword ptr [RDI + RAX*0x1],XMM0 ADD RAX,0x10 CMP RAX,R8 JNZ 0x001011b0 TEST DL,0x3 JZ 0x00101188 AND EDX,0xfffffffc SUB ESI,EDX MOV EAX,EDX LEA R8D,[RSI + -0x1] CMP ESI,0x2 JZ 0x00101202 LAB_001011e1: MOVQ XMM0,qword ptr [RCX + RDX*0x4 + 0x4] MOVQ XMM1,qword ptr [RCX + RDX*0x4] PADDD XMM0,XMM1 MOVQ qword ptr [RDI + RDX*0x4],XMM0 TEST R8B,0x1 JZ 0x00101188 AND R8D,0xfffffffe ADD EAX,R8D LAB_00101202: CDQE MOV EDX,dword ptr [RCX + RAX*0x4] ADD EDX,dword ptr [RCX + RAX*0x4 + 0x4] MOV dword ptr [RDI + RAX*0x4],EDX RET LAB_0010120f: XOR EDX,EDX XOR EAX,EAX JMP 0x001011e1
void func0(long param_1,int param_2,long param_3) { uint uVar1; int *piVar2; int *piVar3; int *piVar4; int8 uVar5; int8 uVar6; int iVar7; int iVar8; int iVar9; int iVar10; int iVar11; int iVar12; ulong uVar13; long lVar14; uint uVar15; if (1 < param_2) { if ((param_2 == 2) || ((ulong)(param_3 - (param_1 + 4)) < 0xd)) { uVar13 = 0; do { *(int *)(param_3 + uVar13 * 4) = *(int *)(param_1 + 4 + uVar13 * 4) + *(int *)(param_1 + uVar13 * 4); uVar13 = uVar13 + 1; } while (param_2 - 1 != uVar13); return; } uVar1 = param_2 - 1; if (param_2 - 2U < 3) { uVar15 = 0; } else { lVar14 = 0; do { piVar2 = (int *)(param_1 + lVar14); iVar7 = piVar2[1]; iVar8 = piVar2[2]; iVar9 = piVar2[3]; piVar4 = (int *)(param_1 + 4 + lVar14); iVar10 = piVar4[1]; iVar11 = piVar4[2]; iVar12 = piVar4[3]; piVar3 = (int *)(param_3 + lVar14); *piVar3 = *piVar2 + *piVar4; piVar3[1] = iVar7 + iVar10; piVar3[2] = iVar8 + iVar11; piVar3[3] = iVar9 + iVar12; lVar14 = lVar14 + 0x10; } while (lVar14 != (ulong)(uVar1 >> 2) << 4); if ((uVar1 & 3) == 0) { return; } uVar15 = uVar1 & 0xfffffffc; uVar1 = (param_2 - uVar15) - 1; if (param_2 - uVar15 == 2) goto LAB_00101202; } uVar13 = (ulong)uVar15; uVar5 = *(int8 *)(param_1 + 4 + uVar13 * 4); uVar6 = *(int8 *)(param_1 + uVar13 * 4); *(ulong *)(param_3 + uVar13 * 4) = CONCAT44((int)((ulong)uVar5 >> 0x20) + (int)((ulong)uVar6 >> 0x20),(int)uVar5 + (int)uVar6) ; if ((uVar1 & 1) != 0) { uVar15 = uVar15 + (uVar1 & 0xfffffffe); LAB_00101202: lVar14 = (long)(int)uVar15; *(int *)(param_3 + lVar14 * 4) = *(int *)(param_1 + lVar14 * 4) + *(int *)(param_1 + 4 + lVar14 * 4); return; } } return; }
5,776
func0
#include <assert.h>
int func0(int arr[], int lens, int n) { int mul = 1; for (int i = 0; i < lens; i++) { mul = (mul * (arr[i] % n)) % n; } return mul % n; }
int main() { int arr1[] = {100, 10, 5, 25, 35, 14}; assert(func0(arr1, 6, 11) == 9); int arr2[] = {1, 1, 1}; assert(func0(arr2, 3, 1) == 0); int arr3[] = {1, 2, 1}; assert(func0(arr3, 3, 2) == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %edx,-0x20(%rbp) movl $0x1,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 11b6 <func0+0x4d> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax cltd idivl -0x20(%rbp) mov %edx,%eax imul -0x8(%rbp),%eax cltd idivl -0x20(%rbp) mov %edx,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 118b <func0+0x22> mov -0x8(%rbp),%eax cltd idivl -0x20(%rbp) mov %edx,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_20], edx mov [rbp+var_8], 1 mov [rbp+var_4], 0 jmp short loc_11B6 loc_118B: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] cdq idiv [rbp+var_20] mov eax, edx imul eax, [rbp+var_8] cdq idiv [rbp+var_20] mov [rbp+var_8], edx add [rbp+var_4], 1 loc_11B6: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_118B mov eax, [rbp+var_8] cdq idiv [rbp+var_20] mov eax, edx pop rbp retn
long long func0(long long a1, int a2, int a3) { int v4; // [rsp+18h] [rbp-8h] int i; // [rsp+1Ch] [rbp-4h] v4 = 1; for ( i = 0; i < a2; ++i ) v4 = v4 * (*(_DWORD *)(4LL * i + a1) % a3) % a3; return (unsigned int)(v4 % a3); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x20],EDX MOV dword ptr [RBP + -0x8],0x1 MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011b6 LAB_0010118b: 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] CDQ IDIV dword ptr [RBP + -0x20] MOV EAX,EDX IMUL EAX,dword ptr [RBP + -0x8] CDQ IDIV dword ptr [RBP + -0x20] MOV dword ptr [RBP + -0x8],EDX ADD dword ptr [RBP + -0x4],0x1 LAB_001011b6: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x0010118b MOV EAX,dword ptr [RBP + -0x8] CDQ IDIV dword ptr [RBP + -0x20] MOV EAX,EDX POP RBP RET
ulong func0(long param_1,int param_2,int param_3) { int4 local_10; int4 local_c; local_10 = 1; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { local_10 = ((*(int *)(param_1 + (long)local_c * 4) % param_3) * local_10) % param_3; } return (long)local_10 % (long)param_3 & 0xffffffff; }
5,777
func0
#include <assert.h>
int func0(int arr[], int lens, int n) { int mul = 1; for (int i = 0; i < lens; i++) { mul = (mul * (arr[i] % n)) % n; } return mul % n; }
int main() { int arr1[] = {100, 10, 5, 25, 35, 14}; assert(func0(arr1, 6, 11) == 9); int arr2[] = {1, 1, 1}; assert(func0(arr2, 3, 1) == 0); int arr3[] = {1, 2, 1}; assert(func0(arr3, 3, 2) == 0); return 0; }
O1
c
func0: endbr64 mov %edx,%r8d test %esi,%esi jle 11a8 <func0+0x3f> mov %rdi,%r9 lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rsi mov $0x1,%ecx mov (%r9),%eax cltd idiv %r8d mov %edx,%eax imul %ecx,%eax cltd idiv %r8d mov %edx,%ecx add $0x4,%r9 cmp %rsi,%r9 jne 1184 <func0+0x1b> mov %ecx,%eax cltd idiv %r8d mov %edx,%eax retq mov $0x1,%ecx jmp 119f <func0+0x36>
func0: endbr64 mov ecx, edx test esi, esi jle short loc_11A4 mov r8, rdi lea eax, [rsi-1] lea rdi, [rdi+rax*4+4] mov esi, 1 loc_1183: mov eax, [r8] cdq idiv ecx mov eax, edx imul eax, esi cdq idiv ecx mov esi, edx add r8, 4 cmp r8, rdi jnz short loc_1183 loc_119C: mov eax, esi cdq idiv ecx mov eax, edx retn loc_11A4: mov esi, 1 jmp short loc_119C
long long func0(_DWORD *a1, int a2, int a3) { _DWORD *v3; // r8 long long v4; // rdi int v5; // esi if ( a2 <= 0 ) { v5 = 1; } else { v3 = a1; v4 = (long long)&a1[a2 - 1 + 1]; v5 = 1; do v5 = v5 * (*v3++ % a3) % a3; while ( v3 != (_DWORD *)v4 ); } return (unsigned int)(v5 % a3); }
func0: ENDBR64 MOV ECX,EDX TEST ESI,ESI JLE 0x001011a4 MOV R8,RDI LEA EAX,[RSI + -0x1] LEA RDI,[RDI + RAX*0x4 + 0x4] MOV ESI,0x1 LAB_00101183: MOV EAX,dword ptr [R8] CDQ IDIV ECX MOV EAX,EDX IMUL EAX,ESI CDQ IDIV ECX MOV ESI,EDX ADD R8,0x4 CMP R8,RDI JNZ 0x00101183 LAB_0010119c: MOV EAX,ESI CDQ IDIV ECX MOV EAX,EDX RET LAB_001011a4: MOV ESI,0x1 JMP 0x0010119c
ulong func0(int *param_1,int param_2,int param_3) { int *piVar1; int iVar2; if (param_2 < 1) { iVar2 = 1; } else { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar2 = 1; do { iVar2 = ((*param_1 % param_3) * iVar2) % param_3; param_1 = param_1 + 1; } while (param_1 != piVar1); } return (long)iVar2 % (long)param_3 & 0xffffffff; }
5,778
func0
#include <assert.h>
int func0(int arr[], int lens, int n) { int mul = 1; for (int i = 0; i < lens; i++) { mul = (mul * (arr[i] % n)) % n; } return mul % n; }
int main() { int arr1[] = {100, 10, 5, 25, 35, 14}; assert(func0(arr1, 6, 11) == 9); int arr2[] = {1, 1, 1}; assert(func0(arr2, 3, 1) == 0); int arr3[] = {1, 2, 1}; assert(func0(arr3, 3, 2) == 0); return 0; }
O2
c
func0: endbr64 mov %edx,%ecx test %esi,%esi jle 12a0 <func0+0x40> lea -0x1(%rsi),%eax mov $0x1,%r8d lea 0x4(%rdi,%rax,4),%rsi nopl 0x0(%rax,%rax,1) mov (%rdi),%eax add $0x4,%rdi cltd idiv %ecx mov %edx,%eax imul %r8d,%eax cltd idiv %ecx mov %edx,%r8d cmp %rsi,%rdi jne 1280 <func0+0x20> mov %r8d,%eax retq xchg %ax,%ax mov $0x1,%eax cltd idiv %ecx mov %edx,%r8d mov %r8d,%eax retq
func0: endbr64 mov ecx, edx test esi, esi jle short loc_12A0 lea eax, [rsi-1] mov r8d, 1 lea rsi, [rdi+rax*4+4] nop dword ptr [rax+rax+00000000h] loc_1280: mov eax, [rdi] add rdi, 4 cdq idiv ecx mov eax, edx imul eax, r8d cdq idiv ecx mov r8d, edx cmp rdi, rsi jnz short loc_1280 mov eax, r8d retn loc_12A0: mov eax, 1 cdq idiv ecx mov r8d, edx mov eax, r8d retn
long long func0(int *a1, int a2, int a3) { unsigned int v3; // r8d long long v4; // rsi int v5; // eax if ( a2 <= 0 ) return (unsigned int)(1 % a3); v3 = 1; v4 = (long long)&a1[a2 - 1 + 1]; do { v5 = *a1++; v3 = (int)(v3 * (v5 % a3)) % a3; } while ( a1 != (int *)v4 ); return v3; }
func0: ENDBR64 MOV ECX,EDX TEST ESI,ESI JLE 0x001012a0 LEA EAX,[RSI + -0x1] MOV R8D,0x1 LEA RSI,[RDI + RAX*0x4 + 0x4] NOP dword ptr [RAX + RAX*0x1] LAB_00101280: MOV EAX,dword ptr [RDI] ADD RDI,0x4 CDQ IDIV ECX MOV EAX,EDX IMUL EAX,R8D CDQ IDIV ECX MOV R8D,EDX CMP RDI,RSI JNZ 0x00101280 MOV EAX,R8D RET LAB_001012a0: MOV EAX,0x1 CDQ IDIV ECX MOV R8D,EDX MOV EAX,R8D RET
ulong func0(int *param_1,int param_2,int param_3) { int *piVar1; int iVar2; ulong uVar3; int iVar4; if (0 < param_2) { iVar4 = 1; piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { iVar2 = *param_1; param_1 = param_1 + 1; uVar3 = (long)((iVar2 % param_3) * iVar4) % (long)param_3; iVar4 = (int)uVar3; } while (param_1 != piVar1); return uVar3 & 0xffffffff; } return 1 % (long)param_3 & 0xffffffff; }
5,779
func0
#include <assert.h>
int func0(int arr[], int lens, int n) { int mul = 1; for (int i = 0; i < lens; i++) { mul = (mul * (arr[i] % n)) % n; } return mul % n; }
int main() { int arr1[] = {100, 10, 5, 25, 35, 14}; assert(func0(arr1, 6, 11) == 9); int arr2[] = {1, 1, 1}; assert(func0(arr2, 3, 1) == 0); int arr3[] = {1, 2, 1}; assert(func0(arr3, 3, 2) == 0); return 0; }
O3
c
func0: endbr64 mov %edx,%ecx test %esi,%esi jle 12e0 <func0+0x40> lea -0x1(%rsi),%eax mov $0x1,%r8d lea 0x4(%rdi,%rax,4),%rsi nopl 0x0(%rax,%rax,1) mov (%rdi),%eax add $0x4,%rdi cltd idiv %ecx mov %edx,%eax imul %r8d,%eax cltd idiv %ecx mov %edx,%r8d cmp %rdi,%rsi jne 12c0 <func0+0x20> mov %r8d,%eax retq xchg %ax,%ax mov $0x1,%eax cltd idiv %ecx mov %edx,%r8d mov %r8d,%eax retq
func0: endbr64 mov ecx, edx test esi, esi jle short loc_1180 movsxd rsi, esi lea r8, [rdi+rsi*4] mov esi, 1 nop word ptr [rax+rax+00000000h] loc_1160: mov eax, [rdi] add rdi, 4 cdq idiv ecx mov eax, edx imul eax, esi cdq idiv ecx mov esi, edx cmp r8, rdi jnz short loc_1160 mov eax, esi retn loc_1180: xor edx, edx mov eax, 1 idiv ecx mov esi, edx mov eax, esi retn
long long func0(int *a1, int a2, int a3) { int *v3; // r8 unsigned int v4; // esi int v5; // eax if ( a2 <= 0 ) return (unsigned int)(1 % a3); v3 = &a1[a2]; v4 = 1; do { v5 = *a1++; v4 = (int)(v4 * (v5 % a3)) % a3; } while ( v3 != a1 ); return v4; }
func0: ENDBR64 MOV ECX,EDX TEST ESI,ESI JLE 0x00101180 MOVSXD RSI,ESI LEA R8,[RDI + RSI*0x4] MOV ESI,0x1 NOP word ptr CS:[RAX + RAX*0x1] LAB_00101160: MOV EAX,dword ptr [RDI] ADD RDI,0x4 CDQ IDIV ECX MOV EAX,EDX IMUL EAX,ESI CDQ IDIV ECX MOV ESI,EDX CMP R8,RDI JNZ 0x00101160 MOV EAX,ESI RET LAB_00101180: XOR EDX,EDX MOV EAX,0x1 IDIV ECX MOV ESI,EDX MOV EAX,ESI RET
ulong func0(int *param_1,int param_2,int param_3) { int *piVar1; int iVar2; ulong uVar3; int iVar4; if (0 < param_2) { piVar1 = param_1 + param_2; iVar4 = 1; do { iVar2 = *param_1; param_1 = param_1 + 1; uVar3 = (long)((iVar2 % param_3) * iVar4) % (long)param_3; iVar4 = (int)uVar3; } while (piVar1 != param_1); return uVar3 & 0xffffffff; } return 1 % (long)param_3 & 0xffffffff; }
5,780
func0
#include <stdbool.h> #include <assert.h> #include <stdlib.h>
bool func0(int *l, int size) { int *sorted = malloc(size * sizeof(int)); for (int i = 0; i < size; i++) { sorted[i] = l[i]; } for (int i = 0; i < size; i++) { for (int j = i + 1; j < size; j++) { if (sorted[i] > sorted[j]) { int temp = sorted[i]; sorted[i] = sorted[j]; sorted[j] = temp; } } } bool result = true; for (int i = 1; i < size; i++) { if (sorted[i] != sorted[i - 1] + 1) { result = false; break; } } free(sorted); return result; }
int main() { int arr1[] = {1, 2, 3, 4, 5}; int arr2[] = {1, 2, 3, 5, 6}; int arr3[] = {1, 2, 1}; assert(func0(arr1, sizeof(arr1) / sizeof(arr1[0])) == true); assert(func0(arr2, sizeof(arr2) / sizeof(arr2[0])) == false); assert(func0(arr3, sizeof(arr3) / sizeof(arr3[0])) == false); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x28(%rbp) mov %esi,-0x2c(%rbp) mov -0x2c(%rbp),%eax cltq shl $0x2,%rax mov %rax,%rdi callq 10b0 <malloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0x1c(%rbp) jmp 120b <func0+0x62> mov -0x1c(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov -0x1c(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x8(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) addl $0x1,-0x1c(%rbp) mov -0x1c(%rbp),%eax cmp -0x2c(%rbp),%eax jl 11da <func0+0x31> movl $0x0,-0x18(%rbp) jmpq 12d0 <func0+0x127> mov -0x18(%rbp),%eax add $0x1,%eax mov %eax,-0x14(%rbp) jmpq 12c0 <func0+0x117> mov -0x18(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x8(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x14(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x8(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jle 12bc <func0+0x113> mov -0x18(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x8(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov %eax,-0xc(%rbp) mov -0x14(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x8(%rbp),%rax add %rdx,%rax mov -0x18(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x8(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) mov -0x14(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x8(%rbp),%rax add %rax,%rdx mov -0xc(%rbp),%eax mov %eax,(%rdx) addl $0x1,-0x14(%rbp) mov -0x14(%rbp),%eax cmp -0x2c(%rbp),%eax jl 122d <func0+0x84> addl $0x1,-0x18(%rbp) mov -0x18(%rbp),%eax cmp -0x2c(%rbp),%eax jl 121f <func0+0x76> movb $0x1,-0x1d(%rbp) movl $0x1,-0x10(%rbp) jmp 1327 <func0+0x17e> mov -0x10(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x8(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov -0x10(%rbp),%edx movslq %edx,%rdx shl $0x2,%rdx lea -0x4(%rdx),%rcx mov -0x8(%rbp),%rdx add %rcx,%rdx mov (%rdx),%edx add $0x1,%edx cmp %edx,%eax je 1323 <func0+0x17a> movb $0x0,-0x1d(%rbp) jmp 132f <func0+0x186> addl $0x1,-0x10(%rbp) mov -0x10(%rbp),%eax cmp -0x2c(%rbp),%eax jl 12e9 <func0+0x140> mov -0x8(%rbp),%rax mov %rax,%rdi callq 1080 <free@plt> movzbl -0x1d(%rbp),%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_28], rdi mov [rbp+var_2C], esi mov eax, [rbp+var_2C] cdqe shl rax, 2 mov rdi, rax; size call _malloc mov [rbp+ptr], rax mov [rbp+var_1C], 0 jmp short loc_120B loc_11DA: mov eax, [rbp+var_1C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rdx mov edx, [rbp+var_1C] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+ptr] add rdx, rcx mov eax, [rax] mov [rdx], eax add [rbp+var_1C], 1 loc_120B: mov eax, [rbp+var_1C] cmp eax, [rbp+var_2C] jl short loc_11DA mov [rbp+var_18], 0 jmp loc_12D0 loc_121F: mov eax, [rbp+var_18] add eax, 1 mov [rbp+var_14], eax jmp loc_12C0 loc_122D: mov eax, [rbp+var_18] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+ptr] add rax, rdx mov edx, [rax] mov eax, [rbp+var_14] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+ptr] add rax, rcx mov eax, [rax] cmp edx, eax jle short loc_12BC mov eax, [rbp+var_18] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+ptr] add rax, rdx mov eax, [rax] mov [rbp+var_C], eax mov eax, [rbp+var_14] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+ptr] add rax, rdx mov edx, [rbp+var_18] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+ptr] add rdx, rcx mov eax, [rax] mov [rdx], eax mov eax, [rbp+var_14] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+ptr] add rdx, rax mov eax, [rbp+var_C] mov [rdx], eax loc_12BC: add [rbp+var_14], 1 loc_12C0: mov eax, [rbp+var_14] cmp eax, [rbp+var_2C] jl loc_122D add [rbp+var_18], 1 loc_12D0: mov eax, [rbp+var_18] cmp eax, [rbp+var_2C] jl loc_121F mov [rbp+var_1D], 1 mov [rbp+var_10], 1 jmp short loc_1326 loc_12E9: mov eax, [rbp+var_10] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+ptr] add rax, rdx mov edx, [rax] mov eax, [rbp+var_10] cdqe shl rax, 2 lea rcx, [rax-4] mov rax, [rbp+ptr] add rax, rcx mov eax, [rax] add eax, 1 cmp edx, eax jz short loc_1322 mov [rbp+var_1D], 0 jmp short loc_132E loc_1322: add [rbp+var_10], 1 loc_1326: mov eax, [rbp+var_10] cmp eax, [rbp+var_2C] jl short loc_12E9 loc_132E: mov rax, [rbp+ptr] mov rdi, rax; ptr call _free movzx eax, [rbp+var_1D] leave retn
long long func0(long long a1, int a2) { unsigned __int8 v3; // [rsp+13h] [rbp-1Dh] int i; // [rsp+14h] [rbp-1Ch] int j; // [rsp+18h] [rbp-18h] int k; // [rsp+1Ch] [rbp-14h] int m; // [rsp+20h] [rbp-10h] int v8; // [rsp+24h] [rbp-Ch] _DWORD *ptr; // [rsp+28h] [rbp-8h] ptr = malloc(4LL * a2); for ( i = 0; i < a2; ++i ) ptr[i] = *(_DWORD *)(4LL * i + a1); for ( j = 0; j < a2; ++j ) { for ( k = j + 1; k < a2; ++k ) { if ( ptr[j] > ptr[k] ) { v8 = ptr[j]; ptr[j] = ptr[k]; ptr[k] = v8; } } } v3 = 1; for ( m = 1; m < a2; ++m ) { if ( ptr[m] != ptr[m - 1] + 1 ) { v3 = 0; break; } } free(ptr); return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x2c],ESI MOV EAX,dword ptr [RBP + -0x2c] CDQE SHL RAX,0x2 MOV RDI,RAX CALL 0x001010b0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0x1c],0x0 JMP 0x0010120b LAB_001011da: MOV EAX,dword ptr [RBP + -0x1c] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0x1c] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x8] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX ADD dword ptr [RBP + -0x1c],0x1 LAB_0010120b: MOV EAX,dword ptr [RBP + -0x1c] CMP EAX,dword ptr [RBP + -0x2c] JL 0x001011da MOV dword ptr [RBP + -0x18],0x0 JMP 0x001012d0 LAB_0010121f: MOV EAX,dword ptr [RBP + -0x18] ADD EAX,0x1 MOV dword ptr [RBP + -0x14],EAX JMP 0x001012c0 LAB_0010122d: MOV EAX,dword ptr [RBP + -0x18] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x14] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JLE 0x001012bc MOV EAX,dword ptr [RBP + -0x18] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0xc],EAX MOV EAX,dword ptr [RBP + -0x14] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0x18] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x8] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX MOV EAX,dword ptr [RBP + -0x14] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0xc] MOV dword ptr [RDX],EAX LAB_001012bc: ADD dword ptr [RBP + -0x14],0x1 LAB_001012c0: MOV EAX,dword ptr [RBP + -0x14] CMP EAX,dword ptr [RBP + -0x2c] JL 0x0010122d ADD dword ptr [RBP + -0x18],0x1 LAB_001012d0: MOV EAX,dword ptr [RBP + -0x18] CMP EAX,dword ptr [RBP + -0x2c] JL 0x0010121f MOV byte ptr [RBP + -0x1d],0x1 MOV dword ptr [RBP + -0x10],0x1 JMP 0x00101326 LAB_001012e9: MOV EAX,dword ptr [RBP + -0x10] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x10] CDQE SHL RAX,0x2 LEA RCX,[RAX + -0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RAX,RCX MOV EAX,dword ptr [RAX] ADD EAX,0x1 CMP EDX,EAX JZ 0x00101322 MOV byte ptr [RBP + -0x1d],0x0 JMP 0x0010132e LAB_00101322: ADD dword ptr [RBP + -0x10],0x1 LAB_00101326: MOV EAX,dword ptr [RBP + -0x10] CMP EAX,dword ptr [RBP + -0x2c] JL 0x001012e9 LAB_0010132e: MOV RAX,qword ptr [RBP + -0x8] MOV RDI,RAX CALL 0x00101080 MOVZX EAX,byte ptr [RBP + -0x1d] LEAVE RET
int func0(long param_1,int param_2) { int4 uVar1; void *__ptr; int local_25; int4 local_24; int4 local_20; int4 local_1c; int4 local_18; __ptr = malloc((long)param_2 << 2); for (local_24 = 0; local_24 < param_2; local_24 = local_24 + 1) { *(int4 *)((long)__ptr + (long)local_24 * 4) = *(int4 *)(param_1 + (long)local_24 * 4); } for (local_20 = 0; local_1c = local_20, local_20 < param_2; local_20 = local_20 + 1) { while (local_1c = local_1c + 1, local_1c < param_2) { if (*(int *)((long)__ptr + (long)local_1c * 4) < *(int *)((long)__ptr + (long)local_20 * 4)) { uVar1 = *(int4 *)((long)__ptr + (long)local_20 * 4); *(int4 *)((long)__ptr + (long)local_20 * 4) = *(int4 *)((long)__ptr + (long)local_1c * 4); *(int4 *)((long)local_1c * 4 + (long)__ptr) = uVar1; } } } local_25 = 1; local_18 = 1; do { if (param_2 <= local_18) { LAB_0010132e: free(__ptr); return local_25; } if (*(int *)((long)__ptr + (long)local_18 * 4) != *(int *)((long)__ptr + (long)local_18 * 4 + -4) + 1) { local_25 = 0; goto LAB_0010132e; } local_18 = local_18 + 1; } while( true ); }
5,781
func0
#include <stdbool.h> #include <assert.h> #include <stdlib.h>
bool func0(int *l, int size) { int *sorted = malloc(size * sizeof(int)); for (int i = 0; i < size; i++) { sorted[i] = l[i]; } for (int i = 0; i < size; i++) { for (int j = i + 1; j < size; j++) { if (sorted[i] > sorted[j]) { int temp = sorted[i]; sorted[i] = sorted[j]; sorted[j] = temp; } } } bool result = true; for (int i = 1; i < size; i++) { if (sorted[i] != sorted[i - 1] + 1) { result = false; break; } } free(sorted); return result; }
int main() { int arr1[] = {1, 2, 3, 4, 5}; int arr2[] = {1, 2, 3, 5, 6}; int arr3[] = {1, 2, 1}; assert(func0(arr1, sizeof(arr1) / sizeof(arr1[0])) == true); assert(func0(arr2, sizeof(arr2) / sizeof(arr2[0])) == false); assert(func0(arr3, sizeof(arr3) / sizeof(arr3[0])) == false); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbp mov %esi,%ebx movslq %esi,%rdi shl $0x2,%rdi callq 10b0 <malloc@plt> test %ebx,%ebx jle 121c <func0+0x73> lea -0x1(%rbx),%esi lea 0x1(%rsi),%r9 mov $0x0,%edx mov 0x0(%rbp,%rdx,4),%ecx mov %ecx,(%rax,%rdx,4) mov %rdx,%rcx add $0x1,%rdx cmp %rsi,%rcx jne 11d4 <func0+0x2b> mov %rax,%rdi mov $0x1,%r8d jmp 1212 <func0+0x69> add $0x1,%rdx cmp %edx,%ebx jle 120a <func0+0x61> mov (%rdi),%ecx mov (%rax,%rdx,4),%esi cmp %esi,%ecx jle 11f2 <func0+0x49> mov %esi,(%rdi) mov %ecx,(%rax,%rdx,4) jmp 11f2 <func0+0x49> add $0x1,%r8 add $0x4,%rdi cmp %r9,%r8 je 121c <func0+0x73> mov %r8,%rdx jmp 11fa <func0+0x51> cmp $0x1,%ebx jle 1246 <func0+0x9d> mov %rax,%rdx lea -0x2(%rbx),%ecx lea 0x4(%rax,%rcx,4),%rsi mov (%rdx),%ebx lea 0x1(%rbx),%ecx cmp %ecx,0x4(%rdx) jne 124d <func0+0xa4> add $0x4,%rdx cmp %rsi,%rdx jne 122c <func0+0x83> mov $0x1,%ebx jmp 1252 <func0+0xa9> mov $0x1,%ebx jmp 1252 <func0+0xa9> mov $0x0,%ebx mov %rax,%rdi callq 1080 <free@plt> mov %ebx,%eax add $0x8,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp push rbx sub rsp, 8 mov rbp, rdi mov ebx, esi movsxd rdi, esi shl rdi, 2 call _malloc mov r10, rax test ebx, ebx jle short loc_1233 lea r11d, [rbx-1] mov r9d, ebx mov eax, 0 loc_11D7: mov edx, [rbp+rax*4+0] mov [r10+rax*4], edx add rax, 1 cmp rax, r9 jnz short loc_11D7 lea rsi, [r10+4] mov r8d, 1 lea rbp, [r10+8] jmp short loc_1219 loc_11F8: add rax, 4 cmp rax, rdi jz short loc_1211 loc_1201: mov edx, [rsi-4] mov ecx, [rax] cmp edx, ecx jle short loc_11F8 mov [rsi-4], ecx mov [rax], edx jmp short loc_11F8 loc_1211: add r8, 1 add rsi, 4 loc_1219: cmp r8, r9 jz short loc_1233 mov eax, r11d sub eax, r8d lea rax, [r8+rax-1] lea rdi, [rbp+rax*4+0] mov rax, rsi jmp short loc_1201 loc_1233: cmp ebx, 1 jle short loc_125C mov rax, r10 lea edx, [rbx-1] lea rcx, [r10+rdx*4] loc_1242: mov ebx, [rax] lea edx, [rbx+1] cmp [rax+4], edx jnz short loc_1263 add rax, 4 cmp rax, rcx jnz short loc_1242 mov ebx, 1 jmp short loc_1268 loc_125C: mov ebx, 1 jmp short loc_1268 loc_1263: mov ebx, 0 loc_1268: mov rdi, r10 call _free mov eax, ebx add rsp, 8 pop rbx pop rbp retn
long long func0(long long a1, int a2) { long long v3; // r10 long long i; // rax _DWORD *v5; // rsi long long j; // r8 _DWORD *v7; // rax int v8; // edx _DWORD *v9; // rax unsigned int v10; // ebx v3 = malloc(4LL * a2); if ( a2 > 0 ) { for ( i = 0LL; i != a2; ++i ) *(_DWORD *)(v3 + 4 * i) = *(_DWORD *)(a1 + 4 * i); v5 = (_DWORD *)(v3 + 4); for ( j = 1LL; j != a2; ++j ) { v7 = v5; do { v8 = *(v5 - 1); if ( v8 > *v7 ) { *(v5 - 1) = *v7; *v7 = v8; } ++v7; } while ( v7 != (_DWORD *)(v3 + 8 + 4 * (j + (unsigned int)(a2 - 1 - j) - 1)) ); ++v5; } } if ( a2 <= 1 ) { v10 = 1; } else { v9 = (_DWORD *)v3; while ( v9[1] == *v9 + 1 ) { if ( ++v9 == (_DWORD *)(v3 + 4LL * (unsigned int)(a2 - 1)) ) { v10 = 1; goto LABEL_18; } } v10 = 0; } LABEL_18: free(v3); return v10; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBP,RDI MOV EBX,ESI MOVSXD RDI,ESI SHL RDI,0x2 CALL 0x001010b0 MOV R10,RAX TEST EBX,EBX JLE 0x00101233 LEA R11D,[RBX + -0x1] MOV R9D,EBX MOV EAX,0x0 LAB_001011d7: MOV EDX,dword ptr [RBP + RAX*0x4] MOV dword ptr [R10 + RAX*0x4],EDX ADD RAX,0x1 CMP RAX,R9 JNZ 0x001011d7 LEA RSI,[R10 + 0x4] MOV R8D,0x1 LEA RBP,[R10 + 0x8] JMP 0x00101219 LAB_001011f8: ADD RAX,0x4 CMP RAX,RDI JZ 0x00101211 LAB_00101201: MOV EDX,dword ptr [RSI + -0x4] MOV ECX,dword ptr [RAX] CMP EDX,ECX JLE 0x001011f8 MOV dword ptr [RSI + -0x4],ECX MOV dword ptr [RAX],EDX JMP 0x001011f8 LAB_00101211: ADD R8,0x1 ADD RSI,0x4 LAB_00101219: CMP R8,R9 JZ 0x00101233 MOV EAX,R11D SUB EAX,R8D LEA RAX,[R8 + RAX*0x1 + -0x1] LEA RDI,[RBP + RAX*0x4] MOV RAX,RSI JMP 0x00101201 LAB_00101233: CMP EBX,0x1 JLE 0x0010125c MOV RAX,R10 LEA EDX,[RBX + -0x1] LEA RCX,[R10 + RDX*0x4] LAB_00101242: MOV EBX,dword ptr [RAX] LEA EDX,[RBX + 0x1] CMP dword ptr [RAX + 0x4],EDX JNZ 0x00101263 ADD RAX,0x4 CMP RAX,RCX JNZ 0x00101242 MOV EBX,0x1 JMP 0x00101268 LAB_0010125c: MOV EBX,0x1 JMP 0x00101268 LAB_00101263: MOV EBX,0x0 LAB_00101268: MOV RDI,R10 CALL 0x00101080 MOV EAX,EBX ADD RSP,0x8 POP RBX POP RBP RET
int8 func0(long param_1,uint param_2) { int iVar1; int *__ptr; ulong uVar2; int *piVar3; int *piVar4; int8 uVar5; __ptr = (int *)malloc((long)(int)param_2 << 2); if (0 < (int)param_2) { uVar2 = 0; do { __ptr[uVar2] = *(int *)(param_1 + uVar2 * 4); uVar2 = uVar2 + 1; } while (uVar2 != param_2); piVar4 = __ptr; for (uVar2 = 1; uVar2 != param_2; uVar2 = uVar2 + 1) { piVar3 = piVar4 + 1; do { iVar1 = *piVar4; if (*piVar3 < iVar1) { *piVar4 = *piVar3; *piVar3 = iVar1; } piVar3 = piVar3 + 1; } while (piVar3 != __ptr + uVar2 + ((param_2 - 1) - (int)uVar2) + 1); piVar4 = piVar4 + 1; } } if ((int)param_2 < 2) { uVar5 = 1; } else { piVar4 = __ptr; do { if (piVar4[1] != *piVar4 + 1) { uVar5 = 0; goto LAB_00101268; } piVar4 = piVar4 + 1; } while (piVar4 != __ptr + (param_2 - 1)); uVar5 = 1; } LAB_00101268: free(__ptr); return uVar5; }