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
7,382
func0
#include <stdio.h> #include <stdbool.h> #include <assert.h>
bool func0(int list1[][2], int size1, int list2[][2], int size2) { for (int i = 0; i < size2; i++) { bool found = false; for (int j = 0; j < size1; j++) { if (list1[j][0] == list2[i][0] && list1[j][1] == list2[i][1]) { found = true; break; } } if (!found) return false; } return true; }
int main() { int list1[][2] = {{1, 3}, {5, 7}, {9, 11}, {13, 15}}; int list2[][2] = {{1, 3}, {13, 15}}; assert(func0(list1, 4, list2, 2) == true); int list3[][2] = {{1, 2}, {2, 3}, {3, 4}, {5, 6}}; int list4[][2] = {{3, 4}, {5, 6}}; assert(func0(list3, 4, list4, 2) == true); int list5[][2] = {{1, 2}, {3, 4}, {5, 7}, {8, 9}}; int list6[][2] = {{3, 4}, {5, 6}}; assert(func0(list5, 4, list6, 2) == false); return 0; }
O2
c
func0: endbr64 test %ecx,%ecx jle 1420 <func0+0x50> lea -0x1(%rcx),%eax mov %rdx,%r8 lea 0x8(%rdx,%rax,8),%r9 lea -0x1(%rsi),%eax lea 0x8(%rdi,%rax,8),%rcx nopl 0x0(%rax,%rax,1) test %esi,%esi jle 1430 <func0+0x60> mov (%r8),%edx mov %rdi,%rax jmp 1409 <func0+0x39> nopl 0x0(%rax) add $0x8,%rax cmp %rcx,%rax je 1430 <func0+0x60> cmp %edx,(%rax) jne 1400 <func0+0x30> mov 0x4(%r8),%r10d cmp %r10d,0x4(%rax) jne 1400 <func0+0x30> add $0x8,%r8 cmp %r9,%r8 jne 13f0 <func0+0x20> mov $0x1,%eax retq nopw %cs:0x0(%rax,%rax,1) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 mov r8, rdi test ecx, ecx jle short loc_1380 lea eax, [rcx-1] mov rdi, rdx lea r9, [rdx+rax*8+8] lea eax, [rsi-1] lea rcx, [r8+rax*8+8] xchg ax, ax loc_1350: test esi, esi jle short loc_1390 mov edx, [rdi] mov rax, r8 jmp short loc_1369 loc_1360: add rax, 8 cmp rax, rcx jz short loc_1390 loc_1369: cmp [rax], edx jnz short loc_1360 mov r10d, [rdi+4] cmp [rax+4], r10d jnz short loc_1360 add rdi, 8 cmp rdi, r9 jnz short loc_1350 loc_1380: mov eax, 1 retn loc_1390: xor eax, eax retn
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4) { _DWORD *v5; // rdi _DWORD *v6; // rax if ( a4 <= 0 ) return 1LL; v5 = a3; while ( a2 > 0 ) { v6 = a1; while ( *v6 != *v5 || v6[1] != v5[1] ) { v6 += 2; if ( v6 == &a1[2 * (a2 - 1) + 2] ) return 0LL; } v5 += 2; if ( v5 == &a3[2 * (a4 - 1) + 2] ) return 1LL; } return 0LL; }
func0: ENDBR64 MOV R8,RDI TEST ECX,ECX JLE 0x00101380 LEA EAX,[RCX + -0x1] MOV RDI,RDX LEA R9,[RDX + RAX*0x8 + 0x8] LEA EAX,[RSI + -0x1] LEA RCX,[R8 + RAX*0x8 + 0x8] NOP LAB_00101350: TEST ESI,ESI JLE 0x00101390 MOV EDX,dword ptr [RDI] MOV RAX,R8 JMP 0x00101369 LAB_00101360: ADD RAX,0x8 CMP RAX,RCX JZ 0x00101390 LAB_00101369: CMP dword ptr [RAX],EDX JNZ 0x00101360 MOV R10D,dword ptr [RDI + 0x4] CMP dword ptr [RAX + 0x4],R10D JNZ 0x00101360 ADD RDI,0x8 CMP RDI,R9 JNZ 0x00101350 LAB_00101380: MOV EAX,0x1 RET LAB_00101390: XOR EAX,EAX RET
int8 func0(int *param_1,int param_2,int *param_3,int param_4) { int *piVar1; int *piVar2; if (0 < param_4) { piVar1 = param_3 + (ulong)(param_4 - 1) * 2 + 2; do { if (param_2 < 1) { return 0; } piVar2 = param_1; while ((*piVar2 != *param_3 || (piVar2[1] != param_3[1]))) { piVar2 = piVar2 + 2; if (piVar2 == param_1 + (ulong)(param_2 - 1) * 2 + 2) { return 0; } } param_3 = param_3 + 2; } while (param_3 != piVar1); } return 1; }
7,383
func0
#include <stdio.h> #include <stdbool.h> #include <assert.h>
bool func0(int list1[][2], int size1, int list2[][2], int size2) { for (int i = 0; i < size2; i++) { bool found = false; for (int j = 0; j < size1; j++) { if (list1[j][0] == list2[i][0] && list1[j][1] == list2[i][1]) { found = true; break; } } if (!found) return false; } return true; }
int main() { int list1[][2] = {{1, 3}, {5, 7}, {9, 11}, {13, 15}}; int list2[][2] = {{1, 3}, {13, 15}}; assert(func0(list1, 4, list2, 2) == true); int list3[][2] = {{1, 2}, {2, 3}, {3, 4}, {5, 6}}; int list4[][2] = {{3, 4}, {5, 6}}; assert(func0(list3, 4, list4, 2) == true); int list5[][2] = {{1, 2}, {3, 4}, {5, 7}, {8, 9}}; int list6[][2] = {{3, 4}, {5, 6}}; assert(func0(list5, 4, list6, 2) == false); return 0; }
O3
c
func0: endbr64 test %ecx,%ecx jle 13e0 <func0+0x50> lea -0x1(%rcx),%eax mov %rdx,%r8 lea 0x8(%rdx,%rax,8),%r9 lea -0x1(%rsi),%eax lea 0x8(%rdi,%rax,8),%rcx nopl 0x0(%rax,%rax,1) test %esi,%esi jle 13f0 <func0+0x60> mov (%r8),%edx mov %rdi,%rax jmp 13c9 <func0+0x39> nopl 0x0(%rax) add $0x8,%rax cmp %rcx,%rax je 13f0 <func0+0x60> cmp %edx,(%rax) jne 13c0 <func0+0x30> mov 0x4(%r8),%r10d cmp %r10d,0x4(%rax) jne 13c0 <func0+0x30> add $0x8,%r8 cmp %r9,%r8 jne 13b0 <func0+0x20> mov $0x1,%eax retq nopw %cs:0x0(%rax,%rax,1) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 mov r8, rdi test ecx, ecx jle short loc_118E movsxd rcx, ecx movsxd rax, esi mov rdi, rdx lea r9, [rdx+rcx*8] lea rcx, [r8+rax*8] test esi, esi jle short loc_1198 loc_1160: mov edx, [rdi] mov rax, r8 jmp short loc_1179 loc_1170: add rax, 8 cmp rcx, rax jz short loc_1198 loc_1179: cmp [rax], edx jnz short loc_1170 mov esi, [rdi+4] cmp [rax+4], esi jnz short loc_1170 add rdi, 8 cmp rdi, r9 jnz short loc_1160 loc_118E: mov eax, 1 retn loc_1198: xor eax, eax retn
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4) { _DWORD *v5; // rdi _DWORD *v6; // rax if ( a4 <= 0 ) return 1LL; v5 = a3; if ( a2 > 0 ) { do { v6 = a1; while ( *v6 != *v5 || v6[1] != v5[1] ) { v6 += 2; if ( &a1[2 * a2] == v6 ) return 0LL; } v5 += 2; } while ( v5 != &a3[2 * a4] ); return 1LL; } return 0LL; }
func0: ENDBR64 MOV R8,RDI TEST ECX,ECX JLE 0x0010118e MOVSXD RCX,ECX MOVSXD RAX,ESI MOV RDI,RDX LEA R9,[RDX + RCX*0x8] LEA RCX,[R8 + RAX*0x8] TEST ESI,ESI JLE 0x00101198 LAB_00101160: MOV EDX,dword ptr [RDI] MOV RAX,R8 JMP 0x00101179 LAB_00101170: ADD RAX,0x8 CMP RCX,RAX JZ 0x00101198 LAB_00101179: CMP dword ptr [RAX],EDX JNZ 0x00101170 MOV ESI,dword ptr [RDI + 0x4] CMP dword ptr [RAX + 0x4],ESI JNZ 0x00101170 ADD RDI,0x8 CMP RDI,R9 JNZ 0x00101160 LAB_0010118e: MOV EAX,0x1 RET LAB_00101198: XOR EAX,EAX RET
int8 func0(int *param_1,int param_2,int *param_3,int param_4) { int *piVar1; int *piVar2; if (0 < param_4) { piVar1 = param_3 + (long)param_4 * 2; if (param_2 < 1) { return 0; } do { piVar2 = param_1; while ((*piVar2 != *param_3 || (piVar2[1] != param_3[1]))) { piVar2 = piVar2 + 2; if (param_1 + (long)param_2 * 2 == piVar2) { return 0; } } param_3 = param_3 + 2; } while (param_3 != piVar1); } return 1; }
7,384
func0
#include <assert.h>
int func0(int n) { if (n == 1 || n == 2) { return 1; } else { return (func0(n - 1) + func0(n - 2)); } }
int main() { assert(func0(7) == 13); assert(func0(8) == 21); assert(func0(9) == 34); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x18,%rsp mov %edi,-0x14(%rbp) cmpl $0x1,-0x14(%rbp) je 1165 <func0+0x1c> cmpl $0x2,-0x14(%rbp) jne 116c <func0+0x23> mov $0x1,%eax jmp 118a <func0+0x41> mov -0x14(%rbp),%eax sub $0x1,%eax mov %eax,%edi callq 1149 <func0> mov %eax,%ebx mov -0x14(%rbp),%eax sub $0x2,%eax mov %eax,%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 cmp [rbp+var_14], 1 jz short loc_1165 cmp [rbp+var_14], 2 jnz short loc_116C loc_1165: mov eax, 1 jmp short loc_118A loc_116C: mov eax, [rbp+var_14] sub eax, 1 mov edi, eax call func0 mov ebx, eax mov eax, [rbp+var_14] sub eax, 2 mov edi, eax call func0 add eax, ebx loc_118A: mov rbx, [rbp+var_8] leave retn
long long func0(int a1) { int v2; // ebx if ( a1 == 1 || a1 == 2 ) return 1LL; v2 = func0((unsigned int)(a1 - 1)); return v2 + (unsigned int)func0((unsigned int)(a1 - 2)); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x18 MOV dword ptr [RBP + -0x14],EDI CMP dword ptr [RBP + -0x14],0x1 JZ 0x00101165 CMP dword ptr [RBP + -0x14],0x2 JNZ 0x0010116c LAB_00101165: MOV EAX,0x1 JMP 0x0010118a LAB_0010116c: MOV EAX,dword ptr [RBP + -0x14] SUB EAX,0x1 MOV EDI,EAX CALL 0x00101149 MOV EBX,EAX MOV EAX,dword ptr [RBP + -0x14] SUB EAX,0x2 MOV EDI,EAX CALL 0x00101149 ADD EAX,EBX LAB_0010118a: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int func0(int param_1) { int iVar1; int iVar2; if ((param_1 == 1) || (param_1 == 2)) { iVar2 = 1; } else { iVar1 = func0(param_1 + -1); iVar2 = func0(param_1 + -2); iVar2 = iVar2 + iVar1; } return iVar2; }
7,385
func0
#include <assert.h>
int func0(int n) { if (n == 1 || n == 2) { return 1; } else { return (func0(n - 1) + func0(n - 2)); } }
int main() { assert(func0(7) == 13); assert(func0(8) == 21); assert(func0(9) == 34); return 0; }
O1
c
func0: endbr64 lea -0x1(%rdi),%edx mov $0x1,%eax cmp $0x1,%edx ja 115b <func0+0x12> retq push %rbp push %rbx sub $0x8,%rsp mov %edi,%ebx mov %edx,%edi callq 1149 <func0> mov %eax,%ebp lea -0x2(%rbx),%edi callq 1149 <func0> add %ebp,%eax add $0x8,%rsp pop %rbx pop %rbp retq
func0: endbr64 lea edx, [rdi-1] mov eax, 1 cmp edx, 1 ja short loc_115B retn loc_115B: push rbp push rbx sub rsp, 8 mov ebx, edi mov edi, edx call func0 mov ebp, eax lea edi, [rbx-2] call func0 add eax, ebp add rsp, 8 pop rbx pop rbp retn
long long func0(int a1) { long long result; // rax int v2; // ebp result = 1LL; if ( (unsigned int)(a1 - 1) > 1 ) { v2 = func0((unsigned int)(a1 - 1)); return v2 + (unsigned int)func0((unsigned int)(a1 - 2)); } return result; }
func0: ENDBR64 LEA EDX,[RDI + -0x1] MOV EAX,0x1 CMP EDX,0x1 JA 0x0010115b RET LAB_0010115b: PUSH RBP PUSH RBX SUB RSP,0x8 MOV EBX,EDI MOV EDI,EDX CALL 0x00101149 MOV EBP,EAX LEA EDI,[RBX + -0x2] CALL 0x00101149 ADD EAX,EBP ADD RSP,0x8 POP RBX POP RBP RET
int func0(int param_1) { int iVar1; int iVar2; if (param_1 - 1U < 2) { return 1; } iVar1 = func0(param_1 - 1U); iVar2 = func0(param_1 + -2); return iVar2 + iVar1; }
7,386
func0
#include <assert.h>
int func0(int n) { if (n == 1 || n == 2) { return 1; } else { return (func0(n - 1) + func0(n - 2)); } }
int main() { assert(func0(7) == 13); assert(func0(8) == 21); assert(func0(9) == 34); return 0; }
O2
c
func0: endbr64 push %rbp mov $0x1,%eax push %rbx lea -0x1(%rdi),%ebx sub $0x8,%rsp cmp $0x1,%ebx jbe 127d <func0+0x2d> xor %ebp,%ebp mov %ebx,%edi sub $0x2,%ebx callq 1250 <func0> add %eax,%ebp cmp $0x1,%ebx ja 1269 <func0+0x19> lea 0x1(%rbp),%eax add $0x8,%rsp pop %rbx pop %rbp retq nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 push r15 mov eax, edi lea edx, [rdi-1] push r14 sub eax, 2 push r13 push r12 push rbp push rbx sub rsp, 38h mov [rsp+68h+var_68], eax mov eax, 1 mov [rsp+68h+var_64], 0 cmp edx, 1 jbe loc_146F loc_1223: mov eax, [rsp+68h+var_68] mov [rsp+68h+var_60], 0 mov esi, eax cmp eax, 1 jbe loc_1449 loc_1239: cmp esi, 2 jz loc_147E lea r8d, [rsi-2] mov [rsp+68h+var_5C], 0 xor esi, esi mov r9d, r8d mov ecx, r9d cmp r9d, 1 jz loc_13DA loc_1260: cmp ecx, 2 jz loc_141F sub ecx, 2 xor edx, edx xor r12d, r12d mov ebx, ecx mov r15d, ebx cmp ebx, 1 jz loc_1391 nop loc_1280: lea r10d, [r15-3] xor r14d, r14d cmp r15d, 2 jz loc_13E1 loc_1291: lea eax, [r10+1] mov ebp, r10d xor r13d, r13d cmp eax, 1 jbe loc_1400 mov r11d, r15d mov edi, ebp mov r15d, ebx xor ebx, ebx cmp ebp, 1 jz short loc_132B nop dword ptr [rax+rax+00h] loc_12B8: mov [rsp+68h+var_3C], ecx mov [rsp+68h+var_40], r8d mov [rsp+68h+var_44], r10d mov [rsp+68h+var_48], r11d mov [rsp+68h+var_4C], r9d mov [rsp+68h+var_50], edx mov [rsp+68h+var_54], esi mov [rsp+68h+var_58], edi call func0 mov edi, [rsp+68h+var_58] mov esi, [rsp+68h+var_54] add ebx, eax mov edx, [rsp+68h+var_50] mov r9d, [rsp+68h+var_4C] sub edi, 2 mov r11d, [rsp+68h+var_48] mov r10d, [rsp+68h+var_44] cmp edi, 1 mov r8d, [rsp+68h+var_40] mov ecx, [rsp+68h+var_3C] ja short loc_12B8 add ebx, 1 lea eax, [rbp-2] sub ebp, 1 add r13d, ebx cmp ebp, 1 jbe short loc_133E loc_1320: mov ebp, eax xor ebx, ebx mov edi, ebp cmp ebp, 1 jnz short loc_12B8 loc_132B: mov ebx, 1 lea eax, [rbp-2] sub ebp, 1 add r13d, ebx cmp ebp, 1 ja short loc_1320 loc_133E: add r13d, 1 mov ebx, r15d lea eax, [r10-2] mov r15d, r11d add r14d, r13d cmp r10d, 1 ja loc_1417 loc_1359: add r14d, 1 sub r15d, 2 add r12d, r14d cmp r15d, 1 ja loc_1280 loc_136E: add r12d, 1 lea eax, [rbx-2] sub ebx, 1 add edx, r12d cmp ebx, 1 jbe short loc_13A5 loc_1380: mov ebx, eax xor r12d, r12d mov r15d, ebx cmp ebx, 1 jnz loc_1280 loc_1391: mov r12d, 1 lea eax, [rbx-2] sub ebx, 1 add edx, r12d cmp ebx, 1 ja short loc_1380 loc_13A5: add edx, 1 loc_13A8: add esi, edx cmp ecx, 1 ja loc_1260 add esi, 1 loc_13B6: lea eax, [r9-2] sub r9d, 1 add [rsp+68h+var_5C], esi cmp r9d, 1 jbe short loc_1428 mov r9d, eax xor esi, esi mov ecx, r9d cmp r9d, 1 jnz loc_1260 loc_13DA: mov esi, 1 jmp short loc_13B6 loc_13E1: mov r14d, 1 sub r15d, 2 add r12d, r14d cmp r15d, 1 ja loc_1280 jmp loc_136E loc_1400: mov r13d, 1 lea eax, [r10-2] add r14d, r13d cmp r10d, 1 jbe loc_1359 loc_1417: mov r10d, eax jmp loc_1291 loc_141F: mov edx, 1 xor ecx, ecx jmp short loc_13A8 loc_1428: mov eax, [rsp+68h+var_5C] add eax, 1 loc_142F: add [rsp+68h+var_60], eax mov esi, r8d cmp r8d, 1 ja loc_1239 mov eax, [rsp+68h+var_60] add eax, 1 jmp short loc_144E loc_1449: mov eax, 1 loc_144E: add [rsp+68h+var_64], eax mov eax, [rsp+68h+var_68] lea edx, [rax-2] sub eax, 1 cmp eax, 1 jbe short loc_1468 mov [rsp+68h+var_68], edx jmp loc_1223 loc_1468: mov eax, [rsp+68h+var_64] add eax, 1 loc_146F: add rsp, 38h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_147E: mov eax, 1 xor r8d, r8d jmp short loc_142F
long long func0(int a1) { long long result; // rax unsigned int v2; // esi unsigned int v3; // r8d int v4; // esi unsigned int v5; // r9d unsigned int v6; // ecx int v7; // edx int v8; // r12d unsigned int v9; // ebx unsigned int v10; // r15d unsigned int v11; // r10d int v12; // r14d unsigned int v13; // ebp int v14; // r13d unsigned int v15; // r11d unsigned int v16; // edi unsigned int v17; // r15d int v18; // ebx unsigned int v19; // eax unsigned int v20; // eax unsigned int v21; // eax int v22; // edx int v23; // esi unsigned int v24; // eax int v25; // eax int v26; // eax unsigned int v27; // [rsp+0h] [rbp-68h] int v28; // [rsp+4h] [rbp-64h] int v29; // [rsp+8h] [rbp-60h] int v30; // [rsp+Ch] [rbp-5Ch] int v31; // [rsp+18h] [rbp-50h] unsigned int v32; // [rsp+1Ch] [rbp-4Ch] unsigned int v33; // [rsp+20h] [rbp-48h] unsigned int v34; // [rsp+24h] [rbp-44h] unsigned int v35; // [rsp+28h] [rbp-40h] unsigned int v36; // [rsp+2Ch] [rbp-3Ch] v27 = a1 - 2; result = 1LL; v28 = 0; if ( (unsigned int)(a1 - 1) > 1 ) { while ( 1 ) { v29 = 0; v2 = v27; if ( v27 <= 1 ) { v26 = 1; } else { do { if ( v2 == 2 ) { v25 = 1; v3 = 0; } else { v3 = v2 - 2; v30 = 0; v4 = 0; v5 = v3; v6 = v3; if ( v3 != 1 ) goto LABEL_5; while ( 1 ) { v23 = 1; LABEL_22: v24 = v5 - 2; v30 += v23; if ( v5 - 1 <= 1 ) break; v5 -= 2; v4 = 0; v6 = v24; if ( v24 != 1 ) { while ( 1 ) { LABEL_5: if ( v6 == 2 ) { v22 = 1; v6 = 0; } else { v6 -= 2; v7 = 0; v8 = 0; v9 = v6; v10 = v6; if ( v6 != 1 ) goto LABEL_7; LABEL_18: v21 = v9 - 2; ++v7; if ( v9 - 1 > 1 ) { while ( 1 ) { v9 = v21; v8 = 0; v10 = v21; if ( v21 == 1 ) goto LABEL_18; LABEL_7: v11 = v10 - 3; v12 = 0; if ( v10 != 2 ) break; ++v8; LABEL_16: v21 = v9 - 2; v7 += v8 + 1; if ( v9 - 1 <= 1 ) goto LABEL_19; } while ( 2 ) { v13 = v11; v14 = 0; if ( v11 + 1 <= 1 ) { v20 = v11 - 2; ++v12; if ( v11 <= 1 ) { LABEL_15: v10 -= 2; v8 += v12 + 1; if ( v10 <= 1 ) goto LABEL_16; goto LABEL_7; } } else { v15 = v10; v16 = v11; v17 = v9; v18 = 0; if ( v11 == 1 ) goto LABEL_13; while ( 1 ) { do { v36 = v6; v35 = v3; v34 = v11; v33 = v15; v32 = v5; v31 = v7; v18 += func0(); v7 = v31; v5 = v32; v16 -= 2; v15 = v33; v11 = v34; v3 = v35; v6 = v36; } while ( v16 > 1 ); v19 = v13 - 2; v14 += v18 + 1; if ( v13 - 1 <= 1 ) break; while ( 1 ) { v13 = v19; v18 = 0; v16 = v19; if ( v19 != 1 ) break; LABEL_13: v19 = v13 - 2; ++v14; if ( v13 - 1 <= 1 ) goto LABEL_14; } } LABEL_14: v9 = v17; v20 = v11 - 2; v10 = v15; v12 += v14 + 1; if ( v11 <= 1 ) goto LABEL_15; } v11 = v20; continue; } } LABEL_19: v22 = v7 + 1; } v4 += v22; if ( v6 <= 1 ) { v23 = v4 + 1; goto LABEL_22; } } } } v25 = v30 + 1; } v29 += v25; v2 = v3; } while ( v3 > 1 ); v26 = v29 + 1; } v28 += v26; if ( v27 - 1 <= 1 ) return (unsigned int)(v28 + 1); v27 -= 2; } } return result; }
func0: ENDBR64 PUSH R15 MOV EAX,EDI LEA EDX,[RDI + -0x1] PUSH R14 SUB EAX,0x2 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x38 MOV dword ptr [RSP],EAX MOV EAX,0x1 MOV dword ptr [RSP + 0x4],0x0 CMP EDX,0x1 JBE 0x0010146f LAB_00101223: MOV EAX,dword ptr [RSP] MOV dword ptr [RSP + 0x8],0x0 MOV ESI,EAX CMP EAX,0x1 JBE 0x00101449 LAB_00101239: CMP ESI,0x2 JZ 0x0010147e LEA R8D,[RSI + -0x2] MOV dword ptr [RSP + 0xc],0x0 XOR ESI,ESI MOV R9D,R8D MOV ECX,R9D CMP R9D,0x1 JZ 0x001013da LAB_00101260: CMP ECX,0x2 JZ 0x0010141f SUB ECX,0x2 XOR EDX,EDX XOR R12D,R12D MOV EBX,ECX MOV R15D,EBX CMP EBX,0x1 JZ 0x00101391 NOP LAB_00101280: LEA R10D,[R15 + -0x3] XOR R14D,R14D CMP R15D,0x2 JZ 0x001013e1 LAB_00101291: LEA EAX,[R10 + 0x1] MOV EBP,R10D XOR R13D,R13D CMP EAX,0x1 JBE 0x00101400 MOV R11D,R15D MOV EDI,EBP MOV R15D,EBX XOR EBX,EBX CMP EBP,0x1 JZ 0x0010132b NOP dword ptr [RAX + RAX*0x1] LAB_001012b8: MOV dword ptr [RSP + 0x2c],ECX MOV dword ptr [RSP + 0x28],R8D MOV dword ptr [RSP + 0x24],R10D MOV dword ptr [RSP + 0x20],R11D MOV dword ptr [RSP + 0x1c],R9D MOV dword ptr [RSP + 0x18],EDX MOV dword ptr [RSP + 0x14],ESI MOV dword ptr [RSP + 0x10],EDI CALL 0x001011f0 MOV EDI,dword ptr [RSP + 0x10] MOV ESI,dword ptr [RSP + 0x14] ADD EBX,EAX MOV EDX,dword ptr [RSP + 0x18] MOV R9D,dword ptr [RSP + 0x1c] SUB EDI,0x2 MOV R11D,dword ptr [RSP + 0x20] MOV R10D,dword ptr [RSP + 0x24] CMP EDI,0x1 MOV R8D,dword ptr [RSP + 0x28] MOV ECX,dword ptr [RSP + 0x2c] JA 0x001012b8 ADD EBX,0x1 LEA EAX,[RBP + -0x2] SUB EBP,0x1 ADD R13D,EBX CMP EBP,0x1 JBE 0x0010133e LAB_00101320: MOV EBP,EAX XOR EBX,EBX MOV EDI,EBP CMP EBP,0x1 JNZ 0x001012b8 LAB_0010132b: MOV EBX,0x1 LEA EAX,[RBP + -0x2] SUB EBP,0x1 ADD R13D,EBX CMP EBP,0x1 JA 0x00101320 LAB_0010133e: ADD R13D,0x1 MOV EBX,R15D LEA EAX,[R10 + -0x2] MOV R15D,R11D ADD R14D,R13D CMP R10D,0x1 JA 0x00101417 LAB_00101359: ADD R14D,0x1 SUB R15D,0x2 ADD R12D,R14D CMP R15D,0x1 JA 0x00101280 LAB_0010136e: ADD R12D,0x1 LEA EAX,[RBX + -0x2] SUB EBX,0x1 ADD EDX,R12D CMP EBX,0x1 JBE 0x001013a5 LAB_00101380: MOV EBX,EAX XOR R12D,R12D MOV R15D,EBX CMP EBX,0x1 JNZ 0x00101280 LAB_00101391: MOV R12D,0x1 LEA EAX,[RBX + -0x2] SUB EBX,0x1 ADD EDX,R12D CMP EBX,0x1 JA 0x00101380 LAB_001013a5: ADD EDX,0x1 LAB_001013a8: ADD ESI,EDX CMP ECX,0x1 JA 0x00101260 ADD ESI,0x1 LAB_001013b6: LEA EAX,[R9 + -0x2] SUB R9D,0x1 ADD dword ptr [RSP + 0xc],ESI CMP R9D,0x1 JBE 0x00101428 MOV R9D,EAX XOR ESI,ESI MOV ECX,R9D CMP R9D,0x1 JNZ 0x00101260 LAB_001013da: MOV ESI,0x1 JMP 0x001013b6 LAB_001013e1: MOV R14D,0x1 SUB R15D,0x2 ADD R12D,R14D CMP R15D,0x1 JA 0x00101280 JMP 0x0010136e LAB_00101400: MOV R13D,0x1 LEA EAX,[R10 + -0x2] ADD R14D,R13D CMP R10D,0x1 JBE 0x00101359 LAB_00101417: MOV R10D,EAX JMP 0x00101291 LAB_0010141f: MOV EDX,0x1 XOR ECX,ECX JMP 0x001013a8 LAB_00101428: MOV EAX,dword ptr [RSP + 0xc] ADD EAX,0x1 LAB_0010142f: ADD dword ptr [RSP + 0x8],EAX MOV ESI,R8D CMP R8D,0x1 JA 0x00101239 MOV EAX,dword ptr [RSP + 0x8] ADD EAX,0x1 JMP 0x0010144e LAB_00101449: MOV EAX,0x1 LAB_0010144e: ADD dword ptr [RSP + 0x4],EAX MOV EAX,dword ptr [RSP] LEA EDX,[RAX + -0x2] SUB EAX,0x1 CMP EAX,0x1 JBE 0x00101468 MOV dword ptr [RSP],EDX JMP 0x00101223 LAB_00101468: MOV EAX,dword ptr [RSP + 0x4] ADD EAX,0x1 LAB_0010146f: ADD RSP,0x38 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010147e: MOV EAX,0x1 XOR R8D,R8D JMP 0x0010142f
int func0(int param_1) { int iVar1; uint uVar2; uint uVar3; uint uVar4; uint uVar5; uint uVar6; int iVar7; uint uVar8; int iVar9; int iVar10; uint uVar11; int iVar12; int iVar13; int iVar14; uint uVar15; uint local_68; int local_64; int local_60; int local_5c; iVar10 = 1; local_64 = 0; local_68 = param_1 - 2; if (1 < param_1 - 1U) { do { local_60 = 0; uVar5 = local_68; if (local_68 < 2) { local_60 = 1; } else { do { if (uVar5 != 2) { uVar5 = uVar5 - 2; local_5c = 0; iVar10 = 0; uVar4 = uVar5; uVar6 = uVar5; if (uVar5 == 1) goto LAB_001013da; do { do { if (uVar6 != 2) { uVar6 = uVar6 - 2; iVar14 = 0; iVar12 = 0; uVar8 = uVar6; uVar15 = uVar6; iVar7 = 0; if (uVar6 == 1) goto LAB_00101391; LAB_00101280: uVar3 = uVar15 - 3; iVar14 = 0; if (uVar15 != 2) { do { iVar13 = 0; if (1 < uVar3 + 1) { iVar9 = 0; uVar2 = uVar3; uVar11 = uVar3; if (uVar3 == 1) goto LAB_0010132b; do { do { iVar1 = func0(); iVar9 = iVar9 + iVar1; uVar11 = uVar11 - 2; } while (1 < uVar11); iVar13 = iVar13 + iVar9 + 1; while( true ) { if (uVar2 - 1 < 2) { iVar14 = iVar14 + iVar13 + 1; goto joined_r0x00101411; } uVar2 = uVar2 - 2; iVar9 = 0; uVar11 = uVar2; if (uVar2 != 1) break; LAB_0010132b: iVar13 = iVar13 + 1; } } while( true ); } iVar14 = iVar14 + 1; joined_r0x00101411: if (uVar3 < 2) goto LAB_00101359; uVar3 = uVar3 - 2; } while( true ); } iVar12 = iVar12 + 1; goto LAB_0010136e; } iVar14 = 1; uVar6 = 0; LAB_001013a8: iVar10 = iVar10 + iVar14; } while (1 < uVar6); iVar10 = iVar10 + 1; uVar6 = uVar4; while( true ) { uVar4 = uVar6 - 2; local_5c = local_5c + iVar10; if (uVar6 - 1 < 2) { local_5c = local_5c + 1; goto LAB_0010142f; } iVar10 = 0; uVar6 = uVar4; if (uVar4 != 1) break; LAB_001013da: iVar10 = 1; uVar6 = uVar4; } } while( true ); } local_5c = 1; uVar5 = 0; LAB_0010142f: local_60 = local_60 + local_5c; } while (1 < uVar5); local_60 = local_60 + 1; } local_64 = local_64 + local_60; uVar5 = local_68 - 1; local_68 = local_68 - 2; } while (1 < uVar5); iVar10 = local_64 + 1; } return iVar10; LAB_00101359: uVar15 = uVar15 - 2; iVar12 = iVar12 + iVar14 + 1; if (uVar15 < 2) { LAB_0010136e: iVar14 = iVar7 + iVar12 + 1; while( true ) { if (uVar8 - 1 < 2) { iVar14 = iVar14 + 1; goto LAB_001013a8; } uVar8 = uVar8 - 2; iVar12 = 0; uVar15 = uVar8; iVar7 = iVar14; if (uVar8 != 1) break; LAB_00101391: iVar14 = iVar14 + 1; } } goto LAB_00101280; }
7,387
func0
#include <assert.h>
int func0(int n) { if (n == 1 || n == 2) { return 1; } else { return (func0(n - 1) + func0(n - 2)); } }
int main() { assert(func0(7) == 13); assert(func0(8) == 21); assert(func0(9) == 34); return 0; }
O3
c
func0: endbr64 push %rbp mov $0x1,%eax push %rbx lea -0x1(%rdi),%ebx sub $0x8,%rsp cmp $0x1,%ebx jbe 12dd <func0+0x2d> xor %ebp,%ebp mov %ebx,%edi sub $0x2,%ebx callq 12b0 <func0> add %eax,%ebp cmp $0x1,%ebx ja 12c9 <func0+0x19> lea 0x1(%rbp),%eax add $0x8,%rsp pop %rbx pop %rbp retq nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 push r15 lea edx, [rdi-1] push r14 push r13 mov r13d, 1 push r12 push rbp push rbx sub rsp, 58h cmp edx, 1 jbe loc_155C lea r15d, [rdi-2] xor r13d, r13d loc_128B: cmp r15d, 1 jz loc_1558 lea ebp, [r15-1] mov [rsp+88h+var_70], r13d xor r14d, r14d mov [rsp+88h+var_6C], ebp mov [rsp+88h+var_68], r15d loc_12AA: cmp ebp, 1 jz loc_156E lea ecx, [rbp-1] xor r13d, r13d mov r15d, ecx loc_12BC: cmp r15d, 1 jz loc_153E mov [rsp+88h+var_64], r14d lea edi, [r15-1] xor r12d, r12d mov esi, ecx mov [rsp+88h+var_60], r13d mov ebx, edi loc_12DB: cmp ebx, 1 jz loc_14FC mov [rsp+88h+var_5C], r12d lea r10d, [rbx-1] mov r11d, esi xor r14d, r14d mov [rsp+88h+var_58], ebx mov r13d, r10d mov esi, ebp mov r9d, edi mov ecx, r15d loc_1302: cmp r13d, 1 jz loc_14DF lea r15d, [r13-1] xor ebp, ebp mov ebx, r15d loc_1315: cmp ebx, 1 jz loc_1426 lea eax, [rbx-1] lea edx, [rbx-2] mov r8d, ebx xor r12d, r12d mov edi, eax mov [rsp+88h+var_88], edx and edi, 0FFFFFFFEh sub r8d, edi mov edi, edx mov [rsp+88h+var_74], r8d mov r8d, eax loc_133F: cmp [rsp+88h+var_74], ebx jz loc_14C0 mov [rsp+88h+var_84], r11d mov r11d, ebx mov ebx, edi xor edx, edx mov [rsp+88h+var_80], esi mov esi, r15d mov r15d, r12d mov [rsp+88h+var_7C], r9d mov r9d, r13d mov r13d, ebp mov [rsp+88h+var_78], edi cmp ebx, 1 jbe short loc_13E3 loc_1373: mov r12d, ebx xor ebp, ebp loc_1378: mov edi, r12d mov [rsp+88h+var_3C], r11d sub r12d, 2 mov [rsp+88h+var_40], r8d mov [rsp+88h+var_44], r9d mov [rsp+88h+var_48], esi mov [rsp+88h+var_4C], r10d mov [rsp+88h+var_50], ecx mov [rsp+88h+var_54], edx call func0 mov edx, [rsp+88h+var_54] mov ecx, [rsp+88h+var_50] add ebp, eax cmp r12d, 1 mov r10d, [rsp+88h+var_4C] mov esi, [rsp+88h+var_48] mov r9d, [rsp+88h+var_44] mov r8d, [rsp+88h+var_40] mov r11d, [rsp+88h+var_3C] ja short loc_1378 lea edx, [rdx+rbp+1] lea edi, [rbx-2] cmp ebx, 2 jz loc_1518 mov ebx, edi cmp ebx, 1 ja short loc_1373 loc_13E3: mov ebp, r13d mov r12d, r15d mov r13d, r9d mov r15d, esi mov ebx, r11d mov esi, [rsp+88h+var_80] mov r9d, [rsp+88h+var_7C] add edx, 1 mov r11d, [rsp+88h+var_84] mov edi, [rsp+88h+var_78] loc_1407: sub ebx, 2 lea r12d, [r12+rdx+1] sub edi, 2 cmp ebx, 1 ja loc_133F mov edx, [rsp+88h+var_88] mov eax, r8d jmp loc_14CA loc_1426: add ebp, 1 loc_1429: lea r14d, [r14+rbp+1] sub r13d, 2 cmp r15d, 1 jnz loc_1302 mov r12d, [rsp+88h+var_5C] mov ebx, [rsp+88h+var_58] mov ebp, esi mov edi, r9d mov esi, r11d mov r15d, ecx loc_1450: lea r12d, [r12+r14+1] sub ebx, 2 cmp r10d, 1 jnz loc_12DB mov r14d, [rsp+88h+var_64] mov r13d, [rsp+88h+var_60] mov ecx, esi loc_146E: lea r13d, [r13+r12+1] sub r15d, 2 cmp edi, 1 jnz loc_12BC lea r14d, [r14+r13+1] sub ebp, 2 cmp ecx, 1 jnz loc_12AA loc_1491: mov r13d, [rsp+88h+var_70] mov r15d, [rsp+88h+var_68] mov ebp, [rsp+88h+var_6C] lea r13d, [r13+r14+1] sub r15d, 2 cmp ebp, 1 jnz loc_128B add r13d, 1 jmp loc_155C loc_14C0: mov edx, [rsp+88h+var_88] mov eax, r8d add r12d, 1 loc_14CA: lea ebp, [rbp+r12+1] cmp eax, 1 jz loc_1429 mov ebx, edx jmp loc_1315 loc_14DF: mov ebp, esi mov r12d, [rsp+88h+var_5C] mov ebx, [rsp+88h+var_58] mov esi, r11d mov edi, r9d mov r15d, ecx add r14d, 1 jmp loc_1450 loc_14FC: mov r14d, [rsp+88h+var_64] mov r13d, [rsp+88h+var_60] mov ecx, esi add r12d, 1 jmp loc_146E loc_1518: mov ebp, r13d mov r12d, r15d mov r13d, r9d mov r15d, esi mov ebx, r11d mov esi, [rsp+88h+var_80] mov r9d, [rsp+88h+var_7C] mov r11d, [rsp+88h+var_84] mov edi, [rsp+88h+var_78] jmp loc_1407 loc_153E: add r13d, 1 sub ebp, 2 lea r14d, [r14+r13+1] cmp ecx, 1 jnz loc_12AA jmp loc_1491 loc_1558: add r13d, 2 loc_155C: add rsp, 58h mov eax, r13d pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_156E: mov r13d, [rsp+88h+var_70] mov r15d, [rsp+88h+var_68] add r14d, 1 mov ebp, [rsp+88h+var_6C] lea r13d, [r13+r14+1] sub r15d, 2 cmp ebp, 1 jnz loc_128B add r13d, 1 jmp short loc_155C
long long func0(int a1) { unsigned int v1; // r13d int v2; // r15d int v3; // r13d int v4; // ebp int v5; // r14d int v6; // ecx int v7; // r13d int v8; // r15d int v9; // edi int v10; // r12d int v11; // esi int v12; // ebx int v13; // r10d int v14; // r11d int v15; // r14d int v16; // r13d int v17; // esi int v18; // r9d int v19; // ecx int v20; // r15d int v21; // ebp unsigned int i; // ebx int v23; // r12d unsigned int v24; // edi unsigned int v25; // r8d unsigned int v26; // r11d unsigned int v27; // ebx int v28; // edx int v29; // esi int v30; // r15d int v31; // r9d int v32; // r13d unsigned int v33; // r12d int v34; // ebp long long v35; // rdi int v36; // eax unsigned int v37; // edi int v38; // r12d unsigned int v39; // ebx unsigned int v40; // edi unsigned int v41; // edx unsigned int v42; // eax int v43; // r12d int v44; // ebx int v45; // r13d unsigned int v47; // [rsp+0h] [rbp-88h] int v48; // [rsp+4h] [rbp-84h] int v49; // [rsp+8h] [rbp-80h] int v50; // [rsp+Ch] [rbp-7Ch] unsigned int v51; // [rsp+10h] [rbp-78h] unsigned int v52; // [rsp+14h] [rbp-74h] int v53; // [rsp+18h] [rbp-70h] int v54; // [rsp+1Ch] [rbp-6Ch] int v55; // [rsp+20h] [rbp-68h] int v56; // [rsp+24h] [rbp-64h] int v57; // [rsp+28h] [rbp-60h] int v58; // [rsp+2Ch] [rbp-5Ch] int v59; // [rsp+30h] [rbp-58h] int v60; // [rsp+34h] [rbp-54h] int v61; // [rsp+38h] [rbp-50h] int v62; // [rsp+3Ch] [rbp-4Ch] int v63; // [rsp+44h] [rbp-44h] unsigned int v64; // [rsp+48h] [rbp-40h] unsigned int v65; // [rsp+4Ch] [rbp-3Ch] v1 = 1; if ( (unsigned int)(a1 - 1) > 1 ) { v2 = a1 - 2; v3 = 0; while ( 1 ) { LABEL_3: if ( v2 == 1 ) return (unsigned int)(v3 + 2); v4 = v2 - 1; v53 = v3; v5 = 0; v54 = v2 - 1; v55 = v2; LABEL_5: if ( v4 != 1 ) break; v3 = v53 + v5 + 1 + 1; v2 = v55 - 2; if ( v54 == 1 ) return (unsigned int)(v53 + v5 + 1 + 2); } v6 = v4 - 1; v7 = 0; v8 = v4 - 1; while ( v8 != 1 ) { v56 = v5; v9 = v8 - 1; v10 = 0; v11 = v6; v57 = v7; v12 = v8 - 1; while ( v12 != 1 ) { v58 = v10; v13 = v12 - 1; v14 = v11; v15 = 0; v59 = v12; v16 = v12 - 1; v17 = v4; v18 = v9; v19 = v8; while ( v16 != 1 ) { v20 = v16 - 1; v21 = 0; for ( i = v16 - 1; i != 1; i = v41 ) { v23 = 0; v47 = i - 2; v24 = i - 2; v52 = i - ((i - 1) & 0xFFFFFFFE); v25 = i - 1; while ( v52 != i ) { v48 = v14; v26 = i; v27 = v24; v28 = 0; v49 = v17; v29 = v20; v30 = v23; v50 = v18; v31 = v16; v32 = v21; v51 = v24; if ( v24 <= 1 ) { LABEL_21: v21 = v32; v38 = v30; v16 = v31; v20 = v29; v39 = v26; v17 = v49; v18 = v50; ++v28; v14 = v48; v40 = v51; } else { while ( 1 ) { v33 = v27; v34 = 0; do { v35 = v33; v65 = v26; v33 -= 2; v64 = v25; v63 = v31; v62 = v13; v61 = v19; v60 = v28; v36 = func0(v35); v28 = v60; v19 = v61; v34 += v36; v13 = v62; v31 = v63; v25 = v64; v26 = v65; } while ( v33 > 1 ); v28 = v60 + v34 + 1; v37 = v27 - 2; if ( v27 == 2 ) break; v27 -= 2; if ( v37 <= 1 ) goto LABEL_21; } v21 = v32; v38 = v30; v16 = v63; v20 = v29; v39 = v65; v17 = v49; v18 = v50; v14 = v48; v40 = v51; } i = v39 - 2; v23 = v38 + v28 + 1; v24 = v40 - 2; if ( i <= 1 ) { v41 = v47; v42 = v25; goto LABEL_34; } } v41 = v47; v42 = v25; ++v23; LABEL_34: v21 += v23 + 1; if ( v42 == 1 ) goto LABEL_25; } ++v21; LABEL_25: v15 += v21 + 1; v16 -= 2; if ( v20 == 1 ) { v43 = v58; v44 = v59; v4 = v17; v9 = v18; v11 = v14; v8 = v19; goto LABEL_27; } } v4 = v17; v43 = v58; v44 = v59; v11 = v14; v9 = v18; v8 = v19; ++v15; LABEL_27: v10 = v43 + v15 + 1; v12 = v44 - 2; if ( v13 == 1 ) { v5 = v56; v45 = v57; v6 = v11; goto LABEL_29; } } v5 = v56; v45 = v57; v6 = v11; ++v10; LABEL_29: v7 = v45 + v10 + 1; v8 -= 2; if ( v9 == 1 ) { v5 += v7 + 1; v4 -= 2; if ( v6 != 1 ) goto LABEL_5; goto LABEL_31; } } v4 -= 2; v5 += v7 + 1 + 1; if ( v6 != 1 ) goto LABEL_5; LABEL_31: v3 = v53 + v5 + 1; v2 = v55 - 2; if ( v54 != 1 ) goto LABEL_3; return (unsigned int)(v53 + v5 + 2); } return v1; }
func0: ENDBR64 PUSH R15 LEA EDX,[RDI + -0x1] PUSH R14 PUSH R13 MOV R13D,0x1 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x58 CMP EDX,0x1 JBE 0x0010155c LEA R15D,[RDI + -0x2] XOR R13D,R13D LAB_0010128b: CMP R15D,0x1 JZ 0x00101558 LEA EBP,[R15 + -0x1] MOV dword ptr [RSP + 0x18],R13D XOR R14D,R14D MOV dword ptr [RSP + 0x1c],EBP MOV dword ptr [RSP + 0x20],R15D LAB_001012aa: CMP EBP,0x1 JZ 0x0010156e LEA ECX,[RBP + -0x1] XOR R13D,R13D MOV R15D,ECX LAB_001012bc: CMP R15D,0x1 JZ 0x0010153e MOV dword ptr [RSP + 0x24],R14D LEA EDI,[R15 + -0x1] XOR R12D,R12D MOV ESI,ECX MOV dword ptr [RSP + 0x28],R13D MOV EBX,EDI LAB_001012db: CMP EBX,0x1 JZ 0x001014fc MOV dword ptr [RSP + 0x2c],R12D LEA R10D,[RBX + -0x1] MOV R11D,ESI XOR R14D,R14D MOV dword ptr [RSP + 0x30],EBX MOV R13D,R10D MOV ESI,EBP MOV R9D,EDI MOV ECX,R15D LAB_00101302: CMP R13D,0x1 JZ 0x001014df LEA R15D,[R13 + -0x1] XOR EBP,EBP MOV EBX,R15D LAB_00101315: CMP EBX,0x1 JZ 0x00101426 LEA EAX,[RBX + -0x1] LEA EDX,[RBX + -0x2] MOV R8D,EBX XOR R12D,R12D MOV EDI,EAX MOV dword ptr [RSP],EDX AND EDI,0xfffffffe SUB R8D,EDI MOV EDI,EDX MOV dword ptr [RSP + 0x14],R8D MOV R8D,EAX LAB_0010133f: CMP dword ptr [RSP + 0x14],EBX JZ 0x001014c0 MOV dword ptr [RSP + 0x4],R11D MOV R11D,EBX MOV EBX,EDI XOR EDX,EDX MOV dword ptr [RSP + 0x8],ESI MOV ESI,R15D MOV R15D,R12D MOV dword ptr [RSP + 0xc],R9D MOV R9D,R13D MOV R13D,EBP MOV dword ptr [RSP + 0x10],EDI CMP EBX,0x1 JBE 0x001013e3 LAB_00101373: MOV R12D,EBX XOR EBP,EBP LAB_00101378: MOV EDI,R12D MOV dword ptr [RSP + 0x4c],R11D SUB R12D,0x2 MOV dword ptr [RSP + 0x48],R8D MOV dword ptr [RSP + 0x44],R9D MOV dword ptr [RSP + 0x40],ESI MOV dword ptr [RSP + 0x3c],R10D MOV dword ptr [RSP + 0x38],ECX MOV dword ptr [RSP + 0x34],EDX CALL 0x00101260 MOV EDX,dword ptr [RSP + 0x34] MOV ECX,dword ptr [RSP + 0x38] ADD EBP,EAX CMP R12D,0x1 MOV R10D,dword ptr [RSP + 0x3c] MOV ESI,dword ptr [RSP + 0x40] MOV R9D,dword ptr [RSP + 0x44] MOV R8D,dword ptr [RSP + 0x48] MOV R11D,dword ptr [RSP + 0x4c] JA 0x00101378 LEA EDX,[RDX + RBP*0x1 + 0x1] LEA EDI,[RBX + -0x2] CMP EBX,0x2 JZ 0x00101518 MOV EBX,EDI CMP EBX,0x1 JA 0x00101373 LAB_001013e3: MOV EBP,R13D MOV R12D,R15D MOV R13D,R9D MOV R15D,ESI MOV EBX,R11D MOV ESI,dword ptr [RSP + 0x8] MOV R9D,dword ptr [RSP + 0xc] ADD EDX,0x1 MOV R11D,dword ptr [RSP + 0x4] MOV EDI,dword ptr [RSP + 0x10] LAB_00101407: SUB EBX,0x2 LEA R12D,[R12 + RDX*0x1 + 0x1] SUB EDI,0x2 CMP EBX,0x1 JA 0x0010133f MOV EDX,dword ptr [RSP] MOV EAX,R8D JMP 0x001014ca LAB_00101426: ADD EBP,0x1 LAB_00101429: LEA R14D,[R14 + RBP*0x1 + 0x1] SUB R13D,0x2 CMP R15D,0x1 JNZ 0x00101302 MOV R12D,dword ptr [RSP + 0x2c] MOV EBX,dword ptr [RSP + 0x30] MOV EBP,ESI MOV EDI,R9D MOV ESI,R11D MOV R15D,ECX LAB_00101450: LEA R12D,[R12 + R14*0x1 + 0x1] SUB EBX,0x2 CMP R10D,0x1 JNZ 0x001012db MOV R14D,dword ptr [RSP + 0x24] MOV R13D,dword ptr [RSP + 0x28] MOV ECX,ESI LAB_0010146e: LEA R13D,[R13 + R12*0x1 + 0x1] SUB R15D,0x2 CMP EDI,0x1 JNZ 0x001012bc LEA R14D,[R14 + R13*0x1 + 0x1] SUB EBP,0x2 CMP ECX,0x1 JNZ 0x001012aa LAB_00101491: MOV R13D,dword ptr [RSP + 0x18] MOV R15D,dword ptr [RSP + 0x20] MOV EBP,dword ptr [RSP + 0x1c] LEA R13D,[R13 + R14*0x1 + 0x1] SUB R15D,0x2 CMP EBP,0x1 JNZ 0x0010128b ADD R13D,0x1 JMP 0x0010155c LAB_001014c0: MOV EDX,dword ptr [RSP] MOV EAX,R8D ADD R12D,0x1 LAB_001014ca: LEA EBP,[RBP + R12*0x1 + 0x1] CMP EAX,0x1 JZ 0x00101429 MOV EBX,EDX JMP 0x00101315 LAB_001014df: MOV EBP,ESI MOV R12D,dword ptr [RSP + 0x2c] MOV EBX,dword ptr [RSP + 0x30] MOV ESI,R11D MOV EDI,R9D MOV R15D,ECX ADD R14D,0x1 JMP 0x00101450 LAB_001014fc: MOV R14D,dword ptr [RSP + 0x24] MOV R13D,dword ptr [RSP + 0x28] MOV ECX,ESI ADD R12D,0x1 JMP 0x0010146e LAB_00101518: MOV EBP,R13D MOV R12D,R15D MOV R13D,R9D MOV R15D,ESI MOV EBX,R11D MOV ESI,dword ptr [RSP + 0x8] MOV R9D,dword ptr [RSP + 0xc] MOV R11D,dword ptr [RSP + 0x4] MOV EDI,dword ptr [RSP + 0x10] JMP 0x00101407 LAB_0010153e: ADD R13D,0x1 SUB EBP,0x2 LEA R14D,[R14 + R13*0x1 + 0x1] CMP ECX,0x1 JNZ 0x001012aa JMP 0x00101491 LAB_00101558: ADD R13D,0x2 LAB_0010155c: ADD RSP,0x58 MOV EAX,R13D POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010156e: MOV R13D,dword ptr [RSP + 0x18] MOV R15D,dword ptr [RSP + 0x20] ADD R14D,0x1 MOV EBP,dword ptr [RSP + 0x1c] LEA R13D,[R13 + R14*0x1 + 0x1] SUB R15D,0x2 CMP EBP,0x1 JNZ 0x0010128b ADD R13D,0x1 JMP 0x0010155c
int func0(int param_1) { int iVar1; uint uVar2; uint uVar3; uint uVar4; uint uVar5; int iVar6; int iVar7; uint uVar8; int iVar9; uint uVar10; int iVar11; int iVar12; int iVar13; int iVar14; int iVar15; uint uVar16; uint uVar17; int iVar18; uint uVar19; int iVar20; int iVar21; int iVar22; int iVar23; int iVar24; int iVar25; int iVar26; int iVar27; bool bVar28; iVar24 = 1; if (1 < param_1 - 1U) { param_1 = param_1 + -2; iVar24 = 0; LAB_0010128b: do { if (param_1 == 1) { return iVar24 + 2; } iVar12 = param_1 + -1; iVar26 = 0; iVar13 = iVar12; do { if (iVar13 == 1) { iVar24 = iVar24 + iVar26 + 2; param_1 = param_1 + -2; if (iVar12 == 1) { return iVar24 + 1; } goto LAB_0010128b; } iVar7 = iVar13 + -1; iVar23 = 0; iVar27 = iVar7; do { if (iVar27 == 1) { iVar26 = iVar26 + iVar23 + 2; goto joined_r0x0010154d; } iVar1 = iVar27 + -1; iVar21 = 0; iVar11 = iVar1; do { if (iVar11 == 1) { iVar21 = iVar21 + 1; break; } iVar18 = iVar11 + -1; iVar25 = 0; iVar22 = iVar18; do { if (iVar22 == 1) { iVar25 = iVar25 + 1; break; } uVar2 = iVar22 - 1; iVar15 = 0; uVar10 = uVar2; do { if (uVar10 == 1) { iVar15 = iVar15 + 1; break; } uVar5 = uVar10 - 1; uVar8 = uVar10 - 2; iVar20 = 0; uVar17 = uVar10 - (uVar5 & 0xfffffffe); uVar16 = uVar8; do { if (uVar17 == uVar10) { iVar20 = iVar20 + 1; break; } iVar9 = 0; uVar4 = uVar16; do { if (uVar4 < 2) { iVar9 = iVar9 + 1; break; } iVar14 = 0; uVar3 = uVar4; do { uVar19 = uVar3 - 2; iVar6 = func0(uVar3); iVar14 = iVar14 + iVar6; uVar3 = uVar19; } while (1 < uVar19); iVar9 = iVar9 + 1 + iVar14; bVar28 = uVar4 != 2; uVar4 = uVar4 - 2; } while (bVar28); uVar10 = uVar10 - 2; iVar20 = iVar20 + 1 + iVar9; uVar16 = uVar16 - 2; } while (1 < uVar10); iVar15 = iVar15 + 1 + iVar20; uVar10 = uVar8; } while (uVar5 != 1); iVar25 = iVar25 + 1 + iVar15; iVar22 = iVar22 + -2; } while (uVar2 != 1); iVar21 = iVar21 + 1 + iVar25; iVar11 = iVar11 + -2; } while (iVar18 != 1); iVar23 = iVar23 + 1 + iVar21; iVar27 = iVar27 + -2; } while (iVar1 != 1); iVar26 = iVar26 + 1 + iVar23; joined_r0x0010154d: iVar13 = iVar13 + -2; } while (iVar7 != 1); iVar24 = iVar24 + 1 + iVar26; param_1 = param_1 + -2; } while (iVar12 != 1); iVar24 = iVar24 + 1; } return iVar24; }
7,388
func0
#include <assert.h> #include <string.h> #include <stdbool.h>
bool func0(const char* str1, const char* str2) { int N = strlen(str1); int M = strlen(str2); if (N % M != 0) { return false; } for (int i = 0; i < N; i++) { if (str1[i] != str2[i % M]) { return false; } } return true; }
int main() { assert(func0("abcabcabc", "abc") == true); assert(func0("abcab", "abc") == false); assert(func0("aba", "ab") == false); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 1060 <strlen@plt> mov %eax,-0x8(%rbp) mov -0x20(%rbp),%rax mov %rax,%rdi callq 1060 <strlen@plt> mov %eax,-0x4(%rbp) mov -0x8(%rbp),%eax cltd idivl -0x4(%rbp) mov %edx,%eax test %eax,%eax je 11af <func0+0x46> mov $0x0,%eax jmp 11fa <func0+0x91> movl $0x0,-0xc(%rbp) jmp 11ed <func0+0x84> mov -0xc(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax movzbl (%rax),%ecx mov -0xc(%rbp),%eax cltd idivl -0x4(%rbp) mov %edx,%eax movslq %eax,%rdx mov -0x20(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax cmp %al,%cl je 11e9 <func0+0x80> mov $0x0,%eax jmp 11fa <func0+0x91> addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x8(%rbp),%eax jl 11b8 <func0+0x4f> mov $0x1,%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+s], rdi mov [rbp+var_20], rsi mov rax, [rbp+s] mov rdi, rax; s call _strlen mov [rbp+var_8], eax mov rax, [rbp+var_20] mov rdi, rax; s call _strlen mov [rbp+var_4], eax mov eax, [rbp+var_8] cdq idiv [rbp+var_4] mov eax, edx test eax, eax jz short loc_11AF mov eax, 0 jmp short locret_11FA loc_11AF: mov [rbp+var_C], 0 jmp short loc_11ED loc_11B8: mov eax, [rbp+var_C] movsxd rdx, eax mov rax, [rbp+s] add rax, rdx movzx ecx, byte ptr [rax] mov eax, [rbp+var_C] cdq idiv [rbp+var_4] mov eax, edx movsxd rdx, eax mov rax, [rbp+var_20] add rax, rdx movzx eax, byte ptr [rax] cmp cl, al jz short loc_11E9 mov eax, 0 jmp short locret_11FA loc_11E9: add [rbp+var_C], 1 loc_11ED: mov eax, [rbp+var_C] cmp eax, [rbp+var_8] jl short loc_11B8 mov eax, 1 locret_11FA: leave retn
long long func0(const char *a1, const char *a2) { int i; // [rsp+14h] [rbp-Ch] int v4; // [rsp+18h] [rbp-8h] int v5; // [rsp+1Ch] [rbp-4h] v4 = strlen(a1); v5 = strlen(a2); if ( v4 % v5 ) return 0LL; for ( i = 0; i < v4; ++i ) { if ( a1[i] != a2[i % v5] ) return 0LL; } return 1LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101060 MOV dword ptr [RBP + -0x8],EAX MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x00101060 MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x8] CDQ IDIV dword ptr [RBP + -0x4] MOV EAX,EDX TEST EAX,EAX JZ 0x001011af MOV EAX,0x0 JMP 0x001011fa LAB_001011af: MOV dword ptr [RBP + -0xc],0x0 JMP 0x001011ed LAB_001011b8: MOV EAX,dword ptr [RBP + -0xc] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVZX ECX,byte ptr [RAX] MOV EAX,dword ptr [RBP + -0xc] CDQ IDIV dword ptr [RBP + -0x4] MOV EAX,EDX MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] CMP CL,AL JZ 0x001011e9 MOV EAX,0x0 JMP 0x001011fa LAB_001011e9: ADD dword ptr [RBP + -0xc],0x1 LAB_001011ed: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x8] JL 0x001011b8 MOV EAX,0x1 LAB_001011fa: LEAVE RET
int8 func0(char *param_1,char *param_2) { size_t sVar1; size_t sVar2; int8 uVar3; int local_14; sVar1 = strlen(param_1); sVar2 = strlen(param_2); if ((int)sVar1 % (int)sVar2 == 0) { for (local_14 = 0; local_14 < (int)sVar1; local_14 = local_14 + 1) { if (param_1[local_14] != param_2[local_14 % (int)sVar2]) { return 0; } } uVar3 = 1; } else { uVar3 = 0; } return uVar3; }
7,389
func0
#include <assert.h> #include <string.h> #include <stdbool.h>
bool func0(const char* str1, const char* str2) { int N = strlen(str1); int M = strlen(str2); if (N % M != 0) { return false; } for (int i = 0; i < N; i++) { if (str1[i] != str2[i % M]) { return false; } } return true; }
int main() { assert(func0("abcabcabc", "abc") == true); assert(func0("abcab", "abc") == false); assert(func0("aba", "ab") == false); return 0; }
O1
c
func0: endbr64 mov %rdi,%r8 mov $0xffffffffffffffff,%rdx mov $0x0,%eax mov %rdx,%rcx repnz scas %es:(%rdi),%al not %rcx lea -0x1(%rcx),%r9 mov %rdx,%rcx mov %rsi,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rax),%edi mov %r9d,%eax cltd idiv %edi mov $0x0,%eax test %edx,%edx jne 11c7 <func0+0x7e> test %r9d,%r9d jle 11bc <func0+0x73> lea -0x1(%r9),%r9d mov $0x0,%ecx jmp 119b <func0+0x52> mov %rax,%rcx mov %ecx,%eax cltd idiv %edi movslq %edx,%rdx movzbl (%rsi,%rdx,1),%eax cmp %al,(%r8,%rcx,1) jne 11c2 <func0+0x79> lea 0x1(%rcx),%rax cmp %r9,%rcx jne 1198 <func0+0x4f> mov $0x1,%eax retq mov $0x1,%eax retq mov $0x0,%eax retq
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov rbx, rdi mov rbp, rsi call _strlen mov r12, rax mov rdi, rbp call _strlen mov esi, eax mov eax, r12d cdq idiv esi mov eax, 0 test edx, edx jnz short loc_11E0 test r12d, r12d jle short loc_11D4 lea edi, [r12-1] mov ecx, 0 jmp short loc_11B2 loc_11AF: mov rcx, rax loc_11B2: mov eax, ecx cdq idiv esi movsxd rdx, edx movzx eax, byte ptr [rbp+rdx+0] cmp [rbx+rcx], al jnz short loc_11DB lea rax, [rcx+1] cmp rcx, rdi jnz short loc_11AF mov eax, 1 jmp short loc_11E0 loc_11D4: mov eax, 1 jmp short loc_11E0 loc_11DB: mov eax, 0 loc_11E0: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
long long func0(long long a1, long long a2) { int v3; // r12d int v4; // esi long long result; // rax long long i; // rcx v3 = ((long long (*)(void))strlen)(); v4 = strlen(a2); result = 0LL; if ( !(v3 % v4) ) { if ( v3 <= 0 ) { return 1LL; } else { for ( i = 0LL; *(_BYTE *)(a1 + i) == *(_BYTE *)(a2 + (int)i % v4); ++i ) { if ( i == v3 - 1 ) return 1LL; } return 0LL; } } return result; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBX,RDI MOV RBP,RSI CALL 0x00101060 MOV R12,RAX MOV RDI,RBP CALL 0x00101060 MOV ESI,EAX MOV EAX,R12D CDQ IDIV ESI MOV EAX,0x0 TEST EDX,EDX JNZ 0x001011e0 TEST R12D,R12D JLE 0x001011d4 LEA EDI,[R12 + -0x1] MOV ECX,0x0 JMP 0x001011b2 LAB_001011af: MOV RCX,RAX LAB_001011b2: MOV EAX,ECX CDQ IDIV ESI MOVSXD RDX,EDX MOVZX EAX,byte ptr [RBP + RDX*0x1] CMP byte ptr [RBX + RCX*0x1],AL JNZ 0x001011db LEA RAX,[RCX + 0x1] CMP RCX,RDI JNZ 0x001011af MOV EAX,0x1 JMP 0x001011e0 LAB_001011d4: MOV EAX,0x1 JMP 0x001011e0 LAB_001011db: MOV EAX,0x0 LAB_001011e0: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
int8 func0(char *param_1,char *param_2) { size_t sVar1; size_t sVar2; int8 uVar3; ulong uVar4; int iVar5; bool bVar6; sVar1 = strlen(param_1); sVar2 = strlen(param_2); iVar5 = (int)sVar1; uVar3 = 0; if ((int)((long)((ulong)(uint)(iVar5 >> 0x1f) << 0x20 | sVar1 & 0xffffffff) % (long)(int)sVar2) == 0) { if (iVar5 < 1) { uVar3 = 1; } else { uVar4 = 0; do { if (param_1[uVar4] != param_2[(int)((long)((ulong)(uint)((int)uVar4 >> 0x1f) << 0x20 | uVar4 & 0xffffffff) % (long)(int)sVar2)]) { return 0; } bVar6 = uVar4 != iVar5 - 1; uVar4 = uVar4 + 1; } while (bVar6); uVar3 = 1; } } return uVar3; }
7,390
func0
#include <assert.h> #include <string.h> #include <stdbool.h>
bool func0(const char* str1, const char* str2) { int N = strlen(str1); int M = strlen(str2); if (N % M != 0) { return false; } for (int i = 0; i < N; i++) { if (str1[i] != str2[i % M]) { return false; } } return true; }
int main() { assert(func0("abcabcabc", "abc") == true); assert(func0("abcab", "abc") == false); assert(func0("aba", "ab") == false); return 0; }
O2
c
func0: endbr64 push %r13 push %r12 push %rbp mov %rsi,%rbp push %rbx mov %rdi,%rbx sub $0x8,%rsp callq 1060 <strlen@plt> mov %rbp,%rdi mov %rax,%r12 callq 1060 <strlen@plt> mov %eax,%edi mov %r12d,%eax cltd idiv %edi xor %eax,%eax test %edx,%edx jne 1290 <func0+0x60> test %r12d,%r12d jle 12a0 <func0+0x70> lea -0x1(%r12),%esi xor %ecx,%ecx jmp 127c <func0+0x4c> lea 0x1(%rcx),%rax cmp %rsi,%rcx je 12a0 <func0+0x70> mov %rax,%rcx mov %ecx,%eax cltd idiv %edi movslq %edx,%rdx movzbl 0x0(%rbp,%rdx,1),%eax cmp %al,(%rbx,%rcx,1) je 1270 <func0+0x40> xor %eax,%eax add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq nopl 0x0(%rax,%rax,1) add $0x8,%rsp mov $0x1,%eax pop %rbx pop %rbp pop %r12 pop %r13 retq
func0: endbr64 push r13 push r12 push rbp mov rbp, rsi push rbx mov rbx, rdi sub rsp, 8 call _strlen mov rdi, rbp mov r12, rax call _strlen mov esi, eax mov eax, r12d cdq idiv esi xor eax, eax test edx, edx jnz short loc_1280 test r12d, r12d jle short loc_1290 lea edi, [r12-1] xor ecx, ecx jmp short loc_126C loc_1260: lea rax, [rcx+1] cmp rcx, rdi jz short loc_1290 mov rcx, rax loc_126C: mov eax, ecx cdq idiv esi movsxd rdx, edx movzx eax, byte ptr [rbp+rdx+0] cmp [rbx+rcx], al jz short loc_1260 xor eax, eax loc_1280: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_1290: add rsp, 8 mov eax, 1 pop rbx pop rbp pop r12 pop r13 retn
long long func0(long long a1, long long a2) { int v3; // r12d int v4; // esi long long result; // rax long long i; // rcx v3 = ((long long (*)(void))strlen)(); v4 = strlen(a2); result = 0LL; if ( !(v3 % v4) ) { if ( v3 <= 0 ) { return 1LL; } else { for ( i = 0LL; *(_BYTE *)(a1 + i) == *(_BYTE *)(a2 + (int)i % v4); ++i ) { if ( i == v3 - 1 ) return 1LL; } return 0LL; } } return result; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP MOV RBP,RSI PUSH RBX MOV RBX,RDI SUB RSP,0x8 CALL 0x00101060 MOV RDI,RBP MOV R12,RAX CALL 0x00101060 MOV ESI,EAX MOV EAX,R12D CDQ IDIV ESI XOR EAX,EAX TEST EDX,EDX JNZ 0x00101280 TEST R12D,R12D JLE 0x00101290 LEA EDI,[R12 + -0x1] XOR ECX,ECX JMP 0x0010126c LAB_00101260: LEA RAX,[RCX + 0x1] CMP RCX,RDI JZ 0x00101290 MOV RCX,RAX LAB_0010126c: MOV EAX,ECX CDQ IDIV ESI MOVSXD RDX,EDX MOVZX EAX,byte ptr [RBP + RDX*0x1] CMP byte ptr [RBX + RCX*0x1],AL JZ 0x00101260 XOR EAX,EAX LAB_00101280: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_00101290: ADD RSP,0x8 MOV EAX,0x1 POP RBX POP RBP POP R12 POP R13 RET
int8 func0(char *param_1,char *param_2) { size_t sVar1; size_t sVar2; ulong uVar3; int iVar4; bool bVar5; sVar1 = strlen(param_1); sVar2 = strlen(param_2); iVar4 = (int)sVar1; if ((int)((long)((ulong)(uint)(iVar4 >> 0x1f) << 0x20 | sVar1 & 0xffffffff) % (long)(int)sVar2) != 0) { return 0; } if (0 < iVar4) { uVar3 = 0; do { if (param_1[uVar3] != param_2[(int)((long)((ulong)(uint)((int)uVar3 >> 0x1f) << 0x20 | uVar3 & 0xffffffff) % (long)(int)sVar2)]) { return 0; } bVar5 = uVar3 != iVar4 - 1; uVar3 = uVar3 + 1; } while (bVar5); } return 1; }
7,391
func0
#include <assert.h> #include <string.h> #include <stdbool.h>
bool func0(const char* str1, const char* str2) { int N = strlen(str1); int M = strlen(str2); if (N % M != 0) { return false; } for (int i = 0; i < N; i++) { if (str1[i] != str2[i % M]) { return false; } } return true; }
int main() { assert(func0("abcabcabc", "abc") == true); assert(func0("abcab", "abc") == false); assert(func0("aba", "ab") == false); return 0; }
O3
c
func0: endbr64 push %r13 push %r12 push %rbp mov %rsi,%rbp push %rbx mov %rdi,%rbx sub $0x8,%rsp callq 1060 <strlen@plt> mov %rbp,%rdi mov %rax,%r12 callq 1060 <strlen@plt> mov %eax,%edi mov %r12d,%eax cltd idiv %edi xor %eax,%eax test %edx,%edx jne 1290 <func0+0x60> test %r12d,%r12d jle 12a0 <func0+0x70> lea -0x1(%r12),%esi xor %ecx,%ecx jmp 127c <func0+0x4c> lea 0x1(%rcx),%rax cmp %rsi,%rcx je 12a0 <func0+0x70> mov %rax,%rcx mov %ecx,%eax cltd idiv %edi movslq %edx,%rdx movzbl 0x0(%rbp,%rdx,1),%eax cmp %al,(%rbx,%rcx,1) je 1270 <func0+0x40> xor %eax,%eax add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq nopl 0x0(%rax,%rax,1) add $0x8,%rsp mov $0x1,%eax pop %rbx pop %rbp pop %r12 pop %r13 retq
func0: endbr64 push r13 push r12 push rbp mov rbp, rsi push rbx mov rbx, rdi sub rsp, 8 call _strlen mov rdi, rbp; s mov r12, rax call _strlen mov esi, eax mov eax, r12d cdq idiv esi xor eax, eax test edx, edx jnz short loc_1280 test r12d, r12d jle short loc_1290 lea edi, [r12-1] xor ecx, ecx jmp short loc_126C loc_1260: lea rax, [rcx+1] cmp rcx, rdi jz short loc_1290 mov rcx, rax loc_126C: mov eax, ecx cdq idiv esi movsxd rdx, edx movzx eax, byte ptr [rbp+rdx+0] cmp [rbx+rcx], al jz short loc_1260 xor eax, eax loc_1280: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_1290: add rsp, 8 mov eax, 1 pop rbx pop rbp pop r12 pop r13 retn
long long func0(const char *a1, const char *a2) { int v3; // r12d int v4; // esi long long result; // rax long long i; // rcx v3 = strlen(a1); v4 = strlen(a2); result = 0LL; if ( !(v3 % v4) ) { if ( v3 <= 0 ) { return 1LL; } else { for ( i = 0LL; a1[i] == a2[(int)i % v4]; ++i ) { if ( i == v3 - 1 ) return 1LL; } return 0LL; } } return result; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP MOV RBP,RSI PUSH RBX MOV RBX,RDI SUB RSP,0x8 CALL 0x00101060 MOV RDI,RBP MOV R12,RAX CALL 0x00101060 MOV ESI,EAX MOV EAX,R12D CDQ IDIV ESI XOR EAX,EAX TEST EDX,EDX JNZ 0x00101280 TEST R12D,R12D JLE 0x00101290 LEA EDI,[R12 + -0x1] XOR ECX,ECX JMP 0x0010126c LAB_00101260: LEA RAX,[RCX + 0x1] CMP RCX,RDI JZ 0x00101290 MOV RCX,RAX LAB_0010126c: MOV EAX,ECX CDQ IDIV ESI MOVSXD RDX,EDX MOVZX EAX,byte ptr [RBP + RDX*0x1] CMP byte ptr [RBX + RCX*0x1],AL JZ 0x00101260 XOR EAX,EAX LAB_00101280: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_00101290: ADD RSP,0x8 MOV EAX,0x1 POP RBX POP RBP POP R12 POP R13 RET
int8 func0(char *param_1,char *param_2) { size_t sVar1; size_t sVar2; ulong uVar3; int iVar4; bool bVar5; sVar1 = strlen(param_1); sVar2 = strlen(param_2); iVar4 = (int)sVar1; if ((int)((long)((ulong)(uint)(iVar4 >> 0x1f) << 0x20 | sVar1 & 0xffffffff) % (long)(int)sVar2) != 0) { return 0; } if (0 < iVar4) { uVar3 = 0; do { if (param_1[uVar3] != param_2[(int)((long)((ulong)(uint)((int)uVar3 >> 0x1f) << 0x20 | uVar3 & 0xffffffff) % (long)(int)sVar2)]) { return 0; } bVar5 = uVar3 != iVar4 - 1; uVar3 = uVar3 + 1; } while (bVar5); } return 1; }
7,392
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
int func0(int test_list[][2], int len) { int* temp = (int*)malloc(sizeof(int) * len); for (int i = 0; i < len; i++) { temp[i] = abs(test_list[i][1] - test_list[i][0]); } int res = temp[0]; for (int i = 1; i < len; i++) { if (temp[i] < res) { res = temp[i]; } } free(temp); return res; }
int main() { int arr1[][2] = {{3, 5}, {1, 7}, {10, 3}, {1, 2}}; int arr2[][2] = {{4, 6}, {12, 8}, {11, 4}, {2, 13}}; int arr3[][2] = {{5, 17}, {3, 9}, {12, 5}, {3, 24}}; assert(func0(arr1, 4) == 1); assert(func0(arr2, 4) == 2); assert(func0(arr3, 4) == 6); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x28(%rbp) mov %esi,-0x2c(%rbp) mov -0x2c(%rbp),%eax cltq shl $0x2,%rax mov %rax,%rdi callq 10b0 <malloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0x14(%rbp) jmp 122b <func0+0x82> mov -0x14(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov 0x4(%rax),%edx mov -0x14(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x28(%rbp),%rax add %rcx,%rax mov (%rax),%eax sub %eax,%edx mov %edx,%eax mov -0x14(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x8(%rbp),%rdx add %rdx,%rcx cltd xor %edx,%eax sub %edx,%eax mov %eax,(%rcx) addl $0x1,-0x14(%rbp) mov -0x14(%rbp),%eax cmp -0x2c(%rbp),%eax jl 11da <func0+0x31> mov -0x8(%rbp),%rax mov (%rax),%eax mov %eax,-0x10(%rbp) movl $0x1,-0xc(%rbp) jmp 127d <func0+0xd4> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x8(%rbp),%rax add %rdx,%rax mov (%rax),%eax cmp %eax,-0x10(%rbp) jle 1279 <func0+0xd0> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x8(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov %eax,-0x10(%rbp) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x2c(%rbp),%eax jl 1245 <func0+0x9c> mov -0x8(%rbp),%rax mov %rax,%rdi callq 1080 <free@plt> mov -0x10(%rbp),%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_28], rdi mov [rbp+var_2C], esi mov eax, [rbp+var_2C] cdqe shl rax, 2 mov rdi, rax; size call _malloc mov [rbp+ptr], rax mov [rbp+var_14], 0 jmp short loc_122C loc_11DA: mov eax, [rbp+var_14] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_28] add rax, rdx mov eax, [rax+4] mov edx, [rbp+var_14] movsxd rdx, edx lea rcx, ds:0[rdx*8] mov rdx, [rbp+var_28] add rdx, rcx mov edx, [rdx] sub eax, edx mov edx, [rbp+var_14] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+ptr] add rdx, rcx mov ecx, eax neg ecx cmovns eax, ecx mov [rdx], eax add [rbp+var_14], 1 loc_122C: mov eax, [rbp+var_14] cmp eax, [rbp+var_2C] jl short loc_11DA mov rax, [rbp+ptr] mov eax, [rax] mov [rbp+var_10], eax mov [rbp+var_C], 1 jmp short loc_127E loc_1246: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+ptr] add rax, rdx mov eax, [rax] cmp [rbp+var_10], eax jle short loc_127A mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+ptr] add rax, rdx mov eax, [rax] mov [rbp+var_10], eax loc_127A: add [rbp+var_C], 1 loc_127E: mov eax, [rbp+var_C] cmp eax, [rbp+var_2C] jl short loc_1246 mov rax, [rbp+ptr] mov rdi, rax; ptr call _free mov eax, [rbp+var_10] leave retn
long long func0(long long a1, int a2) { int v2; // eax int i; // [rsp+1Ch] [rbp-14h] unsigned int v5; // [rsp+20h] [rbp-10h] int j; // [rsp+24h] [rbp-Ch] unsigned int *ptr; // [rsp+28h] [rbp-8h] ptr = (unsigned int *)malloc(4LL * a2); for ( i = 0; i < a2; ++i ) { v2 = *(_DWORD *)(8LL * i + a1 + 4) - *(_DWORD *)(8LL * i + a1); if ( *(_DWORD *)(8LL * i + a1) - *(_DWORD *)(8LL * i + a1 + 4) >= 0 ) v2 = *(_DWORD *)(8LL * i + a1) - *(_DWORD *)(8LL * i + a1 + 4); ptr[i] = v2; } v5 = *ptr; for ( j = 1; j < a2; ++j ) { if ( (int)v5 > (int)ptr[j] ) v5 = ptr[j]; } free(ptr); return v5; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x2c],ESI MOV EAX,dword ptr [RBP + -0x2c] CDQE SHL RAX,0x2 MOV RDI,RAX CALL 0x001010b0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0x14],0x0 JMP 0x0010122c LAB_001011da: MOV EAX,dword ptr [RBP + -0x14] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EAX,dword ptr [RAX + 0x4] MOV EDX,dword ptr [RBP + -0x14] MOVSXD RDX,EDX LEA RCX,[RDX*0x8] MOV RDX,qword ptr [RBP + -0x28] ADD RDX,RCX MOV EDX,dword ptr [RDX] SUB EAX,EDX MOV EDX,dword ptr [RBP + -0x14] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x8] ADD RDX,RCX MOV ECX,EAX NEG ECX CMOVNS EAX,ECX MOV dword ptr [RDX],EAX ADD dword ptr [RBP + -0x14],0x1 LAB_0010122c: MOV EAX,dword ptr [RBP + -0x14] CMP EAX,dword ptr [RBP + -0x2c] JL 0x001011da MOV RAX,qword ptr [RBP + -0x8] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x10],EAX MOV dword ptr [RBP + -0xc],0x1 JMP 0x0010127e LAB_00101246: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RAX,RDX MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x10],EAX JLE 0x0010127a MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x10],EAX LAB_0010127a: ADD dword ptr [RBP + -0xc],0x1 LAB_0010127e: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x2c] JL 0x00101246 MOV RAX,qword ptr [RBP + -0x8] MOV RDI,RAX CALL 0x00101080 MOV EAX,dword ptr [RBP + -0x10] LEAVE RET
int func0(long param_1,int param_2) { int iVar1; int *__ptr; int local_1c; int local_18; int local_14; __ptr = (int *)malloc((long)param_2 << 2); for (local_1c = 0; local_1c < param_2; local_1c = local_1c + 1) { iVar1 = *(int *)(param_1 + (long)local_1c * 8 + 4) - *(int *)(param_1 + (long)local_1c * 8); if (iVar1 < 1) { iVar1 = -iVar1; } __ptr[local_1c] = iVar1; } local_18 = *__ptr; for (local_14 = 1; local_14 < param_2; local_14 = local_14 + 1) { if (__ptr[local_14] < local_18) { local_18 = __ptr[local_14]; } } free(__ptr); return local_18; }
7,393
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
int func0(int test_list[][2], int len) { int* temp = (int*)malloc(sizeof(int) * len); for (int i = 0; i < len; i++) { temp[i] = abs(test_list[i][1] - test_list[i][0]); } int res = temp[0]; for (int i = 1; i < len; i++) { if (temp[i] < res) { res = temp[i]; } } free(temp); return res; }
int main() { int arr1[][2] = {{3, 5}, {1, 7}, {10, 3}, {1, 2}}; int arr2[][2] = {{4, 6}, {12, 8}, {11, 4}, {2, 13}}; int arr3[][2] = {{5, 17}, {3, 9}, {12, 5}, {3, 24}}; assert(func0(arr1, 4) == 1); assert(func0(arr2, 4) == 2); assert(func0(arr3, 4) == 6); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbp mov %esi,%ebx movslq %esi,%rdi shl $0x2,%rdi callq 10b0 <malloc@plt> mov %rax,%rdi test %ebx,%ebx jle 11f4 <func0+0x4b> lea -0x1(%rbx),%esi mov $0x0,%edx mov 0x4(%rbp,%rdx,8),%ecx sub 0x0(%rbp,%rdx,8),%ecx mov %ecx,%eax sar $0x1f,%eax xor %eax,%ecx mov %ecx,(%rdi,%rdx,4) sub %eax,(%rdi,%rdx,4) mov %rdx,%rax add $0x1,%rdx cmp %rsi,%rax jne 11d3 <func0+0x2a> mov (%rdi),%ebp cmp $0x1,%ebx jle 1217 <func0+0x6e> lea 0x4(%rdi),%rdx lea -0x2(%rbx),%eax lea 0x8(%rdi,%rax,4),%rcx mov (%rdx),%eax cmp %eax,%ebp cmovg %eax,%ebp add $0x4,%rdx cmp %rcx,%rdx jne 1207 <func0+0x5e> callq 1080 <free@plt> mov %ebp,%eax add $0x8,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp push rbx sub rsp, 8 mov rbp, rdi mov ebx, esi movsxd rdi, esi shl rdi, 2 call _malloc mov rdi, rax test ebx, ebx jle short loc_11ED mov eax, ebx mov edx, 0 loc_11D2: mov ecx, [rbp+rdx*8+4] sub ecx, [rbp+rdx*8+0] mov esi, ecx neg esi cmovns ecx, esi mov [rdi+rdx*4], ecx add rdx, 1 cmp rdx, rax jnz short loc_11D2 loc_11ED: mov ebp, [rdi] cmp ebx, 1 jle short loc_1210 lea rdx, [rdi+4] lea eax, [rbx-2] lea rax, [rdi+rax*4+8] loc_1200: mov ecx, [rdx] cmp ebp, ecx cmovg ebp, ecx add rdx, 4 cmp rdx, rax jnz short loc_1200 loc_1210: call _free mov eax, ebp add rsp, 8 pop rbx pop rbp retn
long long func0(long long a1, int a2) { unsigned int *v3; // rdi long long i; // rdx int v5; // ecx unsigned int v6; // ebp unsigned int *v7; // rdx v3 = (unsigned int *)malloc(4LL * a2); if ( a2 > 0 ) { for ( i = 0LL; i != a2; v3[i++] = v5 ) { v5 = *(_DWORD *)(a1 + 8 * i + 4) - *(_DWORD *)(a1 + 8 * i); if ( *(_DWORD *)(a1 + 8 * i) - *(_DWORD *)(a1 + 8 * i + 4) >= 0 ) v5 = *(_DWORD *)(a1 + 8 * i) - *(_DWORD *)(a1 + 8 * i + 4); } } v6 = *v3; if ( a2 > 1 ) { v7 = v3 + 1; do { if ( (int)v6 > (int)*v7 ) v6 = *v7; ++v7; } while ( v7 != &v3[a2 - 2 + 2] ); } free(); return v6; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBP,RDI MOV EBX,ESI MOVSXD RDI,ESI SHL RDI,0x2 CALL 0x001010b0 MOV RDI,RAX TEST EBX,EBX JLE 0x001011ed MOV EAX,EBX MOV EDX,0x0 LAB_001011d2: MOV ECX,dword ptr [RBP + RDX*0x8 + 0x4] SUB ECX,dword ptr [RBP + RDX*0x8] MOV ESI,ECX NEG ESI CMOVNS ECX,ESI MOV dword ptr [RDI + RDX*0x4],ECX ADD RDX,0x1 CMP RDX,RAX JNZ 0x001011d2 LAB_001011ed: MOV EBP,dword ptr [RDI] CMP EBX,0x1 JLE 0x00101210 LEA RDX,[RDI + 0x4] LEA EAX,[RBX + -0x2] LEA RAX,[RDI + RAX*0x4 + 0x8] LAB_00101200: MOV ECX,dword ptr [RDX] CMP EBP,ECX CMOVG EBP,ECX ADD RDX,0x4 CMP RDX,RAX JNZ 0x00101200 LAB_00101210: CALL 0x00101080 MOV EAX,EBP ADD RSP,0x8 POP RBX POP RBP RET
int func0(long param_1,uint param_2) { int *__ptr; int iVar1; ulong uVar2; int *piVar3; __ptr = (int *)malloc((long)(int)param_2 << 2); if (0 < (int)param_2) { uVar2 = 0; do { iVar1 = *(int *)(param_1 + 4 + uVar2 * 8) - *(int *)(param_1 + uVar2 * 8); if (iVar1 < 1) { iVar1 = -iVar1; } __ptr[uVar2] = iVar1; uVar2 = uVar2 + 1; } while (uVar2 != param_2); } iVar1 = *__ptr; if (1 < (int)param_2) { piVar3 = __ptr + 1; do { if (*piVar3 < iVar1) { iVar1 = *piVar3; } piVar3 = piVar3 + 1; } while (piVar3 != __ptr + (ulong)(param_2 - 2) + 2); } free(__ptr); return iVar1; }
7,394
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
int func0(int test_list[][2], int len) { int* temp = (int*)malloc(sizeof(int) * len); for (int i = 0; i < len; i++) { temp[i] = abs(test_list[i][1] - test_list[i][0]); } int res = temp[0]; for (int i = 1; i < len; i++) { if (temp[i] < res) { res = temp[i]; } } free(temp); return res; }
int main() { int arr1[][2] = {{3, 5}, {1, 7}, {10, 3}, {1, 2}}; int arr2[][2] = {{4, 6}, {12, 8}, {11, 4}, {2, 13}}; int arr3[][2] = {{5, 17}, {3, 9}, {12, 5}, {3, 24}}; assert(func0(arr1, 4) == 1); assert(func0(arr2, 4) == 2); assert(func0(arr3, 4) == 6); return 0; }
O2
c
func0: endbr64 push %r12 mov %rdi,%r12 movslq %esi,%rdi push %rbx mov %rdi,%rbx shl $0x2,%rdi sub $0x8,%rsp callq 10b0 <malloc@plt> mov %rax,%rdi test %ebx,%ebx jle 13c8 <func0+0x98> lea -0x1(%rbx),%r8d xor %edx,%edx nopw 0x0(%rax,%rax,1) mov 0x4(%r12,%rdx,8),%ecx sub (%r12,%rdx,8),%ecx mov %ecx,%eax sar $0x1f,%eax xor %eax,%ecx mov %ecx,(%rdi,%rdx,4) sub %eax,(%rdi,%rdx,4) mov %rdx,%rax add $0x1,%rdx cmp %r8,%rax jne 1360 <func0+0x30> mov (%rdi),%r12d cmp $0x1,%ebx jle 13b2 <func0+0x82> lea -0x2(%rbx),%eax lea 0x4(%rdi),%rdx lea 0x8(%rdi,%rax,4),%rcx nopw %cs:0x0(%rax,%rax,1) mov (%rdx),%eax cmp %eax,%r12d cmovg %eax,%r12d add $0x4,%rdx cmp %rdx,%rcx jne 13a0 <func0+0x70> callq 1080 <free@plt> add $0x8,%rsp mov %r12d,%eax pop %rbx pop %r12 retq nopw 0x0(%rax,%rax,1) mov (%rax),%r12d callq 1080 <free@plt> add $0x8,%rsp mov %r12d,%eax pop %rbx pop %r12 retq nopl 0x0(%rax,%rax,1)
func0: endbr64 push r12 mov r12, rdi push rbp push rbx movsxd rbx, esi lea rdi, ds:0[rbx*4] call _malloc mov rdi, rax test ebx, ebx jle short loc_13C0 mov rbp, rbx xor edx, edx nop word ptr [rax+rax+00000000h] loc_1360: mov ecx, [r12+rdx*8+4] sub ecx, [r12+rdx*8] mov r8d, ecx neg r8d cmovns ecx, r8d mov [rdi+rdx*4], ecx add rdx, 1 cmp rdx, rbx jnz short loc_1360 mov r12d, [rdi] cmp ebp, 1 jle short loc_13AA lea eax, [rbp-2] lea rdx, [rdi+4] lea rax, [rdi+rax*4+8] nop dword ptr [rax+rax+00h] loc_1398: mov ecx, [rdx] cmp r12d, ecx cmovg r12d, ecx add rdx, 4 cmp rax, rdx jnz short loc_1398 loc_13AA: call _free mov eax, r12d pop rbx pop rbp pop r12 retn loc_13C0: mov r12d, [rax] call _free pop rbx pop rbp mov eax, r12d pop r12 retn
long long func0(long long a1, int a2) { _DWORD *v3; // rax _DWORD *v4; // rdi long long i; // rdx int v6; // ecx unsigned int v7; // r12d unsigned int *v8; // rdx long long v9; // rax unsigned int v11; // r12d v3 = (_DWORD *)malloc(4LL * a2); v4 = v3; if ( a2 <= 0 ) { v11 = *v3; free(v3); return v11; } else { for ( i = 0LL; i != a2; v3[i++] = v6 ) { v6 = *(_DWORD *)(a1 + 8 * i + 4) - *(_DWORD *)(a1 + 8 * i); if ( *(_DWORD *)(a1 + 8 * i) - *(_DWORD *)(a1 + 8 * i + 4) >= 0 ) v6 = *(_DWORD *)(a1 + 8 * i) - *(_DWORD *)(a1 + 8 * i + 4); } v7 = *v3; if ( a2 > 1 ) { v8 = v3 + 1; v9 = (long long)&v3[a2 - 2 + 2]; do { if ( (int)v7 > (int)*v8 ) v7 = *v8; ++v8; } while ( (unsigned int *)v9 != v8 ); } free(v4); return v7; } }
func0: ENDBR64 PUSH R12 MOV R12,RDI PUSH RBP PUSH RBX MOVSXD RBX,ESI LEA RDI,[RBX*0x4] CALL 0x001010b0 MOV RDI,RAX TEST EBX,EBX JLE 0x001013c0 MOV RBP,RBX XOR EDX,EDX NOP word ptr [RAX + RAX*0x1] LAB_00101360: MOV ECX,dword ptr [R12 + RDX*0x8 + 0x4] SUB ECX,dword ptr [R12 + RDX*0x8] MOV R8D,ECX NEG R8D CMOVNS ECX,R8D MOV dword ptr [RDI + RDX*0x4],ECX ADD RDX,0x1 CMP RDX,RBX JNZ 0x00101360 MOV R12D,dword ptr [RDI] CMP EBP,0x1 JLE 0x001013aa LEA EAX,[RBP + -0x2] LEA RDX,[RDI + 0x4] LEA RAX,[RDI + RAX*0x4 + 0x8] NOP dword ptr [RAX + RAX*0x1] LAB_00101398: MOV ECX,dword ptr [RDX] CMP R12D,ECX CMOVG R12D,ECX ADD RDX,0x4 CMP RAX,RDX JNZ 0x00101398 LAB_001013aa: CALL 0x00101080 MOV EAX,R12D POP RBX POP RBP POP R12 RET LAB_001013c0: MOV R12D,dword ptr [RAX] CALL 0x00101080 POP RBX POP RBP MOV EAX,R12D POP R12 RET
int func0(long param_1,int param_2) { int *__ptr; int iVar1; long lVar2; int *piVar3; __ptr = (int *)malloc((long)param_2 * 4); if (0 < param_2) { lVar2 = 0; do { iVar1 = *(int *)(param_1 + 4 + lVar2 * 8) - *(int *)(param_1 + lVar2 * 8); if (iVar1 < 1) { iVar1 = -iVar1; } __ptr[lVar2] = iVar1; lVar2 = lVar2 + 1; } while (lVar2 != param_2); iVar1 = *__ptr; if (1 < param_2) { piVar3 = __ptr + 1; do { if (*piVar3 < iVar1) { iVar1 = *piVar3; } piVar3 = piVar3 + 1; } while (__ptr + (ulong)(param_2 - 2) + 2 != piVar3); } free(__ptr); return iVar1; } iVar1 = *__ptr; free(__ptr); return iVar1; }
7,395
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
int func0(int test_list[][2], int len) { int* temp = (int*)malloc(sizeof(int) * len); for (int i = 0; i < len; i++) { temp[i] = abs(test_list[i][1] - test_list[i][0]); } int res = temp[0]; for (int i = 1; i < len; i++) { if (temp[i] < res) { res = temp[i]; } } free(temp); return res; }
int main() { int arr1[][2] = {{3, 5}, {1, 7}, {10, 3}, {1, 2}}; int arr2[][2] = {{4, 6}, {12, 8}, {11, 4}, {2, 13}}; int arr3[][2] = {{5, 17}, {3, 9}, {12, 5}, {3, 24}}; assert(func0(arr1, 4) == 1); assert(func0(arr2, 4) == 2); assert(func0(arr3, 4) == 6); return 0; }
O3
c
func0: endbr64 push %r12 mov %rdi,%r12 movslq %esi,%rdi push %rbx mov %rdi,%rbx shl $0x2,%rdi sub $0x8,%rsp callq 10b0 <malloc@plt> mov %rax,%rdi test %ebx,%ebx jle 14a0 <func0+0x1d0> lea -0x1(%rbx),%ecx cmp $0x2,%ecx jbe 14b3 <func0+0x1e3> mov %ebx,%eax xor %edx,%edx shr $0x2,%eax shl $0x4,%rax movdqu (%r12,%rdx,2),%xmm1 movdqu 0x10(%r12,%rdx,2),%xmm3 movdqa %xmm1,%xmm0 shufps $0x88,%xmm3,%xmm1 shufps $0xdd,%xmm3,%xmm0 psubd %xmm1,%xmm0 movdqa %xmm0,%xmm1 psrad $0x1f,%xmm1 pxor %xmm1,%xmm0 psubd %xmm1,%xmm0 movups %xmm0,(%rdi,%rdx,1) add $0x10,%rdx cmp %rax,%rdx jne 1310 <func0+0x40> mov %ebx,%eax and $0xfffffffc,%eax test $0x3,%bl je 13b9 <func0+0xe9> movslq %eax,%rsi mov 0x4(%r12,%rsi,8),%edx sub (%r12,%rsi,8),%edx mov %edx,%r8d sar $0x1f,%r8d xor %r8d,%edx mov %edx,(%rdi,%rsi,4) lea 0x1(%rax),%edx sub %r8d,(%rdi,%rsi,4) cmp %edx,%ebx jle 14c1 <func0+0x1f1> movslq %edx,%rdx add $0x2,%eax mov 0x4(%r12,%rdx,8),%esi sub (%r12,%rdx,8),%esi mov %esi,%r8d sar $0x1f,%r8d xor %r8d,%esi mov %esi,(%rdi,%rdx,4) sub %r8d,(%rdi,%rdx,4) cmp %eax,%ebx jle 13b9 <func0+0xe9> cltq mov 0x4(%r12,%rax,8),%edx sub (%r12,%rax,8),%edx mov %edx,%esi sar $0x1f,%esi xor %esi,%edx mov %edx,(%rdi,%rax,4) sub %esi,(%rdi,%rax,4) mov (%rdi),%r12d lea -0x2(%rbx),%eax cmp $0x2,%eax jbe 14ba <func0+0x1ea> mov %ecx,%eax movd %r12d,%xmm6 mov %rdi,%rdx shr $0x2,%eax pshufd $0x0,%xmm6,%xmm0 shl $0x4,%rax add %rdi,%rax nopl 0x0(%rax) movdqu 0x4(%rdx),%xmm1 movdqu 0x4(%rdx),%xmm5 add $0x10,%rdx pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm0 pandn %xmm5,%xmm1 por %xmm1,%xmm0 cmp %rax,%rdx jne 13e8 <func0+0x118> movdqa %xmm0,%xmm2 mov %ecx,%edx psrldq $0x8,%xmm2 and $0xfffffffc,%edx movdqa %xmm2,%xmm1 lea 0x1(%rdx),%eax 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,%r12d cmp %ecx,%edx je 148a <func0+0x1ba> movslq %eax,%rdx mov (%rdi,%rdx,4),%edx cmp %edx,%r12d cmovg %edx,%r12d lea 0x1(%rax),%edx cmp %ebx,%edx jge 148a <func0+0x1ba> movslq %edx,%rdx mov (%rdi,%rdx,4),%edx cmp %edx,%r12d cmovg %edx,%r12d add $0x2,%eax cmp %ebx,%eax jge 148a <func0+0x1ba> cltq mov (%rdi,%rax,4),%eax cmp %eax,%r12d cmovg %eax,%r12d callq 1080 <free@plt> add $0x8,%rsp mov %r12d,%eax pop %rbx pop %r12 retq nopw 0x0(%rax,%rax,1) mov (%rax),%r12d callq 1080 <free@plt> add $0x8,%rsp mov %r12d,%eax pop %rbx pop %r12 retq xor %eax,%eax jmpq 1355 <func0+0x85> mov $0x1,%eax jmp 1456 <func0+0x186> mov (%rdi),%r12d cmp $0x1,%ebx jg 13bc <func0+0xec> jmp 148a <func0+0x1ba>
func0: endbr64 push rbp push rbx mov rbx, rdi movsxd rdi, esi mov rbp, rdi shl rdi, 2; size sub rsp, 8 call _malloc mov rdi, rax; ptr test ebp, ebp jle loc_14A0 lea ecx, [rbp-1] cmp ecx, 2 jbe loc_14B0 mov edx, ebp xor eax, eax shr edx, 2 shl rdx, 4 xchg ax, ax loc_1310: movdqu xmm1, xmmword ptr [rbx+rax*2] movdqu xmm3, xmmword ptr [rbx+rax*2+10h] movdqa xmm0, xmm1 shufps xmm1, xmm3, 88h shufps xmm0, xmm3, 0DDh psubd xmm0, xmm1 movdqa xmm1, xmm0 psrad xmm1, 1Fh pxor xmm0, xmm1 psubd xmm0, xmm1 movups xmmword ptr [rdi+rax], xmm0 add rax, 10h cmp rdx, rax jnz short loc_1310 mov edx, ebp and edx, 0FFFFFFFCh test bpl, 3 jz short loc_13BD loc_1354: movsxd rsi, edx lea r10, ds:0[rsi*8] lea r8, ds:0[rsi*4] lea r9, [rbx+r10] mov eax, [r9+4] sub eax, [r9] mov r9d, eax neg r9d cmovns eax, r9d mov [rdi+rsi*4], eax lea eax, [rdx+1] cmp ebp, eax jle loc_14BE lea rsi, [rbx+r10+8] mov eax, [rsi+4] sub eax, [rsi] mov esi, eax neg esi cmovns eax, esi add edx, 2 mov [rdi+r8+4], eax cmp ebp, edx jle short loc_13BD lea rdx, [rbx+r10+10h] mov eax, [rdx+4] sub eax, [rdx] mov edx, eax neg edx cmovns eax, edx mov [rdi+r8+8], eax loc_13BD: mov ebx, [rdi] loc_13BF: lea eax, [rbp-2] cmp eax, 2 jbe loc_14B7 mov edx, ecx movd xmm6, ebx mov rax, rdi shr edx, 2 pshufd xmm0, xmm6, 0 shl rdx, 4 add rdx, rdi nop dword ptr [rax+rax+00h] loc_13E8: movdqu xmm1, xmmword ptr [rax+4] movdqu xmm5, xmmword ptr [rax+4] add rax, 10h pcmpgtd xmm1, xmm0 pand xmm0, xmm1 pandn xmm1, xmm5 por xmm0, xmm1 cmp rax, rdx jnz short loc_13E8 movdqa xmm2, xmm0 mov eax, ecx psrldq xmm2, 8 and eax, 0FFFFFFFCh movdqa xmm1, xmm2 add eax, 1 and ecx, 3 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 ebx, xmm1 jz short loc_1489 loc_1456: movsxd rdx, eax lea rcx, ds:0[rdx*4] mov edx, [rdi+rdx*4] cmp ebx, edx cmovg ebx, edx lea edx, [rax+1] cmp edx, ebp jge short loc_1489 mov edx, [rdi+rcx+4] cmp ebx, edx cmovg ebx, edx add eax, 2 cmp eax, ebp jge short loc_1489 mov eax, [rdi+rcx+8] cmp ebx, eax cmovg ebx, eax loc_1489: call _free add rsp, 8 mov eax, ebx pop rbx pop rbp retn loc_14A0: mov ebx, [rax] call _free add rsp, 8 mov eax, ebx pop rbx pop rbp retn loc_14B0: xor edx, edx jmp loc_1354 loc_14B7: mov eax, 1 jmp short loc_1456 loc_14BE: mov ebx, [rdi] cmp ebp, 1 jnz loc_13BF jmp short loc_1489
long long func0(long long a1, int a2) { signed int *v3; // rax signed int *v4; // rdi unsigned int v5; // ecx unsigned long long v6; // rax __m128 v7; // xmm3 __m128 v8; // xmm0 __m128i v9; // xmm0 __m128i v10; // xmm1 int v11; // edx long long v12; // r10 long long v13; // r8 int v14; // eax int v15; // eax int v16; // eax signed int v17; // ebx signed int *v18; // rax __m128i v19; // xmm0 __m128i v20; // xmm1 __m128i v21; // xmm5 __m128i v22; // xmm1 __m128i v23; // xmm2 signed int v24; // eax __m128i v25; // xmm1 __m128i v26; // xmm0 __m128i v27; // xmm2 __m128i v28; // xmm1 long long v29; // rcx unsigned int v31; // ebx v3 = (signed int *)malloc(4LL * a2); v4 = v3; if ( a2 > 0 ) { v5 = a2 - 1; if ( (unsigned int)(a2 - 1) <= 2 ) { v11 = 0; } else { v6 = 0LL; do { v7 = (__m128)_mm_loadu_si128((const __m128i *)(a1 + 2 * v6 + 16)); v8 = (__m128)_mm_loadu_si128((const __m128i *)(a1 + 2 * v6)); v9 = _mm_sub_epi32((__m128i)_mm_shuffle_ps(v8, v7, 221), (__m128i)_mm_shuffle_ps(v8, v7, 136)); v10 = _mm_srai_epi32(v9, 0x1Fu); *(__m128i *)&v4[v6 / 4] = _mm_sub_epi32(_mm_xor_si128(v9, v10), v10); v6 += 16LL; } while ( 16LL * ((unsigned int)a2 >> 2) != v6 ); v11 = a2 & 0x7FFFFFFC; if ( (a2 & 3) == 0 ) goto LABEL_15; } v12 = 8LL * v11; v13 = v11; v14 = *(_DWORD *)(a1 + v12 + 4) - *(_DWORD *)(a1 + v12); if ( *(_DWORD *)(a1 + v12) - *(_DWORD *)(a1 + v12 + 4) >= 0 ) v14 = *(_DWORD *)(a1 + 8LL * v11) - *(_DWORD *)(a1 + 8LL * v11 + 4); v4[v11] = v14; if ( a2 <= v11 + 1 ) { v17 = *v4; if ( a2 == 1 ) goto LABEL_28; goto LABEL_16; } v15 = *(_DWORD *)(a1 + v12 + 12) - *(_DWORD *)(a1 + v12 + 8); if ( *(_DWORD *)(a1 + v12 + 8) - *(_DWORD *)(a1 + v12 + 12) >= 0 ) v15 = *(_DWORD *)(a1 + v12 + 8) - *(_DWORD *)(a1 + v12 + 12); v4[v13 + 1] = v15; if ( a2 > v11 + 2 ) { v16 = *(_DWORD *)(a1 + v12 + 20) - *(_DWORD *)(a1 + v12 + 16); if ( *(_DWORD *)(a1 + v12 + 16) - *(_DWORD *)(a1 + v12 + 20) >= 0 ) v16 = *(_DWORD *)(a1 + v12 + 16) - *(_DWORD *)(a1 + v12 + 20); v4[v13 + 2] = v16; } LABEL_15: v17 = *v4; LABEL_16: if ( (unsigned int)(a2 - 2) <= 2 ) { v24 = 1; LABEL_20: v29 = v24; if ( v17 > v4[v29] ) v17 = v4[v24]; if ( v24 + 1 < a2 ) { if ( v17 > v4[v29 + 1] ) v17 = v4[v29 + 1]; if ( v24 + 2 < a2 && v17 > v4[v29 + 2] ) v17 = v4[v29 + 2]; } goto LABEL_28; } v18 = v4; v19 = _mm_shuffle_epi32(_mm_cvtsi32_si128(v17), 0); do { v20 = _mm_loadu_si128((const __m128i *)(v18 + 1)); v21 = v20; v18 += 4; v22 = _mm_cmpgt_epi32(v20, v19); v19 = _mm_or_si128(_mm_and_si128(v19, v22), _mm_andnot_si128(v22, v21)); } while ( v18 != &v4[4 * (v5 >> 2)] ); v23 = _mm_srli_si128(v19, 8); v24 = (v5 & 0xFFFFFFFC) + 1; v25 = _mm_cmpgt_epi32(v23, v19); v26 = _mm_or_si128(_mm_and_si128(v19, v25), _mm_andnot_si128(v25, v23)); v27 = _mm_srli_si128(v26, 4); v28 = _mm_cmpgt_epi32(v27, v26); v17 = _mm_cvtsi128_si32(_mm_or_si128(_mm_andnot_si128(v28, v27), _mm_and_si128(v26, v28))); if ( (v5 & 3) != 0 ) goto LABEL_20; LABEL_28: free(v4); return (unsigned int)v17; } v31 = *v3; free(v3); return v31; }
func0: ENDBR64 PUSH RBP PUSH RBX MOV RBX,RDI MOVSXD RDI,ESI MOV RBP,RDI SHL RDI,0x2 SUB RSP,0x8 CALL 0x001010b0 MOV RDI,RAX TEST EBP,EBP JLE 0x001014a0 LEA ECX,[RBP + -0x1] CMP ECX,0x2 JBE 0x001014b0 MOV EDX,EBP XOR EAX,EAX SHR EDX,0x2 SHL RDX,0x4 NOP LAB_00101310: MOVDQU XMM1,xmmword ptr [RBX + RAX*0x2] MOVDQU XMM3,xmmword ptr [RBX + RAX*0x2 + 0x10] MOVDQA XMM0,XMM1 SHUFPS XMM1,XMM3,0x88 SHUFPS XMM0,XMM3,0xdd PSUBD XMM0,XMM1 MOVDQA XMM1,XMM0 PSRAD XMM1,0x1f PXOR XMM0,XMM1 PSUBD XMM0,XMM1 MOVUPS xmmword ptr [RDI + RAX*0x1],XMM0 ADD RAX,0x10 CMP RDX,RAX JNZ 0x00101310 MOV EDX,EBP AND EDX,0xfffffffc TEST BPL,0x3 JZ 0x001013bd LAB_00101354: MOVSXD RSI,EDX LEA R10,[RSI*0x8] LEA R8,[RSI*0x4] LEA R9,[RBX + R10*0x1] MOV EAX,dword ptr [R9 + 0x4] SUB EAX,dword ptr [R9] MOV R9D,EAX NEG R9D CMOVNS EAX,R9D MOV dword ptr [RDI + RSI*0x4],EAX LEA EAX,[RDX + 0x1] CMP EBP,EAX JLE 0x001014be LEA RSI,[RBX + R10*0x1 + 0x8] MOV EAX,dword ptr [RSI + 0x4] SUB EAX,dword ptr [RSI] MOV ESI,EAX NEG ESI CMOVNS EAX,ESI ADD EDX,0x2 MOV dword ptr [RDI + R8*0x1 + 0x4],EAX CMP EBP,EDX JLE 0x001013bd LEA RDX,[RBX + R10*0x1 + 0x10] MOV EAX,dword ptr [RDX + 0x4] SUB EAX,dword ptr [RDX] MOV EDX,EAX NEG EDX CMOVNS EAX,EDX MOV dword ptr [RDI + R8*0x1 + 0x8],EAX LAB_001013bd: MOV EBX,dword ptr [RDI] LAB_001013bf: LEA EAX,[RBP + -0x2] CMP EAX,0x2 JBE 0x001014b7 MOV EDX,ECX MOVD XMM6,EBX MOV RAX,RDI SHR EDX,0x2 PSHUFD XMM0,XMM6,0x0 SHL RDX,0x4 ADD RDX,RDI NOP dword ptr [RAX + RAX*0x1] LAB_001013e8: MOVDQU XMM1,xmmword ptr [RAX + 0x4] MOVDQU XMM5,xmmword ptr [RAX + 0x4] ADD RAX,0x10 PCMPGTD XMM1,XMM0 PAND XMM0,XMM1 PANDN XMM1,XMM5 POR XMM0,XMM1 CMP RAX,RDX JNZ 0x001013e8 MOVDQA XMM2,XMM0 MOV EAX,ECX PSRLDQ XMM2,0x8 AND EAX,0xfffffffc MOVDQA XMM1,XMM2 ADD EAX,0x1 AND ECX,0x3 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 EBX,XMM1 JZ 0x00101489 LAB_00101456: MOVSXD RDX,EAX LEA RCX,[RDX*0x4] MOV EDX,dword ptr [RDI + RDX*0x4] CMP EBX,EDX CMOVG EBX,EDX LEA EDX,[RAX + 0x1] CMP EDX,EBP JGE 0x00101489 MOV EDX,dword ptr [RDI + RCX*0x1 + 0x4] CMP EBX,EDX CMOVG EBX,EDX ADD EAX,0x2 CMP EAX,EBP JGE 0x00101489 MOV EAX,dword ptr [RDI + RCX*0x1 + 0x8] CMP EBX,EAX CMOVG EBX,EAX LAB_00101489: CALL 0x00101080 ADD RSP,0x8 MOV EAX,EBX POP RBX POP RBP RET LAB_001014a0: MOV EBX,dword ptr [RAX] CALL 0x00101080 ADD RSP,0x8 MOV EAX,EBX POP RBX POP RBP RET LAB_001014b0: XOR EDX,EDX JMP 0x00101354 LAB_001014b7: MOV EAX,0x1 JMP 0x00101456 LAB_001014be: MOV EBX,dword ptr [RDI] CMP EBP,0x1 JNZ 0x001013bf JMP 0x00101489
uint func0(long param_1,uint param_2) { uint *puVar1; uint *puVar2; int *piVar3; int *piVar4; int iVar5; int iVar6; int iVar7; int iVar8; int iVar9; uint *puVar10; uint *puVar11; uint *puVar12; uint *puVar13; uint *puVar14; uint *puVar15; int iVar16; uint *__ptr; long lVar17; uint *puVar18; uint uVar19; long lVar20; uint uVar21; uint uVar22; uint uVar23; uint uVar24; __ptr = (uint *)malloc((long)(int)param_2 << 2); if ((int)param_2 < 1) { uVar19 = *__ptr; free(__ptr); return uVar19; } uVar19 = param_2 - 1; if (uVar19 < 3) { uVar21 = 0; LAB_00101354: lVar20 = (long)(int)uVar21; lVar17 = lVar20 * 8; uVar22 = ((int *)(param_1 + lVar17))[1] - *(int *)(param_1 + lVar17); if ((int)uVar22 < 1) { uVar22 = -uVar22; } __ptr[lVar20] = uVar22; if ((int)(uVar21 + 1) < (int)param_2) { piVar3 = (int *)(param_1 + 8 + lVar17); uVar22 = piVar3[1] - *piVar3; if ((int)uVar22 < 1) { uVar22 = -uVar22; } __ptr[lVar20 + 1] = uVar22; if ((int)(uVar21 + 2) < (int)param_2) { piVar3 = (int *)(param_1 + 0x10 + lVar17); uVar21 = piVar3[1] - *piVar3; if ((int)uVar21 < 1) { uVar21 = -uVar21; } __ptr[lVar20 + 2] = uVar21; } goto LAB_001013bd; } uVar21 = *__ptr; if (param_2 == 1) goto LAB_00101489; } else { lVar17 = 0; do { piVar3 = (int *)(param_1 + lVar17 * 2); iVar16 = piVar3[2]; iVar5 = piVar3[3]; piVar4 = (int *)(param_1 + 0x10 + lVar17 * 2); iVar6 = *piVar4; iVar7 = piVar4[1]; iVar8 = piVar4[2]; iVar9 = piVar4[3]; uVar21 = piVar3[1] - *piVar3 >> 0x1f; uVar22 = iVar5 - iVar16 >> 0x1f; uVar23 = iVar7 - iVar6 >> 0x1f; uVar24 = iVar9 - iVar8 >> 0x1f; piVar4 = (int *)((long)__ptr + lVar17); *piVar4 = (piVar3[1] - *piVar3 ^ uVar21) - uVar21; piVar4[1] = (iVar5 - iVar16 ^ uVar22) - uVar22; piVar4[2] = (iVar7 - iVar6 ^ uVar23) - uVar23; piVar4[3] = (iVar9 - iVar8 ^ uVar24) - uVar24; lVar17 = lVar17 + 0x10; } while ((ulong)(param_2 >> 2) << 4 != lVar17); uVar21 = param_2 & 0xfffffffc; if (((long)(int)param_2 & 3U) != 0) goto LAB_00101354; LAB_001013bd: uVar21 = *__ptr; } if (param_2 - 2 < 3) { iVar16 = 1; } else { puVar18 = __ptr; uVar22 = uVar21; uVar23 = uVar21; uVar24 = uVar21; do { puVar1 = puVar18 + 1; puVar10 = puVar18 + 2; puVar11 = puVar18 + 3; puVar12 = puVar18 + 4; puVar2 = puVar18 + 1; puVar13 = puVar18 + 2; puVar14 = puVar18 + 3; puVar15 = puVar18 + 4; puVar18 = puVar18 + 4; uVar21 = uVar21 & -(uint)((int)uVar21 < (int)*puVar1) | ~-(uint)((int)uVar21 < (int)*puVar1) & *puVar2; uVar22 = uVar22 & -(uint)((int)uVar22 < (int)*puVar10) | ~-(uint)((int)uVar22 < (int)*puVar10) & *puVar13; uVar23 = uVar23 & -(uint)((int)uVar23 < (int)*puVar11) | ~-(uint)((int)uVar23 < (int)*puVar11) & *puVar14; uVar24 = uVar24 & -(uint)((int)uVar24 < (int)*puVar12) | ~-(uint)((int)uVar24 < (int)*puVar12) & *puVar15; } while (puVar18 != __ptr + (ulong)(uVar19 >> 2) * 4); iVar16 = (uVar19 & 0xfffffffc) + 1; uVar21 = uVar21 & -(uint)((int)uVar21 < (int)uVar23) | ~-(uint)((int)uVar21 < (int)uVar23) & uVar23; uVar22 = uVar22 & -(uint)((int)uVar22 < (int)uVar24) | ~-(uint)((int)uVar22 < (int)uVar24) & uVar24; uVar23 = -(uint)((int)uVar21 < (int)uVar22); uVar21 = ~uVar23 & uVar22 | uVar21 & uVar23; if ((uVar19 & 3) == 0) goto LAB_00101489; } if ((int)__ptr[iVar16] < (int)uVar21) { uVar21 = __ptr[iVar16]; } if (iVar16 + 1 < (int)param_2) { if ((int)__ptr[(long)iVar16 + 1] < (int)uVar21) { uVar21 = __ptr[(long)iVar16 + 1]; } if ((iVar16 + 2 < (int)param_2) && ((int)__ptr[(long)iVar16 + 2] < (int)uVar21)) { uVar21 = __ptr[(long)iVar16 + 2]; } } LAB_00101489: free(__ptr); return uVar21; }
7,396
func0
#include <assert.h>
int func0(int x, int y) { int z; if (x > y) { z = x; } else { z = y; } while (1) { if ((z % x == 0) && (z % y == 0)) { return z; } z += 1; } }
int main() { assert(func0(4, 6) == 12); assert(func0(15, 17) == 255); assert(func0(2, 6) == 6); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) mov -0x14(%rbp),%eax cmp -0x18(%rbp),%eax jle 1167 <func0+0x1e> mov -0x14(%rbp),%eax mov %eax,-0x4(%rbp) jmp 116d <func0+0x24> mov -0x18(%rbp),%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax cltd idivl -0x14(%rbp) mov %edx,%eax test %eax,%eax jne 118c <func0+0x43> mov -0x4(%rbp),%eax cltd idivl -0x18(%rbp) mov %edx,%eax test %eax,%eax jne 118c <func0+0x43> mov -0x4(%rbp),%eax jmp 1192 <func0+0x49> addl $0x1,-0x4(%rbp) jmp 116d <func0+0x24> pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_18], esi mov eax, [rbp+var_14] cmp eax, [rbp+var_18] jle short loc_1167 mov eax, [rbp+var_14] mov [rbp+var_4], eax jmp short loc_116D loc_1167: mov eax, [rbp+var_18] mov [rbp+var_4], eax loc_116D: mov eax, [rbp+var_4] cdq idiv [rbp+var_14] mov eax, edx test eax, eax jnz short loc_118C mov eax, [rbp+var_4] cdq idiv [rbp+var_18] mov eax, edx test eax, eax jnz short loc_118C mov eax, [rbp+var_4] jmp short loc_1192 loc_118C: add [rbp+var_4], 1 jmp short loc_116D loc_1192: pop rbp retn
long long func0(signed int a1, signed int a2) { signed int v3; // [rsp+14h] [rbp-4h] if ( a1 <= a2 ) v3 = a2; else v3 = a1; while ( v3 % a1 || v3 % a2 ) ++v3; return (unsigned int)v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x18],ESI MOV EAX,dword ptr [RBP + -0x14] CMP EAX,dword ptr [RBP + -0x18] JLE 0x00101167 MOV EAX,dword ptr [RBP + -0x14] MOV dword ptr [RBP + -0x4],EAX JMP 0x0010116d LAB_00101167: MOV EAX,dword ptr [RBP + -0x18] MOV dword ptr [RBP + -0x4],EAX LAB_0010116d: MOV EAX,dword ptr [RBP + -0x4] CDQ IDIV dword ptr [RBP + -0x14] MOV EAX,EDX TEST EAX,EAX JNZ 0x0010118c MOV EAX,dword ptr [RBP + -0x4] CDQ IDIV dword ptr [RBP + -0x18] MOV EAX,EDX TEST EAX,EAX JNZ 0x0010118c MOV EAX,dword ptr [RBP + -0x4] JMP 0x00101192 LAB_0010118c: ADD dword ptr [RBP + -0x4],0x1 JMP 0x0010116d LAB_00101192: POP RBP RET
int func0(int param_1,int param_2) { int local_c; local_c = param_2; if (param_2 < param_1) { local_c = param_1; } for (; (local_c % param_1 != 0 || (local_c % param_2 != 0)); local_c = local_c + 1) { } return local_c; }
7,397
func0
#include <assert.h>
int func0(int x, int y) { int z; if (x > y) { z = x; } else { z = y; } while (1) { if ((z % x == 0) && (z % y == 0)) { return z; } z += 1; } }
int main() { assert(func0(4, 6) == 12); assert(func0(15, 17) == 255); assert(func0(2, 6) == 6); return 0; }
O1
c
func0: endbr64 cmp %esi,%edi mov %esi,%ecx cmovge %edi,%ecx jmp 1159 <func0+0x10> add $0x1,%ecx mov %ecx,%eax cltd idiv %edi test %edx,%edx jne 1156 <func0+0xd> mov %ecx,%eax cltd idiv %esi test %edx,%edx jne 1156 <func0+0xd> mov %ecx,%eax retq
func0: endbr64 cmp edi, esi mov ecx, esi cmovge ecx, edi jmp short loc_1159 loc_1156: add ecx, 1 loc_1159: mov eax, ecx cdq idiv edi test edx, edx jnz short loc_1156 mov eax, ecx cdq idiv esi test edx, edx jnz short loc_1156 mov eax, ecx retn
long long func0(signed int a1, signed int a2) { signed int v2; // ecx v2 = a2; if ( a1 >= a2 ) v2 = a1; while ( v2 % a1 || v2 % a2 ) ++v2; return (unsigned int)v2; }
func0: ENDBR64 CMP EDI,ESI MOV ECX,ESI CMOVGE ECX,EDI JMP 0x00101159 LAB_00101156: ADD ECX,0x1 LAB_00101159: MOV EAX,ECX CDQ IDIV EDI TEST EDX,EDX JNZ 0x00101156 MOV EAX,ECX CDQ IDIV ESI TEST EDX,EDX JNZ 0x00101156 MOV EAX,ECX RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = param_2; if (param_2 <= param_1) { iVar1 = param_1; } for (; (iVar1 % param_1 != 0 || (iVar1 % param_2 != 0)); iVar1 = iVar1 + 1) { } return iVar1; }
7,398
func0
#include <assert.h>
int func0(int x, int y) { int z; if (x > y) { z = x; } else { z = y; } while (1) { if ((z % x == 0) && (z % y == 0)) { return z; } z += 1; } }
int main() { assert(func0(4, 6) == 12); assert(func0(15, 17) == 255); assert(func0(2, 6) == 6); return 0; }
O2
c
func0: endbr64 cmp %esi,%edi mov %esi,%r8d cmovge %edi,%r8d jmp 1244 <func0+0x14> add $0x1,%r8d mov %r8d,%eax cltd idiv %edi test %edx,%edx jne 1240 <func0+0x10> mov %r8d,%eax cltd idiv %esi test %edx,%edx jne 1240 <func0+0x10> mov %r8d,%eax retq nopl 0x0(%rax)
func0: endbr64 cmp edi, esi mov r8d, esi cmovge r8d, edi jmp short loc_1214 loc_1210: add r8d, 1 loc_1214: mov eax, r8d cdq idiv edi test edx, edx jnz short loc_1210 mov eax, r8d cdq idiv esi test edx, edx jnz short loc_1210 mov eax, r8d retn
long long func0(signed int a1, signed int a2) { signed int v2; // r8d v2 = a2; if ( a1 >= a2 ) v2 = a1; while ( v2 % a1 || v2 % a2 ) ++v2; return (unsigned int)v2; }
func0: ENDBR64 CMP EDI,ESI MOV R8D,ESI CMOVGE R8D,EDI JMP 0x00101214 LAB_00101210: ADD R8D,0x1 LAB_00101214: MOV EAX,R8D CDQ IDIV EDI TEST EDX,EDX JNZ 0x00101210 MOV EAX,R8D CDQ IDIV ESI TEST EDX,EDX JNZ 0x00101210 MOV EAX,R8D RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = param_2; if (param_2 <= param_1) { iVar1 = param_1; } for (; (iVar1 % param_1 != 0 || (iVar1 % param_2 != 0)); iVar1 = iVar1 + 1) { } return iVar1; }
7,399
func0
#include <assert.h>
int func0(int x, int y) { int z; if (x > y) { z = x; } else { z = y; } while (1) { if ((z % x == 0) && (z % y == 0)) { return z; } z += 1; } }
int main() { assert(func0(4, 6) == 12); assert(func0(15, 17) == 255); assert(func0(2, 6) == 6); return 0; }
O3
c
func0: endbr64 cmp %esi,%edi mov %esi,%r8d cmovge %edi,%r8d jmp 1244 <func0+0x14> add $0x1,%r8d mov %r8d,%eax cltd idiv %edi test %edx,%edx jne 1240 <func0+0x10> mov %r8d,%eax cltd idiv %esi test %edx,%edx jne 1240 <func0+0x10> mov %r8d,%eax retq nopl 0x0(%rax)
func0: endbr64 cmp edi, esi mov ecx, esi cmovge ecx, edi jmp short loc_1233 loc_1230: add ecx, 1 loc_1233: mov eax, ecx cdq idiv edi test edx, edx jnz short loc_1230 mov eax, ecx cdq idiv esi test edx, edx jnz short loc_1230 mov eax, ecx retn
long long func0(signed int a1, signed int a2) { signed int v2; // ecx v2 = a2; if ( a1 >= a2 ) v2 = a1; while ( v2 % a1 || v2 % a2 ) ++v2; return (unsigned int)v2; }
func0: ENDBR64 CMP EDI,ESI MOV ECX,ESI CMOVGE ECX,EDI JMP 0x00101233 LAB_00101230: ADD ECX,0x1 LAB_00101233: MOV EAX,ECX CDQ IDIV EDI TEST EDX,EDX JNZ 0x00101230 MOV EAX,ECX CDQ IDIV ESI TEST EDX,EDX JNZ 0x00101230 MOV EAX,ECX RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = param_2; if (param_2 <= param_1) { iVar1 = param_1; } for (; (iVar1 % param_1 != 0 || (iVar1 % param_2 != 0)); iVar1 = iVar1 + 1) { } return iVar1; }
7,400
func0
#include <stdio.h> #include <string.h> #include <assert.h>
void func0(char *str) { int n = strlen(str); char temp; for (int i = 0; i < n-1; i++) { for (int j = i+1; j < n; j++) { if (str[i] > str[j]) { temp = str[i]; str[i] = str[j]; str[j] = temp; } } } }
int main() { char str1[] = "cba"; char str2[] = "data"; char str3[] = "zxy"; func0(str1); func0(str2); func0(str3); assert(strcmp(str1, "abc") == 0); assert(strcmp(str2, "aadt") == 0); assert(strcmp(str3, "xyz") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 1080 <strlen@plt> mov %eax,-0x4(%rbp) movl $0x0,-0xc(%rbp) jmpq 1258 <func0+0xaf> mov -0xc(%rbp),%eax add $0x1,%eax mov %eax,-0x8(%rbp) jmp 124c <func0+0xa3> mov -0xc(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax movzbl (%rax),%edx mov -0x8(%rbp),%eax movslq %eax,%rcx mov -0x18(%rbp),%rax add %rcx,%rax movzbl (%rax),%eax cmp %al,%dl jle 1248 <func0+0x9f> mov -0xc(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax mov %al,-0xd(%rbp) mov -0x8(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0xc(%rbp),%edx movslq %edx,%rcx mov -0x18(%rbp),%rdx add %rcx,%rdx movzbl (%rax),%eax mov %al,(%rdx) mov -0x8(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax add %rax,%rdx movzbl -0xd(%rbp),%eax mov %al,(%rdx) addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x4(%rbp),%eax jl 11df <func0+0x36> addl $0x1,-0xc(%rbp) mov -0x4(%rbp),%eax sub $0x1,%eax cmp %eax,-0xc(%rbp) jl 11d4 <func0+0x2b> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+s], rdi mov rax, [rbp+s] mov rdi, rax; s call _strlen mov [rbp+var_4], eax mov [rbp+var_C], 0 jmp loc_1258 loc_11D4: mov eax, [rbp+var_C] add eax, 1 mov [rbp+var_8], eax jmp short loc_124C loc_11DF: mov eax, [rbp+var_C] movsxd rdx, eax mov rax, [rbp+s] add rax, rdx movzx edx, byte ptr [rax] mov eax, [rbp+var_8] movsxd rcx, eax mov rax, [rbp+s] add rax, rcx movzx eax, byte ptr [rax] cmp dl, al jle short loc_1248 mov eax, [rbp+var_C] movsxd rdx, eax mov rax, [rbp+s] add rax, rdx movzx eax, byte ptr [rax] mov [rbp+var_D], al mov eax, [rbp+var_8] movsxd rdx, eax mov rax, [rbp+s] add rax, rdx mov edx, [rbp+var_C] movsxd rcx, edx mov rdx, [rbp+s] add rdx, rcx movzx eax, byte ptr [rax] mov [rdx], al mov eax, [rbp+var_8] movsxd rdx, eax mov rax, [rbp+s] add rdx, rax movzx eax, [rbp+var_D] mov [rdx], al loc_1248: add [rbp+var_8], 1 loc_124C: mov eax, [rbp+var_8] cmp eax, [rbp+var_4] jl short loc_11DF add [rbp+var_C], 1 loc_1258: mov eax, [rbp+var_4] sub eax, 1 cmp [rbp+var_C], eax jl loc_11D4 nop nop leave retn
long long func0(const char *a1) { long long result; // rax char v2; // [rsp+13h] [rbp-Dh] int i; // [rsp+14h] [rbp-Ch] int j; // [rsp+18h] [rbp-8h] int v5; // [rsp+1Ch] [rbp-4h] v5 = strlen(a1); for ( i = 0; ; ++i ) { result = (unsigned int)(v5 - 1); if ( i >= (int)result ) break; for ( j = i + 1; j < v5; ++j ) { if ( a1[i] > a1[j] ) { v2 = a1[i]; a1[i] = a1[j]; a1[j] = v2; } } } return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101080 MOV dword ptr [RBP + -0x4],EAX MOV dword ptr [RBP + -0xc],0x0 JMP 0x00101258 LAB_001011d4: MOV EAX,dword ptr [RBP + -0xc] ADD EAX,0x1 MOV dword ptr [RBP + -0x8],EAX JMP 0x0010124c LAB_001011df: MOV EAX,dword ptr [RBP + -0xc] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVZX EDX,byte ptr [RAX] MOV EAX,dword ptr [RBP + -0x8] MOVSXD RCX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOVZX EAX,byte ptr [RAX] CMP DL,AL JLE 0x00101248 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 MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0xc] MOVSXD RCX,EDX MOV RDX,qword ptr [RBP + -0x18] ADD RDX,RCX MOVZX EAX,byte ptr [RAX] MOV byte ptr [RDX],AL MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RDX,RAX MOVZX EAX,byte ptr [RBP + -0xd] MOV byte ptr [RDX],AL LAB_00101248: ADD dword ptr [RBP + -0x8],0x1 LAB_0010124c: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x4] JL 0x001011df ADD dword ptr [RBP + -0xc],0x1 LAB_00101258: MOV EAX,dword ptr [RBP + -0x4] SUB EAX,0x1 CMP dword ptr [RBP + -0xc],EAX JL 0x001011d4 NOP NOP LEAVE RET
void func0(char *param_1) { char cVar1; size_t sVar2; int local_14; int local_10; sVar2 = strlen(param_1); for (local_14 = 0; local_10 = local_14, local_14 < (int)sVar2 + -1; local_14 = local_14 + 1) { while (local_10 = local_10 + 1, local_10 < (int)sVar2) { if (param_1[local_10] < param_1[local_14]) { cVar1 = param_1[local_14]; param_1[local_14] = param_1[local_10]; param_1[local_10] = cVar1; } } } return; }
7,401
func0
#include <stdio.h> #include <string.h> #include <assert.h>
void func0(char *str) { int n = strlen(str); char temp; for (int i = 0; i < n-1; i++) { for (int j = i+1; j < n; j++) { if (str[i] > str[j]) { temp = str[i]; str[i] = str[j]; str[j] = temp; } } } }
int main() { char str1[] = "cba"; char str2[] = "data"; char str3[] = "zxy"; func0(str1); func0(str2); func0(str3); assert(strcmp(str1, "abc") == 0); assert(strcmp(str2, "aadt") == 0); assert(strcmp(str3, "xyz") == 0); return 0; }
O1
c
func0: endbr64 mov %rdi,%r8 mov $0xffffffffffffffff,%rcx mov $0x0,%eax repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax sub $0x1,%rax mov %eax,%edi cmp $0x1,%eax jle 11d5 <func0+0x6c> mov %r8,%rsi lea -0x2(%rax),%r10d add $0x2,%r10 mov $0x1,%r9d jmp 11cb <func0+0x62> add $0x1,%rax cmp %eax,%edi jle 11be <func0+0x55> movzbl (%rsi),%edx movzbl (%r8,%rax,1),%ecx cmp %cl,%dl jle 11a2 <func0+0x39> mov %cl,(%rsi) mov %dl,(%r8,%rax,1) jmp 11a2 <func0+0x39> add $0x1,%r9 add $0x1,%rsi cmp %r10,%r9 je 11d5 <func0+0x6c> cmp %r9d,%edi jle 11be <func0+0x55> mov %r9,%rax jmp 11aa <func0+0x41> retq
func0: endbr64 push rbx mov rbx, rdi call _strlen cmp eax, 1 jle short loc_1209 mov r10d, eax mov rdi, rbx lea r9d, [rax-1] mov r8d, 0 jmp short loc_11EF loc_11CD: add rax, 1 cmp rax, rsi jz short loc_11E6 loc_11D6: movzx edx, byte ptr [rdi] movzx ecx, byte ptr [rax] cmp dl, cl jle short loc_11CD mov [rdi], cl mov [rax], dl jmp short loc_11CD loc_11E6: add rdi, 1 cmp r8d, r9d jz short loc_1209 loc_11EF: add r8d, 1 cmp r10d, r8d jle short loc_11E6 lea rax, [rdi+1] mov edx, r9d sub edx, r8d lea rsi, [rdi+rdx+2] jmp short loc_11D6 loc_1209: pop rbx retn
char * func0(char *a1) { char *result; // rax int v2; // r10d int v3; // r9d int v4; // r8d char v5; // dl result = (char *)strlen(); if ( (int)result > 1 ) { v2 = (int)result; v3 = (_DWORD)result - 1; v4 = 0; do { if ( v2 > ++v4 ) { result = a1 + 1; do { v5 = *a1; if ( *a1 > *result ) { *a1 = *result; *result = v5; } ++result; } while ( result != &a1[v3 - v4 + 2] ); } ++a1; } while ( v4 != v3 ); } return result; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101080 CMP EAX,0x1 JLE 0x00101209 MOV R10D,EAX MOV RDI,RBX LEA R9D,[RAX + -0x1] MOV R8D,0x0 JMP 0x001011ef LAB_001011cd: ADD RAX,0x1 CMP RAX,RSI JZ 0x001011e6 LAB_001011d6: MOVZX EDX,byte ptr [RDI] MOVZX ECX,byte ptr [RAX] CMP DL,CL JLE 0x001011cd MOV byte ptr [RDI],CL MOV byte ptr [RAX],DL JMP 0x001011cd LAB_001011e6: ADD RDI,0x1 CMP R8D,R9D JZ 0x00101209 LAB_001011ef: ADD R8D,0x1 CMP R10D,R8D JLE 0x001011e6 LEA RAX,[RDI + 0x1] MOV EDX,R9D SUB EDX,R8D LEA RSI,[RDI + RDX*0x1 + 0x2] JMP 0x001011d6 LAB_00101209: POP RBX RET
void func0(char *param_1) { char cVar1; int iVar2; size_t sVar3; char *pcVar4; int iVar5; sVar3 = strlen(param_1); iVar2 = (int)sVar3; if (1 < iVar2) { iVar5 = 0; do { iVar5 = iVar5 + 1; if (iVar5 < iVar2) { pcVar4 = param_1 + 1; do { cVar1 = *param_1; if (*pcVar4 < cVar1) { *param_1 = *pcVar4; *pcVar4 = cVar1; } pcVar4 = pcVar4 + 1; } while (pcVar4 != param_1 + (ulong)(uint)((iVar2 + -1) - iVar5) + 2); } param_1 = param_1 + 1; } while (iVar5 != iVar2 + -1); } return; }
7,402
func0
#include <stdio.h> #include <string.h> #include <assert.h>
void func0(char *str) { int n = strlen(str); char temp; for (int i = 0; i < n-1; i++) { for (int j = i+1; j < n; j++) { if (str[i] > str[j]) { temp = str[i]; str[i] = str[j]; str[j] = temp; } } } }
int main() { char str1[] = "cba"; char str2[] = "data"; char str3[] = "zxy"; func0(str1); func0(str2); func0(str3); assert(strcmp(str1, "abc") == 0); assert(strcmp(str2, "aadt") == 0); assert(strcmp(str3, "xyz") == 0); return 0; }
O2
c
func0: endbr64 push %rbx mov %rdi,%rbx callq 1070 <strlen@plt> cmp $0x1,%eax jle 131f <func0+0x5f> mov %eax,%r11d mov %rbx,%rdi lea -0x1(%rax),%r10d xor %r8d,%r8d add $0x1,%r8d lea 0x1(%rdi),%r9 cmp %r8d,%r11d jle 1317 <func0+0x57> mov %r10d,%edx mov %r9,%rax sub %r8d,%edx lea 0x2(%rdi,%rdx,1),%rsi nopl 0x0(%rax,%rax,1) movzbl (%rdi),%edx movzbl (%rax),%ecx cmp %cl,%dl jle 130e <func0+0x4e> mov %cl,(%rdi) mov %dl,(%rax) add $0x1,%rax cmp %rsi,%rax jne 1300 <func0+0x40> mov %r9,%rdi cmp %r10d,%r8d jne 12e0 <func0+0x20> pop %rbx retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 push rbx mov rbx, rdi call _strlen cmp eax, 1 jle short loc_132F mov r11d, eax mov rdi, rbx lea r10d, [rax-1] xor r8d, r8d nop loc_12F0: add r8d, 1 lea r9, [rdi+1] cmp r11d, r8d jle short loc_1327 mov edx, r10d mov rax, r9 sub edx, r8d lea rsi, [rdi+rdx+2] nop dword ptr [rax+rax+00h] loc_1310: movzx edx, byte ptr [rdi] movzx ecx, byte ptr [rax] cmp dl, cl jle short loc_131E mov [rdi], cl mov [rax], dl loc_131E: add rax, 1 cmp rax, rsi jnz short loc_1310 loc_1327: mov rdi, r9 cmp r8d, r10d jnz short loc_12F0 loc_132F: pop rbx retn
char * func0(char *a1) { char *result; // rax int v2; // r11d int v3; // r10d int v4; // r8d char v5; // dl result = (char *)strlen(); if ( (int)result > 1 ) { v2 = (int)result; v3 = (_DWORD)result - 1; v4 = 0; do { if ( v2 > ++v4 ) { result = a1 + 1; do { v5 = *a1; if ( *a1 > *result ) { *a1 = *result; *result = v5; } ++result; } while ( result != &a1[v3 - v4 + 2] ); } ++a1; } while ( v4 != v3 ); } return result; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101080 CMP EAX,0x1 JLE 0x0010132f MOV R11D,EAX MOV RDI,RBX LEA R10D,[RAX + -0x1] XOR R8D,R8D NOP LAB_001012f0: ADD R8D,0x1 LEA R9,[RDI + 0x1] CMP R11D,R8D JLE 0x00101327 MOV EDX,R10D MOV RAX,R9 SUB EDX,R8D LEA RSI,[RDI + RDX*0x1 + 0x2] NOP dword ptr [RAX + RAX*0x1] LAB_00101310: MOVZX EDX,byte ptr [RDI] MOVZX ECX,byte ptr [RAX] CMP DL,CL JLE 0x0010131e MOV byte ptr [RDI],CL MOV byte ptr [RAX],DL LAB_0010131e: ADD RAX,0x1 CMP RAX,RSI JNZ 0x00101310 LAB_00101327: MOV RDI,R9 CMP R8D,R10D JNZ 0x001012f0 LAB_0010132f: POP RBX RET
void func0(char *param_1) { char cVar1; int iVar2; size_t sVar3; char *pcVar4; int iVar5; sVar3 = strlen(param_1); iVar2 = (int)sVar3; if (1 < iVar2) { iVar5 = 0; do { iVar5 = iVar5 + 1; if (iVar5 < iVar2) { pcVar4 = param_1 + 1; do { cVar1 = *param_1; if (*pcVar4 < cVar1) { *param_1 = *pcVar4; *pcVar4 = cVar1; } pcVar4 = pcVar4 + 1; } while (pcVar4 != param_1 + (ulong)(uint)((iVar2 + -1) - iVar5) + 2); } param_1 = param_1 + 1; } while (iVar5 != iVar2 + -1); } return; }
7,403
func0
#include <stdio.h> #include <string.h> #include <assert.h>
void func0(char *str) { int n = strlen(str); char temp; for (int i = 0; i < n-1; i++) { for (int j = i+1; j < n; j++) { if (str[i] > str[j]) { temp = str[i]; str[i] = str[j]; str[j] = temp; } } } }
int main() { char str1[] = "cba"; char str2[] = "data"; char str3[] = "zxy"; func0(str1); func0(str2); func0(str3); assert(strcmp(str1, "abc") == 0); assert(strcmp(str2, "aadt") == 0); assert(strcmp(str3, "xyz") == 0); return 0; }
O3
c
func0: endbr64 push %rbx mov %rdi,%rbx callq 1070 <strlen@plt> cmp $0x1,%eax jle 131f <func0+0x5f> mov %eax,%r11d mov %rbx,%rdi lea -0x1(%rax),%r10d xor %r8d,%r8d add $0x1,%r8d lea 0x1(%rdi),%r9 cmp %r8d,%r11d jle 1317 <func0+0x57> mov %r10d,%edx mov %r9,%rax sub %r8d,%edx lea 0x2(%rdi,%rdx,1),%rsi nopl 0x0(%rax,%rax,1) movzbl (%rdi),%edx movzbl (%rax),%ecx cmp %cl,%dl jle 130e <func0+0x4e> mov %cl,(%rdi) mov %dl,(%rax) add $0x1,%rax cmp %rsi,%rax jne 1300 <func0+0x40> mov %r9,%rdi cmp %r10d,%r8d jne 12e0 <func0+0x20> pop %rbx retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 push rbx mov rbx, rdi call _strlen cmp eax, 1 jle short loc_132F mov r11d, eax mov rdi, rbx lea r10d, [rax-1] xor r8d, r8d nop loc_12F0: add r8d, 1 lea r9, [rdi+1] cmp r11d, r8d jle short loc_1327 mov edx, r10d mov rax, r9 sub edx, r8d lea rsi, [rdi+rdx+2] nop dword ptr [rax+rax+00h] loc_1310: movzx edx, byte ptr [rdi] movzx ecx, byte ptr [rax] cmp dl, cl jle short loc_131E mov [rdi], cl mov [rax], dl loc_131E: add rax, 1 cmp rax, rsi jnz short loc_1310 loc_1327: mov rdi, r9 cmp r8d, r10d jnz short loc_12F0 loc_132F: pop rbx retn
char * func0(char *a1) { char *result; // rax int v2; // r11d int v3; // r10d int v4; // r8d char v5; // dl result = (char *)strlen(a1); if ( (int)result > 1 ) { v2 = (int)result; v3 = (_DWORD)result - 1; v4 = 0; do { if ( v2 > ++v4 ) { result = a1 + 1; do { v5 = *a1; if ( *a1 > *result ) { *a1 = *result; *result = v5; } ++result; } while ( result != &a1[v3 - v4 + 2] ); } ++a1; } while ( v4 != v3 ); } return result; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101080 CMP EAX,0x1 JLE 0x0010132f MOV R11D,EAX MOV RDI,RBX LEA R10D,[RAX + -0x1] XOR R8D,R8D NOP LAB_001012f0: ADD R8D,0x1 LEA R9,[RDI + 0x1] CMP R11D,R8D JLE 0x00101327 MOV EDX,R10D MOV RAX,R9 SUB EDX,R8D LEA RSI,[RDI + RDX*0x1 + 0x2] NOP dword ptr [RAX + RAX*0x1] LAB_00101310: MOVZX EDX,byte ptr [RDI] MOVZX ECX,byte ptr [RAX] CMP DL,CL JLE 0x0010131e MOV byte ptr [RDI],CL MOV byte ptr [RAX],DL LAB_0010131e: ADD RAX,0x1 CMP RAX,RSI JNZ 0x00101310 LAB_00101327: MOV RDI,R9 CMP R8D,R10D JNZ 0x001012f0 LAB_0010132f: POP RBX RET
void func0(char *param_1) { char cVar1; int iVar2; size_t sVar3; char *pcVar4; int iVar5; sVar3 = strlen(param_1); iVar2 = (int)sVar3; if (1 < iVar2) { iVar5 = 0; do { iVar5 = iVar5 + 1; if (iVar5 < iVar2) { pcVar4 = param_1 + 1; do { cVar1 = *param_1; if (*pcVar4 < cVar1) { *param_1 = *pcVar4; *pcVar4 = cVar1; } pcVar4 = pcVar4 + 1; } while (pcVar4 != param_1 + (ulong)(uint)((iVar2 + -1) - iVar5) + 2); } param_1 = param_1 + 1; } while (iVar5 != iVar2 + -1); } return; }
7,404
func0
#include <stdbool.h> #include <assert.h>
bool func0(int test_tuple[], int tuple_size, int K[], int K_size) { for (int i = 0; i < tuple_size; i++) { bool found = false; for (int j = 0; j < K_size; j++) { if (test_tuple[i] == K[j]) { found = true; break; } } if (!found) { return false; } } return true; }
int main() { int tuple1[] = {3, 5, 6, 5, 3, 6}; int K1[] = {3, 6, 5}; assert(func0(tuple1, 6, K1, 3) == true); int tuple2[] = {4, 5, 6, 4, 6, 5}; int K2[] = {4, 5, 6}; assert(func0(tuple2, 6, K2, 3) == true); int tuple3[] = {9, 8, 7, 6, 8, 9}; int K3[] = {9, 8, 1}; assert(func0(tuple3, 6, K3, 3) == false); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %rdx,-0x28(%rbp) mov %ecx,-0x20(%rbp) movl $0x0,-0x8(%rbp) jmp 11ed <func0+0x84> movb $0x0,-0x9(%rbp) movl $0x0,-0x4(%rbp) jmp 11cf <func0+0x66> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x28(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jne 11cb <func0+0x62> movb $0x1,-0x9(%rbp) jmp 11d7 <func0+0x6e> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x20(%rbp),%eax jl 1195 <func0+0x2c> movzbl -0x9(%rbp),%eax xor $0x1,%eax test %al,%al je 11e9 <func0+0x80> mov $0x0,%eax jmp 11fa <func0+0x91> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1188 <func0+0x1f> mov $0x1,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_28], rdx mov [rbp+var_20], ecx mov [rbp+var_8], 0 jmp short loc_11ED loc_1188: mov [rbp+var_9], 0 mov [rbp+var_4], 0 jmp short loc_11CF loc_1195: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_4] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rcx mov eax, [rax] cmp edx, eax jnz short loc_11CB mov [rbp+var_9], 1 jmp short loc_11D7 loc_11CB: add [rbp+var_4], 1 loc_11CF: mov eax, [rbp+var_4] cmp eax, [rbp+var_20] jl short loc_1195 loc_11D7: movzx eax, [rbp+var_9] xor eax, 1 test al, al jz short loc_11E9 mov eax, 0 jmp short loc_11FA loc_11E9: add [rbp+var_8], 1 loc_11ED: mov eax, [rbp+var_8] cmp eax, [rbp+var_1C] jl short loc_1188 mov eax, 1 loc_11FA: pop rbp retn
long long func0(long long a1, int a2, long long a3, int a4) { char v5; // [rsp+1Fh] [rbp-9h] int i; // [rsp+20h] [rbp-8h] int j; // [rsp+24h] [rbp-4h] for ( i = 0; i < a2; ++i ) { v5 = 0; for ( j = 0; j < a4; ++j ) { if ( *(_DWORD *)(4LL * i + a1) == *(_DWORD *)(4LL * j + a3) ) { v5 = 1; break; } } if ( v5 != 1 ) return 0LL; } return 1LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x20],ECX MOV dword ptr [RBP + -0x8],0x0 JMP 0x001011ed LAB_00101188: MOV byte ptr [RBP + -0x9],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011cf LAB_00101195: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JNZ 0x001011cb MOV byte ptr [RBP + -0x9],0x1 JMP 0x001011d7 LAB_001011cb: ADD dword ptr [RBP + -0x4],0x1 LAB_001011cf: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x20] JL 0x00101195 LAB_001011d7: MOVZX EAX,byte ptr [RBP + -0x9] XOR EAX,0x1 TEST AL,AL JZ 0x001011e9 MOV EAX,0x0 JMP 0x001011fa LAB_001011e9: ADD dword ptr [RBP + -0x8],0x1 LAB_001011ed: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101188 MOV EAX,0x1 LAB_001011fa: POP RBP RET
int8 func0(long param_1,int param_2,long param_3,int param_4) { bool bVar1; int local_10; int local_c; local_10 = 0; do { if (param_2 <= local_10) { return 1; } bVar1 = false; for (local_c = 0; local_c < param_4; local_c = local_c + 1) { if (*(int *)(param_1 + (long)local_10 * 4) == *(int *)(param_3 + (long)local_c * 4)) { bVar1 = true; break; } } if (!bVar1) { return 0; } local_10 = local_10 + 1; } while( true ); }
7,405
func0
#include <stdbool.h> #include <assert.h>
bool func0(int test_tuple[], int tuple_size, int K[], int K_size) { for (int i = 0; i < tuple_size; i++) { bool found = false; for (int j = 0; j < K_size; j++) { if (test_tuple[i] == K[j]) { found = true; break; } } if (!found) { return false; } } return true; }
int main() { int tuple1[] = {3, 5, 6, 5, 3, 6}; int K1[] = {3, 6, 5}; assert(func0(tuple1, 6, K1, 3) == true); int tuple2[] = {4, 5, 6, 4, 6, 5}; int K2[] = {4, 5, 6}; assert(func0(tuple2, 6, K2, 3) == true); int tuple3[] = {9, 8, 7, 6, 8, 9}; int K3[] = {9, 8, 1}; assert(func0(tuple3, 6, K3, 3) == false); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 1189 <func0+0x20> mov %rdi,%r8 lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%r9 mov %rdx,%rdi lea -0x1(%rcx),%eax lea 0x4(%rdx,%rax,4),%rsi jmp 119e <func0+0x35> mov $0x1,%eax retq mov $0x0,%eax retq add $0x4,%r8 cmp %r9,%r8 je 11bb <func0+0x52> test %ecx,%ecx jle 118f <func0+0x26> mov (%r8),%edx mov %rdi,%rax cmp (%rax),%edx je 1195 <func0+0x2c> add $0x4,%rax cmp %rsi,%rax jne 11a8 <func0+0x3f> mov $0x0,%eax retq mov $0x1,%eax retq
func0: endbr64 test esi, esi jle short loc_1186 mov r8, rdi lea eax, [rsi-1] lea r9, [rdi+rax*4+4] lea eax, [rcx-1] lea rdi, [rdx+rax*4+4] jmp short loc_119B loc_1186: mov eax, 1 retn loc_118C: mov eax, 0 retn loc_1192: add r8, 4 cmp r8, r9 jz short loc_11B8 loc_119B: test ecx, ecx jle short loc_118C mov esi, [r8] mov rax, rdx loc_11A5: cmp esi, [rax] jz short loc_1192 add rax, 4 cmp rax, rdi jnz short loc_11A5 mov eax, 0 retn loc_11B8: mov eax, 1 retn
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4) { _DWORD *v4; // r8 _DWORD *v6; // rax if ( a2 <= 0 ) return 1LL; v4 = a1; while ( 2 ) { if ( a4 <= 0 ) return 0LL; v6 = a3; while ( *v4 != *v6 ) { if ( ++v6 == &a3[a4 - 1 + 1] ) return 0LL; } if ( ++v4 != &a1[a2 - 1 + 1] ) continue; break; } return 1LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101186 MOV R8,RDI LEA EAX,[RSI + -0x1] LEA R9,[RDI + RAX*0x4 + 0x4] LEA EAX,[RCX + -0x1] LEA RDI,[RDX + RAX*0x4 + 0x4] JMP 0x0010119b LAB_00101186: MOV EAX,0x1 RET LAB_0010118c: MOV EAX,0x0 RET LAB_00101192: ADD R8,0x4 CMP R8,R9 JZ 0x001011b8 LAB_0010119b: TEST ECX,ECX JLE 0x0010118c MOV ESI,dword ptr [R8] MOV RAX,RDX LAB_001011a5: CMP ESI,dword ptr [RAX] JZ 0x00101192 ADD RAX,0x4 CMP RAX,RDI JNZ 0x001011a5 MOV EAX,0x0 RET LAB_001011b8: MOV EAX,0x1 RET
int8 func0(int *param_1,int param_2,int *param_3,int param_4) { int *piVar1; int *piVar2; if (param_2 < 1) { return 1; } piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if (param_4 < 1) { return 0; } piVar2 = param_3; while (*param_1 != *piVar2) { piVar2 = piVar2 + 1; if (piVar2 == param_3 + (ulong)(param_4 - 1) + 1) { return 0; } } param_1 = param_1 + 1; if (param_1 == piVar1) { return 1; } } while( true ); }
7,406
func0
#include <stdbool.h> #include <assert.h>
bool func0(int test_tuple[], int tuple_size, int K[], int K_size) { for (int i = 0; i < tuple_size; i++) { bool found = false; for (int j = 0; j < K_size; j++) { if (test_tuple[i] == K[j]) { found = true; break; } } if (!found) { return false; } } return true; }
int main() { int tuple1[] = {3, 5, 6, 5, 3, 6}; int K1[] = {3, 6, 5}; assert(func0(tuple1, 6, K1, 3) == true); int tuple2[] = {4, 5, 6, 4, 6, 5}; int K2[] = {4, 5, 6}; assert(func0(tuple2, 6, K2, 3) == true); int tuple3[] = {9, 8, 7, 6, 8, 9}; int K3[] = {9, 8, 1}; assert(func0(tuple3, 6, K3, 3) == false); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1336 <func0+0x46> lea -0x1(%rsi),%eax mov %rdi,%r8 lea 0x4(%rdi,%rax,4),%r9 lea -0x1(%rcx),%eax lea 0x4(%rdx,%rax,4),%rdi nopl 0x0(%rax,%rax,1) test %ecx,%ecx jle 1340 <func0+0x50> mov (%r8),%esi mov %rdx,%rax jmp 1329 <func0+0x39> nopl 0x0(%rax) add $0x4,%rax cmp %rdi,%rax je 1340 <func0+0x50> cmp (%rax),%esi jne 1320 <func0+0x30> add $0x4,%r8 cmp %r9,%r8 jne 1310 <func0+0x20> mov $0x1,%eax retq nopl 0x0(%rax) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 test esi, esi jle short loc_1366 lea eax, [rsi-1] lea r9, [rdi+rax*4+4] lea eax, [rcx-1] lea r8, [rdx+rax*4+4] nop dword ptr [rax+rax+00000000h] loc_1340: test ecx, ecx jle short loc_1370 mov esi, [rdi] mov rax, rdx jmp short loc_1359 loc_1350: add rax, 4 cmp rax, r8 jz short loc_1370 loc_1359: cmp esi, [rax] jnz short loc_1350 add rdi, 4 cmp rdi, r9 jnz short loc_1340 loc_1366: mov eax, 1 retn loc_1370: xor eax, eax retn
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4) { long long v4; // r9 _DWORD *v5; // rax if ( a2 <= 0 ) return 1LL; v4 = (long long)&a1[a2 - 1 + 1]; while ( a4 > 0 ) { v5 = a3; while ( *a1 != *v5 ) { if ( ++v5 == &a3[a4 - 1 + 1] ) return 0LL; } if ( ++a1 == (_DWORD *)v4 ) return 1LL; } return 0LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101366 LEA EAX,[RSI + -0x1] LEA R9,[RDI + RAX*0x4 + 0x4] LEA EAX,[RCX + -0x1] LEA R8,[RDX + RAX*0x4 + 0x4] NOP dword ptr [RAX + RAX*0x1] LAB_00101340: TEST ECX,ECX JLE 0x00101370 MOV ESI,dword ptr [RDI] MOV RAX,RDX JMP 0x00101359 LAB_00101350: ADD RAX,0x4 CMP RAX,R8 JZ 0x00101370 LAB_00101359: CMP ESI,dword ptr [RAX] JNZ 0x00101350 ADD RDI,0x4 CMP RDI,R9 JNZ 0x00101340 LAB_00101366: MOV EAX,0x1 RET LAB_00101370: XOR EAX,EAX RET
int8 func0(int *param_1,int param_2,int *param_3,int param_4) { int *piVar1; int *piVar2; if (0 < param_2) { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { if (param_4 < 1) { return 0; } piVar2 = param_3; while (*param_1 != *piVar2) { piVar2 = piVar2 + 1; if (piVar2 == param_3 + (ulong)(param_4 - 1) + 1) { return 0; } } param_1 = param_1 + 1; } while (param_1 != piVar1); } return 1; }
7,407
func0
#include <stdbool.h> #include <assert.h>
bool func0(int test_tuple[], int tuple_size, int K[], int K_size) { for (int i = 0; i < tuple_size; i++) { bool found = false; for (int j = 0; j < K_size; j++) { if (test_tuple[i] == K[j]) { found = true; break; } } if (!found) { return false; } } return true; }
int main() { int tuple1[] = {3, 5, 6, 5, 3, 6}; int K1[] = {3, 6, 5}; assert(func0(tuple1, 6, K1, 3) == true); int tuple2[] = {4, 5, 6, 4, 6, 5}; int K2[] = {4, 5, 6}; assert(func0(tuple2, 6, K2, 3) == true); int tuple3[] = {9, 8, 7, 6, 8, 9}; int K3[] = {9, 8, 1}; assert(func0(tuple3, 6, K3, 3) == false); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 12f6 <func0+0x46> lea -0x1(%rsi),%eax mov %rdi,%r8 lea 0x4(%rdi,%rax,4),%r9 lea -0x1(%rcx),%eax lea 0x4(%rdx,%rax,4),%rdi nopl 0x0(%rax,%rax,1) test %ecx,%ecx jle 1300 <func0+0x50> mov (%r8),%esi mov %rdx,%rax jmp 12e9 <func0+0x39> nopl 0x0(%rax) add $0x4,%rax cmp %rdi,%rax je 1300 <func0+0x50> cmp (%rax),%esi jne 12e0 <func0+0x30> add $0x4,%r8 cmp %r9,%r8 jne 12d0 <func0+0x20> mov $0x1,%eax retq nopl 0x0(%rax) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 test esi, esi jle short loc_1186 movsxd rsi, esi movsxd rax, ecx lea r8, [rdi+rsi*4] lea rsi, [rdx+rax*4] test ecx, ecx jle short loc_1190 nop word ptr [rax+rax+00h] loc_1160: mov ecx, [rdi] mov rax, rdx jmp short loc_1179 loc_1170: add rax, 4 cmp rsi, rax jz short loc_1190 loc_1179: cmp ecx, [rax] jnz short loc_1170 add rdi, 4 cmp rdi, r8 jnz short loc_1160 loc_1186: mov eax, 1 retn loc_1190: xor eax, eax retn
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4) { _DWORD *v4; // r8 _DWORD *v5; // rax if ( a2 <= 0 ) return 1LL; v4 = &a1[a2]; if ( a4 > 0 ) { do { v5 = a3; while ( *a1 != *v5 ) { if ( &a3[a4] == ++v5 ) return 0LL; } ++a1; } while ( a1 != v4 ); return 1LL; } return 0LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101186 MOVSXD RSI,ESI MOVSXD RAX,ECX LEA R8,[RDI + RSI*0x4] LEA RSI,[RDX + RAX*0x4] TEST ECX,ECX JLE 0x00101190 NOP word ptr [RAX + RAX*0x1] LAB_00101160: MOV ECX,dword ptr [RDI] MOV RAX,RDX JMP 0x00101179 LAB_00101170: ADD RAX,0x4 CMP RSI,RAX JZ 0x00101190 LAB_00101179: CMP ECX,dword ptr [RAX] JNZ 0x00101170 ADD RDI,0x4 CMP RDI,R8 JNZ 0x00101160 LAB_00101186: MOV EAX,0x1 RET LAB_00101190: XOR EAX,EAX RET
int8 func0(int *param_1,int param_2,int *param_3,int param_4) { int *piVar1; int *piVar2; if (0 < param_2) { piVar1 = param_1 + param_2; if (param_4 < 1) { return 0; } do { piVar2 = param_3; while (*param_1 != *piVar2) { piVar2 = piVar2 + 1; if (param_3 + param_4 == piVar2) { return 0; } } param_1 = param_1 + 1; } while (param_1 != piVar1); } return 1; }
7,408
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <string.h>
char* func0(const char *text) { regex_t regex; int result; char *pattern = "a.*?b$"; // Compile the regular expression result = regcomp(&regex, pattern, REG_EXTENDED); if (result) { return ("Regex compilation failed."); } // Execute the regular expression result = regexec(&regex, text, 0, NULL, 0); if (!result) { return ("Found a match!"); } else if (result == REG_NOMATCH) { return ("Not matched!"); } else { return ("Regex match failed."); } regfree(&regex); // Free the memory allocated to the pattern buffer by regcomp() }
int main() { assert(strcmp(func0("aabbbbd"), "Not matched!") == 0); assert(strcmp(func0("aabAbbbc"), "Not matched!") == 0); assert(strcmp(func0("accddbbjjjb"), "Found a match!") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x70,%rsp mov %rdi,-0x68(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea 0xe19(%rip),%rax mov %rax,-0x58(%rbp) mov -0x58(%rbp),%rcx lea -0x50(%rbp),%rax mov $0x1,%edx mov %rcx,%rsi mov %rax,%rdi callq 10b0 <regcomp@plt> mov %eax,-0x5c(%rbp) cmpl $0x0,-0x5c(%rbp) je 121d <func0+0x54> lea 0xdf4(%rip),%rax jmp 1265 <func0+0x9c> mov -0x68(%rbp),%rsi lea -0x50(%rbp),%rax mov $0x0,%r8d mov $0x0,%ecx mov $0x0,%edx mov %rax,%rdi callq 10d0 <regexec@plt> mov %eax,-0x5c(%rbp) cmpl $0x0,-0x5c(%rbp) jne 124f <func0+0x86> lea 0xddc(%rip),%rax jmp 1265 <func0+0x9c> cmpl $0x1,-0x5c(%rbp) jne 125e <func0+0x95> lea 0xddc(%rip),%rax jmp 1265 <func0+0x9c> lea 0xde0(%rip),%rax mov -0x8(%rbp),%rdx xor %fs:0x28,%rdx je 1279 <func0+0xb0> callq 1090 <__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, aAB; "a.*?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 [rbp+var_5C], eax cmp [rbp+var_5C], 0 jz short loc_121D lea rax, aRegexCompilati; "Regex compilation failed." jmp short loc_1265 loc_121D: mov rsi, [rbp+string]; string lea rax, [rbp+preg] mov r8d, 0; eflags mov ecx, 0; pmatch mov edx, 0; nmatch mov rdi, rax; preg call _regexec mov [rbp+var_5C], eax cmp [rbp+var_5C], 0 jnz short loc_124F lea rax, aFoundAMatch; "Found a match!" jmp short loc_1265 loc_124F: cmp [rbp+var_5C], 1 jnz short loc_125E lea rax, s2; "Not matched!" jmp short loc_1265 loc_125E: lea rax, aRegexMatchFail; "Regex match failed." loc_1265: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_1279 call ___stack_chk_fail locret_1279: leave retn
const char * func0(const char *a1) { int v2; // [rsp+14h] [rbp-5Ch] regex_t preg; // [rsp+20h] [rbp-50h] BYREF unsigned long long v4; // [rsp+68h] [rbp-8h] v4 = __readfsqword(0x28u); if ( regcomp(&preg, "a.*?b$", 1) ) return "Regex compilation failed."; v2 = regexec(&preg, a1, 0LL, 0LL, 0); if ( !v2 ) return "Found a match!"; if ( v2 == 1 ) return "Not matched!"; return "Regex match failed."; }
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 0x001010b0 MOV dword ptr [RBP + -0x5c],EAX CMP dword ptr [RBP + -0x5c],0x0 JZ 0x0010121d LEA RAX,[0x10200f] JMP 0x00101265 LAB_0010121d: MOV RSI,qword ptr [RBP + -0x68] LEA RAX,[RBP + -0x50] MOV R8D,0x0 MOV ECX,0x0 MOV EDX,0x0 MOV RDI,RAX CALL 0x001010d0 MOV dword ptr [RBP + -0x5c],EAX CMP dword ptr [RBP + -0x5c],0x0 JNZ 0x0010124f LEA RAX,[0x102029] JMP 0x00101265 LAB_0010124f: CMP dword ptr [RBP + -0x5c],0x1 JNZ 0x0010125e LEA RAX,[0x102038] JMP 0x00101265 LAB_0010125e: LEA RAX,[0x102045] LAB_00101265: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x00101279 CALL 0x00101090 LAB_00101279: LEAVE RET
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t local_58; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&local_58,"a.*?b$",1); if (iVar1 == 0) { iVar1 = regexec(&local_58,param_1,0,(regmatch_t *)0x0,0); if (iVar1 == 0) { pcVar2 = "Found a match!"; } else if (iVar1 == 1) { pcVar2 = "Not matched!"; } else { pcVar2 = "Regex match failed."; } } else { pcVar2 = "Regex compilation failed."; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return pcVar2; }
7,409
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <string.h>
char* func0(const char *text) { regex_t regex; int result; char *pattern = "a.*?b$"; // Compile the regular expression result = regcomp(&regex, pattern, REG_EXTENDED); if (result) { return ("Regex compilation failed."); } // Execute the regular expression result = regexec(&regex, text, 0, NULL, 0); if (!result) { return ("Found a match!"); } else if (result == REG_NOMATCH) { return ("Not matched!"); } else { return ("Regex match failed."); } regfree(&regex); // Free the memory allocated to the pattern buffer by regcomp() }
int main() { assert(strcmp(func0("aabbbbd"), "Not matched!") == 0); assert(strcmp(func0("aabAbbbc"), "Not matched!") == 0); assert(strcmp(func0("accddbbjjjb"), "Found a match!") == 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 0xe7a(%rip),%rsi callq 10a0 <regcomp@plt> mov %eax,%edx lea 0xe3e(%rip),%rax test %edx,%edx je 11fc <func0+0x53> mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 123b <func0+0x92> add $0x50,%rsp pop %rbx retq mov %rsp,%rdi mov $0x0,%r8d mov $0x0,%ecx mov $0x0,%edx mov %rbx,%rsi callq 10b0 <regexec@plt> mov %eax,%edx lea 0xde4(%rip),%rax test %edx,%edx je 11e6 <func0+0x3d> cmp $0x1,%edx lea 0xde5(%rip),%rax lea 0xe05(%rip),%rdx cmovne %rdx,%rax jmp 11e6 <func0+0x3d> callq 1080 <__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, aAB; "a.*?b$" call _regcomp mov edx, eax lea rax, aRegexCompilati; "Regex compilation failed." test edx, edx jz short loc_121C loc_1206: mov rdx, [rsp+58h+var_10] sub rdx, fs:28h jnz short loc_125B add rsp, 50h pop rbx retn loc_121C: mov rdi, rsp mov r8d, 0 mov ecx, 0 mov edx, 0 mov rsi, rbx call _regexec mov edx, eax lea rax, aFoundAMatch; "Found a match!" test edx, edx jz short loc_1206 cmp edx, 1 lea rax, aNotMatched; "Not matched!" lea rdx, aRegexMatchFail; "Regex match failed." cmovnz rax, rdx jmp short loc_1206 loc_125B: call ___stack_chk_fail
const char * func0(long long a1) { int v1; // edx const char *result; // rax int v3; // edx _QWORD v4[11]; // [rsp+0h] [rbp-58h] BYREF v4[9] = __readfsqword(0x28u); v1 = regcomp(v4, "a.*?b$", 1LL); result = "Regex compilation failed."; if ( !v1 ) { v3 = regexec(v4, a1, 0LL, 0LL, 0LL); result = "Found a match!"; if ( v3 ) { result = "Not matched!"; if ( v3 != 1 ) return "Regex match failed."; } } 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,[0x10204e] CALL 0x001010b0 MOV EDX,EAX LEA RAX,[0x102004] TEST EDX,EDX JZ 0x0010121c LAB_00101206: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x0010125b ADD RSP,0x50 POP RBX RET LAB_0010121c: MOV RDI,RSP MOV R8D,0x0 MOV ECX,0x0 MOV EDX,0x0 MOV RSI,RBX CALL 0x001010d0 MOV EDX,EAX LEA RAX,[0x10201e] TEST EDX,EDX JZ 0x00101206 CMP EDX,0x1 LEA RAX,[0x10202d] LEA RDX,[0x10203a] CMOVNZ RAX,RDX JMP 0x00101206 LAB_0010125b: CALL 0x00101090
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_58; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_58,"a.*?b$",1); pcVar2 = "Regex compilation failed."; if (iVar1 == 0) { iVar1 = regexec(&rStack_58,param_1,0,(regmatch_t *)0x0,0); pcVar2 = "Found a match!"; if ((iVar1 != 0) && (pcVar2 = "Not matched!", iVar1 != 1)) { pcVar2 = "Regex match failed."; } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return pcVar2; }
7,410
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <string.h>
char* func0(const char *text) { regex_t regex; int result; char *pattern = "a.*?b$"; // Compile the regular expression result = regcomp(&regex, pattern, REG_EXTENDED); if (result) { return ("Regex compilation failed."); } // Execute the regular expression result = regexec(&regex, text, 0, NULL, 0); if (!result) { return ("Found a match!"); } else if (result == REG_NOMATCH) { return ("Not matched!"); } else { return ("Regex match failed."); } regfree(&regex); // Free the memory allocated to the pattern buffer by regcomp() }
int main() { assert(strcmp(func0("aabbbbd"), "Not matched!") == 0); assert(strcmp(func0("aabAbbbc"), "Not matched!") == 0); assert(strcmp(func0("accddbbjjjb"), "Found a match!") == 0); return 0; }
O2
c
func0: endbr64 push %r12 mov $0x1,%edx lea 0xdac(%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 10a0 <regcomp@plt> mov %eax,%r8d lea 0xd51(%rip),%rax test %r8d,%r8d je 12f0 <func0+0x60> mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 1323 <func0+0x93> add $0x58,%rsp pop %rbp pop %r12 retq nopl 0x0(%rax) xor %edx,%edx xor %ecx,%ecx mov %rbp,%rsi mov %r12,%rdi callq 10b0 <regexec@plt> mov %eax,%edx lea 0xcfc(%rip),%rax test %edx,%edx je 12d4 <func0+0x44> cmp $0x1,%edx lea 0xcfd(%rip),%rax lea 0xd1d(%rip),%rdx cmovne %rdx,%rax jmp 12d4 <func0+0x44> callq 1080 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r12 mov edx, 1 lea rsi, aAB; "a.*?b$" push rbp mov rbp, rdi sub rsp, 58h mov rax, fs:28h mov [rsp+68h+var_20], rax xor eax, eax mov r12, rsp mov rdi, r12 call _regcomp mov r8d, eax lea rax, aRegexCompilati; "Regex compilation failed." test r8d, r8d jz short loc_1300 loc_12E4: mov rdx, [rsp+68h+var_20] sub rdx, fs:28h jnz short loc_1333 add rsp, 58h pop rbp pop r12 retn loc_1300: xor edx, edx xor ecx, ecx mov rsi, rbp mov rdi, r12 call _regexec mov edx, eax lea rax, aFoundAMatch; "Found a match!" test edx, edx jz short loc_12E4 cmp edx, 1 lea rax, aNotMatched; "Not matched!" lea rdx, aRegexMatchFail; "Regex match failed." cmovnz rax, rdx jmp short loc_12E4 loc_1333: call ___stack_chk_fail
const char * func0(long long a1) { int v1; // r8d const char *result; // rax int v3; // edx _QWORD v4[13]; // [rsp+0h] [rbp-68h] BYREF v4[9] = __readfsqword(0x28u); v1 = regcomp(v4, "a.*?b$", 1LL); result = "Regex compilation failed."; if ( !v1 ) { v3 = regexec(v4, a1, 0LL, 0LL); result = "Found a match!"; if ( v3 ) { result = "Not matched!"; if ( v3 != 1 ) return "Regex match failed."; } } return result; }
func0: ENDBR64 PUSH R12 MOV EDX,0x1 LEA RSI,[0x10204e] PUSH RBP MOV RBP,RDI SUB RSP,0x58 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV R12,RSP MOV RDI,R12 CALL 0x001010b0 MOV R8D,EAX LEA RAX,[0x102004] TEST R8D,R8D JZ 0x00101300 LAB_001012e4: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101333 ADD RSP,0x58 POP RBP POP R12 RET LAB_00101300: XOR EDX,EDX XOR ECX,ECX MOV RSI,RBP MOV RDI,R12 CALL 0x001010d0 MOV EDX,EAX LEA RAX,[0x10201e] TEST EDX,EDX JZ 0x001012e4 CMP EDX,0x1 LEA RAX,[0x10202d] LEA RDX,[0x10203a] CMOVNZ RAX,RDX JMP 0x001012e4 LAB_00101333: CALL 0x00101090
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_68; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"a.*?b$",1); pcVar2 = "Regex compilation failed."; if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0); pcVar2 = "Found a match!"; if ((iVar1 != 0) && (pcVar2 = "Not matched!", iVar1 != 1)) { pcVar2 = "Regex match failed."; } } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return pcVar2; }
7,411
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <string.h>
char* func0(const char *text) { regex_t regex; int result; char *pattern = "a.*?b$"; // Compile the regular expression result = regcomp(&regex, pattern, REG_EXTENDED); if (result) { return ("Regex compilation failed."); } // Execute the regular expression result = regexec(&regex, text, 0, NULL, 0); if (!result) { return ("Found a match!"); } else if (result == REG_NOMATCH) { return ("Not matched!"); } else { return ("Regex match failed."); } regfree(&regex); // Free the memory allocated to the pattern buffer by regcomp() }
int main() { assert(strcmp(func0("aabbbbd"), "Not matched!") == 0); assert(strcmp(func0("aabAbbbc"), "Not matched!") == 0); assert(strcmp(func0("accddbbjjjb"), "Found a match!") == 0); return 0; }
O3
c
func0: endbr64 push %r12 mov $0x1,%edx lea 0xdac(%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 10a0 <regcomp@plt> mov %eax,%r8d lea 0xd51(%rip),%rax test %r8d,%r8d je 12f0 <func0+0x60> mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 1323 <func0+0x93> add $0x58,%rsp pop %rbp pop %r12 retq nopl 0x0(%rax) xor %edx,%edx xor %ecx,%ecx mov %rbp,%rsi mov %r12,%rdi callq 10b0 <regexec@plt> mov %eax,%edx lea 0xcfc(%rip),%rax test %edx,%edx je 12d4 <func0+0x44> cmp $0x1,%edx lea 0xcfd(%rip),%rax lea 0xd1d(%rip),%rdx cmovne %rdx,%rax jmp 12d4 <func0+0x44> callq 1080 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push rbp mov edx, 1; cflags lea rsi, pattern; "a.*?b$" push rbx mov rbx, rdi sub rsp, 58h mov rax, fs:28h mov [rsp+var_s48], rax xor eax, eax mov rbp, rsp mov rdi, rbp; preg call _regcomp mov edx, eax lea rax, aRegexCompilati; "Regex compilation failed." test edx, edx jz short loc_1300 loc_12E1: mov rdx, [rsp+var_s48] sub rdx, fs:28h jnz short loc_1336 add rsp, 58h pop rbx pop rbp retn loc_1300: xor edx, edx; nmatch xor r8d, r8d; eflags xor ecx, ecx; pmatch mov rsi, rbx; string mov rdi, rbp; preg call _regexec mov edx, eax lea rax, aFoundAMatch; "Found a match!" test edx, edx jz short loc_12E1 cmp edx, 1 lea rax, aRegexMatchFail; "Regex match failed." lea rdx, s2; "Not matched!" cmovz rax, rdx jmp short loc_12E1 loc_1336: call ___stack_chk_fail
const char * func0(char *string) { int v1; // edx const char *result; // rax int v3; // edx regex_t _0; // [rsp+0h] [rbp+0h] BYREF unsigned long long vars48; // [rsp+48h] [rbp+48h] vars48 = __readfsqword(0x28u); v1 = regcomp(&_0, "a.*?b$", 1); result = "Regex compilation failed."; if ( !v1 ) { v3 = regexec(&_0, string, 0LL, 0LL, 0); result = "Found a match!"; if ( v3 ) { result = "Regex match failed."; if ( v3 == 1 ) return "Not matched!"; } } return result; }
func0: ENDBR64 PUSH RBP MOV EDX,0x1 LEA RSI,[0x10204e] PUSH RBX MOV RBX,RDI SUB RSP,0x58 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV RBP,RSP MOV RDI,RBP CALL 0x001010b0 MOV EDX,EAX LEA RAX,[0x102004] TEST EDX,EDX JZ 0x00101300 LAB_001012e1: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101336 ADD RSP,0x58 POP RBX POP RBP RET LAB_00101300: XOR EDX,EDX XOR R8D,R8D XOR ECX,ECX MOV RSI,RBX MOV RDI,RBP CALL 0x001010d0 MOV EDX,EAX LEA RAX,[0x10201e] TEST EDX,EDX JZ 0x001012e1 CMP EDX,0x1 LEA RAX,[0x10203a] LEA RDX,[0x10202d] CMOVZ RAX,RDX JMP 0x001012e1 LAB_00101336: CALL 0x00101090
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_68; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"a.*?b$",1); pcVar2 = "Regex compilation failed."; if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0); pcVar2 = "Found a match!"; if ((iVar1 != 0) && (pcVar2 = "Regex match failed.", iVar1 == 1)) { pcVar2 = "Not matched!"; } } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return pcVar2; }
7,412
func0
#include <stdio.h> #include <assert.h>
const char* func0(int a, int b, int c) { if ((b*b) - (4*a*c) > 0) { return "2 solutions"; } else if ((b*b) - (4*a*c) == 0) { return "1 solution"; } else { return "No solutions"; } }
int main() { assert(func0(2, 5, 2) == "2 solutions"); assert(func0(1, 1, 1) == "No solutions"); assert(func0(1, 2, 1) == "1 solution"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov %esi,-0x8(%rbp) mov %edx,-0xc(%rbp) mov -0x8(%rbp),%eax imul %eax,%eax mov %eax,%edx mov -0x4(%rbp),%eax imul -0xc(%rbp),%eax shl $0x2,%eax sub %eax,%edx mov %edx,%eax test %eax,%eax jle 117d <func0+0x34> lea 0xe8d(%rip),%rax jmp 11a3 <func0+0x5a> mov -0x8(%rbp),%eax imul %eax,%eax mov %eax,%edx mov -0x4(%rbp),%eax imul -0xc(%rbp),%eax shl $0x2,%eax cmp %eax,%edx jne 119c <func0+0x53> lea 0xe7a(%rip),%rax jmp 11a3 <func0+0x5a> lea 0xe7c(%rip),%rax 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_8] imul eax, eax mov ecx, eax mov eax, [rbp+var_4] imul eax, [rbp+var_C] lea edx, ds:0[rax*4] mov eax, ecx sub eax, edx test eax, eax jle short loc_1181 lea rax, a2Solutions; "2 solutions" jmp short loc_11A7 loc_1181: mov eax, [rbp+var_8] imul eax, eax mov edx, eax mov eax, [rbp+var_4] imul eax, [rbp+var_C] shl eax, 2 cmp edx, eax jnz short loc_11A0 lea rax, a1Solution; "1 solution" jmp short loc_11A7 loc_11A0: lea rax, aNoSolutions; "No solutions" loc_11A7: pop rbp retn
const char * func0(int a1, int a2, int a3) { if ( a2 * a2 - 4 * a3 * a1 > 0 ) return "2 solutions"; if ( a2 * a2 == 4 * a3 * a1 ) return "1 solution"; return "No solutions"; }
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 + -0x8] IMUL EAX,EAX MOV ECX,EAX MOV EAX,dword ptr [RBP + -0x4] IMUL EAX,dword ptr [RBP + -0xc] LEA EDX,[RAX*0x4] MOV EAX,ECX SUB EAX,EDX TEST EAX,EAX JLE 0x00101181 LEA RAX,[0x102008] JMP 0x001011a7 LAB_00101181: MOV EAX,dword ptr [RBP + -0x8] IMUL EAX,EAX MOV EDX,EAX MOV EAX,dword ptr [RBP + -0x4] IMUL EAX,dword ptr [RBP + -0xc] SHL EAX,0x2 CMP EDX,EAX JNZ 0x001011a0 LEA RAX,[0x102014] JMP 0x001011a7 LAB_001011a0: LEA RAX,[0x10201f] LAB_001011a7: POP RBP RET
char * func0(int param_1,int param_2,int param_3) { char *pcVar1; if (param_2 * param_2 + param_1 * param_3 * -4 < 1) { if (param_2 * param_2 == param_1 * param_3 * 4) { pcVar1 = "1 solution"; } else { pcVar1 = "No solutions"; } } else { pcVar1 = "2 solutions"; } return pcVar1; }
7,413
func0
#include <stdio.h> #include <assert.h>
const char* func0(int a, int b, int c) { if ((b*b) - (4*a*c) > 0) { return "2 solutions"; } else if ((b*b) - (4*a*c) == 0) { return "1 solution"; } else { return "No solutions"; } }
int main() { assert(func0(2, 5, 2) == "2 solutions"); assert(func0(1, 1, 1) == "No solutions"); assert(func0(1, 2, 1) == "1 solution"); return 0; }
O1
c
func0: endbr64 imul %esi,%esi imul %edx,%edi lea 0x0(,%rdi,4),%edx mov %esi,%ecx sub %edx,%ecx lea 0xebf(%rip),%rax test %ecx,%ecx jg 115d <func0+0x34> cmp %edx,%esi lea 0xebe(%rip),%rax lea 0xec2(%rip),%rdx cmovne %rdx,%rax retq
func0: endbr64 imul esi, esi imul edi, edx shl edi, 2 lea rax, a2Solutions; "2 solutions" cmp esi, edi jg short locret_1153 lea rax, a1Solution; "1 solution" lea rdx, aNoSolutions; "No solutions" cmovnz rax, rdx locret_1153: retn
const char * func0(int a1, int a2, int a3) { int v3; // esi int v4; // edi const char *result; // rax v3 = a2 * a2; v4 = 4 * a3 * a1; result = "2 solutions"; if ( v3 <= v4 ) { result = "1 solution"; if ( v3 != v4 ) return "No solutions"; } return result; }
func0: ENDBR64 IMUL ESI,ESI IMUL EDI,EDX SHL EDI,0x2 LEA RAX,[0x102004] CMP ESI,EDI JG 0x00101153 LEA RAX,[0x102010] LEA RDX,[0x10201b] CMOVNZ RAX,RDX LAB_00101153: RET
char * func0(int param_1,int param_2,int param_3) { char *pcVar1; int iVar2; iVar2 = param_1 * param_3 * 4; pcVar1 = "2 solutions"; if ((param_2 * param_2 <= iVar2) && (pcVar1 = "1 solution", param_2 * param_2 != iVar2)) { pcVar1 = "No solutions"; } return pcVar1; }
7,414
func0
#include <stdio.h> #include <assert.h>
const char* func0(int a, int b, int c) { if ((b*b) - (4*a*c) > 0) { return "2 solutions"; } else if ((b*b) - (4*a*c) == 0) { return "1 solution"; } else { return "No solutions"; } }
int main() { assert(func0(2, 5, 2) == "2 solutions"); assert(func0(1, 1, 1) == "No solutions"); assert(func0(1, 2, 1) == "1 solution"); return 0; }
O2
c
func0: endbr64 imul %esi,%esi lea 0xeb6(%rip),%rax imul %edx,%edi mov %esi,%ecx lea 0x0(,%rdi,4),%edx sub %edx,%ecx test %ecx,%ecx jg 1174 <func0+0x34> cmp %edx,%esi lea 0xea7(%rip),%rax lea 0xeab(%rip),%rdx cmovne %rdx,%rax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 imul edi, edx lea rax, a2Solutions; "2 solutions" imul esi, esi shl edi, 2 cmp esi, edi jg short locret_116A lea rax, a1Solution; "1 solution" lea rdx, aNoSolutions; "No solutions" cmovnz rax, rdx locret_116A: retn
const char * func0(int a1, int a2, int a3) { const char *result; // rax int v4; // esi int v5; // edi result = "2 solutions"; v4 = a2 * a2; v5 = 4 * a3 * a1; if ( v4 <= v5 ) { result = "1 solution"; if ( v4 != v5 ) return "No solutions"; } return result; }
func0: ENDBR64 IMUL EDI,EDX LEA RAX,[0x102004] IMUL ESI,ESI SHL EDI,0x2 CMP ESI,EDI JG 0x0010116a LEA RAX,[0x102010] LEA RDX,[0x10201b] CMOVNZ RAX,RDX LAB_0010116a: RET
char * func0(int param_1,int param_2,int param_3) { char *pcVar1; int iVar2; pcVar1 = "2 solutions"; iVar2 = param_1 * param_3 * 4; if ((param_2 * param_2 <= iVar2) && (pcVar1 = "1 solution", param_2 * param_2 != iVar2)) { pcVar1 = "No solutions"; } return pcVar1; }
7,415
func0
#include <stdio.h> #include <assert.h>
const char* func0(int a, int b, int c) { if ((b*b) - (4*a*c) > 0) { return "2 solutions"; } else if ((b*b) - (4*a*c) == 0) { return "1 solution"; } else { return "No solutions"; } }
int main() { assert(func0(2, 5, 2) == "2 solutions"); assert(func0(1, 1, 1) == "No solutions"); assert(func0(1, 2, 1) == "1 solution"); return 0; }
O3
c
func0: endbr64 imul %esi,%esi lea 0xeb6(%rip),%rax imul %edx,%edi mov %esi,%ecx lea 0x0(,%rdi,4),%edx sub %edx,%ecx test %ecx,%ecx jg 1174 <func0+0x34> cmp %edx,%esi lea 0xea7(%rip),%rax lea 0xeab(%rip),%rdx cmovne %rdx,%rax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 imul edi, edx lea rax, a2Solutions; "2 solutions" imul esi, esi shl edi, 2 cmp esi, edi jg short locret_116A lea rax, aNoSolutions; "No solutions" lea rdx, a1Solution; "1 solution" cmovz rax, rdx locret_116A: retn
const char * func0(int a1, int a2, int a3) { const char *result; // rax int v4; // esi int v5; // edi result = "2 solutions"; v4 = a2 * a2; v5 = 4 * a3 * a1; if ( v4 <= v5 ) { result = "No solutions"; if ( v4 == v5 ) return "1 solution"; } return result; }
func0: ENDBR64 IMUL EDI,EDX LEA RAX,[0x102004] IMUL ESI,ESI SHL EDI,0x2 CMP ESI,EDI JG 0x0010116a LEA RAX,[0x10201b] LEA RDX,[0x102010] CMOVZ RAX,RDX LAB_0010116a: RET
char * func0(int param_1,int param_2,int param_3) { char *pcVar1; int iVar2; pcVar1 = "2 solutions"; iVar2 = param_1 * param_3 * 4; if ((param_2 * param_2 <= iVar2) && (pcVar1 = "No solutions", param_2 * param_2 == iVar2)) { pcVar1 = "1 solution"; } return pcVar1; }
7,416
func0
#include <assert.h>
int func0(int list1[], int size) { int first_even = -1; int first_odd = -1; for (int i = 0; i < size; i++) { if (list1[i] % 2 == 0) { first_even = list1[i]; break; } } for (int i = 0; i < size; i++) { if (list1[i] % 2 != 0) { first_odd = list1[i]; break; } } return first_even + first_odd; }
int main() { int list1[] = {1, 3, 5, 7, 4, 1, 6, 8}; int list2[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int list3[] = {1, 5, 7, 9, 10}; assert(func0(list1, 8) == 5); assert(func0(list2, 10) == 3); assert(func0(list3, 5) == 11); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0xffffffff,-0x10(%rbp) movl $0xffffffff,-0xc(%rbp) movl $0x0,-0x8(%rbp) jmp 11cb <func0+0x62> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax and $0x1,%eax test %eax,%eax jne 11c7 <func0+0x5e> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov %eax,-0x10(%rbp) jmp 11d3 <func0+0x6a> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x1c(%rbp),%eax jl 118f <func0+0x26> movl $0x0,-0x4(%rbp) jmp 1218 <func0+0xaf> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax and $0x1,%eax test %eax,%eax je 1214 <func0+0xab> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov %eax,-0xc(%rbp) jmp 1220 <func0+0xb7> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11dc <func0+0x73> mov -0x10(%rbp),%edx mov -0xc(%rbp),%eax add %edx,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_10], 0FFFFFFFFh mov [rbp+var_C], 0FFFFFFFFh mov [rbp+var_8], 0 jmp short loc_11CB loc_118F: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] and eax, 1 test eax, eax jnz short loc_11C7 mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] mov [rbp+var_10], eax jmp short loc_11D3 loc_11C7: add [rbp+var_8], 1 loc_11CB: mov eax, [rbp+var_8] cmp eax, [rbp+var_1C] jl short loc_118F loc_11D3: mov [rbp+var_4], 0 jmp short loc_1218 loc_11DC: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] and eax, 1 test eax, eax jz short loc_1214 mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] mov [rbp+var_C], eax jmp short loc_1220 loc_1214: add [rbp+var_4], 1 loc_1218: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_11DC loc_1220: mov edx, [rbp+var_10] mov eax, [rbp+var_C] add eax, edx pop rbp retn
long long func0(long long a1, int a2) { int v3; // [rsp+Ch] [rbp-10h] int v4; // [rsp+10h] [rbp-Ch] int i; // [rsp+14h] [rbp-8h] int j; // [rsp+18h] [rbp-4h] v3 = -1; v4 = -1; for ( i = 0; i < a2; ++i ) { if ( (*(_DWORD *)(4LL * i + a1) & 1) == 0 ) { v3 = *(_DWORD *)(4LL * i + a1); break; } } for ( j = 0; j < a2; ++j ) { if ( (*(_DWORD *)(4LL * j + a1) & 1) != 0 ) { v4 = *(_DWORD *)(4LL * j + a1); return (unsigned int)(v3 + v4); } } return (unsigned int)(v3 + v4); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x10],0xffffffff MOV dword ptr [RBP + -0xc],0xffffffff MOV dword ptr [RBP + -0x8],0x0 JMP 0x001011cb LAB_0010118f: 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] AND EAX,0x1 TEST EAX,EAX JNZ 0x001011c7 MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x10],EAX JMP 0x001011d3 LAB_001011c7: ADD dword ptr [RBP + -0x8],0x1 LAB_001011cb: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x1c] JL 0x0010118f LAB_001011d3: MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101218 LAB_001011dc: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] AND EAX,0x1 TEST EAX,EAX JZ 0x00101214 MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0xc],EAX JMP 0x00101220 LAB_00101214: ADD dword ptr [RBP + -0x4],0x1 LAB_00101218: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011dc LAB_00101220: MOV EDX,dword ptr [RBP + -0x10] MOV EAX,dword ptr [RBP + -0xc] ADD EAX,EDX POP RBP RET
int func0(long param_1,int param_2) { int4 local_18; int4 local_14; int4 local_10; int4 local_c; local_18 = -1; local_14 = -1; for (local_10 = 0; local_10 < param_2; local_10 = local_10 + 1) { if ((*(uint *)(param_1 + (long)local_10 * 4) & 1) == 0) { local_18 = *(int *)(param_1 + (long)local_10 * 4); break; } } local_c = 0; do { if (param_2 <= local_c) { LAB_00101220: return local_14 + local_18; } if ((*(uint *)(param_1 + (long)local_c * 4) & 1) != 0) { local_14 = *(int *)(param_1 + (long)local_c * 4); goto LAB_00101220; } local_c = local_c + 1; } while( true ); }
7,417
func0
#include <assert.h>
int func0(int list1[], int size) { int first_even = -1; int first_odd = -1; for (int i = 0; i < size; i++) { if (list1[i] % 2 == 0) { first_even = list1[i]; break; } } for (int i = 0; i < size; i++) { if (list1[i] % 2 != 0) { first_odd = list1[i]; break; } } return first_even + first_odd; }
int main() { int list1[] = {1, 3, 5, 7, 4, 1, 6, 8}; int list2[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int list3[] = {1, 5, 7, 9, 10}; assert(func0(list1, 8) == 5); assert(func0(list2, 10) == 3); assert(func0(list3, 5) == 11); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11a8 <func0+0x3f> mov %rdi,%rdx lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rsi mov (%rdi),%ecx test $0x1,%cl je 1191 <func0+0x28> add $0x4,%rdi cmp %rsi,%rdi jne 117c <func0+0x13> mov $0xffffffff,%ecx mov (%rdx),%eax test $0x1,%al jne 11a5 <func0+0x3c> add $0x4,%rdx cmp %rsi,%rdx jne 1191 <func0+0x28> mov $0xffffffff,%eax add %ecx,%eax retq mov $0xffffffff,%ecx mov $0xffffffff,%eax jmp 11a5 <func0+0x3c>
func0: endbr64 test esi, esi jle short loc_11A8 mov rdx, rdi lea eax, [rsi-1] lea rsi, [rdi+rax*4+4] loc_117C: mov ecx, [rdi] test cl, 1 jz short loc_1191 add rdi, 4 cmp rdi, rsi jnz short loc_117C mov ecx, 0FFFFFFFFh loc_1191: mov eax, [rdx] test al, 1 jnz short loc_11A5 add rdx, 4 cmp rdx, rsi jnz short loc_1191 mov eax, 0FFFFFFFFh loc_11A5: add eax, ecx retn loc_11A8: mov ecx, 0FFFFFFFFh mov eax, 0FFFFFFFFh jmp short loc_11A5
long long func0(int *a1, int a2) { int *v2; // rdx long long v3; // rsi int v4; // ecx int v5; // eax if ( a2 <= 0 ) { v4 = -1; v5 = -1; } else { v2 = a1; v3 = (long long)&a1[a2 - 1 + 1]; do { v4 = *a1; if ( (*a1 & 1) == 0 ) goto LABEL_6; ++a1; } while ( a1 != (int *)v3 ); v4 = -1; LABEL_6: while ( 1 ) { v5 = *v2; if ( (*v2 & 1) != 0 ) break; if ( ++v2 == (int *)v3 ) { v5 = -1; return (unsigned int)(v4 + v5); } } } return (unsigned int)(v4 + v5); }
func0: ENDBR64 TEST ESI,ESI JLE 0x001011a8 MOV RDX,RDI LEA EAX,[RSI + -0x1] LEA RSI,[RDI + RAX*0x4 + 0x4] LAB_0010117c: MOV ECX,dword ptr [RDI] TEST CL,0x1 JZ 0x00101191 ADD RDI,0x4 CMP RDI,RSI JNZ 0x0010117c MOV ECX,0xffffffff LAB_00101191: MOV EAX,dword ptr [RDX] TEST AL,0x1 JNZ 0x001011a5 ADD RDX,0x4 CMP RDX,RSI JNZ 0x00101191 MOV EAX,0xffffffff LAB_001011a5: ADD EAX,ECX RET LAB_001011a8: MOV ECX,0xffffffff MOV EAX,0xffffffff JMP 0x001011a5
int func0(uint *param_1,int param_2) { uint *puVar1; uint uVar2; uint uVar3; uint *puVar4; if (param_2 < 1) { uVar3 = 0xffffffff; uVar2 = 0xffffffff; } else { puVar1 = param_1 + (ulong)(param_2 - 1) + 1; puVar4 = param_1; do { uVar3 = *puVar4; if ((uVar3 & 1) == 0) goto LAB_00101191; puVar4 = puVar4 + 1; } while (puVar4 != puVar1); uVar3 = 0xffffffff; LAB_00101191: do { uVar2 = *param_1; if ((uVar2 & 1) != 0) goto LAB_001011a5; param_1 = param_1 + 1; } while (param_1 != puVar1); uVar2 = 0xffffffff; } LAB_001011a5: return uVar2 + uVar3; }
7,418
func0
#include <assert.h>
int func0(int list1[], int size) { int first_even = -1; int first_odd = -1; for (int i = 0; i < size; i++) { if (list1[i] % 2 == 0) { first_even = list1[i]; break; } } for (int i = 0; i < size; i++) { if (list1[i] % 2 != 0) { first_odd = list1[i]; break; } } return first_even + first_odd; }
int main() { int list1[] = {1, 3, 5, 7, 4, 1, 6, 8}; int list2[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int list3[] = {1, 5, 7, 9, 10}; assert(func0(list1, 8) == 5); assert(func0(list2, 10) == 3); assert(func0(list3, 5) == 11); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1344 <func0+0x54> lea -0x1(%rsi),%eax mov %rdi,%rdx lea 0x4(%rdi,%rax,4),%rcx jmp 1311 <func0+0x21> nopl (%rax) add $0x4,%rdx cmp %rcx,%rdx je 1338 <func0+0x48> mov (%rdx),%eax test $0x1,%al jne 1308 <func0+0x18> jmp 1329 <func0+0x39> nopl 0x0(%rax) add $0x4,%rdi cmp %rcx,%rdi je 1340 <func0+0x50> mov (%rdi),%edx test $0x1,%dl je 1320 <func0+0x30> add %edx,%eax retq nopl 0x0(%rax,%rax,1) mov $0xffffffff,%eax jmp 1329 <func0+0x39> sub $0x1,%eax retq mov $0xfffffffe,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle short loc_1344 lea eax, [rsi-1] mov rdx, rdi lea rcx, [rdi+rax*4+4] jmp short loc_1311 loc_1308: add rdx, 4 cmp rdx, rcx jz short loc_1338 loc_1311: mov eax, [rdx] test al, 1 jnz short loc_1308 jmp short loc_1329 loc_1320: add rdi, 4 cmp rdi, rcx jz short loc_1340 loc_1329: mov edx, [rdi] test dl, 1 jz short loc_1320 add eax, edx retn loc_1338: mov eax, 0FFFFFFFFh jmp short loc_1329 loc_1340: sub eax, 1 retn loc_1344: mov eax, 0FFFFFFFEh retn
long long func0(int *a1, int a2) { int *v2; // rdx long long v3; // rcx int v4; // eax if ( a2 <= 0 ) return 4294967294LL; v2 = a1; v3 = (long long)&a1[a2 - 1 + 1]; while ( 1 ) { v4 = *v2; if ( (*v2 & 1) == 0 ) break; if ( ++v2 == (int *)v3 ) { v4 = -1; goto LABEL_7; } } do { LABEL_7: if ( (*a1 & 1) != 0 ) return (unsigned int)(*a1 + v4); ++a1; } while ( a1 != (int *)v3 ); return (unsigned int)(v4 - 1); }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101344 LEA EAX,[RSI + -0x1] MOV RDX,RDI LEA RCX,[RDI + RAX*0x4 + 0x4] JMP 0x00101311 LAB_00101308: ADD RDX,0x4 CMP RDX,RCX JZ 0x00101338 LAB_00101311: MOV EAX,dword ptr [RDX] TEST AL,0x1 JNZ 0x00101308 JMP 0x00101329 LAB_00101320: ADD RDI,0x4 CMP RDI,RCX JZ 0x00101340 LAB_00101329: MOV EDX,dword ptr [RDI] TEST DL,0x1 JZ 0x00101320 ADD EAX,EDX RET LAB_00101338: MOV EAX,0xffffffff JMP 0x00101329 LAB_00101340: SUB EAX,0x1 RET LAB_00101344: MOV EAX,0xfffffffe RET
int func0(uint *param_1,int param_2) { uint *puVar1; uint uVar2; uint *puVar3; if (param_2 < 1) { return -2; } puVar1 = param_1 + (ulong)(param_2 - 1) + 1; puVar3 = param_1; do { uVar2 = *puVar3; if ((uVar2 & 1) == 0) goto LAB_00101329; puVar3 = puVar3 + 1; } while (puVar3 != puVar1); uVar2 = 0xffffffff; LAB_00101329: do { if ((*param_1 & 1) != 0) { return uVar2 + *param_1; } param_1 = param_1 + 1; } while (param_1 != puVar1); return uVar2 - 1; }
7,419
func0
#include <assert.h>
int func0(int list1[], int size) { int first_even = -1; int first_odd = -1; for (int i = 0; i < size; i++) { if (list1[i] % 2 == 0) { first_even = list1[i]; break; } } for (int i = 0; i < size; i++) { if (list1[i] % 2 != 0) { first_odd = list1[i]; break; } } return first_even + first_odd; }
int main() { int list1[] = {1, 3, 5, 7, 4, 1, 6, 8}; int list2[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int list3[] = {1, 5, 7, 9, 10}; assert(func0(list1, 8) == 5); assert(func0(list2, 10) == 3); assert(func0(list3, 5) == 11); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 12f4 <func0+0x54> lea -0x1(%rsi),%eax mov %rdi,%rdx lea 0x4(%rdi,%rax,4),%rcx jmp 12c1 <func0+0x21> nopl (%rax) add $0x4,%rdx cmp %rcx,%rdx je 12e8 <func0+0x48> mov (%rdx),%eax test $0x1,%al jne 12b8 <func0+0x18> jmp 12d9 <func0+0x39> nopl 0x0(%rax) add $0x4,%rdi cmp %rcx,%rdi je 12f0 <func0+0x50> mov (%rdi),%edx test $0x1,%dl je 12d0 <func0+0x30> add %edx,%eax retq nopl 0x0(%rax,%rax,1) mov $0xffffffff,%eax jmp 12d9 <func0+0x39> sub $0x1,%eax retq mov $0xfffffffe,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle short loc_12E4 movsxd rsi, esi mov rdx, rdi lea rcx, [rdi+rsi*4] jmp short loc_12B1 loc_12A8: add rdx, 4 cmp rdx, rcx jz short loc_12D8 loc_12B1: mov eax, [rdx] test al, 1 jnz short loc_12A8 jmp short loc_12C9 loc_12C0: add rdi, 4 cmp rdi, rcx jz short loc_12E0 loc_12C9: mov edx, [rdi] test dl, 1 jz short loc_12C0 add eax, edx retn loc_12D8: mov eax, 0FFFFFFFFh jmp short loc_12C9 loc_12E0: sub eax, 1 retn loc_12E4: mov eax, 0FFFFFFFEh retn
long long func0(int *a1, int a2) { int *v2; // rdx int *v3; // rcx int v4; // eax if ( a2 <= 0 ) return 4294967294LL; v2 = a1; v3 = &a1[a2]; while ( 1 ) { v4 = *v2; if ( (*v2 & 1) == 0 ) break; if ( ++v2 == v3 ) { v4 = -1; goto LABEL_7; } } do { LABEL_7: if ( (*a1 & 1) != 0 ) return (unsigned int)(*a1 + v4); ++a1; } while ( a1 != v3 ); return (unsigned int)(v4 - 1); }
func0: ENDBR64 TEST ESI,ESI JLE 0x001012e4 MOVSXD RSI,ESI MOV RDX,RDI LEA RCX,[RDI + RSI*0x4] JMP 0x001012b1 LAB_001012a8: ADD RDX,0x4 CMP RDX,RCX JZ 0x001012d8 LAB_001012b1: MOV EAX,dword ptr [RDX] TEST AL,0x1 JNZ 0x001012a8 JMP 0x001012c9 LAB_001012c0: ADD RDI,0x4 CMP RDI,RCX JZ 0x001012e0 LAB_001012c9: MOV EDX,dword ptr [RDI] TEST DL,0x1 JZ 0x001012c0 ADD EAX,EDX RET LAB_001012d8: MOV EAX,0xffffffff JMP 0x001012c9 LAB_001012e0: SUB EAX,0x1 RET LAB_001012e4: MOV EAX,0xfffffffe RET
int func0(uint *param_1,int param_2) { uint *puVar1; uint uVar2; uint *puVar3; if (param_2 < 1) { return -2; } puVar1 = param_1 + param_2; puVar3 = param_1; do { uVar2 = *puVar3; if ((uVar2 & 1) == 0) goto LAB_001012c9; puVar3 = puVar3 + 1; } while (puVar3 != puVar1); uVar2 = 0xffffffff; LAB_001012c9: do { if ((*param_1 & 1) != 0) { return uVar2 + *param_1; } param_1 = param_1 + 1; } while (param_1 != puVar1); return uVar2 - 1; }
7,420
func0
#include <assert.h>
int func0(int b, int h) { int perimeter = 2 * (b + h); return perimeter; }
int main() { assert(func0(10, 20) == 60); assert(func0(15, 20) == 70); assert(func0(8, 9) == 34); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) mov -0x14(%rbp),%edx mov -0x18(%rbp),%eax add %edx,%eax add %eax,%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_18], esi mov edx, [rbp+var_14] mov eax, [rbp+var_18] add eax, edx add eax, eax mov [rbp+var_4], eax mov eax, [rbp+var_4] pop rbp retn
long long func0(int a1, int a2) { return (unsigned int)(2 * (a1 + a2)); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x18],ESI MOV EDX,dword ptr [RBP + -0x14] MOV EAX,dword ptr [RBP + -0x18] ADD EAX,EDX ADD EAX,EAX MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] POP RBP RET
int func0(int param_1,int param_2) { return (param_2 + param_1) * 2; }
7,421
func0
#include <assert.h>
int func0(int b, int h) { int perimeter = 2 * (b + h); return perimeter; }
int main() { assert(func0(10, 20) == 60); assert(func0(15, 20) == 70); assert(func0(8, 9) == 34); return 0; }
O1
c
func0: endbr64 add %esi,%edi lea (%rdi,%rdi,1),%eax retq
func0: endbr64 add edi, esi lea eax, [rdi+rdi] retn
long long func0(int a1, int a2) { return (unsigned int)(2 * (a2 + a1)); }
func0: ENDBR64 ADD EDI,ESI LEA EAX,[RDI + RDI*0x1] RET
int func0(int param_1,int param_2) { return (param_1 + param_2) * 2; }
7,422
func0
#include <assert.h>
int func0(int b, int h) { int perimeter = 2 * (b + h); return perimeter; }
int main() { assert(func0(10, 20) == 60); assert(func0(15, 20) == 70); assert(func0(8, 9) == 34); return 0; }
O2
c
func0: endbr64 add %esi,%edi lea (%rdi,%rdi,1),%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 add edi, esi lea eax, [rdi+rdi] retn
long long func0(int a1, int a2) { return (unsigned int)(2 * (a2 + a1)); }
func0: ENDBR64 ADD EDI,ESI LEA EAX,[RDI + RDI*0x1] RET
int func0(int param_1,int param_2) { return (param_1 + param_2) * 2; }
7,423
func0
#include <assert.h>
int func0(int b, int h) { int perimeter = 2 * (b + h); return perimeter; }
int main() { assert(func0(10, 20) == 60); assert(func0(15, 20) == 70); assert(func0(8, 9) == 34); return 0; }
O3
c
func0: endbr64 add %esi,%edi lea (%rdi,%rdi,1),%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 add edi, esi lea eax, [rdi+rdi] retn
long long func0(int a1, int a2) { return (unsigned int)(2 * (a2 + a1)); }
func0: ENDBR64 ADD EDI,ESI LEA EAX,[RDI + RDI*0x1] RET
int func0(int param_1,int param_2) { return (param_1 + param_2) * 2; }
7,424
func0
#include <stdio.h> #include <assert.h>
int* func0(int nums[], int size, int m, int n, int *result_size) { static int result[100]; int count = 0; for (int i = 0; i < size; i++) { if (nums[i] % m == 0 && nums[i] % n == 0) { result[count++] = nums[i]; } } *result_size = count; return result; }
int main() { int size; int result1_size; int arr1[] = {19, 65, 57, 39, 152, 639, 121, 44, 90, 190}; int expected1[] = {152, 44}; int* result1 = func0(arr1, 10, 2, 4, &result1_size); assert(result1_size == 2); for (int i = 0; i < result1_size; i++) { assert(result1[i] == expected1[i]); } int result2_size; int arr2[] = {1, 2, 3, 5, 7, 8, 10}; int expected2[] = {10}; int* result2 = func0(arr2, 7, 2, 5, &result2_size); assert(result2_size == 1); for (int i = 0; i < result2_size; i++) { assert(result2[i] == expected2[i]); } int result3_size; int arr3[] = {10, 15, 14, 13, 18, 12, 20}; int expected3[] = {10, 20}; int* result3 = func0(arr3, 7, 10, 5, &result3_size); assert(result3_size == 2); for (int i = 0; i < result3_size; i++) { assert(result3[i] == expected3[i]); } return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %edx,-0x20(%rbp) mov %ecx,-0x24(%rbp) mov %r8,-0x30(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 120a <func0+0xa1> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax cltd idivl -0x20(%rbp) mov %edx,%eax test %eax,%eax jne 1206 <func0+0x9d> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax cltd idivl -0x24(%rbp) mov %edx,%eax test %eax,%eax jne 1206 <func0+0x9d> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x8(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x8(%rbp) mov (%rcx),%edx cltq lea 0x0(,%rax,4),%rcx lea 0x2e3d(%rip),%rax mov %edx,(%rcx,%rax,1) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1192 <func0+0x29> mov -0x30(%rbp),%rax mov -0x8(%rbp),%edx mov %edx,(%rax) lea 0x2e1e(%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_20], edx mov [rbp+var_24], ecx mov [rbp+var_30], r8 mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_120A loc_1192: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] cdq idiv [rbp+var_20] mov eax, edx test eax, eax jnz short loc_1206 mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] cdq idiv [rbp+var_24] mov eax, edx test eax, eax jnz short loc_1206 mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] lea rcx, [rdx+rax] mov eax, [rbp+var_8] lea edx, [rax+1] mov [rbp+var_8], edx mov edx, [rcx] cdqe lea rcx, ds:0[rax*4] lea rax, result_1 mov [rcx+rax], edx loc_1206: add [rbp+var_4], 1 loc_120A: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1192 mov rax, [rbp+var_30] mov edx, [rbp+var_8] mov [rax], edx lea rax, result_1 pop rbp retn
_DWORD * func0(long long a1, int a2, int a3, int a4, _DWORD *a5) { int v5; // eax int v7; // [rsp+28h] [rbp-8h] int i; // [rsp+2Ch] [rbp-4h] v7 = 0; for ( i = 0; i < a2; ++i ) { if ( !(*(_DWORD *)(4LL * i + a1) % a3) && !(*(_DWORD *)(4LL * i + a1) % a4) ) { v5 = v7++; result_1[v5] = *(_DWORD *)(4LL * i + a1); } } *a5 = v7; return result_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x20],EDX MOV dword ptr [RBP + -0x24],ECX MOV qword ptr [RBP + -0x30],R8 MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x0010120a LAB_00101192: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] CDQ IDIV dword ptr [RBP + -0x20] MOV EAX,EDX TEST EAX,EAX JNZ 0x00101206 MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] CDQ IDIV dword ptr [RBP + -0x24] MOV EAX,EDX TEST EAX,EAX JNZ 0x00101206 MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] LEA RCX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x8] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x8],EDX MOV EDX,dword ptr [RCX] CDQE LEA RCX,[RAX*0x4] LEA RAX,[0x104040] MOV dword ptr [RCX + RAX*0x1],EDX LAB_00101206: ADD dword ptr [RBP + -0x4],0x1 LAB_0010120a: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101192 MOV RAX,qword ptr [RBP + -0x30] MOV EDX,dword ptr [RBP + -0x8] MOV dword ptr [RAX],EDX LEA RAX,[0x104040] POP RBP RET
int1 * func0(long param_1,int param_2,int param_3,int param_4,int *param_5) { int local_10; int 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) % param_3 == 0) && (*(int *)(param_1 + (long)local_c * 4) % param_4 == 0)) { *(int4 *)(result_1 + (long)local_10 * 4) = *(int4 *)((long)local_c * 4 + param_1); local_10 = local_10 + 1; } } *param_5 = local_10; return result_1; }
7,425
func0
#include <stdio.h> #include <assert.h>
int* func0(int nums[], int size, int m, int n, int *result_size) { static int result[100]; int count = 0; for (int i = 0; i < size; i++) { if (nums[i] % m == 0 && nums[i] % n == 0) { result[count++] = nums[i]; } } *result_size = count; return result; }
int main() { int size; int result1_size; int arr1[] = {19, 65, 57, 39, 152, 639, 121, 44, 90, 190}; int expected1[] = {152, 44}; int* result1 = func0(arr1, 10, 2, 4, &result1_size); assert(result1_size == 2); for (int i = 0; i < result1_size; i++) { assert(result1[i] == expected1[i]); } int result2_size; int arr2[] = {1, 2, 3, 5, 7, 8, 10}; int expected2[] = {10}; int* result2 = func0(arr2, 7, 2, 5, &result2_size); assert(result2_size == 1); for (int i = 0; i < result2_size; i++) { assert(result2[i] == expected2[i]); } int result3_size; int arr3[] = {10, 15, 14, 13, 18, 12, 20}; int expected3[] = {10, 20}; int* result3 = func0(arr3, 7, 10, 5, &result3_size); assert(result3_size == 2); for (int i = 0; i < result3_size; i++) { assert(result3[i] == expected3[i]); } return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11ba <func0+0x51> push %rbx mov %edx,%r10d mov %rdi,%r9 lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rdi mov $0x0,%r11d lea 0x2eb3(%rip),%rbx jmp 1198 <func0+0x2f> add $0x4,%r9 cmp %rdi,%r9 je 11cb <func0+0x62> mov (%r9),%esi mov %esi,%eax cltd idiv %r10d test %edx,%edx jne 118f <func0+0x26> mov %esi,%eax cltd idiv %ecx test %edx,%edx jne 118f <func0+0x26> movslq %r11d,%rax mov %esi,(%rbx,%rax,4) lea 0x1(%r11),%r11d jmp 118f <func0+0x26> mov $0x0,%r11d mov %r11d,(%r8) lea 0x2e76(%rip),%rax retq mov %r11d,(%r8) lea 0x2e6b(%rip),%rax pop %rbx retq
func0: endbr64 test esi, esi jle short loc_11BC push rbx mov r10d, edx mov r11d, ecx mov r9, rdi lea eax, [rsi-1] lea rsi, [rdi+rax*4+4] mov edi, 0 lea rbx, result_1 jmp short loc_119A loc_1191: add r9, 4 cmp r9, rsi jz short loc_11CC loc_119A: mov ecx, [r9] mov eax, ecx cdq idiv r10d test edx, edx jnz short loc_1191 mov eax, ecx cdq idiv r11d test edx, edx jnz short loc_1191 movsxd rax, edi mov [rbx+rax*4], ecx lea edi, [rdi+1] jmp short loc_1191 loc_11BC: mov edi, 0 mov [r8], edi lea rax, result_1 retn loc_11CC: mov [r8], edi lea rax, result_1 pop rbx retn
_DWORD * func0(int *a1, int a2, int a3, int a4, _DWORD *a5) { int *v6; // r9 long long v7; // rsi int v8; // edi int v9; // ecx if ( a2 <= 0 ) { *a5 = 0; return result_1; } else { v6 = a1; v7 = (long long)&a1[a2 - 1 + 1]; v8 = 0; do { v9 = *v6; if ( !(*v6 % a3) && !(v9 % a4) ) result_1[v8++] = v9; ++v6; } while ( v6 != (int *)v7 ); *a5 = v8; return result_1; } }
func0: ENDBR64 TEST ESI,ESI JLE 0x001011bc PUSH RBX MOV R10D,EDX MOV R11D,ECX MOV R9,RDI LEA EAX,[RSI + -0x1] LEA RSI,[RDI + RAX*0x4 + 0x4] MOV EDI,0x0 LEA RBX,[0x104040] JMP 0x0010119a LAB_00101191: ADD R9,0x4 CMP R9,RSI JZ 0x001011cc LAB_0010119a: MOV ECX,dword ptr [R9] MOV EAX,ECX CDQ IDIV R10D TEST EDX,EDX JNZ 0x00101191 MOV EAX,ECX CDQ IDIV R11D TEST EDX,EDX JNZ 0x00101191 MOVSXD RAX,EDI MOV dword ptr [RBX + RAX*0x4],ECX LEA EDI,[RDI + 0x1] JMP 0x00101191 LAB_001011bc: MOV EDI,0x0 MOV dword ptr [R8],EDI LEA RAX,[0x104040] RET LAB_001011cc: MOV dword ptr [R8],EDI LEA RAX,[0x104040] POP RBX RET
int4 * func0(int *param_1,int param_2,int param_3,int param_4,int *param_5) { int *piVar1; int iVar2; int iVar3; if (0 < param_2) { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar3 = 0; do { iVar2 = *param_1; if ((iVar2 % param_3 == 0) && (iVar2 % param_4 == 0)) { (&result_1)[iVar3] = iVar2; iVar3 = iVar3 + 1; } param_1 = param_1 + 1; } while (param_1 != piVar1); *param_5 = iVar3; return &result_1; } *param_5 = 0; return &result_1; }
7,426
func0
#include <stdio.h> #include <assert.h>
int* func0(int nums[], int size, int m, int n, int *result_size) { static int result[100]; int count = 0; for (int i = 0; i < size; i++) { if (nums[i] % m == 0 && nums[i] % n == 0) { result[count++] = nums[i]; } } *result_size = count; return result; }
int main() { int size; int result1_size; int arr1[] = {19, 65, 57, 39, 152, 639, 121, 44, 90, 190}; int expected1[] = {152, 44}; int* result1 = func0(arr1, 10, 2, 4, &result1_size); assert(result1_size == 2); for (int i = 0; i < result1_size; i++) { assert(result1[i] == expected1[i]); } int result2_size; int arr2[] = {1, 2, 3, 5, 7, 8, 10}; int expected2[] = {10}; int* result2 = func0(arr2, 7, 2, 5, &result2_size); assert(result2_size == 1); for (int i = 0; i < result2_size; i++) { assert(result2[i] == expected2[i]); } int result3_size; int arr3[] = {10, 15, 14, 13, 18, 12, 20}; int expected3[] = {10, 20}; int* result3 = func0(arr3, 7, 10, 5, &result3_size); assert(result3_size == 2); for (int i = 0; i < result3_size; i++) { assert(result3[i] == expected3[i]); } return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 14c8 <func0+0x58> lea -0x1(%rsi),%eax push %rbx mov %edx,%r11d xor %r10d,%r10d lea 0x4(%rdi,%rax,4),%r9 lea 0x2bb2(%rip),%rbx xchg %ax,%ax mov (%rdi),%esi mov %esi,%eax cltd idiv %r11d test %edx,%edx jne 14af <func0+0x3f> mov %esi,%eax cltd idiv %ecx test %edx,%edx jne 14af <func0+0x3f> movslq %r10d,%rax add $0x1,%r10d mov %esi,(%rbx,%rax,4) add $0x4,%rdi cmp %r9,%rdi jne 1490 <func0+0x20> lea 0x2b81(%rip),%rax mov %r10d,(%r8) pop %rbx retq nopl 0x0(%rax) xor %r10d,%r10d lea 0x2b6e(%rip),%rax mov %r10d,(%r8) retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r12 test esi, esi jle short loc_1420 lea eax, [rsi-1] mov r9d, edx mov r10d, ecx xor r11d, r11d lea rsi, [rdi+rax*4+4] lea r12, result_1 nop word ptr [rax+rax+00h] loc_13E8: mov ecx, [rdi] mov eax, ecx cdq idiv r9d test edx, edx jnz short loc_1409 mov eax, ecx cdq idiv r10d test edx, edx jnz short loc_1409 movsxd rax, r11d add r11d, 1 mov [r12+rax*4], ecx loc_1409: add rdi, 4 cmp rdi, rsi jnz short loc_13E8 mov rax, r12 mov [r8], r11d pop r12 retn loc_1420: lea r12, result_1 xor r11d, r11d mov rax, r12 mov [r8], r11d pop r12 retn
_DWORD * func0(int *a1, int a2, int a3, int a4, _DWORD *a5) { int v6; // r11d long long v7; // rsi int v8; // ecx long long v9; // rax _DWORD *result; // rax if ( a2 <= 0 ) { result = result_1; *a5 = 0; } else { v6 = 0; v7 = (long long)&a1[a2 - 1 + 1]; do { v8 = *a1; if ( !(*a1 % a3) && !(v8 % a4) ) { v9 = v6++; result_1[v9] = v8; } ++a1; } while ( a1 != (int *)v7 ); result = result_1; *a5 = v6; } return result; }
func0: ENDBR64 PUSH R12 TEST ESI,ESI JLE 0x00101420 LEA EAX,[RSI + -0x1] MOV R9D,EDX MOV R10D,ECX XOR R11D,R11D LEA RSI,[RDI + RAX*0x4 + 0x4] LEA R12,[0x104040] NOP word ptr [RAX + RAX*0x1] LAB_001013e8: MOV ECX,dword ptr [RDI] MOV EAX,ECX CDQ IDIV R9D TEST EDX,EDX JNZ 0x00101409 MOV EAX,ECX CDQ IDIV R10D TEST EDX,EDX JNZ 0x00101409 MOVSXD RAX,R11D ADD R11D,0x1 MOV dword ptr [R12 + RAX*0x4],ECX LAB_00101409: ADD RDI,0x4 CMP RDI,RSI JNZ 0x001013e8 MOV RAX,R12 MOV dword ptr [R8],R11D POP R12 RET LAB_00101420: LEA R12,[0x104040] XOR R11D,R11D MOV RAX,R12 MOV dword ptr [R8],R11D POP R12 RET
int4 * func0(int *param_1,int param_2,int param_3,int param_4,int *param_5) { int *piVar1; int iVar2; long lVar3; int iVar4; if (0 < param_2) { iVar4 = 0; piVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { iVar2 = *param_1; if ((iVar2 % param_3 == 0) && (iVar2 % param_4 == 0)) { lVar3 = (long)iVar4; iVar4 = iVar4 + 1; (&result_1)[lVar3] = iVar2; } param_1 = param_1 + 1; } while (param_1 != piVar1); *param_5 = iVar4; return &result_1; } *param_5 = 0; return &result_1; }
7,427
func0
#include <stdio.h> #include <assert.h>
int* func0(int nums[], int size, int m, int n, int *result_size) { static int result[100]; int count = 0; for (int i = 0; i < size; i++) { if (nums[i] % m == 0 && nums[i] % n == 0) { result[count++] = nums[i]; } } *result_size = count; return result; }
int main() { int size; int result1_size; int arr1[] = {19, 65, 57, 39, 152, 639, 121, 44, 90, 190}; int expected1[] = {152, 44}; int* result1 = func0(arr1, 10, 2, 4, &result1_size); assert(result1_size == 2); for (int i = 0; i < result1_size; i++) { assert(result1[i] == expected1[i]); } int result2_size; int arr2[] = {1, 2, 3, 5, 7, 8, 10}; int expected2[] = {10}; int* result2 = func0(arr2, 7, 2, 5, &result2_size); assert(result2_size == 1); for (int i = 0; i < result2_size; i++) { assert(result2[i] == expected2[i]); } int result3_size; int arr3[] = {10, 15, 14, 13, 18, 12, 20}; int expected3[] = {10, 20}; int* result3 = func0(arr3, 7, 10, 5, &result3_size); assert(result3_size == 2); for (int i = 0; i < result3_size; i++) { assert(result3[i] == expected3[i]); } return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 15e8 <func0+0x58> lea -0x1(%rsi),%eax push %rbx mov %edx,%r11d xor %r10d,%r10d lea 0x4(%rdi,%rax,4),%r9 lea 0x2a92(%rip),%rbx xchg %ax,%ax mov (%rdi),%esi mov %esi,%eax cltd idiv %r11d test %edx,%edx jne 15cf <func0+0x3f> mov %esi,%eax cltd idiv %ecx test %edx,%edx jne 15cf <func0+0x3f> movslq %r10d,%rax add $0x1,%r10d mov %esi,(%rbx,%rax,4) add $0x4,%rdi cmp %r9,%rdi jne 15b0 <func0+0x20> lea 0x2a61(%rip),%rax mov %r10d,(%r8) pop %rbx retq nopl 0x0(%rax) xor %r10d,%r10d lea 0x2a4e(%rip),%rax mov %r10d,(%r8) retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push rbx test esi, esi jle short loc_11A8 movsxd rsi, esi mov r9d, edx mov r10d, ecx xor r11d, r11d lea rsi, [rdi+rsi*4] lea rbx, result_1 loc_1170: mov ecx, [rdi] mov eax, ecx cdq idiv r9d test edx, edx jnz short loc_1190 mov eax, ecx cdq idiv r10d test edx, edx jnz short loc_1190 movsxd rax, r11d add r11d, 1 mov [rbx+rax*4], ecx loc_1190: add rdi, 4 cmp rsi, rdi jnz short loc_1170 mov rax, rbx mov [r8], r11d pop rbx retn loc_11A8: lea rbx, result_1 xor r11d, r11d mov rax, rbx mov [r8], r11d pop rbx retn
long long * func0(int *a1, int a2, int a3, int a4, _DWORD *a5) { int v6; // r11d int *v7; // rsi int v8; // ecx long long v9; // rax long long *result; // rax if ( a2 <= 0 ) { result = &result_1; *a5 = 0; } else { v6 = 0; v7 = &a1[a2]; do { v8 = *a1; if ( !(*a1 % a3) && !(v8 % a4) ) { v9 = v6++; *((_DWORD *)&result_1 + v9) = v8; } ++a1; } while ( v7 != a1 ); result = &result_1; *a5 = v6; } return result; }
func0: ENDBR64 PUSH RBX TEST ESI,ESI JLE 0x001011a8 MOVSXD RSI,ESI MOV R9D,EDX MOV R10D,ECX XOR R11D,R11D LEA RSI,[RDI + RSI*0x4] LEA RBX,[0x104040] LAB_00101170: MOV ECX,dword ptr [RDI] MOV EAX,ECX CDQ IDIV R9D TEST EDX,EDX JNZ 0x00101190 MOV EAX,ECX CDQ IDIV R10D TEST EDX,EDX JNZ 0x00101190 MOVSXD RAX,R11D ADD R11D,0x1 MOV dword ptr [RBX + RAX*0x4],ECX LAB_00101190: ADD RDI,0x4 CMP RSI,RDI JNZ 0x00101170 MOV RAX,RBX MOV dword ptr [R8],R11D POP RBX RET LAB_001011a8: LEA RBX,[0x104040] XOR R11D,R11D MOV RAX,RBX MOV dword ptr [R8],R11D POP RBX RET
int4 * func0(int *param_1,int param_2,int param_3,int param_4,int *param_5) { int *piVar1; int iVar2; long lVar3; int iVar4; if (0 < param_2) { iVar4 = 0; piVar1 = param_1 + param_2; do { iVar2 = *param_1; if ((iVar2 % param_3 == 0) && (iVar2 % param_4 == 0)) { lVar3 = (long)iVar4; iVar4 = iVar4 + 1; (&result_1)[lVar3] = iVar2; } param_1 = param_1 + 1; } while (piVar1 != param_1); *param_5 = iVar4; return &result_1; } *param_5 = 0; return &result_1; }
7,428
func0
#include <assert.h>
int func0(int n, int l, int r) { int num = ((1 << r) - 1) ^ ((1 << (l - 1)) - 1); int new_num = n & num; if (num == new_num) { return 1; // true } return 0; // false }
int main() { assert(func0(10, 2, 1) == 1); assert(func0(5, 2, 4) == 0); assert(func0(22, 2, 3) == 1); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) mov %edx,-0x1c(%rbp) mov -0x1c(%rbp),%eax mov $0x1,%edx mov %eax,%ecx shl %cl,%edx mov %edx,%eax lea -0x1(%rax),%edx mov -0x18(%rbp),%eax sub $0x1,%eax mov $0x1,%esi mov %eax,%ecx shl %cl,%esi mov %esi,%eax sub $0x1,%eax xor %edx,%eax mov %eax,-0x8(%rbp) mov -0x14(%rbp),%eax and -0x8(%rbp),%eax mov %eax,-0x4(%rbp) mov -0x8(%rbp),%eax cmp -0x4(%rbp),%eax jne 119c <func0+0x53> mov $0x1,%eax jmp 11a1 <func0+0x58> mov $0x0,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_18], esi mov [rbp+var_1C], edx mov eax, [rbp+var_1C] mov edx, 1 mov ecx, eax shl edx, cl mov eax, edx lea edx, [rax-1] mov eax, [rbp+var_18] sub eax, 1 mov esi, 1 mov ecx, eax shl esi, cl mov eax, esi sub eax, 1 xor eax, edx mov [rbp+var_8], eax mov eax, [rbp+var_14] and eax, [rbp+var_8] mov [rbp+var_4], eax mov eax, [rbp+var_8] cmp eax, [rbp+var_4] jnz short loc_119C mov eax, 1 jmp short loc_11A1 loc_119C: mov eax, 0 loc_11A1: pop rbp retn
_BOOL8 func0(int a1, char a2, char a3) { int v4; // [rsp+14h] [rbp-8h] v4 = ((1 << a3) - 1) ^ ((1 << (a2 - 1)) - 1); return v4 == (v4 & a1); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x18],ESI MOV dword ptr [RBP + -0x1c],EDX MOV EAX,dword ptr [RBP + -0x1c] MOV EDX,0x1 MOV ECX,EAX SHL EDX,CL MOV EAX,EDX LEA EDX,[RAX + -0x1] MOV EAX,dword ptr [RBP + -0x18] SUB EAX,0x1 MOV ESI,0x1 MOV ECX,EAX SHL ESI,CL MOV EAX,ESI SUB EAX,0x1 XOR EAX,EDX MOV dword ptr [RBP + -0x8],EAX MOV EAX,dword ptr [RBP + -0x14] AND EAX,dword ptr [RBP + -0x8] MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x4] JNZ 0x0010119c MOV EAX,0x1 JMP 0x001011a1 LAB_0010119c: MOV EAX,0x0 LAB_001011a1: POP RBP RET
bool func0(uint param_1,char param_2,byte param_3) { uint uVar1; uVar1 = (1 << (param_2 - 1U & 0x1f)) - 1U ^ (1 << (param_3 & 0x1f)) - 1U; return uVar1 == (param_1 & uVar1); }
7,429
func0
#include <assert.h>
int func0(int n, int l, int r) { int num = ((1 << r) - 1) ^ ((1 << (l - 1)) - 1); int new_num = n & num; if (num == new_num) { return 1; // true } return 0; // false }
int main() { assert(func0(10, 2, 1) == 1); assert(func0(5, 2, 4) == 0); assert(func0(22, 2, 3) == 1); return 0; }
O1
c
func0: endbr64 lea -0x1(%rsi),%ecx mov $0x1,%r8d mov %r8d,%eax shl %cl,%eax sub $0x1,%eax mov %edx,%ecx shl %cl,%r8d sub $0x1,%r8d xor %r8d,%eax and %eax,%edi cmp %eax,%edi sete %al movzbl %al,%eax retq
func0: endbr64 lea ecx, [rsi-1] mov r8d, 1 mov eax, r8d shl eax, cl sub eax, 1 mov ecx, edx shl r8d, cl sub r8d, 1 xor eax, r8d and edi, eax cmp edi, eax setz al movzx eax, al retn
_BOOL8 func0(int a1, char a2, char a3) { int v3; // eax v3 = ((1 << a3) - 1) ^ ((1 << (a2 - 1)) - 1); return (v3 & a1) == v3; }
func0: ENDBR64 LEA ECX,[RSI + -0x1] MOV R8D,0x1 MOV EAX,R8D SHL EAX,CL SUB EAX,0x1 MOV ECX,EDX SHL R8D,CL SUB R8D,0x1 XOR EAX,R8D AND EDI,EAX CMP EDI,EAX SETZ AL MOVZX EAX,AL RET
bool func0(uint param_1,char param_2,byte param_3) { uint uVar1; uVar1 = (1 << (param_2 - 1U & 0x1f)) - 1U ^ (1 << (param_3 & 0x1f)) - 1U; return (param_1 & uVar1) == uVar1; }
7,430
func0
#include <assert.h>
int func0(int n, int l, int r) { int num = ((1 << r) - 1) ^ ((1 << (l - 1)) - 1); int new_num = n & num; if (num == new_num) { return 1; // true } return 0; // false }
int main() { assert(func0(10, 2, 1) == 1); assert(func0(5, 2, 4) == 0); assert(func0(22, 2, 3) == 1); return 0; }
O2
c
func0: endbr64 mov $0x1,%r8d lea -0x1(%rsi),%ecx mov %r8d,%eax shl %cl,%eax mov %edx,%ecx shl %cl,%r8d sub $0x1,%eax sub $0x1,%r8d xor %r8d,%eax and %eax,%edi cmp %eax,%edi sete %al movzbl %al,%eax retq nopl 0x0(%rax)
func0: endbr64 mov r8d, 1 lea ecx, [rsi-1] mov eax, r8d shl eax, cl mov ecx, edx shl r8d, cl sub eax, 1 sub r8d, 1 xor eax, r8d and edi, eax cmp edi, eax setz al movzx eax, al retn
_BOOL8 func0(int a1, char a2, char a3) { int v3; // eax v3 = ((1 << a3) - 1) ^ ((1 << (a2 - 1)) - 1); return (v3 & a1) == v3; }
func0: ENDBR64 MOV R8D,0x1 LEA ECX,[RSI + -0x1] MOV EAX,R8D SHL EAX,CL MOV ECX,EDX SHL R8D,CL SUB EAX,0x1 SUB R8D,0x1 XOR EAX,R8D AND EDI,EAX CMP EDI,EAX SETZ AL MOVZX EAX,AL RET
bool func0(uint param_1,char param_2,byte param_3) { uint uVar1; uVar1 = (1 << (param_2 - 1U & 0x1f)) - 1U ^ (1 << (param_3 & 0x1f)) - 1U; return (param_1 & uVar1) == uVar1; }
7,431
func0
#include <assert.h>
int func0(int n, int l, int r) { int num = ((1 << r) - 1) ^ ((1 << (l - 1)) - 1); int new_num = n & num; if (num == new_num) { return 1; // true } return 0; // false }
int main() { assert(func0(10, 2, 1) == 1); assert(func0(5, 2, 4) == 0); assert(func0(22, 2, 3) == 1); return 0; }
O3
c
func0: endbr64 mov $0x1,%r8d lea -0x1(%rsi),%ecx mov %r8d,%eax shl %cl,%eax mov %edx,%ecx shl %cl,%r8d sub $0x1,%eax sub $0x1,%r8d xor %r8d,%eax and %eax,%edi cmp %eax,%edi sete %al movzbl %al,%eax retq nopl 0x0(%rax)
func0: endbr64 mov eax, 1 lea ecx, [rsi-1] not edi mov esi, eax shl esi, cl mov ecx, edx shl eax, cl sub esi, 1 sub eax, 1 xor esi, eax xor eax, eax test edi, esi setz al retn
_BOOL8 func0(int a1, char a2, char a3) { return ((((1 << a3) - 1) ^ ((1 << (a2 - 1)) - 1)) & ~a1) == 0; }
func0: ENDBR64 MOV EAX,0x1 LEA ECX,[RSI + -0x1] NOT EDI MOV ESI,EAX SHL ESI,CL MOV ECX,EDX SHL EAX,CL SUB ESI,0x1 SUB EAX,0x1 XOR ESI,EAX XOR EAX,EAX TEST EDI,ESI SETZ AL RET
bool func0(uint param_1,char param_2,byte param_3) { return (~param_1 & ((1 << (param_2 - 1U & 0x1f)) - 1U ^ (1 << (param_3 & 0x1f)) - 1U)) == 0; }
7,432
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(const char *str1, const char *str2) { if (strlen(str1) != strlen(str2)) { return 0; } int dict_str1[256][1000]; int counts_str1[256] = {0}; int dict_str2[256][1000]; int counts_str2[256] = {0}; int n = strlen(str1); for (int i = 0; i < n; i++) { unsigned char c1 = str1[i]; dict_str1[c1][counts_str1[c1]++] = i; unsigned char c2 = str2[i]; dict_str2[c2][counts_str2[c2]++] = i; } // Compare the count of unique characters int unique1 = 0, unique2 = 0; for (int c = 0; c < 256; c++) { if (counts_str1[c] > 0) unique1++; if (counts_str2[c] > 0) unique2++; } if (unique1 != unique2) { return 0; } // Compare the lists of indices for (int c1 = 0; c1 < 256; c1++) { if (counts_str1[c1] == 0) continue; int found = 0; for (int c2 = 0; c2 < 256; c2++) { if (counts_str2[c2] != counts_str1[c1]) continue; int match = 1; for (int k = 0; k < counts_str1[c1]; k++) { if (dict_str1[c1][k] != dict_str2[c2][k]) { match = 0; break; } } if (match) { found = 1; break; } } if (!found) return 0; } return 1; }
int main() { assert(func0("paper", "title") == 1); assert(func0("ab", "ba") == 1); assert(func0("ab", "aa") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx lea -0x1f4000(%rsp),%r11 sub $0x1000,%rsp orq $0x0,(%rsp) cmp %r11,%rsp jne 119a <func0+0x11> sub $0x858,%rsp mov %rdi,-0x1f4858(%rbp) mov %rsi,-0x1f4860(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax mov -0x1f4858(%rbp),%rax mov %rax,%rdi callq 1070 <strlen@plt> mov %rax,%rbx mov -0x1f4860(%rbp),%rax mov %rax,%rdi callq 1070 <strlen@plt> cmp %rax,%rbx je 11ff <func0+0x76> mov $0x0,%eax jmpq 14ea <func0+0x361> lea -0x1f4820(%rbp),%rdx mov $0x0,%eax mov $0x80,%ecx mov %rdx,%rdi rep stos %rax,%es:(%rdi) lea -0x1f4420(%rbp),%rdx mov $0x0,%eax mov $0x80,%ecx mov %rdx,%rdi rep stos %rax,%es:(%rdi) mov -0x1f4858(%rbp),%rax mov %rax,%rdi callq 1070 <strlen@plt> mov %eax,-0x1f4824(%rbp) movl $0x0,-0x1f4848(%rbp) jmpq 1312 <func0+0x189> mov -0x1f4848(%rbp),%eax movslq %eax,%rdx mov -0x1f4858(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax mov %al,-0x1f484a(%rbp) movzbl -0x1f484a(%rbp),%esi movzbl -0x1f484a(%rbp),%edx movslq %edx,%rax mov -0x1f4820(%rbp,%rax,4),%eax lea 0x1(%rax),%ecx movslq %edx,%rdx mov %ecx,-0x1f4820(%rbp,%rdx,4) cltq movslq %esi,%rdx imul $0x3e8,%rdx,%rdx add %rax,%rdx mov -0x1f4848(%rbp),%eax mov %eax,-0x1f4020(%rbp,%rdx,4) mov -0x1f4848(%rbp),%eax movslq %eax,%rdx mov -0x1f4860(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax mov %al,-0x1f4849(%rbp) movzbl -0x1f4849(%rbp),%esi movzbl -0x1f4849(%rbp),%edx movslq %edx,%rax mov -0x1f4420(%rbp,%rax,4),%eax lea 0x1(%rax),%ecx movslq %edx,%rdx mov %ecx,-0x1f4420(%rbp,%rdx,4) cltq movslq %esi,%rdx imul $0x3e8,%rdx,%rdx add %rax,%rdx mov -0x1f4848(%rbp),%eax mov %eax,-0xfa020(%rbp,%rdx,4) addl $0x1,-0x1f4848(%rbp) mov -0x1f4848(%rbp),%eax cmp -0x1f4824(%rbp),%eax jl 1251 <func0+0xc8> movl $0x0,-0x1f4844(%rbp) movl $0x0,-0x1f4840(%rbp) movl $0x0,-0x1f483c(%rbp) jmp 137f <func0+0x1f6> mov -0x1f483c(%rbp),%eax cltq mov -0x1f4820(%rbp,%rax,4),%eax test %eax,%eax jle 135e <func0+0x1d5> addl $0x1,-0x1f4844(%rbp) mov -0x1f483c(%rbp),%eax cltq mov -0x1f4420(%rbp,%rax,4),%eax test %eax,%eax jle 1378 <func0+0x1ef> addl $0x1,-0x1f4840(%rbp) addl $0x1,-0x1f483c(%rbp) cmpl $0xff,-0x1f483c(%rbp) jle 1344 <func0+0x1bb> mov -0x1f4844(%rbp),%eax cmp -0x1f4840(%rbp),%eax je 13a3 <func0+0x21a> mov $0x0,%eax jmpq 14ea <func0+0x361> movl $0x0,-0x1f4838(%rbp) jmpq 14d5 <func0+0x34c> mov -0x1f4838(%rbp),%eax cltq mov -0x1f4820(%rbp,%rax,4),%eax test %eax,%eax je 14cd <func0+0x344> movl $0x0,-0x1f4834(%rbp) movl $0x0,-0x1f4830(%rbp) jmpq 14ad <func0+0x324> mov -0x1f4830(%rbp),%eax cltq mov -0x1f4420(%rbp,%rax,4),%edx mov -0x1f4838(%rbp),%eax cltq mov -0x1f4820(%rbp,%rax,4),%eax cmp %eax,%edx jne 14a5 <func0+0x31c> movl $0x1,-0x1f482c(%rbp) movl $0x0,-0x1f4828(%rbp) jmp 1479 <func0+0x2f0> mov -0x1f4828(%rbp),%eax cltq mov -0x1f4838(%rbp),%edx movslq %edx,%rdx imul $0x3e8,%rdx,%rdx add %rdx,%rax mov -0x1f4020(%rbp,%rax,4),%edx mov -0x1f4828(%rbp),%eax cltq mov -0x1f4830(%rbp),%ecx movslq %ecx,%rcx imul $0x3e8,%rcx,%rcx add %rcx,%rax mov -0xfa020(%rbp,%rax,4),%eax cmp %eax,%edx je 1472 <func0+0x2e9> movl $0x0,-0x1f482c(%rbp) jmp 1490 <func0+0x307> addl $0x1,-0x1f4828(%rbp) mov -0x1f4838(%rbp),%eax cltq mov -0x1f4820(%rbp,%rax,4),%eax cmp %eax,-0x1f4828(%rbp) jl 141e <func0+0x295> cmpl $0x0,-0x1f482c(%rbp) je 14a6 <func0+0x31d> movl $0x1,-0x1f4834(%rbp) jmp 14bd <func0+0x334> addl $0x1,-0x1f4830(%rbp) cmpl $0xff,-0x1f4830(%rbp) jle 13e2 <func0+0x259> cmpl $0x0,-0x1f4834(%rbp) jne 14ce <func0+0x345> mov $0x0,%eax jmp 14ea <func0+0x361> addl $0x1,-0x1f4838(%rbp) cmpl $0xff,-0x1f4838(%rbp) jle 13b2 <func0+0x229> mov $0x1,%eax mov -0x18(%rbp),%rbx xor %fs:0x28,%rbx je 14fe <func0+0x375> callq 1080 <__stack_chk_fail@plt> add $0x1f4858,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx lea r11, [rsp+8+var_1F4008] loc_119A: sub rsp, 1000h or [rsp+1008h+var_1008], 0 cmp rsp, r11 jnz short loc_119A sub rsp, 858h mov [rbp+s], rdi mov [rbp+var_1F4860], rsi mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax mov rax, [rbp+s] mov rdi, rax; s call _strlen mov rbx, rax mov rax, [rbp+var_1F4860] mov rdi, rax; s call _strlen cmp rbx, rax jz short loc_11FF mov eax, 0 jmp loc_14EA loc_11FF: lea rdx, [rbp+var_1F4820] mov eax, 0 mov ecx, 80h mov rdi, rdx rep stosq lea rdx, [rbp+var_1F4420] mov eax, 0 mov ecx, 80h mov rdi, rdx rep stosq mov rax, [rbp+s] mov rdi, rax; s call _strlen mov [rbp+var_1F4824], eax mov [rbp+var_1F4848], 0 jmp loc_1312 loc_1251: mov eax, [rbp+var_1F4848] movsxd rdx, eax mov rax, [rbp+s] add rax, rdx movzx eax, byte ptr [rax] mov [rbp+var_1F484A], al movzx esi, [rbp+var_1F484A] movzx edx, [rbp+var_1F484A] movsxd rax, edx mov eax, [rbp+rax*4+var_1F4820] lea ecx, [rax+1] movsxd rdx, edx mov [rbp+rdx*4+var_1F4820], ecx cdqe movsxd rdx, esi imul rdx, 3E8h add rdx, rax mov eax, [rbp+var_1F4848] mov [rbp+rdx*4+var_1F4020], eax mov eax, [rbp+var_1F4848] movsxd rdx, eax mov rax, [rbp+var_1F4860] add rax, rdx movzx eax, byte ptr [rax] mov [rbp+var_1F4849], al movzx esi, [rbp+var_1F4849] movzx edx, [rbp+var_1F4849] movsxd rax, edx mov eax, [rbp+rax*4+var_1F4420] lea ecx, [rax+1] movsxd rdx, edx mov [rbp+rdx*4+var_1F4420], ecx cdqe movsxd rdx, esi imul rdx, 3E8h add rdx, rax mov eax, [rbp+var_1F4848] mov [rbp+rdx*4+var_FA020], eax add [rbp+var_1F4848], 1 loc_1312: mov eax, [rbp+var_1F4848] cmp eax, [rbp+var_1F4824] jl loc_1251 mov [rbp+var_1F4844], 0 mov [rbp+var_1F4840], 0 mov [rbp+var_1F483C], 0 jmp short loc_137F loc_1344: mov eax, [rbp+var_1F483C] cdqe mov eax, [rbp+rax*4+var_1F4820] test eax, eax jle short loc_135E add [rbp+var_1F4844], 1 loc_135E: mov eax, [rbp+var_1F483C] cdqe mov eax, [rbp+rax*4+var_1F4420] test eax, eax jle short loc_1378 add [rbp+var_1F4840], 1 loc_1378: add [rbp+var_1F483C], 1 loc_137F: cmp [rbp+var_1F483C], 0FFh jle short loc_1344 mov eax, [rbp+var_1F4844] cmp eax, [rbp+var_1F4840] jz short loc_13A3 mov eax, 0 jmp loc_14EA loc_13A3: mov [rbp+var_1F4838], 0 jmp loc_14D5 loc_13B2: mov eax, [rbp+var_1F4838] cdqe mov eax, [rbp+rax*4+var_1F4820] test eax, eax jz loc_14CD mov [rbp+var_1F4834], 0 mov [rbp+var_1F4830], 0 jmp loc_14AD loc_13E2: mov eax, [rbp+var_1F4830] cdqe mov edx, [rbp+rax*4+var_1F4420] mov eax, [rbp+var_1F4838] cdqe mov eax, [rbp+rax*4+var_1F4820] cmp edx, eax jnz loc_14A5 mov [rbp+var_1F482C], 1 mov [rbp+var_1F4828], 0 jmp short loc_1479 loc_141E: mov eax, [rbp+var_1F4828] cdqe mov edx, [rbp+var_1F4838] movsxd rdx, edx imul rdx, 3E8h add rax, rdx mov edx, [rbp+rax*4+var_1F4020] mov eax, [rbp+var_1F4828] cdqe mov ecx, [rbp+var_1F4830] movsxd rcx, ecx imul rcx, 3E8h add rax, rcx mov eax, [rbp+rax*4+var_FA020] cmp edx, eax jz short loc_1472 mov [rbp+var_1F482C], 0 jmp short loc_1490 loc_1472: add [rbp+var_1F4828], 1 loc_1479: mov eax, [rbp+var_1F4838] cdqe mov eax, [rbp+rax*4+var_1F4820] cmp [rbp+var_1F4828], eax jl short loc_141E loc_1490: cmp [rbp+var_1F482C], 0 jz short loc_14A6 mov [rbp+var_1F4834], 1 jmp short loc_14BD loc_14A5: nop loc_14A6: add [rbp+var_1F4830], 1 loc_14AD: cmp [rbp+var_1F4830], 0FFh jle loc_13E2 loc_14BD: cmp [rbp+var_1F4834], 0 jnz short loc_14CE mov eax, 0 jmp short loc_14EA loc_14CD: nop loc_14CE: add [rbp+var_1F4838], 1 loc_14D5: cmp [rbp+var_1F4838], 0FFh jle loc_13B2 mov eax, 1 loc_14EA: mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_14FE call ___stack_chk_fail loc_14FE: mov rbx, [rbp+var_8] leave retn
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX LEA R11,[RSP + -0x1f4000] LAB_0010119a: SUB RSP,0x1000 OR qword ptr [RSP],0x0 CMP RSP,R11 JNZ 0x0010119a SUB RSP,0x858 MOV qword ptr [RBP + -0x1f4858],RDI MOV qword ptr [RBP + -0x1f4860],RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV RAX,qword ptr [RBP + -0x1f4858] MOV RDI,RAX CALL 0x00101070 MOV RBX,RAX MOV RAX,qword ptr [RBP + -0x1f4860] MOV RDI,RAX CALL 0x00101070 CMP RBX,RAX JZ 0x001011ff MOV EAX,0x0 JMP 0x001014ea LAB_001011ff: LEA RDX,[RBP + -0x1f4820] MOV EAX,0x0 MOV ECX,0x80 MOV RDI,RDX STOSQ.REP RDI LEA RDX,[RBP + -0x1f4420] MOV EAX,0x0 MOV ECX,0x80 MOV RDI,RDX STOSQ.REP RDI MOV RAX,qword ptr [RBP + -0x1f4858] MOV RDI,RAX CALL 0x00101070 MOV dword ptr [RBP + -0x1f4824],EAX MOV dword ptr [RBP + -0x1f4848],0x0 JMP 0x00101312 LAB_00101251: MOV EAX,dword ptr [RBP + -0x1f4848] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x1f4858] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] MOV byte ptr [RBP + -0x1f484a],AL MOVZX ESI,byte ptr [RBP + -0x1f484a] MOVZX EDX,byte ptr [RBP + -0x1f484a] MOVSXD RAX,EDX MOV EAX,dword ptr [RBP + RAX*0x4 + -0x1f4820] LEA ECX,[RAX + 0x1] MOVSXD RDX,EDX MOV dword ptr [RBP + RDX*0x4 + -0x1f4820],ECX CDQE MOVSXD RDX,ESI IMUL RDX,RDX,0x3e8 ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x1f4848] MOV dword ptr [RBP + RDX*0x4 + -0x1f4020],EAX MOV EAX,dword ptr [RBP + -0x1f4848] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x1f4860] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] MOV byte ptr [RBP + -0x1f4849],AL MOVZX ESI,byte ptr [RBP + -0x1f4849] MOVZX EDX,byte ptr [RBP + -0x1f4849] MOVSXD RAX,EDX MOV EAX,dword ptr [RBP + RAX*0x4 + -0x1f4420] LEA ECX,[RAX + 0x1] MOVSXD RDX,EDX MOV dword ptr [RBP + RDX*0x4 + -0x1f4420],ECX CDQE MOVSXD RDX,ESI IMUL RDX,RDX,0x3e8 ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x1f4848] MOV dword ptr [RBP + RDX*0x4 + -0xfa020],EAX ADD dword ptr [RBP + -0x1f4848],0x1 LAB_00101312: MOV EAX,dword ptr [RBP + -0x1f4848] CMP EAX,dword ptr [RBP + -0x1f4824] JL 0x00101251 MOV dword ptr [RBP + -0x1f4844],0x0 MOV dword ptr [RBP + -0x1f4840],0x0 MOV dword ptr [RBP + -0x1f483c],0x0 JMP 0x0010137f LAB_00101344: MOV EAX,dword ptr [RBP + -0x1f483c] CDQE MOV EAX,dword ptr [RBP + RAX*0x4 + -0x1f4820] TEST EAX,EAX JLE 0x0010135e ADD dword ptr [RBP + -0x1f4844],0x1 LAB_0010135e: MOV EAX,dword ptr [RBP + -0x1f483c] CDQE MOV EAX,dword ptr [RBP + RAX*0x4 + -0x1f4420] TEST EAX,EAX JLE 0x00101378 ADD dword ptr [RBP + -0x1f4840],0x1 LAB_00101378: ADD dword ptr [RBP + -0x1f483c],0x1 LAB_0010137f: CMP dword ptr [RBP + -0x1f483c],0xff JLE 0x00101344 MOV EAX,dword ptr [RBP + -0x1f4844] CMP EAX,dword ptr [RBP + -0x1f4840] JZ 0x001013a3 MOV EAX,0x0 JMP 0x001014ea LAB_001013a3: MOV dword ptr [RBP + -0x1f4838],0x0 JMP 0x001014d5 LAB_001013b2: MOV EAX,dword ptr [RBP + -0x1f4838] CDQE MOV EAX,dword ptr [RBP + RAX*0x4 + -0x1f4820] TEST EAX,EAX JZ 0x001014cd MOV dword ptr [RBP + -0x1f4834],0x0 MOV dword ptr [RBP + -0x1f4830],0x0 JMP 0x001014ad LAB_001013e2: MOV EAX,dword ptr [RBP + -0x1f4830] CDQE MOV EDX,dword ptr [RBP + RAX*0x4 + -0x1f4420] MOV EAX,dword ptr [RBP + -0x1f4838] CDQE MOV EAX,dword ptr [RBP + RAX*0x4 + -0x1f4820] CMP EDX,EAX JNZ 0x001014a5 MOV dword ptr [RBP + -0x1f482c],0x1 MOV dword ptr [RBP + -0x1f4828],0x0 JMP 0x00101479 LAB_0010141e: MOV EAX,dword ptr [RBP + -0x1f4828] CDQE MOV EDX,dword ptr [RBP + -0x1f4838] MOVSXD RDX,EDX IMUL RDX,RDX,0x3e8 ADD RAX,RDX MOV EDX,dword ptr [RBP + RAX*0x4 + -0x1f4020] MOV EAX,dword ptr [RBP + -0x1f4828] CDQE MOV ECX,dword ptr [RBP + -0x1f4830] MOVSXD RCX,ECX IMUL RCX,RCX,0x3e8 ADD RAX,RCX MOV EAX,dword ptr [RBP + RAX*0x4 + -0xfa020] CMP EDX,EAX JZ 0x00101472 MOV dword ptr [RBP + -0x1f482c],0x0 JMP 0x00101490 LAB_00101472: ADD dword ptr [RBP + -0x1f4828],0x1 LAB_00101479: MOV EAX,dword ptr [RBP + -0x1f4838] CDQE MOV EAX,dword ptr [RBP + RAX*0x4 + -0x1f4820] CMP dword ptr [RBP + -0x1f4828],EAX JL 0x0010141e LAB_00101490: CMP dword ptr [RBP + -0x1f482c],0x0 JZ 0x001014a6 MOV dword ptr [RBP + -0x1f4834],0x1 JMP 0x001014bd LAB_001014a5: NOP LAB_001014a6: ADD dword ptr [RBP + -0x1f4830],0x1 LAB_001014ad: CMP dword ptr [RBP + -0x1f4830],0xff JLE 0x001013e2 LAB_001014bd: CMP dword ptr [RBP + -0x1f4834],0x0 JNZ 0x001014ce MOV EAX,0x0 JMP 0x001014ea LAB_001014cd: NOP LAB_001014ce: ADD dword ptr [RBP + -0x1f4838],0x1 LAB_001014d5: CMP dword ptr [RBP + -0x1f4838],0xff JLE 0x001013b2 MOV EAX,0x1 LAB_001014ea: MOV RDX,qword ptr [RBP + -0x18] SUB RDX,qword ptr FS:[0x28] JZ 0x001014fe CALL 0x00101080 LAB_001014fe: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int8 func0(char *param_1,char *param_2) { long lVar1; bool bVar2; bool bVar3; int *puVar4; size_t sVar5; size_t sVar6; int8 uVar7; long lVar8; int *puVar9; int8 *puVar10; long in_FS_OFFSET; byte bVar11; int iVar12; int iVar13; int iVar14; bVar11 = 0; puVar4 = &stack0xfffffffffffffff0; do { puVar9 = puVar4; *(int8 *)(puVar9 + -0x1000) = *(int8 *)(puVar9 + -0x1000); puVar4 = puVar9 + -0x1000; } while (puVar9 + -0x1000 != &stack0xffffffffffe0bff0); lVar1 = *(long *)(in_FS_OFFSET + 0x28); *(int8 *)(puVar9 + -0x1860) = 0x1011de; sVar5 = strlen(param_1); *(int8 *)(puVar9 + -0x1860) = 0x1011f0; sVar6 = strlen(param_2); if (sVar5 == sVar6) { puVar10 = (int8 *)&stack0xffffffffffe0b7d8; for (lVar8 = 0x80; lVar8 != 0; lVar8 = lVar8 + -1) { *puVar10 = 0; puVar10 = puVar10 + (ulong)bVar11 * -2 + 1; } puVar10 = (int8 *)&stack0xffffffffffe0bbd8; for (lVar8 = 0x80; lVar8 != 0; lVar8 = lVar8 + -1) { *puVar10 = 0; puVar10 = puVar10 + (ulong)bVar11 * -2 + 1; } *(int8 *)(puVar9 + -0x1860) = 0x10123c; sVar5 = strlen(param_1); for (iVar12 = 0; iVar12 < (int)sVar5; iVar12 = iVar12 + 1) { bVar11 = param_1[iVar12]; iVar13 = *(int *)(&stack0xffffffffffe0b7d8 + (long)(int)(uint)bVar11 * 4); *(int *)(&stack0xffffffffffe0b7d8 + (long)(int)(uint)bVar11 * 4) = iVar13 + 1; *(int *)(&stack0xffffffffffe0bfd8 + ((long)(int)(uint)bVar11 * 1000 + (long)iVar13) * 4) = iVar12; bVar11 = param_2[iVar12]; iVar13 = *(int *)(&stack0xffffffffffe0bbd8 + (long)(int)(uint)bVar11 * 4); *(int *)(&stack0xffffffffffe0bbd8 + (long)(int)(uint)bVar11 * 4) = iVar13 + 1; *(int *)(&stack0xfffffffffff05fd8 + ((long)(int)(uint)bVar11 * 1000 + (long)iVar13) * 4) = iVar12; } iVar12 = 0; iVar13 = 0; for (iVar14 = 0; iVar14 < 0x100; iVar14 = iVar14 + 1) { if (0 < *(int *)(&stack0xffffffffffe0b7d8 + (long)iVar14 * 4)) { iVar12 = iVar12 + 1; } if (0 < *(int *)(&stack0xffffffffffe0bbd8 + (long)iVar14 * 4)) { iVar13 = iVar13 + 1; } } if (iVar12 == iVar13) { for (iVar12 = 0; iVar12 < 0x100; iVar12 = iVar12 + 1) { if (*(int *)(&stack0xffffffffffe0b7d8 + (long)iVar12 * 4) != 0) { bVar3 = false; for (iVar13 = 0; iVar13 < 0x100; iVar13 = iVar13 + 1) { if (*(int *)(&stack0xffffffffffe0bbd8 + (long)iVar13 * 4) == *(int *)(&stack0xffffffffffe0b7d8 + (long)iVar12 * 4)) { bVar2 = true; for (iVar14 = 0; iVar14 < *(int *)(&stack0xffffffffffe0b7d8 + (long)iVar12 * 4); iVar14 = iVar14 + 1) { if (*(int *)(&stack0xffffffffffe0bfd8 + ((long)iVar14 + (long)iVar12 * 1000) * 4) != *(int *)(&stack0xfffffffffff05fd8 + ((long)iVar14 + (long)iVar13 * 1000) * 4)) { bVar2 = false; break; } } if (bVar2) { bVar3 = true; break; } } } if (!bVar3) { uVar7 = 0; goto LAB_001014ea; } } } uVar7 = 1; } else { uVar7 = 0; } } else { uVar7 = 0; } LAB_001014ea: if (lVar1 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(int8 *)(puVar9 + -0x1860) = 0x1014fe; __stack_chk_fail(); } return uVar7; }
7,433
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(const char *str1, const char *str2) { if (strlen(str1) != strlen(str2)) { return 0; } int dict_str1[256][1000]; int counts_str1[256] = {0}; int dict_str2[256][1000]; int counts_str2[256] = {0}; int n = strlen(str1); for (int i = 0; i < n; i++) { unsigned char c1 = str1[i]; dict_str1[c1][counts_str1[c1]++] = i; unsigned char c2 = str2[i]; dict_str2[c2][counts_str2[c2]++] = i; } // Compare the count of unique characters int unique1 = 0, unique2 = 0; for (int c = 0; c < 256; c++) { if (counts_str1[c] > 0) unique1++; if (counts_str2[c] > 0) unique2++; } if (unique1 != unique2) { return 0; } // Compare the lists of indices for (int c1 = 0; c1 < 256; c1++) { if (counts_str1[c1] == 0) continue; int found = 0; for (int c2 = 0; c2 < 256; c2++) { if (counts_str2[c2] != counts_str1[c1]) continue; int match = 1; for (int k = 0; k < counts_str1[c1]; k++) { if (dict_str1[c1][k] != dict_str2[c2][k]) { match = 0; break; } } if (match) { found = 1; break; } } if (!found) return 0; } return 1; }
int main() { assert(func0("paper", "title") == 1); assert(func0("ab", "ba") == 1); assert(func0("ab", "aa") == 0); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx lea -0x1f4000(%rsp),%r11 sub $0x1000,%rsp orq $0x0,(%rsp) cmp %r11,%rsp jne 1177 <func0+0xe> sub $0x818,%rsp mov %rdi,%r8 mov %fs:0x28,%rax mov %rax,0x1f4808(%rsp) xor %eax,%eax mov $0xffffffffffffffff,%r9 mov %r9,%rcx repnz scas %es:(%rdi),%al not %rcx lea -0x1(%rcx),%rdx mov %r9,%rcx mov %rsi,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax sub $0x1,%rax mov $0x0,%edi cmp %rax,%rdx jne 134e <func0+0x1e5> mov %rsp,%rdi mov $0x0,%eax mov $0x80,%ecx rep stos %rax,%es:(%rdi) lea 0x400(%rsp),%rdi mov $0x80,%ecx rep stos %rax,%es:(%rdi) mov $0xffffffffffffffff,%rcx mov %r8,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax sub $0x1,%rax test %eax,%eax jle 1275 <func0+0x10c> lea -0x1(%rax),%edi mov $0x0,%edx movzbl (%r8,%rdx,1),%eax mov (%rsp,%rax,4),%ecx lea 0x1(%rcx),%r9d mov %r9d,(%rsp,%rax,4) movslq %ecx,%rcx imul $0x3e8,%rax,%rax add %rcx,%rax mov %edx,0x800(%rsp,%rax,4) movzbl (%rsi,%rdx,1),%eax mov 0x400(%rsp,%rax,4),%ecx lea 0x1(%rcx),%r9d mov %r9d,0x400(%rsp,%rax,4) movslq %ecx,%rcx imul $0x3e8,%rax,%rax add %rcx,%rax mov %edx,0xfa800(%rsp,%rax,4) mov %rdx,%rax add $0x1,%rdx cmp %rdi,%rax jne 121a <func0+0xb1> mov $0x0,%eax mov $0x0,%edx mov $0x0,%ecx mov %rsp,%r8 lea 0x400(%rsp),%rdi cmpl $0x0,(%rax,%r8,1) setg %sil movzbl %sil,%esi add %esi,%ecx cmpl $0x0,(%rax,%rdi,1) setg %sil movzbl %sil,%esi add %esi,%edx add $0x4,%rax cmp $0x400,%rax jne 128f <func0+0x126> mov $0x0,%edi cmp %edx,%ecx jne 134e <func0+0x1e5> mov %rsp,%rbx lea 0x800(%rsp),%rdi lea 0xfa800(%rsp),%rbp lea 0x1f4800(%rsp),%r10 mov $0x0,%r11d jmp 130c <func0+0x1a3> mov %rcx,%rax mov (%rdx,%rax,4),%ecx cmp %ecx,(%rdi,%rax,4) jne 132a <func0+0x1c1> lea 0x1(%rax),%rcx cmp %r8,%rax jne 12e8 <func0+0x17f> add $0x4,%rbx add $0xfa0,%rdi cmp %rbp,%rdi je 136d <func0+0x204> mov (%rbx),%r9d test %r9d,%r9d je 12fc <func0+0x193> lea 0x400(%rsp),%rsi lea 0xfa800(%rsp),%rdx lea -0x1(%r9),%r8d jmp 133a <func0+0x1d1> add $0x4,%rsi add $0xfa0,%rdx cmp %r10,%rdx je 1349 <func0+0x1e0> cmp (%rsi),%r9d jne 132a <func0+0x1c1> test %r9d,%r9d jle 12fc <func0+0x193> mov %r11,%rax jmp 12eb <func0+0x182> mov $0x0,%edi mov 0x1f4808(%rsp),%rax xor %fs:0x28,%rax jne 1374 <func0+0x20b> mov %edi,%eax add $0x1f4818,%rsp pop %rbx pop %rbp retq mov $0x1,%edi jmp 134e <func0+0x1e5> callq 1060 <__stack_chk_fail@plt>
func0: endbr64 push r12 push rbp push rbx lea r11, [rsp+18h+var_1F4018] loc_1199: sub rsp, 1000h or [rsp+1018h+var_1018], 0 cmp rsp, r11 jnz short loc_1199 sub rsp, 810h mov rbx, rdi mov rbp, rsi mov rax, fs:28h mov [rsp+1828h+arg_1F2FD8], rax xor eax, eax call _strlen mov r12, rax mov rdi, rbp call _strlen mov rdx, rax mov eax, 0 cmp r12, rdx jnz loc_1341 mov rdi, rsp mov eax, 0 mov ecx, 80h rep stosq lea rdi, [rsp+1828h+var_1428] mov ecx, 80h rep stosq mov rdi, rbx call _strlen test eax, eax jle short loc_1276 lea esi, [rax-1] mov edx, 0 loc_121F: movzx eax, byte ptr [rbx+rdx] mov ecx, [rsp+rax*4+1828h+var_1828] lea edi, [rcx+1] mov [rsp+rax*4+1828h+var_1828], edi movsxd rcx, ecx imul rax, 3E8h add rax, rcx mov [rsp+rax*4+1828h+var_1028], edx movzx eax, byte ptr [rbp+rdx+0] mov ecx, [rsp+rax*4+1828h+var_1428] lea edi, [rcx+1] mov [rsp+rax*4+1828h+var_1428], edi movsxd rcx, ecx imul rax, 3E8h add rax, rcx mov [rsp+rax*4+1828h+arg_F8FD0], edx mov rax, rdx add rdx, 1 cmp rax, rsi jnz short loc_121F loc_1276: mov eax, 0 mov edx, 0 mov ecx, 0 mov r8, rsp lea rdi, [rsp+1828h+var_1428] loc_1290: cmp dword ptr [rax+r8], 0 setnle sil movzx esi, sil add ecx, esi cmp dword ptr [rax+rdi], 0 setnle sil movzx esi, sil add edx, esi add rax, 4 cmp rax, 400h jnz short loc_1290 mov eax, 0 cmp ecx, edx jnz short loc_1341 mov r10, rsp lea rsi, [rsp+1828h+var_1028] lea r11, [rsp+1828h+arg_F8FD0] lea r9, [rsp+1828h+arg_1F2FD0] jmp short loc_131F loc_12DF: add rcx, 4 add rdx, 0FA0h cmp rdx, r9 jz short loc_133C loc_12EF: cmp r8d, [rcx] jnz short loc_12DF test r8d, r8d jle short loc_130F mov eax, 0 loc_12FE: mov ebx, [rdx+rax*4] cmp [rsi+rax*4], ebx jnz short loc_12DF add rax, 1 cmp rax, rdi jnz short loc_12FE loc_130F: add r10, 4 add rsi, 0FA0h cmp rsi, r11 jz short loc_1360 loc_131F: mov r8d, [r10] test r8d, r8d jz short loc_130F lea rcx, [rsp+1828h+var_1428] lea rdx, [rsp+1828h+arg_F8FD0] mov edi, r8d jmp short loc_12EF loc_133C: mov eax, 0 loc_1341: mov rdx, [rsp+1828h+arg_1F2FD8] sub rdx, fs:28h jnz short loc_1367 add rsp, 1F4810h pop rbx pop rbp pop r12 retn loc_1360: mov eax, 1 jmp short loc_1341 loc_1367: call ___stack_chk_fail
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX LEA R11,[RSP + -0x1f4000] LAB_00101199: SUB RSP,0x1000 OR qword ptr [RSP],0x0 CMP RSP,R11 JNZ 0x00101199 SUB RSP,0x810 MOV RBX,RDI MOV RBP,RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x1f4808],RAX XOR EAX,EAX CALL 0x00101070 MOV R12,RAX MOV RDI,RBP CALL 0x00101070 MOV RDX,RAX MOV EAX,0x0 CMP R12,RDX JNZ 0x00101341 MOV RDI,RSP MOV EAX,0x0 MOV ECX,0x80 STOSQ.REP RDI LEA RDI,[RSP + 0x400] MOV ECX,0x80 STOSQ.REP RDI MOV RDI,RBX CALL 0x00101070 TEST EAX,EAX JLE 0x00101276 LEA ESI,[RAX + -0x1] MOV EDX,0x0 LAB_0010121f: MOVZX EAX,byte ptr [RBX + RDX*0x1] MOV ECX,dword ptr [RSP + RAX*0x4] LEA EDI,[RCX + 0x1] MOV dword ptr [RSP + RAX*0x4],EDI MOVSXD RCX,ECX IMUL RAX,RAX,0x3e8 ADD RAX,RCX MOV dword ptr [RSP + RAX*0x4 + 0x800],EDX MOVZX EAX,byte ptr [RBP + RDX*0x1] MOV ECX,dword ptr [RSP + RAX*0x4 + 0x400] LEA EDI,[RCX + 0x1] MOV dword ptr [RSP + RAX*0x4 + 0x400],EDI MOVSXD RCX,ECX IMUL RAX,RAX,0x3e8 ADD RAX,RCX MOV dword ptr [RSP + RAX*0x4 + 0xfa800],EDX MOV RAX,RDX ADD RDX,0x1 CMP RAX,RSI JNZ 0x0010121f LAB_00101276: MOV EAX,0x0 MOV EDX,0x0 MOV ECX,0x0 MOV R8,RSP LEA RDI,[RSP + 0x400] LAB_00101290: CMP dword ptr [RAX + R8*0x1],0x0 SETG SIL MOVZX ESI,SIL ADD ECX,ESI CMP dword ptr [RAX + RDI*0x1],0x0 SETG SIL MOVZX ESI,SIL ADD EDX,ESI ADD RAX,0x4 CMP RAX,0x400 JNZ 0x00101290 MOV EAX,0x0 CMP ECX,EDX JNZ 0x00101341 MOV R10,RSP LEA RSI,[RSP + 0x800] LEA R11,[RSP + 0xfa800] LEA R9,[RSP + 0x1f4800] JMP 0x0010131f LAB_001012df: ADD RCX,0x4 ADD RDX,0xfa0 CMP RDX,R9 JZ 0x0010133c LAB_001012ef: CMP R8D,dword ptr [RCX] JNZ 0x001012df TEST R8D,R8D JLE 0x0010130f MOV EAX,0x0 LAB_001012fe: MOV EBX,dword ptr [RDX + RAX*0x4] CMP dword ptr [RSI + RAX*0x4],EBX JNZ 0x001012df ADD RAX,0x1 CMP RAX,RDI JNZ 0x001012fe LAB_0010130f: ADD R10,0x4 ADD RSI,0xfa0 CMP RSI,R11 JZ 0x00101360 LAB_0010131f: MOV R8D,dword ptr [R10] TEST R8D,R8D JZ 0x0010130f LEA RCX,[RSP + 0x400] LEA RDX,[RSP + 0xfa800] MOV EDI,R8D JMP 0x001012ef LAB_0010133c: MOV EAX,0x0 LAB_00101341: MOV RDX,qword ptr [RSP + 0x1f4808] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101367 ADD RSP,0x1f4810 POP RBX POP RBP POP R12 RET LAB_00101360: MOV EAX,0x1 JMP 0x00101341 LAB_00101367: CALL 0x00101080
int8 func0(char *param_1,char *param_2) { uint uVar1; size_t sVar2; size_t sVar3; int8 uVar4; ulong uVar5; ulong uVar6; int iVar7; long lVar8; uint *puVar9; int iVar10; int1 *puVar11; int1 *puVar12; int1 *puVar13; int8 *puVar14; uint *puVar15; long in_FS_OFFSET; bool bVar16; byte bVar17; bVar17 = 0; puVar13 = &stack0xffffffffffffffe8; do { puVar12 = puVar13; *(int8 *)(puVar12 + -0x1000) = *(int8 *)(puVar12 + -0x1000); puVar13 = puVar12 + -0x1000; } while (puVar12 + -0x1000 != &stack0xffffffffffe0bfe8); puVar15 = (uint *)(puVar12 + -0x1810); *(int8 *)(puVar12 + 0x1f2ff8) = *(int8 *)(in_FS_OFFSET + 0x28); *(int8 *)(puVar12 + -0x1818) = 0x1011cf; sVar2 = strlen(param_1); *(int8 *)(puVar12 + -0x1818) = 0x1011da; sVar3 = strlen(param_2); uVar4 = 0; if (sVar2 == sVar3) { puVar14 = (int8 *)(puVar12 + -0x1810); for (lVar8 = 0x80; lVar8 != 0; lVar8 = lVar8 + -1) { *puVar14 = 0; puVar14 = puVar14 + (ulong)bVar17 * -2 + 1; } puVar14 = (int8 *)(puVar12 + -0x1410); for (lVar8 = 0x80; lVar8 != 0; lVar8 = lVar8 + -1) { *puVar14 = 0; puVar14 = puVar14 + (ulong)bVar17 * -2 + 1; } *(int8 *)(puVar12 + -0x1818) = 0x101213; sVar2 = strlen(param_1); if (0 < (int)sVar2) { uVar6 = 0; do { uVar5 = (ulong)(byte)param_1[uVar6]; iVar7 = *(int *)(puVar12 + uVar5 * 4 + -0x1810); *(int *)(puVar12 + uVar5 * 4 + -0x1810) = iVar7 + 1; *(int *)(puVar12 + (uVar5 * 1000 + (long)iVar7) * 4 + -0x1010) = (int)uVar6; uVar5 = (ulong)(byte)param_2[uVar6]; iVar7 = *(int *)(puVar12 + uVar5 * 4 + -0x1410); *(int *)(puVar12 + uVar5 * 4 + -0x1410) = iVar7 + 1; *(int *)(puVar12 + (uVar5 * 1000 + (long)iVar7) * 4 + 0xf8ff0) = (int)uVar6; bVar16 = uVar6 != (int)sVar2 - 1; uVar6 = uVar6 + 1; } while (bVar16); } lVar8 = 0; iVar10 = 0; iVar7 = 0; do { iVar7 = iVar7 + (uint)(0 < *(int *)(puVar12 + lVar8 + -0x1810)); iVar10 = iVar10 + (uint)(0 < *(int *)(puVar12 + lVar8 + -0x1410)); lVar8 = lVar8 + 4; } while (lVar8 != 0x400); uVar4 = 0; if (iVar7 == iVar10) { puVar13 = puVar12 + -0x1010; do { uVar1 = *puVar15; if (uVar1 != 0) { puVar9 = (uint *)(puVar12 + -0x1410); puVar11 = puVar12 + 0xf8ff0; do { if (uVar1 == *puVar9) { if ((int)uVar1 < 1) break; uVar6 = 0; while (*(int *)(puVar13 + uVar6 * 4) == *(int *)(puVar11 + uVar6 * 4)) { uVar6 = uVar6 + 1; if (uVar6 == uVar1) goto LAB_0010130f; } } puVar9 = puVar9 + 1; puVar11 = puVar11 + 4000; if (puVar11 == puVar12 + 0x1f2ff0) { uVar4 = 0; goto LAB_00101341; } } while( true ); } LAB_0010130f: puVar15 = puVar15 + 1; puVar13 = puVar13 + 4000; } while (puVar13 != puVar12 + 0xf8ff0); uVar4 = 1; } } LAB_00101341: if (*(long *)(puVar12 + 0x1f2ff8) == *(long *)(in_FS_OFFSET + 0x28)) { return uVar4; } /* WARNING: Subroutine does not return */ *(code **)(puVar12 + -0x1818) = main; __stack_chk_fail(); }
7,434
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(const char *str1, const char *str2) { if (strlen(str1) != strlen(str2)) { return 0; } int dict_str1[256][1000]; int counts_str1[256] = {0}; int dict_str2[256][1000]; int counts_str2[256] = {0}; int n = strlen(str1); for (int i = 0; i < n; i++) { unsigned char c1 = str1[i]; dict_str1[c1][counts_str1[c1]++] = i; unsigned char c2 = str2[i]; dict_str2[c2][counts_str2[c2]++] = i; } // Compare the count of unique characters int unique1 = 0, unique2 = 0; for (int c = 0; c < 256; c++) { if (counts_str1[c] > 0) unique1++; if (counts_str2[c] > 0) unique2++; } if (unique1 != unique2) { return 0; } // Compare the lists of indices for (int c1 = 0; c1 < 256; c1++) { if (counts_str1[c1] == 0) continue; int found = 0; for (int c2 = 0; c2 < 256; c2++) { if (counts_str2[c2] != counts_str1[c1]) continue; int match = 1; for (int k = 0; k < counts_str1[c1]; k++) { if (dict_str1[c1][k] != dict_str2[c2][k]) { match = 0; break; } } if (match) { found = 1; break; } } if (!found) return 0; } return 1; }
int main() { assert(func0("paper", "title") == 1); assert(func0("ab", "ba") == 1); assert(func0("ab", "aa") == 0); return 0; }
O2
c
func0: endbr64 push %r12 mov %rsi,%r12 push %rbp mov %rdi,%rbp push %rbx callq 1070 <strlen@plt> mov %r12,%rdi mov %rax,%rbx callq 1070 <strlen@plt> cmp %rax,%rbx jne 1488 <func0+0x38> pop %rbx mov %r12,%rsi mov %rbp,%rdi pop %rbp pop %r12 jmpq 1250 <func0.part.0> nopw 0x0(%rax,%rax,1) pop %rbx xor %eax,%eax pop %rbp pop %r12 retq
func0_part_0: push r13 push r12 push rbp push rbx lea r11, [rsp+20h+var_1F4020] loc_124E: sub rsp, 1000h or [rsp+1020h+var_1020], 0 cmp rsp, r11 jnz short loc_124E sub rsp, 818h mov ecx, 80h mov rax, fs:28h mov [rsp+1838h+arg_1F2FC8], rax xor eax, eax mov rbp, rsp mov r12, rdi lea rbx, [rsp+1838h+var_1438] mov rdi, rbp mov r13, rsi rep stosq mov ecx, 80h mov rdi, rbx rep stosq mov rdi, r12 call _strlen test eax, eax jle loc_1420 lea esi, [rax-1] xor edx, edx nop dword ptr [rax] loc_12B8: movzx eax, byte ptr [r12+rdx] movsxd rcx, [rsp+rax*4+1838h+var_1838] lea edi, [rcx+1] mov [rsp+rax*4+1838h+var_1838], edi imul rax, 3E8h add rax, rcx mov [rsp+rax*4+1838h+var_1038], edx movzx eax, byte ptr [r13+rdx+0] movsxd rcx, [rsp+rax*4+1838h+var_1438] lea edi, [rcx+1] mov [rsp+rax*4+1838h+var_1438], edi imul rax, 3E8h add rax, rcx mov [rsp+rax*4+1838h+arg_F8FC0], edx mov rax, rdx add rdx, 1 cmp rax, rsi jnz short loc_12B8 mov r10d, [rsp+1838h+var_1438] mov r8d, [rsp+1838h+var_1838] loc_1319: mov edi, r10d mov esi, r8d xor eax, eax xor edx, edx xor ecx, ecx jmp short loc_1337 loc_1330: mov esi, [rbp+rax+0] mov edi, [rbx+rax] loc_1337: test esi, esi setnle sil movzx esi, sil add ecx, esi xor esi, esi test edi, edi setnle sil add rax, 4 add edx, esi cmp rax, 400h jnz short loc_1330 xor eax, eax cmp ecx, edx jnz loc_13FF lea r11, [rsp+1838h+var_1834] lea rsi, [rsp+1838h+var_1038] lea rbx, [rsp+1838h+arg_F8FC0] lea r9, [rsp+1838h+arg_1F2FC0] jmp short loc_139F loc_1388: add rsi, 0FA0h cmp rsi, rbx jz loc_142B mov r8d, [r11] add r11, 4 loc_139F: test r8d, r8d jz short loc_1388 lea rcx, [rsp+1838h+var_1434] mov rdx, rbx mov eax, r10d movsxd rdi, r8d jmp short loc_13D2 loc_13C0: add rdx, 0FA0h cmp rdx, r9 jz short loc_13FD loc_13CC: mov eax, [rcx] add rcx, 4 loc_13D2: cmp r8d, eax jnz short loc_13C0 test r8d, r8d jle short loc_1388 xor eax, eax jmp short loc_13E9 loc_13E0: add rax, 1 cmp rdi, rax jz short loc_1388 loc_13E9: mov ebp, [rdx+rax*4] cmp [rsi+rax*4], ebp jz short loc_13E0 add rdx, 0FA0h cmp rdx, r9 jnz short loc_13CC loc_13FD: xor eax, eax loc_13FF: mov rdx, [rsp+1838h+arg_1F2FC8] sub rdx, fs:28h jnz short loc_1432 add rsp, 1F4818h pop rbx pop rbp pop r12 pop r13 retn loc_1420: xor r8d, r8d xor r10d, r10d jmp loc_1319 loc_142B: mov eax, 1 jmp short loc_13FF loc_1432: call ___stack_chk_fail
func0.part.0: PUSH R13 PUSH R12 PUSH RBP PUSH RBX LEA R11,[RSP + -0x1f4000] LAB_0010124e: SUB RSP,0x1000 OR qword ptr [RSP],0x0 CMP RSP,R11 JNZ 0x0010124e SUB RSP,0x818 MOV ECX,0x80 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x1f4808],RAX XOR EAX,EAX MOV RBP,RSP MOV R12,RDI LEA RBX,[RSP + 0x400] MOV RDI,RBP MOV R13,RSI STOSQ.REP RDI MOV ECX,0x80 MOV RDI,RBX STOSQ.REP RDI MOV RDI,R12 CALL 0x00101070 TEST EAX,EAX JLE 0x00101420 LEA ESI,[RAX + -0x1] XOR EDX,EDX NOP dword ptr [RAX] LAB_001012b8: MOVZX EAX,byte ptr [R12 + RDX*0x1] MOVSXD RCX,dword ptr [RSP + RAX*0x4] LEA EDI,[RCX + 0x1] MOV dword ptr [RSP + RAX*0x4],EDI IMUL RAX,RAX,0x3e8 ADD RAX,RCX MOV dword ptr [RSP + RAX*0x4 + 0x800],EDX MOVZX EAX,byte ptr [R13 + RDX*0x1] MOVSXD RCX,dword ptr [RSP + RAX*0x4 + 0x400] LEA EDI,[RCX + 0x1] MOV dword ptr [RSP + RAX*0x4 + 0x400],EDI IMUL RAX,RAX,0x3e8 ADD RAX,RCX MOV dword ptr [RSP + RAX*0x4 + 0xfa800],EDX MOV RAX,RDX ADD RDX,0x1 CMP RAX,RSI JNZ 0x001012b8 MOV R10D,dword ptr [RSP + 0x400] MOV R8D,dword ptr [RSP] LAB_00101319: MOV EDI,R10D MOV ESI,R8D XOR EAX,EAX XOR EDX,EDX XOR ECX,ECX JMP 0x00101337 LAB_00101330: MOV ESI,dword ptr [RBP + RAX*0x1] MOV EDI,dword ptr [RBX + RAX*0x1] LAB_00101337: TEST ESI,ESI SETG SIL MOVZX ESI,SIL ADD ECX,ESI XOR ESI,ESI TEST EDI,EDI SETG SIL ADD RAX,0x4 ADD EDX,ESI CMP RAX,0x400 JNZ 0x00101330 XOR EAX,EAX CMP ECX,EDX JNZ 0x001013ff LEA R11,[RSP + 0x4] LEA RSI,[RSP + 0x800] LEA RBX,[RSP + 0xfa800] LEA R9,[RSP + 0x1f4800] JMP 0x0010139f LAB_00101388: ADD RSI,0xfa0 CMP RSI,RBX JZ 0x0010142b MOV R8D,dword ptr [R11] ADD R11,0x4 LAB_0010139f: TEST R8D,R8D JZ 0x00101388 LEA RCX,[RSP + 0x404] MOV RDX,RBX MOV EAX,R10D MOVSXD RDI,R8D JMP 0x001013d2 LAB_001013c0: ADD RDX,0xfa0 CMP RDX,R9 JZ 0x001013fd LAB_001013cc: MOV EAX,dword ptr [RCX] ADD RCX,0x4 LAB_001013d2: CMP R8D,EAX JNZ 0x001013c0 TEST R8D,R8D JLE 0x00101388 XOR EAX,EAX JMP 0x001013e9 LAB_001013e0: ADD RAX,0x1 CMP RDI,RAX JZ 0x00101388 LAB_001013e9: MOV EBP,dword ptr [RDX + RAX*0x4] CMP dword ptr [RSI + RAX*0x4],EBP JZ 0x001013e0 ADD RDX,0xfa0 CMP RDX,R9 JNZ 0x001013cc LAB_001013fd: XOR EAX,EAX LAB_001013ff: MOV RDX,qword ptr [RSP + 0x1f4808] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101432 ADD RSP,0x1f4818 POP RBX POP RBP POP R12 POP R13 RET LAB_00101420: XOR R8D,R8D XOR R10D,R10D JMP 0x00101319 LAB_0010142b: MOV EAX,0x1 JMP 0x001013ff LAB_00101432: CALL 0x00101080
int8 func0_part_0(char *param_1,long param_2) { int iVar1; size_t sVar2; ulong uVar3; long lVar4; int8 uVar5; int iVar6; long lVar7; int *piVar8; int iVar9; ulong uVar10; int1 *puVar11; int1 *puVar12; int *piVar13; int iVar14; int1 *puVar15; int8 *puVar16; int iVar17; int iVar18; long in_FS_OFFSET; bool bVar19; puVar15 = &stack0xffffffffffffffe0; do { puVar12 = puVar15; *(int8 *)(puVar12 + -0x1000) = *(int8 *)(puVar12 + -0x1000); puVar15 = puVar12 + -0x1000; } while (puVar12 + -0x1000 != &stack0xffffffffffe0bfe0); piVar13 = (int *)(puVar12 + -0x1818); *(int8 *)(puVar12 + 0x1f2ff0) = *(int8 *)(in_FS_OFFSET + 0x28); puVar16 = (int8 *)(puVar12 + -0x1818); for (lVar7 = 0x80; lVar7 != 0; lVar7 = lVar7 + -1) { *puVar16 = 0; puVar16 = puVar16 + 1; } puVar16 = (int8 *)(puVar12 + -0x1418); for (lVar7 = 0x80; lVar7 != 0; lVar7 = lVar7 + -1) { *puVar16 = 0; puVar16 = puVar16 + 1; } *(int8 *)(puVar12 + -0x1820) = 0x1012a8; sVar2 = strlen(param_1); if ((int)sVar2 < 1) { iVar17 = 0; iVar18 = 0; } else { uVar10 = 0; do { uVar3 = (ulong)(byte)param_1[uVar10]; iVar18 = *(int *)(puVar12 + uVar3 * 4 + -0x1818); *(int *)(puVar12 + uVar3 * 4 + -0x1818) = iVar18 + 1; *(int *)(puVar12 + (uVar3 * 1000 + (long)iVar18) * 4 + -0x1018) = (int)uVar10; uVar3 = (ulong)*(byte *)(param_2 + uVar10); iVar18 = *(int *)(puVar12 + uVar3 * 4 + -0x1418); *(int *)(puVar12 + uVar3 * 4 + -0x1418) = iVar18 + 1; *(int *)(puVar12 + (uVar3 * 1000 + (long)iVar18) * 4 + 0xf8fe8) = (int)uVar10; bVar19 = uVar10 != (int)sVar2 - 1; uVar10 = uVar10 + 1; } while (bVar19); iVar18 = *(int *)(puVar12 + -0x1418); iVar17 = *(int *)(puVar12 + -0x1818); } iVar9 = 0; iVar6 = 0; lVar7 = 0; iVar1 = iVar18; iVar14 = iVar17; while( true ) { iVar6 = iVar6 + (uint)(0 < iVar14); lVar4 = lVar7 + 4; iVar9 = iVar9 + (uint)(0 < iVar1); if (lVar4 == 0x400) break; iVar14 = *(int *)(puVar12 + lVar7 + -0x1814); iVar1 = *(int *)((long)(puVar12 + -0x1418) + lVar4); lVar7 = lVar4; } uVar5 = 0; if (iVar6 == iVar9) { puVar15 = puVar12 + -0x1018; do { piVar13 = piVar13 + 1; if (iVar17 != 0) { piVar8 = (int *)(puVar12 + -0x1414); puVar11 = puVar12 + 0xf8fe8; iVar14 = iVar18; do { if (iVar17 != iVar14) { if (puVar11 + 4000 != puVar12 + 0x1f2fe8) goto LAB_001013cc; LAB_001013fd: uVar5 = 0; goto LAB_001013ff; } if (iVar17 < 1) break; lVar7 = 0; while (*(int *)(puVar15 + lVar7 * 4) == *(int *)(puVar11 + lVar7 * 4)) { lVar7 = lVar7 + 1; if (iVar17 == lVar7) goto LAB_00101388; } if (puVar11 + 4000 == puVar12 + 0x1f2fe8) goto LAB_001013fd; LAB_001013cc: puVar11 = puVar11 + 4000; iVar14 = *piVar8; piVar8 = piVar8 + 1; } while( true ); } LAB_00101388: puVar15 = puVar15 + 4000; if (puVar15 == puVar12 + 0xf8fe8) goto LAB_0010142b; iVar17 = *piVar13; } while( true ); } LAB_001013ff: if (*(long *)(puVar12 + 0x1f2ff0) == *(long *)(in_FS_OFFSET + 0x28)) { return uVar5; } /* WARNING: Subroutine does not return */ *(int **)(puVar12 + -0x1820) = &UNK_00101437; __stack_chk_fail(); LAB_0010142b: uVar5 = 1; goto LAB_001013ff; }
7,435
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(const char *str1, const char *str2) { if (strlen(str1) != strlen(str2)) { return 0; } int dict_str1[256][1000]; int counts_str1[256] = {0}; int dict_str2[256][1000]; int counts_str2[256] = {0}; int n = strlen(str1); for (int i = 0; i < n; i++) { unsigned char c1 = str1[i]; dict_str1[c1][counts_str1[c1]++] = i; unsigned char c2 = str2[i]; dict_str2[c2][counts_str2[c2]++] = i; } // Compare the count of unique characters int unique1 = 0, unique2 = 0; for (int c = 0; c < 256; c++) { if (counts_str1[c] > 0) unique1++; if (counts_str2[c] > 0) unique2++; } if (unique1 != unique2) { return 0; } // Compare the lists of indices for (int c1 = 0; c1 < 256; c1++) { if (counts_str1[c1] == 0) continue; int found = 0; for (int c2 = 0; c2 < 256; c2++) { if (counts_str2[c2] != counts_str1[c1]) continue; int match = 1; for (int k = 0; k < counts_str1[c1]; k++) { if (dict_str1[c1][k] != dict_str2[c2][k]) { match = 0; break; } } if (match) { found = 1; break; } } if (!found) return 0; } return 1; }
int main() { assert(func0("paper", "title") == 1); assert(func0("ab", "ba") == 1); assert(func0("ab", "aa") == 0); return 0; }
O3
c
func0: endbr64 push %r12 mov %rsi,%r12 push %rbp mov %rdi,%rbp push %rbx callq 1070 <strlen@plt> mov %r12,%rdi mov %rax,%rbx callq 1070 <strlen@plt> cmp %rax,%rbx jne 14a8 <func0+0x38> pop %rbx mov %r12,%rsi mov %rbp,%rdi pop %rbp pop %r12 jmpq 1250 <func0.part.0> nopw 0x0(%rax,%rax,1) pop %rbx xor %eax,%eax pop %rbp pop %r12 retq
func0: endbr64 push r12 push rbp push rbx lea r11, [rsp+18h+var_1F4018] loc_1250: sub rsp, 1000h or [rsp+1018h+var_1018], 0 cmp rsp, r11 jnz short loc_1250 sub rsp, 810h mov rax, fs:28h mov [rsp+1828h+arg_1F2FD8], rax xor eax, eax mov rbp, rsi mov rbx, rdi call _strlen mov rdi, rbp; s mov r12, rax call _strlen cmp r12, rax jnz loc_13A1 mov r10, rsp xor eax, eax mov ecx, 80h mov rdi, r10 lea r11, [rsp+1828h+var_1428] rep stosq mov ecx, 80h mov rdi, r11 rep stosq test r12d, r12d jle short loc_1323 lea esi, [r12-1] xor edx, edx nop dword ptr [rax+00000000h] loc_12D0: movzx eax, byte ptr [rbx+rdx] movsxd rcx, [rsp+rax*4+1828h+var_1828] lea edi, [rcx+1] mov [rsp+rax*4+1828h+var_1828], edi imul rax, 3E8h add rax, rcx mov [rsp+rax*4+1828h+var_1028], edx movzx eax, byte ptr [rbp+rdx+0] movsxd rcx, [rsp+rax*4+1828h+var_1428] lea edi, [rcx+1] mov [rsp+rax*4+1828h+var_1428], edi imul rax, 3E8h add rax, rcx mov [rsp+rax*4+1828h+arg_F8FD0], edx mov rax, rdx add rdx, 1 cmp rax, rsi jnz short loc_12D0 loc_1323: pxor xmm1, xmm1 xor eax, eax movdqa xmm2, xmm1 movdqa xmm3, xmm1 nop dword ptr [rax+00000000h] loc_1338: movdqa xmm0, xmmword ptr [r10+rax] add rax, 10h pcmpgtd xmm0, xmm3 psubd xmm2, xmm0 movdqa xmm0, xmmword ptr [rax+r11-10h] pcmpgtd xmm0, xmm3 psubd xmm1, xmm0 cmp rax, 400h jnz short loc_1338 movdqa xmm0, xmm1 psrldq xmm0, 8 paddd xmm1, xmm0 movdqa xmm0, xmm2 psrldq xmm0, 8 paddd xmm2, xmm0 movdqa xmm0, xmm2 psrldq xmm0, 4 paddd xmm2, xmm0 movdqa xmm0, xmm1 psrldq xmm0, 4 movd edx, xmm2 paddd xmm1, xmm0 movd eax, xmm1 cmp edx, eax jz short loc_13C6 loc_13A1: xor eax, eax loc_13A3: mov rdx, [rsp+1828h+arg_1F2FD8] sub rdx, fs:28h jnz loc_144D add rsp, 1F4810h pop rbx pop rbp pop r12 retn loc_13C6: lea rsi, [rsp+1828h+var_1028] lea rbx, [rsp+1828h+arg_F8FD0] lea r9, [rsp+1828h+arg_1F2FD0] jmp short loc_13F0 loc_13E0: add rsi, 0FA0h add r10, 4 cmp rsi, rbx jz short loc_1443 loc_13F0: mov r8d, [r10] test r8d, r8d jz short loc_13E0 movsxd rdi, r8d mov rcx, r11 mov rdx, rbx shl rdi, 2 jmp short loc_1420 loc_1410: add rdx, 0FA0h add rcx, 4 cmp r9, rdx jz short loc_13A1 loc_1420: cmp r8d, [rcx] jnz short loc_1410 test r8d, r8d jle short loc_13E0 xor eax, eax jmp short loc_1439 loc_1430: add rax, 4 cmp rdi, rax jz short loc_13E0 loc_1439: mov ebp, [rdx+rax] cmp [rsi+rax], ebp jz short loc_1430 jmp short loc_1410 loc_1443: mov eax, 1 jmp loc_13A3 loc_144D: call ___stack_chk_fail
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX LEA R11,[RSP + -0x1f4000] LAB_00101250: SUB RSP,0x1000 OR qword ptr [RSP],0x0 CMP RSP,R11 JNZ 0x00101250 SUB RSP,0x810 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x1f4808],RAX XOR EAX,EAX MOV RBP,RSI MOV RBX,RDI CALL 0x00101070 MOV RDI,RBP MOV R12,RAX CALL 0x00101070 CMP R12,RAX JNZ 0x001013a1 MOV R10,RSP XOR EAX,EAX MOV ECX,0x80 MOV RDI,R10 LEA R11,[RSP + 0x400] STOSQ.REP RDI MOV ECX,0x80 MOV RDI,R11 STOSQ.REP RDI TEST R12D,R12D JLE 0x00101323 LEA ESI,[R12 + -0x1] XOR EDX,EDX NOP dword ptr [RAX] LAB_001012d0: MOVZX EAX,byte ptr [RBX + RDX*0x1] MOVSXD RCX,dword ptr [RSP + RAX*0x4] LEA EDI,[RCX + 0x1] MOV dword ptr [RSP + RAX*0x4],EDI IMUL RAX,RAX,0x3e8 ADD RAX,RCX MOV dword ptr [RSP + RAX*0x4 + 0x800],EDX MOVZX EAX,byte ptr [RBP + RDX*0x1] MOVSXD RCX,dword ptr [RSP + RAX*0x4 + 0x400] LEA EDI,[RCX + 0x1] MOV dword ptr [RSP + RAX*0x4 + 0x400],EDI IMUL RAX,RAX,0x3e8 ADD RAX,RCX MOV dword ptr [RSP + RAX*0x4 + 0xfa800],EDX MOV RAX,RDX ADD RDX,0x1 CMP RAX,RSI JNZ 0x001012d0 LAB_00101323: PXOR XMM1,XMM1 XOR EAX,EAX MOVDQA XMM2,XMM1 MOVDQA XMM3,XMM1 NOP dword ptr [RAX] LAB_00101338: MOVDQA XMM0,xmmword ptr [R10 + RAX*0x1] ADD RAX,0x10 PCMPGTD XMM0,XMM3 PSUBD XMM2,XMM0 MOVDQA XMM0,xmmword ptr [RAX + R11*0x1 + -0x10] PCMPGTD XMM0,XMM3 PSUBD XMM1,XMM0 CMP RAX,0x400 JNZ 0x00101338 MOVDQA XMM0,XMM1 PSRLDQ XMM0,0x8 PADDD XMM1,XMM0 MOVDQA XMM0,XMM2 PSRLDQ XMM0,0x8 PADDD XMM2,XMM0 MOVDQA XMM0,XMM2 PSRLDQ XMM0,0x4 PADDD XMM2,XMM0 MOVDQA XMM0,XMM1 PSRLDQ XMM0,0x4 MOVD EDX,XMM2 PADDD XMM1,XMM0 MOVD EAX,XMM1 CMP EDX,EAX JZ 0x001013c6 LAB_001013a1: XOR EAX,EAX LAB_001013a3: MOV RDX,qword ptr [RSP + 0x1f4808] SUB RDX,qword ptr FS:[0x28] JNZ 0x0010144d ADD RSP,0x1f4810 POP RBX POP RBP POP R12 RET LAB_001013c6: LEA RSI,[RSP + 0x800] LEA RBX,[RSP + 0xfa800] LEA R9,[RSP + 0x1f4800] JMP 0x001013f0 LAB_001013e0: ADD RSI,0xfa0 ADD R10,0x4 CMP RSI,RBX JZ 0x00101443 LAB_001013f0: MOV R8D,dword ptr [R10] TEST R8D,R8D JZ 0x001013e0 MOVSXD RDI,R8D MOV RCX,R11 MOV RDX,RBX SHL RDI,0x2 JMP 0x00101420 LAB_00101410: ADD RDX,0xfa0 ADD RCX,0x4 CMP R9,RDX JZ 0x001013a1 LAB_00101420: CMP R8D,dword ptr [RCX] JNZ 0x00101410 TEST R8D,R8D JLE 0x001013e0 XOR EAX,EAX JMP 0x00101439 LAB_00101430: ADD RAX,0x4 CMP RDI,RAX JZ 0x001013e0 LAB_00101439: MOV EBP,dword ptr [RDX + RAX*0x1] CMP dword ptr [RSI + RAX*0x1],EBP JZ 0x00101430 JMP 0x00101410 LAB_00101443: MOV EAX,0x1 JMP 0x001013a3 LAB_0010144d: CALL 0x00101080
int8 func0(char *param_1,char *param_2) { int *piVar1; size_t sVar2; size_t sVar3; ulong uVar4; long lVar5; int8 uVar6; long lVar7; int *piVar8; ulong uVar9; int *puVar10; int *puVar11; int *puVar12; int8 *puVar13; int *piVar14; long in_FS_OFFSET; bool bVar15; byte bVar16; int iVar17; int iVar18; int iVar19; int iVar20; int iVar21; int iVar22; int iVar23; int iVar24; bVar16 = 0; puVar12 = &stack0xffffffffffffffe8; do { puVar11 = puVar12; *(int8 *)(puVar11 + -0x1000) = *(int8 *)(puVar11 + -0x1000); puVar12 = puVar11 + -0x1000; } while (puVar11 + -0x1000 != &stack0xffffffffffe0bfe8); piVar14 = (int *)(puVar11 + -0x1810); *(int8 *)(puVar11 + 0x1f2ff8) = *(int8 *)(in_FS_OFFSET + 0x28); *(int8 *)(puVar11 + -0x1818) = 0x101286; sVar2 = strlen(param_1); *(int8 *)(puVar11 + -0x1818) = 0x101291; sVar3 = strlen(param_2); if (sVar2 == sVar3) { piVar1 = (int *)(puVar11 + -0x1410); puVar13 = (int8 *)(puVar11 + -0x1810); for (lVar7 = 0x80; lVar7 != 0; lVar7 = lVar7 + -1) { *puVar13 = 0; puVar13 = puVar13 + (ulong)bVar16 * -2 + 1; } piVar8 = piVar1; for (lVar7 = 0x80; lVar7 != 0; lVar7 = lVar7 + -1) { piVar8[0] = 0; piVar8[1] = 0; piVar8 = piVar8 + (ulong)bVar16 * -4 + 2; } if (0 < (int)sVar2) { uVar9 = 0; do { uVar4 = (ulong)(byte)param_1[uVar9]; iVar17 = *(int *)(puVar11 + uVar4 * 4 + -0x1810); *(int *)(puVar11 + uVar4 * 4 + -0x1810) = iVar17 + 1; *(int *)(puVar11 + (uVar4 * 1000 + (long)iVar17) * 4 + -0x1010) = (int)uVar9; uVar4 = (ulong)(byte)param_2[uVar9]; iVar17 = *(int *)(puVar11 + uVar4 * 4 + -0x1410); *(int *)(puVar11 + uVar4 * 4 + -0x1410) = iVar17 + 1; *(int *)(puVar11 + (uVar4 * 1000 + (long)iVar17) * 4 + 0xf8ff0) = (int)uVar9; bVar15 = uVar9 != (int)sVar2 - 1; uVar9 = uVar9 + 1; } while (bVar15); } iVar17 = 0; iVar18 = 0; iVar19 = 0; iVar20 = 0; iVar21 = 0; iVar22 = 0; iVar23 = 0; iVar24 = 0; lVar7 = 0; do { piVar8 = (int *)(puVar11 + lVar7 + -0x1810); lVar5 = lVar7 + 0x10; iVar21 = iVar21 + (uint)(0 < *piVar8); iVar22 = iVar22 + (uint)(0 < piVar8[1]); iVar23 = iVar23 + (uint)(0 < piVar8[2]); iVar24 = iVar24 + (uint)(0 < piVar8[3]); piVar8 = (int *)(lVar7 + (long)piVar1); iVar17 = iVar17 + (uint)(0 < *piVar8); iVar18 = iVar18 + (uint)(0 < piVar8[1]); iVar19 = iVar19 + (uint)(0 < piVar8[2]); iVar20 = iVar20 + (uint)(0 < piVar8[3]); lVar7 = lVar5; } while (lVar5 != 0x400); if (iVar21 + iVar23 + iVar22 + iVar24 == iVar17 + iVar19 + iVar18 + iVar20) { puVar12 = puVar11 + -0x1010; do { iVar17 = *piVar14; if (iVar17 != 0) { piVar8 = piVar1; puVar10 = puVar11 + 0xf8ff0; do { if (iVar17 == *piVar8) { if (iVar17 < 1) break; lVar7 = 0; while (*(int *)(puVar12 + lVar7) == *(int *)(puVar10 + lVar7)) { lVar7 = lVar7 + 4; if ((long)iVar17 * 4 == lVar7) goto LAB_001013e0; } } puVar10 = puVar10 + 4000; piVar8 = piVar8 + 1; if (puVar11 + 0x1f2ff0 == puVar10) goto LAB_001013a1; } while( true ); } LAB_001013e0: puVar12 = puVar12 + 4000; piVar14 = piVar14 + 1; } while (puVar12 != puVar11 + 0xf8ff0); uVar6 = 1; goto LAB_001013a3; } } LAB_001013a1: uVar6 = 0; LAB_001013a3: if (*(long *)(puVar11 + 0x1f2ff8) != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(int8 *)(puVar11 + -0x1818) = 0x101452; __stack_chk_fail(); } return uVar6; }
7,436
func0
#include <assert.h>
double func0(int numbers[], int size) { int total = 0; for (int i = 0; i < size; i++) { total += numbers[i]; } return (double)total / size; }
int main() { int arr1[] = {8, 2, 3, 0, 7}; int arr2[] = {-10, -20, -30}; int arr3[] = {19, 15, 18}; assert(func0(arr1, 5) == 4.0); assert(func0(arr2, 3) == -20.0); assert(func0(arr3, 3) == 17.333333333333332); 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 11a5 <func0+0x3c> 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 1188 <func0+0x1f> cvtsi2sdl -0x8(%rbp),%xmm0 cvtsi2sdl -0x1c(%rbp),%xmm1 divsd %xmm1,%xmm0 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_11A5 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] add [rbp+var_8], eax add [rbp+var_4], 1 loc_11A5: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1188 pxor xmm0, xmm0 cvtsi2sd xmm0, [rbp+var_8] pxor xmm1, xmm1 cvtsi2sd xmm1, [rbp+var_1C] divsd xmm0, xmm1 pop rbp retn
double func0(long long a1, int a2) { int v3; // [rsp+14h] [rbp-8h] int i; // [rsp+18h] [rbp-4h] v3 = 0; for ( i = 0; i < a2; ++i ) v3 += *(_DWORD *)(4LL * i + a1); return (double)v3 / (double)a2; }
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 0x001011a5 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] ADD dword ptr [RBP + -0x8],EAX ADD dword ptr [RBP + -0x4],0x1 LAB_001011a5: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101188 PXOR XMM0,XMM0 CVTSI2SD XMM0,dword ptr [RBP + -0x8] PXOR XMM1,XMM1 CVTSI2SD XMM1,dword ptr [RBP + -0x1c] DIVSD XMM0,XMM1 POP RBP RET
double 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) { local_10 = local_10 + *(int *)(param_1 + (long)local_c * 4); } return (double)local_10 / (double)param_2; }
7,437
func0
#include <assert.h>
double func0(int numbers[], int size) { int total = 0; for (int i = 0; i < size; i++) { total += numbers[i]; } return (double)total / size; }
int main() { int arr1[] = {8, 2, 3, 0, 7}; int arr2[] = {-10, -20, -30}; int arr3[] = {19, 15, 18}; assert(func0(arr1, 5) == 4.0); assert(func0(arr2, 3) == -20.0); assert(func0(arr3, 3) == 17.333333333333332); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11a1 <func0+0x38> mov %rdi,%rax lea -0x1(%rsi),%edx lea 0x4(%rdi,%rdx,4),%rcx mov $0x0,%edx add (%rax),%edx add $0x4,%rax cmp %rcx,%rax jne 1181 <func0+0x18> pxor %xmm0,%xmm0 cvtsi2sd %edx,%xmm0 pxor %xmm1,%xmm1 cvtsi2sd %esi,%xmm1 divsd %xmm1,%xmm0 retq mov $0x0,%edx jmp 118c <func0+0x23>
func0: endbr64 test esi, esi jle short loc_11A1 mov rax, rdi lea edx, [rsi-1] lea rcx, [rdi+rdx*4+4] mov edx, 0 loc_1181: add edx, [rax] add rax, 4 cmp rax, rcx jnz short loc_1181 loc_118C: pxor xmm0, xmm0 cvtsi2sd xmm0, edx pxor xmm1, xmm1 cvtsi2sd xmm1, esi divsd xmm0, xmm1 retn loc_11A1: mov edx, 0 jmp short loc_118C
double func0(_DWORD *a1, int a2) { _DWORD *v2; // rax int v3; // edx if ( a2 <= 0 ) { v3 = 0; } else { v2 = a1; v3 = 0; do v3 += *v2++; while ( v2 != &a1[a2 - 1 + 1] ); } return (double)v3 / (double)a2; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001011a1 MOV RAX,RDI LEA EDX,[RSI + -0x1] LEA RCX,[RDI + RDX*0x4 + 0x4] MOV EDX,0x0 LAB_00101181: ADD EDX,dword ptr [RAX] ADD RAX,0x4 CMP RAX,RCX JNZ 0x00101181 LAB_0010118c: PXOR XMM0,XMM0 CVTSI2SD XMM0,EDX PXOR XMM1,XMM1 CVTSI2SD XMM1,ESI DIVSD XMM0,XMM1 RET LAB_001011a1: MOV EDX,0x0 JMP 0x0010118c
double 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 + *param_1; param_1 = param_1 + 1; } while (param_1 != piVar1); } return (double)iVar2 / (double)param_2; }
7,438
func0
#include <assert.h>
double func0(int numbers[], int size) { int total = 0; for (int i = 0; i < size; i++) { total += numbers[i]; } return (double)total / size; }
int main() { int arr1[] = {8, 2, 3, 0, 7}; int arr2[] = {-10, -20, -30}; int arr3[] = {19, 15, 18}; assert(func0(arr1, 5) == 4.0); assert(func0(arr2, 3) == -20.0); assert(func0(arr3, 3) == 17.333333333333332); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1180 <func0+0x40> lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rdx xor %eax,%eax nopw 0x0(%rax,%rax,1) add (%rdi),%eax add $0x4,%rdi cmp %rdx,%rdi jne 1158 <func0+0x18> pxor %xmm0,%xmm0 pxor %xmm1,%xmm1 cvtsi2sd %eax,%xmm0 cvtsi2sd %esi,%xmm1 divsd %xmm1,%xmm0 retq nopl 0x0(%rax,%rax,1) pxor %xmm1,%xmm1 pxor %xmm0,%xmm0 cvtsi2sd %esi,%xmm1 divsd %xmm1,%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle short loc_1180 lea eax, [rsi-1] lea rdx, [rdi+rax*4+4] xor eax, eax nop word ptr [rax+rax+00h] loc_1158: add eax, [rdi] add rdi, 4 cmp rdi, rdx jnz short loc_1158 pxor xmm0, xmm0 pxor xmm1, xmm1 cvtsi2sd xmm0, eax cvtsi2sd xmm1, esi divsd xmm0, xmm1 retn loc_1180: pxor xmm1, xmm1 pxor xmm0, xmm0 cvtsi2sd xmm1, esi divsd xmm0, xmm1 retn
double func0(_DWORD *a1, int a2) { long long v2; // rdx int v3; // eax if ( a2 <= 0 ) return 0.0 / (double)a2; v2 = (long long)&a1[a2 - 1 + 1]; v3 = 0; do v3 += *a1++; while ( a1 != (_DWORD *)v2 ); return (double)v3 / (double)a2; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101180 LEA EAX,[RSI + -0x1] LEA RDX,[RDI + RAX*0x4 + 0x4] XOR EAX,EAX NOP word ptr [RAX + RAX*0x1] LAB_00101158: ADD EAX,dword ptr [RDI] ADD RDI,0x4 CMP RDI,RDX JNZ 0x00101158 PXOR XMM0,XMM0 PXOR XMM1,XMM1 CVTSI2SD XMM0,EAX CVTSI2SD XMM1,ESI DIVSD XMM0,XMM1 RET LAB_00101180: PXOR XMM1,XMM1 PXOR XMM0,XMM0 CVTSI2SD XMM1,ESI DIVSD XMM0,XMM1 RET
double func0(int *param_1,int param_2) { int *piVar1; int iVar2; if (0 < param_2) { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar2 = 0; do { iVar2 = iVar2 + *param_1; param_1 = param_1 + 1; } while (param_1 != piVar1); return (double)iVar2 / (double)param_2; } return 0.0 / (double)param_2; }
7,439
func0
#include <assert.h>
double func0(int numbers[], int size) { int total = 0; for (int i = 0; i < size; i++) { total += numbers[i]; } return (double)total / size; }
int main() { int arr1[] = {8, 2, 3, 0, 7}; int arr2[] = {-10, -20, -30}; int arr3[] = {19, 15, 18}; assert(func0(arr1, 5) == 4.0); assert(func0(arr2, 3) == -20.0); assert(func0(arr3, 3) == 17.333333333333332); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 11f0 <func0+0xb0> lea -0x1(%rsi),%eax cmp $0x3,%eax jbe 1201 <func0+0xc1> mov %esi,%edx mov %rdi,%rax pxor %xmm0,%xmm0 shr $0x2,%edx shl $0x4,%rdx add %rdi,%rdx nopl 0x0(%rax,%rax,1) movdqu (%rax),%xmm2 add $0x10,%rax paddd %xmm2,%xmm0 cmp %rdx,%rax jne 1170 <func0+0x30> movdqa %xmm0,%xmm1 mov %esi,%edx psrldq $0x8,%xmm1 and $0xfffffffc,%edx paddd %xmm1,%xmm0 movdqa %xmm0,%xmm1 psrldq $0x4,%xmm1 paddd %xmm1,%xmm0 movd %xmm0,%eax test $0x3,%sil je 11d7 <func0+0x97> movslq %edx,%rcx add (%rdi,%rcx,4),%eax lea 0x1(%rdx),%ecx cmp %ecx,%esi jle 11d7 <func0+0x97> movslq %ecx,%rcx add (%rdi,%rcx,4),%eax lea 0x2(%rdx),%ecx cmp %ecx,%esi jle 11d7 <func0+0x97> movslq %ecx,%rcx add $0x3,%edx add (%rdi,%rcx,4),%eax cmp %edx,%esi jle 11d7 <func0+0x97> movslq %edx,%rdx add (%rdi,%rdx,4),%eax pxor %xmm0,%xmm0 pxor %xmm1,%xmm1 cvtsi2sd %eax,%xmm0 cvtsi2sd %esi,%xmm1 divsd %xmm1,%xmm0 retq nopl 0x0(%rax) pxor %xmm1,%xmm1 pxor %xmm0,%xmm0 cvtsi2sd %esi,%xmm1 divsd %xmm1,%xmm0 retq xor %edx,%edx xor %eax,%eax jmp 11aa <func0+0x6a> nopw 0x0(%rax,%rax,1)
func0: endbr64 mov rcx, rdi test esi, esi jle loc_11E8 lea eax, [rsi-1] cmp eax, 2 jbe loc_11F9 mov edx, esi mov rax, rdi pxor xmm0, xmm0 shr edx, 2 shl rdx, 4 add rdx, rdi xchg ax, ax loc_1170: movdqu xmm2, xmmword ptr [rax] add rax, 10h paddd xmm0, xmm2 cmp rax, rdx jnz short loc_1170 movdqa xmm1, xmm0 mov edx, esi psrldq xmm1, 8 and edx, 0FFFFFFFCh paddd xmm0, xmm1 movdqa xmm1, xmm0 psrldq xmm1, 4 paddd xmm0, xmm1 movd eax, xmm0 test sil, 3 jz short loc_11D0 loc_11AA: movsxd rdi, edx lea r8, ds:0[rdi*4] add eax, [rcx+rdi*4] lea edi, [rdx+1] cmp esi, edi jle short loc_11D0 add edx, 2 add eax, [rcx+r8+4] cmp esi, edx jle short loc_11D0 add eax, [rcx+r8+8] loc_11D0: pxor xmm0, xmm0 pxor xmm1, xmm1 cvtsi2sd xmm0, eax cvtsi2sd xmm1, esi divsd xmm0, xmm1 retn loc_11E8: pxor xmm1, xmm1 pxor xmm0, xmm0 cvtsi2sd xmm1, esi divsd xmm0, xmm1 retn loc_11F9: xor edx, edx xor eax, eax jmp short loc_11AA
double func0(const __m128i *a1, int a2) { const __m128i *v2; // rax __m128i v3; // xmm0 __m128i v4; // xmm2 int v5; // edx __m128i v6; // xmm0 int v7; // eax long long v8; // r8 if ( a2 > 0 ) { if ( (unsigned int)(a2 - 1) <= 2 ) { v5 = 0; v7 = 0; } else { v2 = a1; v3 = 0LL; do { v4 = _mm_loadu_si128(v2++); v3 = _mm_add_epi32(v3, v4); } while ( v2 != &a1[(unsigned int)a2 >> 2] ); v5 = a2 & 0x7FFFFFFC; v6 = _mm_add_epi32(v3, _mm_srli_si128(v3, 8)); v7 = _mm_cvtsi128_si32(_mm_add_epi32(v6, _mm_srli_si128(v6, 4))); if ( (a2 & 3) == 0 ) return (double)v7 / (double)a2; } v8 = v5; v7 += a1->m128i_i32[v8]; if ( a2 > v5 + 1 ) { v7 += a1->m128i_i32[v8 + 1]; if ( a2 > v5 + 2 ) v7 += a1->m128i_i32[v8 + 2]; } return (double)v7 / (double)a2; } return 0.0 / (double)a2; }
func0: ENDBR64 MOV RCX,RDI TEST ESI,ESI JLE 0x001011e8 LEA EAX,[RSI + -0x1] CMP EAX,0x2 JBE 0x001011f9 MOV EDX,ESI MOV RAX,RDI PXOR XMM0,XMM0 SHR EDX,0x2 SHL RDX,0x4 ADD RDX,RDI NOP LAB_00101170: MOVDQU XMM2,xmmword ptr [RAX] ADD RAX,0x10 PADDD XMM0,XMM2 CMP RAX,RDX JNZ 0x00101170 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 0x001011d0 LAB_001011aa: MOVSXD RDI,EDX LEA R8,[RDI*0x4] ADD EAX,dword ptr [RCX + RDI*0x4] LEA EDI,[RDX + 0x1] CMP ESI,EDI JLE 0x001011d0 ADD EDX,0x2 ADD EAX,dword ptr [RCX + R8*0x1 + 0x4] CMP ESI,EDX JLE 0x001011d0 ADD EAX,dword ptr [RCX + R8*0x1 + 0x8] LAB_001011d0: PXOR XMM0,XMM0 PXOR XMM1,XMM1 CVTSI2SD XMM0,EAX CVTSI2SD XMM1,ESI DIVSD XMM0,XMM1 RET LAB_001011e8: PXOR XMM1,XMM1 PXOR XMM0,XMM0 CVTSI2SD XMM1,ESI DIVSD XMM0,XMM1 RET LAB_001011f9: XOR EDX,EDX XOR EAX,EAX JMP 0x001011aa
double 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.0 / (double)(int)param_2; } 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 + iVar1; iVar8 = iVar8 + *piVar2; iVar9 = iVar9 + *piVar3; iVar10 = iVar10 + *piVar4; } while (piVar5 != param_1 + (ulong)(param_2 >> 2) * 4); uVar6 = param_2 & 0xfffffffc; iVar7 = iVar7 + iVar9 + iVar8 + iVar10; if ((param_2 & 3) == 0) goto LAB_001011d0; } iVar7 = iVar7 + param_1[(int)uVar6]; if (((int)(uVar6 + 1) < (int)param_2) && (iVar7 = iVar7 + param_1[(long)(int)uVar6 + 1], (int)(uVar6 + 2) < (int)param_2)) { iVar7 = iVar7 + param_1[(long)(int)uVar6 + 2]; } LAB_001011d0: return (double)iVar7 / (double)(int)param_2; }
7,440
func0
#include <stdbool.h> #include <assert.h>
bool func0(int n) { if ((n ^ 1) == n - 1) return true; else return false; }
int main() { assert(func0(5) == true); assert(func0(6) == false); assert(func0(7) == true); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov -0x4(%rbp),%eax xor $0x1,%eax mov %eax,%edx mov -0x4(%rbp),%eax sub $0x1,%eax cmp %eax,%edx jne 116d <func0+0x24> mov $0x1,%eax jmp 1172 <func0+0x29> mov $0x0,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov eax, [rbp+var_4] xor eax, 1 mov edx, eax mov eax, [rbp+var_4] sub eax, 1 cmp edx, eax jnz short loc_116D mov eax, 1 jmp short loc_1172 loc_116D: mov eax, 0 loc_1172: pop rbp retn
_BOOL8 func0(int a1) { return (a1 ^ 1) == a1 - 1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV EAX,dword ptr [RBP + -0x4] XOR EAX,0x1 MOV EDX,EAX MOV EAX,dword ptr [RBP + -0x4] SUB EAX,0x1 CMP EDX,EAX JNZ 0x0010116d MOV EAX,0x1 JMP 0x00101172 LAB_0010116d: MOV EAX,0x0 LAB_00101172: POP RBP RET
bool func0(uint param_1) { return (param_1 ^ 1) == param_1 - 1; }
7,441
func0
#include <stdbool.h> #include <assert.h>
bool func0(int n) { if ((n ^ 1) == n - 1) return true; else return false; }
int main() { assert(func0(5) == true); assert(func0(6) == false); assert(func0(7) == true); return 0; }
O1
c
func0: endbr64 mov %edi,%eax xor $0x1,%eax sub $0x1,%edi cmp %edi,%eax sete %al retq
func0: endbr64 mov eax, edi xor eax, 1 sub edi, 1 cmp eax, edi setz al retn
bool func0(int a1) { return (a1 ^ 1) == a1 - 1; }
func0: ENDBR64 MOV EAX,EDI XOR EAX,0x1 SUB EDI,0x1 CMP EAX,EDI SETZ AL RET
bool func0(uint param_1) { return (param_1 ^ 1) == param_1 - 1; }
7,442
func0
#include <stdbool.h> #include <assert.h>
bool func0(int n) { if ((n ^ 1) == n - 1) return true; else return false; }
int main() { assert(func0(5) == true); assert(func0(6) == false); assert(func0(7) == true); return 0; }
O2
c
func0: endbr64 mov %edi,%eax sub $0x1,%edi xor $0x1,%eax cmp %edi,%eax sete %al retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 mov eax, edi sub edi, 1 xor eax, 1 cmp eax, edi setz al retn
bool func0(int a1) { return (a1 ^ 1) == a1 - 1; }
func0: ENDBR64 MOV EAX,EDI SUB EDI,0x1 XOR EAX,0x1 CMP EAX,EDI SETZ AL RET
bool func0(uint param_1) { return (param_1 ^ 1) == param_1 - 1; }
7,443
func0
#include <stdbool.h> #include <assert.h>
bool func0(int n) { if ((n ^ 1) == n - 1) return true; else return false; }
int main() { assert(func0(5) == true); assert(func0(6) == false); assert(func0(7) == true); return 0; }
O3
c
func0: endbr64 mov %edi,%eax sub $0x1,%edi xor $0x1,%eax cmp %edi,%eax sete %al retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 mov eax, edi sub edi, 1 xor eax, 1 cmp eax, edi setz al retn
bool func0(int a1) { return (a1 ^ 1) == a1 - 1; }
func0: ENDBR64 MOV EAX,EDI SUB EDI,0x1 XOR EAX,0x1 CMP EAX,EDI SETZ AL RET
bool func0(uint param_1) { return (param_1 ^ 1) == param_1 - 1; }
7,444
func0
#include <assert.h>
void func0(const int test_tup1[][2], const int test_tup2[][2], int n, int res[][2]) { for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { res[i][j] = test_tup1[i][j] - test_tup2[i][j]; } } }
int main() { int res[4][2]; int test1_1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test1_2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int expected1[4][2] = {{-5, -4}, {1, -4}, {1, 8}, {-6, 7}}; func0(test1_1, test1_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected1[i][j]); int test2_1[4][2] = {{13, 4}, {14, 6}, {13, 10}, {12, 11}}; int test2_2[4][2] = {{19, 8}, {14, 10}, {12, 2}, {18, 4}}; int expected2[4][2] = {{-6, -4}, {0, -4}, {1, 8}, {-6, 7}}; func0(test2_1, test2_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected2[i][j]); int test3_1[4][2] = {{19, 5}, {18, 7}, {19, 11}, {17, 12}}; int test3_2[4][2] = {{12, 9}, {17, 11}, {13, 3}, {19, 5}}; int expected3[4][2] = {{7, -4}, {1, -4}, {6, 8}, {-2, 7}}; func0(test3_1, test3_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected3[i][j]); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %edx,-0x24(%rbp) mov %rcx,-0x30(%rbp) movl $0x0,-0x8(%rbp) jmp 11f7 <func0+0x8e> movl $0x0,-0x4(%rbp) jmp 11ed <func0+0x84> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rax,%rdx mov -0x4(%rbp),%eax cltq mov (%rdx,%rax,4),%ecx mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x20(%rbp),%rax add %rax,%rdx mov -0x4(%rbp),%eax cltq mov (%rdx,%rax,4),%eax mov -0x8(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,8),%rsi mov -0x30(%rbp),%rdx add %rsi,%rdx sub %eax,%ecx mov -0x4(%rbp),%eax cltq mov %ecx,(%rdx,%rax,4) addl $0x1,-0x4(%rbp) cmpl $0x1,-0x4(%rbp) jle 1192 <func0+0x29> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x24(%rbp),%eax jl 1189 <func0+0x20> pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_24], edx mov [rbp+var_30], rcx mov [rbp+var_8], 0 jmp short loc_11F7 loc_1189: mov [rbp+var_4], 0 jmp short loc_11ED loc_1192: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] add rdx, rax mov eax, [rbp+var_4] cdqe mov ecx, [rdx+rax*4] mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_20] add rdx, rax mov eax, [rbp+var_4] cdqe mov eax, [rdx+rax*4] mov edx, [rbp+var_8] movsxd rdx, edx lea rsi, ds:0[rdx*8] mov rdx, [rbp+var_30] add rdx, rsi sub ecx, eax mov eax, [rbp+var_4] cdqe mov [rdx+rax*4], ecx add [rbp+var_4], 1 loc_11ED: cmp [rbp+var_4], 1 jle short loc_1192 add [rbp+var_8], 1 loc_11F7: mov eax, [rbp+var_8] cmp eax, [rbp+var_24] jl short loc_1189 nop nop pop rbp retn
long long func0(long long a1, long long a2, int a3, long long a4) { long long result; // rax unsigned int i; // [rsp+28h] [rbp-8h] int j; // [rsp+2Ch] [rbp-4h] for ( i = 0; ; ++i ) { result = i; if ( (int)i >= a3 ) break; for ( j = 0; j <= 1; ++j ) *(_DWORD *)(8LL * (int)i + a4 + 4LL * j) = *(_DWORD *)(a1 + 8LL * (int)i + 4LL * j) - *(_DWORD *)(a2 + 8LL * (int)i + 4LL * j); } return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV dword ptr [RBP + -0x24],EDX MOV qword ptr [RBP + -0x30],RCX MOV dword ptr [RBP + -0x8],0x0 JMP 0x001011f7 LAB_00101189: MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011ed LAB_00101192: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x4] CDQE MOV ECX,dword ptr [RDX + RAX*0x4] MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x20] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x4] CDQE MOV EAX,dword ptr [RDX + RAX*0x4] MOV EDX,dword ptr [RBP + -0x8] MOVSXD RDX,EDX LEA RSI,[RDX*0x8] MOV RDX,qword ptr [RBP + -0x30] ADD RDX,RSI SUB ECX,EAX MOV EAX,dword ptr [RBP + -0x4] CDQE MOV dword ptr [RDX + RAX*0x4],ECX ADD dword ptr [RBP + -0x4],0x1 LAB_001011ed: CMP dword ptr [RBP + -0x4],0x1 JLE 0x00101192 ADD dword ptr [RBP + -0x8],0x1 LAB_001011f7: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x24] JL 0x00101189 NOP NOP POP RBP RET
void func0(long param_1,long param_2,int param_3,long param_4) { int4 local_10; int4 local_c; for (local_10 = 0; local_10 < param_3; local_10 = local_10 + 1) { for (local_c = 0; local_c < 2; local_c = local_c + 1) { *(int *)(param_4 + (long)local_10 * 8 + (long)local_c * 4) = *(int *)((long)local_10 * 8 + param_1 + (long)local_c * 4) - *(int *)((long)local_10 * 8 + param_2 + (long)local_c * 4); } } return; }
7,445
func0
#include <assert.h>
void func0(const int test_tup1[][2], const int test_tup2[][2], int n, int res[][2]) { for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { res[i][j] = test_tup1[i][j] - test_tup2[i][j]; } } }
int main() { int res[4][2]; int test1_1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test1_2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int expected1[4][2] = {{-5, -4}, {1, -4}, {1, 8}, {-6, 7}}; func0(test1_1, test1_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected1[i][j]); int test2_1[4][2] = {{13, 4}, {14, 6}, {13, 10}, {12, 11}}; int test2_2[4][2] = {{19, 8}, {14, 10}, {12, 2}, {18, 4}}; int expected2[4][2] = {{-6, -4}, {0, -4}, {1, 8}, {-6, 7}}; func0(test2_1, test2_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected2[i][j]); int test3_1[4][2] = {{19, 5}, {18, 7}, {19, 11}, {17, 12}}; int test3_2[4][2] = {{12, 9}, {17, 11}, {13, 3}, {19, 5}}; int expected3[4][2] = {{7, -4}, {1, -4}, {6, 8}, {-2, 7}}; func0(test3_1, test3_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected3[i][j]); return 0; }
O1
c
func0: endbr64 test %edx,%edx jle 119b <func0+0x32> lea -0x1(%rdx),%r8d mov $0x0,%eax mov (%rdi,%rax,8),%edx sub (%rsi,%rax,8),%edx mov %edx,(%rcx,%rax,8) mov 0x4(%rdi,%rax,8),%edx sub 0x4(%rsi,%rax,8),%edx mov %edx,0x4(%rcx,%rax,8) mov %rax,%rdx add $0x1,%rax cmp %r8,%rdx jne 117a <func0+0x11> retq
func0: endbr64 test edx, edx jle short locret_1197 mov r8d, edx mov eax, 0 loc_1179: mov edx, [rdi+rax*8] sub edx, [rsi+rax*8] mov [rcx+rax*8], edx mov edx, [rdi+rax*8+4] sub edx, [rsi+rax*8+4] mov [rcx+rax*8+4], edx add rax, 1 cmp rax, r8 jnz short loc_1179 locret_1197: retn
void func0(long long a1, long long a2, int a3, long long a4) { long long i; // rax if ( a3 > 0 ) { for ( i = 0LL; i != a3; ++i ) { *(_DWORD *)(a4 + 8 * i) = *(_DWORD *)(a1 + 8 * i) - *(_DWORD *)(a2 + 8 * i); *(_DWORD *)(a4 + 8 * i + 4) = *(_DWORD *)(a1 + 8 * i + 4) - *(_DWORD *)(a2 + 8 * i + 4); } } }
func0: ENDBR64 TEST EDX,EDX JLE 0x00101197 MOV R8D,EDX MOV EAX,0x0 LAB_00101179: MOV EDX,dword ptr [RDI + RAX*0x8] SUB EDX,dword ptr [RSI + RAX*0x8] MOV dword ptr [RCX + RAX*0x8],EDX MOV EDX,dword ptr [RDI + RAX*0x8 + 0x4] SUB EDX,dword ptr [RSI + RAX*0x8 + 0x4] MOV dword ptr [RCX + RAX*0x8 + 0x4],EDX ADD RAX,0x1 CMP RAX,R8 JNZ 0x00101179 LAB_00101197: RET
void func0(long param_1,long param_2,uint param_3,long param_4) { ulong uVar1; if (0 < (int)param_3) { uVar1 = 0; do { *(int *)(param_4 + uVar1 * 8) = *(int *)(param_1 + uVar1 * 8) - *(int *)(param_2 + uVar1 * 8); *(int *)(param_4 + 4 + uVar1 * 8) = *(int *)(param_1 + 4 + uVar1 * 8) - *(int *)(param_2 + 4 + uVar1 * 8); uVar1 = uVar1 + 1; } while (uVar1 != param_3); } return; }
7,446
func0
#include <assert.h>
void func0(const int test_tup1[][2], const int test_tup2[][2], int n, int res[][2]) { for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { res[i][j] = test_tup1[i][j] - test_tup2[i][j]; } } }
int main() { int res[4][2]; int test1_1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test1_2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int expected1[4][2] = {{-5, -4}, {1, -4}, {1, 8}, {-6, 7}}; func0(test1_1, test1_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected1[i][j]); int test2_1[4][2] = {{13, 4}, {14, 6}, {13, 10}, {12, 11}}; int test2_2[4][2] = {{19, 8}, {14, 10}, {12, 2}, {18, 4}}; int expected2[4][2] = {{-6, -4}, {0, -4}, {1, 8}, {-6, 7}}; func0(test2_1, test2_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected2[i][j]); int test3_1[4][2] = {{19, 5}, {18, 7}, {19, 11}, {17, 12}}; int test3_2[4][2] = {{12, 9}, {17, 11}, {13, 3}, {19, 5}}; int expected3[4][2] = {{7, -4}, {1, -4}, {6, 8}, {-2, 7}}; func0(test3_1, test3_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected3[i][j]); return 0; }
O2
c
func0: endbr64 test %edx,%edx jle 1581 <func0+0x31> lea -0x1(%rdx),%r8d xor %eax,%eax xchg %ax,%ax mov (%rdi,%rax,8),%edx sub (%rsi,%rax,8),%edx mov %edx,(%rcx,%rax,8) mov 0x4(%rdi,%rax,8),%edx sub 0x4(%rsi,%rax,8),%edx mov %edx,0x4(%rcx,%rax,8) mov %rax,%rdx add $0x1,%rax cmp %rdx,%r8 jne 1560 <func0+0x10> retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 test edx, edx jle short locret_154E movsxd r8, edx xor eax, eax nop dword ptr [rax] loc_1530: mov edx, [rdi+rax*8] sub edx, [rsi+rax*8] mov [rcx+rax*8], edx mov edx, [rdi+rax*8+4] sub edx, [rsi+rax*8+4] mov [rcx+rax*8+4], edx add rax, 1 cmp r8, rax jnz short loc_1530 locret_154E: retn
void func0(long long a1, long long a2, int a3, long long a4) { long long i; // rax if ( a3 > 0 ) { for ( i = 0LL; i != a3; ++i ) { *(_DWORD *)(a4 + 8 * i) = *(_DWORD *)(a1 + 8 * i) - *(_DWORD *)(a2 + 8 * i); *(_DWORD *)(a4 + 8 * i + 4) = *(_DWORD *)(a1 + 8 * i + 4) - *(_DWORD *)(a2 + 8 * i + 4); } } }
func0: ENDBR64 TEST EDX,EDX JLE 0x0010154e MOVSXD R8,EDX XOR EAX,EAX NOP dword ptr [RAX] LAB_00101530: MOV EDX,dword ptr [RDI + RAX*0x8] SUB EDX,dword ptr [RSI + RAX*0x8] MOV dword ptr [RCX + RAX*0x8],EDX MOV EDX,dword ptr [RDI + RAX*0x8 + 0x4] SUB EDX,dword ptr [RSI + RAX*0x8 + 0x4] MOV dword ptr [RCX + RAX*0x8 + 0x4],EDX ADD RAX,0x1 CMP R8,RAX JNZ 0x00101530 LAB_0010154e: RET
void func0(long param_1,long param_2,int param_3,long param_4) { long lVar1; if (0 < param_3) { lVar1 = 0; do { *(int *)(param_4 + lVar1 * 8) = *(int *)(param_1 + lVar1 * 8) - *(int *)(param_2 + lVar1 * 8); *(int *)(param_4 + 4 + lVar1 * 8) = *(int *)(param_1 + 4 + lVar1 * 8) - *(int *)(param_2 + 4 + lVar1 * 8); lVar1 = lVar1 + 1; } while (param_3 != lVar1); } return; }
7,447
func0
#include <assert.h>
void func0(const int test_tup1[][2], const int test_tup2[][2], int n, int res[][2]) { for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { res[i][j] = test_tup1[i][j] - test_tup2[i][j]; } } }
int main() { int res[4][2]; int test1_1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test1_2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int expected1[4][2] = {{-5, -4}, {1, -4}, {1, 8}, {-6, 7}}; func0(test1_1, test1_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected1[i][j]); int test2_1[4][2] = {{13, 4}, {14, 6}, {13, 10}, {12, 11}}; int test2_2[4][2] = {{19, 8}, {14, 10}, {12, 2}, {18, 4}}; int expected2[4][2] = {{-6, -4}, {0, -4}, {1, 8}, {-6, 7}}; func0(test2_1, test2_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected2[i][j]); int test3_1[4][2] = {{19, 5}, {18, 7}, {19, 11}, {17, 12}}; int test3_2[4][2] = {{12, 9}, {17, 11}, {13, 3}, {19, 5}}; int expected3[4][2] = {{7, -4}, {1, -4}, {6, 8}, {-2, 7}}; func0(test3_1, test3_2, 4, res); for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) assert(res[i][j] == expected3[i][j]); return 0; }
O3
c
func0: endbr64 test %edx,%edx jle 1511 <func0+0xb1> lea 0xf(%rsi),%rax sub %rcx,%rax cmp $0x1e,%rax seta %r8b cmp $0x1,%edx setne %al test %al,%r8b je 14e5 <func0+0x85> lea 0xf(%rdi),%rax sub %rcx,%rax cmp $0x1e,%rax jbe 14e5 <func0+0x85> mov %edx,%eax xor %r8d,%r8d shr %eax shl $0x4,%rax xchg %ax,%ax movdqu (%rdi,%r8,1),%xmm0 movdqu (%rsi,%r8,1),%xmm1 psubd %xmm1,%xmm0 movups %xmm0,(%rcx,%r8,1) add $0x10,%r8 cmp %rax,%r8 jne 14a0 <func0+0x40> mov %edx,%eax and $0xfffffffe,%eax and $0x1,%edx je 1511 <func0+0xb1> shl $0x3,%rax add %rax,%rdi add %rax,%rsi add %rcx,%rax mov (%rdi),%edx sub (%rsi),%edx mov %edx,(%rax) mov 0x4(%rdi),%edx sub 0x4(%rsi),%edx mov %edx,0x4(%rax) retq lea -0x1(%rdx),%r8d xor %eax,%eax nopl 0x0(%rax,%rax,1) mov (%rdi,%rax,8),%edx sub (%rsi,%rax,8),%edx mov %edx,(%rcx,%rax,8) mov 0x4(%rdi,%rax,8),%edx sub 0x4(%rsi,%rax,8),%edx mov %edx,0x4(%rcx,%rax,8) mov %rax,%rdx add $0x1,%rax cmp %rdx,%r8 jne 14f0 <func0+0x90> retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 test edx, edx jle locret_11EC lea rax, [rdi+0Fh] sub rax, rcx cmp rax, 1Eh jbe short loc_11B9 lea rax, [rsi+0Fh] sub rax, rcx cmp rax, 1Eh jbe short loc_11B9 cmp edx, 1 jz loc_11EE mov r8d, edx xor eax, eax shr r8d, 1 shl r8, 4 nop dword ptr [rax+rax+00h] loc_1180: movdqu xmm0, xmmword ptr [rdi+rax] movdqu xmm2, xmmword ptr [rsi+rax] psubd xmm0, xmm2 movups xmmword ptr [rcx+rax], xmm0 add rax, 10h cmp rax, r8 jnz short loc_1180 mov eax, edx and eax, 0FFFFFFFEh and edx, 1 jz short locret_11ED loc_11A5: movq xmm0, qword ptr [rdi+rax*8] movq xmm1, qword ptr [rsi+rax*8] psubd xmm0, xmm1 movq qword ptr [rcx+rax*8], xmm0 retn loc_11B9: movsxd rdx, edx xor eax, eax shl rdx, 3 nop word ptr [rax+rax+00h] loc_11C8: mov r8d, [rdi+rax] sub r8d, [rsi+rax] mov [rcx+rax], r8d mov r8d, [rdi+rax+4] sub r8d, [rsi+rax+4] mov [rcx+rax+4], r8d add rax, 8 cmp rax, rdx jnz short loc_11C8 locret_11EC: retn locret_11ED: retn loc_11EE: xor eax, eax jmp short loc_11A5
void func0(long long a1, long long a2, int a3, long long a4) { long long v4; // rax long long v5; // rax long long v6; // rax long long v7; // rdx if ( a3 > 0 ) { if ( (unsigned long long)(a1 + 15 - a4) <= 0x1E || (unsigned long long)(a2 + 15 - a4) <= 0x1E ) { v6 = 0LL; v7 = 8LL * a3; do { *(_DWORD *)(a4 + v6) = *(_DWORD *)(a1 + v6) - *(_DWORD *)(a2 + v6); *(_DWORD *)(a4 + v6 + 4) = *(_DWORD *)(a1 + v6 + 4) - *(_DWORD *)(a2 + v6 + 4); v6 += 8LL; } while ( v6 != v7 ); } else { if ( a3 == 1 ) { v5 = 0LL; LABEL_8: *(_QWORD *)(a4 + 8 * v5) = _mm_sub_epi32( _mm_loadl_epi64((const __m128i *)(a1 + 8 * v5)), _mm_loadl_epi64((const __m128i *)(a2 + 8 * v5))).m128i_u64[0]; return; } v4 = 0LL; do { *(__m128i *)(a4 + v4) = _mm_sub_epi32( _mm_loadu_si128((const __m128i *)(a1 + v4)), _mm_loadu_si128((const __m128i *)(a2 + v4))); v4 += 16LL; } while ( v4 != 16LL * ((unsigned int)a3 >> 1) ); v5 = a3 & 0xFFFFFFFE; if ( (a3 & 1) != 0 ) goto LABEL_8; } } }
func0: ENDBR64 TEST EDX,EDX JLE 0x001011ec LEA RAX,[RDI + 0xf] SUB RAX,RCX CMP RAX,0x1e JBE 0x001011b9 LEA RAX,[RSI + 0xf] SUB RAX,RCX CMP RAX,0x1e JBE 0x001011b9 CMP EDX,0x1 JZ 0x001011ee MOV R8D,EDX XOR EAX,EAX SHR R8D,0x1 SHL R8,0x4 NOP dword ptr [RAX + RAX*0x1] LAB_00101180: MOVDQU XMM0,xmmword ptr [RDI + RAX*0x1] MOVDQU XMM2,xmmword ptr [RSI + RAX*0x1] PSUBD XMM0,XMM2 MOVUPS xmmword ptr [RCX + RAX*0x1],XMM0 ADD RAX,0x10 CMP RAX,R8 JNZ 0x00101180 MOV EAX,EDX AND EAX,0xfffffffe AND EDX,0x1 JZ 0x001011ed LAB_001011a5: MOVQ XMM0,qword ptr [RDI + RAX*0x8] MOVQ XMM1,qword ptr [RSI + RAX*0x8] PSUBD XMM0,XMM1 MOVQ qword ptr [RCX + RAX*0x8],XMM0 RET LAB_001011b9: MOVSXD RDX,EDX XOR EAX,EAX SHL RDX,0x3 NOP word ptr [RAX + RAX*0x1] LAB_001011c8: MOV R8D,dword ptr [RDI + RAX*0x1] SUB R8D,dword ptr [RSI + RAX*0x1] MOV dword ptr [RCX + RAX*0x1],R8D MOV R8D,dword ptr [RDI + RAX*0x1 + 0x4] SUB R8D,dword ptr [RSI + RAX*0x1 + 0x4] MOV dword ptr [RCX + RAX*0x1 + 0x4],R8D ADD RAX,0x8 CMP RAX,RDX JNZ 0x001011c8 LAB_001011ec: RET LAB_001011ed: RET LAB_001011ee: XOR EAX,EAX JMP 0x001011a5
void func0(long param_1,long param_2,uint param_3,long param_4) { int *piVar1; int *piVar2; int *piVar3; int8 uVar4; int8 uVar5; int iVar6; int iVar7; int iVar8; int iVar9; int iVar10; int iVar11; long lVar12; ulong uVar13; if (0 < (int)param_3) { if ((0x1e < (ulong)((param_1 + 0xf) - param_4)) && (0x1e < (ulong)((param_2 + 0xf) - param_4))) { if (param_3 == 1) { uVar13 = 0; } else { lVar12 = 0; do { piVar1 = (int *)(param_1 + lVar12); iVar6 = piVar1[1]; iVar7 = piVar1[2]; iVar8 = piVar1[3]; piVar2 = (int *)(param_2 + lVar12); iVar9 = piVar2[1]; iVar10 = piVar2[2]; iVar11 = piVar2[3]; piVar3 = (int *)(param_4 + lVar12); *piVar3 = *piVar1 - *piVar2; piVar3[1] = iVar6 - iVar9; piVar3[2] = iVar7 - iVar10; piVar3[3] = iVar8 - iVar11; lVar12 = lVar12 + 0x10; } while (lVar12 != (ulong)(param_3 >> 1) << 4); uVar13 = (ulong)(param_3 & 0xfffffffe); if ((param_3 & 1) == 0) { return; } } uVar4 = *(int8 *)(param_1 + uVar13 * 8); uVar5 = *(int8 *)(param_2 + uVar13 * 8); *(ulong *)(param_4 + uVar13 * 8) = CONCAT44((int)((ulong)uVar4 >> 0x20) - (int)((ulong)uVar5 >> 0x20), (int)uVar4 - (int)uVar5); return; } lVar12 = 0; do { *(int *)(param_4 + lVar12) = *(int *)(param_1 + lVar12) - *(int *)(param_2 + lVar12); *(int *)(param_4 + 4 + lVar12) = *(int *)(param_1 + 4 + lVar12) - *(int *)(param_2 + 4 + lVar12); lVar12 = lVar12 + 8; } while (lVar12 != (long)(int)param_3 * 8); } return; }
7,448
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> int compare_desc(const void* a, const void* b) { return (*(int*)b - *(int*)a); }
void func0(int** lists, int* sizes, int num_lists) { for(int i = 0; i < num_lists; i++) { qsort(lists[i], sizes[i], sizeof(int), compare_desc); } }
int main() { // First test case int list1_1[] = {1, 2, 3, 4}; int list1_2[] = {5, 6, 7, 8}; int list1_3[] = {9, 10, 11, 12}; int list1_4[] = {13, 14, 15, 16}; int* lists1[] = {list1_1, list1_2, list1_3, list1_4}; int sizes1[] = {4, 4, 4, 4}; func0(lists1, sizes1, 4); int expected1_1[] = {4, 3, 2, 1}; int expected1_2[] = {8, 7, 6, 5}; int expected1_3[] = {12, 11, 10, 9}; int expected1_4[] = {16, 15, 14, 13}; assert(memcmp(lists1[0], expected1_1, sizeof(expected1_1)) == 0); assert(memcmp(lists1[1], expected1_2, sizeof(expected1_2)) == 0); assert(memcmp(lists1[2], expected1_3, sizeof(expected1_3)) == 0); assert(memcmp(lists1[3], expected1_4, sizeof(expected1_4)) == 0); // Second test case int list2_1[] = {1, 2}; int list2_2[] = {2, 3}; int list2_3[] = {3, 4}; int* lists2[] = {list2_1, list2_2, list2_3}; int sizes2[] = {2, 2, 2}; func0(lists2, sizes2, 3); int expected2_1[] = {2, 1}; int expected2_2[] = {3, 2}; int expected2_3[] = {4, 3}; assert(memcmp(lists2[0], expected2_1, sizeof(expected2_1)) == 0); assert(memcmp(lists2[1], expected2_2, sizeof(expected2_2)) == 0); assert(memcmp(lists2[2], expected2_3, sizeof(expected2_3)) == 0); // Third test case int list3_1[] = {10, 20}; int list3_2[] = {30, 40}; int* lists3[] = {list3_1, list3_2}; int sizes3[] = {2, 2}; func0(lists3, sizes3, 2); int expected3_1[] = {20, 10}; int expected3_2[] = {40, 30}; assert(memcmp(lists3[0], expected3_1, sizeof(expected3_1)) == 0); assert(memcmp(lists3[1], expected3_2, sizeof(expected3_2)) == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %edx,-0x24(%rbp) movl $0x0,-0x4(%rbp) jmp 1233 <func0+0x68> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x20(%rbp),%rax add %rdx,%rax mov (%rax),%eax movslq %eax,%rsi mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax lea -0x79(%rip),%rcx mov $0x4,%edx mov %rax,%rdi callq 1080 <qsort@plt> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x24(%rbp),%eax jl 11eb <func0+0x20> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_24], edx mov [rbp+var_4], 0 jmp short loc_1236 loc_11EB: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_20] add rax, rdx mov eax, [rax] movsxd rsi, eax; nmemb mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] add rax, rdx mov rax, [rax] lea rdx, compare_desc mov rcx, rdx; compar mov edx, 4; size mov rdi, rax; base call _qsort add [rbp+var_4], 1 loc_1236: mov eax, [rbp+var_4] cmp eax, [rbp+var_24] jl short loc_11EB nop nop leave retn
long long func0(long long a1, long long a2, int a3) { long long result; // rax unsigned int i; // [rsp+2Ch] [rbp-4h] for ( i = 0; ; ++i ) { result = i; if ( (int)i >= a3 ) break; qsort(*(void **)(8LL * (int)i + a1), *(int *)(4LL * (int)i + a2), 4uLL, compare_desc); } 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 dword ptr [RBP + -0x24],EDX MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101236 LAB_001011eb: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOVSXD RSI,EAX MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] LEA RDX,[0x1011a9] MOV RCX,RDX MOV EDX,0x4 MOV RDI,RAX CALL 0x00101080 ADD dword ptr [RBP + -0x4],0x1 LAB_00101236: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x24] JL 0x001011eb NOP NOP LEAVE RET
void func0(long param_1,long param_2,int param_3) { int local_c; for (local_c = 0; local_c < param_3; local_c = local_c + 1) { qsort(*(void **)(param_1 + (long)local_c * 8),(long)*(int *)(param_2 + (long)local_c * 4),4, compare_desc); } return; }
7,449
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> int compare_desc(const void* a, const void* b) { return (*(int*)b - *(int*)a); }
void func0(int** lists, int* sizes, int num_lists) { for(int i = 0; i < num_lists; i++) { qsort(lists[i], sizes[i], sizeof(int), compare_desc); } }
int main() { // First test case int list1_1[] = {1, 2, 3, 4}; int list1_2[] = {5, 6, 7, 8}; int list1_3[] = {9, 10, 11, 12}; int list1_4[] = {13, 14, 15, 16}; int* lists1[] = {list1_1, list1_2, list1_3, list1_4}; int sizes1[] = {4, 4, 4, 4}; func0(lists1, sizes1, 4); int expected1_1[] = {4, 3, 2, 1}; int expected1_2[] = {8, 7, 6, 5}; int expected1_3[] = {12, 11, 10, 9}; int expected1_4[] = {16, 15, 14, 13}; assert(memcmp(lists1[0], expected1_1, sizeof(expected1_1)) == 0); assert(memcmp(lists1[1], expected1_2, sizeof(expected1_2)) == 0); assert(memcmp(lists1[2], expected1_3, sizeof(expected1_3)) == 0); assert(memcmp(lists1[3], expected1_4, sizeof(expected1_4)) == 0); // Second test case int list2_1[] = {1, 2}; int list2_2[] = {2, 3}; int list2_3[] = {3, 4}; int* lists2[] = {list2_1, list2_2, list2_3}; int sizes2[] = {2, 2, 2}; func0(lists2, sizes2, 3); int expected2_1[] = {2, 1}; int expected2_2[] = {3, 2}; int expected2_3[] = {4, 3}; assert(memcmp(lists2[0], expected2_1, sizeof(expected2_1)) == 0); assert(memcmp(lists2[1], expected2_2, sizeof(expected2_2)) == 0); assert(memcmp(lists2[2], expected2_3, sizeof(expected2_3)) == 0); // Third test case int list3_1[] = {10, 20}; int list3_2[] = {30, 40}; int* lists3[] = {list3_1, list3_2}; int sizes3[] = {2, 2}; func0(lists3, sizes3, 2); int expected3_1[] = {20, 10}; int expected3_2[] = {40, 30}; assert(memcmp(lists3[0], expected3_1, sizeof(expected3_1)) == 0); assert(memcmp(lists3[1], expected3_2, sizeof(expected3_2)) == 0); return 0; }
O1
c
func0: endbr64 test %edx,%edx jle 1203 <func0+0x51> push %r14 push %r13 push %r12 push %rbp push %rbx mov %rdi,%rbp mov %rsi,%r12 lea -0x1(%rdx),%r14d mov $0x0,%ebx lea -0x2f(%rip),%r13 movslq (%r12,%rbx,4),%rsi mov 0x0(%rbp,%rbx,8),%rdi mov %r13,%rcx mov $0x4,%edx callq 1080 <qsort@plt> mov %rbx,%rax add $0x1,%rbx cmp %r14,%rax jne 11d8 <func0+0x26> pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq retq
func0: endbr64 test edx, edx jle short locret_11FE push r14 push r13 push r12 push rbp push rbx mov r12, rdi mov r13, rsi mov ebp, edx mov ebx, 0 lea r14, compare_desc loc_11D6: movsxd rsi, dword ptr [r13+rbx*4+0] mov rdi, [r12+rbx*8] mov rcx, r14 mov edx, 4 call _qsort add rbx, 1 cmp rbx, rbp jnz short loc_11D6 pop rbx pop rbp pop r12 pop r13 pop r14 retn locret_11FE: retn
long long func0(long long a1, long long a2, int a3) { long long v3; // rbp long long i; // rbx long long result; // rax if ( a3 > 0 ) { v3 = (unsigned int)a3; for ( i = 0LL; i != v3; ++i ) result = qsort(*(_QWORD *)(a1 + 8 * i), *(int *)(a2 + 4 * i), 4LL, compare_desc); } return result; }
func0: ENDBR64 TEST EDX,EDX JLE 0x001011fe PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX MOV R12,RDI MOV R13,RSI MOV EBP,EDX MOV EBX,0x0 LEA R14,[0x1011a9] LAB_001011d6: MOVSXD RSI,dword ptr [R13 + RBX*0x4] MOV RDI,qword ptr [R12 + RBX*0x8] MOV RCX,R14 MOV EDX,0x4 CALL 0x00101080 ADD RBX,0x1 CMP RBX,RBP JNZ 0x001011d6 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_001011fe: RET
void func0(long param_1,long param_2,uint param_3) { ulong uVar1; if (0 < (int)param_3) { uVar1 = 0; do { qsort(*(void **)(param_1 + uVar1 * 8),(long)*(int *)(param_2 + uVar1 * 4),4,compare_desc); uVar1 = uVar1 + 1; } while (uVar1 != param_3); return; } return; }
7,450
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> int compare_desc(const void* a, const void* b) { return (*(int*)b - *(int*)a); }
void func0(int** lists, int* sizes, int num_lists) { for(int i = 0; i < num_lists; i++) { qsort(lists[i], sizes[i], sizeof(int), compare_desc); } }
int main() { // First test case int list1_1[] = {1, 2, 3, 4}; int list1_2[] = {5, 6, 7, 8}; int list1_3[] = {9, 10, 11, 12}; int list1_4[] = {13, 14, 15, 16}; int* lists1[] = {list1_1, list1_2, list1_3, list1_4}; int sizes1[] = {4, 4, 4, 4}; func0(lists1, sizes1, 4); int expected1_1[] = {4, 3, 2, 1}; int expected1_2[] = {8, 7, 6, 5}; int expected1_3[] = {12, 11, 10, 9}; int expected1_4[] = {16, 15, 14, 13}; assert(memcmp(lists1[0], expected1_1, sizeof(expected1_1)) == 0); assert(memcmp(lists1[1], expected1_2, sizeof(expected1_2)) == 0); assert(memcmp(lists1[2], expected1_3, sizeof(expected1_3)) == 0); assert(memcmp(lists1[3], expected1_4, sizeof(expected1_4)) == 0); // Second test case int list2_1[] = {1, 2}; int list2_2[] = {2, 3}; int list2_3[] = {3, 4}; int* lists2[] = {list2_1, list2_2, list2_3}; int sizes2[] = {2, 2, 2}; func0(lists2, sizes2, 3); int expected2_1[] = {2, 1}; int expected2_2[] = {3, 2}; int expected2_3[] = {4, 3}; assert(memcmp(lists2[0], expected2_1, sizeof(expected2_1)) == 0); assert(memcmp(lists2[1], expected2_2, sizeof(expected2_2)) == 0); assert(memcmp(lists2[2], expected2_3, sizeof(expected2_3)) == 0); // Third test case int list3_1[] = {10, 20}; int list3_2[] = {30, 40}; int* lists3[] = {list3_1, list3_2}; int sizes3[] = {2, 2}; func0(lists3, sizes3, 2); int expected3_1[] = {20, 10}; int expected3_2[] = {40, 30}; assert(memcmp(lists3[0], expected3_1, sizeof(expected3_1)) == 0); assert(memcmp(lists3[1], expected3_2, sizeof(expected3_2)) == 0); return 0; }
O2
c
func0: endbr64 test %edx,%edx jle 16d8 <func0+0x58> push %r14 mov %rdi,%r14 push %r13 lea -0x1(%rdx),%r13d push %r12 lea -0x2c(%rip),%r12 push %rbp mov %rsi,%rbp push %rbx xor %ebx,%ebx nopl 0x0(%rax,%rax,1) movslq 0x0(%rbp,%rbx,4),%rsi mov (%r14,%rbx,8),%rdi mov %r12,%rcx mov $0x4,%edx callq 1070 <qsort@plt> mov %rbx,%rax add $0x1,%rbx cmp %rax,%r13 jne 16a8 <func0+0x28> pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq nopl 0x0(%rax,%rax,1) retq nopl 0x0(%rax)
func0: endbr64 test edx, edx jle short locret_1690 push r14 mov r14, rdi push r13 lea r13, compare_desc push r12 mov r12, rsi push rbp movsxd rbp, edx push rbx xor ebx, ebx nop word ptr [rax+rax+00h] loc_1668: movsxd rsi, dword ptr [r12+rbx*4] mov rdi, [r14+rbx*8] mov rcx, r13 mov edx, 4 add rbx, 1 call _qsort cmp rbp, rbx jnz short loc_1668 pop rbx pop rbp pop r12 pop r13 pop r14 retn locret_1690: retn
long long func0(long long a1, long long a2, int a3) { long long v5; // rbp long long i; // rbx long long v7; // rsi long long v8; // rdi long long result; // rax if ( a3 > 0 ) { v5 = a3; for ( i = 0LL; i != v5; ++i ) { v7 = *(int *)(a2 + 4 * i); v8 = *(_QWORD *)(a1 + 8 * i); result = qsort(v8, v7, 4LL, compare_desc); } } return result; }
func0: ENDBR64 TEST EDX,EDX JLE 0x00101690 PUSH R14 MOV R14,RDI PUSH R13 LEA R13,[0x101630] PUSH R12 MOV R12,RSI PUSH RBP MOVSXD RBP,EDX PUSH RBX XOR EBX,EBX NOP word ptr [RAX + RAX*0x1] LAB_00101668: MOVSXD RSI,dword ptr [R12 + RBX*0x4] MOV RDI,qword ptr [R14 + RBX*0x8] MOV RCX,R13 MOV EDX,0x4 ADD RBX,0x1 CALL 0x00101070 CMP RBP,RBX JNZ 0x00101668 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_00101690: RET
void func0(long param_1,long param_2,int param_3) { long lVar1; long lVar2; long lVar3; if (0 < param_3) { lVar3 = 0; do { lVar1 = lVar3 * 4; lVar2 = lVar3 * 8; lVar3 = lVar3 + 1; qsort(*(void **)(param_1 + lVar2),(long)*(int *)(param_2 + lVar1),4,compare_desc); } while (param_3 != lVar3); return; } return; }
7,451
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> int compare_desc(const void* a, const void* b) { return (*(int*)b - *(int*)a); }
void func0(int** lists, int* sizes, int num_lists) { for(int i = 0; i < num_lists; i++) { qsort(lists[i], sizes[i], sizeof(int), compare_desc); } }
int main() { // First test case int list1_1[] = {1, 2, 3, 4}; int list1_2[] = {5, 6, 7, 8}; int list1_3[] = {9, 10, 11, 12}; int list1_4[] = {13, 14, 15, 16}; int* lists1[] = {list1_1, list1_2, list1_3, list1_4}; int sizes1[] = {4, 4, 4, 4}; func0(lists1, sizes1, 4); int expected1_1[] = {4, 3, 2, 1}; int expected1_2[] = {8, 7, 6, 5}; int expected1_3[] = {12, 11, 10, 9}; int expected1_4[] = {16, 15, 14, 13}; assert(memcmp(lists1[0], expected1_1, sizeof(expected1_1)) == 0); assert(memcmp(lists1[1], expected1_2, sizeof(expected1_2)) == 0); assert(memcmp(lists1[2], expected1_3, sizeof(expected1_3)) == 0); assert(memcmp(lists1[3], expected1_4, sizeof(expected1_4)) == 0); // Second test case int list2_1[] = {1, 2}; int list2_2[] = {2, 3}; int list2_3[] = {3, 4}; int* lists2[] = {list2_1, list2_2, list2_3}; int sizes2[] = {2, 2, 2}; func0(lists2, sizes2, 3); int expected2_1[] = {2, 1}; int expected2_2[] = {3, 2}; int expected2_3[] = {4, 3}; assert(memcmp(lists2[0], expected2_1, sizeof(expected2_1)) == 0); assert(memcmp(lists2[1], expected2_2, sizeof(expected2_2)) == 0); assert(memcmp(lists2[2], expected2_3, sizeof(expected2_3)) == 0); // Third test case int list3_1[] = {10, 20}; int list3_2[] = {30, 40}; int* lists3[] = {list3_1, list3_2}; int sizes3[] = {2, 2}; func0(lists3, sizes3, 2); int expected3_1[] = {20, 10}; int expected3_2[] = {40, 30}; assert(memcmp(lists3[0], expected3_1, sizeof(expected3_1)) == 0); assert(memcmp(lists3[1], expected3_2, sizeof(expected3_2)) == 0); return 0; }
O3
c
func0: endbr64 test %edx,%edx jle 1658 <func0+0x58> push %r14 mov %rdi,%r14 push %r13 lea -0x1(%rdx),%r13d push %r12 lea -0x2c(%rip),%r12 push %rbp mov %rsi,%rbp push %rbx xor %ebx,%ebx nopl 0x0(%rax,%rax,1) movslq 0x0(%rbp,%rbx,4),%rsi mov (%r14,%rbx,8),%rdi mov %r12,%rcx mov $0x4,%edx callq 1070 <qsort@plt> mov %rbx,%rax add $0x1,%rbx cmp %r13,%rax jne 1628 <func0+0x28> pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq nopl 0x0(%rax,%rax,1) retq nopl 0x0(%rax)
func0: endbr64 test edx, edx jle short locret_1620 push r13 movsxd rdx, edx push r12 lea r13, [rsi+rdx*4] lea r12, compare_desc push rbp mov rbp, rdi push rbx mov rbx, rsi sub rsp, 8 nop word ptr [rax+rax+00000000h] loc_15F0: movsxd rsi, dword ptr [rbx]; nmemb mov rdi, [rbp+0]; base mov rcx, r12; compar mov edx, 4; size add rbx, 4 add rbp, 8 call _qsort cmp rbx, r13 jnz short loc_15F0 add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn locret_1620: retn
void func0(void **a1, int *a2, int a3) { int *v3; // r13 int *v5; // rbx size_t v6; // rsi void *v7; // rdi if ( a3 > 0 ) { v3 = &a2[a3]; v5 = a2; do { v6 = *v5; v7 = *a1; ++v5; ++a1; qsort(v7, v6, 4uLL, compare_desc); } while ( v5 != v3 ); } }
func0: ENDBR64 TEST EDX,EDX JLE 0x00101620 PUSH R13 MOVSXD RDX,EDX PUSH R12 LEA R13,[RSI + RDX*0x4] LEA R12,[0x1015b0] PUSH RBP MOV RBP,RDI PUSH RBX MOV RBX,RSI SUB RSP,0x8 NOP word ptr CS:[RAX + RAX*0x1] LAB_001015f0: MOVSXD RSI,dword ptr [RBX] MOV RDI,qword ptr [RBP] MOV RCX,R12 MOV EDX,0x4 ADD RBX,0x4 ADD RBP,0x8 CALL 0x00101070 CMP RBX,R13 JNZ 0x001015f0 ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_00101620: RET
void func0(int8 *param_1,int *param_2,int param_3) { int *piVar1; int iVar2; void *__base; if (0 < param_3) { piVar1 = param_2 + param_3; do { iVar2 = *param_2; __base = (void *)*param_1; param_2 = param_2 + 1; param_1 = param_1 + 1; qsort(__base,(long)iVar2,4,compare_desc); } while (param_2 != piVar1); return; } return; }
7,452
func0
#include <assert.h>
int func0(int arr1[], int arr2[], int n) { for (int i = 0; i < n; i++) { if (arr1[i] != arr2[i]) { return i; } } return n; }
int main() { int arr1_1[] = {1, 2, 3, 4}; int arr2_1[] = {1, 2, 3}; int arr1_2[] = {2, 4, 6, 8, 10}; int arr2_2[] = {2, 4, 6, 8}; int arr1_3[] = {1, 3, 5, 7, 9, 11}; int arr2_3[] = {1, 3, 5, 7, 9}; assert(func0(arr1_1, arr2_1, 3) == 3); assert(func0(arr1_2, arr2_2, 4) == 4); assert(func0(arr1_3, arr2_3, 5) == 5); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %edx,-0x24(%rbp) movl $0x0,-0x4(%rbp) jmp 11be <func0+0x55> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x20(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx je 11ba <func0+0x51> mov -0x4(%rbp),%eax jmp 11c9 <func0+0x60> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x24(%rbp),%eax jl 1185 <func0+0x1c> mov -0x24(%rbp),%eax 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_4], 0 jmp short loc_11BE loc_1185: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_4] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_20] add rax, rcx mov eax, [rax] cmp edx, eax jz short loc_11BA mov eax, [rbp+var_4] jmp short loc_11C9 loc_11BA: add [rbp+var_4], 1 loc_11BE: mov eax, [rbp+var_4] cmp eax, [rbp+var_24] jl short loc_1185 mov eax, [rbp+var_24] loc_11C9: pop rbp retn
long long func0(long long a1, long long a2, unsigned int a3) { unsigned int i; // [rsp+20h] [rbp-4h] for ( i = 0; (int)i < (int)a3; ++i ) { if ( *(_DWORD *)(4LL * (int)i + a1) != *(_DWORD *)(4LL * (int)i + a2) ) return i; } return a3; }
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 + -0x4],0x0 JMP 0x001011be LAB_00101185: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JZ 0x001011ba MOV EAX,dword ptr [RBP + -0x4] JMP 0x001011c9 LAB_001011ba: ADD dword ptr [RBP + -0x4],0x1 LAB_001011be: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x24] JL 0x00101185 MOV EAX,dword ptr [RBP + -0x24] LAB_001011c9: POP RBP RET
int func0(long param_1,long param_2,int param_3) { int iVar1; int local_c; local_c = 0; while ((iVar1 = param_3, local_c < param_3 && (iVar1 = local_c, *(int *)(param_1 + (long)local_c * 4) == *(int *)(param_2 + (long)local_c * 4)))) { local_c = local_c + 1; } return iVar1; }
7,453
func0
#include <assert.h>
int func0(int arr1[], int arr2[], int n) { for (int i = 0; i < n; i++) { if (arr1[i] != arr2[i]) { return i; } } return n; }
int main() { int arr1_1[] = {1, 2, 3, 4}; int arr2_1[] = {1, 2, 3}; int arr1_2[] = {2, 4, 6, 8, 10}; int arr2_2[] = {2, 4, 6, 8}; int arr1_3[] = {1, 3, 5, 7, 9, 11}; int arr2_3[] = {1, 3, 5, 7, 9}; assert(func0(arr1_1, arr2_1, 3) == 3); assert(func0(arr1_2, arr2_2, 4) == 4); assert(func0(arr1_3, arr2_3, 5) == 5); return 0; }
O1
c
func0: endbr64 mov %edx,%eax test %edx,%edx jle 1195 <func0+0x2c> lea -0x1(%rdx),%r9d mov $0x0,%ecx jmp 1181 <func0+0x18> mov %r8,%rcx mov (%rsi,%rcx,4),%edx cmp %edx,(%rdi,%rcx,4) jne 1193 <func0+0x2a> lea 0x1(%rcx),%r8 cmp %r9,%rcx jne 117e <func0+0x15> retq mov %ecx,%eax retq
func0: endbr64 mov eax, edx test edx, edx jle short locret_118F mov r9d, edx mov ecx, 0 loc_117B: mov edx, [rsi+rcx*4] cmp [rdi+rcx*4], edx jnz short loc_118D add rcx, 1 cmp rcx, r9 jnz short loc_117B retn loc_118D: mov eax, ecx locret_118F: retn
long long func0(long long a1, long long a2, int a3) { long long result; // rax long long v4; // rcx result = (unsigned int)a3; if ( a3 > 0 ) { v4 = 0LL; while ( *(_DWORD *)(a1 + 4 * v4) == *(_DWORD *)(a2 + 4 * v4) ) { if ( ++v4 == a3 ) return result; } return (unsigned int)v4; } return result; }
func0: ENDBR64 MOV EAX,EDX TEST EDX,EDX JLE 0x0010118f MOV R9D,EDX MOV ECX,0x0 LAB_0010117b: MOV EDX,dword ptr [RSI + RCX*0x4] CMP dword ptr [RDI + RCX*0x4],EDX JNZ 0x0010118d ADD RCX,0x1 CMP RCX,R9 JNZ 0x0010117b RET LAB_0010118d: MOV EAX,ECX LAB_0010118f: RET
ulong func0(long param_1,long param_2,ulong param_3) { ulong uVar1; ulong uVar2; uVar1 = param_3 & 0xffffffff; if (0 < (int)param_3) { uVar2 = 0; while (*(int *)(param_1 + uVar2 * 4) == *(int *)(param_2 + uVar2 * 4)) { uVar2 = uVar2 + 1; if (uVar2 == (param_3 & 0xffffffff)) { return uVar1; } } uVar1 = uVar2 & 0xffffffff; } return uVar1; }
7,454
func0
#include <assert.h>
int func0(int arr1[], int arr2[], int n) { for (int i = 0; i < n; i++) { if (arr1[i] != arr2[i]) { return i; } } return n; }
int main() { int arr1_1[] = {1, 2, 3, 4}; int arr2_1[] = {1, 2, 3}; int arr1_2[] = {2, 4, 6, 8, 10}; int arr2_2[] = {2, 4, 6, 8}; int arr1_3[] = {1, 3, 5, 7, 9, 11}; int arr2_3[] = {1, 3, 5, 7, 9}; assert(func0(arr1_1, arr2_1, 3) == 3); assert(func0(arr1_2, arr2_2, 4) == 4); assert(func0(arr1_3, arr2_3, 5) == 5); return 0; }
O2
c
func0: endbr64 mov %edx,%eax test %edx,%edx jle 116e <func0+0x2e> lea -0x1(%rdx),%r9d xor %ecx,%ecx jmp 1164 <func0+0x24> nopw 0x0(%rax,%rax,1) lea 0x1(%rcx),%r8 cmp %r9,%rcx je 1170 <func0+0x30> mov %r8,%rcx mov (%rsi,%rcx,4),%edx cmp %edx,(%rdi,%rcx,4) je 1158 <func0+0x18> mov %ecx,%eax retq retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 mov eax, edx test edx, edx jle short locret_12DB movsxd r8, edx xor ecx, ecx jmp short loc_12D1 loc_12C8: add rcx, 1 cmp rcx, r8 jz short locret_12E0 loc_12D1: mov edx, [rsi+rcx*4] cmp [rdi+rcx*4], edx jz short loc_12C8 mov eax, ecx locret_12DB: retn locret_12E0: retn
long long func0(long long a1, long long a2, int a3) { long long result; // rax long long v4; // rcx result = (unsigned int)a3; if ( a3 > 0 ) { v4 = 0LL; while ( *(_DWORD *)(a1 + 4 * v4) == *(_DWORD *)(a2 + 4 * v4) ) { if ( ++v4 == a3 ) return result; } return (unsigned int)v4; } return result; }
func0: ENDBR64 MOV EAX,EDX TEST EDX,EDX JLE 0x001012db MOVSXD R8,EDX XOR ECX,ECX JMP 0x001012d1 LAB_001012c8: ADD RCX,0x1 CMP RCX,R8 JZ 0x001012e0 LAB_001012d1: MOV EDX,dword ptr [RSI + RCX*0x4] CMP dword ptr [RDI + RCX*0x4],EDX JZ 0x001012c8 MOV EAX,ECX LAB_001012db: RET LAB_001012e0: RET
ulong func0(long param_1,long param_2,ulong param_3) { ulong uVar1; ulong uVar2; uVar1 = param_3 & 0xffffffff; if (0 < (int)param_3) { uVar2 = 0; while (*(int *)(param_1 + uVar2 * 4) == *(int *)(param_2 + uVar2 * 4)) { uVar2 = uVar2 + 1; if (uVar2 == (long)(int)param_3) { return uVar1; } } uVar1 = uVar2 & 0xffffffff; } return uVar1; }
7,455
func0
#include <assert.h>
int func0(int arr1[], int arr2[], int n) { for (int i = 0; i < n; i++) { if (arr1[i] != arr2[i]) { return i; } } return n; }
int main() { int arr1_1[] = {1, 2, 3, 4}; int arr2_1[] = {1, 2, 3}; int arr1_2[] = {2, 4, 6, 8, 10}; int arr2_2[] = {2, 4, 6, 8}; int arr1_3[] = {1, 3, 5, 7, 9, 11}; int arr2_3[] = {1, 3, 5, 7, 9}; assert(func0(arr1_1, arr2_1, 3) == 3); assert(func0(arr1_2, arr2_2, 4) == 4); assert(func0(arr1_3, arr2_3, 5) == 5); return 0; }
O3
c
func0: endbr64 mov %edx,%eax test %edx,%edx jle 122e <func0+0x2e> lea -0x1(%rdx),%r9d xor %ecx,%ecx jmp 1224 <func0+0x24> nopw 0x0(%rax,%rax,1) lea 0x1(%rcx),%r8 cmp %r9,%rcx je 1230 <func0+0x30> mov %r8,%rcx mov (%rsi,%rcx,4),%edx cmp %edx,(%rdi,%rcx,4) je 1218 <func0+0x18> mov %ecx,%eax retq retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 mov eax, edx test edx, edx jle short locret_1170 movsxd r8, edx xor ecx, ecx jmp short loc_1161 loc_1158: add rcx, 1 cmp rcx, r8 jz short locret_1170 loc_1161: mov edx, [rsi+rcx*4] cmp [rdi+rcx*4], edx jz short loc_1158 mov eax, ecx retn locret_1170: retn
long long func0(long long a1, long long a2, int a3) { long long result; // rax long long v4; // rcx result = (unsigned int)a3; if ( a3 > 0 ) { v4 = 0LL; while ( *(_DWORD *)(a1 + 4 * v4) == *(_DWORD *)(a2 + 4 * v4) ) { if ( ++v4 == a3 ) return result; } return (unsigned int)v4; } return result; }
func0: ENDBR64 MOV EAX,EDX TEST EDX,EDX JLE 0x00101170 MOVSXD R8,EDX XOR ECX,ECX JMP 0x00101161 LAB_00101158: ADD RCX,0x1 CMP RCX,R8 JZ 0x00101170 LAB_00101161: MOV EDX,dword ptr [RSI + RCX*0x4] CMP dword ptr [RDI + RCX*0x4],EDX JZ 0x00101158 MOV EAX,ECX RET LAB_00101170: RET
ulong func0(long param_1,long param_2,ulong param_3) { ulong uVar1; if (0 < (int)param_3) { uVar1 = 0; do { if (*(int *)(param_1 + uVar1 * 4) != *(int *)(param_2 + uVar1 * 4)) { return uVar1 & 0xffffffff; } uVar1 = uVar1 + 1; } while (uVar1 != (long)(int)param_3); } return param_3 & 0xffffffff; }
7,456
func0
#include <assert.h> #include <stdbool.h>
bool func0(int A, int B) { while (A > 0 && B > 0) { A = A / 10; B = B / 10; } if (A == 0 && B == 0) { return true; } return false; }
int main() { assert(func0(12, 1) == false); assert(func0(2, 2) == true); assert(func0(10, 20) == true); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov %esi,-0x8(%rbp) jmp 1195 <func0+0x4c> mov -0x4(%rbp),%eax movslq %eax,%rdx imul $0x66666667,%rdx,%rdx shr $0x20,%rdx sar $0x2,%edx sar $0x1f,%eax sub %eax,%edx mov %edx,%eax mov %eax,-0x4(%rbp) mov -0x8(%rbp),%eax movslq %eax,%rdx imul $0x66666667,%rdx,%rdx shr $0x20,%rdx sar $0x2,%edx sar $0x1f,%eax sub %eax,%edx mov %edx,%eax mov %eax,-0x8(%rbp) cmpl $0x0,-0x4(%rbp) jle 11a1 <func0+0x58> cmpl $0x0,-0x8(%rbp) jg 1159 <func0+0x10> cmpl $0x0,-0x4(%rbp) jne 11b4 <func0+0x6b> cmpl $0x0,-0x8(%rbp) jne 11b4 <func0+0x6b> mov $0x1,%eax jmp 11b9 <func0+0x70> mov $0x0,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov [rbp+var_8], esi jmp short loc_1195 loc_1159: mov eax, [rbp+var_4] movsxd rdx, eax imul rdx, 66666667h shr rdx, 20h mov ecx, edx sar ecx, 2 cdq mov eax, ecx sub eax, edx mov [rbp+var_4], eax mov eax, [rbp+var_8] movsxd rdx, eax imul rdx, 66666667h shr rdx, 20h mov ecx, edx sar ecx, 2 cdq mov eax, ecx sub eax, edx mov [rbp+var_8], eax loc_1195: cmp [rbp+var_4], 0 jle short loc_11A1 cmp [rbp+var_8], 0 jg short loc_1159 loc_11A1: cmp [rbp+var_4], 0 jnz short loc_11B4 cmp [rbp+var_8], 0 jnz short loc_11B4 mov eax, 1 jmp short loc_11B9 loc_11B4: mov eax, 0 loc_11B9: pop rbp retn
_BOOL8 func0(int a1, int a2) { while ( a1 > 0 && a2 > 0 ) { a1 /= 10; a2 /= 10; } return !a1 && !a2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV dword ptr [RBP + -0x8],ESI JMP 0x00101195 LAB_00101159: MOV EAX,dword ptr [RBP + -0x4] MOVSXD RDX,EAX IMUL RDX,RDX,0x66666667 SHR RDX,0x20 MOV ECX,EDX SAR ECX,0x2 CDQ MOV EAX,ECX SUB EAX,EDX MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX IMUL RDX,RDX,0x66666667 SHR RDX,0x20 MOV ECX,EDX SAR ECX,0x2 CDQ MOV EAX,ECX SUB EAX,EDX MOV dword ptr [RBP + -0x8],EAX LAB_00101195: CMP dword ptr [RBP + -0x4],0x0 JLE 0x001011a1 CMP dword ptr [RBP + -0x8],0x0 JG 0x00101159 LAB_001011a1: CMP dword ptr [RBP + -0x4],0x0 JNZ 0x001011b4 CMP dword ptr [RBP + -0x8],0x0 JNZ 0x001011b4 MOV EAX,0x1 JMP 0x001011b9 LAB_001011b4: MOV EAX,0x0 LAB_001011b9: POP RBP RET
int8 func0(int param_1,int param_2) { int8 uVar1; int4 local_10; int4 local_c; local_c = param_1; for (local_10 = param_2; (0 < local_c && (0 < local_10)); local_10 = local_10 / 10) { local_c = local_c / 10; } if ((local_c == 0) && (local_10 == 0)) { uVar1 = 1; } else { uVar1 = 0; } return uVar1; }
7,457
func0
#include <assert.h> #include <stdbool.h>
bool func0(int A, int B) { while (A > 0 && B > 0) { A = A / 10; B = B / 10; } if (A == 0 && B == 0) { return true; } return false; }
int main() { assert(func0(12, 1) == false); assert(func0(2, 2) == true); assert(func0(10, 20) == true); return 0; }
O1
c
func0: endbr64 test %edi,%edi jle 118d <func0+0x44> test %esi,%esi jle 118d <func0+0x44> mov %edi,%edx movslq %edi,%rax imul $0x66666667,%rax,%rax sar $0x22,%rax sar $0x1f,%edi sub %edi,%eax mov %eax,%edi mov %esi,%ecx movslq %esi,%rax imul $0x66666667,%rax,%rax sar $0x22,%rax sar $0x1f,%esi sub %esi,%eax mov %eax,%esi cmp $0x9,%edx jle 118d <func0+0x44> cmp $0x9,%ecx jg 1155 <func0+0xc> or %esi,%edi sete %al retq
func0: endbr64 test edi, edi jle short loc_1191 test esi, esi jle short loc_1191 loc_1155: mov edx, edi movsxd rax, edi imul rax, 66666667h sar rax, 22h mov ecx, edi sar ecx, 1Fh sub eax, ecx mov edi, eax mov r8d, esi movsxd rax, esi imul rax, 66666667h sar rax, 22h sar esi, 1Fh sub eax, esi mov esi, eax cmp edx, 9 jle short loc_1191 cmp r8d, 9 jg short loc_1155 loc_1191: or edi, esi setz al retn
bool func0(int a1, int a2) { int v2; // edx int v3; // r8d if ( a1 > 0 && a2 > 0 ) { do { v2 = a1; a1 /= 10; v3 = a2; a2 /= 10; } while ( v2 > 9 && v3 > 9 ); } return (a2 | a1) == 0; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101191 TEST ESI,ESI JLE 0x00101191 LAB_00101155: MOV EDX,EDI MOVSXD RAX,EDI IMUL RAX,RAX,0x66666667 SAR RAX,0x22 MOV ECX,EDI SAR ECX,0x1f SUB EAX,ECX MOV EDI,EAX MOV R8D,ESI MOVSXD RAX,ESI IMUL RAX,RAX,0x66666667 SAR RAX,0x22 SAR ESI,0x1f SUB EAX,ESI MOV ESI,EAX CMP EDX,0x9 JLE 0x00101191 CMP R8D,0x9 JG 0x00101155 LAB_00101191: OR EDI,ESI SETZ AL RET
bool func0(int param_1,int param_2) { bool bVar1; int iVar2; int iVar3; if ((0 < param_1) && (iVar3 = param_1, iVar2 = param_2, 0 < param_2)) { do { param_1 = iVar3 / 10; param_2 = iVar2 / 10; if (iVar3 < 10) break; bVar1 = 9 < iVar2; iVar3 = param_1; iVar2 = param_2; } while (bVar1); } return param_1 == 0 && param_2 == 0; }
7,458
func0
#include <assert.h> #include <stdbool.h>
bool func0(int A, int B) { while (A > 0 && B > 0) { A = A / 10; B = B / 10; } if (A == 0 && B == 0) { return true; } return false; }
int main() { assert(func0(12, 1) == false); assert(func0(2, 2) == true); assert(func0(10, 20) == true); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 120c <func0+0x3c> test %edi,%edi jle 120c <func0+0x3c> mov $0xcccccccd,%ecx nopl 0x0(%rax) mov %edi,%edi mov %esi,%esi mov %rdi,%rax imul %rcx,%rdi mov %rsi,%rdx imul %rcx,%rsi shr $0x23,%rdi shr $0x23,%rsi cmp $0x9,%eax jle 120c <func0+0x3c> cmp $0x9,%edx jg 11e8 <func0+0x18> or %esi,%edi sete %al retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 test esi, esi jle short loc_120C test edi, edi jle short loc_120C mov ecx, 0CCCCCCCDh nop dword ptr [rax+00000000h] loc_11E8: mov edi, edi mov esi, esi mov rax, rdi imul rdi, rcx mov rdx, rsi imul rsi, rcx shr rdi, 23h shr rsi, 23h cmp eax, 9 jle short loc_120C cmp edx, 9 jg short loc_11E8 loc_120C: or edi, esi setz al retn
bool func0(int a1, int a2) { int v2; // eax int v3; // edx if ( a2 > 0 && a1 > 0 ) { do { v2 = a1; v3 = a2; a1 /= 0xAu; a2 /= 0xAu; } while ( v2 > 9 && v3 > 9 ); } return (a2 | a1) == 0; }
func0: ENDBR64 TEST ESI,ESI JLE 0x0010120c TEST EDI,EDI JLE 0x0010120c MOV ECX,0xcccccccd NOP dword ptr [RAX] LAB_001011e8: MOV EDI,EDI MOV ESI,ESI MOV RAX,RDI IMUL RDI,RCX MOV RDX,RSI IMUL RSI,RCX SHR RDI,0x23 SHR RSI,0x23 CMP EAX,0x9 JLE 0x0010120c CMP EDX,0x9 JG 0x001011e8 LAB_0010120c: OR EDI,ESI SETZ AL RET
bool func0(ulong param_1,uint param_2) { bool bVar1; uint uVar2; int iVar3; ulong uVar4; iVar3 = (int)param_1; if ((0 < (int)param_2) && (uVar2 = param_2, 0 < iVar3)) { do { uVar4 = (param_1 & 0xffffffff) / 10; iVar3 = (int)uVar4; param_2 = uVar2 / 10; if ((int)param_1 < 10) break; bVar1 = 9 < (int)uVar2; param_1 = uVar4; uVar2 = param_2; } while (bVar1); } return iVar3 == 0 && param_2 == 0; }
7,459
func0
#include <assert.h> #include <stdbool.h>
bool func0(int A, int B) { while (A > 0 && B > 0) { A = A / 10; B = B / 10; } if (A == 0 && B == 0) { return true; } return false; }
int main() { assert(func0(12, 1) == false); assert(func0(2, 2) == true); assert(func0(10, 20) == true); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 120c <func0+0x3c> test %edi,%edi jle 120c <func0+0x3c> mov $0xcccccccd,%ecx nopl 0x0(%rax) mov %edi,%edi mov %esi,%esi mov %rdi,%rax imul %rcx,%rdi mov %rsi,%rdx imul %rcx,%rsi shr $0x23,%rdi shr $0x23,%rsi cmp $0x9,%eax jle 120c <func0+0x3c> cmp $0x9,%edx jg 11e8 <func0+0x18> or %esi,%edi sete %al retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 test edi, edi jle short loc_117C test esi, esi jle short loc_117C mov ecx, 0CCCCCCCDh nop dword ptr [rax+00000000h] loc_1158: mov edi, edi mov esi, esi mov rax, rdi imul rdi, rcx mov rdx, rsi imul rsi, rcx shr rdi, 23h shr rsi, 23h cmp eax, 9 jle short loc_117C cmp edx, 9 jg short loc_1158 loc_117C: or edi, esi setz al retn
bool func0(int a1, int a2) { int v2; // eax int v3; // edx if ( a1 > 0 && a2 > 0 ) { do { v2 = a1; v3 = a2; a1 /= 0xAu; a2 /= 0xAu; } while ( v2 > 9 && v3 > 9 ); } return (a2 | a1) == 0; }
func0: ENDBR64 TEST EDI,EDI JLE 0x0010117c TEST ESI,ESI JLE 0x0010117c MOV ECX,0xcccccccd NOP dword ptr [RAX] LAB_00101158: MOV EDI,EDI MOV ESI,ESI MOV RAX,RDI IMUL RDI,RCX MOV RDX,RSI IMUL RSI,RCX SHR RDI,0x23 SHR RSI,0x23 CMP EAX,0x9 JLE 0x0010117c CMP EDX,0x9 JG 0x00101158 LAB_0010117c: OR EDI,ESI SETZ AL RET
bool func0(ulong param_1,ulong param_2) { int iVar1; int iVar2; ulong uVar3; int iVar4; ulong uVar5; iVar4 = (int)param_1; iVar2 = (int)param_2; if ((0 < iVar4) && (0 < iVar2)) { do { uVar5 = (param_1 & 0xffffffff) / 10; iVar4 = (int)uVar5; uVar3 = (param_2 & 0xffffffff) / 10; iVar2 = (int)uVar3; if ((int)param_1 < 10) break; iVar1 = (int)param_2; param_2 = uVar3; param_1 = uVar5; } while (9 < iVar1); } return iVar4 == 0 && iVar2 == 0; }
7,460
func0
#include <assert.h> #include <stdio.h> #include <string.h> #include <regex.h>
char* func0(const char* text) { static char buffer[1024]; regex_t regex; regmatch_t match; const char *cursor = text; char *bufptr = buffer; int err; err = regcomp(&regex, " +", REG_EXTENDED); if (err != 0) { return NULL; } while (*cursor != '\0') { if (regexec(&regex, cursor, 1, &match, 0) == 0) { memcpy(bufptr, cursor, match.rm_so); bufptr += match.rm_so; *bufptr++ = ' '; cursor += match.rm_eo; } else { strcpy(bufptr, cursor); break; } } regfree(&regex); return buffer; }
int main() { assert(strcmp(func0("python program"), "python program") == 0); assert(strcmp(func0("python programming language"), "python programming language") == 0); assert(strcmp(func0("python program"), "python program") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp add $0xffffffffffffff80,%rsp mov %rdi,-0x78(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax mov -0x78(%rbp),%rax mov %rax,-0x68(%rbp) lea 0x2de9(%rip),%rax mov %rax,-0x60(%rbp) lea -0x50(%rbp),%rax mov $0x1,%edx lea 0xd9d(%rip),%rsi mov %rax,%rdi callq 1100 <regcomp@plt> mov %eax,-0x6c(%rbp) cmpl $0x0,-0x6c(%rbp) je 1301 <func0+0xd8> mov $0x0,%eax jmpq 1323 <func0+0xfa> lea -0x58(%rbp),%rdx mov -0x68(%rbp),%rsi lea -0x50(%rbp),%rax mov $0x0,%r8d mov %rdx,%rcx mov $0x1,%edx mov %rax,%rdi callq 1130 <regexec@plt> test %eax,%eax jne 12ec <func0+0xc3> mov -0x58(%rbp),%eax movslq %eax,%rdx mov -0x68(%rbp),%rcx mov -0x60(%rbp),%rax mov %rcx,%rsi mov %rax,%rdi callq 1120 <memcpy@plt> mov -0x58(%rbp),%eax cltq add %rax,-0x60(%rbp) mov -0x60(%rbp),%rax lea 0x1(%rax),%rdx mov %rdx,-0x60(%rbp) movb $0x20,(%rax) mov -0x54(%rbp),%eax cltq add %rax,-0x68(%rbp) jmp 1301 <func0+0xd8> mov -0x68(%rbp),%rdx mov -0x60(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 10c0 <strcpy@plt> jmp 1310 <func0+0xe7> mov -0x68(%rbp),%rax movzbl (%rax),%eax test %al,%al jne 128a <func0+0x61> lea -0x50(%rbp),%rax mov %rax,%rdi callq 10d0 <regfree@plt> lea 0x2d1d(%rip),%rax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 1337 <func0+0x10e> callq 10e0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp add rsp, 0FFFFFFFFFFFFFF80h mov [rbp+var_78], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov rax, [rbp+var_78] mov [rbp+string], rax lea rax, buffer_1 mov [rbp+dest], rax lea rax, [rbp+preg] mov edx, 1; cflags lea rcx, pattern; " +" mov rsi, rcx; pattern mov rdi, rax; preg call _regcomp mov [rbp+var_6C], eax cmp [rbp+var_6C], 0 jz loc_1304 mov eax, 0 jmp loc_1326 loc_128D: 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_12EF mov eax, [rbp+pmatch.rm_so] movsxd rdx, eax; n mov rcx, [rbp+string] mov rax, [rbp+dest] mov rsi, rcx; src mov rdi, rax; dest call _memcpy mov eax, [rbp+pmatch.rm_so] cdqe add [rbp+dest], rax mov rax, [rbp+dest] lea rdx, [rax+1] mov [rbp+dest], rdx mov byte ptr [rax], 20h ; ' ' mov eax, [rbp+pmatch.rm_eo] cdqe add [rbp+string], rax jmp short loc_1304 loc_12EF: mov rdx, [rbp+string] mov rax, [rbp+dest] mov rsi, rdx; src mov rdi, rax; dest call _strcpy jmp short loc_1313 loc_1304: mov rax, [rbp+string] movzx eax, byte ptr [rax] test al, al jnz loc_128D loc_1313: lea rax, [rbp+preg] mov rdi, rax; preg call _regfree lea rax, buffer_1 loc_1326: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_133A call ___stack_chk_fail locret_133A: leave retn
void * func0(const char *a1) { char *v2; // rax char *dest; // [rsp+20h] [rbp-60h] regmatch_t pmatch; // [rsp+28h] [rbp-58h] BYREF regex_t preg; // [rsp+30h] [rbp-50h] BYREF unsigned long long v7; // [rsp+78h] [rbp-8h] v7 = __readfsqword(0x28u); dest = (char *)&buffer_1; if ( regcomp(&preg, " +", 1) ) return 0LL; while ( *a1 ) { if ( regexec(&preg, a1, 1uLL, &pmatch, 0) ) { strcpy(dest, a1); break; } memcpy(dest, a1, pmatch.rm_so); v2 = &dest[pmatch.rm_so]; dest = v2 + 1; *v2 = 32; a1 += pmatch.rm_eo; } regfree(&preg); return &buffer_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP ADD RSP,-0x80 MOV qword ptr [RBP + -0x78],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV RAX,qword ptr [RBP + -0x78] MOV qword ptr [RBP + -0x68],RAX LEA RAX,[0x104040] MOV qword ptr [RBP + -0x60],RAX LEA RAX,[RBP + -0x50] MOV EDX,0x1 LEA RCX,[0x102008] MOV RSI,RCX MOV RDI,RAX CALL 0x00101100 MOV dword ptr [RBP + -0x6c],EAX CMP dword ptr [RBP + -0x6c],0x0 JZ 0x00101304 MOV EAX,0x0 JMP 0x00101326 LAB_0010128d: LEA RDX,[RBP + -0x58] MOV RSI,qword ptr [RBP + -0x68] LEA RAX,[RBP + -0x50] MOV R8D,0x0 MOV RCX,RDX MOV EDX,0x1 MOV RDI,RAX CALL 0x00101130 TEST EAX,EAX JNZ 0x001012ef MOV EAX,dword ptr [RBP + -0x58] MOVSXD RDX,EAX MOV RCX,qword ptr [RBP + -0x68] MOV RAX,qword ptr [RBP + -0x60] MOV RSI,RCX MOV RDI,RAX CALL 0x00101120 MOV EAX,dword ptr [RBP + -0x58] CDQE ADD qword ptr [RBP + -0x60],RAX MOV RAX,qword ptr [RBP + -0x60] LEA RDX,[RAX + 0x1] MOV qword ptr [RBP + -0x60],RDX MOV byte ptr [RAX],0x20 MOV EAX,dword ptr [RBP + -0x54] CDQE ADD qword ptr [RBP + -0x68],RAX JMP 0x00101304 LAB_001012ef: MOV RDX,qword ptr [RBP + -0x68] MOV RAX,qword ptr [RBP + -0x60] MOV RSI,RDX MOV RDI,RAX CALL 0x001010c0 JMP 0x00101313 LAB_00101304: MOV RAX,qword ptr [RBP + -0x68] MOVZX EAX,byte ptr [RAX] TEST AL,AL JNZ 0x0010128d LAB_00101313: LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001010d0 LEA RAX,[0x104040] LAB_00101326: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x0010133a CALL 0x001010e0 LAB_0010133a: LEAVE RET
int1 * func0(char *param_1) { char *pcVar1; int iVar2; int1 *puVar3; long in_FS_OFFSET; char *local_70; char *local_68; regmatch_t local_60; regex_t local_58; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_68 = buffer_1; iVar2 = regcomp(&local_58," +",1); local_70 = param_1; if (iVar2 == 0) { for (; *local_70 != '\0'; local_70 = local_70 + local_60.rm_eo) { iVar2 = regexec(&local_58,local_70,1,&local_60,0); if (iVar2 != 0) { strcpy(local_68,local_70); break; } memcpy(local_68,local_70,(long)local_60.rm_so); pcVar1 = local_68 + local_60.rm_so; local_68 = pcVar1 + 1; *pcVar1 = ' '; } regfree(&local_58); puVar3 = buffer_1; } else { puVar3 = (int1 *)0x0; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return puVar3; }
7,461
func0
#include <assert.h> #include <stdio.h> #include <string.h> #include <regex.h>
char* func0(const char* text) { static char buffer[1024]; regex_t regex; regmatch_t match; const char *cursor = text; char *bufptr = buffer; int err; err = regcomp(&regex, " +", REG_EXTENDED); if (err != 0) { return NULL; } while (*cursor != '\0') { if (regexec(&regex, cursor, 1, &match, 0) == 0) { memcpy(bufptr, cursor, match.rm_so); bufptr += match.rm_so; *bufptr++ = ' '; cursor += match.rm_eo; } else { strcpy(bufptr, cursor); break; } } regfree(&regex); return buffer; }
int main() { assert(strcmp(func0("python program"), "python program") == 0); assert(strcmp(func0("python programming language"), "python programming language") == 0); assert(strcmp(func0("python program"), "python program") == 0); return 0; }
O1
c
func0: endbr64 push %r13 push %r12 push %rbp push %rbx sub $0x68,%rsp mov %rdi,%rbp mov %fs:0x28,%rax mov %rax,0x58(%rsp) xor %eax,%eax lea 0x10(%rsp),%rdi mov $0x1,%edx lea 0xdc9(%rip),%rsi callq 10f0 <regcomp@plt> test %eax,%eax jne 12dd <func0+0xd4> lea 0x2df1(%rip),%r12 lea 0x8(%rsp),%r13 cmpb $0x0,0x0(%rbp) je 12b1 <func0+0xa8> lea 0x10(%rsp),%rdi mov $0x0,%r8d mov %r13,%rcx mov $0x1,%edx mov %rbp,%rsi callq 1110 <regexec@plt> test %eax,%eax jne 12a6 <func0+0x9d> movslq 0x8(%rsp),%rbx mov %rbx,%rdx mov %rbp,%rsi mov %r12,%rdi callq 1100 <memcpy@plt> add %r12,%rbx lea 0x1(%rbx),%r12 movb $0x20,(%rbx) movslq 0xc(%rsp),%rax add %rax,%rbp cmpb $0x0,0x0(%rbp) jne 125a <func0+0x51> jmp 12b1 <func0+0xa8> mov %rbp,%rsi mov %r12,%rdi callq 10b0 <strcpy@plt> lea 0x10(%rsp),%rdi callq 10c0 <regfree@plt> lea 0x2d7e(%rip),%rax mov 0x58(%rsp),%rcx xor %fs:0x28,%rcx jne 12e4 <func0+0xdb> add $0x68,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq mov $0x0,%eax jmp 12c2 <func0+0xb9> callq 10d0 <__stack_chk_fail@plt>
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 68h mov rbp, rdi mov rax, fs:28h mov [rsp+88h+var_30], rax xor eax, eax lea rdi, [rsp+88h+var_78] mov edx, 1 lea rsi, unk_2004 call _regcomp test eax, eax jnz loc_12FD lea r12, buffer_1 lea r13, [rsp+88h+var_80] cmp byte ptr [rbp+0], 0 jz short loc_12D1 loc_127A: lea rdi, [rsp+88h+var_78] mov r8d, 0 mov rcx, r13 mov edx, 1 mov rsi, rbp call _regexec test eax, eax jnz short loc_12C6 movsxd rbx, [rsp+88h+var_80] mov rdx, rbx mov rsi, rbp mov rdi, r12 call _memcpy add rbx, r12 lea r12, [rbx+1] mov byte ptr [rbx], 20h ; ' ' movsxd rax, [rsp+88h+var_7C] add rbp, rax cmp byte ptr [rbp+0], 0 jnz short loc_127A jmp short loc_12D1 loc_12C6: mov rsi, rbp mov rdi, r12 call _strcpy loc_12D1: lea rdi, [rsp+88h+var_78] call _regfree lea rax, buffer_1 loc_12E2: mov rdx, [rsp+88h+var_30] sub rdx, fs:28h jnz short loc_1304 add rsp, 68h pop rbx pop rbp pop r12 pop r13 retn loc_12FD: mov eax, 0 jmp short loc_12E2 loc_1304: call ___stack_chk_fail
void * func0(_BYTE *a1) { _BYTE *v1; // rbp char *v2; // r12 long long v3; // rbx char *v4; // rbx _DWORD v6[2]; // [rsp+8h] [rbp-80h] BYREF _BYTE v7[72]; // [rsp+10h] [rbp-78h] BYREF unsigned long long v8; // [rsp+58h] [rbp-30h] v1 = a1; v8 = __readfsqword(0x28u); if ( (unsigned int)regcomp(v7, &unk_2004, 1LL) ) return 0LL; v2 = (char *)&buffer_1; if ( *a1 ) { while ( !(unsigned int)regexec(v7, v1, 1LL, v6, 0LL) ) { v3 = v6[0]; memcpy(v2, v1, v6[0]); v4 = &v2[v3]; v2 = v4 + 1; *v4 = 32; v1 += v6[1]; if ( !*v1 ) goto LABEL_7; } strcpy(v2, v1); } LABEL_7: regfree(v7); return &buffer_1; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x68 MOV RBP,RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x58],RAX XOR EAX,EAX LEA RDI,[RSP + 0x10] MOV EDX,0x1 LEA RSI,[0x102004] CALL 0x00101100 TEST EAX,EAX JNZ 0x001012fd LEA R12,[0x104040] LEA R13,[RSP + 0x8] CMP byte ptr [RBP],0x0 JZ 0x001012d1 LAB_0010127a: LEA RDI,[RSP + 0x10] MOV R8D,0x0 MOV RCX,R13 MOV EDX,0x1 MOV RSI,RBP CALL 0x00101130 TEST EAX,EAX JNZ 0x001012c6 MOVSXD RBX,dword ptr [RSP + 0x8] MOV RDX,RBX MOV RSI,RBP MOV RDI,R12 CALL 0x00101120 ADD RBX,R12 LEA R12,[RBX + 0x1] MOV byte ptr [RBX],0x20 MOVSXD RAX,dword ptr [RSP + 0xc] ADD RBP,RAX CMP byte ptr [RBP],0x0 JNZ 0x0010127a JMP 0x001012d1 LAB_001012c6: MOV RSI,RBP MOV RDI,R12 CALL 0x001010c0 LAB_001012d1: LEA RDI,[RSP + 0x10] CALL 0x001010d0 LEA RAX,[0x104040] LAB_001012e2: MOV RDX,qword ptr [RSP + 0x58] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101304 ADD RSP,0x68 POP RBX POP RBP POP R12 POP R13 RET LAB_001012fd: MOV EAX,0x0 JMP 0x001012e2 LAB_00101304: CALL 0x001010e0
int1 * func0(char *param_1) { char cVar1; int iVar2; size_t __n; char *pcVar3; int1 *puVar4; long in_FS_OFFSET; regmatch_t local_80; regex_t local_78; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); iVar2 = regcomp(&local_78," +",1); if (iVar2 == 0) { puVar4 = buffer_1; cVar1 = *param_1; while (cVar1 != '\0') { iVar2 = regexec(&local_78,param_1,1,&local_80,0); if (iVar2 != 0) { strcpy(puVar4,param_1); break; } __n = (size_t)local_80.rm_so; memcpy(puVar4,param_1,__n); pcVar3 = puVar4 + __n; puVar4 = pcVar3 + 1; *pcVar3 = ' '; param_1 = param_1 + local_80.rm_eo; cVar1 = *param_1; } regfree(&local_78); puVar4 = buffer_1; } else { puVar4 = (int1 *)0x0; } if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return puVar4; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
7,462
func0
#include <assert.h> #include <stdio.h> #include <string.h> #include <regex.h>
char* func0(const char* text) { static char buffer[1024]; regex_t regex; regmatch_t match; const char *cursor = text; char *bufptr = buffer; int err; err = regcomp(&regex, " +", REG_EXTENDED); if (err != 0) { return NULL; } while (*cursor != '\0') { if (regexec(&regex, cursor, 1, &match, 0) == 0) { memcpy(bufptr, cursor, match.rm_so); bufptr += match.rm_so; *bufptr++ = ' '; cursor += match.rm_eo; } else { strcpy(bufptr, cursor); break; } } regfree(&regex); return buffer; }
int main() { assert(strcmp(func0("python program"), "python program") == 0); assert(strcmp(func0("python programming language"), "python programming language") == 0); assert(strcmp(func0("python program"), "python program") == 0); return 0; }
O2
c
func0: endbr64 push %r14 mov $0x1,%edx lea 0xd02(%rip),%rsi push %r13 push %r12 push %rbp mov %rdi,%rbp push %rbx sub $0x60,%rsp mov %fs:0x28,%rax mov %rax,0x58(%rsp) xor %eax,%eax lea 0x10(%rsp),%r13 mov %r13,%rdi callq 10f0 <regcomp@plt> test %eax,%eax jne 13d0 <func0+0xe0> cmpb $0x0,0x0(%rbp) lea 0x2d01(%rip),%r12 lea 0x8(%rsp),%r14 jne 137b <func0+0x8b> jmp 13a0 <func0+0xb0> nopl 0x0(%rax,%rax,1) movslq 0x8(%rsp),%rbx mov %rbp,%rsi mov %r12,%rdi mov %rbx,%rdx add %r12,%rbx callq 1100 <memcpy@plt> movslq 0xc(%rsp),%rax movb $0x20,(%rbx) lea 0x1(%rbx),%r12 add %rax,%rbp cmpb $0x0,0x0(%rbp) je 13a0 <func0+0xb0> xor %r8d,%r8d mov %r14,%rcx mov $0x1,%edx mov %rbp,%rsi mov %r13,%rdi callq 1110 <regexec@plt> test %eax,%eax je 1350 <func0+0x60> mov %rbp,%rsi mov %r12,%rdi callq 10b0 <strcpy@plt> mov %r13,%rdi callq 10c0 <regfree@plt> lea 0x2c91(%rip),%rax mov 0x58(%rsp),%rcx xor %fs:0x28,%rcx jne 13d4 <func0+0xe4> add $0x60,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq nopl 0x0(%rax) xor %eax,%eax jmp 13af <func0+0xbf> callq 10d0 <__stack_chk_fail@plt> nopl 0x0(%rax)
func0: endbr64 push r14 mov edx, 1 lea rsi, unk_2004 push r13 push r12 push rbp mov rbp, rdi push rbx sub rsp, 60h mov rax, fs:28h mov [rsp+88h+var_30], rax xor eax, eax lea r13, [rsp+88h+var_78] mov rdi, r13 call _regcomp test eax, eax jnz loc_13E0 cmp byte ptr [rbp+0], 0 lea r12, buffer_1 lea r14, [rsp+88h+var_80] jnz short loc_138B jmp short loc_13B0 loc_1360: movsxd rbx, [rsp+88h+var_80] mov rsi, rbp mov rdi, r12 mov rdx, rbx add rbx, r12 call _memcpy movsxd rax, [rsp+88h+var_7C] mov byte ptr [rbx], 20h ; ' ' lea r12, [rbx+1] add rbp, rax cmp byte ptr [rbp+0], 0 jz short loc_13B0 loc_138B: xor r8d, r8d mov rcx, r14 mov edx, 1 mov rsi, rbp mov rdi, r13 call _regexec test eax, eax jz short loc_1360 mov rsi, rbp mov rdi, r12 call _strcpy loc_13B0: mov rdi, r13 call _regfree lea rax, buffer_1 loc_13BF: mov rdx, [rsp+88h+var_30] sub rdx, fs:28h jnz short loc_13E4 add rsp, 60h pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_13E0: xor eax, eax jmp short loc_13BF loc_13E4: call ___stack_chk_fail
void * func0(_BYTE *a1) { _BYTE *v1; // rbp char *v2; // r12 char *v3; // rbx long long v4; // rax _DWORD v6[2]; // [rsp+8h] [rbp-80h] BYREF _BYTE v7[72]; // [rsp+10h] [rbp-78h] BYREF unsigned long long v8; // [rsp+58h] [rbp-30h] v1 = a1; v8 = __readfsqword(0x28u); if ( (unsigned int)regcomp(v7, &unk_2004, 1LL) ) return 0LL; v2 = (char *)&buffer_1; if ( *a1 ) { while ( !(unsigned int)regexec(v7, v1, 1LL, v6, 0LL) ) { v3 = &v2[v6[0]]; memcpy(v2, v1, v6[0]); v4 = v6[1]; *v3 = 32; v2 = v3 + 1; v1 += v4; if ( !*v1 ) goto LABEL_7; } strcpy(v2, v1); } LABEL_7: regfree(v7); return &buffer_1; }
func0: ENDBR64 PUSH R14 MOV EDX,0x1 LEA RSI,[0x102004] PUSH R13 PUSH R12 PUSH RBP MOV RBP,RDI PUSH RBX SUB RSP,0x60 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x58],RAX XOR EAX,EAX LEA R13,[RSP + 0x10] MOV RDI,R13 CALL 0x00101100 TEST EAX,EAX JNZ 0x001013e0 CMP byte ptr [RBP],0x0 LEA R12,[0x104040] LEA R14,[RSP + 0x8] JNZ 0x0010138b JMP 0x001013b0 LAB_00101360: MOVSXD RBX,dword ptr [RSP + 0x8] MOV RSI,RBP MOV RDI,R12 MOV RDX,RBX ADD RBX,R12 CALL 0x00101120 MOVSXD RAX,dword ptr [RSP + 0xc] MOV byte ptr [RBX],0x20 LEA R12,[RBX + 0x1] ADD RBP,RAX CMP byte ptr [RBP],0x0 JZ 0x001013b0 LAB_0010138b: XOR R8D,R8D MOV RCX,R14 MOV EDX,0x1 MOV RSI,RBP MOV RDI,R13 CALL 0x00101130 TEST EAX,EAX JZ 0x00101360 MOV RSI,RBP MOV RDI,R12 CALL 0x001010c0 LAB_001013b0: MOV RDI,R13 CALL 0x001010d0 LEA RAX,[0x104040] LAB_001013bf: MOV RDX,qword ptr [RSP + 0x58] SUB RDX,qword ptr FS:[0x28] JNZ 0x001013e4 ADD RSP,0x60 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_001013e0: XOR EAX,EAX JMP 0x001013bf LAB_001013e4: CALL 0x001010e0
int1 * func0(char *param_1) { char cVar1; int iVar2; size_t __n; int1 *puVar3; long in_FS_OFFSET; regmatch_t local_80; regex_t local_78; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); iVar2 = regcomp(&local_78," +",1); if (iVar2 == 0) { puVar3 = buffer_1; cVar1 = *param_1; while (cVar1 != '\0') { iVar2 = regexec(&local_78,param_1,1,&local_80,0); if (iVar2 != 0) { strcpy(puVar3,param_1); break; } __n = (size_t)local_80.rm_so; memcpy(puVar3,param_1,__n); puVar3[__n] = ' '; puVar3 = puVar3 + __n + 1; param_1 = param_1 + local_80.rm_eo; cVar1 = *param_1; } regfree(&local_78); puVar3 = buffer_1; } else { puVar3 = (int1 *)0x0; } if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return puVar3; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
7,463
func0
#include <assert.h> #include <stdio.h> #include <string.h> #include <regex.h>
char* func0(const char* text) { static char buffer[1024]; regex_t regex; regmatch_t match; const char *cursor = text; char *bufptr = buffer; int err; err = regcomp(&regex, " +", REG_EXTENDED); if (err != 0) { return NULL; } while (*cursor != '\0') { if (regexec(&regex, cursor, 1, &match, 0) == 0) { memcpy(bufptr, cursor, match.rm_so); bufptr += match.rm_so; *bufptr++ = ' '; cursor += match.rm_eo; } else { strcpy(bufptr, cursor); break; } } regfree(&regex); return buffer; }
int main() { assert(strcmp(func0("python program"), "python program") == 0); assert(strcmp(func0("python programming language"), "python programming language") == 0); assert(strcmp(func0("python program"), "python program") == 0); return 0; }
O3
c
func0: endbr64 push %r14 mov $0x1,%edx lea 0xd02(%rip),%rsi push %r13 push %r12 push %rbp mov %rdi,%rbp push %rbx sub $0x60,%rsp mov %fs:0x28,%rax mov %rax,0x58(%rsp) xor %eax,%eax lea 0x10(%rsp),%r13 mov %r13,%rdi callq 10f0 <regcomp@plt> test %eax,%eax jne 13d0 <func0+0xe0> cmpb $0x0,0x0(%rbp) lea 0x2d01(%rip),%r12 lea 0x8(%rsp),%r14 jne 137b <func0+0x8b> jmp 13a0 <func0+0xb0> nopl 0x0(%rax,%rax,1) movslq 0x8(%rsp),%rbx mov %rbp,%rsi mov %r12,%rdi mov %rbx,%rdx add %r12,%rbx callq 1100 <memcpy@plt> movslq 0xc(%rsp),%rax movb $0x20,(%rbx) lea 0x1(%rbx),%r12 add %rax,%rbp cmpb $0x0,0x0(%rbp) je 13a0 <func0+0xb0> xor %r8d,%r8d mov %r14,%rcx mov $0x1,%edx mov %rbp,%rsi mov %r13,%rdi callq 1110 <regexec@plt> test %eax,%eax je 1350 <func0+0x60> mov %rbp,%rsi mov %r12,%rdi callq 10b0 <strcpy@plt> mov %r13,%rdi callq 10c0 <regfree@plt> lea 0x2c91(%rip),%rax mov 0x58(%rsp),%rcx xor %fs:0x28,%rcx jne 13d4 <func0+0xe4> add $0x60,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq nopl 0x0(%rax) xor %eax,%eax jmp 13af <func0+0xbf> callq 10d0 <__stack_chk_fail@plt> nopl 0x0(%rax)
func0: endbr64 push r15 mov edx, 1; cflags lea rsi, pattern; " +" push r14 mov r14, rdi push r13 push r12 push rbp push rbx sub rsp, 68h mov rax, fs:28h mov [rsp+98h+var_40], rax xor eax, eax lea rbp, [rsp+98h+preg] mov rdi, rbp; preg call _regcomp test eax, eax jnz loc_1448 cmp byte ptr [r14], 0 mov ebx, 400h lea r12, [rsp+98h+pmatch] lea r13, buffer_1 jnz loc_13E9 jmp loc_1415 loc_1370: movsxd r15, [rsp+98h+pmatch.rm_so] mov rcx, rbx mov rsi, r14 mov rdi, r13 mov rdx, r15 call ___memcpy_chk mov edx, 400h cmp rbx, rdx cmovnb rdx, rbx lea rcx, [r15+rdx] mov rax, rcx sub rax, rbx cmp rax, rdx cmovb rax, rdx sub rbx, rcx mov edx, 400h add r15, r13 mov byte ptr [r15], 20h ; ' ' lea r13, [r15+1] add rax, rbx cmp rax, rdx cmovnb rdx, rax mov rbx, rdx sub rbx, rax add rbx, 1 cmp rbx, rdx cmovb rbx, rdx sub rax, 1 sub rax, rdx add rbx, rax movsxd rax, [rsp+98h+pmatch.rm_eo] add r14, rax cmp byte ptr [r14], 0 jz short loc_1415 loc_13E9: xor r8d, r8d; eflags mov rcx, r12; pmatch mov edx, 1; nmatch mov rsi, r14; string mov rdi, rbp; preg call _regexec test eax, eax jz loc_1370 mov rdx, rbx mov rsi, r14 mov rdi, r13 call ___strcpy_chk loc_1415: mov rdi, rbp; preg call _regfree lea rax, buffer_1 loc_1424: mov rdx, [rsp+98h+var_40] sub rdx, fs:28h jnz short loc_144C add rsp, 68h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1448: xor eax, eax jmp short loc_1424 loc_144C: call ___stack_chk_fail
void * func0(char *string) { char *v1; // r14 unsigned long long v2; // rbx char *v3; // r13 long long rm_so; // r15 unsigned long long v5; // rdx long long v6; // rcx unsigned long long v7; // rax unsigned long long v8; // rdx char *v9; // r15 unsigned long long v10; // rax unsigned long long v11; // rbx regmatch_t pmatch; // [rsp+8h] [rbp-90h] BYREF regex_t preg; // [rsp+10h] [rbp-88h] BYREF unsigned long long v15; // [rsp+58h] [rbp-40h] v1 = string; v15 = __readfsqword(0x28u); if ( regcomp(&preg, " +", 1) ) return 0LL; v2 = 1024LL; v3 = (char *)&buffer_1; if ( *string ) { while ( !regexec(&preg, v1, 1uLL, &pmatch, 0) ) { rm_so = pmatch.rm_so; __memcpy_chk(v3, v1, pmatch.rm_so, v2); v5 = 1024LL; if ( v2 >= 0x400 ) v5 = v2; v6 = rm_so + v5; v7 = rm_so + v5 - v2; if ( v7 < v5 ) v7 = v5; v8 = 1024LL; v9 = &v3[rm_so]; *v9 = 32; v3 = v9 + 1; v10 = v2 - v6 + v7; if ( v10 >= 0x400 ) v8 = v10; v11 = v8 - v10 + 1; if ( v11 < v8 ) v11 = v8; v2 = v10 - 1 - v8 + v11; v1 += pmatch.rm_eo; if ( !*v1 ) goto LABEL_15; } __strcpy_chk(v3, v1, v2); } LABEL_15: regfree(&preg); return &buffer_1; }
func0: ENDBR64 PUSH R15 MOV EDX,0x1 LEA RSI,[0x102004] PUSH R14 MOV R14,RDI 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 LEA RBP,[RSP + 0x10] MOV RDI,RBP CALL 0x001010f0 TEST EAX,EAX JNZ 0x00101448 CMP byte ptr [R14],0x0 MOV EBX,0x400 LEA R12,[RSP + 0x8] LEA R13,[0x104040] JNZ 0x001013e9 JMP 0x00101415 LAB_00101370: MOVSXD R15,dword ptr [RSP + 0x8] MOV RCX,RBX MOV RSI,R14 MOV RDI,R13 MOV RDX,R15 CALL 0x00101110 MOV EDX,0x400 CMP RBX,RDX CMOVNC RDX,RBX LEA RCX,[R15 + RDX*0x1] MOV RAX,RCX SUB RAX,RBX CMP RAX,RDX CMOVC RAX,RDX SUB RBX,RCX MOV EDX,0x400 ADD R15,R13 MOV byte ptr [R15],0x20 LEA R13,[R15 + 0x1] ADD RAX,RBX CMP RAX,RDX CMOVNC RDX,RAX MOV RBX,RDX SUB RBX,RAX ADD RBX,0x1 CMP RBX,RDX CMOVC RBX,RDX SUB RAX,0x1 SUB RAX,RDX ADD RBX,RAX MOVSXD RAX,dword ptr [RSP + 0xc] ADD R14,RAX CMP byte ptr [R14],0x0 JZ 0x00101415 LAB_001013e9: XOR R8D,R8D MOV RCX,R12 MOV EDX,0x1 MOV RSI,R14 MOV RDI,RBP CALL 0x00101120 TEST EAX,EAX JZ 0x00101370 MOV RDX,RBX MOV RSI,R14 MOV RDI,R13 CALL 0x00101130 LAB_00101415: MOV RDI,RBP CALL 0x001010c0 LEA RAX,[0x104040] LAB_00101424: MOV RDX,qword ptr [RSP + 0x58] SUB RDX,qword ptr FS:[0x28] JNZ 0x0010144c ADD RSP,0x68 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101448: XOR EAX,EAX JMP 0x00101424 LAB_0010144c: CALL 0x001010d0
int1 * func0(char *param_1) { char cVar1; int iVar2; ulong uVar3; ulong uVar4; ulong uVar5; int1 *puVar6; long lVar7; long in_FS_OFFSET; regmatch_t local_90; regex_t local_88; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); iVar2 = regcomp(&local_88," +",1); if (iVar2 == 0) { uVar5 = 0x400; puVar6 = buffer_1; cVar1 = *param_1; while (cVar1 != '\0') { iVar2 = regexec(&local_88,param_1,1,&local_90,0); if (iVar2 != 0) { __strcpy_chk(puVar6,param_1,uVar5); break; } lVar7 = (long)local_90.rm_so; __memcpy_chk(puVar6,param_1,lVar7,uVar5); uVar4 = 0x400; if (0x3ff < uVar5) { uVar4 = uVar5; } uVar3 = (lVar7 + uVar4) - uVar5; if (uVar3 < uVar4) { uVar3 = uVar4; } puVar6[lVar7] = 0x20; puVar6 = puVar6 + lVar7 + 1; uVar3 = uVar3 + (uVar5 - (lVar7 + uVar4)); uVar4 = 0x400; if (0x3ff < uVar3) { uVar4 = uVar3; } uVar5 = (uVar4 - uVar3) + 1; if (uVar5 < uVar4) { uVar5 = uVar4; } uVar5 = uVar5 + ((uVar3 - 1) - uVar4); param_1 = param_1 + local_90.rm_eo; cVar1 = *param_1; } regfree(&local_88); puVar6 = buffer_1; } else { puVar6 = (int1 *)0x0; } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return puVar6; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
7,464
func0
#include <assert.h> #include <stdlib.h>
int *func0(int **lst, int *sizes, int rows) { int *result = malloc(rows * sizeof(int)); for (int i = 0; i < rows; ++i) { result[i] = lst[i][sizes[i] - 1]; } return result; }
int main() { // Test case 1 int row1[] = {1, 2, 3}; int row2[] = {4, 5}; int row3[] = {6, 7, 8, 9}; int *list1[] = {row1, row2, row3}; int sizes1[] = {3, 2, 4}; int *result1 = func0(list1, sizes1, 3); assert(result1[0] == 3 && result1[1] == 5 && result1[2] == 9); free(result1); // Test case 2 int rowx[] = {120, 121, 122}; // 'x', 'y', 'z' int rowm[] = {109}; // 'm' int rowa[] = {97, 98}; // 'a', 'b' int rowu[] = {117, 118}; // 'u', 'v' int *list2[] = {rowx, rowm, rowa, rowu}; int sizes2[] = {3, 1, 2, 2}; int *result2 = func0(list2, sizes2, 4); assert(result2[0] == 122 && result2[1] == 109 && result2[2] == 98 && result2[3] == 118); free(result2); // Test case 3 int row31[] = {1, 2, 3}; int row32[] = {4, 5}; int *list3[] = {row31, row32}; int sizes3[] = {3, 2}; int *result3 = func0(list3, sizes3, 2); assert(result3[0] == 3 && result3[1] == 5); free(result3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %edx,-0x24(%rbp) mov -0x24(%rbp),%eax cltq shl $0x2,%rax mov %rax,%rdi callq 10b0 <malloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0xc(%rbp) jmp 1237 <func0+0x8e> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0xc(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x20(%rbp),%rdx add %rcx,%rdx mov (%rdx),%edx movslq %edx,%rdx shl $0x2,%rdx sub $0x4,%rdx add %rdx,%rax mov -0xc(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x8(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x24(%rbp),%eax jl 11de <func0+0x35> mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_24], edx mov eax, [rbp+var_24] cdqe shl rax, 2 mov rdi, rax; size call _malloc mov [rbp+var_8], rax mov [rbp+var_C], 0 jmp short loc_1237 loc_11DE: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] add rax, rdx mov rax, [rax] mov edx, [rbp+var_C] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+var_20] add rdx, rcx mov edx, [rdx] movsxd rdx, edx shl rdx, 2 sub rdx, 4 add rax, rdx mov edx, [rbp+var_C] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+var_8] add rdx, rcx mov eax, [rax] mov [rdx], eax add [rbp+var_C], 1 loc_1237: mov eax, [rbp+var_C] cmp eax, [rbp+var_24] jl short loc_11DE mov rax, [rbp+var_8] leave retn
_DWORD * func0(long long a1, long long a2, int a3) { int i; // [rsp+24h] [rbp-Ch] _DWORD *v6; // [rsp+28h] [rbp-8h] v6 = malloc(4LL * a3); for ( i = 0; i < a3; ++i ) v6[i] = *(_DWORD *)(4LL * *(int *)(4LL * i + a2) - 4 + *(_QWORD *)(8LL * i + a1)); return v6; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV dword ptr [RBP + -0x24],EDX MOV EAX,dword ptr [RBP + -0x24] CDQE SHL RAX,0x2 MOV RDI,RAX CALL 0x001010b0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0xc],0x0 JMP 0x00101237 LAB_001011de: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x20] ADD RDX,RCX MOV EDX,dword ptr [RDX] MOVSXD RDX,EDX SHL RDX,0x2 SUB RDX,0x4 ADD RAX,RDX MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x8] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX ADD dword ptr [RBP + -0xc],0x1 LAB_00101237: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x24] JL 0x001011de MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1,long param_2,int param_3) { void *pvVar1; int4 local_14; pvVar1 = malloc((long)param_3 << 2); for (local_14 = 0; local_14 < param_3; local_14 = local_14 + 1) { *(int4 *)((long)pvVar1 + (long)local_14 * 4) = *(int4 *) (*(long *)(param_1 + (long)local_14 * 8) + (long)*(int *)(param_2 + (long)local_14 * 4) * 4 + -4); } return pvVar1; }
7,465
func0
#include <assert.h> #include <stdlib.h>
int *func0(int **lst, int *sizes, int rows) { int *result = malloc(rows * sizeof(int)); for (int i = 0; i < rows; ++i) { result[i] = lst[i][sizes[i] - 1]; } return result; }
int main() { // Test case 1 int row1[] = {1, 2, 3}; int row2[] = {4, 5}; int row3[] = {6, 7, 8, 9}; int *list1[] = {row1, row2, row3}; int sizes1[] = {3, 2, 4}; int *result1 = func0(list1, sizes1, 3); assert(result1[0] == 3 && result1[1] == 5 && result1[2] == 9); free(result1); // Test case 2 int rowx[] = {120, 121, 122}; // 'x', 'y', 'z' int rowm[] = {109}; // 'm' int rowa[] = {97, 98}; // 'a', 'b' int rowu[] = {117, 118}; // 'u', 'v' int *list2[] = {rowx, rowm, rowa, rowu}; int sizes2[] = {3, 1, 2, 2}; int *result2 = func0(list2, sizes2, 4); assert(result2[0] == 122 && result2[1] == 109 && result2[2] == 98 && result2[3] == 118); free(result2); // Test case 3 int row31[] = {1, 2, 3}; int row32[] = {4, 5}; int *list3[] = {row31, row32}; int sizes3[] = {3, 2}; int *result3 = func0(list3, sizes3, 2); assert(result3[0] == 3 && result3[1] == 5); free(result3); return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx mov %rdi,%rbx mov %rsi,%rbp mov %edx,%r12d movslq %edx,%rdi shl $0x2,%rdi callq 10b0 <malloc@plt> test %r12d,%r12d jle 11f1 <func0+0x48> lea -0x1(%r12),%edi mov $0x0,%edx movslq 0x0(%rbp,%rdx,4),%rsi mov (%rbx,%rdx,8),%rcx mov -0x4(%rcx,%rsi,4),%ecx mov %ecx,(%rax,%rdx,4) mov %rdx,%rcx add $0x1,%rdx cmp %rdi,%rcx jne 11d5 <func0+0x2c> pop %rbx pop %rbp pop %r12 retq
func0: endbr64 push r12 push rbp push rbx mov rbx, rdi mov rbp, rsi mov r12d, edx movsxd rdi, edx shl rdi, 2 call _malloc test r12d, r12d jle short loc_11EC mov edi, r12d mov edx, 0 loc_11D3: movsxd rsi, dword ptr [rbp+rdx*4+0] mov rcx, [rbx+rdx*8] mov ecx, [rcx+rsi*4-4] mov [rax+rdx*4], ecx add rdx, 1 cmp rdx, rdi jnz short loc_11D3 loc_11EC: pop rbx pop rbp pop r12 retn
long long func0(long long a1, long long a2, int a3) { long long result; // rax long long v5; // rdx result = malloc(4LL * a3); if ( a3 > 0 ) { v5 = 0LL; do { *(_DWORD *)(result + 4 * v5) = *(_DWORD *)(*(_QWORD *)(a1 + 8 * v5) + 4LL * *(int *)(a2 + 4 * v5) - 4); ++v5; } while ( v5 != a3 ); } return result; }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RDI MOV RBP,RSI MOV R12D,EDX MOVSXD RDI,EDX SHL RDI,0x2 CALL 0x001010b0 TEST R12D,R12D JLE 0x001011ec MOV EDI,R12D MOV EDX,0x0 LAB_001011d3: MOVSXD RSI,dword ptr [RBP + RDX*0x4] MOV RCX,qword ptr [RBX + RDX*0x8] MOV ECX,dword ptr [RCX + RSI*0x4 + -0x4] MOV dword ptr [RAX + RDX*0x4],ECX ADD RDX,0x1 CMP RDX,RDI JNZ 0x001011d3 LAB_001011ec: POP RBX POP RBP POP R12 RET
void func0(long param_1,long param_2,uint param_3) { void *pvVar1; ulong uVar2; pvVar1 = malloc((long)(int)param_3 << 2); if (0 < (int)param_3) { uVar2 = 0; do { *(int4 *)((long)pvVar1 + uVar2 * 4) = *(int4 *) (*(long *)(param_1 + uVar2 * 8) + -4 + (long)*(int *)(param_2 + uVar2 * 4) * 4); uVar2 = uVar2 + 1; } while (uVar2 != param_3); } return; }
7,466
func0
#include <assert.h> #include <stdlib.h>
int *func0(int **lst, int *sizes, int rows) { int *result = malloc(rows * sizeof(int)); for (int i = 0; i < rows; ++i) { result[i] = lst[i][sizes[i] - 1]; } return result; }
int main() { // Test case 1 int row1[] = {1, 2, 3}; int row2[] = {4, 5}; int row3[] = {6, 7, 8, 9}; int *list1[] = {row1, row2, row3}; int sizes1[] = {3, 2, 4}; int *result1 = func0(list1, sizes1, 3); assert(result1[0] == 3 && result1[1] == 5 && result1[2] == 9); free(result1); // Test case 2 int rowx[] = {120, 121, 122}; // 'x', 'y', 'z' int rowm[] = {109}; // 'm' int rowa[] = {97, 98}; // 'a', 'b' int rowu[] = {117, 118}; // 'u', 'v' int *list2[] = {rowx, rowm, rowa, rowu}; int sizes2[] = {3, 1, 2, 2}; int *result2 = func0(list2, sizes2, 4); assert(result2[0] == 122 && result2[1] == 109 && result2[2] == 98 && result2[3] == 118); free(result2); // Test case 3 int row31[] = {1, 2, 3}; int row32[] = {4, 5}; int *list3[] = {row31, row32}; int sizes3[] = {3, 2}; int *result3 = func0(list3, sizes3, 2); assert(result3[0] == 3 && result3[1] == 5); free(result3); return 0; }
O2
c
func0: endbr64 push %r12 push %rbp mov %rsi,%rbp push %rbx mov %rdi,%rbx movslq %edx,%rdi mov %rdi,%r12 shl $0x2,%rdi callq 10b0 <malloc@plt> test %r12d,%r12d jle 149c <func0+0x4c> lea -0x1(%r12),%esi xor %edx,%edx nopl 0x0(%rax) movslq 0x0(%rbp,%rdx,4),%rdi mov (%rbx,%rdx,8),%rcx mov -0x4(%rcx,%rdi,4),%ecx mov %ecx,(%rax,%rdx,4) mov %rdx,%rcx add $0x1,%rdx cmp %rsi,%rcx jne 1480 <func0+0x30> pop %rbx pop %rbp pop %r12 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 push r13 push r12 movsxd r12, edx push rbp mov rbp, rsi push rbx mov rbx, rdi lea rdi, ds:0[r12*4] sub rsp, 8 call _malloc test r12d, r12d jle short loc_1499 xor edx, edx nop dword ptr [rax+rax+00h] loc_1480: movsxd rdi, dword ptr [rbp+rdx*4+0] mov rcx, [rbx+rdx*8] mov ecx, [rcx+rdi*4-4] mov [rax+rdx*4], ecx add rdx, 1 cmp r12, rdx jnz short loc_1480 loc_1499: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
long long func0(long long a1, long long a2, int a3) { long long v3; // r12 long long result; // rax long long i; // rdx v3 = a3; result = malloc(4LL * a3); if ( (int)v3 > 0 ) { for ( i = 0LL; i != v3; ++i ) *(_DWORD *)(result + 4 * i) = *(_DWORD *)(*(_QWORD *)(a1 + 8 * i) + 4LL * *(int *)(a2 + 4 * i) - 4); } return result; }
func0: ENDBR64 PUSH R13 PUSH R12 MOVSXD R12,EDX PUSH RBP MOV RBP,RSI PUSH RBX MOV RBX,RDI LEA RDI,[R12*0x4] SUB RSP,0x8 CALL 0x001010b0 TEST R12D,R12D JLE 0x00101499 XOR EDX,EDX NOP dword ptr [RAX + RAX*0x1] LAB_00101480: MOVSXD RDI,dword ptr [RBP + RDX*0x4] MOV RCX,qword ptr [RBX + RDX*0x8] MOV ECX,dword ptr [RCX + RDI*0x4 + -0x4] MOV dword ptr [RAX + RDX*0x4],ECX ADD RDX,0x1 CMP R12,RDX JNZ 0x00101480 LAB_00101499: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
void func0(long param_1,long param_2,int param_3) { void *pvVar1; long lVar2; pvVar1 = malloc((long)param_3 * 4); if (0 < param_3) { lVar2 = 0; do { *(int4 *)((long)pvVar1 + lVar2 * 4) = *(int4 *) (*(long *)(param_1 + lVar2 * 8) + -4 + (long)*(int *)(param_2 + lVar2 * 4) * 4); lVar2 = lVar2 + 1; } while (param_3 != lVar2); } return; }
7,467
func0
#include <assert.h> #include <stdlib.h>
int *func0(int **lst, int *sizes, int rows) { int *result = malloc(rows * sizeof(int)); for (int i = 0; i < rows; ++i) { result[i] = lst[i][sizes[i] - 1]; } return result; }
int main() { // Test case 1 int row1[] = {1, 2, 3}; int row2[] = {4, 5}; int row3[] = {6, 7, 8, 9}; int *list1[] = {row1, row2, row3}; int sizes1[] = {3, 2, 4}; int *result1 = func0(list1, sizes1, 3); assert(result1[0] == 3 && result1[1] == 5 && result1[2] == 9); free(result1); // Test case 2 int rowx[] = {120, 121, 122}; // 'x', 'y', 'z' int rowm[] = {109}; // 'm' int rowa[] = {97, 98}; // 'a', 'b' int rowu[] = {117, 118}; // 'u', 'v' int *list2[] = {rowx, rowm, rowa, rowu}; int sizes2[] = {3, 1, 2, 2}; int *result2 = func0(list2, sizes2, 4); assert(result2[0] == 122 && result2[1] == 109 && result2[2] == 98 && result2[3] == 118); free(result2); // Test case 3 int row31[] = {1, 2, 3}; int row32[] = {4, 5}; int *list3[] = {row31, row32}; int sizes3[] = {3, 2}; int *result3 = func0(list3, sizes3, 2); assert(result3[0] == 3 && result3[1] == 5); free(result3); return 0; }
O3
c
func0: endbr64 push %r12 push %rbp mov %rsi,%rbp push %rbx mov %rdi,%rbx movslq %edx,%rdi mov %rdi,%r12 shl $0x2,%rdi callq 10b0 <malloc@plt> test %r12d,%r12d jle 148c <func0+0x4c> lea -0x1(%r12),%esi xor %edx,%edx nopl 0x0(%rax) movslq 0x0(%rbp,%rdx,4),%rdi mov (%rbx,%rdx,8),%rcx mov -0x4(%rcx,%rdi,4),%ecx mov %ecx,(%rax,%rdx,4) mov %rdx,%rcx add $0x1,%rdx cmp %rsi,%rcx jne 1470 <func0+0x30> pop %rbx pop %rbp pop %r12 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 push r13 push r12 mov r12, rsi push rbp mov rbp, rdi push rbx movsxd rbx, edx mov r13, rbx shl rbx, 2 mov rdi, rbx; size sub rsp, 8 call _malloc test r13d, r13d jle short loc_14A9 xor edx, edx nop dword ptr [rax] loc_1490: movsxd rdi, dword ptr [r12+rdx] mov rcx, [rbp+rdx*2+0] mov ecx, [rcx+rdi*4-4] mov [rax+rdx], ecx add rdx, 4 cmp rbx, rdx jnz short loc_1490 loc_14A9: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
char * func0(long long a1, long long a2, int a3) { size_t v4; // rbx char *result; // rax long long v6; // rdx v4 = 4LL * a3; result = (char *)malloc(v4); if ( a3 > 0 ) { v6 = 0LL; do { *(_DWORD *)&result[v6] = *(_DWORD *)(*(_QWORD *)(a1 + 2 * v6) + 4LL * *(int *)(a2 + v6) - 4); v6 += 4LL; } while ( v4 != v6 ); } return result; }
func0: ENDBR64 PUSH R13 PUSH R12 MOV R12,RSI PUSH RBP MOV RBP,RDI PUSH RBX MOVSXD RBX,EDX MOV R13,RBX SHL RBX,0x2 MOV RDI,RBX SUB RSP,0x8 CALL 0x001010b0 TEST R13D,R13D JLE 0x001014a9 XOR EDX,EDX NOP dword ptr [RAX] LAB_00101490: MOVSXD RDI,dword ptr [R12 + RDX*0x1] MOV RCX,qword ptr [RBP + RDX*0x2] MOV ECX,dword ptr [RCX + RDI*0x4 + -0x4] MOV dword ptr [RAX + RDX*0x1],ECX ADD RDX,0x4 CMP RBX,RDX JNZ 0x00101490 LAB_001014a9: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
void func0(long param_1,long param_2,int param_3) { void *pvVar1; size_t sVar2; pvVar1 = malloc((long)param_3 * 4); if (0 < param_3) { sVar2 = 0; do { *(int4 *)((long)pvVar1 + sVar2) = *(int4 *) (*(long *)(param_1 + sVar2 * 2) + -4 + (long)*(int *)(param_2 + sVar2) * 4); sVar2 = sVar2 + 4; } while ((long)param_3 * 4 != sVar2); } return; }
7,468
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> typedef struct { float *elements; int size; } FloatTuple;
FloatTuple func0(const char *test_str) { FloatTuple res; int estimate_size = 10; res.elements = malloc(estimate_size * sizeof(float)); res.size = 0; char *token = strtok(strdup(test_str), ", "); while (token != NULL) { if (res.size >= estimate_size) { estimate_size *= 2; res.elements = realloc(res.elements, estimate_size * sizeof(float)); } res.elements[res.size++] = atof(token); token = strtok(NULL, ", "); } return res; }
int main() { FloatTuple result1 = func0("1.2, 1.3, 2.3, 2.4, 6.5"); FloatTuple expected1 = {.elements = (float[]){1.2, 1.3, 2.3, 2.4, 6.5}, .size = 5}; assert(result1.size == expected1.size && memcmp(result1.elements, expected1.elements, result1.size * sizeof(float)) == 0); FloatTuple result2 = func0("2.3, 2.4, 5.6, 5.4, 8.9"); FloatTuple expected2 = {.elements = (float[]){2.3, 2.4, 5.6, 5.4, 8.9}, .size = 5}; assert(result2.size == expected2.size && memcmp(result2.elements, expected2.elements, result2.size * sizeof(float)) == 0); FloatTuple result3 = func0("0.3, 0.5, 7.8, 9.4"); FloatTuple expected3 = {.elements = (float[]){0.3, 0.5, 7.8, 9.4}, .size = 4}; assert(result3.size == expected3.size && memcmp(result3.elements, expected3.elements, result3.size * sizeof(float)) == 0); free(result1.elements); free(result2.elements); free(result3.elements); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x28(%rbp) movl $0xa,-0x1c(%rbp) mov -0x1c(%rbp),%eax cltq shl $0x2,%rax mov %rax,%rdi callq 1120 <malloc@plt> mov %rax,-0x10(%rbp) movl $0x0,-0x8(%rbp) mov -0x28(%rbp),%rax mov %rax,%rdi callq 1150 <strdup@plt> lea 0xd79(%rip),%rsi mov %rax,%rdi callq 1140 <strtok@plt> mov %rax,-0x18(%rbp) jmp 1307 <func0+0xbe> mov -0x8(%rbp),%eax cmp %eax,-0x1c(%rbp) jg 12c8 <func0+0x7f> shll -0x1c(%rbp) mov -0x1c(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x10(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1130 <realloc@plt> mov %rax,-0x10(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 10e0 <atof@plt> mov -0x10(%rbp),%rcx mov -0x8(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x8(%rbp) cltq shl $0x2,%rax add %rcx,%rax cvtsd2ss %xmm0,%xmm0 movss %xmm0,(%rax) lea 0xd0f(%rip),%rsi mov $0x0,%edi callq 1140 <strtok@plt> mov %rax,-0x18(%rbp) cmpq $0x0,-0x18(%rbp) jne 129d <func0+0x54> mov -0x10(%rbp),%rax mov -0x8(%rbp),%rdx leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+s], rdi mov [rbp+var_1C], 0Ah mov eax, [rbp+var_1C] cdqe shl rax, 2 mov rdi, rax; size call _malloc mov [rbp+ptr], rax mov dword ptr [rbp+var_8], 0 mov rax, [rbp+s] mov rdi, rax; s call _strdup mov rdx, rax lea rax, delim; ", " mov rsi, rax; delim mov rdi, rdx; s call _strtok mov [rbp+nptr], rax jmp short loc_1310 loc_12A3: mov eax, dword ptr [rbp+var_8] cmp [rbp+var_1C], eax jg short loc_12CE shl [rbp+var_1C], 1 mov eax, [rbp+var_1C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+ptr] mov rsi, rdx; size mov rdi, rax; ptr call _realloc mov [rbp+ptr], rax loc_12CE: mov rax, [rbp+nptr] mov rdi, rax; nptr call _atof mov rcx, [rbp+ptr] mov eax, dword ptr [rbp+var_8] lea edx, [rax+1] mov dword ptr [rbp+var_8], edx cdqe shl rax, 2 add rax, rcx cvtsd2ss xmm0, xmm0 movss dword ptr [rax], xmm0 lea rax, delim; ", " mov rsi, rax; delim mov edi, 0; s call _strtok mov [rbp+nptr], rax loc_1310: cmp [rbp+nptr], 0 jnz short loc_12A3 mov rax, [rbp+ptr] mov rdx, [rbp+var_8] leave retn
void * func0(const char *a1) { char *v1; // rax double v2; // xmm0_8 int v3; // eax int v5; // [rsp+14h] [rbp-1Ch] const char *nptr; // [rsp+18h] [rbp-18h] void *ptr; // [rsp+20h] [rbp-10h] int v8; // [rsp+28h] [rbp-8h] v5 = 10; ptr = malloc(0x28uLL); v8 = 0; v1 = strdup(a1); for ( nptr = strtok(v1, ", "); nptr; nptr = strtok(0LL, ", ") ) { if ( v5 <= v8 ) { v5 *= 2; ptr = realloc(ptr, 4LL * v5); } v2 = atof(nptr); v3 = v8++; *(float *)&v2 = v2; *((_DWORD *)ptr + v3) = LODWORD(v2); } return ptr; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x1c],0xa MOV EAX,dword ptr [RBP + -0x1c] CDQE SHL RAX,0x2 MOV RDI,RAX CALL 0x00101120 MOV qword ptr [RBP + -0x10],RAX MOV dword ptr [RBP + -0x8],0x0 MOV RAX,qword ptr [RBP + -0x28] MOV RDI,RAX CALL 0x00101150 MOV RDX,RAX LEA RAX,[0x102008] MOV RSI,RAX MOV RDI,RDX CALL 0x00101140 MOV qword ptr [RBP + -0x18],RAX JMP 0x00101310 LAB_001012a3: MOV EAX,dword ptr [RBP + -0x8] CMP dword ptr [RBP + -0x1c],EAX JG 0x001012ce SHL dword ptr [RBP + -0x1c],0x1 MOV EAX,dword ptr [RBP + -0x1c] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x10] MOV RSI,RDX MOV RDI,RAX CALL 0x00101130 MOV qword ptr [RBP + -0x10],RAX LAB_001012ce: MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x001010e0 MOV RCX,qword ptr [RBP + -0x10] MOV EAX,dword ptr [RBP + -0x8] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x8],EDX CDQE SHL RAX,0x2 ADD RAX,RCX CVTSD2SS XMM0,XMM0 MOVSS dword ptr [RAX],XMM0 LEA RAX,[0x102008] MOV RSI,RAX MOV EDI,0x0 CALL 0x00101140 MOV qword ptr [RBP + -0x18],RAX LAB_00101310: CMP qword ptr [RBP + -0x18],0x0 JNZ 0x001012a3 MOV RAX,qword ptr [RBP + -0x10] MOV RDX,qword ptr [RBP + -0x8] LEAVE RET
int [16] func0(char *param_1) { int auVar1 [16]; char *__s; double dVar2; int local_24; char *local_20; void *local_18; int local_10; int4 uStack_c; local_24 = 10; local_18 = malloc(0x28); local_10 = 0; __s = strdup(param_1); local_20 = strtok(__s,", "); while (local_20 != (char *)0x0) { if (local_24 <= local_10) { local_24 = local_24 << 1; local_18 = realloc(local_18,(long)local_24 * 4); } dVar2 = atof(local_20); *(float *)((long)local_10 * 4 + (long)local_18) = (float)dVar2; local_20 = strtok((char *)0x0,", "); local_10 = local_10 + 1; } auVar1._8_4_ = local_10; auVar1._0_8_ = local_18; auVar1._12_4_ = uStack_c; return auVar1; }
7,469
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> typedef struct { float *elements; int size; } FloatTuple;
FloatTuple func0(const char *test_str) { FloatTuple res; int estimate_size = 10; res.elements = malloc(estimate_size * sizeof(float)); res.size = 0; char *token = strtok(strdup(test_str), ", "); while (token != NULL) { if (res.size >= estimate_size) { estimate_size *= 2; res.elements = realloc(res.elements, estimate_size * sizeof(float)); } res.elements[res.size++] = atof(token); token = strtok(NULL, ", "); } return res; }
int main() { FloatTuple result1 = func0("1.2, 1.3, 2.3, 2.4, 6.5"); FloatTuple expected1 = {.elements = (float[]){1.2, 1.3, 2.3, 2.4, 6.5}, .size = 5}; assert(result1.size == expected1.size && memcmp(result1.elements, expected1.elements, result1.size * sizeof(float)) == 0); FloatTuple result2 = func0("2.3, 2.4, 5.6, 5.4, 8.9"); FloatTuple expected2 = {.elements = (float[]){2.3, 2.4, 5.6, 5.4, 8.9}, .size = 5}; assert(result2.size == expected2.size && memcmp(result2.elements, expected2.elements, result2.size * sizeof(float)) == 0); FloatTuple result3 = func0("0.3, 0.5, 7.8, 9.4"); FloatTuple expected3 = {.elements = (float[]){0.3, 0.5, 7.8, 9.4}, .size = 4}; assert(result3.size == expected3.size && memcmp(result3.elements, expected3.elements, result3.size * sizeof(float)) == 0); free(result1.elements); free(result2.elements); free(result3.elements); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbx mov $0x28,%edi callq 1120 <malloc@plt> mov %rax,%r12 mov %rbx,%rdi callq 1150 <strdup@plt> mov %rax,%rdi lea 0xd87(%rip),%rsi callq 1140 <strtok@plt> mov %rax,%rbx mov $0x0,%ebp mov $0xa,%r14d lea 0xd6d(%rip),%r15 mov $0x0,%r13d test %rax,%rax jne 12bb <func0+0x72> mov %r13d,%edx mov %r12,%rax add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq add $0x1,%rbp mov $0x0,%esi mov %rbx,%rdi callq 10e0 <strtod@plt> lea 0x1(%rbp),%r13d cvtsd2ss %xmm0,%xmm0 movss %xmm0,(%r12,%rbp,4) mov %r15,%rsi mov $0x0,%edi callq 1140 <strtok@plt> mov %rax,%rbx test %rax,%rax je 12a2 <func0+0x59> cmp %r13d,%r14d jg 12b7 <func0+0x6e> add %r14d,%r14d movslq %r14d,%rsi shl $0x2,%rsi mov %r12,%rdi callq 1130 <realloc@plt> mov %rax,%r12 jmp 12b7 <func0+0x6e>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 8 mov rbx, rdi mov edi, 28h ; '(' call _malloc mov r12, rax mov rdi, rbx call _strdup mov rdi, rax lea rsi, unk_2004 call _strtok mov rbx, rax mov ebp, 0 mov r14d, 0Ah lea r15, unk_2004 mov r13d, 0 test rax, rax jnz short loc_12BB loc_12A2: mov edx, r13d mov rax, r12 add rsp, 8 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_12B7: add rbp, 1 loc_12BB: mov esi, 0 mov rdi, rbx call _strtod lea r13d, [rbp+1] cvtsd2ss xmm0, xmm0 movss dword ptr [r12+rbp*4], xmm0 mov rsi, r15 mov edi, 0 call _strtok mov rbx, rax test rax, rax jz short loc_12A2 cmp r14d, r13d jg short loc_12B7 add r14d, r14d movsxd rsi, r14d shl rsi, 2 mov rdi, r12 call _realloc mov r12, rax jmp short loc_12B7
long long func0(long long a1) { long long v1; // r12 long long v2; // rax long long v3; // rbx long long v4; // rbp int v5; // r14d float v7; // xmm0_4 v1 = malloc(40LL); v2 = strdup(a1); v3 = strtok(v2, &unk_2004); v4 = 0LL; v5 = 10; if ( v3 ) { while ( 1 ) { v7 = strtod(v3, 0LL); *(float *)(v1 + 4 * v4) = v7; v3 = strtok(0LL, &unk_2004); if ( !v3 ) break; if ( v5 <= (int)v4 + 1 ) { v5 *= 2; v1 = realloc(v1, 4LL * v5); } ++v4; } } return v1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBX,RDI MOV EDI,0x28 CALL 0x00101120 MOV R12,RAX MOV RDI,RBX CALL 0x00101150 MOV RDI,RAX LEA RSI,[0x102004] CALL 0x00101140 MOV RBX,RAX MOV EBP,0x0 MOV R14D,0xa LEA R15,[0x102004] MOV R13D,0x0 TEST RAX,RAX JNZ 0x001012bb LAB_001012a2: MOV EDX,R13D MOV RAX,R12 ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001012b7: ADD RBP,0x1 LAB_001012bb: MOV ESI,0x0 MOV RDI,RBX CALL 0x001010e0 LEA R13D,[RBP + 0x1] CVTSD2SS XMM0,XMM0 MOVSS dword ptr [R12 + RBP*0x4],XMM0 MOV RSI,R15 MOV EDI,0x0 CALL 0x00101140 MOV RBX,RAX TEST RAX,RAX JZ 0x001012a2 CMP R14D,R13D JG 0x001012b7 ADD R14D,R14D MOVSXD RSI,R14D SHL RSI,0x2 MOV RDI,R12 CALL 0x00101130 MOV R12,RAX JMP 0x001012b7
int1 [16] func0(char *param_1) { void *__ptr; char *pcVar1; long lVar2; uint uVar3; ulong uVar4; int iVar5; double dVar6; int1 auVar7 [16]; __ptr = malloc(0x28); pcVar1 = strdup(param_1); pcVar1 = strtok(pcVar1,", "); lVar2 = 0; iVar5 = 10; uVar4 = 0; if (pcVar1 != (char *)0x0) { while( true ) { dVar6 = strtod(pcVar1,(char **)0x0); uVar3 = (int)lVar2 + 1; uVar4 = (ulong)uVar3; *(float *)((long)__ptr + lVar2 * 4) = (float)dVar6; pcVar1 = strtok((char *)0x0,", "); if (pcVar1 == (char *)0x0) break; if (iVar5 <= (int)uVar3) { iVar5 = iVar5 * 2; __ptr = realloc(__ptr,(long)iVar5 << 2); } lVar2 = lVar2 + 1; } } auVar7._8_8_ = uVar4; auVar7._0_8_ = __ptr; return auVar7; }
7,470
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> typedef struct { float *elements; int size; } FloatTuple;
FloatTuple func0(const char *test_str) { FloatTuple res; int estimate_size = 10; res.elements = malloc(estimate_size * sizeof(float)); res.size = 0; char *token = strtok(strdup(test_str), ", "); while (token != NULL) { if (res.size >= estimate_size) { estimate_size *= 2; res.elements = realloc(res.elements, estimate_size * sizeof(float)); } res.elements[res.size++] = atof(token); token = strtok(NULL, ", "); } return res; }
int main() { FloatTuple result1 = func0("1.2, 1.3, 2.3, 2.4, 6.5"); FloatTuple expected1 = {.elements = (float[]){1.2, 1.3, 2.3, 2.4, 6.5}, .size = 5}; assert(result1.size == expected1.size && memcmp(result1.elements, expected1.elements, result1.size * sizeof(float)) == 0); FloatTuple result2 = func0("2.3, 2.4, 5.6, 5.4, 8.9"); FloatTuple expected2 = {.elements = (float[]){2.3, 2.4, 5.6, 5.4, 8.9}, .size = 5}; assert(result2.size == expected2.size && memcmp(result2.elements, expected2.elements, result2.size * sizeof(float)) == 0); FloatTuple result3 = func0("0.3, 0.5, 7.8, 9.4"); FloatTuple expected3 = {.elements = (float[]){0.3, 0.5, 7.8, 9.4}, .size = 4}; assert(result3.size == expected3.size && memcmp(result3.elements, expected3.elements, result3.size * sizeof(float)) == 0); free(result1.elements); free(result2.elements); free(result3.elements); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 push %r13 xor %r13d,%r13d push %r12 push %rbp mov %rdi,%rbp mov $0x28,%edi push %rbx sub $0x8,%rsp callq 1100 <malloc@plt> mov %rbp,%rdi mov %rax,%r12 callq 1130 <strdup@plt> lea 0xbf0(%rip),%rsi mov %rax,%rdi callq 1120 <strtok@plt> test %rax,%rax je 1480 <func0+0xa0> mov %rax,%rbp xor %ebx,%ebx mov $0xa,%r14d lea 0xbd1(%rip),%r15 jmp 1456 <func0+0x76> nopl (%rax) cmp %r13d,%r14d jg 1452 <func0+0x72> add %r14d,%r14d mov %r12,%rdi movslq %r14d,%rsi shl $0x2,%rsi callq 1110 <realloc@plt> mov %rax,%r12 add $0x1,%rbx mov %rbp,%rdi xor %esi,%esi lea 0x1(%rbx),%r13d callq 10d0 <strtod@plt> mov %r15,%rsi xor %edi,%edi cvtsd2ss %xmm0,%xmm0 movss %xmm0,(%r12,%rbx,4) callq 1120 <strtok@plt> mov %rax,%rbp test %rax,%rax jne 1438 <func0+0x58> add $0x8,%rsp mov %r13d,%edx mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r15 lea r15, unk_2004 push r14 push r13 xor r13d, r13d push r12 push rbp mov rbp, rdi mov edi, 28h ; '(' push rbx sub rsp, 8 call _malloc mov rdi, rbp mov r12, rax call _strdup mov rsi, r15 mov rdi, rax call _strtok test rax, rax jz short loc_1480 mov rbp, rax xor ebx, ebx mov r14d, 0Ah jmp short loc_1456 loc_1438: cmp r14d, r13d jg short loc_1452 add r14d, r14d mov rdi, r12 movsxd rsi, r14d shl rsi, 2 call _realloc mov r12, rax loc_1452: add rbx, 1 loc_1456: mov rdi, rbp xor esi, esi lea r13d, [rbx+1] call _strtod mov rsi, r15 xor edi, edi cvtsd2ss xmm0, xmm0 movss dword ptr [r12+rbx*4], xmm0 call _strtok mov rbp, rax test rax, rax jnz short loc_1438 loc_1480: add rsp, 8 mov edx, r13d mov rax, r12 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1) { long long v1; // r12 long long v2; // rax long long v3; // rax long long v4; // rbp long long v5; // rbx int v6; // r14d float v7; // xmm0_4 v1 = malloc(40LL); v2 = strdup(a1); v3 = strtok(v2, &unk_2004); if ( v3 ) { v4 = v3; v5 = 0LL; v6 = 10; while ( 1 ) { v7 = strtod(v4, 0LL); *(float *)(v1 + 4 * v5) = v7; v4 = strtok(0LL, &unk_2004); if ( !v4 ) break; if ( v6 <= (int)v5 + 1 ) { v6 *= 2; v1 = realloc(v1, 4LL * v6); } ++v5; } } return v1; }
func0: ENDBR64 PUSH R15 LEA R15,[0x102004] PUSH R14 PUSH R13 XOR R13D,R13D PUSH R12 PUSH RBP MOV RBP,RDI MOV EDI,0x28 PUSH RBX SUB RSP,0x8 CALL 0x00101100 MOV RDI,RBP MOV R12,RAX CALL 0x00101130 MOV RSI,R15 MOV RDI,RAX CALL 0x00101120 TEST RAX,RAX JZ 0x00101480 MOV RBP,RAX XOR EBX,EBX MOV R14D,0xa JMP 0x00101456 LAB_00101438: CMP R14D,R13D JG 0x00101452 ADD R14D,R14D MOV RDI,R12 MOVSXD RSI,R14D SHL RSI,0x2 CALL 0x00101110 MOV R12,RAX LAB_00101452: ADD RBX,0x1 LAB_00101456: MOV RDI,RBP XOR ESI,ESI LEA R13D,[RBX + 0x1] CALL 0x001010d0 MOV RSI,R15 XOR EDI,EDI CVTSD2SS XMM0,XMM0 MOVSS dword ptr [R12 + RBX*0x4],XMM0 CALL 0x00101120 MOV RBP,RAX TEST RAX,RAX JNZ 0x00101438 LAB_00101480: ADD RSP,0x8 MOV EDX,R13D MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int1 [16] func0(char *param_1) { void *__ptr; char *pcVar1; long lVar2; int iVar3; int iVar4; double dVar5; int1 auVar6 [16]; iVar3 = 0; __ptr = malloc(0x28); pcVar1 = strdup(param_1); pcVar1 = strtok(pcVar1,", "); if (pcVar1 != (char *)0x0) { lVar2 = 0; iVar4 = 10; while( true ) { iVar3 = (int)lVar2 + 1; dVar5 = strtod(pcVar1,(char **)0x0); *(float *)((long)__ptr + lVar2 * 4) = (float)dVar5; pcVar1 = strtok((char *)0x0,", "); if (pcVar1 == (char *)0x0) break; if (iVar4 <= iVar3) { iVar4 = iVar4 * 2; __ptr = realloc(__ptr,(long)iVar4 << 2); } lVar2 = lVar2 + 1; } } auVar6._8_4_ = iVar3; auVar6._0_8_ = __ptr; auVar6._12_4_ = 0; return auVar6; }
7,471
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> typedef struct { float *elements; int size; } FloatTuple;
FloatTuple func0(const char *test_str) { FloatTuple res; int estimate_size = 10; res.elements = malloc(estimate_size * sizeof(float)); res.size = 0; char *token = strtok(strdup(test_str), ", "); while (token != NULL) { if (res.size >= estimate_size) { estimate_size *= 2; res.elements = realloc(res.elements, estimate_size * sizeof(float)); } res.elements[res.size++] = atof(token); token = strtok(NULL, ", "); } return res; }
int main() { FloatTuple result1 = func0("1.2, 1.3, 2.3, 2.4, 6.5"); FloatTuple expected1 = {.elements = (float[]){1.2, 1.3, 2.3, 2.4, 6.5}, .size = 5}; assert(result1.size == expected1.size && memcmp(result1.elements, expected1.elements, result1.size * sizeof(float)) == 0); FloatTuple result2 = func0("2.3, 2.4, 5.6, 5.4, 8.9"); FloatTuple expected2 = {.elements = (float[]){2.3, 2.4, 5.6, 5.4, 8.9}, .size = 5}; assert(result2.size == expected2.size && memcmp(result2.elements, expected2.elements, result2.size * sizeof(float)) == 0); FloatTuple result3 = func0("0.3, 0.5, 7.8, 9.4"); FloatTuple expected3 = {.elements = (float[]){0.3, 0.5, 7.8, 9.4}, .size = 4}; assert(result3.size == expected3.size && memcmp(result3.elements, expected3.elements, result3.size * sizeof(float)) == 0); free(result1.elements); free(result2.elements); free(result3.elements); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 push %r13 xor %r13d,%r13d push %r12 push %rbp mov %rdi,%rbp mov $0x28,%edi push %rbx sub $0x8,%rsp callq 1100 <malloc@plt> mov %rbp,%rdi mov %rax,%r12 callq 1130 <strdup@plt> lea 0xc20(%rip),%rsi mov %rax,%rdi callq 1120 <strtok@plt> test %rax,%rax je 1450 <func0+0xa0> mov %rax,%rbp xor %ebx,%ebx mov $0xa,%r14d lea 0xc01(%rip),%r15 jmp 1426 <func0+0x76> nopl (%rax) cmp %r14d,%r13d jl 1422 <func0+0x72> add %r14d,%r14d mov %r12,%rdi movslq %r14d,%rsi shl $0x2,%rsi callq 1110 <realloc@plt> mov %rax,%r12 add $0x1,%rbx mov %rbp,%rdi xor %esi,%esi lea 0x1(%rbx),%r13d callq 10d0 <strtod@plt> mov %r15,%rsi xor %edi,%edi cvtsd2ss %xmm0,%xmm0 movss %xmm0,(%r12,%rbx,4) callq 1120 <strtok@plt> mov %rax,%rbp test %rax,%rax jne 1408 <func0+0x58> add $0x8,%rsp mov %r13d,%edx mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r14 push r13 push r12 lea r12, delim; ", " push rbp push rbx mov rbx, rdi mov edi, 28h ; '('; size call _malloc mov rdi, rbx; s mov rbp, rax call _strdup mov rsi, r12; delim mov rdi, rax; s call _strtok test rax, rax jz short loc_1460 mov rbx, rax xor r14d, r14d mov r13d, 0Ah jmp short loc_142E loc_1400: mov rdi, rbx; nptr xor esi, esi; endptr call _strtod mov rsi, r12; delim xor edi, edi; s cvtsd2ss xmm0, xmm0 movss dword ptr [rbp+r14*4+0], xmm0 call _strtok mov rbx, rax lea rax, [r14+1] test rbx, rbx jz short loc_1450 mov r14, rax loc_142E: cmp r13d, r14d jg short loc_1400 add r13d, r13d mov rdi, rbp; ptr movsxd rsi, r13d shl rsi, 2; size call _realloc mov rbp, rax jmp short loc_1400 loc_1450: pop rbx lea edx, [r14+1] mov rax, rbp pop rbp pop r12 pop r13 pop r14 retn loc_1460: pop rbx mov rax, rbp xor edx, edx pop rbp pop r12 pop r13 pop r14 retn
void * func0(char *s) { void *v1; // rbp char *v2; // rax char *v3; // rax char *v4; // rbx long long v5; // r14 int v6; // r13d float v7; // xmm0_4 v1 = malloc(0x28uLL); v2 = strdup(s); v3 = strtok(v2, ", "); if ( !v3 ) return v1; v4 = v3; v5 = 0LL; v6 = 10; while ( 1 ) { if ( v6 <= (int)v5 ) { v6 *= 2; v1 = realloc(v1, 4LL * v6); } v7 = strtod(v4, 0LL); *((float *)v1 + v5) = v7; v4 = strtok(0LL, ", "); if ( !v4 ) break; ++v5; } return v1; }
func0: ENDBR64 PUSH R14 PUSH R13 PUSH R12 LEA R12,[0x102004] PUSH RBP PUSH RBX MOV RBX,RDI MOV EDI,0x28 CALL 0x00101100 MOV RDI,RBX MOV RBP,RAX CALL 0x00101130 MOV RSI,R12 MOV RDI,RAX CALL 0x00101120 TEST RAX,RAX JZ 0x00101460 MOV RBX,RAX XOR R14D,R14D MOV R13D,0xa JMP 0x0010142e LAB_00101400: MOV RDI,RBX XOR ESI,ESI CALL 0x001010d0 MOV RSI,R12 XOR EDI,EDI CVTSD2SS XMM0,XMM0 MOVSS dword ptr [RBP + R14*0x4],XMM0 CALL 0x00101120 MOV RBX,RAX LEA RAX,[R14 + 0x1] TEST RBX,RBX JZ 0x00101450 MOV R14,RAX LAB_0010142e: CMP R13D,R14D JG 0x00101400 ADD R13D,R13D MOV RDI,RBP MOVSXD RSI,R13D SHL RSI,0x2 CALL 0x00101110 MOV RBP,RAX JMP 0x00101400 LAB_00101450: POP RBX LEA EDX,[R14 + 0x1] MOV RAX,RBP POP RBP POP R12 POP R13 POP R14 RET LAB_00101460: POP RBX MOV RAX,RBP XOR EDX,EDX POP RBP POP R12 POP R13 POP R14 RET
int [16] func0(char *param_1) { char *pcVar1; int iVar2; int iVar3; long lVar4; double dVar5; int auVar6 [16]; int auVar7 [16]; auVar7._0_8_ = malloc(0x28); pcVar1 = strdup(param_1); pcVar1 = strtok(pcVar1,", "); if (pcVar1 == (char *)0x0) { auVar7._8_8_ = 0; return auVar7; } lVar4 = 0; iVar2 = 10; do { iVar3 = (int)lVar4; if (iVar2 <= iVar3) { iVar2 = iVar2 * 2; auVar7._0_8_ = realloc(auVar7._0_8_,(long)iVar2 << 2); } dVar5 = strtod(pcVar1,(char **)0x0); *(float *)((long)auVar7._0_8_ + lVar4 * 4) = (float)dVar5; pcVar1 = strtok((char *)0x0,", "); lVar4 = lVar4 + 1; } while (pcVar1 != (char *)0x0); auVar6._8_4_ = iVar3 + 1; auVar6._0_8_ = auVar7._0_8_; auVar6._12_4_ = 0; return auVar6; }
7,472
func0
#include <assert.h>
int func0(int A[], int n) { if (n == 1) { return A[0]; } int look_up[n]; look_up[0] = A[0]; look_up[1] = A[0] > A[1] ? A[0] : A[1]; for (int i = 2; i < n; i++) { int option1 = look_up[i - 1]; int option2 = look_up[i - 2] + A[i]; int option3 = A[i]; look_up[i] = option1 > option2 ? option1 : option2; look_up[i] = look_up[i] > option3 ? look_up[i] : option3; } return look_up[n - 1]; }
int main() { int arr1[] = {1, 2, 9, 4, 5, 0, 4, 11, 6}; int arr2[] = {1, 2, 9, 5, 6, 0, 5, 12, 7}; int arr3[] = {1, 3, 10, 5, 6, 0, 6, 14, 21}; assert(func0(arr1, 9) == 26); assert(func0(arr2, 9) == 28); assert(func0(arr3, 9) == 44); 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,%rsi cmpl $0x1,-0x4c(%rbp) jne 11a3 <func0+0x3a> mov -0x48(%rbp),%rax mov (%rax),%eax jmpq 133d <func0+0x1d4> mov -0x4c(%rbp),%eax movslq %eax,%rdx sub $0x1,%rdx mov %rdx,-0x28(%rbp) movslq %eax,%rdx mov %rdx,%r8 mov $0x0,%r9d movslq %eax,%rdx mov %rdx,%rcx mov $0x0,%ebx cltq lea 0x0(,%rax,4),%rdx mov $0x10,%eax sub $0x1,%rax add %rdx,%rax mov $0x10,%edi mov $0x0,%edx div %rdi imul $0x10,%rax,%rax mov %rax,%rdx and $0xfffffffffffff000,%rdx mov %rsp,%rbx sub %rdx,%rbx mov %rbx,%rdx cmp %rdx,%rsp je 1219 <func0+0xb0> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) jmp 1202 <func0+0x99> mov %rax,%rdx and $0xfff,%edx sub %rdx,%rsp mov %rax,%rdx and $0xfff,%edx test %rdx,%rdx je 1243 <func0+0xda> 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) mov -0x48(%rbp),%rax mov (%rax),%edx mov -0x20(%rbp),%rax mov %edx,(%rax) mov -0x48(%rbp),%rax add $0x4,%rax mov (%rax),%edx mov -0x48(%rbp),%rax mov (%rax),%eax cmp %eax,%edx cmovl %eax,%edx mov -0x20(%rbp),%rax mov %edx,0x4(%rax) movl $0x2,-0x38(%rbp) jmpq 1321 <func0+0x1b8> mov -0x38(%rbp),%eax lea -0x1(%rax),%edx mov -0x20(%rbp),%rax movslq %edx,%rdx mov (%rax,%rdx,4),%eax mov %eax,-0x34(%rbp) mov -0x38(%rbp),%eax lea -0x2(%rax),%edx mov -0x20(%rbp),%rax movslq %edx,%rdx mov (%rax,%rdx,4),%edx mov -0x38(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x48(%rbp),%rax add %rcx,%rax mov (%rax),%eax add %edx,%eax mov %eax,-0x30(%rbp) mov -0x38(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x48(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov %eax,-0x2c(%rbp) mov -0x34(%rbp),%eax cmp %eax,-0x30(%rbp) cmovge -0x30(%rbp),%eax mov %eax,%ecx mov -0x20(%rbp),%rax mov -0x38(%rbp),%edx movslq %edx,%rdx mov %ecx,(%rax,%rdx,4) mov -0x20(%rbp),%rax mov -0x38(%rbp),%edx movslq %edx,%rdx mov (%rax,%rdx,4),%eax cmp %eax,-0x2c(%rbp) cmovge -0x2c(%rbp),%eax mov %eax,%ecx mov -0x20(%rbp),%rax mov -0x38(%rbp),%edx movslq %edx,%rdx mov %ecx,(%rax,%rdx,4) addl $0x1,-0x38(%rbp) mov -0x38(%rbp),%eax cmp -0x4c(%rbp),%eax jl 128a <func0+0x121> mov -0x4c(%rbp),%eax lea -0x1(%rax),%edx mov -0x20(%rbp),%rax movslq %edx,%rdx mov (%rax,%rdx,4),%eax mov %rsi,%rsp mov -0x18(%rbp),%rdi xor %fs:0x28,%rdi je 1354 <func0+0x1eb> callq 1060 <__stack_chk_fail@plt> mov -0x8(%rbp),%rbx leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_38], rdi mov [rbp+var_3C], esi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov rax, rsp mov rsi, rax cmp [rbp+var_3C], 1 jnz short loc_11A2 mov rax, [rbp+var_38] mov eax, [rax] jmp loc_1324 loc_11A2: mov eax, [rbp+var_3C] movsxd rdx, eax sub rdx, 1 mov [rbp+var_18], rdx cdqe lea rdx, ds:0[rax*4] mov eax, 10h sub rax, 1 add rax, rdx mov edi, 10h mov edx, 0 div rdi imul rax, 10h mov rcx, rax and rcx, 0FFFFFFFFFFFFF000h mov rdx, rsp sub rdx, rcx loc_11E7: cmp rsp, rdx jz short loc_11FE sub rsp, 1000h or [rsp+1040h+var_48], 0 jmp short loc_11E7 loc_11FE: mov rdx, rax and edx, 0FFFh sub rsp, rdx mov rdx, rax and edx, 0FFFh test rdx, rdx jz short loc_1228 and eax, 0FFFh sub rax, 8 add rax, rsp or qword ptr [rax], 0 loc_1228: mov rax, rsp add rax, 3 shr rax, 2 shl rax, 2 mov [rbp+var_10], rax mov rax, [rbp+var_38] mov edx, [rax] mov rax, [rbp+var_10] mov [rax], edx mov rax, [rbp+var_38] add rax, 4 mov edx, [rax] mov rax, [rbp+var_38] mov eax, [rax] cmp edx, eax cmovl edx, eax mov rax, [rbp+var_10] mov [rax+4], edx mov [rbp+var_28], 2 jmp loc_1308 loc_126F: mov eax, [rbp+var_28] lea edx, [rax-1] mov rax, [rbp+var_10] movsxd rdx, edx mov eax, [rax+rdx*4] mov [rbp+var_24], eax mov eax, [rbp+var_28] lea edx, [rax-2] mov rax, [rbp+var_10] movsxd rdx, edx mov edx, [rax+rdx*4] mov eax, [rbp+var_28] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_38] add rax, rcx mov eax, [rax] add eax, edx mov [rbp+var_20], eax mov eax, [rbp+var_28] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_38] add rax, rdx mov eax, [rax] mov [rbp+var_1C], eax mov edx, [rbp+var_20] mov eax, [rbp+var_24] cmp edx, eax cmovge eax, edx mov ecx, eax mov rax, [rbp+var_10] mov edx, [rbp+var_28] movsxd rdx, edx mov [rax+rdx*4], ecx mov rax, [rbp+var_10] mov edx, [rbp+var_28] movsxd rdx, edx mov edx, [rax+rdx*4] mov eax, [rbp+var_1C] cmp edx, eax cmovge eax, edx mov ecx, eax mov rax, [rbp+var_10] mov edx, [rbp+var_28] movsxd rdx, edx mov [rax+rdx*4], ecx add [rbp+var_28], 1 loc_1308: mov eax, [rbp+var_28] cmp eax, [rbp+var_3C] jl loc_126F mov eax, [rbp+var_3C] lea edx, [rax-1] mov rax, [rbp+var_10] movsxd rdx, edx mov eax, [rax+rdx*4] loc_1324: mov rsp, rsi mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_133B call ___stack_chk_fail locret_133B: leave retn
long long func0(unsigned int *a1, int a2) { unsigned long long v3; // rax void *v4; // rsp signed int v5; // edx int v6; // eax signed int v7; // eax signed int v8; // [rsp+8h] [rbp-40h] BYREF int v9; // [rsp+Ch] [rbp-3Ch] signed int *v10; // [rsp+10h] [rbp-38h] int i; // [rsp+20h] [rbp-28h] int v12; // [rsp+24h] [rbp-24h] int v13; // [rsp+28h] [rbp-20h] signed int v14; // [rsp+2Ch] [rbp-1Ch] long long v15; // [rsp+30h] [rbp-18h] signed int *v16; // [rsp+38h] [rbp-10h] unsigned long long v17; // [rsp+40h] [rbp-8h] v10 = (signed int *)a1; v9 = a2; v17 = __readfsqword(0x28u); if ( a2 == 1 ) return (unsigned int)*v10; v15 = v9 - 1LL; v3 = 16 * ((4LL * v9 + 15) / 0x10uLL); while ( &v8 != (signed int *)((char *)&v8 - (v3 & 0xFFFFFFFFFFFFF000LL)) ) ; v4 = alloca(v3 & 0xFFF); if ( (v3 & 0xFFF) != 0 ) *(_QWORD *)((char *)&v8 + (v3 & 0xFFF) - 8) = *(_QWORD *)((char *)&v8 + (v3 & 0xFFF) - 8); v16 = &v8; v8 = *v10; v5 = v10[1]; if ( v5 < *v10 ) v5 = *v10; v16[1] = v5; for ( i = 2; i < v9; ++i ) { v12 = v16[i - 1]; v13 = v16[i - 2] + v10[i]; v14 = v10[i]; v6 = v12; if ( v13 >= v12 ) v6 = v13; v16[i] = v6; v7 = v14; if ( v16[i] >= v14 ) v7 = v16[i]; v16[i] = v7; } return (unsigned int)v16[v9 - 1]; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x38],RDI MOV dword ptr [RBP + -0x3c],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV RAX,RSP MOV RSI,RAX CMP dword ptr [RBP + -0x3c],0x1 JNZ 0x001011a2 MOV RAX,qword ptr [RBP + -0x38] MOV EAX,dword ptr [RAX] JMP 0x00101324 LAB_001011a2: MOV EAX,dword ptr [RBP + -0x3c] MOVSXD RDX,EAX SUB RDX,0x1 MOV qword ptr [RBP + -0x18],RDX CDQE LEA RDX,[RAX*0x4] MOV EAX,0x10 SUB RAX,0x1 ADD RAX,RDX MOV EDI,0x10 MOV EDX,0x0 DIV RDI IMUL RAX,RAX,0x10 MOV RCX,RAX AND RCX,-0x1000 MOV RDX,RSP SUB RDX,RCX LAB_001011e7: CMP RSP,RDX JZ 0x001011fe SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 JMP 0x001011e7 LAB_001011fe: MOV RDX,RAX AND EDX,0xfff SUB RSP,RDX MOV RDX,RAX AND EDX,0xfff TEST RDX,RDX JZ 0x00101228 AND EAX,0xfff SUB RAX,0x8 ADD RAX,RSP OR qword ptr [RAX],0x0 LAB_00101228: MOV RAX,RSP ADD RAX,0x3 SHR RAX,0x2 SHL RAX,0x2 MOV qword ptr [RBP + -0x10],RAX MOV RAX,qword ptr [RBP + -0x38] MOV EDX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x10] MOV dword ptr [RAX],EDX MOV RAX,qword ptr [RBP + -0x38] ADD RAX,0x4 MOV EDX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x38] MOV EAX,dword ptr [RAX] CMP EDX,EAX CMOVL EDX,EAX MOV RAX,qword ptr [RBP + -0x10] MOV dword ptr [RAX + 0x4],EDX MOV dword ptr [RBP + -0x28],0x2 JMP 0x00101308 LAB_0010126f: MOV EAX,dword ptr [RBP + -0x28] LEA EDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x10] MOVSXD RDX,EDX MOV EAX,dword ptr [RAX + RDX*0x4] MOV dword ptr [RBP + -0x24],EAX MOV EAX,dword ptr [RBP + -0x28] LEA EDX,[RAX + -0x2] MOV RAX,qword ptr [RBP + -0x10] MOVSXD RDX,EDX MOV EDX,dword ptr [RAX + RDX*0x4] MOV EAX,dword ptr [RBP + -0x28] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x38] ADD RAX,RCX MOV EAX,dword ptr [RAX] ADD EAX,EDX MOV dword ptr [RBP + -0x20],EAX MOV EAX,dword ptr [RBP + -0x28] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x38] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x1c],EAX MOV EDX,dword ptr [RBP + -0x20] MOV EAX,dword ptr [RBP + -0x24] CMP EDX,EAX CMOVGE EAX,EDX MOV ECX,EAX MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x28] MOVSXD RDX,EDX MOV dword ptr [RAX + RDX*0x4],ECX MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x28] MOVSXD RDX,EDX MOV EDX,dword ptr [RAX + RDX*0x4] MOV EAX,dword ptr [RBP + -0x1c] CMP EDX,EAX CMOVGE EAX,EDX MOV ECX,EAX MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x28] MOVSXD RDX,EDX MOV dword ptr [RAX + RDX*0x4],ECX ADD dword ptr [RBP + -0x28],0x1 LAB_00101308: MOV EAX,dword ptr [RBP + -0x28] CMP EAX,dword ptr [RBP + -0x3c] JL 0x0010126f MOV EAX,dword ptr [RBP + -0x3c] LEA EDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x10] MOVSXD RDX,EDX MOV EAX,dword ptr [RAX + RDX*0x4] LAB_00101324: MOV RSP,RSI MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x0010133b CALL 0x00101060 LAB_0010133b: LEAVE RET
int func0(int *param_1,int param_2) { long lVar1; int iVar2; ulong uVar3; int *puVar4; long in_FS_OFFSET; int auStack_48 [4]; int local_44; int *local_40; int local_30; int local_2c; int local_28; int local_24; long local_20; int *local_18; long local_10; puVar4 = auStack_48; local_40 = param_1; local_44 = param_2; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (param_2 == 1) { iVar2 = *param_1; } else { local_20 = (long)param_2 + -1; uVar3 = (((long)param_2 * 4 + 0xfU) / 0x10) * 0x10; for (; puVar4 != auStack_48 + -(uVar3 & 0xfffffffffffff000); puVar4 = puVar4 + -0x1000) { *(int8 *)(puVar4 + -8) = *(int8 *)(puVar4 + -8); } lVar1 = -(ulong)((uint)uVar3 & 0xfff); if ((uVar3 & 0xfff) != 0) { *(int8 *)(puVar4 + ((ulong)((uint)uVar3 & 0xfff) - 8) + lVar1) = *(int8 *)(puVar4 + ((ulong)((uint)uVar3 & 0xfff) - 8) + lVar1); } *(int *)(puVar4 + lVar1) = *local_40; iVar2 = local_40[1]; if (local_40[1] < *local_40) { iVar2 = *local_40; } *(int *)(puVar4 + lVar1 + 4) = iVar2; for (local_30 = 2; local_30 < local_44; local_30 = local_30 + 1) { local_2c = *(int *)(puVar4 + (long)(local_30 + -1) * 4 + lVar1); local_28 = local_40[local_30] + *(int *)(puVar4 + (long)(local_30 + -2) * 4 + lVar1); local_24 = local_40[local_30]; iVar2 = local_2c; if (local_2c <= local_28) { iVar2 = local_28; } *(int *)(puVar4 + (long)local_30 * 4 + lVar1) = iVar2; iVar2 = local_24; if (local_24 <= *(int *)(puVar4 + (long)local_30 * 4 + lVar1)) { iVar2 = *(int *)(puVar4 + (long)local_30 * 4 + lVar1); } *(int *)(puVar4 + (long)local_30 * 4 + lVar1) = iVar2; } iVar2 = *(int *)(puVar4 + (long)(local_44 + -1) * 4 + lVar1); local_18 = puVar4 + lVar1; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return iVar2; }
7,473
func0
#include <assert.h>
int func0(int A[], int n) { if (n == 1) { return A[0]; } int look_up[n]; look_up[0] = A[0]; look_up[1] = A[0] > A[1] ? A[0] : A[1]; for (int i = 2; i < n; i++) { int option1 = look_up[i - 1]; int option2 = look_up[i - 2] + A[i]; int option3 = A[i]; look_up[i] = option1 > option2 ? option1 : option2; look_up[i] = look_up[i] > option3 ? look_up[i] : option3; } return look_up[n - 1]; }
int main() { int arr1[] = {1, 2, 9, 4, 5, 0, 4, 11, 6}; int arr2[] = {1, 2, 9, 5, 6, 0, 5, 12, 7}; int arr3[] = {1, 3, 10, 5, 6, 0, 6, 14, 21}; assert(func0(arr1, 9) == 26); assert(func0(arr2, 9) == 28); assert(func0(arr3, 9) == 44); return 0; }
O1
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax cmp $0x1,%esi je 11c1 <func0+0x58> movslq %esi,%rax lea 0xf(,%rax,4),%rax mov %rax,%rdx and $0xfffffffffffffff0,%rdx and $0xfffffffffffff000,%rax mov %rsp,%rcx sub %rax,%rcx mov %rcx,%rax cmp %rax,%rsp je 11c8 <func0+0x5f> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) jmp 11aa <func0+0x41> mov (%rdi),%eax jmpq 124b <func0+0xe2> mov %rdx,%rax and $0xfff,%eax sub %rax,%rsp test %rax,%rax je 11de <func0+0x75> orq $0x0,-0x8(%rsp,%rax,1) lea 0x3(%rsp),%r10 mov %r10,%rdx shr $0x2,%rdx and $0xfffffffffffffffc,%r10 mov %r10,%r8 mov (%rdi),%eax mov %eax,0x0(,%rdx,4) cmp %eax,0x4(%rdi) cmovge 0x4(%rdi),%eax mov %eax,0x4(,%rdx,4) cmp $0x2,%esi jle 1241 <func0+0xd8> lea -0x3(%rsi),%r9d add $0x3,%r9 mov $0x2,%eax mov (%rdi,%rax,4),%edx cmp %edx,-0x4(%r8,%rax,4) mov %edx,%ecx cmovge -0x4(%r8,%rax,4),%ecx add -0x8(%r8,%rax,4),%edx cmp %edx,%ecx cmovge %ecx,%edx mov %edx,(%r8,%rax,4) add $0x1,%rax cmp %r9,%rax jne 121a <func0+0xb1> sub $0x1,%esi movslq %esi,%rsi mov (%r10,%rsi,4),%eax mov -0x8(%rbp),%rsi xor %fs:0x28,%rsi jne 125c <func0+0xf3> leaveq retq callq 1060 <__stack_chk_fail@plt>
func0: endbr64 push rbp mov rbp, rsp sub rsp, 10h mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax cmp esi, 1 jz short loc_11C1 mov r8d, esi movsxd rax, esi lea rax, ds:0Fh[rax*4] mov rcx, rax and rcx, 0FFFFFFFFFFFFFFF0h and rax, 0FFFFFFFFFFFFF000h mov rdx, rsp sub rdx, rax loc_11AA: cmp rsp, rdx jz short loc_11C5 sub rsp, 1000h or [rsp+1010h+var_18], 0 jmp short loc_11AA loc_11C1: mov eax, [rdi] jmp short loc_123D loc_11C5: mov rax, rcx and eax, 0FFFh sub rsp, rax test rax, rax jz short loc_11DB or [rsp+rax+10h+var_18], 0 loc_11DB: lea rsi, [rsp+10h+var_D] mov rcx, rsi shr rcx, 2 and rsi, 0FFFFFFFFFFFFFFFCh mov edx, [rdi] mov ds:dword_0[rcx*4], edx mov eax, [rdi+4] cmp eax, edx cmovl eax, edx mov dword ptr ds:byte_4[rcx*4], eax cmp r8d, 2 jle short loc_1232 mov r9d, r8d mov edx, 2 loc_1211: mov ecx, [rdi+rdx*4] mov eax, [rsi+rdx*4-4] cmp ecx, eax cmovge eax, ecx add ecx, [rsi+rdx*4-8] cmp eax, ecx cmovl eax, ecx mov [rsi+rdx*4], eax add rdx, 1 cmp rdx, r9 jnz short loc_1211 loc_1232: sub r8d, 1 movsxd r8, r8d mov eax, [rsi+r8*4] loc_123D: mov rdx, [rbp+var_8] sub rdx, fs:28h jnz short loc_124E leave retn loc_124E: call ___stack_chk_fail
long long func0(unsigned int *a1, int a2) { signed long long v3; // rax void *v4; // rsp signed int v5; // edx signed int v6; // eax long long i; // rdx signed int v8; // ecx signed int v9; // eax signed int v10; // ecx _DWORD v12[2]; // [rsp+8h] [rbp-10h] BYREF unsigned long long v13; // [rsp+10h] [rbp-8h] v13 = __readfsqword(0x28u); if ( a2 == 1 ) return *a1; while ( v12 != (_DWORD *)((char *)v12 - ((4LL * a2 + 15) & 0xFFFFFFFFFFFFF000LL)) ) ; v3 = (4 * (_WORD)a2 + 15) & 0xFF0; v4 = alloca(v3); if ( ((4 * (_WORD)a2 + 15) & 0xFF0) != 0 ) *(_QWORD *)((char *)&v12[-2] + v3) = *(_QWORD *)((char *)&v12[-2] + v3); v5 = *a1; v12[0] = v5; v6 = a1[1]; if ( v6 < v5 ) v6 = v5; v12[1] = v6; if ( a2 > 2 ) { for ( i = 2LL; i != a2; v12[i++] = v9 ) { v8 = a1[i]; v9 = v12[i - 1]; if ( v8 >= v9 ) v9 = a1[i]; v10 = v12[i - 2] + v8; if ( v9 < v10 ) v9 = v10; } } return (unsigned int)v12[a2 - 1]; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x10 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX CMP ESI,0x1 JZ 0x001011c1 MOV R8D,ESI MOVSXD RAX,ESI LEA RAX,[0xf + RAX*0x4] MOV RCX,RAX AND RCX,-0x10 AND RAX,-0x1000 MOV RDX,RSP SUB RDX,RAX LAB_001011aa: CMP RSP,RDX JZ 0x001011c5 SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 JMP 0x001011aa LAB_001011c1: MOV EAX,dword ptr [RDI] JMP 0x0010123d LAB_001011c5: MOV RAX,RCX AND EAX,0xfff SUB RSP,RAX TEST RAX,RAX JZ 0x001011db OR qword ptr [RSP + RAX*0x1 + -0x8],0x0 LAB_001011db: LEA RSI,[RSP + 0x3] MOV RCX,RSI SHR RCX,0x2 AND RSI,-0x4 MOV EDX,dword ptr [RDI] MOV dword ptr [RCX*0x4],EDX MOV EAX,dword ptr [RDI + 0x4] CMP EAX,EDX CMOVL EAX,EDX MOV dword ptr [0x4 + RCX*0x4],EAX CMP R8D,0x2 JLE 0x00101232 MOV R9D,R8D MOV EDX,0x2 LAB_00101211: MOV ECX,dword ptr [RDI + RDX*0x4] MOV EAX,dword ptr [RSI + RDX*0x4 + -0x4] CMP ECX,EAX CMOVGE EAX,ECX ADD ECX,dword ptr [RSI + RDX*0x4 + -0x8] CMP EAX,ECX CMOVL EAX,ECX MOV dword ptr [RSI + RDX*0x4],EAX ADD RDX,0x1 CMP RDX,R9 JNZ 0x00101211 LAB_00101232: SUB R8D,0x1 MOVSXD R8,R8D MOV EAX,dword ptr [RSI + R8*0x4] LAB_0010123d: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JNZ 0x0010124e LEAVE RET LAB_0010124e: CALL 0x00101060
int func0(int *param_1,uint param_2) { int iVar1; long lVar2; int iVar3; ulong uVar4; int1 *puVar5; int1 *puVar6; long in_FS_OFFSET; int1 auStack_18 [8]; long local_10; puVar6 = auStack_18; puVar5 = auStack_18; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (param_2 == 1) { iVar1 = *param_1; } else { uVar4 = (long)(int)param_2 * 4 + 0xf; for (; puVar5 != auStack_18 + -(uVar4 & 0xfffffffffffff000); puVar5 = puVar5 + -0x1000) { *(int8 *)(puVar5 + -8) = *(int8 *)(puVar5 + -8); } uVar4 = (ulong)((uint)uVar4 & 0xff0); lVar2 = -uVar4; puVar6 = puVar5 + lVar2; if (uVar4 != 0) { *(int8 *)(puVar5 + -8) = *(int8 *)(puVar5 + -8); } iVar1 = *param_1; *(int *)(((ulong)(puVar5 + lVar2 + 3) >> 2) * 4) = iVar1; iVar3 = param_1[1]; if (param_1[1] < iVar1) { iVar3 = iVar1; } *(int *)(((ulong)(puVar5 + lVar2 + 3) >> 2) * 4 + 4) = iVar3; if (2 < (int)param_2) { uVar4 = 2; do { iVar1 = param_1[uVar4]; iVar3 = *(int *)(puVar5 + uVar4 * 4 + lVar2 + -4); if (*(int *)(puVar5 + uVar4 * 4 + lVar2 + -4) <= iVar1) { iVar3 = iVar1; } if (iVar3 < iVar1 + *(int *)(puVar5 + uVar4 * 4 + lVar2 + -8)) { iVar3 = iVar1 + *(int *)(puVar5 + uVar4 * 4 + lVar2 + -8); } *(int *)(puVar5 + uVar4 * 4 + lVar2) = iVar3; uVar4 = uVar4 + 1; } while (uVar4 != param_2); } iVar1 = *(int *)(puVar5 + (long)(int)(param_2 - 1) * 4 + lVar2); } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar1; } /* WARNING: Subroutine does not return */ *(code **)(puVar6 + -8) = main; __stack_chk_fail(); }
7,474
func0
#include <assert.h>
int func0(int A[], int n) { if (n == 1) { return A[0]; } int look_up[n]; look_up[0] = A[0]; look_up[1] = A[0] > A[1] ? A[0] : A[1]; for (int i = 2; i < n; i++) { int option1 = look_up[i - 1]; int option2 = look_up[i - 2] + A[i]; int option3 = A[i]; look_up[i] = option1 > option2 ? option1 : option2; look_up[i] = look_up[i] > option3 ? look_up[i] : option3; } return look_up[n - 1]; }
int main() { int arr1[] = {1, 2, 9, 4, 5, 0, 4, 11, 6}; int arr2[] = {1, 2, 9, 5, 6, 0, 5, 12, 7}; int arr3[] = {1, 3, 10, 5, 6, 0, 6, 14, 21}; assert(func0(arr1, 9) == 26); assert(func0(arr2, 9) == 28); assert(func0(arr3, 9) == 44); return 0; }
O2
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax cmp $0x1,%esi je 13f8 <func0+0xf8> 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 135f <func0+0x5f> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 134a <func0+0x4a> and $0xfff,%edx sub %rdx,%rsp test %rdx,%rdx jne 1400 <func0+0x100> mov (%rdi),%eax lea 0x3(%rsp),%r9 mov %r9,%rdx and $0xfffffffffffffffc,%r9 shr $0x2,%rdx mov %eax,%ecx cmp %eax,0x4(%rdi) cmovge 0x4(%rdi),%ecx mov %eax,0x0(,%rdx,4) mov %ecx,0x4(,%rdx,4) cmp $0x2,%esi jle 13d7 <func0+0xd7> lea -0x3(%rsi),%r10d xor %edx,%edx shl $0x2,%r10 jmp 13b9 <func0+0xb9> nopl 0x0(%rax,%rax,1) mov 0x4(%r9,%rdx,1),%eax add $0x4,%rdx mov 0x8(%rdi,%rdx,1),%r8d add %r8d,%eax cmp %r8d,%eax cmovl %r8d,%eax cmp %eax,%ecx cmovl %eax,%ecx mov %ecx,0x8(%r9,%rdx,1) cmp %r10,%rdx jne 13b0 <func0+0xb0> sub $0x1,%esi movslq %esi,%rsi mov (%r9,%rsi,4),%eax mov -0x8(%rbp),%rsi xor %fs:0x28,%rsi jne 140b <func0+0x10b> leaveq retq nopw 0x0(%rax,%rax,1) mov (%rdi),%eax jmp 13e1 <func0+0xe1> nopl 0x0(%rax) orq $0x0,-0x8(%rsp,%rdx,1) jmpq 1371 <func0+0x71> callq 1060 <__stack_chk_fail@plt>
func0: endbr64 push rbp mov r8, rdi mov rbp, rsp sub rsp, 10h mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax cmp esi, 1 jz loc_13F0 movsxd rax, esi mov rcx, rsp mov r9d, esi lea rax, ds:0Fh[rax*4] mov rdx, rax and rax, 0FFFFFFFFFFFFF000h sub rcx, rax and rdx, 0FFFFFFFFFFFFFFF0h cmp rsp, rcx jz short loc_1362 loc_134D: sub rsp, 1000h or [rsp+1010h+var_18], 0 cmp rsp, rcx jnz short loc_134D loc_1362: and edx, 0FFFh sub rsp, rdx test rdx, rdx jnz loc_13F8 loc_1374: mov eax, [r8] mov ecx, [r8+4] lea rdi, [rsp+1010h+var_100D] mov rdx, rdi and rdi, 0FFFFFFFFFFFFFFFCh shr rdx, 2 cmp eax, ecx cmovge ecx, eax mov ds:dword_0[rdx*4], eax mov dword ptr ds:byte_4[rdx*4], ecx cmp r9d, 2 jle short loc_13D2 lea r10d, [r9-3] xor edx, edx shl r10, 2 jmp short loc_13B8 loc_13B0: mov eax, [rdi+rdx+4] add rdx, 4 loc_13B8: mov esi, [r8+rdx+8] add eax, esi cmp eax, esi cmovl eax, esi cmp ecx, eax cmovl ecx, eax mov [rdi+rdx+8], ecx cmp rdx, r10 jnz short loc_13B0 loc_13D2: sub r9d, 1 movsxd r9, r9d mov eax, [rdi+r9*4] loc_13DD: mov rdx, [rbp+var_8] sub rdx, fs:28h jnz short loc_1403 leave retn loc_13F0: mov eax, [rdi] jmp short loc_13DD loc_13F8: or [rsp+rdx+1010h+var_1018], 0 jmp loc_1374 loc_1403: call ___stack_chk_fail
long long func0(signed int *a1, int a2) { long long v3; // rdx _DWORD *v4; // rcx __int16 v5; // dx signed long long v6; // rdx void *v7; // rsp signed int v8; // eax signed int v9; // ecx unsigned long long v10; // rdx long long v11; // r10 signed int v12; // esi signed int v13; // eax _DWORD v16[1022]; // [rsp+8h] [rbp-1010h] BYREF _QWORD v17[2]; // [rsp+1008h] [rbp-10h] BYREF v17[1] = __readfsqword(0x28u); if ( a2 == 1 ) return (unsigned int)*a1; v3 = 4LL * a2 + 15; v4 = (_DWORD *)((char *)v17 - (v3 & 0xFFFFFFFFFFFFF000LL)); v5 = v3 & 0xFFF0; if ( v17 != (_QWORD *)v4 ) { while ( v16 != v4 ) ; } v6 = v5 & 0xFFF; v7 = alloca(v6); if ( v6 ) *(_QWORD *)((char *)&v16[-2] + v6) = *(_QWORD *)((char *)&v16[-2] + v6); v8 = *a1; v9 = a1[1]; if ( *a1 >= v9 ) v9 = *a1; v16[0] = *a1; v16[1] = v9; if ( a2 > 2 ) { v10 = 0LL; v11 = 4LL * (unsigned int)(a2 - 3); while ( 1 ) { v12 = a1[v10 / 4 + 2]; v13 = v12 + v8; if ( v13 < v12 ) v13 = a1[v10 / 4 + 2]; if ( v9 < v13 ) v9 = v13; v16[v10 / 4 + 2] = v9; if ( v10 == v11 ) break; v8 = v16[v10 / 4 + 1]; v10 += 4LL; } } return (unsigned int)v16[a2 - 1]; }
func0: ENDBR64 PUSH RBP MOV R8,RDI MOV RBP,RSP SUB RSP,0x10 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX CMP ESI,0x1 JZ 0x001013f0 MOVSXD RAX,ESI MOV RCX,RSP MOV R9D,ESI LEA RAX,[0xf + RAX*0x4] MOV RDX,RAX AND RAX,-0x1000 SUB RCX,RAX AND RDX,-0x10 CMP RSP,RCX JZ 0x00101362 LAB_0010134d: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RCX JNZ 0x0010134d LAB_00101362: AND EDX,0xfff SUB RSP,RDX TEST RDX,RDX JNZ 0x001013f8 LAB_00101374: MOV EAX,dword ptr [R8] MOV ECX,dword ptr [R8 + 0x4] LEA RDI,[RSP + 0x3] MOV RDX,RDI AND RDI,-0x4 SHR RDX,0x2 CMP EAX,ECX CMOVGE ECX,EAX MOV dword ptr [RDX*0x4],EAX MOV dword ptr [0x4 + RDX*0x4],ECX CMP R9D,0x2 JLE 0x001013d2 LEA R10D,[R9 + -0x3] XOR EDX,EDX SHL R10,0x2 JMP 0x001013b8 LAB_001013b0: MOV EAX,dword ptr [RDI + RDX*0x1 + 0x4] ADD RDX,0x4 LAB_001013b8: MOV ESI,dword ptr [R8 + RDX*0x1 + 0x8] ADD EAX,ESI CMP EAX,ESI CMOVL EAX,ESI CMP ECX,EAX CMOVL ECX,EAX MOV dword ptr [RDI + RDX*0x1 + 0x8],ECX CMP RDX,R10 JNZ 0x001013b0 LAB_001013d2: SUB R9D,0x1 MOVSXD R9,R9D MOV EAX,dword ptr [RDI + R9*0x4] LAB_001013dd: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101403 LEAVE RET LAB_001013f0: MOV EAX,dword ptr [RDI] JMP 0x001013dd LAB_001013f8: OR qword ptr [RSP + RDX*0x1 + -0x8],0x0 JMP 0x00101374 LAB_00101403: CALL 0x00101060
int func0(int *param_1,int param_2) { int iVar1; long lVar2; int1 *puVar3; int iVar4; int iVar5; int iVar6; ulong uVar7; long lVar8; int1 *puVar9; int1 *puVar11; long in_FS_OFFSET; int1 auStack_18 [8]; long local_10; int1 *puVar10; puVar11 = auStack_18; puVar9 = auStack_18; puVar10 = auStack_18; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (param_2 == 1) { iVar4 = *param_1; } else { uVar7 = (long)param_2 * 4 + 0xf; puVar3 = auStack_18; while (puVar10 != auStack_18 + -(uVar7 & 0xfffffffffffff000)) { puVar9 = puVar3 + -0x1000; *(int8 *)(puVar3 + -8) = *(int8 *)(puVar3 + -8); puVar10 = puVar3 + -0x1000; puVar3 = puVar3 + -0x1000; } uVar7 = (ulong)((uint)uVar7 & 0xff0); lVar2 = -uVar7; puVar11 = puVar9 + lVar2; if (uVar7 != 0) { *(int8 *)(puVar9 + -8) = *(int8 *)(puVar9 + -8); } iVar4 = *param_1; iVar6 = param_1[1]; if (param_1[1] <= iVar4) { iVar6 = iVar4; } *(int *)(((ulong)(puVar9 + lVar2 + 3) >> 2) * 4) = iVar4; *(int *)(((ulong)(puVar9 + lVar2 + 3) >> 2) * 4 + 4) = iVar6; if (2 < param_2) { lVar8 = 0; while( true ) { iVar1 = *(int *)((long)param_1 + lVar8 + 8); iVar5 = iVar4 + iVar1; if (iVar4 + iVar1 < iVar1) { iVar5 = iVar1; } if (iVar6 < iVar5) { iVar6 = iVar5; } *(int *)(puVar9 + lVar8 + lVar2 + 8) = iVar6; if (lVar8 == (ulong)(param_2 - 3) << 2) break; iVar4 = *(int *)(puVar9 + lVar8 + lVar2 + 4); lVar8 = lVar8 + 4; } } iVar4 = *(int *)(puVar9 + (long)(param_2 + -1) * 4 + lVar2); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(code **)(puVar11 + -8) = _fini; __stack_chk_fail(); } return iVar4; }
7,475
func0
#include <assert.h>
int func0(int A[], int n) { if (n == 1) { return A[0]; } int look_up[n]; look_up[0] = A[0]; look_up[1] = A[0] > A[1] ? A[0] : A[1]; for (int i = 2; i < n; i++) { int option1 = look_up[i - 1]; int option2 = look_up[i - 2] + A[i]; int option3 = A[i]; look_up[i] = option1 > option2 ? option1 : option2; look_up[i] = look_up[i] > option3 ? look_up[i] : option3; } return look_up[n - 1]; }
int main() { int arr1[] = {1, 2, 9, 4, 5, 0, 4, 11, 6}; int arr2[] = {1, 2, 9, 5, 6, 0, 5, 12, 7}; int arr3[] = {1, 3, 10, 5, 6, 0, 6, 14, 21}; assert(func0(arr1, 9) == 26); assert(func0(arr2, 9) == 28); assert(func0(arr3, 9) == 44); return 0; }
O3
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax cmp $0x1,%esi je 13f8 <func0+0x148> 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 130f <func0+0x5f> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 12fa <func0+0x4a> and $0xfff,%edx sub %rdx,%rsp test %rdx,%rdx jne 1400 <func0+0x150> mov (%rdi),%eax lea 0x3(%rsp),%r8 mov %r8,%rcx and $0xfffffffffffffffc,%r8 shr $0x2,%rcx mov %eax,%edx cmp %eax,0x4(%rdi) cmovge 0x4(%rdi),%edx mov %eax,0x0(,%rcx,4) mov %edx,0x4(,%rcx,4) cmp $0x2,%esi jle 13d6 <func0+0x126> cmp $0x4,%esi jle 140b <func0+0x15b> lea -0x5(%rsi),%ecx mov %eax,%r9d shr %ecx lea 0x6(%rcx,%rcx,1),%r11 mov $0x4,%ecx mov -0x8(%rdi,%rcx,4),%eax mov %edx,%r10d cmp %edx,%eax cmovge %eax,%r10d add %r9d,%eax cmp %eax,%r10d cmovge %r10d,%eax mov %eax,%r9d mov %eax,-0x8(%r8,%rcx,4) mov -0x4(%rdi,%rcx,4),%eax add %eax,%edx cmp %eax,%edx cmovl %eax,%edx movslq %ecx,%rax cmp %r9d,%edx cmovl %r9d,%edx mov %edx,-0x4(%r8,%rcx,4) add $0x2,%rcx cmp %rcx,%r11 jne 136e <func0+0xbe> mov (%rdi,%rax,4),%edx cmp %edx,-0x4(%r8,%rax,4) mov %edx,%ecx cmovge -0x4(%r8,%rax,4),%ecx add -0x8(%r8,%rax,4),%edx cmp %edx,%ecx cmovge %ecx,%edx mov %edx,(%r8,%rax,4) add $0x1,%rax cmp %eax,%esi jg 13b0 <func0+0x100> sub $0x1,%esi movslq %esi,%rsi mov (%r8,%rsi,4),%eax mov -0x8(%rbp),%rdi xor %fs:0x28,%rdi jne 1412 <func0+0x162> leaveq retq nopl 0x0(%rax) mov (%rdi),%eax jmp 13e0 <func0+0x130> nopl 0x0(%rax) orq $0x0,-0x8(%rsp,%rdx,1) jmpq 1321 <func0+0x71> mov $0x2,%eax jmp 13b0 <func0+0x100> callq 1060 <__stack_chk_fail@plt> nopw 0x0(%rax,%rax,1)
func0: endbr64 push rbp mov r8, rdi mov rbp, rsp sub rsp, 10h mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax cmp esi, 1 jz loc_1400 movsxd rax, esi mov rcx, rsp mov edi, esi lea rax, ds:0Fh[rax*4] mov rdx, rax and rax, 0FFFFFFFFFFFFF000h sub rcx, rax and rdx, 0FFFFFFFFFFFFFFF0h cmp rsp, rcx jz short loc_1311 loc_12FC: sub rsp, 1000h or [rsp+1010h+var_18], 0 cmp rsp, rcx jnz short loc_12FC loc_1311: and edx, 0FFFh sub rsp, rdx test rdx, rdx jnz loc_1408 loc_1323: mov r9d, [r8] mov eax, [r8+4] lea rsi, [rsp+1010h+var_100D] mov rdx, rsi and rsi, 0FFFFFFFFFFFFFFFCh shr rdx, 2 cmp r9d, eax movd xmm0, r9d cmovge eax, r9d movd xmm1, eax punpckldq xmm0, xmm1 movq qword ptr ds:dword_0[rdx*4], xmm0 cmp edi, 2 jle loc_13E1 cmp edi, 4 jle loc_1413 lea edx, [rdi-5] mov ecx, 4 shr edx, 1 lea r10d, [rdx+3] add r10, r10 loc_137A: mov edx, [r8+rcx*4-8] mov r11d, eax cmp edx, eax cmovge r11d, edx add edx, r9d cmp r11d, edx cmovge edx, r11d mov r9d, edx mov [rsi+rcx*4-8], edx mov edx, [r8+rcx*4-4] add eax, edx cmp eax, edx cmovl eax, edx mov rdx, rcx cmp eax, r9d cmovl eax, r9d mov [rsi+rcx*4-4], eax add rcx, 2 cmp r10, rcx jnz short loc_137A loc_13BC: movsxd rdx, edx nop loc_13C0: mov ecx, [r8+rdx*4] mov eax, [rsi+rdx*4-4] cmp ecx, eax cmovge eax, ecx add ecx, [rsi+rdx*4-8] cmp eax, ecx cmovl eax, ecx mov [rsi+rdx*4], eax add rdx, 1 cmp edi, edx jg short loc_13C0 loc_13E1: sub edi, 1 movsxd rdi, edi mov eax, [rsi+rdi*4] loc_13EA: mov rdx, [rbp+var_8] sub rdx, fs:28h jnz short loc_141A leave retn loc_1400: mov eax, [rdi] jmp short loc_13EA loc_1408: or [rsp+rdx+1010h+var_1018], 0 jmp loc_1323 loc_1413: mov edx, 2 jmp short loc_13BC loc_141A: call ___stack_chk_fail
long long func0(unsigned int *a1, int a2) { long long v2; // rdx _QWORD *v3; // rcx __int16 v4; // dx signed long long v5; // rdx void *v6; // rsp signed int v7; // r9d signed int v8; // eax __m128i v9; // xmm0 long long v10; // rcx signed int v11; // edx signed int v12; // r11d int v13; // edx signed int v14; // edx long long v15; // rdx signed int v16; // ecx signed int v17; // eax signed int v18; // ecx _QWORD v21[511]; // [rsp+8h] [rbp-1010h] BYREF _QWORD v22[2]; // [rsp+1008h] [rbp-10h] BYREF v22[1] = __readfsqword(0x28u); if ( a2 == 1 ) return *a1; v2 = 4LL * a2 + 15; v3 = (_QWORD *)((char *)v22 - (v2 & 0xFFFFFFFFFFFFF000LL)); v4 = v2 & 0xFFF0; if ( v22 != v3 ) { while ( v21 != v3 ) ; } v5 = v4 & 0xFFF; v6 = alloca(v5); if ( v5 ) *(_QWORD *)((char *)&v21[-1] + v5) = *(_QWORD *)((char *)&v21[-1] + v5); v7 = *a1; v8 = a1[1]; v9 = _mm_cvtsi32_si128(*a1); if ( (int)*a1 >= v8 ) v8 = *a1; v21[0] = _mm_unpacklo_epi32(v9, _mm_cvtsi32_si128(v8)).m128i_u64[0]; if ( a2 > 2 ) { if ( a2 <= 4 ) { LODWORD(v15) = 2; } else { v10 = 4LL; do { v11 = a1[v10 - 2]; v12 = v8; if ( v11 >= v8 ) v12 = a1[v10 - 2]; v13 = v7 + v11; if ( v12 >= v13 ) v13 = v12; v7 = v13; LODWORD(v21[(unsigned long long)v10 / 2 - 1]) = v13; v14 = a1[v10 - 1]; v8 += v14; if ( v8 < v14 ) v8 = a1[v10 - 1]; LODWORD(v15) = v10; if ( v8 < v7 ) v8 = v7; HIDWORD(v21[(unsigned long long)v10 / 2 - 1]) = v8; v10 += 2LL; } while ( 2LL * (((unsigned int)(a2 - 5) >> 1) + 3) != v10 ); } v15 = (int)v15; do { v16 = a1[v15]; v17 = *((_DWORD *)v21 + v15 - 1); if ( v16 >= v17 ) v17 = a1[v15]; v18 = *((_DWORD *)&v21[-1] + v15) + v16; if ( v17 < v18 ) v17 = v18; *((_DWORD *)v21 + v15++) = v17; } while ( a2 > (int)v15 ); } return *((unsigned int *)v21 + a2 - 1); }
func0: ENDBR64 PUSH RBP MOV R8,RDI MOV RBP,RSP SUB RSP,0x10 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX CMP ESI,0x1 JZ 0x00101400 MOVSXD RAX,ESI MOV RCX,RSP MOV EDI,ESI LEA RAX,[0xf + RAX*0x4] MOV RDX,RAX AND RAX,-0x1000 SUB RCX,RAX AND RDX,-0x10 CMP RSP,RCX JZ 0x00101311 LAB_001012fc: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RCX JNZ 0x001012fc LAB_00101311: AND EDX,0xfff SUB RSP,RDX TEST RDX,RDX JNZ 0x00101408 LAB_00101323: MOV R9D,dword ptr [R8] MOV EAX,dword ptr [R8 + 0x4] LEA RSI,[RSP + 0x3] MOV RDX,RSI AND RSI,-0x4 SHR RDX,0x2 CMP R9D,EAX MOVD XMM0,R9D CMOVGE EAX,R9D MOVD XMM1,EAX PUNPCKLDQ XMM0,XMM1 MOVQ qword ptr [RDX*0x4],XMM0 CMP EDI,0x2 JLE 0x001013e1 CMP EDI,0x4 JLE 0x00101413 LEA EDX,[RDI + -0x5] MOV ECX,0x4 SHR EDX,0x1 LEA R10D,[RDX + 0x3] ADD R10,R10 LAB_0010137a: MOV EDX,dword ptr [R8 + RCX*0x4 + -0x8] MOV R11D,EAX CMP EDX,EAX CMOVGE R11D,EDX ADD EDX,R9D CMP R11D,EDX CMOVGE EDX,R11D MOV R9D,EDX MOV dword ptr [RSI + RCX*0x4 + -0x8],EDX MOV EDX,dword ptr [R8 + RCX*0x4 + -0x4] ADD EAX,EDX CMP EAX,EDX CMOVL EAX,EDX MOV RDX,RCX CMP EAX,R9D CMOVL EAX,R9D MOV dword ptr [RSI + RCX*0x4 + -0x4],EAX ADD RCX,0x2 CMP R10,RCX JNZ 0x0010137a LAB_001013bc: MOVSXD RDX,EDX NOP LAB_001013c0: MOV ECX,dword ptr [R8 + RDX*0x4] MOV EAX,dword ptr [RSI + RDX*0x4 + -0x4] CMP ECX,EAX CMOVGE EAX,ECX ADD ECX,dword ptr [RSI + RDX*0x4 + -0x8] CMP EAX,ECX CMOVL EAX,ECX MOV dword ptr [RSI + RDX*0x4],EAX ADD RDX,0x1 CMP EDI,EDX JG 0x001013c0 LAB_001013e1: SUB EDI,0x1 MOVSXD RDI,EDI MOV EAX,dword ptr [RSI + RDI*0x4] LAB_001013ea: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JNZ 0x0010141a LEAVE RET LAB_00101400: MOV EAX,dword ptr [RDI] JMP 0x001013ea LAB_00101408: OR qword ptr [RSP + RDX*0x1 + -0x8],0x0 JMP 0x00101323 LAB_00101413: MOV EDX,0x2 JMP 0x001013bc LAB_0010141a: CALL 0x00101060
int func0(int *param_1,int param_2) { long lVar1; int *puVar2; int iVar3; long lVar4; int iVar5; int iVar6; ulong uVar7; int *puVar8; int *puVar10; int iVar11; long in_FS_OFFSET; int auStack_18 [8]; long local_10; int *puVar9; puVar10 = auStack_18; puVar8 = auStack_18; puVar9 = auStack_18; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (param_2 == 1) { iVar5 = *param_1; } else { uVar7 = (long)param_2 * 4 + 0xf; puVar2 = auStack_18; while (puVar9 != auStack_18 + -(uVar7 & 0xfffffffffffff000)) { puVar8 = puVar2 + -0x1000; *(int8 *)(puVar2 + -8) = *(int8 *)(puVar2 + -8); puVar9 = puVar2 + -0x1000; puVar2 = puVar2 + -0x1000; } uVar7 = (ulong)((uint)uVar7 & 0xff0); lVar1 = -uVar7; puVar10 = puVar8 + lVar1; if (uVar7 != 0) { *(int8 *)(puVar8 + -8) = *(int8 *)(puVar8 + -8); } iVar5 = *param_1; iVar3 = param_1[1]; if (param_1[1] <= iVar5) { iVar3 = iVar5; } *(ulong *)(puVar8 + lVar1) = CONCAT44(iVar3,iVar5); if (2 < param_2) { if (param_2 < 5) { iVar6 = 2; } else { lVar4 = 4; do { iVar6 = param_1[lVar4 + -2]; iVar11 = iVar3; if (iVar3 <= iVar6) { iVar11 = iVar6; } iVar5 = iVar6 + iVar5; if (iVar5 <= iVar11) { iVar5 = iVar11; } *(int *)(puVar8 + lVar4 * 4 + lVar1 + -8) = iVar5; iVar6 = param_1[lVar4 + -1]; iVar11 = iVar3 + iVar6; if (iVar3 + iVar6 < iVar6) { iVar11 = iVar6; } iVar6 = (int)lVar4; iVar3 = iVar11; if (iVar11 < iVar5) { iVar3 = iVar5; } *(int *)(puVar8 + lVar4 * 4 + lVar1 + -4) = iVar3; lVar4 = lVar4 + 2; } while ((ulong)((param_2 - 5U >> 1) + 3) * 2 != lVar4); } lVar4 = (long)iVar6; do { iVar5 = param_1[lVar4]; iVar3 = *(int *)(puVar8 + lVar4 * 4 + lVar1 + -4); if (*(int *)(puVar8 + lVar4 * 4 + lVar1 + -4) <= iVar5) { iVar3 = iVar5; } if (iVar3 < iVar5 + *(int *)(puVar8 + lVar4 * 4 + lVar1 + -8)) { iVar3 = iVar5 + *(int *)(puVar8 + lVar4 * 4 + lVar1 + -8); } *(int *)(puVar8 + lVar4 * 4 + lVar1) = iVar3; lVar4 = lVar4 + 1; } while ((int)lVar4 < param_2); } iVar5 = *(int *)(puVar8 + (long)(param_2 + -1) * 4 + lVar1); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(int8 *)(puVar10 + -8) = 0x10141f; __stack_chk_fail(); } return iVar5; }
7,476
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Tuple; int compare_tuples(const void *a, const void *b) { Tuple *tuple_a = (Tuple *)a; Tuple *tuple_b = (Tuple *)b; return tuple_a->second - tuple_b->second; }
void func0(Tuple *tuples, int length) { qsort(tuples, length, sizeof(Tuple), compare_tuples); }
int main() { Tuple list1[5] = {{2, 5}, {1, 2}, {4, 4}, {2, 3}, {2, 1}}; Tuple list2[5] = {{9, 8}, {4, 7}, {3, 5}, {7, 9}, {1, 2}}; Tuple list3[3] = {{20, 50}, {10, 20}, {40, 40}}; func0(list1, 5); func0(list2, 5); func0(list3, 3); assert(list1[0].first == 2 && list1[0].second == 1); assert(list1[1].first == 1 && list1[1].second == 2); assert(list1[2].first == 2 && list1[2].second == 3); assert(list1[3].first == 4 && list1[3].second == 4); assert(list1[4].first == 2 && list1[4].second == 5); assert(list2[0].first == 1 && list2[0].second == 2); assert(list2[1].first == 3 && list2[1].second == 5); assert(list2[2].first == 4 && list2[2].second == 7); assert(list2[3].first == 9 && list2[3].second == 8); assert(list2[4].first == 7 && list2[4].second == 9); assert(list3[0].first == 10 && list3[0].second == 20); assert(list3[1].first == 40 && list3[1].second == 40); assert(list3[2].first == 20 && list3[2].second == 50); printf("All tests passed!\n"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov %rdi,-0x8(%rbp) mov %esi,-0xc(%rbp) mov -0xc(%rbp),%eax movslq %eax,%rsi mov -0x8(%rbp),%rax lea -0x58(%rip),%rcx mov $0x8,%edx mov %rax,%rdi callq 1090 <qsort@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 10h mov [rbp+base], rdi mov [rbp+var_C], esi mov eax, [rbp+var_C] movsxd rsi, eax; nmemb mov rax, [rbp+base] lea rdx, compare_tuples mov rcx, rdx; compar mov edx, 8; size mov rdi, rax; base call _qsort nop leave retn
void func0(void *a1, int a2) { qsort(a1, a2, 8uLL, compare_tuples); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x10 MOV qword ptr [RBP + -0x8],RDI MOV dword ptr [RBP + -0xc],ESI MOV EAX,dword ptr [RBP + -0xc] MOVSXD RSI,EAX MOV RAX,qword ptr [RBP + -0x8] LEA RDX,[0x1011a9] MOV RCX,RDX MOV EDX,0x8 MOV RDI,RAX CALL 0x00101090 NOP LEAVE RET
void func0(void *param_1,int param_2) { qsort(param_1,(long)param_2,8,compare_tuples); return; }
7,477
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Tuple; int compare_tuples(const void *a, const void *b) { Tuple *tuple_a = (Tuple *)a; Tuple *tuple_b = (Tuple *)b; return tuple_a->second - tuple_b->second; }
void func0(Tuple *tuples, int length) { qsort(tuples, length, sizeof(Tuple), compare_tuples); }
int main() { Tuple list1[5] = {{2, 5}, {1, 2}, {4, 4}, {2, 3}, {2, 1}}; Tuple list2[5] = {{9, 8}, {4, 7}, {3, 5}, {7, 9}, {1, 2}}; Tuple list3[3] = {{20, 50}, {10, 20}, {40, 40}}; func0(list1, 5); func0(list2, 5); func0(list3, 3); assert(list1[0].first == 2 && list1[0].second == 1); assert(list1[1].first == 1 && list1[1].second == 2); assert(list1[2].first == 2 && list1[2].second == 3); assert(list1[3].first == 4 && list1[3].second == 4); assert(list1[4].first == 2 && list1[4].second == 5); assert(list2[0].first == 1 && list2[0].second == 2); assert(list2[1].first == 3 && list2[1].second == 5); assert(list2[2].first == 4 && list2[2].second == 7); assert(list2[3].first == 9 && list2[3].second == 8); assert(list2[4].first == 7 && list2[4].second == 9); assert(list3[0].first == 10 && list3[0].second == 20); assert(list3[1].first == 40 && list3[1].second == 40); assert(list3[2].first == 20 && list3[2].second == 50); printf("All tests passed!\n"); return 0; }
O1
c
func0: endbr64 sub $0x8,%rsp movslq %esi,%rsi lea -0x1d(%rip),%rcx mov $0x8,%edx callq 1090 <qsort@plt> add $0x8,%rsp retq
func0: endbr64 sub rsp, 8 movsxd rsi, esi lea rcx, compare_tuples mov edx, 8 call _qsort add rsp, 8 retn
long long func0(long long a1, int a2) { return qsort(a1, a2, 8LL, compare_tuples); }
func0: ENDBR64 SUB RSP,0x8 MOVSXD RSI,ESI LEA RCX,[0x1011a9] MOV EDX,0x8 CALL 0x00101090 ADD RSP,0x8 RET
void func0(void *param_1,int param_2) { qsort(param_1,(long)param_2,8,compare_tuples); return; }
7,478
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Tuple; int compare_tuples(const void *a, const void *b) { Tuple *tuple_a = (Tuple *)a; Tuple *tuple_b = (Tuple *)b; return tuple_a->second - tuple_b->second; }
void func0(Tuple *tuples, int length) { qsort(tuples, length, sizeof(Tuple), compare_tuples); }
int main() { Tuple list1[5] = {{2, 5}, {1, 2}, {4, 4}, {2, 3}, {2, 1}}; Tuple list2[5] = {{9, 8}, {4, 7}, {3, 5}, {7, 9}, {1, 2}}; Tuple list3[3] = {{20, 50}, {10, 20}, {40, 40}}; func0(list1, 5); func0(list2, 5); func0(list3, 3); assert(list1[0].first == 2 && list1[0].second == 1); assert(list1[1].first == 1 && list1[1].second == 2); assert(list1[2].first == 2 && list1[2].second == 3); assert(list1[3].first == 4 && list1[3].second == 4); assert(list1[4].first == 2 && list1[4].second == 5); assert(list2[0].first == 1 && list2[0].second == 2); assert(list2[1].first == 3 && list2[1].second == 5); assert(list2[2].first == 4 && list2[2].second == 7); assert(list2[3].first == 9 && list2[3].second == 8); assert(list2[4].first == 7 && list2[4].second == 9); assert(list3[0].first == 10 && list3[0].second == 20); assert(list3[1].first == 40 && list3[1].second == 40); assert(list3[2].first == 20 && list3[2].second == 50); printf("All tests passed!\n"); return 0; }
O2
c
func0: endbr64 movslq %esi,%rsi lea -0x1e(%rip),%rcx mov $0x8,%edx jmpq 1090 <qsort@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 movsxd rsi, esi lea rcx, compare_tuples mov edx, 8 jmp _qsort
long long func0(long long a1, int a2) { return qsort(a1, a2, 8LL, compare_tuples); }
func0: ENDBR64 MOVSXD RSI,ESI LEA RCX,[0x1015a0] MOV EDX,0x8 JMP 0x00101090
void func0(void *param_1,int param_2) { qsort(param_1,(long)param_2,8,compare_tuples); return; }
7,479
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Tuple; int compare_tuples(const void *a, const void *b) { Tuple *tuple_a = (Tuple *)a; Tuple *tuple_b = (Tuple *)b; return tuple_a->second - tuple_b->second; }
void func0(Tuple *tuples, int length) { qsort(tuples, length, sizeof(Tuple), compare_tuples); }
int main() { Tuple list1[5] = {{2, 5}, {1, 2}, {4, 4}, {2, 3}, {2, 1}}; Tuple list2[5] = {{9, 8}, {4, 7}, {3, 5}, {7, 9}, {1, 2}}; Tuple list3[3] = {{20, 50}, {10, 20}, {40, 40}}; func0(list1, 5); func0(list2, 5); func0(list3, 3); assert(list1[0].first == 2 && list1[0].second == 1); assert(list1[1].first == 1 && list1[1].second == 2); assert(list1[2].first == 2 && list1[2].second == 3); assert(list1[3].first == 4 && list1[3].second == 4); assert(list1[4].first == 2 && list1[4].second == 5); assert(list2[0].first == 1 && list2[0].second == 2); assert(list2[1].first == 3 && list2[1].second == 5); assert(list2[2].first == 4 && list2[2].second == 7); assert(list2[3].first == 9 && list2[3].second == 8); assert(list2[4].first == 7 && list2[4].second == 9); assert(list3[0].first == 10 && list3[0].second == 20); assert(list3[1].first == 40 && list3[1].second == 40); assert(list3[2].first == 20 && list3[2].second == 50); printf("All tests passed!\n"); return 0; }
O3
c
func0: endbr64 movslq %esi,%rsi lea -0x1e(%rip),%rcx mov $0x8,%edx jmpq 1090 <qsort@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 movsxd rsi, esi; nmemb lea rcx, compare_tuples; compar mov edx, 8; size jmp _qsort
void func0(void *a1, int a2) { qsort(a1, a2, 8uLL, compare_tuples); }
func0: ENDBR64 MOVSXD RSI,ESI LEA RCX,[0x101550] MOV EDX,0x8 JMP 0x00101090
void func0(void *param_1,int param_2) { qsort(param_1,(long)param_2,8,compare_tuples); return; }
7,480
func0
#include <assert.h> #include <string.h> #include <stdlib.h> #include <stdbool.h>
bool func0(const char* sentence, const char* word) { char* token; char* toFree; char* sentenceCopy = strdup(sentence); if (!sentenceCopy) return false; toFree = sentenceCopy; token = strtok(sentenceCopy, " "); while (token != NULL) { if (strcmp(token, word) == 0) { free(toFree); return true; } token = strtok(NULL, " "); } free(toFree); return false; }
int main() { assert(func0("machine learning", "machine") == true); assert(func0("easy", "fun") == false); assert(func0("python language", "code") == false); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x28(%rbp) mov %rsi,-0x30(%rbp) mov -0x28(%rbp),%rax mov %rax,%rdi callq 10d0 <strdup@plt> mov %rax,-0x10(%rbp) cmpq $0x0,-0x10(%rbp) jne 11fb <func0+0x32> mov $0x0,%eax jmp 1273 <func0+0xaa> mov -0x10(%rbp),%rax mov %rax,-0x8(%rbp) mov -0x10(%rbp),%rax lea 0xdfa(%rip),%rsi mov %rax,%rdi callq 10c0 <strtok@plt> mov %rax,-0x18(%rbp) jmp 125b <func0+0x92> mov -0x30(%rbp),%rdx mov -0x18(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 10b0 <strcmp@plt> test %eax,%eax jne 1246 <func0+0x7d> mov -0x8(%rbp),%rax mov %rax,%rdi callq 1090 <free@plt> mov $0x1,%eax jmp 1273 <func0+0xaa> lea 0xdbb(%rip),%rsi mov $0x0,%edi callq 10c0 <strtok@plt> mov %rax,-0x18(%rbp) cmpq $0x0,-0x18(%rbp) jne 121c <func0+0x53> mov -0x8(%rbp),%rax mov %rax,%rdi callq 1090 <free@plt> mov $0x0,%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+s], rdi mov [rbp+s2], rsi mov rax, [rbp+s] mov rdi, rax; s call _strdup mov [rbp+var_10], rax cmp [rbp+var_10], 0 jnz short loc_11FB mov eax, 0 jmp short locret_1279 loc_11FB: mov rax, [rbp+var_10] mov [rbp+ptr], rax mov rax, [rbp+var_10] lea rdx, delim; " " mov rsi, rdx; delim mov rdi, rax; s call _strtok mov [rbp+s1], rax jmp short loc_1261 loc_121F: mov rdx, [rbp+s2] mov rax, [rbp+s1] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jnz short loc_1249 mov rax, [rbp+ptr] mov rdi, rax; ptr call _free mov eax, 1 jmp short locret_1279 loc_1249: lea rax, delim; " " mov rsi, rax; delim mov edi, 0; s call _strtok mov [rbp+s1], rax loc_1261: cmp [rbp+s1], 0 jnz short loc_121F mov rax, [rbp+ptr] mov rdi, rax; ptr call _free mov eax, 0 locret_1279: leave retn
long long func0(const char *a1, const char *a2) { const char *s1; // [rsp+18h] [rbp-18h] char *v4; // [rsp+20h] [rbp-10h] v4 = strdup(a1); if ( !v4 ) return 0LL; for ( s1 = strtok(v4, " "); s1; s1 = strtok(0LL, " ") ) { if ( !strcmp(s1, a2) ) { free(v4); return 1LL; } } free(v4); return 0LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x28],RDI MOV qword ptr [RBP + -0x30],RSI MOV RAX,qword ptr [RBP + -0x28] MOV RDI,RAX CALL 0x001010d0 MOV qword ptr [RBP + -0x10],RAX CMP qword ptr [RBP + -0x10],0x0 JNZ 0x001011fb MOV EAX,0x0 JMP 0x00101279 LAB_001011fb: MOV RAX,qword ptr [RBP + -0x10] MOV qword ptr [RBP + -0x8],RAX MOV RAX,qword ptr [RBP + -0x10] LEA RDX,[0x102008] MOV RSI,RDX MOV RDI,RAX CALL 0x001010c0 MOV qword ptr [RBP + -0x18],RAX JMP 0x00101261 LAB_0010121f: MOV RDX,qword ptr [RBP + -0x30] MOV RAX,qword ptr [RBP + -0x18] MOV RSI,RDX MOV RDI,RAX CALL 0x001010b0 TEST EAX,EAX JNZ 0x00101249 MOV RAX,qword ptr [RBP + -0x8] MOV RDI,RAX CALL 0x00101090 MOV EAX,0x1 JMP 0x00101279 LAB_00101249: LEA RAX,[0x102008] MOV RSI,RAX MOV EDI,0x0 CALL 0x001010c0 MOV qword ptr [RBP + -0x18],RAX LAB_00101261: CMP qword ptr [RBP + -0x18],0x0 JNZ 0x0010121f MOV RAX,qword ptr [RBP + -0x8] MOV RDI,RAX CALL 0x00101090 MOV EAX,0x0 LAB_00101279: LEAVE RET
int8 func0(char *param_1,char *param_2) { int iVar1; char *__s; char *local_20; __s = strdup(param_1); if (__s != (char *)0x0) { local_20 = strtok(__s," "); while (local_20 != (char *)0x0) { iVar1 = strcmp(local_20,param_2); if (iVar1 == 0) { free(__s); return 1; } local_20 = strtok((char *)0x0," "); } free(__s); } return 0; }
7,481
func0
#include <assert.h> #include <string.h> #include <stdlib.h> #include <stdbool.h>
bool func0(const char* sentence, const char* word) { char* token; char* toFree; char* sentenceCopy = strdup(sentence); if (!sentenceCopy) return false; toFree = sentenceCopy; token = strtok(sentenceCopy, " "); while (token != NULL) { if (strcmp(token, word) == 0) { free(toFree); return true; } token = strtok(NULL, " "); } free(toFree); return false; }
int main() { assert(func0("machine learning", "machine") == true); assert(func0("easy", "fun") == false); assert(func0("python language", "code") == false); return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx mov %rsi,%rbx callq 10d0 <strdup@plt> test %rax,%rax je 1241 <func0+0x78> mov %rax,%rbp lea 0xe1c(%rip),%rsi mov %rax,%rdi callq 10c0 <strtok@plt> mov %rax,%rdi test %rax,%rax je 1220 <func0+0x57> lea 0xe05(%rip),%r12 mov %rbx,%rsi callq 10b0 <strcmp@plt> test %eax,%eax je 1232 <func0+0x69> mov %r12,%rsi mov $0x0,%edi callq 10c0 <strtok@plt> mov %rax,%rdi test %rax,%rax jne 11ff <func0+0x36> mov %rbp,%rdi callq 1090 <free@plt> mov $0x0,%eax pop %rbx pop %rbp pop %r12 retq mov %rbp,%rdi callq 1090 <free@plt> mov $0x1,%eax jmp 122d <func0+0x64> mov $0x0,%eax jmp 122d <func0+0x64>
func0: endbr64 push r12 push rbp push rbx mov rbx, rsi call _strdup test rax, rax jz short loc_1241 mov rbp, rax lea rsi, unk_2004 mov rdi, rax call _strtok mov rdi, rax test rax, rax jz short loc_1220 lea r12, unk_2004 loc_11FF: mov rsi, rbx call _strcmp test eax, eax jz short loc_1232 mov rsi, r12 mov edi, 0 call _strtok mov rdi, rax test rax, rax jnz short loc_11FF loc_1220: mov rdi, rbp call _free mov eax, 0 loc_122D: pop rbx pop rbp pop r12 retn loc_1232: mov rdi, rbp call _free mov eax, 1 jmp short loc_122D loc_1241: mov eax, 0 jmp short loc_122D
long long func0(long long a1, long long a2) { long long v2; // rax long long v3; // rbp long long v4; // rdi v2 = strdup(); if ( !v2 ) return 0LL; v3 = v2; v4 = strtok(v2, &unk_2004); if ( v4 ) { while ( (unsigned int)strcmp(v4, a2) ) { v4 = strtok(0LL, &unk_2004); if ( !v4 ) goto LABEL_5; } free(v3); return 1LL; } else { LABEL_5: free(v3); return 0LL; } }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RSI CALL 0x001010d0 TEST RAX,RAX JZ 0x00101241 MOV RBP,RAX LEA RSI,[0x102004] MOV RDI,RAX CALL 0x001010c0 MOV RDI,RAX TEST RAX,RAX JZ 0x00101220 LEA R12,[0x102004] LAB_001011ff: MOV RSI,RBX CALL 0x001010b0 TEST EAX,EAX JZ 0x00101232 MOV RSI,R12 MOV EDI,0x0 CALL 0x001010c0 MOV RDI,RAX TEST RAX,RAX JNZ 0x001011ff LAB_00101220: MOV RDI,RBP CALL 0x00101090 MOV EAX,0x0 LAB_0010122d: POP RBX POP RBP POP R12 RET LAB_00101232: MOV RDI,RBP CALL 0x00101090 MOV EAX,0x1 JMP 0x0010122d LAB_00101241: MOV EAX,0x0 JMP 0x0010122d
int8 func0(char *param_1,char *param_2) { int iVar1; char *__s; char *__s1; __s = strdup(param_1); if (__s != (char *)0x0) { __s1 = strtok(__s," "); while (__s1 != (char *)0x0) { iVar1 = strcmp(__s1,param_2); if (iVar1 == 0) { free(__s); return 1; } __s1 = strtok((char *)0x0," "); } free(__s); } return 0; }