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,182
func0
#include <stdio.h> #include <assert.h> #include <limits.h>
int* func0(int list1[], int size, int *resultSize) { int min_val = INT_MAX; static int min_positions[100]; // static buffer to store positions int count = 0; // Find minimum value for (int i = 0; i < size; i++) { if (list1[i] < min_val) { min_val = list1[i]; } } // Find all positions holding the minimum value for (int i = 0; i < size; i++) { if (list1[i] == min_val) { min_positions[count++] = i; } } *resultSize = count; return min_positions; }
int main() { int resultSize; int* result; int list1[] = {12,33,23,10,67,89,45,667,23,12,11,10,54}; int list2[] = {1,2,2,2,4,4,4,5,5,5,5}; int list3[] = {2,1,5,6,8,3,4,9,10,11,8,12}; result = func0(list1, sizeof(list1)/sizeof(list1[0]), &resultSize); assert(resultSize == 2 && result[0] == 3 && result[1] == 11); result = func0(list2, sizeof(list2)/sizeof(list2[0]), &resultSize); assert(resultSize == 1 && result[0] == 0); result = func0(list3, sizeof(list3)/sizeof(list3[0]), &resultSize); assert(resultSize == 1 && result[0] == 1); printf("All tests passed!\n"); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1520 <func0+0x70> lea -0x1(%rsi),%r9d mov %rdi,%rax mov $0x7fffffff,%ecx lea 0x4(%rdi,%r9,4),%r8 nopl 0x0(%rax) mov (%rax),%esi cmp %esi,%ecx cmovg %esi,%ecx add $0x4,%rax cmp %r8,%rax jne 14d0 <func0+0x20> xor %eax,%eax xor %r8d,%r8d lea 0x2b54(%rip),%r10 jmp 14f3 <func0+0x43> xchg %ax,%ax mov %rsi,%rax cmp (%rdi,%rax,4),%ecx jne 1503 <func0+0x53> movslq %r8d,%rsi add $0x1,%r8d mov %eax,(%r10,%rsi,4) lea 0x1(%rax),%rsi cmp %rax,%r9 jne 14f0 <func0+0x40> mov %r8d,(%rdx) lea 0x2b2a(%rip),%rax retq nopw 0x0(%rax,%rax,1) xor %r8d,%r8d lea 0x2b16(%rip),%rax mov %r8d,(%rdx) retq xchg %ax,%ax
func0: endbr64 mov r8, rdi test esi, esi jle short loc_1410 lea ecx, [rsi-1] mov rax, rdi lea r9, [rdi+rcx*4+4] mov ecx, 7FFFFFFFh nop dword ptr [rax+rax+00h] loc_13D0: mov edi, [rax] cmp ecx, edi cmovg ecx, edi add rax, 4 cmp rax, r9 jnz short loc_13D0 mov esi, esi xor eax, eax lea r10, min_positions_1 xor edi, edi nop dword ptr [rax] loc_13F0: cmp ecx, [r8+rax*4] jnz short loc_1400 movsxd r9, edi add edi, 1 mov [r10+r9*4], eax loc_1400: add rax, 1 cmp rsi, rax jnz short loc_13F0 mov [rdx], edi mov rax, r10 retn loc_1410: xor edi, edi lea r10, min_positions_1 mov [rdx], edi mov rax, r10 retn
_DWORD * func0(int *a1, int a2, _DWORD *a3) { int *v4; // rax int v5; // ecx long long v6; // rax int v7; // edi long long v8; // r9 if ( a2 <= 0 ) { *a3 = 0; return min_positions_1; } else { v4 = a1; v5 = 0x7FFFFFFF; do { if ( v5 > *v4 ) v5 = *v4; ++v4; } while ( v4 != &a1[a2 - 1 + 1] ); v6 = 0LL; v7 = 0; do { if ( v5 == a1[v6] ) { v8 = v7++; min_positions_1[v8] = v6; } ++v6; } while ( a2 != v6 ); *a3 = v7; return min_positions_1; } }
func0: ENDBR64 MOV R8,RDI TEST ESI,ESI JLE 0x00101410 LEA ECX,[RSI + -0x1] MOV RAX,RDI LEA R9,[RDI + RCX*0x4 + 0x4] MOV ECX,0x7fffffff NOP dword ptr [RAX + RAX*0x1] LAB_001013d0: MOV EDI,dword ptr [RAX] CMP ECX,EDI CMOVG ECX,EDI ADD RAX,0x4 CMP RAX,R9 JNZ 0x001013d0 MOV ESI,ESI XOR EAX,EAX LEA R10,[0x104040] XOR EDI,EDI NOP dword ptr [RAX] LAB_001013f0: CMP ECX,dword ptr [R8 + RAX*0x4] JNZ 0x00101400 MOVSXD R9,EDI ADD EDI,0x1 MOV dword ptr [R10 + R9*0x4],EAX LAB_00101400: ADD RAX,0x1 CMP RSI,RAX JNZ 0x001013f0 MOV dword ptr [RDX],EDI MOV RAX,R10 RET LAB_00101410: XOR EDI,EDI LEA R10,[0x104040] MOV dword ptr [RDX],EDI MOV RAX,R10 RET
int4 * func0(int *param_1,uint param_2,int *param_3) { int *piVar1; ulong uVar2; int iVar3; int iVar4; long lVar5; if (0 < (int)param_2) { iVar3 = 0x7fffffff; piVar1 = param_1; do { if (*piVar1 < iVar3) { iVar3 = *piVar1; } piVar1 = piVar1 + 1; } while (piVar1 != param_1 + (ulong)(param_2 - 1) + 1); uVar2 = 0; iVar4 = 0; do { if (iVar3 == param_1[uVar2]) { lVar5 = (long)iVar4; iVar4 = iVar4 + 1; (&min_positions_1)[lVar5] = (int)uVar2; } uVar2 = uVar2 + 1; } while (param_2 != uVar2); *param_3 = iVar4; return &min_positions_1; } *param_3 = 0; return &min_positions_1; }
5,183
func0
#include <stdio.h> #include <assert.h> #include <limits.h>
int* func0(int list1[], int size, int *resultSize) { int min_val = INT_MAX; static int min_positions[100]; // static buffer to store positions int count = 0; // Find minimum value for (int i = 0; i < size; i++) { if (list1[i] < min_val) { min_val = list1[i]; } } // Find all positions holding the minimum value for (int i = 0; i < size; i++) { if (list1[i] == min_val) { min_positions[count++] = i; } } *resultSize = count; return min_positions; }
int main() { int resultSize; int* result; int list1[] = {12,33,23,10,67,89,45,667,23,12,11,10,54}; int list2[] = {1,2,2,2,4,4,4,5,5,5,5}; int list3[] = {2,1,5,6,8,3,4,9,10,11,8,12}; result = func0(list1, sizeof(list1)/sizeof(list1[0]), &resultSize); assert(resultSize == 2 && result[0] == 3 && result[1] == 11); result = func0(list2, sizeof(list2)/sizeof(list2[0]), &resultSize); assert(resultSize == 1 && result[0] == 0); result = func0(list3, sizeof(list3)/sizeof(list3[0]), &resultSize); assert(resultSize == 1 && result[0] == 1); printf("All tests passed!\n"); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 1730 <func0+0x120> lea -0x1(%rsi),%r8d cmp $0x2,%r8d jbe 173e <func0+0x12e> mov %esi,%ecx movdqa 0xabc(%rip),%xmm0 mov %rdi,%rax shr $0x2,%ecx shl $0x4,%rcx add %rdi,%rcx nopl 0x0(%rax) movdqu (%rax),%xmm1 movdqu (%rax),%xmm3 add $0x10,%rax pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm0 pandn %xmm3,%xmm1 por %xmm1,%xmm0 cmp %rcx,%rax jne 1648 <func0+0x38> movdqa %xmm0,%xmm2 mov %esi,%eax psrldq $0x8,%xmm2 and $0xfffffffc,%eax movdqa %xmm2,%xmm1 pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm0 pandn %xmm2,%xmm1 por %xmm1,%xmm0 movdqa %xmm0,%xmm2 psrldq $0x4,%xmm2 movdqa %xmm2,%xmm1 pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm0 pandn %xmm2,%xmm1 por %xmm1,%xmm0 movd %xmm0,%ecx test $0x3,%sil je 16e8 <func0+0xd8> movslq %eax,%r9 mov (%rdi,%r9,4),%r9d cmp %r9d,%ecx cmovg %r9d,%ecx lea 0x1(%rax),%r9d cmp %r9d,%esi jle 16e8 <func0+0xd8> movslq %r9d,%r9 mov (%rdi,%r9,4),%r9d cmp %r9d,%ecx cmovg %r9d,%ecx add $0x2,%eax cmp %eax,%esi jle 16e8 <func0+0xd8> cltq mov (%rdi,%rax,4),%eax cmp %eax,%ecx cmovg %eax,%ecx mov %r8d,%r8d xor %eax,%eax xor %r9d,%r9d lea 0x2949(%rip),%r10 jmp 1703 <func0+0xf3> nopl 0x0(%rax) mov %rsi,%rax cmp %ecx,(%rdi,%rax,4) jne 1713 <func0+0x103> movslq %r9d,%rsi add $0x1,%r9d mov %eax,(%r10,%rsi,4) lea 0x1(%rax),%rsi cmp %r8,%rax jne 1700 <func0+0xf0> mov %r9d,(%rdx) lea 0x291a(%rip),%rax retq nopw 0x0(%rax,%rax,1) xor %r9d,%r9d lea 0x2906(%rip),%rax mov %r9d,(%rdx) retq xor %eax,%eax mov $0x7fffffff,%ecx jmpq 16b2 <func0+0xa2> nopw 0x0(%rax,%rax,1)
func0: endbr64 movsxd rcx, esi mov r10, rdx test ecx, ecx jle loc_1290 lea eax, [rcx-1] cmp eax, 2 jbe loc_12A0 mov edx, ecx movdqa xmm0, cs:xmmword_2020 mov rax, rdi shr edx, 2 shl rdx, 4 add rdx, rdi nop dword ptr [rax] loc_11B8: movdqu xmm1, xmmword ptr [rax] movdqu xmm3, xmmword ptr [rax] add rax, 10h pcmpgtd xmm1, xmm0 pand xmm0, xmm1 pandn xmm1, xmm3 por xmm0, xmm1 cmp rax, rdx jnz short loc_11B8 movdqa xmm2, xmm0 mov eax, ecx psrldq xmm2, 8 and eax, 0FFFFFFFCh movdqa xmm1, xmm2 pcmpgtd xmm1, xmm0 pand xmm0, xmm1 pandn xmm1, xmm2 por xmm0, xmm1 movdqa xmm2, xmm0 psrldq xmm2, 4 movdqa xmm1, xmm2 pcmpgtd xmm1, xmm0 pand xmm0, xmm1 pandn xmm1, xmm2 por xmm1, xmm0 movd edx, xmm1 test cl, 3 jz short loc_1256 loc_1221: movsxd rsi, eax lea r8, ds:0[rsi*4] mov esi, [rdi+rsi*4] cmp edx, esi cmovg edx, esi lea esi, [rax+1] cmp ecx, esi jle short loc_1256 mov esi, [rdi+r8+4] cmp edx, esi cmovg edx, esi add eax, 2 cmp ecx, eax jle short loc_1256 mov eax, [rdi+r8+8] cmp edx, eax cmovg edx, eax loc_1256: xor eax, eax lea r9, min_positions_1 xor esi, esi nop dword ptr [rax+00000000h] loc_1268: cmp [rdi+rax*4], edx jnz short loc_1277 movsxd r8, esi add esi, 1 mov [r9+r8*4], eax loc_1277: add rax, 1 cmp rax, rcx jnz short loc_1268 mov [r10], esi mov rax, r9 retn loc_1290: xor esi, esi lea r9, min_positions_1 mov [r10], esi mov rax, r9 retn loc_12A0: xor eax, eax mov edx, 7FFFFFFFh jmp loc_1221
long long * func0(const __m128i *a1, int a2, _DWORD *a3) { long long v3; // rcx __m128i si128; // xmm0 const __m128i *v6; // rax __m128i v7; // xmm1 __m128i v8; // xmm3 __m128i v9; // xmm1 __m128i v10; // xmm2 signed int v11; // eax __m128i v12; // xmm1 __m128i v13; // xmm0 __m128i v14; // xmm2 __m128i v15; // xmm1 int v16; // edx long long v17; // r8 long long v18; // rax int v19; // esi long long v20; // r8 v3 = a2; if ( a2 <= 0 ) { *a3 = 0; return &min_positions_1; } if ( (unsigned int)(a2 - 1) <= 2 ) { v11 = 0; v16 = 0x7FFFFFFF; LABEL_6: v17 = v11; if ( v16 > a1->m128i_i32[v17] ) v16 = a1->m128i_i32[v11]; if ( a2 > v11 + 1 ) { if ( v16 > a1->m128i_i32[v17 + 1] ) v16 = a1->m128i_i32[v17 + 1]; if ( a2 > v11 + 2 && v16 > a1->m128i_i32[v17 + 2] ) v16 = a1->m128i_i32[v17 + 2]; } goto LABEL_14; } si128 = _mm_load_si128((const __m128i *)&xmmword_2020); v6 = a1; do { v7 = _mm_loadu_si128(v6); v8 = v7; ++v6; v9 = _mm_cmpgt_epi32(v7, si128); si128 = _mm_or_si128(_mm_and_si128(si128, v9), _mm_andnot_si128(v9, v8)); } while ( v6 != &a1[(unsigned int)a2 >> 2] ); v10 = _mm_srli_si128(si128, 8); v11 = a2 & 0xFFFFFFFC; v12 = _mm_cmpgt_epi32(v10, si128); v13 = _mm_or_si128(_mm_and_si128(si128, v12), _mm_andnot_si128(v12, v10)); v14 = _mm_srli_si128(v13, 4); v15 = _mm_cmpgt_epi32(v14, v13); v16 = _mm_cvtsi128_si32(_mm_or_si128(_mm_andnot_si128(v15, v14), _mm_and_si128(v13, v15))); if ( (a2 & 3) != 0 ) goto LABEL_6; LABEL_14: v18 = 0LL; v19 = 0; do { if ( a1->m128i_i32[v18] == v16 ) { v20 = v19++; *((_DWORD *)&min_positions_1 + v20) = v18; } ++v18; } while ( v18 != v3 ); *a3 = v19; return &min_positions_1; }
func0: ENDBR64 MOVSXD RCX,ESI MOV R10,RDX TEST ECX,ECX JLE 0x00101290 LEA EAX,[RCX + -0x1] CMP EAX,0x2 JBE 0x001012a0 MOV EDX,ECX MOVDQA XMM0,xmmword ptr [0x00102020] MOV RAX,RDI SHR EDX,0x2 SHL RDX,0x4 ADD RDX,RDI NOP dword ptr [RAX] LAB_001011b8: MOVDQU XMM1,xmmword ptr [RAX] MOVDQU XMM3,xmmword ptr [RAX] ADD RAX,0x10 PCMPGTD XMM1,XMM0 PAND XMM0,XMM1 PANDN XMM1,XMM3 POR XMM0,XMM1 CMP RAX,RDX JNZ 0x001011b8 MOVDQA XMM2,XMM0 MOV EAX,ECX PSRLDQ XMM2,0x8 AND EAX,0xfffffffc MOVDQA XMM1,XMM2 PCMPGTD XMM1,XMM0 PAND XMM0,XMM1 PANDN XMM1,XMM2 POR XMM0,XMM1 MOVDQA XMM2,XMM0 PSRLDQ XMM2,0x4 MOVDQA XMM1,XMM2 PCMPGTD XMM1,XMM0 PAND XMM0,XMM1 PANDN XMM1,XMM2 POR XMM1,XMM0 MOVD EDX,XMM1 TEST CL,0x3 JZ 0x00101256 LAB_00101221: MOVSXD RSI,EAX LEA R8,[RSI*0x4] MOV ESI,dword ptr [RDI + RSI*0x4] CMP EDX,ESI CMOVG EDX,ESI LEA ESI,[RAX + 0x1] CMP ECX,ESI JLE 0x00101256 MOV ESI,dword ptr [RDI + R8*0x1 + 0x4] CMP EDX,ESI CMOVG EDX,ESI ADD EAX,0x2 CMP ECX,EAX JLE 0x00101256 MOV EAX,dword ptr [RDI + R8*0x1 + 0x8] CMP EDX,EAX CMOVG EDX,EAX LAB_00101256: XOR EAX,EAX LEA R9,[0x104040] XOR ESI,ESI NOP dword ptr [RAX] LAB_00101268: CMP dword ptr [RDI + RAX*0x4],EDX JNZ 0x00101277 MOVSXD R8,ESI ADD ESI,0x1 MOV dword ptr [R9 + R8*0x4],EAX LAB_00101277: ADD RAX,0x1 CMP RAX,RCX JNZ 0x00101268 MOV dword ptr [R10],ESI MOV RAX,R9 RET LAB_00101290: XOR ESI,ESI LEA R9,[0x104040] MOV dword ptr [R10],ESI MOV RAX,R9 RET LAB_001012a0: XOR EAX,EAX MOV EDX,0x7fffffff JMP 0x00101221
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ int4 * func0(uint *param_1,uint param_2,int *param_3) { uint *puVar1; uint *puVar2; uint *puVar3; uint uVar4; uint *puVar5; uint *puVar6; uint *puVar7; uint uVar8; uint *puVar9; ulong uVar10; uint uVar11; int iVar12; long lVar13; uint uVar14; uint uVar15; uint uVar16; if ((int)param_2 < 1) { *param_3 = 0; return &min_positions_1; } if (param_2 - 1 < 3) { uVar8 = 0; uVar11 = 0x7fffffff; } else { puVar9 = param_1; uVar11 = _DAT_00102020; uVar14 = _UNK_00102024; uVar16 = _UNK_00102028; uVar15 = _UNK_0010202c; do { uVar8 = *puVar9; puVar1 = puVar9 + 1; puVar2 = puVar9 + 2; puVar3 = puVar9 + 3; uVar4 = *puVar9; puVar5 = puVar9 + 1; puVar6 = puVar9 + 2; puVar7 = puVar9 + 3; puVar9 = puVar9 + 4; uVar11 = uVar11 & -(uint)((int)uVar11 < (int)uVar8) | ~-(uint)((int)uVar11 < (int)uVar8) & uVar4; uVar14 = uVar14 & -(uint)((int)uVar14 < (int)*puVar1) | ~-(uint)((int)uVar14 < (int)*puVar1) & *puVar5; uVar16 = uVar16 & -(uint)((int)uVar16 < (int)*puVar2) | ~-(uint)((int)uVar16 < (int)*puVar2) & *puVar6; uVar15 = uVar15 & -(uint)((int)uVar15 < (int)*puVar3) | ~-(uint)((int)uVar15 < (int)*puVar3) & *puVar7; } while (puVar9 != param_1 + (ulong)(param_2 >> 2) * 4); uVar8 = param_2 & 0xfffffffc; uVar11 = uVar11 & -(uint)((int)uVar11 < (int)uVar16) | ~-(uint)((int)uVar11 < (int)uVar16) & uVar16; uVar14 = uVar14 & -(uint)((int)uVar14 < (int)uVar15) | ~-(uint)((int)uVar14 < (int)uVar15) & uVar15; uVar16 = -(uint)((int)uVar11 < (int)uVar14); uVar11 = ~uVar16 & uVar14 | uVar11 & uVar16; if (((long)(int)param_2 & 3U) == 0) goto LAB_00101256; } if ((int)param_1[(int)uVar8] < (int)uVar11) { uVar11 = param_1[(int)uVar8]; } if ((int)(uVar8 + 1) < (int)param_2) { if ((int)param_1[(long)(int)uVar8 + 1] < (int)uVar11) { uVar11 = param_1[(long)(int)uVar8 + 1]; } if (((int)(uVar8 + 2) < (int)param_2) && ((int)param_1[(long)(int)uVar8 + 2] < (int)uVar11)) { uVar11 = param_1[(long)(int)uVar8 + 2]; } } LAB_00101256: uVar10 = 0; iVar12 = 0; do { if (param_1[uVar10] == uVar11) { lVar13 = (long)iVar12; iVar12 = iVar12 + 1; (&min_positions_1)[lVar13] = (int)uVar10; } uVar10 = uVar10 + 1; } while (uVar10 != (long)(int)param_2); *param_3 = iVar12; return &min_positions_1; }
5,184
func0
#include <assert.h> void right_rotate(int arr[], int n, int out_of_place, int cur) { int temp = arr[cur]; for (int i = cur; i > out_of_place; --i) { arr[i] = arr[i - 1]; } arr[out_of_place] = temp; }
void func0(int arr[], int n) { int out_of_place = -1; for (int index = 0; index < n; ++index) { if (out_of_place >= 0) { if ((arr[index] >= 0 && arr[out_of_place] < 0) || (arr[index] < 0 && arr[out_of_place] >= 0)) { right_rotate(arr, n, out_of_place, index); if (index - out_of_place > 2) { out_of_place += 2; } else { out_of_place = -1; } } } if (out_of_place == -1) { if ((arr[index] >= 0 && index % 2 == 0) || (arr[index] < 0 && index % 2 == 1)) { out_of_place = index; } } } }
int main() { int arr1[] = {-5, -2, 5, 2, 4, 7, 1, 8, 0, -8}; int arr1_result[] = {-5, 5, -2, 2, -8, 4, 7, 1, 8, 0}; func0(arr1, 10); for (int i = 0; i < 10; i++) { assert(arr1[i] == arr1_result[i]); } int arr2[] = {1, 2, 3, -4, -1, 4}; int arr2_result[] = {-4, 1, -1, 2, 3, 4}; func0(arr2, 6); for (int i = 0; i < 6; i++) { assert(arr2[i] == arr2_result[i]); } int arr3[] = {4, 7, 9, 77, -4, 5, -3, -9}; int arr3_result[] = {-4, 4, -3, 7, -9, 9, 77, 5}; func0(arr3, 8); for (int i = 0; i < 8; i++) { assert(arr3[i] == arr3_result[i]); } return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0xffffffff,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmpq 131a <func0+0x126> cmpl $0x0,-0x8(%rbp) js 12b9 <func0+0xc5> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax test %eax,%eax js 1258 <func0+0x64> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax test %eax,%eax js 128c <func0+0x98> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax test %eax,%eax jns 12b9 <func0+0xc5> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax test %eax,%eax js 12b9 <func0+0xc5> mov -0x4(%rbp),%ecx mov -0x8(%rbp),%edx mov -0x1c(%rbp),%esi mov -0x18(%rbp),%rax mov %rax,%rdi callq 1169 <right_rotate> mov -0x4(%rbp),%eax sub -0x8(%rbp),%eax cmp $0x2,%eax jle 12b2 <func0+0xbe> addl $0x2,-0x8(%rbp) jmp 12b9 <func0+0xc5> movl $0xffffffff,-0x8(%rbp) cmpl $0xffffffff,-0x8(%rbp) jne 1316 <func0+0x122> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax test %eax,%eax js 12e3 <func0+0xef> mov -0x4(%rbp),%eax and $0x1,%eax test %eax,%eax je 1310 <func0+0x11c> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax test %eax,%eax jns 1316 <func0+0x122> mov -0x4(%rbp),%eax cltd shr $0x1f,%edx add %edx,%eax and $0x1,%eax sub %edx,%eax cmp $0x1,%eax jne 1316 <func0+0x122> mov -0x4(%rbp),%eax mov %eax,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 121a <func0+0x26> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_8], 0FFFFFFFFh mov [rbp+var_4], 0 jmp loc_1320 loc_121A: cmp [rbp+var_8], 0 js loc_12B9 mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] test eax, eax js short loc_1258 mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] test eax, eax js short loc_128C loc_1258: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] test eax, eax jns short loc_12B9 mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] test eax, eax js short loc_12B9 loc_128C: mov ecx, [rbp+var_4] mov edx, [rbp+var_8] mov esi, [rbp+var_1C] mov rax, [rbp+var_18] mov rdi, rax call right_rotate mov eax, [rbp+var_4] sub eax, [rbp+var_8] cmp eax, 2 jle short loc_12B2 add [rbp+var_8], 2 jmp short loc_12B9 loc_12B2: mov [rbp+var_8], 0FFFFFFFFh loc_12B9: cmp [rbp+var_8], 0FFFFFFFFh jnz short loc_131C mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] test eax, eax js short loc_12E3 mov eax, [rbp+var_4] and eax, 1 test eax, eax jz short loc_1316 loc_12E3: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] test eax, eax jns short loc_131C mov edx, [rbp+var_4] mov eax, edx sar eax, 1Fh shr eax, 1Fh add edx, eax and edx, 1 sub edx, eax mov eax, edx cmp eax, 1 jnz short loc_131C loc_1316: mov eax, [rbp+var_4] mov [rbp+var_8], eax loc_131C: add [rbp+var_4], 1 loc_1320: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl loc_121A nop nop leave retn
long long func0(long long a1, int a2) { long long result; // rax int v3; // [rsp+18h] [rbp-8h] int i; // [rsp+1Ch] [rbp-4h] v3 = -1; for ( i = 0; ; ++i ) { result = (unsigned int)i; if ( i >= a2 ) break; if ( v3 >= 0 && (*(int *)(4LL * i + a1) >= 0 && *(int *)(4LL * v3 + a1) < 0 || *(int *)(4LL * i + a1) < 0 && *(int *)(4LL * v3 + a1) >= 0) ) { right_rotate(a1, (unsigned int)a2, (unsigned int)v3, (unsigned int)i); if ( i - v3 <= 2 ) v3 = -1; else v3 += 2; } if ( v3 == -1 && (*(int *)(4LL * i + a1) >= 0 && (i & 1) == 0 || *(int *)(4LL * i + a1) < 0 && i % 2 == 1) ) v3 = i; } 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 + -0x8],0xffffffff MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101320 LAB_0010121a: CMP dword ptr [RBP + -0x8],0x0 JS 0x001012b9 MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JS 0x00101258 MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JS 0x0010128c LAB_00101258: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JNS 0x001012b9 MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JS 0x001012b9 LAB_0010128c: MOV ECX,dword ptr [RBP + -0x4] MOV EDX,dword ptr [RBP + -0x8] MOV ESI,dword ptr [RBP + -0x1c] MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101169 MOV EAX,dword ptr [RBP + -0x4] SUB EAX,dword ptr [RBP + -0x8] CMP EAX,0x2 JLE 0x001012b2 ADD dword ptr [RBP + -0x8],0x2 JMP 0x001012b9 LAB_001012b2: MOV dword ptr [RBP + -0x8],0xffffffff LAB_001012b9: CMP dword ptr [RBP + -0x8],-0x1 JNZ 0x0010131c MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JS 0x001012e3 MOV EAX,dword ptr [RBP + -0x4] AND EAX,0x1 TEST EAX,EAX JZ 0x00101316 LAB_001012e3: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JNS 0x0010131c MOV EDX,dword ptr [RBP + -0x4] MOV EAX,EDX SAR EAX,0x1f SHR EAX,0x1f ADD EDX,EAX AND EDX,0x1 SUB EDX,EAX MOV EAX,EDX CMP EAX,0x1 JNZ 0x0010131c LAB_00101316: MOV EAX,dword ptr [RBP + -0x4] MOV dword ptr [RBP + -0x8],EAX LAB_0010131c: ADD dword ptr [RBP + -0x4],0x1 LAB_00101320: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x0010121a NOP NOP LEAVE RET
void func0(long param_1,int param_2) { int4 local_10; int4 local_c; local_10 = 0xffffffff; for (local_c = 0; (int)local_c < param_2; local_c = local_c + 1) { if ((-1 < (int)local_10) && (((-1 < *(int *)(param_1 + (long)(int)local_c * 4) && (*(int *)(param_1 + (long)(int)local_10 * 4) < 0)) || ((*(int *)(param_1 + (long)(int)local_c * 4) < 0 && (-1 < *(int *)(param_1 + (long)(int)local_10 * 4))))))) { right_rotate(param_1,param_2,local_10,local_c); if ((int)(local_c - local_10) < 3) { local_10 = 0xffffffff; } else { local_10 = local_10 + 2; } } if ((local_10 == 0xffffffff) && (((-1 < *(int *)(param_1 + (long)(int)local_c * 4) && ((local_c & 1) == 0)) || ((*(int *)(param_1 + (long)(int)local_c * 4) < 0 && ((int)local_c % 2 == 1)))))) { local_10 = local_c; } } return; }
5,185
func0
#include <assert.h> void right_rotate(int arr[], int n, int out_of_place, int cur) { int temp = arr[cur]; for (int i = cur; i > out_of_place; --i) { arr[i] = arr[i - 1]; } arr[out_of_place] = temp; }
void func0(int arr[], int n) { int out_of_place = -1; for (int index = 0; index < n; ++index) { if (out_of_place >= 0) { if ((arr[index] >= 0 && arr[out_of_place] < 0) || (arr[index] < 0 && arr[out_of_place] >= 0)) { right_rotate(arr, n, out_of_place, index); if (index - out_of_place > 2) { out_of_place += 2; } else { out_of_place = -1; } } } if (out_of_place == -1) { if ((arr[index] >= 0 && index % 2 == 0) || (arr[index] < 0 && index % 2 == 1)) { out_of_place = index; } } } }
int main() { int arr1[] = {-5, -2, 5, 2, 4, 7, 1, 8, 0, -8}; int arr1_result[] = {-5, 5, -2, 2, -8, 4, 7, 1, 8, 0}; func0(arr1, 10); for (int i = 0; i < 10; i++) { assert(arr1[i] == arr1_result[i]); } int arr2[] = {1, 2, 3, -4, -1, 4}; int arr2_result[] = {-4, 1, -1, 2, 3, 4}; func0(arr2, 6); for (int i = 0; i < 6; i++) { assert(arr2[i] == arr2_result[i]); } int arr3[] = {4, 7, 9, 77, -4, 5, -3, -9}; int arr3_result[] = {-4, 4, -3, 7, -9, 9, 77, 5}; func0(arr3, 8); for (int i = 0; i < 8; i++) { assert(arr3[i] == arr3_result[i]); } return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 1275 <func0+0xca> push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%r12 mov %esi,%r15d lea -0x1(%rsi),%r14d mov $0x0,%ebx mov $0xffffffff,%ebp jmp 120d <func0+0x62> movslq %ebp,%rax cmpl $0x0,(%r12,%rax,4) jns 1229 <func0+0x7e> jmp 1201 <func0+0x56> cmp $0xffffffff,%ebp jne 1201 <func0+0x56> cmpl $0x0,(%r12,%rbx,4) js 1248 <func0+0x9d> testb $0x1,0x4(%rsp) mov $0xffffffff,%ebp cmove %r13d,%ebp lea 0x1(%rbx),%rax cmp %r14,%rbx je 1266 <func0+0xbb> mov %rax,%rbx mov %ebx,0x4(%rsp) mov %ebx,%r13d test %ebp,%ebp js 11e7 <func0+0x3c> cmpl $0x0,(%r12,%rbx,4) js 11db <func0+0x30> movslq %ebp,%rax cmpl $0x0,(%r12,%rax,4) jns 1201 <func0+0x56> mov %r13d,%ecx mov %ebp,%edx mov %r15d,%esi mov %r12,%rdi callq 1169 <right_rotate> mov %r13d,%eax sub %ebp,%eax add $0x2,%ebp cmp $0x2,%eax jg 1201 <func0+0x56> jmp 11ec <func0+0x41> mov %r13d,%edx shr $0x1f,%edx lea 0x0(%r13,%rdx,1),%eax and $0x1,%eax sub %edx,%eax cmp $0x1,%eax mov $0xffffffff,%ebp cmove %r13d,%ebp jmp 1201 <func0+0x56> add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq retq
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 8 mov [rsp+38h+var_34], esi test esi, esi jle loc_1261 mov r12, rdi mov r15d, esi mov ebx, 0 mov ebp, 0FFFFFFFFh jmp short loc_1208 loc_11DA: movsxd rax, ebp cmp dword ptr [r12+rax*4], 0 jns short loc_1223 jmp short loc_11FF loc_11E6: cmp ebp, 0FFFFFFFFh jnz short loc_11FF loc_11EB: cmp dword ptr [r12+rbx*4], 0 js short loc_1243 test r14b, 1 mov ebp, 0FFFFFFFFh cmovz ebp, r13d loc_11FF: add rbx, 1 cmp rbx, r15 jz short loc_1261 loc_1208: mov r14d, ebx mov r13d, ebx test ebp, ebp js short loc_11E6 cmp dword ptr [r12+rbx*4], 0 js short loc_11DA movsxd rax, ebp cmp dword ptr [r12+rax*4], 0 jns short loc_11FF loc_1223: mov ecx, r13d mov edx, ebp mov esi, [rsp+38h+var_34] mov rdi, r12 call right_rotate mov eax, r13d sub eax, ebp add ebp, 2 cmp eax, 2 jg short loc_11FF jmp short loc_11EB loc_1243: mov edx, r13d shr edx, 1Fh lea eax, [r13+rdx+0] and eax, 1 sub eax, edx cmp eax, 1 mov ebp, 0FFFFFFFFh cmovz ebp, r13d jmp short loc_11FF loc_1261: add rsp, 8 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1, int a2) { long long v2; // rbx int v3; // ebp long long result; // rax if ( a2 > 0 ) { v2 = 0LL; v3 = -1; do { if ( v3 < 0 ) { if ( v3 == -1 ) goto LABEL_6; } else { if ( *(int *)(a1 + 4 * v2) < 0 ) { result = v3; if ( *(int *)(a1 + 4LL * v3) < 0 ) goto LABEL_9; } else { result = v3; if ( *(int *)(a1 + 4LL * v3) >= 0 ) goto LABEL_9; } right_rotate(a1, (unsigned int)a2, (unsigned int)v3, (unsigned int)v2); result = (unsigned int)(v2 - v3); v3 += 2; if ( (int)result <= 2 ) { LABEL_6: if ( *(int *)(a1 + 4 * v2) < 0 ) { result = (unsigned int)((int)v2 % 2); v3 = -1; if ( (_DWORD)result == 1 ) v3 = v2; } else { v3 = -1; if ( (v2 & 1) == 0 ) v3 = v2; } } } LABEL_9: ++v2; } while ( v2 != a2 ); } return result; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV dword ptr [RSP + 0x4],ESI TEST ESI,ESI JLE 0x00101261 MOV R12,RDI MOV R15D,ESI MOV EBX,0x0 MOV EBP,0xffffffff JMP 0x00101208 LAB_001011da: MOVSXD RAX,EBP CMP dword ptr [R12 + RAX*0x4],0x0 JNS 0x00101223 JMP 0x001011ff LAB_001011e6: CMP EBP,-0x1 JNZ 0x001011ff LAB_001011eb: CMP dword ptr [R12 + RBX*0x4],0x0 JS 0x00101243 TEST R14B,0x1 MOV EBP,0xffffffff CMOVZ EBP,R13D LAB_001011ff: ADD RBX,0x1 CMP RBX,R15 JZ 0x00101261 LAB_00101208: MOV R14D,EBX MOV R13D,EBX TEST EBP,EBP JS 0x001011e6 CMP dword ptr [R12 + RBX*0x4],0x0 JS 0x001011da MOVSXD RAX,EBP CMP dword ptr [R12 + RAX*0x4],0x0 JNS 0x001011ff LAB_00101223: MOV ECX,R13D MOV EDX,EBP MOV ESI,dword ptr [RSP + 0x4] MOV RDI,R12 CALL 0x00101169 MOV EAX,R13D SUB EAX,EBP ADD EBP,0x2 CMP EAX,0x2 JG 0x001011ff JMP 0x001011eb LAB_00101243: MOV EDX,R13D SHR EDX,0x1f LEA EAX,[R13 + RDX*0x1] AND EAX,0x1 SUB EAX,EDX CMP EAX,0x1 MOV EBP,0xffffffff CMOVZ EBP,R13D JMP 0x001011ff LAB_00101261: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
void func0(long param_1,uint param_2) { ulong uVar1; int iVar2; ulong uVar3; ulong uVar4; if (0 < (int)param_2) { uVar1 = 0; uVar3 = 0xffffffff; do { uVar4 = uVar1 & 0xffffffff; iVar2 = (int)uVar3; if (iVar2 < 0) { if (iVar2 != -1) goto LAB_001011ff; LAB_001011eb: if (*(int *)(param_1 + uVar1 * 4) < 0) { iVar2 = (int)(uVar4 >> 0x1f); uVar3 = 0xffffffff; if (((int)uVar1 + iVar2 & 1U) - iVar2 == 1) { uVar3 = uVar4; } } else { uVar3 = 0xffffffff; if ((uVar1 & 1) == 0) { uVar3 = uVar4; } } } else if (*(int *)(param_1 + uVar1 * 4) < 0) { if (-1 < *(int *)(param_1 + (long)iVar2 * 4)) goto LAB_00101223; } else if (*(int *)(param_1 + (long)iVar2 * 4) < 0) { LAB_00101223: right_rotate(param_1,param_2,uVar3,uVar4); uVar3 = (ulong)(iVar2 + 2); if ((int)uVar1 - iVar2 < 3) goto LAB_001011eb; } LAB_001011ff: uVar1 = uVar1 + 1; } while (uVar1 != param_2); } return; }
5,186
func0
#include <assert.h> void right_rotate(int arr[], int n, int out_of_place, int cur) { int temp = arr[cur]; for (int i = cur; i > out_of_place; --i) { arr[i] = arr[i - 1]; } arr[out_of_place] = temp; }
void func0(int arr[], int n) { int out_of_place = -1; for (int index = 0; index < n; ++index) { if (out_of_place >= 0) { if ((arr[index] >= 0 && arr[out_of_place] < 0) || (arr[index] < 0 && arr[out_of_place] >= 0)) { right_rotate(arr, n, out_of_place, index); if (index - out_of_place > 2) { out_of_place += 2; } else { out_of_place = -1; } } } if (out_of_place == -1) { if ((arr[index] >= 0 && index % 2 == 0) || (arr[index] < 0 && index % 2 == 1)) { out_of_place = index; } } } }
int main() { int arr1[] = {-5, -2, 5, 2, 4, 7, 1, 8, 0, -8}; int arr1_result[] = {-5, 5, -2, 2, -8, 4, 7, 1, 8, 0}; func0(arr1, 10); for (int i = 0; i < 10; i++) { assert(arr1[i] == arr1_result[i]); } int arr2[] = {1, 2, 3, -4, -1, 4}; int arr2_result[] = {-4, 1, -1, 2, 3, 4}; func0(arr2, 6); for (int i = 0; i < 6; i++) { assert(arr2[i] == arr2_result[i]); } int arr3[] = {4, 7, 9, 77, -4, 5, -3, -9}; int arr3_result[] = {-4, 4, -3, 7, -9, 9, 77, 5}; func0(arr3, 8); for (int i = 0; i < 8; i++) { assert(arr3[i] == arr3_result[i]); } return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1580 <func0+0x110> push %r12 xor %r8d,%r8d mov $0xffffffff,%r10d lea -0x4(%rdi),%r12 push %rbp push %rbx jmp 14bc <func0+0x4c> lea 0x0(,%r11,4),%rdx movslq %r10d,%rcx lea (%rdi,%rdx,1),%rax lea (%rdi,%rcx,4),%rbp mov (%rax),%ebx mov 0x0(%rbp),%ecx test %ebx,%ebx js 1520 <func0+0xb0> test %ecx,%ecx js 1524 <func0+0xb4> mov %r9d,%r8d cmp %r9d,%esi jle 1571 <func0+0x101> lea 0x1(%r8),%r9d movslq %r8d,%r11 cmp $0xffffffff,%r10d jne 1490 <func0+0x20> mov %r8d,%r10d lea (%rdi,%r11,4),%rax mov (%rax),%edx mov %r9d,%r8d test %edx,%edx js 14ff <func0+0x8f> test $0x1,%r10b je 14b3 <func0+0x43> cmp %r9d,%esi jle 1571 <func0+0x101> movslq %r8d,%r11 mov %r9d,%r10d add $0x1,%r9d lea (%rdi,%r11,4),%rax mov %r9d,%r8d mov (%rax),%edx test %edx,%edx jns 14d9 <func0+0x69> test $0x1,%r10b jne 14b3 <func0+0x43> add $0x4,%rax cmp %r9d,%esi jle 1571 <func0+0x101> mov %r9d,%r10d add $0x1,%r9d jmp 14d0 <func0+0x60> nopw 0x0(%rax,%rax,1) test %ecx,%ecx js 14b0 <func0+0x40> cmp %r8d,%r10d jge 154f <func0+0xdf> lea -0x1(%r8),%ecx add %r12,%rdx sub %r10d,%ecx shl $0x2,%rcx sub %rcx,%rdx nopw 0x0(%rax,%rax,1) mov -0x4(%rax),%ecx sub $0x4,%rax mov %ecx,0x4(%rax) cmp %rdx,%rax jne 1540 <func0+0xd0> mov %r8d,%eax mov %ebx,0x0(%rbp) sub %r10d,%eax cmp $0x2,%eax jle 14c9 <func0+0x59> add $0x2,%r10d mov %r9d,%r8d cmp %r9d,%esi jg 14bc <func0+0x4c> pop %rbx pop %rbp pop %r12 retq nopw %cs:0x0(%rax,%rax,1) retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle locret_15AA push r15 mov r15d, esi push r14 push r13 mov r13, rdi push r12 mov r12d, 0FFFFFFFFh push rbp push rbx xor ebx, ebx sub rsp, 18h jmp short loc_14E2 loc_14D0: lea eax, [rbx+1] test esi, esi js short loc_150F loc_14D7: mov ebx, eax cmp r15d, eax jle loc_156D loc_14E2: movsxd rbp, ebx mov r14d, [r13+rbp*4+0] lea rdx, ds:0[rbp*4] cmp r12d, 0FFFFFFFFh jz loc_1590 movsxd rax, r12d lea rcx, [r13+rax*4+0] mov esi, [rcx] test r14d, r14d jns short loc_14D0 test esi, esi js short loc_155F loc_150F: cmp ebx, r12d jle short loc_154E mov eax, ebx mov [rsp+48h+var_40], rcx sub eax, r12d sub eax, 1 mov rdi, rax lea r8, ds:4[rax*4] neg rdi shl rdi, 2 lea rsi, [rdx+rdi-4] add rdi, rdx mov rdx, r8 add rsi, r13 add rdi, r13 call _memmove mov rcx, [rsp+48h+var_40] loc_154E: mov eax, ebx mov [rcx], r14d sub eax, r12d cmp eax, 2 jle short loc_1590 add r12d, 2 loc_155F: lea eax, [rbx+1] mov ebx, eax cmp r15d, eax jg loc_14E2 loc_156D: add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1580: test bl, 1 jnz short loc_15A2 loc_1585: cmp r15d, eax jle short loc_156D add rbp, 1 mov ebx, eax loc_1590: mov edx, [r13+rbp*4+0] lea eax, [rbx+1] test edx, edx js short loc_1580 test bpl, 1 jnz short loc_1585 loc_15A2: mov r12d, ebx jmp loc_14D7 locret_15AA: retn
void func0(long long a1, int a2) { int v3; // r12d int v4; // ebx int v5; // eax long long v6; // rbp int v7; // r14d int *v8; // rcx int v9; // esi if ( a2 > 0 ) { v3 = -1; v4 = 0; while ( 1 ) { v6 = v4; v7 = *(_DWORD *)(a1 + 4LL * v4); if ( v3 == -1 ) goto LABEL_17; v8 = (int *)(a1 + 4LL * v3); v9 = *v8; if ( v7 >= 0 ) { v5 = v4 + 1; if ( v9 >= 0 ) goto LABEL_4; LABEL_8: if ( v4 > v3 ) { memmove( a1 + 4LL * v4 - 4LL * (unsigned int)(v4 - v3 - 1), a1 + 4LL * v4 - 4LL * (unsigned int)(v4 - v3 - 1) - 4, 4LL * (unsigned int)(v4 - v3 - 1) + 4); v8 = (int *)(a1 + 4LL * v3); } *v8 = v7; if ( v4 - v3 > 2 ) { v3 += 2; goto LABEL_12; } LABEL_17: while ( 1 ) { v5 = v4 + 1; if ( *(int *)(a1 + 4 * v6) >= 0 ) break; if ( (v4 & 1) != 0 ) goto LABEL_19; LABEL_15: if ( a2 <= v5 ) return; ++v6; ++v4; } if ( (v6 & 1) != 0 ) goto LABEL_15; LABEL_19: v3 = v4; LABEL_4: v4 = v5; if ( a2 <= v5 ) return; } else { if ( v9 >= 0 ) goto LABEL_8; LABEL_12: if ( a2 <= ++v4 ) return; } } } }
func0: ENDBR64 TEST ESI,ESI JLE 0x001015aa PUSH R15 MOV R15D,ESI PUSH R14 PUSH R13 MOV R13,RDI PUSH R12 MOV R12D,0xffffffff PUSH RBP PUSH RBX XOR EBX,EBX SUB RSP,0x18 JMP 0x001014e2 LAB_001014d0: LEA EAX,[RBX + 0x1] TEST ESI,ESI JS 0x0010150f LAB_001014d7: MOV EBX,EAX CMP R15D,EAX JLE 0x0010156d LAB_001014e2: MOVSXD RBP,EBX MOV R14D,dword ptr [R13 + RBP*0x4] LEA RDX,[RBP*0x4] CMP R12D,-0x1 JZ 0x00101590 MOVSXD RAX,R12D LEA RCX,[R13 + RAX*0x4] MOV ESI,dword ptr [RCX] TEST R14D,R14D JNS 0x001014d0 TEST ESI,ESI JS 0x0010155f LAB_0010150f: CMP EBX,R12D JLE 0x0010154e MOV EAX,EBX MOV qword ptr [RSP + 0x8],RCX SUB EAX,R12D SUB EAX,0x1 MOV RDI,RAX LEA R8,[0x4 + RAX*0x4] NEG RDI SHL RDI,0x2 LEA RSI,[RDX + RDI*0x1 + -0x4] ADD RDI,RDX MOV RDX,R8 ADD RSI,R13 ADD RDI,R13 CALL 0x00101090 MOV RCX,qword ptr [RSP + 0x8] LAB_0010154e: MOV EAX,EBX MOV dword ptr [RCX],R14D SUB EAX,R12D CMP EAX,0x2 JLE 0x00101590 ADD R12D,0x2 LAB_0010155f: LEA EAX,[RBX + 0x1] MOV EBX,EAX CMP R15D,EAX JG 0x001014e2 LAB_0010156d: ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101580: TEST BL,0x1 JNZ 0x001015a2 LAB_00101585: CMP R15D,EAX JLE 0x0010156d ADD RBP,0x1 MOV EBX,EAX LAB_00101590: MOV EDX,dword ptr [R13 + RBP*0x4] LEA EAX,[RBX + 0x1] TEST EDX,EDX JS 0x00101580 TEST BPL,0x1 JNZ 0x00101585 LAB_001015a2: MOV R12D,EBX JMP 0x001014d7 LAB_001015aa: RET
void func0(long param_1,int param_2) { int *piVar1; int iVar2; int iVar3; uint uVar4; ulong uVar5; uint uVar6; ulong uVar7; long lVar8; uint uVar9; if (param_2 < 1) { return; } uVar9 = 0xffffffff; uVar6 = 0; do { while( true ) { uVar7 = (ulong)(int)uVar6; iVar2 = *(int *)(param_1 + uVar7 * 4); if (uVar9 == 0xffffffff) goto LAB_00101590; piVar1 = (int *)(param_1 + (long)(int)uVar9 * 4); iVar3 = *piVar1; if (iVar2 < 0) break; uVar4 = uVar6 + 1; if (iVar3 < 0) goto LAB_0010150f; LAB_001014d7: uVar6 = uVar4; if (param_2 <= (int)uVar4) { return; } } if (-1 < iVar3) { LAB_0010150f: if ((int)uVar9 < (int)uVar6) { uVar5 = (ulong)((uVar6 - uVar9) - 1); lVar8 = uVar5 * -4; memmove((void *)(lVar8 + uVar7 * 4 + param_1),(void *)(uVar7 * 4 + -4 + lVar8 + param_1), uVar5 * 4 + 4); } *piVar1 = iVar2; if ((int)(uVar6 - uVar9) < 3) { LAB_00101590: do { uVar4 = uVar6 + 1; uVar9 = uVar6; if (*(int *)(param_1 + uVar7 * 4) < 0) { if ((uVar6 & 1) != 0) goto LAB_001014d7; } else if ((uVar7 & 1) == 0) goto LAB_001014d7; if (param_2 <= (int)uVar4) { return; } uVar7 = uVar7 + 1; uVar6 = uVar4; } while( true ); } uVar9 = uVar9 + 2; } uVar6 = uVar6 + 1; if (param_2 <= (int)uVar6) { return; } } while( true ); }
5,187
func0
#include <assert.h> void right_rotate(int arr[], int n, int out_of_place, int cur) { int temp = arr[cur]; for (int i = cur; i > out_of_place; --i) { arr[i] = arr[i - 1]; } arr[out_of_place] = temp; }
void func0(int arr[], int n) { int out_of_place = -1; for (int index = 0; index < n; ++index) { if (out_of_place >= 0) { if ((arr[index] >= 0 && arr[out_of_place] < 0) || (arr[index] < 0 && arr[out_of_place] >= 0)) { right_rotate(arr, n, out_of_place, index); if (index - out_of_place > 2) { out_of_place += 2; } else { out_of_place = -1; } } } if (out_of_place == -1) { if ((arr[index] >= 0 && index % 2 == 0) || (arr[index] < 0 && index % 2 == 1)) { out_of_place = index; } } } }
int main() { int arr1[] = {-5, -2, 5, 2, 4, 7, 1, 8, 0, -8}; int arr1_result[] = {-5, 5, -2, 2, -8, 4, 7, 1, 8, 0}; func0(arr1, 10); for (int i = 0; i < 10; i++) { assert(arr1[i] == arr1_result[i]); } int arr2[] = {1, 2, 3, -4, -1, 4}; int arr2_result[] = {-4, 1, -1, 2, 3, 4}; func0(arr2, 6); for (int i = 0; i < 6; i++) { assert(arr2[i] == arr2_result[i]); } int arr3[] = {4, 7, 9, 77, -4, 5, -3, -9}; int arr3_result[] = {-4, 4, -3, 7, -9, 9, 77, 5}; func0(arr3, 8); for (int i = 0; i < 8; i++) { assert(arr3[i] == arr3_result[i]); } return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 1610 <func0+0x130> push %r15 mov %esi,%r15d push %r14 mov %rdi,%r14 push %r13 push %r12 mov $0xffffffff,%r12d push %rbp push %rbx xor %ebx,%ebx sub $0x18,%rsp nopl 0x0(%rax,%rax,1) lea 0x1(%rbx),%ebp movslq %ebx,%r13 cmp $0xffffffff,%r12d je 15b8 <func0+0xd8> movslq %r12d,%rax mov (%r14,%r13,4),%ecx lea 0x0(,%r13,4),%rdi lea (%r14,%rax,4),%r8 mov (%r8),%eax test %ecx,%ecx js 1558 <func0+0x78> test %eax,%eax js 155c <func0+0x7c> mov %ebp,%ebx cmp %ebp,%r15d jg 1510 <func0+0x30> add $0x18,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) test %eax,%eax js 153e <func0+0x5e> cmp %ebx,%r12d jge 15a0 <func0+0xc0> mov %ebx,%eax mov %r8,0x8(%rsp) sub %r12d,%eax mov %ecx,0x4(%rsp) lea -0x1(%rax),%edx mov %rdx,%rax lea 0x4(,%rdx,4),%rdx neg %rax shl $0x2,%rax lea -0x4(%rdi,%rax,1),%rsi add %rax,%rdi add %r14,%rsi add %r14,%rdi callq 1090 <memmove@plt> mov 0x4(%rsp),%ecx mov 0x8(%rsp),%r8 mov %ebx,%eax mov %ecx,(%r8) sub %r12d,%eax cmp $0x2,%eax jle 15b8 <func0+0xd8> add $0x2,%r12d mov %ebp,%ebx jmp 1540 <func0+0x60> nopl (%rax) mov %ebx,%r12d lea (%r14,%r13,4),%rax mov (%rax),%edx mov %ebp,%ebx test %edx,%edx js 15ef <func0+0x10f> test $0x1,%r12b je 1540 <func0+0x60> cmp %ebp,%r15d jle 1545 <func0+0x65> movslq %ebx,%r13 mov %ebp,%r12d add $0x1,%ebp lea (%r14,%r13,4),%rax mov %ebp,%ebx mov (%rax),%edx test %edx,%edx jns 15c7 <func0+0xe7> test $0x1,%r12b jne 1540 <func0+0x60> add $0x4,%rax cmp %ebp,%r15d jle 1545 <func0+0x65> mov %ebp,%r12d add $0x1,%ebp jmp 15bf <func0+0xdf> xchg %ax,%ax retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle locret_1510 push r15 push r14 push r13 mov r13d, esi push r12 mov r12, rdi push rbp xor ebp, ebp push rbx xor ebx, ebx sub rsp, 18h loc_1414: lea rax, [r12+rbp] mov edx, ebx mov eax, [rax] and edx, 1 test eax, eax js loc_14E8 test edx, edx jnz loc_14F0 loc_142F: lea eax, [rbx+1] add rbp, 4 cmp r13d, eax jz loc_14D4 mov ecx, ebx mov ebx, eax jmp short loc_1458 loc_1448: test eax, eax js short loc_146F loc_144C: add ebx, 1 add rbp, 4 cmp r13d, ebx jz short loc_14D4 loc_1458: movsxd rax, ecx mov r15d, [r12+rbp] lea r14, [r12+rax*4] mov eax, [r14] test r15d, r15d jns short loc_1448 test eax, eax js short loc_144C loc_146F: cmp ecx, ebx jge loc_1508 mov r8d, ebx mov [rsp+48h+var_3C], ecx sub r8d, ecx lea eax, [r8-1] mov [rsp+48h+var_40], r8d mov rdi, rax lea rdx, ds:4[rax*4]; n neg rdi shl rdi, 2 lea rsi, [rbp+rdi-4] add rdi, rbp add rsi, r12; src add rdi, r12; dest call _memmove mov r8d, [rsp+48h+var_40] mov ecx, [rsp+48h+var_3C] mov [r14], r15d cmp r8d, 2 jle loc_1414 add ebx, 1 add ecx, 2 add rbp, 4 cmp r13d, ebx jnz short loc_1458 loc_14D4: add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_14E8: test edx, edx jnz loc_142F loc_14F0: add ebx, 1 add rbp, 4 cmp r13d, ebx jnz loc_1414 jmp short loc_14D4 loc_1508: mov [r14], r15d jmp loc_1414 locret_1510: retn
void func0(long long a1, int a2) { long long v2; // rbp int v3; // ebx int v4; // ecx int v5; // r15d int *v6; // r14 int v7; // eax int v8; // [rsp+0h] [rbp-40h] int v9; // [rsp+4h] [rbp-3Ch] if ( a2 > 0 ) { v2 = 0LL; v3 = 0; while ( 1 ) { LABEL_3: while ( *(int *)(a1 + v2) < 0 ) { if ( (v3 & 1) != 0 ) goto LABEL_5; LABEL_16: ++v3; v2 += 4LL; if ( a2 == v3 ) return; } if ( (v3 & 1) != 0 ) goto LABEL_16; LABEL_5: v2 += 4LL; if ( a2 == v3 + 1 ) return; v4 = v3++; while ( 1 ) { while ( 1 ) { v5 = *(_DWORD *)(a1 + v2); v6 = (int *)(a1 + 4LL * v4); v7 = *v6; if ( v5 < 0 ) break; if ( v7 < 0 ) goto LABEL_11; LABEL_8: ++v3; v2 += 4LL; if ( a2 == v3 ) return; } if ( v7 < 0 ) goto LABEL_8; LABEL_11: if ( v4 >= v3 ) break; v9 = v4; v8 = v3 - v4; memmove( (void *)(a1 + v2 - 4LL * (unsigned int)(v3 - v4 - 1)), (const void *)(a1 + v2 - 4LL * (unsigned int)(v3 - v4 - 1) - 4), 4LL * (unsigned int)(v3 - v4 - 1) + 4); *v6 = v5; if ( v8 <= 2 ) goto LABEL_3; ++v3; v4 = v9 + 2; v2 += 4LL; if ( a2 == v3 ) return; } *v6 = v5; } } }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101510 PUSH R15 PUSH R14 PUSH R13 MOV R13D,ESI PUSH R12 MOV R12,RDI PUSH RBP XOR EBP,EBP PUSH RBX XOR EBX,EBX SUB RSP,0x18 LAB_00101414: LEA RAX,[R12 + RBP*0x1] MOV EDX,EBX MOV EAX,dword ptr [RAX] AND EDX,0x1 TEST EAX,EAX JS 0x001014e8 TEST EDX,EDX JNZ 0x001014f0 LAB_0010142f: LEA EAX,[RBX + 0x1] ADD RBP,0x4 CMP R13D,EAX JZ 0x001014d4 MOV ECX,EBX MOV EBX,EAX JMP 0x00101458 LAB_00101448: TEST EAX,EAX JS 0x0010146f LAB_0010144c: ADD EBX,0x1 ADD RBP,0x4 CMP R13D,EBX JZ 0x001014d4 LAB_00101458: MOVSXD RAX,ECX MOV R15D,dword ptr [R12 + RBP*0x1] LEA R14,[R12 + RAX*0x4] MOV EAX,dword ptr [R14] TEST R15D,R15D JNS 0x00101448 TEST EAX,EAX JS 0x0010144c LAB_0010146f: CMP ECX,EBX JGE 0x00101508 MOV R8D,EBX MOV dword ptr [RSP + 0xc],ECX SUB R8D,ECX LEA EAX,[R8 + -0x1] MOV dword ptr [RSP + 0x8],R8D MOV RDI,RAX LEA RDX,[0x4 + RAX*0x4] NEG RDI SHL RDI,0x2 LEA RSI,[RBP + RDI*0x1 + -0x4] ADD RDI,RBP ADD RSI,R12 ADD RDI,R12 CALL 0x00101090 MOV R8D,dword ptr [RSP + 0x8] MOV ECX,dword ptr [RSP + 0xc] MOV dword ptr [R14],R15D CMP R8D,0x2 JLE 0x00101414 ADD EBX,0x1 ADD ECX,0x2 ADD RBP,0x4 CMP R13D,EBX JNZ 0x00101458 LAB_001014d4: ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001014e8: TEST EDX,EDX JNZ 0x0010142f LAB_001014f0: ADD EBX,0x1 ADD RBP,0x4 CMP R13D,EBX JNZ 0x00101414 JMP 0x001014d4 LAB_00101508: MOV dword ptr [R14],R15D JMP 0x00101414 LAB_00101510: RET
void func0(long param_1,uint param_2) { int *piVar1; int iVar2; uint uVar3; ulong uVar4; uint uVar5; uint uVar6; long lVar7; long lVar8; long lVar9; if ((int)param_2 < 1) { return; } lVar7 = 0; uVar6 = 0; LAB_00101414: while ((uVar6 & 1) == 0) { uVar6 = uVar6 + 1; lVar7 = lVar7 + 4; if (param_2 == uVar6) { return; } } uVar3 = uVar6 + 1; uVar5 = uVar6; lVar8 = lVar7; if (param_2 == uVar6 + 1) { return; } do { uVar6 = uVar3; lVar7 = lVar8 + 4; iVar2 = *(int *)(param_1 + lVar7); piVar1 = (int *)(param_1 + (long)(int)uVar5 * 4); if (*piVar1 < 0) { if ((int)uVar6 <= (int)uVar5) { *piVar1 = iVar2; goto LAB_00101414; } uVar4 = (ulong)((uVar6 - uVar5) - 1); lVar9 = uVar4 * -4; memmove((void *)(lVar9 + lVar7 + param_1),(void *)(lVar8 + lVar9 + param_1),uVar4 * 4 + 4); *piVar1 = iVar2; if ((int)(uVar6 - uVar5) < 3) goto LAB_00101414; uVar5 = uVar5 + 2; } uVar3 = uVar6 + 1; lVar8 = lVar7; if (param_2 == uVar6 + 1) { return; } } while( true ); }
5,188
func0
#include <stdio.h> #include <assert.h>
int* func0(int test_tuple[], int size) { static int sums[2]; int sum1 = 0; int sum2 = 0; for (int idx = 0; idx < size; idx++) { if (idx % 2) { sum1 += test_tuple[idx]; } else { sum2 += test_tuple[idx]; } } sums[0] = sum1; sums[1] = sum2; return sums; }
int main() { int arr1[] = {5, 6, 3, 6, 10, 34}; int* result1 = func0(arr1, 6); assert(result1[0] == 46 && result1[1] == 18); int arr2[] = {1, 2, 3, 4, 5}; int* result2 = func0(arr2, 5); assert(result2[0] == 6 && result2[1] == 9); int arr3[] = {6, 7, 8, 9, 4, 5}; int* result3 = func0(arr3, 6); assert(result3[0] == 21 && result3[1] == 18); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0xc(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 11d1 <func0+0x68> mov -0x4(%rbp),%eax and $0x1,%eax test %eax,%eax je 11b4 <func0+0x4b> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax add %eax,-0xc(%rbp) jmp 11cd <func0+0x64> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax add %eax,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 118f <func0+0x26> mov -0xc(%rbp),%eax mov %eax,0x2e36(%rip) mov -0x8(%rbp),%eax mov %eax,0x2e31(%rip) lea 0x2e26(%rip),%rax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_C], 0 mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_11D1 loc_118F: mov eax, [rbp+var_4] and eax, 1 test eax, eax jz short loc_11B4 mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] add [rbp+var_C], eax jmp short loc_11CD loc_11B4: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] add [rbp+var_8], eax loc_11CD: add [rbp+var_4], 1 loc_11D1: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_118F mov eax, [rbp+var_C] mov cs:sums_1, eax mov eax, [rbp+var_8] mov cs:dword_401C, eax lea rax, sums_1 pop rbp retn
int * func0(long long a1, int a2) { int v3; // [rsp+10h] [rbp-Ch] int v4; // [rsp+14h] [rbp-8h] int i; // [rsp+18h] [rbp-4h] v3 = 0; v4 = 0; for ( i = 0; i < a2; ++i ) { if ( (i & 1) != 0 ) v3 += *(_DWORD *)(4LL * i + a1); else v4 += *(_DWORD *)(4LL * i + a1); } sums_1 = v3; dword_401C = v4; return &sums_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011d1 LAB_0010118f: MOV EAX,dword ptr [RBP + -0x4] AND EAX,0x1 TEST EAX,EAX JZ 0x001011b4 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] ADD dword ptr [RBP + -0xc],EAX JMP 0x001011cd LAB_001011b4: 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] ADD dword ptr [RBP + -0x8],EAX LAB_001011cd: ADD dword ptr [RBP + -0x4],0x1 LAB_001011d1: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x0010118f MOV EAX,dword ptr [RBP + -0xc] MOV dword ptr [0x00104018],EAX MOV EAX,dword ptr [RBP + -0x8] MOV dword ptr [0x0010401c],EAX LEA RAX,[0x104018] POP RBP RET
int8 * func0(long param_1,int param_2) { int local_14; int local_10; uint local_c; local_14 = 0; local_10 = 0; for (local_c = 0; (int)local_c < param_2; local_c = local_c + 1) { if ((local_c & 1) == 0) { local_10 = local_10 + *(int *)(param_1 + (long)(int)local_c * 4); } else { local_14 = local_14 + *(int *)(param_1 + (long)(int)local_c * 4); } } sums_1._0_4_ = local_14; sums_1._4_4_ = local_10; return &sums_1; }
5,189
func0
#include <stdio.h> #include <assert.h>
int* func0(int test_tuple[], int size) { static int sums[2]; int sum1 = 0; int sum2 = 0; for (int idx = 0; idx < size; idx++) { if (idx % 2) { sum1 += test_tuple[idx]; } else { sum2 += test_tuple[idx]; } } sums[0] = sum1; sums[1] = sum2; return sums; }
int main() { int arr1[] = {5, 6, 3, 6, 10, 34}; int* result1 = func0(arr1, 6); assert(result1[0] == 46 && result1[1] == 18); int arr2[] = {1, 2, 3, 4, 5}; int* result2 = func0(arr2, 5); assert(result2[0] == 6 && result2[1] == 9); int arr3[] = {6, 7, 8, 9, 4, 5}; int* result3 = func0(arr3, 6); assert(result3[0] == 21 && result3[1] == 18); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 119e <func0+0x35> lea -0x1(%rsi),%r8d mov $0x0,%eax mov $0x0,%ecx mov $0x0,%esi jmp 1195 <func0+0x2c> add (%rdi,%rax,4),%ecx lea 0x1(%rax),%rdx cmp %r8,%rax je 11a8 <func0+0x3f> mov %rdx,%rax test $0x1,%al je 1186 <func0+0x1d> add (%rdi,%rax,4),%esi jmp 1189 <func0+0x20> mov $0x0,%ecx mov $0x0,%esi mov %esi,0x2e6a(%rip) mov %ecx,0x2e68(%rip) lea 0x2e5d(%rip),%rax retq
func0: endbr64 test esi, esi jle short loc_1199 mov esi, esi mov eax, 0 mov edx, 0 mov ecx, 0 jmp short loc_1190 loc_1184: add edx, [rdi+rax*4] loc_1187: add rax, 1 cmp rax, rsi jz short loc_11A3 loc_1190: test al, 1 jz short loc_1184 add ecx, [rdi+rax*4] jmp short loc_1187 loc_1199: mov edx, 0 mov ecx, 0 loc_11A3: mov cs:sums_1, ecx mov cs:dword_401C, edx lea rax, sums_1 retn
int * func0(long long a1, int a2) { long long v2; // rax int v3; // edx int v4; // ecx if ( a2 <= 0 ) { v3 = 0; v4 = 0; } else { v2 = 0LL; v3 = 0; v4 = 0; do { if ( (v2 & 1) != 0 ) v4 += *(_DWORD *)(a1 + 4 * v2); else v3 += *(_DWORD *)(a1 + 4 * v2); ++v2; } while ( v2 != a2 ); } sums_1 = v4; dword_401C = v3; return &sums_1; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101199 MOV ESI,ESI MOV EAX,0x0 MOV EDX,0x0 MOV ECX,0x0 JMP 0x00101190 LAB_00101184: ADD EDX,dword ptr [RDI + RAX*0x4] LAB_00101187: ADD RAX,0x1 CMP RAX,RSI JZ 0x001011a3 LAB_00101190: TEST AL,0x1 JZ 0x00101184 ADD ECX,dword ptr [RDI + RAX*0x4] JMP 0x00101187 LAB_00101199: MOV EDX,0x0 MOV ECX,0x0 LAB_001011a3: MOV dword ptr [0x00104018],ECX MOV dword ptr [0x0010401c],EDX LEA RAX,[0x104018] RET
int8 * func0(long param_1,uint param_2) { ulong uVar1; if ((int)param_2 < 1) { sums_1._4_4_ = 0; sums_1._0_4_ = 0; } else { uVar1 = 0; sums_1._4_4_ = 0; sums_1._0_4_ = 0; do { if ((uVar1 & 1) == 0) { sums_1._4_4_ = sums_1._4_4_ + *(int *)(param_1 + uVar1 * 4); } else { sums_1._0_4_ = (int)sums_1 + *(int *)(param_1 + uVar1 * 4); } uVar1 = uVar1 + 1; } while (uVar1 != param_2); } return &sums_1; }
5,190
func0
#include <stdio.h> #include <assert.h>
int* func0(int test_tuple[], int size) { static int sums[2]; int sum1 = 0; int sum2 = 0; for (int idx = 0; idx < size; idx++) { if (idx % 2) { sum1 += test_tuple[idx]; } else { sum2 += test_tuple[idx]; } } sums[0] = sum1; sums[1] = sum2; return sums; }
int main() { int arr1[] = {5, 6, 3, 6, 10, 34}; int* result1 = func0(arr1, 6); assert(result1[0] == 46 && result1[1] == 18); int arr2[] = {1, 2, 3, 4, 5}; int* result2 = func0(arr2, 5); assert(result2[0] == 6 && result2[1] == 9); int arr3[] = {6, 7, 8, 9, 4, 5}; int* result3 = func0(arr3, 6); assert(result3[0] == 21 && result3[1] == 18); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 11a0 <func0+0x50> lea -0x1(%rsi),%r8d xor %eax,%eax xor %ecx,%ecx xor %esi,%esi jmp 1176 <func0+0x26> nopl 0x0(%rax) add %edx,%esi lea 0x1(%rax),%rdx cmp %r8,%rax je 1188 <func0+0x38> mov %rdx,%rax mov (%rdi,%rax,4),%edx test $0x1,%al jne 1168 <func0+0x18> add %edx,%ecx lea 0x1(%rax),%rdx cmp %r8,%rax jne 1173 <func0+0x23> mov %esi,0x2e8a(%rip) lea 0x2e83(%rip),%rax mov %ecx,0x2e81(%rip) retq nopl 0x0(%rax) xor %ecx,%ecx xor %esi,%esi jmp 1188 <func0+0x38> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle short loc_1330 movsxd rsi, esi xor eax, eax xor ecx, ecx xor r8d, r8d jmp short loc_1304 loc_12F8: add rax, 1 add r8d, edx cmp rsi, rax jz short loc_1316 loc_1304: mov edx, [rdi+rax*4] test al, 1 jnz short loc_12F8 add rax, 1 add ecx, edx cmp rsi, rax jnz short loc_1304 loc_1316: mov cs:sums_1, r8d lea rax, sums_1 mov cs:dword_401C, ecx retn loc_1330: xor ecx, ecx xor r8d, r8d jmp short loc_1316
int * func0(long long a1, int a2) { long long v2; // rax int v3; // ecx int v4; // r8d int v5; // edx int *result; // rax if ( a2 <= 0 ) { v3 = 0; v4 = 0; } else { v2 = 0LL; v3 = 0; v4 = 0; do { while ( 1 ) { v5 = *(_DWORD *)(a1 + 4 * v2); if ( (v2 & 1) == 0 ) break; ++v2; v4 += v5; if ( a2 == v2 ) goto LABEL_6; } ++v2; v3 += v5; } while ( a2 != v2 ); } LABEL_6: sums_1 = v4; result = &sums_1; dword_401C = v3; return result; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101330 MOVSXD RSI,ESI XOR EAX,EAX XOR ECX,ECX XOR R8D,R8D JMP 0x00101304 LAB_001012f8: ADD RAX,0x1 ADD R8D,EDX CMP RSI,RAX JZ 0x00101316 LAB_00101304: MOV EDX,dword ptr [RDI + RAX*0x4] TEST AL,0x1 JNZ 0x001012f8 ADD RAX,0x1 ADD ECX,EDX CMP RSI,RAX JNZ 0x00101304 LAB_00101316: MOV dword ptr [0x00104018],R8D LEA RAX,[0x104018] MOV dword ptr [0x0010401c],ECX RET LAB_00101330: XOR ECX,ECX XOR R8D,R8D JMP 0x00101316
int8 * func0(long param_1,int param_2) { int iVar1; ulong uVar2; if (param_2 < 1) { sums_1._4_4_ = 0; sums_1._0_4_ = 0; } else { uVar2 = 0; sums_1._4_4_ = 0; sums_1._0_4_ = 0; do { while (iVar1 = *(int *)(param_1 + uVar2 * 4), (uVar2 & 1) == 0) { uVar2 = uVar2 + 1; sums_1._4_4_ = sums_1._4_4_ + iVar1; if ((long)param_2 == uVar2) { return &sums_1; } } uVar2 = uVar2 + 1; sums_1._0_4_ = (int)sums_1 + iVar1; } while ((long)param_2 != uVar2); } return &sums_1; }
5,191
func0
#include <stdio.h> #include <assert.h>
int* func0(int test_tuple[], int size) { static int sums[2]; int sum1 = 0; int sum2 = 0; for (int idx = 0; idx < size; idx++) { if (idx % 2) { sum1 += test_tuple[idx]; } else { sum2 += test_tuple[idx]; } } sums[0] = sum1; sums[1] = sum2; return sums; }
int main() { int arr1[] = {5, 6, 3, 6, 10, 34}; int* result1 = func0(arr1, 6); assert(result1[0] == 46 && result1[1] == 18); int arr2[] = {1, 2, 3, 4, 5}; int* result2 = func0(arr2, 5); assert(result2[0] == 6 && result2[1] == 9); int arr3[] = {6, 7, 8, 9, 4, 5}; int* result3 = func0(arr3, 6); assert(result3[0] == 21 && result3[1] == 18); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 12a0 <func0+0x150> lea -0x1(%rsi),%eax cmp $0x4,%eax jbe 12a6 <func0+0x156> mov %esi,%edx pxor %xmm2,%xmm2 movdqa 0xe9a(%rip),%xmm3 movdqa 0xea2(%rip),%xmm7 shr $0x2,%edx movdqa %xmm2,%xmm1 movdqa %xmm2,%xmm5 mov %rdi,%rax shl $0x4,%rdx movdqa 0xe98(%rip),%xmm6 add %rdi,%rdx nopl 0x0(%rax,%rax,1) movdqa %xmm3,%xmm0 movdqu (%rax),%xmm8 add $0x10,%rax paddd %xmm7,%xmm3 pand %xmm6,%xmm0 pcmpeqd %xmm5,%xmm0 movdqa %xmm0,%xmm4 pand %xmm8,%xmm0 pandn %xmm8,%xmm4 paddd %xmm0,%xmm2 paddd %xmm4,%xmm1 cmp %rdx,%rax jne 11a0 <func0+0x50> movdqa %xmm2,%xmm0 mov %esi,%ecx psrldq $0x8,%xmm0 and $0xfffffffc,%ecx paddd %xmm0,%xmm2 movdqa %xmm2,%xmm0 psrldq $0x4,%xmm0 paddd %xmm0,%xmm2 movdqa %xmm1,%xmm0 psrldq $0x8,%xmm0 movd %xmm2,%edx paddd %xmm0,%xmm1 movdqa %xmm1,%xmm0 psrldq $0x4,%xmm0 paddd %xmm0,%xmm1 movd %xmm1,%eax test $0x3,%sil je 1279 <func0+0x129> movslq %ecx,%r8 mov (%rdi,%r8,4),%r8d add %r8d,%edx lea 0x1(%rcx),%r8d cmp %esi,%r8d jge 1279 <func0+0x129> movslq %r8d,%r9 and $0x1,%r8d mov (%rdi,%r9,4),%r9d jne 1290 <func0+0x140> add %r9d,%edx lea 0x2(%rcx),%r8d cmp %esi,%r8d jge 1279 <func0+0x129> movslq %r8d,%r8 mov (%rdi,%r8,4),%r8d add %r8d,%edx lea 0x3(%rcx),%r8d cmp %r8d,%esi jle 1279 <func0+0x129> movslq %r8d,%r9 and $0x1,%r8d mov (%rdi,%r9,4),%r9d je 1298 <func0+0x148> add %r9d,%eax add $0x4,%ecx cmp %ecx,%esi jle 1279 <func0+0x129> movslq %ecx,%rcx mov (%rdi,%rcx,4),%ecx add %ecx,%edx mov %eax,0x2d99(%rip) lea 0x2d92(%rip),%rax mov %edx,0x2d90(%rip) retq nopl (%rax) add %r9d,%eax jmp 123e <func0+0xee> nopl (%rax) add %r9d,%edx jmp 126a <func0+0x11a> nopl (%rax) xor %edx,%edx xor %eax,%eax jmp 1279 <func0+0x129> mov (%rdi),%r8d xor %ecx,%ecx xor %edx,%edx xor %eax,%eax jmpq 1222 <func0+0xd2> nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 mov rcx, rdi test esi, esi jle loc_1280 lea eax, [rsi-1] cmp eax, 3 jbe loc_128A mov edx, esi pxor xmm1, xmm1 movdqa xmm3, cs:xmmword_2010 movdqa xmm7, cs:xmmword_2020 shr edx, 2 movdqa xmm2, xmm1 movdqa xmm4, xmm1 mov rax, rdi shl rdx, 4 movdqa xmm6, cs:xmmword_2030 add rdx, rdi xchg ax, ax loc_11A0: movdqa xmm0, xmm3 movdqu xmm5, xmmword ptr [rax] add rax, 10h paddd xmm3, xmm7 pand xmm0, xmm6 pcmpeqd xmm0, xmm4 pcmpeqd xmm0, xmm4 pand xmm5, xmm0 paddd xmm2, xmm5 movdqu xmm5, xmmword ptr [rax-10h] pandn xmm0, xmm5 paddd xmm1, xmm0 cmp rax, rdx jnz short loc_11A0 movdqa xmm0, xmm1 mov eax, esi psrldq xmm0, 8 and eax, 0FFFFFFFCh paddd xmm1, xmm0 movdqa xmm0, xmm1 psrldq xmm0, 4 paddd xmm1, xmm0 movdqa xmm0, xmm2 psrldq xmm0, 8 paddd xmm2, xmm0 movdqa xmm0, xmm2 psrldq xmm0, 4 paddd xmm2, xmm0 test sil, 3 jz short loc_125F mov edx, eax movd xmm0, dword ptr [rcx+rdx*4] lea rdi, ds:0[rdx*4] lea edx, [rax+1] paddd xmm1, xmm0 cmp esi, edx jle short loc_125F lea rdx, [rdi+4] movd xmm0, dword ptr [rcx+rdi+4] loc_1239: lea edi, [rax+2] paddd xmm2, xmm0 cmp esi, edi jle short loc_125F movd xmm0, dword ptr [rcx+rdx+4] add eax, 3 paddd xmm1, xmm0 cmp esi, eax jle short loc_125F movd xmm0, dword ptr [rcx+rdx+8] paddd xmm2, xmm0 loc_125F: movd dword ptr cs:sums_1, xmm2 lea rax, sums_1 movd dword ptr cs:sums_1+4, xmm1 retn loc_1280: pxor xmm1, xmm1 movdqa xmm2, xmm1 jmp short loc_125F loc_128A: movd xmm1, dword ptr [rdi] pxor xmm2, xmm2 cmp esi, 1 jz short loc_125F movd xmm0, dword ptr [rdi+4] pxor xmm2, xmm2 mov edx, 4 xor eax, eax jmp short loc_1239
long long * func0(unsigned int *a1, int a2) { __m128i v3; // xmm1 __m128i si128; // xmm3 __m128i v5; // xmm7 __m128i v6; // xmm2 const __m128i *v7; // rax __m128i v8; // xmm6 __m128i v9; // xmm0 __m128i v10; // xmm5 __m128i v11; // xmm0 unsigned int v12; // eax __m128i v13; // xmm1 __m128i v14; // xmm1 __m128i v15; // xmm2 __m128i v16; // xmm2 __m128i v17; // xmm0 long long v18; // rdi long long v19; // rdx __m128i v20; // xmm0 long long *result; // rax if ( a2 <= 0 ) { v14 = 0LL; v16 = 0LL; goto LABEL_11; } if ( (unsigned int)(a2 - 1) <= 3 ) { v14 = _mm_cvtsi32_si128(*a1); v16 = 0LL; if ( a2 == 1 ) goto LABEL_11; v20 = _mm_cvtsi32_si128(a1[1]); v16 = 0LL; v19 = 4LL; v12 = 0; } else { v3 = 0LL; si128 = _mm_load_si128((const __m128i *)&xmmword_2010); v5 = _mm_load_si128((const __m128i *)&xmmword_2020); v6 = 0LL; v7 = (const __m128i *)a1; v8 = _mm_load_si128((const __m128i *)&xmmword_2030); do { v9 = si128; v10 = _mm_loadu_si128(v7++); si128 = _mm_add_epi32(si128, v5); v11 = _mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_and_si128(v9, v8), (__m128i)0LL), (__m128i)0LL); v6 = _mm_add_epi32(v6, _mm_and_si128(v10, v11)); v3 = _mm_add_epi32(v3, _mm_andnot_si128(v11, _mm_loadu_si128(v7 - 1))); } while ( v7 != (const __m128i *)&a1[4 * ((unsigned int)a2 >> 2)] ); v12 = a2 & 0x7FFFFFFC; v13 = _mm_add_epi32(v3, _mm_srli_si128(v3, 8)); v14 = _mm_add_epi32(v13, _mm_srli_si128(v13, 4)); v15 = _mm_add_epi32(v6, _mm_srli_si128(v6, 8)); v16 = _mm_add_epi32(v15, _mm_srli_si128(v15, 4)); if ( (a2 & 3) == 0 ) goto LABEL_11; v17 = _mm_cvtsi32_si128(a1[v12]); v18 = v12; v14 = _mm_add_epi32(v14, v17); if ( a2 <= (int)(v12 + 1) ) goto LABEL_11; v19 = v18 * 4 + 4; v20 = _mm_cvtsi32_si128(a1[v18 + 1]); } v16 = _mm_add_epi32(v16, v20); if ( a2 > (int)(v12 + 2) ) { v14 = _mm_add_epi32(v14, _mm_cvtsi32_si128(*(unsigned int *)((char *)a1 + v19 + 4))); if ( a2 > (int)(v12 + 3) ) v16 = _mm_add_epi32(v16, _mm_cvtsi32_si128(*(unsigned int *)((char *)a1 + v19 + 8))); } LABEL_11: LODWORD(sums_1) = _mm_cvtsi128_si32(v16); result = &sums_1; HIDWORD(sums_1) = _mm_cvtsi128_si32(v14); return result; }
func0: ENDBR64 MOV RCX,RDI TEST ESI,ESI JLE 0x00101280 LEA EAX,[RSI + -0x1] CMP EAX,0x3 JBE 0x0010128a MOV EDX,ESI PXOR XMM1,XMM1 MOVDQA XMM3,xmmword ptr [0x00102010] MOVDQA XMM7,xmmword ptr [0x00102020] SHR EDX,0x2 MOVDQA XMM2,XMM1 MOVDQA XMM4,XMM1 MOV RAX,RDI SHL RDX,0x4 MOVDQA XMM6,xmmword ptr [0x00102030] ADD RDX,RDI NOP LAB_001011a0: MOVDQA XMM0,XMM3 MOVDQU XMM5,xmmword ptr [RAX] ADD RAX,0x10 PADDD XMM3,XMM7 PAND XMM0,XMM6 PCMPEQD XMM0,XMM4 PCMPEQD XMM0,XMM4 PAND XMM5,XMM0 PADDD XMM2,XMM5 MOVDQU XMM5,xmmword ptr [RAX + -0x10] PANDN XMM0,XMM5 PADDD XMM1,XMM0 CMP RAX,RDX JNZ 0x001011a0 MOVDQA XMM0,XMM1 MOV EAX,ESI PSRLDQ XMM0,0x8 AND EAX,0xfffffffc PADDD XMM1,XMM0 MOVDQA XMM0,XMM1 PSRLDQ XMM0,0x4 PADDD XMM1,XMM0 MOVDQA XMM0,XMM2 PSRLDQ XMM0,0x8 PADDD XMM2,XMM0 MOVDQA XMM0,XMM2 PSRLDQ XMM0,0x4 PADDD XMM2,XMM0 TEST SIL,0x3 JZ 0x0010125f MOV EDX,EAX MOVD XMM0,dword ptr [RCX + RDX*0x4] LEA RDI,[RDX*0x4] LEA EDX,[RAX + 0x1] PADDD XMM1,XMM0 CMP ESI,EDX JLE 0x0010125f LEA RDX,[RDI + 0x4] MOVD XMM0,dword ptr [RCX + RDI*0x1 + 0x4] LAB_00101239: LEA EDI,[RAX + 0x2] PADDD XMM2,XMM0 CMP ESI,EDI JLE 0x0010125f MOVD XMM0,dword ptr [RCX + RDX*0x1 + 0x4] ADD EAX,0x3 PADDD XMM1,XMM0 CMP ESI,EAX JLE 0x0010125f MOVD XMM0,dword ptr [RCX + RDX*0x1 + 0x8] PADDD XMM2,XMM0 LAB_0010125f: MOVD dword ptr [0x00104018],XMM2 LEA RAX,[0x104018] MOVD dword ptr [0x0010401c],XMM1 RET LAB_00101280: PXOR XMM1,XMM1 MOVDQA XMM2,XMM1 JMP 0x0010125f LAB_0010128a: MOVD XMM1,dword ptr [RDI] PXOR XMM2,XMM2 CMP ESI,0x1 JZ 0x0010125f MOVD XMM0,dword ptr [RDI + 0x4] PXOR XMM2,XMM2 MOV EDX,0x4 XOR EAX,EAX JMP 0x00101239
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ int8 * func0(uint *param_1,uint param_2) { uint uVar1; uint *puVar2; uint *puVar3; ulong uVar4; long lVar5; uint uVar6; uint uVar7; uint uVar8; uint uVar9; int iVar10; int iVar11; int iVar12; int iVar13; int iVar14; int iVar15; int iVar16; int iVar17; uint uVar18; uint uVar19; uint uVar20; if ((int)param_2 < 1) { sums_1._0_4_ = 0; sums_1._4_4_ = 0; return &sums_1; } if (param_2 - 1 < 4) { sums_1._4_4_ = *param_1; if (param_2 == 1) { sums_1._0_4_ = 0; return &sums_1; } uVar18 = param_1[1]; sums_1._0_4_ = 0; lVar5 = 4; uVar1 = 0; } else { iVar10 = 0; iVar11 = 0; iVar12 = 0; iVar13 = 0; iVar14 = 0; iVar15 = 0; iVar16 = 0; iVar17 = 0; puVar2 = param_1; uVar18 = _DAT_00102010; uVar1 = _UNK_00102014; uVar19 = _UNK_00102018; uVar20 = _UNK_0010201c; do { puVar3 = puVar2 + 4; uVar6 = -(uint)((uVar18 & _DAT_00102030) != 0); uVar7 = -(uint)((uVar1 & _UNK_00102034) != 0); uVar8 = -(uint)((uVar19 & _UNK_00102038) != 0); uVar9 = -(uint)((uVar20 & _UNK_0010203c) != 0); iVar14 = iVar14 + (*puVar2 & uVar6); iVar15 = iVar15 + (puVar2[1] & uVar7); iVar16 = iVar16 + (puVar2[2] & uVar8); iVar17 = iVar17 + (puVar2[3] & uVar9); iVar10 = iVar10 + (~uVar6 & *puVar2); iVar11 = iVar11 + (~uVar7 & puVar2[1]); iVar12 = iVar12 + (~uVar8 & puVar2[2]); iVar13 = iVar13 + (~uVar9 & puVar2[3]); puVar2 = puVar3; uVar18 = uVar18 + _DAT_00102020; uVar1 = uVar1 + _UNK_00102024; uVar19 = uVar19 + _UNK_00102028; uVar20 = uVar20 + _UNK_0010202c; } while (puVar3 != param_1 + (ulong)(param_2 >> 2) * 4); uVar1 = param_2 & 0xfffffffc; sums_1._4_4_ = iVar10 + iVar12 + iVar11 + iVar13; sums_1._0_4_ = iVar14 + iVar16 + iVar15 + iVar17; if ((param_2 & 3) == 0) { return &sums_1; } uVar4 = (ulong)uVar1; sums_1._4_4_ = sums_1._4_4_ + param_1[uVar4]; if ((int)param_2 <= (int)(uVar1 + 1)) { return &sums_1; } lVar5 = uVar4 * 4 + 4; uVar18 = param_1[uVar4 + 1]; } sums_1._0_4_ = (int)sums_1 + uVar18; if (((int)(uVar1 + 2) < (int)param_2) && (sums_1._4_4_ = sums_1._4_4_ + *(int *)((long)param_1 + lVar5 + 4), (int)(uVar1 + 3) < (int)param_2)) { sums_1._0_4_ = (int)sums_1 + *(int *)((long)param_1 + lVar5 + 8); } return &sums_1; }
5,192
func0
#include <stdio.h> #include <limits.h> #include <assert.h>
int func0(int n) { if (n <= 3) { return n; } int res = n; for (int x = 1; x <= n; x++) { int temp = x * x; if (temp > n) { break; } else { res = (res < (1 + func0(n - temp))) ? res : (1 + func0(n - temp)); } } return res; }
int main() { assert(func0(6) == 3); assert(func0(2) == 2); assert(func0(4) == 1); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %edi,-0x14(%rbp) cmpl $0x3,-0x14(%rbp) jg 1163 <func0+0x1a> mov -0x14(%rbp),%eax jmp 11bf <func0+0x76> mov -0x14(%rbp),%eax mov %eax,-0xc(%rbp) movl $0x1,-0x8(%rbp) jmp 11b1 <func0+0x68> mov -0x8(%rbp),%eax imul %eax,%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x14(%rbp),%eax jg 11bb <func0+0x72> mov -0x14(%rbp),%eax sub -0x4(%rbp),%eax mov %eax,%edi callq 1149 <func0> cmp %eax,-0xc(%rbp) jle 11a7 <func0+0x5e> mov -0x14(%rbp),%eax sub -0x4(%rbp),%eax mov %eax,%edi callq 1149 <func0> add $0x1,%eax jmp 11aa <func0+0x61> mov -0xc(%rbp),%eax mov %eax,-0xc(%rbp) addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x14(%rbp),%eax jle 1172 <func0+0x29> jmp 11bc <func0+0x73> mov -0xc(%rbp),%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_14], edi cmp [rbp+var_14], 3 jg short loc_1163 mov eax, [rbp+var_14] jmp short locret_11BF loc_1163: mov eax, [rbp+var_14] mov [rbp+var_C], eax mov [rbp+var_8], 1 jmp short loc_11B1 loc_1172: mov eax, [rbp+var_8] imul eax, eax mov [rbp+var_4], eax mov eax, [rbp+var_4] cmp eax, [rbp+var_14] jg short loc_11BB mov eax, [rbp+var_14] sub eax, [rbp+var_4] mov edi, eax call func0 cmp [rbp+var_C], eax jle short loc_11A7 mov eax, [rbp+var_14] sub eax, [rbp+var_4] mov edi, eax call func0 add eax, 1 jmp short loc_11AA loc_11A7: mov eax, [rbp+var_C] loc_11AA: mov [rbp+var_C], eax add [rbp+var_8], 1 loc_11B1: mov eax, [rbp+var_8] cmp eax, [rbp+var_14] jle short loc_1172 jmp short loc_11BC loc_11BB: nop loc_11BC: mov eax, [rbp+var_C] locret_11BF: leave retn
long long func0(int a1) { int v2; // eax int v3; // [rsp+14h] [rbp-Ch] int i; // [rsp+18h] [rbp-8h] int v5; // [rsp+1Ch] [rbp-4h] if ( a1 <= 3 ) return (unsigned int)a1; v3 = a1; for ( i = 1; i <= a1; ++i ) { v5 = i * i; if ( i * i > a1 ) break; if ( v3 <= (int)func0((unsigned int)(a1 - v5)) ) v2 = v3; else v2 = func0((unsigned int)(a1 - v5)) + 1; v3 = v2; } return (unsigned int)v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV dword ptr [RBP + -0x14],EDI CMP dword ptr [RBP + -0x14],0x3 JG 0x00101163 MOV EAX,dword ptr [RBP + -0x14] JMP 0x001011bf LAB_00101163: MOV EAX,dword ptr [RBP + -0x14] MOV dword ptr [RBP + -0xc],EAX MOV dword ptr [RBP + -0x8],0x1 JMP 0x001011b1 LAB_00101172: MOV EAX,dword ptr [RBP + -0x8] IMUL EAX,EAX MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x14] JG 0x001011bb MOV EAX,dword ptr [RBP + -0x14] SUB EAX,dword ptr [RBP + -0x4] MOV EDI,EAX CALL 0x00101149 CMP dword ptr [RBP + -0xc],EAX JLE 0x001011a7 MOV EAX,dword ptr [RBP + -0x14] SUB EAX,dword ptr [RBP + -0x4] MOV EDI,EAX CALL 0x00101149 ADD EAX,0x1 JMP 0x001011aa LAB_001011a7: MOV EAX,dword ptr [RBP + -0xc] LAB_001011aa: MOV dword ptr [RBP + -0xc],EAX ADD dword ptr [RBP + -0x8],0x1 LAB_001011b1: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x14] JLE 0x00101172 JMP 0x001011bc LAB_001011bb: NOP LAB_001011bc: MOV EAX,dword ptr [RBP + -0xc] LAB_001011bf: LEAVE RET
int func0(int param_1) { int iVar1; int iVar2; int local_14; int local_10; local_14 = param_1; if (3 < param_1) { for (local_10 = 1; (local_10 <= param_1 && (iVar1 = local_10 * local_10, iVar1 <= param_1)); local_10 = local_10 + 1) { iVar2 = func0(param_1 - iVar1); if (iVar2 < local_14) { local_14 = func0(param_1 - iVar1); local_14 = local_14 + 1; } } } return local_14; }
5,193
func0
#include <stdio.h> #include <limits.h> #include <assert.h>
int func0(int n) { if (n <= 3) { return n; } int res = n; for (int x = 1; x <= n; x++) { int temp = x * x; if (temp > n) { break; } else { res = (res < (1 + func0(n - temp))) ? res : (1 + func0(n - temp)); } } return res; }
int main() { assert(func0(6) == 3); assert(func0(2) == 2); assert(func0(4) == 1); return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx mov %edi,%r12d cmp $0x3,%edi jle 1188 <func0+0x3f> mov %edi,%ebx mov $0x1,%eax mov $0x1,%ebp mov %ebx,%edi sub %eax,%edi callq 1149 <func0> lea 0x1(%rax),%edx cmp %r12d,%eax cmovl %edx,%r12d add $0x1,%ebp cmp %ebp,%ebx jl 1188 <func0+0x3f> mov %ebp,%eax imul %ebp,%eax cmp %eax,%ebx jge 1165 <func0+0x1c> mov %r12d,%eax pop %rbx pop %rbp pop %r12 retq
func0: endbr64 push r12 push rbp push rbx mov r12d, edi cmp edi, 3 jle short loc_118A mov ebx, edi mov eax, 1 mov ebp, 1 jmp short loc_1170 loc_1167: mov eax, ebp imul eax, ebp cmp ebx, eax jl short loc_118A loc_1170: mov edi, ebx sub edi, eax call func0 lea edx, [rax+1] cmp eax, r12d cmovl r12d, edx add ebp, 1 cmp ebx, ebp jge short loc_1167 loc_118A: mov eax, r12d pop rbx pop rbp pop r12 retn
long long func0(int a1) { int v1; // r12d int v2; // eax int v3; // ebp int v4; // eax v1 = a1; if ( a1 > 3 ) { v2 = 1; v3 = 1; do { v4 = func0((unsigned int)(a1 - v2)); if ( v4 < v1 ) v1 = v4 + 1; if ( a1 < ++v3 ) break; v2 = v3 * v3; } while ( a1 >= v3 * v3 ); } return (unsigned int)v1; }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX MOV R12D,EDI CMP EDI,0x3 JLE 0x0010118a MOV EBX,EDI MOV EAX,0x1 MOV EBP,0x1 JMP 0x00101170 LAB_00101167: MOV EAX,EBP IMUL EAX,EBP CMP EBX,EAX JL 0x0010118a LAB_00101170: MOV EDI,EBX SUB EDI,EAX CALL 0x00101149 LEA EDX,[RAX + 0x1] CMP EAX,R12D CMOVL R12D,EDX ADD EBP,0x1 CMP EBX,EBP JGE 0x00101167 LAB_0010118a: MOV EAX,R12D POP RBX POP RBP POP R12 RET
int func0(int param_1) { int iVar1; int iVar2; int iVar3; iVar3 = param_1; if (3 < param_1) { iVar1 = 1; iVar2 = 1; do { iVar1 = func0(param_1 - iVar1); if (iVar1 < iVar3) { iVar3 = iVar1 + 1; } iVar2 = iVar2 + 1; } while ((iVar2 <= param_1) && (iVar1 = iVar2 * iVar2, iVar1 <= param_1)); } return iVar3; }
5,194
func0
#include <stdio.h> #include <limits.h> #include <assert.h>
int func0(int n) { if (n <= 3) { return n; } int res = n; for (int x = 1; x <= n; x++) { int temp = x * x; if (temp > n) { break; } else { res = (res < (1 + func0(n - temp))) ? res : (1 + func0(n - temp)); } } return res; }
int main() { assert(func0(6) == 3); assert(func0(2) == 2); assert(func0(4) == 1); return 0; }
O2
c
func0: endbr64 cmp $0x3,%edi jle 11d0 <func0+0x10> jmp 11e0 <func0.part.0> nopl 0x0(%rax,%rax,1) mov %edi,%eax retq data16 nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0_part_0: push r14 mov eax, 1 push r13 mov r13d, edi push r12 mov r12d, edi push rbp push rbx mov ebx, 1 test edi, edi jle short loc_1215 loc_11DC: mov ebp, r12d sub ebp, eax cmp ebp, 3 jle short loc_1228 mov edi, ebp call func0_part_0 mov r14d, eax cmp eax, r13d jge short loc_1203 mov edi, ebp mov ebp, r14d call func0_part_0 loc_11FF: lea r13d, [rbp+1] loc_1203: add ebx, 1 cmp r12d, ebx jl short loc_1215 mov eax, ebx imul eax, ebx cmp eax, r12d jle short loc_11DC loc_1215: pop rbx mov eax, r13d pop rbp pop r12 pop r13 pop r14 retn loc_1228: cmp ebp, r13d jge short loc_1203 jmp short loc_11FF
long long func0_part_0(int a1) { int v1; // eax int v2; // r13d int v4; // ebx unsigned int v5; // ebp signed int v6; // eax long long v7; // rdi v1 = 1; v2 = a1; v4 = 1; if ( a1 > 0 ) { while ( 1 ) { v5 = a1 - v1; if ( a1 - v1 > 3 ) break; if ( (int)v5 < v2 ) goto LABEL_5; LABEL_6: if ( a1 >= ++v4 ) { v1 = v4 * v4; if ( v4 * v4 <= a1 ) continue; } return (unsigned int)v2; } v6 = func0_part_0(v5); if ( v6 >= v2 ) goto LABEL_6; v7 = v5; v5 = v6; func0_part_0(v7); LABEL_5: v2 = v5 + 1; goto LABEL_6; } return (unsigned int)v2; }
func0.part.0: PUSH R14 MOV EAX,0x1 PUSH R13 MOV R13D,EDI PUSH R12 MOV R12D,EDI PUSH RBP PUSH RBX MOV EBX,0x1 TEST EDI,EDI JLE 0x00101215 LAB_001011dc: MOV EBP,R12D SUB EBP,EAX CMP EBP,0x3 JLE 0x00101228 MOV EDI,EBP CALL 0x001011c0 MOV R14D,EAX CMP EAX,R13D JGE 0x00101203 MOV EDI,EBP MOV EBP,R14D CALL 0x001011c0 LAB_001011ff: LEA R13D,[RBP + 0x1] LAB_00101203: ADD EBX,0x1 CMP R12D,EBX JL 0x00101215 MOV EAX,EBX IMUL EAX,EBX CMP EAX,R12D JLE 0x001011dc LAB_00101215: POP RBX MOV EAX,R13D POP RBP POP R12 POP R13 POP R14 RET LAB_00101228: CMP EBP,R13D JGE 0x00101203 JMP 0x001011ff
int func0_part_0(int param_1) { int iVar1; int iVar2; int iVar3; int iVar4; iVar3 = 1; iVar2 = 1; iVar4 = param_1; if (0 < param_1) { do { iVar3 = param_1 - iVar3; if (iVar3 < 4) { if (iVar3 < iVar4) goto LAB_001011ff; } else { iVar1 = func0_part_0(iVar3); if (iVar1 < iVar4) { func0_part_0(iVar3); iVar3 = iVar1; LAB_001011ff: iVar4 = iVar3 + 1; } } iVar2 = iVar2 + 1; } while ((iVar2 <= param_1) && (iVar3 = iVar2 * iVar2, iVar3 <= param_1)); } return iVar4; }
5,195
func0
#include <stdio.h> #include <limits.h> #include <assert.h>
int func0(int n) { if (n <= 3) { return n; } int res = n; for (int x = 1; x <= n; x++) { int temp = x * x; if (temp > n) { break; } else { res = (res < (1 + func0(n - temp))) ? res : (1 + func0(n - temp)); } } return res; }
int main() { assert(func0(6) == 3); assert(func0(2) == 2); assert(func0(4) == 1); return 0; }
O3
c
func0: endbr64 mov %edi,%r8d cmp $0x3,%edi jle 13e8 <func0+0x1a8> mov %edi,%ecx mov $0x1,%esi mov $0x1,%eax mov %ecx,%edx sub %eax,%edx cmp $0x3,%edx jle 13c8 <func0+0x188> push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %edx,%edi callq 11c0 <func0.part.0> cmp %r8d,%eax jl 12c0 <func0+0x80> add $0x1,%esi cmp %esi,%ecx jl 12ab <func0+0x6b> mov %esi,%eax imul %esi,%eax cmp %eax,%ecx jl 12ab <func0+0x6b> mov %ecx,%edx sub %eax,%edx cmp $0x3,%edx jg 1273 <func0+0x33> cmp %r8d,%edx jge 127f <func0+0x3f> mov %edx,%r8d add $0x1,%esi add $0x1,%r8d cmp %esi,%ecx jge 1286 <func0+0x46> add $0x8,%rsp mov %r8d,%eax pop %rbx pop %rbp pop %r12 pop %r13 retq nopl 0x0(%rax) mov $0x1,%eax mov %edx,%r9d mov %edx,%r8d mov $0x1,%r10d sub %eax,%r9d cmp $0x3,%r9d jle 1307 <func0+0xc7> mov %r9d,%edi callq 11c0 <func0.part.0> cmp %r8d,%eax jl 1318 <func0+0xd8> add $0x1,%r10d cmp %r10d,%edx jl 12a0 <func0+0x60> mov %r10d,%eax imul %r10d,%eax cmp %eax,%edx jl 12a0 <func0+0x60> mov %edx,%r9d sub %eax,%r9d cmp $0x3,%r9d jg 12da <func0+0x9a> cmp %r8d,%r9d jge 12e7 <func0+0xa7> mov %r9d,%r8d add $0x1,%r8d jmp 12e7 <func0+0xa7> nopl (%rax) mov $0x1,%eax mov %r9d,%r11d mov %r9d,%r8d mov $0x1,%ebx sub %eax,%r11d cmp $0x3,%r11d jle 135c <func0+0x11c> mov %r11d,%edi callq 11c0 <func0.part.0> cmp %r8d,%eax jl 1370 <func0+0x130> add $0x1,%ebx cmp %ebx,%r9d jl 130f <func0+0xcf> mov %ebx,%eax imul %ebx,%eax cmp %eax,%r9d jl 130f <func0+0xcf> mov %r9d,%r11d sub %eax,%r11d cmp $0x3,%r11d jg 1331 <func0+0xf1> cmp %r8d,%r11d jge 133e <func0+0xfe> mov %r11d,%r8d add $0x1,%r8d jmp 133e <func0+0xfe> nopw 0x0(%rax,%rax,1) mov $0x1,%eax mov %r11d,%r12d mov %r11d,%r8d mov $0x1,%ebp sub %eax,%r12d cmp $0x3,%r12d jle 13b7 <func0+0x177> mov %r12d,%edi callq 11c0 <func0.part.0> mov %eax,%r13d cmp %r8d,%eax jl 13f0 <func0+0x1b0> add $0x1,%ebp cmp %ebp,%r11d jl 1364 <func0+0x124> mov %ebp,%eax imul %ebp,%eax cmp %eax,%r11d jl 1364 <func0+0x124> mov %r11d,%r12d sub %eax,%r12d cmp $0x3,%r12d jg 1389 <func0+0x149> cmp %r8d,%r12d jge 1399 <func0+0x159> lea 0x1(%r12),%r8d jmp 1399 <func0+0x159> nopl 0x0(%rax,%rax,1) cmp %r8d,%edx jge 13d4 <func0+0x194> mov %edx,%r8d add $0x1,%r8d add $0x1,%esi cmp %esi,%ecx jl 13e8 <func0+0x1a8> mov %esi,%eax imul %esi,%eax cmp %eax,%ecx jge 125c <func0+0x1c> mov %r8d,%eax retq nopl 0x0(%rax) mov %r12d,%edi mov %r13d,%r12d callq 11c0 <func0.part.0> lea 0x1(%r12),%r8d jmp 1399 <func0+0x159> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0_part_0: push r15 push r14 push r13 push r12 push rbp mov ebp, edi push rbx sub rsp, 38h test edi, edi jle loc_1371 mov eax, 1 mov r13d, 1 mov r12d, edi loc_11E6: mov esi, r12d sub esi, eax cmp esi, 3 jle loc_185B mov r14d, 1 mov [rsp+68h+var_5C], r13d mov ebx, esi mov eax, 1 mov [rsp+68h+var_58], ebp mov r13d, r12d mov ebp, r14d mov r14d, esi loc_1213: mov edx, r14d sub edx, eax cmp edx, 3 jle loc_15C0 mov r15d, 1 mov [rsp+68h+var_60], ebx mov eax, 1 mov r8d, edx mov ebx, r15d mov r15d, edx loc_1239: mov r12d, r15d sub r12d, eax cmp r12d, 3 jle loc_1438 mov r9d, r12d mov eax, 1 mov esi, 1 loc_1256: mov edx, r12d sub edx, eax cmp edx, 3 jle loc_13A0 mov r10d, edx mov eax, 1 mov ecx, 1 loc_1271: mov edi, edx sub edi, eax cmp edi, 3 jle loc_1388 mov [rsp+68h+var_3C], r10d mov [rsp+68h+var_40], ecx mov [rsp+68h+var_44], esi mov [rsp+68h+var_48], edx mov [rsp+68h+var_4C], r8d mov [rsp+68h+var_50], r9d mov [rsp+68h+var_54], edi call func0_part_0 mov r10d, [rsp+68h+var_3C] mov edi, [rsp+68h+var_54] mov r9d, [rsp+68h+var_50] mov r8d, [rsp+68h+var_4C] cmp eax, r10d mov edx, [rsp+68h+var_48] mov esi, [rsp+68h+var_44] mov ecx, [rsp+68h+var_40] jl loc_1924 nop word ptr [rax+rax+00h] loc_12D0: add ecx, 1 cmp edx, ecx jl short loc_12E0 mov eax, ecx imul eax, ecx cmp edx, eax jge short loc_1271 loc_12E0: cmp r9d, r10d jg loc_13B8 loc_12E9: add esi, 1 cmp r12d, esi jl short loc_12FF mov eax, esi imul eax, esi cmp r12d, eax jge loc_1256 loc_12FF: cmp r9d, r8d jl loc_1450 loc_1308: add ebx, 1 cmp r15d, ebx jl short loc_131E mov eax, ebx imul eax, ebx cmp r15d, eax jge loc_1239 loc_131E: mov ebx, [rsp+68h+var_60] mov edx, r15d cmp r8d, ebx jl loc_15D2 loc_132E: add ebp, 1 cmp r14d, ebp jl short loc_1344 mov eax, ebp imul eax, ebp cmp r14d, eax jge loc_1213 loc_1344: mov ebp, [rsp+68h+var_58] mov r12d, r13d mov r13d, [rsp+68h+var_5C] cmp ebx, ebp jl loc_1A0F loc_1358: add r13d, 1 cmp r12d, r13d jl short loc_1371 mov eax, r13d imul eax, r13d cmp eax, r12d jle loc_11E6 loc_1371: add rsp, 38h mov eax, ebp pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1388: cmp edi, r10d jge loc_12D0 lea r10d, [rdi+1] jmp loc_12D0 loc_13A0: cmp r9d, edx jle loc_12E9 mov r9d, edx loc_13AC: add r9d, 1 jmp loc_12E9 loc_13B8: mov eax, 1 mov edi, edx mov r9d, edx mov ecx, 1 sub edi, eax cmp edi, 3 jle short loc_1429 loc_13CE: mov [rsp+68h+var_40], ecx mov [rsp+68h+var_44], r9d mov [rsp+68h+var_48], esi mov [rsp+68h+var_4C], edx mov [rsp+68h+var_50], r8d mov [rsp+68h+var_54], edi call func0_part_0 mov r9d, [rsp+68h+var_44] mov edi, [rsp+68h+var_54] mov r8d, [rsp+68h+var_50] mov edx, [rsp+68h+var_4C] cmp r9d, eax mov esi, [rsp+68h+var_48] mov ecx, [rsp+68h+var_40] jg loc_18D2 loc_1410: add ecx, 1 cmp edx, ecx jl short loc_13AC mov eax, ecx imul eax, ecx cmp edx, eax jl short loc_13AC mov edi, edx sub edi, eax cmp edi, 3 jg short loc_13CE loc_1429: cmp r9d, edi jle short loc_1410 lea r9d, [rdi+1] jmp short loc_1410 loc_1438: cmp r12d, r8d jge loc_1308 mov r8d, r12d loc_1444: add r8d, 1 jmp loc_1308 loc_1450: mov r9d, 1 mov ecx, ebp mov r8d, r12d mov eax, 1 mov ebp, r9d mov esi, ebx mov r9d, r13d mov r13d, r12d loc_146B: mov r12d, r13d sub r12d, eax cmp r12d, 3 jle loc_1530 mov edx, r12d mov eax, 1 mov ebx, 1 loc_1488: mov edi, r12d sub edi, eax cmp edi, 3 jle loc_1520 mov [rsp+68h+var_40], r9d mov [rsp+68h+var_44], edx mov [rsp+68h+var_48], r8d mov [rsp+68h+var_4C], esi mov [rsp+68h+var_50], ecx mov [rsp+68h+var_54], edi call func0_part_0 mov edx, [rsp+68h+var_44] mov edi, [rsp+68h+var_54] mov ecx, [rsp+68h+var_50] mov esi, [rsp+68h+var_4C] cmp edx, eax mov r8d, [rsp+68h+var_48] mov r9d, [rsp+68h+var_40] jg loc_19A6 nop word ptr [rax+rax+00000000h] loc_14E0: add ebx, 1 cmp r12d, ebx jl short loc_14F2 mov eax, ebx imul eax, ebx cmp r12d, eax jge short loc_1488 loc_14F2: cmp r8d, edx jg short loc_1540 loc_14F7: add ebp, 1 cmp r13d, ebp jl short loc_150D mov eax, ebp imul eax, ebp cmp r13d, eax jge loc_146B loc_150D: mov ebp, ecx mov ebx, esi mov r13d, r9d jmp loc_1444 loc_1520: cmp edx, edi jle short loc_14E0 lea edx, [rdi+1] jmp short loc_14E0 loc_1530: cmp r8d, r12d jle short loc_14F7 mov r8d, r12d loc_1538: add r8d, 1 jmp short loc_14F7 loc_1540: mov eax, 1 mov edi, r12d mov r8d, r12d mov ebx, 1 sub edi, eax cmp edi, 3 jle short loc_15B4 loc_1557: mov [rsp+68h+var_44], r9d mov [rsp+68h+var_48], r8d mov [rsp+68h+var_4C], esi mov [rsp+68h+var_50], ecx mov [rsp+68h+var_54], edi call func0_part_0 mov r8d, [rsp+68h+var_48] mov edi, [rsp+68h+var_54] mov ecx, [rsp+68h+var_50] mov esi, [rsp+68h+var_4C] cmp r8d, eax mov r9d, [rsp+68h+var_44] jg loc_19DF nop dword ptr [rax+00000000h] loc_1598: add ebx, 1 cmp r12d, ebx jl short loc_1538 mov eax, ebx imul eax, ebx cmp r12d, eax jl short loc_1538 mov edi, r12d sub edi, eax cmp edi, 3 jg short loc_1557 loc_15B4: cmp r8d, edi jle short loc_1598 lea r8d, [rdi+1] jmp short loc_1598 loc_15C0: cmp edx, ebx jge loc_132E mov ebx, edx loc_15CA: add ebx, 1 jmp loc_132E loc_15D2: mov ebx, r15d mov [rsp+68h+var_60], ebp mov r15d, 1 mov r12d, r14d mov [rsp+68h+var_54], r13d mov esi, r15d mov eax, 1 mov r15d, edx mov edx, esi loc_15F4: mov ebp, r15d sub ebp, eax cmp ebp, 3 jle loc_1780 mov r14d, 1 mov r8d, ebx mov r13d, ebp mov eax, 1 mov ebx, r14d loc_1616: mov r14d, ebp sub r14d, eax cmp r14d, 3 jle loc_16F0 mov esi, r14d mov eax, 1 mov ecx, 1 loc_1633: mov edi, r14d sub edi, eax cmp edi, 3 jle loc_16E0 mov [rsp+68h+var_40], edx mov [rsp+68h+var_44], r8d mov [rsp+68h+var_48], ecx mov [rsp+68h+var_4C], esi mov [rsp+68h+var_50], edi call func0_part_0 mov esi, [rsp+68h+var_4C] mov edi, [rsp+68h+var_50] mov ecx, [rsp+68h+var_48] mov r8d, [rsp+68h+var_44] cmp esi, eax mov edx, [rsp+68h+var_40] jg loc_1950 nop dword ptr [rax+rax+00000000h] loc_1680: add ecx, 1 cmp r14d, ecx jl short loc_1692 mov eax, ecx imul eax, ecx cmp r14d, eax jge short loc_1633 loc_1692: cmp esi, r13d jl short loc_1700 loc_1697: add ebx, 1 cmp ebp, ebx jl short loc_16AB mov eax, ebx imul eax, ebx cmp ebp, eax jge loc_1616 loc_16AB: mov ebx, r8d cmp r8d, r13d jg loc_1794 loc_16B7: add edx, 1 cmp r15d, edx jl short loc_16CD mov eax, edx imul eax, edx cmp r15d, eax jge loc_15F4 loc_16CD: mov ebp, [rsp+68h+var_60] mov r13d, [rsp+68h+var_54] mov r14d, r12d jmp loc_15CA loc_16E0: cmp esi, edi jle short loc_1680 lea esi, [rdi+1] jmp short loc_1680 loc_16F0: cmp r14d, r13d jge short loc_1697 mov ecx, r14d loc_16F8: lea r13d, [rcx+1] jmp short loc_1697 loc_1700: mov eax, 1 mov edi, r14d mov ecx, r14d mov r13d, 1 sub edi, eax cmp edi, 3 jle short loc_176F loc_1718: mov [rsp+68h+var_44], edx mov [rsp+68h+var_48], ecx mov [rsp+68h+var_4C], r8d mov [rsp+68h+var_50], edi call func0_part_0 mov ecx, [rsp+68h+var_48] mov edi, [rsp+68h+var_50] mov r8d, [rsp+68h+var_4C] mov edx, [rsp+68h+var_44] cmp ecx, eax jg loc_197F nop word ptr [rax+rax+00000000h] loc_1750: add r13d, 1 cmp r14d, r13d jl short loc_16F8 mov eax, r13d imul eax, r13d cmp r14d, eax jl short loc_16F8 mov edi, r14d sub edi, eax cmp edi, 3 jg short loc_1718 loc_176F: cmp ecx, edi jle short loc_1750 lea ecx, [rdi+1] jmp short loc_1750 loc_1780: cmp ebx, ebp jle loc_16B7 mov r8d, ebp loc_178B: lea ebx, [r8+1] jmp loc_16B7 loc_1794: mov [rsp+68h+var_48], edx mov r13d, 1 mov eax, 1 mov [rsp+68h+var_50], r12d mov r12d, r13d mov [rsp+68h+var_4C], r15d mov r15d, ebp loc_17B3: mov ebx, r15d sub ebx, eax cmp ebx, 3 jle loc_1850 mov ecx, ebx mov eax, 1 mov r14d, 1 loc_17CE: mov r13d, ebx sub r13d, eax cmp r13d, 3 jle short loc_1840 mov edi, r13d mov [rsp+68h+var_44], ecx call func0_part_0 mov ecx, [rsp+68h+var_44] cmp ecx, eax jg loc_190A nop word ptr [rax+rax+00h] loc_17F8: add r14d, 1 cmp ebx, r14d jl short loc_180C mov eax, r14d imul eax, r14d cmp ebx, eax jge short loc_17CE loc_180C: cmp ebp, ecx jg short loc_186B loc_1810: add r12d, 1 cmp r15d, r12d jl short loc_1825 mov eax, r12d imul eax, r12d cmp r15d, eax jge short loc_17B3 loc_1825: mov r12d, [rsp+68h+var_50] mov r15d, [rsp+68h+var_4C] mov r8d, ebp mov edx, [rsp+68h+var_48] jmp loc_178B loc_1840: cmp ecx, r13d jle short loc_17F8 lea ecx, [r13+1] jmp short loc_17F8 loc_1850: cmp ebp, ebx jle short loc_1810 mov ebp, ebx loc_1856: add ebp, 1 jmp short loc_1810 loc_185B: cmp esi, ebp jge loc_1358 mov r15d, esi jmp loc_1B77 loc_186B: mov eax, 1 mov r14d, ebx mov ebp, ebx mov r13d, 1 sub r14d, eax cmp r14d, 3 jle short loc_18B0 loc_1884: mov edi, r14d call func0_part_0 cmp eax, ebp jl short loc_18BB loc_1890: add r13d, 1 cmp ebx, r13d jl short loc_1856 mov eax, r13d imul eax, r13d cmp ebx, eax jl short loc_1856 mov r14d, ebx sub r14d, eax cmp r14d, 3 jg short loc_1884 loc_18B0: cmp r14d, ebp jge short loc_1890 lea ebp, [r14+1] jmp short loc_1890 loc_18BB: mov edi, r14d mov [rsp+68h+var_44], eax call func0_part_0 mov r14d, [rsp+68h+var_44] lea ebp, [r14+1] jmp short loc_1890 loc_18D2: mov [rsp+68h+var_44], ecx mov [rsp+68h+var_48], esi mov [rsp+68h+var_4C], edx mov [rsp+68h+var_50], r8d mov [rsp+68h+var_54], eax call func0_part_0 mov edi, [rsp+68h+var_54] mov ecx, [rsp+68h+var_44] mov esi, [rsp+68h+var_48] mov edx, [rsp+68h+var_4C] mov r8d, [rsp+68h+var_50] lea r9d, [rdi+1] jmp loc_1410 loc_190A: mov edi, r13d mov [rsp+68h+var_44], eax call func0_part_0 mov r13d, [rsp+68h+var_44] lea ecx, [r13+1] jmp loc_17F8 loc_1924: mov [rsp+68h+var_54], eax call func0_part_0 mov edi, [rsp+68h+var_54] mov ecx, [rsp+68h+var_40] mov esi, [rsp+68h+var_44] mov edx, [rsp+68h+var_48] mov r8d, [rsp+68h+var_4C] mov r9d, [rsp+68h+var_50] lea r10d, [rdi+1] jmp loc_12D0 loc_1950: mov [rsp+68h+var_44], edx mov [rsp+68h+var_48], r8d mov [rsp+68h+var_4C], ecx mov [rsp+68h+var_50], eax call func0_part_0 mov edi, [rsp+68h+var_50] mov edx, [rsp+68h+var_44] mov r8d, [rsp+68h+var_48] mov ecx, [rsp+68h+var_4C] lea esi, [rdi+1] jmp loc_1680 loc_197F: mov [rsp+68h+var_48], edx mov [rsp+68h+var_4C], r8d mov [rsp+68h+var_50], eax call func0_part_0 mov edi, [rsp+68h+var_50] mov edx, [rsp+68h+var_48] mov r8d, [rsp+68h+var_4C] lea ecx, [rdi+1] jmp loc_1750 loc_19A6: mov [rsp+68h+var_44], r9d mov [rsp+68h+var_48], r8d mov [rsp+68h+var_4C], esi mov [rsp+68h+var_50], ecx mov [rsp+68h+var_54], eax call func0_part_0 mov edi, [rsp+68h+var_54] mov r9d, [rsp+68h+var_44] mov r8d, [rsp+68h+var_48] mov esi, [rsp+68h+var_4C] mov ecx, [rsp+68h+var_50] lea edx, [rdi+1] jmp loc_14E0 loc_19DF: mov [rsp+68h+var_48], r9d mov [rsp+68h+var_4C], esi mov [rsp+68h+var_50], ecx mov [rsp+68h+var_54], eax call func0_part_0 mov edi, [rsp+68h+var_54] mov r9d, [rsp+68h+var_48] mov esi, [rsp+68h+var_4C] mov ecx, [rsp+68h+var_50] lea r8d, [rdi+1] jmp loc_1598 loc_1A0F: mov [rsp+68h+var_44], r13d mov ebx, 1 mov edx, 1 mov [rsp+68h+var_40], r12d mov ebp, ebx mov r12d, r14d mov ebx, r14d loc_1A2B: mov r13d, ebx sub r13d, edx cmp r13d, 3 jle loc_1D3C mov [rsp+68h+var_58], r12d mov edx, 1 mov r14d, 1 mov [rsp+68h+var_60], ebx mov ebx, r13d mov [rsp+68h+var_5C], ebp mov ebp, r13d loc_1A59: mov r13d, ebp sub r13d, edx cmp r13d, 3 jle loc_1C10 mov r15d, 1 mov esi, r14d mov r12d, r13d mov r14d, ebp mov eax, 1 mov ebp, ebx mov ebx, r15d loc_1A82: mov r15d, r13d sub r15d, eax cmp r15d, 3 jle loc_1B90 mov ecx, r15d mov eax, 1 mov edx, 1 loc_1A9F: mov edi, r15d sub edi, eax cmp edi, 3 jle loc_1B80 mov [rsp+68h+var_48], edx mov [rsp+68h+var_4C], esi mov [rsp+68h+var_50], ecx mov [rsp+68h+var_54], edi call func0_part_0 mov ecx, [rsp+68h+var_50] mov edi, [rsp+68h+var_54] mov esi, [rsp+68h+var_4C] mov edx, [rsp+68h+var_48] cmp ecx, eax jg loc_1D7E nop word ptr [rax+rax+00h] loc_1AE0: add edx, 1 cmp r15d, edx jl short loc_1AF2 mov eax, edx imul eax, edx cmp r15d, eax jge short loc_1A9F loc_1AF2: cmp ecx, r12d jl loc_1BA8 loc_1AFB: add ebx, 1 cmp r13d, ebx jl short loc_1B11 mov eax, ebx imul eax, ebx cmp r13d, eax jge loc_1A82 loc_1B11: mov ebx, ebp mov ebp, r14d mov r14d, esi cmp ebx, r12d jg loc_1C24 loc_1B22: add r14d, 1 cmp ebp, r14d jl short loc_1B3A mov edx, r14d imul edx, r14d cmp ebp, edx jge loc_1A59 loc_1B3A: mov r12d, [rsp+68h+var_58] mov r15d, ebx mov r13d, ebp mov ebx, [rsp+68h+var_60] mov ebp, [rsp+68h+var_5C] cmp r12d, r15d jg loc_1DC0 loc_1B56: add ebp, 1 cmp ebx, ebp jl short loc_1B6A mov edx, ebp imul edx, ebp cmp ebx, edx jge loc_1A2B loc_1B6A: mov r15d, r12d mov r13d, [rsp+68h+var_44] mov r12d, [rsp+68h+var_40] loc_1B77: lea ebp, [r15+1] jmp loc_1358 loc_1B80: cmp ecx, edi jle loc_1AE0 lea ecx, [rdi+1] jmp loc_1AE0 loc_1B90: cmp r15d, r12d jge loc_1AFB mov edx, r15d loc_1B9C: lea r12d, [rdx+1] jmp loc_1AFB loc_1BA8: mov eax, 1 mov edi, r15d mov edx, r15d mov r12d, 1 sub edi, eax cmp edi, 3 jle short loc_1C07 loc_1BC0: mov [rsp+68h+var_4C], esi mov [rsp+68h+var_50], edx mov [rsp+68h+var_54], edi call func0_part_0 mov edx, [rsp+68h+var_50] mov edi, [rsp+68h+var_54] mov esi, [rsp+68h+var_4C] cmp edx, eax jg loc_1DA3 nop dword ptr [rax] loc_1BE8: add r12d, 1 cmp r15d, r12d jl short loc_1B9C mov eax, r12d imul eax, r12d cmp r15d, eax jl short loc_1B9C mov edi, r15d sub edi, eax cmp edi, 3 jg short loc_1BC0 loc_1C07: cmp edx, edi jle short loc_1BE8 lea edx, [rdi+1] jmp short loc_1BE8 loc_1C10: cmp ebx, r13d jle loc_1B22 mov ebx, r13d loc_1C1C: add ebx, 1 jmp loc_1B22 loc_1C24: mov [rsp+68h+var_50], esi mov r12d, 1 mov eax, 1 mov r14d, r13d mov [rsp+68h+var_54], ebp mov ebx, r12d mov ebp, r13d loc_1C40: mov r15d, r14d sub r15d, eax cmp r15d, 3 jle loc_1CD8 mov edx, r15d mov eax, 1 mov r12d, 1 loc_1C5E: mov r13d, r15d sub r13d, eax cmp r13d, 3 jle short loc_1CC8 mov edi, r13d mov [rsp+68h+var_4C], edx call func0_part_0 mov edx, [rsp+68h+var_4C] cmp edx, eax jg loc_1D4D nop word ptr [rax+rax+00h] loc_1C88: add r12d, 1 cmp r15d, r12d jl short loc_1C9D mov eax, r12d imul eax, r12d cmp r15d, eax jge short loc_1C5E loc_1C9D: cmp ebp, edx jg short loc_1CE5 loc_1CA1: add ebx, 1 cmp r14d, ebx jl short loc_1CB3 mov eax, ebx imul eax, ebx cmp r14d, eax jge short loc_1C40 loc_1CB3: mov ebx, ebp mov r14d, [rsp+68h+var_50] mov ebp, [rsp+68h+var_54] jmp loc_1C1C loc_1CC8: cmp edx, r13d jle short loc_1C88 lea edx, [r13+1] jmp short loc_1C88 loc_1CD8: cmp ebp, r15d jle short loc_1CA1 mov ebp, r15d loc_1CE0: add ebp, 1 jmp short loc_1CA1 loc_1CE5: mov eax, 1 mov r13d, r15d mov ebp, r15d mov r12d, 1 sub r13d, eax cmp r13d, 3 jle short loc_1D31 loc_1CFF: mov edi, r13d call func0_part_0 cmp eax, ebp jl short loc_1D67 nop dword ptr [rax+rax+00h] loc_1D10: add r12d, 1 cmp r15d, r12d jl short loc_1CE0 mov eax, r12d imul eax, r12d cmp r15d, eax jl short loc_1CE0 mov r13d, r15d sub r13d, eax cmp r13d, 3 jg short loc_1CFF loc_1D31: cmp r13d, ebp jge short loc_1D10 lea ebp, [r13+1] jmp short loc_1D10 loc_1D3C: cmp r12d, r13d jle loc_1B56 mov r12d, r13d jmp loc_1E58 loc_1D4D: mov edi, r13d mov [rsp+68h+var_4C], eax call func0_part_0 mov r13d, [rsp+68h+var_4C] lea edx, [r13+1] jmp loc_1C88 loc_1D67: mov edi, r13d mov [rsp+68h+var_4C], eax call func0_part_0 mov r13d, [rsp+68h+var_4C] lea ebp, [r13+1] jmp short loc_1D10 loc_1D7E: mov [rsp+68h+var_4C], edx mov [rsp+68h+var_50], esi mov [rsp+68h+var_54], eax call func0_part_0 mov edi, [rsp+68h+var_54] mov edx, [rsp+68h+var_4C] mov esi, [rsp+68h+var_50] lea ecx, [rdi+1] jmp loc_1AE0 loc_1DA3: mov [rsp+68h+var_50], esi mov [rsp+68h+var_54], eax call func0_part_0 mov edi, [rsp+68h+var_54] mov esi, [rsp+68h+var_50] lea edx, [rdi+1] jmp loc_1BE8 loc_1DC0: mov edx, 1 mov [rsp+68h+var_5C], ebx mov eax, 1 mov ebx, r13d mov [rsp+68h+var_58], ebp mov r12d, edx mov ebp, r13d loc_1DDB: mov r15d, ebx sub r15d, eax cmp r15d, 3 jle loc_1E8A mov edx, r15d mov eax, 1 mov r14d, 1 loc_1DF9: mov r13d, r15d sub r13d, eax cmp r13d, 3 jle short loc_1E68 mov edi, r13d mov [rsp+68h+var_60], edx call func0_part_0 mov edx, [rsp+68h+var_60] cmp eax, edx jl short loc_1E73 nop dword ptr [rax+00000000h] loc_1E20: add r14d, 1 cmp r15d, r14d jl short loc_1E35 mov eax, r14d imul eax, r14d cmp r15d, eax jge short loc_1DF9 loc_1E35: cmp edx, ebp jl short loc_1E95 loc_1E39: add r12d, 1 cmp ebx, r12d jl short loc_1E4D mov eax, r12d imul eax, r12d cmp ebx, eax jge short loc_1DDB loc_1E4D: mov r12d, ebp mov ebx, [rsp+68h+var_5C] mov ebp, [rsp+68h+var_58] loc_1E58: add r12d, 1 jmp loc_1B56 loc_1E68: cmp r13d, edx jge short loc_1E20 lea edx, [r13+1] jmp short loc_1E20 loc_1E73: mov edi, r13d mov [rsp+68h+var_60], eax call func0_part_0 mov r13d, [rsp+68h+var_60] lea edx, [r13+1] jmp short loc_1E20 loc_1E8A: cmp r15d, ebp jge short loc_1E39 lea ebp, [r15+1] jmp short loc_1E39 loc_1E95: mov edi, r15d call func0_part_0 mov r15d, eax lea ebp, [r15+1] jmp short loc_1E39
long long func0_part_0(int a1, long long a2, long long a3, long long a4, long long a5, long long a6) { unsigned int v6; // ebp int v7; // eax int v8; // r13d int v9; // r12d long long v10; // rsi int v11; // ebx int v12; // eax unsigned int v13; // r13d unsigned int v14; // ebp int v15; // r14d int v16; // edx int v17; // eax unsigned int v18; // ebx int v19; // r15d int v20; // r12d int v21; // eax long long v22; // rdx int v23; // r10d int v24; // eax int v25; // edi int v26; // eax long long v27; // rdi long long v29; // r9 long long v30; // rdi int v31; // eax long long v32; // r8 int v33; // eax int v34; // ebp int v35; // r13d int v36; // r12d long long v37; // rdx int v38; // eax int v39; // ebx long long v40; // rdi int v41; // eax long long v42; // rdi long long v43; // r8 int v44; // ebx long long v45; // rdi int v46; // eax int v47; // ebx int v48; // r12d int v49; // eax long long v50; // rdx int v51; // ebp int v52; // r13d int v53; // eax int v54; // ebx int v55; // r14d int v56; // eax long long v57; // rdi int v58; // eax long long v59; // rdi int v60; // r13d long long v61; // rdi int v62; // eax int v63; // eax int v64; // r12d int v65; // r15d int v66; // ebx int v67; // eax int v68; // r14d unsigned int v69; // r13d int v70; // eax int v71; // ebp int v72; // r15d int v73; // r13d unsigned int v74; // r14d int v75; // eax int v76; // eax int v77; // edx int v78; // ebp int v79; // r12d int v80; // ebx int v81; // r13d int v82; // edx unsigned int v83; // r14d int v84; // ebx int v85; // ebp int v86; // r13d int v87; // r12d int v88; // r14d int v89; // eax int v90; // ebp int v91; // ebx int v92; // r15d int v93; // eax long long v94; // rdx long long v95; // rdi int v96; // eax long long v97; // rdi int v98; // r15d int v99; // r13d long long v100; // rdx int v101; // r12d long long v102; // rdi int v103; // eax int v104; // ebx int v105; // eax int v106; // r14d int v107; // ebx int v108; // ebp int v109; // r15d long long v110; // rdx int v111; // eax int v112; // r12d unsigned int v113; // r13d int v114; // eax int v115; // ebp int v116; // r12d unsigned int v117; // r13d int v118; // eax int v119; // eax int v120; // r12d int v121; // eax int v122; // ebx int v123; // r12d int v124; // ebp int v125; // r15d long long v126; // rdx int v127; // eax int v128; // r14d unsigned int v129; // r13d int v130; // eax int v131; // [rsp+8h] [rbp-60h] unsigned int v132; // [rsp+8h] [rbp-60h] int v133; // [rsp+8h] [rbp-60h] unsigned int v134; // [rsp+8h] [rbp-60h] int v135; // [rsp+8h] [rbp-60h] int v136; // [rsp+Ch] [rbp-5Ch] int v137; // [rsp+Ch] [rbp-5Ch] int v138; // [rsp+Ch] [rbp-5Ch] signed int v139; // [rsp+10h] [rbp-58h] int v140; // [rsp+10h] [rbp-58h] int v141; // [rsp+10h] [rbp-58h] unsigned int v142; // [rsp+14h] [rbp-54h] unsigned int v143; // [rsp+14h] [rbp-54h] unsigned int v144; // [rsp+14h] [rbp-54h] int v145; // [rsp+14h] [rbp-54h] int v146; // [rsp+14h] [rbp-54h] int v147; // [rsp+14h] [rbp-54h] int v148; // [rsp+14h] [rbp-54h] unsigned int v149; // [rsp+14h] [rbp-54h] int v150; // [rsp+14h] [rbp-54h] int v151; // [rsp+14h] [rbp-54h] int v152; // [rsp+14h] [rbp-54h] unsigned int v153; // [rsp+18h] [rbp-50h] unsigned int v154; // [rsp+18h] [rbp-50h] unsigned int v155; // [rsp+18h] [rbp-50h] unsigned int v156; // [rsp+18h] [rbp-50h] unsigned int v157; // [rsp+18h] [rbp-50h] int v158; // [rsp+18h] [rbp-50h] int v159; // [rsp+18h] [rbp-50h] int v160; // [rsp+18h] [rbp-50h] unsigned int v161; // [rsp+18h] [rbp-50h] unsigned int v162; // [rsp+18h] [rbp-50h] unsigned int v163; // [rsp+1Ch] [rbp-4Ch] unsigned int v164; // [rsp+1Ch] [rbp-4Ch] unsigned int v165; // [rsp+1Ch] [rbp-4Ch] int v166; // [rsp+1Ch] [rbp-4Ch] unsigned int v167; // [rsp+1Ch] [rbp-4Ch] int v168; // [rsp+1Ch] [rbp-4Ch] int v169; // [rsp+1Ch] [rbp-4Ch] unsigned int v170; // [rsp+20h] [rbp-48h] unsigned int v171; // [rsp+20h] [rbp-48h] unsigned int v172; // [rsp+20h] [rbp-48h] unsigned int v173; // [rsp+20h] [rbp-48h] unsigned int v174; // [rsp+20h] [rbp-48h] int v175; // [rsp+20h] [rbp-48h] unsigned int v176; // [rsp+20h] [rbp-48h] unsigned int v177; // [rsp+24h] [rbp-44h] unsigned int v178; // [rsp+24h] [rbp-44h] unsigned int v179; // [rsp+24h] [rbp-44h] unsigned int v180; // [rsp+24h] [rbp-44h] unsigned int v181; // [rsp+24h] [rbp-44h] unsigned int v182; // [rsp+24h] [rbp-44h] int v183; // [rsp+24h] [rbp-44h] int v184; // [rsp+24h] [rbp-44h] int v185; // [rsp+24h] [rbp-44h] unsigned int v186; // [rsp+28h] [rbp-40h] unsigned int v187; // [rsp+28h] [rbp-40h] unsigned int v188; // [rsp+28h] [rbp-40h] unsigned int v189; // [rsp+28h] [rbp-40h] int v190; // [rsp+28h] [rbp-40h] int v191; // [rsp+2Ch] [rbp-3Ch] v6 = a1; if ( a1 > 0 ) { v7 = 1; v8 = 1; v9 = a1; while ( 1 ) { v10 = (unsigned int)(v9 - v7); if ( (int)v10 > 3 ) break; if ( (int)v10 < (int)v6 ) { v72 = v9 - v7; goto LABEL_155; } LABEL_26: if ( v9 >= ++v8 ) { v7 = v8 * v8; if ( v8 * v8 <= v9 ) continue; } return v6; } v136 = v8; v11 = v9 - v7; v12 = 1; v139 = v6; v13 = v9; v14 = 1; v15 = v10; do { v16 = v15 - v12; if ( v15 - v12 > 3 ) { v131 = v11; v17 = 1; a5 = (unsigned int)v16; v18 = 1; v19 = v16; while ( 1 ) { v20 = v19 - v17; if ( v19 - v17 > 3 ) break; if ( v20 < (int)a5 ) { LODWORD(v32) = v19 - v17; goto LABEL_44; } LABEL_20: if ( v19 >= (int)++v18 ) { v17 = v18 * v18; if ( v19 >= (int)(v18 * v18) ) continue; } v11 = v131; if ( (int)a5 >= v131 ) goto LABEL_23; v47 = v19; v132 = v14; v48 = v15; v144 = v13; v10 = 1LL; v49 = 1; v50 = 1LL; while ( 1 ) { v51 = v19 - v49; if ( v19 - v49 > 3 ) break; if ( v47 > v51 ) { a5 = (unsigned int)v51; goto LABEL_105; } LABEL_87: v50 = (unsigned int)(v50 + 1); if ( v19 >= (int)v50 ) { v49 = v50 * v50; if ( v19 >= (int)v50 * (int)v50 ) continue; } v14 = v132; v13 = v144; v15 = v48; LABEL_72: v11 = v47 + 1; goto LABEL_23; } a5 = (unsigned int)v47; v52 = v19 - v49; v53 = 1; v54 = 1; while ( 2 ) { v55 = v51 - v53; if ( v51 - v53 <= 3 ) { if ( v55 >= v52 ) goto LABEL_84; a4 = (unsigned int)v55; } else { v10 = (unsigned int)v55; v56 = 1; a4 = 1LL; do { v57 = (unsigned int)(v55 - v56); if ( (int)v57 <= 3 ) { if ( (int)v10 > (int)v57 ) v10 = (unsigned int)(v57 + 1); } else { v189 = v50; v180 = a5; v173 = a4; v157 = v55 - v56; v58 = func0_part_0(v57, v10, v50, a4, a5, a6); v10 = (unsigned int)v10; v59 = v157; LODWORD(a4) = v173; a5 = v180; v50 = v189; if ( (int)v10 > v58 ) { v159 = v58; func0_part_0(v59, (unsigned int)v10, v189, v173, v180, a6); v50 = v189; a5 = v180; LODWORD(a4) = v173; v10 = (unsigned int)(v159 + 1); } } a4 = (unsigned int)(a4 + 1); if ( v55 < (int)a4 ) break; v56 = a4 * a4; } while ( v55 >= (int)a4 * (int)a4 ); if ( (int)v10 >= v52 ) { LABEL_84: if ( v51 >= ++v54 ) { v53 = v54 * v54; if ( v51 >= v54 * v54 ) continue; } v47 = a5; if ( (int)a5 <= v52 ) goto LABEL_87; v175 = v50; v63 = 1; v158 = v48; v64 = 1; v166 = v19; v65 = v51; while ( 2 ) { v66 = v65 - v63; if ( v65 - v63 <= 3 ) { if ( v51 <= v66 ) goto LABEL_115; v71 = v65 - v63; } else { a4 = (unsigned int)v66; v67 = 1; v68 = 1; do { v69 = v66 - v67; if ( v66 - v67 <= 3 ) { if ( (int)a4 > (int)v69 ) a4 = v69 + 1; } else { v182 = a4; v70 = func0_part_0(v69, v10, v50, a4, a5, a6); a4 = v182; if ( (int)v182 > v70 ) { v184 = v70; func0_part_0(v69, v10, v50, a4, a5, a6); a4 = (unsigned int)(v184 + 1); } } if ( v66 < ++v68 ) break; v67 = v68 * v68; } while ( v66 >= v68 * v68 ); if ( v51 <= (int)a4 ) { LABEL_115: if ( v65 < ++v64 || (v63 = v64 * v64, v65 < v64 * v64) ) { v48 = v158; v19 = v166; a5 = (unsigned int)v51; LODWORD(v50) = v175; LABEL_105: v47 = a5 + 1; goto LABEL_87; } continue; } v71 = v66; v73 = 1; v74 = v66 - 1; if ( v66 - 1 > 3 ) { LABEL_126: v75 = func0_part_0(v74, v10, v50, a4, a5, a6); if ( v75 < v71 ) { v183 = v75; func0_part_0(v74, v10, v50, a4, a5, a6); v71 = v183 + 1; } goto LABEL_128; } while ( 1 ) { if ( (int)v74 < v71 ) v71 = v74 + 1; LABEL_128: if ( v66 < ++v73 ) break; v76 = v73 * v73; if ( v66 < v73 * v73 ) break; v74 = v66 - v76; if ( v66 - v76 > 3 ) goto LABEL_126; } } break; } v51 = v71 + 1; goto LABEL_115; } a4 = (unsigned int)v55; v60 = 1; v61 = (unsigned int)(v55 - 1); if ( (int)v61 > 3 ) { LABEL_96: v181 = v50; v174 = a4; v165 = a5; v62 = func0_part_0(v61, v10, v50, a4, a5, a6); a4 = v174; a5 = v165; v50 = v181; if ( (int)v174 > v62 ) { v160 = v62; func0_part_0((unsigned int)v61, v10, v181, v174, v165, a6); v50 = v181; a5 = v165; a4 = (unsigned int)(v160 + 1); } goto LABEL_98; } while ( 1 ) { if ( (int)a4 > (int)v61 ) a4 = (unsigned int)(v61 + 1); LABEL_98: if ( v55 < ++v60 || v55 < v60 * v60 ) break; v61 = (unsigned int)(v55 - v60 * v60); if ( (int)v61 > 3 ) goto LABEL_96; } } break; } v52 = a4 + 1; goto LABEL_84; } a6 = (unsigned int)v20; v21 = 1; v10 = 1LL; while ( 1 ) { v22 = (unsigned int)(v20 - v21); if ( (int)v22 <= 3 ) { if ( (int)a6 <= (int)v22 ) goto LABEL_17; LODWORD(v29) = v20 - v21; } else { v23 = v20 - v21; v24 = 1; LODWORD(a4) = 1; do { v25 = v22 - v24; if ( (int)v22 - v24 <= 3 ) { if ( v25 < v23 ) v23 = v25 + 1; } else { v191 = v23; v186 = a4; v170 = v22; v163 = a5; v153 = a6; v142 = v22 - v24; v26 = ((long long (*)(void))func0_part_0)(); v23 = v191; v27 = v142; a6 = v153; a5 = v163; v22 = v170; v10 = (unsigned int)v10; LODWORD(a4) = v186; if ( v26 < v191 ) { v146 = v26; func0_part_0(v27, (unsigned int)v10, v170, v186, v163, v153); LODWORD(a4) = v186; v10 = (unsigned int)v10; v22 = v170; a5 = v163; a6 = v153; v23 = v146 + 1; } } a4 = (unsigned int)(a4 + 1); if ( (int)v22 < (int)a4 ) break; v24 = a4 * a4; } while ( (int)v22 >= (int)a4 * (int)a4 ); if ( (int)a6 <= v23 ) goto LABEL_17; v29 = (unsigned int)v22; a4 = 1LL; v30 = (unsigned int)(v22 - 1); if ( (int)v30 > 3 ) { LABEL_35: v187 = a4; v177 = v29; v164 = v22; v154 = a5; v31 = func0_part_0(v30, v10, v22, a4, a5, v29); v29 = v177; a5 = v154; v22 = v164; v10 = (unsigned int)v10; LODWORD(a4) = v187; if ( (int)v177 > v31 ) { v145 = v31; func0_part_0((unsigned int)v30, (unsigned int)v10, v164, v187, v154, v177); LODWORD(a4) = v187; v10 = (unsigned int)v10; v22 = v164; a5 = v154; v29 = (unsigned int)(v145 + 1); } goto LABEL_37; } while ( 1 ) { if ( (int)v29 > (int)v30 ) v29 = (unsigned int)(v30 + 1); LABEL_37: a4 = (unsigned int)(a4 + 1); if ( (int)v22 < (int)a4 || (int)v22 < (int)a4 * (int)a4 ) break; v30 = (unsigned int)(v22 - a4 * a4); if ( (int)v30 > 3 ) goto LABEL_35; } } a6 = (unsigned int)(v29 + 1); LABEL_17: v10 = (unsigned int)(v10 + 1); if ( v20 >= (int)v10 ) { v21 = v10 * v10; if ( v20 >= (int)v10 * (int)v10 ) continue; } if ( (int)a6 >= (int)a5 ) goto LABEL_20; a4 = v14; v32 = (unsigned int)v20; v33 = 1; v34 = 1; v10 = v18; a6 = v13; v35 = v20; while ( 1 ) { v36 = v35 - v33; if ( v35 - v33 <= 3 ) { if ( (int)v32 <= v36 ) goto LABEL_54; LODWORD(v43) = v35 - v33; } else { v37 = (unsigned int)v36; v38 = 1; v39 = 1; do { v40 = (unsigned int)(v36 - v38); if ( (int)v40 <= 3 ) { if ( (int)v37 > (int)v40 ) v37 = (unsigned int)(v40 + 1); } else { v188 = a6; v178 = v37; v171 = v32; v155 = a4; v143 = v36 - v38; v41 = func0_part_0(v40, v10, v37, a4, v32, a6); v37 = v178; v42 = v143; a4 = v155; v10 = (unsigned int)v10; v32 = v171; a6 = v188; if ( (int)v178 > v41 ) { v147 = v41; func0_part_0(v42, (unsigned int)v10, v178, v155, v171, v188); a6 = v188; v32 = v171; v10 = (unsigned int)v10; a4 = v155; v37 = (unsigned int)(v147 + 1); } } if ( v36 < ++v39 ) break; v38 = v39 * v39; } while ( v36 >= v39 * v39 ); if ( (int)v32 <= (int)v37 ) goto LABEL_54; v43 = (unsigned int)v36; v44 = 1; v45 = (unsigned int)(v36 - 1); if ( (int)v45 > 3 ) { LABEL_63: v179 = a6; v172 = v43; v156 = a4; v46 = func0_part_0(v45, v10, v37, a4, v43, a6); v43 = v172; a4 = v156; v10 = (unsigned int)v10; a6 = v179; if ( (int)v172 > v46 ) { v148 = v46; func0_part_0((unsigned int)v45, (unsigned int)v10, v37, v156, v172, v179); a6 = v179; v10 = (unsigned int)v10; a4 = v156; v43 = (unsigned int)(v148 + 1); } goto LABEL_65; } while ( 1 ) { if ( (int)v43 > (int)v45 ) v43 = (unsigned int)(v45 + 1); LABEL_65: if ( v36 < ++v44 || v36 < v44 * v44 ) break; v45 = (unsigned int)(v36 - v44 * v44); if ( (int)v45 > 3 ) goto LABEL_63; } } v32 = (unsigned int)(v43 + 1); LABEL_54: if ( v35 >= ++v34 ) { v33 = v34 * v34; if ( v35 >= v34 * v34 ) continue; } v14 = a4; v18 = v10; v13 = a6; LABEL_44: a5 = (unsigned int)(v32 + 1); goto LABEL_20; } } } if ( v16 < v11 ) { v47 = v15 - v12; goto LABEL_72; } LABEL_23: if ( v15 < (int)++v14 ) break; v12 = v14 * v14; } while ( v15 >= (int)(v14 * v14) ); v6 = v139; v9 = v13; v8 = v136; if ( v11 >= v139 ) goto LABEL_26; v185 = v136; v77 = 1; v190 = v9; v78 = 1; v79 = v15; v80 = v15; LABEL_134: v81 = v80 - v77; if ( v80 - v77 <= 3 ) { if ( v79 <= v81 ) goto LABEL_152; v120 = v80 - v77; LABEL_212: v79 = v120 + 1; goto LABEL_152; } v140 = v79; v82 = 1; v83 = 1; v133 = v80; v84 = v81; v137 = v78; v85 = v81; while ( 1 ) { v86 = v85 - v82; if ( v85 - v82 > 3 ) break; if ( v84 > v86 ) { v104 = v85 - v82; goto LABEL_171; } LABEL_149: if ( v85 >= (int)++v83 ) { v82 = v83 * v83; if ( v85 >= (int)(v83 * v83) ) continue; } v79 = v140; v98 = v84; v99 = v85; v80 = v133; v78 = v137; if ( v140 > v98 ) { v138 = v133; v121 = 1; v122 = v99; v141 = v78; v123 = 1; v124 = v99; do { v125 = v122 - v121; if ( v122 - v121 <= 3 ) { if ( v125 < v124 ) v124 = v125 + 1; } else { v126 = (unsigned int)v125; v127 = 1; v128 = 1; do { v129 = v125 - v127; if ( v125 - v127 <= 3 ) { if ( (int)v129 < (int)v126 ) v126 = v129 + 1; } else { v134 = v126; v130 = func0_part_0(v129, v10, v126, a4, a5, a6); v126 = v134; if ( v130 < (int)v134 ) { v135 = v130; func0_part_0(v129, v10, v126, a4, a5, a6); v126 = (unsigned int)(v135 + 1); } } if ( v125 < ++v128 ) break; v127 = v128 * v128; } while ( v125 >= v128 * v128 ); if ( (int)v126 < v124 ) v124 = func0_part_0((unsigned int)v125, v10, v126, a4, a5, a6) + 1; } if ( v122 < ++v123 ) break; v121 = v123 * v123; } while ( v122 >= v123 * v123 ); v120 = v124; v80 = v138; v78 = v141; goto LABEL_212; } LABEL_152: if ( v80 < ++v78 || (v77 = v78 * v78, v80 < v78 * v78) ) { v72 = v79; v8 = v185; v9 = v190; LABEL_155: v6 = v72 + 1; goto LABEL_26; } goto LABEL_134; } v10 = v83; v87 = v85 - v82; v88 = v85; v89 = 1; v90 = v84; v91 = 1; while ( 1 ) { v92 = v86 - v89; if ( v86 - v89 <= 3 ) { if ( v92 >= v87 ) goto LABEL_146; LODWORD(v100) = v86 - v89; } else { a4 = (unsigned int)v92; v93 = 1; v94 = 1LL; do { v95 = (unsigned int)(v92 - v93); if ( (int)v95 <= 3 ) { if ( (int)a4 > (int)v95 ) a4 = (unsigned int)(v95 + 1); } else { v176 = v94; v161 = a4; v149 = v92 - v93; v96 = func0_part_0(v95, v10, v94, a4, a5, a6); a4 = v161; v97 = v149; v10 = (unsigned int)v10; LODWORD(v94) = v176; if ( (int)v161 > v96 ) { v151 = v96; func0_part_0(v97, (unsigned int)v10, v176, v161, a5, a6); LODWORD(v94) = v176; v10 = (unsigned int)v10; a4 = (unsigned int)(v151 + 1); } } v94 = (unsigned int)(v94 + 1); if ( v92 < (int)v94 ) break; v93 = v94 * v94; } while ( v92 >= (int)v94 * (int)v94 ); if ( (int)a4 >= v87 ) goto LABEL_146; v100 = (unsigned int)v92; v101 = 1; v102 = (unsigned int)(v92 - 1); if ( (int)v102 > 3 ) { LABEL_162: v162 = v100; v103 = func0_part_0(v102, v10, v100, a4, a5, a6); v100 = v162; v10 = (unsigned int)v10; if ( (int)v162 > v103 ) { v152 = v103; func0_part_0((unsigned int)v102, (unsigned int)v10, v162, a4, a5, a6); v10 = (unsigned int)v10; v100 = (unsigned int)(v152 + 1); } goto LABEL_164; } while ( 1 ) { if ( (int)v100 > (int)v102 ) v100 = (unsigned int)(v102 + 1); LABEL_164: if ( v92 < ++v101 || v92 < v101 * v101 ) break; v102 = (unsigned int)(v92 - v101 * v101); if ( (int)v102 > 3 ) goto LABEL_162; } } v87 = v100 + 1; LABEL_146: if ( v86 >= ++v91 ) { v89 = v91 * v91; if ( v86 >= v91 * v91 ) continue; } v84 = v90; v85 = v88; v83 = v10; if ( v84 <= v87 ) goto LABEL_149; v105 = 1; v106 = v86; v150 = v85; v107 = 1; v108 = v86; while ( 1 ) { v109 = v106 - v105; if ( v106 - v105 <= 3 ) { if ( v108 <= v109 ) goto LABEL_181; v115 = v106 - v105; } else { v110 = (unsigned int)v109; v111 = 1; v112 = 1; do { v113 = v109 - v111; if ( v109 - v111 <= 3 ) { if ( (int)v110 > (int)v113 ) v110 = v113 + 1; } else { v167 = v110; v114 = func0_part_0(v113, v10, v110, a4, a5, a6); v110 = v167; if ( (int)v167 > v114 ) { v168 = v114; func0_part_0(v113, v10, v110, a4, a5, a6); v110 = (unsigned int)(v168 + 1); } } if ( v109 < ++v112 ) break; v111 = v112 * v112; } while ( v109 >= v112 * v112 ); if ( v108 <= (int)v110 ) goto LABEL_181; v115 = v109; v116 = 1; v117 = v109 - 1; if ( v109 - 1 > 3 ) { LABEL_190: v118 = func0_part_0(v117, v10, v110, a4, a5, a6); if ( v118 < v115 ) { v169 = v118; func0_part_0(v117, v10, v110, a4, a5, a6); v115 = v169 + 1; } goto LABEL_192; } while ( 1 ) { if ( (int)v117 < v115 ) v115 = v117 + 1; LABEL_192: if ( v109 < ++v116 ) break; v119 = v116 * v116; if ( v109 < v116 * v116 ) break; v117 = v109 - v119; if ( v109 - v119 > 3 ) goto LABEL_190; } } v108 = v115 + 1; LABEL_181: if ( v106 >= ++v107 ) { v105 = v107 * v107; if ( v106 >= v107 * v107 ) continue; } v104 = v108; v83 = v10; v85 = v150; LABEL_171: v84 = v104 + 1; goto LABEL_149; } } } return v6; }
func0.part.0: PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP MOV EBP,EDI PUSH RBX SUB RSP,0x38 TEST EDI,EDI JLE 0x00101371 MOV EAX,0x1 MOV R13D,0x1 MOV R12D,EDI LAB_001011e6: MOV ESI,R12D SUB ESI,EAX CMP ESI,0x3 JLE 0x0010185b MOV R14D,0x1 MOV dword ptr [RSP + 0xc],R13D MOV EBX,ESI MOV EAX,0x1 MOV dword ptr [RSP + 0x10],EBP MOV R13D,R12D MOV EBP,R14D MOV R14D,ESI LAB_00101213: MOV EDX,R14D SUB EDX,EAX CMP EDX,0x3 JLE 0x001015c0 MOV R15D,0x1 MOV dword ptr [RSP + 0x8],EBX MOV EAX,0x1 MOV R8D,EDX MOV EBX,R15D MOV R15D,EDX LAB_00101239: MOV R12D,R15D SUB R12D,EAX CMP R12D,0x3 JLE 0x00101438 MOV R9D,R12D MOV EAX,0x1 MOV ESI,0x1 LAB_00101256: MOV EDX,R12D SUB EDX,EAX CMP EDX,0x3 JLE 0x001013a0 MOV R10D,EDX MOV EAX,0x1 MOV ECX,0x1 LAB_00101271: MOV EDI,EDX SUB EDI,EAX CMP EDI,0x3 JLE 0x00101388 MOV dword ptr [RSP + 0x2c],R10D MOV dword ptr [RSP + 0x28],ECX MOV dword ptr [RSP + 0x24],ESI MOV dword ptr [RSP + 0x20],EDX MOV dword ptr [RSP + 0x1c],R8D MOV dword ptr [RSP + 0x18],R9D MOV dword ptr [RSP + 0x14],EDI CALL 0x001011c0 MOV R10D,dword ptr [RSP + 0x2c] MOV EDI,dword ptr [RSP + 0x14] MOV R9D,dword ptr [RSP + 0x18] MOV R8D,dword ptr [RSP + 0x1c] CMP EAX,R10D MOV EDX,dword ptr [RSP + 0x20] MOV ESI,dword ptr [RSP + 0x24] MOV ECX,dword ptr [RSP + 0x28] JL 0x00101924 NOP word ptr [RAX + RAX*0x1] LAB_001012d0: ADD ECX,0x1 CMP EDX,ECX JL 0x001012e0 MOV EAX,ECX IMUL EAX,ECX CMP EDX,EAX JGE 0x00101271 LAB_001012e0: CMP R9D,R10D JG 0x001013b8 LAB_001012e9: ADD ESI,0x1 CMP R12D,ESI JL 0x001012ff MOV EAX,ESI IMUL EAX,ESI CMP R12D,EAX JGE 0x00101256 LAB_001012ff: CMP R9D,R8D JL 0x00101450 LAB_00101308: ADD EBX,0x1 CMP R15D,EBX JL 0x0010131e MOV EAX,EBX IMUL EAX,EBX CMP R15D,EAX JGE 0x00101239 LAB_0010131e: MOV EBX,dword ptr [RSP + 0x8] MOV EDX,R15D CMP R8D,EBX JL 0x001015d2 LAB_0010132e: ADD EBP,0x1 CMP R14D,EBP JL 0x00101344 MOV EAX,EBP IMUL EAX,EBP CMP R14D,EAX JGE 0x00101213 LAB_00101344: MOV EBP,dword ptr [RSP + 0x10] MOV R12D,R13D MOV R13D,dword ptr [RSP + 0xc] CMP EBX,EBP JL 0x00101a0f LAB_00101358: ADD R13D,0x1 CMP R12D,R13D JL 0x00101371 MOV EAX,R13D IMUL EAX,R13D CMP EAX,R12D JLE 0x001011e6 LAB_00101371: ADD RSP,0x38 MOV EAX,EBP POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101388: CMP EDI,R10D JGE 0x001012d0 LEA R10D,[RDI + 0x1] JMP 0x001012d0 LAB_001013a0: CMP R9D,EDX JLE 0x001012e9 MOV R9D,EDX LAB_001013ac: ADD R9D,0x1 JMP 0x001012e9 LAB_001013b8: MOV EAX,0x1 MOV EDI,EDX MOV R9D,EDX MOV ECX,0x1 SUB EDI,EAX CMP EDI,0x3 JLE 0x00101429 LAB_001013ce: MOV dword ptr [RSP + 0x28],ECX MOV dword ptr [RSP + 0x24],R9D MOV dword ptr [RSP + 0x20],ESI MOV dword ptr [RSP + 0x1c],EDX MOV dword ptr [RSP + 0x18],R8D MOV dword ptr [RSP + 0x14],EDI CALL 0x001011c0 MOV R9D,dword ptr [RSP + 0x24] MOV EDI,dword ptr [RSP + 0x14] MOV R8D,dword ptr [RSP + 0x18] MOV EDX,dword ptr [RSP + 0x1c] CMP R9D,EAX MOV ESI,dword ptr [RSP + 0x20] MOV ECX,dword ptr [RSP + 0x28] JG 0x001018d2 LAB_00101410: ADD ECX,0x1 CMP EDX,ECX JL 0x001013ac MOV EAX,ECX IMUL EAX,ECX CMP EDX,EAX JL 0x001013ac MOV EDI,EDX SUB EDI,EAX CMP EDI,0x3 JG 0x001013ce LAB_00101429: CMP R9D,EDI JLE 0x00101410 LEA R9D,[RDI + 0x1] JMP 0x00101410 LAB_00101438: CMP R12D,R8D JGE 0x00101308 MOV R8D,R12D LAB_00101444: ADD R8D,0x1 JMP 0x00101308 LAB_00101450: MOV R9D,0x1 MOV ECX,EBP MOV R8D,R12D MOV EAX,0x1 MOV EBP,R9D MOV ESI,EBX MOV R9D,R13D MOV R13D,R12D LAB_0010146b: MOV R12D,R13D SUB R12D,EAX CMP R12D,0x3 JLE 0x00101530 MOV EDX,R12D MOV EAX,0x1 MOV EBX,0x1 LAB_00101488: MOV EDI,R12D SUB EDI,EAX CMP EDI,0x3 JLE 0x00101520 MOV dword ptr [RSP + 0x28],R9D MOV dword ptr [RSP + 0x24],EDX MOV dword ptr [RSP + 0x20],R8D MOV dword ptr [RSP + 0x1c],ESI MOV dword ptr [RSP + 0x18],ECX MOV dword ptr [RSP + 0x14],EDI CALL 0x001011c0 MOV EDX,dword ptr [RSP + 0x24] MOV EDI,dword ptr [RSP + 0x14] MOV ECX,dword ptr [RSP + 0x18] MOV ESI,dword ptr [RSP + 0x1c] CMP EDX,EAX MOV R8D,dword ptr [RSP + 0x20] MOV R9D,dword ptr [RSP + 0x28] JG 0x001019a6 NOP word ptr [RAX + RAX*0x1] LAB_001014e0: ADD EBX,0x1 CMP R12D,EBX JL 0x001014f2 MOV EAX,EBX IMUL EAX,EBX CMP R12D,EAX JGE 0x00101488 LAB_001014f2: CMP R8D,EDX JG 0x00101540 LAB_001014f7: ADD EBP,0x1 CMP R13D,EBP JL 0x0010150d MOV EAX,EBP IMUL EAX,EBP CMP R13D,EAX JGE 0x0010146b LAB_0010150d: MOV EBP,ECX MOV EBX,ESI MOV R13D,R9D JMP 0x00101444 LAB_00101520: CMP EDX,EDI JLE 0x001014e0 LEA EDX,[RDI + 0x1] JMP 0x001014e0 LAB_00101530: CMP R8D,R12D JLE 0x001014f7 MOV R8D,R12D LAB_00101538: ADD R8D,0x1 JMP 0x001014f7 LAB_00101540: MOV EAX,0x1 MOV EDI,R12D MOV R8D,R12D MOV EBX,0x1 SUB EDI,EAX CMP EDI,0x3 JLE 0x001015b4 LAB_00101557: MOV dword ptr [RSP + 0x24],R9D MOV dword ptr [RSP + 0x20],R8D MOV dword ptr [RSP + 0x1c],ESI MOV dword ptr [RSP + 0x18],ECX MOV dword ptr [RSP + 0x14],EDI CALL 0x001011c0 MOV R8D,dword ptr [RSP + 0x20] MOV EDI,dword ptr [RSP + 0x14] MOV ECX,dword ptr [RSP + 0x18] MOV ESI,dword ptr [RSP + 0x1c] CMP R8D,EAX MOV R9D,dword ptr [RSP + 0x24] JG 0x001019df NOP dword ptr [RAX] LAB_00101598: ADD EBX,0x1 CMP R12D,EBX JL 0x00101538 MOV EAX,EBX IMUL EAX,EBX CMP R12D,EAX JL 0x00101538 MOV EDI,R12D SUB EDI,EAX CMP EDI,0x3 JG 0x00101557 LAB_001015b4: CMP R8D,EDI JLE 0x00101598 LEA R8D,[RDI + 0x1] JMP 0x00101598 LAB_001015c0: CMP EDX,EBX JGE 0x0010132e MOV EBX,EDX LAB_001015ca: ADD EBX,0x1 JMP 0x0010132e LAB_001015d2: MOV EBX,R15D MOV dword ptr [RSP + 0x8],EBP MOV R15D,0x1 MOV R12D,R14D MOV dword ptr [RSP + 0x14],R13D MOV ESI,R15D MOV EAX,0x1 MOV R15D,EDX MOV EDX,ESI LAB_001015f4: MOV EBP,R15D SUB EBP,EAX CMP EBP,0x3 JLE 0x00101780 MOV R14D,0x1 MOV R8D,EBX MOV R13D,EBP MOV EAX,0x1 MOV EBX,R14D LAB_00101616: MOV R14D,EBP SUB R14D,EAX CMP R14D,0x3 JLE 0x001016f0 MOV ESI,R14D MOV EAX,0x1 MOV ECX,0x1 LAB_00101633: MOV EDI,R14D SUB EDI,EAX CMP EDI,0x3 JLE 0x001016e0 MOV dword ptr [RSP + 0x28],EDX MOV dword ptr [RSP + 0x24],R8D MOV dword ptr [RSP + 0x20],ECX MOV dword ptr [RSP + 0x1c],ESI MOV dword ptr [RSP + 0x18],EDI CALL 0x001011c0 MOV ESI,dword ptr [RSP + 0x1c] MOV EDI,dword ptr [RSP + 0x18] MOV ECX,dword ptr [RSP + 0x20] MOV R8D,dword ptr [RSP + 0x24] CMP ESI,EAX MOV EDX,dword ptr [RSP + 0x28] JG 0x00101950 NOP dword ptr [RAX + RAX*0x1] LAB_00101680: ADD ECX,0x1 CMP R14D,ECX JL 0x00101692 MOV EAX,ECX IMUL EAX,ECX CMP R14D,EAX JGE 0x00101633 LAB_00101692: CMP ESI,R13D JL 0x00101700 LAB_00101697: ADD EBX,0x1 CMP EBP,EBX JL 0x001016ab MOV EAX,EBX IMUL EAX,EBX CMP EBP,EAX JGE 0x00101616 LAB_001016ab: MOV EBX,R8D CMP R8D,R13D JG 0x00101794 LAB_001016b7: ADD EDX,0x1 CMP R15D,EDX JL 0x001016cd MOV EAX,EDX IMUL EAX,EDX CMP R15D,EAX JGE 0x001015f4 LAB_001016cd: MOV EBP,dword ptr [RSP + 0x8] MOV R13D,dword ptr [RSP + 0x14] MOV R14D,R12D JMP 0x001015ca LAB_001016e0: CMP ESI,EDI JLE 0x00101680 LEA ESI,[RDI + 0x1] JMP 0x00101680 LAB_001016f0: CMP R14D,R13D JGE 0x00101697 MOV ECX,R14D LAB_001016f8: LEA R13D,[RCX + 0x1] JMP 0x00101697 LAB_00101700: MOV EAX,0x1 MOV EDI,R14D MOV ECX,R14D MOV R13D,0x1 SUB EDI,EAX CMP EDI,0x3 JLE 0x0010176f LAB_00101718: MOV dword ptr [RSP + 0x24],EDX MOV dword ptr [RSP + 0x20],ECX MOV dword ptr [RSP + 0x1c],R8D MOV dword ptr [RSP + 0x18],EDI CALL 0x001011c0 MOV ECX,dword ptr [RSP + 0x20] MOV EDI,dword ptr [RSP + 0x18] MOV R8D,dword ptr [RSP + 0x1c] MOV EDX,dword ptr [RSP + 0x24] CMP ECX,EAX JG 0x0010197f NOP word ptr [RAX + RAX*0x1] LAB_00101750: ADD R13D,0x1 CMP R14D,R13D JL 0x001016f8 MOV EAX,R13D IMUL EAX,R13D CMP R14D,EAX JL 0x001016f8 MOV EDI,R14D SUB EDI,EAX CMP EDI,0x3 JG 0x00101718 LAB_0010176f: CMP ECX,EDI JLE 0x00101750 LEA ECX,[RDI + 0x1] JMP 0x00101750 LAB_00101780: CMP EBX,EBP JLE 0x001016b7 MOV R8D,EBP LAB_0010178b: LEA EBX,[R8 + 0x1] JMP 0x001016b7 LAB_00101794: MOV dword ptr [RSP + 0x20],EDX MOV R13D,0x1 MOV EAX,0x1 MOV dword ptr [RSP + 0x18],R12D MOV R12D,R13D MOV dword ptr [RSP + 0x1c],R15D MOV R15D,EBP LAB_001017b3: MOV EBX,R15D SUB EBX,EAX CMP EBX,0x3 JLE 0x00101850 MOV ECX,EBX MOV EAX,0x1 MOV R14D,0x1 LAB_001017ce: MOV R13D,EBX SUB R13D,EAX CMP R13D,0x3 JLE 0x00101840 MOV EDI,R13D MOV dword ptr [RSP + 0x24],ECX CALL 0x001011c0 MOV ECX,dword ptr [RSP + 0x24] CMP ECX,EAX JG 0x0010190a NOP word ptr [RAX + RAX*0x1] LAB_001017f8: ADD R14D,0x1 CMP EBX,R14D JL 0x0010180c MOV EAX,R14D IMUL EAX,R14D CMP EBX,EAX JGE 0x001017ce LAB_0010180c: CMP EBP,ECX JG 0x0010186b LAB_00101810: ADD R12D,0x1 CMP R15D,R12D JL 0x00101825 MOV EAX,R12D IMUL EAX,R12D CMP R15D,EAX JGE 0x001017b3 LAB_00101825: MOV R12D,dword ptr [RSP + 0x18] MOV R15D,dword ptr [RSP + 0x1c] MOV R8D,EBP MOV EDX,dword ptr [RSP + 0x20] JMP 0x0010178b LAB_00101840: CMP ECX,R13D JLE 0x001017f8 LEA ECX,[R13 + 0x1] JMP 0x001017f8 LAB_00101850: CMP EBP,EBX JLE 0x00101810 MOV EBP,EBX LAB_00101856: ADD EBP,0x1 JMP 0x00101810 LAB_0010185b: CMP ESI,EBP JGE 0x00101358 MOV R15D,ESI JMP 0x00101b77 LAB_0010186b: MOV EAX,0x1 MOV R14D,EBX MOV EBP,EBX MOV R13D,0x1 SUB R14D,EAX CMP R14D,0x3 JLE 0x001018b0 LAB_00101884: MOV EDI,R14D CALL 0x001011c0 CMP EAX,EBP JL 0x001018bb LAB_00101890: ADD R13D,0x1 CMP EBX,R13D JL 0x00101856 MOV EAX,R13D IMUL EAX,R13D CMP EBX,EAX JL 0x00101856 MOV R14D,EBX SUB R14D,EAX CMP R14D,0x3 JG 0x00101884 LAB_001018b0: CMP R14D,EBP JGE 0x00101890 LEA EBP,[R14 + 0x1] JMP 0x00101890 LAB_001018bb: MOV EDI,R14D MOV dword ptr [RSP + 0x24],EAX CALL 0x001011c0 MOV R14D,dword ptr [RSP + 0x24] LEA EBP,[R14 + 0x1] JMP 0x00101890 LAB_001018d2: MOV dword ptr [RSP + 0x24],ECX MOV dword ptr [RSP + 0x20],ESI MOV dword ptr [RSP + 0x1c],EDX MOV dword ptr [RSP + 0x18],R8D MOV dword ptr [RSP + 0x14],EAX CALL 0x001011c0 MOV EDI,dword ptr [RSP + 0x14] MOV ECX,dword ptr [RSP + 0x24] MOV ESI,dword ptr [RSP + 0x20] MOV EDX,dword ptr [RSP + 0x1c] MOV R8D,dword ptr [RSP + 0x18] LEA R9D,[RDI + 0x1] JMP 0x00101410 LAB_0010190a: MOV EDI,R13D MOV dword ptr [RSP + 0x24],EAX CALL 0x001011c0 MOV R13D,dword ptr [RSP + 0x24] LEA ECX,[R13 + 0x1] JMP 0x001017f8 LAB_00101924: MOV dword ptr [RSP + 0x14],EAX CALL 0x001011c0 MOV EDI,dword ptr [RSP + 0x14] MOV ECX,dword ptr [RSP + 0x28] MOV ESI,dword ptr [RSP + 0x24] MOV EDX,dword ptr [RSP + 0x20] MOV R8D,dword ptr [RSP + 0x1c] MOV R9D,dword ptr [RSP + 0x18] LEA R10D,[RDI + 0x1] JMP 0x001012d0 LAB_00101950: MOV dword ptr [RSP + 0x24],EDX MOV dword ptr [RSP + 0x20],R8D MOV dword ptr [RSP + 0x1c],ECX MOV dword ptr [RSP + 0x18],EAX CALL 0x001011c0 MOV EDI,dword ptr [RSP + 0x18] MOV EDX,dword ptr [RSP + 0x24] MOV R8D,dword ptr [RSP + 0x20] MOV ECX,dword ptr [RSP + 0x1c] LEA ESI,[RDI + 0x1] JMP 0x00101680 LAB_0010197f: MOV dword ptr [RSP + 0x20],EDX MOV dword ptr [RSP + 0x1c],R8D MOV dword ptr [RSP + 0x18],EAX CALL 0x001011c0 MOV EDI,dword ptr [RSP + 0x18] MOV EDX,dword ptr [RSP + 0x20] MOV R8D,dword ptr [RSP + 0x1c] LEA ECX,[RDI + 0x1] JMP 0x00101750 LAB_001019a6: MOV dword ptr [RSP + 0x24],R9D MOV dword ptr [RSP + 0x20],R8D MOV dword ptr [RSP + 0x1c],ESI MOV dword ptr [RSP + 0x18],ECX MOV dword ptr [RSP + 0x14],EAX CALL 0x001011c0 MOV EDI,dword ptr [RSP + 0x14] MOV R9D,dword ptr [RSP + 0x24] MOV R8D,dword ptr [RSP + 0x20] MOV ESI,dword ptr [RSP + 0x1c] MOV ECX,dword ptr [RSP + 0x18] LEA EDX,[RDI + 0x1] JMP 0x001014e0 LAB_001019df: MOV dword ptr [RSP + 0x20],R9D MOV dword ptr [RSP + 0x1c],ESI MOV dword ptr [RSP + 0x18],ECX MOV dword ptr [RSP + 0x14],EAX CALL 0x001011c0 MOV EDI,dword ptr [RSP + 0x14] MOV R9D,dword ptr [RSP + 0x20] MOV ESI,dword ptr [RSP + 0x1c] MOV ECX,dword ptr [RSP + 0x18] LEA R8D,[RDI + 0x1] JMP 0x00101598 LAB_00101a0f: MOV dword ptr [RSP + 0x24],R13D MOV EBX,0x1 MOV EDX,0x1 MOV dword ptr [RSP + 0x28],R12D MOV EBP,EBX MOV R12D,R14D MOV EBX,R14D LAB_00101a2b: MOV R13D,EBX SUB R13D,EDX CMP R13D,0x3 JLE 0x00101d3c MOV dword ptr [RSP + 0x10],R12D MOV EDX,0x1 MOV R14D,0x1 MOV dword ptr [RSP + 0x8],EBX MOV EBX,R13D MOV dword ptr [RSP + 0xc],EBP MOV EBP,R13D LAB_00101a59: MOV R13D,EBP SUB R13D,EDX CMP R13D,0x3 JLE 0x00101c10 MOV R15D,0x1 MOV ESI,R14D MOV R12D,R13D MOV R14D,EBP MOV EAX,0x1 MOV EBP,EBX MOV EBX,R15D LAB_00101a82: MOV R15D,R13D SUB R15D,EAX CMP R15D,0x3 JLE 0x00101b90 MOV ECX,R15D MOV EAX,0x1 MOV EDX,0x1 LAB_00101a9f: MOV EDI,R15D SUB EDI,EAX CMP EDI,0x3 JLE 0x00101b80 MOV dword ptr [RSP + 0x20],EDX MOV dword ptr [RSP + 0x1c],ESI MOV dword ptr [RSP + 0x18],ECX MOV dword ptr [RSP + 0x14],EDI CALL 0x001011c0 MOV ECX,dword ptr [RSP + 0x18] MOV EDI,dword ptr [RSP + 0x14] MOV ESI,dword ptr [RSP + 0x1c] MOV EDX,dword ptr [RSP + 0x20] CMP ECX,EAX JG 0x00101d7e NOP word ptr [RAX + RAX*0x1] LAB_00101ae0: ADD EDX,0x1 CMP R15D,EDX JL 0x00101af2 MOV EAX,EDX IMUL EAX,EDX CMP R15D,EAX JGE 0x00101a9f LAB_00101af2: CMP ECX,R12D JL 0x00101ba8 LAB_00101afb: ADD EBX,0x1 CMP R13D,EBX JL 0x00101b11 MOV EAX,EBX IMUL EAX,EBX CMP R13D,EAX JGE 0x00101a82 LAB_00101b11: MOV EBX,EBP MOV EBP,R14D MOV R14D,ESI CMP EBX,R12D JG 0x00101c24 LAB_00101b22: ADD R14D,0x1 CMP EBP,R14D JL 0x00101b3a MOV EDX,R14D IMUL EDX,R14D CMP EBP,EDX JGE 0x00101a59 LAB_00101b3a: MOV R12D,dword ptr [RSP + 0x10] MOV R15D,EBX MOV R13D,EBP MOV EBX,dword ptr [RSP + 0x8] MOV EBP,dword ptr [RSP + 0xc] CMP R12D,R15D JG 0x00101dc0 LAB_00101b56: ADD EBP,0x1 CMP EBX,EBP JL 0x00101b6a MOV EDX,EBP IMUL EDX,EBP CMP EBX,EDX JGE 0x00101a2b LAB_00101b6a: MOV R15D,R12D MOV R13D,dword ptr [RSP + 0x24] MOV R12D,dword ptr [RSP + 0x28] LAB_00101b77: LEA EBP,[R15 + 0x1] JMP 0x00101358 LAB_00101b80: CMP ECX,EDI JLE 0x00101ae0 LEA ECX,[RDI + 0x1] JMP 0x00101ae0 LAB_00101b90: CMP R15D,R12D JGE 0x00101afb MOV EDX,R15D LAB_00101b9c: LEA R12D,[RDX + 0x1] JMP 0x00101afb LAB_00101ba8: MOV EAX,0x1 MOV EDI,R15D MOV EDX,R15D MOV R12D,0x1 SUB EDI,EAX CMP EDI,0x3 JLE 0x00101c07 LAB_00101bc0: MOV dword ptr [RSP + 0x1c],ESI MOV dword ptr [RSP + 0x18],EDX MOV dword ptr [RSP + 0x14],EDI CALL 0x001011c0 MOV EDX,dword ptr [RSP + 0x18] MOV EDI,dword ptr [RSP + 0x14] MOV ESI,dword ptr [RSP + 0x1c] CMP EDX,EAX JG 0x00101da3 NOP dword ptr [RAX] LAB_00101be8: ADD R12D,0x1 CMP R15D,R12D JL 0x00101b9c MOV EAX,R12D IMUL EAX,R12D CMP R15D,EAX JL 0x00101b9c MOV EDI,R15D SUB EDI,EAX CMP EDI,0x3 JG 0x00101bc0 LAB_00101c07: CMP EDX,EDI JLE 0x00101be8 LEA EDX,[RDI + 0x1] JMP 0x00101be8 LAB_00101c10: CMP EBX,R13D JLE 0x00101b22 MOV EBX,R13D LAB_00101c1c: ADD EBX,0x1 JMP 0x00101b22 LAB_00101c24: MOV dword ptr [RSP + 0x18],ESI MOV R12D,0x1 MOV EAX,0x1 MOV R14D,R13D MOV dword ptr [RSP + 0x14],EBP MOV EBX,R12D MOV EBP,R13D LAB_00101c40: MOV R15D,R14D SUB R15D,EAX CMP R15D,0x3 JLE 0x00101cd8 MOV EDX,R15D MOV EAX,0x1 MOV R12D,0x1 LAB_00101c5e: MOV R13D,R15D SUB R13D,EAX CMP R13D,0x3 JLE 0x00101cc8 MOV EDI,R13D MOV dword ptr [RSP + 0x1c],EDX CALL 0x001011c0 MOV EDX,dword ptr [RSP + 0x1c] CMP EDX,EAX JG 0x00101d4d NOP word ptr [RAX + RAX*0x1] LAB_00101c88: ADD R12D,0x1 CMP R15D,R12D JL 0x00101c9d MOV EAX,R12D IMUL EAX,R12D CMP R15D,EAX JGE 0x00101c5e LAB_00101c9d: CMP EBP,EDX JG 0x00101ce5 LAB_00101ca1: ADD EBX,0x1 CMP R14D,EBX JL 0x00101cb3 MOV EAX,EBX IMUL EAX,EBX CMP R14D,EAX JGE 0x00101c40 LAB_00101cb3: MOV EBX,EBP MOV R14D,dword ptr [RSP + 0x18] MOV EBP,dword ptr [RSP + 0x14] JMP 0x00101c1c LAB_00101cc8: CMP EDX,R13D JLE 0x00101c88 LEA EDX,[R13 + 0x1] JMP 0x00101c88 LAB_00101cd8: CMP EBP,R15D JLE 0x00101ca1 MOV EBP,R15D LAB_00101ce0: ADD EBP,0x1 JMP 0x00101ca1 LAB_00101ce5: MOV EAX,0x1 MOV R13D,R15D MOV EBP,R15D MOV R12D,0x1 SUB R13D,EAX CMP R13D,0x3 JLE 0x00101d31 LAB_00101cff: MOV EDI,R13D CALL 0x001011c0 CMP EAX,EBP JL 0x00101d67 NOP dword ptr [RAX + RAX*0x1] LAB_00101d10: ADD R12D,0x1 CMP R15D,R12D JL 0x00101ce0 MOV EAX,R12D IMUL EAX,R12D CMP R15D,EAX JL 0x00101ce0 MOV R13D,R15D SUB R13D,EAX CMP R13D,0x3 JG 0x00101cff LAB_00101d31: CMP R13D,EBP JGE 0x00101d10 LEA EBP,[R13 + 0x1] JMP 0x00101d10 LAB_00101d3c: CMP R12D,R13D JLE 0x00101b56 MOV R12D,R13D JMP 0x00101e58 LAB_00101d4d: MOV EDI,R13D MOV dword ptr [RSP + 0x1c],EAX CALL 0x001011c0 MOV R13D,dword ptr [RSP + 0x1c] LEA EDX,[R13 + 0x1] JMP 0x00101c88 LAB_00101d67: MOV EDI,R13D MOV dword ptr [RSP + 0x1c],EAX CALL 0x001011c0 MOV R13D,dword ptr [RSP + 0x1c] LEA EBP,[R13 + 0x1] JMP 0x00101d10 LAB_00101d7e: MOV dword ptr [RSP + 0x1c],EDX MOV dword ptr [RSP + 0x18],ESI MOV dword ptr [RSP + 0x14],EAX CALL 0x001011c0 MOV EDI,dword ptr [RSP + 0x14] MOV EDX,dword ptr [RSP + 0x1c] MOV ESI,dword ptr [RSP + 0x18] LEA ECX,[RDI + 0x1] JMP 0x00101ae0 LAB_00101da3: MOV dword ptr [RSP + 0x18],ESI MOV dword ptr [RSP + 0x14],EAX CALL 0x001011c0 MOV EDI,dword ptr [RSP + 0x14] MOV ESI,dword ptr [RSP + 0x18] LEA EDX,[RDI + 0x1] JMP 0x00101be8 LAB_00101dc0: MOV EDX,0x1 MOV dword ptr [RSP + 0xc],EBX MOV EAX,0x1 MOV EBX,R13D MOV dword ptr [RSP + 0x10],EBP MOV R12D,EDX MOV EBP,R13D LAB_00101ddb: MOV R15D,EBX SUB R15D,EAX CMP R15D,0x3 JLE 0x00101e8a MOV EDX,R15D MOV EAX,0x1 MOV R14D,0x1 LAB_00101df9: MOV R13D,R15D SUB R13D,EAX CMP R13D,0x3 JLE 0x00101e68 MOV EDI,R13D MOV dword ptr [RSP + 0x8],EDX CALL 0x001011c0 MOV EDX,dword ptr [RSP + 0x8] CMP EAX,EDX JL 0x00101e73 NOP dword ptr [RAX] LAB_00101e20: ADD R14D,0x1 CMP R15D,R14D JL 0x00101e35 MOV EAX,R14D IMUL EAX,R14D CMP R15D,EAX JGE 0x00101df9 LAB_00101e35: CMP EDX,EBP JL 0x00101e95 LAB_00101e39: ADD R12D,0x1 CMP EBX,R12D JL 0x00101e4d MOV EAX,R12D IMUL EAX,R12D CMP EBX,EAX JGE 0x00101ddb LAB_00101e4d: MOV R12D,EBP MOV EBX,dword ptr [RSP + 0xc] MOV EBP,dword ptr [RSP + 0x10] LAB_00101e58: ADD R12D,0x1 JMP 0x00101b56 LAB_00101e68: CMP R13D,EDX JGE 0x00101e20 LEA EDX,[R13 + 0x1] JMP 0x00101e20 LAB_00101e73: MOV EDI,R13D MOV dword ptr [RSP + 0x8],EAX CALL 0x001011c0 MOV R13D,dword ptr [RSP + 0x8] LEA EDX,[R13 + 0x1] JMP 0x00101e20 LAB_00101e8a: CMP R15D,EBP JGE 0x00101e39 LEA EBP,[R15 + 0x1] JMP 0x00101e39 LAB_00101e95: MOV EDI,R15D CALL 0x001011c0 MOV R15D,EAX LEA EBP,[R15 + 0x1] JMP 0x00101e39
int func0_part_0(int param_1) { int iVar1; int iVar2; int iVar3; int iVar4; int iVar5; int iVar6; int iVar7; int iVar8; int iVar9; int iVar10; int iVar11; int iVar12; int iVar13; int iVar14; int iVar15; int iVar16; int iVar17; int iVar18; int iVar19; int iVar20; iVar16 = param_1; if (0 < param_1) { iVar10 = 1; iVar15 = 1; do { iVar10 = param_1 - iVar10; iVar20 = iVar10; if (iVar10 < 4) { if (iVar10 < iVar16) goto LAB_00101b77; } else { iVar3 = 1; iVar8 = 1; iVar9 = iVar10; do { iVar3 = iVar10 - iVar3; iVar17 = iVar3; if (iVar3 < 4) { if (iVar3 < iVar9) goto LAB_001015ca; } else { iVar14 = 1; iVar6 = 1; iVar18 = iVar3; do { iVar14 = iVar3 - iVar14; iVar19 = iVar14; if (iVar14 < 4) { if (iVar14 < iVar18) goto LAB_00101444; } else { iVar4 = 1; iVar11 = 1; iVar7 = iVar14; do { iVar4 = iVar14 - iVar4; iVar13 = iVar4; if (iVar4 < 4) { if (iVar4 < iVar7) { LAB_001013ac: iVar7 = iVar13 + 1; } } else { iVar12 = 1; iVar2 = 1; iVar5 = iVar4; do { iVar12 = iVar4 - iVar12; if (iVar12 < 4) { if (iVar12 < iVar5) { iVar5 = iVar12 + 1; } } else { iVar1 = func0_part_0(); if (iVar1 < iVar5) { func0_part_0(iVar12); iVar5 = iVar1 + 1; } } iVar2 = iVar2 + 1; } while ((iVar2 <= iVar4) && (iVar12 = iVar2 * iVar2, iVar12 <= iVar4)); if (iVar5 < iVar7) { iVar7 = 1; iVar5 = iVar4 + -1; if (iVar5 < 4) goto LAB_00101429; do { iVar12 = func0_part_0(); if (iVar12 < iVar13) { func0_part_0(iVar5); iVar13 = iVar12 + 1; } while( true ) { iVar7 = iVar7 + 1; if ((iVar4 < iVar7) || (iVar4 < iVar7 * iVar7)) goto LAB_001013ac; iVar5 = iVar4 - iVar7 * iVar7; if (3 < iVar5) break; LAB_00101429: if (iVar5 < iVar13) { iVar13 = iVar5 + 1; } } } while( true ); } } iVar11 = iVar11 + 1; } while ((iVar11 <= iVar14) && (iVar4 = iVar11 * iVar11, iVar4 <= iVar14)); if (iVar7 < iVar18) { iVar18 = 1; iVar7 = 1; do { iVar18 = iVar14 - iVar18; iVar4 = iVar18; if (iVar18 < 4) { if (iVar18 < iVar19) { LAB_00101538: iVar19 = iVar4 + 1; } } else { iVar13 = 1; iVar5 = 1; iVar11 = iVar18; do { iVar13 = iVar18 - iVar13; if (iVar13 < 4) { if (iVar13 < iVar11) { iVar11 = iVar13 + 1; } } else { iVar12 = func0_part_0(); if (iVar12 < iVar11) { func0_part_0(iVar13); iVar11 = iVar12 + 1; } } iVar5 = iVar5 + 1; } while ((iVar5 <= iVar18) && (iVar13 = iVar5 * iVar5, iVar13 <= iVar18)); if (iVar11 < iVar19) { iVar19 = 1; iVar11 = iVar18 + -1; if (iVar11 < 4) goto LAB_001015b4; do { iVar13 = func0_part_0(); if (iVar13 < iVar4) { func0_part_0(iVar11); iVar4 = iVar13 + 1; } while( true ) { iVar19 = iVar19 + 1; if ((iVar18 < iVar19) || (iVar18 < iVar19 * iVar19)) goto LAB_00101538; iVar11 = iVar18 - iVar19 * iVar19; if (3 < iVar11) break; LAB_001015b4: if (iVar11 < iVar4) { iVar4 = iVar11 + 1; } } } while( true ); } } iVar7 = iVar7 + 1; } while ((iVar7 <= iVar14) && (iVar18 = iVar7 * iVar7, iVar18 <= iVar14)); LAB_00101444: iVar18 = iVar19 + 1; } } iVar6 = iVar6 + 1; } while ((iVar6 <= iVar3) && (iVar14 = iVar6 * iVar6, iVar14 <= iVar3)); if (iVar18 < iVar9) { iVar9 = 1; iVar18 = 1; do { iVar9 = iVar3 - iVar9; iVar14 = iVar9; if (iVar9 < 4) { if (iVar9 < iVar17) goto LAB_0010178b; } else { iVar19 = 1; iVar7 = 1; iVar6 = iVar9; do { iVar19 = iVar9 - iVar19; iVar4 = iVar19; if (iVar19 < 4) { if (iVar19 < iVar6) { LAB_001016f8: iVar6 = iVar4 + 1; } } else { iVar13 = 1; iVar5 = 1; iVar11 = iVar19; do { iVar13 = iVar19 - iVar13; if (iVar13 < 4) { if (iVar13 < iVar11) { iVar11 = iVar13 + 1; } } else { iVar12 = func0_part_0(); if (iVar12 < iVar11) { func0_part_0(iVar13); iVar11 = iVar12 + 1; } } iVar5 = iVar5 + 1; } while ((iVar5 <= iVar19) && (iVar13 = iVar5 * iVar5, iVar13 <= iVar19)); if (iVar11 < iVar6) { iVar11 = 1; iVar6 = iVar19 + -1; if (iVar6 < 4) goto LAB_0010176f; do { iVar13 = func0_part_0(); if (iVar13 < iVar4) { func0_part_0(iVar6); iVar4 = iVar13 + 1; } while( true ) { iVar11 = iVar11 + 1; if ((iVar19 < iVar11) || (iVar19 < iVar11 * iVar11)) goto LAB_001016f8; iVar6 = iVar19 - iVar11 * iVar11; if (3 < iVar6) break; LAB_0010176f: if (iVar6 < iVar4) { iVar4 = iVar6 + 1; } } } while( true ); } } iVar7 = iVar7 + 1; } while ((iVar7 <= iVar9) && (iVar19 = iVar7 * iVar7, iVar19 <= iVar9)); if (iVar6 < iVar17) { iVar17 = 1; iVar6 = 1; do { iVar17 = iVar9 - iVar17; iVar19 = iVar17; if (iVar17 < 4) { if (iVar17 < iVar14) { LAB_00101856: iVar14 = iVar19 + 1; } } else { iVar4 = 1; iVar11 = 1; iVar7 = iVar17; do { iVar4 = iVar17 - iVar4; if (iVar4 < 4) { if (iVar4 < iVar7) { iVar7 = iVar4 + 1; } } else { iVar13 = func0_part_0(iVar4); if (iVar13 < iVar7) { func0_part_0(iVar4); iVar7 = iVar13 + 1; } } iVar11 = iVar11 + 1; } while ((iVar11 <= iVar17) && (iVar4 = iVar11 * iVar11, iVar4 <= iVar17)); if (iVar7 < iVar14) { iVar14 = 1; iVar7 = iVar17 + -1; if (iVar7 < 4) goto LAB_001018b0; do { iVar4 = func0_part_0(iVar7); if (iVar4 < iVar19) { func0_part_0(iVar7); iVar19 = iVar4 + 1; } while( true ) { iVar14 = iVar14 + 1; if ((iVar17 < iVar14) || (iVar17 < iVar14 * iVar14)) goto LAB_00101856; iVar7 = iVar17 - iVar14 * iVar14; if (3 < iVar7) break; LAB_001018b0: if (iVar7 < iVar19) { iVar19 = iVar7 + 1; } } } while( true ); } } iVar6 = iVar6 + 1; } while ((iVar6 <= iVar9) && (iVar17 = iVar6 * iVar6, iVar17 <= iVar9)); LAB_0010178b: iVar17 = iVar14 + 1; } } iVar18 = iVar18 + 1; } while ((iVar18 <= iVar3) && (iVar9 = iVar18 * iVar18, iVar9 <= iVar3)); LAB_001015ca: iVar9 = iVar17 + 1; } } iVar8 = iVar8 + 1; } while ((iVar8 <= iVar10) && (iVar3 = iVar8 * iVar8, iVar3 <= iVar10)); if (iVar9 < iVar16) { iVar16 = 1; iVar9 = 1; do { iVar16 = iVar10 - iVar16; iVar3 = iVar16; if (iVar16 < 4) { if (iVar16 < iVar20) goto LAB_00101e58; } else { iVar17 = 1; iVar18 = 1; iVar8 = iVar16; do { iVar17 = iVar16 - iVar17; iVar14 = iVar17; if (iVar17 < 4) { if (iVar17 < iVar8) goto LAB_00101c1c; } else { iVar19 = 1; iVar7 = 1; iVar6 = iVar17; do { iVar19 = iVar17 - iVar19; iVar4 = iVar19; if (iVar19 < 4) { if (iVar19 < iVar6) { LAB_00101b9c: iVar6 = iVar4 + 1; } } else { iVar13 = 1; iVar5 = 1; iVar11 = iVar19; do { iVar13 = iVar19 - iVar13; if (iVar13 < 4) { if (iVar13 < iVar11) { iVar11 = iVar13 + 1; } } else { iVar12 = func0_part_0(); if (iVar12 < iVar11) { func0_part_0(iVar13); iVar11 = iVar12 + 1; } } iVar5 = iVar5 + 1; } while ((iVar5 <= iVar19) && (iVar13 = iVar5 * iVar5, iVar13 <= iVar19)); if (iVar11 < iVar6) { iVar11 = 1; iVar6 = iVar19 + -1; if (iVar6 < 4) goto LAB_00101c07; do { iVar13 = func0_part_0(); if (iVar13 < iVar4) { func0_part_0(iVar6); iVar4 = iVar13 + 1; } while( true ) { iVar11 = iVar11 + 1; if ((iVar19 < iVar11) || (iVar19 < iVar11 * iVar11)) goto LAB_00101b9c; iVar6 = iVar19 - iVar11 * iVar11; if (3 < iVar6) break; LAB_00101c07: if (iVar6 < iVar4) { iVar4 = iVar6 + 1; } } } while( true ); } } iVar7 = iVar7 + 1; } while ((iVar7 <= iVar17) && (iVar19 = iVar7 * iVar7, iVar19 <= iVar17)); if (iVar6 < iVar8) { iVar8 = 1; iVar6 = 1; do { iVar8 = iVar17 - iVar8; iVar19 = iVar8; if (iVar8 < 4) { if (iVar8 < iVar14) { LAB_00101ce0: iVar14 = iVar19 + 1; } } else { iVar4 = 1; iVar11 = 1; iVar7 = iVar8; do { iVar4 = iVar8 - iVar4; if (iVar4 < 4) { if (iVar4 < iVar7) { iVar7 = iVar4 + 1; } } else { iVar13 = func0_part_0(iVar4); if (iVar13 < iVar7) { func0_part_0(iVar4); iVar7 = iVar13 + 1; } } iVar11 = iVar11 + 1; } while ((iVar11 <= iVar8) && (iVar4 = iVar11 * iVar11, iVar4 <= iVar8)); if (iVar7 < iVar14) { iVar14 = 1; iVar7 = iVar8 + -1; if (iVar7 < 4) goto LAB_00101d31; do { iVar4 = func0_part_0(iVar7); if (iVar4 < iVar19) { func0_part_0(iVar7); iVar19 = iVar4 + 1; } while( true ) { iVar14 = iVar14 + 1; if ((iVar8 < iVar14) || (iVar8 < iVar14 * iVar14)) goto LAB_00101ce0; iVar7 = iVar8 - iVar14 * iVar14; if (3 < iVar7) break; LAB_00101d31: if (iVar7 < iVar19) { iVar19 = iVar7 + 1; } } } while( true ); } } iVar6 = iVar6 + 1; } while ((iVar6 <= iVar17) && (iVar8 = iVar6 * iVar6, iVar8 <= iVar17)); LAB_00101c1c: iVar8 = iVar14 + 1; } } iVar18 = iVar18 + 1; } while ((iVar18 <= iVar16) && (iVar17 = iVar18 * iVar18, iVar17 <= iVar16)); if (iVar8 < iVar20) { iVar20 = 1; iVar8 = 1; do { iVar20 = iVar16 - iVar20; if (iVar20 < 4) { if (iVar20 < iVar3) { iVar3 = iVar20 + 1; } } else { iVar18 = 1; iVar14 = 1; iVar17 = iVar20; do { iVar18 = iVar20 - iVar18; if (iVar18 < 4) { if (iVar18 < iVar17) { iVar17 = iVar18 + 1; } } else { iVar6 = func0_part_0(iVar18); if (iVar6 < iVar17) { func0_part_0(iVar18); iVar17 = iVar6 + 1; } } iVar14 = iVar14 + 1; } while ((iVar14 <= iVar20) && (iVar18 = iVar14 * iVar14, iVar18 <= iVar20)); if (iVar17 < iVar3) { iVar3 = func0_part_0(iVar20); iVar3 = iVar3 + 1; } } iVar8 = iVar8 + 1; } while ((iVar8 <= iVar16) && (iVar20 = iVar8 * iVar8, iVar20 <= iVar16)); LAB_00101e58: iVar20 = iVar3 + 1; } } iVar9 = iVar9 + 1; } while ((iVar9 <= iVar10) && (iVar16 = iVar9 * iVar9, iVar16 <= iVar10)); LAB_00101b77: iVar16 = iVar20 + 1; } } iVar15 = iVar15 + 1; } while ((iVar15 <= param_1) && (iVar10 = iVar15 * iVar15, iVar10 <= param_1)); } return iVar16; }
5,196
func0
#include <assert.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> typedef struct { char word[50]; int count; } WordCount;
const char* func0(int n, const char* test_list[]) { static WordCount words[100]; int unique = 0; for(int i=0;i<n;i++) { const char* str = test_list[i]; char word[50]; int pos =0; while(*str) { if(!isspace(*str)) { word[pos++] = *str; } else { if(pos >0) { word[pos] = '\0'; // check if word exists int found = 0; for(int j=0;j<unique;j++) { if(strcmp(words[j].word, word) ==0){ words[j].count++; found =1; break; } } if(!found){ strcpy(words[unique].word, word); words[unique].count =1; unique++; } pos=0; } } str++; } if(pos >0){ word[pos] = '\0'; int found =0; for(int j=0;j<unique;j++) { if(strcmp(words[j].word, word) ==0){ words[j].count++; found =1; break; } } if(!found){ strcpy(words[unique].word, word); words[unique].count =1; unique++; } } } // find max int max =0; int index =0; for(int i=0;i<unique;i++) { if(words[i].count > max){ max = words[i].count; index =i; } } return words[index].word; }
int main(){ const char* test1[] = {"UTS is best for RTF", "RTF love UTS", "UTS is best"}; assert(strcmp(func0(3, test1), "UTS") == 0); const char* test2[] = {"Its been a great year", "this year is so worse", "this year is okay"}; assert(strcmp(func0(3, test2), "year") == 0); const char* test3[] = {"Families can be reunited", "people can be reunited", "Tasks can be achieved "}; assert(strcmp(func0(3, test3), "can") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp add $0xffffffffffffff80,%rsp mov %edi,-0x74(%rbp) mov %rsi,-0x80(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax movl $0x0,-0x70(%rbp) movl $0x0,-0x6c(%rbp) jmpq 14ab <func0+0x2e2> mov -0x6c(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x80(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov %rax,-0x48(%rbp) movl $0x0,-0x68(%rbp) jmpq 1386 <func0+0x1bd> callq 10d0 <__ctype_b_loc@plt> mov (%rax),%rdx mov -0x48(%rbp),%rax movzbl (%rax),%eax movsbq %al,%rax add %rax,%rax add %rdx,%rax movzwl (%rax),%eax movzwl %ax,%eax and $0x2000,%eax test %eax,%eax jne 1268 <func0+0x9f> mov -0x68(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x68(%rbp) mov -0x48(%rbp),%rdx movzbl (%rdx),%edx cltq mov %dl,-0x40(%rbp,%rax,1) jmpq 1381 <func0+0x1b8> cmpl $0x0,-0x68(%rbp) jle 1381 <func0+0x1b8> mov -0x68(%rbp),%eax cltq movb $0x0,-0x40(%rbp,%rax,1) movl $0x0,-0x64(%rbp) movl $0x0,-0x60(%rbp) jmpq 1312 <func0+0x149> mov -0x60(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax lea 0x2d96(%rip),%rdx add %rax,%rdx lea -0x40(%rbp),%rax mov %rax,%rsi mov %rdx,%rdi callq 10c0 <strcmp@plt> test %eax,%eax jne 130e <func0+0x145> mov -0x60(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax mov %rax,%rdx lea 0x2d96(%rip),%rax mov (%rdx,%rax,1),%eax lea 0x1(%rax),%ecx mov -0x60(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax mov %rax,%rdx lea 0x2d72(%rip),%rax mov %ecx,(%rdx,%rax,1) movl $0x1,-0x64(%rbp) jmp 131e <func0+0x155> addl $0x1,-0x60(%rbp) mov -0x60(%rbp),%eax cmp -0x70(%rbp),%eax jl 128f <func0+0xc6> cmpl $0x0,-0x64(%rbp) jne 137a <func0+0x1b1> mov -0x70(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax lea 0x2d01(%rip),%rdx add %rax,%rdx lea -0x40(%rbp),%rax mov %rax,%rsi mov %rdx,%rdi callq 1090 <strcpy@plt> mov -0x70(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax mov %rax,%rdx lea 0x2d05(%rip),%rax movl $0x1,(%rdx,%rax,1) addl $0x1,-0x70(%rbp) movl $0x0,-0x68(%rbp) addq $0x1,-0x48(%rbp) mov -0x48(%rbp),%rax movzbl (%rax),%eax test %al,%al jne 1225 <func0+0x5c> cmpl $0x0,-0x68(%rbp) jle 14a7 <func0+0x2de> mov -0x68(%rbp),%eax cltq movb $0x0,-0x40(%rbp,%rax,1) movl $0x0,-0x5c(%rbp) movl $0x0,-0x58(%rbp) jmpq 143f <func0+0x276> mov -0x58(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax lea 0x2c69(%rip),%rdx add %rax,%rdx lea -0x40(%rbp),%rax mov %rax,%rsi mov %rdx,%rdi callq 10c0 <strcmp@plt> test %eax,%eax jne 143b <func0+0x272> mov -0x58(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax mov %rax,%rdx lea 0x2c69(%rip),%rax mov (%rdx,%rax,1),%eax lea 0x1(%rax),%ecx mov -0x58(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax mov %rax,%rdx lea 0x2c45(%rip),%rax mov %ecx,(%rdx,%rax,1) movl $0x1,-0x5c(%rbp) jmp 144b <func0+0x282> addl $0x1,-0x58(%rbp) mov -0x58(%rbp),%eax cmp -0x70(%rbp),%eax jl 13bc <func0+0x1f3> cmpl $0x0,-0x5c(%rbp) jne 14a7 <func0+0x2de> mov -0x70(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax lea 0x2bd4(%rip),%rdx add %rax,%rdx lea -0x40(%rbp),%rax mov %rax,%rsi mov %rdx,%rdi callq 1090 <strcpy@plt> mov -0x70(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax mov %rax,%rdx lea 0x2bd8(%rip),%rax movl $0x1,(%rdx,%rax,1) addl $0x1,-0x70(%rbp) addl $0x1,-0x6c(%rbp) mov -0x6c(%rbp),%eax cmp -0x74(%rbp),%eax jl 11fe <func0+0x35> movl $0x0,-0x54(%rbp) movl $0x0,-0x50(%rbp) movl $0x0,-0x4c(%rbp) jmp 1522 <func0+0x359> mov -0x4c(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax mov %rax,%rdx lea 0x2b88(%rip),%rax mov (%rdx,%rax,1),%eax cmp %eax,-0x54(%rbp) jge 151e <func0+0x355> mov -0x4c(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax mov %rax,%rdx lea 0x2b62(%rip),%rax mov (%rdx,%rax,1),%eax mov %eax,-0x54(%rbp) mov -0x4c(%rbp),%eax mov %eax,-0x50(%rbp) addl $0x1,-0x4c(%rbp) mov -0x4c(%rbp),%eax cmp -0x70(%rbp),%eax jl 14ce <func0+0x305> mov -0x50(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x3,%rax sub %rdx,%rax shl $0x3,%rax lea 0x2afb(%rip),%rdx add %rdx,%rax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 155c <func0+0x393> callq 10a0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp add rsp, 0FFFFFFFFFFFFFF80h mov [rbp+var_74], edi mov [rbp+var_80], rsi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov [rbp+var_70], 0 mov [rbp+var_6C], 0 jmp loc_14AB loc_11FE: mov eax, [rbp+var_6C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_80] add rax, rdx mov rax, [rax] mov [rbp+var_48], rax mov [rbp+var_68], 0 jmp loc_1386 loc_1225: call ___ctype_b_loc mov rdx, [rax] mov rax, [rbp+var_48] movzx eax, byte ptr [rax] movsx rax, al add rax, rax add rax, rdx movzx eax, word ptr [rax] movzx eax, ax and eax, 2000h test eax, eax jnz short loc_1268 mov eax, [rbp+var_68] lea edx, [rax+1] mov [rbp+var_68], edx mov rdx, [rbp+var_48] movzx edx, byte ptr [rdx] cdqe mov [rbp+rax+s2], dl jmp loc_1381 loc_1268: cmp [rbp+var_68], 0 jle loc_1381 mov eax, [rbp+var_68] cdqe mov [rbp+rax+s2], 0 mov [rbp+var_64], 0 mov [rbp+var_60], 0 jmp loc_1312 loc_128F: mov eax, [rbp+var_60] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 lea rdx, words_1 add rdx, rax lea rax, [rbp+s2] mov rsi, rax; s2 mov rdi, rdx; s1 call _strcmp test eax, eax jnz short loc_130E mov eax, [rbp+var_60] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 mov rdx, rax lea rax, unk_4074 mov eax, [rdx+rax] lea ecx, [rax+1] mov eax, [rbp+var_60] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 mov rdx, rax lea rax, unk_4074 mov [rdx+rax], ecx mov [rbp+var_64], 1 jmp short loc_131E loc_130E: add [rbp+var_60], 1 loc_1312: mov eax, [rbp+var_60] cmp eax, [rbp+var_70] jl loc_128F loc_131E: cmp [rbp+var_64], 0 jnz short loc_137A mov eax, [rbp+var_70] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 lea rdx, words_1 add rdx, rax lea rax, [rbp+s2] mov rsi, rax; src mov rdi, rdx; dest call _strcpy mov eax, [rbp+var_70] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 mov rdx, rax lea rax, unk_4074 mov dword ptr [rdx+rax], 1 add [rbp+var_70], 1 loc_137A: mov [rbp+var_68], 0 loc_1381: add [rbp+var_48], 1 loc_1386: mov rax, [rbp+var_48] movzx eax, byte ptr [rax] test al, al jnz loc_1225 cmp [rbp+var_68], 0 jle loc_14A7 mov eax, [rbp+var_68] cdqe mov [rbp+rax+s2], 0 mov [rbp+var_5C], 0 mov [rbp+var_58], 0 jmp loc_143F loc_13BC: mov eax, [rbp+var_58] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 lea rdx, words_1 add rdx, rax lea rax, [rbp+s2] mov rsi, rax; s2 mov rdi, rdx; s1 call _strcmp test eax, eax jnz short loc_143B mov eax, [rbp+var_58] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 mov rdx, rax lea rax, unk_4074 mov eax, [rdx+rax] lea ecx, [rax+1] mov eax, [rbp+var_58] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 mov rdx, rax lea rax, unk_4074 mov [rdx+rax], ecx mov [rbp+var_5C], 1 jmp short loc_144B loc_143B: add [rbp+var_58], 1 loc_143F: mov eax, [rbp+var_58] cmp eax, [rbp+var_70] jl loc_13BC loc_144B: cmp [rbp+var_5C], 0 jnz short loc_14A7 mov eax, [rbp+var_70] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 lea rdx, words_1 add rdx, rax lea rax, [rbp+s2] mov rsi, rax; src mov rdi, rdx; dest call _strcpy mov eax, [rbp+var_70] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 mov rdx, rax lea rax, unk_4074 mov dword ptr [rdx+rax], 1 add [rbp+var_70], 1 loc_14A7: add [rbp+var_6C], 1 loc_14AB: mov eax, [rbp+var_6C] cmp eax, [rbp+var_74] jl loc_11FE mov [rbp+var_54], 0 mov [rbp+var_50], 0 mov [rbp+var_4C], 0 jmp short loc_1522 loc_14CE: mov eax, [rbp+var_4C] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 mov rdx, rax lea rax, unk_4074 mov eax, [rdx+rax] cmp [rbp+var_54], eax jge short loc_151E mov eax, [rbp+var_4C] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 mov rdx, rax lea rax, unk_4074 mov eax, [rdx+rax] mov [rbp+var_54], eax mov eax, [rbp+var_4C] mov [rbp+var_50], eax loc_151E: add [rbp+var_4C], 1 loc_1522: mov eax, [rbp+var_4C] cmp eax, [rbp+var_70] jl short loc_14CE mov eax, [rbp+var_50] movsxd rdx, eax mov rax, rdx shl rax, 3 sub rax, rdx shl rax, 3 lea rdx, words_1 add rax, rdx mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_155C call ___stack_chk_fail locret_155C: leave retn
char * func0(int a1, long long a2) { int v2; // eax int v4; // [rsp+10h] [rbp-70h] int i; // [rsp+14h] [rbp-6Ch] int v6; // [rsp+18h] [rbp-68h] int v7; // [rsp+1Ch] [rbp-64h] int j; // [rsp+20h] [rbp-60h] int v9; // [rsp+24h] [rbp-5Ch] int k; // [rsp+28h] [rbp-58h] int v11; // [rsp+2Ch] [rbp-54h] int v12; // [rsp+30h] [rbp-50h] int m; // [rsp+34h] [rbp-4Ch] char *v14; // [rsp+38h] [rbp-48h] char s2[56]; // [rsp+40h] [rbp-40h] BYREF unsigned long long v16; // [rsp+78h] [rbp-8h] v16 = __readfsqword(0x28u); v4 = 0; for ( i = 0; i < a1; ++i ) { v14 = *(char **)(8LL * i + a2); v6 = 0; while ( *v14 ) { if ( ((*__ctype_b_loc())[*v14] & 0x2000) != 0 ) { if ( v6 > 0 ) { s2[v6] = 0; v7 = 0; for ( j = 0; j < v4; ++j ) { if ( !strcmp((const char *)&words_1 + 56 * j, s2) ) { ++dword_4074[14 * j]; v7 = 1; break; } } if ( !v7 ) { strcpy((char *)&words_1 + 56 * v4, s2); dword_4074[14 * v4++] = 1; } v6 = 0; } } else { v2 = v6++; s2[v2] = *v14; } ++v14; } if ( v6 > 0 ) { s2[v6] = 0; v9 = 0; for ( k = 0; k < v4; ++k ) { if ( !strcmp((const char *)&words_1 + 56 * k, s2) ) { ++dword_4074[14 * k]; v9 = 1; break; } } if ( !v9 ) { strcpy((char *)&words_1 + 56 * v4, s2); dword_4074[14 * v4++] = 1; } } } v11 = 0; v12 = 0; for ( m = 0; m < v4; ++m ) { if ( v11 < dword_4074[14 * m] ) { v11 = dword_4074[14 * m]; v12 = m; } } return (char *)&words_1 + 56 * v12; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP ADD RSP,-0x80 MOV dword ptr [RBP + -0x74],EDI MOV qword ptr [RBP + -0x80],RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV dword ptr [RBP + -0x70],0x0 MOV dword ptr [RBP + -0x6c],0x0 JMP 0x001014ab LAB_001011fe: MOV EAX,dword ptr [RBP + -0x6c] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x80] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV qword ptr [RBP + -0x48],RAX MOV dword ptr [RBP + -0x68],0x0 JMP 0x00101386 LAB_00101225: CALL 0x001010d0 MOV RDX,qword ptr [RAX] MOV RAX,qword ptr [RBP + -0x48] MOVZX EAX,byte ptr [RAX] MOVSX RAX,AL ADD RAX,RAX ADD RAX,RDX MOVZX EAX,word ptr [RAX] MOVZX EAX,AX AND EAX,0x2000 TEST EAX,EAX JNZ 0x00101268 MOV EAX,dword ptr [RBP + -0x68] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x68],EDX MOV RDX,qword ptr [RBP + -0x48] MOVZX EDX,byte ptr [RDX] CDQE MOV byte ptr [RBP + RAX*0x1 + -0x40],DL JMP 0x00101381 LAB_00101268: CMP dword ptr [RBP + -0x68],0x0 JLE 0x00101381 MOV EAX,dword ptr [RBP + -0x68] CDQE MOV byte ptr [RBP + RAX*0x1 + -0x40],0x0 MOV dword ptr [RBP + -0x64],0x0 MOV dword ptr [RBP + -0x60],0x0 JMP 0x00101312 LAB_0010128f: MOV EAX,dword ptr [RBP + -0x60] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 LEA RDX,[0x104040] ADD RDX,RAX LEA RAX,[RBP + -0x40] MOV RSI,RAX MOV RDI,RDX CALL 0x001010c0 TEST EAX,EAX JNZ 0x0010130e MOV EAX,dword ptr [RBP + -0x60] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 MOV RDX,RAX LEA RAX,[0x104074] MOV EAX,dword ptr [RDX + RAX*0x1] LEA ECX,[RAX + 0x1] MOV EAX,dword ptr [RBP + -0x60] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 MOV RDX,RAX LEA RAX,[0x104074] MOV dword ptr [RDX + RAX*0x1],ECX MOV dword ptr [RBP + -0x64],0x1 JMP 0x0010131e LAB_0010130e: ADD dword ptr [RBP + -0x60],0x1 LAB_00101312: MOV EAX,dword ptr [RBP + -0x60] CMP EAX,dword ptr [RBP + -0x70] JL 0x0010128f LAB_0010131e: CMP dword ptr [RBP + -0x64],0x0 JNZ 0x0010137a MOV EAX,dword ptr [RBP + -0x70] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 LEA RDX,[0x104040] ADD RDX,RAX LEA RAX,[RBP + -0x40] MOV RSI,RAX MOV RDI,RDX CALL 0x00101090 MOV EAX,dword ptr [RBP + -0x70] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 MOV RDX,RAX LEA RAX,[0x104074] MOV dword ptr [RDX + RAX*0x1],0x1 ADD dword ptr [RBP + -0x70],0x1 LAB_0010137a: MOV dword ptr [RBP + -0x68],0x0 LAB_00101381: ADD qword ptr [RBP + -0x48],0x1 LAB_00101386: MOV RAX,qword ptr [RBP + -0x48] MOVZX EAX,byte ptr [RAX] TEST AL,AL JNZ 0x00101225 CMP dword ptr [RBP + -0x68],0x0 JLE 0x001014a7 MOV EAX,dword ptr [RBP + -0x68] CDQE MOV byte ptr [RBP + RAX*0x1 + -0x40],0x0 MOV dword ptr [RBP + -0x5c],0x0 MOV dword ptr [RBP + -0x58],0x0 JMP 0x0010143f LAB_001013bc: MOV EAX,dword ptr [RBP + -0x58] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 LEA RDX,[0x104040] ADD RDX,RAX LEA RAX,[RBP + -0x40] MOV RSI,RAX MOV RDI,RDX CALL 0x001010c0 TEST EAX,EAX JNZ 0x0010143b MOV EAX,dword ptr [RBP + -0x58] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 MOV RDX,RAX LEA RAX,[0x104074] MOV EAX,dword ptr [RDX + RAX*0x1] LEA ECX,[RAX + 0x1] MOV EAX,dword ptr [RBP + -0x58] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 MOV RDX,RAX LEA RAX,[0x104074] MOV dword ptr [RDX + RAX*0x1],ECX MOV dword ptr [RBP + -0x5c],0x1 JMP 0x0010144b LAB_0010143b: ADD dword ptr [RBP + -0x58],0x1 LAB_0010143f: MOV EAX,dword ptr [RBP + -0x58] CMP EAX,dword ptr [RBP + -0x70] JL 0x001013bc LAB_0010144b: CMP dword ptr [RBP + -0x5c],0x0 JNZ 0x001014a7 MOV EAX,dword ptr [RBP + -0x70] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 LEA RDX,[0x104040] ADD RDX,RAX LEA RAX,[RBP + -0x40] MOV RSI,RAX MOV RDI,RDX CALL 0x00101090 MOV EAX,dword ptr [RBP + -0x70] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 MOV RDX,RAX LEA RAX,[0x104074] MOV dword ptr [RDX + RAX*0x1],0x1 ADD dword ptr [RBP + -0x70],0x1 LAB_001014a7: ADD dword ptr [RBP + -0x6c],0x1 LAB_001014ab: MOV EAX,dword ptr [RBP + -0x6c] CMP EAX,dword ptr [RBP + -0x74] JL 0x001011fe MOV dword ptr [RBP + -0x54],0x0 MOV dword ptr [RBP + -0x50],0x0 MOV dword ptr [RBP + -0x4c],0x0 JMP 0x00101522 LAB_001014ce: MOV EAX,dword ptr [RBP + -0x4c] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 MOV RDX,RAX LEA RAX,[0x104074] MOV EAX,dword ptr [RDX + RAX*0x1] CMP dword ptr [RBP + -0x54],EAX JGE 0x0010151e MOV EAX,dword ptr [RBP + -0x4c] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 MOV RDX,RAX LEA RAX,[0x104074] MOV EAX,dword ptr [RDX + RAX*0x1] MOV dword ptr [RBP + -0x54],EAX MOV EAX,dword ptr [RBP + -0x4c] MOV dword ptr [RBP + -0x50],EAX LAB_0010151e: ADD dword ptr [RBP + -0x4c],0x1 LAB_00101522: MOV EAX,dword ptr [RBP + -0x4c] CMP EAX,dword ptr [RBP + -0x70] JL 0x001014ce MOV EAX,dword ptr [RBP + -0x50] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x3 SUB RAX,RDX SHL RAX,0x3 LEA RDX,[0x104040] ADD RAX,RDX MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x0010155c CALL 0x001010a0 LAB_0010155c: LEAVE RET
int1 * func0(int param_1,long param_2) { bool bVar1; int iVar2; ushort **ppuVar3; long in_FS_OFFSET; int local_78; int local_74; int local_70; int local_68; int local_60; int local_5c; int local_58; int local_54; char *local_50; char local_48 [56]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_78 = 0; local_74 = 0; do { if (param_1 <= local_74) { local_5c = 0; local_58 = 0; for (local_54 = 0; local_54 < local_78; local_54 = local_54 + 1) { if (local_5c < *(int *)(words_1 + (long)local_54 * 0x38 + 0x34)) { local_5c = *(int *)(words_1 + (long)local_54 * 0x38 + 0x34); local_58 = local_54; } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return words_1 + (long)local_58 * 0x38; } local_50 = *(char **)(param_2 + (long)local_74 * 8); local_70 = 0; for (; *local_50 != '\0'; local_50 = local_50 + 1) { ppuVar3 = __ctype_b_loc(); if (((*ppuVar3)[*local_50] & 0x2000) == 0) { local_48[local_70] = *local_50; local_70 = local_70 + 1; } else if (0 < local_70) { local_48[local_70] = '\0'; bVar1 = false; for (local_68 = 0; local_68 < local_78; local_68 = local_68 + 1) { iVar2 = strcmp(words_1 + (long)local_68 * 0x38,local_48); if (iVar2 == 0) { *(int *)(words_1 + (long)local_68 * 0x38 + 0x34) = *(int *)(words_1 + (long)local_68 * 0x38 + 0x34) + 1; bVar1 = true; break; } } if (!bVar1) { strcpy(words_1 + (long)local_78 * 0x38,local_48); *(int4 *)(words_1 + (long)local_78 * 0x38 + 0x34) = 1; local_78 = local_78 + 1; } local_70 = 0; } } if (0 < local_70) { local_48[local_70] = '\0'; bVar1 = false; for (local_60 = 0; local_60 < local_78; local_60 = local_60 + 1) { iVar2 = strcmp(words_1 + (long)local_60 * 0x38,local_48); if (iVar2 == 0) { *(int *)(words_1 + (long)local_60 * 0x38 + 0x34) = *(int *)(words_1 + (long)local_60 * 0x38 + 0x34) + 1; bVar1 = true; break; } } if (!bVar1) { strcpy(words_1 + (long)local_78 * 0x38,local_48); *(int4 *)(words_1 + (long)local_78 * 0x38 + 0x34) = 1; local_78 = local_78 + 1; } } local_74 = local_74 + 1; } while( true ); }
5,197
func0
#include <assert.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> typedef struct { char word[50]; int count; } WordCount;
const char* func0(int n, const char* test_list[]) { static WordCount words[100]; int unique = 0; for(int i=0;i<n;i++) { const char* str = test_list[i]; char word[50]; int pos =0; while(*str) { if(!isspace(*str)) { word[pos++] = *str; } else { if(pos >0) { word[pos] = '\0'; // check if word exists int found = 0; for(int j=0;j<unique;j++) { if(strcmp(words[j].word, word) ==0){ words[j].count++; found =1; break; } } if(!found){ strcpy(words[unique].word, word); words[unique].count =1; unique++; } pos=0; } } str++; } if(pos >0){ word[pos] = '\0'; int found =0; for(int j=0;j<unique;j++) { if(strcmp(words[j].word, word) ==0){ words[j].count++; found =1; break; } } if(!found){ strcpy(words[unique].word, word); words[unique].count =1; unique++; } } } // find max int max =0; int index =0; for(int i=0;i<unique;i++) { if(words[i].count > max){ max = words[i].count; index =i; } } return words[index].word; }
int main(){ const char* test1[] = {"UTS is best for RTF", "RTF love UTS", "UTS is best"}; assert(strcmp(func0(3, test1), "UTS") == 0); const char* test2[] = {"Its been a great year", "this year is so worse", "this year is okay"}; assert(strcmp(func0(3, test2), "year") == 0); const char* test3[] = {"Families can be reunited", "people can be reunited", "Tasks can be achieved "}; assert(strcmp(func0(3, test3), "can") == 0); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x58,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax test %edi,%edi jle 13f2 <func0+0x229> mov %rsi,(%rsp) lea -0x1(%rdi),%eax lea 0x8(%rsi,%rax,8),%rax mov %rax,0x8(%rsp) mov $0x0,%r13d jmpq 12fb <func0+0x132> test %eax,%eax jg 123e <func0+0x75> add $0x1,%r12 movzbl (%r12),%ebx test %bl,%bl je 12e3 <func0+0x11a> movsbq %bl,%rdx mov (%r15),%rcx testb $0x20,0x1(%rcx,%rdx,2) jne 120f <func0+0x46> movslq %eax,%rdx mov %bl,0x10(%rsp,%rdx,1) lea 0x1(%rax),%eax jmp 1213 <func0+0x4a> cltq movb $0x0,0x10(%rsp,%rax,1) test %r13d,%r13d jle 1276 <func0+0xad> lea 0x2def(%rip),%rbp mov $0x0,%ebx lea 0x10(%rsp),%r14 mov %r14,%rsi mov %rbp,%rdi callq 10b0 <strcmp@plt> test %eax,%eax je 12bb <func0+0xf2> add $0x1,%ebx add $0x38,%rbp cmp %r13d,%ebx jne 125b <func0+0x92> lea 0x10(%rsp),%rsi movslq %r13d,%rbx lea 0x0(,%rbx,8),%rbp mov %rbp,%rax sub %rbx,%rax lea 0x2dad(%rip),%r14 lea (%r14,%rax,8),%rdi mov $0x32,%edx callq 10c0 <__strcpy_chk@plt> sub %rbx,%rbp movl $0x1,0x34(%r14,%rbp,8) add $0x1,%r13d mov $0x0,%eax jmpq 1213 <func0+0x4a> movslq %ebx,%rbx lea 0x0(,%rbx,8),%rdx mov %rdx,%rcx sub %rbx,%rcx lea 0x2d6d(%rip),%rdi mov 0x34(%rdi,%rcx,8),%edx add $0x1,%edx mov %edx,0x34(%rdi,%rcx,8) jmpq 1213 <func0+0x4a> test %eax,%eax jg 131d <func0+0x154> addq $0x8,(%rsp) mov (%rsp),%rax cmp 0x8(%rsp),%rax je 13bd <func0+0x1f4> mov (%rsp),%rax mov (%rax),%r12 movzbl (%r12),%ebx test %bl,%bl je 12e7 <func0+0x11e> callq 10d0 <__ctype_b_loc@plt> mov %rax,%r15 mov $0x0,%eax jmpq 1224 <func0+0x5b> cltq movb $0x0,0x10(%rsp,%rax,1) test %r13d,%r13d jle 1355 <func0+0x18c> lea 0x2d10(%rip),%rbp mov $0x0,%ebx lea 0x10(%rsp),%r12 mov %r12,%rsi mov %rbp,%rdi callq 10b0 <strcmp@plt> test %eax,%eax je 1395 <func0+0x1cc> add $0x1,%ebx add $0x38,%rbp cmp %ebx,%r13d jne 133a <func0+0x171> lea 0x10(%rsp),%rsi movslq %r13d,%rbp lea 0x0(,%rbp,8),%rbx mov %rbx,%rax sub %rbp,%rax lea 0x2cce(%rip),%r15 lea (%r15,%rax,8),%rdi mov $0x32,%edx callq 10c0 <__strcpy_chk@plt> sub %rbp,%rbx movl $0x1,0x34(%r15,%rbx,8) add $0x1,%r13d jmpq 12e7 <func0+0x11e> movslq %ebx,%rbx lea 0x0(,%rbx,8),%rax mov %rax,%rdx sub %rbx,%rdx lea 0x2c93(%rip),%rcx mov 0x34(%rcx,%rdx,8),%eax add $0x1,%eax mov %eax,0x34(%rcx,%rdx,8) jmpq 12e7 <func0+0x11e> test %r13d,%r13d jle 142f <func0+0x266> lea 0x2cab(%rip),%rdx mov $0x0,%eax mov $0x0,%edi mov $0x0,%esi jmp 13e6 <func0+0x21d> add $0x1,%eax add $0x38,%rdx cmp %eax,%r13d je 13f7 <func0+0x22e> mov (%rdx),%ecx cmp %esi,%ecx jle 13da <func0+0x211> mov %eax,%edi mov %ecx,%esi jmp 13da <func0+0x211> mov $0x0,%edi movslq %edi,%rdi lea 0x0(,%rdi,8),%rax sub %rdi,%rax lea 0x2c34(%rip),%rdx lea (%rdx,%rax,8),%rax mov 0x48(%rsp),%rsi xor %fs:0x28,%rsi jne 1436 <func0+0x26d> add $0x58,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq mov $0x0,%edi jmp 13f7 <func0+0x22e> callq 1090 <__stack_chk_fail@plt>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 58h mov rax, fs:28h mov [rsp+88h+var_40], rax xor eax, eax test edi, edi jle loc_13F2 mov [rsp+88h+var_88], rsi lea eax, [rdi-1] lea rax, [rsi+rax*8+8] mov [rsp+88h+var_80], rax mov r13d, 0 jmp loc_12FB loc_120F: test eax, eax jg short loc_123E loc_1213: add r12, 1 movzx ebx, byte ptr [r12] test bl, bl jz loc_12E3 loc_1224: movsx rdx, bl mov rcx, [r15] test byte ptr [rcx+rdx*2+1], 20h jnz short loc_120F movsxd rdx, eax mov [rsp+rdx+88h+var_78], bl lea eax, [rax+1] jmp short loc_1213 loc_123E: cdqe mov [rsp+rax+88h+var_78], 0 test r13d, r13d jle short loc_1276 lea rbp, words_1 mov ebx, 0 lea r14, [rsp+88h+var_78] loc_125B: mov rsi, r14 mov rdi, rbp call _strcmp test eax, eax jz short loc_12BB add ebx, 1 add rbp, 38h ; '8' cmp ebx, r13d jnz short loc_125B loc_1276: lea rsi, [rsp+88h+var_78] movsxd rbp, r13d lea rbx, ds:0[rbp*8] mov rax, rbx sub rax, rbp lea r14, words_1 lea rdi, [r14+rax*8] mov edx, 32h ; '2' call ___strcpy_chk sub rbx, rbp mov dword ptr [r14+rbx*8+34h], 1 add r13d, 1 mov eax, 0 jmp loc_1213 loc_12BB: movsxd rbx, ebx lea rdx, ds:0[rbx*8] mov rcx, rdx sub rcx, rbx lea rdi, words_1 mov edx, [rdi+rcx*8+34h] add edx, 1 mov [rdi+rcx*8+34h], edx jmp loc_1213 loc_12E3: test eax, eax jg short loc_131D loc_12E7: add [rsp+88h+var_88], 8 mov rax, [rsp+88h+var_88] cmp rax, [rsp+88h+var_80] jz loc_13BD loc_12FB: mov rax, [rsp+88h+var_88] mov r12, [rax] movzx ebx, byte ptr [r12] test bl, bl jz short loc_12E7 call ___ctype_b_loc mov r15, rax mov eax, 0 jmp loc_1224 loc_131D: cdqe mov [rsp+rax+88h+var_78], 0 test r13d, r13d jle short loc_1355 lea rbp, words_1 mov ebx, 0 lea r12, [rsp+88h+var_78] loc_133A: mov rsi, r12 mov rdi, rbp call _strcmp test eax, eax jz short loc_1395 add ebx, 1 add rbp, 38h ; '8' cmp r13d, ebx jnz short loc_133A loc_1355: lea rsi, [rsp+88h+var_78] movsxd rbp, r13d lea rbx, ds:0[rbp*8] mov rax, rbx sub rax, rbp lea r15, words_1 lea rdi, [r15+rax*8] mov edx, 32h ; '2' call ___strcpy_chk sub rbx, rbp mov dword ptr [r15+rbx*8+34h], 1 add r13d, 1 jmp loc_12E7 loc_1395: movsxd rbx, ebx lea rax, ds:0[rbx*8] mov rdx, rax sub rdx, rbx lea rcx, words_1 mov eax, [rcx+rdx*8+34h] add eax, 1 mov [rcx+rdx*8+34h], eax jmp loc_12E7 loc_13BD: test r13d, r13d jle short loc_142F lea rdx, unk_4074 mov eax, 0 mov edi, 0 mov esi, 0 jmp short loc_13E6 loc_13DA: add eax, 1 add rdx, 38h ; '8' cmp r13d, eax jz short loc_13F7 loc_13E6: mov ecx, [rdx] cmp ecx, esi jle short loc_13DA mov edi, eax mov esi, ecx jmp short loc_13DA loc_13F2: mov edi, 0 loc_13F7: movsxd rdi, edi lea rax, ds:0[rdi*8] sub rax, rdi lea rdx, words_1 lea rax, [rdx+rax*8] mov rdx, [rsp+88h+var_40] sub rdx, fs:28h jnz short loc_1436 add rsp, 58h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_142F: mov edi, 0 jmp short loc_13F7 loc_1436: call ___stack_chk_fail
char * func0(int a1, char **a2) { int v2; // r13d char *v3; // r12 char v4; // bl int v5; // eax char *v6; // rbp int v7; // ebx _QWORD *v8; // r15 char *v9; // rbp int v10; // ebx int *v11; // rdx int v12; // eax int v13; // edi int v14; // esi char **v16; // [rsp+0h] [rbp-88h] _BYTE v17[56]; // [rsp+10h] [rbp-78h] BYREF unsigned long long v18; // [rsp+48h] [rbp-40h] v18 = __readfsqword(0x28u); if ( a1 <= 0 ) { v13 = 0; } else { v16 = a2; v2 = 0; do { v3 = *v16; v4 = **v16; if ( v4 ) { v8 = (_QWORD *)__ctype_b_loc(); v5 = 0; do { if ( (*(_BYTE *)(*v8 + 2LL * v4 + 1) & 0x20) != 0 ) { if ( v5 > 0 ) { v17[v5] = 0; if ( v2 <= 0 ) { LABEL_11: __strcpy_chk((char *)&words_1 + 56 * v2, v17, 50LL); *((_DWORD *)&words_1 + 14 * v2++ + 13) = 1; v5 = 0; } else { v6 = (char *)&words_1; v7 = 0; while ( 1 ) { v5 = strcmp(v6, v17); if ( !v5 ) break; ++v7; v6 += 56; if ( v7 == v2 ) goto LABEL_11; } ++*((_DWORD *)&words_1 + 14 * v7 + 13); } } } else { v17[v5++] = v4; } v4 = *++v3; } while ( *v3 ); if ( v5 > 0 ) { v17[v5] = 0; if ( v2 <= 0 ) { LABEL_21: __strcpy_chk((char *)&words_1 + 56 * v2, v17, 50LL); *((_DWORD *)&words_1 + 14 * v2++ + 13) = 1; } else { v9 = (char *)&words_1; v10 = 0; while ( (unsigned int)strcmp(v9, v17) ) { ++v10; v9 += 56; if ( v2 == v10 ) goto LABEL_21; } ++*((_DWORD *)&words_1 + 14 * v10 + 13); } } } ++v16; } while ( v16 != &a2[(unsigned int)(a1 - 1) + 1] ); if ( v2 <= 0 ) { v13 = 0; } else { v11 = (int *)&unk_4074; v12 = 0; v13 = 0; v14 = 0; do { if ( *v11 > v14 ) { v13 = v12; v14 = *v11; } ++v12; v11 += 14; } while ( v2 != v12 ); } } return (char *)&words_1 + 56 * v13; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x58 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX TEST EDI,EDI JLE 0x001013f2 MOV qword ptr [RSP],RSI LEA EAX,[RDI + -0x1] LEA RAX,[RSI + RAX*0x8 + 0x8] MOV qword ptr [RSP + 0x8],RAX MOV R13D,0x0 JMP 0x001012fb LAB_0010120f: TEST EAX,EAX JG 0x0010123e LAB_00101213: ADD R12,0x1 MOVZX EBX,byte ptr [R12] TEST BL,BL JZ 0x001012e3 LAB_00101224: MOVSX RDX,BL MOV RCX,qword ptr [R15] TEST byte ptr [RCX + RDX*0x2 + 0x1],0x20 JNZ 0x0010120f MOVSXD RDX,EAX MOV byte ptr [RSP + RDX*0x1 + 0x10],BL LEA EAX,[RAX + 0x1] JMP 0x00101213 LAB_0010123e: CDQE MOV byte ptr [RSP + RAX*0x1 + 0x10],0x0 TEST R13D,R13D JLE 0x00101276 LEA RBP,[0x104040] MOV EBX,0x0 LEA R14,[RSP + 0x10] LAB_0010125b: MOV RSI,R14 MOV RDI,RBP CALL 0x001010b0 TEST EAX,EAX JZ 0x001012bb ADD EBX,0x1 ADD RBP,0x38 CMP EBX,R13D JNZ 0x0010125b LAB_00101276: LEA RSI,[RSP + 0x10] MOVSXD RBP,R13D LEA RBX,[RBP*0x8] MOV RAX,RBX SUB RAX,RBP LEA R14,[0x104040] LEA RDI,[R14 + RAX*0x8] MOV EDX,0x32 CALL 0x001010c0 SUB RBX,RBP MOV dword ptr [R14 + RBX*0x8 + 0x34],0x1 ADD R13D,0x1 MOV EAX,0x0 JMP 0x00101213 LAB_001012bb: MOVSXD RBX,EBX LEA RDX,[RBX*0x8] MOV RCX,RDX SUB RCX,RBX LEA RDI,[0x104040] MOV EDX,dword ptr [RDI + RCX*0x8 + 0x34] ADD EDX,0x1 MOV dword ptr [RDI + RCX*0x8 + 0x34],EDX JMP 0x00101213 LAB_001012e3: TEST EAX,EAX JG 0x0010131d LAB_001012e7: ADD qword ptr [RSP],0x8 MOV RAX,qword ptr [RSP] CMP RAX,qword ptr [RSP + 0x8] JZ 0x001013bd LAB_001012fb: MOV RAX,qword ptr [RSP] MOV R12,qword ptr [RAX] MOVZX EBX,byte ptr [R12] TEST BL,BL JZ 0x001012e7 CALL 0x001010d0 MOV R15,RAX MOV EAX,0x0 JMP 0x00101224 LAB_0010131d: CDQE MOV byte ptr [RSP + RAX*0x1 + 0x10],0x0 TEST R13D,R13D JLE 0x00101355 LEA RBP,[0x104040] MOV EBX,0x0 LEA R12,[RSP + 0x10] LAB_0010133a: MOV RSI,R12 MOV RDI,RBP CALL 0x001010b0 TEST EAX,EAX JZ 0x00101395 ADD EBX,0x1 ADD RBP,0x38 CMP R13D,EBX JNZ 0x0010133a LAB_00101355: LEA RSI,[RSP + 0x10] MOVSXD RBP,R13D LEA RBX,[RBP*0x8] MOV RAX,RBX SUB RAX,RBP LEA R15,[0x104040] LEA RDI,[R15 + RAX*0x8] MOV EDX,0x32 CALL 0x001010c0 SUB RBX,RBP MOV dword ptr [R15 + RBX*0x8 + 0x34],0x1 ADD R13D,0x1 JMP 0x001012e7 LAB_00101395: MOVSXD RBX,EBX LEA RAX,[RBX*0x8] MOV RDX,RAX SUB RDX,RBX LEA RCX,[0x104040] MOV EAX,dword ptr [RCX + RDX*0x8 + 0x34] ADD EAX,0x1 MOV dword ptr [RCX + RDX*0x8 + 0x34],EAX JMP 0x001012e7 LAB_001013bd: TEST R13D,R13D JLE 0x0010142f LEA RDX,[0x104074] MOV EAX,0x0 MOV EDI,0x0 MOV ESI,0x0 JMP 0x001013e6 LAB_001013da: ADD EAX,0x1 ADD RDX,0x38 CMP R13D,EAX JZ 0x001013f7 LAB_001013e6: MOV ECX,dword ptr [RDX] CMP ECX,ESI JLE 0x001013da MOV EDI,EAX MOV ESI,ECX JMP 0x001013da LAB_001013f2: MOV EDI,0x0 LAB_001013f7: MOVSXD RDI,EDI LEA RAX,[RDI*0x8] SUB RAX,RDI LEA RDX,[0x104040] LEA RAX,[RDX + RAX*0x8] MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101436 ADD RSP,0x58 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010142f: MOV EDI,0x0 JMP 0x001013f7 LAB_00101436: CALL 0x00101090
int1 * func0(int param_1,int8 *param_2) { int iVar1; int iVar2; ushort **ppuVar3; int *piVar4; char cVar5; int iVar6; int1 *puVar7; char *pcVar8; int iVar9; long in_FS_OFFSET; int8 *local_88; char local_78 [56]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); if (param_1 < 1) { iVar6 = 0; } else { iVar9 = 0; local_88 = param_2; do { pcVar8 = (char *)*local_88; cVar5 = *pcVar8; if (cVar5 != '\0') { ppuVar3 = __ctype_b_loc(); iVar6 = 0; do { if ((*(byte *)((long)*ppuVar3 + (long)cVar5 * 2 + 1) & 0x20) == 0) { local_78[iVar6] = cVar5; iVar6 = iVar6 + 1; } else if (0 < iVar6) { local_78[iVar6] = '\0'; if (0 < iVar9) { puVar7 = words_1; iVar6 = 0; do { iVar1 = strcmp(puVar7,local_78); if (iVar1 == 0) { *(int *)(words_1 + (long)iVar6 * 0x38 + 0x34) = *(int *)(words_1 + (long)iVar6 * 0x38 + 0x34) + 1; iVar6 = 0; goto LAB_00101213; } iVar6 = iVar6 + 1; puVar7 = puVar7 + 0x38; } while (iVar6 != iVar9); } __strcpy_chk(words_1 + (long)iVar9 * 0x38,local_78,0x32); *(int4 *)(words_1 + (long)iVar9 * 0x38 + 0x34) = 1; iVar9 = iVar9 + 1; iVar6 = 0; } LAB_00101213: pcVar8 = pcVar8 + 1; cVar5 = *pcVar8; } while (cVar5 != '\0'); if (0 < iVar6) { local_78[iVar6] = '\0'; if (0 < iVar9) { puVar7 = words_1; iVar6 = 0; do { iVar1 = strcmp(puVar7,local_78); if (iVar1 == 0) { *(int *)(words_1 + (long)iVar6 * 0x38 + 0x34) = *(int *)(words_1 + (long)iVar6 * 0x38 + 0x34) + 1; goto LAB_001012e7; } iVar6 = iVar6 + 1; puVar7 = puVar7 + 0x38; } while (iVar9 != iVar6); } __strcpy_chk(words_1 + (long)iVar9 * 0x38,local_78,0x32); *(int4 *)(words_1 + (long)iVar9 * 0x38 + 0x34) = 1; iVar9 = iVar9 + 1; } } LAB_001012e7: local_88 = local_88 + 1; } while (local_88 != param_2 + (ulong)(param_1 - 1) + 1); if (iVar9 < 1) { iVar6 = 0; } else { piVar4 = (int *)(words_1 + 0x34); iVar2 = 0; iVar6 = 0; iVar1 = 0; do { if (iVar1 < *piVar4) { iVar1 = *piVar4; iVar6 = iVar2; } iVar2 = iVar2 + 1; piVar4 = piVar4 + 0xe; } while (iVar9 != iVar2); } } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return words_1 + (long)iVar6 * 0x38; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,198
func0
#include <assert.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> typedef struct { char word[50]; int count; } WordCount;
const char* func0(int n, const char* test_list[]) { static WordCount words[100]; int unique = 0; for(int i=0;i<n;i++) { const char* str = test_list[i]; char word[50]; int pos =0; while(*str) { if(!isspace(*str)) { word[pos++] = *str; } else { if(pos >0) { word[pos] = '\0'; // check if word exists int found = 0; for(int j=0;j<unique;j++) { if(strcmp(words[j].word, word) ==0){ words[j].count++; found =1; break; } } if(!found){ strcpy(words[unique].word, word); words[unique].count =1; unique++; } pos=0; } } str++; } if(pos >0){ word[pos] = '\0'; int found =0; for(int j=0;j<unique;j++) { if(strcmp(words[j].word, word) ==0){ words[j].count++; found =1; break; } } if(!found){ strcpy(words[unique].word, word); words[unique].count =1; unique++; } } } // find max int max =0; int index =0; for(int i=0;i<unique;i++) { if(words[i].count > max){ max = words[i].count; index =i; } } return words[index].word; }
int main(){ const char* test1[] = {"UTS is best for RTF", "RTF love UTS", "UTS is best"}; assert(strcmp(func0(3, test1), "UTS") == 0); const char* test2[] = {"Its been a great year", "this year is so worse", "this year is okay"}; assert(strcmp(func0(3, test2), "year") == 0); const char* test3[] = {"Families can be reunited", "people can be reunited", "Tasks can be achieved "}; assert(strcmp(func0(3, test3), "can") == 0); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x58,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax test %edi,%edi jle 15ec <func0+0x29c> lea -0x1(%rdi),%eax mov %rsi,(%rsp) xor %ebp,%ebp lea 0x8(%rsi,%rax,8),%rax mov %rax,0x8(%rsp) nopl (%rax) mov (%rsp),%rax mov (%rax),%rbx movzbl (%rbx),%r15d test %r15b,%r15b je 1464 <func0+0x114> callq 10d0 <__ctype_b_loc@plt> mov %rax,%r12 xor %eax,%eax jmp 13cd <func0+0x7d> movslq %eax,%rdx add $0x1,%eax mov %r15b,0x10(%rsp,%rdx,1) movzbl 0x1(%rbx),%r15d add $0x1,%rbx test %r15b,%r15b je 1460 <func0+0x110> mov (%r12),%rsi movsbq %r15b,%rdx testb $0x20,0x1(%rsi,%rdx,2) je 13b0 <func0+0x60> test %eax,%eax je 13bb <func0+0x6b> cltq lea 0x10(%rsp),%r15 movb $0x0,0x10(%rsp,%rax,1) test %ebp,%ebp je 1560 <func0+0x210> lea 0x2c45(%rip),%r13 xor %r14d,%r14d lea 0x10(%rsp),%r15 jmp 1419 <func0+0xc9> nopl (%rax) add $0x1,%r14d add $0x38,%r13 cmp %ebp,%r14d je 1560 <func0+0x210> mov %r15,%rsi mov %r13,%rdi callq 10b0 <strcmp@plt> test %eax,%eax jne 1408 <func0+0xb8> movslq %r14d,%rdx add $0x1,%rbx lea 0x0(,%rdx,8),%rcx sub %rdx,%rcx mov %rcx,%rdx lea 0x2bfc(%rip),%rcx addl $0x1,0x34(%rcx,%rdx,8) movzbl (%rbx),%r15d test %r15b,%r15b jne 13cd <func0+0x7d> nopw %cs:0x0(%rax,%rax,1) test %eax,%eax jne 14e0 <func0+0x190> addq $0x8,(%rsp) mov (%rsp),%rax cmp %rax,0x8(%rsp) jne 1390 <func0+0x40> test %ebp,%ebp je 15ec <func0+0x29c> lea 0x2bed(%rip),%rdx xor %eax,%eax xor %edi,%edi xor %esi,%esi nopl (%rax) mov (%rdx),%ecx cmp %esi,%ecx jle 149b <func0+0x14b> movslq %eax,%rdi mov %ecx,%esi add $0x1,%eax add $0x38,%rdx cmp %eax,%ebp jne 1490 <func0+0x140> lea 0x0(,%rdi,8),%rax lea 0x2b8b(%rip),%rcx sub %rdi,%rax lea (%rcx,%rax,8),%rax mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 15f8 <func0+0x2a8> add $0x58,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq cltq lea 0x10(%rsp),%r15 movb $0x0,0x10(%rsp,%rax,1) test %ebp,%ebp je 15a0 <func0+0x250> lea 0x2b45(%rip),%r12 xor %ebx,%ebx lea 0x10(%rsp),%r15 jmp 1517 <func0+0x1c7> nopl 0x0(%rax) add $0x1,%ebx add $0x38,%r12 cmp %ebx,%ebp je 15a0 <func0+0x250> mov %r15,%rsi mov %r12,%rdi callq 10b0 <strcmp@plt> test %eax,%eax jne 1508 <func0+0x1b8> movslq %ebx,%rbx lea 0x2b10(%rip),%rcx addq $0x8,(%rsp) lea 0x0(,%rbx,8),%rax sub %rbx,%rax addl $0x1,0x34(%rcx,%rax,8) mov (%rsp),%rax cmp %rax,0x8(%rsp) jne 1390 <func0+0x40> jmpq 1478 <func0+0x128> nopl 0x0(%rax) movslq %ebp,%rdx lea 0x2ad6(%rip),%rcx mov %r15,%rsi add $0x1,%ebp lea 0x0(,%rdx,8),%rax sub %rdx,%rax mov $0x32,%edx lea (%rcx,%rax,8),%rcx mov %rcx,%rdi callq 10c0 <__strcpy_chk@plt> movl $0x1,0x34(%rax) xor %eax,%eax jmpq 13bb <func0+0x6b> nopw 0x0(%rax,%rax,1) movslq %ebp,%rdx lea 0x2a96(%rip),%rcx mov %r15,%rsi add $0x1,%ebp lea 0x0(,%rdx,8),%rax sub %rdx,%rax mov $0x32,%edx lea (%rcx,%rax,8),%rcx mov %rcx,%rdi callq 10c0 <__strcpy_chk@plt> addq $0x8,(%rsp) movl $0x1,0x34(%rax) mov (%rsp),%rax cmp %rax,0x8(%rsp) jne 1390 <func0+0x40> jmpq 1478 <func0+0x128> lea 0x2a4d(%rip),%rax jmpq 14bc <func0+0x16c> callq 1090 <__stack_chk_fail@plt> nopl (%rax)
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 58h mov rax, fs:28h mov [rsp+88h+var_40], rax xor eax, eax test edi, edi jle loc_15DC lea eax, [rdi-1] mov [rsp+88h+var_88], rsi xor ebp, ebp lea rax, [rsi+rax*8+8] mov [rsp+88h+var_80], rax nop dword ptr [rax] loc_1380: mov rax, [rsp+88h+var_88] mov rbx, [rax] movzx r15d, byte ptr [rbx] test r15b, r15b jz loc_1450 call ___ctype_b_loc mov r12, rax xor eax, eax jmp short loc_13BD loc_13A0: movsxd rdx, eax add eax, 1 mov [rsp+rdx+88h+var_78], r15b loc_13AB: movzx r15d, byte ptr [rbx+1] add rbx, 1 test r15b, r15b jz loc_1448 loc_13BD: mov rsi, [r12] movsx rdx, r15b test byte ptr [rsi+rdx*2+1], 20h jz short loc_13A0 test eax, eax jz short loc_13AB cdqe lea r15, [rsp+88h+var_78] mov [rsp+rax+88h+var_78], 0 test ebp, ebp jz loc_1550 lea r13, words_1 xor r14d, r14d lea r15, [rsp+88h+var_78] jmp short loc_1409 loc_13F8: add r14d, 1 add r13, 38h ; '8' cmp r14d, ebp jz loc_1550 loc_1409: mov rsi, r15 mov rdi, r13 call _strcmp test eax, eax jnz short loc_13F8 movsxd rdx, r14d lea rdi, words_1 add rbx, 1 lea rcx, ds:0[rdx*8] sub rcx, rdx add dword ptr [rdi+rcx*8+34h], 1 movzx r15d, byte ptr [rbx] test r15b, r15b jnz loc_13BD nop dword ptr [rax+rax+00h] loc_1448: test eax, eax jnz loc_14D0 loc_1450: add [rsp+88h+var_88], 8 mov rax, [rsp+88h+var_88] cmp [rsp+88h+var_80], rax jnz loc_1380 loc_1464: test ebp, ebp jz loc_15DC lea rdx, unk_4074 xor eax, eax xor edi, edi xor esi, esi nop dword ptr [rax+00000000h] loc_1480: mov ecx, [rdx] cmp ecx, esi jle short loc_148B movsxd rdi, eax mov esi, ecx loc_148B: add eax, 1 add rdx, 38h ; '8' cmp ebp, eax jnz short loc_1480 lea rax, ds:0[rdi*8] lea rcx, words_1 sub rax, rdi lea rax, [rcx+rax*8] loc_14AC: mov rdx, [rsp+88h+var_40] sub rdx, fs:28h jnz loc_15E8 add rsp, 58h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_14D0: cdqe lea r15, [rsp+88h+var_78] mov [rsp+rax+88h+var_78], 0 test ebp, ebp jz loc_1590 lea r12, words_1 xor ebx, ebx lea r15, [rsp+88h+var_78] jmp short loc_1507 loc_14F8: add ebx, 1 add r12, 38h ; '8' cmp ebp, ebx jz loc_1590 loc_1507: mov rsi, r15 mov rdi, r12 call _strcmp test eax, eax jnz short loc_14F8 movsxd rbx, ebx lea rcx, words_1 add [rsp+88h+var_88], 8 lea rax, ds:0[rbx*8] sub rax, rbx add dword ptr [rcx+rax*8+34h], 1 mov rax, [rsp+88h+var_88] cmp [rsp+88h+var_80], rax jnz loc_1380 jmp loc_1464 loc_1550: movsxd rdx, ebp lea rcx, words_1 mov rsi, r15 add ebp, 1 lea rax, ds:0[rdx*8] sub rax, rdx mov edx, 32h ; '2' lea rcx, [rcx+rax*8] mov rdi, rcx call ___strcpy_chk mov dword ptr [rax+34h], 1 xor eax, eax jmp loc_13AB loc_1590: movsxd rdx, ebp lea rcx, words_1 mov rsi, r15 add ebp, 1 lea rax, ds:0[rdx*8] sub rax, rdx mov edx, 32h ; '2' lea rcx, [rcx+rax*8] mov rdi, rcx call ___strcpy_chk add [rsp+88h+var_88], 8 mov dword ptr [rax+34h], 1 mov rax, [rsp+88h+var_88] cmp [rsp+88h+var_80], rax jnz loc_1380 jmp loc_1464 loc_15DC: lea rax, words_1 jmp loc_14AC loc_15E8: call ___stack_chk_fail
char * func0(int a1, char **a2) { int v2; // ebp char *v3; // rbx char v4; // r15 _QWORD *v5; // r12 int v6; // eax long long v7; // rdx char *v8; // r13 int v9; // r14d int *v10; // rdx int v11; // eax long long v12; // rdi int v13; // esi char *v15; // r12 int v16; // ebx long long v17; // rdx long long v18; // rdx char **v19; // [rsp+0h] [rbp-88h] long long v20; // [rsp+8h] [rbp-80h] _BYTE v21[56]; // [rsp+10h] [rbp-78h] BYREF unsigned long long v22; // [rsp+48h] [rbp-40h] v22 = __readfsqword(0x28u); if ( a1 <= 0 ) return (char *)&words_1; v19 = a2; v2 = 0; v20 = (long long)&a2[(unsigned int)(a1 - 1) + 1]; do { LABEL_3: v3 = *v19; v4 = **v19; if ( !v4 ) goto LABEL_15; v5 = (_QWORD *)__ctype_b_loc(); v6 = 0; do { while ( (*(_BYTE *)(*v5 + 2LL * v4 + 1) & 0x20) == 0 ) { v7 = v6++; v21[v7] = v4; LABEL_6: v4 = *++v3; if ( !v4 ) goto LABEL_14; } if ( !v6 ) goto LABEL_6; v21[v6] = 0; if ( !v2 ) { LABEL_28: v17 = v2++; *(_DWORD *)(__strcpy_chk((char *)&words_1 + 56 * v17, v21, 50LL) + 52) = 1; v6 = 0; goto LABEL_6; } v8 = (char *)&words_1; v9 = 0; while ( 1 ) { v6 = strcmp(v8, v21); if ( !v6 ) break; ++v9; v8 += 56; if ( v9 == v2 ) goto LABEL_28; } ++v3; ++*((_DWORD *)&words_1 + 14 * v9 + 13); v4 = *v3; } while ( *v3 ); LABEL_14: if ( !v6 ) { LABEL_15: if ( (char **)v20 == ++v19 ) break; goto LABEL_3; } v21[v6] = 0; if ( !v2 ) { LABEL_29: v18 = v2++; ++v19; *(_DWORD *)(__strcpy_chk((char *)&words_1 + 56 * v18, v21, 50LL) + 52) = 1; if ( (char **)v20 == v19 ) break; goto LABEL_3; } v15 = (char *)&words_1; v16 = 0; while ( (unsigned int)strcmp(v15, v21) ) { ++v16; v15 += 56; if ( v2 == v16 ) goto LABEL_29; } ++v19; ++*((_DWORD *)&words_1 + 14 * v16 + 13); } while ( (char **)v20 != v19 ); if ( !v2 ) return (char *)&words_1; v10 = (int *)&unk_4074; v11 = 0; v12 = 0LL; v13 = 0; do { if ( *v10 > v13 ) { v12 = v11; v13 = *v10; } ++v11; v10 += 14; } while ( v2 != v11 ); return (char *)&words_1 + 56 * v12; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x58 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX TEST EDI,EDI JLE 0x001015dc LEA EAX,[RDI + -0x1] MOV qword ptr [RSP],RSI XOR EBP,EBP LEA RAX,[RSI + RAX*0x8 + 0x8] MOV qword ptr [RSP + 0x8],RAX NOP dword ptr [RAX] LAB_00101380: MOV RAX,qword ptr [RSP] MOV RBX,qword ptr [RAX] MOVZX R15D,byte ptr [RBX] TEST R15B,R15B JZ 0x00101450 CALL 0x001010d0 MOV R12,RAX XOR EAX,EAX JMP 0x001013bd LAB_001013a0: MOVSXD RDX,EAX ADD EAX,0x1 MOV byte ptr [RSP + RDX*0x1 + 0x10],R15B LAB_001013ab: MOVZX R15D,byte ptr [RBX + 0x1] ADD RBX,0x1 TEST R15B,R15B JZ 0x00101448 LAB_001013bd: MOV RSI,qword ptr [R12] MOVSX RDX,R15B TEST byte ptr [RSI + RDX*0x2 + 0x1],0x20 JZ 0x001013a0 TEST EAX,EAX JZ 0x001013ab CDQE LEA R15,[RSP + 0x10] MOV byte ptr [RSP + RAX*0x1 + 0x10],0x0 TEST EBP,EBP JZ 0x00101550 LEA R13,[0x104040] XOR R14D,R14D LEA R15,[RSP + 0x10] JMP 0x00101409 LAB_001013f8: ADD R14D,0x1 ADD R13,0x38 CMP R14D,EBP JZ 0x00101550 LAB_00101409: MOV RSI,R15 MOV RDI,R13 CALL 0x001010b0 TEST EAX,EAX JNZ 0x001013f8 MOVSXD RDX,R14D LEA RDI,[0x104040] ADD RBX,0x1 LEA RCX,[RDX*0x8] SUB RCX,RDX ADD dword ptr [RDI + RCX*0x8 + 0x34],0x1 MOVZX R15D,byte ptr [RBX] TEST R15B,R15B JNZ 0x001013bd NOP dword ptr [RAX + RAX*0x1] LAB_00101448: TEST EAX,EAX JNZ 0x001014d0 LAB_00101450: ADD qword ptr [RSP],0x8 MOV RAX,qword ptr [RSP] CMP qword ptr [RSP + 0x8],RAX JNZ 0x00101380 LAB_00101464: TEST EBP,EBP JZ 0x001015dc LEA RDX,[0x104074] XOR EAX,EAX XOR EDI,EDI XOR ESI,ESI NOP dword ptr [RAX] LAB_00101480: MOV ECX,dword ptr [RDX] CMP ECX,ESI JLE 0x0010148b MOVSXD RDI,EAX MOV ESI,ECX LAB_0010148b: ADD EAX,0x1 ADD RDX,0x38 CMP EBP,EAX JNZ 0x00101480 LEA RAX,[RDI*0x8] LEA RCX,[0x104040] SUB RAX,RDI LEA RAX,[RCX + RAX*0x8] LAB_001014ac: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x001015e8 ADD RSP,0x58 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001014d0: CDQE LEA R15,[RSP + 0x10] MOV byte ptr [RSP + RAX*0x1 + 0x10],0x0 TEST EBP,EBP JZ 0x00101590 LEA R12,[0x104040] XOR EBX,EBX LEA R15,[RSP + 0x10] JMP 0x00101507 LAB_001014f8: ADD EBX,0x1 ADD R12,0x38 CMP EBP,EBX JZ 0x00101590 LAB_00101507: MOV RSI,R15 MOV RDI,R12 CALL 0x001010b0 TEST EAX,EAX JNZ 0x001014f8 MOVSXD RBX,EBX LEA RCX,[0x104040] ADD qword ptr [RSP],0x8 LEA RAX,[RBX*0x8] SUB RAX,RBX ADD dword ptr [RCX + RAX*0x8 + 0x34],0x1 MOV RAX,qword ptr [RSP] CMP qword ptr [RSP + 0x8],RAX JNZ 0x00101380 JMP 0x00101464 LAB_00101550: MOVSXD RDX,EBP LEA RCX,[0x104040] MOV RSI,R15 ADD EBP,0x1 LEA RAX,[RDX*0x8] SUB RAX,RDX MOV EDX,0x32 LEA RCX,[RCX + RAX*0x8] MOV RDI,RCX CALL 0x001010c0 MOV dword ptr [RAX + 0x34],0x1 XOR EAX,EAX JMP 0x001013ab LAB_00101590: MOVSXD RDX,EBP LEA RCX,[0x104040] MOV RSI,R15 ADD EBP,0x1 LEA RAX,[RDX*0x8] SUB RAX,RDX MOV EDX,0x32 LEA RCX,[RCX + RAX*0x8] MOV RDI,RCX CALL 0x001010c0 ADD qword ptr [RSP],0x8 MOV dword ptr [RAX + 0x34],0x1 MOV RAX,qword ptr [RSP] CMP qword ptr [RSP + 0x8],RAX JNZ 0x00101380 JMP 0x00101464 LAB_001015dc: LEA RAX,[0x104040] JMP 0x001014ac LAB_001015e8: CALL 0x00101090
int1 * func0(int param_1,int8 *param_2) { int iVar1; ushort **ppuVar2; int *piVar3; int iVar4; char *pcVar5; int iVar6; long lVar7; int1 *puVar8; char cVar9; long in_FS_OFFSET; int8 *local_88; char local_78 [56]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); if (0 < param_1) { iVar6 = 0; local_88 = param_2; do { while( true ) { pcVar5 = (char *)*local_88; cVar9 = *pcVar5; if (cVar9 != '\0') break; LAB_00101450: local_88 = local_88 + 1; if (param_2 + (ulong)(param_1 - 1) + 1 == local_88) goto LAB_00101464; } ppuVar2 = __ctype_b_loc(); iVar4 = 0; do { if ((*(byte *)((long)*ppuVar2 + (long)cVar9 * 2 + 1) & 0x20) == 0) { lVar7 = (long)iVar4; iVar4 = iVar4 + 1; local_78[lVar7] = cVar9; } else if (iVar4 != 0) { local_78[iVar4] = '\0'; if (iVar6 != 0) { puVar8 = words_1; iVar4 = 0; do { iVar1 = strcmp(puVar8,local_78); if (iVar1 == 0) { *(int *)(words_1 + (long)iVar4 * 0x38 + 0x34) = *(int *)(words_1 + (long)iVar4 * 0x38 + 0x34) + 1; cVar9 = pcVar5[1]; iVar4 = 0; goto joined_r0x0010143d; } iVar4 = iVar4 + 1; puVar8 = puVar8 + 0x38; } while (iVar4 != iVar6); } lVar7 = (long)iVar6; iVar6 = iVar6 + 1; lVar7 = __strcpy_chk(words_1 + lVar7 * 0x38,local_78,0x32); *(int4 *)(lVar7 + 0x34) = 1; iVar4 = 0; } cVar9 = pcVar5[1]; joined_r0x0010143d: pcVar5 = pcVar5 + 1; } while (cVar9 != '\0'); if (iVar4 == 0) goto LAB_00101450; local_78[iVar4] = '\0'; if (iVar6 != 0) { puVar8 = words_1; iVar4 = 0; do { iVar1 = strcmp(puVar8,local_78); if (iVar1 == 0) { *(int *)(words_1 + (long)iVar4 * 0x38 + 0x34) = *(int *)(words_1 + (long)iVar4 * 0x38 + 0x34) + 1; goto joined_r0x0010153e; } iVar4 = iVar4 + 1; puVar8 = puVar8 + 0x38; } while (iVar6 != iVar4); } lVar7 = (long)iVar6; iVar6 = iVar6 + 1; lVar7 = __strcpy_chk(words_1 + lVar7 * 0x38,local_78,0x32); *(int4 *)(lVar7 + 0x34) = 1; joined_r0x0010153e: local_88 = local_88 + 1; } while (param_2 + (ulong)(param_1 - 1) + 1 != local_88); LAB_00101464: if (iVar6 != 0) { piVar3 = (int *)(words_1 + 0x34); iVar1 = 0; lVar7 = 0; iVar4 = 0; do { if (iVar4 < *piVar3) { lVar7 = (long)iVar1; iVar4 = *piVar3; } iVar1 = iVar1 + 1; piVar3 = piVar3 + 0xe; } while (iVar6 != iVar1); puVar8 = words_1 + lVar7 * 0x38; goto LAB_001014ac; } } puVar8 = words_1; LAB_001014ac: if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return puVar8; }
5,199
func0
#include <assert.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> typedef struct { char word[50]; int count; } WordCount;
const char* func0(int n, const char* test_list[]) { static WordCount words[100]; int unique = 0; for(int i=0;i<n;i++) { const char* str = test_list[i]; char word[50]; int pos =0; while(*str) { if(!isspace(*str)) { word[pos++] = *str; } else { if(pos >0) { word[pos] = '\0'; // check if word exists int found = 0; for(int j=0;j<unique;j++) { if(strcmp(words[j].word, word) ==0){ words[j].count++; found =1; break; } } if(!found){ strcpy(words[unique].word, word); words[unique].count =1; unique++; } pos=0; } } str++; } if(pos >0){ word[pos] = '\0'; int found =0; for(int j=0;j<unique;j++) { if(strcmp(words[j].word, word) ==0){ words[j].count++; found =1; break; } } if(!found){ strcpy(words[unique].word, word); words[unique].count =1; unique++; } } } // find max int max =0; int index =0; for(int i=0;i<unique;i++) { if(words[i].count > max){ max = words[i].count; index =i; } } return words[index].word; }
int main(){ const char* test1[] = {"UTS is best for RTF", "RTF love UTS", "UTS is best"}; assert(strcmp(func0(3, test1), "UTS") == 0); const char* test2[] = {"Its been a great year", "this year is so worse", "this year is okay"}; assert(strcmp(func0(3, test2), "year") == 0); const char* test3[] = {"Families can be reunited", "people can be reunited", "Tasks can be achieved "}; assert(strcmp(func0(3, test3), "can") == 0); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x58,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax test %edi,%edi jle 160c <func0+0x29c> lea -0x1(%rdi),%eax mov %rsi,(%rsp) xor %ebp,%ebp lea 0x8(%rsi,%rax,8),%rax mov %rax,0x8(%rsp) nopl (%rax) mov (%rsp),%rax mov (%rax),%rbx movzbl (%rbx),%r15d test %r15b,%r15b je 1484 <func0+0x114> callq 10d0 <__ctype_b_loc@plt> mov %rax,%r12 xor %eax,%eax jmp 13ed <func0+0x7d> movslq %eax,%rdx add $0x1,%eax mov %r15b,0x10(%rsp,%rdx,1) movzbl 0x1(%rbx),%r15d add $0x1,%rbx test %r15b,%r15b je 1480 <func0+0x110> mov (%r12),%rsi movsbq %r15b,%rdx testb $0x20,0x1(%rsi,%rdx,2) je 13d0 <func0+0x60> test %eax,%eax je 13db <func0+0x6b> cltq lea 0x10(%rsp),%r15 movb $0x0,0x10(%rsp,%rax,1) test %ebp,%ebp je 1580 <func0+0x210> lea 0x2c25(%rip),%r13 xor %r14d,%r14d lea 0x10(%rsp),%r15 jmp 1439 <func0+0xc9> nopl (%rax) add $0x1,%r14d add $0x38,%r13 cmp %ebp,%r14d je 1580 <func0+0x210> mov %r15,%rsi mov %r13,%rdi callq 10b0 <strcmp@plt> test %eax,%eax jne 1428 <func0+0xb8> movslq %r14d,%rdx add $0x1,%rbx lea 0x0(,%rdx,8),%rcx sub %rdx,%rcx mov %rcx,%rdx lea 0x2bdc(%rip),%rcx addl $0x1,0x34(%rcx,%rdx,8) movzbl (%rbx),%r15d test %r15b,%r15b jne 13ed <func0+0x7d> nopw %cs:0x0(%rax,%rax,1) test %eax,%eax jne 1500 <func0+0x190> addq $0x8,(%rsp) mov (%rsp),%rax cmp %rax,0x8(%rsp) jne 13b0 <func0+0x40> test %ebp,%ebp je 160c <func0+0x29c> lea 0x2bcd(%rip),%rdx xor %eax,%eax xor %edi,%edi xor %esi,%esi nopl (%rax) mov (%rdx),%ecx cmp %esi,%ecx jle 14bb <func0+0x14b> movslq %eax,%rdi mov %ecx,%esi add $0x1,%eax add $0x38,%rdx cmp %eax,%ebp jne 14b0 <func0+0x140> lea 0x0(,%rdi,8),%rax lea 0x2b6b(%rip),%rcx sub %rdi,%rax lea (%rcx,%rax,8),%rax mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 1618 <func0+0x2a8> add $0x58,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq cltq lea 0x10(%rsp),%r15 movb $0x0,0x10(%rsp,%rax,1) test %ebp,%ebp je 15c0 <func0+0x250> lea 0x2b25(%rip),%r12 xor %ebx,%ebx lea 0x10(%rsp),%r15 jmp 1537 <func0+0x1c7> nopl 0x0(%rax) add $0x1,%ebx add $0x38,%r12 cmp %ebx,%ebp je 15c0 <func0+0x250> mov %r15,%rsi mov %r12,%rdi callq 10b0 <strcmp@plt> test %eax,%eax jne 1528 <func0+0x1b8> movslq %ebx,%rbx lea 0x2af0(%rip),%rcx addq $0x8,(%rsp) lea 0x0(,%rbx,8),%rax sub %rbx,%rax addl $0x1,0x34(%rcx,%rax,8) mov (%rsp),%rax cmp %rax,0x8(%rsp) jne 13b0 <func0+0x40> jmpq 1498 <func0+0x128> nopl 0x0(%rax) movslq %ebp,%rdx lea 0x2ab6(%rip),%rcx mov %r15,%rsi add $0x1,%ebp lea 0x0(,%rdx,8),%rax sub %rdx,%rax mov $0x32,%edx lea (%rcx,%rax,8),%rcx mov %rcx,%rdi callq 10c0 <__strcpy_chk@plt> movl $0x1,0x34(%rax) xor %eax,%eax jmpq 13db <func0+0x6b> nopw 0x0(%rax,%rax,1) movslq %ebp,%rdx lea 0x2a76(%rip),%rcx mov %r15,%rsi add $0x1,%ebp lea 0x0(,%rdx,8),%rax sub %rdx,%rax mov $0x32,%edx lea (%rcx,%rax,8),%rcx mov %rcx,%rdi callq 10c0 <__strcpy_chk@plt> addq $0x8,(%rsp) movl $0x1,0x34(%rax) mov (%rsp),%rax cmp %rax,0x8(%rsp) jne 13b0 <func0+0x40> jmpq 1498 <func0+0x128> lea 0x2a2d(%rip),%rax jmpq 14dc <func0+0x16c> callq 1090 <__stack_chk_fail@plt> nopl (%rax)
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 68h mov rax, fs:28h mov [rsp+98h+var_40], rax xor eax, eax test edi, edi jle loc_15EA movsxd rdi, edi mov [rsp+98h+var_88], rsi xor ebp, ebp lea rax, [rsi+rdi*8] mov [rsp+98h+var_80], rax nop dword ptr [rax] loc_13A0: mov rax, [rsp+98h+var_88] mov rbx, [rax] movzx r14d, byte ptr [rbx] test r14b, r14b jz loc_1474 call ___ctype_b_loc lea r12, [rsp+98h+s2] mov r13, rax xor eax, eax jmp short loc_13ED loc_13D0: movsxd rdx, eax add eax, 1 mov [rsp+rdx+98h+s2], r14b loc_13DB: movzx r14d, byte ptr [rbx+1] add rbx, 1 test r14b, r14b jz loc_1470 loc_13ED: mov rcx, [r13+0] movsx rdx, r14b test byte ptr [rcx+rdx*2+1], 20h jz short loc_13D0 test eax, eax jle short loc_13DB cdqe mov [rsp+rax+98h+s2], 0 test ebp, ebp jle loc_1557 mov [rsp+98h+var_90], r12 lea r14, words_1 xor r15d, r15d jmp short loc_1431 loc_1420: add r15d, 1 add r14, 38h ; '8' cmp r15d, ebp jz loc_1568 loc_1431: mov rsi, r12; s2 mov rdi, r14; s1 call _strcmp test eax, eax jnz short loc_1420 movsxd rdx, r15d lea rsi, words_1 add rbx, 1 lea rcx, ds:0[rdx*8] sub rcx, rdx add dword ptr [rsi+rcx*8+34h], 1 movzx r14d, byte ptr [rbx] test r14b, r14b jnz short loc_13ED nop word ptr [rax+rax+00000000h] loc_1470: test eax, eax jg short loc_14F0 loc_1474: add [rsp+98h+var_88], 8 mov rax, [rsp+98h+var_88] cmp [rsp+98h+var_80], rax jnz loc_13A0 test ebp, ebp jle loc_15EA lea rdx, unk_4074 xor eax, eax xor edi, edi xor esi, esi nop loc_14A0: mov ecx, [rdx] cmp ecx, esi jle short loc_14AB movsxd rdi, eax mov esi, ecx loc_14AB: add eax, 1 add rdx, 38h ; '8' cmp ebp, eax jnz short loc_14A0 lea rax, ds:0[rdi*8] sub rax, rdi lea rdi, words_1 lea rax, [rdi+rax*8] loc_14CC: mov rdx, [rsp+98h+var_40] sub rdx, fs:28h jnz loc_15F6 add rsp, 68h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_14F0: cdqe mov [rsp+rax+98h+s2], 0 test ebp, ebp jle loc_15A4 lea rax, [rsp+98h+s2] lea r12, words_1 xor ebx, ebx mov [rsp+98h+var_90], rax jmp short loc_1527 loc_1518: add ebx, 1 add r12, 38h ; '8' cmp ebp, ebx jz loc_15B0 loc_1527: mov rsi, [rsp+98h+var_90]; s2 mov rdi, r12; s1 call _strcmp test eax, eax jnz short loc_1518 movsxd rbx, ebx lea rdi, words_1 lea rax, ds:0[rbx*8] sub rax, rbx add dword ptr [rdi+rax*8+34h], 1 jmp loc_1474 loc_1557: lea rax, [rsp+98h+s2] mov [rsp+98h+var_90], rax nop dword ptr [rax+00000000h] loc_1568: movsxd rdx, ebp lea rsi, words_1 add ebp, 1 lea rax, ds:0[rdx*8] sub rax, rdx mov edx, 32h ; '2' lea rcx, [rsi+rax*8] mov rsi, [rsp+98h+var_90] mov rdi, rcx call ___strcpy_chk mov dword ptr [rax+34h], 1 xor eax, eax jmp loc_13DB loc_15A4: lea rax, [rsp+98h+s2] mov [rsp+98h+var_90], rax xchg ax, ax loc_15B0: movsxd rdx, ebp lea rdi, words_1 mov rsi, [rsp+98h+var_90] add ebp, 1 lea rax, ds:0[rdx*8] sub rax, rdx mov edx, 32h ; '2' lea rcx, [rdi+rax*8] mov rdi, rcx call ___strcpy_chk mov dword ptr [rax+34h], 1 jmp loc_1474 loc_15EA: lea rax, words_1 jmp loc_14CC loc_15F6: call ___stack_chk_fail
char * func0(int a1, char **a2) { int v2; // ebp char *v3; // rbx char v4; // r14 const unsigned __int16 **v5; // r13 int v6; // eax long long v7; // rdx const char *v8; // r14 int v9; // r15d int *v10; // rdx int v11; // eax long long v12; // rdi int v13; // esi const char *v15; // r12 int v16; // ebx int i; // eax long long v18; // rdx long long v19; // rdx char **v20; // [rsp+10h] [rbp-88h] char s2[56]; // [rsp+20h] [rbp-78h] BYREF unsigned long long v22; // [rsp+58h] [rbp-40h] v22 = __readfsqword(0x28u); if ( a1 <= 0 ) return words_1; v20 = a2; v2 = 0; do { v3 = *v20; v4 = **v20; if ( !v4 ) goto LABEL_15; v5 = __ctype_b_loc(); v6 = 0; do { while ( ((*v5)[v4] & 0x2000) == 0 ) { v7 = v6++; s2[v7] = v4; LABEL_6: v4 = *++v3; if ( !v4 ) goto LABEL_14; } if ( v6 <= 0 ) goto LABEL_6; s2[v6] = 0; if ( v2 <= 0 ) { LABEL_28: v18 = v2++; *(_DWORD *)(__strcpy_chk(&words_1[56 * v18], s2, 50LL) + 52) = 1; v6 = 0; goto LABEL_6; } v8 = words_1; v9 = 0; while ( 1 ) { v6 = strcmp(v8, s2); if ( !v6 ) break; ++v9; v8 += 56; if ( v9 == v2 ) goto LABEL_28; } ++v3; ++*(_DWORD *)&words_1[56 * v9 + 52]; v4 = *v3; } while ( *v3 ); LABEL_14: if ( v6 > 0 ) { s2[v6] = 0; if ( v2 <= 0 ) { LABEL_29: v19 = v2++; *(_DWORD *)(__strcpy_chk(&words_1[56 * v19], s2, 50LL) + 52) = 1; } else { v15 = words_1; v16 = 0; for ( i = strcmp(words_1, s2); i; i = strcmp(v15, s2) ) { ++v16; v15 += 56; if ( v2 == v16 ) goto LABEL_29; } ++*(_DWORD *)&words_1[56 * v16 + 52]; } } LABEL_15: ++v20; } while ( &a2[a1] != v20 ); if ( v2 <= 0 ) return words_1; v10 = (int *)&unk_4074; v11 = 0; v12 = 0LL; v13 = 0; do { if ( *v10 > v13 ) { v12 = v11; v13 = *v10; } ++v11; v10 += 14; } while ( v2 != v11 ); return &words_1[56 * v12]; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x68 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x58],RAX XOR EAX,EAX TEST EDI,EDI JLE 0x001015ea MOVSXD RDI,EDI MOV qword ptr [RSP + 0x10],RSI XOR EBP,EBP LEA RAX,[RSI + RDI*0x8] MOV qword ptr [RSP + 0x18],RAX NOP dword ptr [RAX] LAB_001013a0: MOV RAX,qword ptr [RSP + 0x10] MOV RBX,qword ptr [RAX] MOVZX R14D,byte ptr [RBX] TEST R14B,R14B JZ 0x00101474 CALL 0x001010d0 LEA R12,[RSP + 0x20] MOV R13,RAX XOR EAX,EAX JMP 0x001013ed LAB_001013d0: MOVSXD RDX,EAX ADD EAX,0x1 MOV byte ptr [RSP + RDX*0x1 + 0x20],R14B LAB_001013db: MOVZX R14D,byte ptr [RBX + 0x1] ADD RBX,0x1 TEST R14B,R14B JZ 0x00101470 LAB_001013ed: MOV RCX,qword ptr [R13] MOVSX RDX,R14B TEST byte ptr [RCX + RDX*0x2 + 0x1],0x20 JZ 0x001013d0 TEST EAX,EAX JLE 0x001013db CDQE MOV byte ptr [RSP + RAX*0x1 + 0x20],0x0 TEST EBP,EBP JLE 0x00101557 MOV qword ptr [RSP + 0x8],R12 LEA R14,[0x104040] XOR R15D,R15D JMP 0x00101431 LAB_00101420: ADD R15D,0x1 ADD R14,0x38 CMP R15D,EBP JZ 0x00101568 LAB_00101431: MOV RSI,R12 MOV RDI,R14 CALL 0x001010b0 TEST EAX,EAX JNZ 0x00101420 MOVSXD RDX,R15D LEA RSI,[0x104040] ADD RBX,0x1 LEA RCX,[RDX*0x8] SUB RCX,RDX ADD dword ptr [RSI + RCX*0x8 + 0x34],0x1 MOVZX R14D,byte ptr [RBX] TEST R14B,R14B JNZ 0x001013ed NOP word ptr [RAX + RAX*0x1] LAB_00101470: TEST EAX,EAX JG 0x001014f0 LAB_00101474: ADD qword ptr [RSP + 0x10],0x8 MOV RAX,qword ptr [RSP + 0x10] CMP qword ptr [RSP + 0x18],RAX JNZ 0x001013a0 TEST EBP,EBP JLE 0x001015ea LEA RDX,[0x104074] XOR EAX,EAX XOR EDI,EDI XOR ESI,ESI NOP LAB_001014a0: MOV ECX,dword ptr [RDX] CMP ECX,ESI JLE 0x001014ab MOVSXD RDI,EAX MOV ESI,ECX LAB_001014ab: ADD EAX,0x1 ADD RDX,0x38 CMP EBP,EAX JNZ 0x001014a0 LEA RAX,[RDI*0x8] SUB RAX,RDI LEA RDI,[0x104040] LEA RAX,[RDI + RAX*0x8] LAB_001014cc: MOV RDX,qword ptr [RSP + 0x58] SUB RDX,qword ptr FS:[0x28] JNZ 0x001015f6 ADD RSP,0x68 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001014f0: CDQE MOV byte ptr [RSP + RAX*0x1 + 0x20],0x0 TEST EBP,EBP JLE 0x001015a4 LEA RAX,[RSP + 0x20] LEA R12,[0x104040] XOR EBX,EBX MOV qword ptr [RSP + 0x8],RAX JMP 0x00101527 LAB_00101518: ADD EBX,0x1 ADD R12,0x38 CMP EBP,EBX JZ 0x001015b0 LAB_00101527: MOV RSI,qword ptr [RSP + 0x8] MOV RDI,R12 CALL 0x001010b0 TEST EAX,EAX JNZ 0x00101518 MOVSXD RBX,EBX LEA RDI,[0x104040] LEA RAX,[RBX*0x8] SUB RAX,RBX ADD dword ptr [RDI + RAX*0x8 + 0x34],0x1 JMP 0x00101474 LAB_00101557: LEA RAX,[RSP + 0x20] MOV qword ptr [RSP + 0x8],RAX NOP dword ptr [RAX] LAB_00101568: MOVSXD RDX,EBP LEA RSI,[0x104040] ADD EBP,0x1 LEA RAX,[RDX*0x8] SUB RAX,RDX MOV EDX,0x32 LEA RCX,[RSI + RAX*0x8] MOV RSI,qword ptr [RSP + 0x8] MOV RDI,RCX CALL 0x001010c0 MOV dword ptr [RAX + 0x34],0x1 XOR EAX,EAX JMP 0x001013db LAB_001015a4: LEA RAX,[RSP + 0x20] MOV qword ptr [RSP + 0x8],RAX NOP LAB_001015b0: MOVSXD RDX,EBP LEA RDI,[0x104040] MOV RSI,qword ptr [RSP + 0x8] ADD EBP,0x1 LEA RAX,[RDX*0x8] SUB RAX,RDX MOV EDX,0x32 LEA RCX,[RDI + RAX*0x8] MOV RDI,RCX CALL 0x001010c0 MOV dword ptr [RAX + 0x34],0x1 JMP 0x00101474 LAB_001015ea: LEA RAX,[0x104040] JMP 0x001014cc LAB_001015f6: CALL 0x00101090
int1 * func0(int param_1,int8 *param_2) { int iVar1; ushort **ppuVar2; int *piVar3; int iVar4; char *pcVar5; int iVar6; long lVar7; char cVar8; int1 *puVar9; long in_FS_OFFSET; char *local_90; int8 *local_88; char local_78 [56]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); if (0 < param_1) { iVar6 = 0; local_88 = param_2; do { pcVar5 = (char *)*local_88; cVar8 = *pcVar5; if (cVar8 != '\0') { ppuVar2 = __ctype_b_loc(); iVar4 = 0; LAB_001013ed: do { if ((*(byte *)((long)*ppuVar2 + (long)cVar8 * 2 + 1) & 0x20) == 0) { lVar7 = (long)iVar4; iVar4 = iVar4 + 1; local_78[lVar7] = cVar8; } else if (0 < iVar4) { local_78[iVar4] = '\0'; if (0 < iVar6) { puVar9 = words_1; iVar4 = 0; do { iVar1 = strcmp(puVar9,local_78); if (iVar1 == 0) { pcVar5 = pcVar5 + 1; *(int *)(words_1 + (long)iVar4 * 0x38 + 0x34) = *(int *)(words_1 + (long)iVar4 * 0x38 + 0x34) + 1; cVar8 = *pcVar5; iVar4 = 0; if (cVar8 == '\0') goto LAB_00101470; goto LAB_001013ed; } iVar4 = iVar4 + 1; puVar9 = puVar9 + 0x38; } while (iVar4 != iVar6); } local_90 = local_78; lVar7 = (long)iVar6; iVar6 = iVar6 + 1; lVar7 = __strcpy_chk(words_1 + lVar7 * 0x38,local_90,0x32); *(int4 *)(lVar7 + 0x34) = 1; iVar4 = 0; } cVar8 = pcVar5[1]; pcVar5 = pcVar5 + 1; } while (cVar8 != '\0'); LAB_00101470: if (0 < iVar4) { local_78[iVar4] = '\0'; if (0 < iVar6) { puVar9 = words_1; iVar4 = 0; do { iVar1 = strcmp(puVar9,local_78); if (iVar1 == 0) { *(int *)(words_1 + (long)iVar4 * 0x38 + 0x34) = *(int *)(words_1 + (long)iVar4 * 0x38 + 0x34) + 1; goto LAB_00101474; } iVar4 = iVar4 + 1; puVar9 = puVar9 + 0x38; } while (iVar6 != iVar4); } local_90 = local_78; lVar7 = (long)iVar6; iVar6 = iVar6 + 1; lVar7 = __strcpy_chk(words_1 + lVar7 * 0x38,local_90,0x32); *(int4 *)(lVar7 + 0x34) = 1; } } LAB_00101474: local_88 = local_88 + 1; } while (param_2 + param_1 != local_88); if (0 < iVar6) { piVar3 = (int *)(words_1 + 0x34); iVar1 = 0; lVar7 = 0; iVar4 = 0; do { if (iVar4 < *piVar3) { lVar7 = (long)iVar1; iVar4 = *piVar3; } iVar1 = iVar1 + 1; piVar3 = piVar3 + 0xe; } while (iVar6 != iVar1); puVar9 = words_1 + lVar7 * 0x38; goto LAB_001014cc; } } puVar9 = words_1; LAB_001014cc: if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return puVar9; }
5,200
func0
#include <assert.h> #include <stdbool.h>
bool func0(int x, int y, int z) { if (x == y || y == z || z == x) { return true; } else { return false; } }
int main() { assert(func0(6, 8, 12) == false); assert(func0(6, 6, 12) == true); assert(func0(6, 16, 20) == false); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov %esi,-0x8(%rbp) mov %edx,-0xc(%rbp) mov -0x4(%rbp),%eax cmp -0x8(%rbp),%eax je 1172 <func0+0x29> mov -0x8(%rbp),%eax cmp -0xc(%rbp),%eax je 1172 <func0+0x29> mov -0xc(%rbp),%eax cmp -0x4(%rbp),%eax jne 1179 <func0+0x30> mov $0x1,%eax jmp 117e <func0+0x35> mov $0x0,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov [rbp+var_8], esi mov [rbp+var_C], edx mov eax, [rbp+var_4] cmp eax, [rbp+var_8] jz short loc_1172 mov eax, [rbp+var_8] cmp eax, [rbp+var_C] jz short loc_1172 mov eax, [rbp+var_C] cmp eax, [rbp+var_4] jnz short loc_1179 loc_1172: mov eax, 1 jmp short loc_117E loc_1179: mov eax, 0 loc_117E: pop rbp retn
_BOOL8 func0(int a1, int a2, int a3) { return a1 == a2 || a2 == a3 || a3 == a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV dword ptr [RBP + -0x8],ESI MOV dword ptr [RBP + -0xc],EDX MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x8] JZ 0x00101172 MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0xc] JZ 0x00101172 MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x4] JNZ 0x00101179 LAB_00101172: MOV EAX,0x1 JMP 0x0010117e LAB_00101179: MOV EAX,0x0 LAB_0010117e: POP RBP RET
int8 func0(int param_1,int param_2,int param_3) { int8 uVar1; if (((param_1 == param_2) || (param_2 == param_3)) || (param_3 == param_1)) { uVar1 = 1; } else { uVar1 = 0; } return uVar1; }
5,201
func0
#include <assert.h> #include <stdbool.h>
bool func0(int x, int y, int z) { if (x == y || y == z || z == x) { return true; } else { return false; } }
int main() { assert(func0(6, 8, 12) == false); assert(func0(6, 6, 12) == true); assert(func0(6, 16, 20) == false); return 0; }
O1
c
func0: endbr64 cmp %esi,%edi sete %al cmp %edx,%edi sete %cl or %ecx,%eax cmp %edx,%esi sete %dl or %edx,%eax retq
func0: endbr64 cmp edi, esi setz al cmp edi, edx setz cl or eax, ecx cmp esi, edx setz dl or eax, edx retn
long long func0(int a1, int a2, int a3, int a4) { unsigned int v4; // eax LOBYTE(v4) = a1 == a2; LOBYTE(a4) = a1 == a3; LOBYTE(a3) = a2 == a3; return a3 | a4 | v4; }
func0: ENDBR64 CMP EDI,ESI SETZ AL CMP EDI,EDX SETZ CL OR EAX,ECX CMP ESI,EDX SETZ DL OR EAX,EDX RET
uint func0(int param_1,int param_2,int param_3,int4 param_4) { int8 in_RAX; return (uint)CONCAT71((int7)((ulong)in_RAX >> 8),param_1 == param_2) | CONCAT31((int3)((uint)param_4 >> 8),param_1 == param_3) | CONCAT31((int3)((uint)param_3 >> 8),param_2 == param_3); }
5,202
func0
#include <assert.h> #include <stdbool.h>
bool func0(int x, int y, int z) { if (x == y || y == z || z == x) { return true; } else { return false; } }
int main() { assert(func0(6, 8, 12) == false); assert(func0(6, 6, 12) == true); assert(func0(6, 16, 20) == false); return 0; }
O2
c
func0: endbr64 cmp %esi,%edi sete %al cmp %edx,%edi sete %cl or %ecx,%eax cmp %edx,%esi sete %dl or %edx,%eax retq nopl 0x0(%rax,%rax,1)
func0: endbr64 cmp edi, esi setz al cmp edi, edx setz cl or eax, ecx cmp esi, edx setz dl or eax, edx retn
long long func0(int a1, int a2, int a3, int a4) { unsigned int v4; // eax LOBYTE(v4) = a1 == a2; LOBYTE(a4) = a1 == a3; LOBYTE(a3) = a2 == a3; return a3 | a4 | v4; }
func0: ENDBR64 CMP EDI,ESI SETZ AL CMP EDI,EDX SETZ CL OR EAX,ECX CMP ESI,EDX SETZ DL OR EAX,EDX RET
uint func0(int param_1,int param_2,int param_3,int4 param_4) { int8 in_RAX; return (uint)CONCAT71((int7)((ulong)in_RAX >> 8),param_1 == param_2) | CONCAT31((int3)((uint)param_4 >> 8),param_1 == param_3) | CONCAT31((int3)((uint)param_3 >> 8),param_2 == param_3); }
5,203
func0
#include <assert.h> #include <stdbool.h>
bool func0(int x, int y, int z) { if (x == y || y == z || z == x) { return true; } else { return false; } }
int main() { assert(func0(6, 8, 12) == false); assert(func0(6, 6, 12) == true); assert(func0(6, 16, 20) == false); return 0; }
O3
c
func0: endbr64 cmp %esi,%edi sete %al cmp %edx,%edi sete %cl or %ecx,%eax cmp %edx,%esi sete %dl or %edx,%eax retq nopl 0x0(%rax,%rax,1)
func0: endbr64 cmp edi, esi setz al cmp edi, edx setz cl or eax, ecx cmp esi, edx setz dl or eax, edx retn
long long func0(int a1, int a2, int a3, int a4) { unsigned int v4; // eax LOBYTE(v4) = a1 == a2; LOBYTE(a4) = a1 == a3; LOBYTE(a3) = a2 == a3; return a3 | a4 | v4; }
func0: ENDBR64 CMP EDI,ESI SETZ AL CMP EDI,EDX SETZ CL OR EAX,ECX CMP ESI,EDX SETZ DL OR EAX,EDX RET
uint func0(int param_1,int param_2,int param_3,int4 param_4) { int8 in_RAX; return (uint)CONCAT71((int7)((ulong)in_RAX >> 8),param_1 == param_2) | CONCAT31((int3)((uint)param_4 >> 8),param_1 == param_3) | CONCAT31((int3)((uint)param_3 >> 8),param_2 == param_3); }
5,204
func0
#include <stdio.h> #include <assert.h>
void func0(int list1[], int result[], int m, int n, int size) { int index = 0; for (int i = m; i < size; i++, index++) { result[index] = list1[i]; } for (int i = 0; i < n; i++, index++) { result[index] = list1[i]; } }
int main() { int arr1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int result1[10]; func0(arr1, result1, 3, 4, 10); int expected1[10] = {4, 5, 6, 7, 8, 9, 10, 1, 2, 3}; for (int i = 0; i < 10; i++) { assert(result1[i] == expected1[i]); } int result2[10]; func0(arr1, result2, 2, 2, 10); int expected2[10] = {3, 4, 5, 6, 7, 8, 9, 10, 1, 2}; for (int i = 0; i < 10; i++) { assert(result2[i] == expected2[i]); } int result3[7]; func0(arr1, result3, 5, 2, 10); int expected3[7] = {6, 7, 8, 9, 10, 1, 2}; for (int i = 0; i < 7; i++) { assert(result3[i] == expected3[i]); } printf("All test cases passed!\n"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %edx,-0x24(%rbp) mov %ecx,-0x28(%rbp) mov %r8d,-0x2c(%rbp) movl $0x0,-0xc(%rbp) mov -0x24(%rbp),%eax mov %eax,-0x8(%rbp) jmp 11e7 <func0+0x5e> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0xc(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x20(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) addl $0x1,-0x8(%rbp) addl $0x1,-0xc(%rbp) mov -0x8(%rbp),%eax cmp -0x2c(%rbp),%eax jl 11b2 <func0+0x29> movl $0x0,-0x4(%rbp) jmp 122d <func0+0xa4> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0xc(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x20(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) addl $0x1,-0x4(%rbp) addl $0x1,-0xc(%rbp) mov -0x4(%rbp),%eax cmp -0x28(%rbp),%eax jl 11f8 <func0+0x6f> pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_24], edx mov [rbp+var_28], ecx mov [rbp+var_2C], r8d mov [rbp+var_C], 0 mov eax, [rbp+var_24] mov [rbp+var_8], eax jmp short loc_11E7 loc_11B2: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rbp+var_C] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+var_20] add rdx, rcx mov eax, [rax] mov [rdx], eax add [rbp+var_8], 1 add [rbp+var_C], 1 loc_11E7: mov eax, [rbp+var_8] cmp eax, [rbp+var_2C] jl short loc_11B2 mov [rbp+var_4], 0 jmp short loc_122D loc_11F8: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rbp+var_C] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+var_20] add rdx, rcx mov eax, [rax] mov [rdx], eax add [rbp+var_4], 1 add [rbp+var_C], 1 loc_122D: mov eax, [rbp+var_4] cmp eax, [rbp+var_28] jl short loc_11F8 nop nop pop rbp retn
long long func0(long long a1, long long a2, int a3, int a4, int a5) { long long result; // rax int v6; // [rsp+20h] [rbp-Ch] unsigned int i; // [rsp+28h] [rbp-4h] v6 = 0; while ( a3 < a5 ) *(_DWORD *)(4LL * v6++ + a2) = *(_DWORD *)(4LL * a3++ + a1); for ( i = 0; ; ++i ) { result = i; if ( (int)i >= a4 ) break; *(_DWORD *)(4LL * v6++ + a2) = *(_DWORD *)(4LL * (int)i + a1); } return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV dword ptr [RBP + -0x24],EDX MOV dword ptr [RBP + -0x28],ECX MOV dword ptr [RBP + -0x2c],R8D MOV dword ptr [RBP + -0xc],0x0 MOV EAX,dword ptr [RBP + -0x24] MOV dword ptr [RBP + -0x8],EAX JMP 0x001011e7 LAB_001011b2: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x20] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX ADD dword ptr [RBP + -0x8],0x1 ADD dword ptr [RBP + -0xc],0x1 LAB_001011e7: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x2c] JL 0x001011b2 MOV dword ptr [RBP + -0x4],0x0 JMP 0x0010122d LAB_001011f8: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x20] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX ADD dword ptr [RBP + -0x4],0x1 ADD dword ptr [RBP + -0xc],0x1 LAB_0010122d: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x28] JL 0x001011f8 NOP NOP POP RBP RET
void func0(long param_1,long param_2,int param_3,int param_4,int param_5) { int4 local_14; int4 local_10; int4 local_c; local_14 = 0; for (local_10 = param_3; local_10 < param_5; local_10 = local_10 + 1) { *(int4 *)(param_2 + (long)local_14 * 4) = *(int4 *)(param_1 + (long)local_10 * 4); local_14 = local_14 + 1; } for (local_c = 0; local_c < param_4; local_c = local_c + 1) { *(int4 *)(param_2 + (long)local_14 * 4) = *(int4 *)(param_1 + (long)local_c * 4); local_14 = local_14 + 1; } return; }
5,205
func0
#include <stdio.h> #include <assert.h>
void func0(int list1[], int result[], int m, int n, int size) { int index = 0; for (int i = m; i < size; i++, index++) { result[index] = list1[i]; } for (int i = 0; i < n; i++, index++) { result[index] = list1[i]; } }
int main() { int arr1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int result1[10]; func0(arr1, result1, 3, 4, 10); int expected1[10] = {4, 5, 6, 7, 8, 9, 10, 1, 2, 3}; for (int i = 0; i < 10; i++) { assert(result1[i] == expected1[i]); } int result2[10]; func0(arr1, result2, 2, 2, 10); int expected2[10] = {3, 4, 5, 6, 7, 8, 9, 10, 1, 2}; for (int i = 0; i < 10; i++) { assert(result2[i] == expected2[i]); } int result3[7]; func0(arr1, result3, 5, 2, 10); int expected3[7] = {6, 7, 8, 9, 10, 1, 2}; for (int i = 0; i < 7; i++) { assert(result3[i] == expected3[i]); } printf("All test cases passed!\n"); return 0; }
O1
c
func0: endbr64 cmp %r8d,%edx jge 11da <func0+0x51> movslq %edx,%rax mov %rax,%r9 neg %r9 lea (%rsi,%r9,4),%r10 mov (%rdi,%rax,4),%r9d mov %r9d,(%r10,%rax,4) add $0x1,%rax cmp %eax,%r8d jg 119f <func0+0x16> sub %edx,%r8d test %ecx,%ecx jle 11d9 <func0+0x50> lea -0x1(%rcx),%r9d movslq %r8d,%r8 lea (%rsi,%r8,4),%rcx mov $0x0,%eax mov (%rdi,%rax,4),%edx mov %edx,(%rcx,%rax,4) mov %rax,%rdx add $0x1,%rax cmp %r9,%rdx jne 11c7 <func0+0x3e> retq mov $0x0,%r8d jmp 11b3 <func0+0x2a>
func0: endbr64 mov r10, rsi cmp edx, r8d jge short loc_11D7 movsxd rax, edx mov rsi, rax neg rsi lea r9, [r10+rsi*4] loc_11A2: mov esi, [rdi+rax*4] mov [r9+rax*4], esi add rax, 1 cmp r8d, eax jg short loc_11A2 sub r8d, edx loc_11B5: test ecx, ecx jle short locret_11D6 mov ecx, ecx movsxd r8, r8d lea rsi, [r10+r8*4] mov eax, 0 loc_11C7: mov edx, [rdi+rax*4] mov [rsi+rax*4], edx add rax, 1 cmp rax, rcx jnz short loc_11C7 locret_11D6: retn loc_11D7: mov r8d, 0 jmp short loc_11B5
void func0(long long a1, long long a2, int a3, int a4, int a5) { long long v5; // rax int v6; // r8d long long i; // rax if ( a3 >= a5 ) { v6 = 0; } else { v5 = a3; do { *(_DWORD *)(a2 - 4LL * a3 + 4 * v5) = *(_DWORD *)(a1 + 4 * v5); ++v5; } while ( a5 > (int)v5 ); v6 = a5 - a3; } if ( a4 > 0 ) { for ( i = 0LL; i != a4; ++i ) *(_DWORD *)(a2 + 4LL * v6 + 4 * i) = *(_DWORD *)(a1 + 4 * i); } }
func0: ENDBR64 MOV R10,RSI CMP EDX,R8D JGE 0x001011d7 MOVSXD RAX,EDX MOV RSI,RAX NEG RSI LEA R9,[R10 + RSI*0x4] LAB_001011a2: MOV ESI,dword ptr [RDI + RAX*0x4] MOV dword ptr [R9 + RAX*0x4],ESI ADD RAX,0x1 CMP R8D,EAX JG 0x001011a2 SUB R8D,EDX LAB_001011b5: TEST ECX,ECX JLE 0x001011d6 MOV ECX,ECX MOVSXD R8,R8D LEA RSI,[R10 + R8*0x4] MOV EAX,0x0 LAB_001011c7: MOV EDX,dword ptr [RDI + RAX*0x4] MOV dword ptr [RSI + RAX*0x4],EDX ADD RAX,0x1 CMP RAX,RCX JNZ 0x001011c7 LAB_001011d6: RET LAB_001011d7: MOV R8D,0x0 JMP 0x001011b5
void func0(long param_1,long param_2,int param_3,uint param_4,int param_5) { long lVar1; long lVar2; ulong uVar3; if (param_3 < param_5) { lVar2 = (long)param_3; lVar1 = lVar2 * -4; do { *(int4 *)(param_2 + lVar1 + lVar2 * 4) = *(int4 *)(param_1 + lVar2 * 4); lVar2 = lVar2 + 1; } while ((int)lVar2 < param_5); param_5 = param_5 - param_3; } else { param_5 = 0; } if (0 < (int)param_4) { uVar3 = 0; do { *(int4 *)(param_2 + (long)param_5 * 4 + uVar3 * 4) = *(int4 *)(param_1 + uVar3 * 4); uVar3 = uVar3 + 1; } while (uVar3 != param_4); } return; }
5,206
func0
#include <stdio.h> #include <assert.h>
void func0(int list1[], int result[], int m, int n, int size) { int index = 0; for (int i = m; i < size; i++, index++) { result[index] = list1[i]; } for (int i = 0; i < n; i++, index++) { result[index] = list1[i]; } }
int main() { int arr1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int result1[10]; func0(arr1, result1, 3, 4, 10); int expected1[10] = {4, 5, 6, 7, 8, 9, 10, 1, 2, 3}; for (int i = 0; i < 10; i++) { assert(result1[i] == expected1[i]); } int result2[10]; func0(arr1, result2, 2, 2, 10); int expected2[10] = {3, 4, 5, 6, 7, 8, 9, 10, 1, 2}; for (int i = 0; i < 10; i++) { assert(result2[i] == expected2[i]); } int result3[7]; func0(arr1, result3, 5, 2, 10); int expected3[7] = {6, 7, 8, 9, 10, 1, 2}; for (int i = 0; i < 7; i++) { assert(result3[i] == expected3[i]); } printf("All test cases passed!\n"); return 0; }
O2
c
func0: endbr64 cmp %r8d,%edx jge 14b0 <func0+0x60> movslq %edx,%rax mov %rax,%r9 neg %r9 lea (%rsi,%r9,4),%r10 nopw %cs:0x0(%rax,%rax,1) mov (%rdi,%rax,4),%r9d mov %r9d,(%r10,%rax,4) add $0x1,%rax cmp %eax,%r8d jg 1470 <func0+0x20> sub %edx,%r8d test %ecx,%ecx jle 14aa <func0+0x5a> movslq %r8d,%r8 lea -0x1(%rcx),%r9d xor %eax,%eax lea (%rsi,%r8,4),%rcx nopl (%rax) mov (%rdi,%rax,4),%edx mov %edx,(%rcx,%rax,4) mov %rax,%rdx add $0x1,%rax cmp %rdx,%r9 jne 1498 <func0+0x48> retq nopl 0x0(%rax,%rax,1) xor %r8d,%r8d jmp 1484 <func0+0x34> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 mov r10, rsi cmp edx, r8d jge short loc_1480 movsxd rax, edx mov rsi, rax neg rsi lea r9, [r10+rsi*4] nop dword ptr [rax+00000000h] loc_1440: mov esi, [rdi+rax*4] mov [r9+rax*4], esi add rax, 1 cmp r8d, eax jg short loc_1440 sub r8d, edx loc_1453: test ecx, ecx jle short locret_1477 movsxd r8, r8d movsxd rcx, ecx xor eax, eax lea rsi, [r10+r8*4] nop dword ptr [rax+rax+00h] loc_1468: mov edx, [rdi+rax*4] mov [rsi+rax*4], edx add rax, 1 cmp rcx, rax jnz short loc_1468 locret_1477: retn loc_1480: xor r8d, r8d jmp short loc_1453
void func0(long long a1, long long a2, int a3, int a4, int a5) { long long v5; // rax int v6; // r8d long long i; // rax if ( a3 >= a5 ) { v6 = 0; } else { v5 = a3; do { *(_DWORD *)(a2 - 4LL * a3 + 4 * v5) = *(_DWORD *)(a1 + 4 * v5); ++v5; } while ( a5 > (int)v5 ); v6 = a5 - a3; } if ( a4 > 0 ) { for ( i = 0LL; i != a4; ++i ) *(_DWORD *)(a2 + 4LL * v6 + 4 * i) = *(_DWORD *)(a1 + 4 * i); } }
func0: ENDBR64 MOV R10,RSI CMP EDX,R8D JGE 0x00101480 MOVSXD RAX,EDX MOV RSI,RAX NEG RSI LEA R9,[R10 + RSI*0x4] NOP dword ptr [RAX] LAB_00101440: MOV ESI,dword ptr [RDI + RAX*0x4] MOV dword ptr [R9 + RAX*0x4],ESI ADD RAX,0x1 CMP R8D,EAX JG 0x00101440 SUB R8D,EDX LAB_00101453: TEST ECX,ECX JLE 0x00101477 MOVSXD R8,R8D MOVSXD RCX,ECX XOR EAX,EAX LEA RSI,[R10 + R8*0x4] NOP dword ptr [RAX + RAX*0x1] LAB_00101468: MOV EDX,dword ptr [RDI + RAX*0x4] MOV dword ptr [RSI + RAX*0x4],EDX ADD RAX,0x1 CMP RCX,RAX JNZ 0x00101468 LAB_00101477: RET LAB_00101480: XOR R8D,R8D JMP 0x00101453
void func0(long param_1,long param_2,int param_3,int param_4,int param_5) { long lVar1; long lVar2; if (param_3 < param_5) { lVar1 = (long)param_3; lVar2 = lVar1 * -4; do { *(int4 *)(param_2 + lVar2 + lVar1 * 4) = *(int4 *)(param_1 + lVar1 * 4); lVar1 = lVar1 + 1; } while ((int)lVar1 < param_5); param_5 = param_5 - param_3; } else { param_5 = 0; } if (0 < param_4) { lVar2 = 0; do { *(int4 *)(param_2 + (long)param_5 * 4 + lVar2 * 4) = *(int4 *)(param_1 + lVar2 * 4); lVar2 = lVar2 + 1; } while (param_4 != lVar2); } return; }
5,207
func0
#include <stdio.h> #include <assert.h>
void func0(int list1[], int result[], int m, int n, int size) { int index = 0; for (int i = m; i < size; i++, index++) { result[index] = list1[i]; } for (int i = 0; i < n; i++, index++) { result[index] = list1[i]; } }
int main() { int arr1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int result1[10]; func0(arr1, result1, 3, 4, 10); int expected1[10] = {4, 5, 6, 7, 8, 9, 10, 1, 2, 3}; for (int i = 0; i < 10; i++) { assert(result1[i] == expected1[i]); } int result2[10]; func0(arr1, result2, 2, 2, 10); int expected2[10] = {3, 4, 5, 6, 7, 8, 9, 10, 1, 2}; for (int i = 0; i < 10; i++) { assert(result2[i] == expected2[i]); } int result3[7]; func0(arr1, result3, 5, 2, 10); int expected3[7] = {6, 7, 8, 9, 10, 1, 2}; for (int i = 0; i < 7; i++) { assert(result3[i] == expected3[i]); } printf("All test cases passed!\n"); return 0; }
O3
c
func0: endbr64 cmp %r8d,%edx jge 1610 <func0+0x1c0> movslq %edx,%rax lea 0x10(%rdi,%rax,4),%r9 lea (%rdi,%rax,4),%r10 cmp %r9,%rsi lea 0x10(%rsi),%r9 setae %r11b cmp %r9,%r10 setae %r9b or %r9b,%r11b je 15e0 <func0+0x190> lea -0x1(%r8),%r9d sub %edx,%r9d cmp $0x3,%r9d jbe 15e0 <func0+0x190> mov %r8d,%r11d xor %eax,%eax sub %edx,%r11d mov %r11d,%r9d shr $0x2,%r9d shl $0x4,%r9 nopl 0x0(%rax,%rax,1) movdqu (%r10,%rax,1),%xmm0 movups %xmm0,(%rsi,%rax,1) add $0x10,%rax cmp %r9,%rax jne 14b0 <func0+0x60> mov %r11d,%eax and $0xfffffffc,%eax lea (%rdx,%rax,1),%r9d cmp %eax,%r11d je 1516 <func0+0xc6> movslq %r9d,%r10 mov (%rdi,%r10,4),%r11d movslq %eax,%r10 add $0x1,%eax mov %r11d,(%rsi,%r10,4) lea 0x1(%r9),%r10d cmp %r10d,%r8d jle 1516 <func0+0xc6> movslq %r10d,%r10 cltq add $0x2,%r9d mov (%rdi,%r10,4),%r10d lea 0x0(,%rax,4),%r11 mov %r10d,(%rsi,%rax,4) cmp %r9d,%r8d jle 1516 <func0+0xc6> movslq %r9d,%r9 mov (%rdi,%r9,4),%eax mov %eax,0x4(%rsi,%r11,1) sub %edx,%r8d test %ecx,%ecx jle 15db <func0+0x18b> movslq %r8d,%rdx lea 0x10(%rdi),%r10 lea -0x1(%rcx),%eax lea (%rsi,%rdx,4),%r9 lea 0x10(%rsi,%rdx,4),%rdx cmp %r10,%r9 setae %r10b cmp %rdx,%rdi setae %dl or %dl,%r10b je 15c0 <func0+0x170> cmp $0x3,%eax jbe 15c0 <func0+0x170> mov %ecx,%edx xor %eax,%eax shr $0x2,%edx shl $0x4,%rdx nopw %cs:0x0(%rax,%rax,1) movdqu (%rdi,%rax,1),%xmm1 movups %xmm1,(%r9,%rax,1) add $0x10,%rax cmp %rdx,%rax jne 1560 <func0+0x110> mov %ecx,%eax and $0xfffffffc,%eax add %eax,%r8d cmp %eax,%ecx je 15db <func0+0x18b> mov %eax,%edx mov (%rdi,%rdx,4),%r9d movslq %r8d,%rdx add $0x1,%r8d mov %r9d,(%rsi,%rdx,4) lea 0x1(%rax),%edx cmp %edx,%ecx jle 15db <func0+0x18b> movslq %edx,%rdx movslq %r8d,%r8 add $0x2,%eax mov (%rdi,%rdx,4),%edx lea 0x0(,%r8,4),%r9 mov %edx,(%rsi,%r8,4) cmp %eax,%ecx jle 15db <func0+0x18b> cltq mov (%rdi,%rax,4),%eax mov %eax,0x4(%rsi,%r9,1) retq xchg %ax,%ax mov %eax,%edx xor %eax,%eax nopl 0x0(%rax) mov (%rdi,%rax,4),%ecx mov %ecx,(%r9,%rax,4) mov %rax,%rcx add $0x1,%rax cmp %rdx,%rcx jne 15c8 <func0+0x178> retq nopl 0x0(%rax) mov %rax,%r9 neg %r9 lea (%rsi,%r9,4),%r10 nopw 0x0(%rax,%rax,1) mov (%rdi,%rax,4),%r9d mov %r9d,(%r10,%rax,4) add $0x1,%rax cmp %eax,%r8d jg 15f0 <func0+0x1a0> jmpq 1516 <func0+0xc6> nopw %cs:0x0(%rax,%rax,1) xor %r8d,%r8d jmpq 1519 <func0+0xc9> nopl 0x0(%rax,%rax,1)
func0: endbr64 mov r9d, edx push rbx movsxd rdx, ecx cmp r9d, r8d jge loc_1338 mov ecx, r8d sub ecx, r9d lea eax, [rcx-1] cmp eax, 2 movsxd rax, r9d jbe short loc_11AD lea r10, ds:4[rax*4] mov r11, rsi lea rbx, [rdi+r10] sub r11, rbx cmp r11, 8 ja short loc_1220 loc_11AD: mov r9d, ecx lea r10, [rdi+rax*4] xor eax, eax shl r9, 2 nop word ptr [rax+rax+00h] loc_11C0: mov r8d, [r10+rax] mov [rsi+rax], r8d add rax, 4 cmp r9, rax jnz short loc_11C0 loc_11D1: test edx, edx jle short loc_1217 lea eax, [rdx-1] cmp eax, 2 movsxd rax, ecx jbe short loc_11F8 lea r9, [rsi+rax*4] lea r10, [rdi+4] mov r8, r9 sub r8, r10 cmp r8, 8 ja loc_12B0 loc_11F8: lea rsi, [rsi+rax*4] shl rdx, 2 xor eax, eax nop word ptr [rax+rax+00h] loc_1208: mov ecx, [rdi+rax] mov [rsi+rax], ecx add rax, 4 cmp rax, rdx jnz short loc_1208 loc_1217: pop rbx retn loc_1220: lea r11, [rdi+r10-4] mov r10d, ecx xor eax, eax shr r10d, 2 shl r10, 4 nop word ptr [rax+rax+00h] loc_1238: movdqu xmm0, xmmword ptr [r11+rax] movups xmmword ptr [rsi+rax], xmm0 add rax, 10h cmp rax, r10 jnz short loc_1238 mov eax, ecx and eax, 0FFFFFFFCh add r9d, eax test cl, 3 jz loc_11D1 movsxd r11, r9d cdqe mov r11d, [rdi+r11*4] lea r10, ds:0[rax*4] mov [rsi+rax*4], r11d lea eax, [r9+1] cmp r8d, eax jle loc_11D1 cdqe add r9d, 2 lea r11, ds:0[rax*4] mov eax, [rdi+rax*4] mov [rsi+r10+4], eax cmp r8d, r9d jle loc_11D1 mov eax, [rdi+r11+4] mov [rsi+r10+8], eax jmp loc_11D1 loc_12B0: mov r8d, edx xor eax, eax shr r8d, 2 shl r8, 4 nop dword ptr [rax] loc_12C0: movdqu xmm1, xmmword ptr [rdi+rax] movups xmmword ptr [r9+rax], xmm1 add rax, 10h cmp rax, r8 jnz short loc_12C0 mov eax, edx and eax, 0FFFFFFFCh add ecx, eax cmp edx, eax jz loc_1217 mov r8d, eax mov r10d, [rdi+r8*4] lea r9, ds:0[r8*4] movsxd r8, ecx add ecx, 1 mov [rsi+r8*4], r10d lea r8d, [rax+1] cmp edx, r8d jle loc_1217 mov r8d, [rdi+r9+4] movsxd rcx, ecx add eax, 2 lea r10, ds:0[rcx*4] mov [rsi+rcx*4], r8d cmp edx, eax jle loc_1217 mov eax, [rdi+r9+8] mov [rsi+r10+4], eax pop rbx retn loc_1338: xor ecx, ecx jmp loc_11D1
void func0(long long a1, long long a2, int a3, int a4, int a5) { long long v6; // rdx unsigned int v7; // ecx long long v8; // rax long long v9; // rsi long long v10; // rdx long long v11; // rax long long v12; // rax int v13; // r9d long long v14; // r10 long long v15; // r11 long long v16; // rax unsigned int v17; // eax int v18; // ecx long long v19; // r9 long long v20; // r8 int v21; // ecx v6 = a4; if ( a3 >= a5 ) { v7 = 0; } else { v7 = a5 - a3; if ( (unsigned int)(a5 - a3 - 1) > 2 && (unsigned long long)(a2 - (a1 + 4LL * a3 + 4)) > 8 ) { v12 = 0LL; do { *(__m128i *)(a2 + v12) = _mm_loadu_si128((const __m128i *)(a1 + 4LL * a3 + v12)); v12 += 16LL; } while ( v12 != 16LL * (v7 >> 2) ); v13 = (v7 & 0xFFFFFFFC) + a3; if ( (v7 & 3) != 0 ) { v14 = 4LL * (int)(v7 & 0xFFFFFFFC); *(_DWORD *)(a2 + v14) = *(_DWORD *)(a1 + 4LL * v13); if ( a5 > v13 + 1 ) { v15 = 4LL * (v13 + 1); *(_DWORD *)(a2 + v14 + 4) = *(_DWORD *)(a1 + v15); if ( a5 > v13 + 2 ) *(_DWORD *)(a2 + v14 + 8) = *(_DWORD *)(a1 + v15 + 4); } } } else { v8 = 0LL; do { *(_DWORD *)(a2 + v8) = *(_DWORD *)(a1 + 4LL * a3 + v8); v8 += 4LL; } while ( 4LL * v7 != v8 ); } } if ( (int)v6 > 0 ) { if ( (unsigned int)(v6 - 1) > 2 && (unsigned long long)(a2 + 4LL * (int)v7 - (a1 + 4)) > 8 ) { v16 = 0LL; do { *(__m128i *)(a2 + 4LL * (int)v7 + v16) = _mm_loadu_si128((const __m128i *)(a1 + v16)); v16 += 16LL; } while ( v16 != 16LL * ((unsigned int)v6 >> 2) ); v17 = v6 & 0xFFFFFFFC; v18 = (v6 & 0xFFFFFFFC) + v7; if ( (_DWORD)v6 != (v6 & 0xFFFFFFFC) ) { v19 = 4LL * v17; v20 = v18; v21 = v18 + 1; *(_DWORD *)(a2 + 4 * v20) = *(_DWORD *)(a1 + v19); if ( (int)v6 > (int)(v17 + 1) ) { *(_DWORD *)(a2 + 4LL * v21) = *(_DWORD *)(a1 + v19 + 4); if ( (int)v6 > (int)(v17 + 2) ) *(_DWORD *)(a2 + 4LL * v21 + 4) = *(_DWORD *)(a1 + v19 + 8); } } } else { v9 = a2 + 4LL * (int)v7; v10 = 4 * v6; v11 = 0LL; do { *(_DWORD *)(v9 + v11) = *(_DWORD *)(a1 + v11); v11 += 4LL; } while ( v11 != v10 ); } } }
func0: ENDBR64 MOV R9D,EDX PUSH RBX MOVSXD RDX,ECX CMP R9D,R8D JGE 0x00101338 MOV ECX,R8D SUB ECX,R9D LEA EAX,[RCX + -0x1] CMP EAX,0x2 MOVSXD RAX,R9D JBE 0x001011ad LEA R10,[0x4 + RAX*0x4] MOV R11,RSI LEA RBX,[RDI + R10*0x1] SUB R11,RBX CMP R11,0x8 JA 0x00101220 LAB_001011ad: MOV R9D,ECX LEA R10,[RDI + RAX*0x4] XOR EAX,EAX SHL R9,0x2 NOP word ptr [RAX + RAX*0x1] LAB_001011c0: MOV R8D,dword ptr [R10 + RAX*0x1] MOV dword ptr [RSI + RAX*0x1],R8D ADD RAX,0x4 CMP R9,RAX JNZ 0x001011c0 LAB_001011d1: TEST EDX,EDX JLE 0x00101217 LEA EAX,[RDX + -0x1] CMP EAX,0x2 MOVSXD RAX,ECX JBE 0x001011f8 LEA R9,[RSI + RAX*0x4] LEA R10,[RDI + 0x4] MOV R8,R9 SUB R8,R10 CMP R8,0x8 JA 0x001012b0 LAB_001011f8: LEA RSI,[RSI + RAX*0x4] SHL RDX,0x2 XOR EAX,EAX NOP word ptr [RAX + RAX*0x1] LAB_00101208: MOV ECX,dword ptr [RDI + RAX*0x1] MOV dword ptr [RSI + RAX*0x1],ECX ADD RAX,0x4 CMP RAX,RDX JNZ 0x00101208 LAB_00101217: POP RBX RET LAB_00101220: LEA R11,[RDI + R10*0x1 + -0x4] MOV R10D,ECX XOR EAX,EAX SHR R10D,0x2 SHL R10,0x4 NOP word ptr [RAX + RAX*0x1] LAB_00101238: MOVDQU XMM0,xmmword ptr [R11 + RAX*0x1] MOVUPS xmmword ptr [RSI + RAX*0x1],XMM0 ADD RAX,0x10 CMP RAX,R10 JNZ 0x00101238 MOV EAX,ECX AND EAX,0xfffffffc ADD R9D,EAX TEST CL,0x3 JZ 0x001011d1 MOVSXD R11,R9D CDQE MOV R11D,dword ptr [RDI + R11*0x4] LEA R10,[RAX*0x4] MOV dword ptr [RSI + RAX*0x4],R11D LEA EAX,[R9 + 0x1] CMP R8D,EAX JLE 0x001011d1 CDQE ADD R9D,0x2 LEA R11,[RAX*0x4] MOV EAX,dword ptr [RDI + RAX*0x4] MOV dword ptr [RSI + R10*0x1 + 0x4],EAX CMP R8D,R9D JLE 0x001011d1 MOV EAX,dword ptr [RDI + R11*0x1 + 0x4] MOV dword ptr [RSI + R10*0x1 + 0x8],EAX JMP 0x001011d1 LAB_001012b0: MOV R8D,EDX XOR EAX,EAX SHR R8D,0x2 SHL R8,0x4 NOP dword ptr [RAX] LAB_001012c0: MOVDQU XMM1,xmmword ptr [RDI + RAX*0x1] MOVUPS xmmword ptr [R9 + RAX*0x1],XMM1 ADD RAX,0x10 CMP RAX,R8 JNZ 0x001012c0 MOV EAX,EDX AND EAX,0xfffffffc ADD ECX,EAX CMP EDX,EAX JZ 0x00101217 MOV R8D,EAX MOV R10D,dword ptr [RDI + R8*0x4] LEA R9,[R8*0x4] MOVSXD R8,ECX ADD ECX,0x1 MOV dword ptr [RSI + R8*0x4],R10D LEA R8D,[RAX + 0x1] CMP EDX,R8D JLE 0x00101217 MOV R8D,dword ptr [RDI + R9*0x1 + 0x4] MOVSXD RCX,ECX ADD EAX,0x2 LEA R10,[RCX*0x4] MOV dword ptr [RSI + RCX*0x4],R8D CMP EDX,EAX JLE 0x00101217 MOV EAX,dword ptr [RDI + R9*0x1 + 0x8] MOV dword ptr [RSI + R10*0x1 + 0x4],EAX POP RBX RET LAB_00101338: XOR ECX,ECX JMP 0x001011d1
void func0(long param_1,long param_2,int param_3,uint param_4,int param_5) { int iVar1; int8 *puVar2; int8 uVar3; uint uVar4; long lVar5; long lVar6; uint uVar7; if (param_3 < param_5) { uVar7 = param_5 - param_3; if ((uVar7 - 1 < 3) || (lVar5 = (long)param_3 * 4 + 4, (ulong)(param_2 - (param_1 + lVar5)) < 9) ) { lVar5 = 0; do { *(int4 *)(param_2 + lVar5) = *(int4 *)(param_1 + (long)param_3 * 4 + lVar5); lVar5 = lVar5 + 4; } while ((ulong)uVar7 << 2 != lVar5); } else { lVar6 = 0; do { puVar2 = (int8 *)(param_1 + -4 + lVar5 + lVar6); uVar3 = puVar2[1]; *(int8 *)(param_2 + lVar6) = *puVar2; ((int8 *)(param_2 + lVar6))[1] = uVar3; lVar6 = lVar6 + 0x10; } while (lVar6 != (ulong)(uVar7 >> 2) << 4); uVar4 = uVar7 & 0xfffffffc; param_3 = param_3 + uVar4; if ((uVar7 & 3) != 0) { lVar5 = (long)(int)uVar4 * 4; *(int4 *)(param_2 + (long)(int)uVar4 * 4) = *(int4 *)(param_1 + (long)param_3 * 4); iVar1 = param_3 + 1; if (iVar1 < param_5) { *(int4 *)(param_2 + 4 + lVar5) = *(int4 *)(param_1 + (long)iVar1 * 4); if (param_3 + 2 < param_5) { *(int4 *)(param_2 + 8 + lVar5) = *(int4 *)(param_1 + 4 + (long)iVar1 * 4); } } } } } else { uVar7 = 0; } if (0 < (int)param_4) { if ((param_4 - 1 < 3) || (lVar5 = param_2 + (long)(int)uVar7 * 4, (ulong)(lVar5 - (param_1 + 4)) < 9)) { lVar5 = 0; do { *(int4 *)(param_2 + (long)(int)uVar7 * 4 + lVar5) = *(int4 *)(param_1 + lVar5); lVar5 = lVar5 + 4; } while (lVar5 != (long)(int)param_4 * 4); } else { lVar6 = 0; do { uVar3 = ((int8 *)(param_1 + lVar6))[1]; puVar2 = (int8 *)(lVar5 + lVar6); *puVar2 = *(int8 *)(param_1 + lVar6); puVar2[1] = uVar3; lVar6 = lVar6 + 0x10; } while (lVar6 != (ulong)(param_4 >> 2) << 4); uVar4 = param_4 & 0xfffffffc; if (param_4 != uVar4) { lVar5 = (ulong)uVar4 * 4; *(int4 *)(param_2 + (long)(int)(uVar7 + uVar4) * 4) = *(int4 *)(param_1 + (ulong)uVar4 * 4); if ((int)(uVar4 + 1) < (int)param_4) { lVar6 = (long)(int)(uVar7 + uVar4 + 1); *(int4 *)(param_2 + lVar6 * 4) = *(int4 *)(param_1 + 4 + lVar5); if ((int)(uVar4 + 2) < (int)param_4) { *(int4 *)(param_2 + 4 + lVar6 * 4) = *(int4 *)(param_1 + 8 + lVar5); return; } } } } } return; }
5,208
func0
#include <assert.h>
int func0(int list[], int list_size) { int neg_count = 0; for (int i = 0; i < list_size; i++) { if (list[i] <= 0) { neg_count += 1; } } return neg_count; }
int main() { int list1[] = {-1, -2, 3, -4, -5}; int list2[] = {1, 2, 3}; int list3[] = {1, 2, -3, -10, 20}; assert(func0(list1, 5) == 4); assert(func0(list2, 3) == 0); assert(func0(list3, 5) == 2); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0x8(%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 test %eax,%eax jg 11a6 <func0+0x3d> addl $0x1,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1188 <func0+0x1f> mov -0x8(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_11AA loc_1188: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] test eax, eax jg short loc_11A6 add [rbp+var_8], 1 loc_11A6: add [rbp+var_4], 1 loc_11AA: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1188 mov eax, [rbp+var_8] pop rbp retn
long long func0(long long a1, int a2) { unsigned int v3; // [rsp+14h] [rbp-8h] int i; // [rsp+18h] [rbp-4h] v3 = 0; for ( i = 0; i < a2; ++i ) { if ( *(int *)(4LL * i + a1) <= 0 ) ++v3; } return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011aa LAB_00101188: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JG 0x001011a6 ADD dword ptr [RBP + -0x8],0x1 LAB_001011a6: ADD dword ptr [RBP + -0x4],0x1 LAB_001011aa: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101188 MOV EAX,dword ptr [RBP + -0x8] POP RBP RET
int func0(long param_1,int param_2) { int4 local_10; int4 local_c; local_10 = 0; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { if (*(int *)(param_1 + (long)local_c * 4) < 1) { local_10 = local_10 + 1; } } return local_10; }
5,209
func0
#include <assert.h>
int func0(int list[], int list_size) { int neg_count = 0; for (int i = 0; i < list_size; i++) { if (list[i] <= 0) { neg_count += 1; } } return neg_count; }
int main() { int list1[] = {-1, -2, 3, -4, -5}; int list2[] = {1, 2, 3}; int list3[] = {1, 2, -3, -10, 20}; assert(func0(list1, 5) == 4); assert(func0(list2, 3) == 0); assert(func0(list3, 5) == 2); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 1198 <func0+0x2f> mov %rdi,%rax lea -0x1(%rsi),%edx lea 0x4(%rdi,%rdx,4),%rsi mov $0x0,%edx cmpl $0x0,(%rax) setle %cl movzbl %cl,%ecx add %ecx,%edx add $0x4,%rax cmp %rsi,%rax jne 1181 <func0+0x18> mov %edx,%eax retq mov $0x0,%edx jmp 1195 <func0+0x2c>
func0: endbr64 test esi, esi jle short loc_1198 mov rax, rdi lea edx, [rsi-1] lea rsi, [rdi+rdx*4+4] mov edx, 0 loc_1181: cmp dword ptr [rax], 0 setle cl movzx ecx, cl add edx, ecx add rax, 4 cmp rax, rsi jnz short loc_1181 loc_1195: mov eax, edx retn loc_1198: mov edx, 0 jmp short loc_1195
long long func0(_DWORD *a1, int a2) { _DWORD *v2; // rax long long v3; // rsi unsigned int v4; // edx if ( a2 <= 0 ) { return 0; } else { v2 = a1; v3 = (long long)&a1[a2 - 1 + 1]; v4 = 0; do v4 += *v2++ <= 0; while ( v2 != (_DWORD *)v3 ); } return v4; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101198 MOV RAX,RDI LEA EDX,[RSI + -0x1] LEA RSI,[RDI + RDX*0x4 + 0x4] MOV EDX,0x0 LAB_00101181: CMP dword ptr [RAX],0x0 SETLE CL MOVZX ECX,CL ADD EDX,ECX ADD RAX,0x4 CMP RAX,RSI JNZ 0x00101181 LAB_00101195: MOV EAX,EDX RET LAB_00101198: MOV EDX,0x0 JMP 0x00101195
int func0(int *param_1,int param_2) { int *piVar1; int iVar2; if (param_2 < 1) { iVar2 = 0; } else { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar2 = 0; do { iVar2 = iVar2 + (uint)(*param_1 < 1); param_1 = param_1 + 1; } while (param_1 != piVar1); } return iVar2; }
5,210
func0
#include <assert.h>
int func0(int list[], int list_size) { int neg_count = 0; for (int i = 0; i < list_size; i++) { if (list[i] <= 0) { neg_count += 1; } } return neg_count; }
int main() { int list1[] = {-1, -2, 3, -4, -5}; int list2[] = {1, 2, 3}; int list3[] = {1, 2, -3, -10, 20}; assert(func0(list1, 5) == 4); assert(func0(list2, 3) == 0); assert(func0(list3, 5) == 2); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1270 <func0+0x30> lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rcx xor %eax,%eax nopw 0x0(%rax,%rax,1) mov (%rdi),%esi xor %edx,%edx test %esi,%esi setle %dl add $0x4,%rdi add %edx,%eax cmp %rcx,%rdi jne 1258 <func0+0x18> retq nopl (%rax) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 test esi, esi jle short loc_12C0 lea eax, [rsi-1] lea rcx, [rdi+rax*4+4] xor eax, eax nop word ptr [rax+rax+00h] loc_12A8: mov esi, [rdi] xor edx, edx test esi, esi setle dl add rdi, 4 add eax, edx cmp rdi, rcx jnz short loc_12A8 retn loc_12C0: xor eax, eax retn
long long func0(_DWORD *a1, int a2) { long long v2; // rcx long long result; // rax BOOL v4; // edx if ( a2 <= 0 ) return 0LL; v2 = (long long)&a1[a2 - 1 + 1]; LODWORD(result) = 0; do { v4 = *a1++ <= 0; result = (unsigned int)(v4 + result); } while ( a1 != (_DWORD *)v2 ); return result; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001012c0 LEA EAX,[RSI + -0x1] LEA RCX,[RDI + RAX*0x4 + 0x4] XOR EAX,EAX NOP word ptr [RAX + RAX*0x1] LAB_001012a8: MOV ESI,dword ptr [RDI] XOR EDX,EDX TEST ESI,ESI SETLE DL ADD RDI,0x4 ADD EAX,EDX CMP RDI,RCX JNZ 0x001012a8 RET LAB_001012c0: XOR EAX,EAX RET
int func0(int *param_1,int param_2) { int *piVar1; int iVar2; int iVar3; if (0 < param_2) { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar3 = 0; do { iVar2 = *param_1; param_1 = param_1 + 1; iVar3 = iVar3 + (uint)(iVar2 < 1); } while (param_1 != piVar1); return iVar3; } return 0; }
5,211
func0
#include <assert.h>
int func0(int list[], int list_size) { int neg_count = 0; for (int i = 0; i < list_size; i++) { if (list[i] <= 0) { neg_count += 1; } } return neg_count; }
int main() { int list1[] = {-1, -2, 3, -4, -5}; int list2[] = {1, 2, 3}; int list3[] = {1, 2, -3, -10, 20}; assert(func0(list1, 5) == 4); assert(func0(list2, 3) == 0); assert(func0(list3, 5) == 2); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 1310 <func0+0xf0> lea -0x1(%rsi),%eax cmp $0x3,%eax jbe 1313 <func0+0xf3> mov %esi,%edx pxor %xmm1,%xmm1 pcmpeqd %xmm2,%xmm2 mov %rdi,%rax shr $0x2,%edx movdqa %xmm1,%xmm3 shl $0x4,%rdx add %rdi,%rdx nopl 0x0(%rax,%rax,1) movdqu (%rax),%xmm0 add $0x10,%rax pcmpgtd %xmm3,%xmm0 pandn %xmm2,%xmm0 psubd %xmm0,%xmm1 cmp %rdx,%rax jne 1258 <func0+0x38> movdqa %xmm1,%xmm0 mov %esi,%edx psrldq $0x8,%xmm0 and $0xfffffffc,%edx paddd %xmm0,%xmm1 movdqa %xmm1,%xmm0 psrldq $0x4,%xmm0 paddd %xmm0,%xmm1 movd %xmm1,%eax test $0x3,%sil je 1300 <func0+0xe0> movslq %edx,%rcx mov (%rdi,%rcx,4),%r9d test %r9d,%r9d jle 12e0 <func0+0xc0> lea 0x1(%rdx),%ecx cmp %esi,%ecx jge 12db <func0+0xbb> movslq %ecx,%rcx mov (%rdi,%rcx,4),%r8d test %r8d,%r8d jle 12e8 <func0+0xc8> lea 0x2(%rdx),%ecx cmp %ecx,%esi jle 12db <func0+0xbb> movslq %ecx,%rcx mov (%rdi,%rcx,4),%ecx test %ecx,%ecx jle 12f0 <func0+0xd0> add $0x3,%edx cmp %edx,%esi jle 12db <func0+0xbb> movslq %edx,%rdx mov (%rdi,%rdx,4),%edx test %edx,%edx jle 1308 <func0+0xe8> retq nopl 0x0(%rax) add $0x1,%eax jmp 12a6 <func0+0x86> nopl (%rax) add $0x1,%eax jmp 12b9 <func0+0x99> nopl (%rax) add $0x3,%edx add $0x1,%eax cmp %edx,%esi jg 12d1 <func0+0xb1> jmp 12db <func0+0xbb> nopl 0x0(%rax) retq nopl 0x0(%rax) add $0x1,%eax retq nopl 0x0(%rax) xor %eax,%eax retq xor %edx,%edx xor %eax,%eax jmp 129a <func0+0x7a> nopl 0x0(%rax)
func0: endbr64 mov rcx, rdi test esi, esi jle loc_1220 lea eax, [rsi-1] cmp eax, 2 jbe loc_1223 mov edx, esi movdqa xmm2, cs:xmmword_2010 mov rax, rdi pxor xmm0, xmm0 shr edx, 2 shl rdx, 4 add rdx, rdi nop word ptr [rax+rax+00000000h] loc_1180: movdqu xmm3, xmmword ptr [rax] movdqa xmm1, xmm2 add rax, 10h pcmpgtd xmm1, xmm3 psubd xmm0, xmm1 cmp rdx, rax jnz short loc_1180 movdqa xmm1, xmm0 mov edx, esi psrldq xmm1, 8 and edx, 0FFFFFFFCh paddd xmm0, xmm1 movdqa xmm1, xmm0 psrldq xmm1, 4 paddd xmm0, xmm1 movd eax, xmm0 test sil, 3 jz short locret_1218 loc_11C2: movsxd rdi, edx mov r9d, [rcx+rdi*4] lea r8, ds:0[rdi*4] test r9d, r9d jle short loc_1200 loc_11D6: lea edi, [rdx+1] cmp esi, edi jle short locret_11F6 mov edi, [rcx+r8+4] test edi, edi jle short loc_1208 loc_11E6: add edx, 2 cmp esi, edx jle short locret_11F6 mov edx, [rcx+r8+8] test edx, edx jle short loc_1210 locret_11F6: retn loc_1200: add eax, 1 jmp short loc_11D6 loc_1208: add eax, 1 jmp short loc_11E6 loc_1210: add eax, 1 retn locret_1218: retn loc_1220: xor eax, eax retn loc_1223: xor edx, edx xor eax, eax jmp short loc_11C2
long long func0(const __m128i *a1, int a2) { __m128i si128; // xmm2 const __m128i *v3; // rax __m128i v4; // xmm0 __m128i v5; // xmm3 int v6; // edx __m128i v7; // xmm0 long long result; // rax long long v9; // r8 if ( a2 <= 0 ) return 0LL; if ( (unsigned int)(a2 - 1) <= 2 ) { v6 = 0; result = 0LL; } else { si128 = _mm_load_si128((const __m128i *)&xmmword_2010); v3 = a1; v4 = 0LL; do { v5 = _mm_loadu_si128(v3++); v4 = _mm_sub_epi32(v4, _mm_cmpgt_epi32(si128, v5)); } while ( &a1[(unsigned int)a2 >> 2] != v3 ); v6 = a2 & 0x7FFFFFFC; v7 = _mm_add_epi32(v4, _mm_srli_si128(v4, 8)); result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v7, _mm_srli_si128(v7, 4))); if ( (a2 & 3) == 0 ) return result; } v9 = v6; if ( a1->m128i_i32[v9] <= 0 ) result = (unsigned int)(result + 1); if ( a2 > v6 + 1 ) { if ( a1->m128i_i32[v9 + 1] <= 0 ) result = (unsigned int)(result + 1); if ( a2 > v6 + 2 && a1->m128i_i32[v9 + 2] <= 0 ) return (unsigned int)(result + 1); } return result; }
func0: ENDBR64 MOV RCX,RDI TEST ESI,ESI JLE 0x00101220 LEA EAX,[RSI + -0x1] CMP EAX,0x2 JBE 0x00101223 MOV EDX,ESI MOVDQA XMM2,xmmword ptr [0x00102010] MOV RAX,RDI PXOR XMM0,XMM0 SHR EDX,0x2 SHL RDX,0x4 ADD RDX,RDI NOP word ptr CS:[RAX + RAX*0x1] LAB_00101180: MOVDQU XMM3,xmmword ptr [RAX] MOVDQA XMM1,XMM2 ADD RAX,0x10 PCMPGTD XMM1,XMM3 PSUBD XMM0,XMM1 CMP RDX,RAX JNZ 0x00101180 MOVDQA XMM1,XMM0 MOV EDX,ESI PSRLDQ XMM1,0x8 AND EDX,0xfffffffc PADDD XMM0,XMM1 MOVDQA XMM1,XMM0 PSRLDQ XMM1,0x4 PADDD XMM0,XMM1 MOVD EAX,XMM0 TEST SIL,0x3 JZ 0x00101218 LAB_001011c2: MOVSXD RDI,EDX MOV R9D,dword ptr [RCX + RDI*0x4] LEA R8,[RDI*0x4] TEST R9D,R9D JLE 0x00101200 LAB_001011d6: LEA EDI,[RDX + 0x1] CMP ESI,EDI JLE 0x001011f6 MOV EDI,dword ptr [RCX + R8*0x1 + 0x4] TEST EDI,EDI JLE 0x00101208 LAB_001011e6: ADD EDX,0x2 CMP ESI,EDX JLE 0x001011f6 MOV EDX,dword ptr [RCX + R8*0x1 + 0x8] TEST EDX,EDX JLE 0x00101210 LAB_001011f6: RET LAB_00101200: ADD EAX,0x1 JMP 0x001011d6 LAB_00101208: ADD EAX,0x1 JMP 0x001011e6 LAB_00101210: ADD EAX,0x1 RET LAB_00101218: RET LAB_00101220: XOR EAX,EAX RET LAB_00101223: XOR EDX,EDX XOR EAX,EAX JMP 0x001011c2
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ int func0(int *param_1,uint param_2) { int iVar1; int *piVar2; int *piVar3; int *piVar4; int *piVar5; uint uVar6; int iVar7; int iVar8; int iVar9; int iVar10; if ((int)param_2 < 1) { return 0; } if (param_2 - 1 < 3) { uVar6 = 0; iVar7 = 0; } else { iVar7 = 0; iVar8 = 0; iVar9 = 0; iVar10 = 0; piVar5 = param_1; do { iVar1 = *piVar5; piVar2 = piVar5 + 1; piVar3 = piVar5 + 2; piVar4 = piVar5 + 3; piVar5 = piVar5 + 4; iVar7 = iVar7 + (uint)(iVar1 < _DAT_00102010); iVar8 = iVar8 + (uint)(*piVar2 < _UNK_00102014); iVar9 = iVar9 + (uint)(*piVar3 < _UNK_00102018); iVar10 = iVar10 + (uint)(*piVar4 < _UNK_0010201c); } while (param_1 + (ulong)(param_2 >> 2) * 4 != piVar5); uVar6 = param_2 & 0xfffffffc; iVar7 = iVar7 + iVar9 + iVar8 + iVar10; if ((param_2 & 3) == 0) { return iVar7; } } if (param_1[(int)uVar6] < 1) { iVar7 = iVar7 + 1; } if ((int)(uVar6 + 1) < (int)param_2) { if (param_1[(long)(int)uVar6 + 1] < 1) { iVar7 = iVar7 + 1; } if (((int)(uVar6 + 2) < (int)param_2) && (param_1[(long)(int)uVar6 + 2] < 1)) { return iVar7 + 1; } } return iVar7; }
5,212
func0
#include <stdio.h> #include <string.h> #include <regex.h> #include <assert.h>
void func0(const char* text, char output[][6], int* count) { regex_t regex; regmatch_t pmatch[1]; const char* pattern = "\\b\\w{3,5}\\b"; regcomp(&regex, pattern, REG_EXTENDED); const char* current = text; *count = 0; while (regexec(&regex, current, 1, pmatch, 0) == 0) { int start = pmatch[0].rm_so; int end = pmatch[0].rm_eo; int length = end - start; strncpy(output[*count], current + start, length); output[*count][length] = '\0'; (*count)++; current += end; } regfree(&regex); }
int main() { char words1[5][6]; int count1 = 0; func0("For the four consumer complaints contact manager AKR reddy", words1, &count1); assert(count1 == 5 && strcmp(words1[0], "For") == 0 && strcmp(words1[1], "the") == 0 && strcmp(words1[2], "four") == 0 && strcmp(words1[3], "AKR") == 0 && strcmp(words1[4], "reddy") == 0); char words2[2][6]; int count2 = 0; func0("Certain service are subject to change MSR", words2, &count2); assert(count2 == 2 && strcmp(words2[0], "are") == 0 && strcmp(words2[1], "MSR") == 0); char words3[3][6]; int count3 = 0; func0("Third party legal desclaimers", words3, &count3); assert(count3 == 3 && strcmp(words3[0], "Third") == 0 && strcmp(words3[1], "party") == 0 && strcmp(words3[2], "legal") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x90,%rsp mov %rdi,-0x78(%rbp) mov %rsi,-0x80(%rbp) mov %rdx,-0x88(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea 0xdcb(%rip),%rax mov %rax,-0x58(%rbp) mov -0x58(%rbp),%rcx lea -0x50(%rbp),%rax mov $0x1,%edx mov %rcx,%rsi mov %rax,%rdi callq 10f0 <regcomp@plt> mov -0x78(%rbp),%rax mov %rax,-0x60(%rbp) mov -0x88(%rbp),%rax movl $0x0,(%rax) jmpq 1312 <func0+0x109> mov -0x10(%rbp),%eax mov %eax,-0x6c(%rbp) mov -0xc(%rbp),%eax mov %eax,-0x68(%rbp) mov -0x68(%rbp),%eax sub -0x6c(%rbp),%eax mov %eax,-0x64(%rbp) mov -0x64(%rbp),%eax movslq %eax,%rcx mov -0x6c(%rbp),%eax movslq %eax,%rdx mov -0x60(%rbp),%rax lea (%rdx,%rax,1),%rsi mov -0x88(%rbp),%rax mov (%rax),%eax movslq %eax,%rdx mov %rdx,%rax add %rax,%rax add %rdx,%rax add %rax,%rax mov %rax,%rdx mov -0x80(%rbp),%rax add %rdx,%rax mov %rcx,%rdx mov %rax,%rdi callq 10b0 <strncpy@plt> mov -0x88(%rbp),%rax mov (%rax),%eax movslq %eax,%rdx mov %rdx,%rax add %rax,%rax add %rdx,%rax add %rax,%rax mov %rax,%rdx mov -0x80(%rbp),%rax add %rax,%rdx mov -0x64(%rbp),%eax cltq movb $0x0,(%rdx,%rax,1) mov -0x88(%rbp),%rax mov (%rax),%eax lea 0x1(%rax),%edx mov -0x88(%rbp),%rax mov %edx,(%rax) mov -0x68(%rbp),%eax cltq add %rax,-0x60(%rbp) lea -0x10(%rbp),%rdx mov -0x60(%rbp),%rsi lea -0x50(%rbp),%rax mov $0x0,%r8d mov %rdx,%rcx mov $0x1,%edx mov %rax,%rdi callq 1110 <regexec@plt> test %eax,%eax je 1273 <func0+0x6a> lea -0x50(%rbp),%rax mov %rax,%rdi callq 10c0 <regfree@plt> mov -0x8(%rbp),%rax xor %fs:0x28,%rax je 135d <func0+0x154> callq 10d0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 90h mov [rbp+var_78], rdi mov [rbp+var_80], rsi mov [rbp+var_88], rdx mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea rax, aBW35B; "\\b\\w{3,5}\\b" 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 rax, [rbp+var_78] mov [rbp+string], rax mov rax, [rbp+var_88] mov dword ptr [rax], 0 jmp loc_1312 loc_1273: mov eax, [rbp+pmatch.rm_so] mov [rbp+var_6C], eax mov eax, [rbp+pmatch.rm_eo] mov [rbp+var_68], eax mov eax, [rbp+var_68] sub eax, [rbp+var_6C] mov [rbp+var_64], eax mov eax, [rbp+var_64] movsxd rcx, eax mov eax, [rbp+var_6C] movsxd rdx, eax mov rax, [rbp+string] lea rsi, [rdx+rax]; src mov rax, [rbp+var_88] mov eax, [rax] movsxd rdx, eax mov rax, rdx add rax, rax add rax, rdx add rax, rax mov rdx, rax mov rax, [rbp+var_80] add rax, rdx mov rdx, rcx; n mov rdi, rax; dest call _strncpy mov rax, [rbp+var_88] mov eax, [rax] movsxd rdx, eax mov rax, rdx add rax, rax add rax, rdx add rax, rax mov rdx, rax mov rax, [rbp+var_80] add rdx, rax mov eax, [rbp+var_64] cdqe mov byte ptr [rdx+rax], 0 mov rax, [rbp+var_88] mov eax, [rax] lea edx, [rax+1] mov rax, [rbp+var_88] mov [rax], edx mov eax, [rbp+var_68] cdqe add [rbp+string], rax loc_1312: lea rdx, [rbp+pmatch] mov rsi, [rbp+string]; string lea rax, [rbp+preg] mov r8d, 0; eflags mov rcx, rdx; pmatch mov edx, 1; nmatch mov rdi, rax; preg call _regexec test eax, eax jz loc_1273 lea rax, [rbp+preg] mov rdi, rax; preg call _regfree nop mov rax, [rbp+var_8] sub rax, fs:28h jz short locret_135D call ___stack_chk_fail locret_135D: leave retn
unsigned long long func0(const char *a1, long long a2, int *a3) { int i; // eax regoff_t rm_eo; // [rsp+28h] [rbp-68h] int v7; // [rsp+2Ch] [rbp-64h] char *string; // [rsp+30h] [rbp-60h] regex_t preg; // [rsp+40h] [rbp-50h] BYREF regmatch_t pmatch; // [rsp+80h] [rbp-10h] BYREF unsigned long long v11; // [rsp+88h] [rbp-8h] v11 = __readfsqword(0x28u); regcomp(&preg, "\\b\\w{3,5}\\b", 1); string = (char *)a1; *a3 = 0; for ( i = regexec(&preg, a1, 1uLL, &pmatch, 0); !i; i = regexec(&preg, string, 1uLL, &pmatch, 0) ) { rm_eo = pmatch.rm_eo; v7 = pmatch.rm_eo - pmatch.rm_so; strncpy((char *)(6LL * *a3 + a2), &string[pmatch.rm_so], pmatch.rm_eo - pmatch.rm_so); *(_BYTE *)(a2 + 6LL * (*a3)++ + v7) = 0; string += rm_eo; } regfree(&preg); return v11 - __readfsqword(0x28u); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x90 MOV qword ptr [RBP + -0x78],RDI MOV qword ptr [RBP + -0x80],RSI MOV qword ptr [RBP + -0x88],RDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX LEA RAX,[0x102008] MOV qword ptr [RBP + -0x58],RAX MOV RCX,qword ptr [RBP + -0x58] LEA RAX,[RBP + -0x50] MOV EDX,0x1 MOV RSI,RCX MOV RDI,RAX CALL 0x001010f0 MOV RAX,qword ptr [RBP + -0x78] MOV qword ptr [RBP + -0x60],RAX MOV RAX,qword ptr [RBP + -0x88] MOV dword ptr [RAX],0x0 JMP 0x00101312 LAB_00101273: MOV EAX,dword ptr [RBP + -0x10] MOV dword ptr [RBP + -0x6c],EAX MOV EAX,dword ptr [RBP + -0xc] MOV dword ptr [RBP + -0x68],EAX MOV EAX,dword ptr [RBP + -0x68] SUB EAX,dword ptr [RBP + -0x6c] MOV dword ptr [RBP + -0x64],EAX MOV EAX,dword ptr [RBP + -0x64] MOVSXD RCX,EAX MOV EAX,dword ptr [RBP + -0x6c] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x60] LEA RSI,[RDX + RAX*0x1] MOV RAX,qword ptr [RBP + -0x88] MOV EAX,dword ptr [RAX] MOVSXD RDX,EAX MOV RAX,RDX ADD RAX,RAX ADD RAX,RDX ADD RAX,RAX MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x80] ADD RAX,RDX MOV RDX,RCX MOV RDI,RAX CALL 0x001010b0 MOV RAX,qword ptr [RBP + -0x88] MOV EAX,dword ptr [RAX] MOVSXD RDX,EAX MOV RAX,RDX ADD RAX,RAX ADD RAX,RDX ADD RAX,RAX MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x80] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x64] CDQE MOV byte ptr [RDX + RAX*0x1],0x0 MOV RAX,qword ptr [RBP + -0x88] MOV EAX,dword ptr [RAX] LEA EDX,[RAX + 0x1] MOV RAX,qword ptr [RBP + -0x88] MOV dword ptr [RAX],EDX MOV EAX,dword ptr [RBP + -0x68] CDQE ADD qword ptr [RBP + -0x60],RAX LAB_00101312: LEA RDX,[RBP + -0x10] MOV RSI,qword ptr [RBP + -0x60] LEA RAX,[RBP + -0x50] MOV R8D,0x0 MOV RCX,RDX MOV EDX,0x1 MOV RDI,RAX CALL 0x00101110 TEST EAX,EAX JZ 0x00101273 LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001010c0 NOP MOV RAX,qword ptr [RBP + -0x8] SUB RAX,qword ptr FS:[0x28] JZ 0x0010135d CALL 0x001010d0 LAB_0010135d: LEAVE RET
void func0(char *param_1,long param_2,int *param_3) { regoff_t rVar1; int iVar2; long in_FS_OFFSET; char *local_68; regex_t local_58; regmatch_t local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); regcomp(&local_58,"\\b\\w{3,5}\\b",1); *param_3 = 0; local_68 = param_1; while( true ) { iVar2 = regexec(&local_58,local_68,1,&local_18,0); rVar1 = local_18.rm_eo; if (iVar2 != 0) break; iVar2 = local_18.rm_eo - local_18.rm_so; strncpy((char *)(param_2 + (long)*param_3 * 6),local_68 + local_18.rm_so,(long)iVar2); *(int *)((long)*param_3 * 6 + param_2 + (long)iVar2) = 0; *param_3 = *param_3 + 1; local_68 = local_68 + rVar1; } regfree(&local_58); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return; }
5,213
func0
#include <stdio.h> #include <string.h> #include <regex.h> #include <assert.h>
void func0(const char* text, char output[][6], int* count) { regex_t regex; regmatch_t pmatch[1]; const char* pattern = "\\b\\w{3,5}\\b"; regcomp(&regex, pattern, REG_EXTENDED); const char* current = text; *count = 0; while (regexec(&regex, current, 1, pmatch, 0) == 0) { int start = pmatch[0].rm_so; int end = pmatch[0].rm_eo; int length = end - start; strncpy(output[*count], current + start, length); output[*count][length] = '\0'; (*count)++; current += end; } regfree(&regex); }
int main() { char words1[5][6]; int count1 = 0; func0("For the four consumer complaints contact manager AKR reddy", words1, &count1); assert(count1 == 5 && strcmp(words1[0], "For") == 0 && strcmp(words1[1], "the") == 0 && strcmp(words1[2], "four") == 0 && strcmp(words1[3], "AKR") == 0 && strcmp(words1[4], "reddy") == 0); char words2[2][6]; int count2 = 0; func0("Certain service are subject to change MSR", words2, &count2); assert(count2 == 2 && strcmp(words2[0], "are") == 0 && strcmp(words2[1], "MSR") == 0); char words3[3][6]; int count3 = 0; func0("Third party legal desclaimers", words3, &count3); assert(count3 == 3 && strcmp(words3[0], "Third") == 0 && strcmp(words3[1], "party") == 0 && strcmp(words3[2], "legal") == 0); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x58,%rsp mov %rdi,%r13 mov %rsi,%r14 mov %rdx,%r12 mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov %rsp,%rdi mov $0x1,%edx lea 0xde1(%rip),%rsi callq 10e0 <regcomp@plt> movl $0x0,(%r12) lea 0x40(%rsp),%r15 mov %rsp,%rdi mov $0x0,%r8d mov %r15,%rcx mov $0x1,%edx mov %r13,%rsi callq 10f0 <regexec@plt> test %eax,%eax jne 1298 <func0+0xaf> mov 0x40(%rsp),%esi mov 0x44(%rsp),%ebx mov %ebx,%ebp sub %esi,%ebp movslq %ebp,%rbp movslq %esi,%rsi add %r13,%rsi movslq (%r12),%rax lea (%rax,%rax,2),%rax lea (%r14,%rax,2),%rdi mov %rbp,%rdx callq 10a0 <strncpy@plt> movslq (%r12),%rax lea (%rax,%rax,2),%rax lea (%r14,%rax,2),%rax movb $0x0,(%rax,%rbp,1) addl $0x1,(%r12) movslq %ebx,%rbx add %rbx,%r13 jmp 1235 <func0+0x4c> mov %rsp,%rdi callq 10b0 <regfree@plt> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 12bf <func0+0xd6> add $0x58,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 10c0 <__stack_chk_fail@plt>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 58h mov r13, rdi mov r14, rsi mov r12, rdx mov rax, fs:28h mov [rsp+88h+var_40], rax xor eax, eax mov rdi, rsp mov edx, 1 lea rsi, aBW35B; "\\b\\w{3,5}\\b" call _regcomp mov eax, 0 lea r15, [rsp+88h+var_48] jmp short loc_129A loc_1254: mov esi, [rsp+88h+var_48] mov ebx, [rsp+88h+var_44] mov ebp, ebx sub ebp, esi movsxd rbp, ebp movsxd rsi, esi add rsi, r13 movsxd rax, dword ptr [r12] lea rax, [rax+rax*2] lea rdi, [r14+rax*2] mov rdx, rbp call _strncpy movsxd rax, dword ptr [r12] lea rax, [rax+rax*2] lea rax, [r14+rax*2] mov byte ptr [rax+rbp], 0 mov eax, [r12] add eax, 1 movsxd rbx, ebx add r13, rbx loc_129A: mov [r12], eax mov rdi, rsp mov r8d, 0 mov rcx, r15 mov edx, 1 mov rsi, r13 call _regexec test eax, eax jz short loc_1254 mov rdi, rsp call _regfree mov rax, [rsp+88h+var_40] sub rax, fs:28h jnz short loc_12E2 add rsp, 58h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_12E2: call ___stack_chk_fail
unsigned long long func0(long long a1, long long a2, int *a3) { int v5; // eax int v6; // ebx long long v7; // rbp _BYTE v9[64]; // [rsp+0h] [rbp-88h] BYREF int v10; // [rsp+40h] [rbp-48h] BYREF int v11; // [rsp+44h] [rbp-44h] unsigned long long v12; // [rsp+48h] [rbp-40h] v12 = __readfsqword(0x28u); regcomp(v9, "\\b\\w{3,5}\\b", 1LL); v5 = 0; while ( 1 ) { *a3 = v5; if ( (unsigned int)regexec(v9, a1, 1LL, &v10, 0LL) ) break; v6 = v11; v7 = v11 - v10; strncpy(a2 + 6LL * *a3, a1 + v10, v7); *(_BYTE *)(a2 + 6LL * *a3 + v7) = 0; v5 = *a3 + 1; a1 += v6; } regfree(v9); return v12 - __readfsqword(0x28u); }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x58 MOV R13,RDI MOV R14,RSI MOV R12,RDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV RDI,RSP MOV EDX,0x1 LEA RSI,[0x102004] CALL 0x001010f0 MOV EAX,0x0 LEA R15,[RSP + 0x40] JMP 0x0010129a LAB_00101254: MOV ESI,dword ptr [RSP + 0x40] MOV EBX,dword ptr [RSP + 0x44] MOV EBP,EBX SUB EBP,ESI MOVSXD RBP,EBP MOVSXD RSI,ESI ADD RSI,R13 MOVSXD RAX,dword ptr [R12] LEA RAX,[RAX + RAX*0x2] LEA RDI,[R14 + RAX*0x2] MOV RDX,RBP CALL 0x001010b0 MOVSXD RAX,dword ptr [R12] LEA RAX,[RAX + RAX*0x2] LEA RAX,[R14 + RAX*0x2] MOV byte ptr [RAX + RBP*0x1],0x0 MOV EAX,dword ptr [R12] ADD EAX,0x1 MOVSXD RBX,EBX ADD R13,RBX LAB_0010129a: MOV dword ptr [R12],EAX MOV RDI,RSP MOV R8D,0x0 MOV RCX,R15 MOV EDX,0x1 MOV RSI,R13 CALL 0x00101110 TEST EAX,EAX JZ 0x00101254 MOV RDI,RSP CALL 0x001010c0 MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x001012e2 ADD RSP,0x58 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001012e2: CALL 0x001010d0
void func0(char *param_1,long param_2,int *param_3) { regoff_t rVar1; int iVar2; long in_FS_OFFSET; regex_t rStack_88; regmatch_t local_48; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); regcomp(&rStack_88,"\\b\\w{3,5}\\b",1); iVar2 = 0; while( true ) { *param_3 = iVar2; iVar2 = regexec(&rStack_88,param_1,1,&local_48,0); rVar1 = local_48.rm_eo; if (iVar2 != 0) break; iVar2 = local_48.rm_eo - local_48.rm_so; strncpy((char *)(param_2 + (long)*param_3 * 6),param_1 + local_48.rm_so,(long)iVar2); *(int1 *)(param_2 + (long)*param_3 * 6 + (long)iVar2) = 0; iVar2 = *param_3 + 1; param_1 = param_1 + rVar1; } regfree(&rStack_88); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,214
func0
#include <stdio.h> #include <string.h> #include <regex.h> #include <assert.h>
void func0(const char* text, char output[][6], int* count) { regex_t regex; regmatch_t pmatch[1]; const char* pattern = "\\b\\w{3,5}\\b"; regcomp(&regex, pattern, REG_EXTENDED); const char* current = text; *count = 0; while (regexec(&regex, current, 1, pmatch, 0) == 0) { int start = pmatch[0].rm_so; int end = pmatch[0].rm_eo; int length = end - start; strncpy(output[*count], current + start, length); output[*count][length] = '\0'; (*count)++; current += end; } regfree(&regex); }
int main() { char words1[5][6]; int count1 = 0; func0("For the four consumer complaints contact manager AKR reddy", words1, &count1); assert(count1 == 5 && strcmp(words1[0], "For") == 0 && strcmp(words1[1], "the") == 0 && strcmp(words1[2], "four") == 0 && strcmp(words1[3], "AKR") == 0 && strcmp(words1[4], "reddy") == 0); char words2[2][6]; int count2 = 0; func0("Certain service are subject to change MSR", words2, &count2); assert(count2 == 2 && strcmp(words2[0], "are") == 0 && strcmp(words2[1], "MSR") == 0); char words3[3][6]; int count3 = 0; func0("Third party legal desclaimers", words3, &count3); assert(count3 == 3 && strcmp(words3[0], "Third") == 0 && strcmp(words3[1], "party") == 0 && strcmp(words3[2], "legal") == 0); return 0; }
O2
c
func0: endbr64 push %r15 mov %rdi,%r15 push %r14 push %r13 push %r12 push %rbp mov %rsi,%rbp lea 0xc4a(%rip),%rsi push %rbx mov %rdx,%rbx mov $0x1,%edx sub $0x68,%rsp mov %fs:0x28,%rax mov %rax,0x58(%rsp) xor %eax,%eax lea 0x10(%rsp),%r12 lea 0x50(%rsp),%r13 mov %r12,%rdi callq 10e0 <regcomp@plt> movl $0x0,(%rbx) jmp 143e <func0+0x9e> nopl 0x0(%rax) movslq 0x54(%rsp),%r14 movslq 0x50(%rsp),%rsi movslq (%rbx),%rax mov %r14d,%edx sub %esi,%edx lea (%rax,%rax,2),%rax add %r15,%rsi add %r14,%r15 movslq %edx,%rdx lea 0x0(%rbp,%rax,2),%rdi mov %rdx,0x8(%rsp) callq 10a0 <strncpy@plt> movslq (%rbx),%rax mov 0x8(%rsp),%rdx lea (%rax,%rax,2),%rax lea 0x0(%rbp,%rax,2),%rax movb $0x0,(%rax,%rdx,1) addl $0x1,(%rbx) xor %r8d,%r8d mov %r13,%rcx mov $0x1,%edx mov %r15,%rsi mov %r12,%rdi callq 10f0 <regexec@plt> test %eax,%eax je 13f8 <func0+0x58> mov %r12,%rdi callq 10b0 <regfree@plt> mov 0x58(%rsp),%rax xor %fs:0x28,%rax jne 147f <func0+0xdf> add $0x68,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 10c0 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 push r15 mov r15, rdi push r14 mov r14, rdx mov edx, 1 push r13 push r12 push rbp push rbx mov rbx, rsi lea rsi, aBW35B; "\\b\\w{3,5}\\b" sub rsp, 68h mov rax, fs:28h mov [rsp+98h+var_40], rax xor eax, eax lea rbp, [rsp+98h+var_88] lea r12, [rsp+98h+var_48] mov rdi, rbp call _regcomp xor eax, eax jmp short loc_1447 loc_1400: movsxd r13, [rsp+98h+var_44] movsxd rsi, [rsp+98h+var_48] movsxd rax, dword ptr [r14] mov edx, r13d sub edx, esi lea rax, [rax+rax*2] add rsi, r15 add r15, r13 movsxd rdx, edx lea rdi, [rbx+rax*2] mov [rsp+98h+var_90], rdx call _strncpy movsxd rax, dword ptr [r14] mov rdx, [rsp+98h+var_90] lea rax, [rax+rax*2] lea rax, [rbx+rax*2] mov byte ptr [rax+rdx], 0 mov eax, [r14] add eax, 1 loc_1447: mov [r14], eax xor r8d, r8d mov rcx, r12 mov edx, 1 mov rsi, r15 mov rdi, rbp call _regexec test eax, eax jz short loc_1400 mov rdi, rbp call _regfree mov rax, [rsp+98h+var_40] sub rax, fs:28h jnz short loc_148B add rsp, 68h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_148B: call ___stack_chk_fail
unsigned long long func0(long long a1, long long a2, int *a3) { int i; // eax long long v7; // rsi long long v9; // [rsp+8h] [rbp-90h] _BYTE v10[64]; // [rsp+10h] [rbp-88h] BYREF int v11; // [rsp+50h] [rbp-48h] BYREF int v12; // [rsp+54h] [rbp-44h] unsigned long long v13; // [rsp+58h] [rbp-40h] v13 = __readfsqword(0x28u); regcomp(v10, "\\b\\w{3,5}\\b", 1LL); for ( i = 0; ; i = *a3 + 1 ) { *a3 = i; if ( (unsigned int)regexec(v10, a1, 1LL, &v11, 0LL) ) break; v7 = a1 + v11; a1 += v12; v9 = v12 - v11; strncpy(a2 + 6LL * *a3, v7); *(_BYTE *)(a2 + 6LL * *a3 + v9) = 0; } regfree(v10); return v13 - __readfsqword(0x28u); }
func0: ENDBR64 PUSH R15 MOV R15,RDI PUSH R14 MOV R14,RDX MOV EDX,0x1 PUSH R13 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RSI LEA RSI,[0x102004] SUB RSP,0x68 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x58],RAX XOR EAX,EAX LEA RBP,[RSP + 0x10] LEA R12,[RSP + 0x50] MOV RDI,RBP CALL 0x001010f0 XOR EAX,EAX JMP 0x00101447 LAB_00101400: MOVSXD R13,dword ptr [RSP + 0x54] MOVSXD RSI,dword ptr [RSP + 0x50] MOVSXD RAX,dword ptr [R14] MOV EDX,R13D SUB EDX,ESI LEA RAX,[RAX + RAX*0x2] ADD RSI,R15 ADD R15,R13 MOVSXD RDX,EDX LEA RDI,[RBX + RAX*0x2] MOV qword ptr [RSP + 0x8],RDX CALL 0x001010b0 MOVSXD RAX,dword ptr [R14] MOV RDX,qword ptr [RSP + 0x8] LEA RAX,[RAX + RAX*0x2] LEA RAX,[RBX + RAX*0x2] MOV byte ptr [RAX + RDX*0x1],0x0 MOV EAX,dword ptr [R14] ADD EAX,0x1 LAB_00101447: MOV dword ptr [R14],EAX XOR R8D,R8D MOV RCX,R12 MOV EDX,0x1 MOV RSI,R15 MOV RDI,RBP CALL 0x00101110 TEST EAX,EAX JZ 0x00101400 MOV RDI,RBP CALL 0x001010c0 MOV RAX,qword ptr [RSP + 0x58] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010148b ADD RSP,0x68 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010148b: CALL 0x001010d0
void func0(char *param_1,long param_2,int *param_3) { int iVar1; char *__src; long in_FS_OFFSET; regex_t local_88; regmatch_t local_48; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); regcomp(&local_88,"\\b\\w{3,5}\\b",1); iVar1 = 0; while( true ) { *param_3 = iVar1; iVar1 = regexec(&local_88,param_1,1,&local_48,0); if (iVar1 != 0) break; iVar1 = local_48.rm_eo - local_48.rm_so; __src = param_1 + local_48.rm_so; param_1 = param_1 + local_48.rm_eo; strncpy((char *)(param_2 + (long)*param_3 * 6),__src,(long)iVar1); *(int1 *)(param_2 + (long)*param_3 * 6 + (long)iVar1) = 0; iVar1 = *param_3 + 1; } regfree(&local_88); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,215
func0
#include <stdio.h> #include <string.h> #include <regex.h> #include <assert.h>
void func0(const char* text, char output[][6], int* count) { regex_t regex; regmatch_t pmatch[1]; const char* pattern = "\\b\\w{3,5}\\b"; regcomp(&regex, pattern, REG_EXTENDED); const char* current = text; *count = 0; while (regexec(&regex, current, 1, pmatch, 0) == 0) { int start = pmatch[0].rm_so; int end = pmatch[0].rm_eo; int length = end - start; strncpy(output[*count], current + start, length); output[*count][length] = '\0'; (*count)++; current += end; } regfree(&regex); }
int main() { char words1[5][6]; int count1 = 0; func0("For the four consumer complaints contact manager AKR reddy", words1, &count1); assert(count1 == 5 && strcmp(words1[0], "For") == 0 && strcmp(words1[1], "the") == 0 && strcmp(words1[2], "four") == 0 && strcmp(words1[3], "AKR") == 0 && strcmp(words1[4], "reddy") == 0); char words2[2][6]; int count2 = 0; func0("Certain service are subject to change MSR", words2, &count2); assert(count2 == 2 && strcmp(words2[0], "are") == 0 && strcmp(words2[1], "MSR") == 0); char words3[3][6]; int count3 = 0; func0("Third party legal desclaimers", words3, &count3); assert(count3 == 3 && strcmp(words3[0], "Third") == 0 && strcmp(words3[1], "party") == 0 && strcmp(words3[2], "legal") == 0); return 0; }
O3
c
func0: endbr64 push %r15 mov %rdi,%r15 push %r14 push %r13 push %r12 push %rbp mov %rsi,%rbp lea 0xc4a(%rip),%rsi push %rbx mov %rdx,%rbx mov $0x1,%edx sub $0x68,%rsp mov %fs:0x28,%rax mov %rax,0x58(%rsp) xor %eax,%eax lea 0x10(%rsp),%r12 lea 0x50(%rsp),%r13 mov %r12,%rdi callq 10e0 <regcomp@plt> movl $0x0,(%rbx) jmp 143e <func0+0x9e> nopl 0x0(%rax) movslq 0x54(%rsp),%r14 movslq 0x50(%rsp),%rsi movslq (%rbx),%rax mov %r14d,%edx sub %esi,%edx lea (%rax,%rax,2),%rax add %r15,%rsi add %r14,%r15 movslq %edx,%rdx lea 0x0(%rbp,%rax,2),%rdi mov %rdx,0x8(%rsp) callq 10a0 <strncpy@plt> movslq (%rbx),%rax mov 0x8(%rsp),%rdx lea (%rax,%rax,2),%rax lea 0x0(%rbp,%rax,2),%rax movb $0x0,(%rax,%rdx,1) addl $0x1,(%rbx) xor %r8d,%r8d mov %r13,%rcx mov $0x1,%edx mov %r15,%rsi mov %r12,%rdi callq 10f0 <regexec@plt> test %eax,%eax je 13f8 <func0+0x58> mov %r12,%rdi callq 10b0 <regfree@plt> mov 0x58(%rsp),%rax xor %fs:0x28,%rax jne 147f <func0+0xdf> add $0x68,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 10c0 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 push r15 mov r15, rdx mov edx, 1; cflags push r14 push r13 push r12 push rbp mov rbp, rsi lea rsi, pattern; "\\b\\w{3,5}\\b" push rbx mov rbx, rdi sub rsp, 68h mov rax, fs:28h mov [rsp+98h+var_40], rax xor eax, eax lea r12, [rsp+98h+preg] mov rdi, r12; preg call _regcomp lea rcx, [rsp+98h+var_48] xor eax, eax mov [rsp+98h+pmatch], rcx jmp short loc_144B loc_1408: movsxd r14, [rsp+98h+var_44] movsxd rsi, [rsp+98h+var_48] movsxd rax, dword ptr [r15] mov edx, r14d sub edx, esi lea rax, [rax+rax*2] add rsi, rbx; src add rbx, r14 movsxd r13, edx lea rdi, [rbp+rax*2+0]; dest mov rdx, r13; n call _strncpy movsxd rax, dword ptr [r15] lea rax, [rax+rax*2] lea rax, [rbp+rax*2+0] mov byte ptr [rax+r13], 0 mov eax, [r15] add eax, 1 loc_144B: mov [r15], eax mov rcx, [rsp+98h+pmatch]; pmatch xor r8d, r8d; eflags mov edx, 1; nmatch mov rsi, rbx; string mov rdi, r12; preg call _regexec test eax, eax jz short loc_1408 mov rdi, r12; preg call _regfree mov rax, [rsp+98h+var_40] sub rax, fs:28h jnz short loc_1491 add rsp, 68h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1491: call ___stack_chk_fail
unsigned long long func0(char *string, long long a2, int *a3) { int i; // eax const char *v7; // rsi size_t v8; // r13 regex_t preg; // [rsp+10h] [rbp-88h] BYREF regmatch_t v11; // [rsp+50h] [rbp-48h] BYREF unsigned long long v12; // [rsp+58h] [rbp-40h] v12 = __readfsqword(0x28u); regcomp(&preg, "\\b\\w{3,5}\\b", 1); for ( i = 0; ; i = *a3 + 1 ) { *a3 = i; if ( regexec(&preg, string, 1uLL, &v11, 0) ) break; v7 = &string[v11.rm_so]; string += v11.rm_eo; v8 = v11.rm_eo - v11.rm_so; strncpy((char *)(a2 + 6LL * *a3), v7, v8); *(_BYTE *)(a2 + 6LL * *a3 + v8) = 0; } regfree(&preg); return v12 - __readfsqword(0x28u); }
func0: ENDBR64 PUSH R15 MOV R15,RDX MOV EDX,0x1 PUSH R14 PUSH R13 PUSH R12 PUSH RBP MOV RBP,RSI LEA RSI,[0x102004] PUSH RBX MOV RBX,RDI SUB RSP,0x68 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x58],RAX XOR EAX,EAX LEA R12,[RSP + 0x10] MOV RDI,R12 CALL 0x001010f0 LEA RCX,[RSP + 0x50] XOR EAX,EAX MOV qword ptr [RSP + 0x8],RCX JMP 0x0010144b LAB_00101408: MOVSXD R14,dword ptr [RSP + 0x54] MOVSXD RSI,dword ptr [RSP + 0x50] MOVSXD RAX,dword ptr [R15] MOV EDX,R14D SUB EDX,ESI LEA RAX,[RAX + RAX*0x2] ADD RSI,RBX ADD RBX,R14 MOVSXD R13,EDX LEA RDI,[RBP + RAX*0x2] MOV RDX,R13 CALL 0x001010b0 MOVSXD RAX,dword ptr [R15] LEA RAX,[RAX + RAX*0x2] LEA RAX,[RBP + RAX*0x2] MOV byte ptr [RAX + R13*0x1],0x0 MOV EAX,dword ptr [R15] ADD EAX,0x1 LAB_0010144b: MOV dword ptr [R15],EAX MOV RCX,qword ptr [RSP + 0x8] XOR R8D,R8D MOV EDX,0x1 MOV RSI,RBX MOV RDI,R12 CALL 0x00101110 TEST EAX,EAX JZ 0x00101408 MOV RDI,R12 CALL 0x001010c0 MOV RAX,qword ptr [RSP + 0x58] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101491 ADD RSP,0x68 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101491: CALL 0x001010d0
void func0(char *param_1,long param_2,int *param_3) { int iVar1; char *__src; long in_FS_OFFSET; regex_t local_88; regmatch_t local_48; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); regcomp(&local_88,"\\b\\w{3,5}\\b",1); iVar1 = 0; while( true ) { *param_3 = iVar1; iVar1 = regexec(&local_88,param_1,1,&local_48,0); if (iVar1 != 0) break; iVar1 = local_48.rm_eo - local_48.rm_so; __src = param_1 + local_48.rm_so; param_1 = param_1 + local_48.rm_eo; strncpy((char *)(param_2 + (long)*param_3 * 6),__src,(long)iVar1); *(int *)(param_2 + (long)*param_3 * 6 + (long)iVar1) = 0; iVar1 = *param_3 + 1; } regfree(&local_88); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,216
func0
#include <assert.h>
int func0(int n) { int count = 0; int x = 1; while (x < n + 1) { if ((x & n) == 0) { count += 1; } x = x << 1; } return count; }
int main() { assert(func0(2) == 1); assert(func0(4) == 2); assert(func0(6) == 1); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) movl $0x0,-0x8(%rbp) movl $0x1,-0x4(%rbp) jmp 1175 <func0+0x2c> mov -0x4(%rbp),%eax and -0x14(%rbp),%eax test %eax,%eax jne 1172 <func0+0x29> addl $0x1,-0x8(%rbp) shll -0x4(%rbp) mov -0x14(%rbp),%eax cmp -0x4(%rbp),%eax jge 1164 <func0+0x1b> mov -0x8(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_8], 0 mov [rbp+var_4], 1 jmp short loc_1175 loc_1164: mov eax, [rbp+var_4] and eax, [rbp+var_14] test eax, eax jnz short loc_1172 add [rbp+var_8], 1 loc_1172: shl [rbp+var_4], 1 loc_1175: mov eax, [rbp+var_14] cmp eax, [rbp+var_4] jge short loc_1164 mov eax, [rbp+var_8] pop rbp retn
long long func0(int a1) { unsigned int v2; // [rsp+Ch] [rbp-8h] int i; // [rsp+10h] [rbp-4h] v2 = 0; for ( i = 1; a1 >= i; i *= 2 ) { if ( (a1 & i) == 0 ) ++v2; } return v2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x1 JMP 0x00101175 LAB_00101164: MOV EAX,dword ptr [RBP + -0x4] AND EAX,dword ptr [RBP + -0x14] TEST EAX,EAX JNZ 0x00101172 ADD dword ptr [RBP + -0x8],0x1 LAB_00101172: SHL dword ptr [RBP + -0x4],0x1 LAB_00101175: MOV EAX,dword ptr [RBP + -0x14] CMP EAX,dword ptr [RBP + -0x4] JGE 0x00101164 MOV EAX,dword ptr [RBP + -0x8] POP RBP RET
int func0(uint param_1) { int4 local_10; int4 local_c; local_10 = 0; for (local_c = 1; (int)local_c <= (int)param_1; local_c = local_c << 1) { if ((local_c & param_1) == 0) { local_10 = local_10 + 1; } } return local_10; }
5,217
func0
#include <assert.h>
int func0(int n) { int count = 0; int x = 1; while (x < n + 1) { if ((x & n) == 0) { count += 1; } x = x << 1; } return count; }
int main() { assert(func0(2) == 1); assert(func0(4) == 2); assert(func0(6) == 1); return 0; }
O1
c
func0: endbr64 test %edi,%edi jle 116e <func0+0x25> mov $0x1,%eax mov $0x0,%edx mov %edi,%ecx and %eax,%ecx cmp $0x1,%ecx adc $0x0,%edx add %eax,%eax cmp %eax,%edi jge 115b <func0+0x12> mov %edx,%eax retq mov $0x0,%edx jmp 116b <func0+0x22>
func0: endbr64 test edi, edi jle short loc_116E mov eax, 1 mov edx, 0 loc_115B: mov ecx, edi and ecx, eax cmp ecx, 1 adc edx, 0 add eax, eax cmp edi, eax jge short loc_115B loc_116B: mov eax, edx retn loc_116E: mov edx, 0 jmp short loc_116B
long long func0(int a1) { int v1; // eax unsigned int v2; // edx if ( a1 <= 0 ) { return 0; } else { v1 = 1; v2 = 0; do { v2 += (v1 & a1) == 0; v1 *= 2; } while ( a1 >= v1 ); } return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x0010116e MOV EAX,0x1 MOV EDX,0x0 LAB_0010115b: MOV ECX,EDI AND ECX,EAX CMP ECX,0x1 ADC EDX,0x0 ADD EAX,EAX CMP EDI,EAX JGE 0x0010115b LAB_0010116b: MOV EAX,EDX RET LAB_0010116e: MOV EDX,0x0 JMP 0x0010116b
int func0(uint param_1) { uint uVar1; int iVar2; if ((int)param_1 < 1) { iVar2 = 0; } else { uVar1 = 1; iVar2 = 0; do { iVar2 = iVar2 + (uint)((param_1 & uVar1) == 0); uVar1 = uVar1 * 2; } while ((int)uVar1 <= (int)param_1); } return iVar2; }
5,218
func0
#include <assert.h>
int func0(int n) { int count = 0; int x = 1; while (x < n + 1) { if ((x & n) == 0) { count += 1; } x = x << 1; } return count; }
int main() { assert(func0(2) == 1); assert(func0(4) == 2); assert(func0(6) == 1); return 0; }
O2
c
func0: endbr64 test %edi,%edi jle 1218 <func0+0x28> mov $0x1,%eax xor %r8d,%r8d mov %edi,%edx and %eax,%edx cmp $0x1,%edx adc $0x0,%r8d add %eax,%eax cmp %eax,%edi jge 1200 <func0+0x10> mov %r8d,%eax retq nopl (%rax) xor %r8d,%r8d mov %r8d,%eax retq
func0: endbr64 test edi, edi jle short loc_1218 mov eax, 1 xor r8d, r8d loc_1200: mov edx, edi and edx, eax cmp edx, 1 adc r8d, 0 add eax, eax cmp edi, eax jge short loc_1200 mov eax, r8d retn loc_1218: xor r8d, r8d mov eax, r8d retn
long long func0(int a1) { int v1; // eax unsigned int v2; // r8d if ( a1 <= 0 ) return 0LL; v1 = 1; v2 = 0; do { v2 += (v1 & a1) == 0; v1 *= 2; } while ( a1 >= v1 ); return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101218 MOV EAX,0x1 XOR R8D,R8D LAB_00101200: MOV EDX,EDI AND EDX,EAX CMP EDX,0x1 ADC R8D,0x0 ADD EAX,EAX CMP EDI,EAX JGE 0x00101200 MOV EAX,R8D RET LAB_00101218: XOR R8D,R8D MOV EAX,R8D RET
int func0(uint param_1) { uint uVar1; int iVar2; if (0 < (int)param_1) { uVar1 = 1; iVar2 = 0; do { iVar2 = iVar2 + (uint)((param_1 & uVar1) == 0); uVar1 = uVar1 * 2; } while ((int)uVar1 <= (int)param_1); return iVar2; } return 0; }
5,219
func0
#include <assert.h>
int func0(int n) { int count = 0; int x = 1; while (x < n + 1) { if ((x & n) == 0) { count += 1; } x = x << 1; } return count; }
int main() { assert(func0(2) == 1); assert(func0(4) == 2); assert(func0(6) == 1); return 0; }
O3
c
func0: endbr64 test %edi,%edi jle 1168 <func0+0x28> mov $0x1,%eax xor %r8d,%r8d mov %edi,%edx and %eax,%edx cmp $0x1,%edx adc $0x0,%r8d add %eax,%eax cmp %eax,%edi jge 1150 <func0+0x10> mov %r8d,%eax retq nopl (%rax) xor %r8d,%r8d mov %r8d,%eax retq
func0: endbr64 test edi, edi jle short loc_1168 mov eax, 1 xor edx, edx nop loc_1150: mov ecx, edi and ecx, eax cmp ecx, 1 adc edx, 0 add eax, eax cmp edi, eax jge short loc_1150 mov eax, edx retn loc_1168: xor edx, edx mov eax, edx retn
long long func0(int a1) { int v1; // eax unsigned int v2; // edx if ( a1 <= 0 ) return 0LL; v1 = 1; v2 = 0; do { v2 += (v1 & a1) == 0; v1 *= 2; } while ( a1 >= v1 ); return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101168 MOV EAX,0x1 XOR EDX,EDX NOP LAB_00101150: MOV ECX,EDI AND ECX,EAX CMP ECX,0x1 ADC EDX,0x0 ADD EAX,EAX CMP EDI,EAX JGE 0x00101150 MOV EAX,EDX RET LAB_00101168: XOR EDX,EDX MOV EAX,EDX RET
int func0(uint param_1) { uint uVar1; int iVar2; if (0 < (int)param_1) { uVar1 = 1; iVar2 = 0; do { iVar2 = iVar2 + (uint)((param_1 & uVar1) == 0); uVar1 = uVar1 * 2; } while ((int)uVar1 <= (int)param_1); return iVar2; } return 0; }
5,220
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h> #define NUM_CHARS 256
int* func0(const char* str) { int* freq = calloc(NUM_CHARS, sizeof(int)); if (freq == NULL) { perror("Failed to allocate memory"); exit(EXIT_FAILURE); } for(int i = 0; str[i] != '\0'; i++) { unsigned char c = str[i]; freq[c]++; } return freq; }
int main() { // Test case 1: "python" int* freq1 = func0("python"); assert(freq1['p'] == 1); assert(freq1['y'] == 1); assert(freq1['t'] == 1); assert(freq1['h'] == 1); assert(freq1['o'] == 1); assert(freq1['n'] == 1); free(freq1); // Test case 2: "program" int* freq2 = func0("program"); assert(freq2['p'] == 1); assert(freq2['r'] == 2); assert(freq2['o'] == 1); assert(freq2['g'] == 1); assert(freq2['a'] == 1); assert(freq2['m'] == 1); free(freq2); // Test case 3: "language" int* freq3 = func0("language"); assert(freq3['l'] == 1); assert(freq3['a'] == 2); assert(freq3['n'] == 1); assert(freq3['g'] == 2); assert(freq3['u'] == 1); assert(freq3['e'] == 1); free(freq3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov $0x4,%esi mov $0x100,%edi callq 10b0 <calloc@plt> mov %rax,-0x8(%rbp) cmpq $0x0,-0x8(%rbp) jne 1209 <func0+0x40> lea 0xe0e(%rip),%rdi callq 10c0 <perror@plt> mov $0x1,%edi callq 10d0 <exit@plt> movl $0x0,-0xc(%rbp) jmp 1243 <func0+0x7a> mov -0xc(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax mov %al,-0xd(%rbp) movzbl -0xd(%rbp),%eax lea 0x0(,%rax,4),%rdx mov -0x8(%rbp),%rax add %rdx,%rax mov (%rax),%edx add $0x1,%edx mov %edx,(%rax) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax test %al,%al jne 1212 <func0+0x49> mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov esi, 4; size mov edi, 100h; nmemb call _calloc mov [rbp+var_8], rax cmp [rbp+var_8], 0 jnz short loc_120C lea rax, s; "Failed to allocate memory" mov rdi, rax; s call _perror mov edi, 1; status call _exit loc_120C: mov [rbp+var_C], 0 jmp short loc_1246 loc_1215: mov eax, [rbp+var_C] movsxd rdx, eax mov rax, [rbp+var_18] add rax, rdx movzx eax, byte ptr [rax] mov [rbp+var_D], al movzx eax, [rbp+var_D] lea rdx, ds:0[rax*4] mov rax, [rbp+var_8] add rax, rdx mov edx, [rax] add edx, 1 mov [rax], edx add [rbp+var_C], 1 loc_1246: mov eax, [rbp+var_C] movsxd rdx, eax mov rax, [rbp+var_18] add rax, rdx movzx eax, byte ptr [rax] test al, al jnz short loc_1215 mov rax, [rbp+var_8] leave retn
char * func0(long long a1) { char *v1; // rax int i; // [rsp+14h] [rbp-Ch] char *v4; // [rsp+18h] [rbp-8h] v4 = (char *)calloc(0x100uLL, 4uLL); if ( !v4 ) { perror("Failed to allocate memory"); exit(1); } for ( i = 0; *(_BYTE *)(i + a1); ++i ) { v1 = &v4[4 * *(unsigned __int8 *)(i + a1)]; ++*(_DWORD *)v1; } return v4; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV ESI,0x4 MOV EDI,0x100 CALL 0x001010b0 MOV qword ptr [RBP + -0x8],RAX CMP qword ptr [RBP + -0x8],0x0 JNZ 0x0010120c LEA RAX,[0x102004] MOV RDI,RAX CALL 0x001010c0 MOV EDI,0x1 CALL 0x001010d0 LAB_0010120c: MOV dword ptr [RBP + -0xc],0x0 JMP 0x00101246 LAB_00101215: MOV EAX,dword ptr [RBP + -0xc] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] MOV byte ptr [RBP + -0xd],AL MOVZX EAX,byte ptr [RBP + -0xd] LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RAX,RDX MOV EDX,dword ptr [RAX] ADD EDX,0x1 MOV dword ptr [RAX],EDX ADD dword ptr [RBP + -0xc],0x1 LAB_00101246: MOV EAX,dword ptr [RBP + -0xc] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] TEST AL,AL JNZ 0x00101215 MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1) { void *pvVar1; int *piVar2; int local_14; pvVar1 = calloc(0x100,4); if (pvVar1 == (void *)0x0) { perror("Failed to allocate memory"); /* WARNING: Subroutine does not return */ exit(1); } for (local_14 = 0; *(char *)(param_1 + local_14) != '\0'; local_14 = local_14 + 1) { piVar2 = (int *)((long)pvVar1 + (ulong)*(byte *)(param_1 + local_14) * 4); *piVar2 = *piVar2 + 1; } return pvVar1; }
5,221
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h> #define NUM_CHARS 256
int* func0(const char* str) { int* freq = calloc(NUM_CHARS, sizeof(int)); if (freq == NULL) { perror("Failed to allocate memory"); exit(EXIT_FAILURE); } for(int i = 0; str[i] != '\0'; i++) { unsigned char c = str[i]; freq[c]++; } return freq; }
int main() { // Test case 1: "python" int* freq1 = func0("python"); assert(freq1['p'] == 1); assert(freq1['y'] == 1); assert(freq1['t'] == 1); assert(freq1['h'] == 1); assert(freq1['o'] == 1); assert(freq1['n'] == 1); free(freq1); // Test case 2: "program" int* freq2 = func0("program"); assert(freq2['p'] == 1); assert(freq2['r'] == 2); assert(freq2['o'] == 1); assert(freq2['g'] == 1); assert(freq2['a'] == 1); assert(freq2['m'] == 1); free(freq2); // Test case 3: "language" int* freq3 = func0("language"); assert(freq3['l'] == 1); assert(freq3['a'] == 2); assert(freq3['n'] == 1); assert(freq3['g'] == 2); assert(freq3['u'] == 1); assert(freq3['e'] == 1); free(freq3); return 0; }
O1
c
func0: endbr64 push %rbx mov %rdi,%rbx mov $0x4,%esi mov $0x100,%edi callq 10b0 <calloc@plt> test %rax,%rax je 1205 <func0+0x3c> movzbl (%rbx),%edx lea 0x1(%rbx),%rdi test %dl,%dl je 1203 <func0+0x3a> movzbl %dl,%edx addl $0x1,(%rax,%rdx,4) add $0x1,%rdi movzbl -0x1(%rdi),%edx test %dl,%dl jne 11f0 <func0+0x27> pop %rbx retq lea 0xdf8(%rip),%rdi callq 10c0 <perror@plt> mov $0x1,%edi callq 10d0 <exit@plt>
func0: endbr64 push rbx mov rbx, rdi mov esi, 4 mov edi, 100h call _calloc test rax, rax jz short loc_1205 movzx edx, byte ptr [rbx] lea rdi, [rbx+1] test dl, dl jz short loc_1203 loc_11F0: movzx edx, dl add dword ptr [rax+rdx*4], 1 add rdi, 1 movzx edx, byte ptr [rdi-1] test dl, dl jnz short loc_11F0 loc_1203: pop rbx retn loc_1205: lea rdi, aFailedToAlloca; "Failed to allocate memory" call _perror mov edi, 1 call _exit
long long func0(unsigned __int8 *a1) { long long result; // rax unsigned __int8 v3; // dl _BYTE *i; // rdi result = calloc(256LL, 4LL); if ( !result ) { perror("Failed to allocate memory"); exit(1LL); } v3 = *a1; for ( i = a1 + 1; v3; v3 = *(i - 1) ) { ++*(_DWORD *)(result + 4LL * v3); ++i; } return result; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI MOV ESI,0x4 MOV EDI,0x100 CALL 0x001010b0 TEST RAX,RAX JZ 0x00101205 MOVZX EDX,byte ptr [RBX] LEA RDI,[RBX + 0x1] TEST DL,DL JZ 0x00101203 LAB_001011f0: MOVZX EDX,DL ADD dword ptr [RAX + RDX*0x4],0x1 ADD RDI,0x1 MOVZX EDX,byte ptr [RDI + -0x1] TEST DL,DL JNZ 0x001011f0 LAB_00101203: POP RBX RET LAB_00101205: LEA RDI,[0x102004] CALL 0x001010c0 MOV EDI,0x1 CALL 0x001010d0
void func0(byte *param_1) { int *piVar1; byte bVar2; byte *pbVar3; void *pvVar4; pvVar4 = calloc(0x100,4); if (pvVar4 == (void *)0x0) { perror("Failed to allocate memory"); /* WARNING: Subroutine does not return */ exit(1); } bVar2 = *param_1; pbVar3 = param_1 + 1; while (bVar2 != 0) { piVar1 = (int *)((long)pvVar4 + (ulong)bVar2 * 4); *piVar1 = *piVar1 + 1; bVar2 = *pbVar3; pbVar3 = pbVar3 + 1; } return; }
5,222
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h> #define NUM_CHARS 256
int* func0(const char* str) { int* freq = calloc(NUM_CHARS, sizeof(int)); if (freq == NULL) { perror("Failed to allocate memory"); exit(EXIT_FAILURE); } for(int i = 0; str[i] != '\0'; i++) { unsigned char c = str[i]; freq[c]++; } return freq; }
int main() { // Test case 1: "python" int* freq1 = func0("python"); assert(freq1['p'] == 1); assert(freq1['y'] == 1); assert(freq1['t'] == 1); assert(freq1['h'] == 1); assert(freq1['o'] == 1); assert(freq1['n'] == 1); free(freq1); // Test case 2: "program" int* freq2 = func0("program"); assert(freq2['p'] == 1); assert(freq2['r'] == 2); assert(freq2['o'] == 1); assert(freq2['g'] == 1); assert(freq2['a'] == 1); assert(freq2['m'] == 1); free(freq2); // Test case 3: "language" int* freq3 = func0("language"); assert(freq3['l'] == 1); assert(freq3['a'] == 2); assert(freq3['n'] == 1); assert(freq3['g'] == 2); assert(freq3['u'] == 1); assert(freq3['e'] == 1); free(freq3); return 0; }
O2
c
func0: endbr64 push %rbx mov $0x4,%esi mov %rdi,%rbx mov $0x100,%edi callq 10b0 <calloc@plt> test %rax,%rax je 1575 <func0+0x45> movzbl (%rbx),%edx lea 0x1(%rbx),%rdi test %dl,%dl je 1573 <func0+0x43> nopw 0x0(%rax,%rax,1) movzbl %dl,%edx add $0x1,%rdi addl $0x1,(%rax,%rdx,4) movzbl -0x1(%rdi),%edx test %dl,%dl jne 1560 <func0+0x30> pop %rbx retq lea 0xa88(%rip),%rdi callq 10c0 <perror@plt> mov $0x1,%edi callq 10d0 <exit@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push rbx mov esi, 4 mov rbx, rdi mov edi, 100h call _calloc test rax, rax jz short loc_1572 movzx edx, byte ptr [rbx] lea rdi, [rbx+1] test dl, dl jz short loc_1570 nop word ptr [rax+rax+00000000h] loc_1560: add rdi, 1 add dword ptr [rax+rdx*4], 1 movzx edx, byte ptr [rdi-1] test dl, dl jnz short loc_1560 loc_1570: pop rbx retn loc_1572: lea rdi, aFailedToAlloca; "Failed to allocate memory" call _perror mov edi, 1 call _exit
long long func0(unsigned __int8 *a1) { long long result; // rax long long v2; // rdx unsigned __int8 *i; // rdi result = calloc(256LL, 4LL); if ( !result ) { perror("Failed to allocate memory"); exit(1LL); } v2 = *a1; for ( i = a1 + 1; (_BYTE)v2; v2 = *(i - 1) ) { ++i; ++*(_DWORD *)(result + 4 * v2); } return result; }
func0: ENDBR64 PUSH RBX MOV ESI,0x4 MOV RBX,RDI MOV EDI,0x100 CALL 0x001010b0 TEST RAX,RAX JZ 0x00101572 MOVZX EDX,byte ptr [RBX] LEA RDI,[RBX + 0x1] TEST DL,DL JZ 0x00101570 NOP word ptr [RAX + RAX*0x1] LAB_00101560: ADD RDI,0x1 ADD dword ptr [RAX + RDX*0x4],0x1 MOVZX EDX,byte ptr [RDI + -0x1] TEST DL,DL JNZ 0x00101560 LAB_00101570: POP RBX RET LAB_00101572: LEA RDI,[0x102004] CALL 0x001010c0 MOV EDI,0x1 CALL 0x001010d0
void func0(byte *param_1) { int *piVar1; byte bVar2; byte *pbVar3; void *pvVar4; pvVar4 = calloc(0x100,4); if (pvVar4 != (void *)0x0) { bVar2 = *param_1; pbVar3 = param_1 + 1; while (bVar2 != 0) { piVar1 = (int *)((long)pvVar4 + (ulong)bVar2 * 4); *piVar1 = *piVar1 + 1; bVar2 = *pbVar3; pbVar3 = pbVar3 + 1; } return; } perror("Failed to allocate memory"); /* WARNING: Subroutine does not return */ exit(1); }
5,223
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h> #define NUM_CHARS 256
int* func0(const char* str) { int* freq = calloc(NUM_CHARS, sizeof(int)); if (freq == NULL) { perror("Failed to allocate memory"); exit(EXIT_FAILURE); } for(int i = 0; str[i] != '\0'; i++) { unsigned char c = str[i]; freq[c]++; } return freq; }
int main() { // Test case 1: "python" int* freq1 = func0("python"); assert(freq1['p'] == 1); assert(freq1['y'] == 1); assert(freq1['t'] == 1); assert(freq1['h'] == 1); assert(freq1['o'] == 1); assert(freq1['n'] == 1); free(freq1); // Test case 2: "program" int* freq2 = func0("program"); assert(freq2['p'] == 1); assert(freq2['r'] == 2); assert(freq2['o'] == 1); assert(freq2['g'] == 1); assert(freq2['a'] == 1); assert(freq2['m'] == 1); free(freq2); // Test case 3: "language" int* freq3 = func0("language"); assert(freq3['l'] == 1); assert(freq3['a'] == 2); assert(freq3['n'] == 1); assert(freq3['g'] == 2); assert(freq3['u'] == 1); assert(freq3['e'] == 1); free(freq3); return 0; }
O3
c
func0: endbr64 push %rbx mov $0x4,%esi mov %rdi,%rbx mov $0x100,%edi callq 10b0 <calloc@plt> test %rax,%rax je 1575 <func0+0x45> movzbl (%rbx),%edx lea 0x1(%rbx),%rdi test %dl,%dl je 1573 <func0+0x43> nopw 0x0(%rax,%rax,1) movzbl %dl,%edx add $0x1,%rdi addl $0x1,(%rax,%rdx,4) movzbl -0x1(%rdi),%edx test %dl,%dl jne 1560 <func0+0x30> pop %rbx retq lea 0xa88(%rip),%rdi callq 10c0 <perror@plt> mov $0x1,%edi callq 10d0 <exit@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push rbx mov esi, 4; size mov rbx, rdi mov edi, 100h; nmemb call _calloc test rax, rax jz func0_cold movzx edx, byte ptr [rbx] lea rdi, [rbx+1] test dl, dl jz short loc_1590 nop dword ptr [rax+rax+00h] loc_1580: add rdi, 1 add dword ptr [rax+rdx*4], 1 movzx edx, byte ptr [rdi-1] test dl, dl jnz short loc_1580 loc_1590: pop rbx retn
_DWORD * func0(unsigned __int8 *a1) { _DWORD *result; // rax long long v2; // rdx unsigned __int8 *i; // rdi result = calloc(0x100uLL, 4uLL); if ( !result ) func0_cold(); v2 = *a1; for ( i = a1 + 1; (_BYTE)v2; v2 = *(i - 1) ) { ++i; ++result[v2]; } return result; }
func0: ENDBR64 PUSH RBX MOV ESI,0x4 MOV RBX,RDI MOV EDI,0x100 CALL 0x001010b0 TEST RAX,RAX JZ 0x001010e0 MOVZX EDX,byte ptr [RBX] LEA RDI,[RBX + 0x1] TEST DL,DL JZ 0x00101590 NOP dword ptr [RAX + RAX*0x1] LAB_00101580: ADD RDI,0x1 ADD dword ptr [RAX + RDX*0x4],0x1 MOVZX EDX,byte ptr [RDI + -0x1] TEST DL,DL JNZ 0x00101580 LAB_00101590: POP RBX RET
void func0(byte *param_1) { int *piVar1; byte bVar2; byte *pbVar3; void *pvVar4; pvVar4 = calloc(0x100,4); if (pvVar4 != (void *)0x0) { bVar2 = *param_1; pbVar3 = param_1 + 1; while (bVar2 != 0) { piVar1 = (int *)((long)pvVar4 + (ulong)bVar2 * 4); *piVar1 = *piVar1 + 1; bVar2 = *pbVar3; pbVar3 = pbVar3 + 1; } return; } perror("Failed to allocate memory"); /* WARNING: Subroutine does not return */ exit(1); }
5,224
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> typedef struct { char* str; int num; } pair; int compare_pairs(const void* a, const void* b) { const pair* pa = (const pair*)a; const pair* pb = (const pair*)b; return (pa->num - pb->num); }
void func0(pair* sub_li, size_t n) { qsort(sub_li, n, sizeof(pair), compare_pairs); }
int main() { pair array1[] = {{"a", 10}, {"b", 5}, {"c", 20}, {"d", 15}}; pair expected1[] = {{"b", 5}, {"a", 10}, {"d", 15}, {"c", 20}}; size_t size1 = sizeof(array1) / sizeof(array1[0]); pair array2[] = {{"452", 10}, {"256", 5}, {"100", 20}, {"135", 15}}; pair expected2[] = {{"256", 5}, {"452", 10}, {"135", 15}, {"100", 20}}; size_t size2 = sizeof(array2) / sizeof(array2[0]); pair array3[] = {{"rishi", 10}, {"akhil", 5}, {"ramya", 20}, {"gaur", 15}}; pair expected3[] = {{"akhil", 5}, {"rishi", 10}, {"gaur", 15}, {"ramya", 20}}; size_t size3 = sizeof(array3) / sizeof(array3[0]); func0(array1, size1); func0(array2, size2); func0(array3, size3); for (size_t i = 0; i < size1; i++) { assert(array1[i].num == expected1[i].num); } for (size_t i = 0; i < size2; i++) { assert(array2[i].num == expected2[i].num); } for (size_t i = 0; i < size3; i++) { assert(array3[i].num == expected3[i].num); } return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov %rdi,-0x8(%rbp) mov %rsi,-0x10(%rbp) mov -0x10(%rbp),%rsi mov -0x8(%rbp),%rax lea -0x57(%rip),%rcx mov $0x10,%edx mov %rax,%rdi callq 1070 <qsort@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 10h mov [rbp+base], rdi mov [rbp+nmemb], rsi mov rsi, [rbp+nmemb]; nmemb mov rax, [rbp+base] lea rdx, compare_pairs mov rcx, rdx; compar mov edx, 10h; size mov rdi, rax; base call _qsort nop leave retn
void func0(void *a1, size_t a2) { qsort(a1, a2, 0x10uLL, compare_pairs); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x10 MOV qword ptr [RBP + -0x8],RDI MOV qword ptr [RBP + -0x10],RSI MOV RSI,qword ptr [RBP + -0x10] MOV RAX,qword ptr [RBP + -0x8] LEA RDX,[0x101189] MOV RCX,RDX MOV EDX,0x10 MOV RDI,RAX CALL 0x00101070 NOP LEAVE RET
void func0(void *param_1,size_t param_2) { qsort(param_1,param_2,0x10,compare_pairs); return; }
5,225
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> typedef struct { char* str; int num; } pair; int compare_pairs(const void* a, const void* b) { const pair* pa = (const pair*)a; const pair* pb = (const pair*)b; return (pa->num - pb->num); }
void func0(pair* sub_li, size_t n) { qsort(sub_li, n, sizeof(pair), compare_pairs); }
int main() { pair array1[] = {{"a", 10}, {"b", 5}, {"c", 20}, {"d", 15}}; pair expected1[] = {{"b", 5}, {"a", 10}, {"d", 15}, {"c", 20}}; size_t size1 = sizeof(array1) / sizeof(array1[0]); pair array2[] = {{"452", 10}, {"256", 5}, {"100", 20}, {"135", 15}}; pair expected2[] = {{"256", 5}, {"452", 10}, {"135", 15}, {"100", 20}}; size_t size2 = sizeof(array2) / sizeof(array2[0]); pair array3[] = {{"rishi", 10}, {"akhil", 5}, {"ramya", 20}, {"gaur", 15}}; pair expected3[] = {{"akhil", 5}, {"rishi", 10}, {"gaur", 15}, {"ramya", 20}}; size_t size3 = sizeof(array3) / sizeof(array3[0]); func0(array1, size1); func0(array2, size2); func0(array3, size3); for (size_t i = 0; i < size1; i++) { assert(array1[i].num == expected1[i].num); } for (size_t i = 0; i < size2; i++) { assert(array2[i].num == expected2[i].num); } for (size_t i = 0; i < size3; i++) { assert(array3[i].num == expected3[i].num); } return 0; }
O1
c
func0: endbr64 sub $0x8,%rsp lea -0x1a(%rip),%rcx mov $0x10,%edx callq 1070 <qsort@plt> add $0x8,%rsp retq
func0: endbr64 sub rsp, 8 lea rcx, compare_pairs mov edx, 10h call _qsort add rsp, 8 retn
long long func0(long long a1, long long a2) { return qsort(a1, a2, 16LL, compare_pairs); }
func0: ENDBR64 SUB RSP,0x8 LEA RCX,[0x101189] MOV EDX,0x10 CALL 0x00101070 ADD RSP,0x8 RET
void func0(void *param_1,size_t param_2) { qsort(param_1,param_2,0x10,compare_pairs); return; }
5,226
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> typedef struct { char* str; int num; } pair; int compare_pairs(const void* a, const void* b) { const pair* pa = (const pair*)a; const pair* pb = (const pair*)b; return (pa->num - pb->num); }
void func0(pair* sub_li, size_t n) { qsort(sub_li, n, sizeof(pair), compare_pairs); }
int main() { pair array1[] = {{"a", 10}, {"b", 5}, {"c", 20}, {"d", 15}}; pair expected1[] = {{"b", 5}, {"a", 10}, {"d", 15}, {"c", 20}}; size_t size1 = sizeof(array1) / sizeof(array1[0]); pair array2[] = {{"452", 10}, {"256", 5}, {"100", 20}, {"135", 15}}; pair expected2[] = {{"256", 5}, {"452", 10}, {"135", 15}, {"100", 20}}; size_t size2 = sizeof(array2) / sizeof(array2[0]); pair array3[] = {{"rishi", 10}, {"akhil", 5}, {"ramya", 20}, {"gaur", 15}}; pair expected3[] = {{"akhil", 5}, {"rishi", 10}, {"gaur", 15}, {"ramya", 20}}; size_t size3 = sizeof(array3) / sizeof(array3[0]); func0(array1, size1); func0(array2, size2); func0(array3, size3); for (size_t i = 0; i < size1; i++) { assert(array1[i].num == expected1[i].num); } for (size_t i = 0; i < size2; i++) { assert(array2[i].num == expected2[i].num); } for (size_t i = 0; i < size3; i++) { assert(array3[i].num == expected3[i].num); } return 0; }
O2
c
func0: endbr64 lea -0x1b(%rip),%rcx mov $0x10,%edx jmpq 1070 <qsort@plt> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 lea rcx, compare_pairs mov edx, 10h jmp _qsort
long long func0(long long a1, long long a2) { return qsort(a1, a2, 16LL, compare_pairs); }
func0: ENDBR64 LEA RCX,[0x101490] MOV EDX,0x10 JMP 0x00101070
void func0(void *param_1,size_t param_2) { qsort(param_1,param_2,0x10,compare_pairs); return; }
5,227
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> typedef struct { char* str; int num; } pair; int compare_pairs(const void* a, const void* b) { const pair* pa = (const pair*)a; const pair* pb = (const pair*)b; return (pa->num - pb->num); }
void func0(pair* sub_li, size_t n) { qsort(sub_li, n, sizeof(pair), compare_pairs); }
int main() { pair array1[] = {{"a", 10}, {"b", 5}, {"c", 20}, {"d", 15}}; pair expected1[] = {{"b", 5}, {"a", 10}, {"d", 15}, {"c", 20}}; size_t size1 = sizeof(array1) / sizeof(array1[0]); pair array2[] = {{"452", 10}, {"256", 5}, {"100", 20}, {"135", 15}}; pair expected2[] = {{"256", 5}, {"452", 10}, {"135", 15}, {"100", 20}}; size_t size2 = sizeof(array2) / sizeof(array2[0]); pair array3[] = {{"rishi", 10}, {"akhil", 5}, {"ramya", 20}, {"gaur", 15}}; pair expected3[] = {{"akhil", 5}, {"rishi", 10}, {"gaur", 15}, {"ramya", 20}}; size_t size3 = sizeof(array3) / sizeof(array3[0]); func0(array1, size1); func0(array2, size2); func0(array3, size3); for (size_t i = 0; i < size1; i++) { assert(array1[i].num == expected1[i].num); } for (size_t i = 0; i < size2; i++) { assert(array2[i].num == expected2[i].num); } for (size_t i = 0; i < size3; i++) { assert(array3[i].num == expected3[i].num); } return 0; }
O3
c
func0: endbr64 lea -0x1b(%rip),%rcx mov $0x10,%edx jmpq 1070 <qsort@plt> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 lea rcx, compare_pairs; compar mov edx, 10h; size jmp _qsort
void func0(void *a1, size_t a2) { qsort(a1, a2, 0x10uLL, compare_pairs); }
func0: ENDBR64 LEA RCX,[0x101400] MOV EDX,0x10 JMP 0x00101070
void func0(void *param_1,size_t param_2) { qsort(param_1,param_2,0x10,compare_pairs); return; }
5,228
func0
#include <assert.h> #include <stdbool.h>
bool func0(int a, int b, int c) { if ((a + b <= c) || (a + c <= b) || (b + c <= a)) { return false; } else { return true; } }
int main() { assert(func0(1, 2, 3) == false); assert(func0(2, 3, 5) == false); assert(func0(7, 10, 5) == true); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov %esi,-0x8(%rbp) mov %edx,-0xc(%rbp) mov -0x4(%rbp),%edx mov -0x8(%rbp),%eax add %edx,%eax cmp %eax,-0xc(%rbp) jge 1181 <func0+0x38> mov -0x4(%rbp),%edx mov -0xc(%rbp),%eax add %edx,%eax cmp %eax,-0x8(%rbp) jge 1181 <func0+0x38> mov -0x8(%rbp),%edx mov -0xc(%rbp),%eax add %edx,%eax cmp %eax,-0x4(%rbp) jl 1188 <func0+0x3f> mov $0x0,%eax jmp 118d <func0+0x44> mov $0x1,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov [rbp+var_8], esi mov [rbp+var_C], edx mov edx, [rbp+var_4] mov eax, [rbp+var_8] add eax, edx cmp [rbp+var_C], eax jge short loc_1181 mov edx, [rbp+var_4] mov eax, [rbp+var_C] add eax, edx cmp [rbp+var_8], eax jge short loc_1181 mov edx, [rbp+var_8] mov eax, [rbp+var_C] add eax, edx cmp [rbp+var_4], eax jl short loc_1188 loc_1181: mov eax, 0 jmp short loc_118D loc_1188: mov eax, 1 loc_118D: pop rbp retn
_BOOL8 func0(int a1, int a2, int a3) { return a3 < a1 + a2 && a2 < a1 + a3 && a1 < a2 + a3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV dword ptr [RBP + -0x8],ESI MOV dword ptr [RBP + -0xc],EDX MOV EDX,dword ptr [RBP + -0x4] MOV EAX,dword ptr [RBP + -0x8] ADD EAX,EDX CMP dword ptr [RBP + -0xc],EAX JGE 0x00101181 MOV EDX,dword ptr [RBP + -0x4] MOV EAX,dword ptr [RBP + -0xc] ADD EAX,EDX CMP dword ptr [RBP + -0x8],EAX JGE 0x00101181 MOV EDX,dword ptr [RBP + -0x8] MOV EAX,dword ptr [RBP + -0xc] ADD EAX,EDX CMP dword ptr [RBP + -0x4],EAX JL 0x00101188 LAB_00101181: MOV EAX,0x0 JMP 0x0010118d LAB_00101188: MOV EAX,0x1 LAB_0010118d: POP RBP RET
int8 func0(int param_1,int param_2,int param_3) { int8 uVar1; if (((param_3 < param_2 + param_1) && (param_2 < param_3 + param_1)) && (param_1 < param_3 + param_2)) { uVar1 = 1; } else { uVar1 = 0; } return uVar1; }
5,229
func0
#include <assert.h> #include <stdbool.h>
bool func0(int a, int b, int c) { if ((a + b <= c) || (a + c <= b) || (b + c <= a)) { return false; } else { return true; } }
int main() { assert(func0(1, 2, 3) == false); assert(func0(2, 3, 5) == false); assert(func0(7, 10, 5) == true); return 0; }
O1
c
func0: endbr64 lea (%rdi,%rsi,1),%ecx mov $0x0,%eax cmp %edx,%ecx jle 1147 <func0+0x1e> lea (%rdi,%rdx,1),%ecx cmp %esi,%ecx jle 1147 <func0+0x1e> add %edx,%esi cmp %edi,%esi setg %al retq
func0: endbr64 lea ecx, [rdi+rsi] mov eax, 0 cmp ecx, edx jle short locret_1147 lea ecx, [rdi+rdx] cmp ecx, esi jle short locret_1147 add esi, edx cmp esi, edi setnle al locret_1147: retn
bool func0(int a1, int a2, int a3) { bool result; // al result = 0; if ( a1 + a2 > a3 && a1 + a3 > a2 ) return a3 + a2 > a1; return result; }
func0: ENDBR64 LEA ECX,[RDI + RSI*0x1] MOV EAX,0x0 CMP ECX,EDX JLE 0x00101147 LEA ECX,[RDI + RDX*0x1] CMP ECX,ESI JLE 0x00101147 ADD ESI,EDX CMP ESI,EDI SETG AL LAB_00101147: RET
bool func0(int param_1,int param_2,int param_3) { bool bVar1; bVar1 = false; if ((param_3 < param_1 + param_2) && (param_2 < param_1 + param_3)) { bVar1 = param_1 < param_2 + param_3; } return bVar1; }
5,230
func0
#include <assert.h> #include <stdbool.h>
bool func0(int a, int b, int c) { if ((a + b <= c) || (a + c <= b) || (b + c <= a)) { return false; } else { return true; } }
int main() { assert(func0(1, 2, 3) == false); assert(func0(2, 3, 5) == false); assert(func0(7, 10, 5) == true); return 0; }
O2
c
func0: endbr64 lea (%rdi,%rsi,1),%ecx xor %eax,%eax cmp %edx,%ecx jle 115b <func0+0x1b> lea (%rdi,%rdx,1),%ecx cmp %esi,%ecx jle 115b <func0+0x1b> add %edx,%esi cmp %edi,%esi setg %al retq nopl 0x0(%rax)
func0: endbr64 lea ecx, [rdi+rsi] xor eax, eax cmp ecx, edx jle short locret_115B lea ecx, [rdi+rdx] cmp ecx, esi jle short locret_115B add esi, edx cmp esi, edi setnle al locret_115B: retn
bool func0(int a1, int a2, int a3) { bool result; // al result = 0; if ( a1 + a2 > a3 && a1 + a3 > a2 ) return a3 + a2 > a1; return result; }
func0: ENDBR64 LEA ECX,[RDI + RSI*0x1] XOR EAX,EAX CMP ECX,EDX JLE 0x0010115b LEA ECX,[RDI + RDX*0x1] CMP ECX,ESI JLE 0x0010115b ADD ESI,EDX CMP ESI,EDI SETG AL LAB_0010115b: RET
bool func0(int param_1,int param_2,int param_3) { bool bVar1; bVar1 = false; if ((param_3 < param_1 + param_2) && (param_2 < param_1 + param_3)) { bVar1 = param_1 < param_2 + param_3; } return bVar1; }
5,231
func0
#include <assert.h> #include <stdbool.h>
bool func0(int a, int b, int c) { if ((a + b <= c) || (a + c <= b) || (b + c <= a)) { return false; } else { return true; } }
int main() { assert(func0(1, 2, 3) == false); assert(func0(2, 3, 5) == false); assert(func0(7, 10, 5) == true); return 0; }
O3
c
func0: endbr64 lea (%rdi,%rsi,1),%ecx xor %eax,%eax cmp %edx,%ecx jle 115b <func0+0x1b> lea (%rdi,%rdx,1),%ecx cmp %esi,%ecx jle 115b <func0+0x1b> add %edx,%esi cmp %edi,%esi setg %al retq nopl 0x0(%rax)
func0: endbr64 lea ecx, [rdi+rsi] xor eax, eax cmp ecx, edx jle short locret_115B lea ecx, [rdi+rdx] cmp ecx, esi jle short locret_115B add esi, edx cmp esi, edi setnle al locret_115B: retn
bool func0(int a1, int a2, int a3) { bool result; // al result = 0; if ( a1 + a2 > a3 && a1 + a3 > a2 ) return a3 + a2 > a1; return result; }
func0: ENDBR64 LEA ECX,[RDI + RSI*0x1] XOR EAX,EAX CMP ECX,EDX JLE 0x0010115b LEA ECX,[RDI + RDX*0x1] CMP ECX,ESI JLE 0x0010115b ADD ESI,EDX CMP ESI,EDI SETG AL LAB_0010115b: RET
bool func0(int param_1,int param_2,int param_3) { bool bVar1; bVar1 = false; if ((param_3 < param_1 + param_2) && (param_2 < param_1 + param_3)) { bVar1 = param_1 < param_2 + param_3; } return bVar1; }
5,232
func0
#include <assert.h>
double func0(int a, int n, int d) { return (n * (2 * a + (n - 1) * d)) / 2.0; }
int main() { assert(func0(1, 5, 2) == 25); assert(func0(2, 6, 4) == 72); assert(func0(1, 4, 5) == 34); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov %esi,-0x8(%rbp) mov %edx,-0xc(%rbp) mov -0x4(%rbp),%eax lea (%rax,%rax,1),%edx mov -0x8(%rbp),%eax sub $0x1,%eax imul -0xc(%rbp),%eax add %edx,%eax imul -0x8(%rbp),%eax cvtsi2sd %eax,%xmm0 movsd 0xf0c(%rip),%xmm1 divsd %xmm1,%xmm0 pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov [rbp+var_8], esi mov [rbp+var_C], edx mov eax, [rbp+var_4] lea edx, [rax+rax] mov eax, [rbp+var_8] sub eax, 1 imul eax, [rbp+var_C] add eax, edx imul eax, [rbp+var_8] pxor xmm0, xmm0 cvtsi2sd xmm0, eax movsd xmm1, cs:qword_2070 divsd xmm0, xmm1 pop rbp retn
double func0(int a1, int a2, int a3) { return (double)(a2 * (2 * a1 + a3 * (a2 - 1))) / 2.0; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV dword ptr [RBP + -0x8],ESI MOV dword ptr [RBP + -0xc],EDX MOV EAX,dword ptr [RBP + -0x4] LEA EDX,[RAX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x8] SUB EAX,0x1 IMUL EAX,dword ptr [RBP + -0xc] ADD EAX,EDX IMUL EAX,dword ptr [RBP + -0x8] PXOR XMM0,XMM0 CVTSI2SD XMM0,EAX MOVSD XMM1,qword ptr [0x00102070] DIVSD XMM0,XMM1 POP RBP RET
double func0(int param_1,int param_2,int param_3) { return (double)(((param_2 + -1) * param_3 + param_1 * 2) * param_2) / DAT_00102070; }
5,233
func0
#include <assert.h>
double func0(int a, int n, int d) { return (n * (2 * a + (n - 1) * d)) / 2.0; }
int main() { assert(func0(1, 5, 2) == 25); assert(func0(2, 6, 4) == 72); assert(func0(1, 4, 5) == 34); return 0; }
O1
c
func0: endbr64 mov %esi,%eax mov %edx,%ecx lea -0x1(%rsi),%edx imul %ecx,%edx lea (%rdx,%rdi,2),%esi imul %eax,%esi pxor %xmm0,%xmm0 cvtsi2sd %esi,%xmm0 mulsd 0xebb(%rip),%xmm0 retq
func0: endbr64 lea eax, [rsi-1] imul eax, edx lea eax, [rax+rdi*2] imul eax, esi pxor xmm0, xmm0 cvtsi2sd xmm0, eax mulsd xmm0, cs:qword_2008 retn
double func0(int a1, int a2, int a3) { return (double)(a2 * (a3 * (a2 - 1) + 2 * a1)) * 0.5; }
func0: ENDBR64 LEA EAX,[RSI + -0x1] IMUL EAX,EDX LEA EAX,[RAX + RDI*0x2] IMUL EAX,ESI PXOR XMM0,XMM0 CVTSI2SD XMM0,EAX MULSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int param_1,int param_2,int param_3) { return (double)(((param_2 + -1) * param_3 + param_1 * 2) * param_2) * _DAT_00102008; }
5,234
func0
#include <assert.h>
double func0(int a, int n, int d) { return (n * (2 * a + (n - 1) * d)) / 2.0; }
int main() { assert(func0(1, 5, 2) == 25); assert(func0(2, 6, 4) == 72); assert(func0(1, 4, 5) == 34); return 0; }
O2
c
func0: endbr64 mov %edx,%r8d lea -0x1(%rsi),%edx pxor %xmm0,%xmm0 mov %esi,%eax imul %r8d,%edx lea (%rdx,%rdi,2),%esi imul %eax,%esi cvtsi2sd %esi,%xmm0 mulsd 0xea2(%rip),%xmm0 retq nopw 0x0(%rax,%rax,1)
func0: endbr64 lea eax, [rsi-1] pxor xmm0, xmm0 imul eax, edx lea eax, [rax+rdi*2] imul eax, esi cvtsi2sd xmm0, eax mulsd xmm0, cs:qword_2008 retn
double func0(int a1, int a2, int a3) { return (double)(a2 * (a3 * (a2 - 1) + 2 * a1)) * 0.5; }
func0: ENDBR64 LEA EAX,[RSI + -0x1] PXOR XMM0,XMM0 IMUL EAX,EDX LEA EAX,[RAX + RDI*0x2] IMUL EAX,ESI CVTSI2SD XMM0,EAX MULSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int param_1,int param_2,int param_3) { return (double)(((param_2 + -1) * param_3 + param_1 * 2) * param_2) * _DAT_00102008; }
5,235
func0
#include <assert.h>
double func0(int a, int n, int d) { return (n * (2 * a + (n - 1) * d)) / 2.0; }
int main() { assert(func0(1, 5, 2) == 25); assert(func0(2, 6, 4) == 72); assert(func0(1, 4, 5) == 34); return 0; }
O3
c
func0: endbr64 mov %edx,%r8d lea -0x1(%rsi),%edx pxor %xmm0,%xmm0 mov %esi,%eax imul %r8d,%edx lea (%rdx,%rdi,2),%esi imul %eax,%esi cvtsi2sd %esi,%xmm0 mulsd 0xea2(%rip),%xmm0 retq nopw 0x0(%rax,%rax,1)
func0: endbr64 lea eax, [rsi-1] pxor xmm0, xmm0 imul eax, edx lea eax, [rax+rdi*2] imul eax, esi cvtsi2sd xmm0, eax mulsd xmm0, cs:qword_2008 retn
double func0(int a1, int a2, int a3) { return (double)(a2 * (a3 * (a2 - 1) + 2 * a1)) * 0.5; }
func0: ENDBR64 LEA EAX,[RSI + -0x1] PXOR XMM0,XMM0 IMUL EAX,EDX LEA EAX,[RAX + RDI*0x2] IMUL EAX,ESI CVTSI2SD XMM0,EAX MULSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int param_1,int param_2,int param_3) { return (double)(((param_2 + -1) * param_3 + param_1 * 2) * param_2) * _DAT_00102008; }
5,236
func0
#include <assert.h> #include <stdbool.h>
bool func0(char *monthname1) { if (monthname1[0] == 'F' && monthname1[1] == 'e' && monthname1[2] == 'b' && monthname1[3] == 'r' && monthname1[4] == 'u' && monthname1[5] == 'a' && monthname1[6] == 'r' && monthname1[7] == 'y' && monthname1[8] == '\0') { return true; } else { return false; } }
int main() { assert(func0("February") == true); assert(func0("January") == false); assert(func0("March") == false); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x8(%rbp) mov -0x8(%rbp),%rax movzbl (%rax),%eax cmp $0x46,%al jne 11df <func0+0x96> mov -0x8(%rbp),%rax add $0x1,%rax movzbl (%rax),%eax cmp $0x65,%al jne 11df <func0+0x96> mov -0x8(%rbp),%rax add $0x2,%rax movzbl (%rax),%eax cmp $0x62,%al jne 11df <func0+0x96> mov -0x8(%rbp),%rax add $0x3,%rax movzbl (%rax),%eax cmp $0x72,%al jne 11df <func0+0x96> mov -0x8(%rbp),%rax add $0x4,%rax movzbl (%rax),%eax cmp $0x75,%al jne 11df <func0+0x96> mov -0x8(%rbp),%rax add $0x5,%rax movzbl (%rax),%eax cmp $0x61,%al jne 11df <func0+0x96> mov -0x8(%rbp),%rax add $0x6,%rax movzbl (%rax),%eax cmp $0x72,%al jne 11df <func0+0x96> mov -0x8(%rbp),%rax add $0x7,%rax movzbl (%rax),%eax cmp $0x79,%al jne 11df <func0+0x96> mov -0x8(%rbp),%rax add $0x8,%rax movzbl (%rax),%eax test %al,%al jne 11df <func0+0x96> mov $0x1,%eax jmp 11e4 <func0+0x9b> mov $0x0,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_8], rdi mov rax, [rbp+var_8] movzx eax, byte ptr [rax] cmp al, 46h ; 'F' jnz short loc_11DF mov rax, [rbp+var_8] add rax, 1 movzx eax, byte ptr [rax] cmp al, 65h ; 'e' jnz short loc_11DF mov rax, [rbp+var_8] add rax, 2 movzx eax, byte ptr [rax] cmp al, 62h ; 'b' jnz short loc_11DF mov rax, [rbp+var_8] add rax, 3 movzx eax, byte ptr [rax] cmp al, 72h ; 'r' jnz short loc_11DF mov rax, [rbp+var_8] add rax, 4 movzx eax, byte ptr [rax] cmp al, 75h ; 'u' jnz short loc_11DF mov rax, [rbp+var_8] add rax, 5 movzx eax, byte ptr [rax] cmp al, 61h ; 'a' jnz short loc_11DF mov rax, [rbp+var_8] add rax, 6 movzx eax, byte ptr [rax] cmp al, 72h ; 'r' jnz short loc_11DF mov rax, [rbp+var_8] add rax, 7 movzx eax, byte ptr [rax] cmp al, 79h ; 'y' jnz short loc_11DF mov rax, [rbp+var_8] add rax, 8 movzx eax, byte ptr [rax] test al, al jnz short loc_11DF mov eax, 1 jmp short loc_11E4 loc_11DF: mov eax, 0 loc_11E4: pop rbp retn
_BOOL8 func0(_BYTE *a1) { return *a1 == 70 && a1[1] == 101 && a1[2] == 98 && a1[3] == 114 && a1[4] == 117 && a1[5] == 97 && a1[6] == 114 && a1[7] == 121 && !a1[8]; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x8],RDI MOV RAX,qword ptr [RBP + -0x8] MOVZX EAX,byte ptr [RAX] CMP AL,0x46 JNZ 0x001011df MOV RAX,qword ptr [RBP + -0x8] ADD RAX,0x1 MOVZX EAX,byte ptr [RAX] CMP AL,0x65 JNZ 0x001011df MOV RAX,qword ptr [RBP + -0x8] ADD RAX,0x2 MOVZX EAX,byte ptr [RAX] CMP AL,0x62 JNZ 0x001011df MOV RAX,qword ptr [RBP + -0x8] ADD RAX,0x3 MOVZX EAX,byte ptr [RAX] CMP AL,0x72 JNZ 0x001011df MOV RAX,qword ptr [RBP + -0x8] ADD RAX,0x4 MOVZX EAX,byte ptr [RAX] CMP AL,0x75 JNZ 0x001011df MOV RAX,qword ptr [RBP + -0x8] ADD RAX,0x5 MOVZX EAX,byte ptr [RAX] CMP AL,0x61 JNZ 0x001011df MOV RAX,qword ptr [RBP + -0x8] ADD RAX,0x6 MOVZX EAX,byte ptr [RAX] CMP AL,0x72 JNZ 0x001011df MOV RAX,qword ptr [RBP + -0x8] ADD RAX,0x7 MOVZX EAX,byte ptr [RAX] CMP AL,0x79 JNZ 0x001011df MOV RAX,qword ptr [RBP + -0x8] ADD RAX,0x8 MOVZX EAX,byte ptr [RAX] TEST AL,AL JNZ 0x001011df MOV EAX,0x1 JMP 0x001011e4 LAB_001011df: MOV EAX,0x0 LAB_001011e4: POP RBP RET
int8 func0(char *param_1) { int8 uVar1; if ((((((*param_1 == 'F') && (param_1[1] == 'e')) && (param_1[2] == 'b')) && ((param_1[3] == 'r' && (param_1[4] == 'u')))) && ((param_1[5] == 'a' && ((param_1[6] == 'r' && (param_1[7] == 'y')))))) && (param_1[8] == '\0') ) { uVar1 = 1; } else { uVar1 = 0; } return uVar1; }
5,237
func0
#include <assert.h> #include <stdbool.h>
bool func0(char *monthname1) { if (monthname1[0] == 'F' && monthname1[1] == 'e' && monthname1[2] == 'b' && monthname1[3] == 'r' && monthname1[4] == 'u' && monthname1[5] == 'a' && monthname1[6] == 'r' && monthname1[7] == 'y' && monthname1[8] == '\0') { return true; } else { return false; } }
int main() { assert(func0("February") == true); assert(func0("January") == false); assert(func0("March") == false); return 0; }
O1
c
func0: endbr64 mov $0x0,%eax cmpb $0x46,(%rdi) jne 1188 <func0+0x3f> cmpb $0x65,0x1(%rdi) jne 1188 <func0+0x3f> cmpb $0x62,0x2(%rdi) jne 1188 <func0+0x3f> cmpb $0x72,0x3(%rdi) jne 1188 <func0+0x3f> cmpb $0x75,0x4(%rdi) jne 1188 <func0+0x3f> cmpb $0x61,0x5(%rdi) jne 1188 <func0+0x3f> cmpb $0x72,0x6(%rdi) jne 1188 <func0+0x3f> cmpb $0x79,0x7(%rdi) jne 1188 <func0+0x3f> cmpb $0x0,0x8(%rdi) sete %al retq
func0: endbr64 mov eax, 0 cmp byte ptr [rdi], 46h ; 'F' jnz short locret_1188 cmp byte ptr [rdi+1], 65h ; 'e' jnz short locret_1188 cmp byte ptr [rdi+2], 62h ; 'b' jnz short locret_1188 cmp byte ptr [rdi+3], 72h ; 'r' jnz short locret_1188 cmp byte ptr [rdi+4], 75h ; 'u' jnz short locret_1188 cmp byte ptr [rdi+5], 61h ; 'a' jnz short locret_1188 cmp byte ptr [rdi+6], 72h ; 'r' jnz short locret_1188 cmp byte ptr [rdi+7], 79h ; 'y' jnz short locret_1188 cmp byte ptr [rdi+8], 0 setz al locret_1188: retn
bool func0(_BYTE *a1) { bool result; // al result = 0; if ( *a1 == 70 && a1[1] == 101 && a1[2] == 98 && a1[3] == 114 && a1[4] == 117 && a1[5] == 97 && a1[6] == 114 && a1[7] == 121 ) { return a1[8] == 0; } return result; }
func0: ENDBR64 MOV EAX,0x0 CMP byte ptr [RDI],0x46 JNZ 0x00101188 CMP byte ptr [RDI + 0x1],0x65 JNZ 0x00101188 CMP byte ptr [RDI + 0x2],0x62 JNZ 0x00101188 CMP byte ptr [RDI + 0x3],0x72 JNZ 0x00101188 CMP byte ptr [RDI + 0x4],0x75 JNZ 0x00101188 CMP byte ptr [RDI + 0x5],0x61 JNZ 0x00101188 CMP byte ptr [RDI + 0x6],0x72 JNZ 0x00101188 CMP byte ptr [RDI + 0x7],0x79 JNZ 0x00101188 CMP byte ptr [RDI + 0x8],0x0 SETZ AL LAB_00101188: RET
bool func0(char *param_1) { bool bVar1; bVar1 = false; if (((((*param_1 == 'F') && (param_1[1] == 'e')) && (param_1[2] == 'b')) && ((param_1[3] == 'r' && (param_1[4] == 'u')))) && ((param_1[5] == 'a' && ((param_1[6] == 'r' && (param_1[7] == 'y')))))) { bVar1 = param_1[8] == '\0'; } return bVar1; }
5,238
func0
#include <assert.h> #include <stdbool.h>
bool func0(char *monthname1) { if (monthname1[0] == 'F' && monthname1[1] == 'e' && monthname1[2] == 'b' && monthname1[3] == 'r' && monthname1[4] == 'u' && monthname1[5] == 'a' && monthname1[6] == 'r' && monthname1[7] == 'y' && monthname1[8] == '\0') { return true; } else { return false; } }
int main() { assert(func0("February") == true); assert(func0("January") == false); assert(func0("March") == false); return 0; }
O2
c
func0: endbr64 xor %eax,%eax cmpb $0x46,(%rdi) jne 122c <func0+0x3c> cmpb $0x65,0x1(%rdi) jne 122c <func0+0x3c> cmpb $0x62,0x2(%rdi) jne 122c <func0+0x3c> cmpb $0x72,0x3(%rdi) jne 122c <func0+0x3c> cmpb $0x75,0x4(%rdi) jne 122c <func0+0x3c> cmpb $0x61,0x5(%rdi) jne 122c <func0+0x3c> cmpb $0x72,0x6(%rdi) jne 122c <func0+0x3c> cmpb $0x79,0x7(%rdi) jne 122c <func0+0x3c> cmpb $0x0,0x8(%rdi) sete %al retq nopl (%rax)
func0: endbr64 xor eax, eax cmp byte ptr [rdi], 46h ; 'F' jnz short locret_122C cmp byte ptr [rdi+1], 65h ; 'e' jnz short locret_122C cmp byte ptr [rdi+2], 62h ; 'b' jnz short locret_122C cmp byte ptr [rdi+3], 72h ; 'r' jnz short locret_122C cmp byte ptr [rdi+4], 75h ; 'u' jnz short locret_122C cmp byte ptr [rdi+5], 61h ; 'a' jnz short locret_122C cmp byte ptr [rdi+6], 72h ; 'r' jnz short locret_122C cmp byte ptr [rdi+7], 79h ; 'y' jnz short locret_122C cmp byte ptr [rdi+8], 0 setz al locret_122C: retn
bool func0(_BYTE *a1) { bool result; // al result = 0; if ( *a1 == 70 && a1[1] == 101 && a1[2] == 98 && a1[3] == 114 && a1[4] == 117 && a1[5] == 97 && a1[6] == 114 && a1[7] == 121 ) { return a1[8] == 0; } return result; }
func0: ENDBR64 XOR EAX,EAX CMP byte ptr [RDI],0x46 JNZ 0x0010122c CMP byte ptr [RDI + 0x1],0x65 JNZ 0x0010122c CMP byte ptr [RDI + 0x2],0x62 JNZ 0x0010122c CMP byte ptr [RDI + 0x3],0x72 JNZ 0x0010122c CMP byte ptr [RDI + 0x4],0x75 JNZ 0x0010122c CMP byte ptr [RDI + 0x5],0x61 JNZ 0x0010122c CMP byte ptr [RDI + 0x6],0x72 JNZ 0x0010122c CMP byte ptr [RDI + 0x7],0x79 JNZ 0x0010122c CMP byte ptr [RDI + 0x8],0x0 SETZ AL LAB_0010122c: RET
bool func0(char *param_1) { bool bVar1; bool bVar2; bVar2 = false; bVar1 = false; if (((((*param_1 == 'F') && (param_1[1] == 'e')) && (param_1[2] == 'b')) && ((bVar2 = bVar1, param_1[3] == 'r' && (param_1[4] == 'u')))) && ((param_1[5] == 'a' && ((param_1[6] == 'r' && (param_1[7] == 'y')))))) { bVar2 = param_1[8] == '\0'; } return bVar2; }
5,239
func0
#include <assert.h> #include <stdbool.h>
bool func0(char *monthname1) { if (monthname1[0] == 'F' && monthname1[1] == 'e' && monthname1[2] == 'b' && monthname1[3] == 'r' && monthname1[4] == 'u' && monthname1[5] == 'a' && monthname1[6] == 'r' && monthname1[7] == 'y' && monthname1[8] == '\0') { return true; } else { return false; } }
int main() { assert(func0("February") == true); assert(func0("January") == false); assert(func0("March") == false); return 0; }
O3
c
func0: endbr64 xor %eax,%eax cmpb $0x46,(%rdi) jne 122c <func0+0x3c> cmpb $0x65,0x1(%rdi) jne 122c <func0+0x3c> cmpb $0x62,0x2(%rdi) jne 122c <func0+0x3c> cmpb $0x72,0x3(%rdi) jne 122c <func0+0x3c> cmpb $0x75,0x4(%rdi) jne 122c <func0+0x3c> cmpb $0x61,0x5(%rdi) jne 122c <func0+0x3c> cmpb $0x72,0x6(%rdi) jne 122c <func0+0x3c> cmpb $0x79,0x7(%rdi) jne 122c <func0+0x3c> cmpb $0x0,0x8(%rdi) sete %al retq nopl (%rax)
func0: endbr64 xor eax, eax cmp byte ptr [rdi], 46h ; 'F' jnz short locret_122C cmp byte ptr [rdi+1], 65h ; 'e' jnz short locret_122C cmp byte ptr [rdi+2], 62h ; 'b' jnz short locret_122C cmp byte ptr [rdi+3], 72h ; 'r' jnz short locret_122C cmp byte ptr [rdi+4], 75h ; 'u' jnz short locret_122C cmp byte ptr [rdi+5], 61h ; 'a' jnz short locret_122C cmp byte ptr [rdi+6], 72h ; 'r' jnz short locret_122C cmp byte ptr [rdi+7], 79h ; 'y' jnz short locret_122C cmp byte ptr [rdi+8], 0 setz al locret_122C: retn
bool func0(_BYTE *a1) { bool result; // al result = 0; if ( *a1 == 70 && a1[1] == 101 && a1[2] == 98 && a1[3] == 114 && a1[4] == 117 && a1[5] == 97 && a1[6] == 114 && a1[7] == 121 ) { return a1[8] == 0; } return result; }
func0: ENDBR64 XOR EAX,EAX CMP byte ptr [RDI],0x46 JNZ 0x0010122c CMP byte ptr [RDI + 0x1],0x65 JNZ 0x0010122c CMP byte ptr [RDI + 0x2],0x62 JNZ 0x0010122c CMP byte ptr [RDI + 0x3],0x72 JNZ 0x0010122c CMP byte ptr [RDI + 0x4],0x75 JNZ 0x0010122c CMP byte ptr [RDI + 0x5],0x61 JNZ 0x0010122c CMP byte ptr [RDI + 0x6],0x72 JNZ 0x0010122c CMP byte ptr [RDI + 0x7],0x79 JNZ 0x0010122c CMP byte ptr [RDI + 0x8],0x0 SETZ AL LAB_0010122c: RET
bool func0(char *param_1) { bool bVar1; bool bVar2; bVar2 = false; bVar1 = false; if (((((*param_1 == 'F') && (param_1[1] == 'e')) && (param_1[2] == 'b')) && ((bVar2 = bVar1, param_1[3] == 'r' && (param_1[4] == 'u')))) && ((param_1[5] == 'a' && ((param_1[6] == 'r' && (param_1[7] == 'y')))))) { bVar2 = param_1[8] == '\0'; } return bVar2; }
5,240
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <regex.h>
char* func0(const char* text) { regex_t regex; char *patterns = "\\w+\\S*$"; if (regcomp(&regex, patterns, REG_EXTENDED) == 0) { regmatch_t matches[1]; if (regexec(&regex, text, 1, matches, 0) == 0) { regfree(&regex); return "Found a match!"; } else { regfree(&regex); return "Not matched!"; } } return "Regex compilation failed"; }
int main() { assert(strcmp(func0("python."), "Found a match!") == 0); assert(strcmp(func0("python."), "Found a match!") == 0); assert(strcmp(func0(" lang ."), "Not matched!") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x70,%rsp mov %rdi,-0x68(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea 0xdf9(%rip),%rax mov %rax,-0x58(%rbp) mov -0x58(%rbp),%rcx lea -0x50(%rbp),%rax mov $0x1,%edx mov %rcx,%rsi mov %rax,%rdi callq 10d0 <regcomp@plt> test %eax,%eax jne 127f <func0+0x96> lea -0x10(%rbp),%rdx mov -0x68(%rbp),%rsi lea -0x50(%rbp),%rax mov $0x0,%r8d mov %rdx,%rcx mov $0x1,%edx mov %rax,%rdi callq 10f0 <regexec@plt> test %eax,%eax jne 126a <func0+0x81> lea -0x50(%rbp),%rax mov %rax,%rdi callq 10a0 <regfree@plt> lea 0xda8(%rip),%rax jmp 1286 <func0+0x9d> lea -0x50(%rbp),%rax mov %rax,%rdi callq 10a0 <regfree@plt> lea 0xda2(%rip),%rax jmp 1286 <func0+0x9d> lea 0xda6(%rip),%rax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 129a <func0+0xb1> callq 10b0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 70h mov [rbp+string], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea rax, aWS; "\\w+\\S*$" 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 test eax, eax jnz short loc_127F lea rdx, [rbp+pmatch] mov rsi, [rbp+string]; string lea rax, [rbp+preg] mov r8d, 0; eflags mov rcx, rdx; pmatch mov edx, 1; nmatch mov rdi, rax; preg call _regexec test eax, eax jnz short loc_126A lea rax, [rbp+preg] mov rdi, rax; preg call _regfree lea rax, s2; "Found a match!" jmp short loc_1286 loc_126A: lea rax, [rbp+preg] mov rdi, rax; preg call _regfree lea rax, aNotMatched; "Not matched!" jmp short loc_1286 loc_127F: lea rax, aRegexCompilati; "Regex compilation failed" loc_1286: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_129A call ___stack_chk_fail locret_129A: leave retn
const char * func0(const char *a1) { regex_t preg; // [rsp+20h] [rbp-50h] BYREF regmatch_t pmatch; // [rsp+60h] [rbp-10h] BYREF unsigned long long v4; // [rsp+68h] [rbp-8h] v4 = __readfsqword(0x28u); if ( regcomp(&preg, "\\w+\\S*$", 1) ) return "Regex compilation failed"; if ( regexec(&preg, a1, 1uLL, &pmatch, 0) ) { regfree(&preg); return "Not matched!"; } else { regfree(&preg); return "Found a match!"; } }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x70 MOV qword ptr [RBP + -0x68],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX LEA RAX,[0x102008] MOV qword ptr [RBP + -0x58],RAX MOV RCX,qword ptr [RBP + -0x58] LEA RAX,[RBP + -0x50] MOV EDX,0x1 MOV RSI,RCX MOV RDI,RAX CALL 0x001010d0 TEST EAX,EAX JNZ 0x0010127f LEA RDX,[RBP + -0x10] MOV RSI,qword ptr [RBP + -0x68] LEA RAX,[RBP + -0x50] MOV R8D,0x0 MOV RCX,RDX MOV EDX,0x1 MOV RDI,RAX CALL 0x001010f0 TEST EAX,EAX JNZ 0x0010126a LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001010a0 LEA RAX,[0x102010] JMP 0x00101286 LAB_0010126a: LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001010a0 LEA RAX,[0x10201f] JMP 0x00101286 LAB_0010127f: LEA RAX,[0x10202c] LAB_00101286: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x0010129a CALL 0x001010b0 LAB_0010129a: LEAVE RET
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t local_58; regmatch_t local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&local_58,"\\w+\\S*$",1); if (iVar1 == 0) { iVar1 = regexec(&local_58,param_1,1,&local_18,0); if (iVar1 == 0) { regfree(&local_58); pcVar2 = "Found a match!"; } else { regfree(&local_58); pcVar2 = "Not matched!"; } } else { pcVar2 = "Regex compilation failed"; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return pcVar2; }
5,241
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <regex.h>
char* func0(const char* text) { regex_t regex; char *patterns = "\\w+\\S*$"; if (regcomp(&regex, patterns, REG_EXTENDED) == 0) { regmatch_t matches[1]; if (regexec(&regex, text, 1, matches, 0) == 0) { regfree(&regex); return "Found a match!"; } else { regfree(&regex); return "Not matched!"; } } return "Regex compilation failed"; }
int main() { assert(strcmp(func0("python."), "Found a match!") == 0); assert(strcmp(func0("python."), "Found a match!") == 0); assert(strcmp(func0(" lang ."), "Not matched!") == 0); return 0; }
O1
c
func0: endbr64 push %rbx sub $0x50,%rsp mov %rdi,%rbx mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov %rsp,%rdi mov $0x1,%edx lea 0xe45(%rip),%rsi callq 10c0 <regcomp@plt> mov %eax,%edx lea 0xe1e(%rip),%rax test %edx,%edx je 121c <func0+0x53> mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 125d <func0+0x94> add $0x50,%rsp pop %rbx retq lea 0x40(%rsp),%rcx mov %rsp,%rdi mov $0x0,%r8d mov $0x1,%edx mov %rbx,%rsi callq 10d0 <regexec@plt> test %eax,%eax jne 124c <func0+0x83> mov %rsp,%rdi callq 1090 <regfree@plt> lea 0xdba(%rip),%rax jmp 1206 <func0+0x3d> mov %rsp,%rdi callq 1090 <regfree@plt> lea 0xdb8(%rip),%rax jmp 1206 <func0+0x3d> callq 10a0 <__stack_chk_fail@plt>
func0: endbr64 push rbx sub rsp, 50h mov rbx, rdi mov rax, fs:28h mov [rsp+58h+var_10], rax xor eax, eax mov rdi, rsp mov edx, 1 lea rsi, aWS; "\\w+\\S*$" call _regcomp mov edx, eax lea rax, aRegexCompilati; "Regex compilation failed" test edx, edx jz short loc_123C loc_1226: mov rdx, [rsp+58h+var_10] sub rdx, fs:28h jnz short loc_127D add rsp, 50h pop rbx retn loc_123C: lea rcx, [rsp+58h+var_18] mov rdi, rsp mov r8d, 0 mov edx, 1 mov rsi, rbx call _regexec test eax, eax jnz short loc_126C mov rdi, rsp call _regfree lea rax, aFoundAMatch; "Found a match!" jmp short loc_1226 loc_126C: mov rdi, rsp call _regfree lea rax, aNotMatched; "Not matched!" jmp short loc_1226 loc_127D: call ___stack_chk_fail
const char * func0(long long a1) { int v1; // edx const char *result; // rax _BYTE v3[64]; // [rsp+0h] [rbp-58h] BYREF _BYTE v4[8]; // [rsp+40h] [rbp-18h] BYREF unsigned long long v5; // [rsp+48h] [rbp-10h] v5 = __readfsqword(0x28u); v1 = regcomp(v3, "\\w+\\S*$", 1LL); result = "Regex compilation failed"; if ( !v1 ) { if ( (unsigned int)regexec(v3, a1, 1LL, v4, 0LL) ) { regfree(v3); return "Not matched!"; } else { regfree(v3); return "Found a match!"; } } return result; }
func0: ENDBR64 PUSH RBX SUB RSP,0x50 MOV RBX,RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV RDI,RSP MOV EDX,0x1 LEA RSI,[0x102039] CALL 0x001010d0 MOV EDX,EAX LEA RAX,[0x102020] TEST EDX,EDX JZ 0x0010123c LAB_00101226: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x0010127d ADD RSP,0x50 POP RBX RET LAB_0010123c: LEA RCX,[RSP + 0x40] MOV RDI,RSP MOV R8D,0x0 MOV EDX,0x1 MOV RSI,RBX CALL 0x001010f0 TEST EAX,EAX JNZ 0x0010126c MOV RDI,RSP CALL 0x001010a0 LEA RAX,[0x102004] JMP 0x00101226 LAB_0010126c: MOV RDI,RSP CALL 0x001010a0 LEA RAX,[0x102013] JMP 0x00101226 LAB_0010127d: CALL 0x001010b0
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_58; regmatch_t local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_58,"\\w+\\S*$",1); pcVar2 = "Regex compilation failed"; if (iVar1 == 0) { iVar1 = regexec(&rStack_58,param_1,1,&local_18,0); if (iVar1 == 0) { regfree(&rStack_58); pcVar2 = "Found a match!"; } else { regfree(&rStack_58); pcVar2 = "Not matched!"; } } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,242
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <regex.h>
char* func0(const char* text) { regex_t regex; char *patterns = "\\w+\\S*$"; if (regcomp(&regex, patterns, REG_EXTENDED) == 0) { regmatch_t matches[1]; if (regexec(&regex, text, 1, matches, 0) == 0) { regfree(&regex); return "Found a match!"; } else { regfree(&regex); return "Not matched!"; } } return "Regex compilation failed"; }
int main() { assert(strcmp(func0("python."), "Found a match!") == 0); assert(strcmp(func0("python."), "Found a match!") == 0); assert(strcmp(func0(" lang ."), "Not matched!") == 0); return 0; }
O2
c
func0: endbr64 push %r12 mov $0x1,%edx lea 0xd77(%rip),%rsi push %rbp mov %rdi,%rbp sub $0x58,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov %rsp,%r12 mov %r12,%rdi callq 10c0 <regcomp@plt> mov %eax,%r8d lea 0xd31(%rip),%rax test %r8d,%r8d je 1310 <func0+0x60> mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 134e <func0+0x9e> add $0x58,%rsp pop %rbp pop %r12 retq nopl 0x0(%rax) mov %r12,%rdi lea 0x40(%rsp),%rcx mov $0x1,%edx mov %rbp,%rsi callq 10d0 <regexec@plt> mov %r12,%rdi test %eax,%eax jne 1340 <func0+0x90> callq 1090 <regfree@plt> lea 0xccc(%rip),%rax jmp 12f4 <func0+0x44> nopw 0x0(%rax,%rax,1) callq 1090 <regfree@plt> lea 0xcc7(%rip),%rax jmp 12f4 <func0+0x44> callq 10a0 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 push r12 mov edx, 1 mov r12, rdi lea rsi, aWS; "\\w+\\S*$" push rbp sub rsp, 58h mov rax, fs:28h mov [rsp+var_s48], rax xor eax, eax mov rbp, rsp mov rdi, rbp call _regcomp mov r8d, eax lea rax, aRegexCompilati; "Regex compilation failed" test r8d, r8d jz short loc_1320 loc_1304: mov rdx, [rsp+var_s48] sub rdx, fs:28h jnz short loc_135E add rsp, 58h pop rbp pop r12 retn loc_1320: mov rdi, rbp lea rcx, [rsp+var_s40] mov edx, 1 mov rsi, r12 call _regexec mov rdi, rbp test eax, eax jnz short loc_1350 call _regfree lea rax, aFoundAMatch; "Found a match!" jmp short loc_1304 loc_1350: call _regfree lea rax, aNotMatched; "Not matched!" jmp short loc_1304 loc_135E: call ___stack_chk_fail
const char * func0(long long a1) { int v1; // r8d const char *result; // rax _BYTE _0[64]; // [rsp+0h] [rbp+0h] BYREF char vars40; // [rsp+40h] [rbp+40h] BYREF unsigned long long vars48; // [rsp+48h] [rbp+48h] vars48 = __readfsqword(0x28u); v1 = regcomp(_0, "\\w+\\S*$", 1LL); result = "Regex compilation failed"; if ( !v1 ) { if ( (unsigned int)regexec(_0, a1, 1LL, &vars40) ) { regfree(_0); return "Not matched!"; } else { regfree(_0); return "Found a match!"; } } return result; }
func0: ENDBR64 PUSH R12 MOV EDX,0x1 MOV R12,RDI LEA RSI,[0x102039] PUSH RBP SUB RSP,0x58 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV RBP,RSP MOV RDI,RBP CALL 0x001010d0 MOV R8D,EAX LEA RAX,[0x102020] TEST R8D,R8D JZ 0x00101320 LAB_00101304: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x0010135e ADD RSP,0x58 POP RBP POP R12 RET LAB_00101320: MOV RDI,RBP LEA RCX,[RSP + 0x40] MOV EDX,0x1 MOV RSI,R12 CALL 0x001010f0 MOV RDI,RBP TEST EAX,EAX JNZ 0x00101350 CALL 0x001010a0 LEA RAX,[0x102004] JMP 0x00101304 LAB_00101350: CALL 0x001010a0 LEA RAX,[0x102013] JMP 0x00101304 LAB_0010135e: CALL 0x001010b0
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_68; regmatch_t local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"\\w+\\S*$",1); pcVar2 = "Regex compilation failed"; if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,1,&local_28,0); if (iVar1 == 0) { regfree(&rStack_68); pcVar2 = "Found a match!"; } else { regfree(&rStack_68); pcVar2 = "Not matched!"; } } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,243
func0
#include <stdio.h> #include <assert.h> #include <string.h> #include <regex.h>
char* func0(const char* text) { regex_t regex; char *patterns = "\\w+\\S*$"; if (regcomp(&regex, patterns, REG_EXTENDED) == 0) { regmatch_t matches[1]; if (regexec(&regex, text, 1, matches, 0) == 0) { regfree(&regex); return "Found a match!"; } else { regfree(&regex); return "Not matched!"; } } return "Regex compilation failed"; }
int main() { assert(strcmp(func0("python."), "Found a match!") == 0); assert(strcmp(func0("python."), "Found a match!") == 0); assert(strcmp(func0(" lang ."), "Not matched!") == 0); return 0; }
O3
c
func0: endbr64 push %r12 mov $0x1,%edx lea 0xd77(%rip),%rsi push %rbp mov %rdi,%rbp sub $0x58,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov %rsp,%r12 mov %r12,%rdi callq 10c0 <regcomp@plt> mov %eax,%r8d lea 0xd31(%rip),%rax test %r8d,%r8d je 1310 <func0+0x60> mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 134e <func0+0x9e> add $0x58,%rsp pop %rbp pop %r12 retq nopl 0x0(%rax) mov %r12,%rdi lea 0x40(%rsp),%rcx mov $0x1,%edx mov %rbp,%rsi callq 10d0 <regexec@plt> mov %r12,%rdi test %eax,%eax jne 1340 <func0+0x90> callq 1090 <regfree@plt> lea 0xccc(%rip),%rax jmp 12f4 <func0+0x44> nopw 0x0(%rax,%rax,1) callq 1090 <regfree@plt> lea 0xcc7(%rip),%rax jmp 12f4 <func0+0x44> callq 10a0 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 push rbp mov edx, 1; cflags mov rbp, rdi lea rsi, pattern; "\\w+\\S*$" push rbx sub rsp, 58h mov rax, fs:28h mov [rsp+68h+var_20], rax xor eax, eax mov rbx, rsp mov rdi, rbx; preg call _regcomp mov edx, eax lea rax, aRegexCompilati; "Regex compilation failed" test edx, edx jz short loc_1320 loc_1301: mov rdx, [rsp+68h+var_20] sub rdx, fs:28h jnz short loc_135E add rsp, 58h pop rbx pop rbp retn loc_1320: mov rdi, rbx; preg lea rcx, [rsp+68h+pmatch]; pmatch xor r8d, r8d; eflags mov edx, 1; nmatch mov rsi, rbp; string call _regexec mov rdi, rbx; preg test eax, eax jnz short loc_1350 call _regfree lea rax, s2; "Found a match!" jmp short loc_1301 loc_1350: call _regfree lea rax, aNotMatched; "Not matched!" jmp short loc_1301 loc_135E: call ___stack_chk_fail
const char * func0(char *string) { int v1; // edx const char *result; // rax regex_t v3; // [rsp+0h] [rbp-68h] BYREF regmatch_t pmatch; // [rsp+40h] [rbp-28h] BYREF unsigned long long v5; // [rsp+48h] [rbp-20h] v5 = __readfsqword(0x28u); v1 = regcomp(&v3, "\\w+\\S*$", 1); result = "Regex compilation failed"; if ( !v1 ) { if ( regexec(&v3, string, 1uLL, &pmatch, 0) ) { regfree(&v3); return "Not matched!"; } else { regfree(&v3); return "Found a match!"; } } return result; }
func0: ENDBR64 PUSH RBP MOV EDX,0x1 MOV RBP,RDI LEA RSI,[0x102039] PUSH RBX SUB RSP,0x58 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV RBX,RSP MOV RDI,RBX CALL 0x001010d0 MOV EDX,EAX LEA RAX,[0x102020] TEST EDX,EDX JZ 0x00101320 LAB_00101301: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x0010135e ADD RSP,0x58 POP RBX POP RBP RET LAB_00101320: MOV RDI,RBX LEA RCX,[RSP + 0x40] XOR R8D,R8D MOV EDX,0x1 MOV RSI,RBP CALL 0x001010f0 MOV RDI,RBX TEST EAX,EAX JNZ 0x00101350 CALL 0x001010a0 LEA RAX,[0x102004] JMP 0x00101301 LAB_00101350: CALL 0x001010a0 LEA RAX,[0x102013] JMP 0x00101301 LAB_0010135e: CALL 0x001010b0
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_68; regmatch_t local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"\\w+\\S*$",1); pcVar2 = "Regex compilation failed"; if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,1,&local_28,0); if (iVar1 == 0) { regfree(&rStack_68); pcVar2 = "Found a match!"; } else { regfree(&rStack_68); pcVar2 = "Not matched!"; } } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
5,244
func0
#include <stdio.h> #include <assert.h> #include <string.h> int check_Equality(char* s, int start, int end) { return (s[start] == s[end]); }
int func0(char* s) { int result = 0; int n = strlen(s); for (int i = 0; i < n; i++) { for (int j = 1; j <= n - i; j++) { if (check_Equality(s, i, i + j - 1)) { result++; } } } return result; }
int main() { assert(func0("aba") == 4); assert(func0("abcab") == 7); assert(func0("abc") == 3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) movl $0x0,-0x10(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 1060 <strlen@plt> mov %eax,-0x4(%rbp) movl $0x0,-0xc(%rbp) jmp 1214 <func0+0x6f> movl $0x1,-0x8(%rbp) jmp 1205 <func0+0x60> mov -0xc(%rbp),%edx mov -0x8(%rbp),%eax add %edx,%eax lea -0x1(%rax),%edx mov -0xc(%rbp),%ecx mov -0x18(%rbp),%rax mov %ecx,%esi mov %rax,%rdi callq 1169 <check_Equality> test %eax,%eax je 1201 <func0+0x5c> addl $0x1,-0x10(%rbp) addl $0x1,-0x8(%rbp) mov -0x4(%rbp),%eax sub -0xc(%rbp),%eax cmp %eax,-0x8(%rbp) jle 11dd <func0+0x38> addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x4(%rbp),%eax jl 11d4 <func0+0x2f> mov -0x10(%rbp),%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+s], rdi mov [rbp+var_10], 0 mov rax, [rbp+s] mov rdi, rax; s call _strlen mov [rbp+var_4], eax mov [rbp+var_C], 0 jmp short loc_1214 loc_11D4: mov [rbp+var_8], 1 jmp short loc_1205 loc_11DD: mov edx, [rbp+var_C] mov eax, [rbp+var_8] add eax, edx lea edx, [rax-1] mov ecx, [rbp+var_C] mov rax, [rbp+s] mov esi, ecx mov rdi, rax call check_Equality test eax, eax jz short loc_1201 add [rbp+var_10], 1 loc_1201: add [rbp+var_8], 1 loc_1205: mov eax, [rbp+var_4] sub eax, [rbp+var_C] cmp [rbp+var_8], eax jle short loc_11DD add [rbp+var_C], 1 loc_1214: mov eax, [rbp+var_C] cmp eax, [rbp+var_4] jl short loc_11D4 mov eax, [rbp+var_10] leave retn
long long func0(const char *a1) { unsigned int v2; // [rsp+10h] [rbp-10h] unsigned int i; // [rsp+14h] [rbp-Ch] int j; // [rsp+18h] [rbp-8h] int v5; // [rsp+1Ch] [rbp-4h] v2 = 0; v5 = strlen(a1); for ( i = 0; (int)i < v5; ++i ) { for ( j = 1; j <= (int)(v5 - i); ++j ) { if ( (unsigned int)check_Equality(a1, i, i + j - 1) ) ++v2; } } return v2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x10],0x0 MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101060 MOV dword ptr [RBP + -0x4],EAX MOV dword ptr [RBP + -0xc],0x0 JMP 0x00101214 LAB_001011d4: MOV dword ptr [RBP + -0x8],0x1 JMP 0x00101205 LAB_001011dd: MOV EDX,dword ptr [RBP + -0xc] MOV EAX,dword ptr [RBP + -0x8] ADD EAX,EDX LEA EDX,[RAX + -0x1] MOV ECX,dword ptr [RBP + -0xc] MOV RAX,qword ptr [RBP + -0x18] MOV ESI,ECX MOV RDI,RAX CALL 0x00101169 TEST EAX,EAX JZ 0x00101201 ADD dword ptr [RBP + -0x10],0x1 LAB_00101201: ADD dword ptr [RBP + -0x8],0x1 LAB_00101205: MOV EAX,dword ptr [RBP + -0x4] SUB EAX,dword ptr [RBP + -0xc] CMP dword ptr [RBP + -0x8],EAX JLE 0x001011dd ADD dword ptr [RBP + -0xc],0x1 LAB_00101214: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x4] JL 0x001011d4 MOV EAX,dword ptr [RBP + -0x10] LEAVE RET
int func0(char *param_1) { int iVar1; size_t sVar2; int4 local_18; int4 local_14; int4 local_10; local_18 = 0; sVar2 = strlen(param_1); for (local_14 = 0; local_14 < (int)sVar2; local_14 = local_14 + 1) { for (local_10 = 1; local_10 <= (int)sVar2 - local_14; local_10 = local_10 + 1) { iVar1 = check_Equality(param_1,local_14,local_10 + local_14 + -1); if (iVar1 != 0) { local_18 = local_18 + 1; } } } return local_18; }
5,245
func0
#include <stdio.h> #include <assert.h> #include <string.h> int check_Equality(char* s, int start, int end) { return (s[start] == s[end]); }
int func0(char* s) { int result = 0; int n = strlen(s); for (int i = 0; i < n; i++) { for (int j = 1; j <= n - i; j++) { if (check_Equality(s, i, i + j - 1)) { result++; } } } return result; }
int main() { assert(func0("aba") == 4); assert(func0("abcab") == 7); assert(func0("abc") == 3); return 0; }
O1
c
func0: endbr64 mov %rdi,%rdx mov $0xffffffffffffffff,%rcx mov $0x0,%eax repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rax),%r10 test %r10d,%r10d jle 11db <func0+0x7a> push %rbx mov %r10d,%r11d mov %rdx,%rdi mov $0x0,%r9d mov $0x0,%edx lea -0x1(%r10),%ebx jmp 11cf <func0+0x6e> movzbl (%rdi),%r8d mov %ebx,%eax sub %r9d,%eax lea 0x1(%rdi,%rax,1),%rsi mov %rdi,%rax cmp (%rax),%r8b sete %cl movzbl %cl,%ecx add %ecx,%edx add $0x1,%rax cmp %rsi,%rax jne 11ae <func0+0x4d> add $0x1,%r9d add $0x1,%rdi cmp %r9d,%r11d je 11e3 <func0+0x82> mov %r10d,%eax sub %r9d,%eax test %eax,%eax jg 119d <func0+0x3c> jmp 11c2 <func0+0x61> mov $0x0,%edx mov %edx,%eax retq mov %edx,%eax pop %rbx retq
func0: endbr64 push rbx mov rbx, rdi call _strlen test eax, eax jle short loc_11EA mov r10, rax mov r11d, eax mov rdi, rbx mov r9d, 0 mov eax, 0 lea ebx, [r10-1] jmp short loc_11DE loc_11AC: movzx r8d, byte ptr [rdi] mov edx, ebx sub edx, r9d lea rsi, [rdi+rdx+1] mov rdx, rdi loc_11BD: cmp r8b, [rdx] setz cl movzx ecx, cl add eax, ecx add rdx, 1 cmp rdx, rsi jnz short loc_11BD loc_11D1: add r9d, 1 add rdi, 1 cmp r11d, r9d jz short loc_11EF loc_11DE: mov edx, r10d sub edx, r9d test edx, edx jg short loc_11AC jmp short loc_11D1 loc_11EA: mov eax, 0 loc_11EF: pop rbx retn
long long func0(_BYTE *a1) { int v1; // eax int v2; // r10d int v3; // r11d int v4; // r9d long long result; // rax _BYTE *v6; // rdx v1 = strlen(); if ( v1 <= 0 ) return 0LL; v2 = v1; v3 = v1; v4 = 0; result = 0LL; do { if ( v2 - v4 > 0 ) { v6 = a1; do result = (*a1 == *v6++) + (unsigned int)result; while ( v6 != &a1[v2 - 1 - v4 + 1] ); } ++v4; ++a1; } while ( v3 != v4 ); return result; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101060 TEST EAX,EAX JLE 0x001011ea MOV R10,RAX MOV R11D,EAX MOV RDI,RBX MOV R9D,0x0 MOV EAX,0x0 LEA EBX,[R10 + -0x1] JMP 0x001011de LAB_001011ac: MOVZX R8D,byte ptr [RDI] MOV EDX,EBX SUB EDX,R9D LEA RSI,[RDI + RDX*0x1 + 0x1] MOV RDX,RDI LAB_001011bd: CMP R8B,byte ptr [RDX] SETZ CL MOVZX ECX,CL ADD EAX,ECX ADD RDX,0x1 CMP RDX,RSI JNZ 0x001011bd LAB_001011d1: ADD R9D,0x1 ADD RDI,0x1 CMP R11D,R9D JZ 0x001011ef LAB_001011de: MOV EDX,R10D SUB EDX,R9D TEST EDX,EDX JG 0x001011ac JMP 0x001011d1 LAB_001011ea: MOV EAX,0x0 LAB_001011ef: POP RBX RET
int func0(char *param_1) { int iVar1; int iVar2; size_t sVar3; char *pcVar4; int iVar5; sVar3 = strlen(param_1); iVar1 = (int)sVar3; if (iVar1 < 1) { iVar2 = 0; } else { iVar5 = 0; iVar2 = 0; do { if (0 < iVar1 - iVar5) { pcVar4 = param_1; do { iVar2 = iVar2 + (uint)(*param_1 == *pcVar4); pcVar4 = pcVar4 + 1; } while (pcVar4 != param_1 + (ulong)(uint)((iVar1 + -1) - iVar5) + 1); } iVar5 = iVar5 + 1; param_1 = param_1 + 1; } while (iVar1 != iVar5); } return iVar2; }
5,246
func0
#include <stdio.h> #include <assert.h> #include <string.h> int check_Equality(char* s, int start, int end) { return (s[start] == s[end]); }
int func0(char* s) { int result = 0; int n = strlen(s); for (int i = 0; i < n; i++) { for (int j = 1; j <= n - i; j++) { if (check_Equality(s, i, i + j - 1)) { result++; } } } return result; }
int main() { assert(func0("aba") == 4); assert(func0("abcab") == 7); assert(func0("abc") == 3); return 0; }
O2
c
func0: endbr64 push %rbx mov %rdi,%rbx callq 1060 <strlen@plt> test %eax,%eax jle 1292 <func0+0x62> mov %eax,%r10d mov %rbx,%rdi xor %r9d,%r9d xor %r8d,%r8d lea -0x1(%rax),%r11d nopl 0x0(%rax) mov %r11d,%ecx movzbl (%rdi),%esi mov %rdi,%rax add $0x1,%rdi sub %r9d,%ecx add %rdi,%rcx nopl 0x0(%rax,%rax,1) xor %edx,%edx cmp (%rax),%sil sete %dl add $0x1,%rax add %edx,%r8d cmp %rax,%rcx jne 1270 <func0+0x40> add $0x1,%r9d cmp %r9d,%r10d jne 1258 <func0+0x28> mov %r8d,%eax pop %rbx retq xor %r8d,%r8d pop %rbx mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 push rbx mov rbx, rdi call _strlen test eax, eax jle short loc_1292 mov r10d, eax mov rdi, rbx xor r9d, r9d xor r8d, r8d lea r11d, [rax-1] nop dword ptr [rax+00000000h] loc_1258: mov ecx, r11d movzx esi, byte ptr [rdi] mov rax, rdi add rdi, 1 sub ecx, r9d add rcx, rdi nop dword ptr [rax+rax+00h] loc_1270: xor edx, edx cmp sil, [rax] setz dl add rax, 1 add r8d, edx cmp rcx, rax jnz short loc_1270 add r9d, 1 cmp r10d, r9d jnz short loc_1258 mov eax, r8d pop rbx retn loc_1292: xor r8d, r8d pop rbx mov eax, r8d retn
long long func0(char *a1) { int v1; // eax int v2; // r10d int v3; // r9d unsigned int v4; // r8d int v5; // r11d char v6; // si char *v7; // rax int v8; // edx v1 = strlen(); if ( v1 <= 0 ) return 0LL; v2 = v1; v3 = 0; v4 = 0; v5 = v1 - 1; do { v6 = *a1; v7 = a1++; do { v8 = v6 == *v7++; v4 += v8; } while ( &a1[v5 - v3] != v7 ); ++v3; } while ( v2 != v3 ); return v4; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101060 TEST EAX,EAX JLE 0x00101292 MOV R10D,EAX MOV RDI,RBX XOR R9D,R9D XOR R8D,R8D LEA R11D,[RAX + -0x1] NOP dword ptr [RAX] LAB_00101258: MOV ECX,R11D MOVZX ESI,byte ptr [RDI] MOV RAX,RDI ADD RDI,0x1 SUB ECX,R9D ADD RCX,RDI NOP dword ptr [RAX + RAX*0x1] LAB_00101270: XOR EDX,EDX CMP SIL,byte ptr [RAX] SETZ DL ADD RAX,0x1 ADD R8D,EDX CMP RCX,RAX JNZ 0x00101270 ADD R9D,0x1 CMP R10D,R9D JNZ 0x00101258 MOV EAX,R8D POP RBX RET LAB_00101292: XOR R8D,R8D POP RBX MOV EAX,R8D RET
int func0(char *param_1) { char cVar1; char cVar2; int iVar3; size_t sVar4; char *pcVar5; int iVar6; int iVar7; sVar4 = strlen(param_1); iVar3 = (int)sVar4; if (0 < iVar3) { iVar7 = 0; iVar6 = 0; do { cVar2 = *param_1; pcVar5 = param_1 + 1; do { cVar1 = *param_1; param_1 = param_1 + 1; iVar6 = iVar6 + (uint)(cVar2 == cVar1); } while (pcVar5 + (uint)((iVar3 + -1) - iVar7) != param_1); iVar7 = iVar7 + 1; param_1 = pcVar5; } while (iVar3 != iVar7); return iVar6; } return 0; }
5,247
func0
#include <stdio.h> #include <assert.h> #include <string.h> int check_Equality(char* s, int start, int end) { return (s[start] == s[end]); }
int func0(char* s) { int result = 0; int n = strlen(s); for (int i = 0; i < n; i++) { for (int j = 1; j <= n - i; j++) { if (check_Equality(s, i, i + j - 1)) { result++; } } } return result; }
int main() { assert(func0("aba") == 4); assert(func0("abcab") == 7); assert(func0("abc") == 3); return 0; }
O3
c
func0: endbr64 push %rbp push %rbx mov %rdi,%rbx sub $0x8,%rsp callq 1060 <strlen@plt> test %eax,%eax jle 152a <func0+0x2fa> movdqa 0xe4e(%rip),%xmm5 mov %rax,%rdx mov %eax,%r11d mov %eax,%ebp mov %rbx,%rdi xor %esi,%esi pxor %xmm4,%xmm4 xor %r8d,%r8d pxor %xmm3,%xmm3 nopw 0x0(%rax,%rax,1) lea -0x1(%rdx),%r10d movzbl (%rdi),%r9d cmp $0xe,%r10d jbe 1520 <func0+0x2f0> movd %r9d,%xmm7 mov %edx,%ecx pxor %xmm1,%xmm1 mov %rdi,%rax punpcklbw %xmm7,%xmm7 shr $0x4,%ecx punpcklwd %xmm7,%xmm7 shl $0x4,%rcx pshufd $0x0,%xmm7,%xmm7 add %rdi,%rcx nopw 0x0(%rax,%rax,1) movdqu (%rax),%xmm0 movdqa %xmm4,%xmm6 add $0x10,%rax pcmpeqb %xmm7,%xmm0 pand %xmm5,%xmm0 pcmpgtb %xmm0,%xmm6 movdqa %xmm0,%xmm2 punpcklbw %xmm6,%xmm2 punpckhbw %xmm6,%xmm0 movdqa %xmm3,%xmm6 pcmpgtw %xmm2,%xmm6 movdqa %xmm2,%xmm8 punpcklwd %xmm6,%xmm8 punpckhwd %xmm6,%xmm2 movdqa %xmm0,%xmm6 paddd %xmm8,%xmm1 paddd %xmm2,%xmm1 movdqa %xmm3,%xmm2 pcmpgtw %xmm0,%xmm2 punpcklwd %xmm2,%xmm6 punpckhwd %xmm2,%xmm0 paddd %xmm6,%xmm1 paddd %xmm0,%xmm1 cmp %rax,%rcx jne 12b0 <func0+0x80> movdqa %xmm1,%xmm0 mov %edx,%ecx psrldq $0x8,%xmm0 and $0xfffffff0,%ecx paddd %xmm1,%xmm0 movdqa %xmm0,%xmm1 psrldq $0x4,%xmm1 paddd %xmm1,%xmm0 movd %xmm0,%eax add %eax,%r8d lea 0x1(%rcx),%eax cmp %ecx,%edx je 1500 <func0+0x2d0> lea -0x1(%rsi,%rax,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0x1(%rax),%ecx cmp %edx,%ecx jg 1500 <func0+0x2d0> lea -0x1(%rsi,%rcx,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0x2(%rax),%ecx cmp %edx,%ecx jg 1500 <func0+0x2d0> lea -0x1(%rsi,%rcx,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0x3(%rax),%ecx cmp %edx,%ecx jg 1500 <func0+0x2d0> lea -0x1(%rsi,%rcx,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0x4(%rax),%ecx cmp %edx,%ecx jg 1500 <func0+0x2d0> lea -0x1(%rcx,%rsi,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0x5(%rax),%ecx cmp %edx,%ecx jg 1500 <func0+0x2d0> lea -0x1(%rsi,%rcx,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0x6(%rax),%ecx cmp %edx,%ecx jg 1500 <func0+0x2d0> lea -0x1(%rsi,%rcx,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0x7(%rax),%ecx cmp %ecx,%edx jl 1500 <func0+0x2d0> lea -0x1(%rsi,%rcx,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0x8(%rax),%ecx cmp %ecx,%edx jl 1500 <func0+0x2d0> lea -0x1(%rsi,%rcx,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0x9(%rax),%ecx cmp %ecx,%edx jl 1500 <func0+0x2d0> lea -0x1(%rsi,%rcx,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0xa(%rax),%ecx cmp %ecx,%edx jl 1500 <func0+0x2d0> lea -0x1(%rsi,%rcx,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0xb(%rax),%ecx cmp %ecx,%edx jl 1500 <func0+0x2d0> lea -0x1(%rsi,%rcx,1),%ecx movslq %ecx,%rcx cmp (%rbx,%rcx,1),%r9b sete %cl movzbl %cl,%ecx add %ecx,%r8d lea 0xc(%rax),%ecx cmp %ecx,%edx jl 1500 <func0+0x2d0> lea -0x1(%rsi,%rcx,1),%edx mov %ebp,%ecx movslq %edx,%rdx cmp (%rbx,%rdx,1),%r9b sete %dl sub %esi,%ecx movzbl %dl,%edx add %edx,%r8d lea 0xd(%rax),%edx cmp %ecx,%edx jg 1500 <func0+0x2d0> lea -0x1(%rsi,%rdx,1),%edx movslq %edx,%rdx cmp (%rbx,%rdx,1),%r9b sete %dl add $0xe,%eax movzbl %dl,%edx add %edx,%r8d cmp %eax,%ecx jl 1500 <func0+0x2d0> lea -0x1(%rsi,%rax,1),%eax cltq cmp (%rbx,%rax,1),%r9b sete %al movzbl %al,%eax add %eax,%r8d xchg %ax,%ax add $0x1,%esi add $0x1,%rdi mov %r10d,%edx cmp %esi,%r11d jne 1270 <func0+0x40> add $0x8,%rsp mov %r8d,%eax pop %rbx pop %rbp retq nopl (%rax) mov $0x1,%eax jmpq 1345 <func0+0x115> add $0x8,%rsp xor %r8d,%r8d mov %r8d,%eax pop %rbx pop %rbp retq nopw 0x0(%rax,%rax,1)
func0: endbr64 push r14 push r13 push r12 push rbp push rbx mov rbx, rdi call _strlen test eax, eax jle loc_151D mov rcx, rax mov r10, rbx xor r11d, r11d xor edi, edi pxor xmm6, xmm6 pxor xmm5, xmm5 pxor xmm4, xmm4 pxor xmm3, xmm3 nop word ptr [rax+rax+00000000h] loc_1270: lea r8d, [rcx-1] movzx edx, byte ptr [r10] mov esi, r11d cmp r8d, 0Eh jbe loc_14E0 movd xmm8, edx mov r9d, ecx pxor xmm1, xmm1 mov rax, r10 punpcklbw xmm8, xmm8 shr r9d, 4 punpcklwd xmm8, xmm8 shl r9, 4 pshufd xmm8, xmm8, 0 add r9, r10 nop loc_12B0: movdqu xmm0, xmmword ptr [rax] movdqa xmm7, xmm4 add rax, 10h pcmpeqb xmm0, xmm8 pcmpgtb xmm7, xmm0 movdqa xmm2, xmm0 punpcklbw xmm2, xmm7 punpckhbw xmm0, xmm7 movdqa xmm7, xmm3 pcmpgtw xmm7, xmm2 movdqa xmm9, xmm2 punpcklwd xmm9, xmm7 punpckhwd xmm2, xmm7 movdqa xmm7, xmm0 psubd xmm1, xmm9 psubd xmm1, xmm2 movdqa xmm2, xmm3 pcmpgtw xmm2, xmm0 punpcklwd xmm7, xmm2 punpckhwd xmm0, xmm2 psubd xmm1, xmm7 psubd xmm1, xmm0 cmp r9, rax jnz short loc_12B0 movdqa xmm0, xmm1 mov ebp, ecx psrldq xmm0, 8 and ebp, 0FFFFFFF0h paddd xmm0, xmm1 lea r14d, [rbp+1] movdqa xmm2, xmm0 psrldq xmm2, 4 paddd xmm0, xmm2 movd eax, xmm0 movdqa xmm0, xmm1 psrldq xmm1, 8 paddd xmm0, xmm1 lea r12d, [rax+rdi] test cl, 0Fh jz loc_1510 mov r9d, ecx sub r9d, ebp lea r13d, [r9-1] cmp r13d, 6 jbe loc_1508 loc_1366: lea r12, [rbx+r11] movdqa xmm7, xmm6 movq xmm2, qword ptr [r12+rbp] movzx ebp, dl mov eax, ebp mov ah, al mov ebp, eax movd xmm1, ebp pshuflw xmm1, xmm1, 0 pcmpeqb xmm2, xmm1 pcmpgtb xmm7, xmm2 movdqa xmm1, xmm2 punpcklbw xmm1, xmm7 punpcklbw xmm2, xmm7 movdqa xmm7, xmm5 pcmpgtw xmm7, xmm1 movdqa xmm8, xmm1 pshufd xmm2, xmm2, 4Eh ; 'N' punpcklwd xmm8, xmm7 punpcklwd xmm1, xmm7 movdqa xmm7, xmm2 psubd xmm0, xmm8 pshufd xmm1, xmm1, 4Eh ; 'N' psubd xmm0, xmm1 movdqa xmm1, xmm5 pcmpgtw xmm1, xmm2 punpcklwd xmm7, xmm1 punpcklwd xmm2, xmm1 psubd xmm0, xmm7 pshufd xmm2, xmm2, 4Eh ; 'N' psubd xmm0, xmm2 movd r12d, xmm0 pshufd xmm1, xmm0, 0E5h movd ebp, xmm1 add ebp, r12d add edi, ebp mov ebp, r9d and ebp, 0FFFFFFF8h add r14d, ebp and r9d, 7 jz loc_14D0 loc_140A: lea r9d, [rsi+r14-1] movsxd r9, r9d cmp dl, [rbx+r9] jnz short loc_141B add edi, 1 loc_141B: lea r9d, [r14+1] cmp r9d, ecx jg loc_14D0 lea r9d, [rsi+r9-1] movsxd r9, r9d cmp dl, [rbx+r9] jnz short loc_1439 add edi, 1 loc_1439: lea r9d, [r14+2] cmp ecx, r9d jl short loc_14C0 lea r9d, [rsi+r9-1] movsxd r9, r9d cmp dl, [rbx+r9] jnz short loc_1453 add edi, 1 loc_1453: lea r9d, [r14+3] cmp ecx, r9d jl short loc_14C0 lea r9d, [rsi+r9-1] movsxd r9, r9d cmp dl, [rbx+r9] jnz short loc_146D add edi, 1 loc_146D: lea r9d, [r14+4] cmp r9d, ecx jg short loc_14C0 lea r9d, [rsi+r9-1] movsxd r9, r9d cmp dl, [rbx+r9] jnz short loc_1487 add edi, 1 loc_1487: lea r9d, [r14+5] cmp r9d, ecx jg short loc_14C0 lea r9d, [rsi+r9-1] movsxd r9, r9d cmp dl, [rbx+r9] jnz short loc_14A1 add edi, 1 loc_14A1: lea eax, [r14+6] cmp eax, ecx jg short loc_14C0 lea eax, [rsi+rax-1] cdqe cmp dl, [rbx+rax] jnz short loc_14C0 add edi, 1 nop word ptr [rax+rax+00000000h] loc_14C0: add r11, 1 add r10, 1 loc_14C8: mov ecx, r8d jmp loc_1270 loc_14D0: test r8d, r8d jnz short loc_14C0 pop rbx mov eax, edi pop rbp pop r12 pop r13 pop r14 retn loc_14E0: xor ebp, ebp mov r9d, ecx mov r12d, edi mov r14d, 1 sub r9d, ebp pxor xmm0, xmm0 lea r13d, [r9-1] cmp r13d, 6 ja loc_1366 nop dword ptr [rax+rax+00h] loc_1508: mov edi, r12d jmp loc_140A loc_1510: add r11, 1 add r10, 1 mov edi, r12d jmp short loc_14C8 loc_151D: xor edi, edi pop rbx pop rbp mov eax, edi pop r12 pop r13 pop r14 retn
long long func0(const char *a1) { int v2; // eax int v3; // ecx const __m128i *v4; // r10 long long v5; // r11 unsigned int v6; // edi unsigned int v7; // edx __m128i v8; // xmm8 __m128i v9; // xmm1 const __m128i *v10; // rax __m128i v11; // xmm8 __m128i v12; // xmm8 __m128i v13; // xmm0 __m128i v14; // xmm0 __m128i v15; // xmm7 __m128i v16; // xmm2 __m128i v17; // xmm0 __m128i v18; // xmm7 __m128i v19; // xmm1 __m128i v20; // xmm2 long long v21; // rbp __m128i v22; // xmm0 int v23; // r14d int v24; // eax __m128i v25; // xmm0 unsigned int v26; // r12d int v27; // r9d unsigned int v28; // eax __m128i v29; // xmm2 __m128i v30; // xmm1 __m128i v31; // xmm2 __m128i v32; // xmm1 __m128i v33; // xmm2 __m128i v34; // xmm0 v2 = strlen(a1); if ( v2 > 0 ) { v3 = v2; v4 = (const __m128i *)a1; v5 = 0LL; v6 = 0; while ( 1 ) { v7 = v4->m128i_u8[0]; if ( (unsigned int)(v3 - 1) <= 0xE ) break; v8 = _mm_cvtsi32_si128(v7); v9 = 0LL; v10 = v4; v11 = _mm_unpacklo_epi8(v8, v8); v12 = _mm_shuffle_epi32(_mm_unpacklo_epi16(v11, v11), 0); do { v13 = _mm_loadu_si128(v10++); v14 = _mm_cmpeq_epi8(v13, v12); v15 = _mm_cmpgt_epi8((__m128i)0LL, v14); v16 = _mm_unpacklo_epi8(v14, v15); v17 = _mm_unpackhi_epi8(v14, v15); v18 = _mm_cmpgt_epi16((__m128i)0LL, v16); v19 = _mm_sub_epi32(_mm_sub_epi32(v9, _mm_unpacklo_epi16(v16, v18)), _mm_unpackhi_epi16(v16, v18)); v20 = _mm_cmpgt_epi16((__m128i)0LL, v17); v9 = _mm_sub_epi32(_mm_sub_epi32(v19, _mm_unpacklo_epi16(v17, v20)), _mm_unpackhi_epi16(v17, v20)); } while ( &v4[(unsigned int)v3 >> 4] != v10 ); v21 = v3 & 0xFFFFFFF0; v22 = _mm_add_epi32(_mm_srli_si128(v9, 8), v9); v23 = v21 + 1; v24 = _mm_cvtsi128_si32(_mm_add_epi32(v22, _mm_srli_si128(v22, 4))); v25 = _mm_add_epi32(v9, _mm_srli_si128(v9, 8)); v26 = v24 + v6; if ( (v3 & 0xF) != 0 ) { v27 = v3 - v21; if ( (unsigned int)(v3 - v21 - 1) > 6 ) goto LABEL_8; LABEL_34: v6 = v26; goto LABEL_9; } ++v5; v4 = (const __m128i *)((char *)v4 + 1); v6 += v24; LABEL_30: --v3; } v21 = 0LL; v26 = v6; v23 = 1; v27 = v3; v25 = 0LL; if ( (unsigned int)(v3 - 1) <= 6 ) goto LABEL_34; LABEL_8: v28 = (unsigned __int8)v7; BYTE1(v28) = v4->m128i_i8[0]; v29 = _mm_cmpeq_epi8( _mm_loadl_epi64((const __m128i *)&a1[v5 + v21]), _mm_shufflelo_epi16(_mm_cvtsi32_si128(v28), 0)); v30 = _mm_unpacklo_epi8(v29, _mm_cmpgt_epi8((__m128i)0LL, v29)); v31 = _mm_shuffle_epi32(v30, 78); v32 = _mm_unpacklo_epi16(v30, _mm_cmpgt_epi16((__m128i)0LL, v30)); v33 = _mm_unpacklo_epi16(v31, _mm_cmpgt_epi16((__m128i)0LL, v31)); v34 = _mm_sub_epi32( _mm_sub_epi32(_mm_sub_epi32(_mm_sub_epi32(v25, v32), _mm_shuffle_epi32(v32, 78)), v33), _mm_shuffle_epi32(v33, 78)); v6 += _mm_cvtsi128_si32(v34) + _mm_cvtsi128_si32(_mm_shuffle_epi32(v34, 229)); v23 += v27 & 0xFFFFFFF8; if ( (v27 & 7) != 0 ) { LABEL_9: if ( (_BYTE)v7 == a1[(int)v5 - 1 + v23] ) ++v6; if ( v23 + 1 <= v3 ) { if ( (_BYTE)v7 == a1[(int)v5 + v23] ) ++v6; if ( v3 >= v23 + 2 ) { if ( (_BYTE)v7 == a1[(int)v5 + 1 + v23] ) ++v6; if ( v3 >= v23 + 3 ) { if ( (_BYTE)v7 == a1[(int)v5 + 2 + v23] ) ++v6; if ( v23 + 4 <= v3 ) { if ( (_BYTE)v7 == a1[(int)v5 + 3 + v23] ) ++v6; if ( v23 + 5 <= v3 ) { if ( (_BYTE)v7 == a1[(int)v5 + 4 + v23] ) ++v6; if ( v23 + 6 <= v3 && (_BYTE)v7 == a1[(int)v5 + 5 + v23] ) ++v6; } } } } LABEL_29: ++v5; v4 = (const __m128i *)((char *)v4 + 1); goto LABEL_30; } } if ( v3 == 1 ) return v6; goto LABEL_29; } return 0LL; }
func0: ENDBR64 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RDI CALL 0x00101060 TEST EAX,EAX JLE 0x0010151d MOV RCX,RAX MOV R10,RBX XOR R11D,R11D XOR EDI,EDI PXOR XMM6,XMM6 PXOR XMM5,XMM5 PXOR XMM4,XMM4 PXOR XMM3,XMM3 NOP word ptr [RAX + RAX*0x1] LAB_00101270: LEA R8D,[RCX + -0x1] MOVZX EDX,byte ptr [R10] MOV ESI,R11D CMP R8D,0xe JBE 0x001014e0 MOVD XMM8,EDX MOV R9D,ECX PXOR XMM1,XMM1 MOV RAX,R10 PUNPCKLBW XMM8,XMM8 SHR R9D,0x4 PUNPCKLWD XMM8,XMM8 SHL R9,0x4 PSHUFD XMM8,XMM8,0x0 ADD R9,R10 NOP LAB_001012b0: MOVDQU XMM0,xmmword ptr [RAX] MOVDQA XMM7,XMM4 ADD RAX,0x10 PCMPEQB XMM0,XMM8 PCMPGTB XMM7,XMM0 MOVDQA XMM2,XMM0 PUNPCKLBW XMM2,XMM7 PUNPCKHBW XMM0,XMM7 MOVDQA XMM7,XMM3 PCMPGTW XMM7,XMM2 MOVDQA XMM9,XMM2 PUNPCKLWD XMM9,XMM7 PUNPCKHWD XMM2,XMM7 MOVDQA XMM7,XMM0 PSUBD XMM1,XMM9 PSUBD XMM1,XMM2 MOVDQA XMM2,XMM3 PCMPGTW XMM2,XMM0 PUNPCKLWD XMM7,XMM2 PUNPCKHWD XMM0,XMM2 PSUBD XMM1,XMM7 PSUBD XMM1,XMM0 CMP R9,RAX JNZ 0x001012b0 MOVDQA XMM0,XMM1 MOV EBP,ECX PSRLDQ XMM0,0x8 AND EBP,0xfffffff0 PADDD XMM0,XMM1 LEA R14D,[RBP + 0x1] MOVDQA XMM2,XMM0 PSRLDQ XMM2,0x4 PADDD XMM0,XMM2 MOVD EAX,XMM0 MOVDQA XMM0,XMM1 PSRLDQ XMM1,0x8 PADDD XMM0,XMM1 LEA R12D,[RAX + RDI*0x1] TEST CL,0xf JZ 0x00101510 MOV R9D,ECX SUB R9D,EBP LEA R13D,[R9 + -0x1] CMP R13D,0x6 JBE 0x00101508 LAB_00101366: LEA R12,[RBX + R11*0x1] MOVDQA XMM7,XMM6 MOVQ XMM2,qword ptr [R12 + RBP*0x1] MOVZX EBP,DL MOV EAX,EBP MOV AH,AL MOV EBP,EAX MOVD XMM1,EBP PSHUFLW XMM1,XMM1,0x0 PCMPEQB XMM2,XMM1 PCMPGTB XMM7,XMM2 MOVDQA XMM1,XMM2 PUNPCKLBW XMM1,XMM7 PUNPCKLBW XMM2,XMM7 MOVDQA XMM7,XMM5 PCMPGTW XMM7,XMM1 MOVDQA XMM8,XMM1 PSHUFD XMM2,XMM2,0x4e PUNPCKLWD XMM8,XMM7 PUNPCKLWD XMM1,XMM7 MOVDQA XMM7,XMM2 PSUBD XMM0,XMM8 PSHUFD XMM1,XMM1,0x4e PSUBD XMM0,XMM1 MOVDQA XMM1,XMM5 PCMPGTW XMM1,XMM2 PUNPCKLWD XMM7,XMM1 PUNPCKLWD XMM2,XMM1 PSUBD XMM0,XMM7 PSHUFD XMM2,XMM2,0x4e PSUBD XMM0,XMM2 MOVD R12D,XMM0 PSHUFD XMM1,XMM0,0xe5 MOVD EBP,XMM1 ADD EBP,R12D ADD EDI,EBP MOV EBP,R9D AND EBP,0xfffffff8 ADD R14D,EBP AND R9D,0x7 JZ 0x001014d0 LAB_0010140a: LEA R9D,[RSI + R14*0x1 + -0x1] MOVSXD R9,R9D CMP DL,byte ptr [RBX + R9*0x1] JNZ 0x0010141b ADD EDI,0x1 LAB_0010141b: LEA R9D,[R14 + 0x1] CMP R9D,ECX JG 0x001014d0 LEA R9D,[RSI + R9*0x1 + -0x1] MOVSXD R9,R9D CMP DL,byte ptr [RBX + R9*0x1] JNZ 0x00101439 ADD EDI,0x1 LAB_00101439: LEA R9D,[R14 + 0x2] CMP ECX,R9D JL 0x001014c0 LEA R9D,[RSI + R9*0x1 + -0x1] MOVSXD R9,R9D CMP DL,byte ptr [RBX + R9*0x1] JNZ 0x00101453 ADD EDI,0x1 LAB_00101453: LEA R9D,[R14 + 0x3] CMP ECX,R9D JL 0x001014c0 LEA R9D,[RSI + R9*0x1 + -0x1] MOVSXD R9,R9D CMP DL,byte ptr [RBX + R9*0x1] JNZ 0x0010146d ADD EDI,0x1 LAB_0010146d: LEA R9D,[R14 + 0x4] CMP R9D,ECX JG 0x001014c0 LEA R9D,[RSI + R9*0x1 + -0x1] MOVSXD R9,R9D CMP DL,byte ptr [RBX + R9*0x1] JNZ 0x00101487 ADD EDI,0x1 LAB_00101487: LEA R9D,[R14 + 0x5] CMP R9D,ECX JG 0x001014c0 LEA R9D,[RSI + R9*0x1 + -0x1] MOVSXD R9,R9D CMP DL,byte ptr [RBX + R9*0x1] JNZ 0x001014a1 ADD EDI,0x1 LAB_001014a1: LEA EAX,[R14 + 0x6] CMP EAX,ECX JG 0x001014c0 LEA EAX,[RSI + RAX*0x1 + -0x1] CDQE CMP DL,byte ptr [RBX + RAX*0x1] JNZ 0x001014c0 ADD EDI,0x1 NOP word ptr [RAX + RAX*0x1] LAB_001014c0: ADD R11,0x1 ADD R10,0x1 LAB_001014c8: MOV ECX,R8D JMP 0x00101270 LAB_001014d0: TEST R8D,R8D JNZ 0x001014c0 POP RBX MOV EAX,EDI POP RBP POP R12 POP R13 POP R14 RET LAB_001014e0: XOR EBP,EBP MOV R9D,ECX MOV R12D,EDI MOV R14D,0x1 SUB R9D,EBP PXOR XMM0,XMM0 LEA R13D,[R9 + -0x1] CMP R13D,0x6 JA 0x00101366 NOP dword ptr [RAX + RAX*0x1] LAB_00101508: MOV EDI,R12D JMP 0x0010140a LAB_00101510: ADD R11,0x1 ADD R10,0x1 MOV EDI,R12D JMP 0x001014c8 LAB_0010151d: XOR EDI,EDI POP RBX POP RBP MOV EAX,EDI POP R12 POP R13 POP R14 RET
int func0(char *param_1) { char cVar1; bool bVar2; bool bVar3; bool bVar4; bool bVar5; bool bVar6; bool bVar7; bool bVar8; bool bVar9; uint uVar10; char *pcVar11; char *pcVar12; char *pcVar13; char *pcVar14; char *pcVar15; char *pcVar16; char *pcVar17; char *pcVar18; char *pcVar19; char *pcVar20; char *pcVar21; char *pcVar22; char *pcVar23; char *pcVar24; char *pcVar25; int auVar26 [14]; int auVar27 [12]; unkbyte10 Var28; int auVar29 [12]; int auVar30 [14]; int auVar31 [12]; int auVar32 [16]; int auVar33 [16]; int auVar34 [16]; int auVar35 [12]; unkbyte9 Var36; int6 uVar37; int4 uVar38; int2 uVar39; size_t sVar40; char *pcVar41; uint uVar42; int iVar44; uint uVar45; char *pcVar46; long lVar47; int iVar48; int4 uVar49; int iVar50; int iVar57; char cVar58; short sVar59; int auVar54 [12]; int iVar60; int iVar66; int iVar68; int iVar69; int auVar61 [16]; int auVar62 [16]; short sVar67; int auVar63 [16]; short sVar83; int auVar70 [12]; int auVar71 [12]; char cVar78; char cVar79; char cVar80; char cVar81; short sVar84; int auVar72 [16]; int auVar74 [16]; int auVar75 [16]; char cVar94; char cVar95; char cVar96; char cVar97; char cVar98; char cVar99; int auVar85 [16]; int auVar90 [16]; int auVar100 [16]; int auVar103 [16]; ulong uVar43; int6 uVar51; int8 uVar52; int auVar53 [12]; int auVar55 [14]; int auVar56 [16]; int auVar64 [16]; int auVar65 [16]; int auVar76 [16]; int auVar73 [16]; int auVar77 [16]; long lVar82; int auVar86 [16]; int auVar87 [16]; int auVar91 [16]; int auVar88 [16]; int auVar92 [16]; int auVar89 [16]; int auVar93 [16]; int auVar101 [16]; int auVar102 [16]; int auVar104 [16]; int auVar105 [16]; sVar40 = strlen(param_1); if ((int)sVar40 < 1) { return 0; } lVar47 = 0; iVar44 = 0; pcVar46 = param_1; do { uVar10 = (uint)sVar40; uVar45 = uVar10 - 1; cVar1 = *pcVar46; if (uVar45 < 0xf) { uVar43 = 0; iVar48 = 1; iVar50 = 0; iVar57 = 0; uVar42 = uVar10; iVar60 = iVar44; joined_r0x001014fd: if (uVar42 - 1 < 7) { LAB_0010140a: iVar44 = (int)lVar47; if (cVar1 == param_1[iVar44 + -1 + iVar48]) { iVar60 = iVar60 + 1; } if (iVar48 + 1 <= (int)uVar10) { if (cVar1 == param_1[iVar44 + -1 + iVar48 + 1]) { iVar60 = iVar60 + 1; } if (iVar48 + 2 <= (int)uVar10) { if (cVar1 == param_1[iVar44 + -1 + iVar48 + 2]) { iVar60 = iVar60 + 1; } if (iVar48 + 3 <= (int)uVar10) { if (cVar1 == param_1[iVar44 + -1 + iVar48 + 3]) { iVar60 = iVar60 + 1; } if (iVar48 + 4 <= (int)uVar10) { if (cVar1 == param_1[iVar44 + -1 + iVar48 + 4]) { iVar60 = iVar60 + 1; } if (iVar48 + 5 <= (int)uVar10) { if (cVar1 == param_1[iVar44 + -1 + iVar48 + 5]) { iVar60 = iVar60 + 1; } if ((iVar48 + 6 <= (int)uVar10) && (cVar1 == param_1[iVar44 + -1 + iVar48 + 6])) { iVar60 = iVar60 + 1; } } } } } goto LAB_001014c8; } } else { uVar52 = *(int8 *)(param_1 + uVar43 + lVar47); auVar61 = pshuflw(ZEXT216(CONCAT11(cVar1,cVar1)),ZEXT216(CONCAT11(cVar1,cVar1)),0); bVar2 = (char)uVar52 == auVar61[0]; auVar74[0] = -bVar2; bVar6 = (char)((ulong)uVar52 >> 8) == auVar61[1]; cVar58 = -bVar6; bVar7 = (char)((ulong)uVar52 >> 0x10) == auVar61[2]; bVar8 = (char)((ulong)uVar52 >> 0x18) == auVar61[3]; bVar9 = (char)((ulong)uVar52 >> 0x20) == auVar61[4]; cVar78 = -bVar9; bVar3 = (char)((ulong)uVar52 >> 0x28) == auVar61[5]; cVar79 = -bVar3; bVar4 = (char)((ulong)uVar52 >> 0x30) == auVar61[6]; cVar80 = -bVar4; bVar5 = (char)((ulong)uVar52 >> 0x38) == auVar61[7]; cVar81 = -bVar5; cVar94 = -bVar6; cVar95 = -bVar8; cVar96 = -bVar9; cVar97 = -bVar3; cVar98 = -bVar4; cVar99 = -bVar5; Var28 = CONCAT91(CONCAT81((long)(CONCAT72(CONCAT61(CONCAT51(CONCAT41(CONCAT31(CONCAT21( CONCAT11(cVar99,cVar81),cVar98),cVar80),cVar97), cVar79),cVar96),CONCAT11(cVar78,cVar81)) >> 8), cVar95),-bVar8); auVar31._2_10_ = Var28; auVar31[1] = -bVar7; auVar31[0] = -bVar7; auVar30._2_12_ = auVar31; auVar30[1] = cVar94; auVar30[0] = cVar58; auVar62._0_2_ = CONCAT11(-bVar2,auVar74[0]); auVar62._2_14_ = auVar30; uVar39 = CONCAT11(cVar99,cVar81); uVar38 = CONCAT31(CONCAT21(uVar39,cVar98),cVar80); uVar37 = CONCAT51(CONCAT41(uVar38,cVar97),cVar79); Var36 = CONCAT72(CONCAT61(uVar37,cVar96),CONCAT11(cVar78,cVar81)); lVar82 = (long)((unkuint9)Var36 >> 8); auVar34._1_8_ = lVar82; auVar34[0] = cVar95; auVar34._9_7_ = 0; auVar33._10_6_ = 0; auVar33._0_10_ = SUB1610(auVar34 << 0x38,6); auVar32._11_5_ = 0; auVar32._0_11_ = SUB1611(auVar33 << 0x30,5); auVar74._4_12_ = SUB1612(auVar32 << 0x28,4); auVar74[3] = cVar94; auVar74[2] = cVar58; auVar74[1] = -bVar2; sVar59 = auVar31._0_2_; sVar67 = (short)Var28; iVar60 = (int)((unkuint9)Var36 >> 8); auVar71._8_4_ = auVar74._0_4_; auVar71._0_8_ = lVar82; auVar102._0_12_ = auVar62._0_12_; auVar102._12_2_ = sVar67; auVar102._14_2_ = -(ushort)(sVar67 < 0); auVar101._12_4_ = auVar102._12_4_; auVar101._0_10_ = auVar62._0_10_; auVar101._10_2_ = -(ushort)(sVar59 < 0); auVar100._10_6_ = auVar101._10_6_; auVar100._0_8_ = auVar62._0_8_; auVar100._8_2_ = sVar59; auVar35._4_8_ = auVar100._8_8_; auVar35._2_2_ = -(ushort)(auVar30._0_2_ < 0); auVar35._0_2_ = auVar30._0_2_; auVar65._12_2_ = sVar67; auVar65._0_12_ = auVar102._0_12_; auVar65._14_2_ = -(ushort)(sVar67 < 0); auVar64._12_4_ = auVar65._12_4_; auVar64._10_2_ = -(ushort)(sVar59 < 0); auVar64._0_10_ = auVar101._0_10_; auVar63._10_6_ = auVar64._10_6_; auVar63._8_2_ = sVar59; auVar63._0_8_ = auVar100._0_8_; sVar59 = (short)((unkuint9)Var36 >> 8); sVar67 = (short)uVar38; auVar93._12_2_ = uVar39; auVar93._0_12_ = auVar71; auVar93._14_2_ = -(ushort)(lVar82 < 0); auVar92._12_4_ = auVar93._12_4_; auVar92._0_10_ = auVar71._0_10_; auVar92._10_2_ = -(ushort)(sVar67 < 0); auVar91._10_6_ = auVar92._10_6_; auVar91._8_2_ = sVar67; auVar91._0_8_ = lVar82; auVar90._8_8_ = auVar91._8_8_; auVar90._6_2_ = -(ushort)(iVar60 < 0); auVar90._4_2_ = (short)uVar37; auVar90._0_4_ = iVar60; auVar77._12_2_ = uVar39; auVar77._0_12_ = auVar71; auVar77._14_2_ = -(ushort)(lVar82 < 0); auVar76._12_4_ = auVar77._12_4_; auVar76._10_2_ = -(ushort)(sVar67 < 0); auVar76._0_10_ = auVar92._0_10_; auVar75._10_6_ = auVar76._10_6_; auVar75._8_2_ = sVar67; auVar75._0_8_ = lVar82; iVar60 = iVar44 + ((((iVar57 - auVar35._0_4_) - auVar64._12_4_) - auVar90._4_4_) - auVar76._12_4_) + ((((iVar50 - CONCAT22(-(ushort)bVar2,auVar62._0_2_)) - auVar63._8_4_) - CONCAT22(-(ushort)(sVar59 < 0),sVar59)) - auVar75._8_4_); iVar48 = iVar48 + (uVar42 & 0xfffffff8); if ((uVar42 & 7) != 0) goto LAB_0010140a; } if (uVar45 == 0) { return iVar60; } } else { iVar60 = 0; iVar66 = 0; iVar68 = 0; iVar69 = 0; pcVar41 = pcVar46; do { cVar58 = *pcVar41; pcVar11 = pcVar41 + 1; pcVar12 = pcVar41 + 2; pcVar13 = pcVar41 + 3; pcVar14 = pcVar41 + 4; pcVar15 = pcVar41 + 5; pcVar16 = pcVar41 + 6; pcVar17 = pcVar41 + 7; pcVar18 = pcVar41 + 8; pcVar19 = pcVar41 + 9; pcVar20 = pcVar41 + 10; pcVar21 = pcVar41 + 0xb; pcVar22 = pcVar41 + 0xc; pcVar23 = pcVar41 + 0xd; pcVar24 = pcVar41 + 0xe; pcVar25 = pcVar41 + 0xf; pcVar41 = pcVar41 + 0x10; bVar2 = cVar58 == cVar1; cVar58 = -(*pcVar17 == cVar1); bVar6 = *pcVar18 == cVar1; bVar7 = *pcVar19 == cVar1; bVar8 = *pcVar20 == cVar1; bVar9 = *pcVar21 == cVar1; uVar39 = CONCAT11(-(*pcVar17 == cVar1),cVar58); uVar38 = CONCAT31(CONCAT21(uVar39,-(*pcVar16 == cVar1)),-(*pcVar16 == cVar1)); uVar37 = CONCAT51(CONCAT41(uVar38,-(*pcVar15 == cVar1)),-(*pcVar15 == cVar1)); Var36 = CONCAT72(CONCAT61(uVar37,-(*pcVar14 == cVar1)),CONCAT11(-(*pcVar14 == cVar1),cVar58) ); lVar82 = (long)((unkuint9)Var36 >> 8); Var28 = CONCAT91(CONCAT81(lVar82,-(*pcVar13 == cVar1)),-(*pcVar13 == cVar1)); auVar27._2_10_ = Var28; auVar27[1] = -(*pcVar12 == cVar1); auVar27[0] = -(*pcVar12 == cVar1); auVar26._2_12_ = auVar27; auVar26[1] = -(*pcVar11 == cVar1); auVar26[0] = -(*pcVar11 == cVar1); auVar72._0_2_ = CONCAT11(-bVar2,-bVar2); auVar72._2_14_ = auVar26; uVar49 = CONCAT13(-bVar7,CONCAT12(-bVar7,CONCAT11(-bVar6,-bVar6))); uVar51 = CONCAT15(-bVar8,CONCAT14(-bVar8,uVar49)); uVar52 = CONCAT17(-bVar9,CONCAT16(-bVar9,uVar51)); auVar53._0_10_ = CONCAT19(-(*pcVar22 == cVar1),CONCAT18(-(*pcVar22 == cVar1),uVar52)); auVar53[10] = -(*pcVar23 == cVar1); auVar53[0xb] = -(*pcVar23 == cVar1); auVar55[0xc] = -(*pcVar24 == cVar1); auVar55._0_12_ = auVar53; auVar55[0xd] = -(*pcVar24 == cVar1); auVar61[0xe] = -(*pcVar25 == cVar1); auVar61._0_14_ = auVar55; auVar61[0xf] = -(*pcVar25 == cVar1); sVar59 = (short)Var28; sVar67 = (short)((unkuint9)Var36 >> 8); sVar83 = (short)uVar37; sVar84 = (short)uVar38; auVar105._0_12_ = auVar72._0_12_; auVar105._12_2_ = sVar59; auVar105._14_2_ = -(ushort)(sVar59 < 0); auVar104._12_4_ = auVar105._12_4_; auVar104._0_10_ = auVar72._0_10_; auVar104._10_2_ = -(ushort)(auVar27._0_2_ < 0); auVar103._10_6_ = auVar104._10_6_; auVar103._0_8_ = auVar72._0_8_; auVar103._8_2_ = auVar27._0_2_; auVar29._4_8_ = auVar103._8_8_; auVar29._2_2_ = -(ushort)(auVar26._0_2_ < 0); auVar29._0_2_ = auVar26._0_2_; iVar50 = CONCAT22(-(ushort)(sVar67 < 0),sVar67); auVar70._0_8_ = CONCAT26(-(ushort)(sVar83 < 0),CONCAT24(sVar83,iVar50)); auVar70._8_2_ = sVar84; auVar70._10_2_ = -(ushort)(sVar84 < 0); auVar73._12_2_ = uVar39; auVar73._0_12_ = auVar70; auVar73._14_2_ = -(ushort)(lVar82 < 0); sVar59 = (short)((unkuint10)auVar53._0_10_ >> 0x40); auVar89._12_2_ = (short)((ulong)uVar52 >> 0x30); auVar89._0_12_ = auVar53; auVar89._14_2_ = -(ushort)bVar9; auVar88._12_4_ = auVar89._12_4_; auVar88._10_2_ = -(ushort)bVar8; auVar88._0_10_ = auVar53._0_10_; auVar87._10_6_ = auVar88._10_6_; auVar87._8_2_ = (short)((uint6)uVar51 >> 0x20); auVar87._0_8_ = uVar52; auVar86._8_8_ = auVar87._8_8_; auVar86._6_2_ = -(ushort)bVar7; auVar86._0_6_ = uVar51; auVar85._6_10_ = auVar86._6_10_; auVar85._4_2_ = (short)((uint)uVar49 >> 0x10); auVar85._0_4_ = uVar49; iVar48 = CONCAT22(-(ushort)(sVar59 < 0),sVar59); auVar54._0_8_ = CONCAT26(-(ushort)(auVar53._10_2_ < 0),CONCAT24(auVar53._10_2_,iVar48)); auVar54._8_2_ = auVar55._12_2_; auVar54._10_2_ = -(ushort)(auVar55._12_2_ < 0); auVar56._12_2_ = auVar61._14_2_; auVar56._0_12_ = auVar54; auVar56._14_2_ = -(ushort)(auVar61._14_2_ < 0); iVar60 = (((iVar60 - CONCAT22(-(ushort)bVar2,auVar72._0_2_)) - iVar50) - CONCAT22(-(ushort)bVar6,CONCAT11(-bVar6,-bVar6))) - iVar48; iVar66 = (((iVar66 - auVar29._0_4_) - (int)((ulong)auVar70._0_8_ >> 0x20)) - auVar85._4_4_) - (int)((ulong)auVar54._0_8_ >> 0x20); iVar68 = (((iVar68 - auVar103._8_4_) - auVar70._8_4_) - auVar87._8_4_) - auVar54._8_4_; iVar69 = (((iVar69 - auVar104._12_4_) - auVar73._12_4_) - auVar88._12_4_) - auVar56._12_4_; } while (pcVar46 + (sVar40 >> 4 & 0xfffffff) * 0x10 != pcVar41); uVar42 = uVar10 & 0xfffffff0; uVar43 = (ulong)uVar42; iVar48 = uVar42 + 1; iVar50 = iVar60 + iVar68; iVar57 = iVar66 + iVar69; iVar60 = iVar68 + iVar60 + iVar69 + iVar66 + iVar44; if ((sVar40 & 0xf) != 0) { uVar42 = uVar10 - uVar42; goto joined_r0x001014fd; } } LAB_001014c8: iVar44 = iVar60; lVar47 = lVar47 + 1; pcVar46 = pcVar46 + 1; sVar40 = (size_t)uVar45; } while( true ); }
5,248
func0
#include <assert.h>
int func0(int x, int y) { if (x == y) { return y; } return 2; }
int main() { assert(func0(2,2) == 2); assert(func0(2,5) == 2); assert(func0(5,10) == 2); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov %esi,-0x8(%rbp) mov -0x4(%rbp),%eax cmp -0x8(%rbp),%eax jne 1164 <func0+0x1b> mov -0x8(%rbp),%eax jmp 1169 <func0+0x20> mov $0x2,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov [rbp+var_8], esi mov eax, [rbp+var_4] cmp eax, [rbp+var_8] jnz short loc_1164 mov eax, [rbp+var_8] jmp short loc_1169 loc_1164: mov eax, 2 loc_1169: pop rbp retn
long long func0(int a1, unsigned int a2) { if ( a1 == a2 ) return a2; else return 2LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV dword ptr [RBP + -0x8],ESI MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x8] JNZ 0x00101164 MOV EAX,dword ptr [RBP + -0x8] JMP 0x00101169 LAB_00101164: MOV EAX,0x2 LAB_00101169: POP RBP RET
int func0(int param_1,int param_2) { if (param_1 != param_2) { param_2 = 2; } return param_2; }
5,249
func0
#include <assert.h>
int func0(int x, int y) { if (x == y) { return y; } return 2; }
int main() { assert(func0(2,2) == 2); assert(func0(2,5) == 2); assert(func0(5,10) == 2); return 0; }
O1
c
func0: endbr64 cmp %esi,%edi mov $0x2,%eax cmove %esi,%eax retq
func0: endbr64 cmp edi, esi mov eax, 2 cmovz eax, esi retn
long long func0(int a1, unsigned int a2) { long long result; // rax result = 2LL; if ( a1 == a2 ) return a2; return result; }
func0: ENDBR64 CMP EDI,ESI MOV EAX,0x2 CMOVZ EAX,ESI RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = 2; if (param_1 == param_2) { iVar1 = param_2; } return iVar1; }
5,250
func0
#include <assert.h>
int func0(int x, int y) { if (x == y) { return y; } return 2; }
int main() { assert(func0(2,2) == 2); assert(func0(2,5) == 2); assert(func0(5,10) == 2); return 0; }
O2
c
func0: endbr64 cmp %esi,%edi mov $0x2,%eax cmove %edi,%eax retq
func0: endbr64 cmp edi, esi mov eax, 2 cmovz eax, edi retn
long long func0(unsigned int a1, int a2) { long long result; // rax result = 2LL; if ( a1 == a2 ) return a1; return result; }
func0: ENDBR64 CMP EDI,ESI MOV EAX,0x2 CMOVZ EAX,EDI RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = 2; if (param_1 == param_2) { iVar1 = param_1; } return iVar1; }
5,251
func0
#include <assert.h>
int func0(int x, int y) { if (x == y) { return y; } return 2; }
int main() { assert(func0(2,2) == 2); assert(func0(2,5) == 2); assert(func0(5,10) == 2); return 0; }
O3
c
func0: endbr64 cmp %esi,%edi mov $0x2,%eax cmove %edi,%eax retq
func0: endbr64 cmp edi, esi mov eax, 2 cmovz eax, edi retn
long long func0(unsigned int a1, int a2) { long long result; // rax result = 2LL; if ( a1 == a2 ) return a1; return result; }
func0: ENDBR64 CMP EDI,ESI MOV EAX,0x2 CMOVZ EAX,EDI RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = 2; if (param_1 == param_2) { iVar1 = param_1; } return iVar1; }
5,252
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> int compare(const void * a, const void * b) { return (*(int*)a - *(int*)b); }
int func0(int lst[], int size) { int positive_numbers[size]; int count = 0; for (int i = 0; i < size; i++) { if (lst[i] > 0) { positive_numbers[count++] = lst[i]; } } qsort(positive_numbers, count, sizeof(int), compare); int sum = 0; for (int i = 0; i < 3 && i < count; i++) { sum += positive_numbers[i]; } return sum; }
int main() { int arr1[] = {10, 20, 30, 40, 50, 60, 7}; int arr2[] = {1, 2, 3, 4, 5}; int arr3[] = {0, 1, 2, 3, 4, 5}; assert(func0(arr1, 7) == 37); assert(func0(arr2, 5) == 6); assert(func0(arr3, 6) == 6); 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,%rbx mov -0x4c(%rbp),%eax movslq %eax,%rdx sub $0x1,%rdx mov %rdx,-0x28(%rbp) movslq %eax,%rdx mov %rdx,%r10 mov $0x0,%r11d movslq %eax,%rdx mov %rdx,%r8 mov $0x0,%r9d cltq lea 0x0(,%rax,4),%rdx mov $0x10,%eax sub $0x1,%rax add %rdx,%rax mov $0x10,%esi mov $0x0,%edx div %rsi imul $0x10,%rax,%rax mov %rax,%rdx and $0xfffffffffffff000,%rdx mov %rsp,%rdi sub %rdx,%rdi mov %rdi,%rdx cmp %rdx,%rsp je 124b <func0+0xa0> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) jmp 1234 <func0+0x89> mov %rax,%rdx and $0xfff,%edx sub %rdx,%rsp mov %rax,%rdx and $0xfff,%edx test %rdx,%rdx je 1275 <func0+0xca> 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,-0x2c(%rbp) movl $0x0,-0x30(%rbp) jmp 12df <func0+0x134> mov -0x30(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x48(%rbp),%rax add %rdx,%rax mov (%rax),%eax test %eax,%eax jle 12db <func0+0x130> mov -0x30(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x48(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x2c(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x2c(%rbp) mov (%rcx),%ecx mov -0x20(%rbp),%rdx cltq mov %ecx,(%rdx,%rax,4) addl $0x1,-0x30(%rbp) mov -0x30(%rbp),%eax cmp -0x4c(%rbp),%eax jl 1298 <func0+0xed> mov -0x2c(%rbp),%eax movslq %eax,%rsi mov -0x20(%rbp),%rax lea -0x16f(%rip),%rcx mov $0x4,%edx mov %rax,%rdi callq 1070 <qsort@plt> movl $0x0,-0x34(%rbp) movl $0x0,-0x38(%rbp) jmp 1329 <func0+0x17e> mov -0x20(%rbp),%rax mov -0x38(%rbp),%edx movslq %edx,%rdx mov (%rax,%rdx,4),%eax add %eax,-0x34(%rbp) addl $0x1,-0x38(%rbp) cmpl $0x2,-0x38(%rbp) jg 1337 <func0+0x18c> mov -0x38(%rbp),%eax cmp -0x2c(%rbp),%eax jl 1315 <func0+0x16a> mov -0x34(%rbp),%eax mov %rbx,%rsp mov -0x18(%rbp),%rbx xor %fs:0x28,%rbx je 1351 <func0+0x1a6> callq 1080 <__stack_chk_fail@plt> mov -0x8(%rbp),%rbx leaveq retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 48h mov [rbp+var_48], rdi mov [rbp+var_4C], esi mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax mov rax, rsp mov rbx, rax mov eax, [rbp+var_4C] movsxd rdx, eax sub rdx, 1 mov [rbp+var_28], rdx cdqe lea rdx, ds:0[rax*4] mov eax, 10h sub rax, 1 add rax, rdx mov edi, 10h mov edx, 0 div rdi imul rax, 10h mov rcx, rax and rcx, 0FFFFFFFFFFFFF000h mov rdx, rsp sub rdx, rcx loc_1219: cmp rsp, rdx jz short loc_1230 sub rsp, 1000h or [rsp+1050h+var_58], 0 jmp short loc_1219 loc_1230: mov rdx, rax and edx, 0FFFh sub rsp, rdx mov rdx, rax and edx, 0FFFh test rdx, rdx jz short loc_125A and eax, 0FFFh sub rax, 8 add rax, rsp or qword ptr [rax], 0 loc_125A: mov rax, rsp add rax, 3 shr rax, 2 shl rax, 2 mov [rbp+base], rax mov [rbp+var_38], 0 mov [rbp+var_34], 0 jmp short loc_12C4 loc_127D: mov eax, [rbp+var_34] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_48] add rax, rdx mov eax, [rax] test eax, eax jle short loc_12C0 mov eax, [rbp+var_34] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_48] lea rcx, [rdx+rax] mov eax, [rbp+var_38] lea edx, [rax+1] mov [rbp+var_38], edx mov ecx, [rcx] mov rdx, [rbp+base] cdqe mov [rdx+rax*4], ecx loc_12C0: add [rbp+var_34], 1 loc_12C4: mov eax, [rbp+var_34] cmp eax, [rbp+var_4C] jl short loc_127D mov eax, [rbp+var_38] movsxd rsi, eax; nmemb mov rax, [rbp+base] lea rdx, compare mov rcx, rdx; compar mov edx, 4; size mov rdi, rax; base call _qsort mov [rbp+var_30], 0 mov [rbp+var_2C], 0 jmp short loc_1311 loc_12FD: mov rax, [rbp+base] mov edx, [rbp+var_2C] movsxd rdx, edx mov eax, [rax+rdx*4] add [rbp+var_30], eax add [rbp+var_2C], 1 loc_1311: cmp [rbp+var_2C], 2 jg short loc_131F mov eax, [rbp+var_2C] cmp eax, [rbp+var_38] jl short loc_12FD loc_131F: mov eax, [rbp+var_30] mov rsp, rbx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_1339 call ___stack_chk_fail loc_1339: mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, int a2) { unsigned long long v2; // rax void *v3; // rsp int v4; // eax _BYTE v6[4]; // [rsp+8h] [rbp-50h] BYREF int v7; // [rsp+Ch] [rbp-4Ch] long long v8; // [rsp+10h] [rbp-48h] int v9; // [rsp+20h] [rbp-38h] int i; // [rsp+24h] [rbp-34h] unsigned int v11; // [rsp+28h] [rbp-30h] int j; // [rsp+2Ch] [rbp-2Ch] long long v13; // [rsp+30h] [rbp-28h] void *base; // [rsp+38h] [rbp-20h] unsigned long long v15; // [rsp+40h] [rbp-18h] v8 = a1; v7 = a2; v15 = __readfsqword(0x28u); v13 = a2 - 1LL; v2 = 16 * ((4LL * a2 + 15) / 0x10uLL); while ( v6 != &v6[-(v2 & 0xFFFFFFFFFFFFF000LL)] ) ; v3 = alloca(v2 & 0xFFF); if ( (v2 & 0xFFF) != 0 ) *(_QWORD *)&v6[(v2 & 0xFFF) - 8] = *(_QWORD *)&v6[(v2 & 0xFFF) - 8]; base = v6; v9 = 0; for ( i = 0; i < v7; ++i ) { if ( *(int *)(4LL * i + v8) > 0 ) { v4 = v9++; *((_DWORD *)base + v4) = *(_DWORD *)(4LL * i + v8); } } qsort(base, v9, 4uLL, compare); v11 = 0; for ( j = 0; j <= 2 && j < v9; ++j ) v11 += *((_DWORD *)base + j); return v11; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x48 MOV qword ptr [RBP + -0x48],RDI MOV dword ptr [RBP + -0x4c],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV RAX,RSP MOV RBX,RAX MOV EAX,dword ptr [RBP + -0x4c] MOVSXD RDX,EAX SUB RDX,0x1 MOV qword ptr [RBP + -0x28],RDX CDQE LEA RDX,[RAX*0x4] MOV EAX,0x10 SUB RAX,0x1 ADD RAX,RDX MOV EDI,0x10 MOV EDX,0x0 DIV RDI IMUL RAX,RAX,0x10 MOV RCX,RAX AND RCX,-0x1000 MOV RDX,RSP SUB RDX,RCX LAB_00101219: CMP RSP,RDX JZ 0x00101230 SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 JMP 0x00101219 LAB_00101230: MOV RDX,RAX AND EDX,0xfff SUB RSP,RDX MOV RDX,RAX AND EDX,0xfff TEST RDX,RDX JZ 0x0010125a AND EAX,0xfff SUB RAX,0x8 ADD RAX,RSP OR qword ptr [RAX],0x0 LAB_0010125a: MOV RAX,RSP ADD RAX,0x3 SHR RAX,0x2 SHL RAX,0x2 MOV qword ptr [RBP + -0x20],RAX MOV dword ptr [RBP + -0x38],0x0 MOV dword ptr [RBP + -0x34],0x0 JMP 0x001012c4 LAB_0010127d: MOV EAX,dword ptr [RBP + -0x34] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x48] ADD RAX,RDX MOV EAX,dword ptr [RAX] TEST EAX,EAX JLE 0x001012c0 MOV EAX,dword ptr [RBP + -0x34] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x48] LEA RCX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x38] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x38],EDX MOV ECX,dword ptr [RCX] MOV RDX,qword ptr [RBP + -0x20] CDQE MOV dword ptr [RDX + RAX*0x4],ECX LAB_001012c0: ADD dword ptr [RBP + -0x34],0x1 LAB_001012c4: MOV EAX,dword ptr [RBP + -0x34] CMP EAX,dword ptr [RBP + -0x4c] JL 0x0010127d MOV EAX,dword ptr [RBP + -0x38] MOVSXD RSI,EAX MOV RAX,qword ptr [RBP + -0x20] LEA RDX,[0x101189] MOV RCX,RDX MOV EDX,0x4 MOV RDI,RAX CALL 0x00101070 MOV dword ptr [RBP + -0x30],0x0 MOV dword ptr [RBP + -0x2c],0x0 JMP 0x00101311 LAB_001012fd: MOV RAX,qword ptr [RBP + -0x20] MOV EDX,dword ptr [RBP + -0x2c] MOVSXD RDX,EDX MOV EAX,dword ptr [RAX + RDX*0x4] ADD dword ptr [RBP + -0x30],EAX ADD dword ptr [RBP + -0x2c],0x1 LAB_00101311: CMP dword ptr [RBP + -0x2c],0x2 JG 0x0010131f MOV EAX,dword ptr [RBP + -0x2c] CMP EAX,dword ptr [RBP + -0x38] JL 0x001012fd LAB_0010131f: MOV EAX,dword ptr [RBP + -0x30] MOV RSP,RBX MOV RDX,qword ptr [RBP + -0x18] SUB RDX,qword ptr FS:[0x28] JZ 0x00101339 CALL 0x00101080 LAB_00101339: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int func0(long param_1,int param_2) { long lVar1; ulong uVar2; int *puVar3; size_t __nmemb; long in_FS_OFFSET; int auStack_58 [4]; int local_54; long local_50; int local_40; int local_3c; int local_38; int local_34; long local_30; int *local_28; long local_20; local_50 = param_1; local_54 = param_2; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_30 = (long)param_2 + -1; uVar2 = (((long)param_2 * 4 + 0xfU) / 0x10) * 0x10; for (puVar3 = auStack_58; puVar3 != auStack_58 + -(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); } local_40 = 0; for (local_3c = 0; local_3c < local_54; local_3c = local_3c + 1) { if (0 < *(int *)(local_50 + (long)local_3c * 4)) { *(int4 *)(puVar3 + (long)local_40 * 4 + lVar1) = *(int4 *)((long)local_3c * 4 + local_50); local_40 = local_40 + 1; } } __nmemb = (size_t)local_40; local_28 = puVar3 + lVar1; *(int8 *)(puVar3 + lVar1 + -8) = 0x1012ed; qsort(puVar3 + lVar1,__nmemb,4,compare); local_38 = 0; for (local_34 = 0; (local_34 < 3 && (local_34 < local_40)); local_34 = local_34 + 1) { local_38 = local_38 + *(int *)(local_28 + (long)local_34 * 4); } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_38; }
5,253
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> int compare(const void * a, const void * b) { return (*(int*)a - *(int*)b); }
int func0(int lst[], int size) { int positive_numbers[size]; int count = 0; for (int i = 0; i < size; i++) { if (lst[i] > 0) { positive_numbers[count++] = lst[i]; } } qsort(positive_numbers, count, sizeof(int), compare); int sum = 0; for (int i = 0; i < 3 && i < count; i++) { sum += positive_numbers[i]; } return sum; }
int main() { int arr1[] = {10, 20, 30, 40, 50, 60, 7}; int arr2[] = {1, 2, 3, 4, 5}; int arr3[] = {0, 1, 2, 3, 4, 5}; assert(func0(arr1, 7) == 37); assert(func0(arr2, 5) == 6); assert(func0(arr3, 6) == 6); return 0; }
O1
c
func0: endbr64 push %rbp mov %rsp,%rbp push %r12 push %rbx sub $0x10,%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 11e8 <func0+0x56> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) jmp 11d1 <func0+0x3f> mov %rdx,%rax and $0xfff,%eax sub %rax,%rsp test %rax,%rax je 11fe <func0+0x6c> orq $0x0,-0x8(%rsp,%rax,1) mov %rsp,%r8 mov %r8,%r12 test %esi,%esi jle 1293 <func0+0x101> mov %rdi,%rax lea -0x1(%rsi),%edx lea 0x4(%rdi,%rdx,4),%rsi mov $0x0,%ebx jmp 1227 <func0+0x95> add $0x4,%rax cmp %rsi,%rax je 1239 <func0+0xa7> mov (%rax),%edx test %edx,%edx jle 121e <func0+0x8c> movslq %ebx,%rcx mov %edx,(%r12,%rcx,4) lea 0x1(%rbx),%ebx jmp 121e <func0+0x8c> movslq %ebx,%rsi lea -0xba(%rip),%rcx mov $0x4,%edx mov %r8,%rdi callq 1070 <qsort@plt> test %ebx,%ebx jle 128c <func0+0xfa> mov $0x1,%eax mov $0x0,%ecx add -0x4(%r12,%rax,4),%ecx mov %eax,%edx add $0x1,%rax cmp $0x2,%edx jg 1272 <func0+0xe0> cmp %edx,%ebx jg 125e <func0+0xcc> mov -0x18(%rbp),%rax xor %fs:0x28,%rax jne 12b3 <func0+0x121> mov %ecx,%eax lea -0x10(%rbp),%rsp pop %rbx pop %r12 pop %rbp retq mov $0x0,%ecx jmp 1272 <func0+0xe0> lea -0x111(%rip),%rcx mov $0x4,%edx mov $0x0,%esi mov %r8,%rdi callq 1070 <qsort@plt> mov $0x0,%ecx jmp 1272 <func0+0xe0> callq 1080 <__stack_chk_fail@plt>
func0: endbr64 push rbp mov rbp, rsp push r12 push rbx sub rsp, 10h mov rdx, rdi mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax movsxd rax, esi lea rax, ds:0Fh[rax*4] mov rdi, rax and rdi, 0FFFFFFFFFFFFFFF0h and rax, 0FFFFFFFFFFFFF000h mov rcx, rsp sub rcx, rax loc_11D1: cmp rsp, rcx jz short loc_11E8 sub rsp, 1000h or [rsp+1020h+var_28], 0 jmp short loc_11D1 loc_11E8: mov rax, rdi and eax, 0FFFh sub rsp, rax test rax, rax jz short loc_11FE or [rsp+rax+20h+var_28], 0 loc_11FE: mov r12, rsp test esi, esi jle loc_1290 mov rax, rdx lea ecx, [rsi-1] lea rsi, [rdx+rcx*4+4] mov ebx, 0 jmp short loc_122E loc_121B: movsxd rcx, ebx mov [r12+rcx*4], edx lea ebx, [rbx+1] loc_1225: add rax, 4 cmp rax, rsi jz short loc_1236 loc_122E: mov edx, [rax] test edx, edx jg short loc_121B jmp short loc_1225 loc_1236: movsxd rsi, ebx lea rcx, compare mov edx, 4 mov rdi, r12 call _qsort test ebx, ebx jle short loc_1289 mov eax, 1 mov ecx, 0 loc_125B: add ecx, [r12+rax*4-4] mov edx, eax add rax, 1 cmp edx, 2 jg short loc_126F cmp ebx, edx jg short loc_125B loc_126F: mov rax, [rbp+var_18] sub rax, fs:28h jnz short loc_12B0 mov eax, ecx lea rsp, [rbp-10h] pop rbx pop r12 pop rbp retn loc_1289: mov ecx, 0 jmp short loc_126F loc_1290: lea rcx, compare mov edx, 4 mov esi, 0 mov rdi, r12 call _qsort mov ecx, 0 jmp short loc_126F loc_12B0: call ___stack_chk_fail
long long func0(_DWORD *a1, int a2) { signed long long v2; // rax void *v3; // rsp _DWORD *v4; // rax long long v5; // rsi int v6; // ebx long long v7; // rax unsigned int v8; // ecx int v9; // edx _DWORD v12[2]; // [rsp+8h] [rbp-20h] BYREF unsigned long long v13; // [rsp+10h] [rbp-18h] v13 = __readfsqword(0x28u); while ( v12 != (_DWORD *)((char *)v12 - ((4LL * a2 + 15) & 0xFFFFFFFFFFFFF000LL)) ) ; v2 = (4 * (_WORD)a2 + 15) & 0xFF0; v3 = alloca(v2); if ( ((4 * (_WORD)a2 + 15) & 0xFF0) != 0 ) *(_QWORD *)((char *)&v12[-2] + v2) = *(_QWORD *)((char *)&v12[-2] + v2); if ( a2 <= 0 ) { qsort(v12, 0LL, 4LL, compare); return 0; } else { v4 = a1; v5 = (long long)&a1[a2 - 1 + 1]; v6 = 0; do { if ( (int)*v4 > 0 ) v12[v6++] = *v4; ++v4; } while ( v4 != (_DWORD *)v5 ); qsort(v12, v6, 4LL, compare); if ( v6 <= 0 ) { return 0; } else { v7 = 1LL; v8 = 0; do { v8 += v12[v7 - 1]; v9 = v7++; } while ( v9 <= 2 && v6 > v9 ); } } return v8; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R12 PUSH RBX SUB RSP,0x10 MOV RDX,RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOVSXD RAX,ESI LEA RAX,[0xf + RAX*0x4] MOV RDI,RAX AND RDI,-0x10 AND RAX,-0x1000 MOV RCX,RSP SUB RCX,RAX LAB_001011d1: CMP RSP,RCX JZ 0x001011e8 SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 JMP 0x001011d1 LAB_001011e8: MOV RAX,RDI AND EAX,0xfff SUB RSP,RAX TEST RAX,RAX JZ 0x001011fe OR qword ptr [RSP + RAX*0x1 + -0x8],0x0 LAB_001011fe: MOV R12,RSP TEST ESI,ESI JLE 0x00101290 MOV RAX,RDX LEA ECX,[RSI + -0x1] LEA RSI,[RDX + RCX*0x4 + 0x4] MOV EBX,0x0 JMP 0x0010122e LAB_0010121b: MOVSXD RCX,EBX MOV dword ptr [R12 + RCX*0x4],EDX LEA EBX,[RBX + 0x1] LAB_00101225: ADD RAX,0x4 CMP RAX,RSI JZ 0x00101236 LAB_0010122e: MOV EDX,dword ptr [RAX] TEST EDX,EDX JG 0x0010121b JMP 0x00101225 LAB_00101236: MOVSXD RSI,EBX LEA RCX,[0x101189] MOV EDX,0x4 MOV RDI,R12 CALL 0x00101070 TEST EBX,EBX JLE 0x00101289 MOV EAX,0x1 MOV ECX,0x0 LAB_0010125b: ADD ECX,dword ptr [R12 + RAX*0x4 + -0x4] MOV EDX,EAX ADD RAX,0x1 CMP EDX,0x2 JG 0x0010126f CMP EBX,EDX JG 0x0010125b LAB_0010126f: MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JNZ 0x001012b0 MOV EAX,ECX LEA RSP,[RBP + -0x10] POP RBX POP R12 POP RBP RET LAB_00101289: MOV ECX,0x0 JMP 0x0010126f LAB_00101290: LEA RCX,[0x101189] MOV EDX,0x4 MOV ESI,0x0 MOV RDI,R12 CALL 0x00101070 MOV ECX,0x0 JMP 0x0010126f LAB_001012b0: CALL 0x00101080
int func0(int *param_1,int param_2) { int *piVar1; long lVar2; ulong uVar3; long lVar4; int iVar5; int iVar6; int iVar7; int1 *puVar8; long in_FS_OFFSET; int1 auStack_28 [8]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); uVar3 = (long)param_2 * 4 + 0xf; for (puVar8 = auStack_28; puVar8 != auStack_28 + -(uVar3 & 0xfffffffffffff000); puVar8 = puVar8 + -0x1000) { *(int8 *)(puVar8 + -8) = *(int8 *)(puVar8 + -8); } uVar3 = (ulong)((uint)uVar3 & 0xff0); lVar2 = -uVar3; if (uVar3 != 0) { *(int8 *)(puVar8 + -8) = *(int8 *)(puVar8 + -8); } if (param_2 < 1) { *(int8 *)(puVar8 + lVar2 + -8) = 0x1012a9; qsort(puVar8 + lVar2,0,4,compare); iVar5 = 0; } else { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar7 = 0; do { if (0 < *param_1) { *(int *)(puVar8 + (long)iVar7 * 4 + lVar2) = *param_1; iVar7 = iVar7 + 1; } param_1 = param_1 + 1; } while (param_1 != piVar1); *(int8 *)(puVar8 + lVar2 + -8) = 0x10124d; qsort(puVar8 + lVar2,(long)iVar7,4,compare); if (iVar7 < 1) { iVar5 = 0; } else { iVar5 = 0; lVar4 = 1; do { iVar5 = iVar5 + *(int *)(puVar8 + lVar4 * 4 + lVar2 + -4); iVar6 = (int)lVar4; if (2 < iVar6) break; lVar4 = lVar4 + 1; } while (iVar6 < iVar7); } } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(code **)(puVar8 + lVar2 + -8) = main; __stack_chk_fail(); } return iVar5; }
5,254
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> int compare(const void * a, const void * b) { return (*(int*)a - *(int*)b); }
int func0(int lst[], int size) { int positive_numbers[size]; int count = 0; for (int i = 0; i < size; i++) { if (lst[i] > 0) { positive_numbers[count++] = lst[i]; } } qsort(positive_numbers, count, sizeof(int), compare); int sum = 0; for (int i = 0; i < 3 && i < count; i++) { sum += positive_numbers[i]; } return sum; }
int main() { int arr1[] = {10, 20, 30, 40, 50, 60, 7}; int arr2[] = {1, 2, 3, 4, 5}; int arr3[] = {0, 1, 2, 3, 4, 5}; assert(func0(arr1, 7) == 37); assert(func0(arr2, 5) == 6); assert(func0(arr3, 6) == 6); return 0; }
O2
c
func0: endbr64 push %rbp mov %rsp,%rbp push %r12 push %rbx sub $0x10,%rsp mov %fs:0x28,%rax mov %rax,-0x18(%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 1359 <func0+0x59> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 1344 <func0+0x44> and $0xfff,%edx sub %rdx,%rsp test %rdx,%rdx jne 1410 <func0+0x110> mov %rsp,%r12 test %esi,%esi jle 13eb <func0+0xeb> lea -0x1(%rsi),%eax xor %ebx,%ebx lea 0x4(%rdi,%rax,4),%rcx nopl 0x0(%rax) mov (%rdi),%eax test %eax,%eax jle 1390 <func0+0x90> movslq %ebx,%rdx add $0x1,%ebx mov %eax,(%r12,%rdx,4) add $0x4,%rdi cmp %rcx,%rdi jne 1380 <func0+0x80> movslq %ebx,%rsi lea -0xb3(%rip),%rcx mov $0x4,%edx mov %r12,%rdi callq 1070 <qsort@plt> test %ebx,%ebx je 1401 <func0+0x101> mov $0x1,%eax xor %r8d,%r8d mov %eax,%edx add -0x4(%r12,%rax,4),%r8d add $0x1,%rax cmp $0x2,%edx jg 13d0 <func0+0xd0> cmp %edx,%ebx jg 13bc <func0+0xbc> mov -0x18(%rbp),%rax xor %fs:0x28,%rax jne 141b <func0+0x11b> lea -0x10(%rbp),%rsp mov %r8d,%eax pop %rbx pop %r12 pop %rbp retq lea -0x102(%rip),%rcx mov $0x4,%edx xor %esi,%esi mov %r12,%rdi callq 1070 <qsort@plt> xor %r8d,%r8d jmp 13d0 <func0+0xd0> nopw %cs:0x0(%rax,%rax,1) orq $0x0,-0x8(%rsp,%rdx,1) jmpq 136b <func0+0x6b> callq 1080 <__stack_chk_fail@plt>
func0: endbr64 push rbp mov rbp, rsp push r12 push rbx sub rsp, 10h mov rax, fs:28h mov [rbp+var_18], 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_1346 loc_1331: sub rsp, 1000h or [rsp+1020h+var_28], 0 cmp rsp, rcx jnz short loc_1331 loc_1346: and edx, 0FFFh sub rsp, rdx test rdx, rdx jnz loc_1400 loc_1358: mov r12, rsp test esi, esi jle short loc_13DB lea eax, [rsi-1] xor ebx, ebx lea rcx, [rdi+rax*4+4] nop dword ptr [rax+00000000h] loc_1370: mov eax, [rdi] test eax, eax jle short loc_1380 movsxd rdx, ebx add ebx, 1 mov [r12+rdx*4], eax loc_1380: add rdi, 4 cmp rdi, rcx jnz short loc_1370 movsxd rsi, ebx lea rcx, compare mov edx, 4 mov rdi, r12 call _qsort test ebx, ebx jz short loc_13F1 mov eax, 1 xor r8d, r8d loc_13AC: mov edx, eax add r8d, [r12+rax*4-4] add rax, 1 cmp edx, 2 jg short loc_13C0 cmp ebx, edx jg short loc_13AC loc_13C0: mov rax, [rbp+var_18] sub rax, fs:28h jnz short loc_140B lea rsp, [rbp-10h] mov eax, r8d pop rbx pop r12 pop rbp retn loc_13DB: lea rcx, compare mov edx, 4 xor esi, esi mov rdi, r12 call _qsort loc_13F1: xor r8d, r8d jmp short loc_13C0 loc_1400: or [rsp+rdx+1020h+var_1028], 0 jmp loc_1358 loc_140B: call ___stack_chk_fail
long long func0(_DWORD *a1, int a2) { long long v2; // rdx _DWORD *v3; // rcx __int16 v4; // dx signed long long v5; // rdx void *v6; // rsp int v7; // ebx long long v8; // rcx long long v9; // rdx long long v10; // rax unsigned int v11; // r8d int v12; // edx _DWORD v15[1022]; // [rsp+8h] [rbp-1020h] BYREF _QWORD v16[4]; // [rsp+1008h] [rbp-20h] BYREF v16[1] = __readfsqword(0x28u); v2 = 4LL * a2 + 15; v3 = (_DWORD *)((char *)v16 - (v2 & 0xFFFFFFFFFFFFF000LL)); v4 = v2 & 0xFFF0; if ( v16 != (_QWORD *)v3 ) { while ( v15 != v3 ) ; } v5 = v4 & 0xFFF; v6 = alloca(v5); if ( v5 ) *(_QWORD *)((char *)&v15[-2] + v5) = *(_QWORD *)((char *)&v15[-2] + v5); if ( a2 <= 0 ) { qsort(v15, 0LL, 4LL, compare); return 0; } v7 = 0; v8 = (long long)&a1[a2 - 1 + 1]; do { if ( (int)*a1 > 0 ) { v9 = v7++; v15[v9] = *a1; } ++a1; } while ( a1 != (_DWORD *)v8 ); qsort(v15, v7, 4LL, compare); if ( !v7 ) return 0; v10 = 1LL; v11 = 0; do { v12 = v10; v11 += v15[v10++ - 1]; } while ( v12 <= 2 && v7 > v12 ); return v11; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R12 PUSH RBX SUB RSP,0x10 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],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 0x00101346 LAB_00101331: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RCX JNZ 0x00101331 LAB_00101346: AND EDX,0xfff SUB RSP,RDX TEST RDX,RDX JNZ 0x00101400 LAB_00101358: MOV R12,RSP TEST ESI,ESI JLE 0x001013db LEA EAX,[RSI + -0x1] XOR EBX,EBX LEA RCX,[RDI + RAX*0x4 + 0x4] NOP dword ptr [RAX] LAB_00101370: MOV EAX,dword ptr [RDI] TEST EAX,EAX JLE 0x00101380 MOVSXD RDX,EBX ADD EBX,0x1 MOV dword ptr [R12 + RDX*0x4],EAX LAB_00101380: ADD RDI,0x4 CMP RDI,RCX JNZ 0x00101370 MOVSXD RSI,EBX LEA RCX,[0x1012e0] MOV EDX,0x4 MOV RDI,R12 CALL 0x00101070 TEST EBX,EBX JZ 0x001013f1 MOV EAX,0x1 XOR R8D,R8D LAB_001013ac: MOV EDX,EAX ADD R8D,dword ptr [R12 + RAX*0x4 + -0x4] ADD RAX,0x1 CMP EDX,0x2 JG 0x001013c0 CMP EBX,EDX JG 0x001013ac LAB_001013c0: MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010140b LEA RSP,[RBP + -0x10] MOV EAX,R8D POP RBX POP R12 POP RBP RET LAB_001013db: LEA RCX,[0x1012e0] MOV EDX,0x4 XOR ESI,ESI MOV RDI,R12 CALL 0x00101070 LAB_001013f1: XOR R8D,R8D JMP 0x001013c0 LAB_00101400: OR qword ptr [RSP + RDX*0x1 + -0x8],0x0 JMP 0x00101358 LAB_0010140b: CALL 0x00101080
int func0(int *param_1,int param_2) { int *piVar1; long lVar2; int1 *puVar3; int iVar4; ulong uVar5; long lVar6; int iVar7; int1 *puVar8; int iVar10; long in_FS_OFFSET; int1 auStack_28 [8]; long local_20; int1 *puVar9; puVar8 = auStack_28; local_20 = *(long *)(in_FS_OFFSET + 0x28); uVar5 = (long)param_2 * 4 + 0xf; puVar9 = auStack_28; puVar3 = auStack_28; while (puVar9 != auStack_28 + -(uVar5 & 0xfffffffffffff000)) { puVar8 = puVar3 + -0x1000; *(int8 *)(puVar3 + -8) = *(int8 *)(puVar3 + -8); puVar9 = puVar3 + -0x1000; puVar3 = puVar3 + -0x1000; } uVar5 = (ulong)((uint)uVar5 & 0xff0); lVar2 = -uVar5; if (uVar5 != 0) { *(int8 *)(puVar8 + -8) = *(int8 *)(puVar8 + -8); } if (param_2 < 1) { *(int8 *)(puVar8 + lVar2 + -8) = 0x1013f1; qsort(puVar8 + lVar2,0,4,compare); } else { iVar7 = 0; piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if (0 < *param_1) { lVar6 = (long)iVar7; iVar7 = iVar7 + 1; *(int *)(puVar8 + lVar6 * 4 + lVar2) = *param_1; } param_1 = param_1 + 1; } while (param_1 != piVar1); *(int8 *)(puVar8 + lVar2 + -8) = 0x1013a0; qsort(puVar8 + lVar2,(long)iVar7,4,compare); if (iVar7 != 0) { iVar10 = 0; lVar6 = 1; do { iVar10 = iVar10 + *(int *)(puVar8 + lVar6 * 4 + lVar2 + -4); iVar4 = (int)lVar6; if (2 < iVar4) break; lVar6 = lVar6 + 1; } while (iVar4 < iVar7); goto LAB_001013c0; } } iVar10 = 0; LAB_001013c0: if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(code **)(puVar8 + lVar2 + -8) = _fini; __stack_chk_fail(); } return iVar10; }
5,255
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> int compare(const void * a, const void * b) { return (*(int*)a - *(int*)b); }
int func0(int lst[], int size) { int positive_numbers[size]; int count = 0; for (int i = 0; i < size; i++) { if (lst[i] > 0) { positive_numbers[count++] = lst[i]; } } qsort(positive_numbers, count, sizeof(int), compare); int sum = 0; for (int i = 0; i < 3 && i < count; i++) { sum += positive_numbers[i]; } return sum; }
int main() { int arr1[] = {10, 20, 30, 40, 50, 60, 7}; int arr2[] = {1, 2, 3, 4, 5}; int arr3[] = {0, 1, 2, 3, 4, 5}; assert(func0(arr1, 7) == 37); assert(func0(arr2, 5) == 6); assert(func0(arr3, 6) == 6); return 0; }
O3
c
func0: endbr64 push %rbp mov %rsp,%rbp push %r12 push %rbx sub $0x10,%rsp mov %fs:0x28,%rax mov %rax,-0x18(%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 1319 <func0+0x59> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 1304 <func0+0x44> and $0xfff,%edx sub %rdx,%rsp test %rdx,%rdx jne 13e0 <func0+0x120> lea 0x3(%rsp),%r8 mov %r8,%r12 and $0xfffffffffffffffc,%r8 shr $0x2,%r12 test %esi,%esi jle 13be <func0+0xfe> lea -0x1(%rsi),%eax xor %ebx,%ebx lea 0x4(%rdi,%rax,4),%rcx nopl 0x0(%rax) mov (%rdi),%eax test %eax,%eax jle 1360 <func0+0xa0> movslq %ebx,%rdx add $0x1,%ebx mov %eax,(%r8,%rdx,4) add $0x4,%rdi cmp %rcx,%rdi jne 1350 <func0+0x90> movslq %ebx,%rsi lea -0xc3(%rip),%rcx mov $0x4,%edx mov %r8,%rdi callq 1070 <qsort@plt> test %ebx,%ebx je 13d4 <func0+0x114> mov 0x0(,%r12,4),%eax cmp $0x1,%ebx jle 13a6 <func0+0xe6> add 0x4(,%r12,4),%eax cmp $0x2,%ebx jle 13a6 <func0+0xe6> add 0x8(,%r12,4),%eax mov -0x18(%rbp),%rsi xor %fs:0x28,%rsi jne 13eb <func0+0x12b> lea -0x10(%rbp),%rsp pop %rbx pop %r12 pop %rbp retq lea -0x115(%rip),%rcx mov $0x4,%edx xor %esi,%esi mov %r8,%rdi callq 1070 <qsort@plt> xor %eax,%eax jmp 13a6 <func0+0xe6> nopl 0x0(%rax,%rax,1) orq $0x0,-0x8(%rsp,%rdx,1) jmpq 132b <func0+0x6b> callq 1080 <__stack_chk_fail@plt>
func0: endbr64 push rbp movsxd rcx, esi mov rax, rdi shl rcx, 2 mov rbp, rsp push r12 push rbx sub rsp, 10h mov rdx, fs:28h mov [rbp+var_18], rdx xor edx, edx lea rdx, [rcx+0Fh] mov r8, rsp mov rdi, rdx and rdx, 0FFFFFFFFFFFFF000h sub r8, rdx and rdi, 0FFFFFFFFFFFFFFF0h cmp rsp, r8 jz short loc_131A loc_1305: sub rsp, 1000h or [rsp+1020h+var_28], 0 cmp rsp, r8 jnz short loc_1305 loc_131A: and edi, 0FFFh sub rsp, rdi test rdi, rdi jnz loc_13C0 loc_132C: lea rdi, [rsp+1020h+var_101D] mov rbx, rdi and rdi, 0FFFFFFFFFFFFFFFCh; base shr rbx, 2 test esi, esi jle loc_13CB add rcx, rax xor r12d, r12d nop word ptr [rax+rax+00h] loc_1350: mov edx, [rax] test edx, edx jle short loc_1360 movsxd rsi, r12d add r12d, 1 mov [rdi+rsi*4], edx loc_1360: add rax, 4 cmp rcx, rax jnz short loc_1350 movsxd rsi, r12d; nmemb lea rcx, compare; compar mov edx, 4; size call _qsort test r12d, r12d jle short loc_13DE mov eax, ds:dword_0[rbx*4] cmp r12d, 1 jz short loc_13A3 add eax, dword ptr ds:byte_4[rbx*4] cmp r12d, 2 jz short loc_13A3 add eax, dword ptr ds:byte_8[rbx*4] loc_13A3: mov rdx, [rbp+var_18] sub rdx, fs:28h jnz short loc_13E2 lea rsp, [rbp-10h] pop rbx pop r12 pop rbp retn loc_13C0: or [rsp+rdi+1020h+var_1028], 0 jmp loc_132C loc_13CB: lea rcx, compare; compar mov edx, 4; size xor esi, esi; nmemb call _qsort loc_13DE: xor eax, eax jmp short loc_13A3 loc_13E2: call ___stack_chk_fail
long long func0(_DWORD *a1, int a2) { long long v3; // rcx _DWORD *v4; // r8 signed long long v5; // rdi void *v6; // rsp _DWORD *v7; // rcx int v8; // r12d long long v9; // rsi long long result; // rax _DWORD v12[1022]; // [rsp+8h] [rbp-1020h] BYREF _QWORD v13[4]; // [rsp+1008h] [rbp-20h] BYREF v3 = 4LL * a2; v13[1] = __readfsqword(0x28u); v4 = (_DWORD *)((char *)v13 - ((v3 + 15) & 0xFFFFFFFFFFFFF000LL)); if ( v13 != (_QWORD *)v4 ) { while ( v12 != v4 ) ; } v5 = ((_WORD)v3 + 15) & 0xFF0; v6 = alloca(v5); if ( (((_WORD)v3 + 15) & 0xFF0) != 0 ) *(_QWORD *)((char *)&v12[-2] + v5) = *(_QWORD *)((char *)&v12[-2] + v5); if ( a2 <= 0 ) { qsort(v12, 0LL, 4uLL, compare); return 0LL; } v7 = &a1[(unsigned long long)v3 / 4]; v8 = 0; do { if ( (int)*a1 > 0 ) { v9 = v8++; v12[v9] = *a1; } ++a1; } while ( v7 != a1 ); qsort(v12, v8, 4uLL, compare); if ( v8 <= 0 ) return 0LL; result = v12[0]; if ( v8 != 1 ) { result = (unsigned int)(v12[1] + v12[0]); if ( v8 != 2 ) return (unsigned int)(v12[2] + result); } return result; }
func0: ENDBR64 PUSH RBP MOVSXD RCX,ESI MOV RAX,RDI SHL RCX,0x2 MOV RBP,RSP PUSH R12 PUSH RBX SUB RSP,0x10 MOV RDX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RDX XOR EDX,EDX LEA RDX,[RCX + 0xf] MOV R8,RSP MOV RDI,RDX AND RDX,-0x1000 SUB R8,RDX AND RDI,-0x10 CMP RSP,R8 JZ 0x0010131a LAB_00101305: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,R8 JNZ 0x00101305 LAB_0010131a: AND EDI,0xfff SUB RSP,RDI TEST RDI,RDI JNZ 0x001013c0 LAB_0010132c: LEA RDI,[RSP + 0x3] MOV RBX,RDI AND RDI,-0x4 SHR RBX,0x2 TEST ESI,ESI JLE 0x001013cb ADD RCX,RAX XOR R12D,R12D NOP word ptr [RAX + RAX*0x1] LAB_00101350: MOV EDX,dword ptr [RAX] TEST EDX,EDX JLE 0x00101360 MOVSXD RSI,R12D ADD R12D,0x1 MOV dword ptr [RDI + RSI*0x4],EDX LAB_00101360: ADD RAX,0x4 CMP RCX,RAX JNZ 0x00101350 MOVSXD RSI,R12D LEA RCX,[0x1012b0] MOV EDX,0x4 CALL 0x00101070 TEST R12D,R12D JLE 0x001013de MOV EAX,dword ptr [RBX*0x4] CMP R12D,0x1 JZ 0x001013a3 ADD EAX,dword ptr [0x4 + RBX*0x4] CMP R12D,0x2 JZ 0x001013a3 ADD EAX,dword ptr [0x8 + RBX*0x4] LAB_001013a3: MOV RDX,qword ptr [RBP + -0x18] SUB RDX,qword ptr FS:[0x28] JNZ 0x001013e2 LEA RSP,[RBP + -0x10] POP RBX POP R12 POP RBP RET LAB_001013c0: OR qword ptr [RSP + RDI*0x1 + -0x8],0x0 JMP 0x0010132c LAB_001013cb: LEA RCX,[0x1012b0] MOV EDX,0x4 XOR ESI,ESI CALL 0x00101070 LAB_001013de: XOR EAX,EAX JMP 0x001013a3 LAB_001013e2: CALL 0x00101080
int func0(int *param_1,int param_2) { long lVar1; int *puVar2; int iVar3; int *piVar4; ulong uVar5; int *puVar6; long lVar8; int iVar9; long in_FS_OFFSET; int auStack_28 [8]; long local_20; int *puVar7; puVar6 = auStack_28; local_20 = *(long *)(in_FS_OFFSET + 0x28); uVar5 = (long)param_2 * 4 + 0xf; puVar7 = auStack_28; puVar2 = auStack_28; while (puVar7 != auStack_28 + -(uVar5 & 0xfffffffffffff000)) { puVar6 = puVar2 + -0x1000; *(int8 *)(puVar2 + -8) = *(int8 *)(puVar2 + -8); puVar7 = puVar2 + -0x1000; puVar2 = puVar2 + -0x1000; } uVar5 = (ulong)((uint)uVar5 & 0xff0); lVar1 = -uVar5; if (uVar5 != 0) { *(int8 *)(puVar6 + -8) = *(int8 *)(puVar6 + -8); } uVar5 = (ulong)(puVar6 + lVar1 + 3) >> 2; if (param_2 < 1) { *(int8 *)(puVar6 + lVar1 + -8) = 0x1013de; qsort(puVar6 + lVar1,0,4,compare); } else { piVar4 = param_1 + param_2; iVar9 = 0; do { if (0 < *param_1) { lVar8 = (long)iVar9; iVar9 = iVar9 + 1; *(int *)(puVar6 + lVar8 * 4 + lVar1) = *param_1; } param_1 = param_1 + 1; } while (piVar4 != param_1); *(int8 *)(puVar6 + lVar1 + -8) = 0x10137d; qsort(puVar6 + lVar1,(long)iVar9,4,compare); if (0 < iVar9) { iVar3 = *(int *)(uVar5 * 4); if ((iVar9 != 1) && (iVar3 = iVar3 + *(int *)(uVar5 * 4 + 4), iVar9 != 2)) { iVar3 = iVar3 + *(int *)(uVar5 * 4 + 8); } goto LAB_001013a3; } } iVar3 = 0; LAB_001013a3: if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(int8 *)(puVar6 + lVar1 + -8) = 0x1013e7; __stack_chk_fail(); } return iVar3; }
5,256
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> int cmpfunc (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); }
void func0(int arr[], int n, int result[]) { qsort(arr, n, sizeof(int), cmpfunc); for (int i = 0; i < n; i++) { result[i] = arr[i]; } }
int main() { int result[5]; int set1[] = {1, 2, 3, 4, 5}; func0(set1, 5, result); assert(result[0] == 1 && result[1] == 2 && result[2] == 3 && result[3] == 4 && result[4] == 5); int set2[] = {6, 7, 8, 9, 10, 11}; func0(set2, 6, result); assert(result[0] == 6 && result[1] == 7 && result[2] == 8 && result[3] == 9 && result[4] == 10 && result[5] == 11); int set3[] = {12, 13, 14, 15, 16}; func0(set3, 5, result); assert(result[0] == 12 && result[1] == 13 && result[2] == 14 && result[3] == 15 && result[4] == 16); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %rdx,-0x28(%rbp) mov -0x1c(%rbp),%eax movslq %eax,%rsi mov -0x18(%rbp),%rax lea -0x4a(%rip),%rcx mov $0x4,%edx mov %rax,%rdi callq 1070 <qsort@plt> movl $0x0,-0x4(%rbp) jmp 121a <func0+0x6f> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0x4(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x28(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11e9 <func0+0x3e> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+base], rdi mov [rbp+var_1C], esi mov [rbp+var_28], rdx mov eax, [rbp+var_1C] movsxd rsi, eax; nmemb mov rax, [rbp+base] lea rdx, cmpfunc mov rcx, rdx; compar mov edx, 4; size mov rdi, rax; base call _qsort mov [rbp+var_4], 0 jmp short loc_121D loc_11EC: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+base] add rax, rdx mov edx, [rbp+var_4] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+var_28] add rdx, rcx mov eax, [rax] mov [rdx], eax add [rbp+var_4], 1 loc_121D: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_11EC nop nop leave retn
long long func0(void *a1, int a2, long long a3) { long long result; // rax unsigned int i; // [rsp+2Ch] [rbp-4h] qsort(a1, a2, 4uLL, cmpfunc); for ( i = 0; ; ++i ) { result = i; if ( (int)i >= a2 ) break; *(_DWORD *)(4LL * (int)i + a3) = *((_DWORD *)a1 + (int)i); } return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV qword ptr [RBP + -0x28],RDX MOV EAX,dword ptr [RBP + -0x1c] MOVSXD RSI,EAX MOV RAX,qword ptr [RBP + -0x18] LEA RDX,[0x101189] MOV RCX,RDX MOV EDX,0x4 MOV RDI,RAX CALL 0x00101070 MOV dword ptr [RBP + -0x4],0x0 JMP 0x0010121d LAB_001011ec: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0x4] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x28] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX ADD dword ptr [RBP + -0x4],0x1 LAB_0010121d: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011ec NOP NOP LEAVE RET
void func0(void *param_1,int param_2,long param_3) { int local_c; qsort(param_1,(long)param_2,4,cmpfunc); for (local_c = 0; local_c < param_2; local_c = local_c + 1) { *(int4 *)(param_3 + (long)local_c * 4) = *(int4 *)((long)param_1 + (long)local_c * 4); } return; }
5,257
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> int cmpfunc (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); }
void func0(int arr[], int n, int result[]) { qsort(arr, n, sizeof(int), cmpfunc); for (int i = 0; i < n; i++) { result[i] = arr[i]; } }
int main() { int result[5]; int set1[] = {1, 2, 3, 4, 5}; func0(set1, 5, result); assert(result[0] == 1 && result[1] == 2 && result[2] == 3 && result[3] == 4 && result[4] == 5); int set2[] = {6, 7, 8, 9, 10, 11}; func0(set2, 6, result); assert(result[0] == 6 && result[1] == 7 && result[2] == 8 && result[3] == 9 && result[4] == 10 && result[5] == 11); int set3[] = {12, 13, 14, 15, 16}; func0(set3, 5, result); assert(result[0] == 12 && result[1] == 13 && result[2] == 14 && result[3] == 15 && result[4] == 16); return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx mov %rdi,%rbx mov %esi,%r12d mov %rdx,%rbp movslq %esi,%rsi lea -0x24(%rip),%rcx mov $0x4,%edx callq 1070 <qsort@plt> test %r12d,%r12d jle 11d9 <func0+0x47> lea -0x1(%r12),%ecx mov $0x0,%eax mov (%rbx,%rax,4),%edx mov %edx,0x0(%rbp,%rax,4) mov %rax,%rdx add $0x1,%rax cmp %rcx,%rdx jne 11c6 <func0+0x34> pop %rbx pop %rbp pop %r12 retq
func0: endbr64 push r12 push rbp push rbx mov rbp, rdi mov ebx, esi mov r12, rdx movsxd rsi, esi lea rcx, cmpfunc mov edx, 4 call _qsort test ebx, ebx jle short loc_11D2 mov esi, ebx mov eax, 0 loc_11C1: mov edx, [rbp+rax*4+0] mov [r12+rax*4], edx add rax, 1 cmp rax, rsi jnz short loc_11C1 loc_11D2: pop rbx pop rbp pop r12 retn
long long func0(long long a1, int a2, long long a3) { long long result; // rax result = qsort(a1, a2, 4LL, cmpfunc); if ( a2 > 0 ) { for ( result = 0LL; result != a2; ++result ) *(_DWORD *)(a3 + 4 * result) = *(_DWORD *)(a1 + 4 * result); } return result; }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX MOV RBP,RDI MOV EBX,ESI MOV R12,RDX MOVSXD RSI,ESI LEA RCX,[0x101189] MOV EDX,0x4 CALL 0x00101070 TEST EBX,EBX JLE 0x001011d2 MOV ESI,EBX MOV EAX,0x0 LAB_001011c1: MOV EDX,dword ptr [RBP + RAX*0x4] MOV dword ptr [R12 + RAX*0x4],EDX ADD RAX,0x1 CMP RAX,RSI JNZ 0x001011c1 LAB_001011d2: POP RBX POP RBP POP R12 RET
void func0(void *param_1,uint param_2,long param_3) { ulong uVar1; qsort(param_1,(long)(int)param_2,4,cmpfunc); if (0 < (int)param_2) { uVar1 = 0; do { *(int4 *)(param_3 + uVar1 * 4) = *(int4 *)((long)param_1 + uVar1 * 4); uVar1 = uVar1 + 1; } while (uVar1 != param_2); } return; }
5,258
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> int cmpfunc (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); }
void func0(int arr[], int n, int result[]) { qsort(arr, n, sizeof(int), cmpfunc); for (int i = 0; i < n; i++) { result[i] = arr[i]; } }
int main() { int result[5]; int set1[] = {1, 2, 3, 4, 5}; func0(set1, 5, result); assert(result[0] == 1 && result[1] == 2 && result[2] == 3 && result[3] == 4 && result[4] == 5); int set2[] = {6, 7, 8, 9, 10, 11}; func0(set2, 6, result); assert(result[0] == 6 && result[1] == 7 && result[2] == 8 && result[3] == 9 && result[4] == 10 && result[5] == 11); int set3[] = {12, 13, 14, 15, 16}; func0(set3, 5, result); assert(result[0] == 12 && result[1] == 13 && result[2] == 14 && result[3] == 15 && result[4] == 16); return 0; }
O2
c
func0: endbr64 push %r12 movslq %esi,%rsi lea -0x20(%rip),%rcx push %rbp mov %rsi,%r12 mov %rdx,%rbp mov $0x4,%edx push %rbx mov %rdi,%rbx callq 1070 <qsort@plt> test %r12d,%r12d jle 13cb <func0+0x4b> lea -0x1(%r12),%ecx xor %eax,%eax nopl 0x0(%rax) mov (%rbx,%rax,4),%edx mov %edx,0x0(%rbp,%rax,4) mov %rax,%rdx add $0x1,%rax cmp %rcx,%rdx jne 13b8 <func0+0x38> pop %rbx pop %rbp pop %r12 retq
func0: endbr64 push r13 lea rcx, cmpfunc push r12 movsxd r12, esi push rbp mov rsi, r12 mov rbp, rdx mov edx, 4 push rbx mov rbx, rdi sub rsp, 8 call _qsort test r12d, r12d jle short loc_13C8 xor eax, eax nop word ptr [rax+rax+00h] loc_13B8: mov edx, [rbx+rax*4] mov [rbp+rax*4+0], edx add rax, 1 cmp rax, r12 jnz short loc_13B8 loc_13C8: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
long long func0(long long a1, int a2, long long a3) { long long result; // rax result = qsort(a1, a2, 4LL, cmpfunc); if ( a2 > 0 ) { for ( result = 0LL; result != a2; ++result ) *(_DWORD *)(a3 + 4 * result) = *(_DWORD *)(a1 + 4 * result); } return result; }
func0: ENDBR64 PUSH R13 LEA RCX,[0x101370] PUSH R12 MOVSXD R12,ESI PUSH RBP MOV RSI,R12 MOV RBP,RDX MOV EDX,0x4 PUSH RBX MOV RBX,RDI SUB RSP,0x8 CALL 0x00101070 TEST R12D,R12D JLE 0x001013c8 XOR EAX,EAX NOP word ptr [RAX + RAX*0x1] LAB_001013b8: MOV EDX,dword ptr [RBX + RAX*0x4] MOV dword ptr [RBP + RAX*0x4],EDX ADD RAX,0x1 CMP RAX,R12 JNZ 0x001013b8 LAB_001013c8: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
void func0(void *param_1,int param_2,long param_3) { size_t sVar1; qsort(param_1,(long)param_2,4,cmpfunc); if (0 < param_2) { sVar1 = 0; do { *(int4 *)(param_3 + sVar1 * 4) = *(int4 *)((long)param_1 + sVar1 * 4); sVar1 = sVar1 + 1; } while (sVar1 != (long)param_2); } return; }
5,259
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> int cmpfunc (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); }
void func0(int arr[], int n, int result[]) { qsort(arr, n, sizeof(int), cmpfunc); for (int i = 0; i < n; i++) { result[i] = arr[i]; } }
int main() { int result[5]; int set1[] = {1, 2, 3, 4, 5}; func0(set1, 5, result); assert(result[0] == 1 && result[1] == 2 && result[2] == 3 && result[3] == 4 && result[4] == 5); int set2[] = {6, 7, 8, 9, 10, 11}; func0(set2, 6, result); assert(result[0] == 6 && result[1] == 7 && result[2] == 8 && result[3] == 9 && result[4] == 10 && result[5] == 11); int set3[] = {12, 13, 14, 15, 16}; func0(set3, 5, result); assert(result[0] == 12 && result[1] == 13 && result[2] == 14 && result[3] == 15 && result[4] == 16); return 0; }
O3
c
func0: endbr64 push %r12 movslq %esi,%rsi lea -0x20(%rip),%rcx push %rbp mov %rsi,%r12 mov %rdx,%rbp mov $0x4,%edx push %rbx mov %rdi,%rbx callq 1070 <qsort@plt> test %r12d,%r12d jle 13db <func0+0x9b> lea 0xf(%rbx),%rdx lea -0x1(%r12),%eax sub %rbp,%rdx cmp $0x1e,%rdx jbe 13e0 <func0+0xa0> cmp $0x3,%eax jbe 13e0 <func0+0xa0> mov %r12d,%edx xor %eax,%eax shr $0x2,%edx shl $0x4,%rdx nopl (%rax) movdqu (%rbx,%rax,1),%xmm0 movups %xmm0,0x0(%rbp,%rax,1) add $0x10,%rax cmp %rdx,%rax jne 1390 <func0+0x50> mov %r12d,%eax and $0xfffffffc,%eax test $0x3,%r12b je 13db <func0+0x9b> mov %eax,%edx mov (%rbx,%rdx,4),%ecx mov %ecx,0x0(%rbp,%rdx,4) lea 0x1(%rax),%edx cmp %edx,%r12d jle 13db <func0+0x9b> movslq %edx,%rdx add $0x2,%eax mov (%rbx,%rdx,4),%ecx mov %ecx,0x0(%rbp,%rdx,4) cmp %eax,%r12d jle 13db <func0+0x9b> cltq mov (%rbx,%rax,4),%edx mov %edx,0x0(%rbp,%rax,4) pop %rbx pop %rbp pop %r12 retq mov %eax,%edx xor %eax,%eax nopl 0x0(%rax) mov (%rbx,%rax,4),%ecx mov %ecx,0x0(%rbp,%rax,4) mov %rax,%rcx add $0x1,%rax cmp %rdx,%rcx jne 13e8 <func0+0xa8> pop %rbx pop %rbp pop %r12 retq
func0: endbr64 push r13 movsxd r13, esi lea rcx, cmpfunc; compar push r12 mov rsi, r13; nmemb push rbp mov rbp, rdx mov edx, 4; size push rbx mov rbx, rdi sub rsp, 8 call _qsort test r13d, r13d jle short loc_13B0 lea eax, [r13-1] mov r12, r13 cmp eax, 2 jbe short loc_138C lea rdx, [rbx+4] mov rax, rbp sub rax, rdx cmp rax, 8 ja short loc_13C0 loc_138C: lea rcx, ds:0[r13*4] xor eax, eax nop word ptr [rax+rax+00000000h] loc_13A0: mov edx, [rbx+rax] mov [rbp+rax+0], edx add rax, 4 cmp rcx, rax jnz short loc_13A0 loc_13B0: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_13C0: mov edx, r13d xor eax, eax shr edx, 2 shl rdx, 4 nop dword ptr [rax+00h] loc_13D0: movdqu xmm0, xmmword ptr [rbx+rax] movups xmmword ptr [rbp+rax+0], xmm0 add rax, 10h cmp rax, rdx jnz short loc_13D0 mov eax, r12d and eax, 0FFFFFFFCh test r12b, 3 jz short loc_13B0 mov ecx, eax mov esi, [rbx+rcx*4] lea rdx, ds:0[rcx*4] mov [rbp+rcx*4+0], esi lea ecx, [rax+1] cmp r12d, ecx jle short loc_13B0 mov ecx, [rbx+rdx+4] add eax, 2 mov [rbp+rdx+4], ecx cmp r12d, eax jle short loc_13B0 mov eax, [rbx+rdx+8] mov [rbp+rdx+8], eax add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
void func0(char *a1, int a2, long long a3) { long long v4; // rax long long v5; // rax unsigned int v6; // eax long long v7; // rdx qsort(a1, a2, 4uLL, cmpfunc); if ( a2 > 0 ) { if ( (unsigned int)(a2 - 1) > 2 && (unsigned long long)(a3 - (_QWORD)(a1 + 4)) > 8 ) { v5 = 0LL; do { *(__m128i *)(a3 + v5) = _mm_loadu_si128((const __m128i *)&a1[v5]); v5 += 16LL; } while ( v5 != 16LL * ((unsigned int)a2 >> 2) ); v6 = a2 & 0xFFFFFFFC; if ( (a2 & 3) != 0 ) { v7 = 4LL * v6; *(_DWORD *)(a3 + v7) = *(_DWORD *)&a1[v7]; if ( a2 > (int)(v6 + 1) ) { *(_DWORD *)(a3 + v7 + 4) = *(_DWORD *)&a1[v7 + 4]; if ( a2 > (int)(v6 + 2) ) *(_DWORD *)(a3 + v7 + 8) = *(_DWORD *)&a1[v7 + 8]; } } } else { v4 = 0LL; do { *(_DWORD *)(a3 + v4) = *(_DWORD *)&a1[v4]; v4 += 4LL; } while ( 4LL * a2 != v4 ); } } }
func0: ENDBR64 PUSH R13 MOVSXD R13,ESI LEA RCX,[0x101330] PUSH R12 MOV RSI,R13 PUSH RBP MOV RBP,RDX MOV EDX,0x4 PUSH RBX MOV RBX,RDI SUB RSP,0x8 CALL 0x00101070 TEST R13D,R13D JLE 0x001013b0 LEA EAX,[R13 + -0x1] MOV R12,R13 CMP EAX,0x2 JBE 0x0010138c LEA RDX,[RBX + 0x4] MOV RAX,RBP SUB RAX,RDX CMP RAX,0x8 JA 0x001013c0 LAB_0010138c: LEA RCX,[R13*0x4] XOR EAX,EAX NOP word ptr CS:[RAX + RAX*0x1] LAB_001013a0: MOV EDX,dword ptr [RBX + RAX*0x1] MOV dword ptr [RBP + RAX*0x1],EDX ADD RAX,0x4 CMP RCX,RAX JNZ 0x001013a0 LAB_001013b0: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_001013c0: MOV EDX,R13D XOR EAX,EAX SHR EDX,0x2 SHL RDX,0x4 NOP dword ptr [RAX] LAB_001013d0: MOVDQU XMM0,xmmword ptr [RBX + RAX*0x1] MOVUPS xmmword ptr [RBP + RAX*0x1],XMM0 ADD RAX,0x10 CMP RAX,RDX JNZ 0x001013d0 MOV EAX,R12D AND EAX,0xfffffffc TEST R12B,0x3 JZ 0x001013b0 MOV ECX,EAX MOV ESI,dword ptr [RBX + RCX*0x4] LEA RDX,[RCX*0x4] MOV dword ptr [RBP + RCX*0x4],ESI LEA ECX,[RAX + 0x1] CMP R12D,ECX JLE 0x001013b0 MOV ECX,dword ptr [RBX + RDX*0x1 + 0x4] ADD EAX,0x2 MOV dword ptr [RBP + RDX*0x1 + 0x4],ECX CMP R12D,EAX JLE 0x001013b0 MOV EAX,dword ptr [RBX + RDX*0x1 + 0x8] MOV dword ptr [RBP + RDX*0x1 + 0x8],EAX ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
void func0(void *param_1,uint param_2,long param_3) { int8 uVar1; uint uVar2; long lVar3; ulong uVar4; size_t __nmemb; __nmemb = (size_t)(int)param_2; qsort(param_1,__nmemb,4,cmpfunc); if (0 < (int)param_2) { if ((param_2 - 1 < 3) || ((ulong)(param_3 - ((long)param_1 + 4)) < 9)) { lVar3 = 0; do { *(int4 *)(param_3 + lVar3) = *(int4 *)((long)param_1 + lVar3); lVar3 = lVar3 + 4; } while (__nmemb * 4 - lVar3 != 0); } else { lVar3 = 0; do { uVar1 = ((int8 *)((long)param_1 + lVar3))[1]; *(int8 *)(param_3 + lVar3) = *(int8 *)((long)param_1 + lVar3); ((int8 *)(param_3 + lVar3))[1] = uVar1; lVar3 = lVar3 + 0x10; } while (lVar3 != (ulong)(param_2 >> 2) << 4); uVar2 = param_2 & 0xfffffffc; if ((__nmemb & 3) != 0) { uVar4 = (ulong)uVar2; lVar3 = uVar4 * 4; *(int4 *)(param_3 + uVar4 * 4) = *(int4 *)((long)param_1 + uVar4 * 4); if (((int)(uVar2 + 1) < (int)param_2) && (*(int4 *)(param_3 + 4 + lVar3) = *(int4 *)((long)param_1 + lVar3 + 4), (int)(uVar2 + 2) < (int)param_2)) { *(int4 *)(param_3 + 8 + lVar3) = *(int4 *)((long)param_1 + lVar3 + 8); return; } } } } return; }
5,260
func0
#include <stdio.h> #include <stdlib.h> #include <limits.h> #include <assert.h> typedef struct Node { int value; int list_num; int index; } Node; Node* create_node(int value, int list_num, int index) { Node* node = (Node*)malloc(sizeof(Node)); node->value = value; node->list_num = list_num; node->index = index; return node; } int compare_nodes(const void *a, const void *b) { Node* node1 = *(Node**)a; Node* node2 = *(Node**)b; return (node1->value > node2->value) - (node1->value < node2->value); }
int* func0(int** list, int* list_sizes, int numLists) { static int range[2]; int high = INT_MIN; int i, j; Node** pq = malloc(numLists * sizeof(Node*)); int pq_size = 0; for (i = 0; i < numLists; i++) { pq[pq_size++] = create_node(list[i][0], i, 0); if (list[i][0] > high) { high = list[i][0]; } } qsort(pq, pq_size, sizeof(Node*), compare_nodes); range[0] = 0; range[1] = INT_MAX; while (1) { Node* top = pq[0]; int low = top->value; i = top->list_num; j = top->index; if (high - low < range[1] - range[0]) { range[0] = low; range[1] = high; } if (j == list_sizes[i] - 1) { break; } pq[0] = create_node(list[i][j + 1], i, j + 1); if (list[i][j + 1] > high) { high = list[i][j + 1]; } qsort(pq, pq_size, sizeof(Node*), compare_nodes); } free(pq); return range; }
int main() { int list1[] = {3, 6, 8, 10, 15}; int list2[] = {1, 5, 12}; int list3[] = {4, 8, 15, 16}; int list4[] = {2, 6}; int* lists[] = {list1, list2, list3, list4}; int sizes[] = {5, 3, 4, 2}; int* result; result = func0(lists, sizes, 4); assert(result[0] == 4 && result[1] == 6); int list5[] = {4, 7, 9, 11, 16}; int list6[] = {2, 6, 13}; int list7[] = {5, 9, 16, 17}; int list8[] = {3, 7}; int* lists2[] = {list5, list6, list7, list8}; int sizes2[] = {5, 3, 4, 2}; result = func0(lists2, sizes2, 4); assert(result[0] == 5 && result[1] == 7); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x58,%rsp mov %rdi,-0x48(%rbp) mov %rsi,-0x50(%rbp) mov %edx,-0x54(%rbp) movl $0x80000000,-0x34(%rbp) mov -0x54(%rbp),%eax cltq shl $0x3,%rax mov %rax,%rdi callq 10d0 <malloc@plt> mov %rax,-0x20(%rbp) movl $0x0,-0x2c(%rbp) movl $0x0,-0x30(%rbp) jmpq 1330 <func0+0xcd> mov -0x30(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x48(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov (%rax),%ecx mov -0x2c(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x2c(%rbp) cltq lea 0x0(,%rax,8),%rdx mov -0x20(%rbp),%rax lea (%rdx,%rax,1),%rbx mov -0x30(%rbp),%eax mov $0x0,%edx mov %eax,%esi mov %ecx,%edi callq 11c9 <create_node> mov %rax,(%rbx) mov -0x30(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x48(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov (%rax),%eax cmp %eax,-0x34(%rbp) jge 132c <func0+0xc9> mov -0x30(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x48(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov (%rax),%eax mov %eax,-0x34(%rbp) addl $0x1,-0x30(%rbp) mov -0x30(%rbp),%eax cmp -0x54(%rbp),%eax jl 12aa <func0+0x47> mov -0x2c(%rbp),%eax movslq %eax,%rsi mov -0x20(%rbp),%rax lea -0x13e(%rip),%rcx mov $0x8,%edx mov %rax,%rdi callq 10a0 <qsort@plt> movl $0x0,0x2cb4(%rip) movl $0x7fffffff,0x2cae(%rip) mov -0x20(%rbp),%rax mov (%rax),%rax mov %rax,-0x18(%rbp) mov -0x18(%rbp),%rax mov (%rax),%eax mov %eax,-0x28(%rbp) mov -0x18(%rbp),%rax mov 0x4(%rax),%eax mov %eax,-0x30(%rbp) mov -0x18(%rbp),%rax mov 0x8(%rax),%eax mov %eax,-0x24(%rbp) mov -0x34(%rbp),%eax sub -0x28(%rbp),%eax mov 0x2c7a(%rip),%ecx mov 0x2c70(%rip),%edx sub %edx,%ecx mov %ecx,%edx cmp %edx,%eax jge 13c2 <func0+0x15f> mov -0x28(%rbp),%eax mov %eax,0x2c5f(%rip) mov -0x34(%rbp),%eax mov %eax,0x2c5a(%rip) mov -0x30(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x50(%rbp),%rax add %rdx,%rax mov (%rax),%eax sub $0x1,%eax cmp %eax,-0x24(%rbp) je 14a6 <func0+0x243> mov -0x24(%rbp),%eax lea 0x1(%rax),%edx mov -0x30(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x48(%rbp),%rax add %rcx,%rax mov (%rax),%rax mov -0x24(%rbp),%ecx movslq %ecx,%rcx add $0x1,%rcx shl $0x2,%rcx add %rcx,%rax mov (%rax),%eax mov -0x30(%rbp),%ecx mov %ecx,%esi mov %eax,%edi callq 11c9 <create_node> mov -0x20(%rbp),%rdx mov %rax,(%rdx) mov -0x30(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x48(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0x24(%rbp),%edx movslq %edx,%rdx add $0x1,%rdx shl $0x2,%rdx add %rdx,%rax mov (%rax),%eax cmp %eax,-0x34(%rbp) jge 1483 <func0+0x220> mov -0x30(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x48(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0x24(%rbp),%edx movslq %edx,%rdx add $0x1,%rdx shl $0x2,%rdx add %rdx,%rax mov (%rax),%eax mov %eax,-0x34(%rbp) mov -0x2c(%rbp),%eax movslq %eax,%rsi mov -0x20(%rbp),%rax lea -0x285(%rip),%rcx mov $0x8,%edx mov %rax,%rdi callq 10a0 <qsort@plt> jmpq 136e <func0+0x10b> mov -0x20(%rbp),%rax mov %rax,%rdi callq 1090 <free@plt> lea 0x2b5e(%rip),%rax add $0x58,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 58h mov [rbp+var_48], rdi mov [rbp+var_50], rsi mov [rbp+var_54], edx mov [rbp+var_34], 80000000h mov eax, [rbp+var_54] cdqe shl rax, 3 mov rdi, rax; size call _malloc mov [rbp+base], rax mov [rbp+var_2C], 0 mov [rbp+var_30], 0 jmp loc_1330 loc_12AA: mov eax, [rbp+var_30] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_48] add rax, rdx mov rax, [rax] mov ecx, [rax] mov eax, [rbp+var_2C] lea edx, [rax+1] mov [rbp+var_2C], edx cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+base] lea rbx, [rdx+rax] mov eax, [rbp+var_30] mov edx, 0 mov esi, eax mov edi, ecx call create_node mov [rbx], rax mov eax, [rbp+var_30] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_48] add rax, rdx mov rax, [rax] mov eax, [rax] cmp [rbp+var_34], eax jge short loc_132C mov eax, [rbp+var_30] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_48] add rax, rdx mov rax, [rax] mov eax, [rax] mov [rbp+var_34], eax loc_132C: add [rbp+var_30], 1 loc_1330: mov eax, [rbp+var_30] cmp eax, [rbp+var_54] jl loc_12AA mov eax, [rbp+var_2C] movsxd rsi, eax; nmemb mov rax, [rbp+base] lea rdx, compare_nodes mov rcx, rdx; compar mov edx, 8; size mov rdi, rax; base call _qsort mov cs:range_1, 0 mov cs:dword_401C, 7FFFFFFFh loc_1371: mov rax, [rbp+base] mov rax, [rax] mov [rbp+var_18], rax mov rax, [rbp+var_18] mov eax, [rax] mov [rbp+var_28], eax mov rax, [rbp+var_18] mov eax, [rax+4] mov [rbp+var_30], eax mov rax, [rbp+var_18] mov eax, [rax+8] mov [rbp+var_24], eax mov eax, [rbp+var_34] sub eax, [rbp+var_28] mov ecx, eax mov edx, cs:dword_401C mov eax, cs:range_1 sub edx, eax cmp ecx, edx jge short loc_13C5 mov eax, [rbp+var_28] mov cs:range_1, eax mov eax, [rbp+var_34] mov cs:dword_401C, eax loc_13C5: mov eax, [rbp+var_30] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_50] add rax, rdx mov eax, [rax] sub eax, 1 cmp [rbp+var_24], eax jz loc_14AC mov eax, [rbp+var_24] lea edx, [rax+1] mov eax, [rbp+var_30] cdqe lea rcx, ds:0[rax*8] mov rax, [rbp+var_48] add rax, rcx mov rax, [rax] mov ecx, [rbp+var_24] movsxd rcx, ecx add rcx, 1 shl rcx, 2 add rax, rcx mov eax, [rax] mov ecx, [rbp+var_30] mov esi, ecx mov edi, eax call create_node mov rdx, [rbp+base] mov [rdx], rax mov eax, [rbp+var_30] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_48] add rax, rdx mov rax, [rax] mov edx, [rbp+var_24] movsxd rdx, edx add rdx, 1 shl rdx, 2 add rax, rdx mov eax, [rax] cmp [rbp+var_34], eax jge short loc_1486 mov eax, [rbp+var_30] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_48] add rax, rdx mov rax, [rax] mov edx, [rbp+var_24] movsxd rdx, edx add rdx, 1 shl rdx, 2 add rax, rdx mov eax, [rax] mov [rbp+var_34], eax loc_1486: mov eax, [rbp+var_2C] movsxd rsi, eax; nmemb mov rax, [rbp+base] lea rdx, compare_nodes mov rcx, rdx; compar mov edx, 8; size mov rdi, rax; base call _qsort jmp loc_1371 loc_14AC: nop mov rax, [rbp+base] mov rdi, rax; ptr call _free lea rax, range_1 mov rbx, [rbp+var_8] leave retn
int * func0(long long a1, long long a2, int a3) { int v3; // eax signed int v6; // [rsp+2Ch] [rbp-34h] unsigned int i; // [rsp+30h] [rbp-30h] int v8; // [rsp+30h] [rbp-30h] int v9; // [rsp+34h] [rbp-2Ch] int v10; // [rsp+3Ch] [rbp-24h] int **base; // [rsp+40h] [rbp-20h] v6 = 0x80000000; base = (int **)malloc(8LL * a3); v9 = 0; for ( i = 0; (int)i < a3; ++i ) { v3 = v9++; base[v3] = (int *)create_node(**(unsigned int **)(8LL * (int)i + a1), i, 0LL); if ( v6 < **(_DWORD **)(8LL * (int)i + a1) ) v6 = **(_DWORD **)(8LL * (int)i + a1); } qsort(base, v9, 8uLL, compare_nodes); range_1 = 0; dword_401C = 0x7FFFFFFF; while ( 1 ) { v8 = (*base)[1]; v10 = (*base)[2]; if ( v6 - **base < dword_401C - range_1 ) { range_1 = **base; dword_401C = v6; } if ( v10 == *(_DWORD *)(4LL * v8 + a2) - 1 ) break; *base = (int *)create_node( *(unsigned int *)(4 * (v10 + 1LL) + *(_QWORD *)(8LL * v8 + a1)), (unsigned int)v8, (unsigned int)(v10 + 1)); if ( v6 < *(_DWORD *)(4 * (v10 + 1LL) + *(_QWORD *)(8LL * v8 + a1)) ) v6 = *(_DWORD *)(4 * (v10 + 1LL) + *(_QWORD *)(8LL * v8 + a1)); qsort(base, v9, 8uLL, compare_nodes); } free(base); return &range_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x58 MOV qword ptr [RBP + -0x48],RDI MOV qword ptr [RBP + -0x50],RSI MOV dword ptr [RBP + -0x54],EDX MOV dword ptr [RBP + -0x34],0x80000000 MOV EAX,dword ptr [RBP + -0x54] CDQE SHL RAX,0x3 MOV RDI,RAX CALL 0x001010d0 MOV qword ptr [RBP + -0x20],RAX MOV dword ptr [RBP + -0x2c],0x0 MOV dword ptr [RBP + -0x30],0x0 JMP 0x00101330 LAB_001012aa: MOV EAX,dword ptr [RBP + -0x30] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x48] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV ECX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x2c] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x2c],EDX CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x20] LEA RBX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x30] MOV EDX,0x0 MOV ESI,EAX MOV EDI,ECX CALL 0x001011c9 MOV qword ptr [RBX],RAX MOV EAX,dword ptr [RBP + -0x30] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x48] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x34],EAX JGE 0x0010132c MOV EAX,dword ptr [RBP + -0x30] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x48] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x34],EAX LAB_0010132c: ADD dword ptr [RBP + -0x30],0x1 LAB_00101330: MOV EAX,dword ptr [RBP + -0x30] CMP EAX,dword ptr [RBP + -0x54] JL 0x001012aa MOV EAX,dword ptr [RBP + -0x2c] MOVSXD RSI,EAX MOV RAX,qword ptr [RBP + -0x20] LEA RDX,[0x10120f] MOV RCX,RDX MOV EDX,0x8 MOV RDI,RAX CALL 0x001010a0 MOV dword ptr [0x00104018],0x0 MOV dword ptr [0x0010401c],0x7fffffff LAB_00101371: MOV RAX,qword ptr [RBP + -0x20] MOV RAX,qword ptr [RAX] MOV qword ptr [RBP + -0x18],RAX MOV RAX,qword ptr [RBP + -0x18] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x28],EAX MOV RAX,qword ptr [RBP + -0x18] MOV EAX,dword ptr [RAX + 0x4] MOV dword ptr [RBP + -0x30],EAX MOV RAX,qword ptr [RBP + -0x18] MOV EAX,dword ptr [RAX + 0x8] MOV dword ptr [RBP + -0x24],EAX MOV EAX,dword ptr [RBP + -0x34] SUB EAX,dword ptr [RBP + -0x28] MOV ECX,EAX MOV EDX,dword ptr [0x0010401c] MOV EAX,dword ptr [0x00104018] SUB EDX,EAX CMP ECX,EDX JGE 0x001013c5 MOV EAX,dword ptr [RBP + -0x28] MOV dword ptr [0x00104018],EAX MOV EAX,dword ptr [RBP + -0x34] MOV dword ptr [0x0010401c],EAX LAB_001013c5: MOV EAX,dword ptr [RBP + -0x30] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x50] ADD RAX,RDX MOV EAX,dword ptr [RAX] SUB EAX,0x1 CMP dword ptr [RBP + -0x24],EAX JZ 0x001014ac MOV EAX,dword ptr [RBP + -0x24] LEA EDX,[RAX + 0x1] MOV EAX,dword ptr [RBP + -0x30] CDQE LEA RCX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x48] ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV ECX,dword ptr [RBP + -0x24] MOVSXD RCX,ECX ADD RCX,0x1 SHL RCX,0x2 ADD RAX,RCX MOV EAX,dword ptr [RAX] MOV ECX,dword ptr [RBP + -0x30] MOV ESI,ECX MOV EDI,EAX CALL 0x001011c9 MOV RDX,qword ptr [RBP + -0x20] MOV qword ptr [RDX],RAX MOV EAX,dword ptr [RBP + -0x30] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x48] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0x24] MOVSXD RDX,EDX ADD RDX,0x1 SHL RDX,0x2 ADD RAX,RDX MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x34],EAX JGE 0x00101486 MOV EAX,dword ptr [RBP + -0x30] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x48] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0x24] MOVSXD RDX,EDX ADD RDX,0x1 SHL RDX,0x2 ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x34],EAX LAB_00101486: MOV EAX,dword ptr [RBP + -0x2c] MOVSXD RSI,EAX MOV RAX,qword ptr [RBP + -0x20] LEA RDX,[0x10120f] MOV RCX,RDX MOV EDX,0x8 MOV RDI,RAX CALL 0x001010a0 JMP 0x00101371 LAB_001014ac: NOP MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x00101090 LEA RAX,[0x104018] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int4 * func0(long param_1,long param_2,int param_3) { int iVar1; int iVar2; int *piVar3; int8 *__base; int8 uVar4; int local_3c; int local_38; int local_34; local_3c = -0x80000000; __base = (int8 *)malloc((long)param_3 << 3); local_34 = 0; for (local_38 = 0; local_38 < param_3; local_38 = local_38 + 1) { uVar4 = create_node(**(int4 **)(param_1 + (long)local_38 * 8),local_38,0); __base[local_34] = uVar4; if (local_3c < **(int **)(param_1 + (long)local_38 * 8)) { local_3c = **(int **)(param_1 + (long)local_38 * 8); } local_34 = local_34 + 1; } qsort(__base,(long)local_34,8,compare_nodes); range_1 = 0; DAT_0010401c = 0x7fffffff; while( true ) { piVar3 = (int *)*__base; iVar1 = piVar3[1]; iVar2 = piVar3[2]; if (local_3c - *piVar3 < DAT_0010401c - range_1) { DAT_0010401c = local_3c; range_1 = *piVar3; } if (iVar2 == *(int *)(param_2 + (long)iVar1 * 4) + -1) break; uVar4 = create_node(*(int4 *) (*(long *)(param_1 + (long)iVar1 * 8) + ((long)iVar2 + 1) * 4),iVar1, iVar2 + 1); *__base = uVar4; if (local_3c < *(int *)(*(long *)(param_1 + (long)iVar1 * 8) + ((long)iVar2 + 1) * 4)) { local_3c = *(int *)(*(long *)(param_1 + (long)iVar1 * 8) + ((long)iVar2 + 1) * 4); } qsort(__base,(long)local_34,8,compare_nodes); } free(__base); return &range_1; }
5,261
func0
#include <stdio.h> #include <stdlib.h> #include <limits.h> #include <assert.h> typedef struct Node { int value; int list_num; int index; } Node; Node* create_node(int value, int list_num, int index) { Node* node = (Node*)malloc(sizeof(Node)); node->value = value; node->list_num = list_num; node->index = index; return node; } int compare_nodes(const void *a, const void *b) { Node* node1 = *(Node**)a; Node* node2 = *(Node**)b; return (node1->value > node2->value) - (node1->value < node2->value); }
int* func0(int** list, int* list_sizes, int numLists) { static int range[2]; int high = INT_MIN; int i, j; Node** pq = malloc(numLists * sizeof(Node*)); int pq_size = 0; for (i = 0; i < numLists; i++) { pq[pq_size++] = create_node(list[i][0], i, 0); if (list[i][0] > high) { high = list[i][0]; } } qsort(pq, pq_size, sizeof(Node*), compare_nodes); range[0] = 0; range[1] = INT_MAX; while (1) { Node* top = pq[0]; int low = top->value; i = top->list_num; j = top->index; if (high - low < range[1] - range[0]) { range[0] = low; range[1] = high; } if (j == list_sizes[i] - 1) { break; } pq[0] = create_node(list[i][j + 1], i, j + 1); if (list[i][j + 1] > high) { high = list[i][j + 1]; } qsort(pq, pq_size, sizeof(Node*), compare_nodes); } free(pq); return range; }
int main() { int list1[] = {3, 6, 8, 10, 15}; int list2[] = {1, 5, 12}; int list3[] = {4, 8, 15, 16}; int list4[] = {2, 6}; int* lists[] = {list1, list2, list3, list4}; int sizes[] = {5, 3, 4, 2}; int* result; result = func0(lists, sizes, 4); assert(result[0] == 4 && result[1] == 6); int list5[] = {4, 7, 9, 11, 16}; int list6[] = {2, 6, 13}; int list7[] = {5, 9, 16, 17}; int list8[] = {3, 7}; int* lists2[] = {list5, list6, list7, list8}; int sizes2[] = {5, 3, 4, 2}; result = func0(lists2, sizes2, 4); assert(result[0] == 5 && result[1] == 7); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov %rdi,%r13 mov %rsi,%r15 mov %edx,%ebx mov %edx,0x8(%rsp) movslq %edx,%rdi shl $0x3,%rdi callq 10d0 <malloc@plt> mov %rax,%r12 test %ebx,%ebx jle 12b4 <func0+0xa5> lea -0x1(%rbx),%r14d mov $0x0,%ebp mov $0x80000000,%ebx mov 0x0(%r13,%rbp,8),%rax mov $0x0,%edx mov %ebp,%esi mov (%rax),%edi callq 11e8 <create_node> mov %rax,(%r12,%rbp,8) mov 0x0(%r13,%rbp,8),%rax mov (%rax),%eax cmp %eax,%ebx cmovl %eax,%ebx mov %rbp,%rax add $0x1,%rbp cmp %r14,%rax jne 124e <func0+0x3f> movslq 0x8(%rsp),%rax mov %rax,0x8(%rsp) lea -0xc5(%rip),%rcx mov $0x8,%edx mov %rax,%rsi mov %r12,%rdi callq 10a0 <qsort@plt> movl $0x0,0x2d70(%rip) movl $0x7fffffff,0x2d6a(%rip) jmp 131f <func0+0x110> movl $0x0,0x8(%rsp) mov $0x80000000,%ebx jmp 127d <func0+0x6e> mov %ecx,0x2d4f(%rip) mov %ebx,0x2d4d(%rip) movslq %esi,%rcx mov (%r15,%rcx,4),%eax sub $0x1,%eax cmp %edx,%eax je 1341 <func0+0x132> lea 0x0(%r13,%rcx,8),%r14 movslq %edx,%rbp add $0x1,%rbp add $0x1,%edx mov (%r14),%rax mov (%rax,%rbp,4),%edi callq 11e8 <create_node> mov %rax,(%r12) mov (%r14),%rax mov (%rax,%rbp,4),%eax cmp %eax,%ebx cmovl %eax,%ebx lea -0x144(%rip),%rcx mov $0x8,%edx mov 0x8(%rsp),%rsi mov %r12,%rdi callq 10a0 <qsort@plt> mov (%r12),%rax mov (%rax),%ecx mov 0x4(%rax),%esi mov 0x8(%rax),%edx mov %ebx,%edi sub %ecx,%edi mov 0x2ce7(%rip),%eax sub 0x2cdd(%rip),%eax cmp %eax,%edi jge 12cf <func0+0xc0> jmp 12c3 <func0+0xb4> mov %r12,%rdi callq 1090 <free@plt> lea 0x2cc8(%rip),%rax 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 r13, rdi mov r15, rsi mov ebx, edx mov dword ptr [rsp+48h+var_40], edx movsxd rdi, edx shl rdi, 3 call _malloc mov r12, rax test ebx, ebx jle short loc_12AE mov r14d, ebx mov ebp, 0 mov ebx, 80000000h loc_124B: mov rax, [r13+rbp*8+0] mov edx, 0 mov esi, ebp mov edi, [rax] call create_node mov [r12+rbp*8], rax mov rax, [r13+rbp*8+0] mov eax, [rax] cmp ebx, eax cmovl ebx, eax add rbp, 1 cmp rbp, r14 jnz short loc_124B loc_1277: movsxd rax, dword ptr [rsp+48h+var_40] mov [rsp+48h+var_40], rax lea rcx, compare_nodes mov edx, 8 mov rsi, rax mov rdi, r12 call _qsort mov cs:range_1, 0 mov cs:dword_401C, 7FFFFFFFh jmp short loc_1319 loc_12AE: mov dword ptr [rsp+48h+var_40], 0 mov ebx, 80000000h jmp short loc_1277 loc_12BD: mov cs:range_1, ecx mov cs:dword_401C, ebx loc_12C9: movsxd rcx, esi mov eax, [r15+rcx*4] sub eax, 1 cmp eax, edx jz short loc_133B lea r14, [r13+rcx*8+0] movsxd rbp, edx add rbp, 1 add edx, 1 mov rax, [r14] mov edi, [rax+rbp*4] call create_node mov [r12], rax mov rax, [r14] mov eax, [rax+rbp*4] cmp ebx, eax cmovl ebx, eax lea rcx, compare_nodes mov edx, 8 mov rsi, [rsp+48h+var_40] mov rdi, r12 call _qsort loc_1319: mov rax, [r12] mov ecx, [rax] mov esi, [rax+4] mov edx, [rax+8] mov edi, ebx sub edi, ecx mov eax, cs:dword_401C sub eax, cs:range_1 cmp edi, eax jge short loc_12C9 jmp short loc_12BD loc_133B: mov rdi, r12 call _free lea rax, range_1 add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
int * func0(long long a1, long long a2, int a3) { int **v5; // r12 long long v6; // r14 long long v7; // rbp signed int v8; // ebx _QWORD *v9; // r14 long long v10; // rbp long long v11; // rsi int v12; // edx int v14; // [rsp+8h] [rbp-40h] v14 = a3; v5 = (int **)malloc(8LL * a3); if ( a3 <= 0 ) { v14 = 0; v8 = 0x80000000; } else { v6 = (unsigned int)a3; v7 = 0LL; v8 = 0x80000000; do { v5[v7] = (int *)create_node(**(unsigned int **)(a1 + 8 * v7), (unsigned int)v7, 0LL); if ( v8 < **(_DWORD **)(a1 + 8 * v7) ) v8 = **(_DWORD **)(a1 + 8 * v7); ++v7; } while ( v7 != v6 ); } qsort(v5, v14, 8LL, compare_nodes); range_1 = 0; dword_401C = 0x7FFFFFFF; while ( 1 ) { v11 = (unsigned int)(*v5)[1]; v12 = (*v5)[2]; if ( v8 - **v5 < dword_401C - range_1 ) { range_1 = **v5; dword_401C = v8; } if ( *(_DWORD *)(a2 + 4LL * (int)v11) - 1 == v12 ) break; v9 = (_QWORD *)(a1 + 8LL * (int)v11); v10 = v12 + 1LL; *v5 = (int *)create_node(*(unsigned int *)(*v9 + 4 * v10), v11, (unsigned int)(v12 + 1)); if ( v8 < *(_DWORD *)(*v9 + 4 * v10) ) v8 = *(_DWORD *)(*v9 + 4 * v10); qsort(v5, v14, 8LL, compare_nodes); } free(v5); return &range_1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV R13,RDI MOV R15,RSI MOV EBX,EDX MOV dword ptr [RSP + 0x8],EDX MOVSXD RDI,EDX SHL RDI,0x3 CALL 0x001010d0 MOV R12,RAX TEST EBX,EBX JLE 0x001012ae MOV R14D,EBX MOV EBP,0x0 MOV EBX,0x80000000 LAB_0010124b: MOV RAX,qword ptr [R13 + RBP*0x8] MOV EDX,0x0 MOV ESI,EBP MOV EDI,dword ptr [RAX] CALL 0x001011e6 MOV qword ptr [R12 + RBP*0x8],RAX MOV RAX,qword ptr [R13 + RBP*0x8] MOV EAX,dword ptr [RAX] CMP EBX,EAX CMOVL EBX,EAX ADD RBP,0x1 CMP RBP,R14 JNZ 0x0010124b LAB_00101277: MOVSXD RAX,dword ptr [RSP + 0x8] MOV qword ptr [RSP + 0x8],RAX LEA RCX,[0x1011c9] MOV EDX,0x8 MOV RSI,RAX MOV RDI,R12 CALL 0x001010a0 MOV dword ptr [0x00104018],0x0 MOV dword ptr [0x0010401c],0x7fffffff JMP 0x00101319 LAB_001012ae: MOV dword ptr [RSP + 0x8],0x0 MOV EBX,0x80000000 JMP 0x00101277 LAB_001012bd: MOV dword ptr [0x00104018],ECX MOV dword ptr [0x0010401c],EBX LAB_001012c9: MOVSXD RCX,ESI MOV EAX,dword ptr [R15 + RCX*0x4] SUB EAX,0x1 CMP EAX,EDX JZ 0x0010133b LEA R14,[R13 + RCX*0x8] MOVSXD RBP,EDX ADD RBP,0x1 ADD EDX,0x1 MOV RAX,qword ptr [R14] MOV EDI,dword ptr [RAX + RBP*0x4] CALL 0x001011e6 MOV qword ptr [R12],RAX MOV RAX,qword ptr [R14] MOV EAX,dword ptr [RAX + RBP*0x4] CMP EBX,EAX CMOVL EBX,EAX LEA RCX,[0x1011c9] MOV EDX,0x8 MOV RSI,qword ptr [RSP + 0x8] MOV RDI,R12 CALL 0x001010a0 LAB_00101319: MOV RAX,qword ptr [R12] MOV ECX,dword ptr [RAX] MOV ESI,dword ptr [RAX + 0x4] MOV EDX,dword ptr [RAX + 0x8] MOV EDI,EBX SUB EDI,ECX MOV EAX,dword ptr [0x0010401c] SUB EAX,dword ptr [0x00104018] CMP EDI,EAX JGE 0x001012c9 JMP 0x001012bd LAB_0010133b: MOV RDI,R12 CALL 0x00101090 LEA RAX,[0x104018] ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int8 * func0(long param_1,long param_2,uint param_3) { long *plVar1; int iVar2; int iVar3; int *piVar4; int8 *__base; int8 uVar5; int iVar6; ulong uVar7; __base = (int8 *)malloc((long)(int)param_3 << 3); if ((int)param_3 < 1) { param_3 = 0; iVar6 = -0x80000000; } else { uVar7 = 0; iVar6 = -0x80000000; do { uVar5 = create_node(**(int4 **)(param_1 + uVar7 * 8),uVar7 & 0xffffffff,0); __base[uVar7] = uVar5; iVar2 = **(int **)(param_1 + uVar7 * 8); if (iVar6 < iVar2) { iVar6 = iVar2; } uVar7 = uVar7 + 1; } while (uVar7 != param_3); } qsort(__base,(long)(int)param_3,8,compare_nodes); range_1._0_4_ = 0; range_1._4_4_ = 0x7fffffff; while( true ) { piVar4 = (int *)*__base; iVar2 = piVar4[1]; iVar3 = piVar4[2]; if (iVar6 - *piVar4 < range_1._4_4_ - (int)range_1) { range_1._0_4_ = *piVar4; range_1._4_4_ = iVar6; } if (*(int *)(param_2 + (long)iVar2 * 4) + -1 == iVar3) break; plVar1 = (long *)(param_1 + (long)iVar2 * 8); uVar5 = create_node(*(int4 *)(*plVar1 + ((long)iVar3 + 1) * 4),iVar2,iVar3 + 1); *__base = uVar5; iVar2 = *(int *)(*plVar1 + ((long)iVar3 + 1) * 4); if (iVar6 < iVar2) { iVar6 = iVar2; } qsort(__base,(long)(int)param_3,8,compare_nodes); } free(__base); return &range_1; }
5,262
func0
#include <stdio.h> #include <stdlib.h> #include <limits.h> #include <assert.h> typedef struct Node { int value; int list_num; int index; } Node; Node* create_node(int value, int list_num, int index) { Node* node = (Node*)malloc(sizeof(Node)); node->value = value; node->list_num = list_num; node->index = index; return node; } int compare_nodes(const void *a, const void *b) { Node* node1 = *(Node**)a; Node* node2 = *(Node**)b; return (node1->value > node2->value) - (node1->value < node2->value); }
int* func0(int** list, int* list_sizes, int numLists) { static int range[2]; int high = INT_MIN; int i, j; Node** pq = malloc(numLists * sizeof(Node*)); int pq_size = 0; for (i = 0; i < numLists; i++) { pq[pq_size++] = create_node(list[i][0], i, 0); if (list[i][0] > high) { high = list[i][0]; } } qsort(pq, pq_size, sizeof(Node*), compare_nodes); range[0] = 0; range[1] = INT_MAX; while (1) { Node* top = pq[0]; int low = top->value; i = top->list_num; j = top->index; if (high - low < range[1] - range[0]) { range[0] = low; range[1] = high; } if (j == list_sizes[i] - 1) { break; } pq[0] = create_node(list[i][j + 1], i, j + 1); if (list[i][j + 1] > high) { high = list[i][j + 1]; } qsort(pq, pq_size, sizeof(Node*), compare_nodes); } free(pq); return range; }
int main() { int list1[] = {3, 6, 8, 10, 15}; int list2[] = {1, 5, 12}; int list3[] = {4, 8, 15, 16}; int list4[] = {2, 6}; int* lists[] = {list1, list2, list3, list4}; int sizes[] = {5, 3, 4, 2}; int* result; result = func0(lists, sizes, 4); assert(result[0] == 4 && result[1] == 6); int list5[] = {4, 7, 9, 11, 16}; int list6[] = {2, 6, 13}; int list7[] = {5, 9, 16, 17}; int list8[] = {3, 7}; int* lists2[] = {list5, list6, list7, list8}; int sizes2[] = {5, 3, 4, 2}; result = func0(lists2, sizes2, 4); assert(result[0] == 5 && result[1] == 7); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 push %r13 movslq %edx,%r13 push %r12 mov %rsi,%r12 push %rbp mov %rdi,%rbp lea 0x0(,%r13,8),%rdi push %rbx sub $0x28,%rsp callq 10d0 <malloc@plt> mov %rax,%r15 test %r13d,%r13d jle 15f0 <func0+0x190> lea -0x1(%r13),%eax xor %r14d,%r14d mov $0x80000000,%ebx mov %rax,0x18(%rsp) nopl (%rax) mov 0x0(%rbp,%r14,8),%rcx mov $0xc,%edi mov (%rcx),%esi mov %rcx,0x10(%rsp) mov %esi,0xc(%rsp) callq 10d0 <malloc@plt> mov 0xc(%rsp),%esi mov 0x10(%rsp),%rcx mov %r14d,0x4(%rax) mov %rax,(%r15,%r14,8) mov %esi,(%rax) movl $0x0,0x8(%rax) mov (%rcx),%eax cmp %eax,%ebx cmovl %eax,%ebx mov %r14,%rax add $0x1,%r14 cmp %rax,0x18(%rsp) jne 14a8 <func0+0x48> mov %r15,%rdi lea -0xeb(%rip),%rcx mov $0x8,%edx mov %r13,%rsi callq 10a0 <qsort@plt> xor %edi,%edi movabs $0x7fffffff00000000,%rax mov %rax,0x2afd(%rip) mov $0x7fffffff,%eax jmp 1592 <func0+0x132> nopw 0x0(%rax,%rax,1) mov 0x0(%rbp,%rsi,8),%rax movslq %edx,%rdi mov %edx,0x18(%rsp) lea 0x4(%rax,%rdi,4),%r14 mov $0xc,%edi mov (%r14),%r8d mov %r8d,0x10(%rsp) callq 10d0 <malloc@plt> mov 0x18(%rsp),%edx mov 0xc(%rsp),%ecx mov %r15,%rdi mov 0x10(%rsp),%r8d mov %rax,(%r15) mov %r13,%rsi add $0x1,%edx mov %ecx,0x4(%rax) lea -0x15e(%rip),%rcx mov %edx,0x8(%rax) mov $0x8,%edx mov %r8d,(%rax) mov (%r14),%eax cmp %eax,%ebx cmovl %eax,%ebx callq 10a0 <qsort@plt> mov 0x2a90(%rip),%eax mov 0x2a86(%rip),%edi mov (%r15),%rdx mov %ebx,%r8d sub %edi,%eax mov (%rdx),%esi mov 0x4(%rdx),%ecx mov 0x8(%rdx),%edx sub %esi,%r8d cmp %eax,%r8d jge 15b6 <func0+0x156> mov %esi,0x2a68(%rip) mov %ebx,0x2a66(%rip) movslq %ecx,%rsi mov %ecx,0xc(%rsp) mov (%r12,%rsi,4),%eax sub $0x1,%eax cmp %edx,%eax jne 1528 <func0+0xc8> mov %r15,%rdi callq 1090 <free@plt> add $0x28,%rsp lea 0x2a39(%rip),%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw 0x0(%rax,%rax,1) xor %r13d,%r13d mov $0x80000000,%ebx jmpq 14f1 <func0+0x91> nopl (%rax)
func0: endbr64 push r15 push r14 mov r14, rsi push r13 push r12 push rbp movsxd rbp, edx push rbx sub rsp, 18h mov [rsp+48h+var_48], rdi lea rdi, ds:0[rbp*8] call _malloc mov r12, rax test ebp, ebp jle loc_15E0 xor r13d, r13d mov ebx, 80000000h nop dword ptr [rax+00h] loc_14A0: mov rax, [rsp+48h+var_48] mov edi, 0Ch mov r15, [rax+r13*8] mov edx, [r15] mov [rsp+48h+var_40], edx call _malloc mov edx, [rsp+48h+var_40] mov [rax+4], r13d mov [r12+r13*8], rax mov [rax], edx mov dword ptr [rax+8], 0 mov eax, [r15] cmp ebx, eax cmovl ebx, eax add r13, 1 cmp rbp, r13 jnz short loc_14A0 loc_14DF: mov rdi, r12 lea rcx, compare_nodes mov edx, 8 mov rsi, rbp call _qsort xor edi, edi mov rax, 7FFFFFFF00000000h mov cs:range_1, rax mov eax, 7FFFFFFFh jmp short loc_1580 loc_1510: mov rax, [rsp+48h+var_48] movsxd rdi, edx mov [rsp+48h+var_3C], edx mov rax, [rax+rsi*8] lea r13, [rax+rdi*4+4] mov edi, 0Ch mov r9d, [r13+0] mov [rsp+48h+var_40], r9d call _malloc mov edx, [rsp+48h+var_3C] mov rdi, r12 mov rsi, rbp mov r9d, [rsp+48h+var_40] mov [rax+4], r15d lea rcx, compare_nodes add edx, 1 mov [r12], rax mov [rax+8], edx mov edx, 8 mov [rax], r9d mov eax, [r13+0] cmp ebx, eax cmovl ebx, eax call _qsort lea rcx, range_1 mov eax, dword ptr cs:range_1+4 mov edi, [rcx] loc_1580: mov rdx, [r12] mov r9d, ebx sub eax, edi mov esi, [rdx] mov r15d, [rdx+4] mov edx, [rdx+8] sub r9d, esi cmp r9d, eax jge short loc_15A9 lea rax, range_1 mov dword ptr cs:range_1+4, ebx mov [rax], esi loc_15A9: movsxd rsi, r15d mov eax, [r14+rsi*4] sub eax, 1 cmp eax, edx jnz loc_1510 mov rdi, r12 call _free add rsp, 18h lea rax, range_1 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_15E0: xor ebp, ebp mov ebx, 80000000h jmp loc_14DF
long long * func0(long long a1, long long a2, int a3) { long long v4; // rbp signed int **v5; // r12 long long v6; // r13 signed int v7; // ebx signed int *v8; // r15 signed int *v9; // rax int v10; // edi int v11; // eax signed int *v12; // r13 signed int *v13; // rax int v14; // esi signed int v15; // r15d int v16; // edx signed int v19; // [rsp+8h] [rbp-40h] signed int v20; // [rsp+8h] [rbp-40h] int v21; // [rsp+Ch] [rbp-3Ch] v4 = a3; v5 = (signed int **)malloc(8LL * a3); if ( (int)v4 <= 0 ) { v4 = 0LL; v7 = 0x80000000; } else { v6 = 0LL; v7 = 0x80000000; do { v8 = *(signed int **)(a1 + 8 * v6); v19 = *v8; v9 = (signed int *)malloc(12LL); v9[1] = v6; v5[v6] = v9; *v9 = v19; v9[2] = 0; if ( v7 < *v8 ) v7 = *v8; ++v6; } while ( v4 != v6 ); } qsort(v5, v4, 8LL, compare_nodes); v10 = 0; range_1 = 0x7FFFFFFF00000000LL; v11 = 0x7FFFFFFF; while ( 1 ) { v14 = **v5; v15 = (*v5)[1]; v16 = (*v5)[2]; if ( v7 - v14 < v11 - v10 ) { HIDWORD(range_1) = v7; LODWORD(range_1) = v14; } if ( *(_DWORD *)(a2 + 4LL * v15) - 1 == v16 ) break; v21 = v16; v12 = (signed int *)(*(_QWORD *)(a1 + 8LL * v15) + 4LL * v16 + 4); v20 = *v12; v13 = (signed int *)malloc(12LL); v13[1] = v15; *v5 = v13; v13[2] = v21 + 1; *v13 = v20; if ( v7 < *v12 ) v7 = *v12; qsort(v5, v4, 8LL, compare_nodes); v11 = HIDWORD(range_1); v10 = range_1; } free(v5); return &range_1; }
func0: ENDBR64 PUSH R15 PUSH R14 MOV R14,RSI PUSH R13 PUSH R12 PUSH RBP MOVSXD RBP,EDX PUSH RBX SUB RSP,0x18 MOV qword ptr [RSP],RDI LEA RDI,[RBP*0x8] CALL 0x001010d0 MOV R12,RAX TEST EBP,EBP JLE 0x001015e0 XOR R13D,R13D MOV EBX,0x80000000 NOP dword ptr [RAX] LAB_001014a0: MOV RAX,qword ptr [RSP] MOV EDI,0xc MOV R15,qword ptr [RAX + R13*0x8] MOV EDX,dword ptr [R15] MOV dword ptr [RSP + 0x8],EDX CALL 0x001010d0 MOV EDX,dword ptr [RSP + 0x8] MOV dword ptr [RAX + 0x4],R13D MOV qword ptr [R12 + R13*0x8],RAX MOV dword ptr [RAX],EDX MOV dword ptr [RAX + 0x8],0x0 MOV EAX,dword ptr [R15] CMP EBX,EAX CMOVL EBX,EAX ADD R13,0x1 CMP RBP,R13 JNZ 0x001014a0 LAB_001014df: MOV RDI,R12 LEA RCX,[0x101410] MOV EDX,0x8 MOV RSI,RBP CALL 0x001010a0 XOR EDI,EDI MOV RAX,0x7fffffff00000000 MOV qword ptr [0x00104018],RAX MOV EAX,0x7fffffff JMP 0x00101580 LAB_00101510: MOV RAX,qword ptr [RSP] MOVSXD RDI,EDX MOV dword ptr [RSP + 0xc],EDX MOV RAX,qword ptr [RAX + RSI*0x8] LEA R13,[RAX + RDI*0x4 + 0x4] MOV EDI,0xc MOV R9D,dword ptr [R13] MOV dword ptr [RSP + 0x8],R9D CALL 0x001010d0 MOV EDX,dword ptr [RSP + 0xc] MOV RDI,R12 MOV RSI,RBP MOV R9D,dword ptr [RSP + 0x8] MOV dword ptr [RAX + 0x4],R15D LEA RCX,[0x101410] ADD EDX,0x1 MOV qword ptr [R12],RAX MOV dword ptr [RAX + 0x8],EDX MOV EDX,0x8 MOV dword ptr [RAX],R9D MOV EAX,dword ptr [R13] CMP EBX,EAX CMOVL EBX,EAX CALL 0x001010a0 LEA RCX,[0x104018] MOV EAX,dword ptr [0x0010401c] MOV EDI,dword ptr [RCX] LAB_00101580: MOV RDX,qword ptr [R12] MOV R9D,EBX SUB EAX,EDI MOV ESI,dword ptr [RDX] MOV R15D,dword ptr [RDX + 0x4] MOV EDX,dword ptr [RDX + 0x8] SUB R9D,ESI CMP R9D,EAX JGE 0x001015a9 LEA RAX,[0x104018] MOV dword ptr [0x0010401c],EBX MOV dword ptr [RAX],ESI LAB_001015a9: MOVSXD RSI,R15D MOV EAX,dword ptr [R14 + RSI*0x4] SUB EAX,0x1 CMP EAX,EDX JNZ 0x00101510 MOV RDI,R12 CALL 0x00101090 ADD RSP,0x18 LEA RAX,[0x104018] POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001015e0: XOR EBP,EBP MOV EBX,0x80000000 JMP 0x001014df
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ int4 * func0(long param_1,long param_2,int param_3) { int iVar1; int iVar2; int iVar3; int *piVar4; int8 *__base; int *piVar5; int iVar6; size_t __nmemb; size_t sVar7; __nmemb = (size_t)param_3; __base = (int8 *)malloc(__nmemb * 8); if (param_3 < 1) { __nmemb = 0; iVar6 = -0x80000000; } else { sVar7 = 0; iVar6 = -0x80000000; do { piVar4 = *(int **)(param_1 + sVar7 * 8); iVar1 = *piVar4; piVar5 = (int *)malloc(0xc); piVar5[1] = (int)sVar7; __base[sVar7] = piVar5; *piVar5 = iVar1; piVar5[2] = 0; iVar1 = *piVar4; if (iVar6 < iVar1) { iVar6 = iVar1; } sVar7 = sVar7 + 1; } while (__nmemb != sVar7); } qsort(__base,__nmemb,8,compare_nodes); range_1 = 0; DAT_0010401c = 0x7fffffff; while( true ) { piVar4 = (int *)*__base; iVar1 = piVar4[1]; iVar3 = piVar4[2]; if (iVar6 - *piVar4 < DAT_0010401c - range_1) { range_1 = *piVar4; DAT_0010401c = iVar6; } if (*(int *)(param_2 + (long)iVar1 * 4) + -1 == iVar3) break; piVar4 = (int *)(*(long *)(param_1 + (long)iVar1 * 8) + 4 + (long)iVar3 * 4); iVar2 = *piVar4; piVar5 = (int *)malloc(0xc); piVar5[1] = iVar1; *__base = piVar5; piVar5[2] = iVar3 + 1; *piVar5 = iVar2; iVar1 = *piVar4; if (iVar6 < iVar1) { iVar6 = iVar1; } qsort(__base,__nmemb,8,compare_nodes); } free(__base); return &range_1; }
5,263
func0
#include <stdio.h> #include <stdlib.h> #include <limits.h> #include <assert.h> typedef struct Node { int value; int list_num; int index; } Node; Node* create_node(int value, int list_num, int index) { Node* node = (Node*)malloc(sizeof(Node)); node->value = value; node->list_num = list_num; node->index = index; return node; } int compare_nodes(const void *a, const void *b) { Node* node1 = *(Node**)a; Node* node2 = *(Node**)b; return (node1->value > node2->value) - (node1->value < node2->value); }
int* func0(int** list, int* list_sizes, int numLists) { static int range[2]; int high = INT_MIN; int i, j; Node** pq = malloc(numLists * sizeof(Node*)); int pq_size = 0; for (i = 0; i < numLists; i++) { pq[pq_size++] = create_node(list[i][0], i, 0); if (list[i][0] > high) { high = list[i][0]; } } qsort(pq, pq_size, sizeof(Node*), compare_nodes); range[0] = 0; range[1] = INT_MAX; while (1) { Node* top = pq[0]; int low = top->value; i = top->list_num; j = top->index; if (high - low < range[1] - range[0]) { range[0] = low; range[1] = high; } if (j == list_sizes[i] - 1) { break; } pq[0] = create_node(list[i][j + 1], i, j + 1); if (list[i][j + 1] > high) { high = list[i][j + 1]; } qsort(pq, pq_size, sizeof(Node*), compare_nodes); } free(pq); return range; }
int main() { int list1[] = {3, 6, 8, 10, 15}; int list2[] = {1, 5, 12}; int list3[] = {4, 8, 15, 16}; int list4[] = {2, 6}; int* lists[] = {list1, list2, list3, list4}; int sizes[] = {5, 3, 4, 2}; int* result; result = func0(lists, sizes, 4); assert(result[0] == 4 && result[1] == 6); int list5[] = {4, 7, 9, 11, 16}; int list6[] = {2, 6, 13}; int list7[] = {5, 9, 16, 17}; int list8[] = {3, 7}; int* lists2[] = {list5, list6, list7, list8}; int sizes2[] = {5, 3, 4, 2}; result = func0(lists2, sizes2, 4); assert(result[0] == 5 && result[1] == 7); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 movslq %edx,%r14 push %r13 mov %rsi,%r13 push %r12 push %rbp mov %rdi,%rbp lea 0x0(,%r14,8),%rdi push %rbx sub $0x28,%rsp callq 10d0 <malloc@plt> mov %rax,%r15 test %r14d,%r14d jle 15d0 <func0+0x1b0> lea -0x1(%r14),%eax xor %r12d,%r12d mov $0x80000000,%ebx mov %rax,0x18(%rsp) nopl (%rax) mov 0x0(%rbp,%r12,8),%rcx mov $0xc,%edi mov (%rcx),%esi mov %rcx,0x10(%rsp) mov %esi,0xc(%rsp) callq 10d0 <malloc@plt> mov 0xc(%rsp),%esi mov 0x10(%rsp),%rcx mov %r12d,0x4(%rax) mov %rax,(%r15,%r12,8) mov %esi,(%rax) movl $0x0,0x8(%rax) mov (%rcx),%eax cmp %eax,%ebx cmovl %eax,%ebx mov %r12,%rax add $0x1,%r12 cmp %rax,0x18(%rsp) jne 1468 <func0+0x48> mov %r15,%rdi lea -0xeb(%rip),%rcx mov $0x8,%edx mov %r14,%rsi callq 10a0 <qsort@plt> xor %edi,%edi movabs $0x7fffffff00000000,%rax mov %rax,0x2b3d(%rip) mov $0x7fffffff,%eax jmpq 157d <func0+0x15d> nopl (%rax) lea 0x2b29(%rip),%rax mov %ebx,0x2b27(%rip) mov %esi,(%rax) movslq %ecx,%rax mov 0x0(%r13,%rax,4),%edi lea -0x1(%rdi),%esi cmp %esi,%edx je 15ac <func0+0x18c> mov 0x0(%rbp,%rax,8),%rax movslq %edx,%rsi mov $0xc,%edi mov %ecx,0x18(%rsp) mov %edx,0x10(%rsp) lea 0x4(%rax,%rsi,4),%r12 mov (%r12),%r8d mov %r8d,0xc(%rsp) callq 10d0 <malloc@plt> mov 0x10(%rsp),%edx mov 0x18(%rsp),%ecx mov %r15,%rdi mov 0xc(%rsp),%r8d mov %rax,(%r15) mov %r14,%rsi add $0x1,%edx mov %ecx,0x4(%rax) lea -0x185(%rip),%rcx mov %edx,0x8(%rax) mov $0x8,%edx mov %r8d,(%rax) mov (%r12),%eax cmp %eax,%ebx cmovl %eax,%ebx callq 10a0 <qsort@plt> lea 0x2aa3(%rip),%rdi mov 0x2aa1(%rip),%eax mov (%rdi),%edi mov (%r15),%rdx mov %ebx,%r8d sub %edi,%eax mov (%rdx),%esi mov 0x4(%rdx),%ecx mov 0x8(%rdx),%edx sub %esi,%r8d cmp %eax,%r8d jl 14e8 <func0+0xc8> movslq %ecx,%rax mov 0x0(%r13,%rax,4),%edi lea -0x1(%rdi),%esi cmp %edx,%esi jne 150a <func0+0xea> mov %r15,%rdi callq 1090 <free@plt> add $0x28,%rsp lea 0x2a59(%rip),%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw 0x0(%rax,%rax,1) xor %r14d,%r14d mov $0x80000000,%ebx jmpq 14b1 <func0+0x91> nopl (%rax)
func0: endbr64 push r15 push r14 mov r14, rsi push r13 movsxd r13, edx push r12 mov r12d, 80000000h push rbp push rbx xor ebx, ebx sub rsp, 18h mov [rsp+48h+var_48], rdi lea rdi, ds:0[r13*8]; size call _malloc mov rbp, rax test r13d, r13d jle short loc_14BE nop dword ptr [rax+00000000h] loc_1470: mov rax, [rsp+48h+var_48] movd xmm1, ebx mov edi, 0Ch; size mov r15, [rax+rbx*8] movd xmm0, dword ptr [r15] punpckldq xmm0, xmm1 movq [rsp+48h+var_40], xmm0 call _malloc movq xmm0, [rsp+48h+var_40] mov [rbp+rbx*8+0], rax mov dword ptr [rax+8], 0 movq qword ptr [rax], xmm0 mov eax, [r15] cmp r12d, eax cmovl r12d, eax add rbx, 1 cmp r13, rbx jnz short loc_1470 loc_14BE: lea rcx, compare_nodes; compar mov rdi, rbp; base mov edx, 8; size mov rsi, rbx; nmemb call _qsort mov rax, cs:qword_2078 xor edi, edi mov ecx, 7FFFFFFFh mov cs:range_1, rax jmp loc_158E loc_14F0: movd xmm0, esi movd xmm3, r12d lea rcx, range_1 punpckldq xmm0, xmm3 movq qword ptr [rcx], xmm0 movsxd rcx, eax mov edi, [r14+rcx*4] lea esi, [rdi-1] cmp esi, r13d jz loc_15BF loc_151B: mov rdx, [rsp+48h+var_48] movsxd rdi, r13d movd xmm2, eax mov rsi, [rdx+rcx*8] movd xmm0, dword ptr [rsi+rdi*4+4] lea r15, [rsi+rdi*4+4] mov edi, 0Ch; size punpckldq xmm0, xmm2 movq [rsp+48h+var_40], xmm0 call _malloc lea edx, [r13+1] mov rdi, rbp; base mov rsi, rbx; nmemb movq xmm0, [rsp+48h+var_40] mov [rax+8], edx lea rcx, compare_nodes; compar mov edx, 8; size mov [rbp+0], rax movq qword ptr [rax], xmm0 mov eax, [r15] cmp r12d, eax cmovl r12d, eax call _qsort lea rax, range_1 mov ecx, dword ptr cs:range_1+4 mov edi, [rax] loc_158E: mov rdx, [rbp+0] mov r9d, r12d sub ecx, edi mov esi, [rdx] mov eax, [rdx+4] mov r13d, [rdx+8] sub r9d, esi cmp r9d, ecx jl loc_14F0 movsxd rcx, eax mov esi, [r14+rcx*4] sub esi, 1 cmp esi, r13d jnz loc_151B loc_15BF: mov rdi, rbp; ptr call _free add rsp, 18h lea rax, range_1 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long * func0(long long a1, long long a2, int a3) { long long v4; // r13 signed int v5; // r12d size_t v6; // rbx unsigned int **v7; // rbp unsigned int *v8; // r15 unsigned int *v9; // rax unsigned long long v10; // xmm0_8 int v11; // edi int v12; // ecx long long v13; // rcx unsigned int *v14; // r15 unsigned int *v15; // rax unsigned long long v16; // xmm0_8 unsigned int v17; // esi signed int v18; // eax signed int v19; // r13d unsigned long long v22; // [rsp+8h] [rbp-40h] v4 = a3; v5 = 0x80000000; v6 = 0LL; v7 = (unsigned int **)malloc(8LL * a3); if ( (int)v4 > 0 ) { do { v8 = *(unsigned int **)(a1 + 8 * v6); v22 = _mm_unpacklo_epi32(_mm_cvtsi32_si128(*v8), _mm_cvtsi32_si128(v6)).m128i_u64[0]; v9 = (unsigned int *)malloc(0xCuLL); v10 = v22; v7[v6] = v9; v9[2] = 0; *(_QWORD *)v9 = v10; if ( v5 < (int)*v8 ) v5 = *v8; ++v6; } while ( v4 != v6 ); } qsort(v7, v6, 8uLL, compare_nodes); v11 = 0; v12 = 0x7FFFFFFF; for ( range_1 = 0x7FFFFFFF00000000LL; ; v11 = range_1 ) { v17 = **v7; v18 = (*v7)[1]; v19 = (*v7)[2]; if ( (int)(v5 - v17) >= v12 - v11 ) break; range_1 = _mm_unpacklo_epi32(_mm_cvtsi32_si128(v17), _mm_cvtsi32_si128(v5)).m128i_u64[0]; v13 = v18; if ( *(_DWORD *)(a2 + 4LL * v18) - 1 == v19 ) goto LABEL_12; LABEL_7: v14 = (unsigned int *)(*(_QWORD *)(a1 + 8 * v13) + 4LL * v19 + 4); v22 = _mm_unpacklo_epi32(_mm_cvtsi32_si128(*v14), _mm_cvtsi32_si128(v18)).m128i_u64[0]; v15 = (unsigned int *)malloc(0xCuLL); v16 = v22; v15[2] = v19 + 1; *v7 = v15; *(_QWORD *)v15 = v16; if ( v5 < (int)*v14 ) v5 = *v14; qsort(v7, v6, 8uLL, compare_nodes); v12 = HIDWORD(range_1); } v13 = v18; if ( *(_DWORD *)(a2 + 4LL * v18) - 1 != v19 ) goto LABEL_7; LABEL_12: free(v7); return &range_1; }
func0: ENDBR64 PUSH R15 PUSH R14 MOV R14,RSI PUSH R13 MOVSXD R13,EDX PUSH R12 MOV R12D,0x80000000 PUSH RBP PUSH RBX XOR EBX,EBX SUB RSP,0x18 MOV qword ptr [RSP],RDI LEA RDI,[R13*0x8] CALL 0x001010d0 MOV RBP,RAX TEST R13D,R13D JLE 0x001014be NOP dword ptr [RAX] LAB_00101470: MOV RAX,qword ptr [RSP] MOVD XMM1,EBX MOV EDI,0xc MOV R15,qword ptr [RAX + RBX*0x8] MOVD XMM0,dword ptr [R15] PUNPCKLDQ XMM0,XMM1 MOVQ qword ptr [RSP + 0x8],XMM0 CALL 0x001010d0 MOVQ XMM0,qword ptr [RSP + 0x8] MOV qword ptr [RBP + RBX*0x8],RAX MOV dword ptr [RAX + 0x8],0x0 MOVQ qword ptr [RAX],XMM0 MOV EAX,dword ptr [R15] CMP R12D,EAX CMOVL R12D,EAX ADD RBX,0x1 CMP R13,RBX JNZ 0x00101470 LAB_001014be: LEA RCX,[0x1013e0] MOV RDI,RBP MOV EDX,0x8 MOV RSI,RBX CALL 0x001010a0 MOV RAX,qword ptr [0x00102078] XOR EDI,EDI MOV ECX,0x7fffffff MOV qword ptr [0x00104018],RAX JMP 0x0010158e LAB_001014f0: MOVD XMM0,ESI MOVD XMM3,R12D LEA RCX,[0x104018] PUNPCKLDQ XMM0,XMM3 MOVQ qword ptr [RCX],XMM0 MOVSXD RCX,EAX MOV EDI,dword ptr [R14 + RCX*0x4] LEA ESI,[RDI + -0x1] CMP ESI,R13D JZ 0x001015bf LAB_0010151b: MOV RDX,qword ptr [RSP] MOVSXD RDI,R13D MOVD XMM2,EAX MOV RSI,qword ptr [RDX + RCX*0x8] MOVD XMM0,dword ptr [RSI + RDI*0x4 + 0x4] LEA R15,[RSI + RDI*0x4 + 0x4] MOV EDI,0xc PUNPCKLDQ XMM0,XMM2 MOVQ qword ptr [RSP + 0x8],XMM0 CALL 0x001010d0 LEA EDX,[R13 + 0x1] MOV RDI,RBP MOV RSI,RBX MOVQ XMM0,qword ptr [RSP + 0x8] MOV dword ptr [RAX + 0x8],EDX LEA RCX,[0x1013e0] MOV EDX,0x8 MOV qword ptr [RBP],RAX MOVQ qword ptr [RAX],XMM0 MOV EAX,dword ptr [R15] CMP R12D,EAX CMOVL R12D,EAX CALL 0x001010a0 LEA RAX,[0x104018] MOV ECX,dword ptr [0x0010401c] MOV EDI,dword ptr [RAX] LAB_0010158e: MOV RDX,qword ptr [RBP] MOV R9D,R12D SUB ECX,EDI MOV ESI,dword ptr [RDX] MOV EAX,dword ptr [RDX + 0x4] MOV R13D,dword ptr [RDX + 0x8] SUB R9D,ESI CMP R9D,ECX JL 0x001014f0 MOVSXD RCX,EAX MOV ESI,dword ptr [R14 + RCX*0x4] SUB ESI,0x1 CMP ESI,R13D JNZ 0x0010151b LAB_001015bf: MOV RDI,RBP CALL 0x00101090 ADD RSP,0x18 LEA RAX,[0x104018] POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int8 * func0(long param_1,long param_2,int param_3) { int4 uVar1; int iVar2; int iVar3; int *piVar4; long lVar5; int8 *__base; int8 *puVar6; int iVar7; size_t __nmemb; int iVar8; int iVar9; iVar9 = -0x80000000; __nmemb = 0; __base = (int8 *)malloc((long)param_3 * 8); if (0 < param_3) { do { piVar4 = *(int **)(param_1 + __nmemb * 8); iVar7 = *piVar4; puVar6 = (int8 *)malloc(0xc); __base[__nmemb] = puVar6; *(int4 *)(puVar6 + 1) = 0; *puVar6 = CONCAT44((int)__nmemb,iVar7); iVar7 = *piVar4; if (iVar9 < iVar7) { iVar9 = iVar7; } __nmemb = __nmemb + 1; } while ((long)param_3 != __nmemb); } qsort(__base,__nmemb,8,compare_nodes); range_1 = DAT_00102078; iVar7 = 0x7fffffff; iVar8 = 0; while( true ) { piVar4 = (int *)*__base; iVar2 = piVar4[1]; iVar3 = piVar4[2]; if (iVar9 - *piVar4 < iVar7 - iVar8) { range_1 = CONCAT44(iVar9,*piVar4); iVar7 = *(int *)(param_2 + (long)iVar2 * 4); } else { iVar7 = *(int *)(param_2 + (long)iVar2 * 4); } if (iVar7 + -1 == iVar3) break; lVar5 = *(long *)(param_1 + (long)iVar2 * 8); uVar1 = *(int4 *)(lVar5 + 4 + (long)iVar3 * 4); puVar6 = (int8 *)malloc(0xc); *(int *)(puVar6 + 1) = iVar3 + 1; *__base = puVar6; *puVar6 = CONCAT44(iVar2,uVar1); iVar7 = *(int *)(lVar5 + 4 + (long)iVar3 * 4); if (iVar9 < iVar7) { iVar9 = iVar7; } qsort(__base,__nmemb,8,compare_nodes); iVar7 = range_1._4_4_; iVar8 = (int)range_1; } free(__base); return &range_1; }
5,264
func0
#include <ctype.h> #include <assert.h>
void func0(const char *s, int *letters, int *digits) { int l = 0, d = 0; while (*s) { if (isdigit((unsigned char)*s)) d++; else if (isalpha((unsigned char)*s)) l++; s++; } *letters = l; *digits = d; }
int main() { int letters, digits; func0("python", &letters, &digits); assert(letters == 6 && digits == 0); func0("program", &letters, &digits); assert(letters == 7 && digits == 0); func0("python3.0", &letters, &digits); assert(letters == 6 && digits == 2); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %rdx,-0x28(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 120e <func0+0x85> callq 1090 <__ctype_b_loc@plt> mov (%rax),%rdx mov -0x18(%rbp),%rax movzbl (%rax),%eax movzbl %al,%eax add %rax,%rax add %rdx,%rax movzwl (%rax),%eax movzwl %ax,%eax and $0x800,%eax test %eax,%eax je 11de <func0+0x55> addl $0x1,-0x4(%rbp) jmp 1209 <func0+0x80> callq 1090 <__ctype_b_loc@plt> mov (%rax),%rdx mov -0x18(%rbp),%rax movzbl (%rax),%eax movzbl %al,%eax add %rax,%rax add %rdx,%rax movzwl (%rax),%eax movzwl %ax,%eax and $0x400,%eax test %eax,%eax je 1209 <func0+0x80> addl $0x1,-0x8(%rbp) addq $0x1,-0x18(%rbp) mov -0x18(%rbp),%rax movzbl (%rax),%eax test %al,%al jne 11b1 <func0+0x28> mov -0x20(%rbp),%rax mov -0x8(%rbp),%edx mov %edx,(%rax) mov -0x28(%rbp),%rax mov -0x4(%rbp),%edx mov %edx,(%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_28], rdx mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_120E loc_11B1: call ___ctype_b_loc mov rdx, [rax] mov rax, [rbp+var_18] movzx eax, byte ptr [rax] movzx eax, al add rax, rax add rax, rdx movzx eax, word ptr [rax] movzx eax, ax and eax, 800h test eax, eax jz short loc_11DE add [rbp+var_4], 1 jmp short loc_1209 loc_11DE: call ___ctype_b_loc mov rdx, [rax] mov rax, [rbp+var_18] movzx eax, byte ptr [rax] movzx eax, al add rax, rax add rax, rdx movzx eax, word ptr [rax] movzx eax, ax and eax, 400h test eax, eax jz short loc_1209 add [rbp+var_8], 1 loc_1209: add [rbp+var_18], 1 loc_120E: mov rax, [rbp+var_18] movzx eax, byte ptr [rax] test al, al jnz short loc_11B1 mov rax, [rbp+var_20] mov edx, [rbp+var_8] mov [rax], edx mov rax, [rbp+var_28] mov edx, [rbp+var_4] mov [rax], edx nop leave retn
_DWORD * func0(_BYTE *a1, _DWORD *a2, _DWORD *a3) { _DWORD *result; // rax int v6; // [rsp+28h] [rbp-8h] int v7; // [rsp+2Ch] [rbp-4h] v6 = 0; v7 = 0; while ( *a1 ) { if ( ((*__ctype_b_loc())[(unsigned __int8)*a1] & 0x800) != 0 ) { ++v7; } else if ( ((*__ctype_b_loc())[(unsigned __int8)*a1] & 0x400) != 0 ) { ++v6; } ++a1; } *a2 = v6; result = a3; *a3 = v7; return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x0010120e LAB_001011b1: CALL 0x00101090 MOV RDX,qword ptr [RAX] MOV RAX,qword ptr [RBP + -0x18] MOVZX EAX,byte ptr [RAX] MOVZX EAX,AL ADD RAX,RAX ADD RAX,RDX MOVZX EAX,word ptr [RAX] MOVZX EAX,AX AND EAX,0x800 TEST EAX,EAX JZ 0x001011de ADD dword ptr [RBP + -0x4],0x1 JMP 0x00101209 LAB_001011de: CALL 0x00101090 MOV RDX,qword ptr [RAX] MOV RAX,qword ptr [RBP + -0x18] MOVZX EAX,byte ptr [RAX] MOVZX EAX,AL ADD RAX,RAX ADD RAX,RDX MOVZX EAX,word ptr [RAX] MOVZX EAX,AX AND EAX,0x400 TEST EAX,EAX JZ 0x00101209 ADD dword ptr [RBP + -0x8],0x1 LAB_00101209: ADD qword ptr [RBP + -0x18],0x1 LAB_0010120e: MOV RAX,qword ptr [RBP + -0x18] MOVZX EAX,byte ptr [RAX] TEST AL,AL JNZ 0x001011b1 MOV RAX,qword ptr [RBP + -0x20] MOV EDX,dword ptr [RBP + -0x8] MOV dword ptr [RAX],EDX MOV RAX,qword ptr [RBP + -0x28] MOV EDX,dword ptr [RBP + -0x4] MOV dword ptr [RAX],EDX NOP LEAVE RET
void func0(byte *param_1,int *param_2,int *param_3) { ushort **ppuVar1; byte *local_20; int local_10; int local_c; local_10 = 0; local_c = 0; for (local_20 = param_1; *local_20 != 0; local_20 = local_20 + 1) { ppuVar1 = __ctype_b_loc(); if (((*ppuVar1)[*local_20] & 0x800) == 0) { ppuVar1 = __ctype_b_loc(); if (((*ppuVar1)[*local_20] & 0x400) != 0) { local_10 = local_10 + 1; } } else { local_c = local_c + 1; } } *param_2 = local_10; *param_3 = local_c; return; }
5,265
func0
#include <ctype.h> #include <assert.h>
void func0(const char *s, int *letters, int *digits) { int l = 0, d = 0; while (*s) { if (isdigit((unsigned char)*s)) d++; else if (isalpha((unsigned char)*s)) l++; s++; } *letters = l; *digits = d; }
int main() { int letters, digits; func0("python", &letters, &digits); assert(letters == 6 && digits == 0); func0("program", &letters, &digits); assert(letters == 7 && digits == 0); func0("python3.0", &letters, &digits); assert(letters == 6 && digits == 2); return 0; }
O1
c
func0: endbr64 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %rsi,%r13 mov %rdx,%r12 movzbl (%rdi),%ebx test %bl,%bl je 11e3 <func0+0x5a> mov %rdi,%rbp callq 1090 <__ctype_b_loc@plt> mov (%rax),%rsi mov $0x0,%edx mov $0x0,%ecx jmp 11d2 <func0+0x49> and $0x400,%ax cmp $0x1,%ax sbb $0xffffffff,%ecx add $0x1,%rbp movzbl 0x0(%rbp),%ebx test %bl,%bl je 11ed <func0+0x64> movzbl %bl,%ebx movzwl (%rsi,%rbx,2),%eax test $0x8,%ah je 11bb <func0+0x32> add $0x1,%edx jmp 11c6 <func0+0x3d> mov $0x0,%edx mov $0x0,%ecx mov %ecx,0x0(%r13) mov %edx,(%r12) add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov r13, rsi mov r12, rdx movzx ebx, byte ptr [rdi] test bl, bl jz short loc_11E3 mov rbp, rdi call ___ctype_b_loc mov rsi, [rax] mov edx, 0 mov ecx, 0 jmp short loc_11D2 loc_11BB: and ax, 400h cmp ax, 1 sbb ecx, 0FFFFFFFFh loc_11C6: add rbp, 1 movzx ebx, byte ptr [rbp+0] test bl, bl jz short loc_11ED loc_11D2: movzx ebx, bl movzx eax, word ptr [rsi+rbx*2] test ah, 8 jz short loc_11BB add edx, 1 jmp short loc_11C6 loc_11E3: mov edx, 0 mov ecx, 0 loc_11ED: mov [r13+0], ecx mov [r12], edx add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
void func0(unsigned __int8 *a1, _DWORD *a2, _DWORD *a3) { unsigned __int8 v5; // bl unsigned __int8 *v6; // rbp long long v7; // rsi int v8; // edx int v9; // ecx __int16 v10; // ax v5 = *a1; if ( *a1 ) { v6 = a1; v7 = *(_QWORD *)__ctype_b_loc(); v8 = 0; v9 = 0; do { v10 = *(_WORD *)(v7 + 2LL * v5); if ( (v10 & 0x800) != 0 ) ++v8; else v9 -= ((v10 & 0x400) == 0) - 1; v5 = *++v6; } while ( *v6 ); } else { v8 = 0; v9 = 0; } *a2 = v9; *a3 = v8; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R13,RSI MOV R12,RDX MOVZX EBX,byte ptr [RDI] TEST BL,BL JZ 0x001011e3 MOV RBP,RDI CALL 0x00101090 MOV RSI,qword ptr [RAX] MOV EDX,0x0 MOV ECX,0x0 JMP 0x001011d2 LAB_001011bb: AND AX,0x400 CMP AX,0x1 SBB ECX,-0x1 LAB_001011c6: ADD RBP,0x1 MOVZX EBX,byte ptr [RBP] TEST BL,BL JZ 0x001011ed LAB_001011d2: MOVZX EBX,BL MOVZX EAX,word ptr [RSI + RBX*0x2] TEST AH,0x8 JZ 0x001011bb ADD EDX,0x1 JMP 0x001011c6 LAB_001011e3: MOV EDX,0x0 MOV ECX,0x0 LAB_001011ed: MOV dword ptr [R13],ECX MOV dword ptr [R12],EDX ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
void func0(byte *param_1,int *param_2,int *param_3) { ushort **ppuVar1; int iVar2; int iVar3; byte bVar4; bVar4 = *param_1; if (bVar4 == 0) { iVar3 = 0; iVar2 = 0; } else { ppuVar1 = __ctype_b_loc(); iVar3 = 0; iVar2 = 0; do { if (((*ppuVar1)[bVar4] & 0x800) == 0) { iVar2 = (iVar2 + 1) - (uint)(((*ppuVar1)[bVar4] & 0x400) == 0); } else { iVar3 = iVar3 + 1; } param_1 = param_1 + 1; bVar4 = *param_1; } while (bVar4 != 0); } *param_2 = iVar2; *param_3 = iVar3; return; }
5,266
func0
#include <ctype.h> #include <assert.h>
void func0(const char *s, int *letters, int *digits) { int l = 0, d = 0; while (*s) { if (isdigit((unsigned char)*s)) d++; else if (isalpha((unsigned char)*s)) l++; s++; } *letters = l; *digits = d; }
int main() { int letters, digits; func0("python", &letters, &digits); assert(letters == 6 && digits == 0); func0("program", &letters, &digits); assert(letters == 7 && digits == 0); func0("python3.0", &letters, &digits); assert(letters == 6 && digits == 2); return 0; }
O2
c
func0: endbr64 push %r13 mov %rsi,%r13 push %r12 mov %rdx,%r12 push %rbp push %rbx sub $0x8,%rsp movzbl (%rdi),%ebx test %bl,%bl je 1308 <func0+0x78> mov %rdi,%rbp callq 1090 <__ctype_b_loc@plt> xor %ecx,%ecx xor %edi,%edi mov (%rax),%r8 jmp 12cf <func0+0x3f> nopl 0x0(%rax) movzbl 0x1(%rbp),%ebx add $0x1,%rbp add $0x1,%ecx test %bl,%bl je 12f0 <func0+0x60> movzwl (%r8,%rbx,2),%eax test $0x8,%ah jne 12c0 <func0+0x30> and $0x400,%ax cmp $0x1,%ax sbb $0xffffffff,%edi movzbl 0x1(%rbp),%ebx add $0x1,%rbp test %bl,%bl jne 12cf <func0+0x3f> mov %edi,0x0(%r13) mov %ecx,(%r12) add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq nopl 0x0(%rax,%rax,1) xor %ecx,%ecx xor %edi,%edi jmp 12f0 <func0+0x60> xchg %ax,%ax
func0: endbr64 push r13 mov r13, rsi push r12 mov r12, rdx push rbp push rbx sub rsp, 8 movzx ebx, byte ptr [rdi] test bl, bl jz short loc_1308 mov rbp, rdi call ___ctype_b_loc xor ecx, ecx xor edi, edi mov r8, [rax] jmp short loc_12CF loc_12C0: movzx ebx, byte ptr [rbp+1] add rbp, 1 add ecx, 1 test bl, bl jz short loc_12F0 loc_12CF: movzx eax, word ptr [r8+rbx*2] test ah, 8 jnz short loc_12C0 and ax, 400h cmp ax, 1 sbb edi, 0FFFFFFFFh movzx ebx, byte ptr [rbp+1] add rbp, 1 test bl, bl jnz short loc_12CF loc_12F0: mov [r13+0], edi mov [r12], ecx add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_1308: xor ecx, ecx xor edi, edi jmp short loc_12F0
void func0(unsigned __int8 *a1, _DWORD *a2, _DWORD *a3) { long long v4; // rbx unsigned __int8 *v5; // rbp long long *v6; // rax int v7; // ecx int v8; // edi long long v9; // r8 __int16 v10; // ax v4 = *a1; if ( (_BYTE)v4 ) { v5 = a1; v6 = (long long *)__ctype_b_loc(); v7 = 0; v8 = 0; v9 = *v6; do { while ( 1 ) { v10 = *(_WORD *)(v9 + 2 * v4); if ( (v10 & 0x800) == 0 ) break; v4 = *++v5; ++v7; if ( !(_BYTE)v4 ) goto LABEL_6; } v8 -= ((v10 & 0x400) == 0) - 1; v4 = *++v5; } while ( (_BYTE)v4 ); } else { v7 = 0; v8 = 0; } LABEL_6: *a2 = v8; *a3 = v7; }
func0: ENDBR64 PUSH R13 MOV R13,RSI PUSH R12 MOV R12,RDX PUSH RBP PUSH RBX SUB RSP,0x8 MOVZX EBX,byte ptr [RDI] TEST BL,BL JZ 0x00101308 MOV RBP,RDI CALL 0x00101090 XOR ECX,ECX XOR EDI,EDI MOV R8,qword ptr [RAX] JMP 0x001012cf LAB_001012c0: MOVZX EBX,byte ptr [RBP + 0x1] ADD RBP,0x1 ADD ECX,0x1 TEST BL,BL JZ 0x001012f0 LAB_001012cf: MOVZX EAX,word ptr [R8 + RBX*0x2] TEST AH,0x8 JNZ 0x001012c0 AND AX,0x400 CMP AX,0x1 SBB EDI,-0x1 MOVZX EBX,byte ptr [RBP + 0x1] ADD RBP,0x1 TEST BL,BL JNZ 0x001012cf LAB_001012f0: MOV dword ptr [R13],EDI MOV dword ptr [R12],ECX ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_00101308: XOR ECX,ECX XOR EDI,EDI JMP 0x001012f0
void func0(byte *param_1,int *param_2,int *param_3) { byte *pbVar1; ushort **ppuVar2; int iVar3; ulong uVar4; int iVar5; uVar4 = (ulong)*param_1; if (*param_1 == 0) { iVar3 = 0; iVar5 = 0; } else { ppuVar2 = __ctype_b_loc(); iVar3 = 0; iVar5 = 0; do { while (((*ppuVar2)[uVar4] & 0x800) == 0) { iVar5 = (iVar5 + 1) - (uint)(((*ppuVar2)[uVar4] & 0x400) == 0); pbVar1 = param_1 + 1; uVar4 = (ulong)*pbVar1; param_1 = param_1 + 1; if (*pbVar1 == 0) goto LAB_001012f0; } pbVar1 = param_1 + 1; uVar4 = (ulong)*pbVar1; param_1 = param_1 + 1; iVar3 = iVar3 + 1; } while (*pbVar1 != 0); } LAB_001012f0: *param_2 = iVar5; *param_3 = iVar3; return; }
5,267
func0
#include <ctype.h> #include <assert.h>
void func0(const char *s, int *letters, int *digits) { int l = 0, d = 0; while (*s) { if (isdigit((unsigned char)*s)) d++; else if (isalpha((unsigned char)*s)) l++; s++; } *letters = l; *digits = d; }
int main() { int letters, digits; func0("python", &letters, &digits); assert(letters == 6 && digits == 0); func0("program", &letters, &digits); assert(letters == 7 && digits == 0); func0("python3.0", &letters, &digits); assert(letters == 6 && digits == 2); return 0; }
O3
c
func0: endbr64 push %r13 mov %rsi,%r13 push %r12 mov %rdx,%r12 push %rbp push %rbx sub $0x8,%rsp movzbl (%rdi),%ebx test %bl,%bl je 1308 <func0+0x78> mov %rdi,%rbp callq 1090 <__ctype_b_loc@plt> xor %ecx,%ecx xor %edi,%edi mov (%rax),%r8 jmp 12cf <func0+0x3f> nopl 0x0(%rax) movzbl 0x1(%rbp),%ebx add $0x1,%rbp add $0x1,%ecx test %bl,%bl je 12f0 <func0+0x60> movzwl (%r8,%rbx,2),%eax test $0x8,%ah jne 12c0 <func0+0x30> and $0x400,%ax cmp $0x1,%ax sbb $0xffffffff,%edi movzbl 0x1(%rbp),%ebx add $0x1,%rbp test %bl,%bl jne 12cf <func0+0x3f> mov %edi,0x0(%r13) mov %ecx,(%r12) add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq nopl 0x0(%rax,%rax,1) xor %ecx,%ecx xor %edi,%edi jmp 12f0 <func0+0x60> xchg %ax,%ax
func0: endbr64 push r13 mov r13, rsi push r12 mov r12, rdx push rbp push rbx sub rsp, 8 movzx ebx, byte ptr [rdi] test bl, bl jz short loc_1308 mov rbp, rdi call ___ctype_b_loc xor ecx, ecx xor edi, edi mov r8, [rax] jmp short loc_12CF loc_12C0: movzx ebx, byte ptr [rbp+1] add rbp, 1 add ecx, 1 test bl, bl jz short loc_12F0 loc_12CF: movzx eax, word ptr [r8+rbx*2] test ah, 8 jnz short loc_12C0 and ax, 400h cmp ax, 1 sbb edi, 0FFFFFFFFh movzx ebx, byte ptr [rbp+1] add rbp, 1 test bl, bl jnz short loc_12CF loc_12F0: mov [r13+0], edi mov [r12], ecx add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_1308: xor ecx, ecx xor edi, edi jmp short loc_12F0
void func0(unsigned __int8 *a1, _DWORD *a2, _DWORD *a3) { long long v4; // rbx unsigned __int8 *v5; // rbp const unsigned __int16 **v6; // rax int v7; // ecx int v8; // edi const unsigned __int16 *v9; // r8 unsigned __int16 v10; // ax v4 = *a1; if ( (_BYTE)v4 ) { v5 = a1; v6 = __ctype_b_loc(); v7 = 0; v8 = 0; v9 = *v6; do { while ( 1 ) { v10 = v9[v4]; if ( (v10 & 0x800) == 0 ) break; v4 = *++v5; ++v7; if ( !(_BYTE)v4 ) goto LABEL_6; } v8 -= ((v10 & 0x400) == 0) - 1; v4 = *++v5; } while ( (_BYTE)v4 ); } else { v7 = 0; v8 = 0; } LABEL_6: *a2 = v8; *a3 = v7; }
func0: ENDBR64 PUSH R13 MOV R13,RSI PUSH R12 MOV R12,RDX PUSH RBP PUSH RBX SUB RSP,0x8 MOVZX EBX,byte ptr [RDI] TEST BL,BL JZ 0x00101308 MOV RBP,RDI CALL 0x00101090 XOR ECX,ECX XOR EDI,EDI MOV R8,qword ptr [RAX] JMP 0x001012cf LAB_001012c0: MOVZX EBX,byte ptr [RBP + 0x1] ADD RBP,0x1 ADD ECX,0x1 TEST BL,BL JZ 0x001012f0 LAB_001012cf: MOVZX EAX,word ptr [R8 + RBX*0x2] TEST AH,0x8 JNZ 0x001012c0 AND AX,0x400 CMP AX,0x1 SBB EDI,-0x1 MOVZX EBX,byte ptr [RBP + 0x1] ADD RBP,0x1 TEST BL,BL JNZ 0x001012cf LAB_001012f0: MOV dword ptr [R13],EDI MOV dword ptr [R12],ECX ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_00101308: XOR ECX,ECX XOR EDI,EDI JMP 0x001012f0
void func0(byte *param_1,int *param_2,int *param_3) { byte *pbVar1; ushort **ppuVar2; int iVar3; ulong uVar4; int iVar5; uVar4 = (ulong)*param_1; if (*param_1 == 0) { iVar3 = 0; iVar5 = 0; } else { ppuVar2 = __ctype_b_loc(); iVar3 = 0; iVar5 = 0; do { while (((*ppuVar2)[uVar4] & 0x800) == 0) { iVar5 = (iVar5 + 1) - (uint)(((*ppuVar2)[uVar4] & 0x400) == 0); pbVar1 = param_1 + 1; uVar4 = (ulong)*pbVar1; param_1 = param_1 + 1; if (*pbVar1 == 0) goto LAB_001012f0; } pbVar1 = param_1 + 1; uVar4 = (ulong)*pbVar1; param_1 = param_1 + 1; iVar3 = iVar3 + 1; } while (*pbVar1 != 0); } LAB_001012f0: *param_2 = iVar5; *param_3 = iVar3; return; }
5,268
func0
#include <math.h> #include <assert.h>
int func0(int n, int m) { return (int)sqrt(m) - (int)sqrt(n - 1); }
int main() { assert(func0(5, 100) == 8); assert(func0(8, 65) == 6); assert(func0(2, 5) == 1); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x18,%rsp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) cvtsi2sdl -0x18(%rbp),%xmm0 callq 1070 <sqrt@plt> cvttsd2si %xmm0,%ebx mov -0x14(%rbp),%eax sub $0x1,%eax cvtsi2sd %eax,%xmm0 callq 1070 <sqrt@plt> cvttsd2si %xmm0,%eax sub %eax,%ebx mov %ebx,%eax add $0x18,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 18h mov [rbp+var_14], edi mov [rbp+var_18], esi pxor xmm1, xmm1 cvtsi2sd xmm1, [rbp+var_18] movq rax, xmm1 movq xmm0, rax; x call _sqrt cvttsd2si ebx, xmm0 mov eax, [rbp+var_14] sub eax, 1 pxor xmm2, xmm2 cvtsi2sd xmm2, eax movq rax, xmm2 movq xmm0, rax; x call _sqrt cvttsd2si eax, xmm0 mov edx, ebx sub edx, eax mov eax, edx mov rbx, [rbp+var_8] leave retn
long long func0(int a1, int a2) { int v2; // ebx v2 = (int)sqrt((double)a2); return (unsigned int)(v2 - (int)sqrt((double)(a1 - 1))); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x18 MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x18],ESI PXOR XMM1,XMM1 CVTSI2SD XMM1,dword ptr [RBP + -0x18] MOVQ RAX,XMM1 MOVQ XMM0,RAX CALL 0x00101070 CVTTSD2SI EBX,XMM0 MOV EAX,dword ptr [RBP + -0x14] SUB EAX,0x1 PXOR XMM2,XMM2 CVTSI2SD XMM2,EAX MOVQ RAX,XMM2 MOVQ XMM0,RAX CALL 0x00101070 CVTTSD2SI EAX,XMM0 MOV EDX,EBX SUB EDX,EAX MOV EAX,EDX MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int func0(int param_1,int param_2) { double dVar1; double dVar2; dVar1 = sqrt((double)param_2); dVar2 = sqrt((double)(param_1 + -1)); return (int)dVar1 - (int)dVar2; }
5,269
func0
#include <math.h> #include <assert.h>
int func0(int n, int m) { return (int)sqrt(m) - (int)sqrt(n - 1); }
int main() { assert(func0(5, 100) == 8); assert(func0(8, 65) == 6); assert(func0(2, 5) == 1); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x18,%rsp mov %edi,%ebx pxor %xmm0,%xmm0 cvtsi2sd %esi,%xmm0 movapd %xmm0,%xmm2 sqrtsd %xmm2,%xmm2 movsd %xmm2,0x8(%rsp) pxor %xmm1,%xmm1 ucomisd %xmm0,%xmm1 ja 11cf <func0+0x66> cvttsd2si 0x8(%rsp),%ebp sub $0x1,%ebx pxor %xmm0,%xmm0 cvtsi2sd %ebx,%xmm0 movapd %xmm0,%xmm3 sqrtsd %xmm3,%xmm3 movsd %xmm3,0x8(%rsp) pxor %xmm1,%xmm1 ucomisd %xmm0,%xmm1 ja 11d6 <func0+0x6d> cvttsd2si 0x8(%rsp),%eax sub %eax,%ebp mov %ebp,%eax add $0x18,%rsp pop %rbx pop %rbp retq callq 1070 <sqrt@plt> jmp 1195 <func0+0x2c> callq 1070 <sqrt@plt> jmp 11be <func0+0x55>
func0: endbr64 push rbp push rbx sub rsp, 8 mov ebx, edi pxor xmm0, xmm0 cvtsi2sd xmm0, esi pxor xmm1, xmm1 ucomisd xmm1, xmm0 ja short loc_11B7 sqrtsd xmm0, xmm0 loc_118B: cvttsd2si ebp, xmm0 sub ebx, 1 pxor xmm0, xmm0 cvtsi2sd xmm0, ebx pxor xmm1, xmm1 ucomisd xmm1, xmm0 ja short loc_11BE sqrtsd xmm0, xmm0 loc_11A8: cvttsd2si edx, xmm0 mov eax, ebp sub eax, edx add rsp, 8 pop rbx pop rbp retn loc_11B7: call _sqrt jmp short loc_118B loc_11BE: call _sqrt jmp short loc_11A8
long long func0(int a1, int a2) { double v2; // xmm0_8 double v3; // xmm0_8 int v4; // ebp double v5; // xmm0_8 double v6; // xmm0_8 v2 = (double)a2; if ( (double)a2 < 0.0 ) v3 = sqrt(v2); else v3 = sqrt(v2); v4 = (int)v3; v5 = (double)(a1 - 1); if ( v5 < 0.0 ) v6 = sqrt(v5); else v6 = sqrt(v5); return (unsigned int)(v4 - (int)v6); }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x8 MOV EBX,EDI PXOR XMM0,XMM0 CVTSI2SD XMM0,ESI PXOR XMM1,XMM1 UCOMISD XMM1,XMM0 JA 0x001011b7 SQRTSD XMM0,XMM0 LAB_0010118b: CVTTSD2SI EBP,XMM0 SUB EBX,0x1 PXOR XMM0,XMM0 CVTSI2SD XMM0,EBX PXOR XMM1,XMM1 UCOMISD XMM1,XMM0 JA 0x001011be SQRTSD XMM0,XMM0 LAB_001011a8: CVTTSD2SI EDX,XMM0 MOV EAX,EBP SUB EAX,EDX ADD RSP,0x8 POP RBX POP RBP RET LAB_001011b7: CALL 0x00101070 JMP 0x0010118b LAB_001011be: CALL 0x00101070 JMP 0x001011a8
int func0(int param_1,int param_2) { double dVar1; double dVar2; dVar1 = (double)param_2; if (dVar1 < 0.0) { dVar1 = sqrt(dVar1); } else { dVar1 = SQRT(dVar1); } dVar2 = (double)(param_1 + -1); if (dVar2 < 0.0) { dVar2 = sqrt(dVar2); } else { dVar2 = SQRT(dVar2); } return (int)dVar1 - (int)dVar2; }
5,270
func0
#include <math.h> #include <assert.h>
int func0(int n, int m) { return (int)sqrt(m) - (int)sqrt(n - 1); }
int main() { assert(func0(5, 100) == 8); assert(func0(8, 65) == 6); assert(func0(2, 5) == 1); return 0; }
O2
c
func0: endbr64 pxor %xmm0,%xmm0 pxor %xmm2,%xmm2 sub $0x18,%rsp cvtsi2sd %esi,%xmm0 ucomisd %xmm0,%xmm2 movapd %xmm0,%xmm1 sqrtsd %xmm1,%xmm1 ja 126a <func0+0x4a> sub $0x1,%edi cvttsd2si %xmm1,%eax pxor %xmm0,%xmm0 cvtsi2sd %edi,%xmm0 ucomisd %xmm0,%xmm2 movapd %xmm0,%xmm1 sqrtsd %xmm1,%xmm1 ja 1287 <func0+0x67> cvttsd2si %xmm1,%edx add $0x18,%rsp sub %edx,%eax retq mov %edi,0x8(%rsp) movsd %xmm1,(%rsp) callq 1070 <sqrt@plt> mov 0x8(%rsp),%edi movsd (%rsp),%xmm1 pxor %xmm2,%xmm2 jmp 1242 <func0+0x22> mov %eax,(%rsp) movsd %xmm1,0x8(%rsp) callq 1070 <sqrt@plt> movsd 0x8(%rsp),%xmm1 mov (%rsp),%eax jmp 125f <func0+0x3f>
func0: endbr64 pxor xmm0, xmm0 pxor xmm1, xmm1 sub rsp, 18h cvtsi2sd xmm0, esi ucomisd xmm1, xmm0 ja short loc_1262 sqrtsd xmm0, xmm0 loc_123E: sub edi, 1 cvttsd2si eax, xmm0 pxor xmm0, xmm0 cvtsi2sd xmm0, edi ucomisd xmm1, xmm0 ja short loc_1275 sqrtsd xmm0, xmm0 loc_1257: cvttsd2si edx, xmm0 add rsp, 18h sub eax, edx retn loc_1262: mov [rsp+18h+var_C], edi call _sqrt mov edi, [rsp+18h+var_C] pxor xmm1, xmm1 jmp short loc_123E loc_1275: mov [rsp+18h+var_C], eax call _sqrt mov eax, [rsp+18h+var_C] jmp short loc_1257
long long func0(int a1, int a2) { double v2; // xmm0_8 double v3; // xmm0_8 int v4; // eax double v5; // xmm0_8 double v6; // xmm0_8 int v8; // [rsp+Ch] [rbp-Ch] v2 = (double)a2; if ( (double)a2 < 0.0 ) v3 = sqrt(v2); else v3 = sqrt(v2); v4 = (int)v3; v5 = (double)(a1 - 1); if ( v5 < 0.0 ) { v8 = v4; v6 = sqrt(v5); v4 = v8; } else { v6 = sqrt(v5); } return (unsigned int)(v4 - (int)v6); }
func0: ENDBR64 PXOR XMM0,XMM0 PXOR XMM1,XMM1 SUB RSP,0x18 CVTSI2SD XMM0,ESI UCOMISD XMM1,XMM0 JA 0x00101262 SQRTSD XMM0,XMM0 LAB_0010123e: SUB EDI,0x1 CVTTSD2SI EAX,XMM0 PXOR XMM0,XMM0 CVTSI2SD XMM0,EDI UCOMISD XMM1,XMM0 JA 0x00101275 SQRTSD XMM0,XMM0 LAB_00101257: CVTTSD2SI EDX,XMM0 ADD RSP,0x18 SUB EAX,EDX RET LAB_00101262: MOV dword ptr [RSP + 0xc],EDI CALL 0x00101070 MOV EDI,dword ptr [RSP + 0xc] PXOR XMM1,XMM1 JMP 0x0010123e LAB_00101275: MOV dword ptr [RSP + 0xc],EAX CALL 0x00101070 MOV EAX,dword ptr [RSP + 0xc] JMP 0x00101257
int func0(int param_1,int param_2) { double dVar1; double dVar2; dVar1 = (double)param_2; if (dVar1 < 0.0) { dVar1 = sqrt(dVar1); } else { dVar1 = SQRT(dVar1); } dVar2 = (double)(param_1 + -1); if (dVar2 < 0.0) { dVar2 = sqrt(dVar2); } else { dVar2 = SQRT(dVar2); } return (int)dVar1 - (int)dVar2; }
5,271
func0
#include <math.h> #include <assert.h>
int func0(int n, int m) { return (int)sqrt(m) - (int)sqrt(n - 1); }
int main() { assert(func0(5, 100) == 8); assert(func0(8, 65) == 6); assert(func0(2, 5) == 1); return 0; }
O3
c
func0: endbr64 pxor %xmm0,%xmm0 pxor %xmm2,%xmm2 sub $0x18,%rsp cvtsi2sd %esi,%xmm0 ucomisd %xmm0,%xmm2 movapd %xmm0,%xmm1 sqrtsd %xmm1,%xmm1 ja 126a <func0+0x4a> sub $0x1,%edi cvttsd2si %xmm1,%eax pxor %xmm0,%xmm0 cvtsi2sd %edi,%xmm0 ucomisd %xmm0,%xmm2 movapd %xmm0,%xmm1 sqrtsd %xmm1,%xmm1 ja 1287 <func0+0x67> cvttsd2si %xmm1,%edx add $0x18,%rsp sub %edx,%eax retq mov %edi,0x8(%rsp) movsd %xmm1,(%rsp) callq 1070 <sqrt@plt> mov 0x8(%rsp),%edi movsd (%rsp),%xmm1 pxor %xmm2,%xmm2 jmp 1242 <func0+0x22> mov %eax,(%rsp) movsd %xmm1,0x8(%rsp) callq 1070 <sqrt@plt> movsd 0x8(%rsp),%xmm1 mov (%rsp),%eax jmp 125f <func0+0x3f>
func0: endbr64 pxor xmm0, xmm0 pxor xmm1, xmm1 sub rsp, 18h cvtsi2sd xmm0, esi; x ucomisd xmm1, xmm0 ja short loc_1266 sqrtsd xmm0, xmm0 loc_123E: sub edi, 1 cvttsd2si eax, xmm0 pxor xmm0, xmm0 cvtsi2sd xmm0, edi; x pxor xmm1, xmm1 ucomisd xmm1, xmm0 ja short loc_1275 sqrtsd xmm0, xmm0 loc_125B: cvttsd2si edx, xmm0 add rsp, 18h sub eax, edx retn loc_1266: mov [rsp+18h+var_C], edi call _sqrt mov edi, [rsp+18h+var_C] jmp short loc_123E loc_1275: mov [rsp+18h+var_C], eax call _sqrt mov eax, [rsp+18h+var_C] jmp short loc_125B
long long func0(int a1, int a2) { double v2; // xmm0_8 double v3; // xmm0_8 int v4; // eax double v5; // xmm0_8 double v6; // xmm0_8 int v8; // [rsp+Ch] [rbp-Ch] v2 = (double)a2; if ( (double)a2 < 0.0 ) v3 = sqrt(v2); else v3 = sqrt(v2); v4 = (int)v3; v5 = (double)(a1 - 1); if ( v5 < 0.0 ) { v8 = v4; v6 = sqrt(v5); v4 = v8; } else { v6 = sqrt(v5); } return (unsigned int)(v4 - (int)v6); }
func0: ENDBR64 PXOR XMM0,XMM0 PXOR XMM1,XMM1 SUB RSP,0x18 CVTSI2SD XMM0,ESI UCOMISD XMM1,XMM0 JA 0x00101266 SQRTSD XMM0,XMM0 LAB_0010123e: SUB EDI,0x1 CVTTSD2SI EAX,XMM0 PXOR XMM0,XMM0 CVTSI2SD XMM0,EDI PXOR XMM1,XMM1 UCOMISD XMM1,XMM0 JA 0x00101275 SQRTSD XMM0,XMM0 LAB_0010125b: CVTTSD2SI EDX,XMM0 ADD RSP,0x18 SUB EAX,EDX RET LAB_00101266: MOV dword ptr [RSP + 0xc],EDI CALL 0x00101070 MOV EDI,dword ptr [RSP + 0xc] JMP 0x0010123e LAB_00101275: MOV dword ptr [RSP + 0xc],EAX CALL 0x00101070 MOV EAX,dword ptr [RSP + 0xc] JMP 0x0010125b
int func0(int param_1,int param_2) { double dVar1; double dVar2; dVar1 = (double)param_2; if (dVar1 < 0.0) { dVar1 = sqrt(dVar1); } else { dVar1 = SQRT(dVar1); } dVar2 = (double)(param_1 + -1); if (dVar2 < 0.0) { dVar2 = sqrt(dVar2); } else { dVar2 = SQRT(dVar2); } return (int)dVar1 - (int)dVar2; }
5,272
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h>
int* func0(int nums[], int size, int *result_size) { *result_size = size - 1; int *result = malloc(*result_size * sizeof(int)); for (int i = 0; i < *result_size; i++) { result[i] = nums[i + 1] - nums[i]; } return result; }
int main() { int result_size; int *result; int test1[] = {1, 1, 3, 4, 4, 5, 6, 7}; result = func0(test1, 8, &result_size); int expected1[] = {0, 2, 1, 0, 1, 1, 1}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected1[i]); } free(result); int test2[] = {4, 5, 8, 9, 6, 10}; result = func0(test2, 6, &result_size); int expected2[] = {1, 3, 1, -3, 4}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected2[i]); } free(result); int test3[] = {0, 1, 2, 3, 4, 4, 4, 4, 5, 7}; result = func0(test3, 10, &result_size); int expected3[] = {1, 1, 1, 1, 0, 0, 0, 1, 2}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected3[i]); } free(result); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %rdx,-0x28(%rbp) mov -0x1c(%rbp),%eax lea -0x1(%rax),%edx mov -0x28(%rbp),%rax mov %edx,(%rax) mov -0x28(%rbp),%rax mov (%rax),%eax cltq shl $0x2,%rax mov %rax,%rdi callq 10b0 <malloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0xc(%rbp) jmp 123b <func0+0x92> mov -0xc(%rbp),%eax cltq add $0x1,%rax lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%ecx mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rsi mov -0x8(%rbp),%rax add %rsi,%rax sub %edx,%ecx mov %ecx,%edx mov %edx,(%rax) addl $0x1,-0xc(%rbp) mov -0x28(%rbp),%rax mov (%rax),%eax cmp %eax,-0xc(%rbp) jl 11ed <func0+0x44> mov -0x8(%rbp),%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_28], rdx mov eax, [rbp+var_1C] lea edx, [rax-1] mov rax, [rbp+var_28] mov [rax], edx mov rax, [rbp+var_28] mov eax, [rax] cdqe shl rax, 2 mov rdi, rax; size call _malloc mov [rbp+var_8], rax mov [rbp+var_C], 0 jmp short loc_123A loc_11ED: mov eax, [rbp+var_C] cdqe add rax, 1 lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov ecx, [rax] mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] mov edx, [rbp+var_C] movsxd rdx, edx lea rsi, ds:0[rdx*4] mov rdx, [rbp+var_8] add rdx, rsi sub ecx, eax mov [rdx], ecx add [rbp+var_C], 1 loc_123A: mov rax, [rbp+var_28] mov eax, [rax] cmp [rbp+var_C], eax jl short loc_11ED mov rax, [rbp+var_8] leave retn
_DWORD * func0(long long a1, int a2, int *a3) { int i; // [rsp+24h] [rbp-Ch] _DWORD *v6; // [rsp+28h] [rbp-8h] *a3 = a2 - 1; v6 = malloc(4LL * *a3); for ( i = 0; i < *a3; ++i ) v6[i] = *(_DWORD *)(4 * (i + 1LL) + a1) - *(_DWORD *)(4LL * i + a1); return v6; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV qword ptr [RBP + -0x28],RDX MOV EAX,dword ptr [RBP + -0x1c] LEA EDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x28] MOV dword ptr [RAX],EDX MOV RAX,qword ptr [RBP + -0x28] MOV EAX,dword ptr [RAX] CDQE SHL RAX,0x2 MOV RDI,RAX CALL 0x001010b0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0xc],0x0 JMP 0x0010123a LAB_001011ed: MOV EAX,dword ptr [RBP + -0xc] CDQE ADD RAX,0x1 LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV ECX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX LEA RSI,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x8] ADD RDX,RSI SUB ECX,EAX MOV dword ptr [RDX],ECX ADD dword ptr [RBP + -0xc],0x1 LAB_0010123a: MOV RAX,qword ptr [RBP + -0x28] MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0xc],EAX JL 0x001011ed MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1,int param_2,int *param_3) { void *pvVar1; int4 local_14; *param_3 = param_2 + -1; pvVar1 = malloc((long)*param_3 << 2); for (local_14 = 0; local_14 < *param_3; local_14 = local_14 + 1) { *(int *)((long)pvVar1 + (long)local_14 * 4) = *(int *)(param_1 + ((long)local_14 + 1) * 4) - *(int *)(param_1 + (long)local_14 * 4); } return pvVar1; }
5,273
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h>
int* func0(int nums[], int size, int *result_size) { *result_size = size - 1; int *result = malloc(*result_size * sizeof(int)); for (int i = 0; i < *result_size; i++) { result[i] = nums[i + 1] - nums[i]; } return result; }
int main() { int result_size; int *result; int test1[] = {1, 1, 3, 4, 4, 5, 6, 7}; result = func0(test1, 8, &result_size); int expected1[] = {0, 2, 1, 0, 1, 1, 1}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected1[i]); } free(result); int test2[] = {4, 5, 8, 9, 6, 10}; result = func0(test2, 6, &result_size); int expected2[] = {1, 3, 1, -3, 4}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected2[i]); } free(result); int test3[] = {0, 1, 2, 3, 4, 4, 4, 4, 5, 7}; result = func0(test3, 10, &result_size); int expected3[] = {1, 1, 1, 1, 0, 0, 0, 1, 2}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected3[i]); } free(result); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbx mov %rdx,%rbp sub $0x1,%esi mov %esi,(%rdx) movslq %esi,%rsi lea 0x0(,%rsi,4),%rdi callq 10b0 <malloc@plt> mov 0x0(%rbp),%edx test %edx,%edx jle 11f3 <func0+0x4a> lea -0x1(%rdx),%esi mov $0x0,%edx mov 0x4(%rbx,%rdx,4),%ecx sub (%rbx,%rdx,4),%ecx mov %ecx,(%rax,%rdx,4) mov %rdx,%rcx add $0x1,%rdx cmp %rsi,%rcx jne 11dd <func0+0x34> add $0x8,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp push rbx sub rsp, 8 mov rbx, rdi mov rbp, rdx sub esi, 1 mov [rdx], esi movsxd rsi, esi lea rdi, ds:0[rsi*4] call _malloc mov esi, [rbp+0] test esi, esi jle short loc_11EF mov esi, esi mov edx, 0 loc_11DC: mov ecx, [rbx+rdx*4+4] sub ecx, [rbx+rdx*4] mov [rax+rdx*4], ecx add rdx, 1 cmp rdx, rsi jnz short loc_11DC loc_11EF: add rsp, 8 pop rbx pop rbp retn
long long func0(long long a1, int a2, int *a3) { int v4; // esi long long result; // rax int v6; // esi long long v7; // rdx v4 = a2 - 1; *a3 = v4; result = malloc(4LL * v4); v6 = *a3; if ( *a3 > 0 ) { v7 = 0LL; do { *(_DWORD *)(result + 4 * v7) = *(_DWORD *)(a1 + 4 * v7 + 4) - *(_DWORD *)(a1 + 4 * v7); ++v7; } while ( v7 != v6 ); } return result; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBX,RDI MOV RBP,RDX SUB ESI,0x1 MOV dword ptr [RDX],ESI MOVSXD RSI,ESI LEA RDI,[RSI*0x4] CALL 0x001010b0 MOV ESI,dword ptr [RBP] TEST ESI,ESI JLE 0x001011ef MOV ESI,ESI MOV EDX,0x0 LAB_001011dc: MOV ECX,dword ptr [RBX + RDX*0x4 + 0x4] SUB ECX,dword ptr [RBX + RDX*0x4] MOV dword ptr [RAX + RDX*0x4],ECX ADD RDX,0x1 CMP RDX,RSI JNZ 0x001011dc LAB_001011ef: ADD RSP,0x8 POP RBX POP RBP RET
void func0(long param_1,int param_2,uint *param_3) { uint uVar1; void *pvVar2; ulong uVar3; *param_3 = param_2 - 1U; pvVar2 = malloc((long)(int)(param_2 - 1U) * 4); uVar1 = *param_3; if (0 < (int)uVar1) { uVar3 = 0; do { *(int *)((long)pvVar2 + uVar3 * 4) = *(int *)(param_1 + 4 + uVar3 * 4) - *(int *)(param_1 + uVar3 * 4); uVar3 = uVar3 + 1; } while (uVar3 != uVar1); } return; }
5,274
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h>
int* func0(int nums[], int size, int *result_size) { *result_size = size - 1; int *result = malloc(*result_size * sizeof(int)); for (int i = 0; i < *result_size; i++) { result[i] = nums[i + 1] - nums[i]; } return result; }
int main() { int result_size; int *result; int test1[] = {1, 1, 3, 4, 4, 5, 6, 7}; result = func0(test1, 8, &result_size); int expected1[] = {0, 2, 1, 0, 1, 1, 1}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected1[i]); } free(result); int test2[] = {4, 5, 8, 9, 6, 10}; result = func0(test2, 6, &result_size); int expected2[] = {1, 3, 1, -3, 4}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected2[i]); } free(result); int test3[] = {0, 1, 2, 3, 4, 4, 4, 4, 5, 7}; result = func0(test3, 10, &result_size); int expected3[] = {1, 1, 1, 1, 0, 0, 0, 1, 2}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected3[i]); } free(result); return 0; }
O2
c
func0: endbr64 push %rbp sub $0x1,%esi mov %rdx,%rbp push %rbx mov %rdi,%rbx sub $0x8,%rsp mov %esi,(%rdx) movslq %esi,%rsi lea 0x0(,%rsi,4),%rdi callq 10b0 <malloc@plt> mov 0x0(%rbp),%edx test %edx,%edx jle 14ae <func0+0x4e> lea -0x1(%rdx),%esi xor %edx,%edx nopl 0x0(%rax) mov 0x4(%rbx,%rdx,4),%ecx sub (%rbx,%rdx,4),%ecx mov %ecx,(%rax,%rdx,4) mov %rdx,%rcx add $0x1,%rdx cmp %rsi,%rcx jne 1498 <func0+0x38> add $0x8,%rsp pop %rbx pop %rbp retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push rbp sub esi, 1 mov rbp, rdx push rbx mov rbx, rdi sub rsp, 8 mov [rdx], esi movsxd rsi, esi lea rdi, ds:0[rsi*4] call _malloc movsxd rsi, dword ptr [rbp+0] test esi, esi jle short loc_14A3 xor edx, edx nop loc_1490: mov ecx, [rbx+rdx*4+4] sub ecx, [rbx+rdx*4] mov [rax+rdx*4], ecx add rdx, 1 cmp rsi, rdx jnz short loc_1490 loc_14A3: add rsp, 8 pop rbx pop rbp retn
long long func0(long long a1, int a2, int *a3) { int v3; // esi long long result; // rax long long v6; // rsi long long i; // rdx v3 = a2 - 1; *a3 = v3; result = malloc(4LL * v3); v6 = *a3; if ( (int)v6 > 0 ) { for ( i = 0LL; i != v6; ++i ) *(_DWORD *)(result + 4 * i) = *(_DWORD *)(a1 + 4 * i + 4) - *(_DWORD *)(a1 + 4 * i); } return result; }
func0: ENDBR64 PUSH RBP SUB ESI,0x1 MOV RBP,RDX PUSH RBX MOV RBX,RDI SUB RSP,0x8 MOV dword ptr [RDX],ESI MOVSXD RSI,ESI LEA RDI,[RSI*0x4] CALL 0x001010b0 MOVSXD RSI,dword ptr [RBP] TEST ESI,ESI JLE 0x001014a3 XOR EDX,EDX NOP LAB_00101490: MOV ECX,dword ptr [RBX + RDX*0x4 + 0x4] SUB ECX,dword ptr [RBX + RDX*0x4] MOV dword ptr [RAX + RDX*0x4],ECX ADD RDX,0x1 CMP RSI,RDX JNZ 0x00101490 LAB_001014a3: ADD RSP,0x8 POP RBX POP RBP RET
void func0(long param_1,int param_2,int *param_3) { int iVar1; void *pvVar2; long lVar3; *param_3 = param_2 + -1; pvVar2 = malloc((long)(param_2 + -1) * 4); iVar1 = *param_3; if (0 < iVar1) { lVar3 = 0; do { *(int *)((long)pvVar2 + lVar3 * 4) = *(int *)(param_1 + 4 + lVar3 * 4) - *(int *)(param_1 + lVar3 * 4); lVar3 = lVar3 + 1; } while (iVar1 != lVar3); } return; }
5,275
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h>
int* func0(int nums[], int size, int *result_size) { *result_size = size - 1; int *result = malloc(*result_size * sizeof(int)); for (int i = 0; i < *result_size; i++) { result[i] = nums[i + 1] - nums[i]; } return result; }
int main() { int result_size; int *result; int test1[] = {1, 1, 3, 4, 4, 5, 6, 7}; result = func0(test1, 8, &result_size); int expected1[] = {0, 2, 1, 0, 1, 1, 1}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected1[i]); } free(result); int test2[] = {4, 5, 8, 9, 6, 10}; result = func0(test2, 6, &result_size); int expected2[] = {1, 3, 1, -3, 4}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected2[i]); } free(result); int test3[] = {0, 1, 2, 3, 4, 4, 4, 4, 5, 7}; result = func0(test3, 10, &result_size); int expected3[] = {1, 1, 1, 1, 0, 0, 0, 1, 2}; for (int i = 0; i < result_size; i++) { assert(result[i] == expected3[i]); } free(result); return 0; }
O3
c
func0: endbr64 push %rbp sub $0x1,%esi mov %rdx,%rbp push %rbx mov %rdi,%rbx sub $0x8,%rsp mov %esi,(%rdx) movslq %esi,%rsi lea 0x0(,%rsi,4),%rdi callq 10b0 <malloc@plt> mov 0x0(%rbp),%esi test %esi,%esi jle 15ec <func0+0x10c> lea -0x1(%rsi),%edi cmp $0x2,%edi jbe 164a <func0+0x16a> mov %esi,%ecx xor %edx,%edx shr $0x2,%ecx shl $0x4,%rcx nopw 0x0(%rax,%rax,1) movdqu 0x4(%rbx,%rdx,1),%xmm0 movdqu (%rbx,%rdx,1),%xmm1 psubd %xmm1,%xmm0 movups %xmm0,(%rax,%rdx,1) add $0x10,%rdx cmp %rdx,%rcx jne 1530 <func0+0x50> mov %esi,%ecx and $0xfffffffc,%ecx test $0x3,%sil je 15ec <func0+0x10c> movslq %ecx,%r8 lea 0x1(%rcx),%r9d lea 0x0(,%r8,4),%rdx lea (%rbx,%rdx,1),%r10 cmp %edi,%r9d jge 1651 <func0+0x171> cmp %ecx,%esi jle 1651 <func0+0x171> mov 0x4(%rbx,%rdx,1),%r9d mov %r9d,%r11d sub (%r10),%r11d mov 0x8(%rbx,%rdx,1),%r10d mov %r11d,(%rax,%r8,4) mov %r10d,%r8d sub %r9d,%r8d lea 0x3(%rcx),%r9d mov %r8d,0x4(%rax,%rdx,1) lea 0x2(%rcx),%r8d cmp %r9d,%edi jg 15f8 <func0+0x118> movslq %r8d,%rdx add $0x1,%rdx mov (%rbx,%rdx,4),%edi lea 0x0(,%rdx,4),%rcx sub -0x4(%rbx,%rdx,4),%edi mov %edi,-0x4(%rax,%rcx,1) lea 0x1(%r8),%edi cmp %edi,%esi jle 15ec <func0+0x10c> mov 0x4(%rbx,%rcx,1),%edi add $0x2,%r8d sub (%rbx,%rdx,4),%edi mov %edi,(%rax,%rdx,4) cmp %r8d,%esi jle 15ec <func0+0x10c> mov 0x8(%rbx,%rcx,1),%edx sub 0x4(%rbx,%rcx,1),%edx mov %edx,0x4(%rax,%rcx,1) add $0x8,%rsp pop %rbx pop %rbp retq nopl 0x0(%rax,%rax,1) mov 0xc(%rbx,%rdx,1),%r8d mov %r8d,%r9d sub %r10d,%r9d lea 0x5(%rcx),%r10d mov %r9d,0x8(%rax,%rdx,1) mov 0x10(%rbx,%rdx,1),%r9d mov %r9d,%r11d sub %r8d,%r11d lea 0x4(%rcx),%r8d mov %r11d,0xc(%rax,%rdx,1) cmp %r10d,%edi jle 15ab <func0+0xcb> mov 0x14(%rbx,%rdx,1),%edi mov 0x18(%rbx,%rdx,1),%r11d mov %edi,%r8d sub %edi,%r11d sub %r9d,%r8d mov %r11d,0x14(%rax,%rdx,1) mov %r8d,0x10(%rax,%rdx,1) lea 0x6(%rcx),%r8d jmpq 15ab <func0+0xcb> xor %ecx,%ecx jmpq 155b <func0+0x7b> mov %ecx,%r8d jmpq 15ab <func0+0xcb> nopl 0x0(%rax)
func0: endbr64 push rbp sub esi, 1 mov rbp, rdx push rbx mov rbx, rdi sub rsp, 8 mov [rdx], esi movsxd rsi, esi lea rdi, ds:0[rsi*4]; size call _malloc mov edx, [rbp+0] mov rcx, rax test edx, edx jle loc_14D9 lea eax, [rdx-1] cmp eax, 2 jbe loc_14E3 mov esi, edx xor eax, eax shr esi, 2 shl rsi, 4 nop word ptr [rax+rax+00h] loc_1470: movdqu xmm0, xmmword ptr [rbx+rax+4] movdqu xmm2, xmmword ptr [rbx+rax] psubd xmm0, xmm2 movups xmmword ptr [rcx+rax], xmm0 add rax, 10h cmp rsi, rax jnz short loc_1470 mov eax, edx and eax, 0FFFFFFFCh mov esi, eax cmp edx, eax jz short loc_14D9 loc_1497: sub edx, esi cmp edx, 1 jz short loc_14C8 lea edi, [rsi+1] lea rsi, ds:0[rdi*4] movq xmm0, qword ptr [rbx+rdi*4] movq xmm1, qword ptr [rbx+rsi-4] psubd xmm0, xmm1 movq qword ptr [rcx+rsi-4], xmm0 test dl, 1 jz short loc_14D9 and edx, 0FFFFFFFEh add eax, edx loc_14C8: cdqe add rax, 1 mov edx, [rbx+rax*4] sub edx, [rbx+rax*4-4] mov [rcx+rax*4-4], edx loc_14D9: add rsp, 8 mov rax, rcx pop rbx pop rbp retn loc_14E3: xor esi, esi xor eax, eax jmp short loc_1497
_DWORD * func0(long long a1, int a2, unsigned int *a3) { unsigned int v3; // esi _DWORD *v5; // rax unsigned int v6; // edx _DWORD *v7; // rcx long long v8; // rax signed int v9; // eax unsigned int v10; // esi unsigned int v11; // edx v3 = a2 - 1; *a3 = v3; v5 = malloc(4LL * (int)v3); v6 = *a3; v7 = v5; if ( (int)*a3 > 0 ) { if ( v6 - 1 <= 2 ) { v10 = 0; v9 = 0; } else { v8 = 0LL; do { *(__m128i *)&v7[v8] = _mm_sub_epi32( _mm_loadu_si128((const __m128i *)(a1 + v8 * 4 + 4)), _mm_loadu_si128((const __m128i *)(a1 + v8 * 4))); v8 += 4LL; } while ( 4LL * (v6 >> 2) != v8 ); v9 = v6 & 0xFFFFFFFC; v10 = v6 & 0xFFFFFFFC; if ( v6 == (v6 & 0xFFFFFFFC) ) return v7; } v11 = v6 - v10; if ( v11 == 1 ) { LABEL_9: v7[v9] = *(_DWORD *)(a1 + 4 * (v9 + 1LL)) - *(_DWORD *)(a1 + 4 * (v9 + 1LL) - 4); return v7; } *(_QWORD *)&v7[v10] = _mm_sub_epi32( _mm_loadl_epi64((const __m128i *)(a1 + 4LL * (v10 + 1))), _mm_loadl_epi64((const __m128i *)(a1 + 4LL * (v10 + 1) - 4))).m128i_u64[0]; if ( (v11 & 1) != 0 ) { v9 += v11 & 0xFFFFFFFE; goto LABEL_9; } } return v7; }
func0: ENDBR64 PUSH RBP SUB ESI,0x1 MOV RBP,RDX PUSH RBX MOV RBX,RDI SUB RSP,0x8 MOV dword ptr [RDX],ESI MOVSXD RSI,ESI LEA RDI,[RSI*0x4] CALL 0x001010b0 MOV EDX,dword ptr [RBP] MOV RCX,RAX TEST EDX,EDX JLE 0x001014d9 LEA EAX,[RDX + -0x1] CMP EAX,0x2 JBE 0x001014e3 MOV ESI,EDX XOR EAX,EAX SHR ESI,0x2 SHL RSI,0x4 NOP word ptr [RAX + RAX*0x1] LAB_00101470: MOVDQU XMM0,xmmword ptr [RBX + RAX*0x1 + 0x4] MOVDQU XMM2,xmmword ptr [RBX + RAX*0x1] PSUBD XMM0,XMM2 MOVUPS xmmword ptr [RCX + RAX*0x1],XMM0 ADD RAX,0x10 CMP RSI,RAX JNZ 0x00101470 MOV EAX,EDX AND EAX,0xfffffffc MOV ESI,EAX CMP EDX,EAX JZ 0x001014d9 LAB_00101497: SUB EDX,ESI CMP EDX,0x1 JZ 0x001014c8 LEA EDI,[RSI + 0x1] LEA RSI,[RDI*0x4] MOVQ XMM0,qword ptr [RBX + RDI*0x4] MOVQ XMM1,qword ptr [RBX + RSI*0x1 + -0x4] PSUBD XMM0,XMM1 MOVQ qword ptr [RCX + RSI*0x1 + -0x4],XMM0 TEST DL,0x1 JZ 0x001014d9 AND EDX,0xfffffffe ADD EAX,EDX LAB_001014c8: CDQE ADD RAX,0x1 MOV EDX,dword ptr [RBX + RAX*0x4] SUB EDX,dword ptr [RBX + RAX*0x4 + -0x4] MOV dword ptr [RCX + RAX*0x4 + -0x4],EDX LAB_001014d9: ADD RSP,0x8 MOV RAX,RCX POP RBX POP RBP RET LAB_001014e3: XOR ESI,ESI XOR EAX,EAX JMP 0x00101497
void * func0(long param_1,int param_2,uint *param_3) { int *piVar1; int *piVar2; int *piVar3; int8 uVar4; int8 uVar5; int iVar6; int iVar7; int iVar8; int iVar9; int iVar10; int iVar11; uint uVar12; void *pvVar13; long lVar14; uint uVar15; *param_3 = param_2 - 1U; pvVar13 = malloc((long)(int)(param_2 - 1U) * 4); uVar15 = *param_3; if (0 < (int)uVar15) { if (uVar15 - 1 < 3) { uVar12 = 0; } else { lVar14 = 0; do { piVar3 = (int *)(param_1 + 4 + lVar14); iVar6 = piVar3[1]; iVar7 = piVar3[2]; iVar8 = piVar3[3]; piVar1 = (int *)(param_1 + lVar14); iVar9 = piVar1[1]; iVar10 = piVar1[2]; iVar11 = piVar1[3]; piVar2 = (int *)((long)pvVar13 + lVar14); *piVar2 = *piVar3 - *piVar1; piVar2[1] = iVar6 - iVar9; piVar2[2] = iVar7 - iVar10; piVar2[3] = iVar8 - iVar11; lVar14 = lVar14 + 0x10; } while ((ulong)(uVar15 >> 2) << 4 != lVar14); uVar12 = uVar15 & 0xfffffffc; if (uVar15 == uVar12) { return pvVar13; } } uVar15 = uVar15 - uVar12; if (uVar15 != 1) { lVar14 = (ulong)(uVar12 + 1) * 4; uVar4 = *(int8 *)(param_1 + (ulong)(uVar12 + 1) * 4); uVar5 = *(int8 *)(param_1 + -4 + lVar14); *(ulong *)((long)pvVar13 + lVar14 + -4) = CONCAT44((int)((ulong)uVar4 >> 0x20) - (int)((ulong)uVar5 >> 0x20), (int)uVar4 - (int)uVar5); if ((uVar15 & 1) == 0) { return pvVar13; } uVar12 = uVar12 + (uVar15 & 0xfffffffe); } lVar14 = (long)(int)uVar12 + 1; *(int *)((long)pvVar13 + lVar14 * 4 + -4) = *(int *)(param_1 + lVar14 * 4) - *(int *)(param_1 + -4 + lVar14 * 4); } return pvVar13; }
5,276
func0
#include <assert.h>
int func0(int n, int k) { if (n == 0 && k == 0) { return 1; } if (k == 0) { return 0; } return func0(n, k - 1) + func0(n - 1, n - k); }
int main() { assert(func0(4, 3) == 5); assert(func0(4, 2) == 4); assert(func0(3, 1) == 1); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x18,%rsp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) cmpl $0x0,-0x14(%rbp) jne 116f <func0+0x26> cmpl $0x0,-0x18(%rbp) jne 116f <func0+0x26> mov $0x1,%eax jmp 11a7 <func0+0x5e> cmpl $0x0,-0x18(%rbp) jne 117c <func0+0x33> mov $0x0,%eax jmp 11a7 <func0+0x5e> mov -0x18(%rbp),%eax lea -0x1(%rax),%edx mov -0x14(%rbp),%eax mov %edx,%esi mov %eax,%edi callq 1149 <func0> mov %eax,%ebx mov -0x14(%rbp),%eax sub -0x18(%rbp),%eax mov -0x14(%rbp),%edx sub $0x1,%edx mov %eax,%esi mov %edx,%edi callq 1149 <func0> add %ebx,%eax add $0x18,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 18h mov [rbp+var_14], edi mov [rbp+var_18], esi cmp [rbp+var_14], 0 jnz short loc_116F cmp [rbp+var_18], 0 jnz short loc_116F mov eax, 1 jmp short loc_11A7 loc_116F: cmp [rbp+var_18], 0 jnz short loc_117C mov eax, 0 jmp short loc_11A7 loc_117C: mov eax, [rbp+var_18] lea edx, [rax-1] mov eax, [rbp+var_14] mov esi, edx mov edi, eax call func0 mov ebx, eax mov eax, [rbp+var_14] sub eax, [rbp+var_18] mov edx, [rbp+var_14] sub edx, 1 mov esi, eax mov edi, edx call func0 add eax, ebx loc_11A7: mov rbx, [rbp+var_8] leave retn
long long func0(unsigned int a1, int a2) { int v3; // ebx if ( !a1 && !a2 ) return 1LL; if ( !a2 ) return 0LL; v3 = func0(a1, (unsigned int)(a2 - 1)); return v3 + (unsigned int)func0(a1 - 1, a1 - a2); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x18 MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x18],ESI CMP dword ptr [RBP + -0x14],0x0 JNZ 0x0010116f CMP dword ptr [RBP + -0x18],0x0 JNZ 0x0010116f MOV EAX,0x1 JMP 0x001011a7 LAB_0010116f: CMP dword ptr [RBP + -0x18],0x0 JNZ 0x0010117c MOV EAX,0x0 JMP 0x001011a7 LAB_0010117c: MOV EAX,dword ptr [RBP + -0x18] LEA EDX,[RAX + -0x1] MOV EAX,dword ptr [RBP + -0x14] MOV ESI,EDX MOV EDI,EAX CALL 0x00101149 MOV EBX,EAX MOV EAX,dword ptr [RBP + -0x14] SUB EAX,dword ptr [RBP + -0x18] MOV EDX,dword ptr [RBP + -0x14] SUB EDX,0x1 MOV ESI,EAX MOV EDI,EDX CALL 0x00101149 ADD EAX,EBX LAB_001011a7: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int func0(int param_1,int param_2) { int iVar1; int iVar2; if ((param_1 == 0) && (param_2 == 0)) { iVar2 = 1; } else if (param_2 == 0) { iVar2 = 0; } else { iVar1 = func0(param_1,param_2 + -1); iVar2 = func0(param_1 + -1,param_1 - param_2); iVar2 = iVar2 + iVar1; } return iVar2; }
5,277
func0
#include <assert.h>
int func0(int n, int k) { if (n == 0 && k == 0) { return 1; } if (k == 0) { return 0; } return func0(n, k - 1) + func0(n - 1, n - k); }
int main() { assert(func0(4, 3) == 5); assert(func0(4, 2) == 4); assert(func0(3, 1) == 1); return 0; }
O1
c
func0: endbr64 mov $0x1,%eax mov %edi,%edx or %esi,%edx je 1187 <func0+0x3e> push %r12 push %rbp push %rbx mov %edi,%ebp mov %esi,%ebx mov %esi,%eax test %esi,%esi jne 116b <func0+0x22> pop %rbx pop %rbp pop %r12 retq lea -0x1(%rsi),%esi callq 1149 <func0> mov %eax,%r12d mov %ebp,%esi sub %ebx,%esi lea -0x1(%rbp),%edi callq 1149 <func0> add %r12d,%eax jmp 1166 <func0+0x1d> retq
func0: endbr64 mov eax, 1 mov edx, edi or edx, esi jz short locret_1189 push r12 push rbp push rbx mov r12d, edi mov ebx, esi mov eax, esi test esi, esi jnz short loc_116C loc_1167: pop rbx pop rbp pop r12 retn loc_116C: lea esi, [rsi-1] call func0 mov ebp, eax mov esi, r12d sub esi, ebx lea edi, [r12-1] call func0 add eax, ebp jmp short loc_1167 locret_1189: retn
long long func0(long long a1, unsigned int a2) { long long result; // rax int v3; // ebp result = 1LL; if ( a2 | (unsigned int)a1 ) { result = a2; if ( a2 ) { v3 = func0(a1, a2 - 1); return v3 + (unsigned int)func0((unsigned int)(a1 - 1), (unsigned int)a1 - a2); } } return result; }
func0: ENDBR64 MOV EAX,0x1 MOV EDX,EDI OR EDX,ESI JZ 0x00101189 PUSH R12 PUSH RBP PUSH RBX MOV R12D,EDI MOV EBX,ESI MOV EAX,ESI TEST ESI,ESI JNZ 0x0010116c LAB_00101167: POP RBX POP RBP POP R12 RET LAB_0010116c: LEA ESI,[RSI + -0x1] CALL 0x00101149 MOV EBP,EAX MOV ESI,R12D SUB ESI,EBX LEA EDI,[R12 + -0x1] CALL 0x00101149 ADD EAX,EBP JMP 0x00101167 LAB_00101189: RET
int func0(int8 param_1,int param_2) { int iVar1; int iVar2; iVar2 = (int)param_1; if (iVar2 != 0 || param_2 != 0) { if (param_2 != 0) { iVar1 = func0(param_1,param_2 + -1); param_2 = func0(iVar2 + -1,iVar2 - param_2); param_2 = param_2 + iVar1; } return param_2; } return 1; }
5,278
func0
#include <assert.h>
int func0(int n, int k) { if (n == 0 && k == 0) { return 1; } if (k == 0) { return 0; } return func0(n, k - 1) + func0(n - 1, n - k); }
int main() { assert(func0(4, 3) == 5); assert(func0(4, 2) == 4); assert(func0(3, 1) == 1); return 0; }
O2
c
func0: endbr64 mov %edi,%eax push %r12 or %esi,%eax push %rbp push %rbx je 1258 <func0+0x58> mov %esi,%ebx test %esi,%esi je 1270 <func0+0x70> mov %edi,%ebp xor %r12d,%r12d lea -0x1(%rbx),%esi mov %ebp,%edi callq 1200 <func0> mov %ebp,%edx sub $0x1,%ebp sub %ebx,%edx add %eax,%r12d mov %edx,%eax mov %edx,%ebx or %ebp,%eax je 1248 <func0+0x48> test %ebx,%ebx jne 1219 <func0+0x19> mov %r12d,%eax pop %rbx pop %rbp pop %r12 retq nopl 0x0(%rax) add $0x1,%r12d pop %rbx pop %rbp mov %r12d,%eax pop %r12 retq nopl 0x0(%rax) mov $0x1,%r12d pop %rbx pop %rbp mov %r12d,%eax pop %r12 retq nopw %cs:0x0(%rax,%rax,1) xor %r12d,%r12d jmp 1239 <func0+0x39> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 mov eax, esi mov esi, edi or esi, eax jz loc_164F test eax, eax jz locret_1655 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 68h mov [rsp+98h+var_88], 0 loc_122E: lea esi, [rax-1] mov ebx, edi lea r11d, [rdi-1] sub ebx, eax mov eax, esi mov [rsp+98h+var_84], esi or eax, edi mov [rsp+98h+var_78], ebx mov [rsp+98h+var_44], r11d jz loc_1646 test esi, esi jz loc_1640 xor r10d, r10d mov [rsp+98h+var_90], r10d loc_1260: mov esi, [rsp+98h+var_84] mov edx, edi mov [rsp+98h+var_48], r11d lea eax, [rsi-1] sub edx, esi mov [rsp+98h+var_80], eax mov esi, eax or eax, edi mov [rsp+98h+var_84], edx jz loc_160A test esi, esi jz loc_1599 xor r9d, r9d mov r10d, r11d mov [rsp+98h+var_8C], r9d loc_1295: mov eax, [rsp+98h+var_80] mov esi, edi mov [rsp+98h+var_4C], r10d lea r11d, [rax-1] sub esi, eax mov eax, r11d mov [rsp+98h+var_80], esi or eax, edi jz loc_15C2 test r11d, r11d jz loc_14E6 xor r9d, r9d mov [rsp+98h+var_7C], r11d mov r11d, r10d mov r15d, r9d loc_12CC: mov eax, [rsp+98h+var_7C] mov esi, edi mov [rsp+98h+var_50], r11d lea r14d, [rax-1] sub esi, eax mov eax, r14d mov [rsp+98h+var_7C], esi or eax, edi jz loc_157E test r14d, r14d jz loc_1485 xor r10d, r10d mov [rsp+98h+var_40], r15d mov ebx, r11d mov r15d, r14d mov r11d, r10d loc_1306: mov eax, edi lea r14d, [r15-1] mov [rsp+98h+var_54], ebx sub eax, r15d mov r15d, eax mov eax, r14d or eax, edi jz loc_156E test r14d, r14d jz loc_1472 mov [rsp+98h+var_3C], r11d xor ecx, ecx mov r8d, r14d loc_1334: mov eax, edi lea ebp, [r8-1] mov r11d, ebx sub eax, r8d mov r8d, eax mov eax, ebp or eax, edi jz loc_150D test ebp, ebp jz loc_1460 xor r13d, r13d mov r10d, ecx mov edx, r13d mov r13d, ebp loc_1361: mov eax, edi lea ebp, [r13-1] mov ecx, ebx sub eax, r13d mov r13d, eax mov eax, ebp or eax, edi jz loc_152B test ebp, ebp jz loc_1450 mov r9d, r13d xor r12d, r12d mov r13d, ebp loc_138A: mov eax, edi lea r14d, [r13-1] mov [rsp+98h+var_58], ebx sub eax, r13d mov r13d, eax mov eax, r14d or eax, edi jz short loc_1418 test r14d, r14d jz loc_143B mov [rsp+98h+var_74], r13d xor ebp, ebp mov r13d, r9d loc_13B4: lea esi, [r14-1] mov [rsp+98h+var_5C], r11d mov [rsp+98h+var_60], ecx mov [rsp+98h+var_64], edx mov [rsp+98h+var_68], r10d mov [rsp+98h+var_6C], r8d mov [rsp+98h+var_70], edi call func0 mov edi, [rsp+98h+var_70] mov r8d, [rsp+98h+var_6C] add ebp, eax mov r10d, [rsp+98h+var_68] mov edx, [rsp+98h+var_64] sub edi, r14d mov ecx, [rsp+98h+var_60] mov r11d, [rsp+98h+var_5C] mov r14d, edi mov edi, ebx mov eax, r14d or eax, ebx jz loc_1540 test r14d, r14d jz short loc_1430 sub ebx, 1 jmp short loc_13B4 loc_1418: add r12d, 1 loc_141C: mov edi, [rsp+98h+var_58] lea ebx, [rdi-1] jmp loc_138A loc_1430: mov r9d, r13d mov r13d, [rsp+98h+var_74] add r12d, ebp loc_143B: mov eax, [rsp+98h+var_58] or eax, r13d jnz loc_155A loc_1448: mov r13d, r9d lea edx, [r12+rdx+1] loc_1450: mov eax, r13d or eax, ecx jnz loc_151C lea ecx, [r10+rdx+1] loc_1460: mov eax, r8d or eax, r11d jnz short loc_14A8 mov r11d, [rsp+98h+var_3C] lea r11d, [rcx+r11+1] loc_1472: mov eax, [rsp+98h+var_54] or eax, r15d jnz short loc_14BE loc_147B: mov r15d, [rsp+98h+var_40] lea r15d, [r15+r11+1] loc_1485: mov eax, [rsp+98h+var_7C] or eax, [rsp+98h+var_50] jz short loc_14D9 loc_148F: mov eax, [rsp+98h+var_7C] test eax, eax jz loc_15B8 loc_149B: mov edi, [rsp+98h+var_50] lea r11d, [rdi-1] jmp loc_12CC loc_14A8: test r8d, r8d jnz short loc_1510 mov r11d, [rsp+98h+var_3C] mov eax, [rsp+98h+var_54] add r11d, ecx or eax, r15d jz short loc_147B loc_14BE: test r15d, r15d jnz loc_1572 mov r15d, [rsp+98h+var_40] mov eax, [rsp+98h+var_7C] add r15d, r11d or eax, [rsp+98h+var_50] jnz short loc_148F loc_14D9: mov eax, [rsp+98h+var_8C] lea eax, [rax+r15+1] mov [rsp+98h+var_8C], eax loc_14E6: mov eax, [rsp+98h+var_80] or eax, [rsp+98h+var_4C] jz loc_1587 mov edx, [rsp+98h+var_80] test edx, edx jz loc_15CC loc_1500: mov edi, [rsp+98h+var_4C] lea r10d, [rdi-1] jmp loc_1295 loc_150D: add ecx, 1 loc_1510: mov edi, r11d lea ebx, [r11-1] jmp loc_1334 loc_151C: test r13d, r13d jnz short loc_152E mov ecx, r10d add ecx, edx jmp loc_1460 loc_152B: add edx, 1 loc_152E: mov edi, ecx lea ebx, [rcx-1] jmp loc_1361 loc_1540: mov eax, [rsp+98h+var_58] mov r9d, r13d mov r13d, [rsp+98h+var_74] lea r12d, [r12+rbp+1] or eax, r13d jz loc_1448 loc_155A: test r13d, r13d jnz loc_141C mov r13d, r9d add edx, r12d jmp loc_1450 loc_156E: add r11d, 1 loc_1572: mov edi, [rsp+98h+var_54] lea ebx, [rdi-1] jmp loc_1306 loc_157E: add r15d, 1 jmp loc_149B loc_1587: mov eax, [rsp+98h+var_90] mov r9d, [rsp+98h+var_8C] lea eax, [rax+r9+1] mov [rsp+98h+var_90], eax loc_1599: mov eax, [rsp+98h+var_84] or eax, [rsp+98h+var_48] jz short loc_15E0 loc_15A3: mov ecx, [rsp+98h+var_84] test ecx, ecx jz short loc_1611 loc_15AB: mov edi, [rsp+98h+var_48] lea r11d, [rdi-1] jmp loc_1260 loc_15B8: add [rsp+98h+var_8C], r15d jmp loc_14E6 loc_15C2: add [rsp+98h+var_8C], 1 jmp loc_1500 loc_15CC: mov r9d, [rsp+98h+var_8C] mov eax, [rsp+98h+var_84] add [rsp+98h+var_90], r9d or eax, [rsp+98h+var_48] jnz short loc_15A3 loc_15E0: mov r10d, [rsp+98h+var_90] mov eax, [rsp+98h+var_88] mov ebx, [rsp+98h+var_78] or ebx, [rsp+98h+var_44] lea eax, [rax+r10+1] jnz short loc_1627 loc_15F8: add eax, 1 loc_15FB: add rsp, 68h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_160A: add [rsp+98h+var_90], 1 jmp short loc_15AB loc_1611: mov r10d, [rsp+98h+var_90] mov eax, [rsp+98h+var_88] add eax, r10d loc_161D: mov ebx, [rsp+98h+var_78] or ebx, [rsp+98h+var_44] jz short loc_15F8 loc_1627: mov esi, [rsp+98h+var_78] test esi, esi jz short loc_15FB loc_162F: mov [rsp+98h+var_88], eax mov edi, [rsp+98h+var_44] mov eax, [rsp+98h+var_78] jmp loc_122E loc_1640: mov eax, [rsp+98h+var_88] jmp short loc_161D loc_1646: mov eax, [rsp+98h+var_88] add eax, 1 jmp short loc_162F loc_164F: mov eax, 1 retn locret_1655: retn
long long func0(long long a1, unsigned int a2) { long long result; // rax unsigned int v3; // r11d int v4; // esi bool v5; // zf unsigned int v6; // r10d int v7; // r11d int v8; // eax unsigned int v9; // r11d int v10; // r15d int v11; // r14d int v12; // eax unsigned int v13; // ebx int v14; // r15d int v15; // r11d int v16; // r14d int v17; // ecx int v18; // r8d int v19; // ebp unsigned int v20; // r11d int v21; // r10d int v22; // edx int v23; // r13d int v24; // ebp unsigned int v25; // ecx int v26; // r9d int v27; // r12d int v28; // r13d int v29; // r14d int v30; // ebp int v31; // r13d int v32; // eax int v33; // [rsp+0h] [rbp-90h] int v34; // [rsp+4h] [rbp-8Ch] unsigned int v35; // [rsp+8h] [rbp-88h] int v36; // [rsp+Ch] [rbp-84h] int v37; // [rsp+10h] [rbp-80h] int v38; // [rsp+14h] [rbp-7Ch] int v39; // [rsp+18h] [rbp-78h] int v40; // [rsp+1Ch] [rbp-74h] int v41; // [rsp+24h] [rbp-6Ch] int v42; // [rsp+28h] [rbp-68h] int v43; // [rsp+2Ch] [rbp-64h] unsigned int v44; // [rsp+30h] [rbp-60h] unsigned int v45; // [rsp+34h] [rbp-5Ch] unsigned int v46; // [rsp+38h] [rbp-58h] unsigned int v47; // [rsp+3Ch] [rbp-54h] unsigned int v48; // [rsp+40h] [rbp-50h] unsigned int v49; // [rsp+44h] [rbp-4Ch] unsigned int v50; // [rsp+48h] [rbp-48h] unsigned int v51; // [rsp+4Ch] [rbp-44h] int v52; // [rsp+50h] [rbp-40h] int v53; // [rsp+54h] [rbp-3Ch] result = a2; if ( !(a2 | (unsigned int)a1) ) return 1LL; if ( !a2 ) return result; v35 = 0; LABEL_4: v3 = a1 - 1; v36 = result - 1; v39 = a1 - result; v51 = a1 - 1; if ( !((unsigned int)a1 | ((_DWORD)result - 1)) ) { LODWORD(result) = v35 + 1; goto LABEL_79; } if ( (_DWORD)result != 1 ) { v33 = 0; while ( 1 ) { v50 = v3; v37 = v36 - 1; v4 = v36 - 1; v5 = ((unsigned int)a1 | (v36 - 1)) == 0; v36 = a1 - v36; if ( v5 ) { ++v33; goto LABEL_68; } if ( !v4 ) { LABEL_66: if ( !(v50 | v36) ) goto LABEL_72; goto LABEL_67; } v6 = v3; v34 = 0; while ( 1 ) { v49 = v6; v7 = v37 - 1; v8 = v37 - 1; v37 = a1 - v37; if ( (unsigned int)a1 | v8 ) break; ++v34; LABEL_52: a1 = v49; v6 = v49 - 1; } if ( !v7 ) goto LABEL_50; v38 = v7; v9 = v6; v10 = 0; while ( 1 ) { v48 = v9; v11 = v38 - 1; v12 = v38 - 1; v38 = a1 - v38; if ( (unsigned int)a1 | v12 ) break; ++v10; LABEL_44: a1 = v48; v9 = v48 - 1; } if ( !v11 ) goto LABEL_42; v52 = v10; v13 = v9; v14 = v11; v15 = 0; while ( 1 ) { v16 = v14 - 1; v47 = v13; v14 = a1 - v14; if ( (unsigned int)a1 | v16 ) break; ++v15; LABEL_63: a1 = v47; v13 = v47 - 1; } if ( !v16 ) goto LABEL_40; v53 = v15; v17 = 0; v18 = v16; while ( 1 ) { v19 = v18 - 1; v20 = v13; v18 = a1 - v18; if ( (unsigned int)a1 | v19 ) break; ++v17; LABEL_54: a1 = v20; v13 = v20 - 1; } if ( !v19 ) goto LABEL_38; v21 = v17; v22 = 0; v23 = v19; while ( 1 ) { v24 = v23 - 1; v25 = v13; v23 = a1 - v23; if ( !((unsigned int)a1 | v24) ) { ++v22; goto LABEL_58; } if ( !v24 ) goto LABEL_36; v26 = v23; v27 = 0; v28 = v24; while ( 1 ) { v29 = v28 - 1; v46 = v13; v28 = a1 - v28; if ( !((unsigned int)a1 | v29) ) { ++v27; goto LABEL_32; } if ( v29 ) { v40 = v28; v30 = 0; v31 = v26; while ( 1 ) { v45 = v20; v44 = v25; v43 = v22; v42 = v21; v41 = v18; v32 = func0(a1, (unsigned int)(v29 - 1)); v18 = v41; v30 += v32; v21 = v42; v22 = v43; v25 = v44; v20 = v45; v29 = a1 - v29; a1 = v13; if ( !(v13 | v29) ) break; if ( !v29 ) { v26 = v31; v28 = v40; v27 += v30; goto LABEL_34; } --v13; } v26 = v31; v28 = v40; v27 += v30 + 1; if ( !(v40 | v46) ) { LABEL_35: v23 = v26; v22 += v27 + 1; goto LABEL_36; } } else { LABEL_34: if ( !(v28 | v46) ) goto LABEL_35; } if ( !v28 ) break; LABEL_32: a1 = v46; v13 = v46 - 1; } v23 = v26; v22 += v27; LABEL_36: if ( !(v25 | v23) ) { v17 = v21 + v22 + 1; goto LABEL_38; } if ( !v23 ) break; LABEL_58: a1 = v25; v13 = v25 - 1; } v17 = v22 + v21; LABEL_38: if ( v20 | v18 ) { if ( v18 ) goto LABEL_54; v15 = v17 + v53; if ( !(v14 | v47) ) goto LABEL_41; LABEL_47: if ( !v14 ) { v10 = v15 + v52; if ( v48 | v38 ) goto LABEL_43; LABEL_49: v34 += v10 + 1; goto LABEL_50; } goto LABEL_63; } v15 = v17 + v53 + 1; LABEL_40: if ( v14 | v47 ) goto LABEL_47; LABEL_41: v10 = v52 + v15 + 1; LABEL_42: if ( !(v48 | v38) ) goto LABEL_49; LABEL_43: if ( v38 ) goto LABEL_44; v34 += v10; LABEL_50: if ( !(v49 | v37) ) { v33 += v34 + 1; goto LABEL_66; } if ( v37 ) goto LABEL_52; v33 += v34; if ( !(v50 | v36) ) { LABEL_72: result = v35 + v33 + 1; if ( !(v51 | v39) ) return (unsigned int)(result + 1); LABEL_78: if ( !v39 ) return result; LABEL_79: v35 = result; a1 = v51; LODWORD(result) = v39; goto LABEL_4; } LABEL_67: if ( !v36 ) { result = v33 + v35; goto LABEL_77; } LABEL_68: a1 = v50; v3 = v50 - 1; } } result = v35; LABEL_77: if ( v51 | v39 ) goto LABEL_78; return (unsigned int)(result + 1); }
func0: ENDBR64 MOV EAX,ESI MOV ESI,EDI OR ESI,EAX JZ 0x0010164f TEST EAX,EAX JZ 0x00101655 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x68 MOV dword ptr [RSP + 0x10],0x0 LAB_0010122e: LEA ESI,[RAX + -0x1] MOV EBX,EDI LEA R11D,[RDI + -0x1] SUB EBX,EAX MOV EAX,ESI MOV dword ptr [RSP + 0x14],ESI OR EAX,EDI MOV dword ptr [RSP + 0x20],EBX MOV dword ptr [RSP + 0x54],R11D JZ 0x00101646 TEST ESI,ESI JZ 0x00101640 XOR R10D,R10D MOV dword ptr [RSP + 0x8],R10D LAB_00101260: MOV ESI,dword ptr [RSP + 0x14] MOV EDX,EDI MOV dword ptr [RSP + 0x50],R11D LEA EAX,[RSI + -0x1] SUB EDX,ESI MOV dword ptr [RSP + 0x18],EAX MOV ESI,EAX OR EAX,EDI MOV dword ptr [RSP + 0x14],EDX JZ 0x0010160a TEST ESI,ESI JZ 0x00101599 XOR R9D,R9D MOV R10D,R11D MOV dword ptr [RSP + 0xc],R9D LAB_00101295: MOV EAX,dword ptr [RSP + 0x18] MOV ESI,EDI MOV dword ptr [RSP + 0x4c],R10D LEA R11D,[RAX + -0x1] SUB ESI,EAX MOV EAX,R11D MOV dword ptr [RSP + 0x18],ESI OR EAX,EDI JZ 0x001015c2 TEST R11D,R11D JZ 0x001014e6 XOR R9D,R9D MOV dword ptr [RSP + 0x1c],R11D MOV R11D,R10D MOV R15D,R9D LAB_001012cc: MOV EAX,dword ptr [RSP + 0x1c] MOV ESI,EDI MOV dword ptr [RSP + 0x48],R11D LEA R14D,[RAX + -0x1] SUB ESI,EAX MOV EAX,R14D MOV dword ptr [RSP + 0x1c],ESI OR EAX,EDI JZ 0x0010157e TEST R14D,R14D JZ 0x00101485 XOR R10D,R10D MOV dword ptr [RSP + 0x58],R15D MOV EBX,R11D MOV R15D,R14D MOV R11D,R10D LAB_00101306: MOV EAX,EDI LEA R14D,[R15 + -0x1] MOV dword ptr [RSP + 0x44],EBX SUB EAX,R15D MOV R15D,EAX MOV EAX,R14D OR EAX,EDI JZ 0x0010156e TEST R14D,R14D JZ 0x00101472 MOV dword ptr [RSP + 0x5c],R11D XOR ECX,ECX MOV R8D,R14D LAB_00101334: MOV EAX,EDI LEA EBP,[R8 + -0x1] MOV R11D,EBX SUB EAX,R8D MOV R8D,EAX MOV EAX,EBP OR EAX,EDI JZ 0x0010150d TEST EBP,EBP JZ 0x00101460 XOR R13D,R13D MOV R10D,ECX MOV EDX,R13D MOV R13D,EBP LAB_00101361: MOV EAX,EDI LEA EBP,[R13 + -0x1] MOV ECX,EBX SUB EAX,R13D MOV R13D,EAX MOV EAX,EBP OR EAX,EDI JZ 0x0010152b TEST EBP,EBP JZ 0x00101450 MOV R9D,R13D XOR R12D,R12D MOV R13D,EBP LAB_0010138a: MOV EAX,EDI LEA R14D,[R13 + -0x1] MOV dword ptr [RSP + 0x40],EBX SUB EAX,R13D MOV R13D,EAX MOV EAX,R14D OR EAX,EDI JZ 0x00101418 TEST R14D,R14D JZ 0x0010143b MOV dword ptr [RSP + 0x24],R13D XOR EBP,EBP MOV R13D,R9D LAB_001013b4: LEA ESI,[R14 + -0x1] MOV dword ptr [RSP + 0x3c],R11D MOV dword ptr [RSP + 0x38],ECX MOV dword ptr [RSP + 0x34],EDX MOV dword ptr [RSP + 0x30],R10D MOV dword ptr [RSP + 0x2c],R8D MOV dword ptr [RSP + 0x28],EDI CALL 0x00101200 MOV EDI,dword ptr [RSP + 0x28] MOV R8D,dword ptr [RSP + 0x2c] ADD EBP,EAX MOV R10D,dword ptr [RSP + 0x30] MOV EDX,dword ptr [RSP + 0x34] SUB EDI,R14D MOV ECX,dword ptr [RSP + 0x38] MOV R11D,dword ptr [RSP + 0x3c] MOV R14D,EDI MOV EDI,EBX MOV EAX,R14D OR EAX,EBX JZ 0x00101540 TEST R14D,R14D JZ 0x00101430 SUB EBX,0x1 JMP 0x001013b4 LAB_00101418: ADD R12D,0x1 LAB_0010141c: MOV EDI,dword ptr [RSP + 0x40] LEA EBX,[RDI + -0x1] JMP 0x0010138a LAB_00101430: MOV R9D,R13D MOV R13D,dword ptr [RSP + 0x24] ADD R12D,EBP LAB_0010143b: MOV EAX,dword ptr [RSP + 0x40] OR EAX,R13D JNZ 0x0010155a LAB_00101448: MOV R13D,R9D LEA EDX,[R12 + RDX*0x1 + 0x1] LAB_00101450: MOV EAX,R13D OR EAX,ECX JNZ 0x0010151c LEA ECX,[R10 + RDX*0x1 + 0x1] LAB_00101460: MOV EAX,R8D OR EAX,R11D JNZ 0x001014a8 MOV R11D,dword ptr [RSP + 0x5c] LEA R11D,[RCX + R11*0x1 + 0x1] LAB_00101472: MOV EAX,dword ptr [RSP + 0x44] OR EAX,R15D JNZ 0x001014be LAB_0010147b: MOV R15D,dword ptr [RSP + 0x58] LEA R15D,[R15 + R11*0x1 + 0x1] LAB_00101485: MOV EAX,dword ptr [RSP + 0x1c] OR EAX,dword ptr [RSP + 0x48] JZ 0x001014d9 LAB_0010148f: MOV EAX,dword ptr [RSP + 0x1c] TEST EAX,EAX JZ 0x001015b8 LAB_0010149b: MOV EDI,dword ptr [RSP + 0x48] LEA R11D,[RDI + -0x1] JMP 0x001012cc LAB_001014a8: TEST R8D,R8D JNZ 0x00101510 MOV R11D,dword ptr [RSP + 0x5c] MOV EAX,dword ptr [RSP + 0x44] ADD R11D,ECX OR EAX,R15D JZ 0x0010147b LAB_001014be: TEST R15D,R15D JNZ 0x00101572 MOV R15D,dword ptr [RSP + 0x58] MOV EAX,dword ptr [RSP + 0x1c] ADD R15D,R11D OR EAX,dword ptr [RSP + 0x48] JNZ 0x0010148f LAB_001014d9: MOV EAX,dword ptr [RSP + 0xc] LEA EAX,[RAX + R15*0x1 + 0x1] MOV dword ptr [RSP + 0xc],EAX LAB_001014e6: MOV EAX,dword ptr [RSP + 0x18] OR EAX,dword ptr [RSP + 0x4c] JZ 0x00101587 MOV EDX,dword ptr [RSP + 0x18] TEST EDX,EDX JZ 0x001015cc LAB_00101500: MOV EDI,dword ptr [RSP + 0x4c] LEA R10D,[RDI + -0x1] JMP 0x00101295 LAB_0010150d: ADD ECX,0x1 LAB_00101510: MOV EDI,R11D LEA EBX,[R11 + -0x1] JMP 0x00101334 LAB_0010151c: TEST R13D,R13D JNZ 0x0010152e MOV ECX,R10D ADD ECX,EDX JMP 0x00101460 LAB_0010152b: ADD EDX,0x1 LAB_0010152e: MOV EDI,ECX LEA EBX,[RCX + -0x1] JMP 0x00101361 LAB_00101540: MOV EAX,dword ptr [RSP + 0x40] MOV R9D,R13D MOV R13D,dword ptr [RSP + 0x24] LEA R12D,[R12 + RBP*0x1 + 0x1] OR EAX,R13D JZ 0x00101448 LAB_0010155a: TEST R13D,R13D JNZ 0x0010141c MOV R13D,R9D ADD EDX,R12D JMP 0x00101450 LAB_0010156e: ADD R11D,0x1 LAB_00101572: MOV EDI,dword ptr [RSP + 0x44] LEA EBX,[RDI + -0x1] JMP 0x00101306 LAB_0010157e: ADD R15D,0x1 JMP 0x0010149b LAB_00101587: MOV EAX,dword ptr [RSP + 0x8] MOV R9D,dword ptr [RSP + 0xc] LEA EAX,[RAX + R9*0x1 + 0x1] MOV dword ptr [RSP + 0x8],EAX LAB_00101599: MOV EAX,dword ptr [RSP + 0x14] OR EAX,dword ptr [RSP + 0x50] JZ 0x001015e0 LAB_001015a3: MOV ECX,dword ptr [RSP + 0x14] TEST ECX,ECX JZ 0x00101611 LAB_001015ab: MOV EDI,dword ptr [RSP + 0x50] LEA R11D,[RDI + -0x1] JMP 0x00101260 LAB_001015b8: ADD dword ptr [RSP + 0xc],R15D JMP 0x001014e6 LAB_001015c2: ADD dword ptr [RSP + 0xc],0x1 JMP 0x00101500 LAB_001015cc: MOV R9D,dword ptr [RSP + 0xc] MOV EAX,dword ptr [RSP + 0x14] ADD dword ptr [RSP + 0x8],R9D OR EAX,dword ptr [RSP + 0x50] JNZ 0x001015a3 LAB_001015e0: MOV R10D,dword ptr [RSP + 0x8] MOV EAX,dword ptr [RSP + 0x10] MOV EBX,dword ptr [RSP + 0x20] OR EBX,dword ptr [RSP + 0x54] LEA EAX,[RAX + R10*0x1 + 0x1] JNZ 0x00101627 LAB_001015f8: ADD EAX,0x1 LAB_001015fb: ADD RSP,0x68 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010160a: ADD dword ptr [RSP + 0x8],0x1 JMP 0x001015ab LAB_00101611: MOV R10D,dword ptr [RSP + 0x8] MOV EAX,dword ptr [RSP + 0x10] ADD EAX,R10D LAB_0010161d: MOV EBX,dword ptr [RSP + 0x20] OR EBX,dword ptr [RSP + 0x54] JZ 0x001015f8 LAB_00101627: MOV ESI,dword ptr [RSP + 0x20] TEST ESI,ESI JZ 0x001015fb LAB_0010162f: MOV dword ptr [RSP + 0x10],EAX MOV EDI,dword ptr [RSP + 0x54] MOV EAX,dword ptr [RSP + 0x20] JMP 0x0010122e LAB_00101640: MOV EAX,dword ptr [RSP + 0x10] JMP 0x0010161d LAB_00101646: MOV EAX,dword ptr [RSP + 0x10] ADD EAX,0x1 JMP 0x0010162f LAB_0010164f: MOV EAX,0x1 RET LAB_00101655: RET
int func0(ulong param_1,int param_2) { ulong uVar1; int iVar2; int iVar3; int iVar4; int iVar5; int iVar6; uint uVar7; uint uVar8; ulong uVar9; ulong uVar10; ulong uVar11; ulong uVar12; int iVar13; int iVar14; int iVar15; int iVar16; int iVar17; uint uVar18; uint uVar19; int iVar20; uint uVar21; uint uVar22; int iVar23; int iVar24; int local_90; int local_8c; int local_88; int local_84; int local_80; int local_7c; if ((int)param_1 == 0 && param_2 == 0) { return 1; } if (param_2 == 0) { return param_2; } local_88 = 0; LAB_0010122e: local_84 = param_2 + -1; iVar17 = (int)param_1; uVar19 = iVar17 - 1; param_2 = iVar17 - param_2; if (local_84 != 0 || iVar17 != 0) { if (local_84 != 0) { local_90 = 0; uVar22 = uVar19; LAB_00101260: local_80 = local_84 + -1; local_84 = (int)param_1 - local_84; if (local_80 == 0 && (int)param_1 == 0) { local_90 = local_90 + 1; goto LAB_001015ab; } if (local_80 != 0) { local_8c = 0; uVar18 = uVar22; LAB_00101295: local_7c = local_80 + -1; local_80 = (int)param_1 - local_80; if (local_7c != 0 || (int)param_1 != 0) { if (local_7c != 0) { iVar17 = 0; uVar21 = uVar18; LAB_001012cc: iVar2 = local_7c + -1; local_7c = (int)param_1 - local_7c; if (iVar2 != 0 || (int)param_1 != 0) { if (iVar2 != 0) { iVar20 = 0; uVar8 = uVar21; LAB_00101306: iVar24 = iVar2 + -1; iVar2 = (int)param_1 - iVar2; if (iVar24 == 0 && (int)param_1 == 0) { iVar20 = iVar20 + 1; goto LAB_00101572; } if (iVar24 != 0) { iVar4 = 0; uVar7 = uVar8; LAB_00101334: uVar9 = (ulong)uVar7; iVar13 = iVar24 + -1; iVar24 = (int)param_1 - iVar24; if (iVar13 != 0 || (int)param_1 != 0) { if (iVar13 != 0) { iVar5 = 0; uVar1 = uVar9; do { uVar10 = uVar1; iVar14 = iVar13 + -1; iVar13 = (int)param_1 - iVar13; if (iVar14 == 0 && (int)param_1 == 0) { iVar5 = iVar5 + 1; } else { if (iVar14 != 0) { iVar23 = 0; uVar1 = uVar10; while( true ) { uVar11 = uVar1; iVar16 = iVar14 + -1; iVar6 = (int)uVar11; iVar14 = (int)param_1 - iVar14; if (iVar16 != 0 || (int)param_1 != 0) break; iVar23 = iVar23 + 1; LAB_0010141c: uVar1 = (ulong)(iVar6 - 1); param_1 = uVar11; } if (iVar16 == 0) { LAB_0010143b: if (iVar6 != 0 || iVar14 != 0) { LAB_0010155a: if (iVar14 != 0) goto LAB_0010141c; iVar5 = iVar5 + iVar23; goto LAB_00101450; } } else { iVar15 = 0; uVar1 = uVar11; while( true ) { uVar12 = uVar1; iVar3 = func0(param_1,iVar16 + -1); iVar15 = iVar15 + iVar3; iVar16 = (int)param_1 - iVar16; iVar3 = (int)uVar12; if (iVar16 == 0 && iVar3 == 0) break; if (iVar16 == 0) { iVar23 = iVar23 + iVar15; goto LAB_0010143b; } uVar1 = (ulong)(iVar3 - 1); param_1 = uVar12; } iVar23 = iVar23 + 1 + iVar15; if (iVar6 != 0 || iVar14 != 0) goto LAB_0010155a; } iVar5 = iVar23 + 1 + iVar5; } LAB_00101450: if (iVar13 == 0 && (int)uVar10 == 0) { iVar4 = iVar4 + 1 + iVar5; break; } if (iVar13 == 0) goto code_r0x00101521; } uVar1 = (ulong)((int)uVar10 - 1); param_1 = uVar10; } while( true ); } goto LAB_00101460; } iVar4 = iVar4 + 1; goto LAB_00101510; } LAB_00101472: if (uVar8 != 0 || iVar2 != 0) goto LAB_001014be; goto LAB_0010147b; } LAB_00101485: if (local_7c == 0 && uVar21 == 0) goto LAB_001014d9; goto LAB_0010148f; } iVar17 = iVar17 + 1; goto LAB_0010149b; } goto LAB_001014e6; } local_8c = local_8c + 1; goto LAB_00101500; } LAB_00101599: if (local_84 != 0 || uVar22 != 0) goto LAB_001015a3; goto LAB_001015e0; } goto LAB_0010161d; } local_88 = local_88 + 1; goto LAB_0010162f; code_r0x00101521: iVar4 = iVar4 + iVar5; LAB_00101460: if (iVar24 == 0 && uVar7 == 0) { iVar20 = iVar4 + 1 + iVar20; goto LAB_00101472; } if (iVar24 == 0) goto code_r0x001014ad; LAB_00101510: uVar7 = uVar7 - 1; param_1 = uVar9; goto LAB_00101334; code_r0x001014ad: iVar20 = iVar20 + iVar4; if (uVar8 == 0 && iVar2 == 0) { LAB_0010147b: iVar17 = iVar17 + 1 + iVar20; goto LAB_00101485; } LAB_001014be: if (iVar2 == 0) goto code_r0x001014c7; LAB_00101572: param_1 = (ulong)uVar8; uVar8 = uVar8 - 1; goto LAB_00101306; code_r0x001014c7: iVar17 = iVar17 + iVar20; if (local_7c == 0 && uVar21 == 0) { LAB_001014d9: local_8c = local_8c + 1 + iVar17; goto LAB_001014e6; } LAB_0010148f: if (local_7c == 0) goto LAB_001015b8; LAB_0010149b: param_1 = (ulong)uVar21; uVar21 = uVar21 - 1; goto LAB_001012cc; LAB_001015b8: local_8c = local_8c + iVar17; LAB_001014e6: if (local_80 == 0 && uVar18 == 0) { local_90 = local_90 + 1 + local_8c; goto LAB_00101599; } if (local_80 == 0) goto LAB_001015cc; LAB_00101500: param_1 = (ulong)uVar18; uVar18 = uVar18 - 1; goto LAB_00101295; LAB_001015cc: local_90 = local_90 + local_8c; if (local_84 == 0 && uVar22 == 0) { LAB_001015e0: local_88 = local_88 + 1 + local_90; if (param_2 == 0 && uVar19 == 0) goto LAB_001015f8; goto LAB_00101627; } LAB_001015a3: if (local_84 == 0) goto LAB_00101611; LAB_001015ab: param_1 = (ulong)uVar22; uVar22 = uVar22 - 1; goto LAB_00101260; LAB_00101611: local_88 = local_88 + local_90; LAB_0010161d: if (param_2 == 0 && uVar19 == 0) { LAB_001015f8: return local_88 + 1; } LAB_00101627: if (param_2 == 0) { return local_88; } LAB_0010162f: param_1 = (ulong)uVar19; goto LAB_0010122e; }
5,279
func0
#include <assert.h>
int func0(int n, int k) { if (n == 0 && k == 0) { return 1; } if (k == 0) { return 0; } return func0(n, k - 1) + func0(n - 1, n - k); }
int main() { assert(func0(4, 3) == 5); assert(func0(4, 2) == 4); assert(func0(3, 1) == 1); return 0; }
O3
c
func0: endbr64 mov %edi,%eax push %r12 or %esi,%eax push %rbp push %rbx je 1258 <func0+0x58> mov %esi,%ebx test %esi,%esi je 1270 <func0+0x70> mov %edi,%ebp xor %r12d,%r12d lea -0x1(%rbx),%esi mov %ebp,%edi callq 1200 <func0> mov %ebp,%edx sub $0x1,%ebp sub %ebx,%edx add %eax,%r12d mov %edx,%eax mov %edx,%ebx or %ebp,%eax je 1248 <func0+0x48> test %ebx,%ebx jne 1219 <func0+0x19> mov %r12d,%eax pop %rbx pop %rbp pop %r12 retq nopl 0x0(%rax) add $0x1,%r12d pop %rbx pop %rbp mov %r12d,%eax pop %r12 retq nopl 0x0(%rax) mov $0x1,%r12d pop %rbx pop %rbp mov %r12d,%eax pop %r12 retq nopw %cs:0x0(%rax,%rax,1) xor %r12d,%r12d jmp 1239 <func0+0x39> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r15 mov eax, edi push r14 push r13 push r12 push rbp push rbx sub rsp, 68h or eax, esi jz loc_1741 mov ebp, esi test esi, esi jz loc_1537 xor r14d, r14d mov ebx, edi loc_122B: lea r15d, [rbp-1] mov eax, r15d or eax, ebx jz loc_1728 test r15d, r15d jz loc_151B loc_1243: mov [rsp+98h+var_68], ebp xor eax, eax mov esi, r14d mov r13d, eax mov eax, ebx loc_1251: lea ebp, [r15-1] mov ecx, ebp or ecx, ebx jz loc_16EA test ebp, ebp jz loc_14F1 loc_1267: mov [rsp+98h+var_64], r15d mov ecx, ebx xor edx, edx mov r9d, esi mov [rsp+98h+var_60], ebx mov r12d, ecx mov ebx, ebp mov r8d, eax mov [rsp+98h+var_5C], r13d mov r13d, edx loc_1287: lea r14d, [rbx-1] mov eax, r14d or eax, r12d jz loc_16D0 test r14d, r14d jz loc_14BB loc_12A0: mov [rsp+98h+var_58], ebx xor r15d, r15d mov ebp, r12d mov [rsp+98h+var_54], r12d loc_12AF: lea ebx, [r14-1] mov eax, ebx or eax, ebp jz loc_16B7 test ebx, ebx jz loc_1493 loc_12C5: mov [rsp+98h+var_50], r9d xor r12d, r12d mov [rsp+98h+var_48], ebp mov [rsp+98h+var_40], r15d mov [rsp+98h+var_3C], r8d mov [rsp+98h+var_4C], r13d mov r13d, ebx mov [rsp+98h+var_44], r14d mov r14d, r12d loc_12EB: lea ebx, [r13-1] mov eax, ebx or eax, ebp jz loc_1684 test ebx, ebx jz loc_1454 loc_1301: xor r15d, r15d mov edx, ebp mov ecx, r14d mov esi, r13d mov r14d, ebp mov eax, ebx mov ebp, r15d loc_1314: lea r13d, [rax-1] mov edi, r13d or edi, r14d jz loc_161C test r13d, r13d jz loc_142A loc_132D: mov edi, ebp xor r15d, r15d mov ebp, r14d loc_1335: lea r12d, [r13-1] mov ebx, r12d or ebx, ebp jz loc_169D test r12d, r12d jz loc_1409 loc_134D: mov [rsp+98h+var_8C], esi xor ebx, ebx mov [rsp+98h+var_88], edx mov [rsp+98h+var_84], ecx mov [rsp+98h+var_80], r14d mov [rsp+98h+var_78], edi mov [rsp+98h+var_70], r13d mov [rsp+98h+var_7C], eax mov eax, ebp mov [rsp+98h+var_74], ebp mov ebp, r12d mov r12d, ebx loc_1379: lea ebx, [rbp-1] mov edx, ebx or edx, eax jz loc_1550 test ebx, ebx jz short loc_13CF loc_138A: mov [rsp+98h+var_6C], r12d mov r14d, eax mov r12d, ebp xor r13d, r13d mov ebp, eax loc_139A: mov edi, r14d lea esi, [rbx-1] call func0 mov edi, r14d sub r14d, 1 sub edi, ebx add r13d, eax mov eax, edi mov ebx, edi or eax, r14d jz loc_1638 test ebx, ebx jnz short loc_139A mov eax, ebp mov ebp, r12d mov r12d, [rsp+98h+var_6C] add r12d, r13d loc_13CF: mov ecx, eax sub eax, 1 sub ecx, ebp mov ebp, ecx or ecx, eax jz loc_1658 loc_13E0: test ebp, ebp jnz short loc_1379 mov esi, [rsp+98h+var_8C] mov edx, [rsp+98h+var_88] add r15d, r12d mov ecx, [rsp+98h+var_84] mov r14d, [rsp+98h+var_80] mov eax, [rsp+98h+var_7C] mov edi, [rsp+98h+var_78] mov ebp, [rsp+98h+var_74] mov r13d, [rsp+98h+var_70] loc_1409: mov ebx, ebp sub ebp, 1 sub ebx, r13d mov r13d, ebx or ebx, ebp jz loc_1568 test r13d, r13d jnz loc_1335 mov ebp, edi add ebp, r15d loc_142A: mov edi, r14d sub r14d, 1 sub edi, eax mov eax, edi or edi, r14d jz loc_1581 loc_143E: test eax, eax jnz loc_1314 mov r15d, ebp mov r14d, ecx mov r13d, esi mov ebp, edx add r14d, r15d loc_1454: mov eax, ebp sub ebp, 1 sub eax, r13d mov r13d, eax or eax, ebp jz loc_15A1 loc_1467: test r13d, r13d jnz loc_12EB mov r15d, [rsp+98h+var_40] mov r12d, r14d mov r9d, [rsp+98h+var_50] mov r13d, [rsp+98h+var_4C] mov ebp, [rsp+98h+var_48] mov r14d, [rsp+98h+var_44] mov r8d, [rsp+98h+var_3C] add r15d, r12d loc_1493: mov eax, ebp sub ebp, 1 sub eax, r14d mov r14d, eax or eax, ebp jz loc_15D9 loc_14A6: test r14d, r14d jnz loc_12AF mov ebx, [rsp+98h+var_58] mov r12d, [rsp+98h+var_54] add r13d, r15d loc_14BB: mov eax, r12d sub r12d, 1 sub eax, ebx mov ebx, eax or eax, r12d jz loc_15FB loc_14CF: test ebx, ebx jnz loc_1287 mov edx, r13d mov r13d, [rsp+98h+var_5C] mov r15d, [rsp+98h+var_64] mov esi, r9d mov ebx, [rsp+98h+var_60] mov eax, r8d add r13d, edx loc_14F1: mov ecx, ebx sub ebx, 1 sub ecx, r15d mov edx, ecx mov r15d, ecx or edx, ebx jz loc_1703 test r15d, r15d jnz loc_1251 mov r14d, esi mov ebp, [rsp+98h+var_68] mov ebx, eax add r14d, r13d loc_151B: mov eax, ebx sub ebx, 1 sub eax, ebp mov ebp, eax or eax, ebx jz loc_171F loc_152C: test ebp, ebp jnz loc_122B mov ebp, r14d loc_1537: add rsp, 68h mov eax, ebp pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1550: add r12d, 1 mov ebp, 0FFFFFFFFh mov eax, 0FFFFFFFFh mov ebx, 0FFFFFFFEh jmp loc_138A loc_1568: lea ebp, [rdi+r15+1] mov edi, r14d sub r14d, 1 sub edi, eax mov eax, edi or edi, r14d jnz loc_143E loc_1581: mov r15d, ebp mov ebp, edx mov r13d, esi mov eax, ebp sub ebp, 1 lea r14d, [rcx+r15+1] sub eax, r13d mov r13d, eax or eax, ebp jnz loc_1467 loc_15A1: mov ebp, [rsp+98h+var_48] mov r12d, r14d mov r14d, [rsp+98h+var_44] mov r15d, [rsp+98h+var_40] mov r9d, [rsp+98h+var_50] mov eax, ebp sub ebp, 1 mov r13d, [rsp+98h+var_4C] mov r8d, [rsp+98h+var_3C] sub eax, r14d lea r15d, [r15+r12+1] mov r14d, eax or eax, ebp jnz loc_14A6 loc_15D9: mov r12d, [rsp+98h+var_54] mov ebx, [rsp+98h+var_58] lea r13d, [r13+r15+1] mov eax, r12d sub r12d, 1 sub eax, ebx mov ebx, eax or eax, r12d jnz loc_14CF loc_15FB: mov edx, r13d mov r13d, [rsp+98h+var_5C] mov r15d, [rsp+98h+var_64] mov esi, r9d mov ebx, [rsp+98h+var_60] mov eax, r8d lea r13d, [r13+rdx+1] jmp loc_14F1 loc_161C: add ebp, 1 mov eax, 0FFFFFFFFh mov r14d, 0FFFFFFFFh mov r13d, 0FFFFFFFEh jmp loc_132D loc_1638: mov eax, ebp mov ebp, r12d mov r12d, [rsp+98h+var_6C] mov ecx, eax sub eax, 1 sub ecx, ebp lea r12d, [r13+r12+1] mov ebp, ecx or ecx, eax jnz loc_13E0 loc_1658: mov esi, [rsp+98h+var_8C] mov edx, [rsp+98h+var_88] lea r15d, [r15+r12+1] mov ecx, [rsp+98h+var_84] mov r14d, [rsp+98h+var_80] mov eax, [rsp+98h+var_7C] mov edi, [rsp+98h+var_78] mov ebp, [rsp+98h+var_74] mov r13d, [rsp+98h+var_70] jmp loc_1409 loc_1684: add r14d, 1 mov r13d, 0FFFFFFFFh mov ebp, 0FFFFFFFFh mov ebx, 0FFFFFFFEh jmp loc_1301 loc_169D: add r15d, 1 mov r13d, 0FFFFFFFFh mov ebp, 0FFFFFFFFh mov r12d, 0FFFFFFFEh jmp loc_134D loc_16B7: add r15d, 1 mov r14d, 0FFFFFFFFh mov ebp, 0FFFFFFFFh mov ebx, 0FFFFFFFEh jmp loc_12C5 loc_16D0: add r13d, 1 mov ebx, 0FFFFFFFFh mov r12d, 0FFFFFFFFh mov r14d, 0FFFFFFFEh jmp loc_12A0 loc_16EA: add r13d, 1 mov r15d, 0FFFFFFFFh mov ebx, 0FFFFFFFFh mov ebp, 0FFFFFFFEh jmp loc_1267 loc_1703: mov ebp, [rsp+98h+var_68] mov ebx, eax lea r14d, [rsi+r13+1] mov eax, ebx sub ebx, 1 sub eax, ebp mov ebp, eax or eax, ebx jnz loc_152C loc_171F: lea ebp, [r14+1] jmp loc_1537 loc_1728: add r14d, 1 mov ebp, 0FFFFFFFFh mov ebx, 0FFFFFFFFh mov r15d, 0FFFFFFFEh jmp loc_1243 loc_1741: mov ebp, 1 jmp loc_1537
long long func0(int a1, unsigned int a2) { unsigned int v2; // ebp unsigned int v3; // r14d int v4; // ebx int v5; // r15d unsigned int v6; // esi int v7; // r13d int v8; // eax int v9; // ebp unsigned int v10; // r9d int v11; // r12d int v12; // ebx int v13; // r8d int v14; // r13d int v15; // r14d int v16; // r15d int v17; // ebp int v18; // ebx int v19; // r13d int v20; // r14d int v21; // ebx int v22; // edx int v23; // ecx int v24; // esi int v25; // r14d int v26; // eax int v27; // ebp int v28; // r13d int v29; // edi int v30; // r15d int v31; // ebp int v32; // r12d int v33; // eax int v34; // ebp int v35; // r12d int v36; // ebx unsigned int v37; // r14d int v38; // r12d int v39; // r13d int v40; // ebp int v41; // eax unsigned int v42; // edi int v43; // ecx int v44; // ebx int v45; // edi int v46; // r15d int v47; // eax int v48; // r12d int v49; // eax int v50; // eax int v51; // ecx int v52; // eax int v54; // edi int v55; // r15d int v56; // eax int v57; // ebp int v58; // ecx int v59; // [rsp+10h] [rbp-88h] int v60; // [rsp+14h] [rbp-84h] int v61; // [rsp+18h] [rbp-80h] int v62; // [rsp+1Ch] [rbp-7Ch] int v63; // [rsp+20h] [rbp-78h] int v64; // [rsp+24h] [rbp-74h] int v65; // [rsp+28h] [rbp-70h] int v66; // [rsp+2Ch] [rbp-6Ch] unsigned int v67; // [rsp+30h] [rbp-68h] int v68; // [rsp+34h] [rbp-64h] int v69; // [rsp+38h] [rbp-60h] int v70; // [rsp+3Ch] [rbp-5Ch] int v71; // [rsp+40h] [rbp-58h] int v72; // [rsp+44h] [rbp-54h] unsigned int v73; // [rsp+48h] [rbp-50h] int v74; // [rsp+4Ch] [rbp-4Ch] int v75; // [rsp+50h] [rbp-48h] int v76; // [rsp+54h] [rbp-44h] int v77; // [rsp+58h] [rbp-40h] int v78; // [rsp+5Ch] [rbp-3Ch] if ( !(a2 | a1) ) return 1; v2 = a2; if ( a2 ) { v3 = 0; v4 = a1; while ( 1 ) { v5 = v2 - 1; if ( v4 | (v2 - 1) ) { if ( v2 == 1 ) goto LABEL_52; } else { ++v3; v2 = -1; v4 = -1; v5 = -2; } v67 = v2; v6 = v3; v7 = 0; v8 = v4; do { v9 = v5 - 1; if ( v4 | (v5 - 1) ) { if ( v5 == 1 ) goto LABEL_49; } else { ++v7; v5 = -1; v4 = -1; v9 = -2; } v68 = v5; v10 = v6; v69 = v4; v11 = v4; v12 = v9; v13 = v8; v70 = v7; v14 = 0; while ( 2 ) { v15 = v12 - 1; if ( v11 | (v12 - 1) ) { if ( v12 == 1 ) goto LABEL_46; } else { ++v14; v12 = -1; v11 = -1; v15 = -2; } v71 = v12; v16 = 0; v17 = v11; v72 = v11; do { v18 = v15 - 1; if ( v17 | (v15 - 1) ) { if ( v15 == 1 ) goto LABEL_43; } else { ++v16; v15 = -1; v17 = -1; v18 = -2; } v73 = v10; v75 = v17; v77 = v16; v78 = v13; v74 = v14; v19 = v18; v76 = v15; v20 = 0; do { v21 = v19 - 1; if ( v17 | (v19 - 1) ) { if ( v19 == 1 ) goto LABEL_40; } else { ++v20; v19 = -1; v17 = -1; v21 = -2; } v22 = v17; v23 = v20; v24 = v19; v25 = v17; v26 = v21; v27 = 0; do { v28 = v26 - 1; if ( v25 | (v26 - 1) ) { if ( v26 == 1 ) goto LABEL_37; } else { ++v27; v26 = -1; v25 = -1; v28 = -2; } v29 = v27; v30 = 0; v31 = v25; do { v32 = v28 - 1; if ( v31 | (v28 - 1) ) { if ( v28 == 1 ) goto LABEL_34; } else { ++v30; v28 = -1; v31 = -1; v32 = -2; } v59 = v22; v60 = v23; v61 = v25; v63 = v29; v65 = v28; v62 = v26; v33 = v31; v64 = v31; v34 = v32; v35 = 0; while ( 1 ) { v36 = v34 - 1; if ( !(v33 | (v34 - 1)) ) break; if ( v34 != 1 ) goto LABEL_27; LABEL_31: v43 = v33--; v34 = v43 - v34; if ( !(v33 | v34) ) goto LABEL_64; LABEL_32: if ( !v34 ) { v22 = v59; v30 += v35; v23 = v60; v25 = v61; v26 = v62; v29 = v63; v31 = v64; v28 = v65; goto LABEL_34; } } ++v35; v34 = -1; v33 = -1; v36 = -2; LABEL_27: v66 = v35; v37 = v33; v38 = v34; v39 = 0; v40 = v33; while ( 1 ) { v41 = func0(v37, (unsigned int)(v36 - 1)); v42 = v37--; v39 += v41; v36 = v42 - v36; if ( !(v37 | v36) ) break; if ( !v36 ) { v33 = v40; v34 = v38; v35 = v39 + v66; goto LABEL_31; } } v56 = v40; v57 = v38; v58 = v56; v33 = v56 - 1; v35 = v39 + v66 + 1; v34 = v58 - v57; if ( v33 | v34 ) goto LABEL_32; LABEL_64: v22 = v59; v30 += v35 + 1; v23 = v60; v25 = v61; v26 = v62; v29 = v63; v31 = v64; v28 = v65; LABEL_34: v44 = v31--; v28 = v44 - v28; if ( !(v31 | v28) ) { v27 = v29 + v30 + 1; v54 = v25--; v26 = v54 - v26; if ( v25 | v26 ) goto LABEL_38; goto LABEL_58; } } while ( v28 ); v27 = v30 + v29; LABEL_37: v45 = v25--; v26 = v45 - v26; if ( !(v25 | v26) ) { LABEL_58: v55 = v27; v17 = v22 - 1; v20 = v23 + v55 + 1; v19 = v22 - v24; if ( (v22 - 1) | (v22 - v24) ) goto LABEL_41; goto LABEL_59; } LABEL_38: ; } while ( v26 ); v46 = v27; v19 = v24; v17 = v22; v20 = v46 + v23; LABEL_40: v47 = v17--; v19 = v47 - v19; if ( !(v17 | v19) ) { LABEL_59: v10 = v73; v17 = v75 - 1; v14 = v74; v13 = v78; v16 = v77 + v20 + 1; v15 = v75 - v76; if ( (v75 - 1) | (v75 - v76) ) goto LABEL_44; LABEL_60: v14 += v16 + 1; v11 = v72 - 1; v12 = v72 - v71; if ( (v72 - 1) | (v72 - v71) ) goto LABEL_47; goto LABEL_61; } LABEL_41: ; } while ( v19 ); v48 = v20; v10 = v73; v14 = v74; v17 = v75; v15 = v76; v13 = v78; v16 = v48 + v77; LABEL_43: v49 = v17--; v15 = v49 - v15; if ( !(v17 | v15) ) goto LABEL_60; LABEL_44: ; } while ( v15 ); v12 = v71; v11 = v72; v14 += v16; LABEL_46: v50 = v11--; v12 = v50 - v12; if ( v11 | v12 ) { LABEL_47: if ( !v12 ) { v5 = v68; v6 = v10; v4 = v69; v8 = v13; v7 = v14 + v70; goto LABEL_49; } continue; } break; } LABEL_61: v5 = v68; v6 = v10; v4 = v69; v8 = v13; v7 = v70 + v14 + 1; LABEL_49: v51 = v4--; v5 = v51 - v5; if ( !(v4 | v5) ) { v3 = v6 + v7 + 1; v4 = v8 - 1; v2 = v8 - v67; if ( (v8 - 1) | (v8 - v67) ) goto LABEL_53; return v3 + 1; } } while ( v5 ); v2 = v67; v4 = v8; v3 = v7 + v6; LABEL_52: v52 = v4--; v2 = v52 - v2; if ( !(v4 | v2) ) return v3 + 1; LABEL_53: if ( !v2 ) return v3; } } return v2; }
func0: ENDBR64 PUSH R15 MOV EAX,EDI PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x68 OR EAX,ESI JZ 0x00101741 MOV EBP,ESI TEST ESI,ESI JZ 0x00101537 XOR R14D,R14D MOV EBX,EDI LAB_0010122b: LEA R15D,[RBP + -0x1] MOV EAX,R15D OR EAX,EBX JZ 0x00101728 TEST R15D,R15D JZ 0x0010151b LAB_00101243: MOV dword ptr [RSP + 0x30],EBP XOR EAX,EAX MOV ESI,R14D MOV R13D,EAX MOV EAX,EBX LAB_00101251: LEA EBP,[R15 + -0x1] MOV ECX,EBP OR ECX,EBX JZ 0x001016ea TEST EBP,EBP JZ 0x001014f1 LAB_00101267: MOV dword ptr [RSP + 0x34],R15D MOV ECX,EBX XOR EDX,EDX MOV R9D,ESI MOV dword ptr [RSP + 0x38],EBX MOV R12D,ECX MOV EBX,EBP MOV R8D,EAX MOV dword ptr [RSP + 0x3c],R13D MOV R13D,EDX LAB_00101287: LEA R14D,[RBX + -0x1] MOV EAX,R14D OR EAX,R12D JZ 0x001016d0 TEST R14D,R14D JZ 0x001014bb LAB_001012a0: MOV dword ptr [RSP + 0x40],EBX XOR R15D,R15D MOV EBP,R12D MOV dword ptr [RSP + 0x44],R12D LAB_001012af: LEA EBX,[R14 + -0x1] MOV EAX,EBX OR EAX,EBP JZ 0x001016b7 TEST EBX,EBX JZ 0x00101493 LAB_001012c5: MOV dword ptr [RSP + 0x48],R9D XOR R12D,R12D MOV dword ptr [RSP + 0x50],EBP MOV dword ptr [RSP + 0x58],R15D MOV dword ptr [RSP + 0x5c],R8D MOV dword ptr [RSP + 0x4c],R13D MOV R13D,EBX MOV dword ptr [RSP + 0x54],R14D MOV R14D,R12D LAB_001012eb: LEA EBX,[R13 + -0x1] MOV EAX,EBX OR EAX,EBP JZ 0x00101684 TEST EBX,EBX JZ 0x00101454 LAB_00101301: XOR R15D,R15D MOV EDX,EBP MOV ECX,R14D MOV ESI,R13D MOV R14D,EBP MOV EAX,EBX MOV EBP,R15D LAB_00101314: LEA R13D,[RAX + -0x1] MOV EDI,R13D OR EDI,R14D JZ 0x0010161c TEST R13D,R13D JZ 0x0010142a LAB_0010132d: MOV EDI,EBP XOR R15D,R15D MOV EBP,R14D LAB_00101335: LEA R12D,[R13 + -0x1] MOV EBX,R12D OR EBX,EBP JZ 0x0010169d TEST R12D,R12D JZ 0x00101409 LAB_0010134d: MOV dword ptr [RSP + 0xc],ESI XOR EBX,EBX MOV dword ptr [RSP + 0x10],EDX MOV dword ptr [RSP + 0x14],ECX MOV dword ptr [RSP + 0x18],R14D MOV dword ptr [RSP + 0x20],EDI MOV dword ptr [RSP + 0x28],R13D MOV dword ptr [RSP + 0x1c],EAX MOV EAX,EBP MOV dword ptr [RSP + 0x24],EBP MOV EBP,R12D MOV R12D,EBX LAB_00101379: LEA EBX,[RBP + -0x1] MOV EDX,EBX OR EDX,EAX JZ 0x00101550 TEST EBX,EBX JZ 0x001013cf LAB_0010138a: MOV dword ptr [RSP + 0x2c],R12D MOV R14D,EAX MOV R12D,EBP XOR R13D,R13D MOV EBP,EAX LAB_0010139a: MOV EDI,R14D LEA ESI,[RBX + -0x1] CALL 0x00101200 MOV EDI,R14D SUB R14D,0x1 SUB EDI,EBX ADD R13D,EAX MOV EAX,EDI MOV EBX,EDI OR EAX,R14D JZ 0x00101638 TEST EBX,EBX JNZ 0x0010139a MOV EAX,EBP MOV EBP,R12D MOV R12D,dword ptr [RSP + 0x2c] ADD R12D,R13D LAB_001013cf: MOV ECX,EAX SUB EAX,0x1 SUB ECX,EBP MOV EBP,ECX OR ECX,EAX JZ 0x00101658 LAB_001013e0: TEST EBP,EBP JNZ 0x00101379 MOV ESI,dword ptr [RSP + 0xc] MOV EDX,dword ptr [RSP + 0x10] ADD R15D,R12D MOV ECX,dword ptr [RSP + 0x14] MOV R14D,dword ptr [RSP + 0x18] MOV EAX,dword ptr [RSP + 0x1c] MOV EDI,dword ptr [RSP + 0x20] MOV EBP,dword ptr [RSP + 0x24] MOV R13D,dword ptr [RSP + 0x28] LAB_00101409: MOV EBX,EBP SUB EBP,0x1 SUB EBX,R13D MOV R13D,EBX OR EBX,EBP JZ 0x00101568 TEST R13D,R13D JNZ 0x00101335 MOV EBP,EDI ADD EBP,R15D LAB_0010142a: MOV EDI,R14D SUB R14D,0x1 SUB EDI,EAX MOV EAX,EDI OR EDI,R14D JZ 0x00101581 LAB_0010143e: TEST EAX,EAX JNZ 0x00101314 MOV R15D,EBP MOV R14D,ECX MOV R13D,ESI MOV EBP,EDX ADD R14D,R15D LAB_00101454: MOV EAX,EBP SUB EBP,0x1 SUB EAX,R13D MOV R13D,EAX OR EAX,EBP JZ 0x001015a1 LAB_00101467: TEST R13D,R13D JNZ 0x001012eb MOV R15D,dword ptr [RSP + 0x58] MOV R12D,R14D MOV R9D,dword ptr [RSP + 0x48] MOV R13D,dword ptr [RSP + 0x4c] MOV EBP,dword ptr [RSP + 0x50] MOV R14D,dword ptr [RSP + 0x54] MOV R8D,dword ptr [RSP + 0x5c] ADD R15D,R12D LAB_00101493: MOV EAX,EBP SUB EBP,0x1 SUB EAX,R14D MOV R14D,EAX OR EAX,EBP JZ 0x001015d9 LAB_001014a6: TEST R14D,R14D JNZ 0x001012af MOV EBX,dword ptr [RSP + 0x40] MOV R12D,dword ptr [RSP + 0x44] ADD R13D,R15D LAB_001014bb: MOV EAX,R12D SUB R12D,0x1 SUB EAX,EBX MOV EBX,EAX OR EAX,R12D JZ 0x001015fb LAB_001014cf: TEST EBX,EBX JNZ 0x00101287 MOV EDX,R13D MOV R13D,dword ptr [RSP + 0x3c] MOV R15D,dword ptr [RSP + 0x34] MOV ESI,R9D MOV EBX,dword ptr [RSP + 0x38] MOV EAX,R8D ADD R13D,EDX LAB_001014f1: MOV ECX,EBX SUB EBX,0x1 SUB ECX,R15D MOV EDX,ECX MOV R15D,ECX OR EDX,EBX JZ 0x00101703 TEST R15D,R15D JNZ 0x00101251 MOV R14D,ESI MOV EBP,dword ptr [RSP + 0x30] MOV EBX,EAX ADD R14D,R13D LAB_0010151b: MOV EAX,EBX SUB EBX,0x1 SUB EAX,EBP MOV EBP,EAX OR EAX,EBX JZ 0x0010171f LAB_0010152c: TEST EBP,EBP JNZ 0x0010122b MOV EBP,R14D LAB_00101537: ADD RSP,0x68 MOV EAX,EBP POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101550: ADD R12D,0x1 MOV EBP,0xffffffff MOV EAX,0xffffffff MOV EBX,0xfffffffe JMP 0x0010138a LAB_00101568: LEA EBP,[RDI + R15*0x1 + 0x1] MOV EDI,R14D SUB R14D,0x1 SUB EDI,EAX MOV EAX,EDI OR EDI,R14D JNZ 0x0010143e LAB_00101581: MOV R15D,EBP MOV EBP,EDX MOV R13D,ESI MOV EAX,EBP SUB EBP,0x1 LEA R14D,[RCX + R15*0x1 + 0x1] SUB EAX,R13D MOV R13D,EAX OR EAX,EBP JNZ 0x00101467 LAB_001015a1: MOV EBP,dword ptr [RSP + 0x50] MOV R12D,R14D MOV R14D,dword ptr [RSP + 0x54] MOV R15D,dword ptr [RSP + 0x58] MOV R9D,dword ptr [RSP + 0x48] MOV EAX,EBP SUB EBP,0x1 MOV R13D,dword ptr [RSP + 0x4c] MOV R8D,dword ptr [RSP + 0x5c] SUB EAX,R14D LEA R15D,[R15 + R12*0x1 + 0x1] MOV R14D,EAX OR EAX,EBP JNZ 0x001014a6 LAB_001015d9: MOV R12D,dword ptr [RSP + 0x44] MOV EBX,dword ptr [RSP + 0x40] LEA R13D,[R13 + R15*0x1 + 0x1] MOV EAX,R12D SUB R12D,0x1 SUB EAX,EBX MOV EBX,EAX OR EAX,R12D JNZ 0x001014cf LAB_001015fb: MOV EDX,R13D MOV R13D,dword ptr [RSP + 0x3c] MOV R15D,dword ptr [RSP + 0x34] MOV ESI,R9D MOV EBX,dword ptr [RSP + 0x38] MOV EAX,R8D LEA R13D,[R13 + RDX*0x1 + 0x1] JMP 0x001014f1 LAB_0010161c: ADD EBP,0x1 MOV EAX,0xffffffff MOV R14D,0xffffffff MOV R13D,0xfffffffe JMP 0x0010132d LAB_00101638: MOV EAX,EBP MOV EBP,R12D MOV R12D,dword ptr [RSP + 0x2c] MOV ECX,EAX SUB EAX,0x1 SUB ECX,EBP LEA R12D,[R13 + R12*0x1 + 0x1] MOV EBP,ECX OR ECX,EAX JNZ 0x001013e0 LAB_00101658: MOV ESI,dword ptr [RSP + 0xc] MOV EDX,dword ptr [RSP + 0x10] LEA R15D,[R15 + R12*0x1 + 0x1] MOV ECX,dword ptr [RSP + 0x14] MOV R14D,dword ptr [RSP + 0x18] MOV EAX,dword ptr [RSP + 0x1c] MOV EDI,dword ptr [RSP + 0x20] MOV EBP,dword ptr [RSP + 0x24] MOV R13D,dword ptr [RSP + 0x28] JMP 0x00101409 LAB_00101684: ADD R14D,0x1 MOV R13D,0xffffffff MOV EBP,0xffffffff MOV EBX,0xfffffffe JMP 0x00101301 LAB_0010169d: ADD R15D,0x1 MOV R13D,0xffffffff MOV EBP,0xffffffff MOV R12D,0xfffffffe JMP 0x0010134d LAB_001016b7: ADD R15D,0x1 MOV R14D,0xffffffff MOV EBP,0xffffffff MOV EBX,0xfffffffe JMP 0x001012c5 LAB_001016d0: ADD R13D,0x1 MOV EBX,0xffffffff MOV R12D,0xffffffff MOV R14D,0xfffffffe JMP 0x001012a0 LAB_001016ea: ADD R13D,0x1 MOV R15D,0xffffffff MOV EBX,0xffffffff MOV EBP,0xfffffffe JMP 0x00101267 LAB_00101703: MOV EBP,dword ptr [RSP + 0x30] MOV EBX,EAX LEA R14D,[RSI + R13*0x1 + 0x1] MOV EAX,EBX SUB EBX,0x1 SUB EAX,EBP MOV EBP,EAX OR EAX,EBX JNZ 0x0010152c LAB_0010171f: LEA EBP,[R14 + 0x1] JMP 0x00101537 LAB_00101728: ADD R14D,0x1 MOV EBP,0xffffffff MOV EBX,0xffffffff MOV R15D,0xfffffffe JMP 0x00101243 LAB_00101741: MOV EBP,0x1 JMP 0x00101537
int func0(int param_1,int param_2) { int iVar1; int iVar2; int iVar3; int iVar4; int iVar5; int iVar6; int iVar7; int iVar8; int iVar9; int iVar10; int iVar11; int iVar12; int iVar13; int iVar14; int iVar15; int iVar16; int iVar17; int iVar18; int iVar19; int iVar20; int iVar21; int iVar22; int iVar23; int iVar24; int iVar25; int iVar26; if (param_1 == 0 && param_2 == 0) { iVar22 = 1; } else { iVar22 = param_2; if (param_2 != 0) { iVar22 = 0; do { iVar23 = param_2 + -1; if (iVar23 == 0 && param_1 == 0) { iVar22 = iVar22 + 1; param_2 = -1; param_1 = -1; iVar23 = -2; LAB_00101243: iVar2 = 0; iVar11 = param_1; do { iVar5 = iVar23 + -1; if (iVar5 == 0 && iVar11 == 0) { iVar2 = iVar2 + 1; iVar23 = -1; iVar11 = -1; iVar5 = -2; LAB_00101267: iVar18 = 0; iVar15 = iVar11; do { iVar19 = iVar5 + -1; if (iVar19 == 0 && iVar15 == 0) { iVar18 = iVar18 + 1; iVar5 = -1; iVar15 = -1; iVar19 = -2; LAB_001012a0: iVar24 = 0; iVar14 = iVar15; do { iVar4 = iVar19 + -1; if (iVar4 == 0 && iVar14 == 0) { iVar24 = iVar24 + 1; iVar19 = -1; iVar14 = -1; iVar4 = -2; LAB_001012c5: iVar21 = 0; iVar13 = iVar14; do { iVar8 = iVar4 + -1; if (iVar8 == 0 && iVar13 == 0) { iVar21 = iVar21 + 1; iVar4 = -1; iVar13 = -1; iVar8 = -2; LAB_00101301: iVar25 = 0; iVar20 = iVar13; do { iVar16 = iVar8 + -1; if (iVar16 == 0 && iVar20 == 0) { iVar25 = iVar25 + 1; iVar8 = -1; iVar20 = -1; iVar16 = -2; LAB_0010132d: iVar26 = 0; iVar12 = iVar20; do { iVar7 = iVar16 + -1; if (iVar7 == 0 && iVar12 == 0) { iVar26 = iVar26 + 1; iVar16 = -1; iVar12 = -1; iVar7 = -2; LAB_0010134d: iVar9 = 0; iVar6 = iVar12; do { iVar10 = iVar7 + -1; if (iVar10 == 0 && iVar6 == 0) { iVar9 = iVar9 + 1; iVar7 = -1; iVar6 = -1; iVar10 = -2; LAB_0010138a: iVar17 = 0; iVar1 = iVar6; do { iVar3 = func0(iVar1,iVar10 + -1); iVar10 = iVar1 - iVar10; iVar17 = iVar17 + iVar3; if (iVar10 == 0 && iVar1 + -1 == 0) { iVar10 = iVar6 + -1; iVar7 = iVar6 - iVar7; iVar9 = iVar17 + 1 + iVar9; if (iVar7 == 0 && iVar10 == 0) goto LAB_00101658; goto LAB_001013e0; } iVar1 = iVar1 + -1; } while (iVar10 != 0); iVar9 = iVar9 + iVar17; } else if (iVar10 != 0) goto LAB_0010138a; iVar10 = iVar6 + -1; iVar7 = iVar6 - iVar7; if (iVar7 == 0 && iVar10 == 0) { LAB_00101658: iVar26 = iVar26 + 1 + iVar9; goto LAB_00101409; } LAB_001013e0: iVar6 = iVar10; } while (iVar7 != 0); iVar26 = iVar26 + iVar9; } else if (iVar7 != 0) goto LAB_0010134d; LAB_00101409: iVar16 = iVar12 - iVar16; if (iVar16 == 0 && iVar12 + -1 == 0) { iVar25 = iVar25 + 1 + iVar26; iVar16 = iVar20 + -1; iVar8 = iVar20 - iVar8; if (iVar8 == 0 && iVar16 == 0) goto LAB_00101581; goto LAB_0010143e; } iVar12 = iVar12 + -1; } while (iVar16 != 0); iVar25 = iVar25 + iVar26; } else if (iVar16 != 0) goto LAB_0010132d; iVar16 = iVar20 + -1; iVar8 = iVar20 - iVar8; if (iVar8 == 0 && iVar16 == 0) { LAB_00101581: iVar8 = iVar13 + -1; iVar21 = iVar21 + 1 + iVar25; iVar4 = iVar13 - iVar4; if (iVar4 == 0 && iVar8 == 0) goto LAB_001015a1; goto LAB_00101467; } LAB_0010143e: iVar20 = iVar16; } while (iVar8 != 0); iVar21 = iVar21 + iVar25; } else if (iVar8 != 0) goto LAB_00101301; iVar8 = iVar13 + -1; iVar4 = iVar13 - iVar4; if (iVar4 == 0 && iVar8 == 0) { LAB_001015a1: iVar4 = iVar14 + -1; iVar19 = iVar14 - iVar19; iVar24 = iVar24 + 1 + iVar21; if (iVar19 == 0 && iVar4 == 0) goto LAB_001015d9; goto LAB_001014a6; } LAB_00101467: iVar13 = iVar8; } while (iVar4 != 0); iVar24 = iVar24 + iVar21; } else if (iVar4 != 0) goto LAB_001012c5; iVar4 = iVar14 + -1; iVar19 = iVar14 - iVar19; if (iVar19 == 0 && iVar4 == 0) { LAB_001015d9: iVar18 = iVar18 + 1 + iVar24; iVar19 = iVar15 + -1; iVar5 = iVar15 - iVar5; if (iVar5 == 0 && iVar19 == 0) goto LAB_001015fb; goto LAB_001014cf; } LAB_001014a6: iVar14 = iVar4; } while (iVar19 != 0); iVar18 = iVar18 + iVar24; } else if (iVar19 != 0) goto LAB_001012a0; iVar19 = iVar15 + -1; iVar5 = iVar15 - iVar5; if (iVar5 == 0 && iVar19 == 0) { LAB_001015fb: iVar2 = iVar2 + 1 + iVar18; goto LAB_001014f1; } LAB_001014cf: iVar15 = iVar19; } while (iVar5 != 0); iVar2 = iVar2 + iVar18; } else if (iVar5 != 0) goto LAB_00101267; LAB_001014f1: iVar23 = iVar11 - iVar23; if (iVar23 == 0 && iVar11 + -1 == 0) { iVar22 = iVar22 + 1 + iVar2; iVar23 = param_1 + -1; param_2 = param_1 - param_2; if (param_2 == 0 && iVar23 == 0) goto LAB_0010171f; goto LAB_0010152c; } iVar11 = iVar11 + -1; } while (iVar23 != 0); iVar22 = iVar22 + iVar2; } else if (iVar23 != 0) goto LAB_00101243; iVar23 = param_1 + -1; param_2 = param_1 - param_2; if (param_2 == 0 && iVar23 == 0) { LAB_0010171f: return iVar22 + 1; } LAB_0010152c: param_1 = iVar23; } while (param_2 != 0); } } return iVar22; }
5,280
func0
#include <assert.h>
int func0(int m, int n) { if (n < m) { int temp = m; m = n; n = temp; } return n * (n + 1) * (3 * m - n + 1) / 6; }
int main() { assert(func0(4, 3) == 20); assert(func0(1, 2) == 2); assert(func0(2, 2) == 5); 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 jge 1171 <func0+0x28> mov -0x14(%rbp),%eax mov %eax,-0x4(%rbp) mov -0x18(%rbp),%eax mov %eax,-0x14(%rbp) mov -0x4(%rbp),%eax mov %eax,-0x18(%rbp) mov -0x18(%rbp),%eax add $0x1,%eax imul -0x18(%rbp),%eax mov %eax,%ecx mov -0x14(%rbp),%edx mov %edx,%eax add %eax,%eax add %edx,%eax sub -0x18(%rbp),%eax add $0x1,%eax imul %ecx,%eax movslq %eax,%rdx imul $0x2aaaaaab,%rdx,%rdx shr $0x20,%rdx sar $0x1f,%eax mov %edx,%esi sub %eax,%esi mov %esi,%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] jge short loc_1171 mov eax, [rbp+var_14] mov [rbp+var_4], eax mov eax, [rbp+var_18] mov [rbp+var_14], eax mov eax, [rbp+var_4] mov [rbp+var_18], eax loc_1171: mov eax, [rbp+var_18] add eax, 1 imul eax, [rbp+var_18] mov ecx, eax mov edx, [rbp+var_14] mov eax, edx add eax, eax add eax, edx sub eax, [rbp+var_18] add eax, 1 imul eax, ecx movsxd rdx, eax imul rdx, 2AAAAAABh shr rdx, 20h sar eax, 1Fh sub edx, eax mov eax, edx pop rbp retn
long long func0(int a1, int a2) { int v3; // [rsp+0h] [rbp-18h] int v4; // [rsp+4h] [rbp-14h] v4 = a1; v3 = a2; if ( a2 < a1 ) { v4 = a2; v3 = a1; } return (unsigned int)(v3 * (v3 + 1) * (3 * v4 - v3 + 1) / 6); }
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] JGE 0x00101171 MOV EAX,dword ptr [RBP + -0x14] MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x18] MOV dword ptr [RBP + -0x14],EAX MOV EAX,dword ptr [RBP + -0x4] MOV dword ptr [RBP + -0x18],EAX LAB_00101171: MOV EAX,dword ptr [RBP + -0x18] ADD EAX,0x1 IMUL EAX,dword ptr [RBP + -0x18] MOV ECX,EAX MOV EDX,dword ptr [RBP + -0x14] MOV EAX,EDX ADD EAX,EAX ADD EAX,EDX SUB EAX,dword ptr [RBP + -0x18] ADD EAX,0x1 IMUL EAX,ECX MOVSXD RDX,EAX IMUL RDX,RDX,0x2aaaaaab SHR RDX,0x20 SAR EAX,0x1f SUB EDX,EAX MOV EAX,EDX POP RBP RET
int func0(int param_1,int param_2) { int4 local_20; int4 local_1c; local_20 = param_2; local_1c = param_1; if (param_2 < param_1) { local_20 = param_1; local_1c = param_2; } return (((local_1c * 3 - local_20) + 1) * (local_20 + 1) * local_20) / 6; }
5,281
func0
#include <assert.h>
int func0(int m, int n) { if (n < m) { int temp = m; m = n; n = temp; } return n * (n + 1) * (3 * m - n + 1) / 6; }
int main() { assert(func0(4, 3) == 20); assert(func0(1, 2) == 2); assert(func0(2, 2) == 5); return 0; }
O1
c
func0: endbr64 mov %esi,%eax cmp %edi,%esi jge 1159 <func0+0x10> mov %edi,%edx mov %esi,%edi mov %edx,%eax lea (%rdi,%rdi,2),%esi sub %eax,%esi add $0x1,%esi lea 0x1(%rax),%edx imul %edx,%eax imul %eax,%esi movslq %esi,%rax imul $0x2aaaaaab,%rax,%rax shr $0x20,%rax sar $0x1f,%esi sub %esi,%eax retq
func0: endbr64 mov eax, esi cmp esi, edi jge short loc_1159 mov edx, edi mov edi, esi mov eax, edx loc_1159: lea esi, [rdi+rdi*2] sub esi, eax add esi, 1 lea edx, [rax+1] imul eax, edx imul esi, eax movsxd rax, esi imul rax, 2AAAAAABh shr rax, 20h sar esi, 1Fh sub eax, esi retn
long long func0(int a1, int a2) { int v2; // eax int v3; // edx v2 = a2; if ( a2 < a1 ) { v3 = a1; a1 = a2; v2 = v3; } return (unsigned int)((v2 + 1) * v2 * (3 * a1 - v2 + 1) / 6); }
func0: ENDBR64 MOV EAX,ESI CMP ESI,EDI JGE 0x00101159 MOV EDX,EDI MOV EDI,ESI MOV EAX,EDX LAB_00101159: LEA ESI,[RDI + RDI*0x2] SUB ESI,EAX ADD ESI,0x1 LEA EDX,[RAX + 0x1] IMUL EAX,EDX IMUL ESI,EAX MOVSXD RAX,ESI IMUL RAX,RAX,0x2aaaaaab SHR RAX,0x20 SAR ESI,0x1f SUB EAX,ESI RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = param_2; if (param_2 < param_1) { iVar1 = param_1; param_1 = param_2; } return (((param_1 * 3 - iVar1) + 1) * iVar1 * (iVar1 + 1)) / 6; }