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
6,882
func0
#include <stdio.h> #include <assert.h>
int func0(char* X, char* Y, char* Z, int m, int n, int o) { int L[m+1][n+1][o+1]; int i, j, k; for (i = 0; i <= m; i++) { for (j = 0; j <= n; j++) { for (k = 0; k <= o; k++) { if (i == 0 || j == 0 || k == 0) { L[i][j][k] = 0; } else if (X[i-1] == Y[j-1] && X[i-1] == Z[k-1]) { L[i][j][k] = L[i-1][j-1][k-1] + 1; } else { int max1 = L[i-1][j][k] > L[i][j-1][k] ? L[i-1][j][k] : L[i][j-1][k]; L[i][j][k] = max1 > L[i][j][k-1] ? max1 : L[i][j][k-1]; } } } } return L[m][n][o]; }
int main() { // Testing the implementation with assertions assert(func0("AGGT12", "12TXAYB", "12XBA", 6, 7, 5) == 2); assert(func0("Reels", "Reelsfor", "ReelsforReels", 5, 8, 13) == 5); assert(func0("abcd1e2", "bc12ea", "bd1ea", 7, 6, 5) == 3); printf("All tests passed!\n"); return 0; }
O2
c
func0: endbr64 push %rbp mov %rsp,%rbp push %r15 mov %r9d,%r15d push %r14 push %r13 mov %rdi,%r13 push %r12 push %rbx mov %rsi,%rbx sub $0x78,%rsp mov %rdx,-0x60(%rbp) mov %ecx,%edx lea 0x1(%r8),%ecx mov %r8d,-0x7c(%rbp) movslq %ecx,%rcx mov %fs:0x28,%rax mov %rax,-0x38(%rbp) xor %eax,%eax lea 0x1(%r9),%eax cltq lea 0x0(,%rax,4),%rdi imul %rcx,%rax lea 0x1(%rdx),%ecx mov %rdi,-0x50(%rbp) mov %rsp,%rdi movslq %ecx,%rcx imul %rax,%rcx lea 0xf(,%rcx,4),%rsi mov %rsi,%rcx and $0xfffffffffffff000,%rsi sub %rsi,%rdi and $0xfffffffffffffff0,%rcx mov %rdi,%rsi cmp %rsi,%rsp je 1337 <func0+0x97> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rsi,%rsp jne 1322 <func0+0x82> and $0xfff,%ecx sub %rcx,%rsp test %rcx,%rcx jne 1521 <func0+0x281> shl $0x2,%rax mov %rsp,-0x90(%rbp) shr $0x2,%rax mov %rax,-0x68(%rbp) mov -0x50(%rbp),%rax shr $0x2,%rax mov %rax,-0x98(%rbp) test %edx,%edx js 14c6 <func0+0x226> movslq %edx,%rax sub $0x1,%r13 xor %r14d,%r14d movslq %r15d,%rdi mov %rax,-0x88(%rbp) mov -0x98(%rbp),%rax movq $0x0,-0x78(%rbp) neg %rax movq $0xffffffffffffffff,-0x70(%rbp) shl $0x2,%rax mov %rax,-0x58(%rbp) movslq -0x7c(%rbp),%rax mov %rax,-0x48(%rbp) nopl 0x0(%rax) mov -0x7c(%rbp),%eax test %eax,%eax js 14a0 <func0+0x200> mov -0x70(%rbp),%r12 mov -0x90(%rbp),%rax xor %r10d,%r10d mov -0x78(%rbp),%rcx sub %r14,%r12 imul -0x68(%rbp),%r12 lea (%rax,%rcx,4),%r11 nopl 0x0(%rax) test %r15d,%r15d js 1460 <func0+0x1c0> test %r14d,%r14d mov %r11,%rdx sete %r8b test %r10d,%r10d sete %al or %eax,%r8d mov -0x58(%rbp),%rax lea (%r11,%rax,1),%rcx xor %eax,%eax jmp 144b <func0+0x1ab> nopl 0x0(%rax) test %r8b,%r8b jne 144f <func0+0x1af> movzbl 0x0(%r13),%esi cmp -0x1(%rbx,%r10,1),%sil je 1480 <func0+0x1e0> mov (%rdx,%r12,4),%esi mov -0x4(%rdx),%r9d cmp %esi,(%rcx) cmovge (%rcx),%esi cmp %r9d,%esi cmovl %r9d,%esi mov %esi,(%rdx) lea 0x1(%rax),%rsi add $0x4,%rdx add $0x4,%rcx cmp %rax,%rdi je 1460 <func0+0x1c0> mov %rsi,%rax test %eax,%eax jne 1410 <func0+0x170> movl $0x0,(%rdx) jmp 1437 <func0+0x197> nopw 0x0(%rax,%rax,1) lea 0x1(%r10),%rax add -0x50(%rbp),%r11 cmp -0x48(%rbp),%r10 je 14a0 <func0+0x200> mov %rax,%r10 jmpq 13e8 <func0+0x148> nopw %cs:0x0(%rax,%rax,1) mov -0x60(%rbp),%r9 cmp -0x1(%r9,%rax,1),%sil jne 1421 <func0+0x181> mov -0x4(%rcx,%r12,4),%esi add $0x1,%esi mov %esi,(%rdx) jmp 1437 <func0+0x197> nopw 0x0(%rax,%rax,1) mov -0x68(%rbp),%rdx lea 0x1(%r14),%rax add %rdx,-0x78(%rbp) add $0x1,%r13 addq $0x1,-0x70(%rbp) cmp -0x88(%rbp),%r14 je 14db <func0+0x23b> mov %rax,%r14 jmpq 13b8 <func0+0x118> movslq %edx,%rax movslq %r15d,%rdi mov %rax,-0x88(%rbp) movslq -0x7c(%rbp),%rax mov %rax,-0x48(%rbp) mov -0x88(%rbp),%rax imul -0x68(%rbp),%rax mov -0x48(%rbp),%rdx imul -0x98(%rbp),%rdx mov -0x90(%rbp),%rbx add %rdi,%rax add %rdx,%rax mov (%rbx,%rax,4),%eax mov -0x38(%rbp),%rbx xor %fs:0x28,%rbx jne 152c <func0+0x28c> lea -0x28(%rbp),%rsp pop %rbx pop %r12 pop %r13 pop %r14 pop %r15 pop %rbp retq orq $0x0,-0x8(%rsp,%rcx,1) jmpq 1349 <func0+0xa9> callq 1080 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 push rbp mov r11, rsi mov rbp, rsp push r15 push r14 mov r14d, r9d push r13 push r12 push rbx mov rbx, rdi sub rsp, 68h mov [rbp+var_60], rdx mov edx, ecx lea ecx, [r9+1] mov [rbp+var_74], r8d movsxd rcx, ecx mov rdi, rsp mov rax, fs:28h mov [rbp+var_38], rax xor eax, eax lea rax, ds:0[rcx*4] mov [rbp+var_50], rax lea eax, [r8+1] cdqe imul rax, rcx lea ecx, [rdx+1] movsxd rcx, ecx imul rcx, rax lea rsi, ds:0Fh[rcx*4] mov rcx, rsi and rsi, 0FFFFFFFFFFFFF000h sub rdi, rsi and rcx, 0FFFFFFFFFFFFFFF0h cmp rsp, rdi jz short loc_1334 loc_131F: sub rsp, 1000h or [rsp+1090h+var_98], 0 cmp rsp, rdi jnz short loc_131F loc_1334: and ecx, 0FFFh sub rsp, rcx test rcx, rcx jnz loc_14EB loc_1346: shl rax, 2 mov [rbp+var_88], rsp shr rax, 2 mov [rbp+var_70], rax mov rax, [rbp+var_50] shr rax, 2 mov [rbp+var_90], rax test edx, edx js loc_1496 movsxd rax, edx mov r12, [rbp+var_70] sub rbx, 1 xor r13d, r13d mov [rbp+var_80], rax mov rax, [rbp+var_90] movsxd rdi, r14d mov [rbp+var_68], 0 neg r12 neg rax shl rax, 2 mov [rbp+var_58], rax movsxd rax, [rbp+var_74] mov [rbp+var_48], rax nop word ptr [rax+rax+00h] loc_13B0: mov eax, [rbp+var_74] test eax, eax js loc_1478 mov rax, [rbp+var_88] mov rsi, [rbp+var_68] xor r9d, r9d lea r10, [rax+rsi*4] nop dword ptr [rax] loc_13D0: test r14d, r14d js short loc_1440 test r9d, r9d mov rcx, r10 setz r8b test r13d, r13d setz al or r8d, eax mov rax, [rbp+var_58] lea rsi, [r10+rax] xor eax, eax jmp short loc_1435 loc_13F8: test r8b, r8b jnz short loc_1439 movzx edx, byte ptr [rbx] cmp dl, [r11+r9-1] jz short loc_1460 loc_1407: mov r15d, [rcx+r12*4] mov edx, [rsi] cmp edx, r15d cmovl edx, r15d mov r15d, [rcx-4] cmp edx, r15d cmovl edx, r15d loc_141F: mov [rcx], edx add rsi, 4 lea rdx, [rax+1] add rcx, 4 cmp rax, rdi jz short loc_1440 mov rax, rdx loc_1435: test eax, eax jnz short loc_13F8 loc_1439: xor edx, edx jmp short loc_141F loc_1440: lea rax, [r9+1] add r10, [rbp+var_50] cmp r9, [rbp+var_48] jz short loc_1478 mov r9, rax jmp loc_13D0 loc_1460: mov r15, [rbp+var_60] cmp dl, [r15+rax-1] jnz short loc_1407 mov edx, [rsi+r12*4-4] add edx, 1 jmp short loc_141F loc_1478: mov rcx, [rbp+var_70] lea rax, [r13+1] add [rbp+var_68], rcx add rbx, 1 cmp r13, [rbp+var_80] jz short loc_14A8 mov r13, rax jmp loc_13B0 loc_1496: movsxd rax, edx movsxd rdi, r14d mov [rbp+var_80], rax movsxd rax, [rbp+var_74] mov [rbp+var_48], rax loc_14A8: mov rax, [rbp+var_80] imul rax, [rbp+var_70] mov rdx, [rbp+var_48] imul rdx, [rbp+var_90] mov rbx, [rbp+var_88] add rax, rdi add rax, rdx mov eax, [rbx+rax*4] mov rdx, [rbp+var_38] sub rdx, fs:28h jnz short loc_14F6 lea rsp, [rbp-28h] pop rbx pop r12 pop r13 pop r14 pop r15 pop rbp retn loc_14EB: or [rsp+rcx+1090h+var_1098], 0 jmp loc_1346 loc_14F6: call ___stack_chk_fail
long long func0(long long a1, long long a2, long long a3, int a4, int a5, int a6) { long long v10; // rcx long long v11; // rax long long v12; // rcx unsigned long long *v13; // rdi __int16 v14; // cx signed long long v15; // rcx void *v16; // rsp _BYTE *v17; // rbx long long v18; // r13 long long v19; // rdi long long v20; // r12 long long v21; // r9 int *v22; // r10 int *v23; // rcx int *v24; // rsi long long i; // rax int v26; // edx _BYTE v29[4088]; // [rsp+8h] [rbp-1090h] BYREF unsigned long long v30; // [rsp+1008h] [rbp-90h] BYREF _BYTE *v31; // [rsp+1010h] [rbp-88h] long long v32; // [rsp+1018h] [rbp-80h] int v33; // [rsp+1024h] [rbp-74h] unsigned long long v34; // [rsp+1028h] [rbp-70h] long long v35; // [rsp+1030h] [rbp-68h] long long v36; // [rsp+1038h] [rbp-60h] long long v37; // [rsp+1040h] [rbp-58h] unsigned long long v38; // [rsp+1048h] [rbp-50h] long long v39; // [rsp+1050h] [rbp-48h] unsigned long long v40; // [rsp+1060h] [rbp-38h] v36 = a3; v33 = a5; v10 = a6 + 1; v40 = __readfsqword(0x28u); v38 = 4 * v10; v11 = v10 * (a5 + 1); v12 = 4 * v11 * (a4 + 1) + 15; v13 = (unsigned long long *)((char *)&v30 - (v12 & 0xFFFFFFFFFFFFF000LL)); v14 = v12 & 0xFFF0; if ( &v30 != v13 ) { while ( v29 != (_BYTE *)v13 ) ; } v15 = v14 & 0xFFF; v16 = alloca(v15); if ( v15 ) *(_QWORD *)&v29[v15 - 8] = *(_QWORD *)&v29[v15 - 8]; v31 = v29; v34 = (unsigned long long)(4 * v11) >> 2; v30 = v38 >> 2; if ( a4 < 0 ) { v19 = a6; v32 = a4; v39 = v33; } else { v17 = (_BYTE *)(a1 - 1); v18 = 0LL; v32 = a4; v19 = a6; v35 = 0LL; v20 = -(long long)v34; v37 = -4LL * v30; v39 = v33; while ( 1 ) { if ( v33 >= 0 ) { v21 = 0LL; v22 = (int *)&v31[4 * v35]; while ( 1 ) { if ( a6 >= 0 ) { v23 = v22; v24 = &v22[(unsigned long long)v37 / 4]; for ( i = 0LL; ; ++i ) { if ( !(_DWORD)i || (_DWORD)v18 == 0 || (_DWORD)v21 == 0 ) { v26 = 0; } else if ( *v17 == *(_BYTE *)(a2 + v21 - 1) && *v17 == *(_BYTE *)(v36 + i - 1) ) { v26 = v24[v20 - 1] + 1; } else { v26 = *v24; if ( *v24 < v23[v20] ) v26 = v23[v20]; if ( v26 < *(v23 - 1) ) v26 = *(v23 - 1); } *v23 = v26; ++v24; ++v23; if ( i == a6 ) break; } } v22 = (int *)((char *)v22 + v38); if ( v21 == v39 ) break; ++v21; } } v35 += v34; ++v17; if ( v18 == v32 ) break; ++v18; } } return *(unsigned int *)&v31[4 * v30 * v39 + 4 * v19 + 4 * v34 * v32]; }
func0: ENDBR64 PUSH RBP MOV R11,RSI MOV RBP,RSP PUSH R15 PUSH R14 MOV R14D,R9D PUSH R13 PUSH R12 PUSH RBX MOV RBX,RDI SUB RSP,0x68 MOV qword ptr [RBP + -0x60],RDX MOV EDX,ECX LEA ECX,[R9 + 0x1] MOV dword ptr [RBP + -0x74],R8D MOVSXD RCX,ECX MOV RDI,RSP MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x38],RAX XOR EAX,EAX LEA RAX,[RCX*0x4] MOV qword ptr [RBP + -0x50],RAX LEA EAX,[R8 + 0x1] CDQE IMUL RAX,RCX LEA ECX,[RDX + 0x1] MOVSXD RCX,ECX IMUL RCX,RAX LEA RSI,[0xf + RCX*0x4] MOV RCX,RSI AND RSI,-0x1000 SUB RDI,RSI AND RCX,-0x10 CMP RSP,RDI JZ 0x00101334 LAB_0010131f: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RDI JNZ 0x0010131f LAB_00101334: AND ECX,0xfff SUB RSP,RCX TEST RCX,RCX JNZ 0x001014eb LAB_00101346: SHL RAX,0x2 MOV qword ptr [RBP + -0x88],RSP SHR RAX,0x2 MOV qword ptr [RBP + -0x70],RAX MOV RAX,qword ptr [RBP + -0x50] SHR RAX,0x2 MOV qword ptr [RBP + -0x90],RAX TEST EDX,EDX JS 0x00101496 MOVSXD RAX,EDX MOV R12,qword ptr [RBP + -0x70] SUB RBX,0x1 XOR R13D,R13D MOV qword ptr [RBP + -0x80],RAX MOV RAX,qword ptr [RBP + -0x90] MOVSXD RDI,R14D MOV qword ptr [RBP + -0x68],0x0 NEG R12 NEG RAX SHL RAX,0x2 MOV qword ptr [RBP + -0x58],RAX MOVSXD RAX,dword ptr [RBP + -0x74] MOV qword ptr [RBP + -0x48],RAX NOP word ptr [RAX + RAX*0x1] LAB_001013b0: MOV EAX,dword ptr [RBP + -0x74] TEST EAX,EAX JS 0x00101478 MOV RAX,qword ptr [RBP + -0x88] MOV RSI,qword ptr [RBP + -0x68] XOR R9D,R9D LEA R10,[RAX + RSI*0x4] NOP dword ptr [RAX] LAB_001013d0: TEST R14D,R14D JS 0x00101440 TEST R9D,R9D MOV RCX,R10 SETZ R8B TEST R13D,R13D SETZ AL OR R8D,EAX MOV RAX,qword ptr [RBP + -0x58] LEA RSI,[R10 + RAX*0x1] XOR EAX,EAX JMP 0x00101435 LAB_001013f8: TEST R8B,R8B JNZ 0x00101439 MOVZX EDX,byte ptr [RBX] CMP DL,byte ptr [R11 + R9*0x1 + -0x1] JZ 0x00101460 LAB_00101407: MOV R15D,dword ptr [RCX + R12*0x4] MOV EDX,dword ptr [RSI] CMP EDX,R15D CMOVL EDX,R15D MOV R15D,dword ptr [RCX + -0x4] CMP EDX,R15D CMOVL EDX,R15D LAB_0010141f: MOV dword ptr [RCX],EDX ADD RSI,0x4 LEA RDX,[RAX + 0x1] ADD RCX,0x4 CMP RAX,RDI JZ 0x00101440 MOV RAX,RDX LAB_00101435: TEST EAX,EAX JNZ 0x001013f8 LAB_00101439: XOR EDX,EDX JMP 0x0010141f LAB_00101440: LEA RAX,[R9 + 0x1] ADD R10,qword ptr [RBP + -0x50] CMP R9,qword ptr [RBP + -0x48] JZ 0x00101478 MOV R9,RAX JMP 0x001013d0 LAB_00101460: MOV R15,qword ptr [RBP + -0x60] CMP DL,byte ptr [R15 + RAX*0x1 + -0x1] JNZ 0x00101407 MOV EDX,dword ptr [RSI + R12*0x4 + -0x4] ADD EDX,0x1 JMP 0x0010141f LAB_00101478: MOV RCX,qword ptr [RBP + -0x70] LEA RAX,[R13 + 0x1] ADD qword ptr [RBP + -0x68],RCX ADD RBX,0x1 CMP R13,qword ptr [RBP + -0x80] JZ 0x001014a8 MOV R13,RAX JMP 0x001013b0 LAB_00101496: MOVSXD RAX,EDX MOVSXD RDI,R14D MOV qword ptr [RBP + -0x80],RAX MOVSXD RAX,dword ptr [RBP + -0x74] MOV qword ptr [RBP + -0x48],RAX LAB_001014a8: MOV RAX,qword ptr [RBP + -0x80] IMUL RAX,qword ptr [RBP + -0x70] MOV RDX,qword ptr [RBP + -0x48] IMUL RDX,qword ptr [RBP + -0x90] MOV RBX,qword ptr [RBP + -0x88] ADD RAX,RDI ADD RAX,RDX MOV EAX,dword ptr [RBX + RAX*0x4] MOV RDX,qword ptr [RBP + -0x38] SUB RDX,qword ptr FS:[0x28] JNZ 0x001014f6 LEA RSP,[RBP + -0x28] POP RBX POP R12 POP R13 POP R14 POP R15 POP RBP RET LAB_001014eb: OR qword ptr [RSP + RCX*0x1 + -0x8],0x0 JMP 0x00101346 LAB_001014f6: CALL 0x00101080
int4 func0(long param_1,long param_2,long param_3,int param_4,int param_5,int param_6) { long lVar1; ulong *puVar2; long lVar3; ulong uVar4; ulong uVar5; int *piVar6; int iVar7; char *pcVar8; ulong *puVar9; int *piVar11; long lVar12; int *piVar13; long lVar14; long in_FS_OFFSET; bool bVar15; ulong local_98; int1 *local_90; long local_88; int local_7c; ulong local_78; long local_70; long local_68; long local_60; long local_58; long local_50; long local_40; ulong *puVar10; puVar9 = &local_98; uVar4 = (ulong)(param_6 + 1); local_40 = *(long *)(in_FS_OFFSET + 0x28); local_58 = uVar4 * 4; local_78 = (long)(param_5 + 1) * uVar4; uVar5 = (long)(param_4 + 1) * local_78 * 4 + 0xf; puVar10 = &local_98; puVar2 = &local_98; while (puVar10 != (ulong *)((long)&local_98 - (uVar5 & 0xfffffffffffff000))) { puVar9 = (ulong *)((long)puVar2 + -0x1000); *(int8 *)((long)puVar2 + -8) = *(int8 *)((long)puVar2 + -8); puVar10 = (ulong *)((long)puVar2 + -0x1000); puVar2 = (ulong *)((long)puVar2 + -0x1000); } uVar5 = (ulong)((uint)uVar5 & 0xff0); lVar1 = -uVar5; local_90 = (int1 *)((long)puVar9 + lVar1); if (uVar5 != 0) { *(int8 *)((long)puVar9 + -8) = *(int8 *)((long)puVar9 + -8); } local_78 = local_78 & 0x3fffffffffffffff; local_98 = uVar4 & 0x3fffffffffffffff; if (-1 < param_4) { pcVar8 = (char *)(param_1 + -1); local_70 = 0; local_60 = local_98 * -4; lVar14 = 0; do { if (-1 < param_5) { piVar13 = (int *)((long)puVar9 + local_70 * 4 + lVar1); lVar12 = 0; do { if (-1 < param_6) { piVar11 = piVar13 + -local_98; lVar3 = 0; piVar6 = piVar13; do { if (((int)lVar3 == 0) || ((int)lVar12 == 0 || (int)lVar14 == 0)) { iVar7 = 0; } else if ((*pcVar8 == *(char *)(param_2 + -1 + lVar12)) && (*pcVar8 == *(char *)(param_3 + -1 + lVar3))) { iVar7 = piVar11[-1 - local_78] + 1; } else { iVar7 = *piVar11; if (*piVar11 < piVar6[-local_78]) { iVar7 = piVar6[-local_78]; } if (iVar7 < piVar6[-1]) { iVar7 = piVar6[-1]; } } *piVar6 = iVar7; piVar11 = piVar11 + 1; piVar6 = piVar6 + 1; bVar15 = lVar3 != param_6; lVar3 = lVar3 + 1; } while (bVar15); } piVar13 = piVar13 + uVar4; bVar15 = lVar12 != param_5; lVar12 = lVar12 + 1; } while (bVar15); } local_70 = local_70 + local_78; pcVar8 = pcVar8 + 1; bVar15 = lVar14 != param_4; lVar14 = lVar14 + 1; } while (bVar15); } local_50 = (long)param_5; local_88 = (long)param_4; if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return *(int4 *) ((long)puVar9 + (local_88 * local_78 + (long)param_6 + local_50 * local_98) * 4 + lVar1) ; } /* WARNING: Subroutine does not return */ *(int8 *)((long)puVar9 + lVar1 + -8) = 0x1014fb; local_7c = param_5; local_68 = param_3; __stack_chk_fail(); }
6,883
func0
#include <stdio.h> #include <assert.h>
int func0(char* X, char* Y, char* Z, int m, int n, int o) { int L[m+1][n+1][o+1]; int i, j, k; for (i = 0; i <= m; i++) { for (j = 0; j <= n; j++) { for (k = 0; k <= o; k++) { if (i == 0 || j == 0 || k == 0) { L[i][j][k] = 0; } else if (X[i-1] == Y[j-1] && X[i-1] == Z[k-1]) { L[i][j][k] = L[i-1][j-1][k-1] + 1; } else { int max1 = L[i-1][j][k] > L[i][j-1][k] ? L[i-1][j][k] : L[i][j-1][k]; L[i][j][k] = max1 > L[i][j][k-1] ? max1 : L[i][j][k-1]; } } } } return L[m][n][o]; }
int main() { // Testing the implementation with assertions assert(func0("AGGT12", "12TXAYB", "12XBA", 6, 7, 5) == 2); assert(func0("Reels", "Reelsfor", "ReelsforReels", 5, 8, 13) == 5); assert(func0("abcd1e2", "bc12ea", "bd1ea", 7, 6, 5) == 3); printf("All tests passed!\n"); return 0; }
O3
c
func0: endbr64 push %rbp movslq %r8d,%rax mov %rsp,%rbp push %r15 push %r14 push %r13 mov %rdi,%r13 movslq %r9d,%rdi push %r12 push %rbx mov %rsi,%rbx sub $0x68,%rsp mov %rdx,-0x58(%rbp) mov %ecx,%edx mov %rsp,%r15 mov %fs:0x28,%rcx mov %rcx,-0x38(%rbp) xor %ecx,%ecx lea 0x1(%rdi),%ecx movslq %ecx,%rcx lea 0x0(,%rcx,4),%rsi mov %rsi,-0x50(%rbp) lea 0x1(%rax),%esi movslq %esi,%rsi imul %rsi,%rcx lea 0x1(%rdx),%esi movslq %esi,%rsi imul %rcx,%rsi lea 0xf(,%rsi,4),%r8 mov %r8,%rsi and $0xfffffffffffff000,%r8 sub %r8,%r15 and $0xfffffffffffffff0,%rsi mov %r15,%r8 cmp %r8,%rsp je 1335 <func0+0x95> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %r8,%rsp jne 1320 <func0+0x80> and $0xfff,%esi sub %rsi,%rsp test %rsi,%rsi jne 14ee <func0+0x24e> shl $0x2,%rcx mov %rsp,-0x80(%rbp) shr $0x2,%rcx mov %rcx,-0x60(%rbp) mov -0x50(%rbp),%rcx shr $0x2,%rcx mov %rcx,-0x88(%rbp) test %edx,%edx js 14a3 <func0+0x203> test %eax,%eax js 14a3 <func0+0x203> test %edi,%edi js 14a3 <func0+0x203> mov %rcx,%r15 movslq %edx,%rcx mov %rax,-0x48(%rbp) sub $0x1,%r13 mov %rcx,-0x78(%rbp) neg %r15 xor %r14d,%r14d movq $0x0,-0x70(%rbp) shl $0x2,%r15 movq $0xffffffffffffffff,-0x68(%rbp) nopw 0x0(%rax,%rax,1) mov -0x68(%rbp),%r12 mov -0x80(%rbp),%rax xor %r10d,%r10d mov -0x70(%rbp),%rcx sub %r14,%r12 imul -0x60(%rbp),%r12 lea (%rax,%rcx,4),%r11 nopl 0x0(%rax,%rax,1) test %r14d,%r14d lea (%r11,%r15,1),%rcx mov %r11,%rdx sete %r8b test %r10d,%r10d sete %al or %eax,%r8d xor %eax,%eax jmp 142b <func0+0x18b> nopl 0x0(%rax,%rax,1) test %r8b,%r8b jne 142f <func0+0x18f> movzbl 0x0(%r13),%esi cmp -0x1(%rbx,%r10,1),%sil je 1460 <func0+0x1c0> mov (%rdx,%r12,4),%esi mov -0x4(%rdx),%r9d cmp %esi,(%rcx) cmovge (%rcx),%esi cmp %r9d,%esi cmovl %r9d,%esi mov %esi,(%rdx) lea 0x1(%rax),%rsi add $0x4,%rdx add $0x4,%rcx cmp %rax,%rdi je 1440 <func0+0x1a0> mov %rsi,%rax test %eax,%eax jne 13f0 <func0+0x150> movl $0x0,(%rdx) jmp 1417 <func0+0x177> nopw 0x0(%rax,%rax,1) lea 0x1(%r10),%rax add -0x50(%rbp),%r11 cmp -0x48(%rbp),%r10 je 1480 <func0+0x1e0> mov %rax,%r10 jmpq 13d0 <func0+0x130> nopw %cs:0x0(%rax,%rax,1) mov -0x58(%rbp),%r9 cmp -0x1(%r9,%rax,1),%sil jne 1401 <func0+0x161> mov -0x4(%rcx,%r12,4),%esi add $0x1,%esi mov %esi,(%rdx) jmp 1417 <func0+0x177> nopw 0x0(%rax,%rax,1) mov -0x60(%rbp),%rdx lea 0x1(%r14),%rax add %rdx,-0x70(%rbp) add $0x1,%r13 addq $0x1,-0x68(%rbp) cmp -0x78(%rbp),%r14 je 14ae <func0+0x20e> mov %rax,%r14 jmpq 13b0 <func0+0x110> movslq %edx,%rbx mov %rax,-0x48(%rbp) mov %rbx,-0x78(%rbp) mov -0x78(%rbp),%rax imul -0x60(%rbp),%rax mov -0x48(%rbp),%rdx imul -0x88(%rbp),%rdx mov -0x80(%rbp),%rbx add %rdi,%rax add %rdx,%rax mov (%rbx,%rax,4),%eax mov -0x38(%rbp),%rbx xor %fs:0x28,%rbx jne 14f9 <func0+0x259> lea -0x28(%rbp),%rsp pop %rbx pop %r12 pop %r13 pop %r14 pop %r15 pop %rbp retq orq $0x0,-0x8(%rsp,%rsi,1) jmpq 1347 <func0+0xa7> callq 1080 <__stack_chk_fail@plt> xchg %ax,%ax
func0: endbr64 push rbp mov r10d, ecx lea ecx, [r9+1] mov r11, rsi movsxd rcx, ecx mov eax, r9d mov rbp, rsp push r15 push r14 lea r14, ds:0[rcx*4] push r13 push r12 push rbx mov rbx, rdi sub rsp, 68h mov [rbp+var_58], rdx mov [rbp+var_7C], r8d mov rdi, rsp mov rdx, fs:28h mov [rbp+var_38], rdx xor edx, edx lea edx, [r8+1] movsxd rdx, edx imul rdx, rcx lea ecx, [r10+1] movsxd rcx, ecx imul rcx, rdx lea rsi, ds:0Fh[rcx*4] mov rcx, rsi and rsi, 0FFFFFFFFFFFFF000h sub rdi, rsi and rcx, 0FFFFFFFFFFFFFFF0h cmp rsp, rdi jz short loc_1333 loc_131E: sub rsp, 1000h or [rsp+1090h+var_98], 0 cmp rsp, rdi jnz short loc_131E loc_1333: and ecx, 0FFFh sub rsp, rcx test rcx, rcx jnz loc_14EE loc_1345: shl rdx, 2 mov r12d, [rbp+var_7C] mov r9, r14 mov r8, rsp shr rdx, 2 shr r9, 2 mov rsi, rdx mov edx, r12d or edx, r10d or edx, eax js loc_14B5 mov r15d, r10d mov rdx, r9 mov [rbp+var_50], r14 xor ecx, ecx mov [rbp+var_88], r9 neg rdx sub rbx, 1 mov edi, eax mov [rbp+var_78], r15 shl rdx, 2 xor r13d, r13d mov [rbp+var_80], r10d mov [rbp+var_8C], eax mov [rbp+var_70], r8 mov [rbp+var_48], r12 mov r12, rsi mov [rbp+var_68], rsi neg r12 mov rsi, rcx nop word ptr [rax+rax+00h] loc_13B8: mov rax, [rbp+var_70] mov [rbp+var_60], rsi xor r10d, r10d lea r14, [rax+rsi*4] nop word ptr [rax+rax+00000000h] loc_13D0: test r13d, r13d lea r8, [r14+rdx] mov rsi, r14 setz r9b test r10d, r10d setz al or r9d, eax xor eax, eax jmp short loc_142E loc_13F0: test r9b, r9b jnz short loc_1432 movzx ecx, byte ptr [rbx] cmp cl, [r11+r10-1] jz short loc_1460 loc_13FF: mov r15d, [r8] mov ecx, [rsi+r12*4] cmp r15d, ecx cmovge ecx, r15d mov r15d, [rsi-4] cmp ecx, r15d cmovl ecx, r15d loc_1418: mov [rsi], ecx add r8, 4 lea rcx, [rax+1] add rsi, 4 cmp rdi, rax jz short loc_1440 mov rax, rcx loc_142E: test eax, eax jnz short loc_13F0 loc_1432: xor ecx, ecx jmp short loc_1418 loc_1440: mov rsi, [rbp+var_50] lea rax, [r10+1] add r14, rsi mov rsi, [rbp+var_48] cmp r10, rsi jz short loc_1478 mov r10, rax jmp loc_13D0 loc_1460: mov r15, [rbp+var_58] cmp cl, [r15+rax-1] jnz short loc_13FF mov ecx, [r8+r12*4-4] add ecx, 1 jmp short loc_1418 loc_1478: mov rcx, [rbp+var_68] mov rsi, [rbp+var_60] lea rax, [r13+1] add rbx, 1 add rsi, rcx mov rcx, [rbp+var_78] cmp r13, rcx jz short loc_149C mov r13, rax jmp loc_13B8 loc_149C: mov rsi, [rbp+var_68] mov r9, [rbp+var_88] mov r10d, [rbp+var_80] mov eax, [rbp+var_8C] mov r8, [rbp+var_70] loc_14B5: movsxd rdx, [rbp+var_7C] movsxd rcx, r10d cdqe imul rcx, rsi imul rdx, r9 add rax, rcx add rax, rdx mov eax, [r8+rax*4] mov rdx, [rbp+var_38] sub rdx, fs:28h jnz short loc_14F9 lea rsp, [rbp-28h] pop rbx pop r12 pop r13 pop r14 pop r15 pop rbp retn loc_14EE: or [rsp+rcx+1090h+var_1098], 0 jmp loc_1345 loc_14F9: call ___stack_chk_fail
long long func0(long long a1, long long a2, long long a3, unsigned int a4, unsigned int a5, unsigned int a6) { long long v8; // rcx unsigned int v9; // eax unsigned long long v10; // r14 long long v12; // rdx long long v13; // rcx _BYTE *v14; // rdi __int16 v15; // cx signed long long v16; // rcx void *v17; // rsp _BYTE *v18; // r8 unsigned long long v19; // r9 unsigned long long v20; // rsi _BYTE *v21; // rbx long long v22; // rdi long long v23; // r13 long long v24; // r12 long long v25; // rsi long long v26; // r10 int *v27; // r14 int *v28; // r8 int *v29; // rsi long long i; // rax int v31; // ecx _BYTE v34[4088]; // [rsp+8h] [rbp-1090h] BYREF _BYTE v35[4]; // [rsp+1008h] [rbp-90h] BYREF unsigned int v36; // [rsp+100Ch] [rbp-8Ch] unsigned long long v37; // [rsp+1010h] [rbp-88h] unsigned int v38; // [rsp+1018h] [rbp-80h] unsigned int v39; // [rsp+101Ch] [rbp-7Ch] long long v40; // [rsp+1020h] [rbp-78h] _BYTE *v41; // [rsp+1028h] [rbp-70h] unsigned long long v42; // [rsp+1030h] [rbp-68h] long long v43; // [rsp+1038h] [rbp-60h] long long v44; // [rsp+1040h] [rbp-58h] unsigned long long v45; // [rsp+1048h] [rbp-50h] long long v46; // [rsp+1050h] [rbp-48h] unsigned long long v47; // [rsp+1060h] [rbp-38h] v8 = (int)(a6 + 1); v9 = a6; v10 = 4 * v8; v44 = a3; v39 = a5; v47 = __readfsqword(0x28u); v12 = v8 * (int)(a5 + 1); v13 = 4 * v12 * (int)(a4 + 1) + 15; v14 = &v35[-(v13 & 0xFFFFFFFFFFFFF000LL)]; v15 = v13 & 0xFFF0; if ( v35 != v14 ) { while ( v34 != v14 ) ; } v16 = v15 & 0xFFF; v17 = alloca(v16); if ( v16 ) *(_QWORD *)&v34[v16 - 8] = *(_QWORD *)&v34[v16 - 8]; v18 = v34; v19 = v10 >> 2; v20 = (unsigned long long)(4 * v12) >> 2; if ( ((v9 | a4 | v39) & 0x80000000) == 0 ) { v45 = v10; v37 = v10 >> 2; v21 = (_BYTE *)(a1 - 1); v22 = v9; v40 = a4; v23 = 0LL; v38 = a4; v36 = v9; v41 = v34; v46 = v39; v42 = (unsigned long long)(4 * v12) >> 2; v24 = -(long long)v20; v25 = 0LL; while ( 1 ) { v43 = v25; v26 = 0LL; v27 = (int *)&v41[4 * v25]; while ( 1 ) { v28 = &v27[-v19]; v29 = v27; for ( i = 0LL; ; ++i ) { if ( !(_DWORD)i || (_DWORD)v26 == 0 || (_DWORD)v23 == 0 ) { v31 = 0; } else if ( *v21 == *(_BYTE *)(a2 + v26 - 1) && *v21 == *(_BYTE *)(v44 + i - 1) ) { v31 = v28[v24 - 1] + 1; } else { v31 = v29[v24]; if ( *v28 >= v31 ) v31 = *v28; if ( v31 < *(v29 - 1) ) v31 = *(v29 - 1); } *v29 = v31; ++v28; ++v29; if ( v22 == i ) break; } v27 = (int *)((char *)v27 + v45); if ( v26 == v46 ) break; ++v26; } ++v21; v25 = v42 + v43; if ( v23 == v40 ) break; ++v23; } v20 = v42; v19 = v37; a4 = v38; v9 = v36; v18 = v41; } return *(unsigned int *)&v18[4 * v19 * (int)v39 + 4 * v20 * (int)a4 + 4 * (int)v9]; }
func0: ENDBR64 PUSH RBP MOV R10D,ECX LEA ECX,[R9 + 0x1] MOV R11,RSI MOVSXD RCX,ECX MOV EAX,R9D MOV RBP,RSP PUSH R15 PUSH R14 LEA R14,[RCX*0x4] PUSH R13 PUSH R12 PUSH RBX MOV RBX,RDI SUB RSP,0x68 MOV qword ptr [RBP + -0x58],RDX MOV dword ptr [RBP + -0x7c],R8D MOV RDI,RSP MOV RDX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x38],RDX XOR EDX,EDX LEA EDX,[R8 + 0x1] MOVSXD RDX,EDX IMUL RDX,RCX LEA ECX,[R10 + 0x1] MOVSXD RCX,ECX IMUL RCX,RDX LEA RSI,[0xf + RCX*0x4] MOV RCX,RSI AND RSI,-0x1000 SUB RDI,RSI AND RCX,-0x10 CMP RSP,RDI JZ 0x00101333 LAB_0010131e: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RDI JNZ 0x0010131e LAB_00101333: AND ECX,0xfff SUB RSP,RCX TEST RCX,RCX JNZ 0x001014ee LAB_00101345: SHL RDX,0x2 MOV R12D,dword ptr [RBP + -0x7c] MOV R9,R14 MOV R8,RSP SHR RDX,0x2 SHR R9,0x2 MOV RSI,RDX MOV EDX,R12D OR EDX,R10D OR EDX,EAX JS 0x001014b5 MOV R15D,R10D MOV RDX,R9 MOV qword ptr [RBP + -0x50],R14 XOR ECX,ECX MOV qword ptr [RBP + -0x88],R9 NEG RDX SUB RBX,0x1 MOV EDI,EAX MOV qword ptr [RBP + -0x78],R15 SHL RDX,0x2 XOR R13D,R13D MOV dword ptr [RBP + -0x80],R10D MOV dword ptr [RBP + -0x8c],EAX MOV qword ptr [RBP + -0x70],R8 MOV qword ptr [RBP + -0x48],R12 MOV R12,RSI MOV qword ptr [RBP + -0x68],RSI NEG R12 MOV RSI,RCX NOP word ptr [RAX + RAX*0x1] LAB_001013b8: MOV RAX,qword ptr [RBP + -0x70] MOV qword ptr [RBP + -0x60],RSI XOR R10D,R10D LEA R14,[RAX + RSI*0x4] NOP word ptr [RAX + RAX*0x1] LAB_001013d0: TEST R13D,R13D LEA R8,[R14 + RDX*0x1] MOV RSI,R14 SETZ R9B TEST R10D,R10D SETZ AL OR R9D,EAX XOR EAX,EAX JMP 0x0010142e LAB_001013f0: TEST R9B,R9B JNZ 0x00101432 MOVZX ECX,byte ptr [RBX] CMP CL,byte ptr [R11 + R10*0x1 + -0x1] JZ 0x00101460 LAB_001013ff: MOV R15D,dword ptr [R8] MOV ECX,dword ptr [RSI + R12*0x4] CMP R15D,ECX CMOVGE ECX,R15D MOV R15D,dword ptr [RSI + -0x4] CMP ECX,R15D CMOVL ECX,R15D LAB_00101418: MOV dword ptr [RSI],ECX ADD R8,0x4 LEA RCX,[RAX + 0x1] ADD RSI,0x4 CMP RDI,RAX JZ 0x00101440 MOV RAX,RCX LAB_0010142e: TEST EAX,EAX JNZ 0x001013f0 LAB_00101432: XOR ECX,ECX JMP 0x00101418 LAB_00101440: MOV RSI,qword ptr [RBP + -0x50] LEA RAX,[R10 + 0x1] ADD R14,RSI MOV RSI,qword ptr [RBP + -0x48] CMP R10,RSI JZ 0x00101478 MOV R10,RAX JMP 0x001013d0 LAB_00101460: MOV R15,qword ptr [RBP + -0x58] CMP CL,byte ptr [R15 + RAX*0x1 + -0x1] JNZ 0x001013ff MOV ECX,dword ptr [R8 + R12*0x4 + -0x4] ADD ECX,0x1 JMP 0x00101418 LAB_00101478: MOV RCX,qword ptr [RBP + -0x68] MOV RSI,qword ptr [RBP + -0x60] LEA RAX,[R13 + 0x1] ADD RBX,0x1 ADD RSI,RCX MOV RCX,qword ptr [RBP + -0x78] CMP R13,RCX JZ 0x0010149c MOV R13,RAX JMP 0x001013b8 LAB_0010149c: MOV RSI,qword ptr [RBP + -0x68] MOV R9,qword ptr [RBP + -0x88] MOV R10D,dword ptr [RBP + -0x80] MOV EAX,dword ptr [RBP + -0x8c] MOV R8,qword ptr [RBP + -0x70] LAB_001014b5: MOVSXD RDX,dword ptr [RBP + -0x7c] MOVSXD RCX,R10D CDQE IMUL RCX,RSI IMUL RDX,R9 ADD RAX,RCX ADD RAX,RDX MOV EAX,dword ptr [R8 + RAX*0x4] MOV RDX,qword ptr [RBP + -0x38] SUB RDX,qword ptr FS:[0x28] JNZ 0x001014f9 LEA RSP,[RBP + -0x28] POP RBX POP R12 POP R13 POP R14 POP R15 POP RBP RET LAB_001014ee: OR qword ptr [RSP + RCX*0x1 + -0x8],0x0 JMP 0x00101345 LAB_001014f9: CALL 0x00101080
int4 func0(long param_1,long param_2,long param_3,uint param_4,uint param_5,uint param_6) { long lVar1; int *puVar2; long lVar3; ulong uVar4; int iVar5; ulong uVar6; ulong uVar7; char *pcVar8; int *puVar9; int *piVar11; int *piVar12; ulong uVar13; ulong uVar14; ulong uVar15; int *piVar16; long in_FS_OFFSET; bool bVar17; int auStack_98 [4]; uint local_94; ulong local_90; uint local_88; uint local_84; ulong local_80; int *local_78; ulong local_70; long local_68; long local_60; long local_58; ulong local_50; long local_40; int *puVar10; uVar6 = (ulong)(int)(param_6 + 1); puVar9 = auStack_98; local_40 = *(long *)(in_FS_OFFSET + 0x28); uVar7 = (long)(int)(param_5 + 1) * uVar6; uVar13 = (long)(int)(param_4 + 1) * uVar7 * 4 + 0xf; puVar10 = auStack_98; puVar2 = auStack_98; while (puVar10 != auStack_98 + -(uVar13 & 0xfffffffffffff000)) { puVar9 = puVar2 + -0x1000; *(int8 *)(puVar2 + -8) = *(int8 *)(puVar2 + -8); puVar10 = puVar2 + -0x1000; puVar2 = puVar2 + -0x1000; } uVar13 = (ulong)((uint)uVar13 & 0xff0); lVar1 = -uVar13; if (uVar13 != 0) { *(int8 *)(puVar9 + -8) = *(int8 *)(puVar9 + -8); } uVar7 = uVar7 & 0x3fffffffffffffff; uVar13 = uVar6 & 0x3fffffffffffffff; if (-1 < (int)(param_5 | param_4 | param_6)) { local_80 = (ulong)param_4; pcVar8 = (char *)(param_1 + -1); lVar3 = 0; uVar15 = 0; do { local_68 = lVar3; piVar16 = (int *)(puVar9 + local_68 * 4 + lVar1); uVar14 = 0; do { piVar12 = piVar16 + -uVar13; uVar4 = 0; piVar11 = piVar16; do { if (((int)uVar4 == 0) || ((int)uVar15 == 0 || (int)uVar14 == 0)) { iVar5 = 0; } else if ((*pcVar8 == *(char *)(param_2 + -1 + uVar14)) && (*pcVar8 == *(char *)(param_3 + -1 + uVar4))) { iVar5 = piVar12[-1 - uVar7] + 1; } else { iVar5 = piVar11[-uVar7]; if (piVar11[-uVar7] <= *piVar12) { iVar5 = *piVar12; } if (iVar5 < piVar11[-1]) { iVar5 = piVar11[-1]; } } *piVar11 = iVar5; piVar12 = piVar12 + 1; piVar11 = piVar11 + 1; bVar17 = param_6 != uVar4; uVar4 = uVar4 + 1; } while (bVar17); piVar16 = piVar16 + uVar6; bVar17 = uVar14 != param_5; uVar14 = uVar14 + 1; } while (bVar17); pcVar8 = pcVar8 + 1; bVar17 = uVar15 != local_80; lVar3 = local_68 + uVar7; uVar15 = uVar15 + 1; local_94 = param_6; local_90 = uVar13; local_88 = param_4; local_78 = puVar9 + lVar1; local_70 = uVar7; local_58 = uVar6 * 4; local_50 = (ulong)param_5; } while (bVar17); } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return *(int4 *) (puVar9 + ((long)(int)param_6 + (long)(int)param_4 * uVar7 + (long)(int)param_5 * uVar13 ) * 4 + lVar1); } /* WARNING: Subroutine does not return */ *(int8 *)(puVar9 + lVar1 + -8) = 0x1014fe; local_84 = param_5; local_60 = param_3; __stack_chk_fail(); }
6,884
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <regex.h>
void func0(const char *str1, char *result) { regex_t regex; regmatch_t matches[3]; // We need 3 groups: the complete match, \1, and \2 char buffer[1024]; regcomp(&regex, "([a-z])([A-Z])", REG_EXTENDED); strcpy(buffer, str1); const char *cursor = buffer; result[0] = '\0'; while (regexec(&regex, cursor, 3, matches, 0) == 0) { strncat(result, cursor, matches[1].rm_eo); strcat(result, " "); cursor += matches[2].rm_so; } strcat(result, cursor); regfree(&regex); }
int main() { char result[1024]; func0("Python", result); assert(strcmp(result, "Python") == 0); func0("PythonProgrammingExamples", result); assert(strcmp(result, "Python Programming Examples") == 0); func0("GetReadyToBeCodingFreak", result); assert(strcmp(result, "Get Ready To Be Coding Freak") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x490,%rsp mov %rdi,-0x488(%rbp) mov %rsi,-0x490(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea -0x470(%rbp),%rax mov $0x1,%edx lea 0xd80(%rip),%rsi mov %rax,%rdi callq 1120 <regcomp@plt> mov -0x488(%rbp),%rdx lea -0x410(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 10d0 <strcpy@plt> lea -0x410(%rbp),%rax mov %rax,-0x478(%rbp) mov -0x490(%rbp),%rax movb $0x0,(%rax) jmp 1328 <func0+0xdf> mov -0x424(%rbp),%eax movslq %eax,%rdx mov -0x478(%rbp),%rcx mov -0x490(%rbp),%rax mov %rcx,%rsi mov %rax,%rdi callq 1110 <strncat@plt> mov -0x490(%rbp),%rax mov $0xffffffffffffffff,%rcx mov %rax,%rdx mov $0x0,%eax mov %rdx,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rax),%rdx mov -0x490(%rbp),%rax add %rdx,%rax movw $0x20,(%rax) mov -0x420(%rbp),%eax cltq add %rax,-0x478(%rbp) lea -0x430(%rbp),%rdx mov -0x478(%rbp),%rsi lea -0x470(%rbp),%rax mov $0x0,%r8d mov %rdx,%rcx mov $0x3,%edx mov %rax,%rdi callq 1140 <regexec@plt> test %eax,%eax je 12c3 <func0+0x7a> mov -0x478(%rbp),%rdx mov -0x490(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1150 <strcat@plt> lea -0x470(%rbp),%rax mov %rax,%rdi callq 10e0 <regfree@plt> mov -0x8(%rbp),%rax xor %fs:0x28,%rax je 1398 <func0+0x14f> callq 10f0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 490h mov [rbp+src], rdi mov [rbp+s], rsi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea rax, [rbp+preg] mov edx, 1; cflags lea rcx, pattern; "([a-z])([A-Z])" mov rsi, rcx; pattern mov rdi, rax; preg call _regcomp mov rdx, [rbp+src] lea rax, [rbp+dest] mov rsi, rdx; src mov rdi, rax; dest call _strcpy lea rax, [rbp+dest] mov [rbp+string], rax mov rax, [rbp+s] mov byte ptr [rax], 0 jmp short loc_1338 loc_12E6: mov eax, [rbp+var_424] movsxd rdx, eax; n mov rcx, [rbp+string] mov rax, [rbp+s] mov rsi, rcx; src mov rdi, rax; dest call _strncat mov rax, [rbp+s] mov rdi, rax; s call _strlen mov rdx, rax mov rax, [rbp+s] add rax, rdx mov word ptr [rax], 20h ; ' ' mov eax, [rbp+var_420] cdqe add [rbp+string], rax loc_1338: lea rdx, [rbp+pmatch] mov rsi, [rbp+string]; string lea rax, [rbp+preg] mov r8d, 0; eflags mov rcx, rdx; pmatch mov edx, 3; nmatch mov rdi, rax; preg call _regexec test eax, eax jz loc_12E6 mov rdx, [rbp+string] mov rax, [rbp+s] mov rsi, rdx; src mov rdi, rax; dest call _strcat lea rax, [rbp+preg] mov rdi, rax; preg call _regfree nop mov rax, [rbp+var_8] sub rax, fs:28h jz short locret_13A8 call ___stack_chk_fail locret_13A8: leave retn
unsigned long long func0(const char *a1, char *a2) { int i; // eax const char *string; // [rsp+18h] [rbp-478h] regex_t preg; // [rsp+20h] [rbp-470h] BYREF regmatch_t pmatch; // [rsp+60h] [rbp-430h] BYREF int v7; // [rsp+6Ch] [rbp-424h] int v8; // [rsp+70h] [rbp-420h] char dest[1032]; // [rsp+80h] [rbp-410h] BYREF unsigned long long v10; // [rsp+488h] [rbp-8h] v10 = __readfsqword(0x28u); regcomp(&preg, "([a-z])([A-Z])", 1); strcpy(dest, a1); string = dest; *a2 = 0; for ( i = regexec(&preg, dest, 3uLL, &pmatch, 0); !i; i = regexec(&preg, string, 3uLL, &pmatch, 0) ) { strncat(a2, string, v7); *(_WORD *)&a2[strlen(a2)] = 32; string += v8; } strcat(a2, string); regfree(&preg); return v10 - __readfsqword(0x28u); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x490 MOV qword ptr [RBP + -0x488],RDI MOV qword ptr [RBP + -0x490],RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX LEA RAX,[RBP + -0x470] MOV EDX,0x1 LEA RCX,[0x102008] MOV RSI,RCX MOV RDI,RAX CALL 0x00101140 MOV RDX,qword ptr [RBP + -0x488] LEA RAX,[RBP + -0x410] MOV RSI,RDX MOV RDI,RAX CALL 0x001010e0 LEA RAX,[RBP + -0x410] MOV qword ptr [RBP + -0x478],RAX MOV RAX,qword ptr [RBP + -0x490] MOV byte ptr [RAX],0x0 JMP 0x00101338 LAB_001012e6: MOV EAX,dword ptr [RBP + -0x424] MOVSXD RDX,EAX MOV RCX,qword ptr [RBP + -0x478] MOV RAX,qword ptr [RBP + -0x490] MOV RSI,RCX MOV RDI,RAX CALL 0x00101130 MOV RAX,qword ptr [RBP + -0x490] MOV RDI,RAX CALL 0x00101100 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x490] ADD RAX,RDX MOV word ptr [RAX],0x20 MOV EAX,dword ptr [RBP + -0x420] CDQE ADD qword ptr [RBP + -0x478],RAX LAB_00101338: LEA RDX,[RBP + -0x430] MOV RSI,qword ptr [RBP + -0x478] LEA RAX,[RBP + -0x470] MOV R8D,0x0 MOV RCX,RDX MOV EDX,0x3 MOV RDI,RAX CALL 0x00101160 TEST EAX,EAX JZ 0x001012e6 MOV RDX,qword ptr [RBP + -0x478] MOV RAX,qword ptr [RBP + -0x490] MOV RSI,RDX MOV RDI,RAX CALL 0x00101170 LEA RAX,[RBP + -0x470] MOV RDI,RAX CALL 0x001010f0 NOP MOV RAX,qword ptr [RBP + -0x8] SUB RAX,qword ptr FS:[0x28] JZ 0x001013a8 CALL 0x00101110 LAB_001013a8: LEAVE RET
void func0(char *param_1,char *param_2) { int iVar1; size_t sVar2; long in_FS_OFFSET; char *local_480; regex_t local_478; regmatch_t local_438; int local_42c; int local_428; char local_418 [1032]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); regcomp(&local_478,"([a-z])([A-Z])",1); strcpy(local_418,param_1); local_480 = local_418; *param_2 = '\0'; while( true ) { iVar1 = regexec(&local_478,local_480,3,&local_438,0); if (iVar1 != 0) break; strncat(param_2,local_480,(long)local_42c); sVar2 = strlen(param_2); (param_2 + sVar2)[0] = ' '; (param_2 + sVar2)[1] = '\0'; local_480 = local_480 + local_428; } strcat(param_2,local_480); regfree(&local_478); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return; }
6,885
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <regex.h>
void func0(const char *str1, char *result) { regex_t regex; regmatch_t matches[3]; // We need 3 groups: the complete match, \1, and \2 char buffer[1024]; regcomp(&regex, "([a-z])([A-Z])", REG_EXTENDED); strcpy(buffer, str1); const char *cursor = buffer; result[0] = '\0'; while (regexec(&regex, cursor, 3, matches, 0) == 0) { strncat(result, cursor, matches[1].rm_eo); strcat(result, " "); cursor += matches[2].rm_so; } strcat(result, cursor); regfree(&regex); }
int main() { char result[1024]; func0("Python", result); assert(strcmp(result, "Python") == 0); func0("PythonProgrammingExamples", result); assert(strcmp(result, "Python Programming Examples") == 0); func0("GetReadyToBeCodingFreak", result); assert(strcmp(result, "Get Ready To Be Coding Freak") == 0); return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx sub $0x470,%rsp mov %rdi,%r12 mov %rsi,%rbp mov %fs:0x28,%rax mov %rax,0x468(%rsp) xor %eax,%eax mov %rsp,%rdi mov $0x1,%edx lea 0xda4(%rip),%rsi callq 1100 <regcomp@plt> lea 0x60(%rsp),%rbx mov $0x400,%edx mov %r12,%rsi mov %rbx,%rdi callq 1120 <__strcpy_chk@plt> movb $0x0,0x0(%rbp) lea 0x40(%rsp),%r12 mov %rsp,%rdi mov $0x0,%r8d mov %r12,%rcx mov $0x3,%edx mov %rbx,%rsi callq 1110 <regexec@plt> test %eax,%eax jne 12d5 <func0+0xac> movslq 0x4c(%rsp),%rdx mov %rbx,%rsi mov %rbp,%rdi callq 10f0 <strncat@plt> mov $0xffffffffffffffff,%rcx mov $0x0,%eax mov %rbp,%rdi repnz scas %es:(%rdi),%al not %rcx movw $0x20,-0x1(%rbp,%rcx,1) movslq 0x50(%rsp),%rax add %rax,%rbx jmp 1283 <func0+0x5a> mov %rbx,%rsi mov %rbp,%rdi callq 1130 <strcat@plt> mov %rsp,%rdi callq 10c0 <regfree@plt> mov 0x468(%rsp),%rax xor %fs:0x28,%rax jne 1307 <func0+0xde> add $0x470,%rsp pop %rbx pop %rbp pop %r12 retq callq 10d0 <__stack_chk_fail@plt>
func0: endbr64 push r12 push rbp push rbx sub rsp, 470h mov r12, rdi mov rbp, rsi mov rax, fs:28h mov [rsp+488h+var_20], rax xor eax, eax mov rdi, rsp mov edx, 1 lea rsi, aAZAZ; "([a-z])([A-Z])" call _regcomp lea rbx, [rsp+488h+var_428] mov edx, 400h mov rsi, r12 mov rdi, rbx call ___strcpy_chk mov byte ptr [rbp+0], 0 lea r12, [rsp+488h+var_448] jmp short loc_12EC loc_12C5: movsxd rdx, [rsp+488h+var_43C] mov rsi, rbx mov rdi, rbp call _strncat mov rdi, rbp call _strlen mov word ptr [rbp+rax+0], 20h ; ' ' movsxd rax, [rsp+488h+var_438] add rbx, rax loc_12EC: mov rdi, rsp mov r8d, 0 mov rcx, r12 mov edx, 3 mov rsi, rbx call _regexec test eax, eax jz short loc_12C5 mov rsi, rbx mov rdi, rbp call _strcat mov rdi, rsp call _regfree mov rax, [rsp+488h+var_20] sub rax, fs:28h jnz short loc_133B add rsp, 470h pop rbx pop rbp pop r12 retn loc_133B: call ___stack_chk_fail
unsigned long long func0(long long a1, _BYTE *a2) { _BYTE *v2; // rbx _BYTE v4[64]; // [rsp+0h] [rbp-488h] BYREF _BYTE v5[12]; // [rsp+40h] [rbp-448h] BYREF int v6; // [rsp+4Ch] [rbp-43Ch] int v7; // [rsp+50h] [rbp-438h] _BYTE v8[1032]; // [rsp+60h] [rbp-428h] BYREF unsigned long long v9; // [rsp+468h] [rbp-20h] v9 = __readfsqword(0x28u); regcomp(v4, "([a-z])([A-Z])", 1LL); v2 = v8; __strcpy_chk(v8, a1, 1024LL); *a2 = 0; while ( !(unsigned int)regexec(v4, v2, 3LL, v5, 0LL) ) { strncat(a2, v2, v6); *(_WORD *)&a2[strlen(a2)] = 32; v2 += v7; } strcat(a2, v2); regfree(v4); return v9 - __readfsqword(0x28u); }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x470 MOV R12,RDI MOV RBP,RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x468],RAX XOR EAX,EAX MOV RDI,RSP MOV EDX,0x1 LEA RSI,[0x102004] CALL 0x00101130 LEA RBX,[RSP + 0x60] MOV EDX,0x400 MOV RSI,R12 MOV RDI,RBX CALL 0x00101160 MOV byte ptr [RBP],0x0 LEA R12,[RSP + 0x40] JMP 0x001012ec LAB_001012c5: MOVSXD RDX,dword ptr [RSP + 0x4c] MOV RSI,RBX MOV RDI,RBP CALL 0x00101120 MOV RDI,RBP CALL 0x001010f0 MOV word ptr [RBP + RAX*0x1],0x20 MOVSXD RAX,dword ptr [RSP + 0x50] ADD RBX,RAX LAB_001012ec: MOV RDI,RSP MOV R8D,0x0 MOV RCX,R12 MOV EDX,0x3 MOV RSI,RBX CALL 0x00101150 TEST EAX,EAX JZ 0x001012c5 MOV RSI,RBX MOV RDI,RBP CALL 0x00101170 MOV RDI,RSP CALL 0x001010e0 MOV RAX,qword ptr [RSP + 0x468] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010133b ADD RSP,0x470 POP RBX POP RBP POP R12 RET LAB_0010133b: CALL 0x00101100
void func0(int8 param_1,char *param_2) { int iVar1; size_t sVar2; char *__string; long in_FS_OFFSET; regex_t rStack_488; regmatch_t local_448; int local_43c; int local_438; char local_428 [1032]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); regcomp(&rStack_488,"([a-z])([A-Z])",1); __string = local_428; __strcpy_chk(__string,param_1,0x400); *param_2 = '\0'; while( true ) { iVar1 = regexec(&rStack_488,__string,3,&local_448,0); if (iVar1 != 0) break; strncat(param_2,__string,(long)local_43c); sVar2 = strlen(param_2); (param_2 + sVar2)[0] = ' '; (param_2 + sVar2)[1] = '\0'; __string = __string + local_438; } strcat(param_2,__string); regfree(&rStack_488); if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
6,886
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <regex.h>
void func0(const char *str1, char *result) { regex_t regex; regmatch_t matches[3]; // We need 3 groups: the complete match, \1, and \2 char buffer[1024]; regcomp(&regex, "([a-z])([A-Z])", REG_EXTENDED); strcpy(buffer, str1); const char *cursor = buffer; result[0] = '\0'; while (regexec(&regex, cursor, 3, matches, 0) == 0) { strncat(result, cursor, matches[1].rm_eo); strcat(result, " "); cursor += matches[2].rm_so; } strcat(result, cursor); regfree(&regex); }
int main() { char result[1024]; func0("Python", result); assert(strcmp(result, "Python") == 0); func0("PythonProgrammingExamples", result); assert(strcmp(result, "Python Programming Examples") == 0); func0("GetReadyToBeCodingFreak", result); assert(strcmp(result, "Get Ready To Be Coding Freak") == 0); return 0; }
O2
c
func0: endbr64 push %r14 mov $0x1,%edx mov %rdi,%r14 push %r13 push %r12 mov %rsi,%r12 lea 0xc18(%rip),%rsi push %rbp push %rbx sub $0x470,%rsp mov %fs:0x28,%rax mov %rax,0x468(%rsp) xor %eax,%eax mov %rsp,%r13 lea 0x60(%rsp),%rbp lea 0x40(%rsp),%rbx mov %r13,%rdi callq 1120 <regcomp@plt> mov $0x400,%edx mov %r14,%rsi mov %rbp,%rdi callq 1140 <__strcpy_chk@plt> movb $0x0,(%r12) jmp 1462 <func0+0x92> nopl 0x0(%rax) movslq 0x4c(%rsp),%rdx mov %rbp,%rsi mov %r12,%rdi callq 1110 <strncat@plt> mov %r12,%rdi callq 10e0 <strlen@plt> mov $0x20,%edx mov %dx,(%r12,%rax,1) movslq 0x50(%rsp),%rax add %rax,%rbp xor %r8d,%r8d mov %rbx,%rcx mov $0x3,%edx mov %rbp,%rsi mov %r13,%rdi callq 1130 <regexec@plt> test %eax,%eax je 1438 <func0+0x68> mov %rbp,%rsi mov %r12,%rdi callq 1150 <strcat@plt> mov %r13,%rdi callq 10d0 <regfree@plt> mov 0x468(%rsp),%rax xor %fs:0x28,%rax jne 14b2 <func0+0xe2> add $0x470,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq callq 10f0 <__stack_chk_fail@plt> nopw 0x0(%rax,%rax,1)
func0: endbr64 push r14 mov edx, 1 mov r14, rdi push r13 push r12 mov r12, rsi lea rsi, aAZAZ; "([a-z])([A-Z])" push rbp push rbx sub rsp, 470h mov rax, fs:28h mov [rsp+498h+var_30], rax xor eax, eax mov r13, rsp lea rbp, [rsp+498h+var_438] lea rbx, [rsp+498h+var_458] mov rdi, r13 call _regcomp mov edx, 400h mov rsi, r14 mov rdi, rbp call ___strcpy_chk mov byte ptr [r12], 0 jmp short loc_1462 loc_1438: movsxd rdx, [rsp+498h+var_44C] mov rsi, rbp mov rdi, r12 call _strncat mov rdi, r12 call _strlen mov edx, 20h ; ' ' mov [r12+rax], dx movsxd rax, [rsp+498h+var_448] add rbp, rax loc_1462: xor r8d, r8d mov rcx, rbx mov edx, 3 mov rsi, rbp mov rdi, r13 call _regexec test eax, eax jz short loc_1438 mov rdi, r12 mov rsi, rbp call _strcat mov rdi, r13 call _regfree mov rax, [rsp+498h+var_30] sub rax, fs:28h jnz short loc_14B2 add rsp, 470h pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_14B2: call ___stack_chk_fail
unsigned long long func0(long long a1, _BYTE *a2) { _BYTE *v2; // rbp _BYTE v4[64]; // [rsp+0h] [rbp-498h] BYREF _BYTE v5[12]; // [rsp+40h] [rbp-458h] BYREF int v6; // [rsp+4Ch] [rbp-44Ch] int v7; // [rsp+50h] [rbp-448h] _BYTE v8[1032]; // [rsp+60h] [rbp-438h] BYREF unsigned long long v9; // [rsp+468h] [rbp-30h] v9 = __readfsqword(0x28u); v2 = v8; regcomp(v4, "([a-z])([A-Z])", 1LL); __strcpy_chk(v8, a1, 1024LL); *a2 = 0; while ( !(unsigned int)regexec(v4, v2, 3LL, v5, 0LL) ) { strncat(a2, v2, v6); *(_WORD *)&a2[strlen(a2)] = 32; v2 += v7; } strcat(a2, v2); regfree(v4); return v9 - __readfsqword(0x28u); }
func0: ENDBR64 PUSH R14 MOV EDX,0x1 MOV R14,RDI PUSH R13 PUSH R12 MOV R12,RSI LEA RSI,[0x102004] PUSH RBP PUSH RBX SUB RSP,0x470 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x468],RAX XOR EAX,EAX MOV R13,RSP LEA RBP,[RSP + 0x60] LEA RBX,[RSP + 0x40] MOV RDI,R13 CALL 0x00101120 MOV EDX,0x400 MOV RSI,R14 MOV RDI,RBP CALL 0x00101140 MOV byte ptr [R12],0x0 JMP 0x00101462 LAB_00101438: MOVSXD RDX,dword ptr [RSP + 0x4c] MOV RSI,RBP MOV RDI,R12 CALL 0x00101110 MOV RDI,R12 CALL 0x001010e0 MOV EDX,0x20 MOV word ptr [R12 + RAX*0x1],DX MOVSXD RAX,dword ptr [RSP + 0x50] ADD RBP,RAX LAB_00101462: XOR R8D,R8D MOV RCX,RBX MOV EDX,0x3 MOV RSI,RBP MOV RDI,R13 CALL 0x00101130 TEST EAX,EAX JZ 0x00101438 MOV RDI,R12 MOV RSI,RBP CALL 0x00101150 MOV RDI,R13 CALL 0x001010d0 MOV RAX,qword ptr [RSP + 0x468] SUB RAX,qword ptr FS:[0x28] JNZ 0x001014b2 ADD RSP,0x470 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_001014b2: CALL 0x001010f0
void func0(int8 param_1,char *param_2) { int iVar1; size_t sVar2; char *__string; long in_FS_OFFSET; regex_t rStack_498; regmatch_t local_458; int local_44c; int local_448; char local_438 [1032]; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); __string = local_438; regcomp(&rStack_498,"([a-z])([A-Z])",1); __strcpy_chk(__string,param_1,0x400); *param_2 = '\0'; while( true ) { iVar1 = regexec(&rStack_498,__string,3,&local_458,0); if (iVar1 != 0) break; strncat(param_2,__string,(long)local_44c); sVar2 = strlen(param_2); (param_2 + sVar2)[0] = ' '; (param_2 + sVar2)[1] = '\0'; __string = __string + local_448; } strcat(param_2,__string); regfree(&rStack_498); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
6,887
func0
#include <stdio.h> #include <string.h> #include <assert.h> #include <regex.h>
void func0(const char *str1, char *result) { regex_t regex; regmatch_t matches[3]; // We need 3 groups: the complete match, \1, and \2 char buffer[1024]; regcomp(&regex, "([a-z])([A-Z])", REG_EXTENDED); strcpy(buffer, str1); const char *cursor = buffer; result[0] = '\0'; while (regexec(&regex, cursor, 3, matches, 0) == 0) { strncat(result, cursor, matches[1].rm_eo); strcat(result, " "); cursor += matches[2].rm_so; } strcat(result, cursor); regfree(&regex); }
int main() { char result[1024]; func0("Python", result); assert(strcmp(result, "Python") == 0); func0("PythonProgrammingExamples", result); assert(strcmp(result, "Python Programming Examples") == 0); func0("GetReadyToBeCodingFreak", result); assert(strcmp(result, "Get Ready To Be Coding Freak") == 0); return 0; }
O3
c
func0: endbr64 push %r14 mov $0x1,%edx mov %rdi,%r14 push %r13 push %r12 mov %rsi,%r12 lea 0xc18(%rip),%rsi push %rbp push %rbx sub $0x470,%rsp mov %fs:0x28,%rax mov %rax,0x468(%rsp) xor %eax,%eax mov %rsp,%r13 lea 0x60(%rsp),%rbp lea 0x40(%rsp),%rbx mov %r13,%rdi callq 1120 <regcomp@plt> mov $0x400,%edx mov %r14,%rsi mov %rbp,%rdi callq 1140 <__strcpy_chk@plt> movb $0x0,(%r12) jmp 1462 <func0+0x92> nopl 0x0(%rax) movslq 0x4c(%rsp),%rdx mov %rbp,%rsi mov %r12,%rdi callq 1110 <strncat@plt> mov %r12,%rdi callq 10e0 <strlen@plt> mov $0x20,%edx mov %dx,(%r12,%rax,1) movslq 0x50(%rsp),%rax add %rax,%rbp xor %r8d,%r8d mov %rbx,%rcx mov $0x3,%edx mov %rbp,%rsi mov %r13,%rdi callq 1130 <regexec@plt> test %eax,%eax je 1438 <func0+0x68> mov %rbp,%rsi mov %r12,%rdi callq 1150 <strcat@plt> mov %r13,%rdi callq 10d0 <regfree@plt> mov 0x468(%rsp),%rax xor %fs:0x28,%rax jne 14b2 <func0+0xe2> add $0x470,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq callq 10f0 <__stack_chk_fail@plt> nopw 0x0(%rax,%rax,1)
func0: endbr64 push r13 mov edx, 1; cflags mov r13, rdi push r12 push rbp mov rbp, rsi lea rsi, pattern; "([a-z])([A-Z])" push rbx sub rsp, 478h mov rax, fs:28h mov [rsp+498h+var_30], rax xor eax, eax mov r12, rsp lea rbx, [rsp+498h+src] mov rdi, r12; preg call _regcomp mov rsi, r13 mov edx, 400h mov rdi, rbx call ___strcpy_chk lea r13, [rsp+498h+pmatch] mov byte ptr [rbp+0], 0 jmp short loc_1452 loc_1428: movsxd rdx, [rsp+498h+var_44C]; n mov rsi, rbx; src mov rdi, rbp; dest call _strncat mov rdi, rbp; s call _strlen mov edx, 20h ; ' ' mov [rbp+rax+0], dx movsxd rax, [rsp+498h+var_448] add rbx, rax loc_1452: xor r8d, r8d; eflags mov rcx, r13; pmatch mov edx, 3; nmatch mov rsi, rbx; string mov rdi, r12; preg call _regexec test eax, eax jz short loc_1428 mov rdi, rbp; dest mov rsi, rbx; src call _strcat mov rdi, r12; preg call _regfree mov rax, [rsp+498h+var_30] sub rax, fs:28h jnz short loc_14A0 add rsp, 478h pop rbx pop rbp pop r12 pop r13 retn loc_14A0: call ___stack_chk_fail
unsigned long long func0(long long a1, char *a2) { char *v2; // rbx regex_t v4; // [rsp+0h] [rbp-498h] BYREF regmatch_t pmatch; // [rsp+40h] [rbp-458h] BYREF int v6; // [rsp+4Ch] [rbp-44Ch] int v7; // [rsp+50h] [rbp-448h] char src[1032]; // [rsp+60h] [rbp-438h] BYREF unsigned long long v9; // [rsp+468h] [rbp-30h] v9 = __readfsqword(0x28u); v2 = src; regcomp(&v4, "([a-z])([A-Z])", 1); __strcpy_chk(src, a1, 1024LL); *a2 = 0; while ( !regexec(&v4, v2, 3uLL, &pmatch, 0) ) { strncat(a2, v2, v6); *(_WORD *)&a2[strlen(a2)] = 32; v2 += v7; } strcat(a2, v2); regfree(&v4); return v9 - __readfsqword(0x28u); }
func0: ENDBR64 PUSH R13 MOV EDX,0x1 MOV R13,RDI PUSH R12 PUSH RBP MOV RBP,RSI LEA RSI,[0x102004] PUSH RBX SUB RSP,0x478 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x468],RAX XOR EAX,EAX MOV R12,RSP LEA RBX,[RSP + 0x60] MOV RDI,R12 CALL 0x00101120 MOV RSI,R13 MOV EDX,0x400 MOV RDI,RBX CALL 0x00101140 LEA R13,[RSP + 0x40] MOV byte ptr [RBP],0x0 JMP 0x00101452 LAB_00101428: MOVSXD RDX,dword ptr [RSP + 0x4c] MOV RSI,RBX MOV RDI,RBP CALL 0x00101110 MOV RDI,RBP CALL 0x001010e0 MOV EDX,0x20 MOV word ptr [RBP + RAX*0x1],DX MOVSXD RAX,dword ptr [RSP + 0x50] ADD RBX,RAX LAB_00101452: XOR R8D,R8D MOV RCX,R13 MOV EDX,0x3 MOV RSI,RBX MOV RDI,R12 CALL 0x00101130 TEST EAX,EAX JZ 0x00101428 MOV RDI,RBP MOV RSI,RBX CALL 0x00101150 MOV RDI,R12 CALL 0x001010d0 MOV RAX,qword ptr [RSP + 0x468] SUB RAX,qword ptr FS:[0x28] JNZ 0x001014a0 ADD RSP,0x478 POP RBX POP RBP POP R12 POP R13 RET LAB_001014a0: CALL 0x001010f0
void func0(int8 param_1,char *param_2) { int iVar1; size_t sVar2; char *__string; long in_FS_OFFSET; regex_t rStack_498; regmatch_t local_458; int local_44c; int local_448; char local_438 [1032]; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); __string = local_438; regcomp(&rStack_498,"([a-z])([A-Z])",1); __strcpy_chk(__string,param_1,0x400); *param_2 = '\0'; while( true ) { iVar1 = regexec(&rStack_498,__string,3,&local_458,0); if (iVar1 != 0) break; strncat(param_2,__string,(long)local_44c); sVar2 = strlen(param_2); (param_2 + sVar2)[0] = ' '; (param_2 + sVar2)[1] = '\0'; __string = __string + local_448; } strcat(param_2,__string); regfree(&rStack_498); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
6,888
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> int int_cmp(const void* a, const void* b) { int int_a = *((int*)a); int int_b = *((int*)b); return int_a - int_b; }
int* func0(const char* nums_str[], int size) { int *result = malloc(size * sizeof(int)); if (!result) { perror("Malloc failed"); exit(EXIT_FAILURE); } for (int i = 0; i < size; i++) { result[i] = atoi(nums_str[i]); } qsort(result, size, sizeof(int), int_cmp); return result; }
int main() { const char* test1[] = {"4","12","45","7","0","100","200","-12","-500"}; int expected1[] = {-500, -12, 0, 4, 7, 12, 45, 100, 200}; int *sorted1 = func0(test1, 9); for (int i = 0; i < 9; i++) { assert(sorted1[i] == expected1[i]); } free(sorted1); const char* test2[] = {"2","3","8","4","7","9","8","2","6","5","1","6","1","2","3","4","6","9","1","2"}; int expected2[] = {1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8, 9, 9}; int *sorted2 = func0(test2, 20); for (int i = 0; i < 20; i++) { assert(sorted2[i] == expected2[i]); } free(sorted2); const char* test3[] = {"1","3","5","7","1", "3","13", "15", "17","5", "7","9","1", "11"}; int expected3[] = {1, 1, 1, 3, 3, 5, 5, 7, 7, 9, 11, 13, 15, 17}; int *sorted3 = func0(test3, 14); for (int i = 0; i < 14; i++) { assert(sorted3[i] == expected3[i]); } free(sorted3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x28,%rsp mov %rdi,-0x28(%rbp) mov %esi,-0x2c(%rbp) mov -0x2c(%rbp),%eax cltq shl $0x2,%rax mov %rax,%rdi callq 1100 <malloc@plt> mov %rax,-0x18(%rbp) cmpq $0x0,-0x18(%rbp) jne 1299 <func0+0x46> lea 0xd7e(%rip),%rdi callq 1110 <perror@plt> mov $0x1,%edi callq 1130 <exit@plt> movl $0x0,-0x1c(%rbp) jmp 12dd <func0+0x8a> mov -0x1c(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0x1c(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x18(%rbp),%rdx lea (%rcx,%rdx,1),%rbx mov %rax,%rdi callq 1120 <atoi@plt> mov %eax,(%rbx) addl $0x1,-0x1c(%rbp) mov -0x1c(%rbp),%eax cmp -0x2c(%rbp),%eax jl 12a2 <func0+0x4f> mov -0x2c(%rbp),%eax movslq %eax,%rsi mov -0x18(%rbp),%rax lea -0xcd(%rip),%rcx mov $0x4,%edx mov %rax,%rdi callq 10d0 <qsort@plt> mov -0x18(%rbp),%rax add $0x28,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 28h 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+base], rax cmp [rbp+base], 0 jnz short loc_129C lea rax, s; "Malloc failed" mov rdi, rax; s call _perror mov edi, 1; status call _exit loc_129C: mov [rbp+var_1C], 0 jmp short loc_12E0 loc_12A5: mov eax, [rbp+var_1C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_28] add rax, rdx mov rax, [rax] mov edx, [rbp+var_1C] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+base] lea rbx, [rcx+rdx] mov rdi, rax; nptr call _atoi mov [rbx], eax add [rbp+var_1C], 1 loc_12E0: mov eax, [rbp+var_1C] cmp eax, [rbp+var_2C] jl short loc_12A5 mov eax, [rbp+var_2C] movsxd rsi, eax; nmemb mov rax, [rbp+base] lea rdx, int_cmp mov rcx, rdx; compar mov edx, 4; size mov rdi, rax; base call _qsort mov rax, [rbp+base] mov rbx, [rbp+var_8] leave retn
_DWORD * func0(long long a1, int a2) { int i; // [rsp+14h] [rbp-1Ch] _DWORD *base; // [rsp+18h] [rbp-18h] base = malloc(4LL * a2); if ( !base ) { perror("Malloc failed"); exit(1); } for ( i = 0; i < a2; ++i ) base[i] = atoi(*(const char **)(8LL * i + a1)); qsort(base, a2, 4uLL, int_cmp); return base; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x28 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 0x00101100 MOV qword ptr [RBP + -0x18],RAX CMP qword ptr [RBP + -0x18],0x0 JNZ 0x0010129c LEA RAX,[0x102004] MOV RDI,RAX CALL 0x00101110 MOV EDI,0x1 CALL 0x00101130 LAB_0010129c: MOV dword ptr [RBP + -0x1c],0x0 JMP 0x001012e0 LAB_001012a5: MOV EAX,dword ptr [RBP + -0x1c] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0x1c] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x18] LEA RBX,[RCX + RDX*0x1] MOV RDI,RAX CALL 0x00101120 MOV dword ptr [RBX],EAX ADD dword ptr [RBP + -0x1c],0x1 LAB_001012e0: MOV EAX,dword ptr [RBP + -0x1c] CMP EAX,dword ptr [RBP + -0x2c] JL 0x001012a5 MOV EAX,dword ptr [RBP + -0x2c] MOVSXD RSI,EAX MOV RAX,qword ptr [RBP + -0x18] LEA RDX,[0x101229] MOV RCX,RDX MOV EDX,0x4 MOV RDI,RAX CALL 0x001010d0 MOV RAX,qword ptr [RBP + -0x18] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1,int param_2) { int iVar1; void *__base; int local_24; __base = malloc((long)param_2 << 2); if (__base == (void *)0x0) { perror("Malloc failed"); /* WARNING: Subroutine does not return */ exit(1); } for (local_24 = 0; local_24 < param_2; local_24 = local_24 + 1) { iVar1 = atoi(*(char **)(param_1 + (long)local_24 * 8)); *(int *)((long)local_24 * 4 + (long)__base) = iVar1; } qsort(__base,(long)param_2,4,int_cmp); return __base; }
6,889
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> int int_cmp(const void* a, const void* b) { int int_a = *((int*)a); int int_b = *((int*)b); return int_a - int_b; }
int* func0(const char* nums_str[], int size) { int *result = malloc(size * sizeof(int)); if (!result) { perror("Malloc failed"); exit(EXIT_FAILURE); } for (int i = 0; i < size; i++) { result[i] = atoi(nums_str[i]); } qsort(result, size, sizeof(int), int_cmp); return result; }
int main() { const char* test1[] = {"4","12","45","7","0","100","200","-12","-500"}; int expected1[] = {-500, -12, 0, 4, 7, 12, 45, 100, 200}; int *sorted1 = func0(test1, 9); for (int i = 0; i < 9; i++) { assert(sorted1[i] == expected1[i]); } free(sorted1); const char* test2[] = {"2","3","8","4","7","9","8","2","6","5","1","6","1","2","3","4","6","9","1","2"}; int expected2[] = {1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8, 9, 9}; int *sorted2 = func0(test2, 20); for (int i = 0; i < 20; i++) { assert(sorted2[i] == expected2[i]); } free(sorted2); const char* test3[] = {"1","3","5","7","1", "3","13", "15", "17","5", "7","9","1", "11"}; int expected3[] = {1, 1, 1, 3, 3, 5, 5, 7, 7, 9, 11, 13, 15, 17}; int *sorted3 = func0(test3, 14); for (int i = 0; i < 14; i++) { assert(sorted3[i] == expected3[i]); } free(sorted3); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%r12 mov %esi,%r15d movslq %esi,%r14 lea 0x0(,%r14,4),%rdi callq 1110 <malloc@plt> test %rax,%rax je 12bc <func0+0x8a> mov %rax,%rbp lea -0x1(%r15),%r13d mov $0x0,%ebx test %r15d,%r15d jle 1293 <func0+0x61> mov (%r12,%rbx,8),%rdi mov $0xa,%edx mov $0x0,%esi callq 1100 <strtol@plt> mov %eax,0x0(%rbp,%rbx,4) mov %rbx,%rax add $0x1,%rbx cmp %r13,%rax jne 1270 <func0+0x3e> lea -0x71(%rip),%rcx mov $0x4,%edx mov %r14,%rsi mov %rbp,%rdi callq 10d0 <qsort@plt> mov %rbp,%rax add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq lea 0xd41(%rip),%rdi callq 1120 <perror@plt> mov $0x1,%edi callq 1130 <exit@plt>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 8 mov r12, rdi mov r15d, esi movsxd r14, esi lea rdi, ds:0[r14*4] call _malloc test rax, rax jz short loc_12B8 mov rbp, rax mov r13d, r15d mov ebx, 0 test r15d, r15d jle short loc_128F loc_126F: mov rdi, [r12+rbx*8] mov edx, 0Ah mov esi, 0 call _strtol mov [rbp+rbx*4+0], eax add rbx, 1 cmp rbx, r13 jnz short loc_126F loc_128F: lea rcx, int_cmp mov edx, 4 mov rsi, r14 mov rdi, rbp call _qsort mov rax, rbp add rsp, 8 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_12B8: lea rdi, aMallocFailed; "Malloc failed" call _perror mov edi, 1 call _exit
long long func0(long long a1, int a2) { long long v2; // rax long long v3; // rbp long long v4; // rbx v2 = malloc(4LL * a2); if ( !v2 ) { perror("Malloc failed"); exit(1LL); } v3 = v2; v4 = 0LL; if ( a2 > 0 ) { do { *(_DWORD *)(v3 + 4 * v4) = strtol(*(_QWORD *)(a1 + 8 * v4), 0LL, 10LL); ++v4; } while ( v4 != a2 ); } qsort(v3, a2, 4LL, int_cmp); return v3; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R12,RDI MOV R15D,ESI MOVSXD R14,ESI LEA RDI,[R14*0x4] CALL 0x00101110 TEST RAX,RAX JZ 0x001012b8 MOV RBP,RAX MOV R13D,R15D MOV EBX,0x0 TEST R15D,R15D JLE 0x0010128f LAB_0010126f: MOV RDI,qword ptr [R12 + RBX*0x8] MOV EDX,0xa MOV ESI,0x0 CALL 0x00101100 MOV dword ptr [RBP + RBX*0x4],EAX ADD RBX,0x1 CMP RBX,R13 JNZ 0x0010126f LAB_0010128f: LEA RCX,[0x101229] MOV EDX,0x4 MOV RSI,R14 MOV RDI,RBP CALL 0x001010d0 MOV RAX,RBP ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001012b8: LEA RDI,[0x102004] CALL 0x00101120 MOV EDI,0x1 CALL 0x00101130
void * func0(long param_1,uint param_2) { void *__base; long lVar1; ulong uVar2; __base = malloc((long)(int)param_2 * 4); if (__base != (void *)0x0) { uVar2 = 0; if (0 < (int)param_2) { do { lVar1 = strtol(*(char **)(param_1 + uVar2 * 8),(char **)0x0,10); *(int *)((long)__base + uVar2 * 4) = (int)lVar1; uVar2 = uVar2 + 1; } while (uVar2 != param_2); } qsort(__base,(long)(int)param_2,4,int_cmp); return __base; } perror("Malloc failed"); /* WARNING: Subroutine does not return */ exit(1); }
6,890
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> int int_cmp(const void* a, const void* b) { int int_a = *((int*)a); int int_b = *((int*)b); return int_a - int_b; }
int* func0(const char* nums_str[], int size) { int *result = malloc(size * sizeof(int)); if (!result) { perror("Malloc failed"); exit(EXIT_FAILURE); } for (int i = 0; i < size; i++) { result[i] = atoi(nums_str[i]); } qsort(result, size, sizeof(int), int_cmp); return result; }
int main() { const char* test1[] = {"4","12","45","7","0","100","200","-12","-500"}; int expected1[] = {-500, -12, 0, 4, 7, 12, 45, 100, 200}; int *sorted1 = func0(test1, 9); for (int i = 0; i < 9; i++) { assert(sorted1[i] == expected1[i]); } free(sorted1); const char* test2[] = {"2","3","8","4","7","9","8","2","6","5","1","6","1","2","3","4","6","9","1","2"}; int expected2[] = {1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8, 9, 9}; int *sorted2 = func0(test2, 20); for (int i = 0; i < 20; i++) { assert(sorted2[i] == expected2[i]); } free(sorted2); const char* test3[] = {"1","3","5","7","1", "3","13", "15", "17","5", "7","9","1", "11"}; int expected3[] = {1, 1, 1, 3, 3, 5, 5, 7, 7, 9, 11, 13, 15, 17}; int *sorted3 = func0(test3, 14); for (int i = 0; i < 14; i++) { assert(sorted3[i] == expected3[i]); } free(sorted3); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 movslq %esi,%r14 push %r13 push %r12 push %rbp mov %rdi,%rbp lea 0x0(,%r14,4),%rdi push %rbx sub $0x8,%rsp callq 1110 <malloc@plt> test %rax,%rax je 175a <func0+0x8a> mov %rax,%r12 lea -0x1(%r14),%r13d xor %ebx,%ebx test %r14d,%r14d jle 1731 <func0+0x61> nopl 0x0(%rax,%rax,1) mov 0x0(%rbp,%rbx,8),%rdi mov $0xa,%edx xor %esi,%esi callq 1100 <strtol@plt> mov %eax,(%r12,%rbx,4) mov %rbx,%rax add $0x1,%rbx cmp %rax,%r13 jne 1710 <func0+0x40> mov %r14,%rsi mov %r12,%rdi mov $0x4,%edx lea -0x83(%rip),%rcx callq 10d0 <qsort@plt> add $0x8,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq lea 0x8a3(%rip),%rdi callq 1120 <perror@plt> mov $0x1,%edi callq 1130 <exit@plt>
func0: endbr64 push r14 push r13 mov r13, rdi push r12 push rbp movsxd rbp, esi push rbx lea rdi, ds:0[rbp*4] call _malloc test rax, rax jz short loc_1741 mov r12, rax xor ebx, ebx test ebp, ebp jle short loc_171E nop dword ptr [rax] loc_1700: mov rdi, [r13+rbx*8+0] mov edx, 0Ah xor esi, esi call _strtol mov [r12+rbx*4], eax add rbx, 1 cmp rbx, rbp jnz short loc_1700 loc_171E: mov rsi, rbp mov rdi, r12 mov edx, 4 lea rcx, int_cmp call _qsort pop rbx mov rax, r12 pop rbp pop r12 pop r13 pop r14 retn loc_1741: lea rdi, aMallocFailed; "Malloc failed" call _perror mov edi, 1 call _exit
long long func0(long long a1, int a2) { long long v2; // rax long long v3; // r12 long long v4; // rbx v2 = malloc(4LL * a2); if ( !v2 ) { perror("Malloc failed"); exit(1LL); } v3 = v2; v4 = 0LL; if ( a2 > 0 ) { do { *(_DWORD *)(v3 + 4 * v4) = strtol(*(_QWORD *)(a1 + 8 * v4), 0LL, 10LL); ++v4; } while ( v4 != a2 ); } qsort(v3, a2, 4LL, int_cmp); return v3; }
func0: ENDBR64 PUSH R14 PUSH R13 MOV R13,RDI PUSH R12 PUSH RBP MOVSXD RBP,ESI PUSH RBX LEA RDI,[RBP*0x4] CALL 0x00101110 TEST RAX,RAX JZ 0x00101741 MOV R12,RAX XOR EBX,EBX TEST EBP,EBP JLE 0x0010171e NOP dword ptr [RAX] LAB_00101700: MOV RDI,qword ptr [R13 + RBX*0x8] MOV EDX,0xa XOR ESI,ESI CALL 0x00101100 MOV dword ptr [R12 + RBX*0x4],EAX ADD RBX,0x1 CMP RBX,RBP JNZ 0x00101700 LAB_0010171e: MOV RSI,RBP MOV RDI,R12 MOV EDX,0x4 LEA RCX,[0x1016c0] CALL 0x001010d0 POP RBX MOV RAX,R12 POP RBP POP R12 POP R13 POP R14 RET LAB_00101741: LEA RDI,[0x102004] CALL 0x00101120 MOV EDI,0x1 CALL 0x00101130
void * func0(long param_1,int param_2) { void *__base; long lVar1; size_t sVar2; size_t __nmemb; __nmemb = (size_t)param_2; __base = malloc(__nmemb * 4); if (__base != (void *)0x0) { sVar2 = 0; if (0 < param_2) { do { lVar1 = strtol(*(char **)(param_1 + sVar2 * 8),(char **)0x0,10); *(int *)((long)__base + sVar2 * 4) = (int)lVar1; sVar2 = sVar2 + 1; } while (sVar2 != __nmemb); } qsort(__base,__nmemb,4,int_cmp); return __base; } perror("Malloc failed"); /* WARNING: Subroutine does not return */ exit(1); }
6,891
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> int int_cmp(const void* a, const void* b) { int int_a = *((int*)a); int int_b = *((int*)b); return int_a - int_b; }
int* func0(const char* nums_str[], int size) { int *result = malloc(size * sizeof(int)); if (!result) { perror("Malloc failed"); exit(EXIT_FAILURE); } for (int i = 0; i < size; i++) { result[i] = atoi(nums_str[i]); } qsort(result, size, sizeof(int), int_cmp); return result; }
int main() { const char* test1[] = {"4","12","45","7","0","100","200","-12","-500"}; int expected1[] = {-500, -12, 0, 4, 7, 12, 45, 100, 200}; int *sorted1 = func0(test1, 9); for (int i = 0; i < 9; i++) { assert(sorted1[i] == expected1[i]); } free(sorted1); const char* test2[] = {"2","3","8","4","7","9","8","2","6","5","1","6","1","2","3","4","6","9","1","2"}; int expected2[] = {1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8, 9, 9}; int *sorted2 = func0(test2, 20); for (int i = 0; i < 20; i++) { assert(sorted2[i] == expected2[i]); } free(sorted2); const char* test3[] = {"1","3","5","7","1", "3","13", "15", "17","5", "7","9","1", "11"}; int expected3[] = {1, 1, 1, 3, 3, 5, 5, 7, 7, 9, 11, 13, 15, 17}; int *sorted3 = func0(test3, 14); for (int i = 0; i < 14; i++) { assert(sorted3[i] == expected3[i]); } free(sorted3); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 movslq %esi,%r14 push %r13 push %r12 push %rbp mov %rdi,%rbp lea 0x0(,%r14,4),%rdi push %rbx sub $0x8,%rsp callq 1110 <malloc@plt> test %rax,%rax je 17ca <func0+0x8a> mov %rax,%r12 lea -0x1(%r14),%r13d xor %ebx,%ebx test %r14d,%r14d jle 17a1 <func0+0x61> nopl 0x0(%rax,%rax,1) mov 0x0(%rbp,%rbx,8),%rdi mov $0xa,%edx xor %esi,%esi callq 1100 <strtol@plt> mov %eax,(%r12,%rbx,4) mov %rbx,%rax add $0x1,%rbx cmp %rax,%r13 jne 1780 <func0+0x40> mov %r14,%rsi mov %r12,%rdi mov $0x4,%edx lea -0x83(%rip),%rcx callq 10d0 <qsort@plt> add $0x8,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq lea 0x833(%rip),%rdi callq 1120 <perror@plt> mov $0x1,%edi callq 1130 <exit@plt>
func0: endbr64 push r14 push r13 movsxd r13, esi push r12 push rbp push rbx mov rbx, rdi lea rdi, ds:0[r13*4]; size call _malloc test rax, rax jz func0_cold mov r12, rax test r13d, r13d jle short loc_17AF mov rbp, rax lea r14, [rbx+r13*8] nop word ptr [rax+rax+00000000h] loc_1790: mov rdi, [rbx]; nptr mov edx, 0Ah; base xor esi, esi; endptr add rbx, 8 add rbp, 4 call _strtol mov [rbp-4], eax cmp rbx, r14 jnz short loc_1790 loc_17AF: mov rsi, r13; nmemb mov rdi, r12; base mov edx, 4; size lea rcx, int_cmp; compar call _qsort pop rbx mov rax, r12 pop rbp pop r12 pop r13 pop r14 retn
void * func0(const char **a1, int a2) { const char **v2; // rbx void *v3; // rax void *v4; // r12 _DWORD *v5; // rbp const char **v6; // r14 const char *v7; // rdi v2 = a1; v3 = malloc(4LL * a2); if ( !v3 ) func0_cold(); v4 = v3; if ( a2 > 0 ) { v5 = v3; v6 = &a1[a2]; do { v7 = *v2++; *v5++ = strtol(v7, 0LL, 10); } while ( v2 != v6 ); } qsort(v4, a2, 4uLL, int_cmp); return v4; }
func0: ENDBR64 PUSH R14 PUSH R13 MOVSXD R13,ESI PUSH R12 PUSH RBP PUSH RBX MOV RBX,RDI LEA RDI,[R13*0x4] CALL 0x00101110 TEST RAX,RAX JZ 0x00101140 MOV R12,RAX TEST R13D,R13D JLE 0x001017af MOV RBP,RAX LEA R14,[RBX + R13*0x8] NOP word ptr [RAX + RAX*0x1] LAB_00101790: MOV RDI,qword ptr [RBX] MOV EDX,0xa XOR ESI,ESI ADD RBX,0x8 ADD RBP,0x4 CALL 0x00101100 MOV dword ptr [RBP + -0x4],EAX CMP RBX,R14 JNZ 0x00101790 LAB_001017af: MOV RSI,R13 MOV RDI,R12 MOV EDX,0x4 LEA RCX,[0x101740] CALL 0x001010d0 POP RBX MOV RAX,R12 POP RBP POP R12 POP R13 POP R14 RET
int4 * func0(int8 *param_1,int param_2) { int8 *puVar1; char *__nptr; int4 *__base; long lVar2; int4 *puVar3; size_t __nmemb; __nmemb = (size_t)param_2; __base = (int4 *)malloc(__nmemb * 4); if (__base != (int4 *)0x0) { if (0 < param_2) { puVar1 = param_1 + __nmemb; puVar3 = __base; do { __nptr = (char *)*param_1; param_1 = param_1 + 1; lVar2 = strtol(__nptr,(char **)0x0,10); *puVar3 = (int)lVar2; puVar3 = puVar3 + 1; } while (param_1 != puVar1); } qsort(__base,__nmemb,4,int_cmp); return __base; } perror("Malloc failed"); /* WARNING: Subroutine does not return */ exit(1); }
6,892
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h>
int* func0(int* test_list, int list_size, int* test_tup, int tup_size, int* new_size) { *new_size = list_size + tup_size; int* result = malloc(*new_size * sizeof(int)); for (int i = 0; i < list_size; i++) { result[i] = test_list[i]; } for (int i = 0; i < tup_size; i++) { result[list_size + i] = test_tup[i]; } return result; }
int main() { int test_list1[] = {5, 6, 7}; int test_tup1[] = {9, 10}; int new_size1; int* result1 = func0(test_list1, 3, test_tup1, 2, &new_size1); assert(new_size1 == 5 && result1[0] == 5 && result1[1] == 6 && result1[2] == 7 && result1[3] == 9 && result1[4] == 10); free(result1); int test_list2[] = {6, 7, 8}; int test_tup2[] = {10, 11}; int new_size2; int* result2 = func0(test_list2, 3, test_tup2, 2, &new_size2); assert(new_size2 == 5 && result2[0] == 6 && result2[1] == 7 && result2[2] == 8 && result2[3] == 10 && result2[4] == 11); free(result2); int test_list3[] = {7, 8, 9}; int test_tup3[] = {11, 12}; int new_size3; int* result3 = func0(test_list3, 3, test_tup3, 2, &new_size3); assert(new_size3 == 5 && result3[0] == 7 && result3[1] == 8 && result3[2] == 9 && result3[3] == 11 && result3[4] == 12); free(result3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %rdx,-0x28(%rbp) mov %ecx,-0x20(%rbp) mov %r8,-0x30(%rbp) mov -0x1c(%rbp),%edx mov -0x20(%rbp),%eax add %eax,%edx mov -0x30(%rbp),%rax mov %edx,(%rax) mov -0x30(%rbp),%rax mov (%rax),%eax cltq shl $0x2,%rax mov %rax,%rdi callq 10b0 <malloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0x10(%rbp) jmp 1227 <func0+0x7e> mov -0x10(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0x10(%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,-0x10(%rbp) mov -0x10(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11f6 <func0+0x4d> movl $0x0,-0xc(%rbp) jmp 126e <func0+0xc5> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov -0x1c(%rbp),%ecx mov -0xc(%rbp),%edx add %ecx,%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 -0x20(%rbp),%eax jl 1238 <func0+0x8f> mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_28], rdx mov [rbp+var_20], ecx mov [rbp+var_30], r8 mov edx, [rbp+var_1C] mov eax, [rbp+var_20] add edx, eax mov rax, [rbp+var_30] mov [rax], edx mov rax, [rbp+var_30] mov eax, [rax] cdqe shl rax, 2 mov rdi, rax; size call _malloc mov [rbp+var_8], rax mov [rbp+var_10], 0 jmp short loc_1227 loc_11F6: mov eax, [rbp+var_10] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rbp+var_10] 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_10], 1 loc_1227: mov eax, [rbp+var_10] cmp eax, [rbp+var_1C] jl short loc_11F6 mov [rbp+var_C], 0 jmp short loc_126E loc_1238: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rdx mov ecx, [rbp+var_1C] mov edx, [rbp+var_C] add edx, ecx 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_126E: mov eax, [rbp+var_C] cmp eax, [rbp+var_20] jl short loc_1238 mov rax, [rbp+var_8] leave retn
_DWORD * func0(long long a1, int a2, long long a3, int a4, int *a5) { int i; // [rsp+20h] [rbp-10h] int j; // [rsp+24h] [rbp-Ch] _DWORD *v10; // [rsp+28h] [rbp-8h] *a5 = a4 + a2; v10 = malloc(4LL * *a5); for ( i = 0; i < a2; ++i ) v10[i] = *(_DWORD *)(4LL * i + a1); for ( j = 0; j < a4; ++j ) v10[a2 + j] = *(_DWORD *)(4LL * j + a3); return v10; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x20],ECX MOV qword ptr [RBP + -0x30],R8 MOV EDX,dword ptr [RBP + -0x1c] MOV EAX,dword ptr [RBP + -0x20] ADD EDX,EAX MOV RAX,qword ptr [RBP + -0x30] MOV dword ptr [RAX],EDX MOV RAX,qword ptr [RBP + -0x30] MOV EAX,dword ptr [RAX] CDQE SHL RAX,0x2 MOV RDI,RAX CALL 0x001010b0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0x10],0x0 JMP 0x00101227 LAB_001011f6: MOV EAX,dword ptr [RBP + -0x10] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0x10] 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 + -0x10],0x1 LAB_00101227: MOV EAX,dword ptr [RBP + -0x10] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011f6 MOV dword ptr [RBP + -0xc],0x0 JMP 0x0010126e LAB_00101238: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV ECX,dword ptr [RBP + -0x1c] MOV EDX,dword ptr [RBP + -0xc] ADD EDX,ECX 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_0010126e: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x20] JL 0x00101238 MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1,int param_2,long param_3,int param_4,int *param_5) { void *pvVar1; int4 local_18; int4 local_14; *param_5 = param_2 + param_4; pvVar1 = malloc((long)*param_5 << 2); for (local_18 = 0; local_18 < param_2; local_18 = local_18 + 1) { *(int4 *)((long)pvVar1 + (long)local_18 * 4) = *(int4 *)(param_1 + (long)local_18 * 4); } for (local_14 = 0; local_14 < param_4; local_14 = local_14 + 1) { *(int4 *)((long)pvVar1 + (long)(local_14 + param_2) * 4) = *(int4 *)(param_3 + (long)local_14 * 4); } return pvVar1; }
6,893
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h>
int* func0(int* test_list, int list_size, int* test_tup, int tup_size, int* new_size) { *new_size = list_size + tup_size; int* result = malloc(*new_size * sizeof(int)); for (int i = 0; i < list_size; i++) { result[i] = test_list[i]; } for (int i = 0; i < tup_size; i++) { result[list_size + i] = test_tup[i]; } return result; }
int main() { int test_list1[] = {5, 6, 7}; int test_tup1[] = {9, 10}; int new_size1; int* result1 = func0(test_list1, 3, test_tup1, 2, &new_size1); assert(new_size1 == 5 && result1[0] == 5 && result1[1] == 6 && result1[2] == 7 && result1[3] == 9 && result1[4] == 10); free(result1); int test_list2[] = {6, 7, 8}; int test_tup2[] = {10, 11}; int new_size2; int* result2 = func0(test_list2, 3, test_tup2, 2, &new_size2); assert(new_size2 == 5 && result2[0] == 6 && result2[1] == 7 && result2[2] == 8 && result2[3] == 10 && result2[4] == 11); free(result2); int test_list3[] = {7, 8, 9}; int test_tup3[] = {11, 12}; int new_size3; int* result3 = func0(test_list3, 3, test_tup3, 2, &new_size3); assert(new_size3 == 5 && result3[0] == 7 && result3[1] == 8 && result3[2] == 9 && result3[3] == 11 && result3[4] == 12); free(result3); return 0; }
O1
c
func0: endbr64 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbp mov %esi,%r12d mov %rdx,%rbx mov %ecx,%r13d lea (%rsi,%rcx,1),%edi mov %edi,(%r8) movslq %edi,%rdi shl $0x2,%rdi callq 10b0 <malloc@plt> test %r12d,%r12d jle 11f7 <func0+0x4e> lea -0x1(%r12),%esi mov $0x0,%edx mov 0x0(%rbp,%rdx,4),%ecx mov %ecx,(%rax,%rdx,4) mov %rdx,%rcx add $0x1,%rdx cmp %rsi,%rcx jne 11e4 <func0+0x3b> test %r13d,%r13d jle 121e <func0+0x75> lea -0x1(%r13),%edi movslq %r12d,%r12 lea (%rax,%r12,4),%rsi mov $0x0,%edx mov (%rbx,%rdx,4),%ecx mov %ecx,(%rsi,%rdx,4) mov %rdx,%rcx add $0x1,%rdx cmp %rcx,%rdi jne 120c <func0+0x63> add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov r12, rdi mov r13d, esi mov rbp, rdx mov ebx, ecx lea edi, [rsi+rcx] mov [r8], edi movsxd rdi, edi shl rdi, 2 call _malloc test r13d, r13d jle short loc_11F1 mov esi, r13d mov edx, 0 loc_11E1: mov ecx, [r12+rdx*4] mov [rax+rdx*4], ecx add rdx, 1 cmp rdx, rsi jnz short loc_11E1 loc_11F1: test ebx, ebx jle short loc_1213 mov ebx, ebx movsxd r13, r13d lea rsi, [rax+r13*4] mov edx, 0 loc_1203: mov ecx, [rbp+rdx*4+0] mov [rsi+rdx*4], ecx add rdx, 1 cmp rdx, rbx jnz short loc_1203 loc_1213: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
long long func0(long long a1, int a2, long long a3, int a4, _DWORD *a5) { long long result; // rax long long i; // rdx long long v9; // rdx *a5 = a2 + a4; result = malloc(4LL * (a2 + a4)); if ( a2 > 0 ) { for ( i = 0LL; i != a2; ++i ) *(_DWORD *)(result + 4 * i) = *(_DWORD *)(a1 + 4 * i); } if ( a4 > 0 ) { v9 = 0LL; do { *(_DWORD *)(result + 4LL * a2 + 4 * v9) = *(_DWORD *)(a3 + 4 * v9); ++v9; } while ( v9 != a4 ); } return result; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R12,RDI MOV R13D,ESI MOV RBP,RDX MOV EBX,ECX LEA EDI,[RSI + RCX*0x1] MOV dword ptr [R8],EDI MOVSXD RDI,EDI SHL RDI,0x2 CALL 0x001010b0 TEST R13D,R13D JLE 0x001011f1 MOV ESI,R13D MOV EDX,0x0 LAB_001011e1: MOV ECX,dword ptr [R12 + RDX*0x4] MOV dword ptr [RAX + RDX*0x4],ECX ADD RDX,0x1 CMP RDX,RSI JNZ 0x001011e1 LAB_001011f1: TEST EBX,EBX JLE 0x00101213 MOV EBX,EBX MOVSXD R13,R13D LEA RSI,[RAX + R13*0x4] MOV EDX,0x0 LAB_00101203: MOV ECX,dword ptr [RBP + RDX*0x4] MOV dword ptr [RSI + RDX*0x4],ECX ADD RDX,0x1 CMP RDX,RBX JNZ 0x00101203 LAB_00101213: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
void func0(long param_1,uint param_2,long param_3,uint param_4,int *param_5) { void *pvVar1; ulong uVar2; *param_5 = param_2 + param_4; pvVar1 = malloc((long)(int)(param_2 + param_4) << 2); if (0 < (int)param_2) { uVar2 = 0; do { *(int4 *)((long)pvVar1 + uVar2 * 4) = *(int4 *)(param_1 + uVar2 * 4); uVar2 = uVar2 + 1; } while (uVar2 != param_2); } if (0 < (int)param_4) { uVar2 = 0; do { *(int4 *)((long)pvVar1 + uVar2 * 4 + (long)(int)param_2 * 4) = *(int4 *)(param_3 + uVar2 * 4); uVar2 = uVar2 + 1; } while (uVar2 != param_4); } return; }
6,894
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h>
int* func0(int* test_list, int list_size, int* test_tup, int tup_size, int* new_size) { *new_size = list_size + tup_size; int* result = malloc(*new_size * sizeof(int)); for (int i = 0; i < list_size; i++) { result[i] = test_list[i]; } for (int i = 0; i < tup_size; i++) { result[list_size + i] = test_tup[i]; } return result; }
int main() { int test_list1[] = {5, 6, 7}; int test_tup1[] = {9, 10}; int new_size1; int* result1 = func0(test_list1, 3, test_tup1, 2, &new_size1); assert(new_size1 == 5 && result1[0] == 5 && result1[1] == 6 && result1[2] == 7 && result1[3] == 9 && result1[4] == 10); free(result1); int test_list2[] = {6, 7, 8}; int test_tup2[] = {10, 11}; int new_size2; int* result2 = func0(test_list2, 3, test_tup2, 2, &new_size2); assert(new_size2 == 5 && result2[0] == 6 && result2[1] == 7 && result2[2] == 8 && result2[3] == 10 && result2[4] == 11); free(result2); int test_list3[] = {7, 8, 9}; int test_tup3[] = {11, 12}; int new_size3; int* result3 = func0(test_list3, 3, test_tup3, 2, &new_size3); assert(new_size3 == 5 && result3[0] == 7 && result3[1] == 8 && result3[2] == 9 && result3[3] == 11 && result3[4] == 12); free(result3); return 0; }
O2
c
func0: endbr64 push %r13 mov %ecx,%r13d push %r12 movslq %esi,%r12 push %rbp mov %rdi,%rbp lea (%r12,%rcx,1),%edi push %rbx mov %rdx,%rbx sub $0x8,%rsp mov %edi,(%r8) movslq %edi,%rdi shl $0x2,%rdi callq 10b0 <malloc@plt> test %r12d,%r12d jle 1415 <func0+0x55> lea -0x1(%r12),%edx xor %edi,%edi nopl 0x0(%rax) mov 0x0(%rbp,%rdi,4),%r8d mov %r8d,(%rax,%rdi,4) mov %rdi,%r8 add $0x1,%rdi cmp %rdx,%r8 jne 1400 <func0+0x40> test %r13d,%r13d jle 143a <func0+0x7a> lea -0x1(%r13),%edi lea (%rax,%r12,4),%rdx xor %ecx,%ecx nopl 0x0(%rax) mov (%rbx,%rcx,4),%esi mov %esi,(%rdx,%rcx,4) mov %rcx,%rsi add $0x1,%rcx cmp %rsi,%rdi jne 1428 <func0+0x68> add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r14 mov r14, rdi push r13 push r12 mov r12, rdx push rbp movsxd rbp, esi lea edi, [rbp+rcx+0] push rbx mov ebx, ecx mov [r8], edi movsxd rdi, edi shl rdi, 2 call _malloc mov r13, rax test ebp, ebp jle short loc_1423 movsxd rdx, ebp mov rsi, r14 mov rdi, rax shl rdx, 2 call _memcpy loc_1423: test ebx, ebx jle short loc_143B movsxd rdx, ebx lea rdi, [r13+rbp*4+0] mov rsi, r12 shl rdx, 2 call _memcpy loc_143B: pop rbx mov rax, r13 pop rbp pop r12 pop r13 pop r14 retn
long long func0(long long a1, int a2, long long a3, int a4, _DWORD *a5) { long long v7; // rax long long v8; // r13 *a5 = a2 + a4; v7 = malloc(4LL * (a2 + a4)); v8 = v7; if ( a2 > 0 ) memcpy(v7, a1, 4LL * a2); if ( a4 > 0 ) memcpy(v8 + 4LL * a2, a3, 4LL * a4); return v8; }
func0: ENDBR64 PUSH R14 MOV R14,RDI PUSH R13 PUSH R12 MOV R12,RDX PUSH RBP MOVSXD RBP,ESI LEA EDI,[RBP + RCX*0x1] PUSH RBX MOV EBX,ECX MOV dword ptr [R8],EDI MOVSXD RDI,EDI SHL RDI,0x2 CALL 0x001010d0 MOV R13,RAX TEST EBP,EBP JLE 0x00101423 MOVSXD RDX,EBP MOV RSI,R14 MOV RDI,RAX SHL RDX,0x2 CALL 0x001010c0 LAB_00101423: TEST EBX,EBX JLE 0x0010143b MOVSXD RDX,EBX LEA RDI,[R13 + RBP*0x4] MOV RSI,R12 SHL RDX,0x2 CALL 0x001010c0 LAB_0010143b: POP RBX MOV RAX,R13 POP RBP POP R12 POP R13 POP R14 RET
void * func0(void *param_1,int param_2,void *param_3,int param_4,int *param_5) { void *__dest; *param_5 = param_2 + param_4; __dest = malloc((long)(param_2 + param_4) << 2); if (0 < param_2) { memcpy(__dest,param_1,(long)param_2 << 2); } if (0 < param_4) { memcpy((void *)((long)__dest + (long)param_2 * 4),param_3,(long)param_4 << 2); } return __dest; }
6,895
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h>
int* func0(int* test_list, int list_size, int* test_tup, int tup_size, int* new_size) { *new_size = list_size + tup_size; int* result = malloc(*new_size * sizeof(int)); for (int i = 0; i < list_size; i++) { result[i] = test_list[i]; } for (int i = 0; i < tup_size; i++) { result[list_size + i] = test_tup[i]; } return result; }
int main() { int test_list1[] = {5, 6, 7}; int test_tup1[] = {9, 10}; int new_size1; int* result1 = func0(test_list1, 3, test_tup1, 2, &new_size1); assert(new_size1 == 5 && result1[0] == 5 && result1[1] == 6 && result1[2] == 7 && result1[3] == 9 && result1[4] == 10); free(result1); int test_list2[] = {6, 7, 8}; int test_tup2[] = {10, 11}; int new_size2; int* result2 = func0(test_list2, 3, test_tup2, 2, &new_size2); assert(new_size2 == 5 && result2[0] == 6 && result2[1] == 7 && result2[2] == 8 && result2[3] == 10 && result2[4] == 11); free(result2); int test_list3[] = {7, 8, 9}; int test_tup3[] = {11, 12}; int new_size3; int* result3 = func0(test_list3, 3, test_tup3, 2, &new_size3); assert(new_size3 == 5 && result3[0] == 7 && result3[1] == 8 && result3[2] == 9 && result3[3] == 11 && result3[4] == 12); free(result3); return 0; }
O3
c
func0: endbr64 push %r14 mov %rdi,%r14 push %r13 push %r12 mov %ecx,%r12d push %rbp mov %rdx,%rbp push %rbx movslq %esi,%rbx lea (%rbx,%rcx,1),%edi mov %edi,(%r8) movslq %edi,%rdi shl $0x2,%rdi callq 10d0 <malloc@plt> mov %rax,%r13 test %ebx,%ebx jle 1427 <func0+0x47> lea -0x1(%rbx),%eax mov %r14,%rsi mov %r13,%rdi lea 0x4(,%rax,4),%rdx callq 10c0 <memcpy@plt> test %r12d,%r12d jle 1446 <func0+0x66> lea -0x1(%r12),%eax lea 0x0(%r13,%rbx,4),%rdi mov %rbp,%rsi lea 0x4(,%rax,4),%rdx callq 10c0 <memcpy@plt> pop %rbx mov %r13,%rax pop %rbp pop %r12 pop %r13 pop %r14 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 push r14 mov r14, rdi lea edi, [rsi+rcx] push r13 push r12 mov r12, rdx push rbp mov ebp, esi push rbx mov ebx, ecx mov [r8], edi movsxd rdi, edi shl rdi, 2; size call _malloc mov r13, rax test ebp, ebp jle short loc_1410 mov edx, ebp mov rsi, r14; src mov rdi, rax; dest shl rdx, 2; n call _memcpy loc_1410: test ebx, ebx jle short loc_142A movsxd rbp, ebp mov edx, ebx mov rsi, r12; src lea rdi, [r13+rbp*4+0]; dest shl rdx, 2; n call _memcpy loc_142A: pop rbx mov rax, r13 pop rbp pop r12 pop r13 pop r14 retn
char * func0(void *src, int a2, const void *a3, int a4, _DWORD *a5) { char *v7; // rax char *v8; // r13 *a5 = a2 + a4; v7 = (char *)malloc(4LL * (a2 + a4)); v8 = v7; if ( a2 > 0 ) memcpy(v7, src, 4LL * (unsigned int)a2); if ( a4 > 0 ) memcpy(&v8[4 * a2], a3, 4LL * (unsigned int)a4); return v8; }
func0: ENDBR64 PUSH R14 MOV R14,RDI LEA EDI,[RSI + RCX*0x1] PUSH R13 PUSH R12 MOV R12,RDX PUSH RBP MOV EBP,ESI PUSH RBX MOV EBX,ECX MOV dword ptr [R8],EDI MOVSXD RDI,EDI SHL RDI,0x2 CALL 0x001010d0 MOV R13,RAX TEST EBP,EBP JLE 0x00101410 MOV EDX,EBP MOV RSI,R14 MOV RDI,RAX SHL RDX,0x2 CALL 0x001010c0 LAB_00101410: TEST EBX,EBX JLE 0x0010142a MOVSXD RBP,EBP MOV EDX,EBX MOV RSI,R12 LEA RDI,[R13 + RBP*0x4] SHL RDX,0x2 CALL 0x001010c0 LAB_0010142a: POP RBX MOV RAX,R13 POP RBP POP R12 POP R13 POP R14 RET
void * func0(void *param_1,uint param_2,void *param_3,uint param_4,int *param_5) { void *__dest; *param_5 = param_2 + param_4; __dest = malloc((long)(int)(param_2 + param_4) << 2); if (0 < (int)param_2) { memcpy(__dest,param_1,(ulong)param_2 << 2); } if (0 < (int)param_4) { memcpy((void *)((long)__dest + (long)(int)param_2 * 4),param_3,(ulong)param_4 << 2); } return __dest; }
6,896
func0
#include <stdbool.h> #include <assert.h>
bool func0(int arr[], int n, int i) { if (2 * i + 2 > n) { return true; } bool left_child = (arr[i] <= arr[2 * i + 1]) && func0(arr, n, 2 * i + 1); bool right_child = (2 * i + 2 == n) || (arr[i] <= arr[2 * i + 2] && func0(arr, n, 2 * i + 2)); return left_child && right_child; }
int main() { int arr1[] = {1, 2, 3, 4, 5, 6}; int arr2[] = {2, 3, 4, 5, 10, 15}; int arr3[] = {2, 10, 4, 5, 3, 15}; assert(func0(arr1, 6, 0) == true); assert(func0(arr2, 6, 0) == true); assert(func0(arr3, 6, 0) == false); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %edx,-0x20(%rbp) mov -0x20(%rbp),%eax add $0x1,%eax add %eax,%eax cmp %eax,-0x1c(%rbp) jge 1196 <func0+0x2d> mov $0x1,%eax jmpq 128b <func0+0x122> mov -0x20(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x20(%rbp),%eax add %eax,%eax cltq add $0x1,%rax lea 0x0(,%rax,4),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jg 11f0 <func0+0x87> mov -0x20(%rbp),%eax add %eax,%eax lea 0x1(%rax),%edx mov -0x1c(%rbp),%ecx mov -0x18(%rbp),%rax mov %ecx,%esi mov %rax,%rdi callq 1169 <func0> test %al,%al je 11f0 <func0+0x87> mov $0x1,%eax jmp 11f5 <func0+0x8c> mov $0x0,%eax mov %al,-0x2(%rbp) andb $0x1,-0x2(%rbp) mov -0x20(%rbp),%eax add $0x1,%eax add %eax,%eax cmp %eax,-0x1c(%rbp) je 125d <func0+0xf4> mov -0x20(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x20(%rbp),%eax add %eax,%eax cltq add $0x2,%rax lea 0x0(,%rax,4),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jg 1264 <func0+0xfb> mov -0x20(%rbp),%eax add $0x1,%eax lea (%rax,%rax,1),%edx mov -0x1c(%rbp),%ecx mov -0x18(%rbp),%rax mov %ecx,%esi mov %rax,%rdi callq 1169 <func0> test %al,%al je 1264 <func0+0xfb> mov $0x1,%eax jmp 1269 <func0+0x100> mov $0x0,%eax mov %al,-0x1(%rbp) andb $0x1,-0x1(%rbp) cmpb $0x0,-0x2(%rbp) je 1283 <func0+0x11a> cmpb $0x0,-0x1(%rbp) je 1283 <func0+0x11a> mov $0x1,%eax jmp 1288 <func0+0x11f> mov $0x0,%eax and $0x1,%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_20], edx mov eax, [rbp+var_20] add eax, 1 add eax, eax cmp [rbp+var_1C], eax jge short loc_1196 mov eax, 1 jmp locret_128B loc_1196: mov eax, [rbp+var_20] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_20] add eax, eax cdqe add rax, 1 lea rcx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rcx mov eax, [rax] cmp edx, eax jg short loc_11F0 mov eax, [rbp+var_20] add eax, eax lea edx, [rax+1] mov ecx, [rbp+var_1C] mov rax, [rbp+var_18] mov esi, ecx mov rdi, rax call func0 test al, al jz short loc_11F0 mov eax, 1 jmp short loc_11F5 loc_11F0: mov eax, 0 loc_11F5: mov [rbp+var_2], al and [rbp+var_2], 1 mov eax, [rbp+var_20] add eax, 1 add eax, eax cmp [rbp+var_1C], eax jz short loc_125D mov eax, [rbp+var_20] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_20] add eax, eax cdqe add rax, 2 lea rcx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rcx mov eax, [rax] cmp edx, eax jg short loc_1264 mov eax, [rbp+var_20] add eax, 1 lea edx, [rax+rax] mov ecx, [rbp+var_1C] mov rax, [rbp+var_18] mov esi, ecx mov rdi, rax call func0 test al, al jz short loc_1264 loc_125D: mov eax, 1 jmp short loc_1269 loc_1264: mov eax, 0 loc_1269: mov [rbp+var_1], al and [rbp+var_1], 1 cmp [rbp+var_2], 0 jz short loc_1283 cmp [rbp+var_1], 0 jz short loc_1283 mov eax, 1 jmp short loc_1288 loc_1283: mov eax, 0 loc_1288: and eax, 1 locret_128B: leave retn
long long func0(long long a1, unsigned int a2, int a3) { bool v4; // al bool v5; // al bool v8; // [rsp+1Eh] [rbp-2h] if ( (int)a2 < 2 * (a3 + 1) ) return 1LL; v4 = *(_DWORD *)(4LL * a3 + a1) <= *(_DWORD *)(4 * (2 * a3 + 1LL) + a1) && (unsigned __int8)func0(a1, a2, (unsigned int)(2 * a3 + 1)); v8 = v4; v5 = a2 == 2 * (a3 + 1) || *(_DWORD *)(4LL * a3 + a1) <= *(_DWORD *)(4 * (2 * a3 + 2LL) + a1) && (unsigned __int8)func0(a1, a2, (unsigned int)(2 * (a3 + 1))); return v8 && v5; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x20],EDX MOV EAX,dword ptr [RBP + -0x20] ADD EAX,0x1 ADD EAX,EAX CMP dword ptr [RBP + -0x1c],EAX JGE 0x00101196 MOV EAX,0x1 JMP 0x0010128b LAB_00101196: MOV EAX,dword ptr [RBP + -0x20] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x20] ADD EAX,EAX CDQE ADD RAX,0x1 LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JG 0x001011f0 MOV EAX,dword ptr [RBP + -0x20] ADD EAX,EAX LEA EDX,[RAX + 0x1] MOV ECX,dword ptr [RBP + -0x1c] MOV RAX,qword ptr [RBP + -0x18] MOV ESI,ECX MOV RDI,RAX CALL 0x00101169 TEST AL,AL JZ 0x001011f0 MOV EAX,0x1 JMP 0x001011f5 LAB_001011f0: MOV EAX,0x0 LAB_001011f5: MOV byte ptr [RBP + -0x2],AL AND byte ptr [RBP + -0x2],0x1 MOV EAX,dword ptr [RBP + -0x20] ADD EAX,0x1 ADD EAX,EAX CMP dword ptr [RBP + -0x1c],EAX JZ 0x0010125d MOV EAX,dword ptr [RBP + -0x20] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x20] ADD EAX,EAX CDQE ADD RAX,0x2 LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JG 0x00101264 MOV EAX,dword ptr [RBP + -0x20] ADD EAX,0x1 LEA EDX,[RAX + RAX*0x1] MOV ECX,dword ptr [RBP + -0x1c] MOV RAX,qword ptr [RBP + -0x18] MOV ESI,ECX MOV RDI,RAX CALL 0x00101169 TEST AL,AL JZ 0x00101264 LAB_0010125d: MOV EAX,0x1 JMP 0x00101269 LAB_00101264: MOV EAX,0x0 LAB_00101269: MOV byte ptr [RBP + -0x1],AL AND byte ptr [RBP + -0x1],0x1 CMP byte ptr [RBP + -0x2],0x0 JZ 0x00101283 CMP byte ptr [RBP + -0x1],0x0 JZ 0x00101283 MOV EAX,0x1 JMP 0x00101288 LAB_00101283: MOV EAX,0x0 LAB_00101288: AND EAX,0x1 LAB_0010128b: LEAVE RET
int4 func0(long param_1,int param_2,int param_3) { char cVar1; bool bVar2; bool bVar3; int4 uVar4; if (param_2 < (param_3 + 1) * 2) { uVar4 = 1; } else { if ((*(int *)(param_1 + ((long)(param_3 * 2) + 1) * 4) < *(int *)(param_1 + (long)param_3 * 4)) || (cVar1 = func0(param_1,param_2,param_3 * 2 + 1), cVar1 == '\0')) { bVar2 = false; } else { bVar2 = true; } if ((param_2 == (param_3 + 1) * 2) || ((*(int *)(param_1 + (long)param_3 * 4) <= *(int *)(param_1 + ((long)(param_3 * 2) + 2) * 4) && (cVar1 = func0(param_1,param_2,(param_3 + 1) * 2), cVar1 != '\0')))) { bVar3 = true; } else { bVar3 = false; } if ((bVar2) && (bVar3)) { uVar4 = 1; } else { uVar4 = 0; } } return uVar4; }
6,897
func0
#include <stdbool.h> #include <assert.h>
bool func0(int arr[], int n, int i) { if (2 * i + 2 > n) { return true; } bool left_child = (arr[i] <= arr[2 * i + 1]) && func0(arr, n, 2 * i + 1); bool right_child = (2 * i + 2 == n) || (arr[i] <= arr[2 * i + 2] && func0(arr, n, 2 * i + 2)); return left_child && right_child; }
int main() { int arr1[] = {1, 2, 3, 4, 5, 6}; int arr2[] = {2, 3, 4, 5, 10, 15}; int arr3[] = {2, 10, 4, 5, 3, 15}; assert(func0(arr1, 6, 0) == true); assert(func0(arr2, 6, 0) == true); assert(func0(arr3, 6, 0) == false); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp lea 0x2(%rdx,%rdx,1),%r12d mov $0x1,%eax cmp %esi,%r12d jg 11c7 <func0+0x5e> mov %rdi,%rbx mov %esi,%ebp movslq %edx,%rdx mov (%rdi,%rdx,4),%r15d lea -0x2(%r12),%r14d movslq %r14d,%r14 mov $0x0,%r13d cmp 0x4(%rdi,%r14,4),%r15d jle 11d6 <func0+0x6d> mov $0x1,%eax cmp %ebp,%r12d je 11c1 <func0+0x58> mov $0x0,%eax cmp 0x8(%rbx,%r14,4),%r15d jle 11e6 <func0+0x7d> and %r13d,%eax and $0x1,%eax add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq lea -0x1(%r12),%edx callq 1169 <func0> movzbl %al,%r13d jmp 11ab <func0+0x42> mov %r12d,%edx mov %ebp,%esi mov %rbx,%rdi callq 1169 <func0> movzbl %al,%eax jmp 11c1 <func0+0x58>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 8 lea r12d, [rdx+rdx+2] mov eax, 1 cmp r12d, esi jg short loc_11C7 mov rbx, rdi mov ebp, esi movsxd rdx, edx mov r15d, [rdi+rdx*4] lea r14d, [r12-2] movsxd r14, r14d mov r13d, 0 cmp r15d, [rdi+r14*4+4] jle short loc_11D6 loc_11AB: mov eax, 1 cmp r12d, ebp jz short loc_11C1 mov eax, 0 cmp r15d, [rbx+r14*4+8] jle short loc_11E6 loc_11C1: and eax, r13d and eax, 1 loc_11C7: add rsp, 8 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_11D6: lea edx, [r12-1] call func0 movzx r13d, al jmp short loc_11AB loc_11E6: mov edx, r12d mov esi, ebp mov rdi, rbx call func0 movzx eax, al jmp short loc_11C1
long long func0(long long a1, long long a2, int a3) { int v3; // r12d long long result; // rax int v5; // r15d long long v6; // r14 unsigned __int8 v7; // r13 char v8; // al v3 = 2 * a3 + 2; result = 1LL; if ( v3 <= (int)a2 ) { v5 = *(_DWORD *)(a1 + 4LL * a3); v6 = 2 * a3; v7 = 0; if ( v5 <= *(_DWORD *)(a1 + 4 * v6 + 4) ) v7 = func0(a1, a2, (unsigned int)(2 * a3 + 1)); v8 = 1; if ( v3 != (_DWORD)a2 ) { v8 = 0; if ( v5 <= *(_DWORD *)(a1 + 4 * v6 + 8) ) v8 = func0(a1, (unsigned int)a2, (unsigned int)v3); } return v7 & (unsigned __int8)v8 & 1; } return result; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 LEA R12D,[RDX + RDX*0x1 + 0x2] MOV EAX,0x1 CMP R12D,ESI JG 0x001011c7 MOV RBX,RDI MOV EBP,ESI MOVSXD RDX,EDX MOV R15D,dword ptr [RDI + RDX*0x4] LEA R14D,[R12 + -0x2] MOVSXD R14,R14D MOV R13D,0x0 CMP R15D,dword ptr [RDI + R14*0x4 + 0x4] JLE 0x001011d6 LAB_001011ab: MOV EAX,0x1 CMP R12D,EBP JZ 0x001011c1 MOV EAX,0x0 CMP R15D,dword ptr [RBX + R14*0x4 + 0x8] JLE 0x001011e6 LAB_001011c1: AND EAX,R13D AND EAX,0x1 LAB_001011c7: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001011d6: LEA EDX,[R12 + -0x1] CALL 0x00101169 MOVZX R13D,AL JMP 0x001011ab LAB_001011e6: MOV EDX,R12D MOV ESI,EBP MOV RDI,RBX CALL 0x00101169 MOVZX EAX,AL JMP 0x001011c1
byte func0(long param_1,ulong param_2,int param_3) { int iVar1; int iVar2; int iVar3; byte bVar4; byte bVar5; iVar3 = param_3 * 2; iVar2 = iVar3 + 2; bVar4 = 1; if (iVar2 <= (int)param_2) { iVar1 = *(int *)(param_1 + (long)param_3 * 4); bVar4 = 0; if (iVar1 <= *(int *)(param_1 + 4 + (long)iVar3 * 4)) { bVar4 = func0(param_1,param_2,iVar3 + 1); } bVar5 = 1; if ((iVar2 != (int)param_2) && (bVar5 = 0, iVar1 <= *(int *)(param_1 + 8 + (long)iVar3 * 4))) { bVar5 = func0(param_1,param_2 & 0xffffffff,iVar2); } bVar4 = bVar5 & bVar4 & 1; } return bVar4; }
6,898
func0
#include <stdbool.h> #include <assert.h>
bool func0(int arr[], int n, int i) { if (2 * i + 2 > n) { return true; } bool left_child = (arr[i] <= arr[2 * i + 1]) && func0(arr, n, 2 * i + 1); bool right_child = (2 * i + 2 == n) || (arr[i] <= arr[2 * i + 2] && func0(arr, n, 2 * i + 2)); return left_child && right_child; }
int main() { int arr1[] = {1, 2, 3, 4, 5, 6}; int arr2[] = {2, 3, 4, 5, 10, 15}; int arr3[] = {2, 10, 4, 5, 3, 15}; assert(func0(arr1, 6, 0) == true); assert(func0(arr2, 6, 0) == true); assert(func0(arr3, 6, 0) == false); return 0; }
O2
c
func0: endbr64 push %r15 mov $0x1,%eax push %r14 push %r13 lea 0x2(%rdx,%rdx,1),%r13d push %r12 push %rbp push %rbx sub $0x8,%rsp cmp %esi,%r13d jg 1313 <func0+0x53> lea -0x2(%r13),%ebx movslq %edx,%rdx mov %rdi,%rbp mov %esi,%r12d movslq %ebx,%rbx mov (%rdi,%rdx,4),%r15d xor %r14d,%r14d cmp 0x4(%rdi,%rbx,4),%r15d jle 1328 <func0+0x68> mov %r14d,%eax and $0x1,%eax cmp %r12d,%r13d je 1313 <func0+0x53> xor %eax,%eax cmp 0x8(%rbp,%rbx,4),%r15d jle 1348 <func0+0x88> add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw 0x0(%rax,%rax,1) lea -0x1(%r13),%edx callq 12c0 <func0> movzbl %al,%r14d mov %r14d,%eax and $0x1,%eax cmp %r12d,%r13d jne 130a <func0+0x4a> jmp 1313 <func0+0x53> nopw 0x0(%rax,%rax,1) mov %r13d,%edx mov %r12d,%esi mov %rbp,%rdi callq 12c0 <func0> add $0x8,%rsp and %r14d,%eax pop %rbx pop %rbp and $0x1,%eax pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax,%rax,1)
func0: endbr64 push r15 mov eax, 1 push r14 push r13 lea r13d, [rdx+rdx+2] push r12 push rbp push rbx sub rsp, 8 cmp r13d, esi jg short loc_130D lea ebx, [r13-2] movsxd rdx, edx mov rbp, rdi mov r12d, esi movsxd rbx, ebx mov r15d, [rdi+rdx*4] xor r14d, r14d cmp r15d, [rdi+rbx*4+4] jle short loc_1350 cmp r13d, r12d jz short loc_1331 loc_1304: xor eax, eax cmp r15d, [rbp+rbx*4+8] jle short loc_1320 loc_130D: add rsp, 8 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1320: mov edx, r13d mov esi, r12d mov rdi, rbp call func0 and r14d, eax loc_1331: add rsp, 8 mov eax, r14d pop rbx and eax, 1 pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1350: lea edx, [r13-1] call func0 movzx r14d, al cmp r13d, r12d jnz short loc_1304 jmp short loc_1331
long long func0(long long a1, long long a2, int a3) { long long result; // rax int v4; // r13d long long v5; // rbx int v6; // r15d char v7; // r14 result = 1LL; v4 = 2 * a3 + 2; if ( v4 <= (int)a2 ) { v5 = 2 * a3; v6 = *(_DWORD *)(a1 + 4LL * a3); v7 = 0; if ( v6 <= *(_DWORD *)(a1 + 4 * v5 + 4) ) { v7 = func0(a1, a2, (unsigned int)(2 * a3 + 1)); if ( v4 == (_DWORD)a2 ) return v7 & 1; } else if ( v4 == (_DWORD)a2 ) { return v7 & 1; } result = 0LL; if ( v6 > *(_DWORD *)(a1 + 4 * v5 + 8) ) return result; v7 &= func0(a1, (unsigned int)a2, (unsigned int)v4); return v7 & 1; } return result; }
func0: ENDBR64 PUSH R15 MOV EAX,0x1 PUSH R14 PUSH R13 LEA R13D,[RDX + RDX*0x1 + 0x2] PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 CMP R13D,ESI JG 0x0010130d LEA EBX,[R13 + -0x2] MOVSXD RDX,EDX MOV RBP,RDI MOV R12D,ESI MOVSXD RBX,EBX MOV R15D,dword ptr [RDI + RDX*0x4] XOR R14D,R14D CMP R15D,dword ptr [RDI + RBX*0x4 + 0x4] JLE 0x00101350 CMP R13D,R12D JZ 0x00101331 LAB_00101304: XOR EAX,EAX CMP R15D,dword ptr [RBP + RBX*0x4 + 0x8] JLE 0x00101320 LAB_0010130d: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101320: MOV EDX,R13D MOV ESI,R12D MOV RDI,RBP CALL 0x001012c0 AND R14D,EAX LAB_00101331: ADD RSP,0x8 MOV EAX,R14D POP RBX AND EAX,0x1 POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101350: LEA EDX,[R13 + -0x1] CALL 0x001012c0 MOVZX R14D,AL CMP R13D,R12D JNZ 0x00101304 JMP 0x00101331
byte func0(long param_1,ulong param_2,int param_3) { int iVar1; int iVar2; int iVar3; byte bVar4; byte bVar5; iVar3 = param_3 * 2; iVar2 = iVar3 + 2; if ((int)param_2 < iVar2) { return 1; } iVar1 = *(int *)(param_1 + (long)param_3 * 4); bVar5 = 0; if (iVar1 <= *(int *)(param_1 + 4 + (long)iVar3 * 4)) { bVar5 = func0(param_1,param_2,iVar3 + 1); } if (iVar2 != (int)param_2) { if (*(int *)(param_1 + 8 + (long)iVar3 * 4) < iVar1) { return 0; } bVar4 = func0(param_1,param_2 & 0xffffffff,iVar2); bVar5 = bVar5 & bVar4; } return bVar5 & 1; }
6,899
func0
#include <stdbool.h> #include <assert.h>
bool func0(int arr[], int n, int i) { if (2 * i + 2 > n) { return true; } bool left_child = (arr[i] <= arr[2 * i + 1]) && func0(arr, n, 2 * i + 1); bool right_child = (2 * i + 2 == n) || (arr[i] <= arr[2 * i + 2] && func0(arr, n, 2 * i + 2)); return left_child && right_child; }
int main() { int arr1[] = {1, 2, 3, 4, 5, 6}; int arr2[] = {2, 3, 4, 5, 10, 15}; int arr3[] = {2, 10, 4, 5, 3, 15}; assert(func0(arr1, 6, 0) == true); assert(func0(arr2, 6, 0) == true); assert(func0(arr3, 6, 0) == false); return 0; }
O3
c
func0: endbr64 push %r15 mov $0x1,%eax push %r14 push %r13 lea 0x2(%rdx,%rdx,1),%r13d push %r12 push %rbp push %rbx sub $0x8,%rsp cmp %esi,%r13d jg 12df <func0+0x4f> lea -0x2(%r13),%ebx movslq %edx,%rdx mov %rdi,%rbp mov %esi,%r12d movslq %ebx,%rbx mov (%rdi,%rdx,4),%r14d xor %eax,%eax xor %r15d,%r15d cmp 0x4(%rdi,%rbx,4),%r14d jle 12f0 <func0+0x60> cmp %r12d,%r13d je 12df <func0+0x4f> xor %eax,%eax cmp 0x8(%rbp,%rbx,4),%r14d jle 1308 <func0+0x78> add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq xchg %ax,%ax lea -0x1(%r13),%edx callq 1290 <func0> movzbl %al,%r15d cmp %r12d,%r13d jne 12d6 <func0+0x46> jmp 12df <func0+0x4f> nopl 0x0(%rax) mov %r13d,%edx mov %r12d,%esi mov %rbp,%rdi callq 1290 <func0> add $0x8,%rsp and %r15d,%eax pop %rbx pop %rbp and $0x1,%eax pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax,%rax,1)
func0: endbr64 push r14 mov eax, 1 push r13 push r12 lea r12d, [rdx+rdx+2] push rbp push rbx cmp r12d, esi jg short loc_12CB movsxd rdx, edx mov rbx, rdi mov ebp, esi xor eax, eax mov r13d, [rdi+rdx*4] lea edx, [r12-2] xor r14d, r14d movsxd rdx, edx cmp r13d, [rdi+rdx*4+4] jle short loc_12D8 cmp r12d, ebp jz short loc_12CB loc_12C0: movsxd rdx, r12d xor eax, eax cmp r13d, [rbx+rdx*4] jle short loc_12F0 loc_12CB: pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_12D8: lea edx, [r12-1] call func0 movzx r14d, al cmp r12d, ebp jnz short loc_12C0 jmp short loc_12CB loc_12F0: mov edx, r12d mov esi, ebp mov rdi, rbx call func0 pop rbx pop rbp and r14d, eax pop r12 pop r13 mov eax, r14d pop r14 and eax, 1 retn
long long func0(long long a1, long long a2, int a3) { long long result; // rax int v4; // r12d int v5; // r13d unsigned __int8 v6; // r14 result = 1LL; v4 = 2 * a3 + 2; if ( v4 <= (int)a2 ) { result = 0LL; v5 = *(_DWORD *)(a1 + 4LL * a3); v6 = 0; if ( v5 <= *(_DWORD *)(a1 + 8LL * a3 + 4) ) { result = func0(a1, a2, (unsigned int)(2 * a3 + 1)); v6 = result; if ( v4 == (_DWORD)a2 ) return result; } else if ( v4 == (_DWORD)a2 ) { return result; } result = 0LL; if ( v5 <= *(_DWORD *)(a1 + 4LL * v4) ) return (unsigned __int8)func0(a1, (unsigned int)a2, (unsigned int)v4) & v6 & 1; } return result; }
func0: ENDBR64 PUSH R14 MOV EAX,0x1 PUSH R13 PUSH R12 LEA R12D,[RDX + RDX*0x1 + 0x2] PUSH RBP PUSH RBX CMP R12D,ESI JG 0x001012cb MOVSXD RDX,EDX MOV RBX,RDI MOV EBP,ESI XOR EAX,EAX MOV R13D,dword ptr [RDI + RDX*0x4] LEA EDX,[R12 + -0x2] XOR R14D,R14D MOVSXD RDX,EDX CMP R13D,dword ptr [RDI + RDX*0x4 + 0x4] JLE 0x001012d8 CMP R12D,EBP JZ 0x001012cb LAB_001012c0: MOVSXD RDX,R12D XOR EAX,EAX CMP R13D,dword ptr [RBX + RDX*0x4] JLE 0x001012f0 LAB_001012cb: POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_001012d8: LEA EDX,[R12 + -0x1] CALL 0x00101280 MOVZX R14D,AL CMP R12D,EBP JNZ 0x001012c0 JMP 0x001012cb LAB_001012f0: MOV EDX,R12D MOV ESI,EBP MOV RDI,RBX CALL 0x00101280 POP RBX POP RBP AND R14D,EAX POP R12 POP R13 MOV EAX,R14D POP R14 AND EAX,0x1 RET
ulong func0(long param_1,ulong param_2,int param_3) { int iVar1; int iVar2; int iVar3; uint uVar4; ulong uVar5; uint uVar6; uVar5 = 1; iVar3 = param_3 * 2; iVar2 = iVar3 + 2; if (iVar2 <= (int)param_2) { uVar5 = 0; iVar1 = *(int *)(param_1 + (long)param_3 * 4); uVar6 = 0; if (iVar1 <= *(int *)(param_1 + 4 + (long)iVar3 * 4)) { uVar5 = func0(param_1,param_2,iVar3 + 1); uVar6 = (uint)uVar5 & 0xff; } if ((iVar2 != (int)param_2) && (uVar5 = 0, iVar1 <= *(int *)(param_1 + (long)iVar2 * 4))) { uVar4 = func0(param_1,param_2 & 0xffffffff,iVar2); return (ulong)(uVar6 & uVar4 & 1); } } return uVar5; }
6,900
func0
#include <assert.h>
int func0(int n) { int dp[n + 1]; dp[0] = 0; dp[1] = 1; for (int i = 2; i <= n; i++) { dp[i] = dp[i - 1] + 2 * dp[i - 2]; } return dp[n]; }
int main() { assert(func0(5) == 11); assert(func0(2) == 1); assert(func0(4) == 5); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x38,%rsp mov %edi,-0x34(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax mov %rsp,%rax mov %rax,%rsi mov -0x34(%rbp),%eax add $0x1,%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 1207 <func0+0x9e> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) jmp 11f0 <func0+0x87> mov %rax,%rdx and $0xfff,%edx sub %rdx,%rsp mov %rax,%rdx and $0xfff,%edx test %rdx,%rdx je 1231 <func0+0xc8> 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 -0x20(%rbp),%rax movl $0x0,(%rax) mov -0x20(%rbp),%rax movl $0x1,0x4(%rax) movl $0x2,-0x2c(%rbp) jmp 1297 <func0+0x12e> mov -0x2c(%rbp),%eax lea -0x1(%rax),%edx mov -0x20(%rbp),%rax movslq %edx,%rdx mov (%rax,%rdx,4),%ecx mov -0x2c(%rbp),%eax lea -0x2(%rax),%edx mov -0x20(%rbp),%rax movslq %edx,%rdx mov (%rax,%rdx,4),%eax add %eax,%eax add %eax,%ecx mov -0x20(%rbp),%rax mov -0x2c(%rbp),%edx movslq %edx,%rdx mov %ecx,(%rax,%rdx,4) addl $0x1,-0x2c(%rbp) mov -0x2c(%rbp),%eax cmp -0x34(%rbp),%eax jle 1262 <func0+0xf9> mov -0x20(%rbp),%rax mov -0x34(%rbp),%edx movslq %edx,%rdx mov (%rax,%rdx,4),%eax mov %rsi,%rsp mov -0x18(%rbp),%rdi xor %fs:0x28,%rdi je 12c3 <func0+0x15a> callq 1060 <__stack_chk_fail@plt> mov -0x8(%rbp),%rbx leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_24], edi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov rax, rsp mov rsi, rax mov eax, [rbp+var_24] add eax, 1 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_11D5: cmp rsp, rdx jz short loc_11EC sub rsp, 1000h or [rsp+1030h+var_38], 0 jmp short loc_11D5 loc_11EC: mov rdx, rax and edx, 0FFFh sub rsp, rdx mov rdx, rax and edx, 0FFFh test rdx, rdx jz short loc_1216 and eax, 0FFFh sub rax, 8 add rax, rsp or qword ptr [rax], 0 loc_1216: mov rax, rsp add rax, 3 shr rax, 2 shl rax, 2 mov [rbp+var_10], rax mov rax, [rbp+var_10] mov dword ptr [rax], 0 mov rax, [rbp+var_10] mov dword ptr [rax+4], 1 mov [rbp+var_1C], 2 jmp short loc_127C loc_1247: mov eax, [rbp+var_1C] lea edx, [rax-1] mov rax, [rbp+var_10] movsxd rdx, edx mov ecx, [rax+rdx*4] mov eax, [rbp+var_1C] lea edx, [rax-2] mov rax, [rbp+var_10] movsxd rdx, edx mov eax, [rax+rdx*4] add eax, eax add ecx, eax mov rax, [rbp+var_10] mov edx, [rbp+var_1C] movsxd rdx, edx mov [rax+rdx*4], ecx add [rbp+var_1C], 1 loc_127C: mov eax, [rbp+var_1C] cmp eax, [rbp+var_24] jle short loc_1247 mov rax, [rbp+var_10] mov edx, [rbp+var_24] movsxd rdx, edx mov eax, [rax+rdx*4] mov rsp, rsi mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_12A8 call ___stack_chk_fail locret_12A8: leave retn
long long func0(int a1) { unsigned long long v1; // rax void *v2; // rsp _DWORD v4[3]; // [rsp+8h] [rbp-30h] BYREF int v5; // [rsp+14h] [rbp-24h] int i; // [rsp+1Ch] [rbp-1Ch] long long v7; // [rsp+20h] [rbp-18h] _DWORD *v8; // [rsp+28h] [rbp-10h] unsigned long long v9; // [rsp+30h] [rbp-8h] v5 = a1; v9 = __readfsqword(0x28u); v7 = a1 + 1 - 1LL; v1 = 16 * ((4LL * (a1 + 1) + 15) / 0x10uLL); while ( v4 != (_DWORD *)((char *)v4 - (v1 & 0xFFFFFFFFFFFFF000LL)) ) ; v2 = alloca(v1 & 0xFFF); if ( (v1 & 0xFFF) != 0 ) *(_QWORD *)((char *)&v4[-2] + (v1 & 0xFFF)) = *(_QWORD *)((char *)&v4[-2] + (v1 & 0xFFF)); v8 = v4; v4[0] = 0; v4[1] = 1; for ( i = 2; i <= v5; ++i ) v8[i] = 2 * v8[i - 2] + v8[i - 1]; return (unsigned int)v8[v5]; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV dword ptr [RBP + -0x24],EDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV RAX,RSP MOV RSI,RAX MOV EAX,dword ptr [RBP + -0x24] ADD EAX,0x1 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_001011d5: CMP RSP,RDX JZ 0x001011ec SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 JMP 0x001011d5 LAB_001011ec: MOV RDX,RAX AND EDX,0xfff SUB RSP,RDX MOV RDX,RAX AND EDX,0xfff TEST RDX,RDX JZ 0x00101216 AND EAX,0xfff SUB RAX,0x8 ADD RAX,RSP OR qword ptr [RAX],0x0 LAB_00101216: MOV RAX,RSP ADD RAX,0x3 SHR RAX,0x2 SHL RAX,0x2 MOV qword ptr [RBP + -0x10],RAX MOV RAX,qword ptr [RBP + -0x10] MOV dword ptr [RAX],0x0 MOV RAX,qword ptr [RBP + -0x10] MOV dword ptr [RAX + 0x4],0x1 MOV dword ptr [RBP + -0x1c],0x2 JMP 0x0010127c LAB_00101247: MOV EAX,dword ptr [RBP + -0x1c] LEA EDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x10] MOVSXD RDX,EDX MOV ECX,dword ptr [RAX + RDX*0x4] MOV EAX,dword ptr [RBP + -0x1c] LEA EDX,[RAX + -0x2] MOV RAX,qword ptr [RBP + -0x10] MOVSXD RDX,EDX MOV EAX,dword ptr [RAX + RDX*0x4] ADD EAX,EAX ADD ECX,EAX MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x1c] MOVSXD RDX,EDX MOV dword ptr [RAX + RDX*0x4],ECX ADD dword ptr [RBP + -0x1c],0x1 LAB_0010127c: MOV EAX,dword ptr [RBP + -0x1c] CMP EAX,dword ptr [RBP + -0x24] JLE 0x00101247 MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x24] MOVSXD RDX,EDX MOV EAX,dword ptr [RAX + RDX*0x4] MOV RSP,RSI MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001012a8 CALL 0x00101060 LAB_001012a8: LEAVE RET
int4 func0(int param_1) { long lVar1; ulong uVar2; int *puVar3; long in_FS_OFFSET; int auStack_38 [12]; int local_2c; int local_24; long local_20; int *local_18; long local_10; local_2c = param_1; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_20 = (long)(param_1 + 1) + -1; uVar2 = (((long)(param_1 + 1) * 4 + 0xfU) / 0x10) * 0x10; for (puVar3 = auStack_38; puVar3 != auStack_38 + -(uVar2 & 0xfffffffffffff000); puVar3 = puVar3 + -0x1000) { *(int8 *)(puVar3 + -8) = *(int8 *)(puVar3 + -8); } lVar1 = -(ulong)((uint)uVar2 & 0xfff); if ((uVar2 & 0xfff) != 0) { *(int8 *)(puVar3 + ((ulong)((uint)uVar2 & 0xfff) - 8) + lVar1) = *(int8 *)(puVar3 + ((ulong)((uint)uVar2 & 0xfff) - 8) + lVar1); } *(int4 *)(puVar3 + lVar1) = 0; *(int4 *)(puVar3 + lVar1 + 4) = 1; for (local_24 = 2; local_24 <= local_2c; local_24 = local_24 + 1) { *(int *)(puVar3 + (long)local_24 * 4 + lVar1) = *(int *)(puVar3 + (long)(local_24 + -1) * 4 + lVar1) + *(int *)(puVar3 + (long)(local_24 + -2) * 4 + lVar1) * 2; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { local_18 = puVar3 + lVar1; /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return *(int4 *)(puVar3 + (long)local_2c * 4 + lVar1); }
6,901
func0
#include <assert.h>
int func0(int n) { int dp[n + 1]; dp[0] = 0; dp[1] = 1; for (int i = 2; i <= n; i++) { dp[i] = dp[i - 1] + 2 * dp[i - 2]; } return dp[n]; }
int main() { assert(func0(5) == 11); assert(func0(2) == 1); assert(func0(4) == 5); 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 lea 0x1(%rdi),%eax cltq lea 0xf(,%rax,4),%rax mov %rax,%rdx and $0xfffffffffffffff0,%rdx and $0xfffffffffffff000,%rax mov %rsp,%rsi sub %rax,%rsi mov %rsi,%rax cmp %rax,%rsp je 11be <func0+0x55> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) jmp 11a7 <func0+0x3e> mov %rdx,%rax and $0xfff,%eax sub %rax,%rsp test %rax,%rax je 11d4 <func0+0x6b> orq $0x0,-0x8(%rsp,%rax,1) lea 0x3(%rsp),%r8 mov %r8,%rax shr $0x2,%rax and $0xfffffffffffffffc,%r8 movl $0x0,0x0(,%rax,4) movl $0x1,0x4(,%rax,4) cmp $0x1,%edi jle 121e <func0+0xb5> mov %r8,%rax lea -0x2(%rdi),%edx lea 0x4(%r8,%rdx,4),%rsi mov (%rax),%ecx mov 0x4(%rax),%edx lea (%rdx,%rcx,2),%edx mov %edx,0x8(%rax) add $0x4,%rax cmp %rsi,%rax jne 120a <func0+0xa1> movslq %edi,%rdi mov (%r8,%rdi,4),%eax mov -0x8(%rbp),%rdi xor %fs:0x28,%rdi jne 1236 <func0+0xcd> 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 lea eax, [rdi+1] cdqe lea rax, ds:0Fh[rax*4] mov rcx, rax and rcx, 0FFFFFFFFFFFFFFF0h and rax, 0FFFFFFFFFFFFF000h mov rdx, rsp sub rdx, rax loc_11A4: cmp rsp, rdx jz short loc_11BB sub rsp, 1000h or [rsp+1010h+var_18], 0 jmp short loc_11A4 loc_11BB: mov rax, rcx and eax, 0FFFh sub rsp, rax test rax, rax jz short loc_11D1 or [rsp+rax+10h+var_18], 0 loc_11D1: lea r8, [rsp+10h+var_D] mov rax, r8 shr rax, 2 and r8, 0FFFFFFFFFFFFFFFCh mov ds:dword_0[rax*4], 0 mov dword ptr ds:byte_4[rax*4], 1 cmp edi, 1 jle short loc_121A mov rax, r8 lea edx, [rdi-1] lea rsi, [r8+rdx*4] loc_1206: mov ecx, [rax] mov edx, [rax+4] lea edx, [rdx+rcx*2] mov [rax+8], edx add rax, 4 cmp rax, rsi jnz short loc_1206 loc_121A: movsxd rdi, edi mov eax, [r8+rdi*4] mov rdx, [rbp+var_8] sub rdx, fs:28h jnz short loc_1232 leave retn loc_1232: call ___stack_chk_fail
long long func0(int a1) { signed long long v1; // rax void *v2; // rsp unsigned long long v3; // rax _BYTE *v4; // rax _BYTE v7[3]; // [rsp+8h] [rbp-10h] BYREF char v8; // [rsp+Bh] [rbp-Dh] BYREF unsigned long long v9; // [rsp+10h] [rbp-8h] v9 = __readfsqword(0x28u); while ( v7 != &v7[-((4LL * (a1 + 1) + 15) & 0xFFFFFFFFFFFFF000LL)] ) ; v1 = (4 * ((_WORD)a1 + 1) + 15) & 0xFF0; v2 = alloca(v1); if ( ((4 * ((_WORD)a1 + 1) + 15) & 0xFF0) != 0 ) *(_QWORD *)&v7[v1 - 8] = *(_QWORD *)&v7[v1 - 8]; v3 = (unsigned long long)&v8 >> 2; *(_DWORD *)(4 * v3) = 0; *(_DWORD *)&byte_4[4 * v3] = 1; if ( a1 > 1 ) { v4 = v7; do { *((_DWORD *)v4 + 2) = *((_DWORD *)v4 + 1) + 2 * *(_DWORD *)v4; v4 += 4; } while ( v4 != &v7[4 * (a1 - 1)] ); } return *(unsigned int *)&v7[4 * a1]; }
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 LEA EAX,[RDI + 0x1] CDQE LEA RAX,[0xf + RAX*0x4] MOV RCX,RAX AND RCX,-0x10 AND RAX,-0x1000 MOV RDX,RSP SUB RDX,RAX LAB_001011a4: CMP RSP,RDX JZ 0x001011bb SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 JMP 0x001011a4 LAB_001011bb: MOV RAX,RCX AND EAX,0xfff SUB RSP,RAX TEST RAX,RAX JZ 0x001011d1 OR qword ptr [RSP + RAX*0x1 + -0x8],0x0 LAB_001011d1: LEA R8,[RSP + 0x3] MOV RAX,R8 SHR RAX,0x2 AND R8,-0x4 MOV dword ptr [RAX*0x4],0x0 MOV dword ptr [0x4 + RAX*0x4],0x1 CMP EDI,0x1 JLE 0x0010121a MOV RAX,R8 LEA EDX,[RDI + -0x1] LEA RSI,[R8 + RDX*0x4] LAB_00101206: MOV ECX,dword ptr [RAX] MOV EDX,dword ptr [RAX + 0x4] LEA EDX,[RDX + RCX*0x2] MOV dword ptr [RAX + 0x8],EDX ADD RAX,0x4 CMP RAX,RSI JNZ 0x00101206 LAB_0010121a: MOVSXD RDI,EDI MOV EAX,dword ptr [R8 + RDI*0x4] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101232 LEAVE RET LAB_00101232: CALL 0x00101060
int4 func0(int param_1) { long lVar1; ulong uVar2; int *piVar3; int1 *puVar4; long in_FS_OFFSET; int1 auStack_18 [8]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); uVar2 = (long)(param_1 + 1) * 4 + 0xf; for (puVar4 = auStack_18; puVar4 != auStack_18 + -(uVar2 & 0xfffffffffffff000); puVar4 = puVar4 + -0x1000) { *(int8 *)(puVar4 + -8) = *(int8 *)(puVar4 + -8); } uVar2 = (ulong)((uint)uVar2 & 0xff0); lVar1 = -uVar2; piVar3 = (int *)(puVar4 + lVar1); if (uVar2 != 0) { *(int8 *)(puVar4 + -8) = *(int8 *)(puVar4 + -8); } *(int4 *)(((ulong)(puVar4 + lVar1 + 3) >> 2) * 4) = 0; *(int4 *)(((ulong)(puVar4 + lVar1 + 3) >> 2) * 4 + 4) = 1; if (1 < param_1) { do { piVar3[2] = piVar3[1] + *piVar3 * 2; piVar3 = piVar3 + 1; } while (piVar3 != (int *)(puVar4 + (ulong)(param_1 - 1) * 4 + lVar1)); } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return *(int4 *)(puVar4 + (long)param_1 * 4 + lVar1); } /* WARNING: Subroutine does not return */ *(code **)(puVar4 + lVar1 + -8) = main; __stack_chk_fail(); }
6,902
func0
#include <assert.h>
int func0(int n) { int dp[n + 1]; dp[0] = 0; dp[1] = 1; for (int i = 2; i <= n; i++) { dp[i] = dp[i - 1] + 2 * dp[i - 2]; } return dp[n]; }
int main() { assert(func0(5) == 11); assert(func0(2) == 1); assert(func0(4) == 5); 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 lea 0x1(%rdi),%eax mov %rsp,%rsi cltq lea 0xf(,%rax,4),%rax mov %rax,%rdx and $0xfffffffffffff000,%rax sub %rax,%rsi and $0xfffffffffffffff0,%rdx mov %rsi,%rax cmp %rax,%rsp je 1268 <func0+0x58> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 1253 <func0+0x43> and $0xfff,%edx sub %rdx,%rsp test %rdx,%rdx jne 12e8 <func0+0xd8> movabs $0x100000000,%rsi lea 0x3(%rsp),%r8 mov %r8,%rax and $0xfffffffffffffffc,%r8 shr $0x2,%rax mov %rsi,0x0(,%rax,4) cmp $0x1,%edi jle 12c9 <func0+0xb9> lea -0x2(%rdi),%edx lea 0x8(%r8),%rax xor %ecx,%ecx lea 0x8(%r8,%rdx,4),%rsi mov $0x1,%edx jmp 12bf <func0+0xaf> nopw 0x0(%rax,%rax,1) mov -0x4(%rax),%ecx add $0x4,%rax lea (%rdx,%rcx,2),%edx mov %edx,(%rax) cmp %rsi,%rax jne 12b8 <func0+0xa8> movslq %edi,%rdi mov (%r8,%rdi,4),%eax mov -0x8(%rbp),%rdi xor %fs:0x28,%rdi jne 12f0 <func0+0xe0> leaveq retq nopl 0x0(%rax) orq $0x0,-0x8(%rsp,%rdx,1) jmp 1276 <func0+0x66> callq 1060 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push rbp mov rbp, rsp sub rsp, 10h mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea eax, [rdi+1] mov rcx, rsp cdqe lea rax, ds:0Fh[rax*4] mov rdx, rax and rax, 0FFFFFFFFFFFFF000h sub rcx, rax and rdx, 0FFFFFFFFFFFFFFF0h cmp rsp, rcx jz short loc_1265 loc_1250: sub rsp, 1000h or [rsp+1010h+var_18], 0 cmp rsp, rcx jnz short loc_1250 loc_1265: and edx, 0FFFh sub rsp, rdx test rdx, rdx jnz short loc_12E0 loc_1273: mov rsi, 100000000h lea r8, [rsp+1010h+var_100D] mov rax, r8 and r8, 0FFFFFFFFFFFFFFFCh shr rax, 2 mov qword ptr ds:dword_0[rax*4], rsi cmp edi, 1 jle short loc_12C1 lea edx, [rdi-2] lea rax, [r8+8] xor ecx, ecx lea rsi, [r8+rdx*4+8] mov edx, 1 jmp short loc_12B7 loc_12B0: mov ecx, [rax-4] add rax, 4 loc_12B7: lea edx, [rdx+rcx*2] mov [rax], edx cmp rax, rsi jnz short loc_12B0 loc_12C1: movsxd rdi, edi mov eax, [r8+rdi*4] mov rdx, [rbp+var_8] sub rdx, fs:28h jnz short loc_12E8 leave retn loc_12E0: or [rsp+rdx+1010h+var_1018], 0 jmp short loc_1273 loc_12E8: call ___stack_chk_fail
long long func0(int a1) { long long v1; // rdx long long *v2; // rcx __int16 v3; // dx signed long long v4; // rdx void *v5; // rsp long long *v6; // rax int v7; // ecx int v8; // edx long long v10; // [rsp+0h] [rbp-1018h] long long v11; // [rsp+8h] [rbp-1010h] BYREF long long v12; // [rsp+10h] [rbp-1008h] BYREF _QWORD v13[2]; // [rsp+1008h] [rbp-10h] BYREF v13[1] = __readfsqword(0x28u); v1 = 4LL * (a1 + 1) + 15; v2 = (_QWORD *)((char *)v13 - (v1 & 0xFFFFFFFFFFFFF000LL)); v3 = v1 & 0xFFF0; if ( v13 != v2 ) { while ( &v11 != v2 ) ; } v4 = v3 & 0xFFF; v5 = alloca(v4); if ( v4 ) *(long long *)((char *)&v10 + v4) = *(long long *)((char *)&v10 + v4); v11 = 0x100000000LL; if ( a1 > 1 ) { v6 = &v12; v7 = 0; v8 = 1; while ( 1 ) { v8 += 2 * v7; *(_DWORD *)v6 = v8; if ( v6 == (long long *)((char *)&v11 + 4 * (unsigned int)(a1 - 2) + 8) ) break; v7 = *((_DWORD *)v6 - 1); v6 = (long long *)((char *)v6 + 4); } } return *((unsigned int *)&v11 + a1); }
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 LEA EAX,[RDI + 0x1] MOV RCX,RSP CDQE LEA RAX,[0xf + RAX*0x4] MOV RDX,RAX AND RAX,-0x1000 SUB RCX,RAX AND RDX,-0x10 CMP RSP,RCX JZ 0x00101265 LAB_00101250: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RCX JNZ 0x00101250 LAB_00101265: AND EDX,0xfff SUB RSP,RDX TEST RDX,RDX JNZ 0x001012e0 LAB_00101273: MOV RSI,0x100000000 LEA R8,[RSP + 0x3] MOV RAX,R8 AND R8,-0x4 SHR RAX,0x2 MOV qword ptr [RAX*0x4],RSI CMP EDI,0x1 JLE 0x001012c1 LEA EDX,[RDI + -0x2] LEA RAX,[R8 + 0x8] XOR ECX,ECX LEA RSI,[R8 + RDX*0x4 + 0x8] MOV EDX,0x1 JMP 0x001012b7 LAB_001012b0: MOV ECX,dword ptr [RAX + -0x4] ADD RAX,0x4 LAB_001012b7: LEA EDX,[RDX + RCX*0x2] MOV dword ptr [RAX],EDX CMP RAX,RSI JNZ 0x001012b0 LAB_001012c1: MOVSXD RDI,EDI MOV EAX,dword ptr [R8 + RDI*0x4] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JNZ 0x001012e8 LEAVE RET LAB_001012e0: OR qword ptr [RSP + RDX*0x1 + -0x8],0x0 JMP 0x00101273 LAB_001012e8: CALL 0x00101060
int4 func0(int param_1) { long lVar1; int1 *puVar2; int *piVar3; int iVar4; int iVar5; ulong uVar6; int1 *puVar7; long in_FS_OFFSET; int1 auStack_18 [8]; long local_10; int1 *puVar8; puVar7 = auStack_18; local_10 = *(long *)(in_FS_OFFSET + 0x28); uVar6 = (long)(param_1 + 1) * 4 + 0xf; puVar8 = auStack_18; puVar2 = auStack_18; while (puVar8 != auStack_18 + -(uVar6 & 0xfffffffffffff000)) { puVar7 = puVar2 + -0x1000; *(int8 *)(puVar2 + -8) = *(int8 *)(puVar2 + -8); puVar8 = puVar2 + -0x1000; puVar2 = puVar2 + -0x1000; } uVar6 = (ulong)((uint)uVar6 & 0xff0); lVar1 = -uVar6; if (uVar6 != 0) { *(int8 *)(puVar7 + -8) = *(int8 *)(puVar7 + -8); } *(int8 *)(puVar7 + lVar1) = 0x100000000; if (1 < param_1) { piVar3 = (int *)(puVar7 + lVar1 + 8); iVar4 = 0; iVar5 = 1; while( true ) { iVar5 = iVar5 + iVar4 * 2; *piVar3 = iVar5; if (piVar3 == (int *)(puVar7 + (ulong)(param_1 - 2) * 4 + lVar1 + 8)) break; iVar4 = piVar3[-1]; piVar3 = piVar3 + 1; } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(int8 *)(puVar7 + lVar1 + -8) = 0x1012ed; __stack_chk_fail(); } return *(int4 *)(puVar7 + (long)param_1 * 4 + lVar1); }
6,903
func0
#include <assert.h>
int func0(int n) { int dp[n + 1]; dp[0] = 0; dp[1] = 1; for (int i = 2; i <= n; i++) { dp[i] = dp[i - 1] + 2 * dp[i - 2]; } return dp[n]; }
int main() { assert(func0(5) == 11); assert(func0(2) == 1); assert(func0(4) == 5); 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 lea 0x1(%rdi),%eax mov %rsp,%rsi cltq lea 0xf(,%rax,4),%rax mov %rax,%rdx and $0xfffffffffffff000,%rax sub %rax,%rsi and $0xfffffffffffffff0,%rdx mov %rsi,%rax cmp %rax,%rsp je 11e8 <func0+0x58> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 11d3 <func0+0x43> and $0xfff,%edx sub %rdx,%rsp test %rdx,%rdx jne 1298 <func0+0x108> movabs $0x100000000,%rsi lea 0x3(%rsp),%rdx mov %rdx,%rax and $0xfffffffffffffffc,%rdx shr $0x2,%rax mov %rsi,0x0(,%rax,4) cmp $0x1,%edi jle 127e <func0+0xee> cmp $0x3,%edi jle 12a3 <func0+0x113> mov 0x0(,%rax,4),%r8d mov 0x4(,%rax,4),%esi lea -0x4(%rdi),%eax mov $0x4,%ecx shr %eax lea 0x6(%rax,%rax,1),%r9 lea (%rsi,%r8,2),%r8d movslq %ecx,%rax lea (%r8,%rsi,2),%esi mov %r8d,-0x8(%rdx,%rcx,4) mov %esi,-0x4(%rdx,%rcx,4) add $0x2,%rcx cmp %rcx,%r9 jne 1244 <func0+0xb4> nopl 0x0(%rax) mov -0x8(%rdx,%rax,4),%esi mov -0x4(%rdx,%rax,4),%ecx lea (%rcx,%rsi,2),%ecx mov %ecx,(%rdx,%rax,4) add $0x1,%rax cmp %eax,%edi jge 1268 <func0+0xd8> movslq %edi,%rdi mov (%rdx,%rdi,4),%eax mov -0x8(%rbp),%rdi xor %fs:0x28,%rdi jne 12aa <func0+0x11a> leaveq retq nopl (%rax) orq $0x0,-0x8(%rsp,%rdx,1) jmpq 11fa <func0+0x6a> mov $0x2,%eax jmp 1268 <func0+0xd8> callq 1050 <__stack_chk_fail@plt>
func0: endbr64 push rbp movsxd rcx, edi mov rbp, rsp sub rsp, 10h mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea eax, [rcx+1] mov rsi, rsp cdqe lea rax, ds:0Fh[rax*4] mov rdx, rax and rax, 0FFFFFFFFFFFFF000h sub rsi, rax and rdx, 0FFFFFFFFFFFFFFF0h cmp rsp, rsi jz short loc_11B8 loc_11A3: sub rsp, 1000h or [rsp+1010h+var_18], 0 cmp rsp, rsi jnz short loc_11A3 loc_11B8: and edx, 0FFFh sub rsp, rdx test rdx, rdx jnz loc_1260 loc_11CA: lea rdx, [rsp+1010h+var_100D] mov rsi, cs:qword_2008 mov rax, rdx and rdx, 0FFFFFFFFFFFFFFFCh shr rax, 2 mov qword ptr ds:dword_0[rax*4], rsi cmp ecx, 1 jle short loc_1246 cmp ecx, 3 jle short loc_126B lea eax, [rcx-4] mov esi, 4 mov r8d, 1 xor edi, edi shr eax, 1 lea r9d, [rax+3] add r9, r9 loc_120C: lea edi, [r8+rdi*2] mov rax, rsi lea r8d, [rdi+r8*2] mov [rdx+rsi*4-8], edi mov [rdx+rsi*4-4], r8d add rsi, 2 cmp r9, rsi jnz short loc_120C loc_1229: cdqe nop dword ptr [rax+rax+00h] loc_1230: mov edi, [rdx+rax*4-8] mov esi, [rdx+rax*4-4] lea esi, [rsi+rdi*2] mov [rdx+rax*4], esi add rax, 1 cmp ecx, eax jge short loc_1230 loc_1246: mov eax, [rdx+rcx*4] mov rdx, [rbp+var_8] sub rdx, fs:28h jnz short loc_1272 leave retn loc_1260: or [rsp+rdx+1010h+var_1018], 0 jmp loc_11CA loc_126B: mov eax, 2 jmp short loc_1229 loc_1272: call ___stack_chk_fail
long long func0(int a1) { long long v1; // rcx long long v2; // rdx _QWORD *v3; // rsi __int16 v4; // dx signed long long v5; // rdx void *v6; // rsp long long v7; // rsi int v8; // r8d int v9; // edi long long v10; // rax _QWORD v13[511]; // [rsp+8h] [rbp-1010h] BYREF _QWORD v14[2]; // [rsp+1008h] [rbp-10h] BYREF v1 = a1; v14[1] = __readfsqword(0x28u); v2 = 4LL * (a1 + 1) + 15; v3 = (_QWORD *)((char *)v14 - (v2 & 0xFFFFFFFFFFFFF000LL)); v4 = v2 & 0xFFF0; if ( v14 != v3 ) { while ( v13 != v3 ) ; } v5 = v4 & 0xFFF; v6 = alloca(v5); if ( v5 ) *(_QWORD *)((char *)&v13[-1] + v5) = *(_QWORD *)((char *)&v13[-1] + v5); v13[0] = 0x100000000LL; if ( a1 > 1 ) { if ( a1 <= 3 ) { LODWORD(v10) = 2; } else { v7 = 2LL; v8 = 1; v9 = 0; do { v9 = v8 + 2 * v9; LODWORD(v10) = v7 * 2; v8 = v9 + 2 * v8; LODWORD(v13[v7 - 1]) = v9; HIDWORD(v13[v7++ - 1]) = v8; } while ( ((unsigned int)(v1 - 4) >> 1) + 3 != v7 ); } v10 = (int)v10; do { *((_DWORD *)v13 + v10) = *((_DWORD *)v13 + v10 - 1) + 2 * *((_DWORD *)&v13[-1] + v10); ++v10; } while ( (int)v1 >= (int)v10 ); } return *((unsigned int *)v13 + v1); }
func0: ENDBR64 PUSH RBP MOVSXD RCX,EDI MOV RBP,RSP SUB RSP,0x10 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX LEA EAX,[RCX + 0x1] MOV RSI,RSP CDQE LEA RAX,[0xf + RAX*0x4] MOV RDX,RAX AND RAX,-0x1000 SUB RSI,RAX AND RDX,-0x10 CMP RSP,RSI JZ 0x001011b8 LAB_001011a3: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RSI JNZ 0x001011a3 LAB_001011b8: AND EDX,0xfff SUB RSP,RDX TEST RDX,RDX JNZ 0x00101260 LAB_001011ca: LEA RDX,[RSP + 0x3] MOV RSI,qword ptr [0x00102008] MOV RAX,RDX AND RDX,-0x4 SHR RAX,0x2 MOV qword ptr [RAX*0x4],RSI CMP ECX,0x1 JLE 0x00101246 CMP ECX,0x3 JLE 0x0010126b LEA EAX,[RCX + -0x4] MOV ESI,0x4 MOV R8D,0x1 XOR EDI,EDI SHR EAX,0x1 LEA R9D,[RAX + 0x3] ADD R9,R9 LAB_0010120c: LEA EDI,[R8 + RDI*0x2] MOV RAX,RSI LEA R8D,[RDI + R8*0x2] MOV dword ptr [RDX + RSI*0x4 + -0x8],EDI MOV dword ptr [RDX + RSI*0x4 + -0x4],R8D ADD RSI,0x2 CMP R9,RSI JNZ 0x0010120c LAB_00101229: CDQE NOP dword ptr [RAX + RAX*0x1] LAB_00101230: MOV EDI,dword ptr [RDX + RAX*0x4 + -0x8] MOV ESI,dword ptr [RDX + RAX*0x4 + -0x4] LEA ESI,[RSI + RDI*0x2] MOV dword ptr [RDX + RAX*0x4],ESI ADD RAX,0x1 CMP ECX,EAX JGE 0x00101230 LAB_00101246: MOV EAX,dword ptr [RDX + RCX*0x4] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101272 LEAVE RET LAB_00101260: OR qword ptr [RSP + RDX*0x1 + -0x8],0x0 JMP 0x001011ca LAB_0010126b: MOV EAX,0x2 JMP 0x00101229 LAB_00101272: CALL 0x00101050
int4 func0(int param_1) { long lVar1; int *puVar2; int iVar3; ulong uVar4; int *puVar5; long lVar7; int iVar8; int iVar9; long in_FS_OFFSET; int auStack_18 [8]; long local_10; int *puVar6; puVar5 = auStack_18; local_10 = *(long *)(in_FS_OFFSET + 0x28); uVar4 = (long)(param_1 + 1) * 4 + 0xf; puVar6 = auStack_18; puVar2 = auStack_18; while (puVar6 != auStack_18 + -(uVar4 & 0xfffffffffffff000)) { puVar5 = puVar2 + -0x1000; *(int8 *)(puVar2 + -8) = *(int8 *)(puVar2 + -8); puVar6 = puVar2 + -0x1000; puVar2 = puVar2 + -0x1000; } uVar4 = (ulong)((uint)uVar4 & 0xff0); lVar1 = -uVar4; if (uVar4 != 0) { *(int8 *)(puVar5 + -8) = *(int8 *)(puVar5 + -8); } *(int8 *)(puVar5 + lVar1) = DAT_00102008; if (1 < param_1) { if (param_1 < 4) { iVar3 = 2; } else { lVar7 = 4; iVar9 = 1; iVar8 = 0; do { iVar8 = iVar9 + iVar8 * 2; iVar3 = (int)lVar7; iVar9 = iVar8 + iVar9 * 2; *(int *)(puVar5 + lVar7 * 4 + lVar1 + -8) = iVar8; *(int *)(puVar5 + lVar7 * 4 + lVar1 + -4) = iVar9; lVar7 = lVar7 + 2; } while ((ulong)((param_1 - 4U >> 1) + 3) * 2 != lVar7); } lVar7 = (long)iVar3; do { *(int *)(puVar5 + lVar7 * 4 + lVar1) = *(int *)(puVar5 + lVar7 * 4 + lVar1 + -4) + *(int *)(puVar5 + lVar7 * 4 + lVar1 + -8) * 2 ; lVar7 = lVar7 + 1; } while ((int)lVar7 <= param_1); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(int8 *)(puVar5 + lVar1 + -8) = 0x101277; __stack_chk_fail(); } return *(int4 *)(puVar5 + (long)param_1 * 4 + lVar1); }
6,904
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct pair { char* name; int value; } Pair; int compare_pairs(const void *a, const void *b) { Pair *pa = (Pair *)a; Pair *pb = (Pair *)b; return (pa->value - pb->value); }
Pair* func0(Pair arr[], int size, int K) { qsort(arr, size, sizeof(Pair), compare_pairs); Pair *res = malloc(K * sizeof(Pair)); for (int i = 0; i < K; ++i) { res[i] = arr[i]; } return res; }
int main() { Pair list1[] = {{"Manjeet", 10}, {"Akshat", 4}, {"Akash", 2}, {"Nikhil", 8}}; Pair list2[] = {{"Sanjeev", 11}, {"Angat", 5}, {"Akash", 3}, {"Nepin", 9}}; Pair list3[] = {{"tanmay", 14}, {"Amer", 11}, {"Ayesha", 9}, {"SKD", 16}}; Pair* result1 = func0(list1, 4, 2); assert(result1[0].value == 2 && result1[1].value == 4); assert(strcmp(result1[0].name, "Akash") == 0); assert(strcmp(result1[1].name, "Akshat") == 0); Pair* result2 = func0(list2, 4, 3); assert(result2[0].value == 3 && result2[1].value == 5 && result2[2].value == 9); assert(strcmp(result2[0].name, "Akash") == 0); assert(strcmp(result2[1].name, "Angat") == 0); assert(strcmp(result2[2].name, "Nepin") == 0); Pair* result3 = func0(list3, 4, 1); assert(result3[0].value == 9); assert(strcmp(result3[0].name, "Ayesha") == 0); free(result1); free(result2); free(result3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %edx,-0x20(%rbp) mov -0x1c(%rbp),%eax movslq %eax,%rsi mov -0x18(%rbp),%rax lea -0x5b(%rip),%rcx mov $0x10,%edx mov %rax,%rdi callq 10b0 <qsort@plt> mov -0x20(%rbp),%eax cltq shl $0x4,%rax mov %rax,%rdi callq 10f0 <malloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0xc(%rbp) jmp 12a8 <func0+0x8b> mov -0xc(%rbp),%eax cltq shl $0x4,%rax mov %rax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0xc(%rbp),%edx movslq %edx,%rdx mov %rdx,%rcx shl $0x4,%rcx mov -0x8(%rbp),%rdx add %rdx,%rcx mov 0x8(%rax),%rdx mov (%rax),%rax mov %rax,(%rcx) mov %rdx,0x8(%rcx) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x20(%rbp),%eax jl 126f <func0+0x52> mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+base], rdi mov [rbp+var_1C], esi mov [rbp+var_20], edx mov eax, [rbp+var_1C] movsxd rsi, eax; nmemb mov rax, [rbp+base] lea rdx, compare_pairs mov rcx, rdx; compar mov edx, 10h; size mov rdi, rax; base call _qsort mov eax, [rbp+var_20] cdqe shl rax, 4 mov rdi, rax; size call _malloc mov [rbp+var_8], rax mov [rbp+var_C], 0 jmp short loc_12AB loc_1272: mov eax, [rbp+var_C] cdqe shl rax, 4 mov rdx, rax mov rax, [rbp+base] add rax, rdx mov edx, [rbp+var_C] movsxd rdx, edx mov rcx, rdx shl rcx, 4 mov rdx, [rbp+var_8] add rcx, rdx mov rdx, [rax+8] mov rax, [rax] mov [rcx], rax mov [rcx+8], rdx add [rbp+var_C], 1 loc_12AB: mov eax, [rbp+var_C] cmp eax, [rbp+var_20] jl short loc_1272 mov rax, [rbp+var_8] leave retn
char * func0(char *a1, int a2, int a3) { char *v3; // rax char *v4; // rcx long long v5; // rdx int i; // [rsp+14h] [rbp-Ch] char *v9; // [rsp+18h] [rbp-8h] qsort(a1, a2, 0x10uLL, compare_pairs); v9 = (char *)malloc(16LL * a3); for ( i = 0; i < a3; ++i ) { v3 = &a1[16 * i]; v4 = &v9[16 * i]; v5 = *((_QWORD *)v3 + 1); *(_QWORD *)v4 = *(_QWORD *)v3; *((_QWORD *)v4 + 1) = v5; } return v9; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x20],EDX MOV EAX,dword ptr [RBP + -0x1c] MOVSXD RSI,EAX MOV RAX,qword ptr [RBP + -0x18] LEA RDX,[0x1011e9] MOV RCX,RDX MOV EDX,0x10 MOV RDI,RAX CALL 0x001010b0 MOV EAX,dword ptr [RBP + -0x20] CDQE SHL RAX,0x4 MOV RDI,RAX CALL 0x001010f0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0xc],0x0 JMP 0x001012ab LAB_00101272: MOV EAX,dword ptr [RBP + -0xc] CDQE SHL RAX,0x4 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX MOV RCX,RDX SHL RCX,0x4 MOV RDX,qword ptr [RBP + -0x8] ADD RCX,RDX MOV RDX,qword ptr [RAX + 0x8] MOV RAX,qword ptr [RAX] MOV qword ptr [RCX],RAX MOV qword ptr [RCX + 0x8],RDX ADD dword ptr [RBP + -0xc],0x1 LAB_001012ab: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x20] JL 0x00101272 MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(void *param_1,int param_2,int param_3) { int8 uVar1; void *pvVar2; int8 *puVar3; int8 *puVar4; int local_14; qsort(param_1,(long)param_2,0x10,compare_pairs); pvVar2 = malloc((long)param_3 << 4); for (local_14 = 0; local_14 < param_3; local_14 = local_14 + 1) { puVar3 = (int8 *)((long)param_1 + (long)local_14 * 0x10); puVar4 = (int8 *)((long)local_14 * 0x10 + (long)pvVar2); uVar1 = puVar3[1]; *puVar4 = *puVar3; puVar4[1] = uVar1; } return pvVar2; }
6,905
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct pair { char* name; int value; } Pair; int compare_pairs(const void *a, const void *b) { Pair *pa = (Pair *)a; Pair *pb = (Pair *)b; return (pa->value - pb->value); }
Pair* func0(Pair arr[], int size, int K) { qsort(arr, size, sizeof(Pair), compare_pairs); Pair *res = malloc(K * sizeof(Pair)); for (int i = 0; i < K; ++i) { res[i] = arr[i]; } return res; }
int main() { Pair list1[] = {{"Manjeet", 10}, {"Akshat", 4}, {"Akash", 2}, {"Nikhil", 8}}; Pair list2[] = {{"Sanjeev", 11}, {"Angat", 5}, {"Akash", 3}, {"Nepin", 9}}; Pair list3[] = {{"tanmay", 14}, {"Amer", 11}, {"Ayesha", 9}, {"SKD", 16}}; Pair* result1 = func0(list1, 4, 2); assert(result1[0].value == 2 && result1[1].value == 4); assert(strcmp(result1[0].name, "Akash") == 0); assert(strcmp(result1[1].name, "Akshat") == 0); Pair* result2 = func0(list2, 4, 3); assert(result2[0].value == 3 && result2[1].value == 5 && result2[2].value == 9); assert(strcmp(result2[0].name, "Akash") == 0); assert(strcmp(result2[1].name, "Angat") == 0); assert(strcmp(result2[2].name, "Nepin") == 0); Pair* result3 = func0(list3, 4, 1); assert(result3[0].value == 9); assert(strcmp(result3[0].name, "Ayesha") == 0); free(result1); free(result2); free(result3); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbx mov %edx,%ebp movslq %esi,%rsi lea -0x24(%rip),%rcx mov $0x10,%edx callq 10a0 <qsort@plt> movslq %ebp,%rdi shl $0x4,%rdi callq 10d0 <malloc@plt> test %ebp,%ebp jle 1229 <func0+0x55> lea -0x1(%rbp),%ecx add $0x1,%rcx shl $0x4,%rcx mov $0x0,%edx movdqu (%rbx,%rdx,1),%xmm0 movups %xmm0,(%rax,%rdx,1) add $0x10,%rdx cmp %rcx,%rdx jne 1217 <func0+0x43> add $0x8,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp push rbx sub rsp, 8 mov rbp, rdi mov ebx, edx movsxd rsi, esi lea rcx, compare_pairs mov edx, 10h call _qsort movsxd rdi, ebx shl rdi, 4 call _malloc test ebx, ebx jle short loc_1245 mov ecx, ebx shl rcx, 4 mov edx, 0 loc_1232: movdqu xmm0, xmmword ptr [rbp+rdx+0] movups xmmword ptr [rax+rdx], xmm0 add rdx, 10h cmp rdx, rcx jnz short loc_1232 loc_1245: add rsp, 8 pop rbx pop rbp retn
long long func0(long long a1, int a2, int a3) { long long result; // rax long long v5; // rdx qsort(a1, a2, 16LL, compare_pairs); result = malloc(16LL * a3); if ( a3 > 0 ) { v5 = 0LL; do { *(__m128i *)(result + v5) = _mm_loadu_si128((const __m128i *)(a1 + v5)); v5 += 16LL; } while ( v5 != 16LL * (unsigned int)a3 ); } return result; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBP,RDI MOV EBX,EDX MOVSXD RSI,ESI LEA RCX,[0x1011e9] MOV EDX,0x10 CALL 0x001010b0 MOVSXD RDI,EBX SHL RDI,0x4 CALL 0x001010f0 TEST EBX,EBX JLE 0x00101245 MOV ECX,EBX SHL RCX,0x4 MOV EDX,0x0 LAB_00101232: MOVDQU XMM0,xmmword ptr [RBP + RDX*0x1] MOVUPS xmmword ptr [RAX + RDX*0x1],XMM0 ADD RDX,0x10 CMP RDX,RCX JNZ 0x00101232 LAB_00101245: ADD RSP,0x8 POP RBX POP RBP RET
void func0(void *param_1,int param_2,uint param_3) { int8 uVar1; void *pvVar2; long lVar3; qsort(param_1,(long)param_2,0x10,compare_pairs); pvVar2 = malloc((long)(int)param_3 << 4); if (0 < (int)param_3) { lVar3 = 0; do { uVar1 = ((int8 *)((long)param_1 + lVar3))[1]; *(int8 *)((long)pvVar2 + lVar3) = *(int8 *)((long)param_1 + lVar3); ((int8 *)((long)pvVar2 + lVar3))[1] = uVar1; lVar3 = lVar3 + 0x10; } while (lVar3 != (ulong)param_3 << 4); } return; }
6,906
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct pair { char* name; int value; } Pair; int compare_pairs(const void *a, const void *b) { Pair *pa = (Pair *)a; Pair *pb = (Pair *)b; return (pa->value - pb->value); }
Pair* func0(Pair arr[], int size, int K) { qsort(arr, size, sizeof(Pair), compare_pairs); Pair *res = malloc(K * sizeof(Pair)); for (int i = 0; i < K; ++i) { res[i] = arr[i]; } return res; }
int main() { Pair list1[] = {{"Manjeet", 10}, {"Akshat", 4}, {"Akash", 2}, {"Nikhil", 8}}; Pair list2[] = {{"Sanjeev", 11}, {"Angat", 5}, {"Akash", 3}, {"Nepin", 9}}; Pair list3[] = {{"tanmay", 14}, {"Amer", 11}, {"Ayesha", 9}, {"SKD", 16}}; Pair* result1 = func0(list1, 4, 2); assert(result1[0].value == 2 && result1[1].value == 4); assert(strcmp(result1[0].name, "Akash") == 0); assert(strcmp(result1[1].name, "Akshat") == 0); Pair* result2 = func0(list2, 4, 3); assert(result2[0].value == 3 && result2[1].value == 5 && result2[2].value == 9); assert(strcmp(result2[0].name, "Akash") == 0); assert(strcmp(result2[1].name, "Angat") == 0); assert(strcmp(result2[2].name, "Nepin") == 0); Pair* result3 = func0(list3, 4, 1); assert(result3[0].value == 9); assert(strcmp(result3[0].name, "Ayesha") == 0); free(result1); free(result2); free(result3); return 0; }
O2
c
func0: endbr64 push %rbp movslq %esi,%rsi mov %edx,%ebp lea -0x21(%rip),%rcx push %rbx mov $0x10,%edx mov %rdi,%rbx sub $0x8,%rsp callq 10a0 <qsort@plt> movslq %ebp,%rdi shl $0x4,%rdi callq 10d0 <malloc@plt> test %ebp,%ebp jle 15e2 <func0+0x52> lea -0x1(%rbp),%ecx xor %edx,%edx add $0x1,%rcx shl $0x4,%rcx movdqu (%rbx,%rdx,1),%xmm0 movups %xmm0,(%rax,%rdx,1) add $0x10,%rdx cmp %rcx,%rdx jne 15d0 <func0+0x40> add $0x8,%rsp pop %rbx pop %rbp retq nopl 0x0(%rax)
func0: endbr64 push r12 movsxd r12, edx movsxd rsi, esi lea rcx, compare_pairs push rbp mov edx, 10h mov rbp, rdi push rbx mov rbx, r12 shl r12, 4 call _qsort mov rdi, r12 call _malloc mov r8, rax test ebx, ebx jle short loc_15E9 mov rdx, r12 mov rsi, rbp mov rdi, rax call _memcpy mov r8, rax loc_15E9: pop rbx mov rax, r8 pop rbp pop r12 retn
long long func0(long long a1, int a2, int a3) { long long v4; // r12 long long v5; // rax long long v6; // rcx long long v7; // r8 v4 = 16LL * a3; qsort(a1, a2, 16LL, compare_pairs); v5 = malloc(v4); v7 = v5; if ( a3 > 0 ) return memcpy(v5, a1, v4, v6, v5); return v7; }
func0: ENDBR64 PUSH R12 MOVSXD R12,EDX MOVSXD RSI,ESI LEA RCX,[0x101590] PUSH RBP MOV EDX,0x10 MOV RBP,RDI PUSH RBX MOV RBX,R12 SHL R12,0x4 CALL 0x001010c0 MOV RDI,R12 CALL 0x00101110 MOV R8,RAX TEST EBX,EBX JLE 0x001015e9 MOV RDX,R12 MOV RSI,RBP MOV RDI,RAX CALL 0x00101100 MOV R8,RAX LAB_001015e9: POP RBX MOV RAX,R8 POP RBP POP R12 RET
void * func0(void *param_1,int param_2,int param_3) { void *__dest; qsort(param_1,(long)param_2,0x10,compare_pairs); __dest = malloc((long)param_3 << 4); if (0 < param_3) { __dest = memcpy(__dest,param_1,(long)param_3 << 4); } return __dest; }
6,907
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct pair { char* name; int value; } Pair; int compare_pairs(const void *a, const void *b) { Pair *pa = (Pair *)a; Pair *pb = (Pair *)b; return (pa->value - pb->value); }
Pair* func0(Pair arr[], int size, int K) { qsort(arr, size, sizeof(Pair), compare_pairs); Pair *res = malloc(K * sizeof(Pair)); for (int i = 0; i < K; ++i) { res[i] = arr[i]; } return res; }
int main() { Pair list1[] = {{"Manjeet", 10}, {"Akshat", 4}, {"Akash", 2}, {"Nikhil", 8}}; Pair list2[] = {{"Sanjeev", 11}, {"Angat", 5}, {"Akash", 3}, {"Nepin", 9}}; Pair list3[] = {{"tanmay", 14}, {"Amer", 11}, {"Ayesha", 9}, {"SKD", 16}}; Pair* result1 = func0(list1, 4, 2); assert(result1[0].value == 2 && result1[1].value == 4); assert(strcmp(result1[0].name, "Akash") == 0); assert(strcmp(result1[1].name, "Akshat") == 0); Pair* result2 = func0(list2, 4, 3); assert(result2[0].value == 3 && result2[1].value == 5 && result2[2].value == 9); assert(strcmp(result2[0].name, "Akash") == 0); assert(strcmp(result2[1].name, "Angat") == 0); assert(strcmp(result2[2].name, "Nepin") == 0); Pair* result3 = func0(list3, 4, 1); assert(result3[0].value == 9); assert(strcmp(result3[0].name, "Ayesha") == 0); free(result1); free(result2); free(result3); return 0; }
O3
c
func0: endbr64 push %rbp movslq %esi,%rsi lea -0x1f(%rip),%rcx mov %rdi,%rbp push %rbx mov %edx,%ebx mov $0x10,%edx sub $0x8,%rsp callq 10b0 <qsort@plt> movslq %ebx,%rdi shl $0x4,%rdi callq 10f0 <malloc@plt> mov %rax,%r8 test %ebx,%ebx jle 15ff <func0+0x4f> lea -0x1(%rbx),%edx mov %rbp,%rsi mov %rax,%rdi add $0x1,%rdx shl $0x4,%rdx callq 10e0 <memcpy@plt> mov %rax,%r8 add $0x8,%rsp mov %r8,%rax pop %rbx pop %rbp retq nopl 0x0(%rax)
func0: endbr64 push rbp lea rcx, compare_pairs; compar movsxd rsi, esi; nmemb mov rbp, rdi push rbx mov ebx, edx mov edx, 10h; size sub rsp, 8 call _qsort movsxd rdi, ebx shl rdi, 4; size call _malloc mov rcx, rax test ebx, ebx jle short loc_15EA mov edx, ebx mov rsi, rbp; src mov rdi, rax; dest shl rdx, 4; n call _memcpy mov rcx, rax loc_15EA: add rsp, 8 mov rax, rcx pop rbx pop rbp retn
void * func0(void *src, int a2, int a3) { void *v4; // rax void *v5; // rcx qsort(src, a2, 0x10uLL, compare_pairs); v4 = malloc(16LL * a3); v5 = v4; if ( a3 > 0 ) return memcpy(v4, src, 16LL * (unsigned int)a3); return v5; }
func0: ENDBR64 PUSH RBP LEA RCX,[0x101590] MOVSXD RSI,ESI MOV RBP,RDI PUSH RBX MOV EBX,EDX MOV EDX,0x10 SUB RSP,0x8 CALL 0x001010c0 MOVSXD RDI,EBX SHL RDI,0x4 CALL 0x00101110 MOV RCX,RAX TEST EBX,EBX JLE 0x001015ea MOV EDX,EBX MOV RSI,RBP MOV RDI,RAX SHL RDX,0x4 CALL 0x00101100 MOV RCX,RAX LAB_001015ea: ADD RSP,0x8 MOV RAX,RCX POP RBX POP RBP RET
void * func0(void *param_1,int param_2,uint param_3) { void *__dest; qsort(param_1,(long)param_2,0x10,compare_pairs); __dest = malloc((long)(int)param_3 << 4); if (0 < (int)param_3) { __dest = memcpy(__dest,param_1,(ulong)param_3 << 4); } return __dest; }
6,908
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
int* func0(int l1[], int l2[], int l3[], int len, int* resultSize) { int* result = (int*)malloc(len * sizeof(int)); *resultSize = 0; for (int i = 0; i < len; ++i) { if (l1[i] == l2[i] && l2[i] == l3[i]) { result[*resultSize] = l1[i]; (*resultSize)++; } } return result; }
int main() { int resultSize; // Test Case 1 int l1a[] = {1, 1, 3, 4, 5, 6, 7}; int l2a[] = {0, 1, 2, 3, 4, 5, 7}; int l3a[] = {0, 1, 2, 3, 4, 5, 7}; int* result1 = func0(l1a, l2a, l3a, 7, &resultSize); assert(resultSize == 2 && result1[0] == 1 && result1[1] == 7); free(result1); // Test Case 2 int l1b[] = {1, 1, 3, 4, 5, 6, 7}; int l2b[] = {0, 1, 2, 3, 4, 6, 5}; int l3b[] = {0, 1, 2, 3, 4, 6, 7}; int* result2 = func0(l1b, l2b, l3b, 7, &resultSize); assert(resultSize == 2 && result2[0] == 1 && result2[1] == 6); free(result2); // Test Case 3 int l1c[] = {1, 1, 3, 4, 6, 5, 6}; int l2c[] = {0, 1, 2, 3, 4, 5, 7}; int l3c[] = {0, 1, 2, 3, 4, 5, 7}; int* result3 = func0(l1c, l2c, l3c, 7, &resultSize); assert(resultSize == 2 && result3[0] == 1 && result3[1] == 5); free(result3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x40,%rsp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %rdx,-0x28(%rbp) mov %ecx,-0x2c(%rbp) mov %r8,-0x38(%rbp) mov -0x2c(%rbp),%eax cltq shl $0x2,%rax mov %rax,%rdi callq 10b0 <malloc@plt> mov %rax,-0x8(%rbp) mov -0x38(%rbp),%rax movl $0x0,(%rax) movl $0x0,-0xc(%rbp) jmpq 1296 <func0+0xed> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x20(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jne 1292 <func0+0xe9> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x20(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x28(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jne 1292 <func0+0xe9> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x38(%rbp),%rax mov (%rax),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x8(%rbp),%rax add %rax,%rdx mov (%rcx),%eax mov %eax,(%rdx) mov -0x38(%rbp),%rax mov (%rax),%eax lea 0x1(%rax),%edx mov -0x38(%rbp),%rax mov %edx,(%rax) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x2c(%rbp),%eax jl 11f3 <func0+0x4a> mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_28], rdx mov [rbp+var_2C], ecx mov [rbp+var_38], r8 mov eax, [rbp+var_2C] cdqe shl rax, 2 mov rdi, rax; size call _malloc mov [rbp+var_8], rax mov rax, [rbp+var_38] mov dword ptr [rax], 0 mov [rbp+var_C], 0 jmp loc_1296 loc_11F3: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_C] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_20] add rax, rcx mov eax, [rax] cmp edx, eax jnz short loc_1292 mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_20] add rax, rdx mov edx, [rax] mov eax, [rbp+var_C] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rcx mov eax, [rax] cmp edx, eax jnz short loc_1292 mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] lea rcx, [rdx+rax] mov rax, [rbp+var_38] mov eax, [rax] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_8] add rdx, rax mov eax, [rcx] mov [rdx], eax mov rax, [rbp+var_38] mov eax, [rax] lea edx, [rax+1] mov rax, [rbp+var_38] mov [rax], edx loc_1292: add [rbp+var_C], 1 loc_1296: mov eax, [rbp+var_C] cmp eax, [rbp+var_2C] jl loc_11F3 mov rax, [rbp+var_8] leave retn
_DWORD * func0(long long a1, long long a2, long long a3, int a4, _DWORD *a5) { int i; // [rsp+34h] [rbp-Ch] _DWORD *v10; // [rsp+38h] [rbp-8h] v10 = malloc(4LL * a4); *a5 = 0; for ( i = 0; i < a4; ++i ) { if ( *(_DWORD *)(4LL * i + a1) == *(_DWORD *)(4LL * i + a2) && *(_DWORD *)(4LL * i + a2) == *(_DWORD *)(4LL * i + a3) ) { v10[(*a5)++] = *(_DWORD *)(4LL * i + a1); } } return v10; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x2c],ECX MOV qword ptr [RBP + -0x38],R8 MOV EAX,dword ptr [RBP + -0x2c] CDQE SHL RAX,0x2 MOV RDI,RAX CALL 0x001010b0 MOV qword ptr [RBP + -0x8],RAX MOV RAX,qword ptr [RBP + -0x38] MOV dword ptr [RAX],0x0 MOV dword ptr [RBP + -0xc],0x0 JMP 0x00101296 LAB_001011f3: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JNZ 0x00101292 MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JNZ 0x00101292 MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] LEA RCX,[RDX + RAX*0x1] MOV RAX,qword ptr [RBP + -0x38] MOV EAX,dword ptr [RAX] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RDX,RAX MOV EAX,dword ptr [RCX] MOV dword ptr [RDX],EAX MOV RAX,qword ptr [RBP + -0x38] MOV EAX,dword ptr [RAX] LEA EDX,[RAX + 0x1] MOV RAX,qword ptr [RBP + -0x38] MOV dword ptr [RAX],EDX LAB_00101292: ADD dword ptr [RBP + -0xc],0x1 LAB_00101296: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x2c] JL 0x001011f3 MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1,long param_2,long param_3,int param_4,int *param_5) { void *pvVar1; int4 local_14; pvVar1 = malloc((long)param_4 << 2); *param_5 = 0; for (local_14 = 0; local_14 < param_4; local_14 = local_14 + 1) { if ((*(int *)(param_1 + (long)local_14 * 4) == *(int *)(param_2 + (long)local_14 * 4)) && (*(int *)(param_2 + (long)local_14 * 4) == *(int *)(param_3 + (long)local_14 * 4))) { *(int4 *)((long)*param_5 * 4 + (long)pvVar1) = *(int4 *)((long)local_14 * 4 + param_1); *param_5 = *param_5 + 1; } } return pvVar1; }
6,909
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
int* func0(int l1[], int l2[], int l3[], int len, int* resultSize) { int* result = (int*)malloc(len * sizeof(int)); *resultSize = 0; for (int i = 0; i < len; ++i) { if (l1[i] == l2[i] && l2[i] == l3[i]) { result[*resultSize] = l1[i]; (*resultSize)++; } } return result; }
int main() { int resultSize; // Test Case 1 int l1a[] = {1, 1, 3, 4, 5, 6, 7}; int l2a[] = {0, 1, 2, 3, 4, 5, 7}; int l3a[] = {0, 1, 2, 3, 4, 5, 7}; int* result1 = func0(l1a, l2a, l3a, 7, &resultSize); assert(resultSize == 2 && result1[0] == 1 && result1[1] == 7); free(result1); // Test Case 2 int l1b[] = {1, 1, 3, 4, 5, 6, 7}; int l2b[] = {0, 1, 2, 3, 4, 6, 5}; int l3b[] = {0, 1, 2, 3, 4, 6, 7}; int* result2 = func0(l1b, l2b, l3b, 7, &resultSize); assert(resultSize == 2 && result2[0] == 1 && result2[1] == 6); free(result2); // Test Case 3 int l1c[] = {1, 1, 3, 4, 6, 5, 6}; int l2c[] = {0, 1, 2, 3, 4, 5, 7}; int l3c[] = {0, 1, 2, 3, 4, 5, 7}; int* result3 = func0(l1c, l2c, l3c, 7, &resultSize); assert(resultSize == 2 && result3[0] == 1 && result3[1] == 5); free(result3); return 0; }
O1
c
func0: endbr64 push %r14 push %r13 push %r12 push %rbp push %rbx mov %rdi,%rbx mov %rsi,%rbp mov %rdx,%r13 mov %ecx,%r14d mov %r8,%r12 movslq %ecx,%rdi shl $0x2,%rdi callq 10b0 <malloc@plt> movl $0x0,(%r12) test %r14d,%r14d jle 121a <func0+0x71> lea -0x1(%r14),%edi mov $0x0,%edx jmp 11f4 <func0+0x4b> lea 0x1(%rdx),%rcx cmp %rdi,%rdx je 121a <func0+0x71> mov %rcx,%rdx mov (%rbx,%rdx,4),%esi mov 0x0(%rbp,%rdx,4),%ecx cmp %ecx,%esi jne 11e8 <func0+0x3f> cmp 0x0(%r13,%rdx,4),%ecx jne 11e8 <func0+0x3f> mov (%r12),%ecx movslq %ecx,%r8 mov %esi,(%rax,%r8,4) add $0x1,%ecx mov %ecx,(%r12) jmp 11e8 <func0+0x3f> pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq
func0: endbr64 push r14 push r13 push r12 push rbp push rbx mov rbx, rdi mov rbp, rsi mov r13, rdx mov r14d, ecx mov r12, r8 movsxd rdi, ecx shl rdi, 2 call _malloc mov dword ptr [r12], 0 test r14d, r14d jle short loc_1216 mov edi, r14d mov edx, 0 jmp short loc_11F0 loc_11E7: add rdx, 1 cmp rdx, rdi jz short loc_1216 loc_11F0: mov esi, [rbx+rdx*4] mov ecx, [rbp+rdx*4+0] cmp esi, ecx jnz short loc_11E7 cmp ecx, [r13+rdx*4+0] jnz short loc_11E7 mov ecx, [r12] movsxd r8, ecx mov [rax+r8*4], esi add ecx, 1 mov [r12], ecx jmp short loc_11E7 loc_1216: pop rbx pop rbp pop r12 pop r13 pop r14 retn
long long func0(long long a1, long long a2, long long a3, int a4, int *a5) { long long result; // rax long long v10; // rdx int v11; // esi int v12; // ecx int v13; // ecx result = malloc(4LL * a4); *a5 = 0; if ( a4 > 0 ) { v10 = 0LL; do { v11 = *(_DWORD *)(a1 + 4 * v10); v12 = *(_DWORD *)(a2 + 4 * v10); if ( v11 == v12 && v12 == *(_DWORD *)(a3 + 4 * v10) ) { v13 = *a5; *(_DWORD *)(result + 4LL * *a5) = v11; *a5 = v13 + 1; } ++v10; } while ( v10 != a4 ); } return result; }
func0: ENDBR64 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RDI MOV RBP,RSI MOV R13,RDX MOV R14D,ECX MOV R12,R8 MOVSXD RDI,ECX SHL RDI,0x2 CALL 0x001010b0 MOV dword ptr [R12],0x0 TEST R14D,R14D JLE 0x00101216 MOV EDI,R14D MOV EDX,0x0 JMP 0x001011f0 LAB_001011e7: ADD RDX,0x1 CMP RDX,RDI JZ 0x00101216 LAB_001011f0: MOV ESI,dword ptr [RBX + RDX*0x4] MOV ECX,dword ptr [RBP + RDX*0x4] CMP ESI,ECX JNZ 0x001011e7 CMP ECX,dword ptr [R13 + RDX*0x4] JNZ 0x001011e7 MOV ECX,dword ptr [R12] MOVSXD R8,ECX MOV dword ptr [RAX + R8*0x4],ESI ADD ECX,0x1 MOV dword ptr [R12],ECX JMP 0x001011e7 LAB_00101216: POP RBX POP RBP POP R12 POP R13 POP R14 RET
void func0(long param_1,long param_2,long param_3,uint param_4,int *param_5) { int iVar1; int iVar2; void *pvVar3; ulong uVar4; pvVar3 = malloc((long)(int)param_4 << 2); *param_5 = 0; if (0 < (int)param_4) { uVar4 = 0; do { iVar1 = *(int *)(param_1 + uVar4 * 4); iVar2 = *(int *)(param_2 + uVar4 * 4); if ((iVar1 == iVar2) && (iVar2 == *(int *)(param_3 + uVar4 * 4))) { iVar2 = *param_5; *(int *)((long)pvVar3 + (long)iVar2 * 4) = iVar1; *param_5 = iVar2 + 1; } uVar4 = uVar4 + 1; } while (uVar4 != param_4); } return; }
6,910
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
int* func0(int l1[], int l2[], int l3[], int len, int* resultSize) { int* result = (int*)malloc(len * sizeof(int)); *resultSize = 0; for (int i = 0; i < len; ++i) { if (l1[i] == l2[i] && l2[i] == l3[i]) { result[*resultSize] = l1[i]; (*resultSize)++; } } return result; }
int main() { int resultSize; // Test Case 1 int l1a[] = {1, 1, 3, 4, 5, 6, 7}; int l2a[] = {0, 1, 2, 3, 4, 5, 7}; int l3a[] = {0, 1, 2, 3, 4, 5, 7}; int* result1 = func0(l1a, l2a, l3a, 7, &resultSize); assert(resultSize == 2 && result1[0] == 1 && result1[1] == 7); free(result1); // Test Case 2 int l1b[] = {1, 1, 3, 4, 5, 6, 7}; int l2b[] = {0, 1, 2, 3, 4, 6, 5}; int l3b[] = {0, 1, 2, 3, 4, 6, 7}; int* result2 = func0(l1b, l2b, l3b, 7, &resultSize); assert(resultSize == 2 && result2[0] == 1 && result2[1] == 6); free(result2); // Test Case 3 int l1c[] = {1, 1, 3, 4, 6, 5, 6}; int l2c[] = {0, 1, 2, 3, 4, 5, 7}; int l3c[] = {0, 1, 2, 3, 4, 5, 7}; int* result3 = func0(l1c, l2c, l3c, 7, &resultSize); assert(resultSize == 2 && result3[0] == 1 && result3[1] == 5); free(result3); return 0; }
O2
c
func0: endbr64 push %r14 mov %rdx,%r14 push %r13 mov %r8,%r13 push %r12 push %rbp mov %rsi,%rbp push %rbx mov %rdi,%rbx movslq %ecx,%rdi mov %rdi,%r12 shl $0x2,%rdi callq 10b0 <malloc@plt> movl $0x0,0x0(%r13) test %r12d,%r12d jle 1516 <func0+0x76> lea -0x1(%r12),%esi xor %ecx,%ecx jmp 14ec <func0+0x4c> nopl (%rax) lea 0x1(%rcx),%rdi cmp %rcx,%rsi je 1516 <func0+0x76> mov %rdi,%rcx mov (%rbx,%rcx,4),%edi cmp 0x0(%rbp,%rcx,4),%edi jne 14e0 <func0+0x40> cmp (%r14,%rcx,4),%edi jne 14e0 <func0+0x40> movslq 0x0(%r13),%r8 mov %r8,%rdx mov %edi,(%rax,%r8,4) lea 0x1(%rcx),%rdi add $0x1,%edx mov %edx,0x0(%r13) cmp %rcx,%rsi jne 14e9 <func0+0x49> pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq
func0: endbr64 push r15 push r14 mov r14, rdx push r13 mov r13, r8 push r12 movsxd r12, ecx push rbp mov rbp, rsi push rbx mov rbx, rdi lea rdi, ds:0[r12*4] sub rsp, 8 call _malloc mov dword ptr [r13+0], 0 test r12d, r12d jle short loc_1512 xor edx, edx jmp short loc_14E9 loc_14E0: add rdx, 1 cmp rdx, r12 jz short loc_1512 loc_14E9: mov ecx, [rbx+rdx*4] cmp ecx, [rbp+rdx*4+0] jnz short loc_14E0 cmp ecx, [r14+rdx*4] jnz short loc_14E0 movsxd rdi, dword ptr [r13+0] add rdx, 1 mov rsi, rdi mov [rax+rdi*4], ecx add esi, 1 mov [r13+0], esi cmp rdx, r12 jnz short loc_14E9 loc_1512: add rsp, 8 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1, long long a2, long long a3, int a4, int *a5) { long long v7; // r12 long long result; // rax long long v10; // rdx int v11; // ecx int v12; // esi v7 = a4; result = malloc(4LL * a4); *a5 = 0; if ( (int)v7 > 0 ) { v10 = 0LL; do { while ( 1 ) { v11 = *(_DWORD *)(a1 + 4 * v10); if ( v11 == *(_DWORD *)(a2 + 4 * v10) && v11 == *(_DWORD *)(a3 + 4 * v10) ) break; if ( ++v10 == v7 ) return result; } ++v10; v12 = *a5; *(_DWORD *)(result + 4LL * *a5) = v11; *a5 = v12 + 1; } while ( v10 != v7 ); } return result; }
func0: ENDBR64 PUSH R15 PUSH R14 MOV R14,RDX PUSH R13 MOV R13,R8 PUSH R12 MOVSXD R12,ECX PUSH RBP MOV RBP,RSI PUSH RBX MOV RBX,RDI LEA RDI,[R12*0x4] SUB RSP,0x8 CALL 0x001010b0 MOV dword ptr [R13],0x0 TEST R12D,R12D JLE 0x00101512 XOR EDX,EDX JMP 0x001014e9 LAB_001014e0: ADD RDX,0x1 CMP RDX,R12 JZ 0x00101512 LAB_001014e9: MOV ECX,dword ptr [RBX + RDX*0x4] CMP ECX,dword ptr [RBP + RDX*0x4] JNZ 0x001014e0 CMP ECX,dword ptr [R14 + RDX*0x4] JNZ 0x001014e0 MOVSXD RDI,dword ptr [R13] ADD RDX,0x1 MOV RSI,RDI MOV dword ptr [RAX + RDI*0x4],ECX ADD ESI,0x1 MOV dword ptr [R13],ESI CMP RDX,R12 JNZ 0x001014e9 LAB_00101512: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
void func0(long param_1,long param_2,long param_3,int param_4,int *param_5) { int iVar1; int iVar2; void *pvVar3; long lVar4; long lVar5; lVar5 = (long)param_4; pvVar3 = malloc(lVar5 * 4); *param_5 = 0; if (0 < param_4) { lVar4 = 0; do { while ((iVar1 = *(int *)(param_1 + lVar4 * 4), iVar1 == *(int *)(param_2 + lVar4 * 4) && (iVar1 == *(int *)(param_3 + lVar4 * 4)))) { iVar2 = *param_5; lVar4 = lVar4 + 1; *(int *)((long)pvVar3 + (long)iVar2 * 4) = iVar1; *param_5 = iVar2 + 1; if (lVar4 == lVar5) { return; } } lVar4 = lVar4 + 1; } while (lVar4 != lVar5); } return; }
6,911
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
int* func0(int l1[], int l2[], int l3[], int len, int* resultSize) { int* result = (int*)malloc(len * sizeof(int)); *resultSize = 0; for (int i = 0; i < len; ++i) { if (l1[i] == l2[i] && l2[i] == l3[i]) { result[*resultSize] = l1[i]; (*resultSize)++; } } return result; }
int main() { int resultSize; // Test Case 1 int l1a[] = {1, 1, 3, 4, 5, 6, 7}; int l2a[] = {0, 1, 2, 3, 4, 5, 7}; int l3a[] = {0, 1, 2, 3, 4, 5, 7}; int* result1 = func0(l1a, l2a, l3a, 7, &resultSize); assert(resultSize == 2 && result1[0] == 1 && result1[1] == 7); free(result1); // Test Case 2 int l1b[] = {1, 1, 3, 4, 5, 6, 7}; int l2b[] = {0, 1, 2, 3, 4, 6, 5}; int l3b[] = {0, 1, 2, 3, 4, 6, 7}; int* result2 = func0(l1b, l2b, l3b, 7, &resultSize); assert(resultSize == 2 && result2[0] == 1 && result2[1] == 6); free(result2); // Test Case 3 int l1c[] = {1, 1, 3, 4, 6, 5, 6}; int l2c[] = {0, 1, 2, 3, 4, 5, 7}; int l3c[] = {0, 1, 2, 3, 4, 5, 7}; int* result3 = func0(l1c, l2c, l3c, 7, &resultSize); assert(resultSize == 2 && result3[0] == 1 && result3[1] == 5); free(result3); return 0; }
O3
c
func0: endbr64 push %r14 mov %rdx,%r14 push %r13 mov %r8,%r13 push %r12 push %rbp mov %rsi,%rbp push %rbx mov %rdi,%rbx movslq %ecx,%rdi mov %rdi,%r12 shl $0x2,%rdi callq 10b0 <malloc@plt> movl $0x0,0x0(%r13) test %r12d,%r12d jle 14c6 <func0+0x76> lea -0x1(%r12),%esi xor %ecx,%ecx jmp 149c <func0+0x4c> nopl (%rax) lea 0x1(%rcx),%rdi cmp %rsi,%rcx je 14c6 <func0+0x76> mov %rdi,%rcx mov (%rbx,%rcx,4),%edi cmp 0x0(%rbp,%rcx,4),%edi jne 1490 <func0+0x40> cmp (%r14,%rcx,4),%edi jne 1490 <func0+0x40> movslq 0x0(%r13),%r8 mov %r8,%rdx mov %edi,(%rax,%r8,4) lea 0x1(%rcx),%rdi add $0x1,%edx mov %edx,0x0(%r13) cmp %rsi,%rcx jne 1499 <func0+0x49> pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq
func0: endbr64 push r15 push r14 mov r14, rdx push r13 mov r13, r8 push r12 mov r12, rsi push rbp mov rbp, rdi push rbx movsxd rbx, ecx mov r15, rbx shl rbx, 2 mov rdi, rbx; size sub rsp, 8 call _malloc mov dword ptr [r13+0], 0 test r15d, r15d jle short loc_14CB xor edx, edx jmp short loc_14A1 loc_1498: add rdx, 4 cmp rbx, rdx jz short loc_14CB loc_14A1: mov ecx, [rbp+rdx+0] cmp ecx, [r12+rdx] jnz short loc_1498 cmp ecx, [r14+rdx] jnz short loc_1498 movsxd rdi, dword ptr [r13+0] add rdx, 4 mov rsi, rdi mov [rax+rdi*4], ecx add esi, 1 mov [r13+0], esi cmp rbx, rdx jnz short loc_14A1 loc_14CB: add rsp, 8 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
_DWORD * func0(long long a1, long long a2, long long a3, int a4, int *a5) { size_t v9; // rbx _DWORD *result; // rax long long v11; // rdx int v12; // ecx int v13; // esi v9 = 4LL * a4; result = malloc(v9); *a5 = 0; if ( a4 > 0 ) { v11 = 0LL; do { while ( 1 ) { v12 = *(_DWORD *)(a1 + v11); if ( v12 == *(_DWORD *)(a2 + v11) && v12 == *(_DWORD *)(a3 + v11) ) break; v11 += 4LL; if ( v9 == v11 ) return result; } v11 += 4LL; v13 = *a5; result[*a5] = v12; *a5 = v13 + 1; } while ( v9 != v11 ); } return result; }
func0: ENDBR64 PUSH R15 PUSH R14 MOV R14,RDX PUSH R13 MOV R13,R8 PUSH R12 MOV R12,RSI PUSH RBP MOV RBP,RDI PUSH RBX MOVSXD RBX,ECX MOV R15,RBX SHL RBX,0x2 MOV RDI,RBX SUB RSP,0x8 CALL 0x001010b0 MOV dword ptr [R13],0x0 TEST R15D,R15D JLE 0x001014cb XOR EDX,EDX JMP 0x001014a1 LAB_00101498: ADD RDX,0x4 CMP RBX,RDX JZ 0x001014cb LAB_001014a1: MOV ECX,dword ptr [RBP + RDX*0x1] CMP ECX,dword ptr [R12 + RDX*0x1] JNZ 0x00101498 CMP ECX,dword ptr [R14 + RDX*0x1] JNZ 0x00101498 MOVSXD RDI,dword ptr [R13] ADD RDX,0x4 MOV RSI,RDI MOV dword ptr [RAX + RDI*0x4],ECX ADD ESI,0x1 MOV dword ptr [R13],ESI CMP RBX,RDX JNZ 0x001014a1 LAB_001014cb: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
void func0(long param_1,long param_2,long param_3,int param_4,int *param_5) { int iVar1; int iVar2; void *pvVar3; size_t sVar4; size_t __size; __size = (long)param_4 * 4; pvVar3 = malloc(__size); *param_5 = 0; if (0 < param_4) { sVar4 = 0; do { while ((iVar1 = *(int *)(param_1 + sVar4), iVar1 == *(int *)(param_2 + sVar4) && (iVar1 == *(int *)(param_3 + sVar4)))) { iVar2 = *param_5; sVar4 = sVar4 + 4; *(int *)((long)pvVar3 + (long)iVar2 * 4) = iVar1; *param_5 = iVar2 + 1; if (__size == sVar4) { return; } } sVar4 = sVar4 + 4; } while (__size != sVar4); } return; }
6,912
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
double func0(double* numbers, int length) { if (length < 2) { return -9999999; // representing None } int count = 0; for (int i = 0; i < length; i++) { for (int j = i + 1; j < length; j++) { if (numbers[j] == numbers[i]) { count += 1; break; } } } if (length == 2 && count == 1) { return -9999999; // representing None } double* uniq_items = malloc(length * sizeof(double)); int uniq_length = 0; for (int i = 0; i < length; i++) { int found = 0; for (int j = 0; j < uniq_length; j++) { if (uniq_items[j] == numbers[i]) { found = 1; break; } } if (!found) { uniq_items[uniq_length++] = numbers[i]; } } for (int i = 0; i < uniq_length; i++) { for (int j = i + 1; j < uniq_length; j++) { if (uniq_items[i] > uniq_items[j]) { double temp = uniq_items[i]; uniq_items[i] = uniq_items[j]; uniq_items[j] = temp; } } } double result = uniq_items[1]; free(uniq_items); return result; }
int main() { double arr1[] = {1, 2, -8, -2, 0, -2}; double arr2[] = {1, 1, -0.5, 0, 2, -2, -2}; double arr3[] = {2, 2}; assert(func0(arr1, 6) == -2); assert(func0(arr2, 7) == -0.5); assert(func0(arr3, 2) == -9999999); // representing None return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x50,%rsp mov %rdi,-0x48(%rbp) mov %esi,-0x4c(%rbp) cmpl $0x1,-0x4c(%rbp) jg 11cf <func0+0x26> movsd 0xec6(%rip),%xmm0 jmpq 142c <func0+0x283> movl $0x0,-0x3c(%rbp) movl $0x0,-0x38(%rbp) jmp 123c <func0+0x93> mov -0x38(%rbp),%eax add $0x1,%eax mov %eax,-0x34(%rbp) jmp 1230 <func0+0x87> mov -0x34(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x48(%rbp),%rax add %rdx,%rax movsd (%rax),%xmm0 mov -0x38(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x48(%rbp),%rax add %rdx,%rax movsd (%rax),%xmm1 ucomisd %xmm1,%xmm0 jp 122c <func0+0x83> ucomisd %xmm1,%xmm0 jne 122c <func0+0x83> addl $0x1,-0x3c(%rbp) jmp 1238 <func0+0x8f> addl $0x1,-0x34(%rbp) mov -0x34(%rbp),%eax cmp -0x4c(%rbp),%eax jl 11ea <func0+0x41> addl $0x1,-0x38(%rbp) mov -0x38(%rbp),%eax cmp -0x4c(%rbp),%eax jl 11df <func0+0x36> cmpl $0x2,-0x4c(%rbp) jne 125d <func0+0xb4> cmpl $0x1,-0x3c(%rbp) jne 125d <func0+0xb4> movsd 0xe38(%rip),%xmm0 jmpq 142c <func0+0x283> mov -0x4c(%rbp),%eax cltq shl $0x3,%rax mov %rax,%rdi callq 10b0 <malloc@plt> mov %rax,-0x18(%rbp) movl $0x0,-0x30(%rbp) movl $0x0,-0x2c(%rbp) jmpq 1327 <func0+0x17e> movl $0x0,-0x28(%rbp) movl $0x0,-0x24(%rbp) jmp 12de <func0+0x135> mov -0x24(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax movsd (%rax),%xmm0 mov -0x2c(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x48(%rbp),%rax add %rdx,%rax movsd (%rax),%xmm1 ucomisd %xmm1,%xmm0 jp 12da <func0+0x131> ucomisd %xmm1,%xmm0 jne 12da <func0+0x131> movl $0x1,-0x28(%rbp) jmp 12e6 <func0+0x13d> addl $0x1,-0x24(%rbp) mov -0x24(%rbp),%eax cmp -0x30(%rbp),%eax jl 1295 <func0+0xec> cmpl $0x0,-0x28(%rbp) jne 1323 <func0+0x17a> mov -0x2c(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x48(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x30(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x30(%rbp) cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax movsd (%rcx),%xmm0 movsd %xmm0,(%rax) addl $0x1,-0x2c(%rbp) mov -0x2c(%rbp),%eax cmp -0x4c(%rbp),%eax jl 1285 <func0+0xdc> movl $0x0,-0x20(%rbp) jmpq 1401 <func0+0x258> mov -0x20(%rbp),%eax add $0x1,%eax mov %eax,-0x1c(%rbp) jmpq 13f1 <func0+0x248> mov -0x20(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax movsd (%rax),%xmm0 mov -0x1c(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax movsd (%rax),%xmm1 comisd %xmm1,%xmm0 jbe 13ed <func0+0x244> mov -0x20(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax movsd (%rax),%xmm0 movsd %xmm0,-0x8(%rbp) mov -0x1c(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rax,%rdx mov -0x20(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x18(%rbp),%rax add %rcx,%rax movsd (%rdx),%xmm0 movsd %xmm0,(%rax) mov -0x1c(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax movsd -0x8(%rbp),%xmm0 movsd %xmm0,(%rax) addl $0x1,-0x1c(%rbp) mov -0x1c(%rbp),%eax cmp -0x30(%rbp),%eax jl 134d <func0+0x1a4> addl $0x1,-0x20(%rbp) mov -0x20(%rbp),%eax cmp -0x30(%rbp),%eax jl 133f <func0+0x196> mov -0x18(%rbp),%rax movsd 0x8(%rax),%xmm0 movsd %xmm0,-0x10(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 1080 <free@plt> movsd -0x10(%rbp),%xmm0 leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 50h mov [rbp+var_48], rdi mov [rbp+var_4C], esi cmp [rbp+var_4C], 1 jg short loc_11CF movsd xmm0, cs:qword_2078 jmp locret_142C loc_11CF: mov [rbp+var_3C], 0 mov [rbp+var_38], 0 jmp short loc_123C loc_11DF: mov eax, [rbp+var_38] add eax, 1 mov [rbp+var_34], eax jmp short loc_1230 loc_11EA: mov eax, [rbp+var_34] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_48] add rax, rdx movsd xmm0, qword ptr [rax] mov eax, [rbp+var_38] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_48] add rax, rdx movsd xmm1, qword ptr [rax] ucomisd xmm0, xmm1 jp short loc_122C ucomisd xmm0, xmm1 jnz short loc_122C add [rbp+var_3C], 1 jmp short loc_1238 loc_122C: add [rbp+var_34], 1 loc_1230: mov eax, [rbp+var_34] cmp eax, [rbp+var_4C] jl short loc_11EA loc_1238: add [rbp+var_38], 1 loc_123C: mov eax, [rbp+var_38] cmp eax, [rbp+var_4C] jl short loc_11DF cmp [rbp+var_4C], 2 jnz short loc_125D cmp [rbp+var_3C], 1 jnz short loc_125D movsd xmm0, cs:qword_2078 jmp locret_142C loc_125D: mov eax, [rbp+var_4C] cdqe shl rax, 3 mov rdi, rax; size call _malloc mov [rbp+ptr], rax mov [rbp+var_30], 0 mov [rbp+var_2C], 0 jmp loc_1327 loc_1285: mov [rbp+var_28], 0 mov [rbp+var_24], 0 jmp short loc_12DE loc_1295: mov eax, [rbp+var_24] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rdx movsd xmm0, qword ptr [rax] mov eax, [rbp+var_2C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_48] add rax, rdx movsd xmm1, qword ptr [rax] ucomisd xmm0, xmm1 jp short loc_12DA ucomisd xmm0, xmm1 jnz short loc_12DA mov [rbp+var_28], 1 jmp short loc_12E6 loc_12DA: add [rbp+var_24], 1 loc_12DE: mov eax, [rbp+var_24] cmp eax, [rbp+var_30] jl short loc_1295 loc_12E6: cmp [rbp+var_28], 0 jnz short loc_1323 mov eax, [rbp+var_2C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_48] lea rcx, [rdx+rax] mov eax, [rbp+var_30] lea edx, [rax+1] mov [rbp+var_30], edx cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rdx movsd xmm0, qword ptr [rcx] movsd qword ptr [rax], xmm0 loc_1323: add [rbp+var_2C], 1 loc_1327: mov eax, [rbp+var_2C] cmp eax, [rbp+var_4C] jl loc_1285 mov [rbp+var_20], 0 jmp loc_1401 loc_133F: mov eax, [rbp+var_20] add eax, 1 mov [rbp+var_1C], eax jmp loc_13F1 loc_134D: mov eax, [rbp+var_20] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rdx movsd xmm0, qword ptr [rax] mov eax, [rbp+var_1C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rdx movsd xmm1, qword ptr [rax] comisd xmm0, xmm1 jbe short loc_13ED mov eax, [rbp+var_20] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rdx movsd xmm0, qword ptr [rax] movsd [rbp+var_8], xmm0 mov eax, [rbp+var_1C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rdx, rax mov eax, [rbp+var_20] cdqe lea rcx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rcx movsd xmm0, qword ptr [rdx] movsd qword ptr [rax], xmm0 mov eax, [rbp+var_1C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] add rax, rdx movsd xmm0, [rbp+var_8] movsd qword ptr [rax], xmm0 loc_13ED: add [rbp+var_1C], 1 loc_13F1: mov eax, [rbp+var_1C] cmp eax, [rbp+var_30] jl loc_134D add [rbp+var_20], 1 loc_1401: mov eax, [rbp+var_20] cmp eax, [rbp+var_30] jl loc_133F mov rax, [rbp+ptr] movsd xmm0, qword ptr [rax+8] movsd [rbp+var_10], xmm0 mov rax, [rbp+ptr] mov rdi, rax; ptr call _free movsd xmm0, [rbp+var_10] locret_142C: leave retn
double func0(long long a1, int a2) { int v3; // eax int v4; // [rsp+14h] [rbp-3Ch] int i; // [rsp+18h] [rbp-38h] int j; // [rsp+1Ch] [rbp-34h] int v7; // [rsp+20h] [rbp-30h] int k; // [rsp+24h] [rbp-2Ch] int v9; // [rsp+28h] [rbp-28h] int m; // [rsp+2Ch] [rbp-24h] int n; // [rsp+30h] [rbp-20h] int ii; // [rsp+34h] [rbp-1Ch] double *ptr; // [rsp+38h] [rbp-18h] double v14; // [rsp+40h] [rbp-10h] double v15; // [rsp+48h] [rbp-8h] if ( a2 <= 1 ) return -9999999.0; v4 = 0; for ( i = 0; i < a2; ++i ) { for ( j = i + 1; j < a2; ++j ) { if ( *(double *)(8LL * j + a1) == *(double *)(8LL * i + a1) ) { ++v4; break; } } } if ( a2 == 2 && v4 == 1 ) return -9999999.0; ptr = (double *)malloc(8LL * a2); v7 = 0; for ( k = 0; k < a2; ++k ) { v9 = 0; for ( m = 0; m < v7; ++m ) { if ( ptr[m] == *(double *)(8LL * k + a1) ) { v9 = 1; break; } } if ( !v9 ) { v3 = v7++; ptr[v3] = *(double *)(8LL * k + a1); } } for ( n = 0; n < v7; ++n ) { for ( ii = n + 1; ii < v7; ++ii ) { if ( ptr[n] > ptr[ii] ) { v15 = ptr[n]; ptr[n] = ptr[ii]; ptr[ii] = v15; } } } v14 = ptr[1]; free(ptr); return v14; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x50 MOV qword ptr [RBP + -0x48],RDI MOV dword ptr [RBP + -0x4c],ESI CMP dword ptr [RBP + -0x4c],0x1 JG 0x001011cf MOVSD XMM0,qword ptr [0x00102078] JMP 0x0010142c LAB_001011cf: MOV dword ptr [RBP + -0x3c],0x0 MOV dword ptr [RBP + -0x38],0x0 JMP 0x0010123c LAB_001011df: MOV EAX,dword ptr [RBP + -0x38] ADD EAX,0x1 MOV dword ptr [RBP + -0x34],EAX JMP 0x00101230 LAB_001011ea: MOV EAX,dword ptr [RBP + -0x34] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x48] ADD RAX,RDX MOVSD XMM0,qword ptr [RAX] MOV EAX,dword ptr [RBP + -0x38] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x48] ADD RAX,RDX MOVSD XMM1,qword ptr [RAX] UCOMISD XMM0,XMM1 JP 0x0010122c UCOMISD XMM0,XMM1 JNZ 0x0010122c ADD dword ptr [RBP + -0x3c],0x1 JMP 0x00101238 LAB_0010122c: ADD dword ptr [RBP + -0x34],0x1 LAB_00101230: MOV EAX,dword ptr [RBP + -0x34] CMP EAX,dword ptr [RBP + -0x4c] JL 0x001011ea LAB_00101238: ADD dword ptr [RBP + -0x38],0x1 LAB_0010123c: MOV EAX,dword ptr [RBP + -0x38] CMP EAX,dword ptr [RBP + -0x4c] JL 0x001011df CMP dword ptr [RBP + -0x4c],0x2 JNZ 0x0010125d CMP dword ptr [RBP + -0x3c],0x1 JNZ 0x0010125d MOVSD XMM0,qword ptr [0x00102078] JMP 0x0010142c LAB_0010125d: MOV EAX,dword ptr [RBP + -0x4c] CDQE SHL RAX,0x3 MOV RDI,RAX CALL 0x001010b0 MOV qword ptr [RBP + -0x18],RAX MOV dword ptr [RBP + -0x30],0x0 MOV dword ptr [RBP + -0x2c],0x0 JMP 0x00101327 LAB_00101285: MOV dword ptr [RBP + -0x28],0x0 MOV dword ptr [RBP + -0x24],0x0 JMP 0x001012de LAB_00101295: MOV EAX,dword ptr [RBP + -0x24] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVSD XMM0,qword ptr [RAX] MOV EAX,dword ptr [RBP + -0x2c] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x48] ADD RAX,RDX MOVSD XMM1,qword ptr [RAX] UCOMISD XMM0,XMM1 JP 0x001012da UCOMISD XMM0,XMM1 JNZ 0x001012da MOV dword ptr [RBP + -0x28],0x1 JMP 0x001012e6 LAB_001012da: ADD dword ptr [RBP + -0x24],0x1 LAB_001012de: MOV EAX,dword ptr [RBP + -0x24] CMP EAX,dword ptr [RBP + -0x30] JL 0x00101295 LAB_001012e6: CMP dword ptr [RBP + -0x28],0x0 JNZ 0x00101323 MOV EAX,dword ptr [RBP + -0x2c] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x48] LEA RCX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x30] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x30],EDX CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVSD XMM0,qword ptr [RCX] MOVSD qword ptr [RAX],XMM0 LAB_00101323: ADD dword ptr [RBP + -0x2c],0x1 LAB_00101327: MOV EAX,dword ptr [RBP + -0x2c] CMP EAX,dword ptr [RBP + -0x4c] JL 0x00101285 MOV dword ptr [RBP + -0x20],0x0 JMP 0x00101401 LAB_0010133f: MOV EAX,dword ptr [RBP + -0x20] ADD EAX,0x1 MOV dword ptr [RBP + -0x1c],EAX JMP 0x001013f1 LAB_0010134d: MOV EAX,dword ptr [RBP + -0x20] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVSD XMM0,qword ptr [RAX] MOV EAX,dword ptr [RBP + -0x1c] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVSD XMM1,qword ptr [RAX] COMISD XMM0,XMM1 JBE 0x001013ed MOV EAX,dword ptr [RBP + -0x20] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVSD XMM0,qword ptr [RAX] MOVSD qword ptr [RBP + -0x8],XMM0 MOV EAX,dword ptr [RBP + -0x1c] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x20] CDQE LEA RCX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOVSD XMM0,qword ptr [RDX] MOVSD qword ptr [RAX],XMM0 MOV EAX,dword ptr [RBP + -0x1c] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVSD XMM0,qword ptr [RBP + -0x8] MOVSD qword ptr [RAX],XMM0 LAB_001013ed: ADD dword ptr [RBP + -0x1c],0x1 LAB_001013f1: MOV EAX,dword ptr [RBP + -0x1c] CMP EAX,dword ptr [RBP + -0x30] JL 0x0010134d ADD dword ptr [RBP + -0x20],0x1 LAB_00101401: MOV EAX,dword ptr [RBP + -0x20] CMP EAX,dword ptr [RBP + -0x30] JL 0x0010133f MOV RAX,qword ptr [RBP + -0x18] MOVSD XMM0,qword ptr [RAX + 0x8] MOVSD qword ptr [RBP + -0x10],XMM0 MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101080 MOVSD XMM0,qword ptr [RBP + -0x10] LAB_0010142c: LEAVE RET
int8 func0(long param_1,int param_2) { bool bVar1; void *__ptr; int8 uVar2; int local_44; int local_40; int local_3c; int local_38; int local_34; int local_2c; int local_28; int local_24; uVar2 = DAT_00102078; if (1 < param_2) { local_44 = 0; for (local_40 = 0; local_3c = local_40, local_40 < param_2; local_40 = local_40 + 1) { do { local_3c = local_3c + 1; if (param_2 <= local_3c) goto LAB_00101238; } while (*(double *)(param_1 + (long)local_3c * 8) != *(double *)(param_1 + (long)local_40 * 8)); local_44 = local_44 + 1; LAB_00101238: } if ((param_2 != 2) || (local_44 != 1)) { __ptr = malloc((long)param_2 << 3); local_38 = 0; for (local_34 = 0; local_34 < param_2; local_34 = local_34 + 1) { bVar1 = false; for (local_2c = 0; local_2c < local_38; local_2c = local_2c + 1) { if (*(double *)((long)__ptr + (long)local_2c * 8) == *(double *)(param_1 + (long)local_34 * 8)) { bVar1 = true; break; } } if (!bVar1) { *(int8 *)((long)__ptr + (long)local_38 * 8) = *(int8 *)((long)local_34 * 8 + param_1); local_38 = local_38 + 1; } } for (local_28 = 0; local_24 = local_28, local_28 < local_38; local_28 = local_28 + 1) { while (local_24 = local_24 + 1, local_24 < local_38) { if (*(double *)((long)__ptr + (long)local_24 * 8) < *(double *)((long)__ptr + (long)local_28 * 8)) { uVar2 = *(int8 *)((long)__ptr + (long)local_28 * 8); *(int8 *)((long)__ptr + (long)local_28 * 8) = *(int8 *)((long)local_24 * 8 + (long)__ptr); *(int8 *)((long)__ptr + (long)local_24 * 8) = uVar2; } } } uVar2 = *(int8 *)((long)__ptr + 8); free(__ptr); } } return uVar2; }
6,913
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
double func0(double* numbers, int length) { if (length < 2) { return -9999999; // representing None } int count = 0; for (int i = 0; i < length; i++) { for (int j = i + 1; j < length; j++) { if (numbers[j] == numbers[i]) { count += 1; break; } } } if (length == 2 && count == 1) { return -9999999; // representing None } double* uniq_items = malloc(length * sizeof(double)); int uniq_length = 0; for (int i = 0; i < length; i++) { int found = 0; for (int j = 0; j < uniq_length; j++) { if (uniq_items[j] == numbers[i]) { found = 1; break; } } if (!found) { uniq_items[uniq_length++] = numbers[i]; } } for (int i = 0; i < uniq_length; i++) { for (int j = i + 1; j < uniq_length; j++) { if (uniq_items[i] > uniq_items[j]) { double temp = uniq_items[i]; uniq_items[i] = uniq_items[j]; uniq_items[j] = temp; } } } double result = uniq_items[1]; free(uniq_items); return result; }
int main() { double arr1[] = {1, 2, -8, -2, 0, -2}; double arr2[] = {1, 1, -0.5, 0, 2, -2, -2}; double arr3[] = {2, 2}; assert(func0(arr1, 6) == -2); assert(func0(arr2, 7) == -0.5); assert(func0(arr3, 2) == -9999999); // representing None return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx cmp $0x1,%esi jle 1286 <func0+0xdd> mov %rdi,%rbx mov %esi,%ebp mov $0x0,%esi mov $0x0,%r8d mov $0x1,%edi mov $0x1,%eax jmp 11eb <func0+0x42> jne 11fd <func0+0x54> add $0x1,%r8d lea 0x1(%rdi),%eax cmp %eax,%ebp jle 12d3 <func0+0x12a> mov %edi,%esi mov %eax,%edi movslq %eax,%rcx movslq %esi,%rdx movsd (%rbx,%rcx,8),%xmm0 ucomisd (%rbx,%rdx,8),%xmm0 jnp 11d6 <func0+0x2d> add $0x1,%eax cmp %eax,%ebp jg 11eb <func0+0x42> jmp 11dc <func0+0x33> je 129f <func0+0xf6> jmpq 12c8 <func0+0x11f> test %ecx,%ecx jle 1270 <func0+0xc7> lea 0x8(%r8),%rdx lea -0x1(%rcx),%esi mov %esi,%r9d add $0x1,%r9 mov $0x1,%edi lea 0x10(%r8),%r10 jmp 1259 <func0+0xb0> add $0x8,%rax cmp %rcx,%rax je 1251 <func0+0xa8> movsd -0x8(%rdx),%xmm0 movsd (%rax),%xmm1 comisd %xmm1,%xmm0 jbe 122e <func0+0x85> movsd %xmm1,-0x8(%rdx) movsd %xmm0,(%rax) jmp 122e <func0+0x85> add $0x1,%rdi add $0x8,%rdx cmp %r9,%rdi je 1270 <func0+0xc7> mov %esi,%eax sub %edi,%eax lea -0x1(%rdi,%rax,1),%rax lea (%r10,%rax,8),%rcx mov %rdx,%rax jmp 1237 <func0+0x8e> mov 0x8(%r8),%r12 mov %r8,%rdi callq 1080 <free@plt> movq %r12,%xmm0 pop %rbx pop %rbp pop %r12 retq mov 0xe03(%rip),%r12 jmp 127c <func0+0xd3> movslq %ecx,%rax movsd (%rsi),%xmm0 movsd %xmm0,(%r8,%rax,8) lea 0x1(%rcx),%ecx add $0x8,%rsi cmp %rdi,%rsi je 1211 <func0+0x68> test %ecx,%ecx jle 128f <func0+0xe6> movsd (%rsi),%xmm0 mov %r8,%rax lea -0x1(%rcx),%edx lea (%r9,%rdx,8),%rdx ucomisd (%rax),%xmm0 jnp 1206 <func0+0x5d> add $0x8,%rax cmp %rdx,%rax jne 12be <func0+0x115> jmp 128f <func0+0xe6> cmp $0x2,%ebp jne 12e5 <func0+0x13c> mov 0xdb1(%rip),%r12 cmp $0x1,%r8d je 127c <func0+0xd3> movslq %ebp,%rdi shl $0x3,%rdi callq 10b0 <malloc@plt> mov %rax,%r8 mov %rbx,%rsi lea -0x1(%rbp),%eax lea 0x8(%rbx,%rax,8),%rdi mov $0x0,%ecx lea 0x8(%r8),%r9 jmp 12ac <func0+0x103>
func0: endbr64 push r12 push rbp push rbx cmp esi, 1 jle loc_1278 mov rbx, rdi mov ebp, esi mov esi, 0 mov r8d, 0 mov edi, 1 mov eax, 1 jmp short loc_11E9 loc_11D6: add r8d, 1 loc_11DA: lea eax, [rdi+1] cmp ebp, eax jle loc_12C3 mov esi, edi mov edi, eax loc_11E9: movsxd rcx, eax movsxd rdx, esi movsd xmm0, qword ptr [rbx+rcx*8] ucomisd xmm0, qword ptr [rbx+rdx*8] jp short loc_11FD jz short loc_11D6 loc_11FD: add eax, 1 cmp ebp, eax jg short loc_11E9 jmp short loc_11DA loc_1206: test ecx, ecx jle short loc_1262 lea rdx, [r8+8] lea r10d, [rcx-1] mov esi, ecx mov edi, 1 lea r9, [r8+10h] jmp short loc_124A loc_121F: add rax, 8 cmp rax, rcx jz short loc_1242 loc_1228: movsd xmm0, qword ptr [rdx-8] movsd xmm1, qword ptr [rax] comisd xmm0, xmm1 jbe short loc_121F movsd qword ptr [rdx-8], xmm1 movsd qword ptr [rax], xmm0 jmp short loc_121F loc_1242: add rdi, 1 add rdx, 8 loc_124A: cmp rdi, rsi jz short loc_1262 mov eax, r10d sub eax, edi lea rax, [rdi+rax-1] lea rcx, [r9+rax*8] mov rax, rdx jmp short loc_1228 loc_1262: mov r12, [r8+8] mov rdi, r8 call _free loc_126E: movq xmm0, r12 pop rbx pop rbp pop r12 retn loc_1278: mov r12, cs:qword_2070 jmp short loc_126E loc_1281: movsxd rax, ecx movsd xmm0, qword ptr [rsi] movsd qword ptr [r8+rax*8], xmm0 lea ecx, [rcx+1] loc_1291: add rsi, 8 cmp rsi, rdi jz loc_1206 loc_129E: test ecx, ecx jle short loc_1281 movsd xmm0, qword ptr [rsi] mov rax, r8 lea edx, [rcx-1] lea rdx, [r9+rdx*8] loc_12B0: ucomisd xmm0, qword ptr [rax] jp short loc_12B8 jz short loc_1291 loc_12B8: add rax, 8 cmp rax, rdx jnz short loc_12B0 jmp short loc_1281 loc_12C3: cmp ebp, 2 jnz short loc_12D5 mov r12, cs:qword_2070 cmp r8d, 1 jz short loc_126E loc_12D5: movsxd rdi, ebp shl rdi, 3 call _malloc mov r8, rax mov rsi, rbx lea eax, [rbp-1] lea rdi, [rbx+rax*8+8] mov ecx, 0 lea r9, [r8+8] jmp short loc_129E
double func0(_QWORD *a1, int a2) { long long v4; // rsi long long v5; // r8 unsigned int v6; // edi int v7; // eax long long v8; // rcx _QWORD *v9; // rdx long long i; // rdi _QWORD *v11; // rax double v12; // xmm0_8 double v13; // r12 int v15; // ecx _QWORD *v16; // rsi double *v17; // rax long long v18; // r8 if ( a2 <= 1 ) return -9999999.0; v4 = 0LL; v5 = 0LL; v6 = 1; v7 = 1; while ( 1 ) { do { v8 = v7; if ( *(double *)&a1[v7] == *(double *)&a1[(int)v4] ) { v5 = (unsigned int)(v5 + 1); break; } ++v7; } while ( a2 > v7 ); v7 = v6 + 1; if ( a2 <= (int)(v6 + 1) ) break; v4 = v6++; } if ( a2 != 2 || (v13 = -9999999.0, (_DWORD)v5 != 1) ) { v18 = malloc(8LL * a2, v4, (int)v4, v8, v5); v16 = a1; v15 = 0; do { if ( v15 <= 0 ) { LABEL_20: *(_QWORD *)(v18 + 8LL * v15++) = *v16; } else { v17 = (double *)v18; while ( *(double *)v16 != *v17 ) { if ( ++v17 == (double *)(v18 + 8 + 8LL * (unsigned int)(v15 - 1)) ) goto LABEL_20; } } ++v16; } while ( v16 != &a1[(unsigned int)(a2 - 1) + 1] ); if ( v15 > 0 ) { v9 = (_QWORD *)(v18 + 8); for ( i = 1LL; i != v15; ++i ) { v11 = v9; do { v12 = *((double *)v9 - 1); if ( v12 > *(double *)v11 ) { *(v9 - 1) = *v11; *(double *)v11 = v12; } ++v11; } while ( v11 != (_QWORD *)(v18 + 16 + 8 * (i + (unsigned int)(v15 - 1 - i) - 1)) ); ++v9; } } v13 = *(double *)(v18 + 8); free(v18); } return v13; }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX CMP ESI,0x1 JLE 0x00101278 MOV RBX,RDI MOV EBP,ESI MOV ESI,0x0 MOV R8D,0x0 MOV EDI,0x1 MOV EAX,0x1 JMP 0x001011e9 LAB_001011d6: ADD R8D,0x1 LAB_001011da: LEA EAX,[RDI + 0x1] CMP EBP,EAX JLE 0x001012c3 MOV ESI,EDI MOV EDI,EAX LAB_001011e9: MOVSXD RCX,EAX MOVSXD RDX,ESI MOVSD XMM0,qword ptr [RBX + RCX*0x8] UCOMISD XMM0,qword ptr [RBX + RDX*0x8] JP 0x001011fd JZ 0x001011d6 LAB_001011fd: ADD EAX,0x1 CMP EBP,EAX JG 0x001011e9 JMP 0x001011da LAB_00101206: TEST ECX,ECX JLE 0x00101262 LEA RDX,[R8 + 0x8] LEA R10D,[RCX + -0x1] MOV ESI,ECX MOV EDI,0x1 LEA R9,[R8 + 0x10] JMP 0x0010124a LAB_0010121f: ADD RAX,0x8 CMP RAX,RCX JZ 0x00101242 LAB_00101228: MOVSD XMM0,qword ptr [RDX + -0x8] MOVSD XMM1,qword ptr [RAX] COMISD XMM0,XMM1 JBE 0x0010121f MOVSD qword ptr [RDX + -0x8],XMM1 MOVSD qword ptr [RAX],XMM0 JMP 0x0010121f LAB_00101242: ADD RDI,0x1 ADD RDX,0x8 LAB_0010124a: CMP RDI,RSI JZ 0x00101262 MOV EAX,R10D SUB EAX,EDI LEA RAX,[RDI + RAX*0x1 + -0x1] LEA RCX,[R9 + RAX*0x8] MOV RAX,RDX JMP 0x00101228 LAB_00101262: MOV R12,qword ptr [R8 + 0x8] MOV RDI,R8 CALL 0x00101080 LAB_0010126e: MOVQ XMM0,R12 POP RBX POP RBP POP R12 RET LAB_00101278: MOV R12,qword ptr [0x00102070] JMP 0x0010126e LAB_00101281: MOVSXD RAX,ECX MOVSD XMM0,qword ptr [RSI] MOVSD qword ptr [R8 + RAX*0x8],XMM0 LEA ECX,[RCX + 0x1] LAB_00101291: ADD RSI,0x8 CMP RSI,RDI JZ 0x00101206 LAB_0010129e: TEST ECX,ECX JLE 0x00101281 MOVSD XMM0,qword ptr [RSI] MOV RAX,R8 LEA EDX,[RCX + -0x1] LEA RDX,[R9 + RDX*0x8] LAB_001012b0: UCOMISD XMM0,qword ptr [RAX] JP 0x001012b8 JZ 0x00101291 LAB_001012b8: ADD RAX,0x8 CMP RAX,RDX JNZ 0x001012b0 JMP 0x00101281 LAB_001012c3: CMP EBP,0x2 JNZ 0x001012d5 MOV R12,qword ptr [0x00102070] CMP R8D,0x1 JZ 0x0010126e LAB_001012d5: MOVSXD RDI,EBP SHL RDI,0x3 CALL 0x001010b0 MOV R8,RAX MOV RSI,RBX LEA EAX,[RBP + -0x1] LEA RDI,[RBX + RAX*0x8 + 0x8] MOV ECX,0x0 LEA R9,[R8 + 0x8] JMP 0x0010129e
double func0(double *param_1,int param_2) { double *pdVar1; int iVar2; int iVar3; double *pdVar4; double *__ptr; uint uVar5; int iVar6; int iVar7; ulong uVar8; int iVar9; double dVar10; dVar10 = DAT_00102070; if (1 < param_2) { iVar9 = 0; iVar3 = 1; iVar2 = 1; iVar6 = 0; LAB_001011e9: do { iVar7 = iVar2; if (param_1[iVar3] == param_1[iVar6]) { iVar9 = iVar9 + 1; } else { iVar3 = iVar3 + 1; iVar2 = iVar7; if (iVar3 < param_2) goto LAB_001011e9; } iVar3 = iVar7 + 1; iVar2 = iVar3; iVar6 = iVar7; } while (iVar3 < param_2); if ((param_2 != 2) || (iVar9 != 1)) { __ptr = (double *)malloc((long)param_2 << 3); pdVar1 = param_1 + (ulong)(param_2 - 1) + 1; uVar5 = 0; do { if (0 < (int)uVar5) { pdVar4 = __ptr; do { if (*param_1 == *pdVar4) goto LAB_00101291; pdVar4 = pdVar4 + 1; } while (pdVar4 != __ptr + (ulong)(uVar5 - 1) + 1); } __ptr[(int)uVar5] = *param_1; uVar5 = uVar5 + 1; LAB_00101291: param_1 = param_1 + 1; } while (param_1 != pdVar1); if (0 < (int)uVar5) { pdVar1 = __ptr; for (uVar8 = 1; uVar8 != uVar5; uVar8 = uVar8 + 1) { pdVar4 = pdVar1 + 1; do { dVar10 = *pdVar1; if (*pdVar4 < dVar10) { *pdVar1 = *pdVar4; *pdVar4 = dVar10; } pdVar4 = pdVar4 + 1; } while (pdVar4 != __ptr + uVar8 + ((uVar5 - 1) - (int)uVar8) + 1); pdVar1 = pdVar1 + 1; } } dVar10 = __ptr[1]; free(__ptr); } } return dVar10; }
6,914
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
double func0(double* numbers, int length) { if (length < 2) { return -9999999; // representing None } int count = 0; for (int i = 0; i < length; i++) { for (int j = i + 1; j < length; j++) { if (numbers[j] == numbers[i]) { count += 1; break; } } } if (length == 2 && count == 1) { return -9999999; // representing None } double* uniq_items = malloc(length * sizeof(double)); int uniq_length = 0; for (int i = 0; i < length; i++) { int found = 0; for (int j = 0; j < uniq_length; j++) { if (uniq_items[j] == numbers[i]) { found = 1; break; } } if (!found) { uniq_items[uniq_length++] = numbers[i]; } } for (int i = 0; i < uniq_length; i++) { for (int j = i + 1; j < uniq_length; j++) { if (uniq_items[i] > uniq_items[j]) { double temp = uniq_items[i]; uniq_items[i] = uniq_items[j]; uniq_items[j] = temp; } } } double result = uniq_items[1]; free(uniq_items); return result; }
int main() { double arr1[] = {1, 2, -8, -2, 0, -2}; double arr2[] = {1, 1, -0.5, 0, 2, -2, -2}; double arr3[] = {2, 2}; assert(func0(arr1, 6) == -2); assert(func0(arr2, 7) == -0.5); assert(func0(arr3, 2) == -9999999); // representing None return 0; }
O2
c
func0: endbr64 cmp $0x1,%esi jle 1491 <func0+0x161> push %rbp mov $0x1,%ecx mov %esi,%ebp mov $0x1,%eax push %rbx xor %esi,%esi mov %rdi,%rbx sub $0x18,%rsp movsd (%rdi),%xmm0 jmp 1367 <func0+0x37> nopw 0x0(%rax,%rax,1) add $0x1,%eax cmp %eax,%ebp jle 1376 <func0+0x46> movslq %eax,%rdx ucomisd (%rbx,%rdx,8),%xmm0 jp 1360 <func0+0x30> jne 1360 <func0+0x30> add $0x1,%esi lea 0x1(%rcx),%eax cmp %eax,%ebp jle 1387 <func0+0x57> movsd (%rbx,%rcx,8),%xmm0 movslq %eax,%rcx jmp 1367 <func0+0x37> cmp $0x2,%ebp jne 13a0 <func0+0x70> movsd 0xcfc(%rip),%xmm0 cmp $0x1,%esi jne 13a0 <func0+0x70> add $0x18,%rsp pop %rbx pop %rbp retq movslq %ebp,%rdi shl $0x3,%rdi callq 10b0 <malloc@plt> xor %esi,%esi mov %rax,%r8 lea -0x1(%rbp),%eax lea 0x8(%rbx,%rax,8),%rdi lea 0x8(%r8),%rdx nopl (%rax) movsd (%rbx),%xmm0 test %esi,%esi je 1480 <func0+0x150> lea -0x1(%rsi),%ecx mov %r8,%rax lea (%rdx,%rcx,8),%rcx jmp 13ed <func0+0xbd> nopl 0x0(%rax,%rax,1) add $0x8,%rax cmp %rax,%rcx je 1480 <func0+0x150> ucomisd (%rax),%xmm0 jp 13e0 <func0+0xb0> jne 13e0 <func0+0xb0> add $0x8,%rbx cmp %rdi,%rbx jne 13c0 <func0+0x90> lea -0x1(%rsi),%r9d mov $0x1,%edi lea 0x10(%r8),%r10 mov %r9,%rsi add $0x1,%r9 cmp %rdi,%r9 je 145e <func0+0x12e> nopw 0x0(%rax,%rax,1) mov %esi,%eax sub %edi,%eax lea -0x1(%rdi,%rax,1),%rax lea (%r10,%rax,8),%rcx mov %rdx,%rax movsd -0x8(%rdx),%xmm0 movsd (%rax),%xmm1 comisd %xmm1,%xmm0 jbe 1448 <func0+0x118> movsd %xmm1,-0x8(%rdx) movsd %xmm0,(%rax) add $0x8,%rax cmp %rax,%rcx jne 1430 <func0+0x100> add $0x1,%rdi add $0x8,%rdx cmp %rdi,%r9 jne 1420 <func0+0xf0> movsd 0x8(%r8),%xmm0 mov %r8,%rdi movsd %xmm0,0x8(%rsp) callq 1080 <free@plt> movsd 0x8(%rsp),%xmm0 add $0x18,%rsp pop %rbx pop %rbp retq movslq %esi,%rax add $0x1,%esi movsd %xmm0,(%r8,%rax,8) jmpq 13f5 <func0+0xc5> movsd 0xbf7(%rip),%xmm0 retq nopw 0x0(%rax,%rax,1)
func0_part_0: push rbp mov ebp, esi push rbx sub rsp, 18h test esi, esi jle loc_149E movsxd rcx, esi mov edx, 1 mov rbx, rdi xor esi, esi cmp rdx, rcx jz short loc_1385 nop word ptr [rax+rax+00h] loc_1358: movsd xmm0, qword ptr [rbx+rdx*8-8] mov rax, rdx jmp short loc_1370 loc_1368: add rax, 1 cmp ebp, eax jle short loc_137C loc_1370: ucomisd xmm0, qword ptr [rbx+rax*8] jp short loc_1368 jnz short loc_1368 add esi, 1 loc_137C: add rdx, 1 cmp rdx, rcx jnz short loc_1358 loc_1385: cmp ebp, 2 jnz short loc_139E movsd xmm0, cs:qword_2070 cmp esi, 1 jnz short loc_139E add rsp, 18h pop rbx pop rbp retn loc_139E: lea rdi, ds:0[rcx*8] call _malloc xor esi, esi mov r8, rax lea eax, [rbp-1] lea rdi, [rbx+rax*8+8] lea rdx, [r8+8] nop dword ptr [rax+00h] loc_13C0: movsd xmm0, qword ptr [rbx] test esi, esi jz loc_1480 lea ecx, [rsi-1] mov rax, r8 lea rcx, [rdx+rcx*8] jmp short loc_13ED loc_13E0: add rax, 8 cmp rax, rcx jz loc_1480 loc_13ED: ucomisd xmm0, qword ptr [rax] jp short loc_13E0 jnz short loc_13E0 add rbx, 8 cmp rbx, rdi jnz short loc_13C0 loc_13FE: mov edi, 1 lea r10d, [rsi-1] lea r9, [r8+10h] cmp rsi, rdi jz short loc_1456 loc_1410: mov eax, r10d sub eax, edi lea rax, [rdi+rax-1] lea rcx, [r9+rax*8] mov rax, rdx nop dword ptr [rax+00000000h] loc_1428: movsd xmm0, qword ptr [rdx-8] movsd xmm1, qword ptr [rax] comisd xmm0, xmm1 jbe short loc_1440 movsd qword ptr [rdx-8], xmm1 movsd qword ptr [rax], xmm0 loc_1440: add rax, 8 cmp rcx, rax jnz short loc_1428 add rdi, 1 add rdx, 8 cmp rsi, rdi jnz short loc_1410 loc_1456: movsd xmm0, qword ptr [r8+8] mov rdi, r8 movsd [rsp+28h+var_20], xmm0 call _free movsd xmm0, [rsp+28h+var_20] add rsp, 18h pop rbx pop rbp retn loc_1480: movsxd rax, esi add rbx, 8 add esi, 1 movsd qword ptr [r8+rax*8], xmm0 cmp rbx, rdi jnz loc_13C0 jmp loc_13FE loc_149E: movsxd rdi, esi shl rdi, 3 call _malloc mov r8, rax jmp short loc_1456
double func0_part_0(double *a1, long long a2) { int v2; // ebp long long v3; // rcx long long v4; // rdx double *v5; // rbx int i; // esi long long v7; // rax double result; // xmm0_8 long long v9; // rcx long long v10; // r8 long long v11; // rdi _QWORD *v12; // rdx double v13; // xmm0_8 double *v14; // rax long long j; // rdi _QWORD *v16; // rax double v17; // xmm0_8 long long v18; // rax double v19; // [rsp+8h] [rbp-20h] v2 = a2; if ( (int)a2 <= 0 ) { v10 = malloc(8LL * (int)a2); LABEL_22: v19 = *(double *)(v10 + 8); free(v10, a2, v12, v9); return v19; } v3 = (int)a2; v4 = 1LL; v5 = a1; for ( i = 0; v4 != v3; ++v4 ) { v7 = v4; while ( a1[v4 - 1] != a1[v7] ) { if ( v2 <= (int)++v7 ) goto LABEL_7; } ++i; LABEL_7: ; } if ( v2 != 2 || (result = -9999999.0, i != 1) ) { a2 = 0LL; v10 = malloc(8 * v3); v11 = (long long)&a1[(unsigned int)(v2 - 1) + 1]; v12 = (_QWORD *)(v10 + 8); do { while ( 1 ) { v13 = *v5; if ( (_DWORD)a2 ) break; LABEL_23: v18 = (int)a2; ++v5; a2 = (unsigned int)(a2 + 1); *(double *)(v10 + 8 * v18) = v13; if ( v5 == (double *)v11 ) goto LABEL_16; } v14 = (double *)v10; v9 = (long long)&v12[(unsigned int)(a2 - 1)]; while ( v13 != *v14 ) { if ( ++v14 == (double *)v9 ) goto LABEL_23; } ++v5; } while ( v5 != (double *)v11 ); LABEL_16: for ( j = 1LL; a2 != j; ++v12 ) { v9 = v10 + 16 + 8 * (j + (unsigned int)(a2 - 1 - j) - 1); v16 = v12; do { v17 = *((double *)v12 - 1); if ( v17 > *(double *)v16 ) { *(v12 - 1) = *v16; *(double *)v16 = v17; } ++v16; } while ( (_QWORD *)v9 != v16 ); ++j; } goto LABEL_22; } return result; }
func0.part.0: PUSH RBP MOV EBP,ESI PUSH RBX SUB RSP,0x18 TEST ESI,ESI JLE 0x0010149e MOVSXD RCX,ESI MOV EDX,0x1 MOV RBX,RDI XOR ESI,ESI CMP RDX,RCX JZ 0x00101385 NOP word ptr [RAX + RAX*0x1] LAB_00101358: MOVSD XMM0,qword ptr [RBX + RDX*0x8 + -0x8] MOV RAX,RDX JMP 0x00101370 LAB_00101368: ADD RAX,0x1 CMP EBP,EAX JLE 0x0010137c LAB_00101370: UCOMISD XMM0,qword ptr [RBX + RAX*0x8] JP 0x00101368 JNZ 0x00101368 ADD ESI,0x1 LAB_0010137c: ADD RDX,0x1 CMP RDX,RCX JNZ 0x00101358 LAB_00101385: CMP EBP,0x2 JNZ 0x0010139e MOVSD XMM0,qword ptr [0x00102070] CMP ESI,0x1 JNZ 0x0010139e ADD RSP,0x18 POP RBX POP RBP RET LAB_0010139e: LEA RDI,[RCX*0x8] CALL 0x001010b0 XOR ESI,ESI MOV R8,RAX LEA EAX,[RBP + -0x1] LEA RDI,[RBX + RAX*0x8 + 0x8] LEA RDX,[R8 + 0x8] NOP dword ptr [RAX] LAB_001013c0: MOVSD XMM0,qword ptr [RBX] TEST ESI,ESI JZ 0x00101480 LEA ECX,[RSI + -0x1] MOV RAX,R8 LEA RCX,[RDX + RCX*0x8] JMP 0x001013ed LAB_001013e0: ADD RAX,0x8 CMP RAX,RCX JZ 0x00101480 LAB_001013ed: UCOMISD XMM0,qword ptr [RAX] JP 0x001013e0 JNZ 0x001013e0 ADD RBX,0x8 CMP RBX,RDI JNZ 0x001013c0 LAB_001013fe: MOV EDI,0x1 LEA R10D,[RSI + -0x1] LEA R9,[R8 + 0x10] CMP RSI,RDI JZ 0x00101456 LAB_00101410: MOV EAX,R10D SUB EAX,EDI LEA RAX,[RDI + RAX*0x1 + -0x1] LEA RCX,[R9 + RAX*0x8] MOV RAX,RDX NOP dword ptr [RAX] LAB_00101428: MOVSD XMM0,qword ptr [RDX + -0x8] MOVSD XMM1,qword ptr [RAX] COMISD XMM0,XMM1 JBE 0x00101440 MOVSD qword ptr [RDX + -0x8],XMM1 MOVSD qword ptr [RAX],XMM0 LAB_00101440: ADD RAX,0x8 CMP RCX,RAX JNZ 0x00101428 ADD RDI,0x1 ADD RDX,0x8 CMP RSI,RDI JNZ 0x00101410 LAB_00101456: MOVSD XMM0,qword ptr [R8 + 0x8] MOV RDI,R8 MOVSD qword ptr [RSP + 0x8],XMM0 CALL 0x00101080 MOVSD XMM0,qword ptr [RSP + 0x8] ADD RSP,0x18 POP RBX POP RBP RET LAB_00101480: MOVSXD RAX,ESI ADD RBX,0x8 ADD ESI,0x1 MOVSD qword ptr [R8 + RAX*0x8],XMM0 CMP RBX,RDI JNZ 0x001013c0 JMP 0x001013fe LAB_0010149e: MOVSXD RDI,ESI SHL RDI,0x3 CALL 0x001010b0 MOV R8,RAX JMP 0x00101456
double func0_part_0(double *param_1,int param_2) { double dVar1; long lVar2; double *__ptr; double *pdVar3; double *pdVar4; long lVar5; long lVar6; double *pdVar7; int iVar8; ulong uVar9; ulong uVar10; if (param_2 < 1) { __ptr = (double *)malloc((long)param_2 << 3); } else { lVar5 = (long)param_2; lVar6 = 1; iVar8 = 0; if (lVar5 != 1) { do { lVar2 = lVar6; do { if (param_1[lVar6 + -1] == param_1[lVar2]) { iVar8 = iVar8 + 1; break; } lVar2 = lVar2 + 1; } while ((int)lVar2 < param_2); lVar6 = lVar6 + 1; } while (lVar6 != lVar5); } if ((param_2 == 2) && (iVar8 == 1)) { return DAT_00102070; } __ptr = (double *)malloc(lVar5 * 8); uVar9 = 0; pdVar4 = param_1 + (ulong)(param_2 - 1) + 1; pdVar7 = __ptr + 1; LAB_001013c0: do { dVar1 = *param_1; iVar8 = (int)uVar9; if (iVar8 != 0) { pdVar3 = __ptr; do { if (dVar1 == *pdVar3) { param_1 = param_1 + 1; if (param_1 == pdVar4) goto LAB_001013fe; goto LAB_001013c0; } pdVar3 = pdVar3 + 1; } while (pdVar3 != pdVar7 + (iVar8 - 1)); } param_1 = param_1 + 1; uVar9 = (ulong)(iVar8 + 1); __ptr[iVar8] = dVar1; } while (param_1 != pdVar4); LAB_001013fe: uVar10 = 1; if (uVar9 != 1) { do { pdVar4 = pdVar7; do { dVar1 = pdVar7[-1]; if (*pdVar4 < dVar1) { pdVar7[-1] = *pdVar4; *pdVar4 = dVar1; } pdVar4 = pdVar4 + 1; } while (__ptr + uVar10 + (uint)(((int)uVar9 + -1) - (int)uVar10) + 1 != pdVar4); uVar10 = uVar10 + 1; pdVar7 = pdVar7 + 1; } while (uVar9 != uVar10); } } dVar1 = __ptr[1]; free(__ptr); return dVar1; }
6,915
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h>
double func0(double* numbers, int length) { if (length < 2) { return -9999999; // representing None } int count = 0; for (int i = 0; i < length; i++) { for (int j = i + 1; j < length; j++) { if (numbers[j] == numbers[i]) { count += 1; break; } } } if (length == 2 && count == 1) { return -9999999; // representing None } double* uniq_items = malloc(length * sizeof(double)); int uniq_length = 0; for (int i = 0; i < length; i++) { int found = 0; for (int j = 0; j < uniq_length; j++) { if (uniq_items[j] == numbers[i]) { found = 1; break; } } if (!found) { uniq_items[uniq_length++] = numbers[i]; } } for (int i = 0; i < uniq_length; i++) { for (int j = i + 1; j < uniq_length; j++) { if (uniq_items[i] > uniq_items[j]) { double temp = uniq_items[i]; uniq_items[i] = uniq_items[j]; uniq_items[j] = temp; } } } double result = uniq_items[1]; free(uniq_items); return result; }
int main() { double arr1[] = {1, 2, -8, -2, 0, -2}; double arr2[] = {1, 1, -0.5, 0, 2, -2, -2}; double arr3[] = {2, 2}; assert(func0(arr1, 6) == -2); assert(func0(arr2, 7) == -0.5); assert(func0(arr3, 2) == -9999999); // representing None return 0; }
O3
c
func0: endbr64 cmp $0x1,%esi jle 1448 <func0+0x148> push %rbp mov $0x1,%ecx mov %esi,%ebp mov $0x1,%eax push %rbx xor %esi,%esi mov %rdi,%rbx sub $0x18,%rsp movsd (%rdi),%xmm0 jmp 1337 <func0+0x37> nopw 0x0(%rax,%rax,1) add $0x1,%eax cmp %eax,%ebp jle 1346 <func0+0x46> movslq %eax,%rdx ucomisd (%rbx,%rdx,8),%xmm0 jp 1330 <func0+0x30> jne 1330 <func0+0x30> add $0x1,%esi lea 0x1(%rcx),%eax cmp %eax,%ebp jle 1357 <func0+0x57> movsd (%rbx,%rcx,8),%xmm0 movslq %eax,%rcx jmp 1337 <func0+0x37> cmp $0x2,%ebp jne 1370 <func0+0x70> movsd 0xd2c(%rip),%xmm0 cmp $0x1,%esi jne 1370 <func0+0x70> add $0x18,%rsp pop %rbx pop %rbp retq movslq %ebp,%rdi shl $0x3,%rdi callq 10b0 <malloc@plt> xor %ecx,%ecx mov %rax,%rdi lea -0x1(%rbp),%eax lea 0x8(%rbx,%rax,8),%rsi lea 0x8(%rdi),%r8 nopl (%rax) movsd (%rbx),%xmm0 test %ecx,%ecx je 1438 <func0+0x138> lea -0x1(%rcx),%edx mov %rdi,%rax lea (%r8,%rdx,8),%rdx jmp 13b9 <func0+0xb9> nopl 0x0(%rax,%rax,1) add $0x8,%rax cmp %rax,%rdx je 1438 <func0+0x138> ucomisd (%rax),%xmm0 jp 13b0 <func0+0xb0> jne 13b0 <func0+0xb0> add $0x8,%rbx cmp %rbx,%rsi jne 1390 <func0+0x90> cmp $0x1,%ecx jle 1415 <func0+0x115> lea -0x2(%rcx),%r8d mov %rdi,%rdx mov $0x1,%esi add $0x2,%r8 mov %rsi,%rax nopl 0x0(%rax,%rax,1) movsd (%rdx),%xmm0 movsd (%rdi,%rax,8),%xmm1 comisd %xmm1,%xmm0 jbe 1400 <func0+0x100> movsd %xmm1,(%rdx) movsd %xmm0,(%rdi,%rax,8) add $0x1,%rax cmp %eax,%ecx jg 13e8 <func0+0xe8> add $0x1,%rsi add $0x8,%rdx cmp %rsi,%r8 jne 13e0 <func0+0xe0> movsd 0x8(%rdi),%xmm0 movsd %xmm0,0x8(%rsp) callq 1080 <free@plt> movsd 0x8(%rsp),%xmm0 add $0x18,%rsp pop %rbx pop %rbp retq nopw 0x0(%rax,%rax,1) movslq %ecx,%rax add $0x1,%ecx movsd %xmm0,(%rdi,%rax,8) jmpq 13c1 <func0+0xc1> movsd 0xc40(%rip),%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 cmp esi, 1 jle loc_1452 push rbp mov edx, 1 xor ecx, ecx push rbx mov rbx, rdi mov edi, esi sub rsp, 18h nop loc_1330: movsd xmm0, qword ptr [rbx+rdx*8-8] mov rax, rdx jmp short loc_1348 loc_1340: add rax, 1 cmp esi, eax jle short loc_1354 loc_1348: ucomisd xmm0, qword ptr [rbx+rax*8] jp short loc_1340 jnz short loc_1340 add ecx, 1 loc_1354: add rdx, 1 cmp rdx, rdi jnz short loc_1330 cmp esi, 2 jnz short loc_1376 movsd xmm0, cs:qword_2070 cmp ecx, 1 jnz short loc_1376 add rsp, 18h pop rbx pop rbp retn loc_1376: movsxd rdx, esi lea rbp, ds:0[rdx*8] mov rdi, rbp; size call _malloc lea rdx, [rbx+rbp] xor ecx, ecx mov rdi, rax; ptr loc_1392: movsxd r8, ecx movsd xmm0, qword ptr [rbx] lea rsi, [rdi+r8*8] test ecx, ecx jle short loc_13D0 loc_13A1: mov rax, rdi jmp short loc_13B9 loc_13B0: add rax, 8 cmp rsi, rax jz short loc_13D0 loc_13B9: ucomisd xmm0, qword ptr [rax] jp short loc_13B0 jnz short loc_13B0 add rbx, 8 cmp rdx, rbx jz short loc_13E2 movsd xmm0, qword ptr [rbx] jmp short loc_13A1 loc_13D0: add rbx, 8 add ecx, 1 movsd qword ptr [rdi+r8*8], xmm0 cmp rdx, rbx jnz short loc_1392 loc_13E2: test ecx, ecx jle short loc_1435 mov rdx, rdi mov r8d, ecx mov esi, 1 cmp ecx, 1 jz short loc_1435 nop word ptr [rax+rax+00000000h] loc_1400: mov rax, rsi nop dword ptr [rax+rax+00h] loc_1408: movsd xmm0, qword ptr [rdx] movsd xmm1, qword ptr [rdi+rax*8] comisd xmm0, xmm1 jbe short loc_1420 movsd qword ptr [rdx], xmm1 movsd qword ptr [rdi+rax*8], xmm0 loc_1420: add rax, 1 cmp ecx, eax jg short loc_1408 add rsi, 1 add rdx, 8 cmp rsi, r8 jnz short loc_1400 loc_1435: movsd xmm0, qword ptr [rdi+8] movsd [rsp+28h+var_20], xmm0 call _free movsd xmm0, [rsp+28h+var_20] add rsp, 18h pop rbx pop rbp retn loc_1452: movsd xmm0, cs:qword_2070 retn
double func0(double *a1, int a2) { long long v2; // rdx int v3; // ecx double *v4; // rbx long long v5; // rax double result; // xmm0_8 double *v7; // rax double *v8; // rdx int v9; // ecx double *v10; // rdi long long v11; // r8 double v12; // xmm0_8 double *v13; // rax double *v14; // rdx long long v15; // rsi long long v16; // rax double v17; // xmm0_8 double v18; // xmm1_8 double v19; // [rsp+0h] [rbp-20h] if ( a2 <= 1 ) return -9999999.0; v2 = 1LL; v3 = 0; v4 = a1; do { v5 = v2; while ( a1[v2 - 1] != a1[v5] ) { if ( a2 <= (int)++v5 ) goto LABEL_7; } ++v3; LABEL_7: ++v2; } while ( v2 != a2 ); if ( a2 != 2 || (result = -9999999.0, v3 != 1) ) { v7 = (double *)malloc(8LL * a2); v8 = &a1[a2]; v9 = 0; v10 = v7; while ( 1 ) { v11 = v9; v12 = *v4; if ( v9 > 0 ) break; LABEL_17: ++v4; ++v9; v10[v11] = v12; if ( v8 == v4 ) goto LABEL_18; } while ( 1 ) { v13 = v10; while ( v12 != *v13 ) { if ( &v10[v9] == ++v13 ) goto LABEL_17; } if ( v8 == ++v4 ) break; v12 = *v4; } LABEL_18: if ( v9 > 0 ) { v14 = v10; v15 = 1LL; if ( v9 != 1 ) { do { v16 = v15; do { v17 = *v14; v18 = v10[v16]; if ( *v14 > v18 ) { *v14 = v18; v10[v16] = v17; } ++v16; } while ( v9 > (int)v16 ); ++v15; ++v14; } while ( v15 != v9 ); } } v19 = v10[1]; free(v10); return v19; } return result; }
func0: ENDBR64 CMP ESI,0x1 JLE 0x00101452 PUSH RBP MOV EDX,0x1 XOR ECX,ECX PUSH RBX MOV RBX,RDI MOV EDI,ESI SUB RSP,0x18 NOP LAB_00101330: MOVSD XMM0,qword ptr [RBX + RDX*0x8 + -0x8] MOV RAX,RDX JMP 0x00101348 LAB_00101340: ADD RAX,0x1 CMP ESI,EAX JLE 0x00101354 LAB_00101348: UCOMISD XMM0,qword ptr [RBX + RAX*0x8] JP 0x00101340 JNZ 0x00101340 ADD ECX,0x1 LAB_00101354: ADD RDX,0x1 CMP RDX,RDI JNZ 0x00101330 CMP ESI,0x2 JNZ 0x00101376 MOVSD XMM0,qword ptr [0x00102070] CMP ECX,0x1 JNZ 0x00101376 ADD RSP,0x18 POP RBX POP RBP RET LAB_00101376: MOVSXD RDX,ESI LEA RBP,[RDX*0x8] MOV RDI,RBP CALL 0x001010b0 LEA RDX,[RBX + RBP*0x1] XOR ECX,ECX MOV RDI,RAX LAB_00101392: MOVSXD R8,ECX MOVSD XMM0,qword ptr [RBX] LEA RSI,[RDI + R8*0x8] TEST ECX,ECX JLE 0x001013d0 LAB_001013a1: MOV RAX,RDI JMP 0x001013b9 LAB_001013b0: ADD RAX,0x8 CMP RSI,RAX JZ 0x001013d0 LAB_001013b9: UCOMISD XMM0,qword ptr [RAX] JP 0x001013b0 JNZ 0x001013b0 ADD RBX,0x8 CMP RDX,RBX JZ 0x001013e2 MOVSD XMM0,qword ptr [RBX] JMP 0x001013a1 LAB_001013d0: ADD RBX,0x8 ADD ECX,0x1 MOVSD qword ptr [RDI + R8*0x8],XMM0 CMP RDX,RBX JNZ 0x00101392 LAB_001013e2: TEST ECX,ECX JLE 0x00101435 MOV RDX,RDI MOV R8D,ECX MOV ESI,0x1 CMP ECX,0x1 JZ 0x00101435 NOP word ptr CS:[RAX + RAX*0x1] LAB_00101400: MOV RAX,RSI NOP dword ptr [RAX + RAX*0x1] LAB_00101408: MOVSD XMM0,qword ptr [RDX] MOVSD XMM1,qword ptr [RDI + RAX*0x8] COMISD XMM0,XMM1 JBE 0x00101420 MOVSD qword ptr [RDX],XMM1 MOVSD qword ptr [RDI + RAX*0x8],XMM0 LAB_00101420: ADD RAX,0x1 CMP ECX,EAX JG 0x00101408 ADD RSI,0x1 ADD RDX,0x8 CMP RSI,R8 JNZ 0x00101400 LAB_00101435: MOVSD XMM0,qword ptr [RDI + 0x8] MOVSD qword ptr [RSP + 0x8],XMM0 CALL 0x00101080 MOVSD XMM0,qword ptr [RSP + 0x8] ADD RSP,0x18 POP RBX POP RBP RET LAB_00101452: MOVSD XMM0,qword ptr [0x00102070] RET
double func0(double *param_1,uint param_2) { double *__ptr; double *pdVar1; int iVar2; uint uVar3; uint uVar4; ulong uVar5; double *pdVar6; ulong uVar7; double dVar8; if ((int)param_2 < 2) { return DAT_00102070; } uVar5 = 1; iVar2 = 0; do { uVar7 = uVar5; do { if (param_1[uVar5 - 1] == param_1[uVar7]) { iVar2 = iVar2 + 1; break; } uVar7 = uVar7 + 1; } while ((int)uVar7 < (int)param_2); uVar5 = uVar5 + 1; } while (uVar5 != param_2); if ((param_2 == 2) && (iVar2 == 1)) { return DAT_00102070; } __ptr = (double *)malloc((long)(int)param_2 * 8); pdVar6 = param_1 + (int)param_2; uVar3 = 0; do { dVar8 = *param_1; pdVar1 = __ptr; if (0 < (int)uVar3) { do { while (dVar8 == *pdVar1) { param_1 = param_1 + 1; uVar4 = uVar3; if (pdVar6 == param_1) goto LAB_001013e2; pdVar1 = __ptr; dVar8 = *param_1; } pdVar1 = pdVar1 + 1; } while (__ptr + (int)uVar3 != pdVar1); } param_1 = param_1 + 1; uVar4 = uVar3 + 1; __ptr[(int)uVar3] = dVar8; uVar3 = uVar4; } while (pdVar6 != param_1); LAB_001013e2: if (0 < (int)uVar4) { uVar7 = 1; uVar5 = uVar7; pdVar6 = __ptr; if (uVar4 != 1) { do { do { dVar8 = *pdVar6; if (__ptr[uVar7] < dVar8) { *pdVar6 = __ptr[uVar7]; __ptr[uVar7] = dVar8; } uVar7 = uVar7 + 1; } while ((int)uVar7 < (int)uVar4); uVar7 = uVar5 + 1; uVar5 = uVar7; pdVar6 = pdVar6 + 1; } while (uVar7 != uVar4); } } dVar8 = __ptr[1]; free(__ptr); return dVar8; }
6,916
func0
#include <stdio.h> #include <string.h> #include <regex.h> #include <assert.h>
const char* func0(const char* text) { regex_t regex; int ret; const char* result; ret = regcomp(&regex, "ab?", REG_EXTENDED); if (ret) { return "Not matched!"; } ret = regexec(&regex, text, 0, NULL, 0); if (!ret) { result = "Found a match!"; } else { result = "Not matched!"; } regfree(&regex); return result; }
int main() { assert(strcmp(func0("ac"), "Found a match!") == 0); assert(strcmp(func0("dc"), "Not matched!") == 0); assert(strcmp(func0("abbbba"), "Found a match!") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x70,%rsp mov %rdi,-0x68(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea -0x50(%rbp),%rax mov $0x1,%edx lea 0xdf0(%rip),%rsi mov %rax,%rdi callq 10d0 <regcomp@plt> mov %eax,-0x5c(%rbp) cmpl $0x0,-0x5c(%rbp) je 1232 <func0+0x49> lea 0xddc(%rip),%rax jmp 1283 <func0+0x9a> mov -0x68(%rbp),%rsi lea -0x50(%rbp),%rax mov $0x0,%r8d mov $0x0,%ecx mov $0x0,%edx mov %rax,%rdi callq 10f0 <regexec@plt> mov %eax,-0x5c(%rbp) cmpl $0x0,-0x5c(%rbp) jne 1268 <func0+0x7f> lea 0xdb7(%rip),%rax mov %rax,-0x58(%rbp) jmp 1273 <func0+0x8a> lea 0xd9d(%rip),%rax mov %rax,-0x58(%rbp) lea -0x50(%rbp),%rax mov %rax,%rdi callq 10a0 <regfree@plt> mov -0x58(%rbp),%rax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 1297 <func0+0xae> callq 10b0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 70h mov [rbp+string], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea rax, [rbp+preg] mov edx, 1; cflags lea rcx, pattern; "ab?" mov rsi, rcx; pattern mov rdi, rax; preg call _regcomp mov [rbp+var_5C], eax cmp [rbp+var_5C], 0 jz short loc_1235 lea rax, aNotMatched; "Not matched!" jmp short loc_1286 loc_1235: mov rsi, [rbp+string]; string lea rax, [rbp+preg] mov r8d, 0; eflags mov ecx, 0; pmatch mov edx, 0; nmatch mov rdi, rax; preg call _regexec mov [rbp+var_5C], eax cmp [rbp+var_5C], 0 jnz short loc_126B lea rax, s2; "Found a match!" mov [rbp+var_58], rax jmp short loc_1276 loc_126B: lea rax, aNotMatched; "Not matched!" mov [rbp+var_58], rax loc_1276: lea rax, [rbp+preg] mov rdi, rax; preg call _regfree mov rax, [rbp+var_58] loc_1286: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_129A call ___stack_chk_fail locret_129A: leave retn
const char * func0(const char *a1) { const char *v2; // [rsp+18h] [rbp-58h] regex_t preg; // [rsp+20h] [rbp-50h] BYREF unsigned long long v4; // [rsp+68h] [rbp-8h] v4 = __readfsqword(0x28u); if ( regcomp(&preg, "ab?", 1) ) return "Not matched!"; if ( regexec(&preg, a1, 0LL, 0LL, 0) ) v2 = "Not matched!"; else v2 = "Found a match!"; regfree(&preg); return v2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x70 MOV qword ptr [RBP + -0x68],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX LEA RAX,[RBP + -0x50] MOV EDX,0x1 LEA RCX,[0x102008] MOV RSI,RCX MOV RDI,RAX CALL 0x001010d0 MOV dword ptr [RBP + -0x5c],EAX CMP dword ptr [RBP + -0x5c],0x0 JZ 0x00101235 LEA RAX,[0x10200c] JMP 0x00101286 LAB_00101235: MOV RSI,qword ptr [RBP + -0x68] LEA RAX,[RBP + -0x50] MOV R8D,0x0 MOV ECX,0x0 MOV EDX,0x0 MOV RDI,RAX CALL 0x001010f0 MOV dword ptr [RBP + -0x5c],EAX CMP dword ptr [RBP + -0x5c],0x0 JNZ 0x0010126b LEA RAX,[0x102019] MOV qword ptr [RBP + -0x58],RAX JMP 0x00101276 LAB_0010126b: LEA RAX,[0x10200c] MOV qword ptr [RBP + -0x58],RAX LAB_00101276: LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001010a0 MOV RAX,qword ptr [RBP + -0x58] LAB_00101286: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x0010129a CALL 0x001010b0 LAB_0010129a: LEAVE RET
char * func0(char *param_1) { int iVar1; long in_FS_OFFSET; char *local_60; regex_t local_58; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&local_58,"ab?",1); if (iVar1 == 0) { iVar1 = regexec(&local_58,param_1,0,(regmatch_t *)0x0,0); if (iVar1 == 0) { local_60 = "Found a match!"; } else { local_60 = "Not matched!"; } regfree(&local_58); } else { local_60 = "Not matched!"; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_60; }
6,917
func0
#include <stdio.h> #include <string.h> #include <regex.h> #include <assert.h>
const char* func0(const char* text) { regex_t regex; int ret; const char* result; ret = regcomp(&regex, "ab?", REG_EXTENDED); if (ret) { return "Not matched!"; } ret = regexec(&regex, text, 0, NULL, 0); if (!ret) { result = "Found a match!"; } else { result = "Not matched!"; } regfree(&regex); return result; }
int main() { assert(strcmp(func0("ac"), "Found a match!") == 0); assert(strcmp(func0("dc"), "Not matched!") == 0); assert(strcmp(func0("abbbba"), "Found a match!") == 0); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x58,%rsp mov %rdi,%rbx mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov %rsp,%rdi mov $0x1,%edx lea 0xe2b(%rip),%rsi callq 10c0 <regcomp@plt> lea 0xe12(%rip),%rbp test %eax,%eax je 121f <func0+0x56> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 1258 <func0+0x8f> mov %rbp,%rax add $0x58,%rsp pop %rbx pop %rbp retq mov %rsp,%rdi mov $0x0,%r8d mov $0x0,%ecx mov $0x0,%edx mov %rbx,%rsi callq 10d0 <regexec@plt> test %eax,%eax lea 0xdc1(%rip),%rbp lea 0xdc9(%rip),%rax cmovne %rax,%rbp mov %rsp,%rdi callq 1090 <regfree@plt> jmp 1205 <func0+0x3c> callq 10a0 <__stack_chk_fail@plt>
func0: endbr64 push rbp push rbx sub rsp, 58h mov rbp, rdi mov rax, fs:28h mov [rsp+68h+var_20], rax xor eax, eax mov rdi, rsp mov edx, 1 lea rsi, aAb; "ab?" call _regcomp lea rbx, aNotMatched; "Not matched!" test eax, eax jz short loc_123F loc_1225: mov rax, [rsp+68h+var_20] sub rax, fs:28h jnz short loc_1278 mov rax, rbx add rsp, 58h pop rbx pop rbp retn loc_123F: mov rdi, rsp mov r8d, 0 mov ecx, 0 mov edx, 0 mov rsi, rbp call _regexec test eax, eax lea rbx, aFoundAMatch; "Found a match!" lea rax, aNotMatched; "Not matched!" cmovnz rbx, rax mov rdi, rsp call _regfree jmp short loc_1225 loc_1278: call ___stack_chk_fail
const char * func0(long long a1) { const char *v1; // rbx _QWORD v3[13]; // [rsp+0h] [rbp-68h] BYREF v3[9] = __readfsqword(0x28u); v1 = "Not matched!"; if ( !(unsigned int)regcomp(v3, "ab?", 1LL) ) { v1 = "Found a match!"; if ( (unsigned int)regexec(v3, a1, 0LL, 0LL, 0LL) ) v1 = "Not matched!"; regfree(v3); } return v1; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x58 MOV RBP,RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV RDI,RSP MOV EDX,0x1 LEA RSI,[0x102020] CALL 0x001010d0 LEA RBX,[0x102013] TEST EAX,EAX JZ 0x0010123f LAB_00101225: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101278 MOV RAX,RBX ADD RSP,0x58 POP RBX POP RBP RET LAB_0010123f: MOV RDI,RSP MOV R8D,0x0 MOV ECX,0x0 MOV EDX,0x0 MOV RSI,RBP CALL 0x001010f0 TEST EAX,EAX LEA RBX,[0x102004] LEA RAX,[0x102013] CMOVNZ RBX,RAX MOV RDI,RSP CALL 0x001010a0 JMP 0x00101225 LAB_00101278: CALL 0x001010b0
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_68; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"ab?",1); pcVar2 = "Not matched!"; if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0); pcVar2 = "Found a match!"; if (iVar1 != 0) { pcVar2 = "Not matched!"; } regfree(&rStack_68); } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
6,918
func0
#include <stdio.h> #include <string.h> #include <regex.h> #include <assert.h>
const char* func0(const char* text) { regex_t regex; int ret; const char* result; ret = regcomp(&regex, "ab?", REG_EXTENDED); if (ret) { return "Not matched!"; } ret = regexec(&regex, text, 0, NULL, 0); if (!ret) { result = "Found a match!"; } else { result = "Not matched!"; } regfree(&regex); return result; }
int main() { assert(strcmp(func0("ac"), "Found a match!") == 0); assert(strcmp(func0("dc"), "Not matched!") == 0); assert(strcmp(func0("abbbba"), "Found a match!") == 0); return 0; }
O2
c
func0: endbr64 push %r13 mov $0x1,%edx lea 0xd5e(%rip),%rsi lea 0xd4a(%rip),%r13 push %r12 push %rbp mov %rdi,%rbp sub $0x50,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov %rsp,%r12 mov %r12,%rdi callq 10c0 <regcomp@plt> test %eax,%eax jne 1319 <func0+0x69> xor %r8d,%r8d xor %ecx,%ecx xor %edx,%edx mov %r12,%rdi mov %rbp,%rsi callq 10d0 <regexec@plt> mov %r12,%rdi test %eax,%eax lea 0xcf4(%rip),%rax cmove %rax,%r13 callq 1090 <regfree@plt> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 1336 <func0+0x86> add $0x50,%rsp mov %r13,%rax pop %rbp pop %r12 pop %r13 retq callq 10a0 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r13 mov edx, 1 lea rsi, aAb; "ab?" lea r13, aNotMatched; "Not matched!" push r12 push rbp mov rbp, rdi sub rsp, 50h mov rax, fs:28h mov [rsp+68h+var_20], rax xor eax, eax mov r12, rsp mov rdi, r12 call _regcomp test eax, eax jnz short loc_1329 xor r8d, r8d xor ecx, ecx xor edx, edx mov rdi, r12 mov rsi, rbp call _regexec mov rdi, r12 test eax, eax lea rax, aFoundAMatch; "Found a match!" cmovz r13, rax call _regfree loc_1329: mov rax, [rsp+68h+var_20] sub rax, fs:28h jnz short loc_1346 add rsp, 50h mov rax, r13 pop rbp pop r12 pop r13 retn loc_1346: call ___stack_chk_fail
const char * func0(long long a1) { const char *v1; // r13 _QWORD v3[13]; // [rsp+0h] [rbp-68h] BYREF v1 = "Not matched!"; v3[9] = __readfsqword(0x28u); if ( !(unsigned int)regcomp(v3, "ab?", 1LL) ) { if ( !(unsigned int)regexec(v3, a1, 0LL, 0LL, 0LL) ) v1 = "Found a match!"; regfree(v3); } return v1; }
func0: ENDBR64 PUSH R13 MOV EDX,0x1 LEA RSI,[0x102020] LEA R13,[0x102013] PUSH R12 PUSH RBP MOV RBP,RDI SUB RSP,0x50 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV R12,RSP MOV RDI,R12 CALL 0x001010d0 TEST EAX,EAX JNZ 0x00101329 XOR R8D,R8D XOR ECX,ECX XOR EDX,EDX MOV RDI,R12 MOV RSI,RBP CALL 0x001010f0 MOV RDI,R12 TEST EAX,EAX LEA RAX,[0x102004] CMOVZ R13,RAX CALL 0x001010a0 LAB_00101329: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101346 ADD RSP,0x50 MOV RAX,R13 POP RBP POP R12 POP R13 RET LAB_00101346: CALL 0x001010b0
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_68; long local_20; pcVar2 = "Not matched!"; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"ab?",1); if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0); if (iVar1 == 0) { pcVar2 = "Found a match!"; } regfree(&rStack_68); } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
6,919
func0
#include <stdio.h> #include <string.h> #include <regex.h> #include <assert.h>
const char* func0(const char* text) { regex_t regex; int ret; const char* result; ret = regcomp(&regex, "ab?", REG_EXTENDED); if (ret) { return "Not matched!"; } ret = regexec(&regex, text, 0, NULL, 0); if (!ret) { result = "Found a match!"; } else { result = "Not matched!"; } regfree(&regex); return result; }
int main() { assert(strcmp(func0("ac"), "Found a match!") == 0); assert(strcmp(func0("dc"), "Not matched!") == 0); assert(strcmp(func0("abbbba"), "Found a match!") == 0); return 0; }
O3
c
func0: endbr64 push %r13 mov $0x1,%edx lea 0xd5e(%rip),%rsi lea 0xd4a(%rip),%r13 push %r12 push %rbp mov %rdi,%rbp sub $0x50,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov %rsp,%r12 mov %r12,%rdi callq 10c0 <regcomp@plt> test %eax,%eax jne 1319 <func0+0x69> xor %r8d,%r8d xor %ecx,%ecx xor %edx,%edx mov %r12,%rdi mov %rbp,%rsi callq 10d0 <regexec@plt> mov %r12,%rdi test %eax,%eax lea 0xcf4(%rip),%rax cmove %rax,%r13 callq 1090 <regfree@plt> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 1336 <func0+0x86> add $0x50,%rsp mov %r13,%rax pop %rbp pop %r12 pop %r13 retq callq 10a0 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r12 mov edx, 1; cflags lea rsi, pattern; "ab?" lea r12, aNotMatched; "Not matched!" push rbp push rbx mov rbx, rdi sub rsp, 50h mov rax, fs:28h mov [rsp+var_s48], rax xor eax, eax mov rbp, rsp mov rdi, rbp; preg call _regcomp test eax, eax jnz short loc_1328 xor r8d, r8d; eflags xor ecx, ecx; pmatch xor edx, edx; nmatch mov rdi, rbp; preg mov rsi, rbx; string call _regexec mov rdi, rbp; preg test eax, eax lea rax, s2; "Found a match!" cmovz r12, rax call _regfree loc_1328: mov rax, [rsp+var_s48] sub rax, fs:28h jnz short loc_1344 add rsp, 50h mov rax, r12 pop rbx pop rbp pop r12 retn loc_1344: call ___stack_chk_fail
const char * func0(char *string) { const char *v1; // r12 regex_t _0; // [rsp+0h] [rbp+0h] BYREF unsigned long long vars48; // [rsp+48h] [rbp+48h] v1 = "Not matched!"; vars48 = __readfsqword(0x28u); if ( !regcomp(&_0, "ab?", 1) ) { if ( !regexec(&_0, string, 0LL, 0LL, 0) ) v1 = "Found a match!"; regfree(&_0); } return v1; }
func0: ENDBR64 PUSH R12 MOV EDX,0x1 LEA RSI,[0x102020] LEA R12,[0x102013] PUSH RBP PUSH RBX MOV RBX,RDI SUB RSP,0x50 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV RBP,RSP MOV RDI,RBP CALL 0x001010d0 TEST EAX,EAX JNZ 0x00101328 XOR R8D,R8D XOR ECX,ECX XOR EDX,EDX MOV RDI,RBP MOV RSI,RBX CALL 0x001010f0 MOV RDI,RBP TEST EAX,EAX LEA RAX,[0x102004] CMOVZ R12,RAX CALL 0x001010a0 LAB_00101328: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101344 ADD RSP,0x50 MOV RAX,R12 POP RBX POP RBP POP R12 RET LAB_00101344: CALL 0x001010b0
char * func0(char *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; regex_t rStack_68; long local_20; pcVar2 = "Not matched!"; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"ab?",1); if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0); if (iVar1 == 0) { pcVar2 = "Found a match!"; } regfree(&rStack_68); } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
6,920
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(char* test_list[], int size) { int count = 0; for (int idx = 0; idx < size; idx++) { for (int idxn = idx; idxn < size; idxn++) { char reversed[100]; int len = strlen(test_list[idx]); for (int i = 0; i < len; i++) { reversed[i] = test_list[idx][len - 1 - i]; } reversed[len] = '\0'; if (strcmp(test_list[idxn], reversed) == 0) { count++; } } } static char result[12]; sprintf(result, "%d", count); return result; }
int main() { char* test1[] = {"julia", "best", "tseb", "for", "ailuj"}; char* test2[] = {"geeks", "best", "for", "skeeg"}; char* test3[] = {"makes", "best", "sekam", "for", "rof"}; assert(strcmp(func0(test1, 5), "2") == 0); assert(strcmp(func0(test2, 4), "1") == 0); assert(strcmp(func0(test3, 5), "2") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0xa0,%rsp mov %rdi,-0x98(%rbp) mov %esi,-0x9c(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax movl $0x0,-0x84(%rbp) movl $0x0,-0x80(%rbp) jmpq 12d8 <func0+0x10f> mov -0x80(%rbp),%eax mov %eax,-0x7c(%rbp) jmpq 12c5 <func0+0xfc> mov -0x80(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x98(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov %rax,%rdi callq 1090 <strlen@plt> mov %eax,-0x74(%rbp) movl $0x0,-0x78(%rbp) jmp 127b <func0+0xb2> mov -0x80(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x98(%rbp),%rax add %rdx,%rax mov (%rax),%rdx mov -0x74(%rbp),%eax sub $0x1,%eax sub -0x78(%rbp),%eax cltq add %rdx,%rax movzbl (%rax),%edx mov -0x78(%rbp),%eax cltq mov %dl,-0x70(%rbp,%rax,1) addl $0x1,-0x78(%rbp) mov -0x78(%rbp),%eax cmp -0x74(%rbp),%eax jl 1243 <func0+0x7a> mov -0x74(%rbp),%eax cltq movb $0x0,-0x70(%rbp,%rax,1) mov -0x7c(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x98(%rbp),%rax add %rdx,%rax mov (%rax),%rax lea -0x70(%rbp),%rdx mov %rdx,%rsi mov %rax,%rdi callq 10c0 <strcmp@plt> test %eax,%eax jne 12c1 <func0+0xf8> addl $0x1,-0x84(%rbp) addl $0x1,-0x7c(%rbp) mov -0x7c(%rbp),%eax cmp -0x9c(%rbp),%eax jl 1215 <func0+0x4c> addl $0x1,-0x80(%rbp) mov -0x80(%rbp),%eax cmp -0x9c(%rbp),%eax jl 120a <func0+0x41> mov -0x84(%rbp),%eax mov %eax,%edx lea 0xd12(%rip),%rsi lea 0x2d1b(%rip),%rdi mov $0x0,%eax callq 10d0 <sprintf@plt> lea 0x2d0a(%rip),%rax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 1322 <func0+0x159> callq 10a0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 0A0h mov [rbp+var_98], rdi mov [rbp+var_9C], esi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov [rbp+var_84], 0 mov [rbp+var_80], 0 jmp loc_12D8 loc_120A: mov eax, [rbp+var_80] mov [rbp+var_7C], eax jmp loc_12C5 loc_1215: mov eax, [rbp+var_80] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_98] add rax, rdx mov rax, [rax] mov rdi, rax; s call _strlen mov [rbp+var_74], eax mov [rbp+var_78], 0 jmp short loc_127B loc_1243: mov eax, [rbp+var_80] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_98] add rax, rdx mov rdx, [rax] mov eax, [rbp+var_74] sub eax, 1 sub eax, [rbp+var_78] cdqe add rax, rdx movzx edx, byte ptr [rax] mov eax, [rbp+var_78] cdqe mov [rbp+rax+s2], dl add [rbp+var_78], 1 loc_127B: mov eax, [rbp+var_78] cmp eax, [rbp+var_74] jl short loc_1243 mov eax, [rbp+var_74] cdqe mov [rbp+rax+s2], 0 mov eax, [rbp+var_7C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_98] add rax, rdx mov rax, [rax] lea rdx, [rbp+s2] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jnz short loc_12C1 add [rbp+var_84], 1 loc_12C1: add [rbp+var_7C], 1 loc_12C5: mov eax, [rbp+var_7C] cmp eax, [rbp+var_9C] jl loc_1215 add [rbp+var_80], 1 loc_12D8: mov eax, [rbp+var_80] cmp eax, [rbp+var_9C] jl loc_120A mov eax, [rbp+var_84] mov edx, eax lea rax, format; "%d" mov rsi, rax; format lea rax, result_1 mov rdi, rax; s mov eax, 0 call _sprintf lea rax, result_1 mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_1328 call ___stack_chk_fail locret_1328: leave retn
char * func0(long long a1, int a2) { int v3; // [rsp+1Ch] [rbp-84h] int i; // [rsp+20h] [rbp-80h] int j; // [rsp+24h] [rbp-7Ch] int k; // [rsp+28h] [rbp-78h] int v7; // [rsp+2Ch] [rbp-74h] char s2[104]; // [rsp+30h] [rbp-70h] BYREF unsigned long long v9; // [rsp+98h] [rbp-8h] v9 = __readfsqword(0x28u); v3 = 0; for ( i = 0; i < a2; ++i ) { for ( j = i; j < a2; ++j ) { v7 = strlen(*(const char **)(8LL * i + a1)); for ( k = 0; k < v7; ++k ) s2[k] = *(_BYTE *)(*(_QWORD *)(8LL * i + a1) + v7 - 1 - k); s2[v7] = 0; if ( !strcmp(*(const char **)(8LL * j + a1), s2) ) ++v3; } } sprintf(result_1, "%d", v3); return result_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0xa0 MOV qword ptr [RBP + -0x98],RDI MOV dword ptr [RBP + -0x9c],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV dword ptr [RBP + -0x84],0x0 MOV dword ptr [RBP + -0x80],0x0 JMP 0x001012d8 LAB_0010120a: MOV EAX,dword ptr [RBP + -0x80] MOV dword ptr [RBP + -0x7c],EAX JMP 0x001012c5 LAB_00101215: MOV EAX,dword ptr [RBP + -0x80] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x98] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV RDI,RAX CALL 0x00101090 MOV dword ptr [RBP + -0x74],EAX MOV dword ptr [RBP + -0x78],0x0 JMP 0x0010127b LAB_00101243: MOV EAX,dword ptr [RBP + -0x80] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x98] ADD RAX,RDX MOV RDX,qword ptr [RAX] MOV EAX,dword ptr [RBP + -0x74] SUB EAX,0x1 SUB EAX,dword ptr [RBP + -0x78] CDQE ADD RAX,RDX MOVZX EDX,byte ptr [RAX] MOV EAX,dword ptr [RBP + -0x78] CDQE MOV byte ptr [RBP + RAX*0x1 + -0x70],DL ADD dword ptr [RBP + -0x78],0x1 LAB_0010127b: MOV EAX,dword ptr [RBP + -0x78] CMP EAX,dword ptr [RBP + -0x74] JL 0x00101243 MOV EAX,dword ptr [RBP + -0x74] CDQE MOV byte ptr [RBP + RAX*0x1 + -0x70],0x0 MOV EAX,dword ptr [RBP + -0x7c] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x98] ADD RAX,RDX MOV RAX,qword ptr [RAX] LEA RDX,[RBP + -0x70] MOV RSI,RDX MOV RDI,RAX CALL 0x001010c0 TEST EAX,EAX JNZ 0x001012c1 ADD dword ptr [RBP + -0x84],0x1 LAB_001012c1: ADD dword ptr [RBP + -0x7c],0x1 LAB_001012c5: MOV EAX,dword ptr [RBP + -0x7c] CMP EAX,dword ptr [RBP + -0x9c] JL 0x00101215 ADD dword ptr [RBP + -0x80],0x1 LAB_001012d8: MOV EAX,dword ptr [RBP + -0x80] CMP EAX,dword ptr [RBP + -0x9c] JL 0x0010120a MOV EAX,dword ptr [RBP + -0x84] MOV EDX,EAX LEA RAX,[0x102008] MOV RSI,RAX LEA RAX,[0x104018] MOV RDI,RAX MOV EAX,0x0 CALL 0x001010d0 LEA RAX,[0x104018] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x00101328 CALL 0x001010a0 LAB_00101328: LEAVE RET
int1 * func0(long param_1,int param_2) { int iVar1; size_t sVar2; long in_FS_OFFSET; uint local_8c; int local_88; int local_84; int local_80; char local_78 [104]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_8c = 0; for (local_88 = 0; local_88 < param_2; local_88 = local_88 + 1) { for (local_84 = local_88; local_84 < param_2; local_84 = local_84 + 1) { sVar2 = strlen(*(char **)(param_1 + (long)local_88 * 8)); iVar1 = (int)sVar2; for (local_80 = 0; local_80 < iVar1; local_80 = local_80 + 1) { local_78[local_80] = *(char *)((long)((iVar1 + -1) - local_80) + *(long *)(param_1 + (long)local_88 * 8)); } local_78[iVar1] = '\0'; iVar1 = strcmp(*(char **)(param_1 + (long)local_84 * 8),local_78); if (iVar1 == 0) { local_8c = local_8c + 1; } } } sprintf(result_1,"%d",(ulong)local_8c); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return result_1; }
6,921
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(char* test_list[], int size) { int count = 0; for (int idx = 0; idx < size; idx++) { for (int idxn = idx; idxn < size; idxn++) { char reversed[100]; int len = strlen(test_list[idx]); for (int i = 0; i < len; i++) { reversed[i] = test_list[idx][len - 1 - i]; } reversed[len] = '\0'; if (strcmp(test_list[idxn], reversed) == 0) { count++; } } } static char result[12]; sprintf(result, "%d", count); return result; }
int main() { char* test1[] = {"julia", "best", "tseb", "for", "ailuj"}; char* test2[] = {"geeks", "best", "for", "skeeg"}; char* test3[] = {"makes", "best", "sekam", "for", "rof"}; assert(strcmp(func0(test1, 5), "2") == 0); assert(strcmp(func0(test2, 4), "1") == 0); assert(strcmp(func0(test3, 5), "2") == 0); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x98,%rsp mov %esi,%ebx mov %esi,0x10(%rsp) mov %fs:0x28,%rsi mov %rsi,0x88(%rsp) xor %esi,%esi test %ebx,%ebx jle 12c2 <func0+0x119> mov %rdi,%rax sub $0x1,%ebx mov %ebx,0x14(%rsp) mov %ebx,%ebx mov %rbx,0x8(%rsp) mov %rdi,%r12 movq $0x0,(%rsp) mov $0x0,%ebp add $0x8,%rax mov %rax,0x18(%rsp) mov $0xffffffffffffffff,%r15 lea 0x20(%rsp),%r14 jmpq 129b <func0+0xf2> movslq %esi,%rsi movb $0x0,0x20(%rsp,%rsi,1) mov %r14,%rsi mov (%rbx),%rdi callq 10a0 <strcmp@plt> cmp $0x1,%eax adc $0x0,%ebp add $0x8,%rbx cmp %r13,%rbx je 1284 <func0+0xdb> mov (%r12),%r8 mov %r15,%rcx mov %r8,%rdi mov $0x0,%eax repnz scas %es:(%rdi),%al not %rcx lea -0x1(%rcx),%rsi test %esi,%esi jle 121a <func0+0x71> movslq %esi,%rcx lea -0x1(%r8,%rcx,1),%rax lea 0x20(%rsp),%rdx lea -0x2(%r8,%rcx,1),%rdi lea -0x1(%rsi),%ecx sub %rcx,%rdi movzbl (%rax),%ecx mov %cl,(%rdx) sub $0x1,%rax add $0x1,%rdx cmp %rdi,%rax jne 1270 <func0+0xc7> jmp 121a <func0+0x71> mov (%rsp),%rbx lea 0x1(%rbx),%rax add $0x8,%r12 cmp 0x8(%rsp),%rbx je 12c7 <func0+0x11e> mov %rax,(%rsp) mov (%rsp),%ebx cmp %ebx,0x10(%rsp) jle 1284 <func0+0xdb> mov 0x14(%rsp),%eax mov (%rsp),%rbx sub %ebx,%eax add %rbx,%rax mov 0x18(%rsp),%rbx lea (%rbx,%rax,8),%r13 mov %r12,%rbx jmpq 123c <func0+0x93> mov $0x0,%ebp mov %ebp,%r8d lea 0xd33(%rip),%rcx mov $0xc,%edx mov $0x1,%esi lea 0x2d36(%rip),%rdi mov $0x0,%eax callq 10b0 <__sprintf_chk@plt> mov 0x88(%rsp),%rax xor %fs:0x28,%rax jne 1318 <func0+0x16f> lea 0x2d12(%rip),%rax add $0x98,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 1080 <__stack_chk_fail@plt>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 98h mov [rsp+0C8h+var_B8], esi mov rdx, fs:28h mov [rsp+0C8h+var_40], rdx xor edx, edx test esi, esi jle loc_12CB mov rax, rdi lea edi, [rsi-1] mov [rsp+0C8h+var_B4], edi mov ebx, esi mov [rsp+0C8h+var_C0], rbx mov r13, rax mov [rsp+0C8h+var_C8], 0 mov r12d, 0 add rax, 8 mov [rsp+0C8h+var_B0], rax lea r15, [rsp+0C8h+var_A8] jmp loc_12BC loc_1232: mov eax, [rsp+0C8h+var_B4] mov rbx, [rsp+0C8h+var_C8] sub eax, ebx add rax, rbx mov rbx, [rsp+0C8h+var_B0] lea r14, [rbx+rax*8] mov rbx, r13 loc_124B: mov rbp, [r13+0] mov rdi, rbp call _strlen test eax, eax jle short loc_1286 movsxd rsi, eax lea rdx, [rbp+rsi-1] lea rcx, [rsp+0C8h+var_A8] lea rdi, [rbp+rsi-2] lea esi, [rax-1] sub rdi, rsi loc_1273: movzx esi, byte ptr [rdx] mov [rcx], sil sub rdx, 1 add rcx, 1 cmp rdx, rdi jnz short loc_1273 loc_1286: cdqe mov [rsp+rax+0C8h+var_A8], 0 mov rsi, r15 mov rdi, [rbx] call _strcmp cmp eax, 1 adc r12d, 0 add rbx, 8 cmp rbx, r14 jnz short loc_124B loc_12A8: add [rsp+0C8h+var_C8], 1 mov rax, [rsp+0C8h+var_C8] add r13, 8 cmp rax, [rsp+0C8h+var_C0] jz short loc_12D1 loc_12BC: mov ebx, dword ptr [rsp+0C8h+var_C8] cmp [rsp+0C8h+var_B8], ebx jg loc_1232 jmp short loc_12A8 loc_12CB: mov r12d, 0 loc_12D1: mov r8d, r12d lea rcx, unk_2004 mov edx, 0Ch mov esi, 1 lea rbx, result_1 mov rdi, rbx mov eax, 0 call ___sprintf_chk mov rax, [rsp+0C8h+var_40] sub rax, fs:28h jnz short loc_1321 mov rax, rbx add rsp, 98h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1321: call ___stack_chk_fail
void * func0(_QWORD *a1, int a2) { _QWORD *v2; // r13 unsigned int v3; // r12d _QWORD *v4; // rbx long long v5; // rbp int v6; // eax _BYTE *v7; // rdx _BYTE *v8; // rcx long long v10; // [rsp+0h] [rbp-C8h] _BYTE v11[104]; // [rsp+20h] [rbp-A8h] BYREF unsigned long long v12; // [rsp+88h] [rbp-40h] v12 = __readfsqword(0x28u); if ( a2 <= 0 ) { v3 = 0; } else { v2 = a1; v10 = 0LL; v3 = 0; do { if ( a2 > (int)v10 ) { v4 = v2; do { v5 = *v2; v6 = strlen(*v2); if ( v6 > 0 ) { v7 = (_BYTE *)(v5 + v6 - 1); v8 = v11; do *v8++ = *v7--; while ( v7 != (_BYTE *)(v5 + v6 - 2 - (unsigned int)(v6 - 1)) ); } v11[v6] = 0; v3 += strcmp(*v4++, v11, v7, v8) == 0; } while ( v4 != &a1[v10 + 1 + (unsigned int)(a2 - 1 - v10)] ); } ++v10; ++v2; } while ( v10 != a2 ); } __sprintf_chk(&result_1, 1LL, 12LL, &unk_2004, v3); return &result_1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x98 MOV dword ptr [RSP + 0x10],ESI MOV RDX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x88],RDX XOR EDX,EDX TEST ESI,ESI JLE 0x001012cb MOV RAX,RDI LEA EDI,[RSI + -0x1] MOV dword ptr [RSP + 0x14],EDI MOV EBX,ESI MOV qword ptr [RSP + 0x8],RBX MOV R13,RAX MOV qword ptr [RSP],0x0 MOV R12D,0x0 ADD RAX,0x8 MOV qword ptr [RSP + 0x18],RAX LEA R15,[RSP + 0x20] JMP 0x001012bc LAB_00101232: MOV EAX,dword ptr [RSP + 0x14] MOV RBX,qword ptr [RSP] SUB EAX,EBX ADD RAX,RBX MOV RBX,qword ptr [RSP + 0x18] LEA R14,[RBX + RAX*0x8] MOV RBX,R13 LAB_0010124b: MOV RBP,qword ptr [R13] MOV RDI,RBP CALL 0x00101090 TEST EAX,EAX JLE 0x00101286 MOVSXD RSI,EAX LEA RDX,[RBP + RSI*0x1 + -0x1] LEA RCX,[RSP + 0x20] LEA RDI,[RBP + RSI*0x1 + -0x2] LEA ESI,[RAX + -0x1] SUB RDI,RSI LAB_00101273: MOVZX ESI,byte ptr [RDX] MOV byte ptr [RCX],SIL SUB RDX,0x1 ADD RCX,0x1 CMP RDX,RDI JNZ 0x00101273 LAB_00101286: CDQE MOV byte ptr [RSP + RAX*0x1 + 0x20],0x0 MOV RSI,R15 MOV RDI,qword ptr [RBX] CALL 0x001010c0 CMP EAX,0x1 ADC R12D,0x0 ADD RBX,0x8 CMP RBX,R14 JNZ 0x0010124b LAB_001012a8: ADD qword ptr [RSP],0x1 MOV RAX,qword ptr [RSP] ADD R13,0x8 CMP RAX,qword ptr [RSP + 0x8] JZ 0x001012d1 LAB_001012bc: MOV EBX,dword ptr [RSP] CMP dword ptr [RSP + 0x10],EBX JG 0x00101232 JMP 0x001012a8 LAB_001012cb: MOV R12D,0x0 LAB_001012d1: MOV R8D,R12D LEA RCX,[0x102004] MOV EDX,0xc MOV ESI,0x1 LEA RBX,[0x104018] MOV RDI,RBX MOV EAX,0x0 CALL 0x001010d0 MOV RAX,qword ptr [RSP + 0x88] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101321 MOV RAX,RBX ADD RSP,0x98 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101321: CALL 0x001010a0
int1 * func0(int8 *param_1,uint param_2) { char *__s; int iVar1; size_t sVar2; char *pcVar3; char *pcVar4; int8 *puVar5; int iVar6; int8 *puVar7; long in_FS_OFFSET; ulong local_c8; char local_a8 [104]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); if ((int)param_2 < 1) { iVar6 = 0; } else { local_c8 = 0; iVar6 = 0; puVar7 = param_1; do { if ((int)local_c8 < (int)param_2) { puVar5 = puVar7; do { __s = (char *)*puVar7; sVar2 = strlen(__s); iVar1 = (int)sVar2; if (0 < iVar1) { pcVar4 = __s + (long)iVar1 + -1; pcVar3 = local_a8; do { *pcVar3 = *pcVar4; pcVar4 = pcVar4 + -1; pcVar3 = pcVar3 + 1; } while (pcVar4 != __s + (((long)iVar1 + -2) - (ulong)(iVar1 - 1))); } local_a8[iVar1] = '\0'; iVar1 = strcmp((char *)*puVar5,local_a8); iVar6 = iVar6 + (uint)(iVar1 == 0); puVar5 = puVar5 + 1; } while (puVar5 != param_1 + ((param_2 - 1) - (int)local_c8) + local_c8 + 1); } local_c8 = local_c8 + 1; puVar7 = puVar7 + 1; } while (local_c8 != param_2); } __sprintf_chk(result_1,1,0xc,&DAT_00102004,iVar6); if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return result_1; }
6,922
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(char* test_list[], int size) { int count = 0; for (int idx = 0; idx < size; idx++) { for (int idxn = idx; idxn < size; idxn++) { char reversed[100]; int len = strlen(test_list[idx]); for (int i = 0; i < len; i++) { reversed[i] = test_list[idx][len - 1 - i]; } reversed[len] = '\0'; if (strcmp(test_list[idxn], reversed) == 0) { count++; } } } static char result[12]; sprintf(result, "%d", count); return result; }
int main() { char* test1[] = {"julia", "best", "tseb", "for", "ailuj"}; char* test2[] = {"geeks", "best", "for", "skeeg"}; char* test3[] = {"makes", "best", "sekam", "for", "rof"}; assert(strcmp(func0(test1, 5), "2") == 0); assert(strcmp(func0(test2, 4), "1") == 0); assert(strcmp(func0(test3, 5), "2") == 0); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0xa8,%rsp mov %esi,0xc(%rsp) mov %fs:0x28,%rbx mov %rbx,0x98(%rsp) xor %ebx,%ebx test %esi,%esi jle 149e <func0+0x15e> mov %esi,%eax mov %rdi,%r15 lea 0x30(%rsp),%r13 xor %r12d,%r12d movq $0x0,0x18(%rsp) sub $0x1,%eax mov %rax,0x28(%rsp) nopw 0x0(%rax,%rax,1) mov 0x18(%rsp),%rax mov (%r15,%rax,8),%rbp mov %rax,0x20(%rsp) add $0x1,%rax mov %rax,0x18(%rsp) mov %rax,%rbx mov %rbp,%rdi lea -0x2(%rbp),%rax mov %rbp,%r14 mov %rax,0x10(%rsp) callq 1090 <strlen@plt> test %eax,%eax jle 1434 <func0+0xf4> nopw 0x0(%rax,%rax,1) lea -0x1(%rax),%r9d movslq %eax,%rdi mov 0x10(%rsp),%rax mov %r13,%rcx movslq %r9d,%rdx mov %r9d,%r9d lea (%rax,%rdi,1),%rsi add %rbp,%rdx sub %r9,%rsi movzbl (%rdx),%eax sub $0x1,%rdx add $0x1,%rcx mov %al,-0x1(%rcx) cmp %rsi,%rdx jne 13f0 <func0+0xb0> movb $0x0,0x30(%rsp,%rdi,1) mov %r13,%rsi mov %r14,%rdi callq 10c0 <strcmp@plt> cmp $0x1,%eax adc $0x0,%r12d cmp %ebx,0xc(%rsp) jle 1440 <func0+0x100> mov %rbp,%rdi mov (%r15,%rbx,8),%r14 add $0x1,%rbx callq 1090 <strlen@plt> test %eax,%eax jg 13d0 <func0+0x90> movslq %eax,%rdi jmp 1403 <func0+0xc3> nopl 0x0(%rax) mov 0x28(%rsp),%rbx cmp %rbx,0x20(%rsp) jne 1398 <func0+0x58> xor %eax,%eax mov %r12d,%r8d mov $0xc,%edx mov $0x1,%esi lea 0xb9e(%rip),%rcx lea 0x2bab(%rip),%rdi callq 10d0 <__sprintf_chk@plt> mov 0x98(%rsp),%rax xor %fs:0x28,%rax jne 14a3 <func0+0x163> add $0xa8,%rsp lea 0x2b85(%rip),%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq xor %r12d,%r12d jmp 1450 <func0+0x110> callq 10a0 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 98h mov [rsp+0C8h+var_BC], esi mov rax, fs:28h mov [rsp+0C8h+var_40], rax xor eax, eax movsxd rax, esi test eax, eax jle loc_1477 mov [rsp+0C8h+var_B0], rax mov r13, rdi xor ebp, ebp lea r12, [rsp+0C8h+var_A8] mov [rsp+0C8h+var_B8], 0 nop loc_1390: mov r14, [rsp+0C8h+var_B8] mov rbx, [r13+r14*8+0] lea r15, [rbx-2] xchg ax, ax loc_13A0: mov rdi, rbx call _strlen test eax, eax jle loc_1470 lea esi, [rax-1] cdqe mov rcx, r12 movsxd rdx, esi lea rdi, [r15+rax] mov esi, esi add rdx, rbx sub rdi, rsi nop word ptr [rax+rax+00000000h] loc_13D0: movzx esi, byte ptr [rdx] sub rdx, 1 add rcx, 1 mov [rcx-1], sil cmp rdx, rdi jnz short loc_13D0 loc_13E4: mov rdi, [r13+r14*8+0] mov rsi, r12 mov [rsp+rax+0C8h+var_A8], 0 call _strcmp cmp eax, 1 adc ebp, 0 add r14, 1 cmp [rsp+0C8h+var_BC], r14d jg short loc_13A0 add [rsp+0C8h+var_B8], 1 mov rax, [rsp+0C8h+var_B8] cmp rax, [rsp+0C8h+var_B0] jnz loc_1390 loc_141D: xor eax, eax mov r8d, ebp mov edx, 0Ch mov esi, 1 lea r12, result_1 lea rcx, unk_2004 mov rdi, r12 call ___sprintf_chk mov rax, [rsp+0C8h+var_40] sub rax, fs:28h jnz short loc_147B add rsp, 98h mov rax, r12 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1470: cdqe jmp loc_13E4 loc_1477: xor ebp, ebp jmp short loc_141D loc_147B: call ___stack_chk_fail
void * func0(long long a1, int a2) { unsigned int v3; // ebp long long v4; // r14 long long v5; // rbx long long v6; // rax _BYTE *v7; // rcx char *v8; // rdx char v9; // si long long v10; // rdi long long i; // [rsp+10h] [rbp-B8h] long long v14; // [rsp+18h] [rbp-B0h] _BYTE v15[104]; // [rsp+20h] [rbp-A8h] BYREF unsigned long long v16; // [rsp+88h] [rbp-40h] v16 = __readfsqword(0x28u); if ( a2 <= 0 ) { v3 = 0; } else { v14 = a2; v3 = 0; for ( i = 0LL; i != v14; ++i ) { v4 = i; v5 = *(_QWORD *)(a1 + 8 * i); do { LODWORD(v6) = strlen(v5); if ( (int)v6 <= 0 ) { v6 = (int)v6; } else { v6 = (int)v6; v7 = v15; v8 = (char *)(v5 + (int)v6 - 1); do { v9 = *v8--; *v7++ = v9; } while ( v8 != (char *)(v5 - 2 + (int)v6 - (unsigned int)(v6 - 1)) ); } v10 = *(_QWORD *)(a1 + 8 * v4); v15[v6] = 0; v3 += strcmp(v10, v15) == 0; ++v4; } while ( a2 > (int)v4 ); } } __sprintf_chk(&result_1, 1LL, 12LL, &unk_2004, v3); return &result_1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x98 MOV dword ptr [RSP + 0xc],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x88],RAX XOR EAX,EAX MOVSXD RAX,ESI TEST EAX,EAX JLE 0x00101477 MOV qword ptr [RSP + 0x18],RAX MOV R13,RDI XOR EBP,EBP LEA R12,[RSP + 0x20] MOV qword ptr [RSP + 0x10],0x0 NOP LAB_00101390: MOV R14,qword ptr [RSP + 0x10] MOV RBX,qword ptr [R13 + R14*0x8] LEA R15,[RBX + -0x2] NOP LAB_001013a0: MOV RDI,RBX CALL 0x00101090 TEST EAX,EAX JLE 0x00101470 LEA ESI,[RAX + -0x1] CDQE MOV RCX,R12 MOVSXD RDX,ESI LEA RDI,[R15 + RAX*0x1] MOV ESI,ESI ADD RDX,RBX SUB RDI,RSI NOP word ptr [RAX + RAX*0x1] LAB_001013d0: MOVZX ESI,byte ptr [RDX] SUB RDX,0x1 ADD RCX,0x1 MOV byte ptr [RCX + -0x1],SIL CMP RDX,RDI JNZ 0x001013d0 LAB_001013e4: MOV RDI,qword ptr [R13 + R14*0x8] MOV RSI,R12 MOV byte ptr [RSP + RAX*0x1 + 0x20],0x0 CALL 0x001010c0 CMP EAX,0x1 ADC EBP,0x0 ADD R14,0x1 CMP dword ptr [RSP + 0xc],R14D JG 0x001013a0 ADD qword ptr [RSP + 0x10],0x1 MOV RAX,qword ptr [RSP + 0x10] CMP RAX,qword ptr [RSP + 0x18] JNZ 0x00101390 LAB_0010141d: XOR EAX,EAX MOV R8D,EBP MOV EDX,0xc MOV ESI,0x1 LEA R12,[0x104018] LEA RCX,[0x102004] MOV RDI,R12 CALL 0x001010d0 MOV RAX,qword ptr [RSP + 0x88] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010147b ADD RSP,0x98 MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101470: CDQE JMP 0x001013e4 LAB_00101477: XOR EBP,EBP JMP 0x0010141d LAB_0010147b: CALL 0x001010a0
int1 * func0(long param_1,int param_2) { char cVar1; char *__s; int iVar2; size_t sVar3; char *pcVar4; char *pcVar5; int iVar6; long lVar7; long in_FS_OFFSET; long local_b8; char local_a8 [104]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); if (param_2 < 1) { iVar6 = 0; } else { iVar6 = 0; local_b8 = 0; do { __s = *(char **)(param_1 + local_b8 * 8); lVar7 = local_b8; do { sVar3 = strlen(__s); iVar2 = (int)sVar3; if (0 < iVar2) { pcVar5 = __s + (int)(iVar2 - 1U); pcVar4 = local_a8; do { cVar1 = *pcVar5; pcVar5 = pcVar5 + -1; *pcVar4 = cVar1; pcVar4 = pcVar4 + 1; } while (pcVar5 != __s + (((long)iVar2 + -2) - (ulong)(iVar2 - 1U))); } pcVar4 = *(char **)(param_1 + lVar7 * 8); local_a8[iVar2] = '\0'; iVar2 = strcmp(pcVar4,local_a8); iVar6 = iVar6 + (uint)(iVar2 == 0); lVar7 = lVar7 + 1; } while ((int)lVar7 < param_2); local_b8 = local_b8 + 1; } while (local_b8 != param_2); } __sprintf_chk(result_1,1,0xc,&DAT_00102004,iVar6); if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return result_1; }
6,923
func0
#include <stdio.h> #include <string.h> #include <assert.h>
char* func0(char* test_list[], int size) { int count = 0; for (int idx = 0; idx < size; idx++) { for (int idxn = idx; idxn < size; idxn++) { char reversed[100]; int len = strlen(test_list[idx]); for (int i = 0; i < len; i++) { reversed[i] = test_list[idx][len - 1 - i]; } reversed[len] = '\0'; if (strcmp(test_list[idxn], reversed) == 0) { count++; } } } static char result[12]; sprintf(result, "%d", count); return result; }
int main() { char* test1[] = {"julia", "best", "tseb", "for", "ailuj"}; char* test2[] = {"geeks", "best", "for", "skeeg"}; char* test3[] = {"makes", "best", "sekam", "for", "rof"}; assert(strcmp(func0(test1, 5), "2") == 0); assert(strcmp(func0(test2, 4), "1") == 0); assert(strcmp(func0(test3, 5), "2") == 0); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x98,%rsp mov %esi,0xc(%rsp) mov %fs:0x28,%rbx mov %rbx,0x88(%rsp) xor %ebx,%ebx test %esi,%esi jle 146d <func0+0xfd> mov %esi,%eax mov %rdi,%r13 lea 0x20(%rsp),%r12 xor %ebp,%ebp movq $0x0,0x10(%rsp) sub $0x1,%eax mov 0x10(%rsp),%r14 mov %rax,0x18(%rsp) nopw %cs:0x0(%rax,%rax,1) mov 0x0(%r13,%r14,8),%rbx lea -0x2(%rbx),%r15 nopl 0x0(%rax) mov %rbx,%rdi callq 1090 <strlen@plt> test %eax,%eax jle 1468 <func0+0xf8> lea -0x1(%rax),%r9d movslq %eax,%rdi mov %r12,%rcx movslq %r9d,%rdx lea (%r15,%rdi,1),%rsi mov %r9d,%r9d add %rbx,%rdx sub %r9,%rsi nopw %cs:0x0(%rax,%rax,1) movzbl (%rdx),%eax sub $0x1,%rdx add $0x1,%rcx mov %al,-0x1(%rcx) cmp %rdx,%rsi jne 1410 <func0+0xa0> movb $0x0,0x20(%rsp,%rdi,1) mov 0x0(%r13,%r14,8),%rdi mov %r12,%rsi callq 10c0 <strcmp@plt> cmp $0x1,%eax adc $0x0,%ebp add $0x1,%r14 cmp %r14d,0xc(%rsp) jg 13e0 <func0+0x70> mov 0x10(%rsp),%rbx lea 0x1(%rbx),%rax cmp %rbx,0x18(%rsp) je 146f <func0+0xff> mov %rax,0x10(%rsp) mov %rax,%r14 jmpq 13d0 <func0+0x60> nopl 0x0(%rax,%rax,1) movslq %eax,%rdi jmp 1423 <func0+0xb3> xor %ebp,%ebp xor %eax,%eax mov %ebp,%r8d mov $0xc,%edx mov $0x1,%esi lea 0xb7f(%rip),%rcx lea 0x2b8c(%rip),%rdi callq 10d0 <__sprintf_chk@plt> mov 0x88(%rsp),%rax xor %fs:0x28,%rax jne 14bd <func0+0x14d> add $0x98,%rsp lea 0x2b66(%rip),%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 10a0 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 push r15 push r14 push r13 push r12 push rbp xor ebp, ebp push rbx sub rsp, 98h mov [rsp+0C8h+var_BC], esi mov rax, fs:28h mov [rsp+0C8h+var_40], rax xor eax, eax test esi, esi jle loc_145D movsxd rax, [rsp+0C8h+var_BC] mov r13, rdi xor ebp, ebp lea r12, [rsp+0C8h+s2] mov [rsp+0C8h+var_B8], 0 mov [rsp+0C8h+var_B0], rax nop dword ptr [rax+rax+00h] loc_13C8: mov r14, [rsp+0C8h+var_B8] mov rbx, [r13+r14*8+0] lea r15, [rbx-2] nop word ptr [rax+rax+00000000h] loc_13E0: mov rdi, rbx; s call _strlen test eax, eax jle loc_14B0 lea esi, [rax-1] cdqe mov rcx, r12 movsxd rdx, esi lea rdi, [r15+rax] mov esi, esi add rdx, rbx sub rdi, rsi nop word ptr [rax+rax+00000000h] loc_1410: movzx esi, byte ptr [rdx] sub rdx, 1 add rcx, 1 mov [rcx-1], sil cmp rdi, rdx jnz short loc_1410 loc_1424: mov rdi, [r13+r14*8+0]; s1 mov rsi, r12; s2 mov [rsp+rax+0C8h+s2], 0 call _strcmp cmp eax, 1 adc ebp, 0 add r14, 1 cmp [rsp+0C8h+var_BC], r14d jg short loc_13E0 add [rsp+0C8h+var_B8], 1 mov rax, [rsp+0C8h+var_B8] cmp [rsp+0C8h+var_B0], rax jnz loc_13C8 loc_145D: xor eax, eax mov r8d, ebp mov edx, 0Ch mov esi, 2 lea rbx, result_1 lea rcx, unk_2004 mov rdi, rbx call ___sprintf_chk mov rax, [rsp+0C8h+var_40] sub rax, fs:28h jnz short loc_14B7 add rsp, 98h mov rax, rbx pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_14B0: cdqe jmp loc_1424 loc_14B7: call ___stack_chk_fail
void * func0(long long a1, int a2) { unsigned int v2; // ebp long long v4; // r14 const char *v5; // rbx long long v6; // rax char *v7; // rcx const char *v8; // rdx char v9; // si const char *v10; // rdi long long i; // [rsp+10h] [rbp-B8h] char s2[104]; // [rsp+20h] [rbp-A8h] BYREF unsigned long long v15; // [rsp+88h] [rbp-40h] v2 = 0; v15 = __readfsqword(0x28u); if ( a2 > 0 ) { v2 = 0; for ( i = 0LL; i != a2; ++i ) { v4 = i; v5 = *(const char **)(a1 + 8 * i); do { LODWORD(v6) = strlen(v5); if ( (int)v6 <= 0 ) { v6 = (int)v6; } else { v6 = (int)v6; v7 = s2; v8 = &v5[(int)v6 - 1]; do { v9 = *v8--; *v7++ = v9; } while ( &v5[(int)v6 - 2 - (unsigned int)(v6 - 1)] != v8 ); } v10 = *(const char **)(a1 + 8 * v4); s2[v6] = 0; v2 += strcmp(v10, s2) == 0; ++v4; } while ( a2 > (int)v4 ); } } __sprintf_chk(&result_1, 2LL, 12LL, &unk_2004, v2); return &result_1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP XOR EBP,EBP PUSH RBX SUB RSP,0x98 MOV dword ptr [RSP + 0xc],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x88],RAX XOR EAX,EAX TEST ESI,ESI JLE 0x0010145d MOVSXD RAX,dword ptr [RSP + 0xc] MOV R13,RDI XOR EBP,EBP LEA R12,[RSP + 0x20] MOV qword ptr [RSP + 0x10],0x0 MOV qword ptr [RSP + 0x18],RAX NOP dword ptr [RAX + RAX*0x1] LAB_001013c8: MOV R14,qword ptr [RSP + 0x10] MOV RBX,qword ptr [R13 + R14*0x8] LEA R15,[RBX + -0x2] NOP word ptr CS:[RAX + RAX*0x1] LAB_001013e0: MOV RDI,RBX CALL 0x00101090 TEST EAX,EAX JLE 0x001014b0 LEA ESI,[RAX + -0x1] CDQE MOV RCX,R12 MOVSXD RDX,ESI LEA RDI,[R15 + RAX*0x1] MOV ESI,ESI ADD RDX,RBX SUB RDI,RSI NOP word ptr [RAX + RAX*0x1] LAB_00101410: MOVZX ESI,byte ptr [RDX] SUB RDX,0x1 ADD RCX,0x1 MOV byte ptr [RCX + -0x1],SIL CMP RDI,RDX JNZ 0x00101410 LAB_00101424: MOV RDI,qword ptr [R13 + R14*0x8] MOV RSI,R12 MOV byte ptr [RSP + RAX*0x1 + 0x20],0x0 CALL 0x001010c0 CMP EAX,0x1 ADC EBP,0x0 ADD R14,0x1 CMP dword ptr [RSP + 0xc],R14D JG 0x001013e0 ADD qword ptr [RSP + 0x10],0x1 MOV RAX,qword ptr [RSP + 0x10] CMP qword ptr [RSP + 0x18],RAX JNZ 0x001013c8 LAB_0010145d: XOR EAX,EAX MOV R8D,EBP MOV EDX,0xc MOV ESI,0x2 LEA RBX,[0x104018] LEA RCX,[0x102004] MOV RDI,RBX CALL 0x001010d0 MOV RAX,qword ptr [RSP + 0x88] SUB RAX,qword ptr FS:[0x28] JNZ 0x001014b7 ADD RSP,0x98 MOV RAX,RBX POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001014b0: CDQE JMP 0x00101424 LAB_001014b7: CALL 0x001010a0
int1 * func0(long param_1,int param_2) { char cVar1; char *__s; int iVar2; size_t sVar3; char *pcVar4; char *pcVar5; int iVar6; long lVar7; long in_FS_OFFSET; long local_b8; char local_a8 [104]; long local_40; iVar6 = 0; local_40 = *(long *)(in_FS_OFFSET + 0x28); if (0 < param_2) { iVar6 = 0; local_b8 = 0; do { __s = *(char **)(param_1 + local_b8 * 8); lVar7 = local_b8; do { sVar3 = strlen(__s); iVar2 = (int)sVar3; if (0 < iVar2) { pcVar5 = __s + (int)(iVar2 - 1U); pcVar4 = local_a8; do { cVar1 = *pcVar5; pcVar5 = pcVar5 + -1; *pcVar4 = cVar1; pcVar4 = pcVar4 + 1; } while (__s + (((long)iVar2 + -2) - (ulong)(iVar2 - 1U)) != pcVar5); } pcVar4 = *(char **)(param_1 + lVar7 * 8); local_a8[iVar2] = '\0'; iVar2 = strcmp(pcVar4,local_a8); iVar6 = iVar6 + (uint)(iVar2 == 0); lVar7 = lVar7 + 1; } while ((int)lVar7 < param_2); local_b8 = local_b8 + 1; } while (param_2 != local_b8); } __sprintf_chk(result_1,2,0xc,&DAT_00102004,iVar6); if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return result_1; }
6,924
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct hash{ void* key; int value; size_t key_size; struct hash* next; } HashItem; int hash_function(void* key, size_t key_size, int buckets) { unsigned char* p = (unsigned char*) key; unsigned long hash = 5381; for (size_t i = 0; i < key_size; i++) { hash = ((hash << 5) + hash) + p[i]; } return hash % buckets; } void insert_or_increment(HashItem** hashtable, int buckets, void* key, size_t key_size) { int bucket = hash_function(key, key_size, buckets); HashItem* item = hashtable[bucket]; while (item) { if (item->key_size == key_size && memcmp(item->key, key, key_size) == 0) { item->value += 1; return; } item = item->next; } HashItem* new_item = malloc(sizeof(HashItem)); new_item->key = malloc(key_size); memcpy(new_item->key, key, key_size); new_item->key_size = key_size; new_item->value = 1; new_item->next = hashtable[bucket]; hashtable[bucket] = new_item; } void free_hashtable(HashItem** hashtable, int buckets) { for (int i = 0; i < buckets; i++) { HashItem* item = hashtable[i]; while (item) { HashItem* next = item->next; free(item->key); free(item); item = next; } } free(hashtable); }
HashItem** func0(int list1[][50], int lengths[], int list1_size) { const int buckets = 10; HashItem** hashtable = calloc(buckets, sizeof(HashItem*)); for (int i = 0; i < list1_size; i++) { insert_or_increment(hashtable, buckets, list1[i], lengths[i] * sizeof(int)); } return hashtable; }
int main() { int list1[][50] = {{1, 3}, {5, 7}, {1, 3}, {13, 15, 17}, {5, 7}, {9, 11}}; int lengths1[] = {2, 2, 2, 3, 2, 2}; int list1_size = 6; HashItem** result1 = func0(list1, lengths1, list1_size); assert(result1[hash_function((int[]){1, 3}, sizeof(int)*2, 10)]->value == 2); assert(result1[hash_function((int[]){5, 7}, sizeof(int)*2, 10)]->value == 2); assert(result1[hash_function((int[]){13, 15, 17}, sizeof(int)*3, 10)]->value == 1); assert(result1[hash_function((int[]){9, 11}, sizeof(int)*2, 10)]->value == 1); free_hashtable(result1, 10); // Additional test cases for other lists like `list2`, `list3` can be written similarly... 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 $0xa,-0xc(%rbp) mov -0xc(%rbp),%eax cltq mov $0x8,%esi mov %rax,%rdi callq 10f0 <calloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0x10(%rbp) jmp 14e1 <func0+0x99> mov -0x10(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x20(%rbp),%rax add %rdx,%rax mov (%rax),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x10(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax shl $0x3,%rax mov %rax,%rdx mov -0x18(%rbp),%rax add %rax,%rdx mov -0xc(%rbp),%esi mov -0x8(%rbp),%rax mov %rax,%rdi callq 1287 <insert_or_increment> addl $0x1,-0x10(%rbp) mov -0x10(%rbp),%eax cmp -0x24(%rbp),%eax jl 1485 <func0+0x3d> 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 [rbp+var_C], 0Ah mov eax, [rbp+var_C] cdqe mov esi, 8; size mov rdi, rax; nmemb call _calloc mov [rbp+var_8], rax mov [rbp+var_10], 0 jmp short loc_14E4 loc_1488: mov eax, [rbp+var_10] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_20] add rax, rdx mov eax, [rax] cdqe lea rcx, ds:0[rax*4] mov eax, [rbp+var_10] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx shl rax, 3 mov rdx, rax mov rax, [rbp+var_18] add rdx, rax mov esi, [rbp+var_C] mov rax, [rbp+var_8] mov rdi, rax call insert_or_increment add [rbp+var_10], 1 loc_14E4: mov eax, [rbp+var_10] cmp eax, [rbp+var_24] jl short loc_1488 mov rax, [rbp+var_8] leave retn
void * func0(long long a1, long long a2, int a3) { int i; // [rsp+20h] [rbp-10h] void *v6; // [rsp+28h] [rbp-8h] v6 = calloc(0xAuLL, 8uLL); for ( i = 0; i < a3; ++i ) insert_or_increment(v6, 10LL, a1 + 200LL * i, 4LL * *(int *)(4LL * i + a2)); 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 dword ptr [RBP + -0xc],0xa MOV EAX,dword ptr [RBP + -0xc] CDQE MOV ESI,0x8 MOV RDI,RAX CALL 0x001010f0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0x10],0x0 JMP 0x001014e4 LAB_00101488: MOV EAX,dword ptr [RBP + -0x10] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV EAX,dword ptr [RAX] CDQE LEA RCX,[RAX*0x4] MOV EAX,dword ptr [RBP + -0x10] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX SHL RAX,0x3 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x18] ADD RDX,RAX MOV ESI,dword ptr [RBP + -0xc] MOV RAX,qword ptr [RBP + -0x8] MOV RDI,RAX CALL 0x0010128a ADD dword ptr [RBP + -0x10],0x1 LAB_001014e4: MOV EAX,dword ptr [RBP + -0x10] CMP EAX,dword ptr [RBP + -0x24] JL 0x00101488 MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1,long param_2,int param_3) { void *pvVar1; int4 local_18; pvVar1 = calloc(10,8); for (local_18 = 0; local_18 < param_3; local_18 = local_18 + 1) { insert_or_increment(pvVar1,10,(long)local_18 * 200 + param_1, (long)*(int *)(param_2 + (long)local_18 * 4) * 4); } return pvVar1; }
6,925
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct hash{ void* key; int value; size_t key_size; struct hash* next; } HashItem; int hash_function(void* key, size_t key_size, int buckets) { unsigned char* p = (unsigned char*) key; unsigned long hash = 5381; for (size_t i = 0; i < key_size; i++) { hash = ((hash << 5) + hash) + p[i]; } return hash % buckets; } void insert_or_increment(HashItem** hashtable, int buckets, void* key, size_t key_size) { int bucket = hash_function(key, key_size, buckets); HashItem* item = hashtable[bucket]; while (item) { if (item->key_size == key_size && memcmp(item->key, key, key_size) == 0) { item->value += 1; return; } item = item->next; } HashItem* new_item = malloc(sizeof(HashItem)); new_item->key = malloc(key_size); memcpy(new_item->key, key, key_size); new_item->key_size = key_size; new_item->value = 1; new_item->next = hashtable[bucket]; hashtable[bucket] = new_item; } void free_hashtable(HashItem** hashtable, int buckets) { for (int i = 0; i < buckets; i++) { HashItem* item = hashtable[i]; while (item) { HashItem* next = item->next; free(item->key); free(item); item = next; } } free(hashtable); }
HashItem** func0(int list1[][50], int lengths[], int list1_size) { const int buckets = 10; HashItem** hashtable = calloc(buckets, sizeof(HashItem*)); for (int i = 0; i < list1_size; i++) { insert_or_increment(hashtable, buckets, list1[i], lengths[i] * sizeof(int)); } return hashtable; }
int main() { int list1[][50] = {{1, 3}, {5, 7}, {1, 3}, {13, 15, 17}, {5, 7}, {9, 11}}; int lengths1[] = {2, 2, 2, 3, 2, 2}; int list1_size = 6; HashItem** result1 = func0(list1, lengths1, list1_size); assert(result1[hash_function((int[]){1, 3}, sizeof(int)*2, 10)]->value == 2); assert(result1[hash_function((int[]){5, 7}, sizeof(int)*2, 10)]->value == 2); assert(result1[hash_function((int[]){13, 15, 17}, sizeof(int)*3, 10)]->value == 1); assert(result1[hash_function((int[]){9, 11}, sizeof(int)*2, 10)]->value == 1); free_hashtable(result1, 10); // Additional test cases for other lists like `list2`, `list3` can be written similarly... return 0; }
O1
c
func0: endbr64 push %r14 push %r13 push %r12 push %rbp push %rbx mov %rdi,%rbp mov %rsi,%r14 mov %edx,%r13d mov $0x8,%esi mov $0xa,%edi callq 10f0 <calloc@plt> mov %rax,%r12 test %r13d,%r13d jle 13aa <func0+0x5f> mov %r14,%rbx lea -0x1(%r13),%eax lea 0x4(%r14,%rax,4),%r13 movslq (%rbx),%rcx shl $0x2,%rcx mov %rbp,%rdx mov $0xa,%esi mov %r12,%rdi callq 124c <insert_or_increment> add $0x4,%rbx add $0xc8,%rbp cmp %r13,%rbx jne 1383 <func0+0x38> mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq
func0: endbr64 push r14 push r13 push r12 push rbp push rbx mov rbp, rdi mov r14, rsi mov r13d, edx mov esi, 8 mov edi, 0Ah call _calloc mov r12, rax test r13d, r13d jle short loc_13A5 mov rbx, r14 lea eax, [r13-1] lea r13, [r14+rax*4+4] loc_137E: movsxd rcx, dword ptr [rbx] shl rcx, 2 mov rdx, rbp mov esi, 0Ah mov rdi, r12 call insert_or_increment add rbx, 4 add rbp, 0C8h cmp rbx, r13 jnz short loc_137E loc_13A5: mov rax, r12 pop rbx pop rbp pop r12 pop r13 pop r14 retn
long long func0(long long a1, int *a2, int a3) { long long v5; // r12 int *v6; // rbx long long v7; // r13 v5 = calloc(10LL, 8LL); if ( a3 > 0 ) { v6 = a2; v7 = (long long)&a2[a3 - 1 + 1]; do { insert_or_increment(v5, 10LL, a1, 4LL * *v6++); a1 += 200LL; } while ( v6 != (int *)v7 ); } return v5; }
func0: ENDBR64 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX MOV RBP,RDI MOV R14,RSI MOV R13D,EDX MOV ESI,0x8 MOV EDI,0xa CALL 0x001010f0 MOV R12,RAX TEST R13D,R13D JLE 0x001013a5 MOV RBX,R14 LEA EAX,[R13 + -0x1] LEA R13,[R14 + RAX*0x4 + 0x4] LAB_0010137e: MOVSXD RCX,dword ptr [RBX] SHL RCX,0x2 MOV RDX,RBP MOV ESI,0xa MOV RDI,R12 CALL 0x0010124b ADD RBX,0x4 ADD RBP,0xc8 CMP RBX,R13 JNZ 0x0010137e LAB_001013a5: MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 POP R14 RET
void * func0(long param_1,int *param_2,int param_3) { int *piVar1; void *pvVar2; pvVar2 = calloc(10,8); if (0 < param_3) { piVar1 = param_2 + (ulong)(param_3 - 1) + 1; do { insert_or_increment(pvVar2,10,param_1,(long)*param_2 << 2); param_2 = param_2 + 1; param_1 = param_1 + 200; } while (param_2 != piVar1); } return pvVar2; }
6,926
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct hash{ void* key; int value; size_t key_size; struct hash* next; } HashItem; int hash_function(void* key, size_t key_size, int buckets) { unsigned char* p = (unsigned char*) key; unsigned long hash = 5381; for (size_t i = 0; i < key_size; i++) { hash = ((hash << 5) + hash) + p[i]; } return hash % buckets; } void insert_or_increment(HashItem** hashtable, int buckets, void* key, size_t key_size) { int bucket = hash_function(key, key_size, buckets); HashItem* item = hashtable[bucket]; while (item) { if (item->key_size == key_size && memcmp(item->key, key, key_size) == 0) { item->value += 1; return; } item = item->next; } HashItem* new_item = malloc(sizeof(HashItem)); new_item->key = malloc(key_size); memcpy(new_item->key, key, key_size); new_item->key_size = key_size; new_item->value = 1; new_item->next = hashtable[bucket]; hashtable[bucket] = new_item; } void free_hashtable(HashItem** hashtable, int buckets) { for (int i = 0; i < buckets; i++) { HashItem* item = hashtable[i]; while (item) { HashItem* next = item->next; free(item->key); free(item); item = next; } } free(hashtable); }
HashItem** func0(int list1[][50], int lengths[], int list1_size) { const int buckets = 10; HashItem** hashtable = calloc(buckets, sizeof(HashItem*)); for (int i = 0; i < list1_size; i++) { insert_or_increment(hashtable, buckets, list1[i], lengths[i] * sizeof(int)); } return hashtable; }
int main() { int list1[][50] = {{1, 3}, {5, 7}, {1, 3}, {13, 15, 17}, {5, 7}, {9, 11}}; int lengths1[] = {2, 2, 2, 3, 2, 2}; int list1_size = 6; HashItem** result1 = func0(list1, lengths1, list1_size); assert(result1[hash_function((int[]){1, 3}, sizeof(int)*2, 10)]->value == 2); assert(result1[hash_function((int[]){5, 7}, sizeof(int)*2, 10)]->value == 2); assert(result1[hash_function((int[]){13, 15, 17}, sizeof(int)*3, 10)]->value == 1); assert(result1[hash_function((int[]){9, 11}, sizeof(int)*2, 10)]->value == 1); free_hashtable(result1, 10); // Additional test cases for other lists like `list2`, `list3` can be written similarly... return 0; }
O2
c
func0: endbr64 push %r13 mov %edx,%r13d push %r12 push %rbp mov %rdi,%rbp mov $0xa,%edi push %rbx mov %rsi,%rbx mov $0x8,%esi sub $0x8,%rsp callq 10f0 <calloc@plt> mov %rax,%r12 test %r13d,%r13d jle 1747 <func0+0x67> lea -0x1(%r13),%eax lea 0x4(%rbx,%rax,4),%r13 nopw 0x0(%rax,%rax,1) movslq (%rbx),%rcx mov %rbp,%rdx mov $0xa,%esi mov %r12,%rdi add $0x4,%rbx add $0xc8,%rbp shl $0x2,%rcx callq 1580 <insert_or_increment> cmp %r13,%rbx jne 1720 <func0+0x40> add $0x8,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r13 mov r13d, edx push r12 push rbp mov rbp, rdi mov edi, 0Ah push rbx mov rbx, rsi mov esi, 8 sub rsp, 8 call _calloc mov r12, rax test r13d, r13d jle short loc_1757 lea eax, [r13-1] lea r13, [rbx+rax*4+4] nop word ptr [rax+rax+00000000h] loc_1730: movsxd rcx, dword ptr [rbx] mov rdx, rbp mov esi, 0Ah mov rdi, r12 add rbx, 4 add rbp, 0C8h shl rcx, 2 call insert_or_increment cmp rbx, r13 jnz short loc_1730 loc_1757: add rsp, 8 mov rax, r12 pop rbx pop rbp pop r12 pop r13 retn
long long func0(long long a1, int *a2, int a3) { int *v5; // rbx long long v6; // r12 long long v7; // r13 long long v8; // rcx long long v9; // rdx v5 = a2; v6 = calloc(10LL, 8LL); if ( a3 > 0 ) { v7 = (long long)&a2[a3 - 1 + 1]; do { v8 = *v5; v9 = a1; ++v5; a1 += 200LL; insert_or_increment(v6, 10LL, v9, 4 * v8); } while ( v5 != (int *)v7 ); } return v6; }
func0: ENDBR64 PUSH R13 MOV R13D,EDX PUSH R12 PUSH RBP MOV RBP,RDI MOV EDI,0xa PUSH RBX MOV RBX,RSI MOV ESI,0x8 SUB RSP,0x8 CALL 0x001010f0 MOV R12,RAX TEST R13D,R13D JLE 0x00101757 LEA EAX,[R13 + -0x1] LEA R13,[RBX + RAX*0x4 + 0x4] NOP word ptr [RAX + RAX*0x1] LAB_00101730: MOVSXD RCX,dword ptr [RBX] MOV RDX,RBP MOV ESI,0xa MOV RDI,R12 ADD RBX,0x4 ADD RBP,0xc8 SHL RCX,0x2 CALL 0x00101590 CMP RBX,R13 JNZ 0x00101730 LAB_00101757: ADD RSP,0x8 MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 RET
void * func0(long param_1,int *param_2,int param_3) { int *piVar1; int iVar2; void *pvVar3; pvVar3 = calloc(10,8); if (0 < param_3) { piVar1 = param_2 + (ulong)(param_3 - 1) + 1; do { iVar2 = *param_2; param_2 = param_2 + 1; insert_or_increment(pvVar3,10,param_1,(long)iVar2 << 2); param_1 = param_1 + 200; } while (param_2 != piVar1); } return pvVar3; }
6,927
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct hash{ void* key; int value; size_t key_size; struct hash* next; } HashItem; int hash_function(void* key, size_t key_size, int buckets) { unsigned char* p = (unsigned char*) key; unsigned long hash = 5381; for (size_t i = 0; i < key_size; i++) { hash = ((hash << 5) + hash) + p[i]; } return hash % buckets; } void insert_or_increment(HashItem** hashtable, int buckets, void* key, size_t key_size) { int bucket = hash_function(key, key_size, buckets); HashItem* item = hashtable[bucket]; while (item) { if (item->key_size == key_size && memcmp(item->key, key, key_size) == 0) { item->value += 1; return; } item = item->next; } HashItem* new_item = malloc(sizeof(HashItem)); new_item->key = malloc(key_size); memcpy(new_item->key, key, key_size); new_item->key_size = key_size; new_item->value = 1; new_item->next = hashtable[bucket]; hashtable[bucket] = new_item; } void free_hashtable(HashItem** hashtable, int buckets) { for (int i = 0; i < buckets; i++) { HashItem* item = hashtable[i]; while (item) { HashItem* next = item->next; free(item->key); free(item); item = next; } } free(hashtable); }
HashItem** func0(int list1[][50], int lengths[], int list1_size) { const int buckets = 10; HashItem** hashtable = calloc(buckets, sizeof(HashItem*)); for (int i = 0; i < list1_size; i++) { insert_or_increment(hashtable, buckets, list1[i], lengths[i] * sizeof(int)); } return hashtable; }
int main() { int list1[][50] = {{1, 3}, {5, 7}, {1, 3}, {13, 15, 17}, {5, 7}, {9, 11}}; int lengths1[] = {2, 2, 2, 3, 2, 2}; int list1_size = 6; HashItem** result1 = func0(list1, lengths1, list1_size); assert(result1[hash_function((int[]){1, 3}, sizeof(int)*2, 10)]->value == 2); assert(result1[hash_function((int[]){5, 7}, sizeof(int)*2, 10)]->value == 2); assert(result1[hash_function((int[]){13, 15, 17}, sizeof(int)*3, 10)]->value == 1); assert(result1[hash_function((int[]){9, 11}, sizeof(int)*2, 10)]->value == 1); free_hashtable(result1, 10); // Additional test cases for other lists like `list2`, `list3` can be written similarly... return 0; }
O3
c
func0: endbr64 push %r13 mov %edx,%r13d push %r12 push %rbp mov %rdi,%rbp mov $0xa,%edi push %rbx mov %rsi,%rbx mov $0x8,%esi sub $0x8,%rsp callq 10f0 <calloc@plt> mov %rax,%r12 test %r13d,%r13d jle 17d7 <func0+0x67> lea -0x1(%r13),%eax lea 0x4(%rbx,%rax,4),%r13 nopw 0x0(%rax,%rax,1) movslq (%rbx),%rcx mov %rbp,%rdx mov $0xa,%esi mov %r12,%rdi add $0x4,%rbx add $0xc8,%rbp shl $0x2,%rcx callq 1610 <insert_or_increment> cmp %rbx,%r13 jne 17b0 <func0+0x40> add $0x8,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r13 movsxd r13, edx push r12 push rbp mov rbp, rdi mov edi, 0Ah; nmemb push rbx mov rbx, rsi mov esi, 8; size sub rsp, 8 call _calloc mov r12, rax test r13d, r13d jle short loc_159F lea r13, [rbx+r13*4] nop word ptr [rax+rax+00h] loc_1578: movsxd rcx, dword ptr [rbx] mov rdx, rbp mov esi, 0Ah mov rdi, r12 add rbx, 4 add rbp, 0C8h shl rcx, 2 call insert_or_increment cmp r13, rbx jnz short loc_1578 loc_159F: add rsp, 8 mov rax, r12 pop rbx pop rbp pop r12 pop r13 retn
void * func0(long long a1, int *a2, int a3) { long long v3; // r13 int *v5; // rbx void *v6; // r12 int *v7; // r13 long long v8; // rcx long long v9; // rdx v3 = a3; v5 = a2; v6 = calloc(0xAuLL, 8uLL); if ( (int)v3 > 0 ) { v7 = &a2[v3]; do { v8 = *v5; v9 = a1; ++v5; a1 += 200LL; insert_or_increment(v6, 10LL, v9, 4 * v8); } while ( v7 != v5 ); } return v6; }
func0: ENDBR64 PUSH R13 MOVSXD R13,EDX PUSH R12 PUSH RBP MOV RBP,RDI MOV EDI,0xa PUSH RBX MOV RBX,RSI MOV ESI,0x8 SUB RSP,0x8 CALL 0x001010f0 MOV R12,RAX TEST R13D,R13D JLE 0x0010159f LEA R13,[RBX + R13*0x4] NOP word ptr [RAX + RAX*0x1] LAB_00101578: MOVSXD RCX,dword ptr [RBX] MOV RDX,RBP MOV ESI,0xa MOV RDI,R12 ADD RBX,0x4 ADD RBP,0xc8 SHL RCX,0x2 CALL 0x001013e0 CMP R13,RBX JNZ 0x00101578 LAB_0010159f: ADD RSP,0x8 MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 RET
void * func0(long param_1,int *param_2,int param_3) { int *piVar1; int iVar2; void *pvVar3; pvVar3 = calloc(10,8); if (0 < param_3) { piVar1 = param_2 + param_3; do { iVar2 = *param_2; param_2 = param_2 + 1; insert_or_increment(pvVar3,10,param_1,(long)iVar2 << 2); param_1 = param_1 + 200; } while (piVar1 != param_2); } return pvVar3; }
6,928
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <stdbool.h>
bool func0(const char *num) { regex_t regex; int result; char *pattern = "^[0-9]+(\\.[0-9]{1,2})?$"; if (regcomp(&regex, pattern, REG_EXTENDED) != 0) { return false; // Compilation failed } result = regexec(&regex, num, 0, NULL, 0); regfree(&regex); return result == 0; // Return true if the regular expression matches the entire string }
int main() { assert(func0("123.11") == true); assert(func0("e666.86") == false); assert(func0("3.124587") == false); printf("All tests passed successfully.\n"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x70,%rsp mov %rdi,-0x68(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea 0xdf9(%rip),%rax mov %rax,-0x58(%rbp) mov -0x58(%rbp),%rcx lea -0x50(%rbp),%rax mov $0x1,%edx mov %rcx,%rsi mov %rax,%rdi callq 10e0 <regcomp@plt> test %eax,%eax je 1236 <func0+0x4d> mov $0x0,%eax jmp 126c <func0+0x83> mov -0x68(%rbp),%rsi lea -0x50(%rbp),%rax mov $0x0,%r8d mov $0x0,%ecx mov $0x0,%edx mov %rax,%rdi callq 10f0 <regexec@plt> mov %eax,-0x5c(%rbp) lea -0x50(%rbp),%rax mov %rax,%rdi callq 10b0 <regfree@plt> cmpl $0x0,-0x5c(%rbp) sete %al mov -0x8(%rbp),%rdx xor %fs:0x28,%rdx je 1280 <func0+0x97> callq 10c0 <__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, a090912; "^[0-9]+(\\.[0-9]{1,2})?$" mov [rbp+pattern], rax mov rcx, [rbp+pattern] lea rax, [rbp+preg] mov edx, 1; cflags mov rsi, rcx; pattern mov rdi, rax; preg call _regcomp test eax, eax jz short loc_1236 mov eax, 0 jmp short loc_126C loc_1236: 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 lea rax, [rbp+preg] mov rdi, rax; preg call _regfree cmp [rbp+var_5C], 0 setz al loc_126C: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_1280 call ___stack_chk_fail locret_1280: leave retn
bool 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, "^[0-9]+(\\.[0-9]{1,2})?$", 1) ) return 0; v2 = regexec(&preg, a1, 0LL, 0LL, 0); regfree(&preg); return v2 == 0; }
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 0x001010e0 TEST EAX,EAX JZ 0x00101236 MOV EAX,0x0 JMP 0x0010126c LAB_00101236: MOV RSI,qword ptr [RBP + -0x68] LEA RAX,[RBP + -0x50] MOV R8D,0x0 MOV ECX,0x0 MOV EDX,0x0 MOV RDI,RAX CALL 0x001010f0 MOV dword ptr [RBP + -0x5c],EAX LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001010b0 CMP dword ptr [RBP + -0x5c],0x0 SETZ AL LAB_0010126c: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x00101280 CALL 0x001010c0 LAB_00101280: LEAVE RET
bool func0(char *param_1) { int iVar1; long in_FS_OFFSET; bool bVar2; regex_t local_58; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&local_58,"^[0-9]+(\\.[0-9]{1,2})?$",1); if (iVar1 == 0) { iVar1 = regexec(&local_58,param_1,0,(regmatch_t *)0x0,0); regfree(&local_58); bVar2 = iVar1 == 0; } else { bVar2 = false; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return bVar2; }
6,929
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <stdbool.h>
bool func0(const char *num) { regex_t regex; int result; char *pattern = "^[0-9]+(\\.[0-9]{1,2})?$"; if (regcomp(&regex, pattern, REG_EXTENDED) != 0) { return false; // Compilation failed } result = regexec(&regex, num, 0, NULL, 0); regfree(&regex); return result == 0; // Return true if the regular expression matches the entire string }
int main() { assert(func0("123.11") == true); assert(func0("e666.86") == false); assert(func0("3.124587") == false); printf("All tests passed successfully.\n"); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x58,%rsp mov %rdi,%rbx mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov %rsp,%rdi mov $0x1,%edx lea 0xdef(%rip),%rsi callq 10e0 <regcomp@plt> mov %eax,%edx mov $0x0,%eax test %edx,%edx je 123c <func0+0x53> mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 126b <func0+0x82> add $0x58,%rsp pop %rbx pop %rbp retq mov %rsp,%rbp mov $0x0,%r8d mov $0x0,%ecx mov $0x0,%edx mov %rbx,%rsi mov %rbp,%rdi callq 10f0 <regexec@plt> mov %eax,%ebx mov %rbp,%rdi callq 10b0 <regfree@plt> test %ebx,%ebx sete %al jmp 1225 <func0+0x3c> callq 10c0 <__stack_chk_fail@plt>
func0: endbr64 push rbp push rbx sub rsp, 58h mov rbx, rdi mov rax, fs:28h mov [rsp+68h+var_20], rax xor eax, eax mov rdi, rsp mov edx, 1 lea rsi, a090912; "^[0-9]+(\\.[0-9]{1,2})?$" call _regcomp mov edx, eax mov eax, 0 test edx, edx jz short loc_123C loc_1225: mov rdx, [rsp+68h+var_20] sub rdx, fs:28h jnz short loc_126B add rsp, 58h pop rbx pop rbp retn loc_123C: mov rbp, rsp mov r8d, 0 mov ecx, 0 mov edx, 0 mov rsi, rbx mov rdi, rbp call _regexec mov ebx, eax mov rdi, rbp call _regfree test ebx, ebx setz al jmp short loc_1225 loc_126B: call ___stack_chk_fail
bool func0(long long a1) { int v1; // edx bool result; // al int v3; // ebx _QWORD v4[13]; // [rsp+0h] [rbp-68h] BYREF v4[9] = __readfsqword(0x28u); v1 = regcomp(v4, "^[0-9]+(\\.[0-9]{1,2})?$", 1LL); result = 0; if ( !v1 ) { v3 = regexec(v4, a1, 0LL, 0LL, 0LL); regfree(v4); return v3 == 0; } return result; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x58 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,[0x102004] CALL 0x001010e0 MOV EDX,EAX MOV EAX,0x0 TEST EDX,EDX JZ 0x0010123c LAB_00101225: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x0010126b ADD RSP,0x58 POP RBX POP RBP RET LAB_0010123c: MOV RBP,RSP MOV R8D,0x0 MOV ECX,0x0 MOV EDX,0x0 MOV RSI,RBX MOV RDI,RBP CALL 0x001010f0 MOV EBX,EAX MOV RDI,RBP CALL 0x001010b0 TEST EBX,EBX SETZ AL JMP 0x00101225 LAB_0010126b: CALL 0x001010c0
bool func0(char *param_1) { int iVar1; long in_FS_OFFSET; bool bVar2; regex_t rStack_68; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"^[0-9]+(\\.[0-9]{1,2})?$",1); bVar2 = false; if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0); regfree(&rStack_68); bVar2 = iVar1 == 0; } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return bVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
6,930
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <stdbool.h>
bool func0(const char *num) { regex_t regex; int result; char *pattern = "^[0-9]+(\\.[0-9]{1,2})?$"; if (regcomp(&regex, pattern, REG_EXTENDED) != 0) { return false; // Compilation failed } result = regexec(&regex, num, 0, NULL, 0); regfree(&regex); return result == 0; // Return true if the regular expression matches the entire string }
int main() { assert(func0("123.11") == true); assert(func0("e666.86") == false); assert(func0("3.124587") == false); printf("All tests passed successfully.\n"); return 0; }
O2
c
func0: endbr64 push %r12 mov $0x1,%edx lea 0xd52(%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 10e0 <regcomp@plt> mov %eax,%r8d xor %eax,%eax test %r8d,%r8d jne 12fd <func0+0x5d> xor %ecx,%ecx xor %edx,%edx mov %rbp,%rsi mov %r12,%rdi callq 10f0 <regexec@plt> mov %r12,%rdi mov %eax,%ebp callq 10b0 <regfree@plt> test %ebp,%ebp sete %al mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 1315 <func0+0x75> add $0x58,%rsp pop %rbp pop %r12 retq callq 10c0 <__stack_chk_fail@plt> nopw 0x0(%rax,%rax,1)
func0: endbr64 push r12 mov edx, 1 lea rsi, a090912; "^[0-9]+(\\.[0-9]{1,2})?$" 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 xor eax, eax test r8d, r8d jnz short loc_12FD xor ecx, ecx xor edx, edx mov rsi, rbp mov rdi, r12 call _regexec mov rdi, r12 mov ebp, eax call _regfree test ebp, ebp setz al loc_12FD: mov rdx, [rsp+68h+var_20] sub rdx, fs:28h jnz short loc_1315 add rsp, 58h pop rbp pop r12 retn loc_1315: call ___stack_chk_fail
bool func0(long long a1) { int v1; // r8d bool result; // al int v3; // ebp _QWORD v4[13]; // [rsp+0h] [rbp-68h] BYREF v4[9] = __readfsqword(0x28u); v1 = regcomp(v4, "^[0-9]+(\\.[0-9]{1,2})?$", 1LL); result = 0; if ( !v1 ) { v3 = regexec(v4, a1, 0LL, 0LL); regfree(v4); return v3 == 0; } return result; }
func0: ENDBR64 PUSH R12 MOV EDX,0x1 LEA RSI,[0x102004] 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 0x001010e0 MOV R8D,EAX XOR EAX,EAX TEST R8D,R8D JNZ 0x001012fd XOR ECX,ECX XOR EDX,EDX MOV RSI,RBP MOV RDI,R12 CALL 0x001010f0 MOV RDI,R12 MOV EBP,EAX CALL 0x001010b0 TEST EBP,EBP SETZ AL LAB_001012fd: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101315 ADD RSP,0x58 POP RBP POP R12 RET LAB_00101315: CALL 0x001010c0
bool func0(char *param_1) { int iVar1; long in_FS_OFFSET; bool bVar2; regex_t rStack_68; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"^[0-9]+(\\.[0-9]{1,2})?$",1); bVar2 = false; if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0); regfree(&rStack_68); bVar2 = iVar1 == 0; } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return bVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
6,931
func0
#include <stdio.h> #include <assert.h> #include <regex.h> #include <stdbool.h>
bool func0(const char *num) { regex_t regex; int result; char *pattern = "^[0-9]+(\\.[0-9]{1,2})?$"; if (regcomp(&regex, pattern, REG_EXTENDED) != 0) { return false; // Compilation failed } result = regexec(&regex, num, 0, NULL, 0); regfree(&regex); return result == 0; // Return true if the regular expression matches the entire string }
int main() { assert(func0("123.11") == true); assert(func0("e666.86") == false); assert(func0("3.124587") == false); printf("All tests passed successfully.\n"); return 0; }
O3
c
func0: endbr64 push %r12 mov $0x1,%edx lea 0xd52(%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 10e0 <regcomp@plt> mov %eax,%r8d xor %eax,%eax test %r8d,%r8d jne 12fd <func0+0x5d> xor %ecx,%ecx xor %edx,%edx mov %rbp,%rsi mov %r12,%rdi callq 10f0 <regexec@plt> mov %r12,%rdi mov %eax,%ebp callq 10b0 <regfree@plt> test %ebp,%ebp sete %al mov 0x48(%rsp),%rcx xor %fs:0x28,%rcx jne 1315 <func0+0x75> add $0x58,%rsp pop %rbp pop %r12 retq callq 10c0 <__stack_chk_fail@plt> nopw 0x0(%rax,%rax,1)
func0: endbr64 push rbp mov edx, 1; cflags lea rsi, pattern; "^[0-9]+(\\.[0-9]{1,2})?$" 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 xor eax, eax test edx, edx jnz short loc_12FD xor r8d, r8d; eflags xor ecx, ecx; pmatch xor edx, edx; nmatch mov rsi, rbx; string mov rdi, rbp; preg call _regexec mov rdi, rbp; preg mov ebx, eax call _regfree test ebx, ebx setz al loc_12FD: mov rdx, [rsp+var_s48] sub rdx, fs:28h jnz short loc_1314 add rsp, 58h pop rbx pop rbp retn loc_1314: call ___stack_chk_fail
bool func0(char *string) { int v1; // edx bool result; // al int v3; // ebx regex_t _0; // [rsp+0h] [rbp+0h] BYREF unsigned long long vars48; // [rsp+48h] [rbp+48h] vars48 = __readfsqword(0x28u); v1 = regcomp(&_0, "^[0-9]+(\\.[0-9]{1,2})?$", 1); result = 0; if ( !v1 ) { v3 = regexec(&_0, string, 0LL, 0LL, 0); regfree(&_0); return v3 == 0; } return result; }
func0: ENDBR64 PUSH RBP MOV EDX,0x1 LEA RSI,[0x102004] 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 0x001010e0 MOV EDX,EAX XOR EAX,EAX TEST EDX,EDX JNZ 0x001012fd XOR R8D,R8D XOR ECX,ECX XOR EDX,EDX MOV RSI,RBX MOV RDI,RBP CALL 0x001010f0 MOV RDI,RBP MOV EBX,EAX CALL 0x001010b0 TEST EBX,EBX SETZ AL LAB_001012fd: MOV RDX,qword ptr [RSP + 0x48] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101314 ADD RSP,0x58 POP RBX POP RBP RET LAB_00101314: CALL 0x001010c0
bool func0(char *param_1) { int iVar1; long in_FS_OFFSET; bool bVar2; regex_t rStack_68; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = regcomp(&rStack_68,"^[0-9]+(\\.[0-9]{1,2})?$",1); bVar2 = false; if (iVar1 == 0) { iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0); regfree(&rStack_68); bVar2 = iVar1 == 0; } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return bVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
6,932
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h>
const char* func0(int arr[], int n) { for(int i = 1; i < n; i++) { if(arr[i] != arr[0]) { return "NO"; } } return "YES"; }
int main() { int arr1[] = {1, 1, 1}; assert(strcmp(func0(arr1, 3), "YES") == 0); int arr2[] = {1, 2, 1, 2}; assert(strcmp(func0(arr2, 4), "NO") == 0); int arr3[] = {1, 2, 3, 4, 5}; assert(strcmp(func0(arr3, 5), "NO") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x1,-0x4(%rbp) jmp 11ce <func0+0x45> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x18(%rbp),%rax mov (%rax),%eax cmp %eax,%edx je 11ca <func0+0x41> lea 0xe40(%rip),%rax jmp 11dd <func0+0x54> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11a1 <func0+0x18> lea 0xe2e(%rip),%rax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_4], 1 jmp short loc_11CE loc_11A1: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov rax, [rbp+var_18] mov eax, [rax] cmp edx, eax jz short loc_11CA lea rax, aNo; "NO" jmp short loc_11DD loc_11CA: add [rbp+var_4], 1 loc_11CE: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_11A1 lea rax, s2; "YES" loc_11DD: pop rbp retn
const char * func0(_DWORD *a1, int a2) { int i; // [rsp+18h] [rbp-4h] for ( i = 1; i < a2; ++i ) { if ( a1[i] != *a1 ) return "NO"; } return "YES"; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x4],0x1 JMP 0x001011ce LAB_001011a1: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x18] MOV EAX,dword ptr [RAX] CMP EDX,EAX JZ 0x001011ca LEA RAX,[0x102008] JMP 0x001011dd LAB_001011ca: ADD dword ptr [RBP + -0x4],0x1 LAB_001011ce: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011a1 LEA RAX,[0x10200b] LAB_001011dd: POP RBP RET
int * func0(int *param_1,int param_2) { int local_c; local_c = 1; while( true ) { if (param_2 <= local_c) { return &DAT_0010200b; } if (param_1[local_c] != *param_1) break; local_c = local_c + 1; } return &DAT_00102008; }
6,933
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h>
const char* func0(int arr[], int n) { for(int i = 1; i < n; i++) { if(arr[i] != arr[0]) { return "NO"; } } return "YES"; }
int main() { int arr1[] = {1, 1, 1}; assert(strcmp(func0(arr1, 3), "YES") == 0); int arr2[] = {1, 2, 1, 2}; assert(strcmp(func0(arr2, 4), "NO") == 0); int arr3[] = {1, 2, 3, 4, 5}; assert(strcmp(func0(arr3, 5), "NO") == 0); return 0; }
O1
c
func0: endbr64 lea 0xe93(%rip),%rax cmp $0x1,%esi jle 11a3 <func0+0x3a> mov (%rdi),%edx lea 0x4(%rdi),%rax lea -0x2(%rsi),%ecx lea 0x8(%rdi,%rcx,4),%rcx cmp %edx,(%rax) jne 119c <func0+0x33> add $0x4,%rax cmp %rcx,%rax jne 1187 <func0+0x1e> lea 0xe6c(%rip),%rax retq lea 0xe61(%rip),%rax retq
func0: endbr64 lea rax, unk_2007 cmp esi, 1 jle short locret_11C3 mov edx, [rdi] lea rax, [rdi+4] lea ecx, [rsi-2] lea rcx, [rdi+rcx*4+8] loc_11A7: cmp [rax], edx jnz short loc_11BC add rax, 4 cmp rax, rcx jnz short loc_11A7 lea rax, unk_2007 retn loc_11BC: lea rax, unk_2004 locret_11C3: retn
void * func0(_DWORD *a1, int a2) { void *result; // rax _DWORD *v3; // rax result = &unk_2007; if ( a2 > 1 ) { v3 = a1 + 1; while ( *v3 == *a1 ) { if ( ++v3 == &a1[a2 - 2 + 2] ) return &unk_2007; } return &unk_2004; } return result; }
func0: ENDBR64 LEA RAX,[0x102007] CMP ESI,0x1 JLE 0x001011c3 MOV EDX,dword ptr [RDI] LEA RAX,[RDI + 0x4] LEA ECX,[RSI + -0x2] LEA RCX,[RDI + RCX*0x4 + 0x8] LAB_001011a7: CMP dword ptr [RAX],EDX JNZ 0x001011bc ADD RAX,0x4 CMP RAX,RCX JNZ 0x001011a7 LEA RAX,[0x102007] RET LAB_001011bc: LEA RAX,[0x102004] LAB_001011c3: RET
int * func0(int *param_1,int param_2) { int *puVar1; int *piVar2; puVar1 = &DAT_00102007; if (1 < param_2) { piVar2 = param_1 + 1; while (*piVar2 == *param_1) { piVar2 = piVar2 + 1; if (piVar2 == param_1 + (ulong)(param_2 - 2) + 2) { return &DAT_00102007; } } puVar1 = &DAT_00102004; } return puVar1; }
6,934
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h>
const char* func0(int arr[], int n) { for(int i = 1; i < n; i++) { if(arr[i] != arr[0]) { return "NO"; } } return "YES"; }
int main() { int arr1[] = {1, 1, 1}; assert(strcmp(func0(arr1, 3), "YES") == 0); int arr2[] = {1, 2, 1, 2}; assert(strcmp(func0(arr2, 4), "NO") == 0); int arr3[] = {1, 2, 3, 4, 5}; assert(strcmp(func0(arr3, 5), "NO") == 0); return 0; }
O2
c
func0: endbr64 lea 0xebc(%rip),%rax cmp $0x1,%esi jle 1174 <func0+0x34> lea -0x2(%rsi),%ecx mov (%rdi),%edx lea 0x4(%rdi),%rax lea 0x8(%rdi,%rcx,4),%rcx jmp 1169 <func0+0x29> add $0x4,%rax cmp %rcx,%rax je 1178 <func0+0x38> cmp %edx,(%rax) je 1160 <func0+0x20> lea 0xe90(%rip),%rax retq nopl (%rax) lea 0xe88(%rip),%rax retq
func0: endbr64 lea rax, unk_2007 cmp esi, 1 jle short locret_1174 lea ecx, [rsi-2] mov edx, [rdi] lea rax, [rdi+4] lea rcx, [rdi+rcx*4+8] jmp short loc_1169 loc_1160: add rax, 4 cmp rax, rcx jz short loc_1178 loc_1169: cmp [rax], edx jz short loc_1160 lea rax, unk_2004 locret_1174: retn loc_1178: lea rax, unk_2007 retn
void * func0(_DWORD *a1, int a2) { void *result; // rax _DWORD *v3; // rax result = &unk_2007; if ( a2 > 1 ) { v3 = a1 + 1; do { if ( *v3 != *a1 ) return &unk_2004; ++v3; } while ( v3 != &a1[a2 - 2 + 2] ); return &unk_2007; } return result; }
func0: ENDBR64 LEA RAX,[0x102007] CMP ESI,0x1 JLE 0x00101174 LEA ECX,[RSI + -0x2] MOV EDX,dword ptr [RDI] LEA RAX,[RDI + 0x4] LEA RCX,[RDI + RCX*0x4 + 0x8] JMP 0x00101169 LAB_00101160: ADD RAX,0x4 CMP RAX,RCX JZ 0x00101178 LAB_00101169: CMP dword ptr [RAX],EDX JZ 0x00101160 LEA RAX,[0x102004] LAB_00101174: RET LAB_00101178: LEA RAX,[0x102007] RET
int * func0(int *param_1,int param_2) { int *puVar1; int *piVar2; puVar1 = &DAT_00102007; if (1 < param_2) { piVar2 = param_1 + 1; while (*piVar2 == *param_1) { piVar2 = piVar2 + 1; if (piVar2 == param_1 + (ulong)(param_2 - 2) + 2) { return &DAT_00102007; } } puVar1 = &DAT_00102004; } return puVar1; }
6,935
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h>
const char* func0(int arr[], int n) { for(int i = 1; i < n; i++) { if(arr[i] != arr[0]) { return "NO"; } } return "YES"; }
int main() { int arr1[] = {1, 1, 1}; assert(strcmp(func0(arr1, 3), "YES") == 0); int arr2[] = {1, 2, 1, 2}; assert(strcmp(func0(arr2, 4), "NO") == 0); int arr3[] = {1, 2, 3, 4, 5}; assert(strcmp(func0(arr3, 5), "NO") == 0); return 0; }
O3
c
func0: endbr64 lea 0xebc(%rip),%rax cmp $0x1,%esi jle 1174 <func0+0x34> lea -0x2(%rsi),%ecx mov (%rdi),%edx lea 0x4(%rdi),%rax lea 0x8(%rdi,%rcx,4),%rcx jmp 1169 <func0+0x29> add $0x4,%rax cmp %rcx,%rax je 1178 <func0+0x38> cmp %edx,(%rax) je 1160 <func0+0x20> lea 0xe90(%rip),%rax retq nopl (%rax) lea 0xe88(%rip),%rax retq
func0: endbr64 lea rax, unk_2007 cmp esi, 1 jle short locret_1174 lea ecx, [rsi-2] mov edx, [rdi] lea rax, [rdi+4] lea rcx, [rdi+rcx*4+8] jmp short loc_1169 loc_1160: add rax, 4 cmp rax, rcx jz short loc_1178 loc_1169: cmp [rax], edx jz short loc_1160 lea rax, unk_2004 locret_1174: retn loc_1178: lea rax, unk_2007 retn
void * func0(_DWORD *a1, int a2) { void *result; // rax _DWORD *v3; // rax result = &unk_2007; if ( a2 > 1 ) { v3 = a1 + 1; do { if ( *v3 != *a1 ) return &unk_2004; ++v3; } while ( v3 != &a1[a2 - 2 + 2] ); return &unk_2007; } return result; }
func0: ENDBR64 LEA RAX,[0x102007] CMP ESI,0x1 JLE 0x00101174 LEA ECX,[RSI + -0x2] MOV EDX,dword ptr [RDI] LEA RAX,[RDI + 0x4] LEA RCX,[RDI + RCX*0x4 + 0x8] JMP 0x00101169 LAB_00101160: ADD RAX,0x4 CMP RAX,RCX JZ 0x00101178 LAB_00101169: CMP dword ptr [RAX],EDX JZ 0x00101160 LEA RAX,[0x102004] LAB_00101174: RET LAB_00101178: LEA RAX,[0x102007] RET
int * func0(int *param_1,int param_2) { int *puVar1; int *piVar2; puVar1 = &DAT_00102007; if (1 < param_2) { piVar2 = param_1 + 1; while (*piVar2 == *param_1) { piVar2 = piVar2 + 1; if (piVar2 == param_1 + (ulong)(param_2 - 2) + 2) { return &DAT_00102007; } } puVar1 = &DAT_00102004; } return puVar1; }
6,936
func0
#include <assert.h> #include <stdio.h>
double func0(double d, double a){ double pi = 22.0/7.0; if (a >= 360){ return -1; // Use -1 to represent None since C does not have a None type } double arclength = (pi * d) * (a / 360); return arclength; }
int main() { assert(func0(9, 45) - 3.5357142857142856 < 0.0001); assert(func0(9, 480) == -1); // Using -1 to represent None assert(func0(5, 270) - 11.785714285714285 < 0.0001); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp movsd %xmm0,-0x18(%rbp) movsd %xmm1,-0x20(%rbp) movsd 0xf5d(%rip),%xmm0 movsd %xmm0,-0x10(%rbp) movsd -0x20(%rbp),%xmm0 comisd 0xf53(%rip),%xmm0 jb 1181 <func0+0x38> movsd 0xf51(%rip),%xmm0 jmp 11ae <func0+0x65> movsd -0x10(%rbp),%xmm0 movapd %xmm0,%xmm1 mulsd -0x18(%rbp),%xmm1 movsd -0x20(%rbp),%xmm0 movsd 0xf2c(%rip),%xmm2 divsd %xmm2,%xmm0 mulsd %xmm1,%xmm0 movsd %xmm0,-0x8(%rbp) movsd -0x8(%rbp),%xmm0 pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp movsd [rbp+var_18], xmm0 movsd [rbp+var_20], xmm1 movsd xmm0, cs:qword_20A0 movsd [rbp+var_10], xmm0 movsd xmm0, [rbp+var_20] comisd xmm0, cs:qword_20A8 jb short loc_1181 movsd xmm0, cs:qword_20B0 jmp short loc_11AE loc_1181: movsd xmm0, [rbp+var_10] movapd xmm1, xmm0 mulsd xmm1, [rbp+var_18] movsd xmm0, [rbp+var_20] movsd xmm2, cs:qword_20A8 divsd xmm0, xmm2 mulsd xmm0, xmm1 movsd [rbp+var_8], xmm0 movsd xmm0, [rbp+var_8] loc_11AE: pop rbp retn
double func0(double a1, double a2) { if ( a2 < 360.0 ) return a2 / 360.0 * (3.142857142857143 * a1); else return -1.0; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOVSD qword ptr [RBP + -0x18],XMM0 MOVSD qword ptr [RBP + -0x20],XMM1 MOVSD XMM0,qword ptr [0x001020a0] MOVSD qword ptr [RBP + -0x10],XMM0 MOVSD XMM0,qword ptr [RBP + -0x20] COMISD XMM0,qword ptr [0x001020a8] JC 0x00101181 MOVSD XMM0,qword ptr [0x001020b0] JMP 0x001011ae LAB_00101181: MOVSD XMM0,qword ptr [RBP + -0x10] MOVAPD XMM1,XMM0 MULSD XMM1,qword ptr [RBP + -0x18] MOVSD XMM0,qword ptr [RBP + -0x20] MOVSD XMM2,qword ptr [0x001020a8] DIVSD XMM0,XMM2 MULSD XMM0,XMM1 MOVSD qword ptr [RBP + -0x8],XMM0 MOVSD XMM0,qword ptr [RBP + -0x8] LAB_001011ae: POP RBP RET
double func0(double param_1,double param_2) { double dVar1; dVar1 = DAT_001020b0; if (param_2 < DAT_001020a8) { dVar1 = (param_2 / DAT_001020a8) * DAT_001020a0 * param_1; } return dVar1; }
6,937
func0
#include <assert.h> #include <stdio.h>
double func0(double d, double a){ double pi = 22.0/7.0; if (a >= 360){ return -1; // Use -1 to represent None since C does not have a None type } double arclength = (pi * d) * (a / 360); return arclength; }
int main() { assert(func0(9, 45) - 3.5357142857142856 < 0.0001); assert(func0(9, 480) == -1); // Using -1 to represent None assert(func0(5, 270) - 11.785714285714285 < 0.0001); return 0; }
O1
c
func0: endbr64 comisd 0xedb(%rip),%xmm1 jae 114c <func0+0x23> mulsd 0xed9(%rip),%xmm0 divsd 0xec9(%rip),%xmm1 mulsd %xmm1,%xmm0 retq movsd 0xeb4(%rip),%xmm0 retq
func0: endbr64 comisd xmm1, cs:qword_2010 jnb short loc_114C mulsd xmm0, cs:qword_2018 divsd xmm1, cs:qword_2010 mulsd xmm0, xmm1 retn loc_114C: movsd xmm0, cs:qword_2008 retn
double func0(double a1, double a2) { if ( a2 >= 360.0 ) return -1.0; else return a1 * 3.142857142857143 * (a2 / 360.0); }
func0: ENDBR64 COMISD XMM1,qword ptr [0x00102010] JNC 0x0010114c MULSD XMM0,qword ptr [0x00102018] DIVSD XMM1,qword ptr [0x00102010] MULSD XMM0,XMM1 RET LAB_0010114c: MOVSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(double param_1,double param_2) { if (param_2 < _DAT_00102010) { return param_1 * _DAT_00102018 * (param_2 / _DAT_00102010); } return DAT_00102008; }
6,938
func0
#include <assert.h> #include <stdio.h>
double func0(double d, double a){ double pi = 22.0/7.0; if (a >= 360){ return -1; // Use -1 to represent None since C does not have a None type } double arclength = (pi * d) * (a / 360); return arclength; }
int main() { assert(func0(9, 45) - 3.5357142857142856 < 0.0001); assert(func0(9, 480) == -1); // Using -1 to represent None assert(func0(5, 270) - 11.785714285714285 < 0.0001); return 0; }
O2
c
func0: endbr64 movsd 0xec4(%rip),%xmm2 comisd %xmm2,%xmm1 jae 1168 <func0+0x28> divsd %xmm2,%xmm1 mulsd 0xeba(%rip),%xmm0 mulsd %xmm1,%xmm0 retq nopl 0x0(%rax,%rax,1) movsd 0xe98(%rip),%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 movsd xmm2, cs:qword_2010 comisd xmm1, xmm2 jnb short loc_1168 divsd xmm1, xmm2 mulsd xmm0, cs:qword_2018 mulsd xmm0, xmm1 retn loc_1168: movsd xmm0, cs:qword_2008 retn
double func0(double a1, double a2) { if ( a2 >= 360.0 ) return -1.0; else return a1 * 3.142857142857143 * (a2 / 360.0); }
func0: ENDBR64 MOVSD XMM2,qword ptr [0x00102010] COMISD XMM1,XMM2 JNC 0x00101168 DIVSD XMM1,XMM2 MULSD XMM0,qword ptr [0x00102018] MULSD XMM0,XMM1 RET LAB_00101168: MOVSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(double param_1,double param_2) { if (param_2 < DAT_00102010) { return param_1 * _DAT_00102018 * (param_2 / DAT_00102010); } return DAT_00102008; }
6,939
func0
#include <assert.h> #include <stdio.h>
double func0(double d, double a){ double pi = 22.0/7.0; if (a >= 360){ return -1; // Use -1 to represent None since C does not have a None type } double arclength = (pi * d) * (a / 360); return arclength; }
int main() { assert(func0(9, 45) - 3.5357142857142856 < 0.0001); assert(func0(9, 480) == -1); // Using -1 to represent None assert(func0(5, 270) - 11.785714285714285 < 0.0001); return 0; }
O3
c
func0: endbr64 movsd 0xec4(%rip),%xmm2 comisd %xmm2,%xmm1 jae 1168 <func0+0x28> divsd %xmm2,%xmm1 mulsd 0xeba(%rip),%xmm0 mulsd %xmm1,%xmm0 retq nopl 0x0(%rax,%rax,1) movsd 0xe98(%rip),%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 movsd xmm2, cs:qword_2010 comisd xmm1, xmm2 jnb short loc_1168 divsd xmm1, xmm2 mulsd xmm0, cs:qword_2018 mulsd xmm0, xmm1 retn loc_1168: movsd xmm0, cs:qword_2008 retn
double func0(double a1, double a2) { if ( a2 >= 360.0 ) return -1.0; else return a1 * 3.142857142857143 * (a2 / 360.0); }
func0: ENDBR64 MOVSD XMM2,qword ptr [0x00102010] COMISD XMM1,XMM2 JNC 0x00101168 DIVSD XMM1,XMM2 MULSD XMM0,qword ptr [0x00102018] MULSD XMM0,XMM1 RET LAB_00101168: MOVSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(double param_1,double param_2) { if (param_2 < DAT_00102010) { return param_1 * _DAT_00102018 * (param_2 / DAT_00102010); } return DAT_00102008; }
6,940
func0
#include <assert.h>
int func0(int monthnum3) { if (monthnum3 == 4 || monthnum3 == 6 || monthnum3 == 9 || monthnum3 == 11) { return 1; // True in C } else { return 0; // False in C } }
int main() { assert(func0(6) == 1); assert(func0(2) == 0); assert(func0(12) == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) cmpl $0x4,-0x4(%rbp) je 116c <func0+0x23> cmpl $0x6,-0x4(%rbp) je 116c <func0+0x23> cmpl $0x9,-0x4(%rbp) je 116c <func0+0x23> cmpl $0xb,-0x4(%rbp) jne 1173 <func0+0x2a> mov $0x1,%eax jmp 1178 <func0+0x2f> mov $0x0,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi cmp [rbp+var_4], 4 jz short loc_116C cmp [rbp+var_4], 6 jz short loc_116C cmp [rbp+var_4], 9 jz short loc_116C cmp [rbp+var_4], 0Bh jnz short loc_1173 loc_116C: mov eax, 1 jmp short loc_1178 loc_1173: mov eax, 0 loc_1178: pop rbp retn
_BOOL8 func0(int a1) { return a1 == 4 || a1 == 6 || a1 == 9 || a1 == 11; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI CMP dword ptr [RBP + -0x4],0x4 JZ 0x0010116c CMP dword ptr [RBP + -0x4],0x6 JZ 0x0010116c CMP dword ptr [RBP + -0x4],0x9 JZ 0x0010116c CMP dword ptr [RBP + -0x4],0xb JNZ 0x00101173 LAB_0010116c: MOV EAX,0x1 JMP 0x00101178 LAB_00101173: MOV EAX,0x0 LAB_00101178: POP RBP RET
int8 func0(int param_1) { int8 uVar1; if ((((param_1 == 4) || (param_1 == 6)) || (param_1 == 9)) || (param_1 == 0xb)) { uVar1 = 1; } else { uVar1 = 0; } return uVar1; }
6,941
func0
#include <assert.h>
int func0(int monthnum3) { if (monthnum3 == 4 || monthnum3 == 6 || monthnum3 == 9 || monthnum3 == 11) { return 1; // True in C } else { return 0; // False in C } }
int main() { assert(func0(6) == 1); assert(func0(2) == 0); assert(func0(12) == 0); return 0; }
O1
c
func0: endbr64 and $0xfffffffd,%edi mov $0x1,%eax cmp $0x4,%edi je 1143 <func0+0x1a> cmp $0x9,%edi sete %al movzbl %al,%eax retq
func0: endbr64 cmp edi, 0Bh ja short loc_1140 mov eax, 0A50h mov ecx, edi shr rax, cl and eax, 1 retn loc_1140: mov eax, 0 retn
unsigned long long func0(unsigned int a1) { if ( a1 > 0xB ) return 0LL; else return (0xA50uLL >> a1) & 1; }
func0: ENDBR64 CMP EDI,0xb JA 0x00101140 MOV EAX,0xa50 MOV ECX,EDI SHR RAX,CL AND EAX,0x1 RET LAB_00101140: MOV EAX,0x0 RET
uint func0(uint param_1) { if (param_1 < 0xc) { return (uint)(0xa50L >> ((byte)param_1 & 0x3f)) & 1; } return 0; }
6,942
func0
#include <assert.h>
int func0(int monthnum3) { if (monthnum3 == 4 || monthnum3 == 6 || monthnum3 == 9 || monthnum3 == 11) { return 1; // True in C } else { return 0; // False in C } }
int main() { assert(func0(6) == 1); assert(func0(2) == 0); assert(func0(12) == 0); return 0; }
O2
c
func0: endbr64 and $0xfffffffd,%edi mov $0x1,%eax cmp $0x4,%edi je 1159 <func0+0x19> xor %eax,%eax cmp $0x9,%edi sete %al retq nopw 0x0(%rax,%rax,1)
func0: endbr64 cmp edi, 0Bh ja short loc_1160 mov ecx, edi mov eax, 0A50h shr rax, cl and eax, 1 retn loc_1160: xor eax, eax retn
unsigned long long func0(unsigned int a1) { if ( a1 > 0xB ) return 0LL; else return (0xA50uLL >> a1) & 1; }
func0: ENDBR64 CMP EDI,0xb JA 0x00101160 MOV ECX,EDI MOV EAX,0xa50 SHR RAX,CL AND EAX,0x1 RET LAB_00101160: XOR EAX,EAX RET
uint func0(uint param_1) { if (param_1 < 0xc) { return (uint)(0xa50L >> ((byte)param_1 & 0x3f)) & 1; } return 0; }
6,943
func0
#include <assert.h>
int func0(int monthnum3) { if (monthnum3 == 4 || monthnum3 == 6 || monthnum3 == 9 || monthnum3 == 11) { return 1; // True in C } else { return 0; // False in C } }
int main() { assert(func0(6) == 1); assert(func0(2) == 0); assert(func0(12) == 0); return 0; }
O3
c
func0: endbr64 and $0xfffffffd,%edi mov $0x1,%eax cmp $0x4,%edi je 1159 <func0+0x19> xor %eax,%eax cmp $0x9,%edi sete %al retq nopw 0x0(%rax,%rax,1)
func0: endbr64 xor eax, eax cmp edi, 0Bh ja short locret_115A mov eax, 0A50h bt rax, rdi setb al movzx eax, al locret_115A: retn
long long func0(unsigned long long a1) { long long result; // rax long long v2; // rax result = 0LL; if ( (unsigned int)a1 <= 0xB ) { v2 = 2640LL; return _bittest64(&v2, a1); } return result; }
func0: ENDBR64 XOR EAX,EAX CMP EDI,0xb JA 0x0010115a MOV EAX,0xa50 BT RAX,RDI SETC AL MOVZX EAX,AL LAB_0010115a: RET
bool func0(uint param_1) { bool bVar1; bVar1 = false; if (param_1 < 0xc) { bVar1 = (0xa50UL >> ((ulong)param_1 & 0x3f) & 1) != 0; } return bVar1; }
6,944
func0
#include <assert.h> #include <stdlib.h>
int func0(int arr[], int n) { int i, j, temp; // Sorting the array for (i = 0; i < n-1; i++) { for (j = 0; j < n-i-1; j++) { if (arr[j] > arr[j+1]) { temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } int diff = __INT_MAX__; for (i = 0; i < n-1; i++) { if (arr[i+1] - arr[i] < diff) { diff = arr[i+1] - arr[i]; } } return diff; }
int main() { int arr1[] = {1, 5, 3, 19, 18, 25}; int arr2[] = {4, 3, 2, 6}; int arr3[] = {30, 5, 20, 9}; assert(func0(arr1, 6) == 1); assert(func0(arr2, 4) == 1); assert(func0(arr3, 4) == 4); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0x10(%rbp) jmpq 1245 <func0+0xdc> movl $0x0,-0xc(%rbp) jmpq 122f <func0+0xc6> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0xc(%rbp),%eax cltq add $0x1,%rax lea 0x0(,%rax,4),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jle 122b <func0+0xc2> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov %eax,-0x4(%rbp) mov -0xc(%rbp),%eax cltq add $0x1,%rax lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0xc(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x18(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) mov -0xc(%rbp),%eax cltq add $0x1,%rax lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rax,%rdx mov -0x4(%rbp),%eax mov %eax,(%rdx) addl $0x1,-0xc(%rbp) mov -0x1c(%rbp),%eax sub -0x10(%rbp),%eax sub $0x1,%eax cmp %eax,-0xc(%rbp) jl 1190 <func0+0x27> addl $0x1,-0x10(%rbp) mov -0x1c(%rbp),%eax sub $0x1,%eax cmp %eax,-0x10(%rbp) jl 1184 <func0+0x1b> movl $0x7fffffff,-0x8(%rbp) movl $0x0,-0x10(%rbp) jmp 12d8 <func0+0x16f> mov -0x10(%rbp),%eax cltq add $0x1,%rax lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x10(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%eax sub %eax,%edx mov %edx,%eax cmp %eax,-0x8(%rbp) jle 12d4 <func0+0x16b> mov -0x10(%rbp),%eax cltq add $0x1,%rax lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x10(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%eax sub %eax,%edx mov %edx,%eax mov %eax,-0x8(%rbp) addl $0x1,-0x10(%rbp) mov -0x1c(%rbp),%eax sub $0x1,%eax cmp %eax,-0x10(%rbp) jl 1264 <func0+0xfb> mov -0x8(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_10], 0 jmp loc_1245 loc_1184: mov [rbp+var_C], 0 jmp loc_122F loc_1190: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_C] cdqe add rax, 1 lea rcx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rcx mov eax, [rax] cmp edx, eax jle short loc_122B mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] mov [rbp+var_4], eax mov eax, [rbp+var_C] cdqe add rax, 1 lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rbp+var_C] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+var_18] add rdx, rcx mov eax, [rax] mov [rdx], eax mov eax, [rbp+var_C] cdqe add rax, 1 lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rdx, rax mov eax, [rbp+var_4] mov [rdx], eax loc_122B: add [rbp+var_C], 1 loc_122F: mov eax, [rbp+var_1C] sub eax, [rbp+var_10] sub eax, 1 cmp [rbp+var_C], eax jl loc_1190 add [rbp+var_10], 1 loc_1245: mov eax, [rbp+var_1C] sub eax, 1 cmp [rbp+var_10], eax jl loc_1184 mov [rbp+var_8], 7FFFFFFFh mov [rbp+var_10], 0 jmp short loc_12D4 loc_1264: mov eax, [rbp+var_10] cdqe add rax, 1 lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_10] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rcx mov eax, [rax] sub edx, eax cmp [rbp+var_8], edx jle short loc_12D0 mov eax, [rbp+var_10] cdqe add rax, 1 lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_10] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rcx mov eax, [rax] sub edx, eax mov [rbp+var_8], edx loc_12D0: add [rbp+var_10], 1 loc_12D4: mov eax, [rbp+var_1C] sub eax, 1 cmp [rbp+var_10], eax jl short loc_1264 mov eax, [rbp+var_8] pop rbp retn
long long func0(long long a1, int a2) { int i; // [rsp+Ch] [rbp-10h] int k; // [rsp+Ch] [rbp-10h] int j; // [rsp+10h] [rbp-Ch] int v6; // [rsp+14h] [rbp-8h] int v7; // [rsp+18h] [rbp-4h] for ( i = 0; i < a2 - 1; ++i ) { for ( j = 0; j < a2 - i - 1; ++j ) { if ( *(_DWORD *)(4LL * j + a1) > *(_DWORD *)(4 * (j + 1LL) + a1) ) { v7 = *(_DWORD *)(4LL * j + a1); *(_DWORD *)(4LL * j + a1) = *(_DWORD *)(4 * (j + 1LL) + a1); *(_DWORD *)(a1 + 4 * (j + 1LL)) = v7; } } } v6 = 0x7FFFFFFF; for ( k = 0; k < a2 - 1; ++k ) { if ( v6 > *(_DWORD *)(4 * (k + 1LL) + a1) - *(_DWORD *)(4LL * k + a1) ) v6 = *(_DWORD *)(4 * (k + 1LL) + a1) - *(_DWORD *)(4LL * k + a1); } return (unsigned int)v6; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x10],0x0 JMP 0x00101245 LAB_00101184: MOV dword ptr [RBP + -0xc],0x0 JMP 0x0010122f LAB_00101190: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0xc] CDQE ADD RAX,0x1 LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JLE 0x0010122b MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0xc] CDQE ADD RAX,0x1 LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x18] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX MOV EAX,dword ptr [RBP + -0xc] CDQE ADD RAX,0x1 LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x4] MOV dword ptr [RDX],EAX LAB_0010122b: ADD dword ptr [RBP + -0xc],0x1 LAB_0010122f: MOV EAX,dword ptr [RBP + -0x1c] SUB EAX,dword ptr [RBP + -0x10] SUB EAX,0x1 CMP dword ptr [RBP + -0xc],EAX JL 0x00101190 ADD dword ptr [RBP + -0x10],0x1 LAB_00101245: MOV EAX,dword ptr [RBP + -0x1c] SUB EAX,0x1 CMP dword ptr [RBP + -0x10],EAX JL 0x00101184 MOV dword ptr [RBP + -0x8],0x7fffffff MOV dword ptr [RBP + -0x10],0x0 JMP 0x001012d4 LAB_00101264: MOV EAX,dword ptr [RBP + -0x10] CDQE ADD RAX,0x1 LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x10] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV EAX,dword ptr [RAX] SUB EDX,EAX CMP dword ptr [RBP + -0x8],EDX JLE 0x001012d0 MOV EAX,dword ptr [RBP + -0x10] CDQE ADD RAX,0x1 LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x10] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV EAX,dword ptr [RAX] SUB EDX,EAX MOV dword ptr [RBP + -0x8],EDX LAB_001012d0: ADD dword ptr [RBP + -0x10],0x1 LAB_001012d4: MOV EAX,dword ptr [RBP + -0x1c] SUB EAX,0x1 CMP dword ptr [RBP + -0x10],EAX JL 0x00101264 MOV EAX,dword ptr [RBP + -0x8] POP RBP RET
int func0(long param_1,int param_2) { int4 uVar1; int4 local_18; int4 local_14; int4 local_10; for (local_18 = 0; local_18 < param_2 + -1; local_18 = local_18 + 1) { for (local_14 = 0; local_14 < (param_2 - local_18) + -1; local_14 = local_14 + 1) { if (*(int *)(param_1 + ((long)local_14 + 1) * 4) < *(int *)(param_1 + (long)local_14 * 4)) { uVar1 = *(int4 *)(param_1 + (long)local_14 * 4); *(int4 *)(param_1 + (long)local_14 * 4) = *(int4 *)(param_1 + ((long)local_14 + 1) * 4); *(int4 *)(((long)local_14 + 1) * 4 + param_1) = uVar1; } } } local_10 = 0x7fffffff; for (local_18 = 0; local_18 < param_2 + -1; local_18 = local_18 + 1) { if (*(int *)(param_1 + ((long)local_18 + 1) * 4) - *(int *)(param_1 + (long)local_18 * 4) < local_10) { local_10 = *(int *)(param_1 + ((long)local_18 + 1) * 4) - *(int *)(param_1 + (long)local_18 * 4); } } return local_10; }
6,945
func0
#include <assert.h> #include <stdlib.h>
int func0(int arr[], int n) { int i, j, temp; // Sorting the array for (i = 0; i < n-1; i++) { for (j = 0; j < n-i-1; j++) { if (arr[j] > arr[j+1]) { temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } int diff = __INT_MAX__; for (i = 0; i < n-1; i++) { if (arr[i+1] - arr[i] < diff) { diff = arr[i+1] - arr[i]; } } return diff; }
int main() { int arr1[] = {1, 5, 3, 19, 18, 25}; int arr2[] = {4, 3, 2, 6}; int arr3[] = {30, 5, 20, 9}; assert(func0(arr1, 6) == 1); assert(func0(arr2, 4) == 1); assert(func0(arr3, 4) == 4); return 0; }
O1
c
func0: endbr64 lea -0x1(%rsi),%r9d test %r9d,%r9d jle 11d3 <func0+0x6a> lea 0x4(%rdi),%r10 jmp 119b <func0+0x32> add $0x4,%rax cmp %r8,%rax je 1195 <func0+0x2c> mov (%rax),%edx mov 0x4(%rax),%ecx cmp %ecx,%edx jle 117c <func0+0x13> mov %ecx,(%rax) mov %edx,0x4(%rax) jmp 117c <func0+0x13> sub $0x1,%r9d je 11ad <func0+0x44> test %r9d,%r9d jle 1195 <func0+0x2c> mov %rdi,%rax lea -0x1(%r9),%edx lea (%r10,%rdx,4),%r8 jmp 1185 <func0+0x1c> mov %rdi,%rax lea -0x2(%rsi),%edx lea 0x4(%rdi,%rdx,4),%rsi mov $0x7fffffff,%ecx mov 0x4(%rax),%edx sub (%rax),%edx cmp %edx,%ecx cmovg %edx,%ecx add $0x4,%rax cmp %rsi,%rax jne 11bd <func0+0x54> mov %ecx,%eax retq mov $0x7fffffff,%ecx jmp 11d0 <func0+0x67>
func0: endbr64 lea r9d, [rsi-1] test r9d, r9d jle short loc_11D3 lea r10, [rdi+4] jmp short loc_119B loc_117C: add rax, 4 cmp rax, r8 jz short loc_1195 loc_1185: mov edx, [rax] mov ecx, [rax+4] cmp edx, ecx jle short loc_117C mov [rax], ecx mov [rax+4], edx jmp short loc_117C loc_1195: sub r9d, 1 jz short loc_11AD loc_119B: test r9d, r9d jle short loc_1195 mov rax, rdi lea edx, [r9-1] lea r8, [r10+rdx*4] jmp short loc_1185 loc_11AD: mov rax, rdi lea edx, [rsi-2] lea rsi, [rdi+rdx*4+4] mov ecx, 7FFFFFFFh loc_11BD: mov edx, [rax+4] sub edx, [rax] cmp ecx, edx cmovg ecx, edx add rax, 4 cmp rax, rsi jnz short loc_11BD loc_11D0: mov eax, ecx retn loc_11D3: mov ecx, 7FFFFFFFh jmp short loc_11D0
long long func0(int *a1, int a2) { int v2; // r9d int *v3; // rax int v4; // edx int v5; // ecx int *v6; // rax long long v7; // rsi int v8; // ecx v2 = a2 - 1; if ( a2 - 1 <= 0 ) { return 0x7FFFFFFF; } else { do { if ( v2 > 0 ) { v3 = a1; do { v4 = *v3; v5 = v3[1]; if ( *v3 > v5 ) { *v3 = v5; v3[1] = v4; } ++v3; } while ( v3 != &a1[v2 - 1 + 1] ); } --v2; } while ( v2 ); v6 = a1; v7 = (long long)&a1[a2 - 2 + 1]; v8 = 0x7FFFFFFF; do { if ( v8 > v6[1] - *v6 ) v8 = v6[1] - *v6; ++v6; } while ( v6 != (int *)v7 ); } return (unsigned int)v8; }
func0: ENDBR64 LEA R9D,[RSI + -0x1] TEST R9D,R9D JLE 0x001011d3 LEA R10,[RDI + 0x4] JMP 0x0010119b LAB_0010117c: ADD RAX,0x4 CMP RAX,R8 JZ 0x00101195 LAB_00101185: MOV EDX,dword ptr [RAX] MOV ECX,dword ptr [RAX + 0x4] CMP EDX,ECX JLE 0x0010117c MOV dword ptr [RAX],ECX MOV dword ptr [RAX + 0x4],EDX JMP 0x0010117c LAB_00101195: SUB R9D,0x1 JZ 0x001011ad LAB_0010119b: TEST R9D,R9D JLE 0x00101195 MOV RAX,RDI LEA EDX,[R9 + -0x1] LEA R8,[R10 + RDX*0x4] JMP 0x00101185 LAB_001011ad: MOV RAX,RDI LEA EDX,[RSI + -0x2] LEA RSI,[RDI + RDX*0x4 + 0x4] MOV ECX,0x7fffffff LAB_001011bd: MOV EDX,dword ptr [RAX + 0x4] SUB EDX,dword ptr [RAX] CMP ECX,EDX CMOVG ECX,EDX ADD RAX,0x4 CMP RAX,RSI JNZ 0x001011bd LAB_001011d0: MOV EAX,ECX RET LAB_001011d3: MOV ECX,0x7fffffff JMP 0x001011d0
int func0(int *param_1,int param_2) { int iVar1; int *piVar2; int iVar3; iVar3 = param_2 + -1; if (iVar3 < 1) { iVar3 = 0x7fffffff; } else { do { if (0 < iVar3) { piVar2 = param_1; do { iVar1 = *piVar2; if (piVar2[1] < iVar1) { *piVar2 = piVar2[1]; piVar2[1] = iVar1; } piVar2 = piVar2 + 1; } while (piVar2 != param_1 + (ulong)(iVar3 - 1) + 1); } iVar3 = iVar3 + -1; } while (iVar3 != 0); piVar2 = param_1 + (ulong)(param_2 - 2) + 1; iVar3 = 0x7fffffff; do { if (param_1[1] - *param_1 < iVar3) { iVar3 = param_1[1] - *param_1; } param_1 = param_1 + 1; } while (param_1 != piVar2); } return iVar3; }
6,946
func0
#include <assert.h> #include <stdlib.h>
int func0(int arr[], int n) { int i, j, temp; // Sorting the array for (i = 0; i < n-1; i++) { for (j = 0; j < n-i-1; j++) { if (arr[j] > arr[j+1]) { temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } int diff = __INT_MAX__; for (i = 0; i < n-1; i++) { if (arr[i+1] - arr[i] < diff) { diff = arr[i+1] - arr[i]; } } return diff; }
int main() { int arr1[] = {1, 5, 3, 19, 18, 25}; int arr2[] = {4, 3, 2, 6}; int arr3[] = {30, 5, 20, 9}; assert(func0(arr1, 6) == 1); assert(func0(arr2, 4) == 1); assert(func0(arr3, 4) == 4); return 0; }
O2
c
func0: endbr64 lea -0x1(%rsi),%edx test %edx,%edx jle 1319 <func0+0x69> lea 0x4(%rdi),%r10 sub $0x1,%edx mov %rdi,%rax mov %rdx,%r9 lea (%r10,%rdx,4),%r8 nopl (%rax) mov (%rax),%edx mov 0x4(%rax),%ecx cmp %ecx,%edx jle 12de <func0+0x2e> mov %ecx,(%rax) mov %edx,0x4(%rax) add $0x4,%rax cmp %rax,%r8 jne 12d0 <func0+0x20> mov %r9d,%edx test %r9d,%r9d jne 12c0 <func0+0x10> lea -0x2(%rsi),%eax mov $0x7fffffff,%r8d lea (%r10,%rax,4),%rdx nopl 0x0(%rax) mov 0x4(%rdi),%eax sub (%rdi),%eax cmp %eax,%r8d cmovg %eax,%r8d add $0x4,%rdi cmp %rdi,%rdx jne 1300 <func0+0x50> mov %r8d,%eax retq mov $0x7fffffff,%r8d mov %r8d,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 lea edx, [rsi-1] test edx, edx jle short loc_1319 lea r10, [rdi+4] nop loc_12C0: sub edx, 1 mov rax, rdi mov r9, rdx lea r8, [r10+rdx*4] nop dword ptr [rax] loc_12D0: mov edx, [rax] mov ecx, [rax+4] cmp edx, ecx jle short loc_12DE mov [rax], ecx mov [rax+4], edx loc_12DE: add rax, 4 cmp r8, rax jnz short loc_12D0 mov edx, r9d test r9d, r9d jnz short loc_12C0 lea eax, [rsi-2] mov r8d, 7FFFFFFFh lea rdx, [r10+rax*4] nop dword ptr [rax+00h] loc_1300: mov eax, [rdi+4] sub eax, [rdi] cmp r8d, eax cmovg r8d, eax add rdi, 4 cmp rdx, rdi jnz short loc_1300 mov eax, r8d retn loc_1319: mov r8d, 7FFFFFFFh mov eax, r8d retn
long long func0(int *a1, int a2) { int v2; // edx _DWORD *v3; // r10 int *v4; // rax int v5; // r9d int *v6; // r8 int v7; // edx int v8; // ecx int v9; // r8d v2 = a2 - 1; if ( a2 - 1 <= 0 ) return 0x7FFFFFFFLL; v3 = a1 + 1; do { v4 = a1; v5 = v2 - 1; v6 = &v3[v2 - 1]; do { v7 = *v4; v8 = v4[1]; if ( *v4 > v8 ) { *v4 = v8; v4[1] = v7; } ++v4; } while ( v6 != v4 ); v2 = v5; } while ( v5 ); v9 = 0x7FFFFFFF; do { if ( v9 > a1[1] - *a1 ) v9 = a1[1] - *a1; ++a1; } while ( &v3[a2 - 2] != a1 ); return (unsigned int)v9; }
func0: ENDBR64 LEA EDX,[RSI + -0x1] TEST EDX,EDX JLE 0x00101319 LEA R10,[RDI + 0x4] NOP LAB_001012c0: SUB EDX,0x1 MOV RAX,RDI MOV R9,RDX LEA R8,[R10 + RDX*0x4] NOP dword ptr [RAX] LAB_001012d0: MOV EDX,dword ptr [RAX] MOV ECX,dword ptr [RAX + 0x4] CMP EDX,ECX JLE 0x001012de MOV dword ptr [RAX],ECX MOV dword ptr [RAX + 0x4],EDX LAB_001012de: ADD RAX,0x4 CMP R8,RAX JNZ 0x001012d0 MOV EDX,R9D TEST R9D,R9D JNZ 0x001012c0 LEA EAX,[RSI + -0x2] MOV R8D,0x7fffffff LEA RDX,[R10 + RAX*0x4] NOP dword ptr [RAX] LAB_00101300: MOV EAX,dword ptr [RDI + 0x4] SUB EAX,dword ptr [RDI] CMP R8D,EAX CMOVG R8D,EAX ADD RDI,0x4 CMP RDX,RDI JNZ 0x00101300 MOV EAX,R8D RET LAB_00101319: MOV R8D,0x7fffffff MOV EAX,R8D RET
int func0(int *param_1,int param_2) { int *piVar1; uint uVar2; int iVar3; uVar2 = param_2 - 1; if ((int)uVar2 < 1) { return 0x7fffffff; } do { uVar2 = uVar2 - 1; piVar1 = param_1; do { iVar3 = *piVar1; if (piVar1[1] < iVar3) { *piVar1 = piVar1[1]; piVar1[1] = iVar3; } piVar1 = piVar1 + 1; } while (param_1 + (ulong)uVar2 + 1 != piVar1); } while (uVar2 != 0); iVar3 = 0x7fffffff; piVar1 = param_1 + (ulong)(param_2 - 2) + 1; do { if (param_1[1] - *param_1 < iVar3) { iVar3 = param_1[1] - *param_1; } param_1 = param_1 + 1; } while (piVar1 != param_1); return iVar3; }
6,947
func0
#include <assert.h> #include <stdlib.h>
int func0(int arr[], int n) { int i, j, temp; // Sorting the array for (i = 0; i < n-1; i++) { for (j = 0; j < n-i-1; j++) { if (arr[j] > arr[j+1]) { temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } int diff = __INT_MAX__; for (i = 0; i < n-1; i++) { if (arr[i+1] - arr[i] < diff) { diff = arr[i+1] - arr[i]; } } return diff; }
int main() { int arr1[] = {1, 5, 3, 19, 18, 25}; int arr2[] = {4, 3, 2, 6}; int arr3[] = {30, 5, 20, 9}; assert(func0(arr1, 6) == 1); assert(func0(arr2, 4) == 1); assert(func0(arr3, 4) == 4); return 0; }
O3
c
func0: endbr64 lea -0x1(%rsi),%r10d test %r10d,%r10d jle 1448 <func0+0x1d8> mov %r10d,%edx lea 0x4(%rdi),%r11 nopl 0x0(%rax,%rax,1) sub $0x1,%edx mov %rdi,%rax mov %rdx,%r9 lea (%r11,%rdx,4),%r8 nopl (%rax) mov (%rax),%edx mov 0x4(%rax),%ecx cmp %ecx,%edx jle 12ae <func0+0x3e> mov %ecx,(%rax) mov %edx,0x4(%rax) add $0x4,%rax cmp %r8,%rax jne 12a0 <func0+0x30> mov %r9d,%edx test %r9d,%r9d jne 1290 <func0+0x20> lea -0x2(%rsi),%r8d cmp $0x2,%r8d jbe 144f <func0+0x1df> mov %r10d,%edx movdqa 0xdb8(%rip),%xmm0 mov %rdi,%rax shr $0x2,%edx shl $0x4,%rdx add %rdi,%rdx nopl (%rax) movdqu 0x4(%rax),%xmm2 movdqu (%rax),%xmm3 add $0x10,%rax psubd %xmm3,%xmm2 movdqa %xmm2,%xmm1 pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm0 pandn %xmm2,%xmm1 por %xmm1,%xmm0 cmp %rdx,%rax jne 12e8 <func0+0x78> movdqa %xmm0,%xmm2 mov %r10d,%ecx psrldq $0x8,%xmm2 and $0xfffffffc,%ecx movdqa %xmm2,%xmm1 pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm0 pandn %xmm2,%xmm1 por %xmm1,%xmm0 movdqa %xmm0,%xmm2 psrldq $0x4,%xmm2 movdqa %xmm2,%xmm1 pcmpgtd %xmm0,%xmm1 pand %xmm1,%xmm0 pandn %xmm2,%xmm1 por %xmm1,%xmm0 movd %xmm0,%eax test $0x3,%r10b je 144e <func0+0x1de> movslq %ecx,%rdx lea 0x1(%rcx),%r9d shl $0x2,%rdx lea (%rdi,%rdx,1),%r11 cmp %r8d,%r9d jge 145b <func0+0x1eb> cmp $0x80000001,%esi je 145b <func0+0x1eb> mov 0x4(%rdi,%rdx,1),%r9d mov %r9d,%esi sub (%r11),%esi mov 0x8(%rdi,%rdx,1),%r11d cmp %eax,%esi cmovle %esi,%eax mov %r11d,%esi sub %r9d,%esi lea 0x3(%rcx),%r9d cmp %eax,%esi cmovle %esi,%eax lea 0x2(%rcx),%esi cmp %r9d,%r8d jg 13f8 <func0+0x188> movslq %esi,%rdx add $0x1,%rdx mov (%rdi,%rdx,4),%ecx sub -0x4(%rdi,%rdx,4),%ecx lea 0x0(,%rdx,4),%r8 cmp %ecx,%eax cmovg %ecx,%eax lea 0x1(%rsi),%ecx cmp %ecx,%r10d jle 144d <func0+0x1dd> mov 0x4(%rdi,%r8,1),%ecx sub (%rdi,%rdx,4),%ecx cmp %ecx,%eax cmovg %ecx,%eax add $0x2,%esi cmp %esi,%r10d jle 144d <func0+0x1dd> mov 0x8(%rdi,%r8,1),%edx sub 0x4(%rdi,%r8,1),%edx cmp %edx,%eax cmovg %edx,%eax retq mov 0xc(%rdi,%rdx,1),%r9d mov %r9d,%esi sub %r11d,%esi mov 0x10(%rdi,%rdx,1),%r11d cmp %eax,%esi cmovle %esi,%eax mov %r11d,%esi sub %r9d,%esi lea 0x5(%rcx),%r9d cmp %eax,%esi cmovle %esi,%eax lea 0x4(%rcx),%esi cmp %r9d,%r8d jle 13b0 <func0+0x140> mov 0x14(%rdi,%rdx,1),%r8d mov 0x18(%rdi,%rdx,1),%edx mov %r8d,%esi sub %r11d,%esi cmp %eax,%esi cmovle %esi,%eax sub %r8d,%edx lea 0x6(%rcx),%esi cmp %eax,%edx cmovle %edx,%eax jmpq 13b0 <func0+0x140> mov $0x7fffffff,%eax retq retq mov $0x7fffffff,%eax xor %ecx,%ecx jmpq 1360 <func0+0xf0> mov %ecx,%esi jmpq 13b0 <func0+0x140> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 lea r11d, [rsi-1] test r11d, r11d jle loc_146D push rbp mov r8d, esi mov r10, rdi push rbx mov ebx, esi lea rsi, [rdi+4] nop loc_1290: cmp r8d, 1 jle loc_1410 lea eax, [r8-2] mov r9, r10 lea rdi, [rsi+rax*4] mov rax, r10 nop dword ptr [rax+rax+00000000h] loc_12B0: movq xmm0, qword ptr [rax] pshufd xmm3, xmm0, 0E5h movd edx, xmm0 movd ecx, xmm3 cmp ecx, edx jge short loc_12CE pshufd xmm0, xmm0, 0E1h movq qword ptr [rax], xmm0 loc_12CE: add rax, 4 cmp rax, rdi jnz short loc_12B0 sub r8d, 1 cmp r8d, 1 jnz short loc_1290 sub ebx, 2 cmp ebx, 2 jbe loc_1473 mov eax, r11d movdqa xmm0, cs:xmmword_2070 shr eax, 2 shl rax, 4 add rax, r10 nop word ptr [rax+rax+00h] loc_1308: movdqu xmm2, xmmword ptr [r9+4] movdqu xmm4, xmmword ptr [r9] add r9, 10h psubd xmm2, xmm4 movdqa xmm1, xmm2 pcmpgtd xmm1, xmm0 pand xmm0, xmm1 pandn xmm1, xmm2 por xmm0, xmm1 cmp r9, rax jnz short loc_1308 movdqa xmm2, xmm0 mov edx, r11d psrldq xmm2, 8 and edx, 0FFFFFFFCh movdqa xmm1, xmm2 pcmpgtd xmm1, xmm0 pand xmm0, xmm1 pandn xmm1, xmm2 por xmm0, xmm1 movdqa xmm2, xmm0 psrldq xmm2, 4 movdqa xmm1, xmm2 pcmpgtd xmm1, xmm0 pand xmm0, xmm1 pandn xmm1, xmm2 por xmm1, xmm0 movd eax, xmm1 test r11b, 3 jz loc_1405 loc_1382: movsxd rcx, edx lea esi, [rdx+1] shl rcx, 2 lea rdi, [r10+rcx] cmp esi, ebx jge short loc_13C0 mov r8d, [r10+rcx+4] mov r9d, [r10+rcx+8] mov esi, r8d sub esi, [rdi] mov edi, r9d sub edi, r8d cmp esi, edi cmovg esi, edi cmp eax, esi cmovg eax, esi lea esi, [rdx+3] cmp ebx, esi jg short loc_1419 add edx, 2 lea esi, [rdx+1] loc_13C0: movsxd rcx, esi mov r8d, [r10+rcx*4] lea rdi, ds:0[rcx*4] mov ebx, r8d sub ebx, [r10+rcx*4-4] cmp eax, ebx cmovg eax, ebx cmp r11d, esi jle short loc_1405 mov ecx, [r10+rdi+4] sub ecx, r8d cmp eax, ecx cmovg eax, ecx add edx, 2 cmp r11d, edx jle short loc_1405 mov edx, [r10+rdi+8] sub edx, [r10+rdi+4] cmp eax, edx cmovg eax, edx loc_1405: pop rbx pop rbp retn loc_1410: sub r8d, 1 jmp loc_1290 loc_1419: mov ebp, [r10+rcx+0Ch] mov r8d, [r10+rcx+10h] mov esi, ebp mov edi, r8d sub esi, r9d sub edi, ebp cmp esi, edi cmovg esi, edi cmp eax, esi cmovg eax, esi lea esi, [rdx+5] cmp ebx, esi jle short loc_1462 mov esi, [r10+rcx+14h] mov ecx, [r10+rcx+18h] sub ecx, esi sub esi, r8d cmp ecx, esi cmovg ecx, esi cmp eax, ecx cmovg eax, ecx add edx, 6 lea esi, [rdx+1] jmp loc_13C0 loc_1462: add edx, 4 lea esi, [rdx+1] jmp loc_13C0 loc_146D: mov eax, 7FFFFFFFh retn loc_1473: mov eax, 7FFFFFFFh xor edx, edx jmp loc_1382
long long func0(__m128i *a1, int a2) { int v2; // r11d int v3; // r8d __m128i *v4; // r9 __m128i *v5; // rax __m128i v6; // xmm0 int v7; // ebx __m128i si128; // xmm0 __m128i v9; // xmm2 __m128i v10; // xmm4 __m128i v11; // xmm2 __m128i v12; // xmm1 __m128i v13; // xmm2 signed int v14; // edx __m128i v15; // xmm1 __m128i v16; // xmm0 __m128i v17; // xmm2 __m128i v18; // xmm1 long long result; // rax int v20; // esi long long v21; // rcx int v22; // esi int v23; // ebx int v24; // ecx int v25; // edx __int32 v26; // r8d int v27; // esi __int32 v28; // esi int v29; // ecx int v30; // esi v2 = a2 - 1; if ( a2 - 1 <= 0 ) return 0x7FFFFFFFLL; v3 = a2; do { while ( v3 <= 1 ) --v3; v4 = a1; v5 = a1; do { v6 = _mm_loadl_epi64(v5); if ( _mm_cvtsi128_si32(_mm_shuffle_epi32(v6, 229)) < _mm_cvtsi128_si32(v6) ) v5->m128i_i64[0] = _mm_shuffle_epi32(v6, 225).m128i_u64[0]; v5 = (__m128i *)((char *)v5 + 4); } while ( v5 != (__m128i *)((char *)a1->m128i_i64 + 4 * (unsigned int)(v3 - 2) + 4) ); --v3; } while ( v3 != 1 ); v7 = a2 - 2; if ( (unsigned int)(a2 - 2) <= 2 ) { result = 0x7FFFFFFFLL; v14 = 0; } else { si128 = _mm_load_si128((const __m128i *)&xmmword_2070); do { v9 = _mm_loadu_si128((const __m128i *)((char *)v4->m128i_i64 + 4)); v10 = _mm_loadu_si128(v4++); v11 = _mm_sub_epi32(v9, v10); v12 = _mm_cmpgt_epi32(v11, si128); si128 = _mm_or_si128(_mm_and_si128(si128, v12), _mm_andnot_si128(v12, v11)); } while ( v4 != &a1[(unsigned int)v2 >> 2] ); v13 = _mm_srli_si128(si128, 8); v14 = v2 & 0xFFFFFFFC; v15 = _mm_cmpgt_epi32(v13, si128); v16 = _mm_or_si128(_mm_and_si128(si128, v15), _mm_andnot_si128(v15, v13)); v17 = _mm_srli_si128(v16, 4); v18 = _mm_cmpgt_epi32(v17, v16); result = (unsigned int)_mm_cvtsi128_si32(_mm_or_si128(_mm_andnot_si128(v18, v17), _mm_and_si128(v16, v18))); if ( (v2 & 3) == 0 ) return result; } v20 = v14 + 1; v21 = v14; if ( v14 + 1 < v7 ) { v22 = a1->m128i_i32[v14 + 1] - a1->m128i_i32[v14]; if ( v22 > a1->m128i_i32[v21 + 2] - a1->m128i_i32[v21 + 1] ) v22 = a1->m128i_i32[v21 + 2] - a1->m128i_i32[v21 + 1]; if ( (int)result > v22 ) result = (unsigned int)v22; if ( v7 > v14 + 3 ) { v26 = a1[1].m128i_i32[v21]; v27 = a1->m128i_i32[v21 + 3] - a1->m128i_i32[v21 + 2]; if ( v27 > v26 - a1->m128i_i32[v21 + 3] ) v27 = a1[1].m128i_i32[v21] - a1->m128i_i32[v21 + 3]; if ( (int)result > v27 ) result = (unsigned int)v27; if ( v7 <= v14 + 5 ) { v14 += 4; v20 = v14 + 1; } else { v28 = a1[1].m128i_i32[v21 + 1]; v29 = a1[1].m128i_i32[v21 + 2] - v28; v30 = v28 - v26; if ( v29 > v30 ) v29 = v30; if ( (int)result > v29 ) result = (unsigned int)v29; v14 += 6; v20 = v14 + 1; } } else { v14 += 2; v20 = v14 + 1; } } v23 = a1->m128i_i32[v20] - a1->m128i_i32[v20 - 1]; if ( (int)result > v23 ) result = (unsigned int)v23; if ( v2 > v20 ) { v24 = a1->m128i_i32[v20 + 1] - a1->m128i_i32[v20]; if ( (int)result > v24 ) result = (unsigned int)v24; if ( v2 > v14 + 2 ) { v25 = a1->m128i_i32[v20 + 2] - a1->m128i_i32[v20 + 1]; if ( (int)result > v25 ) return (unsigned int)v25; } } return result; }
func0: ENDBR64 LEA R11D,[RSI + -0x1] TEST R11D,R11D JLE 0x0010146d PUSH RBP MOV R8D,ESI MOV R10,RDI PUSH RBX MOV EBX,ESI LEA RSI,[RDI + 0x4] NOP LAB_00101290: CMP R8D,0x1 JLE 0x00101410 LEA EAX,[R8 + -0x2] MOV R9,R10 LEA RDI,[RSI + RAX*0x4] MOV RAX,R10 NOP dword ptr [RAX + RAX*0x1] LAB_001012b0: MOVQ XMM0,qword ptr [RAX] PSHUFD XMM3,XMM0,0xe5 MOVD EDX,XMM0 MOVD ECX,XMM3 CMP ECX,EDX JGE 0x001012ce PSHUFD XMM0,XMM0,0xe1 MOVQ qword ptr [RAX],XMM0 LAB_001012ce: ADD RAX,0x4 CMP RAX,RDI JNZ 0x001012b0 SUB R8D,0x1 CMP R8D,0x1 JNZ 0x00101290 SUB EBX,0x2 CMP EBX,0x2 JBE 0x00101473 MOV EAX,R11D MOVDQA XMM0,xmmword ptr [0x00102070] SHR EAX,0x2 SHL RAX,0x4 ADD RAX,R10 NOP word ptr [RAX + RAX*0x1] LAB_00101308: MOVDQU XMM2,xmmword ptr [R9 + 0x4] MOVDQU XMM4,xmmword ptr [R9] ADD R9,0x10 PSUBD XMM2,XMM4 MOVDQA XMM1,XMM2 PCMPGTD XMM1,XMM0 PAND XMM0,XMM1 PANDN XMM1,XMM2 POR XMM0,XMM1 CMP R9,RAX JNZ 0x00101308 MOVDQA XMM2,XMM0 MOV EDX,R11D PSRLDQ XMM2,0x8 AND EDX,0xfffffffc MOVDQA XMM1,XMM2 PCMPGTD XMM1,XMM0 PAND XMM0,XMM1 PANDN XMM1,XMM2 POR XMM0,XMM1 MOVDQA XMM2,XMM0 PSRLDQ XMM2,0x4 MOVDQA XMM1,XMM2 PCMPGTD XMM1,XMM0 PAND XMM0,XMM1 PANDN XMM1,XMM2 POR XMM1,XMM0 MOVD EAX,XMM1 TEST R11B,0x3 JZ 0x00101405 LAB_00101382: MOVSXD RCX,EDX LEA ESI,[RDX + 0x1] SHL RCX,0x2 LEA RDI,[R10 + RCX*0x1] CMP ESI,EBX JGE 0x001013c0 MOV R8D,dword ptr [R10 + RCX*0x1 + 0x4] MOV R9D,dword ptr [R10 + RCX*0x1 + 0x8] MOV ESI,R8D SUB ESI,dword ptr [RDI] MOV EDI,R9D SUB EDI,R8D CMP ESI,EDI CMOVG ESI,EDI CMP EAX,ESI CMOVG EAX,ESI LEA ESI,[RDX + 0x3] CMP EBX,ESI JG 0x00101419 ADD EDX,0x2 LEA ESI,[RDX + 0x1] LAB_001013c0: MOVSXD RCX,ESI MOV R8D,dword ptr [R10 + RCX*0x4] LEA RDI,[RCX*0x4] MOV EBX,R8D SUB EBX,dword ptr [R10 + RCX*0x4 + -0x4] CMP EAX,EBX CMOVG EAX,EBX CMP R11D,ESI JLE 0x00101405 MOV ECX,dword ptr [R10 + RDI*0x1 + 0x4] SUB ECX,R8D CMP EAX,ECX CMOVG EAX,ECX ADD EDX,0x2 CMP R11D,EDX JLE 0x00101405 MOV EDX,dword ptr [R10 + RDI*0x1 + 0x8] SUB EDX,dword ptr [R10 + RDI*0x1 + 0x4] CMP EAX,EDX CMOVG EAX,EDX LAB_00101405: POP RBX POP RBP RET LAB_00101410: SUB R8D,0x1 JMP 0x00101290 LAB_00101419: MOV EBP,dword ptr [R10 + RCX*0x1 + 0xc] MOV R8D,dword ptr [R10 + RCX*0x1 + 0x10] MOV ESI,EBP MOV EDI,R8D SUB ESI,R9D SUB EDI,EBP CMP ESI,EDI CMOVG ESI,EDI CMP EAX,ESI CMOVG EAX,ESI LEA ESI,[RDX + 0x5] CMP EBX,ESI JLE 0x00101462 MOV ESI,dword ptr [R10 + RCX*0x1 + 0x14] MOV ECX,dword ptr [R10 + RCX*0x1 + 0x18] SUB ECX,ESI SUB ESI,R8D CMP ECX,ESI CMOVG ECX,ESI CMP EAX,ECX CMOVG EAX,ECX ADD EDX,0x6 LEA ESI,[RDX + 0x1] JMP 0x001013c0 LAB_00101462: ADD EDX,0x4 LEA ESI,[RDX + 0x1] JMP 0x001013c0 LAB_0010146d: MOV EAX,0x7fffffff RET LAB_00101473: MOV EAX,0x7fffffff XOR EDX,EDX JMP 0x00101382
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ uint func0(int *param_1,int param_2) { int *piVar1; int *piVar2; int *piVar3; int *piVar4; int *piVar5; int *piVar6; int *piVar7; uint uVar8; int *piVar9; uint uVar10; uint uVar11; int iVar12; uint uVar13; int iVar14; int iVar15; uint uVar16; uint uVar17; uint uVar18; uint uVar19; uint uVar20; uint uVar21; uVar13 = param_2 - 1; iVar12 = param_2; if ((int)uVar13 < 1) { return 0x7fffffff; } do { for (; iVar12 < 2; iVar12 = iVar12 + -1) { } piVar9 = param_1; do { iVar14 = (int)*(int8 *)piVar9; iVar15 = (int)((ulong)*(int8 *)piVar9 >> 0x20); if (iVar15 < iVar14) { *(ulong *)piVar9 = CONCAT44(iVar14,iVar15); } piVar9 = piVar9 + 1; } while (piVar9 != param_1 + (ulong)(iVar12 - 2) + 1); iVar12 = iVar12 + -1; } while (iVar12 != 1); uVar10 = param_2 - 2; if (uVar10 < 3) { uVar8 = 0x7fffffff; uVar17 = 0; } else { piVar9 = param_1; uVar8 = _DAT_00102070; uVar11 = _UNK_00102074; uVar18 = _UNK_00102078; uVar16 = _UNK_0010207c; do { piVar1 = piVar9 + 1; piVar2 = piVar9 + 2; piVar3 = piVar9 + 3; piVar4 = piVar9 + 4; iVar12 = *piVar9; piVar5 = piVar9 + 1; piVar6 = piVar9 + 2; piVar7 = piVar9 + 3; piVar9 = piVar9 + 4; uVar17 = -(uint)((int)uVar8 < *piVar1 - iVar12); uVar19 = -(uint)((int)uVar11 < *piVar2 - *piVar5); uVar20 = -(uint)((int)uVar18 < *piVar3 - *piVar6); uVar21 = -(uint)((int)uVar16 < *piVar4 - *piVar7); uVar8 = uVar8 & uVar17 | ~uVar17 & *piVar1 - iVar12; uVar11 = uVar11 & uVar19 | ~uVar19 & *piVar2 - *piVar5; uVar18 = uVar18 & uVar20 | ~uVar20 & *piVar3 - *piVar6; uVar16 = uVar16 & uVar21 | ~uVar21 & *piVar4 - *piVar7; } while (piVar9 != param_1 + (ulong)(uVar13 >> 2) * 4); uVar17 = uVar13 & 0xfffffffc; uVar8 = uVar8 & -(uint)((int)uVar8 < (int)uVar18) | ~-(uint)((int)uVar8 < (int)uVar18) & uVar18; uVar11 = uVar11 & -(uint)((int)uVar11 < (int)uVar16) | ~-(uint)((int)uVar11 < (int)uVar16) & uVar16; uVar18 = -(uint)((int)uVar8 < (int)uVar11); uVar8 = ~uVar18 & uVar11 | uVar8 & uVar18; if ((uVar13 & 3) == 0) { return uVar8; } } iVar12 = uVar17 + 1; uVar11 = uVar17; if (iVar12 < (int)uVar10) { uVar11 = param_1[(long)(int)uVar17 + 1] - param_1[(int)uVar17]; uVar18 = param_1[(long)(int)uVar17 + 2] - param_1[(long)(int)uVar17 + 1]; if ((int)uVar18 < (int)uVar11) { uVar11 = uVar18; } if ((int)uVar11 < (int)uVar8) { uVar8 = uVar11; } if ((int)(uVar17 + 3) < (int)uVar10) { uVar11 = param_1[(long)(int)uVar17 + 3] - param_1[(long)(int)uVar17 + 2]; uVar18 = param_1[(long)(int)uVar17 + 4] - param_1[(long)(int)uVar17 + 3]; if ((int)uVar18 < (int)uVar11) { uVar11 = uVar18; } if ((int)uVar11 < (int)uVar8) { uVar8 = uVar11; } if ((int)(uVar17 + 5) < (int)uVar10) { uVar10 = param_1[(long)(int)uVar17 + 6] - param_1[(long)(int)uVar17 + 5]; uVar11 = param_1[(long)(int)uVar17 + 5] - param_1[(long)(int)uVar17 + 4]; if ((int)uVar11 < (int)uVar10) { uVar10 = uVar11; } if ((int)uVar10 < (int)uVar8) { uVar8 = uVar10; } uVar11 = uVar17 + 6; iVar12 = uVar17 + 7; } else { uVar11 = uVar17 + 4; iVar12 = uVar17 + 5; } } else { uVar11 = uVar17 + 2; iVar12 = uVar17 + 3; } } uVar10 = param_1[iVar12] - param_1[(long)iVar12 + -1]; if ((int)uVar10 < (int)uVar8) { uVar8 = uVar10; } if (iVar12 < (int)uVar13) { uVar10 = param_1[(long)iVar12 + 1] - param_1[iVar12]; if ((int)uVar10 < (int)uVar8) { uVar8 = uVar10; } if (((int)(uVar11 + 2) < (int)uVar13) && (param_1[(long)iVar12 + 2] - param_1[(long)iVar12 + 1] < (int)uVar8)) { uVar8 = param_1[(long)iVar12 + 2] - param_1[(long)iVar12 + 1]; } } return uVar8; }
6,948
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(char str[]) { int number_ctr = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] >= '0' && str[i] <= '9') { number_ctr += 1; } } return number_ctr; }
int main() { assert(func0("program2bedone") == 1); assert(func0("3wonders") == 1); assert(func0("123") == 3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x28,%rsp mov %rdi,-0x28(%rbp) movl $0x0,-0x18(%rbp) movl $0x0,-0x14(%rbp) jmp 11ba <func0+0x51> mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax cmp $0x2f,%al jle 11b6 <func0+0x4d> mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax cmp $0x39,%al jg 11b6 <func0+0x4d> addl $0x1,-0x18(%rbp) addl $0x1,-0x14(%rbp) mov -0x14(%rbp),%eax movslq %eax,%rbx mov -0x28(%rbp),%rax mov %rax,%rdi callq 1060 <strlen@plt> cmp %rax,%rbx jb 118a <func0+0x21> mov -0x18(%rbp),%eax add $0x28,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 28h mov [rbp+s], rdi mov [rbp+var_18], 0 mov [rbp+var_14], 0 jmp short loc_11BA loc_118A: mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+s] add rax, rdx movzx eax, byte ptr [rax] cmp al, 2Fh ; '/' jle short loc_11B6 mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+s] add rax, rdx movzx eax, byte ptr [rax] cmp al, 39h ; '9' jg short loc_11B6 add [rbp+var_18], 1 loc_11B6: add [rbp+var_14], 1 loc_11BA: mov eax, [rbp+var_14] movsxd rbx, eax mov rax, [rbp+s] mov rdi, rax; s call _strlen cmp rbx, rax jb short loc_118A mov eax, [rbp+var_18] mov rbx, [rbp+var_8] leave retn
long long func0(const char *a1) { unsigned int v2; // [rsp+18h] [rbp-18h] int i; // [rsp+1Ch] [rbp-14h] v2 = 0; for ( i = 0; i < strlen(a1); ++i ) { if ( a1[i] > 47 && a1[i] <= 57 ) ++v2; } return v2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x28 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x18],0x0 MOV dword ptr [RBP + -0x14],0x0 JMP 0x001011ba LAB_0010118a: MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] CMP AL,0x2f JLE 0x001011b6 MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] CMP AL,0x39 JG 0x001011b6 ADD dword ptr [RBP + -0x18],0x1 LAB_001011b6: ADD dword ptr [RBP + -0x14],0x1 LAB_001011ba: MOV EAX,dword ptr [RBP + -0x14] MOVSXD RBX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RDI,RAX CALL 0x00101060 CMP RBX,RAX JC 0x0010118a MOV EAX,dword ptr [RBP + -0x18] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int func0(char *param_1) { size_t sVar1; int local_20; int local_1c; local_20 = 0; local_1c = 0; while( true ) { sVar1 = strlen(param_1); if (sVar1 <= (ulong)(long)local_1c) break; if (('/' < param_1[local_1c]) && (param_1[local_1c] < ':')) { local_20 = local_20 + 1; } local_1c = local_1c + 1; } return local_20; }
6,949
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(char str[]) { int number_ctr = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] >= '0' && str[i] <= '9') { number_ctr += 1; } } return number_ctr; }
int main() { assert(func0("program2bedone") == 1); assert(func0("3wonders") == 1); assert(func0("123") == 3); return 0; }
O1
c
func0: endbr64 mov %rdi,%rsi mov $0xffffffffffffffff,%rcx mov $0x0,%eax repnz scas %es:(%rdi),%al not %rcx mov %rsi,%rdx lea -0x1(%rsi,%rcx,1),%rsi mov $0x0,%ecx cmp %rsi,%rdx je 1184 <func0+0x3b> movzbl (%rdx),%eax sub $0x30,%eax cmp $0xa,%al adc $0x0,%ecx add $0x1,%rdx jmp 116e <func0+0x25> mov %ecx,%eax retq
func0: endbr64 push rbx mov rbx, rdi call _strlen mov rdi, rax mov rax, rbx add rdi, rbx mov ecx, 0 jmp short loc_1196 loc_1186: movzx esi, byte ptr [rax] lea edx, [rsi-30h] cmp dl, 0Ah adc ecx, 0 add rax, 1 loc_1196: cmp rax, rdi jnz short loc_1186 mov eax, ecx pop rbx retn
long long func0(_BYTE *a1) { long long v2; // rdi _BYTE *v3; // rax _BYTE *v4; // rdi unsigned int v5; // ecx v2 = strlen(); v3 = a1; v4 = &a1[v2]; v5 = 0; while ( v3 != v4 ) v5 += (unsigned __int8)(*v3++ - 48) < 0xAu; return v5; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101060 MOV RDI,RAX MOV RAX,RBX ADD RDI,RBX MOV ECX,0x0 JMP 0x00101196 LAB_00101186: MOVZX ESI,byte ptr [RAX] LEA EDX,[RSI + -0x30] CMP DL,0xa ADC ECX,0x0 ADD RAX,0x1 LAB_00101196: CMP RAX,RDI JNZ 0x00101186 MOV EAX,ECX POP RBX RET
int func0(char *param_1) { size_t sVar1; int iVar2; char *pcVar3; sVar1 = strlen(param_1); pcVar3 = param_1 + sVar1; iVar2 = 0; for (; param_1 != pcVar3; param_1 = param_1 + 1) { iVar2 = iVar2 + (uint)((byte)(*param_1 - 0x30U) < 10); } return iVar2; }
6,950
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(char str[]) { int number_ctr = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] >= '0' && str[i] <= '9') { number_ctr += 1; } } return number_ctr; }
int main() { assert(func0("program2bedone") == 1); assert(func0("3wonders") == 1); assert(func0("123") == 3); return 0; }
O2
c
func0: endbr64 push %rbx mov %rdi,%rbx callq 1060 <strlen@plt> mov %rbx,%rdi lea (%rbx,%rax,1),%rcx xor %eax,%eax jmp 1240 <func0+0x30> nopl 0x0(%rax,%rax,1) movzbl (%rdi),%esi lea -0x30(%rsi),%edx cmp $0xa,%dl adc $0x0,%eax add $0x1,%rdi cmp %rcx,%rdi jne 1230 <func0+0x20> pop %rbx retq nopw 0x0(%rax,%rax,1)
func0: endbr64 push rbx mov rbx, rdi call _strlen mov rdi, rbx lea rcx, [rbx+rax] xor eax, eax jmp short loc_1240 loc_1230: movzx esi, byte ptr [rdi] lea edx, [rsi-30h] cmp dl, 0Ah adc eax, 0 add rdi, 1 loc_1240: cmp rdi, rcx jnz short loc_1230 pop rbx retn
long long func0(_BYTE *a1) { _BYTE *v1; // rcx long long result; // rax v1 = &a1[strlen()]; result = 0LL; while ( a1 != v1 ) result = ((unsigned __int8)(*a1++ - 48) < 0xAu) + (unsigned int)result; return result; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101060 MOV RDI,RBX LEA RCX,[RBX + RAX*0x1] XOR EAX,EAX JMP 0x00101240 LAB_00101230: MOVZX ESI,byte ptr [RDI] LEA EDX,[RSI + -0x30] CMP DL,0xa ADC EAX,0x0 ADD RDI,0x1 LAB_00101240: CMP RDI,RCX JNZ 0x00101230 POP RBX RET
int func0(char *param_1) { char *pcVar1; int iVar2; size_t sVar3; sVar3 = strlen(param_1); pcVar1 = param_1 + sVar3; iVar2 = 0; for (; param_1 != pcVar1; param_1 = param_1 + 1) { iVar2 = iVar2 + (uint)((byte)(*param_1 - 0x30U) < 10); } return iVar2; }
6,951
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(char str[]) { int number_ctr = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] >= '0' && str[i] <= '9') { number_ctr += 1; } } return number_ctr; }
int main() { assert(func0("program2bedone") == 1); assert(func0("3wonders") == 1); assert(func0("123") == 3); return 0; }
O3
c
func0: endbr64 push %rbx mov %rdi,%rbx callq 1060 <strlen@plt> test %rax,%rax je 14b0 <func0+0x2a0> mov %rax,%rcx lea -0x1(%rax),%rax cmp $0xe,%rax jbe 14b4 <func0+0x2a4> mov %rcx,%rax mov %rbx,%rdx pxor %xmm1,%xmm1 movdqa 0xe67(%rip),%xmm7 and $0xfffffffffffffff0,%rax movdqa 0xe6b(%rip),%xmm6 pxor %xmm4,%xmm4 pxor %xmm3,%xmm3 movdqa 0xe6b(%rip),%xmm5 add %rbx,%rax nopl 0x0(%rax,%rax,1) movdqu (%rdx),%xmm0 movdqa %xmm4,%xmm8 add $0x10,%rdx paddb %xmm7,%xmm0 psubusb %xmm6,%xmm0 pcmpeqb %xmm4,%xmm0 pand %xmm5,%xmm0 pcmpgtb %xmm0,%xmm8 movdqa %xmm0,%xmm2 punpcklbw %xmm8,%xmm2 punpckhbw %xmm8,%xmm0 movdqa %xmm3,%xmm8 pcmpgtw %xmm2,%xmm8 movdqa %xmm2,%xmm9 punpcklwd %xmm8,%xmm9 punpckhwd %xmm8,%xmm2 movdqa %xmm0,%xmm8 paddd %xmm9,%xmm1 paddd %xmm2,%xmm1 movdqa %xmm3,%xmm2 pcmpgtw %xmm0,%xmm2 punpcklwd %xmm2,%xmm8 punpckhwd %xmm2,%xmm0 paddd %xmm8,%xmm1 paddd %xmm0,%xmm1 cmp %rax,%rdx jne 1270 <func0+0x60> movdqa %xmm1,%xmm0 mov %rcx,%rsi psrldq $0x8,%xmm0 and $0xfffffffffffffff0,%rsi paddd %xmm1,%xmm0 mov %esi,%edx movdqa %xmm0,%xmm1 psrldq $0x4,%xmm1 paddd %xmm1,%xmm0 movd %xmm0,%eax cmp %rsi,%rcx je 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0x1(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0x2(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0x3(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0x4(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0x5(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0x6(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0x7(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0x8(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0x9(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0xa(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0xb(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0xc(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil lea 0xd(%rdx),%esi movslq %esi,%rsi adc $0x0,%eax cmp %rsi,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rsi,1),%esi sub $0x30,%esi cmp $0xa,%sil adc $0x0,%eax add $0xe,%edx movslq %edx,%rdx cmp %rdx,%rcx jbe 14a5 <func0+0x295> movzbl (%rbx,%rdx,1),%edx sub $0x30,%edx cmp $0xa,%dl adc $0x0,%eax pop %rbx retq nopw 0x0(%rax,%rax,1) xor %eax,%eax pop %rbx retq xor %edx,%edx xor %eax,%eax xor %esi,%esi jmpq 1316 <func0+0x106>
func0: endbr64 push rbx mov rbx, rdi call _strlen test rax, rax jz loc_1470 mov rdx, rax lea rax, [rax-1] cmp rax, 0Eh jbe loc_1474 mov rcx, rdx pxor xmm1, xmm1 pxor xmm3, xmm3 mov rax, rbx and rcx, 0FFFFFFFFFFFFFFF0h movdqa xmm6, cs:xmmword_2090 movdqa xmm5, cs:xmmword_20A0 pxor xmm4, xmm4 lea rsi, [rcx+rbx] nop dword ptr [rax+00000000h] loc_1268: movdqu xmm2, xmmword ptr [rax] movdqa xmm0, xmm5 movdqa xmm7, xmm3 add rax, 10h paddb xmm2, xmm6 psubusb xmm0, xmm2 pcmpeqb xmm0, xmm3 pcmpeqb xmm0, xmm3 pcmpgtb xmm7, xmm0 movdqa xmm2, xmm0 punpcklbw xmm2, xmm7 punpckhbw xmm0, xmm7 movdqa xmm7, xmm4 pcmpgtw xmm7, xmm2 movdqa xmm8, xmm2 punpcklwd xmm8, xmm7 punpckhwd xmm2, xmm7 movdqa xmm7, xmm0 psubd xmm1, xmm8 psubd xmm1, xmm2 movdqa xmm2, xmm4 pcmpgtw xmm2, xmm0 punpcklwd xmm7, xmm2 punpckhwd xmm0, xmm2 psubd xmm1, xmm7 psubd xmm1, xmm0 cmp rsi, rax jnz short loc_1268 movdqa xmm0, xmm1 mov esi, ecx psrldq xmm0, 8 paddd xmm0, xmm1 movdqa xmm2, xmm0 psrldq xmm2, 4 paddd xmm0, xmm2 movd eax, xmm0 movdqa xmm0, xmm1 psrldq xmm1, 8 paddd xmm1, xmm0 cmp rdx, rcx jz loc_1466 loc_130E: mov rdi, rdx sub rdi, rcx lea r8, [rdi-1] cmp r8, 6 jbe loc_13C5 movq xmm2, qword ptr cs:xmmword_2090 movq xmm0, qword ptr [rbx+rcx] paddb xmm0, xmm2 movq xmm2, cs:qword_20B0 pminub xmm2, xmm0 pcmpeqb xmm0, xmm2 pxor xmm2, xmm2 pcmpgtb xmm2, xmm0 movdqa xmm3, xmm0 punpcklbw xmm3, xmm2 punpcklbw xmm0, xmm2 pxor xmm2, xmm2 movdqa xmm4, xmm2 movdqa xmm5, xmm3 pshufd xmm0, xmm0, 4Eh ; 'N' pcmpgtw xmm4, xmm3 pcmpgtw xmm2, xmm0 punpcklwd xmm5, xmm4 punpcklwd xmm3, xmm4 psubd xmm1, xmm5 pshufd xmm3, xmm3, 4Eh ; 'N' psubd xmm1, xmm3 movdqa xmm3, xmm0 punpcklwd xmm0, xmm2 punpcklwd xmm3, xmm2 pshufd xmm0, xmm0, 4Eh ; 'N' psubd xmm1, xmm3 psubd xmm1, xmm0 movd r8d, xmm1 pshufd xmm6, xmm1, 0E5h movd eax, xmm6 add eax, r8d mov r8, rdi and r8, 0FFFFFFFFFFFFFFF8h add rcx, r8 add esi, r8d and edi, 7 jz loc_1466 loc_13C5: movzx ecx, byte ptr [rbx+rcx] sub ecx, 30h ; '0' cmp cl, 0Ah lea ecx, [rsi+1] movsxd rcx, ecx adc eax, 0 cmp rcx, rdx jnb loc_1466 movzx ecx, byte ptr [rbx+rcx] sub ecx, 30h ; '0' cmp cl, 0Ah lea ecx, [rsi+2] movsxd rcx, ecx adc eax, 0 cmp rcx, rdx jnb short loc_1466 movzx ecx, byte ptr [rbx+rcx] sub ecx, 30h ; '0' cmp cl, 0Ah lea ecx, [rsi+3] movsxd rcx, ecx adc eax, 0 cmp rcx, rdx jnb short loc_1466 movzx ecx, byte ptr [rbx+rcx] sub ecx, 30h ; '0' cmp cl, 0Ah lea ecx, [rsi+4] movsxd rcx, ecx adc eax, 0 cmp rcx, rdx jnb short loc_1466 movzx ecx, byte ptr [rbx+rcx] sub ecx, 30h ; '0' cmp cl, 0Ah lea ecx, [rsi+5] movsxd rcx, ecx adc eax, 0 cmp rcx, rdx jnb short loc_1466 movzx ecx, byte ptr [rbx+rcx] sub ecx, 30h ; '0' cmp cl, 0Ah adc eax, 0 add esi, 6 movsxd rsi, esi cmp rsi, rdx jnb short loc_1466 movzx edx, byte ptr [rbx+rsi] sub edx, 30h ; '0' cmp dl, 0Ah adc eax, 0 loc_1466: pop rbx retn loc_1470: xor eax, eax pop rbx retn loc_1474: pxor xmm1, xmm1 xor esi, esi xor eax, eax xor ecx, ecx jmp loc_130E
long long func0(const char *a1) { size_t v2; // rax size_t v3; // rdx __m128i v4; // xmm1 const __m128i *v5; // rax unsigned long long v6; // rcx __m128i si128; // xmm6 __m128i v8; // xmm5 __m128i v9; // xmm2 __m128i v10; // xmm0 __m128i v11; // xmm7 __m128i v12; // xmm2 __m128i v13; // xmm0 __m128i v14; // xmm7 __m128i v15; // xmm1 __m128i v16; // xmm2 int v17; // esi __m128i v18; // xmm0 long long result; // rax __m128i v20; // xmm1 size_t v21; // rdi __m128i v22; // xmm0 __m128i v23; // xmm0 __m128i v24; // xmm3 __m128i v25; // xmm0 __m128i v26; // xmm2 __m128i v27; // xmm3 __m128i v28; // xmm1 bool v29; // cf size_t v30; // rcx size_t v31; // rcx size_t v32; // rcx size_t v33; // rcx size_t v34; // rcx size_t v35; // rsi v2 = strlen(a1); if ( !v2 ) return 0LL; v3 = v2; if ( v2 - 1 <= 0xE ) { v20 = 0LL; v17 = 0; LODWORD(result) = 0; v6 = 0LL; } else { v4 = 0LL; v5 = (const __m128i *)a1; v6 = v3 & 0xFFFFFFFFFFFFFFF0LL; si128 = _mm_load_si128((const __m128i *)&xmmword_2090); v8 = _mm_load_si128((const __m128i *)&xmmword_20A0); do { v9 = _mm_loadu_si128(v5++); v10 = _mm_cmpeq_epi8(_mm_cmpeq_epi8(_mm_subs_epu8(v8, _mm_add_epi8(v9, si128)), (__m128i)0LL), (__m128i)0LL); v11 = _mm_cmpgt_epi8((__m128i)0LL, v10); v12 = _mm_unpacklo_epi8(v10, v11); v13 = _mm_unpackhi_epi8(v10, v11); v14 = _mm_cmpgt_epi16((__m128i)0LL, v12); v15 = _mm_sub_epi32(_mm_sub_epi32(v4, _mm_unpacklo_epi16(v12, v14)), _mm_unpackhi_epi16(v12, v14)); v16 = _mm_cmpgt_epi16((__m128i)0LL, v13); v4 = _mm_sub_epi32(_mm_sub_epi32(v15, _mm_unpacklo_epi16(v13, v16)), _mm_unpackhi_epi16(v13, v16)); } while ( &a1[v3 & 0xFFFFFFFFFFFFFFF0LL] != (const char *)v5 ); v17 = v3 & 0xFFFFFFF0; v18 = _mm_add_epi32(_mm_srli_si128(v4, 8), v4); result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v18, _mm_srli_si128(v18, 4))); v20 = v18; if ( v3 == v6 ) return result; } v21 = v3 - v6; if ( v3 - v6 - 1 <= 6 ) goto LABEL_8; v22 = _mm_add_epi8(_mm_loadl_epi64((const __m128i *)&a1[v6]), _mm_loadl_epi64((const __m128i *)&xmmword_2090)); v23 = _mm_cmpeq_epi8(v22, _mm_min_epu8(_mm_loadl_epi64((const __m128i *)&qword_20B0), v22)); v24 = _mm_unpacklo_epi8(v23, _mm_cmpgt_epi8((__m128i)0LL, v23)); v25 = _mm_shuffle_epi32(v24, 78); v26 = _mm_cmpgt_epi16((__m128i)0LL, v25); v27 = _mm_unpacklo_epi16(v24, _mm_cmpgt_epi16((__m128i)0LL, v24)); v28 = _mm_sub_epi32( _mm_sub_epi32( _mm_sub_epi32(_mm_sub_epi32(v20, v27), _mm_shuffle_epi32(v27, 78)), _mm_unpacklo_epi16(v25, v26)), _mm_shuffle_epi32(_mm_unpacklo_epi16(v25, v26), 78)); result = (unsigned int)(_mm_cvtsi128_si32(v28) + _mm_cvtsi128_si32(_mm_shuffle_epi32(v28, 229))); v6 += v21 & 0xFFFFFFFFFFFFFFF8LL; v17 += v21 & 0xFFFFFFF8; if ( (v21 & 7) != 0 ) { LABEL_8: v29 = (unsigned __int8)(a1[v6] - 48) < 0xAu; v30 = v17 + 1; result = v29 + (unsigned int)result; if ( v30 < v3 ) { v29 = (unsigned __int8)(a1[v30] - 48) < 0xAu; v31 = v17 + 2; result = v29 + (unsigned int)result; if ( v31 < v3 ) { v29 = (unsigned __int8)(a1[v31] - 48) < 0xAu; v32 = v17 + 3; result = v29 + (unsigned int)result; if ( v32 < v3 ) { v29 = (unsigned __int8)(a1[v32] - 48) < 0xAu; v33 = v17 + 4; result = v29 + (unsigned int)result; if ( v33 < v3 ) { v29 = (unsigned __int8)(a1[v33] - 48) < 0xAu; v34 = v17 + 5; result = v29 + (unsigned int)result; if ( v34 < v3 ) { result = ((unsigned __int8)(a1[v34] - 48) < 0xAu) + (unsigned int)result; v35 = v17 + 6; if ( v35 < v3 ) return ((unsigned __int8)(a1[v35] - 48) < 0xAu) + (unsigned int)result; } } } } } } return result; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101060 TEST RAX,RAX JZ 0x00101470 MOV RDX,RAX LEA RAX,[RAX + -0x1] CMP RAX,0xe JBE 0x00101474 MOV RCX,RDX PXOR XMM1,XMM1 PXOR XMM3,XMM3 MOV RAX,RBX AND RCX,-0x10 MOVDQA XMM6,xmmword ptr [0x00102090] MOVDQA XMM5,xmmword ptr [0x001020a0] PXOR XMM4,XMM4 LEA RSI,[RCX + RBX*0x1] NOP dword ptr [RAX] LAB_00101268: MOVDQU XMM2,xmmword ptr [RAX] MOVDQA XMM0,XMM5 MOVDQA XMM7,XMM3 ADD RAX,0x10 PADDB XMM2,XMM6 PSUBUSB XMM0,XMM2 PCMPEQB XMM0,XMM3 PCMPEQB XMM0,XMM3 PCMPGTB XMM7,XMM0 MOVDQA XMM2,XMM0 PUNPCKLBW XMM2,XMM7 PUNPCKHBW XMM0,XMM7 MOVDQA XMM7,XMM4 PCMPGTW XMM7,XMM2 MOVDQA XMM8,XMM2 PUNPCKLWD XMM8,XMM7 PUNPCKHWD XMM2,XMM7 MOVDQA XMM7,XMM0 PSUBD XMM1,XMM8 PSUBD XMM1,XMM2 MOVDQA XMM2,XMM4 PCMPGTW XMM2,XMM0 PUNPCKLWD XMM7,XMM2 PUNPCKHWD XMM0,XMM2 PSUBD XMM1,XMM7 PSUBD XMM1,XMM0 CMP RSI,RAX JNZ 0x00101268 MOVDQA XMM0,XMM1 MOV ESI,ECX PSRLDQ XMM0,0x8 PADDD XMM0,XMM1 MOVDQA XMM2,XMM0 PSRLDQ XMM2,0x4 PADDD XMM0,XMM2 MOVD EAX,XMM0 MOVDQA XMM0,XMM1 PSRLDQ XMM1,0x8 PADDD XMM1,XMM0 CMP RDX,RCX JZ 0x00101466 LAB_0010130e: MOV RDI,RDX SUB RDI,RCX LEA R8,[RDI + -0x1] CMP R8,0x6 JBE 0x001013c5 MOVQ XMM2,qword ptr [0x00102090] MOVQ XMM0,qword ptr [RBX + RCX*0x1] PADDB XMM0,XMM2 MOVQ XMM2,qword ptr [0x001020b0] PMINUB XMM2,XMM0 PCMPEQB XMM0,XMM2 PXOR XMM2,XMM2 PCMPGTB XMM2,XMM0 MOVDQA XMM3,XMM0 PUNPCKLBW XMM3,XMM2 PUNPCKLBW XMM0,XMM2 PXOR XMM2,XMM2 MOVDQA XMM4,XMM2 MOVDQA XMM5,XMM3 PSHUFD XMM0,XMM0,0x4e PCMPGTW XMM4,XMM3 PCMPGTW XMM2,XMM0 PUNPCKLWD XMM5,XMM4 PUNPCKLWD XMM3,XMM4 PSUBD XMM1,XMM5 PSHUFD XMM3,XMM3,0x4e PSUBD XMM1,XMM3 MOVDQA XMM3,XMM0 PUNPCKLWD XMM0,XMM2 PUNPCKLWD XMM3,XMM2 PSHUFD XMM0,XMM0,0x4e PSUBD XMM1,XMM3 PSUBD XMM1,XMM0 MOVD R8D,XMM1 PSHUFD XMM6,XMM1,0xe5 MOVD EAX,XMM6 ADD EAX,R8D MOV R8,RDI AND R8,-0x8 ADD RCX,R8 ADD ESI,R8D AND EDI,0x7 JZ 0x00101466 LAB_001013c5: MOVZX ECX,byte ptr [RBX + RCX*0x1] SUB ECX,0x30 CMP CL,0xa LEA ECX,[RSI + 0x1] MOVSXD RCX,ECX ADC EAX,0x0 CMP RCX,RDX JNC 0x00101466 MOVZX ECX,byte ptr [RBX + RCX*0x1] SUB ECX,0x30 CMP CL,0xa LEA ECX,[RSI + 0x2] MOVSXD RCX,ECX ADC EAX,0x0 CMP RCX,RDX JNC 0x00101466 MOVZX ECX,byte ptr [RBX + RCX*0x1] SUB ECX,0x30 CMP CL,0xa LEA ECX,[RSI + 0x3] MOVSXD RCX,ECX ADC EAX,0x0 CMP RCX,RDX JNC 0x00101466 MOVZX ECX,byte ptr [RBX + RCX*0x1] SUB ECX,0x30 CMP CL,0xa LEA ECX,[RSI + 0x4] MOVSXD RCX,ECX ADC EAX,0x0 CMP RCX,RDX JNC 0x00101466 MOVZX ECX,byte ptr [RBX + RCX*0x1] SUB ECX,0x30 CMP CL,0xa LEA ECX,[RSI + 0x5] MOVSXD RCX,ECX ADC EAX,0x0 CMP RCX,RDX JNC 0x00101466 MOVZX ECX,byte ptr [RBX + RCX*0x1] SUB ECX,0x30 CMP CL,0xa ADC EAX,0x0 ADD ESI,0x6 MOVSXD RSI,ESI CMP RSI,RDX JNC 0x00101466 MOVZX EDX,byte ptr [RBX + RSI*0x1] SUB EDX,0x30 CMP DL,0xa ADC EAX,0x0 LAB_00101466: POP RBX RET LAB_00101470: XOR EAX,EAX POP RBX RET LAB_00101474: PXOR XMM1,XMM1 XOR ESI,ESI XOR EAX,EAX XOR ECX,ECX JMP 0x0010130e
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ int func0(char *param_1) { bool bVar1; bool bVar2; bool bVar3; bool bVar4; bool bVar5; bool bVar6; bool bVar7; bool bVar8; bool bVar9; bool bVar10; bool bVar11; bool bVar12; bool bVar13; bool bVar14; bool bVar15; bool bVar16; char *pcVar17; char *pcVar18; char *pcVar19; char *pcVar20; char *pcVar21; char *pcVar22; char *pcVar23; char *pcVar24; char *pcVar25; char *pcVar26; char *pcVar27; char *pcVar28; char *pcVar29; char *pcVar30; char *pcVar31; int auVar32 [14]; int auVar33 [12]; unkbyte10 Var34; int auVar35 [12]; int auVar36 [14]; int auVar37 [12]; int auVar38 [16]; int auVar39 [16]; int auVar40 [16]; int auVar41 [12]; unkbyte9 Var42; int6 uVar43; int4 uVar44; int2 uVar45; size_t sVar46; char *pcVar47; ulong uVar48; uint uVar49; ulong uVar50; byte bVar51; short sVar52; int4 uVar53; int iVar54; byte bVar77; byte bVar79; byte bVar83; byte bVar88; int auVar57 [11]; int auVar59 [12]; int auVar61 [12]; byte bVar78; byte bVar80; short sVar82; byte bVar85; char cVar87; int auVar65 [16]; int auVar67 [16]; int auVar74 [16]; int iVar90; int iVar91; int iVar92; int iVar93; int iVar94; char cVar99; char cVar100; char cVar101; char cVar102; char cVar103; char cVar104; short sVar105; short sVar106; int auVar96 [16]; int auVar97 [16]; int auVar107 [16]; int auVar114 [16]; int auVar117 [16]; int auVar121 [16]; int auVar124 [16]; int auVar129 [16]; int6 uVar55; int8 uVar56; int auVar68 [16]; int auVar58 [12]; int auVar69 [16]; int auVar75 [16]; int auVar60 [12]; int auVar70 [16]; int auVar63 [14]; int auVar66 [16]; int auVar62 [13]; int auVar71 [16]; int auVar76 [16]; int auVar64 [14]; int auVar72 [16]; int auVar73 [16]; char cVar81; char cVar84; char cVar86; long lVar89; int auVar95 [12]; int auVar98 [16]; int auVar118 [16]; int auVar108 [16]; int auVar109 [16]; int auVar115 [16]; int auVar119 [16]; int auVar110 [16]; int auVar111 [16]; int auVar116 [16]; int auVar120 [16]; int auVar112 [16]; int auVar113 [16]; int auVar122 [16]; int auVar123 [16]; int auVar125 [16]; int auVar126 [16]; int auVar127 [16]; int auVar128 [16]; int auVar130 [16]; int auVar131 [16]; sVar46 = strlen(param_1); if (sVar46 == 0) { return 0; } if (sVar46 - 1 < 0xf) { iVar92 = 0; iVar93 = 0; uVar49 = 0; iVar54 = 0; uVar48 = 0; } else { iVar90 = 0; iVar91 = 0; iVar92 = 0; iVar93 = 0; uVar48 = sVar46 & 0xfffffffffffffff0; pcVar47 = param_1; do { cVar87 = *pcVar47; pcVar17 = pcVar47 + 1; pcVar18 = pcVar47 + 2; pcVar19 = pcVar47 + 3; pcVar20 = pcVar47 + 4; pcVar21 = pcVar47 + 5; pcVar22 = pcVar47 + 6; pcVar23 = pcVar47 + 7; pcVar24 = pcVar47 + 8; pcVar25 = pcVar47 + 9; pcVar26 = pcVar47 + 10; pcVar27 = pcVar47 + 0xb; pcVar28 = pcVar47 + 0xc; pcVar29 = pcVar47 + 0xd; pcVar30 = pcVar47 + 0xe; pcVar31 = pcVar47 + 0xf; pcVar47 = pcVar47 + 0x10; auVar96[0] = cVar87 + (char)DAT_00102090; auVar96[1] = *pcVar17 + DAT_00102090._1_1_; auVar96[2] = *pcVar18 + DAT_00102090._2_1_; auVar96[3] = *pcVar19 + DAT_00102090._3_1_; auVar96[4] = *pcVar20 + DAT_00102090._4_1_; auVar96[5] = *pcVar21 + DAT_00102090._5_1_; auVar96[6] = *pcVar22 + DAT_00102090._6_1_; auVar96[7] = *pcVar23 + DAT_00102090._7_1_; auVar96[8] = *pcVar24 + UNK_00102098; auVar96[9] = *pcVar25 + UNK_00102099; auVar96[10] = *pcVar26 + UNK_0010209a; auVar96[0xb] = *pcVar27 + UNK_0010209b; auVar96[0xc] = *pcVar28 + UNK_0010209c; auVar96[0xd] = *pcVar29 + UNK_0010209d; auVar96[0xe] = *pcVar30 + UNK_0010209e; auVar96[0xf] = *pcVar31 + UNK_0010209f; auVar65 = psubusb(_DAT_001020a0,auVar96); bVar1 = auVar65[0] != '\0'; bVar2 = auVar65[1] != '\0'; bVar3 = auVar65[2] != '\0'; bVar4 = auVar65[3] != '\0'; bVar5 = auVar65[4] != '\0'; bVar6 = auVar65[5] != '\0'; bVar7 = auVar65[6] != '\0'; bVar8 = auVar65[7] != '\0'; bVar9 = auVar65[8] != '\0'; bVar10 = auVar65[9] != '\0'; bVar11 = auVar65[10] != '\0'; bVar12 = auVar65[0xb] != '\0'; bVar13 = auVar65[0xc] != '\0'; bVar14 = auVar65[0xd] != '\0'; bVar15 = auVar65[0xe] != '\0'; bVar16 = auVar65[0xf] != '\0'; cVar87 = -bVar8; uVar45 = CONCAT11(-bVar8,cVar87); uVar44 = CONCAT31(CONCAT21(uVar45,-bVar7),-bVar7); uVar43 = CONCAT51(CONCAT41(uVar44,-bVar6),-bVar6); Var42 = CONCAT72(CONCAT61(uVar43,-bVar5),CONCAT11(-bVar5,cVar87)); lVar89 = (long)((unkuint9)Var42 >> 8); Var34 = CONCAT91(CONCAT81(lVar89,-bVar4),-bVar4); auVar33._2_10_ = Var34; auVar33[1] = -bVar3; auVar33[0] = -bVar3; auVar32._2_12_ = auVar33; auVar32[1] = -bVar2; auVar32[0] = -bVar2; auVar97._0_2_ = CONCAT11(-bVar1,-bVar1); auVar97._2_14_ = auVar32; uVar53 = CONCAT13(-bVar10,CONCAT12(-bVar10,CONCAT11(-bVar9,-bVar9))); uVar55 = CONCAT15(-bVar11,CONCAT14(-bVar11,uVar53)); uVar56 = CONCAT17(-bVar12,CONCAT16(-bVar12,uVar55)); auVar58._0_10_ = CONCAT19(-bVar13,CONCAT18(-bVar13,uVar56)); auVar58[10] = -bVar14; auVar58[0xb] = -bVar14; auVar63[0xc] = -bVar15; auVar63._0_12_ = auVar58; auVar63[0xd] = -bVar15; auVar65[0xe] = -bVar16; auVar65._0_14_ = auVar63; auVar65[0xf] = -bVar16; sVar52 = (short)Var34; sVar82 = (short)((unkuint9)Var42 >> 8); sVar105 = (short)uVar43; sVar106 = (short)uVar44; auVar131._0_12_ = auVar97._0_12_; auVar131._12_2_ = sVar52; auVar131._14_2_ = -(ushort)(sVar52 < 0); auVar130._12_4_ = auVar131._12_4_; auVar130._0_10_ = auVar97._0_10_; auVar130._10_2_ = -(ushort)(auVar33._0_2_ < 0); auVar129._10_6_ = auVar130._10_6_; auVar129._0_8_ = auVar97._0_8_; auVar129._8_2_ = auVar33._0_2_; auVar35._4_8_ = auVar129._8_8_; auVar35._2_2_ = -(ushort)(auVar32._0_2_ < 0); auVar35._0_2_ = auVar32._0_2_; iVar94 = CONCAT22(-(ushort)(sVar82 < 0),sVar82); auVar95._0_8_ = CONCAT26(-(ushort)(sVar105 < 0),CONCAT24(sVar105,iVar94)); auVar95._8_2_ = sVar106; auVar95._10_2_ = -(ushort)(sVar106 < 0); auVar98._12_2_ = uVar45; auVar98._0_12_ = auVar95; auVar98._14_2_ = -(ushort)(lVar89 < 0); sVar52 = (short)((unkuint10)auVar58._0_10_ >> 0x40); auVar128._12_2_ = (short)((ulong)uVar56 >> 0x30); auVar128._0_12_ = auVar58; auVar128._14_2_ = -(ushort)bVar12; auVar127._12_4_ = auVar128._12_4_; auVar127._10_2_ = -(ushort)bVar11; auVar127._0_10_ = auVar58._0_10_; auVar126._10_6_ = auVar127._10_6_; auVar126._8_2_ = (short)((uint6)uVar55 >> 0x20); auVar126._0_8_ = uVar56; auVar125._8_8_ = auVar126._8_8_; auVar125._6_2_ = -(ushort)bVar10; auVar125._0_6_ = uVar55; auVar124._6_10_ = auVar125._6_10_; auVar124._4_2_ = (short)((uint)uVar53 >> 0x10); auVar124._0_4_ = uVar53; iVar54 = CONCAT22(-(ushort)(sVar52 < 0),sVar52); auVar59._0_8_ = CONCAT26(-(ushort)(auVar58._10_2_ < 0),CONCAT24(auVar58._10_2_,iVar54)); auVar59._8_2_ = auVar63._12_2_; auVar59._10_2_ = -(ushort)(auVar63._12_2_ < 0); auVar66._12_2_ = auVar65._14_2_; auVar66._0_12_ = auVar59; auVar66._14_2_ = -(ushort)(auVar65._14_2_ < 0); iVar90 = (((iVar90 - CONCAT22(-(ushort)bVar1,auVar97._0_2_)) - iVar94) - CONCAT22(-(ushort)bVar9,CONCAT11(-bVar9,-bVar9))) - iVar54; iVar91 = (((iVar91 - auVar35._0_4_) - (int)((ulong)auVar95._0_8_ >> 0x20)) - auVar124._4_4_) - (int)((ulong)auVar59._0_8_ >> 0x20); iVar92 = (((iVar92 - auVar129._8_4_) - auVar95._8_4_) - auVar126._8_4_) - auVar59._8_4_; iVar93 = (((iVar93 - auVar130._12_4_) - auVar98._12_4_) - auVar127._12_4_) - auVar66._12_4_; } while (param_1 + uVar48 != pcVar47); uVar49 = (uint)sVar46 & 0xfffffff0; iVar54 = iVar92 + iVar90 + iVar93 + iVar91; iVar92 = iVar92 + iVar90; iVar93 = iVar93 + iVar91; if (sVar46 == uVar48) { return iVar54; } } uVar50 = sVar46 - uVar48; if (6 < uVar50 - 1) { uVar56 = *(int8 *)(param_1 + uVar48); bVar51 = (char)uVar56 + (char)DAT_00102090; bVar77 = (char)((ulong)uVar56 >> 8) + DAT_00102090._1_1_; bVar78 = (char)((ulong)uVar56 >> 0x10) + DAT_00102090._2_1_; bVar79 = (char)((ulong)uVar56 >> 0x18) + DAT_00102090._3_1_; bVar80 = (char)((ulong)uVar56 >> 0x20) + DAT_00102090._4_1_; bVar83 = (char)((ulong)uVar56 >> 0x28) + DAT_00102090._5_1_; bVar85 = (char)((ulong)uVar56 >> 0x30) + DAT_00102090._6_1_; bVar88 = (char)((ulong)uVar56 >> 0x38) + DAT_00102090._7_1_; bVar1 = bVar51 == (byte)((bVar51 < (byte)DAT_001020b0) * bVar51 | (bVar51 >= (byte)DAT_001020b0) * (byte)DAT_001020b0); auVar67[0] = -bVar1; bVar2 = bVar77 == (byte)((bVar77 < DAT_001020b0._1_1_) * bVar77 | (bVar77 >= DAT_001020b0._1_1_) * DAT_001020b0._1_1_); cVar87 = -bVar2; bVar3 = bVar78 == (byte)((bVar78 < DAT_001020b0._2_1_) * bVar78 | (bVar78 >= DAT_001020b0._2_1_) * DAT_001020b0._2_1_); bVar4 = bVar79 == (byte)((bVar79 < DAT_001020b0._3_1_) * bVar79 | (bVar79 >= DAT_001020b0._3_1_) * DAT_001020b0._3_1_); bVar5 = bVar80 == (byte)((bVar80 < DAT_001020b0._4_1_) * bVar80 | (bVar80 >= DAT_001020b0._4_1_) * DAT_001020b0._4_1_); cVar81 = -bVar5; bVar6 = bVar83 == (byte)((bVar83 < DAT_001020b0._5_1_) * bVar83 | (bVar83 >= DAT_001020b0._5_1_) * DAT_001020b0._5_1_); cVar84 = -bVar6; bVar7 = bVar85 == (byte)((bVar85 < DAT_001020b0._6_1_) * bVar85 | (bVar85 >= DAT_001020b0._6_1_) * DAT_001020b0._6_1_); cVar86 = -bVar7; bVar8 = bVar88 == (byte)((bVar88 < DAT_001020b0._7_1_) * bVar88 | (bVar88 >= DAT_001020b0._7_1_) * DAT_001020b0._7_1_); bVar51 = -bVar8; auVar68._0_9_ = CONCAT18(0xff,(ulong)bVar51 << 0x38); auVar57._0_10_ = CONCAT19(0xff,auVar68._0_9_); auVar57[10] = 0xff; auVar60[0xb] = 0xff; auVar60._0_11_ = auVar57; auVar62[0xc] = 0xff; auVar62._0_12_ = auVar60; auVar64[0xd] = 0xff; auVar64._0_13_ = auVar62; cVar99 = -bVar2; cVar100 = -bVar4; cVar101 = -bVar5; cVar102 = -bVar6; cVar103 = -bVar7; cVar104 = -bVar8; auVar113[0xe] = bVar51; auVar113._0_14_ = auVar64; auVar113[0xf] = cVar104; auVar112._14_2_ = auVar113._14_2_; auVar112[0xd] = cVar103; auVar112._0_13_ = auVar62; auVar111._13_3_ = auVar112._13_3_; auVar111[0xc] = cVar86; auVar111._0_12_ = auVar60; auVar110._12_4_ = auVar111._12_4_; auVar110[0xb] = cVar102; auVar110._0_11_ = auVar57; auVar109._11_5_ = auVar110._11_5_; auVar109[10] = cVar84; auVar109._0_10_ = auVar57._0_10_; auVar108._10_6_ = auVar109._10_6_; auVar108[9] = cVar101; auVar108._0_9_ = auVar68._0_9_; Var34 = CONCAT91(CONCAT81((long)(CONCAT72(auVar108._9_7_,CONCAT11(cVar81,bVar51)) >> 8),cVar100) ,-bVar4); auVar37._2_10_ = Var34; auVar37[1] = -bVar3; auVar37[0] = -bVar3; auVar36._2_12_ = auVar37; auVar36[1] = cVar99; auVar36[0] = cVar87; auVar107._0_2_ = CONCAT11(-bVar1,auVar67[0]); auVar107._2_14_ = auVar36; auVar73[0xe] = bVar51; auVar73._0_14_ = auVar64; auVar73[0xf] = cVar104; auVar72._14_2_ = auVar73._14_2_; auVar72[0xd] = cVar103; auVar72._0_13_ = auVar62; auVar71._13_3_ = auVar72._13_3_; auVar71[0xc] = cVar86; auVar71._0_12_ = auVar60; auVar70._12_4_ = auVar71._12_4_; auVar70[0xb] = cVar102; auVar70._0_11_ = auVar57; auVar69._11_5_ = auVar70._11_5_; auVar69[10] = cVar84; auVar69._0_10_ = auVar57._0_10_; auVar68._10_6_ = auVar69._10_6_; auVar68[9] = cVar101; Var42 = CONCAT72(auVar68._9_7_,CONCAT11(cVar81,bVar51)); lVar89 = (long)((unkuint9)Var42 >> 8); auVar40._1_8_ = lVar89; auVar40[0] = cVar100; auVar40._9_7_ = 0; auVar39._10_6_ = 0; auVar39._0_10_ = SUB1610(auVar40 << 0x38,6); auVar38._11_5_ = 0; auVar38._0_11_ = SUB1611(auVar39 << 0x30,5); auVar67._4_12_ = SUB1612(auVar38 << 0x28,4); auVar67[3] = cVar99; auVar67[2] = cVar87; auVar67[1] = -bVar1; iVar54 = (int)((unkuint9)Var42 >> 8); auVar61._8_4_ = auVar67._0_4_; auVar61._0_8_ = lVar89; sVar105 = auVar37._0_2_; sVar106 = (short)Var34; sVar52 = (short)((unkuint9)Var42 >> 8); sVar82 = auVar71._12_2_; auVar123._0_12_ = auVar107._0_12_; auVar123._12_2_ = sVar106; auVar123._14_2_ = -(ushort)(sVar106 < 0); auVar122._12_4_ = auVar123._12_4_; auVar122._0_10_ = auVar107._0_10_; auVar122._10_2_ = -(ushort)(sVar105 < 0); auVar121._10_6_ = auVar122._10_6_; auVar121._0_8_ = auVar107._0_8_; auVar121._8_2_ = sVar105; auVar41._4_8_ = auVar121._8_8_; auVar41._2_2_ = -(ushort)(auVar36._0_2_ < 0); auVar41._0_2_ = auVar36._0_2_; auVar116._12_2_ = sVar106; auVar116._0_12_ = auVar123._0_12_; auVar116._14_2_ = -(ushort)(sVar106 < 0); auVar115._12_4_ = auVar116._12_4_; auVar115._10_2_ = -(ushort)(sVar105 < 0); auVar115._0_10_ = auVar122._0_10_; auVar114._10_6_ = auVar115._10_6_; auVar114._8_2_ = sVar105; auVar114._0_8_ = auVar121._0_8_; auVar76._12_2_ = auVar72._14_2_; auVar76._0_12_ = auVar61; auVar76._14_2_ = -(ushort)(lVar89 < 0); auVar75._12_4_ = auVar76._12_4_; auVar75._0_10_ = auVar61._0_10_; auVar75._10_2_ = -(ushort)(sVar82 < 0); auVar74._10_6_ = auVar75._10_6_; auVar74._8_2_ = sVar82; auVar74._0_8_ = lVar89; auVar120._12_2_ = auVar72._14_2_; auVar120._0_12_ = auVar61; auVar120._14_2_ = -(ushort)(lVar89 < 0); auVar119._12_4_ = auVar120._12_4_; auVar119._10_2_ = -(ushort)(sVar82 < 0); auVar119._0_10_ = auVar75._0_10_; auVar118._10_6_ = auVar119._10_6_; auVar118._8_2_ = sVar82; auVar118._0_8_ = lVar89; auVar117._8_8_ = auVar118._8_8_; auVar117._6_2_ = -(ushort)(iVar54 < 0); auVar117._4_2_ = auVar69._10_2_; auVar117._0_4_ = iVar54; iVar54 = ((((iVar93 - auVar41._0_4_) - auVar115._12_4_) - auVar117._4_4_) - auVar75._12_4_) + ((((iVar92 - CONCAT22(-(ushort)bVar1,auVar107._0_2_)) - auVar114._8_4_) - CONCAT22(-(ushort)(sVar52 < 0),sVar52)) - auVar74._8_4_); uVar48 = uVar48 + (uVar50 & 0xfffffffffffffff8); uVar49 = uVar49 + (int)(uVar50 & 0xfffffffffffffff8); if ((uVar50 & 7) == 0) { return iVar54; } } iVar54 = iVar54 + (uint)((byte)(param_1[uVar48] - 0x30U) < 10); if ((ulong)(long)(int)(uVar49 + 1) < sVar46) { iVar54 = iVar54 + (uint)((byte)(param_1[(int)(uVar49 + 1)] - 0x30U) < 10); if ((ulong)(long)(int)(uVar49 + 2) < sVar46) { iVar54 = iVar54 + (uint)((byte)(param_1[(int)(uVar49 + 2)] - 0x30U) < 10); if ((ulong)(long)(int)(uVar49 + 3) < sVar46) { iVar54 = iVar54 + (uint)((byte)(param_1[(int)(uVar49 + 3)] - 0x30U) < 10); if ((ulong)(long)(int)(uVar49 + 4) < sVar46) { iVar54 = iVar54 + (uint)((byte)(param_1[(int)(uVar49 + 4)] - 0x30U) < 10); if ((ulong)(long)(int)(uVar49 + 5) < sVar46) { iVar54 = iVar54 + (uint)((byte)(param_1[(int)(uVar49 + 5)] - 0x30U) < 10); if ((ulong)(long)(int)(uVar49 + 6) < sVar46) { iVar54 = iVar54 + (uint)((byte)(param_1[(int)(uVar49 + 6)] - 0x30U) < 10); } } } } } } return iVar54; }
6,952
func0
#include <stdio.h> #include <math.h> #include <assert.h>
int func0(int n) { n = n + 1; return n + (int)(log2(n + log2(n))); }
int main() { assert(func0(7) == 11); assert(func0(4) == 7); assert(func0(9) == 13); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov %edi,-0x4(%rbp) addl $0x1,-0x4(%rbp) cvtsi2sdl -0x4(%rbp),%xmm1 movsd %xmm1,-0x10(%rbp) cvtsi2sdl -0x4(%rbp),%xmm0 callq 1060 <log2@plt> addsd -0x10(%rbp),%xmm0 callq 1060 <log2@plt> cvttsd2si %xmm0,%edx mov -0x4(%rbp),%eax add %edx,%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 10h mov [rbp+var_4], edi add [rbp+var_4], 1 pxor xmm1, xmm1 cvtsi2sd xmm1, [rbp+var_4] movsd [rbp+var_10], xmm1 pxor xmm2, xmm2 cvtsi2sd xmm2, [rbp+var_4] movq rax, xmm2 movq xmm0, rax; x call _log2 addsd xmm0, [rbp+var_10] movq rax, xmm0 movq xmm0, rax; x call _log2 cvttsd2si edx, xmm0 mov eax, [rbp+var_4] add eax, edx leave retn
long long func0(int a1) { double v1; // xmm0_8 v1 = log2((double)(a1 + 1)); return (unsigned int)((int)log2(v1 + (double)(a1 + 1)) + a1 + 1); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x10 MOV dword ptr [RBP + -0x4],EDI ADD dword ptr [RBP + -0x4],0x1 PXOR XMM1,XMM1 CVTSI2SD XMM1,dword ptr [RBP + -0x4] MOVSD qword ptr [RBP + -0x10],XMM1 PXOR XMM2,XMM2 CVTSI2SD XMM2,dword ptr [RBP + -0x4] MOVQ RAX,XMM2 MOVQ XMM0,RAX CALL 0x00101060 ADDSD XMM0,qword ptr [RBP + -0x10] MOVQ RAX,XMM0 MOVQ XMM0,RAX CALL 0x00101060 CVTTSD2SI EDX,XMM0 MOV EAX,dword ptr [RBP + -0x4] ADD EAX,EDX LEAVE RET
int func0(int param_1) { double dVar1; param_1 = param_1 + 1; dVar1 = log2((double)param_1); dVar1 = log2(dVar1 + (double)param_1); return param_1 + (int)dVar1; }
6,953
func0
#include <stdio.h> #include <math.h> #include <assert.h>
int func0(int n) { n = n + 1; return n + (int)(log2(n + log2(n))); }
int main() { assert(func0(7) == 11); assert(func0(4) == 7); assert(func0(9) == 13); return 0; }
O1
c
func0: endbr64 push %rbx sub $0x10,%rsp lea 0x1(%rdi),%ebx pxor %xmm1,%xmm1 cvtsi2sd %ebx,%xmm1 movsd %xmm1,0x8(%rsp) movapd %xmm1,%xmm0 callq 1060 <log2@plt> addsd 0x8(%rsp),%xmm0 callq 1060 <log2@plt> cvttsd2si %xmm0,%eax add %ebx,%eax add $0x10,%rsp pop %rbx retq
func0: endbr64 push rbx sub rsp, 10h lea ebx, [rdi+1] pxor xmm1, xmm1 cvtsi2sd xmm1, ebx movsd [rsp+18h+var_10], xmm1 movapd xmm0, xmm1 call _log2 addsd xmm0, [rsp+18h+var_10] call _log2 cvttsd2si eax, xmm0 add eax, ebx add rsp, 10h pop rbx retn
long long func0(int a1) { double v1; // xmm0_8 v1 = log2((double)(a1 + 1)); return (unsigned int)(a1 + 1 + (int)log2(v1 + (double)(a1 + 1))); }
func0: ENDBR64 PUSH RBX SUB RSP,0x10 LEA EBX,[RDI + 0x1] PXOR XMM1,XMM1 CVTSI2SD XMM1,EBX MOVSD qword ptr [RSP + 0x8],XMM1 MOVAPD XMM0,XMM1 CALL 0x00101060 ADDSD XMM0,qword ptr [RSP + 0x8] CALL 0x00101060 CVTTSD2SI EAX,XMM0 ADD EAX,EBX ADD RSP,0x10 POP RBX RET
int func0(int param_1) { double dVar1; double __x; __x = (double)(param_1 + 1); dVar1 = log2(__x); dVar1 = log2(dVar1 + __x); return (int)dVar1 + param_1 + 1; }
6,954
func0
#include <stdio.h> #include <math.h> #include <assert.h>
int func0(int n) { n = n + 1; return n + (int)(log2(n + log2(n))); }
int main() { assert(func0(7) == 11); assert(func0(4) == 7); assert(func0(9) == 13); return 0; }
O2
c
func0: endbr64 push %rbx pxor %xmm1,%xmm1 lea 0x1(%rdi),%ebx cvtsi2sd %ebx,%xmm1 sub $0x10,%rsp movapd %xmm1,%xmm0 movsd %xmm1,0x8(%rsp) callq 1060 <log2@plt> movsd 0x8(%rsp),%xmm1 addsd %xmm1,%xmm0 callq 1060 <log2@plt> add $0x10,%rsp cvttsd2si %xmm0,%eax add %ebx,%eax pop %rbx retq xchg %ax,%ax
func0: endbr64 push rbx pxor xmm1, xmm1 lea ebx, [rdi+1] cvtsi2sd xmm1, ebx sub rsp, 10h movapd xmm0, xmm1 movsd [rsp+18h+var_10], xmm1 call _log2 movsd xmm1, [rsp+18h+var_10] addsd xmm0, xmm1 call _log2 add rsp, 10h cvttsd2si eax, xmm0 add eax, ebx pop rbx retn
long long func0(int a1) { double v1; // xmm0_8 v1 = log2((double)(a1 + 1)); return (unsigned int)(a1 + 1 + (int)log2(v1 + (double)(a1 + 1))); }
func0: ENDBR64 PUSH RBX PXOR XMM1,XMM1 LEA EBX,[RDI + 0x1] CVTSI2SD XMM1,EBX SUB RSP,0x10 MOVAPD XMM0,XMM1 MOVSD qword ptr [RSP + 0x8],XMM1 CALL 0x00101060 MOVSD XMM1,qword ptr [RSP + 0x8] ADDSD XMM0,XMM1 CALL 0x00101060 ADD RSP,0x10 CVTTSD2SI EAX,XMM0 ADD EAX,EBX POP RBX RET
int func0(int param_1) { double dVar1; double __x; __x = (double)(param_1 + 1); dVar1 = log2(__x); dVar1 = log2(dVar1 + __x); return (int)dVar1 + param_1 + 1; }
6,955
func0
#include <stdio.h> #include <math.h> #include <assert.h>
int func0(int n) { n = n + 1; return n + (int)(log2(n + log2(n))); }
int main() { assert(func0(7) == 11); assert(func0(4) == 7); assert(func0(9) == 13); return 0; }
O3
c
func0: endbr64 push %rbx pxor %xmm1,%xmm1 lea 0x1(%rdi),%ebx cvtsi2sd %ebx,%xmm1 sub $0x10,%rsp movapd %xmm1,%xmm0 movsd %xmm1,0x8(%rsp) callq 1060 <log2@plt> movsd 0x8(%rsp),%xmm1 addsd %xmm1,%xmm0 callq 1060 <log2@plt> add $0x10,%rsp cvttsd2si %xmm0,%eax add %ebx,%eax pop %rbx retq xchg %ax,%ax
func0: endbr64 push rbx pxor xmm1, xmm1 lea ebx, [rdi+1] cvtsi2sd xmm1, ebx sub rsp, 10h movapd xmm0, xmm1; x movsd [rsp+18h+var_10], xmm1 call _log2 movsd xmm1, [rsp+18h+var_10] addsd xmm0, xmm1; x call _log2 add rsp, 10h cvttsd2si eax, xmm0 add eax, ebx pop rbx retn
long long func0(int a1) { double v1; // xmm0_8 v1 = log2((double)(a1 + 1)); return (unsigned int)(a1 + 1 + (int)log2(v1 + (double)(a1 + 1))); }
func0: ENDBR64 PUSH RBX PXOR XMM1,XMM1 LEA EBX,[RDI + 0x1] CVTSI2SD XMM1,EBX SUB RSP,0x10 MOVAPD XMM0,XMM1 MOVSD qword ptr [RSP + 0x8],XMM1 CALL 0x00101060 MOVSD XMM1,qword ptr [RSP + 0x8] ADDSD XMM0,XMM1 CALL 0x00101060 ADD RSP,0x10 CVTTSD2SI EAX,XMM0 ADD EAX,EBX POP RBX RET
int func0(int param_1) { double dVar1; double __x; __x = (double)(param_1 + 1); dVar1 = log2(__x); dVar1 = log2(dVar1 + __x); return (int)dVar1 + param_1 + 1; }
6,956
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Pair;
Pair* func0(int* arr, int size, int* out_size) { *out_size = size - 1; Pair* pairs = (Pair*)malloc(sizeof(Pair) * (*out_size)); for (int i = 0; i < *out_size; i++) { pairs[i].first = arr[i]; pairs[i].second = arr[i + 1]; } return pairs; }
int main() { int out_size; int arr1[] = {1, 1, 2, 3, 3, 4, 4, 5}; Pair* result1 = func0(arr1, sizeof(arr1) / sizeof(arr1[0]), &out_size); Pair expected1[] = {{1, 1}, {1, 2}, {2, 3}, {3, 3}, {3, 4}, {4, 4}, {4, 5}}; for (int i = 0; i < out_size; i++) { assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second); } free(result1); int arr2[] = {1, 5, 7, 9, 10}; Pair* result2 = func0(arr2, sizeof(arr2) / sizeof(arr2[0]), &out_size); Pair expected2[] = {{1, 5}, {5, 7}, {7, 9}, {9, 10}}; for (int i = 0; i < out_size; i++) { assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second); } free(result2); int arr3[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Pair* result3 = func0(arr3, sizeof(arr3) / sizeof(arr3[0]), &out_size); Pair expected3[] = {{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}, {9, 10}}; for (int i = 0; i < out_size; i++) { assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second); } free(result3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %rdx,-0x28(%rbp) mov -0x1c(%rbp),%eax lea -0x1(%rax),%edx mov -0x28(%rbp),%rax mov %edx,(%rax) mov -0x28(%rbp),%rax mov (%rax),%eax cltq shl $0x3,%rax mov %rax,%rdi callq 10b0 <malloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0xc(%rbp) jmp 1250 <func0+0xa7> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0xc(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,8),%rcx mov -0x8(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) mov -0xc(%rbp),%eax cltq add $0x1,%rax lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0xc(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,8),%rcx mov -0x8(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,0x4(%rdx) addl $0x1,-0xc(%rbp) mov -0x28(%rbp),%rax mov (%rax),%eax cmp %eax,-0xc(%rbp) jl 11ed <func0+0x44> mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_28], rdx mov eax, [rbp+var_1C] lea edx, [rax-1] mov rax, [rbp+var_28] mov [rax], edx mov rax, [rbp+var_28] mov eax, [rax] cdqe shl rax, 3 mov rdi, rax; size call _malloc mov [rbp+var_8], rax mov [rbp+var_C], 0 jmp short loc_1250 loc_11ED: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rbp+var_C] movsxd rdx, edx lea rcx, ds:0[rdx*8] mov rdx, [rbp+var_8] add rdx, rcx mov eax, [rax] mov [rdx], eax mov eax, [rbp+var_C] cdqe add rax, 1 lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rbp+var_C] movsxd rdx, edx lea rcx, ds:0[rdx*8] mov rdx, [rbp+var_8] add rdx, rcx mov eax, [rax] mov [rdx+4], eax add [rbp+var_C], 1 loc_1250: mov rax, [rbp+var_28] mov eax, [rax] cmp [rbp+var_C], eax jl short loc_11ED mov rax, [rbp+var_8] leave retn
_DWORD * func0(long long a1, int a2, int *a3) { int i; // [rsp+24h] [rbp-Ch] _DWORD *v6; // [rsp+28h] [rbp-8h] *a3 = a2 - 1; v6 = malloc(8LL * *a3); for ( i = 0; i < *a3; ++i ) { v6[2 * i] = *(_DWORD *)(4LL * i + a1); v6[2 * i + 1] = *(_DWORD *)(4 * (i + 1LL) + a1); } return v6; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV qword ptr [RBP + -0x28],RDX MOV EAX,dword ptr [RBP + -0x1c] LEA EDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x28] MOV dword ptr [RAX],EDX MOV RAX,qword ptr [RBP + -0x28] MOV EAX,dword ptr [RAX] CDQE SHL RAX,0x3 MOV RDI,RAX CALL 0x001010b0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0xc],0x0 JMP 0x00101250 LAB_001011ed: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX LEA RCX,[RDX*0x8] MOV RDX,qword ptr [RBP + -0x8] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX MOV EAX,dword ptr [RBP + -0xc] CDQE ADD RAX,0x1 LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX LEA RCX,[RDX*0x8] MOV RDX,qword ptr [RBP + -0x8] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX + 0x4],EAX ADD dword ptr [RBP + -0xc],0x1 LAB_00101250: MOV RAX,qword ptr [RBP + -0x28] MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0xc],EAX JL 0x001011ed MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1,int param_2,int *param_3) { void *pvVar1; int local_14; *param_3 = param_2 + -1; pvVar1 = malloc((long)*param_3 << 3); for (local_14 = 0; local_14 < *param_3; local_14 = local_14 + 1) { *(int4 *)((long)pvVar1 + (long)local_14 * 8) = *(int4 *)(param_1 + (long)local_14 * 4); *(int4 *)((long)pvVar1 + (long)local_14 * 8 + 4) = *(int4 *)(param_1 + ((long)local_14 + 1) * 4); } return pvVar1; }
6,957
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Pair;
Pair* func0(int* arr, int size, int* out_size) { *out_size = size - 1; Pair* pairs = (Pair*)malloc(sizeof(Pair) * (*out_size)); for (int i = 0; i < *out_size; i++) { pairs[i].first = arr[i]; pairs[i].second = arr[i + 1]; } return pairs; }
int main() { int out_size; int arr1[] = {1, 1, 2, 3, 3, 4, 4, 5}; Pair* result1 = func0(arr1, sizeof(arr1) / sizeof(arr1[0]), &out_size); Pair expected1[] = {{1, 1}, {1, 2}, {2, 3}, {3, 3}, {3, 4}, {4, 4}, {4, 5}}; for (int i = 0; i < out_size; i++) { assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second); } free(result1); int arr2[] = {1, 5, 7, 9, 10}; Pair* result2 = func0(arr2, sizeof(arr2) / sizeof(arr2[0]), &out_size); Pair expected2[] = {{1, 5}, {5, 7}, {7, 9}, {9, 10}}; for (int i = 0; i < out_size; i++) { assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second); } free(result2); int arr3[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Pair* result3 = func0(arr3, sizeof(arr3) / sizeof(arr3[0]), &out_size); Pair expected3[] = {{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}, {9, 10}}; for (int i = 0; i < out_size; i++) { assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second); } free(result3); return 0; }
O1
c
func0: endbr64 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbx mov %rdx,%rbp sub $0x1,%esi mov %esi,(%rdx) movslq %esi,%rsi lea 0x0(,%rsi,8),%rdi callq 10b0 <malloc@plt> mov 0x0(%rbp),%edx test %edx,%edx jle 11f7 <func0+0x4e> lea -0x1(%rdx),%esi mov $0x0,%edx mov (%rbx,%rdx,4),%ecx mov %ecx,(%rax,%rdx,8) mov 0x4(%rbx,%rdx,4),%ecx mov %ecx,0x4(%rax,%rdx,8) mov %rdx,%rcx add $0x1,%rdx cmp %rsi,%rcx jne 11dd <func0+0x34> add $0x8,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp push rbx sub rsp, 8 mov rbx, rdi mov rbp, rdx sub esi, 1 mov [rdx], esi movsxd rsi, esi lea rdi, ds:0[rsi*8] call _malloc mov esi, [rbp+0] test esi, esi jle short loc_11F3 mov esi, esi mov edx, 0 loc_11DC: mov ecx, [rbx+rdx*4] mov [rax+rdx*8], ecx mov ecx, [rbx+rdx*4+4] mov [rax+rdx*8+4], ecx add rdx, 1 cmp rdx, rsi jnz short loc_11DC loc_11F3: add rsp, 8 pop rbx pop rbp retn
long long func0(long long a1, int a2, int *a3) { int v4; // esi long long result; // rax int v6; // esi long long v7; // rdx v4 = a2 - 1; *a3 = v4; result = malloc(8LL * v4); v6 = *a3; if ( *a3 > 0 ) { v7 = 0LL; do { *(_DWORD *)(result + 8 * v7) = *(_DWORD *)(a1 + 4 * v7); *(_DWORD *)(result + 8 * v7 + 4) = *(_DWORD *)(a1 + 4 * v7 + 4); ++v7; } while ( v7 != v6 ); } return result; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBX,RDI MOV RBP,RDX SUB ESI,0x1 MOV dword ptr [RDX],ESI MOVSXD RSI,ESI LEA RDI,[RSI*0x8] CALL 0x001010b0 MOV ESI,dword ptr [RBP] TEST ESI,ESI JLE 0x001011f3 MOV ESI,ESI MOV EDX,0x0 LAB_001011dc: MOV ECX,dword ptr [RBX + RDX*0x4] MOV dword ptr [RAX + RDX*0x8],ECX MOV ECX,dword ptr [RBX + RDX*0x4 + 0x4] MOV dword ptr [RAX + RDX*0x8 + 0x4],ECX ADD RDX,0x1 CMP RDX,RSI JNZ 0x001011dc LAB_001011f3: ADD RSP,0x8 POP RBX POP RBP RET
void func0(long param_1,int param_2,uint *param_3) { uint uVar1; void *pvVar2; ulong uVar3; *param_3 = param_2 - 1U; pvVar2 = malloc((long)(int)(param_2 - 1U) * 8); uVar1 = *param_3; if (0 < (int)uVar1) { uVar3 = 0; do { *(int4 *)((long)pvVar2 + uVar3 * 8) = *(int4 *)(param_1 + uVar3 * 4); *(int4 *)((long)pvVar2 + uVar3 * 8 + 4) = *(int4 *)(param_1 + 4 + uVar3 * 4); uVar3 = uVar3 + 1; } while (uVar3 != uVar1); } return; }
6,958
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Pair;
Pair* func0(int* arr, int size, int* out_size) { *out_size = size - 1; Pair* pairs = (Pair*)malloc(sizeof(Pair) * (*out_size)); for (int i = 0; i < *out_size; i++) { pairs[i].first = arr[i]; pairs[i].second = arr[i + 1]; } return pairs; }
int main() { int out_size; int arr1[] = {1, 1, 2, 3, 3, 4, 4, 5}; Pair* result1 = func0(arr1, sizeof(arr1) / sizeof(arr1[0]), &out_size); Pair expected1[] = {{1, 1}, {1, 2}, {2, 3}, {3, 3}, {3, 4}, {4, 4}, {4, 5}}; for (int i = 0; i < out_size; i++) { assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second); } free(result1); int arr2[] = {1, 5, 7, 9, 10}; Pair* result2 = func0(arr2, sizeof(arr2) / sizeof(arr2[0]), &out_size); Pair expected2[] = {{1, 5}, {5, 7}, {7, 9}, {9, 10}}; for (int i = 0; i < out_size; i++) { assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second); } free(result2); int arr3[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Pair* result3 = func0(arr3, sizeof(arr3) / sizeof(arr3[0]), &out_size); Pair expected3[] = {{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}, {9, 10}}; for (int i = 0; i < out_size; i++) { assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second); } free(result3); return 0; }
O2
c
func0: endbr64 push %rbp sub $0x1,%esi mov %rdx,%rbp push %rbx mov %rdi,%rbx sub $0x8,%rsp mov %esi,(%rdx) movslq %esi,%rsi lea 0x0(,%rsi,8),%rdi callq 10b0 <malloc@plt> mov 0x0(%rbp),%edx test %edx,%edx jle 1562 <func0+0x52> lea -0x1(%rdx),%esi xor %edx,%edx nopl 0x0(%rax) mov (%rbx,%rdx,4),%ecx mov %ecx,(%rax,%rdx,8) mov 0x4(%rbx,%rdx,4),%ecx mov %ecx,0x4(%rax,%rdx,8) mov %rdx,%rcx add $0x1,%rdx cmp %rcx,%rsi jne 1548 <func0+0x38> add $0x8,%rsp pop %rbx pop %rbp retq nopl 0x0(%rax)
func0: endbr64 push rbp sub esi, 1 mov rbp, rdx push rbx mov rbx, rdi sub rsp, 8 mov [rdx], esi movsxd rsi, esi lea rdi, ds:0[rsi*8] call _malloc movsxd rsi, dword ptr [rbp+0] test esi, esi jle short loc_1557 xor edx, edx nop loc_1540: mov ecx, [rbx+rdx*4] mov [rax+rdx*8], ecx mov ecx, [rbx+rdx*4+4] mov [rax+rdx*8+4], ecx add rdx, 1 cmp rsi, rdx jnz short loc_1540 loc_1557: add rsp, 8 pop rbx pop rbp retn
long long func0(long long a1, int a2, int *a3) { int v3; // esi long long result; // rax long long v6; // rsi long long i; // rdx v3 = a2 - 1; *a3 = v3; result = malloc(8LL * v3); v6 = *a3; if ( (int)v6 > 0 ) { for ( i = 0LL; i != v6; ++i ) { *(_DWORD *)(result + 8 * i) = *(_DWORD *)(a1 + 4 * i); *(_DWORD *)(result + 8 * i + 4) = *(_DWORD *)(a1 + 4 * i + 4); } } return result; }
func0: ENDBR64 PUSH RBP SUB ESI,0x1 MOV RBP,RDX PUSH RBX MOV RBX,RDI SUB RSP,0x8 MOV dword ptr [RDX],ESI MOVSXD RSI,ESI LEA RDI,[RSI*0x8] CALL 0x001010b0 MOVSXD RSI,dword ptr [RBP] TEST ESI,ESI JLE 0x00101557 XOR EDX,EDX NOP LAB_00101540: MOV ECX,dword ptr [RBX + RDX*0x4] MOV dword ptr [RAX + RDX*0x8],ECX MOV ECX,dword ptr [RBX + RDX*0x4 + 0x4] MOV dword ptr [RAX + RDX*0x8 + 0x4],ECX ADD RDX,0x1 CMP RSI,RDX JNZ 0x00101540 LAB_00101557: ADD RSP,0x8 POP RBX POP RBP RET
void func0(long param_1,int param_2,int *param_3) { int iVar1; void *pvVar2; long lVar3; *param_3 = param_2 + -1; pvVar2 = malloc((long)(param_2 + -1) * 8); iVar1 = *param_3; if (0 < iVar1) { lVar3 = 0; do { *(int4 *)((long)pvVar2 + lVar3 * 8) = *(int4 *)(param_1 + lVar3 * 4); *(int4 *)((long)pvVar2 + lVar3 * 8 + 4) = *(int4 *)(param_1 + 4 + lVar3 * 4); lVar3 = lVar3 + 1; } while (iVar1 != lVar3); } return; }
6,959
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Pair;
Pair* func0(int* arr, int size, int* out_size) { *out_size = size - 1; Pair* pairs = (Pair*)malloc(sizeof(Pair) * (*out_size)); for (int i = 0; i < *out_size; i++) { pairs[i].first = arr[i]; pairs[i].second = arr[i + 1]; } return pairs; }
int main() { int out_size; int arr1[] = {1, 1, 2, 3, 3, 4, 4, 5}; Pair* result1 = func0(arr1, sizeof(arr1) / sizeof(arr1[0]), &out_size); Pair expected1[] = {{1, 1}, {1, 2}, {2, 3}, {3, 3}, {3, 4}, {4, 4}, {4, 5}}; for (int i = 0; i < out_size; i++) { assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second); } free(result1); int arr2[] = {1, 5, 7, 9, 10}; Pair* result2 = func0(arr2, sizeof(arr2) / sizeof(arr2[0]), &out_size); Pair expected2[] = {{1, 5}, {5, 7}, {7, 9}, {9, 10}}; for (int i = 0; i < out_size; i++) { assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second); } free(result2); int arr3[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Pair* result3 = func0(arr3, sizeof(arr3) / sizeof(arr3[0]), &out_size); Pair expected3[] = {{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}, {9, 10}}; for (int i = 0; i < out_size; i++) { assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second); } free(result3); return 0; }
O3
c
func0: endbr64 push %rbp sub $0x1,%esi mov %rdx,%rbp push %rbx mov %rdi,%rbx sub $0x8,%rsp mov %esi,(%rdx) movslq %esi,%rsi lea 0x0(,%rsi,8),%rdi callq 10b0 <malloc@plt> mov 0x0(%rbp),%esi test %esi,%esi jle 174a <func0+0xca> lea -0x1(%rsi),%edx cmp $0x2,%edx jbe 1751 <func0+0xd1> mov %esi,%ecx xor %edx,%edx shr $0x2,%ecx shl $0x4,%rcx nopw 0x0(%rax,%rax,1) movdqu (%rbx,%rdx,1),%xmm0 movdqu 0x4(%rbx,%rdx,1),%xmm2 movdqa %xmm0,%xmm1 punpckhdq %xmm2,%xmm0 punpckldq %xmm2,%xmm1 movups %xmm0,0x10(%rax,%rdx,2) movups %xmm1,(%rax,%rdx,2) add $0x10,%rdx cmp %rdx,%rcx jne 16d0 <func0+0x50> mov %esi,%edx and $0xfffffffc,%edx test $0x3,%sil je 174a <func0+0xca> movslq %edx,%rcx mov (%rbx,%rcx,4),%r8d lea (%rax,%rcx,8),%rdi mov %r8d,(%rdi) mov 0x4(%rbx,%rcx,4),%r8d lea 0x1(%rdx),%ecx mov %r8d,0x4(%rdi) cmp %ecx,%esi jle 174a <func0+0xca> movslq %ecx,%rcx add $0x2,%edx lea (%rax,%rcx,8),%rdi mov 0x4(%rbx,%rcx,4),%ecx mov %r8d,(%rdi) mov %ecx,0x4(%rdi) cmp %edx,%esi jle 174a <func0+0xca> movslq %edx,%rdx lea (%rax,%rdx,8),%rsi mov 0x4(%rbx,%rdx,4),%edx mov %ecx,(%rsi) mov %edx,0x4(%rsi) add $0x8,%rsp pop %rbx pop %rbp retq xor %edx,%edx jmp 1704 <func0+0x84> nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push rbp sub esi, 1 mov rbp, rdx push rbx mov rbx, rdi sub rsp, 8 mov [rdx], esi movsxd rsi, esi lea rdi, ds:0[rsi*8]; size call _malloc mov edx, [rbp+0] mov rcx, rax test edx, edx jle loc_15B8 lea eax, [rdx-1] cmp eax, 2 jbe loc_15C2 mov esi, edx xor eax, eax shr esi, 2 shl rsi, 4 nop word ptr [rax+rax+00h] loc_1540: movdqu xmm0, xmmword ptr [rbx+rax] movdqu xmm3, xmmword ptr [rbx+rax+4] movdqa xmm1, xmm0 punpckhdq xmm0, xmm3 punpckldq xmm1, xmm3 movups xmmword ptr [rcx+rax*2+10h], xmm0 movups xmmword ptr [rcx+rax*2], xmm1 add rax, 10h cmp rax, rsi jnz short loc_1540 mov eax, edx and eax, 0FFFFFFFCh mov esi, eax cmp edx, eax jz short loc_15B8 loc_1574: sub edx, esi cmp edx, 1 jz short loc_15AE movq xmm0, qword ptr [rbx+rsi*4] movq xmm1, qword ptr [rbx+rsi*4+4] lea rdi, [rcx+rsi*8] movdqa xmm2, xmm0 punpckldq xmm0, xmm1 punpckldq xmm2, xmm1 pshufd xmm0, xmm0, 4Eh ; 'N' movq qword ptr [rdi], xmm2 movq qword ptr [rdi+8], xmm0 test dl, 1 jz short loc_15B8 and edx, 0FFFFFFFEh add eax, edx loc_15AE: cdqe mov rdx, [rbx+rax*4] mov [rcx+rax*8], rdx loc_15B8: add rsp, 8 mov rax, rcx pop rbx pop rbp retn loc_15C2: xor esi, esi xor eax, eax jmp short loc_1574
_QWORD * func0(long long a1, int a2, unsigned int *a3) { unsigned int v3; // esi _QWORD *v6; // rax unsigned int v7; // edx _QWORD *v8; // rcx long long v9; // rax __m128i v10; // xmm3 __m128i v11; // xmm1 signed int v12; // eax long long v13; // rsi int v14; // edx _QWORD *v15; // rdi __m128i v16; // xmm2 v3 = a2 - 1; *a3 = v3; v6 = malloc(8LL * (int)v3); v7 = *a3; v8 = v6; if ( (int)*a3 > 0 ) { if ( v7 - 1 <= 2 ) { v13 = 0LL; v12 = 0; } else { v9 = 0LL; do { v10 = _mm_loadu_si128((const __m128i *)(a1 + v9 * 4 + 4)); v11 = _mm_loadu_si128((const __m128i *)(a1 + v9 * 4)); *(__m128i *)&v8[v9 + 2] = _mm_unpackhi_epi32(v11, v10); *(__m128i *)&v8[v9] = _mm_unpacklo_epi32(v11, v10); v9 += 4LL; } while ( v9 != 4LL * (v7 >> 2) ); v12 = v7 & 0xFFFFFFFC; v13 = v7 & 0xFFFFFFFC; if ( v7 == (v7 & 0xFFFFFFFC) ) return v8; } v14 = v7 - v13; if ( v14 == 1 ) { LABEL_9: v8[v12] = *(_QWORD *)(a1 + 4LL * v12); return v8; } v15 = &v8[v13]; v16 = _mm_unpacklo_epi32( _mm_loadl_epi64((const __m128i *)(a1 + 4 * v13)), _mm_loadl_epi64((const __m128i *)(a1 + 4 * v13 + 4))); *v15 = v16.m128i_i64[0]; v15[1] = _mm_shuffle_epi32(v16, 78).m128i_u64[0]; if ( (v14 & 1) != 0 ) { v12 += v14 & 0xFFFFFFFE; goto LABEL_9; } } return v8; }
func0: ENDBR64 PUSH RBP SUB ESI,0x1 MOV RBP,RDX PUSH RBX MOV RBX,RDI SUB RSP,0x8 MOV dword ptr [RDX],ESI MOVSXD RSI,ESI LEA RDI,[RSI*0x8] CALL 0x001010b0 MOV EDX,dword ptr [RBP] MOV RCX,RAX TEST EDX,EDX JLE 0x001015b8 LEA EAX,[RDX + -0x1] CMP EAX,0x2 JBE 0x001015c2 MOV ESI,EDX XOR EAX,EAX SHR ESI,0x2 SHL RSI,0x4 NOP word ptr [RAX + RAX*0x1] LAB_00101540: MOVDQU XMM0,xmmword ptr [RBX + RAX*0x1] MOVDQU XMM3,xmmword ptr [RBX + RAX*0x1 + 0x4] MOVDQA XMM1,XMM0 PUNPCKHDQ XMM0,XMM3 PUNPCKLDQ XMM1,XMM3 MOVUPS xmmword ptr [RCX + RAX*0x2 + 0x10],XMM0 MOVUPS xmmword ptr [RCX + RAX*0x2],XMM1 ADD RAX,0x10 CMP RAX,RSI JNZ 0x00101540 MOV EAX,EDX AND EAX,0xfffffffc MOV ESI,EAX CMP EDX,EAX JZ 0x001015b8 LAB_00101574: SUB EDX,ESI CMP EDX,0x1 JZ 0x001015ae MOVQ XMM0,qword ptr [RBX + RSI*0x4] MOVQ XMM1,qword ptr [RBX + RSI*0x4 + 0x4] LEA RDI,[RCX + RSI*0x8] MOVDQA XMM2,XMM0 PUNPCKLDQ XMM0,XMM1 PUNPCKLDQ XMM2,XMM1 PSHUFD XMM0,XMM0,0x4e MOVQ qword ptr [RDI],XMM2 MOVQ qword ptr [RDI + 0x8],XMM0 TEST DL,0x1 JZ 0x001015b8 AND EDX,0xfffffffe ADD EAX,EDX LAB_001015ae: CDQE MOV RDX,qword ptr [RBX + RAX*0x4] MOV qword ptr [RCX + RAX*0x8],RDX LAB_001015b8: ADD RSP,0x8 MOV RAX,RCX POP RBX POP RBP RET LAB_001015c2: XOR ESI,ESI XOR EAX,EAX JMP 0x00101574
void * func0(long param_1,int param_2,uint *param_3) { int4 *puVar1; int8 *puVar2; int4 *puVar3; int8 uVar4; int8 uVar5; int4 uVar6; int4 uVar7; int4 uVar8; int4 uVar9; int4 uVar10; int4 uVar11; int4 uVar12; uint uVar13; void *pvVar14; long lVar15; uint uVar16; ulong uVar17; *param_3 = param_2 - 1U; pvVar14 = malloc((long)(int)(param_2 - 1U) * 8); uVar16 = *param_3; if (0 < (int)uVar16) { if (uVar16 - 1 < 3) { uVar17 = 0; uVar13 = 0; } else { lVar15 = 0; do { puVar1 = (int4 *)(param_1 + lVar15); uVar6 = *puVar1; uVar7 = puVar1[1]; uVar8 = puVar1[3]; puVar3 = (int4 *)(param_1 + 4 + lVar15); uVar9 = *puVar3; uVar10 = puVar3[1]; uVar11 = puVar3[2]; uVar12 = puVar3[3]; puVar3 = (int4 *)((long)pvVar14 + lVar15 * 2 + 0x10); *puVar3 = puVar1[2]; puVar3[1] = uVar11; puVar3[2] = uVar8; puVar3[3] = uVar12; puVar1 = (int4 *)((long)pvVar14 + lVar15 * 2); *puVar1 = uVar6; puVar1[1] = uVar9; puVar1[2] = uVar7; puVar1[3] = uVar10; lVar15 = lVar15 + 0x10; } while (lVar15 != (ulong)(uVar16 >> 2) << 4); uVar13 = uVar16 & 0xfffffffc; uVar17 = (ulong)uVar13; if (uVar16 == uVar13) { return pvVar14; } } uVar16 = uVar16 - (int)uVar17; if (uVar16 != 1) { uVar4 = *(int8 *)(param_1 + uVar17 * 4); uVar5 = *(int8 *)(param_1 + 4 + uVar17 * 4); puVar2 = (int8 *)((long)pvVar14 + uVar17 * 8); *puVar2 = CONCAT44((int)uVar5,(int)uVar4); puVar2[1] = CONCAT44((int)((ulong)uVar5 >> 0x20),(int)((ulong)uVar4 >> 0x20)); if ((uVar16 & 1) == 0) { return pvVar14; } uVar13 = uVar13 + (uVar16 & 0xfffffffe); } *(int8 *)((long)pvVar14 + (long)(int)uVar13 * 8) = *(int8 *)(param_1 + (long)(int)uVar13 * 4); } return pvVar14; }
6,960
func0
#include <assert.h>
int func0(int arr[], int n, int sum) { int count = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (arr[i] + arr[j] == sum) { count += 1; } } } return count; }
int main() { int arr1[] = {1, 1, 1, 1}; int arr2[] = {1, 5, 7, -1, 5}; int arr3[] = {1, -2, 3}; assert(func0(arr1, 4, 2) == 6); assert(func0(arr2, 5, 6) == 3); assert(func0(arr3, 3, 1) == 1); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %edx,-0x20(%rbp) movl $0x0,-0xc(%rbp) movl $0x0,-0x8(%rbp) jmp 11dd <func0+0x74> mov -0x8(%rbp),%eax add $0x1,%eax mov %eax,-0x4(%rbp) jmp 11d1 <func0+0x68> 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 -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%eax add %edx,%eax cmp %eax,-0x20(%rbp) jne 11cd <func0+0x64> addl $0x1,-0xc(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1196 <func0+0x2d> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x1c(%rbp),%eax jl 118b <func0+0x22> mov -0xc(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_20], edx mov [rbp+var_C], 0 mov [rbp+var_8], 0 jmp short loc_11DD loc_118B: mov eax, [rbp+var_8] add eax, 1 mov [rbp+var_4], eax jmp short loc_11D1 loc_1196: 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_18] add rax, rcx mov eax, [rax] add eax, edx cmp [rbp+var_20], eax jnz short loc_11CD add [rbp+var_C], 1 loc_11CD: add [rbp+var_4], 1 loc_11D1: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1196 add [rbp+var_8], 1 loc_11DD: mov eax, [rbp+var_8] cmp eax, [rbp+var_1C] jl short loc_118B mov eax, [rbp+var_C] pop rbp retn
long long func0(long long a1, int a2, int a3) { unsigned int v4; // [rsp+14h] [rbp-Ch] int i; // [rsp+18h] [rbp-8h] int j; // [rsp+1Ch] [rbp-4h] v4 = 0; for ( i = 0; i < a2; ++i ) { for ( j = i + 1; j < a2; ++j ) { if ( a3 == *(_DWORD *)(4LL * i + a1) + *(_DWORD *)(4LL * j + a1) ) ++v4; } } return v4; }
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 + -0xc],0x0 MOV dword ptr [RBP + -0x8],0x0 JMP 0x001011dd LAB_0010118b: MOV EAX,dword ptr [RBP + -0x8] ADD EAX,0x1 MOV dword ptr [RBP + -0x4],EAX JMP 0x001011d1 LAB_00101196: 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 + -0x18] ADD RAX,RCX MOV EAX,dword ptr [RAX] ADD EAX,EDX CMP dword ptr [RBP + -0x20],EAX JNZ 0x001011cd ADD dword ptr [RBP + -0xc],0x1 LAB_001011cd: ADD dword ptr [RBP + -0x4],0x1 LAB_001011d1: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101196 ADD dword ptr [RBP + -0x8],0x1 LAB_001011dd: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x1c] JL 0x0010118b MOV EAX,dword ptr [RBP + -0xc] POP RBP RET
int func0(long param_1,int param_2,int param_3) { int4 local_14; int4 local_10; int4 local_c; local_14 = 0; for (local_10 = 0; local_c = local_10, local_10 < param_2; local_10 = local_10 + 1) { while (local_c = local_c + 1, local_c < param_2) { if (param_3 == *(int *)(param_1 + (long)local_c * 4) + *(int *)(param_1 + (long)local_10 * 4)) { local_14 = local_14 + 1; } } } return local_14; }
6,961
func0
#include <assert.h>
int func0(int arr[], int n, int sum) { int count = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (arr[i] + arr[j] == sum) { count += 1; } } } return count; }
int main() { int arr1[] = {1, 1, 1, 1}; int arr2[] = {1, 5, 7, -1, 5}; int arr3[] = {1, -2, 3}; assert(func0(arr1, 4, 2) == 6); assert(func0(arr2, 5, 6) == 3); assert(func0(arr3, 3, 1) == 1); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 11b4 <func0+0x4b> lea -0x1(%rsi),%r11d add $0x1,%r11 mov $0x1,%r10d mov $0x0,%ecx cmp %r11,%r10 je 11b9 <func0+0x50> mov -0x4(%rdi,%r10,4),%r9d mov %r10,%rax mov %r9d,%r8d add (%rdi,%rax,4),%r8d cmp %edx,%r8d sete %r8b movzbl %r8b,%r8d add %r8d,%ecx add $0x1,%rax cmp %eax,%esi jg 1191 <func0+0x28> add $0x1,%r10 jmp 1184 <func0+0x1b> mov $0x0,%ecx mov %ecx,%eax retq
func0: endbr64 test esi, esi jle short loc_11AF mov r11d, esi mov r10d, 1 mov ecx, 0 loc_117F: cmp r10, r11 jz short loc_11B4 mov r9d, [rdi+r10*4-4] mov rax, r10 loc_118C: mov r8d, r9d add r8d, [rdi+rax*4] cmp r8d, edx setz r8b movzx r8d, r8b add ecx, r8d add rax, 1 cmp esi, eax jg short loc_118C add r10, 1 jmp short loc_117F loc_11AF: mov ecx, 0 loc_11B4: mov eax, ecx retn
long long func0(long long a1, int a2, int a3) { long long v3; // r10 unsigned int v4; // ecx long long v5; // rax if ( a2 <= 0 ) { return 0; } else { v3 = 1LL; v4 = 0; while ( v3 != a2 ) { v5 = v3; do v4 += *(_DWORD *)(a1 + 4 * v5++) + *(_DWORD *)(a1 + 4 * v3 - 4) == a3; while ( a2 > (int)v5 ); ++v3; } } return v4; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001011af MOV R11D,ESI MOV R10D,0x1 MOV ECX,0x0 LAB_0010117f: CMP R10,R11 JZ 0x001011b4 MOV R9D,dword ptr [RDI + R10*0x4 + -0x4] MOV RAX,R10 LAB_0010118c: MOV R8D,R9D ADD R8D,dword ptr [RDI + RAX*0x4] CMP R8D,EDX SETZ R8B MOVZX R8D,R8B ADD ECX,R8D ADD RAX,0x1 CMP ESI,EAX JG 0x0010118c ADD R10,0x1 JMP 0x0010117f LAB_001011af: MOV ECX,0x0 LAB_001011b4: MOV EAX,ECX RET
int func0(long param_1,uint param_2,int param_3) { ulong uVar1; int iVar2; ulong uVar3; if ((int)param_2 < 1) { iVar2 = 0; } else { iVar2 = 0; for (uVar3 = 1; uVar3 != param_2; uVar3 = uVar3 + 1) { uVar1 = uVar3; do { iVar2 = iVar2 + (uint)(*(int *)(param_1 + -4 + uVar3 * 4) + *(int *)(param_1 + uVar1 * 4) == param_3); uVar1 = uVar1 + 1; } while ((int)uVar1 < (int)param_2); } } return iVar2; }
6,962
func0
#include <assert.h>
int func0(int arr[], int n, int sum) { int count = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (arr[i] + arr[j] == sum) { count += 1; } } } return count; }
int main() { int arr1[] = {1, 1, 1, 1}; int arr2[] = {1, 5, 7, -1, 5}; int arr3[] = {1, -2, 3}; assert(func0(arr1, 4, 2) == 6); assert(func0(arr2, 5, 6) == 3); assert(func0(arr3, 3, 1) == 1); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 13a6 <func0+0x56> lea -0x1(%rsi),%r11d mov $0x1,%r10d xor %r8d,%r8d add $0x1,%r11 cmp %r11,%r10 je 13a2 <func0+0x52> xchg %ax,%ax mov -0x4(%rdi,%r10,4),%r9d mov %r10,%rax nopl 0x0(%rax,%rax,1) mov (%rdi,%rax,4),%ecx add %r9d,%ecx cmp %edx,%ecx sete %cl add $0x1,%rax movzbl %cl,%ecx add %ecx,%r8d cmp %eax,%esi jg 1380 <func0+0x30> add $0x1,%r10 cmp %r11,%r10 jne 1370 <func0+0x20> mov %r8d,%eax retq xor %r8d,%r8d mov %r8d,%eax retq nopl (%rax)
func0: endbr64 test esi, esi jle short loc_12F6 movsxd r11, esi mov r10d, 1 xor r8d, r8d cmp r10, r11 jz short loc_12F2 nop dword ptr [rax+00000000h] loc_12C0: mov r9d, [rdi+r10*4-4] mov rax, r10 nop dword ptr [rax+rax+00000000h] loc_12D0: mov ecx, [rdi+rax*4] add ecx, r9d cmp ecx, edx setz cl add rax, 1 movzx ecx, cl add r8d, ecx cmp esi, eax jg short loc_12D0 add r10, 1 cmp r10, r11 jnz short loc_12C0 loc_12F2: mov eax, r8d retn loc_12F6: xor r8d, r8d mov eax, r8d retn
long long func0(long long a1, int a2, int a3) { long long v3; // r10 unsigned int i; // r8d long long v5; // rax bool v6; // cl if ( a2 <= 0 ) return 0LL; v3 = 1LL; for ( i = 0; v3 != a2; ++v3 ) { v5 = v3; do { v6 = *(_DWORD *)(a1 + 4 * v3 - 4) + *(_DWORD *)(a1 + 4 * v5++) == a3; i += v6; } while ( a2 > (int)v5 ); } return i; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001012f6 MOVSXD R11,ESI MOV R10D,0x1 XOR R8D,R8D CMP R10,R11 JZ 0x001012f2 NOP dword ptr [RAX] LAB_001012c0: MOV R9D,dword ptr [RDI + R10*0x4 + -0x4] MOV RAX,R10 NOP dword ptr [RAX + RAX*0x1] LAB_001012d0: MOV ECX,dword ptr [RDI + RAX*0x4] ADD ECX,R9D CMP ECX,EDX SETZ CL ADD RAX,0x1 MOVZX ECX,CL ADD R8D,ECX CMP ESI,EAX JG 0x001012d0 ADD R10,0x1 CMP R10,R11 JNZ 0x001012c0 LAB_001012f2: MOV EAX,R8D RET LAB_001012f6: XOR R8D,R8D MOV EAX,R8D RET
int func0(long param_1,int param_2,int param_3) { long lVar1; long lVar2; int iVar3; long lVar4; if (0 < param_2) { lVar4 = 1; iVar3 = 0; if ((long)param_2 != 1) { do { lVar2 = lVar4; do { lVar1 = lVar2 * 4; lVar2 = lVar2 + 1; iVar3 = iVar3 + (uint)(*(int *)(param_1 + lVar1) + *(int *)(param_1 + -4 + lVar4 * 4) == param_3); } while ((int)lVar2 < param_2); lVar4 = lVar4 + 1; } while (lVar4 != param_2); } return iVar3; } return 0; }
6,963
func0
#include <assert.h>
int func0(int arr[], int n, int sum) { int count = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (arr[i] + arr[j] == sum) { count += 1; } } } return count; }
int main() { int arr1[] = {1, 1, 1, 1}; int arr2[] = {1, 5, 7, -1, 5}; int arr3[] = {1, -2, 3}; assert(func0(arr1, 4, 2) == 6); assert(func0(arr2, 5, 6) == 3); assert(func0(arr3, 3, 1) == 1); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 14b1 <func0+0x171> cmp $0x1,%esi je 14b1 <func0+0x171> push %r14 xor %r9d,%r9d mov $0x1,%r8d push %r12 lea -0x1(%rsi),%r12d push %rbp mov $0x1,%ebp push %rbx mov %rdi,%rbx mov %edx,%edi movd %edi,%xmm5 lea 0x4(%rbx),%rdx pshufd $0x0,%xmm5,%xmm3 mov %esi,%r10d mov %r12d,%eax mov -0x4(%rdx),%r11d sub %r8d,%r10d cmp %r8d,%esi cmovle %ebp,%r10d sub %r8d,%eax cmp $0x3,%eax jbe 14a9 <func0+0x169> cmp %r8d,%esi jle 14a9 <func0+0x169> mov %r10d,%ecx movd %r11d,%xmm4 pxor %xmm1,%xmm1 mov %rdx,%rax shr $0x2,%ecx pshufd $0x0,%xmm4,%xmm2 shl $0x4,%rcx add %rdx,%rcx nopw 0x0(%rax,%rax,1) movdqu (%rax),%xmm0 add $0x10,%rax paddd %xmm2,%xmm0 pcmpeqd %xmm3,%xmm0 psubd %xmm0,%xmm1 cmp %rax,%rcx jne 13d0 <func0+0x90> movdqa %xmm1,%xmm0 mov %r10d,%ecx psrldq $0x8,%xmm0 and $0xfffffffc,%ecx paddd %xmm0,%xmm1 movdqa %xmm1,%xmm0 psrldq $0x4,%xmm0 paddd %xmm0,%xmm1 movd %xmm1,%eax add %eax,%r9d lea (%rcx,%r8,1),%eax cmp %ecx,%r10d je 148e <func0+0x14e> movslq %eax,%r10 mov (%rbx,%r10,4),%r14d lea 0x0(,%r10,4),%rcx add %r11d,%r14d cmp %r14d,%edi sete %r10b movzbl %r10b,%r10d add %r10d,%r9d lea 0x1(%rax),%r10d cmp %r10d,%esi jle 148e <func0+0x14e> mov 0x4(%rbx,%rcx,1),%r10d add %r11d,%r10d cmp %r10d,%edi sete %r10b movzbl %r10b,%r10d add %r10d,%r9d lea 0x2(%rax),%r10d cmp %r10d,%esi jle 148e <func0+0x14e> mov 0x8(%rbx,%rcx,1),%r10d add %r11d,%r10d cmp %r10d,%edi sete %r10b add $0x3,%eax movzbl %r10b,%r10d add %r10d,%r9d cmp %eax,%esi jle 148e <func0+0x14e> add 0xc(%rbx,%rcx,1),%r11d xor %eax,%eax cmp %r11d,%edi sete %al add %eax,%r9d add $0x1,%r8d add $0x4,%rdx cmp %r8d,%esi jne 1380 <func0+0x40> pop %rbx mov %r9d,%eax pop %rbp pop %r12 pop %r14 retq mov %r8d,%eax jmpq 1419 <func0+0xd9> xor %r9d,%r9d mov %r9d,%eax retq nopl 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle loc_1280 push r14 push r12 push rbp push rbx mov rbx, rdi mov edi, esi xor esi, esi cmp edi, 1 jz loc_1273 movd xmm5, edx mov r11d, edx lea r10, [rbx+4] xor esi, esi mov ecx, 1 lea r12d, [rdi-1] mov ebp, 1 pshufd xmm3, xmm5, 0 nop word ptr [rax+rax+00h] loc_1188: mov r8d, edi mov eax, r12d mov r9d, [r10-4] sub r8d, ecx cmp edi, ecx cmovle r8d, ebp sub eax, ecx cmp eax, 2 jbe loc_127C cmp edi, ecx jle loc_127C mov edx, r8d movd xmm4, r9d pxor xmm1, xmm1 mov rax, r10 shr edx, 2 pshufd xmm2, xmm4, 0 shl rdx, 4 add rdx, r10 nop dword ptr [rax+00h] loc_11D0: movdqu xmm0, xmmword ptr [rax] add rax, 10h paddd xmm0, xmm2 pcmpeqd xmm0, xmm3 psubd xmm1, xmm0 cmp rax, rdx jnz short loc_11D0 movdqa xmm0, xmm1 psrldq xmm0, 8 paddd xmm1, xmm0 movdqa xmm0, xmm1 psrldq xmm0, 4 paddd xmm1, xmm0 movd eax, xmm1 add esi, eax mov eax, r8d and eax, 0FFFFFFFCh add eax, ecx and r8d, 3 jz short loc_1264 loc_1217: movsxd rdx, eax mov r14d, [rbx+rdx*4] lea r8, ds:0[rdx*4] add r14d, r9d cmp r11d, r14d setz dl movzx edx, dl add esi, edx lea edx, [rax+1] cmp edi, edx jle short loc_1264 mov edx, [rbx+r8+4] add edx, r9d cmp r11d, edx setz dl add eax, 2 movzx edx, dl add esi, edx cmp edi, eax jle short loc_1264 add r9d, [rbx+r8+8] xor eax, eax cmp r11d, r9d setz al add esi, eax loc_1264: add ecx, 1 add r10, 4 cmp edi, ecx jnz loc_1188 loc_1273: pop rbx mov eax, esi pop rbp pop r12 pop r14 retn loc_127C: mov eax, ecx jmp short loc_1217 loc_1280: xor eax, eax retn
long long func0(long long a1, int a2, unsigned int a3) { unsigned int v5; // esi const __m128i *v6; // r10 int v7; // ecx __m128i v8; // xmm3 unsigned int v9; // r9d unsigned int v10; // r8d __m128i v11; // xmm1 const __m128i *v12; // rax __m128i v13; // xmm2 __m128i v14; // xmm0 __m128i v15; // xmm1 int v16; // eax long long v17; // r8 if ( a2 <= 0 ) return 0LL; v5 = 0; if ( a2 != 1 ) { v6 = (const __m128i *)(a1 + 4); v5 = 0; v7 = 1; v8 = _mm_shuffle_epi32(_mm_cvtsi32_si128(a3), 0); while ( 1 ) { v9 = v6[-1].m128i_u32[3]; v10 = a2 - v7; if ( a2 <= v7 ) v10 = 1; if ( (unsigned int)(a2 - 1 - v7) <= 2 || a2 <= v7 ) break; v11 = 0LL; v12 = v6; v13 = _mm_shuffle_epi32(_mm_cvtsi32_si128(v9), 0); do { v14 = _mm_loadu_si128(v12++); v11 = _mm_sub_epi32(v11, _mm_cmpeq_epi32(_mm_add_epi32(v14, v13), v8)); } while ( v12 != &v6[v10 >> 2] ); v15 = _mm_add_epi32(v11, _mm_srli_si128(v11, 8)); v5 += _mm_cvtsi128_si32(_mm_add_epi32(v15, _mm_srli_si128(v15, 4))); v16 = v7 + (v10 & 0xFFFFFFFC); if ( (v10 & 3) != 0 ) goto LABEL_11; LABEL_14: ++v7; v6 = (const __m128i *)((char *)v6 + 4); if ( a2 == v7 ) return v5; } v16 = v7; LABEL_11: v17 = 4LL * v16; v5 += a3 == v9 + *(_DWORD *)(a1 + v17); if ( a2 > v16 + 1 ) { v5 += a3 == v9 + *(_DWORD *)(a1 + v17 + 4); if ( a2 > v16 + 2 ) v5 += a3 == *(_DWORD *)(a1 + v17 + 8) + v9; } goto LABEL_14; } return v5; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101280 PUSH R14 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RDI MOV EDI,ESI XOR ESI,ESI CMP EDI,0x1 JZ 0x00101273 MOVD XMM5,EDX MOV R11D,EDX LEA R10,[RBX + 0x4] XOR ESI,ESI MOV ECX,0x1 LEA R12D,[RDI + -0x1] MOV EBP,0x1 PSHUFD XMM3,XMM5,0x0 NOP word ptr [RAX + RAX*0x1] LAB_00101188: MOV R8D,EDI MOV EAX,R12D MOV R9D,dword ptr [R10 + -0x4] SUB R8D,ECX CMP EDI,ECX CMOVLE R8D,EBP SUB EAX,ECX CMP EAX,0x2 JBE 0x0010127c CMP EDI,ECX JLE 0x0010127c MOV EDX,R8D MOVD XMM4,R9D PXOR XMM1,XMM1 MOV RAX,R10 SHR EDX,0x2 PSHUFD XMM2,XMM4,0x0 SHL RDX,0x4 ADD RDX,R10 NOP dword ptr [RAX] LAB_001011d0: MOVDQU XMM0,xmmword ptr [RAX] ADD RAX,0x10 PADDD XMM0,XMM2 PCMPEQD XMM0,XMM3 PSUBD XMM1,XMM0 CMP RAX,RDX JNZ 0x001011d0 MOVDQA XMM0,XMM1 PSRLDQ XMM0,0x8 PADDD XMM1,XMM0 MOVDQA XMM0,XMM1 PSRLDQ XMM0,0x4 PADDD XMM1,XMM0 MOVD EAX,XMM1 ADD ESI,EAX MOV EAX,R8D AND EAX,0xfffffffc ADD EAX,ECX AND R8D,0x3 JZ 0x00101264 LAB_00101217: MOVSXD RDX,EAX MOV R14D,dword ptr [RBX + RDX*0x4] LEA R8,[RDX*0x4] ADD R14D,R9D CMP R11D,R14D SETZ DL MOVZX EDX,DL ADD ESI,EDX LEA EDX,[RAX + 0x1] CMP EDI,EDX JLE 0x00101264 MOV EDX,dword ptr [RBX + R8*0x1 + 0x4] ADD EDX,R9D CMP R11D,EDX SETZ DL ADD EAX,0x2 MOVZX EDX,DL ADD ESI,EDX CMP EDI,EAX JLE 0x00101264 ADD R9D,dword ptr [RBX + R8*0x1 + 0x8] XOR EAX,EAX CMP R11D,R9D SETZ AL ADD ESI,EAX LAB_00101264: ADD ECX,0x1 ADD R10,0x4 CMP EDI,ECX JNZ 0x00101188 LAB_00101273: POP RBX MOV EAX,ESI POP RBP POP R12 POP R14 RET LAB_0010127c: MOV EAX,ECX JMP 0x00101217 LAB_00101280: XOR EAX,EAX RET
int func0(long param_1,int param_2,int param_3) { long lVar1; int iVar2; uint uVar3; int iVar4; int *piVar5; int *piVar6; int *piVar7; int *piVar8; int iVar9; int iVar10; int *piVar11; int iVar12; int iVar13; int iVar14; int iVar15; if (param_2 < 1) { return 0; } iVar10 = 0; if (param_2 != 1) { piVar11 = (int *)(param_1 + 4); iVar10 = 0; iVar9 = 1; do { iVar2 = piVar11[-1]; uVar3 = param_2 - iVar9; if (param_2 <= iVar9) { uVar3 = 1; } iVar12 = iVar9; if (((uint)((param_2 + -1) - iVar9) < 3) || (param_2 <= iVar9)) { LAB_00101217: lVar1 = (long)iVar12 * 4; iVar10 = iVar10 + (uint)(param_3 == *(int *)(param_1 + (long)iVar12 * 4) + iVar2); if ((iVar12 + 1 < param_2) && (iVar10 = iVar10 + (uint)(param_3 == *(int *)(param_1 + 4 + lVar1) + iVar2), iVar12 + 2 < param_2)) { iVar10 = iVar10 + (uint)(param_3 == iVar2 + *(int *)(param_1 + 8 + lVar1)); } } else { iVar12 = 0; iVar13 = 0; iVar14 = 0; iVar15 = 0; piVar8 = piVar11; do { iVar4 = *piVar8; piVar5 = piVar8 + 1; piVar6 = piVar8 + 2; piVar7 = piVar8 + 3; piVar8 = piVar8 + 4; iVar12 = iVar12 + (uint)(iVar4 + iVar2 == param_3); iVar13 = iVar13 + (uint)(*piVar5 + iVar2 == param_3); iVar14 = iVar14 + (uint)(*piVar6 + iVar2 == param_3); iVar15 = iVar15 + (uint)(*piVar7 + iVar2 == param_3); } while (piVar8 != piVar11 + (ulong)(uVar3 >> 2) * 4); iVar10 = iVar10 + iVar12 + iVar14 + iVar13 + iVar15; iVar12 = (uVar3 & 0xfffffffc) + iVar9; if ((uVar3 & 3) != 0) goto LAB_00101217; } iVar9 = iVar9 + 1; piVar11 = piVar11 + 1; } while (param_2 != iVar9); } return iVar10; }
6,964
func0
#include <assert.h>
int func0(int x) { int parity = 0; while (x != 0) { x = x & (x - 1); parity++; } return (parity % 2 == 1); }
int main() { assert(func0(13) == 1); assert(func0(21) == 1); assert(func0(18) == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) movl $0x0,-0x4(%rbp) jmp 116a <func0+0x21> mov -0x14(%rbp),%eax sub $0x1,%eax and %eax,-0x14(%rbp) addl $0x1,-0x4(%rbp) cmpl $0x0,-0x14(%rbp) jne 115d <func0+0x14> mov -0x4(%rbp),%eax cltd shr $0x1f,%edx add %edx,%eax and $0x1,%eax sub %edx,%eax cmp $0x1,%eax sete %al movzbl %al,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_4], 0 jmp short loc_116A loc_115D: mov eax, [rbp+var_14] sub eax, 1 and [rbp+var_14], eax add [rbp+var_4], 1 loc_116A: cmp [rbp+var_14], 0 jnz short loc_115D mov edx, [rbp+var_4] mov eax, edx sar eax, 1Fh shr eax, 1Fh add edx, eax and edx, 1 sub edx, eax mov eax, edx cmp eax, 1 setz al movzx eax, al pop rbp retn
_BOOL8 func0(int a1) { int v3; // [rsp+10h] [rbp-4h] v3 = 0; while ( a1 ) { a1 &= a1 - 1; ++v3; } return v3 % 2 == 1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x4],0x0 JMP 0x0010116a LAB_0010115d: MOV EAX,dword ptr [RBP + -0x14] SUB EAX,0x1 AND dword ptr [RBP + -0x14],EAX ADD dword ptr [RBP + -0x4],0x1 LAB_0010116a: CMP dword ptr [RBP + -0x14],0x0 JNZ 0x0010115d MOV EDX,dword ptr [RBP + -0x4] MOV EAX,EDX SAR EAX,0x1f SHR EAX,0x1f ADD EDX,EAX AND EDX,0x1 SUB EDX,EAX MOV EAX,EDX CMP EAX,0x1 SETZ AL MOVZX EAX,AL POP RBP RET
bool func0(uint param_1) { int4 local_1c; int4 local_c; local_c = 0; for (local_1c = param_1; local_1c != 0; local_1c = local_1c & local_1c - 1) { local_c = local_c + 1; } return local_c % 2 == 1; }
6,965
func0
#include <assert.h>
int func0(int x) { int parity = 0; while (x != 0) { x = x & (x - 1); parity++; } return (parity % 2 == 1); }
int main() { assert(func0(13) == 1); assert(func0(21) == 1); assert(func0(18) == 0); return 0; }
O1
c
func0: endbr64 test %edi,%edi je 1176 <func0+0x2d> mov $0x0,%eax lea -0x1(%rdi),%edx add $0x1,%eax and %edx,%edi jne 1156 <func0+0xd> mov %eax,%edx shr $0x1f,%edx add %edx,%eax and $0x1,%eax sub %edx,%eax cmp $0x1,%eax sete %al movzbl %al,%eax retq mov %edi,%eax jmp 1160 <func0+0x17>
func0: endbr64 test edi, edi jz short loc_1176 mov eax, 0 loc_1156: lea edx, [rdi-1] add eax, 1 and edi, edx jnz short loc_1156 loc_1160: mov edx, eax shr edx, 1Fh add eax, edx and eax, 1 sub eax, edx cmp eax, 1 setz al movzx eax, al retn loc_1176: mov eax, edi jmp short loc_1160
_BOOL8 func0(int a1) { int v1; // eax if ( a1 ) { v1 = 0; do { ++v1; a1 &= a1 - 1; } while ( a1 ); } else { v1 = 0; } return v1 % 2 == 1; }
func0: ENDBR64 TEST EDI,EDI JZ 0x00101176 MOV EAX,0x0 LAB_00101156: LEA EDX,[RDI + -0x1] ADD EAX,0x1 AND EDI,EDX JNZ 0x00101156 LAB_00101160: MOV EDX,EAX SHR EDX,0x1f ADD EAX,EDX AND EAX,0x1 SUB EAX,EDX CMP EAX,0x1 SETZ AL MOVZX EAX,AL RET LAB_00101176: MOV EAX,EDI JMP 0x00101160
bool func0(uint param_1) { int iVar1; if (param_1 == 0) { iVar1 = 0; } else { iVar1 = 0; do { iVar1 = iVar1 + 1; param_1 = param_1 & param_1 - 1; } while (param_1 != 0); } return iVar1 % 2 == 1; }
6,966
func0
#include <assert.h>
int func0(int x) { int parity = 0; while (x != 0) { x = x & (x - 1); parity++; } return (parity % 2 == 1); }
int main() { assert(func0(13) == 1); assert(func0(21) == 1); assert(func0(18) == 0); return 0; }
O2
c
func0: endbr64 xor %eax,%eax test %edi,%edi je 1160 <func0+0x20> nopw 0x0(%rax,%rax,1) lea -0x1(%rdi),%edx add $0x1,%eax and %edx,%edi jne 1150 <func0+0x10> and $0x1,%eax retq xchg %ax,%ax retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 xor eax, eax test edi, edi jz short locret_1160 nop word ptr [rax+rax+00h] loc_1150: lea edx, [rdi-1] add eax, 1 and edi, edx jnz short loc_1150 and eax, 1 retn locret_1160: retn
long long func0(int a1) { long long result; // rax result = 0LL; if ( a1 ) { do { LOBYTE(result) = result + 1; a1 &= a1 - 1; } while ( a1 ); return result & 1; } return result; }
func0: ENDBR64 XOR EAX,EAX TEST EDI,EDI JZ 0x00101160 NOP word ptr [RAX + RAX*0x1] LAB_00101150: LEA EDX,[RDI + -0x1] ADD EAX,0x1 AND EDI,EDX JNZ 0x00101150 AND EAX,0x1 RET LAB_00101160: RET
uint func0(uint param_1) { uint uVar1; uVar1 = 0; if (param_1 == 0) { return 0; } do { uVar1 = uVar1 + 1; param_1 = param_1 & param_1 - 1; } while (param_1 != 0); return uVar1 & 1; }
6,967
func0
#include <assert.h>
int func0(int x) { int parity = 0; while (x != 0) { x = x & (x - 1); parity++; } return (parity % 2 == 1); }
int main() { assert(func0(13) == 1); assert(func0(21) == 1); assert(func0(18) == 0); return 0; }
O3
c
func0: endbr64 xor %eax,%eax test %edi,%edi je 1160 <func0+0x20> nopw 0x0(%rax,%rax,1) lea -0x1(%rdi),%edx add $0x1,%eax and %edx,%edi jne 1150 <func0+0x10> and $0x1,%eax retq xchg %ax,%ax retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 xor eax, eax test edi, edi jz short locret_1160 nop word ptr [rax+rax+00h] loc_1150: lea edx, [rdi-1] add eax, 1 and edi, edx jnz short loc_1150 and eax, 1 retn locret_1160: retn
long long func0(int a1) { long long result; // rax result = 0LL; if ( a1 ) { do { LOBYTE(result) = result + 1; a1 &= a1 - 1; } while ( a1 ); return result & 1; } return result; }
func0: ENDBR64 XOR EAX,EAX TEST EDI,EDI JZ 0x00101160 NOP word ptr [RAX + RAX*0x1] LAB_00101150: LEA EDX,[RDI + -0x1] ADD EAX,0x1 AND EDI,EDX JNZ 0x00101150 AND EAX,0x1 RET LAB_00101160: RET
uint func0(uint param_1) { uint uVar1; uVar1 = 0; if (param_1 == 0) { return 0; } do { uVar1 = uVar1 + 1; param_1 = param_1 & param_1 - 1; } while (param_1 != 0); return uVar1 & 1; }
6,968
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> int compare(const void *a, const void *b) { return (*(int*)a - *(int*)b); }
int* func0(int *li1, int li1Size, int *li2, int li2Size, int *resultSize) { int *result = malloc((li1Size + li2Size) * sizeof(int)); int i, j; int index = 0; int found; // elements in li1 but not in li2 for (i = 0; i < li1Size; i++) { found = 0; for (j = 0; j < li2Size; j++) { if (li1[i] == li2[j]) { found = 1; break; } } if (!found) { result[index++] = li1[i]; } } // elements in li2 but not in li1 for (i = 0; i < li2Size; i++) { found = 0; for (j = 0; j < li1Size; j++) { if (li2[i] == li1[j]) { found = 1; break; } } if (!found) { result[index++] = li2[i]; } } *resultSize = index; return result; }
int main() { int resultSize; int *result; int li1[] = {10, 15, 20, 25, 30, 35, 40}; int li2[] = {25, 40, 35}; result = func0(li1, 7, li2, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected1[] = {10, 15, 20, 30}; assert(resultSize == 4 && memcmp(result, expected1, resultSize * sizeof(int)) == 0); free(result); int li3[] = {1, 2, 3, 4, 5}; int li4[] = {6, 7, 1}; result = func0(li3, 5, li4, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected2[] = {2, 3, 4, 5, 6, 7}; assert(resultSize == 6 && memcmp(result, expected2, resultSize * sizeof(int)) == 0); free(result); int li5[] = {1, 2, 3}; int li6[] = {6, 7, 1}; result = func0(li5, 3, li6, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected3[] = {2, 3, 6, 7}; assert(resultSize == 4 && memcmp(result, expected3, resultSize * sizeof(int)) == 0); free(result); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x40,%rsp mov %rdi,-0x28(%rbp) mov %esi,-0x2c(%rbp) mov %rdx,-0x38(%rbp) mov %ecx,-0x30(%rbp) mov %r8,-0x40(%rbp) mov -0x2c(%rbp),%edx mov -0x30(%rbp),%eax add %edx,%eax cltq shl $0x2,%rax mov %rax,%rdi callq 10f0 <malloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0x10(%rbp) movl $0x0,-0x18(%rbp) jmpq 12e8 <func0+0xdd> movl $0x0,-0xc(%rbp) movl $0x0,-0x14(%rbp) jmp 12a3 <func0+0x98> mov -0x18(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x14(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x38(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jne 129f <func0+0x94> movl $0x1,-0xc(%rbp) jmp 12ab <func0+0xa0> addl $0x1,-0x14(%rbp) mov -0x14(%rbp),%eax cmp -0x30(%rbp),%eax jl 1266 <func0+0x5b> cmpl $0x0,-0xc(%rbp) jne 12e4 <func0+0xd9> mov -0x18(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x10(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x10(%rbp) cltq lea 0x0(,%rax,4),%rdx mov -0x8(%rbp),%rax add %rax,%rdx mov (%rcx),%eax mov %eax,(%rdx) addl $0x1,-0x18(%rbp) mov -0x18(%rbp),%eax cmp -0x2c(%rbp),%eax jl 1256 <func0+0x4b> movl $0x0,-0x18(%rbp) jmpq 1392 <func0+0x187> movl $0x0,-0xc(%rbp) movl $0x0,-0x14(%rbp) jmp 134d <func0+0x142> mov -0x18(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x38(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x14(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x28(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jne 1349 <func0+0x13e> movl $0x1,-0xc(%rbp) jmp 1355 <func0+0x14a> addl $0x1,-0x14(%rbp) mov -0x14(%rbp),%eax cmp -0x2c(%rbp),%eax jl 1310 <func0+0x105> cmpl $0x0,-0xc(%rbp) jne 138e <func0+0x183> mov -0x18(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x38(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x10(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x10(%rbp) cltq lea 0x0(,%rax,4),%rdx mov -0x8(%rbp),%rax add %rax,%rdx mov (%rcx),%eax mov %eax,(%rdx) addl $0x1,-0x18(%rbp) mov -0x18(%rbp),%eax cmp -0x30(%rbp),%eax jl 1300 <func0+0xf5> mov -0x40(%rbp),%rax mov -0x10(%rbp),%edx mov %edx,(%rax) mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_28], rdi mov [rbp+var_2C], esi mov [rbp+var_38], rdx mov [rbp+var_30], ecx mov [rbp+var_40], r8 mov edx, [rbp+var_2C] mov eax, [rbp+var_30] add eax, edx cdqe shl rax, 2 mov rdi, rax; size call _malloc mov [rbp+var_8], rax mov [rbp+var_10], 0 mov [rbp+var_18], 0 jmp loc_12E8 loc_1256: mov [rbp+var_C], 0 mov [rbp+var_14], 0 jmp short loc_12A3 loc_1266: mov eax, [rbp+var_18] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rdx mov edx, [rax] mov eax, [rbp+var_14] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_38] add rax, rcx mov eax, [rax] cmp edx, eax jnz short loc_129F mov [rbp+var_C], 1 jmp short loc_12AB loc_129F: add [rbp+var_14], 1 loc_12A3: mov eax, [rbp+var_14] cmp eax, [rbp+var_30] jl short loc_1266 loc_12AB: cmp [rbp+var_C], 0 jnz short loc_12E4 mov eax, [rbp+var_18] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] lea rcx, [rdx+rax] mov eax, [rbp+var_10] lea edx, [rax+1] mov [rbp+var_10], edx cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_8] add rdx, rax mov eax, [rcx] mov [rdx], eax loc_12E4: add [rbp+var_18], 1 loc_12E8: mov eax, [rbp+var_18] cmp eax, [rbp+var_2C] jl loc_1256 mov [rbp+var_18], 0 jmp loc_1392 loc_1300: mov [rbp+var_C], 0 mov [rbp+var_14], 0 jmp short loc_134D loc_1310: mov eax, [rbp+var_18] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_38] add rax, rdx mov edx, [rax] mov eax, [rbp+var_14] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rcx mov eax, [rax] cmp edx, eax jnz short loc_1349 mov [rbp+var_C], 1 jmp short loc_1355 loc_1349: add [rbp+var_14], 1 loc_134D: mov eax, [rbp+var_14] cmp eax, [rbp+var_2C] jl short loc_1310 loc_1355: cmp [rbp+var_C], 0 jnz short loc_138E mov eax, [rbp+var_18] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_38] lea rcx, [rdx+rax] mov eax, [rbp+var_10] lea edx, [rax+1] mov [rbp+var_10], edx cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_8] add rdx, rax mov eax, [rcx] mov [rdx], eax loc_138E: add [rbp+var_18], 1 loc_1392: mov eax, [rbp+var_18] cmp eax, [rbp+var_30] jl loc_1300 mov rax, [rbp+var_40] mov edx, [rbp+var_10] mov [rax], edx mov rax, [rbp+var_8] leave retn
_DWORD * func0(long long a1, int a2, long long a3, int a4, _DWORD *a5) { int v5; // eax int v6; // eax int i; // [rsp+28h] [rbp-18h] int k; // [rsp+28h] [rbp-18h] int j; // [rsp+2Ch] [rbp-14h] int m; // [rsp+2Ch] [rbp-14h] int v15; // [rsp+30h] [rbp-10h] int v16; // [rsp+34h] [rbp-Ch] int v17; // [rsp+34h] [rbp-Ch] _DWORD *v18; // [rsp+38h] [rbp-8h] v18 = malloc(4LL * (a2 + a4)); v15 = 0; for ( i = 0; i < a2; ++i ) { v16 = 0; for ( j = 0; j < a4; ++j ) { if ( *(_DWORD *)(4LL * i + a1) == *(_DWORD *)(4LL * j + a3) ) { v16 = 1; break; } } if ( !v16 ) { v5 = v15++; v18[v5] = *(_DWORD *)(4LL * i + a1); } } for ( k = 0; k < a4; ++k ) { v17 = 0; for ( m = 0; m < a2; ++m ) { if ( *(_DWORD *)(4LL * k + a3) == *(_DWORD *)(4LL * m + a1) ) { v17 = 1; break; } } if ( !v17 ) { v6 = v15++; v18[v6] = *(_DWORD *)(4LL * k + a3); } } *a5 = v15; return v18; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x2c],ESI MOV qword ptr [RBP + -0x38],RDX MOV dword ptr [RBP + -0x30],ECX MOV qword ptr [RBP + -0x40],R8 MOV EDX,dword ptr [RBP + -0x2c] MOV EAX,dword ptr [RBP + -0x30] ADD EAX,EDX CDQE SHL RAX,0x2 MOV RDI,RAX CALL 0x001010f0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0x10],0x0 MOV dword ptr [RBP + -0x18],0x0 JMP 0x001012e8 LAB_00101256: MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x14],0x0 JMP 0x001012a3 LAB_00101266: MOV EAX,dword ptr [RBP + -0x18] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x14] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x38] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JNZ 0x0010129f MOV dword ptr [RBP + -0xc],0x1 JMP 0x001012ab LAB_0010129f: ADD dword ptr [RBP + -0x14],0x1 LAB_001012a3: MOV EAX,dword ptr [RBP + -0x14] CMP EAX,dword ptr [RBP + -0x30] JL 0x00101266 LAB_001012ab: CMP dword ptr [RBP + -0xc],0x0 JNZ 0x001012e4 MOV EAX,dword ptr [RBP + -0x18] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] LEA RCX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x10] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x10],EDX CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RDX,RAX MOV EAX,dword ptr [RCX] MOV dword ptr [RDX],EAX LAB_001012e4: ADD dword ptr [RBP + -0x18],0x1 LAB_001012e8: MOV EAX,dword ptr [RBP + -0x18] CMP EAX,dword ptr [RBP + -0x2c] JL 0x00101256 MOV dword ptr [RBP + -0x18],0x0 JMP 0x00101392 LAB_00101300: MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x14],0x0 JMP 0x0010134d LAB_00101310: MOV EAX,dword ptr [RBP + -0x18] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x38] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x14] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JNZ 0x00101349 MOV dword ptr [RBP + -0xc],0x1 JMP 0x00101355 LAB_00101349: ADD dword ptr [RBP + -0x14],0x1 LAB_0010134d: MOV EAX,dword ptr [RBP + -0x14] CMP EAX,dword ptr [RBP + -0x2c] JL 0x00101310 LAB_00101355: CMP dword ptr [RBP + -0xc],0x0 JNZ 0x0010138e MOV EAX,dword ptr [RBP + -0x18] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x38] LEA RCX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x10] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x10],EDX CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x8] ADD RDX,RAX MOV EAX,dword ptr [RCX] MOV dword ptr [RDX],EAX LAB_0010138e: ADD dword ptr [RBP + -0x18],0x1 LAB_00101392: MOV EAX,dword ptr [RBP + -0x18] CMP EAX,dword ptr [RBP + -0x30] JL 0x00101300 MOV RAX,qword ptr [RBP + -0x40] MOV EDX,dword ptr [RBP + -0x10] MOV dword ptr [RAX],EDX MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1,int param_2,long param_3,int param_4,int *param_5) { bool bVar1; void *pvVar2; int4 local_20; int4 local_1c; int4 local_18; pvVar2 = malloc((long)(param_4 + param_2) << 2); local_18 = 0; for (local_20 = 0; local_20 < param_2; local_20 = local_20 + 1) { bVar1 = false; for (local_1c = 0; local_1c < param_4; local_1c = local_1c + 1) { if (*(int *)(param_1 + (long)local_20 * 4) == *(int *)(param_3 + (long)local_1c * 4)) { bVar1 = true; break; } } if (!bVar1) { *(int4 *)((long)local_18 * 4 + (long)pvVar2) = *(int4 *)((long)local_20 * 4 + param_1); local_18 = local_18 + 1; } } local_20 = 0; do { if (param_4 <= local_20) { *param_5 = local_18; return pvVar2; } bVar1 = false; for (local_1c = 0; local_1c < param_2; local_1c = local_1c + 1) { if (*(int *)(param_3 + (long)local_20 * 4) == *(int *)(param_1 + (long)local_1c * 4)) { bVar1 = true; break; } } if (!bVar1) { *(int4 *)((long)local_18 * 4 + (long)pvVar2) = *(int4 *)((long)local_20 * 4 + param_3); local_18 = local_18 + 1; } local_20 = local_20 + 1; } while( true ); }
6,969
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> int compare(const void *a, const void *b) { return (*(int*)a - *(int*)b); }
int* func0(int *li1, int li1Size, int *li2, int li2Size, int *resultSize) { int *result = malloc((li1Size + li2Size) * sizeof(int)); int i, j; int index = 0; int found; // elements in li1 but not in li2 for (i = 0; i < li1Size; i++) { found = 0; for (j = 0; j < li2Size; j++) { if (li1[i] == li2[j]) { found = 1; break; } } if (!found) { result[index++] = li1[i]; } } // elements in li2 but not in li1 for (i = 0; i < li2Size; i++) { found = 0; for (j = 0; j < li1Size; j++) { if (li2[i] == li1[j]) { found = 1; break; } } if (!found) { result[index++] = li2[i]; } } *resultSize = index; return result; }
int main() { int resultSize; int *result; int li1[] = {10, 15, 20, 25, 30, 35, 40}; int li2[] = {25, 40, 35}; result = func0(li1, 7, li2, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected1[] = {10, 15, 20, 30}; assert(resultSize == 4 && memcmp(result, expected1, resultSize * sizeof(int)) == 0); free(result); int li3[] = {1, 2, 3, 4, 5}; int li4[] = {6, 7, 1}; result = func0(li3, 5, li4, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected2[] = {2, 3, 4, 5, 6, 7}; assert(resultSize == 6 && memcmp(result, expected2, resultSize * sizeof(int)) == 0); free(result); int li5[] = {1, 2, 3}; int li6[] = {6, 7, 1}; result = func0(li5, 3, li6, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected3[] = {2, 3, 6, 7}; assert(resultSize == 4 && memcmp(result, expected3, resultSize * sizeof(int)) == 0); free(result); return 0; }
O1
c
func0: endbr64 push %r14 push %r13 push %r12 push %rbp push %rbx mov %rdi,%r13 mov %esi,%ebx mov %rdx,%r14 mov %ecx,%ebp mov %r8,%r12 lea (%rsi,%rcx,1),%edi movslq %edi,%rdi shl $0x2,%rdi callq 10f0 <malloc@plt> test %ebx,%ebx jle 123c <func0+0x4a> mov %r13,%rdi lea -0x1(%rbx),%edx lea 0x4(%r13,%rdx,4),%r9 mov %r14,%r10 lea -0x1(%rbp),%edx lea 0x4(%r14,%rdx,4),%rsi mov $0x0,%r8d jmp 12ad <func0+0xbb> mov $0x0,%r8d test %ebp,%ebp jle 125e <func0+0x6c> mov %r14,%rdi lea -0x1(%rbp),%edx lea 0x4(%r14,%rdx,4),%r9 mov %r13,%r10 lea -0x1(%rbx),%edx lea 0x4(%r13,%rdx,4),%rsi jmp 1280 <func0+0x8e> mov %r8d,(%r12) pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq movslq %r8d,%rdx mov (%rdi),%ecx mov %ecx,(%rax,%rdx,4) lea 0x1(%r8),%r8d add $0x4,%rdi cmp %r9,%rdi je 125e <func0+0x6c> test %ebx,%ebx jle 126b <func0+0x79> mov (%rdi),%ecx mov %r10,%rdx cmp (%rdx),%ecx je 1277 <func0+0x85> add $0x4,%rdx cmp %rsi,%rdx jne 1289 <func0+0x97> jmp 126b <func0+0x79> movslq %r8d,%rdx mov (%rdi),%ecx mov %ecx,(%rax,%rdx,4) lea 0x1(%r8),%r8d add $0x4,%rdi cmp %r9,%rdi je 1242 <func0+0x50> test %ebp,%ebp jle 1298 <func0+0xa6> mov (%rdi),%ecx mov %r10,%rdx cmp (%rdx),%ecx je 12a4 <func0+0xb2> add $0x4,%rdx cmp %rsi,%rdx jne 12b6 <func0+0xc4> jmp 1298 <func0+0xa6>
func0: endbr64 push r14 push r13 push r12 push rbp push rbx mov rbp, rdi mov ebx, esi mov r14, rdx mov r13d, ecx mov r12, r8 lea edi, [rsi+rcx] movsxd rdi, edi shl rdi, 2 call _malloc mov r8, rax test ebx, ebx jle short loc_123D mov rsi, rbp lea eax, [rbx-1] lea r9, [rbp+rax*4+4] lea eax, [r13-1] lea rcx, [r14+rax*4+4] mov edi, 0 jmp short loc_129F loc_123D: mov edi, 0 loc_1242: test r13d, r13d jle short loc_12B8 mov rsi, r14 lea eax, [r13-1] lea r9, [r14+rax*4+4] lea eax, [rbx-1] lea rcx, [rbp+rax*4+4] jmp short loc_1272 loc_125D: movsxd rax, edi mov edx, [rsi] mov [r8+rax*4], edx lea edi, [rdi+1] loc_1269: add rsi, 4 cmp rsi, r9 jz short loc_12B8 loc_1272: test ebx, ebx jle short loc_125D mov edx, [rsi] mov rax, rbp loc_127B: cmp edx, [rax] jz short loc_1269 add rax, 4 cmp rax, rcx jnz short loc_127B jmp short loc_125D loc_128A: movsxd rax, edi mov edx, [rsi] mov [r8+rax*4], edx lea edi, [rdi+1] loc_1296: add rsi, 4 cmp rsi, r9 jz short loc_1242 loc_129F: test r13d, r13d jle short loc_128A mov edx, [rsi] mov rax, r14 loc_12A9: cmp edx, [rax] jz short loc_1296 add rax, 4 cmp rax, rcx jnz short loc_12A9 jmp short loc_128A loc_12B8: mov [r12], edi mov rax, r8 pop rbx pop rbp pop r12 pop r13 pop r14 retn
long long func0(_DWORD *a1, int a2, _DWORD *a3, int a4, _DWORD *a5) { long long v10; // r8 _DWORD *v11; // rsi int v12; // edi _DWORD *v13; // rsi _DWORD *v14; // rax _DWORD *v15; // rax v10 = malloc(4LL * (a2 + a4)); if ( a2 <= 0 ) { v12 = 0; } else { v11 = a1; v12 = 0; do { if ( a4 <= 0 ) { LABEL_13: *(_DWORD *)(v10 + 4LL * v12++) = *v11; } else { v15 = a3; while ( *v11 != *v15 ) { if ( ++v15 == &a3[a4 - 1 + 1] ) goto LABEL_13; } } ++v11; } while ( v11 != &a1[a2 - 1 + 1] ); } if ( a4 > 0 ) { v13 = a3; do { if ( a2 <= 0 ) { LABEL_6: *(_DWORD *)(v10 + 4LL * v12++) = *v13; } else { v14 = a1; while ( *v13 != *v14 ) { if ( ++v14 == &a1[a2 - 1 + 1] ) goto LABEL_6; } } ++v13; } while ( v13 != &a3[a4 - 1 + 1] ); } *a5 = v12; return v10; }
func0: ENDBR64 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX MOV RBP,RDI MOV EBX,ESI MOV R14,RDX MOV R13D,ECX MOV R12,R8 LEA EDI,[RSI + RCX*0x1] MOVSXD RDI,EDI SHL RDI,0x2 CALL 0x001010f0 MOV R8,RAX TEST EBX,EBX JLE 0x0010123d MOV RSI,RBP LEA EAX,[RBX + -0x1] LEA R9,[RBP + RAX*0x4 + 0x4] LEA EAX,[R13 + -0x1] LEA RCX,[R14 + RAX*0x4 + 0x4] MOV EDI,0x0 JMP 0x0010129f LAB_0010123d: MOV EDI,0x0 LAB_00101242: TEST R13D,R13D JLE 0x001012b8 MOV RSI,R14 LEA EAX,[R13 + -0x1] LEA R9,[R14 + RAX*0x4 + 0x4] LEA EAX,[RBX + -0x1] LEA RCX,[RBP + RAX*0x4 + 0x4] JMP 0x00101272 LAB_0010125d: MOVSXD RAX,EDI MOV EDX,dword ptr [RSI] MOV dword ptr [R8 + RAX*0x4],EDX LEA EDI,[RDI + 0x1] LAB_00101269: ADD RSI,0x4 CMP RSI,R9 JZ 0x001012b8 LAB_00101272: TEST EBX,EBX JLE 0x0010125d MOV EDX,dword ptr [RSI] MOV RAX,RBP LAB_0010127b: CMP EDX,dword ptr [RAX] JZ 0x00101269 ADD RAX,0x4 CMP RAX,RCX JNZ 0x0010127b JMP 0x0010125d LAB_0010128a: MOVSXD RAX,EDI MOV EDX,dword ptr [RSI] MOV dword ptr [R8 + RAX*0x4],EDX LEA EDI,[RDI + 0x1] LAB_00101296: ADD RSI,0x4 CMP RSI,R9 JZ 0x00101242 LAB_0010129f: TEST R13D,R13D JLE 0x0010128a MOV EDX,dword ptr [RSI] MOV RAX,R14 LAB_001012a9: CMP EDX,dword ptr [RAX] JZ 0x00101296 ADD RAX,0x4 CMP RAX,RCX JNZ 0x001012a9 JMP 0x0010128a LAB_001012b8: MOV dword ptr [R12],EDI MOV RAX,R8 POP RBX POP RBP POP R12 POP R13 POP R14 RET
void * func0(int *param_1,int param_2,int *param_3,int param_4,int *param_5) { void *pvVar1; int *piVar2; int *piVar3; int iVar4; pvVar1 = malloc((long)(param_2 + param_4) << 2); if (param_2 < 1) { iVar4 = 0; } else { iVar4 = 0; piVar3 = param_1; do { if (0 < param_4) { piVar2 = param_3; do { if (*piVar3 == *piVar2) goto LAB_00101296; piVar2 = piVar2 + 1; } while (piVar2 != param_3 + (ulong)(param_4 - 1) + 1); } *(int *)((long)pvVar1 + (long)iVar4 * 4) = *piVar3; iVar4 = iVar4 + 1; LAB_00101296: piVar3 = piVar3 + 1; } while (piVar3 != param_1 + (ulong)(param_2 - 1) + 1); } if (0 < param_4) { piVar3 = param_3 + (ulong)(param_4 - 1) + 1; do { if (0 < param_2) { piVar2 = param_1; do { if (*param_3 == *piVar2) goto LAB_00101269; piVar2 = piVar2 + 1; } while (piVar2 != param_1 + (ulong)(param_2 - 1) + 1); } *(int *)((long)pvVar1 + (long)iVar4 * 4) = *param_3; iVar4 = iVar4 + 1; LAB_00101269: param_3 = param_3 + 1; } while (param_3 != piVar3); } *param_5 = iVar4; return pvVar1; }
6,970
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> int compare(const void *a, const void *b) { return (*(int*)a - *(int*)b); }
int* func0(int *li1, int li1Size, int *li2, int li2Size, int *resultSize) { int *result = malloc((li1Size + li2Size) * sizeof(int)); int i, j; int index = 0; int found; // elements in li1 but not in li2 for (i = 0; i < li1Size; i++) { found = 0; for (j = 0; j < li2Size; j++) { if (li1[i] == li2[j]) { found = 1; break; } } if (!found) { result[index++] = li1[i]; } } // elements in li2 but not in li1 for (i = 0; i < li2Size; i++) { found = 0; for (j = 0; j < li1Size; j++) { if (li2[i] == li1[j]) { found = 1; break; } } if (!found) { result[index++] = li2[i]; } } *resultSize = index; return result; }
int main() { int resultSize; int *result; int li1[] = {10, 15, 20, 25, 30, 35, 40}; int li2[] = {25, 40, 35}; result = func0(li1, 7, li2, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected1[] = {10, 15, 20, 30}; assert(resultSize == 4 && memcmp(result, expected1, resultSize * sizeof(int)) == 0); free(result); int li3[] = {1, 2, 3, 4, 5}; int li4[] = {6, 7, 1}; result = func0(li3, 5, li4, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected2[] = {2, 3, 4, 5, 6, 7}; assert(resultSize == 6 && memcmp(result, expected2, resultSize * sizeof(int)) == 0); free(result); int li5[] = {1, 2, 3}; int li6[] = {6, 7, 1}; result = func0(li5, 3, li6, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected3[] = {2, 3, 6, 7}; assert(resultSize == 4 && memcmp(result, expected3, resultSize * sizeof(int)) == 0); free(result); return 0; }
O2
c
func0: endbr64 push %r14 mov %ecx,%r14d push %r13 mov %r8,%r13 push %r12 mov %esi,%r12d push %rbp mov %rdi,%rbp lea (%rsi,%rcx,1),%edi push %rbx movslq %edi,%rdi mov %rdx,%rbx shl $0x2,%rdi callq 10d0 <malloc@plt> test %r12d,%r12d jle 15d4 <func0+0x104> lea -0x1(%r14),%esi lea -0x1(%r12),%ecx mov %rbp,%rdx lea 0x4(%rbx,%rsi,4),%r10 lea 0x4(%rbp,%rcx,4),%rcx xor %esi,%esi nopl 0x0(%rax,%rax,1) mov (%rdx),%r9d mov %rbx,%rdi test %r14d,%r14d jg 1539 <func0+0x69> jmp 15a0 <func0+0xd0> nopl (%rax) add $0x4,%rdi cmp %rdi,%r10 je 15a0 <func0+0xd0> cmp %r9d,(%rdi) jne 1530 <func0+0x60> add $0x4,%rdx cmp %rcx,%rdx jne 1520 <func0+0x50> test %r14d,%r14d jle 158e <func0+0xbe> lea -0x1(%r14),%edx mov %rbx,%r9 lea 0x4(%rbx,%rdx,4),%r8 lea -0x1(%r12),%edx lea 0x4(%rbp,%rdx,4),%rdi nopw 0x0(%rax,%rax,1) mov (%r9),%ecx mov %rbp,%rdx test %r12d,%r12d jg 1581 <func0+0xb1> jmp 15c0 <func0+0xf0> nopl (%rax) add $0x4,%rdx cmp %rdi,%rdx je 15c0 <func0+0xf0> cmp %ecx,(%rdx) jne 1578 <func0+0xa8> add $0x4,%r9 cmp %r9,%r8 jne 1568 <func0+0x98> pop %rbx pop %rbp mov %esi,0x0(%r13) pop %r12 pop %r13 pop %r14 retq nopl 0x0(%rax,%rax,1) movslq %esi,%rdi add $0x4,%rdx add $0x1,%esi mov %r9d,(%rax,%rdi,4) cmp %rcx,%rdx jne 1520 <func0+0x50> jmp 1547 <func0+0x77> nopl 0x0(%rax) movslq %esi,%rdx add $0x4,%r9 add $0x1,%esi mov %ecx,(%rax,%rdx,4) cmp %r9,%r8 jne 1568 <func0+0x98> jmp 158e <func0+0xbe> xor %esi,%esi jmpq 1547 <func0+0x77> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r14 mov r14d, ecx push r13 mov r13, r8 push r12 mov r12d, esi push rbp mov rbp, rdi lea edi, [rsi+rcx] push rbx movsxd rdi, edi mov rbx, rdx shl rdi, 2 call _malloc mov r8, rax test r12d, r12d jle loc_15D5 lea eax, [r12-1] mov rsi, rbp xor edi, edi lea r9, [rbp+rax*4+4] lea eax, [r14-1] lea rcx, [rbx+rax*4+4] xchg ax, ax loc_1520: mov edx, [rsi] mov rax, rbx test r14d, r14d jg short loc_1539 jmp short loc_15A0 loc_1530: add rax, 4 cmp rax, rcx jz short loc_15A0 loc_1539: cmp [rax], edx jnz short loc_1530 add rsi, 4 cmp rsi, r9 jnz short loc_1520 loc_1546: test r14d, r14d jle short loc_158E lea eax, [r14-1] mov rsi, rbx lea r9, [rbx+rax*4+4] lea eax, [r12-1] lea rcx, [rbp+rax*4+4] nop dword ptr [rax+00000000h] loc_1568: mov edx, [rsi] mov rax, rbp test r12d, r12d jg short loc_1581 jmp short loc_15C0 loc_1578: add rax, 4 cmp rax, rcx jz short loc_15C0 loc_1581: cmp [rax], edx jnz short loc_1578 add rsi, 4 cmp rsi, r9 jnz short loc_1568 loc_158E: pop rbx mov rax, r8 pop rbp mov [r13+0], edi pop r12 pop r13 pop r14 retn loc_15A0: movsxd rax, edi add rsi, 4 add edi, 1 mov [r8+rax*4], edx cmp rsi, r9 jnz loc_1520 jmp short loc_1546 loc_15C0: movsxd rax, edi add rsi, 4 add edi, 1 mov [r8+rax*4], edx cmp rsi, r9 jnz short loc_1568 jmp short loc_158E loc_15D5: xor edi, edi jmp loc_1546
long long func0(int *a1, int a2, _DWORD *a3, int a4, _DWORD *a5) { long long v10; // r8 int *v11; // rsi int v12; // edi long long v13; // r9 int v14; // edx _DWORD *v15; // rax int *v16; // rsi long long v17; // r9 int v18; // edx int *v19; // rax long long result; // rax long long v21; // rax long long v22; // rax v10 = malloc(4LL * (a2 + a4)); if ( a2 <= 0 ) { v12 = 0; } else { v11 = a1; v12 = 0; v13 = (long long)&a1[a2 - 1 + 1]; do { while ( 1 ) { v14 = *v11; v15 = a3; if ( a4 > 0 ) break; LABEL_16: v21 = v12; ++v11; ++v12; *(_DWORD *)(v10 + 4 * v21) = v14; if ( v11 == (int *)v13 ) goto LABEL_8; } while ( *v15 != v14 ) { if ( ++v15 == &a3[a4 - 1 + 1] ) goto LABEL_16; } ++v11; } while ( v11 != (int *)v13 ); } LABEL_8: if ( a4 > 0 ) { v16 = a3; v17 = (long long)&a3[a4 - 1 + 1]; do { while ( 1 ) { v18 = *v16; v19 = a1; if ( a2 > 0 ) break; LABEL_18: v22 = v12; ++v16; ++v12; *(_DWORD *)(v10 + 4 * v22) = v18; if ( v16 == (int *)v17 ) goto LABEL_15; } while ( *v19 != v18 ) { if ( ++v19 == &a1[a2 - 1 + 1] ) goto LABEL_18; } ++v16; } while ( v16 != (int *)v17 ); } LABEL_15: result = v10; *a5 = v12; return result; }
func0: ENDBR64 PUSH R14 MOV R14D,ECX PUSH R13 MOV R13,R8 PUSH R12 MOV R12D,ESI PUSH RBP MOV RBP,RDI LEA EDI,[RSI + RCX*0x1] PUSH RBX MOVSXD RDI,EDI MOV RBX,RDX SHL RDI,0x2 CALL 0x001010d0 MOV R8,RAX TEST R12D,R12D JLE 0x001015d5 LEA EAX,[R12 + -0x1] MOV RSI,RBP XOR EDI,EDI LEA R9,[RBP + RAX*0x4 + 0x4] LEA EAX,[R14 + -0x1] LEA RCX,[RBX + RAX*0x4 + 0x4] NOP LAB_00101520: MOV EDX,dword ptr [RSI] MOV RAX,RBX TEST R14D,R14D JG 0x00101539 JMP 0x001015a0 LAB_00101530: ADD RAX,0x4 CMP RAX,RCX JZ 0x001015a0 LAB_00101539: CMP dword ptr [RAX],EDX JNZ 0x00101530 ADD RSI,0x4 CMP RSI,R9 JNZ 0x00101520 LAB_00101546: TEST R14D,R14D JLE 0x0010158e LEA EAX,[R14 + -0x1] MOV RSI,RBX LEA R9,[RBX + RAX*0x4 + 0x4] LEA EAX,[R12 + -0x1] LEA RCX,[RBP + RAX*0x4 + 0x4] NOP dword ptr [RAX] LAB_00101568: MOV EDX,dword ptr [RSI] MOV RAX,RBP TEST R12D,R12D JG 0x00101581 JMP 0x001015c0 LAB_00101578: ADD RAX,0x4 CMP RAX,RCX JZ 0x001015c0 LAB_00101581: CMP dword ptr [RAX],EDX JNZ 0x00101578 ADD RSI,0x4 CMP RSI,R9 JNZ 0x00101568 LAB_0010158e: POP RBX MOV RAX,R8 POP RBP MOV dword ptr [R13],EDI POP R12 POP R13 POP R14 RET LAB_001015a0: MOVSXD RAX,EDI ADD RSI,0x4 ADD EDI,0x1 MOV dword ptr [R8 + RAX*0x4],EDX CMP RSI,R9 JNZ 0x00101520 JMP 0x00101546 LAB_001015c0: MOVSXD RAX,EDI ADD RSI,0x4 ADD EDI,0x1 MOV dword ptr [R8 + RAX*0x4],EDX CMP RSI,R9 JNZ 0x00101568 JMP 0x0010158e LAB_001015d5: XOR EDI,EDI JMP 0x00101546
void * func0(int *param_1,int param_2,int *param_3,int param_4,int *param_5) { void *pvVar1; int *piVar2; long lVar3; int *piVar4; int iVar5; pvVar1 = malloc((long)(param_2 + param_4) << 2); if (param_2 < 1) { iVar5 = 0; } else { iVar5 = 0; piVar4 = param_1; do { piVar2 = param_3; if (0 < param_4) { do { if (*piVar2 == *piVar4) goto joined_r0x00101544; piVar2 = piVar2 + 1; } while (piVar2 != param_3 + (ulong)(param_4 - 1) + 1); } lVar3 = (long)iVar5; iVar5 = iVar5 + 1; *(int *)((long)pvVar1 + lVar3 * 4) = *piVar4; joined_r0x00101544: piVar4 = piVar4 + 1; } while (piVar4 != param_1 + (ulong)(param_2 - 1) + 1); } if (0 < param_4) { piVar4 = param_3 + (ulong)(param_4 - 1) + 1; do { piVar2 = param_1; if (0 < param_2) { do { if (*piVar2 == *param_3) goto joined_r0x0010158c; piVar2 = piVar2 + 1; } while (piVar2 != param_1 + (ulong)(param_2 - 1) + 1); } lVar3 = (long)iVar5; iVar5 = iVar5 + 1; *(int *)((long)pvVar1 + lVar3 * 4) = *param_3; joined_r0x0010158c: param_3 = param_3 + 1; } while (param_3 != piVar4); } *param_5 = iVar5; return pvVar1; }
6,971
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> int compare(const void *a, const void *b) { return (*(int*)a - *(int*)b); }
int* func0(int *li1, int li1Size, int *li2, int li2Size, int *resultSize) { int *result = malloc((li1Size + li2Size) * sizeof(int)); int i, j; int index = 0; int found; // elements in li1 but not in li2 for (i = 0; i < li1Size; i++) { found = 0; for (j = 0; j < li2Size; j++) { if (li1[i] == li2[j]) { found = 1; break; } } if (!found) { result[index++] = li1[i]; } } // elements in li2 but not in li1 for (i = 0; i < li2Size; i++) { found = 0; for (j = 0; j < li1Size; j++) { if (li2[i] == li1[j]) { found = 1; break; } } if (!found) { result[index++] = li2[i]; } } *resultSize = index; return result; }
int main() { int resultSize; int *result; int li1[] = {10, 15, 20, 25, 30, 35, 40}; int li2[] = {25, 40, 35}; result = func0(li1, 7, li2, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected1[] = {10, 15, 20, 30}; assert(resultSize == 4 && memcmp(result, expected1, resultSize * sizeof(int)) == 0); free(result); int li3[] = {1, 2, 3, 4, 5}; int li4[] = {6, 7, 1}; result = func0(li3, 5, li4, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected2[] = {2, 3, 4, 5, 6, 7}; assert(resultSize == 6 && memcmp(result, expected2, resultSize * sizeof(int)) == 0); free(result); int li5[] = {1, 2, 3}; int li6[] = {6, 7, 1}; result = func0(li5, 3, li6, 3, &resultSize); qsort(result, resultSize, sizeof(int), compare); int expected3[] = {2, 3, 6, 7}; assert(resultSize == 4 && memcmp(result, expected3, resultSize * sizeof(int)) == 0); free(result); return 0; }
O3
c
func0: endbr64 push %r14 mov %ecx,%r14d push %r13 mov %r8,%r13 push %r12 mov %esi,%r12d push %rbp mov %rdi,%rbp lea (%rsi,%rcx,1),%edi push %rbx movslq %edi,%rdi mov %rdx,%rbx shl $0x2,%rdi callq 10d0 <malloc@plt> test %r12d,%r12d jle 1594 <func0+0x104> lea -0x1(%r14),%esi lea -0x1(%r12),%ecx mov %rbp,%rdx lea 0x4(%rbx,%rsi,4),%r10 lea 0x4(%rbp,%rcx,4),%rcx xor %esi,%esi nopl 0x0(%rax,%rax,1) mov (%rdx),%r9d mov %rbx,%rdi test %r14d,%r14d jg 14f9 <func0+0x69> jmp 1560 <func0+0xd0> nopl (%rax) add $0x4,%rdi cmp %rdi,%r10 je 1560 <func0+0xd0> cmp %r9d,(%rdi) jne 14f0 <func0+0x60> add $0x4,%rdx cmp %rcx,%rdx jne 14e0 <func0+0x50> test %r14d,%r14d jle 154e <func0+0xbe> lea -0x1(%r14),%edx mov %rbx,%r9 lea 0x4(%rbx,%rdx,4),%r8 lea -0x1(%r12),%edx lea 0x4(%rbp,%rdx,4),%rdi nopw 0x0(%rax,%rax,1) mov (%r9),%ecx mov %rbp,%rdx test %r12d,%r12d jg 1541 <func0+0xb1> jmp 1580 <func0+0xf0> nopl (%rax) add $0x4,%rdx cmp %rdx,%rdi je 1580 <func0+0xf0> cmp %ecx,(%rdx) jne 1538 <func0+0xa8> add $0x4,%r9 cmp %r8,%r9 jne 1528 <func0+0x98> pop %rbx pop %rbp mov %esi,0x0(%r13) pop %r12 pop %r13 pop %r14 retq nopl 0x0(%rax,%rax,1) movslq %esi,%rdi add $0x4,%rdx add $0x1,%esi mov %r9d,(%rax,%rdi,4) cmp %rcx,%rdx jne 14e0 <func0+0x50> jmp 1507 <func0+0x77> nopl 0x0(%rax) movslq %esi,%rdx add $0x4,%r9 add $0x1,%esi mov %ecx,(%rax,%rdx,4) cmp %r8,%r9 jne 1528 <func0+0x98> jmp 154e <func0+0xbe> xor %esi,%esi jmpq 1507 <func0+0x77> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r14 movsxd r14, ecx push r13 mov r13, r8 push r12 mov r12d, esi push rbp mov rbp, rdi lea edi, [rsi+r14] push rbx movsxd rdi, edi mov rbx, rdx shl rdi, 2; size call _malloc mov r8, rax test r12d, r12d jle loc_1580 movsxd rax, r12d mov rsi, rbp xor r9d, r9d lea r10, [rbp+rax*4+0] movsxd rax, r14d lea rcx, [rbx+rax*4] nop dword ptr [rax+00h] loc_14D0: mov edx, [rsi] test r14d, r14d jle short loc_1500 loc_14D7: mov rax, rbx jmp short loc_14E9 loc_14E0: add rax, 4 cmp rax, rcx jz short loc_1500 loc_14E9: cmp [rax], edx jnz short loc_14E0 add rsi, 4 cmp rsi, r10 jz short loc_1516 mov edx, [rsi] jmp short loc_14D7 loc_1500: add rsi, 4 mov [r8+r9*4], edx lea edi, [r9+1] cmp rsi, r10 jz short loc_1519 movsxd r9, edi jmp short loc_14D0 loc_1516: mov edi, r9d loc_1519: test r14d, r14d jle short loc_1570 movsxd rax, r12d mov rsi, rbx lea r10, [rbx+r14*4] lea rcx, [rbp+rax*4+0] nop dword ptr [rax] loc_1530: mov edx, [rsi] movsxd r9, edi test r12d, r12d jle short loc_1560 loc_153A: mov rax, rbp jmp short loc_1549 loc_1540: add rax, 4 cmp rcx, rax jz short loc_1560 loc_1549: cmp edx, [rax] jnz short loc_1540 add rsi, 4 cmp rsi, r10 jz short loc_1570 mov edx, [rsi] jmp short loc_153A loc_1560: add rsi, 4 mov [r8+r9*4], edx add edi, 1 cmp rsi, r10 jnz short loc_1530 loc_1570: mov [r13+0], edi mov rax, r8 pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_1580: xor edi, edi jmp short loc_1519
_DWORD * func0(int *a1, int a2, _DWORD *a3, int a4, _DWORD *a5) { long long v5; // r14 _DWORD *v10; // r8 int *v11; // rsi long long v12; // r9 int *v13; // r10 int v14; // edx _DWORD *v15; // rax int v16; // edi int *v17; // rsi int *v18; // r10 int v19; // edx int *v20; // rax v5 = a4; v10 = malloc(4LL * (a2 + a4)); if ( a2 <= 0 ) { v16 = 0; } else { v11 = a1; v12 = 0LL; v13 = &a1[a2]; while ( 1 ) { v14 = *v11; if ( (int)v5 > 0 ) break; LABEL_9: ++v11; v10[v12] = v14; v16 = v12 + 1; if ( v11 == v13 ) goto LABEL_12; v12 = v16; } while ( 1 ) { v15 = a3; while ( *v15 != v14 ) { if ( ++v15 == &a3[(int)v5] ) goto LABEL_9; } if ( ++v11 == v13 ) break; v14 = *v11; } v16 = v12; } LABEL_12: if ( (int)v5 > 0 ) { v17 = a3; v18 = &a3[v5]; while ( 1 ) { v19 = *v17; if ( a2 > 0 ) break; LABEL_20: ++v17; v10[v16++] = v19; if ( v17 == v18 ) goto LABEL_21; } while ( 1 ) { v20 = a1; while ( v19 != *v20 ) { if ( &a1[a2] == ++v20 ) goto LABEL_20; } if ( ++v17 == v18 ) break; v19 = *v17; } } LABEL_21: *a5 = v16; return v10; }
func0: ENDBR64 PUSH R14 MOVSXD R14,ECX PUSH R13 MOV R13,R8 PUSH R12 MOV R12D,ESI PUSH RBP MOV RBP,RDI LEA EDI,[RSI + R14*0x1] PUSH RBX MOVSXD RDI,EDI MOV RBX,RDX SHL RDI,0x2 CALL 0x001010d0 MOV R8,RAX TEST R12D,R12D JLE 0x00101580 MOVSXD RAX,R12D MOV RSI,RBP XOR R9D,R9D LEA R10,[RBP + RAX*0x4] MOVSXD RAX,R14D LEA RCX,[RBX + RAX*0x4] NOP dword ptr [RAX] LAB_001014d0: MOV EDX,dword ptr [RSI] TEST R14D,R14D JLE 0x00101500 LAB_001014d7: MOV RAX,RBX JMP 0x001014e9 LAB_001014e0: ADD RAX,0x4 CMP RAX,RCX JZ 0x00101500 LAB_001014e9: CMP dword ptr [RAX],EDX JNZ 0x001014e0 ADD RSI,0x4 CMP RSI,R10 JZ 0x00101516 MOV EDX,dword ptr [RSI] JMP 0x001014d7 LAB_00101500: ADD RSI,0x4 MOV dword ptr [R8 + R9*0x4],EDX LEA EDI,[R9 + 0x1] CMP RSI,R10 JZ 0x00101519 MOVSXD R9,EDI JMP 0x001014d0 LAB_00101516: MOV EDI,R9D LAB_00101519: TEST R14D,R14D JLE 0x00101570 MOVSXD RAX,R12D MOV RSI,RBX LEA R10,[RBX + R14*0x4] LEA RCX,[RBP + RAX*0x4] NOP dword ptr [RAX] LAB_00101530: MOV EDX,dword ptr [RSI] MOVSXD R9,EDI TEST R12D,R12D JLE 0x00101560 LAB_0010153a: MOV RAX,RBP JMP 0x00101549 LAB_00101540: ADD RAX,0x4 CMP RCX,RAX JZ 0x00101560 LAB_00101549: CMP EDX,dword ptr [RAX] JNZ 0x00101540 ADD RSI,0x4 CMP RSI,R10 JZ 0x00101570 MOV EDX,dword ptr [RSI] JMP 0x0010153a LAB_00101560: ADD RSI,0x4 MOV dword ptr [R8 + R9*0x4],EDX ADD EDI,0x1 CMP RSI,R10 JNZ 0x00101530 LAB_00101570: MOV dword ptr [R13],EDI MOV RAX,R8 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_00101580: XOR EDI,EDI JMP 0x00101519
void * func0(int *param_1,int param_2,int *param_3,int param_4,int *param_5) { void *pvVar1; int *piVar2; int iVar3; int *piVar4; int iVar5; long lVar6; pvVar1 = malloc((long)(param_2 + param_4) << 2); if (param_2 < 1) { iVar5 = 0; } else { lVar6 = 0; piVar4 = param_1; while( true ) { iVar3 = *piVar4; iVar5 = (int)lVar6; piVar2 = param_3; if (0 < param_4) { do { while (*piVar2 == iVar3) { piVar4 = piVar4 + 1; if (piVar4 == param_1 + param_2) goto LAB_00101519; piVar2 = param_3; iVar3 = *piVar4; } piVar2 = piVar2 + 1; } while (piVar2 != param_3 + param_4); } piVar4 = piVar4 + 1; *(int *)((long)pvVar1 + lVar6 * 4) = iVar3; iVar5 = iVar5 + 1; if (piVar4 == param_1 + param_2) break; lVar6 = (long)iVar5; } } LAB_00101519: if (0 < param_4) { piVar4 = param_3 + param_4; do { iVar3 = *param_3; piVar2 = param_1; if (0 < param_2) { do { while (iVar3 == *piVar2) { param_3 = param_3 + 1; if (param_3 == piVar4) goto LAB_00101570; piVar2 = param_1; iVar3 = *param_3; } piVar2 = piVar2 + 1; } while (param_1 + param_2 != piVar2); } param_3 = param_3 + 1; *(int *)((long)pvVar1 + (long)iVar5 * 4) = iVar3; iVar5 = iVar5 + 1; } while (param_3 != piVar4); } LAB_00101570: *param_5 = iVar5; return pvVar1; }
6,972
func0
#include <assert.h>
int func0(int n) { int j = 0; int sm = 0; for (int i = 1; i <= n; ++i) { j = (2 * i - 1); sm += (j * j * j * j); } return sm; }
int main() { assert(func0(2) == 82); assert(func0(3) == 707); assert(func0(4) == 3108); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) movl $0x0,-0x4(%rbp) movl $0x0,-0xc(%rbp) movl $0x1,-0x8(%rbp) jmp 118b <func0+0x42> mov -0x8(%rbp),%eax add %eax,%eax sub $0x1,%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax imul %eax,%eax imul -0x4(%rbp),%eax imul -0x4(%rbp),%eax add %eax,-0xc(%rbp) addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x14(%rbp),%eax jle 116b <func0+0x22> mov -0xc(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_4], 0 mov [rbp+var_C], 0 mov [rbp+var_8], 1 jmp short loc_118B loc_116B: mov eax, [rbp+var_8] add eax, eax sub eax, 1 mov [rbp+var_4], eax mov eax, [rbp+var_4] imul eax, eax imul eax, [rbp+var_4] imul eax, [rbp+var_4] add [rbp+var_C], eax add [rbp+var_8], 1 loc_118B: mov eax, [rbp+var_8] cmp eax, [rbp+var_14] jle short loc_116B mov eax, [rbp+var_C] pop rbp retn
long long func0(int a1) { unsigned int v2; // [rsp+8h] [rbp-Ch] int i; // [rsp+Ch] [rbp-8h] v2 = 0; for ( i = 1; i <= a1; ++i ) v2 += (2 * i - 1) * (2 * i - 1) * (2 * i - 1) * (2 * i - 1); return v2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x4],0x0 MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x8],0x1 JMP 0x0010118b LAB_0010116b: MOV EAX,dword ptr [RBP + -0x8] ADD EAX,EAX SUB EAX,0x1 MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] IMUL EAX,EAX IMUL EAX,dword ptr [RBP + -0x4] IMUL EAX,dword ptr [RBP + -0x4] ADD dword ptr [RBP + -0xc],EAX ADD dword ptr [RBP + -0x8],0x1 LAB_0010118b: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x14] JLE 0x0010116b MOV EAX,dword ptr [RBP + -0xc] POP RBP RET
int func0(int param_1) { int iVar1; int4 local_14; int4 local_10; local_14 = 0; for (local_10 = 1; local_10 <= param_1; local_10 = local_10 + 1) { iVar1 = local_10 * 2 + -1; local_14 = local_14 + iVar1 * iVar1 * iVar1 * iVar1; } return local_14; }
6,973
func0
#include <assert.h>
int func0(int n) { int j = 0; int sm = 0; for (int i = 1; i <= n; ++i) { j = (2 * i - 1); sm += (j * j * j * j); } return sm; }
int main() { assert(func0(2) == 82); assert(func0(3) == 707); assert(func0(4) == 3108); return 0; }
O1
c
func0: endbr64 test %edi,%edi jle 1173 <func0+0x2a> lea 0x1(%rdi,%rdi,1),%esi mov $0x1,%eax mov $0x0,%ecx mov %eax,%edx imul %eax,%edx imul %edx,%edx add %edx,%ecx add $0x2,%eax cmp %esi,%eax jne 115f <func0+0x16> mov %ecx,%eax retq mov $0x0,%ecx jmp 1170 <func0+0x27>
func0: endbr64 test edi, edi jle short loc_1173 lea esi, [rdi+rdi+1] mov eax, 1 mov ecx, 0 loc_115F: mov edx, eax imul edx, eax imul edx, edx add ecx, edx add eax, 2 cmp eax, esi jnz short loc_115F loc_1170: mov eax, ecx retn loc_1173: mov ecx, 0 jmp short loc_1170
long long func0(int a1) { int v1; // eax unsigned int v2; // ecx if ( a1 <= 0 ) { return 0; } else { v1 = 1; v2 = 0; do { v2 += v1 * v1 * v1 * v1; v1 += 2; } while ( v1 != 2 * a1 + 1 ); } return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101173 LEA ESI,[RDI + RDI*0x1 + 0x1] MOV EAX,0x1 MOV ECX,0x0 LAB_0010115f: MOV EDX,EAX IMUL EDX,EAX IMUL EDX,EDX ADD ECX,EDX ADD EAX,0x2 CMP EAX,ESI JNZ 0x0010115f LAB_00101170: MOV EAX,ECX RET LAB_00101173: MOV ECX,0x0 JMP 0x00101170
int func0(int param_1) { int iVar1; int iVar2; if (param_1 < 1) { iVar2 = 0; } else { iVar1 = 1; iVar2 = 0; do { iVar2 = iVar2 + iVar1 * iVar1 * iVar1 * iVar1; iVar1 = iVar1 + 2; } while (iVar1 != param_1 * 2 + 1); } return iVar2; }
6,974
func0
#include <assert.h>
int func0(int n) { int j = 0; int sm = 0; for (int i = 1; i <= n; ++i) { j = (2 * i - 1); sm += (j * j * j * j); } return sm; }
int main() { assert(func0(2) == 82); assert(func0(3) == 707); assert(func0(4) == 3108); return 0; }
O2
c
func0: endbr64 test %edi,%edi jle 1170 <func0+0x30> lea 0x1(%rdi,%rdi,1),%ecx mov $0x1,%eax xor %r8d,%r8d nopl 0x0(%rax) mov %eax,%edx imul %eax,%edx add $0x2,%eax imul %edx,%edx add %edx,%r8d cmp %ecx,%eax jne 1158 <func0+0x18> mov %r8d,%eax retq xchg %ax,%ax xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 test edi, edi jle short loc_1170 lea ecx, [rdi+rdi+1] mov eax, 1 xor r8d, r8d nop dword ptr [rax+00h] loc_1158: mov edx, eax imul edx, eax add eax, 2 imul edx, edx add r8d, edx cmp eax, ecx jnz short loc_1158 mov eax, r8d retn loc_1170: xor r8d, r8d mov eax, r8d retn
long long func0(int a1) { int v1; // eax unsigned int v2; // r8d int v3; // edx if ( a1 <= 0 ) return 0LL; v1 = 1; v2 = 0; do { v3 = v1 * v1; v1 += 2; v2 += v3 * v3; } while ( v1 != 2 * a1 + 1 ); return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101170 LEA ECX,[RDI + RDI*0x1 + 0x1] MOV EAX,0x1 XOR R8D,R8D NOP dword ptr [RAX] LAB_00101158: MOV EDX,EAX IMUL EDX,EAX ADD EAX,0x2 IMUL EDX,EDX ADD R8D,EDX CMP EAX,ECX JNZ 0x00101158 MOV EAX,R8D RET LAB_00101170: XOR R8D,R8D MOV EAX,R8D RET
int func0(int param_1) { int iVar1; int iVar2; int iVar3; if (0 < param_1) { iVar1 = 1; iVar3 = 0; do { iVar2 = iVar1 * iVar1; iVar1 = iVar1 + 2; iVar3 = iVar3 + iVar2 * iVar2; } while (iVar1 != param_1 * 2 + 1); return iVar3; } return 0; }
6,975
func0
#include <assert.h>
int func0(int n) { int j = 0; int sm = 0; for (int i = 1; i <= n; ++i) { j = (2 * i - 1); sm += (j * j * j * j); } return sm; }
int main() { assert(func0(2) == 82); assert(func0(3) == 707); assert(func0(4) == 3108); return 0; }
O3
c
func0: endbr64 test %edi,%edi jle 1260 <func0+0x120> lea -0x1(%rdi),%eax cmp $0x29,%eax jbe 1267 <func0+0x127> mov %edi,%edx movdqa 0xeae(%rip),%xmm5 xor %eax,%eax pxor %xmm4,%xmm4 movdqa 0xeb0(%rip),%xmm7 shr $0x2,%edx pcmpeqd %xmm6,%xmm6 nopw 0x0(%rax,%rax,1) movdqa %xmm5,%xmm0 add $0x1,%eax paddd %xmm7,%xmm5 pslld $0x1,%xmm0 paddd %xmm6,%xmm0 movdqa %xmm0,%xmm8 movdqa %xmm0,%xmm3 psrlq $0x20,%xmm8 pmuludq %xmm0,%xmm3 movdqa %xmm8,%xmm1 pmuludq %xmm8,%xmm1 pshufd $0x8,%xmm3,%xmm3 pshufd $0x8,%xmm1,%xmm1 punpckldq %xmm1,%xmm3 movdqa %xmm3,%xmm2 psrlq $0x20,%xmm3 pmuludq %xmm0,%xmm2 pmuludq %xmm8,%xmm3 pshufd $0x8,%xmm2,%xmm1 pshufd $0x8,%xmm3,%xmm3 punpckldq %xmm3,%xmm1 pmuludq %xmm1,%xmm0 psrlq $0x20,%xmm1 pmuludq %xmm8,%xmm1 pshufd $0x8,%xmm0,%xmm0 pshufd $0x8,%xmm1,%xmm1 punpckldq %xmm1,%xmm0 paddd %xmm0,%xmm4 cmp %edx,%eax jne 1180 <func0+0x40> movdqa %xmm4,%xmm0 mov %edi,%eax psrldq $0x8,%xmm0 and $0xfffffffc,%eax paddd %xmm0,%xmm4 lea 0x1(%rax),%ecx movdqa %xmm4,%xmm0 psrldq $0x4,%xmm0 paddd %xmm0,%xmm4 movd %xmm4,%r8d cmp %eax,%edi je 1255 <func0+0x115> lea -0x1(%rcx,%rcx,1),%edx nopw %cs:0x0(%rax,%rax,1) mov %edx,%eax add $0x1,%ecx imul %edx,%eax add $0x2,%edx imul %eax,%eax add %eax,%r8d cmp %ecx,%edi jge 1240 <func0+0x100> mov %r8d,%eax retq nopl 0x0(%rax) xor %r8d,%r8d mov %r8d,%eax retq mov $0x1,%ecx xor %r8d,%r8d jmp 1232 <func0+0xf2> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 test edi, edi jle loc_1250 lea eax, [rdi-1] cmp eax, 19h jbe loc_1255 mov edx, edi movdqa xmm4, cs:xmmword_2010 xor eax, eax pxor xmm3, xmm3 movdqa xmm6, cs:xmmword_2020 shr edx, 2 pcmpeqd xmm5, xmm5 nop word ptr [rax+rax+00000000h] loc_1180: movdqa xmm0, xmm4 add eax, 1 paddd xmm4, xmm6 pslld xmm0, 1 paddd xmm0, xmm5 movdqa xmm7, xmm0 movdqa xmm2, xmm0 psrlq xmm7, 20h ; ' ' pmuludq xmm2, xmm0 movdqa xmm1, xmm7 pmuludq xmm1, xmm7 pshufd xmm2, xmm2, 8 pshufd xmm1, xmm1, 8 punpckldq xmm2, xmm1 movdqa xmm1, xmm2 psrlq xmm2, 20h ; ' ' pmuludq xmm1, xmm0 pmuludq xmm2, xmm7 pshufd xmm1, xmm1, 8 pshufd xmm2, xmm2, 8 punpckldq xmm1, xmm2 pmuludq xmm0, xmm1 psrlq xmm1, 20h ; ' ' pmuludq xmm1, xmm7 pshufd xmm0, xmm0, 8 pshufd xmm1, xmm1, 8 punpckldq xmm0, xmm1 paddd xmm3, xmm0 cmp eax, edx jnz short loc_1180 movdqa xmm0, xmm3 mov esi, edi psrldq xmm0, 8 and esi, 0FFFFFFFCh paddd xmm3, xmm0 add esi, 1 movdqa xmm0, xmm3 psrldq xmm0, 4 paddd xmm3, xmm0 movd edx, xmm3 test dil, 3 jz short loc_1244 loc_1229: lea ecx, [rsi+rsi-1] nop dword ptr [rax] loc_1230: mov eax, ecx add esi, 1 imul eax, ecx add ecx, 2 imul eax, eax add edx, eax cmp edi, esi jge short loc_1230 loc_1244: mov eax, edx retn loc_1250: xor edx, edx mov eax, edx retn loc_1255: mov esi, 1 xor edx, edx jmp short loc_1229
long long func0(int a1) { __m128i si128; // xmm4 int v2; // eax __m128i v3; // xmm3 __m128i v4; // xmm6 __m128i v5; // xmm0 __m128i v6; // xmm0 __m128i v7; // xmm7 __m128i v8; // xmm1 __m128i v9; // xmm1 __m128i v10; // xmm3 signed int v11; // esi unsigned int v12; // edx int v13; // ecx int v14; // eax if ( a1 > 0 ) { if ( (unsigned int)(a1 - 1) <= 0x19 ) { v11 = 1; v12 = 0; } else { si128 = _mm_load_si128((const __m128i *)&xmmword_2010); v2 = 0; v3 = 0LL; v4 = _mm_load_si128((const __m128i *)&xmmword_2020); do { v5 = si128; ++v2; si128 = _mm_add_epi32(si128, v4); v6 = _mm_add_epi32(_mm_slli_epi32(v5, 1u), (__m128i)-1LL); v7 = _mm_srli_epi64(v6, 0x20u); v8 = _mm_unpacklo_epi32( _mm_shuffle_epi32(_mm_mul_epu32(v6, v6), 8), _mm_shuffle_epi32(_mm_mul_epu32(v7, v7), 8)); v9 = _mm_unpacklo_epi32( _mm_shuffle_epi32(_mm_mul_epu32(v8, v6), 8), _mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_epi64(v8, 0x20u), v7), 8)); v3 = _mm_add_epi32( v3, _mm_unpacklo_epi32( _mm_shuffle_epi32(_mm_mul_epu32(v6, v9), 8), _mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_epi64(v9, 0x20u), v7), 8))); } while ( v2 != (unsigned int)a1 >> 2 ); v10 = _mm_add_epi32(v3, _mm_srli_si128(v3, 8)); v11 = (a1 & 0xFFFFFFFC) + 1; v12 = _mm_cvtsi128_si32(_mm_add_epi32(v10, _mm_srli_si128(v10, 4))); if ( (a1 & 3) == 0 ) return v12; } v13 = 2 * v11 - 1; do { ++v11; v14 = v13 * v13; v13 += 2; v12 += v14 * v14; } while ( a1 >= v11 ); return v12; } return 0LL; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101250 LEA EAX,[RDI + -0x1] CMP EAX,0x19 JBE 0x00101255 MOV EDX,EDI MOVDQA XMM4,xmmword ptr [0x00102010] XOR EAX,EAX PXOR XMM3,XMM3 MOVDQA XMM6,xmmword ptr [0x00102020] SHR EDX,0x2 PCMPEQD XMM5,XMM5 NOP word ptr [RAX + RAX*0x1] LAB_00101180: MOVDQA XMM0,XMM4 ADD EAX,0x1 PADDD XMM4,XMM6 PSLLD XMM0,0x1 PADDD XMM0,XMM5 MOVDQA XMM7,XMM0 MOVDQA XMM2,XMM0 PSRLQ XMM7,0x20 PMULUDQ XMM2,XMM0 MOVDQA XMM1,XMM7 PMULUDQ XMM1,XMM7 PSHUFD XMM2,XMM2,0x8 PSHUFD XMM1,XMM1,0x8 PUNPCKLDQ XMM2,XMM1 MOVDQA XMM1,XMM2 PSRLQ XMM2,0x20 PMULUDQ XMM1,XMM0 PMULUDQ XMM2,XMM7 PSHUFD XMM1,XMM1,0x8 PSHUFD XMM2,XMM2,0x8 PUNPCKLDQ XMM1,XMM2 PMULUDQ XMM0,XMM1 PSRLQ XMM1,0x20 PMULUDQ XMM1,XMM7 PSHUFD XMM0,XMM0,0x8 PSHUFD XMM1,XMM1,0x8 PUNPCKLDQ XMM0,XMM1 PADDD XMM3,XMM0 CMP EAX,EDX JNZ 0x00101180 MOVDQA XMM0,XMM3 MOV ESI,EDI PSRLDQ XMM0,0x8 AND ESI,0xfffffffc PADDD XMM3,XMM0 ADD ESI,0x1 MOVDQA XMM0,XMM3 PSRLDQ XMM0,0x4 PADDD XMM3,XMM0 MOVD EDX,XMM3 TEST DIL,0x3 JZ 0x00101244 LAB_00101229: LEA ECX,[RSI + RSI*0x1 + -0x1] NOP dword ptr [RAX] LAB_00101230: MOV EAX,ECX ADD ESI,0x1 IMUL EAX,ECX ADD ECX,0x2 IMUL EAX,EAX ADD EDX,EAX CMP EDI,ESI JGE 0x00101230 LAB_00101244: MOV EAX,EDX RET LAB_00101250: XOR EDX,EDX MOV EAX,EDX RET LAB_00101255: MOV ESI,0x1 XOR EDX,EDX JMP 0x00101229
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ int func0(uint param_1) { uint uVar1; int iVar2; int iVar3; int iVar4; int auVar5 [16]; int auVar6 [16]; long lVar8; int auVar7 [16]; int iVar9; int iVar10; int iVar11; int iVar12; int iVar13; ulong uVar14; if ((int)param_1 < 1) { return 0; } if (param_1 - 1 < 0x1a) { iVar4 = 1; iVar10 = 0; } else { uVar1 = 0; iVar9 = 0; iVar11 = 0; iVar12 = 0; iVar13 = 0; iVar10 = _DAT_00102010; iVar4 = _UNK_00102014; iVar3 = _UNK_00102018; iVar2 = _UNK_0010201c; do { uVar1 = uVar1 + 1; auVar5._0_4_ = iVar10 * 2 + -1; auVar5._4_4_ = iVar4 * 2 + -1; auVar5._8_4_ = iVar3 * 2 - 1; auVar5._12_4_ = iVar2 * 2 - 1; uVar14 = auVar5._8_8_; lVar8 = (uVar14 & 0xffffffff) * (ulong)auVar5._8_4_; auVar7._8_4_ = (int4)lVar8; auVar7._0_8_ = lVar8 << 0x20; auVar7._12_4_ = (int)((uVar14 >> 0x20) * (ulong)auVar5._12_4_); lVar8 = (auVar7._8_8_ & 0xffffffff) * (ulong)auVar5._8_4_; auVar6._8_4_ = (int4)lVar8; auVar6._0_8_ = lVar8 << 0x20; auVar6._12_4_ = (int)((auVar7._8_8_ >> 0x20) * (ulong)auVar5._12_4_); iVar9 = iVar9 + auVar5._0_4_ * auVar5._0_4_ * auVar5._0_4_ * auVar5._0_4_; iVar11 = iVar11 + auVar5._4_4_ * auVar5._4_4_ * auVar5._4_4_ * auVar5._4_4_; iVar12 = iVar12 + (int)((uVar14 & 0xffffffff) * (auVar6._8_8_ & 0xffffffff)); iVar13 = iVar13 + (int)((auVar6._8_8_ >> 0x20) * (ulong)auVar5._12_4_); iVar10 = iVar10 + _DAT_00102020; iVar4 = iVar4 + _UNK_00102024; iVar3 = iVar3 + _UNK_00102028; iVar2 = iVar2 + _UNK_0010202c; } while (uVar1 != param_1 >> 2); iVar4 = (param_1 & 0xfffffffc) + 1; iVar10 = iVar9 + iVar12 + iVar11 + iVar13; if ((param_1 & 3) == 0) { return iVar10; } } iVar3 = iVar4 * 2 + -1; do { iVar4 = iVar4 + 1; iVar2 = iVar3 * iVar3; iVar3 = iVar3 + 2; iVar10 = iVar10 + iVar2 * iVar2; } while (iVar4 <= (int)param_1); return iVar10; }
6,976
func0
#include <stdio.h> #include <stdbool.h> #include <assert.h> #include <string.h>
bool func0(const char *exp) { int len = strlen(exp); if (len % 2 != 0) { return false; } char stack[100]; int top = -1; for (int i = 0; i < len; i++) { char ch = exp[i]; if (ch == '(' || ch == '{' || ch == '[') { stack[++top] = ch; } else if (ch == ')' || ch == '}' || ch == ']') { if (top == -1) { return false; } char last_open = stack[top--]; if ((last_open == '(' && ch != ')') || (last_open == '{' && ch != '}') || (last_open == '[' && ch != ']')) { return false; } } } return top == -1; }
int main() { assert(func0("{()}[{}]") == true); assert(func0("{()}[{]") == false); assert(func0("{()}[{}][]({})") == true); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x90,%rsp mov %rdi,-0x88(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax mov -0x88(%rbp),%rax mov %rax,%rdi callq 1070 <strlen@plt> mov %eax,-0x74(%rbp) mov -0x74(%rbp),%eax and $0x1,%eax test %eax,%eax je 11d4 <func0+0x4b> mov $0x0,%eax jmpq 1296 <func0+0x10d> movl $0xffffffff,-0x7c(%rbp) movl $0x0,-0x78(%rbp) jmpq 1283 <func0+0xfa> mov -0x78(%rbp),%eax movslq %eax,%rdx mov -0x88(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax mov %al,-0x7e(%rbp) cmpb $0x28,-0x7e(%rbp) je 120f <func0+0x86> cmpb $0x7b,-0x7e(%rbp) je 120f <func0+0x86> cmpb $0x5b,-0x7e(%rbp) jne 1222 <func0+0x99> addl $0x1,-0x7c(%rbp) mov -0x7c(%rbp),%eax cltq movzbl -0x7e(%rbp),%edx mov %dl,-0x70(%rbp,%rax,1) jmp 127f <func0+0xf6> cmpb $0x29,-0x7e(%rbp) je 1234 <func0+0xab> cmpb $0x7d,-0x7e(%rbp) je 1234 <func0+0xab> cmpb $0x5d,-0x7e(%rbp) jne 127f <func0+0xf6> cmpl $0xffffffff,-0x7c(%rbp) jne 1241 <func0+0xb8> mov $0x0,%eax jmp 1296 <func0+0x10d> mov -0x7c(%rbp),%eax lea -0x1(%rax),%edx mov %edx,-0x7c(%rbp) cltq movzbl -0x70(%rbp,%rax,1),%eax mov %al,-0x7d(%rbp) cmpb $0x28,-0x7d(%rbp) jne 1260 <func0+0xd7> cmpb $0x29,-0x7e(%rbp) jne 1278 <func0+0xef> cmpb $0x7b,-0x7d(%rbp) jne 126c <func0+0xe3> cmpb $0x7d,-0x7e(%rbp) jne 1278 <func0+0xef> cmpb $0x5b,-0x7d(%rbp) jne 127f <func0+0xf6> cmpb $0x5d,-0x7e(%rbp) je 127f <func0+0xf6> mov $0x0,%eax jmp 1296 <func0+0x10d> addl $0x1,-0x78(%rbp) mov -0x78(%rbp),%eax cmp -0x74(%rbp),%eax jl 11e7 <func0+0x5e> cmpl $0xffffffff,-0x7c(%rbp) sete %al mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 12aa <func0+0x121> callq 1080 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 90h mov [rbp+s], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov rax, [rbp+s] mov rdi, rax; s call _strlen mov [rbp+var_74], eax mov eax, [rbp+var_74] and eax, 1 test eax, eax jz short loc_11D4 mov eax, 0 jmp loc_1296 loc_11D4: mov [rbp+var_7C], 0FFFFFFFFh mov [rbp+var_78], 0 jmp loc_1283 loc_11E7: mov eax, [rbp+var_78] movsxd rdx, eax mov rax, [rbp+s] add rax, rdx movzx eax, byte ptr [rax] mov [rbp+var_7E], al cmp [rbp+var_7E], 28h ; '(' jz short loc_120F cmp [rbp+var_7E], 7Bh ; '{' jz short loc_120F cmp [rbp+var_7E], 5Bh ; '[' jnz short loc_1222 loc_120F: add [rbp+var_7C], 1 mov eax, [rbp+var_7C] cdqe movzx edx, [rbp+var_7E] mov [rbp+rax+var_70], dl jmp short loc_127F loc_1222: cmp [rbp+var_7E], 29h ; ')' jz short loc_1234 cmp [rbp+var_7E], 7Dh ; '}' jz short loc_1234 cmp [rbp+var_7E], 5Dh ; ']' jnz short loc_127F loc_1234: cmp [rbp+var_7C], 0FFFFFFFFh jnz short loc_1241 mov eax, 0 jmp short loc_1296 loc_1241: mov eax, [rbp+var_7C] lea edx, [rax-1] mov [rbp+var_7C], edx cdqe movzx eax, [rbp+rax+var_70] mov [rbp+var_7D], al cmp [rbp+var_7D], 28h ; '(' jnz short loc_1260 cmp [rbp+var_7E], 29h ; ')' jnz short loc_1278 loc_1260: cmp [rbp+var_7D], 7Bh ; '{' jnz short loc_126C cmp [rbp+var_7E], 7Dh ; '}' jnz short loc_1278 loc_126C: cmp [rbp+var_7D], 5Bh ; '[' jnz short loc_127F cmp [rbp+var_7E], 5Dh ; ']' jz short loc_127F loc_1278: mov eax, 0 jmp short loc_1296 loc_127F: add [rbp+var_78], 1 loc_1283: mov eax, [rbp+var_78] cmp eax, [rbp+var_74] jl loc_11E7 cmp [rbp+var_7C], 0FFFFFFFFh setz al loc_1296: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_12AA call ___stack_chk_fail locret_12AA: leave retn
bool func0(const char *a1) { int v2; // eax char v3; // [rsp+12h] [rbp-7Eh] char v4; // [rsp+13h] [rbp-7Dh] int v5; // [rsp+14h] [rbp-7Ch] int i; // [rsp+18h] [rbp-78h] int v7; // [rsp+1Ch] [rbp-74h] _BYTE v8[104]; // [rsp+20h] [rbp-70h] unsigned long long v9; // [rsp+88h] [rbp-8h] v9 = __readfsqword(0x28u); v7 = strlen(a1); if ( (v7 & 1) != 0 ) return 0; v5 = -1; for ( i = 0; i < v7; ++i ) { v3 = a1[i]; if ( v3 == 40 || v3 == 123 || v3 == 91 ) { v8[++v5] = v3; } else if ( v3 == 41 || v3 == 125 || v3 == 93 ) { if ( v5 == -1 ) return 0; v2 = v5--; v4 = v8[v2]; if ( v4 == 40 && v3 != 41 ) return 0; if ( v4 == 123 && v3 != 125 || v4 == 91 && v3 != 93 ) return 0; } } return v5 == -1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x90 MOV qword ptr [RBP + -0x88],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV RAX,qword ptr [RBP + -0x88] MOV RDI,RAX CALL 0x00101070 MOV dword ptr [RBP + -0x74],EAX MOV EAX,dword ptr [RBP + -0x74] AND EAX,0x1 TEST EAX,EAX JZ 0x001011d4 MOV EAX,0x0 JMP 0x00101296 LAB_001011d4: MOV dword ptr [RBP + -0x7c],0xffffffff MOV dword ptr [RBP + -0x78],0x0 JMP 0x00101283 LAB_001011e7: MOV EAX,dword ptr [RBP + -0x78] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x88] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] MOV byte ptr [RBP + -0x7e],AL CMP byte ptr [RBP + -0x7e],0x28 JZ 0x0010120f CMP byte ptr [RBP + -0x7e],0x7b JZ 0x0010120f CMP byte ptr [RBP + -0x7e],0x5b JNZ 0x00101222 LAB_0010120f: ADD dword ptr [RBP + -0x7c],0x1 MOV EAX,dword ptr [RBP + -0x7c] CDQE MOVZX EDX,byte ptr [RBP + -0x7e] MOV byte ptr [RBP + RAX*0x1 + -0x70],DL JMP 0x0010127f LAB_00101222: CMP byte ptr [RBP + -0x7e],0x29 JZ 0x00101234 CMP byte ptr [RBP + -0x7e],0x7d JZ 0x00101234 CMP byte ptr [RBP + -0x7e],0x5d JNZ 0x0010127f LAB_00101234: CMP dword ptr [RBP + -0x7c],-0x1 JNZ 0x00101241 MOV EAX,0x0 JMP 0x00101296 LAB_00101241: MOV EAX,dword ptr [RBP + -0x7c] LEA EDX,[RAX + -0x1] MOV dword ptr [RBP + -0x7c],EDX CDQE MOVZX EAX,byte ptr [RBP + RAX*0x1 + -0x70] MOV byte ptr [RBP + -0x7d],AL CMP byte ptr [RBP + -0x7d],0x28 JNZ 0x00101260 CMP byte ptr [RBP + -0x7e],0x29 JNZ 0x00101278 LAB_00101260: CMP byte ptr [RBP + -0x7d],0x7b JNZ 0x0010126c CMP byte ptr [RBP + -0x7e],0x7d JNZ 0x00101278 LAB_0010126c: CMP byte ptr [RBP + -0x7d],0x5b JNZ 0x0010127f CMP byte ptr [RBP + -0x7e],0x5d JZ 0x0010127f LAB_00101278: MOV EAX,0x0 JMP 0x00101296 LAB_0010127f: ADD dword ptr [RBP + -0x78],0x1 LAB_00101283: MOV EAX,dword ptr [RBP + -0x78] CMP EAX,dword ptr [RBP + -0x74] JL 0x001011e7 CMP dword ptr [RBP + -0x7c],-0x1 SETZ AL LAB_00101296: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001012aa CALL 0x00101080 LAB_001012aa: LEAVE RET
int4 func0(char *param_1) { int iVar1; char cVar2; char cVar3; int4 uVar4; size_t sVar5; long in_FS_OFFSET; int local_84; int local_80; char acStack_78 [104]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); sVar5 = strlen(param_1); if ((sVar5 & 1) == 0) { local_84 = -1; for (local_80 = 0; local_80 < (int)sVar5; local_80 = local_80 + 1) { cVar2 = param_1[local_80]; if (((cVar2 == '(') || (cVar2 == '{')) || (cVar2 == '[')) { acStack_78[local_84 + 1] = cVar2; local_84 = local_84 + 1; } else if (((cVar2 == ')') || (cVar2 == '}')) || (cVar2 == ']')) { if (local_84 == -1) { uVar4 = 0; goto LAB_00101296; } iVar1 = local_84 + -1; cVar3 = acStack_78[local_84]; if (((cVar3 == '(') && (cVar2 != ')')) || (((cVar3 == '{' && (cVar2 != '}')) || ((local_84 = iVar1, cVar3 == '[' && (cVar2 != ']')))))) { uVar4 = 0; goto LAB_00101296; } } } uVar4 = CONCAT31((int3)((uint)local_80 >> 8),local_84 == -1); } else { uVar4 = 0; } LAB_00101296: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return uVar4; }
6,977
func0
#include <stdio.h> #include <stdbool.h> #include <assert.h> #include <string.h>
bool func0(const char *exp) { int len = strlen(exp); if (len % 2 != 0) { return false; } char stack[100]; int top = -1; for (int i = 0; i < len; i++) { char ch = exp[i]; if (ch == '(' || ch == '{' || ch == '[') { stack[++top] = ch; } else if (ch == ')' || ch == '}' || ch == ']') { if (top == -1) { return false; } char last_open = stack[top--]; if ((last_open == '(' && ch != ')') || (last_open == '{' && ch != '}') || (last_open == '[' && ch != ']')) { return false; } } } return top == -1; }
int main() { assert(func0("{()}[{}]") == true); assert(func0("{()}[{]") == false); assert(func0("{()}[{}][]({})") == true); return 0; }
O1
c
func0: endbr64 sub $0x78,%rsp mov %rdi,%rdx mov %fs:0x28,%rax mov %rax,0x68(%rsp) xor %eax,%eax mov $0xffffffffffffffff,%rcx repnz scas %es:(%rdi),%al not %rcx test $0x1,%cl je 1243 <func0+0xda> lea -0x1(%rcx),%rsi test %esi,%esi jle 1238 <func0+0xcf> mov %rdx,%rcx lea -0x1(%rsi),%eax lea 0x1(%rdx,%rax,1),%r9 mov $0xffffffff,%esi jmp 1210 <func0+0xa7> cmp $0x29,%dl je 11c2 <func0+0x59> cmp $0x5d,%r8b jne 1207 <func0+0x9e> cmp $0xffffffff,%esi je 1243 <func0+0xda> lea -0x1(%rsi),%r10d movslq %esi,%rsi movzbl (%rsp,%rsi,1),%edi cmp $0x28,%dil sete %sil cmp $0x29,%dl setne %r8b and %r8b,%sil jne 1243 <func0+0xda> cmp $0x7b,%dil sete %al cmp $0x7d,%dl setne %r8b and %r8b,%al jne 1258 <func0+0xef> cmp $0x5b,%dil jne 1204 <func0+0x9b> cmp $0x5d,%dl jne 1243 <func0+0xda> mov %r10d,%esi add $0x1,%rcx cmp %r9,%rcx je 123d <func0+0xd4> movzbl (%rcx),%edx mov %edx,%r8d and $0xffffffdf,%r8d cmp $0x28,%dl sete %al cmp $0x5b,%r8b sete %dil or %dil,%al je 11b7 <func0+0x4e> add $0x1,%esi movslq %esi,%rax mov %dl,(%rsp,%rax,1) jmp 1207 <func0+0x9e> mov $0xffffffff,%esi cmp $0xffffffff,%esi sete %al mov 0x68(%rsp),%rdi xor %fs:0x28,%rdi jne 125c <func0+0xf3> add $0x78,%rsp retq mov %esi,%eax jmp 1243 <func0+0xda> callq 1060 <__stack_chk_fail@plt>
func0: endbr64 push rbx sub rsp, 70h mov rbx, rdi mov rax, fs:28h mov [rsp+78h+var_10], rax xor eax, eax call _strlen mov rdx, rax mov eax, 0 test dl, 1 jnz loc_1261 test edx, edx jle loc_1256 mov rcx, rbx lea eax, [rdx-1] lea r9, [rbx+rax+1] mov esi, 0FFFFFFFFh jmp short loc_11E7 loc_11D5: add esi, 1 movsxd rax, esi mov [rsp+rax+78h+var_78], dl loc_11DE: add rcx, 1 cmp rcx, r9 jz short loc_125B loc_11E7: movzx edx, byte ptr [rcx] mov r8d, edx and r8d, 0FFFFFFDFh cmp dl, 28h ; '(' setz al cmp r8b, 5Bh ; '[' setz dil or al, dil jnz short loc_11D5 cmp dl, 29h ; ')' jz short loc_120F cmp r8b, 5Dh ; ']' jnz short loc_11DE loc_120F: cmp esi, 0FFFFFFFFh jz short loc_1261 lea r10d, [rsi-1] movsxd rsi, esi movzx edi, [rsp+rsi+78h+var_78] cmp dil, 28h ; '(' setz sil cmp dl, 29h ; ')' setnz r8b and sil, r8b jnz short loc_1261 cmp dil, 7Bh ; '{' setz al cmp dl, 7Dh ; '}' setnz r8b and al, r8b jnz short loc_1277 cmp dil, 5Bh ; '[' jnz short loc_1251 cmp dl, 5Dh ; ']' jnz short loc_1261 loc_1251: mov esi, r10d jmp short loc_11DE loc_1256: mov esi, 0FFFFFFFFh loc_125B: cmp esi, 0FFFFFFFFh setz al loc_1261: mov rdx, [rsp+78h+var_10] sub rdx, fs:28h jnz short loc_127B add rsp, 70h pop rbx retn loc_1277: mov eax, esi jmp short loc_1261 loc_127B: call ___stack_chk_fail
bool func0(char *a1) { int v1; // edx bool result; // al char *v3; // rcx long long v4; // r9 int v5; // esi char v6; // dl char v7; // di _BYTE v8[104]; // [rsp+0h] [rbp-78h] unsigned long long v9; // [rsp+68h] [rbp-10h] v9 = __readfsqword(0x28u); v1 = strlen(); result = 0; if ( (v1 & 1) == 0 ) { if ( v1 > 0 ) { v3 = a1; v4 = (long long)&a1[v1 - 1 + 1]; v5 = -1; while ( 1 ) { v6 = *v3; result = (*v3 & 0xDF) == 91 || *v3 == 40; if ( result ) { v8[++v5] = v6; } else if ( v6 == 41 || (*v3 & 0xDF) == 0x5D ) { if ( v5 == -1 ) return result; v7 = v8[v5]; if ( v6 != 41 && v7 == 40 ) return result; result = v6 != 125 && v7 == 123; if ( result ) return v6 != 41 && v7 == 40; if ( v7 == 91 && v6 != 93 ) return result; --v5; } if ( ++v3 == (char *)v4 ) return v5 == -1; } } v5 = -1; return v5 == -1; } return result; }
func0: ENDBR64 PUSH RBX SUB RSP,0x70 MOV RBX,RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x68],RAX XOR EAX,EAX CALL 0x00101070 MOV RDX,RAX MOV EAX,0x0 TEST DL,0x1 JNZ 0x00101261 TEST EDX,EDX JLE 0x00101256 MOV RCX,RBX LEA EAX,[RDX + -0x1] LEA R9,[RBX + RAX*0x1 + 0x1] MOV ESI,0xffffffff JMP 0x001011e7 LAB_001011d5: ADD ESI,0x1 MOVSXD RAX,ESI MOV byte ptr [RSP + RAX*0x1],DL LAB_001011de: ADD RCX,0x1 CMP RCX,R9 JZ 0x0010125b LAB_001011e7: MOVZX EDX,byte ptr [RCX] MOV R8D,EDX AND R8D,0xffffffdf CMP DL,0x28 SETZ AL CMP R8B,0x5b SETZ DIL OR AL,DIL JNZ 0x001011d5 CMP DL,0x29 JZ 0x0010120f CMP R8B,0x5d JNZ 0x001011de LAB_0010120f: CMP ESI,-0x1 JZ 0x00101261 LEA R10D,[RSI + -0x1] MOVSXD RSI,ESI MOVZX EDI,byte ptr [RSP + RSI*0x1] CMP DIL,0x28 SETZ SIL CMP DL,0x29 SETNZ R8B AND SIL,R8B JNZ 0x00101261 CMP DIL,0x7b SETZ AL CMP DL,0x7d SETNZ R8B AND AL,R8B JNZ 0x00101277 CMP DIL,0x5b JNZ 0x00101251 CMP DL,0x5d JNZ 0x00101261 LAB_00101251: MOV ESI,R10D JMP 0x001011de LAB_00101256: MOV ESI,0xffffffff LAB_0010125b: CMP ESI,-0x1 SETZ AL LAB_00101261: MOV RDX,qword ptr [RSP + 0x68] SUB RDX,qword ptr FS:[0x28] JNZ 0x0010127b ADD RSP,0x70 POP RBX RET LAB_00101277: MOV EAX,ESI JMP 0x00101261 LAB_0010127b: CALL 0x00101080
ulong func0(byte *param_1) { byte *pbVar1; byte bVar2; byte bVar3; bool bVar4; bool bVar5; size_t sVar6; ulong uVar7; int7 uVar8; int iVar9; int iVar10; long in_FS_OFFSET; byte local_78 [104]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); sVar6 = strlen((char *)param_1); uVar7 = 0; if ((sVar6 & 1) == 0) { if ((int)sVar6 < 1) { iVar9 = -1; } else { uVar7 = (ulong)((int)sVar6 - 1); pbVar1 = param_1 + uVar7 + 1; iVar10 = -1; do { bVar2 = *param_1; uVar8 = (int7)(uVar7 >> 8); bVar4 = bVar2 == 0x28 || (bVar2 & 0xdf) == 0x5b; uVar7 = CONCAT71(uVar8,bVar4); if (bVar4) { iVar9 = iVar10 + 1; uVar7 = (ulong)iVar9; local_78[uVar7] = bVar2; } else if ((bVar2 == 0x29) || (iVar9 = iVar10, (bVar2 & 0xdf) == 0x5d)) { if (iVar10 == -1) goto LAB_00101261; iVar9 = iVar10 + -1; bVar3 = local_78[iVar10]; bVar4 = bVar3 == 0x28 && bVar2 != 0x29; if (bVar4) goto LAB_00101261; bVar5 = bVar3 == 0x7b && bVar2 != 0x7d; uVar7 = CONCAT71(uVar8,bVar5); if (bVar5) { uVar7 = CONCAT71((int7)(int3)((uint)iVar10 >> 8),bVar4) & 0xffffffff; goto LAB_00101261; } if ((bVar3 == 0x5b) && (bVar2 != 0x5d)) goto LAB_00101261; } param_1 = param_1 + 1; iVar10 = iVar9; } while (param_1 != pbVar1); } uVar7 = CONCAT71((int7)(uVar7 >> 8),iVar9 == -1); } LAB_00101261: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return uVar7; }
6,978
func0
#include <stdio.h> #include <stdbool.h> #include <assert.h> #include <string.h>
bool func0(const char *exp) { int len = strlen(exp); if (len % 2 != 0) { return false; } char stack[100]; int top = -1; for (int i = 0; i < len; i++) { char ch = exp[i]; if (ch == '(' || ch == '{' || ch == '[') { stack[++top] = ch; } else if (ch == ')' || ch == '}' || ch == ']') { if (top == -1) { return false; } char last_open = stack[top--]; if ((last_open == '(' && ch != ')') || (last_open == '{' && ch != '}') || (last_open == '[' && ch != ']')) { return false; } } } return top == -1; }
int main() { assert(func0("{()}[{}]") == true); assert(func0("{()}[{]") == false); assert(func0("{()}[{}][]({})") == true); return 0; }
O2
c
func0: endbr64 push %rbx mov %rdi,%rbx sub $0x70,%rsp mov %fs:0x28,%rax mov %rax,0x68(%rsp) xor %eax,%eax callq 1070 <strlen@plt> test $0x1,%al jne 12d0 <func0+0xa0> test %eax,%eax jle 12fb <func0+0xcb> sub $0x1,%eax mov %rbx,%rdi mov $0xffffffff,%edx lea 0x1(%rbx,%rax,1),%rsi nopl (%rax) movzbl (%rdi),%eax mov %eax,%ecx and $0xffffffdf,%ecx cmp $0x28,%al je 12f0 <func0+0xc0> cmp $0x5b,%cl je 12f0 <func0+0xc0> cmp $0x29,%al je 128a <func0+0x5a> cmp $0x5d,%cl jne 12b6 <func0+0x86> cmp $0xffffffff,%edx je 12d0 <func0+0xa0> lea -0x1(%rdx),%ecx movslq %edx,%rdx movzbl (%rsp,%rdx,1),%edx cmp $0x28,%dl jne 12a2 <func0+0x72> cmp $0x29,%al jne 12d0 <func0+0xa0> cmp $0x7b,%dl jne 12ab <func0+0x7b> cmp $0x7d,%al jne 12d0 <func0+0xa0> cmp $0x5b,%dl jne 12b4 <func0+0x84> cmp $0x5d,%al jne 12d0 <func0+0xa0> mov %ecx,%edx add $0x1,%rdi cmp %rdi,%rsi jne 1270 <func0+0x40> cmp $0xffffffff,%edx sete %al jmp 12d2 <func0+0xa2> nopw 0x0(%rax,%rax,1) xor %eax,%eax mov 0x68(%rsp),%rbx xor %fs:0x28,%rbx jne 1302 <func0+0xd2> add $0x70,%rsp pop %rbx retq nopl 0x0(%rax,%rax,1) add $0x1,%edx movslq %edx,%rcx mov %al,(%rsp,%rcx,1) jmp 12b6 <func0+0x86> mov $0x1,%eax jmp 12d2 <func0+0xa2> callq 1080 <__stack_chk_fail@plt> nopw 0x0(%rax,%rax,1)
func0: endbr64 push rbx mov rbx, rdi sub rsp, 70h mov rax, fs:28h mov [rsp+78h+var_10], rax xor eax, eax call _strlen test al, 1 jnz short loc_12D0 test eax, eax jle loc_12FB sub eax, 1 mov rdi, rbx mov edx, 0FFFFFFFFh lea rsi, [rbx+rax+1] nop dword ptr [rax] loc_1270: movzx eax, byte ptr [rdi] mov ecx, eax and ecx, 0FFFFFFDFh cmp al, 28h ; '(' jz short loc_12F0 cmp cl, 5Bh ; '[' jz short loc_12F0 cmp al, 29h ; ')' jz short loc_128A cmp cl, 5Dh ; ']' jnz short loc_12B6 loc_128A: cmp edx, 0FFFFFFFFh jz short loc_12D0 lea ecx, [rdx-1] movsxd rdx, edx movzx edx, [rsp+rdx+78h+var_78] cmp dl, 28h ; '(' jnz short loc_12A2 cmp al, 29h ; ')' jnz short loc_12D0 loc_12A2: cmp dl, 7Bh ; '{' jnz short loc_12AB cmp al, 7Dh ; '}' jnz short loc_12D0 loc_12AB: cmp dl, 5Bh ; '[' jnz short loc_12B4 cmp al, 5Dh ; ']' jnz short loc_12D0 loc_12B4: mov edx, ecx loc_12B6: add rdi, 1 cmp rsi, rdi jnz short loc_1270 cmp edx, 0FFFFFFFFh setz al jmp short loc_12D2 loc_12D0: xor eax, eax loc_12D2: mov rdx, [rsp+78h+var_10] sub rdx, fs:28h jnz short loc_1302 add rsp, 70h pop rbx retn loc_12F0: add edx, 1 movsxd rcx, edx mov [rsp+rcx+78h+var_78], al jmp short loc_12B6 loc_12FB: mov eax, 1 jmp short loc_12D2 loc_1302: call ___stack_chk_fail
bool func0(char *a1) { int v1; // eax int v2; // edx long long v3; // rsi char v4; // al char v5; // cl int v6; // ecx char v7; // dl _BYTE v9[104]; // [rsp+0h] [rbp-78h] unsigned long long v10; // [rsp+68h] [rbp-10h] v10 = __readfsqword(0x28u); v1 = strlen(); if ( (v1 & 1) != 0 ) return 0; if ( v1 <= 0 ) return 1; v2 = -1; v3 = (long long)&a1[v1 - 1 + 1]; do { v4 = *a1; v5 = *a1 & 0xDF; if ( *a1 == 40 || v5 == 91 ) { v9[++v2] = v4; } else if ( v4 == 41 || v5 == 93 ) { if ( v2 == -1 ) return 0; v6 = v2 - 1; v7 = v9[v2]; if ( v7 == 40 && v4 != 41 ) return 0; if ( v7 == 123 && v4 != 125 || v7 == 91 && v4 != 93 ) return 0; v2 = v6; } ++a1; } while ( (char *)v3 != a1 ); return v2 == -1; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI SUB RSP,0x70 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x68],RAX XOR EAX,EAX CALL 0x00101070 TEST AL,0x1 JNZ 0x001012d0 TEST EAX,EAX JLE 0x001012fb SUB EAX,0x1 MOV RDI,RBX MOV EDX,0xffffffff LEA RSI,[RBX + RAX*0x1 + 0x1] NOP dword ptr [RAX] LAB_00101270: MOVZX EAX,byte ptr [RDI] MOV ECX,EAX AND ECX,0xffffffdf CMP AL,0x28 JZ 0x001012f0 CMP CL,0x5b JZ 0x001012f0 CMP AL,0x29 JZ 0x0010128a CMP CL,0x5d JNZ 0x001012b6 LAB_0010128a: CMP EDX,-0x1 JZ 0x001012d0 LEA ECX,[RDX + -0x1] MOVSXD RDX,EDX MOVZX EDX,byte ptr [RSP + RDX*0x1] CMP DL,0x28 JNZ 0x001012a2 CMP AL,0x29 JNZ 0x001012d0 LAB_001012a2: CMP DL,0x7b JNZ 0x001012ab CMP AL,0x7d JNZ 0x001012d0 LAB_001012ab: CMP DL,0x5b JNZ 0x001012b4 CMP AL,0x5d JNZ 0x001012d0 LAB_001012b4: MOV EDX,ECX LAB_001012b6: ADD RDI,0x1 CMP RSI,RDI JNZ 0x00101270 CMP EDX,-0x1 SETZ AL JMP 0x001012d2 LAB_001012d0: XOR EAX,EAX LAB_001012d2: MOV RDX,qword ptr [RSP + 0x68] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101302 ADD RSP,0x70 POP RBX RET LAB_001012f0: ADD EDX,0x1 MOVSXD RCX,EDX MOV byte ptr [RSP + RCX*0x1],AL JMP 0x001012b6 LAB_001012fb: MOV EAX,0x1 JMP 0x001012d2 LAB_00101302: CALL 0x00101080
bool func0(byte *param_1) { int iVar1; byte *pbVar2; byte bVar3; byte bVar4; size_t sVar5; int iVar6; long in_FS_OFFSET; bool bVar7; byte local_78 [104]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); sVar5 = strlen((char *)param_1); if ((sVar5 & 1) == 0) { if ((int)sVar5 < 1) { bVar7 = true; } else { iVar6 = -1; pbVar2 = param_1 + (ulong)((int)sVar5 - 1) + 1; do { bVar3 = *param_1; if ((bVar3 == 0x28) || ((bVar3 & 0xdf) == 0x5b)) { local_78[iVar6 + 1] = bVar3; iVar6 = iVar6 + 1; } else if ((bVar3 == 0x29) || ((bVar3 & 0xdf) == 0x5d)) { if (iVar6 == -1) goto LAB_001012d0; iVar1 = iVar6 + -1; bVar4 = local_78[iVar6]; if ((((bVar4 == 0x28) && (bVar3 != 0x29)) || ((bVar4 == 0x7b && (bVar3 != 0x7d)))) || ((iVar6 = iVar1, bVar4 == 0x5b && (bVar3 != 0x5d)))) goto LAB_001012d0; } param_1 = param_1 + 1; } while (pbVar2 != param_1); bVar7 = iVar6 == -1; } } else { LAB_001012d0: bVar7 = false; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return bVar7; }
6,979
func0
#include <stdio.h> #include <stdbool.h> #include <assert.h> #include <string.h>
bool func0(const char *exp) { int len = strlen(exp); if (len % 2 != 0) { return false; } char stack[100]; int top = -1; for (int i = 0; i < len; i++) { char ch = exp[i]; if (ch == '(' || ch == '{' || ch == '[') { stack[++top] = ch; } else if (ch == ')' || ch == '}' || ch == ']') { if (top == -1) { return false; } char last_open = stack[top--]; if ((last_open == '(' && ch != ')') || (last_open == '{' && ch != '}') || (last_open == '[' && ch != ']')) { return false; } } } return top == -1; }
int main() { assert(func0("{()}[{}]") == true); assert(func0("{()}[{]") == false); assert(func0("{()}[{}][]({})") == true); return 0; }
O3
c
func0: endbr64 push %rbx mov %rdi,%rbx sub $0x70,%rsp mov %fs:0x28,%rax mov %rax,0x68(%rsp) xor %eax,%eax callq 1070 <strlen@plt> test $0x1,%al jne 12d0 <func0+0xa0> test %eax,%eax jle 12fb <func0+0xcb> sub $0x1,%eax mov %rbx,%rdi mov $0xffffffff,%edx lea 0x1(%rbx,%rax,1),%rsi nopl (%rax) movzbl (%rdi),%eax mov %eax,%ecx and $0xffffffdf,%ecx cmp $0x28,%al je 12f0 <func0+0xc0> cmp $0x5b,%cl je 12f0 <func0+0xc0> cmp $0x29,%al je 128a <func0+0x5a> cmp $0x5d,%cl jne 12b6 <func0+0x86> cmp $0xffffffff,%edx je 12d0 <func0+0xa0> lea -0x1(%rdx),%ecx movslq %edx,%rdx movzbl (%rsp,%rdx,1),%edx cmp $0x28,%dl jne 12a2 <func0+0x72> cmp $0x29,%al jne 12d0 <func0+0xa0> cmp $0x7b,%dl jne 12ab <func0+0x7b> cmp $0x7d,%al jne 12d0 <func0+0xa0> cmp $0x5b,%dl jne 12b4 <func0+0x84> cmp $0x5d,%al jne 12d0 <func0+0xa0> mov %ecx,%edx add $0x1,%rdi cmp %rdi,%rsi jne 1270 <func0+0x40> cmp $0xffffffff,%edx sete %al jmp 12d2 <func0+0xa2> nopw 0x0(%rax,%rax,1) xor %eax,%eax mov 0x68(%rsp),%rbx xor %fs:0x28,%rbx jne 1302 <func0+0xd2> add $0x70,%rsp pop %rbx retq nopl 0x0(%rax,%rax,1) add $0x1,%edx movslq %edx,%rcx mov %al,(%rsp,%rcx,1) jmp 12b6 <func0+0x86> mov $0x1,%eax jmp 12d2 <func0+0xa2> callq 1080 <__stack_chk_fail@plt> nopw 0x0(%rax,%rax,1)
func0: endbr64 push rbx mov rbx, rdi sub rsp, 70h mov rax, fs:28h mov [rsp+78h+var_10], rax xor eax, eax call _strlen test al, 1 jnz short loc_12C8 test eax, eax jle loc_1311 sub eax, 1 mov rdi, rbx mov edx, 0FFFFFFFFh lea rsi, [rbx+rax+1] jmp short loc_1289 loc_1270: cmp al, 29h ; ')' jz loc_1300 cmp al, 5Bh ; '[' jz short loc_12E0 cmp al, 28h ; '(' jz short loc_12E0 loc_1280: add rdi, 1 cmp rdi, rsi jz short loc_12F2 loc_1289: movzx eax, byte ptr [rdi] cmp al, 5Dh ; ']' jz short loc_129A jle short loc_1270 cmp al, 7Bh ; '{' jz short loc_12E0 cmp al, 7Dh ; '}' jnz short loc_1280 loc_129A: cmp edx, 0FFFFFFFFh jz short loc_12C8 lea r8d, [rdx-1] movsxd rdx, edx movzx ecx, [rsp+rdx+78h+var_78] cmp cl, 28h ; '(' jz short loc_12C8 mov edx, r8d loc_12B2: cmp cl, 7Bh ; '{' jnz short loc_12BB cmp al, 7Dh ; '}' jnz short loc_12C8 loc_12BB: cmp cl, 5Bh ; '[' jnz short loc_1280 cmp al, 5Dh ; ']' jz short loc_1280 nop dword ptr [rax+00h] loc_12C8: xor eax, eax loc_12CA: mov rdx, [rsp+78h+var_10] sub rdx, fs:28h jnz short loc_1318 add rsp, 70h pop rbx retn loc_12E0: add edx, 1 add rdi, 1 movsxd rcx, edx mov [rsp+rcx+78h+var_78], al cmp rdi, rsi jnz short loc_1289 loc_12F2: cmp edx, 0FFFFFFFFh setz al jmp short loc_12CA loc_1300: cmp edx, 0FFFFFFFFh jz short loc_12C8 movsxd rcx, edx sub edx, 1 movzx ecx, [rsp+rcx+78h+var_78] jmp short loc_12B2 loc_1311: mov eax, 1 jmp short loc_12CA loc_1318: call ___stack_chk_fail
char func0(const char *a1) { int v1; // eax int v2; // edx long long v3; // rsi char v4; // al char v5; // cl long long v7; // rcx _BYTE v8[104]; // [rsp+0h] [rbp-78h] unsigned long long v9; // [rsp+68h] [rbp-10h] v9 = __readfsqword(0x28u); v1 = strlen(a1); if ( (v1 & 1) != 0 ) return 0; if ( v1 > 0 ) { v2 = -1; v3 = (long long)&a1[v1 - 1 + 1]; while ( 1 ) { v4 = *a1; if ( *a1 == 93 ) { LABEL_12: if ( v2 == -1 ) return 0; v5 = v8[v2]; if ( v5 == 40 ) return 0; --v2; LABEL_15: if ( v5 == 123 && v4 != 125 || v5 == 91 && v4 != 93 ) return 0; goto LABEL_7; } if ( v4 <= 93 ) { if ( v4 == 41 ) { if ( v2 == -1 ) return 0; v7 = v2--; v5 = v8[v7]; goto LABEL_15; } if ( v4 == 91 || v4 == 40 ) goto LABEL_20; LABEL_7: if ( ++a1 == (const char *)v3 ) return v2 == -1; } else { if ( v4 != 123 ) { if ( v4 == 125 ) goto LABEL_12; goto LABEL_7; } LABEL_20: ++v2; ++a1; v8[v2] = v4; if ( a1 == (const char *)v3 ) return v2 == -1; } } } return 1; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI SUB RSP,0x70 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x68],RAX XOR EAX,EAX CALL 0x00101070 TEST AL,0x1 JNZ 0x001012c8 TEST EAX,EAX JLE 0x00101311 SUB EAX,0x1 MOV RDI,RBX MOV EDX,0xffffffff LEA RSI,[RBX + RAX*0x1 + 0x1] JMP 0x00101289 LAB_00101270: CMP AL,0x29 JZ 0x00101300 CMP AL,0x5b JZ 0x001012e0 CMP AL,0x28 JZ 0x001012e0 LAB_00101280: ADD RDI,0x1 CMP RDI,RSI JZ 0x001012f2 LAB_00101289: MOVZX EAX,byte ptr [RDI] CMP AL,0x5d JZ 0x0010129a JLE 0x00101270 CMP AL,0x7b JZ 0x001012e0 CMP AL,0x7d JNZ 0x00101280 LAB_0010129a: CMP EDX,-0x1 JZ 0x001012c8 LEA R8D,[RDX + -0x1] MOVSXD RDX,EDX MOVZX ECX,byte ptr [RSP + RDX*0x1] CMP CL,0x28 JZ 0x001012c8 MOV EDX,R8D LAB_001012b2: CMP CL,0x7b JNZ 0x001012bb CMP AL,0x7d JNZ 0x001012c8 LAB_001012bb: CMP CL,0x5b JNZ 0x00101280 CMP AL,0x5d JZ 0x00101280 NOP dword ptr [RAX] LAB_001012c8: XOR EAX,EAX LAB_001012ca: MOV RDX,qword ptr [RSP + 0x68] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101318 ADD RSP,0x70 POP RBX RET LAB_001012e0: ADD EDX,0x1 ADD RDI,0x1 MOVSXD RCX,EDX MOV byte ptr [RSP + RCX*0x1],AL CMP RDI,RSI JNZ 0x00101289 LAB_001012f2: CMP EDX,-0x1 SETZ AL JMP 0x001012ca LAB_00101300: CMP EDX,-0x1 JZ 0x001012c8 MOVSXD RCX,EDX SUB EDX,0x1 MOVZX ECX,byte ptr [RSP + RCX*0x1] JMP 0x001012b2 LAB_00101311: MOV EAX,0x1 JMP 0x001012ca LAB_00101318: CALL 0x00101080
bool func0(char *param_1) { char *pcVar1; char cVar2; size_t sVar3; char cVar4; int iVar5; long in_FS_OFFSET; bool bVar6; char local_78 [104]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); sVar3 = strlen(param_1); if ((sVar3 & 1) == 0) { if ((int)sVar3 < 1) { bVar6 = true; } else { iVar5 = -1; pcVar1 = param_1 + (ulong)((int)sVar3 - 1) + 1; do { while (cVar2 = *param_1, cVar2 != ']') { if (cVar2 < '^') { if (cVar2 == ')') { if (iVar5 != -1) { cVar4 = local_78[iVar5]; goto LAB_001012b2; } goto LAB_001012c8; } if ((cVar2 != '[') && (cVar2 != '(')) goto LAB_00101280; } else if (cVar2 != '{') { if (cVar2 == '}') break; goto LAB_00101280; } iVar5 = iVar5 + 1; param_1 = param_1 + 1; local_78[iVar5] = cVar2; if (param_1 == pcVar1) goto LAB_001012f2; } if ((iVar5 == -1) || (cVar4 = local_78[iVar5], cVar4 == '(')) goto LAB_001012c8; LAB_001012b2: iVar5 = iVar5 + -1; if (((cVar4 == '{') && (cVar2 != '}')) || ((cVar4 == '[' && (cVar2 != ']')))) goto LAB_001012c8; LAB_00101280: param_1 = param_1 + 1; } while (param_1 != pcVar1); LAB_001012f2: bVar6 = iVar5 == -1; } } else { LAB_001012c8: bVar6 = false; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return bVar6; }
6,980
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h>
char* func0(const char* test_str, int K) { // Make a copy of the input string to tokenize char temp_copy[1000]; strncpy(temp_copy, test_str, sizeof(temp_copy)); temp_copy[sizeof(temp_copy) - 1] = '\0'; // Allocate memory for the result char* res = malloc(strlen(test_str) + 1); if (!res) { perror("malloc failed"); exit(EXIT_FAILURE); } res[0] = '\0'; // Tokenize and filter words char* token = strtok(temp_copy, " "); while (token != NULL) { if ((int)strlen(token) != K) { strcat(res, token); strcat(res, " "); } token = strtok(NULL, " "); } // Remove trailing space if present size_t len = strlen(res); if (len > 0 && res[len - 1] == ' ') { res[len - 1] = '\0'; } return res; }
int main() { char* result1 = func0("The person is most value tet", 3); assert(strcmp(result1, "person is most value") == 0); free(result1); char* result2 = func0("If you told me about this ok", 4); assert(strcmp(result2, "If you me about ok") == 0); free(result2); char* result3 = func0("Forces of darkeness is come into the play", 4); assert(strcmp(result3, "Forces of darkeness is the") == 0); free(result3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x420,%rsp mov %rdi,-0x418(%rbp) mov %esi,-0x41c(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax mov -0x418(%rbp),%rcx lea -0x3f0(%rbp),%rax mov $0x3e8,%edx mov %rcx,%rsi mov %rax,%rdi callq 1100 <strncpy@plt> movb $0x0,-0x9(%rbp) mov -0x418(%rbp),%rax mov %rax,%rdi callq 1110 <strlen@plt> add $0x1,%rax mov %rax,%rdi callq 1150 <malloc@plt> mov %rax,-0x400(%rbp) cmpq $0x0,-0x400(%rbp) jne 1318 <func0+0x8f> lea 0xcff(%rip),%rdi callq 1160 <perror@plt> mov $0x1,%edi callq 1190 <exit@plt> mov -0x400(%rbp),%rax movb $0x0,(%rax) lea -0x3f0(%rbp),%rax lea 0xce6(%rip),%rsi mov %rax,%rdi callq 1170 <strtok@plt> mov %rax,-0x408(%rbp) jmp 13bd <func0+0x134> mov -0x408(%rbp),%rax mov %rax,%rdi callq 1110 <strlen@plt> cmp %eax,-0x41c(%rbp) je 13a5 <func0+0x11c> mov -0x408(%rbp),%rdx mov -0x400(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1180 <strcat@plt> mov -0x400(%rbp),%rax mov $0xffffffffffffffff,%rcx mov %rax,%rdx mov $0x0,%eax mov %rdx,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rax),%rdx mov -0x400(%rbp),%rax add %rdx,%rax movw $0x20,(%rax) lea 0xc6a(%rip),%rsi mov $0x0,%edi callq 1170 <strtok@plt> mov %rax,-0x408(%rbp) cmpq $0x0,-0x408(%rbp) jne 1341 <func0+0xb8> mov -0x400(%rbp),%rax mov %rax,%rdi callq 1110 <strlen@plt> mov %rax,-0x3f8(%rbp) cmpq $0x0,-0x3f8(%rbp) je 141f <func0+0x196> mov -0x3f8(%rbp),%rax lea -0x1(%rax),%rdx mov -0x400(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax cmp $0x20,%al jne 141f <func0+0x196> mov -0x3f8(%rbp),%rax lea -0x1(%rax),%rdx mov -0x400(%rbp),%rax add %rdx,%rax movb $0x0,(%rax) mov -0x400(%rbp),%rax mov -0x8(%rbp),%rsi xor %fs:0x28,%rsi je 143a <func0+0x1b1> callq 1120 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 420h mov [rbp+src], rdi mov [rbp+var_41C], esi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov rcx, [rbp+src] lea rax, [rbp+dest] mov edx, 3E8h; n mov rsi, rcx; src mov rdi, rax; dest call _strncpy mov [rbp+var_9], 0 mov rax, [rbp+src] mov rdi, rax; s call _strlen add rax, 1 mov rdi, rax; size call _malloc mov [rbp+var_400], rax cmp [rbp+var_400], 0 jnz short loc_131B lea rax, s; "malloc failed" mov rdi, rax; s call _perror mov edi, 1; status call _exit loc_131B: mov rax, [rbp+var_400] mov byte ptr [rax], 0 lea rax, [rbp+dest] lea rdx, delim; " " mov rsi, rdx; delim mov rdi, rax; s call _strtok mov [rbp+s], rax jmp short loc_13B3 loc_1347: mov rax, [rbp+s] mov rdi, rax; s call _strlen cmp [rbp+var_41C], eax jz short loc_1398 mov rdx, [rbp+s] mov rax, [rbp+var_400] mov rsi, rdx; src mov rdi, rax; dest call _strcat mov rax, [rbp+var_400] mov rdi, rax; s call _strlen mov rdx, rax mov rax, [rbp+var_400] add rax, rdx mov word ptr [rax], 20h ; ' ' loc_1398: lea rax, delim; " " mov rsi, rax; delim mov edi, 0; s call _strtok mov [rbp+s], rax loc_13B3: cmp [rbp+s], 0 jnz short loc_1347 mov rax, [rbp+var_400] mov rdi, rax; s call _strlen mov [rbp+var_3F8], rax cmp [rbp+var_3F8], 0 jz short loc_1411 mov rax, [rbp+var_3F8] lea rdx, [rax-1] mov rax, [rbp+var_400] add rax, rdx movzx eax, byte ptr [rax] cmp al, 20h ; ' ' jnz short loc_1411 mov rax, [rbp+var_3F8] lea rdx, [rax-1] mov rax, [rbp+var_400] add rax, rdx mov byte ptr [rax], 0 loc_1411: mov rax, [rbp+var_400] mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_142C call ___stack_chk_fail locret_142C: leave retn
char * func0(const char *a1, int a2) { size_t v2; // rax const char *s; // [rsp+18h] [rbp-408h] char *v5; // [rsp+20h] [rbp-400h] size_t v6; // [rsp+28h] [rbp-3F8h] char dest[1000]; // [rsp+30h] [rbp-3F0h] BYREF unsigned long long v8; // [rsp+418h] [rbp-8h] v8 = __readfsqword(0x28u); strncpy(dest, a1, 0x3E8uLL); dest[999] = 0; v2 = strlen(a1); v5 = (char *)malloc(v2 + 1); if ( !v5 ) { perror("malloc failed"); exit(1); } *v5 = 0; for ( s = strtok(dest, " "); s; s = strtok(0LL, " ") ) { if ( a2 != (unsigned int)strlen(s) ) { strcat(v5, s); *(_WORD *)&v5[strlen(v5)] = 32; } } v6 = strlen(v5); if ( v6 && v5[v6 - 1] == 32 ) v5[v6 - 1] = 0; return v5; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x420 MOV qword ptr [RBP + -0x418],RDI MOV dword ptr [RBP + -0x41c],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV RCX,qword ptr [RBP + -0x418] LEA RAX,[RBP + -0x3f0] MOV EDX,0x3e8 MOV RSI,RCX MOV RDI,RAX CALL 0x00101100 MOV byte ptr [RBP + -0x9],0x0 MOV RAX,qword ptr [RBP + -0x418] MOV RDI,RAX CALL 0x00101110 ADD RAX,0x1 MOV RDI,RAX CALL 0x00101150 MOV qword ptr [RBP + -0x400],RAX CMP qword ptr [RBP + -0x400],0x0 JNZ 0x0010131b LEA RAX,[0x102008] MOV RDI,RAX CALL 0x00101160 MOV EDI,0x1 CALL 0x00101190 LAB_0010131b: MOV RAX,qword ptr [RBP + -0x400] MOV byte ptr [RAX],0x0 LEA RAX,[RBP + -0x3f0] LEA RDX,[0x102016] MOV RSI,RDX MOV RDI,RAX CALL 0x00101170 MOV qword ptr [RBP + -0x408],RAX JMP 0x001013b3 LAB_00101347: MOV RAX,qword ptr [RBP + -0x408] MOV RDI,RAX CALL 0x00101110 CMP dword ptr [RBP + -0x41c],EAX JZ 0x00101398 MOV RDX,qword ptr [RBP + -0x408] MOV RAX,qword ptr [RBP + -0x400] MOV RSI,RDX MOV RDI,RAX CALL 0x00101180 MOV RAX,qword ptr [RBP + -0x400] MOV RDI,RAX CALL 0x00101110 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x400] ADD RAX,RDX MOV word ptr [RAX],0x20 LAB_00101398: LEA RAX,[0x102016] MOV RSI,RAX MOV EDI,0x0 CALL 0x00101170 MOV qword ptr [RBP + -0x408],RAX LAB_001013b3: CMP qword ptr [RBP + -0x408],0x0 JNZ 0x00101347 MOV RAX,qword ptr [RBP + -0x400] MOV RDI,RAX CALL 0x00101110 MOV qword ptr [RBP + -0x3f8],RAX CMP qword ptr [RBP + -0x3f8],0x0 JZ 0x00101411 MOV RAX,qword ptr [RBP + -0x3f8] LEA RDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x400] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] CMP AL,0x20 JNZ 0x00101411 MOV RAX,qword ptr [RBP + -0x3f8] LEA RDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x400] ADD RAX,RDX MOV byte ptr [RAX],0x0 LAB_00101411: MOV RAX,qword ptr [RBP + -0x400] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x0010142c CALL 0x00101120 LAB_0010142c: LEAVE RET
char * func0(char *param_1,int param_2) { size_t sVar1; char *__dest; long in_FS_OFFSET; char *local_410; char local_3f8 [999]; int local_11; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); strncpy(local_3f8,param_1,1000); local_11 = 0; sVar1 = strlen(param_1); __dest = (char *)malloc(sVar1 + 1); if (__dest == (char *)0x0) { perror("malloc failed"); /* WARNING: Subroutine does not return */ exit(1); } *__dest = '\0'; local_410 = strtok(local_3f8," "); while (local_410 != (char *)0x0) { sVar1 = strlen(local_410); if (param_2 != (int)sVar1) { strcat(__dest,local_410); sVar1 = strlen(__dest); (__dest + sVar1)[0] = ' '; (__dest + sVar1)[1] = '\0'; } local_410 = strtok((char *)0x0," "); } sVar1 = strlen(__dest); if ((sVar1 != 0) && (__dest[sVar1 - 1] == ' ')) { __dest[sVar1 - 1] = '\0'; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return __dest; }
6,981
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h>
char* func0(const char* test_str, int K) { // Make a copy of the input string to tokenize char temp_copy[1000]; strncpy(temp_copy, test_str, sizeof(temp_copy)); temp_copy[sizeof(temp_copy) - 1] = '\0'; // Allocate memory for the result char* res = malloc(strlen(test_str) + 1); if (!res) { perror("malloc failed"); exit(EXIT_FAILURE); } res[0] = '\0'; // Tokenize and filter words char* token = strtok(temp_copy, " "); while (token != NULL) { if ((int)strlen(token) != K) { strcat(res, token); strcat(res, " "); } token = strtok(NULL, " "); } // Remove trailing space if present size_t len = strlen(res); if (len > 0 && res[len - 1] == ' ') { res[len - 1] = '\0'; } return res; }
int main() { char* result1 = func0("The person is most value tet", 3); assert(strcmp(result1, "person is most value") == 0); free(result1); char* result2 = func0("If you told me about this ok", 4); assert(strcmp(result2, "If you me about ok") == 0); free(result2); char* result3 = func0("Forces of darkeness is come into the play", 4); assert(strcmp(result3, "Forces of darkeness is the") == 0); free(result3); return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx sub $0x3f0,%rsp mov %rdi,%rbx mov %esi,%r12d mov %fs:0x28,%rax mov %rax,0x3e8(%rsp) xor %eax,%eax mov %rsp,%rdi mov $0x3e8,%edx mov %rbx,%rsi callq 10e0 <strncpy@plt> movb $0x0,0x3e7(%rsp) mov $0xffffffffffffffff,%rcx mov $0x0,%eax mov %rbx,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rdi not %rdi callq 1110 <malloc@plt> test %rax,%rax je 12d0 <func0+0x87> mov %rax,%rbx movb $0x0,(%rax) mov %rsp,%rdi lea 0xd58(%rip),%rsi callq 1130 <strtok@plt> mov %rax,%rsi test %rax,%rax je 133f <func0+0xf6> mov $0xffffffffffffffff,%rbp jmp 1321 <func0+0xd8> lea 0xd2d(%rip),%rdi callq 1120 <perror@plt> mov $0x1,%edi callq 1150 <exit@plt> mov %rbx,%rdi callq 1140 <strcat@plt> mov $0x0,%eax mov %rbp,%rcx mov %rbx,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax movw $0x20,-0x1(%rbx,%rax,1) lea 0xd03(%rip),%rsi mov $0x0,%edi callq 1130 <strtok@plt> mov %rax,%rsi test %rax,%rax je 133f <func0+0xf6> mov $0x0,%eax mov %rbp,%rcx mov %rsi,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax sub $0x1,%rax cmp %eax,%r12d je 1308 <func0+0xbf> jmp 12e6 <func0+0x9d> mov $0xffffffffffffffff,%rcx mov $0x0,%eax mov %rbx,%rdi repnz scas %es:(%rdi),%al not %rcx sub $0x1,%rcx je 1363 <func0+0x11a> lea -0x1(%rbx,%rcx,1),%rax cmpb $0x20,(%rax) je 1385 <func0+0x13c> mov 0x3e8(%rsp),%rax xor %fs:0x28,%rax jne 138a <func0+0x141> mov %rbx,%rax add $0x3f0,%rsp pop %rbx pop %rbp pop %r12 retq movb $0x0,(%rax) jmp 1363 <func0+0x11a> callq 10f0 <__stack_chk_fail@plt>
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 3F8h mov rbx, rdi mov r12d, esi mov rax, fs:28h mov [rsp+418h+var_30], rax xor eax, eax mov rdi, rsp mov edx, 3E8h mov rsi, rbx call _strncpy mov [rsp+418h+var_31], 0 mov rdi, rbx call _strlen lea rdi, [rax+1] call _malloc test rax, rax jz short loc_1307 mov rbp, rax mov byte ptr [rax], 0 mov rdi, rsp lea rsi, asc_2012; " " call _strtok mov rbx, rax test rax, rax jz short loc_135B lea r13, asc_2012; " " jmp short loc_1332 loc_1307: lea rdi, aMallocFailed; "malloc failed" call _perror mov edi, 1 call _exit loc_131D: mov rsi, r13 mov edi, 0 call _strtok mov rbx, rax test rax, rax jz short loc_135B loc_1332: mov rdi, rbx call _strlen cmp r12d, eax jz short loc_131D mov rsi, rbx mov rdi, rbp call _strcat mov rdi, rbp call _strlen mov word ptr [rbp+rax+0], 20h ; ' ' jmp short loc_131D loc_135B: mov rdi, rbp call _strlen test rax, rax jz short loc_1372 lea rax, [rbp+rax-1] cmp byte ptr [rax], 20h ; ' ' jz short loc_1396 loc_1372: mov rax, [rsp+418h+var_30] sub rax, fs:28h jnz short loc_139B mov rax, rbp add rsp, 3F8h pop rbx pop rbp pop r12 pop r13 retn loc_1396: mov byte ptr [rax], 0 jmp short loc_1372 loc_139B: call ___stack_chk_fail
_BYTE * func0(long long a1, int a2) { long long v2; // rax _BYTE *v3; // rax _BYTE *v4; // rbp long long i; // rbx long long v6; // rax _BYTE *v7; // rax _BYTE v9[1000]; // [rsp+0h] [rbp-418h] BYREF unsigned long long v10; // [rsp+3E8h] [rbp-30h] v10 = __readfsqword(0x28u); strncpy(v9, a1, 1000LL); v9[999] = 0; v2 = strlen(a1); v3 = (_BYTE *)malloc(v2 + 1); if ( !v3 ) { perror("malloc failed"); exit(1LL); } v4 = v3; *v3 = 0; for ( i = strtok(v9, " "); i; i = strtok(0LL, " ") ) { if ( a2 != (unsigned int)strlen(i) ) { strcat(v4, i); *(_WORD *)&v4[strlen(v4)] = 32; } } v6 = strlen(v4); if ( v6 ) { v7 = &v4[v6 - 1]; if ( *v7 == 32 ) *v7 = 0; } return v4; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x3f8 MOV RBX,RDI MOV R12D,ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x3e8],RAX XOR EAX,EAX MOV RDI,RSP MOV EDX,0x3e8 MOV RSI,RBX CALL 0x00101100 MOV byte ptr [RSP + 0x3e7],0x0 MOV RDI,RBX CALL 0x00101110 LEA RDI,[RAX + 0x1] CALL 0x00101150 TEST RAX,RAX JZ 0x00101307 MOV RBP,RAX MOV byte ptr [RAX],0x0 MOV RDI,RSP LEA RSI,[0x102012] CALL 0x00101170 MOV RBX,RAX TEST RAX,RAX JZ 0x0010135b LEA R13,[0x102012] JMP 0x00101332 LAB_00101307: LEA RDI,[0x102004] CALL 0x00101160 MOV EDI,0x1 CALL 0x00101190 LAB_0010131d: MOV RSI,R13 MOV EDI,0x0 CALL 0x00101170 MOV RBX,RAX TEST RAX,RAX JZ 0x0010135b LAB_00101332: MOV RDI,RBX CALL 0x00101110 CMP R12D,EAX JZ 0x0010131d MOV RSI,RBX MOV RDI,RBP CALL 0x00101180 MOV RDI,RBP CALL 0x00101110 MOV word ptr [RBP + RAX*0x1],0x20 JMP 0x0010131d LAB_0010135b: MOV RDI,RBP CALL 0x00101110 TEST RAX,RAX JZ 0x00101372 LEA RAX,[RBP + RAX*0x1 + -0x1] CMP byte ptr [RAX],0x20 JZ 0x00101396 LAB_00101372: MOV RAX,qword ptr [RSP + 0x3e8] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010139b MOV RAX,RBP ADD RSP,0x3f8 POP RBX POP RBP POP R12 POP R13 RET LAB_00101396: MOV byte ptr [RAX],0x0 JMP 0x00101372 LAB_0010139b: CALL 0x00101120
char * func0(char *param_1,int param_2) { size_t sVar1; char *__dest; char *__s; long in_FS_OFFSET; char acStack_418 [999]; int1 local_31; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); strncpy(acStack_418,param_1,1000); local_31 = 0; sVar1 = strlen(param_1); __dest = (char *)malloc(sVar1 + 1); if (__dest == (char *)0x0) { perror("malloc failed"); /* WARNING: Subroutine does not return */ exit(1); } *__dest = '\0'; __s = strtok(acStack_418," "); while (__s != (char *)0x0) { sVar1 = strlen(__s); if (param_2 != (int)sVar1) { strcat(__dest,__s); sVar1 = strlen(__dest); (__dest + sVar1)[0] = ' '; (__dest + sVar1)[1] = '\0'; } __s = strtok((char *)0x0," "); } sVar1 = strlen(__dest); if ((sVar1 != 0) && (__dest[sVar1 - 1] == ' ')) { __dest[sVar1 - 1] = '\0'; } if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return __dest; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }