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
4,882
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(char str[]) { int n = strlen(str); int L[n][n]; for (int i = 0; i < n; i++) { L[i][i] = 1; } for (int cl = 2; cl <= n; cl++) { for (int i = 0; i < n - cl + 1; i++) { int j = i + cl - 1; if (str[i] == str[j] && cl == 2) { L[i][j] = 2; } else if (str[i] == str[j]) { L[i][j] = L[i+1][j-1] + 2; } else { L[i][j] = (L[i][j-1] > L[i+1][j]) ? L[i][j-1] : L[i+1][j]; } } } return L[0][n-1]; }
int main() { assert(func0("TENS FOR TENS") == 5); assert(func0("CARDIO FOR CARDS") == 7); assert(func0("PART OF THE JOURNEY IS PART") == 9); return 0; }
O2
c
func0: endbr64 push %rbp mov %rsp,%rbp push %r15 push %r14 mov %rdi,%r14 push %r13 push %r12 push %rbx sub $0x28,%rsp mov %fs:0x28,%rax mov %rax,-0x38(%rbp) xor %eax,%eax mov %rsp,%rbx callq 1070 <strlen@plt> movslq %eax,%rdx mov %rax,-0x50(%rbp) mov %eax,%ecx mov %rdx,%rax imul %rdx,%rax lea 0xf(,%rax,4),%rax mov %rax,%rsi and $0xfffffffffffff000,%rax sub %rax,%rbx and $0xfffffffffffffff0,%rsi mov %rbx,%rax cmp %rax,%rsp je 12a4 <func0+0x74> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 128f <func0+0x5f> and $0xfff,%esi sub %rsi,%rsp test %rsi,%rsi jne 1424 <func0+0x1f4> lea 0x0(,%rdx,4),%r10 mov -0x50(%rbp),%edx mov %rsp,%r8 xor %eax,%eax shr $0x2,%r10 lea 0x1(%r10),%rsi test %edx,%edx jle 13dd <func0+0x1ad> nopw %cs:0x0(%rax,%rax,1) movslq %eax,%rdx add $0x1,%eax imul %rsi,%rdx movl $0x1,(%r8,%rdx,4) cmp %eax,%ecx jne 12e0 <func0+0xb0> mov -0x50(%rbp),%rax cmp $0x1,%eax jle 13dd <func0+0x1ad> mov %eax,-0x44(%rbp) add $0x1,%eax lea 0x2(%r14),%r11 mov $0x2,%r13d mov %eax,-0x48(%rbp) nopw %cs:0x0(%rax,%rax,1) mov -0x44(%rbp),%edx mov $0x0,%eax lea -0x1(%r13),%ebx lea -0x2(%r13),%r15d sub %r13d,%edx mov %edx,%r12d jns 137f <func0+0x14f> jmpq 13cb <func0+0x19b> nopl (%rax) movslq %eax,%rsi movslq %ecx,%rcx imul %r10,%rsi imul %r10,%rcx lea (%rdx,%rsi,1),%rdi mov %rsi,%r9 lea (%r15,%rax,1),%esi movslq %esi,%rsi add %rdx,%rcx add %r9,%rsi mov (%r8,%rcx,4),%edx cmp %edx,(%r8,%rsi,4) cmovge (%r8,%rsi,4),%edx mov %edx,(%r8,%rdi,4) lea 0x1(%rax),%rdx cmp %rax,%r12 je 13cb <func0+0x19b> mov %rdx,%rax lea (%rbx,%rax,1),%edx movzbl -0x1(%rax,%r11,1),%edi movslq %eax,%rsi lea 0x1(%rax),%ecx movslq %edx,%rdx cmp %dil,(%r14,%rax,1) jne 1340 <func0+0x110> cmp $0x2,%r13d je 1410 <func0+0x1e0> movslq %ecx,%rcx movslq %esi,%rdi add %r15d,%esi imul %r10,%rcx movslq %esi,%rsi imul %r10,%rdi add %rsi,%rcx mov (%r8,%rcx,4),%ecx add %rdi,%rdx add $0x2,%ecx mov %ecx,(%r8,%rdx,4) lea 0x1(%rax),%rdx cmp %rax,%r12 jne 137c <func0+0x14c> add $0x1,%r13d add $0x1,%r11 cmp -0x48(%rbp),%r13d jne 1320 <func0+0xf0> mov -0x50(%rbp),%eax sub $0x1,%eax mov -0x38(%rbp),%rbx xor %fs:0x28,%rbx cltq mov (%r8,%rax,4),%eax jne 142f <func0+0x1ff> lea -0x28(%rbp),%rsp pop %rbx pop %r12 pop %r13 pop %r14 pop %r15 pop %rbp retq nopw 0x0(%rax,%rax,1) imul %r10,%rsi add %rsi,%rdx movl $0x2,(%r8,%rdx,4) jmpq 1373 <func0+0x143> orq $0x0,-0x8(%rsp,%rsi,1) jmpq 12b6 <func0+0x86> callq 1080 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 push rbp mov rbp, rsp push r15 push r14 push r13 push r12 push rbx mov rbx, rdi sub rsp, 18h mov rax, fs:28h mov [rbp+var_38], rax xor eax, eax call _strlen mov rsi, rsp mov r12, rax mov ecx, eax cdqe lea r9, ds:0[rax*4] imul rax, rax lea rax, ds:0Fh[rax*4] mov rdx, rax and rax, 0FFFFFFFFFFFFF000h sub rsi, rax and rdx, 0FFFFFFFFFFFFFFF0h cmp rsp, rsi jz short loc_12A4 loc_128F: sub rsp, 1000h or [rsp+1040h+var_48], 0 cmp rsp, rsi jnz short loc_128F loc_12A4: and edx, 0FFFh sub rsp, rdx test rdx, rdx jnz loc_13C5 loc_12B6: shr r9, 2 mov r8, rsp xor eax, eax lea rsi, [r9+1] test r12d, r12d jle loc_13D0 nop dword ptr [rax+00h] loc_12D0: movsxd rdx, eax add eax, 1 imul rdx, rsi mov dword ptr [r8+rdx*4], 1 cmp ecx, eax jnz short loc_12D0 cmp r12d, 1 jz loc_13D6 sub r12d, 1 mov r10d, 2 mov r11d, r12d nop dword ptr [rax] loc_1300: mov rsi, rbx lea edi, [r10-2] xor ecx, ecx jmp short loc_134D loc_1310: movsxd r14, ecx mov r15, rax movsxd r13, edi imul r15, r9 imul r14, r9 add rdx, r15 add r14, r13 mov r15d, [r8+r14*4] mov r14d, [r8+rdx*4] cmp r15d, r14d mov edx, r14d cmovge edx, r15d loc_1339: imul rax, r9 add rsi, 1 add rax, r13 mov [r8+rax*4], edx cmp r11d, ecx jz short loc_1380 loc_134D: movsxd rdx, edi movsxd rax, ecx movzx r15d, byte ptr [r10+rsi-1] add edi, 1 add ecx, 1 cmp [rsi], r15b jnz short loc_1310 cmp r10, 2 jz short loc_13B8 movsxd r13, ecx imul r13, r9 add rdx, r13 movsxd r13, edi mov edx, [r8+rdx*4] add edx, 2 jmp short loc_1339 loc_1380: add r10, 1 sub r11d, 1 jnz loc_1300 loc_138E: movsxd r12, r12d mov eax, [r8+r12*4] mov rdx, [rbp+var_38] sub rdx, fs:28h jnz short loc_13DB lea rsp, [rbp-28h] pop rbx pop r12 pop r13 pop r14 pop r15 pop rbp retn loc_13B8: mov edx, 2 movsxd r13, edi jmp loc_1339 loc_13C5: or [rsp+rdx+1040h+var_1048], 0 jmp loc_12B6 loc_13D0: sub r12d, 1 jmp short loc_138E loc_13D6: xor r12d, r12d jmp short loc_138E loc_13DB: call ___stack_chk_fail
long long func0(_BYTE *a1) { int v2; // r12d long long v3; // rdx _DWORD *v4; // rsi __int16 v5; // dx signed long long v6; // rdx void *v7; // rsp unsigned long long v8; // r9 int v9; // eax long long v10; // rdx int v11; // r12d long long v12; // r10 int v13; // r11d _BYTE *v14; // rsi int v15; // edi int v16; // ecx long long v17; // r13 int v18; // edx long long v19; // rdx long long v20; // rax _DWORD v23[1022]; // [rsp+8h] [rbp-1040h] BYREF _QWORD v24[8]; // [rsp+1008h] [rbp-40h] BYREF v24[1] = __readfsqword(0x28u); v2 = strlen(); v3 = 4 * v2 * (long long)v2 + 15; v4 = (_DWORD *)((char *)v24 - (v3 & 0xFFFFFFFFFFFFF000LL)); v5 = v3 & 0xFFF0; if ( v24 != (_QWORD *)v4 ) { while ( v23 != v4 ) ; } v6 = v5 & 0xFFF; v7 = alloca(v6); if ( v6 ) *(_QWORD *)((char *)&v23[-2] + v6) = *(_QWORD *)((char *)&v23[-2] + v6); v8 = (unsigned long long)(4LL * v2) >> 2; v9 = 0; if ( v2 <= 0 ) { v11 = v2 - 1; } else { do { v10 = v9++; v23[(v8 + 1) * v10] = 1; } while ( v2 != v9 ); if ( v2 == 1 ) { v11 = 0; } else { v11 = v2 - 1; v12 = 2LL; v13 = v11; do { v14 = a1; v15 = v12 - 2; v16 = 0; do { v19 = v15; v20 = v16; ++v15; ++v16; if ( *v14 == v14[v12 - 1] ) { if ( v12 == 2 ) { v18 = 2; v17 = v15; } else { v17 = v15; v18 = v23[v8 * v16 + v19] + 2; } } else { v17 = v15; v18 = v23[v8 * v20 + v19]; if ( v23[v15 + v8 * v16] >= v18 ) v18 = v23[v15 + v8 * v16]; } ++v14; v23[v17 + v8 * v20] = v18; } while ( v13 != v16 ); ++v12; --v13; } while ( v13 ); } } return (unsigned int)v23[v11]; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBX MOV RBX,RDI SUB RSP,0x18 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x38],RAX XOR EAX,EAX CALL 0x00101070 MOV RSI,RSP MOV R12,RAX MOV ECX,EAX CDQE LEA R9,[RAX*0x4] IMUL RAX,RAX LEA RAX,[0xf + RAX*0x4] MOV RDX,RAX AND RAX,-0x1000 SUB RSI,RAX AND RDX,-0x10 CMP RSP,RSI JZ 0x001012a4 LAB_0010128f: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RSI JNZ 0x0010128f LAB_001012a4: AND EDX,0xfff SUB RSP,RDX TEST RDX,RDX JNZ 0x001013c5 LAB_001012b6: SHR R9,0x2 MOV R8,RSP XOR EAX,EAX LEA RSI,[R9 + 0x1] TEST R12D,R12D JLE 0x001013d0 NOP dword ptr [RAX] LAB_001012d0: MOVSXD RDX,EAX ADD EAX,0x1 IMUL RDX,RSI MOV dword ptr [R8 + RDX*0x4],0x1 CMP ECX,EAX JNZ 0x001012d0 CMP R12D,0x1 JZ 0x001013d6 SUB R12D,0x1 MOV R10D,0x2 MOV R11D,R12D NOP dword ptr [RAX] LAB_00101300: MOV RSI,RBX LEA EDI,[R10 + -0x2] XOR ECX,ECX JMP 0x0010134d LAB_00101310: MOVSXD R14,ECX MOV R15,RAX MOVSXD R13,EDI IMUL R15,R9 IMUL R14,R9 ADD RDX,R15 ADD R14,R13 MOV R15D,dword ptr [R8 + R14*0x4] MOV R14D,dword ptr [R8 + RDX*0x4] CMP R15D,R14D MOV EDX,R14D CMOVGE EDX,R15D LAB_00101339: IMUL RAX,R9 ADD RSI,0x1 ADD RAX,R13 MOV dword ptr [R8 + RAX*0x4],EDX CMP R11D,ECX JZ 0x00101380 LAB_0010134d: MOVSXD RDX,EDI MOVSXD RAX,ECX MOVZX R15D,byte ptr [R10 + RSI*0x1 + -0x1] ADD EDI,0x1 ADD ECX,0x1 CMP byte ptr [RSI],R15B JNZ 0x00101310 CMP R10,0x2 JZ 0x001013b8 MOVSXD R13,ECX IMUL R13,R9 ADD RDX,R13 MOVSXD R13,EDI MOV EDX,dword ptr [R8 + RDX*0x4] ADD EDX,0x2 JMP 0x00101339 LAB_00101380: ADD R10,0x1 SUB R11D,0x1 JNZ 0x00101300 LAB_0010138e: MOVSXD R12,R12D MOV EAX,dword ptr [R8 + R12*0x4] MOV RDX,qword ptr [RBP + -0x38] SUB RDX,qword ptr FS:[0x28] JNZ 0x001013db LEA RSP,[RBP + -0x28] POP RBX POP R12 POP R13 POP R14 POP R15 POP RBP RET LAB_001013b8: MOV EDX,0x2 MOVSXD R13,EDI JMP 0x00101339 LAB_001013c5: OR qword ptr [RSP + RDX*0x1 + -0x8],0x0 JMP 0x001012b6 LAB_001013d0: SUB R12D,0x1 JMP 0x0010138e LAB_001013d6: XOR R12D,R12D JMP 0x0010138e LAB_001013db: CALL 0x00101080
int4 func0(char *param_1) { long lVar1; int1 *puVar2; int iVar3; size_t sVar4; ulong uVar5; long lVar6; int iVar7; int iVar8; ulong uVar9; long lVar10; long lVar11; int1 *puVar12; char *pcVar14; int iVar15; int iVar16; long in_FS_OFFSET; int1 auStack_48 [8]; long local_40; int1 *puVar13; puVar12 = auStack_48; local_40 = *(long *)(in_FS_OFFSET + 0x28); sVar4 = strlen(param_1); iVar16 = (int)sVar4; uVar5 = (ulong)iVar16; uVar9 = uVar5 * uVar5 * 4 + 0xf; puVar13 = auStack_48; puVar2 = auStack_48; while (puVar13 != auStack_48 + -(uVar9 & 0xfffffffffffff000)) { puVar12 = puVar2 + -0x1000; *(int8 *)(puVar2 + -8) = *(int8 *)(puVar2 + -8); puVar13 = puVar2 + -0x1000; puVar2 = puVar2 + -0x1000; } uVar9 = (ulong)((uint)uVar9 & 0xff0); lVar1 = -uVar9; if (uVar9 != 0) { *(int8 *)(puVar12 + -8) = *(int8 *)(puVar12 + -8); } uVar5 = uVar5 & 0x3fffffffffffffff; iVar3 = 0; if (iVar16 < 1) { iVar16 = iVar16 + -1; } else { do { lVar10 = (long)iVar3; iVar3 = iVar3 + 1; *(int4 *)(puVar12 + lVar10 * (uVar5 + 1) * 4 + lVar1) = 1; } while (iVar16 != iVar3); if (iVar16 == 1) { iVar16 = 0; } else { iVar16 = iVar16 + -1; lVar10 = 2; iVar3 = iVar16; do { iVar15 = (int)lVar10 + -2; iVar7 = 0; pcVar14 = param_1; do { lVar11 = (long)iVar15; lVar6 = (long)iVar7; iVar15 = iVar15 + 1; iVar7 = iVar7 + 1; if (*pcVar14 == pcVar14[lVar10 + -1]) { if (lVar10 == 2) { iVar8 = 2; } else { iVar8 = *(int *)(puVar12 + (lVar11 + (long)iVar7 * uVar5) * 4 + lVar1) + 2; } } else { iVar8 = *(int *)(puVar12 + (lVar11 + lVar6 * uVar5) * 4 + lVar1); if (*(int *)(puVar12 + (lVar11 + lVar6 * uVar5) * 4 + lVar1) <= *(int *)(puVar12 + ((long)iVar7 * uVar5 + (long)iVar15) * 4 + lVar1)) { iVar8 = *(int *)(puVar12 + ((long)iVar7 * uVar5 + (long)iVar15) * 4 + lVar1); } } pcVar14 = pcVar14 + 1; *(int *)(puVar12 + (lVar6 * uVar5 + (long)iVar15) * 4 + lVar1) = iVar8; } while (iVar3 != iVar7); lVar10 = lVar10 + 1; iVar3 = iVar3 + -1; } while (iVar3 != 0); } } if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(code **)(puVar12 + lVar1 + -8) = _fini; __stack_chk_fail(); } return *(int4 *)(puVar12 + (long)iVar16 * 4 + lVar1); }
4,883
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(char str[]) { int n = strlen(str); int L[n][n]; for (int i = 0; i < n; i++) { L[i][i] = 1; } for (int cl = 2; cl <= n; cl++) { for (int i = 0; i < n - cl + 1; i++) { int j = i + cl - 1; if (str[i] == str[j] && cl == 2) { L[i][j] = 2; } else if (str[i] == str[j]) { L[i][j] = L[i+1][j-1] + 2; } else { L[i][j] = (L[i][j-1] > L[i+1][j]) ? L[i][j-1] : L[i+1][j]; } } } return L[0][n-1]; }
int main() { assert(func0("TENS FOR TENS") == 5); assert(func0("CARDIO FOR CARDS") == 7); assert(func0("PART OF THE JOURNEY IS PART") == 9); return 0; }
O3
c
func0: endbr64 push %rbp mov %rsp,%rbp push %r15 push %r14 push %r13 push %r12 push %rbx mov %rdi,%rbx sub $0x38,%rsp mov %fs:0x28,%rax mov %rax,-0x38(%rbp) xor %eax,%eax callq 1070 <strlen@plt> mov %rsp,%rdi movslq %eax,%rdx mov %rax,-0x50(%rbp) mov %eax,%ecx mov %rdx,%rax imul %rdx,%rax lea 0xf(,%rax,4),%rax mov %rax,%rsi and $0xfffffffffffff000,%rax sub %rax,%rdi and $0xfffffffffffffff0,%rsi mov %rdi,%rax cmp %rax,%rsp je 12a4 <func0+0x74> sub $0x1000,%rsp orq $0x0,0xff8(%rsp) cmp %rax,%rsp jne 128f <func0+0x5f> and $0xfff,%esi sub %rsi,%rsp test %rsi,%rsi jne 147e <func0+0x24e> lea 0x0(,%rdx,4),%r10 mov -0x50(%rbp),%edx mov %rsp,%r8 xor %eax,%eax shr $0x2,%r10 lea 0x1(%r10),%rdi mov %rdi,-0x60(%rbp) mov %rdi,%rsi test %edx,%edx jle 13de <func0+0x1ae> nopl (%rax) movslq %eax,%rdx add $0x1,%eax imul %rsi,%rdx movl $0x1,(%r8,%rdx,4) cmp %eax,%ecx jne 12e0 <func0+0xb0> mov -0x50(%rbp),%rax cmp $0x1,%eax jle 13de <func0+0x1ae> mov %eax,%edi mov %eax,-0x44(%rbp) add $0x1,%eax lea 0x2(%rbx),%r11 mov %eax,-0x48(%rbp) lea -0x2(%rdi),%eax mov $0x2,%r13d mov %rax,-0x58(%rbp) mov -0x44(%rbp),%r9d sub %r13d,%r9d js 13cc <func0+0x19c> cmp $0x2,%r13d je 1410 <func0+0x1e0> mov %r9d,%r9d lea -0x1(%r13),%r14d lea -0x2(%r13),%r15d xor %eax,%eax jmp 1388 <func0+0x158> nopw %cs:0x0(%rax,%rax,1) movslq %esi,%rsi lea (%rdx,%rcx,1),%rdi mov %rcx,%r12 imul %r10,%rsi lea (%r15,%rax,1),%ecx movslq %ecx,%rcx add %r12,%rcx add %rsi,%rdx mov (%r8,%rdx,4),%edx cmp %edx,(%r8,%rcx,4) cmovge (%r8,%rcx,4),%edx mov %edx,(%r8,%rdi,4) lea 0x1(%rax),%rdx cmp %r9,%rax je 13cc <func0+0x19c> mov %rdx,%rax lea (%r14,%rax,1),%edx movslq %eax,%rcx movzbl (%rbx,%rax,1),%edi lea 0x1(%rax),%esi imul %r10,%rcx movslq %edx,%rdx cmp %dil,-0x1(%rax,%r11,1) jne 1350 <func0+0x120> movslq %esi,%rsi add %rdx,%rcx lea (%r15,%rax,1),%edx imul %r10,%rsi movslq %edx,%rdx add %rdx,%rsi mov (%r8,%rsi,4),%edx add $0x2,%edx mov %edx,(%r8,%rcx,4) lea 0x1(%rax),%rdx cmp %r9,%rax jne 1385 <func0+0x155> add $0x1,%r13d add $0x1,%r11 cmp -0x48(%rbp),%r13d jne 1320 <func0+0xf0> mov -0x50(%rbp),%eax sub $0x1,%eax mov -0x38(%rbp),%rbx xor %fs:0x28,%rbx cltq mov (%r8,%rax,4),%eax jne 1489 <func0+0x259> lea -0x28(%rbp),%rsp pop %rbx pop %r12 pop %r13 pop %r14 pop %r15 pop %rbp retq nopl 0x0(%rax) mov -0x60(%rbp),%rsi mov -0x58(%rbp),%rdi xor %eax,%eax jmp 1459 <func0+0x229> nopl 0x0(%rax) movslq %eax,%rcx movslq %edx,%rdx mov %rcx,%r9 imul %rsi,%rcx imul %r10,%r9 mov (%r8,%rcx,4),%ecx add %rdx,%r9 imul %rsi,%rdx cmp %ecx,(%r8,%rdx,4) cmovge (%r8,%rdx,4),%ecx mov %ecx,(%r8,%r9,4) lea 0x1(%rax),%rdx cmp %rdi,%rax je 13cc <func0+0x19c> mov %rdx,%rax movzbl -0x1(%rax,%r11,1),%ecx lea 0x1(%rax),%edx cmp %cl,(%rbx,%rax,1) jne 1420 <func0+0x1f0> movslq %edx,%rcx movslq %eax,%rdx imul %r10,%rdx add %rcx,%rdx movl $0x2,(%r8,%rdx,4) jmp 1449 <func0+0x219> orq $0x0,-0x8(%rsp,%rsi,1) jmpq 12b6 <func0+0x86> callq 1080 <__stack_chk_fail@plt> xchg %ax,%ax
func0: endbr64 push rbp mov rbp, rsp push r15 push r14 push r13 push r12 mov r12, rdi push rbx sub rsp, 38h mov rax, fs:28h mov [rbp+var_38], rax xor eax, eax call _strlen mov rdi, rsp mov rdx, rax mov esi, eax cdqe lea r10, ds:0[rax*4] imul rax, rax lea rax, ds:0Fh[rax*4] mov rcx, rax and rax, 0FFFFFFFFFFFFF000h sub rdi, rax and rcx, 0FFFFFFFFFFFFFFF0h cmp rsp, rdi jz short loc_12A4 loc_128F: sub rsp, 1000h or [rsp+1060h+var_68], 0 cmp rsp, rdi jnz short loc_128F loc_12A4: and ecx, 0FFFh sub rsp, rcx test rcx, rcx jnz loc_1455 loc_12B6: mov rdi, rsp test edx, edx jle loc_13BA shr r10, 2 xor eax, eax lea r9, [r10+1] nop dword ptr [rax+rax+00h] loc_12D0: movsxd rcx, eax mov ebx, eax add eax, 1 imul rcx, r9 mov dword ptr [rdi+rcx*4], 1 cmp esi, eax jnz short loc_12D0 cmp edx, 1 jz loc_13BA lea r13d, [rdx-2] mov [rbp+var_50], r12 lea r14, [r12+2] mov r15, rdx mov [rbp+var_58], r13 lea r8, [r13+3] mov r11d, 2 xchg ax, ax loc_1310: cmp r11, 2 jz loc_13E8 mov [rbp+var_48], r8 mov rcx, [rbp+var_50] lea edx, [r11-2] xor eax, eax jmp short loc_1365 loc_1330: imul rax, r10 movsxd rdx, edx add rdx, rax lea r13, [r8+rax] movsxd rax, esi imul rax, r10 mov edx, [rdi+rdx*4] add rax, r8 mov eax, [rdi+rax*4] cmp edx, eax cmovl edx, eax add rcx, 1 mov [rdi+r13*4], edx cmp esi, ebx jz short loc_13A3 loc_135F: mov edx, r12d movsxd rax, esi loc_1365: movzx r8d, byte ptr [rcx] lea r12d, [rdx+1] cmp [rcx+r11-1], r8b lea esi, [rax+1] movsxd r8, r12d jnz short loc_1330 movsxd r13, eax movsxd rdx, edx add rcx, 1 imul r13, r10 lea rax, [r8+r13] movsxd r8, esi imul r8, r10 add rdx, r8 mov edx, [rdi+rdx*4] add edx, 2 mov [rdi+rax*4], edx cmp esi, ebx jnz short loc_135F loc_13A3: mov r8, [rbp+var_48] loc_13A7: add r11, 1 sub ebx, 1 cmp r11, r8 jnz loc_1310 mov rdx, r15 loc_13BA: lea eax, [rdx-1] cdqe mov eax, [rdi+rax*4] mov rdx, [rbp+var_38] sub rdx, fs:28h jnz loc_1460 lea rsp, [rbp-28h] pop rbx pop r12 pop r13 pop r14 pop r15 pop rbp retn loc_13E8: mov r13, [rbp+var_58] mov r12, [rbp+var_50] xor eax, eax jmp short loc_1424 loc_13F8: mov rsi, rcx imul rcx, r9 imul rsi, r10 mov ecx, [rdi+rcx*4] add rsi, rdx imul rdx, r9 mov edx, [rdi+rdx*4] cmp edx, ecx cmovl edx, ecx mov [rdi+rsi*4], edx lea rdx, [rax+1] cmp rax, r13 jz short loc_13A7 loc_1421: mov rax, rdx loc_1424: lea edx, [rax+1] movzx esi, byte ptr [r14+rax-1] movsxd rcx, eax movsxd rdx, edx cmp [r12+rax], sil jnz short loc_13F8 imul rcx, r10 add rdx, rcx mov dword ptr [rdi+rdx*4], 2 lea rdx, [rax+1] cmp rax, r13 jnz short loc_1421 jmp loc_13A7 loc_1455: or [rsp+rcx+1060h+var_1068], 0 jmp loc_12B6 loc_1460: call ___stack_chk_fail
long long func0(const char *a1) { int v2; // edx long long v3; // rcx long long *v4; // rdi __int16 v5; // cx signed long long v6; // rcx void *v7; // rsp unsigned long long v8; // r10 int v9; // eax unsigned long long v10; // r9 long long v11; // rcx int v12; // ebx const char *v13; // r14 int v14; // r15d long long v15; // r8 long long v16; // r11 const char *v17; // rcx int v18; // edx long long i; // rax unsigned long long v20; // rax int v21; // edx int v22; // r12d int v23; // esi long long v25; // r13 const char *v26; // r12 long long j; // rax long long v28; // rsi int v29; // edx long long v30; // rdx long long v31; // rdx _DWORD v33[1022]; // [rsp+8h] [rbp-1060h] BYREF long long v34; // [rsp+1008h] [rbp-60h] BYREF long long v35; // [rsp+1010h] [rbp-58h] const char *v36; // [rsp+1018h] [rbp-50h] long long v37; // [rsp+1020h] [rbp-48h] unsigned long long v38; // [rsp+1030h] [rbp-38h] v38 = __readfsqword(0x28u); v2 = strlen(a1); v3 = 4 * v2 * (long long)v2 + 15; v4 = (long long *)((char *)&v34 - (v3 & 0xFFFFFFFFFFFFF000LL)); v5 = v3 & 0xFFF0; if ( &v34 != v4 ) { while ( v33 != (_DWORD *)v4 ) ; } v6 = v5 & 0xFFF; v7 = alloca(v6); if ( v6 ) *(_QWORD *)((char *)&v33[-2] + v6) = *(_QWORD *)((char *)&v33[-2] + v6); if ( v2 > 0 ) { v8 = (unsigned long long)(4LL * v2) >> 2; v9 = 0; v10 = v8 + 1; do { v11 = v9; v12 = v9++; v33[v10 * v11] = 1; } while ( v2 != v9 ); if ( v2 != 1 ) { v36 = a1; v13 = a1 + 2; v14 = v2; v35 = (unsigned int)(v2 - 2); v15 = v35 + 3; v16 = 2LL; while ( 1 ) { if ( v16 != 2 ) { v37 = v15; v17 = v36; v18 = v16 - 2; for ( i = 0LL; ; i = v23 ) { v22 = v18 + 1; v23 = i + 1; if ( v17[v16 - 1] == *v17 ) { ++v17; v33[v22 + v8 * (int)i] = v33[v8 * v23 + v18] + 2; if ( v23 == v12 ) goto LABEL_18; } else { v20 = v8 * i; v21 = v33[v20 + v18]; if ( v21 < v33[v22 + v8 * v23] ) v21 = v33[v22 + v8 * v23]; ++v17; v33[v22 + v20] = v21; if ( v23 == v12 ) { LABEL_18: v15 = v37; goto LABEL_19; } } v18 = v22; } } v25 = v35; v26 = v36; for ( j = 0LL; ; j = v30 ) { v31 = (int)j + 1; if ( v26[j] != v13[j - 1] ) break; v33[v8 * (int)j + v31] = 2; v30 = j + 1; if ( j == v25 ) goto LABEL_19; LABEL_26: ; } v28 = v31 + v8 * (int)j; v29 = v33[v10 * v31]; if ( v29 < v33[v10 * (int)j] ) v29 = v33[v10 * (int)j]; v33[v28] = v29; v30 = j + 1; if ( j != v25 ) goto LABEL_26; LABEL_19: ++v16; --v12; if ( v16 == v15 ) { v2 = v14; return (unsigned int)v33[v2 - 1]; } } } } return (unsigned int)v33[v2 - 1]; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R15 PUSH R14 PUSH R13 PUSH R12 MOV R12,RDI PUSH RBX SUB RSP,0x38 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x38],RAX XOR EAX,EAX CALL 0x00101070 MOV RDI,RSP MOV RDX,RAX MOV ESI,EAX CDQE LEA R10,[RAX*0x4] IMUL RAX,RAX LEA RAX,[0xf + RAX*0x4] MOV RCX,RAX AND RAX,-0x1000 SUB RDI,RAX AND RCX,-0x10 CMP RSP,RDI JZ 0x001012a4 LAB_0010128f: SUB RSP,0x1000 OR qword ptr [RSP + 0xff8],0x0 CMP RSP,RDI JNZ 0x0010128f LAB_001012a4: AND ECX,0xfff SUB RSP,RCX TEST RCX,RCX JNZ 0x00101455 LAB_001012b6: MOV RDI,RSP TEST EDX,EDX JLE 0x001013ba SHR R10,0x2 XOR EAX,EAX LEA R9,[R10 + 0x1] NOP dword ptr [RAX + RAX*0x1] LAB_001012d0: MOVSXD RCX,EAX MOV EBX,EAX ADD EAX,0x1 IMUL RCX,R9 MOV dword ptr [RDI + RCX*0x4],0x1 CMP ESI,EAX JNZ 0x001012d0 CMP EDX,0x1 JZ 0x001013ba LEA R13D,[RDX + -0x2] MOV qword ptr [RBP + -0x50],R12 LEA R14,[R12 + 0x2] MOV R15,RDX MOV qword ptr [RBP + -0x58],R13 LEA R8,[R13 + 0x3] MOV R11D,0x2 NOP LAB_00101310: CMP R11,0x2 JZ 0x001013e8 MOV qword ptr [RBP + -0x48],R8 MOV RCX,qword ptr [RBP + -0x50] LEA EDX,[R11 + -0x2] XOR EAX,EAX JMP 0x00101365 LAB_00101330: IMUL RAX,R10 MOVSXD RDX,EDX ADD RDX,RAX LEA R13,[R8 + RAX*0x1] MOVSXD RAX,ESI IMUL RAX,R10 MOV EDX,dword ptr [RDI + RDX*0x4] ADD RAX,R8 MOV EAX,dword ptr [RDI + RAX*0x4] CMP EDX,EAX CMOVL EDX,EAX ADD RCX,0x1 MOV dword ptr [RDI + R13*0x4],EDX CMP ESI,EBX JZ 0x001013a3 LAB_0010135f: MOV EDX,R12D MOVSXD RAX,ESI LAB_00101365: MOVZX R8D,byte ptr [RCX] LEA R12D,[RDX + 0x1] CMP byte ptr [RCX + R11*0x1 + -0x1],R8B LEA ESI,[RAX + 0x1] MOVSXD R8,R12D JNZ 0x00101330 MOVSXD R13,EAX MOVSXD RDX,EDX ADD RCX,0x1 IMUL R13,R10 LEA RAX,[R8 + R13*0x1] MOVSXD R8,ESI IMUL R8,R10 ADD RDX,R8 MOV EDX,dword ptr [RDI + RDX*0x4] ADD EDX,0x2 MOV dword ptr [RDI + RAX*0x4],EDX CMP ESI,EBX JNZ 0x0010135f LAB_001013a3: MOV R8,qword ptr [RBP + -0x48] LAB_001013a7: ADD R11,0x1 SUB EBX,0x1 CMP R11,R8 JNZ 0x00101310 MOV RDX,R15 LAB_001013ba: LEA EAX,[RDX + -0x1] CDQE MOV EAX,dword ptr [RDI + RAX*0x4] MOV RDX,qword ptr [RBP + -0x38] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101460 LEA RSP,[RBP + -0x28] POP RBX POP R12 POP R13 POP R14 POP R15 POP RBP RET LAB_001013e8: MOV R13,qword ptr [RBP + -0x58] MOV R12,qword ptr [RBP + -0x50] XOR EAX,EAX JMP 0x00101424 LAB_001013f8: MOV RSI,RCX IMUL RCX,R9 IMUL RSI,R10 MOV ECX,dword ptr [RDI + RCX*0x4] ADD RSI,RDX IMUL RDX,R9 MOV EDX,dword ptr [RDI + RDX*0x4] CMP EDX,ECX CMOVL EDX,ECX MOV dword ptr [RDI + RSI*0x4],EDX LEA RDX,[RAX + 0x1] CMP RAX,R13 JZ 0x001013a7 LAB_00101421: MOV RAX,RDX LAB_00101424: LEA EDX,[RAX + 0x1] MOVZX ESI,byte ptr [R14 + RAX*0x1 + -0x1] MOVSXD RCX,EAX MOVSXD RDX,EDX CMP byte ptr [R12 + RAX*0x1],SIL JNZ 0x001013f8 IMUL RCX,R10 ADD RDX,RCX MOV dword ptr [RDI + RDX*0x4],0x2 LEA RDX,[RAX + 0x1] CMP RAX,R13 JNZ 0x00101421 JMP 0x001013a7 LAB_00101455: OR qword ptr [RSP + RCX*0x1 + -0x8],0x0 JMP 0x001012b6 LAB_00101460: CALL 0x00101080
int4 func0(char *param_1) { long lVar1; long lVar2; int iVar3; int *puVar4; int iVar5; size_t sVar6; ulong uVar7; long lVar8; char *pcVar9; int iVar10; ulong uVar11; int iVar12; int *puVar13; int iVar15; long lVar16; long lVar17; long in_FS_OFFSET; int auStack_68 [8]; ulong local_60; char *local_58; long local_50; long local_40; int *puVar14; puVar13 = auStack_68; local_40 = *(long *)(in_FS_OFFSET + 0x28); sVar6 = strlen(param_1); iVar5 = (int)sVar6; uVar7 = (ulong)iVar5; uVar11 = uVar7 * uVar7 * 4 + 0xf; puVar14 = auStack_68; puVar4 = auStack_68; while (puVar14 != auStack_68 + -(uVar11 & 0xfffffffffffff000)) { puVar13 = puVar4 + -0x1000; *(int8 *)(puVar4 + -8) = *(int8 *)(puVar4 + -8); puVar14 = puVar4 + -0x1000; puVar4 = puVar4 + -0x1000; } uVar11 = (ulong)((uint)uVar11 & 0xff0); lVar2 = -uVar11; if (uVar11 != 0) { *(int8 *)(puVar13 + -8) = *(int8 *)(puVar13 + -8); } if (0 < iVar5) { uVar7 = uVar7 & 0x3fffffffffffffff; lVar1 = uVar7 + 1; iVar10 = 0; do { iVar12 = iVar10; *(int4 *)(puVar13 + iVar12 * lVar1 * 4 + lVar2) = 1; iVar10 = iVar12 + 1; } while (iVar5 != iVar12 + 1); if (iVar5 != 1) { local_60 = (ulong)(iVar5 - 2); lVar17 = 2; do { if (lVar17 == 2) { uVar11 = 0; while( true ) { lVar8 = (long)(int)uVar11; lVar16 = (long)((int)uVar11 + 1); if (param_1[uVar11] == param_1[uVar11 + 1]) { *(int4 *)(puVar13 + (lVar16 + lVar8 * uVar7) * 4 + lVar2) = 2; } else { iVar10 = *(int *)(puVar13 + lVar16 * lVar1 * 4 + lVar2); if (*(int *)(puVar13 + lVar16 * lVar1 * 4 + lVar2) < *(int *)(puVar13 + lVar8 * lVar1 * 4 + lVar2)) { iVar10 = *(int *)(puVar13 + lVar8 * lVar1 * 4 + lVar2); } *(int *)(puVar13 + (lVar8 * uVar7 + lVar16) * 4 + lVar2) = iVar10; } if (uVar11 == local_60) break; uVar11 = uVar11 + 1; } } else { lVar8 = 0; pcVar9 = param_1; iVar10 = (int)lVar17 + -2; while( true ) { iVar15 = (int)lVar8 + 1; lVar16 = (long)(iVar10 + 1); if (pcVar9[lVar17 + -1] == *pcVar9) { *(int *)(puVar13 + (lVar16 + (long)(int)lVar8 * uVar7) * 4 + lVar2) = *(int *)(puVar13 + ((long)iVar10 + (long)iVar15 * uVar7) * 4 + lVar2) + 2; } else { iVar3 = *(int *)(puVar13 + ((long)iVar10 + lVar8 * uVar7) * 4 + lVar2); if (*(int *)(puVar13 + ((long)iVar10 + lVar8 * uVar7) * 4 + lVar2) < *(int *)(puVar13 + ((long)iVar15 * uVar7 + lVar16) * 4 + lVar2)) { iVar3 = *(int *)(puVar13 + ((long)iVar15 * uVar7 + lVar16) * 4 + lVar2); } *(int *)(puVar13 + (lVar16 + lVar8 * uVar7) * 4 + lVar2) = iVar3; } local_50 = local_60 + 3; if (iVar15 == iVar12) break; pcVar9 = pcVar9 + 1; lVar8 = (long)iVar15; iVar10 = iVar10 + 1; } } lVar17 = lVar17 + 1; iVar12 = iVar12 + -1; local_58 = param_1; } while (lVar17 != local_60 + 3); } } if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(int8 *)(puVar13 + lVar2 + -8) = 0x101465; __stack_chk_fail(); } return *(int4 *)(puVar13 + (long)(iVar5 + -1) * 4 + lVar2); }
4,884
func0
#include <assert.h>
double func0(int n) { if (n < 2) { return 1; } else { return 1.0 / n + func0(n - 1); } }
int main() { assert(func0(7) - 2.5928571428571425 < 0.000001); assert(func0(4) - 2.083333333333333 < 0.000001); assert(func0(19) - 3.547739657143682 < 0.000001); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov %edi,-0x4(%rbp) cmpl $0x1,-0x4(%rbp) jg 1168 <func0+0x1f> movsd 0xf6a(%rip),%xmm0 jmp 1190 <func0+0x47> cvtsi2sdl -0x4(%rbp),%xmm1 movsd 0xf5b(%rip),%xmm0 divsd %xmm1,%xmm0 movsd %xmm0,-0x10(%rbp) mov -0x4(%rbp),%eax sub $0x1,%eax mov %eax,%edi callq 1149 <func0> addsd -0x10(%rbp),%xmm0 leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 10h mov [rbp+var_4], edi cmp [rbp+var_4], 1 jg short loc_1168 movsd xmm0, cs:qword_20B0 jmp short locret_1194 loc_1168: pxor xmm1, xmm1 cvtsi2sd xmm1, [rbp+var_4] movsd xmm0, cs:qword_20B0 divsd xmm0, xmm1 movsd [rbp+var_10], xmm0 mov eax, [rbp+var_4] sub eax, 1 mov edi, eax call func0 addsd xmm0, [rbp+var_10] locret_1194: leave retn
double func0(int a1) { if ( a1 > 1 ) return func0((unsigned int)(a1 - 1)) + 1.0 / (double)a1; else return 1.0; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x10 MOV dword ptr [RBP + -0x4],EDI CMP dword ptr [RBP + -0x4],0x1 JG 0x00101168 MOVSD XMM0,qword ptr [0x001020b0] JMP 0x00101194 LAB_00101168: PXOR XMM1,XMM1 CVTSI2SD XMM1,dword ptr [RBP + -0x4] MOVSD XMM0,qword ptr [0x001020b0] DIVSD XMM0,XMM1 MOVSD qword ptr [RBP + -0x10],XMM0 MOV EAX,dword ptr [RBP + -0x4] SUB EAX,0x1 MOV EDI,EAX CALL 0x00101149 ADDSD XMM0,qword ptr [RBP + -0x10] LAB_00101194: LEAVE RET
double func0(int param_1) { double dVar1; double dVar2; dVar1 = DAT_001020b0; if (1 < param_1) { dVar1 = DAT_001020b0 / (double)param_1; dVar2 = (double)func0(param_1 + -1); dVar1 = dVar2 + dVar1; } return dVar1; }
4,885
func0
#include <assert.h>
double func0(int n) { if (n < 2) { return 1; } else { return 1.0 / n + func0(n - 1); } }
int main() { assert(func0(7) - 2.5928571428571425 < 0.000001); assert(func0(4) - 2.083333333333333 < 0.000001); assert(func0(19) - 3.547739657143682 < 0.000001); return 0; }
O1
c
func0: endbr64 movsd 0xf7b(%rip),%xmm0 cmp $0x1,%edi jg 115b <func0+0x12> retq push %rbx mov %edi,%ebx lea -0x1(%rdi),%edi callq 1149 <func0> movapd %xmm0,%xmm2 pxor %xmm1,%xmm1 cvtsi2sd %ebx,%xmm1 movsd 0xf56(%rip),%xmm0 divsd %xmm1,%xmm0 addsd %xmm2,%xmm0 pop %rbx retq
func0: endbr64 movsd xmm0, cs:qword_20B0 cmp edi, 1 jg short loc_115B retn loc_115B: push rbx mov ebx, edi lea edi, [rdi-1] call func0 movapd xmm1, xmm0 pxor xmm2, xmm2 cvtsi2sd xmm2, ebx movsd xmm0, cs:qword_20B0 divsd xmm0, xmm2 addsd xmm0, xmm1 pop rbx retn
double func0(int a1) { double result; // xmm0_8 result = 1.0; if ( a1 > 1 ) return 1.0 / (double)a1 + func0((unsigned int)(a1 - 1), 1.0); return result; }
func0: ENDBR64 MOVSD XMM0,qword ptr [0x001020b0] CMP EDI,0x1 JG 0x0010115b RET LAB_0010115b: PUSH RBX MOV EBX,EDI LEA EDI,[RDI + -0x1] CALL 0x00101149 MOVAPD XMM1,XMM0 PXOR XMM2,XMM2 CVTSI2SD XMM2,EBX MOVSD XMM0,qword ptr [0x001020b0] DIVSD XMM0,XMM2 ADDSD XMM0,XMM1 POP RBX RET
double func0(int param_1) { double dVar1; if (param_1 < 2) { return DAT_001020b0; } dVar1 = (double)func0(DAT_001020b0,param_1 + -1); return DAT_001020b0 / (double)param_1 + dVar1; }
4,886
func0
#include <assert.h>
double func0(int n) { if (n < 2) { return 1; } else { return 1.0 / n + func0(n - 1); } }
int main() { assert(func0(7) - 2.5928571428571425 < 0.000001); assert(func0(4) - 2.083333333333333 < 0.000001); assert(func0(19) - 3.547739657143682 < 0.000001); return 0; }
O2
c
func0: endbr64 cmp $0x1,%edi jg 1258 <func0+0x18> movsd 0xe7f(%rip),%xmm0 retq nopw 0x0(%rax,%rax,1) jmp 1260 <func0.part.0> nopw 0x0(%rax,%rax,1)
func0: endbr64 movsd xmm0, cs:qword_20B0 cmp edi, 1 jg short loc_1248 retn loc_1248: pxor xmm1, xmm1 movapd xmm3, xmm0 lea eax, [rdi-1] cvtsi2sd xmm1, edi divsd xmm3, xmm1 cmp edi, 2 jnz short loc_1270 addsd xmm3, xmm0 movapd xmm0, xmm3 retn loc_1270: pxor xmm1, xmm1 push rbx movapd xmm2, xmm0 lea ebx, [rdi-2] cvtsi2sd xmm1, eax sub rsp, 20h divsd xmm2, xmm1 movapd xmm1, xmm0 cmp edi, 3 jz short loc_12CD sub edi, 3 movsd [rsp+28h+var_18], xmm2 movsd [rsp+28h+var_20], xmm3 movsd [rsp+28h+var_10], xmm0 call func0 pxor xmm5, xmm5 movsd xmm1, [rsp+28h+var_10] movsd xmm2, [rsp+28h+var_18] cvtsi2sd xmm5, ebx movsd xmm3, [rsp+28h+var_20] divsd xmm1, xmm5 addsd xmm1, xmm0 loc_12CD: addsd xmm1, xmm2 add rsp, 20h pop rbx addsd xmm3, xmm1 movapd xmm0, xmm3 retn
__int128 __usercall func0@<xmm0>(int a1@<edi>) { __int128 result; // xmm0 int v2; // eax __int128 v3; // xmm3 double v4; // xmm2_8 double v5; // xmm1_8 result = 0x3FF0000000000000uLL; if ( a1 > 1 ) { *((_QWORD *)&v3 + 1) = 0LL; v2 = a1 - 1; *(double *)&v3 = 1.0 / (double)a1; if ( a1 == 2 ) { *(double *)&v3 = *(double *)&v3 + 1.0; return v3; } else { v4 = 1.0 / (double)v2; v5 = 1.0; if ( a1 != 3 ) { v4 = 1.0 / (double)v2; v3 = (unsigned long long)v3; v5 = 1.0 / (double)(a1 - 2) + func0((unsigned int)(a1 - 3), 1.0, 1.0); } *(double *)&v3 = *(double *)&v3 + v5 + v4; return v3; } } return result; }
func0: ENDBR64 MOVSD XMM0,qword ptr [0x001020b0] CMP EDI,0x1 JG 0x00101248 RET LAB_00101248: PXOR XMM1,XMM1 MOVAPD XMM3,XMM0 LEA EAX,[RDI + -0x1] CVTSI2SD XMM1,EDI DIVSD XMM3,XMM1 CMP EDI,0x2 JNZ 0x00101270 ADDSD XMM3,XMM0 MOVAPD XMM0,XMM3 RET LAB_00101270: PXOR XMM1,XMM1 PUSH RBX MOVAPD XMM2,XMM0 LEA EBX,[RDI + -0x2] CVTSI2SD XMM1,EAX SUB RSP,0x20 DIVSD XMM2,XMM1 MOVAPD XMM1,XMM0 CMP EDI,0x3 JZ 0x001012cd SUB EDI,0x3 MOVSD qword ptr [RSP + 0x10],XMM2 MOVSD qword ptr [RSP + 0x8],XMM3 MOVSD qword ptr [RSP + 0x18],XMM0 CALL 0x00101230 PXOR XMM5,XMM5 MOVSD XMM1,qword ptr [RSP + 0x18] MOVSD XMM2,qword ptr [RSP + 0x10] CVTSI2SD XMM5,EBX MOVSD XMM3,qword ptr [RSP + 0x8] DIVSD XMM1,XMM5 ADDSD XMM1,XMM0 LAB_001012cd: ADDSD XMM1,XMM2 ADD RSP,0x20 POP RBX ADDSD XMM3,XMM1 MOVAPD XMM0,XMM3 RET
double func0(int param_1) { double dVar1; double dVar2; double dVar3; double dVar4; dVar1 = DAT_001020b0; if (param_1 < 2) { return DAT_001020b0; } dVar4 = DAT_001020b0 / (double)param_1; if (param_1 == 2) { return dVar4 + DAT_001020b0; } dVar3 = DAT_001020b0 / (double)(param_1 + -1); dVar2 = DAT_001020b0; if (param_1 != 3) { dVar2 = (double)func0(param_1 + -3); dVar2 = dVar1 / (double)(param_1 + -2) + dVar2; } return dVar4 + dVar2 + dVar3; }
4,887
func0
#include <assert.h>
double func0(int n) { if (n < 2) { return 1; } else { return 1.0 / n + func0(n - 1); } }
int main() { assert(func0(7) - 2.5928571428571425 < 0.000001); assert(func0(4) - 2.083333333333333 < 0.000001); assert(func0(19) - 3.547739657143682 < 0.000001); return 0; }
O3
c
func0: endbr64 movsd 0xe94(%rip),%xmm1 cmp $0x1,%edi jg 1250 <func0+0x20> movapd %xmm1,%xmm0 retq nopw %cs:0x0(%rax,%rax,1) push %rbx mov %edi,%ebx lea -0x1(%rdi),%edi sub $0x10,%rsp movsd %xmm1,0x8(%rsp) callq 1230 <func0> movsd 0x8(%rsp),%xmm1 add $0x10,%rsp movapd %xmm0,%xmm2 pxor %xmm0,%xmm0 cvtsi2sd %ebx,%xmm0 pop %rbx divsd %xmm0,%xmm1 addsd %xmm2,%xmm1 movapd %xmm1,%xmm0 retq nopl 0x0(%rax)
func0: endbr64 movsd xmm0, cs:qword_20B0 cmp edi, 1 jg short loc_1248 retn loc_1248: pxor xmm1, xmm1 movapd xmm2, xmm0 lea eax, [rdi-1] cvtsi2sd xmm1, edi divsd xmm2, xmm1 movapd xmm1, xmm0 cmp edi, 2 jnz short loc_1270 addsd xmm2, xmm1 movapd xmm0, xmm2 retn loc_1270: pxor xmm3, xmm3 cvtsi2sd xmm3, eax lea eax, [rdi-2] divsd xmm1, xmm3 cmp edi, 3 jnz short loc_1298 addsd xmm1, xmm0 addsd xmm2, xmm1 movapd xmm0, xmm2 retn loc_1298: pxor xmm3, xmm3 sub rsp, 28h sub edi, 3 cvtsi2sd xmm3, eax movsd [rsp+28h+var_10], xmm1 movsd [rsp+28h+var_18], xmm2 divsd xmm0, xmm3 movsd [rsp+28h+var_20], xmm0 call func0 addsd xmm0, [rsp+28h+var_20] movsd xmm1, [rsp+28h+var_10] movsd xmm2, [rsp+28h+var_18] add rsp, 28h addsd xmm1, xmm0 addsd xmm2, xmm1 movapd xmm0, xmm2 retn
__int128 __usercall func0@<xmm0>(int a1@<edi>) { __int128 result; // xmm0 __int128 v2; // xmm2 int v3; // eax double v4; // xmm1_8 result = 0x3FF0000000000000uLL; if ( a1 > 1 ) { *((_QWORD *)&v2 + 1) = 0LL; *(double *)&v2 = 1.0 / (double)a1; if ( a1 == 2 ) { *(double *)&v2 = *(double *)&v2 + 1.0; return v2; } else { v4 = 1.0 / (double)(a1 - 1); if ( a1 == 3 ) { *(double *)&v2 = *(double *)&v2 + v4 + 1.0; } else { v2 = (unsigned long long)v2; v3 = a1 - 2; *(double *)&v2 = *(double *)&v2 + v4 + func0((unsigned int)(a1 - 3)) + 1.0 / (double)v3; } return v2; } } return result; }
func0: ENDBR64 MOVSD XMM0,qword ptr [0x001020b0] CMP EDI,0x1 JG 0x00101248 RET LAB_00101248: PXOR XMM1,XMM1 MOVAPD XMM2,XMM0 LEA EAX,[RDI + -0x1] CVTSI2SD XMM1,EDI DIVSD XMM2,XMM1 MOVAPD XMM1,XMM0 CMP EDI,0x2 JNZ 0x00101270 ADDSD XMM2,XMM1 MOVAPD XMM0,XMM2 RET LAB_00101270: PXOR XMM3,XMM3 CVTSI2SD XMM3,EAX LEA EAX,[RDI + -0x2] DIVSD XMM1,XMM3 CMP EDI,0x3 JNZ 0x00101298 ADDSD XMM1,XMM0 ADDSD XMM2,XMM1 MOVAPD XMM0,XMM2 RET LAB_00101298: PXOR XMM3,XMM3 SUB RSP,0x28 SUB EDI,0x3 CVTSI2SD XMM3,EAX MOVSD qword ptr [RSP + 0x18],XMM1 MOVSD qword ptr [RSP + 0x10],XMM2 DIVSD XMM0,XMM3 MOVSD qword ptr [RSP + 0x8],XMM0 CALL 0x00101230 ADDSD XMM0,qword ptr [RSP + 0x8] MOVSD XMM1,qword ptr [RSP + 0x18] MOVSD XMM2,qword ptr [RSP + 0x10] ADD RSP,0x28 ADDSD XMM1,XMM0 ADDSD XMM2,XMM1 MOVAPD XMM0,XMM2 RET
double func0(int param_1) { double dVar1; double dVar2; double dVar3; double dVar4; if (param_1 < 2) { return DAT_001020b0; } dVar4 = DAT_001020b0 / (double)param_1; if (param_1 == 2) { return dVar4 + DAT_001020b0; } dVar3 = DAT_001020b0 / (double)(param_1 + -1); if (param_1 == 3) { return dVar4 + dVar3 + DAT_001020b0; } dVar1 = DAT_001020b0 / (double)(param_1 + -2); dVar2 = (double)func0(param_1 + -3); return dVar4 + dVar3 + dVar2 + dVar1; }
4,888
func0
#include <stdio.h> #include <assert.h>
int *func0(int array_nums1[], int len1, int array_nums2[], int len2, int *result_len) { static int result[1000]; // Static to avoid the result variable from becoming local only to this function int k = 0; for (int i = 0; i < len2; i++) { for (int j = 0; j < len1; j++) { if (array_nums2[i] == array_nums1[j]) { result[k++] = array_nums2[i]; break; } } } *result_len = k; return result; }
int main() { int result_len; int *result; int array1[] = {1, 2, 3, 5, 7, 8, 9, 10}; int array2[] = {1, 2, 4, 8, 9}; int expected1[] = {1, 2, 8, 9}; result = func0(array1, 8, array2, 5, &result_len); assert(result_len == 4); for (int i = 0; i < result_len; i++) { assert(result[i] == expected1[i]); } int array3[] = {3, 5, 7, 9}; int expected2[] = {3, 5, 7, 9}; result = func0(array1, 8, array3, 4, &result_len); assert(result_len == 4); for (int i = 0; i < result_len; i++) { assert(result[i] == expected2[i]); } int array4[] = {10, 20, 30, 40}; int expected3[] = {10}; result = func0(array1, 8, array4, 4, &result_len); assert(result_len == 1); for (int i = 0; i < result_len; i++) { assert(result[i] == expected3[i]); } printf("All tests passed!\n"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %rdx,-0x28(%rbp) mov %ecx,-0x20(%rbp) mov %r8,-0x30(%rbp) movl $0x0,-0xc(%rbp) movl $0x0,-0x8(%rbp) jmp 1232 <func0+0xa9> movl $0x0,-0x4(%rbp) jmp 1226 <func0+0x9d> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%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 cmp %eax,%edx jne 1222 <func0+0x99> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0xc(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0xc(%rbp) mov (%rcx),%edx cltq lea 0x0(,%rax,4),%rcx lea 0x2e23(%rip),%rax mov %edx,(%rcx,%rax,1) jmp 122e <func0+0xa5> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11bc <func0+0x33> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x20(%rbp),%eax jl 11b3 <func0+0x2a> mov -0x30(%rbp),%rax mov -0xc(%rbp),%edx mov %edx,(%rax) lea 0x2df2(%rip),%rax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_28], rdx mov [rbp+var_20], ecx mov [rbp+var_30], r8 mov [rbp+var_C], 0 mov [rbp+var_8], 0 jmp short loc_1232 loc_11B3: mov [rbp+var_4], 0 jmp short loc_1226 loc_11BC: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] 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] cmp edx, eax jnz short loc_1222 mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] lea rcx, [rdx+rax] mov eax, [rbp+var_C] lea edx, [rax+1] mov [rbp+var_C], edx mov edx, [rcx] cdqe lea rcx, ds:0[rax*4] lea rax, result_1 mov [rcx+rax], edx jmp short loc_122E loc_1222: add [rbp+var_4], 1 loc_1226: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_11BC loc_122E: add [rbp+var_8], 1 loc_1232: mov eax, [rbp+var_8] cmp eax, [rbp+var_20] jl loc_11B3 mov rax, [rbp+var_30] mov edx, [rbp+var_C] mov [rax], edx lea rax, result_1 pop rbp retn
_DWORD * func0(long long a1, int a2, long long a3, int a4, _DWORD *a5) { int v5; // eax int v7; // [rsp+24h] [rbp-Ch] int i; // [rsp+28h] [rbp-8h] int j; // [rsp+2Ch] [rbp-4h] v7 = 0; for ( i = 0; i < a4; ++i ) { for ( j = 0; j < a2; ++j ) { if ( *(_DWORD *)(4LL * i + a3) == *(_DWORD *)(4LL * j + a1) ) { v5 = v7++; result_1[v5] = *(_DWORD *)(4LL * i + a3); break; } } } *a5 = v7; return result_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x20],ECX MOV qword ptr [RBP + -0x30],R8 MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x8],0x0 JMP 0x00101232 LAB_001011b3: MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101226 LAB_001011bc: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] 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] CMP EDX,EAX JNZ 0x00101222 MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] LEA RCX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0xc] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0xc],EDX MOV EDX,dword ptr [RCX] CDQE LEA RCX,[RAX*0x4] LEA RAX,[0x104040] MOV dword ptr [RCX + RAX*0x1],EDX JMP 0x0010122e LAB_00101222: ADD dword ptr [RBP + -0x4],0x1 LAB_00101226: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011bc LAB_0010122e: ADD dword ptr [RBP + -0x8],0x1 LAB_00101232: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x20] JL 0x001011b3 MOV RAX,qword ptr [RBP + -0x30] MOV EDX,dword ptr [RBP + -0xc] MOV dword ptr [RAX],EDX LEA RAX,[0x104040] POP RBP RET
int1 * func0(long param_1,int param_2,long param_3,int param_4,int *param_5) { int local_14; int local_10; int local_c; local_14 = 0; local_10 = 0; do { if (param_4 <= local_10) { *param_5 = local_14; return result_1; } for (local_c = 0; local_c < param_2; local_c = local_c + 1) { if (*(int *)(param_3 + (long)local_10 * 4) == *(int *)(param_1 + (long)local_c * 4)) { *(int4 *)(result_1 + (long)local_14 * 4) = *(int4 *)((long)local_10 * 4 + param_3); local_14 = local_14 + 1; break; } } local_10 = local_10 + 1; } while( true ); }
4,889
func0
#include <stdio.h> #include <assert.h>
int *func0(int array_nums1[], int len1, int array_nums2[], int len2, int *result_len) { static int result[1000]; // Static to avoid the result variable from becoming local only to this function int k = 0; for (int i = 0; i < len2; i++) { for (int j = 0; j < len1; j++) { if (array_nums2[i] == array_nums1[j]) { result[k++] = array_nums2[i]; break; } } } *result_len = k; return result; }
int main() { int result_len; int *result; int array1[] = {1, 2, 3, 5, 7, 8, 9, 10}; int array2[] = {1, 2, 4, 8, 9}; int expected1[] = {1, 2, 8, 9}; result = func0(array1, 8, array2, 5, &result_len); assert(result_len == 4); for (int i = 0; i < result_len; i++) { assert(result[i] == expected1[i]); } int array3[] = {3, 5, 7, 9}; int expected2[] = {3, 5, 7, 9}; result = func0(array1, 8, array3, 4, &result_len); assert(result_len == 4); for (int i = 0; i < result_len; i++) { assert(result[i] == expected2[i]); } int array4[] = {10, 20, 30, 40}; int expected3[] = {10}; result = func0(array1, 8, array4, 4, &result_len); assert(result_len == 1); for (int i = 0; i < result_len; i++) { assert(result[i] == expected3[i]); } printf("All tests passed!\n"); return 0; }
O1
c
func0: endbr64 push %rbx mov %r8,%rbx test %ecx,%ecx jle 11e5 <func0+0x5c> mov %rdx,%r9 lea -0x1(%rcx),%eax lea 0x4(%rdx,%rax,4),%r10 mov %rdi,%r11 lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rcx mov $0x0,%edi lea 0x2e89(%rip),%r8 jmp 11cc <func0+0x43> movslq %edi,%rax mov %edx,(%r8,%rax,4) lea 0x1(%rdi),%edi add $0x4,%r9 cmp %r10,%r9 je 11ea <func0+0x61> test %esi,%esi jle 11c3 <func0+0x3a> mov (%r9),%edx mov %r11,%rax cmp (%rax),%edx je 11b9 <func0+0x30> add $0x4,%rax cmp %rcx,%rax jne 11d6 <func0+0x4d> jmp 11c3 <func0+0x3a> mov $0x0,%edi mov %edi,(%rbx) lea 0x2e4d(%rip),%rax pop %rbx retq
func0: endbr64 test ecx, ecx jle short loc_11E5 push rbx mov r10, rdi mov r9d, esi mov rsi, rdx lea eax, [rcx-1] lea r11, [rdx+rax*4+4] lea eax, [r9-1] lea rcx, [rdi+rax*4+4] mov edi, 0 lea rbx, result_1 jmp short loc_11CC loc_11BA: movsxd rax, edi mov [rbx+rax*4], edx lea edi, [rdi+1] loc_11C3: add rsi, 4 cmp rsi, r11 jz short loc_11F5 loc_11CC: test r9d, r9d jle short loc_11C3 mov edx, [rsi] mov rax, r10 loc_11D6: cmp edx, [rax] jz short loc_11BA add rax, 4 cmp rax, rcx jnz short loc_11D6 jmp short loc_11C3 loc_11E5: mov edi, 0 mov [r8], edi lea rax, result_1 retn loc_11F5: mov [r8], edi lea rax, result_1 pop rbx retn
_DWORD * func0(_DWORD *a1, int a2, int *a3, int a4, _DWORD *a5) { int *v7; // rsi long long v8; // r11 long long v9; // rcx int v10; // edi int v11; // edx _DWORD *v12; // rax if ( a4 <= 0 ) { *a5 = 0; return result_1; } else { v7 = a3; v8 = (long long)&a3[a4 - 1 + 1]; v9 = (long long)&a1[a2 - 1 + 1]; v10 = 0; do { if ( a2 > 0 ) { v11 = *v7; v12 = a1; while ( v11 != *v12 ) { if ( ++v12 == (_DWORD *)v9 ) goto LABEL_4; } result_1[v10++] = v11; } LABEL_4: ++v7; } while ( v7 != (int *)v8 ); *a5 = v10; return result_1; } }
func0: ENDBR64 TEST ECX,ECX JLE 0x001011e5 PUSH RBX MOV R10,RDI MOV R9D,ESI MOV RSI,RDX LEA EAX,[RCX + -0x1] LEA R11,[RDX + RAX*0x4 + 0x4] LEA EAX,[R9 + -0x1] LEA RCX,[RDI + RAX*0x4 + 0x4] MOV EDI,0x0 LEA RBX,[0x104040] JMP 0x001011cc LAB_001011ba: MOVSXD RAX,EDI MOV dword ptr [RBX + RAX*0x4],EDX LEA EDI,[RDI + 0x1] LAB_001011c3: ADD RSI,0x4 CMP RSI,R11 JZ 0x001011f5 LAB_001011cc: TEST R9D,R9D JLE 0x001011c3 MOV EDX,dword ptr [RSI] MOV RAX,R10 LAB_001011d6: CMP EDX,dword ptr [RAX] JZ 0x001011ba ADD RAX,0x4 CMP RAX,RCX JNZ 0x001011d6 JMP 0x001011c3 LAB_001011e5: MOV EDI,0x0 MOV dword ptr [R8],EDI LEA RAX,[0x104040] RET LAB_001011f5: MOV dword ptr [R8],EDI LEA RAX,[0x104040] POP RBX RET
int4 * func0(int *param_1,int param_2,int *param_3,int param_4,int *param_5) { int *piVar1; int *piVar2; int iVar3; if (param_4 < 1) { *param_5 = 0; return &result_1; } piVar1 = param_3 + (ulong)(param_4 - 1) + 1; iVar3 = 0; do { if (0 < param_2) { piVar2 = param_1; do { if (*param_3 == *piVar2) { (&result_1)[iVar3] = *param_3; iVar3 = iVar3 + 1; break; } piVar2 = piVar2 + 1; } while (piVar2 != param_1 + (ulong)(param_2 - 1) + 1); } param_3 = param_3 + 1; if (param_3 == piVar1) { *param_5 = iVar3; return &result_1; } } while( true ); }
4,890
func0
#include <stdio.h> #include <assert.h>
int *func0(int array_nums1[], int len1, int array_nums2[], int len2, int *result_len) { static int result[1000]; // Static to avoid the result variable from becoming local only to this function int k = 0; for (int i = 0; i < len2; i++) { for (int j = 0; j < len1; j++) { if (array_nums2[i] == array_nums1[j]) { result[k++] = array_nums2[i]; break; } } } *result_len = k; return result; }
int main() { int result_len; int *result; int array1[] = {1, 2, 3, 5, 7, 8, 9, 10}; int array2[] = {1, 2, 4, 8, 9}; int expected1[] = {1, 2, 8, 9}; result = func0(array1, 8, array2, 5, &result_len); assert(result_len == 4); for (int i = 0; i < result_len; i++) { assert(result[i] == expected1[i]); } int array3[] = {3, 5, 7, 9}; int expected2[] = {3, 5, 7, 9}; result = func0(array1, 8, array3, 4, &result_len); assert(result_len == 4); for (int i = 0; i < result_len; i++) { assert(result[i] == expected2[i]); } int array4[] = {10, 20, 30, 40}; int expected3[] = {10}; result = func0(array1, 8, array4, 4, &result_len); assert(result_len == 1); for (int i = 0; i < result_len; i++) { assert(result[i] == expected3[i]); } printf("All tests passed!\n"); return 0; }
O2
c
func0: endbr64 push %rbx mov %r8,%rbx test %ecx,%ecx jle 154d <func0+0x6d> lea -0x1(%rcx),%eax mov %rdx,%r9 lea 0x2b47(%rip),%r8 xor %r10d,%r10d lea 0x4(%rdx,%rax,4),%r11 lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rcx nopl 0x0(%rax) test %esi,%esi jle 1538 <func0+0x58> mov (%r9),%edx mov %rdi,%rax jmp 1529 <func0+0x49> nopl 0x0(%rax) add $0x4,%rax cmp %rcx,%rax je 1538 <func0+0x58> cmp (%rax),%edx jne 1520 <func0+0x40> movslq %r10d,%rax add $0x1,%r10d mov %edx,(%r8,%rax,4) add $0x4,%r9 cmp %r11,%r9 jne 1510 <func0+0x30> mov %r10d,(%rbx) lea 0x2af5(%rip),%rax pop %rbx retq xor %r10d,%r10d lea 0x2ae9(%rip),%rax mov %r10d,(%rbx) pop %rbx retq nopl 0x0(%rax)
func0: endbr64 push r12 test ecx, ecx jle short loc_1479 lea eax, [rcx-1] mov r10, rdi lea r12, result_1 mov r9d, esi lea r11, [rdx+rax*4+4] lea eax, [rsi-1] lea rsi, [rdi+rax*4+4] xor edi, edi nop dword ptr [rax+00000000h] loc_1440: test r9d, r9d jle short loc_1467 mov ecx, [rdx] mov rax, r10 jmp short loc_1459 loc_1450: add rax, 4 cmp rax, rsi jz short loc_1467 loc_1459: cmp ecx, [rax] jnz short loc_1450 movsxd rax, edi add edi, 1 mov [r12+rax*4], ecx loc_1467: add rdx, 4 cmp rdx, r11 jnz short loc_1440 mov rax, r12 mov [r8], edi pop r12 retn loc_1479: lea r12, result_1 xor edi, edi mov rax, r12 mov [r8], edi pop r12 retn
_DWORD * func0(_DWORD *a1, int a2, int *a3, int a4, _DWORD *a5) { long long v7; // r11 long long v8; // rsi int v9; // edi int v10; // ecx _DWORD *v11; // rax long long v12; // rax _DWORD *result; // rax if ( a4 <= 0 ) { result = result_1; *a5 = 0; } else { v7 = (long long)&a3[a4 - 1 + 1]; v8 = (long long)&a1[a2 - 1 + 1]; v9 = 0; do { if ( a2 > 0 ) { v10 = *a3; v11 = a1; while ( v10 != *v11 ) { if ( ++v11 == (_DWORD *)v8 ) goto LABEL_8; } v12 = v9++; result_1[v12] = v10; } LABEL_8: ++a3; } while ( a3 != (int *)v7 ); result = result_1; *a5 = v9; } return result; }
func0: ENDBR64 PUSH R12 TEST ECX,ECX JLE 0x00101479 LEA EAX,[RCX + -0x1] MOV R10,RDI LEA R12,[0x104040] MOV R9D,ESI LEA R11,[RDX + RAX*0x4 + 0x4] LEA EAX,[RSI + -0x1] LEA RSI,[RDI + RAX*0x4 + 0x4] XOR EDI,EDI NOP dword ptr [RAX] LAB_00101440: TEST R9D,R9D JLE 0x00101467 MOV ECX,dword ptr [RDX] MOV RAX,R10 JMP 0x00101459 LAB_00101450: ADD RAX,0x4 CMP RAX,RSI JZ 0x00101467 LAB_00101459: CMP ECX,dword ptr [RAX] JNZ 0x00101450 MOVSXD RAX,EDI ADD EDI,0x1 MOV dword ptr [R12 + RAX*0x4],ECX LAB_00101467: ADD RDX,0x4 CMP RDX,R11 JNZ 0x00101440 MOV RAX,R12 MOV dword ptr [R8],EDI POP R12 RET LAB_00101479: LEA R12,[0x104040] XOR EDI,EDI MOV RAX,R12 MOV dword ptr [R8],EDI POP R12 RET
int4 * func0(int *param_1,int param_2,int *param_3,int param_4,int *param_5) { int *piVar1; int *piVar2; long lVar3; int iVar4; if (param_4 < 1) { *param_5 = 0; return &result_1; } piVar1 = param_3 + (ulong)(param_4 - 1) + 1; iVar4 = 0; do { if (0 < param_2) { piVar2 = param_1; do { if (*param_3 == *piVar2) { lVar3 = (long)iVar4; iVar4 = iVar4 + 1; (&result_1)[lVar3] = *param_3; break; } piVar2 = piVar2 + 1; } while (piVar2 != param_1 + (ulong)(param_2 - 1) + 1); } param_3 = param_3 + 1; if (param_3 == piVar1) { *param_5 = iVar4; return &result_1; } } while( true ); }
4,891
func0
#include <stdio.h> #include <assert.h>
int *func0(int array_nums1[], int len1, int array_nums2[], int len2, int *result_len) { static int result[1000]; // Static to avoid the result variable from becoming local only to this function int k = 0; for (int i = 0; i < len2; i++) { for (int j = 0; j < len1; j++) { if (array_nums2[i] == array_nums1[j]) { result[k++] = array_nums2[i]; break; } } } *result_len = k; return result; }
int main() { int result_len; int *result; int array1[] = {1, 2, 3, 5, 7, 8, 9, 10}; int array2[] = {1, 2, 4, 8, 9}; int expected1[] = {1, 2, 8, 9}; result = func0(array1, 8, array2, 5, &result_len); assert(result_len == 4); for (int i = 0; i < result_len; i++) { assert(result[i] == expected1[i]); } int array3[] = {3, 5, 7, 9}; int expected2[] = {3, 5, 7, 9}; result = func0(array1, 8, array3, 4, &result_len); assert(result_len == 4); for (int i = 0; i < result_len; i++) { assert(result[i] == expected2[i]); } int array4[] = {10, 20, 30, 40}; int expected3[] = {10}; result = func0(array1, 8, array4, 4, &result_len); assert(result_len == 1); for (int i = 0; i < result_len; i++) { assert(result[i] == expected3[i]); } printf("All tests passed!\n"); return 0; }
O3
c
func0: endbr64 push %rbx mov %r8,%rbx test %ecx,%ecx jle 153d <func0+0x6d> lea -0x1(%rcx),%eax mov %rdx,%r9 lea 0x2b57(%rip),%r8 xor %r10d,%r10d lea 0x4(%rdx,%rax,4),%r11 lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rcx nopl 0x0(%rax) test %esi,%esi jle 1528 <func0+0x58> mov (%r9),%edx mov %rdi,%rax jmp 1519 <func0+0x49> nopl 0x0(%rax) add $0x4,%rax cmp %rcx,%rax je 1528 <func0+0x58> cmp (%rax),%edx jne 1510 <func0+0x40> movslq %r10d,%rax add $0x1,%r10d mov %edx,(%r8,%rax,4) add $0x4,%r9 cmp %r11,%r9 jne 1500 <func0+0x30> mov %r10d,(%rbx) lea 0x2b05(%rip),%rax pop %rbx retq xor %r10d,%r10d lea 0x2af9(%rip),%rax mov %r10d,(%rbx) pop %rbx retq nopl 0x0(%rax)
func0: endbr64 mov r9, rdi test ecx, ecx jle short loc_119F movsxd rcx, ecx lea r10, [rdx+rcx*4] loc_1192: test esi, esi jg short loc_11AF add rdx, 4 cmp rdx, r10 jnz short loc_1192 loc_119F: xor eax, eax lea r11, result_1 loc_11A8: mov [r8], eax mov rax, r11 retn loc_11AF: movsxd rsi, esi xor edi, edi lea r11, result_1 lea rsi, [r9+rsi*4] nop loc_11C0: mov ecx, [rdx] mov rax, r9 jmp short loc_11D9 loc_11D0: add rax, 4 cmp rax, rsi jz short loc_11F8 loc_11D9: cmp ecx, [rax] jnz short loc_11D0 add rdx, 4 mov [r11+rdi*4], ecx lea eax, [rdi+1] cmp rdx, r10 jz short loc_11A8 movsxd rdi, eax jmp short loc_11C0 loc_11F8: add rdx, 4 cmp rdx, r10 jnz short loc_11C0 mov eax, edi mov [r8], eax mov rax, r11 retn
__int128 * func0(_DWORD *a1, int a2, int *a3, int a4, _DWORD *a5) { int *v6; // r10 int v7; // eax long long v9; // rdi _DWORD *v10; // rsi int v11; // ecx _DWORD *v12; // rax if ( a4 <= 0 ) { LABEL_5: v7 = 0; LABEL_6: *a5 = v7; return &result_1; } else { v6 = &a3[a4]; while ( a2 <= 0 ) { if ( ++a3 == v6 ) goto LABEL_5; } v9 = 0LL; v10 = &a1[a2]; do { LABEL_8: v11 = *a3; v12 = a1; do { if ( v11 == *v12 ) { ++a3; *((_DWORD *)&result_1 + v9) = v11; v7 = v9 + 1; if ( a3 == v6 ) goto LABEL_6; v9 = v7; goto LABEL_8; } ++v12; } while ( v12 != v10 ); ++a3; } while ( a3 != v6 ); *a5 = v9; return &result_1; } }
func0: ENDBR64 MOV R9,RDI TEST ECX,ECX JLE 0x0010119f MOVSXD RCX,ECX LEA R10,[RDX + RCX*0x4] LAB_00101192: TEST ESI,ESI JG 0x001011af ADD RDX,0x4 CMP RDX,R10 JNZ 0x00101192 LAB_0010119f: XOR EAX,EAX LEA R11,[0x104040] LAB_001011a8: MOV dword ptr [R8],EAX MOV RAX,R11 RET LAB_001011af: MOVSXD RSI,ESI XOR EDI,EDI LEA R11,[0x104040] LEA RSI,[R9 + RSI*0x4] NOP LAB_001011c0: MOV ECX,dword ptr [RDX] MOV RAX,R9 JMP 0x001011d9 LAB_001011d0: ADD RAX,0x4 CMP RAX,RSI JZ 0x001011f8 LAB_001011d9: CMP ECX,dword ptr [RAX] JNZ 0x001011d0 ADD RDX,0x4 MOV dword ptr [R11 + RDI*0x4],ECX LEA EAX,[RDI + 0x1] CMP RDX,R10 JZ 0x001011a8 MOVSXD RDI,EAX JMP 0x001011c0 LAB_001011f8: ADD RDX,0x4 CMP RDX,R10 JNZ 0x001011c0 MOV EAX,EDI MOV dword ptr [R8],EAX MOV RAX,R11 RET
int4 * func0(int *param_1,int param_2,int *param_3,int param_4,int *param_5) { int *piVar1; int iVar2; int *piVar3; long lVar4; if (0 < param_4) { piVar1 = param_3 + param_4; do { if (0 < param_2) { lVar4 = 0; LAB_001011c0: do { iVar2 = *param_3; piVar3 = param_1; do { if (iVar2 == *piVar3) { param_3 = param_3 + 1; (&result_1)[lVar4] = iVar2; iVar2 = (int)lVar4 + 1; if (param_3 == piVar1) goto LAB_001011a8; lVar4 = (long)iVar2; goto LAB_001011c0; } piVar3 = piVar3 + 1; } while (piVar3 != param_1 + param_2); param_3 = param_3 + 1; if (param_3 == piVar1) { *param_5 = (int)lVar4; return &result_1; } } while( true ); } param_3 = param_3 + 1; } while (param_3 != piVar1); } iVar2 = 0; LAB_001011a8: *param_5 = iVar2; return &result_1; }
4,892
func0
#include <assert.h>
int func0(int arr[], int arr_size, int x) { int count = 0; for (int i = 0; i < arr_size; i++) { if (arr[i] == x) { count++; } } return count; }
int main() { int arr1[] = {10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2}; int size1 = sizeof(arr1) / sizeof(arr1[0]); assert(func0(arr1, size1, 4) == 0); assert(func0(arr1, size1, 10) == 3); assert(func0(arr1, size1, 8) == 4); 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,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 11ae <func0+0x45> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax cmp %eax,-0x20(%rbp) jne 11aa <func0+0x41> addl $0x1,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 118b <func0+0x22> 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_20], edx mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_11AE loc_118B: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] cmp [rbp+var_20], eax jnz short loc_11AA add [rbp+var_8], 1 loc_11AA: add [rbp+var_4], 1 loc_11AE: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_118B mov eax, [rbp+var_8] pop rbp retn
long long func0(long long a1, int a2, int a3) { unsigned int v4; // [rsp+18h] [rbp-8h] int i; // [rsp+1Ch] [rbp-4h] v4 = 0; for ( i = 0; i < a2; ++i ) { if ( a3 == *(_DWORD *)(4LL * i + 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 + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011ae LAB_0010118b: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x20],EAX JNZ 0x001011aa ADD dword ptr [RBP + -0x8],0x1 LAB_001011aa: ADD dword ptr [RBP + -0x4],0x1 LAB_001011ae: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x0010118b MOV EAX,dword ptr [RBP + -0x8] POP RBP RET
int func0(long param_1,int param_2,int param_3) { int4 local_10; int4 local_c; local_10 = 0; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { if (param_3 == *(int *)(param_1 + (long)local_c * 4)) { local_10 = local_10 + 1; } } return local_10; }
4,893
func0
#include <assert.h>
int func0(int arr[], int arr_size, int x) { int count = 0; for (int i = 0; i < arr_size; i++) { if (arr[i] == x) { count++; } } return count; }
int main() { int arr1[] = {10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2}; int size1 = sizeof(arr1) / sizeof(arr1[0]); assert(func0(arr1, size1, 4) == 0); assert(func0(arr1, size1, 10) == 3); assert(func0(arr1, size1, 8) == 4); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 1199 <func0+0x30> mov %rdi,%rax lea -0x1(%rsi),%ecx lea 0x4(%rdi,%rcx,4),%rdi mov $0x0,%ecx cmp %edx,(%rax) sete %sil movzbl %sil,%esi add %esi,%ecx add $0x4,%rax cmp %rdi,%rax jne 1181 <func0+0x18> mov %ecx,%eax retq mov $0x0,%ecx jmp 1196 <func0+0x2d>
func0: endbr64 test esi, esi jle short loc_1199 mov rax, rdi lea ecx, [rsi-1] lea rdi, [rdi+rcx*4+4] mov ecx, 0 loc_1181: cmp [rax], edx setz sil movzx esi, sil add ecx, esi add rax, 4 cmp rax, rdi jnz short loc_1181 loc_1196: mov eax, ecx retn loc_1199: mov ecx, 0 jmp short loc_1196
long long func0(_DWORD *a1, int a2, int a3) { _DWORD *v3; // rax long long v4; // rdi unsigned int v5; // ecx if ( a2 <= 0 ) { return 0; } else { v3 = a1; v4 = (long long)&a1[a2 - 1 + 1]; v5 = 0; do v5 += *v3++ == a3; while ( v3 != (_DWORD *)v4 ); } return v5; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101199 MOV RAX,RDI LEA ECX,[RSI + -0x1] LEA RDI,[RDI + RCX*0x4 + 0x4] MOV ECX,0x0 LAB_00101181: CMP dword ptr [RAX],EDX SETZ SIL MOVZX ESI,SIL ADD ECX,ESI ADD RAX,0x4 CMP RAX,RDI JNZ 0x00101181 LAB_00101196: MOV EAX,ECX RET LAB_00101199: MOV ECX,0x0 JMP 0x00101196
int func0(int *param_1,int param_2,int param_3) { int *piVar1; int iVar2; if (param_2 < 1) { iVar2 = 0; } else { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar2 = 0; do { iVar2 = iVar2 + (uint)(*param_1 == param_3); param_1 = param_1 + 1; } while (param_1 != piVar1); } return iVar2; }
4,894
func0
#include <assert.h>
int func0(int arr[], int arr_size, int x) { int count = 0; for (int i = 0; i < arr_size; i++) { if (arr[i] == x) { count++; } } return count; }
int main() { int arr1[] = {10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2}; int size1 = sizeof(arr1) / sizeof(arr1[0]); assert(func0(arr1, size1, 4) == 0); assert(func0(arr1, size1, 10) == 3); assert(func0(arr1, size1, 8) == 4); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1300 <func0+0x30> lea -0x1(%rsi),%eax lea 0x4(%rdi,%rax,4),%rsi xor %eax,%eax nopw 0x0(%rax,%rax,1) xor %ecx,%ecx cmp %edx,(%rdi) sete %cl add $0x4,%rdi add %ecx,%eax cmp %rsi,%rdi jne 12e8 <func0+0x18> retq nopl 0x0(%rax,%rax,1) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 test esi, esi jle short loc_1300 lea eax, [rsi-1] lea rsi, [rdi+rax*4+4] xor eax, eax nop word ptr [rax+rax+00h] loc_12E8: xor ecx, ecx cmp [rdi], edx setz cl add rdi, 4 add eax, ecx cmp rdi, rsi jnz short loc_12E8 retn loc_1300: xor eax, eax retn
long long func0(_DWORD *a1, int a2, int a3) { long long v3; // rsi long long result; // rax BOOL v5; // ecx if ( a2 <= 0 ) return 0LL; v3 = (long long)&a1[a2 - 1 + 1]; LODWORD(result) = 0; do { v5 = *a1++ == a3; result = (unsigned int)(v5 + result); } while ( a1 != (_DWORD *)v3 ); return result; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101300 LEA EAX,[RSI + -0x1] LEA RSI,[RDI + RAX*0x4 + 0x4] XOR EAX,EAX NOP word ptr [RAX + RAX*0x1] LAB_001012e8: XOR ECX,ECX CMP dword ptr [RDI],EDX SETZ CL ADD RDI,0x4 ADD EAX,ECX CMP RDI,RSI JNZ 0x001012e8 RET LAB_00101300: XOR EAX,EAX RET
int func0(int *param_1,int param_2,int param_3) { int *piVar1; int iVar2; int iVar3; if (0 < param_2) { piVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar3 = 0; do { iVar2 = *param_1; param_1 = param_1 + 1; iVar3 = iVar3 + (uint)(iVar2 == param_3); } while (param_1 != piVar1); return iVar3; } return 0; }
4,895
func0
#include <assert.h>
int func0(int arr[], int arr_size, int x) { int count = 0; for (int i = 0; i < arr_size; i++) { if (arr[i] == x) { count++; } } return count; }
int main() { int arr1[] = {10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2}; int size1 = sizeof(arr1) / sizeof(arr1[0]); assert(func0(arr1, size1, 4) == 0); assert(func0(arr1, size1, 10) == 3); assert(func0(arr1, size1, 8) == 4); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 13c8 <func0+0xe8> lea -0x1(%rsi),%eax cmp $0x3,%eax jbe 13cb <func0+0xeb> mov %esi,%ecx movd %edx,%xmm3 pxor %xmm0,%xmm0 mov %rdi,%rax shr $0x2,%ecx pshufd $0x0,%xmm3,%xmm2 shl $0x4,%rcx add %rdi,%rcx nopl 0x0(%rax) movdqu (%rax),%xmm1 add $0x10,%rax pcmpeqd %xmm2,%xmm1 psubd %xmm1,%xmm0 cmp %rcx,%rax jne 1318 <func0+0x38> movdqa %xmm0,%xmm1 mov %esi,%ecx psrldq $0x8,%xmm1 and $0xfffffffc,%ecx paddd %xmm1,%xmm0 movdqa %xmm0,%xmm1 psrldq $0x4,%xmm1 paddd %xmm1,%xmm0 movd %xmm0,%eax test $0x3,%sil je 13a8 <func0+0xc8> movslq %ecx,%r8 cmp %edx,(%rdi,%r8,4) je 1398 <func0+0xb8> lea 0x1(%rcx),%r8d cmp %esi,%r8d jge 1392 <func0+0xb2> movslq %r8d,%r8 cmp (%rdi,%r8,4),%edx je 13a0 <func0+0xc0> lea 0x2(%rcx),%r8d cmp %r8d,%esi jle 1392 <func0+0xb2> movslq %r8d,%r8 cmp (%rdi,%r8,4),%edx je 13b0 <func0+0xd0> add $0x3,%ecx cmp %ecx,%esi jle 1392 <func0+0xb2> movslq %ecx,%rcx cmp (%rdi,%rcx,4),%edx je 13c0 <func0+0xe0> retq nopl 0x0(%rax,%rax,1) add $0x1,%eax jmp 135f <func0+0x7f> nopl (%rax) add $0x1,%eax jmp 1371 <func0+0x91> nopl (%rax) retq nopl 0x0(%rax) add $0x3,%ecx add $0x1,%eax cmp %ecx,%esi jg 138a <func0+0xaa> jmp 1392 <func0+0xb2> nopl 0x0(%rax) add $0x1,%eax retq nopl 0x0(%rax) xor %eax,%eax retq xor %ecx,%ecx xor %eax,%eax jmp 1356 <func0+0x76> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle loc_1210 lea eax, [rsi-1] cmp eax, 2 jbe loc_1213 mov ecx, esi movd xmm3, edx pxor xmm0, xmm0 mov rax, rdi shr ecx, 2 pshufd xmm2, xmm3, 0 shl rcx, 4 add rcx, rdi nop dword ptr [rax+00h] loc_1178: movdqu xmm1, xmmword ptr [rax] add rax, 10h pcmpeqd xmm1, xmm2 psubd xmm0, xmm1 cmp rcx, rax jnz short loc_1178 movdqa xmm1, xmm0 mov ecx, esi psrldq xmm1, 8 and ecx, 0FFFFFFFCh paddd xmm0, xmm1 movdqa xmm1, xmm0 psrldq xmm1, 4 paddd xmm0, xmm1 movd eax, xmm0 test sil, 3 jz short locret_1200 loc_11B6: movsxd r8, ecx lea r9, ds:0[r8*4] cmp [rdi+r8*4], edx jz short loc_11F0 loc_11C7: lea r8d, [rcx+1] cmp esi, r8d jle short locret_11E5 cmp edx, [rdi+r9+4] jz short loc_11F8 loc_11D7: add ecx, 2 cmp esi, ecx jle short locret_11E5 cmp edx, [rdi+r9+8] jz short loc_1208 locret_11E5: retn loc_11F0: add eax, 1 jmp short loc_11C7 loc_11F8: add eax, 1 jmp short loc_11D7 locret_1200: retn loc_1208: add eax, 1 retn loc_1210: xor eax, eax retn loc_1213: xor ecx, ecx xor eax, eax jmp short loc_11B6
long long func0(const __m128i *a1, int a2, unsigned int a3) { __m128i v3; // xmm0 const __m128i *v4; // rax __m128i v5; // xmm2 __m128i v6; // xmm1 int v7; // ecx __m128i v8; // xmm0 long long result; // rax long long v10; // r9 if ( a2 <= 0 ) return 0LL; if ( (unsigned int)(a2 - 1) <= 2 ) { v7 = 0; result = 0LL; } else { v3 = 0LL; v4 = a1; v5 = _mm_shuffle_epi32(_mm_cvtsi32_si128(a3), 0); do { v6 = _mm_loadu_si128(v4++); v3 = _mm_sub_epi32(v3, _mm_cmpeq_epi32(v6, v5)); } while ( &a1[(unsigned int)a2 >> 2] != v4 ); v7 = a2 & 0x7FFFFFFC; v8 = _mm_add_epi32(v3, _mm_srli_si128(v3, 8)); result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v8, _mm_srli_si128(v8, 4))); if ( (a2 & 3) == 0 ) return result; } v10 = v7; if ( a1->m128i_i32[v10] == a3 ) result = (unsigned int)(result + 1); if ( a2 > v7 + 1 ) { if ( a3 == a1->m128i_i32[v10 + 1] ) result = (unsigned int)(result + 1); if ( a2 > v7 + 2 && a3 == a1->m128i_i32[v10 + 2] ) return (unsigned int)(result + 1); } return result; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101210 LEA EAX,[RSI + -0x1] CMP EAX,0x2 JBE 0x00101213 MOV ECX,ESI MOVD XMM3,EDX PXOR XMM0,XMM0 MOV RAX,RDI SHR ECX,0x2 PSHUFD XMM2,XMM3,0x0 SHL RCX,0x4 ADD RCX,RDI NOP dword ptr [RAX] LAB_00101178: MOVDQU XMM1,xmmword ptr [RAX] ADD RAX,0x10 PCMPEQD XMM1,XMM2 PSUBD XMM0,XMM1 CMP RCX,RAX JNZ 0x00101178 MOVDQA XMM1,XMM0 MOV ECX,ESI PSRLDQ XMM1,0x8 AND ECX,0xfffffffc PADDD XMM0,XMM1 MOVDQA XMM1,XMM0 PSRLDQ XMM1,0x4 PADDD XMM0,XMM1 MOVD EAX,XMM0 TEST SIL,0x3 JZ 0x00101200 LAB_001011b6: MOVSXD R8,ECX LEA R9,[R8*0x4] CMP dword ptr [RDI + R8*0x4],EDX JZ 0x001011f0 LAB_001011c7: LEA R8D,[RCX + 0x1] CMP ESI,R8D JLE 0x001011e5 CMP EDX,dword ptr [RDI + R9*0x1 + 0x4] JZ 0x001011f8 LAB_001011d7: ADD ECX,0x2 CMP ESI,ECX JLE 0x001011e5 CMP EDX,dword ptr [RDI + R9*0x1 + 0x8] JZ 0x00101208 LAB_001011e5: RET LAB_001011f0: ADD EAX,0x1 JMP 0x001011c7 LAB_001011f8: ADD EAX,0x1 JMP 0x001011d7 LAB_00101200: RET LAB_00101208: ADD EAX,0x1 RET LAB_00101210: XOR EAX,EAX RET LAB_00101213: XOR ECX,ECX XOR EAX,EAX JMP 0x001011b6
int func0(int *param_1,uint param_2,int param_3) { int iVar1; int *piVar2; int *piVar3; int *piVar4; int *piVar5; uint uVar6; int iVar7; int iVar8; int iVar9; int iVar10; if ((int)param_2 < 1) { return 0; } if (param_2 - 1 < 3) { uVar6 = 0; iVar7 = 0; } else { iVar7 = 0; iVar8 = 0; iVar9 = 0; iVar10 = 0; piVar5 = param_1; do { iVar1 = *piVar5; piVar2 = piVar5 + 1; piVar3 = piVar5 + 2; piVar4 = piVar5 + 3; piVar5 = piVar5 + 4; iVar7 = iVar7 + (uint)(iVar1 == param_3); iVar8 = iVar8 + (uint)(*piVar2 == param_3); iVar9 = iVar9 + (uint)(*piVar3 == param_3); iVar10 = iVar10 + (uint)(*piVar4 == param_3); } while (param_1 + (ulong)(param_2 >> 2) * 4 != piVar5); uVar6 = param_2 & 0xfffffffc; iVar7 = iVar7 + iVar9 + iVar8 + iVar10; if ((param_2 & 3) == 0) { return iVar7; } } if (param_1[(int)uVar6] == param_3) { iVar7 = iVar7 + 1; } if ((int)(uVar6 + 1) < (int)param_2) { if (param_3 == param_1[(long)(int)uVar6 + 1]) { iVar7 = iVar7 + 1; } if (((int)(uVar6 + 2) < (int)param_2) && (param_3 == param_1[(long)(int)uVar6 + 2])) { return iVar7 + 1; } } return iVar7; }
4,896
func0
#include <assert.h> #include <stdio.h> #include <string.h> #include <stdlib.h>
char** func0(char** list, int list_size, char* element, int* new_size) { *new_size = 2 * list_size; char** new_list = malloc((*new_size) * sizeof(char*)); int k = 0; for (int i = 0; i < list_size; i++) { new_list[k++] = element; new_list[k++] = list[i]; } return new_list; }
int main() { char* colors[] = {"Red", "Green", "Black"}; int colors_size = 3; char* colors_element = "c"; int new_colors_size; char** new_colors = func0(colors, colors_size, colors_element, &new_colors_size); assert(new_colors_size == 6); assert(strcmp(new_colors[0], "c") == 0); assert(strcmp(new_colors[1], "Red") == 0); assert(strcmp(new_colors[2], "c") == 0); assert(strcmp(new_colors[3], "Green") == 0); assert(strcmp(new_colors[4], "c") == 0); assert(strcmp(new_colors[5], "Black") == 0); free(new_colors); char* languages[] = {"python", "java"}; int languages_size = 2; char* languages_element = "program"; int new_languages_size; char** new_languages = func0(languages, languages_size, languages_element, &new_languages_size); assert(new_languages_size == 4); assert(strcmp(new_languages[0], "program") == 0); assert(strcmp(new_languages[1], "python") == 0); assert(strcmp(new_languages[2], "program") == 0); assert(strcmp(new_languages[3], "java") == 0); free(new_languages); char* moods[] = {"happy", "sad"}; int moods_size = 2; char* moods_element = "laugh"; int new_moods_size; char** new_moods = func0(moods, moods_size, moods_element, &new_moods_size); assert(new_moods_size == 4); assert(strcmp(new_moods[0], "laugh") == 0); assert(strcmp(new_moods[1], "happy") == 0); assert(strcmp(new_moods[2], "laugh") == 0); assert(strcmp(new_moods[3], "sad") == 0); free(new_moods); 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 %rcx,-0x30(%rbp) mov -0x1c(%rbp),%eax lea (%rax,%rax,1),%edx mov -0x30(%rbp),%rax mov %edx,(%rax) mov -0x30(%rbp),%rax mov (%rax),%eax cltq shl $0x3,%rax mov %rax,%rdi callq 10d0 <malloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0x10(%rbp) movl $0x0,-0xc(%rbp) jmp 1272 <func0+0xa9> mov -0x10(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x10(%rbp) cltq lea 0x0(,%rax,8),%rdx mov -0x8(%rbp),%rax add %rax,%rdx mov -0x28(%rbp),%rax mov %rax,(%rdx) mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x10(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x10(%rbp) cltq lea 0x0(,%rax,8),%rdx mov -0x8(%rbp),%rax add %rax,%rdx mov (%rcx),%rax mov %rax,(%rdx) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1218 <func0+0x4f> 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_30], rcx mov eax, [rbp+var_1C] lea edx, [rax+rax] mov rax, [rbp+var_30] mov [rax], edx mov rax, [rbp+var_30] mov eax, [rax] cdqe shl rax, 3 mov rdi, rax; size call _malloc mov [rbp+var_8], rax mov [rbp+var_10], 0 mov [rbp+var_C], 0 jmp short loc_1272 loc_1218: mov eax, [rbp+var_10] lea edx, [rax+1] mov [rbp+var_10], edx cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_8] add rdx, rax mov rax, [rbp+var_28] mov [rdx], rax mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] lea rcx, [rdx+rax] mov eax, [rbp+var_10] lea edx, [rax+1] mov [rbp+var_10], edx cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_8] add rdx, rax mov rax, [rcx] mov [rdx], rax add [rbp+var_C], 1 loc_1272: mov eax, [rbp+var_C] cmp eax, [rbp+var_1C] jl short loc_1218 mov rax, [rbp+var_8] leave retn
_QWORD * func0(long long a1, int a2, long long a3, int *a4) { int v4; // eax int v7; // [rsp+20h] [rbp-10h] int i; // [rsp+24h] [rbp-Ch] _QWORD *v9; // [rsp+28h] [rbp-8h] *a4 = 2 * a2; v9 = malloc(8LL * *a4); v7 = 0; for ( i = 0; i < a2; ++i ) { v9[v7] = a3; v4 = v7 + 1; v7 += 2; v9[v4] = *(_QWORD *)(8LL * i + a1); } return v9; }
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 qword ptr [RBP + -0x30],RCX MOV EAX,dword ptr [RBP + -0x1c] LEA EDX,[RAX + RAX*0x1] 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,0x3 MOV RDI,RAX CALL 0x001010d0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0x10],0x0 MOV dword ptr [RBP + -0xc],0x0 JMP 0x00101272 LAB_00101218: MOV EAX,dword ptr [RBP + -0x10] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x10],EDX CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x8] ADD RDX,RAX MOV RAX,qword ptr [RBP + -0x28] MOV qword ptr [RDX],RAX MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] 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*0x8] MOV RAX,qword ptr [RBP + -0x8] ADD RDX,RAX MOV RAX,qword ptr [RCX] MOV qword ptr [RDX],RAX ADD dword ptr [RBP + -0xc],0x1 LAB_00101272: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101218 MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1,int param_2,int8 param_3,int *param_4) { int iVar1; void *pvVar2; int4 local_18; int4 local_14; *param_4 = param_2 * 2; pvVar2 = malloc((long)*param_4 << 3); local_18 = 0; for (local_14 = 0; local_14 < param_2; local_14 = local_14 + 1) { iVar1 = local_18 + 1; *(int8 *)((long)local_18 * 8 + (long)pvVar2) = param_3; local_18 = local_18 + 2; *(int8 *)((long)iVar1 * 8 + (long)pvVar2) = *(int8 *)((long)local_14 * 8 + param_1); } return pvVar2; }
4,897
func0
#include <assert.h> #include <stdio.h> #include <string.h> #include <stdlib.h>
char** func0(char** list, int list_size, char* element, int* new_size) { *new_size = 2 * list_size; char** new_list = malloc((*new_size) * sizeof(char*)); int k = 0; for (int i = 0; i < list_size; i++) { new_list[k++] = element; new_list[k++] = list[i]; } return new_list; }
int main() { char* colors[] = {"Red", "Green", "Black"}; int colors_size = 3; char* colors_element = "c"; int new_colors_size; char** new_colors = func0(colors, colors_size, colors_element, &new_colors_size); assert(new_colors_size == 6); assert(strcmp(new_colors[0], "c") == 0); assert(strcmp(new_colors[1], "Red") == 0); assert(strcmp(new_colors[2], "c") == 0); assert(strcmp(new_colors[3], "Green") == 0); assert(strcmp(new_colors[4], "c") == 0); assert(strcmp(new_colors[5], "Black") == 0); free(new_colors); char* languages[] = {"python", "java"}; int languages_size = 2; char* languages_element = "program"; int new_languages_size; char** new_languages = func0(languages, languages_size, languages_element, &new_languages_size); assert(new_languages_size == 4); assert(strcmp(new_languages[0], "program") == 0); assert(strcmp(new_languages[1], "python") == 0); assert(strcmp(new_languages[2], "program") == 0); assert(strcmp(new_languages[3], "java") == 0); free(new_languages); char* moods[] = {"happy", "sad"}; int moods_size = 2; char* moods_element = "laugh"; int new_moods_size; char** new_moods = func0(moods, moods_size, moods_element, &new_moods_size); assert(new_moods_size == 4); assert(strcmp(new_moods[0], "laugh") == 0); assert(strcmp(new_moods[1], "happy") == 0); assert(strcmp(new_moods[2], "laugh") == 0); assert(strcmp(new_moods[3], "sad") == 0); free(new_moods); return 0; }
O1
c
func0: endbr64 push %r12 push %rbp push %rbx mov %rdi,%rbx mov %esi,%r12d mov %rdx,%rbp lea (%rsi,%rsi,1),%edi mov %edi,(%rcx) movslq %edi,%rdi shl $0x3,%rdi callq 10b0 <malloc@plt> test %r12d,%r12d jle 11f5 <func0+0x4c> lea -0x1(%r12),%edx lea 0x2(%rdx,%rdx,1),%rsi mov $0x0,%edx mov %rbp,(%rax,%rdx,8) mov (%rbx,%rdx,4),%rcx mov %rcx,0x8(%rax,%rdx,8) add $0x2,%rdx cmp %rsi,%rdx jne 11df <func0+0x36> pop %rbx pop %rbp pop %r12 retq
func0: endbr64 push r12 push rbp push rbx mov rbx, rdi mov r12d, esi mov rbp, rdx lea edi, [rsi+rsi] mov [rcx], edi movsxd rdi, edi shl rdi, 3 call _malloc test r12d, r12d jle short loc_1211 mov esi, r12d add rsi, rsi mov edx, 0 loc_11FB: mov [rax+rdx*8], rbp mov rcx, [rbx+rdx*4] mov [rax+rdx*8+8], rcx add rdx, 2 cmp rdx, rsi jnz short loc_11FB loc_1211: pop rbx pop rbp pop r12 retn
long long func0(long long a1, int a2, long long a3, _DWORD *a4) { long long result; // rax long long v6; // rdx *a4 = 2 * a2; result = malloc(16LL * a2); if ( a2 > 0 ) { v6 = 0LL; do { *(_QWORD *)(result + 8 * v6) = a3; *(_QWORD *)(result + 8 * v6 + 8) = *(_QWORD *)(a1 + 4 * v6); v6 += 2LL; } while ( v6 != 2LL * (unsigned int)a2 ); } return result; }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RDI MOV R12D,ESI MOV RBP,RDX LEA EDI,[RSI + RSI*0x1] MOV dword ptr [RCX],EDI MOVSXD RDI,EDI SHL RDI,0x3 CALL 0x001010d0 TEST R12D,R12D JLE 0x00101211 MOV ESI,R12D ADD RSI,RSI MOV EDX,0x0 LAB_001011fb: MOV qword ptr [RAX + RDX*0x8],RBP MOV RCX,qword ptr [RBX + RDX*0x4] MOV qword ptr [RAX + RDX*0x8 + 0x8],RCX ADD RDX,0x2 CMP RDX,RSI JNZ 0x001011fb LAB_00101211: POP RBX POP RBP POP R12 RET
void func0(long param_1,uint param_2,int8 param_3,int *param_4) { void *pvVar1; long lVar2; *param_4 = param_2 * 2; pvVar1 = malloc((long)(int)(param_2 * 2) << 3); if (0 < (int)param_2) { lVar2 = 0; do { *(int8 *)((long)pvVar1 + lVar2 * 8) = param_3; *(int8 *)((long)pvVar1 + lVar2 * 8 + 8) = *(int8 *)(param_1 + lVar2 * 4); lVar2 = lVar2 + 2; } while (lVar2 != (ulong)param_2 * 2); } return; }
4,898
func0
#include <assert.h> #include <stdio.h> #include <string.h> #include <stdlib.h>
char** func0(char** list, int list_size, char* element, int* new_size) { *new_size = 2 * list_size; char** new_list = malloc((*new_size) * sizeof(char*)); int k = 0; for (int i = 0; i < list_size; i++) { new_list[k++] = element; new_list[k++] = list[i]; } return new_list; }
int main() { char* colors[] = {"Red", "Green", "Black"}; int colors_size = 3; char* colors_element = "c"; int new_colors_size; char** new_colors = func0(colors, colors_size, colors_element, &new_colors_size); assert(new_colors_size == 6); assert(strcmp(new_colors[0], "c") == 0); assert(strcmp(new_colors[1], "Red") == 0); assert(strcmp(new_colors[2], "c") == 0); assert(strcmp(new_colors[3], "Green") == 0); assert(strcmp(new_colors[4], "c") == 0); assert(strcmp(new_colors[5], "Black") == 0); free(new_colors); char* languages[] = {"python", "java"}; int languages_size = 2; char* languages_element = "program"; int new_languages_size; char** new_languages = func0(languages, languages_size, languages_element, &new_languages_size); assert(new_languages_size == 4); assert(strcmp(new_languages[0], "program") == 0); assert(strcmp(new_languages[1], "python") == 0); assert(strcmp(new_languages[2], "program") == 0); assert(strcmp(new_languages[3], "java") == 0); free(new_languages); char* moods[] = {"happy", "sad"}; int moods_size = 2; char* moods_element = "laugh"; int new_moods_size; char** new_moods = func0(moods, moods_size, moods_element, &new_moods_size); assert(new_moods_size == 4); assert(strcmp(new_moods[0], "laugh") == 0); assert(strcmp(new_moods[1], "happy") == 0); assert(strcmp(new_moods[2], "laugh") == 0); assert(strcmp(new_moods[3], "sad") == 0); free(new_moods); return 0; }
O2
c
func0: endbr64 push %r12 mov %esi,%r12d push %rbp mov %rdx,%rbp push %rbx mov %rdi,%rbx lea (%rsi,%rsi,1),%edi mov %edi,(%rcx) movslq %edi,%rdi shl $0x3,%rdi callq 10b0 <malloc@plt> test %r12d,%r12d jle 16ae <func0+0x4e> lea -0x1(%r12),%edx xor %ecx,%ecx lea 0x2(%rdx,%rdx,1),%rdx nopl 0x0(%rax,%rax,1) mov (%rbx,%rcx,4),%rsi mov %rbp,(%rax,%rcx,8) mov %rsi,0x8(%rax,%rcx,8) add $0x2,%rcx cmp %rcx,%rdx jne 1698 <func0+0x38> pop %rbx pop %rbp pop %r12 retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 push r12 mov r12, rdx push rbp mov rbp, rdi lea edi, [rsi+rsi] push rbx mov ebx, esi mov [rcx], edi movsxd rdi, edi shl rdi, 3 call _malloc test ebx, ebx jle short loc_1667 movsxd rcx, ebx xor edx, edx add rcx, rcx nop dword ptr [rax] loc_1650: mov rsi, [rbp+rdx*4+0] mov [rax+rdx*8], r12 mov [rax+rdx*8+8], rsi add rdx, 2 cmp rcx, rdx jnz short loc_1650 loc_1667: pop rbx pop rbp pop r12 retn
long long func0(long long a1, int a2, long long a3, _DWORD *a4) { long long result; // rax long long v7; // rdx long long v8; // rsi *a4 = 2 * a2; result = malloc(16LL * a2); if ( a2 > 0 ) { v7 = 0LL; do { v8 = *(_QWORD *)(a1 + 4 * v7); *(_QWORD *)(result + 8 * v7) = a3; *(_QWORD *)(result + 8 * v7 + 8) = v8; v7 += 2LL; } while ( 2LL * a2 != v7 ); } return result; }
func0: ENDBR64 PUSH R12 MOV R12,RDX PUSH RBP MOV RBP,RDI LEA EDI,[RSI + RSI*0x1] PUSH RBX MOV EBX,ESI MOV dword ptr [RCX],EDI MOVSXD RDI,EDI SHL RDI,0x3 CALL 0x001010d0 TEST EBX,EBX JLE 0x00101667 MOVSXD RCX,EBX XOR EDX,EDX ADD RCX,RCX NOP dword ptr [RAX] LAB_00101650: MOV RSI,qword ptr [RBP + RDX*0x4] MOV qword ptr [RAX + RDX*0x8],R12 MOV qword ptr [RAX + RDX*0x8 + 0x8],RSI ADD RDX,0x2 CMP RCX,RDX JNZ 0x00101650 LAB_00101667: POP RBX POP RBP POP R12 RET
void func0(long param_1,int param_2,int8 param_3,int *param_4) { int8 uVar1; void *pvVar2; long lVar3; *param_4 = param_2 * 2; pvVar2 = malloc((long)(param_2 * 2) << 3); if (0 < param_2) { lVar3 = 0; do { uVar1 = *(int8 *)(param_1 + lVar3 * 4); *(int8 *)((long)pvVar2 + lVar3 * 8) = param_3; *(int8 *)((long)pvVar2 + lVar3 * 8 + 8) = uVar1; lVar3 = lVar3 + 2; } while ((long)param_2 * 2 != lVar3); } return; }
4,899
func0
#include <assert.h> #include <stdio.h> #include <string.h> #include <stdlib.h>
char** func0(char** list, int list_size, char* element, int* new_size) { *new_size = 2 * list_size; char** new_list = malloc((*new_size) * sizeof(char*)); int k = 0; for (int i = 0; i < list_size; i++) { new_list[k++] = element; new_list[k++] = list[i]; } return new_list; }
int main() { char* colors[] = {"Red", "Green", "Black"}; int colors_size = 3; char* colors_element = "c"; int new_colors_size; char** new_colors = func0(colors, colors_size, colors_element, &new_colors_size); assert(new_colors_size == 6); assert(strcmp(new_colors[0], "c") == 0); assert(strcmp(new_colors[1], "Red") == 0); assert(strcmp(new_colors[2], "c") == 0); assert(strcmp(new_colors[3], "Green") == 0); assert(strcmp(new_colors[4], "c") == 0); assert(strcmp(new_colors[5], "Black") == 0); free(new_colors); char* languages[] = {"python", "java"}; int languages_size = 2; char* languages_element = "program"; int new_languages_size; char** new_languages = func0(languages, languages_size, languages_element, &new_languages_size); assert(new_languages_size == 4); assert(strcmp(new_languages[0], "program") == 0); assert(strcmp(new_languages[1], "python") == 0); assert(strcmp(new_languages[2], "program") == 0); assert(strcmp(new_languages[3], "java") == 0); free(new_languages); char* moods[] = {"happy", "sad"}; int moods_size = 2; char* moods_element = "laugh"; int new_moods_size; char** new_moods = func0(moods, moods_size, moods_element, &new_moods_size); assert(new_moods_size == 4); assert(strcmp(new_moods[0], "laugh") == 0); assert(strcmp(new_moods[1], "happy") == 0); assert(strcmp(new_moods[2], "laugh") == 0); assert(strcmp(new_moods[3], "sad") == 0); free(new_moods); return 0; }
O3
c
func0: endbr64 push %rbp mov %esi,%ebp push %rbx mov %rdi,%rbx lea (%rsi,%rsi,1),%edi sub $0x18,%rsp mov %edi,(%rcx) movslq %edi,%rdi shl $0x3,%rdi mov %rdx,0x8(%rsp) callq 10b0 <malloc@plt> test %ebp,%ebp jle 1707 <func0+0x97> cmp $0x1,%ebp movq 0x8(%rsp),%xmm2 je 170e <func0+0x9e> mov %ebp,%ecx movdqa %xmm2,%xmm0 xor %edx,%edx shr %ecx punpcklqdq %xmm0,%xmm0 shl $0x4,%rcx nopw %cs:0x0(%rax,%rax,1) movdqu (%rbx,%rdx,1),%xmm3 movdqa %xmm0,%xmm1 punpcklqdq %xmm3,%xmm1 movups %xmm1,(%rax,%rdx,2) movdqa %xmm0,%xmm1 punpckhqdq %xmm3,%xmm1 movups %xmm1,0x10(%rax,%rdx,2) add $0x10,%rdx cmp %rdx,%rcx jne 16c0 <func0+0x50> mov %ebp,%ecx and $0xfffffffe,%ecx lea (%rcx,%rcx,1),%edx cmp %ecx,%ebp je 1707 <func0+0x97> movslq %ecx,%rcx movslq %edx,%rdx mov (%rbx,%rcx,8),%rcx movq %xmm2,(%rax,%rdx,8) mov %rcx,0x8(%rax,%rdx,8) add $0x18,%rsp pop %rbx pop %rbp retq xor %ecx,%ecx xor %edx,%edx jmp 16f3 <func0+0x83> nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 push rbp mov ebp, esi push rbx mov rbx, rdi lea edi, [rsi+rsi] sub rsp, 18h mov [rcx], edi movsxd rdi, edi shl rdi, 3; size mov [rsp+28h+var_20], rdx call _malloc test ebp, ebp jle short loc_16E5 cmp ebp, 1 movq xmm0, [rsp+28h+var_20] jz short loc_16EC mov edx, ebp movdqa xmm3, xmm0 xor ecx, ecx shr edx, 1 punpcklqdq xmm3, xmm3 shl rdx, 4 nop word ptr [rax+rax+00000000h] loc_16A0: movdqu xmm4, xmmword ptr [rbx+rcx] movdqa xmm1, xmm3 movdqa xmm2, xmm0 punpcklqdq xmm1, xmm4 movups xmmword ptr [rax+rcx*2], xmm1 movhlps xmm1, xmm4 punpcklqdq xmm2, xmm1 movups xmmword ptr [rax+rcx*2+10h], xmm2 add rcx, 10h cmp rdx, rcx jnz short loc_16A0 mov edx, ebp and edx, 0FFFFFFFEh and ebp, 1 jz short loc_16E5 lea ecx, [rdx+rdx] loc_16D7: movsxd rdx, edx movhps xmm0, qword ptr [rbx+rdx*8] movsxd rdx, ecx movups xmmword ptr [rax+rdx*8], xmm0 loc_16E5: add rsp, 18h pop rbx pop rbp retn loc_16EC: xor edx, edx xor ecx, ecx jmp short loc_16D7
char * func0(long long a1, int a2, long long a3, _DWORD *a4) { char *result; // rax __m128i v5; // xmm0 long long v6; // rcx __m128i v7; // xmm3 __m128 v8; // xmm4 __m128 v9; // xmm1 signed int v10; // edx int v11; // ecx __m128i v12[2]; // [rsp+8h] [rbp-20h] BYREF *a4 = 2 * a2; v12[0].m128i_i64[0] = a3; result = (char *)malloc(16LL * a2); if ( a2 > 0 ) { v5 = _mm_loadl_epi64(v12); if ( a2 == 1 ) { v10 = 0; v11 = 0; goto LABEL_7; } v6 = 0LL; v7 = _mm_unpacklo_epi64(v5, v5); do { v8 = (__m128)_mm_loadu_si128((const __m128i *)(a1 + v6)); v9 = (__m128)_mm_unpacklo_epi64(v7, (__m128i)v8); *(__m128 *)&result[2 * v6] = v9; *(__m128i *)&result[2 * v6 + 16] = _mm_unpacklo_epi64(v5, (__m128i)_mm_movehl_ps(v9, v8)); v6 += 16LL; } while ( 16LL * ((unsigned int)a2 >> 1) != v6 ); v10 = a2 & 0xFFFFFFFE; if ( (a2 & 1) != 0 ) { v11 = 2 * v10; LABEL_7: *(__m128 *)&result[8 * v11] = _mm_loadh_ps((const double *)(a1 + 8LL * v10)); } } return result; }
func0: ENDBR64 PUSH RBP MOV EBP,ESI PUSH RBX MOV RBX,RDI LEA EDI,[RSI + RSI*0x1] SUB RSP,0x18 MOV dword ptr [RCX],EDI MOVSXD RDI,EDI SHL RDI,0x3 MOV qword ptr [RSP + 0x8],RDX CALL 0x001010d0 TEST EBP,EBP JLE 0x001016e5 CMP EBP,0x1 MOVQ XMM0,qword ptr [RSP + 0x8] JZ 0x001016ec MOV EDX,EBP MOVDQA XMM3,XMM0 XOR ECX,ECX SHR EDX,0x1 PUNPCKLQDQ XMM3,XMM3 SHL RDX,0x4 NOP word ptr CS:[RAX + RAX*0x1] LAB_001016a0: MOVDQU XMM4,xmmword ptr [RBX + RCX*0x1] MOVDQA XMM1,XMM3 MOVDQA XMM2,XMM0 PUNPCKLQDQ XMM1,XMM4 MOVUPS xmmword ptr [RAX + RCX*0x2],XMM1 MOVHLPS XMM1,XMM4 PUNPCKLQDQ XMM2,XMM1 MOVUPS xmmword ptr [RAX + RCX*0x2 + 0x10],XMM2 ADD RCX,0x10 CMP RDX,RCX JNZ 0x001016a0 MOV EDX,EBP AND EDX,0xfffffffe AND EBP,0x1 JZ 0x001016e5 LEA ECX,[RDX + RDX*0x1] LAB_001016d7: MOVSXD RDX,EDX MOVHPS XMM0,qword ptr [RBX + RDX*0x8] MOVSXD RDX,ECX MOVUPS xmmword ptr [RAX + RDX*0x8],XMM0 LAB_001016e5: ADD RSP,0x18 POP RBX POP RBP RET LAB_001016ec: XOR EDX,EDX XOR ECX,ECX JMP 0x001016d7
void func0(long param_1,uint param_2,int8 param_3,int *param_4) { int8 *puVar1; int8 uVar2; int8 uVar3; void *pvVar4; int iVar5; long lVar6; uint uVar7; *param_4 = param_2 * 2; pvVar4 = malloc((long)(int)(param_2 * 2) << 3); if (0 < (int)param_2) { if (param_2 == 1) { uVar7 = 0; iVar5 = 0; } else { lVar6 = 0; do { uVar2 = *(int8 *)(param_1 + lVar6); uVar3 = ((int8 *)(param_1 + lVar6))[1]; puVar1 = (int8 *)((long)pvVar4 + lVar6 * 2); *puVar1 = param_3; puVar1[1] = uVar2; puVar1 = (int8 *)((long)pvVar4 + lVar6 * 2 + 0x10); *puVar1 = param_3; puVar1[1] = uVar3; lVar6 = lVar6 + 0x10; } while ((ulong)(param_2 >> 1) << 4 != lVar6); uVar7 = param_2 & 0xfffffffe; if ((param_2 & 1) == 0) { return; } iVar5 = uVar7 * 2; } uVar2 = *(int8 *)(param_1 + (long)(int)uVar7 * 8); puVar1 = (int8 *)((long)pvVar4 + (long)iVar5 * 8); *puVar1 = param_3; puVar1[1] = uVar2; } return; }
4,900
func0
#include <stdio.h> #include <math.h> #include <assert.h> typedef struct { double magnitude; double angle; } polar_number;
polar_number func0(double numbers) { polar_number num; num.magnitude = fabs(numbers); num.angle = 0.0; return num; }
int main() { polar_number num; num = func0(1); assert(num.magnitude == 1.0 && num.angle == 0.0); num = func0(4); assert(num.magnitude == 4.0 && num.angle == 0.0); num = func0(5); assert(num.magnitude == 5.0 && num.angle == 0.0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx movsd %xmm0,-0x20(%rbp) movsd -0x20(%rbp),%xmm0 movq 0xf7c(%rip),%xmm1 andpd %xmm1,%xmm0 movsd %xmm0,-0x18(%rbp) pxor %xmm0,%xmm0 movsd %xmm0,-0x10(%rbp) mov -0x18(%rbp),%rax mov -0x10(%rbp),%rdx mov %rax,%rcx mov %rdx,%rbx movq %rcx,%xmm0 movq %rdx,%xmm1 pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp movsd [rbp+var_18], xmm0 movsd xmm0, [rbp+var_18] movq xmm1, cs:qword_20C0 andpd xmm0, xmm1 movsd [rbp+var_10], xmm0 pxor xmm0, xmm0 movsd [rbp+var_8], xmm0 mov rax, [rbp+var_10] mov rdx, [rbp+var_8] mov qword ptr [rbp+var_30], rax mov qword ptr [rbp+var_30+8], rdx movdqa xmm0, [rbp+var_30] movq xmm1, rdx pop rbp retn
__m128i func0(double a1) { __m128i v2; // [rsp+0h] [rbp-30h] BYREF double v3; // [rsp+18h] [rbp-18h] double v4; // [rsp+20h] [rbp-10h] long long v5; // [rsp+28h] [rbp-8h] v3 = a1; v4 = fabs(a1); v5 = 0LL; v2 = (__m128i)*(unsigned long long *)&v4; return _mm_load_si128(&v2); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOVSD qword ptr [RBP + -0x18],XMM0 MOVSD XMM0,qword ptr [RBP + -0x18] MOVQ XMM1,qword ptr [0x001020c0] ANDPD XMM0,XMM1 MOVSD qword ptr [RBP + -0x10],XMM0 PXOR XMM0,XMM0 MOVSD qword ptr [RBP + -0x8],XMM0 MOV RAX,qword ptr [RBP + -0x10] MOV RDX,qword ptr [RBP + -0x8] MOV qword ptr [RBP + -0x30],RAX MOV qword ptr [RBP + -0x28],RDX MOVDQA XMM0,xmmword ptr [RBP + -0x30] MOVQ XMM1,RDX POP RBP RET
int [16] func0(ulong param_1) { int auVar1 [16]; auVar1._0_8_ = param_1 & DAT_001020c0; auVar1._8_8_ = 0; return auVar1; }
4,901
func0
#include <stdio.h> #include <math.h> #include <assert.h> typedef struct { double magnitude; double angle; } polar_number;
polar_number func0(double numbers) { polar_number num; num.magnitude = fabs(numbers); num.angle = 0.0; return num; }
int main() { polar_number num; num = func0(1); assert(num.magnitude == 1.0 && num.angle == 0.0); num = func0(4); assert(num.magnitude == 4.0 && num.angle == 0.0); num = func0(5); assert(num.magnitude == 5.0 && num.angle == 0.0); return 0; }
O1
c
func0: endbr64 andpd 0xedb(%rip),%xmm0 pxor %xmm1,%xmm1 retq
func0: endbr64 andpd xmm0, cs:xmmword_2010 pxor xmm1, xmm1 retn
__m128d func0(__m128d a1) { return _mm_and_pd(a1, (__m128d)xmmword_2010); }
func0: ENDBR64 ANDPD XMM0,xmmword ptr [0x00102010] PXOR XMM1,XMM1 RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ int1 [16] func0(ulong param_1) { int1 auVar1 [16]; auVar1._0_8_ = param_1 & _DAT_00102010; auVar1._8_8_ = 0; return auVar1; }
4,902
func0
#include <stdio.h> #include <math.h> #include <assert.h> typedef struct { double magnitude; double angle; } polar_number;
polar_number func0(double numbers) { polar_number num; num.magnitude = fabs(numbers); num.angle = 0.0; return num; }
int main() { polar_number num; num = func0(1); assert(num.magnitude == 1.0 && num.angle == 0.0); num = func0(4); assert(num.magnitude == 4.0 && num.angle == 0.0); num = func0(5); assert(num.magnitude == 5.0 && num.angle == 0.0); return 0; }
O2
c
func0: endbr64 pxor %xmm1,%xmm1 andpd 0xec0(%rip),%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 pxor xmm1, xmm1 andpd xmm0, cs:xmmword_2010 retn
__m128d func0(__m128d a1) { return _mm_and_pd(a1, (__m128d)xmmword_2010); }
func0: ENDBR64 PXOR XMM1,XMM1 ANDPD XMM0,xmmword ptr [0x00102010] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ int1 [16] func0(ulong param_1) { int1 auVar1 [16]; auVar1._0_8_ = param_1 & _DAT_00102010; auVar1._8_8_ = 0; return auVar1; }
4,903
func0
#include <stdio.h> #include <math.h> #include <assert.h> typedef struct { double magnitude; double angle; } polar_number;
polar_number func0(double numbers) { polar_number num; num.magnitude = fabs(numbers); num.angle = 0.0; return num; }
int main() { polar_number num; num = func0(1); assert(num.magnitude == 1.0 && num.angle == 0.0); num = func0(4); assert(num.magnitude == 4.0 && num.angle == 0.0); num = func0(5); assert(num.magnitude == 5.0 && num.angle == 0.0); return 0; }
O3
c
func0: endbr64 pxor %xmm1,%xmm1 andpd 0xec0(%rip),%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 pxor xmm1, xmm1 andpd xmm0, cs:xmmword_2010 retn
__m128d func0(__m128d a1) { return _mm_and_pd(a1, (__m128d)xmmword_2010); }
func0: ENDBR64 PXOR XMM1,XMM1 ANDPD XMM0,xmmword ptr [0x00102010] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ int [16] func0(ulong param_1) { int auVar1 [16]; auVar1._0_8_ = param_1 & _DAT_00102010; auVar1._8_8_ = 0; return auVar1; }
4,904
func0
#include <stdio.h> #include <assert.h>
int func0(int list1[], int length) { int ctr = 0; for (int i = 0; i < length; i++) { ctr++; } return ctr; }
int main() { int list1[] = {1, 2, 5}; int size1 = sizeof(list1) / sizeof(list1[0]); assert(func0(list1, size1) == 3); int list2[] = {1, 2, 3}; int size2 = sizeof(list2) / sizeof(list2[0]); assert(func0(list2, size2) == 3); int list3[] = {1, 4}; int size3 = sizeof(list3) / sizeof(list3[0]); assert(func0(list3, size3) == 2); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 1190 <func0+0x27> addl $0x1,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1188 <func0+0x1f> mov -0x8(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_1190 loc_1188: add [rbp+var_8], 1 add [rbp+var_4], 1 loc_1190: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1188 mov eax, [rbp+var_8] pop rbp retn
long long func0(long long a1, int a2) { unsigned int v3; // [rsp+14h] [rbp-8h] int i; // [rsp+18h] [rbp-4h] v3 = 0; for ( i = 0; i < a2; ++i ) ++v3; return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101190 LAB_00101188: ADD dword ptr [RBP + -0x8],0x1 ADD dword ptr [RBP + -0x4],0x1 LAB_00101190: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101188 MOV EAX,dword ptr [RBP + -0x8] POP RBP RET
int func0(int8 param_1,int param_2) { int4 local_10; int4 local_c; local_10 = 0; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { local_10 = local_10 + 1; } return local_10; }
4,905
func0
#include <stdio.h> #include <assert.h>
int func0(int list1[], int length) { int ctr = 0; for (int i = 0; i < length; i++) { ctr++; } return ctr; }
int main() { int list1[] = {1, 2, 5}; int size1 = sizeof(list1) / sizeof(list1[0]); assert(func0(list1, size1) == 3); int list2[] = {1, 2, 3}; int size2 = sizeof(list2) / sizeof(list2[0]); assert(func0(list2, size2) == 3); int list3[] = {1, 4}; int size3 = sizeof(list3) / sizeof(list3[0]); assert(func0(list3, size3) == 2); return 0; }
O1
c
func0: endbr64 mov %esi,%eax test %esi,%esi jle 1140 <func0+0x17> mov $0x0,%edx add $0x1,%edx cmp %edx,%eax jne 1138 <func0+0xf> retq mov $0x0,%eax retq
func0: endbr64 mov eax, esi test esi, esi jle short loc_1140 mov edx, 0 loc_1138: add edx, 1 cmp eax, edx jnz short loc_1138 retn loc_1140: mov eax, 0 retn
long long func0(long long a1, int a2) { long long result; // rax int i; // edx result = (unsigned int)a2; if ( a2 <= 0 ) return 0LL; for ( i = 0; i != a2; ++i ) ; return result; }
func0: ENDBR64 MOV EAX,ESI TEST ESI,ESI JLE 0x00101140 MOV EDX,0x0 LAB_00101138: ADD EDX,0x1 CMP EAX,EDX JNZ 0x00101138 RET LAB_00101140: MOV EAX,0x0 RET
int func0(int8 param_1,int param_2) { int iVar1; if (0 < param_2) { iVar1 = 0; do { iVar1 = iVar1 + 1; } while (param_2 != iVar1); return param_2; } return 0; }
4,906
func0
#include <stdio.h> #include <assert.h>
int func0(int list1[], int length) { int ctr = 0; for (int i = 0; i < length; i++) { ctr++; } return ctr; }
int main() { int list1[] = {1, 2, 5}; int size1 = sizeof(list1) / sizeof(list1[0]); assert(func0(list1, size1) == 3); int list2[] = {1, 2, 3}; int size2 = sizeof(list2) / sizeof(list2[0]); assert(func0(list2, size2) == 3); int list3[] = {1, 4}; int size3 = sizeof(list3) / sizeof(list3[0]); assert(func0(list3, size3) == 2); return 0; }
O2
c
func0: endbr64 test %esi,%esi mov $0x0,%eax cmovg %esi,%eax retq
func0: endbr64 xor eax, eax test esi, esi cmovns eax, esi retn
long long func0(long long a1, int a2) { long long result; // rax result = 0LL; if ( a2 >= 0 ) return (unsigned int)a2; return result; }
func0: ENDBR64 XOR EAX,EAX TEST ESI,ESI CMOVNS EAX,ESI RET
int func0(int8 param_1,int param_2) { int iVar1; iVar1 = 0; if (-1 < param_2) { iVar1 = param_2; } return iVar1; }
4,907
func0
#include <stdio.h> #include <assert.h>
int func0(int list1[], int length) { int ctr = 0; for (int i = 0; i < length; i++) { ctr++; } return ctr; }
int main() { int list1[] = {1, 2, 5}; int size1 = sizeof(list1) / sizeof(list1[0]); assert(func0(list1, size1) == 3); int list2[] = {1, 2, 3}; int size2 = sizeof(list2) / sizeof(list2[0]); assert(func0(list2, size2) == 3); int list3[] = {1, 4}; int size3 = sizeof(list3) / sizeof(list3[0]); assert(func0(list3, size3) == 2); return 0; }
O3
c
func0: endbr64 test %esi,%esi mov $0x0,%eax cmovg %esi,%eax retq
func0: endbr64 xor eax, eax test esi, esi cmovns eax, esi retn
long long func0(long long a1, int a2) { long long result; // rax result = 0LL; if ( a2 >= 0 ) return (unsigned int)a2; return result; }
func0: ENDBR64 XOR EAX,EAX TEST ESI,ESI CMOVNS EAX,ESI RET
int func0(int8 param_1,int param_2) { int iVar1; iVar1 = 0; if (-1 < param_2) { iVar1 = param_2; } return iVar1; }
4,908
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <regex.h> #include <assert.h> typedef struct { char **matches; int count; } MatchList;
MatchList func0(const char *text) { regex_t regex; regmatch_t pmatch[1]; const char *pattern = "[ae]\\w+"; int ret; MatchList list; list.matches = NULL; list.count = 0; ret = regcomp(&regex, pattern, REG_EXTENDED); if (ret) { fprintf(stderr, "Could not compile regex\n"); exit(1); } const char *p = text; while ((ret = regexec(&regex, p, 1, pmatch, 0)) != REG_NOMATCH) { if (ret) { regfree(&regex); fprintf(stderr, "Regex match failed\n"); exit(1); } int start = pmatch[0].rm_so; int end = pmatch[0].rm_eo; int len = end - start; char *match = (char *)malloc(len + 1); strncpy(match, p + start, len); match[len] = '\0'; list.matches = (char **)realloc(list.matches, sizeof(char *) * (list.count + 1)); list.matches[list.count] = match; list.count++; p += end; } regfree(&regex); return list; }
int main() { // Test case 1 MatchList result1 = func0("python programe"); assert(result1.count == 1); assert(strcmp(result1.matches[0], "ame") == 0); for(int i = 0; i < result1.count; i++) { free(result1.matches[i]); } free(result1.matches); // Test case 2 MatchList result2 = func0("python programe language"); assert(result2.count == 2); assert(strcmp(result2.matches[0], "ame") == 0); assert(strcmp(result2.matches[1], "anguage") == 0); for(int i = 0; i < result2.count; i++) { free(result2.matches[i]); } free(result2.matches); // Test case 3 MatchList result3 = func0("assert statement"); assert(result3.count == 2); assert(strcmp(result3.matches[0], "assert") == 0); assert(strcmp(result3.matches[1], "atement") == 0); for(int i = 0; i < result3.count; i++) { free(result3.matches[i]); } free(result3.matches); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0xa0,%rsp mov %rdi,-0x98(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea 0xd33(%rip),%rax mov %rax,-0x70(%rbp) movq $0x0,-0x60(%rbp) movl $0x0,-0x58(%rbp) mov -0x70(%rbp),%rcx lea -0x50(%rbp),%rax mov $0x1,%edx mov %rcx,%rsi mov %rax,%rdi callq 1150 <regcomp@plt> mov %eax,-0x88(%rbp) cmpl $0x0,-0x88(%rbp) je 1339 <func0+0x90> mov 0x2d0a(%rip),%rax mov %rax,%rcx mov $0x18,%edx mov $0x1,%esi lea 0xce6(%rip),%rdi callq 11b0 <fwrite@plt> mov $0x1,%edi callq 11a0 <exit@plt> mov -0x98(%rbp),%rax mov %rax,-0x78(%rbp) jmpq 1439 <func0+0x190> cmpl $0x0,-0x88(%rbp) je 1388 <func0+0xdf> lea -0x50(%rbp),%rax mov %rax,%rdi callq 1120 <regfree@plt> mov 0x2cbb(%rip),%rax mov %rax,%rcx mov $0x13,%edx mov $0x1,%esi lea 0xcb0(%rip),%rdi callq 11b0 <fwrite@plt> mov $0x1,%edi callq 11a0 <exit@plt> mov -0x10(%rbp),%eax mov %eax,-0x84(%rbp) mov -0xc(%rbp),%eax mov %eax,-0x80(%rbp) mov -0x80(%rbp),%eax sub -0x84(%rbp),%eax mov %eax,-0x7c(%rbp) mov -0x7c(%rbp),%eax add $0x1,%eax cltq mov %rax,%rdi callq 1170 <malloc@plt> mov %rax,-0x68(%rbp) mov -0x7c(%rbp),%eax movslq %eax,%rdx mov -0x84(%rbp),%eax movslq %eax,%rcx mov -0x78(%rbp),%rax add %rax,%rcx mov -0x68(%rbp),%rax mov %rcx,%rsi mov %rax,%rdi callq 1110 <strncpy@plt> mov -0x7c(%rbp),%eax movslq %eax,%rdx mov -0x68(%rbp),%rax add %rdx,%rax movb $0x0,(%rax) mov -0x58(%rbp),%eax add $0x1,%eax cltq lea 0x0(,%rax,8),%rdx mov -0x60(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1190 <realloc@plt> mov %rax,-0x60(%rbp) mov -0x60(%rbp),%rax mov -0x58(%rbp),%edx movslq %edx,%rdx shl $0x3,%rdx add %rax,%rdx mov -0x68(%rbp),%rax mov %rax,(%rdx) mov -0x58(%rbp),%eax add $0x1,%eax mov %eax,-0x58(%rbp) mov -0x80(%rbp),%eax cltq add %rax,-0x78(%rbp) lea -0x10(%rbp),%rdx mov -0x78(%rbp),%rsi lea -0x50(%rbp),%rax mov $0x0,%r8d mov %rdx,%rcx mov $0x1,%edx mov %rax,%rdi callq 1180 <regexec@plt> mov %eax,-0x88(%rbp) cmpl $0x1,-0x88(%rbp) jne 1349 <func0+0xa0> lea -0x50(%rbp),%rax mov %rax,%rdi callq 1120 <regfree@plt> mov -0x60(%rbp),%rax mov -0x58(%rbp),%rdx mov -0x8(%rbp),%rsi xor %fs:0x28,%rsi je 1496 <func0+0x1ed> callq 1130 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 0A0h mov [rbp+var_98], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea rax, aAeW; "[ae]\\w+" mov [rbp+pattern], rax mov [rbp+ptr], 0 mov dword ptr [rbp+var_58], 0 mov rcx, [rbp+pattern] lea rax, [rbp+preg] mov edx, 1; cflags mov rsi, rcx; pattern mov rdi, rax; preg call _regcomp mov [rbp+var_88], eax cmp [rbp+var_88], 0 jz short loc_133C mov rax, cs:__bss_start mov rcx, rax; s mov edx, 18h; n mov esi, 1; size lea rax, aCouldNotCompil; "Could not compile regex\n" mov rdi, rax; ptr call _fwrite mov edi, 1; status call _exit loc_133C: mov rax, [rbp+var_98] mov [rbp+string], rax jmp loc_143F loc_134C: cmp [rbp+var_88], 0 jz short loc_138E lea rax, [rbp+preg] mov rdi, rax; preg call _regfree mov rax, cs:__bss_start mov rcx, rax; s mov edx, 13h; n mov esi, 1; size lea rax, aRegexMatchFail; "Regex match failed\n" mov rdi, rax; ptr call _fwrite mov edi, 1; status call _exit loc_138E: mov eax, [rbp+pmatch.rm_so] mov [rbp+var_84], eax mov eax, [rbp+pmatch.rm_eo] mov [rbp+var_80], eax mov eax, [rbp+var_80] sub eax, [rbp+var_84] mov [rbp+var_7C], eax mov eax, [rbp+var_7C] add eax, 1 cdqe mov rdi, rax; size call _malloc mov [rbp+dest], rax mov eax, [rbp+var_7C] movsxd rdx, eax; n mov eax, [rbp+var_84] movsxd rcx, eax mov rax, [rbp+string] add rcx, rax mov rax, [rbp+dest] mov rsi, rcx; src mov rdi, rax; dest call _strncpy mov eax, [rbp+var_7C] movsxd rdx, eax mov rax, [rbp+dest] add rax, rdx mov byte ptr [rax], 0 mov eax, dword ptr [rbp+var_58] add eax, 1 cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+ptr] mov rsi, rdx; size mov rdi, rax; ptr call _realloc mov [rbp+ptr], rax mov rax, [rbp+ptr] mov edx, dword ptr [rbp+var_58] movsxd rdx, edx shl rdx, 3 add rdx, rax mov rax, [rbp+dest] mov [rdx], rax mov eax, dword ptr [rbp+var_58] add eax, 1 mov dword ptr [rbp+var_58], eax mov eax, [rbp+var_80] cdqe add [rbp+string], rax loc_143F: lea rdx, [rbp+pmatch] mov rsi, [rbp+string]; string lea rax, [rbp+preg] mov r8d, 0; eflags mov rcx, rdx; pmatch mov edx, 1; nmatch mov rdi, rax; preg call _regexec mov [rbp+var_88], eax cmp [rbp+var_88], 1 jnz loc_134C lea rax, [rbp+preg] mov rdi, rax; preg call _regfree mov rax, [rbp+ptr] mov rdx, [rbp+var_58] mov rcx, [rbp+var_8] sub rcx, fs:28h jz short locret_149C call ___stack_chk_fail locret_149C: leave retn
void * func0(const char *a1) { int i; // eax regmatch_t v3; // [rsp+1Ch] [rbp-84h] int v4; // [rsp+24h] [rbp-7Ch] char *string; // [rsp+28h] [rbp-78h] char *dest; // [rsp+38h] [rbp-68h] void *ptr; // [rsp+40h] [rbp-60h] int v8; // [rsp+48h] [rbp-58h] regex_t preg; // [rsp+50h] [rbp-50h] BYREF regmatch_t pmatch; // [rsp+90h] [rbp-10h] BYREF unsigned long long v11; // [rsp+98h] [rbp-8h] v11 = __readfsqword(0x28u); ptr = 0LL; v8 = 0; if ( regcomp(&preg, "[ae]\\w+", 1) ) { fwrite("Could not compile regex\n", 1uLL, 0x18uLL, _bss_start); exit(1); } string = (char *)a1; for ( i = regexec(&preg, a1, 1uLL, &pmatch, 0); i != 1; i = regexec(&preg, string, 1uLL, &pmatch, 0) ) { if ( i ) { regfree(&preg); fwrite("Regex match failed\n", 1uLL, 0x13uLL, _bss_start); exit(1); } v3 = pmatch; v4 = pmatch.rm_eo - pmatch.rm_so; dest = (char *)malloc(pmatch.rm_eo - pmatch.rm_so + 1); strncpy(dest, &string[v3.rm_so], v4); dest[v4] = 0; ptr = realloc(ptr, 8LL * (v8 + 1)); *((_QWORD *)ptr + v8++) = dest; string += v3.rm_eo; } regfree(&preg); return ptr; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0xa0 MOV qword ptr [RBP + -0x98],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX LEA RAX,[0x102008] MOV qword ptr [RBP + -0x70],RAX MOV qword ptr [RBP + -0x60],0x0 MOV dword ptr [RBP + -0x58],0x0 MOV RCX,qword ptr [RBP + -0x70] LEA RAX,[RBP + -0x50] MOV EDX,0x1 MOV RSI,RCX MOV RDI,RAX CALL 0x00101150 MOV dword ptr [RBP + -0x88],EAX CMP dword ptr [RBP + -0x88],0x0 JZ 0x0010133c MOV RAX,qword ptr [0x00104020] MOV RCX,RAX MOV EDX,0x18 MOV ESI,0x1 LEA RAX,[0x102010] MOV RDI,RAX CALL 0x001011b0 MOV EDI,0x1 CALL 0x001011a0 LAB_0010133c: MOV RAX,qword ptr [RBP + -0x98] MOV qword ptr [RBP + -0x78],RAX JMP 0x0010143f LAB_0010134c: CMP dword ptr [RBP + -0x88],0x0 JZ 0x0010138e LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x00101120 MOV RAX,qword ptr [0x00104020] MOV RCX,RAX MOV EDX,0x13 MOV ESI,0x1 LEA RAX,[0x102029] MOV RDI,RAX CALL 0x001011b0 MOV EDI,0x1 CALL 0x001011a0 LAB_0010138e: MOV EAX,dword ptr [RBP + -0x10] MOV dword ptr [RBP + -0x84],EAX MOV EAX,dword ptr [RBP + -0xc] MOV dword ptr [RBP + -0x80],EAX MOV EAX,dword ptr [RBP + -0x80] SUB EAX,dword ptr [RBP + -0x84] MOV dword ptr [RBP + -0x7c],EAX MOV EAX,dword ptr [RBP + -0x7c] ADD EAX,0x1 CDQE MOV RDI,RAX CALL 0x00101170 MOV qword ptr [RBP + -0x68],RAX MOV EAX,dword ptr [RBP + -0x7c] MOVSXD RDX,EAX MOV EAX,dword ptr [RBP + -0x84] MOVSXD RCX,EAX MOV RAX,qword ptr [RBP + -0x78] ADD RCX,RAX MOV RAX,qword ptr [RBP + -0x68] MOV RSI,RCX MOV RDI,RAX CALL 0x00101110 MOV EAX,dword ptr [RBP + -0x7c] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x68] ADD RAX,RDX MOV byte ptr [RAX],0x0 MOV EAX,dword ptr [RBP + -0x58] ADD EAX,0x1 CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x60] MOV RSI,RDX MOV RDI,RAX CALL 0x00101190 MOV qword ptr [RBP + -0x60],RAX MOV RAX,qword ptr [RBP + -0x60] MOV EDX,dword ptr [RBP + -0x58] MOVSXD RDX,EDX SHL RDX,0x3 ADD RDX,RAX MOV RAX,qword ptr [RBP + -0x68] MOV qword ptr [RDX],RAX MOV EAX,dword ptr [RBP + -0x58] ADD EAX,0x1 MOV dword ptr [RBP + -0x58],EAX MOV EAX,dword ptr [RBP + -0x80] CDQE ADD qword ptr [RBP + -0x78],RAX LAB_0010143f: LEA RDX,[RBP + -0x10] MOV RSI,qword ptr [RBP + -0x78] LEA RAX,[RBP + -0x50] MOV R8D,0x0 MOV RCX,RDX MOV EDX,0x1 MOV RDI,RAX CALL 0x00101180 MOV dword ptr [RBP + -0x88],EAX CMP dword ptr [RBP + -0x88],0x1 JNZ 0x0010134c LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x00101120 MOV RAX,qword ptr [RBP + -0x60] MOV RDX,qword ptr [RBP + -0x58] MOV RCX,qword ptr [RBP + -0x8] SUB RCX,qword ptr FS:[0x28] JZ 0x0010149c CALL 0x00101130 LAB_0010149c: LEAVE RET
void * func0(char *param_1) { regoff_t rVar1; regoff_t rVar2; int iVar3; char *__dest; long in_FS_OFFSET; char *local_80; void *local_68; int local_60; regex_t local_58; regmatch_t local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_68 = (void *)0x0; local_60 = 0; iVar3 = regcomp(&local_58,"[ae]\\w+",1); local_80 = param_1; if (iVar3 != 0) { fwrite("Could not compile regex\n",1,0x18,stderr); /* WARNING: Subroutine does not return */ exit(1); } while( true ) { iVar3 = regexec(&local_58,local_80,1,&local_18,0); rVar2 = local_18.rm_eo; rVar1 = local_18.rm_so; if (iVar3 == 1) { regfree(&local_58); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_68; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); } if (iVar3 != 0) break; iVar3 = local_18.rm_eo - local_18.rm_so; __dest = (char *)malloc((long)(iVar3 + 1)); strncpy(__dest,local_80 + rVar1,(long)iVar3); __dest[iVar3] = '\0'; local_68 = realloc(local_68,(long)(local_60 + 1) * 8); *(char **)((long)local_60 * 8 + (long)local_68) = __dest; local_60 = local_60 + 1; local_80 = local_80 + rVar2; } regfree(&local_58); fwrite("Regex match failed\n",1,0x13,stderr); /* WARNING: Subroutine does not return */ exit(1); }
4,909
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <regex.h> #include <assert.h> typedef struct { char **matches; int count; } MatchList;
MatchList func0(const char *text) { regex_t regex; regmatch_t pmatch[1]; const char *pattern = "[ae]\\w+"; int ret; MatchList list; list.matches = NULL; list.count = 0; ret = regcomp(&regex, pattern, REG_EXTENDED); if (ret) { fprintf(stderr, "Could not compile regex\n"); exit(1); } const char *p = text; while ((ret = regexec(&regex, p, 1, pmatch, 0)) != REG_NOMATCH) { if (ret) { regfree(&regex); fprintf(stderr, "Regex match failed\n"); exit(1); } int start = pmatch[0].rm_so; int end = pmatch[0].rm_eo; int len = end - start; char *match = (char *)malloc(len + 1); strncpy(match, p + start, len); match[len] = '\0'; list.matches = (char **)realloc(list.matches, sizeof(char *) * (list.count + 1)); list.matches[list.count] = match; list.count++; p += end; } regfree(&regex); return list; }
int main() { // Test case 1 MatchList result1 = func0("python programe"); assert(result1.count == 1); assert(strcmp(result1.matches[0], "ame") == 0); for(int i = 0; i < result1.count; i++) { free(result1.matches[i]); } free(result1.matches); // Test case 2 MatchList result2 = func0("python programe language"); assert(result2.count == 2); assert(strcmp(result2.matches[0], "ame") == 0); assert(strcmp(result2.matches[1], "anguage") == 0); for(int i = 0; i < result2.count; i++) { free(result2.matches[i]); } free(result2.matches); // Test case 3 MatchList result3 = func0("assert statement"); assert(result3.count == 2); assert(strcmp(result3.matches[0], "assert") == 0); assert(strcmp(result3.matches[1], "atement") == 0); for(int i = 0; i < result3.count; i++) { free(result3.matches[i]); } free(result3.matches); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x68,%rsp mov %rdi,%r15 mov %fs:0x28,%rax mov %rax,0x58(%rsp) xor %eax,%eax lea 0x10(%rsp),%rdi mov $0x1,%edx lea 0xd45(%rip),%rsi callq 1140 <regcomp@plt> test %eax,%eax jne 1374 <func0+0xeb> mov $0x0,%ebp movq $0x0,(%rsp) lea 0x50(%rsp),%rax mov %rax,0x8(%rsp) lea 0x10(%rsp),%rdi mov $0x0,%r8d mov 0x8(%rsp),%rcx mov $0x1,%edx mov %r15,%rsi callq 1160 <regexec@plt> cmp $0x1,%eax je 13cc <func0+0x143> test %eax,%eax jne 139b <func0+0x112> mov 0x50(%rsp),%ebx mov 0x54(%rsp),%r14d mov %r14d,%r13d sub %ebx,%r13d lea 0x1(%r13),%edi movslq %edi,%rdi callq 1150 <malloc@plt> mov %rax,%r12 movslq %r13d,%r13 movslq %ebx,%rsi add %r15,%rsi mov %r13,%rdx mov %rax,%rdi callq 1100 <strncpy@plt> movb $0x0,(%r12,%r13,1) add $0x1,%rbp lea 0x0(,%rbp,8),%rbx mov %rbx,%rsi mov (%rsp),%rdi callq 1170 <realloc@plt> mov %rax,(%rsp) mov %r12,-0x8(%rax,%rbx,1) movslq %r14d,%r14 add %r14,%r15 jmpq 12e3 <func0+0x5a> mov 0x2ca5(%rip),%rcx mov $0x18,%edx mov $0x1,%esi lea 0xc80(%rip),%rdi callq 1190 <fwrite@plt> mov $0x1,%edi callq 1180 <exit@plt> lea 0x10(%rsp),%rdi callq 1110 <regfree@plt> mov 0x2c74(%rip),%rcx mov $0x13,%edx mov $0x1,%esi lea 0xc68(%rip),%rdi callq 1190 <fwrite@plt> mov $0x1,%edi callq 1180 <exit@plt> lea 0x10(%rsp),%rdi callq 1110 <regfree@plt> mov %ebp,%edx mov 0x58(%rsp),%rax xor %fs:0x28,%rax jne 13fb <func0+0x172> mov (%rsp),%rax add $0x68,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 1120 <__stack_chk_fail@plt>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 68h mov r15, rdi mov rax, fs:28h mov [rsp+98h+var_40], rax xor eax, eax lea rdi, [rsp+98h+var_88] mov edx, 1 lea rsi, aAeW; "[ae]\\w+" call _regcomp test eax, eax jnz loc_1394 mov ebp, 0 mov [rsp+98h+var_98], 0 lea rax, [rsp+98h+var_48] mov [rsp+98h+var_90], rax loc_1303: lea rdi, [rsp+98h+var_88] mov r8d, 0 mov rcx, [rsp+98h+var_90] mov edx, 1 mov rsi, r15 call _regexec cmp eax, 1 jz loc_13EC test eax, eax jnz loc_13BB mov ebx, [rsp+98h+var_48] mov r14d, [rsp+98h+var_44] mov r13d, r14d sub r13d, ebx lea edi, [r13+1] movsxd rdi, edi call _malloc mov r12, rax movsxd r13, r13d movsxd rsi, ebx add rsi, r15 mov rdx, r13 mov rdi, rax call _strncpy mov byte ptr [r12+r13], 0 add rbp, 1 lea rbx, ds:0[rbp*8] mov rsi, rbx mov rdi, [rsp+98h+var_98] call _realloc mov [rsp+98h+var_98], rax mov [rax+rbx-8], r12 movsxd r14, r14d add r15, r14 jmp loc_1303 loc_1394: mov rcx, cs:stderr@GLIBC_2_2_5 mov edx, 18h mov esi, 1 lea rdi, aCouldNotCompil; "Could not compile regex\n" call _fwrite mov edi, 1 call _exit loc_13BB: lea rdi, [rsp+98h+var_88] call _regfree mov rcx, cs:stderr@GLIBC_2_2_5 mov edx, 13h mov esi, 1 lea rdi, aRegexMatchFail; "Regex match failed\n" call _fwrite mov edi, 1 call _exit loc_13EC: lea rdi, [rsp+98h+var_88] call _regfree mov edx, ebp mov rax, [rsp+98h+var_40] sub rax, fs:28h jnz short loc_141B mov rax, [rsp+98h+var_98] add rsp, 68h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_141B: call ___stack_chk_fail
long long func0(long long a1) { long long v2; // rbp int v3; // eax int v4; // ebx int v5; // r14d int v6; // r13d long long v7; // r12 long long v9; // [rsp+0h] [rbp-98h] _BYTE v10[64]; // [rsp+10h] [rbp-88h] BYREF int v11; // [rsp+50h] [rbp-48h] BYREF int v12; // [rsp+54h] [rbp-44h] unsigned long long v13; // [rsp+58h] [rbp-40h] v13 = __readfsqword(0x28u); if ( (unsigned int)regcomp(v10, "[ae]\\w+", 1LL) ) { fwrite("Could not compile regex\n", 1LL, 24LL, stderr); exit(1LL); } v2 = 0LL; v9 = 0LL; while ( 1 ) { v3 = regexec(v10, a1, 1LL, &v11, 0LL); if ( v3 == 1 ) break; if ( v3 ) { regfree(v10); fwrite("Regex match failed\n", 1LL, 19LL, stderr); exit(1LL); } v4 = v11; v5 = v12; v6 = v12 - v11; v7 = malloc(v12 - v11 + 1); strncpy(v7, a1 + v4, v6); *(_BYTE *)(v7 + v6) = 0; ++v2; v9 = realloc(v9, 8 * v2); *(_QWORD *)(v9 + 8 * v2 - 8) = v7; a1 += v5; } regfree(v10); return v9; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x68 MOV R15,RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x58],RAX XOR EAX,EAX LEA RDI,[RSP + 0x10] MOV EDX,0x1 LEA RSI,[0x102004] CALL 0x00101150 TEST EAX,EAX JNZ 0x00101394 MOV EBP,0x0 MOV qword ptr [RSP],0x0 LEA RAX,[RSP + 0x50] MOV qword ptr [RSP + 0x8],RAX LAB_00101303: LEA RDI,[RSP + 0x10] MOV R8D,0x0 MOV RCX,qword ptr [RSP + 0x8] MOV EDX,0x1 MOV RSI,R15 CALL 0x00101180 CMP EAX,0x1 JZ 0x001013ec TEST EAX,EAX JNZ 0x001013bb MOV EBX,dword ptr [RSP + 0x50] MOV R14D,dword ptr [RSP + 0x54] MOV R13D,R14D SUB R13D,EBX LEA EDI,[R13 + 0x1] MOVSXD RDI,EDI CALL 0x00101170 MOV R12,RAX MOVSXD R13,R13D MOVSXD RSI,EBX ADD RSI,R15 MOV RDX,R13 MOV RDI,RAX CALL 0x00101110 MOV byte ptr [R12 + R13*0x1],0x0 ADD RBP,0x1 LEA RBX,[RBP*0x8] MOV RSI,RBX MOV RDI,qword ptr [RSP] CALL 0x00101190 MOV qword ptr [RSP],RAX MOV qword ptr [RAX + RBX*0x1 + -0x8],R12 MOVSXD R14,R14D ADD R15,R14 JMP 0x00101303 LAB_00101394: MOV RCX,qword ptr [0x00104020] MOV EDX,0x18 MOV ESI,0x1 LEA RDI,[0x10200c] CALL 0x001011b0 MOV EDI,0x1 CALL 0x001011a0 LAB_001013bb: LEA RDI,[RSP + 0x10] CALL 0x00101120 MOV RCX,qword ptr [0x00104020] MOV EDX,0x13 MOV ESI,0x1 LEA RDI,[0x102025] CALL 0x001011b0 MOV EDI,0x1 CALL 0x001011a0 LAB_001013ec: LEA RDI,[RSP + 0x10] CALL 0x00101120 MOV EDX,EBP MOV RAX,qword ptr [RSP + 0x58] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010141b MOV RAX,qword ptr [RSP] ADD RSP,0x68 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010141b: CALL 0x00101130
void * func0(char *param_1) { regoff_t rVar1; regoff_t rVar2; int iVar3; char *__dest; long lVar4; long in_FS_OFFSET; void *local_98; regex_t local_88; regmatch_t local_48; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); iVar3 = regcomp(&local_88,"[ae]\\w+",1); if (iVar3 != 0) { fwrite("Could not compile regex\n",1,0x18,stderr); /* WARNING: Subroutine does not return */ exit(1); } lVar4 = 0; local_98 = (void *)0x0; while( true ) { iVar3 = regexec(&local_88,param_1,1,&local_48,0); rVar2 = local_48.rm_eo; rVar1 = local_48.rm_so; if (iVar3 == 1) { regfree(&local_88); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return local_98; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); } if (iVar3 != 0) break; iVar3 = local_48.rm_eo - local_48.rm_so; __dest = (char *)malloc((long)(iVar3 + 1)); strncpy(__dest,param_1 + rVar1,(long)iVar3); __dest[iVar3] = '\0'; lVar4 = lVar4 + 1; local_98 = realloc(local_98,lVar4 * 8); *(char **)((long)local_98 + (lVar4 * 8 - 8U)) = __dest; param_1 = param_1 + rVar2; } regfree(&local_88); fwrite("Regex match failed\n",1,0x13,stderr); /* WARNING: Subroutine does not return */ exit(1); }
4,910
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <regex.h> #include <assert.h> typedef struct { char **matches; int count; } MatchList;
MatchList func0(const char *text) { regex_t regex; regmatch_t pmatch[1]; const char *pattern = "[ae]\\w+"; int ret; MatchList list; list.matches = NULL; list.count = 0; ret = regcomp(&regex, pattern, REG_EXTENDED); if (ret) { fprintf(stderr, "Could not compile regex\n"); exit(1); } const char *p = text; while ((ret = regexec(&regex, p, 1, pmatch, 0)) != REG_NOMATCH) { if (ret) { regfree(&regex); fprintf(stderr, "Regex match failed\n"); exit(1); } int start = pmatch[0].rm_so; int end = pmatch[0].rm_eo; int len = end - start; char *match = (char *)malloc(len + 1); strncpy(match, p + start, len); match[len] = '\0'; list.matches = (char **)realloc(list.matches, sizeof(char *) * (list.count + 1)); list.matches[list.count] = match; list.count++; p += end; } regfree(&regex); return list; }
int main() { // Test case 1 MatchList result1 = func0("python programe"); assert(result1.count == 1); assert(strcmp(result1.matches[0], "ame") == 0); for(int i = 0; i < result1.count; i++) { free(result1.matches[i]); } free(result1.matches); // Test case 2 MatchList result2 = func0("python programe language"); assert(result2.count == 2); assert(strcmp(result2.matches[0], "ame") == 0); assert(strcmp(result2.matches[1], "anguage") == 0); for(int i = 0; i < result2.count; i++) { free(result2.matches[i]); } free(result2.matches); // Test case 3 MatchList result3 = func0("assert statement"); assert(result3.count == 2); assert(strcmp(result3.matches[0], "assert") == 0); assert(strcmp(result3.matches[1], "atement") == 0); for(int i = 0; i < result3.count; i++) { free(result3.matches[i]); } free(result3.matches); return 0; }
O2
c
func0: endbr64 push %r15 mov $0x1,%edx lea 0xb32(%rip),%rsi push %r14 push %r13 mov %rdi,%r13 push %r12 push %rbp push %rbx sub $0x78,%rsp mov %fs:0x28,%rax mov %rax,0x68(%rsp) xor %eax,%eax lea 0x20(%rsp),%rdi mov %rdi,0x10(%rsp) callq 1140 <regcomp@plt> test %eax,%eax jne 1611 <func0+0x151> lea 0x60(%rsp),%rax xor %ebp,%ebp xor %r12d,%r12d mov %rax,0x18(%rsp) jmp 158f <func0+0xcf> nopl 0x0(%rax) test %eax,%eax jne 15e0 <func0+0x120> mov 0x64(%rsp),%r15d mov 0x60(%rsp),%ebx add $0x1,%rbp mov %r15d,%edx sub %ebx,%edx lea 0x1(%rdx),%edi mov %edx,0x8(%rsp) movslq %edi,%rdi callq 1150 <malloc@plt> movslq 0x8(%rsp),%rdx movslq %ebx,%rsi lea 0x0(,%rbp,8),%rbx add %r13,%rsi mov %rax,%rdi mov %rax,%r14 mov %rdx,0x8(%rsp) callq 1100 <strncpy@plt> mov 0x8(%rsp),%rdx mov %r12,%rdi mov %rbx,%rsi movb $0x0,(%r14,%rdx,1) callq 1170 <realloc@plt> movslq %r15d,%r8 mov %r14,-0x8(%rax,%rbx,1) mov %rax,%r12 add %r8,%r13 mov 0x18(%rsp),%rcx mov 0x10(%rsp),%rdi xor %r8d,%r8d mov %r13,%rsi mov $0x1,%edx callq 1160 <regexec@plt> cmp $0x1,%eax jne 1520 <func0+0x60> mov 0x10(%rsp),%rdi callq 1110 <regfree@plt> mov %ebp,%edx mov 0x68(%rsp),%rax xor %fs:0x28,%rax jne 1638 <func0+0x178> add $0x78,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq mov 0x10(%rsp),%rdi callq 1110 <regfree@plt> mov $0x13,%edx mov $0x1,%esi mov 0x2a25(%rip),%rcx lea 0xa23(%rip),%rdi callq 1190 <fwrite@plt> mov $0x1,%edi callq 1180 <exit@plt> mov 0x2a08(%rip),%rcx mov $0x18,%edx mov $0x1,%esi lea 0x9e3(%rip),%rdi callq 1190 <fwrite@plt> mov $0x1,%edi callq 1180 <exit@plt> callq 1120 <__stack_chk_fail@plt> nopl (%rax)
func0: endbr64 push r15 mov edx, 1 lea rsi, aAeW; "[ae]\\w+" push r14 push r13 mov r13, rdi push r12 push rbp push rbx sub rsp, 78h mov rax, fs:28h mov [rsp+0A8h+var_40], rax xor eax, eax lea rdi, [rsp+0A8h+var_88] mov [rsp+0A8h+var_98], rdi call _regcomp test eax, eax jnz loc_160D lea rax, [rsp+0A8h+var_48] xor ebp, ebp xor r12d, r12d mov [rsp+0A8h+var_90], rax jmp short loc_158B loc_1520: test eax, eax jnz loc_15DC mov r15d, [rsp+0A8h+var_44] mov ebx, [rsp+0A8h+var_48] mov edx, r15d sub edx, ebx lea edi, [rdx+1] mov dword ptr [rsp+0A8h+var_A0], edx movsxd rdi, edi call _malloc movsxd rdx, dword ptr [rsp+0A8h+var_A0] movsxd rsi, ebx add rsi, r13 mov rdi, rax mov r14, rax mov [rsp+0A8h+var_A0], rdx call _strncpy mov rdx, [rsp+0A8h+var_A0] lea rsi, ds:8[rbp*8] mov rdi, r12 mov byte ptr [r14+rdx], 0 call _realloc movsxd r8, r15d mov [rax+rbp*8], r14 mov r12, rax add r13, r8 add rbp, 1 loc_158B: mov rcx, [rsp+0A8h+var_90] mov rdi, [rsp+0A8h+var_98] xor r8d, r8d mov rsi, r13 mov edx, 1 call _regexec cmp eax, 1 jnz loc_1520 mov rdi, [rsp+0A8h+var_98] call _regfree mov edx, ebp mov rax, [rsp+0A8h+var_40] sub rax, fs:28h jnz short loc_1634 add rsp, 78h mov rax, r12 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_15DC: mov rdi, [rsp+0A8h+var_98] call _regfree mov edx, 13h mov esi, 1 mov rcx, cs:stderr@GLIBC_2_2_5 lea rdi, aRegexMatchFail; "Regex match failed\n" call _fwrite mov edi, 1 call _exit loc_160D: mov rcx, cs:stderr@GLIBC_2_2_5 mov edx, 18h mov esi, 1 lea rdi, aCouldNotCompil; "Could not compile regex\n" call _fwrite mov edi, 1 call _exit loc_1634: call ___stack_chk_fail
long long func0(long long a1) { long long v1; // r13 long long v2; // rbp long long v3; // r12 int i; // eax int v5; // r15d int v6; // ebx long long v7; // r14 long long v8; // rax int v10; // [rsp+8h] [rbp-A0h] _BYTE v11[64]; // [rsp+20h] [rbp-88h] BYREF int v12; // [rsp+60h] [rbp-48h] BYREF int v13; // [rsp+64h] [rbp-44h] unsigned long long v14; // [rsp+68h] [rbp-40h] v1 = a1; v14 = __readfsqword(0x28u); if ( (unsigned int)regcomp(v11, "[ae]\\w+", 1LL) ) { fwrite("Could not compile regex\n", 1LL, 24LL, stderr); exit(1LL); } v2 = 0LL; v3 = 0LL; for ( i = regexec(v11, a1, 1LL, &v12, 0LL); i != 1; i = regexec(v11, v1, 1LL, &v12, 0LL) ) { if ( i ) { regfree(v11); fwrite("Regex match failed\n", 1LL, 19LL, stderr); exit(1LL); } v5 = v13; v6 = v12; v10 = v13 - v12; v7 = malloc(v13 - v12 + 1); strncpy(v7, v1 + v6); *(_BYTE *)(v7 + v10) = 0; v8 = realloc(v3, 8 * v2 + 8); *(_QWORD *)(v8 + 8 * v2) = v7; v3 = v8; v1 += v5; ++v2; } regfree(v11); return v3; }
func0: ENDBR64 PUSH R15 MOV EDX,0x1 LEA RSI,[0x102004] PUSH R14 PUSH R13 MOV R13,RDI PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x78 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x68],RAX XOR EAX,EAX LEA RDI,[RSP + 0x20] MOV qword ptr [RSP + 0x10],RDI CALL 0x00101150 TEST EAX,EAX JNZ 0x0010160d LEA RAX,[RSP + 0x60] XOR EBP,EBP XOR R12D,R12D MOV qword ptr [RSP + 0x18],RAX JMP 0x0010158b LAB_00101520: TEST EAX,EAX JNZ 0x001015dc MOV R15D,dword ptr [RSP + 0x64] MOV EBX,dword ptr [RSP + 0x60] MOV EDX,R15D SUB EDX,EBX LEA EDI,[RDX + 0x1] MOV dword ptr [RSP + 0x8],EDX MOVSXD RDI,EDI CALL 0x00101170 MOVSXD RDX,dword ptr [RSP + 0x8] MOVSXD RSI,EBX ADD RSI,R13 MOV RDI,RAX MOV R14,RAX MOV qword ptr [RSP + 0x8],RDX CALL 0x00101110 MOV RDX,qword ptr [RSP + 0x8] LEA RSI,[0x8 + RBP*0x8] MOV RDI,R12 MOV byte ptr [R14 + RDX*0x1],0x0 CALL 0x00101190 MOVSXD R8,R15D MOV qword ptr [RAX + RBP*0x8],R14 MOV R12,RAX ADD R13,R8 ADD RBP,0x1 LAB_0010158b: MOV RCX,qword ptr [RSP + 0x18] MOV RDI,qword ptr [RSP + 0x10] XOR R8D,R8D MOV RSI,R13 MOV EDX,0x1 CALL 0x00101180 CMP EAX,0x1 JNZ 0x00101520 MOV RDI,qword ptr [RSP + 0x10] CALL 0x00101120 MOV EDX,EBP MOV RAX,qword ptr [RSP + 0x68] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101634 ADD RSP,0x78 MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001015dc: MOV RDI,qword ptr [RSP + 0x10] CALL 0x00101120 MOV EDX,0x13 MOV ESI,0x1 MOV RCX,qword ptr [0x00104020] LEA RDI,[0x102025] CALL 0x001011b0 MOV EDI,0x1 CALL 0x001011a0 LAB_0010160d: MOV RCX,qword ptr [0x00104020] MOV EDX,0x18 MOV ESI,0x1 LEA RDI,[0x10200c] CALL 0x001011b0 MOV EDI,0x1 CALL 0x001011a0 LAB_00101634: CALL 0x00101130
void * func0(char *param_1) { regoff_t rVar1; regoff_t rVar2; int iVar3; char *__dest; void *__ptr; long lVar4; long in_FS_OFFSET; regex_t local_88; regmatch_t local_48; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); iVar3 = regcomp(&local_88,"[ae]\\w+",1); if (iVar3 != 0) { fwrite("Could not compile regex\n",1,0x18,stderr); /* WARNING: Subroutine does not return */ exit(1); } lVar4 = 0; __ptr = (void *)0x0; while( true ) { iVar3 = regexec(&local_88,param_1,1,&local_48,0); rVar2 = local_48.rm_eo; rVar1 = local_48.rm_so; if (iVar3 == 1) break; if (iVar3 != 0) { regfree(&local_88); fwrite("Regex match failed\n",1,0x13,stderr); /* WARNING: Subroutine does not return */ exit(1); } iVar3 = local_48.rm_eo - local_48.rm_so; __dest = (char *)malloc((long)(iVar3 + 1)); strncpy(__dest,param_1 + rVar1,(long)iVar3); __dest[iVar3] = '\0'; __ptr = realloc(__ptr,lVar4 * 8 + 8); *(char **)((long)__ptr + lVar4 * 8) = __dest; param_1 = param_1 + rVar2; lVar4 = lVar4 + 1; } regfree(&local_88); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return __ptr; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
4,911
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <regex.h> #include <assert.h> typedef struct { char **matches; int count; } MatchList;
MatchList func0(const char *text) { regex_t regex; regmatch_t pmatch[1]; const char *pattern = "[ae]\\w+"; int ret; MatchList list; list.matches = NULL; list.count = 0; ret = regcomp(&regex, pattern, REG_EXTENDED); if (ret) { fprintf(stderr, "Could not compile regex\n"); exit(1); } const char *p = text; while ((ret = regexec(&regex, p, 1, pmatch, 0)) != REG_NOMATCH) { if (ret) { regfree(&regex); fprintf(stderr, "Regex match failed\n"); exit(1); } int start = pmatch[0].rm_so; int end = pmatch[0].rm_eo; int len = end - start; char *match = (char *)malloc(len + 1); strncpy(match, p + start, len); match[len] = '\0'; list.matches = (char **)realloc(list.matches, sizeof(char *) * (list.count + 1)); list.matches[list.count] = match; list.count++; p += end; } regfree(&regex); return list; }
int main() { // Test case 1 MatchList result1 = func0("python programe"); assert(result1.count == 1); assert(strcmp(result1.matches[0], "ame") == 0); for(int i = 0; i < result1.count; i++) { free(result1.matches[i]); } free(result1.matches); // Test case 2 MatchList result2 = func0("python programe language"); assert(result2.count == 2); assert(strcmp(result2.matches[0], "ame") == 0); assert(strcmp(result2.matches[1], "anguage") == 0); for(int i = 0; i < result2.count; i++) { free(result2.matches[i]); } free(result2.matches); // Test case 3 MatchList result3 = func0("assert statement"); assert(result3.count == 2); assert(strcmp(result3.matches[0], "assert") == 0); assert(strcmp(result3.matches[1], "atement") == 0); for(int i = 0; i < result3.count; i++) { free(result3.matches[i]); } free(result3.matches); return 0; }
O3
c
func0: endbr64 push %r15 mov $0x1,%edx lea 0xb32(%rip),%rsi push %r14 push %r13 mov %rdi,%r13 push %r12 push %rbp push %rbx sub $0x78,%rsp mov %fs:0x28,%rax mov %rax,0x68(%rsp) xor %eax,%eax lea 0x20(%rsp),%rdi mov %rdi,0x10(%rsp) callq 1140 <regcomp@plt> test %eax,%eax jne 1611 <func0+0x151> lea 0x60(%rsp),%rax xor %ebp,%ebp xor %r12d,%r12d mov %rax,0x18(%rsp) jmp 158f <func0+0xcf> nopl 0x0(%rax) test %eax,%eax jne 15e0 <func0+0x120> mov 0x64(%rsp),%r15d mov 0x60(%rsp),%ebx add $0x1,%rbp mov %r15d,%edx sub %ebx,%edx lea 0x1(%rdx),%edi mov %edx,0x8(%rsp) movslq %edi,%rdi callq 1150 <malloc@plt> movslq 0x8(%rsp),%rdx movslq %ebx,%rsi lea 0x0(,%rbp,8),%rbx add %r13,%rsi mov %rax,%rdi mov %rax,%r14 mov %rdx,0x8(%rsp) callq 1100 <strncpy@plt> mov 0x8(%rsp),%rdx mov %r12,%rdi mov %rbx,%rsi movb $0x0,(%r14,%rdx,1) callq 1170 <realloc@plt> movslq %r15d,%r8 mov %r14,-0x8(%rax,%rbx,1) mov %rax,%r12 add %r8,%r13 mov 0x18(%rsp),%rcx mov 0x10(%rsp),%rdi xor %r8d,%r8d mov %r13,%rsi mov $0x1,%edx callq 1160 <regexec@plt> cmp $0x1,%eax jne 1520 <func0+0x60> mov 0x10(%rsp),%rdi callq 1110 <regfree@plt> mov %ebp,%edx mov 0x68(%rsp),%rax xor %fs:0x28,%rax jne 1638 <func0+0x178> add $0x78,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq mov 0x10(%rsp),%rdi callq 1110 <regfree@plt> mov $0x13,%edx mov $0x1,%esi mov 0x2a25(%rip),%rcx lea 0xa23(%rip),%rdi callq 1190 <fwrite@plt> mov $0x1,%edi callq 1180 <exit@plt> mov 0x2a08(%rip),%rcx mov $0x18,%edx mov $0x1,%esi lea 0x9e3(%rip),%rdi callq 1190 <fwrite@plt> mov $0x1,%edi callq 1180 <exit@plt> callq 1120 <__stack_chk_fail@plt> nopl (%rax)
func0: endbr64 push r15 mov edx, 1; cflags lea rsi, pattern; "[ae]\\w+" push r14 push r13 push r12 mov r12, rdi push rbp push rbx sub rsp, 78h mov rax, fs:28h mov [rsp+0A8h+var_40], rax xor eax, eax lea rdi, [rsp+0A8h+preg]; preg mov [rsp+0A8h+var_98], rdi call _regcomp test eax, eax jnz loc_1614 lea rax, [rsp+0A8h+var_48] xor r13d, r13d xor ebp, ebp mov [rsp+0A8h+pmatch], rax jmp short loc_1591 loc_1520: test eax, eax jnz loc_15E3 mov r15d, [rsp+0A8h+var_44] mov esi, [rsp+0A8h+var_48] mov r14d, r15d mov [rsp+0A8h+var_9C], esi sub r14d, esi lea ecx, [r14+1] movsxd r14, r14d movsxd rcx, ecx mov rdi, rcx; size mov [rsp+0A8h+var_A8], rcx call _malloc movsxd rsi, [rsp+0A8h+var_9C] mov rcx, [rsp+0A8h+var_A8] mov rdx, r14 mov rbx, rax mov rdi, rax add rsi, r12 call ___strncpy_chk mov byte ptr [rbx+r14], 0 lea rsi, ds:8[r13*8]; size mov rdi, rbp; ptr call _realloc movsxd r8, r15d mov [rax+r13*8], rbx mov rbp, rax add r12, r8 add r13, 1 loc_1591: mov rcx, [rsp+0A8h+pmatch]; pmatch mov rdi, [rsp+0A8h+var_98]; preg xor r8d, r8d; eflags mov rsi, r12; string mov edx, 1; nmatch call _regexec cmp eax, 1 jnz loc_1520 mov rdi, [rsp+0A8h+var_98]; preg call _regfree mov edx, r13d mov rax, [rsp+0A8h+var_40] sub rax, fs:28h jnz short loc_163B add rsp, 78h mov rax, rbp pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_15E3: mov rdi, [rsp+0A8h+var_98]; preg call _regfree mov edx, 13h; n mov esi, 1; size mov rcx, cs:__bss_start; s lea rdi, aRegexMatchFail; "Regex match failed\n" call _fwrite mov edi, 1; status call _exit loc_1614: mov rcx, cs:__bss_start; s mov edx, 18h; n mov esi, 1; size lea rdi, aCouldNotCompil; "Could not compile regex\n" call _fwrite mov edi, 1; status call _exit loc_163B: call ___stack_chk_fail
void * func0(char *string) { const char *v1; // r12 long long v2; // r13 void *v3; // rbp int i; // eax regoff_t rm_eo; // r15d long long v6; // r14 _BYTE *v7; // rbx _QWORD *v8; // rax size_t v10; // [rsp+0h] [rbp-A8h] regoff_t rm_so; // [rsp+Ch] [rbp-9Ch] regex_t preg; // [rsp+20h] [rbp-88h] BYREF regmatch_t v13[9]; // [rsp+60h] [rbp-48h] BYREF v1 = string; v13[1] = (regmatch_t)__readfsqword(0x28u); if ( regcomp(&preg, "[ae]\\w+", 1) ) { fwrite("Could not compile regex\n", 1uLL, 0x18uLL, _bss_start); exit(1); } v2 = 0LL; v3 = 0LL; for ( i = regexec(&preg, string, 1uLL, v13, 0); i != 1; i = regexec(&preg, v1, 1uLL, v13, 0) ) { if ( i ) { regfree(&preg); fwrite("Regex match failed\n", 1uLL, 0x13uLL, _bss_start); exit(1); } rm_eo = v13[0].rm_eo; rm_so = v13[0].rm_so; v6 = v13[0].rm_eo - v13[0].rm_so; v10 = v13[0].rm_eo - v13[0].rm_so + 1; v7 = malloc(v10); __strncpy_chk(v7, &v1[rm_so], v6, v10); v7[v6] = 0; v8 = realloc(v3, 8 * v2 + 8); v8[v2] = v7; v3 = v8; v1 += rm_eo; ++v2; } regfree(&preg); return v3; }
func0: ENDBR64 PUSH R15 MOV EDX,0x1 LEA RSI,[0x102004] PUSH R14 PUSH R13 PUSH R12 MOV R12,RDI PUSH RBP PUSH RBX SUB RSP,0x78 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x68],RAX XOR EAX,EAX LEA RDI,[RSP + 0x20] MOV qword ptr [RSP + 0x10],RDI CALL 0x00101140 TEST EAX,EAX JNZ 0x00101614 LEA RAX,[RSP + 0x60] XOR R13D,R13D XOR EBP,EBP MOV qword ptr [RSP + 0x18],RAX JMP 0x00101591 LAB_00101520: TEST EAX,EAX JNZ 0x001015e3 MOV R15D,dword ptr [RSP + 0x64] MOV ESI,dword ptr [RSP + 0x60] MOV R14D,R15D MOV dword ptr [RSP + 0xc],ESI SUB R14D,ESI LEA ECX,[R14 + 0x1] MOVSXD R14,R14D MOVSXD RCX,ECX MOV RDI,RCX MOV qword ptr [RSP],RCX CALL 0x00101160 MOVSXD RSI,dword ptr [RSP + 0xc] MOV RCX,qword ptr [RSP] MOV RDX,R14 MOV RBX,RAX MOV RDI,RAX ADD RSI,R12 CALL 0x00101180 MOV byte ptr [RBX + R14*0x1],0x0 LEA RSI,[0x8 + R13*0x8] MOV RDI,RBP CALL 0x00101190 MOVSXD R8,R15D MOV qword ptr [RAX + R13*0x8],RBX MOV RBP,RAX ADD R12,R8 ADD R13,0x1 LAB_00101591: MOV RCX,qword ptr [RSP + 0x18] MOV RDI,qword ptr [RSP + 0x10] XOR R8D,R8D MOV RSI,R12 MOV EDX,0x1 CALL 0x00101170 CMP EAX,0x1 JNZ 0x00101520 MOV RDI,qword ptr [RSP + 0x10] CALL 0x00101110 MOV EDX,R13D MOV RAX,qword ptr [RSP + 0x68] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010163b ADD RSP,0x78 MOV RAX,RBP POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001015e3: MOV RDI,qword ptr [RSP + 0x10] CALL 0x00101110 MOV EDX,0x13 MOV ESI,0x1 MOV RCX,qword ptr [0x00104020] LEA RDI,[0x102025] CALL 0x001011b0 MOV EDI,0x1 CALL 0x001011a0 LAB_00101614: MOV RCX,qword ptr [0x00104020] MOV EDX,0x18 MOV ESI,0x1 LEA RDI,[0x10200c] CALL 0x001011b0 MOV EDI,0x1 CALL 0x001011a0 LAB_0010163b: CALL 0x00101120
void * func0(char *param_1) { regoff_t rVar1; regoff_t rVar2; int iVar3; void *pvVar4; void *__ptr; long lVar5; long in_FS_OFFSET; regex_t local_88; regmatch_t local_48; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); iVar3 = regcomp(&local_88,"[ae]\\w+",1); if (iVar3 != 0) { fwrite("Could not compile regex\n",1,0x18,stderr); /* WARNING: Subroutine does not return */ exit(1); } lVar5 = 0; __ptr = (void *)0x0; while( true ) { iVar3 = regexec(&local_88,param_1,1,&local_48,0); rVar2 = local_48.rm_eo; rVar1 = local_48.rm_so; if (iVar3 == 1) break; if (iVar3 != 0) { regfree(&local_88); fwrite("Regex match failed\n",1,0x13,stderr); /* WARNING: Subroutine does not return */ exit(1); } iVar3 = local_48.rm_eo - local_48.rm_so; pvVar4 = malloc((long)(iVar3 + 1)); __strncpy_chk(pvVar4,param_1 + rVar1,(long)iVar3,(long)(iVar3 + 1)); *(int *)((long)pvVar4 + (long)iVar3) = 0; __ptr = realloc(__ptr,lVar5 * 8 + 8); *(void **)((long)__ptr + lVar5 * 8) = pvVar4; param_1 = param_1 + rVar2; lVar5 = lVar5 + 1; } regfree(&local_88); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return __ptr; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
4,912
func0
#include <stdio.h> #include <string.h> #include <assert.h>
void func0(char *l[], int arr_size, int len, char *result[], int res_len){ if (len == 0){ for (int i = 0; i < res_len; i++) { printf("%s ", result[i]); } printf("\n"); return; } for (int i = 0; i < arr_size; i++){ if (res_len == 0 || strcmp(l[i], result[res_len - 1]) >= 0) { result[res_len] = l[i]; func0(l, arr_size, len - 1, result, res_len + 1); } } }
int main() { char *colors[] = {"Red", "Green", "Blue"}; int colors_size = 3; char *result1[1]; char *result2[2]; char *result3[3]; printf("Combination with 1 color:\n"); func0(colors, colors_size, 1, result1, 0); printf("Combination with 2 colors:\n"); func0(colors, colors_size, 2, result2, 0); printf("Combination with 3 colors:\n"); func0(colors, colors_size, 3, result3, 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %edx,-0x20(%rbp) mov %rcx,-0x28(%rbp) mov %r8d,-0x2c(%rbp) cmpl $0x0,-0x20(%rbp) jne 123c <func0+0x73> movl $0x0,-0x8(%rbp) jmp 1225 <func0+0x5c> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov %rax,%rsi lea 0xded(%rip),%rdi mov $0x0,%eax callq 10c0 <printf@plt> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x2c(%rbp),%eax jl 11f6 <func0+0x2d> mov $0xa,%edi callq 1090 <putchar@plt> jmpq 12f1 <func0+0x128> movl $0x0,-0x4(%rbp) jmpq 12e5 <func0+0x11c> cmpl $0x0,-0x2c(%rbp) je 128b <func0+0xc2> mov -0x2c(%rbp),%eax cltq shl $0x3,%rax lea -0x8(%rax),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%rdx mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%rax mov %rdx,%rsi mov %rax,%rdi callq 10d0 <strcmp@plt> test %eax,%eax js 12e1 <func0+0x118> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0x2c(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,8),%rcx mov -0x28(%rbp),%rdx add %rcx,%rdx mov (%rax),%rax mov %rax,(%rdx) mov -0x2c(%rbp),%eax lea 0x1(%rax),%ecx mov -0x20(%rbp),%eax lea -0x1(%rax),%edi mov -0x28(%rbp),%rdx mov -0x1c(%rbp),%esi mov -0x18(%rbp),%rax mov %ecx,%r8d mov %rdx,%rcx mov %edi,%edx mov %rax,%rdi callq 11c9 <func0> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1248 <func0+0x7f> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_20], edx mov [rbp+var_28], rcx mov [rbp+var_2C], r8d cmp [rbp+var_20], 0 jnz short loc_123F mov [rbp+var_8], 0 jmp short loc_1228 loc_11F6: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_28] add rax, rdx mov rax, [rax] mov rsi, rax lea rax, format; "%s " mov rdi, rax; format mov eax, 0 call _printf add [rbp+var_8], 1 loc_1228: mov eax, [rbp+var_8] cmp eax, [rbp+var_2C] jl short loc_11F6 mov edi, 0Ah; c call _putchar jmp locret_12F4 loc_123F: mov [rbp+var_4], 0 jmp loc_12E8 loc_124B: cmp [rbp+var_2C], 0 jz short loc_128E mov eax, [rbp+var_2C] cdqe shl rax, 3 lea rdx, [rax-8] mov rax, [rbp+var_28] add rax, rdx mov rdx, [rax] mov eax, [rbp+var_4] cdqe lea rcx, ds:0[rax*8] mov rax, [rbp+var_18] add rax, rcx mov rax, [rax] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax js short loc_12E4 loc_128E: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] add rax, rdx mov edx, [rbp+var_2C] movsxd rdx, edx lea rcx, ds:0[rdx*8] mov rdx, [rbp+var_28] add rdx, rcx mov rax, [rax] mov [rdx], rax mov eax, [rbp+var_2C] lea ecx, [rax+1] mov eax, [rbp+var_20] lea edi, [rax-1] mov rdx, [rbp+var_28] mov esi, [rbp+var_1C] mov rax, [rbp+var_18] mov r8d, ecx mov rcx, rdx mov edx, edi mov rdi, rax call func0 loc_12E4: add [rbp+var_4], 1 loc_12E8: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl loc_124B locret_12F4: leave retn
int func0(long long a1, int a2, int a3, long long a4, int a5) { int result; // eax int j; // [rsp+28h] [rbp-8h] int i; // [rsp+2Ch] [rbp-4h] if ( a3 ) { for ( i = 0; ; ++i ) { result = i; if ( i >= a2 ) break; if ( !a5 || strcmp(*(const char **)(8LL * i + a1), *(const char **)(8LL * a5 - 8 + a4)) >= 0 ) { *(_QWORD *)(8LL * a5 + a4) = *(_QWORD *)(8LL * i + a1); func0(a1, (unsigned int)a2, (unsigned int)(a3 - 1), a4, (unsigned int)(a5 + 1)); } } } else { for ( j = 0; j < a5; ++j ) printf("%s ", *(const char **)(8LL * j + a4)); return putchar(10); } return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x20],EDX MOV qword ptr [RBP + -0x28],RCX MOV dword ptr [RBP + -0x2c],R8D CMP dword ptr [RBP + -0x20],0x0 JNZ 0x0010123f MOV dword ptr [RBP + -0x8],0x0 JMP 0x00101228 LAB_001011f6: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV RSI,RAX LEA RAX,[0x102004] MOV RDI,RAX MOV EAX,0x0 CALL 0x001010c0 ADD dword ptr [RBP + -0x8],0x1 LAB_00101228: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x2c] JL 0x001011f6 MOV EDI,0xa CALL 0x00101090 JMP 0x001012f4 LAB_0010123f: MOV dword ptr [RBP + -0x4],0x0 JMP 0x001012e8 LAB_0010124b: CMP dword ptr [RBP + -0x2c],0x0 JZ 0x0010128e MOV EAX,dword ptr [RBP + -0x2c] CDQE SHL RAX,0x3 LEA RDX,[RAX + -0x8] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV RDX,qword ptr [RAX] MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RCX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV RSI,RDX MOV RDI,RAX CALL 0x001010d0 TEST EAX,EAX JS 0x001012e4 LAB_0010128e: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0x2c] MOVSXD RDX,EDX LEA RCX,[RDX*0x8] MOV RDX,qword ptr [RBP + -0x28] ADD RDX,RCX MOV RAX,qword ptr [RAX] MOV qword ptr [RDX],RAX MOV EAX,dword ptr [RBP + -0x2c] LEA ECX,[RAX + 0x1] MOV EAX,dword ptr [RBP + -0x20] LEA EDI,[RAX + -0x1] MOV RDX,qword ptr [RBP + -0x28] MOV ESI,dword ptr [RBP + -0x1c] MOV RAX,qword ptr [RBP + -0x18] MOV R8D,ECX MOV RCX,RDX MOV EDX,EDI MOV RDI,RAX CALL 0x001011c9 LAB_001012e4: ADD dword ptr [RBP + -0x4],0x1 LAB_001012e8: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x0010124b LAB_001012f4: LEAVE RET
void func0(long param_1,int param_2,int param_3,long param_4,int param_5) { int iVar1; int local_10; int local_c; if (param_3 == 0) { for (local_10 = 0; local_10 < param_5; local_10 = local_10 + 1) { printf("%s ",*(int8 *)(param_4 + (long)local_10 * 8)); } putchar(10); } else { for (local_c = 0; local_c < param_2; local_c = local_c + 1) { if (param_5 == 0) { LAB_0010128e: *(int8 *)(param_4 + (long)param_5 * 8) = *(int8 *)(param_1 + (long)local_c * 8); func0(param_1,param_2,param_3 + -1,param_4,param_5 + 1); } else { iVar1 = strcmp(*(char **)(param_1 + (long)local_c * 8), *(char **)(param_4 + (long)param_5 * 8 + -8)); if (-1 < iVar1) goto LAB_0010128e; } } } return; }
4,913
func0
#include <stdio.h> #include <string.h> #include <assert.h>
void func0(char *l[], int arr_size, int len, char *result[], int res_len){ if (len == 0){ for (int i = 0; i < res_len; i++) { printf("%s ", result[i]); } printf("\n"); return; } for (int i = 0; i < arr_size; i++){ if (res_len == 0 || strcmp(l[i], result[res_len - 1]) >= 0) { result[res_len] = l[i]; func0(l, arr_size, len - 1, result, res_len + 1); } } }
int main() { char *colors[] = {"Red", "Green", "Blue"}; int colors_size = 3; char *result1[1]; char *result2[2]; char *result3[3]; printf("Combination with 1 color:\n"); func0(colors, colors_size, 1, result1, 0); printf("Combination with 2 colors:\n"); func0(colors, colors_size, 2, result2, 0); printf("Combination with 3 colors:\n"); func0(colors, colors_size, 3, result3, 0); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x28,%rsp mov %rdi,(%rsp) mov %rcx,%r12 mov %r8d,%ebp test %edx,%edx je 1226 <func0+0x5d> mov %esi,%r13d mov %edx,%r14d test %esi,%esi jle 1266 <func0+0x9d> movslq %r8d,%rax shl $0x3,%rax lea -0x8(%rcx,%rax,1),%rsi mov %rsi,0x18(%rsp) add %rcx,%rax mov %rax,0x8(%rsp) mov (%rsp),%rcx mov %rcx,%rbx lea -0x1(%r13),%eax lea 0x8(%rcx,%rax,8),%r15 lea 0x1(%r8),%eax mov %eax,0x14(%rsp) jmp 12a1 <func0+0xd8> test %r8d,%r8d jle 125c <func0+0x93> mov %rcx,%rbx lea -0x1(%r8),%eax lea 0x8(%rcx,%rax,8),%r12 lea 0xdc6(%rip),%rbp mov (%rbx),%rdx mov %rbp,%rsi mov $0x1,%edi mov $0x0,%eax callq 10d0 <__printf_chk@plt> add $0x8,%rbx cmp %r12,%rbx jne 123e <func0+0x75> mov $0xa,%edi callq 1090 <putchar@plt> add $0x28,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq mov (%rbx),%rax mov 0x8(%rsp),%rcx mov %rax,(%rcx) lea -0x1(%r14),%edx mov 0x14(%rsp),%r8d mov %r12,%rcx mov %r13d,%esi mov (%rsp),%rdi callq 11c9 <func0> add $0x8,%rbx cmp %r15,%rbx je 1266 <func0+0x9d> test %ebp,%ebp je 1275 <func0+0xac> mov 0x18(%rsp),%rax mov (%rax),%rsi mov (%rbx),%rdi callq 10c0 <strcmp@plt> test %eax,%eax jns 1275 <func0+0xac> jmp 1298 <func0+0xcf>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 28h mov [rsp+58h+var_50], rdi mov [rsp+58h+var_58], rcx mov ebp, r8d test edx, edx jz short loc_1229 mov r12d, esi mov r13d, edx test esi, esi jle short loc_126D movsxd rax, r8d shl rax, 3 mov rcx, [rsp+58h+var_58] lea r15, [rcx+rax-8] add rax, rcx mov [rsp+58h+var_48], rax mov rsi, [rsp+58h+var_50] mov rbx, rsi lea eax, [r12-1] lea r14, [rsi+rax*8+8] lea eax, [r8+1] mov [rsp+58h+var_3C], eax jmp short loc_1285 loc_1229: test r8d, r8d jle short loc_1263 mov rcx, [rsp+58h+var_58] mov rbx, rcx lea eax, [r8-1] lea r12, [rcx+rax*8+8] lea rbp, unk_2004 loc_1245: mov rdx, [rbx] mov rsi, rbp mov edi, 1 mov eax, 0 call ___printf_chk add rbx, 8 cmp rbx, r12 jnz short loc_1245 loc_1263: mov edi, 0Ah call _putchar loc_126D: add rsp, 28h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_127C: add rbx, 8 cmp rbx, r14 jz short loc_126D loc_1285: test ebp, ebp jz short loc_1298 mov rsi, [r15] mov rdi, [rbx] call _strcmp test eax, eax js short loc_127C loc_1298: mov rax, [rbx] mov rcx, [rsp+58h+var_48] mov [rcx], rax lea edx, [r13-1] mov r8d, [rsp+58h+var_3C] mov rcx, [rsp+58h+var_58] mov esi, r12d mov rdi, [rsp+58h+var_50] call func0 jmp short loc_127C
void func0(_QWORD *a1, int a2, int a3, _QWORD *a4, int a5) { long long v7; // rax _QWORD *v8; // r15 _QWORD *v9; // rbx _QWORD *v10; // rbx long long v11; // r12 _QWORD *v13; // [rsp+10h] [rbp-48h] unsigned int v14; // [rsp+1Ch] [rbp-3Ch] if ( a3 ) { if ( a2 > 0 ) { v7 = a5; v8 = &a4[v7 - 1]; v13 = &a4[v7]; v9 = a1; v14 = a5 + 1; do { if ( !a5 || (int)strcmp(*v9, *v8) >= 0 ) { *v13 = *v9; func0(a1, (unsigned int)a2, (unsigned int)(a3 - 1), a4, v14); } ++v9; } while ( v9 != &a1[(unsigned int)(a2 - 1) + 1] ); } } else { if ( a5 > 0 ) { v10 = a4; v11 = (long long)&a4[(unsigned int)(a5 - 1) + 1]; do __printf_chk(1LL, &unk_2004, *v10++); while ( v10 != (_QWORD *)v11 ); } putchar(10LL); } }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x28 MOV qword ptr [RSP + 0x8],RDI MOV qword ptr [RSP],RCX MOV EBP,R8D TEST EDX,EDX JZ 0x00101229 MOV R12D,ESI MOV R13D,EDX TEST ESI,ESI JLE 0x0010126d MOVSXD RAX,R8D SHL RAX,0x3 MOV RCX,qword ptr [RSP] LEA R15,[RCX + RAX*0x1 + -0x8] ADD RAX,RCX MOV qword ptr [RSP + 0x10],RAX MOV RSI,qword ptr [RSP + 0x8] MOV RBX,RSI LEA EAX,[R12 + -0x1] LEA R14,[RSI + RAX*0x8 + 0x8] LEA EAX,[R8 + 0x1] MOV dword ptr [RSP + 0x1c],EAX JMP 0x00101285 LAB_00101229: TEST R8D,R8D JLE 0x00101263 MOV RCX,qword ptr [RSP] MOV RBX,RCX LEA EAX,[R8 + -0x1] LEA R12,[RCX + RAX*0x8 + 0x8] LEA RBP,[0x102004] LAB_00101245: MOV RDX,qword ptr [RBX] MOV RSI,RBP MOV EDI,0x1 MOV EAX,0x0 CALL 0x001010d0 ADD RBX,0x8 CMP RBX,R12 JNZ 0x00101245 LAB_00101263: MOV EDI,0xa CALL 0x00101090 LAB_0010126d: ADD RSP,0x28 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010127c: ADD RBX,0x8 CMP RBX,R14 JZ 0x0010126d LAB_00101285: TEST EBP,EBP JZ 0x00101298 MOV RSI,qword ptr [R15] MOV RDI,qword ptr [RBX] CALL 0x001010c0 TEST EAX,EAX JS 0x0010127c LAB_00101298: MOV RAX,qword ptr [RBX] MOV RCX,qword ptr [RSP + 0x10] MOV qword ptr [RCX],RAX LEA EDX,[R13 + -0x1] MOV R8D,dword ptr [RSP + 0x1c] MOV RCX,qword ptr [RSP] MOV ESI,R12D MOV RDI,qword ptr [RSP + 0x8] CALL 0x001011c9 JMP 0x0010127c
void func0(int8 *param_1,int param_2,int param_3,int8 *param_4,int param_5) { int iVar1; int8 *puVar2; if (param_3 == 0) { if (0 < param_5) { puVar2 = param_4 + (ulong)(param_5 - 1) + 1; do { __printf_chk(1,&DAT_00102004,*param_4); param_4 = param_4 + 1; } while (param_4 != puVar2); } putchar(10); } else if (0 < param_2) { puVar2 = param_1; do { if (param_5 == 0) { LAB_00101298: param_4[param_5] = *puVar2; func0(param_1,param_2,param_3 + -1,param_4,param_5 + 1); } else { iVar1 = strcmp((char *)*puVar2,(char *)param_4[(long)param_5 + -1]); if (-1 < iVar1) goto LAB_00101298; } puVar2 = puVar2 + 1; } while (puVar2 != param_1 + (ulong)(param_2 - 1) + 1); } return; }
4,914
func0
#include <stdio.h> #include <string.h> #include <assert.h>
void func0(char *l[], int arr_size, int len, char *result[], int res_len){ if (len == 0){ for (int i = 0; i < res_len; i++) { printf("%s ", result[i]); } printf("\n"); return; } for (int i = 0; i < arr_size; i++){ if (res_len == 0 || strcmp(l[i], result[res_len - 1]) >= 0) { result[res_len] = l[i]; func0(l, arr_size, len - 1, result, res_len + 1); } } }
int main() { char *colors[] = {"Red", "Green", "Blue"}; int colors_size = 3; char *result1[1]; char *result2[2]; char *result3[3]; printf("Combination with 1 color:\n"); func0(colors, colors_size, 1, result1, 0); printf("Combination with 2 colors:\n"); func0(colors, colors_size, 2, result2, 0); printf("Combination with 3 colors:\n"); func0(colors, colors_size, 3, result3, 0); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp mov %r8d,%ebp push %rbx mov %rcx,%rbx sub $0x38,%rsp test %edx,%edx je 1370 <func0+0xc0> mov %esi,%r12d test %esi,%esi jle 1361 <func0+0xb1> movslq %r8d,%rax mov %rdi,%r13 mov %edx,%r14d mov %rdi,%r15 shl $0x3,%rax lea -0x8(%rcx,%rax,1),%rcx add %rbx,%rax mov %rax,0x18(%rsp) lea -0x1(%rsi),%eax lea 0x8(%rdi,%rax,8),%rax mov %rcx,0x28(%rsp) mov %rax,0x10(%rsp) lea 0x1(%r8),%eax mov %eax,0x24(%rsp) mov (%r15),%rdx test %ebp,%ebp je 1337 <func0+0x87> mov 0x28(%rsp),%rax mov %rdx,%rdi mov %rdx,0x8(%rsp) mov (%rax),%rsi callq 10c0 <strcmp@plt> mov 0x8(%rsp),%rdx test %eax,%eax js 1356 <func0+0xa6> mov 0x18(%rsp),%rax mov 0x24(%rsp),%r8d mov %rbx,%rcx mov %r12d,%esi mov %r13,%rdi mov %rdx,(%rax) lea -0x1(%r14),%edx callq 12b0 <func0> add $0x8,%r15 cmp %r15,0x10(%rsp) jne 1312 <func0+0x62> add $0x38,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq test %r8d,%r8d jle 13a3 <func0+0xf3> lea -0x1(%r8),%eax lea 0xc84(%rip),%rbp lea 0x8(%rcx,%rax,8),%r12 nopl (%rax) mov (%rbx),%rdx mov %rbp,%rsi mov $0x1,%edi xor %eax,%eax add $0x8,%rbx callq 10d0 <__printf_chk@plt> cmp %r12,%rbx jne 1388 <func0+0xd8> add $0x38,%rsp mov $0xa,%edi pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 jmpq 1090 <putchar@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 test edx, edx jz short loc_12B0 jmp short func0_part_0 loc_12B0: test r8d, r8d jle short loc_1300 lea eax, [r8-1] push r12 lea r12, [rcx+rax*8+8] push rbp lea rbp, unk_2004 push rbx mov rbx, rcx nop dword ptr [rax+00h] loc_12D0: mov rdx, [rbx] mov rsi, rbp mov edi, 1 xor eax, eax add rbx, 8 call ___printf_chk cmp rbx, r12 jnz short loc_12D0 pop rbx mov edi, 0Ah pop rbp pop r12 jmp _putchar loc_1300: mov edi, 0Ah jmp _putchar
long long func0(long long a1, long long a2, int a3, long long *a4, int a5) { long long v6; // r12 long long *v7; // rbx long long v8; // rdx if ( a3 ) return func0_part_0(); if ( a5 > 0 ) { v6 = (long long)&a4[(unsigned int)(a5 - 1) + 1]; v7 = a4; do { v8 = *v7++; __printf_chk(1LL, &unk_2004, v8); } while ( v7 != (long long *)v6 ); } return putchar(10LL); }
func0: ENDBR64 TEST EDX,EDX JZ 0x001012b0 JMP 0x00101310 LAB_001012b0: TEST R8D,R8D JLE 0x00101300 LEA EAX,[R8 + -0x1] PUSH R12 LEA R12,[RCX + RAX*0x8 + 0x8] PUSH RBP LEA RBP,[0x102004] PUSH RBX MOV RBX,RCX NOP dword ptr [RAX] LAB_001012d0: MOV RDX,qword ptr [RBX] MOV RSI,RBP MOV EDI,0x1 XOR EAX,EAX ADD RBX,0x8 CALL 0x001010d0 CMP RBX,R12 JNZ 0x001012d0 POP RBX MOV EDI,0xa POP RBP POP R12 JMP 0x00101090 LAB_00101300: MOV EDI,0xa JMP 0x00101090
void func0(int8 param_1,int8 param_2,int param_3,int8 *param_4,int param_5) { int8 *puVar1; int8 uVar2; if (param_3 != 0) { func0_part_0(); return; } if (0 < param_5) { puVar1 = param_4 + (ulong)(param_5 - 1) + 1; do { uVar2 = *param_4; param_4 = param_4 + 1; __printf_chk(1,&DAT_00102004,uVar2); } while (param_4 != puVar1); putchar(10); return; } putchar(10); return; }
4,915
func0
#include <stdio.h> #include <string.h> #include <assert.h>
void func0(char *l[], int arr_size, int len, char *result[], int res_len){ if (len == 0){ for (int i = 0; i < res_len; i++) { printf("%s ", result[i]); } printf("\n"); return; } for (int i = 0; i < arr_size; i++){ if (res_len == 0 || strcmp(l[i], result[res_len - 1]) >= 0) { result[res_len] = l[i]; func0(l, arr_size, len - 1, result, res_len + 1); } } }
int main() { char *colors[] = {"Red", "Green", "Blue"}; int colors_size = 3; char *result1[1]; char *result2[2]; char *result3[3]; printf("Combination with 1 color:\n"); func0(colors, colors_size, 1, result1, 0); printf("Combination with 2 colors:\n"); func0(colors, colors_size, 2, result2, 0); printf("Combination with 3 colors:\n"); func0(colors, colors_size, 3, result3, 0); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx mov %rcx,%rbx sub $0x28,%rsp test %edx,%edx je 1490 <func0+0xc0> mov %esi,%r12d test %esi,%esi jle 1479 <func0+0xa9> movslq %r8d,%r15 mov %rdi,%r13 mov %edx,%r14d mov %rdi,%rbp shl $0x3,%r15 lea -0x8(%rcx,%r15,1),%rax mov %rax,0x8(%rsp) lea (%rcx,%r15,1),%rax mov %rax,(%rsp) test %r8d,%r8d je 14e0 <func0+0x110> lea -0x1(%rsi),%eax lea 0x8(%rdi,%rax,8),%rax mov %rax,0x10(%rsp) lea 0x1(%r8),%eax mov %eax,0x1c(%rsp) mov 0x8(%rsp),%rax mov 0x0(%rbp),%r15 mov (%rax),%rsi mov %r15,%rdi callq 10c0 <strcmp@plt> test %eax,%eax js 146e <func0+0x9e> mov (%rsp),%rax mov 0x1c(%rsp),%r8d lea -0x1(%r14),%edx mov %rbx,%rcx mov %r12d,%esi mov %r13,%rdi mov %r15,(%rax) callq 13d0 <func0> add $0x8,%rbp cmp 0x10(%rsp),%rbp jne 1438 <func0+0x68> add $0x28,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax,%rax,1) test %r8d,%r8d jle 14c3 <func0+0xf3> lea -0x1(%r8),%eax lea 0xb64(%rip),%rbp lea 0x8(%rcx,%rax,8),%r12 nopl (%rax) mov (%rbx),%rdx mov %rbp,%rsi mov $0x1,%edi xor %eax,%eax add $0x8,%rbx callq 10d0 <__printf_chk@plt> cmp %rbx,%r12 jne 14a8 <func0+0xd8> add $0x28,%rsp mov $0xa,%edi pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 jmpq 1090 <putchar@plt> nopl 0x0(%rax,%rax,1) lea -0x1(%rsi),%edx sub $0x1,%r14d lea 0x8(%rdi,%rdx,8),%r15 mov 0x0(%rbp),%rdx mov (%rsp),%rax mov %rbx,%rcx mov %r12d,%esi mov $0x1,%r8d mov %r13,%rdi add $0x8,%rbp mov %rdx,(%rax) mov %r14d,%edx callq 13d0 <func0> cmp %r15,%rbp jne 14ec <func0+0x11c> add $0x28,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw %cs:0x0(%rax,%rax,1)
func0_constprop_0: push r15 push r14 push r13 push r12 push rbp push rbx mov rbx, rdx sub rsp, 28h test esi, esi jz loc_1388 movsxd rax, ecx mov rbp, rdi mov r12d, esi shl rax, 3 lea rdi, [rdx+rax] mov [rsp+58h+var_50], rdi test ecx, ecx jz short loc_1340 lea r15, [rdx+rax-8] lea rax, [rbp+18h] mov r14, rbp mov [rsp+58h+var_48], rax lea eax, [rcx+1] mov [rsp+58h+var_3C], eax loc_12EB: mov r13, [r14] mov rsi, [r15]; s2 mov rdi, r13; s1 call _strcmp test eax, eax js short loc_1319 mov rax, [rsp+58h+var_50] mov ecx, [rsp+58h+var_3C] mov rdx, rbx mov rdi, rbp lea esi, [r12-1] mov [rax], r13 call func0_constprop_0 loc_1319: mov rax, [rsp+58h+var_48] add r14, 8 cmp r14, rax jnz short loc_12EB add rsp, 28h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1340: mov r14, rbp lea r15, [rbp+18h] sub r12d, 1 loc_134B: mov rax, [r14] mov rcx, [rsp+58h+var_50] mov rdx, rbx mov esi, r12d mov rdi, rbp add r14, 8 mov [rcx], rax mov ecx, 1 call func0_constprop_0 cmp r14, r15 jnz short loc_134B add rsp, 28h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1388: test ecx, ecx jle short loc_13BB movsxd rcx, ecx lea rbp, unk_2004 lea r12, [rdx+rcx*8] nop word ptr [rax+rax+00h] loc_13A0: mov rdx, [rbx] mov rsi, rbp mov edi, 2 xor eax, eax add rbx, 8 call ___printf_chk cmp r12, rbx jnz short loc_13A0 loc_13BB: add rsp, 28h mov edi, 0Ah; c pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 jmp _putchar
int func0_constprop_0(const char **a1, int a2, long long *a3, int a4) { long long *v4; // rbx long long v5; // rax const char **v6; // r15 const char **v7; // r14 const char *v8; // r13 int result; // eax const char **v10; // r14 const char *v11; // rax long long *v12; // r12 long long v13; // rdx const char **v14; // [rsp+8h] [rbp-50h] unsigned int v15; // [rsp+1Ch] [rbp-3Ch] v4 = a3; if ( a2 ) { v5 = a4; v14 = (const char **)&a3[v5]; if ( a4 ) { v6 = (const char **)&a3[v5 - 1]; v7 = a1; v15 = a4 + 1; do { v8 = *v7; if ( strcmp(*v7, *v6) >= 0 ) { *v14 = v8; func0_constprop_0(a1, (unsigned int)(a2 - 1), v4, v15); } result = (_DWORD)a1 + 24; ++v7; } while ( v7 != a1 + 3 ); } else { v10 = a1; do { v11 = *v10++; *v14 = v11; result = func0_constprop_0(a1, (unsigned int)(a2 - 1), v4, 1LL); } while ( v10 != a1 + 3 ); } } else { if ( a4 > 0 ) { v12 = &a3[a4]; do { v13 = *v4++; __printf_chk(2LL, &unk_2004, v13); } while ( v12 != v4 ); } return putchar(10); } return result; }
func0.constprop.0: PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RDX SUB RSP,0x28 TEST ESI,ESI JZ 0x00101388 MOVSXD RAX,ECX MOV RBP,RDI MOV R12D,ESI SHL RAX,0x3 LEA RDI,[RDX + RAX*0x1] MOV qword ptr [RSP + 0x8],RDI TEST ECX,ECX JZ 0x00101340 LEA R15,[RDX + RAX*0x1 + -0x8] LEA RAX,[RBP + 0x18] MOV R14,RBP MOV qword ptr [RSP + 0x10],RAX LEA EAX,[RCX + 0x1] MOV dword ptr [RSP + 0x1c],EAX LAB_001012eb: MOV R13,qword ptr [R14] MOV RSI,qword ptr [R15] MOV RDI,R13 CALL 0x001010c0 TEST EAX,EAX JS 0x00101319 MOV RAX,qword ptr [RSP + 0x8] MOV ECX,dword ptr [RSP + 0x1c] MOV RDX,RBX MOV RDI,RBP LEA ESI,[R12 + -0x1] MOV qword ptr [RAX],R13 CALL 0x001012a0 LAB_00101319: MOV RAX,qword ptr [RSP + 0x10] ADD R14,0x8 CMP R14,RAX JNZ 0x001012eb ADD RSP,0x28 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101340: MOV R14,RBP LEA R15,[RBP + 0x18] SUB R12D,0x1 LAB_0010134b: MOV RAX,qword ptr [R14] MOV RCX,qword ptr [RSP + 0x8] MOV RDX,RBX MOV ESI,R12D MOV RDI,RBP ADD R14,0x8 MOV qword ptr [RCX],RAX MOV ECX,0x1 CALL 0x001012a0 CMP R14,R15 JNZ 0x0010134b ADD RSP,0x28 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101388: TEST ECX,ECX JLE 0x001013bb MOVSXD RCX,ECX LEA RBP,[0x102004] LEA R12,[RDX + RCX*0x8] NOP word ptr [RAX + RAX*0x1] LAB_001013a0: MOV RDX,qword ptr [RBX] MOV RSI,RBP MOV EDI,0x2 XOR EAX,EAX ADD RBX,0x8 CALL 0x001010d0 CMP R12,RBX JNZ 0x001013a0 LAB_001013bb: ADD RSP,0x28 MOV EDI,0xa POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 JMP 0x00101090
void func0_constprop_0(int8 *param_1,int param_2,int8 *param_3,int param_4) { char *__s1; int8 uVar1; int iVar2; int8 *puVar3; if (param_2 == 0) { if (0 < param_4) { puVar3 = param_3 + param_4; do { uVar1 = *param_3; param_3 = param_3 + 1; __printf_chk(2,&DAT_00102004,uVar1); } while (puVar3 != param_3); } putchar(10); return; } if (param_4 != 0) { puVar3 = param_1; do { __s1 = (char *)*puVar3; iVar2 = strcmp(__s1,(char *)param_3[(long)param_4 + -1]); if (-1 < iVar2) { param_3[param_4] = __s1; func0_constprop_0(param_1,param_2 + -1,param_3,param_4 + 1); } puVar3 = puVar3 + 1; } while (puVar3 != param_1 + 3); return; } puVar3 = param_1; do { uVar1 = *puVar3; puVar3 = puVar3 + 1; param_3[param_4] = uVar1; func0_constprop_0(param_1,param_2 + -1,param_3,1); } while (puVar3 != param_1 + 3); return; }
4,916
func0
#include <assert.h>
int func0(int n) { int ctr = 0; for (int num = 0; num < n; num++) { if (num <= 1) { continue; } int isPrime = 1; for (int i = 2; i < num; i++) { if (num % i == 0) { isPrime = 0; break; } } if (isPrime) { ctr++; } } return ctr; }
int main() { assert(func0(5) == 2); assert(func0(10) == 4); assert(func0(100) == 25); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) movl $0x0,-0x10(%rbp) movl $0x0,-0xc(%rbp) jmp 11ad <func0+0x64> cmpl $0x1,-0xc(%rbp) jle 11a8 <func0+0x5f> movl $0x1,-0x8(%rbp) movl $0x2,-0x4(%rbp) jmp 1194 <func0+0x4b> mov -0xc(%rbp),%eax cltd idivl -0x4(%rbp) mov %edx,%eax test %eax,%eax jne 1190 <func0+0x47> movl $0x0,-0x8(%rbp) jmp 119c <func0+0x53> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0xc(%rbp),%eax jl 117a <func0+0x31> cmpl $0x0,-0x8(%rbp) je 11a9 <func0+0x60> addl $0x1,-0x10(%rbp) jmp 11a9 <func0+0x60> addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x14(%rbp),%eax jl 1164 <func0+0x1b> mov -0x10(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_10], 0 mov [rbp+var_C], 0 jmp short loc_11AD loc_1164: cmp [rbp+var_C], 1 jle short loc_11A8 mov [rbp+var_8], 1 mov [rbp+var_4], 2 jmp short loc_1194 loc_117A: mov eax, [rbp+var_C] cdq idiv [rbp+var_4] mov eax, edx test eax, eax jnz short loc_1190 mov [rbp+var_8], 0 jmp short loc_119C loc_1190: add [rbp+var_4], 1 loc_1194: mov eax, [rbp+var_4] cmp eax, [rbp+var_C] jl short loc_117A loc_119C: cmp [rbp+var_8], 0 jz short loc_11A9 add [rbp+var_10], 1 jmp short loc_11A9 loc_11A8: nop loc_11A9: add [rbp+var_C], 1 loc_11AD: mov eax, [rbp+var_C] cmp eax, [rbp+var_14] jl short loc_1164 mov eax, [rbp+var_10] pop rbp retn
long long func0(int a1) { unsigned int v2; // [rsp+4h] [rbp-10h] int i; // [rsp+8h] [rbp-Ch] int v4; // [rsp+Ch] [rbp-8h] int j; // [rsp+10h] [rbp-4h] v2 = 0; for ( i = 0; i < a1; ++i ) { if ( i > 1 ) { v4 = 1; for ( j = 2; j < i; ++j ) { if ( !(i % j) ) { v4 = 0; break; } } if ( v4 ) ++v2; } } return v2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x10],0x0 MOV dword ptr [RBP + -0xc],0x0 JMP 0x001011ad LAB_00101164: CMP dword ptr [RBP + -0xc],0x1 JLE 0x001011a8 MOV dword ptr [RBP + -0x8],0x1 MOV dword ptr [RBP + -0x4],0x2 JMP 0x00101194 LAB_0010117a: MOV EAX,dword ptr [RBP + -0xc] CDQ IDIV dword ptr [RBP + -0x4] MOV EAX,EDX TEST EAX,EAX JNZ 0x00101190 MOV dword ptr [RBP + -0x8],0x0 JMP 0x0010119c LAB_00101190: ADD dword ptr [RBP + -0x4],0x1 LAB_00101194: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0xc] JL 0x0010117a LAB_0010119c: CMP dword ptr [RBP + -0x8],0x0 JZ 0x001011a9 ADD dword ptr [RBP + -0x10],0x1 JMP 0x001011a9 LAB_001011a8: NOP LAB_001011a9: ADD dword ptr [RBP + -0xc],0x1 LAB_001011ad: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x14] JL 0x00101164 MOV EAX,dword ptr [RBP + -0x10] POP RBP RET
int func0(int param_1) { bool bVar1; int4 local_18; int4 local_14; int4 local_c; local_18 = 0; local_14 = 0; do { if (param_1 <= local_14) { return local_18; } if (1 < local_14) { bVar1 = true; for (local_c = 2; local_c < local_14; local_c = local_c + 1) { if (local_14 % local_c == 0) { bVar1 = false; break; } } if (bVar1) { local_18 = local_18 + 1; } } local_14 = local_14 + 1; } while( true ); }
4,917
func0
#include <assert.h>
int func0(int n) { int ctr = 0; for (int num = 0; num < n; num++) { if (num <= 1) { continue; } int isPrime = 1; for (int i = 2; i < num; i++) { if (num % i == 0) { isPrime = 0; break; } } if (isPrime) { ctr++; } } return ctr; }
int main() { assert(func0(5) == 2); assert(func0(10) == 4); assert(func0(100) == 25); return 0; }
O1
c
func0: endbr64 mov $0x0,%r8d mov $0x0,%r9d test %edi,%edi jg 1168 <func0+0x1f> mov %r9d,%eax retq add $0x1,%r9d mov %esi,%r8d lea 0x1(%r8),%esi cmp %esi,%edi je 115d <func0+0x14> cmp $0x1,%esi jle 1165 <func0+0x1c> cmp $0x2,%esi jle 1161 <func0+0x18> test $0x1,%sil je 1165 <func0+0x1c> mov $0x2,%ecx mov %ecx,%eax add $0x1,%ecx cmp %eax,%r8d je 1161 <func0+0x18> mov %esi,%eax cltd idiv %ecx test %edx,%edx jne 1185 <func0+0x3c> jmp 1165 <func0+0x1c>
func0: endbr64 mov r8d, 0 mov r9d, 0 test edi, edi jg short loc_1168 loc_115D: mov eax, r9d retn loc_1161: add r9d, 1 loc_1165: mov r8d, esi loc_1168: lea esi, [r8+1] cmp edi, esi jz short loc_115D cmp esi, 1 jle short loc_1165 cmp esi, 2 jle short loc_1161 test sil, 1 jz short loc_1165 mov ecx, 2 loc_1185: mov eax, ecx add ecx, 1 cmp r8d, eax jz short loc_1161 mov eax, esi cdq idiv ecx test edx, edx jnz short loc_1185 jmp short loc_1165
long long func0(int a1) { int v1; // r8d unsigned int v2; // r9d int v4; // esi int v5; // ecx int v6; // eax v1 = 0; v2 = 0; if ( a1 > 0 ) { while ( 1 ) { v4 = v1 + 1; if ( a1 == v1 + 1 ) return v2; if ( v4 > 1 ) { if ( v4 <= 2 ) goto LABEL_3; if ( (v4 & 1) != 0 ) break; } LABEL_4: ++v1; } v5 = 2; while ( 1 ) { v6 = v5++; if ( v1 == v6 ) break; if ( !(v4 % v5) ) goto LABEL_4; } LABEL_3: ++v2; goto LABEL_4; } return v2; }
func0: ENDBR64 MOV R8D,0x0 MOV R9D,0x0 TEST EDI,EDI JG 0x00101168 LAB_0010115d: MOV EAX,R9D RET LAB_00101161: ADD R9D,0x1 LAB_00101165: MOV R8D,ESI LAB_00101168: LEA ESI,[R8 + 0x1] CMP EDI,ESI JZ 0x0010115d CMP ESI,0x1 JLE 0x00101165 CMP ESI,0x2 JLE 0x00101161 TEST SIL,0x1 JZ 0x00101165 MOV ECX,0x2 LAB_00101185: MOV EAX,ECX ADD ECX,0x1 CMP R8D,EAX JZ 0x00101161 MOV EAX,ESI CDQ IDIV ECX TEST EDX,EDX JNZ 0x00101185 JMP 0x00101165
int func0(uint param_1) { uint uVar1; uint uVar2; uint uVar3; uint uVar4; int iVar5; iVar5 = 0; uVar3 = 0; if (0 < (int)param_1) { while (uVar4 = uVar3, uVar3 = uVar4 + 1, param_1 != uVar3) { if (1 < (int)uVar3) { if ((int)uVar3 < 3) { LAB_00101161: iVar5 = iVar5 + 1; } else if ((uVar3 & 1) != 0) { uVar1 = 2; do { uVar2 = uVar1 + 1; if (uVar4 == uVar1) goto LAB_00101161; uVar1 = uVar2; } while ((int)uVar3 % (int)uVar2 != 0); } } } } return iVar5; }
4,918
func0
#include <assert.h>
int func0(int n) { int ctr = 0; for (int num = 0; num < n; num++) { if (num <= 1) { continue; } int isPrime = 1; for (int i = 2; i < num; i++) { if (num % i == 0) { isPrime = 0; break; } } if (isPrime) { ctr++; } } return ctr; }
int main() { assert(func0(5) == 2); assert(func0(10) == 4); assert(func0(100) == 25); return 0; }
O2
c
func0: endbr64 xor %r8d,%r8d xor %r9d,%r9d test %edi,%edi jle 12a2 <func0+0x62> lea 0x1(%r8),%esi cmp %esi,%edi je 12a2 <func0+0x62> nopw %cs:0x0(%rax,%rax,1) cmp $0x1,%esi jle 1297 <func0+0x57> cmp $0x2,%esi je 1293 <func0+0x53> test $0x1,%sil je 1297 <func0+0x57> mov $0x2,%ecx jmp 1289 <func0+0x49> nopw 0x0(%rax,%rax,1) mov %esi,%eax cltd idiv %ecx test %edx,%edx je 1297 <func0+0x57> mov %ecx,%eax add $0x1,%ecx cmp %r8d,%eax jne 1280 <func0+0x40> add $0x1,%r9d mov %esi,%r8d lea 0x1(%r8),%esi cmp %esi,%edi jne 1260 <func0+0x20> mov %r9d,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 xor r8d, r8d xor r9d, r9d test edi, edi jle short loc_1252 lea esi, [r8+1] cmp edi, esi jz short loc_1252 nop word ptr [rax+rax+00000000h] loc_1210: cmp esi, 1 jle short loc_1247 cmp esi, 2 jz short loc_1243 test sil, 1 jz short loc_1247 mov ecx, 2 jmp short loc_1239 loc_1230: mov eax, esi cdq idiv ecx test edx, edx jz short loc_1247 loc_1239: mov eax, ecx add ecx, 1 cmp eax, r8d jnz short loc_1230 loc_1243: add r9d, 1 loc_1247: mov r8d, esi lea esi, [r8+1] cmp edi, esi jnz short loc_1210 loc_1252: mov eax, r9d retn
long long func0(int a1) { int v1; // r8d unsigned int v2; // r9d int v3; // esi int v4; // ecx int v5; // eax v1 = 0; v2 = 0; if ( a1 > 0 ) { v3 = 1; if ( a1 != 1 ) { while ( 1 ) { if ( v3 > 1 ) { if ( v3 == 2 ) goto LABEL_9; if ( (v3 & 1) != 0 ) break; } LABEL_10: v1 = v3++; if ( a1 == v3 ) return v2; } v4 = 2; while ( 1 ) { v5 = v4++; if ( v5 == v1 ) break; if ( !(v3 % v4) ) goto LABEL_10; } LABEL_9: ++v2; goto LABEL_10; } } return v2; }
func0: ENDBR64 XOR R8D,R8D XOR R9D,R9D TEST EDI,EDI JLE 0x00101252 LEA ESI,[R8 + 0x1] CMP EDI,ESI JZ 0x00101252 NOP word ptr CS:[RAX + RAX*0x1] LAB_00101210: CMP ESI,0x1 JLE 0x00101247 CMP ESI,0x2 JZ 0x00101243 TEST SIL,0x1 JZ 0x00101247 MOV ECX,0x2 JMP 0x00101239 LAB_00101230: MOV EAX,ESI CDQ IDIV ECX TEST EDX,EDX JZ 0x00101247 LAB_00101239: MOV EAX,ECX ADD ECX,0x1 CMP EAX,R8D JNZ 0x00101230 LAB_00101243: ADD R9D,0x1 LAB_00101247: MOV R8D,ESI LEA ESI,[R8 + 0x1] CMP EDI,ESI JNZ 0x00101210 LAB_00101252: MOV EAX,R9D RET
int func0(uint param_1) { uint uVar1; uint uVar2; uint uVar3; uint uVar4; int iVar5; int iVar6; uVar4 = 0; iVar5 = 0; iVar6 = iVar5; if ((0 < (int)param_1) && (uVar1 = 1, iVar6 = 0, param_1 != 1)) { do { uVar3 = uVar1; if (1 < (int)uVar3) { if (uVar3 == 2) { LAB_00101243: iVar5 = iVar5 + 1; } else if ((uVar3 & 1) != 0) { uVar1 = 2; do { uVar2 = uVar1 + 1; if (uVar1 == uVar4) goto LAB_00101243; uVar1 = uVar2; } while ((int)uVar3 % (int)uVar2 != 0); } } uVar1 = uVar3 + 1; uVar4 = uVar3; iVar6 = iVar5; } while (param_1 != uVar3 + 1); } return iVar6; }
4,919
func0
#include <assert.h>
int func0(int n) { int ctr = 0; for (int num = 0; num < n; num++) { if (num <= 1) { continue; } int isPrime = 1; for (int i = 2; i < num; i++) { if (num % i == 0) { isPrime = 0; break; } } if (isPrime) { ctr++; } } return ctr; }
int main() { assert(func0(5) == 2); assert(func0(10) == 4); assert(func0(100) == 25); return 0; }
O3
c
func0: endbr64 test %edi,%edi jle 12ee <func0+0x5e> mov $0x1,%esi xor %r8d,%r8d xor %r9d,%r9d cmp $0x1,%edi je 12ea <func0+0x5a> add $0x1,%esi add $0x1,%r8d cmp %esi,%edi je 12ea <func0+0x5a> cmp $0x2,%esi je 12db <func0+0x4b> test $0x1,%sil je 12a8 <func0+0x18> mov $0x2,%ecx jmp 12d1 <func0+0x41> nopl (%rax) mov %esi,%eax cltd idiv %ecx test %edx,%edx je 12a8 <func0+0x18> mov %ecx,%eax add $0x1,%ecx cmp %r8d,%eax jl 12c8 <func0+0x38> add $0x1,%esi add $0x1,%r9d add $0x1,%r8d cmp %esi,%edi jne 12b3 <func0+0x23> mov %r9d,%eax retq xor %r9d,%r9d mov %r9d,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 test edi, edi jle short loc_1337 xor esi, esi cmp edi, 1 setnle sil xor r8d, r8d add esi, 1 cmp edi, esi jle short loc_1333 nop dword ptr [rax+rax+00h] loc_1300: cmp esi, 2 jle short loc_1328 test sil, 1 jz short loc_132C mov ecx, 2 jmp short loc_1321 loc_1318: mov eax, esi cdq idiv ecx test edx, edx jz short loc_132C loc_1321: add ecx, 1 cmp esi, ecx jnz short loc_1318 loc_1328: add r8d, 1 loc_132C: add esi, 1 cmp edi, esi jnz short loc_1300 loc_1333: mov eax, r8d retn loc_1337: xor r8d, r8d mov eax, r8d retn
long long func0(int a1) { unsigned int v1; // r8d int v2; // esi int v3; // ecx if ( a1 <= 0 ) return 0LL; v1 = 0; v2 = (a1 > 1) + 1; if ( a1 > v2 ) { while ( 1 ) { if ( v2 <= 2 ) goto LABEL_8; if ( (v2 & 1) != 0 ) break; LABEL_9: if ( a1 == ++v2 ) return v1; } v3 = 2; while ( v2 != ++v3 ) { if ( !(v2 % v3) ) goto LABEL_9; } LABEL_8: ++v1; goto LABEL_9; } return v1; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101337 XOR ESI,ESI CMP EDI,0x1 SETG SIL XOR R8D,R8D ADD ESI,0x1 CMP EDI,ESI JLE 0x00101333 NOP dword ptr [RAX + RAX*0x1] LAB_00101300: CMP ESI,0x2 JLE 0x00101328 TEST SIL,0x1 JZ 0x0010132c MOV ECX,0x2 JMP 0x00101321 LAB_00101318: MOV EAX,ESI CDQ IDIV ECX TEST EDX,EDX JZ 0x0010132c LAB_00101321: ADD ECX,0x1 CMP ESI,ECX JNZ 0x00101318 LAB_00101328: ADD R8D,0x1 LAB_0010132c: ADD ESI,0x1 CMP EDI,ESI JNZ 0x00101300 LAB_00101333: MOV EAX,R8D RET LAB_00101337: XOR R8D,R8D MOV EAX,R8D RET
int func0(uint param_1) { uint uVar1; uint uVar2; int iVar3; if ((int)param_1 < 1) { return 0; } iVar3 = 0; uVar2 = (1 < (int)param_1) + 1; if ((int)uVar2 < (int)param_1) { do { if ((int)uVar2 < 3) { LAB_00101328: iVar3 = iVar3 + 1; } else if ((uVar2 & 1) != 0) { uVar1 = 2; do { uVar1 = uVar1 + 1; if (uVar2 == uVar1) goto LAB_00101328; } while ((int)uVar2 % (int)uVar1 != 0); } uVar2 = uVar2 + 1; } while (param_1 != uVar2); } return iVar3; }
4,920
func0
#include <assert.h>
void func0(int *a, int *b) { int temp = *a; *a = *b; *b = temp; }
int main() { int a = 10, b = 20; func0(&a, &b); assert(a == 20 && b == 10); a = 15, b = 17; func0(&a, &b); assert(a == 17 && b == 15); a = 100, b = 200; func0(&a, &b); assert(a == 200 && b == 100); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov -0x18(%rbp),%rax mov (%rax),%eax mov %eax,-0x4(%rbp) mov -0x20(%rbp),%rax mov (%rax),%edx mov -0x18(%rbp),%rax mov %edx,(%rax) mov -0x20(%rbp),%rax mov -0x4(%rbp),%edx mov %edx,(%rax) pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov rax, [rbp+var_18] mov eax, [rax] mov [rbp+var_4], eax mov rax, [rbp+var_20] mov edx, [rax] mov rax, [rbp+var_18] mov [rax], edx mov rax, [rbp+var_20] mov edx, [rbp+var_4] mov [rax], edx nop pop rbp retn
int * func0(int *a1, int *a2) { int *result; // rax int v3; // [rsp+1Ch] [rbp-4h] v3 = *a1; *a1 = *a2; result = a2; *a2 = v3; return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV RAX,qword ptr [RBP + -0x18] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x4],EAX MOV RAX,qword ptr [RBP + -0x20] MOV EDX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x18] MOV dword ptr [RAX],EDX MOV RAX,qword ptr [RBP + -0x20] MOV EDX,dword ptr [RBP + -0x4] MOV dword ptr [RAX],EDX NOP POP RBP RET
void func0(int4 *param_1,int4 *param_2) { int4 uVar1; uVar1 = *param_1; *param_1 = *param_2; *param_2 = uVar1; return; }
4,921
func0
#include <assert.h>
void func0(int *a, int *b) { int temp = *a; *a = *b; *b = temp; }
int main() { int a = 10, b = 20; func0(&a, &b); assert(a == 20 && b == 10); a = 15, b = 17; func0(&a, &b); assert(a == 17 && b == 15); a = 100, b = 200; func0(&a, &b); assert(a == 200 && b == 100); return 0; }
O1
c
func0: endbr64 mov (%rdi),%eax mov (%rsi),%edx mov %edx,(%rdi) mov %eax,(%rsi) retq
func0: endbr64 mov eax, [rdi] mov edx, [rsi] mov [rdi], edx mov [rsi], eax retn
long long func0(_DWORD *a1, _DWORD *a2) { long long result; // rax result = (unsigned int)*a1; *a1 = *a2; *a2 = result; return result; }
func0: ENDBR64 MOV EAX,dword ptr [RDI] MOV EDX,dword ptr [RSI] MOV dword ptr [RDI],EDX MOV dword ptr [RSI],EAX RET
void func0(int4 *param_1,int4 *param_2) { int4 uVar1; uVar1 = *param_1; *param_1 = *param_2; *param_2 = uVar1; return; }
4,922
func0
#include <assert.h>
void func0(int *a, int *b) { int temp = *a; *a = *b; *b = temp; }
int main() { int a = 10, b = 20; func0(&a, &b); assert(a == 20 && b == 10); a = 15, b = 17; func0(&a, &b); assert(a == 17 && b == 15); a = 100, b = 200; func0(&a, &b); assert(a == 200 && b == 100); return 0; }
O2
c
func0: endbr64 mov (%rdi),%eax mov (%rsi),%edx mov %edx,(%rdi) mov %eax,(%rsi) retq nopl (%rax)
func0: endbr64 mov eax, [rdi] mov edx, [rsi] mov [rdi], edx mov [rsi], eax retn
long long func0(_DWORD *a1, _DWORD *a2) { long long result; // rax result = (unsigned int)*a1; *a1 = *a2; *a2 = result; return result; }
func0: ENDBR64 MOV EAX,dword ptr [RDI] MOV EDX,dword ptr [RSI] MOV dword ptr [RDI],EDX MOV dword ptr [RSI],EAX RET
void func0(int4 *param_1,int4 *param_2) { int4 uVar1; uVar1 = *param_1; *param_1 = *param_2; *param_2 = uVar1; return; }
4,923
func0
#include <assert.h>
void func0(int *a, int *b) { int temp = *a; *a = *b; *b = temp; }
int main() { int a = 10, b = 20; func0(&a, &b); assert(a == 20 && b == 10); a = 15, b = 17; func0(&a, &b); assert(a == 17 && b == 15); a = 100, b = 200; func0(&a, &b); assert(a == 200 && b == 100); return 0; }
O3
c
func0: endbr64 mov (%rdi),%eax mov (%rsi),%edx mov %edx,(%rdi) mov %eax,(%rsi) retq nopl (%rax)
func0: endbr64 mov eax, [rdi] mov edx, [rsi] mov [rdi], edx mov [rsi], eax retn
long long func0(_DWORD *a1, _DWORD *a2) { long long result; // rax result = (unsigned int)*a1; *a1 = *a2; *a2 = result; return result; }
func0: ENDBR64 MOV EAX,dword ptr [RDI] MOV EDX,dword ptr [RSI] MOV dword ptr [RDI],EDX MOV dword ptr [RSI],EAX RET
void func0(int4 *param_1,int4 *param_2) { int4 uVar1; uVar1 = *param_1; *param_1 = *param_2; *param_2 = uVar1; return; }
4,924
func0
#include <assert.h>
int func0(int array_nums[], int n) { int count_odd = 0; for (int i = 0; i < n; i++) { if (array_nums[i] % 2 != 0) { count_odd++; } } return count_odd; }
int main() { int array1[] = {1, 2, 3, 5, 7, 8, 10}; int array2[] = {10, 15, 14, 13, -18, 12, -20}; int array3[] = {1, 2, 4, 8, 9}; assert(func0(array1, 7) == 4); assert(func0(array2, 7) == 2); assert(func0(array3, 5) == 2); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 11ad <func0+0x44> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax and $0x1,%eax test %eax,%eax je 11a9 <func0+0x40> addl $0x1,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1188 <func0+0x1f> mov -0x8(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_11AD loc_1188: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] and eax, 1 test eax, eax jz short loc_11A9 add [rbp+var_8], 1 loc_11A9: add [rbp+var_4], 1 loc_11AD: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1188 mov eax, [rbp+var_8] pop rbp retn
long long func0(long long a1, int a2) { unsigned int v3; // [rsp+14h] [rbp-8h] int i; // [rsp+18h] [rbp-4h] v3 = 0; for ( i = 0; i < a2; ++i ) { if ( (*(_DWORD *)(4LL * i + a1) & 1) != 0 ) ++v3; } return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011ad LAB_00101188: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] AND EAX,0x1 TEST EAX,EAX JZ 0x001011a9 ADD dword ptr [RBP + -0x8],0x1 LAB_001011a9: ADD dword ptr [RBP + -0x4],0x1 LAB_001011ad: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101188 MOV EAX,dword ptr [RBP + -0x8] POP RBP RET
int func0(long param_1,int param_2) { int4 local_10; int4 local_c; local_10 = 0; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { if ((*(uint *)(param_1 + (long)local_c * 4) & 1) != 0) { local_10 = local_10 + 1; } } return local_10; }
4,925
func0
#include <assert.h>
int func0(int array_nums[], int n) { int count_odd = 0; for (int i = 0; i < n; i++) { if (array_nums[i] % 2 != 0) { count_odd++; } } return count_odd; }
int main() { int array1[] = {1, 2, 3, 5, 7, 8, 10}; int array2[] = {10, 15, 14, 13, -18, 12, -20}; int array3[] = {1, 2, 4, 8, 9}; assert(func0(array1, 7) == 4); assert(func0(array2, 7) == 2); assert(func0(array3, 5) == 2); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 1198 <func0+0x2f> mov %rdi,%rax lea -0x1(%rsi),%edx lea 0x4(%rdi,%rdx,4),%rsi mov $0x0,%ecx mov (%rax),%edx and $0x1,%edx cmp $0x1,%edx sbb $0xffffffff,%ecx add $0x4,%rax cmp %rsi,%rax jne 1181 <func0+0x18> mov %ecx,%eax retq mov $0x0,%ecx jmp 1195 <func0+0x2c>
func0: endbr64 test esi, esi jle short loc_1198 mov rax, rdi lea edx, [rsi-1] lea rsi, [rdi+rdx*4+4] mov ecx, 0 loc_1181: mov edx, [rax] and edx, 1 cmp edx, 1 sbb ecx, 0FFFFFFFFh add rax, 4 cmp rax, rsi jnz short loc_1181 loc_1195: mov eax, ecx retn loc_1198: mov ecx, 0 jmp short loc_1195
long long func0(_DWORD *a1, int a2) { _DWORD *v2; // rax long long v3; // rsi unsigned int v4; // ecx if ( a2 <= 0 ) { return 0; } else { v2 = a1; v3 = (long long)&a1[a2 - 1 + 1]; v4 = 0; do v4 -= ((*v2++ & 1) == 0) - 1; while ( v2 != (_DWORD *)v3 ); } return v4; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101198 MOV RAX,RDI LEA EDX,[RSI + -0x1] LEA RSI,[RDI + RDX*0x4 + 0x4] MOV ECX,0x0 LAB_00101181: MOV EDX,dword ptr [RAX] AND EDX,0x1 CMP EDX,0x1 SBB ECX,-0x1 ADD RAX,0x4 CMP RAX,RSI JNZ 0x00101181 LAB_00101195: MOV EAX,ECX RET LAB_00101198: MOV ECX,0x0 JMP 0x00101195
int func0(uint *param_1,int param_2) { uint *puVar1; int iVar2; if (param_2 < 1) { iVar2 = 0; } else { puVar1 = param_1 + (ulong)(param_2 - 1) + 1; iVar2 = 0; do { iVar2 = (iVar2 + 1) - (uint)((*param_1 & 1) == 0); param_1 = param_1 + 1; } while (param_1 != puVar1); } return iVar2; }
4,926
func0
#include <assert.h>
int func0(int array_nums[], int n) { int count_odd = 0; for (int i = 0; i < n; i++) { if (array_nums[i] % 2 != 0) { count_odd++; } } return count_odd; }
int main() { int array1[] = {1, 2, 3, 5, 7, 8, 10}; int array2[] = {10, 15, 14, 13, -18, 12, -20}; int array3[] = {1, 2, 4, 8, 9}; assert(func0(array1, 7) == 4); assert(func0(array2, 7) == 2); assert(func0(array3, 5) == 2); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1358 <func0+0x38> lea -0x1(%rsi),%eax xor %r8d,%r8d lea 0x4(%rdi,%rax,4),%rdx nopl 0x0(%rax,%rax,1) mov (%rdi),%eax and $0x1,%eax cmp $0x1,%eax sbb $0xffffffff,%r8d add $0x4,%rdi cmp %rdx,%rdi jne 1338 <func0+0x18> mov %r8d,%eax retq nopl 0x0(%rax) xor %r8d,%r8d mov %r8d,%eax retq
func0: endbr64 test esi, esi jle short loc_1358 lea eax, [rsi-1] xor r8d, r8d lea rdx, [rdi+rax*4+4] nop dword ptr [rax+rax+00h] loc_1338: mov eax, [rdi] and eax, 1 cmp eax, 1 sbb r8d, 0FFFFFFFFh add rdi, 4 cmp rdi, rdx jnz short loc_1338 mov eax, r8d retn loc_1358: xor r8d, r8d mov eax, r8d retn
long long func0(_DWORD *a1, int a2) { unsigned int v2; // r8d long long v3; // rdx if ( a2 <= 0 ) return 0LL; v2 = 0; v3 = (long long)&a1[a2 - 1 + 1]; do v2 -= ((*a1++ & 1) == 0) - 1; while ( a1 != (_DWORD *)v3 ); return v2; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101358 LEA EAX,[RSI + -0x1] XOR R8D,R8D LEA RDX,[RDI + RAX*0x4 + 0x4] NOP dword ptr [RAX + RAX*0x1] LAB_00101338: MOV EAX,dword ptr [RDI] AND EAX,0x1 CMP EAX,0x1 SBB R8D,-0x1 ADD RDI,0x4 CMP RDI,RDX JNZ 0x00101338 MOV EAX,R8D RET LAB_00101358: XOR R8D,R8D MOV EAX,R8D RET
int func0(uint *param_1,int param_2) { uint *puVar1; int iVar2; if (0 < param_2) { iVar2 = 0; puVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { iVar2 = (iVar2 + 1) - (uint)((*param_1 & 1) == 0); param_1 = param_1 + 1; } while (param_1 != puVar1); return iVar2; } return 0; }
4,927
func0
#include <assert.h>
int func0(int array_nums[], int n) { int count_odd = 0; for (int i = 0; i < n; i++) { if (array_nums[i] % 2 != 0) { count_odd++; } } return count_odd; }
int main() { int array1[] = {1, 2, 3, 5, 7, 8, 10}; int array2[] = {10, 15, 14, 13, -18, 12, -20}; int array3[] = {1, 2, 4, 8, 9}; assert(func0(array1, 7) == 4); assert(func0(array2, 7) == 2); assert(func0(array3, 5) == 2); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 1320 <func0+0xe0> lea -0x1(%rsi),%eax cmp $0x3,%eax jbe 1329 <func0+0xe9> mov %esi,%edx pxor %xmm1,%xmm1 pcmpeqd %xmm2,%xmm2 mov %rdi,%rax shr $0x2,%edx movdqa 0xdf0(%rip),%xmm4 movdqa %xmm1,%xmm3 shl $0x4,%rdx add %rdi,%rdx nopl 0x0(%rax,%rax,1) movdqu (%rax),%xmm0 add $0x10,%rax pand %xmm4,%xmm0 pcmpeqd %xmm3,%xmm0 pandn %xmm2,%xmm0 psubd %xmm0,%xmm1 cmp %rdx,%rax jne 1280 <func0+0x40> movdqa %xmm1,%xmm0 mov %esi,%edx psrldq $0x8,%xmm0 and $0xfffffffc,%edx paddd %xmm0,%xmm1 movdqa %xmm1,%xmm0 psrldq $0x4,%xmm0 paddd %xmm0,%xmm1 movd %xmm1,%eax test $0x3,%sil je 1328 <func0+0xe8> movslq %edx,%rcx mov (%rdi,%rcx,4),%ecx and $0x1,%ecx cmp $0x1,%ecx lea 0x1(%rdx),%ecx sbb $0xffffffff,%eax cmp %esi,%ecx jge 1322 <func0+0xe2> movslq %ecx,%rcx mov (%rdi,%rcx,4),%ecx and $0x1,%ecx cmp $0x1,%ecx lea 0x2(%rdx),%ecx sbb $0xffffffff,%eax cmp %ecx,%esi jle 1322 <func0+0xe2> movslq %ecx,%rcx mov (%rdi,%rcx,4),%ecx and $0x1,%ecx cmp $0x1,%ecx sbb $0xffffffff,%eax add $0x3,%edx cmp %edx,%esi jle 1322 <func0+0xe2> movslq %edx,%rdx mov (%rdi,%rdx,4),%edx and $0x1,%edx cmp $0x1,%edx sbb $0xffffffff,%eax retq nopl 0x0(%rax,%rax,1) xor %eax,%eax retq nopl 0x0(%rax,%rax,1) retq xor %edx,%edx xor %eax,%eax jmp 12c6 <func0+0x86>
func0: endbr64 mov ecx, esi test esi, esi jle loc_1210 lea eax, [rsi-1] cmp eax, 2 jbe loc_1219 mov edx, esi pxor xmm1, xmm1 movdqa xmm3, cs:xmmword_2010 mov rax, rdi shr edx, 2 movdqa xmm2, xmm1 shl rdx, 4 add rdx, rdi nop dword ptr [rax+00000000h] loc_1180: movdqu xmm0, xmmword ptr [rax] add rax, 10h pand xmm0, xmm3 pcmpeqd xmm0, xmm2 pcmpeqd xmm0, xmm2 psubd xmm1, xmm0 cmp rdx, rax jnz short loc_1180 movdqa xmm0, xmm1 mov edx, ecx psrldq xmm0, 8 and edx, 0FFFFFFFCh paddd xmm1, xmm0 movdqa xmm0, xmm1 psrldq xmm0, 4 paddd xmm1, xmm0 movd eax, xmm1 test cl, 3 jz short locret_1218 loc_11C5: movsxd rsi, edx lea r8, ds:0[rsi*4] mov esi, [rdi+rsi*4] and esi, 1 cmp esi, 1 lea esi, [rdx+1] sbb eax, 0FFFFFFFFh cmp ecx, esi jle short locret_1212 mov esi, [rdi+r8+4] and esi, 1 cmp esi, 1 sbb eax, 0FFFFFFFFh add edx, 2 cmp ecx, edx jle short locret_1212 mov edx, [rdi+r8+8] and edx, 1 cmp edx, 1 sbb eax, 0FFFFFFFFh retn loc_1210: xor eax, eax locret_1212: retn locret_1218: retn loc_1219: xor edx, edx xor eax, eax jmp short loc_11C5
long long func0(const __m128i *a1, int a2) { __m128i v2; // xmm1 __m128i si128; // xmm3 const __m128i *v4; // rax __m128i v5; // xmm0 signed int v6; // edx __m128i v7; // xmm1 long long result; // rax long long v9; // r8 if ( a2 <= 0 ) return 0LL; if ( (unsigned int)(a2 - 1) <= 2 ) { v6 = 0; LODWORD(result) = 0; } else { v2 = 0LL; si128 = _mm_load_si128((const __m128i *)&xmmword_2010); v4 = a1; do { v5 = _mm_loadu_si128(v4++); v2 = _mm_sub_epi32(v2, _mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_and_si128(v5, si128), (__m128i)0LL), (__m128i)0LL)); } while ( &a1[(unsigned int)a2 >> 2] != v4 ); v6 = a2 & 0xFFFFFFFC; v7 = _mm_add_epi32(v2, _mm_srli_si128(v2, 8)); result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v7, _mm_srli_si128(v7, 4))); if ( (a2 & 3) == 0 ) return result; } v9 = v6; result = (unsigned int)result - (((a1->m128i_i32[v9] & 1) == 0) - 1); if ( a2 > v6 + 1 ) { result = (unsigned int)result - (((a1->m128i_i32[v9 + 1] & 1) == 0) - 1); if ( a2 > v6 + 2 ) return (unsigned int)result - (((a1->m128i_i32[v9 + 2] & 1) == 0) - 1); } return result; }
func0: ENDBR64 MOV ECX,ESI TEST ESI,ESI JLE 0x00101210 LEA EAX,[RSI + -0x1] CMP EAX,0x2 JBE 0x00101219 MOV EDX,ESI PXOR XMM1,XMM1 MOVDQA XMM3,xmmword ptr [0x00102010] MOV RAX,RDI SHR EDX,0x2 MOVDQA XMM2,XMM1 SHL RDX,0x4 ADD RDX,RDI NOP dword ptr [RAX] LAB_00101180: MOVDQU XMM0,xmmword ptr [RAX] ADD RAX,0x10 PAND XMM0,XMM3 PCMPEQD XMM0,XMM2 PCMPEQD XMM0,XMM2 PSUBD XMM1,XMM0 CMP RDX,RAX JNZ 0x00101180 MOVDQA XMM0,XMM1 MOV EDX,ECX PSRLDQ XMM0,0x8 AND EDX,0xfffffffc PADDD XMM1,XMM0 MOVDQA XMM0,XMM1 PSRLDQ XMM0,0x4 PADDD XMM1,XMM0 MOVD EAX,XMM1 TEST CL,0x3 JZ 0x00101218 LAB_001011c5: MOVSXD RSI,EDX LEA R8,[RSI*0x4] MOV ESI,dword ptr [RDI + RSI*0x4] AND ESI,0x1 CMP ESI,0x1 LEA ESI,[RDX + 0x1] SBB EAX,-0x1 CMP ECX,ESI JLE 0x00101212 MOV ESI,dword ptr [RDI + R8*0x1 + 0x4] AND ESI,0x1 CMP ESI,0x1 SBB EAX,-0x1 ADD EDX,0x2 CMP ECX,EDX JLE 0x00101212 MOV EDX,dword ptr [RDI + R8*0x1 + 0x8] AND EDX,0x1 CMP EDX,0x1 SBB EAX,-0x1 RET LAB_00101210: XOR EAX,EAX LAB_00101212: RET LAB_00101218: RET LAB_00101219: XOR EDX,EDX XOR EAX,EAX JMP 0x001011c5
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ int func0(uint *param_1,uint param_2) { uint *puVar1; uint *puVar2; uint *puVar3; uint *puVar4; uint uVar5; int iVar6; int iVar7; int iVar8; int iVar9; if ((int)param_2 < 1) { iVar6 = 0; } else { if (param_2 - 1 < 3) { uVar5 = 0; iVar6 = 0; } else { iVar6 = 0; iVar7 = 0; iVar8 = 0; iVar9 = 0; puVar4 = param_1; do { uVar5 = *puVar4; puVar1 = puVar4 + 1; puVar2 = puVar4 + 2; puVar3 = puVar4 + 3; puVar4 = puVar4 + 4; iVar6 = iVar6 + (uint)((uVar5 & _DAT_00102010) != 0); iVar7 = iVar7 + (uint)((*puVar1 & _UNK_00102014) != 0); iVar8 = iVar8 + (uint)((*puVar2 & _UNK_00102018) != 0); iVar9 = iVar9 + (uint)((*puVar3 & _UNK_0010201c) != 0); } while (param_1 + (ulong)(param_2 >> 2) * 4 != puVar4); uVar5 = param_2 & 0xfffffffc; iVar6 = iVar6 + iVar8 + iVar7 + iVar9; if ((param_2 & 3) == 0) { return iVar6; } } iVar6 = (iVar6 + 1) - (uint)((param_1[(int)uVar5] & 1) == 0); if ((int)(uVar5 + 1) < (int)param_2) { iVar6 = (iVar6 + 1) - (uint)((param_1[(long)(int)uVar5 + 1] & 1) == 0); if ((int)(uVar5 + 2) < (int)param_2) { return (iVar6 + 1) - (uint)((param_1[(long)(int)uVar5 + 2] & 1) == 0); } } } return iVar6; }
4,928
func0
#include <assert.h>
void func0(int test_tup1[][2], int test_tup2[][2], int rows, int res[][2]) { for (int i = 0; i < rows; i++) { for (int j = 0; j < 2; j++) { res[i][j] = (test_tup1[i][j] > test_tup2[i][j]) ? test_tup1[i][j] : test_tup2[i][j]; } } }
int main() { int test_tup1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test_tup2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int result[4][2]; int expected[4][2] = {{6, 7}, {4, 9}, {2, 9}, {7, 10}}; func0(test_tup1, test_tup2, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected[i][0] && result[i][1] == expected[i][1]); } int test_tup3[4][2] = {{2, 4}, {5, 6}, {3, 10}, {2, 11}}; int test_tup4[4][2] = {{7, 8}, {4, 10}, {2, 2}, {8, 4}}; int expected2[4][2] = {{7, 8}, {5, 10}, {3, 10}, {8, 11}}; func0(test_tup3, test_tup4, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected2[i][0] && result[i][1] == expected2[i][1]); } int test_tup5[4][2] = {{3, 5}, {6, 7}, {4, 11}, {3, 12}}; int test_tup6[4][2] = {{8, 9}, {5, 11}, {3, 3}, {9, 5}}; int expected3[4][2] = {{8, 9}, {6, 11}, {4, 11}, {9, 12}}; func0(test_tup5, test_tup6, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected3[i][0] && result[i][1] == expected3[i][1]); } return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %edx,-0x24(%rbp) mov %rcx,-0x30(%rbp) movl $0x0,-0x8(%rbp) jmp 11fa <func0+0x91> movl $0x0,-0x4(%rbp) jmp 11f0 <func0+0x87> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x20(%rbp),%rax add %rax,%rdx mov -0x4(%rbp),%eax cltq mov (%rdx,%rax,4),%edx mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x18(%rbp),%rax add %rax,%rcx mov -0x4(%rbp),%eax cltq mov (%rcx,%rax,4),%eax mov -0x8(%rbp),%ecx movslq %ecx,%rcx lea 0x0(,%rcx,8),%rsi mov -0x30(%rbp),%rcx add %rsi,%rcx cmp %eax,%edx cmovl %eax,%edx mov -0x4(%rbp),%eax cltq mov %edx,(%rcx,%rax,4) addl $0x1,-0x4(%rbp) cmpl $0x1,-0x4(%rbp) jle 1192 <func0+0x29> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x24(%rbp),%eax jl 1189 <func0+0x20> pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_24], edx mov [rbp+var_30], rcx mov [rbp+var_8], 0 jmp short loc_11FA loc_1189: mov [rbp+var_4], 0 jmp short loc_11F0 loc_1192: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_20] add rdx, rax mov eax, [rbp+var_4] cdqe mov edx, [rdx+rax*4] mov eax, [rbp+var_8] cdqe lea rcx, ds:0[rax*8] mov rax, [rbp+var_18] add rcx, rax mov eax, [rbp+var_4] cdqe mov eax, [rcx+rax*4] mov ecx, [rbp+var_8] movsxd rcx, ecx lea rsi, ds:0[rcx*8] mov rcx, [rbp+var_30] add rcx, rsi cmp edx, eax cmovl edx, eax mov eax, [rbp+var_4] cdqe mov [rcx+rax*4], edx add [rbp+var_4], 1 loc_11F0: cmp [rbp+var_4], 1 jle short loc_1192 add [rbp+var_8], 1 loc_11FA: mov eax, [rbp+var_8] cmp eax, [rbp+var_24] jl short loc_1189 nop nop pop rbp retn
long long func0(long long a1, long long a2, int a3, long long a4) { int v4; // edx long long result; // rax unsigned int i; // [rsp+28h] [rbp-8h] int j; // [rsp+2Ch] [rbp-4h] for ( i = 0; ; ++i ) { result = i; if ( (int)i >= a3 ) break; for ( j = 0; j <= 1; ++j ) { v4 = *(_DWORD *)(a2 + 8LL * (int)i + 4LL * j); if ( v4 < *(_DWORD *)(a1 + 8LL * (int)i + 4LL * j) ) v4 = *(_DWORD *)(a1 + 8LL * (int)i + 4LL * j); *(_DWORD *)(8LL * (int)i + a4 + 4LL * j) = v4; } } return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV dword ptr [RBP + -0x24],EDX MOV qword ptr [RBP + -0x30],RCX MOV dword ptr [RBP + -0x8],0x0 JMP 0x001011fa LAB_00101189: MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011f0 LAB_00101192: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x20] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x4] CDQE MOV EDX,dword ptr [RDX + RAX*0x4] MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RCX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RCX,RAX MOV EAX,dword ptr [RBP + -0x4] CDQE MOV EAX,dword ptr [RCX + RAX*0x4] MOV ECX,dword ptr [RBP + -0x8] MOVSXD RCX,ECX LEA RSI,[RCX*0x8] MOV RCX,qword ptr [RBP + -0x30] ADD RCX,RSI CMP EDX,EAX CMOVL EDX,EAX MOV EAX,dword ptr [RBP + -0x4] CDQE MOV dword ptr [RCX + RAX*0x4],EDX ADD dword ptr [RBP + -0x4],0x1 LAB_001011f0: CMP dword ptr [RBP + -0x4],0x1 JLE 0x00101192 ADD dword ptr [RBP + -0x8],0x1 LAB_001011fa: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x24] JL 0x00101189 NOP NOP POP RBP RET
void func0(long param_1,long param_2,int param_3,long param_4) { int iVar1; int iVar2; int4 local_10; int4 local_c; for (local_10 = 0; local_10 < param_3; local_10 = local_10 + 1) { for (local_c = 0; local_c < 2; local_c = local_c + 1) { iVar1 = *(int *)((long)local_10 * 8 + param_2 + (long)local_c * 4); iVar2 = *(int *)((long)local_10 * 8 + param_1 + (long)local_c * 4); if (iVar1 < iVar2) { iVar1 = iVar2; } *(int *)(param_4 + (long)local_10 * 8 + (long)local_c * 4) = iVar1; } } return; }
4,929
func0
#include <assert.h>
void func0(int test_tup1[][2], int test_tup2[][2], int rows, int res[][2]) { for (int i = 0; i < rows; i++) { for (int j = 0; j < 2; j++) { res[i][j] = (test_tup1[i][j] > test_tup2[i][j]) ? test_tup1[i][j] : test_tup2[i][j]; } } }
int main() { int test_tup1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test_tup2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int result[4][2]; int expected[4][2] = {{6, 7}, {4, 9}, {2, 9}, {7, 10}}; func0(test_tup1, test_tup2, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected[i][0] && result[i][1] == expected[i][1]); } int test_tup3[4][2] = {{2, 4}, {5, 6}, {3, 10}, {2, 11}}; int test_tup4[4][2] = {{7, 8}, {4, 10}, {2, 2}, {8, 4}}; int expected2[4][2] = {{7, 8}, {5, 10}, {3, 10}, {8, 11}}; func0(test_tup3, test_tup4, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected2[i][0] && result[i][1] == expected2[i][1]); } int test_tup5[4][2] = {{3, 5}, {6, 7}, {4, 11}, {3, 12}}; int test_tup6[4][2] = {{8, 9}, {5, 11}, {3, 3}, {9, 5}}; int expected3[4][2] = {{8, 9}, {6, 11}, {4, 11}, {9, 12}}; func0(test_tup5, test_tup6, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected3[i][0] && result[i][1] == expected3[i][1]); } return 0; }
O1
c
func0: endbr64 test %edx,%edx jle 11a4 <func0+0x3b> lea -0x1(%rdx),%r8d mov $0x0,%eax mov (%rdi,%rax,8),%edx cmp %edx,(%rsi,%rax,8) cmovge (%rsi,%rax,8),%edx mov %edx,(%rcx,%rax,8) mov 0x4(%rdi,%rax,8),%edx cmp %edx,0x4(%rsi,%rax,8) cmovge 0x4(%rsi,%rax,8),%edx mov %edx,0x4(%rcx,%rax,8) mov %rax,%rdx add $0x1,%rax cmp %r8,%rdx jne 117a <func0+0x11> retq
func0: endbr64 mov r8, rsi test edx, edx jle short locret_11A6 mov r9d, edx mov eax, 0 loc_117C: mov edx, [r8+rax*8] mov esi, [rdi+rax*8] cmp edx, esi cmovl edx, esi mov [rcx+rax*8], edx mov edx, [r8+rax*8+4] mov esi, [rdi+rax*8+4] cmp edx, esi cmovl edx, esi mov [rcx+rax*8+4], edx add rax, 1 cmp rax, r9 jnz short loc_117C locret_11A6: retn
void func0(long long a1, long long a2, int a3, long long a4) { long long v4; // r9 long long i; // rax int v6; // edx int v7; // edx if ( a3 > 0 ) { v4 = (unsigned int)a3; for ( i = 0LL; i != v4; ++i ) { v6 = *(_DWORD *)(a2 + 8 * i); if ( v6 < *(_DWORD *)(a1 + 8 * i) ) v6 = *(_DWORD *)(a1 + 8 * i); *(_DWORD *)(a4 + 8 * i) = v6; v7 = *(_DWORD *)(a2 + 8 * i + 4); if ( v7 < *(_DWORD *)(a1 + 8 * i + 4) ) v7 = *(_DWORD *)(a1 + 8 * i + 4); *(_DWORD *)(a4 + 8 * i + 4) = v7; } } }
func0: ENDBR64 MOV R8,RSI TEST EDX,EDX JLE 0x001011a6 MOV R9D,EDX MOV EAX,0x0 LAB_0010117c: MOV EDX,dword ptr [R8 + RAX*0x8] MOV ESI,dword ptr [RDI + RAX*0x8] CMP EDX,ESI CMOVL EDX,ESI MOV dword ptr [RCX + RAX*0x8],EDX MOV EDX,dword ptr [R8 + RAX*0x8 + 0x4] MOV ESI,dword ptr [RDI + RAX*0x8 + 0x4] CMP EDX,ESI CMOVL EDX,ESI MOV dword ptr [RCX + RAX*0x8 + 0x4],EDX ADD RAX,0x1 CMP RAX,R9 JNZ 0x0010117c LAB_001011a6: RET
void func0(long param_1,long param_2,uint param_3,long param_4) { int iVar1; ulong uVar2; int iVar3; if (0 < (int)param_3) { uVar2 = 0; do { iVar3 = *(int *)(param_2 + uVar2 * 8); iVar1 = *(int *)(param_1 + uVar2 * 8); if (iVar3 < iVar1) { iVar3 = iVar1; } *(int *)(param_4 + uVar2 * 8) = iVar3; iVar3 = *(int *)(param_2 + 4 + uVar2 * 8); iVar1 = *(int *)(param_1 + 4 + uVar2 * 8); if (iVar3 < iVar1) { iVar3 = iVar1; } *(int *)(param_4 + 4 + uVar2 * 8) = iVar3; uVar2 = uVar2 + 1; } while (uVar2 != param_3); } return; }
4,930
func0
#include <assert.h>
void func0(int test_tup1[][2], int test_tup2[][2], int rows, int res[][2]) { for (int i = 0; i < rows; i++) { for (int j = 0; j < 2; j++) { res[i][j] = (test_tup1[i][j] > test_tup2[i][j]) ? test_tup1[i][j] : test_tup2[i][j]; } } }
int main() { int test_tup1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test_tup2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int result[4][2]; int expected[4][2] = {{6, 7}, {4, 9}, {2, 9}, {7, 10}}; func0(test_tup1, test_tup2, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected[i][0] && result[i][1] == expected[i][1]); } int test_tup3[4][2] = {{2, 4}, {5, 6}, {3, 10}, {2, 11}}; int test_tup4[4][2] = {{7, 8}, {4, 10}, {2, 2}, {8, 4}}; int expected2[4][2] = {{7, 8}, {5, 10}, {3, 10}, {8, 11}}; func0(test_tup3, test_tup4, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected2[i][0] && result[i][1] == expected2[i][1]); } int test_tup5[4][2] = {{3, 5}, {6, 7}, {4, 11}, {3, 12}}; int test_tup6[4][2] = {{8, 9}, {5, 11}, {3, 3}, {9, 5}}; int expected3[4][2] = {{8, 9}, {6, 11}, {4, 11}, {9, 12}}; func0(test_tup5, test_tup6, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected3[i][0] && result[i][1] == expected3[i][1]); } return 0; }
O2
c
func0: endbr64 test %edx,%edx jle 156a <func0+0x3a> lea -0x1(%rdx),%r8d xor %eax,%eax xchg %ax,%ax mov (%rdi,%rax,8),%edx cmp %edx,(%rsi,%rax,8) cmovge (%rsi,%rax,8),%edx mov %edx,(%rcx,%rax,8) mov 0x4(%rdi,%rax,8),%edx cmp %edx,0x4(%rsi,%rax,8) cmovge 0x4(%rsi,%rax,8),%edx mov %edx,0x4(%rcx,%rax,8) mov %rax,%rdx add $0x1,%rax cmp %rdx,%r8 jne 1540 <func0+0x10> retq nopl 0x0(%rax,%rax,1)
func0: endbr64 mov r8, rsi test edx, edx jle short locret_153A movsxd r9, edx xor eax, eax loc_1510: mov esi, [rdi+rax*8] mov edx, [r8+rax*8] cmp edx, esi cmovl edx, esi mov [rcx+rax*8], edx mov edx, [r8+rax*8+4] mov esi, [rdi+rax*8+4] cmp edx, esi cmovl edx, esi mov [rcx+rax*8+4], edx add rax, 1 cmp r9, rax jnz short loc_1510 locret_153A: retn
void func0(long long a1, long long a2, int a3, long long a4) { long long v4; // r9 long long i; // rax int v6; // edx int v7; // edx if ( a3 > 0 ) { v4 = a3; for ( i = 0LL; i != v4; ++i ) { v6 = *(_DWORD *)(a2 + 8 * i); if ( v6 < *(_DWORD *)(a1 + 8 * i) ) v6 = *(_DWORD *)(a1 + 8 * i); *(_DWORD *)(a4 + 8 * i) = v6; v7 = *(_DWORD *)(a2 + 8 * i + 4); if ( v7 < *(_DWORD *)(a1 + 8 * i + 4) ) v7 = *(_DWORD *)(a1 + 8 * i + 4); *(_DWORD *)(a4 + 8 * i + 4) = v7; } } }
func0: ENDBR64 MOV R8,RSI TEST EDX,EDX JLE 0x0010153a MOVSXD R9,EDX XOR EAX,EAX LAB_00101510: MOV ESI,dword ptr [RDI + RAX*0x8] MOV EDX,dword ptr [R8 + RAX*0x8] CMP EDX,ESI CMOVL EDX,ESI MOV dword ptr [RCX + RAX*0x8],EDX MOV EDX,dword ptr [R8 + RAX*0x8 + 0x4] MOV ESI,dword ptr [RDI + RAX*0x8 + 0x4] CMP EDX,ESI CMOVL EDX,ESI MOV dword ptr [RCX + RAX*0x8 + 0x4],EDX ADD RAX,0x1 CMP R9,RAX JNZ 0x00101510 LAB_0010153a: RET
void func0(long param_1,long param_2,int param_3,long param_4) { long lVar1; int iVar2; int iVar3; if (0 < param_3) { lVar1 = 0; do { iVar3 = *(int *)(param_1 + lVar1 * 8); iVar2 = *(int *)(param_2 + lVar1 * 8); if (iVar2 < iVar3) { iVar2 = iVar3; } *(int *)(param_4 + lVar1 * 8) = iVar2; iVar3 = *(int *)(param_2 + 4 + lVar1 * 8); iVar2 = *(int *)(param_1 + 4 + lVar1 * 8); if (iVar3 < iVar2) { iVar3 = iVar2; } *(int *)(param_4 + 4 + lVar1 * 8) = iVar3; lVar1 = lVar1 + 1; } while (param_3 != lVar1); } return; }
4,931
func0
#include <assert.h>
void func0(int test_tup1[][2], int test_tup2[][2], int rows, int res[][2]) { for (int i = 0; i < rows; i++) { for (int j = 0; j < 2; j++) { res[i][j] = (test_tup1[i][j] > test_tup2[i][j]) ? test_tup1[i][j] : test_tup2[i][j]; } } }
int main() { int test_tup1[4][2] = {{1, 3}, {4, 5}, {2, 9}, {1, 10}}; int test_tup2[4][2] = {{6, 7}, {3, 9}, {1, 1}, {7, 3}}; int result[4][2]; int expected[4][2] = {{6, 7}, {4, 9}, {2, 9}, {7, 10}}; func0(test_tup1, test_tup2, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected[i][0] && result[i][1] == expected[i][1]); } int test_tup3[4][2] = {{2, 4}, {5, 6}, {3, 10}, {2, 11}}; int test_tup4[4][2] = {{7, 8}, {4, 10}, {2, 2}, {8, 4}}; int expected2[4][2] = {{7, 8}, {5, 10}, {3, 10}, {8, 11}}; func0(test_tup3, test_tup4, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected2[i][0] && result[i][1] == expected2[i][1]); } int test_tup5[4][2] = {{3, 5}, {6, 7}, {4, 11}, {3, 12}}; int test_tup6[4][2] = {{8, 9}, {5, 11}, {3, 3}, {9, 5}}; int expected3[4][2] = {{8, 9}, {6, 11}, {4, 11}, {9, 12}}; func0(test_tup5, test_tup6, 4, result); for (int i = 0; i < 4; i++) { assert(result[i][0] == expected3[i][0] && result[i][1] == expected3[i][1]); } return 0; }
O3
c
func0: endbr64 test %edx,%edx jle 1542 <func0+0xd2> lea 0xf(%rdi),%rax sub %rcx,%rax cmp $0x1e,%rax seta %r8b cmp $0x1,%edx setne %al test %al,%r8b je 150c <func0+0x9c> lea 0xf(%rsi),%rax sub %rcx,%rax cmp $0x1e,%rax jbe 150c <func0+0x9c> mov %edx,%eax xor %r8d,%r8d shr %eax shl $0x4,%rax xchg %ax,%ax movdqu (%rsi,%r8,1),%xmm1 movdqu (%rdi,%r8,1),%xmm2 movdqa %xmm1,%xmm0 pcmpgtd %xmm2,%xmm0 pand %xmm0,%xmm1 pandn %xmm2,%xmm0 por %xmm1,%xmm0 movups %xmm0,(%rcx,%r8,1) add $0x10,%r8 cmp %rax,%r8 jne 14b0 <func0+0x40> mov %edx,%eax and $0xfffffffe,%eax and $0x1,%edx je 1542 <func0+0xd2> shl $0x3,%rax add %rax,%rsi add %rax,%rdi add %rcx,%rax mov (%rdi),%edx cmp %edx,(%rsi) cmovge (%rsi),%edx mov %edx,(%rax) mov 0x4(%rdi),%edx cmp %edx,0x4(%rsi) cmovge 0x4(%rsi),%edx mov %edx,0x4(%rax) retq lea -0x1(%rdx),%r8d xor %edx,%edx nopw 0x0(%rax,%rax,1) mov (%rdi,%rdx,8),%eax cmp %eax,(%rsi,%rdx,8) cmovge (%rsi,%rdx,8),%eax mov %eax,(%rcx,%rdx,8) mov 0x4(%rdi,%rdx,8),%eax cmp %eax,0x4(%rsi,%rdx,8) cmovge 0x4(%rsi,%rdx,8),%eax mov %eax,0x4(%rcx,%rdx,8) mov %rdx,%rax add $0x1,%rdx cmp %rax,%r8 jne 1518 <func0+0xa8> retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 test edx, edx jle locret_121E cmp edx, 1 jz loc_11E0 lea rax, [rsi+0Fh] sub rax, rcx cmp rax, 1Eh jbe short loc_11E0 lea rax, [rdi+0Fh] sub rax, rcx cmp rax, 1Eh jbe short loc_11E0 mov r8d, edx xor eax, eax shr r8d, 1 shl r8, 4 nop dword ptr [rax+rax+00h] loc_1180: movdqu xmm1, xmmword ptr [rsi+rax] movdqu xmm2, xmmword ptr [rdi+rax] movdqa xmm0, xmm1 pcmpgtd xmm0, xmm2 pand xmm1, xmm0 pandn xmm0, xmm2 por xmm0, xmm1 movups xmmword ptr [rcx+rax], xmm0 add rax, 10h cmp rax, r8 jnz short loc_1180 mov eax, edx and eax, 0FFFFFFFEh and edx, 1 jz short locret_121E shl rax, 3 add rsi, rax add rdi, rax add rax, rcx mov edx, [rsi] mov ecx, [rdi] cmp edx, ecx cmovl edx, ecx mov [rax], edx mov edx, [rsi+4] mov ecx, [rdi+4] cmp edx, ecx cmovl edx, ecx mov [rax+4], edx retn loc_11E0: movsxd rdx, edx xor eax, eax lea r9, ds:0[rdx*8] nop dword ptr [rax] loc_11F0: mov r8d, [rdi+rax] mov edx, [rsi+rax] cmp edx, r8d cmovl edx, r8d mov [rcx+rax], edx mov edx, [rsi+rax+4] mov r8d, [rdi+rax+4] cmp edx, r8d cmovl edx, r8d mov [rcx+rax+4], edx add rax, 8 cmp rax, r9 jnz short loc_11F0 locret_121E: retn
void func0(long long a1, long long a2, int a3, long long a4) { long long v4; // rax __m128i v5; // xmm1 __m128i v6; // xmm2 __m128i v7; // xmm0 long long v8; // rax int *v9; // rsi int *v10; // rdi _DWORD *v11; // rax int v12; // edx int v13; // edx long long v14; // rax long long v15; // r9 int v16; // edx int v17; // edx if ( a3 > 0 ) { if ( a3 == 1 || (unsigned long long)(a2 + 15 - a4) <= 0x1E || (unsigned long long)(a1 + 15 - a4) <= 0x1E ) { v14 = 0LL; v15 = 8LL * a3; do { v16 = *(_DWORD *)(a2 + v14); if ( v16 < *(_DWORD *)(a1 + v14) ) v16 = *(_DWORD *)(a1 + v14); *(_DWORD *)(a4 + v14) = v16; v17 = *(_DWORD *)(a2 + v14 + 4); if ( v17 < *(_DWORD *)(a1 + v14 + 4) ) v17 = *(_DWORD *)(a1 + v14 + 4); *(_DWORD *)(a4 + v14 + 4) = v17; v14 += 8LL; } while ( v14 != v15 ); } else { v4 = 0LL; do { v5 = _mm_loadu_si128((const __m128i *)(a2 + v4)); v6 = _mm_loadu_si128((const __m128i *)(a1 + v4)); v7 = _mm_cmpgt_epi32(v5, v6); *(__m128i *)(a4 + v4) = _mm_or_si128(_mm_andnot_si128(v7, v6), _mm_and_si128(v5, v7)); v4 += 16LL; } while ( v4 != 16LL * ((unsigned int)a3 >> 1) ); if ( (a3 & 1) != 0 ) { v8 = 8LL * (a3 & 0xFFFFFFFE); v9 = (int *)(v8 + a2); v10 = (int *)(v8 + a1); v11 = (_DWORD *)(a4 + v8); v12 = *v9; if ( *v9 < *v10 ) v12 = *v10; *v11 = v12; v13 = v9[1]; if ( v13 < v10[1] ) v13 = v10[1]; v11[1] = v13; } } } }
func0: ENDBR64 TEST EDX,EDX JLE 0x0010121e CMP EDX,0x1 JZ 0x001011e0 LEA RAX,[RSI + 0xf] SUB RAX,RCX CMP RAX,0x1e JBE 0x001011e0 LEA RAX,[RDI + 0xf] SUB RAX,RCX CMP RAX,0x1e JBE 0x001011e0 MOV R8D,EDX XOR EAX,EAX SHR R8D,0x1 SHL R8,0x4 NOP dword ptr [RAX + RAX*0x1] LAB_00101180: MOVDQU XMM1,xmmword ptr [RSI + RAX*0x1] MOVDQU XMM2,xmmword ptr [RDI + RAX*0x1] MOVDQA XMM0,XMM1 PCMPGTD XMM0,XMM2 PAND XMM1,XMM0 PANDN XMM0,XMM2 POR XMM0,XMM1 MOVUPS xmmword ptr [RCX + RAX*0x1],XMM0 ADD RAX,0x10 CMP RAX,R8 JNZ 0x00101180 MOV EAX,EDX AND EAX,0xfffffffe AND EDX,0x1 JZ 0x0010121e SHL RAX,0x3 ADD RSI,RAX ADD RDI,RAX ADD RAX,RCX MOV EDX,dword ptr [RSI] MOV ECX,dword ptr [RDI] CMP EDX,ECX CMOVL EDX,ECX MOV dword ptr [RAX],EDX MOV EDX,dword ptr [RSI + 0x4] MOV ECX,dword ptr [RDI + 0x4] CMP EDX,ECX CMOVL EDX,ECX MOV dword ptr [RAX + 0x4],EDX RET LAB_001011e0: MOVSXD RDX,EDX XOR EAX,EAX LEA R9,[RDX*0x8] NOP dword ptr [RAX] LAB_001011f0: MOV R8D,dword ptr [RDI + RAX*0x1] MOV EDX,dword ptr [RSI + RAX*0x1] CMP EDX,R8D CMOVL EDX,R8D MOV dword ptr [RCX + RAX*0x1],EDX MOV EDX,dword ptr [RSI + RAX*0x1 + 0x4] MOV R8D,dword ptr [RDI + RAX*0x1 + 0x4] CMP EDX,R8D CMOVL EDX,R8D MOV dword ptr [RCX + RAX*0x1 + 0x4],EDX ADD RAX,0x8 CMP RAX,R9 JNZ 0x001011f0 LAB_0010121e: RET
void func0(long param_1,long param_2,uint param_3,long param_4) { uint *puVar1; uint *puVar2; uint *puVar3; int iVar4; uint uVar5; uint uVar6; uint uVar7; uint uVar8; uint uVar9; uint uVar10; long lVar11; int iVar12; uint uVar13; uint uVar14; uint uVar15; uint uVar16; if (0 < (int)param_3) { if (((param_3 == 1) || ((ulong)((param_2 + 0xf) - param_4) < 0x1f)) || ((ulong)((param_1 + 0xf) - param_4) < 0x1f)) { lVar11 = 0; do { iVar12 = *(int *)(param_2 + lVar11); if (*(int *)(param_2 + lVar11) < *(int *)(param_1 + lVar11)) { iVar12 = *(int *)(param_1 + lVar11); } *(int *)(param_4 + lVar11) = iVar12; iVar12 = *(int *)(param_2 + 4 + lVar11); iVar4 = *(int *)(param_1 + 4 + lVar11); if (iVar12 < iVar4) { iVar12 = iVar4; } *(int *)(param_4 + 4 + lVar11) = iVar12; lVar11 = lVar11 + 8; } while (lVar11 != (long)(int)param_3 * 8); } else { lVar11 = 0; do { puVar1 = (uint *)(param_2 + lVar11); uVar5 = puVar1[1]; uVar6 = puVar1[2]; uVar7 = puVar1[3]; puVar2 = (uint *)(param_1 + lVar11); uVar8 = puVar2[1]; uVar9 = puVar2[2]; uVar10 = puVar2[3]; uVar13 = -(uint)((int)*puVar2 < (int)*puVar1); uVar14 = -(uint)((int)uVar8 < (int)uVar5); uVar15 = -(uint)((int)uVar9 < (int)uVar6); uVar16 = -(uint)((int)uVar10 < (int)uVar7); puVar3 = (uint *)(param_4 + lVar11); *puVar3 = ~uVar13 & *puVar2 | *puVar1 & uVar13; puVar3[1] = ~uVar14 & uVar8 | uVar5 & uVar14; puVar3[2] = ~uVar15 & uVar9 | uVar6 & uVar15; puVar3[3] = ~uVar16 & uVar10 | uVar7 & uVar16; lVar11 = lVar11 + 0x10; } while (lVar11 != (ulong)(param_3 >> 1) << 4); if ((param_3 & 1) != 0) { lVar11 = (ulong)(param_3 & 0xfffffffe) * 8; iVar12 = *(int *)(param_2 + lVar11); iVar4 = *(int *)(param_1 + lVar11); if (iVar12 < iVar4) { iVar12 = iVar4; } *(int *)(lVar11 + param_4) = iVar12; iVar12 = ((int *)(param_2 + lVar11))[1]; iVar4 = ((int *)(param_1 + lVar11))[1]; if (iVar12 < iVar4) { iVar12 = iVar4; } ((int *)(lVar11 + param_4))[1] = iVar12; return; } } } return; }
4,932
func0
#include <assert.h>
int func0(int n) { if (n == 0 || n == 1) { return 1; } return 2 * func0(n - 1) + func0(n - 2); }
int main() { assert(func0(3) == 7); assert(func0(4) == 17); assert(func0(5) == 41); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x18,%rsp mov %edi,-0x14(%rbp) cmpl $0x0,-0x14(%rbp) je 1165 <func0+0x1c> cmpl $0x1,-0x14(%rbp) jne 116c <func0+0x23> mov $0x1,%eax jmp 118b <func0+0x42> mov -0x14(%rbp),%eax sub $0x1,%eax mov %eax,%edi callq 1149 <func0> lea (%rax,%rax,1),%ebx mov -0x14(%rbp),%eax sub $0x2,%eax mov %eax,%edi callq 1149 <func0> add %ebx,%eax add $0x18,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 18h mov [rbp+var_14], edi cmp [rbp+var_14], 0 jz short loc_1165 cmp [rbp+var_14], 1 jnz short loc_116C loc_1165: mov eax, 1 jmp short loc_118B loc_116C: mov eax, [rbp+var_14] sub eax, 1 mov edi, eax call func0 lea ebx, [rax+rax] mov eax, [rbp+var_14] sub eax, 2 mov edi, eax call func0 add eax, ebx loc_118B: mov rbx, [rbp+var_8] leave retn
long long func0(unsigned int a1) { int v2; // ebx if ( a1 <= 1 ) return 1LL; v2 = 2 * func0(a1 - 1); return v2 + (unsigned int)func0(a1 - 2); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x18 MOV dword ptr [RBP + -0x14],EDI CMP dword ptr [RBP + -0x14],0x0 JZ 0x00101165 CMP dword ptr [RBP + -0x14],0x1 JNZ 0x0010116c LAB_00101165: MOV EAX,0x1 JMP 0x0010118b LAB_0010116c: MOV EAX,dword ptr [RBP + -0x14] SUB EAX,0x1 MOV EDI,EAX CALL 0x00101149 LEA EBX,[RAX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x14] SUB EAX,0x2 MOV EDI,EAX CALL 0x00101149 ADD EAX,EBX LAB_0010118b: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int func0(int param_1) { int iVar1; int iVar2; if ((param_1 == 0) || (param_1 == 1)) { iVar2 = 1; } else { iVar1 = func0(param_1 + -1); iVar2 = func0(param_1 + -2); iVar2 = iVar2 + iVar1 * 2; } return iVar2; }
4,933
func0
#include <assert.h>
int func0(int n) { if (n == 0 || n == 1) { return 1; } return 2 * func0(n - 1) + func0(n - 2); }
int main() { assert(func0(3) == 7); assert(func0(4) == 17); assert(func0(5) == 41); return 0; }
O1
c
func0: endbr64 mov $0x1,%eax cmp $0x1,%edi jbe 117b <func0+0x32> push %rbp push %rbx sub $0x8,%rsp mov %edi,%ebx lea -0x1(%rdi),%edi callq 1149 <func0> mov %eax,%ebp lea -0x2(%rbx),%edi callq 1149 <func0> lea (%rax,%rbp,2),%eax add $0x8,%rsp pop %rbx pop %rbp retq retq
func0: endbr64 mov eax, 1 cmp edi, 1 jbe short locret_117B push rbp push rbx sub rsp, 8 mov ebx, edi lea edi, [rdi-1] call func0 mov ebp, eax lea edi, [rbx-2] call func0 lea eax, [rax+rbp*2] add rsp, 8 pop rbx pop rbp retn locret_117B: retn
long long func0(unsigned int a1) { long long result; // rax int v2; // ebp result = 1LL; if ( a1 > 1 ) { v2 = func0(a1 - 1); return (unsigned int)func0(a1 - 2) + 2 * v2; } return result; }
func0: ENDBR64 MOV EAX,0x1 CMP EDI,0x1 JBE 0x0010117b PUSH RBP PUSH RBX SUB RSP,0x8 MOV EBX,EDI LEA EDI,[RDI + -0x1] CALL 0x00101149 MOV EBP,EAX LEA EDI,[RBX + -0x2] CALL 0x00101149 LEA EAX,[RAX + RBP*0x2] ADD RSP,0x8 POP RBX POP RBP RET LAB_0010117b: RET
int func0(uint param_1) { int iVar1; int iVar2; if (1 < param_1) { iVar1 = func0(param_1 - 1); iVar2 = func0(param_1 - 2); return iVar2 + iVar1 * 2; } return 1; }
4,934
func0
#include <assert.h>
int func0(int n) { if (n == 0 || n == 1) { return 1; } return 2 * func0(n - 1) + func0(n - 2); }
int main() { assert(func0(3) == 7); assert(func0(4) == 17); assert(func0(5) == 41); return 0; }
O2
c
func0: endbr64 cmp $0x1,%edi jbe 1248 <func0+0x38> push %rbp xor %ebp,%ebp push %rbx mov %edi,%ebx sub $0x8,%rsp lea -0x1(%rbx),%edi sub $0x2,%ebx callq 1210 <func0> lea 0x0(%rbp,%rax,2),%ebp cmp $0x1,%ebx ja 1223 <func0+0x13> add $0x8,%rsp lea 0x1(%rbp),%eax pop %rbx pop %rbp retq nopl 0x0(%rax) mov $0x1,%eax retq xchg %ax,%ax
func0: endbr64 push r15 mov eax, edi sub edi, 1 push r14 push r13 push r12 push rbp push rbx sub rsp, 58h mov [rsp+88h+var_80], edi mov [rsp+88h+var_74], 0 cmp eax, 1 jbe loc_14E3 cmp [rsp+88h+var_80], 1 jbe loc_14BB loc_1227: mov eax, [rsp+88h+var_80] mov [rsp+88h+var_70], 0 sub eax, 1 mov [rsp+88h+var_7C], eax cmp [rsp+88h+var_7C], 1 mov [rsp+88h+var_64], eax jz loc_1483 loc_1249: mov eax, [rsp+88h+var_7C] mov [rsp+88h+var_6C], 0 sub eax, 1 mov [rsp+88h+var_78], eax cmp [rsp+88h+var_78], 1 mov [rsp+88h+var_60], eax jz loc_13F1 loc_126B: mov eax, [rsp+88h+var_78] mov [rsp+88h+var_68], 0 sub eax, 1 mov [rsp+88h+var_58], eax mov r11d, eax loc_1281: cmp r11d, 1 jz loc_1448 lea eax, [r11-1] xor edx, edx mov [rsp+88h+var_5C], eax mov ebp, eax loc_1297: cmp ebp, 1 jz loc_143B lea r14d, [rbp-1] xor ecx, ecx mov r12d, r14d loc_12A9: cmp r12d, 1 jz loc_1400 lea r13d, [r12-2] xor r8d, r8d mov esi, r13d loc_12BE: lea eax, [rsi+1] mov ebx, esi xor r15d, r15d cmp eax, 1 jbe loc_1420 mov r9d, r13d mov r10d, ebx mov r13d, r12d mov r12d, ebp xor ebp, ebp cmp ebx, 1 jz short loc_135D nop word ptr [rax+rax+00h] loc_12E8: lea edi, [r10-1] mov [rsp+88h+var_3C], r9d mov [rsp+88h+var_40], esi mov [rsp+88h+var_44], r11d mov [rsp+88h+var_48], r8d mov [rsp+88h+var_4C], ecx mov [rsp+88h+var_50], edx mov [rsp+88h+var_54], r10d call func0 mov r10d, [rsp+88h+var_54] mov edx, [rsp+88h+var_50] mov ecx, [rsp+88h+var_4C] mov r8d, [rsp+88h+var_48] lea ebp, [rbp+rax*2+0] sub r10d, 2 mov r11d, [rsp+88h+var_44] mov esi, [rsp+88h+var_40] cmp r10d, 1 mov r9d, [rsp+88h+var_3C] ja short loc_12E8 lea eax, [rbp+rbp+2] add r15d, eax lea eax, [rbx-2] sub ebx, 1 cmp ebx, 1 jbe short loc_1370 loc_1351: mov ebx, eax xor ebp, ebp mov r10d, ebx cmp ebx, 1 jnz short loc_12E8 loc_135D: mov eax, 2 add r15d, eax lea eax, [rbx-2] sub ebx, 1 cmp ebx, 1 ja short loc_1351 loc_1370: lea eax, [r15+r15+2] mov ebp, r12d mov r12d, r13d mov r13d, r9d add r8d, eax lea eax, [rsi-2] cmp esi, 1 ja loc_1434 loc_138D: lea eax, [r8+r8+2] sub r12d, 1 add ecx, eax cmp r12d, 1 ja short loc_1417 loc_139E: lea eax, [rcx+rcx+2] loc_13A2: add edx, eax sub ebp, 2 cmp r14d, 1 ja loc_1297 lea eax, [rdx+rdx+2] loc_13B5: add [rsp+88h+var_68], eax sub r11d, 2 cmp [rsp+88h+var_5C], 1 ja loc_1281 mov eax, [rsp+88h+var_68] lea eax, [rax+rax+2] loc_13D0: add [rsp+88h+var_6C], eax mov eax, [rsp+88h+var_78] sub eax, 2 cmp [rsp+88h+var_58], 1 jbe short loc_145A mov [rsp+88h+var_78], eax cmp [rsp+88h+var_78], 1 jnz loc_126B loc_13F1: mov [rsp+88h+var_58], 0 mov eax, 2 jmp short loc_13D0 loc_1400: mov eax, 2 sub r12d, 1 mov r13d, 0FFFFFFFFh add ecx, eax cmp r12d, 1 jbe short loc_139E loc_1417: mov r12d, r13d jmp loc_12A9 loc_1420: mov eax, 2 add r8d, eax lea eax, [rsi-2] cmp esi, 1 jbe loc_138D loc_1434: mov esi, eax jmp loc_12BE loc_143B: mov eax, 2 xor r14d, r14d jmp loc_13A2 loc_1448: mov [rsp+88h+var_5C], 0 mov eax, 2 jmp loc_13B5 loc_145A: mov eax, [rsp+88h+var_6C] lea eax, [rax+rax+2] loc_1462: add [rsp+88h+var_70], eax mov eax, [rsp+88h+var_7C] sub eax, 2 cmp [rsp+88h+var_60], 1 jbe short loc_1492 mov [rsp+88h+var_7C], eax cmp [rsp+88h+var_7C], 1 jnz loc_1249 loc_1483: mov [rsp+88h+var_60], 0 mov eax, 2 jmp short loc_1462 loc_1492: mov eax, [rsp+88h+var_70] lea eax, [rax+rax+2] loc_149A: add [rsp+88h+var_74], eax mov eax, [rsp+88h+var_80] sub eax, 2 cmp [rsp+88h+var_64], 1 jbe short loc_14CD mov [rsp+88h+var_80], eax cmp [rsp+88h+var_80], 1 ja loc_1227 loc_14BB: mov edi, [rsp+88h+var_80] mov eax, 2 sub edi, 1 mov [rsp+88h+var_64], edi jmp short loc_149A loc_14CD: mov eax, [rsp+88h+var_74] add rsp, 58h pop rbx pop rbp add eax, 1 pop r12 pop r13 pop r14 pop r15 retn loc_14E3: add rsp, 58h mov eax, 1 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(unsigned int a1) { unsigned int v1; // r11d int v2; // edx unsigned int v3; // ebp unsigned int v4; // r14d int v5; // ecx unsigned int v6; // r12d unsigned int v7; // r13d int v8; // r8d unsigned int i; // esi unsigned int v10; // ebx int v11; // r15d unsigned int v12; // r9d unsigned int v13; // r10d unsigned int v14; // r13d unsigned int v15; // r12d int v16; // ebp int v17; // eax unsigned int v18; // eax unsigned int v19; // eax int v20; // eax int v21; // eax int j; // eax unsigned int v23; // eax int k; // eax unsigned int v25; // eax int m; // eax unsigned int v27; // eax unsigned int v29; // [rsp+8h] [rbp-80h] unsigned int v30; // [rsp+Ch] [rbp-7Ch] unsigned int v31; // [rsp+10h] [rbp-78h] int v32; // [rsp+14h] [rbp-74h] int v33; // [rsp+18h] [rbp-70h] int v34; // [rsp+1Ch] [rbp-6Ch] int v35; // [rsp+20h] [rbp-68h] unsigned int v36; // [rsp+24h] [rbp-64h] unsigned int v37; // [rsp+28h] [rbp-60h] unsigned int v38; // [rsp+2Ch] [rbp-5Ch] unsigned int v39; // [rsp+30h] [rbp-58h] unsigned int v40; // [rsp+34h] [rbp-54h] int v41; // [rsp+38h] [rbp-50h] int v42; // [rsp+3Ch] [rbp-4Ch] int v43; // [rsp+40h] [rbp-48h] unsigned int v44; // [rsp+44h] [rbp-44h] unsigned int v45; // [rsp+4Ch] [rbp-3Ch] v29 = a1 - 1; v32 = 0; if ( a1 <= 1 ) return 1LL; if ( v29 <= 1 ) goto LABEL_41; LABEL_3: v33 = 0; v30 = v29 - 1; v36 = v29 - 1; if ( v29 == 2 ) goto LABEL_37; LABEL_4: v34 = 0; v31 = v30 - 1; v37 = v30 - 1; if ( v30 == 2 ) goto LABEL_27; LABEL_5: v35 = 0; v39 = v31 - 1; v1 = v31 - 1; do { if ( v1 != 1 ) { v2 = 0; v38 = v1 - 1; v3 = v1 - 1; while ( 1 ) { if ( v3 == 1 ) { v20 = 2; v4 = 0; goto LABEL_21; } v4 = v3 - 1; v5 = 0; v6 = v3 - 1; LABEL_10: if ( v6 != 1 ) break; v5 += 2; LABEL_20: v20 = 2 * v5 + 2; LABEL_21: v2 += v20; v3 -= 2; if ( v4 <= 1 ) { v21 = 2 * v2 + 2; goto LABEL_23; } } v7 = v6 - 2; v8 = 0; for ( i = v6 - 2; ; i = v19 ) { v10 = i; v11 = 0; if ( i + 1 > 1 ) break; v8 += 2; v19 = i - 2; if ( i <= 1 ) { LABEL_19: v5 += 2 * v8 + 2; if ( v6 - 1 <= 1 ) goto LABEL_20; v6 = v7; goto LABEL_10; } LABEL_31: ; } v12 = v7; v13 = i; v14 = v6; v15 = v3; v16 = 0; if ( i == 1 ) goto LABEL_17; while ( 1 ) { do { v45 = v12; v44 = v1; v43 = v8; v42 = v5; v41 = v2; v40 = v13; v17 = func0(v13 - 1); v2 = v41; v5 = v42; v8 = v43; v16 += 2 * v17; v13 = v40 - 2; v1 = v44; v12 = v45; } while ( v40 - 2 > 1 ); v11 += 2 * v16 + 2; v18 = v10 - 2; if ( v10 - 1 <= 1 ) break; while ( 1 ) { v10 = v18; v16 = 0; v13 = v18; if ( v18 != 1 ) break; LABEL_17: v11 += 2; v18 = v10 - 2; if ( v10 - 1 <= 1 ) goto LABEL_18; } } LABEL_18: v3 = v15; v6 = v14; v7 = v12; v8 += 2 * v11 + 2; v19 = i - 2; if ( i <= 1 ) goto LABEL_19; goto LABEL_31; } v38 = 0; v21 = 2; LABEL_23: v35 += v21; v1 -= 2; } while ( v38 > 1 ); for ( j = 2 * v35 + 2; ; j = 2 ) { v34 += j; v23 = v31 - 2; if ( v39 <= 1 ) break; v31 -= 2; if ( v23 != 1 ) goto LABEL_5; LABEL_27: v39 = 0; } for ( k = 2 * v34 + 2; ; k = 2 ) { v33 += k; v25 = v30 - 2; if ( v37 <= 1 ) break; v30 -= 2; if ( v25 != 1 ) goto LABEL_4; LABEL_37: v37 = 0; } for ( m = 2 * v33 + 2; ; m = 2 ) { v32 += m; v27 = v29 - 2; if ( v36 <= 1 ) break; v29 -= 2; if ( v27 > 1 ) goto LABEL_3; LABEL_41: v36 = v29 - 1; } return (unsigned int)(v32 + 1); }
func0: ENDBR64 PUSH R15 MOV EAX,EDI SUB EDI,0x1 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x58 MOV dword ptr [RSP + 0x8],EDI MOV dword ptr [RSP + 0x14],0x0 CMP EAX,0x1 JBE 0x001014e3 CMP dword ptr [RSP + 0x8],0x1 JBE 0x001014bb LAB_00101227: MOV EAX,dword ptr [RSP + 0x8] MOV dword ptr [RSP + 0x18],0x0 SUB EAX,0x1 MOV dword ptr [RSP + 0xc],EAX CMP dword ptr [RSP + 0xc],0x1 MOV dword ptr [RSP + 0x24],EAX JZ 0x00101483 LAB_00101249: MOV EAX,dword ptr [RSP + 0xc] MOV dword ptr [RSP + 0x1c],0x0 SUB EAX,0x1 MOV dword ptr [RSP + 0x10],EAX CMP dword ptr [RSP + 0x10],0x1 MOV dword ptr [RSP + 0x28],EAX JZ 0x001013f1 LAB_0010126b: MOV EAX,dword ptr [RSP + 0x10] MOV dword ptr [RSP + 0x20],0x0 SUB EAX,0x1 MOV dword ptr [RSP + 0x30],EAX MOV R11D,EAX LAB_00101281: CMP R11D,0x1 JZ 0x00101448 LEA EAX,[R11 + -0x1] XOR EDX,EDX MOV dword ptr [RSP + 0x2c],EAX MOV EBP,EAX LAB_00101297: CMP EBP,0x1 JZ 0x0010143b LEA R14D,[RBP + -0x1] XOR ECX,ECX MOV R12D,R14D LAB_001012a9: CMP R12D,0x1 JZ 0x00101400 LEA R13D,[R12 + -0x2] XOR R8D,R8D MOV ESI,R13D LAB_001012be: LEA EAX,[RSI + 0x1] MOV EBX,ESI XOR R15D,R15D CMP EAX,0x1 JBE 0x00101420 MOV R9D,R13D MOV R10D,EBX MOV R13D,R12D MOV R12D,EBP XOR EBP,EBP CMP EBX,0x1 JZ 0x0010135d NOP word ptr [RAX + RAX*0x1] LAB_001012e8: LEA EDI,[R10 + -0x1] MOV dword ptr [RSP + 0x4c],R9D MOV dword ptr [RSP + 0x48],ESI MOV dword ptr [RSP + 0x44],R11D MOV dword ptr [RSP + 0x40],R8D MOV dword ptr [RSP + 0x3c],ECX MOV dword ptr [RSP + 0x38],EDX MOV dword ptr [RSP + 0x34],R10D CALL 0x001011f0 MOV R10D,dword ptr [RSP + 0x34] MOV EDX,dword ptr [RSP + 0x38] MOV ECX,dword ptr [RSP + 0x3c] MOV R8D,dword ptr [RSP + 0x40] LEA EBP,[RBP + RAX*0x2] SUB R10D,0x2 MOV R11D,dword ptr [RSP + 0x44] MOV ESI,dword ptr [RSP + 0x48] CMP R10D,0x1 MOV R9D,dword ptr [RSP + 0x4c] JA 0x001012e8 LEA EAX,[RBP + RBP*0x1 + 0x2] ADD R15D,EAX LEA EAX,[RBX + -0x2] SUB EBX,0x1 CMP EBX,0x1 JBE 0x00101370 LAB_00101351: MOV EBX,EAX XOR EBP,EBP MOV R10D,EBX CMP EBX,0x1 JNZ 0x001012e8 LAB_0010135d: MOV EAX,0x2 ADD R15D,EAX LEA EAX,[RBX + -0x2] SUB EBX,0x1 CMP EBX,0x1 JA 0x00101351 LAB_00101370: LEA EAX,[R15 + R15*0x1 + 0x2] MOV EBP,R12D MOV R12D,R13D MOV R13D,R9D ADD R8D,EAX LEA EAX,[RSI + -0x2] CMP ESI,0x1 JA 0x00101434 LAB_0010138d: LEA EAX,[R8 + R8*0x1 + 0x2] SUB R12D,0x1 ADD ECX,EAX CMP R12D,0x1 JA 0x00101417 LAB_0010139e: LEA EAX,[RCX + RCX*0x1 + 0x2] LAB_001013a2: ADD EDX,EAX SUB EBP,0x2 CMP R14D,0x1 JA 0x00101297 LEA EAX,[RDX + RDX*0x1 + 0x2] LAB_001013b5: ADD dword ptr [RSP + 0x20],EAX SUB R11D,0x2 CMP dword ptr [RSP + 0x2c],0x1 JA 0x00101281 MOV EAX,dword ptr [RSP + 0x20] LEA EAX,[RAX + RAX*0x1 + 0x2] LAB_001013d0: ADD dword ptr [RSP + 0x1c],EAX MOV EAX,dword ptr [RSP + 0x10] SUB EAX,0x2 CMP dword ptr [RSP + 0x30],0x1 JBE 0x0010145a MOV dword ptr [RSP + 0x10],EAX CMP dword ptr [RSP + 0x10],0x1 JNZ 0x0010126b LAB_001013f1: MOV dword ptr [RSP + 0x30],0x0 MOV EAX,0x2 JMP 0x001013d0 LAB_00101400: MOV EAX,0x2 SUB R12D,0x1 MOV R13D,0xffffffff ADD ECX,EAX CMP R12D,0x1 JBE 0x0010139e LAB_00101417: MOV R12D,R13D JMP 0x001012a9 LAB_00101420: MOV EAX,0x2 ADD R8D,EAX LEA EAX,[RSI + -0x2] CMP ESI,0x1 JBE 0x0010138d LAB_00101434: MOV ESI,EAX JMP 0x001012be LAB_0010143b: MOV EAX,0x2 XOR R14D,R14D JMP 0x001013a2 LAB_00101448: MOV dword ptr [RSP + 0x2c],0x0 MOV EAX,0x2 JMP 0x001013b5 LAB_0010145a: MOV EAX,dword ptr [RSP + 0x1c] LEA EAX,[RAX + RAX*0x1 + 0x2] LAB_00101462: ADD dword ptr [RSP + 0x18],EAX MOV EAX,dword ptr [RSP + 0xc] SUB EAX,0x2 CMP dword ptr [RSP + 0x28],0x1 JBE 0x00101492 MOV dword ptr [RSP + 0xc],EAX CMP dword ptr [RSP + 0xc],0x1 JNZ 0x00101249 LAB_00101483: MOV dword ptr [RSP + 0x28],0x0 MOV EAX,0x2 JMP 0x00101462 LAB_00101492: MOV EAX,dword ptr [RSP + 0x18] LEA EAX,[RAX + RAX*0x1 + 0x2] LAB_0010149a: ADD dword ptr [RSP + 0x14],EAX MOV EAX,dword ptr [RSP + 0x8] SUB EAX,0x2 CMP dword ptr [RSP + 0x24],0x1 JBE 0x001014cd MOV dword ptr [RSP + 0x8],EAX CMP dword ptr [RSP + 0x8],0x1 JA 0x00101227 LAB_001014bb: MOV EDI,dword ptr [RSP + 0x8] MOV EAX,0x2 SUB EDI,0x1 MOV dword ptr [RSP + 0x24],EDI JMP 0x0010149a LAB_001014cd: MOV EAX,dword ptr [RSP + 0x14] ADD RSP,0x58 POP RBX POP RBP ADD EAX,0x1 POP R12 POP R13 POP R14 POP R15 RET LAB_001014e3: ADD RSP,0x58 MOV EAX,0x1 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int func0(uint param_1) { int iVar1; uint uVar2; uint uVar3; int iVar4; int iVar5; int iVar6; uint uVar7; int iVar8; uint uVar9; uint uVar10; uint uVar11; uint uVar12; int iVar13; uint local_80; uint local_7c; uint local_78; int local_74; int local_70; int local_6c; int local_68; uint local_64; uint local_60; uint local_5c; uint local_58; local_80 = param_1 - 1; local_74 = 0; if (param_1 < 2) { return 1; } if (local_80 < 2) goto LAB_001014bb; LAB_00101227: local_70 = 0; local_64 = local_80 - 1; local_7c = local_64; if (local_64 == 1) goto LAB_00101483; LAB_00101249: local_6c = 0; local_60 = local_7c - 1; local_78 = local_60; if (local_60 == 1) goto LAB_001013f1; LAB_0010126b: local_68 = 0; local_58 = local_78 - 1; uVar10 = local_58; LAB_00101281: if (uVar10 != 1) { local_5c = uVar10 - 1; iVar5 = 0; uVar7 = local_5c; LAB_00101297: if (uVar7 != 1) { uVar12 = uVar7 - 1; iVar4 = 0; uVar11 = uVar12; LAB_001012a9: if (uVar11 != 1) { iVar8 = 0; uVar3 = uVar11 - 2; do { iVar13 = 0; iVar1 = 0; if (1 < uVar3 + 1) { iVar6 = 0; uVar2 = uVar3; uVar9 = uVar3; if (uVar3 == 1) goto LAB_0010135d; do { do { iVar1 = func0(uVar9 - 1); iVar6 = iVar6 + iVar1 * 2; uVar9 = uVar9 - 2; } while (1 < uVar9); iVar1 = iVar13 + iVar6 * 2 + 2; while( true ) { if (uVar2 - 1 < 2) { iVar8 = iVar8 + iVar1 * 2 + 2; goto joined_r0x0010142e; } uVar2 = uVar2 - 2; iVar6 = 0; uVar9 = uVar2; iVar13 = iVar1; if (uVar2 != 1) break; LAB_0010135d: iVar1 = iVar1 + 2; } } while( true ); } iVar8 = iVar8 + 2; joined_r0x0010142e: if (uVar3 < 2) goto LAB_0010138d; uVar3 = uVar3 - 2; } while( true ); } iVar4 = iVar4 + 2; goto LAB_0010139e; } iVar4 = 2; uVar12 = 0; goto LAB_001013a2; } local_5c = 0; iVar5 = 2; goto LAB_001013b5; LAB_0010138d: uVar3 = uVar11 - 1; iVar4 = iVar4 + iVar8 * 2 + 2; uVar11 = uVar11 - 2; if (uVar3 < 2) goto LAB_0010139e; goto LAB_001012a9; LAB_0010139e: iVar4 = iVar4 * 2 + 2; LAB_001013a2: iVar5 = iVar5 + iVar4; uVar7 = uVar7 - 2; if (uVar12 < 2) goto code_r0x001013b1; goto LAB_00101297; code_r0x001013b1: iVar5 = iVar5 * 2 + 2; LAB_001013b5: local_68 = local_68 + iVar5; uVar10 = uVar10 - 2; if (local_5c < 2) goto code_r0x001013c8; goto LAB_00101281; code_r0x001013c8: iVar5 = local_68 * 2 + 2; while( true ) { local_6c = local_6c + iVar5; local_78 = local_78 - 2; if (local_58 < 2) { iVar5 = local_6c * 2 + 2; goto LAB_00101462; } if (local_78 != 1) break; LAB_001013f1: local_58 = 0; iVar5 = 2; } goto LAB_0010126b; LAB_00101462: local_70 = local_70 + iVar5; local_7c = local_7c - 2; if (1 < local_60) { if (local_7c != 1) goto LAB_00101249; LAB_00101483: local_60 = 0; iVar5 = 2; goto LAB_00101462; } iVar5 = local_70 * 2 + 2; while( true ) { local_74 = local_74 + iVar5; local_80 = local_80 - 2; if (local_64 < 2) { return local_74 + 1; } if (1 < local_80) break; LAB_001014bb: iVar5 = 2; local_64 = local_80 - 1; } goto LAB_00101227; }
4,935
func0
#include <assert.h>
int func0(int n) { if (n == 0 || n == 1) { return 1; } return 2 * func0(n - 1) + func0(n - 2); }
int main() { assert(func0(3) == 7); assert(func0(4) == 17); assert(func0(5) == 41); return 0; }
O3
c
func0: endbr64 cmp $0x1,%edi jbe 1248 <func0+0x38> push %rbp xor %ebp,%ebp push %rbx mov %edi,%ebx sub $0x8,%rsp lea -0x1(%rbx),%edi sub $0x2,%ebx callq 1210 <func0> lea 0x0(%rbp,%rax,2),%ebp cmp $0x1,%ebx ja 1223 <func0+0x13> add $0x8,%rsp lea 0x1(%rbp),%eax pop %rbx pop %rbp retq nopl 0x0(%rax) mov $0x1,%eax retq xchg %ax,%ax
func0: endbr64 push r15 push r14 mov r14d, 1 push r13 push r12 push rbp push rbx sub rsp, 58h cmp edi, 1 jbe loc_1576 lea r15d, [rdi-1] xor ebp, ebp loc_1217: cmp r15d, 1 jz loc_156F loc_1221: lea r12d, [r15-1] xor r14d, r14d mov [rsp+88h+var_6C], ebp mov r13d, r12d mov ebp, r14d mov ebx, r12d loc_1235: cmp ebx, 1 jz loc_1544 loc_123E: mov [rsp+88h+var_64], r15d lea ecx, [rbx-1] xor r14d, r14d mov r12d, ebx mov [rsp+88h+var_68], ebp mov ebx, ecx mov ebp, r14d loc_1255: cmp ebx, 1 jz loc_1517 mov [rsp+88h+var_60], r13d lea edi, [rbx-1] mov eax, r12d xor r15d, r15d mov [rsp+88h+var_5C], ebx mov r12d, edi loc_1273: cmp r12d, 1 jz loc_14DE mov [rsp+88h+var_58], ebp lea r11d, [r12-1] mov r10d, ecx xor r13d, r13d mov ecx, r15d mov ebx, r11d mov r9d, eax mov r8d, edi mov r15d, r12d loc_129B: cmp ebx, 1 jz loc_149F loc_12A4: lea ebp, [rbx-1] xor r12d, r12d mov edi, ecx mov [rsp+88h+var_84], ebp mov eax, ebp mov ebp, r9d loc_12B5: mov r14d, eax cmp eax, 1 jz loc_1478 lea esi, [rax-1] lea edx, [rax-2] mov ecx, r14d mov r9d, edi mov eax, esi mov [rsp+88h+var_88], edx mov edi, edx and eax, 0FFFFFFFEh sub ecx, eax mov eax, r14d mov [rsp+88h+var_70], ecx xor ecx, ecx loc_12E2: mov edx, [rsp+88h+var_70] cmp eax, edx jz loc_14C0 mov r14d, edi mov [rsp+88h+var_80], r9d xor edx, edx mov r9d, ebx mov [rsp+88h+var_78], ecx mov ebx, r14d mov ecx, r15d mov r15d, ebp mov [rsp+88h+var_7C], eax mov [rsp+88h+var_74], edi cmp r14d, 1 jbe short loc_138A loc_1316: xor ebp, ebp loc_1318: lea edi, [rbx-1] sub ebx, 2 mov [rsp+88h+var_3C], esi mov [rsp+88h+var_40], r9d mov [rsp+88h+var_44], ecx mov [rsp+88h+var_48], r11d mov [rsp+88h+var_4C], r8d mov [rsp+88h+var_50], r10d mov [rsp+88h+var_54], edx call func0 cmp ebx, 1 mov edx, [rsp+88h+var_54] mov ecx, [rsp+88h+var_44] mov r10d, [rsp+88h+var_50] mov r8d, [rsp+88h+var_4C] lea ebp, [rbp+rax*2+0] mov r11d, [rsp+88h+var_48] mov r9d, [rsp+88h+var_40] mov esi, [rsp+88h+var_3C] ja short loc_1318 lea edx, [rdx+rbp*2+2] lea edi, [r14-2] cmp r14d, 2 jz loc_14F8 mov r14d, edi mov ebx, r14d cmp r14d, 1 ja short loc_1316 loc_138A: mov ebp, r15d mov ebx, r9d mov r15d, ecx mov eax, [rsp+88h+var_7C] mov ecx, [rsp+88h+var_78] mov r9d, [rsp+88h+var_80] add edx, 2 mov edi, [rsp+88h+var_74] loc_13A7: sub eax, 2 lea ecx, [rcx+rdx*2+2] sub edi, 2 cmp eax, 1 jnz loc_12E2 mov edx, [rsp+88h+var_88] mov edi, r9d lea r12d, [r12+rcx*2+2] cmp esi, 1 jnz loc_14D7 loc_13CE: mov r9d, ebp mov ebp, [rsp+88h+var_84] mov ecx, edi lea r13d, [r13+r12*2+2] sub ebx, 2 cmp ebp, 1 jnz loc_129B loc_13E8: mov ebp, [rsp+88h+var_58] mov r12d, r15d mov eax, r9d mov r15d, ecx mov edi, r8d mov ecx, r10d loc_13FB: lea r15d, [r15+r13*2+2] sub r12d, 2 cmp r11d, 1 jnz loc_1273 mov r13d, [rsp+88h+var_60] mov ebx, [rsp+88h+var_5C] mov r12d, eax loc_141A: lea ebp, [rbp+r15*2+2] sub ebx, 2 cmp edi, 1 jnz loc_1255 mov r14d, ebp mov ebp, [rsp+88h+var_68] mov ebx, r12d mov r15d, [rsp+88h+var_64] sub ebx, 2 lea ebp, [rbp+r14*2+2] cmp ecx, 1 jnz loc_1235 loc_144B: mov r14d, ebp mov ebp, [rsp+88h+var_6C] mov r12d, r13d sub r15d, 2 lea ebp, [rbp+r14*2+2] cmp r12d, 1 jnz loc_1217 loc_1468: mov r14d, ebp add r14d, 1 jmp loc_1576 loc_1478: mov r9d, ebp mov ebp, [rsp+88h+var_84] add r12d, 2 mov ecx, edi lea r13d, [r13+r12*2+2] sub ebx, 2 cmp ebp, 1 jz loc_13E8 cmp ebx, 1 jnz loc_12A4 loc_149F: mov r12d, r15d mov ebp, [rsp+88h+var_58] mov r15d, ecx mov eax, r9d mov edi, r8d mov ecx, r10d add r13d, 2 jmp loc_13FB loc_14C0: add ecx, 2 mov edx, [rsp+88h+var_88] mov edi, r9d lea r12d, [r12+rcx*2+2] cmp esi, 1 jz loc_13CE loc_14D7: mov eax, edx jmp loc_12B5 loc_14DE: mov r13d, [rsp+88h+var_60] mov ebx, [rsp+88h+var_5C] mov r12d, eax add r15d, 2 jmp loc_141A loc_14F8: mov ebp, r15d mov ebx, r9d mov r15d, ecx mov eax, [rsp+88h+var_7C] mov ecx, [rsp+88h+var_78] mov r9d, [rsp+88h+var_80] mov edi, [rsp+88h+var_74] jmp loc_13A7 loc_1517: mov r14d, ebp mov ebp, [rsp+88h+var_68] mov ebx, r12d mov r15d, [rsp+88h+var_64] add r14d, 2 sub ebx, 2 lea ebp, [rbp+r14*2+2] cmp ecx, 1 jz loc_144B cmp ebx, 1 jnz loc_123E loc_1544: mov r14d, ebp mov ebp, [rsp+88h+var_6C] mov r12d, r13d sub r15d, 2 add r14d, 2 lea ebp, [rbp+r14*2+2] cmp r12d, 1 jz loc_1468 cmp r15d, 1 jnz loc_1221 loc_156F: mov r14d, ebp add r14d, 3 loc_1576: add rsp, 58h mov eax, r14d pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(unsigned int a1) { unsigned int v1; // r14d unsigned int v2; // r15d int v3; // ebp unsigned int v4; // r13d int v5; // ebp unsigned int v6; // ebx unsigned int v7; // ecx unsigned int v8; // r12d unsigned int v9; // ebx int v10; // ebp unsigned int v11; // edi unsigned int v12; // eax int v13; // r15d unsigned int v14; // r12d unsigned int v15; // r11d unsigned int v16; // r10d int v17; // r13d int v18; // ecx unsigned int v19; // ebx unsigned int v20; // r9d unsigned int v21; // r8d unsigned int v22; // r15d int v23; // r12d int v24; // edi unsigned int v25; // eax unsigned int v26; // ebp unsigned int v27; // esi int v28; // r9d unsigned int v29; // edi int v30; // ecx unsigned int v31; // r14d int v32; // edx unsigned int v33; // r9d unsigned int v34; // ebx unsigned int v35; // ecx unsigned int v36; // r15d int v37; // ebp long long v38; // rdi int v39; // eax unsigned int v40; // edi unsigned int v41; // eax int v42; // ecx unsigned int v43; // edi unsigned int v44; // edx unsigned int v45; // r12d int v46; // r15d unsigned int v47; // ebx unsigned int v49; // [rsp+0h] [rbp-88h] unsigned int v50; // [rsp+4h] [rbp-84h] int v51; // [rsp+8h] [rbp-80h] unsigned int v52; // [rsp+Ch] [rbp-7Ch] int v53; // [rsp+10h] [rbp-78h] unsigned int v54; // [rsp+14h] [rbp-74h] unsigned int v55; // [rsp+18h] [rbp-70h] int v56; // [rsp+1Ch] [rbp-6Ch] int v57; // [rsp+20h] [rbp-68h] unsigned int v58; // [rsp+24h] [rbp-64h] unsigned int v59; // [rsp+28h] [rbp-60h] unsigned int v60; // [rsp+2Ch] [rbp-5Ch] int v61; // [rsp+30h] [rbp-58h] int v62; // [rsp+34h] [rbp-54h] unsigned int v63; // [rsp+38h] [rbp-50h] unsigned int v64; // [rsp+3Ch] [rbp-4Ch] unsigned int v65; // [rsp+40h] [rbp-48h] unsigned int v66; // [rsp+44h] [rbp-44h] unsigned int v67; // [rsp+48h] [rbp-40h] v1 = 1; if ( a1 > 1 ) { v2 = a1 - 1; v3 = 0; LABEL_3: if ( v2 == 1 ) { return (unsigned int)(v3 + 3); } else { while ( 1 ) { v56 = v3; v4 = v2 - 1; v5 = 0; v6 = v2 - 1; LABEL_5: if ( v6 != 1 ) { while ( 2 ) { v58 = v2; v7 = v6 - 1; v8 = v6; v57 = v5; v9 = v6 - 1; v10 = 0; while ( v9 != 1 ) { v59 = v4; v11 = v9 - 1; v12 = v8; v13 = 0; v60 = v9; v14 = v9 - 1; while ( v14 != 1 ) { v61 = v10; v15 = v14 - 1; v16 = v7; v17 = 0; v18 = v13; v19 = v14 - 1; v20 = v12; v21 = v11; v22 = v14; while ( 2 ) { if ( v19 == 1 ) { LABEL_34: v45 = v22; v10 = v61; v46 = v18; v12 = v20; v11 = v21; v7 = v16; v17 += 2; goto LABEL_26; } while ( 1 ) { v23 = 0; v24 = v18; v50 = v19 - 1; v25 = v19 - 1; v26 = v20; LABEL_13: if ( v25 != 1 ) break; v20 = v26; v18 = v24; v17 += 2 * (v23 + 2) + 2; v19 -= 2; if ( v50 == 1 ) goto LABEL_25; if ( v19 == 1 ) goto LABEL_34; } v27 = v25 - 1; v28 = v24; v49 = v25 - 2; v29 = v25 - 2; v55 = v25 - ((v25 - 1) & 0xFFFFFFFE); v30 = 0; do { if ( v25 == v55 ) { v44 = v49; v24 = v28; v23 += 2 * (v30 + 2) + 2; if ( v27 == 1 ) goto LABEL_24; LABEL_36: v25 = v44; goto LABEL_13; } v31 = v29; v51 = v28; v32 = 0; v33 = v19; v53 = v30; v34 = v29; v35 = v22; v36 = v26; v52 = v25; v54 = v29; if ( v29 <= 1 ) { LABEL_21: v26 = v36; v19 = v33; v22 = v35; v41 = v52; v42 = v53; v28 = v51; v32 += 2; v43 = v54; } else { while ( 1 ) { v37 = 0; do { v38 = v34 - 1; v34 -= 2; v67 = v33; v66 = v35; v65 = v15; v64 = v21; v63 = v16; v62 = v32; v39 = func0(v38); v32 = v62; v35 = v66; v16 = v63; v21 = v64; v37 += 2 * v39; v15 = v65; v33 = v67; } while ( v34 > 1 ); v32 = v62 + 2 * v37 + 2; v40 = v31 - 2; if ( v31 == 2 ) break; v31 -= 2; v34 = v40; if ( v40 <= 1 ) goto LABEL_21; } v26 = v36; v19 = v67; v22 = v66; v41 = v52; v42 = v53; v28 = v51; v43 = v54; } v25 = v41 - 2; v30 = v42 + 2 * v32 + 2; v29 = v43 - 2; } while ( v25 != 1 ); v44 = v49; v24 = v28; v23 += 2 * v30 + 2; if ( v27 != 1 ) goto LABEL_36; LABEL_24: v20 = v26; v18 = v24; v17 += 2 * v23 + 2; v19 -= 2; if ( v50 != 1 ) continue; break; } LABEL_25: v10 = v61; v45 = v22; v12 = v20; v46 = v18; v11 = v21; v7 = v16; LABEL_26: v13 = v46 + 2 * v17 + 2; v14 = v45 - 2; if ( v15 == 1 ) { v4 = v59; v47 = v60; v8 = v12; goto LABEL_28; } } v4 = v59; v47 = v60; v8 = v12; v13 += 2; LABEL_28: v10 += 2 * v13 + 2; v9 = v47 - 2; if ( v11 == 1 ) { v2 = v58; v6 = v8 - 2; v5 = v57 + 2 * v10 + 2; if ( v7 != 1 ) goto LABEL_5; LABEL_30: v2 -= 2; v3 = v56 + 2 * v5 + 2; if ( v4 != 1 ) goto LABEL_3; return (unsigned int)(v3 + 1); } } v2 = v58; v6 = v8 - 2; v5 = v57 + 2 * (v10 + 2) + 2; if ( v7 == 1 ) goto LABEL_30; if ( v8 != 3 ) continue; break; } } v2 -= 2; v3 = v56 + 2 * (v5 + 2) + 2; if ( v4 == 1 ) return (unsigned int)(v3 + 1); if ( v2 == 1 ) return (unsigned int)(v3 + 3); } } } return v1; }
func0: ENDBR64 PUSH R15 PUSH R14 MOV R14D,0x1 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x58 CMP EDI,0x1 JBE 0x00101576 LEA R15D,[RDI + -0x1] XOR EBP,EBP LAB_00101217: CMP R15D,0x1 JZ 0x0010156f LAB_00101221: LEA R12D,[R15 + -0x1] XOR R14D,R14D MOV dword ptr [RSP + 0x1c],EBP MOV R13D,R12D MOV EBP,R14D MOV EBX,R12D LAB_00101235: CMP EBX,0x1 JZ 0x00101544 LAB_0010123e: MOV dword ptr [RSP + 0x24],R15D LEA ECX,[RBX + -0x1] XOR R14D,R14D MOV R12D,EBX MOV dword ptr [RSP + 0x20],EBP MOV EBX,ECX MOV EBP,R14D LAB_00101255: CMP EBX,0x1 JZ 0x00101517 MOV dword ptr [RSP + 0x28],R13D LEA EDI,[RBX + -0x1] MOV EAX,R12D XOR R15D,R15D MOV dword ptr [RSP + 0x2c],EBX MOV R12D,EDI LAB_00101273: CMP R12D,0x1 JZ 0x001014de MOV dword ptr [RSP + 0x30],EBP LEA R11D,[R12 + -0x1] MOV R10D,ECX XOR R13D,R13D MOV ECX,R15D MOV EBX,R11D MOV R9D,EAX MOV R8D,EDI MOV R15D,R12D LAB_0010129b: CMP EBX,0x1 JZ 0x0010149f LAB_001012a4: LEA EBP,[RBX + -0x1] XOR R12D,R12D MOV EDI,ECX MOV dword ptr [RSP + 0x4],EBP MOV EAX,EBP MOV EBP,R9D LAB_001012b5: MOV R14D,EAX CMP EAX,0x1 JZ 0x00101478 LEA ESI,[RAX + -0x1] LEA EDX,[RAX + -0x2] MOV ECX,R14D MOV R9D,EDI MOV EAX,ESI MOV dword ptr [RSP],EDX MOV EDI,EDX AND EAX,0xfffffffe SUB ECX,EAX MOV EAX,R14D MOV dword ptr [RSP + 0x18],ECX XOR ECX,ECX LAB_001012e2: MOV EDX,dword ptr [RSP + 0x18] CMP EAX,EDX JZ 0x001014c0 MOV R14D,EDI MOV dword ptr [RSP + 0x8],R9D XOR EDX,EDX MOV R9D,EBX MOV dword ptr [RSP + 0x10],ECX MOV EBX,R14D MOV ECX,R15D MOV R15D,EBP MOV dword ptr [RSP + 0xc],EAX MOV dword ptr [RSP + 0x14],EDI CMP R14D,0x1 JBE 0x0010138a LAB_00101316: XOR EBP,EBP LAB_00101318: LEA EDI,[RBX + -0x1] SUB EBX,0x2 MOV dword ptr [RSP + 0x4c],ESI MOV dword ptr [RSP + 0x48],R9D MOV dword ptr [RSP + 0x44],ECX MOV dword ptr [RSP + 0x40],R11D MOV dword ptr [RSP + 0x3c],R8D MOV dword ptr [RSP + 0x38],R10D MOV dword ptr [RSP + 0x34],EDX CALL 0x001011f0 CMP EBX,0x1 MOV EDX,dword ptr [RSP + 0x34] MOV ECX,dword ptr [RSP + 0x44] MOV R10D,dword ptr [RSP + 0x38] MOV R8D,dword ptr [RSP + 0x3c] LEA EBP,[RBP + RAX*0x2] MOV R11D,dword ptr [RSP + 0x40] MOV R9D,dword ptr [RSP + 0x48] MOV ESI,dword ptr [RSP + 0x4c] JA 0x00101318 LEA EDX,[RDX + RBP*0x2 + 0x2] LEA EDI,[R14 + -0x2] CMP R14D,0x2 JZ 0x001014f8 MOV R14D,EDI MOV EBX,R14D CMP R14D,0x1 JA 0x00101316 LAB_0010138a: MOV EBP,R15D MOV EBX,R9D MOV R15D,ECX MOV EAX,dword ptr [RSP + 0xc] MOV ECX,dword ptr [RSP + 0x10] MOV R9D,dword ptr [RSP + 0x8] ADD EDX,0x2 MOV EDI,dword ptr [RSP + 0x14] LAB_001013a7: SUB EAX,0x2 LEA ECX,[RCX + RDX*0x2 + 0x2] SUB EDI,0x2 CMP EAX,0x1 JNZ 0x001012e2 MOV EDX,dword ptr [RSP] MOV EDI,R9D LEA R12D,[R12 + RCX*0x2 + 0x2] CMP ESI,0x1 JNZ 0x001014d7 LAB_001013ce: MOV R9D,EBP MOV EBP,dword ptr [RSP + 0x4] MOV ECX,EDI LEA R13D,[R13 + R12*0x2 + 0x2] SUB EBX,0x2 CMP EBP,0x1 JNZ 0x0010129b LAB_001013e8: MOV EBP,dword ptr [RSP + 0x30] MOV R12D,R15D MOV EAX,R9D MOV R15D,ECX MOV EDI,R8D MOV ECX,R10D LAB_001013fb: LEA R15D,[R15 + R13*0x2 + 0x2] SUB R12D,0x2 CMP R11D,0x1 JNZ 0x00101273 MOV R13D,dword ptr [RSP + 0x28] MOV EBX,dword ptr [RSP + 0x2c] MOV R12D,EAX LAB_0010141a: LEA EBP,[RBP + R15*0x2 + 0x2] SUB EBX,0x2 CMP EDI,0x1 JNZ 0x00101255 MOV R14D,EBP MOV EBP,dword ptr [RSP + 0x20] MOV EBX,R12D MOV R15D,dword ptr [RSP + 0x24] SUB EBX,0x2 LEA EBP,[RBP + R14*0x2 + 0x2] CMP ECX,0x1 JNZ 0x00101235 LAB_0010144b: MOV R14D,EBP MOV EBP,dword ptr [RSP + 0x1c] MOV R12D,R13D SUB R15D,0x2 LEA EBP,[RBP + R14*0x2 + 0x2] CMP R12D,0x1 JNZ 0x00101217 LAB_00101468: MOV R14D,EBP ADD R14D,0x1 JMP 0x00101576 LAB_00101478: MOV R9D,EBP MOV EBP,dword ptr [RSP + 0x4] ADD R12D,0x2 MOV ECX,EDI LEA R13D,[R13 + R12*0x2 + 0x2] SUB EBX,0x2 CMP EBP,0x1 JZ 0x001013e8 CMP EBX,0x1 JNZ 0x001012a4 LAB_0010149f: MOV R12D,R15D MOV EBP,dword ptr [RSP + 0x30] MOV R15D,ECX MOV EAX,R9D MOV EDI,R8D MOV ECX,R10D ADD R13D,0x2 JMP 0x001013fb LAB_001014c0: ADD ECX,0x2 MOV EDX,dword ptr [RSP] MOV EDI,R9D LEA R12D,[R12 + RCX*0x2 + 0x2] CMP ESI,0x1 JZ 0x001013ce LAB_001014d7: MOV EAX,EDX JMP 0x001012b5 LAB_001014de: MOV R13D,dword ptr [RSP + 0x28] MOV EBX,dword ptr [RSP + 0x2c] MOV R12D,EAX ADD R15D,0x2 JMP 0x0010141a LAB_001014f8: MOV EBP,R15D MOV EBX,R9D MOV R15D,ECX MOV EAX,dword ptr [RSP + 0xc] MOV ECX,dword ptr [RSP + 0x10] MOV R9D,dword ptr [RSP + 0x8] MOV EDI,dword ptr [RSP + 0x14] JMP 0x001013a7 LAB_00101517: MOV R14D,EBP MOV EBP,dword ptr [RSP + 0x20] MOV EBX,R12D MOV R15D,dword ptr [RSP + 0x24] ADD R14D,0x2 SUB EBX,0x2 LEA EBP,[RBP + R14*0x2 + 0x2] CMP ECX,0x1 JZ 0x0010144b CMP EBX,0x1 JNZ 0x0010123e LAB_00101544: MOV R14D,EBP MOV EBP,dword ptr [RSP + 0x1c] MOV R12D,R13D SUB R15D,0x2 ADD R14D,0x2 LEA EBP,[RBP + R14*0x2 + 0x2] CMP R12D,0x1 JZ 0x00101468 CMP R15D,0x1 JNZ 0x00101221 LAB_0010156f: MOV R14D,EBP ADD R14D,0x3 LAB_00101576: ADD RSP,0x58 MOV EAX,R14D POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int func0(uint param_1) { int iVar1; uint uVar2; uint uVar3; int iVar4; uint uVar5; int iVar6; int iVar7; int iVar8; uint uVar9; uint uVar10; int iVar11; int iVar12; uint uVar13; int iVar14; int iVar15; uint uVar16; int iVar17; int iVar18; int iVar19; int iVar20; uint uVar21; int iVar22; int iVar23; int iVar24; int iVar25; int iVar26; int iVar27; bool bVar28; iVar18 = 1; if (1 < param_1) { iVar8 = param_1 - 1; iVar18 = 0; do { if (iVar8 == 1) { return iVar18 + 3; } iVar22 = iVar8 + -1; iVar15 = 0; iVar7 = iVar22; do { if (iVar7 == 1) { iVar18 = iVar18 + 2 + (iVar15 + 2) * 2; goto joined_r0x0010155f; } iVar1 = iVar7 + -1; iVar26 = 0; iVar14 = iVar1; do { if (iVar14 == 1) { iVar15 = iVar15 + 2 + (iVar26 + 2) * 2; goto joined_r0x00101445; } iVar19 = iVar14 + -1; iVar27 = 0; iVar24 = iVar19; do { if (iVar24 == 1) { iVar27 = iVar27 + 2; break; } iVar4 = iVar24 + -1; iVar25 = 0; iVar6 = iVar4; do { if (iVar6 == 1) { iVar25 = iVar25 + 2; break; } uVar16 = iVar6 - 1; iVar23 = 0; uVar9 = uVar16; do { if (uVar9 == 1) { iVar25 = iVar25 + 2 + (iVar23 + 2) * 2; goto joined_r0x00101490; } uVar2 = uVar9 - 1; uVar3 = uVar9 - 2; uVar10 = uVar9 - (uVar2 & 0xfffffffe); iVar11 = 0; uVar21 = uVar3; do { if (uVar9 == uVar10) { iVar23 = iVar23 + 2 + (iVar11 + 2) * 2; goto joined_r0x001014d1; } iVar12 = 0; uVar5 = uVar21; do { if (uVar5 < 2) { iVar12 = iVar12 + 2; break; } iVar17 = 0; uVar13 = uVar5; do { iVar20 = uVar13 - 1; uVar13 = uVar13 - 2; iVar20 = func0(iVar20); iVar17 = iVar17 + iVar20 * 2; } while (1 < uVar13); iVar12 = iVar12 + 2 + iVar17 * 2; bVar28 = uVar5 != 2; uVar5 = uVar5 - 2; } while (bVar28); uVar9 = uVar9 - 2; iVar11 = iVar11 + 2 + iVar12 * 2; uVar21 = uVar21 - 2; } while (uVar9 != 1); iVar23 = iVar23 + 2 + iVar11 * 2; joined_r0x001014d1: uVar9 = uVar3; } while (uVar2 != 1); iVar25 = iVar25 + 2 + iVar23 * 2; joined_r0x00101490: iVar6 = iVar6 + -2; } while (uVar16 != 1); iVar27 = iVar27 + 2 + iVar25 * 2; iVar24 = iVar24 + -2; } while (iVar4 != 1); iVar26 = iVar26 + 2 + iVar27 * 2; iVar14 = iVar14 + -2; } while (iVar19 != 1); iVar15 = iVar15 + 2 + iVar26 * 2; joined_r0x00101445: iVar7 = iVar7 + -2; } while (iVar1 != 1); iVar18 = iVar18 + 2 + iVar15 * 2; joined_r0x0010155f: iVar8 = iVar8 + -2; } while (iVar22 != 1); iVar18 = iVar18 + 1; } return iVar18; }
4,936
func0
#include <stdio.h> #include <assert.h>
int* func0(int test_tup1[], int test_tup2[], int* result, int size) { for(int i = 0; i < size; i++) { result[i] = test_tup1[i] / test_tup2[i]; } return result; }
int main() { int result1[4]; int result2[4]; int result3[4]; int tuple1_1[4] = {10, 4, 6, 9}; int tuple2_1[4] = {5, 2, 3, 3}; func0(tuple1_1, tuple2_1, result1, 4); assert(result1[0] == 2 && result1[1] == 2 && result1[2] == 2 && result1[3] == 3); int tuple1_2[4] = {12, 6, 8, 16}; int tuple2_2[4] = {6, 3, 4, 4}; func0(tuple1_2, tuple2_2, result2, 4); assert(result2[0] == 2 && result2[1] == 2 && result2[2] == 2 && result2[3] == 4); int tuple1_3[4] = {20, 14, 36, 18}; int tuple2_3[4] = {5, 7, 6, 9}; func0(tuple1_3, tuple2_3, result3, 4); assert(result3[0] == 4 && result3[1] == 2 && result3[2] == 6 && result3[3] == 2); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %rdx,-0x28(%rbp) mov %ecx,-0x2c(%rbp) movl $0x0,-0x4(%rbp) jmp 11d4 <func0+0x6b> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov -0x4(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x20(%rbp),%rdx add %rcx,%rdx mov (%rdx),%edi mov -0x4(%rbp),%ecx movslq %ecx,%rcx lea 0x0(,%rcx,4),%rsi mov -0x28(%rbp),%rcx add %rsi,%rcx cltd idiv %edi mov %eax,(%rcx) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x2c(%rbp),%eax jl 1189 <func0+0x20> mov -0x28(%rbp),%rax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_28], rdx mov [rbp+var_2C], ecx mov [rbp+var_4], 0 jmp short loc_11D4 loc_1189: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] mov edx, [rbp+var_4] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+var_20] add rdx, rcx mov edi, [rdx] mov ecx, [rbp+var_4] movsxd rcx, ecx lea rsi, ds:0[rcx*4] mov rcx, [rbp+var_28] add rcx, rsi cdq idiv edi mov [rcx], eax add [rbp+var_4], 1 loc_11D4: mov eax, [rbp+var_4] cmp eax, [rbp+var_2C] jl short loc_1189 mov rax, [rbp+var_28] pop rbp retn
long long func0(long long a1, long long a2, long long a3, int a4) { int i; // [rsp+28h] [rbp-4h] for ( i = 0; i < a4; ++i ) *(_DWORD *)(4LL * i + a3) = *(_DWORD *)(4LL * i + a1) / *(_DWORD *)(4LL * i + a2); return a3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x2c],ECX MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011d4 LAB_00101189: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV EDX,dword ptr [RBP + -0x4] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x20] ADD RDX,RCX MOV EDI,dword ptr [RDX] MOV ECX,dword ptr [RBP + -0x4] MOVSXD RCX,ECX LEA RSI,[RCX*0x4] MOV RCX,qword ptr [RBP + -0x28] ADD RCX,RSI CDQ IDIV EDI MOV dword ptr [RCX],EAX ADD dword ptr [RBP + -0x4],0x1 LAB_001011d4: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x2c] JL 0x00101189 MOV RAX,qword ptr [RBP + -0x28] POP RBP RET
int [16] func0(long param_1,long param_2,ulong param_3,int param_4) { int iVar1; int iVar2; ulong uVar3; int auVar4 [16]; int4 local_c; uVar3 = param_3; for (local_c = 0; local_c < param_4; local_c = local_c + 1) { iVar1 = *(int *)(param_1 + (long)local_c * 4); iVar2 = *(int *)(param_2 + (long)local_c * 4); uVar3 = (long)iVar1 % (long)iVar2 & 0xffffffff; *(int *)(param_3 + (long)local_c * 4) = iVar1 / iVar2; } auVar4._8_8_ = uVar3; auVar4._0_8_ = param_3; return auVar4; }
4,937
func0
#include <stdio.h> #include <assert.h>
int* func0(int test_tup1[], int test_tup2[], int* result, int size) { for(int i = 0; i < size; i++) { result[i] = test_tup1[i] / test_tup2[i]; } return result; }
int main() { int result1[4]; int result2[4]; int result3[4]; int tuple1_1[4] = {10, 4, 6, 9}; int tuple2_1[4] = {5, 2, 3, 3}; func0(tuple1_1, tuple2_1, result1, 4); assert(result1[0] == 2 && result1[1] == 2 && result1[2] == 2 && result1[3] == 3); int tuple1_2[4] = {12, 6, 8, 16}; int tuple2_2[4] = {6, 3, 4, 4}; func0(tuple1_2, tuple2_2, result2, 4); assert(result2[0] == 2 && result2[1] == 2 && result2[2] == 2 && result2[3] == 4); int tuple1_3[4] = {20, 14, 36, 18}; int tuple2_3[4] = {5, 7, 6, 9}; func0(tuple1_3, tuple2_3, result3, 4); assert(result3[0] == 4 && result3[1] == 2 && result3[2] == 6 && result3[3] == 2); return 0; }
O1
c
func0: endbr64 mov %rdx,%r8 test %ecx,%ecx jle 1194 <func0+0x2b> lea -0x1(%rcx),%r9d mov $0x0,%ecx mov (%rdi,%rcx,4),%eax cltd idivl (%rsi,%rcx,4) mov %eax,(%r8,%rcx,4) mov %rcx,%rax add $0x1,%rcx cmp %r9,%rax jne 117d <func0+0x14> mov %r8,%rax retq
func0: endbr64 mov r9, rdx test ecx, ecx jle short loc_1192 mov ecx, ecx mov r8d, 0 loc_117C: mov eax, [rdi+r8*4] cdq idiv dword ptr [rsi+r8*4] mov [r9+r8*4], eax add r8, 1 cmp r8, rcx jnz short loc_117C loc_1192: mov rax, r9 retn
long long func0(long long a1, long long a2, long long a3, int a4) { long long i; // r8 if ( a4 > 0 ) { for ( i = 0LL; i != a4; ++i ) *(_DWORD *)(a3 + 4 * i) = *(_DWORD *)(a1 + 4 * i) / *(_DWORD *)(a2 + 4 * i); } return a3; }
func0: ENDBR64 MOV R9,RDX TEST ECX,ECX JLE 0x00101192 MOV ECX,ECX MOV R8D,0x0 LAB_0010117c: MOV EAX,dword ptr [RDI + R8*0x4] CDQ IDIV dword ptr [RSI + R8*0x4] MOV dword ptr [R9 + R8*0x4],EAX ADD R8,0x1 CMP R8,RCX JNZ 0x0010117c LAB_00101192: MOV RAX,R9 RET
int1 [16] func0(long param_1,long param_2,ulong param_3,uint param_4) { int iVar1; int iVar2; ulong uVar3; ulong uVar4; int1 auVar5 [16]; uVar3 = param_3; if (0 < (int)param_4) { uVar4 = 0; do { iVar1 = *(int *)(param_1 + uVar4 * 4); iVar2 = *(int *)(param_2 + uVar4 * 4); uVar3 = (long)iVar1 % (long)iVar2 & 0xffffffff; *(int *)(param_3 + uVar4 * 4) = iVar1 / iVar2; uVar4 = uVar4 + 1; } while (uVar4 != param_4); } auVar5._8_8_ = uVar3; auVar5._0_8_ = param_3; return auVar5; }
4,938
func0
#include <stdio.h> #include <assert.h>
int* func0(int test_tup1[], int test_tup2[], int* result, int size) { for(int i = 0; i < size; i++) { result[i] = test_tup1[i] / test_tup2[i]; } return result; }
int main() { int result1[4]; int result2[4]; int result3[4]; int tuple1_1[4] = {10, 4, 6, 9}; int tuple2_1[4] = {5, 2, 3, 3}; func0(tuple1_1, tuple2_1, result1, 4); assert(result1[0] == 2 && result1[1] == 2 && result1[2] == 2 && result1[3] == 3); int tuple1_2[4] = {12, 6, 8, 16}; int tuple2_2[4] = {6, 3, 4, 4}; func0(tuple1_2, tuple2_2, result2, 4); assert(result2[0] == 2 && result2[1] == 2 && result2[2] == 2 && result2[3] == 4); int tuple1_3[4] = {20, 14, 36, 18}; int tuple2_3[4] = {5, 7, 6, 9}; func0(tuple1_3, tuple2_3, result3, 4); assert(result3[0] == 4 && result3[1] == 2 && result3[2] == 6 && result3[3] == 2); return 0; }
O2
c
func0: endbr64 mov %rdx,%r8 test %ecx,%ecx jle 116f <func0+0x2f> lea -0x1(%rcx),%r9d xor %ecx,%ecx nopl 0x0(%rax) mov (%rdi,%rcx,4),%eax cltd idivl (%rsi,%rcx,4) mov %eax,(%r8,%rcx,4) mov %rcx,%rax add $0x1,%rcx cmp %r9,%rax jne 1158 <func0+0x18> mov %r8,%rax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 mov r9, rdx test ecx, ecx jle short loc_13FE movsxd rcx, ecx xor r8d, r8d nop dword ptr [rax+00000000h] loc_13E8: mov eax, [rdi+r8*4] cdq idiv dword ptr [rsi+r8*4] mov [r9+r8*4], eax add r8, 1 cmp rcx, r8 jnz short loc_13E8 loc_13FE: mov rax, r9 retn
long long func0(long long a1, long long a2, long long a3, int a4) { long long i; // r8 if ( a4 > 0 ) { for ( i = 0LL; i != a4; ++i ) *(_DWORD *)(a3 + 4 * i) = *(_DWORD *)(a1 + 4 * i) / *(_DWORD *)(a2 + 4 * i); } return a3; }
func0: ENDBR64 MOV R9,RDX TEST ECX,ECX JLE 0x001013fe MOVSXD RCX,ECX XOR R8D,R8D NOP dword ptr [RAX] LAB_001013e8: MOV EAX,dword ptr [RDI + R8*0x4] CDQ IDIV dword ptr [RSI + R8*0x4] MOV dword ptr [R9 + R8*0x4],EAX ADD R8,0x1 CMP RCX,R8 JNZ 0x001013e8 LAB_001013fe: MOV RAX,R9 RET
int1 [16] func0(long param_1,long param_2,ulong param_3,int param_4) { int iVar1; int iVar2; ulong uVar3; long lVar4; int1 auVar5 [16]; uVar3 = param_3; if (0 < param_4) { lVar4 = 0; do { iVar1 = *(int *)(param_1 + lVar4 * 4); iVar2 = *(int *)(param_2 + lVar4 * 4); uVar3 = (long)iVar1 % (long)iVar2 & 0xffffffff; *(int *)(param_3 + lVar4 * 4) = iVar1 / iVar2; lVar4 = lVar4 + 1; } while (param_4 != lVar4); } auVar5._8_8_ = uVar3; auVar5._0_8_ = param_3; return auVar5; }
4,939
func0
#include <stdio.h> #include <assert.h>
int* func0(int test_tup1[], int test_tup2[], int* result, int size) { for(int i = 0; i < size; i++) { result[i] = test_tup1[i] / test_tup2[i]; } return result; }
int main() { int result1[4]; int result2[4]; int result3[4]; int tuple1_1[4] = {10, 4, 6, 9}; int tuple2_1[4] = {5, 2, 3, 3}; func0(tuple1_1, tuple2_1, result1, 4); assert(result1[0] == 2 && result1[1] == 2 && result1[2] == 2 && result1[3] == 3); int tuple1_2[4] = {12, 6, 8, 16}; int tuple2_2[4] = {6, 3, 4, 4}; func0(tuple1_2, tuple2_2, result2, 4); assert(result2[0] == 2 && result2[1] == 2 && result2[2] == 2 && result2[3] == 4); int tuple1_3[4] = {20, 14, 36, 18}; int tuple2_3[4] = {5, 7, 6, 9}; func0(tuple1_3, tuple2_3, result3, 4); assert(result3[0] == 4 && result3[1] == 2 && result3[2] == 6 && result3[3] == 2); return 0; }
O3
c
func0: endbr64 mov %rdx,%r8 test %ecx,%ecx jle 116f <func0+0x2f> lea -0x1(%rcx),%r9d xor %ecx,%ecx nopl 0x0(%rax) mov (%rdi,%rcx,4),%eax cltd idivl (%rsi,%rcx,4) mov %eax,(%r8,%rcx,4) mov %rcx,%rax add $0x1,%rcx cmp %rax,%r9 jne 1158 <func0+0x18> mov %r8,%rax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 mov r9, rdi mov r8, rdx test ecx, ecx jle short loc_1175 movsxd rcx, ecx lea rdi, ds:0[rcx*4] xor ecx, ecx nop dword ptr [rax+rax+00h] loc_1160: mov eax, [r9+rcx] cdq idiv dword ptr [rsi+rcx] mov [r8+rcx], eax add rcx, 4 cmp rdi, rcx jnz short loc_1160 loc_1175: mov rax, r8 retn
long long func0(long long a1, long long a2, long long a3, int a4) { long long v5; // rdi long long v6; // rcx if ( a4 > 0 ) { v5 = 4LL * a4; v6 = 0LL; do { *(_DWORD *)(a3 + v6) = *(_DWORD *)(a1 + v6) / *(_DWORD *)(a2 + v6); v6 += 4LL; } while ( v5 != v6 ); } return a3; }
func0: ENDBR64 MOV R9,RDI MOV R8,RDX TEST ECX,ECX JLE 0x00101175 MOVSXD RCX,ECX LEA RDI,[RCX*0x4] XOR ECX,ECX NOP dword ptr [RAX + RAX*0x1] LAB_00101160: MOV EAX,dword ptr [R9 + RCX*0x1] CDQ IDIV dword ptr [RSI + RCX*0x1] MOV dword ptr [R8 + RCX*0x1],EAX ADD RCX,0x4 CMP RDI,RCX JNZ 0x00101160 LAB_00101175: MOV RAX,R8 RET
int [16] func0(long param_1,long param_2,ulong param_3,int param_4) { long lVar1; ulong uVar2; int auVar3 [16]; uVar2 = param_3; if (0 < param_4) { lVar1 = 0; do { uVar2 = (long)*(int *)(param_1 + lVar1) % (long)*(int *)(param_2 + lVar1) & 0xffffffff; *(int *)(param_3 + lVar1) = *(int *)(param_1 + lVar1) / *(int *)(param_2 + lVar1); lVar1 = lVar1 + 4; } while ((long)param_4 * 4 - lVar1 != 0); } auVar3._8_8_ = uVar2; auVar3._0_8_ = param_3; return auVar3; }
4,940
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { int* first; int first_size; int* second; int second_size; } SplitInt; typedef struct { char* first; int first_size; char* second; int second_size; } SplitChar; SplitInt split_two_parts_int(int list1[], int length, int L) { SplitInt result; result.first_size = L; result.second_size = length - L; result.first = malloc(result.first_size * sizeof(int)); result.second = malloc(result.second_size * sizeof(int)); memcpy(result.first, list1, result.first_size * sizeof(int)); memcpy(result.second, list1 + L, result.second_size * sizeof(int)); return result; }
SplitChar func0(char list1[], int length, int L) { SplitChar result; result.first_size = L; result.second_size = length - L; result.first = malloc((result.first_size + 1) * sizeof(char)); result.second = malloc((result.second_size + 1) * sizeof(char)); memcpy(result.first, list1, result.first_size * sizeof(char)); result.first[result.first_size] = '\0'; memcpy(result.second, list1 + L, result.second_size * sizeof(char)); result.second[result.second_size] = '\0'; return result; }
int main() { // Test 1: Integers int list1_int[] = {1, 1, 2, 3, 4, 4, 5, 1}; SplitInt split1 = split_two_parts_int(list1_int, 8, 3); int expected1_first[] = {1, 1, 2}; int expected1_second[] = {3, 4, 4, 5, 1}; assert(split1.first_size == 3); assert(split1.second_size == 5); assert(memcmp(split1.first, expected1_first, 3 * sizeof(int)) == 0); assert(memcmp(split1.second, expected1_second, 5 * sizeof(int)) == 0); free(split1.first); free(split1.second); // Test 2: Characters char list1_char2[] = {'a', 'b', 'c', 'd'}; SplitChar split2 = func0(list1_char2, 4, 2); char expected2_first[] = "ab"; char expected2_second[] = "cd"; assert(split2.first_size == 2); assert(split2.second_size == 2); assert(strcmp(split2.first, expected2_first) == 0); assert(strcmp(split2.second, expected2_second) == 0); free(split2.first); free(split2.second); // Test 3: Characters char list1_char3[] = {'p', 'y', 't', 'h', 'o', 'n'}; SplitChar split3 = func0(list1_char3, 6, 4); char expected3_first[] = "pyth"; char expected3_second[] = "on"; assert(split3.first_size == 4); assert(split3.second_size == 2); assert(strcmp(split3.first, expected3_first) == 0); assert(strcmp(split3.second, expected3_second) == 0); free(split3.first); free(split3.second); printf("All assertions passed.\n"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x40,%rsp mov %rdi,-0x28(%rbp) mov %rsi,-0x30(%rbp) mov %edx,-0x34(%rbp) mov %ecx,-0x38(%rbp) mov -0x38(%rbp),%eax mov %eax,-0x18(%rbp) mov -0x34(%rbp),%eax sub -0x38(%rbp),%eax mov %eax,-0x8(%rbp) mov -0x18(%rbp),%eax add $0x1,%eax cltq mov %rax,%rdi callq 1130 <malloc@plt> mov %rax,-0x20(%rbp) mov -0x8(%rbp),%eax add $0x1,%eax cltq mov %rax,%rdi callq 1130 <malloc@plt> mov %rax,-0x10(%rbp) mov -0x18(%rbp),%eax movslq %eax,%rdx mov -0x20(%rbp),%rax mov -0x30(%rbp),%rcx mov %rcx,%rsi mov %rax,%rdi callq 1120 <memcpy@plt> mov -0x20(%rbp),%rdx mov -0x18(%rbp),%eax cltq add %rdx,%rax movb $0x0,(%rax) mov -0x8(%rbp),%eax movslq %eax,%rdx mov -0x38(%rbp),%eax movslq %eax,%rcx mov -0x30(%rbp),%rax add %rax,%rcx mov -0x10(%rbp),%rax mov %rcx,%rsi mov %rax,%rdi callq 1120 <memcpy@plt> mov -0x10(%rbp),%rdx mov -0x8(%rbp),%eax cltq add %rdx,%rax movb $0x0,(%rax) mov -0x28(%rbp),%rcx mov -0x20(%rbp),%rax mov -0x18(%rbp),%rdx mov %rax,(%rcx) mov %rdx,0x8(%rcx) mov -0x10(%rbp),%rax mov -0x8(%rbp),%rdx mov %rax,0x10(%rcx) mov %rdx,0x18(%rcx) mov -0x28(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_28], rdi mov [rbp+src], rsi mov [rbp+var_34], edx mov [rbp+var_38], ecx mov eax, [rbp+var_38] mov dword ptr [rbp+var_18], eax mov eax, [rbp+var_34] sub eax, [rbp+var_38] mov dword ptr [rbp+var_8], eax mov eax, dword ptr [rbp+var_18] add eax, 1 cdqe mov rdi, rax; size call _malloc mov [rbp+dest], rax mov eax, dword ptr [rbp+var_8] add eax, 1 cdqe mov rdi, rax; size call _malloc mov [rbp+var_10], rax mov eax, dword ptr [rbp+var_18] movsxd rdx, eax; n mov rax, [rbp+dest] mov rcx, [rbp+src] mov rsi, rcx; src mov rdi, rax; dest call _memcpy mov rdx, [rbp+dest] mov eax, dword ptr [rbp+var_18] cdqe add rax, rdx mov byte ptr [rax], 0 mov eax, dword ptr [rbp+var_8] movsxd rdx, eax; n mov eax, [rbp+var_38] movsxd rcx, eax mov rax, [rbp+src] add rcx, rax mov rax, [rbp+var_10] mov rsi, rcx; src mov rdi, rax; dest call _memcpy mov rdx, [rbp+var_10] mov eax, dword ptr [rbp+var_8] cdqe add rax, rdx mov byte ptr [rax], 0 mov rcx, [rbp+var_28] mov rax, [rbp+dest] mov rdx, [rbp+var_18] mov [rcx], rax mov [rcx+8], rdx mov rax, [rbp+var_10] mov rdx, [rbp+var_8] mov [rcx+10h], rax mov [rcx+18h], rdx mov rax, [rbp+var_28] leave retn
_QWORD * func0(_QWORD *a1, char *a2, int a3, int a4) { void *dest; // [rsp+20h] [rbp-20h] long long v7; // [rsp+28h] [rbp-18h] void *v8; // [rsp+30h] [rbp-10h] long long v9; // [rsp+38h] [rbp-8h] LODWORD(v7) = a4; LODWORD(v9) = a3 - a4; dest = malloc(a4 + 1); v8 = malloc((int)v9 + 1); memcpy(dest, a2, (int)v7); *((_BYTE *)dest + (int)v7) = 0; memcpy(v8, &a2[a4], (int)v9); *((_BYTE *)v8 + (int)v9) = 0; *a1 = dest; a1[1] = v7; a1[2] = v8; a1[3] = v9; return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x28],RDI MOV qword ptr [RBP + -0x30],RSI MOV dword ptr [RBP + -0x34],EDX MOV dword ptr [RBP + -0x38],ECX MOV EAX,dword ptr [RBP + -0x38] MOV dword ptr [RBP + -0x18],EAX MOV EAX,dword ptr [RBP + -0x34] SUB EAX,dword ptr [RBP + -0x38] MOV dword ptr [RBP + -0x8],EAX MOV EAX,dword ptr [RBP + -0x18] ADD EAX,0x1 CDQE MOV RDI,RAX CALL 0x00101130 MOV qword ptr [RBP + -0x20],RAX MOV EAX,dword ptr [RBP + -0x8] ADD EAX,0x1 CDQE MOV RDI,RAX CALL 0x00101130 MOV qword ptr [RBP + -0x10],RAX MOV EAX,dword ptr [RBP + -0x18] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x20] MOV RCX,qword ptr [RBP + -0x30] MOV RSI,RCX MOV RDI,RAX CALL 0x00101120 MOV RDX,qword ptr [RBP + -0x20] MOV EAX,dword ptr [RBP + -0x18] CDQE ADD RAX,RDX MOV byte ptr [RAX],0x0 MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX MOV EAX,dword ptr [RBP + -0x38] MOVSXD RCX,EAX MOV RAX,qword ptr [RBP + -0x30] ADD RCX,RAX MOV RAX,qword ptr [RBP + -0x10] MOV RSI,RCX MOV RDI,RAX CALL 0x00101120 MOV RDX,qword ptr [RBP + -0x10] MOV EAX,dword ptr [RBP + -0x8] CDQE ADD RAX,RDX MOV byte ptr [RAX],0x0 MOV RCX,qword ptr [RBP + -0x28] MOV RAX,qword ptr [RBP + -0x20] MOV RDX,qword ptr [RBP + -0x18] MOV qword ptr [RCX],RAX MOV qword ptr [RCX + 0x8],RDX MOV RAX,qword ptr [RBP + -0x10] MOV RDX,qword ptr [RBP + -0x8] MOV qword ptr [RCX + 0x10],RAX MOV qword ptr [RCX + 0x18],RDX MOV RAX,qword ptr [RBP + -0x28] LEAVE RET
int8 * func0(int8 *param_1,void *param_2,int param_3,int param_4) { void *__dest; void *__dest_00; int4 uStack_1c; int4 uStack_c; param_3 = param_3 - param_4; __dest = malloc((long)(param_4 + 1)); __dest_00 = malloc((long)(param_3 + 1)); memcpy(__dest,param_2,(long)param_4); *(int *)((long)param_4 + (long)__dest) = 0; memcpy(__dest_00,(void *)((long)param_4 + (long)param_2),(long)param_3); *(int *)((long)param_3 + (long)__dest_00) = 0; *param_1 = __dest; param_1[1] = CONCAT44(uStack_1c,param_4); param_1[2] = __dest_00; param_1[3] = CONCAT44(uStack_c,param_3); return param_1; }
4,941
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { int* first; int first_size; int* second; int second_size; } SplitInt; typedef struct { char* first; int first_size; char* second; int second_size; } SplitChar; SplitInt split_two_parts_int(int list1[], int length, int L) { SplitInt result; result.first_size = L; result.second_size = length - L; result.first = malloc(result.first_size * sizeof(int)); result.second = malloc(result.second_size * sizeof(int)); memcpy(result.first, list1, result.first_size * sizeof(int)); memcpy(result.second, list1 + L, result.second_size * sizeof(int)); return result; }
SplitChar func0(char list1[], int length, int L) { SplitChar result; result.first_size = L; result.second_size = length - L; result.first = malloc((result.first_size + 1) * sizeof(char)); result.second = malloc((result.second_size + 1) * sizeof(char)); memcpy(result.first, list1, result.first_size * sizeof(char)); result.first[result.first_size] = '\0'; memcpy(result.second, list1 + L, result.second_size * sizeof(char)); result.second[result.second_size] = '\0'; return result; }
int main() { // Test 1: Integers int list1_int[] = {1, 1, 2, 3, 4, 4, 5, 1}; SplitInt split1 = split_two_parts_int(list1_int, 8, 3); int expected1_first[] = {1, 1, 2}; int expected1_second[] = {3, 4, 4, 5, 1}; assert(split1.first_size == 3); assert(split1.second_size == 5); assert(memcmp(split1.first, expected1_first, 3 * sizeof(int)) == 0); assert(memcmp(split1.second, expected1_second, 5 * sizeof(int)) == 0); free(split1.first); free(split1.second); // Test 2: Characters char list1_char2[] = {'a', 'b', 'c', 'd'}; SplitChar split2 = func0(list1_char2, 4, 2); char expected2_first[] = "ab"; char expected2_second[] = "cd"; assert(split2.first_size == 2); assert(split2.second_size == 2); assert(strcmp(split2.first, expected2_first) == 0); assert(strcmp(split2.second, expected2_second) == 0); free(split2.first); free(split2.second); // Test 3: Characters char list1_char3[] = {'p', 'y', 't', 'h', 'o', 'n'}; SplitChar split3 = func0(list1_char3, 6, 4); char expected3_first[] = "pyth"; char expected3_second[] = "on"; assert(split3.first_size == 4); assert(split3.second_size == 2); assert(strcmp(split3.first, expected3_first) == 0); assert(strcmp(split3.second, expected3_second) == 0); free(split3.first); free(split3.second); printf("All assertions passed.\n"); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov %rdi,%rbx mov %rsi,0x8(%rsp) mov %ecx,%ebp sub %ecx,%edx mov %edx,%r12d lea 0x1(%rcx),%edi movslq %edi,%rdi callq 1130 <malloc@plt> mov %rax,%r14 lea 0x1(%r12),%edi movslq %edi,%rdi callq 1130 <malloc@plt> mov %rax,%r13 movslq %ebp,%r15 mov %r15,%rdx mov 0x8(%rsp),%rsi mov %r14,%rdi callq 1120 <memcpy@plt> movb $0x0,(%r14,%r15,1) movslq %r12d,%rax mov 0x8(%rsp),%rsi add %r15,%rsi mov %rax,%r15 mov %rax,%rdx mov %r13,%rdi callq 1120 <memcpy@plt> movb $0x0,0x0(%r13,%r15,1) mov %r14,(%rbx) mov %ebp,0x8(%rbx) mov %r13,0x10(%rbx) mov %r12d,0x18(%rbx) mov %rbx,%rax add $0x18,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 18h mov rbx, rdi mov [rsp+48h+var_40], rsi mov ebp, ecx sub edx, ecx mov r12d, edx lea edi, [rcx+1] movsxd rdi, edi call _malloc mov r14, rax lea edi, [r12+1] movsxd rdi, edi call _malloc mov r13, rax movsxd r15, ebp mov rdx, r15 mov rsi, [rsp+48h+var_40] mov rdi, r14 call _memcpy mov byte ptr [r14+r15], 0 movsxd rax, r12d mov rsi, [rsp+48h+var_40] add rsi, r15 mov r15, rax mov rdx, rax mov rdi, r13 call _memcpy mov byte ptr [r13+r15+0], 0 mov [rbx], r14 mov [rbx+8], ebp mov [rbx+10h], r13 mov [rbx+18h], r12d mov rax, rbx add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1, long long a2, int a3, int a4) { int v5; // r12d long long v6; // r14 long long v7; // r13 v5 = a3 - a4; v6 = malloc(a4 + 1); v7 = malloc(v5 + 1); memcpy(v6, a2, a4); *(_BYTE *)(v6 + a4) = 0; memcpy(v7, a4 + a2, v5); *(_BYTE *)(v7 + v5) = 0; *(_QWORD *)a1 = v6; *(_DWORD *)(a1 + 8) = a4; *(_QWORD *)(a1 + 16) = v7; *(_DWORD *)(a1 + 24) = v5; return a1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV RBX,RDI MOV qword ptr [RSP + 0x8],RSI MOV EBP,ECX SUB EDX,ECX MOV R12D,EDX LEA EDI,[RCX + 0x1] MOVSXD RDI,EDI CALL 0x00101130 MOV R14,RAX LEA EDI,[R12 + 0x1] MOVSXD RDI,EDI CALL 0x00101130 MOV R13,RAX MOVSXD R15,EBP MOV RDX,R15 MOV RSI,qword ptr [RSP + 0x8] MOV RDI,R14 CALL 0x00101120 MOV byte ptr [R14 + R15*0x1],0x0 MOVSXD RAX,R12D MOV RSI,qword ptr [RSP + 0x8] ADD RSI,R15 MOV R15,RAX MOV RDX,RAX MOV RDI,R13 CALL 0x00101120 MOV byte ptr [R13 + R15*0x1],0x0 MOV qword ptr [RBX],R14 MOV dword ptr [RBX + 0x8],EBP MOV qword ptr [RBX + 0x10],R13 MOV dword ptr [RBX + 0x18],R12D MOV RAX,RBX ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int8 * func0(int8 *param_1,void *param_2,int param_3,int param_4) { void *__dest; void *__dest_00; size_t __n; param_3 = param_3 - param_4; __dest = malloc((long)(param_4 + 1)); __dest_00 = malloc((long)(param_3 + 1)); __n = (size_t)param_4; memcpy(__dest,param_2,__n); *(int1 *)((long)__dest + __n) = 0; memcpy(__dest_00,(void *)((long)param_2 + __n),(long)param_3); *(int1 *)((long)__dest_00 + (long)param_3) = 0; *param_1 = __dest; *(int *)(param_1 + 1) = param_4; param_1[2] = __dest_00; *(int *)(param_1 + 3) = param_3; return param_1; }
4,942
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { int* first; int first_size; int* second; int second_size; } SplitInt; typedef struct { char* first; int first_size; char* second; int second_size; } SplitChar; SplitInt split_two_parts_int(int list1[], int length, int L) { SplitInt result; result.first_size = L; result.second_size = length - L; result.first = malloc(result.first_size * sizeof(int)); result.second = malloc(result.second_size * sizeof(int)); memcpy(result.first, list1, result.first_size * sizeof(int)); memcpy(result.second, list1 + L, result.second_size * sizeof(int)); return result; }
SplitChar func0(char list1[], int length, int L) { SplitChar result; result.first_size = L; result.second_size = length - L; result.first = malloc((result.first_size + 1) * sizeof(char)); result.second = malloc((result.second_size + 1) * sizeof(char)); memcpy(result.first, list1, result.first_size * sizeof(char)); result.first[result.first_size] = '\0'; memcpy(result.second, list1 + L, result.second_size * sizeof(char)); result.second[result.second_size] = '\0'; return result; }
int main() { // Test 1: Integers int list1_int[] = {1, 1, 2, 3, 4, 4, 5, 1}; SplitInt split1 = split_two_parts_int(list1_int, 8, 3); int expected1_first[] = {1, 1, 2}; int expected1_second[] = {3, 4, 4, 5, 1}; assert(split1.first_size == 3); assert(split1.second_size == 5); assert(memcmp(split1.first, expected1_first, 3 * sizeof(int)) == 0); assert(memcmp(split1.second, expected1_second, 5 * sizeof(int)) == 0); free(split1.first); free(split1.second); // Test 2: Characters char list1_char2[] = {'a', 'b', 'c', 'd'}; SplitChar split2 = func0(list1_char2, 4, 2); char expected2_first[] = "ab"; char expected2_second[] = "cd"; assert(split2.first_size == 2); assert(split2.second_size == 2); assert(strcmp(split2.first, expected2_first) == 0); assert(strcmp(split2.second, expected2_second) == 0); free(split2.first); free(split2.second); // Test 3: Characters char list1_char3[] = {'p', 'y', 't', 'h', 'o', 'n'}; SplitChar split3 = func0(list1_char3, 6, 4); char expected3_first[] = "pyth"; char expected3_second[] = "on"; assert(split3.first_size == 4); assert(split3.second_size == 2); assert(strcmp(split3.first, expected3_first) == 0); assert(strcmp(split3.second, expected3_second) == 0); free(split3.first); free(split3.second); printf("All assertions passed.\n"); return 0; }
O2
c
func0: endbr64 push %r15 sub %ecx,%edx push %r14 push %r13 mov %edx,%r13d push %r12 mov %rdi,%r12 lea 0x1(%rcx),%edi push %rbp movslq %edi,%rdi mov %rsi,%rbp push %rbx mov %ecx,%ebx sub $0x18,%rsp callq 1110 <malloc@plt> lea 0x1(%r13),%edi mov %rax,%r15 movslq %edi,%rdi callq 1110 <malloc@plt> movslq %ebx,%rdx mov %rbp,%rsi mov %r15,%rdi mov %rax,%r14 mov %rdx,0x8(%rsp) callq 1100 <memcpy@plt> mov 0x8(%rsp),%rdx movslq %r13d,%rcx mov %r14,%rdi mov %rcx,0x8(%rsp) movb $0x0,(%r15,%rdx,1) lea 0x0(%rbp,%rdx,1),%rsi mov %rcx,%rdx callq 1100 <memcpy@plt> mov 0x8(%rsp),%rcx mov %r15,(%r12) mov %r12,%rax mov %ebx,0x8(%r12) mov %r14,0x10(%r12) mov %r13d,0x18(%r12) movb $0x0,(%r14,%rcx,1) add $0x18,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq
func0: endbr64 push r15 sub edx, ecx push r14 push r13 mov r13d, edx push r12 mov r12, rdi lea edi, [rcx+1] push rbp movsxd rdi, edi mov rbp, rsi push rbx mov ebx, ecx sub rsp, 18h call _malloc lea edi, [r13+1] mov r15, rax movsxd rdi, edi call _malloc movsxd rdx, ebx mov rsi, rbp mov rdi, r15 mov r14, rax mov [rsp+48h+var_40], rdx call _memcpy mov rdx, [rsp+48h+var_40] movsxd rcx, r13d mov rdi, r14 mov [rsp+48h+var_40], rcx mov byte ptr [r15+rdx], 0 lea rsi, [rbp+rdx+0] mov rdx, rcx call _memcpy mov rcx, [rsp+48h+var_40] mov [r12], r15 mov rax, r12 mov [r12+8], ebx mov [r12+10h], r14 mov [r12+18h], r13d mov byte ptr [r14+rcx], 0 add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1, long long a2, int a3, int a4) { int v4; // r13d long long v6; // r15 long long v7; // r14 long long result; // rax v4 = a3 - a4; v6 = malloc(a4 + 1); v7 = malloc(v4 + 1); memcpy(v6, a2); *(_BYTE *)(v6 + a4) = 0; memcpy(v7, a2 + a4); *(_QWORD *)a1 = v6; result = a1; *(_DWORD *)(a1 + 8) = a4; *(_QWORD *)(a1 + 16) = v7; *(_DWORD *)(a1 + 24) = v4; *(_BYTE *)(v7 + v4) = 0; return result; }
func0: ENDBR64 PUSH R15 SUB EDX,ECX PUSH R14 PUSH R13 MOV R13D,EDX PUSH R12 MOV R12,RDI LEA EDI,[RCX + 0x1] PUSH RBP MOVSXD RDI,EDI MOV RBP,RSI PUSH RBX MOV EBX,ECX SUB RSP,0x18 CALL 0x00101110 LEA EDI,[R13 + 0x1] MOV R15,RAX MOVSXD RDI,EDI CALL 0x00101110 MOVSXD RDX,EBX MOV RSI,RBP MOV RDI,R15 MOV R14,RAX MOV qword ptr [RSP + 0x8],RDX CALL 0x00101100 MOV RDX,qword ptr [RSP + 0x8] MOVSXD RCX,R13D MOV RDI,R14 MOV qword ptr [RSP + 0x8],RCX MOV byte ptr [R15 + RDX*0x1],0x0 LEA RSI,[RBP + RDX*0x1] MOV RDX,RCX CALL 0x00101100 MOV RCX,qword ptr [RSP + 0x8] MOV qword ptr [R12],R15 MOV RAX,R12 MOV dword ptr [R12 + 0x8],EBX MOV qword ptr [R12 + 0x10],R14 MOV dword ptr [R12 + 0x18],R13D MOV byte ptr [R14 + RCX*0x1],0x0 ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int8 * func0(int8 *param_1,void *param_2,int param_3,int param_4) { void *__dest; void *__dest_00; size_t __n; param_3 = param_3 - param_4; __dest = malloc((long)(param_4 + 1)); __dest_00 = malloc((long)(param_3 + 1)); __n = (size_t)param_4; memcpy(__dest,param_2,__n); *(int1 *)((long)__dest + __n) = 0; memcpy(__dest_00,(void *)((long)param_2 + __n),(long)param_3); *param_1 = __dest; *(int *)(param_1 + 1) = param_4; param_1[2] = __dest_00; *(int *)(param_1 + 3) = param_3; *(int1 *)((long)__dest_00 + (long)param_3) = 0; return param_1; }
4,943
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { int* first; int first_size; int* second; int second_size; } SplitInt; typedef struct { char* first; int first_size; char* second; int second_size; } SplitChar; SplitInt split_two_parts_int(int list1[], int length, int L) { SplitInt result; result.first_size = L; result.second_size = length - L; result.first = malloc(result.first_size * sizeof(int)); result.second = malloc(result.second_size * sizeof(int)); memcpy(result.first, list1, result.first_size * sizeof(int)); memcpy(result.second, list1 + L, result.second_size * sizeof(int)); return result; }
SplitChar func0(char list1[], int length, int L) { SplitChar result; result.first_size = L; result.second_size = length - L; result.first = malloc((result.first_size + 1) * sizeof(char)); result.second = malloc((result.second_size + 1) * sizeof(char)); memcpy(result.first, list1, result.first_size * sizeof(char)); result.first[result.first_size] = '\0'; memcpy(result.second, list1 + L, result.second_size * sizeof(char)); result.second[result.second_size] = '\0'; return result; }
int main() { // Test 1: Integers int list1_int[] = {1, 1, 2, 3, 4, 4, 5, 1}; SplitInt split1 = split_two_parts_int(list1_int, 8, 3); int expected1_first[] = {1, 1, 2}; int expected1_second[] = {3, 4, 4, 5, 1}; assert(split1.first_size == 3); assert(split1.second_size == 5); assert(memcmp(split1.first, expected1_first, 3 * sizeof(int)) == 0); assert(memcmp(split1.second, expected1_second, 5 * sizeof(int)) == 0); free(split1.first); free(split1.second); // Test 2: Characters char list1_char2[] = {'a', 'b', 'c', 'd'}; SplitChar split2 = func0(list1_char2, 4, 2); char expected2_first[] = "ab"; char expected2_second[] = "cd"; assert(split2.first_size == 2); assert(split2.second_size == 2); assert(strcmp(split2.first, expected2_first) == 0); assert(strcmp(split2.second, expected2_second) == 0); free(split2.first); free(split2.second); // Test 3: Characters char list1_char3[] = {'p', 'y', 't', 'h', 'o', 'n'}; SplitChar split3 = func0(list1_char3, 6, 4); char expected3_first[] = "pyth"; char expected3_second[] = "on"; assert(split3.first_size == 4); assert(split3.second_size == 2); assert(strcmp(split3.first, expected3_first) == 0); assert(strcmp(split3.second, expected3_second) == 0); free(split3.first); free(split3.second); printf("All assertions passed.\n"); return 0; }
O3
c
func0: endbr64 push %r15 sub %ecx,%edx push %r14 push %r13 mov %edx,%r13d push %r12 mov %rdi,%r12 lea 0x1(%rcx),%edi push %rbp movslq %edi,%rdi mov %rsi,%rbp push %rbx mov %ecx,%ebx sub $0x18,%rsp callq 1110 <malloc@plt> lea 0x1(%r13),%edi mov %rax,%r15 movslq %edi,%rdi callq 1110 <malloc@plt> movslq %ebx,%rdx mov %rbp,%rsi mov %r15,%rdi mov %rax,%r14 mov %rdx,0x8(%rsp) callq 1100 <memcpy@plt> mov 0x8(%rsp),%rdx movslq %r13d,%rcx mov %r14,%rdi mov %rcx,0x8(%rsp) movb $0x0,(%r15,%rdx,1) lea 0x0(%rbp,%rdx,1),%rsi mov %rcx,%rdx callq 1100 <memcpy@plt> mov 0x8(%rsp),%rcx mov %r15,(%r12) mov %r12,%rax mov %ebx,0x8(%r12) mov %r14,0x10(%r12) mov %r13d,0x18(%r12) movb $0x0,(%r14,%rcx,1) add $0x18,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq
func0: endbr64 push r15 sub edx, ecx push r14 push r13 mov r13d, edx push r12 mov r12, rsi push rbp mov ebp, ecx lea ecx, [rcx+1] push rbx movsxd rcx, ecx mov rbx, rdi mov rdi, rcx; size sub rsp, 18h mov [rsp+48h+var_48], rcx call _malloc lea r8d, [r13+1] movsxd r8, r8d mov r15, rax mov rdi, r8; size mov [rsp+48h+var_40], r8 call _malloc mov rcx, [rsp+48h+var_48] movsxd rdx, ebp mov rsi, r12 mov rdi, r15 mov r14, rax mov [rsp+48h+var_48], rdx call ___memcpy_chk mov rdx, [rsp+48h+var_48] movsxd r9, r13d mov rdi, r14 mov rcx, [rsp+48h+var_40] mov [rsp+48h+var_48], r9 mov byte ptr [r15+rdx], 0 lea rsi, [r12+rdx] mov rdx, r9 call ___memcpy_chk mov r9, [rsp+48h+var_48] mov [rbx], r15 mov rax, rbx mov [rbx+8], ebp mov byte ptr [r14+r9], 0 mov [rbx+10h], r14 mov [rbx+18h], r13d add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1, long long a2, int a3, int a4) { int v4; // r13d _BYTE *v6; // r15 _BYTE *v7; // r14 long long result; // rax size_t v9; // [rsp+0h] [rbp-48h] v4 = a3 - a4; v9 = a4 + 1; v6 = malloc(v9); v7 = malloc(v4 + 1); __memcpy_chk(v6, a2, a4, v9); v6[a4] = 0; __memcpy_chk(v7, a2 + a4, v4, v4 + 1); *(_QWORD *)a1 = v6; result = a1; *(_DWORD *)(a1 + 8) = a4; v7[v4] = 0; *(_QWORD *)(a1 + 16) = v7; *(_DWORD *)(a1 + 24) = v4; return result; }
func0: ENDBR64 PUSH R15 SUB EDX,ECX PUSH R14 PUSH R13 MOV R13D,EDX PUSH R12 MOV R12,RSI PUSH RBP MOV EBP,ECX LEA ECX,[RCX + 0x1] PUSH RBX MOVSXD RCX,ECX MOV RBX,RDI MOV RDI,RCX SUB RSP,0x18 MOV qword ptr [RSP],RCX CALL 0x00101110 LEA R8D,[R13 + 0x1] MOVSXD R8,R8D MOV R15,RAX MOV RDI,R8 MOV qword ptr [RSP + 0x8],R8 CALL 0x00101110 MOV RCX,qword ptr [RSP] MOVSXD RDX,EBP MOV RSI,R12 MOV RDI,R15 MOV R14,RAX MOV qword ptr [RSP],RDX CALL 0x00101100 MOV RDX,qword ptr [RSP] MOVSXD R9,R13D MOV RDI,R14 MOV RCX,qword ptr [RSP + 0x8] MOV qword ptr [RSP],R9 MOV byte ptr [R15 + RDX*0x1],0x0 LEA RSI,[R12 + RDX*0x1] MOV RDX,R9 CALL 0x00101100 MOV R9,qword ptr [RSP] MOV qword ptr [RBX],R15 MOV RAX,RBX MOV dword ptr [RBX + 0x8],EBP MOV byte ptr [R14 + R9*0x1],0x0 MOV qword ptr [RBX + 0x10],R14 MOV dword ptr [RBX + 0x18],R13D ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int8 * func0(int8 *param_1,long param_2,int param_3,int param_4) { void *pvVar1; void *pvVar2; long lVar3; param_3 = param_3 - param_4; pvVar1 = malloc((long)(param_4 + 1)); pvVar2 = malloc((long)(param_3 + 1)); lVar3 = (long)param_4; __memcpy_chk(pvVar1,param_2,lVar3,(long)(param_4 + 1)); *(int *)((long)pvVar1 + lVar3) = 0; __memcpy_chk(pvVar2,param_2 + lVar3,(long)param_3,(long)(param_3 + 1)); *param_1 = pvVar1; *(int *)(param_1 + 1) = param_4; *(int *)((long)pvVar2 + (long)param_3) = 0; param_1[2] = pvVar2; *(int *)(param_1 + 3) = param_3; return param_1; }
4,944
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> typedef struct { char *key; int value; } dict_entry; dict_entry* merge_dict(const dict_entry *d1, size_t size1, const dict_entry *d2, size_t size2, size_t *size_out) { dict_entry *merged = malloc((size1 + size2) * sizeof(dict_entry)); for (size_t i = 0; i < size1; i++) { merged[i].key = d1[i].key; merged[i].value = d1[i].value; } for (size_t i = 0; i < size2; i++) { merged[size1 + i].key = d2[i].key; merged[size1 + i].value = d2[i].value; } *size_out = size1 + size2; return merged; }
int func0(const dict_entry *d1, size_t size1, const dict_entry *d2, size_t size2) { if (size1 != size2) return 0; for (size_t i = 0; i < size1; i++) { if (strcmp(d1[i].key, d2[i].key) != 0 || d1[i].value != d2[i].value) { return 0; } } return 1; }
int main() { // Test case 1 dict_entry d1_a[] = {{"a", 100}, {"b", 200}}; dict_entry d2_a[] = {{"x", 300}, {"y", 200}}; size_t size_a; dict_entry *merged_a = merge_dict(d1_a, 2, d2_a, 2, &size_a); dict_entry expected_a[] = {{"a", 100}, {"b", 200}, {"x", 300}, {"y", 200}}; assert(func0(merged_a, size_a, expected_a, 4)); free(merged_a); // Test case 2 dict_entry d1_b[] = {{"a", 900}, {"b", 900}, {"d", 900}}; dict_entry d2_b[] = {{"a", 900}, {"b", 900}, {"d", 900}}; size_t size_b; dict_entry *merged_b = merge_dict(d1_b, 3, d2_b, 3, &size_b); dict_entry expected_b[] = {{"a", 900}, {"b", 900}, {"d", 900}, {"a", 900}, {"b", 900}, {"d", 900}}; assert(func0(merged_b, size_b, expected_b, 6)); free(merged_b); // Test case 3 dict_entry d1_c[] = {{"a", 10}, {"b", 20}}; dict_entry d2_c[] = {{"x", 30}, {"y", 40}}; size_t size_c; dict_entry *merged_c = merge_dict(d1_c, 2, d2_c, 2, &size_c); dict_entry expected_c[] = {{"a", 10}, {"b", 20}, {"x", 30}, {"y", 40}}; assert(func0(merged_c, size_c, expected_c, 4)); free(merged_c); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %rdx,-0x28(%rbp) mov %rcx,-0x30(%rbp) mov -0x20(%rbp),%rax cmp -0x30(%rbp),%rax je 1334 <func0+0x30> mov $0x0,%eax jmpq 13c0 <func0+0xbc> movq $0x0,-0x8(%rbp) jmp 13b1 <func0+0xad> mov -0x8(%rbp),%rax shl $0x4,%rax mov %rax,%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%rdx mov -0x8(%rbp),%rax shl $0x4,%rax mov %rax,%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%rax mov %rdx,%rsi mov %rax,%rdi callq 10c0 <strcmp@plt> test %eax,%eax jne 13a5 <func0+0xa1> mov -0x8(%rbp),%rax shl $0x4,%rax mov %rax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov 0x8(%rax),%edx mov -0x8(%rbp),%rax shl $0x4,%rax mov %rax,%rcx mov -0x28(%rbp),%rax add %rcx,%rax mov 0x8(%rax),%eax cmp %eax,%edx je 13ac <func0+0xa8> mov $0x0,%eax jmp 13c0 <func0+0xbc> addq $0x1,-0x8(%rbp) mov -0x8(%rbp),%rax cmp -0x20(%rbp),%rax jb 133e <func0+0x3a> mov $0x1,%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_28], rdx mov [rbp+var_30], rcx mov rax, [rbp+var_20] cmp rax, [rbp+var_30] jz short loc_1334 mov eax, 0 jmp locret_13C0 loc_1334: mov [rbp+var_8], 0 jmp short loc_13B1 loc_133E: mov rax, [rbp+var_8] shl rax, 4 mov rdx, rax mov rax, [rbp+var_28] add rax, rdx mov rdx, [rax] mov rax, [rbp+var_8] shl rax, 4 mov rcx, rax mov rax, [rbp+var_18] add rax, rcx mov rax, [rax] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jnz short loc_13A5 mov rax, [rbp+var_8] shl rax, 4 mov rdx, rax mov rax, [rbp+var_18] add rax, rdx mov edx, [rax+8] mov rax, [rbp+var_8] shl rax, 4 mov rcx, rax mov rax, [rbp+var_28] add rax, rcx mov eax, [rax+8] cmp edx, eax jz short loc_13AC loc_13A5: mov eax, 0 jmp short locret_13C0 loc_13AC: add [rbp+var_8], 1 loc_13B1: mov rax, [rbp+var_8] cmp rax, [rbp+var_20] jb short loc_133E mov eax, 1 locret_13C0: leave retn
long long func0(long long a1, unsigned long long a2, long long a3, long long a4) { unsigned long long i; // [rsp+28h] [rbp-8h] if ( a2 != a4 ) return 0LL; for ( i = 0LL; i < a2; ++i ) { if ( strcmp(*(const char **)(16 * i + a1), *(const char **)(16 * i + a3)) || *(_DWORD *)(16 * i + a1 + 8) != *(_DWORD *)(16 * i + a3 + 8) ) { return 0LL; } } return 1LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV qword ptr [RBP + -0x28],RDX MOV qword ptr [RBP + -0x30],RCX MOV RAX,qword ptr [RBP + -0x20] CMP RAX,qword ptr [RBP + -0x30] JZ 0x00101334 MOV EAX,0x0 JMP 0x001013c0 LAB_00101334: MOV qword ptr [RBP + -0x8],0x0 JMP 0x001013b1 LAB_0010133e: MOV RAX,qword ptr [RBP + -0x8] SHL RAX,0x4 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV RDX,qword ptr [RAX] MOV RAX,qword ptr [RBP + -0x8] SHL RAX,0x4 MOV RCX,RAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV RSI,RDX MOV RDI,RAX CALL 0x001010c0 TEST EAX,EAX JNZ 0x001013a5 MOV RAX,qword ptr [RBP + -0x8] SHL RAX,0x4 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX + 0x8] MOV RAX,qword ptr [RBP + -0x8] SHL RAX,0x4 MOV RCX,RAX MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RCX MOV EAX,dword ptr [RAX + 0x8] CMP EDX,EAX JZ 0x001013ac LAB_001013a5: MOV EAX,0x0 JMP 0x001013c0 LAB_001013ac: ADD qword ptr [RBP + -0x8],0x1 LAB_001013b1: MOV RAX,qword ptr [RBP + -0x8] CMP RAX,qword ptr [RBP + -0x20] JC 0x0010133e MOV EAX,0x1 LAB_001013c0: LEAVE RET
int8 func0(long param_1,ulong param_2,long param_3,ulong param_4) { int iVar1; int8 uVar2; ulong local_10; if (param_2 == param_4) { for (local_10 = 0; local_10 < param_2; local_10 = local_10 + 1) { iVar1 = strcmp(*(char **)(param_1 + local_10 * 0x10),*(char **)(param_3 + local_10 * 0x10)); if ((iVar1 != 0) || (*(int *)(param_1 + local_10 * 0x10 + 8) != *(int *)(param_3 + local_10 * 0x10 + 8))) { return 0; } } uVar2 = 1; } else { uVar2 = 0; } return uVar2; }
4,945
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> typedef struct { char *key; int value; } dict_entry; dict_entry* merge_dict(const dict_entry *d1, size_t size1, const dict_entry *d2, size_t size2, size_t *size_out) { dict_entry *merged = malloc((size1 + size2) * sizeof(dict_entry)); for (size_t i = 0; i < size1; i++) { merged[i].key = d1[i].key; merged[i].value = d1[i].value; } for (size_t i = 0; i < size2; i++) { merged[size1 + i].key = d2[i].key; merged[size1 + i].value = d2[i].value; } *size_out = size1 + size2; return merged; }
int func0(const dict_entry *d1, size_t size1, const dict_entry *d2, size_t size2) { if (size1 != size2) return 0; for (size_t i = 0; i < size1; i++) { if (strcmp(d1[i].key, d2[i].key) != 0 || d1[i].value != d2[i].value) { return 0; } } return 1; }
int main() { // Test case 1 dict_entry d1_a[] = {{"a", 100}, {"b", 200}}; dict_entry d2_a[] = {{"x", 300}, {"y", 200}}; size_t size_a; dict_entry *merged_a = merge_dict(d1_a, 2, d2_a, 2, &size_a); dict_entry expected_a[] = {{"a", 100}, {"b", 200}, {"x", 300}, {"y", 200}}; assert(func0(merged_a, size_a, expected_a, 4)); free(merged_a); // Test case 2 dict_entry d1_b[] = {{"a", 900}, {"b", 900}, {"d", 900}}; dict_entry d2_b[] = {{"a", 900}, {"b", 900}, {"d", 900}}; size_t size_b; dict_entry *merged_b = merge_dict(d1_b, 3, d2_b, 3, &size_b); dict_entry expected_b[] = {{"a", 900}, {"b", 900}, {"d", 900}, {"a", 900}, {"b", 900}, {"d", 900}}; assert(func0(merged_b, size_b, expected_b, 6)); free(merged_b); // Test case 3 dict_entry d1_c[] = {{"a", 10}, {"b", 20}}; dict_entry d2_c[] = {{"x", 30}, {"y", 40}}; size_t size_c; dict_entry *merged_c = merge_dict(d1_c, 2, d2_c, 2, &size_c); dict_entry expected_c[] = {{"a", 10}, {"b", 20}, {"x", 30}, {"y", 40}}; assert(func0(merged_c, size_c, expected_c, 4)); free(merged_c); return 0; }
O1
c
func0: endbr64 mov $0x0,%eax cmp %rcx,%rsi jne 12db <func0+0x75> push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %rsi,%r12 test %rsi,%rsi je 12c4 <func0+0x5e> lea 0x8(%rdx),%rbp lea 0x8(%rdi),%rbx mov $0x0,%r13d mov -0x8(%rbp),%rsi mov -0x8(%rbx),%rdi callq 10c0 <strcmp@plt> test %eax,%eax jne 12cb <func0+0x65> mov 0x0(%rbp),%ecx cmp %ecx,(%rbx) jne 12d0 <func0+0x6a> add $0x1,%r13 add $0x10,%rbp add $0x10,%rbx cmp %r13,%r12 jne 1294 <func0+0x2e> mov $0x1,%eax jmp 12d0 <func0+0x6a> mov $0x1,%eax jmp 12d0 <func0+0x6a> mov $0x0,%eax add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq retq
func0: endbr64 mov eax, 0 cmp rsi, rcx jnz short locret_12E1 push r13 push r12 push rbp push rbx sub rsp, 8 mov r12, rsi test rsi, rsi jz short loc_12CA lea rbp, [rdx+8] lea rbx, [rdi+8] mov r13d, 0 loc_129A: mov rsi, [rbp-8] mov rdi, [rbx-8] call _strcmp test eax, eax jnz short loc_12D1 mov ecx, [rbp+0] cmp [rbx], ecx jnz short loc_12D6 add r13, 1 add rbp, 10h add rbx, 10h cmp r12, r13 jnz short loc_129A mov eax, 1 jmp short loc_12D6 loc_12CA: mov eax, 1 jmp short loc_12D6 loc_12D1: mov eax, 0 loc_12D6: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn locret_12E1: retn
long long func0(long long a1, long long a2, long long a3, long long a4) { long long result; // rax _DWORD *v5; // rbp _DWORD *v6; // rbx long long v7; // r13 result = 0LL; if ( a2 == a4 ) { if ( a2 ) { v5 = (_DWORD *)(a3 + 8); v6 = (_DWORD *)(a1 + 8); v7 = 0LL; while ( 1 ) { result = strcmp(*((_QWORD *)v6 - 1), *((_QWORD *)v5 - 1)); if ( (_DWORD)result ) break; if ( *v6 != *v5 ) return result; ++v7; v5 += 4; v6 += 4; if ( a2 == v7 ) return 1LL; } return 0LL; } else { return 1LL; } } return result; }
func0: ENDBR64 MOV EAX,0x0 CMP RSI,RCX JNZ 0x001012e1 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R12,RSI TEST RSI,RSI JZ 0x001012ca LEA RBP,[RDX + 0x8] LEA RBX,[RDI + 0x8] MOV R13D,0x0 LAB_0010129a: MOV RSI,qword ptr [RBP + -0x8] MOV RDI,qword ptr [RBX + -0x8] CALL 0x001010c0 TEST EAX,EAX JNZ 0x001012d1 MOV ECX,dword ptr [RBP] CMP dword ptr [RBX],ECX JNZ 0x001012d6 ADD R13,0x1 ADD RBP,0x10 ADD RBX,0x10 CMP R12,R13 JNZ 0x0010129a MOV EAX,0x1 JMP 0x001012d6 LAB_001012ca: MOV EAX,0x1 JMP 0x001012d6 LAB_001012d1: MOV EAX,0x0 LAB_001012d6: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_001012e1: RET
int4 func0(long param_1,long param_2,long param_3,long param_4) { int iVar1; int *piVar2; int *piVar3; long lVar4; if (param_2 != param_4) { return 0; } if (param_2 != 0) { piVar3 = (int *)(param_3 + 8); piVar2 = (int *)(param_1 + 8); lVar4 = 0; do { iVar1 = strcmp(*(char **)(piVar2 + -2),*(char **)(piVar3 + -2)); if (iVar1 != 0) { return 0; } if (*piVar2 != *piVar3) { return 0; } lVar4 = lVar4 + 1; piVar3 = piVar3 + 4; piVar2 = piVar2 + 4; } while (param_2 != lVar4); } return 1; }
4,946
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> typedef struct { char *key; int value; } dict_entry; dict_entry* merge_dict(const dict_entry *d1, size_t size1, const dict_entry *d2, size_t size2, size_t *size_out) { dict_entry *merged = malloc((size1 + size2) * sizeof(dict_entry)); for (size_t i = 0; i < size1; i++) { merged[i].key = d1[i].key; merged[i].value = d1[i].value; } for (size_t i = 0; i < size2; i++) { merged[size1 + i].key = d2[i].key; merged[size1 + i].value = d2[i].value; } *size_out = size1 + size2; return merged; }
int func0(const dict_entry *d1, size_t size1, const dict_entry *d2, size_t size2) { if (size1 != size2) return 0; for (size_t i = 0; i < size1; i++) { if (strcmp(d1[i].key, d2[i].key) != 0 || d1[i].value != d2[i].value) { return 0; } } return 1; }
int main() { // Test case 1 dict_entry d1_a[] = {{"a", 100}, {"b", 200}}; dict_entry d2_a[] = {{"x", 300}, {"y", 200}}; size_t size_a; dict_entry *merged_a = merge_dict(d1_a, 2, d2_a, 2, &size_a); dict_entry expected_a[] = {{"a", 100}, {"b", 200}, {"x", 300}, {"y", 200}}; assert(func0(merged_a, size_a, expected_a, 4)); free(merged_a); // Test case 2 dict_entry d1_b[] = {{"a", 900}, {"b", 900}, {"d", 900}}; dict_entry d2_b[] = {{"a", 900}, {"b", 900}, {"d", 900}}; size_t size_b; dict_entry *merged_b = merge_dict(d1_b, 3, d2_b, 3, &size_b); dict_entry expected_b[] = {{"a", 900}, {"b", 900}, {"d", 900}, {"a", 900}, {"b", 900}, {"d", 900}}; assert(func0(merged_b, size_b, expected_b, 6)); free(merged_b); // Test case 3 dict_entry d1_c[] = {{"a", 10}, {"b", 20}}; dict_entry d2_c[] = {{"x", 30}, {"y", 40}}; size_t size_c; dict_entry *merged_c = merge_dict(d1_c, 2, d2_c, 2, &size_c); dict_entry expected_c[] = {{"a", 10}, {"b", 20}, {"x", 30}, {"y", 40}}; assert(func0(merged_c, size_c, expected_c, 4)); free(merged_c); return 0; }
O2
c
func0: endbr64 cmp %rcx,%rsi jne 16d0 <func0+0x10> jmpq 1590 <func0.part.0> xchg %ax,%ax xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0_part_0: test rsi, rsi jz short loc_1600 push r13 xor r13d, r13d push r12 mov r12, rsi push rbp lea rbp, [rdx+8] push rbx lea rbx, [rdi+8] sub rsp, 8 jmp short loc_15C8 loc_15B0: mov ecx, [rbp+0] cmp [rbx], ecx jnz short loc_15DB add r13, 1 add rbp, 10h add rbx, 10h cmp r13, r12 jz short loc_15F0 loc_15C8: mov rsi, [rbp-8] mov rdi, [rbx-8] call _strcmp test eax, eax jz short loc_15B0 xor eax, eax loc_15DB: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_15F0: add rsp, 8 mov eax, 1 pop rbx pop rbp pop r12 pop r13 retn loc_1600: mov eax, 1 retn
long long func0_part_0(long long a1, long long a2, long long a3) { long long v3; // r13 _DWORD *v4; // rbp _DWORD *v5; // rbx long long result; // rax if ( !a2 ) return 1LL; v3 = 0LL; v4 = (_DWORD *)(a3 + 8); v5 = (_DWORD *)(a1 + 8); do { result = strcmp(*((_QWORD *)v5 - 1), *((_QWORD *)v4 - 1)); if ( (_DWORD)result ) return 0LL; if ( *v5 != *v4 ) return result; ++v3; v4 += 4; v5 += 4; } while ( v3 != a2 ); return 1LL; }
func0.part.0: TEST RSI,RSI JZ 0x00101600 PUSH R13 XOR R13D,R13D PUSH R12 MOV R12,RSI PUSH RBP LEA RBP,[RDX + 0x8] PUSH RBX LEA RBX,[RDI + 0x8] SUB RSP,0x8 JMP 0x001015c8 LAB_001015b0: MOV ECX,dword ptr [RBP] CMP dword ptr [RBX],ECX JNZ 0x001015db ADD R13,0x1 ADD RBP,0x10 ADD RBX,0x10 CMP R13,R12 JZ 0x001015f0 LAB_001015c8: MOV RSI,qword ptr [RBP + -0x8] MOV RDI,qword ptr [RBX + -0x8] CALL 0x001010c0 TEST EAX,EAX JZ 0x001015b0 XOR EAX,EAX LAB_001015db: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_001015f0: ADD RSP,0x8 MOV EAX,0x1 POP RBX POP RBP POP R12 POP R13 RET LAB_00101600: MOV EAX,0x1 RET
int4 func0_part_0(long param_1,long param_2,long param_3) { int iVar1; int *piVar2; int *piVar3; long lVar4; if (param_2 == 0) { return 1; } lVar4 = 0; piVar3 = (int *)(param_3 + 8); piVar2 = (int *)(param_1 + 8); while ((iVar1 = strcmp(*(char **)(piVar2 + -2),*(char **)(piVar3 + -2)), iVar1 == 0 && (*piVar2 == *piVar3))) { lVar4 = lVar4 + 1; piVar3 = piVar3 + 4; piVar2 = piVar2 + 4; if (lVar4 == param_2) { return 1; } } return 0; }
4,947
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> typedef struct { char *key; int value; } dict_entry; dict_entry* merge_dict(const dict_entry *d1, size_t size1, const dict_entry *d2, size_t size2, size_t *size_out) { dict_entry *merged = malloc((size1 + size2) * sizeof(dict_entry)); for (size_t i = 0; i < size1; i++) { merged[i].key = d1[i].key; merged[i].value = d1[i].value; } for (size_t i = 0; i < size2; i++) { merged[size1 + i].key = d2[i].key; merged[size1 + i].value = d2[i].value; } *size_out = size1 + size2; return merged; }
int func0(const dict_entry *d1, size_t size1, const dict_entry *d2, size_t size2) { if (size1 != size2) return 0; for (size_t i = 0; i < size1; i++) { if (strcmp(d1[i].key, d2[i].key) != 0 || d1[i].value != d2[i].value) { return 0; } } return 1; }
int main() { // Test case 1 dict_entry d1_a[] = {{"a", 100}, {"b", 200}}; dict_entry d2_a[] = {{"x", 300}, {"y", 200}}; size_t size_a; dict_entry *merged_a = merge_dict(d1_a, 2, d2_a, 2, &size_a); dict_entry expected_a[] = {{"a", 100}, {"b", 200}, {"x", 300}, {"y", 200}}; assert(func0(merged_a, size_a, expected_a, 4)); free(merged_a); // Test case 2 dict_entry d1_b[] = {{"a", 900}, {"b", 900}, {"d", 900}}; dict_entry d2_b[] = {{"a", 900}, {"b", 900}, {"d", 900}}; size_t size_b; dict_entry *merged_b = merge_dict(d1_b, 3, d2_b, 3, &size_b); dict_entry expected_b[] = {{"a", 900}, {"b", 900}, {"d", 900}, {"a", 900}, {"b", 900}, {"d", 900}}; assert(func0(merged_b, size_b, expected_b, 6)); free(merged_b); // Test case 3 dict_entry d1_c[] = {{"a", 10}, {"b", 20}}; dict_entry d2_c[] = {{"x", 30}, {"y", 40}}; size_t size_c; dict_entry *merged_c = merge_dict(d1_c, 2, d2_c, 2, &size_c); dict_entry expected_c[] = {{"a", 10}, {"b", 20}, {"x", 30}, {"y", 40}}; assert(func0(merged_c, size_c, expected_c, 4)); free(merged_c); return 0; }
O3
c
func0: endbr64 xor %eax,%eax cmp %rcx,%rsi jne 1730 <func0+0x70> push %r13 push %r12 mov %rsi,%r12 push %rbp push %rbx sub $0x8,%rsp test %rsi,%rsi je 1738 <func0+0x78> lea 0x8(%rdx),%rbp lea 0x8(%rdi),%rbx xor %r13d,%r13d jmp 1708 <func0+0x48> nopw 0x0(%rax,%rax,1) mov 0x0(%rbp),%ecx cmp %ecx,(%rbx) jne 171b <func0+0x5b> add $0x1,%r13 add $0x10,%rbp add $0x10,%rbx cmp %r13,%r12 je 1738 <func0+0x78> mov -0x8(%rbp),%rsi mov -0x8(%rbx),%rdi callq 10c0 <strcmp@plt> test %eax,%eax je 16f0 <func0+0x30> xor %eax,%eax add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq nopw %cs:0x0(%rax,%rax,1) retq nopl 0x0(%rax) add $0x8,%rsp mov $0x1,%eax pop %rbx pop %rbp pop %r12 pop %r13 retq nopl 0x0(%rax,%rax,1)
func0_part_0: test rsi, rsi jz short loc_1600 push r13 xor r13d, r13d push r12 mov r12, rsi push rbp lea rbp, [rdx+8] push rbx lea rbx, [rdi+8] sub rsp, 8 jmp short loc_15C8 loc_15B0: mov ecx, [rbp+0] cmp [rbx], ecx jnz short loc_15DB add r13, 1 add rbp, 10h add rbx, 10h cmp r13, r12 jz short loc_15F0 loc_15C8: mov rsi, [rbp-8]; s2 mov rdi, [rbx-8]; s1 call _strcmp test eax, eax jz short loc_15B0 xor eax, eax loc_15DB: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_15F0: add rsp, 8 mov eax, 1 pop rbx pop rbp pop r12 pop r13 retn loc_1600: mov eax, 1 retn
int func0_part_0(long long a1, long long a2, long long a3) { long long v3; // r13 const char **v4; // rbp const char **v5; // rbx int result; // eax if ( !a2 ) return 1; v3 = 0LL; v4 = (const char **)(a3 + 8); v5 = (const char **)(a1 + 8); do { result = strcmp(*(v5 - 1), *(v4 - 1)); if ( result ) return 0; if ( *(_DWORD *)v5 != *(_DWORD *)v4 ) return result; ++v3; v4 += 2; v5 += 2; } while ( v3 != a2 ); return 1; }
func0.part.0: TEST RSI,RSI JZ 0x00101600 PUSH R13 XOR R13D,R13D PUSH R12 MOV R12,RSI PUSH RBP LEA RBP,[RDX + 0x8] PUSH RBX LEA RBX,[RDI + 0x8] SUB RSP,0x8 JMP 0x001015c8 LAB_001015b0: MOV ECX,dword ptr [RBP] CMP dword ptr [RBX],ECX JNZ 0x001015db ADD R13,0x1 ADD RBP,0x10 ADD RBX,0x10 CMP R13,R12 JZ 0x001015f0 LAB_001015c8: MOV RSI,qword ptr [RBP + -0x8] MOV RDI,qword ptr [RBX + -0x8] CALL 0x001010c0 TEST EAX,EAX JZ 0x001015b0 XOR EAX,EAX LAB_001015db: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_001015f0: ADD RSP,0x8 MOV EAX,0x1 POP RBX POP RBP POP R12 POP R13 RET LAB_00101600: MOV EAX,0x1 RET
int4 func0_part_0(long param_1,long param_2,long param_3) { int iVar1; int *piVar2; int *piVar3; long lVar4; if (param_2 == 0) { return 1; } lVar4 = 0; piVar3 = (int *)(param_3 + 8); piVar2 = (int *)(param_1 + 8); while ((iVar1 = strcmp(*(char **)(piVar2 + -2),*(char **)(piVar3 + -2)), iVar1 == 0 && (*piVar2 == *piVar3))) { lVar4 = lVar4 + 1; piVar3 = piVar3 + 4; piVar2 = piVar2 + 4; if (lVar4 == param_2) { return 1; } } return 0; }
4,948
func0
#include <stdlib.h> #include <assert.h>
double func0(int h_age) { double d_age; if (h_age < 0) { exit(EXIT_FAILURE); } else if (h_age <= 2) { d_age = h_age * 10.5; } else { d_age = 21 + (h_age - 2) * 4; } return d_age; }
int main() { assert(func0(12) == 61); assert(func0(15) == 73); assert(func0(24) == 109); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %edi,-0x14(%rbp) cmpl $0x0,-0x14(%rbp) jns 1188 <func0+0x1f> mov $0x1,%edi callq 1070 <exit@plt> cmpl $0x2,-0x14(%rbp) jg 11a6 <func0+0x3d> cvtsi2sdl -0x14(%rbp),%xmm1 movsd 0xee5(%rip),%xmm0 mulsd %xmm1,%xmm0 movsd %xmm0,-0x8(%rbp) jmp 11bb <func0+0x52> mov -0x14(%rbp),%eax sub $0x2,%eax shl $0x2,%eax add $0x15,%eax cvtsi2sd %eax,%xmm0 movsd %xmm0,-0x8(%rbp) movsd -0x8(%rbp),%xmm0 leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_14], edi cmp [rbp+var_14], 0 jns short loc_1188 mov edi, 1; status call _exit loc_1188: cmp [rbp+var_14], 2 jg short loc_11AA pxor xmm1, xmm1 cvtsi2sd xmm1, [rbp+var_14] movsd xmm0, cs:qword_2060 mulsd xmm0, xmm1 movsd [rbp+var_8], xmm0 jmp short loc_11C3 loc_11AA: mov eax, [rbp+var_14] sub eax, 2 shl eax, 2 add eax, 15h pxor xmm0, xmm0 cvtsi2sd xmm0, eax movsd [rbp+var_8], xmm0 loc_11C3: movsd xmm0, [rbp+var_8] leave retn
double func0(int a1) { if ( a1 < 0 ) exit(1); if ( a1 > 2 ) return (double)(4 * (a1 - 2) + 21); else return 10.5 * (double)a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV dword ptr [RBP + -0x14],EDI CMP dword ptr [RBP + -0x14],0x0 JNS 0x00101188 MOV EDI,0x1 CALL 0x00101070 LAB_00101188: CMP dword ptr [RBP + -0x14],0x2 JG 0x001011aa PXOR XMM1,XMM1 CVTSI2SD XMM1,dword ptr [RBP + -0x14] MOVSD XMM0,qword ptr [0x00102060] MULSD XMM0,XMM1 MOVSD qword ptr [RBP + -0x8],XMM0 JMP 0x001011c3 LAB_001011aa: MOV EAX,dword ptr [RBP + -0x14] SUB EAX,0x2 SHL EAX,0x2 ADD EAX,0x15 PXOR XMM0,XMM0 CVTSI2SD XMM0,EAX MOVSD qword ptr [RBP + -0x8],XMM0 LAB_001011c3: MOVSD XMM0,qword ptr [RBP + -0x8] LEAVE RET
double func0(int param_1) { int8 local_10; if (param_1 < 0) { /* WARNING: Subroutine does not return */ exit(1); } if (param_1 < 3) { local_10 = DAT_00102060 * (double)param_1; } else { local_10 = (double)((param_1 + -2) * 4 + 0x15); } return local_10; }
4,949
func0
#include <stdlib.h> #include <assert.h>
double func0(int h_age) { double d_age; if (h_age < 0) { exit(EXIT_FAILURE); } else if (h_age <= 2) { d_age = h_age * 10.5; } else { d_age = 21 + (h_age - 2) * 4; } return d_age; }
int main() { assert(func0(12) == 61); assert(func0(15) == 73); assert(func0(24) == 109); return 0; }
O1
c
func0: endbr64 test %edi,%edi js 1167 <func0+0x1e> cmp $0x2,%edi jg 1175 <func0+0x2c> pxor %xmm0,%xmm0 cvtsi2sd %edi,%xmm0 mulsd 0xea2(%rip),%xmm0 retq sub $0x8,%rsp mov $0x1,%edi callq 1050 <exit@plt> lea 0xd(,%rdi,4),%eax pxor %xmm0,%xmm0 cvtsi2sd %eax,%xmm0 retq
func0: endbr64 test edi, edi js short loc_1167 cmp edi, 2 jg short loc_1175 pxor xmm0, xmm0 cvtsi2sd xmm0, edi mulsd xmm0, cs:qword_2008 retn loc_1167: sub rsp, 8 mov edi, 1 call _exit loc_1175: lea eax, ds:0Dh[rdi*4] pxor xmm0, xmm0 cvtsi2sd xmm0, eax retn
double func0(int a1, long long a2) { if ( a1 < 0 ) exit(1LL, a2); if ( a1 > 2 ) return (double)(4 * a1 + 13); else return (double)a1 * 10.5; }
func0: ENDBR64 TEST EDI,EDI JS 0x00101167 CMP EDI,0x2 JG 0x00101175 PXOR XMM0,XMM0 CVTSI2SD XMM0,EDI MULSD XMM0,qword ptr [0x00102008] RET LAB_00101167: SUB RSP,0x8 MOV EDI,0x1 CALL 0x00101050 LAB_00101175: LEA EAX,[0xd + RDI*0x4] PXOR XMM0,XMM0 CVTSI2SD XMM0,EAX RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int param_1) { if (param_1 < 0) { /* WARNING: Subroutine does not return */ exit(1); } if (param_1 < 3) { return (double)param_1 * _DAT_00102008; } return (double)(param_1 * 4 + 0xd); }
4,950
func0
#include <stdlib.h> #include <assert.h>
double func0(int h_age) { double d_age; if (h_age < 0) { exit(EXIT_FAILURE); } else if (h_age <= 2) { d_age = h_age * 10.5; } else { d_age = 21 + (h_age - 2) * 4; } return d_age; }
int main() { assert(func0(12) == 61); assert(func0(15) == 73); assert(func0(24) == 109); return 0; }
O2
c
func0: endbr64 test %edi,%edi js 1190 <func0+0x30> cmp $0x2,%edi jg 1180 <func0+0x20> pxor %xmm0,%xmm0 cvtsi2sd %edi,%xmm0 mulsd 0xe8b(%rip),%xmm0 retq xchg %ax,%ax lea 0xd(,%rdi,4),%eax pxor %xmm0,%xmm0 cvtsi2sd %eax,%xmm0 retq push %rax mov $0x1,%edi callq 1050 <exit@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 test edi, edi js short loc_1190 cmp edi, 2 jg short loc_1180 pxor xmm0, xmm0 cvtsi2sd xmm0, edi mulsd xmm0, cs:qword_2008 retn loc_1180: lea eax, ds:0Dh[rdi*4] pxor xmm0, xmm0 cvtsi2sd xmm0, eax retn loc_1190: push rax mov edi, 1 call _exit
double func0(int a1) { if ( a1 < 0 ) exit(1LL); if ( a1 > 2 ) return (double)(4 * a1 + 13); else return (double)a1 * 10.5; }
func0: ENDBR64 TEST EDI,EDI JS 0x00101190 CMP EDI,0x2 JG 0x00101180 PXOR XMM0,XMM0 CVTSI2SD XMM0,EDI MULSD XMM0,qword ptr [0x00102008] RET LAB_00101180: LEA EAX,[0xd + RDI*0x4] PXOR XMM0,XMM0 CVTSI2SD XMM0,EAX RET LAB_00101190: PUSH RAX MOV EDI,0x1 CALL 0x00101050
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int param_1) { if (param_1 < 0) { /* WARNING: Subroutine does not return */ exit(1); } if (param_1 < 3) { return (double)param_1 * _DAT_00102008; } return (double)(param_1 * 4 + 0xd); }
4,951
func0
#include <stdlib.h> #include <assert.h>
double func0(int h_age) { double d_age; if (h_age < 0) { exit(EXIT_FAILURE); } else if (h_age <= 2) { d_age = h_age * 10.5; } else { d_age = 21 + (h_age - 2) * 4; } return d_age; }
int main() { assert(func0(12) == 61); assert(func0(15) == 73); assert(func0(24) == 109); return 0; }
O3
c
func0: endbr64 test %edi,%edi js 1190 <func0+0x30> cmp $0x2,%edi jg 1180 <func0+0x20> pxor %xmm0,%xmm0 cvtsi2sd %edi,%xmm0 mulsd 0xe8b(%rip),%xmm0 retq xchg %ax,%ax lea 0xd(,%rdi,4),%eax pxor %xmm0,%xmm0 cvtsi2sd %eax,%xmm0 retq push %rax mov $0x1,%edi callq 1050 <exit@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 test edi, edi js short loc_1190 cmp edi, 2 jg short loc_1180 pxor xmm0, xmm0 cvtsi2sd xmm0, edi mulsd xmm0, cs:qword_2008 retn loc_1180: lea eax, ds:0Dh[rdi*4] pxor xmm0, xmm0 cvtsi2sd xmm0, eax retn loc_1190: push rax mov edi, 1; status call _exit
double func0(int a1) { if ( a1 < 0 ) exit(1); if ( a1 > 2 ) return (double)(4 * a1 + 13); else return (double)a1 * 10.5; }
func0: ENDBR64 TEST EDI,EDI JS 0x00101190 CMP EDI,0x2 JG 0x00101180 PXOR XMM0,XMM0 CVTSI2SD XMM0,EDI MULSD XMM0,qword ptr [0x00102008] RET LAB_00101180: LEA EAX,[0xd + RDI*0x4] PXOR XMM0,XMM0 CVTSI2SD XMM0,EAX RET LAB_00101190: PUSH RAX MOV EDI,0x1 CALL 0x00101050
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int param_1) { if (param_1 < 0) { /* WARNING: Subroutine does not return */ exit(1); } if (param_1 < 3) { return (double)param_1 * _DAT_00102008; } return (double)(param_1 * 4 + 0xd); }
4,952
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> // Function to split integer arrays int** list_split_int(int *S, int length, int step) { int **result = malloc(step * sizeof(int*)); for(int i = 0; i < step; i++) { int count = 0; for(int j = i; j < length; j += step) { count++; } result[i] = malloc(count * sizeof(int)); int index = 0; for(int j = i; j < length; j += step) { result[i][index++] = S[j]; } } return result; } // Function to split string arrays char*** list_split_str(char **S, int length, int step) { char ***result = malloc(step * sizeof(char**)); for(int i = 0; i < step; i++) { int count = 0; for(int j = i; j < length; j += step) { count++; } result[i] = malloc(count * sizeof(char*)); int index = 0; for(int j = i; j < length; j += step) { result[i][index++] = S[j]; } } return result; } // Function to compare integer split results int compare_split_int(int **result, int **expected, int step, int *sizes) { for(int i = 0; i < step; i++) { for(int j = 0; j < sizes[i]; j++) { if(result[i][j] != expected[i][j]) { return 0; } } } return 1; } // Function to compare string split results
int func0(char ***result, char ***expected, int step, int *sizes) { for(int i = 0; i < step; i++) { for(int j = 0; j < sizes[i]; j++) { if(strcmp(result[i][j], expected[i][j]) != 0) { return 0; } } } return 1; }
int main() { // First assert with strings char *S1[] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"}; int length1 = sizeof(S1) / sizeof(S1[0]); int step1 = 3; char ***split1 = list_split_str(S1, length1, step1); char *expected1[][5] = {{"a", "d", "g", "j", "m"}, {"b", "e", "h", "k", "n"}, {"c", "f", "i", "l", NULL}}; int sizes1[] = {5,5,4}; // Prepare expected split char **exp1[3]; exp1[0] = expected1[0]; exp1[1] = expected1[1]; exp1[2] = expected1[2]; assert(func0(split1, exp1, step1, sizes1)); // Second assert with integers int S2[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14}; int length2 = sizeof(S2) / sizeof(S2[0]); int step2 = 3; int **split2 = list_split_int(S2, length2, step2); int expected2[][5] = {{1,4,7,10,13}, {2,5,8,11,14}, {3,6,9,12}}; int sizes2[] = {5,5,4}; // Prepare expected split int *exp2[3]; exp2[0] = expected2[0]; exp2[1] = expected2[1]; exp2[2] = expected2[2]; assert(compare_split_int(split2, exp2, step2, sizes2)); // Third assert with strings char *S3[] = {"python","java","C","C++","DBMS","SQL"}; int length3 = sizeof(S3) / sizeof(S3[0]); int step3 = 2; char ***split3 = list_split_str(S3, length3, step3); char *expected3[][3] = {{"python", "C", "DBMS"}, {"java", "C++", "SQL"}}; int sizes3[] = {3,3}; // Prepare expected split char **exp3[2]; exp3[0] = expected3[0]; exp3[1] = expected3[1]; assert(func0(split3, exp3, step3, sizes3)); // Free allocated memory for(int i = 0; i < step1; i++) { free(split1[i]); } free(split1); for(int i = 0; i < step2; i++) { free(split2[i]); } free(split2); for(int i = 0; i < step3; i++) { free(split3[i]); } free(split3); printf("All asserts passed successfully.\n"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %edx,-0x24(%rbp) mov %rcx,-0x30(%rbp) movl $0x0,-0x8(%rbp) jmpq 155b <func0+0xbb> movl $0x0,-0x4(%rbp) jmp 1538 <func0+0x98> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x20(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0x4(%rbp),%edx movslq %edx,%rdx shl $0x3,%rdx add %rdx,%rax mov (%rax),%rdx mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%rax mov -0x4(%rbp),%ecx movslq %ecx,%rcx shl $0x3,%rcx add %rcx,%rax mov (%rax),%rax mov %rdx,%rsi mov %rax,%rdi callq 10e0 <strcmp@plt> test %eax,%eax je 1534 <func0+0x94> mov $0x0,%eax jmp 156c <func0+0xcc> addl $0x1,-0x4(%rbp) mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x30(%rbp),%rax add %rdx,%rax mov (%rax),%eax cmp %eax,-0x4(%rbp) jl 14d0 <func0+0x30> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x24(%rbp),%eax jl 14c7 <func0+0x27> mov $0x1,%eax 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_30], rcx mov [rbp+var_8], 0 jmp loc_1559 loc_14C5: mov [rbp+var_4], 0 jmp short loc_1536 loc_14CE: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_20] add rax, rdx mov rax, [rax] mov edx, [rbp+var_4] movsxd rdx, edx shl rdx, 3 add rax, rdx mov rdx, [rax] mov eax, [rbp+var_8] cdqe lea rcx, ds:0[rax*8] mov rax, [rbp+var_18] add rax, rcx mov rax, [rax] mov ecx, [rbp+var_4] movsxd rcx, ecx shl rcx, 3 add rax, rcx mov rax, [rax] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jz short loc_1532 mov eax, 0 jmp short locret_156A loc_1532: add [rbp+var_4], 1 loc_1536: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_30] add rax, rdx mov eax, [rax] cmp [rbp+var_4], eax jl loc_14CE add [rbp+var_8], 1 loc_1559: mov eax, [rbp+var_8] cmp eax, [rbp+var_24] jl loc_14C5 mov eax, 1 locret_156A: leave retn
long long func0(long long a1, long long a2, int a3, long long a4) { int i; // [rsp+28h] [rbp-8h] int j; // [rsp+2Ch] [rbp-4h] for ( i = 0; i < a3; ++i ) { for ( j = 0; j < *(_DWORD *)(4LL * i + a4); ++j ) { if ( strcmp( *(const char **)(8LL * j + *(_QWORD *)(8LL * i + a1)), *(const char **)(8LL * j + *(_QWORD *)(8LL * i + a2))) ) { return 0LL; } } } return 1LL; }
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 qword ptr [RBP + -0x30],RCX MOV dword ptr [RBP + -0x8],0x0 JMP 0x00101559 LAB_001014c5: MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101536 LAB_001014ce: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x20] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV EDX,dword ptr [RBP + -0x4] MOVSXD RDX,EDX SHL RDX,0x3 ADD RAX,RDX MOV RDX,qword ptr [RAX] MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RCX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV ECX,dword ptr [RBP + -0x4] MOVSXD RCX,ECX SHL RCX,0x3 ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV RSI,RDX MOV RDI,RAX CALL 0x001010e0 TEST EAX,EAX JZ 0x00101532 MOV EAX,0x0 JMP 0x0010156a LAB_00101532: ADD dword ptr [RBP + -0x4],0x1 LAB_00101536: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x30] ADD RAX,RDX MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x4],EAX JL 0x001014ce ADD dword ptr [RBP + -0x8],0x1 LAB_00101559: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x24] JL 0x001014c5 MOV EAX,0x1 LAB_0010156a: LEAVE RET
int8 func0(long param_1,long param_2,int param_3,long param_4) { int iVar1; int local_10; int local_c; local_10 = 0; do { if (param_3 <= local_10) { return 1; } for (local_c = 0; local_c < *(int *)(param_4 + (long)local_10 * 4); local_c = local_c + 1) { iVar1 = strcmp(*(char **)(*(long *)(param_1 + (long)local_10 * 8) + (long)local_c * 8), *(char **)(*(long *)(param_2 + (long)local_10 * 8) + (long)local_c * 8)); if (iVar1 != 0) { return 0; } } local_10 = local_10 + 1; } while( true ); }
4,953
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> // Function to split integer arrays int** list_split_int(int *S, int length, int step) { int **result = malloc(step * sizeof(int*)); for(int i = 0; i < step; i++) { int count = 0; for(int j = i; j < length; j += step) { count++; } result[i] = malloc(count * sizeof(int)); int index = 0; for(int j = i; j < length; j += step) { result[i][index++] = S[j]; } } return result; } // Function to split string arrays char*** list_split_str(char **S, int length, int step) { char ***result = malloc(step * sizeof(char**)); for(int i = 0; i < step; i++) { int count = 0; for(int j = i; j < length; j += step) { count++; } result[i] = malloc(count * sizeof(char*)); int index = 0; for(int j = i; j < length; j += step) { result[i][index++] = S[j]; } } return result; } // Function to compare integer split results int compare_split_int(int **result, int **expected, int step, int *sizes) { for(int i = 0; i < step; i++) { for(int j = 0; j < sizes[i]; j++) { if(result[i][j] != expected[i][j]) { return 0; } } } return 1; } // Function to compare string split results
int func0(char ***result, char ***expected, int step, int *sizes) { for(int i = 0; i < step; i++) { for(int j = 0; j < sizes[i]; j++) { if(strcmp(result[i][j], expected[i][j]) != 0) { return 0; } } } return 1; }
int main() { // First assert with strings char *S1[] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"}; int length1 = sizeof(S1) / sizeof(S1[0]); int step1 = 3; char ***split1 = list_split_str(S1, length1, step1); char *expected1[][5] = {{"a", "d", "g", "j", "m"}, {"b", "e", "h", "k", "n"}, {"c", "f", "i", "l", NULL}}; int sizes1[] = {5,5,4}; // Prepare expected split char **exp1[3]; exp1[0] = expected1[0]; exp1[1] = expected1[1]; exp1[2] = expected1[2]; assert(func0(split1, exp1, step1, sizes1)); // Second assert with integers int S2[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14}; int length2 = sizeof(S2) / sizeof(S2[0]); int step2 = 3; int **split2 = list_split_int(S2, length2, step2); int expected2[][5] = {{1,4,7,10,13}, {2,5,8,11,14}, {3,6,9,12}}; int sizes2[] = {5,5,4}; // Prepare expected split int *exp2[3]; exp2[0] = expected2[0]; exp2[1] = expected2[1]; exp2[2] = expected2[2]; assert(compare_split_int(split2, exp2, step2, sizes2)); // Third assert with strings char *S3[] = {"python","java","C","C++","DBMS","SQL"}; int length3 = sizeof(S3) / sizeof(S3[0]); int step3 = 2; char ***split3 = list_split_str(S3, length3, step3); char *expected3[][3] = {{"python", "C", "DBMS"}, {"java", "C++", "SQL"}}; int sizes3[] = {3,3}; // Prepare expected split char **exp3[2]; exp3[0] = expected3[0]; exp3[1] = expected3[1]; assert(func0(split3, exp3, step3, sizes3)); // Free allocated memory for(int i = 0; i < step1; i++) { free(split1[i]); } free(split1); for(int i = 0; i < step2; i++) { free(split2[i]); } free(split2); for(int i = 0; i < step3; i++) { free(split3[i]); } free(split3); printf("All asserts passed successfully.\n"); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x28,%rsp mov %rdi,0x8(%rsp) mov %rsi,0x10(%rsp) test %edx,%edx jle 1456 <func0+0x84> mov %rcx,%r15 lea -0x1(%rdx),%eax mov %rax,0x18(%rsp) mov $0x0,%r14d mov (%r15,%r14,4),%eax test %eax,%eax jle 1446 <func0+0x74> mov 0x10(%rsp),%rcx mov (%rcx,%r14,8),%r12 mov 0x8(%rsp),%rdx mov (%rdx,%r14,8),%rbp lea -0x1(%rax),%r13d mov $0x0,%ebx jmp 142b <func0+0x59> mov %rax,%rbx mov (%r12,%rbx,8),%rsi mov 0x0(%rbp,%rbx,8),%rdi callq 10e0 <strcmp@plt> test %eax,%eax jne 145d <func0+0x8b> lea 0x1(%rbx),%rax cmp %rbx,%r13 jne 1428 <func0+0x56> lea 0x1(%r14),%rax cmp 0x18(%rsp),%r14 je 1471 <func0+0x9f> mov %rax,%r14 jmp 1403 <func0+0x31> mov $0x1,%eax jmp 1462 <func0+0x90> mov $0x0,%eax add $0x28,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq mov $0x1,%eax jmp 1462 <func0+0x90>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 28h mov [rsp+58h+var_50], rdi mov [rsp+58h+var_48], rsi test edx, edx jle short loc_142C mov r15, rcx mov eax, edx mov [rsp+58h+var_40], rax mov r14d, 0 loc_13DE: mov ebp, [r15+r14*4] test ebp, ebp jle short loc_141A mov rax, [rsp+58h+var_48] mov r13, [rax+r14*8] mov rax, [rsp+58h+var_50] mov r12, [rax+r14*8] mov ebp, ebp mov ebx, 0 loc_13FF: mov rsi, [r13+rbx*8+0] mov rdi, [r12+rbx*8] call _strcmp test eax, eax jnz short loc_1433 add rbx, 1 cmp rbx, rbp jnz short loc_13FF loc_141A: add r14, 1 cmp r14, [rsp+58h+var_40] jnz short loc_13DE mov eax, 1 jmp short loc_1438 loc_142C: mov eax, 1 jmp short loc_1438 loc_1433: mov eax, 0 loc_1438: add rsp, 28h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1, long long a2, int a3, long long a4) { long long v5; // r14 int v6; // ebp long long v7; // r13 long long v8; // r12 long long v9; // rbx long long v11; // [rsp+18h] [rbp-40h] if ( a3 <= 0 ) return 1LL; v11 = (unsigned int)a3; v5 = 0LL; while ( 1 ) { v6 = *(_DWORD *)(a4 + 4 * v5); if ( v6 > 0 ) break; LABEL_7: if ( ++v5 == v11 ) return 1LL; } v7 = *(_QWORD *)(a2 + 8 * v5); v8 = *(_QWORD *)(a1 + 8 * v5); v9 = 0LL; while ( !(unsigned int)strcmp(*(_QWORD *)(v8 + 8 * v9), *(_QWORD *)(v7 + 8 * v9)) ) { if ( ++v9 == v6 ) goto LABEL_7; } return 0LL; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x28 MOV qword ptr [RSP + 0x8],RDI MOV qword ptr [RSP + 0x10],RSI TEST EDX,EDX JLE 0x0010142c MOV R15,RCX MOV EAX,EDX MOV qword ptr [RSP + 0x18],RAX MOV R14D,0x0 LAB_001013de: MOV EBP,dword ptr [R15 + R14*0x4] TEST EBP,EBP JLE 0x0010141a MOV RAX,qword ptr [RSP + 0x10] MOV R13,qword ptr [RAX + R14*0x8] MOV RAX,qword ptr [RSP + 0x8] MOV R12,qword ptr [RAX + R14*0x8] MOV EBP,EBP MOV EBX,0x0 LAB_001013ff: MOV RSI,qword ptr [R13 + RBX*0x8] MOV RDI,qword ptr [R12 + RBX*0x8] CALL 0x001010e0 TEST EAX,EAX JNZ 0x00101433 ADD RBX,0x1 CMP RBX,RBP JNZ 0x001013ff LAB_0010141a: ADD R14,0x1 CMP R14,qword ptr [RSP + 0x18] JNZ 0x001013de MOV EAX,0x1 JMP 0x00101438 LAB_0010142c: MOV EAX,0x1 JMP 0x00101438 LAB_00101433: MOV EAX,0x0 LAB_00101438: ADD RSP,0x28 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int8 func0(long param_1,long param_2,uint param_3,long param_4) { uint uVar1; long lVar2; long lVar3; int iVar4; ulong uVar5; ulong uVar6; if (0 < (int)param_3) { uVar6 = 0; do { uVar1 = *(uint *)(param_4 + uVar6 * 4); if (0 < (int)uVar1) { lVar2 = *(long *)(param_2 + uVar6 * 8); lVar3 = *(long *)(param_1 + uVar6 * 8); uVar5 = 0; do { iVar4 = strcmp(*(char **)(lVar3 + uVar5 * 8),*(char **)(lVar2 + uVar5 * 8)); if (iVar4 != 0) { return 0; } uVar5 = uVar5 + 1; } while (uVar5 != uVar1); } uVar6 = uVar6 + 1; } while (uVar6 != param_3); } return 1; }
4,954
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> // Function to split integer arrays int** list_split_int(int *S, int length, int step) { int **result = malloc(step * sizeof(int*)); for(int i = 0; i < step; i++) { int count = 0; for(int j = i; j < length; j += step) { count++; } result[i] = malloc(count * sizeof(int)); int index = 0; for(int j = i; j < length; j += step) { result[i][index++] = S[j]; } } return result; } // Function to split string arrays char*** list_split_str(char **S, int length, int step) { char ***result = malloc(step * sizeof(char**)); for(int i = 0; i < step; i++) { int count = 0; for(int j = i; j < length; j += step) { count++; } result[i] = malloc(count * sizeof(char*)); int index = 0; for(int j = i; j < length; j += step) { result[i][index++] = S[j]; } } return result; } // Function to compare integer split results int compare_split_int(int **result, int **expected, int step, int *sizes) { for(int i = 0; i < step; i++) { for(int j = 0; j < sizes[i]; j++) { if(result[i][j] != expected[i][j]) { return 0; } } } return 1; } // Function to compare string split results
int func0(char ***result, char ***expected, int step, int *sizes) { for(int i = 0; i < step; i++) { for(int j = 0; j < sizes[i]; j++) { if(strcmp(result[i][j], expected[i][j]) != 0) { return 0; } } } return 1; }
int main() { // First assert with strings char *S1[] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"}; int length1 = sizeof(S1) / sizeof(S1[0]); int step1 = 3; char ***split1 = list_split_str(S1, length1, step1); char *expected1[][5] = {{"a", "d", "g", "j", "m"}, {"b", "e", "h", "k", "n"}, {"c", "f", "i", "l", NULL}}; int sizes1[] = {5,5,4}; // Prepare expected split char **exp1[3]; exp1[0] = expected1[0]; exp1[1] = expected1[1]; exp1[2] = expected1[2]; assert(func0(split1, exp1, step1, sizes1)); // Second assert with integers int S2[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14}; int length2 = sizeof(S2) / sizeof(S2[0]); int step2 = 3; int **split2 = list_split_int(S2, length2, step2); int expected2[][5] = {{1,4,7,10,13}, {2,5,8,11,14}, {3,6,9,12}}; int sizes2[] = {5,5,4}; // Prepare expected split int *exp2[3]; exp2[0] = expected2[0]; exp2[1] = expected2[1]; exp2[2] = expected2[2]; assert(compare_split_int(split2, exp2, step2, sizes2)); // Third assert with strings char *S3[] = {"python","java","C","C++","DBMS","SQL"}; int length3 = sizeof(S3) / sizeof(S3[0]); int step3 = 2; char ***split3 = list_split_str(S3, length3, step3); char *expected3[][3] = {{"python", "C", "DBMS"}, {"java", "C++", "SQL"}}; int sizes3[] = {3,3}; // Prepare expected split char **exp3[2]; exp3[0] = expected3[0]; exp3[1] = expected3[1]; assert(func0(split3, exp3, step3, sizes3)); // Free allocated memory for(int i = 0; i < step1; i++) { free(split1[i]); } free(split1); for(int i = 0; i < step2; i++) { free(split2[i]); } free(split2); for(int i = 0; i < step3; i++) { free(split3[i]); } free(split3); printf("All asserts passed successfully.\n"); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x28,%rsp mov %rdi,0x8(%rsp) mov %rsi,0x10(%rsp) test %edx,%edx jle 1a00 <func0+0x90> lea -0x1(%rdx),%eax mov %rcx,%r12 xor %ebp,%ebp mov %rax,0x18(%rsp) mov (%r12,%rbp,4),%eax test %eax,%eax jle 19f0 <func0+0x80> mov 0x10(%rsp),%rcx mov 0x8(%rsp),%rdx lea -0x1(%rax),%ebx xor %r15d,%r15d mov (%rcx,%rbp,8),%r14 mov (%rdx,%rbp,8),%r13 jmp 19cc <func0+0x5c> lea 0x1(%r15),%rax cmp %r15,%rbx je 19f0 <func0+0x80> mov %rax,%r15 mov (%r14,%r15,8),%rsi mov 0x0(%r13,%r15,8),%rdi callq 10e0 <strcmp@plt> test %eax,%eax je 19c0 <func0+0x50> add $0x28,%rsp xor %eax,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq lea 0x1(%rbp),%rax cmp %rbp,0x18(%rsp) je 1a00 <func0+0x90> mov %rax,%rbp jmp 199d <func0+0x2d> add $0x28,%rsp mov $0x1,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 28h mov [rsp+58h+var_50], rdi mov [rsp+58h+var_48], rsi test edx, edx jle short loc_1A0B movsxd rax, edx mov r13, rcx xor ebp, ebp mov [rsp+58h+var_40], rax loc_19AD: movsxd rbx, dword ptr [r13+rbp*4+0] test ebx, ebx jle short loc_1A00 mov rax, [rsp+58h+var_48] xor r12d, r12d mov r15, [rax+rbp*8] mov rax, [rsp+58h+var_50] mov r14, [rax+rbp*8] jmp short loc_19D9 loc_19D0: add r12, 1 cmp rbx, r12 jz short loc_1A00 loc_19D9: mov rsi, [r15+r12*8] mov rdi, [r14+r12*8] call _strcmp test eax, eax jz short loc_19D0 add rsp, 28h xor eax, eax pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1A00: add rbp, 1 cmp [rsp+58h+var_40], rbp jnz short loc_19AD loc_1A0B: add rsp, 28h mov eax, 1 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1, long long a2, int a3, long long a4) { long long v5; // rbp long long v6; // rbx long long v7; // r12 long long v8; // r15 long long v9; // r14 long long v11; // [rsp+18h] [rbp-40h] if ( a3 <= 0 ) return 1LL; v5 = 0LL; v11 = a3; while ( 1 ) { v6 = *(int *)(a4 + 4 * v5); if ( (int)v6 > 0 ) break; LABEL_8: if ( v11 == ++v5 ) return 1LL; } v7 = 0LL; v8 = *(_QWORD *)(a2 + 8 * v5); v9 = *(_QWORD *)(a1 + 8 * v5); while ( !(unsigned int)strcmp(*(_QWORD *)(v9 + 8 * v7), *(_QWORD *)(v8 + 8 * v7)) ) { if ( v6 == ++v7 ) goto LABEL_8; } return 0LL; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x28 MOV qword ptr [RSP + 0x8],RDI MOV qword ptr [RSP + 0x10],RSI TEST EDX,EDX JLE 0x00101a0b MOVSXD RAX,EDX MOV R13,RCX XOR EBP,EBP MOV qword ptr [RSP + 0x18],RAX LAB_001019ad: MOVSXD RBX,dword ptr [R13 + RBP*0x4] TEST EBX,EBX JLE 0x00101a00 MOV RAX,qword ptr [RSP + 0x10] XOR R12D,R12D MOV R15,qword ptr [RAX + RBP*0x8] MOV RAX,qword ptr [RSP + 0x8] MOV R14,qword ptr [RAX + RBP*0x8] JMP 0x001019d9 LAB_001019d0: ADD R12,0x1 CMP RBX,R12 JZ 0x00101a00 LAB_001019d9: MOV RSI,qword ptr [R15 + R12*0x8] MOV RDI,qword ptr [R14 + R12*0x8] CALL 0x001010e0 TEST EAX,EAX JZ 0x001019d0 ADD RSP,0x28 XOR EAX,EAX POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101a00: ADD RBP,0x1 CMP qword ptr [RSP + 0x18],RBP JNZ 0x001019ad LAB_00101a0b: ADD RSP,0x28 MOV EAX,0x1 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int8 func0(long param_1,long param_2,int param_3,long param_4) { int iVar1; long lVar2; long lVar3; int iVar4; long lVar5; long lVar6; if (0 < param_3) { lVar5 = 0; do { iVar1 = *(int *)(param_4 + lVar5 * 4); if (0 < iVar1) { lVar6 = 0; lVar2 = *(long *)(param_2 + lVar5 * 8); lVar3 = *(long *)(param_1 + lVar5 * 8); do { iVar4 = strcmp(*(char **)(lVar3 + lVar6 * 8),*(char **)(lVar2 + lVar6 * 8)); if (iVar4 != 0) { return 0; } lVar6 = lVar6 + 1; } while (iVar1 != lVar6); } lVar5 = lVar5 + 1; } while (param_3 != lVar5); } return 1; }
4,955
func0
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> // Function to split integer arrays int** list_split_int(int *S, int length, int step) { int **result = malloc(step * sizeof(int*)); for(int i = 0; i < step; i++) { int count = 0; for(int j = i; j < length; j += step) { count++; } result[i] = malloc(count * sizeof(int)); int index = 0; for(int j = i; j < length; j += step) { result[i][index++] = S[j]; } } return result; } // Function to split string arrays char*** list_split_str(char **S, int length, int step) { char ***result = malloc(step * sizeof(char**)); for(int i = 0; i < step; i++) { int count = 0; for(int j = i; j < length; j += step) { count++; } result[i] = malloc(count * sizeof(char*)); int index = 0; for(int j = i; j < length; j += step) { result[i][index++] = S[j]; } } return result; } // Function to compare integer split results int compare_split_int(int **result, int **expected, int step, int *sizes) { for(int i = 0; i < step; i++) { for(int j = 0; j < sizes[i]; j++) { if(result[i][j] != expected[i][j]) { return 0; } } } return 1; } // Function to compare string split results
int func0(char ***result, char ***expected, int step, int *sizes) { for(int i = 0; i < step; i++) { for(int j = 0; j < sizes[i]; j++) { if(strcmp(result[i][j], expected[i][j]) != 0) { return 0; } } } return 1; }
int main() { // First assert with strings char *S1[] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"}; int length1 = sizeof(S1) / sizeof(S1[0]); int step1 = 3; char ***split1 = list_split_str(S1, length1, step1); char *expected1[][5] = {{"a", "d", "g", "j", "m"}, {"b", "e", "h", "k", "n"}, {"c", "f", "i", "l", NULL}}; int sizes1[] = {5,5,4}; // Prepare expected split char **exp1[3]; exp1[0] = expected1[0]; exp1[1] = expected1[1]; exp1[2] = expected1[2]; assert(func0(split1, exp1, step1, sizes1)); // Second assert with integers int S2[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14}; int length2 = sizeof(S2) / sizeof(S2[0]); int step2 = 3; int **split2 = list_split_int(S2, length2, step2); int expected2[][5] = {{1,4,7,10,13}, {2,5,8,11,14}, {3,6,9,12}}; int sizes2[] = {5,5,4}; // Prepare expected split int *exp2[3]; exp2[0] = expected2[0]; exp2[1] = expected2[1]; exp2[2] = expected2[2]; assert(compare_split_int(split2, exp2, step2, sizes2)); // Third assert with strings char *S3[] = {"python","java","C","C++","DBMS","SQL"}; int length3 = sizeof(S3) / sizeof(S3[0]); int step3 = 2; char ***split3 = list_split_str(S3, length3, step3); char *expected3[][3] = {{"python", "C", "DBMS"}, {"java", "C++", "SQL"}}; int sizes3[] = {3,3}; // Prepare expected split char **exp3[2]; exp3[0] = expected3[0]; exp3[1] = expected3[1]; assert(func0(split3, exp3, step3, sizes3)); // Free allocated memory for(int i = 0; i < step1; i++) { free(split1[i]); } free(split1); for(int i = 0; i < step2; i++) { free(split2[i]); } free(split2); for(int i = 0; i < step3; i++) { free(split3[i]); } free(split3); printf("All asserts passed successfully.\n"); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x28,%rsp mov %rdi,0x8(%rsp) mov %rsi,0x10(%rsp) test %edx,%edx jle 1b30 <func0+0x90> lea -0x1(%rdx),%eax mov %rcx,%r12 xor %ebp,%ebp mov %rax,0x18(%rsp) mov (%r12,%rbp,4),%eax test %eax,%eax jle 1b20 <func0+0x80> mov 0x10(%rsp),%rcx mov 0x8(%rsp),%rdx lea -0x1(%rax),%ebx xor %r15d,%r15d mov (%rcx,%rbp,8),%r14 mov (%rdx,%rbp,8),%r13 jmp 1afc <func0+0x5c> lea 0x1(%r15),%rax cmp %r15,%rbx je 1b20 <func0+0x80> mov %rax,%r15 mov (%r14,%r15,8),%rsi mov 0x0(%r13,%r15,8),%rdi callq 10f0 <strcmp@plt> test %eax,%eax je 1af0 <func0+0x50> add $0x28,%rsp xor %eax,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq lea 0x1(%rbp),%rax cmp %rbp,0x18(%rsp) je 1b30 <func0+0x90> mov %rax,%rbp jmp 1acd <func0+0x2d> add $0x28,%rsp mov $0x1,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw %cs:0x0(%rax,%rax,1) xchg %ax,%ax
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 18h mov [rsp+48h+var_48], rdi test edx, edx jle short loc_1BBB movsxd rax, edx mov r15, rsi mov r13, rcx xor ebp, ebp mov [rsp+48h+var_40], rax loc_1B5A: movsxd rax, dword ptr [r13+rbp*4+0] test eax, eax jle short loc_1BB0 mov r12, [r15+rbp*8] mov rcx, [rsp+48h+var_48] lea rbx, [r12+rax*8] mov r14, [rcx+rbp*8] jmp short loc_1B85 loc_1B78: add r12, 8 add r14, 8 cmp rbx, r12 jz short loc_1BB0 loc_1B85: mov rsi, [r12]; s2 mov rdi, [r14]; s1 call _strcmp test eax, eax jz short loc_1B78 add rsp, 18h xor eax, eax pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1BB0: add rbp, 1 cmp [rsp+48h+var_40], rbp jnz short loc_1B5A loc_1BBB: add rsp, 18h mov eax, 1 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1, long long a2, int a3, long long a4) { long long v5; // rbp long long v6; // rax const char **v7; // r12 const char **v8; // rbx const char **v9; // r14 long long v11; // [rsp+8h] [rbp-40h] if ( a3 <= 0 ) return 1LL; v5 = 0LL; v11 = a3; while ( 1 ) { v6 = *(int *)(a4 + 4 * v5); if ( (int)v6 > 0 ) break; LABEL_8: if ( v11 == ++v5 ) return 1LL; } v7 = *(const char ***)(a2 + 8 * v5); v8 = &v7[v6]; v9 = *(const char ***)(a1 + 8 * v5); while ( !strcmp(*v9, *v7) ) { ++v7; ++v9; if ( v8 == v7 ) goto LABEL_8; } return 0LL; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV qword ptr [RSP],RDI TEST EDX,EDX JLE 0x00101bbb MOVSXD RAX,EDX MOV R15,RSI MOV R13,RCX XOR EBP,EBP MOV qword ptr [RSP + 0x8],RAX LAB_00101b5a: MOVSXD RAX,dword ptr [R13 + RBP*0x4] TEST EAX,EAX JLE 0x00101bb0 MOV R12,qword ptr [R15 + RBP*0x8] MOV RCX,qword ptr [RSP] LEA RBX,[R12 + RAX*0x8] MOV R14,qword ptr [RCX + RBP*0x8] JMP 0x00101b85 LAB_00101b78: ADD R12,0x8 ADD R14,0x8 CMP RBX,R12 JZ 0x00101bb0 LAB_00101b85: MOV RSI,qword ptr [R12] MOV RDI,qword ptr [R14] CALL 0x001010f0 TEST EAX,EAX JZ 0x00101b78 ADD RSP,0x18 XOR EAX,EAX POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101bb0: ADD RBP,0x1 CMP qword ptr [RSP + 0x8],RBP JNZ 0x00101b5a LAB_00101bbb: ADD RSP,0x18 MOV EAX,0x1 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int8 func0(long param_1,long param_2,int param_3,long param_4) { int8 *puVar1; int iVar2; long lVar3; int8 *puVar4; int8 *puVar5; if (0 < param_3) { lVar3 = 0; do { iVar2 = *(int *)(param_4 + lVar3 * 4); if (0 < iVar2) { puVar4 = *(int8 **)(param_2 + lVar3 * 8); puVar1 = puVar4 + iVar2; puVar5 = *(int8 **)(param_1 + lVar3 * 8); do { iVar2 = strcmp((char *)*puVar5,(char *)*puVar4); if (iVar2 != 0) { return 0; } puVar4 = puVar4 + 1; puVar5 = puVar5 + 1; } while (puVar1 != puVar4); } lVar3 = lVar3 + 1; } while (param_3 != lVar3); } return 1; }
4,956
func0
#include <assert.h>
int func0(int l) { int LSA = 4 * (l * l); return LSA; }
int main() { assert(func0(5) == 100); assert(func0(9) == 324); assert(func0(10) == 400); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov -0x14(%rbp),%eax imul %eax,%eax shl $0x2,%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov eax, [rbp+var_14] imul eax, eax shl eax, 2 mov [rbp+var_4], eax mov eax, [rbp+var_4] pop rbp retn
long long func0(int a1) { return (unsigned int)(4 * a1 * a1); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV EAX,dword ptr [RBP + -0x14] IMUL EAX,EAX SHL EAX,0x2 MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] POP RBP RET
int func0(int param_1) { return param_1 * param_1 * 4; }
4,957
func0
#include <assert.h>
int func0(int l) { int LSA = 4 * (l * l); return LSA; }
int main() { assert(func0(5) == 100); assert(func0(9) == 324); assert(func0(10) == 400); return 0; }
O1
c
func0: endbr64 imul %edi,%edi lea 0x0(,%rdi,4),%eax retq
func0: endbr64 imul edi, edi lea eax, ds:0[rdi*4] retn
long long func0(int a1) { return (unsigned int)(4 * a1 * a1); }
func0: ENDBR64 IMUL EDI,EDI LEA EAX,[RDI*0x4] RET
int func0(int param_1) { return param_1 * param_1 * 4; }
4,958
func0
#include <assert.h>
int func0(int l) { int LSA = 4 * (l * l); return LSA; }
int main() { assert(func0(5) == 100); assert(func0(9) == 324); assert(func0(10) == 400); return 0; }
O2
c
func0: endbr64 imul %edi,%edi lea 0x0(,%rdi,4),%eax retq
func0: endbr64 imul edi, edi lea eax, ds:0[rdi*4] retn
long long func0(int a1) { return (unsigned int)(4 * a1 * a1); }
func0: ENDBR64 IMUL EDI,EDI LEA EAX,[RDI*0x4] RET
int func0(int param_1) { return param_1 * param_1 * 4; }
4,959
func0
#include <assert.h>
int func0(int l) { int LSA = 4 * (l * l); return LSA; }
int main() { assert(func0(5) == 100); assert(func0(9) == 324); assert(func0(10) == 400); return 0; }
O3
c
func0: endbr64 imul %edi,%edi lea 0x0(,%rdi,4),%eax retq
func0: endbr64 imul edi, edi lea eax, ds:0[rdi*4] retn
long long func0(int a1) { return (unsigned int)(4 * a1 * a1); }
func0: ENDBR64 IMUL EDI,EDI LEA EAX,[RDI*0x4] RET
int func0(int param_1) { return param_1 * param_1 * 4; }
4,960
func0
#include <assert.h>
int func0(int n) { return (int)(n * (4 * n * n - 1) / 3); }
int main() { assert(func0(2) == 10); assert(func0(3) == 35); assert(func0(4) == 84); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov -0x4(%rbp),%eax imul %eax,%eax shl $0x2,%eax sub $0x1,%eax imul -0x4(%rbp),%eax movslq %eax,%rdx imul $0x55555556,%rdx,%rdx shr $0x20,%rdx sar $0x1f,%eax mov %edx,%ecx sub %eax,%ecx mov %ecx,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov eax, [rbp+var_4] imul eax, eax shl eax, 2 sub eax, 1 imul eax, [rbp+var_4] movsxd rdx, eax imul rdx, 55555556h shr rdx, 20h sar eax, 1Fh sub edx, eax mov eax, edx pop rbp retn
long long func0(int a1) { return (unsigned int)(a1 * (4 * a1 * a1 - 1) / 3); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV EAX,dword ptr [RBP + -0x4] IMUL EAX,EAX SHL EAX,0x2 SUB EAX,0x1 IMUL EAX,dword ptr [RBP + -0x4] MOVSXD RDX,EAX IMUL RDX,RDX,0x55555556 SHR RDX,0x20 SAR EAX,0x1f SUB EDX,EAX MOV EAX,EDX POP RBP RET
int func0(int param_1) { return ((param_1 * param_1 * 4 + -1) * param_1) / 3; }
4,961
func0
#include <assert.h>
int func0(int n) { return (int)(n * (4 * n * n - 1) / 3); }
int main() { assert(func0(2) == 10); assert(func0(3) == 35); assert(func0(4) == 84); return 0; }
O1
c
func0: endbr64 mov %edi,%eax mov %edi,%edx imul %edi,%edx lea -0x1(,%rdx,4),%edi imul %eax,%edi movslq %edi,%rax imul $0x55555556,%rax,%rax shr $0x20,%rax sar $0x1f,%edi sub %edi,%eax retq
func0: endbr64 mov eax, edi mov edx, edi imul edx, edi lea edi, ds:0FFFFFFFFFFFFFFFFh[rdx*4] imul edi, eax movsxd rax, edi imul rax, 55555556h shr rax, 20h sar edi, 1Fh sub eax, edi retn
long long func0(int a1) { return (unsigned int)(a1 * (4 * a1 * a1 - 1) / 3); }
func0: ENDBR64 MOV EAX,EDI MOV EDX,EDI IMUL EDX,EDI LEA EDI,[-0x1 + RDX*0x4] IMUL EDI,EAX MOVSXD RAX,EDI IMUL RAX,RAX,0x55555556 SHR RAX,0x20 SAR EDI,0x1f SUB EAX,EDI RET
int func0(int param_1) { return ((param_1 * param_1 * 4 + -1) * param_1) / 3; }
4,962
func0
#include <assert.h>
int func0(int n) { return (int)(n * (4 * n * n - 1) / 3); }
int main() { assert(func0(2) == 10); assert(func0(3) == 35); assert(func0(4) == 84); return 0; }
O2
c
func0: endbr64 mov %edi,%edx mov %edi,%eax imul %edi,%edx lea -0x1(,%rdx,4),%edi imul %eax,%edi movslq %edi,%rax sar $0x1f,%edi imul $0x55555556,%rax,%rax shr $0x20,%rax sub %edi,%eax retq nopl 0x0(%rax)
func0: endbr64 mov edx, edi mov eax, edi imul edx, edi lea edi, ds:0FFFFFFFFFFFFFFFFh[rdx*4] imul edi, eax movsxd rax, edi sar edi, 1Fh imul rax, 55555556h shr rax, 20h sub eax, edi retn
long long func0(int a1) { return (unsigned int)(a1 * (4 * a1 * a1 - 1) / 3); }
func0: ENDBR64 MOV EDX,EDI MOV EAX,EDI IMUL EDX,EDI LEA EDI,[-0x1 + RDX*0x4] IMUL EDI,EAX MOVSXD RAX,EDI SAR EDI,0x1f IMUL RAX,RAX,0x55555556 SHR RAX,0x20 SUB EAX,EDI RET
int func0(int param_1) { return ((param_1 * param_1 * 4 + -1) * param_1) / 3; }
4,963
func0
#include <assert.h>
int func0(int n) { return (int)(n * (4 * n * n - 1) / 3); }
int main() { assert(func0(2) == 10); assert(func0(3) == 35); assert(func0(4) == 84); return 0; }
O3
c
func0: endbr64 mov %edi,%edx mov %edi,%eax imul %edi,%edx lea -0x1(,%rdx,4),%edi imul %eax,%edi movslq %edi,%rax sar $0x1f,%edi imul $0x55555556,%rax,%rax shr $0x20,%rax sub %edi,%eax retq nopl 0x0(%rax)
func0: endbr64 mov edx, edi mov eax, edi imul edx, edi lea edi, ds:0FFFFFFFFFFFFFFFFh[rdx*4] imul edi, eax movsxd rax, edi sar edi, 1Fh imul rax, 55555556h shr rax, 20h sub eax, edi retn
long long func0(int a1) { return (unsigned int)(a1 * (4 * a1 * a1 - 1) / 3); }
func0: ENDBR64 MOV EDX,EDI MOV EAX,EDI IMUL EDX,EDI LEA EDI,[-0x1 + RDX*0x4] IMUL EDI,EAX MOVSXD RAX,EDI SAR EDI,0x1f IMUL RAX,RAX,0x55555556 SHR RAX,0x20 SUB EAX,EDI RET
int func0(int param_1) { return ((param_1 * param_1 * 4 + -1) * param_1) / 3; }
4,964
func0
#include <assert.h>
int func0(int n) { return (6 * n * (n - 1) + 1); }
int main() { assert(func0(3) == 37); assert(func0(4) == 73); assert(func0(5) == 121); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov -0x4(%rbp),%eax sub $0x1,%eax imul -0x4(%rbp),%eax mov %eax,%edx mov %edx,%eax add %eax,%eax add %edx,%eax add %eax,%eax add $0x1,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov eax, [rbp+var_4] sub eax, 1 imul eax, [rbp+var_4] mov edx, eax mov eax, edx add eax, eax add eax, edx add eax, eax add eax, 1 pop rbp retn
long long func0(int a1) { return (unsigned int)(6 * a1 * (a1 - 1) + 1); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV EAX,dword ptr [RBP + -0x4] SUB EAX,0x1 IMUL EAX,dword ptr [RBP + -0x4] MOV EDX,EAX MOV EAX,EDX ADD EAX,EAX ADD EAX,EDX ADD EAX,EAX ADD EAX,0x1 POP RBP RET
int func0(int param_1) { return (param_1 + -1) * param_1 * 6 + 1; }
4,965
func0
#include <assert.h>
int func0(int n) { return (6 * n * (n - 1) + 1); }
int main() { assert(func0(3) == 37); assert(func0(4) == 73); assert(func0(5) == 121); return 0; }
O1
c
func0: endbr64 mov %edi,%eax lea -0x1(%rdi),%edi imul %eax,%edi lea (%rdi,%rdi,2),%eax lea 0x1(%rax,%rax,1),%eax retq
func0: endbr64 lea eax, [rdi-1] imul eax, edi lea eax, [rax+rax*2] lea eax, [rax+rax+1] retn
long long func0(int a1) { return (unsigned int)(6 * a1 * (a1 - 1) + 1); }
func0: ENDBR64 LEA EAX,[RDI + -0x1] IMUL EAX,EDI LEA EAX,[RAX + RAX*0x2] LEA EAX,[RAX + RAX*0x1 + 0x1] RET
int func0(int param_1) { return (param_1 + -1) * param_1 * 6 + 1; }
4,966
func0
#include <assert.h>
int func0(int n) { return (6 * n * (n - 1) + 1); }
int main() { assert(func0(3) == 37); assert(func0(4) == 73); assert(func0(5) == 121); return 0; }
O2
c
func0: endbr64 mov %edi,%r8d lea -0x1(%rdi),%edi imul %r8d,%edi lea (%rdi,%rdi,2),%eax lea 0x1(%rax,%rax,1),%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 lea eax, [rdi-1] imul eax, edi lea eax, [rax+rax*2] lea eax, [rax+rax+1] retn
long long func0(int a1) { return (unsigned int)(6 * a1 * (a1 - 1) + 1); }
func0: ENDBR64 LEA EAX,[RDI + -0x1] IMUL EAX,EDI LEA EAX,[RAX + RAX*0x2] LEA EAX,[RAX + RAX*0x1 + 0x1] RET
int func0(int param_1) { return (param_1 + -1) * param_1 * 6 + 1; }
4,967
func0
#include <assert.h>
int func0(int n) { return (6 * n * (n - 1) + 1); }
int main() { assert(func0(3) == 37); assert(func0(4) == 73); assert(func0(5) == 121); return 0; }
O3
c
func0: endbr64 mov %edi,%r8d lea -0x1(%rdi),%edi imul %r8d,%edi lea (%rdi,%rdi,2),%eax lea 0x1(%rax,%rax,1),%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 lea eax, [rdi-1] imul eax, edi lea eax, [rax+rax*2] lea eax, [rax+rax+1] retn
long long func0(int a1) { return (unsigned int)(6 * a1 * (a1 - 1) + 1); }
func0: ENDBR64 LEA EAX,[RDI + -0x1] IMUL EAX,EDI LEA EAX,[RAX + RAX*0x2] LEA EAX,[RAX + RAX*0x1 + 0x1] RET
int func0(int param_1) { return (param_1 + -1) * param_1 * 6 + 1; }
4,968
func0
#include <assert.h>
int func0(char k) { return (int)k; }
int main() { assert(func0('A') == 65); assert(func0('R') == 82); assert(func0('S') == 83); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,%eax mov %al,-0x4(%rbp) movsbl -0x4(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov eax, edi mov [rbp+var_4], al movsx eax, [rbp+var_4] pop rbp retn
long long func0(char a1) { return (unsigned int)a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV EAX,EDI MOV byte ptr [RBP + -0x4],AL MOVSX EAX,byte ptr [RBP + -0x4] POP RBP RET
int func0(char param_1) { return (int)param_1; }
4,969
func0
#include <assert.h>
int func0(char k) { return (int)k; }
int main() { assert(func0('A') == 65); assert(func0('R') == 82); assert(func0('S') == 83); return 0; }
O1
c
func0: endbr64 movsbl %dil,%eax retq
func0: endbr64 movsx eax, dil retn
long long func0(char a1) { return (unsigned int)a1; }
func0: ENDBR64 MOVSX EAX,DIL RET
int func0(char param_1) { return (int)param_1; }
4,970
func0
#include <assert.h>
int func0(char k) { return (int)k; }
int main() { assert(func0('A') == 65); assert(func0('R') == 82); assert(func0('S') == 83); return 0; }
O2
c
func0: endbr64 movsbl %dil,%eax retq nopl 0x0(%rax)
func0: endbr64 movsx eax, dil retn
long long func0(char a1) { return (unsigned int)a1; }
func0: ENDBR64 MOVSX EAX,DIL RET
int func0(char param_1) { return (int)param_1; }
4,971
func0
#include <assert.h>
int func0(char k) { return (int)k; }
int main() { assert(func0('A') == 65); assert(func0('R') == 82); assert(func0('S') == 83); return 0; }
O3
c
func0: endbr64 movsbl %dil,%eax retq nopl 0x0(%rax)
func0: endbr64 movsx eax, dil retn
long long func0(char a1) { return (unsigned int)a1; }
func0: ENDBR64 MOVSX EAX,DIL RET
int func0(char param_1) { return (int)param_1; }
4,972
func0
#include <assert.h>
int func0(int arr[], int n) { int sum = 0; for (int i = 0; i < n; i += 2) { if (arr[i] % 2 == 0) { sum += arr[i]; } } return sum; }
int main() { int arr1[] = {5, 6, 12, 1, 18, 8}; int arr2[] = {3, 20, 17, 9, 2, 10, 18, 13, 6, 18}; int arr3[] = {5, 6, 12, 1}; assert(func0(arr1, 6) == 30); assert(func0(arr2, 10) == 26); assert(func0(arr3, 4) == 12); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 11c2 <func0+0x59> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax and $0x1,%eax test %eax,%eax jne 11be <func0+0x55> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%eax add %eax,-0x8(%rbp) addl $0x2,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 1188 <func0+0x1f> mov -0x8(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_11C2 loc_1188: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] and eax, 1 test eax, eax jnz short loc_11BE mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov eax, [rax] add [rbp+var_8], eax loc_11BE: add [rbp+var_4], 2 loc_11C2: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1188 mov eax, [rbp+var_8] pop rbp retn
long long func0(long long a1, int a2) { unsigned int v3; // [rsp+14h] [rbp-8h] int i; // [rsp+18h] [rbp-4h] v3 = 0; for ( i = 0; i < a2; i += 2 ) { if ( (*(_DWORD *)(4LL * i + a1) & 1) == 0 ) v3 += *(_DWORD *)(4LL * i + a1); } return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011c2 LAB_00101188: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] AND EAX,0x1 TEST EAX,EAX JNZ 0x001011be MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EAX,dword ptr [RAX] ADD dword ptr [RBP + -0x8],EAX LAB_001011be: ADD dword ptr [RBP + -0x4],0x2 LAB_001011c2: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101188 MOV EAX,dword ptr [RBP + -0x8] POP RBP RET
int func0(long param_1,int param_2) { int4 local_10; int4 local_c; local_10 = 0; for (local_c = 0; local_c < param_2; local_c = local_c + 2) { if ((*(uint *)(param_1 + (long)local_c * 4) & 1) == 0) { local_10 = local_10 + *(int *)(param_1 + (long)local_c * 4); } } return local_10; }
4,973
func0
#include <assert.h>
int func0(int arr[], int n) { int sum = 0; for (int i = 0; i < n; i += 2) { if (arr[i] % 2 == 0) { sum += arr[i]; } } return sum; }
int main() { int arr1[] = {5, 6, 12, 1, 18, 8}; int arr2[] = {3, 20, 17, 9, 2, 10, 18, 13, 6, 18}; int arr3[] = {5, 6, 12, 1}; assert(func0(arr1, 6) == 30); assert(func0(arr2, 10) == 26); assert(func0(arr3, 4) == 12); return 0; }
O1
c
func0: endbr64 test %esi,%esi jle 119c <func0+0x33> mov %rdi,%rax sub $0x1,%esi shr %esi mov %esi,%esi lea 0x8(%rdi,%rsi,8),%rdi mov $0x0,%edx mov (%rax),%ecx lea (%rdx,%rcx,1),%esi test $0x1,%cl cmove %esi,%edx add $0x8,%rax cmp %rdi,%rax jne 1185 <func0+0x1c> mov %edx,%eax retq mov $0x0,%edx jmp 1199 <func0+0x30>
func0: endbr64 test esi, esi jle short loc_119C mov rax, rdi sub esi, 1 shr esi, 1 mov esi, esi lea rdi, [rdi+rsi*8+8] mov edx, 0 loc_1185: mov ecx, [rax] lea esi, [rdx+rcx] test cl, 1 cmovz edx, esi add rax, 8 cmp rax, rdi jnz short loc_1185 loc_1199: mov eax, edx retn loc_119C: mov edx, 0 jmp short loc_1199
long long func0(_DWORD *a1, int a2) { _DWORD *v2; // rax long long v3; // rdi unsigned int v4; // edx if ( a2 <= 0 ) { return 0; } else { v2 = a1; v3 = (long long)&a1[2 * ((unsigned int)(a2 - 1) >> 1) + 2]; v4 = 0; do { if ( (*v2 & 1) == 0 ) v4 += *v2; v2 += 2; } while ( v2 != (_DWORD *)v3 ); } return v4; }
func0: ENDBR64 TEST ESI,ESI JLE 0x0010119c MOV RAX,RDI SUB ESI,0x1 SHR ESI,0x1 MOV ESI,ESI LEA RDI,[RDI + RSI*0x8 + 0x8] MOV EDX,0x0 LAB_00101185: MOV ECX,dword ptr [RAX] LEA ESI,[RDX + RCX*0x1] TEST CL,0x1 CMOVZ EDX,ESI ADD RAX,0x8 CMP RAX,RDI JNZ 0x00101185 LAB_00101199: MOV EAX,EDX RET LAB_0010119c: MOV EDX,0x0 JMP 0x00101199
int func0(uint *param_1,int param_2) { uint *puVar1; int iVar2; if (param_2 < 1) { iVar2 = 0; } else { puVar1 = param_1 + (ulong)(param_2 - 1U >> 1) * 2 + 2; iVar2 = 0; do { if ((*param_1 & 1) == 0) { iVar2 = iVar2 + *param_1; } param_1 = param_1 + 2; } while (param_1 != puVar1); } return iVar2; }
4,974
func0
#include <assert.h>
int func0(int arr[], int n) { int sum = 0; for (int i = 0; i < n; i += 2) { if (arr[i] % 2 == 0) { sum += arr[i]; } } return sum; }
int main() { int arr1[] = {5, 6, 12, 1, 18, 8}; int arr2[] = {3, 20, 17, 9, 2, 10, 18, 13, 6, 18}; int arr3[] = {5, 6, 12, 1}; assert(func0(arr1, 6) == 30); assert(func0(arr2, 10) == 26); assert(func0(arr3, 4) == 12); return 0; }
O2
c
func0: endbr64 test %esi,%esi jle 1270 <func0+0x30> sub $0x1,%esi xor %eax,%eax shr %esi lea 0x8(%rdi,%rsi,8),%rsi nopl 0x0(%rax) mov (%rdi),%edx lea (%rax,%rdx,1),%ecx and $0x1,%edx cmove %ecx,%eax add $0x8,%rdi cmp %rsi,%rdi jne 1258 <func0+0x18> retq nopl (%rax) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 test esi, esi jle short loc_1270 sub esi, 1 xor eax, eax shr esi, 1 lea rsi, [rdi+rsi*8+8] nop dword ptr [rax+00h] loc_1258: mov edx, [rdi] lea ecx, [rax+rdx] and edx, 1 cmovz eax, ecx add rdi, 8 cmp rdi, rsi jnz short loc_1258 retn loc_1270: xor eax, eax retn
long long func0(_DWORD *a1, int a2) { long long result; // rax long long v3; // rsi if ( a2 <= 0 ) return 0LL; result = 0LL; v3 = (long long)&a1[2 * ((unsigned int)(a2 - 1) >> 1) + 2]; do { if ( (*a1 & 1) == 0 ) result = (unsigned int)(result + *a1); a1 += 2; } while ( a1 != (_DWORD *)v3 ); return result; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101270 SUB ESI,0x1 XOR EAX,EAX SHR ESI,0x1 LEA RSI,[RDI + RSI*0x8 + 0x8] NOP dword ptr [RAX] LAB_00101258: MOV EDX,dword ptr [RDI] LEA ECX,[RAX + RDX*0x1] AND EDX,0x1 CMOVZ EAX,ECX ADD RDI,0x8 CMP RDI,RSI JNZ 0x00101258 RET LAB_00101270: XOR EAX,EAX RET
int func0(uint *param_1,int param_2) { uint *puVar1; int iVar2; if (0 < param_2) { iVar2 = 0; puVar1 = param_1 + (ulong)(param_2 - 1U >> 1) * 2 + 2; do { if ((*param_1 & 1) == 0) { iVar2 = iVar2 + *param_1; } param_1 = param_1 + 2; } while (param_1 != puVar1); return iVar2; } return 0; }
4,975
func0
#include <assert.h>
int func0(int arr[], int n) { int sum = 0; for (int i = 0; i < n; i += 2) { if (arr[i] % 2 == 0) { sum += arr[i]; } } return sum; }
int main() { int arr1[] = {5, 6, 12, 1, 18, 8}; int arr2[] = {3, 20, 17, 9, 2, 10, 18, 13, 6, 18}; int arr3[] = {5, 6, 12, 1}; assert(func0(arr1, 6) == 30); assert(func0(arr2, 10) == 26); assert(func0(arr3, 4) == 12); return 0; }
O3
c
func0: endbr64 test %esi,%esi jle 1328 <func0+0xe8> lea -0x1(%rsi),%edx cmp $0x7,%edx jbe 132b <func0+0xeb> shr $0x3,%edx pxor %xmm2,%xmm2 movdqa 0xdf9(%rip),%xmm4 mov %rdi,%rax mov %edx,%ecx movdqa %xmm2,%xmm3 shl $0x5,%rcx add %rdi,%rcx nopw 0x0(%rax,%rax,1) movdqu (%rax),%xmm1 movdqu 0x10(%rax),%xmm5 add $0x20,%rax shufps $0x88,%xmm5,%xmm1 movdqa %xmm1,%xmm0 pand %xmm4,%xmm0 pcmpeqd %xmm3,%xmm0 pand %xmm1,%xmm0 paddd %xmm0,%xmm2 cmp %rcx,%rax jne 1280 <func0+0x40> movdqa %xmm2,%xmm0 shl $0x3,%edx psrldq $0x8,%xmm0 paddd %xmm0,%xmm2 movdqa %xmm2,%xmm0 psrldq $0x4,%xmm0 paddd %xmm0,%xmm2 movd %xmm2,%eax movslq %edx,%rcx mov (%rdi,%rcx,4),%ecx lea (%rax,%rcx,1),%r8d and $0x1,%ecx lea 0x2(%rdx),%ecx cmove %r8d,%eax cmp %ecx,%esi jle 132a <func0+0xea> movslq %ecx,%rcx mov (%rdi,%rcx,4),%ecx lea (%rax,%rcx,1),%r8d and $0x1,%ecx lea 0x4(%rdx),%ecx cmove %r8d,%eax cmp %ecx,%esi jle 132a <func0+0xea> movslq %ecx,%rcx mov (%rdi,%rcx,4),%ecx lea (%rax,%rcx,1),%r8d and $0x1,%ecx cmove %r8d,%eax add $0x6,%edx cmp %edx,%esi jle 132a <func0+0xea> movslq %edx,%rdx mov (%rdi,%rdx,4),%edx lea (%rax,%rdx,1),%ecx and $0x1,%edx cmove %ecx,%eax retq nopl 0x0(%rax,%rax,1) xor %eax,%eax retq xor %edx,%edx xor %eax,%eax jmp 12cb <func0+0x8b> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 test esi, esi jle loc_1230 lea edx, [rsi-1] cmp edx, 7 jbe loc_1233 shr edx, 3 pxor xmm2, xmm2 movdqa xmm4, cs:xmmword_2010 mov rax, rdi mov ecx, edx movdqa xmm3, xmm2 shl rcx, 5 add rcx, rdi nop word ptr [rax+rax+00000000h] loc_1180: movdqu xmm1, xmmword ptr [rax] movdqu xmm5, xmmword ptr [rax+10h] add rax, 20h ; ' ' shufps xmm1, xmm5, 88h movdqa xmm0, xmm1 pand xmm0, xmm4 pcmpeqd xmm0, xmm3 pand xmm0, xmm1 paddd xmm2, xmm0 cmp rcx, rax jnz short loc_1180 movdqa xmm0, xmm2 shl edx, 3 psrldq xmm0, 8 paddd xmm2, xmm0 movdqa xmm0, xmm2 psrldq xmm0, 4 paddd xmm2, xmm0 movd eax, xmm2 loc_11CB: movsxd r8, edx lea rcx, ds:0[r8*4] mov r8d, [rdi+r8*4] lea r9d, [rax+r8] and r8d, 1 lea r8d, [rdx+2] cmovz eax, r9d cmp esi, r8d jle short locret_1232 mov r8d, [rdi+rcx+8] lea r9d, [rax+r8] and r8d, 1 lea r8d, [rdx+4] cmovz eax, r9d cmp esi, r8d jle short locret_1232 mov r8d, [rdi+rcx+10h] lea r9d, [rax+r8] and r8d, 1 cmovz eax, r9d add edx, 6 cmp edx, esi jge short locret_1232 mov edx, [rdi+rcx+18h] lea ecx, [rax+rdx] and edx, 1 cmovz eax, ecx retn loc_1230: xor eax, eax locret_1232: retn loc_1233: xor edx, edx xor eax, eax jmp short loc_11CB
long long func0(const __m128i *a1, int a2) { unsigned int v2; // edx __m128i v3; // xmm2 __m128i si128; // xmm4 const __m128i *v5; // rax __m128 v6; // xmm1 __m128 v7; // xmm5 __m128i v8; // xmm1 int v9; // edx __m128i v10; // xmm2 long long result; // rax long long v12; // rcx __int32 v13; // r8d __int32 v14; // r8d __int32 v15; // r8d __int32 v16; // edx if ( a2 <= 0 ) return 0LL; if ( (unsigned int)(a2 - 1) <= 7 ) { v9 = 0; result = 0LL; } else { v2 = (unsigned int)(a2 - 1) >> 3; v3 = 0LL; si128 = _mm_load_si128((const __m128i *)&xmmword_2010); v5 = a1; do { v6 = (__m128)_mm_loadu_si128(v5); v7 = (__m128)_mm_loadu_si128(v5 + 1); v5 += 2; v8 = (__m128i)_mm_shuffle_ps(v6, v7, 136); v3 = _mm_add_epi32(v3, _mm_and_si128(_mm_cmpeq_epi32(_mm_and_si128(v8, si128), (__m128i)0LL), v8)); } while ( &a1[2 * v2] != v5 ); v9 = 8 * v2; v10 = _mm_add_epi32(v3, _mm_srli_si128(v3, 8)); result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v10, _mm_srli_si128(v10, 4))); } v12 = v9; v13 = a1->m128i_i32[v12]; if ( (v13 & 1) == 0 ) result = (unsigned int)(result + v13); if ( a2 > v9 + 2 ) { v14 = a1->m128i_i32[v12 + 2]; if ( (v14 & 1) == 0 ) result = (unsigned int)(result + v14); if ( a2 > v9 + 4 ) { v15 = a1[1].m128i_i32[v12]; if ( (v15 & 1) == 0 ) result = (unsigned int)(result + v15); if ( v9 + 6 < a2 ) { v16 = a1[1].m128i_i32[v12 + 2]; if ( (v16 & 1) == 0 ) return (unsigned int)(result + v16); } } } return result; }
func0: ENDBR64 TEST ESI,ESI JLE 0x00101230 LEA EDX,[RSI + -0x1] CMP EDX,0x7 JBE 0x00101233 SHR EDX,0x3 PXOR XMM2,XMM2 MOVDQA XMM4,xmmword ptr [0x00102010] MOV RAX,RDI MOV ECX,EDX MOVDQA XMM3,XMM2 SHL RCX,0x5 ADD RCX,RDI NOP word ptr [RAX + RAX*0x1] LAB_00101180: MOVDQU XMM1,xmmword ptr [RAX] MOVDQU XMM5,xmmword ptr [RAX + 0x10] ADD RAX,0x20 SHUFPS XMM1,XMM5,0x88 MOVDQA XMM0,XMM1 PAND XMM0,XMM4 PCMPEQD XMM0,XMM3 PAND XMM0,XMM1 PADDD XMM2,XMM0 CMP RCX,RAX JNZ 0x00101180 MOVDQA XMM0,XMM2 SHL EDX,0x3 PSRLDQ XMM0,0x8 PADDD XMM2,XMM0 MOVDQA XMM0,XMM2 PSRLDQ XMM0,0x4 PADDD XMM2,XMM0 MOVD EAX,XMM2 LAB_001011cb: MOVSXD R8,EDX LEA RCX,[R8*0x4] MOV R8D,dword ptr [RDI + R8*0x4] LEA R9D,[RAX + R8*0x1] AND R8D,0x1 LEA R8D,[RDX + 0x2] CMOVZ EAX,R9D CMP ESI,R8D JLE 0x00101232 MOV R8D,dword ptr [RDI + RCX*0x1 + 0x8] LEA R9D,[RAX + R8*0x1] AND R8D,0x1 LEA R8D,[RDX + 0x4] CMOVZ EAX,R9D CMP ESI,R8D JLE 0x00101232 MOV R8D,dword ptr [RDI + RCX*0x1 + 0x10] LEA R9D,[RAX + R8*0x1] AND R8D,0x1 CMOVZ EAX,R9D ADD EDX,0x6 CMP EDX,ESI JGE 0x00101232 MOV EDX,dword ptr [RDI + RCX*0x1 + 0x18] LEA ECX,[RAX + RDX*0x1] AND EDX,0x1 CMOVZ EAX,ECX RET LAB_00101230: XOR EAX,EAX LAB_00101232: RET LAB_00101233: XOR EDX,EDX XOR EAX,EAX JMP 0x001011cb
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ int func0(uint *param_1,int param_2) { uint *puVar1; uint uVar2; uint *puVar3; uint *puVar4; uint *puVar5; uint uVar6; int iVar7; int iVar8; int iVar9; int iVar10; int iVar11; if (param_2 < 1) { iVar8 = 0; } else { if (param_2 - 1U < 8) { iVar7 = 0; iVar8 = 0; } else { uVar6 = param_2 - 1U >> 3; iVar8 = 0; iVar9 = 0; iVar10 = 0; iVar11 = 0; puVar5 = param_1; do { uVar2 = *puVar5; puVar3 = puVar5 + 2; puVar1 = puVar5 + 4; puVar4 = puVar5 + 6; puVar5 = puVar5 + 8; iVar8 = iVar8 + (-(uint)((uVar2 & _DAT_00102010) == 0) & uVar2); iVar9 = iVar9 + (-(uint)((*puVar3 & _UNK_00102014) == 0) & *puVar3); iVar10 = iVar10 + (-(uint)((*puVar1 & _UNK_00102018) == 0) & *puVar1); iVar11 = iVar11 + (-(uint)((*puVar4 & _UNK_0010201c) == 0) & *puVar4); } while (param_1 + (ulong)uVar6 * 8 != puVar5); iVar7 = uVar6 << 3; iVar8 = iVar8 + iVar10 + iVar9 + iVar11; } if ((param_1[iVar7] & 1) == 0) { iVar8 = iVar8 + param_1[iVar7]; } if (iVar7 + 2 < param_2) { if ((param_1[(long)iVar7 + 2] & 1) == 0) { iVar8 = iVar8 + param_1[(long)iVar7 + 2]; } if (iVar7 + 4 < param_2) { if ((param_1[(long)iVar7 + 4] & 1) == 0) { iVar8 = iVar8 + param_1[(long)iVar7 + 4]; } if (iVar7 + 6 < param_2) { if ((param_1[(long)iVar7 + 6] & 1) == 0) { iVar8 = iVar8 + param_1[(long)iVar7 + 6]; } return iVar8; } } } } return iVar8; }
4,976
func0
#include <assert.h>
long func0(int n) { long sum = 0; for (int i = 1; i <= n; i++) { int j = 2 * i; sum += j * j * j * j * j; } return sum; }
int main() { assert(func0(2) == 1056); assert(func0(3) == 8832); assert(func0(1) == 32); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) movq $0x0,-0x8(%rbp) movl $0x1,-0x10(%rbp) jmp 1189 <func0+0x40> mov -0x10(%rbp),%eax add %eax,%eax mov %eax,-0xc(%rbp) mov -0xc(%rbp),%eax imul %eax,%eax imul -0xc(%rbp),%eax imul -0xc(%rbp),%eax imul -0xc(%rbp),%eax cltq add %rax,-0x8(%rbp) addl $0x1,-0x10(%rbp) mov -0x10(%rbp),%eax cmp -0x14(%rbp),%eax jle 1165 <func0+0x1c> mov -0x8(%rbp),%rax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_8], 0 mov [rbp+var_10], 1 jmp short loc_1189 loc_1165: mov eax, [rbp+var_10] add eax, eax mov [rbp+var_C], eax mov eax, [rbp+var_C] imul eax, eax imul eax, [rbp+var_C] imul eax, [rbp+var_C] imul eax, [rbp+var_C] cdqe add [rbp+var_8], rax add [rbp+var_10], 1 loc_1189: mov eax, [rbp+var_10] cmp eax, [rbp+var_14] jle short loc_1165 mov rax, [rbp+var_8] pop rbp retn
long long func0(int a1) { int i; // [rsp+4h] [rbp-10h] long long v3; // [rsp+Ch] [rbp-8h] v3 = 0LL; for ( i = 1; i <= a1; ++i ) v3 += 2 * i * 2 * i * 2 * i * 2 * i * 2 * i; return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV qword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x10],0x1 JMP 0x00101189 LAB_00101165: MOV EAX,dword ptr [RBP + -0x10] ADD EAX,EAX MOV dword ptr [RBP + -0xc],EAX MOV EAX,dword ptr [RBP + -0xc] IMUL EAX,EAX IMUL EAX,dword ptr [RBP + -0xc] IMUL EAX,dword ptr [RBP + -0xc] IMUL EAX,dword ptr [RBP + -0xc] CDQE ADD qword ptr [RBP + -0x8],RAX ADD dword ptr [RBP + -0x10],0x1 LAB_00101189: MOV EAX,dword ptr [RBP + -0x10] CMP EAX,dword ptr [RBP + -0x14] JLE 0x00101165 MOV RAX,qword ptr [RBP + -0x8] POP RBP RET
long func0(int param_1) { int iVar1; int4 local_18; int8 local_10; local_10 = 0; for (local_18 = 1; local_18 <= param_1; local_18 = local_18 + 1) { iVar1 = local_18 * 2; local_10 = local_10 + iVar1 * iVar1 * iVar1 * iVar1 * iVar1; } return local_10; }
4,977
func0
#include <assert.h>
long func0(int n) { long sum = 0; for (int i = 1; i <= n; i++) { int j = 2 * i; sum += j * j * j * j * j; } return sum; }
int main() { assert(func0(2) == 1056); assert(func0(3) == 8832); assert(func0(1) == 32); return 0; }
O1
c
func0: endbr64 test %edi,%edi jle 117a <func0+0x31> lea 0x2(%rdi,%rdi,1),%esi mov $0x2,%edx mov $0x0,%ecx mov %edx,%eax imul %edx,%eax imul %eax,%eax imul %edx,%eax cltq add %rax,%rcx add $0x2,%edx cmp %esi,%edx jne 115f <func0+0x16> mov %rcx,%rax retq mov $0x0,%ecx jmp 1176 <func0+0x2d>
func0: endbr64 test edi, edi jle short loc_117A lea esi, [rdi+rdi+2] mov edx, 2 mov ecx, 0 loc_115F: mov eax, edx imul eax, edx imul eax, eax imul eax, edx cdqe add rcx, rax add edx, 2 cmp edx, esi jnz short loc_115F loc_1176: mov rax, rcx retn loc_117A: mov ecx, 0 jmp short loc_1176
long long func0(int a1) { int v1; // edx long long v2; // rcx if ( a1 <= 0 ) return 0LL; v1 = 2; v2 = 0LL; do { v2 += v1 * v1 * v1 * v1 * v1; v1 += 2; } while ( v1 != 2 * a1 + 2 ); return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x0010117a LEA ESI,[RDI + RDI*0x1 + 0x2] MOV EDX,0x2 MOV ECX,0x0 LAB_0010115f: MOV EAX,EDX IMUL EAX,EDX IMUL EAX,EAX IMUL EAX,EDX CDQE ADD RCX,RAX ADD EDX,0x2 CMP EDX,ESI JNZ 0x0010115f LAB_00101176: MOV RAX,RCX RET LAB_0010117a: MOV ECX,0x0 JMP 0x00101176
long func0(int param_1) { long lVar1; int iVar2; if (param_1 < 1) { lVar1 = 0; } else { iVar2 = 2; lVar1 = 0; do { lVar1 = lVar1 + iVar2 * iVar2 * iVar2 * iVar2 * iVar2; iVar2 = iVar2 + 2; } while (iVar2 != param_1 * 2 + 2); } return lVar1; }
4,978
func0
#include <assert.h>
long func0(int n) { long sum = 0; for (int i = 1; i <= n; i++) { int j = 2 * i; sum += j * j * j * j * j; } return sum; }
int main() { assert(func0(2) == 1056); assert(func0(3) == 8832); assert(func0(1) == 32); return 0; }
O2
c
func0: endbr64 test %edi,%edi jle 1178 <func0+0x38> lea 0x2(%rdi,%rdi,1),%ecx mov $0x2,%edx xor %r8d,%r8d nopl 0x0(%rax) mov %edx,%eax imul %edx,%eax imul %eax,%eax imul %edx,%eax add $0x2,%edx cltq add %rax,%r8 cmp %edx,%ecx jne 1158 <func0+0x18> mov %r8,%rax retq nopl 0x0(%rax,%rax,1) xor %r8d,%r8d mov %r8,%rax retq
func0: endbr64 test edi, edi jle short loc_1178 lea ecx, [rdi+rdi+2] mov edx, 2 xor r8d, r8d nop dword ptr [rax+00h] loc_1158: mov eax, edx imul eax, edx imul eax, eax imul eax, edx add edx, 2 cdqe add r8, rax cmp ecx, edx jnz short loc_1158 mov rax, r8 retn loc_1178: xor r8d, r8d mov rax, r8 retn
long long func0(int a1) { int v1; // edx long long v2; // r8 int v3; // eax if ( a1 <= 0 ) return 0LL; v1 = 2; v2 = 0LL; do { v3 = v1 * v1 * v1 * v1 * v1; v1 += 2; v2 += v3; } while ( 2 * a1 + 2 != v1 ); return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101178 LEA ECX,[RDI + RDI*0x1 + 0x2] MOV EDX,0x2 XOR R8D,R8D NOP dword ptr [RAX] LAB_00101158: MOV EAX,EDX IMUL EAX,EDX IMUL EAX,EAX IMUL EAX,EDX ADD EDX,0x2 CDQE ADD R8,RAX CMP ECX,EDX JNZ 0x00101158 MOV RAX,R8 RET LAB_00101178: XOR R8D,R8D MOV RAX,R8 RET
long func0(int param_1) { int iVar1; int iVar2; long lVar3; if (0 < param_1) { iVar2 = 2; lVar3 = 0; do { iVar1 = iVar2 * iVar2 * iVar2 * iVar2 * iVar2; iVar2 = iVar2 + 2; lVar3 = lVar3 + iVar1; } while (param_1 * 2 + 2 != iVar2); return lVar3; } return 0; }
4,979
func0
#include <assert.h>
long func0(int n) { long sum = 0; for (int i = 1; i <= n; i++) { int j = 2 * i; sum += j * j * j * j * j; } return sum; }
int main() { assert(func0(2) == 1056); assert(func0(3) == 8832); assert(func0(1) == 32); return 0; }
O3
c
func0: endbr64 test %edi,%edi jle 1178 <func0+0x38> lea 0x2(%rdi,%rdi,1),%ecx mov $0x2,%edx xor %r8d,%r8d nopl 0x0(%rax) mov %edx,%eax imul %edx,%eax imul %eax,%eax imul %edx,%eax add $0x2,%edx cltq add %rax,%r8 cmp %edx,%ecx jne 1158 <func0+0x18> mov %r8,%rax retq nopl 0x0(%rax,%rax,1) xor %r8d,%r8d mov %r8,%rax retq
func0: endbr64 test edi, edi jle short loc_1178 lea esi, [rdi+rdi+2] mov edx, 2 xor ecx, ecx nop dword ptr [rax+rax+00h] loc_1158: mov eax, edx imul eax, edx imul eax, eax imul eax, edx add edx, 2 cdqe add rcx, rax cmp esi, edx jnz short loc_1158 mov rax, rcx retn loc_1178: xor ecx, ecx mov rax, rcx retn
long long func0(int a1) { int v1; // edx long long v2; // rcx int v3; // eax if ( a1 <= 0 ) return 0LL; v1 = 2; v2 = 0LL; do { v3 = v1 * v1 * v1 * v1 * v1; v1 += 2; v2 += v3; } while ( 2 * a1 + 2 != v1 ); return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101178 LEA ESI,[RDI + RDI*0x1 + 0x2] MOV EDX,0x2 XOR ECX,ECX NOP dword ptr [RAX + RAX*0x1] LAB_00101158: MOV EAX,EDX IMUL EAX,EDX IMUL EAX,EAX IMUL EAX,EDX ADD EDX,0x2 CDQE ADD RCX,RAX CMP ESI,EDX JNZ 0x00101158 MOV RAX,RCX RET LAB_00101178: XOR ECX,ECX MOV RAX,RCX RET
long func0(int param_1) { int iVar1; long lVar2; int iVar3; if (0 < param_1) { iVar3 = 2; lVar2 = 0; do { iVar1 = iVar3 * iVar3 * iVar3 * iVar3 * iVar3; iVar3 = iVar3 + 2; lVar2 = lVar2 + iVar1; } while (param_1 * 2 + 2 != iVar3); return lVar2; } return 0; }
4,980
func0
#include <assert.h> #include <stdio.h>
int* func0(int test_list[][3], int length, int *output) { for (int i = 0; i < length; i++) { output[i] = test_list[i][2]; } return output; }
int main() { int list1[][3] = {{1, 'R', 21}, {2, 'V', 20}, {3, 'K', 19}}; int list2[][3] = {{1, 'S', 36}, {2, 'A', 25}, {3, 'S', 45}}; int list3[][3] = {{1, 'S', 14}, {2, 'V', 36}, {3, 'D', 56}}; int length1 = sizeof(list1) / sizeof(list1[0]); int length2 = sizeof(list2) / sizeof(list2[0]); int length3 = sizeof(list3) / sizeof(list3[0]); int output1[3], output2[3], output3[3]; func0(list1, length1, output1); func0(list2, length2, output2); func0(list3, length3, output3); assert(output1[0] == 21 && output1[1] == 20 && output1[2] == 19); assert(output2[0] == 36 && output2[1] == 25 && output2[2] == 45); assert(output3[0] == 14 && output3[1] == 36 && output3[2] == 56); printf("All tests passed!\n"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %rdx,-0x28(%rbp) movl $0x0,-0x4(%rbp) jmp 11e0 <func0+0x57> mov -0x4(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax add %rax,%rax add %rdx,%rax shl $0x2,%rax mov %rax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0x4(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,4),%rcx mov -0x28(%rbp),%rdx add %rcx,%rdx mov 0x8(%rax),%eax mov %eax,(%rdx) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11a5 <func0+0x1c> mov -0x28(%rbp),%rax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_28], rdx mov [rbp+var_4], 0 jmp short loc_11E0 loc_11A5: mov eax, [rbp+var_4] movsxd rdx, eax mov rax, rdx add rax, rax add rax, rdx shl rax, 2 mov rdx, rax mov rax, [rbp+var_18] add rax, rdx mov edx, [rbp+var_4] movsxd rdx, edx lea rcx, ds:0[rdx*4] mov rdx, [rbp+var_28] add rdx, rcx mov eax, [rax+8] mov [rdx], eax add [rbp+var_4], 1 loc_11E0: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_11A5 mov rax, [rbp+var_28] pop rbp retn
long long func0(long long a1, int a2, long long a3) { int i; // [rsp+24h] [rbp-4h] for ( i = 0; i < a2; ++i ) *(_DWORD *)(4LL * i + a3) = *(_DWORD *)(12LL * i + a1 + 8); return a3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011e0 LAB_001011a5: MOV EAX,dword ptr [RBP + -0x4] MOVSXD RDX,EAX MOV RAX,RDX ADD RAX,RAX ADD RAX,RDX SHL RAX,0x2 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0x4] MOVSXD RDX,EDX LEA RCX,[RDX*0x4] MOV RDX,qword ptr [RBP + -0x28] ADD RDX,RCX MOV EAX,dword ptr [RAX + 0x8] MOV dword ptr [RDX],EAX ADD dword ptr [RBP + -0x4],0x1 LAB_001011e0: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011a5 MOV RAX,qword ptr [RBP + -0x28] POP RBP RET
long func0(long param_1,int param_2,long param_3) { int4 local_c; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { *(int4 *)(param_3 + (long)local_c * 4) = *(int4 *)(param_1 + (long)local_c * 0xc + 8); } return param_3; }
4,981
func0
#include <assert.h> #include <stdio.h>
int* func0(int test_list[][3], int length, int *output) { for (int i = 0; i < length; i++) { output[i] = test_list[i][2]; } return output; }
int main() { int list1[][3] = {{1, 'R', 21}, {2, 'V', 20}, {3, 'K', 19}}; int list2[][3] = {{1, 'S', 36}, {2, 'A', 25}, {3, 'S', 45}}; int list3[][3] = {{1, 'S', 14}, {2, 'V', 36}, {3, 'D', 56}}; int length1 = sizeof(list1) / sizeof(list1[0]); int length2 = sizeof(list2) / sizeof(list2[0]); int length3 = sizeof(list3) / sizeof(list3[0]); int output1[3], output2[3], output3[3]; func0(list1, length1, output1); func0(list2, length2, output2); func0(list3, length3, output3); assert(output1[0] == 21 && output1[1] == 20 && output1[2] == 19); assert(output2[0] == 36 && output2[1] == 25 && output2[2] == 45); assert(output3[0] == 14 && output3[1] == 36 && output3[2] == 56); printf("All tests passed!\n"); return 0; }
O1
c
func0: endbr64 mov %rdx,%rax test %esi,%esi jle 11b4 <func0+0x2b> add $0x8,%rdi mov %rdx,%rcx lea -0x1(%rsi),%edx lea 0x4(%rax,%rdx,4),%r8 mov (%rdi),%esi mov %esi,(%rcx) add $0xc,%rdi add $0x4,%rcx cmp %r8,%rcx jne 11a3 <func0+0x1a> retq
func0: endbr64 mov rax, rdx test esi, esi jle short locret_11B4 add rdi, 8 mov rcx, rdx lea edx, [rsi-1] lea r8, [rax+rdx*4+4] loc_11A3: mov esi, [rdi] mov [rcx], esi add rdi, 0Ch add rcx, 4 cmp rcx, r8 jnz short loc_11A3 locret_11B4: retn
_DWORD * func0(long long a1, int a2, _DWORD *a3) { _DWORD *result; // rax _DWORD *v4; // rdi _DWORD *v5; // rcx result = a3; if ( a2 > 0 ) { v4 = (_DWORD *)(a1 + 8); v5 = a3; do { *v5 = *v4; v4 += 3; ++v5; } while ( v5 != &a3[a2 - 1 + 1] ); } return result; }
func0: ENDBR64 MOV RAX,RDX TEST ESI,ESI JLE 0x001011b4 ADD RDI,0x8 MOV RCX,RDX LEA EDX,[RSI + -0x1] LEA R8,[RAX + RDX*0x4 + 0x4] LAB_001011a3: MOV ESI,dword ptr [RDI] MOV dword ptr [RCX],ESI ADD RDI,0xc ADD RCX,0x4 CMP RCX,R8 JNZ 0x001011a3 LAB_001011b4: RET
void func0(long param_1,int param_2,int4 *param_3) { int4 *puVar1; int4 *puVar2; if (0 < param_2) { puVar2 = (int4 *)(param_1 + 8); puVar1 = param_3 + (ulong)(param_2 - 1) + 1; do { *param_3 = *puVar2; puVar2 = puVar2 + 3; param_3 = param_3 + 1; } while (param_3 != puVar1); } return; }