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,182
func0
#include <assert.h> #include <stdbool.h>
bool func0(int n) { if (n % 4 != 2) { return true; } return false; }
int main() { assert(func0(5) == true); assert(func0(10) == false); assert(func0(15) == true); return 0; }
O2
c
func0: endbr64 and $0x80000003,%edi cmp $0x2,%edi setne %al retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 and edi, 80000003h cmp edi, 2 setnz al retn
bool func0(int a1) { return (a1 & 0x80000003) != 2; }
func0: ENDBR64 AND EDI,0x80000003 CMP EDI,0x2 SETNZ AL RET
bool func0(uint param_1) { return (param_1 & 0x80000003) != 2; }
4,183
func0
#include <assert.h> #include <stdbool.h>
bool func0(int n) { if (n % 4 != 2) { return true; } return false; }
int main() { assert(func0(5) == true); assert(func0(10) == false); assert(func0(15) == true); return 0; }
O3
c
func0: endbr64 and $0x80000003,%edi cmp $0x2,%edi setne %al retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
func0: endbr64 and edi, 80000003h cmp edi, 2 setnz al retn
bool func0(int a1) { return (a1 & 0x80000003) != 2; }
func0: ENDBR64 AND EDI,0x80000003 CMP EDI,0x2 SETNZ AL RET
bool func0(uint param_1) { return (param_1 & 0x80000003) != 2; }
4,184
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { char** tokens; int count; } split_result;
split_result func0(const char* text) { split_result result; result.tokens = NULL; result.count = 0; const char* delimiters[] = {"; ", ", ", "*", "\n"}; int num_delimiters = 4; char* temp = strdup(text); char* ptr = temp; char* match; int min_index; while (*ptr) { min_index = -1; size_t min_pos = strlen(ptr); for (int i = 0; i < num_delimiters; i++) { char* found = strstr(ptr, delimiters[i]); if (found && (found - ptr) < min_pos) { min_pos = found - ptr; min_index = i; } } if (min_index == -1) { result.tokens = realloc(result.tokens, sizeof(char*) * (result.count + 1)); result.tokens[result.count++] = strdup(ptr); break; } if (min_pos > 0) { result.tokens = realloc(result.tokens, sizeof(char*) * (result.count + 1)); char* token = strndup(ptr, min_pos); result.tokens[result.count++] = token; } ptr += min_pos + strlen(delimiters[min_index]); } free(temp); return result; }
int main(){ split_result res1 = func0("Forces of the \ndarkness*are coming into the play."); assert(res1.count == 3); assert(strcmp(res1.tokens[0], "Forces of the ") == 0); assert(strcmp(res1.tokens[1], "darkness") == 0); assert(strcmp(res1.tokens[2], "are coming into the play.") == 0); for(int i=0;i<res1.count;i++) free(res1.tokens[i]); free(res1.tokens); split_result res2 = func0("Mi Box runs on the \n Latest android*which has google assistance and chromecast."); assert(res2.count == 3); assert(strcmp(res2.tokens[0], "Mi Box runs on the ") == 0); assert(strcmp(res2.tokens[1], " Latest android") == 0); assert(strcmp(res2.tokens[2], "which has google assistance and chromecast.") == 0); for(int i=0;i<res2.count;i++) free(res2.tokens[i]); free(res2.tokens); split_result res3 = func0("Certain services\nare subjected to change*over the seperate subscriptions."); assert(res3.count == 3); assert(strcmp(res3.tokens[0], "Certain services") == 0); assert(strcmp(res3.tokens[1], "are subjected to change") == 0); assert(strcmp(res3.tokens[2], "over the seperate subscriptions.") == 0); for(int i=0;i<res3.count;i++) free(res3.tokens[i]); free(res3.tokens); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x98,%rsp mov %rdi,-0x98(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax movq $0x0,-0x50(%rbp) movl $0x0,-0x48(%rbp) lea 0xd83(%rip),%rax mov %rax,-0x40(%rbp) lea 0xd7b(%rip),%rax mov %rax,-0x38(%rbp) lea 0xd73(%rip),%rax mov %rax,-0x30(%rbp) lea 0xd6a(%rip),%rax mov %rax,-0x28(%rbp) movl $0x4,-0x7c(%rbp) mov -0x98(%rbp),%rax mov %rax,%rdi callq 1140 <strdup@plt> mov %rax,-0x68(%rbp) mov -0x68(%rbp),%rax mov %rax,-0x78(%rbp) jmpq 141d <func0+0x1d4> movl $0xffffffff,-0x84(%rbp) mov -0x78(%rbp),%rax mov %rax,%rdi callq 10e0 <strlen@plt> mov %rax,-0x70(%rbp) movl $0x0,-0x80(%rbp) jmp 133f <func0+0xf6> mov -0x80(%rbp),%eax cltq mov -0x40(%rbp,%rax,8),%rdx mov -0x78(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1150 <strstr@plt> mov %rax,-0x58(%rbp) cmpq $0x0,-0x58(%rbp) je 133b <func0+0xf2> mov -0x58(%rbp),%rax sub -0x78(%rbp),%rax cmp %rax,-0x70(%rbp) jbe 133b <func0+0xf2> mov -0x58(%rbp),%rax sub -0x78(%rbp),%rax mov %rax,-0x70(%rbp) mov -0x80(%rbp),%eax mov %eax,-0x84(%rbp) addl $0x1,-0x80(%rbp) mov -0x80(%rbp),%eax cmp -0x7c(%rbp),%eax jl 12f4 <func0+0xab> cmpl $0xffffffff,-0x84(%rbp) jne 139e <func0+0x155> mov -0x48(%rbp),%eax add $0x1,%eax cltq lea 0x0(,%rax,8),%rdx mov -0x50(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1130 <realloc@plt> mov %rax,-0x50(%rbp) mov -0x50(%rbp),%rcx mov -0x48(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x48(%rbp) cltq shl $0x3,%rax lea (%rcx,%rax,1),%rbx mov -0x78(%rbp),%rax mov %rax,%rdi callq 1140 <strdup@plt> mov %rax,(%rbx) jmpq 142c <func0+0x1e3> cmpq $0x0,-0x70(%rbp) je 13fd <func0+0x1b4> mov -0x48(%rbp),%eax add $0x1,%eax cltq lea 0x0(,%rax,8),%rdx mov -0x50(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1130 <realloc@plt> mov %rax,-0x50(%rbp) mov -0x70(%rbp),%rdx mov -0x78(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1110 <strndup@plt> mov %rax,-0x60(%rbp) mov -0x50(%rbp),%rcx mov -0x48(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x48(%rbp) cltq shl $0x3,%rax lea (%rcx,%rax,1),%rdx mov -0x60(%rbp),%rax mov %rax,(%rdx) mov -0x84(%rbp),%eax cltq mov -0x40(%rbp,%rax,8),%rax mov %rax,%rdi callq 10e0 <strlen@plt> mov -0x70(%rbp),%rdx add %rdx,%rax add %rax,-0x78(%rbp) mov -0x78(%rbp),%rax movzbl (%rax),%eax test %al,%al jne 12d1 <func0+0x88> mov -0x68(%rbp),%rax mov %rax,%rdi callq 10d0 <free@plt> mov -0x50(%rbp),%rax mov -0x48(%rbp),%rdx mov -0x18(%rbp),%rbx xor %fs:0x28,%rbx je 1454 <func0+0x20b> callq 10f0 <__stack_chk_fail@plt> add $0x98,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 98h mov [rbp+s], rdi mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax mov [rbp+ptr], 0 mov dword ptr [rbp+var_48], 0 lea rax, unk_2008 mov [rbp+needle], rax lea rax, unk_200B mov [rbp+var_38], rax lea rax, unk_200E mov [rbp+var_30], rax lea rax, unk_2010 mov [rbp+var_28], rax mov [rbp+var_7C], 4 mov rax, [rbp+s] mov rdi, rax; s call _strdup mov [rbp+var_68], rax mov rax, [rbp+var_68] mov [rbp+haystack], rax jmp loc_141D loc_12D1: mov [rbp+var_84], 0FFFFFFFFh mov rax, [rbp+haystack] mov rdi, rax; s call _strlen mov [rbp+n], rax mov [rbp+var_80], 0 jmp short loc_133F loc_12F4: mov eax, [rbp+var_80] cdqe mov rdx, [rbp+rax*8+needle] mov rax, [rbp+haystack] mov rsi, rdx; needle mov rdi, rax; haystack call _strstr mov [rbp+var_58], rax cmp [rbp+var_58], 0 jz short loc_133B mov rax, [rbp+var_58] sub rax, [rbp+haystack] cmp rax, [rbp+n] jnb short loc_133B mov rax, [rbp+var_58] sub rax, [rbp+haystack] mov [rbp+n], rax mov eax, [rbp+var_80] mov [rbp+var_84], eax loc_133B: add [rbp+var_80], 1 loc_133F: mov eax, [rbp+var_80] cmp eax, [rbp+var_7C] jl short loc_12F4 cmp [rbp+var_84], 0FFFFFFFFh jnz short loc_139E mov eax, dword ptr [rbp+var_48] 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 rcx, [rbp+ptr] mov eax, dword ptr [rbp+var_48] lea edx, [rax+1] mov dword ptr [rbp+var_48], edx cdqe shl rax, 3 lea rbx, [rcx+rax] mov rax, [rbp+haystack] mov rdi, rax; s call _strdup mov [rbx], rax jmp loc_142C loc_139E: cmp [rbp+n], 0 jz short loc_13FD mov eax, dword ptr [rbp+var_48] 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 rdx, [rbp+n] mov rax, [rbp+haystack] mov rsi, rdx; n mov rdi, rax; string call _strndup mov [rbp+var_60], rax mov rcx, [rbp+ptr] mov eax, dword ptr [rbp+var_48] lea edx, [rax+1] mov dword ptr [rbp+var_48], edx cdqe shl rax, 3 lea rdx, [rcx+rax] mov rax, [rbp+var_60] mov [rdx], rax loc_13FD: mov eax, [rbp+var_84] cdqe mov rax, [rbp+rax*8+needle] mov rdi, rax; s call _strlen mov rdx, [rbp+n] add rax, rdx add [rbp+haystack], rax loc_141D: mov rax, [rbp+haystack] movzx eax, byte ptr [rax] test al, al jnz loc_12D1 loc_142C: mov rax, [rbp+var_68] mov rdi, rax; ptr call _free mov rax, [rbp+ptr] mov rdx, [rbp+var_48] mov rcx, [rbp+var_18] sub rcx, fs:28h jz short loc_1454 call ___stack_chk_fail loc_1454: mov rbx, [rbp+var_8] leave retn
void * func0(const char *a1) { int v1; // eax int v3; // [rsp+1Ch] [rbp-84h] int i; // [rsp+20h] [rbp-80h] char *haystack; // [rsp+28h] [rbp-78h] size_t n; // [rsp+30h] [rbp-70h] char *v7; // [rsp+38h] [rbp-68h] char *v8; // [rsp+40h] [rbp-60h] char *v9; // [rsp+48h] [rbp-58h] void *ptr; // [rsp+50h] [rbp-50h] int v11; // [rsp+58h] [rbp-48h] char *needle[7]; // [rsp+60h] [rbp-40h] needle[5] = (char *)__readfsqword(0x28u); ptr = 0LL; v11 = 0; needle[0] = (char *)&unk_2008; needle[1] = (char *)&unk_200B; needle[2] = (char *)&unk_200E; needle[3] = (char *)&unk_2010; v7 = strdup(a1); for ( haystack = v7; *haystack; haystack += n + strlen(needle[v3]) ) { v3 = -1; n = strlen(haystack); for ( i = 0; i < 4; ++i ) { v9 = strstr(haystack, needle[i]); if ( v9 && v9 - haystack < n ) { n = v9 - haystack; v3 = i; } } if ( v3 == -1 ) { ptr = realloc(ptr, 8LL * (v11 + 1)); *((_QWORD *)ptr + v11) = strdup(haystack); break; } if ( n ) { ptr = realloc(ptr, 8LL * (v11 + 1)); v8 = strndup(haystack, n); v1 = v11++; *((_QWORD *)ptr + v1) = v8; } } free(v7); return ptr; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x98 MOV qword ptr [RBP + -0x98],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV qword ptr [RBP + -0x50],0x0 MOV dword ptr [RBP + -0x48],0x0 LEA RAX,[0x102008] MOV qword ptr [RBP + -0x40],RAX LEA RAX,[0x10200b] MOV qword ptr [RBP + -0x38],RAX LEA RAX,[0x10200e] MOV qword ptr [RBP + -0x30],RAX LEA RAX,[0x102010] MOV qword ptr [RBP + -0x28],RAX MOV dword ptr [RBP + -0x7c],0x4 MOV RAX,qword ptr [RBP + -0x98] MOV RDI,RAX CALL 0x00101140 MOV qword ptr [RBP + -0x68],RAX MOV RAX,qword ptr [RBP + -0x68] MOV qword ptr [RBP + -0x78],RAX JMP 0x0010141d LAB_001012d1: MOV dword ptr [RBP + -0x84],0xffffffff MOV RAX,qword ptr [RBP + -0x78] MOV RDI,RAX CALL 0x001010e0 MOV qword ptr [RBP + -0x70],RAX MOV dword ptr [RBP + -0x80],0x0 JMP 0x0010133f LAB_001012f4: MOV EAX,dword ptr [RBP + -0x80] CDQE MOV RDX,qword ptr [RBP + RAX*0x8 + -0x40] MOV RAX,qword ptr [RBP + -0x78] MOV RSI,RDX MOV RDI,RAX CALL 0x00101150 MOV qword ptr [RBP + -0x58],RAX CMP qword ptr [RBP + -0x58],0x0 JZ 0x0010133b MOV RAX,qword ptr [RBP + -0x58] SUB RAX,qword ptr [RBP + -0x78] CMP RAX,qword ptr [RBP + -0x70] JNC 0x0010133b MOV RAX,qword ptr [RBP + -0x58] SUB RAX,qword ptr [RBP + -0x78] MOV qword ptr [RBP + -0x70],RAX MOV EAX,dword ptr [RBP + -0x80] MOV dword ptr [RBP + -0x84],EAX LAB_0010133b: ADD dword ptr [RBP + -0x80],0x1 LAB_0010133f: MOV EAX,dword ptr [RBP + -0x80] CMP EAX,dword ptr [RBP + -0x7c] JL 0x001012f4 CMP dword ptr [RBP + -0x84],-0x1 JNZ 0x0010139e MOV EAX,dword ptr [RBP + -0x48] ADD EAX,0x1 CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x50] MOV RSI,RDX MOV RDI,RAX CALL 0x00101130 MOV qword ptr [RBP + -0x50],RAX MOV RCX,qword ptr [RBP + -0x50] MOV EAX,dword ptr [RBP + -0x48] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x48],EDX CDQE SHL RAX,0x3 LEA RBX,[RCX + RAX*0x1] MOV RAX,qword ptr [RBP + -0x78] MOV RDI,RAX CALL 0x00101140 MOV qword ptr [RBX],RAX JMP 0x0010142c LAB_0010139e: CMP qword ptr [RBP + -0x70],0x0 JZ 0x001013fd MOV EAX,dword ptr [RBP + -0x48] ADD EAX,0x1 CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x50] MOV RSI,RDX MOV RDI,RAX CALL 0x00101130 MOV qword ptr [RBP + -0x50],RAX MOV RDX,qword ptr [RBP + -0x70] MOV RAX,qword ptr [RBP + -0x78] MOV RSI,RDX MOV RDI,RAX CALL 0x00101110 MOV qword ptr [RBP + -0x60],RAX MOV RCX,qword ptr [RBP + -0x50] MOV EAX,dword ptr [RBP + -0x48] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x48],EDX CDQE SHL RAX,0x3 LEA RDX,[RCX + RAX*0x1] MOV RAX,qword ptr [RBP + -0x60] MOV qword ptr [RDX],RAX LAB_001013fd: MOV EAX,dword ptr [RBP + -0x84] CDQE MOV RAX,qword ptr [RBP + RAX*0x8 + -0x40] MOV RDI,RAX CALL 0x001010e0 MOV RDX,qword ptr [RBP + -0x70] ADD RAX,RDX ADD qword ptr [RBP + -0x78],RAX LAB_0010141d: MOV RAX,qword ptr [RBP + -0x78] MOVZX EAX,byte ptr [RAX] TEST AL,AL JNZ 0x001012d1 LAB_0010142c: MOV RAX,qword ptr [RBP + -0x68] MOV RDI,RAX CALL 0x001010d0 MOV RAX,qword ptr [RBP + -0x50] MOV RDX,qword ptr [RBP + -0x48] MOV RCX,qword ptr [RBP + -0x18] SUB RCX,qword ptr FS:[0x28] JZ 0x00101454 CALL 0x001010f0 LAB_00101454: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(char *param_1) { char *__ptr; char *pcVar1; size_t sVar2; long in_FS_OFFSET; int local_8c; int local_88; char *local_80; ulong local_78; void *local_58; int local_50; int *local_48 [5]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_58 = (void *)0x0; local_50 = 0; local_48[0] = &DAT_00102008; local_48[1] = &DAT_0010200b; local_48[2] = &DAT_0010200e; local_48[3] = &DAT_00102010; __ptr = strdup(param_1); local_80 = __ptr; do { if (*local_80 == '\0') { LAB_0010142c: free(__ptr); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_58; } local_8c = -1; local_78 = strlen(local_80); for (local_88 = 0; local_88 < 4; local_88 = local_88 + 1) { pcVar1 = strstr(local_80,local_48[local_88]); if ((pcVar1 != (char *)0x0) && ((ulong)((long)pcVar1 - (long)local_80) < local_78)) { local_78 = (long)pcVar1 - (long)local_80; local_8c = local_88; } } if (local_8c == -1) { local_58 = realloc(local_58,(long)(local_50 + 1) * 8); pcVar1 = strdup(local_80); *(char **)((long)local_58 + (long)local_50 * 8) = pcVar1; goto LAB_0010142c; } if (local_78 != 0) { local_58 = realloc(local_58,(long)(local_50 + 1) * 8); pcVar1 = strndup(local_80,local_78); *(char **)((long)local_58 + (long)local_50 * 8) = pcVar1; local_50 = local_50 + 1; } sVar2 = strlen(local_48[local_8c]); local_80 = local_80 + sVar2 + local_78; } while( true ); }
4,185
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { char** tokens; int count; } split_result;
split_result func0(const char* text) { split_result result; result.tokens = NULL; result.count = 0; const char* delimiters[] = {"; ", ", ", "*", "\n"}; int num_delimiters = 4; char* temp = strdup(text); char* ptr = temp; char* match; int min_index; while (*ptr) { min_index = -1; size_t min_pos = strlen(ptr); for (int i = 0; i < num_delimiters; i++) { char* found = strstr(ptr, delimiters[i]); if (found && (found - ptr) < min_pos) { min_pos = found - ptr; min_index = i; } } if (min_index == -1) { result.tokens = realloc(result.tokens, sizeof(char*) * (result.count + 1)); result.tokens[result.count++] = strdup(ptr); break; } if (min_pos > 0) { result.tokens = realloc(result.tokens, sizeof(char*) * (result.count + 1)); char* token = strndup(ptr, min_pos); result.tokens[result.count++] = token; } ptr += min_pos + strlen(delimiters[min_index]); } free(temp); return result; }
int main(){ split_result res1 = func0("Forces of the \ndarkness*are coming into the play."); assert(res1.count == 3); assert(strcmp(res1.tokens[0], "Forces of the ") == 0); assert(strcmp(res1.tokens[1], "darkness") == 0); assert(strcmp(res1.tokens[2], "are coming into the play.") == 0); for(int i=0;i<res1.count;i++) free(res1.tokens[i]); free(res1.tokens); split_result res2 = func0("Mi Box runs on the \n Latest android*which has google assistance and chromecast."); assert(res2.count == 3); assert(strcmp(res2.tokens[0], "Mi Box runs on the ") == 0); assert(strcmp(res2.tokens[1], " Latest android") == 0); assert(strcmp(res2.tokens[2], "which has google assistance and chromecast.") == 0); for(int i=0;i<res2.count;i++) free(res2.tokens[i]); free(res2.tokens); split_result res3 = func0("Certain services\nare subjected to change*over the seperate subscriptions."); assert(res3.count == 3); assert(strcmp(res3.tokens[0], "Certain services") == 0); assert(strcmp(res3.tokens[1], "are subjected to change") == 0); assert(strcmp(res3.tokens[2], "over the seperate subscriptions.") == 0); for(int i=0;i<res3.count;i++) free(res3.tokens[i]); free(res3.tokens); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x58,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax lea 0xdd2(%rip),%rax mov %rax,0x20(%rsp) lea 0xdc9(%rip),%rax mov %rax,0x28(%rsp) lea 0xdc0(%rip),%rax mov %rax,0x30(%rsp) lea 0xdb6(%rip),%rax mov %rax,0x38(%rsp) callq 1100 <strdup@plt> mov %rax,0x18(%rsp) cmpb $0x0,(%rax) je 13af <func0+0x1a6> mov %rax,%r12 movq $0x0,0x10(%rsp) movl $0x0,0xc(%rsp) mov $0xffffffffffffffff,%r15 jmp 12ed <func0+0xe4> add $0x1,%rbx cmp $0x4,%rbx je 12b7 <func0+0xae> mov 0x20(%rsp,%rbx,8),%rsi mov %r12,%rdi callq 1110 <strstr@plt> test %rax,%rax je 128b <func0+0x82> sub %r12,%rax cmp %rbp,%rax jae 128b <func0+0x82> mov %rax,%rbp mov %ebx,%r13d jmp 128b <func0+0x82> cmp $0xffffffff,%r13d je 1311 <func0+0x108> test %rbp,%rbp jne 1375 <func0+0x16c> movslq %r13d,%r13 mov 0x20(%rsp,%r13,8),%rdi mov $0x0,%eax mov %r15,%rcx repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rbp,%rax,1),%rax add %rax,%r12 cmpb $0x0,(%r12) je 1343 <func0+0x13a> mov $0x0,%eax mov %r15,%rcx mov %r12,%rdi repnz scas %es:(%rdi),%al mov %rcx,%rax not %rax lea -0x1(%rax),%rbp mov $0x0,%ebx mov $0xffffffff,%r13d jmp 1295 <func0+0x8c> addl $0x1,0xc(%rsp) mov 0xc(%rsp),%eax movslq %eax,%rbx shl $0x3,%rbx mov %rbx,%rsi mov 0x10(%rsp),%rdi callq 10f0 <realloc@plt> mov %rax,%r15 mov %rax,0x10(%rsp) mov %r12,%rdi callq 1100 <strdup@plt> mov %rax,-0x8(%r15,%rbx,1) mov 0x18(%rsp),%rdi callq 10b0 <free@plt> mov 0xc(%rsp),%edx mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 13c2 <func0+0x1b9> mov 0x10(%rsp),%rax add $0x58,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq addl $0x1,0xc(%rsp) mov 0xc(%rsp),%eax movslq %eax,%rbx shl $0x3,%rbx mov %rbx,%rsi mov 0x10(%rsp),%rdi callq 10f0 <realloc@plt> mov %rax,%r14 mov %rax,0x10(%rsp) mov %rbp,%rsi mov %r12,%rdi callq 10e0 <strndup@plt> mov %rax,-0x8(%r14,%rbx,1) jmpq 12c6 <func0+0xbd> movl $0x0,0xc(%rsp) movq $0x0,0x10(%rsp) jmp 1343 <func0+0x13a> callq 10c0 <__stack_chk_fail@plt>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 48h mov rax, fs:28h mov [rsp+78h+var_40], rax xor eax, eax lea rax, unk_2004 mov [rsp+78h+var_68], rax lea rax, unk_2007 mov [rsp+78h+var_60], rax lea rax, unk_200A mov [rsp+78h+var_58], rax lea rax, unk_200C mov [rsp+78h+var_50], rax call _strdup mov [rsp+78h+var_70], rax cmp byte ptr [rax], 0 jz loc_13BB mov rbp, rax mov [rsp+78h+var_78], 0 mov r15d, 0 jmp short loc_1315 loc_12C1: add rbx, 1 cmp rbx, 4 jz short loc_12ED loc_12CB: mov rsi, [rsp+rbx*8+78h+var_68] mov rdi, rbp call _strstr test rax, rax jz short loc_12C1 sub rax, rbp cmp rax, r12 jnb short loc_12C1 mov r12, rax mov r13d, ebx jmp short loc_12C1 loc_12ED: cmp r13d, 0FFFFFFFFh jz short loc_132D test r12, r12 jnz loc_1388 loc_12FC: movsxd r13, r13d mov rdi, [rsp+r13*8+78h+var_68] call _strlen add rax, r12 add rbp, rax cmp byte ptr [rbp+0], 0 jz short loc_1358 loc_1315: mov rdi, rbp call _strlen mov r12, rax mov ebx, 0 mov r13d, 0FFFFFFFFh jmp short loc_12CB loc_132D: add r15d, 1 movsxd rbx, r15d shl rbx, 3 mov rsi, rbx mov rdi, [rsp+78h+var_78] call _realloc mov r14, rax mov [rsp+78h+var_78], rax mov rdi, rbp call _strdup mov [r14+rbx-8], rax loc_1358: mov rdi, [rsp+78h+var_70] call _free mov edx, r15d mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz short loc_13CB mov rax, [rsp+78h+var_78] add rsp, 48h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1388: add r15d, 1 movsxd rbx, r15d shl rbx, 3 mov rsi, rbx mov rdi, [rsp+78h+var_78] call _realloc mov r14, rax mov [rsp+78h+var_78], rax mov rsi, r12 mov rdi, rbp call _strndup mov [r14+rbx-8], rax jmp loc_12FC loc_13BB: mov r15d, 0 mov [rsp+78h+var_78], 0 jmp short loc_1358 loc_13CB: call ___stack_chk_fail
long long func0() { _BYTE *v0; // rax _BYTE *v1; // rbp int v2; // r15d long long v3; // rbx long long v4; // rax unsigned long long v5; // rax unsigned long long v6; // r12 int v7; // r13d long long v9; // [rsp+0h] [rbp-78h] _BYTE *v10; // [rsp+8h] [rbp-70h] _QWORD v11[13]; // [rsp+10h] [rbp-68h] v11[5] = __readfsqword(0x28u); v11[0] = &unk_2004; v11[1] = &unk_2007; v11[2] = &unk_200A; v11[3] = &unk_200C; v0 = (_BYTE *)((long long (*)(void))strdup)(); v10 = v0; if ( *v0 ) { v1 = v0; v9 = 0LL; v2 = 0; while ( 1 ) { v6 = strlen(v1); v3 = 0LL; v7 = -1; do { v4 = strstr(v1, v11[v3]); if ( v4 ) { v5 = v4 - (_QWORD)v1; if ( v5 < v6 ) { v6 = v5; v7 = v3; } } ++v3; } while ( v3 != 4 ); if ( v7 == -1 ) break; if ( v6 ) { v9 = realloc(v9, 8LL * ++v2); *(_QWORD *)(v9 + 8LL * v2 - 8) = strndup(v1, v6); } v1 += v6 + strlen(v11[v7]); if ( !*v1 ) goto LABEL_13; } v9 = realloc(v9, 8LL * (v2 + 1)); *(_QWORD *)(v9 + 8LL * (v2 + 1) - 8) = strdup(v1); } else { v9 = 0LL; } LABEL_13: free(v10); return v9; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x48 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x38],RAX XOR EAX,EAX LEA RAX,[0x102004] MOV qword ptr [RSP + 0x10],RAX LEA RAX,[0x102007] MOV qword ptr [RSP + 0x18],RAX LEA RAX,[0x10200a] MOV qword ptr [RSP + 0x20],RAX LEA RAX,[0x10200c] MOV qword ptr [RSP + 0x28],RAX CALL 0x00101140 MOV qword ptr [RSP + 0x8],RAX CMP byte ptr [RAX],0x0 JZ 0x001013bb MOV RBP,RAX MOV qword ptr [RSP],0x0 MOV R15D,0x0 JMP 0x00101315 LAB_001012c1: ADD RBX,0x1 CMP RBX,0x4 JZ 0x001012ed LAB_001012cb: MOV RSI,qword ptr [RSP + RBX*0x8 + 0x10] MOV RDI,RBP CALL 0x00101150 TEST RAX,RAX JZ 0x001012c1 SUB RAX,RBP CMP RAX,R12 JNC 0x001012c1 MOV R12,RAX MOV R13D,EBX JMP 0x001012c1 LAB_001012ed: CMP R13D,-0x1 JZ 0x0010132d TEST R12,R12 JNZ 0x00101388 LAB_001012fc: MOVSXD R13,R13D MOV RDI,qword ptr [RSP + R13*0x8 + 0x10] CALL 0x001010e0 ADD RAX,R12 ADD RBP,RAX CMP byte ptr [RBP],0x0 JZ 0x00101358 LAB_00101315: MOV RDI,RBP CALL 0x001010e0 MOV R12,RAX MOV EBX,0x0 MOV R13D,0xffffffff JMP 0x001012cb LAB_0010132d: ADD R15D,0x1 MOVSXD RBX,R15D SHL RBX,0x3 MOV RSI,RBX MOV RDI,qword ptr [RSP] CALL 0x00101130 MOV R14,RAX MOV qword ptr [RSP],RAX MOV RDI,RBP CALL 0x00101140 MOV qword ptr [R14 + RBX*0x1 + -0x8],RAX LAB_00101358: MOV RDI,qword ptr [RSP + 0x8] CALL 0x001010d0 MOV EDX,R15D MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x001013cb MOV RAX,qword ptr [RSP] ADD RSP,0x48 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101388: ADD R15D,0x1 MOVSXD RBX,R15D SHL RBX,0x3 MOV RSI,RBX MOV RDI,qword ptr [RSP] CALL 0x00101130 MOV R14,RAX MOV qword ptr [RSP],RAX MOV RSI,R12 MOV RDI,RBP CALL 0x00101110 MOV qword ptr [R14 + RBX*0x1 + -0x8],RAX JMP 0x001012fc LAB_001013bb: MOV R15D,0x0 MOV qword ptr [RSP],0x0 JMP 0x00101358 LAB_001013cb: CALL 0x001010f0
void * func0(char *param_1) { char *__ptr; char *pcVar1; size_t sVar2; ulong __n; ulong uVar3; char *pcVar4; ulong uVar5; int iVar6; long in_FS_OFFSET; void *local_78; int *local_68 [5]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); local_68[0] = &DAT_00102004; local_68[1] = &DAT_00102007; local_68[2] = &DAT_0010200a; local_68[3] = &DAT_0010200c; __ptr = strdup(param_1); if (*__ptr == '\0') { local_78 = (void *)0x0; } else { local_78 = (void *)0x0; iVar6 = 0; pcVar4 = __ptr; do { __n = strlen(pcVar4); uVar3 = 0; uVar5 = 0xffffffff; do { pcVar1 = strstr(pcVar4,local_68[uVar3]); if ((pcVar1 != (char *)0x0) && ((ulong)((long)pcVar1 - (long)pcVar4) < __n)) { uVar5 = uVar3 & 0xffffffff; __n = (long)pcVar1 - (long)pcVar4; } uVar3 = uVar3 + 1; } while (uVar3 != 4); if ((int)uVar5 == -1) { sVar2 = (long)(iVar6 + 1) * 8; local_78 = realloc(local_78,sVar2); pcVar4 = strdup(pcVar4); *(char **)((long)local_78 + (sVar2 - 8)) = pcVar4; break; } if (__n != 0) { iVar6 = iVar6 + 1; local_78 = realloc(local_78,(long)iVar6 * 8); pcVar1 = strndup(pcVar4,__n); *(char **)((long)local_78 + ((long)iVar6 * 8 - 8U)) = pcVar1; } sVar2 = strlen(local_68[(int)uVar5]); pcVar4 = pcVar4 + sVar2 + __n; } while (*pcVar4 != '\0'); } free(__ptr); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return local_78; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
4,186
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { char** tokens; int count; } split_result;
split_result func0(const char* text) { split_result result; result.tokens = NULL; result.count = 0; const char* delimiters[] = {"; ", ", ", "*", "\n"}; int num_delimiters = 4; char* temp = strdup(text); char* ptr = temp; char* match; int min_index; while (*ptr) { min_index = -1; size_t min_pos = strlen(ptr); for (int i = 0; i < num_delimiters; i++) { char* found = strstr(ptr, delimiters[i]); if (found && (found - ptr) < min_pos) { min_pos = found - ptr; min_index = i; } } if (min_index == -1) { result.tokens = realloc(result.tokens, sizeof(char*) * (result.count + 1)); result.tokens[result.count++] = strdup(ptr); break; } if (min_pos > 0) { result.tokens = realloc(result.tokens, sizeof(char*) * (result.count + 1)); char* token = strndup(ptr, min_pos); result.tokens[result.count++] = token; } ptr += min_pos + strlen(delimiters[min_index]); } free(temp); return result; }
int main(){ split_result res1 = func0("Forces of the \ndarkness*are coming into the play."); assert(res1.count == 3); assert(strcmp(res1.tokens[0], "Forces of the ") == 0); assert(strcmp(res1.tokens[1], "darkness") == 0); assert(strcmp(res1.tokens[2], "are coming into the play.") == 0); for(int i=0;i<res1.count;i++) free(res1.tokens[i]); free(res1.tokens); split_result res2 = func0("Mi Box runs on the \n Latest android*which has google assistance and chromecast."); assert(res2.count == 3); assert(strcmp(res2.tokens[0], "Mi Box runs on the ") == 0); assert(strcmp(res2.tokens[1], " Latest android") == 0); assert(strcmp(res2.tokens[2], "which has google assistance and chromecast.") == 0); for(int i=0;i<res2.count;i++) free(res2.tokens[i]); free(res2.tokens); split_result res3 = func0("Certain services\nare subjected to change*over the seperate subscriptions."); assert(res3.count == 3); assert(strcmp(res3.tokens[0], "Certain services") == 0); assert(strcmp(res3.tokens[1], "are subjected to change") == 0); assert(strcmp(res3.tokens[2], "over the seperate subscriptions.") == 0); for(int i=0;i<res3.count;i++) free(res3.tokens[i]); free(res3.tokens); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 lea 0xa85(%rip),%r14 push %r13 push %r12 push %rbp push %rbx sub $0x58,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax lea 0xa67(%rip),%rax mov %r14,0x20(%rsp) mov %rax,0x28(%rsp) lea 0xa59(%rip),%rax mov %rax,0x30(%rsp) lea 0xa4f(%rip),%rax mov %rax,0x38(%rsp) callq 1120 <strdup@plt> cmpb $0x0,(%rax) mov %rax,0x18(%rsp) je 170b <func0+0x19b> mov %r14,0x8(%rsp) mov %rax,%r15 xor %r12d,%r12d xor %r13d,%r13d nopl 0x0(%rax,%rax,1) mov %r15,%rdi xor %r14d,%r14d mov $0xffffffffffffffff,%rbp callq 10d0 <strlen@plt> mov 0x8(%rsp),%rsi mov %r15,%rdi mov %rax,%rbx callq 1130 <strstr@plt> test %rax,%rax je 161d <func0+0xad> sub %r15,%rax cmp %rbx,%rax jae 161d <func0+0xad> mov %rax,%rbx movslq %r14d,%rbp add $0x1,%r14 cmp $0x4,%r14 je 1643 <func0+0xd3> mov 0x20(%rsp,%r14,8),%rsi mov %r15,%rdi callq 1130 <strstr@plt> test %rax,%rax jne 160f <func0+0x9f> add $0x1,%r14 cmp $0x4,%r14 jne 1627 <func0+0xb7> cmp $0xffffffff,%ebp je 16e0 <func0+0x170> test %rbx,%rbx jne 16a0 <func0+0x130> mov 0x20(%rsp,%rbp,8),%rdi callq 10d0 <strlen@plt> add %rax,%rbx add %rbx,%r15 cmpb $0x0,(%r15) jne 15e8 <func0+0x78> mov 0x18(%rsp),%rdi callq 10c0 <free@plt> mov %r13d,%edx mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 1716 <func0+0x1a6> add $0x58,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw 0x0(%rax,%rax,1) add $0x1,%r13d mov %r12,%rdi movslq %r13d,%rdx shl $0x3,%rdx mov %rdx,%rsi mov %rdx,0x10(%rsp) callq 1110 <realloc@plt> mov %rbx,%rsi mov %r15,%rdi mov %rax,%r12 callq 1100 <strndup@plt> mov 0x10(%rsp),%rdx mov %rax,-0x8(%r12,%rdx,1) jmpq 1651 <func0+0xe1> nopl 0x0(%rax,%rax,1) add $0x1,%r13d mov %r12,%rdi movslq %r13d,%rbx shl $0x3,%rbx mov %rbx,%rsi callq 1110 <realloc@plt> mov %r15,%rdi mov %rax,%r12 callq 1120 <strdup@plt> mov %rax,-0x8(%r12,%rbx,1) jmpq 1667 <func0+0xf7> xor %r13d,%r13d xor %r12d,%r12d jmpq 1667 <func0+0xf7> callq 10e0 <__stack_chk_fail@plt> nopl 0x0(%rax,%rax,1)
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 48h mov rax, fs:28h mov [rsp+78h+var_40], rax lea rax, unk_2004 mov [rsp+78h+var_68], rax lea rax, unk_2007 mov [rsp+78h+var_60], rax lea rax, unk_200A mov [rsp+78h+var_58], rax lea rax, unk_200C mov [rsp+78h+var_50], rax call _strdup cmp byte ptr [rax], 0 mov [rsp+78h+var_70], rax jz loc_16FB mov r15, rax xor r12d, r12d xor r13d, r13d nop dword ptr [rax+00h] loc_15D0: mov rdi, r15 xor r14d, r14d mov rbp, 0FFFFFFFFFFFFFFFFh call _strlen lea rsi, unk_2004 mov rdi, r15 mov rbx, rax call _strstr test rax, rax jz short loc_1607 loc_15F9: sub rax, r15 cmp rax, rbx jnb short loc_1607 mov rbx, rax movsxd rbp, r14d loc_1607: add r14, 1 cmp r14, 4 jz short loc_162D loc_1611: mov rsi, [rsp+r14*8+78h+var_68] mov rdi, r15 call _strstr test rax, rax jnz short loc_15F9 add r14, 1 cmp r14, 4 jnz short loc_1611 loc_162D: cmp ebp, 0FFFFFFFFh jz loc_16D0 test rbx, rbx jnz short loc_1690 loc_163B: mov rdi, [rsp+rbp*8+78h+var_68] call _strlen add rax, rbx add r15, rax cmp byte ptr [r15], 0 jnz loc_15D0 loc_1655: mov rdi, [rsp+78h+var_70] call _free mov edx, r13d mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz loc_1706 add rsp, 48h mov rax, r12 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1690: add r13d, 1 mov rdi, r12 movsxd rdx, r13d shl rdx, 3 mov rsi, rdx mov [rsp+78h+var_78], rdx call _realloc mov rsi, rbx mov rdi, r15 mov r12, rax call _strndup mov rdx, [rsp+78h+var_78] mov [r12+rdx-8], rax jmp loc_163B loc_16D0: add r13d, 1 mov rdi, r12 movsxd rbx, r13d shl rbx, 3 mov rsi, rbx call _realloc mov rdi, r15 mov r12, rax call _strdup mov [r12+rbx-8], rax jmp loc_1655 loc_16FB: xor r13d, r13d xor r12d, r12d jmp loc_1655 loc_1706: call ___stack_chk_fail
long long func0() { _BYTE *v0; // rax _BYTE *v1; // r15 long long v2; // r12 int v3; // r13d long long v4; // r14 long long v5; // rbp unsigned long long v6; // rbx long long v7; // rax unsigned long long v8; // rax _BYTE *v10; // [rsp+8h] [rbp-70h] _QWORD v11[13]; // [rsp+10h] [rbp-68h] v11[5] = __readfsqword(0x28u); v11[0] = &unk_2004; v11[1] = &unk_2007; v11[2] = &unk_200A; v11[3] = &unk_200C; v0 = (_BYTE *)((long long (*)(void))strdup)(); v10 = v0; if ( !*v0 ) { v2 = 0LL; goto LABEL_13; } v1 = v0; v2 = 0LL; v3 = 0; while ( 1 ) { v4 = 0LL; v5 = -1LL; v6 = strlen(v1); v7 = strstr(v1, &unk_2004); if ( !v7 ) goto LABEL_6; while ( 1 ) { v8 = v7 - (_QWORD)v1; if ( v8 < v6 ) { v6 = v8; v5 = (int)v4; } LABEL_6: if ( ++v4 == 4 ) break; while ( 1 ) { v7 = strstr(v1, v11[v4]); if ( v7 ) break; if ( ++v4 == 4 ) goto LABEL_9; } } LABEL_9: if ( (_DWORD)v5 == -1 ) break; if ( v6 ) { v2 = realloc(v2, 8LL * ++v3); *(_QWORD *)(v2 + 8LL * v3 - 8) = strndup(v1, v6); } v1 += v6 + strlen(v11[v5]); if ( !*v1 ) goto LABEL_13; } v2 = realloc(v2, 8LL * (v3 + 1)); *(_QWORD *)(v2 + 8LL * (v3 + 1) - 8) = strdup(v1); LABEL_13: free(v10); return v2; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x48 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x38],RAX LEA RAX,[0x102004] MOV qword ptr [RSP + 0x10],RAX LEA RAX,[0x102007] MOV qword ptr [RSP + 0x18],RAX LEA RAX,[0x10200a] MOV qword ptr [RSP + 0x20],RAX LEA RAX,[0x10200c] MOV qword ptr [RSP + 0x28],RAX CALL 0x00101140 CMP byte ptr [RAX],0x0 MOV qword ptr [RSP + 0x8],RAX JZ 0x001016fb MOV R15,RAX XOR R12D,R12D XOR R13D,R13D NOP dword ptr [RAX] LAB_001015d0: MOV RDI,R15 XOR R14D,R14D MOV RBP,-0x1 CALL 0x001010e0 LEA RSI,[0x102004] MOV RDI,R15 MOV RBX,RAX CALL 0x00101150 TEST RAX,RAX JZ 0x00101607 LAB_001015f9: SUB RAX,R15 CMP RAX,RBX JNC 0x00101607 MOV RBX,RAX MOVSXD RBP,R14D LAB_00101607: ADD R14,0x1 CMP R14,0x4 JZ 0x0010162d LAB_00101611: MOV RSI,qword ptr [RSP + R14*0x8 + 0x10] MOV RDI,R15 CALL 0x00101150 TEST RAX,RAX JNZ 0x001015f9 ADD R14,0x1 CMP R14,0x4 JNZ 0x00101611 LAB_0010162d: CMP EBP,-0x1 JZ 0x001016d0 TEST RBX,RBX JNZ 0x00101690 LAB_0010163b: MOV RDI,qword ptr [RSP + RBP*0x8 + 0x10] CALL 0x001010e0 ADD RAX,RBX ADD R15,RAX CMP byte ptr [R15],0x0 JNZ 0x001015d0 LAB_00101655: MOV RDI,qword ptr [RSP + 0x8] CALL 0x001010d0 MOV EDX,R13D MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101706 ADD RSP,0x48 MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101690: ADD R13D,0x1 MOV RDI,R12 MOVSXD RDX,R13D SHL RDX,0x3 MOV RSI,RDX MOV qword ptr [RSP],RDX CALL 0x00101130 MOV RSI,RBX MOV RDI,R15 MOV R12,RAX CALL 0x00101110 MOV RDX,qword ptr [RSP] MOV qword ptr [R12 + RDX*0x1 + -0x8],RAX JMP 0x0010163b LAB_001016d0: ADD R13D,0x1 MOV RDI,R12 MOVSXD RBX,R13D SHL RBX,0x3 MOV RSI,RBX CALL 0x00101130 MOV RDI,R15 MOV R12,RAX CALL 0x00101140 MOV qword ptr [R12 + RBX*0x1 + -0x8],RAX JMP 0x00101655 LAB_001016fb: XOR R13D,R13D XOR R12D,R12D JMP 0x00101655 LAB_00101706: CALL 0x001010f0
void * func0(char *param_1) { long lVar1; char *__ptr; ulong __n; char *pcVar2; size_t sVar3; void *__ptr_00; long lVar4; int iVar5; char *pcVar6; long in_FS_OFFSET; int *local_70 [6]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); local_70[1] = &DAT_00102004; local_70[2] = &DAT_00102007; local_70[3] = &DAT_0010200a; local_70[4] = &DAT_0010200c; __ptr = strdup(param_1); if (*__ptr == '\0') { __ptr_00 = (void *)0x0; } else { __ptr_00 = (void *)0x0; iVar5 = 0; pcVar6 = __ptr; do { lVar4 = -1; __n = strlen(pcVar6); pcVar2 = strstr(pcVar6,"; "); lVar1 = 0; while( true ) { if ((pcVar2 != (char *)0x0) && ((ulong)((long)pcVar2 - (long)pcVar6) < __n)) { lVar4 = (long)(int)lVar1; __n = (long)pcVar2 - (long)pcVar6; } if (lVar1 + 1 == 4) break; pcVar2 = strstr(pcVar6,local_70[lVar1 + 2]); lVar1 = lVar1 + 1; } if ((int)lVar4 == -1) { sVar3 = (long)(iVar5 + 1) * 8; __ptr_00 = realloc(__ptr_00,sVar3); pcVar6 = strdup(pcVar6); *(char **)((long)__ptr_00 + (sVar3 - 8)) = pcVar6; break; } if (__n != 0) { iVar5 = iVar5 + 1; __ptr_00 = realloc(__ptr_00,(long)iVar5 * 8); pcVar2 = strndup(pcVar6,__n); *(char **)((long)__ptr_00 + ((long)iVar5 * 8 - 8U)) = pcVar2; } sVar3 = strlen(local_70[lVar4 + 1]); pcVar6 = pcVar6 + sVar3 + __n; } while (*pcVar6 != '\0'); } free(__ptr); if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return __ptr_00; }
4,187
func0
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { char** tokens; int count; } split_result;
split_result func0(const char* text) { split_result result; result.tokens = NULL; result.count = 0; const char* delimiters[] = {"; ", ", ", "*", "\n"}; int num_delimiters = 4; char* temp = strdup(text); char* ptr = temp; char* match; int min_index; while (*ptr) { min_index = -1; size_t min_pos = strlen(ptr); for (int i = 0; i < num_delimiters; i++) { char* found = strstr(ptr, delimiters[i]); if (found && (found - ptr) < min_pos) { min_pos = found - ptr; min_index = i; } } if (min_index == -1) { result.tokens = realloc(result.tokens, sizeof(char*) * (result.count + 1)); result.tokens[result.count++] = strdup(ptr); break; } if (min_pos > 0) { result.tokens = realloc(result.tokens, sizeof(char*) * (result.count + 1)); char* token = strndup(ptr, min_pos); result.tokens[result.count++] = token; } ptr += min_pos + strlen(delimiters[min_index]); } free(temp); return result; }
int main(){ split_result res1 = func0("Forces of the \ndarkness*are coming into the play."); assert(res1.count == 3); assert(strcmp(res1.tokens[0], "Forces of the ") == 0); assert(strcmp(res1.tokens[1], "darkness") == 0); assert(strcmp(res1.tokens[2], "are coming into the play.") == 0); for(int i=0;i<res1.count;i++) free(res1.tokens[i]); free(res1.tokens); split_result res2 = func0("Mi Box runs on the \n Latest android*which has google assistance and chromecast."); assert(res2.count == 3); assert(strcmp(res2.tokens[0], "Mi Box runs on the ") == 0); assert(strcmp(res2.tokens[1], " Latest android") == 0); assert(strcmp(res2.tokens[2], "which has google assistance and chromecast.") == 0); for(int i=0;i<res2.count;i++) free(res2.tokens[i]); free(res2.tokens); split_result res3 = func0("Certain services\nare subjected to change*over the seperate subscriptions."); assert(res3.count == 3); assert(strcmp(res3.tokens[0], "Certain services") == 0); assert(strcmp(res3.tokens[1], "are subjected to change") == 0); assert(strcmp(res3.tokens[2], "over the seperate subscriptions.") == 0); for(int i=0;i<res3.count;i++) free(res3.tokens[i]); free(res3.tokens); return 0; }
O3
c
func0: endbr64 push %r15 lea 0xa6b(%rip),%rcx push %r14 movq %rcx,%xmm0 push %r13 push %r12 push %rbp push %rbx sub $0x48,%rsp mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax lea 0xa46(%rip),%rax movq %rax,%xmm1 punpcklqdq %xmm1,%xmm0 movaps %xmm0,0x10(%rsp) callq 1140 <strdup@plt> cmpb $0x0,(%rax) mov %rax,0x8(%rsp) je 1793 <func0+0x203> mov %rax,%r15 xor %r12d,%r12d xor %r14d,%r14d mov %r15,%rdi mov $0xffffffff,%ebp callq 10e0 <strlen@plt> lea 0xa04(%rip),%rsi mov %r15,%rdi mov %rax,%rbx mov %rax,%r13 callq 1150 <strstr@plt> test %rax,%rax je 1628 <func0+0x98> sub %r15,%rax cmp %rax,%rbx cmova %rax,%rbx cmp %r13,%rax sbb %ebp,%ebp not %ebp lea 0x9dc(%rip),%rsi mov %r15,%rdi callq 1150 <strstr@plt> test %rax,%rax je 164c <func0+0xbc> sub %r15,%rax cmp %rax,%rbx jbe 164c <func0+0xbc> mov %rax,%rbx mov $0x1,%ebp mov $0x2a,%esi mov %r15,%rdi callq 1100 <strchr@plt> mov $0xa,%esi mov %r15,%rdi mov %rax,%r13 callq 1100 <strchr@plt> test %r13,%r13 je 16e8 <func0+0x158> sub %r15,%r13 cmp %r13,%rbx jbe 16e8 <func0+0x158> lea 0x987(%rip),%rbp test %rax,%rax je 1698 <func0+0x108> sub %r15,%rax cmp %rax,%r13 jbe 1698 <func0+0x108> mov %rax,%r13 lea 0x972(%rip),%rbp nopl 0x0(%rax) test %r13,%r13 jne 1704 <func0+0x174> mov %rbp,%rdi callq 10e0 <strlen@plt> add %rax,%r15 cmpb $0x0,(%r15) jne 15f0 <func0+0x60> mov 0x8(%rsp),%rdi callq 10d0 <free@plt> mov %r14d,%edx mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 179e <func0+0x20e> add $0x48,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl (%rax) test %rax,%rax je 1750 <func0+0x1c0> sub %r15,%rax mov %rax,%r13 cmp %rax,%rbx jbe 1750 <func0+0x1c0> lea 0x907(%rip),%rbp test %r13,%r13 je 169d <func0+0x10d> add $0x1,%r14d mov %r12,%rdi movslq %r14d,%rbx shl $0x3,%rbx mov %rbx,%rsi callq 1130 <realloc@plt> mov %r13,%rsi mov %r15,%rdi mov %rax,%r12 callq 1120 <strndup@plt> mov %rbp,%rdi mov %rax,-0x8(%r12,%rbx,1) callq 10e0 <strlen@plt> add %rax,%r13 add %r13,%r15 cmpb $0x0,(%r15) jne 15f0 <func0+0x60> jmpq 16b2 <func0+0x122> nopw 0x0(%rax,%rax,1) cmp $0xffffffff,%ebp je 1768 <func0+0x1d8> movslq %ebp,%rbp mov %rbx,%r13 mov 0x10(%rsp,%rbp,8),%rbp jmpq 1698 <func0+0x108> nopl (%rax) add $0x1,%r14d mov %r12,%rdi movslq %r14d,%rbx shl $0x3,%rbx mov %rbx,%rsi callq 1130 <realloc@plt> mov %r15,%rdi mov %rax,%r12 callq 1140 <strdup@plt> mov %rax,-0x8(%r12,%rbx,1) jmpq 16b2 <func0+0x122> xor %r14d,%r14d xor %r12d,%r12d jmpq 16b2 <func0+0x122> callq 10f0 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 push r15 lea rdx, asc_200A; "*" push r14 push r13 push r12 push rbp push rbx sub rsp, 48h movq xmm0, cs:off_3D70; "; " mov rax, fs:28h mov [rsp+78h+var_40], rax xor eax, eax lea rax, asc_200C; "\n" movhps xmm0, cs:off_3D78; ", " movq xmm1, rax movaps xmmword ptr [rsp+78h+s], xmm0 movq xmm0, rdx punpcklqdq xmm0, xmm1 movaps [rsp+78h+var_58], xmm0 call _strdup cmp byte ptr [rax], 0 mov [rsp+78h+ptr], rax jz loc_17A5 mov rbx, rax xor ebp, ebp xor r12d, r12d nop word ptr [rax+rax+00h] loc_15F8: mov rdi, rbx; s mov r15d, 0FFFFFFFFh call _strlen lea rsi, needle; "; " mov rdi, rbx; haystack mov r14, rax call _strstr test rax, rax jz short loc_1630 sub rax, rbx cmp rax, r14 sbb r15d, r15d cmp rax, r14 cmovbe r14, rax not r15d loc_1630: lea rsi, asc_2007; ", " mov rdi, rbx; haystack call _strstr test rax, rax jz short loc_1655 sub rax, rbx cmp rax, r14 jnb short loc_1655 mov r14, rax mov r15d, 1 loc_1655: mov esi, 2Ah ; '*'; c mov rdi, rbx; s call _strchr mov esi, 0Ah; c mov rdi, rbx; s mov r13, rax call _strchr test r13, r13 jz loc_1700 mov r8, r13 sub r8, rbx cmp r8, r14 jnb short loc_1700 test rax, rax jz short loc_169C sub rax, rbx mov r15d, 3 mov r14, rax cmp rax, r8 jb short loc_16A5 loc_169C: mov r14, r8 mov r15d, 2 loc_16A5: test r14, r14 jnz short loc_171B loc_16AA: movsxd rcx, r15d mov rdi, [rsp+rcx*8+78h+s]; s call _strlen add rbx, rax cmp byte ptr [rbx], 0 jnz loc_15F8 loc_16C3: mov rdi, [rsp+78h+ptr]; ptr call _free mov edx, r12d mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz loc_17AF add rsp, 48h mov rax, rbp pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1700: test rax, rax jz short loc_1770 sub rax, rbx cmp rax, r14 jnb short loc_1770 mov r14, rax mov r15d, 3 test r14, r14 jz short loc_16AA loc_171B: add r12d, 1 mov rdi, rbp; ptr movsxd r8, r12d shl r8, 3 mov rsi, r8; size mov [rsp+78h+var_78], r8 call _realloc mov rdi, rbx; string mov rsi, r14; n mov rbp, rax call _strndup mov r8, [rsp+78h+var_78] movsxd rcx, r15d mov rdi, [rsp+rcx*8+78h+s]; s mov [rbp+r8-8], rax call _strlen add rax, r14 add rbx, rax cmp byte ptr [rbx], 0 jnz loc_15F8 jmp loc_16C3 loc_1770: cmp r15d, 0FFFFFFFFh jnz loc_16A5 add r12d, 1 mov rdi, rbp; ptr movsxd r13, r12d shl r13, 3 mov rsi, r13; size call _realloc mov rdi, rbx; s mov rbp, rax call _strdup mov [rbp+r13-8], rax jmp loc_16C3 loc_17A5: xor r12d, r12d xor ebp, ebp jmp loc_16C3 loc_17AF: call ___stack_chk_fail
char * func0(const char *a1) { char *v1; // rax const char *v2; // rbx char *v3; // rbp int v4; // r12d int v5; // r15d size_t v6; // r14 char *v7; // rax unsigned long long v8; // rax int v9; // r15d char *v10; // rax unsigned long long v11; // rax char *v12; // r13 char *v13; // rax unsigned long long v15; // rax char *v16; // rax const char *v17; // rdi size_t v18; // r13 char *ptr; // [rsp+8h] [rbp-70h] char *s[2]; // [rsp+10h] [rbp-68h] __m128i v21; // [rsp+20h] [rbp-58h] unsigned long long v22; // [rsp+38h] [rbp-40h] v22 = __readfsqword(0x28u); *(__m128 *)s = _mm_loadh_ps((const double *)&off_3D78); v21 = _mm_unpacklo_epi64((__m128i)(unsigned long long)"*", (__m128i)(unsigned long long)"\n"); v1 = strdup(a1); ptr = v1; if ( !*v1 ) { v3 = 0LL; goto LABEL_17; } v2 = v1; v3 = 0LL; v4 = 0; while ( 1 ) { while ( 1 ) { v5 = -1; v6 = strlen(v2); v7 = strstr(v2, "; "); if ( v7 ) { v8 = v7 - v2; v9 = -(v8 < v6); if ( v8 <= v6 ) v6 = v8; v5 = ~v9; } v10 = strstr(v2, ", "); if ( v10 ) { v11 = v10 - v2; if ( v11 < v6 ) { v6 = v11; v5 = 1; } } v12 = strchr(v2, 42); v13 = strchr(v2, 10); if ( !v12 || v12 - v2 >= v6 ) break; if ( !v13 || (v5 = 3, v6 = v13 - v2, v13 - v2 >= (unsigned long long)(v12 - v2)) ) { v6 = v12 - v2; v5 = 2; } LABEL_15: if ( v6 ) goto LABEL_21; LABEL_16: v2 += strlen(s[v5]); if ( !*v2 ) goto LABEL_17; } if ( !v13 ) break; v15 = v13 - v2; if ( v15 >= v6 ) break; v6 = v15; v5 = 3; if ( !v15 ) goto LABEL_16; LABEL_21: v3 = (char *)realloc(v3, 8LL * ++v4); v16 = strndup(v2, v6); v17 = s[v5]; *(_QWORD *)&v3[8 * v4 - 8] = v16; v2 += v6 + strlen(v17); if ( !*v2 ) goto LABEL_17; } if ( v5 != -1 ) goto LABEL_15; v18 = 8LL * (v4 + 1); v3 = (char *)realloc(v3, v18); *(_QWORD *)&v3[v18 - 8] = strdup(v2); LABEL_17: free(ptr); return v3; }
func0: ENDBR64 PUSH R15 LEA RDX,[0x10200a] PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x48 MOVQ XMM0,qword ptr [0x00103d70] MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x38],RAX XOR EAX,EAX LEA RAX,[0x10200c] MOVHPS XMM0,qword ptr [0x00103d78] MOVQ XMM1,RAX MOVAPS xmmword ptr [RSP + 0x10],XMM0 MOVQ XMM0,RDX PUNPCKLQDQ XMM0,XMM1 MOVAPS xmmword ptr [RSP + 0x20],XMM0 CALL 0x00101160 CMP byte ptr [RAX],0x0 MOV qword ptr [RSP + 0x8],RAX JZ 0x001017a5 MOV RBX,RAX XOR EBP,EBP XOR R12D,R12D NOP word ptr [RAX + RAX*0x1] LAB_001015f8: MOV RDI,RBX MOV R15D,0xffffffff CALL 0x001010f0 LEA RSI,[0x102004] MOV RDI,RBX MOV R14,RAX CALL 0x00101170 TEST RAX,RAX JZ 0x00101630 SUB RAX,RBX CMP RAX,R14 SBB R15D,R15D CMP RAX,R14 CMOVBE R14,RAX NOT R15D LAB_00101630: LEA RSI,[0x102007] MOV RDI,RBX CALL 0x00101170 TEST RAX,RAX JZ 0x00101655 SUB RAX,RBX CMP RAX,R14 JNC 0x00101655 MOV R14,RAX MOV R15D,0x1 LAB_00101655: MOV ESI,0x2a MOV RDI,RBX CALL 0x00101110 MOV ESI,0xa MOV RDI,RBX MOV R13,RAX CALL 0x00101110 TEST R13,R13 JZ 0x00101700 MOV R8,R13 SUB R8,RBX CMP R8,R14 JNC 0x00101700 TEST RAX,RAX JZ 0x0010169c SUB RAX,RBX MOV R15D,0x3 MOV R14,RAX CMP RAX,R8 JC 0x001016a5 LAB_0010169c: MOV R14,R8 MOV R15D,0x2 LAB_001016a5: TEST R14,R14 JNZ 0x0010171b LAB_001016aa: MOVSXD RCX,R15D MOV RDI,qword ptr [RSP + RCX*0x8 + 0x10] CALL 0x001010f0 ADD RBX,RAX CMP byte ptr [RBX],0x0 JNZ 0x001015f8 LAB_001016c3: MOV RDI,qword ptr [RSP + 0x8] CALL 0x001010e0 MOV EDX,R12D MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x001017af ADD RSP,0x48 MOV RAX,RBP POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101700: TEST RAX,RAX JZ 0x00101770 SUB RAX,RBX CMP RAX,R14 JNC 0x00101770 MOV R14,RAX MOV R15D,0x3 TEST R14,R14 JZ 0x001016aa LAB_0010171b: ADD R12D,0x1 MOV RDI,RBP MOVSXD R8,R12D SHL R8,0x3 MOV RSI,R8 MOV qword ptr [RSP],R8 CALL 0x00101150 MOV RDI,RBX MOV RSI,R14 MOV RBP,RAX CALL 0x00101130 MOV R8,qword ptr [RSP] MOVSXD RCX,R15D MOV RDI,qword ptr [RSP + RCX*0x8 + 0x10] MOV qword ptr [RBP + R8*0x1 + -0x8],RAX CALL 0x001010f0 ADD RAX,R14 ADD RBX,RAX CMP byte ptr [RBX],0x0 JNZ 0x001015f8 JMP 0x001016c3 LAB_00101770: CMP R15D,-0x1 JNZ 0x001016a5 ADD R12D,0x1 MOV RDI,RBP MOVSXD R13,R12D SHL R13,0x3 MOV RSI,R13 CALL 0x00101150 MOV RDI,RBX MOV RBP,RAX CALL 0x00101160 MOV qword ptr [RBP + R13*0x1 + -0x8],RAX JMP 0x001016c3 LAB_001017a5: XOR R12D,R12D XOR EBP,EBP JMP 0x001016c3 LAB_001017af: CALL 0x00101100
void * func0(char *param_1) { char *__ptr; ulong uVar1; char *pcVar2; ulong uVar3; char *pcVar4; size_t sVar5; ulong __n; void *__ptr_00; char *pcVar6; int iVar7; uint uVar8; long in_FS_OFFSET; bool bVar9; int *local_68 [5]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); local_68[0] = PTR_DAT_00103d70; local_68[1] = PTR_DAT_00103d78; local_68[2] = &DAT_0010200a; local_68[3] = &DAT_0010200c; __ptr = strdup(param_1); if (*__ptr == '\0') { __ptr_00 = (void *)0x0; } else { __ptr_00 = (void *)0x0; iVar7 = 0; pcVar6 = __ptr; do { while( true ) { uVar8 = 0xffffffff; uVar1 = strlen(pcVar6); pcVar2 = strstr(pcVar6,"; "); if (pcVar2 != (char *)0x0) { uVar3 = (long)pcVar2 - (long)pcVar6; bVar9 = uVar3 < uVar1; if (uVar3 <= uVar1) { uVar1 = uVar3; } uVar8 = ~-(uint)bVar9; } pcVar2 = strstr(pcVar6,", "); if ((pcVar2 != (char *)0x0) && ((ulong)((long)pcVar2 - (long)pcVar6) < uVar1)) { uVar8 = 1; uVar1 = (long)pcVar2 - (long)pcVar6; } pcVar2 = strchr(pcVar6,0x2a); pcVar4 = strchr(pcVar6,10); if ((pcVar2 != (char *)0x0) && (uVar3 = (long)pcVar2 - (long)pcVar6, uVar3 < uVar1)) break; if ((pcVar4 == (char *)0x0) || (__n = (long)pcVar4 - (long)pcVar6, uVar1 <= __n)) { __n = uVar1; if (uVar8 != 0xffffffff) goto LAB_001016a5; sVar5 = (long)(iVar7 + 1) * 8; __ptr_00 = realloc(__ptr_00,sVar5); pcVar6 = strdup(pcVar6); *(char **)((long)__ptr_00 + (sVar5 - 8)) = pcVar6; goto LAB_001016c3; } uVar8 = 3; if (__n != 0) goto LAB_0010171b; LAB_001016aa: sVar5 = strlen(local_68[(int)uVar8]); pcVar6 = pcVar6 + sVar5; if (*pcVar6 == '\0') goto LAB_001016c3; } if (pcVar4 != (char *)0x0) { uVar8 = 3; __n = (long)pcVar4 - (long)pcVar6; if ((ulong)((long)pcVar4 - (long)pcVar6) < uVar3) goto LAB_001016a5; } uVar8 = 2; __n = uVar3; LAB_001016a5: if (__n == 0) goto LAB_001016aa; LAB_0010171b: iVar7 = iVar7 + 1; __ptr_00 = realloc(__ptr_00,(long)iVar7 * 8); pcVar4 = strndup(pcVar6,__n); pcVar2 = local_68[(int)uVar8]; *(char **)((long)__ptr_00 + ((long)iVar7 * 8 - 8U)) = pcVar4; sVar5 = strlen(pcVar2); pcVar6 = pcVar6 + sVar5 + __n; } while (*pcVar6 != '\0'); } LAB_001016c3: free(__ptr); if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return __ptr_00; }
4,188
func0
#include <stdio.h> #include <stdbool.h> #include <string.h> #include <assert.h>
bool func0(char** colors, int colors_len, char** patterns, int patterns_len){ if (colors_len != patterns_len){ return false; } // Initialize sdict as arrays: patterns and for each pattern, a list of colors. // Also pset and sset // To keep it simple, define max unique patterns and colors as 100 char* sdict_keys[100]; char* sdict_values[100][100]; // sdict_values[i][j] int sdict_size = 0; char* pset[100]; int pset_size = 0; char* sset[100]; int sset_size = 0; for(int i = 0; i < patterns_len; i++) { // Add to pset if not present bool found = false; for(int j = 0; j < pset_size; j++) { if(strcmp(patterns[i], pset[j]) == 0){ found = true; break; } } if (!found){ pset[pset_size++] = patterns[i]; } // Add to sset if not present found = false; for(int j = 0; j < sset_size; j++) { if(strcmp(colors[i], sset[j]) == 0){ found = true; break; } } if (!found){ sset[sset_size++] = colors[i]; } // Add color to sdict // Find if pattern exists in sdict_keys int pattern_index = -1; for(int j = 0; j < sdict_size; j++){ if(strcmp(patterns[i], sdict_keys[j]) == 0){ pattern_index = j; break; } } if(pattern_index == -1){ // Add new pattern key sdict_keys[sdict_size] = patterns[i]; sdict_values[sdict_size][0] = colors[i]; sdict_values[sdict_size][1] = NULL; sdict_size++; } else{ // Append color to existing list int k = 0; while(sdict_values[pattern_index][k] != NULL && k < 99){ k++; } sdict_values[pattern_index][k] = colors[i]; sdict_values[pattern_index][k+1] = NULL; } } if(pset_size != sset_size){ return false; } // Now, for each list in sdict_values, check all colors are same for(int i = 0; i < sdict_size; i++){ char* first_color = sdict_values[i][0]; for(int j = 1; sdict_values[i][j] != NULL; j++){ if(strcmp(first_color, sdict_values[i][j]) != 0){ return false; } } } return true; }
int main(){ char* colors1[] = {"red", "green", "green"}; char* patterns1[] = {"a", "b", "b"}; assert(func0(colors1, 3, patterns1, 3) == true); char* colors2[] = {"red", "green", "greenn"}; char* patterns2[] = {"a", "b", "b"}; assert(func0(colors2, 3, patterns2, 3) == false); char* colors3[] = {"red", "green", "greenn"}; char* patterns3[] = {"a", "b"}; assert(func0(colors3, 3, patterns3, 2) == false); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp lea -0x14000(%rsp),%r11 sub $0x1000,%rsp orq $0x0,(%rsp) cmp %r11,%rsp jne 1199 <func0+0x10> sub $0x250,%rsp mov %rdi,-0x14238(%rbp) mov %esi,-0x1423c(%rbp) mov %rdx,-0x14248(%rbp) mov %ecx,-0x14240(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax mov -0x1423c(%rbp),%eax cmp -0x14240(%rbp),%eax je 11f2 <func0+0x69> mov $0x0,%eax jmpq 16da <func0+0x551> movl $0x0,-0x14224(%rbp) movl $0x0,-0x14220(%rbp) movl $0x0,-0x1421c(%rbp) movl $0x0,-0x14218(%rbp) jmpq 15a9 <func0+0x420> movb $0x0,-0x14225(%rbp) movl $0x0,-0x14214(%rbp) jmp 127e <func0+0xf5> mov -0x14214(%rbp),%eax cltq mov -0x13ed0(%rbp,%rax,8),%rdx mov -0x14218(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x14248(%rbp),%rax add %rcx,%rax mov (%rax),%rax mov %rdx,%rsi mov %rax,%rdi callq 1090 <strcmp@plt> test %eax,%eax jne 1277 <func0+0xee> movb $0x1,-0x14225(%rbp) jmp 128c <func0+0x103> addl $0x1,-0x14214(%rbp) mov -0x14214(%rbp),%eax cmp -0x14220(%rbp),%eax jl 1232 <func0+0xa9> movzbl -0x14225(%rbp),%eax xor $0x1,%eax test %al,%al je 12d1 <func0+0x148> mov -0x14218(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x14248(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x14220(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x14220(%rbp) mov (%rcx),%rdx cltq mov %rdx,-0x13ed0(%rbp,%rax,8) movb $0x0,-0x14225(%rbp) movl $0x0,-0x14210(%rbp) jmp 1330 <func0+0x1a7> mov -0x14210(%rbp),%eax cltq mov -0x13bb0(%rbp,%rax,8),%rdx mov -0x14218(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x14238(%rbp),%rax add %rcx,%rax mov (%rax),%rax mov %rdx,%rsi mov %rax,%rdi callq 1090 <strcmp@plt> test %eax,%eax jne 1329 <func0+0x1a0> movb $0x1,-0x14225(%rbp) jmp 133e <func0+0x1b5> addl $0x1,-0x14210(%rbp) mov -0x14210(%rbp),%eax cmp -0x1421c(%rbp),%eax jl 12e4 <func0+0x15b> movzbl -0x14225(%rbp),%eax xor $0x1,%eax test %al,%al je 1383 <func0+0x1fa> mov -0x14218(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x14238(%rbp),%rax lea (%rdx,%rax,1),%rcx mov -0x1421c(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x1421c(%rbp) mov (%rcx),%rdx cltq mov %rdx,-0x13bb0(%rbp,%rax,8) movl $0xffffffff,-0x1420c(%rbp) movl $0x0,-0x14208(%rbp) jmp 13ea <func0+0x261> mov -0x14208(%rbp),%eax cltq mov -0x141f0(%rbp,%rax,8),%rdx mov -0x14218(%rbp),%eax cltq lea 0x0(,%rax,8),%rcx mov -0x14248(%rbp),%rax add %rcx,%rax mov (%rax),%rax mov %rdx,%rsi mov %rax,%rdi callq 1090 <strcmp@plt> test %eax,%eax jne 13e3 <func0+0x25a> mov -0x14208(%rbp),%eax mov %eax,-0x1420c(%rbp) jmp 13f8 <func0+0x26f> addl $0x1,-0x14208(%rbp) mov -0x14208(%rbp),%eax cmp -0x14224(%rbp),%eax jl 1399 <func0+0x210> cmpl $0xffffffff,-0x1420c(%rbp) jne 14bb <func0+0x332> mov -0x14218(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x14248(%rbp),%rax add %rdx,%rax mov (%rax),%rdx mov -0x14224(%rbp),%eax cltq mov %rdx,-0x141f0(%rbp,%rax,8) mov -0x14218(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x14238(%rbp),%rax add %rdx,%rax mov (%rax),%rcx mov -0x14224(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax shl $0x5,%rax add %rbp,%rax sub $0x13890,%rax mov %rcx,(%rax) mov -0x14224(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax shl $0x5,%rax add %rbp,%rax sub $0x13888,%rax movq $0x0,(%rax) addl $0x1,-0x14224(%rbp) jmpq 15a2 <func0+0x419> movl $0x0,-0x14204(%rbp) jmp 14ce <func0+0x345> addl $0x1,-0x14204(%rbp) mov -0x14204(%rbp),%eax movslq %eax,%rcx mov -0x1420c(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax shl $0x2,%rax add %rcx,%rax mov -0x13890(%rbp,%rax,8),%rax test %rax,%rax je 1512 <func0+0x389> cmpl $0x62,-0x14204(%rbp) jle 14c7 <func0+0x33e> mov -0x14218(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x14238(%rbp),%rax add %rdx,%rax mov (%rax),%rcx mov -0x14204(%rbp),%eax movslq %eax,%rsi mov -0x1420c(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax shl $0x2,%rax add %rsi,%rax mov %rcx,-0x13890(%rbp,%rax,8) mov -0x14204(%rbp),%eax add $0x1,%eax movslq %eax,%rcx mov -0x1420c(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax shl $0x2,%rax add %rcx,%rax movq $0x0,-0x13890(%rbp,%rax,8) addl $0x1,-0x14218(%rbp) mov -0x14218(%rbp),%eax cmp -0x14240(%rbp),%eax jl 121f <func0+0x96> mov -0x14220(%rbp),%eax cmp -0x1421c(%rbp),%eax je 15d3 <func0+0x44a> mov $0x0,%eax jmpq 16da <func0+0x551> movl $0x0,-0x14200(%rbp) jmpq 16c3 <func0+0x53a> mov -0x14200(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax shl $0x5,%rax add %rbp,%rax sub $0x13890,%rax mov (%rax),%rax mov %rax,-0x141f8(%rbp) movl $0x1,-0x141fc(%rbp) jmp 167d <func0+0x4f4> mov -0x141fc(%rbp),%eax movslq %eax,%rcx mov -0x14200(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax shl $0x2,%rax add %rcx,%rax mov -0x13890(%rbp,%rax,8),%rdx mov -0x141f8(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1090 <strcmp@plt> test %eax,%eax je 1676 <func0+0x4ed> mov $0x0,%eax jmp 16da <func0+0x551> addl $0x1,-0x141fc(%rbp) mov -0x141fc(%rbp),%eax movslq %eax,%rcx mov -0x14200(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax shl $0x2,%rax add %rcx,%rax mov -0x13890(%rbp,%rax,8),%rax test %rax,%rax jne 1623 <func0+0x49a> addl $0x1,-0x14200(%rbp) mov -0x14200(%rbp),%eax cmp -0x14224(%rbp),%eax jl 15e2 <func0+0x459> mov $0x1,%eax mov -0x8(%rbp),%rdi xor %fs:0x28,%rdi je 16ee <func0+0x565> callq 1070 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp lea r11, [rsp+var_14000] loc_1199: sub rsp, 1000h or [rsp+1000h+var_1000], 0 cmp rsp, r11 jnz short loc_1199 sub rsp, 250h mov [rbp+var_14238], rdi mov [rbp+var_1423C], esi mov [rbp+var_14248], rdx mov [rbp+var_14240], ecx mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov eax, [rbp+var_1423C] cmp eax, [rbp+var_14240] jz short loc_11F2 mov eax, 0 jmp loc_16DA loc_11F2: mov [rbp+var_14224], 0 mov [rbp+var_14220], 0 mov [rbp+var_1421C], 0 mov [rbp+var_14218], 0 jmp loc_15A9 loc_121F: mov [rbp+var_14225], 0 mov [rbp+var_14214], 0 jmp short loc_127E loc_1232: mov eax, [rbp+var_14214] cdqe mov rdx, [rbp+rax*8+s2] mov eax, [rbp+var_14218] cdqe lea rcx, ds:0[rax*8] mov rax, [rbp+var_14248] add rax, rcx mov rax, [rax] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jnz short loc_1277 mov [rbp+var_14225], 1 jmp short loc_128C loc_1277: add [rbp+var_14214], 1 loc_127E: mov eax, [rbp+var_14214] cmp eax, [rbp+var_14220] jl short loc_1232 loc_128C: movzx eax, [rbp+var_14225] xor eax, 1 test al, al jz short loc_12D1 mov eax, [rbp+var_14218] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_14248] lea rcx, [rdx+rax] mov eax, [rbp+var_14220] lea edx, [rax+1] mov [rbp+var_14220], edx mov rdx, [rcx] cdqe mov [rbp+rax*8+s2], rdx loc_12D1: mov [rbp+var_14225], 0 mov [rbp+var_14210], 0 jmp short loc_1330 loc_12E4: mov eax, [rbp+var_14210] cdqe mov rdx, [rbp+rax*8+var_13BB0] mov eax, [rbp+var_14218] cdqe lea rcx, ds:0[rax*8] mov rax, [rbp+var_14238] add rax, rcx mov rax, [rax] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jnz short loc_1329 mov [rbp+var_14225], 1 jmp short loc_133E loc_1329: add [rbp+var_14210], 1 loc_1330: mov eax, [rbp+var_14210] cmp eax, [rbp+var_1421C] jl short loc_12E4 loc_133E: movzx eax, [rbp+var_14225] xor eax, 1 test al, al jz short loc_1383 mov eax, [rbp+var_14218] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_14238] lea rcx, [rdx+rax] mov eax, [rbp+var_1421C] lea edx, [rax+1] mov [rbp+var_1421C], edx mov rdx, [rcx] cdqe mov [rbp+rax*8+var_13BB0], rdx loc_1383: mov [rbp+var_1420C], 0FFFFFFFFh mov [rbp+var_14208], 0 jmp short loc_13EA loc_1399: mov eax, [rbp+var_14208] cdqe mov rdx, [rbp+rax*8+var_141F0] mov eax, [rbp+var_14218] cdqe lea rcx, ds:0[rax*8] mov rax, [rbp+var_14248] add rax, rcx mov rax, [rax] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jnz short loc_13E3 mov eax, [rbp+var_14208] mov [rbp+var_1420C], eax jmp short loc_13F8 loc_13E3: add [rbp+var_14208], 1 loc_13EA: mov eax, [rbp+var_14208] cmp eax, [rbp+var_14224] jl short loc_1399 loc_13F8: cmp [rbp+var_1420C], 0FFFFFFFFh jnz loc_14BB mov eax, [rbp+var_14218] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_14248] add rax, rdx mov rdx, [rax] mov eax, [rbp+var_14224] cdqe mov [rbp+rax*8+var_141F0], rdx mov eax, [rbp+var_14218] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_14238] add rax, rdx mov rcx, [rax] mov eax, [rbp+var_14224] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx shl rax, 5 add rax, rbp sub rax, 13890h mov [rax], rcx mov eax, [rbp+var_14224] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx shl rax, 5 add rax, rbp sub rax, 13888h mov qword ptr [rax], 0 add [rbp+var_14224], 1 jmp loc_15A2 loc_14BB: mov [rbp+var_14204], 0 jmp short loc_14CE loc_14C7: add [rbp+var_14204], 1 loc_14CE: mov eax, [rbp+var_14204] movsxd rcx, eax mov eax, [rbp+var_1420C] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx shl rax, 2 add rax, rcx mov rax, [rbp+rax*8+var_13890] test rax, rax jz short loc_1512 cmp [rbp+var_14204], 62h ; 'b' jle short loc_14C7 loc_1512: mov eax, [rbp+var_14218] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_14238] add rax, rdx mov rcx, [rax] mov eax, [rbp+var_14204] movsxd rsi, eax mov eax, [rbp+var_1420C] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx shl rax, 2 add rax, rsi mov [rbp+rax*8+var_13890], rcx mov eax, [rbp+var_14204] add eax, 1 movsxd rcx, eax mov eax, [rbp+var_1420C] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx shl rax, 2 add rax, rcx mov [rbp+rax*8+var_13890], 0 loc_15A2: add [rbp+var_14218], 1 loc_15A9: mov eax, [rbp+var_14218] cmp eax, [rbp+var_14240] jl loc_121F mov eax, [rbp+var_14220] cmp eax, [rbp+var_1421C] jz short loc_15D3 mov eax, 0 jmp loc_16DA loc_15D3: mov [rbp+var_14200], 0 jmp loc_16C3 loc_15E2: mov eax, [rbp+var_14200] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx shl rax, 5 add rax, rbp sub rax, 13890h mov rax, [rax] mov [rbp+s1], rax mov [rbp+var_141FC], 1 jmp short loc_167D loc_1623: mov eax, [rbp+var_141FC] movsxd rcx, eax mov eax, [rbp+var_14200] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx shl rax, 2 add rax, rcx mov rdx, [rbp+rax*8+var_13890] mov rax, [rbp+s1] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jz short loc_1676 mov eax, 0 jmp short loc_16DA loc_1676: add [rbp+var_141FC], 1 loc_167D: mov eax, [rbp+var_141FC] movsxd rcx, eax mov eax, [rbp+var_14200] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx shl rax, 2 add rax, rcx mov rax, [rbp+rax*8+var_13890] test rax, rax jnz loc_1623 add [rbp+var_14200], 1 loc_16C3: mov eax, [rbp+var_14200] cmp eax, [rbp+var_14224] jl loc_15E2 mov eax, 1 loc_16DA: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_16EE call ___stack_chk_fail locret_16EE: leave retn
long long func0(long long a1, int a2, long long a3, int a4) { int v5; // eax int v6; // eax char v9; // [rsp+23h] [rbp-14225h] char v10; // [rsp+23h] [rbp-14225h] int v11; // [rsp+24h] [rbp-14224h] int v12; // [rsp+28h] [rbp-14220h] int v13; // [rsp+2Ch] [rbp-1421Ch] int i; // [rsp+30h] [rbp-14218h] int j; // [rsp+34h] [rbp-14214h] int k; // [rsp+38h] [rbp-14210h] int v17; // [rsp+3Ch] [rbp-1420Ch] int m; // [rsp+40h] [rbp-14208h] int n; // [rsp+44h] [rbp-14204h] int ii; // [rsp+48h] [rbp-14200h] int jj; // [rsp+4Ch] [rbp-141FCh] char *s1; // [rsp+50h] [rbp-141F8h] char *v23[62]; // [rsp+58h] [rbp-141F0h] char v24; // [rsp+248h] [rbp-14000h] BYREF char *s2[9690]; // [rsp+378h] [rbp-13ED0h] _QWORD v26[512]; // [rsp+13248h] [rbp-1000h] BYREF while ( v26 != (_QWORD *)&v24 ) ; v26[511] = __readfsqword(0x28u); if ( a2 != a4 ) return 0LL; v11 = 0; v12 = 0; v13 = 0; for ( i = 0; i < a4; ++i ) { v9 = 0; for ( j = 0; j < v12; ++j ) { if ( !strcmp(*(const char **)(8LL * i + a3), s2[j]) ) { v9 = 1; break; } } if ( v9 != 1 ) { v5 = v12++; s2[v5] = *(char **)(8LL * i + a3); } v10 = 0; for ( k = 0; k < v13; ++k ) { if ( !strcmp(*(const char **)(8LL * i + a1), s2[k + 100]) ) { v10 = 1; break; } } if ( v10 != 1 ) { v6 = v13++; s2[v6 + 100] = *(char **)(8LL * i + a1); } v17 = -1; for ( m = 0; m < v11; ++m ) { if ( !strcmp(*(const char **)(8LL * i + a3), v23[m]) ) { v17 = m; break; } } if ( v17 == -1 ) { v23[v11] = *(char **)(8LL * i + a3); s2[100 * v11 + 200] = *(char **)(8LL * i + a1); s2[100 * v11++ + 201] = 0LL; } else { for ( n = 0; (&s2[100 * v17 + 200])[n] && n <= 98; ++n ) ; (&s2[100 * v17 + 200])[n] = *(char **)(8LL * i + a1); (&s2[100 * v17 + 201])[n] = 0LL; } } if ( v12 != v13 ) return 0LL; for ( ii = 0; ii < v11; ++ii ) { s1 = s2[100 * ii + 200]; for ( jj = 1; (&s2[100 * ii + 200])[jj]; ++jj ) { if ( strcmp(s1, (&s2[100 * ii + 200])[jj]) ) return 0LL; } } return 1LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP LEA R11,[RSP + -0x14000] LAB_00101199: SUB RSP,0x1000 OR qword ptr [RSP],0x0 CMP RSP,R11 JNZ 0x00101199 SUB RSP,0x250 MOV qword ptr [RBP + -0x14238],RDI MOV dword ptr [RBP + -0x1423c],ESI MOV qword ptr [RBP + -0x14248],RDX MOV dword ptr [RBP + -0x14240],ECX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV EAX,dword ptr [RBP + -0x1423c] CMP EAX,dword ptr [RBP + -0x14240] JZ 0x001011f2 MOV EAX,0x0 JMP 0x001016da LAB_001011f2: MOV dword ptr [RBP + -0x14224],0x0 MOV dword ptr [RBP + -0x14220],0x0 MOV dword ptr [RBP + -0x1421c],0x0 MOV dword ptr [RBP + -0x14218],0x0 JMP 0x001015a9 LAB_0010121f: MOV byte ptr [RBP + -0x14225],0x0 MOV dword ptr [RBP + -0x14214],0x0 JMP 0x0010127e LAB_00101232: MOV EAX,dword ptr [RBP + -0x14214] CDQE MOV RDX,qword ptr [RBP + RAX*0x8 + -0x13ed0] MOV EAX,dword ptr [RBP + -0x14218] CDQE LEA RCX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x14248] ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV RSI,RDX MOV RDI,RAX CALL 0x00101090 TEST EAX,EAX JNZ 0x00101277 MOV byte ptr [RBP + -0x14225],0x1 JMP 0x0010128c LAB_00101277: ADD dword ptr [RBP + -0x14214],0x1 LAB_0010127e: MOV EAX,dword ptr [RBP + -0x14214] CMP EAX,dword ptr [RBP + -0x14220] JL 0x00101232 LAB_0010128c: MOVZX EAX,byte ptr [RBP + -0x14225] XOR EAX,0x1 TEST AL,AL JZ 0x001012d1 MOV EAX,dword ptr [RBP + -0x14218] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x14248] LEA RCX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x14220] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x14220],EDX MOV RDX,qword ptr [RCX] CDQE MOV qword ptr [RBP + RAX*0x8 + -0x13ed0],RDX LAB_001012d1: MOV byte ptr [RBP + -0x14225],0x0 MOV dword ptr [RBP + -0x14210],0x0 JMP 0x00101330 LAB_001012e4: MOV EAX,dword ptr [RBP + -0x14210] CDQE MOV RDX,qword ptr [RBP + RAX*0x8 + -0x13bb0] MOV EAX,dword ptr [RBP + -0x14218] CDQE LEA RCX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x14238] ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV RSI,RDX MOV RDI,RAX CALL 0x00101090 TEST EAX,EAX JNZ 0x00101329 MOV byte ptr [RBP + -0x14225],0x1 JMP 0x0010133e LAB_00101329: ADD dword ptr [RBP + -0x14210],0x1 LAB_00101330: MOV EAX,dword ptr [RBP + -0x14210] CMP EAX,dword ptr [RBP + -0x1421c] JL 0x001012e4 LAB_0010133e: MOVZX EAX,byte ptr [RBP + -0x14225] XOR EAX,0x1 TEST AL,AL JZ 0x00101383 MOV EAX,dword ptr [RBP + -0x14218] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x14238] LEA RCX,[RDX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x1421c] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x1421c],EDX MOV RDX,qword ptr [RCX] CDQE MOV qword ptr [RBP + RAX*0x8 + -0x13bb0],RDX LAB_00101383: MOV dword ptr [RBP + -0x1420c],0xffffffff MOV dword ptr [RBP + -0x14208],0x0 JMP 0x001013ea LAB_00101399: MOV EAX,dword ptr [RBP + -0x14208] CDQE MOV RDX,qword ptr [RBP + RAX*0x8 + -0x141f0] MOV EAX,dword ptr [RBP + -0x14218] CDQE LEA RCX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x14248] ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV RSI,RDX MOV RDI,RAX CALL 0x00101090 TEST EAX,EAX JNZ 0x001013e3 MOV EAX,dword ptr [RBP + -0x14208] MOV dword ptr [RBP + -0x1420c],EAX JMP 0x001013f8 LAB_001013e3: ADD dword ptr [RBP + -0x14208],0x1 LAB_001013ea: MOV EAX,dword ptr [RBP + -0x14208] CMP EAX,dword ptr [RBP + -0x14224] JL 0x00101399 LAB_001013f8: CMP dword ptr [RBP + -0x1420c],-0x1 JNZ 0x001014bb MOV EAX,dword ptr [RBP + -0x14218] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x14248] ADD RAX,RDX MOV RDX,qword ptr [RAX] MOV EAX,dword ptr [RBP + -0x14224] CDQE MOV qword ptr [RBP + RAX*0x8 + -0x141f0],RDX MOV EAX,dword ptr [RBP + -0x14218] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x14238] ADD RAX,RDX MOV RCX,qword ptr [RAX] MOV EAX,dword ptr [RBP + -0x14224] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX SHL RAX,0x5 ADD RAX,RBP SUB RAX,0x13890 MOV qword ptr [RAX],RCX MOV EAX,dword ptr [RBP + -0x14224] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX SHL RAX,0x5 ADD RAX,RBP SUB RAX,0x13888 MOV qword ptr [RAX],0x0 ADD dword ptr [RBP + -0x14224],0x1 JMP 0x001015a2 LAB_001014bb: MOV dword ptr [RBP + -0x14204],0x0 JMP 0x001014ce LAB_001014c7: ADD dword ptr [RBP + -0x14204],0x1 LAB_001014ce: MOV EAX,dword ptr [RBP + -0x14204] MOVSXD RCX,EAX MOV EAX,dword ptr [RBP + -0x1420c] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX SHL RAX,0x2 ADD RAX,RCX MOV RAX,qword ptr [RBP + RAX*0x8 + -0x13890] TEST RAX,RAX JZ 0x00101512 CMP dword ptr [RBP + -0x14204],0x62 JLE 0x001014c7 LAB_00101512: MOV EAX,dword ptr [RBP + -0x14218] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x14238] ADD RAX,RDX MOV RCX,qword ptr [RAX] MOV EAX,dword ptr [RBP + -0x14204] MOVSXD RSI,EAX MOV EAX,dword ptr [RBP + -0x1420c] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX SHL RAX,0x2 ADD RAX,RSI MOV qword ptr [RBP + RAX*0x8 + -0x13890],RCX MOV EAX,dword ptr [RBP + -0x14204] ADD EAX,0x1 MOVSXD RCX,EAX MOV EAX,dword ptr [RBP + -0x1420c] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX SHL RAX,0x2 ADD RAX,RCX MOV qword ptr [RBP + RAX*0x8 + -0x13890],0x0 LAB_001015a2: ADD dword ptr [RBP + -0x14218],0x1 LAB_001015a9: MOV EAX,dword ptr [RBP + -0x14218] CMP EAX,dword ptr [RBP + -0x14240] JL 0x0010121f MOV EAX,dword ptr [RBP + -0x14220] CMP EAX,dword ptr [RBP + -0x1421c] JZ 0x001015d3 MOV EAX,0x0 JMP 0x001016da LAB_001015d3: MOV dword ptr [RBP + -0x14200],0x0 JMP 0x001016c3 LAB_001015e2: MOV EAX,dword ptr [RBP + -0x14200] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX SHL RAX,0x5 ADD RAX,RBP SUB RAX,0x13890 MOV RAX,qword ptr [RAX] MOV qword ptr [RBP + -0x141f8],RAX MOV dword ptr [RBP + -0x141fc],0x1 JMP 0x0010167d LAB_00101623: MOV EAX,dword ptr [RBP + -0x141fc] MOVSXD RCX,EAX MOV EAX,dword ptr [RBP + -0x14200] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX SHL RAX,0x2 ADD RAX,RCX MOV RDX,qword ptr [RBP + RAX*0x8 + -0x13890] MOV RAX,qword ptr [RBP + -0x141f8] MOV RSI,RDX MOV RDI,RAX CALL 0x00101090 TEST EAX,EAX JZ 0x00101676 MOV EAX,0x0 JMP 0x001016da LAB_00101676: ADD dword ptr [RBP + -0x141fc],0x1 LAB_0010167d: MOV EAX,dword ptr [RBP + -0x141fc] MOVSXD RCX,EAX MOV EAX,dword ptr [RBP + -0x14200] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX SHL RAX,0x2 ADD RAX,RCX MOV RAX,qword ptr [RBP + RAX*0x8 + -0x13890] TEST RAX,RAX JNZ 0x00101623 ADD dword ptr [RBP + -0x14200],0x1 LAB_001016c3: MOV EAX,dword ptr [RBP + -0x14200] CMP EAX,dword ptr [RBP + -0x14224] JL 0x001015e2 MOV EAX,0x1 LAB_001016da: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001016ee CALL 0x00101070 LAB_001016ee: LEAVE RET
int8 func0(long param_1,int param_2,long param_3,int param_4) { long lVar1; char *pcVar2; char *pcVar3; bool bVar4; int *puVar5; int iVar6; int8 uVar7; int *puVar8; long in_FS_OFFSET; int iStack_1422c; int iStack_14228; int iStack_14224; int iStack_14220; int iStack_1421c; int iStack_14218; int iStack_14214; int iStack_14210; int iStack_1420c; int iStack_14208; int iStack_14204; int8 auStack_141f8 [62]; int auStack_14008 [304]; int8 auStack_13ed8 [100]; int8 auStack_13bb8 [100]; long alStack_13898 [10002]; puVar5 = &stack0xfffffffffffffff8; do { puVar8 = puVar5; *(int8 *)(puVar8 + -0x1000) = *(int8 *)(puVar8 + -0x1000); puVar5 = puVar8 + -0x1000; } while (puVar8 + -0x1000 != auStack_14008); lVar1 = *(long *)(in_FS_OFFSET + 0x28); if (param_2 == param_4) { iStack_1422c = 0; iStack_14228 = 0; iStack_14224 = 0; for (iStack_14220 = 0; iStack_14220 < param_4; iStack_14220 = iStack_14220 + 1) { bVar4 = false; for (iStack_1421c = 0; iStack_1421c < iStack_14228; iStack_1421c = iStack_1421c + 1) { pcVar2 = (char *)auStack_13ed8[iStack_1421c]; pcVar3 = *(char **)(param_3 + (long)iStack_14220 * 8); *(int8 *)(puVar8 + -0x1258) = 0x10126a; iVar6 = strcmp(pcVar3,pcVar2); if (iVar6 == 0) { bVar4 = true; break; } } if (!bVar4) { auStack_13ed8[iStack_14228] = *(int8 *)((long)iStack_14220 * 8 + param_3); iStack_14228 = iStack_14228 + 1; } bVar4 = false; for (iStack_14218 = 0; iStack_14218 < iStack_14224; iStack_14218 = iStack_14218 + 1) { pcVar2 = (char *)auStack_13bb8[iStack_14218]; pcVar3 = *(char **)(param_1 + (long)iStack_14220 * 8); *(int8 *)(puVar8 + -0x1258) = 0x10131c; iVar6 = strcmp(pcVar3,pcVar2); if (iVar6 == 0) { bVar4 = true; break; } } if (!bVar4) { auStack_13bb8[iStack_14224] = *(int8 *)((long)iStack_14220 * 8 + param_1); iStack_14224 = iStack_14224 + 1; } iStack_14214 = -1; for (iStack_14210 = 0; iStack_14210 < iStack_1422c; iStack_14210 = iStack_14210 + 1) { pcVar2 = (char *)auStack_141f8[iStack_14210]; pcVar3 = *(char **)(param_3 + (long)iStack_14220 * 8); *(int8 *)(puVar8 + -0x1258) = 0x1013d1; iVar6 = strcmp(pcVar3,pcVar2); if (iVar6 == 0) { iStack_14214 = iStack_14210; break; } } if (iStack_14214 == -1) { auStack_141f8[iStack_1422c] = *(int8 *)(param_3 + (long)iStack_14220 * 8); alStack_13898[(long)iStack_1422c * 100] = *(long *)(param_1 + (long)iStack_14220 * 8); alStack_13898[(long)iStack_1422c * 100 + 1] = 0; iStack_1422c = iStack_1422c + 1; } else { for (iStack_1420c = 0; (alStack_13898[(long)iStack_14214 * 100 + (long)iStack_1420c] != 0 && (iStack_1420c < 99)); iStack_1420c = iStack_1420c + 1) { } alStack_13898[(long)iStack_14214 * 100 + (long)iStack_1420c] = *(long *)(param_1 + (long)iStack_14220 * 8); alStack_13898[(long)iStack_14214 * 100 + (long)(iStack_1420c + 1)] = 0; } } if (iStack_14228 == iStack_14224) { for (iStack_14208 = 0; iStack_14208 < iStack_1422c; iStack_14208 = iStack_14208 + 1) { pcVar2 = (char *)alStack_13898[(long)iStack_14208 * 100]; iStack_14204 = 1; while (alStack_13898[(long)iStack_14208 * 100 + (long)iStack_14204] != 0) { pcVar3 = (char *)alStack_13898[(long)iStack_14208 * 100 + (long)iStack_14204]; *(int8 *)(puVar8 + -0x1258) = 0x10166b; iVar6 = strcmp(pcVar2,pcVar3); if (iVar6 != 0) { uVar7 = 0; goto LAB_001016da; } iStack_14204 = iStack_14204 + 1; } } uVar7 = 1; } else { uVar7 = 0; } } else { uVar7 = 0; } LAB_001016da: if (lVar1 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ *(int8 *)(puVar8 + -0x1258) = 0x1016ee; __stack_chk_fail(); } return uVar7; }
4,189
func0
#include <stdio.h> #include <stdbool.h> #include <string.h> #include <assert.h>
bool func0(char** colors, int colors_len, char** patterns, int patterns_len){ if (colors_len != patterns_len){ return false; } // Initialize sdict as arrays: patterns and for each pattern, a list of colors. // Also pset and sset // To keep it simple, define max unique patterns and colors as 100 char* sdict_keys[100]; char* sdict_values[100][100]; // sdict_values[i][j] int sdict_size = 0; char* pset[100]; int pset_size = 0; char* sset[100]; int sset_size = 0; for(int i = 0; i < patterns_len; i++) { // Add to pset if not present bool found = false; for(int j = 0; j < pset_size; j++) { if(strcmp(patterns[i], pset[j]) == 0){ found = true; break; } } if (!found){ pset[pset_size++] = patterns[i]; } // Add to sset if not present found = false; for(int j = 0; j < sset_size; j++) { if(strcmp(colors[i], sset[j]) == 0){ found = true; break; } } if (!found){ sset[sset_size++] = colors[i]; } // Add color to sdict // Find if pattern exists in sdict_keys int pattern_index = -1; for(int j = 0; j < sdict_size; j++){ if(strcmp(patterns[i], sdict_keys[j]) == 0){ pattern_index = j; break; } } if(pattern_index == -1){ // Add new pattern key sdict_keys[sdict_size] = patterns[i]; sdict_values[sdict_size][0] = colors[i]; sdict_values[sdict_size][1] = NULL; sdict_size++; } else{ // Append color to existing list int k = 0; while(sdict_values[pattern_index][k] != NULL && k < 99){ k++; } sdict_values[pattern_index][k] = colors[i]; sdict_values[pattern_index][k+1] = NULL; } } if(pset_size != sset_size){ return false; } // Now, for each list in sdict_values, check all colors are same for(int i = 0; i < sdict_size; i++){ char* first_color = sdict_values[i][0]; for(int j = 1; sdict_values[i][j] != NULL; j++){ if(strcmp(first_color, sdict_values[i][j]) != 0){ return false; } } } return true; }
int main(){ char* colors1[] = {"red", "green", "green"}; char* patterns1[] = {"a", "b", "b"}; assert(func0(colors1, 3, patterns1, 3) == true); char* colors2[] = {"red", "green", "greenn"}; char* patterns2[] = {"a", "b", "b"}; assert(func0(colors2, 3, patterns2, 3) == false); char* colors3[] = {"red", "green", "greenn"}; char* patterns3[] = {"a", "b"}; assert(func0(colors3, 3, patterns3, 2) == false); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx lea -0x14000(%rsp),%r11 sub $0x1000,%rsp orq $0x0,(%rsp) cmp %r11,%rsp jne 119f <func0+0x16> sub $0x228,%rsp mov %fs:0x28,%rax mov %rax,0x14218(%rsp) xor %eax,%eax cmp %ecx,%esi jne 1407 <func0+0x27e> test %ecx,%ecx jle 1494 <func0+0x30b> mov %rdx,%r14 mov %rdi,%r15 lea -0x1(%rcx),%eax lea 0x8(%rdx,%rax,8),%rax mov %rax,0x10(%rsp) movl $0x0,0xc(%rsp) movl $0x0,0x8(%rsp) mov $0x0,%ebp lea 0x358(%rsp),%rax mov %rax,0x18(%rsp) lea 0x678(%rsp),%rax mov %rax,0x20(%rsp) lea 0x990(%rsp),%rax mov %rax,0x28(%rsp) jmp 129c <func0+0x113> mov %rax,%rbx mov %ebx,0x4(%rsp) mov 0x30(%rsp,%rbx,8),%rsi mov %r12,%rdi callq 1090 <strcmp@plt> test %eax,%eax je 1358 <func0+0x1cf> lea 0x1(%rbx),%rax cmp %r13,%rbx jne 122b <func0+0xa2> movslq %ebp,%rax mov (%r14),%rdx mov %rdx,0x30(%rsp,%rax,8) lea (%rax,%rax,4),%rax lea 0x0(,%rax,4),%rcx lea (%rax,%rcx,1),%rdx shl $0x5,%rdx mov (%r15),%rsi mov %rsi,0x990(%rsp,%rdx,1) movq $0x0,0x998(%rsp,%rdx,1) add $0x1,%ebp add $0x8,%r14 add $0x8,%r15 cmp 0x10(%rsp),%r14 je 13f8 <func0+0x26f> cmpl $0x0,0x8(%rsp) jle 12d6 <func0+0x14d> mov (%r14),%r12 lea 0x350(%rsp),%rbx mov 0x8(%rsp),%eax lea -0x1(%rax),%eax mov 0x18(%rsp),%rcx lea (%rcx,%rax,8),%r13 mov (%rbx),%rsi mov %r12,%rdi callq 1090 <strcmp@plt> test %eax,%eax je 12ef <func0+0x166> add $0x8,%rbx cmp %r13,%rbx jne 12be <func0+0x135> mov 0x8(%rsp),%ecx movslq %ecx,%rax mov (%r14),%rdx mov %rdx,0x350(%rsp,%rax,8) lea 0x1(%rcx),%eax mov %eax,0x8(%rsp) mov 0xc(%rsp),%eax test %eax,%eax jle 1326 <func0+0x19d> mov (%r15),%r12 lea 0x670(%rsp),%rbx lea -0x1(%rax),%eax mov 0x20(%rsp),%rcx lea (%rcx,%rax,8),%r13 mov (%rbx),%rsi mov %r12,%rdi callq 1090 <strcmp@plt> test %eax,%eax je 133f <func0+0x1b6> add $0x8,%rbx cmp %r13,%rbx jne 130e <func0+0x185> mov 0xc(%rsp),%ecx movslq %ecx,%rax mov (%r15),%rdx mov %rdx,0x670(%rsp,%rax,8) lea 0x1(%rcx),%eax mov %eax,0xc(%rsp) test %ebp,%ebp jle 1250 <func0+0xc7> mov (%r14),%r12 lea -0x1(%rbp),%r13d mov $0x0,%ebx jmpq 122e <func0+0xa5> mov 0x4(%rsp),%ecx cmp $0xffffffff,%ecx je 1250 <func0+0xc7> movslq %ecx,%rdx lea (%rdx,%rdx,4),%rdx lea (%rdx,%rdx,4),%rdx shl $0x5,%rdx cmpq $0x0,0x990(%rsp,%rdx,1) je 13b4 <func0+0x22b> movslq 0x4(%rsp),%rax lea (%rax,%rax,4),%rax lea (%rax,%rax,4),%rdi shl $0x5,%rdi add 0x28(%rsp),%rdi mov $0x1,%edx mov %edx,%eax cmpq $0x0,(%rdi,%rdx,8) setne %sil cmp $0x62,%edx setle %cl add $0x1,%rdx test %cl,%sil jne 139a <func0+0x211> movslq %eax,%rsi movslq 0x4(%rsp),%rdx lea (%rdx,%rdx,4),%rdx lea 0x0(,%rdx,4),%rcx lea (%rdx,%rcx,1),%rdi lea (%rsi,%rdi,4),%rsi mov (%r15),%rdi mov %rdi,0x990(%rsp,%rsi,8) add $0x1,%eax cltq add %rcx,%rdx lea (%rax,%rdx,4),%rax movq $0x0,0x990(%rsp,%rax,8) jmpq 1289 <func0+0x100> mov $0x0,%eax mov 0xc(%rsp),%edx cmp %edx,0x8(%rsp) je 1430 <func0+0x2a7> mov 0x14218(%rsp),%rcx xor %fs:0x28,%rcx jne 14b2 <func0+0x329> add $0x14228,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq test %ebp,%ebp jle 149e <func0+0x315> lea 0x9a0(%rsp),%r12 lea -0x1(%rbp),%eax lea (%rax,%rax,4),%rax lea (%rax,%rax,4),%rax shl $0x5,%rax lea 0xcc0(%rsp,%rax,1),%r13 mov -0x10(%r12),%rbp mov -0x8(%r12),%rsi test %rsi,%rsi je 147e <func0+0x2f5> mov %r12,%rbx mov %rbp,%rdi callq 1090 <strcmp@plt> test %eax,%eax jne 14a8 <func0+0x31f> add $0x8,%rbx mov -0x8(%rbx),%rsi test %rsi,%rsi jne 1465 <func0+0x2dc> add $0x320,%r12 cmp %r12,%r13 jne 1453 <func0+0x2ca> mov $0x1,%eax jmpq 1407 <func0+0x27e> mov $0x1,%eax jmpq 1407 <func0+0x27e> mov $0x1,%eax jmpq 1407 <func0+0x27e> mov $0x0,%eax jmpq 1407 <func0+0x27e> callq 1070 <__stack_chk_fail@plt>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx lea r11, [rsp+30h+var_14030] loc_119F: sub rsp, 1000h or [rsp+1030h+var_1030], 0 cmp rsp, r11 jnz short loc_119F sub rsp, 228h mov rax, fs:28h mov [rsp+1258h+arg_12FB8], rax xor eax, eax cmp esi, ecx jnz loc_12DC test ecx, ecx jle loc_136D mov rbp, rdx mov r12, rdi lea eax, [rcx-1] lea rax, [rdx+rax*8+8] mov [rsp+1258h+var_1248], rax mov [rsp+1258h+var_124C], 0 mov r13d, 0 mov [rsp+1258h+var_1250], 0 lea rax, [rsp+1258h+var_F00] mov [rsp+1258h+var_1240], rax lea rax, [rsp+1258h+var_BE0] mov [rsp+1258h+var_1238], rax lea rax, [rsp+1258h+var_8C8] mov [rsp+1258h+var_1230], rax jmp loc_1431 loc_122F: mov ecx, [rsp+1258h+var_1254] cmp ecx, 0FFFFFFFFh jz loc_13DB movsxd rdx, ecx lea rdx, [rdx+rdx*4] lea rdx, [rdx+rdx*4] shl rdx, 5 cmp [rsp+rdx+1258h+var_8C8], 0 jz short loc_128B movsxd rax, [rsp+1258h+var_1254] lea rax, [rax+rax*4] lea rdi, [rax+rax*4] shl rdi, 5 add rdi, [rsp+1258h+var_1230] mov edx, 1 loc_1271: mov eax, edx cmp qword ptr [rdi+rdx*8], 0 setnz sil cmp edx, 62h ; 'b' setle cl add rdx, 1 test sil, cl jnz short loc_1271 loc_128B: movsxd rsi, eax movsxd rdx, [rsp+1258h+var_1254] lea rdx, [rdx+rdx*4] lea rcx, ds:0[rdx*4] lea rdi, [rdx+rcx] lea rsi, [rsi+rdi*4] mov rdi, [r12] mov [rsp+rsi*8+1258h+var_8C8], rdi add eax, 1 cdqe add rdx, rcx lea rax, [rax+rdx*4] mov [rsp+rax*8+1258h+var_8C8], 0 jmp loc_141E loc_12D0: mov eax, 0 cmp r13d, [rsp+1258h+var_124C] jz short loc_1305 loc_12DC: mov rdx, [rsp+1258h+arg_12FB8] sub rdx, fs:28h jnz loc_14BF add rsp, 14228h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1305: mov eax, [rsp+1258h+var_1250] test eax, eax jle short loc_1377 lea r12, [rsp+1258h+var_8B8] lea eax, [rax-1] lea rax, [rax+rax*4] lea rax, [rax+rax*4] shl rax, 5 lea r13, [rsp+rax+1258h+var_598] loc_132C: mov rbp, [r12-10h] mov rsi, [r12-8] test rsi, rsi jz short loc_1357 mov rbx, r12 loc_133E: mov rdi, rbp call _strcmp test eax, eax jnz short loc_1381 add rbx, 8 mov rsi, [rbx-8] test rsi, rsi jnz short loc_133E loc_1357: add r12, 320h cmp r13, r12 jnz short loc_132C mov eax, 1 jmp loc_12DC loc_136D: mov eax, 1 jmp loc_12DC loc_1377: mov eax, 1 jmp loc_12DC loc_1381: mov eax, 0 jmp loc_12DC loc_138B: mov ecx, [rsp+1258h+var_124C] movsxd rax, ecx mov rdx, [r12] mov [rsp+rax*8+1258h+var_BE8], rdx lea eax, [rcx+1] mov [rsp+1258h+var_124C], eax loc_13A5: mov eax, [rsp+1258h+var_1250] test eax, eax jle short loc_13DB mov r14, [rbp+0] mov r15d, eax mov ebx, 0 loc_13B9: mov [rsp+1258h+var_1254], ebx mov rsi, [rsp+rbx*8+1258h+var_1228] mov rdi, r14 call _strcmp test eax, eax jz loc_122F add rbx, 1 cmp rbx, r15 jnz short loc_13B9 loc_13DB: mov edi, [rsp+1258h+var_1250] movsxd rax, edi mov rdx, [rbp+0] mov [rsp+rax*8+1258h+var_1228], rdx lea rax, [rax+rax*4] lea rcx, ds:0[rax*4] lea rdx, [rax+rcx] shl rdx, 5 mov rsi, [r12] mov [rsp+rdx+1258h+var_8C8], rsi mov [rsp+rdx+1258h+var_8C0], 0 add edi, 1 mov [rsp+1258h+var_1250], edi loc_141E: add rbp, 8 add r12, 8 cmp rbp, [rsp+1258h+var_1248] jz loc_12D0 loc_1431: test r13d, r13d jle short loc_1467 mov r14, [rbp+0] lea rbx, [rsp+1258h+var_F08] lea eax, [r13-1] mov rcx, [rsp+1258h+var_1240] lea r15, [rcx+rax*8] loc_144F: mov rsi, [rbx] mov rdi, r14 call _strcmp test eax, eax jz short loc_147A add rbx, 8 cmp rbx, r15 jnz short loc_144F loc_1467: movsxd rax, r13d mov rdx, [rbp+0] mov [rsp+rax*8+1258h+var_F08], rdx lea r13d, [r13+1] loc_147A: mov eax, [rsp+1258h+var_124C] test eax, eax jle loc_138B mov r14, [r12] lea rbx, [rsp+1258h+var_BE8] lea eax, [rax-1] mov rcx, [rsp+1258h+var_1238] lea r15, [rcx+rax*8] loc_149E: mov rsi, [rbx] mov rdi, r14 call _strcmp test eax, eax jz loc_13A5 add rbx, 8 cmp rbx, r15 jnz short loc_149E jmp loc_138B loc_14BF: call ___stack_chk_fail
// positive sp value has been detected, the output may be wrong! long long func0(_QWORD *a1, int a2, _QWORD *a3, int a4) { long long result; // rax _QWORD *v5; // rbp int v7; // r13d long long v8; // rdx int v9; // eax bool v10; // si bool v11; // cl long long v12; // rdx long long v13; // rcx _BYTE *v14; // r12 long long v15; // rbp _BYTE *v16; // rbx long long v17; // r14 long long v18; // rbx long long v19; // rdx long long v20; // r14 _BYTE *v21; // rbx long long v22; // r14 _BYTE *v23; // rbx int v24; // [rsp-220h] [rbp-14250h] int v25; // [rsp-21Ch] [rbp-1424Ch] long long v26; // [rsp-218h] [rbp-14248h] _QWORD v27[63]; // [rsp-1F8h] [rbp-14228h] char v28; // [rsp+0h] [rbp-14030h] BYREF _BYTE v29[800]; // [rsp+128h] [rbp-13F08h] BYREF _BYTE v30[816]; // [rsp+448h] [rbp-13BE8h] BYREF _BYTE v31[2184]; // [rsp+778h] [rbp-138B8h] BYREF _QWORD v32[9734]; // [rsp+1000h] [rbp-13030h] BYREF while ( &v28 != (char *)&v32[-10240] ) ; v32[9726] = __readfsqword(0x28u); result = 0LL; if ( a2 == a4 ) { if ( a4 <= 0 ) { return 1LL; } else { v5 = a3; v26 = (long long)&a3[(unsigned int)(a4 - 1) + 1]; v25 = 0; v7 = 0; v24 = 0; do { if ( v7 <= 0 ) { LABEL_34: *(_QWORD *)&v29[8 * v7++] = *v5; } else { v20 = *v5; v21 = v29; while ( (unsigned int)((long long ( *)(long long, _QWORD))strcmp)(v20, *(_QWORD *)v21) ) { v21 += 8; if ( v21 == &v29[8 * (v7 - 1) + 8] ) goto LABEL_34; } } if ( v25 <= 0 ) { LABEL_23: *(_QWORD *)&v30[8 * v25++] = *a1; } else { v22 = *a1; v23 = v30; while ( (unsigned int)((long long ( *)(long long, _QWORD))strcmp)(v22, *(_QWORD *)v23) ) { v23 += 8; if ( v23 == &v30[8 * (v25 - 1) + 8] ) goto LABEL_23; } } if ( v24 <= 0 ) goto LABEL_28; v17 = *v5; v18 = 0LL; while ( 1 ) { v9 = ((long long ( *)(long long, _QWORD))strcmp)(v17, v27[v18]); if ( !v9 ) break; if ( ++v18 == v24 ) goto LABEL_28; } if ( (_DWORD)v18 == -1 ) { LABEL_28: v27[v24] = *v5; v19 = 800LL * v24; *(_QWORD *)&v30[v19 + 800] = *a1; *(_QWORD *)&v30[v19 + 808] = 0LL; ++v24; } else { if ( *(_QWORD *)&v30[800 * (int)v18 + 800] ) { v8 = 1LL; do { v9 = v8; v10 = *(_QWORD *)&v30[800 * (int)v18 + 800 + 8 * v8] != 0LL; v11 = (int)v8++ <= 98; } while ( v11 && v10 ); } v12 = 5LL * (int)v18; v13 = 20LL * (int)v18; *(_QWORD *)&v30[32 * v12 + 800 + 32 * v13 + 8 * v9] = *a1; *(_QWORD *)&v30[32 * v13 + 808 + 32 * v12 + 8 * v9] = 0LL; } ++v5; ++a1; } while ( v5 != (_QWORD *)v26 ); result = 0LL; if ( v7 == v25 ) { if ( v24 <= 0 ) { return 1LL; } else { v14 = v31; while ( 1 ) { v15 = *((_QWORD *)v14 - 2); if ( *((_QWORD *)v14 - 1) ) break; LABEL_18: v14 += 800; if ( &v31[800 * (v24 - 1) + 800] == v14 ) return 1LL; } v16 = v14; while ( !(unsigned int)((long long ( *)(long long))strcmp)(v15) ) { v16 += 8; if ( !*((_QWORD *)v16 - 1) ) goto LABEL_18; } return 0LL; } } } } return result; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX LEA R11,[RSP + -0x14000] LAB_0010119f: SUB RSP,0x1000 OR qword ptr [RSP],0x0 CMP RSP,R11 JNZ 0x0010119f SUB RSP,0x228 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x14218],RAX XOR EAX,EAX CMP ESI,ECX JNZ 0x001012dc TEST ECX,ECX JLE 0x0010136d MOV RBP,RDX MOV R12,RDI LEA EAX,[RCX + -0x1] LEA RAX,[RDX + RAX*0x8 + 0x8] MOV qword ptr [RSP + 0x10],RAX MOV dword ptr [RSP + 0xc],0x0 MOV R13D,0x0 MOV dword ptr [RSP + 0x8],0x0 LEA RAX,[RSP + 0x358] MOV qword ptr [RSP + 0x18],RAX LEA RAX,[RSP + 0x678] MOV qword ptr [RSP + 0x20],RAX LEA RAX,[RSP + 0x990] MOV qword ptr [RSP + 0x28],RAX JMP 0x00101431 LAB_0010122f: MOV ECX,dword ptr [RSP + 0x4] CMP ECX,-0x1 JZ 0x001013db MOVSXD RDX,ECX LEA RDX,[RDX + RDX*0x4] LEA RDX,[RDX + RDX*0x4] SHL RDX,0x5 CMP qword ptr [RSP + RDX*0x1 + 0x990],0x0 JZ 0x0010128b MOVSXD RAX,dword ptr [RSP + 0x4] LEA RAX,[RAX + RAX*0x4] LEA RDI,[RAX + RAX*0x4] SHL RDI,0x5 ADD RDI,qword ptr [RSP + 0x28] MOV EDX,0x1 LAB_00101271: MOV EAX,EDX CMP qword ptr [RDI + RDX*0x8],0x0 SETNZ SIL CMP EDX,0x62 SETLE CL ADD RDX,0x1 TEST SIL,CL JNZ 0x00101271 LAB_0010128b: MOVSXD RSI,EAX MOVSXD RDX,dword ptr [RSP + 0x4] LEA RDX,[RDX + RDX*0x4] LEA RCX,[RDX*0x4] LEA RDI,[RDX + RCX*0x1] LEA RSI,[RSI + RDI*0x4] MOV RDI,qword ptr [R12] MOV qword ptr [RSP + RSI*0x8 + 0x990],RDI ADD EAX,0x1 CDQE ADD RDX,RCX LEA RAX,[RAX + RDX*0x4] MOV qword ptr [RSP + RAX*0x8 + 0x990],0x0 JMP 0x0010141e LAB_001012d0: MOV EAX,0x0 CMP R13D,dword ptr [RSP + 0xc] JZ 0x00101305 LAB_001012dc: MOV RDX,qword ptr [RSP + 0x14218] SUB RDX,qword ptr FS:[0x28] JNZ 0x001014bf ADD RSP,0x14228 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101305: MOV EAX,dword ptr [RSP + 0x8] TEST EAX,EAX JLE 0x00101377 LEA R12,[RSP + 0x9a0] LEA EAX,[RAX + -0x1] LEA RAX,[RAX + RAX*0x4] LEA RAX,[RAX + RAX*0x4] SHL RAX,0x5 LEA R13,[RSP + RAX*0x1 + 0xcc0] LAB_0010132c: MOV RBP,qword ptr [R12 + -0x10] MOV RSI,qword ptr [R12 + -0x8] TEST RSI,RSI JZ 0x00101357 MOV RBX,R12 LAB_0010133e: MOV RDI,RBP CALL 0x00101090 TEST EAX,EAX JNZ 0x00101381 ADD RBX,0x8 MOV RSI,qword ptr [RBX + -0x8] TEST RSI,RSI JNZ 0x0010133e LAB_00101357: ADD R12,0x320 CMP R13,R12 JNZ 0x0010132c MOV EAX,0x1 JMP 0x001012dc LAB_0010136d: MOV EAX,0x1 JMP 0x001012dc LAB_00101377: MOV EAX,0x1 JMP 0x001012dc LAB_00101381: MOV EAX,0x0 JMP 0x001012dc LAB_0010138b: MOV ECX,dword ptr [RSP + 0xc] MOVSXD RAX,ECX MOV RDX,qword ptr [R12] MOV qword ptr [RSP + RAX*0x8 + 0x670],RDX LEA EAX,[RCX + 0x1] MOV dword ptr [RSP + 0xc],EAX LAB_001013a5: MOV EAX,dword ptr [RSP + 0x8] TEST EAX,EAX JLE 0x001013db MOV R14,qword ptr [RBP] MOV R15D,EAX MOV EBX,0x0 LAB_001013b9: MOV dword ptr [RSP + 0x4],EBX MOV RSI,qword ptr [RSP + RBX*0x8 + 0x30] MOV RDI,R14 CALL 0x00101090 TEST EAX,EAX JZ 0x0010122f ADD RBX,0x1 CMP RBX,R15 JNZ 0x001013b9 LAB_001013db: MOV EDI,dword ptr [RSP + 0x8] MOVSXD RAX,EDI MOV RDX,qword ptr [RBP] MOV qword ptr [RSP + RAX*0x8 + 0x30],RDX LEA RAX,[RAX + RAX*0x4] LEA RCX,[RAX*0x4] LEA RDX,[RAX + RCX*0x1] SHL RDX,0x5 MOV RSI,qword ptr [R12] MOV qword ptr [RSP + RDX*0x1 + 0x990],RSI MOV qword ptr [RSP + RDX*0x1 + 0x998],0x0 ADD EDI,0x1 MOV dword ptr [RSP + 0x8],EDI LAB_0010141e: ADD RBP,0x8 ADD R12,0x8 CMP RBP,qword ptr [RSP + 0x10] JZ 0x001012d0 LAB_00101431: TEST R13D,R13D JLE 0x00101467 MOV R14,qword ptr [RBP] LEA RBX,[RSP + 0x350] LEA EAX,[R13 + -0x1] MOV RCX,qword ptr [RSP + 0x18] LEA R15,[RCX + RAX*0x8] LAB_0010144f: MOV RSI,qword ptr [RBX] MOV RDI,R14 CALL 0x00101090 TEST EAX,EAX JZ 0x0010147a ADD RBX,0x8 CMP RBX,R15 JNZ 0x0010144f LAB_00101467: MOVSXD RAX,R13D MOV RDX,qword ptr [RBP] MOV qword ptr [RSP + RAX*0x8 + 0x350],RDX LEA R13D,[R13 + 0x1] LAB_0010147a: MOV EAX,dword ptr [RSP + 0xc] TEST EAX,EAX JLE 0x0010138b MOV R14,qword ptr [R12] LEA RBX,[RSP + 0x670] LEA EAX,[RAX + -0x1] MOV RCX,qword ptr [RSP + 0x20] LEA R15,[RCX + RAX*0x8] LAB_0010149e: MOV RSI,qword ptr [RBX] MOV RDI,R14 CALL 0x00101090 TEST EAX,EAX JZ 0x001013a5 ADD RBX,0x8 CMP RBX,R15 JNZ 0x0010149e JMP 0x0010138b LAB_001014bf: CALL 0x00101070
int8 func0(int8 *param_1,int param_2,int8 *param_3,int param_4) { long lVar1; uint uVar2; char *pcVar3; char *pcVar4; int8 *puVar5; int1 *puVar6; int iVar7; int iVar8; int8 uVar9; long lVar10; ulong uVar11; int8 *puVar12; int1 *puVar13; int iVar14; long in_FS_OFFSET; int1 auStack_14030 [81920]; puVar6 = &stack0xffffffffffffffd0; do { puVar13 = puVar6; *(int8 *)(puVar13 + -0x1000) = *(int8 *)(puVar13 + -0x1000); puVar6 = puVar13 + -0x1000; } while (puVar13 + -0x1000 != auStack_14030); *(int8 *)(puVar13 + 0x12ff0) = *(int8 *)(in_FS_OFFSET + 0x28); uVar9 = 0; if (param_2 == param_4) { if (param_4 < 1) { uVar9 = 1; } else { *(int8 **)(puVar13 + -0x1218) = param_3 + (ulong)(param_4 - 1) + 1; *(int4 *)(puVar13 + -0x121c) = 0; iVar14 = 0; *(int4 *)(puVar13 + -0x1220) = 0; *(int1 **)(puVar13 + -0x1210) = puVar13 + -0xed0; *(int1 **)(puVar13 + -0x1208) = puVar13 + -0xbb0; *(int1 **)(puVar13 + -0x1200) = puVar13 + -0x898; do { if (0 < iVar14) { pcVar3 = (char *)*param_3; puVar12 = (int8 *)(puVar13 + -0xed8); lVar10 = *(long *)(puVar13 + -0x1210); do { pcVar4 = (char *)*puVar12; *(int8 *)(puVar13 + -0x1230) = 0x10145a; iVar7 = strcmp(pcVar3,pcVar4); if (iVar7 == 0) goto LAB_0010147a; puVar12 = puVar12 + 1; } while (puVar12 != (int8 *)(lVar10 + (ulong)(iVar14 - 1) * 8)); } *(int8 *)(puVar13 + (long)iVar14 * 8 + -0xed8) = *param_3; iVar14 = iVar14 + 1; LAB_0010147a: iVar7 = *(int *)(puVar13 + -0x121c); if (0 < iVar7) { pcVar3 = (char *)*param_1; puVar12 = (int8 *)(puVar13 + -3000); lVar10 = *(long *)(puVar13 + -0x1208); do { pcVar4 = (char *)*puVar12; *(int8 *)(puVar13 + -0x1230) = 0x1014a9; iVar8 = strcmp(pcVar3,pcVar4); if (iVar8 == 0) goto LAB_001013a5; puVar12 = puVar12 + 1; } while (puVar12 != (int8 *)(lVar10 + (ulong)(iVar7 - 1) * 8)); } iVar7 = *(int *)(puVar13 + -0x121c); *(int8 *)(puVar13 + (long)iVar7 * 8 + -3000) = *param_1; *(int *)(puVar13 + -0x121c) = iVar7 + 1; LAB_001013a5: uVar2 = *(uint *)(puVar13 + -0x1220); if (0 < (int)uVar2) { pcVar3 = (char *)*param_3; uVar11 = 0; LAB_001013b9: *(int *)(puVar13 + -0x1224) = (int)uVar11; pcVar4 = *(char **)(puVar13 + uVar11 * 8 + -0x11f8); *(int8 *)(puVar13 + -0x1230) = 0x1013ca; iVar7 = strcmp(pcVar3,pcVar4); if (iVar7 != 0) goto code_r0x001013d2; if (*(int *)(puVar13 + -0x1224) != -1) { iVar7 = 0; if (*(long *)(puVar13 + (long)*(int *)(puVar13 + -0x1224) * 800 + -0x898) != 0) { lVar10 = 1; do { iVar7 = (int)lVar10; lVar1 = lVar10 * 8; lVar10 = lVar10 + 1; } while (*(long *)((long)*(int *)(puVar13 + -0x1224) * 800 + *(long *)(puVar13 + -0x1200) + lVar1) != 0 && iVar7 < 99); } iVar8 = *(int *)(puVar13 + -0x1224); *(int8 *)(puVar13 + (long)iVar7 * 8 + (long)iVar8 * 800 + -0x898) = *param_1; *(int8 *)(puVar13 + (long)(iVar7 + 1) * 8 + (long)iVar8 * 800 + -0x898) = 0; goto LAB_0010141e; } } LAB_001013db: iVar7 = *(int *)(puVar13 + -0x1220); *(int8 *)(puVar13 + (long)iVar7 * 8 + -0x11f8) = *param_3; lVar10 = (long)iVar7 * 800; *(int8 *)(puVar13 + lVar10 + -0x898) = *param_1; *(int8 *)(puVar13 + lVar10 + -0x890) = 0; *(int *)(puVar13 + -0x1220) = iVar7 + 1; LAB_0010141e: param_3 = param_3 + 1; param_1 = param_1 + 1; } while (param_3 != *(int8 **)(puVar13 + -0x1218)); uVar9 = 0; if (iVar14 == *(int *)(puVar13 + -0x121c)) { iVar14 = *(int *)(puVar13 + -0x1220); if (iVar14 < 1) { uVar9 = 1; } else { puVar12 = (int8 *)(puVar13 + -0x888); do { pcVar3 = (char *)puVar12[-2]; pcVar4 = (char *)puVar12[-1]; puVar5 = puVar12; while (pcVar4 != (char *)0x0) { *(int8 *)(puVar13 + -0x1230) = 0x101346; iVar7 = strcmp(pcVar3,pcVar4); if (iVar7 != 0) { uVar9 = 0; goto LAB_001012dc; } pcVar4 = (char *)*puVar5; puVar5 = puVar5 + 1; } puVar12 = puVar12 + 100; } while ((int8 *)(puVar13 + (ulong)(iVar14 - 1) * 800 + -0x568) != puVar12); uVar9 = 1; } } } } LAB_001012dc: if (*(long *)(puVar13 + 0x12ff0) == *(long *)(in_FS_OFFSET + 0x28)) { return uVar9; } /* WARNING: Subroutine does not return */ *(code **)(puVar13 + -0x1230) = main; __stack_chk_fail(); code_r0x001013d2: uVar11 = uVar11 + 1; if (uVar11 == uVar2) goto LAB_001013db; goto LAB_001013b9; }
4,190
func0
#include <stdio.h> #include <stdbool.h> #include <string.h> #include <assert.h>
bool func0(char** colors, int colors_len, char** patterns, int patterns_len){ if (colors_len != patterns_len){ return false; } // Initialize sdict as arrays: patterns and for each pattern, a list of colors. // Also pset and sset // To keep it simple, define max unique patterns and colors as 100 char* sdict_keys[100]; char* sdict_values[100][100]; // sdict_values[i][j] int sdict_size = 0; char* pset[100]; int pset_size = 0; char* sset[100]; int sset_size = 0; for(int i = 0; i < patterns_len; i++) { // Add to pset if not present bool found = false; for(int j = 0; j < pset_size; j++) { if(strcmp(patterns[i], pset[j]) == 0){ found = true; break; } } if (!found){ pset[pset_size++] = patterns[i]; } // Add to sset if not present found = false; for(int j = 0; j < sset_size; j++) { if(strcmp(colors[i], sset[j]) == 0){ found = true; break; } } if (!found){ sset[sset_size++] = colors[i]; } // Add color to sdict // Find if pattern exists in sdict_keys int pattern_index = -1; for(int j = 0; j < sdict_size; j++){ if(strcmp(patterns[i], sdict_keys[j]) == 0){ pattern_index = j; break; } } if(pattern_index == -1){ // Add new pattern key sdict_keys[sdict_size] = patterns[i]; sdict_values[sdict_size][0] = colors[i]; sdict_values[sdict_size][1] = NULL; sdict_size++; } else{ // Append color to existing list int k = 0; while(sdict_values[pattern_index][k] != NULL && k < 99){ k++; } sdict_values[pattern_index][k] = colors[i]; sdict_values[pattern_index][k+1] = NULL; } } if(pset_size != sset_size){ return false; } // Now, for each list in sdict_values, check all colors are same for(int i = 0; i < sdict_size; i++){ char* first_color = sdict_values[i][0]; for(int j = 1; sdict_values[i][j] != NULL; j++){ if(strcmp(first_color, sdict_values[i][j]) != 0){ return false; } } } return true; }
int main(){ char* colors1[] = {"red", "green", "green"}; char* patterns1[] = {"a", "b", "b"}; assert(func0(colors1, 3, patterns1, 3) == true); char* colors2[] = {"red", "green", "greenn"}; char* patterns2[] = {"a", "b", "b"}; assert(func0(colors2, 3, patterns2, 3) == false); char* colors3[] = {"red", "green", "greenn"}; char* patterns3[] = {"a", "b"}; assert(func0(colors3, 3, patterns3, 2) == false); return 0; }
O2
c
func0: endbr64 mov %esi,%r8d mov %rdx,%rsi cmp %ecx,%r8d jne 1630 <func0+0x20> mov %r8d,%edx jmpq 12a0 <func0.part.0> nopw 0x0(%rax,%rax,1) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0_part_0: push r15 push r14 push r13 push r12 push rbp push rbx lea r11, [rsp+30h+var_14030] loc_12B2: sub rsp, 1000h or [rsp+1030h+var_1030], 0 cmp rsp, r11 jnz short loc_12B2 sub rsp, 238h mov rax, fs:28h mov [rsp+1268h+arg_12FB8], rax xor eax, eax test edx, edx jle loc_15C9 lea eax, [rdx-1] mov [rsp+1268h+var_1268], rsi lea rax, [rsi+rax*8+8] mov [rsp+1268h+var_1250], rdi mov [rsp+1268h+var_1248], rax lea rax, [rsp+1268h+var_F00] mov [rsp+1268h+var_1240], rax lea rax, [rsp+1268h+var_BE0] mov [rsp+1268h+var_1238], rax lea rax, [rsp+1268h+var_8C8] mov [rsp+1268h+var_1258], 0 mov [rsp+1268h+var_1254], 0 mov [rsp+1268h+var_125C], 0 mov [rsp+1268h+var_1230], rax nop word ptr [rax+rax+00h] loc_1340: mov rax, [rsp+1268h+var_1268] mov rbx, [rax] mov eax, [rsp+1268h+var_125C] test eax, eax jz loc_15A0 mov eax, [rsp+1268h+var_125C] mov rcx, [rsp+1268h+var_1240] lea r12, [rsp+1268h+var_F08] sub eax, 1 lea rbp, [rcx+rax*8] jmp short loc_137D loc_1370: add r12, 8 cmp r12, rbp jz loc_15A0 loc_137D: mov rsi, [r12] mov rdi, rbx call _strcmp test eax, eax jnz short loc_1370 loc_138D: mov rax, [rsp+1268h+var_1250] mov r12, [rax] mov eax, [rsp+1268h+var_1254] test eax, eax jz loc_1580 mov rcx, [rsp+1268h+var_1238] sub eax, 1 lea r13, [rsp+1268h+var_BE8] lea rbp, [rcx+rax*8] jmp short loc_13CD loc_13C0: add r13, 8 cmp r13, rbp jz loc_1580 loc_13CD: mov rsi, [r13+0] mov rdi, r12 call _strcmp test eax, eax jnz short loc_13C0 loc_13DD: mov edx, [rsp+1268h+var_1258] xor r13d, r13d test edx, edx jz loc_1550 movsxd r13, [rsp+1268h+var_1258] xor r14d, r14d lea r15, [rsp+1268h+var_1228] jmp short loc_140D loc_1400: add r14, 1 cmp r14, r13 jz loc_1550 loc_140D: mov rsi, [r15+r14*8] mov rdi, rbx movsxd rbp, r14d call _strcmp test eax, eax jnz short loc_1400 lea rdx, [rbp+rbp*4+0] mov rcx, [rsp+1268h+var_1230] lea rsi, [rdx+rdx*4] mov edx, 1 shl rsi, 5 add rcx, rsi cmp [rsp+rsi+1268h+var_8C8], 0 jnz short loc_145E jmp loc_15E2 loc_1450: add rdx, 1 cmp rdx, 64h ; 'd' jz loc_15D3 loc_145E: cmp qword ptr [rcx+rdx*8], 0 mov eax, edx jnz short loc_1450 lea ecx, [rdx+1] loc_146A: lea rdx, [rbp+rbp*4+0] cdqe lea rdx, [rdx+rdx*4] shl rdx, 2 add rax, rdx mov [rsp+rax*8+1268h+var_8C8], r12 movsxd rax, ecx add rdx, rax mov [rsp+rdx*8+1268h+var_8C8], 0 loc_1496: add [rsp+1268h+var_1268], 8 mov rax, [rsp+1268h+var_1268] add [rsp+1268h+var_1250], 8 cmp rax, [rsp+1268h+var_1248] jnz loc_1340 mov edi, [rsp+1268h+var_1254] xor eax, eax cmp [rsp+1268h+var_125C], edi jnz short loc_151E mov eax, [rsp+1268h+var_1258] lea r12, [rsp+1268h+var_8B8] sub eax, 1 lea rax, [rax+rax*4] lea rax, [rax+rax*4] shl rax, 5 lea r13, [rsp+rax+1268h+var_598] loc_14DF: mov rsi, [r12-8] mov rbp, [r12-10h] test rsi, rsi jz loc_15B9 mov rbx, r12 jmp short loc_1510 loc_1500: mov rsi, [rbx] add rbx, 8 test rsi, rsi jz loc_15B9 loc_1510: mov rdi, rbp call _strcmp test eax, eax jz short loc_1500 xor eax, eax loc_151E: mov rdx, [rsp+1268h+arg_12FB8] sub rdx, fs:28h jnz loc_15EC add rsp, 14238h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1550: lea rax, [r13+r13*4+0] add [rsp+1268h+var_1258], 1 lea rax, [rax+rax*4] mov [rsp+r13*8+1268h+var_1228], rbx shl rax, 5 mov [rsp+rax+1268h+var_8C8], r12 mov [rsp+rax+1268h+var_8C0], 0 jmp loc_1496 loc_1580: movsxd rax, [rsp+1268h+var_1254] mov [rsp+rax*8+1268h+var_BE8], r12 lea eax, [rax+1] mov [rsp+1268h+var_1254], eax jmp loc_13DD loc_15A0: movsxd rax, [rsp+1268h+var_125C] mov [rsp+rax*8+1268h+var_F08], rbx lea eax, [rax+1] mov [rsp+1268h+var_125C], eax jmp loc_138D loc_15B9: add r12, 320h cmp r12, r13 jnz loc_14DF loc_15C9: mov eax, 1 jmp loc_151E loc_15D3: mov ecx, 64h ; 'd' mov eax, 63h ; 'c' jmp loc_146A loc_15E2: mov ecx, 1 jmp loc_146A loc_15EC: call ___stack_chk_fail
// positive sp value has been detected, the output may be wrong! long long func0_part_0(long long *a1, long long *a2, int a3) { long long v3; // rbx _BYTE *v4; // r12 long long v5; // r12 _BYTE *v6; // r13 long long v7; // r13 long long v8; // r14 int v9; // eax long long v10; // rdx long long result; // rax _BYTE *v12; // r12 long long v13; // rbp _QWORD *v14; // rbx long long v16; // rax int v17; // ecx long long *v18; // [rsp-238h] [rbp-14268h] int v19; // [rsp-22Ch] [rbp-1425Ch] int v20; // [rsp-228h] [rbp-14258h] int v21; // [rsp-224h] [rbp-14254h] long long v23; // [rsp-218h] [rbp-14248h] _QWORD v24[63]; // [rsp-1F8h] [rbp-14228h] char v25; // [rsp+0h] [rbp-14030h] BYREF _BYTE v26[800]; // [rsp+128h] [rbp-13F08h] BYREF _BYTE v27[816]; // [rsp+448h] [rbp-13BE8h] BYREF _BYTE v28[2184]; // [rsp+778h] [rbp-138B8h] BYREF _QWORD v29[9734]; // [rsp+1000h] [rbp-13030h] BYREF while ( &v25 != (char *)&v29[-10240] ) ; v29[9726] = __readfsqword(0x28u); if ( a3 <= 0 ) return 1LL; v18 = a2; v23 = (long long)&a2[(unsigned int)(a3 - 1) + 1]; v20 = 0; v21 = 0; v19 = 0; do { v3 = *v18; if ( v19 ) { v4 = v26; while ( (unsigned int)((long long ( *)(long long, _QWORD))strcmp)(v3, *(_QWORD *)v4) ) { v4 += 8; if ( v4 == &v26[8 * (v19 - 1) + 8] ) goto LABEL_33; } } else { LABEL_33: *(_QWORD *)&v26[8 * v19++] = v3; } v5 = *a1; if ( v21 ) { v6 = v27; while ( (unsigned int)((long long ( *)(long long, _QWORD))strcmp)(v5, *(_QWORD *)v6) ) { v6 += 8; if ( v6 == &v27[8 * (v21 - 1) + 8] ) goto LABEL_32; } } else { LABEL_32: *(_QWORD *)&v27[8 * v21++] = v5; } v7 = 0LL; if ( v20 ) { v7 = v20; v8 = 0LL; while ( 1 ) { v9 = ((long long ( *)(long long, _QWORD))strcmp)(v3, v24[v8]); if ( !v9 ) break; if ( ++v8 == v20 ) goto LABEL_31; } v10 = 1LL; if ( *(_QWORD *)&v27[800 * (int)v8 + 800] ) { do { v9 = v10; if ( !*(_QWORD *)&v27[800 * (int)v8 + 800 + 8 * v10] ) { v17 = v10 + 1; goto LABEL_21; } ++v10; } while ( v10 != 100 ); v17 = 100; v9 = 99; } else { v17 = 1; } LABEL_21: *(_QWORD *)&v27[800 * (int)v8 + 800 + 8 * v9] = v5; *(_QWORD *)&v27[800 * (int)v8 + 800 + 8 * v17] = 0LL; } else { LABEL_31: ++v20; v24[v7] = v3; v16 = 800 * v7; *(_QWORD *)&v27[v16 + 800] = v5; *(_QWORD *)&v27[v16 + 808] = 0LL; } ++v18; ++a1; } while ( v18 != (long long *)v23 ); result = 0LL; if ( v19 == v21 ) { v12 = v28; while ( 1 ) { v13 = *((_QWORD *)v12 - 2); if ( *((_QWORD *)v12 - 1) ) break; LABEL_34: v12 += 800; if ( v12 == &v28[800 * (v20 - 1) + 800] ) return 1LL; } v14 = v12; while ( !(unsigned int)((long long ( *)(long long))strcmp)(v13) ) { if ( !*v14++ ) goto LABEL_34; } return 0LL; } return result; }
func0.part.0: PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX LEA R11,[RSP + -0x14000] LAB_001012b2: SUB RSP,0x1000 OR qword ptr [RSP],0x0 CMP RSP,R11 JNZ 0x001012b2 SUB RSP,0x238 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x14228],RAX XOR EAX,EAX TEST EDX,EDX JLE 0x001015c9 LEA EAX,[RDX + -0x1] MOV qword ptr [RSP],RSI LEA RAX,[RSI + RAX*0x8 + 0x8] MOV qword ptr [RSP + 0x18],RDI MOV qword ptr [RSP + 0x20],RAX LEA RAX,[RSP + 0x368] MOV qword ptr [RSP + 0x28],RAX LEA RAX,[RSP + 0x688] MOV qword ptr [RSP + 0x30],RAX LEA RAX,[RSP + 0x9a0] MOV dword ptr [RSP + 0x10],0x0 MOV dword ptr [RSP + 0x14],0x0 MOV dword ptr [RSP + 0xc],0x0 MOV qword ptr [RSP + 0x38],RAX NOP word ptr [RAX + RAX*0x1] LAB_00101340: MOV RAX,qword ptr [RSP] MOV RBX,qword ptr [RAX] MOV EAX,dword ptr [RSP + 0xc] TEST EAX,EAX JZ 0x001015a0 MOV EAX,dword ptr [RSP + 0xc] MOV RCX,qword ptr [RSP + 0x28] LEA R12,[RSP + 0x360] SUB EAX,0x1 LEA RBP,[RCX + RAX*0x8] JMP 0x0010137d LAB_00101370: ADD R12,0x8 CMP R12,RBP JZ 0x001015a0 LAB_0010137d: MOV RSI,qword ptr [R12] MOV RDI,RBX CALL 0x00101090 TEST EAX,EAX JNZ 0x00101370 LAB_0010138d: MOV RAX,qword ptr [RSP + 0x18] MOV R12,qword ptr [RAX] MOV EAX,dword ptr [RSP + 0x14] TEST EAX,EAX JZ 0x00101580 MOV RCX,qword ptr [RSP + 0x30] SUB EAX,0x1 LEA R13,[RSP + 0x680] LEA RBP,[RCX + RAX*0x8] JMP 0x001013cd LAB_001013c0: ADD R13,0x8 CMP R13,RBP JZ 0x00101580 LAB_001013cd: MOV RSI,qword ptr [R13] MOV RDI,R12 CALL 0x00101090 TEST EAX,EAX JNZ 0x001013c0 LAB_001013dd: MOV EDX,dword ptr [RSP + 0x10] XOR R13D,R13D TEST EDX,EDX JZ 0x00101550 MOVSXD R13,dword ptr [RSP + 0x10] XOR R14D,R14D LEA R15,[RSP + 0x40] JMP 0x0010140d LAB_00101400: ADD R14,0x1 CMP R14,R13 JZ 0x00101550 LAB_0010140d: MOV RSI,qword ptr [R15 + R14*0x8] MOV RDI,RBX MOVSXD RBP,R14D CALL 0x00101090 TEST EAX,EAX JNZ 0x00101400 LEA RDX,[RBP + RBP*0x4] MOV RCX,qword ptr [RSP + 0x38] LEA RSI,[RDX + RDX*0x4] MOV EDX,0x1 SHL RSI,0x5 ADD RCX,RSI CMP qword ptr [RSP + RSI*0x1 + 0x9a0],0x0 JNZ 0x0010145e JMP 0x001015e2 LAB_00101450: ADD RDX,0x1 CMP RDX,0x64 JZ 0x001015d3 LAB_0010145e: CMP qword ptr [RCX + RDX*0x8],0x0 MOV EAX,EDX JNZ 0x00101450 LEA ECX,[RDX + 0x1] LAB_0010146a: LEA RDX,[RBP + RBP*0x4] CDQE LEA RDX,[RDX + RDX*0x4] SHL RDX,0x2 ADD RAX,RDX MOV qword ptr [RSP + RAX*0x8 + 0x9a0],R12 MOVSXD RAX,ECX ADD RDX,RAX MOV qword ptr [RSP + RDX*0x8 + 0x9a0],0x0 LAB_00101496: ADD qword ptr [RSP],0x8 MOV RAX,qword ptr [RSP] ADD qword ptr [RSP + 0x18],0x8 CMP RAX,qword ptr [RSP + 0x20] JNZ 0x00101340 MOV EDI,dword ptr [RSP + 0x14] XOR EAX,EAX CMP dword ptr [RSP + 0xc],EDI JNZ 0x0010151e MOV EAX,dword ptr [RSP + 0x10] LEA R12,[RSP + 0x9b0] SUB EAX,0x1 LEA RAX,[RAX + RAX*0x4] LEA RAX,[RAX + RAX*0x4] SHL RAX,0x5 LEA R13,[RSP + RAX*0x1 + 0xcd0] LAB_001014df: MOV RSI,qword ptr [R12 + -0x8] MOV RBP,qword ptr [R12 + -0x10] TEST RSI,RSI JZ 0x001015b9 MOV RBX,R12 JMP 0x00101510 LAB_00101500: MOV RSI,qword ptr [RBX] ADD RBX,0x8 TEST RSI,RSI JZ 0x001015b9 LAB_00101510: MOV RDI,RBP CALL 0x00101090 TEST EAX,EAX JZ 0x00101500 XOR EAX,EAX LAB_0010151e: MOV RDX,qword ptr [RSP + 0x14228] SUB RDX,qword ptr FS:[0x28] JNZ 0x001015ec ADD RSP,0x14238 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101550: LEA RAX,[R13 + R13*0x4] ADD dword ptr [RSP + 0x10],0x1 LEA RAX,[RAX + RAX*0x4] MOV qword ptr [RSP + R13*0x8 + 0x40],RBX SHL RAX,0x5 MOV qword ptr [RSP + RAX*0x1 + 0x9a0],R12 MOV qword ptr [RSP + RAX*0x1 + 0x9a8],0x0 JMP 0x00101496 LAB_00101580: MOVSXD RAX,dword ptr [RSP + 0x14] MOV qword ptr [RSP + RAX*0x8 + 0x680],R12 LEA EAX,[RAX + 0x1] MOV dword ptr [RSP + 0x14],EAX JMP 0x001013dd LAB_001015a0: MOVSXD RAX,dword ptr [RSP + 0xc] MOV qword ptr [RSP + RAX*0x8 + 0x360],RBX LEA EAX,[RAX + 0x1] MOV dword ptr [RSP + 0xc],EAX JMP 0x0010138d LAB_001015b9: ADD R12,0x320 CMP R12,R13 JNZ 0x001014df LAB_001015c9: MOV EAX,0x1 JMP 0x0010151e LAB_001015d3: MOV ECX,0x64 MOV EAX,0x63 JMP 0x0010146a LAB_001015e2: MOV ECX,0x1 JMP 0x0010146a LAB_001015ec: CALL 0x00101070
int8 func0_part_0(int8 param_1,long param_2,int param_3) { char *pcVar1; char *pcVar2; char *pcVar3; int8 *puVar4; int1 *puVar5; int iVar6; int iVar7; int8 uVar8; int1 *puVar9; long lVar10; int8 *puVar11; long lVar12; long lVar13; long in_FS_OFFSET; int1 auStack_14030 [81920]; puVar5 = &stack0xffffffffffffffd0; do { puVar9 = puVar5; *(int8 *)(puVar9 + -0x1000) = *(int8 *)(puVar9 + -0x1000); puVar5 = puVar9 + -0x1000; } while (puVar9 + -0x1000 != auStack_14030); *(int8 *)(puVar9 + 0x12ff0) = *(int8 *)(in_FS_OFFSET + 0x28); if (0 < param_3) { *(long *)(puVar9 + -0x1238) = param_2; *(int8 *)(puVar9 + -0x1220) = param_1; *(ulong *)(puVar9 + -0x1218) = param_2 + 8 + (ulong)(param_3 - 1) * 8; *(int1 **)(puVar9 + -0x1210) = puVar9 + -0xed0; *(int1 **)(puVar9 + -0x1208) = puVar9 + -0xbb0; *(int4 *)(puVar9 + -0x1228) = 0; *(int4 *)(puVar9 + -0x1224) = 0; *(int4 *)(puVar9 + -0x122c) = 0; *(int1 **)(puVar9 + -0x1200) = puVar9 + -0x898; LAB_00101340: pcVar1 = (char *)**(int8 **)(puVar9 + -0x1238); if (*(int *)(puVar9 + -0x122c) != 0) { iVar7 = *(int *)(puVar9 + -0x122c); lVar12 = *(long *)(puVar9 + -0x1210); puVar11 = (int8 *)(puVar9 + -0xed8); do { pcVar2 = (char *)*puVar11; *(int8 *)(puVar9 + -0x1240) = 0x101389; iVar6 = strcmp(pcVar1,pcVar2); if (iVar6 == 0) goto LAB_0010138d; puVar11 = puVar11 + 1; } while (puVar11 != (int8 *)(lVar12 + (ulong)(iVar7 - 1) * 8)); } iVar7 = *(int *)(puVar9 + -0x122c); *(char **)(puVar9 + (long)iVar7 * 8 + -0xed8) = pcVar1; *(int *)(puVar9 + -0x122c) = iVar7 + 1; LAB_0010138d: pcVar2 = (char *)**(int8 **)(puVar9 + -0x1220); iVar7 = *(int *)(puVar9 + -0x1224); if (iVar7 != 0) { lVar12 = *(long *)(puVar9 + -0x1208); puVar11 = (int8 *)(puVar9 + -3000); do { pcVar3 = (char *)*puVar11; *(int8 *)(puVar9 + -0x1240) = 0x1013d9; iVar6 = strcmp(pcVar2,pcVar3); if (iVar6 == 0) goto LAB_001013dd; puVar11 = puVar11 + 1; } while (puVar11 != (int8 *)(lVar12 + (ulong)(iVar7 - 1) * 8)); } iVar7 = *(int *)(puVar9 + -0x1224); *(char **)(puVar9 + (long)iVar7 * 8 + -3000) = pcVar2; *(int *)(puVar9 + -0x1224) = iVar7 + 1; LAB_001013dd: lVar12 = 0; if (*(int *)(puVar9 + -0x1228) != 0) { lVar12 = (long)*(int *)(puVar9 + -0x1228); lVar13 = 0; do { pcVar3 = *(char **)(puVar9 + lVar13 * 8 + -0x11f8); *(int8 *)(puVar9 + -0x1240) = 0x10141c; iVar7 = strcmp(pcVar1,pcVar3); if (iVar7 == 0) { lVar12 = 1; lVar10 = (long)(int)lVar13 * 800; if (*(long *)(puVar9 + lVar10 + -0x898) != 0) goto LAB_0010145e; iVar6 = 1; iVar7 = 0; goto LAB_0010146a; } lVar13 = lVar13 + 1; } while (lVar13 != lVar12); } *(int *)(puVar9 + -0x1228) = *(int *)(puVar9 + -0x1228) + 1; *(char **)(puVar9 + lVar12 * 8 + -0x11f8) = pcVar1; *(char **)(puVar9 + lVar12 * 800 + -0x898) = pcVar2; *(int8 *)(puVar9 + lVar12 * 800 + -0x890) = 0; goto LAB_00101496; } LAB_001015c9: uVar8 = 1; LAB_0010151e: if (*(long *)(puVar9 + 0x12ff0) == *(long *)(in_FS_OFFSET + 0x28)) { return uVar8; } /* WARNING: Subroutine does not return */ *(int **)(puVar9 + -0x1240) = &UNK_001015f1; __stack_chk_fail(); while (lVar12 = lVar12 + 1, lVar12 != 100) { LAB_0010145e: iVar7 = (int)lVar12; if (*(long *)(*(long *)(puVar9 + -0x1200) + lVar10 + lVar12 * 8) == 0) { iVar6 = iVar7 + 1; goto LAB_0010146a; } } iVar6 = 100; iVar7 = 99; LAB_0010146a: lVar12 = (long)(int)lVar13 * 100; *(char **)(puVar9 + (iVar7 + lVar12) * 8 + -0x898) = pcVar2; *(int8 *)(puVar9 + (lVar12 + iVar6) * 8 + -0x898) = 0; LAB_00101496: *(long *)(puVar9 + -0x1238) = *(long *)(puVar9 + -0x1238) + 8; *(long *)(puVar9 + -0x1220) = *(long *)(puVar9 + -0x1220) + 8; if (*(long *)(puVar9 + -0x1238) == *(long *)(puVar9 + -0x1218)) goto code_r0x001014b0; goto LAB_00101340; code_r0x001014b0: uVar8 = 0; if (*(int *)(puVar9 + -0x122c) != *(int *)(puVar9 + -0x1224)) goto LAB_0010151e; iVar7 = *(int *)(puVar9 + -0x1228); puVar11 = (int8 *)(puVar9 + -0x888); do { pcVar2 = (char *)puVar11[-2]; pcVar1 = (char *)puVar11[-1]; puVar4 = puVar11; while (pcVar1 != (char *)0x0) { *(int8 *)(puVar9 + -0x1240) = 0x101518; iVar6 = strcmp(pcVar2,pcVar1); if (iVar6 != 0) { uVar8 = 0; goto LAB_0010151e; } pcVar1 = (char *)*puVar4; puVar4 = puVar4 + 1; } puVar11 = puVar11 + 100; } while (puVar11 != (int8 *)(puVar9 + (ulong)(iVar7 - 1) * 800 + -0x568)); goto LAB_001015c9; }
4,191
func0
#include <stdio.h> #include <stdbool.h> #include <string.h> #include <assert.h>
bool func0(char** colors, int colors_len, char** patterns, int patterns_len){ if (colors_len != patterns_len){ return false; } // Initialize sdict as arrays: patterns and for each pattern, a list of colors. // Also pset and sset // To keep it simple, define max unique patterns and colors as 100 char* sdict_keys[100]; char* sdict_values[100][100]; // sdict_values[i][j] int sdict_size = 0; char* pset[100]; int pset_size = 0; char* sset[100]; int sset_size = 0; for(int i = 0; i < patterns_len; i++) { // Add to pset if not present bool found = false; for(int j = 0; j < pset_size; j++) { if(strcmp(patterns[i], pset[j]) == 0){ found = true; break; } } if (!found){ pset[pset_size++] = patterns[i]; } // Add to sset if not present found = false; for(int j = 0; j < sset_size; j++) { if(strcmp(colors[i], sset[j]) == 0){ found = true; break; } } if (!found){ sset[sset_size++] = colors[i]; } // Add color to sdict // Find if pattern exists in sdict_keys int pattern_index = -1; for(int j = 0; j < sdict_size; j++){ if(strcmp(patterns[i], sdict_keys[j]) == 0){ pattern_index = j; break; } } if(pattern_index == -1){ // Add new pattern key sdict_keys[sdict_size] = patterns[i]; sdict_values[sdict_size][0] = colors[i]; sdict_values[sdict_size][1] = NULL; sdict_size++; } else{ // Append color to existing list int k = 0; while(sdict_values[pattern_index][k] != NULL && k < 99){ k++; } sdict_values[pattern_index][k] = colors[i]; sdict_values[pattern_index][k+1] = NULL; } } if(pset_size != sset_size){ return false; } // Now, for each list in sdict_values, check all colors are same for(int i = 0; i < sdict_size; i++){ char* first_color = sdict_values[i][0]; for(int j = 1; sdict_values[i][j] != NULL; j++){ if(strcmp(first_color, sdict_values[i][j]) != 0){ return false; } } } return true; }
int main(){ char* colors1[] = {"red", "green", "green"}; char* patterns1[] = {"a", "b", "b"}; assert(func0(colors1, 3, patterns1, 3) == true); char* colors2[] = {"red", "green", "greenn"}; char* patterns2[] = {"a", "b", "b"}; assert(func0(colors2, 3, patterns2, 3) == false); char* colors3[] = {"red", "green", "greenn"}; char* patterns3[] = {"a", "b"}; assert(func0(colors3, 3, patterns3, 2) == false); return 0; }
O3
c
func0: endbr64 mov %esi,%r8d mov %rdx,%rsi cmp %ecx,%r8d jne 1660 <func0+0x20> mov %r8d,%edx jmpq 12d0 <func0.part.0> nopw 0x0(%rax,%rax,1) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx lea r11, [rsp+30h+var_14030] loc_1366: sub rsp, 1000h or [rsp+1030h+var_1030], 0 cmp rsp, r11 jnz short loc_1366 sub rsp, 228h mov rax, fs:28h mov [rsp+1258h+arg_12FB8], rax xor eax, eax cmp esi, ecx jnz loc_15A4 test esi, esi jle loc_1650 movsxd rsi, esi mov [rsp+1258h+var_1240], rdi mov r13, rdx lea rax, [rdx+rsi*8] mov [rsp+1258h+var_1248], 0 mov [rsp+1258h+var_1238], rax lea rax, [rsp+1258h+var_8C8] mov [rsp+1258h+var_124C], 0 mov [rsp+1258h+var_1244], 0 mov [rsp+1258h+var_1230], rax nop word ptr [rax+rax+00h] loc_13E0: mov eax, [rsp+1258h+var_124C] mov rbx, [r13+0] test eax, eax jle loc_1620 movsxd r12, [rsp+1258h+var_124C] lea r14, [rsp+1258h+var_F08] lea rbp, [r14+r12*8] jmp short loc_1415 loc_1408: add r14, 8 cmp r14, rbp jz loc_1628 loc_1415: mov rsi, [r14]; s2 mov rdi, rbx; s1 call _strcmp test eax, eax jnz short loc_1408 loc_1424: mov rax, [rsp+1258h+var_1240] mov ecx, [rsp+1258h+var_1248] mov rbp, [rax] test ecx, ecx jle loc_15FF movsxd r14, [rsp+1258h+var_1248] lea r15, [rsp+1258h+var_BE8] lea r12, [r15+r14*8] jmp short loc_145D loc_1450: add r15, 8 cmp r15, r12 jz loc_1608 loc_145D: mov rsi, [r15]; s2 mov rdi, rbp; s1 call _strcmp test eax, eax jnz short loc_1450 loc_146C: mov edx, [rsp+1258h+var_1244] movsxd r12, [rsp+1258h+var_1244] xor r15d, r15d lea r14, [rsp+1258h+var_1228] test edx, edx jg short loc_149D jmp loc_15D0 loc_1490: add r15, 1 cmp r15, r12 jz loc_15D0 loc_149D: mov rsi, [r14+r15*8]; s2 mov rdi, rbx; s1 call _strcmp test eax, eax jnz short loc_1490 movsxd rdx, r15d mov rcx, [rsp+1258h+var_1230] movsxd rsi, r15d lea rdx, [rdx+rdx*4] lea rdi, [rdx+rdx*4] mov edx, 1 shl rdi, 5 add rcx, rdi cmp [rsp+rdi+1258h+var_8C8], 0 jnz short loc_14EE jmp short loc_14FA loc_14E0: add rdx, 1 cmp rdx, 64h ; 'd' jz loc_165A loc_14EE: cmp qword ptr [rcx+rdx*8], 0 jnz short loc_14E0 mov eax, edx add edx, 1 loc_14FA: lea rcx, [rsi+rsi*4] cdqe movsxd rdx, edx lea rcx, [rcx+rcx*4] shl rcx, 2 add rax, rcx add rcx, rdx mov [rsp+rax*8+1258h+var_8C8], rbp mov [rsp+rcx*8+1258h+var_8C8], 0 loc_1525: mov rax, [rsp+1258h+var_1238] add r13, 8 add [rsp+1258h+var_1240], 8 cmp r13, rax jnz loc_13E0 mov ecx, [rsp+1258h+var_1248] cmp [rsp+1258h+var_124C], ecx jnz short loc_15A4 movsxd rax, [rsp+1258h+var_1244] test eax, eax jle loc_1650 lea rax, [rax+rax*4] lea rbp, [rsp+1258h+var_8B8] lea r13, [rax+rax*4] shl r13, 5 add r13, rbp loc_156B: mov rsi, [rbp-8] mov r12, [rbp-10h] test rsi, rsi jz loc_1640 mov rbx, rbp jmp short loc_1598 loc_1588: mov rsi, [rbx]; s2 add rbx, 8 test rsi, rsi jz loc_1640 loc_1598: mov rdi, r12; s1 call _strcmp test eax, eax jz short loc_1588 loc_15A4: xor eax, eax loc_15A6: mov rdx, [rsp+1258h+arg_12FB8] sub rdx, fs:28h jnz loc_1664 add rsp, 14228h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_15D0: lea rax, [r12+r12*4] add [rsp+1258h+var_1244], 1 lea rax, [rax+rax*4] mov [rsp+r12*8+1258h+var_1228], rbx shl rax, 5 mov [rsp+rax+1258h+var_8C8], rbp mov [rsp+rax+1258h+var_8C0], 0 jmp loc_1525 loc_15FF: movsxd r14, [rsp+1258h+var_1248] nop dword ptr [rax+00h] loc_1608: mov eax, [rsp+1258h+var_1248] mov [rsp+r14*8+1258h+var_BE8], rbp add eax, 1 mov [rsp+1258h+var_1248], eax jmp loc_146C loc_1620: movsxd r12, [rsp+1258h+var_124C] nop dword ptr [rax] loc_1628: mov eax, [rsp+1258h+var_124C] mov [rsp+r12*8+1258h+var_F08], rbx add eax, 1 mov [rsp+1258h+var_124C], eax jmp loc_1424 loc_1640: add rbp, 320h cmp r13, rbp jnz loc_156B loc_1650: mov eax, 1 jmp loc_15A6 loc_165A: mov eax, 63h ; 'c' jmp loc_14FA loc_1664: call ___stack_chk_fail
// positive sp value has been detected, the output may be wrong! long long func0(const char **a1, int a2, const char **a3, int a4) { const char **v4; // r13 const char *v5; // rbx long long v6; // r12 const char **v7; // r14 const char *v8; // rbp long long v9; // r14 const char **v10; // r15 long long v11; // r12 long long v12; // r15 int v13; // eax long long v14; // rdx _OWORD *v15; // rbp const char *v16; // rsi const char *v17; // r12 const char **v18; // rbx long long v20; // rax int v21; // [rsp-21Ch] [rbp-1424Ch] int v22; // [rsp-218h] [rbp-14248h] int v23; // [rsp-214h] [rbp-14244h] const char **v25; // [rsp-208h] [rbp-14238h] _QWORD v26[63]; // [rsp-1F8h] [rbp-14228h] char v27; // [rsp+0h] [rbp-14030h] BYREF _QWORD v28[100]; // [rsp+128h] [rbp-13F08h] BYREF _QWORD v29[102]; // [rsp+448h] [rbp-13BE8h] BYREF _OWORD v30[136]; // [rsp+778h] [rbp-138B8h] BYREF _QWORD v31[9734]; // [rsp+1000h] [rbp-13030h] BYREF while ( &v27 != (char *)&v31[-10240] ) ; v31[9726] = __readfsqword(0x28u); if ( a2 != a4 ) return 0LL; if ( a2 > 0 ) { v4 = a3; v22 = 0; v25 = &a3[a2]; v21 = 0; v23 = 0; do { v5 = *v4; if ( v21 <= 0 ) { v6 = v21; LABEL_36: v28[v6] = v5; ++v21; } else { v6 = v21; v7 = (const char **)v28; while ( strcmp(v5, *v7) ) { if ( ++v7 == &v28[v21] ) goto LABEL_36; } } v8 = *a1; if ( v22 <= 0 ) { v9 = v22; LABEL_34: v29[v9] = v8; ++v22; } else { v9 = v22; v10 = (const char **)v29; while ( strcmp(v8, *v10) ) { if ( ++v10 == &v29[v22] ) goto LABEL_34; } } v11 = v23; v12 = 0LL; if ( v23 > 0 ) { while ( 1 ) { v13 = strcmp(v5, (const char *)v26[v12]); if ( !v13 ) break; if ( ++v12 == v23 ) goto LABEL_32; } v14 = 1LL; if ( v29[100 * (int)v12 + 100] ) { do { if ( !v29[100 * (int)v12 + 100 + v14] ) { v13 = v14; LODWORD(v14) = v14 + 1; goto LABEL_22; } ++v14; } while ( v14 != 100 ); v13 = 99; } LABEL_22: v29[100 * (int)v12 + 100 + v13] = v8; v29[100 * (int)v12 + 100 + (int)v14] = 0LL; } else { LABEL_32: ++v23; v26[v11] = v5; v20 = 100 * v11; v29[v20 + 100] = v8; v29[v20 + 101] = 0LL; } ++v4; ++a1; } while ( v4 != v25 ); if ( v21 != v22 ) return 0LL; if ( v23 > 0 ) { v15 = v30; while ( 1 ) { v16 = (const char *)*((_QWORD *)v15 - 1); v17 = (const char *)*((_QWORD *)v15 - 2); if ( v16 ) break; LABEL_37: v15 += 50; if ( &v30[50 * v23] == v15 ) return 1LL; } v18 = (const char **)v15; while ( !strcmp(v17, v16) ) { v16 = *v18++; if ( !v16 ) goto LABEL_37; } return 0LL; } } return 1LL; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX LEA R11,[RSP + -0x14000] LAB_00101366: SUB RSP,0x1000 OR qword ptr [RSP],0x0 CMP RSP,R11 JNZ 0x00101366 SUB RSP,0x228 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x14218],RAX XOR EAX,EAX CMP ESI,ECX JNZ 0x001015a4 TEST ESI,ESI JLE 0x00101650 MOVSXD RSI,ESI MOV qword ptr [RSP + 0x18],RDI MOV R13,RDX LEA RAX,[RDX + RSI*0x8] MOV dword ptr [RSP + 0x10],0x0 MOV qword ptr [RSP + 0x20],RAX LEA RAX,[RSP + 0x990] MOV dword ptr [RSP + 0xc],0x0 MOV dword ptr [RSP + 0x14],0x0 MOV qword ptr [RSP + 0x28],RAX NOP word ptr [RAX + RAX*0x1] LAB_001013e0: MOV EAX,dword ptr [RSP + 0xc] MOV RBX,qword ptr [R13] TEST EAX,EAX JLE 0x00101620 MOVSXD R12,dword ptr [RSP + 0xc] LEA R14,[RSP + 0x350] LEA RBP,[R14 + R12*0x8] JMP 0x00101415 LAB_00101408: ADD R14,0x8 CMP R14,RBP JZ 0x00101628 LAB_00101415: MOV RSI,qword ptr [R14] MOV RDI,RBX CALL 0x00101090 TEST EAX,EAX JNZ 0x00101408 LAB_00101424: MOV RAX,qword ptr [RSP + 0x18] MOV ECX,dword ptr [RSP + 0x10] MOV RBP,qword ptr [RAX] TEST ECX,ECX JLE 0x001015ff MOVSXD R14,dword ptr [RSP + 0x10] LEA R15,[RSP + 0x670] LEA R12,[R15 + R14*0x8] JMP 0x0010145d LAB_00101450: ADD R15,0x8 CMP R15,R12 JZ 0x00101608 LAB_0010145d: MOV RSI,qword ptr [R15] MOV RDI,RBP CALL 0x00101090 TEST EAX,EAX JNZ 0x00101450 LAB_0010146c: MOV EDX,dword ptr [RSP + 0x14] MOVSXD R12,dword ptr [RSP + 0x14] XOR R15D,R15D LEA R14,[RSP + 0x30] TEST EDX,EDX JG 0x0010149d JMP 0x001015d0 LAB_00101490: ADD R15,0x1 CMP R15,R12 JZ 0x001015d0 LAB_0010149d: MOV RSI,qword ptr [R14 + R15*0x8] MOV RDI,RBX CALL 0x00101090 TEST EAX,EAX JNZ 0x00101490 MOVSXD RDX,R15D MOV RCX,qword ptr [RSP + 0x28] MOVSXD RSI,R15D LEA RDX,[RDX + RDX*0x4] LEA RDI,[RDX + RDX*0x4] MOV EDX,0x1 SHL RDI,0x5 ADD RCX,RDI CMP qword ptr [RSP + RDI*0x1 + 0x990],0x0 JNZ 0x001014ee JMP 0x001014fa LAB_001014e0: ADD RDX,0x1 CMP RDX,0x64 JZ 0x0010165a LAB_001014ee: CMP qword ptr [RCX + RDX*0x8],0x0 JNZ 0x001014e0 MOV EAX,EDX ADD EDX,0x1 LAB_001014fa: LEA RCX,[RSI + RSI*0x4] CDQE MOVSXD RDX,EDX LEA RCX,[RCX + RCX*0x4] SHL RCX,0x2 ADD RAX,RCX ADD RCX,RDX MOV qword ptr [RSP + RAX*0x8 + 0x990],RBP MOV qword ptr [RSP + RCX*0x8 + 0x990],0x0 LAB_00101525: MOV RAX,qword ptr [RSP + 0x20] ADD R13,0x8 ADD qword ptr [RSP + 0x18],0x8 CMP R13,RAX JNZ 0x001013e0 MOV ECX,dword ptr [RSP + 0x10] CMP dword ptr [RSP + 0xc],ECX JNZ 0x001015a4 MOVSXD RAX,dword ptr [RSP + 0x14] TEST EAX,EAX JLE 0x00101650 LEA RAX,[RAX + RAX*0x4] LEA RBP,[RSP + 0x9a0] LEA R13,[RAX + RAX*0x4] SHL R13,0x5 ADD R13,RBP LAB_0010156b: MOV RSI,qword ptr [RBP + -0x8] MOV R12,qword ptr [RBP + -0x10] TEST RSI,RSI JZ 0x00101640 MOV RBX,RBP JMP 0x00101598 LAB_00101588: MOV RSI,qword ptr [RBX] ADD RBX,0x8 TEST RSI,RSI JZ 0x00101640 LAB_00101598: MOV RDI,R12 CALL 0x00101090 TEST EAX,EAX JZ 0x00101588 LAB_001015a4: XOR EAX,EAX LAB_001015a6: MOV RDX,qword ptr [RSP + 0x14218] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101664 ADD RSP,0x14228 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001015d0: LEA RAX,[R12 + R12*0x4] ADD dword ptr [RSP + 0x14],0x1 LEA RAX,[RAX + RAX*0x4] MOV qword ptr [RSP + R12*0x8 + 0x30],RBX SHL RAX,0x5 MOV qword ptr [RSP + RAX*0x1 + 0x990],RBP MOV qword ptr [RSP + RAX*0x1 + 0x998],0x0 JMP 0x00101525 LAB_001015ff: MOVSXD R14,dword ptr [RSP + 0x10] NOP dword ptr [RAX] LAB_00101608: MOV EAX,dword ptr [RSP + 0x10] MOV qword ptr [RSP + R14*0x8 + 0x670],RBP ADD EAX,0x1 MOV dword ptr [RSP + 0x10],EAX JMP 0x0010146c LAB_00101620: MOVSXD R12,dword ptr [RSP + 0xc] NOP dword ptr [RAX] LAB_00101628: MOV EAX,dword ptr [RSP + 0xc] MOV qword ptr [RSP + R12*0x8 + 0x350],RBX ADD EAX,0x1 MOV dword ptr [RSP + 0xc],EAX JMP 0x00101424 LAB_00101640: ADD RBP,0x320 CMP R13,RBP JNZ 0x0010156b LAB_00101650: MOV EAX,0x1 JMP 0x001015a6 LAB_0010165a: MOV EAX,0x63 JMP 0x001014fa LAB_00101664: CALL 0x00101070
int8 func0(int8 param_1,int param_2,int8 *param_3,int param_4) { char *pcVar1; char *pcVar2; char *pcVar3; int8 *puVar4; int *puVar5; int iVar6; int8 uVar7; ulong uVar8; int *puVar9; int8 *puVar10; long lVar11; int8 *puVar12; long lVar13; long in_FS_OFFSET; int auStack_14030 [81920]; puVar5 = &stack0xffffffffffffffd0; do { puVar9 = puVar5; *(int8 *)(puVar9 + -0x1000) = *(int8 *)(puVar9 + -0x1000); puVar5 = puVar9 + -0x1000; } while (puVar9 + -0x1000 != auStack_14030); *(int8 *)(puVar9 + 0x12ff0) = *(int8 *)(in_FS_OFFSET + 0x28); if (param_2 == param_4) { if (0 < param_2) { *(int8 *)(puVar9 + -0x1210) = param_1; *(int4 *)(puVar9 + -0x1218) = 0; *(int8 **)(puVar9 + -0x1208) = param_3 + param_2; *(int4 *)(puVar9 + -0x121c) = 0; *(int4 *)(puVar9 + -0x1214) = 0; *(int **)(puVar9 + -0x1200) = puVar9 + -0x898; LAB_001013e0: pcVar1 = (char *)*param_3; if (*(int *)(puVar9 + -0x121c) < 1) { lVar11 = (long)*(int *)(puVar9 + -0x121c); } else { lVar11 = (long)*(int *)(puVar9 + -0x121c); puVar12 = (int8 *)(puVar9 + -0xed8); puVar10 = puVar12 + lVar11; do { pcVar2 = (char *)*puVar12; *(int8 *)(puVar9 + -0x1230) = 0x101420; iVar6 = strcmp(pcVar1,pcVar2); if (iVar6 == 0) goto LAB_00101424; puVar12 = puVar12 + 1; } while (puVar12 != puVar10); } iVar6 = *(int *)(puVar9 + -0x121c); *(char **)(puVar9 + lVar11 * 8 + -0xed8) = pcVar1; *(int *)(puVar9 + -0x121c) = iVar6 + 1; LAB_00101424: pcVar2 = (char *)**(int8 **)(puVar9 + -0x1210); if (*(int *)(puVar9 + -0x1218) < 1) { lVar11 = (long)*(int *)(puVar9 + -0x1218); } else { lVar11 = (long)*(int *)(puVar9 + -0x1218); puVar12 = (int8 *)(puVar9 + -3000); puVar10 = puVar12 + lVar11; do { pcVar3 = (char *)*puVar12; *(int8 *)(puVar9 + -0x1230) = 0x101468; iVar6 = strcmp(pcVar2,pcVar3); if (iVar6 == 0) goto LAB_0010146c; puVar12 = puVar12 + 1; } while (puVar12 != puVar10); } iVar6 = *(int *)(puVar9 + -0x1218); *(char **)(puVar9 + lVar11 * 8 + -3000) = pcVar2; *(int *)(puVar9 + -0x1218) = iVar6 + 1; LAB_0010146c: lVar11 = (long)*(int *)(puVar9 + -0x1214); lVar13 = 0; if (0 < *(int *)(puVar9 + -0x1214)) { do { pcVar3 = *(char **)(puVar9 + lVar13 * 8 + -0x11f8); *(int8 *)(puVar9 + -0x1230) = 0x1014a9; iVar6 = strcmp(pcVar1,pcVar3); if (iVar6 == 0) { uVar8 = 1; lVar11 = (long)(int)lVar13 * 800; if (*(long *)(puVar9 + lVar11 + -0x898) != 0) goto LAB_001014ee; iVar6 = 0; goto LAB_001014fa; } lVar13 = lVar13 + 1; } while (lVar13 != lVar11); } *(int *)(puVar9 + -0x1214) = *(int *)(puVar9 + -0x1214) + 1; *(char **)(puVar9 + lVar11 * 8 + -0x11f8) = pcVar1; *(char **)(puVar9 + lVar11 * 800 + -0x898) = pcVar2; *(int8 *)(puVar9 + lVar11 * 800 + -0x890) = 0; goto LAB_00101525; } goto LAB_00101650; } LAB_001015a4: uVar7 = 0; LAB_001015a6: if (*(long *)(puVar9 + 0x12ff0) == *(long *)(in_FS_OFFSET + 0x28)) { return uVar7; } /* WARNING: Subroutine does not return */ *(int8 *)(puVar9 + -0x1230) = 0x101669; __stack_chk_fail(); while (uVar8 = uVar8 + 1, uVar8 != 100) { LAB_001014ee: if (*(long *)(*(long *)(puVar9 + -0x1200) + lVar11 + uVar8 * 8) == 0) { iVar6 = (int)uVar8; uVar8 = (ulong)(iVar6 + 1); goto LAB_001014fa; } } iVar6 = 99; uVar8 = 100; LAB_001014fa: lVar11 = (long)(int)lVar13 * 100; *(char **)(puVar9 + (iVar6 + lVar11) * 8 + -0x898) = pcVar2; *(int8 *)(puVar9 + (lVar11 + (int)uVar8) * 8 + -0x898) = 0; LAB_00101525: param_3 = param_3 + 1; *(long *)(puVar9 + -0x1210) = *(long *)(puVar9 + -0x1210) + 8; if (param_3 == *(int8 **)(puVar9 + -0x1208)) goto code_r0x0010153d; goto LAB_001013e0; code_r0x0010153d: if (*(int *)(puVar9 + -0x121c) == *(int *)(puVar9 + -0x1218)) { if (0 < *(int *)(puVar9 + -0x1214)) { puVar10 = (int8 *)(puVar9 + -0x888); puVar12 = puVar10 + (long)*(int *)(puVar9 + -0x1214) * 100; do { pcVar2 = (char *)puVar10[-2]; pcVar1 = (char *)puVar10[-1]; puVar4 = puVar10; while (pcVar1 != (char *)0x0) { *(int8 *)(puVar9 + -0x1230) = 0x1015a0; iVar6 = strcmp(pcVar2,pcVar1); if (iVar6 != 0) goto LAB_001015a4; pcVar1 = (char *)*puVar4; puVar4 = puVar4 + 1; } puVar10 = puVar10 + 100; } while (puVar12 != puVar10); } LAB_00101650: uVar7 = 1; goto LAB_001015a6; } goto LAB_001015a4; }
4,192
func0
#include <stdio.h> #include <assert.h> #include <stdbool.h> #include <string.h>
char* func0(int test_list[][3], int list_size, int K) { static char res[100]; int index = 0; res[index++] = '['; for (int i = 0; i < list_size; i++) { bool divisible = true; for (int j = 0; j < 3; j++) { if (test_list[i][j] % K != 0) { divisible = false; break; } } if (divisible) { if (res[index - 1] != '[') { res[index++] = ','; res[index++] = ' '; } res[index++] = '('; for (int j = 0; j < 3; j++) { char numStr[10]; sprintf(numStr, "%d", test_list[i][j]); for (int k = 0; numStr[k] != '\0'; k++) { res[index++] = numStr[k]; } if (j != 2) { res[index++] = ','; res[index++] = ' '; } } res[index++] = ')'; } } res[index++] = ']'; res[index] = '\0'; return res; }
int main() { int list1[][3] = {{6, 24, 12}, {7, 9, 6}, {12, 18, 21}}; int list2[][3] = {{5, 25, 30}, {4, 2, 3}, {7, 8, 9}}; int list3[][3] = {{7, 9, 16}, {8, 16, 4}, {19, 17, 18}}; assert(strcmp(func0(list1, 3, 6), "[(6, 24, 12)]") == 0); assert(strcmp(func0(list2, 3, 5), "[(5, 25, 30)]") == 0); assert(strcmp(func0(list3, 3, 4), "[(8, 16, 4)]") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x40,%rsp mov %rdi,-0x38(%rbp) mov %esi,-0x3c(%rbp) mov %edx,-0x40(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax movl $0x0,-0x28(%rbp) mov -0x28(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x28(%rbp) cltq lea 0x2e59(%rip),%rdx movb $0x5b,(%rax,%rdx,1) movl $0x0,-0x24(%rbp) jmpq 1384 <func0+0x1db> movb $0x1,-0x29(%rbp) movl $0x0,-0x20(%rbp) jmp 123d <func0+0x94> mov -0x24(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax add %rax,%rax add %rdx,%rax shl $0x2,%rax mov %rax,%rdx mov -0x38(%rbp),%rax add %rax,%rdx mov -0x20(%rbp),%eax cltq mov (%rdx,%rax,4),%eax cltd idivl -0x40(%rbp) mov %edx,%eax test %eax,%eax je 1239 <func0+0x90> movb $0x0,-0x29(%rbp) jmp 1243 <func0+0x9a> addl $0x1,-0x20(%rbp) cmpl $0x2,-0x20(%rbp) jle 1204 <func0+0x5b> cmpb $0x0,-0x29(%rbp) je 1380 <func0+0x1d7> mov -0x28(%rbp),%eax sub $0x1,%eax cltq lea 0x2de4(%rip),%rdx movzbl (%rax,%rdx,1),%eax cmp $0x5b,%al je 1290 <func0+0xe7> mov -0x28(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x28(%rbp) cltq lea 0x2dca(%rip),%rdx movb $0x2c,(%rax,%rdx,1) mov -0x28(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x28(%rbp) cltq lea 0x2db4(%rip),%rdx movb $0x20,(%rax,%rdx,1) mov -0x28(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x28(%rbp) cltq lea 0x2d9e(%rip),%rdx movb $0x28,(%rax,%rdx,1) movl $0x0,-0x1c(%rbp) jmpq 1360 <func0+0x1b7> mov -0x24(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax add %rax,%rax add %rdx,%rax shl $0x2,%rax mov %rax,%rdx mov -0x38(%rbp),%rax add %rax,%rdx mov -0x1c(%rbp),%eax cltq mov (%rdx,%rax,4),%edx lea -0x12(%rbp),%rax lea 0xd26(%rip),%rsi mov %rax,%rdi mov $0x0,%eax callq 10b0 <sprintf@plt> movl $0x0,-0x18(%rbp) jmp 131c <func0+0x173> mov -0x28(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x28(%rbp) mov -0x18(%rbp),%edx movslq %edx,%rdx movzbl -0x12(%rbp,%rdx,1),%edx cltq lea 0x2d2b(%rip),%rcx mov %dl,(%rax,%rcx,1) addl $0x1,-0x18(%rbp) mov -0x18(%rbp),%eax cltq movzbl -0x12(%rbp,%rax,1),%eax test %al,%al jne 12f8 <func0+0x14f> cmpl $0x2,-0x1c(%rbp) je 135c <func0+0x1b3> mov -0x28(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x28(%rbp) cltq lea 0x2cfe(%rip),%rdx movb $0x2c,(%rax,%rdx,1) mov -0x28(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x28(%rbp) cltq lea 0x2ce8(%rip),%rdx movb $0x20,(%rax,%rdx,1) addl $0x1,-0x1c(%rbp) cmpl $0x2,-0x1c(%rbp) jle 12b2 <func0+0x109> mov -0x28(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x28(%rbp) cltq lea 0x2cc4(%rip),%rdx movb $0x29,(%rax,%rdx,1) addl $0x1,-0x24(%rbp) mov -0x24(%rbp),%eax cmp -0x3c(%rbp),%eax jl 11f7 <func0+0x4e> mov -0x28(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x28(%rbp) cltq lea 0x2c9e(%rip),%rdx movb $0x5d,(%rax,%rdx,1) mov -0x28(%rbp),%eax cltq lea 0x2c8e(%rip),%rdx movb $0x0,(%rax,%rdx,1) lea 0x2c83(%rip),%rax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 13d1 <func0+0x228> callq 1080 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_38], rdi mov [rbp+var_3C], esi mov [rbp+var_40], edx mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov [rbp+var_28], 0 mov eax, [rbp+var_28] lea edx, [rax+1] mov [rbp+var_28], edx cdqe lea rdx, res_1 mov byte ptr [rax+rdx], 5Bh ; '[' mov [rbp+var_24], 0 jmp loc_1387 loc_11F7: mov [rbp+var_29], 1 mov [rbp+var_20], 0 jmp short loc_123D loc_1204: mov eax, [rbp+var_24] movsxd rdx, eax mov rax, rdx add rax, rax add rax, rdx shl rax, 2 mov rdx, rax mov rax, [rbp+var_38] add rdx, rax mov eax, [rbp+var_20] cdqe mov eax, [rdx+rax*4] cdq idiv [rbp+var_40] mov eax, edx test eax, eax jz short loc_1239 mov [rbp+var_29], 0 jmp short loc_1243 loc_1239: add [rbp+var_20], 1 loc_123D: cmp [rbp+var_20], 2 jle short loc_1204 loc_1243: cmp [rbp+var_29], 0 jz loc_1383 mov eax, [rbp+var_28] sub eax, 1 cdqe lea rdx, res_1 movzx eax, byte ptr [rax+rdx] cmp al, 5Bh ; '[' jz short loc_1290 mov eax, [rbp+var_28] lea edx, [rax+1] mov [rbp+var_28], edx cdqe lea rdx, res_1 mov byte ptr [rax+rdx], 2Ch ; ',' mov eax, [rbp+var_28] lea edx, [rax+1] mov [rbp+var_28], edx cdqe lea rdx, res_1 mov byte ptr [rax+rdx], 20h ; ' ' loc_1290: mov eax, [rbp+var_28] lea edx, [rax+1] mov [rbp+var_28], edx cdqe lea rdx, res_1 mov byte ptr [rax+rdx], 28h ; '(' mov [rbp+var_1C], 0 jmp loc_1363 loc_12B2: mov eax, [rbp+var_24] movsxd rdx, eax mov rax, rdx add rax, rax add rax, rdx shl rax, 2 mov rdx, rax mov rax, [rbp+var_38] add rdx, rax mov eax, [rbp+var_1C] cdqe mov edx, [rdx+rax*4] lea rax, [rbp+s] lea rcx, format; "%d" mov rsi, rcx; format mov rdi, rax; s mov eax, 0 call _sprintf mov [rbp+var_18], 0 jmp short loc_131F loc_12FB: mov eax, [rbp+var_28] lea edx, [rax+1] mov [rbp+var_28], edx mov edx, [rbp+var_18] movsxd rdx, edx movzx edx, [rbp+rdx+s] cdqe lea rcx, res_1 mov [rax+rcx], dl add [rbp+var_18], 1 loc_131F: mov eax, [rbp+var_18] cdqe movzx eax, [rbp+rax+s] test al, al jnz short loc_12FB cmp [rbp+var_1C], 2 jz short loc_135F mov eax, [rbp+var_28] lea edx, [rax+1] mov [rbp+var_28], edx cdqe lea rdx, res_1 mov byte ptr [rax+rdx], 2Ch ; ',' mov eax, [rbp+var_28] lea edx, [rax+1] mov [rbp+var_28], edx cdqe lea rdx, res_1 mov byte ptr [rax+rdx], 20h ; ' ' loc_135F: add [rbp+var_1C], 1 loc_1363: cmp [rbp+var_1C], 2 jle loc_12B2 mov eax, [rbp+var_28] lea edx, [rax+1] mov [rbp+var_28], edx cdqe lea rdx, res_1 mov byte ptr [rax+rdx], 29h ; ')' loc_1383: add [rbp+var_24], 1 loc_1387: mov eax, [rbp+var_24] cmp eax, [rbp+var_3C] jl loc_11F7 mov eax, [rbp+var_28] lea edx, [rax+1] mov [rbp+var_28], edx cdqe lea rdx, res_1 mov byte ptr [rax+rdx], 5Dh ; ']' mov eax, [rbp+var_28] cdqe lea rdx, res_1 mov byte ptr [rax+rdx], 0 lea rax, res_1 mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_13D4 call ___stack_chk_fail locret_13D4: leave retn
_BYTE * func0(long long a1, int a2, int a3) { int v3; // eax int v4; // eax int v5; // eax int v6; // eax int v7; // eax char v10; // [rsp+17h] [rbp-29h] int v11; // [rsp+18h] [rbp-28h] int v12; // [rsp+18h] [rbp-28h] int i; // [rsp+1Ch] [rbp-24h] int j; // [rsp+20h] [rbp-20h] int k; // [rsp+24h] [rbp-1Ch] int m; // [rsp+28h] [rbp-18h] char s[10]; // [rsp+2Eh] [rbp-12h] BYREF unsigned long long v18; // [rsp+38h] [rbp-8h] v18 = __readfsqword(0x28u); v11 = 1; res_1[0] = 91; for ( i = 0; i < a2; ++i ) { v10 = 1; for ( j = 0; j <= 2; ++j ) { if ( *(_DWORD *)(a1 + 12LL * i + 4LL * j) % a3 ) { v10 = 0; break; } } if ( v10 ) { if ( res_1[v11 - 1] != 91 ) { res_1[v11] = 44; v3 = v11 + 1; v11 += 2; res_1[v3] = 32; } v4 = v11; v12 = v11 + 1; res_1[v4] = 40; for ( k = 0; k <= 2; ++k ) { sprintf(s, "%d", *(_DWORD *)(a1 + 12LL * i + 4LL * k)); for ( m = 0; s[m]; ++m ) { v5 = v12++; res_1[v5] = s[m]; } if ( k != 2 ) { res_1[v12] = 44; v6 = v12 + 1; v12 += 2; res_1[v6] = 32; } } v7 = v12; v11 = v12 + 1; res_1[v7] = 41; } } res_1[v11] = 93; res_1[v11 + 1] = 0; return res_1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x38],RDI MOV dword ptr [RBP + -0x3c],ESI MOV dword ptr [RBP + -0x40],EDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV dword ptr [RBP + -0x28],0x0 MOV EAX,dword ptr [RBP + -0x28] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x28],EDX CDQE LEA RDX,[0x104040] MOV byte ptr [RAX + RDX*0x1],0x5b MOV dword ptr [RBP + -0x24],0x0 JMP 0x00101387 LAB_001011f7: MOV byte ptr [RBP + -0x29],0x1 MOV dword ptr [RBP + -0x20],0x0 JMP 0x0010123d LAB_00101204: MOV EAX,dword ptr [RBP + -0x24] MOVSXD RDX,EAX MOV RAX,RDX ADD RAX,RAX ADD RAX,RDX SHL RAX,0x2 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x38] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x20] CDQE MOV EAX,dword ptr [RDX + RAX*0x4] CDQ IDIV dword ptr [RBP + -0x40] MOV EAX,EDX TEST EAX,EAX JZ 0x00101239 MOV byte ptr [RBP + -0x29],0x0 JMP 0x00101243 LAB_00101239: ADD dword ptr [RBP + -0x20],0x1 LAB_0010123d: CMP dword ptr [RBP + -0x20],0x2 JLE 0x00101204 LAB_00101243: CMP byte ptr [RBP + -0x29],0x0 JZ 0x00101383 MOV EAX,dword ptr [RBP + -0x28] SUB EAX,0x1 CDQE LEA RDX,[0x104040] MOVZX EAX,byte ptr [RAX + RDX*0x1] CMP AL,0x5b JZ 0x00101290 MOV EAX,dword ptr [RBP + -0x28] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x28],EDX CDQE LEA RDX,[0x104040] MOV byte ptr [RAX + RDX*0x1],0x2c MOV EAX,dword ptr [RBP + -0x28] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x28],EDX CDQE LEA RDX,[0x104040] MOV byte ptr [RAX + RDX*0x1],0x20 LAB_00101290: MOV EAX,dword ptr [RBP + -0x28] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x28],EDX CDQE LEA RDX,[0x104040] MOV byte ptr [RAX + RDX*0x1],0x28 MOV dword ptr [RBP + -0x1c],0x0 JMP 0x00101363 LAB_001012b2: MOV EAX,dword ptr [RBP + -0x24] MOVSXD RDX,EAX MOV RAX,RDX ADD RAX,RAX ADD RAX,RDX SHL RAX,0x2 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x38] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x1c] CDQE MOV EDX,dword ptr [RDX + RAX*0x4] LEA RAX,[RBP + -0x12] LEA RCX,[0x102008] MOV RSI,RCX MOV RDI,RAX MOV EAX,0x0 CALL 0x001010b0 MOV dword ptr [RBP + -0x18],0x0 JMP 0x0010131f LAB_001012fb: MOV EAX,dword ptr [RBP + -0x28] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x28],EDX MOV EDX,dword ptr [RBP + -0x18] MOVSXD RDX,EDX MOVZX EDX,byte ptr [RBP + RDX*0x1 + -0x12] CDQE LEA RCX,[0x104040] MOV byte ptr [RAX + RCX*0x1],DL ADD dword ptr [RBP + -0x18],0x1 LAB_0010131f: MOV EAX,dword ptr [RBP + -0x18] CDQE MOVZX EAX,byte ptr [RBP + RAX*0x1 + -0x12] TEST AL,AL JNZ 0x001012fb CMP dword ptr [RBP + -0x1c],0x2 JZ 0x0010135f MOV EAX,dword ptr [RBP + -0x28] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x28],EDX CDQE LEA RDX,[0x104040] MOV byte ptr [RAX + RDX*0x1],0x2c MOV EAX,dword ptr [RBP + -0x28] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x28],EDX CDQE LEA RDX,[0x104040] MOV byte ptr [RAX + RDX*0x1],0x20 LAB_0010135f: ADD dword ptr [RBP + -0x1c],0x1 LAB_00101363: CMP dword ptr [RBP + -0x1c],0x2 JLE 0x001012b2 MOV EAX,dword ptr [RBP + -0x28] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x28],EDX CDQE LEA RDX,[0x104040] MOV byte ptr [RAX + RDX*0x1],0x29 LAB_00101383: ADD dword ptr [RBP + -0x24],0x1 LAB_00101387: MOV EAX,dword ptr [RBP + -0x24] CMP EAX,dword ptr [RBP + -0x3c] JL 0x001011f7 MOV EAX,dword ptr [RBP + -0x28] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x28],EDX CDQE LEA RDX,[0x104040] MOV byte ptr [RAX + RDX*0x1],0x5d MOV EAX,dword ptr [RBP + -0x28] CDQE LEA RDX,[0x104040] MOV byte ptr [RAX + RDX*0x1],0x0 LEA RAX,[0x104040] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001013d4 CALL 0x00101080 LAB_001013d4: LEAVE RET
int1 * func0(long param_1,int param_2,int param_3) { int iVar1; bool bVar2; long in_FS_OFFSET; int local_30; int local_2c; int local_28; int local_24; int local_20; char local_1a [10]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_30 = 1; res_1[0] = 0x5b; local_2c = 0; do { if (param_2 <= local_2c) { res_1[local_30] = 0x5d; res_1[local_30 + 1] = 0; if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return res_1; } bVar2 = true; for (local_28 = 0; local_28 < 3; local_28 = local_28 + 1) { if (*(int *)((long)local_2c * 0xc + param_1 + (long)local_28 * 4) % param_3 != 0) { bVar2 = false; break; } } if (bVar2) { if (res_1[local_30 + -1] != '[') { iVar1 = local_30 + 1; res_1[local_30] = 0x2c; local_30 = local_30 + 2; res_1[iVar1] = 0x20; } res_1[local_30] = 0x28; local_30 = local_30 + 1; for (local_24 = 0; local_24 < 3; local_24 = local_24 + 1) { sprintf(local_1a,"%d",(ulong)*(uint *)((long)local_2c * 0xc + param_1 + (long)local_24 * 4)) ; for (local_20 = 0; local_1a[local_20] != '\0'; local_20 = local_20 + 1) { res_1[local_30] = local_1a[local_20]; local_30 = local_30 + 1; } if (local_24 != 2) { iVar1 = local_30 + 1; res_1[local_30] = 0x2c; local_30 = local_30 + 2; res_1[iVar1] = 0x20; } } res_1[local_30] = 0x29; local_30 = local_30 + 1; } local_2c = local_2c + 1; } while( true ); }
4,193
func0
#include <stdio.h> #include <assert.h> #include <stdbool.h> #include <string.h>
char* func0(int test_list[][3], int list_size, int K) { static char res[100]; int index = 0; res[index++] = '['; for (int i = 0; i < list_size; i++) { bool divisible = true; for (int j = 0; j < 3; j++) { if (test_list[i][j] % K != 0) { divisible = false; break; } } if (divisible) { if (res[index - 1] != '[') { res[index++] = ','; res[index++] = ' '; } res[index++] = '('; for (int j = 0; j < 3; j++) { char numStr[10]; sprintf(numStr, "%d", test_list[i][j]); for (int k = 0; numStr[k] != '\0'; k++) { res[index++] = numStr[k]; } if (j != 2) { res[index++] = ','; res[index++] = ' '; } } res[index++] = ')'; } } res[index++] = ']'; res[index] = '\0'; return res; }
int main() { int list1[][3] = {{6, 24, 12}, {7, 9, 6}, {12, 18, 21}}; int list2[][3] = {{5, 25, 30}, {4, 2, 3}, {7, 8, 9}}; int list3[][3] = {{7, 9, 16}, {8, 16, 4}, {19, 17, 18}}; assert(strcmp(func0(list1, 3, 6), "[(6, 24, 12)]") == 0); assert(strcmp(func0(list2, 3, 5), "[(5, 25, 30)]") == 0); assert(strcmp(func0(list3, 3, 4), "[(8, 16, 4)]") == 0); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x48,%rsp mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax movb $0x5b,0x2e8e(%rip) test %esi,%esi jle 11f2 <func0+0x69> mov %edx,%r12d mov %rdi,%rbp lea -0x1(%rsi),%eax lea (%rax,%rax,2),%rax lea 0xc(%rdi,%rax,4),%rax mov %rax,0x18(%rsp) mov $0x1,%esi lea 0x2e67(%rip),%r15 lea 0x2e(%rsp),%rax mov %rax,0x10(%rsp) lea -0x1(%r15),%rbx jmp 1248 <func0+0xbf> mov 0xc(%rsp),%ecx jmpq 12fa <func0+0x171> mov $0x1,%esi lea 0x2e42(%rip),%rax movslq %esi,%rdx movb $0x5d,(%rax,%rdx,1) add $0x1,%esi movslq %esi,%rsi movb $0x0,(%rax,%rsi,1) mov 0x38(%rsp),%rdi xor %fs:0x28,%rdi jne 1327 <func0+0x19e> add $0x48,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq lea 0x1(%rcx),%esi movslq %ecx,%rcx movb $0x29,(%r15,%rcx,1) add $0xc,%rbp cmp 0x18(%rsp),%rbp je 11f7 <func0+0x6e> mov %rbp,%r14 mov 0x0(%rbp),%eax cltd idiv %r12d test %edx,%edx jne 123d <func0+0xb4> mov 0x4(%rbp),%eax cltd idiv %r12d test %edx,%edx jne 123d <func0+0xb4> mov 0x8(%r14),%eax cltd idiv %r12d test %edx,%edx jne 123d <func0+0xb4> lea -0x1(%rsi),%eax cltq cmpb $0x5b,(%r15,%rax,1) je 128e <func0+0x105> lea 0x1(%rsi),%eax movslq %esi,%rdx movb $0x2c,(%r15,%rdx,1) add $0x2,%esi cltq movb $0x20,(%r15,%rax,1) lea 0x1(%rsi),%eax mov %eax,0xc(%rsp) movslq %esi,%rsi movb $0x28,(%r15,%rsi,1) mov $0x0,%r13d mov (%r14,%r13,4),%r8d lea 0xd56(%rip),%rcx mov $0xa,%edx mov $0x1,%esi mov 0x10(%rsp),%rdi mov $0x0,%eax callq 1090 <__sprintf_chk@plt> movzbl 0x2e(%rsp),%edx test %dl,%dl je 11e9 <func0+0x60> mov 0xc(%rsp),%ecx lea 0x1(%rcx),%eax cltq movslq %ecx,%rcx mov 0x10(%rsp),%rsi sub %rcx,%rsi mov %eax,%ecx mov %dl,(%rax,%rbx,1) add $0x1,%rax movzbl -0x1(%rsi,%rax,1),%edx test %dl,%dl jne 12e8 <func0+0x15f> cmp $0x2,%r13 je 1232 <func0+0xa9> movslq %ecx,%rax movb $0x2c,(%r15,%rax,1) lea 0x2(%rcx),%eax mov %eax,0xc(%rsp) add $0x1,%ecx movslq %ecx,%rcx movb $0x20,(%r15,%rcx,1) add $0x1,%r13 jmpq 12a3 <func0+0x11a> callq 1070 <__stack_chk_fail@plt>
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 48h mov [rsp+78h+var_6C], edx mov rax, fs:28h mov [rsp+78h+var_40], rax xor eax, eax mov cs:res_1, 5Bh ; '[' test esi, esi jle short loc_1208 mov rbp, rdi lea eax, [rsi-1] lea rax, [rax+rax*2] lea rax, [rdi+rax*4+0Ch] mov [rsp+78h+var_68], rax mov esi, 1 lea r15, res_1 lea rbx, [r15-1] jmp short loc_1263 loc_1200: mov ecx, r12d jmp loc_131C loc_1208: mov esi, 1 loc_120D: lea rax, res_1 movsxd rdx, esi mov byte ptr [rax+rdx], 5Dh ; ']' add esi, 1 movsxd rsi, esi mov byte ptr [rax+rsi], 0 mov rdx, [rsp+78h+var_40] sub rdx, fs:28h jnz loc_1343 add rsp, 48h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1248: mov rbp, [rsp+78h+var_60] lea esi, [rcx+1] movsxd rcx, ecx mov byte ptr [r15+rcx], 29h ; ')' loc_1258: add rbp, 0Ch cmp rbp, [rsp+78h+var_68] jz short loc_120D loc_1263: mov r14, rbp mov eax, [rbp+0] mov edi, [rsp+78h+var_6C] cdq idiv edi test edx, edx jnz short loc_1258 mov eax, [rbp+4] cdq idiv edi test edx, edx jnz short loc_1258 mov eax, [r14+8] cdq idiv [rsp+78h+var_6C] test edx, edx jnz short loc_1258 lea eax, [rsi-1] cdqe cmp byte ptr [r15+rax], 5Bh ; '[' jz short loc_12AC lea eax, [rsi+1] movsxd rdx, esi mov byte ptr [r15+rdx], 2Ch ; ',' add esi, 2 cdqe mov byte ptr [r15+rax], 20h ; ' ' loc_12AC: lea r12d, [rsi+1] movsxd rsi, esi mov byte ptr [r15+rsi], 28h ; '(' mov r13d, 0 lea rax, [rsp+78h+var_4A] mov [rsp+78h+var_60], rbp mov rbp, rax loc_12CB: mov r8d, [r14+r13*4] lea rcx, unk_2004 mov edx, 0Ah mov esi, 1 mov rdi, rbp mov eax, 0 call ___sprintf_chk movzx edx, [rsp+78h+var_4A] test dl, dl jz loc_1200 lea eax, [r12+1] cdqe movsxd r12, r12d mov rsi, rbp sub rsi, r12 loc_130A: mov ecx, eax mov [rax+rbx], dl add rax, 1 movzx edx, byte ptr [rsi+rax-1] test dl, dl jnz short loc_130A loc_131C: cmp r13, 2 jz loc_1248 movsxd rax, ecx mov byte ptr [r15+rax], 2Ch ; ',' lea r12d, [rcx+2] add ecx, 1 movsxd rcx, ecx mov byte ptr [r15+rcx], 20h ; ' ' add r13, 1 jmp short loc_12CB loc_1343: call ___stack_chk_fail
char * func0(_DWORD *a1, int a2, int a3) { _DWORD *v3; // rbp int v4; // esi int v5; // ecx char *result; // rax int v7; // eax int v8; // r12d long long i; // r13 char v10; // dl long long v11; // rax long long v13; // [rsp+10h] [rbp-68h] _BYTE v14[10]; // [rsp+2Eh] [rbp-4Ah] BYREF unsigned long long v15; // [rsp+38h] [rbp-40h] v15 = __readfsqword(0x28u); res_1[0] = 91; if ( a2 <= 0 ) { v4 = 1; } else { v3 = a1; v13 = (long long)&a1[3 * (a2 - 1) + 3]; v4 = 1; do { if ( !(*v3 % a3) && !(v3[1] % a3) && !(v3[2] % a3) ) { if ( res_1[v4 - 1] != 91 ) { v7 = v4 + 1; res_1[v4] = 44; v4 += 2; res_1[v7] = 32; } v8 = v4 + 1; res_1[v4] = 40; for ( i = 0LL; ; ++i ) { __sprintf_chk(v14, 1LL, 10LL, &unk_2004, (unsigned int)v3[i]); v10 = v14[0]; if ( v14[0] ) { v11 = v8 + 1; do { v5 = v11; res_1[v11++ - 1] = v10; v10 = v14[v11 - v8 - 1]; } while ( v10 ); } else { v5 = v8; } if ( i == 2 ) break; res_1[v5] = 44; v8 = v5 + 2; res_1[v5 + 1] = 32; } v4 = v5 + 1; res_1[v5] = 41; } v3 += 3; } while ( v3 != (_DWORD *)v13 ); } result = res_1; res_1[v4] = 93; res_1[v4 + 1] = 0; return result; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x48 MOV dword ptr [RSP + 0xc],EDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x38],RAX XOR EAX,EAX MOV byte ptr [0x00104040],0x5b TEST ESI,ESI JLE 0x00101208 MOV RBP,RDI LEA EAX,[RSI + -0x1] LEA RAX,[RAX + RAX*0x2] LEA RAX,[RDI + RAX*0x4 + 0xc] MOV qword ptr [RSP + 0x10],RAX MOV ESI,0x1 LEA R15,[0x104040] LEA RBX,[R15 + -0x1] JMP 0x00101263 LAB_00101200: MOV ECX,R12D JMP 0x0010131c LAB_00101208: MOV ESI,0x1 LAB_0010120d: LEA RAX,[0x104040] MOVSXD RDX,ESI MOV byte ptr [RAX + RDX*0x1],0x5d ADD ESI,0x1 MOVSXD RSI,ESI MOV byte ptr [RAX + RSI*0x1],0x0 MOV RDX,qword ptr [RSP + 0x38] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101343 ADD RSP,0x48 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101248: MOV RBP,qword ptr [RSP + 0x18] LEA ESI,[RCX + 0x1] MOVSXD RCX,ECX MOV byte ptr [R15 + RCX*0x1],0x29 LAB_00101258: ADD RBP,0xc CMP RBP,qword ptr [RSP + 0x10] JZ 0x0010120d LAB_00101263: MOV R14,RBP MOV EAX,dword ptr [RBP] MOV EDI,dword ptr [RSP + 0xc] CDQ IDIV EDI TEST EDX,EDX JNZ 0x00101258 MOV EAX,dword ptr [RBP + 0x4] CDQ IDIV EDI TEST EDX,EDX JNZ 0x00101258 MOV EAX,dword ptr [R14 + 0x8] CDQ IDIV dword ptr [RSP + 0xc] TEST EDX,EDX JNZ 0x00101258 LEA EAX,[RSI + -0x1] CDQE CMP byte ptr [R15 + RAX*0x1],0x5b JZ 0x001012ac LEA EAX,[RSI + 0x1] MOVSXD RDX,ESI MOV byte ptr [R15 + RDX*0x1],0x2c ADD ESI,0x2 CDQE MOV byte ptr [R15 + RAX*0x1],0x20 LAB_001012ac: LEA R12D,[RSI + 0x1] MOVSXD RSI,ESI MOV byte ptr [R15 + RSI*0x1],0x28 MOV R13D,0x0 LEA RAX,[RSP + 0x2e] MOV qword ptr [RSP + 0x18],RBP MOV RBP,RAX LAB_001012cb: MOV R8D,dword ptr [R14 + R13*0x4] LEA RCX,[0x102004] MOV EDX,0xa MOV ESI,0x1 MOV RDI,RBP MOV EAX,0x0 CALL 0x001010b0 MOVZX EDX,byte ptr [RSP + 0x2e] TEST DL,DL JZ 0x00101200 LEA EAX,[R12 + 0x1] CDQE MOVSXD R12,R12D MOV RSI,RBP SUB RSI,R12 LAB_0010130a: MOV ECX,EAX MOV byte ptr [RAX + RBX*0x1],DL ADD RAX,0x1 MOVZX EDX,byte ptr [RSI + RAX*0x1 + -0x1] TEST DL,DL JNZ 0x0010130a LAB_0010131c: CMP R13,0x2 JZ 0x00101248 MOVSXD RAX,ECX MOV byte ptr [R15 + RAX*0x1],0x2c LEA R12D,[RCX + 0x2] ADD ECX,0x1 MOVSXD RCX,ECX MOV byte ptr [R15 + RCX*0x1],0x20 ADD R13,0x1 JMP 0x001012cb LAB_00101343: CALL 0x00101080
void func0(int *param_1,int param_2,int param_3) { int *piVar1; int iVar2; long lVar3; char cVar4; int iVar5; long lVar6; long lVar7; long in_FS_OFFSET; char local_4a [10]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); res_1 = 0x5b; if (param_2 < 1) { iVar5 = 1; } else { piVar1 = param_1 + (ulong)(param_2 - 1) * 3 + 3; iVar5 = 1; do { if (((*param_1 % param_3 == 0) && (param_1[1] % param_3 == 0)) && (param_1[2] % param_3 == 0)) { if ((&res_1)[iVar5 + -1] != '[') { iVar2 = iVar5 + 1; (&res_1)[iVar5] = 0x2c; iVar5 = iVar5 + 2; (&res_1)[iVar2] = 0x20; } (&res_1)[iVar5] = 0x28; lVar7 = 0; iVar2 = iVar5 + 1; while( true ) { __sprintf_chk(local_4a,1,10,&DAT_00102004,param_1[lVar7]); if (local_4a[0] != '\0') { lVar3 = (long)(iVar2 + 1); lVar6 = (long)iVar2; cVar4 = local_4a[0]; do { iVar2 = (int)lVar3; (&DAT_0010403f)[lVar3] = cVar4; lVar3 = lVar3 + 1; cVar4 = local_4a[(lVar3 - lVar6) + -1]; } while (cVar4 != '\0'); } if (lVar7 == 2) break; (&res_1)[iVar2] = 0x2c; (&res_1)[iVar2 + 1] = 0x20; lVar7 = lVar7 + 1; iVar2 = iVar2 + 2; } iVar5 = iVar2 + 1; (&res_1)[iVar2] = 0x29; } param_1 = param_1 + 3; } while (param_1 != piVar1); } (&res_1)[iVar5] = 0x5d; (&res_1)[iVar5 + 1] = 0; if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return; }
4,194
func0
#include <stdio.h> #include <assert.h> #include <stdbool.h> #include <string.h>
char* func0(int test_list[][3], int list_size, int K) { static char res[100]; int index = 0; res[index++] = '['; for (int i = 0; i < list_size; i++) { bool divisible = true; for (int j = 0; j < 3; j++) { if (test_list[i][j] % K != 0) { divisible = false; break; } } if (divisible) { if (res[index - 1] != '[') { res[index++] = ','; res[index++] = ' '; } res[index++] = '('; for (int j = 0; j < 3; j++) { char numStr[10]; sprintf(numStr, "%d", test_list[i][j]); for (int k = 0; numStr[k] != '\0'; k++) { res[index++] = numStr[k]; } if (j != 2) { res[index++] = ','; res[index++] = ' '; } } res[index++] = ')'; } } res[index++] = ']'; res[index] = '\0'; return res; }
int main() { int list1[][3] = {{6, 24, 12}, {7, 9, 6}, {12, 18, 21}}; int list2[][3] = {{5, 25, 30}, {4, 2, 3}, {7, 8, 9}}; int list3[][3] = {{7, 9, 16}, {8, 16, 4}, {19, 17, 18}}; assert(strcmp(func0(list1, 3, 6), "[(6, 24, 12)]") == 0); assert(strcmp(func0(list2, 3, 5), "[(5, 25, 30)]") == 0); assert(strcmp(func0(list3, 3, 4), "[(8, 16, 4)]") == 0); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x38,%rsp mov %fs:0x28,%rax mov %rax,0x28(%rsp) xor %eax,%eax movb $0x5b,0x2c87(%rip) test %esi,%esi jle 1522 <func0+0x192> lea -0x1(%rsi),%eax lea 0x2c75(%rip),%r13 mov %edx,%r14d mov %rdi,%rbp lea (%rax,%rax,2),%rax mov $0x1,%ecx lea -0x1(%r13),%r12 lea 0xc(%rdi,%rax,4),%rax mov %rax,0x8(%rsp) nopl 0x0(%rax,%rax,1) mov 0x0(%rbp),%eax cltd idiv %r14d test %edx,%edx jne 14d9 <func0+0x149> mov 0x4(%rbp),%eax cltd idiv %r14d test %edx,%edx jne 14d9 <func0+0x149> mov 0x8(%rbp),%eax cltd idiv %r14d test %edx,%edx jne 14d9 <func0+0x149> lea -0x1(%rcx),%eax lea 0x1(%rcx),%ebx cltq cmpb $0x5b,0x0(%r13,%rax,1) je 1445 <func0+0xb5> movslq %ecx,%rax movslq %ebx,%rbx movb $0x2c,0x0(%r13,%rax,1) movb $0x20,0x0(%r13,%rbx,1) lea 0x3(%rcx),%ebx add $0x2,%ecx movslq %ecx,%rcx xor %r15d,%r15d lea 0x1e(%rsp),%rdi movb $0x28,0x0(%r13,%rcx,1) mov 0x0(%rbp,%r15,4),%r8d mov $0xa,%edx xor %eax,%eax mov %rdi,(%rsp) lea 0xb97(%rip),%rcx mov $0x1,%esi callq 1090 <__sprintf_chk@plt> movzbl 0x1e(%rsp),%edx mov (%rsp),%rdi test %dl,%dl je 14ab <func0+0x11b> lea 0x1(%rbx),%eax mov %rdi,%rcx movslq %ebx,%rbx cltq sub %rbx,%rcx nopw 0x0(%rax,%rax,1) mov %dl,(%r12,%rax,1) mov %eax,%ebx add $0x1,%rax movzbl -0x1(%rcx,%rax,1),%edx test %dl,%dl jne 1498 <func0+0x108> lea 0x1(%rbx),%ecx cmp $0x2,%r15 je 14d0 <func0+0x140> movslq %ebx,%rax movslq %ecx,%rcx add $0x2,%ebx add $0x1,%r15 movb $0x2c,0x0(%r13,%rax,1) movb $0x20,0x0(%r13,%rcx,1) jmp 1456 <func0+0xc6> movslq %ebx,%rbx movb $0x29,0x0(%r13,%rbx,1) add $0xc,%rbp cmp 0x8(%rsp),%rbp jne 13f0 <func0+0x60> lea 0x1(%rcx),%eax cltq movslq %ecx,%rcx movb $0x5d,0x0(%r13,%rcx,1) movb $0x0,0x0(%r13,%rax,1) mov 0x28(%rsp),%rax xor %fs:0x28,%rax jne 1535 <func0+0x1a5> add $0x38,%rsp lea 0x2b29(%rip),%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq mov $0x2,%eax mov $0x1,%ecx lea 0x2b0d(%rip),%r13 jmp 14eb <func0+0x15b> callq 1070 <__stack_chk_fail@plt> nopw 0x0(%rax,%rax,1)
func0: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 38h mov rax, fs:28h mov [rsp+68h+var_40], rax xor eax, eax mov cs:res_1, 5Bh ; '[' test esi, esi jle loc_151E lea eax, [rsi-1] lea r13, res_1 mov r15d, edx mov rbp, rdi lea rax, [rax+rax*2] mov ecx, 1 lea r14, [rsp+68h+var_4A] lea rax, [rdi+rax*4+0Ch] lea r12, [r13-1] mov [rsp+68h+var_60], rax nop dword ptr [rax] loc_13F0: mov eax, [rbp+0] cdq idiv r15d test edx, edx jnz loc_14D9 mov eax, [rbp+4] cdq idiv r15d test edx, edx jnz loc_14D9 mov eax, [rbp+8] cdq idiv r15d test edx, edx jnz loc_14D9 lea eax, [rcx-1] cdqe cmp byte ptr [r13+rax+0], 5Bh ; '[' jz short loc_1441 movsxd rax, ecx mov byte ptr [r13+rax+0], 2Ch ; ',' lea eax, [rcx+1] add ecx, 2 cdqe mov byte ptr [r13+rax+0], 20h ; ' ' loc_1441: lea ebx, [rcx+1] movsxd rcx, ecx xor r9d, r9d mov byte ptr [r13+rcx+0], 28h ; '(' loc_1450: mov r8d, [rbp+r9*4+0] mov edx, 0Ah xor eax, eax mov rdi, r14 lea rcx, unk_2004 mov esi, 1 mov [rsp+68h+var_68], r9 call ___sprintf_chk movzx edx, [rsp+68h+var_4A] mov r9, [rsp+68h+var_68] test dl, dl jz short loc_14A3 lea eax, [rbx+1] mov rcx, r14 movsxd rbx, ebx cdqe sub rcx, rbx nop loc_1490: mov [r12+rax], dl mov ebx, eax add rax, 1 movzx edx, byte ptr [rcx+rax-1] test dl, dl jnz short loc_1490 loc_14A3: lea ecx, [rbx+1] cmp r9, 2 jz short loc_14D0 movsxd rax, ebx movsxd rcx, ecx add ebx, 2 add r9, 1 mov byte ptr [r13+rax+0], 2Ch ; ',' mov byte ptr [r13+rcx+0], 20h ; ' ' jmp short loc_1450 loc_14D0: movsxd rbx, ebx mov byte ptr [r13+rbx+0], 29h ; ')' loc_14D9: add rbp, 0Ch cmp rbp, [rsp+68h+var_60] jnz loc_13F0 lea eax, [rcx+1] loc_14EB: movsxd rcx, ecx cdqe mov byte ptr [r13+rcx+0], 5Dh ; ']' mov byte ptr [r13+rax+0], 0 mov rax, [rsp+68h+var_40] sub rax, fs:28h jnz short loc_1531 add rsp, 38h mov rax, r13 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_151E: mov eax, 2 mov ecx, 1 lea r13, res_1 jmp short loc_14EB loc_1531: call ___stack_chk_fail
char * func0(_DWORD *a1, int a2, int a3) { _DWORD *v4; // rbp int v5; // ecx int v6; // eax int v7; // ebx long long v8; // r9 char v9; // dl long long v10; // rax _BYTE *v11; // rcx long long v12; // rax int v13; // eax long long v15; // [rsp+0h] [rbp-68h] _BYTE v16[10]; // [rsp+1Eh] [rbp-4Ah] BYREF unsigned long long v17; // [rsp+28h] [rbp-40h] v17 = __readfsqword(0x28u); res_1[0] = 91; if ( a2 <= 0 ) { v13 = 2; v5 = 1; } else { v4 = a1; v5 = 1; do { if ( !(*v4 % a3) && !(v4[1] % a3) && !(v4[2] % a3) ) { if ( res_1[v5 - 1] != 91 ) { res_1[v5] = 44; v6 = v5 + 1; v5 += 2; res_1[v6] = 32; } v7 = v5 + 1; v8 = 0LL; for ( res_1[v5] = 40; ; res_1[v5] = 32 ) { v15 = v8; __sprintf_chk(v16, 1LL, 10LL, &unk_2004, (unsigned int)v4[v8]); v9 = v16[0]; if ( v16[0] ) { v10 = v7 + 1; v11 = &v16[-v7]; do { res_1[v10 - 1] = v9; v7 = v10++; v9 = v11[v10 - 1]; } while ( v9 ); } v5 = v7 + 1; if ( v15 == 2 ) break; v12 = v7; v7 += 2; v8 = v15 + 1; res_1[v12] = 44; } res_1[v7] = 41; } v4 += 3; } while ( v4 != &a1[3 * (a2 - 1) + 3] ); v13 = v5 + 1; } res_1[v5] = 93; res_1[v13] = 0; return res_1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x38 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x28],RAX XOR EAX,EAX MOV byte ptr [0x00104040],0x5b TEST ESI,ESI JLE 0x0010151e LEA EAX,[RSI + -0x1] LEA R13,[0x104040] MOV R15D,EDX MOV RBP,RDI LEA RAX,[RAX + RAX*0x2] MOV ECX,0x1 LEA R14,[RSP + 0x1e] LEA RAX,[RDI + RAX*0x4 + 0xc] LEA R12,[R13 + -0x1] MOV qword ptr [RSP + 0x8],RAX NOP dword ptr [RAX] LAB_001013f0: MOV EAX,dword ptr [RBP] CDQ IDIV R15D TEST EDX,EDX JNZ 0x001014d9 MOV EAX,dword ptr [RBP + 0x4] CDQ IDIV R15D TEST EDX,EDX JNZ 0x001014d9 MOV EAX,dword ptr [RBP + 0x8] CDQ IDIV R15D TEST EDX,EDX JNZ 0x001014d9 LEA EAX,[RCX + -0x1] CDQE CMP byte ptr [R13 + RAX*0x1],0x5b JZ 0x00101441 MOVSXD RAX,ECX MOV byte ptr [R13 + RAX*0x1],0x2c LEA EAX,[RCX + 0x1] ADD ECX,0x2 CDQE MOV byte ptr [R13 + RAX*0x1],0x20 LAB_00101441: LEA EBX,[RCX + 0x1] MOVSXD RCX,ECX XOR R9D,R9D MOV byte ptr [R13 + RCX*0x1],0x28 LAB_00101450: MOV R8D,dword ptr [RBP + R9*0x4] MOV EDX,0xa XOR EAX,EAX MOV RDI,R14 LEA RCX,[0x102004] MOV ESI,0x1 MOV qword ptr [RSP],R9 CALL 0x001010b0 MOVZX EDX,byte ptr [RSP + 0x1e] MOV R9,qword ptr [RSP] TEST DL,DL JZ 0x001014a3 LEA EAX,[RBX + 0x1] MOV RCX,R14 MOVSXD RBX,EBX CDQE SUB RCX,RBX NOP LAB_00101490: MOV byte ptr [R12 + RAX*0x1],DL MOV EBX,EAX ADD RAX,0x1 MOVZX EDX,byte ptr [RCX + RAX*0x1 + -0x1] TEST DL,DL JNZ 0x00101490 LAB_001014a3: LEA ECX,[RBX + 0x1] CMP R9,0x2 JZ 0x001014d0 MOVSXD RAX,EBX MOVSXD RCX,ECX ADD EBX,0x2 ADD R9,0x1 MOV byte ptr [R13 + RAX*0x1],0x2c MOV byte ptr [R13 + RCX*0x1],0x20 JMP 0x00101450 LAB_001014d0: MOVSXD RBX,EBX MOV byte ptr [R13 + RBX*0x1],0x29 LAB_001014d9: ADD RBP,0xc CMP RBP,qword ptr [RSP + 0x8] JNZ 0x001013f0 LEA EAX,[RCX + 0x1] LAB_001014eb: MOVSXD RCX,ECX CDQE MOV byte ptr [R13 + RCX*0x1],0x5d MOV byte ptr [R13 + RAX*0x1],0x0 MOV RAX,qword ptr [RSP + 0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101531 ADD RSP,0x38 MOV RAX,R13 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010151e: MOV EAX,0x2 MOV ECX,0x1 LEA R13,[0x104040] JMP 0x001014eb LAB_00101531: CALL 0x00101080
int1 * func0(int *param_1,int param_2,int param_3) { int *piVar1; long lVar2; int iVar3; char cVar4; int iVar5; long lVar6; long lVar7; long in_FS_OFFSET; char local_4a [10]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); res_1 = 0x5b; if (param_2 < 1) { iVar5 = 2; iVar3 = 1; } else { iVar3 = 1; piVar1 = param_1 + (ulong)(param_2 - 1) * 3 + 3; do { if (((*param_1 % param_3 == 0) && (param_1[1] % param_3 == 0)) && (param_1[2] % param_3 == 0)) { if ((&res_1)[iVar3 + -1] != '[') { (&res_1)[iVar3] = 0x2c; iVar5 = iVar3 + 1; iVar3 = iVar3 + 2; (&res_1)[iVar5] = 0x20; } iVar5 = iVar3 + 1; lVar7 = 0; (&res_1)[iVar3] = 0x28; while( true ) { __sprintf_chk(local_4a,1,10,&DAT_00102004,param_1[lVar7]); if (local_4a[0] != '\0') { lVar6 = (long)iVar5; lVar2 = (long)(iVar5 + 1); cVar4 = local_4a[0]; do { (&DAT_0010403f)[lVar2] = cVar4; iVar5 = (int)lVar2; lVar2 = lVar2 + 1; cVar4 = local_4a[(lVar2 - lVar6) + -1]; } while (cVar4 != '\0'); } iVar3 = iVar5 + 1; if (lVar7 == 2) break; lVar2 = (long)iVar5; iVar5 = iVar5 + 2; lVar7 = lVar7 + 1; (&res_1)[lVar2] = 0x2c; (&res_1)[iVar3] = 0x20; } (&res_1)[iVar5] = 0x29; } param_1 = param_1 + 3; } while (param_1 != piVar1); iVar5 = iVar3 + 1; } (&res_1)[iVar3] = 0x5d; (&res_1)[iVar5] = 0; if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return &res_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
4,195
func0
#include <stdio.h> #include <assert.h> #include <stdbool.h> #include <string.h>
char* func0(int test_list[][3], int list_size, int K) { static char res[100]; int index = 0; res[index++] = '['; for (int i = 0; i < list_size; i++) { bool divisible = true; for (int j = 0; j < 3; j++) { if (test_list[i][j] % K != 0) { divisible = false; break; } } if (divisible) { if (res[index - 1] != '[') { res[index++] = ','; res[index++] = ' '; } res[index++] = '('; for (int j = 0; j < 3; j++) { char numStr[10]; sprintf(numStr, "%d", test_list[i][j]); for (int k = 0; numStr[k] != '\0'; k++) { res[index++] = numStr[k]; } if (j != 2) { res[index++] = ','; res[index++] = ' '; } } res[index++] = ')'; } } res[index++] = ']'; res[index] = '\0'; return res; }
int main() { int list1[][3] = {{6, 24, 12}, {7, 9, 6}, {12, 18, 21}}; int list2[][3] = {{5, 25, 30}, {4, 2, 3}, {7, 8, 9}}; int list3[][3] = {{7, 9, 16}, {8, 16, 4}, {19, 17, 18}}; assert(strcmp(func0(list1, 3, 6), "[(6, 24, 12)]") == 0); assert(strcmp(func0(list2, 3, 5), "[(5, 25, 30)]") == 0); assert(strcmp(func0(list3, 3, 4), "[(8, 16, 4)]") == 0); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x38,%rsp mov %fs:0x28,%rax mov %rax,0x28(%rsp) xor %eax,%eax movb $0x5b,0x2ce7(%rip) test %esi,%esi jle 1567 <func0+0x237> lea -0x1(%rsi),%eax mov %edx,%r13d mov %rdi,%r12 mov $0x1,%ecx lea (%rax,%rax,2),%rax lea 0x2cc6(%rip),%rbp lea 0xc(%rdi,%rax,4),%rax mov %rax,0x8(%rsp) nopl 0x0(%rax) mov (%r12),%eax lea 0x1(%rcx),%ebx cltd idiv %r13d test %edx,%edx jne 1508 <func0+0x1d8> mov 0x4(%r12),%eax cltd idiv %r13d test %edx,%edx jne 1508 <func0+0x1d8> mov 0x8(%r12),%eax cltd idiv %r13d test %edx,%edx jne 1508 <func0+0x1d8> lea -0x1(%rcx),%eax cltq cmpb $0x5b,0x0(%rbp,%rax,1) je 13df <func0+0xaf> movslq %ecx,%rax movslq %ebx,%rbx movb $0x2c,0x0(%rbp,%rax,1) movb $0x20,0x0(%rbp,%rbx,1) lea 0x3(%rcx),%ebx add $0x2,%ecx movslq %ecx,%rcx xor %r15d,%r15d lea 0x1e(%rsp),%r14 movb $0x28,0x0(%rbp,%rcx,1) mov (%r12,%r15,4),%r8d mov $0xa,%edx mov $0x1,%esi xor %eax,%eax lea 0xbfe(%rip),%rcx mov %r14,%rdi callq 1090 <__sprintf_chk@plt> movzbl 0x1e(%rsp),%edx test %dl,%dl je 14d9 <func0+0x1a9> movslq %ebx,%rcx lea 0x1(%rbx),%eax mov %dl,0x0(%rbp,%rcx,1) movzbl 0x1f(%rsp),%ecx test %cl,%cl je 1550 <func0+0x220> cltq lea 0x2(%rbx),%edx mov %cl,0x0(%rbp,%rax,1) movzbl 0x20(%rsp),%ecx test %cl,%cl je 1560 <func0+0x230> movslq %edx,%rdx lea 0x3(%rbx),%eax mov %cl,0x0(%rbp,%rdx,1) movzbl 0x21(%rsp),%ecx test %cl,%cl je 1550 <func0+0x220> cltq lea 0x4(%rbx),%edx mov %cl,0x0(%rbp,%rax,1) movzbl 0x22(%rsp),%ecx test %cl,%cl je 1560 <func0+0x230> movslq %edx,%rdx lea 0x5(%rbx),%eax mov %cl,0x0(%rbp,%rdx,1) movzbl 0x23(%rsp),%ecx test %cl,%cl je 1550 <func0+0x220> cltq lea 0x6(%rbx),%edx mov %cl,0x0(%rbp,%rax,1) movzbl 0x24(%rsp),%ecx test %cl,%cl je 1560 <func0+0x230> movslq %edx,%rdx lea 0x7(%rbx),%eax mov %cl,0x0(%rbp,%rdx,1) movzbl 0x25(%rsp),%ecx test %cl,%cl je 1550 <func0+0x220> cltq lea 0x8(%rbx),%edx mov %cl,0x0(%rbp,%rax,1) movzbl 0x26(%rsp),%eax test %al,%al je 1560 <func0+0x230> movslq %edx,%rdx add $0x9,%ebx mov %al,0x0(%rbp,%rdx,1) lea 0x1(%rbx),%ecx movslq %ebx,%rax cmp $0x2,%r15 je 1500 <func0+0x1d0> movslq %ecx,%rcx movb $0x2c,0x0(%rbp,%rax,1) add $0x2,%ebx add $0x1,%r15 movb $0x20,0x0(%rbp,%rcx,1) jmpq 13ef <func0+0xbf> xchg %ax,%ax movb $0x29,0x0(%rbp,%rax,1) add $0x2,%ebx add $0xc,%r12 cmp 0x8(%rsp),%r12 jne 1388 <func0+0x58> movslq %ecx,%rcx movslq %ebx,%rbx movb $0x5d,0x0(%rbp,%rcx,1) movb $0x0,0x0(%rbp,%rbx,1) mov 0x28(%rsp),%rax xor %fs:0x28,%rax jne 157a <func0+0x24a> add $0x38,%rsp lea 0x2afe(%rip),%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl (%rax) mov %eax,%ebx jmpq 14d9 <func0+0x1a9> nopw 0x0(%rax,%rax,1) mov %edx,%ebx jmpq 14d9 <func0+0x1a9> mov $0x2,%ebx mov $0x1,%ecx lea 0x2ac8(%rip),%rbp jmp 1517 <func0+0x1e7> callq 1070 <__stack_chk_fail@plt>
func0: endbr64 push r15 mov ecx, 1 push r14 push r13 push r12 push rbp lea rbp, res_1 push rbx sub rsp, 38h mov rax, fs:28h mov [rsp+68h+var_40], rax xor eax, eax mov cs:res_1, 5Bh ; '[' mov eax, 2 test esi, esi jle loc_151E movsxd rsi, esi mov rbx, rdi mov r13d, edx mov ecx, 1 lea rax, [rsi+rsi*2] lea rbp, res_1 lea r12, [rdi+rax*4] lea rax, [rsp+68h+var_4A] mov [rsp+68h+var_60], rax nop dword ptr [rax+00000000h] loc_13A0: mov eax, [rbx] cdq idiv r13d test edx, edx jnz loc_1558 mov eax, [rbx+4] cdq idiv r13d test edx, edx jnz loc_1558 mov eax, [rbx+8] cdq idiv r13d test edx, edx jnz loc_1558 lea eax, [rcx-1] cdqe cmp byte ptr [rbp+rax+0], 5Bh ; '[' jz short loc_13EA movzx esi, cs:word_20F6 movsxd rax, ecx add ecx, 2 mov [rbp+rax+0], si loc_13EA: lea r15d, [rcx+1] movsxd rcx, ecx mov r14, rbx mov byte ptr [rbp+rcx+0], 28h ; '(' lea rbx, [rbx+0Ch] loc_13FD: mov r8d, [r14] mov rdi, [rsp+68h+var_60] mov edx, 0Ah xor eax, eax lea rcx, unk_2004 mov esi, 2 call ___sprintf_chk movzx edx, [rsp+68h+var_4A] test dl, dl jz loc_1560 movsxd rcx, r15d lea eax, [r15+1] mov [rbp+rcx+0], dl movzx ecx, [rsp+68h+var_49] test cl, cl jz loc_14E1 cdqe lea edx, [r15+2] mov [rbp+rax+0], cl movzx ecx, [rsp+68h+var_48] test cl, cl jz loc_1550 movsxd rdx, edx lea eax, [r15+3] mov [rbp+rdx+0], cl movzx ecx, [rsp+68h+var_47] test cl, cl jz short loc_14E1 cdqe lea edx, [r15+4] mov [rbp+rax+0], cl movzx ecx, [rsp+68h+var_46] test cl, cl jz loc_1550 movsxd rdx, edx lea eax, [r15+5] mov [rbp+rdx+0], cl movzx ecx, [rsp+68h+var_45] test cl, cl jz short loc_14E1 cdqe lea edx, [r15+6] mov [rbp+rax+0], cl movzx ecx, [rsp+68h+var_44] test cl, cl jz loc_1550 movsxd rdx, edx lea eax, [r15+7] mov [rbp+rdx+0], cl movzx ecx, [rsp+68h+var_43] test cl, cl jz short loc_14E1 cdqe lea edx, [r15+8] mov [rbp+rax+0], cl movzx ecx, [rsp+68h+var_42] test cl, cl jz short loc_1550 movsxd rdx, edx lea eax, [r15+9] mov [rbp+rdx+0], cl loc_14E1: add r14, 4 cmp r14, rbx jz short loc_1508 movzx edi, cs:word_20F6 lea r15d, [rax+2] cdqe mov [rbp+rax+0], di jmp loc_13FD loc_1508: lea ecx, [rax+1] cdqe mov byte ptr [rbp+rax+0], 29h ; ')' loc_1512: cmp rbx, r12 jnz loc_13A0 lea eax, [rcx+1] loc_151E: movsxd rcx, ecx cdqe mov byte ptr [rbp+rcx+0], 5Dh ; ']' mov byte ptr [rbp+rax+0], 0 mov rax, [rsp+68h+var_40] sub rax, fs:28h jnz short loc_1568 add rsp, 38h mov rax, rbp pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1550: mov eax, edx jmp short loc_14E1 loc_1558: add rbx, 0Ch jmp short loc_1512 loc_1560: mov eax, r15d jmp loc_14E1 loc_1568: call ___stack_chk_fail
char * func0(unsigned int *a1, int a2, int a3) { int v3; // ecx int v4; // eax unsigned int *v5; // rbx long long v7; // rax int v8; // r15d unsigned int *v9; // r14 int v10; // eax int v11; // edx char v13; // [rsp+1Eh] [rbp-4Ah] BYREF char v14; // [rsp+1Fh] [rbp-49h] char v15; // [rsp+20h] [rbp-48h] char v16; // [rsp+21h] [rbp-47h] char v17; // [rsp+22h] [rbp-46h] char v18; // [rsp+23h] [rbp-45h] char v19; // [rsp+24h] [rbp-44h] char v20; // [rsp+25h] [rbp-43h] char v21; // [rsp+26h] [rbp-42h] unsigned long long v22; // [rsp+28h] [rbp-40h] v3 = 1; v22 = __readfsqword(0x28u); res_1[0] = 91; v4 = 2; if ( a2 > 0 ) { v5 = a1; v3 = 1; while ( (int)*v5 % a3 || (int)v5[1] % a3 || (int)v5[2] % a3 ) { v5 += 3; LABEL_22: if ( v5 == &a1[3 * a2] ) { v4 = v3 + 1; goto LABEL_24; } } if ( res_1[v3 - 1] != 91 ) { v7 = v3; v3 += 2; *(_WORD *)&res_1[v7] = 8236; } v8 = v3 + 1; v9 = v5; res_1[v3] = 40; v5 += 3; while ( 1 ) { __sprintf_chk(&v13, 2LL, 10LL, &unk_2004, *v9); if ( v13 ) { v10 = v8 + 1; res_1[v8] = v13; if ( !v14 ) goto LABEL_19; v11 = v8 + 2; res_1[v10] = v14; if ( !v15 ) goto LABEL_25; v10 = v8 + 3; res_1[v11] = v15; if ( !v16 ) goto LABEL_19; v11 = v8 + 4; res_1[v10] = v16; if ( !v17 ) goto LABEL_25; v10 = v8 + 5; res_1[v11] = v17; if ( !v18 ) goto LABEL_19; v11 = v8 + 6; res_1[v10] = v18; if ( !v19 ) goto LABEL_25; v10 = v8 + 7; res_1[v11] = v19; if ( !v20 ) goto LABEL_19; v11 = v8 + 8; res_1[v10] = v20; if ( v21 ) { v10 = v8 + 9; res_1[v11] = v21; } else { LABEL_25: v10 = v11; } } else { v10 = v8; } LABEL_19: if ( ++v9 == v5 ) { v3 = v10 + 1; res_1[v10] = 41; goto LABEL_22; } v8 = v10 + 2; *(_WORD *)&res_1[v10] = 8236; } } LABEL_24: res_1[v3] = 93; res_1[v4] = 0; return res_1; }
func0: ENDBR64 PUSH R15 MOV ECX,0x1 PUSH R14 PUSH R13 PUSH R12 PUSH RBP LEA RBP,[0x104040] PUSH RBX SUB RSP,0x38 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x28],RAX XOR EAX,EAX MOV byte ptr [0x00104040],0x5b MOV EAX,0x2 TEST ESI,ESI JLE 0x0010151e MOVSXD RSI,ESI MOV RBX,RDI MOV R13D,EDX MOV ECX,0x1 LEA RAX,[RSI + RSI*0x2] LEA RBP,[0x104040] LEA R12,[RDI + RAX*0x4] LEA RAX,[RSP + 0x1e] MOV qword ptr [RSP + 0x8],RAX NOP dword ptr [RAX] LAB_001013a0: MOV EAX,dword ptr [RBX] CDQ IDIV R13D TEST EDX,EDX JNZ 0x00101558 MOV EAX,dword ptr [RBX + 0x4] CDQ IDIV R13D TEST EDX,EDX JNZ 0x00101558 MOV EAX,dword ptr [RBX + 0x8] CDQ IDIV R13D TEST EDX,EDX JNZ 0x00101558 LEA EAX,[RCX + -0x1] CDQE CMP byte ptr [RBP + RAX*0x1],0x5b JZ 0x001013ea MOVZX ESI,word ptr [0x001020f6] MOVSXD RAX,ECX ADD ECX,0x2 MOV word ptr [RBP + RAX*0x1],SI LAB_001013ea: LEA R15D,[RCX + 0x1] MOVSXD RCX,ECX MOV R14,RBX MOV byte ptr [RBP + RCX*0x1],0x28 LEA RBX,[RBX + 0xc] LAB_001013fd: MOV R8D,dword ptr [R14] MOV RDI,qword ptr [RSP + 0x8] MOV EDX,0xa XOR EAX,EAX LEA RCX,[0x102004] MOV ESI,0x2 CALL 0x001010b0 MOVZX EDX,byte ptr [RSP + 0x1e] TEST DL,DL JZ 0x00101560 MOVSXD RCX,R15D LEA EAX,[R15 + 0x1] MOV byte ptr [RBP + RCX*0x1],DL MOVZX ECX,byte ptr [RSP + 0x1f] TEST CL,CL JZ 0x001014e1 CDQE LEA EDX,[R15 + 0x2] MOV byte ptr [RBP + RAX*0x1],CL MOVZX ECX,byte ptr [RSP + 0x20] TEST CL,CL JZ 0x00101550 MOVSXD RDX,EDX LEA EAX,[R15 + 0x3] MOV byte ptr [RBP + RDX*0x1],CL MOVZX ECX,byte ptr [RSP + 0x21] TEST CL,CL JZ 0x001014e1 CDQE LEA EDX,[R15 + 0x4] MOV byte ptr [RBP + RAX*0x1],CL MOVZX ECX,byte ptr [RSP + 0x22] TEST CL,CL JZ 0x00101550 MOVSXD RDX,EDX LEA EAX,[R15 + 0x5] MOV byte ptr [RBP + RDX*0x1],CL MOVZX ECX,byte ptr [RSP + 0x23] TEST CL,CL JZ 0x001014e1 CDQE LEA EDX,[R15 + 0x6] MOV byte ptr [RBP + RAX*0x1],CL MOVZX ECX,byte ptr [RSP + 0x24] TEST CL,CL JZ 0x00101550 MOVSXD RDX,EDX LEA EAX,[R15 + 0x7] MOV byte ptr [RBP + RDX*0x1],CL MOVZX ECX,byte ptr [RSP + 0x25] TEST CL,CL JZ 0x001014e1 CDQE LEA EDX,[R15 + 0x8] MOV byte ptr [RBP + RAX*0x1],CL MOVZX ECX,byte ptr [RSP + 0x26] TEST CL,CL JZ 0x00101550 MOVSXD RDX,EDX LEA EAX,[R15 + 0x9] MOV byte ptr [RBP + RDX*0x1],CL LAB_001014e1: ADD R14,0x4 CMP R14,RBX JZ 0x00101508 MOVZX EDI,word ptr [0x001020f6] LEA R15D,[RAX + 0x2] CDQE MOV word ptr [RBP + RAX*0x1],DI JMP 0x001013fd LAB_00101508: LEA ECX,[RAX + 0x1] CDQE MOV byte ptr [RBP + RAX*0x1],0x29 LAB_00101512: CMP RBX,R12 JNZ 0x001013a0 LEA EAX,[RCX + 0x1] LAB_0010151e: MOVSXD RCX,ECX CDQE MOV byte ptr [RBP + RCX*0x1],0x5d MOV byte ptr [RBP + RAX*0x1],0x0 MOV RAX,qword ptr [RSP + 0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101568 ADD RSP,0x38 MOV RAX,RBP POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101550: MOV EAX,EDX JMP 0x001014e1 LAB_00101558: ADD RBX,0xc JMP 0x00101512 LAB_00101560: MOV EAX,R15D JMP 0x001014e1 LAB_00101568: CALL 0x00101080
int1 * func0(int *param_1,int param_2,int param_3) { int *piVar1; int iVar2; long lVar3; int iVar4; int iVar5; int *piVar6; long in_FS_OFFSET; char local_4a; char local_49; char local_48; char local_47; char local_46; char local_45; char local_44; char local_43; char local_42; long local_40; iVar4 = 1; local_40 = *(long *)(in_FS_OFFSET + 0x28); res_1 = 0x5b; iVar2 = 2; if (0 < param_2) { iVar4 = 1; piVar1 = param_1 + (long)param_2 * 3; do { if (((*param_1 % param_3 == 0) && (param_1[1] % param_3 == 0)) && (param_1[2] % param_3 == 0)) { if ((&res_1)[iVar4 + -1] != '[') { lVar3 = (long)iVar4; iVar4 = iVar4 + 2; *(int2 *)(&res_1 + lVar3) = DAT_001020f6; } iVar2 = iVar4 + 1; (&res_1)[iVar4] = 0x28; piVar6 = param_1; while( true ) { __sprintf_chk(&local_4a,2,10,&DAT_00102004,*piVar6); iVar5 = iVar2; if (local_4a != '\0') { (&res_1)[iVar2] = local_4a; iVar5 = iVar2 + 1; if (local_49 != '\0') { iVar5 = iVar2 + 2; (&res_1)[iVar2 + 1] = local_49; if (local_48 != '\0') { (&res_1)[iVar5] = local_48; iVar5 = iVar2 + 3; if (local_47 != '\0') { iVar5 = iVar2 + 4; (&res_1)[iVar2 + 3] = local_47; if (local_46 != '\0') { (&res_1)[iVar5] = local_46; iVar5 = iVar2 + 5; if (local_45 != '\0') { iVar5 = iVar2 + 6; (&res_1)[iVar2 + 5] = local_45; if (local_44 != '\0') { (&res_1)[iVar5] = local_44; iVar5 = iVar2 + 7; if (local_43 != '\0') { iVar5 = iVar2 + 8; (&res_1)[iVar2 + 7] = local_43; if (local_42 != '\0') { (&res_1)[iVar5] = local_42; iVar5 = iVar2 + 9; } } } } } } } } } piVar6 = piVar6 + 1; if (piVar6 == param_1 + 3) break; iVar2 = iVar5 + 2; *(int2 *)(&res_1 + iVar5) = DAT_001020f6; } iVar4 = iVar5 + 1; (&res_1)[iVar5] = 0x29; } param_1 = param_1 + 3; } while (param_1 != piVar1); iVar2 = iVar4 + 1; } (&res_1)[iVar4] = 0x5d; (&res_1)[iVar2] = 0; if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return &res_1; }
4,196
func0
#include <assert.h>
int func0(int m, int n) { if (n < m) { int temp = m; m = n; n = temp; } return (int)(m * (m + 1) * (2 * m + 1) / 6 + (n - m) * m * (m + 1) / 2); }
int main() { assert(func0(4, 3) == 20); assert(func0(2, 2) == 5); assert(func0(1, 1) == 1); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) mov -0x18(%rbp),%eax cmp -0x14(%rbp),%eax jge 1171 <func0+0x28> mov -0x14(%rbp),%eax mov %eax,-0x4(%rbp) mov -0x18(%rbp),%eax mov %eax,-0x14(%rbp) mov -0x4(%rbp),%eax mov %eax,-0x18(%rbp) mov -0x14(%rbp),%eax add $0x1,%eax imul -0x14(%rbp),%eax mov -0x14(%rbp),%edx add %edx,%edx add $0x1,%edx imul %edx,%eax movslq %eax,%rdx imul $0x2aaaaaab,%rdx,%rdx shr $0x20,%rdx sar $0x1f,%eax mov %edx,%ecx sub %eax,%ecx mov -0x18(%rbp),%eax sub -0x14(%rbp),%eax imul -0x14(%rbp),%eax mov -0x14(%rbp),%edx add $0x1,%edx imul %edx,%eax mov %eax,%edx shr $0x1f,%edx add %edx,%eax sar %eax add %ecx,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_18], esi mov eax, [rbp+var_18] cmp eax, [rbp+var_14] jge short loc_1171 mov eax, [rbp+var_14] mov [rbp+var_4], eax mov eax, [rbp+var_18] mov [rbp+var_14], eax mov eax, [rbp+var_4] mov [rbp+var_18], eax loc_1171: mov eax, [rbp+var_14] add eax, 1 imul eax, [rbp+var_14] mov edx, [rbp+var_14] add edx, edx add edx, 1 imul eax, edx movsxd rdx, eax imul rdx, 2AAAAAABh shr rdx, 20h sar eax, 1Fh mov ecx, edx sub ecx, eax mov eax, [rbp+var_18] sub eax, [rbp+var_14] imul eax, [rbp+var_14] mov edx, [rbp+var_14] add edx, 1 imul eax, edx mov edx, eax shr edx, 1Fh add eax, edx sar eax, 1 add eax, ecx pop rbp retn
long long func0(int a1, int a2) { int v3; // [rsp+0h] [rbp-18h] int v4; // [rsp+4h] [rbp-14h] v4 = a1; v3 = a2; if ( a2 < a1 ) { v4 = a2; v3 = a1; } return (unsigned int)((2 * v4 + 1) * v4 * (v4 + 1) / 6 + (v4 + 1) * v4 * (v3 - v4) / 2); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x18],ESI MOV EAX,dword ptr [RBP + -0x18] CMP EAX,dword ptr [RBP + -0x14] JGE 0x00101171 MOV EAX,dword ptr [RBP + -0x14] MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x18] MOV dword ptr [RBP + -0x14],EAX MOV EAX,dword ptr [RBP + -0x4] MOV dword ptr [RBP + -0x18],EAX LAB_00101171: MOV EAX,dword ptr [RBP + -0x14] ADD EAX,0x1 IMUL EAX,dword ptr [RBP + -0x14] MOV EDX,dword ptr [RBP + -0x14] ADD EDX,EDX ADD EDX,0x1 IMUL EAX,EDX MOVSXD RDX,EAX IMUL RDX,RDX,0x2aaaaaab SHR RDX,0x20 SAR EAX,0x1f MOV ECX,EDX SUB ECX,EAX MOV EAX,dword ptr [RBP + -0x18] SUB EAX,dword ptr [RBP + -0x14] IMUL EAX,dword ptr [RBP + -0x14] MOV EDX,dword ptr [RBP + -0x14] ADD EDX,0x1 IMUL EAX,EDX MOV EDX,EAX SHR EDX,0x1f ADD EAX,EDX SAR EAX,0x1 ADD EAX,ECX POP RBP RET
int func0(int param_1,int param_2) { int4 local_20; int4 local_1c; local_20 = param_2; local_1c = param_1; if (param_2 < param_1) { local_20 = param_1; local_1c = param_2; } return ((local_20 - local_1c) * local_1c * (local_1c + 1)) / 2 + ((local_1c + 1) * local_1c * (local_1c * 2 + 1)) / 6; }
4,197
func0
#include <assert.h>
int func0(int m, int n) { if (n < m) { int temp = m; m = n; n = temp; } return (int)(m * (m + 1) * (2 * m + 1) / 6 + (n - m) * m * (m + 1) / 2); }
int main() { assert(func0(4, 3) == 20); assert(func0(2, 2) == 5); assert(func0(1, 1) == 1); return 0; }
O1
c
func0: endbr64 cmp %edi,%esi jge 1157 <func0+0xe> mov %edi,%eax mov %esi,%edi mov %eax,%esi lea 0x1(%rdi),%ecx lea 0x1(%rdi,%rdi,1),%edx mov %ecx,%eax imul %edi,%eax imul %eax,%edx movslq %edx,%rax imul $0x2aaaaaab,%rax,%rax shr $0x20,%rax sar $0x1f,%edx sub %edx,%eax mov %eax,%edx sub %edi,%esi imul %edi,%esi imul %ecx,%esi mov %esi,%eax shr $0x1f,%eax add %esi,%eax sar %eax lea (%rdx,%rax,1),%eax retq
func0: endbr64 cmp esi, edi jge short loc_1157 mov eax, edi mov edi, esi mov esi, eax loc_1157: lea ecx, [rdi+1] lea edx, [rdi+rdi+1] mov eax, ecx imul eax, edi imul edx, eax movsxd rax, edx imul rax, 2AAAAAABh shr rax, 20h sar edx, 1Fh sub eax, edx sub esi, edi imul esi, edi imul esi, ecx mov edx, esi shr edx, 1Fh add edx, esi sar edx, 1 add eax, edx retn
long long func0(int a1, int a2) { int v2; // eax if ( a2 < a1 ) { v2 = a1; a1 = a2; a2 = v2; } return (unsigned int)((a1 + 1) * a1 * (a2 - a1) / 2 + a1 * (a1 + 1) * (2 * a1 + 1) / 6); }
func0: ENDBR64 CMP ESI,EDI JGE 0x00101157 MOV EAX,EDI MOV EDI,ESI MOV ESI,EAX LAB_00101157: LEA ECX,[RDI + 0x1] LEA EDX,[RDI + RDI*0x1 + 0x1] MOV EAX,ECX IMUL EAX,EDI IMUL EDX,EAX MOVSXD RAX,EDX IMUL RAX,RAX,0x2aaaaaab SHR RAX,0x20 SAR EDX,0x1f SUB EAX,EDX SUB ESI,EDI IMUL ESI,EDI IMUL ESI,ECX MOV EDX,ESI SHR EDX,0x1f ADD EDX,ESI SAR EDX,0x1 ADD EAX,EDX RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = param_2; if (param_2 < param_1) { iVar1 = param_1; param_1 = param_2; } return ((param_1 * 2 + 1) * (param_1 + 1) * param_1) / 6 + ((iVar1 - param_1) * param_1 * (param_1 + 1)) / 2; }
4,198
func0
#include <assert.h>
int func0(int m, int n) { if (n < m) { int temp = m; m = n; n = temp; } return (int)(m * (m + 1) * (2 * m + 1) / 6 + (n - m) * m * (m + 1) / 2); }
int main() { assert(func0(4, 3) == 20); assert(func0(2, 2) == 5); assert(func0(1, 1) == 1); return 0; }
O2
c
func0: endbr64 cmp %edi,%esi jge 114e <func0+0xe> mov %edi,%eax mov %esi,%edi mov %eax,%esi lea 0x1(%rdi),%ecx lea 0x1(%rdi,%rdi,1),%edx sub %edi,%esi mov %ecx,%eax imul %edi,%esi imul %edi,%eax imul %ecx,%esi imul %eax,%edx movslq %edx,%rax sar $0x1f,%edx imul $0x2aaaaaab,%rax,%rax shr $0x20,%rax sub %edx,%eax mov %eax,%edx mov %esi,%eax shr $0x1f,%eax add %esi,%eax sar %eax lea (%rdx,%rax,1),%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 cmp esi, edi jge short loc_120E mov eax, edi mov edi, esi mov esi, eax loc_120E: lea ecx, [rdi+1] lea edx, [rdi+rdi+1] sub esi, edi mov eax, ecx imul esi, edi imul eax, edi imul esi, ecx imul edx, eax movsxd rax, edx sar edx, 1Fh imul rax, 2AAAAAABh shr rax, 20h sub eax, edx mov edx, esi shr edx, 1Fh add edx, esi sar edx, 1 add eax, edx retn
long long func0(int a1, int a2) { int v2; // eax if ( a2 < a1 ) { v2 = a1; a1 = a2; a2 = v2; } return (unsigned int)((a1 + 1) * a1 * (a2 - a1) / 2 + a1 * (a1 + 1) * (2 * a1 + 1) / 6); }
func0: ENDBR64 CMP ESI,EDI JGE 0x0010120e MOV EAX,EDI MOV EDI,ESI MOV ESI,EAX LAB_0010120e: LEA ECX,[RDI + 0x1] LEA EDX,[RDI + RDI*0x1 + 0x1] SUB ESI,EDI MOV EAX,ECX IMUL ESI,EDI IMUL EAX,EDI IMUL ESI,ECX IMUL EDX,EAX MOVSXD RAX,EDX SAR EDX,0x1f IMUL RAX,RAX,0x2aaaaaab SHR RAX,0x20 SUB EAX,EDX MOV EDX,ESI SHR EDX,0x1f ADD EDX,ESI SAR EDX,0x1 ADD EAX,EDX RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = param_2; if (param_2 < param_1) { iVar1 = param_1; param_1 = param_2; } return ((param_1 * 2 + 1) * (param_1 + 1) * param_1) / 6 + ((iVar1 - param_1) * param_1 * (param_1 + 1)) / 2; }
4,199
func0
#include <assert.h>
int func0(int m, int n) { if (n < m) { int temp = m; m = n; n = temp; } return (int)(m * (m + 1) * (2 * m + 1) / 6 + (n - m) * m * (m + 1) / 2); }
int main() { assert(func0(4, 3) == 20); assert(func0(2, 2) == 5); assert(func0(1, 1) == 1); return 0; }
O3
c
func0: endbr64 cmp %edi,%esi jge 114e <func0+0xe> mov %edi,%eax mov %esi,%edi mov %eax,%esi lea 0x1(%rdi),%ecx lea 0x1(%rdi,%rdi,1),%edx sub %edi,%esi mov %ecx,%eax imul %edi,%esi imul %edi,%eax imul %ecx,%esi imul %eax,%edx movslq %edx,%rax sar $0x1f,%edx imul $0x2aaaaaab,%rax,%rax shr $0x20,%rax sub %edx,%eax mov %eax,%edx mov %esi,%eax shr $0x1f,%eax add %esi,%eax sar %eax lea (%rdx,%rax,1),%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 cmp esi, edi jl short loc_114E mov eax, esi mov esi, edi mov edi, eax loc_114E: lea ecx, [rsi+1] lea edx, [rsi+rsi+1] sub edi, esi mov eax, ecx imul edi, esi imul eax, esi imul edi, ecx imul edx, eax movsxd rax, edx sar edx, 1Fh imul rax, 2AAAAAABh shr rax, 20h sub eax, edx mov edx, edi shr edx, 1Fh add edx, edi sar edx, 1 add eax, edx retn
long long func0(int a1, int a2) { int v2; // eax if ( a2 >= a1 ) { v2 = a2; a2 = a1; a1 = v2; } return (unsigned int)((a2 + 1) * a2 * (a1 - a2) / 2 + a2 * (a2 + 1) * (2 * a2 + 1) / 6); }
func0: ENDBR64 CMP ESI,EDI JL 0x0010114e MOV EAX,ESI MOV ESI,EDI MOV EDI,EAX LAB_0010114e: LEA ECX,[RSI + 0x1] LEA EDX,[RSI + RSI*0x1 + 0x1] SUB EDI,ESI MOV EAX,ECX IMUL EDI,ESI IMUL EAX,ESI IMUL EDI,ECX IMUL EDX,EAX MOVSXD RAX,EDX SAR EDX,0x1f IMUL RAX,RAX,0x2aaaaaab SHR RAX,0x20 SUB EAX,EDX MOV EDX,EDI SHR EDX,0x1f ADD EDX,EDI SAR EDX,0x1 ADD EAX,EDX RET
int func0(int param_1,int param_2) { int iVar1; iVar1 = param_2; if (param_1 <= param_2) { iVar1 = param_1; param_1 = param_2; } return ((iVar1 * 2 + 1) * (iVar1 + 1) * iVar1) / 6 + ((param_1 - iVar1) * iVar1 * (iVar1 + 1)) / 2 ; }
4,200
func0
#include <stdbool.h> #include <assert.h>
bool func0(int n) { return (n % 11 == 0); }
int main() { assert(func0(12345) == false); assert(func0(1212112) == true); assert(func0(1212) == false); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov -0x4(%rbp),%ecx movslq %ecx,%rax imul $0x2e8ba2e9,%rax,%rax shr $0x20,%rax mov %eax,%edx sar %edx mov %ecx,%eax sar $0x1f,%eax sub %eax,%edx mov %edx,%eax shl $0x2,%eax add %edx,%eax add %eax,%eax add %edx,%eax sub %eax,%ecx mov %ecx,%edx test %edx,%edx sete %al pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov ecx, [rbp+var_4] movsxd rax, ecx imul rax, 2E8BA2E9h shr rax, 20h mov edx, eax sar edx, 1 mov eax, ecx sar eax, 1Fh sub edx, eax mov eax, edx shl eax, 2 add eax, edx add eax, eax add eax, edx sub ecx, eax mov edx, ecx test edx, edx setz al pop rbp retn
bool func0(int a1) { return a1 % 11 == 0; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV ECX,dword ptr [RBP + -0x4] MOVSXD RAX,ECX IMUL RAX,RAX,0x2e8ba2e9 SHR RAX,0x20 MOV EDX,EAX SAR EDX,0x1 MOV EAX,ECX SAR EAX,0x1f SUB EDX,EAX MOV EAX,EDX SHL EAX,0x2 ADD EAX,EDX ADD EAX,EAX ADD EAX,EDX SUB ECX,EAX MOV EDX,ECX TEST EDX,EDX SETZ AL POP RBP RET
int4 func0(int param_1) { return CONCAT31((int3)((uint)((param_1 / 0xb) * 0xb) >> 8),param_1 % 0xb == 0); }
4,201
func0
#include <stdbool.h> #include <assert.h>
bool func0(int n) { return (n % 11 == 0); }
int main() { assert(func0(12345) == false); assert(func0(1212112) == true); assert(func0(1212) == false); return 0; }
O1
c
func0: endbr64 movslq %edi,%rax imul $0x2e8ba2e9,%rax,%rax sar $0x21,%rax mov %edi,%edx sar $0x1f,%edx sub %edx,%eax lea (%rax,%rax,4),%edx lea (%rax,%rdx,2),%eax cmp %eax,%edi sete %al retq
func0: endbr64 movsxd rax, edi imul rax, 2E8BA2E9h sar rax, 21h mov edx, edi sar edx, 1Fh sub eax, edx lea edx, [rax+rax*4] lea eax, [rax+rdx*2] cmp edi, eax setz al retn
bool func0(int a1) { return a1 == 11 * (a1 / 11); }
func0: ENDBR64 MOVSXD RAX,EDI IMUL RAX,RAX,0x2e8ba2e9 SAR RAX,0x21 MOV EDX,EDI SAR EDX,0x1f SUB EAX,EDX LEA EDX,[RAX + RAX*0x4] LEA EAX,[RAX + RDX*0x2] CMP EDI,EAX SETZ AL RET
int4 func0(int param_1) { int iVar1; iVar1 = (param_1 / 0xb) * 0xb; return CONCAT31((int3)((uint)iVar1 >> 8),param_1 == iVar1); }
4,202
func0
#include <stdbool.h> #include <assert.h>
bool func0(int n) { return (n % 11 == 0); }
int main() { assert(func0(12345) == false); assert(func0(1212112) == true); assert(func0(1212) == false); return 0; }
O2
c
func0: endbr64 imul $0xba2e8ba3,%edi,%edi add $0xba2e8ba,%edi cmp $0x1745d174,%edi setbe %al retq nopw 0x0(%rax,%rax,1)
func0: endbr64 imul edi, 0BA2E8BA3h add edi, 0BA2E8BAh cmp edi, 1745D174h setbe al retn
bool func0(int a1) { return (unsigned int)(-1171354717 * a1 + 195225786) <= 0x1745D174; }
func0: ENDBR64 IMUL EDI,EDI,-0x45d1745d ADD EDI,0xba2e8ba CMP EDI,0x1745d174 SETBE AL RET
bool func0(int param_1) { return param_1 * -0x45d1745d + 0xba2e8baU < 0x1745d175; }
4,203
func0
#include <stdbool.h> #include <assert.h>
bool func0(int n) { return (n % 11 == 0); }
int main() { assert(func0(12345) == false); assert(func0(1212112) == true); assert(func0(1212) == false); return 0; }
O3
c
func0: endbr64 imul $0xba2e8ba3,%edi,%edi add $0xba2e8ba,%edi cmp $0x1745d174,%edi setbe %al retq nopw 0x0(%rax,%rax,1)
func0: endbr64 imul edi, 0BA2E8BA3h add edi, 0BA2E8BAh cmp edi, 1745D174h setbe al retn
bool func0(int a1) { return (unsigned int)(-1171354717 * a1 + 195225786) <= 0x1745D174; }
func0: ENDBR64 IMUL EDI,EDI,-0x45d1745d ADD EDI,0xba2e8ba CMP EDI,0x1745d174 SETBE AL RET
bool func0(int param_1) { return param_1 * -0x45d1745d + 0xba2e8baU < 0x1745d175; }
4,204
func0
#include <stdio.h> #include <assert.h>
int func0(int n) { if (n % 2 != 0) { return (n + 1) / 2; } int count = 0; for (int i = 0; i < 32; i++) { // Assuming 32 bit integer count += (n >> i) & 1; } int ans = n / 2; if (count % 2 != 0) { ans += 1; } return ans; }
int main() { assert(func0(5) == 3); assert(func0(10) == 5); assert(func0(15) == 8); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov -0x14(%rbp),%eax and $0x1,%eax test %eax,%eax je 116f <func0+0x26> mov -0x14(%rbp),%eax add $0x1,%eax mov %eax,%edx shr $0x1f,%edx add %edx,%eax sar %eax jmp 11bb <func0+0x72> movl $0x0,-0xc(%rbp) movl $0x0,-0x8(%rbp) jmp 1195 <func0+0x4c> mov -0x8(%rbp),%eax mov -0x14(%rbp),%edx mov %eax,%ecx sar %cl,%edx mov %edx,%eax and $0x1,%eax add %eax,-0xc(%rbp) addl $0x1,-0x8(%rbp) cmpl $0x1f,-0x8(%rbp) jle 117f <func0+0x36> mov -0x14(%rbp),%eax mov %eax,%edx shr $0x1f,%edx add %edx,%eax sar %eax mov %eax,-0x4(%rbp) mov -0xc(%rbp),%eax and $0x1,%eax test %eax,%eax je 11b8 <func0+0x6f> addl $0x1,-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] and eax, 1 test eax, eax jz short loc_116F mov eax, [rbp+var_14] add eax, 1 mov edx, eax shr edx, 1Fh add eax, edx sar eax, 1 jmp short loc_11BB loc_116F: mov [rbp+var_C], 0 mov [rbp+var_8], 0 jmp short loc_1195 loc_117F: mov eax, [rbp+var_8] mov edx, [rbp+var_14] mov ecx, eax sar edx, cl mov eax, edx and eax, 1 add [rbp+var_C], eax add [rbp+var_8], 1 loc_1195: cmp [rbp+var_8], 1Fh jle short loc_117F mov eax, [rbp+var_14] mov edx, eax shr edx, 1Fh add eax, edx sar eax, 1 mov [rbp+var_4], eax mov eax, [rbp+var_C] and eax, 1 test eax, eax jz short loc_11B8 add [rbp+var_4], 1 loc_11B8: mov eax, [rbp+var_4] loc_11BB: pop rbp retn
long long func0(int a1) { int v2; // [rsp+8h] [rbp-Ch] int i; // [rsp+Ch] [rbp-8h] unsigned int v4; // [rsp+10h] [rbp-4h] if ( (a1 & 1) != 0 ) return (unsigned int)((a1 + 1) / 2); v2 = 0; for ( i = 0; i <= 31; ++i ) v2 += (a1 >> i) & 1; v4 = a1 / 2; if ( (v2 & 1) != 0 ) ++v4; return v4; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV EAX,dword ptr [RBP + -0x14] AND EAX,0x1 TEST EAX,EAX JZ 0x0010116f MOV EAX,dword ptr [RBP + -0x14] ADD EAX,0x1 MOV EDX,EAX SHR EDX,0x1f ADD EAX,EDX SAR EAX,0x1 JMP 0x001011bb LAB_0010116f: MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x8],0x0 JMP 0x00101195 LAB_0010117f: MOV EAX,dword ptr [RBP + -0x8] MOV EDX,dword ptr [RBP + -0x14] MOV ECX,EAX SAR EDX,CL MOV EAX,EDX AND EAX,0x1 ADD dword ptr [RBP + -0xc],EAX ADD dword ptr [RBP + -0x8],0x1 LAB_00101195: CMP dword ptr [RBP + -0x8],0x1f JLE 0x0010117f MOV EAX,dword ptr [RBP + -0x14] MOV EDX,EAX SHR EDX,0x1f ADD EAX,EDX SAR EAX,0x1 MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0xc] AND EAX,0x1 TEST EAX,EAX JZ 0x001011b8 ADD dword ptr [RBP + -0x4],0x1 LAB_001011b8: MOV EAX,dword ptr [RBP + -0x4] LAB_001011bb: POP RBP RET
int func0(uint param_1) { int iVar1; int4 local_14; int4 local_10; if ((param_1 & 1) == 0) { local_14 = 0; for (local_10 = 0; local_10 < 0x20; local_10 = local_10 + 1) { local_14 = local_14 + ((int)param_1 >> ((byte)local_10 & 0x1f) & 1U); } iVar1 = (int)param_1 / 2; if ((local_14 & 1) != 0) { iVar1 = iVar1 + 1; } } else { iVar1 = (int)(param_1 + 1) / 2; } return iVar1; }
4,205
func0
#include <stdio.h> #include <assert.h>
int func0(int n) { if (n % 2 != 0) { return (n + 1) / 2; } int count = 0; for (int i = 0; i < 32; i++) { // Assuming 32 bit integer count += (n >> i) & 1; } int ans = n / 2; if (count % 2 != 0) { ans += 1; } return ans; }
int main() { assert(func0(5) == 3); assert(func0(10) == 5); assert(func0(15) == 8); return 0; }
O1
c
func0: endbr64 mov $0x0,%ecx mov $0x0,%edx test $0x1,%dil jne 1181 <func0+0x38> mov %edi,%eax sar %cl,%eax and $0x1,%eax add %eax,%edx add $0x1,%ecx cmp $0x20,%ecx jne 115d <func0+0x14> mov %edi,%eax shr $0x1f,%eax add %edi,%eax sar %eax and $0x1,%edx cmp $0x1,%edx sbb $0xffffffff,%eax retq add $0x1,%edi mov %edi,%eax shr $0x1f,%eax add %edi,%eax sar %eax retq
func0: endbr64 mov ecx, 0 mov edx, 0 test dil, 1 jnz short loc_1181 loc_115D: mov eax, edi sar eax, cl and eax, 1 add edx, eax add ecx, 1 cmp ecx, 20h ; ' ' jnz short loc_115D mov eax, edi shr eax, 1Fh add eax, edi sar eax, 1 and edx, 1 cmp edx, 1 sbb eax, 0FFFFFFFFh retn loc_1181: add edi, 1 mov eax, edi shr eax, 1Fh add eax, edi sar eax, 1 retn
long long func0(int a1) { int v1; // ecx int v2; // edx v1 = 0; v2 = 0; if ( (a1 & 1) != 0 ) return (unsigned int)((a1 + 1) / 2); do v2 += (a1 >> v1++) & 1; while ( v1 != 32 ); return a1 / 2 - ((unsigned int)((v2 & 1) == 0) - 1); }
func0: ENDBR64 MOV ECX,0x0 MOV EDX,0x0 TEST DIL,0x1 JNZ 0x00101181 LAB_0010115d: MOV EAX,EDI SAR EAX,CL AND EAX,0x1 ADD EDX,EAX ADD ECX,0x1 CMP ECX,0x20 JNZ 0x0010115d MOV EAX,EDI SHR EAX,0x1f ADD EAX,EDI SAR EAX,0x1 AND EDX,0x1 CMP EDX,0x1 SBB EAX,-0x1 RET LAB_00101181: ADD EDI,0x1 MOV EAX,EDI SHR EAX,0x1f ADD EAX,EDI SAR EAX,0x1 RET
int func0(ulong param_1) { int iVar1; uint uVar2; int iVar3; iVar1 = 0; uVar2 = 0; iVar3 = (int)param_1; if ((param_1 & 1) == 0) { do { uVar2 = uVar2 + (iVar3 >> ((byte)iVar1 & 0x1f) & 1U); iVar1 = iVar1 + 1; } while (iVar1 != 0x20); return (((int)(((uint)(param_1 >> 0x1f) & 1) + iVar3) >> 1) + 1) - (uint)((uVar2 & 1) == 0); } return (iVar3 + 1) / 2; }
4,206
func0
#include <stdio.h> #include <assert.h>
int func0(int n) { if (n % 2 != 0) { return (n + 1) / 2; } int count = 0; for (int i = 0; i < 32; i++) { // Assuming 32 bit integer count += (n >> i) & 1; } int ans = n / 2; if (count % 2 != 0) { ans += 1; } return ans; }
int main() { assert(func0(5) == 3); assert(func0(10) == 5); assert(func0(15) == 8); return 0; }
O2
c
func0: endbr64 xor %edx,%edx xor %ecx,%ecx test $0x1,%dil jne 11d8 <func0+0x38> xchg %ax,%ax mov %edi,%eax sar %cl,%eax add $0x1,%ecx and $0x1,%eax add %eax,%edx cmp $0x20,%ecx jne 11b0 <func0+0x10> mov %edi,%eax and $0x1,%edx shr $0x1f,%eax add %edi,%eax sar %eax cmp $0x1,%edx sbb $0xffffffff,%eax retq nopl 0x0(%rax) add $0x1,%edi mov %edi,%eax shr $0x1f,%eax add %edi,%eax sar %eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 xor edx, edx xor ecx, ecx test dil, 1 jnz short loc_11E8 xchg ax, ax loc_11C0: mov eax, edi sar eax, cl add ecx, 1 and eax, 1 add edx, eax cmp ecx, 20h ; ' ' jnz short loc_11C0 mov eax, edi and edx, 1 shr eax, 1Fh add eax, edi sar eax, 1 cmp edx, 1 sbb eax, 0FFFFFFFFh retn loc_11E8: add edi, 1 mov eax, edi shr eax, 1Fh add eax, edi sar eax, 1 retn
long long func0(int a1) { char v1; // dl int v2; // ecx int v3; // eax v1 = 0; v2 = 0; if ( (a1 & 1) != 0 ) return (unsigned int)((a1 + 1) / 2); do { v3 = a1 >> v2++; v1 += v3 & 1; } while ( v2 != 32 ); return a1 / 2 - ((unsigned int)((v1 & 1) == 0) - 1); }
func0: ENDBR64 XOR EDX,EDX XOR ECX,ECX TEST DIL,0x1 JNZ 0x001011e8 NOP LAB_001011c0: MOV EAX,EDI SAR EAX,CL ADD ECX,0x1 AND EAX,0x1 ADD EDX,EAX CMP ECX,0x20 JNZ 0x001011c0 MOV EAX,EDI AND EDX,0x1 SHR EAX,0x1f ADD EAX,EDI SAR EAX,0x1 CMP EDX,0x1 SBB EAX,-0x1 RET LAB_001011e8: ADD EDI,0x1 MOV EAX,EDI SHR EAX,0x1f ADD EAX,EDI SAR EAX,0x1 RET
int func0(ulong param_1) { byte bVar1; int iVar2; uint uVar3; int iVar4; uVar3 = 0; iVar2 = 0; iVar4 = (int)param_1; if ((param_1 & 1) == 0) { do { bVar1 = (byte)iVar2; iVar2 = iVar2 + 1; uVar3 = uVar3 + (iVar4 >> (bVar1 & 0x1f) & 1U); } while (iVar2 != 0x20); return (((int)(((uint)(param_1 >> 0x1f) & 1) + iVar4) >> 1) + 1) - (uint)((uVar3 & 1) == 0); } return (iVar4 + 1) / 2; }
4,207
func0
#include <stdio.h> #include <assert.h>
int func0(int n) { if (n % 2 != 0) { return (n + 1) / 2; } int count = 0; for (int i = 0; i < 32; i++) { // Assuming 32 bit integer count += (n >> i) & 1; } int ans = n / 2; if (count % 2 != 0) { ans += 1; } return ans; }
int main() { assert(func0(5) == 3); assert(func0(10) == 5); assert(func0(15) == 8); return 0; }
O3
c
func0: endbr64 xor %edx,%edx xor %ecx,%ecx test $0x1,%dil jne 11d8 <func0+0x38> xchg %ax,%ax mov %edi,%eax sar %cl,%eax add $0x1,%ecx and $0x1,%eax add %eax,%edx cmp $0x20,%ecx jne 11b0 <func0+0x10> mov %edi,%eax and $0x1,%edx shr $0x1f,%eax add %edi,%eax sar %eax cmp $0x1,%edx sbb $0xffffffff,%eax retq nopl 0x0(%rax) add $0x1,%edi mov %edi,%eax shr $0x1f,%eax add %edi,%eax sar %eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 mov edx, edi xor ecx, ecx and edx, 1 jnz short loc_11E8 nop dword ptr [rax] loc_11C0: mov eax, edi sar eax, cl add ecx, 1 and eax, 1 add edx, eax cmp ecx, 20h ; ' ' jnz short loc_11C0 mov eax, edi and edx, 1 shr eax, 1Fh add eax, edi sar eax, 1 cmp edx, 1 sbb eax, 0FFFFFFFFh retn loc_11E8: add edi, 1 mov eax, edi shr eax, 1Fh add eax, edi sar eax, 1 retn
long long func0(int a1) { int v1; // ecx char v2; // dl int v3; // eax v1 = 0; v2 = a1 & 1; if ( (a1 & 1) != 0 ) return (unsigned int)((a1 + 1) / 2); do { v3 = a1 >> v1++; v2 += v3 & 1; } while ( v1 != 32 ); return a1 / 2 - ((unsigned int)((v2 & 1) == 0) - 1); }
func0: ENDBR64 MOV EDX,EDI XOR ECX,ECX AND EDX,0x1 JNZ 0x001011e8 NOP dword ptr [RAX] LAB_001011c0: MOV EAX,EDI SAR EAX,CL ADD ECX,0x1 AND EAX,0x1 ADD EDX,EAX CMP ECX,0x20 JNZ 0x001011c0 MOV EAX,EDI AND EDX,0x1 SHR EAX,0x1f ADD EAX,EDI SAR EAX,0x1 CMP EDX,0x1 SBB EAX,-0x1 RET LAB_001011e8: ADD EDI,0x1 MOV EAX,EDI SHR EAX,0x1f ADD EAX,EDI SAR EAX,0x1 RET
int func0(uint param_1) { byte bVar1; int iVar2; uint uVar3; iVar2 = 0; uVar3 = param_1 & 1; if (uVar3 == 0) { do { bVar1 = (byte)iVar2; iVar2 = iVar2 + 1; uVar3 = uVar3 + ((int)param_1 >> (bVar1 & 0x1f) & 1U); } while (iVar2 != 0x20); return ((int)param_1 / 2 + 1) - (uint)((uVar3 & 1) == 0); } return (int)(param_1 + 1) / 2; }
4,208
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(char *s) { char *token = strtok(s, " "); while (token != NULL) { if (strlen(token) % 2 != 0) { return 1; } else { return 0; } token = strtok(NULL, " "); } return 0; }
int main() { assert(func0("Hadoop") == 0); assert(func0("great") == 1); assert(func0("structure") == 1); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov -0x18(%rbp),%rax lea 0xe64(%rip),%rsi mov %rax,%rdi callq 1090 <strtok@plt> mov %rax,-0x8(%rbp) cmpq $0x0,-0x8(%rbp) je 11d9 <func0+0x50> mov -0x8(%rbp),%rax mov %rax,%rdi callq 1070 <strlen@plt> and $0x1,%eax test %rax,%rax je 11d2 <func0+0x49> mov $0x1,%eax jmp 11de <func0+0x55> mov $0x0,%eax jmp 11de <func0+0x55> mov $0x0,%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+s], rdi mov rax, [rbp+s] lea rdx, delim; " " mov rsi, rdx; delim mov rdi, rax; s call _strtok mov [rbp+var_8], rax nop cmp [rbp+var_8], 0 jz short loc_11DD mov rax, [rbp+var_8] mov rdi, rax; s call _strlen and eax, 1 test rax, rax jz short loc_11D6 mov eax, 1 jmp short locret_11E2 loc_11D6: mov eax, 0 jmp short locret_11E2 loc_11DD: mov eax, 0 locret_11E2: leave retn
_BOOL8 func0(char *a1) { const char *v2; // [rsp+18h] [rbp-8h] v2 = strtok(a1, " "); return v2 && (strlen(v2) & 1) != 0; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV RAX,qword ptr [RBP + -0x18] LEA RDX,[0x102004] MOV RSI,RDX MOV RDI,RAX CALL 0x00101090 MOV qword ptr [RBP + -0x8],RAX NOP CMP qword ptr [RBP + -0x8],0x0 JZ 0x001011dd MOV RAX,qword ptr [RBP + -0x8] MOV RDI,RAX CALL 0x00101070 AND EAX,0x1 TEST RAX,RAX JZ 0x001011d6 MOV EAX,0x1 JMP 0x001011e2 LAB_001011d6: MOV EAX,0x0 JMP 0x001011e2 LAB_001011dd: MOV EAX,0x0 LAB_001011e2: LEAVE RET
int8 func0(char *param_1) { char *__s; size_t sVar1; int8 uVar2; __s = strtok(param_1," "); if (__s == (char *)0x0) { uVar2 = 0; } else { sVar1 = strlen(__s); if ((sVar1 & 1) == 0) { uVar2 = 0; } else { uVar2 = 1; } } return uVar2; }
4,209
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(char *s) { char *token = strtok(s, " "); while (token != NULL) { if (strlen(token) % 2 != 0) { return 1; } else { return 0; } token = strtok(NULL, " "); } return 0; }
int main() { assert(func0("Hadoop") == 0); assert(func0("great") == 1); assert(func0("structure") == 1); return 0; }
O1
c
func0: endbr64 sub $0x8,%rsp lea 0xe8c(%rip),%rsi callq 1070 <strtok@plt> mov %rax,%rdi mov $0x0,%eax test %rdi,%rdi je 1198 <func0+0x2f> mov $0xffffffffffffffff,%rcx repnz scas %es:(%rdi),%al mov %ecx,%eax and $0x1,%eax add $0x8,%rsp retq
func0: endbr64 sub rsp, 8 lea rsi, unk_2004 call _strtok mov rdi, rax mov eax, 0 test rdi, rdi jz short loc_11B2 call _strlen and eax, 1 loc_11B2: add rsp, 8 retn
long long func0(long long a1) { long long v1; // rdi long long result; // rax v1 = strtok(a1, &unk_2004); result = 0LL; if ( v1 ) return strlen() & 1; return result; }
func0: ENDBR64 SUB RSP,0x8 LEA RSI,[0x102004] CALL 0x00101090 MOV RDI,RAX MOV EAX,0x0 TEST RDI,RDI JZ 0x001011b2 CALL 0x00101070 AND EAX,0x1 LAB_001011b2: ADD RSP,0x8 RET
uint func0(char *param_1) { uint uVar1; char *__s; size_t sVar2; __s = strtok(param_1," "); uVar1 = 0; if (__s != (char *)0x0) { sVar2 = strlen(__s); uVar1 = (uint)sVar2 & 1; } return uVar1; }
4,210
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(char *s) { char *token = strtok(s, " "); while (token != NULL) { if (strlen(token) % 2 != 0) { return 1; } else { return 0; } token = strtok(NULL, " "); } return 0; }
int main() { assert(func0("Hadoop") == 0); assert(func0("great") == 1); assert(func0("structure") == 1); return 0; }
O2
c
func0: endbr64 sub $0x8,%rsp lea 0xdc5(%rip),%rsi callq 1090 <strtok@plt> mov %rax,%rdi xor %eax,%eax test %rdi,%rdi je 1256 <func0+0x26> callq 1070 <strlen@plt> and $0x1,%eax add $0x8,%rsp retq nopl 0x0(%rax,%rax,1)
func0: endbr64 sub rsp, 8 lea rsi, unk_2004 call _strtok mov rdi, rax xor eax, eax test rdi, rdi jz short loc_1256 call _strlen and eax, 1 loc_1256: add rsp, 8 retn
long long func0(long long a1) { long long v1; // rdi long long result; // rax v1 = strtok(a1, &unk_2004); result = 0LL; if ( v1 ) return strlen() & 1; return result; }
func0: ENDBR64 SUB RSP,0x8 LEA RSI,[0x102004] CALL 0x00101090 MOV RDI,RAX XOR EAX,EAX TEST RDI,RDI JZ 0x00101256 CALL 0x00101070 AND EAX,0x1 LAB_00101256: ADD RSP,0x8 RET
uint func0(char *param_1) { uint uVar1; char *__s; size_t sVar2; __s = strtok(param_1," "); uVar1 = 0; if (__s != (char *)0x0) { sVar2 = strlen(__s); uVar1 = (uint)sVar2 & 1; } return uVar1; }
4,211
func0
#include <stdio.h> #include <string.h> #include <assert.h>
int func0(char *s) { char *token = strtok(s, " "); while (token != NULL) { if (strlen(token) % 2 != 0) { return 1; } else { return 0; } token = strtok(NULL, " "); } return 0; }
int main() { assert(func0("Hadoop") == 0); assert(func0("great") == 1); assert(func0("structure") == 1); return 0; }
O3
c
func0: endbr64 sub $0x8,%rsp lea 0xdc5(%rip),%rsi callq 1090 <strtok@plt> mov %rax,%rdi xor %eax,%eax test %rdi,%rdi je 1256 <func0+0x26> callq 1070 <strlen@plt> and $0x1,%eax add $0x8,%rsp retq nopl 0x0(%rax,%rax,1)
func0: endbr64 sub rsp, 8 lea rsi, delim; " " call _strtok mov rdi, rax; s xor eax, eax test rdi, rdi jz short loc_1256 call _strlen and eax, 1 loc_1256: add rsp, 8 retn
size_t func0(char *a1) { char *v1; // rdi size_t result; // rax v1 = strtok(a1, " "); result = 0LL; if ( v1 ) return strlen(v1) & 1; return result; }
func0: ENDBR64 SUB RSP,0x8 LEA RSI,[0x102004] CALL 0x00101090 MOV RDI,RAX XOR EAX,EAX TEST RDI,RDI JZ 0x00101256 CALL 0x00101070 AND EAX,0x1 LAB_00101256: ADD RSP,0x8 RET
uint func0(char *param_1) { uint uVar1; char *__s; size_t sVar2; __s = strtok(param_1," "); uVar1 = 0; if (__s != (char *)0x0) { sVar2 = strlen(__s); uVar1 = (uint)sVar2 & 1; } return uVar1; }
4,212
func0
#include <assert.h>
double func0(int n) { return (n * (n + 1) * (n + 2)) / 6.0; }
int main() { assert(func0(5) == 35.0); assert(func0(6) == 56.0); assert(func0(7) == 84.0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov -0x4(%rbp),%eax add $0x1,%eax imul -0x4(%rbp),%eax mov -0x4(%rbp),%edx add $0x2,%edx imul %edx,%eax cvtsi2sd %eax,%xmm0 movsd 0xf0d(%rip),%xmm1 divsd %xmm1,%xmm0 pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov eax, [rbp+var_4] add eax, 1 imul eax, [rbp+var_4] mov edx, [rbp+var_4] add edx, 2 imul eax, edx pxor xmm0, xmm0 cvtsi2sd xmm0, eax movsd xmm1, cs:qword_2060 divsd xmm0, xmm1 pop rbp retn
double func0(int a1) { return (double)((a1 + 2) * a1 * (a1 + 1)) / 6.0; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV EAX,dword ptr [RBP + -0x4] ADD EAX,0x1 IMUL EAX,dword ptr [RBP + -0x4] MOV EDX,dword ptr [RBP + -0x4] ADD EDX,0x2 IMUL EAX,EDX PXOR XMM0,XMM0 CVTSI2SD XMM0,EAX MOVSD XMM1,qword ptr [0x00102060] DIVSD XMM0,XMM1 POP RBP RET
double func0(int param_1) { return (double)((param_1 + 1) * param_1 * (param_1 + 2)) / DAT_00102060; }
4,213
func0
#include <assert.h>
double func0(int n) { return (n * (n + 1) * (n + 2)) / 6.0; }
int main() { assert(func0(5) == 35.0); assert(func0(6) == 56.0); assert(func0(7) == 84.0); return 0; }
O1
c
func0: endbr64 mov %edi,%eax lea 0x1(%rdi),%edi imul %eax,%edi add $0x2,%eax imul %eax,%edi pxor %xmm0,%xmm0 cvtsi2sd %edi,%xmm0 divsd 0xebd(%rip),%xmm0 retq
func0: endbr64 lea eax, [rdi+1] imul eax, edi add edi, 2 imul eax, edi pxor xmm0, xmm0 cvtsi2sd xmm0, eax divsd xmm0, cs:qword_2008 retn
double func0(int a1) { return (double)((a1 + 2) * a1 * (a1 + 1)) / 6.0; }
func0: ENDBR64 LEA EAX,[RDI + 0x1] IMUL EAX,EDI ADD EDI,0x2 IMUL EAX,EDI PXOR XMM0,XMM0 CVTSI2SD XMM0,EAX DIVSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int param_1) { return (double)((param_1 + 1) * param_1 * (param_1 + 2)) / _DAT_00102008; }
4,214
func0
#include <assert.h>
double func0(int n) { return (n * (n + 1) * (n + 2)) / 6.0; }
int main() { assert(func0(5) == 35.0); assert(func0(6) == 56.0); assert(func0(7) == 84.0); return 0; }
O2
c
func0: endbr64 mov %edi,%eax lea 0x1(%rdi),%edi pxor %xmm0,%xmm0 imul %eax,%edi add $0x2,%eax imul %eax,%edi cvtsi2sd %edi,%xmm0 divsd 0xea6(%rip),%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 lea eax, [rdi+1] pxor xmm0, xmm0 imul eax, edi add edi, 2 imul eax, edi cvtsi2sd xmm0, eax divsd xmm0, cs:qword_2008 retn
double func0(int a1) { return (double)((a1 + 2) * a1 * (a1 + 1)) / 6.0; }
func0: ENDBR64 LEA EAX,[RDI + 0x1] PXOR XMM0,XMM0 IMUL EAX,EDI ADD EDI,0x2 IMUL EAX,EDI CVTSI2SD XMM0,EAX DIVSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int param_1) { return (double)((param_1 + 1) * param_1 * (param_1 + 2)) / _DAT_00102008; }
4,215
func0
#include <assert.h>
double func0(int n) { return (n * (n + 1) * (n + 2)) / 6.0; }
int main() { assert(func0(5) == 35.0); assert(func0(6) == 56.0); assert(func0(7) == 84.0); return 0; }
O3
c
func0: endbr64 mov %edi,%eax lea 0x1(%rdi),%edi pxor %xmm0,%xmm0 imul %eax,%edi add $0x2,%eax imul %eax,%edi cvtsi2sd %edi,%xmm0 divsd 0xea6(%rip),%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 lea eax, [rdi+1] pxor xmm0, xmm0 imul eax, edi add edi, 2 imul eax, edi cvtsi2sd xmm0, eax divsd xmm0, cs:qword_2008 retn
double func0(int a1) { return (double)((a1 + 2) * a1 * (a1 + 1)) / 6.0; }
func0: ENDBR64 LEA EAX,[RDI + 0x1] PXOR XMM0,XMM0 IMUL EAX,EDI ADD EDI,0x2 IMUL EAX,EDI CVTSI2SD XMM0,EAX DIVSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(int param_1) { return (double)((param_1 + 1) * param_1 * (param_1 + 2)) / _DAT_00102008; }
4,216
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Pair;
Pair* func0(int *test_tup1, int len1, int *test_tup2, int len2) { Pair *res = (Pair*)malloc(sizeof(Pair) * len1); for (int i = 0; i < len1; i++) { res[i].first = test_tup1[i]; res[i].second = test_tup2[i % len2]; } return res; }
int main() { int test_tup1_1[] = {7, 8, 4, 5, 9, 10}; int test_tup2_1[] = {1, 5, 6}; Pair *result1 = func0(test_tup1_1, 6, test_tup2_1, 3); Pair expected1[] = {{7, 1}, {8, 5}, {4, 6}, {5, 1}, {9, 5}, {10, 6}}; for (int i = 0; i < 6; i++) { assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second); } int test_tup1_2[] = {8, 9, 5, 6, 10, 11}; int test_tup2_2[] = {2, 6, 7}; Pair *result2 = func0(test_tup1_2, 6, test_tup2_2, 3); Pair expected2[] = {{8, 2}, {9, 6}, {5, 7}, {6, 2}, {10, 6}, {11, 7}}; for (int i = 0; i < 6; i++) { assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second); } int test_tup1_3[] = {9, 10, 6, 7, 11, 12}; int test_tup2_3[] = {3, 7, 8}; Pair *result3 = func0(test_tup1_3, 6, test_tup2_3, 3); Pair expected3[] = {{9, 3}, {10, 7}, {6, 8}, {7, 3}, {11, 7}, {12, 8}}; for (int i = 0; i < 6; i++) { assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second); } free(result1); free(result2); free(result3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %rdx,-0x28(%rbp) mov %ecx,-0x20(%rbp) mov -0x1c(%rbp),%eax cltq shl $0x3,%rax mov %rax,%rdi callq 10b0 <malloc@plt> mov %rax,-0x8(%rbp) movl $0x0,-0xc(%rbp) jmp 1246 <func0+0x9d> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov -0xc(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,8),%rcx mov -0x8(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,(%rdx) mov -0xc(%rbp),%eax cltd idivl -0x20(%rbp) mov %edx,%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov -0xc(%rbp),%edx movslq %edx,%rdx lea 0x0(,%rdx,8),%rcx mov -0x8(%rbp),%rdx add %rcx,%rdx mov (%rax),%eax mov %eax,0x4(%rdx) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11e1 <func0+0x38> mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_28], rdx mov [rbp+var_20], ecx mov eax, [rbp+var_1C] cdqe shl rax, 3 mov rdi, rax; size call _malloc mov [rbp+var_8], rax mov [rbp+var_C], 0 jmp short loc_1246 loc_11E1: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rbp+var_C] movsxd rdx, edx lea rcx, ds:0[rdx*8] mov rdx, [rbp+var_8] add rdx, rcx mov eax, [rax] mov [rdx], eax mov eax, [rbp+var_C] cdq idiv [rbp+var_20] mov eax, edx cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_28] add rax, rdx mov edx, [rbp+var_C] movsxd rdx, edx lea rcx, ds:0[rdx*8] mov rdx, [rbp+var_8] add rdx, rcx mov eax, [rax] mov [rdx+4], eax add [rbp+var_C], 1 loc_1246: mov eax, [rbp+var_C] cmp eax, [rbp+var_1C] jl short loc_11E1 mov rax, [rbp+var_8] leave retn
_DWORD * func0(long long a1, int a2, long long a3, int a4) { int i; // [rsp+24h] [rbp-Ch] _DWORD *v8; // [rsp+28h] [rbp-8h] v8 = malloc(8LL * a2); for ( i = 0; i < a2; ++i ) { v8[2 * i] = *(_DWORD *)(4LL * i + a1); v8[2 * i + 1] = *(_DWORD *)(4LL * (i % a4) + a3); } return v8; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV qword ptr [RBP + -0x28],RDX MOV dword ptr [RBP + -0x20],ECX MOV EAX,dword ptr [RBP + -0x1c] CDQE SHL RAX,0x3 MOV RDI,RAX CALL 0x001010b0 MOV qword ptr [RBP + -0x8],RAX MOV dword ptr [RBP + -0xc],0x0 JMP 0x00101246 LAB_001011e1: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX LEA RCX,[RDX*0x8] MOV RDX,qword ptr [RBP + -0x8] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX],EAX MOV EAX,dword ptr [RBP + -0xc] CDQ IDIV dword ptr [RBP + -0x20] MOV EAX,EDX CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EDX,dword ptr [RBP + -0xc] MOVSXD RDX,EDX LEA RCX,[RDX*0x8] MOV RDX,qword ptr [RBP + -0x8] ADD RDX,RCX MOV EAX,dword ptr [RAX] MOV dword ptr [RDX + 0x4],EAX ADD dword ptr [RBP + -0xc],0x1 LAB_00101246: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011e1 MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(long param_1,int param_2,long param_3,int param_4) { void *pvVar1; int local_14; pvVar1 = malloc((long)param_2 << 3); for (local_14 = 0; local_14 < param_2; local_14 = local_14 + 1) { *(int4 *)((long)pvVar1 + (long)local_14 * 8) = *(int4 *)(param_1 + (long)local_14 * 4); *(int4 *)((long)pvVar1 + (long)local_14 * 8 + 4) = *(int4 *)(param_3 + (long)(local_14 % param_4) * 4); } return pvVar1; }
4,217
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Pair;
Pair* func0(int *test_tup1, int len1, int *test_tup2, int len2) { Pair *res = (Pair*)malloc(sizeof(Pair) * len1); for (int i = 0; i < len1; i++) { res[i].first = test_tup1[i]; res[i].second = test_tup2[i % len2]; } return res; }
int main() { int test_tup1_1[] = {7, 8, 4, 5, 9, 10}; int test_tup2_1[] = {1, 5, 6}; Pair *result1 = func0(test_tup1_1, 6, test_tup2_1, 3); Pair expected1[] = {{7, 1}, {8, 5}, {4, 6}, {5, 1}, {9, 5}, {10, 6}}; for (int i = 0; i < 6; i++) { assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second); } int test_tup1_2[] = {8, 9, 5, 6, 10, 11}; int test_tup2_2[] = {2, 6, 7}; Pair *result2 = func0(test_tup1_2, 6, test_tup2_2, 3); Pair expected2[] = {{8, 2}, {9, 6}, {5, 7}, {6, 2}, {10, 6}, {11, 7}}; for (int i = 0; i < 6; i++) { assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second); } int test_tup1_3[] = {9, 10, 6, 7, 11, 12}; int test_tup2_3[] = {3, 7, 8}; Pair *result3 = func0(test_tup1_3, 6, test_tup2_3, 3); Pair expected3[] = {{9, 3}, {10, 7}, {6, 8}, {7, 3}, {11, 7}, {12, 8}}; for (int i = 0; i < 6; i++) { assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second); } free(result1); free(result2); free(result3); return 0; }
O1
c
func0: endbr64 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbp mov %esi,%r13d mov %rdx,%r12 mov %ecx,%ebx movslq %esi,%rdi shl $0x3,%rdi callq 10b0 <malloc@plt> mov %rax,%rsi test %r13d,%r13d jle 1202 <func0+0x59> lea -0x1(%r13),%edi mov $0x0,%ecx mov 0x0(%rbp,%rcx,4),%eax mov %eax,(%rsi,%rcx,8) mov %ecx,%eax cltd idiv %ebx movslq %edx,%rdx mov (%r12,%rdx,4),%eax mov %eax,0x4(%rsi,%rcx,8) mov %rcx,%rax add $0x1,%rcx cmp %rdi,%rax jne 11df <func0+0x36> mov %rsi,%rax add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov rbp, rdi mov r13d, esi mov r12, rdx mov ebx, ecx movsxd rdi, esi shl rdi, 3 call _malloc mov rsi, rax test r13d, r13d jle short loc_11FE mov edi, r13d mov ecx, 0 loc_11DE: mov eax, [rbp+rcx*4+0] mov [rsi+rcx*8], eax mov eax, ecx cdq idiv ebx movsxd rdx, edx mov eax, [r12+rdx*4] mov [rsi+rcx*8+4], eax add rcx, 1 cmp rcx, rdi jnz short loc_11DE loc_11FE: mov rax, rsi add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
long long func0(long long a1, int a2, long long a3, int a4) { long long v7; // rsi long long v8; // rcx v7 = malloc(8LL * a2); if ( a2 > 0 ) { v8 = 0LL; do { *(_DWORD *)(v7 + 8 * v8) = *(_DWORD *)(a1 + 4 * v8); *(_DWORD *)(v7 + 8 * v8 + 4) = *(_DWORD *)(a3 + 4LL * ((int)v8 % a4)); ++v8; } while ( v8 != a2 ); } return v7; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBP,RDI MOV R13D,ESI MOV R12,RDX MOV EBX,ECX MOVSXD RDI,ESI SHL RDI,0x3 CALL 0x001010b0 MOV RSI,RAX TEST R13D,R13D JLE 0x001011fe MOV EDI,R13D MOV ECX,0x0 LAB_001011de: MOV EAX,dword ptr [RBP + RCX*0x4] MOV dword ptr [RSI + RCX*0x8],EAX MOV EAX,ECX CDQ IDIV EBX MOVSXD RDX,EDX MOV EAX,dword ptr [R12 + RDX*0x4] MOV dword ptr [RSI + RCX*0x8 + 0x4],EAX ADD RCX,0x1 CMP RCX,RDI JNZ 0x001011de LAB_001011fe: MOV RAX,RSI ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
void * func0(long param_1,uint param_2,long param_3,int param_4) { void *pvVar1; ulong uVar2; pvVar1 = malloc((long)(int)param_2 << 3); if (0 < (int)param_2) { uVar2 = 0; do { *(int4 *)((long)pvVar1 + uVar2 * 8) = *(int4 *)(param_1 + uVar2 * 4); *(int4 *)((long)pvVar1 + uVar2 * 8 + 4) = *(int4 *) (param_3 + (long)(int)((long)((ulong)(uint)((int)uVar2 >> 0x1f) << 0x20 | uVar2 & 0xffffffff) % (long)param_4) * 4); uVar2 = uVar2 + 1; } while (uVar2 != param_2); } return pvVar1; }
4,218
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Pair;
Pair* func0(int *test_tup1, int len1, int *test_tup2, int len2) { Pair *res = (Pair*)malloc(sizeof(Pair) * len1); for (int i = 0; i < len1; i++) { res[i].first = test_tup1[i]; res[i].second = test_tup2[i % len2]; } return res; }
int main() { int test_tup1_1[] = {7, 8, 4, 5, 9, 10}; int test_tup2_1[] = {1, 5, 6}; Pair *result1 = func0(test_tup1_1, 6, test_tup2_1, 3); Pair expected1[] = {{7, 1}, {8, 5}, {4, 6}, {5, 1}, {9, 5}, {10, 6}}; for (int i = 0; i < 6; i++) { assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second); } int test_tup1_2[] = {8, 9, 5, 6, 10, 11}; int test_tup2_2[] = {2, 6, 7}; Pair *result2 = func0(test_tup1_2, 6, test_tup2_2, 3); Pair expected2[] = {{8, 2}, {9, 6}, {5, 7}, {6, 2}, {10, 6}, {11, 7}}; for (int i = 0; i < 6; i++) { assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second); } int test_tup1_3[] = {9, 10, 6, 7, 11, 12}; int test_tup2_3[] = {3, 7, 8}; Pair *result3 = func0(test_tup1_3, 6, test_tup2_3, 3); Pair expected3[] = {{9, 3}, {10, 7}, {6, 8}, {7, 3}, {11, 7}, {12, 8}}; for (int i = 0; i < 6; i++) { assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second); } free(result1); free(result2); free(result3); return 0; }
O2
c
func0: endbr64 push %r13 push %r12 mov %rdx,%r12 push %rbp mov %rdi,%rbp movslq %esi,%rdi push %rbx mov %rdi,%r13 shl $0x3,%rdi mov %ecx,%ebx sub $0x8,%rsp callq 10b0 <malloc@plt> mov %rax,%r8 test %r13d,%r13d jle 15dd <func0+0x5d> lea -0x1(%r13),%ecx xor %esi,%esi nopl 0x0(%rax,%rax,1) mov 0x0(%rbp,%rsi,4),%eax mov %eax,(%r8,%rsi,8) mov %esi,%eax cltd idiv %ebx movslq %edx,%rdx mov (%r12,%rdx,4),%eax mov %eax,0x4(%r8,%rsi,8) mov %rsi,%rax add $0x1,%rsi cmp %rax,%rcx jne 15b8 <func0+0x38> add $0x8,%rsp mov %r8,%rax pop %rbx pop %rbp pop %r12 pop %r13 retq nopl 0x0(%rax,%rax,1)
func0: endbr64 push r14 push r13 movsxd r13, esi push r12 mov r12, rdx push rbp mov rbp, rdi lea rdi, ds:0[r13*8] push rbx mov ebx, ecx call _malloc mov r8, rax test r13d, r13d jle short loc_15D2 xor ecx, ecx xchg ax, ax loc_15B0: mov eax, [rbp+rcx*4+0] mov [r8+rcx*8], eax mov eax, ecx cdq idiv ebx movsxd rdx, edx mov eax, [r12+rdx*4] mov [r8+rcx*8+4], eax add rcx, 1 cmp r13, rcx jnz short loc_15B0 loc_15D2: pop rbx mov rax, r8 pop rbp pop r12 pop r13 pop r14 retn
long long func0(long long a1, int a2, long long a3, int a4) { long long v6; // r8 long long i; // rcx v6 = malloc(8LL * a2); if ( a2 > 0 ) { for ( i = 0LL; i != a2; ++i ) { *(_DWORD *)(v6 + 8 * i) = *(_DWORD *)(a1 + 4 * i); *(_DWORD *)(v6 + 8 * i + 4) = *(_DWORD *)(a3 + 4LL * ((int)i % a4)); } } return v6; }
func0: ENDBR64 PUSH R14 PUSH R13 MOVSXD R13,ESI PUSH R12 MOV R12,RDX PUSH RBP MOV RBP,RDI LEA RDI,[R13*0x8] PUSH RBX MOV EBX,ECX CALL 0x001010b0 MOV R8,RAX TEST R13D,R13D JLE 0x001015d2 XOR ECX,ECX NOP LAB_001015b0: MOV EAX,dword ptr [RBP + RCX*0x4] MOV dword ptr [R8 + RCX*0x8],EAX MOV EAX,ECX CDQ IDIV EBX MOVSXD RDX,EDX MOV EAX,dword ptr [R12 + RDX*0x4] MOV dword ptr [R8 + RCX*0x8 + 0x4],EAX ADD RCX,0x1 CMP R13,RCX JNZ 0x001015b0 LAB_001015d2: POP RBX MOV RAX,R8 POP RBP POP R12 POP R13 POP R14 RET
void * func0(long param_1,int param_2,long param_3,int param_4) { void *pvVar1; ulong uVar2; pvVar1 = malloc((long)param_2 * 8); if (0 < param_2) { uVar2 = 0; do { *(int4 *)((long)pvVar1 + uVar2 * 8) = *(int4 *)(param_1 + uVar2 * 4); *(int4 *)((long)pvVar1 + uVar2 * 8 + 4) = *(int4 *) (param_3 + (long)(int)((long)((ulong)(uint)((int)uVar2 >> 0x1f) << 0x20 | uVar2 & 0xffffffff) % (long)param_4) * 4); uVar2 = uVar2 + 1; } while ((long)param_2 != uVar2); } return pvVar1; }
4,219
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int first; int second; } Pair;
Pair* func0(int *test_tup1, int len1, int *test_tup2, int len2) { Pair *res = (Pair*)malloc(sizeof(Pair) * len1); for (int i = 0; i < len1; i++) { res[i].first = test_tup1[i]; res[i].second = test_tup2[i % len2]; } return res; }
int main() { int test_tup1_1[] = {7, 8, 4, 5, 9, 10}; int test_tup2_1[] = {1, 5, 6}; Pair *result1 = func0(test_tup1_1, 6, test_tup2_1, 3); Pair expected1[] = {{7, 1}, {8, 5}, {4, 6}, {5, 1}, {9, 5}, {10, 6}}; for (int i = 0; i < 6; i++) { assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second); } int test_tup1_2[] = {8, 9, 5, 6, 10, 11}; int test_tup2_2[] = {2, 6, 7}; Pair *result2 = func0(test_tup1_2, 6, test_tup2_2, 3); Pair expected2[] = {{8, 2}, {9, 6}, {5, 7}, {6, 2}, {10, 6}, {11, 7}}; for (int i = 0; i < 6; i++) { assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second); } int test_tup1_3[] = {9, 10, 6, 7, 11, 12}; int test_tup2_3[] = {3, 7, 8}; Pair *result3 = func0(test_tup1_3, 6, test_tup2_3, 3); Pair expected3[] = {{9, 3}, {10, 7}, {6, 8}, {7, 3}, {11, 7}, {12, 8}}; for (int i = 0; i < 6; i++) { assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second); } free(result1); free(result2); free(result3); return 0; }
O3
c
func0: endbr64 push %r13 push %r12 mov %rdi,%r12 movslq %esi,%rdi push %rbp mov %rdi,%r13 shl $0x3,%rdi mov %rdx,%rbp push %rbx mov %ecx,%ebx sub $0x8,%rsp callq 10b0 <malloc@plt> mov %rax,%r8 test %r13d,%r13d jle 171d <func0+0xed> lea -0x1(%r13),%ecx cmp $0x2,%ecx jbe 172b <func0+0xfb> mov %r13d,%edi mov %r12,%rdx shr $0x2,%edi shl $0x4,%rdi add %r12,%rdi xchg %ax,%ax movdqu (%rdx),%xmm0 add $0x10,%rdx add $0x20,%rax pshufd $0x55,%xmm0,%xmm1 movd %xmm0,-0x20(%rax) movd %xmm1,-0x18(%rax) movdqa %xmm0,%xmm1 punpckhdq %xmm0,%xmm1 pshufd $0xff,%xmm0,%xmm0 movd %xmm1,-0x10(%rax) movd %xmm0,-0x8(%rax) cmp %rdi,%rdx jne 1680 <func0+0x50> mov %r13d,%eax and $0xfffffffc,%eax test $0x3,%r13b je 16f3 <func0+0xc3> movslq %eax,%rdx mov (%r12,%rdx,4),%esi mov %esi,(%r8,%rdx,8) lea 0x1(%rax),%edx cmp %edx,%r13d jle 16f3 <func0+0xc3> movslq %edx,%rdx add $0x2,%eax mov (%r12,%rdx,4),%esi mov %esi,(%r8,%rdx,8) cmp %eax,%r13d jle 16f3 <func0+0xc3> cltq mov (%r12,%rax,4),%edx mov %edx,(%r8,%rax,8) mov %ecx,%ecx xor %esi,%esi nopw 0x0(%rax,%rax,1) mov %esi,%eax cltd idiv %ebx movslq %edx,%rdx mov 0x0(%rbp,%rdx,4),%eax mov %eax,0x4(%r8,%rsi,8) mov %rsi,%rax add $0x1,%rsi cmp %rcx,%rax jne 1700 <func0+0xd0> add $0x8,%rsp mov %r8,%rax pop %rbx pop %rbp pop %r12 pop %r13 retq xor %eax,%eax jmp 16c3 <func0+0x93>
func0: endbr64 push r14 push r13 mov r13, rdi push r12 movsxd r12, esi push rbp lea rdi, ds:0[r12*8]; size mov rbp, rdx push rbx mov ebx, ecx call _malloc mov rsi, rax test r12d, r12d jle loc_1589 lea eax, [r12-1] mov r14, r12 cmp eax, 2 jbe loc_1595 mov ecx, r12d mov rax, r13 mov rdx, rsi shr ecx, 2 shl rcx, 4 add rcx, r13 nop dword ptr [rax+00h] loc_14F8: mov edi, [rax+0Ch] mov r8d, [rax+8] add rax, 10h add rdx, 20h ; ' ' mov r9d, [rax-0Ch] mov r10d, [rax-10h] mov [rdx-10h], r8d mov [rdx-20h], r10d mov [rdx-18h], r9d mov [rdx-8], edi cmp rax, rcx jnz short loc_14F8 mov eax, r14d and eax, 0FFFFFFFCh test r14b, 3 jz short loc_156D loc_152F: movsxd rdx, eax mov r8d, [r13+rdx*4+0] lea rdi, ds:0[rdx*4] lea rcx, ds:0[rdx*8] mov [rsi+rdx*8], r8d lea edx, [rax+1] cmp r14d, edx jle short loc_156D mov edx, [r13+rdi+4] add eax, 2 mov [rsi+rcx+8], edx cmp eax, r14d jge short loc_156D mov eax, [r13+rdi+8] mov [rsi+rcx+10h], eax loc_156D: xor ecx, ecx nop loc_1570: mov eax, ecx cdq idiv ebx movsxd rdx, edx mov eax, [rbp+rdx*4+0] mov [rsi+rcx*8+4], eax add rcx, 1 cmp r12, rcx jnz short loc_1570 loc_1589: pop rbx mov rax, rsi pop rbp pop r12 pop r13 pop r14 retn loc_1595: xor eax, eax jmp short loc_152F
_DWORD * func0(long long a1, int a2, long long a3, int a4) { long long v5; // r12 _DWORD *v8; // rsi long long v9; // rax _DWORD *v10; // rdx int v11; // edi int v12; // r8d int v13; // r9d int v14; // r10d int v15; // eax long long v16; // rdi long long v17; // rcx long long i; // rcx v5 = a2; v8 = malloc(8LL * a2); if ( (int)v5 > 0 ) { if ( (unsigned int)(v5 - 1) <= 2 ) { v15 = 0; } else { v9 = a1; v10 = v8; do { v11 = *(_DWORD *)(v9 + 12); v12 = *(_DWORD *)(v9 + 8); v9 += 16LL; v10 += 8; v13 = *(_DWORD *)(v9 - 12); v14 = *(_DWORD *)(v9 - 16); *(v10 - 4) = v12; *(v10 - 8) = v14; *(v10 - 6) = v13; *(v10 - 2) = v11; } while ( v9 != a1 + 16LL * ((unsigned int)v5 >> 2) ); v15 = v5 & 0x7FFFFFFC; if ( (v5 & 3) == 0 ) { LABEL_9: for ( i = 0LL; i != v5; ++i ) v8[2 * i + 1] = *(_DWORD *)(a3 + 4LL * ((int)i % a4)); return v8; } } v16 = 4LL * v15; v17 = 2LL * v15; v8[v17] = *(_DWORD *)(a1 + v16); if ( (int)v5 > v15 + 1 ) { v8[v17 + 2] = *(_DWORD *)(a1 + v16 + 4); if ( v15 + 2 < (int)v5 ) v8[v17 + 4] = *(_DWORD *)(a1 + v16 + 8); } goto LABEL_9; } return v8; }
func0: ENDBR64 PUSH R14 PUSH R13 MOV R13,RDI PUSH R12 MOVSXD R12,ESI PUSH RBP LEA RDI,[R12*0x8] MOV RBP,RDX PUSH RBX MOV EBX,ECX CALL 0x001010b0 MOV RSI,RAX TEST R12D,R12D JLE 0x00101589 LEA EAX,[R12 + -0x1] MOV R14,R12 CMP EAX,0x2 JBE 0x00101595 MOV ECX,R12D MOV RAX,R13 MOV RDX,RSI SHR ECX,0x2 SHL RCX,0x4 ADD RCX,R13 NOP dword ptr [RAX] LAB_001014f8: MOV EDI,dword ptr [RAX + 0xc] MOV R8D,dword ptr [RAX + 0x8] ADD RAX,0x10 ADD RDX,0x20 MOV R9D,dword ptr [RAX + -0xc] MOV R10D,dword ptr [RAX + -0x10] MOV dword ptr [RDX + -0x10],R8D MOV dword ptr [RDX + -0x20],R10D MOV dword ptr [RDX + -0x18],R9D MOV dword ptr [RDX + -0x8],EDI CMP RAX,RCX JNZ 0x001014f8 MOV EAX,R14D AND EAX,0xfffffffc TEST R14B,0x3 JZ 0x0010156d LAB_0010152f: MOVSXD RDX,EAX MOV R8D,dword ptr [R13 + RDX*0x4] LEA RDI,[RDX*0x4] LEA RCX,[RDX*0x8] MOV dword ptr [RSI + RDX*0x8],R8D LEA EDX,[RAX + 0x1] CMP R14D,EDX JLE 0x0010156d MOV EDX,dword ptr [R13 + RDI*0x1 + 0x4] ADD EAX,0x2 MOV dword ptr [RSI + RCX*0x1 + 0x8],EDX CMP EAX,R14D JGE 0x0010156d MOV EAX,dword ptr [R13 + RDI*0x1 + 0x8] MOV dword ptr [RSI + RCX*0x1 + 0x10],EAX LAB_0010156d: XOR ECX,ECX NOP LAB_00101570: MOV EAX,ECX CDQ IDIV EBX MOVSXD RDX,EDX MOV EAX,dword ptr [RBP + RDX*0x4] MOV dword ptr [RSI + RCX*0x8 + 0x4],EAX ADD RCX,0x1 CMP R12,RCX JNZ 0x00101570 LAB_00101589: POP RBX MOV RAX,RSI POP RBP POP R12 POP R13 POP R14 RET LAB_00101595: XOR EAX,EAX JMP 0x0010152f
int4 * func0(int4 *param_1,uint param_2,long param_3,int param_4) { int4 uVar1; int4 uVar2; int4 uVar3; uint uVar4; int4 *puVar5; int4 *puVar6; int4 *puVar7; ulong uVar8; int4 *puVar9; long lVar10; ulong uVar11; uVar11 = (ulong)(int)param_2; puVar5 = (int4 *)malloc(uVar11 * 8); if ((int)param_2 < 1) { return puVar5; } if (param_2 - 1 < 3) { uVar4 = 0; } else { puVar6 = param_1; puVar9 = puVar5; do { uVar1 = puVar6[3]; puVar7 = puVar6 + 4; uVar2 = puVar6[1]; uVar3 = *puVar6; puVar9[4] = puVar6[2]; *puVar9 = uVar3; puVar9[2] = uVar2; puVar9[6] = uVar1; puVar6 = puVar7; puVar9 = puVar9 + 8; } while (puVar7 != param_1 + (ulong)(param_2 >> 2) * 4); uVar4 = param_2 & 0xfffffffc; if ((uVar11 & 3) == 0) goto LAB_0010156d; } lVar10 = (long)(int)uVar4; puVar5[lVar10 * 2] = param_1[lVar10]; if (((int)(uVar4 + 1) < (int)param_2) && (puVar5[lVar10 * 2 + 2] = param_1[lVar10 + 1], (int)(uVar4 + 2) < (int)param_2)) { puVar5[lVar10 * 2 + 4] = param_1[lVar10 + 2]; } LAB_0010156d: uVar8 = 0; do { puVar5[uVar8 * 2 + 1] = *(int4 *) (param_3 + (long)(int)((long)((ulong)(uint)((int)uVar8 >> 0x1f) << 0x20 | uVar8 & 0xffffffff) % (long)param_4) * 4); uVar8 = uVar8 + 1; } while (uVar11 != uVar8); return puVar5; }
4,220
func0
#include <math.h> #include <assert.h>
double func0(double r) { double volume = (4.0/3.0) * M_PI * r * r * r; return volume; }
int main() { assert(func0(10) == 4188.790204786391); assert(func0(25) == 65449.84694978735); assert(func0(20) == 33510.32163829113); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp movsd %xmm0,-0x18(%rbp) movsd -0x18(%rbp),%xmm1 movsd 0xf4d(%rip),%xmm0 mulsd %xmm1,%xmm0 mulsd -0x18(%rbp),%xmm0 movsd -0x18(%rbp),%xmm1 mulsd %xmm1,%xmm0 movsd %xmm0,-0x8(%rbp) movsd -0x8(%rbp),%xmm0 pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp movsd [rbp+var_18], xmm0 movsd xmm1, [rbp+var_18] movsd xmm0, cs:qword_2090 mulsd xmm0, xmm1 mulsd xmm0, [rbp+var_18] movsd xmm1, [rbp+var_18] mulsd xmm0, xmm1 movsd [rbp+var_8], xmm0 movsd xmm0, [rbp+var_8] pop rbp retn
double func0(double a1) { return 4.188790204786391 * a1 * a1 * a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOVSD qword ptr [RBP + -0x18],XMM0 MOVSD XMM1,qword ptr [RBP + -0x18] MOVSD XMM0,qword ptr [0x00102090] MULSD XMM0,XMM1 MULSD XMM0,qword ptr [RBP + -0x18] MOVSD XMM1,qword ptr [RBP + -0x18] MULSD XMM0,XMM1 MOVSD qword ptr [RBP + -0x8],XMM0 MOVSD XMM0,qword ptr [RBP + -0x8] POP RBP RET
double func0(double param_1) { return DAT_00102090 * param_1 * param_1 * param_1; }
4,221
func0
#include <math.h> #include <assert.h>
double func0(double r) { double volume = (4.0/3.0) * M_PI * r * r * r; return volume; }
int main() { assert(func0(10) == 4188.790204786391); assert(func0(25) == 65449.84694978735); assert(func0(20) == 33510.32163829113); return 0; }
O1
c
func0: endbr64 movapd %xmm0,%xmm1 mulsd 0xecf(%rip),%xmm0 mulsd %xmm1,%xmm0 mulsd %xmm1,%xmm0 retq
func0: endbr64 movapd xmm1, xmm0 mulsd xmm0, cs:qword_2008 mulsd xmm0, xmm1 mulsd xmm0, xmm1 retn
double func0(double a1) { return a1 * 4.188790204786391 * a1 * a1; }
func0: ENDBR64 MOVAPD XMM1,XMM0 MULSD XMM0,qword ptr [0x00102008] MULSD XMM0,XMM1 MULSD XMM0,XMM1 RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(double param_1) { return param_1 * _DAT_00102008 * param_1 * param_1; }
4,222
func0
#include <math.h> #include <assert.h>
double func0(double r) { double volume = (4.0/3.0) * M_PI * r * r * r; return volume; }
int main() { assert(func0(10) == 4188.790204786391); assert(func0(25) == 65449.84694978735); assert(func0(20) == 33510.32163829113); return 0; }
O2
c
func0: endbr64 movapd %xmm0,%xmm1 movsd 0xeb8(%rip),%xmm0 mulsd %xmm1,%xmm0 mulsd %xmm1,%xmm0 mulsd %xmm1,%xmm0 retq nopl (%rax)
func0: endbr64 movapd xmm1, xmm0 movsd xmm0, cs:qword_2008 mulsd xmm0, xmm1 mulsd xmm0, xmm1 mulsd xmm0, xmm1 retn
double func0(double a1) { return 4.188790204786391 * a1 * a1 * a1; }
func0: ENDBR64 MOVAPD XMM1,XMM0 MOVSD XMM0,qword ptr [0x00102008] MULSD XMM0,XMM1 MULSD XMM0,XMM1 MULSD XMM0,XMM1 RET
double func0(double param_1) { return DAT_00102008 * param_1 * param_1 * param_1; }
4,223
func0
#include <math.h> #include <assert.h>
double func0(double r) { double volume = (4.0/3.0) * M_PI * r * r * r; return volume; }
int main() { assert(func0(10) == 4188.790204786391); assert(func0(25) == 65449.84694978735); assert(func0(20) == 33510.32163829113); return 0; }
O3
c
func0: endbr64 movapd %xmm0,%xmm1 movsd 0xeb8(%rip),%xmm0 mulsd %xmm1,%xmm0 mulsd %xmm1,%xmm0 mulsd %xmm1,%xmm0 retq nopl (%rax)
func0: endbr64 movapd xmm1, xmm0 movsd xmm0, cs:qword_2008 mulsd xmm0, xmm1 mulsd xmm0, xmm1 mulsd xmm0, xmm1 retn
double func0(double a1) { return 4.188790204786391 * a1 * a1 * a1; }
func0: ENDBR64 MOVAPD XMM1,XMM0 MOVSD XMM0,qword ptr [0x00102008] MULSD XMM0,XMM1 MULSD XMM0,XMM1 MULSD XMM0,XMM1 RET
double func0(double param_1) { return DAT_00102008 * param_1 * param_1 * param_1; }
4,224
func0
#include <stdio.h> #include <assert.h>
int func0(char *strr) { int summ = 0; for (int i = 0; strr[i] != '\0'; i++) { summ += (strr[i] - 'a' + 1); } if (summ % 26 == 0) { return 'z'; } else { summ = summ % 26; return ('a' + summ - 1); } }
int main() { assert(func0("abc") == 'f'); assert(func0("gfg") == 't'); assert(func0("ab") == 'c'); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 1182 <func0+0x39> mov -0x4(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax movsbl %al,%eax sub $0x60,%eax add %eax,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax movzbl (%rax),%eax test %al,%al jne 1165 <func0+0x1c> mov -0x8(%rbp),%edx movslq %edx,%rax imul $0x4ec4ec4f,%rax,%rax shr $0x20,%rax mov %eax,%ecx sar $0x3,%ecx mov %edx,%eax sar $0x1f,%eax sub %eax,%ecx mov %ecx,%eax imul $0x1a,%eax,%eax sub %eax,%edx mov %edx,%eax test %eax,%eax jne 11c7 <func0+0x7e> mov $0x7a,%eax jmp 11f0 <func0+0xa7> mov -0x8(%rbp),%eax movslq %eax,%rdx imul $0x4ec4ec4f,%rdx,%rdx shr $0x20,%rdx mov %edx,%ecx sar $0x3,%ecx cltd sub %edx,%ecx mov %ecx,%edx imul $0x1a,%edx,%edx sub %edx,%eax mov %eax,-0x8(%rbp) mov -0x8(%rbp),%eax add $0x60,%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_1182 loc_1165: mov eax, [rbp+var_4] movsxd rdx, eax mov rax, [rbp+var_18] add rax, rdx movzx eax, byte ptr [rax] movsx eax, al sub eax, 60h ; '`' add [rbp+var_8], eax add [rbp+var_4], 1 loc_1182: mov eax, [rbp+var_4] movsxd rdx, eax mov rax, [rbp+var_18] add rax, rdx movzx eax, byte ptr [rax] test al, al jnz short loc_1165 mov edx, [rbp+var_8] movsxd rax, edx imul rax, 4EC4EC4Fh shr rax, 20h sar eax, 3 mov ecx, edx sar ecx, 1Fh sub eax, ecx imul ecx, eax, 1Ah mov eax, edx sub eax, ecx test eax, eax jnz short loc_11C3 mov eax, 7Ah ; 'z' jmp short loc_11EA loc_11C3: mov eax, [rbp+var_8] movsxd rdx, eax imul rdx, 4EC4EC4Fh shr rdx, 20h mov ecx, edx sar ecx, 3 cdq sub ecx, edx imul edx, ecx, 1Ah sub eax, edx mov [rbp+var_8], eax mov eax, [rbp+var_8] add eax, 60h ; '`' loc_11EA: pop rbp retn
long long func0(long long a1) { int v2; // [rsp+10h] [rbp-8h] int i; // [rsp+14h] [rbp-4h] v2 = 0; for ( i = 0; *(_BYTE *)(i + a1); ++i ) v2 += *(char *)(i + a1) - 96; if ( v2 % 26 ) return (unsigned int)(v2 % 26 + 96); else return 122LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101182 LAB_00101165: MOV EAX,dword ptr [RBP + -0x4] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] MOVSX EAX,AL SUB EAX,0x60 ADD dword ptr [RBP + -0x8],EAX ADD dword ptr [RBP + -0x4],0x1 LAB_00101182: MOV EAX,dword ptr [RBP + -0x4] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVZX EAX,byte ptr [RAX] TEST AL,AL JNZ 0x00101165 MOV EDX,dword ptr [RBP + -0x8] MOVSXD RAX,EDX IMUL RAX,RAX,0x4ec4ec4f SHR RAX,0x20 SAR EAX,0x3 MOV ECX,EDX SAR ECX,0x1f SUB EAX,ECX IMUL ECX,EAX,0x1a MOV EAX,EDX SUB EAX,ECX TEST EAX,EAX JNZ 0x001011c3 MOV EAX,0x7a JMP 0x001011ea LAB_001011c3: MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX IMUL RDX,RDX,0x4ec4ec4f SHR RDX,0x20 MOV ECX,EDX SAR ECX,0x3 CDQ SUB ECX,EDX IMUL EDX,ECX,0x1a SUB EAX,EDX MOV dword ptr [RBP + -0x8],EAX MOV EAX,dword ptr [RBP + -0x8] ADD EAX,0x60 LAB_001011ea: POP RBP RET
int func0(long param_1) { int iVar1; int4 local_10; int4 local_c; local_10 = 0; for (local_c = 0; *(char *)(param_1 + local_c) != '\0'; local_c = local_c + 1) { local_10 = local_10 + *(char *)(param_1 + local_c) + -0x60; } if (local_10 % 0x1a == 0) { iVar1 = 0x7a; } else { iVar1 = local_10 % 0x1a + 0x60; } return iVar1; }
4,225
func0
#include <stdio.h> #include <assert.h>
int func0(char *strr) { int summ = 0; for (int i = 0; strr[i] != '\0'; i++) { summ += (strr[i] - 'a' + 1); } if (summ % 26 == 0) { return 'z'; } else { summ = summ % 26; return ('a' + summ - 1); } }
int main() { assert(func0("abc") == 'f'); assert(func0("gfg") == 't'); assert(func0("ab") == 'c'); return 0; }
O1
c
func0: endbr64 movzbl (%rdi),%eax test %al,%al je 1196 <func0+0x4d> add $0x1,%rdi mov $0x0,%edx movsbl %al,%eax lea -0x60(%rdx,%rax,1),%edx add $0x1,%rdi movzbl -0x1(%rdi),%eax test %al,%al jne 115d <func0+0x14> movslq %edx,%rcx imul $0x4ec4ec4f,%rcx,%rcx sar $0x23,%rcx mov %edx,%eax sar $0x1f,%eax sub %eax,%ecx imul $0x1a,%ecx,%ecx sub %ecx,%edx lea 0x60(%rdx),%eax mov $0x7a,%edx cmove %edx,%eax retq mov $0x7a,%eax retq
func0: endbr64 movzx eax, byte ptr [rdi] test al, al jz short loc_1198 add rdi, 1 mov edx, 0 loc_115D: movsx eax, al lea edx, [rdx+rax-60h] add rdi, 1 movzx eax, byte ptr [rdi-1] test al, al jnz short loc_115D movsxd rcx, edx imul rcx, 4EC4EC4Fh sar rcx, 23h mov eax, edx sar eax, 1Fh sub ecx, eax imul eax, ecx, 1Ah mov ecx, edx sub ecx, eax lea eax, [rcx+60h] mov edx, 7Ah ; 'z' cmovz eax, edx retn loc_1198: mov eax, 7Ah ; 'z' retn
long long func0(char *a1) { char v1; // al char *v2; // rdi int v3; // edx long long result; // rax v1 = *a1; if ( !*a1 ) return 122LL; v2 = a1 + 1; v3 = 0; do { v3 = v3 + v1 - 96; v1 = *v2++; } while ( v1 ); result = (unsigned int)(v3 % 26 + 96); if ( !(v3 % 26) ) return 122LL; return result; }
func0: ENDBR64 MOVZX EAX,byte ptr [RDI] TEST AL,AL JZ 0x00101198 ADD RDI,0x1 MOV EDX,0x0 LAB_0010115d: MOVSX EAX,AL LEA EDX,[RDX + RAX*0x1 + -0x60] ADD RDI,0x1 MOVZX EAX,byte ptr [RDI + -0x1] TEST AL,AL JNZ 0x0010115d MOVSXD RCX,EDX IMUL RCX,RCX,0x4ec4ec4f SAR RCX,0x23 MOV EAX,EDX SAR EAX,0x1f SUB ECX,EAX IMUL EAX,ECX,0x1a MOV ECX,EDX SUB ECX,EAX LEA EAX,[RCX + 0x60] MOV EDX,0x7a CMOVZ EAX,EDX RET LAB_00101198: MOV EAX,0x7a RET
int func0(char *param_1) { char cVar1; int iVar2; int iVar3; char *pcVar4; cVar1 = *param_1; if (cVar1 != '\0') { iVar3 = 0; pcVar4 = param_1 + 1; do { iVar3 = iVar3 + -0x60 + (int)cVar1; cVar1 = *pcVar4; pcVar4 = pcVar4 + 1; } while (cVar1 != '\0'); iVar2 = iVar3 % 0x1a + 0x60; if (iVar3 % 0x1a == 0) { iVar2 = 0x7a; } return iVar2; } return 0x7a; }
4,226
func0
#include <stdio.h> #include <assert.h>
int func0(char *strr) { int summ = 0; for (int i = 0; strr[i] != '\0'; i++) { summ += (strr[i] - 'a' + 1); } if (summ % 26 == 0) { return 'z'; } else { summ = summ % 26; return ('a' + summ - 1); } }
int main() { assert(func0("abc") == 'f'); assert(func0("gfg") == 't'); assert(func0("ab") == 'c'); return 0; }
O2
c
func0: endbr64 movsbl (%rdi),%eax test %al,%al je 12b0 <func0+0x50> add $0x1,%rdi xor %edx,%edx nopl 0x0(%rax) add $0x1,%rdi lea -0x60(%rdx,%rax,1),%edx movsbl -0x1(%rdi),%eax test %al,%al jne 1278 <func0+0x18> movslq %edx,%rcx mov %edx,%eax imul $0x4ec4ec4f,%rcx,%rcx sar $0x1f,%eax sar $0x23,%rcx sub %eax,%ecx imul $0x1a,%ecx,%ecx sub %ecx,%edx lea 0x60(%rdx),%eax mov $0x7a,%edx cmove %edx,%eax retq xchg %ax,%ax mov $0x7a,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 movsx eax, byte ptr [rdi] test al, al jz short loc_1240 add rdi, 1 xor edx, edx nop dword ptr [rax+00000000h] loc_1208: add rdi, 1 lea edx, [rdx+rax-60h] movsx eax, byte ptr [rdi-1] test al, al jnz short loc_1208 movsxd rcx, edx mov eax, edx imul rcx, 4EC4EC4Fh sar eax, 1Fh sar rcx, 23h sub ecx, eax imul eax, ecx, 1Ah mov ecx, edx mov edx, 7Ah ; 'z' sub ecx, eax lea eax, [rcx+60h] cmovz eax, edx retn loc_1240: mov eax, 7Ah ; 'z' retn
long long func0(_BYTE *a1) { int v1; // eax _BYTE *v2; // rdi int v3; // edx long long result; // rax v1 = (char)*a1; if ( !*a1 ) return 122LL; v2 = a1 + 1; v3 = 0; do { ++v2; v3 = v3 + v1 - 96; v1 = (char)*(v2 - 1); } while ( *(v2 - 1) ); result = (unsigned int)(v3 % 26 + 96); if ( !(v3 % 26) ) return 122LL; return result; }
func0: ENDBR64 MOVSX EAX,byte ptr [RDI] TEST AL,AL JZ 0x00101240 ADD RDI,0x1 XOR EDX,EDX NOP dword ptr [RAX] LAB_00101208: ADD RDI,0x1 LEA EDX,[RDX + RAX*0x1 + -0x60] MOVSX EAX,byte ptr [RDI + -0x1] TEST AL,AL JNZ 0x00101208 MOVSXD RCX,EDX MOV EAX,EDX IMUL RCX,RCX,0x4ec4ec4f SAR EAX,0x1f SAR RCX,0x23 SUB ECX,EAX IMUL EAX,ECX,0x1a MOV ECX,EDX MOV EDX,0x7a SUB ECX,EAX LEA EAX,[RCX + 0x60] CMOVZ EAX,EDX RET LAB_00101240: MOV EAX,0x7a RET
int func0(char *param_1) { char cVar1; int iVar2; int iVar3; char *pcVar4; cVar1 = *param_1; if (cVar1 != '\0') { iVar3 = 0; pcVar4 = param_1 + 1; do { iVar3 = iVar3 + -0x60 + (int)cVar1; cVar1 = *pcVar4; pcVar4 = pcVar4 + 1; } while (cVar1 != '\0'); iVar2 = iVar3 % 0x1a + 0x60; if (iVar3 % 0x1a == 0) { iVar2 = 0x7a; } return iVar2; } return 0x7a; }
4,227
func0
#include <stdio.h> #include <assert.h>
int func0(char *strr) { int summ = 0; for (int i = 0; strr[i] != '\0'; i++) { summ += (strr[i] - 'a' + 1); } if (summ % 26 == 0) { return 'z'; } else { summ = summ % 26; return ('a' + summ - 1); } }
int main() { assert(func0("abc") == 'f'); assert(func0("gfg") == 't'); assert(func0("ab") == 'c'); return 0; }
O3
c
func0: endbr64 movsbl (%rdi),%eax test %al,%al je 12b0 <func0+0x50> add $0x1,%rdi xor %edx,%edx nopl 0x0(%rax) add $0x1,%rdi lea -0x60(%rdx,%rax,1),%edx movsbl -0x1(%rdi),%eax test %al,%al jne 1278 <func0+0x18> movslq %edx,%rcx mov %edx,%eax imul $0x4ec4ec4f,%rcx,%rcx sar $0x1f,%eax sar $0x23,%rcx sub %eax,%ecx imul $0x1a,%ecx,%ecx sub %ecx,%edx lea 0x60(%rdx),%eax mov $0x7a,%edx cmove %edx,%eax retq xchg %ax,%ax mov $0x7a,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 movsx eax, byte ptr [rdi] test al, al jz short loc_12B0 add rdi, 1 xor edx, edx nop dword ptr [rax+00000000h] loc_1278: add rdi, 1 lea edx, [rdx+rax-60h] movsx eax, byte ptr [rdi-1] test al, al jnz short loc_1278 movsxd rcx, edx mov eax, edx imul rcx, 4EC4EC4Fh sar eax, 1Fh sar rcx, 23h sub ecx, eax imul eax, ecx, 1Ah mov ecx, edx mov edx, 7Ah ; 'z' sub ecx, eax lea eax, [rcx+60h] cmovz eax, edx retn loc_12B0: mov eax, 7Ah ; 'z' retn
long long func0(_BYTE *a1) { int v1; // eax _BYTE *v2; // rdi int v3; // edx long long result; // rax v1 = (char)*a1; if ( !*a1 ) return 122LL; v2 = a1 + 1; v3 = 0; do { ++v2; v3 = v3 + v1 - 96; v1 = (char)*(v2 - 1); } while ( *(v2 - 1) ); result = (unsigned int)(v3 % 26 + 96); if ( !(v3 % 26) ) return 122LL; return result; }
func0: ENDBR64 MOVSX EAX,byte ptr [RDI] TEST AL,AL JZ 0x001012b0 ADD RDI,0x1 XOR EDX,EDX NOP dword ptr [RAX] LAB_00101278: ADD RDI,0x1 LEA EDX,[RDX + RAX*0x1 + -0x60] MOVSX EAX,byte ptr [RDI + -0x1] TEST AL,AL JNZ 0x00101278 MOVSXD RCX,EDX MOV EAX,EDX IMUL RCX,RCX,0x4ec4ec4f SAR EAX,0x1f SAR RCX,0x23 SUB ECX,EAX IMUL EAX,ECX,0x1a MOV ECX,EDX MOV EDX,0x7a SUB ECX,EAX LEA EAX,[RCX + 0x60] CMOVZ EAX,EDX RET LAB_001012b0: MOV EAX,0x7a RET
int func0(char *param_1) { char cVar1; int iVar2; int iVar3; char *pcVar4; cVar1 = *param_1; if (cVar1 != '\0') { iVar3 = 0; pcVar4 = param_1 + 1; do { iVar3 = iVar3 + -0x60 + (int)cVar1; cVar1 = *pcVar4; pcVar4 = pcVar4 + 1; } while (cVar1 != '\0'); iVar2 = iVar3 % 0x1a + 0x60; if (iVar3 % 0x1a == 0) { iVar2 = 0x7a; } return iVar2; } return 0x7a; }
4,228
func0
#include <assert.h>
int func0(int n) { if (n == 1 || n == 2) { return 1; } else{ return func0(func0(n - 1)) + func0(n - func0(n - 1)); } }
int main() { assert(func0(10) == 6); assert(func0(2) == 1); assert(func0(3) == 2); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x18,%rsp mov %edi,-0x14(%rbp) cmpl $0x1,-0x14(%rbp) je 1165 <func0+0x1c> cmpl $0x2,-0x14(%rbp) jne 116c <func0+0x23> mov $0x1,%eax jmp 119f <func0+0x56> mov -0x14(%rbp),%eax sub $0x1,%eax mov %eax,%edi callq 1149 <func0> mov %eax,%edi callq 1149 <func0> mov %eax,%ebx mov -0x14(%rbp),%eax sub $0x1,%eax mov %eax,%edi callq 1149 <func0> mov -0x14(%rbp),%edx sub %eax,%edx mov %edx,%eax mov %eax,%edi callq 1149 <func0> add %ebx,%eax add $0x18,%rsp pop %rbx pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 18h mov [rbp+var_14], edi cmp [rbp+var_14], 1 jz short loc_1165 cmp [rbp+var_14], 2 jnz short loc_116C loc_1165: mov eax, 1 jmp short loc_119D loc_116C: mov eax, [rbp+var_14] sub eax, 1 mov edi, eax call func0 mov edi, eax call func0 mov ebx, eax mov eax, [rbp+var_14] sub eax, 1 mov edi, eax call func0 mov edx, [rbp+var_14] sub edx, eax mov edi, edx call func0 add eax, ebx loc_119D: mov rbx, [rbp+var_8] leave retn
long long func0(int a1) { unsigned int v2; // eax int v3; // ebx int v4; // eax if ( a1 == 1 || a1 == 2 ) return 1LL; v2 = func0((unsigned int)(a1 - 1)); v3 = func0(v2); v4 = func0((unsigned int)(a1 - 1)); return v3 + (unsigned int)func0((unsigned int)(a1 - v4)); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x18 MOV dword ptr [RBP + -0x14],EDI CMP dword ptr [RBP + -0x14],0x1 JZ 0x00101165 CMP dword ptr [RBP + -0x14],0x2 JNZ 0x0010116c LAB_00101165: MOV EAX,0x1 JMP 0x0010119d LAB_0010116c: MOV EAX,dword ptr [RBP + -0x14] SUB EAX,0x1 MOV EDI,EAX CALL 0x00101149 MOV EDI,EAX CALL 0x00101149 MOV EBX,EAX MOV EAX,dword ptr [RBP + -0x14] SUB EAX,0x1 MOV EDI,EAX CALL 0x00101149 MOV EDX,dword ptr [RBP + -0x14] SUB EDX,EAX MOV EDI,EDX CALL 0x00101149 ADD EAX,EBX LAB_0010119d: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
int func0(int param_1) { int4 uVar1; int iVar2; int iVar3; if ((param_1 == 1) || (param_1 == 2)) { iVar3 = 1; } else { uVar1 = func0(param_1 + -1); iVar2 = func0(uVar1); iVar3 = func0(param_1 + -1); iVar3 = func0(param_1 - iVar3); iVar3 = iVar3 + iVar2; } return iVar3; }
4,229
func0
#include <assert.h>
int func0(int n) { if (n == 1 || n == 2) { return 1; } else{ return func0(func0(n - 1)) + func0(n - func0(n - 1)); } }
int main() { assert(func0(10) == 6); assert(func0(2) == 1); assert(func0(3) == 2); return 0; }
O1
c
func0: endbr64 lea -0x1(%rdi),%edx mov $0x1,%eax cmp $0x1,%edx ja 115b <func0+0x12> retq push %r12 push %rbp push %rbx mov %edi,%ebx mov %edx,%edi callq 1149 <func0> mov %eax,%r12d mov %eax,%edi callq 1149 <func0> mov %eax,%ebp sub %r12d,%ebx mov %ebx,%edi callq 1149 <func0> add %ebp,%eax pop %rbx pop %rbp pop %r12 retq
func0: endbr64 lea edx, [rdi-1] mov eax, 1 cmp edx, 1 ja short loc_115B retn loc_115B: push r12 push rbp push rbx mov ebx, edi mov edi, edx call func0 mov r12d, eax mov edi, eax call func0 mov ebp, eax sub ebx, r12d mov edi, ebx call func0 add eax, ebp pop rbx pop rbp pop r12 retn
long long func0(int a1) { long long result; // rax long long v2; // r12 int v3; // ebp result = 1LL; if ( (unsigned int)(a1 - 1) > 1 ) { v2 = (unsigned int)func0((unsigned int)(a1 - 1)); v3 = func0(v2); return v3 + (unsigned int)func0((unsigned int)(a1 - v2)); } return result; }
func0: ENDBR64 LEA EDX,[RDI + -0x1] MOV EAX,0x1 CMP EDX,0x1 JA 0x0010115b RET LAB_0010115b: PUSH R12 PUSH RBP PUSH RBX MOV EBX,EDI MOV EDI,EDX CALL 0x00101149 MOV R12D,EAX MOV EDI,EAX CALL 0x00101149 MOV EBP,EAX SUB EBX,R12D MOV EDI,EBX CALL 0x00101149 ADD EAX,EBP POP RBX POP RBP POP R12 RET
int func0(int param_1) { int iVar1; int iVar2; if (param_1 - 1U < 2) { return 1; } iVar1 = func0(param_1 - 1U); iVar2 = func0(iVar1); iVar1 = func0(param_1 - iVar1); return iVar1 + iVar2; }
4,230
func0
#include <assert.h>
int func0(int n) { if (n == 1 || n == 2) { return 1; } else{ return func0(func0(n - 1)) + func0(n - func0(n - 1)); } }
int main() { assert(func0(10) == 6); assert(func0(2) == 1); assert(func0(3) == 2); return 0; }
O2
c
func0: endbr64 push %r12 mov $0x1,%eax push %rbp mov %edi,%ebp sub $0x1,%edi push %rbx cmp $0x1,%edi jbe 122a <func0+0x3a> xor %r12d,%r12d callq 11f0 <func0> mov %eax,%ebx mov %eax,%edi callq 11f0 <func0> sub %ebx,%ebp lea -0x1(%rbp),%edi add %eax,%r12d cmp $0x1,%edi ja 120a <func0+0x1a> lea 0x1(%r12),%eax pop %rbx pop %rbp pop %r12 retq
func0: endbr64 push r15 mov eax, edi push r14 sub eax, 1 push r13 push r12 push rbp push rbx sub rsp, 38h mov [rsp+68h+var_44], edi mov [rsp+68h+var_40], eax mov [rsp+68h+var_3C], 0 cmp eax, 1 jbe loc_1A0B loc_1220: mov eax, [rsp+68h+var_40] mov esi, [rsp+68h+var_44] mov [rsp+68h+var_54], eax cmp esi, 3 jz loc_19F0 mov [rsp+68h+var_58], eax lea eax, [rsi-2] mov [rsp+68h+var_48], 0 mov [rsp+68h+var_50], eax loc_1248: mov ecx, [rsp+68h+var_58] mov r13d, [rsp+68h+var_50] lea eax, [rcx-2] cmp eax, 1 jbe loc_1448 mov [rsp+68h+var_5C], 0 mov ebp, eax mov [rsp+68h+var_4C], r13d loc_126C: mov edi, ebp mov ebx, ebp xor r12d, r12d call func0 lea edi, [rax-1] mov r14d, eax cmp edi, 1 jbe loc_1A2A nop word ptr [rax+rax+00000000h] loc_1290: call func0 mov r15d, eax mov edi, eax call func0 sub r14d, r15d lea edi, [r14-1] add r12d, eax cmp edi, 1 ja short loc_1290 add r12d, 1 loc_12B2: lea eax, [r13-2] cmp eax, 1 jbe short loc_1300 xor r14d, r14d lea edi, [rbp-1] loc_12C1: call func0 mov ebp, eax mov edi, eax call func0 sub ebx, ebp lea edi, [rbx-1] add r14d, eax cmp edi, 1 ja short loc_12C1 lea edx, [r14+1] add [rsp+68h+var_5C], r12d sub r13d, edx lea ebp, [r13-1] cmp ebp, 1 ja loc_126C mov r14d, [rsp+68h+var_4C] jmp short loc_130A loc_1300: add [rsp+68h+var_5C], r12d mov r14d, [rsp+68h+var_4C] loc_130A: mov ebp, [rsp+68h+var_5C] lea r13d, [rbp+1] cmp ebp, 1 jbe loc_1A9C mov [rsp+68h+var_5C], 0 mov [rsp+68h+var_4C], r14d loc_1328: mov edi, ebp mov ebx, ebp xor r15d, r15d call func0 lea edi, [rax-1] mov r14d, eax cmp edi, 1 jbe loc_1A35 nop dword ptr [rax+rax+00h] loc_1348: call func0 mov r12d, eax mov edi, eax call func0 sub r14d, r12d lea edi, [r14-1] add r15d, eax cmp edi, 1 ja short loc_1348 add r15d, 1 loc_136A: lea eax, [r13-2] cmp eax, 1 jbe short loc_13B8 xor r14d, r14d lea edi, [rbp-1] loc_1379: call func0 mov ebp, eax mov edi, eax call func0 sub ebx, ebp lea edi, [rbx-1] add r14d, eax cmp edi, 1 ja short loc_1379 lea edx, [r14+1] add [rsp+68h+var_5C], r15d sub r13d, edx lea ebp, [r13-1] cmp ebp, 1 ja loc_1328 mov r14d, [rsp+68h+var_4C] jmp short loc_13C2 loc_13B8: add [rsp+68h+var_5C], r15d mov r14d, [rsp+68h+var_4C] loc_13C2: mov eax, [rsp+68h+var_5C] add eax, 1 mov [rsp+68h+var_5C], eax loc_13CD: mov eax, [rsp+68h+var_50] xor ebp, ebp lea edi, [rax-1] loc_13D6: call func0 xor r12d, r12d lea edi, [rax-1] mov r13d, eax mov r15d, eax cmp edi, 1 jbe loc_1A40 loc_13F0: call func0 mov ebx, eax mov edi, eax call func0 sub r15d, ebx lea edi, [r15-1] add r12d, eax cmp edi, 1 ja short loc_13F0 add r12d, 1 loc_1411: sub r14d, r13d add ebp, r12d lea edi, [r14-1] cmp edi, 1 ja short loc_13D6 add ebp, 1 sub [rsp+68h+var_58], ebp mov eax, [rsp+68h+var_58] mov ecx, [rsp+68h+var_5C] add [rsp+68h+var_48], ecx sub eax, 1 mov [rsp+68h+var_50], eax cmp eax, 1 ja loc_1248 jmp short loc_144D loc_1448: add [rsp+68h+var_48], 1 loc_144D: mov eax, [rsp+68h+var_48] lea esi, [rax+1] mov [rsp+68h+var_58], esi cmp eax, 1 jbe loc_1AA9 mov [rsp+68h+var_48], 0 mov [rsp+68h+var_50], eax loc_146D: mov esi, [rsp+68h+var_58] mov r14d, [rsp+68h+var_50] lea eax, [rsi-2] cmp eax, 1 jbe loc_16E0 mov [rsp+68h+var_5C], 0 mov ebp, eax mov [rsp+68h+var_4C], r14d loc_1491: mov edi, ebp mov ebx, ebp xor r12d, r12d call func0 lea edi, [rax-1] mov r13d, eax cmp edi, 1 jbe loc_1A4B nop dword ptr [rax+00h] loc_14B0: call func0 mov r15d, eax mov edi, eax call func0 sub r13d, r15d lea edi, [r13-1] add r12d, eax cmp edi, 1 ja short loc_14B0 add r12d, 1 loc_14D2: lea eax, [r14-2] cmp eax, 1 jbe short loc_1520 xor r13d, r13d lea edi, [rbp-1] loc_14E1: call func0 mov ebp, eax mov edi, eax call func0 sub ebx, ebp lea edi, [rbx-1] add r13d, eax cmp edi, 1 ja short loc_14E1 lea edx, [r13+1] add [rsp+68h+var_5C], r12d sub r14d, edx lea ebp, [r14-1] cmp ebp, 1 ja short loc_1491 mov r13d, [rsp+68h+var_4C] jmp short loc_152A loc_1520: add [rsp+68h+var_5C], r12d mov r13d, [rsp+68h+var_4C] loc_152A: mov ebp, [rsp+68h+var_5C] lea r14d, [rbp+1] cmp ebp, 1 jbe loc_1A61 mov [rsp+68h+var_5C], 0 mov [rsp+68h+var_4C], r13d loc_1548: mov edi, ebp mov ebx, ebp xor r15d, r15d call func0 lea edi, [rax-1] mov r13d, eax cmp edi, 1 jbe loc_1A1F nop dword ptr [rax+rax+00h] loc_1568: call func0 mov r12d, eax mov edi, eax call func0 sub r13d, r12d lea edi, [r13-1] add r15d, eax cmp edi, 1 ja short loc_1568 add r15d, 1 loc_158A: lea eax, [r14-2] cmp eax, 1 jbe short loc_15D8 xor r13d, r13d lea edi, [rbp-1] loc_1599: call func0 mov ebp, eax mov edi, eax call func0 sub ebx, ebp lea edi, [rbx-1] add r13d, eax cmp edi, 1 ja short loc_1599 lea edx, [r13+1] add [rsp+68h+var_5C], r15d sub r14d, edx lea ebp, [r14-1] cmp ebp, 1 ja loc_1548 mov r13d, [rsp+68h+var_4C] jmp short loc_15E2 loc_15D8: add [rsp+68h+var_5C], r15d mov r13d, [rsp+68h+var_4C] loc_15E2: mov eax, [rsp+68h+var_5C] add eax, 1 mov [rsp+68h+var_4C], eax loc_15ED: mov eax, [rsp+68h+var_50] mov [rsp+68h+var_5C], 0 lea r12d, [rax-1] lea eax, [r13-2] mov ebp, r12d cmp eax, 1 jbe loc_16AD loc_160D: mov r14d, r12d xor ebx, ebx mov edi, eax loc_1614: call func0 mov r15d, eax mov edi, eax call func0 sub r14d, r15d lea edi, [r14-1] add ebx, eax cmp edi, 1 ja short loc_1614 lea r15d, [rbx+1] cmp ebx, 1 jbe loc_1A91 xor r14d, r14d mov edi, ebx loc_1643: call func0 mov ebx, eax mov edi, eax call func0 sub r15d, ebx lea edi, [r15-1] add r14d, eax cmp edi, 1 ja short loc_1643 add r14d, 1 loc_1664: xor r15d, r15d lea edi, [r12-1] loc_166C: call func0 mov ebx, eax mov edi, eax call func0 sub ebp, ebx lea edi, [rbp-1] add r15d, eax cmp edi, 1 ja short loc_166C lea edx, [r15+1] add [rsp+68h+var_5C], r14d sub r13d, edx lea r12d, [r13-1] cmp r12d, 1 jbe short loc_16B2 lea eax, [r13-2] mov ebp, r12d cmp eax, 1 ja loc_160D loc_16AD: add [rsp+68h+var_5C], 1 loc_16B2: mov r14d, [rsp+68h+var_5C] mov ecx, [rsp+68h+var_4C] add [rsp+68h+var_48], ecx add r14d, 1 sub [rsp+68h+var_58], r14d mov eax, [rsp+68h+var_58] sub eax, 1 mov [rsp+68h+var_50], eax cmp eax, 1 ja loc_146D jmp short loc_16E5 loc_16E0: add [rsp+68h+var_48], 1 loc_16E5: mov eax, [rsp+68h+var_48] add eax, 1 mov [rsp+68h+var_48], eax loc_16F0: mov eax, [rsp+68h+var_40] mov [rsp+68h+var_4C], 0 sub eax, 1 mov [rsp+68h+var_50], eax loc_1703: mov ecx, [rsp+68h+var_54] mov r15d, [rsp+68h+var_50] lea eax, [rcx-2] mov r13d, r15d cmp eax, 1 jbe loc_19B8 mov [rsp+68h+var_58], 0 mov [rsp+68h+var_5C], eax loc_1727: mov r12d, [rsp+68h+var_5C] lea eax, [r15-2] mov ebx, r12d cmp eax, 1 jbe loc_17D8 xor ebp, ebp mov edi, eax loc_1740: call func0 mov r14d, eax mov edi, eax call func0 sub r12d, r14d lea edi, [r12-1] add ebp, eax cmp edi, 1 ja short loc_1740 lea r14d, [rbp+1] cmp ebp, 1 jbe loc_1A86 xor r12d, r12d mov edi, ebp loc_1770: call func0 mov ebp, eax mov edi, eax call func0 sub r14d, ebp lea edi, [r14-1] add r12d, eax cmp edi, 1 ja short loc_1770 add r12d, 1 loc_1791: mov eax, [rsp+68h+var_5C] xor ebp, ebp lea edi, [rax-1] loc_179A: call func0 mov r14d, eax mov edi, eax call func0 sub ebx, r14d lea edi, [rbx-1] add ebp, eax cmp edi, 1 ja short loc_179A lea edx, [rbp+1] add [rsp+68h+var_58], r12d sub r15d, edx lea eax, [r15-1] mov [rsp+68h+var_5C], eax cmp eax, 1 ja loc_1727 jmp short loc_17DD loc_17D8: add [rsp+68h+var_58], 1 loc_17DD: mov eax, [rsp+68h+var_58] lea r14d, [rax+1] cmp eax, 1 jbe loc_1A79 mov [rsp+68h+var_58], 0 mov [rsp+68h+var_5C], eax loc_17FA: mov r12d, [rsp+68h+var_5C] lea eax, [r14-2] mov ebx, r12d cmp eax, 1 jbe loc_18B0 xor ebp, ebp mov edi, eax loc_1813: call func0 mov r15d, eax mov edi, eax call func0 sub r12d, r15d lea edi, [r12-1] add ebp, eax cmp edi, 1 ja short loc_1813 lea r12d, [rbp+1] cmp ebp, 1 jbe loc_1A6E xor r15d, r15d mov edi, ebp loc_1843: call func0 mov ebp, eax mov edi, eax call func0 sub r12d, ebp lea edi, [r12-1] add r15d, eax cmp edi, 1 ja short loc_1843 add r15d, 1 loc_1865: mov eax, [rsp+68h+var_5C] xor ebp, ebp lea edi, [rax-1] loc_186E: call func0 mov r12d, eax mov edi, eax call func0 sub ebx, r12d lea edi, [rbx-1] add ebp, eax cmp edi, 1 ja short loc_186E lea edx, [rbp+1] add [rsp+68h+var_58], r15d sub r14d, edx lea eax, [r14-1] mov [rsp+68h+var_5C], eax cmp eax, 1 ja loc_17FA jmp short loc_18B5 loc_18B0: add [rsp+68h+var_58], 1 loc_18B5: mov eax, [rsp+68h+var_58] add eax, 1 mov [rsp+68h+var_58], eax loc_18C0: mov eax, [rsp+68h+var_50] mov [rsp+68h+var_5C], 0 lea r14d, [rax-1] lea eax, [r13-2] mov ebx, r14d cmp eax, 1 jbe loc_1980 loc_18E0: mov r12d, r14d xor ebp, ebp mov edi, eax loc_18E7: call func0 mov r15d, eax mov edi, eax call func0 sub r12d, r15d lea edi, [r12-1] add ebp, eax cmp edi, 1 ja short loc_18E7 lea r12d, [rbp+1] cmp ebp, 1 jbe loc_1A56 xor r15d, r15d mov edi, ebp loc_1917: call func0 mov ebp, eax mov edi, eax call func0 sub r12d, ebp lea edi, [r12-1] add r15d, eax cmp edi, 1 ja short loc_1917 add r15d, 1 loc_1939: xor ebp, ebp lea edi, [r14-1] loc_193F: call func0 mov r14d, eax mov edi, eax call func0 sub ebx, r14d lea edi, [rbx-1] add ebp, eax cmp edi, 1 ja short loc_193F lea edx, [rbp+1] add [rsp+68h+var_5C], r15d sub r13d, edx lea r14d, [r13-1] cmp r14d, 1 jbe short loc_1985 lea eax, [r13-2] mov ebx, r14d cmp eax, 1 ja loc_18E0 loc_1980: add [rsp+68h+var_5C], 1 loc_1985: mov r12d, [rsp+68h+var_5C] mov ecx, [rsp+68h+var_58] add [rsp+68h+var_4C], ecx add r12d, 1 sub [rsp+68h+var_54], r12d mov eax, [rsp+68h+var_54] sub eax, 1 mov [rsp+68h+var_50], eax cmp eax, 1 ja loc_1703 jmp short loc_19BD loc_19B8: add [rsp+68h+var_4C], 1 loc_19BD: mov eax, [rsp+68h+var_4C] mov ecx, [rsp+68h+var_48] add [rsp+68h+var_3C], ecx add eax, 1 sub [rsp+68h+var_44], eax mov eax, [rsp+68h+var_44] sub eax, 1 mov [rsp+68h+var_40], eax cmp eax, 1 ja loc_1220 jmp short loc_19F5 loc_19F0: add [rsp+68h+var_3C], 1 loc_19F5: mov eax, [rsp+68h+var_3C] add rsp, 38h pop rbx pop rbp add eax, 1 pop r12 pop r13 pop r14 pop r15 retn loc_1A0B: add rsp, 38h mov eax, 1 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1A1F: mov r15d, 1 jmp loc_158A loc_1A2A: mov r12d, 1 jmp loc_12B2 loc_1A35: mov r15d, 1 jmp loc_136A loc_1A40: mov r12d, 1 jmp loc_1411 loc_1A4B: mov r12d, 1 jmp loc_14D2 loc_1A56: mov r15d, 1 jmp loc_1939 loc_1A61: mov [rsp+68h+var_4C], 1 jmp loc_15ED loc_1A6E: mov r15d, 1 jmp loc_1865 loc_1A79: mov [rsp+68h+var_58], 1 jmp loc_18C0 loc_1A86: mov r12d, 1 jmp loc_1791 loc_1A91: mov r14d, 1 jmp loc_1664 loc_1A9C: mov [rsp+68h+var_5C], 1 jmp loc_13CD loc_1AA9: mov [rsp+68h+var_48], 1 jmp loc_16F0
long long func0(int a1) { int v1; // r13d unsigned int v2; // ebp unsigned int v3; // ebx int v4; // r12d int v5; // eax long long v6; // rdi int v7; // r14d long long v8; // r15 int v9; // r12d int v10; // r14d long long v11; // rdi long long v12; // rbp int v13; // r14d unsigned int v14; // ebp unsigned int v15; // r13d unsigned int v16; // ebx int v17; // r15d int v18; // eax long long v19; // rdi int v20; // r14d long long v21; // r12 int v22; // r15d int v23; // r14d long long v24; // rdi long long v25; // rbp int v26; // ebp long long v27; // rdi int v28; // eax int v29; // r12d long long v30; // rdi int v31; // r13d int v32; // r15d long long v33; // rbx int v34; // r12d unsigned int v35; // eax unsigned int v36; // r14d unsigned int v37; // ebp unsigned int v38; // ebx int v39; // r12d int v40; // eax long long v41; // rdi int v42; // r13d long long v43; // r15 int v44; // r12d int v45; // r13d long long v46; // rdi long long v47; // rbp unsigned int v48; // r13d unsigned int v49; // ebp unsigned int v50; // r14d unsigned int v51; // ebx int v52; // r15d int v53; // eax long long v54; // rdi int v55; // r13d long long v56; // r12 int v57; // r15d int v58; // r13d long long v59; // rdi long long v60; // rbp unsigned int v61; // r12d unsigned int v62; // eax unsigned int v63; // ebp unsigned int v64; // r14d unsigned int v65; // ebx long long v66; // rdi long long v67; // r15 unsigned int v68; // r15d int v69; // r14d long long v70; // rdi long long v71; // rbx int v72; // r14d int v73; // r15d long long v74; // rdi long long v75; // rbx int v76; // r15d int v77; // r13d int v78; // r12d int v79; // ebx unsigned int v80; // ebp long long v81; // rdi long long v82; // r14 unsigned int v83; // r14d int v84; // r12d long long v85; // rdi long long v86; // rbp int v87; // r12d int v88; // ebp long long v89; // rdi long long v90; // r14 unsigned int v91; // eax unsigned int v92; // r14d unsigned int v93; // r12d unsigned int v94; // ebx unsigned int v95; // ebp long long v96; // rdi long long v97; // r15 unsigned int v98; // r12d int v99; // r15d long long v100; // rdi long long v101; // rbp int v102; // r15d int v103; // ebp long long v104; // rdi long long v105; // r12 int v106; // r14d unsigned int v107; // eax int v108; // ebx int v109; // r12d unsigned int v110; // ebp long long v111; // rdi long long v112; // r15 unsigned int v113; // r12d int v114; // r15d long long v115; // rdi long long v116; // rbp int v117; // r15d int v118; // ebp long long v119; // rdi long long v120; // r14 unsigned int v122; // [rsp+Ch] [rbp-5Ch] int v123; // [rsp+Ch] [rbp-5Ch] int v124; // [rsp+Ch] [rbp-5Ch] unsigned int v125; // [rsp+Ch] [rbp-5Ch] int v126; // [rsp+Ch] [rbp-5Ch] int v127; // [rsp+Ch] [rbp-5Ch] int v128; // [rsp+Ch] [rbp-5Ch] unsigned int v129; // [rsp+Ch] [rbp-5Ch] int v130; // [rsp+Ch] [rbp-5Ch] int v131; // [rsp+10h] [rbp-58h] unsigned int v132; // [rsp+10h] [rbp-58h] unsigned int v133; // [rsp+10h] [rbp-58h] int v134; // [rsp+10h] [rbp-58h] int v135; // [rsp+10h] [rbp-58h] int v136; // [rsp+14h] [rbp-54h] int v137; // [rsp+18h] [rbp-50h] unsigned int v138; // [rsp+18h] [rbp-50h] int v139; // [rsp+18h] [rbp-50h] int v140; // [rsp+1Ch] [rbp-4Ch] unsigned int v141; // [rsp+1Ch] [rbp-4Ch] int v142; // [rsp+1Ch] [rbp-4Ch] int v143; // [rsp+1Ch] [rbp-4Ch] unsigned int v144; // [rsp+20h] [rbp-48h] int v145; // [rsp+20h] [rbp-48h] int v146; // [rsp+20h] [rbp-48h] int v147; // [rsp+24h] [rbp-44h] int v148; // [rsp+28h] [rbp-40h] int v149; // [rsp+2Ch] [rbp-3Ch] v147 = a1; v148 = a1 - 1; v149 = 0; if ( (unsigned int)(a1 - 1) <= 1 ) return 1LL; while ( 1 ) { v136 = v148; if ( v147 == 3 ) return (unsigned int)(++v149 + 1); v131 = v148; v144 = 0; v137 = v147 - 2; while ( 1 ) { v1 = v137; if ( (unsigned int)(v131 - 2) <= 1 ) break; v122 = 0; v2 = v131 - 2; while ( 1 ) { v3 = v2; v4 = 0; v5 = func0(v2); v6 = (unsigned int)(v5 - 1); v7 = v5; if ( (unsigned int)v6 <= 1 ) { v9 = 1; } else { do { v8 = (unsigned int)func0(v6); v7 -= v8; v6 = (unsigned int)(v7 - 1); v4 += func0(v8); } while ( (unsigned int)v6 > 1 ); v9 = v4 + 1; } if ( (unsigned int)(v1 - 2) <= 1 ) break; v10 = 0; v11 = v2 - 1; do { v12 = (unsigned int)func0(v11); v3 -= v12; v11 = v3 - 1; v10 += func0(v12); } while ( (unsigned int)v11 > 1 ); v122 += v9; v1 -= v10 + 1; v2 = v1 - 1; if ( (unsigned int)(v1 - 1) <= 1 ) { v13 = v137; goto LABEL_15; } } v122 += v9; v13 = v137; LABEL_15: v14 = v122; v15 = v122 + 1; if ( v122 <= 1 ) { v124 = 1; } else { v123 = 0; v140 = v13; while ( 1 ) { v16 = v14; v17 = 0; v18 = func0(v14); v19 = (unsigned int)(v18 - 1); v20 = v18; if ( (unsigned int)v19 <= 1 ) { v22 = 1; } else { do { v21 = (unsigned int)func0(v19); v20 -= v21; v19 = (unsigned int)(v20 - 1); v17 += func0(v21); } while ( (unsigned int)v19 > 1 ); v22 = v17 + 1; } if ( v15 - 2 <= 1 ) break; v23 = 0; v24 = v14 - 1; do { v25 = (unsigned int)func0(v24); v16 -= v25; v24 = v16 - 1; v23 += func0(v25); } while ( (unsigned int)v24 > 1 ); v123 += v22; v15 -= v23 + 1; v14 = v15 - 1; if ( v15 - 1 <= 1 ) { v13 = v140; goto LABEL_26; } } v123 += v22; v13 = v140; LABEL_26: v124 = v123 + 1; } v26 = 0; v27 = (unsigned int)(v137 - 1); do { v28 = func0(v27); v29 = 0; v30 = (unsigned int)(v28 - 1); v31 = v28; v32 = v28; if ( (unsigned int)v30 <= 1 ) { v34 = 1; } else { do { v33 = (unsigned int)func0(v30); v32 -= v33; v30 = (unsigned int)(v32 - 1); v29 += func0(v33); } while ( (unsigned int)v30 > 1 ); v34 = v29 + 1; } v13 -= v31; v26 += v34; v27 = (unsigned int)(v13 - 1); } while ( (unsigned int)v27 > 1 ); v131 -= v26 + 1; v144 += v124; v137 = v131 - 1; if ( (unsigned int)(v131 - 1) <= 1 ) goto LABEL_35; } ++v144; LABEL_35: v35 = v144; v132 = v144 + 1; if ( v144 <= 1 ) { v146 = 1; } else { v145 = 0; v138 = v35; while ( 1 ) { v36 = v138; if ( v132 - 2 <= 1 ) break; v125 = 0; v37 = v132 - 2; while ( 1 ) { v38 = v37; v39 = 0; v40 = func0(v37); v41 = (unsigned int)(v40 - 1); v42 = v40; if ( (unsigned int)v41 <= 1 ) { v44 = 1; } else { do { v43 = (unsigned int)func0(v41); v42 -= v43; v41 = (unsigned int)(v42 - 1); v39 += func0(v43); } while ( (unsigned int)v41 > 1 ); v44 = v39 + 1; } if ( v36 - 2 <= 1 ) break; v45 = 0; v46 = v37 - 1; do { v47 = (unsigned int)func0(v46); v38 -= v47; v46 = v38 - 1; v45 += func0(v47); } while ( (unsigned int)v46 > 1 ); v125 += v44; v36 -= v45 + 1; v37 = v36 - 1; if ( v36 - 1 <= 1 ) { v48 = v138; goto LABEL_48; } } v125 += v44; v48 = v138; LABEL_48: v49 = v125; v50 = v125 + 1; if ( v125 <= 1 ) { v142 = 1; } else { v126 = 0; v141 = v48; while ( 1 ) { v51 = v49; v52 = 0; v53 = func0(v49); v54 = (unsigned int)(v53 - 1); v55 = v53; if ( (unsigned int)v54 <= 1 ) { v57 = 1; } else { do { v56 = (unsigned int)func0(v54); v55 -= v56; v54 = (unsigned int)(v55 - 1); v52 += func0(v56); } while ( (unsigned int)v54 > 1 ); v57 = v52 + 1; } if ( v50 - 2 <= 1 ) break; v58 = 0; v59 = v49 - 1; do { v60 = (unsigned int)func0(v59); v51 -= v60; v59 = v51 - 1; v58 += func0(v60); } while ( (unsigned int)v59 > 1 ); v126 += v57; v50 -= v58 + 1; v49 = v50 - 1; if ( v50 - 1 <= 1 ) { v48 = v141; goto LABEL_59; } } v126 += v57; v48 = v141; LABEL_59: v142 = v126 + 1; } v127 = 0; v61 = v138 - 1; v62 = v48 - 2; v63 = v138 - 1; if ( v48 - 2 <= 1 ) { LABEL_71: ++v127; } else { while ( 1 ) { v64 = v61; v65 = 0; v66 = v62; do { v67 = (unsigned int)func0(v66); v64 -= v67; v66 = v64 - 1; v65 += func0(v67); } while ( (unsigned int)v66 > 1 ); v68 = v65 + 1; if ( v65 <= 1 ) { v72 = 1; } else { v69 = 0; v70 = v65; do { v71 = (unsigned int)func0(v70); v68 -= v71; v70 = v68 - 1; v69 += func0(v71); } while ( (unsigned int)v70 > 1 ); v72 = v69 + 1; } v73 = 0; v74 = v61 - 1; do { v75 = (unsigned int)func0(v74); v63 -= v75; v74 = v63 - 1; v73 += func0(v75); } while ( (unsigned int)v74 > 1 ); v127 += v72; v48 -= v73 + 1; v61 = v48 - 1; if ( v48 - 1 <= 1 ) break; v62 = v48 - 2; v63 = v48 - 1; if ( v48 - 2 <= 1 ) goto LABEL_71; } } v145 += v142; v132 -= v127 + 1; v138 = v132 - 1; if ( v132 - 1 <= 1 ) goto LABEL_75; } ++v145; LABEL_75: v146 = v145 + 1; } v143 = 0; v139 = v148 - 1; while ( 1 ) { v76 = v139; v77 = v139; if ( (unsigned int)(v136 - 2) <= 1 ) break; v133 = 0; v128 = v136 - 2; while ( 1 ) { v78 = v128; v79 = v128; if ( (unsigned int)(v76 - 2) <= 1 ) break; v80 = 0; v81 = (unsigned int)(v76 - 2); do { v82 = (unsigned int)func0(v81); v78 -= v82; v81 = (unsigned int)(v78 - 1); v80 += func0(v82); } while ( (unsigned int)v81 > 1 ); v83 = v80 + 1; if ( v80 <= 1 ) { v87 = 1; } else { v84 = 0; v85 = v80; do { v86 = (unsigned int)func0(v85); v83 -= v86; v85 = v83 - 1; v84 += func0(v86); } while ( (unsigned int)v85 > 1 ); v87 = v84 + 1; } v88 = 0; v89 = (unsigned int)(v128 - 1); do { v90 = (unsigned int)func0(v89); v79 -= v90; v89 = (unsigned int)(v79 - 1); v88 += func0(v90); } while ( (unsigned int)v89 > 1 ); v133 += v87; v76 -= v88 + 1; v128 = v76 - 1; if ( (unsigned int)(v76 - 1) <= 1 ) goto LABEL_91; } ++v133; LABEL_91: v91 = v133; v92 = v133 + 1; if ( v133 <= 1 ) { v135 = 1; } else { v134 = 0; v129 = v91; while ( 1 ) { v93 = v129; v94 = v129; if ( v92 - 2 <= 1 ) break; v95 = 0; v96 = v92 - 2; do { v97 = (unsigned int)func0(v96); v93 -= v97; v96 = v93 - 1; v95 += func0(v97); } while ( (unsigned int)v96 > 1 ); v98 = v95 + 1; if ( v95 <= 1 ) { v102 = 1; } else { v99 = 0; v100 = v95; do { v101 = (unsigned int)func0(v100); v98 -= v101; v100 = v98 - 1; v99 += func0(v101); } while ( (unsigned int)v100 > 1 ); v102 = v99 + 1; } v103 = 0; v104 = v129 - 1; do { v105 = (unsigned int)func0(v104); v94 -= v105; v104 = v94 - 1; v103 += func0(v105); } while ( (unsigned int)v104 > 1 ); v134 += v102; v92 -= v103 + 1; v129 = v92 - 1; if ( v92 - 1 <= 1 ) goto LABEL_105; } ++v134; LABEL_105: v135 = v134 + 1; } v130 = 0; v106 = v139 - 1; v107 = v139 - 2; v108 = v139 - 1; if ( (unsigned int)(v139 - 2) <= 1 ) { LABEL_117: ++v130; } else { while ( 1 ) { v109 = v106; v110 = 0; v111 = v107; do { v112 = (unsigned int)func0(v111); v109 -= v112; v111 = (unsigned int)(v109 - 1); v110 += func0(v112); } while ( (unsigned int)v111 > 1 ); v113 = v110 + 1; if ( v110 <= 1 ) { v117 = 1; } else { v114 = 0; v115 = v110; do { v116 = (unsigned int)func0(v115); v113 -= v116; v115 = v113 - 1; v114 += func0(v116); } while ( (unsigned int)v115 > 1 ); v117 = v114 + 1; } v118 = 0; v119 = (unsigned int)(v106 - 1); do { v120 = (unsigned int)func0(v119); v108 -= v120; v119 = (unsigned int)(v108 - 1); v118 += func0(v120); } while ( (unsigned int)v119 > 1 ); v130 += v117; v77 -= v118 + 1; v106 = v77 - 1; if ( (unsigned int)(v77 - 1) <= 1 ) break; v107 = v77 - 2; v108 = v77 - 1; if ( (unsigned int)(v77 - 2) <= 1 ) goto LABEL_117; } } v143 += v135; v136 -= v130 + 1; v139 = v136 - 1; if ( (unsigned int)(v136 - 1) <= 1 ) goto LABEL_121; } ++v143; LABEL_121: v149 += v146; v147 -= v143 + 1; v148 = v147 - 1; if ( (unsigned int)(v147 - 1) <= 1 ) return (unsigned int)(v149 + 1); } }
func0: ENDBR64 PUSH R15 MOV EAX,EDI PUSH R14 SUB EAX,0x1 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x38 MOV dword ptr [RSP + 0x24],EDI MOV dword ptr [RSP + 0x28],EAX MOV dword ptr [RSP + 0x2c],0x0 CMP EAX,0x1 JBE 0x00101a0b LAB_00101220: MOV EAX,dword ptr [RSP + 0x28] MOV ESI,dword ptr [RSP + 0x24] MOV dword ptr [RSP + 0x14],EAX CMP ESI,0x3 JZ 0x001019f0 MOV dword ptr [RSP + 0x10],EAX LEA EAX,[RSI + -0x2] MOV dword ptr [RSP + 0x20],0x0 MOV dword ptr [RSP + 0x18],EAX LAB_00101248: MOV ECX,dword ptr [RSP + 0x10] MOV R13D,dword ptr [RSP + 0x18] LEA EAX,[RCX + -0x2] CMP EAX,0x1 JBE 0x00101448 MOV dword ptr [RSP + 0xc],0x0 MOV EBP,EAX MOV dword ptr [RSP + 0x1c],R13D LAB_0010126c: MOV EDI,EBP MOV EBX,EBP XOR R12D,R12D CALL 0x001011f0 LEA EDI,[RAX + -0x1] MOV R14D,EAX CMP EDI,0x1 JBE 0x00101a2a NOP word ptr [RAX + RAX*0x1] LAB_00101290: CALL 0x001011f0 MOV R15D,EAX MOV EDI,EAX CALL 0x001011f0 SUB R14D,R15D LEA EDI,[R14 + -0x1] ADD R12D,EAX CMP EDI,0x1 JA 0x00101290 ADD R12D,0x1 LAB_001012b2: LEA EAX,[R13 + -0x2] CMP EAX,0x1 JBE 0x00101300 XOR R14D,R14D LEA EDI,[RBP + -0x1] LAB_001012c1: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,EBP LEA EDI,[RBX + -0x1] ADD R14D,EAX CMP EDI,0x1 JA 0x001012c1 LEA EDX,[R14 + 0x1] ADD dword ptr [RSP + 0xc],R12D SUB R13D,EDX LEA EBP,[R13 + -0x1] CMP EBP,0x1 JA 0x0010126c MOV R14D,dword ptr [RSP + 0x1c] JMP 0x0010130a LAB_00101300: ADD dword ptr [RSP + 0xc],R12D MOV R14D,dword ptr [RSP + 0x1c] LAB_0010130a: MOV EBP,dword ptr [RSP + 0xc] LEA R13D,[RBP + 0x1] CMP EBP,0x1 JBE 0x00101a9c MOV dword ptr [RSP + 0xc],0x0 MOV dword ptr [RSP + 0x1c],R14D LAB_00101328: MOV EDI,EBP MOV EBX,EBP XOR R15D,R15D CALL 0x001011f0 LEA EDI,[RAX + -0x1] MOV R14D,EAX CMP EDI,0x1 JBE 0x00101a35 NOP dword ptr [RAX + RAX*0x1] LAB_00101348: CALL 0x001011f0 MOV R12D,EAX MOV EDI,EAX CALL 0x001011f0 SUB R14D,R12D LEA EDI,[R14 + -0x1] ADD R15D,EAX CMP EDI,0x1 JA 0x00101348 ADD R15D,0x1 LAB_0010136a: LEA EAX,[R13 + -0x2] CMP EAX,0x1 JBE 0x001013b8 XOR R14D,R14D LEA EDI,[RBP + -0x1] LAB_00101379: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,EBP LEA EDI,[RBX + -0x1] ADD R14D,EAX CMP EDI,0x1 JA 0x00101379 LEA EDX,[R14 + 0x1] ADD dword ptr [RSP + 0xc],R15D SUB R13D,EDX LEA EBP,[R13 + -0x1] CMP EBP,0x1 JA 0x00101328 MOV R14D,dword ptr [RSP + 0x1c] JMP 0x001013c2 LAB_001013b8: ADD dword ptr [RSP + 0xc],R15D MOV R14D,dword ptr [RSP + 0x1c] LAB_001013c2: MOV EAX,dword ptr [RSP + 0xc] ADD EAX,0x1 MOV dword ptr [RSP + 0xc],EAX LAB_001013cd: MOV EAX,dword ptr [RSP + 0x18] XOR EBP,EBP LEA EDI,[RAX + -0x1] LAB_001013d6: CALL 0x001011f0 XOR R12D,R12D LEA EDI,[RAX + -0x1] MOV R13D,EAX MOV R15D,EAX CMP EDI,0x1 JBE 0x00101a40 LAB_001013f0: CALL 0x001011f0 MOV EBX,EAX MOV EDI,EAX CALL 0x001011f0 SUB R15D,EBX LEA EDI,[R15 + -0x1] ADD R12D,EAX CMP EDI,0x1 JA 0x001013f0 ADD R12D,0x1 LAB_00101411: SUB R14D,R13D ADD EBP,R12D LEA EDI,[R14 + -0x1] CMP EDI,0x1 JA 0x001013d6 ADD EBP,0x1 SUB dword ptr [RSP + 0x10],EBP MOV EAX,dword ptr [RSP + 0x10] MOV ECX,dword ptr [RSP + 0xc] ADD dword ptr [RSP + 0x20],ECX SUB EAX,0x1 MOV dword ptr [RSP + 0x18],EAX CMP EAX,0x1 JA 0x00101248 JMP 0x0010144d LAB_00101448: ADD dword ptr [RSP + 0x20],0x1 LAB_0010144d: MOV EAX,dword ptr [RSP + 0x20] LEA ESI,[RAX + 0x1] MOV dword ptr [RSP + 0x10],ESI CMP EAX,0x1 JBE 0x00101aa9 MOV dword ptr [RSP + 0x20],0x0 MOV dword ptr [RSP + 0x18],EAX LAB_0010146d: MOV ESI,dword ptr [RSP + 0x10] MOV R14D,dword ptr [RSP + 0x18] LEA EAX,[RSI + -0x2] CMP EAX,0x1 JBE 0x001016e0 MOV dword ptr [RSP + 0xc],0x0 MOV EBP,EAX MOV dword ptr [RSP + 0x1c],R14D LAB_00101491: MOV EDI,EBP MOV EBX,EBP XOR R12D,R12D CALL 0x001011f0 LEA EDI,[RAX + -0x1] MOV R13D,EAX CMP EDI,0x1 JBE 0x00101a4b NOP dword ptr [RAX] LAB_001014b0: CALL 0x001011f0 MOV R15D,EAX MOV EDI,EAX CALL 0x001011f0 SUB R13D,R15D LEA EDI,[R13 + -0x1] ADD R12D,EAX CMP EDI,0x1 JA 0x001014b0 ADD R12D,0x1 LAB_001014d2: LEA EAX,[R14 + -0x2] CMP EAX,0x1 JBE 0x00101520 XOR R13D,R13D LEA EDI,[RBP + -0x1] LAB_001014e1: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,EBP LEA EDI,[RBX + -0x1] ADD R13D,EAX CMP EDI,0x1 JA 0x001014e1 LEA EDX,[R13 + 0x1] ADD dword ptr [RSP + 0xc],R12D SUB R14D,EDX LEA EBP,[R14 + -0x1] CMP EBP,0x1 JA 0x00101491 MOV R13D,dword ptr [RSP + 0x1c] JMP 0x0010152a LAB_00101520: ADD dword ptr [RSP + 0xc],R12D MOV R13D,dword ptr [RSP + 0x1c] LAB_0010152a: MOV EBP,dword ptr [RSP + 0xc] LEA R14D,[RBP + 0x1] CMP EBP,0x1 JBE 0x00101a61 MOV dword ptr [RSP + 0xc],0x0 MOV dword ptr [RSP + 0x1c],R13D LAB_00101548: MOV EDI,EBP MOV EBX,EBP XOR R15D,R15D CALL 0x001011f0 LEA EDI,[RAX + -0x1] MOV R13D,EAX CMP EDI,0x1 JBE 0x00101a1f NOP dword ptr [RAX + RAX*0x1] LAB_00101568: CALL 0x001011f0 MOV R12D,EAX MOV EDI,EAX CALL 0x001011f0 SUB R13D,R12D LEA EDI,[R13 + -0x1] ADD R15D,EAX CMP EDI,0x1 JA 0x00101568 ADD R15D,0x1 LAB_0010158a: LEA EAX,[R14 + -0x2] CMP EAX,0x1 JBE 0x001015d8 XOR R13D,R13D LEA EDI,[RBP + -0x1] LAB_00101599: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,EBP LEA EDI,[RBX + -0x1] ADD R13D,EAX CMP EDI,0x1 JA 0x00101599 LEA EDX,[R13 + 0x1] ADD dword ptr [RSP + 0xc],R15D SUB R14D,EDX LEA EBP,[R14 + -0x1] CMP EBP,0x1 JA 0x00101548 MOV R13D,dword ptr [RSP + 0x1c] JMP 0x001015e2 LAB_001015d8: ADD dword ptr [RSP + 0xc],R15D MOV R13D,dword ptr [RSP + 0x1c] LAB_001015e2: MOV EAX,dword ptr [RSP + 0xc] ADD EAX,0x1 MOV dword ptr [RSP + 0x1c],EAX LAB_001015ed: MOV EAX,dword ptr [RSP + 0x18] MOV dword ptr [RSP + 0xc],0x0 LEA R12D,[RAX + -0x1] LEA EAX,[R13 + -0x2] MOV EBP,R12D CMP EAX,0x1 JBE 0x001016ad LAB_0010160d: MOV R14D,R12D XOR EBX,EBX MOV EDI,EAX LAB_00101614: CALL 0x001011f0 MOV R15D,EAX MOV EDI,EAX CALL 0x001011f0 SUB R14D,R15D LEA EDI,[R14 + -0x1] ADD EBX,EAX CMP EDI,0x1 JA 0x00101614 LEA R15D,[RBX + 0x1] CMP EBX,0x1 JBE 0x00101a91 XOR R14D,R14D MOV EDI,EBX LAB_00101643: CALL 0x001011f0 MOV EBX,EAX MOV EDI,EAX CALL 0x001011f0 SUB R15D,EBX LEA EDI,[R15 + -0x1] ADD R14D,EAX CMP EDI,0x1 JA 0x00101643 ADD R14D,0x1 LAB_00101664: XOR R15D,R15D LEA EDI,[R12 + -0x1] LAB_0010166c: CALL 0x001011f0 MOV EBX,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBP,EBX LEA EDI,[RBP + -0x1] ADD R15D,EAX CMP EDI,0x1 JA 0x0010166c LEA EDX,[R15 + 0x1] ADD dword ptr [RSP + 0xc],R14D SUB R13D,EDX LEA R12D,[R13 + -0x1] CMP R12D,0x1 JBE 0x001016b2 LEA EAX,[R13 + -0x2] MOV EBP,R12D CMP EAX,0x1 JA 0x0010160d LAB_001016ad: ADD dword ptr [RSP + 0xc],0x1 LAB_001016b2: MOV R14D,dword ptr [RSP + 0xc] MOV ECX,dword ptr [RSP + 0x1c] ADD dword ptr [RSP + 0x20],ECX ADD R14D,0x1 SUB dword ptr [RSP + 0x10],R14D MOV EAX,dword ptr [RSP + 0x10] SUB EAX,0x1 MOV dword ptr [RSP + 0x18],EAX CMP EAX,0x1 JA 0x0010146d JMP 0x001016e5 LAB_001016e0: ADD dword ptr [RSP + 0x20],0x1 LAB_001016e5: MOV EAX,dword ptr [RSP + 0x20] ADD EAX,0x1 MOV dword ptr [RSP + 0x20],EAX LAB_001016f0: MOV EAX,dword ptr [RSP + 0x28] MOV dword ptr [RSP + 0x1c],0x0 SUB EAX,0x1 MOV dword ptr [RSP + 0x18],EAX LAB_00101703: MOV ECX,dword ptr [RSP + 0x14] MOV R15D,dword ptr [RSP + 0x18] LEA EAX,[RCX + -0x2] MOV R13D,R15D CMP EAX,0x1 JBE 0x001019b8 MOV dword ptr [RSP + 0x10],0x0 MOV dword ptr [RSP + 0xc],EAX LAB_00101727: MOV R12D,dword ptr [RSP + 0xc] LEA EAX,[R15 + -0x2] MOV EBX,R12D CMP EAX,0x1 JBE 0x001017d8 XOR EBP,EBP MOV EDI,EAX LAB_00101740: CALL 0x001011f0 MOV R14D,EAX MOV EDI,EAX CALL 0x001011f0 SUB R12D,R14D LEA EDI,[R12 + -0x1] ADD EBP,EAX CMP EDI,0x1 JA 0x00101740 LEA R14D,[RBP + 0x1] CMP EBP,0x1 JBE 0x00101a86 XOR R12D,R12D MOV EDI,EBP LAB_00101770: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB R14D,EBP LEA EDI,[R14 + -0x1] ADD R12D,EAX CMP EDI,0x1 JA 0x00101770 ADD R12D,0x1 LAB_00101791: MOV EAX,dword ptr [RSP + 0xc] XOR EBP,EBP LEA EDI,[RAX + -0x1] LAB_0010179a: CALL 0x001011f0 MOV R14D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,R14D LEA EDI,[RBX + -0x1] ADD EBP,EAX CMP EDI,0x1 JA 0x0010179a LEA EDX,[RBP + 0x1] ADD dword ptr [RSP + 0x10],R12D SUB R15D,EDX LEA EAX,[R15 + -0x1] MOV dword ptr [RSP + 0xc],EAX CMP EAX,0x1 JA 0x00101727 JMP 0x001017dd LAB_001017d8: ADD dword ptr [RSP + 0x10],0x1 LAB_001017dd: MOV EAX,dword ptr [RSP + 0x10] LEA R14D,[RAX + 0x1] CMP EAX,0x1 JBE 0x00101a79 MOV dword ptr [RSP + 0x10],0x0 MOV dword ptr [RSP + 0xc],EAX LAB_001017fa: MOV R12D,dword ptr [RSP + 0xc] LEA EAX,[R14 + -0x2] MOV EBX,R12D CMP EAX,0x1 JBE 0x001018b0 XOR EBP,EBP MOV EDI,EAX LAB_00101813: CALL 0x001011f0 MOV R15D,EAX MOV EDI,EAX CALL 0x001011f0 SUB R12D,R15D LEA EDI,[R12 + -0x1] ADD EBP,EAX CMP EDI,0x1 JA 0x00101813 LEA R12D,[RBP + 0x1] CMP EBP,0x1 JBE 0x00101a6e XOR R15D,R15D MOV EDI,EBP LAB_00101843: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB R12D,EBP LEA EDI,[R12 + -0x1] ADD R15D,EAX CMP EDI,0x1 JA 0x00101843 ADD R15D,0x1 LAB_00101865: MOV EAX,dword ptr [RSP + 0xc] XOR EBP,EBP LEA EDI,[RAX + -0x1] LAB_0010186e: CALL 0x001011f0 MOV R12D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,R12D LEA EDI,[RBX + -0x1] ADD EBP,EAX CMP EDI,0x1 JA 0x0010186e LEA EDX,[RBP + 0x1] ADD dword ptr [RSP + 0x10],R15D SUB R14D,EDX LEA EAX,[R14 + -0x1] MOV dword ptr [RSP + 0xc],EAX CMP EAX,0x1 JA 0x001017fa JMP 0x001018b5 LAB_001018b0: ADD dword ptr [RSP + 0x10],0x1 LAB_001018b5: MOV EAX,dword ptr [RSP + 0x10] ADD EAX,0x1 MOV dword ptr [RSP + 0x10],EAX LAB_001018c0: MOV EAX,dword ptr [RSP + 0x18] MOV dword ptr [RSP + 0xc],0x0 LEA R14D,[RAX + -0x1] LEA EAX,[R13 + -0x2] MOV EBX,R14D CMP EAX,0x1 JBE 0x00101980 LAB_001018e0: MOV R12D,R14D XOR EBP,EBP MOV EDI,EAX LAB_001018e7: CALL 0x001011f0 MOV R15D,EAX MOV EDI,EAX CALL 0x001011f0 SUB R12D,R15D LEA EDI,[R12 + -0x1] ADD EBP,EAX CMP EDI,0x1 JA 0x001018e7 LEA R12D,[RBP + 0x1] CMP EBP,0x1 JBE 0x00101a56 XOR R15D,R15D MOV EDI,EBP LAB_00101917: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB R12D,EBP LEA EDI,[R12 + -0x1] ADD R15D,EAX CMP EDI,0x1 JA 0x00101917 ADD R15D,0x1 LAB_00101939: XOR EBP,EBP LEA EDI,[R14 + -0x1] LAB_0010193f: CALL 0x001011f0 MOV R14D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,R14D LEA EDI,[RBX + -0x1] ADD EBP,EAX CMP EDI,0x1 JA 0x0010193f LEA EDX,[RBP + 0x1] ADD dword ptr [RSP + 0xc],R15D SUB R13D,EDX LEA R14D,[R13 + -0x1] CMP R14D,0x1 JBE 0x00101985 LEA EAX,[R13 + -0x2] MOV EBX,R14D CMP EAX,0x1 JA 0x001018e0 LAB_00101980: ADD dword ptr [RSP + 0xc],0x1 LAB_00101985: MOV R12D,dword ptr [RSP + 0xc] MOV ECX,dword ptr [RSP + 0x10] ADD dword ptr [RSP + 0x1c],ECX ADD R12D,0x1 SUB dword ptr [RSP + 0x14],R12D MOV EAX,dword ptr [RSP + 0x14] SUB EAX,0x1 MOV dword ptr [RSP + 0x18],EAX CMP EAX,0x1 JA 0x00101703 JMP 0x001019bd LAB_001019b8: ADD dword ptr [RSP + 0x1c],0x1 LAB_001019bd: MOV EAX,dword ptr [RSP + 0x1c] MOV ECX,dword ptr [RSP + 0x20] ADD dword ptr [RSP + 0x2c],ECX ADD EAX,0x1 SUB dword ptr [RSP + 0x24],EAX MOV EAX,dword ptr [RSP + 0x24] SUB EAX,0x1 MOV dword ptr [RSP + 0x28],EAX CMP EAX,0x1 JA 0x00101220 JMP 0x001019f5 LAB_001019f0: ADD dword ptr [RSP + 0x2c],0x1 LAB_001019f5: MOV EAX,dword ptr [RSP + 0x2c] ADD RSP,0x38 POP RBX POP RBP ADD EAX,0x1 POP R12 POP R13 POP R14 POP R15 RET LAB_00101a0b: ADD RSP,0x38 MOV EAX,0x1 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101a1f: MOV R15D,0x1 JMP 0x0010158a LAB_00101a2a: MOV R12D,0x1 JMP 0x001012b2 LAB_00101a35: MOV R15D,0x1 JMP 0x0010136a LAB_00101a40: MOV R12D,0x1 JMP 0x00101411 LAB_00101a4b: MOV R12D,0x1 JMP 0x001014d2 LAB_00101a56: MOV R15D,0x1 JMP 0x00101939 LAB_00101a61: MOV dword ptr [RSP + 0x1c],0x1 JMP 0x001015ed LAB_00101a6e: MOV R15D,0x1 JMP 0x00101865 LAB_00101a79: MOV dword ptr [RSP + 0x10],0x1 JMP 0x001018c0 LAB_00101a86: MOV R12D,0x1 JMP 0x00101791 LAB_00101a91: MOV R14D,0x1 JMP 0x00101664 LAB_00101a9c: MOV dword ptr [RSP + 0xc],0x1 JMP 0x001013cd LAB_00101aa9: MOV dword ptr [RSP + 0x20],0x1 JMP 0x001016f0
int func0(int param_1) { int iVar1; int iVar2; int iVar3; int iVar4; int iVar5; uint uVar6; uint uVar7; int iVar8; uint uVar9; uint uVar10; uint local_5c; uint local_58; uint local_54; uint local_50; int local_4c; uint local_48; int local_44; uint local_40; int local_3c; local_40 = param_1 - 1; local_3c = 0; local_44 = param_1; if (local_40 < 2) { return 1; } do { local_54 = local_40; if (local_44 == 3) { local_3c = local_3c + 1; break; } local_58 = local_40; local_50 = local_44 - 2; local_48 = 0; do { uVar6 = local_58 - 2; if (uVar6 < 2) { local_48 = local_48 + 1; break; } local_5c = 0; uVar9 = local_50; uVar7 = local_5c; do { local_5c = uVar7; iVar8 = 0; iVar1 = func0(uVar6); if (iVar1 - 1U < 2) { iVar8 = 1; } else { do { iVar2 = func0(); iVar3 = func0(iVar2); iVar1 = iVar1 - iVar2; iVar8 = iVar8 + iVar3; } while (1 < iVar1 - 1U); iVar8 = iVar8 + 1; } if (uVar9 - 2 < 2) break; iVar1 = 0; uVar7 = uVar6 - 1; do { iVar2 = func0(uVar7); iVar3 = func0(iVar2); uVar6 = uVar6 - iVar2; uVar7 = uVar6 - 1; iVar1 = iVar1 + iVar3; } while (1 < uVar7); uVar9 = uVar9 - (iVar1 + 1); uVar6 = uVar9 - 1; uVar7 = local_5c + iVar8; } while (1 < uVar6); local_5c = local_5c + iVar8; uVar6 = local_5c; iVar1 = local_5c + 1; if (local_5c < 2) { local_5c = 1; } else { local_5c = 0; uVar9 = local_5c; do { local_5c = uVar9; iVar2 = 0; iVar8 = func0(uVar6); if (iVar8 - 1U < 2) { iVar2 = 1; } else { do { iVar3 = func0(); iVar4 = func0(iVar3); iVar8 = iVar8 - iVar3; iVar2 = iVar2 + iVar4; } while (1 < iVar8 - 1U); iVar2 = iVar2 + 1; } if (iVar1 - 2U < 2) break; iVar8 = 0; uVar9 = uVar6 - 1; do { iVar3 = func0(uVar9); iVar4 = func0(iVar3); uVar6 = uVar6 - iVar3; uVar9 = uVar6 - 1; iVar8 = iVar8 + iVar4; } while (1 < uVar9); iVar1 = iVar1 - (iVar8 + 1); uVar6 = iVar1 - 1; uVar9 = local_5c + iVar2; } while (1 < uVar6); local_5c = local_5c + iVar2; local_5c = local_5c + 1; } iVar1 = 0; uVar6 = local_50 - 1; do { iVar2 = func0(uVar6); iVar3 = 0; iVar8 = iVar2; if (iVar2 - 1U < 2) { iVar3 = 1; } else { do { iVar4 = func0(); iVar5 = func0(iVar4); iVar8 = iVar8 - iVar4; iVar3 = iVar3 + iVar5; } while (1 < iVar8 - 1U); iVar3 = iVar3 + 1; } local_50 = local_50 - iVar2; iVar1 = iVar1 + iVar3; uVar6 = local_50 - 1; } while (1 < uVar6); local_58 = local_58 - (iVar1 + 1); local_48 = local_48 + local_5c; local_50 = local_58 - 1; } while (1 < local_50); local_50 = local_48; local_58 = local_48 + 1; if (local_48 < 2) { local_48 = 1; } else { local_48 = 0; do { uVar6 = local_58 - 2; if (uVar6 < 2) { local_48 = local_48 + 1; break; } local_5c = 0; uVar9 = local_50; uVar7 = local_5c; do { local_5c = uVar7; iVar8 = 0; iVar1 = func0(uVar6); if (iVar1 - 1U < 2) { iVar8 = 1; } else { do { iVar2 = func0(); iVar3 = func0(iVar2); iVar1 = iVar1 - iVar2; iVar8 = iVar8 + iVar3; } while (1 < iVar1 - 1U); iVar8 = iVar8 + 1; } if (uVar9 - 2 < 2) break; iVar1 = 0; uVar7 = uVar6 - 1; do { iVar2 = func0(uVar7); iVar3 = func0(iVar2); uVar6 = uVar6 - iVar2; uVar7 = uVar6 - 1; iVar1 = iVar1 + iVar3; } while (1 < uVar7); uVar9 = uVar9 - (iVar1 + 1); uVar6 = uVar9 - 1; uVar7 = local_5c + iVar8; } while (1 < uVar6); local_5c = local_5c + iVar8; uVar6 = local_5c; iVar1 = local_5c + 1; if (local_5c < 2) { local_4c = 1; } else { local_5c = 0; uVar9 = local_5c; do { local_5c = uVar9; iVar2 = 0; iVar8 = func0(uVar6); if (iVar8 - 1U < 2) { iVar2 = 1; } else { do { iVar3 = func0(); iVar4 = func0(iVar3); iVar8 = iVar8 - iVar3; iVar2 = iVar2 + iVar4; } while (1 < iVar8 - 1U); iVar2 = iVar2 + 1; } if (iVar1 - 2U < 2) break; iVar8 = 0; uVar9 = uVar6 - 1; do { iVar3 = func0(uVar9); iVar4 = func0(iVar3); uVar6 = uVar6 - iVar3; uVar9 = uVar6 - 1; iVar8 = iVar8 + iVar4; } while (1 < uVar9); iVar1 = iVar1 - (iVar8 + 1); uVar6 = iVar1 - 1; uVar9 = local_5c + iVar2; } while (1 < uVar6); local_5c = local_5c + iVar2; local_4c = local_5c + 1; } local_5c = 0; uVar6 = local_50 - 1; do { uVar9 = local_50 - 2; if (uVar9 < 2) { local_5c = local_5c + 1; break; } uVar7 = 0; uVar10 = uVar6; do { iVar1 = func0(uVar9); iVar8 = func0(iVar1); uVar10 = uVar10 - iVar1; uVar9 = uVar10 - 1; uVar7 = uVar7 + iVar8; } while (1 < uVar9); iVar1 = uVar7 + 1; if (uVar7 < 2) { iVar8 = 1; } else { iVar8 = 0; do { iVar2 = func0(uVar7); iVar3 = func0(iVar2); iVar1 = iVar1 - iVar2; uVar7 = iVar1 - 1; iVar8 = iVar8 + iVar3; } while (1 < uVar7); iVar8 = iVar8 + 1; } iVar1 = 0; uVar9 = uVar6 - 1; do { iVar2 = func0(uVar9); iVar3 = func0(iVar2); uVar6 = uVar6 - iVar2; uVar9 = uVar6 - 1; iVar1 = iVar1 + iVar3; } while (1 < uVar9); local_5c = local_5c + iVar8; local_50 = local_50 - (iVar1 + 1); uVar6 = local_50 - 1; } while (1 < uVar6); local_48 = local_48 + local_4c; local_58 = local_58 - (local_5c + 1); local_50 = local_58 - 1; } while (1 < local_50); local_48 = local_48 + 1; } local_4c = 0; local_50 = local_40 - 1; do { local_5c = local_54 - 2; if (local_5c < 2) { local_4c = local_4c + 1; break; } local_58 = 0; uVar6 = local_50; do { uVar9 = uVar6 - 2; if (uVar9 < 2) { local_58 = local_58 + 1; break; } uVar7 = 0; uVar10 = local_5c; do { iVar1 = func0(uVar9); iVar8 = func0(iVar1); uVar10 = uVar10 - iVar1; uVar9 = uVar10 - 1; uVar7 = uVar7 + iVar8; } while (1 < uVar9); iVar1 = uVar7 + 1; if (uVar7 < 2) { iVar8 = 1; } else { iVar8 = 0; do { iVar2 = func0(uVar7); iVar3 = func0(iVar2); iVar1 = iVar1 - iVar2; uVar7 = iVar1 - 1; iVar8 = iVar8 + iVar3; } while (1 < uVar7); iVar8 = iVar8 + 1; } iVar1 = 0; uVar9 = local_5c - 1; do { iVar2 = func0(uVar9); iVar3 = func0(iVar2); local_5c = local_5c - iVar2; uVar9 = local_5c - 1; iVar1 = iVar1 + iVar3; } while (1 < uVar9); local_58 = local_58 + iVar8; uVar6 = uVar6 - (iVar1 + 1); local_5c = uVar6 - 1; } while (1 < local_5c); local_5c = local_58; iVar1 = local_58 + 1; if (local_58 < 2) { local_58 = 1; } else { local_58 = 0; do { uVar6 = iVar1 - 2; if (uVar6 < 2) { local_58 = local_58 + 1; break; } uVar9 = 0; uVar7 = local_5c; do { iVar8 = func0(uVar6); iVar2 = func0(iVar8); uVar7 = uVar7 - iVar8; uVar6 = uVar7 - 1; uVar9 = uVar9 + iVar2; } while (1 < uVar6); iVar8 = uVar9 + 1; if (uVar9 < 2) { iVar2 = 1; } else { iVar2 = 0; do { iVar3 = func0(uVar9); iVar4 = func0(iVar3); iVar8 = iVar8 - iVar3; uVar9 = iVar8 - 1; iVar2 = iVar2 + iVar4; } while (1 < uVar9); iVar2 = iVar2 + 1; } iVar8 = 0; uVar6 = local_5c - 1; do { iVar3 = func0(uVar6); iVar4 = func0(iVar3); local_5c = local_5c - iVar3; uVar6 = local_5c - 1; iVar8 = iVar8 + iVar4; } while (1 < uVar6); local_58 = local_58 + iVar2; iVar1 = iVar1 - (iVar8 + 1); local_5c = iVar1 - 1; } while (1 < local_5c); local_58 = local_58 + 1; } local_5c = 0; uVar6 = local_50 - 1; do { uVar9 = local_50 - 2; if (uVar9 < 2) { local_5c = local_5c + 1; break; } uVar7 = 0; uVar10 = uVar6; do { iVar1 = func0(uVar9); iVar8 = func0(iVar1); uVar10 = uVar10 - iVar1; uVar9 = uVar10 - 1; uVar7 = uVar7 + iVar8; } while (1 < uVar9); iVar1 = uVar7 + 1; if (uVar7 < 2) { iVar8 = 1; } else { iVar8 = 0; do { iVar2 = func0(uVar7); iVar3 = func0(iVar2); iVar1 = iVar1 - iVar2; uVar7 = iVar1 - 1; iVar8 = iVar8 + iVar3; } while (1 < uVar7); iVar8 = iVar8 + 1; } iVar1 = 0; uVar9 = uVar6 - 1; do { iVar2 = func0(uVar9); iVar3 = func0(iVar2); uVar6 = uVar6 - iVar2; uVar9 = uVar6 - 1; iVar1 = iVar1 + iVar3; } while (1 < uVar9); local_5c = local_5c + iVar8; local_50 = local_50 - (iVar1 + 1); uVar6 = local_50 - 1; } while (1 < uVar6); local_4c = local_4c + local_58; local_54 = local_54 - (local_5c + 1); local_50 = local_54 - 1; } while (1 < local_50); local_3c = local_3c + local_48; local_44 = local_44 - (local_4c + 1); local_40 = local_44 - 1; } while (1 < local_40); return local_3c + 1; }
4,231
func0
#include <assert.h>
int func0(int n) { if (n == 1 || n == 2) { return 1; } else{ return func0(func0(n - 1)) + func0(n - func0(n - 1)); } }
int main() { assert(func0(10) == 6); assert(func0(2) == 1); assert(func0(3) == 2); return 0; }
O3
c
func0: endbr64 push %r12 mov $0x1,%eax push %rbp mov %edi,%ebp sub $0x1,%edi push %rbx cmp $0x1,%edi jbe 122a <func0+0x3a> xor %r12d,%r12d callq 11f0 <func0> mov %eax,%ebx mov %eax,%edi callq 11f0 <func0> sub %ebx,%ebp lea -0x1(%rbp),%edi add %eax,%r12d cmp $0x1,%edi ja 120a <func0+0x1a> lea 0x1(%r12),%eax pop %rbx pop %rbp pop %r12 retq
func0: endbr64 push r15 mov eax, 1 push r14 push r13 push r12 lea r12d, [rdi-1] push rbp push rbx sub rsp, 38h cmp r12d, 1 jbe loc_19DC xor ebp, ebp mov [rsp+68h+var_44], edi mov r14d, r12d mov [rsp+68h+var_3C], ebp loc_1222: mov eax, [rsp+68h+var_44] mov [rsp+68h+var_50], r14d cmp eax, 3 jz loc_1B63 mov [rsp+68h+var_58], r14d xor ebx, ebx sub eax, 2 mov [rsp+68h+var_40], r14d mov [rsp+68h+var_48], ebx mov ebx, eax loc_1249: mov eax, [rsp+68h+var_58] cmp eax, 3 jz loc_1AD0 xor ecx, ecx lea r15d, [rax-2] mov [rsp+68h+var_54], ebx mov r14d, ebx mov [rsp+68h+var_4C], ebx mov r12d, ecx mov ebx, r15d loc_126D: mov edi, ebx mov ebp, ebx xor r13d, r13d call func0 lea edi, [rax-1] cmp edi, 1 jbe loc_1B7C mov [rsp+68h+var_5C], ebx mov ebx, eax nop dword ptr [rax+rax+00h] loc_1290: call func0 mov r15d, eax mov edi, eax call func0 sub ebx, r15d lea edi, [rbx-1] add r13d, eax cmp edi, 1 ja short loc_1290 mov ebx, [rsp+68h+var_5C] add r13d, 1 loc_12B5: cmp r14d, 3 jz loc_1AA0 xor r15d, r15d lea edi, [rbx-1] loc_12C5: call func0 mov ebx, eax mov edi, eax call func0 sub ebp, ebx lea edi, [rbp-1] add r15d, eax cmp edi, 1 ja short loc_12C5 add r15d, 1 add r12d, r13d sub r14d, r15d lea ebx, [r14-1] cmp ebx, 1 ja loc_126D mov ecx, r12d mov ebp, [rsp+68h+var_54] mov ebx, [rsp+68h+var_4C] lea r14d, [rcx+1] cmp ecx, 1 jbe loc_1ABB nop loc_1310: mov [rsp+68h+var_54], ebp xor r15d, r15d mov ebp, ecx mov [rsp+68h+var_4C], ebx mov ebx, r14d loc_1320: mov edi, ebp mov r13d, ebp xor r12d, r12d call func0 lea edi, [rax-1] cmp edi, 1 jbe loc_1B87 mov [rsp+68h+var_5C], ebx mov ebx, eax nop loc_1340: call func0 mov r14d, eax mov edi, eax call func0 sub ebx, r14d lea edi, [rbx-1] add r12d, eax cmp edi, 1 ja short loc_1340 mov ebx, [rsp+68h+var_5C] add r12d, 1 loc_1365: cmp ebx, 3 jz loc_1A90 xor r14d, r14d lea edi, [rbp-1] loc_1374: call func0 mov ebp, eax mov edi, eax call func0 sub r13d, ebp lea edi, [r13-1] add r14d, eax cmp edi, 1 ja short loc_1374 lea edx, [r14+1] add r15d, r12d sub ebx, edx lea ebp, [rbx-1] cmp ebp, 1 ja loc_1320 mov ebp, [rsp+68h+var_54] mov ebx, [rsp+68h+var_4C] xchg ax, ax loc_13B0: lea r13d, [r15+1] loc_13B4: mov [rsp+68h+var_5C], r13d xor r12d, r12d lea edi, [rbx-1] loc_13BF: call func0 xor r14d, r14d lea edi, [rax-1] mov r15d, eax mov r13d, eax cmp edi, 1 jbe loc_1B92 nop dword ptr [rax+00000000h] loc_13E0: call func0 mov ebx, eax mov edi, eax call func0 sub r13d, ebx lea edi, [r13-1] add r14d, eax cmp edi, 1 ja short loc_13E0 add r14d, 1 loc_1401: sub ebp, r15d add r12d, r14d lea edi, [rbp-1] cmp edi, 1 ja short loc_13BF add r12d, 1 sub [rsp+68h+var_58], r12d mov eax, [rsp+68h+var_58] mov r13d, [rsp+68h+var_5C] add [rsp+68h+var_48], r13d lea ebx, [rax-1] cmp ebx, 1 ja loc_1249 mov ebx, [rsp+68h+var_48] mov r14d, [rsp+68h+var_40] lea eax, [rbx+1] mov [rsp+68h+var_58], eax cmp ebx, 1 jbe loc_1AEC nop dword ptr [rax+rax+00h] loc_1450: xor r15d, r15d mov [rsp+68h+var_40], r14d mov r13d, ebx mov [rsp+68h+var_48], r15d loc_1460: mov eax, [rsp+68h+var_58] cmp eax, 3 jz loc_1B10 mov [rsp+68h+var_54], r13d lea ebp, [rax-2] xor r14d, r14d mov ebx, r13d mov [rsp+68h+var_4C], r13d mov r12d, ebp loc_1483: mov edi, r12d mov r13d, r12d xor ebp, ebp call func0 lea edi, [rax-1] cmp edi, 1 jbe loc_1B9D mov [rsp+68h+var_5C], ebx mov ebx, eax nop word ptr [rax+rax+00h] loc_14A8: call func0 mov r15d, eax mov edi, eax call func0 sub ebx, r15d lea edi, [rbx-1] add ebp, eax cmp edi, 1 ja short loc_14A8 mov ebx, [rsp+68h+var_5C] lea r15d, [rbp+1] loc_14CC: cmp ebx, 3 jz loc_1A68 xor ebp, ebp lea edi, [r12-1] loc_14DC: call func0 mov r12d, eax mov edi, eax call func0 sub r13d, r12d lea edi, [r13-1] add ebp, eax cmp edi, 1 ja short loc_14DC add ebp, 1 add r14d, r15d sub ebx, ebp lea r12d, [rbx-1] cmp r12d, 1 ja loc_1483 mov r12d, [rsp+68h+var_54] mov r13d, [rsp+68h+var_4C] lea r15d, [r14+1] cmp r14d, 1 jbe loc_1A83 nop word ptr [rax+rax+00000000h] loc_1530: xor edx, edx mov [rsp+68h+var_54], r12d mov r12d, r15d mov [rsp+68h+var_4C], r13d mov r15d, edx mov r13d, r14d loc_1545: mov edi, r13d mov ebp, r13d xor r14d, r14d call func0 lea edi, [rax-1] cmp edi, 1 jbe loc_1BA8 mov [rsp+68h+var_5C], r13d mov ebp, eax nop word ptr [rax+rax+00000000h] loc_1570: call func0 mov ebx, eax mov edi, eax call func0 sub ebp, ebx lea edi, [rbp-1] add r14d, eax cmp edi, 1 ja short loc_1570 mov ebp, [rsp+68h+var_5C] lea ebx, [r14+1] loc_1593: cmp r12d, 3 jz loc_1A50 xor r14d, r14d lea edi, [r13-1] loc_15A4: call func0 mov r13d, eax mov edi, eax call func0 sub ebp, r13d lea edi, [rbp-1] add r14d, eax cmp edi, 1 ja short loc_15A4 lea ecx, [r14+1] add r15d, ebx sub r12d, ecx lea r13d, [r12-1] cmp r13d, 1 ja loc_1545 mov r12d, [rsp+68h+var_54] mov r13d, [rsp+68h+var_4C] mov edx, r15d nop word ptr [rax+rax+00000000h] loc_15F0: lea ebx, [rdx+1] loc_15F3: xor edx, edx mov [rsp+68h+var_54], ebx sub r13d, 1 mov [rsp+68h+var_5C], edx loc_1601: mov ebp, r13d cmp r12d, 3 jz loc_1A40 mov ebx, r13d xor r15d, r15d lea edi, [r12-2] loc_1619: call func0 mov r14d, eax mov edi, eax call func0 sub ebx, r14d lea edi, [rbx-1] add r15d, eax cmp edi, 1 ja short loc_1619 lea r14d, [r15+1] cmp r15d, 1 jbe loc_1B28 xor ebx, ebx mov edi, r15d loc_1649: call func0 mov r15d, eax mov edi, eax call func0 sub r14d, r15d lea edi, [r14-1] add ebx, eax cmp edi, 1 ja short loc_1649 lea r15d, [rbx+1] loc_166A: xor ebx, ebx lea edi, [r13-1] loc_1670: call func0 mov r13d, eax mov edi, eax call func0 sub ebp, r13d lea edi, [rbp-1] add ebx, eax cmp edi, 1 ja short loc_1670 lea edx, [rbx+1] add [rsp+68h+var_5C], r15d sub r12d, edx lea r13d, [r12-1] cmp r13d, 1 ja loc_1601 mov edx, [rsp+68h+var_5C] mov ebx, [rsp+68h+var_54] xchg ax, ax loc_16B0: add edx, 1 sub [rsp+68h+var_58], edx mov eax, [rsp+68h+var_58] add [rsp+68h+var_48], ebx lea r13d, [rax-1] cmp r13d, 1 ja loc_1460 mov r15d, [rsp+68h+var_48] mov r14d, [rsp+68h+var_40] nop word ptr [rax+rax+00000000h] loc_16E0: lea ebx, [r15+1] loc_16E4: xor edx, edx lea eax, [r14-1] mov [rsp+68h+var_40], ebx mov [rsp+68h+var_4C], eax mov [rsp+68h+var_48], edx loc_16F6: mov eax, [rsp+68h+var_4C] mov ecx, [rsp+68h+var_50] mov r13d, eax cmp ecx, 3 jz loc_1B00 mov [rsp+68h+var_5C], eax lea eax, [rcx-2] mov [rsp+68h+var_54], 0 mov [rsp+68h+var_58], eax loc_171D: mov r12d, [rsp+68h+var_58] mov eax, [rsp+68h+var_5C] mov ebx, r12d cmp eax, 3 jz loc_1A10 xor r14d, r14d lea edi, [rax-2] loc_1738: call func0 mov ebp, eax mov edi, eax call func0 sub r12d, ebp lea edi, [r12-1] add r14d, eax cmp edi, 1 ja short loc_1738 lea r15d, [r14+1] cmp r14d, 1 jbe loc_1B58 xor r12d, r12d mov edi, r14d loc_176A: call func0 mov ebp, eax mov edi, eax call func0 sub r15d, ebp lea edi, [r15-1] add r12d, eax cmp edi, 1 ja short loc_176A add r12d, 1 loc_178B: mov eax, [rsp+68h+var_58] xor ebp, ebp lea edi, [rax-1] loc_1794: call func0 mov r14d, eax mov edi, eax call func0 sub ebx, r14d lea edi, [rbx-1] add ebp, eax cmp edi, 1 ja short loc_1794 lea edx, [rbp+1] sub [rsp+68h+var_5C], edx mov eax, [rsp+68h+var_5C] add [rsp+68h+var_54], r12d sub eax, 1 mov [rsp+68h+var_58], eax cmp eax, 1 ja loc_171D mov eax, [rsp+68h+var_54] lea ecx, [rax+1] mov [rsp+68h+var_5C], ecx cmp eax, 1 jbe loc_1A29 nop dword ptr [rax+00h] loc_17E8: mov [rsp+68h+var_54], 0 mov [rsp+68h+var_58], eax loc_17F4: mov r12d, [rsp+68h+var_58] mov eax, [rsp+68h+var_5C] mov ebx, r12d cmp eax, 3 jz loc_1A00 xor r14d, r14d lea edi, [rax-2] loc_180F: call func0 mov ebp, eax mov edi, eax call func0 sub r12d, ebp lea edi, [r12-1] add r14d, eax cmp edi, 1 ja short loc_180F lea r12d, [r14+1] cmp r14d, 1 jbe loc_1B48 xor r15d, r15d mov edi, r14d loc_1841: call func0 mov ebp, eax mov edi, eax call func0 sub r12d, ebp lea edi, [r12-1] add r15d, eax cmp edi, 1 ja short loc_1841 lea r14d, [r15+1] loc_1863: mov eax, [rsp+68h+var_58] xor ebp, ebp lea edi, [rax-1] loc_186C: call func0 mov r12d, eax mov edi, eax call func0 sub ebx, r12d lea edi, [rbx-1] add ebp, eax cmp edi, 1 ja short loc_186C lea edx, [rbp+1] sub [rsp+68h+var_5C], edx mov eax, [rsp+68h+var_5C] add [rsp+68h+var_54], r14d sub eax, 1 mov [rsp+68h+var_58], eax cmp eax, 1 ja loc_17F4 nop dword ptr [rax+rax+00000000h] loc_18B0: mov eax, [rsp+68h+var_54] add eax, 1 mov [rsp+68h+var_54], eax loc_18BB: mov eax, [rsp+68h+var_4C] mov [rsp+68h+var_58], 0 sub eax, 1 mov [rsp+68h+var_5C], eax loc_18CE: mov r14d, [rsp+68h+var_5C] mov ebx, r14d cmp r13d, 3 jz loc_19F0 xor r12d, r12d lea edi, [r13-2] loc_18E7: call func0 mov ebp, eax mov edi, eax call func0 sub r14d, ebp lea edi, [r14-1] add r12d, eax cmp edi, 1 ja short loc_18E7 lea r14d, [r12+1] cmp r12d, 1 jbe loc_1B38 xor r15d, r15d mov edi, r12d loc_1919: call func0 mov ebp, eax mov edi, eax call func0 sub r14d, ebp lea edi, [r14-1] add r15d, eax cmp edi, 1 ja short loc_1919 lea ebp, [r15+1] loc_193A: mov eax, [rsp+68h+var_5C] xor r15d, r15d lea edi, [rax-1] loc_1944: call func0 mov r14d, eax mov edi, eax call func0 sub ebx, r14d lea edi, [rbx-1] add r15d, eax cmp edi, 1 ja short loc_1944 lea edx, [r15+1] add [rsp+68h+var_58], ebp sub r13d, edx lea eax, [r13-1] mov [rsp+68h+var_5C], eax cmp eax, 1 ja loc_18CE nop dword ptr [rax] loc_1980: mov r12d, [rsp+68h+var_58] mov ecx, [rsp+68h+var_54] add [rsp+68h+var_48], ecx add r12d, 1 sub [rsp+68h+var_50], r12d mov eax, [rsp+68h+var_50] sub eax, 1 mov [rsp+68h+var_4C], eax cmp eax, 1 ja loc_16F6 mov edx, [rsp+68h+var_48] mov ebx, [rsp+68h+var_40] nop word ptr [rax+rax+00h] loc_19B8: add edx, 1 sub [rsp+68h+var_44], edx mov eax, [rsp+68h+var_44] add [rsp+68h+var_3C], ebx lea r14d, [rax-1] cmp r14d, 1 ja loc_1222 mov ebp, [rsp+68h+var_3C] lea eax, [rbp+1] loc_19DC: add rsp, 38h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_19F0: add [rsp+68h+var_58], 1 jmp short loc_1980 loc_1A00: add [rsp+68h+var_54], 1 jmp loc_18B0 loc_1A10: add [rsp+68h+var_54], 1 mov eax, [rsp+68h+var_54] lea ecx, [rax+1] mov [rsp+68h+var_5C], ecx cmp eax, 1 ja loc_17E8 loc_1A29: mov [rsp+68h+var_54], 1 jmp loc_18BB loc_1A40: mov edx, [rsp+68h+var_5C] mov ebx, [rsp+68h+var_54] add edx, 1 jmp loc_16B0 loc_1A50: mov edx, r15d mov r12d, [rsp+68h+var_54] mov r13d, [rsp+68h+var_4C] add edx, ebx jmp loc_15F0 loc_1A68: add r14d, r15d mov r12d, [rsp+68h+var_54] mov r13d, [rsp+68h+var_4C] lea r15d, [r14+1] cmp r14d, 1 ja loc_1530 loc_1A83: mov ebx, 1 jmp loc_15F3 loc_1A90: mov ebp, [rsp+68h+var_54] mov ebx, [rsp+68h+var_4C] add r15d, r12d jmp loc_13B0 loc_1AA0: mov ecx, r12d mov ebp, [rsp+68h+var_54] mov ebx, [rsp+68h+var_4C] add ecx, r13d lea r14d, [rcx+1] cmp ecx, 1 ja loc_1310 loc_1ABB: mov r13d, 1 jmp loc_13B4 loc_1AD0: mov ebx, [rsp+68h+var_48] mov r14d, [rsp+68h+var_40] add ebx, 1 lea eax, [rbx+1] mov [rsp+68h+var_58], eax cmp ebx, 1 ja loc_1450 loc_1AEC: mov ebx, 1 jmp loc_16E4 loc_1B00: mov edx, [rsp+68h+var_48] mov ebx, [rsp+68h+var_40] add edx, 1 jmp loc_19B8 loc_1B10: mov r15d, [rsp+68h+var_48] mov r14d, [rsp+68h+var_40] add r15d, 1 jmp loc_16E0 loc_1B28: mov r15d, 1 jmp loc_166A loc_1B38: mov ebp, 1 jmp loc_193A loc_1B48: mov r14d, 1 jmp loc_1863 loc_1B58: mov r12d, 1 jmp loc_178B loc_1B63: mov ebp, [rsp+68h+var_3C] add rsp, 38h pop rbx add ebp, 1 lea eax, [rbp+1] pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1B7C: mov r13d, 1 jmp loc_12B5 loc_1B87: mov r12d, 1 jmp loc_1365 loc_1B92: mov r14d, 1 jmp loc_1401 loc_1B9D: mov r15d, 1 jmp loc_14CC loc_1BA8: mov ebx, 1 jmp loc_1593
long long func0(int a1) { long long result; // rax int v2; // r14d int v3; // ebx int v4; // r14d unsigned int v5; // r12d unsigned int v6; // ebx unsigned int v7; // ebp int v8; // r13d int v9; // eax long long v10; // rdi int v11; // ebx long long v12; // r15 int v13; // r13d int v14; // r15d long long v15; // rdi long long v16; // rbx unsigned int v17; // ecx int v18; // ebp int v19; // ebx int v20; // r14d int v21; // r15d unsigned int v22; // ebp int v23; // ebx unsigned int v24; // r13d int v25; // r12d int v26; // eax long long v27; // rdi int v28; // ebx long long v29; // r14 int v30; // r12d int v31; // r14d long long v32; // rdi long long v33; // rbp int v34; // r13d int v35; // r12d long long v36; // rdi int v37; // eax int v38; // r14d long long v39; // rdi int v40; // r15d int v41; // r13d long long v42; // rbx int v43; // r14d unsigned int v44; // ebx int v45; // r14d unsigned int v46; // r13d unsigned int v47; // r14d unsigned int v48; // ebx unsigned int v49; // r12d unsigned int v50; // r13d int v51; // ebp int v52; // eax long long v53; // rdi int v54; // ebx long long v55; // r15 int v56; // r15d int v57; // ebp long long v58; // rdi long long v59; // r12 unsigned int v60; // r12d unsigned int v61; // r13d unsigned int v62; // r15d unsigned int v63; // r12d int v64; // r15d unsigned int v65; // r13d unsigned int v66; // ebp int v67; // r14d int v68; // eax long long v69; // rdi int v70; // ebp long long v71; // rbx int v72; // ebx int v73; // r14d long long v74; // rdi long long v75; // r13 int v76; // edx int v77; // ebx unsigned int v78; // r13d unsigned int v79; // ebp unsigned int v80; // ebx unsigned int v81; // r15d long long v82; // rdi long long v83; // r14 unsigned int v84; // r14d int v85; // ebx long long v86; // rdi long long v87; // r15 int v88; // r15d int v89; // ebx long long v90; // rdi long long v91; // r13 int v92; // edx int v93; // ebx int v94; // r15d int v95; // ebx int v96; // r13d int v97; // r12d int v98; // ebx unsigned int v99; // r14d long long v100; // rdi long long v101; // rbp unsigned int v102; // r15d int v103; // r12d long long v104; // rdi long long v105; // rbp int v106; // r12d int v107; // ebp long long v108; // rdi long long v109; // r14 unsigned int v110; // eax unsigned int v111; // r12d unsigned int v112; // ebx unsigned int v113; // r14d long long v114; // rdi long long v115; // rbp unsigned int v116; // r12d int v117; // r15d long long v118; // rdi long long v119; // rbp int v120; // r14d int v121; // ebp long long v122; // rdi long long v123; // r12 int v124; // r14d int v125; // ebx unsigned int v126; // r12d long long v127; // rdi long long v128; // rbp unsigned int v129; // r14d int v130; // r15d long long v131; // rdi long long v132; // rbp int v133; // ebp int v134; // r15d long long v135; // rdi long long v136; // r14 int v137; // edx int v138; // ebx unsigned int v139; // [rsp+Ch] [rbp-5Ch] int v140; // [rsp+Ch] [rbp-5Ch] int v141; // [rsp+Ch] [rbp-5Ch] unsigned int v142; // [rsp+Ch] [rbp-5Ch] int v143; // [rsp+Ch] [rbp-5Ch] int v144; // [rsp+Ch] [rbp-5Ch] unsigned int v145; // [rsp+Ch] [rbp-5Ch] int v146; // [rsp+Ch] [rbp-5Ch] int v147; // [rsp+10h] [rbp-58h] unsigned int v148; // [rsp+10h] [rbp-58h] int v149; // [rsp+10h] [rbp-58h] unsigned int v150; // [rsp+10h] [rbp-58h] int v151; // [rsp+10h] [rbp-58h] int v152; // [rsp+14h] [rbp-54h] int v153; // [rsp+14h] [rbp-54h] unsigned int v154; // [rsp+14h] [rbp-54h] unsigned int v155; // [rsp+14h] [rbp-54h] int v156; // [rsp+14h] [rbp-54h] unsigned int v157; // [rsp+14h] [rbp-54h] int v158; // [rsp+14h] [rbp-54h] int v159; // [rsp+14h] [rbp-54h] int v160; // [rsp+18h] [rbp-50h] int v161; // [rsp+1Ch] [rbp-4Ch] int v162; // [rsp+1Ch] [rbp-4Ch] unsigned int v163; // [rsp+1Ch] [rbp-4Ch] unsigned int v164; // [rsp+1Ch] [rbp-4Ch] int v165; // [rsp+1Ch] [rbp-4Ch] unsigned int v166; // [rsp+20h] [rbp-48h] int v167; // [rsp+20h] [rbp-48h] int v168; // [rsp+20h] [rbp-48h] int v169; // [rsp+24h] [rbp-44h] int v170; // [rsp+28h] [rbp-40h] int v171; // [rsp+28h] [rbp-40h] int v172; // [rsp+28h] [rbp-40h] int v173; // [rsp+2Ch] [rbp-3Ch] result = 1LL; if ( (unsigned int)(a1 - 1) > 1 ) { v169 = a1; v2 = a1 - 1; v173 = 0; while ( 1 ) { v160 = v2; if ( v169 == 3 ) return (unsigned int)(v173 + 2); v147 = v2; v170 = v2; v166 = 0; v3 = v169 - 2; while ( v147 != 3 ) { v152 = v3; v4 = v3; v161 = v3; v5 = 0; v6 = v147 - 2; while ( 1 ) { v7 = v6; v8 = 0; v9 = func0(v6); v10 = (unsigned int)(v9 - 1); if ( (unsigned int)v10 <= 1 ) { v13 = 1; } else { v139 = v6; v11 = v9; do { v12 = (unsigned int)func0(v10); v11 -= v12; v10 = (unsigned int)(v11 - 1); v8 += func0(v12); } while ( (unsigned int)v10 > 1 ); v6 = v139; v13 = v8 + 1; } if ( v4 == 3 ) break; v14 = 0; v15 = v6 - 1; do { v16 = (unsigned int)func0(v15); v7 -= v16; v15 = v7 - 1; v14 += func0(v16); } while ( (unsigned int)v15 > 1 ); v5 += v13; v4 -= v14 + 1; v6 = v4 - 1; if ( (unsigned int)(v4 - 1) <= 1 ) { v17 = v5; v18 = v152; v19 = v161; v20 = v5 + 1; if ( v5 > 1 ) goto LABEL_16; LABEL_124: v34 = 1; goto LABEL_27; } } v18 = v152; v19 = v161; v17 = v13 + v5; v20 = v13 + v5 + 1; if ( v13 + v5 <= 1 ) goto LABEL_124; LABEL_16: v153 = v18; v21 = 0; v22 = v17; v162 = v19; v23 = v20; while ( 1 ) { v24 = v22; v25 = 0; v26 = func0(v22); v27 = (unsigned int)(v26 - 1); if ( (unsigned int)v27 <= 1 ) { v30 = 1; } else { v140 = v23; v28 = v26; do { v29 = (unsigned int)func0(v27); v28 -= v29; v27 = (unsigned int)(v28 - 1); v25 += func0(v29); } while ( (unsigned int)v27 > 1 ); v23 = v140; v30 = v25 + 1; } if ( v23 == 3 ) break; v31 = 0; v32 = v22 - 1; do { v33 = (unsigned int)func0(v32); v24 -= v33; v32 = v24 - 1; v31 += func0(v33); } while ( (unsigned int)v32 > 1 ); v21 += v30; v23 -= v31 + 1; v22 = v23 - 1; if ( (unsigned int)(v23 - 1) <= 1 ) { v18 = v153; v19 = v162; goto LABEL_26; } } v18 = v153; v19 = v162; v21 += v30; LABEL_26: v34 = v21 + 1; LABEL_27: v141 = v34; v35 = 0; v36 = (unsigned int)(v19 - 1); do { v37 = func0(v36); v38 = 0; v39 = (unsigned int)(v37 - 1); v40 = v37; v41 = v37; if ( (unsigned int)v39 <= 1 ) { v43 = 1; } else { do { v42 = (unsigned int)func0(v39); v41 -= v42; v39 = (unsigned int)(v41 - 1); v38 += func0(v42); } while ( (unsigned int)v39 > 1 ); v43 = v38 + 1; } v18 -= v40; v35 += v43; v36 = (unsigned int)(v18 - 1); } while ( (unsigned int)v36 > 1 ); v147 -= v35 + 1; v166 += v141; v3 = v147 - 1; if ( (unsigned int)(v147 - 1) <= 1 ) { v44 = v166; v45 = v170; v148 = v166 + 1; if ( v166 > 1 ) goto LABEL_34; LABEL_126: v95 = 1; goto LABEL_72; } } v45 = v170; v44 = v166 + 1; v148 = v166 + 2; if ( v166 + 1 <= 1 ) goto LABEL_126; LABEL_34: v171 = v45; v46 = v44; v167 = 0; while ( v148 != 3 ) { v154 = v46; v47 = 0; v48 = v46; v163 = v46; v49 = v148 - 2; while ( 1 ) { v50 = v49; v51 = 0; v52 = func0(v49); v53 = (unsigned int)(v52 - 1); if ( (unsigned int)v53 <= 1 ) { v56 = 1; } else { v142 = v48; v54 = v52; do { v55 = (unsigned int)func0(v53); v54 -= v55; v53 = (unsigned int)(v54 - 1); v51 += func0(v55); } while ( (unsigned int)v53 > 1 ); v48 = v142; v56 = v51 + 1; } if ( v48 == 3 ) break; v57 = 0; v58 = v49 - 1; do { v59 = (unsigned int)func0(v58); v50 -= v59; v58 = v50 - 1; v57 += func0(v59); } while ( (unsigned int)v58 > 1 ); v47 += v56; v48 -= v57 + 1; v49 = v48 - 1; if ( v48 - 1 <= 1 ) { v60 = v154; v61 = v163; v62 = v47 + 1; if ( v47 > 1 ) goto LABEL_46; LABEL_121: v77 = 1; goto LABEL_57; } } v47 += v56; v60 = v154; v61 = v163; v62 = v47 + 1; if ( v47 <= 1 ) goto LABEL_121; LABEL_46: v155 = v60; v63 = v62; v164 = v61; v64 = 0; v65 = v47; while ( 1 ) { v66 = v65; v67 = 0; v68 = func0(v65); v69 = (unsigned int)(v68 - 1); if ( (unsigned int)v69 <= 1 ) { v72 = 1; } else { v70 = v68; do { v71 = (unsigned int)func0(v69); v70 -= v71; v69 = (unsigned int)(v70 - 1); v67 += func0(v71); } while ( (unsigned int)v69 > 1 ); v66 = v65; v72 = v67 + 1; } if ( v63 == 3 ) break; v73 = 0; v74 = v65 - 1; do { v75 = (unsigned int)func0(v74); v66 -= v75; v74 = v66 - 1; v73 += func0(v75); } while ( (unsigned int)v74 > 1 ); v64 += v72; v63 -= v73 + 1; v65 = v63 - 1; if ( v63 - 1 <= 1 ) { v60 = v155; v61 = v164; v76 = v64; goto LABEL_56; } } v60 = v155; v61 = v164; v76 = v72 + v64; LABEL_56: v77 = v76 + 1; LABEL_57: v156 = v77; v78 = v61 - 1; v143 = 0; while ( 1 ) { v79 = v78; if ( v60 == 3 ) break; v80 = v78; v81 = 0; v82 = v60 - 2; do { v83 = (unsigned int)func0(v82); v80 -= v83; v82 = v80 - 1; v81 += func0(v83); } while ( (unsigned int)v82 > 1 ); v84 = v81 + 1; if ( v81 <= 1 ) { v88 = 1; } else { v85 = 0; v86 = v81; do { v87 = (unsigned int)func0(v86); v84 -= v87; v86 = v84 - 1; v85 += func0(v87); } while ( (unsigned int)v86 > 1 ); v88 = v85 + 1; } v89 = 0; v90 = v78 - 1; do { v91 = (unsigned int)func0(v90); v79 -= v91; v90 = v79 - 1; v89 += func0(v91); } while ( (unsigned int)v90 > 1 ); v143 += v88; v60 -= v89 + 1; v78 = v60 - 1; if ( v60 - 1 <= 1 ) { v92 = v143; v93 = v156; goto LABEL_69; } } v93 = v156; v92 = v143 + 1; LABEL_69: v148 -= v92 + 1; v167 += v93; v46 = v148 - 1; if ( v148 - 1 <= 1 ) { v94 = v167; v45 = v171; goto LABEL_71; } } v45 = v171; v94 = v167 + 1; LABEL_71: v95 = v94 + 1; LABEL_72: v172 = v95; v165 = v45 - 1; v168 = 0; while ( 1 ) { v96 = v165; if ( v160 == 3 ) break; v144 = v165; v157 = 0; v149 = v160 - 2; while ( 1 ) { v97 = v149; v98 = v149; if ( v144 == 3 ) break; v99 = 0; v100 = (unsigned int)(v144 - 2); do { v101 = (unsigned int)func0(v100); v97 -= v101; v100 = (unsigned int)(v97 - 1); v99 += func0(v101); } while ( (unsigned int)v100 > 1 ); v102 = v99 + 1; if ( v99 <= 1 ) { v106 = 1; } else { v103 = 0; v104 = v99; do { v105 = (unsigned int)func0(v104); v102 -= v105; v104 = v102 - 1; v103 += func0(v105); } while ( (unsigned int)v104 > 1 ); v106 = v103 + 1; } v107 = 0; v108 = (unsigned int)(v149 - 1); do { v109 = (unsigned int)func0(v108); v98 -= v109; v108 = (unsigned int)(v98 - 1); v107 += func0(v109); } while ( (unsigned int)v108 > 1 ); v144 -= v107 + 1; v157 += v106; v149 = v144 - 1; if ( (unsigned int)(v144 - 1) <= 1 ) { v110 = v157; v145 = v157 + 1; if ( v157 > 1 ) goto LABEL_86; LABEL_117: v159 = 1; goto LABEL_98; } } v110 = v157 + 1; v145 = v157 + 2; if ( v157 + 1 <= 1 ) goto LABEL_117; LABEL_86: v158 = 0; v150 = v110; while ( 1 ) { v111 = v150; v112 = v150; if ( v145 == 3 ) break; v113 = 0; v114 = v145 - 2; do { v115 = (unsigned int)func0(v114); v111 -= v115; v114 = v111 - 1; v113 += func0(v115); } while ( (unsigned int)v114 > 1 ); v116 = v113 + 1; if ( v113 <= 1 ) { v120 = 1; } else { v117 = 0; v118 = v113; do { v119 = (unsigned int)func0(v118); v116 -= v119; v118 = v116 - 1; v117 += func0(v119); } while ( (unsigned int)v118 > 1 ); v120 = v117 + 1; } v121 = 0; v122 = v150 - 1; do { v123 = (unsigned int)func0(v122); v112 -= v123; v122 = v112 - 1; v121 += func0(v123); } while ( (unsigned int)v122 > 1 ); v145 -= v121 + 1; v158 += v120; v150 = v145 - 1; if ( v145 - 1 <= 1 ) goto LABEL_97; } ++v158; LABEL_97: v159 = v158 + 1; LABEL_98: v151 = 0; v146 = v165 - 1; while ( 1 ) { v124 = v146; v125 = v146; if ( v96 == 3 ) break; v126 = 0; v127 = (unsigned int)(v96 - 2); do { v128 = (unsigned int)func0(v127); v124 -= v128; v127 = (unsigned int)(v124 - 1); v126 += func0(v128); } while ( (unsigned int)v127 > 1 ); v129 = v126 + 1; if ( v126 <= 1 ) { v133 = 1; } else { v130 = 0; v131 = v126; do { v132 = (unsigned int)func0(v131); v129 -= v132; v131 = v129 - 1; v130 += func0(v132); } while ( (unsigned int)v131 > 1 ); v133 = v130 + 1; } v134 = 0; v135 = (unsigned int)(v146 - 1); do { v136 = (unsigned int)func0(v135); v125 -= v136; v135 = (unsigned int)(v125 - 1); v134 += func0(v136); } while ( (unsigned int)v135 > 1 ); v151 += v133; v96 -= v134 + 1; v146 = v96 - 1; if ( (unsigned int)(v96 - 1) <= 1 ) goto LABEL_109; } ++v151; LABEL_109: v168 += v159; v160 -= v151 + 1; v165 = v160 - 1; if ( (unsigned int)(v160 - 1) <= 1 ) { v137 = v168; v138 = v172; goto LABEL_111; } } v138 = v172; v137 = v168 + 1; LABEL_111: v169 -= v137 + 1; v173 += v138; v2 = v169 - 1; if ( (unsigned int)(v169 - 1) <= 1 ) return (unsigned int)(v173 + 1); } } return result; }
func0: ENDBR64 PUSH R15 MOV EAX,0x1 PUSH R14 PUSH R13 PUSH R12 LEA R12D,[RDI + -0x1] PUSH RBP PUSH RBX SUB RSP,0x38 CMP R12D,0x1 JBE 0x001019dc XOR EBP,EBP MOV dword ptr [RSP + 0x24],EDI MOV R14D,R12D MOV dword ptr [RSP + 0x2c],EBP LAB_00101222: MOV EAX,dword ptr [RSP + 0x24] MOV dword ptr [RSP + 0x18],R14D CMP EAX,0x3 JZ 0x00101b63 MOV dword ptr [RSP + 0x10],R14D XOR EBX,EBX SUB EAX,0x2 MOV dword ptr [RSP + 0x28],R14D MOV dword ptr [RSP + 0x20],EBX MOV EBX,EAX LAB_00101249: MOV EAX,dword ptr [RSP + 0x10] CMP EAX,0x3 JZ 0x00101ad0 XOR ECX,ECX LEA R15D,[RAX + -0x2] MOV dword ptr [RSP + 0x14],EBX MOV R14D,EBX MOV dword ptr [RSP + 0x1c],EBX MOV R12D,ECX MOV EBX,R15D LAB_0010126d: MOV EDI,EBX MOV EBP,EBX XOR R13D,R13D CALL 0x001011f0 LEA EDI,[RAX + -0x1] CMP EDI,0x1 JBE 0x00101b7c MOV dword ptr [RSP + 0xc],EBX MOV EBX,EAX NOP dword ptr [RAX + RAX*0x1] LAB_00101290: CALL 0x001011f0 MOV R15D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,R15D LEA EDI,[RBX + -0x1] ADD R13D,EAX CMP EDI,0x1 JA 0x00101290 MOV EBX,dword ptr [RSP + 0xc] ADD R13D,0x1 LAB_001012b5: CMP R14D,0x3 JZ 0x00101aa0 XOR R15D,R15D LEA EDI,[RBX + -0x1] LAB_001012c5: CALL 0x001011f0 MOV EBX,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBP,EBX LEA EDI,[RBP + -0x1] ADD R15D,EAX CMP EDI,0x1 JA 0x001012c5 ADD R15D,0x1 ADD R12D,R13D SUB R14D,R15D LEA EBX,[R14 + -0x1] CMP EBX,0x1 JA 0x0010126d MOV ECX,R12D MOV EBP,dword ptr [RSP + 0x14] MOV EBX,dword ptr [RSP + 0x1c] LEA R14D,[RCX + 0x1] CMP ECX,0x1 JBE 0x00101abb NOP LAB_00101310: MOV dword ptr [RSP + 0x14],EBP XOR R15D,R15D MOV EBP,ECX MOV dword ptr [RSP + 0x1c],EBX MOV EBX,R14D LAB_00101320: MOV EDI,EBP MOV R13D,EBP XOR R12D,R12D CALL 0x001011f0 LEA EDI,[RAX + -0x1] CMP EDI,0x1 JBE 0x00101b87 MOV dword ptr [RSP + 0xc],EBX MOV EBX,EAX NOP LAB_00101340: CALL 0x001011f0 MOV R14D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,R14D LEA EDI,[RBX + -0x1] ADD R12D,EAX CMP EDI,0x1 JA 0x00101340 MOV EBX,dword ptr [RSP + 0xc] ADD R12D,0x1 LAB_00101365: CMP EBX,0x3 JZ 0x00101a90 XOR R14D,R14D LEA EDI,[RBP + -0x1] LAB_00101374: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB R13D,EBP LEA EDI,[R13 + -0x1] ADD R14D,EAX CMP EDI,0x1 JA 0x00101374 LEA EDX,[R14 + 0x1] ADD R15D,R12D SUB EBX,EDX LEA EBP,[RBX + -0x1] CMP EBP,0x1 JA 0x00101320 MOV EBP,dword ptr [RSP + 0x14] MOV EBX,dword ptr [RSP + 0x1c] NOP LAB_001013b0: LEA R13D,[R15 + 0x1] LAB_001013b4: MOV dword ptr [RSP + 0xc],R13D XOR R12D,R12D LEA EDI,[RBX + -0x1] LAB_001013bf: CALL 0x001011f0 XOR R14D,R14D LEA EDI,[RAX + -0x1] MOV R15D,EAX MOV R13D,EAX CMP EDI,0x1 JBE 0x00101b92 NOP dword ptr [RAX] LAB_001013e0: CALL 0x001011f0 MOV EBX,EAX MOV EDI,EAX CALL 0x001011f0 SUB R13D,EBX LEA EDI,[R13 + -0x1] ADD R14D,EAX CMP EDI,0x1 JA 0x001013e0 ADD R14D,0x1 LAB_00101401: SUB EBP,R15D ADD R12D,R14D LEA EDI,[RBP + -0x1] CMP EDI,0x1 JA 0x001013bf ADD R12D,0x1 SUB dword ptr [RSP + 0x10],R12D MOV EAX,dword ptr [RSP + 0x10] MOV R13D,dword ptr [RSP + 0xc] ADD dword ptr [RSP + 0x20],R13D LEA EBX,[RAX + -0x1] CMP EBX,0x1 JA 0x00101249 MOV EBX,dword ptr [RSP + 0x20] MOV R14D,dword ptr [RSP + 0x28] LEA EAX,[RBX + 0x1] MOV dword ptr [RSP + 0x10],EAX CMP EBX,0x1 JBE 0x00101aec NOP dword ptr [RAX + RAX*0x1] LAB_00101450: XOR R15D,R15D MOV dword ptr [RSP + 0x28],R14D MOV R13D,EBX MOV dword ptr [RSP + 0x20],R15D LAB_00101460: MOV EAX,dword ptr [RSP + 0x10] CMP EAX,0x3 JZ 0x00101b10 MOV dword ptr [RSP + 0x14],R13D LEA EBP,[RAX + -0x2] XOR R14D,R14D MOV EBX,R13D MOV dword ptr [RSP + 0x1c],R13D MOV R12D,EBP LAB_00101483: MOV EDI,R12D MOV R13D,R12D XOR EBP,EBP CALL 0x001011f0 LEA EDI,[RAX + -0x1] CMP EDI,0x1 JBE 0x00101b9d MOV dword ptr [RSP + 0xc],EBX MOV EBX,EAX NOP word ptr [RAX + RAX*0x1] LAB_001014a8: CALL 0x001011f0 MOV R15D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,R15D LEA EDI,[RBX + -0x1] ADD EBP,EAX CMP EDI,0x1 JA 0x001014a8 MOV EBX,dword ptr [RSP + 0xc] LEA R15D,[RBP + 0x1] LAB_001014cc: CMP EBX,0x3 JZ 0x00101a68 XOR EBP,EBP LEA EDI,[R12 + -0x1] LAB_001014dc: CALL 0x001011f0 MOV R12D,EAX MOV EDI,EAX CALL 0x001011f0 SUB R13D,R12D LEA EDI,[R13 + -0x1] ADD EBP,EAX CMP EDI,0x1 JA 0x001014dc ADD EBP,0x1 ADD R14D,R15D SUB EBX,EBP LEA R12D,[RBX + -0x1] CMP R12D,0x1 JA 0x00101483 MOV R12D,dword ptr [RSP + 0x14] MOV R13D,dword ptr [RSP + 0x1c] LEA R15D,[R14 + 0x1] CMP R14D,0x1 JBE 0x00101a83 NOP word ptr [RAX + RAX*0x1] LAB_00101530: XOR EDX,EDX MOV dword ptr [RSP + 0x14],R12D MOV R12D,R15D MOV dword ptr [RSP + 0x1c],R13D MOV R15D,EDX MOV R13D,R14D LAB_00101545: MOV EDI,R13D MOV EBP,R13D XOR R14D,R14D CALL 0x001011f0 LEA EDI,[RAX + -0x1] CMP EDI,0x1 JBE 0x00101ba8 MOV dword ptr [RSP + 0xc],R13D MOV EBP,EAX NOP word ptr CS:[RAX + RAX*0x1] LAB_00101570: CALL 0x001011f0 MOV EBX,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBP,EBX LEA EDI,[RBP + -0x1] ADD R14D,EAX CMP EDI,0x1 JA 0x00101570 MOV EBP,dword ptr [RSP + 0xc] LEA EBX,[R14 + 0x1] LAB_00101593: CMP R12D,0x3 JZ 0x00101a50 XOR R14D,R14D LEA EDI,[R13 + -0x1] LAB_001015a4: CALL 0x001011f0 MOV R13D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBP,R13D LEA EDI,[RBP + -0x1] ADD R14D,EAX CMP EDI,0x1 JA 0x001015a4 LEA ECX,[R14 + 0x1] ADD R15D,EBX SUB R12D,ECX LEA R13D,[R12 + -0x1] CMP R13D,0x1 JA 0x00101545 MOV R12D,dword ptr [RSP + 0x14] MOV R13D,dword ptr [RSP + 0x1c] MOV EDX,R15D NOP word ptr [RAX + RAX*0x1] LAB_001015f0: LEA EBX,[RDX + 0x1] LAB_001015f3: XOR EDX,EDX MOV dword ptr [RSP + 0x14],EBX SUB R13D,0x1 MOV dword ptr [RSP + 0xc],EDX LAB_00101601: MOV EBP,R13D CMP R12D,0x3 JZ 0x00101a40 MOV EBX,R13D XOR R15D,R15D LEA EDI,[R12 + -0x2] LAB_00101619: CALL 0x001011f0 MOV R14D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,R14D LEA EDI,[RBX + -0x1] ADD R15D,EAX CMP EDI,0x1 JA 0x00101619 LEA R14D,[R15 + 0x1] CMP R15D,0x1 JBE 0x00101b28 XOR EBX,EBX MOV EDI,R15D LAB_00101649: CALL 0x001011f0 MOV R15D,EAX MOV EDI,EAX CALL 0x001011f0 SUB R14D,R15D LEA EDI,[R14 + -0x1] ADD EBX,EAX CMP EDI,0x1 JA 0x00101649 LEA R15D,[RBX + 0x1] LAB_0010166a: XOR EBX,EBX LEA EDI,[R13 + -0x1] LAB_00101670: CALL 0x001011f0 MOV R13D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBP,R13D LEA EDI,[RBP + -0x1] ADD EBX,EAX CMP EDI,0x1 JA 0x00101670 LEA EDX,[RBX + 0x1] ADD dword ptr [RSP + 0xc],R15D SUB R12D,EDX LEA R13D,[R12 + -0x1] CMP R13D,0x1 JA 0x00101601 MOV EDX,dword ptr [RSP + 0xc] MOV EBX,dword ptr [RSP + 0x14] NOP LAB_001016b0: ADD EDX,0x1 SUB dword ptr [RSP + 0x10],EDX MOV EAX,dword ptr [RSP + 0x10] ADD dword ptr [RSP + 0x20],EBX LEA R13D,[RAX + -0x1] CMP R13D,0x1 JA 0x00101460 MOV R15D,dword ptr [RSP + 0x20] MOV R14D,dword ptr [RSP + 0x28] NOP word ptr [RAX + RAX*0x1] LAB_001016e0: LEA EBX,[R15 + 0x1] LAB_001016e4: XOR EDX,EDX LEA EAX,[R14 + -0x1] MOV dword ptr [RSP + 0x28],EBX MOV dword ptr [RSP + 0x1c],EAX MOV dword ptr [RSP + 0x20],EDX LAB_001016f6: MOV EAX,dword ptr [RSP + 0x1c] MOV ECX,dword ptr [RSP + 0x18] MOV R13D,EAX CMP ECX,0x3 JZ 0x00101b00 MOV dword ptr [RSP + 0xc],EAX LEA EAX,[RCX + -0x2] MOV dword ptr [RSP + 0x14],0x0 MOV dword ptr [RSP + 0x10],EAX LAB_0010171d: MOV R12D,dword ptr [RSP + 0x10] MOV EAX,dword ptr [RSP + 0xc] MOV EBX,R12D CMP EAX,0x3 JZ 0x00101a10 XOR R14D,R14D LEA EDI,[RAX + -0x2] LAB_00101738: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB R12D,EBP LEA EDI,[R12 + -0x1] ADD R14D,EAX CMP EDI,0x1 JA 0x00101738 LEA R15D,[R14 + 0x1] CMP R14D,0x1 JBE 0x00101b58 XOR R12D,R12D MOV EDI,R14D LAB_0010176a: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB R15D,EBP LEA EDI,[R15 + -0x1] ADD R12D,EAX CMP EDI,0x1 JA 0x0010176a ADD R12D,0x1 LAB_0010178b: MOV EAX,dword ptr [RSP + 0x10] XOR EBP,EBP LEA EDI,[RAX + -0x1] LAB_00101794: CALL 0x001011f0 MOV R14D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,R14D LEA EDI,[RBX + -0x1] ADD EBP,EAX CMP EDI,0x1 JA 0x00101794 LEA EDX,[RBP + 0x1] SUB dword ptr [RSP + 0xc],EDX MOV EAX,dword ptr [RSP + 0xc] ADD dword ptr [RSP + 0x14],R12D SUB EAX,0x1 MOV dword ptr [RSP + 0x10],EAX CMP EAX,0x1 JA 0x0010171d MOV EAX,dword ptr [RSP + 0x14] LEA ECX,[RAX + 0x1] MOV dword ptr [RSP + 0xc],ECX CMP EAX,0x1 JBE 0x00101a29 NOP dword ptr [RAX] LAB_001017e8: MOV dword ptr [RSP + 0x14],0x0 MOV dword ptr [RSP + 0x10],EAX LAB_001017f4: MOV R12D,dword ptr [RSP + 0x10] MOV EAX,dword ptr [RSP + 0xc] MOV EBX,R12D CMP EAX,0x3 JZ 0x00101a00 XOR R14D,R14D LEA EDI,[RAX + -0x2] LAB_0010180f: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB R12D,EBP LEA EDI,[R12 + -0x1] ADD R14D,EAX CMP EDI,0x1 JA 0x0010180f LEA R12D,[R14 + 0x1] CMP R14D,0x1 JBE 0x00101b48 XOR R15D,R15D MOV EDI,R14D LAB_00101841: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB R12D,EBP LEA EDI,[R12 + -0x1] ADD R15D,EAX CMP EDI,0x1 JA 0x00101841 LEA R14D,[R15 + 0x1] LAB_00101863: MOV EAX,dword ptr [RSP + 0x10] XOR EBP,EBP LEA EDI,[RAX + -0x1] LAB_0010186c: CALL 0x001011f0 MOV R12D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,R12D LEA EDI,[RBX + -0x1] ADD EBP,EAX CMP EDI,0x1 JA 0x0010186c LEA EDX,[RBP + 0x1] SUB dword ptr [RSP + 0xc],EDX MOV EAX,dword ptr [RSP + 0xc] ADD dword ptr [RSP + 0x14],R14D SUB EAX,0x1 MOV dword ptr [RSP + 0x10],EAX CMP EAX,0x1 JA 0x001017f4 NOP dword ptr [RAX + RAX*0x1] LAB_001018b0: MOV EAX,dword ptr [RSP + 0x14] ADD EAX,0x1 MOV dword ptr [RSP + 0x14],EAX LAB_001018bb: MOV EAX,dword ptr [RSP + 0x1c] MOV dword ptr [RSP + 0x10],0x0 SUB EAX,0x1 MOV dword ptr [RSP + 0xc],EAX LAB_001018ce: MOV R14D,dword ptr [RSP + 0xc] MOV EBX,R14D CMP R13D,0x3 JZ 0x001019f0 XOR R12D,R12D LEA EDI,[R13 + -0x2] LAB_001018e7: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB R14D,EBP LEA EDI,[R14 + -0x1] ADD R12D,EAX CMP EDI,0x1 JA 0x001018e7 LEA R14D,[R12 + 0x1] CMP R12D,0x1 JBE 0x00101b38 XOR R15D,R15D MOV EDI,R12D LAB_00101919: CALL 0x001011f0 MOV EBP,EAX MOV EDI,EAX CALL 0x001011f0 SUB R14D,EBP LEA EDI,[R14 + -0x1] ADD R15D,EAX CMP EDI,0x1 JA 0x00101919 LEA EBP,[R15 + 0x1] LAB_0010193a: MOV EAX,dword ptr [RSP + 0xc] XOR R15D,R15D LEA EDI,[RAX + -0x1] LAB_00101944: CALL 0x001011f0 MOV R14D,EAX MOV EDI,EAX CALL 0x001011f0 SUB EBX,R14D LEA EDI,[RBX + -0x1] ADD R15D,EAX CMP EDI,0x1 JA 0x00101944 LEA EDX,[R15 + 0x1] ADD dword ptr [RSP + 0x10],EBP SUB R13D,EDX LEA EAX,[R13 + -0x1] MOV dword ptr [RSP + 0xc],EAX CMP EAX,0x1 JA 0x001018ce NOP dword ptr [RAX] LAB_00101980: MOV R12D,dword ptr [RSP + 0x10] MOV ECX,dword ptr [RSP + 0x14] ADD dword ptr [RSP + 0x20],ECX ADD R12D,0x1 SUB dword ptr [RSP + 0x18],R12D MOV EAX,dword ptr [RSP + 0x18] SUB EAX,0x1 MOV dword ptr [RSP + 0x1c],EAX CMP EAX,0x1 JA 0x001016f6 MOV EDX,dword ptr [RSP + 0x20] MOV EBX,dword ptr [RSP + 0x28] NOP word ptr [RAX + RAX*0x1] LAB_001019b8: ADD EDX,0x1 SUB dword ptr [RSP + 0x24],EDX MOV EAX,dword ptr [RSP + 0x24] ADD dword ptr [RSP + 0x2c],EBX LEA R14D,[RAX + -0x1] CMP R14D,0x1 JA 0x00101222 MOV EBP,dword ptr [RSP + 0x2c] LEA EAX,[RBP + 0x1] LAB_001019dc: ADD RSP,0x38 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001019f0: ADD dword ptr [RSP + 0x10],0x1 JMP 0x00101980 LAB_00101a00: ADD dword ptr [RSP + 0x14],0x1 JMP 0x001018b0 LAB_00101a10: ADD dword ptr [RSP + 0x14],0x1 MOV EAX,dword ptr [RSP + 0x14] LEA ECX,[RAX + 0x1] MOV dword ptr [RSP + 0xc],ECX CMP EAX,0x1 JA 0x001017e8 LAB_00101a29: MOV dword ptr [RSP + 0x14],0x1 JMP 0x001018bb LAB_00101a40: MOV EDX,dword ptr [RSP + 0xc] MOV EBX,dword ptr [RSP + 0x14] ADD EDX,0x1 JMP 0x001016b0 LAB_00101a50: MOV EDX,R15D MOV R12D,dword ptr [RSP + 0x14] MOV R13D,dword ptr [RSP + 0x1c] ADD EDX,EBX JMP 0x001015f0 LAB_00101a68: ADD R14D,R15D MOV R12D,dword ptr [RSP + 0x14] MOV R13D,dword ptr [RSP + 0x1c] LEA R15D,[R14 + 0x1] CMP R14D,0x1 JA 0x00101530 LAB_00101a83: MOV EBX,0x1 JMP 0x001015f3 LAB_00101a90: MOV EBP,dword ptr [RSP + 0x14] MOV EBX,dword ptr [RSP + 0x1c] ADD R15D,R12D JMP 0x001013b0 LAB_00101aa0: MOV ECX,R12D MOV EBP,dword ptr [RSP + 0x14] MOV EBX,dword ptr [RSP + 0x1c] ADD ECX,R13D LEA R14D,[RCX + 0x1] CMP ECX,0x1 JA 0x00101310 LAB_00101abb: MOV R13D,0x1 JMP 0x001013b4 LAB_00101ad0: MOV EBX,dword ptr [RSP + 0x20] MOV R14D,dword ptr [RSP + 0x28] ADD EBX,0x1 LEA EAX,[RBX + 0x1] MOV dword ptr [RSP + 0x10],EAX CMP EBX,0x1 JA 0x00101450 LAB_00101aec: MOV EBX,0x1 JMP 0x001016e4 LAB_00101b00: MOV EDX,dword ptr [RSP + 0x20] MOV EBX,dword ptr [RSP + 0x28] ADD EDX,0x1 JMP 0x001019b8 LAB_00101b10: MOV R15D,dword ptr [RSP + 0x20] MOV R14D,dword ptr [RSP + 0x28] ADD R15D,0x1 JMP 0x001016e0 LAB_00101b28: MOV R15D,0x1 JMP 0x0010166a LAB_00101b38: MOV EBP,0x1 JMP 0x0010193a LAB_00101b48: MOV R14D,0x1 JMP 0x00101863 LAB_00101b58: MOV R12D,0x1 JMP 0x0010178b LAB_00101b63: MOV EBP,dword ptr [RSP + 0x2c] ADD RSP,0x38 POP RBX ADD EBP,0x1 LEA EAX,[RBP + 0x1] POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101b7c: MOV R13D,0x1 JMP 0x001012b5 LAB_00101b87: MOV R12D,0x1 JMP 0x00101365 LAB_00101b92: MOV R14D,0x1 JMP 0x00101401 LAB_00101b9d: MOV R15D,0x1 JMP 0x001014cc LAB_00101ba8: MOV EBX,0x1 JMP 0x00101593
int func0(int param_1) { uint uVar1; int iVar2; int iVar3; int iVar4; int iVar5; int iVar6; int iVar7; uint uVar8; uint uVar9; uint uVar10; int iVar11; uint uVar12; uint local_5c; uint local_58; uint local_54; uint local_50; uint local_4c; uint local_48; int local_44; int local_3c; local_3c = 1; local_50 = param_1 - 1; if (1 < local_50) { local_3c = 0; local_44 = param_1; do { if (local_44 == 3) { return local_3c + 2; } uVar1 = local_44 - 2; local_48 = 0; local_58 = local_50; do { if (local_58 == 3) { local_58 = local_48 + 2; uVar1 = local_48 + 1; goto joined_r0x00101ae6; } uVar9 = local_58 - 2; iVar2 = 0; uVar12 = uVar1; do { iVar5 = iVar2; iVar11 = 0; iVar2 = func0(uVar9); if (iVar2 - 1U < 2) { iVar11 = 1; } else { do { iVar3 = func0(); iVar4 = func0(iVar3); iVar2 = iVar2 - iVar3; iVar11 = iVar11 + iVar4; } while (1 < iVar2 - 1U); iVar11 = iVar11 + 1; } if (uVar12 == 3) break; iVar2 = 0; uVar10 = uVar9 - 1; do { iVar3 = func0(uVar10); iVar4 = func0(iVar3); uVar9 = uVar9 - iVar3; uVar10 = uVar9 - 1; iVar2 = iVar2 + iVar4; } while (1 < uVar10); uVar12 = uVar12 - (iVar2 + 1); uVar9 = uVar12 - 1; iVar2 = iVar5 + iVar11; } while (1 < uVar9); if ((uint)(iVar5 + iVar11) < 2) { iVar2 = 1; } else { uVar9 = iVar5 + iVar11; iVar2 = uVar9 + 1; iVar5 = 0; do { iVar3 = iVar5; iVar11 = 0; iVar5 = func0(uVar9); if (iVar5 - 1U < 2) { iVar11 = 1; } else { do { iVar4 = func0(); iVar6 = func0(iVar4); iVar5 = iVar5 - iVar4; iVar11 = iVar11 + iVar6; } while (1 < iVar5 - 1U); iVar11 = iVar11 + 1; } if (iVar2 == 3) break; iVar5 = 0; uVar12 = uVar9 - 1; do { iVar4 = func0(uVar12); iVar6 = func0(iVar4); uVar9 = uVar9 - iVar4; uVar12 = uVar9 - 1; iVar5 = iVar5 + iVar6; } while (1 < uVar12); iVar2 = iVar2 - (iVar5 + 1); uVar9 = iVar2 - 1; iVar5 = iVar3 + iVar11; } while (1 < uVar9); iVar2 = iVar3 + iVar11 + 1; } iVar5 = 0; uVar9 = uVar1 - 1; do { iVar3 = func0(uVar9); iVar4 = 0; iVar11 = iVar3; if (iVar3 - 1U < 2) { iVar4 = 1; } else { do { iVar6 = func0(); iVar7 = func0(iVar6); iVar11 = iVar11 - iVar6; iVar4 = iVar4 + iVar7; } while (1 < iVar11 - 1U); iVar4 = iVar4 + 1; } uVar1 = uVar1 - iVar3; iVar5 = iVar5 + iVar4; uVar9 = uVar1 - 1; } while (1 < uVar9); local_58 = local_58 - (iVar5 + 1); local_48 = local_48 + iVar2; uVar1 = local_58 - 1; } while (1 < uVar1); local_58 = local_48 + 1; uVar1 = local_48; joined_r0x00101ae6: if (uVar1 < 2) { iVar2 = 1; } else { local_48 = 0; do { if (local_58 == 3) { local_48 = local_48 + 1; break; } uVar9 = local_58 - 2; iVar2 = 0; uVar12 = uVar1; do { iVar11 = iVar2; iVar5 = 0; iVar2 = func0(uVar9); if (iVar2 - 1U < 2) { iVar5 = 1; } else { do { iVar3 = func0(); iVar4 = func0(iVar3); iVar2 = iVar2 - iVar3; iVar5 = iVar5 + iVar4; } while (1 < iVar2 - 1U); iVar5 = iVar5 + 1; } if (uVar12 == 3) break; iVar2 = 0; uVar10 = uVar9 - 1; do { iVar3 = func0(uVar10); iVar4 = func0(iVar3); uVar9 = uVar9 - iVar3; uVar10 = uVar9 - 1; iVar2 = iVar2 + iVar4; } while (1 < uVar10); uVar12 = uVar12 - (iVar2 + 1); uVar9 = uVar12 - 1; iVar2 = iVar11 + iVar5; } while (1 < uVar9); if ((uint)(iVar11 + iVar5) < 2) { iVar2 = 1; } else { iVar2 = iVar11 + iVar5 + 1; uVar9 = iVar11 + iVar5; iVar5 = 0; do { iVar3 = iVar5; iVar11 = 0; iVar5 = func0(uVar9); if (iVar5 - 1U < 2) { iVar11 = 1; } else { do { iVar4 = func0(); iVar6 = func0(iVar4); iVar5 = iVar5 - iVar4; iVar11 = iVar11 + iVar6; } while (1 < iVar5 - 1U); iVar11 = iVar11 + 1; } if (iVar2 == 3) break; iVar5 = 0; uVar12 = uVar9 - 1; do { iVar4 = func0(uVar12); iVar6 = func0(iVar4); uVar9 = uVar9 - iVar4; uVar12 = uVar9 - 1; iVar5 = iVar5 + iVar6; } while (1 < uVar12); iVar2 = iVar2 - (iVar5 + 1); uVar9 = iVar2 - 1; iVar5 = iVar3 + iVar11; } while (1 < uVar9); iVar2 = iVar3 + iVar11 + 1; } uVar9 = uVar1 - 1; local_5c = 0; do { if (uVar1 == 3) { local_5c = local_5c + 1; break; } uVar12 = 0; uVar10 = uVar1 - 2; uVar8 = uVar9; do { iVar5 = func0(uVar10); iVar11 = func0(iVar5); uVar8 = uVar8 - iVar5; uVar10 = uVar8 - 1; uVar12 = uVar12 + iVar11; } while (1 < uVar10); iVar5 = uVar12 + 1; if (uVar12 < 2) { iVar11 = 1; } else { iVar11 = 0; do { iVar3 = func0(uVar12); iVar4 = func0(iVar3); iVar5 = iVar5 - iVar3; uVar12 = iVar5 - 1; iVar11 = iVar11 + iVar4; } while (1 < uVar12); iVar11 = iVar11 + 1; } iVar5 = 0; uVar12 = uVar9 - 1; do { iVar3 = func0(uVar12); iVar4 = func0(iVar3); uVar9 = uVar9 - iVar3; uVar12 = uVar9 - 1; iVar5 = iVar5 + iVar4; } while (1 < uVar12); local_5c = local_5c + iVar11; uVar1 = uVar1 - (iVar5 + 1); uVar9 = uVar1 - 1; } while (1 < uVar9); local_58 = local_58 - (local_5c + 1); local_48 = local_48 + iVar2; uVar1 = local_58 - 1; } while (1 < uVar1); iVar2 = local_48 + 1; } local_4c = local_50 - 1; local_48 = 0; do { if (local_50 == 3) { local_48 = local_48 + 1; break; } local_5c = local_4c; local_58 = local_50 - 2; local_54 = 0; do { if (local_5c == 3) { local_58 = local_54 + 1; local_5c = local_54 + 2; goto joined_r0x00101a23; } uVar9 = 0; uVar1 = local_5c - 2; uVar12 = local_58; do { iVar5 = func0(uVar1); iVar11 = func0(iVar5); uVar12 = uVar12 - iVar5; uVar1 = uVar12 - 1; uVar9 = uVar9 + iVar11; } while (1 < uVar1); iVar5 = uVar9 + 1; if (uVar9 < 2) { iVar11 = 1; } else { iVar11 = 0; do { iVar3 = func0(uVar9); iVar4 = func0(iVar3); iVar5 = iVar5 - iVar3; uVar9 = iVar5 - 1; iVar11 = iVar11 + iVar4; } while (1 < uVar9); iVar11 = iVar11 + 1; } iVar5 = 0; uVar1 = local_58 - 1; do { iVar3 = func0(uVar1); iVar4 = func0(iVar3); local_58 = local_58 - iVar3; uVar1 = local_58 - 1; iVar5 = iVar5 + iVar4; } while (1 < uVar1); local_5c = local_5c - (iVar5 + 1); local_54 = local_54 + iVar11; local_58 = local_5c - 1; } while (1 < local_58); local_5c = local_54 + 1; local_58 = local_54; joined_r0x00101a23: if (local_58 < 2) { local_54 = 1; } else { local_54 = 0; do { if (local_5c == 3) { local_54 = local_54 + 1; break; } uVar9 = 0; uVar1 = local_5c - 2; uVar12 = local_58; do { iVar5 = func0(uVar1); iVar11 = func0(iVar5); uVar12 = uVar12 - iVar5; uVar1 = uVar12 - 1; uVar9 = uVar9 + iVar11; } while (1 < uVar1); iVar5 = uVar9 + 1; if (uVar9 < 2) { iVar11 = 1; } else { iVar11 = 0; do { iVar3 = func0(uVar9); iVar4 = func0(iVar3); iVar5 = iVar5 - iVar3; uVar9 = iVar5 - 1; iVar11 = iVar11 + iVar4; } while (1 < uVar9); iVar11 = iVar11 + 1; } iVar5 = 0; uVar1 = local_58 - 1; do { iVar3 = func0(uVar1); iVar4 = func0(iVar3); local_58 = local_58 - iVar3; uVar1 = local_58 - 1; iVar5 = iVar5 + iVar4; } while (1 < uVar1); local_5c = local_5c - (iVar5 + 1); local_54 = local_54 + iVar11; local_58 = local_5c - 1; } while (1 < local_58); local_54 = local_54 + 1; } local_58 = 0; local_5c = local_4c - 1; do { if (local_4c == 3) { local_58 = local_58 + 1; break; } uVar9 = 0; uVar1 = local_4c - 2; uVar12 = local_5c; do { iVar5 = func0(uVar1); iVar11 = func0(iVar5); uVar12 = uVar12 - iVar5; uVar1 = uVar12 - 1; uVar9 = uVar9 + iVar11; } while (1 < uVar1); iVar5 = uVar9 + 1; if (uVar9 < 2) { iVar11 = 1; } else { iVar11 = 0; do { iVar3 = func0(uVar9); iVar4 = func0(iVar3); iVar5 = iVar5 - iVar3; uVar9 = iVar5 - 1; iVar11 = iVar11 + iVar4; } while (1 < uVar9); iVar11 = iVar11 + 1; } iVar5 = 0; uVar1 = local_5c - 1; do { iVar3 = func0(uVar1); iVar4 = func0(iVar3); local_5c = local_5c - iVar3; uVar1 = local_5c - 1; iVar5 = iVar5 + iVar4; } while (1 < uVar1); local_58 = local_58 + iVar11; local_4c = local_4c - (iVar5 + 1); local_5c = local_4c - 1; } while (1 < local_5c); local_48 = local_48 + local_54; local_50 = local_50 - (local_58 + 1); local_4c = local_50 - 1; } while (1 < local_4c); local_44 = local_44 - (local_48 + 1); local_3c = local_3c + iVar2; local_50 = local_44 - 1; } while (1 < local_50); local_3c = local_3c + 1; } return local_3c; }
4,232
func0
#include <math.h> #include <assert.h> #include <stdio.h>
double func0(double r) { double surfacearea = 4 * M_PI * r * r; return surfacearea; }
int main() { assert(func0(10) == 1256.6370614359173); assert(func0(15) == 2827.4333882308138); assert(func0(20) == 5026.548245743669); printf("All tests passed successfully!\n"); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp movsd %xmm0,-0x18(%rbp) movsd -0x18(%rbp),%xmm1 movsd 0xf4d(%rip),%xmm0 mulsd %xmm1,%xmm0 movsd -0x18(%rbp),%xmm1 mulsd %xmm1,%xmm0 movsd %xmm0,-0x8(%rbp) movsd -0x8(%rbp),%xmm0 pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp movsd [rbp+var_18], xmm0 movsd xmm1, [rbp+var_18] movsd xmm0, cs:qword_20B0 mulsd xmm0, xmm1 movsd xmm1, [rbp+var_18] mulsd xmm0, xmm1 movsd [rbp+var_8], xmm0 movsd xmm0, [rbp+var_8] pop rbp retn
double func0(double a1) { return 12.56637061435917 * a1 * a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOVSD qword ptr [RBP + -0x18],XMM0 MOVSD XMM1,qword ptr [RBP + -0x18] MOVSD XMM0,qword ptr [0x001020b0] MULSD XMM0,XMM1 MOVSD XMM1,qword ptr [RBP + -0x18] MULSD XMM0,XMM1 MOVSD qword ptr [RBP + -0x8],XMM0 MOVSD XMM0,qword ptr [RBP + -0x8] POP RBP RET
double func0(double param_1) { return DAT_001020b0 * param_1 * param_1; }
4,233
func0
#include <math.h> #include <assert.h> #include <stdio.h>
double func0(double r) { double surfacearea = 4 * M_PI * r * r; return surfacearea; }
int main() { assert(func0(10) == 1256.6370614359173); assert(func0(15) == 2827.4333882308138); assert(func0(20) == 5026.548245743669); printf("All tests passed successfully!\n"); return 0; }
O1
c
func0: endbr64 movapd %xmm0,%xmm1 mulsd 0xecf(%rip),%xmm0 mulsd %xmm1,%xmm0 retq
func0: endbr64 movapd xmm1, xmm0 mulsd xmm0, cs:qword_2028 mulsd xmm0, xmm1 retn
double func0(double a1) { return a1 * 12.56637061435917 * a1; }
func0: ENDBR64 MOVAPD XMM1,XMM0 MULSD XMM0,qword ptr [0x00102028] MULSD XMM0,XMM1 RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ double func0(double param_1) { return param_1 * _DAT_00102028 * param_1; }
4,234
func0
#include <math.h> #include <assert.h> #include <stdio.h>
double func0(double r) { double surfacearea = 4 * M_PI * r * r; return surfacearea; }
int main() { assert(func0(10) == 1256.6370614359173); assert(func0(15) == 2827.4333882308138); assert(func0(20) == 5026.548245743669); printf("All tests passed successfully!\n"); return 0; }
O2
c
func0: endbr64 movapd %xmm0,%xmm1 movsd 0xea8(%rip),%xmm0 mulsd %xmm1,%xmm0 mulsd %xmm1,%xmm0 retq nopl 0x0(%rax)
func0: endbr64 movapd xmm1, xmm0 movsd xmm0, cs:qword_2028 mulsd xmm0, xmm1 mulsd xmm0, xmm1 retn
double func0(double a1) { return 12.56637061435917 * a1 * a1; }
func0: ENDBR64 MOVAPD XMM1,XMM0 MOVSD XMM0,qword ptr [0x00102028] MULSD XMM0,XMM1 MULSD XMM0,XMM1 RET
double func0(double param_1) { return DAT_00102028 * param_1 * param_1; }
4,235
func0
#include <math.h> #include <assert.h> #include <stdio.h>
double func0(double r) { double surfacearea = 4 * M_PI * r * r; return surfacearea; }
int main() { assert(func0(10) == 1256.6370614359173); assert(func0(15) == 2827.4333882308138); assert(func0(20) == 5026.548245743669); printf("All tests passed successfully!\n"); return 0; }
O3
c
func0: endbr64 movapd %xmm0,%xmm1 movsd 0xea8(%rip),%xmm0 mulsd %xmm1,%xmm0 mulsd %xmm1,%xmm0 retq nopl 0x0(%rax)
func0: endbr64 movapd xmm1, xmm0 movsd xmm0, cs:qword_2028 mulsd xmm0, xmm1 mulsd xmm0, xmm1 retn
double func0(double a1) { return 12.56637061435917 * a1 * a1; }
func0: ENDBR64 MOVAPD XMM1,XMM0 MOVSD XMM0,qword ptr [0x00102028] MULSD XMM0,XMM1 MULSD XMM0,XMM1 RET
double func0(double param_1) { return DAT_00102028 * param_1 * param_1; }
4,236
func0
#include <assert.h>
int func0(int n) { return 3 * n * (n - 1) + 1; }
int main() { assert(func0(10) == 271); assert(func0(2) == 7); assert(func0(9) == 217); 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 $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, 1 pop rbp retn
long long func0(int a1) { return (unsigned int)(3 * 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,0x1 POP RBP RET
int func0(int param_1) { return (param_1 + -1) * param_1 * 3 + 1; }
4,237
func0
#include <assert.h>
int func0(int n) { return 3 * n * (n - 1) + 1; }
int main() { assert(func0(10) == 271); assert(func0(2) == 7); assert(func0(9) == 217); return 0; }
O1
c
func0: endbr64 mov %edi,%eax lea -0x1(%rdi),%edi imul %eax,%edi lea 0x1(%rdi,%rdi,2),%eax retq
func0: endbr64 lea eax, [rdi-1] imul eax, edi lea eax, [rax+rax*2+1] retn
long long func0(int a1) { return (unsigned int)(3 * a1 * (a1 - 1) + 1); }
func0: ENDBR64 LEA EAX,[RDI + -0x1] IMUL EAX,EDI LEA EAX,[RAX + RAX*0x2 + 0x1] RET
int func0(int param_1) { return (param_1 + -1) * param_1 * 3 + 1; }
4,238
func0
#include <assert.h>
int func0(int n) { return 3 * n * (n - 1) + 1; }
int main() { assert(func0(10) == 271); assert(func0(2) == 7); assert(func0(9) == 217); return 0; }
O2
c
func0: endbr64 mov %edi,%r8d lea -0x1(%rdi),%edi imul %r8d,%edi lea 0x1(%rdi,%rdi,2),%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 lea eax, [rdi-1] imul eax, edi lea eax, [rax+rax*2+1] retn
long long func0(int a1) { return (unsigned int)(3 * a1 * (a1 - 1) + 1); }
func0: ENDBR64 LEA EAX,[RDI + -0x1] IMUL EAX,EDI LEA EAX,[RAX + RAX*0x2 + 0x1] RET
int func0(int param_1) { return (param_1 + -1) * param_1 * 3 + 1; }
4,239
func0
#include <assert.h>
int func0(int n) { return 3 * n * (n - 1) + 1; }
int main() { assert(func0(10) == 271); assert(func0(2) == 7); assert(func0(9) == 217); return 0; }
O3
c
func0: endbr64 mov %edi,%r8d lea -0x1(%rdi),%edi imul %r8d,%edi lea 0x1(%rdi,%rdi,2),%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 lea eax, [rdi-1] imul eax, edi lea eax, [rax+rax*2+1] retn
long long func0(int a1) { return (unsigned int)(3 * a1 * (a1 - 1) + 1); }
func0: ENDBR64 LEA EAX,[RDI + -0x1] IMUL EAX,EDI LEA EAX,[RAX + RAX*0x2 + 0x1] RET
int func0(int param_1) { return (param_1 + -1) * param_1 * 3 + 1; }
4,240
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct { char *key; char *value; } KeyValuePair; typedef struct { KeyValuePair *pairs; int size; } Dictionary;
Dictionary func0(Dictionary dict1, Dictionary dict2, Dictionary dict3) { Dictionary result; result.pairs = malloc(sizeof(KeyValuePair) * (dict1.size + dict2.size + dict3.size)); result.size = 0; for (int i = 0; i < dict1.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict1.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict1.pairs[i]; } } for (int i = 0; i < dict2.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict2.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict2.pairs[i]; } } for (int i = 0; i < dict3.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict3.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict3.pairs[i]; } } return result; }
int main() { KeyValuePair pairs1[] = {{"R", "Red"}, {"B", "Black"}, {"P", "Pink"}}; KeyValuePair pairs2[] = {{"G", "Green"}, {"W", "White"}}; KeyValuePair pairs3[] = {{"O", "Orange"}, {"W", "White"}, {"B", "Black"}}; Dictionary dict1 = {pairs1, 3}; Dictionary dict2 = {pairs2, 2}; Dictionary dict3 = {pairs3, 3}; Dictionary result = func0(dict1, dict2, dict3); assert(result.size == 6); KeyValuePair pairs4[] = {{"L", "lavender"}, {"B", "Blue"}}; Dictionary dict4 = {pairs4, 2}; result = func0(dict1, dict2, dict4); assert(result.size == 6); result = func0(dict1, dict4, dict2); assert(result.size == 6); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x70,%rsp mov %rsi,%rax mov %rdi,%r10 mov %r10,%rsi mov %r11,%rdi mov %rax,%rdi mov %rsi,-0x50(%rbp) mov %rdi,-0x48(%rbp) mov %rdx,-0x60(%rbp) mov %rcx,-0x58(%rbp) mov %r8,-0x70(%rbp) mov %r9,-0x68(%rbp) mov -0x48(%rbp),%edx mov -0x58(%rbp),%eax add %eax,%edx mov -0x68(%rbp),%eax add %edx,%eax cltq shl $0x4,%rax mov %rax,%rdi callq 10b0 <malloc@plt> mov %rax,-0x10(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x34(%rbp) jmpq 12aa <func0+0x101> movl $0x0,-0x30(%rbp) movl $0x0,-0x2c(%rbp) jmp 1262 <func0+0xb9> mov -0x10(%rbp),%rax mov -0x2c(%rbp),%edx movslq %edx,%rdx shl $0x4,%rdx add %rdx,%rax mov (%rax),%rdx mov -0x50(%rbp),%rax mov -0x34(%rbp),%ecx movslq %ecx,%rcx shl $0x4,%rcx add %rcx,%rax mov (%rax),%rax mov %rdx,%rsi mov %rax,%rdi callq 10a0 <strcmp@plt> test %eax,%eax jne 125e <func0+0xb5> movl $0x1,-0x30(%rbp) jmp 126a <func0+0xc1> addl $0x1,-0x2c(%rbp) mov -0x8(%rbp),%eax cmp %eax,-0x2c(%rbp) jl 121e <func0+0x75> cmpl $0x0,-0x30(%rbp) jne 12a6 <func0+0xfd> mov -0x50(%rbp),%rax mov -0x34(%rbp),%edx movslq %edx,%rdx shl $0x4,%rdx lea (%rax,%rdx,1),%rsi mov -0x10(%rbp),%rcx mov -0x8(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x8(%rbp) cltq shl $0x4,%rax add %rax,%rcx mov (%rsi),%rax mov 0x8(%rsi),%rdx mov %rax,(%rcx) mov %rdx,0x8(%rcx) addl $0x1,-0x34(%rbp) mov -0x48(%rbp),%eax cmp %eax,-0x34(%rbp) jl 120e <func0+0x65> movl $0x0,-0x28(%rbp) jmpq 135e <func0+0x1b5> movl $0x0,-0x24(%rbp) movl $0x0,-0x20(%rbp) jmp 1316 <func0+0x16d> mov -0x10(%rbp),%rax mov -0x20(%rbp),%edx movslq %edx,%rdx shl $0x4,%rdx add %rdx,%rax mov (%rax),%rdx mov -0x60(%rbp),%rax mov -0x28(%rbp),%ecx movslq %ecx,%rcx shl $0x4,%rcx add %rcx,%rax mov (%rax),%rax mov %rdx,%rsi mov %rax,%rdi callq 10a0 <strcmp@plt> test %eax,%eax jne 1312 <func0+0x169> movl $0x1,-0x24(%rbp) jmp 131e <func0+0x175> addl $0x1,-0x20(%rbp) mov -0x8(%rbp),%eax cmp %eax,-0x20(%rbp) jl 12d2 <func0+0x129> cmpl $0x0,-0x24(%rbp) jne 135a <func0+0x1b1> mov -0x60(%rbp),%rax mov -0x28(%rbp),%edx movslq %edx,%rdx shl $0x4,%rdx lea (%rax,%rdx,1),%rsi mov -0x10(%rbp),%rcx mov -0x8(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x8(%rbp) cltq shl $0x4,%rax add %rax,%rcx mov (%rsi),%rax mov 0x8(%rsi),%rdx mov %rax,(%rcx) mov %rdx,0x8(%rcx) addl $0x1,-0x28(%rbp) mov -0x58(%rbp),%eax cmp %eax,-0x28(%rbp) jl 12c2 <func0+0x119> movl $0x0,-0x1c(%rbp) jmpq 1412 <func0+0x269> movl $0x0,-0x18(%rbp) movl $0x0,-0x14(%rbp) jmp 13ca <func0+0x221> mov -0x10(%rbp),%rax mov -0x14(%rbp),%edx movslq %edx,%rdx shl $0x4,%rdx add %rdx,%rax mov (%rax),%rdx mov -0x70(%rbp),%rax mov -0x1c(%rbp),%ecx movslq %ecx,%rcx shl $0x4,%rcx add %rcx,%rax mov (%rax),%rax mov %rdx,%rsi mov %rax,%rdi callq 10a0 <strcmp@plt> test %eax,%eax jne 13c6 <func0+0x21d> movl $0x1,-0x18(%rbp) jmp 13d2 <func0+0x229> addl $0x1,-0x14(%rbp) mov -0x8(%rbp),%eax cmp %eax,-0x14(%rbp) jl 1386 <func0+0x1dd> cmpl $0x0,-0x18(%rbp) jne 140e <func0+0x265> mov -0x70(%rbp),%rax mov -0x1c(%rbp),%edx movslq %edx,%rdx shl $0x4,%rdx lea (%rax,%rdx,1),%rsi mov -0x10(%rbp),%rcx mov -0x8(%rbp),%eax lea 0x1(%rax),%edx mov %edx,-0x8(%rbp) cltq shl $0x4,%rax add %rax,%rcx mov (%rsi),%rax mov 0x8(%rsi),%rdx mov %rax,(%rcx) mov %rdx,0x8(%rcx) addl $0x1,-0x1c(%rbp) mov -0x68(%rbp),%eax cmp %eax,-0x1c(%rbp) jl 1376 <func0+0x1cd> mov -0x10(%rbp),%rax mov -0x8(%rbp),%rdx leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 70h mov rax, rdi mov r10, rsi mov rsi, rax mov rdi, rdx mov rdi, r10 mov [rbp+var_50], rsi mov [rbp+var_48], rdi mov [rbp+var_60], rdx mov [rbp+var_58], rcx mov [rbp+var_70], r8 mov [rbp+var_68], r9 mov edx, dword ptr [rbp+var_48] mov eax, dword ptr [rbp+var_58] add edx, eax mov eax, dword ptr [rbp+var_68] add eax, edx cdqe shl rax, 4 mov rdi, rax; size call _malloc mov [rbp+var_10], rax mov dword ptr [rbp+var_8], 0 mov [rbp+var_34], 0 jmp loc_12AA loc_120E: mov [rbp+var_30], 0 mov [rbp+var_2C], 0 jmp short loc_1262 loc_121E: mov rax, [rbp+var_10] mov edx, [rbp+var_2C] movsxd rdx, edx shl rdx, 4 add rax, rdx mov rdx, [rax] mov rax, [rbp+var_50] mov ecx, [rbp+var_34] movsxd rcx, ecx shl rcx, 4 add rax, rcx mov rax, [rax] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jnz short loc_125E mov [rbp+var_30], 1 jmp short loc_126A loc_125E: add [rbp+var_2C], 1 loc_1262: mov eax, dword ptr [rbp+var_8] cmp [rbp+var_2C], eax jl short loc_121E loc_126A: cmp [rbp+var_30], 0 jnz short loc_12A6 mov rax, [rbp+var_50] mov edx, [rbp+var_34] movsxd rdx, edx shl rdx, 4 lea rsi, [rax+rdx] mov rcx, [rbp+var_10] mov eax, dword ptr [rbp+var_8] lea edx, [rax+1] mov dword ptr [rbp+var_8], edx cdqe shl rax, 4 add rcx, rax mov rax, [rsi] mov rdx, [rsi+8] mov [rcx], rax mov [rcx+8], rdx loc_12A6: add [rbp+var_34], 1 loc_12AA: mov eax, dword ptr [rbp+var_48] cmp [rbp+var_34], eax jl loc_120E mov [rbp+var_28], 0 jmp loc_135E loc_12C2: mov [rbp+var_24], 0 mov [rbp+var_20], 0 jmp short loc_1316 loc_12D2: mov rax, [rbp+var_10] mov edx, [rbp+var_20] movsxd rdx, edx shl rdx, 4 add rax, rdx mov rdx, [rax] mov rax, [rbp+var_60] mov ecx, [rbp+var_28] movsxd rcx, ecx shl rcx, 4 add rax, rcx mov rax, [rax] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jnz short loc_1312 mov [rbp+var_24], 1 jmp short loc_131E loc_1312: add [rbp+var_20], 1 loc_1316: mov eax, dword ptr [rbp+var_8] cmp [rbp+var_20], eax jl short loc_12D2 loc_131E: cmp [rbp+var_24], 0 jnz short loc_135A mov rax, [rbp+var_60] mov edx, [rbp+var_28] movsxd rdx, edx shl rdx, 4 lea rsi, [rax+rdx] mov rcx, [rbp+var_10] mov eax, dword ptr [rbp+var_8] lea edx, [rax+1] mov dword ptr [rbp+var_8], edx cdqe shl rax, 4 add rcx, rax mov rax, [rsi] mov rdx, [rsi+8] mov [rcx], rax mov [rcx+8], rdx loc_135A: add [rbp+var_28], 1 loc_135E: mov eax, dword ptr [rbp+var_58] cmp [rbp+var_28], eax jl loc_12C2 mov [rbp+var_1C], 0 jmp loc_1412 loc_1376: mov [rbp+var_18], 0 mov [rbp+var_14], 0 jmp short loc_13CA loc_1386: mov rax, [rbp+var_10] mov edx, [rbp+var_14] movsxd rdx, edx shl rdx, 4 add rax, rdx mov rdx, [rax] mov rax, [rbp+var_70] mov ecx, [rbp+var_1C] movsxd rcx, ecx shl rcx, 4 add rax, rcx mov rax, [rax] mov rsi, rdx; s2 mov rdi, rax; s1 call _strcmp test eax, eax jnz short loc_13C6 mov [rbp+var_18], 1 jmp short loc_13D2 loc_13C6: add [rbp+var_14], 1 loc_13CA: mov eax, dword ptr [rbp+var_8] cmp [rbp+var_14], eax jl short loc_1386 loc_13D2: cmp [rbp+var_18], 0 jnz short loc_140E mov rax, [rbp+var_70] mov edx, [rbp+var_1C] movsxd rdx, edx shl rdx, 4 lea rsi, [rax+rdx] mov rcx, [rbp+var_10] mov eax, dword ptr [rbp+var_8] lea edx, [rax+1] mov dword ptr [rbp+var_8], edx cdqe shl rax, 4 add rcx, rax mov rax, [rsi] mov rdx, [rsi+8] mov [rcx], rax mov [rcx+8], rdx loc_140E: add [rbp+var_1C], 1 loc_1412: mov eax, dword ptr [rbp+var_68] cmp [rbp+var_1C], eax jl loc_1376 mov rax, [rbp+var_10] mov rdx, [rbp+var_8] leave retn
const char ** func0(long long a1, int a2, long long a3, int a4, long long a5, int a6) { const char **v6; // rsi int v7; // eax const char **v8; // rcx const char *v9; // rdx const char **v10; // rsi int v11; // eax const char **v12; // rcx const char *v13; // rdx const char **v14; // rsi int v15; // eax const char **v16; // rcx const char *v17; // rdx int i; // [rsp+3Ch] [rbp-34h] int v25; // [rsp+40h] [rbp-30h] int j; // [rsp+44h] [rbp-2Ch] int k; // [rsp+48h] [rbp-28h] int v28; // [rsp+4Ch] [rbp-24h] int m; // [rsp+50h] [rbp-20h] int n; // [rsp+54h] [rbp-1Ch] int v31; // [rsp+58h] [rbp-18h] int ii; // [rsp+5Ch] [rbp-14h] const char **v33; // [rsp+60h] [rbp-10h] int v34; // [rsp+68h] [rbp-8h] v33 = (const char **)malloc(16LL * (a4 + a2 + a6)); v34 = 0; for ( i = 0; i < a2; ++i ) { v25 = 0; for ( j = 0; j < v34; ++j ) { if ( !strcmp(*(const char **)(16LL * i + a1), v33[2 * j]) ) { v25 = 1; break; } } if ( !v25 ) { v6 = (const char **)(a1 + 16LL * i); v7 = v34++; v8 = &v33[2 * v7]; v9 = v6[1]; *v8 = *v6; v8[1] = v9; } } for ( k = 0; k < a4; ++k ) { v28 = 0; for ( m = 0; m < v34; ++m ) { if ( !strcmp(*(const char **)(16LL * k + a3), v33[2 * m]) ) { v28 = 1; break; } } if ( !v28 ) { v10 = (const char **)(a3 + 16LL * k); v11 = v34++; v12 = &v33[2 * v11]; v13 = v10[1]; *v12 = *v10; v12[1] = v13; } } for ( n = 0; n < a6; ++n ) { v31 = 0; for ( ii = 0; ii < v34; ++ii ) { if ( !strcmp(*(const char **)(16LL * n + a5), v33[2 * ii]) ) { v31 = 1; break; } } if ( !v31 ) { v14 = (const char **)(a5 + 16LL * n); v15 = v34++; v16 = &v33[2 * v15]; v17 = v14[1]; *v16 = *v14; v16[1] = v17; } } return v33; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x70 MOV RAX,RDI MOV R10,RSI MOV RSI,RAX MOV RDI,RDX MOV RDI,R10 MOV qword ptr [RBP + -0x50],RSI MOV qword ptr [RBP + -0x48],RDI MOV qword ptr [RBP + -0x60],RDX MOV qword ptr [RBP + -0x58],RCX MOV qword ptr [RBP + -0x70],R8 MOV qword ptr [RBP + -0x68],R9 MOV EDX,dword ptr [RBP + -0x48] MOV EAX,dword ptr [RBP + -0x58] ADD EDX,EAX MOV EAX,dword ptr [RBP + -0x68] ADD EAX,EDX CDQE SHL RAX,0x4 MOV RDI,RAX CALL 0x001010b0 MOV qword ptr [RBP + -0x10],RAX MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x34],0x0 JMP 0x001012aa LAB_0010120e: MOV dword ptr [RBP + -0x30],0x0 MOV dword ptr [RBP + -0x2c],0x0 JMP 0x00101262 LAB_0010121e: MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x2c] MOVSXD RDX,EDX SHL RDX,0x4 ADD RAX,RDX MOV RDX,qword ptr [RAX] MOV RAX,qword ptr [RBP + -0x50] MOV ECX,dword ptr [RBP + -0x34] MOVSXD RCX,ECX SHL RCX,0x4 ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV RSI,RDX MOV RDI,RAX CALL 0x001010a0 TEST EAX,EAX JNZ 0x0010125e MOV dword ptr [RBP + -0x30],0x1 JMP 0x0010126a LAB_0010125e: ADD dword ptr [RBP + -0x2c],0x1 LAB_00101262: MOV EAX,dword ptr [RBP + -0x8] CMP dword ptr [RBP + -0x2c],EAX JL 0x0010121e LAB_0010126a: CMP dword ptr [RBP + -0x30],0x0 JNZ 0x001012a6 MOV RAX,qword ptr [RBP + -0x50] MOV EDX,dword ptr [RBP + -0x34] MOVSXD RDX,EDX SHL RDX,0x4 LEA RSI,[RAX + RDX*0x1] MOV RCX,qword ptr [RBP + -0x10] MOV EAX,dword ptr [RBP + -0x8] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x8],EDX CDQE SHL RAX,0x4 ADD RCX,RAX MOV RAX,qword ptr [RSI] MOV RDX,qword ptr [RSI + 0x8] MOV qword ptr [RCX],RAX MOV qword ptr [RCX + 0x8],RDX LAB_001012a6: ADD dword ptr [RBP + -0x34],0x1 LAB_001012aa: MOV EAX,dword ptr [RBP + -0x48] CMP dword ptr [RBP + -0x34],EAX JL 0x0010120e MOV dword ptr [RBP + -0x28],0x0 JMP 0x0010135e LAB_001012c2: MOV dword ptr [RBP + -0x24],0x0 MOV dword ptr [RBP + -0x20],0x0 JMP 0x00101316 LAB_001012d2: MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x20] MOVSXD RDX,EDX SHL RDX,0x4 ADD RAX,RDX MOV RDX,qword ptr [RAX] MOV RAX,qword ptr [RBP + -0x60] MOV ECX,dword ptr [RBP + -0x28] MOVSXD RCX,ECX SHL RCX,0x4 ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV RSI,RDX MOV RDI,RAX CALL 0x001010a0 TEST EAX,EAX JNZ 0x00101312 MOV dword ptr [RBP + -0x24],0x1 JMP 0x0010131e LAB_00101312: ADD dword ptr [RBP + -0x20],0x1 LAB_00101316: MOV EAX,dword ptr [RBP + -0x8] CMP dword ptr [RBP + -0x20],EAX JL 0x001012d2 LAB_0010131e: CMP dword ptr [RBP + -0x24],0x0 JNZ 0x0010135a MOV RAX,qword ptr [RBP + -0x60] MOV EDX,dword ptr [RBP + -0x28] MOVSXD RDX,EDX SHL RDX,0x4 LEA RSI,[RAX + RDX*0x1] MOV RCX,qword ptr [RBP + -0x10] MOV EAX,dword ptr [RBP + -0x8] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x8],EDX CDQE SHL RAX,0x4 ADD RCX,RAX MOV RAX,qword ptr [RSI] MOV RDX,qword ptr [RSI + 0x8] MOV qword ptr [RCX],RAX MOV qword ptr [RCX + 0x8],RDX LAB_0010135a: ADD dword ptr [RBP + -0x28],0x1 LAB_0010135e: MOV EAX,dword ptr [RBP + -0x58] CMP dword ptr [RBP + -0x28],EAX JL 0x001012c2 MOV dword ptr [RBP + -0x1c],0x0 JMP 0x00101412 LAB_00101376: MOV dword ptr [RBP + -0x18],0x0 MOV dword ptr [RBP + -0x14],0x0 JMP 0x001013ca LAB_00101386: MOV RAX,qword ptr [RBP + -0x10] MOV EDX,dword ptr [RBP + -0x14] MOVSXD RDX,EDX SHL RDX,0x4 ADD RAX,RDX MOV RDX,qword ptr [RAX] MOV RAX,qword ptr [RBP + -0x70] MOV ECX,dword ptr [RBP + -0x1c] MOVSXD RCX,ECX SHL RCX,0x4 ADD RAX,RCX MOV RAX,qword ptr [RAX] MOV RSI,RDX MOV RDI,RAX CALL 0x001010a0 TEST EAX,EAX JNZ 0x001013c6 MOV dword ptr [RBP + -0x18],0x1 JMP 0x001013d2 LAB_001013c6: ADD dword ptr [RBP + -0x14],0x1 LAB_001013ca: MOV EAX,dword ptr [RBP + -0x8] CMP dword ptr [RBP + -0x14],EAX JL 0x00101386 LAB_001013d2: CMP dword ptr [RBP + -0x18],0x0 JNZ 0x0010140e MOV RAX,qword ptr [RBP + -0x70] MOV EDX,dword ptr [RBP + -0x1c] MOVSXD RDX,EDX SHL RDX,0x4 LEA RSI,[RAX + RDX*0x1] MOV RCX,qword ptr [RBP + -0x10] MOV EAX,dword ptr [RBP + -0x8] LEA EDX,[RAX + 0x1] MOV dword ptr [RBP + -0x8],EDX CDQE SHL RAX,0x4 ADD RCX,RAX MOV RAX,qword ptr [RSI] MOV RDX,qword ptr [RSI + 0x8] MOV qword ptr [RCX],RAX MOV qword ptr [RCX + 0x8],RDX LAB_0010140e: ADD dword ptr [RBP + -0x1c],0x1 LAB_00101412: MOV EAX,dword ptr [RBP + -0x68] CMP dword ptr [RBP + -0x1c],EAX JL 0x00101376 MOV RAX,qword ptr [RBP + -0x10] MOV RDX,qword ptr [RBP + -0x8] LEAVE RET
int [16] func0(long param_1,int param_2,long param_3,int param_4,long param_5,int param_6) { int8 *puVar1; int8 uVar2; int auVar3 [16]; bool bVar4; int iVar5; void *pvVar6; int8 *puVar7; int local_3c; int local_34; int local_30; int local_28; int local_24; int local_1c; int local_10; int4 uStack_c; pvVar6 = malloc((long)(param_6 + param_2 + param_4) << 4); local_10 = 0; for (local_3c = 0; local_3c < param_2; local_3c = local_3c + 1) { bVar4 = false; for (local_34 = 0; local_34 < local_10; local_34 = local_34 + 1) { iVar5 = strcmp(*(char **)(param_1 + (long)local_3c * 0x10), *(char **)((long)pvVar6 + (long)local_34 * 0x10)); if (iVar5 == 0) { bVar4 = true; break; } } if (!bVar4) { puVar1 = (int8 *)(param_1 + (long)local_3c * 0x10); puVar7 = (int8 *)((long)pvVar6 + (long)local_10 * 0x10); uVar2 = puVar1[1]; *puVar7 = *puVar1; puVar7[1] = uVar2; local_10 = local_10 + 1; } } for (local_30 = 0; local_30 < param_4; local_30 = local_30 + 1) { bVar4 = false; for (local_28 = 0; local_28 < local_10; local_28 = local_28 + 1) { iVar5 = strcmp(*(char **)(param_3 + (long)local_30 * 0x10), *(char **)((long)pvVar6 + (long)local_28 * 0x10)); if (iVar5 == 0) { bVar4 = true; break; } } if (!bVar4) { puVar1 = (int8 *)(param_3 + (long)local_30 * 0x10); puVar7 = (int8 *)((long)pvVar6 + (long)local_10 * 0x10); uVar2 = puVar1[1]; *puVar7 = *puVar1; puVar7[1] = uVar2; local_10 = local_10 + 1; } } local_24 = 0; do { if (param_6 <= local_24) { auVar3._8_4_ = local_10; auVar3._0_8_ = pvVar6; auVar3._12_4_ = uStack_c; return auVar3; } bVar4 = false; for (local_1c = 0; local_1c < local_10; local_1c = local_1c + 1) { iVar5 = strcmp(*(char **)(param_5 + (long)local_24 * 0x10), *(char **)((long)pvVar6 + (long)local_1c * 0x10)); if (iVar5 == 0) { bVar4 = true; break; } } if (!bVar4) { puVar1 = (int8 *)(param_5 + (long)local_24 * 0x10); puVar7 = (int8 *)((long)pvVar6 + (long)local_10 * 0x10); uVar2 = puVar1[1]; *puVar7 = *puVar1; puVar7[1] = uVar2; local_10 = local_10 + 1; } local_24 = local_24 + 1; } while( true ); }
4,241
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct { char *key; char *value; } KeyValuePair; typedef struct { KeyValuePair *pairs; int size; } Dictionary;
Dictionary func0(Dictionary dict1, Dictionary dict2, Dictionary dict3) { Dictionary result; result.pairs = malloc(sizeof(KeyValuePair) * (dict1.size + dict2.size + dict3.size)); result.size = 0; for (int i = 0; i < dict1.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict1.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict1.pairs[i]; } } for (int i = 0; i < dict2.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict2.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict2.pairs[i]; } } for (int i = 0; i < dict3.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict3.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict3.pairs[i]; } } return result; }
int main() { KeyValuePair pairs1[] = {{"R", "Red"}, {"B", "Black"}, {"P", "Pink"}}; KeyValuePair pairs2[] = {{"G", "Green"}, {"W", "White"}}; KeyValuePair pairs3[] = {{"O", "Orange"}, {"W", "White"}, {"B", "Black"}}; Dictionary dict1 = {pairs1, 3}; Dictionary dict2 = {pairs2, 2}; Dictionary dict3 = {pairs3, 3}; Dictionary result = func0(dict1, dict2, dict3); assert(result.size == 6); KeyValuePair pairs4[] = {{"L", "lavender"}, {"B", "Blue"}}; Dictionary dict4 = {pairs4, 2}; result = func0(dict1, dict2, dict4); assert(result.size == 6); result = func0(dict1, dict4, dict2); assert(result.size == 6); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x38,%rsp mov %rdi,%rbp mov %rsi,%rbx mov %rdx,0x20(%rsp) mov %rcx,0x10(%rsp) mov %r8,0x28(%rsp) mov %r9,0x18(%rsp) lea (%rcx,%rsi,1),%edi add %r9d,%edi movslq %edi,%rdi shl $0x4,%rdi callq 10b0 <malloc@plt> mov %rax,%r14 test %ebx,%ebx jle 1215 <func0+0x6c> mov %rbp,%r15 lea -0x1(%rbx),%eax shl $0x4,%rax lea 0x10(%rbp,%rax,1),%rax mov %rax,(%rsp) mov $0x0,%r12d lea 0x10(%r14),%rax mov %rax,0x8(%rsp) jmpq 134c <func0+0x1a3> mov $0x0,%r12d mov 0x10(%rsp),%rax test %eax,%eax jle 124a <func0+0xa1> mov 0x20(%rsp),%rdx mov %rdx,%r15 lea -0x1(%rax),%eax shl $0x4,%rax lea 0x10(%rax,%rdx,1),%rax mov %rax,(%rsp) lea 0x10(%r14),%rax mov %rax,0x8(%rsp) jmpq 12f5 <func0+0x14c> mov 0x18(%rsp),%rax test %eax,%eax jle 137f <func0+0x1d6> mov 0x28(%rsp),%rcx mov %rcx,%r15 lea -0x1(%rax),%eax shl $0x4,%rax lea 0x10(%rax,%rcx,1),%rax mov %rax,(%rsp) lea 0x10(%r14),%rax mov %rax,0x8(%rsp) jmp 129e <func0+0xf5> movslq %r12d,%rax shl $0x4,%rax movdqu (%r15),%xmm0 movups %xmm0,(%r14,%rax,1) lea 0x1(%r12),%r12d add $0x10,%r15 cmp (%rsp),%r15 je 137f <func0+0x1d6> test %r12d,%r12d jle 127a <func0+0xd1> mov (%r15),%r13 mov %r14,%rbx lea -0x1(%r12),%ebp shl $0x4,%rbp add 0x8(%rsp),%rbp mov (%rbx),%rsi mov %r13,%rdi callq 10a0 <strcmp@plt> test %eax,%eax je 1290 <func0+0xe7> add $0x10,%rbx cmp %rbx,%rbp jne 12b7 <func0+0x10e> jmp 127a <func0+0xd1> movslq %r12d,%rax shl $0x4,%rax movdqu (%r15),%xmm1 movups %xmm1,(%r14,%rax,1) lea 0x1(%r12),%r12d add $0x10,%r15 cmp (%rsp),%r15 je 124a <func0+0xa1> test %r12d,%r12d jle 12d1 <func0+0x128> mov (%r15),%r13 mov %r14,%rbx lea -0x1(%r12),%ebp shl $0x4,%rbp add 0x8(%rsp),%rbp mov (%rbx),%rsi mov %r13,%rdi callq 10a0 <strcmp@plt> test %eax,%eax je 12e7 <func0+0x13e> add $0x10,%rbx cmp %rbp,%rbx jne 130e <func0+0x165> jmp 12d1 <func0+0x128> movslq %r12d,%rax shl $0x4,%rax movdqu (%r15),%xmm2 movups %xmm2,(%r14,%rax,1) lea 0x1(%r12),%r12d add $0x10,%r15 cmp (%rsp),%r15 je 121b <func0+0x72> test %r12d,%r12d jle 1328 <func0+0x17f> mov (%r15),%r13 mov %r14,%rbx lea -0x1(%r12),%ebp shl $0x4,%rbp add 0x8(%rsp),%rbp mov (%rbx),%rsi mov %r13,%rdi callq 10a0 <strcmp@plt> test %eax,%eax je 133e <func0+0x195> add $0x10,%rbx cmp %rbp,%rbx jne 1365 <func0+0x1bc> jmp 1328 <func0+0x17f> mov %r12d,%edx mov %r14,%rax add $0x38,%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, 38h mov rbp, rdi mov rbx, rsi mov [rsp+68h+var_48], rdx mov [rsp+68h+var_58], rcx mov [rsp+68h+var_40], r8 mov [rsp+68h+var_50], r9 lea edi, [rcx+rsi] add edi, r9d movsxd rdi, edi shl rdi, 4 call _malloc mov r14, rax test ebx, ebx jle short loc_1215 mov r15, rbp lea eax, [rbx-1] shl rax, 4 lea rax, [rbp+rax+10h] mov [rsp+68h+var_68], rax mov r12d, 0 lea rax, [r14+10h] mov [rsp+68h+var_60], rax jmp loc_134C loc_1215: mov r12d, 0 loc_121B: mov rax, [rsp+68h+var_58] test eax, eax jle short loc_124A mov rdx, [rsp+68h+var_48] mov r15, rdx lea eax, [rax-1] shl rax, 4 lea rax, [rax+rdx+10h] mov [rsp+68h+var_68], rax lea rax, [r14+10h] mov [rsp+68h+var_60], rax jmp loc_12F5 loc_124A: mov rax, [rsp+68h+var_50] test eax, eax jle loc_137F mov rcx, [rsp+68h+var_40] mov r15, rcx lea eax, [rax-1] shl rax, 4 lea rax, [rax+rcx+10h] mov [rsp+68h+var_68], rax lea rax, [r14+10h] mov [rsp+68h+var_60], rax jmp short loc_129E loc_127A: movsxd rax, r12d shl rax, 4 movdqu xmm0, xmmword ptr [r15] movups xmmword ptr [r14+rax], xmm0 lea r12d, [r12+1] loc_1290: add r15, 10h cmp r15, [rsp+68h+var_68] jz loc_137F loc_129E: test r12d, r12d jle short loc_127A mov r13, [r15] mov rbx, r14 lea ebp, [r12-1] shl rbp, 4 add rbp, [rsp+68h+var_60] loc_12B7: mov rsi, [rbx] mov rdi, r13 call _strcmp test eax, eax jz short loc_1290 add rbx, 10h cmp rbp, rbx jnz short loc_12B7 jmp short loc_127A loc_12D1: movsxd rax, r12d shl rax, 4 movdqu xmm1, xmmword ptr [r15] movups xmmword ptr [r14+rax], xmm1 lea r12d, [r12+1] loc_12E7: add r15, 10h cmp r15, [rsp+68h+var_68] jz loc_124A loc_12F5: test r12d, r12d jle short loc_12D1 mov r13, [r15] mov rbx, r14 lea ebp, [r12-1] shl rbp, 4 add rbp, [rsp+68h+var_60] loc_130E: mov rsi, [rbx] mov rdi, r13 call _strcmp test eax, eax jz short loc_12E7 add rbx, 10h cmp rbx, rbp jnz short loc_130E jmp short loc_12D1 loc_1328: movsxd rax, r12d shl rax, 4 movdqu xmm2, xmmword ptr [r15] movups xmmword ptr [r14+rax], xmm2 lea r12d, [r12+1] loc_133E: add r15, 10h cmp r15, [rsp+68h+var_68] jz loc_121B loc_134C: test r12d, r12d jle short loc_1328 mov r13, [r15] mov rbx, r14 lea ebp, [r12-1] shl rbp, 4 add rbp, [rsp+68h+var_60] loc_1365: mov rsi, [rbx] mov rdi, r13 call _strcmp test eax, eax jz short loc_133E add rbx, 10h cmp rbx, rbp jnz short loc_1365 jmp short loc_1328 loc_137F: mov edx, r12d mov rax, r14 add rsp, 38h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(const __m128i *a1, int a2, const __m128i *a3, int a4, const __m128i *a5, int a6) { long long v6; // r14 const __m128i *v7; // r15 int v8; // r12d const __m128i *v9; // r15 const __m128i *v10; // r15 long long v11; // r13 _QWORD *v12; // rbx long long v13; // r13 _QWORD *v14; // rbx long long v15; // r13 _QWORD *v16; // rbx v6 = malloc(16LL * (a6 + a4 + a2)); if ( a2 <= 0 ) { v8 = 0; } else { v7 = a1; v8 = 0; do { if ( v8 <= 0 ) { LABEL_22: *(__m128i *)(v6 + 16LL * v8++) = _mm_loadu_si128(v7); } else { v15 = v7->m128i_i64[0]; v16 = (_QWORD *)v6; while ( (unsigned int)strcmp(v15, *v16) ) { v16 += 2; if ( v16 == (_QWORD *)(v6 + 16 + 16LL * (unsigned int)(v8 - 1)) ) goto LABEL_22; } } ++v7; } while ( v7 != &a1[(unsigned int)(a2 - 1) + 1] ); } if ( a4 > 0 ) { v9 = a3; do { if ( v8 <= 0 ) { LABEL_15: *(__m128i *)(v6 + 16LL * v8++) = _mm_loadu_si128(v9); } else { v13 = v9->m128i_i64[0]; v14 = (_QWORD *)v6; while ( (unsigned int)strcmp(v13, *v14) ) { v14 += 2; if ( v14 == (_QWORD *)(v6 + 16 + 16LL * (unsigned int)(v8 - 1)) ) goto LABEL_15; } } ++v9; } while ( v9 != &a3[(unsigned int)(a4 - 1) + 1] ); } if ( a6 > 0 ) { v10 = a5; do { if ( v8 <= 0 ) { LABEL_8: *(__m128i *)(v6 + 16LL * v8++) = _mm_loadu_si128(v10); } else { v11 = v10->m128i_i64[0]; v12 = (_QWORD *)v6; while ( (unsigned int)strcmp(v11, *v12) ) { v12 += 2; if ( (_QWORD *)(v6 + 16 + 16LL * (unsigned int)(v8 - 1)) == v12 ) goto LABEL_8; } } ++v10; } while ( v10 != &a5[(unsigned int)(a6 - 1) + 1] ); } return v6; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x38 MOV RBP,RDI MOV RBX,RSI MOV qword ptr [RSP + 0x20],RDX MOV qword ptr [RSP + 0x10],RCX MOV qword ptr [RSP + 0x28],R8 MOV qword ptr [RSP + 0x18],R9 LEA EDI,[RCX + RSI*0x1] ADD EDI,R9D MOVSXD RDI,EDI SHL RDI,0x4 CALL 0x001010b0 MOV R14,RAX TEST EBX,EBX JLE 0x00101215 MOV R15,RBP LEA EAX,[RBX + -0x1] SHL RAX,0x4 LEA RAX,[RBP + RAX*0x1 + 0x10] MOV qword ptr [RSP],RAX MOV R12D,0x0 LEA RAX,[R14 + 0x10] MOV qword ptr [RSP + 0x8],RAX JMP 0x0010134c LAB_00101215: MOV R12D,0x0 LAB_0010121b: MOV RAX,qword ptr [RSP + 0x10] TEST EAX,EAX JLE 0x0010124a MOV RDX,qword ptr [RSP + 0x20] MOV R15,RDX LEA EAX,[RAX + -0x1] SHL RAX,0x4 LEA RAX,[RAX + RDX*0x1 + 0x10] MOV qword ptr [RSP],RAX LEA RAX,[R14 + 0x10] MOV qword ptr [RSP + 0x8],RAX JMP 0x001012f5 LAB_0010124a: MOV RAX,qword ptr [RSP + 0x18] TEST EAX,EAX JLE 0x0010137f MOV RCX,qword ptr [RSP + 0x28] MOV R15,RCX LEA EAX,[RAX + -0x1] SHL RAX,0x4 LEA RAX,[RAX + RCX*0x1 + 0x10] MOV qword ptr [RSP],RAX LEA RAX,[R14 + 0x10] MOV qword ptr [RSP + 0x8],RAX JMP 0x0010129e LAB_0010127a: MOVSXD RAX,R12D SHL RAX,0x4 MOVDQU XMM0,xmmword ptr [R15] MOVUPS xmmword ptr [R14 + RAX*0x1],XMM0 LEA R12D,[R12 + 0x1] LAB_00101290: ADD R15,0x10 CMP R15,qword ptr [RSP] JZ 0x0010137f LAB_0010129e: TEST R12D,R12D JLE 0x0010127a MOV R13,qword ptr [R15] MOV RBX,R14 LEA EBP,[R12 + -0x1] SHL RBP,0x4 ADD RBP,qword ptr [RSP + 0x8] LAB_001012b7: MOV RSI,qword ptr [RBX] MOV RDI,R13 CALL 0x001010a0 TEST EAX,EAX JZ 0x00101290 ADD RBX,0x10 CMP RBP,RBX JNZ 0x001012b7 JMP 0x0010127a LAB_001012d1: MOVSXD RAX,R12D SHL RAX,0x4 MOVDQU XMM1,xmmword ptr [R15] MOVUPS xmmword ptr [R14 + RAX*0x1],XMM1 LEA R12D,[R12 + 0x1] LAB_001012e7: ADD R15,0x10 CMP R15,qword ptr [RSP] JZ 0x0010124a LAB_001012f5: TEST R12D,R12D JLE 0x001012d1 MOV R13,qword ptr [R15] MOV RBX,R14 LEA EBP,[R12 + -0x1] SHL RBP,0x4 ADD RBP,qword ptr [RSP + 0x8] LAB_0010130e: MOV RSI,qword ptr [RBX] MOV RDI,R13 CALL 0x001010a0 TEST EAX,EAX JZ 0x001012e7 ADD RBX,0x10 CMP RBX,RBP JNZ 0x0010130e JMP 0x001012d1 LAB_00101328: MOVSXD RAX,R12D SHL RAX,0x4 MOVDQU XMM2,xmmword ptr [R15] MOVUPS xmmword ptr [R14 + RAX*0x1],XMM2 LEA R12D,[R12 + 0x1] LAB_0010133e: ADD R15,0x10 CMP R15,qword ptr [RSP] JZ 0x0010121b LAB_0010134c: TEST R12D,R12D JLE 0x00101328 MOV R13,qword ptr [R15] MOV RBX,R14 LEA EBP,[R12 + -0x1] SHL RBP,0x4 ADD RBP,qword ptr [RSP + 0x8] LAB_00101365: MOV RSI,qword ptr [RBX] MOV RDI,R13 CALL 0x001010a0 TEST EAX,EAX JZ 0x0010133e ADD RBX,0x10 CMP RBX,RBP JNZ 0x00101365 JMP 0x00101328 LAB_0010137f: MOV EDX,R12D MOV RAX,R14 ADD RSP,0x38 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
int1 [16] func0(int8 *param_1,int param_2,int8 *param_3,int param_4,int8 *param_5, int param_6) { int8 *puVar1; char *pcVar2; int8 uVar3; int iVar4; int8 *puVar5; int iVar6; int1 auVar7 [16]; auVar7._0_8_ = (int8 *)malloc((long)(param_4 + param_2 + param_6) << 4); if (param_2 < 1) { iVar6 = 0; } else { puVar1 = param_1 + (ulong)(param_2 - 1) * 2 + 2; iVar6 = 0; do { if (0 < iVar6) { pcVar2 = (char *)*param_1; puVar5 = auVar7._0_8_; do { iVar4 = strcmp(pcVar2,(char *)*puVar5); if (iVar4 == 0) goto LAB_0010133e; puVar5 = puVar5 + 2; } while (puVar5 != auVar7._0_8_ + (ulong)(iVar6 - 1) * 2 + 2); } uVar3 = param_1[1]; auVar7._0_8_[(long)iVar6 * 2] = *param_1; (auVar7._0_8_ + (long)iVar6 * 2)[1] = uVar3; iVar6 = iVar6 + 1; LAB_0010133e: param_1 = param_1 + 2; } while (param_1 != puVar1); } if (0 < param_4) { puVar1 = param_3 + (ulong)(param_4 - 1) * 2 + 2; do { if (0 < iVar6) { pcVar2 = (char *)*param_3; puVar5 = auVar7._0_8_; do { iVar4 = strcmp(pcVar2,(char *)*puVar5); if (iVar4 == 0) goto LAB_001012e7; puVar5 = puVar5 + 2; } while (puVar5 != auVar7._0_8_ + (ulong)(iVar6 - 1) * 2 + 2); } uVar3 = param_3[1]; auVar7._0_8_[(long)iVar6 * 2] = *param_3; (auVar7._0_8_ + (long)iVar6 * 2)[1] = uVar3; iVar6 = iVar6 + 1; LAB_001012e7: param_3 = param_3 + 2; } while (param_3 != puVar1); } if (0 < param_6) { puVar1 = param_5 + (ulong)(param_6 - 1) * 2 + 2; do { if (0 < iVar6) { pcVar2 = (char *)*param_5; puVar5 = auVar7._0_8_; do { iVar4 = strcmp(pcVar2,(char *)*puVar5); if (iVar4 == 0) goto LAB_00101290; puVar5 = puVar5 + 2; } while (auVar7._0_8_ + (ulong)(iVar6 - 1) * 2 + 2 != puVar5); } uVar3 = param_5[1]; auVar7._0_8_[(long)iVar6 * 2] = *param_5; (auVar7._0_8_ + (long)iVar6 * 2)[1] = uVar3; iVar6 = iVar6 + 1; LAB_00101290: param_5 = param_5 + 2; } while (param_5 != puVar1); } auVar7._8_4_ = iVar6; auVar7._12_4_ = 0; return auVar7; }
4,242
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct { char *key; char *value; } KeyValuePair; typedef struct { KeyValuePair *pairs; int size; } Dictionary;
Dictionary func0(Dictionary dict1, Dictionary dict2, Dictionary dict3) { Dictionary result; result.pairs = malloc(sizeof(KeyValuePair) * (dict1.size + dict2.size + dict3.size)); result.size = 0; for (int i = 0; i < dict1.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict1.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict1.pairs[i]; } } for (int i = 0; i < dict2.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict2.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict2.pairs[i]; } } for (int i = 0; i < dict3.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict3.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict3.pairs[i]; } } return result; }
int main() { KeyValuePair pairs1[] = {{"R", "Red"}, {"B", "Black"}, {"P", "Pink"}}; KeyValuePair pairs2[] = {{"G", "Green"}, {"W", "White"}}; KeyValuePair pairs3[] = {{"O", "Orange"}, {"W", "White"}, {"B", "Black"}}; Dictionary dict1 = {pairs1, 3}; Dictionary dict2 = {pairs2, 2}; Dictionary dict3 = {pairs3, 3}; Dictionary result = func0(dict1, dict2, dict3); assert(result.size == 6); KeyValuePair pairs4[] = {{"L", "lavender"}, {"B", "Blue"}}; Dictionary dict4 = {pairs4, 2}; result = func0(dict1, dict2, dict4); assert(result.size == 6); result = func0(dict1, dict4, dict2); assert(result.size == 6); return 0; }
O2
c
func0: endbr64 push %r15 push %r14 mov %rdi,%r14 lea (%rcx,%rsi,1),%edi push %r13 add %r9d,%edi push %r12 movslq %edi,%rdi push %rbp shl $0x4,%rdi push %rbx mov %rsi,%rbx sub $0x38,%rsp mov %rdx,0x20(%rsp) mov %rcx,0x10(%rsp) mov %r8,0x28(%rsp) mov %r9,0x18(%rsp) callq 10b0 <malloc@plt> mov %rax,%r13 test %ebx,%ebx jle 15d8 <func0+0x218> lea -0x1(%rbx),%eax xor %ebp,%ebp shl $0x4,%rax lea 0x10(%r14,%rax,1),%rax mov %rax,(%rsp) lea 0x10(%r13),%rax mov %rax,0x8(%rsp) nopl 0x0(%rax) test %ebp,%ebp je 1588 <func0+0x1c8> lea -0x1(%rbp),%ebx mov (%r14),%r12 mov %r13,%r15 shl $0x4,%rbx add 0x8(%rsp),%rbx jmp 1455 <func0+0x95> nopl 0x0(%rax) add $0x10,%r15 cmp %rbx,%r15 je 1588 <func0+0x1c8> mov (%r15),%rsi mov %r12,%rdi callq 10a0 <strcmp@plt> test %eax,%eax jne 1448 <func0+0x88> add $0x10,%r14 cmp (%rsp),%r14 jne 1428 <func0+0x68> mov 0x10(%rsp),%rax test %eax,%eax jle 14de <func0+0x11e> mov 0x20(%rsp),%r14 sub $0x1,%eax shl $0x4,%rax lea 0x10(%r14,%rax,1),%rax mov %rax,(%rsp) lea 0x10(%r13),%rax mov %rax,0x8(%rsp) nopl (%rax) test %ebp,%ebp je 15b0 <func0+0x1f0> lea -0x1(%rbp),%ebx mov (%r14),%r12 mov %r13,%r15 shl $0x4,%rbx add 0x8(%rsp),%rbx jmp 14c5 <func0+0x105> nopl 0x0(%rax) add $0x10,%r15 cmp %r15,%rbx je 15b0 <func0+0x1f0> mov (%r15),%rsi mov %r12,%rdi callq 10a0 <strcmp@plt> test %eax,%eax jne 14b8 <func0+0xf8> add $0x10,%r14 cmp %r14,(%rsp) jne 1498 <func0+0xd8> mov 0x18(%rsp),%rax test %eax,%eax jle 1542 <func0+0x182> mov 0x28(%rsp),%r14 sub $0x1,%eax shl $0x4,%rax lea 0x10(%r14,%rax,1),%rax mov %rax,(%rsp) lea 0x10(%r13),%rax mov %rax,0x8(%rsp) nopl (%rax) test %ebp,%ebp je 1560 <func0+0x1a0> lea -0x1(%rbp),%ebx mov (%r14),%r12 mov %r13,%r15 shl $0x4,%rbx add 0x8(%rsp),%rbx jmp 1529 <func0+0x169> add $0x10,%r15 cmp %r15,%rbx je 1560 <func0+0x1a0> mov (%r15),%rsi mov %r12,%rdi callq 10a0 <strcmp@plt> test %eax,%eax jne 1520 <func0+0x160> add $0x10,%r14 cmp (%rsp),%r14 jne 1508 <func0+0x148> add $0x38,%rsp mov %ebp,%edx mov %r13,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw %cs:0x0(%rax,%rax,1) movdqu (%r14),%xmm2 movslq %ebp,%rax add $0x10,%r14 add $0x1,%ebp shl $0x4,%rax movups %xmm2,0x0(%r13,%rax,1) cmp (%rsp),%r14 jne 1508 <func0+0x148> jmp 1542 <func0+0x182> nopl 0x0(%rax) movdqu (%r14),%xmm0 movslq %ebp,%rax add $0x10,%r14 add $0x1,%ebp shl $0x4,%rax movups %xmm0,0x0(%r13,%rax,1) cmp (%rsp),%r14 jne 1428 <func0+0x68> jmpq 146e <func0+0xae> movdqu (%r14),%xmm1 movslq %ebp,%rax add $0x10,%r14 add $0x1,%ebp shl $0x4,%rax movups %xmm1,0x0(%r13,%rax,1) cmp %r14,(%rsp) jne 1498 <func0+0xd8> jmpq 14de <func0+0x11e> xor %ebp,%ebp jmpq 146e <func0+0xae>
func0: endbr64 push r15 push r14 mov r14, rdi lea edi, [rcx+rsi] push r13 add edi, r9d push r12 movsxd rdi, edi push rbp shl rdi, 4 push rbx mov rbx, rsi sub rsp, 38h mov [rsp+68h+var_48], rdx mov [rsp+68h+var_58], rcx mov [rsp+68h+var_40], r8 mov [rsp+68h+var_50], r9 call _malloc mov r13, rax test ebx, ebx jle loc_15D8 lea eax, [rbx-1] xor ebp, ebp shl rax, 4 lea rax, [r14+rax+10h] mov [rsp+68h+var_68], rax lea rax, [r13+10h] mov [rsp+68h+var_60], rax nop dword ptr [rax+00h] loc_1428: test ebp, ebp jz loc_1588 lea ebx, [rbp-1] mov r12, [r14] mov r15, r13 shl rbx, 4 add rbx, [rsp+68h+var_60] jmp short loc_1455 loc_1448: add r15, 10h cmp r15, rbx jz loc_1588 loc_1455: mov rsi, [r15] mov rdi, r12 call _strcmp test eax, eax jnz short loc_1448 add r14, 10h cmp r14, [rsp+68h+var_68] jnz short loc_1428 loc_146E: mov rax, [rsp+68h+var_58] test eax, eax jle short loc_14DE mov r14, [rsp+68h+var_48] sub eax, 1 shl rax, 4 lea rax, [r14+rax+10h] mov [rsp+68h+var_68], rax lea rax, [r13+10h] mov [rsp+68h+var_60], rax nop dword ptr [rax] loc_1498: test ebp, ebp jz loc_15B0 lea ebx, [rbp-1] mov r12, [r14] mov r15, r13 shl rbx, 4 add rbx, [rsp+68h+var_60] jmp short loc_14C5 loc_14B8: add r15, 10h cmp rbx, r15 jz loc_15B0 loc_14C5: mov rsi, [r15] mov rdi, r12 call _strcmp test eax, eax jnz short loc_14B8 add r14, 10h cmp r14, [rsp+68h+var_68] jnz short loc_1498 loc_14DE: mov rax, [rsp+68h+var_50] test eax, eax jle short loc_1542 mov r14, [rsp+68h+var_40] sub eax, 1 shl rax, 4 lea rax, [r14+rax+10h] mov [rsp+68h+var_68], rax lea rax, [r13+10h] mov [rsp+68h+var_60], rax nop dword ptr [rax] loc_1508: test ebp, ebp jz short loc_1560 lea ebx, [rbp-1] mov r12, [r14] mov r15, r13 shl rbx, 4 add rbx, [rsp+68h+var_60] jmp short loc_1529 loc_1520: add r15, 10h cmp rbx, r15 jz short loc_1560 loc_1529: mov rsi, [r15] mov rdi, r12 call _strcmp test eax, eax jnz short loc_1520 add r14, 10h cmp r14, [rsp+68h+var_68] jnz short loc_1508 loc_1542: add rsp, 38h mov edx, ebp mov rax, r13 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1560: movdqu xmm2, xmmword ptr [r14] movsxd rax, ebp add r14, 10h add ebp, 1 shl rax, 4 movups xmmword ptr [r13+rax+0], xmm2 cmp r14, [rsp+68h+var_68] jnz short loc_1508 jmp short loc_1542 loc_1588: movdqu xmm0, xmmword ptr [r14] movsxd rax, ebp add r14, 10h add ebp, 1 shl rax, 4 movups xmmword ptr [r13+rax+0], xmm0 cmp r14, [rsp+68h+var_68] jnz loc_1428 jmp loc_146E loc_15B0: movdqu xmm1, xmmword ptr [r14] movsxd rax, ebp add r14, 10h add ebp, 1 shl rax, 4 movups xmmword ptr [r13+rax+0], xmm1 cmp r14, [rsp+68h+var_68] jnz loc_1498 jmp loc_14DE loc_15D8: xor ebp, ebp jmp loc_146E
long long func0(const __m128i *a1, int a2, const __m128i *a3, int a4, const __m128i *a5, int a6) { const __m128i *v6; // r14 long long v7; // r13 int v8; // ebp long long v9; // r12 _QWORD *v10; // r15 const __m128i *v11; // r14 long long v12; // r12 _QWORD *v13; // r15 const __m128i *v14; // r14 long long v15; // r12 _QWORD *v16; // r15 __m128i v18; // xmm2 long long v19; // rax __m128i v20; // xmm0 long long v21; // rax __m128i v22; // xmm1 long long v23; // rax long long m128i_i64; // [rsp+0h] [rbp-68h] long long v25; // [rsp+0h] [rbp-68h] long long v26; // [rsp+0h] [rbp-68h] v6 = a1; v7 = malloc(16LL * (a6 + a4 + a2)); if ( a2 <= 0 ) { v8 = 0; } else { v8 = 0; m128i_i64 = (long long)a1[(unsigned int)(a2 - 1) + 1].m128i_i64; do { while ( !v8 ) { LABEL_25: v20 = _mm_loadu_si128(v6); v21 = v8; ++v6; ++v8; *(__m128i *)(v7 + 16 * v21) = v20; if ( v6 == (const __m128i *)m128i_i64 ) goto LABEL_8; } v9 = v6->m128i_i64[0]; v10 = (_QWORD *)v7; while ( (unsigned int)strcmp(v9, *v10) ) { v10 += 2; if ( v10 == (_QWORD *)(v7 + 16 + 16LL * (unsigned int)(v8 - 1)) ) goto LABEL_25; } ++v6; } while ( v6 != (const __m128i *)m128i_i64 ); } LABEL_8: if ( a4 > 0 ) { v11 = a3; v25 = (long long)a3[(unsigned int)(a4 - 1) + 1].m128i_i64; do { while ( !v8 ) { LABEL_27: v22 = _mm_loadu_si128(v11); v23 = v8; ++v11; ++v8; *(__m128i *)(v7 + 16 * v23) = v22; if ( v11 == (const __m128i *)v25 ) goto LABEL_15; } v12 = v11->m128i_i64[0]; v13 = (_QWORD *)v7; while ( (unsigned int)strcmp(v12, *v13) ) { v13 += 2; if ( (_QWORD *)(v7 + 16 + 16LL * (unsigned int)(v8 - 1)) == v13 ) goto LABEL_27; } ++v11; } while ( v11 != (const __m128i *)v25 ); } LABEL_15: if ( a6 > 0 ) { v14 = a5; v26 = (long long)a5[(unsigned int)(a6 - 1) + 1].m128i_i64; do { while ( !v8 ) { LABEL_23: v18 = _mm_loadu_si128(v14); v19 = v8; ++v14; ++v8; *(__m128i *)(v7 + 16 * v19) = v18; if ( v14 == (const __m128i *)v26 ) return v7; } v15 = v14->m128i_i64[0]; v16 = (_QWORD *)v7; while ( (unsigned int)strcmp(v15, *v16) ) { v16 += 2; if ( (_QWORD *)(v7 + 16 + 16LL * (unsigned int)(v8 - 1)) == v16 ) goto LABEL_23; } ++v14; } while ( v14 != (const __m128i *)v26 ); } return v7; }
func0: ENDBR64 PUSH R15 PUSH R14 MOV R14,RDI LEA EDI,[RCX + RSI*0x1] PUSH R13 ADD EDI,R9D PUSH R12 MOVSXD RDI,EDI PUSH RBP SHL RDI,0x4 PUSH RBX MOV RBX,RSI SUB RSP,0x38 MOV qword ptr [RSP + 0x20],RDX MOV qword ptr [RSP + 0x10],RCX MOV qword ptr [RSP + 0x28],R8 MOV qword ptr [RSP + 0x18],R9 CALL 0x001010b0 MOV R13,RAX TEST EBX,EBX JLE 0x001015d8 LEA EAX,[RBX + -0x1] XOR EBP,EBP SHL RAX,0x4 LEA RAX,[R14 + RAX*0x1 + 0x10] MOV qword ptr [RSP],RAX LEA RAX,[R13 + 0x10] MOV qword ptr [RSP + 0x8],RAX NOP dword ptr [RAX] LAB_00101428: TEST EBP,EBP JZ 0x00101588 LEA EBX,[RBP + -0x1] MOV R12,qword ptr [R14] MOV R15,R13 SHL RBX,0x4 ADD RBX,qword ptr [RSP + 0x8] JMP 0x00101455 LAB_00101448: ADD R15,0x10 CMP R15,RBX JZ 0x00101588 LAB_00101455: MOV RSI,qword ptr [R15] MOV RDI,R12 CALL 0x001010a0 TEST EAX,EAX JNZ 0x00101448 ADD R14,0x10 CMP R14,qword ptr [RSP] JNZ 0x00101428 LAB_0010146e: MOV RAX,qword ptr [RSP + 0x10] TEST EAX,EAX JLE 0x001014de MOV R14,qword ptr [RSP + 0x20] SUB EAX,0x1 SHL RAX,0x4 LEA RAX,[R14 + RAX*0x1 + 0x10] MOV qword ptr [RSP],RAX LEA RAX,[R13 + 0x10] MOV qword ptr [RSP + 0x8],RAX NOP dword ptr [RAX] LAB_00101498: TEST EBP,EBP JZ 0x001015b0 LEA EBX,[RBP + -0x1] MOV R12,qword ptr [R14] MOV R15,R13 SHL RBX,0x4 ADD RBX,qword ptr [RSP + 0x8] JMP 0x001014c5 LAB_001014b8: ADD R15,0x10 CMP RBX,R15 JZ 0x001015b0 LAB_001014c5: MOV RSI,qword ptr [R15] MOV RDI,R12 CALL 0x001010a0 TEST EAX,EAX JNZ 0x001014b8 ADD R14,0x10 CMP R14,qword ptr [RSP] JNZ 0x00101498 LAB_001014de: MOV RAX,qword ptr [RSP + 0x18] TEST EAX,EAX JLE 0x00101542 MOV R14,qword ptr [RSP + 0x28] SUB EAX,0x1 SHL RAX,0x4 LEA RAX,[R14 + RAX*0x1 + 0x10] MOV qword ptr [RSP],RAX LEA RAX,[R13 + 0x10] MOV qword ptr [RSP + 0x8],RAX NOP dword ptr [RAX] LAB_00101508: TEST EBP,EBP JZ 0x00101560 LEA EBX,[RBP + -0x1] MOV R12,qword ptr [R14] MOV R15,R13 SHL RBX,0x4 ADD RBX,qword ptr [RSP + 0x8] JMP 0x00101529 LAB_00101520: ADD R15,0x10 CMP RBX,R15 JZ 0x00101560 LAB_00101529: MOV RSI,qword ptr [R15] MOV RDI,R12 CALL 0x001010a0 TEST EAX,EAX JNZ 0x00101520 ADD R14,0x10 CMP R14,qword ptr [RSP] JNZ 0x00101508 LAB_00101542: ADD RSP,0x38 MOV EDX,EBP MOV RAX,R13 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101560: MOVDQU XMM2,xmmword ptr [R14] MOVSXD RAX,EBP ADD R14,0x10 ADD EBP,0x1 SHL RAX,0x4 MOVUPS xmmword ptr [R13 + RAX*0x1],XMM2 CMP R14,qword ptr [RSP] JNZ 0x00101508 JMP 0x00101542 LAB_00101588: MOVDQU XMM0,xmmword ptr [R14] MOVSXD RAX,EBP ADD R14,0x10 ADD EBP,0x1 SHL RAX,0x4 MOVUPS xmmword ptr [R13 + RAX*0x1],XMM0 CMP R14,qword ptr [RSP] JNZ 0x00101428 JMP 0x0010146e LAB_001015b0: MOVDQU XMM1,xmmword ptr [R14] MOVSXD RAX,EBP ADD R14,0x10 ADD EBP,0x1 SHL RAX,0x4 MOVUPS xmmword ptr [R13 + RAX*0x1],XMM1 CMP R14,qword ptr [RSP] JNZ 0x00101498 JMP 0x001014de LAB_001015d8: XOR EBP,EBP JMP 0x0010146e
int1 [16] func0(int8 *param_1,int param_2,int8 *param_3,int param_4,int8 *param_5, int param_6) { int8 *puVar1; char *pcVar2; int8 uVar3; int iVar4; long lVar5; int iVar6; int8 *puVar7; int1 auVar8 [16]; auVar8._0_8_ = (int8 *)malloc((long)(param_4 + param_2 + param_6) << 4); if (param_2 < 1) { iVar6 = 0; } else { iVar6 = 0; puVar1 = param_1 + (ulong)(param_2 - 1) * 2 + 2; do { if (iVar6 != 0) { pcVar2 = (char *)*param_1; puVar7 = auVar8._0_8_; do { iVar4 = strcmp(pcVar2,(char *)*puVar7); if (iVar4 == 0) goto joined_r0x0010146c; puVar7 = puVar7 + 2; } while (puVar7 != auVar8._0_8_ + (ulong)(iVar6 - 1) * 2 + 2); } uVar3 = param_1[1]; lVar5 = (long)iVar6; iVar6 = iVar6 + 1; auVar8._0_8_[lVar5 * 2] = *param_1; (auVar8._0_8_ + lVar5 * 2)[1] = uVar3; joined_r0x0010146c: param_1 = param_1 + 2; } while (param_1 != puVar1); } if (0 < param_4) { puVar1 = param_3 + (ulong)(param_4 - 1) * 2 + 2; do { if (iVar6 != 0) { pcVar2 = (char *)*param_3; puVar7 = auVar8._0_8_; do { iVar4 = strcmp(pcVar2,(char *)*puVar7); if (iVar4 == 0) goto joined_r0x001014dc; puVar7 = puVar7 + 2; } while (auVar8._0_8_ + (ulong)(iVar6 - 1) * 2 + 2 != puVar7); } uVar3 = param_3[1]; lVar5 = (long)iVar6; iVar6 = iVar6 + 1; auVar8._0_8_[lVar5 * 2] = *param_3; (auVar8._0_8_ + lVar5 * 2)[1] = uVar3; joined_r0x001014dc: param_3 = param_3 + 2; } while (param_3 != puVar1); } if (0 < param_6) { puVar1 = param_5 + (ulong)(param_6 - 1) * 2 + 2; do { if (iVar6 != 0) { pcVar2 = (char *)*param_5; puVar7 = auVar8._0_8_; do { iVar4 = strcmp(pcVar2,(char *)*puVar7); if (iVar4 == 0) goto joined_r0x00101540; puVar7 = puVar7 + 2; } while (auVar8._0_8_ + (ulong)(iVar6 - 1) * 2 + 2 != puVar7); } uVar3 = param_5[1]; lVar5 = (long)iVar6; iVar6 = iVar6 + 1; auVar8._0_8_[lVar5 * 2] = *param_5; (auVar8._0_8_ + lVar5 * 2)[1] = uVar3; joined_r0x00101540: param_5 = param_5 + 2; } while (param_5 != puVar1); } auVar8._8_4_ = iVar6; auVar8._12_4_ = 0; return auVar8; }
4,243
func0
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> typedef struct { char *key; char *value; } KeyValuePair; typedef struct { KeyValuePair *pairs; int size; } Dictionary;
Dictionary func0(Dictionary dict1, Dictionary dict2, Dictionary dict3) { Dictionary result; result.pairs = malloc(sizeof(KeyValuePair) * (dict1.size + dict2.size + dict3.size)); result.size = 0; for (int i = 0; i < dict1.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict1.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict1.pairs[i]; } } for (int i = 0; i < dict2.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict2.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict2.pairs[i]; } } for (int i = 0; i < dict3.size; i++) { int found = 0; for (int j = 0; j < result.size; j++) { if (strcmp(dict3.pairs[i].key, result.pairs[j].key) == 0) { found = 1; break; } } if (!found) { result.pairs[result.size++] = dict3.pairs[i]; } } return result; }
int main() { KeyValuePair pairs1[] = {{"R", "Red"}, {"B", "Black"}, {"P", "Pink"}}; KeyValuePair pairs2[] = {{"G", "Green"}, {"W", "White"}}; KeyValuePair pairs3[] = {{"O", "Orange"}, {"W", "White"}, {"B", "Black"}}; Dictionary dict1 = {pairs1, 3}; Dictionary dict2 = {pairs2, 2}; Dictionary dict3 = {pairs3, 3}; Dictionary result = func0(dict1, dict2, dict3); assert(result.size == 6); KeyValuePair pairs4[] = {{"L", "lavender"}, {"B", "Blue"}}; Dictionary dict4 = {pairs4, 2}; result = func0(dict1, dict2, dict4); assert(result.size == 6); result = func0(dict1, dict4, dict2); assert(result.size == 6); return 0; }
O3
c
func0: endbr64 push %r15 push %r14 mov %rdi,%r14 lea (%rcx,%rsi,1),%edi push %r13 add %r9d,%edi push %r12 movslq %edi,%rdi push %rbp shl $0x4,%rdi push %rbx mov %rsi,%rbx sub $0x38,%rsp mov %rdx,0x20(%rsp) mov %rcx,0x10(%rsp) mov %r8,0x28(%rsp) mov %r9,0x18(%rsp) callq 10b0 <malloc@plt> mov %rax,%r13 test %ebx,%ebx jle 1608 <func0+0x218> lea -0x1(%rbx),%eax xor %ebp,%ebp shl $0x4,%rax lea 0x10(%r14,%rax,1),%rax mov %rax,(%rsp) lea 0x10(%r13),%rax mov %rax,0x8(%rsp) nopl 0x0(%rax) test %ebp,%ebp je 15b8 <func0+0x1c8> lea -0x1(%rbp),%ebx mov (%r14),%r12 mov %r13,%r15 shl $0x4,%rbx add 0x8(%rsp),%rbx jmp 1485 <func0+0x95> nopl 0x0(%rax) add $0x10,%r15 cmp %r15,%rbx je 15b8 <func0+0x1c8> mov (%r15),%rsi mov %r12,%rdi callq 10a0 <strcmp@plt> test %eax,%eax jne 1478 <func0+0x88> add $0x10,%r14 cmp %r14,(%rsp) jne 1458 <func0+0x68> mov 0x10(%rsp),%rax test %eax,%eax jle 150e <func0+0x11e> mov 0x20(%rsp),%r14 sub $0x1,%eax shl $0x4,%rax lea 0x10(%r14,%rax,1),%rax mov %rax,(%rsp) lea 0x10(%r13),%rax mov %rax,0x8(%rsp) nopl (%rax) test %ebp,%ebp je 15e0 <func0+0x1f0> lea -0x1(%rbp),%ebx mov (%r14),%r12 mov %r13,%r15 shl $0x4,%rbx add 0x8(%rsp),%rbx jmp 14f5 <func0+0x105> nopl 0x0(%rax) add $0x10,%r15 cmp %r15,%rbx je 15e0 <func0+0x1f0> mov (%r15),%rsi mov %r12,%rdi callq 10a0 <strcmp@plt> test %eax,%eax jne 14e8 <func0+0xf8> add $0x10,%r14 cmp (%rsp),%r14 jne 14c8 <func0+0xd8> mov 0x18(%rsp),%rax test %eax,%eax jle 1572 <func0+0x182> mov 0x28(%rsp),%r14 sub $0x1,%eax shl $0x4,%rax lea 0x10(%r14,%rax,1),%rax mov %rax,(%rsp) lea 0x10(%r13),%rax mov %rax,0x8(%rsp) nopl (%rax) test %ebp,%ebp je 1590 <func0+0x1a0> lea -0x1(%rbp),%ebx mov (%r14),%r12 mov %r13,%r15 shl $0x4,%rbx add 0x8(%rsp),%rbx jmp 1559 <func0+0x169> add $0x10,%r15 cmp %r15,%rbx je 1590 <func0+0x1a0> mov (%r15),%rsi mov %r12,%rdi callq 10a0 <strcmp@plt> test %eax,%eax jne 1550 <func0+0x160> add $0x10,%r14 cmp %r14,(%rsp) jne 1538 <func0+0x148> add $0x38,%rsp mov %ebp,%edx mov %r13,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw %cs:0x0(%rax,%rax,1) movdqu (%r14),%xmm2 movslq %ebp,%rax add $0x10,%r14 add $0x1,%ebp shl $0x4,%rax movups %xmm2,0x0(%r13,%rax,1) cmp %r14,(%rsp) jne 1538 <func0+0x148> jmp 1572 <func0+0x182> nopl 0x0(%rax) movdqu (%r14),%xmm0 movslq %ebp,%rax add $0x10,%r14 add $0x1,%ebp shl $0x4,%rax movups %xmm0,0x0(%r13,%rax,1) cmp %r14,(%rsp) jne 1458 <func0+0x68> jmpq 149e <func0+0xae> movdqu (%r14),%xmm1 movslq %ebp,%rax add $0x10,%r14 add $0x1,%ebp shl $0x4,%rax movups %xmm1,0x0(%r13,%rax,1) cmp (%rsp),%r14 jne 14c8 <func0+0xd8> jmpq 150e <func0+0x11e> xor %ebp,%ebp jmpq 149e <func0+0xae>
func0: endbr64 push r15 push r14 mov r14, rdi lea edi, [rcx+rsi] push r13 add edi, r9d push r12 movsxd rdi, edi push rbp shl rdi, 4; size push rbx mov rbx, rsi sub rsp, 38h mov [rsp+68h+var_48], rdx mov [rsp+68h+var_58], rcx mov [rsp+68h+var_40], r8 mov [rsp+68h+var_50], r9 call _malloc mov r13, rax test ebx, ebx jle loc_1616 movsxd rbx, ebx xor r12d, r12d shl rbx, 4 lea rax, [rbx+r14] mov [rsp+68h+var_68], rax nop dword ptr [rax+rax+00h] loc_1460: movsxd rax, r12d mov rbx, rax mov [rsp+68h+var_60], rax shl rbx, 4 add rbx, r13 test r12d, r12d jle loc_15B8 loc_147B: mov rbp, [r14] mov r15, r13 jmp short loc_1495 loc_1488: add r15, 10h cmp r15, rbx jz loc_15B8 loc_1495: mov rsi, [r15]; s2 mov rdi, rbp; s1 call _strcmp test eax, eax jnz short loc_1488 mov rax, [rsp+68h+var_68] add r14, 10h cmp r14, rax jnz short loc_147B loc_14B1: mov rax, [rsp+68h+var_58] test eax, eax jle short loc_1519 movsxd r15, eax mov r14, [rsp+68h+var_48] shl r15, 4 lea rax, [r15+r14] mov [rsp+68h+var_68], rax xchg ax, ax loc_14D0: movsxd rbx, r12d mov dword ptr [rsp+68h+var_60], r12d shl rbx, 4 add rbx, r13 test r12d, r12d jle loc_15E8 loc_14E8: mov rbp, [r14] mov r15, r13 jmp short loc_14FD loc_14F0: add r15, 10h cmp rbx, r15 jz loc_15E8 loc_14FD: mov rsi, [r15]; s2 mov rdi, rbp; s1 call _strcmp test eax, eax jnz short loc_14F0 mov rax, [rsp+68h+var_68] add r14, 10h cmp r14, rax jnz short loc_14E8 loc_1519: mov rax, [rsp+68h+var_50] test eax, eax jle short loc_157A mov r14, [rsp+68h+var_40] cdqe shl rax, 4 add rax, r14 mov [rsp+68h+var_68], rax nop dword ptr [rax+00h] loc_1538: movsxd rbx, r12d mov dword ptr [rsp+68h+var_60], r12d shl rbx, 4 add rbx, r13 test r12d, r12d jle short loc_1590 loc_154C: mov rbp, [r14] mov r15, r13 jmp short loc_1561 loc_1558: add r15, 10h cmp rbx, r15 jz short loc_1590 loc_1561: mov rsi, [r15]; s2 mov rdi, rbp; s1 call _strcmp test eax, eax jnz short loc_1558 add r14, 10h cmp [rsp+68h+var_68], r14 jnz short loc_154C loc_157A: add rsp, 38h mov edx, r12d mov rax, r13 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1590: movsxd r15, dword ptr [rsp+68h+var_60] movdqu xmm2, xmmword ptr [r14] add r12d, 1 add r14, 10h shl r15, 4 movups xmmword ptr [r13+r15+0], xmm2 cmp [rsp+68h+var_68], r14 jnz short loc_1538 jmp short loc_157A loc_15B8: mov r15, [rsp+68h+var_60] movdqu xmm0, xmmword ptr [r14] add r12d, 1 add r14, 10h shl r15, 4 movups xmmword ptr [r13+r15+0], xmm0 cmp [rsp+68h+var_68], r14 jnz loc_1460 jmp loc_14B1 loc_15E8: movsxd rax, dword ptr [rsp+68h+var_60] movdqu xmm1, xmmword ptr [r14] add r14, 10h add r12d, 1 shl rax, 4 movups xmmword ptr [r13+rax+0], xmm1 mov rax, [rsp+68h+var_68] cmp r14, rax jnz loc_14D0 jmp loc_1519 loc_1616: xor r12d, r12d jmp loc_14B1
__m128i * func0(const __m128i *a1, int a2, const __m128i *a3, int a4, const __m128i *a5, int a6) { const __m128i *v6; // r14 __m128i *v7; // r13 int v8; // r12d const char *v9; // rbp const char **v10; // r15 const __m128i *v11; // r14 const char *v12; // rbp const char **v13; // r15 const __m128i *v14; // r14 const char *v15; // rbp const char **v16; // r15 __m128i v18; // xmm2 __m128i v19; // xmm0 __m128i v20; // xmm1 const __m128i *v21; // [rsp+0h] [rbp-68h] const __m128i *v22; // [rsp+0h] [rbp-68h] const __m128i *v23; // [rsp+0h] [rbp-68h] long long v24; // [rsp+8h] [rbp-60h] int v25; // [rsp+8h] [rbp-60h] int v26; // [rsp+8h] [rbp-60h] v6 = a1; v7 = (__m128i *)malloc(16LL * (a6 + a4 + a2)); if ( a2 <= 0 ) { v8 = 0; } else { v8 = 0; v21 = &a1[a2]; while ( 1 ) { v24 = v8; if ( v8 > 0 ) break; LABEL_25: v19 = _mm_loadu_si128(v6); ++v8; ++v6; v7[v24] = v19; if ( v21 == v6 ) goto LABEL_8; } do { v9 = (const char *)v6->m128i_i64[0]; v10 = (const char **)v7; while ( strcmp(v9, *v10) ) { v10 += 2; if ( v10 == (const char **)&v7[v8] ) goto LABEL_25; } ++v6; } while ( v6 != v21 ); } LABEL_8: if ( a4 > 0 ) { v11 = a3; v22 = &a3[a4]; while ( 1 ) { v25 = v8; if ( v8 > 0 ) break; LABEL_27: v20 = _mm_loadu_si128(v11++); ++v8; v7[v25] = v20; if ( v11 == v22 ) goto LABEL_15; } do { v12 = (const char *)v11->m128i_i64[0]; v13 = (const char **)v7; while ( strcmp(v12, *v13) ) { v13 += 2; if ( &v7[v8] == (__m128i *)v13 ) goto LABEL_27; } ++v11; } while ( v11 != v22 ); } LABEL_15: if ( a6 > 0 ) { v14 = a5; v23 = &a5[a6]; while ( 1 ) { v26 = v8; if ( v8 > 0 ) break; LABEL_23: v18 = _mm_loadu_si128(v14); ++v8; ++v14; v7[v26] = v18; if ( v23 == v14 ) return v7; } do { v15 = (const char *)v14->m128i_i64[0]; v16 = (const char **)v7; while ( strcmp(v15, *v16) ) { v16 += 2; if ( &v7[v8] == (__m128i *)v16 ) goto LABEL_23; } ++v14; } while ( v23 != v14 ); } return v7; }
func0: ENDBR64 PUSH R15 PUSH R14 MOV R14,RDI LEA EDI,[RCX + RSI*0x1] PUSH R13 ADD EDI,R9D PUSH R12 MOVSXD RDI,EDI PUSH RBP SHL RDI,0x4 PUSH RBX MOV RBX,RSI SUB RSP,0x38 MOV qword ptr [RSP + 0x20],RDX MOV qword ptr [RSP + 0x10],RCX MOV qword ptr [RSP + 0x28],R8 MOV qword ptr [RSP + 0x18],R9 CALL 0x001010b0 MOV R13,RAX TEST EBX,EBX JLE 0x00101616 MOVSXD RBX,EBX XOR R12D,R12D SHL RBX,0x4 LEA RAX,[RBX + R14*0x1] MOV qword ptr [RSP],RAX NOP dword ptr [RAX + RAX*0x1] LAB_00101460: MOVSXD RAX,R12D MOV RBX,RAX MOV qword ptr [RSP + 0x8],RAX SHL RBX,0x4 ADD RBX,R13 TEST R12D,R12D JLE 0x001015b8 LAB_0010147b: MOV RBP,qword ptr [R14] MOV R15,R13 JMP 0x00101495 LAB_00101488: ADD R15,0x10 CMP R15,RBX JZ 0x001015b8 LAB_00101495: MOV RSI,qword ptr [R15] MOV RDI,RBP CALL 0x001010a0 TEST EAX,EAX JNZ 0x00101488 MOV RAX,qword ptr [RSP] ADD R14,0x10 CMP R14,RAX JNZ 0x0010147b LAB_001014b1: MOV RAX,qword ptr [RSP + 0x10] TEST EAX,EAX JLE 0x00101519 MOVSXD R15,EAX MOV R14,qword ptr [RSP + 0x20] SHL R15,0x4 LEA RAX,[R15 + R14*0x1] MOV qword ptr [RSP],RAX NOP LAB_001014d0: MOVSXD RBX,R12D MOV dword ptr [RSP + 0x8],R12D SHL RBX,0x4 ADD RBX,R13 TEST R12D,R12D JLE 0x001015e8 LAB_001014e8: MOV RBP,qword ptr [R14] MOV R15,R13 JMP 0x001014fd LAB_001014f0: ADD R15,0x10 CMP RBX,R15 JZ 0x001015e8 LAB_001014fd: MOV RSI,qword ptr [R15] MOV RDI,RBP CALL 0x001010a0 TEST EAX,EAX JNZ 0x001014f0 MOV RAX,qword ptr [RSP] ADD R14,0x10 CMP R14,RAX JNZ 0x001014e8 LAB_00101519: MOV RAX,qword ptr [RSP + 0x18] TEST EAX,EAX JLE 0x0010157a MOV R14,qword ptr [RSP + 0x28] CDQE SHL RAX,0x4 ADD RAX,R14 MOV qword ptr [RSP],RAX NOP dword ptr [RAX] LAB_00101538: MOVSXD RBX,R12D MOV dword ptr [RSP + 0x8],R12D SHL RBX,0x4 ADD RBX,R13 TEST R12D,R12D JLE 0x00101590 LAB_0010154c: MOV RBP,qword ptr [R14] MOV R15,R13 JMP 0x00101561 LAB_00101558: ADD R15,0x10 CMP RBX,R15 JZ 0x00101590 LAB_00101561: MOV RSI,qword ptr [R15] MOV RDI,RBP CALL 0x001010a0 TEST EAX,EAX JNZ 0x00101558 ADD R14,0x10 CMP qword ptr [RSP],R14 JNZ 0x0010154c LAB_0010157a: ADD RSP,0x38 MOV EDX,R12D MOV RAX,R13 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101590: MOVSXD R15,dword ptr [RSP + 0x8] MOVDQU XMM2,xmmword ptr [R14] ADD R12D,0x1 ADD R14,0x10 SHL R15,0x4 MOVUPS xmmword ptr [R13 + R15*0x1],XMM2 CMP qword ptr [RSP],R14 JNZ 0x00101538 JMP 0x0010157a LAB_001015b8: MOV R15,qword ptr [RSP + 0x8] MOVDQU XMM0,xmmword ptr [R14] ADD R12D,0x1 ADD R14,0x10 SHL R15,0x4 MOVUPS xmmword ptr [R13 + R15*0x1],XMM0 CMP qword ptr [RSP],R14 JNZ 0x00101460 JMP 0x001014b1 LAB_001015e8: MOVSXD RAX,dword ptr [RSP + 0x8] MOVDQU XMM1,xmmword ptr [R14] ADD R14,0x10 ADD R12D,0x1 SHL RAX,0x4 MOVUPS xmmword ptr [R13 + RAX*0x1],XMM1 MOV RAX,qword ptr [RSP] CMP R14,RAX JNZ 0x001014d0 JMP 0x00101519 LAB_00101616: XOR R12D,R12D JMP 0x001014b1
int [16] func0(int8 *param_1,int param_2,int8 *param_3,int param_4,int8 *param_5, int param_6) { char *pcVar1; int8 uVar2; int8 uVar3; int iVar4; long lVar5; int8 *puVar6; int iVar7; int8 *puVar8; int auVar9 [16]; auVar9._0_8_ = (int8 *)malloc((long)(param_4 + param_2 + param_6) << 4); if (param_2 < 1) { iVar7 = 0; } else { iVar7 = 0; puVar6 = param_1 + (long)param_2 * 2; do { lVar5 = (long)iVar7; if (0 < iVar7) { do { pcVar1 = (char *)*param_1; puVar8 = auVar9._0_8_; while (iVar4 = strcmp(pcVar1,(char *)*puVar8), iVar4 != 0) { puVar8 = puVar8 + 2; if (puVar8 == auVar9._0_8_ + lVar5 * 2) goto LAB_001015b8; } param_1 = param_1 + 2; } while (param_1 != puVar6); break; } LAB_001015b8: uVar2 = *param_1; uVar3 = param_1[1]; iVar7 = iVar7 + 1; param_1 = param_1 + 2; auVar9._0_8_[lVar5 * 2] = uVar2; (auVar9._0_8_ + lVar5 * 2)[1] = uVar3; } while (puVar6 != param_1); } if (0 < param_4) { puVar6 = param_3 + (long)param_4 * 2; do { if (0 < iVar7) { do { pcVar1 = (char *)*param_3; puVar8 = auVar9._0_8_; while (iVar4 = strcmp(pcVar1,(char *)*puVar8), iVar4 != 0) { puVar8 = puVar8 + 2; if (auVar9._0_8_ + (long)iVar7 * 2 == puVar8) goto LAB_001015e8; } param_3 = param_3 + 2; } while (param_3 != puVar6); break; } LAB_001015e8: lVar5 = (long)iVar7; uVar2 = *param_3; uVar3 = param_3[1]; param_3 = param_3 + 2; iVar7 = iVar7 + 1; auVar9._0_8_[lVar5 * 2] = uVar2; (auVar9._0_8_ + lVar5 * 2)[1] = uVar3; } while (param_3 != puVar6); } if (0 < param_6) { puVar6 = param_5 + (long)param_6 * 2; do { if (0 < iVar7) { do { pcVar1 = (char *)*param_5; puVar8 = auVar9._0_8_; while (iVar4 = strcmp(pcVar1,(char *)*puVar8), iVar4 != 0) { puVar8 = puVar8 + 2; if (auVar9._0_8_ + (long)iVar7 * 2 == puVar8) goto LAB_00101590; } param_5 = param_5 + 2; } while (puVar6 != param_5); break; } LAB_00101590: lVar5 = (long)iVar7; uVar2 = *param_5; uVar3 = param_5[1]; iVar7 = iVar7 + 1; param_5 = param_5 + 2; auVar9._0_8_[lVar5 * 2] = uVar2; (auVar9._0_8_ + lVar5 * 2)[1] = uVar3; } while (puVar6 != param_5); } auVar9._8_4_ = iVar7; auVar9._12_4_ = 0; return auVar9; }
4,244
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int key; int value; } Pair; int cmpfunc(const void *a, const void *b) { return ((Pair *)a)->key - ((Pair *)b)->key; }
Pair* func0(int arr[], int size, int *count) { qsort(arr, size, sizeof(int), cmpfunc); Pair *frequency = malloc(sizeof(Pair) * size); int current = arr[0]; int freq = 1; int index = 0; for (int i = 1; i < size; i++) { if (arr[i] == current) { freq++; } else { frequency[index].key = current; frequency[index].value = freq; index++; current = arr[i]; freq = 1; } } frequency[index].key = current; frequency[index].value = freq; index++; *count = index; return frequency; }
int main() { int count1, count2, count3; int arr1[] = {10,10,10,10,20,20,20,20,40,40,50,50,30}; Pair *result1 = func0(arr1, 13, &count1); assert(count1 == 5); assert(result1[0].key == 10 && result1[0].value == 4); assert(result1[1].key == 20 && result1[1].value == 4); assert(result1[2].key == 30 && result1[2].value == 1); assert(result1[3].key == 40 && result1[3].value == 2); assert(result1[4].key == 50 && result1[4].value == 2); free(result1); int arr2[] = {1,2,3,4,3,2,4,1,3,1,4}; Pair *result2 = func0(arr2, 11, &count2); assert(count2 == 4); assert(result2[0].key == 1 && result2[0].value == 3); assert(result2[1].key == 2 && result2[1].value == 2); assert(result2[2].key == 3 && result2[2].value == 3); assert(result2[3].key == 4 && result2[3].value == 3); free(result2); int arr3[] = {5,6,7,4,9,10,4,5,6,7,9,5}; Pair *result3 = func0(arr3, 12, &count3); assert(count3 == 6); assert(result3[0].key == 4 && result3[0].value == 2); assert(result3[1].key == 5 && result3[1].value == 3); assert(result3[2].key == 6 && result3[2].value == 2); assert(result3[3].key == 7 && result3[3].value == 2); assert(result3[4].key == 9 && result3[4].value == 2); assert(result3[5].key == 10 && result3[5].value == 1); free(result3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x40,%rsp mov %rdi,-0x28(%rbp) mov %esi,-0x2c(%rbp) mov %rdx,-0x38(%rbp) mov -0x2c(%rbp),%eax movslq %eax,%rsi mov -0x28(%rbp),%rax lea -0x4a(%rip),%rcx mov $0x4,%edx mov %rax,%rdi callq 10a0 <qsort@plt> mov -0x2c(%rbp),%eax cltq shl $0x3,%rax mov %rax,%rdi callq 10d0 <malloc@plt> mov %rax,-0x8(%rbp) mov -0x28(%rbp),%rax mov (%rax),%eax mov %eax,-0x18(%rbp) movl $0x1,-0x14(%rbp) movl $0x0,-0x10(%rbp) movl $0x1,-0xc(%rbp) jmp 12d1 <func0+0xe6> mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%eax cmp %eax,-0x18(%rbp) jne 1276 <func0+0x8b> addl $0x1,-0x14(%rbp) jmp 12cd <func0+0xe2> mov -0x10(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x8(%rbp),%rax add %rax,%rdx mov -0x18(%rbp),%eax mov %eax,(%rdx) mov -0x10(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x8(%rbp),%rax add %rax,%rdx mov -0x14(%rbp),%eax mov %eax,0x4(%rdx) addl $0x1,-0x10(%rbp) mov -0xc(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x28(%rbp),%rax add %rdx,%rax mov (%rax),%eax mov %eax,-0x18(%rbp) movl $0x1,-0x14(%rbp) addl $0x1,-0xc(%rbp) mov -0xc(%rbp),%eax cmp -0x2c(%rbp),%eax jl 1255 <func0+0x6a> mov -0x10(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x8(%rbp),%rax add %rax,%rdx mov -0x18(%rbp),%eax mov %eax,(%rdx) mov -0x10(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x8(%rbp),%rax add %rax,%rdx mov -0x14(%rbp),%eax mov %eax,0x4(%rdx) addl $0x1,-0x10(%rbp) mov -0x38(%rbp),%rax mov -0x10(%rbp),%edx mov %edx,(%rax) mov -0x8(%rbp),%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+base], rdi mov [rbp+var_2C], esi mov [rbp+var_38], rdx mov eax, [rbp+var_2C] movsxd rsi, eax; nmemb mov rax, [rbp+base] lea rdx, cmpfunc mov rcx, rdx; compar mov edx, 4; size mov rdi, rax; base call _qsort mov eax, [rbp+var_2C] cdqe shl rax, 3 mov rdi, rax; size call _malloc mov [rbp+var_8], rax mov rax, [rbp+base] mov eax, [rax] mov [rbp+var_18], eax mov [rbp+var_14], 1 mov [rbp+var_10], 0 mov [rbp+var_C], 1 jmp short loc_12D4 loc_1258: mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+base] add rax, rdx mov eax, [rax] cmp [rbp+var_18], eax jnz short loc_1279 add [rbp+var_14], 1 jmp short loc_12D0 loc_1279: mov eax, [rbp+var_10] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_8] add rdx, rax mov eax, [rbp+var_18] mov [rdx], eax mov eax, [rbp+var_10] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_8] add rdx, rax mov eax, [rbp+var_14] mov [rdx+4], eax add [rbp+var_10], 1 mov eax, [rbp+var_C] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+base] add rax, rdx mov eax, [rax] mov [rbp+var_18], eax mov [rbp+var_14], 1 loc_12D0: add [rbp+var_C], 1 loc_12D4: mov eax, [rbp+var_C] cmp eax, [rbp+var_2C] jl loc_1258 mov eax, [rbp+var_10] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_8] add rdx, rax mov eax, [rbp+var_18] mov [rdx], eax mov eax, [rbp+var_10] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_8] add rdx, rax mov eax, [rbp+var_14] mov [rdx+4], eax add [rbp+var_10], 1 mov rax, [rbp+var_38] mov edx, [rbp+var_10] mov [rax], edx mov rax, [rbp+var_8] leave retn
_DWORD * func0(int *a1, int a2, _DWORD *a3) { int v5; // [rsp+28h] [rbp-18h] int v6; // [rsp+2Ch] [rbp-14h] int v7; // [rsp+30h] [rbp-10h] int i; // [rsp+34h] [rbp-Ch] _DWORD *v9; // [rsp+38h] [rbp-8h] qsort(a1, a2, 4uLL, cmpfunc); v9 = malloc(8LL * a2); v5 = *a1; v6 = 1; v7 = 0; for ( i = 1; i < a2; ++i ) { if ( v5 == a1[i] ) { ++v6; } else { v9[2 * v7] = v5; v9[2 * v7++ + 1] = v6; v5 = a1[i]; v6 = 1; } } v9[2 * v7] = v5; v9[2 * v7 + 1] = v6; *a3 = v7 + 1; return v9; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x2c],ESI MOV qword ptr [RBP + -0x38],RDX MOV EAX,dword ptr [RBP + -0x2c] MOVSXD RSI,EAX MOV RAX,qword ptr [RBP + -0x28] LEA RDX,[0x1011c9] MOV RCX,RDX MOV EDX,0x4 MOV RDI,RAX CALL 0x001010a0 MOV EAX,dword ptr [RBP + -0x2c] CDQE SHL RAX,0x3 MOV RDI,RAX CALL 0x001010d0 MOV qword ptr [RBP + -0x8],RAX MOV RAX,qword ptr [RBP + -0x28] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x18],EAX MOV dword ptr [RBP + -0x14],0x1 MOV dword ptr [RBP + -0x10],0x0 MOV dword ptr [RBP + -0xc],0x1 JMP 0x001012d4 LAB_00101258: MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x18],EAX JNZ 0x00101279 ADD dword ptr [RBP + -0x14],0x1 JMP 0x001012d0 LAB_00101279: MOV EAX,dword ptr [RBP + -0x10] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x8] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x18] MOV dword ptr [RDX],EAX MOV EAX,dword ptr [RBP + -0x10] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x8] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x14] MOV dword ptr [RDX + 0x4],EAX ADD dword ptr [RBP + -0x10],0x1 MOV EAX,dword ptr [RBP + -0xc] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x28] ADD RAX,RDX MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x18],EAX MOV dword ptr [RBP + -0x14],0x1 LAB_001012d0: ADD dword ptr [RBP + -0xc],0x1 LAB_001012d4: MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x2c] JL 0x00101258 MOV EAX,dword ptr [RBP + -0x10] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x8] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x18] MOV dword ptr [RDX],EAX MOV EAX,dword ptr [RBP + -0x10] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x8] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x14] MOV dword ptr [RDX + 0x4],EAX ADD dword ptr [RBP + -0x10],0x1 MOV RAX,qword ptr [RBP + -0x38] MOV EDX,dword ptr [RBP + -0x10] MOV dword ptr [RAX],EDX MOV RAX,qword ptr [RBP + -0x8] LEAVE RET
void * func0(int *param_1,int param_2,int *param_3) { void *pvVar1; int local_20; int local_1c; int local_18; int local_14; qsort(param_1,(long)param_2,4,cmpfunc); pvVar1 = malloc((long)param_2 << 3); local_20 = *param_1; local_1c = 1; local_18 = 0; for (local_14 = 1; local_14 < param_2; local_14 = local_14 + 1) { if (local_20 == param_1[local_14]) { local_1c = local_1c + 1; } else { *(int *)((long)local_18 * 8 + (long)pvVar1) = local_20; *(int *)((long)pvVar1 + (long)local_18 * 8 + 4) = local_1c; local_18 = local_18 + 1; local_20 = param_1[local_14]; local_1c = 1; } } *(int *)((long)local_18 * 8 + (long)pvVar1) = local_20; *(int *)((long)pvVar1 + (long)local_18 * 8 + 4) = local_1c; *param_3 = local_18 + 1; return pvVar1; }
4,245
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int key; int value; } Pair; int cmpfunc(const void *a, const void *b) { return ((Pair *)a)->key - ((Pair *)b)->key; }
Pair* func0(int arr[], int size, int *count) { qsort(arr, size, sizeof(int), cmpfunc); Pair *frequency = malloc(sizeof(Pair) * size); int current = arr[0]; int freq = 1; int index = 0; for (int i = 1; i < size; i++) { if (arr[i] == current) { freq++; } else { frequency[index].key = current; frequency[index].value = freq; index++; current = arr[i]; freq = 1; } } frequency[index].key = current; frequency[index].value = freq; index++; *count = index; return frequency; }
int main() { int count1, count2, count3; int arr1[] = {10,10,10,10,20,20,20,20,40,40,50,50,30}; Pair *result1 = func0(arr1, 13, &count1); assert(count1 == 5); assert(result1[0].key == 10 && result1[0].value == 4); assert(result1[1].key == 20 && result1[1].value == 4); assert(result1[2].key == 30 && result1[2].value == 1); assert(result1[3].key == 40 && result1[3].value == 2); assert(result1[4].key == 50 && result1[4].value == 2); free(result1); int arr2[] = {1,2,3,4,3,2,4,1,3,1,4}; Pair *result2 = func0(arr2, 11, &count2); assert(count2 == 4); assert(result2[0].key == 1 && result2[0].value == 3); assert(result2[1].key == 2 && result2[1].value == 2); assert(result2[2].key == 3 && result2[2].value == 3); assert(result2[3].key == 4 && result2[3].value == 3); free(result2); int arr3[] = {5,6,7,4,9,10,4,5,6,7,9,5}; Pair *result3 = func0(arr3, 12, &count3); assert(count3 == 6); assert(result3[0].key == 4 && result3[0].value == 2); assert(result3[1].key == 5 && result3[1].value == 3); assert(result3[2].key == 6 && result3[2].value == 2); assert(result3[3].key == 7 && result3[3].value == 2); assert(result3[4].key == 9 && result3[4].value == 2); assert(result3[5].key == 10 && result3[5].value == 1); free(result3); return 0; }
O1
c
func0: endbr64 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbp mov %esi,%r12d mov %rdx,%rbx movslq %esi,%r13 lea -0x2a(%rip),%rcx mov $0x4,%edx mov %r13,%rsi callq 10a0 <qsort@plt> lea 0x0(,%r13,8),%rdi callq 10d0 <malloc@plt> mov 0x0(%rbp),%edi cmp $0x1,%r12d jle 125f <func0+0x8d> lea 0x4(%rbp),%rdx lea -0x2(%r12),%ecx lea 0x8(%rbp,%rcx,4),%r10 mov $0x0,%esi mov $0x1,%r8d jmp 1253 <func0+0x81> movslq %esi,%r9 lea (%rax,%r9,8),%r9 mov %edi,(%r9) mov %r8d,0x4(%r9) add $0x1,%esi mov %ecx,%edi mov $0x1,%r8d add $0x4,%rdx cmp %r10,%rdx je 126a <func0+0x98> mov (%rdx),%ecx cmp %edi,%ecx jne 1231 <func0+0x5f> add $0x1,%r8d jmp 124a <func0+0x78> mov $0x0,%esi mov $0x1,%r8d movslq %esi,%rdx lea (%rax,%rdx,8),%rdx mov %edi,(%rdx) mov %r8d,0x4(%rdx) add $0x1,%esi mov %esi,(%rbx) add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov rbp, rdi mov r12d, esi mov rbx, rdx movsxd r13, esi lea rcx, cmpfunc mov edx, 4 mov rsi, r13 call _qsort lea rdi, ds:0[r13*8] call _malloc mov r9, rax mov esi, [rbp+0] cmp r12d, 1 jle short loc_125F lea rax, [rbp+4] lea edx, [r12-2] lea r10, [rbp+rdx*4+8] mov ecx, 0 mov edi, 1 jmp short loc_123F loc_1233: add edi, 1 loc_1236: add rax, 4 cmp rax, r10 jz short loc_1269 loc_123F: mov edx, [rax] cmp edx, esi jz short loc_1233 movsxd r8, ecx lea r8, [r9+r8*8] mov [r8], esi mov [r8+4], edi add ecx, 1 mov esi, edx mov edi, 1 jmp short loc_1236 loc_125F: mov ecx, 0 mov edi, 1 loc_1269: movsxd rax, ecx lea rax, [r9+rax*8] mov [rax], esi mov [rax+4], edi add ecx, 1 mov [rbx], ecx mov rax, r9 add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
long long func0(int *a1, int a2, _DWORD *a3) { long long v6; // r9 int v7; // esi int *v8; // rax int v9; // ecx int v10; // edi int v11; // edx _DWORD *v12; // r8 _DWORD *v13; // rax qsort(a1, a2, 4LL, cmpfunc); v6 = malloc(8LL * a2); v7 = *a1; if ( a2 <= 1 ) { v9 = 0; v10 = 1; } else { v8 = a1 + 1; v9 = 0; v10 = 1; do { v11 = *v8; if ( *v8 == v7 ) { ++v10; } else { v12 = (_DWORD *)(v6 + 8LL * v9); *v12 = v7; v12[1] = v10; ++v9; v7 = v11; v10 = 1; } ++v8; } while ( v8 != &a1[a2 - 2 + 2] ); } v13 = (_DWORD *)(v6 + 8LL * v9); *v13 = v7; v13[1] = v10; *a3 = v9 + 1; return v6; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBP,RDI MOV R12D,ESI MOV RBX,RDX MOVSXD R13,ESI LEA RCX,[0x1011c9] MOV EDX,0x4 MOV RSI,R13 CALL 0x001010a0 LEA RDI,[R13*0x8] CALL 0x001010d0 MOV R9,RAX MOV ESI,dword ptr [RBP] CMP R12D,0x1 JLE 0x0010125f LEA RAX,[RBP + 0x4] LEA EDX,[R12 + -0x2] LEA R10,[RBP + RDX*0x4 + 0x8] MOV ECX,0x0 MOV EDI,0x1 JMP 0x0010123f LAB_00101233: ADD EDI,0x1 LAB_00101236: ADD RAX,0x4 CMP RAX,R10 JZ 0x00101269 LAB_0010123f: MOV EDX,dword ptr [RAX] CMP EDX,ESI JZ 0x00101233 MOVSXD R8,ECX LEA R8,[R9 + R8*0x8] MOV dword ptr [R8],ESI MOV dword ptr [R8 + 0x4],EDI ADD ECX,0x1 MOV ESI,EDX MOV EDI,0x1 JMP 0x00101236 LAB_0010125f: MOV ECX,0x0 MOV EDI,0x1 LAB_00101269: MOVSXD RAX,ECX LEA RAX,[R9 + RAX*0x8] MOV dword ptr [RAX],ESI MOV dword ptr [RAX + 0x4],EDI ADD ECX,0x1 MOV dword ptr [RBX],ECX MOV RAX,R9 ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
void * func0(int *param_1,int param_2,int *param_3) { int *piVar1; int iVar2; void *pvVar3; int *piVar4; int iVar5; int iVar6; int iVar7; qsort(param_1,(long)param_2,4,cmpfunc); pvVar3 = malloc((long)param_2 * 8); iVar6 = *param_1; if (param_2 < 2) { iVar5 = 0; iVar7 = 1; } else { piVar4 = param_1 + 1; iVar5 = 0; iVar7 = 1; do { iVar2 = *piVar4; if (iVar2 == iVar6) { iVar7 = iVar7 + 1; } else { piVar1 = (int *)((long)pvVar3 + (long)iVar5 * 8); *piVar1 = iVar6; piVar1[1] = iVar7; iVar5 = iVar5 + 1; iVar7 = 1; iVar6 = iVar2; } piVar4 = piVar4 + 1; } while (piVar4 != param_1 + (ulong)(param_2 - 2) + 2); } piVar4 = (int *)((long)pvVar3 + (long)iVar5 * 8); *piVar4 = iVar6; piVar4[1] = iVar7; *param_3 = iVar5 + 1; return pvVar3; }
4,246
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int key; int value; } Pair; int cmpfunc(const void *a, const void *b) { return ((Pair *)a)->key - ((Pair *)b)->key; }
Pair* func0(int arr[], int size, int *count) { qsort(arr, size, sizeof(int), cmpfunc); Pair *frequency = malloc(sizeof(Pair) * size); int current = arr[0]; int freq = 1; int index = 0; for (int i = 1; i < size; i++) { if (arr[i] == current) { freq++; } else { frequency[index].key = current; frequency[index].value = freq; index++; current = arr[i]; freq = 1; } } frequency[index].key = current; frequency[index].value = freq; index++; *count = index; return frequency; }
int main() { int count1, count2, count3; int arr1[] = {10,10,10,10,20,20,20,20,40,40,50,50,30}; Pair *result1 = func0(arr1, 13, &count1); assert(count1 == 5); assert(result1[0].key == 10 && result1[0].value == 4); assert(result1[1].key == 20 && result1[1].value == 4); assert(result1[2].key == 30 && result1[2].value == 1); assert(result1[3].key == 40 && result1[3].value == 2); assert(result1[4].key == 50 && result1[4].value == 2); free(result1); int arr2[] = {1,2,3,4,3,2,4,1,3,1,4}; Pair *result2 = func0(arr2, 11, &count2); assert(count2 == 4); assert(result2[0].key == 1 && result2[0].value == 3); assert(result2[1].key == 2 && result2[1].value == 2); assert(result2[2].key == 3 && result2[2].value == 3); assert(result2[3].key == 4 && result2[3].value == 3); free(result2); int arr3[] = {5,6,7,4,9,10,4,5,6,7,9,5}; Pair *result3 = func0(arr3, 12, &count3); assert(count3 == 6); assert(result3[0].key == 4 && result3[0].value == 2); assert(result3[1].key == 5 && result3[1].value == 3); assert(result3[2].key == 6 && result3[2].value == 2); assert(result3[3].key == 7 && result3[3].value == 2); assert(result3[4].key == 9 && result3[4].value == 2); assert(result3[5].key == 10 && result3[5].value == 1); free(result3); return 0; }
O2
c
func0: endbr64 push %r13 lea -0x1d(%rip),%rcx mov %rdi,%r13 push %r12 movslq %esi,%r12 push %rbp mov %r12,%rsi push %rbx mov %rdx,%rbx mov $0x4,%edx sub $0x8,%rsp callq 10a0 <qsort@plt> lea 0x0(,%r12,8),%rdi callq 10d0 <malloc@plt> mov 0x0(%r13),%r9d cmp $0x1,%r12d jle 17b0 <func0+0xc0> lea -0x2(%r12),%edx lea 0x4(%r13),%rcx xor %esi,%esi mov $0x1,%r10d lea 0x8(%r13,%rdx,4),%rbp jmp 1774 <func0+0x84> nopw 0x0(%rax,%rax,1) add $0x4,%rcx mov %r9d,(%rdi) mov %r8d,%r9d mov %r10d,0x4(%rdi) lea 0x8(%rax,%rdx,1),%rdi mov $0x1,%r10d lea 0x2(%rsi),%edx mov %r11d,%esi cmp %rbp,%rcx je 179b <func0+0xab> movslq %esi,%rdx mov (%rcx),%r8d lea 0x1(%rsi),%r11d shl $0x3,%rdx lea (%rax,%rdx,1),%rdi cmp %r9d,%r8d jne 1750 <func0+0x60> add $0x4,%rcx add $0x1,%r10d mov %r11d,%edx cmp %rbp,%rcx jne 1774 <func0+0x84> mov %r9d,(%rdi) mov %r10d,0x4(%rdi) mov %edx,(%rbx) add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq mov %rax,%rdi mov $0x1,%edx mov $0x1,%r10d jmp 179b <func0+0xab>
func0: endbr64 push r13 lea rcx, cmpfunc push r12 mov r12, rdi push rbp movsxd rbp, esi push rbx mov rsi, rbp mov rbx, rdx mov edx, 4 sub rsp, 8 call _qsort lea rdi, ds:0[rbp*8] call _malloc mov ecx, [r12] mov r9, rax cmp ebp, 1 jle short loc_17A8 lea edx, [rbp-2] lea rax, [r12+4] xor esi, esi mov edi, 1 lea r10, [r12+rdx*4+8] jmp short loc_1771 loc_1750: movsxd r8, esi add rax, 4 add esi, 1 lea r8, [r9+r8*8] mov [r8], ecx mov ecx, edx mov [r8+4], edi mov edi, 1 cmp r10, rax jz short loc_1783 loc_1771: mov edx, [rax] cmp edx, ecx jnz short loc_1750 add rax, 4 add edi, 1 cmp r10, rax jnz short loc_1771 loc_1783: movsxd rax, esi add esi, 1 lea rax, [r9+rax*8] loc_178D: mov [rax], ecx mov [rax+4], edi mov rax, r9 mov [rbx], esi add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_17A8: mov esi, 1 mov edi, 1 jmp short loc_178D
_DWORD * func0(int *a1, int a2, int *a3) { _DWORD *v6; // rax int v7; // ecx _DWORD *v8; // r9 int *v9; // rax int v10; // esi int v11; // edi long long v12; // r10 long long v13; // r8 _DWORD *v14; // r8 int v15; // edx long long v16; // rax int v17; // esi _DWORD *result; // rax qsort(a1, a2, 4LL, cmpfunc); v6 = (_DWORD *)malloc(8LL * a2); v7 = *a1; v8 = v6; if ( a2 <= 1 ) { v17 = 1; v11 = 1; } else { v9 = a1 + 1; v10 = 0; v11 = 1; v12 = (long long)&a1[a2 - 2 + 2]; do { while ( 1 ) { v15 = *v9; if ( *v9 == v7 ) break; v13 = v10; ++v9; ++v10; v14 = &v8[2 * v13]; *v14 = v7; v7 = v15; v14[1] = v11; v11 = 1; if ( (int *)v12 == v9 ) goto LABEL_6; } ++v9; ++v11; } while ( (int *)v12 != v9 ); LABEL_6: v16 = v10; v17 = v10 + 1; v6 = &v8[2 * v16]; } *v6 = v7; v6[1] = v11; result = v8; *a3 = v17; return result; }
func0: ENDBR64 PUSH R13 LEA RCX,[0x1016e0] PUSH R12 MOV R12,RDI PUSH RBP MOVSXD RBP,ESI PUSH RBX MOV RSI,RBP MOV RBX,RDX MOV EDX,0x4 SUB RSP,0x8 CALL 0x001010a0 LEA RDI,[RBP*0x8] CALL 0x001010d0 MOV ECX,dword ptr [R12] MOV R9,RAX CMP EBP,0x1 JLE 0x001017a8 LEA EDX,[RBP + -0x2] LEA RAX,[R12 + 0x4] XOR ESI,ESI MOV EDI,0x1 LEA R10,[R12 + RDX*0x4 + 0x8] JMP 0x00101771 LAB_00101750: MOVSXD R8,ESI ADD RAX,0x4 ADD ESI,0x1 LEA R8,[R9 + R8*0x8] MOV dword ptr [R8],ECX MOV ECX,EDX MOV dword ptr [R8 + 0x4],EDI MOV EDI,0x1 CMP R10,RAX JZ 0x00101783 LAB_00101771: MOV EDX,dword ptr [RAX] CMP EDX,ECX JNZ 0x00101750 ADD RAX,0x4 ADD EDI,0x1 CMP R10,RAX JNZ 0x00101771 LAB_00101783: MOVSXD RAX,ESI ADD ESI,0x1 LEA RAX,[R9 + RAX*0x8] LAB_0010178d: MOV dword ptr [RAX],ECX MOV dword ptr [RAX + 0x4],EDI MOV RAX,R9 MOV dword ptr [RBX],ESI ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_001017a8: MOV ESI,0x1 MOV EDI,0x1 JMP 0x0010178d
int * func0(int *param_1,int param_2,int *param_3) { int *piVar1; int *piVar2; int iVar3; int iVar4; int iVar5; int iVar6; long lVar7; qsort(param_1,(long)param_2,4,cmpfunc); piVar1 = (int *)malloc((long)param_2 * 8); iVar3 = *param_1; if (param_2 < 2) { iVar5 = 1; iVar6 = 1; piVar2 = piVar1; } else { piVar2 = param_1 + 1; iVar4 = 0; iVar6 = 1; iVar5 = iVar3; do { while( true ) { iVar3 = *piVar2; if (iVar3 != iVar5) break; piVar2 = piVar2 + 1; iVar6 = iVar6 + 1; iVar3 = iVar5; if (param_1 + (ulong)(param_2 - 2) + 2 == piVar2) goto LAB_00101783; } lVar7 = (long)iVar4; piVar2 = piVar2 + 1; iVar4 = iVar4 + 1; piVar1[lVar7 * 2] = iVar5; (piVar1 + lVar7 * 2)[1] = iVar6; iVar6 = 1; iVar5 = iVar3; } while (param_1 + (ulong)(param_2 - 2) + 2 != piVar2); LAB_00101783: iVar5 = iVar4 + 1; piVar2 = piVar1 + (long)iVar4 * 2; } *piVar2 = iVar3; piVar2[1] = iVar6; *param_3 = iVar5; return piVar1; }
4,247
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int key; int value; } Pair; int cmpfunc(const void *a, const void *b) { return ((Pair *)a)->key - ((Pair *)b)->key; }
Pair* func0(int arr[], int size, int *count) { qsort(arr, size, sizeof(int), cmpfunc); Pair *frequency = malloc(sizeof(Pair) * size); int current = arr[0]; int freq = 1; int index = 0; for (int i = 1; i < size; i++) { if (arr[i] == current) { freq++; } else { frequency[index].key = current; frequency[index].value = freq; index++; current = arr[i]; freq = 1; } } frequency[index].key = current; frequency[index].value = freq; index++; *count = index; return frequency; }
int main() { int count1, count2, count3; int arr1[] = {10,10,10,10,20,20,20,20,40,40,50,50,30}; Pair *result1 = func0(arr1, 13, &count1); assert(count1 == 5); assert(result1[0].key == 10 && result1[0].value == 4); assert(result1[1].key == 20 && result1[1].value == 4); assert(result1[2].key == 30 && result1[2].value == 1); assert(result1[3].key == 40 && result1[3].value == 2); assert(result1[4].key == 50 && result1[4].value == 2); free(result1); int arr2[] = {1,2,3,4,3,2,4,1,3,1,4}; Pair *result2 = func0(arr2, 11, &count2); assert(count2 == 4); assert(result2[0].key == 1 && result2[0].value == 3); assert(result2[1].key == 2 && result2[1].value == 2); assert(result2[2].key == 3 && result2[2].value == 3); assert(result2[3].key == 4 && result2[3].value == 3); free(result2); int arr3[] = {5,6,7,4,9,10,4,5,6,7,9,5}; Pair *result3 = func0(arr3, 12, &count3); assert(count3 == 6); assert(result3[0].key == 4 && result3[0].value == 2); assert(result3[1].key == 5 && result3[1].value == 3); assert(result3[2].key == 6 && result3[2].value == 2); assert(result3[3].key == 7 && result3[3].value == 2); assert(result3[4].key == 9 && result3[4].value == 2); assert(result3[5].key == 10 && result3[5].value == 1); free(result3); return 0; }
O3
c
func0: endbr64 push %r13 lea -0x1d(%rip),%rcx mov %rdi,%r13 push %r12 movslq %esi,%r12 push %rbp mov %r12,%rsi push %rbx mov %rdx,%rbx mov $0x4,%edx sub $0x8,%rsp callq 10a0 <qsort@plt> lea 0x0(,%r12,8),%rdi callq 10d0 <malloc@plt> mov 0x0(%r13),%r9d cmp $0x1,%r12d jle 1738 <func0+0xc8> lea -0x2(%r12),%ecx lea 0x4(%r13),%rdx xor %r11d,%r11d xor %ebp,%ebp lea 0x8(%r13,%rcx,4),%r12 mov $0x1,%r10d mov $0x1,%r8d nopl (%rax) mov (%rdx),%esi lea 0x0(,%rbp,8),%rdi lea (%rax,%rdi,1),%rcx cmp %r9d,%esi je 1720 <func0+0xb0> add $0x4,%rdx mov %r9d,(%rcx) add $0x2,%r11d mov %r10d,0x4(%rcx) lea 0x8(%rax,%rdi,1),%rcx cmp %r12,%rdx je 1748 <func0+0xd8> mov %r8d,%r11d movslq %r8d,%rbp mov %esi,%r9d mov $0x1,%r10d add $0x1,%r8d jmp 16d8 <func0+0x68> nopl 0x0(%rax) add $0x4,%rdx add $0x1,%r10d cmp %r12,%rdx jne 16d8 <func0+0x68> mov %r8d,%r11d mov %r9d,%esi jmp 174e <func0+0xde> nopl (%rax) mov %rax,%rcx mov %r9d,%esi mov $0x1,%r11d nopl 0x0(%rax) mov $0x1,%r10d mov %esi,(%rcx) mov %r10d,0x4(%rcx) mov %r11d,(%rbx) add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
func0: endbr64 push r13 lea rcx, cmpfunc; compar push r12 mov r12, rdi push rbp movsxd rbp, esi push rbx mov rsi, rbp; nmemb mov rbx, rdx mov edx, 4; size sub rsp, 8 call _qsort lea rdi, ds:0[rbp*8]; size call _malloc mov edx, [r12] mov r9, rax cmp ebp, 1 jle short loc_1728 lea ecx, [rbp-2] lea rax, [r12+4] xor esi, esi mov edi, 1 lea r10, [r12+rcx*4+8] jmp short loc_16EF loc_16D0: movsxd r8, esi add rax, 4 add esi, 1 lea r8, [r9+r8*8] mov [r8+4], edi mov edi, 1 mov [r8], ecx cmp rax, r10 jz short loc_1703 loc_16EF: mov ecx, edx mov edx, [rax] cmp edx, ecx jnz short loc_16D0 add rax, 4 add edi, 1 cmp rax, r10 jnz short loc_16EF loc_1703: movsxd rax, esi add esi, 1 lea rax, [r9+rax*8] loc_170D: mov [rax], edx mov [rax+4], edi mov rax, r9 mov [rbx], esi add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_1728: mov esi, 1 mov edi, 1 jmp short loc_170D
_DWORD * func0(int *a1, int a2, int *a3) { _DWORD *v6; // rax int v7; // edx _DWORD *v8; // r9 int *v9; // rax int v10; // esi int v11; // edi long long v12; // r10 long long v13; // r8 _DWORD *v14; // r8 int v15; // ecx long long v16; // rax int v17; // esi _DWORD *result; // rax qsort(a1, a2, 4uLL, cmpfunc); v6 = malloc(8LL * a2); v7 = *a1; v8 = v6; if ( a2 <= 1 ) { v17 = 1; v11 = 1; } else { v9 = a1 + 1; v10 = 0; v11 = 1; v12 = (long long)&a1[a2 - 2 + 2]; do { while ( 1 ) { v15 = v7; v7 = *v9; if ( *v9 == v15 ) break; v13 = v10; ++v9; ++v10; v14 = &v8[2 * v13]; v14[1] = v11; v11 = 1; *v14 = v15; if ( v9 == (int *)v12 ) goto LABEL_6; } ++v9; ++v11; } while ( v9 != (int *)v12 ); LABEL_6: v16 = v10; v17 = v10 + 1; v6 = &v8[2 * v16]; } *v6 = v7; v6[1] = v11; result = v8; *a3 = v17; return result; }
func0: ENDBR64 PUSH R13 LEA RCX,[0x101660] PUSH R12 MOV R12,RDI PUSH RBP MOVSXD RBP,ESI PUSH RBX MOV RSI,RBP MOV RBX,RDX MOV EDX,0x4 SUB RSP,0x8 CALL 0x001010a0 LEA RDI,[RBP*0x8] CALL 0x001010d0 MOV EDX,dword ptr [R12] MOV R9,RAX CMP EBP,0x1 JLE 0x00101728 LEA ECX,[RBP + -0x2] LEA RAX,[R12 + 0x4] XOR ESI,ESI MOV EDI,0x1 LEA R10,[R12 + RCX*0x4 + 0x8] JMP 0x001016ef LAB_001016d0: MOVSXD R8,ESI ADD RAX,0x4 ADD ESI,0x1 LEA R8,[R9 + R8*0x8] MOV dword ptr [R8 + 0x4],EDI MOV EDI,0x1 MOV dword ptr [R8],ECX CMP RAX,R10 JZ 0x00101703 LAB_001016ef: MOV ECX,EDX MOV EDX,dword ptr [RAX] CMP EDX,ECX JNZ 0x001016d0 ADD RAX,0x4 ADD EDI,0x1 CMP RAX,R10 JNZ 0x001016ef LAB_00101703: MOVSXD RAX,ESI ADD ESI,0x1 LEA RAX,[R9 + RAX*0x8] LAB_0010170d: MOV dword ptr [RAX],EDX MOV dword ptr [RAX + 0x4],EDI MOV RAX,R9 MOV dword ptr [RBX],ESI ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_00101728: MOV ESI,0x1 MOV EDI,0x1 JMP 0x0010170d
int * func0(int *param_1,int param_2,int *param_3) { int *piVar1; int *piVar2; int iVar3; int iVar4; int iVar5; int iVar6; long lVar7; qsort(param_1,(long)param_2,4,cmpfunc); piVar1 = (int *)malloc((long)param_2 * 8); iVar3 = *param_1; if (param_2 < 2) { iVar5 = 1; iVar6 = 1; piVar2 = piVar1; } else { piVar2 = param_1 + 1; iVar4 = 0; iVar6 = 1; iVar5 = iVar3; do { while (iVar3 = *piVar2, iVar3 == iVar5) { piVar2 = piVar2 + 1; iVar6 = iVar6 + 1; iVar5 = iVar3; if (piVar2 == param_1 + (ulong)(param_2 - 2) + 2) goto LAB_00101703; } lVar7 = (long)iVar4; piVar2 = piVar2 + 1; iVar4 = iVar4 + 1; (piVar1 + lVar7 * 2)[1] = iVar6; iVar6 = 1; piVar1[lVar7 * 2] = iVar5; iVar5 = iVar3; } while (piVar2 != param_1 + (ulong)(param_2 - 2) + 2); LAB_00101703: iVar5 = iVar4 + 1; piVar2 = piVar1 + (long)iVar4 * 2; } *piVar2 = iVar3; piVar2[1] = iVar6; *param_3 = iVar5; return piVar1; }
4,248
func0
#include <assert.h>
int func0(int N) { return N - 1; }
int main() { assert(func0(11) == 10); assert(func0(7) == 6); assert(func0(12) == 11); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov -0x4(%rbp),%eax sub $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 pop rbp retn
long long func0(int a1) { return (unsigned int)(a1 - 1); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV EAX,dword ptr [RBP + -0x4] SUB EAX,0x1 POP RBP RET
int func0(int param_1) { return param_1 + -1; }
4,249
func0
#include <assert.h>
int func0(int N) { return N - 1; }
int main() { assert(func0(11) == 10); assert(func0(7) == 6); assert(func0(12) == 11); return 0; }
O1
c
func0: endbr64 lea -0x1(%rdi),%eax retq
func0: endbr64 lea eax, [rdi-1] retn
long long func0(int a1) { return (unsigned int)(a1 - 1); }
func0: ENDBR64 LEA EAX,[RDI + -0x1] RET
int func0(int param_1) { return param_1 + -1; }
4,250
func0
#include <assert.h>
int func0(int N) { return N - 1; }
int main() { assert(func0(11) == 10); assert(func0(7) == 6); assert(func0(12) == 11); return 0; }
O2
c
func0: endbr64 lea -0x1(%rdi),%eax retq nopl 0x0(%rax,%rax,1)
func0: endbr64 lea eax, [rdi-1] retn
long long func0(int a1) { return (unsigned int)(a1 - 1); }
func0: ENDBR64 LEA EAX,[RDI + -0x1] RET
int func0(int param_1) { return param_1 + -1; }
4,251
func0
#include <assert.h>
int func0(int N) { return N - 1; }
int main() { assert(func0(11) == 10); assert(func0(7) == 6); assert(func0(12) == 11); return 0; }
O3
c
func0: endbr64 lea -0x1(%rdi),%eax retq nopl 0x0(%rax,%rax,1)
func0: endbr64 lea eax, [rdi-1] retn
long long func0(int a1) { return (unsigned int)(a1 - 1); }
func0: ENDBR64 LEA EAX,[RDI + -0x1] RET
int func0(int param_1) { return param_1 + -1; }
4,252
func0
#include <assert.h> #include <string.h>
int func0(char *list1[], int num_elements) { int max = strlen(list1[0]); for (int i = 0; i < num_elements; i++) { if (strlen(list1[i]) > max) { max = strlen(list1[i]); } } return max; }
int main() { char *list1[] = {"python", "PHP", "bigdata"}; char *list2[] = {"a", "ab", "abc"}; char *list3[] = {"small", "big", "tall"}; assert(func0(list1, 3) == 7); assert(func0(list2, 3) == 3); assert(func0(list3, 3) == 5); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov -0x18(%rbp),%rax mov (%rax),%rax mov %rax,%rdi callq 1070 <strlen@plt> mov %eax,-0x8(%rbp) movl $0x0,-0x4(%rbp) jmp 1207 <func0+0x7e> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov %rax,%rdi callq 1070 <strlen@plt> mov -0x8(%rbp),%edx movslq %edx,%rdx cmp %rdx,%rax jbe 1203 <func0+0x7a> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov %rax,%rdi callq 1070 <strlen@plt> mov %eax,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11b7 <func0+0x2e> mov -0x8(%rbp),%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov rax, [rbp+var_18] mov rax, [rax] mov rdi, rax; s call _strlen mov [rbp+var_8], eax mov [rbp+var_4], 0 jmp short loc_1207 loc_11B7: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] add rax, rdx mov rax, [rax] mov rdi, rax; s call _strlen mov edx, [rbp+var_8] movsxd rdx, edx cmp rdx, rax jnb short loc_1203 mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] add rax, rdx mov rax, [rax] mov rdi, rax; s call _strlen mov [rbp+var_8], eax loc_1203: add [rbp+var_4], 1 loc_1207: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_11B7 mov eax, [rbp+var_8] leave retn
long long func0(const char **a1, int a2) { unsigned int v3; // [rsp+18h] [rbp-8h] int i; // [rsp+1Ch] [rbp-4h] v3 = strlen(*a1); for ( i = 0; i < a2; ++i ) { if ( (int)v3 < strlen(a1[i]) ) v3 = strlen(a1[i]); } return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV RAX,qword ptr [RBP + -0x18] MOV RAX,qword ptr [RAX] MOV RDI,RAX CALL 0x00101070 MOV dword ptr [RBP + -0x8],EAX MOV dword ptr [RBP + -0x4],0x0 JMP 0x00101207 LAB_001011b7: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV RDI,RAX CALL 0x00101070 MOV EDX,dword ptr [RBP + -0x8] MOVSXD RDX,EDX CMP RDX,RAX JNC 0x00101203 MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV RDI,RAX CALL 0x00101070 MOV dword ptr [RBP + -0x8],EAX LAB_00101203: ADD dword ptr [RBP + -0x4],0x1 LAB_00101207: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011b7 MOV EAX,dword ptr [RBP + -0x8] LEAVE RET
int func0(int8 *param_1,int param_2) { size_t sVar1; int local_10; int local_c; sVar1 = strlen((char *)*param_1); local_10 = (int)sVar1; for (local_c = 0; local_c < param_2; local_c = local_c + 1) { sVar1 = strlen((char *)param_1[local_c]); if ((ulong)(long)local_10 < sVar1) { sVar1 = strlen((char *)param_1[local_c]); local_10 = (int)sVar1; } } return local_10; }
4,253
func0
#include <assert.h> #include <string.h>
int func0(char *list1[], int num_elements) { int max = strlen(list1[0]); for (int i = 0; i < num_elements; i++) { if (strlen(list1[i]) > max) { max = strlen(list1[i]); } } return max; }
int main() { char *list1[] = {"python", "PHP", "bigdata"}; char *list2[] = {"a", "ab", "abc"}; char *list3[] = {"small", "big", "tall"}; assert(func0(list1, 3) == 7); assert(func0(list2, 3) == 3); assert(func0(list3, 3) == 5); return 0; }
O1
c
func0: endbr64 mov %rdi,%r9 mov (%rdi),%rdi mov $0xffffffffffffffff,%rcx mov $0x0,%eax repnz scas %es:(%rdi),%al not %rcx lea -0x1(%rcx),%r8d test %esi,%esi jle 11c5 <func0+0x5c> mov %r9,%rdx lea -0x1(%rsi),%eax lea 0x8(%r9,%rax,8),%r10 mov $0xffffffffffffffff,%r9 mov $0x0,%eax mov (%rdx),%rdi mov %r9,%rcx repnz scas %es:(%rdi),%al not %rcx sub $0x1,%rcx movslq %r8d,%rsi cmp %rsi,%rcx cmova %ecx,%r8d add $0x8,%rdx cmp %r10,%rdx jne 11a3 <func0+0x3a> mov %r8d,%eax retq
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov r12, rdi mov r13d, esi mov rdi, [rdi] call _strlen mov ebp, eax test r13d, r13d jle short loc_11D2 mov rbx, r12 lea eax, [r13-1] lea r12, [r12+rax*8+8] loc_11B8: mov rdi, [rbx] call _strlen movsxd rdx, ebp cmp rax, rdx cmova ebp, eax add rbx, 8 cmp rbx, r12 jnz short loc_11B8 loc_11D2: mov eax, ebp add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
long long func0(_QWORD *a1, int a2) { unsigned int v2; // ebp _QWORD *v3; // rbx unsigned long long v4; // rax v2 = strlen(*a1); if ( a2 > 0 ) { v3 = a1; do { v4 = strlen(*v3); if ( v4 > (int)v2 ) v2 = v4; ++v3; } while ( v3 != &a1[(unsigned int)(a2 - 1) + 1] ); } return v2; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R12,RDI MOV R13D,ESI MOV RDI,qword ptr [RDI] CALL 0x00101070 MOV EBP,EAX TEST R13D,R13D JLE 0x001011d2 MOV RBX,R12 LEA EAX,[R13 + -0x1] LEA R12,[R12 + RAX*0x8 + 0x8] LAB_001011b8: MOV RDI,qword ptr [RBX] CALL 0x00101070 MOVSXD RDX,EBP CMP RAX,RDX CMOVA EBP,EAX ADD RBX,0x8 CMP RBX,R12 JNZ 0x001011b8 LAB_001011d2: MOV EAX,EBP ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
ulong func0(int8 *param_1,int param_2) { int8 *puVar1; size_t sVar2; ulong uVar3; sVar2 = strlen((char *)*param_1); uVar3 = sVar2 & 0xffffffff; if (0 < param_2) { puVar1 = param_1 + (ulong)(param_2 - 1) + 1; do { sVar2 = strlen((char *)*param_1); if ((ulong)(long)(int)uVar3 < sVar2) { uVar3 = sVar2 & 0xffffffff; } param_1 = param_1 + 1; } while (param_1 != puVar1); } return uVar3; }
4,254
func0
#include <assert.h> #include <string.h>
int func0(char *list1[], int num_elements) { int max = strlen(list1[0]); for (int i = 0; i < num_elements; i++) { if (strlen(list1[i]) > max) { max = strlen(list1[i]); } } return max; }
int main() { char *list1[] = {"python", "PHP", "bigdata"}; char *list2[] = {"a", "ab", "abc"}; char *list3[] = {"small", "big", "tall"}; assert(func0(list1, 3) == 7); assert(func0(list2, 3) == 3); assert(func0(list3, 3) == 5); return 0; }
O2
c
func0: endbr64 push %r12 push %rbp mov %esi,%ebp push %rbx mov %rdi,%rbx mov (%rdi),%rdi callq 1070 <strlen@plt> mov %eax,%r12d test %ebp,%ebp jle 131b <func0+0x4b> add $0x8,%rbx lea -0x1(%rbp),%edx lea (%rbx,%rdx,8),%rbp jmp 130c <func0+0x3c> nopl 0x0(%rax) mov (%rbx),%rdi add $0x8,%rbx callq 1070 <strlen@plt> movslq %r12d,%rdx cmp %rax,%rdx cmovb %eax,%r12d cmp %rbp,%rbx jne 1300 <func0+0x30> mov %r12d,%eax pop %rbx pop %rbp pop %r12 retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 push r12 push rbp mov ebp, esi push rbx mov rbx, rdi mov rdi, [rdi] call _strlen mov r12d, eax test ebp, ebp jle short loc_131B add rbx, 8 lea edx, [rbp-1] lea rbp, [rbx+rdx*8] jmp short loc_130C loc_1300: mov rdi, [rbx] add rbx, 8 call _strlen loc_130C: movsxd rdx, r12d cmp rdx, rax cmovb r12d, eax cmp rbx, rbp jnz short loc_1300 loc_131B: mov eax, r12d pop rbx pop rbp pop r12 retn
long long func0(_QWORD *a1, int a2) { unsigned long long v2; // rax unsigned int v3; // r12d long long *v4; // rbx long long v5; // rbp long long v6; // rdi v2 = strlen(*a1); v3 = v2; if ( a2 > 0 ) { v4 = a1 + 1; v5 = (long long)&a1[(unsigned int)(a2 - 1) + 1]; while ( 1 ) { if ( (int)v3 < v2 ) v3 = v2; if ( v4 == (long long *)v5 ) break; v6 = *v4++; v2 = strlen(v6); } } return v3; }
func0: ENDBR64 PUSH R12 PUSH RBP MOV EBP,ESI PUSH RBX MOV RBX,RDI MOV RDI,qword ptr [RDI] CALL 0x00101070 MOV R12D,EAX TEST EBP,EBP JLE 0x0010131b ADD RBX,0x8 LEA EDX,[RBP + -0x1] LEA RBP,[RBX + RDX*0x8] JMP 0x0010130c LAB_00101300: MOV RDI,qword ptr [RBX] ADD RBX,0x8 CALL 0x00101070 LAB_0010130c: MOVSXD RDX,R12D CMP RDX,RAX CMOVC R12D,EAX CMP RBX,RBP JNZ 0x00101300 LAB_0010131b: MOV EAX,R12D POP RBX POP RBP POP R12 RET
ulong func0(int8 *param_1,int param_2) { int8 *puVar1; char *__s; ulong uVar2; ulong uVar3; uVar2 = strlen((char *)*param_1); uVar3 = uVar2 & 0xffffffff; if (0 < param_2) { param_1 = param_1 + 1; puVar1 = param_1 + (param_2 - 1); while( true ) { if ((ulong)(long)(int)uVar3 < uVar2) { uVar3 = uVar2 & 0xffffffff; } if (param_1 == puVar1) break; __s = (char *)*param_1; param_1 = param_1 + 1; uVar2 = strlen(__s); } } return uVar3; }
4,255
func0
#include <assert.h> #include <string.h>
int func0(char *list1[], int num_elements) { int max = strlen(list1[0]); for (int i = 0; i < num_elements; i++) { if (strlen(list1[i]) > max) { max = strlen(list1[i]); } } return max; }
int main() { char *list1[] = {"python", "PHP", "bigdata"}; char *list2[] = {"a", "ab", "abc"}; char *list3[] = {"small", "big", "tall"}; assert(func0(list1, 3) == 7); assert(func0(list2, 3) == 3); assert(func0(list3, 3) == 5); return 0; }
O3
c
func0: endbr64 push %r12 push %rbp mov %esi,%ebp push %rbx mov %rdi,%rbx mov (%rdi),%rdi callq 1070 <strlen@plt> mov %eax,%r12d test %ebp,%ebp jle 133b <func0+0x4b> add $0x8,%rbx lea -0x1(%rbp),%edx lea (%rbx,%rdx,8),%rbp jmp 132c <func0+0x3c> nopl 0x0(%rax) mov (%rbx),%rdi add $0x8,%rbx callq 1070 <strlen@plt> movslq %r12d,%rdx cmp %rax,%rdx cmovb %eax,%r12d cmp %rbp,%rbx jne 1320 <func0+0x30> mov %r12d,%eax pop %rbx pop %rbp pop %r12 retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
func0: endbr64 push r12 movsxd r12, esi push rbp push rbx mov rbx, rdi mov rdi, [rdi]; s call _strlen mov ebp, eax test r12d, r12d jle short loc_1322 lea r12, [rbx+r12*8] jmp short loc_1310 loc_1308: mov rdi, [rbx]; s call _strlen loc_1310: movsxd rdx, ebp cmp rdx, rax cmovb ebp, eax add rbx, 8 cmp rbx, r12 jnz short loc_1308 loc_1322: mov eax, ebp pop rbx pop rbp pop r12 retn
long long func0(const char **a1, int a2) { const char **v2; // rbx size_t v3; // rax unsigned int v4; // ebp v2 = a1; v3 = strlen(*a1); v4 = v3; if ( a2 > 0 ) { while ( 1 ) { if ( (int)v4 < v3 ) v4 = v3; if ( ++v2 == &a1[a2] ) break; v3 = strlen(*v2); } } return v4; }
func0: ENDBR64 PUSH R12 MOVSXD R12,ESI PUSH RBP PUSH RBX MOV RBX,RDI MOV RDI,qword ptr [RDI] CALL 0x00101070 MOV EBP,EAX TEST R12D,R12D JLE 0x00101322 LEA R12,[RBX + R12*0x8] JMP 0x00101310 LAB_00101308: MOV RDI,qword ptr [RBX] CALL 0x00101070 LAB_00101310: MOVSXD RDX,EBP CMP RDX,RAX CMOVC EBP,EAX ADD RBX,0x8 CMP RBX,R12 JNZ 0x00101308 LAB_00101322: MOV EAX,EBP POP RBX POP RBP POP R12 RET
ulong func0(int8 *param_1,int param_2) { int8 *puVar1; ulong uVar2; ulong uVar3; uVar2 = strlen((char *)*param_1); uVar3 = uVar2 & 0xffffffff; if (0 < param_2) { puVar1 = param_1 + param_2; while( true ) { if ((ulong)(long)(int)uVar3 < uVar2) { uVar3 = uVar2 & 0xffffffff; } param_1 = param_1 + 1; if (param_1 == puVar1) break; uVar2 = strlen((char *)*param_1); } } return uVar3; }
4,256
func0
#include <stdbool.h> #include <assert.h> #include <string.h>
bool func0(char *str1[], char *sub_str, int size) { for (int i = 0; i < size; i++) { if (strstr(str1[i], sub_str) != NULL) { return true; } } return false; }
int main() { char *array[] = {"red", "black", "white", "green", "orange"}; int size = sizeof(array) / sizeof(array[0]); assert(func0(array, "ack", size) == true); assert(func0(array, "abc", size) == false); assert(func0(array, "ange", size) == true); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x30,%rsp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %edx,-0x24(%rbp) movl $0x0,-0x4(%rbp) jmp 11df <func0+0x56> mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,8),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%rax mov -0x20(%rbp),%rdx mov %rdx,%rsi mov %rax,%rdi callq 1090 <strstr@plt> test %rax,%rax je 11db <func0+0x52> mov $0x1,%eax jmp 11ec <func0+0x63> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x24(%rbp),%eax jl 11a9 <func0+0x20> mov $0x0,%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 30h mov [rbp+var_18], rdi mov [rbp+needle], rsi mov [rbp+var_24], edx mov [rbp+var_4], 0 jmp short loc_11DF loc_11A9: mov eax, [rbp+var_4] cdqe lea rdx, ds:0[rax*8] mov rax, [rbp+var_18] add rax, rdx mov rax, [rax] mov rdx, [rbp+needle] mov rsi, rdx; needle mov rdi, rax; haystack call _strstr test rax, rax jz short loc_11DB mov eax, 1 jmp short locret_11EC loc_11DB: add [rbp+var_4], 1 loc_11DF: mov eax, [rbp+var_4] cmp eax, [rbp+var_24] jl short loc_11A9 mov eax, 0 locret_11EC: leave retn
long long func0(long long a1, const char *a2, int a3) { int i; // [rsp+2Ch] [rbp-4h] for ( i = 0; i < a3; ++i ) { if ( strstr(*(const char **)(8LL * i + a1), a2) ) return 1LL; } return 0LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x30 MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV dword ptr [RBP + -0x24],EDX MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011df LAB_001011a9: MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RDX,[RAX*0x8] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RAX,qword ptr [RAX] MOV RDX,qword ptr [RBP + -0x20] MOV RSI,RDX MOV RDI,RAX CALL 0x00101090 TEST RAX,RAX JZ 0x001011db MOV EAX,0x1 JMP 0x001011ec LAB_001011db: ADD dword ptr [RBP + -0x4],0x1 LAB_001011df: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x24] JL 0x001011a9 MOV EAX,0x0 LAB_001011ec: LEAVE RET
int8 func0(long param_1,char *param_2,int param_3) { char *pcVar1; int local_c; local_c = 0; while( true ) { if (param_3 <= local_c) { return 0; } pcVar1 = strstr(*(char **)(param_1 + (long)local_c * 8),param_2); if (pcVar1 != (char *)0x0) break; local_c = local_c + 1; } return 1; }
4,257
func0
#include <stdbool.h> #include <assert.h> #include <string.h>
bool func0(char *str1[], char *sub_str, int size) { for (int i = 0; i < size; i++) { if (strstr(str1[i], sub_str) != NULL) { return true; } } return false; }
int main() { char *array[] = {"red", "black", "white", "green", "orange"}; int size = sizeof(array) / sizeof(array[0]); assert(func0(array, "ack", size) == true); assert(func0(array, "abc", size) == false); assert(func0(array, "ange", size) == true); return 0; }
O1
c
func0: endbr64 test %edx,%edx jle 11be <func0+0x35> push %r12 push %rbp push %rbx mov %rsi,%rbp mov %rdi,%rbx lea -0x1(%rdx),%eax lea 0x8(%rdi,%rax,8),%r12 mov %rbp,%rsi mov (%rbx),%rdi callq 1090 <strstr@plt> test %rax,%rax jne 11c4 <func0+0x3b> add $0x8,%rbx cmp %r12,%rbx jne 11a3 <func0+0x1a> jmp 11c9 <func0+0x40> mov $0x0,%eax retq mov $0x1,%eax pop %rbx pop %rbp pop %r12 retq
func0: endbr64 test edx, edx jle short loc_11BE push r12 push rbp push rbx mov rbp, rsi mov rbx, rdi lea eax, [rdx-1] lea r12, [rdi+rax*8+8] loc_11A3: mov rsi, rbp mov rdi, [rbx] call _strstr test rax, rax jnz short loc_11C4 add rbx, 8 cmp rbx, r12 jnz short loc_11A3 jmp short loc_11C9 loc_11BE: mov eax, 0 retn loc_11C4: mov eax, 1 loc_11C9: pop rbx pop rbp pop r12 retn
long long func0(_QWORD *a1, long long a2, int a3) { _QWORD *v3; // rbx long long v4; // r12 long long result; // rax if ( a3 <= 0 ) return 0LL; v3 = a1; v4 = (long long)&a1[(unsigned int)(a3 - 1) + 1]; while ( 1 ) { result = strstr(*v3, a2); if ( result ) break; if ( ++v3 == (_QWORD *)v4 ) return result; } return 1LL; }
func0: ENDBR64 TEST EDX,EDX JLE 0x001011be PUSH R12 PUSH RBP PUSH RBX MOV RBP,RSI MOV RBX,RDI LEA EAX,[RDX + -0x1] LEA R12,[RDI + RAX*0x8 + 0x8] LAB_001011a3: MOV RSI,RBP MOV RDI,qword ptr [RBX] CALL 0x00101090 TEST RAX,RAX JNZ 0x001011c4 ADD RBX,0x8 CMP RBX,R12 JNZ 0x001011a3 JMP 0x001011c9 LAB_001011be: MOV EAX,0x0 RET LAB_001011c4: MOV EAX,0x1 LAB_001011c9: POP RBX POP RBP POP R12 RET
int8 func0(int8 *param_1,char *param_2,int param_3) { int8 *puVar1; char *pcVar2; if (param_3 < 1) { return 0; } puVar1 = param_1 + (ulong)(param_3 - 1) + 1; do { pcVar2 = strstr((char *)*param_1,param_2); if (pcVar2 != (char *)0x0) { return 1; } param_1 = param_1 + 1; } while (param_1 != puVar1); return 0; }
4,258
func0
#include <stdbool.h> #include <assert.h> #include <string.h>
bool func0(char *str1[], char *sub_str, int size) { for (int i = 0; i < size; i++) { if (strstr(str1[i], sub_str) != NULL) { return true; } } return false; }
int main() { char *array[] = {"red", "black", "white", "green", "orange"}; int size = sizeof(array) / sizeof(array[0]); assert(func0(array, "ack", size) == true); assert(func0(array, "abc", size) == false); assert(func0(array, "ange", size) == true); return 0; }
O2
c
func0: endbr64 test %edx,%edx jle 1333 <func0+0x43> lea -0x1(%rdx),%eax push %r12 lea 0x8(%rdi,%rax,8),%r12 push %rbp mov %rsi,%rbp push %rbx mov %rdi,%rbx jmp 1319 <func0+0x29> nopl 0x0(%rax) add $0x8,%rbx cmp %r12,%rbx je 132e <func0+0x3e> mov (%rbx),%rdi mov %rbp,%rsi callq 1090 <strstr@plt> test %rax,%rax je 1310 <func0+0x20> mov $0x1,%eax pop %rbx pop %rbp pop %r12 retq xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 test edx, edx jle short loc_12F3 lea eax, [rdx-1] push r12 lea r12, [rdi+rax*8+8] push rbp mov rbp, rsi push rbx mov rbx, rdi jmp short loc_12D9 loc_12D0: add rbx, 8 cmp rbx, r12 jz short loc_12EE loc_12D9: mov rdi, [rbx] mov rsi, rbp call _strstr test rax, rax jz short loc_12D0 mov eax, 1 loc_12EE: pop rbx pop rbp pop r12 retn loc_12F3: xor eax, eax retn
long long func0(_QWORD *a1, long long a2, int a3) { long long v3; // r12 _QWORD *v4; // rbx long long result; // rax if ( a3 <= 0 ) return 0LL; v3 = (long long)&a1[(unsigned int)(a3 - 1) + 1]; v4 = a1; while ( 1 ) { result = strstr(*v4, a2); if ( result ) break; if ( ++v4 == (_QWORD *)v3 ) return result; } return 1LL; }
func0: ENDBR64 TEST EDX,EDX JLE 0x001012f3 LEA EAX,[RDX + -0x1] PUSH R12 LEA R12,[RDI + RAX*0x8 + 0x8] PUSH RBP MOV RBP,RSI PUSH RBX MOV RBX,RDI JMP 0x001012d9 LAB_001012d0: ADD RBX,0x8 CMP RBX,R12 JZ 0x001012ee LAB_001012d9: MOV RDI,qword ptr [RBX] MOV RSI,RBP CALL 0x00101090 TEST RAX,RAX JZ 0x001012d0 MOV EAX,0x1 LAB_001012ee: POP RBX POP RBP POP R12 RET LAB_001012f3: XOR EAX,EAX RET
int8 func0(int8 *param_1,char *param_2,int param_3) { int8 *puVar1; char *pcVar2; if (param_3 < 1) { return 0; } puVar1 = param_1 + (ulong)(param_3 - 1) + 1; do { pcVar2 = strstr((char *)*param_1,param_2); if (pcVar2 != (char *)0x0) { return 1; } param_1 = param_1 + 1; } while (param_1 != puVar1); return 0; }
4,259
func0
#include <stdbool.h> #include <assert.h> #include <string.h>
bool func0(char *str1[], char *sub_str, int size) { for (int i = 0; i < size; i++) { if (strstr(str1[i], sub_str) != NULL) { return true; } } return false; }
int main() { char *array[] = {"red", "black", "white", "green", "orange"}; int size = sizeof(array) / sizeof(array[0]); assert(func0(array, "ack", size) == true); assert(func0(array, "abc", size) == false); assert(func0(array, "ange", size) == true); return 0; }
O3
c
func0: endbr64 test %edx,%edx jle 1323 <func0+0x43> lea -0x1(%rdx),%eax push %r12 lea 0x8(%rdi,%rax,8),%r12 push %rbp mov %rsi,%rbp push %rbx mov %rdi,%rbx jmp 1309 <func0+0x29> nopl 0x0(%rax) add $0x8,%rbx cmp %r12,%rbx je 131e <func0+0x3e> mov (%rbx),%rdi mov %rbp,%rsi callq 1090 <strstr@plt> test %rax,%rax je 1300 <func0+0x20> mov $0x1,%eax pop %rbx pop %rbp pop %r12 retq xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 test edx, edx jle short loc_11A3 movsxd rdx, edx push r12 lea r12, [rdi+rdx*8] push rbp mov rbp, rsi push rbx mov rbx, rdi jmp short loc_1189 loc_1180: add rbx, 8 cmp rbx, r12 jz short loc_119E loc_1189: mov rdi, [rbx]; haystack mov rsi, rbp; needle call _strstr test rax, rax jz short loc_1180 mov eax, 1 loc_119E: pop rbx pop rbp pop r12 retn loc_11A3: xor eax, eax retn
char * func0(const char **a1, const char *a2, int a3) { const char **v3; // r12 const char **v4; // rbx char *result; // rax if ( a3 <= 0 ) return 0LL; v3 = &a1[a3]; v4 = a1; while ( 1 ) { result = strstr(*v4, a2); if ( result ) break; if ( ++v4 == v3 ) return result; } return (_BYTE *)(&dword_0 + 1); }
func0: ENDBR64 TEST EDX,EDX JLE 0x001011a3 MOVSXD RDX,EDX PUSH R12 LEA R12,[RDI + RDX*0x8] PUSH RBP MOV RBP,RSI PUSH RBX MOV RBX,RDI JMP 0x00101189 LAB_00101180: ADD RBX,0x8 CMP RBX,R12 JZ 0x0010119e LAB_00101189: MOV RDI,qword ptr [RBX] MOV RSI,RBP CALL 0x00101050 TEST RAX,RAX JZ 0x00101180 MOV EAX,0x1 LAB_0010119e: POP RBX POP RBP POP R12 RET LAB_001011a3: XOR EAX,EAX RET
int8 func0(int8 *param_1,char *param_2,int param_3) { int8 *puVar1; char *pcVar2; if (param_3 < 1) { return 0; } puVar1 = param_1 + param_3; do { pcVar2 = strstr((char *)*param_1,param_2); if (pcVar2 != (char *)0x0) { return 1; } param_1 = param_1 + 1; } while (param_1 != puVar1); return 0; }
4,260
func0
#include <stdbool.h> #include <string.h> #include <assert.h>
bool func0(const char *n) { int length = strlen(n); if (length <= 2) { return false; } for (int i = 2; i < length; i++) { if (n[i - 2] != n[i]) { return false; } } return true; }
int main() { assert(func0("1212121") == true); assert(func0("1991") == false); assert(func0("121") == true); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 1060 <strlen@plt> mov %eax,-0x4(%rbp) cmpl $0x2,-0x4(%rbp) jg 1195 <func0+0x2c> mov $0x0,%eax jmp 11dd <func0+0x74> movl $0x2,-0x8(%rbp) jmp 11d0 <func0+0x67> mov -0x8(%rbp),%eax cltq lea -0x2(%rax),%rdx mov -0x18(%rbp),%rax add %rdx,%rax movzbl (%rax),%edx mov -0x8(%rbp),%eax movslq %eax,%rcx mov -0x18(%rbp),%rax add %rcx,%rax movzbl (%rax),%eax cmp %al,%dl je 11cc <func0+0x63> mov $0x0,%eax jmp 11dd <func0+0x74> addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x4(%rbp),%eax jl 119e <func0+0x35> mov $0x1,%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+s], rdi mov rax, [rbp+s] mov rdi, rax; s call _strlen mov [rbp+var_4], eax cmp [rbp+var_4], 2 jg short loc_1195 mov eax, 0 jmp short locret_11DD loc_1195: mov [rbp+var_8], 2 jmp short loc_11D0 loc_119E: mov eax, [rbp+var_8] cdqe lea rdx, [rax-2] mov rax, [rbp+s] add rax, rdx movzx edx, byte ptr [rax] mov eax, [rbp+var_8] movsxd rcx, eax mov rax, [rbp+s] add rax, rcx movzx eax, byte ptr [rax] cmp dl, al jz short loc_11CC mov eax, 0 jmp short locret_11DD loc_11CC: add [rbp+var_8], 1 loc_11D0: mov eax, [rbp+var_8] cmp eax, [rbp+var_4] jl short loc_119E mov eax, 1 locret_11DD: leave retn
long long func0(const char *a1) { int i; // [rsp+18h] [rbp-8h] int v3; // [rsp+1Ch] [rbp-4h] v3 = strlen(a1); if ( v3 <= 2 ) return 0LL; for ( i = 2; i < v3; ++i ) { if ( a1[i - 2] != a1[i] ) return 0LL; } return 1LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101060 MOV dword ptr [RBP + -0x4],EAX CMP dword ptr [RBP + -0x4],0x2 JG 0x00101195 MOV EAX,0x0 JMP 0x001011dd LAB_00101195: MOV dword ptr [RBP + -0x8],0x2 JMP 0x001011d0 LAB_0010119e: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX + -0x2] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOVZX EDX,byte ptr [RAX] MOV EAX,dword ptr [RBP + -0x8] MOVSXD RCX,EAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOVZX EAX,byte ptr [RAX] CMP DL,AL JZ 0x001011cc MOV EAX,0x0 JMP 0x001011dd LAB_001011cc: ADD dword ptr [RBP + -0x8],0x1 LAB_001011d0: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x4] JL 0x0010119e MOV EAX,0x1 LAB_001011dd: LEAVE RET
int8 func0(char *param_1) { size_t sVar1; int8 uVar2; int local_10; sVar1 = strlen(param_1); if ((int)sVar1 < 3) { uVar2 = 0; } else { for (local_10 = 2; local_10 < (int)sVar1; local_10 = local_10 + 1) { if (param_1[(long)local_10 + -2] != param_1[local_10]) { return 0; } } uVar2 = 1; } return uVar2; }
4,261
func0
#include <stdbool.h> #include <string.h> #include <assert.h>
bool func0(const char *n) { int length = strlen(n); if (length <= 2) { return false; } for (int i = 2; i < length; i++) { if (n[i - 2] != n[i]) { return false; } } return true; }
int main() { assert(func0("1212121") == true); assert(func0("1991") == false); assert(func0("121") == true); return 0; }
O1
c
func0: endbr64 mov %rdi,%rdx mov $0xffffffffffffffff,%rcx mov $0x0,%eax repnz scas %es:(%rdi),%al not %rcx sub $0x1,%rcx cmp $0x2,%ecx jle 1192 <func0+0x49> mov %rdx,%rax lea -0x3(%rcx),%ecx lea 0x1(%rdx,%rcx,1),%rdx movzbl 0x2(%rax),%esi cmp %sil,(%rax) jne 118d <func0+0x44> add $0x1,%rax cmp %rdx,%rax jne 1175 <func0+0x2c> mov $0x1,%eax retq mov $0x0,%eax retq
func0: endbr64 push rbx mov rbx, rdi call _strlen mov edx, 0 cmp eax, 2 jle short loc_11A8 mov rdx, rbx lea eax, [rax-3] lea rax, [rbx+rax+1] loc_118B: movzx ecx, byte ptr [rdx+2] cmp [rdx], cl jnz short loc_11A3 add rdx, 1 cmp rdx, rax jnz short loc_118B mov edx, 1 jmp short loc_11A8 loc_11A3: mov edx, 0 loc_11A8: mov eax, edx pop rbx retn
long long func0(_BYTE *a1) { int v1; // eax unsigned int v2; // edx _BYTE *v3; // rdx long long v4; // rax v1 = strlen(); v2 = 0; if ( v1 > 2 ) { v3 = a1; v4 = (long long)&a1[v1 - 3 + 1]; while ( *v3 == v3[2] ) { if ( ++v3 == (_BYTE *)v4 ) return 1; } return 0; } return v2; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101060 MOV EDX,0x0 CMP EAX,0x2 JLE 0x001011a8 MOV RDX,RBX LEA EAX,[RAX + -0x3] LEA RAX,[RBX + RAX*0x1 + 0x1] LAB_0010118b: MOVZX ECX,byte ptr [RDX + 0x2] CMP byte ptr [RDX],CL JNZ 0x001011a3 ADD RDX,0x1 CMP RDX,RAX JNZ 0x0010118b MOV EDX,0x1 JMP 0x001011a8 LAB_001011a3: MOV EDX,0x0 LAB_001011a8: MOV EAX,EDX POP RBX RET
int8 func0(char *param_1) { char *pcVar1; size_t sVar2; int8 uVar3; sVar2 = strlen(param_1); uVar3 = 0; if (2 < (int)sVar2) { pcVar1 = param_1 + (ulong)((int)sVar2 - 3) + 1; do { if (*param_1 != param_1[2]) { return 0; } param_1 = param_1 + 1; } while (param_1 != pcVar1); uVar3 = 1; } return uVar3; }
4,262
func0
#include <stdbool.h> #include <string.h> #include <assert.h>
bool func0(const char *n) { int length = strlen(n); if (length <= 2) { return false; } for (int i = 2; i < length; i++) { if (n[i - 2] != n[i]) { return false; } } return true; }
int main() { assert(func0("1212121") == true); assert(func0("1991") == false); assert(func0("121") == true); return 0; }
O2
c
func0: endbr64 push %rbx mov %rdi,%rbx callq 1060 <strlen@plt> xor %r8d,%r8d cmp $0x2,%eax jle 1247 <func0+0x37> sub $0x3,%eax mov %rbx,%rdi lea 0x1(%rbx,%rax,1),%rax movzbl 0x2(%rdi),%edx cmp %dl,(%rdi) jne 1250 <func0+0x40> add $0x1,%rdi cmp %rax,%rdi jne 1230 <func0+0x20> mov $0x1,%r8d mov %r8d,%eax pop %rbx retq nopl 0x0(%rax) xor %r8d,%r8d pop %rbx mov %r8d,%eax retq nopl 0x0(%rax,%rax,1)
func0: endbr64 push rbx mov rbx, rdi call _strlen xor r8d, r8d cmp eax, 2 jle short loc_1247 sub eax, 3 mov rdi, rbx lea rax, [rbx+rax+1] loc_1230: movzx edx, byte ptr [rdi+2] cmp [rdi], dl jnz short loc_1250 add rdi, 1 cmp rdi, rax jnz short loc_1230 mov r8d, 1 loc_1247: mov eax, r8d pop rbx retn loc_1250: xor r8d, r8d pop rbx mov eax, r8d retn
long long func0(_BYTE *a1) { int v1; // eax unsigned int v2; // r8d long long v3; // rax v1 = strlen(); v2 = 0; if ( v1 <= 2 ) return v2; v3 = (long long)&a1[v1 - 3 + 1]; while ( *a1 == a1[2] ) { if ( ++a1 == (_BYTE *)v3 ) return 1; } return 0LL; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101060 XOR R8D,R8D CMP EAX,0x2 JLE 0x00101247 SUB EAX,0x3 MOV RDI,RBX LEA RAX,[RBX + RAX*0x1 + 0x1] LAB_00101230: MOVZX EDX,byte ptr [RDI + 0x2] CMP byte ptr [RDI],DL JNZ 0x00101250 ADD RDI,0x1 CMP RDI,RAX JNZ 0x00101230 MOV R8D,0x1 LAB_00101247: MOV EAX,R8D POP RBX RET LAB_00101250: XOR R8D,R8D POP RBX MOV EAX,R8D RET
int8 func0(char *param_1) { char *pcVar1; size_t sVar2; int8 uVar3; sVar2 = strlen(param_1); uVar3 = 0; if (2 < (int)sVar2) { pcVar1 = param_1 + (ulong)((int)sVar2 - 3) + 1; do { if (*param_1 != param_1[2]) { return 0; } param_1 = param_1 + 1; } while (param_1 != pcVar1); uVar3 = 1; } return uVar3; }
4,263
func0
#include <stdbool.h> #include <string.h> #include <assert.h>
bool func0(const char *n) { int length = strlen(n); if (length <= 2) { return false; } for (int i = 2; i < length; i++) { if (n[i - 2] != n[i]) { return false; } } return true; }
int main() { assert(func0("1212121") == true); assert(func0("1991") == false); assert(func0("121") == true); return 0; }
O3
c
func0: endbr64 push %rbx mov %rdi,%rbx callq 1060 <strlen@plt> xor %r8d,%r8d cmp $0x2,%eax jle 1259 <func0+0x49> sub $0x3,%eax movzbl (%rbx),%ecx movzbl 0x1(%rbx),%esi lea 0x2(%rbx),%rdx lea 0x3(%rbx,%rax,1),%rdi jmp 1242 <func0+0x32> nopw 0x0(%rax,%rax,1) mov %eax,%ecx cmp %cl,(%rdx) jne 1260 <func0+0x50> add $0x1,%rdx mov %esi,%eax mov %ecx,%esi cmp %rdi,%rdx jne 1240 <func0+0x30> mov $0x1,%r8d mov %r8d,%eax pop %rbx retq xchg %ax,%ax xor %r8d,%r8d pop %rbx mov %r8d,%eax retq nopl 0x0(%rax,%rax,1)
func0: endbr64 push rbx mov rbx, rdi call _strlen xor edx, edx cmp eax, 2 jle short loc_1257 sub eax, 3 movzx esi, byte ptr [rbx] movzx ecx, byte ptr [rbx+1] lea rdx, [rbx+2] lea rdi, [rbx+rax+3] jmp short loc_124B loc_1240: add rdx, 1 mov esi, eax cmp rdx, rdi jz short loc_1260 loc_124B: mov eax, ecx movzx ecx, byte ptr [rdx] cmp cl, sil jz short loc_1240 xor edx, edx loc_1257: mov eax, edx pop rbx retn loc_1260: mov edx, 1 pop rbx mov eax, edx retn
long long func0(long long a1) { int v1; // eax char v2; // si char v3; // cl char *v4; // rdx long long v5; // rdi char v6; // al v1 = strlen((const char *)a1); if ( v1 > 2 ) { v2 = *(_BYTE *)a1; v3 = *(_BYTE *)(a1 + 1); v4 = (char *)(a1 + 2); v5 = a1 + (unsigned int)(v1 - 3) + 3; while ( 1 ) { v6 = v3; v3 = *v4; if ( *v4 != v2 ) break; ++v4; v2 = v6; if ( v4 == (char *)v5 ) return 1LL; } } return 0LL; }
func0: ENDBR64 PUSH RBX MOV RBX,RDI CALL 0x00101060 XOR EDX,EDX CMP EAX,0x2 JLE 0x00101257 SUB EAX,0x3 MOVZX ESI,byte ptr [RBX] MOVZX ECX,byte ptr [RBX + 0x1] LEA RDX,[RBX + 0x2] LEA RDI,[RBX + RAX*0x1 + 0x3] JMP 0x0010124b LAB_00101240: ADD RDX,0x1 MOV ESI,EAX CMP RDX,RDI JZ 0x00101260 LAB_0010124b: MOV EAX,ECX MOVZX ECX,byte ptr [RDX] CMP CL,SIL JZ 0x00101240 XOR EDX,EDX LAB_00101257: MOV EAX,EDX POP RBX RET LAB_00101260: MOV EDX,0x1 POP RBX MOV EAX,EDX RET
int8 func0(char *param_1) { char cVar1; size_t sVar2; char cVar3; char *pcVar4; char cVar5; sVar2 = strlen(param_1); if (2 < (int)sVar2) { pcVar4 = param_1 + 2; cVar5 = *param_1; cVar3 = param_1[1]; while (cVar1 = *pcVar4, cVar1 == cVar5) { pcVar4 = pcVar4 + 1; cVar5 = cVar3; cVar3 = cVar1; if (pcVar4 == param_1 + (ulong)((int)sVar2 - 3) + 3) { return 1; } } } return 0; }
4,264
func0
#include <assert.h>
int func0(int a, int b) { if (b == 0) return 1; else if (a == 0) return 0; else if (b == 1) return a; else return a * func0(a, b - 1); }
int main() { assert(func0(3, 4) == 81); assert(func0(2, 3) == 8); assert(func0(5, 5) == 3125); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov %edi,-0x4(%rbp) mov %esi,-0x8(%rbp) cmpl $0x0,-0x8(%rbp) jne 1168 <func0+0x1f> mov $0x1,%eax jmp 1196 <func0+0x4d> cmpl $0x0,-0x4(%rbp) jne 1175 <func0+0x2c> mov $0x0,%eax jmp 1196 <func0+0x4d> cmpl $0x1,-0x8(%rbp) jne 1180 <func0+0x37> mov -0x4(%rbp),%eax jmp 1196 <func0+0x4d> mov -0x8(%rbp),%eax lea -0x1(%rax),%edx mov -0x4(%rbp),%eax mov %edx,%esi mov %eax,%edi callq 1149 <func0> imul -0x4(%rbp),%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 10h mov [rbp+var_4], edi mov [rbp+var_8], esi cmp [rbp+var_8], 0 jnz short loc_1168 mov eax, 1 jmp short locret_1196 loc_1168: cmp [rbp+var_4], 0 jnz short loc_1175 mov eax, 0 jmp short locret_1196 loc_1175: cmp [rbp+var_8], 1 jnz short loc_1180 mov eax, [rbp+var_4] jmp short locret_1196 loc_1180: mov eax, [rbp+var_8] lea edx, [rax-1] mov eax, [rbp+var_4] mov esi, edx mov edi, eax call func0 imul eax, [rbp+var_4] locret_1196: leave retn
long long func0(unsigned int a1, int a2) { if ( !a2 ) return 1LL; if ( !a1 ) return 0LL; if ( a2 == 1 ) return a1; return a1 * (unsigned int)func0(a1, (unsigned int)(a2 - 1)); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x10 MOV dword ptr [RBP + -0x4],EDI MOV dword ptr [RBP + -0x8],ESI CMP dword ptr [RBP + -0x8],0x0 JNZ 0x00101168 MOV EAX,0x1 JMP 0x00101196 LAB_00101168: CMP dword ptr [RBP + -0x4],0x0 JNZ 0x00101175 MOV EAX,0x0 JMP 0x00101196 LAB_00101175: CMP dword ptr [RBP + -0x8],0x1 JNZ 0x00101180 MOV EAX,dword ptr [RBP + -0x4] JMP 0x00101196 LAB_00101180: MOV EAX,dword ptr [RBP + -0x8] LEA EDX,[RAX + -0x1] MOV EAX,dword ptr [RBP + -0x4] MOV ESI,EDX MOV EDI,EAX CALL 0x00101149 IMUL EAX,dword ptr [RBP + -0x4] LAB_00101196: LEAVE RET
int func0(int param_1,int param_2) { int iVar1; if (param_2 == 0) { param_1 = 1; } else if (param_1 == 0) { param_1 = 0; } else if (param_2 != 1) { iVar1 = func0(param_1,param_2 + -1); param_1 = iVar1 * param_1; } return param_1; }
4,265
func0
#include <assert.h>
int func0(int a, int b) { if (b == 0) return 1; else if (a == 0) return 0; else if (b == 1) return a; else return a * func0(a, b - 1); }
int main() { assert(func0(3, 4) == 81); assert(func0(2, 3) == 8); assert(func0(5, 5) == 3125); return 0; }
O1
c
func0: endbr64 mov $0x1,%eax test %esi,%esi je 1173 <func0+0x2a> push %rbx mov %edi,%ebx mov %edi,%eax test %edi,%edi je 1164 <func0+0x1b> cmp $0x1,%esi jne 1166 <func0+0x1d> pop %rbx retq sub $0x1,%esi callq 1149 <func0> imul %ebx,%eax jmp 1164 <func0+0x1b> retq
func0: endbr64 mov eax, 1 test esi, esi jz short locret_1173 push rbx mov ebx, edi mov eax, edi test edi, edi jz short loc_1164 cmp esi, 1 jnz short loc_1166 loc_1164: pop rbx retn loc_1166: sub esi, 1 call func0 imul eax, ebx jmp short loc_1164 locret_1173: retn
long long func0(long long a1, int a2) { long long result; // rax result = 1LL; if ( a2 ) { result = (unsigned int)a1; if ( (_DWORD)a1 ) { if ( a2 != 1 ) return (unsigned int)a1 * (unsigned int)func0(a1, (unsigned int)(a2 - 1)); } } return result; }
func0: ENDBR64 MOV EAX,0x1 TEST ESI,ESI JZ 0x00101173 PUSH RBX MOV EBX,EDI MOV EAX,EDI TEST EDI,EDI JZ 0x00101164 CMP ESI,0x1 JNZ 0x00101166 LAB_00101164: POP RBX RET LAB_00101166: SUB ESI,0x1 CALL 0x00101149 IMUL EAX,EBX JMP 0x00101164 LAB_00101173: RET
int func0(int param_1,int param_2) { int iVar1; if (param_2 != 0) { if ((param_1 != 0) && (param_2 != 1)) { iVar1 = func0(param_1,param_2 + -1); param_1 = iVar1 * param_1; } return param_1; } return 1; }
4,266
func0
#include <assert.h>
int func0(int a, int b) { if (b == 0) return 1; else if (a == 0) return 0; else if (b == 1) return a; else return a * func0(a, b - 1); }
int main() { assert(func0(3, 4) == 81); assert(func0(2, 3) == 8); assert(func0(5, 5) == 3125); return 0; }
O2
c
func0: endbr64 test %esi,%esi je 1174 <func0+0x34> test %edi,%edi je 117a <func0+0x3a> cmp $0x1,%esi je 117d <func0+0x3d> mov $0x1,%eax jmp 1165 <func0+0x25> nopl 0x0(%rax,%rax,1) cmp $0x1,%esi je 1170 <func0+0x30> imul %edi,%eax sub $0x1,%esi jne 1160 <func0+0x20> retq xchg %ax,%ax imul %edi,%eax retq mov $0x1,%eax retq xor %eax,%eax retq mov %edi,%eax retq
func0: endbr64 test esi, esi jz short loc_1174 test edi, edi jz short loc_117A cmp esi, 1 jz short loc_117D mov eax, 1 jmp short loc_1165 loc_1160: cmp esi, 1 jz short loc_1170 loc_1165: imul eax, edi sub esi, 1 jnz short loc_1160 retn loc_1170: imul eax, edi retn loc_1174: mov eax, 1 retn loc_117A: xor eax, eax retn loc_117D: mov eax, edi retn
long long func0(unsigned int a1, int a2) { long long result; // rax if ( !a2 ) return 1LL; if ( !a1 ) return 0LL; if ( a2 == 1 ) return a1; LODWORD(result) = 1; while ( 1 ) { result = a1 * (unsigned int)result; if ( !--a2 ) break; if ( a2 == 1 ) return a1 * (unsigned int)result; } return result; }
func0: ENDBR64 TEST ESI,ESI JZ 0x00101174 TEST EDI,EDI JZ 0x0010117a CMP ESI,0x1 JZ 0x0010117d MOV EAX,0x1 JMP 0x00101165 LAB_00101160: CMP ESI,0x1 JZ 0x00101170 LAB_00101165: IMUL EAX,EDI SUB ESI,0x1 JNZ 0x00101160 RET LAB_00101170: IMUL EAX,EDI RET LAB_00101174: MOV EAX,0x1 RET LAB_0010117a: XOR EAX,EAX RET LAB_0010117d: MOV EAX,EDI RET
int func0(int param_1,int param_2) { int iVar1; if (param_2 == 0) { return 1; } if (param_1 != 0) { if (param_2 == 1) { return param_1; } iVar1 = 1; do { iVar1 = iVar1 * param_1; param_2 = param_2 + -1; if (param_2 == 0) { return iVar1; } } while (param_2 != 1); return iVar1 * param_1; } return 0; }
4,267
func0
#include <assert.h>
int func0(int a, int b) { if (b == 0) return 1; else if (a == 0) return 0; else if (b == 1) return a; else return a * func0(a, b - 1); }
int main() { assert(func0(3, 4) == 81); assert(func0(2, 3) == 8); assert(func0(5, 5) == 3125); return 0; }
O3
c
func0: endbr64 test %esi,%esi je 1174 <func0+0x34> test %edi,%edi je 117a <func0+0x3a> cmp $0x1,%esi je 117d <func0+0x3d> mov $0x1,%eax jmp 1165 <func0+0x25> nopl 0x0(%rax,%rax,1) cmp $0x1,%esi je 1170 <func0+0x30> imul %edi,%eax sub $0x1,%esi jne 1160 <func0+0x20> retq xchg %ax,%ax imul %edi,%eax retq mov $0x1,%eax retq xor %eax,%eax retq mov %edi,%eax retq
func0: endbr64 test esi, esi jz short loc_1184 test edi, edi jz short loc_118A cmp esi, 1 jz short loc_118D mov edx, 1 lea eax, [rsi-1] test sil, 1 jnz short loc_1170 mov esi, eax mov edx, edi cmp eax, 1 jz short loc_117E nop dword ptr [rax+rax+00000000h] loc_1170: imul edx, edi sub esi, 2 imul edx, edi cmp esi, 1 jnz short loc_1170 loc_117E: mov eax, edi imul eax, edx retn loc_1184: mov eax, 1 retn loc_118A: xor eax, eax retn loc_118D: mov eax, edi retn
long long func0(unsigned int a1, int a2) { int v2; // edx int v3; // eax if ( !a2 ) return 1LL; if ( !a1 ) return 0LL; if ( a2 == 1 ) return a1; v2 = 1; v3 = a2 - 1; if ( (a2 & 1) != 0 || (--a2, v2 = a1, v3 != 1) ) { do { a2 -= 2; v2 *= a1 * a1; } while ( a2 != 1 ); } return v2 * a1; }
func0: ENDBR64 TEST ESI,ESI JZ 0x00101184 TEST EDI,EDI JZ 0x0010118a CMP ESI,0x1 JZ 0x0010118d MOV EDX,0x1 LEA EAX,[RSI + -0x1] TEST SIL,0x1 JNZ 0x00101170 MOV ESI,EAX MOV EDX,EDI CMP EAX,0x1 JZ 0x0010117e NOP dword ptr [RAX + RAX*0x1] LAB_00101170: IMUL EDX,EDI SUB ESI,0x2 IMUL EDX,EDI CMP ESI,0x1 JNZ 0x00101170 LAB_0010117e: MOV EAX,EDI IMUL EAX,EDX RET LAB_00101184: MOV EAX,0x1 RET LAB_0010118a: XOR EAX,EAX RET LAB_0010118d: MOV EAX,EDI RET
int func0(int param_1,uint param_2) { int iVar1; uint uVar2; int iVar3; if (param_2 == 0) { return 1; } if (param_1 != 0) { if (param_2 != 1) { iVar3 = 1; iVar1 = param_1; uVar2 = param_2 - 1; if ((param_2 & 1) != 0) goto LAB_00101170; while (param_2 = uVar2, iVar3 = iVar1, param_2 != 1) { LAB_00101170: iVar1 = iVar3 * param_1 * param_1; uVar2 = param_2 - 2; } return param_1 * iVar3; } return param_1; } return 0; }
4,268
func0
#include <assert.h> #include <string.h> #include <stdlib.h>
char* func0(char test_list[][2][50], int size){ int min_index = 0; int min_value = atoi(test_list[0][1]); for (int i = 1; i < size; i++) { int current_value = atoi(test_list[i][1]); if (current_value < min_value) { min_value = current_value; min_index = i; } } return test_list[min_index][0]; }
int main() { char list1[3][2][50] = {{"Rash", "143"}, {"Manjeet", "200"}, {"Varsha", "100"}}; char list2[3][2][50] = {{"Yash", "185"}, {"Dawood", "125"}, {"Sanya", "175"}}; char list3[3][2][50] = {{"Sai", "345"}, {"Salman", "145"}, {"Ayesha", "96"}}; assert(strcmp(func0(list1, 3), "Varsha") == 0); assert(strcmp(func0(list2, 3), "Dawood") == 0); assert(strcmp(func0(list3, 3), "Ayesha") == 0); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0x10(%rbp) mov -0x18(%rbp),%rax add $0x32,%rax mov %rax,%rdi callq 10b0 <atoi@plt> mov %eax,-0xc(%rbp) movl $0x1,-0x8(%rbp) jmp 122f <func0+0x86> mov -0x8(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax shl $0x2,%rax mov %rax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax add $0x32,%rax mov %rax,%rdi callq 10b0 <atoi@plt> mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0xc(%rbp),%eax jge 122b <func0+0x82> mov -0x4(%rbp),%eax mov %eax,-0xc(%rbp) mov -0x8(%rbp),%eax mov %eax,-0x10(%rbp) addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11df <func0+0x36> mov -0x10(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax shl $0x2,%rax mov %rax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_10], 0 mov rax, [rbp+var_18] add rax, 32h ; '2' mov rdi, rax; nptr call _atoi mov [rbp+var_C], eax mov [rbp+var_8], 1 jmp short loc_122F loc_11DF: mov eax, [rbp+var_8] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx shl rax, 2 mov rdx, rax mov rax, [rbp+var_18] add rax, rdx add rax, 32h ; '2' mov rdi, rax; nptr call _atoi mov [rbp+var_4], eax mov eax, [rbp+var_4] cmp eax, [rbp+var_C] jge short loc_122B mov eax, [rbp+var_4] mov [rbp+var_C], eax mov eax, [rbp+var_8] mov [rbp+var_10], eax loc_122B: add [rbp+var_8], 1 loc_122F: mov eax, [rbp+var_8] cmp eax, [rbp+var_1C] jl short loc_11DF mov eax, [rbp+var_10] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx shl rax, 2 mov rdx, rax mov rax, [rbp+var_18] add rax, rdx leave retn
long long func0(long long a1, int a2) { long long v3; // [rsp+10h] [rbp-10h] long long v4; // [rsp+18h] [rbp-8h] LODWORD(v3) = 0; HIDWORD(v3) = atoi((const char *)(a1 + 50)); LODWORD(v4) = 1; while ( (int)v4 < a2 ) { HIDWORD(v4) = atoi((const char *)(100LL * (int)v4 + a1 + 50)); if ( SHIDWORD(v4) < SHIDWORD(v3) ) v3 = v4; LODWORD(v4) = v4 + 1; } return 100LL * (int)v3 + a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x10],0x0 MOV RAX,qword ptr [RBP + -0x18] ADD RAX,0x32 MOV RDI,RAX CALL 0x001010b0 MOV dword ptr [RBP + -0xc],EAX MOV dword ptr [RBP + -0x8],0x1 JMP 0x0010122f LAB_001011df: MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX SHL RAX,0x2 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX ADD RAX,0x32 MOV RDI,RAX CALL 0x001010b0 MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0xc] JGE 0x0010122b MOV EAX,dword ptr [RBP + -0x4] MOV dword ptr [RBP + -0xc],EAX MOV EAX,dword ptr [RBP + -0x8] MOV dword ptr [RBP + -0x10],EAX LAB_0010122b: ADD dword ptr [RBP + -0x8],0x1 LAB_0010122f: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011df MOV EAX,dword ptr [RBP + -0x10] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX SHL RAX,0x2 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX LEAVE RET
long func0(long param_1,int param_2) { int iVar1; int4 local_18; int4 local_14; int4 local_10; local_18 = 0; local_14 = atoi((char *)(param_1 + 0x32)); for (local_10 = 1; local_10 < param_2; local_10 = local_10 + 1) { iVar1 = atoi((char *)(param_1 + (long)local_10 * 100 + 0x32)); if (iVar1 < local_14) { local_18 = local_10; local_14 = iVar1; } } return param_1 + (long)local_18 * 100; }
4,269
func0
#include <assert.h> #include <string.h> #include <stdlib.h>
char* func0(char test_list[][2][50], int size){ int min_index = 0; int min_value = atoi(test_list[0][1]); for (int i = 1; i < size; i++) { int current_value = atoi(test_list[i][1]); if (current_value < min_value) { min_value = current_value; min_index = i; } } return test_list[min_index][0]; }
int main() { char list1[3][2][50] = {{"Rash", "143"}, {"Manjeet", "200"}, {"Varsha", "100"}}; char list2[3][2][50] = {{"Yash", "185"}, {"Dawood", "125"}, {"Sanya", "175"}}; char list3[3][2][50] = {{"Sai", "345"}, {"Salman", "145"}, {"Ayesha", "96"}}; assert(strcmp(func0(list1, 3), "Varsha") == 0); assert(strcmp(func0(list2, 3), "Dawood") == 0); assert(strcmp(func0(list3, 3), "Ayesha") == 0); return 0; }
O1
c
func0: endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%r15 mov %esi,%r13d lea 0x32(%rdi),%rdi mov $0xa,%edx mov $0x0,%esi callq 1090 <strtol@plt> cmp $0x1,%r13d jle 11fc <func0+0x73> mov %eax,%r12d lea 0x96(%r15),%rbp mov $0x1,%ebx mov $0x0,%r14d jmp 11dd <func0+0x54> add $0x1,%ebx add $0x64,%rbp cmp %ebx,%r13d je 1202 <func0+0x79> mov $0xa,%edx mov $0x0,%esi mov %rbp,%rdi callq 1090 <strtol@plt> cmp %r12d,%eax jge 11d1 <func0+0x48> mov %eax,%r12d mov %ebx,%r14d jmp 11d1 <func0+0x48> mov $0x0,%r14d movslq %r14d,%r14 lea (%r14,%r14,4),%rax lea (%rax,%rax,4),%rax lea (%r15,%rax,4),%rax add $0x8,%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, 8 mov r15, rdi mov r13d, esi lea rdi, [rdi+32h] mov edx, 0Ah mov esi, 0 call _strtol cmp r13d, 1 jle short loc_121C mov r12d, eax lea rbp, [r15+96h] mov ebx, 1 mov r14d, 0 jmp short loc_11FD loc_11F1: add ebx, 1 add rbp, 64h ; 'd' cmp r13d, ebx jz short loc_1222 loc_11FD: mov edx, 0Ah mov esi, 0 mov rdi, rbp call _strtol cmp eax, r12d jge short loc_11F1 mov r12d, eax mov r14d, ebx jmp short loc_11F1 loc_121C: mov r14d, 0 loc_1222: movsxd r14, r14d lea rax, [r14+r14*4] lea rax, [rax+rax*4] lea rax, [r15+rax*4] add rsp, 8 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1, int a2) { int v2; // eax int v3; // r12d long long v4; // rbp int v5; // ebx int v6; // r14d int v7; // eax v2 = strtol(a1 + 50, 0LL, 10LL); if ( a2 <= 1 ) { v6 = 0; } else { v3 = v2; v4 = a1 + 150; v5 = 1; v6 = 0; do { v7 = strtol(v4, 0LL, 10LL); if ( v7 < v3 ) { v3 = v7; v6 = v5; } ++v5; v4 += 100LL; } while ( a2 != v5 ); } return a1 + 100LL * v6; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R15,RDI MOV R13D,ESI LEA RDI,[RDI + 0x32] MOV EDX,0xa MOV ESI,0x0 CALL 0x001010b0 CMP R13D,0x1 JLE 0x0010121c MOV R12D,EAX LEA RBP,[R15 + 0x96] MOV EBX,0x1 MOV R14D,0x0 JMP 0x001011fd LAB_001011f1: ADD EBX,0x1 ADD RBP,0x64 CMP R13D,EBX JZ 0x00101222 LAB_001011fd: MOV EDX,0xa MOV ESI,0x0 MOV RDI,RBP CALL 0x001010b0 CMP EAX,R12D JGE 0x001011f1 MOV R12D,EAX MOV R14D,EBX JMP 0x001011f1 LAB_0010121c: MOV R14D,0x0 LAB_00101222: MOVSXD R14,R14D LEA RAX,[R14 + R14*0x4] LEA RAX,[RAX + RAX*0x4] LEA RAX,[R15 + RAX*0x4] ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
long func0(long param_1,int param_2) { ulong uVar1; ulong uVar2; int iVar3; char *__nptr; int iVar4; uVar1 = strtol((char *)(param_1 + 0x32),(char **)0x0,10); if (param_2 < 2) { iVar4 = 0; } else { uVar1 = uVar1 & 0xffffffff; __nptr = (char *)(param_1 + 0x96); iVar3 = 1; iVar4 = 0; do { uVar2 = strtol(__nptr,(char **)0x0,10); if ((int)uVar2 < (int)uVar1) { uVar1 = uVar2 & 0xffffffff; iVar4 = iVar3; } iVar3 = iVar3 + 1; __nptr = __nptr + 100; } while (param_2 != iVar3); } return param_1 + (long)iVar4 * 100; }
4,270
func0
#include <assert.h> #include <string.h> #include <stdlib.h>
char* func0(char test_list[][2][50], int size){ int min_index = 0; int min_value = atoi(test_list[0][1]); for (int i = 1; i < size; i++) { int current_value = atoi(test_list[i][1]); if (current_value < min_value) { min_value = current_value; min_index = i; } } return test_list[min_index][0]; }
int main() { char list1[3][2][50] = {{"Rash", "143"}, {"Manjeet", "200"}, {"Varsha", "100"}}; char list2[3][2][50] = {{"Yash", "185"}, {"Dawood", "125"}, {"Sanya", "175"}}; char list3[3][2][50] = {{"Sai", "345"}, {"Salman", "145"}, {"Ayesha", "96"}}; assert(strcmp(func0(list1, 3), "Varsha") == 0); assert(strcmp(func0(list2, 3), "Dawood") == 0); assert(strcmp(func0(list3, 3), "Ayesha") == 0); return 0; }
O2
c
func0: endbr64 push %r15 mov $0xa,%edx push %r14 push %r13 mov %rdi,%r13 add $0x32,%rdi push %r12 push %rbp mov %esi,%ebp xor %esi,%esi push %rbx sub $0x8,%rsp callq 1090 <strtol@plt> cmp $0x1,%ebp jle 1372 <func0+0x72> mov %eax,%ebx lea 0x96(%r13),%r15 mov $0x1,%r14d xor %r12d,%r12d xchg %ax,%ax xor %esi,%esi mov $0xa,%edx mov %r15,%rdi callq 1090 <strtol@plt> cmp %ebx,%eax jge 1358 <func0+0x58> mov %eax,%ebx movslq %r14d,%r12 add $0x1,%r14d add $0x64,%r15 cmp %r14d,%ebp jne 1340 <func0+0x40> lea (%r12,%r12,4),%rax lea (%rax,%rax,4),%rax lea 0x0(%r13,%rax,4),%r13 add $0x8,%rsp mov %r13,%rax 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 mov edx, 0Ah push r14 push r13 mov r13, rdi add rdi, 32h ; '2' push r12 push rbp mov ebp, esi xor esi, esi push rbx sub rsp, 8 call _strtol cmp ebp, 1 jle short loc_1382 mov ebx, eax lea r15, [r13+96h] mov r14d, 1 xor r12d, r12d xchg ax, ax loc_1350: xor esi, esi mov edx, 0Ah mov rdi, r15 call _strtol cmp eax, ebx jge short loc_1368 mov ebx, eax movsxd r12, r14d loc_1368: add r14d, 1 add r15, 64h ; 'd' cmp ebp, r14d jnz short loc_1350 lea rax, [r12+r12*4] lea rax, [rax+rax*4] lea r13, [r13+rax*4+0] loc_1382: add rsp, 8 mov rax, r13 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1, int a2) { long long v2; // r13 int v3; // eax int v4; // ebx long long v5; // r15 int v6; // r14d long long v7; // r12 int v8; // eax v2 = a1; v3 = strtol(a1 + 50, 0LL, 10LL); if ( a2 > 1 ) { v4 = v3; v5 = a1 + 150; v6 = 1; v7 = 0LL; do { v8 = strtol(v5, 0LL, 10LL); if ( v8 < v4 ) { v4 = v8; v7 = v6; } ++v6; v5 += 100LL; } while ( a2 != v6 ); return a1 + 100 * v7; } return v2; }
func0: ENDBR64 PUSH R15 MOV EDX,0xa PUSH R14 PUSH R13 MOV R13,RDI ADD RDI,0x32 PUSH R12 PUSH RBP MOV EBP,ESI XOR ESI,ESI PUSH RBX SUB RSP,0x8 CALL 0x001010b0 CMP EBP,0x1 JLE 0x00101382 MOV EBX,EAX LEA R15,[R13 + 0x96] MOV R14D,0x1 XOR R12D,R12D NOP LAB_00101350: XOR ESI,ESI MOV EDX,0xa MOV RDI,R15 CALL 0x001010b0 CMP EAX,EBX JGE 0x00101368 MOV EBX,EAX MOVSXD R12,R14D LAB_00101368: ADD R14D,0x1 ADD R15,0x64 CMP EBP,R14D JNZ 0x00101350 LEA RAX,[R12 + R12*0x4] LEA RAX,[RAX + RAX*0x4] LEA R13,[R13 + RAX*0x4] LAB_00101382: ADD RSP,0x8 MOV RAX,R13 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
long func0(long param_1,int param_2) { ulong uVar1; ulong uVar2; long lVar3; int iVar4; char *__nptr; uVar1 = strtol((char *)(param_1 + 0x32),(char **)0x0,10); if (1 < param_2) { uVar1 = uVar1 & 0xffffffff; __nptr = (char *)(param_1 + 0x96); iVar4 = 1; lVar3 = 0; do { uVar2 = strtol(__nptr,(char **)0x0,10); if ((int)uVar2 < (int)uVar1) { uVar1 = uVar2 & 0xffffffff; lVar3 = (long)iVar4; } iVar4 = iVar4 + 1; __nptr = __nptr + 100; } while (param_2 != iVar4); param_1 = param_1 + lVar3 * 100; } return param_1; }
4,271
func0
#include <assert.h> #include <string.h> #include <stdlib.h>
char* func0(char test_list[][2][50], int size){ int min_index = 0; int min_value = atoi(test_list[0][1]); for (int i = 1; i < size; i++) { int current_value = atoi(test_list[i][1]); if (current_value < min_value) { min_value = current_value; min_index = i; } } return test_list[min_index][0]; }
int main() { char list1[3][2][50] = {{"Rash", "143"}, {"Manjeet", "200"}, {"Varsha", "100"}}; char list2[3][2][50] = {{"Yash", "185"}, {"Dawood", "125"}, {"Sanya", "175"}}; char list3[3][2][50] = {{"Sai", "345"}, {"Salman", "145"}, {"Ayesha", "96"}}; assert(strcmp(func0(list1, 3), "Varsha") == 0); assert(strcmp(func0(list2, 3), "Dawood") == 0); assert(strcmp(func0(list3, 3), "Ayesha") == 0); return 0; }
O3
c
func0: endbr64 push %r15 mov $0xa,%edx push %r14 push %r13 mov %rdi,%r13 add $0x32,%rdi push %r12 push %rbp mov %esi,%ebp xor %esi,%esi push %rbx sub $0x8,%rsp callq 1090 <strtol@plt> cmp $0x1,%ebp jle 1372 <func0+0x72> mov %eax,%ebx lea 0x96(%r13),%r15 mov $0x1,%r14d xor %r12d,%r12d xchg %ax,%ax xor %esi,%esi mov $0xa,%edx mov %r15,%rdi callq 1090 <strtol@plt> cmp %ebx,%eax jge 1358 <func0+0x58> mov %eax,%ebx movslq %r14d,%r12 add $0x1,%r14d add $0x64,%r15 cmp %r14d,%ebp jne 1340 <func0+0x40> lea (%r12,%r12,4),%rax lea (%rax,%rax,4),%rax lea 0x0(%r13,%rax,4),%r13 add $0x8,%rsp mov %r13,%rax 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 mov edx, 0Ah; base push r14 push r13 mov r13, rdi add rdi, 32h ; '2'; nptr push r12 mov r12d, esi xor esi, esi; endptr push rbp push rbx sub rsp, 8 call _strtol cmp r12d, 1 jle short loc_1384 mov ebp, eax lea r14, [r13+96h] mov ebx, 1 xor r15d, r15d nop loc_1350: xor esi, esi; endptr mov rdi, r14; nptr mov edx, 0Ah; base call _strtol cmp eax, ebp cmovl ebp, eax cmovl r15d, ebx add ebx, 1 add r14, 64h ; 'd' cmp r12d, ebx jnz short loc_1350 movsxd r15, r15d lea rax, [r15+r15*4] lea rax, [rax+rax*4] lea r13, [r13+rax*4+0] loc_1384: add rsp, 8 mov rax, r13 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(long long a1, int a2) { long long v2; // r13 int v3; // eax int v4; // ebp const char *v5; // r14 int v6; // ebx int v7; // r15d int v8; // eax v2 = a1; v3 = strtol((const char *)(a1 + 50), 0LL, 10); if ( a2 > 1 ) { v4 = v3; v5 = (const char *)(a1 + 150); v6 = 1; v7 = 0; do { v8 = strtol(v5, 0LL, 10); if ( v8 < v4 ) { v4 = v8; v7 = v6; } ++v6; v5 += 100; } while ( a2 != v6 ); return a1 + 100LL * v7; } return v2; }
func0: ENDBR64 PUSH R15 MOV EDX,0xa PUSH R14 PUSH R13 MOV R13,RDI ADD RDI,0x32 PUSH R12 MOV R12D,ESI XOR ESI,ESI PUSH RBP PUSH RBX SUB RSP,0x8 CALL 0x001010b0 CMP R12D,0x1 JLE 0x00101384 MOV EBP,EAX LEA R14,[R13 + 0x96] MOV EBX,0x1 XOR R15D,R15D NOP LAB_00101350: XOR ESI,ESI MOV RDI,R14 MOV EDX,0xa CALL 0x001010b0 CMP EAX,EBP CMOVL EBP,EAX CMOVL R15D,EBX ADD EBX,0x1 ADD R14,0x64 CMP R12D,EBX JNZ 0x00101350 MOVSXD R15,R15D LEA RAX,[R15 + R15*0x4] LEA RAX,[RAX + RAX*0x4] LEA R13,[R13 + RAX*0x4] LAB_00101384: ADD RSP,0x8 MOV RAX,R13 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
long func0(long param_1,int param_2) { ulong uVar1; ulong uVar2; int iVar3; char *__nptr; int iVar4; uVar1 = strtol((char *)(param_1 + 0x32),(char **)0x0,10); if (1 < param_2) { uVar1 = uVar1 & 0xffffffff; __nptr = (char *)(param_1 + 0x96); iVar3 = 1; iVar4 = 0; do { uVar2 = strtol(__nptr,(char **)0x0,10); if ((int)uVar2 < (int)uVar1) { uVar1 = uVar2 & 0xffffffff; iVar4 = iVar3; } iVar3 = iVar3 + 1; __nptr = __nptr + 100; } while (param_2 != iVar3); param_1 = param_1 + (long)iVar4 * 100; } return param_1; }
4,272
func0
#include <assert.h> #include <string.h>
int func0(char lst[][50], int size) { int minLength = strlen(lst[0]); for (int i = 1; i < size; i++) { int length = strlen(lst[i]); if (length < minLength) { minLength = length; } } return minLength; }
int main() { char list1[][50] = {"1", "12"}; char list2[][50] = {"12", "123", "1234"}; char list3[][50] = {"333", "4444"}; assert(func0(list1, 2) == 1); assert(func0(list2, 3) == 2); assert(func0(list3, 2) == 3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 1070 <strlen@plt> mov %eax,-0xc(%rbp) movl $0x1,-0x8(%rbp) jmp 11f9 <func0+0x70> mov -0x8(%rbp),%eax movslq %eax,%rdx mov %rdx,%rax shl $0x2,%rax add %rdx,%rax lea 0x0(,%rax,4),%rdx add %rdx,%rax add %rax,%rax mov %rax,%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov %rax,%rdi callq 1070 <strlen@plt> mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0xc(%rbp),%eax jge 11f5 <func0+0x6c> mov -0x4(%rbp),%eax mov %eax,-0xc(%rbp) addl $0x1,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x1c(%rbp),%eax jl 11b4 <func0+0x2b> mov -0xc(%rbp),%eax leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+s], rdi mov [rbp+var_1C], esi mov rax, [rbp+s] mov rdi, rax; s call _strlen mov [rbp+var_C], eax mov [rbp+var_8], 1 jmp short loc_11F9 loc_11B4: mov eax, [rbp+var_8] movsxd rdx, eax mov rax, rdx shl rax, 2 add rax, rdx lea rdx, ds:0[rax*4] add rax, rdx add rax, rax mov rdx, rax mov rax, [rbp+s] add rax, rdx mov rdi, rax; s call _strlen mov [rbp+var_4], eax mov eax, [rbp+var_4] cmp eax, [rbp+var_C] jge short loc_11F5 mov eax, [rbp+var_4] mov [rbp+var_C], eax loc_11F5: add [rbp+var_8], 1 loc_11F9: mov eax, [rbp+var_8] cmp eax, [rbp+var_1C] jl short loc_11B4 mov eax, [rbp+var_C] leave retn
long long func0(const char *a1, int a2) { unsigned int v3; // [rsp+14h] [rbp-Ch] int i; // [rsp+18h] [rbp-8h] int v5; // [rsp+1Ch] [rbp-4h] v3 = strlen(a1); for ( i = 1; i < a2; ++i ) { v5 = strlen(&a1[50 * i]); if ( v5 < (int)v3 ) v3 = v5; } return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101070 MOV dword ptr [RBP + -0xc],EAX MOV dword ptr [RBP + -0x8],0x1 JMP 0x001011f9 LAB_001011b4: MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX MOV RAX,RDX SHL RAX,0x2 ADD RAX,RDX LEA RDX,[RAX*0x4] ADD RAX,RDX ADD RAX,RAX MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV RDI,RAX CALL 0x00101070 MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0xc] JGE 0x001011f5 MOV EAX,dword ptr [RBP + -0x4] MOV dword ptr [RBP + -0xc],EAX LAB_001011f5: ADD dword ptr [RBP + -0x8],0x1 LAB_001011f9: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011b4 MOV EAX,dword ptr [RBP + -0xc] LEAVE RET
int func0(char *param_1,int param_2) { size_t sVar1; int local_14; int local_10; sVar1 = strlen(param_1); local_14 = (int)sVar1; for (local_10 = 1; local_10 < param_2; local_10 = local_10 + 1) { sVar1 = strlen(param_1 + (long)local_10 * 0x32); if ((int)sVar1 < local_14) { local_14 = (int)sVar1; } } return local_14; }
4,273
func0
#include <assert.h> #include <string.h>
int func0(char lst[][50], int size) { int minLength = strlen(lst[0]); for (int i = 1; i < size; i++) { int length = strlen(lst[i]); if (length < minLength) { minLength = length; } } return minLength; }
int main() { char list1[][50] = {"1", "12"}; char list2[][50] = {"12", "123", "1234"}; char list3[][50] = {"333", "4444"}; assert(func0(list1, 2) == 1); assert(func0(list2, 3) == 2); assert(func0(list3, 2) == 3); return 0; }
O1
c
func0: endbr64 mov %rdi,%r9 mov $0xffffffffffffffff,%rcx mov $0x0,%eax repnz scas %es:(%rdi),%al not %rcx lea -0x1(%rcx),%r8d cmp $0x1,%esi jle 11c9 <func0+0x60> lea 0x32(%r9),%rdx lea -0x2(%rsi),%eax lea (%rax,%rax,4),%rax lea (%rax,%rax,4),%rax lea 0x64(%r9,%rax,2),%r9 mov $0xffffffffffffffff,%rsi mov $0x0,%eax mov %rsi,%rcx mov %rdx,%rdi repnz scas %es:(%rdi),%al not %rcx sub $0x1,%rcx cmp %ecx,%r8d cmovg %ecx,%r8d add $0x32,%rdx cmp %r9,%rdx jne 11aa <func0+0x41> mov %r8d,%eax retq
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov r12, rdi mov r13d, esi call _strlen mov ebp, eax cmp r13d, 1 jle short loc_11D6 lea rbx, [r12+32h] lea eax, [r13-2] lea rax, [rax+rax*4] lea rax, [rax+rax*4] lea r12, [r12+rax*2+64h] loc_11C0: mov rdi, rbx call _strlen cmp ebp, eax cmovg ebp, eax add rbx, 32h ; '2' cmp rbx, r12 jnz short loc_11C0 loc_11D6: mov eax, ebp add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn
long long func0(long long a1, int a2) { unsigned int v2; // ebp long long v3; // rbx int v4; // eax v2 = ((long long (*)(void))strlen)(); if ( a2 > 1 ) { v3 = a1 + 50; do { v4 = strlen(v3); if ( (int)v2 > v4 ) v2 = v4; v3 += 50LL; } while ( v3 != a1 + 50LL * (unsigned int)(a2 - 2) + 100 ); } return v2; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R12,RDI MOV R13D,ESI CALL 0x00101070 MOV EBP,EAX CMP R13D,0x1 JLE 0x001011d6 LEA RBX,[R12 + 0x32] LEA EAX,[R13 + -0x2] LEA RAX,[RAX + RAX*0x4] LEA RAX,[RAX + RAX*0x4] LEA R12,[R12 + RAX*0x2 + 0x64] LAB_001011c0: MOV RDI,RBX CALL 0x00101070 CMP EBP,EAX CMOVG EBP,EAX ADD RBX,0x32 CMP RBX,R12 JNZ 0x001011c0 LAB_001011d6: MOV EAX,EBP ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET
ulong func0(char *param_1,int param_2) { size_t sVar1; char *__s; ulong uVar2; sVar1 = strlen(param_1); uVar2 = sVar1 & 0xffffffff; if (1 < param_2) { __s = param_1 + 0x32; do { sVar1 = strlen(__s); if ((int)sVar1 < (int)uVar2) { uVar2 = sVar1 & 0xffffffff; } __s = __s + 0x32; } while (__s != param_1 + (ulong)(param_2 - 2) * 0x32 + 100); } return uVar2; }
4,274
func0
#include <assert.h> #include <string.h>
int func0(char lst[][50], int size) { int minLength = strlen(lst[0]); for (int i = 1; i < size; i++) { int length = strlen(lst[i]); if (length < minLength) { minLength = length; } } return minLength; }
int main() { char list1[][50] = {"1", "12"}; char list2[][50] = {"12", "123", "1234"}; char list3[][50] = {"333", "4444"}; assert(func0(list1, 2) == 1); assert(func0(list2, 3) == 2); assert(func0(list3, 2) == 3); return 0; }
O2
c
func0: endbr64 push %r13 mov %esi,%r13d push %r12 push %rbp mov %rdi,%rbp push %rbx sub $0x8,%rsp callq 1070 <strlen@plt> mov %eax,%r12d cmp $0x1,%r13d jle 1408 <func0+0x58> lea -0x2(%r13),%eax lea 0x32(%rbp),%rbx lea (%rax,%rax,4),%rax lea (%rax,%rax,4),%rax lea 0x64(%rbp,%rax,2),%rbp nopw 0x0(%rax,%rax,1) mov %rbx,%rdi callq 1070 <strlen@plt> cmp %eax,%r12d cmovg %eax,%r12d add $0x32,%rbx cmp %rbp,%rbx jne 13f0 <func0+0x40> add $0x8,%rsp mov %r12d,%eax pop %rbx pop %rbp pop %r12 pop %r13 retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r13 mov r13d, esi push r12 push rbp mov rbp, rdi push rbx sub rsp, 8 call _strlen mov r12d, eax cmp r13d, 1 jle short loc_1408 lea eax, [r13-2] lea rbx, [rbp+32h] lea rax, [rax+rax*4] lea rax, [rax+rax*4] lea rbp, [rbp+rax*2+64h] nop word ptr [rax+rax+00000000h] loc_13F0: mov rdi, rbx call _strlen cmp r12d, eax cmovg r12d, eax add rbx, 32h ; '2' cmp rbx, rbp jnz short loc_13F0 loc_1408: add rsp, 8 mov eax, r12d pop rbx pop rbp pop r12 pop r13 retn
long long func0(long long a1, int a2) { unsigned int v2; // r12d long long v3; // rbx int v4; // eax v2 = ((long long (*)(void))strlen)(); if ( a2 > 1 ) { v3 = a1 + 50; do { v4 = strlen(v3); if ( (int)v2 > v4 ) v2 = v4; v3 += 50LL; } while ( v3 != a1 + 50LL * (unsigned int)(a2 - 2) + 100 ); } return v2; }
func0: ENDBR64 PUSH R13 MOV R13D,ESI PUSH R12 PUSH RBP MOV RBP,RDI PUSH RBX SUB RSP,0x8 CALL 0x00101070 MOV R12D,EAX CMP R13D,0x1 JLE 0x00101408 LEA EAX,[R13 + -0x2] LEA RBX,[RBP + 0x32] LEA RAX,[RAX + RAX*0x4] LEA RAX,[RAX + RAX*0x4] LEA RBP,[RBP + RAX*0x2 + 0x64] NOP word ptr [RAX + RAX*0x1] LAB_001013f0: MOV RDI,RBX CALL 0x00101070 CMP R12D,EAX CMOVG R12D,EAX ADD RBX,0x32 CMP RBX,RBP JNZ 0x001013f0 LAB_00101408: ADD RSP,0x8 MOV EAX,R12D POP RBX POP RBP POP R12 POP R13 RET
ulong func0(char *param_1,int param_2) { size_t sVar1; char *__s; ulong uVar2; sVar1 = strlen(param_1); uVar2 = sVar1 & 0xffffffff; if (1 < param_2) { __s = param_1 + 0x32; do { sVar1 = strlen(__s); if ((int)sVar1 < (int)uVar2) { uVar2 = sVar1 & 0xffffffff; } __s = __s + 0x32; } while (__s != param_1 + (ulong)(param_2 - 2) * 0x32 + 100); } return uVar2; }
4,275
func0
#include <assert.h> #include <string.h>
int func0(char lst[][50], int size) { int minLength = strlen(lst[0]); for (int i = 1; i < size; i++) { int length = strlen(lst[i]); if (length < minLength) { minLength = length; } } return minLength; }
int main() { char list1[][50] = {"1", "12"}; char list2[][50] = {"12", "123", "1234"}; char list3[][50] = {"333", "4444"}; assert(func0(list1, 2) == 1); assert(func0(list2, 3) == 2); assert(func0(list3, 2) == 3); return 0; }
O3
c
func0: endbr64 push %r13 mov %esi,%r13d push %r12 push %rbp mov %rdi,%rbp push %rbx sub $0x8,%rsp callq 1070 <strlen@plt> mov %eax,%r12d cmp $0x1,%r13d jle 1408 <func0+0x58> lea -0x2(%r13),%eax lea 0x32(%rbp),%rbx lea (%rax,%rax,4),%rax lea (%rax,%rax,4),%rax lea 0x64(%rbp,%rax,2),%rbp nopw 0x0(%rax,%rax,1) mov %rbx,%rdi callq 1070 <strlen@plt> cmp %eax,%r12d cmovg %eax,%r12d add $0x32,%rbx cmp %rbx,%rbp jne 13f0 <func0+0x40> add $0x8,%rsp mov %r12d,%eax pop %rbx pop %rbp pop %r12 pop %r13 retq nopw %cs:0x0(%rax,%rax,1)
func0: endbr64 push r13 mov r13d, esi push r12 mov r12, rdi push rbp push rbx sub rsp, 8 call _strlen mov ebp, eax cmp r13d, 1 jle short loc_13F6 lea eax, [r13-2] lea rbx, [r12+32h] lea rax, [rax+rax*4] lea rax, [rax+rax*4] lea r12, [r12+rax*2+64h] nop word ptr [rax+rax+00000000h] loc_13E0: mov rdi, rbx; s call _strlen cmp ebp, eax cmovg ebp, eax add rbx, 32h ; '2' cmp r12, rbx jnz short loc_13E0 loc_13F6: add rsp, 8 mov eax, ebp pop rbx pop rbp pop r12 pop r13 retn
long long func0(const char *a1, int a2) { unsigned int v2; // ebp const char *v3; // rbx int v4; // eax v2 = strlen(a1); if ( a2 > 1 ) { v3 = a1 + 50; do { v4 = strlen(v3); if ( (int)v2 > v4 ) v2 = v4; v3 += 50; } while ( &a1[50 * (a2 - 2) + 100] != v3 ); } return v2; }
func0: ENDBR64 PUSH R13 MOV R13D,ESI PUSH R12 MOV R12,RDI PUSH RBP PUSH RBX SUB RSP,0x8 CALL 0x00101070 MOV EBP,EAX CMP R13D,0x1 JLE 0x001013f6 LEA EAX,[R13 + -0x2] LEA RBX,[R12 + 0x32] LEA RAX,[RAX + RAX*0x4] LEA RAX,[RAX + RAX*0x4] LEA R12,[R12 + RAX*0x2 + 0x64] NOP word ptr [RAX + RAX*0x1] LAB_001013e0: MOV RDI,RBX CALL 0x00101070 CMP EBP,EAX CMOVG EBP,EAX ADD RBX,0x32 CMP R12,RBX JNZ 0x001013e0 LAB_001013f6: ADD RSP,0x8 MOV EAX,EBP POP RBX POP RBP POP R12 POP R13 RET
ulong func0(char *param_1,int param_2) { size_t sVar1; char *__s; ulong uVar2; sVar1 = strlen(param_1); uVar2 = sVar1 & 0xffffffff; if (1 < param_2) { __s = param_1 + 0x32; do { sVar1 = strlen(__s); if ((int)sVar1 < (int)uVar2) { uVar2 = sVar1 & 0xffffffff; } __s = __s + 0x32; } while (param_1 + (ulong)(param_2 - 2) * 0x32 + 100 != __s); } return uVar2; }
4,276
func0
#include <assert.h> #include <stdio.h>
int func0(int n) { int count = 0; for (int i = 1; i <= n; i++) { if (n % i == 0) { count++; } } return count; }
int main() { assert(func0(15) == 4); assert(func0(12) == 6); assert(func0(9) == 3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) movl $0x0,-0x8(%rbp) movl $0x1,-0x4(%rbp) jmp 1179 <func0+0x30> mov -0x14(%rbp),%eax cltd idivl -0x4(%rbp) mov %edx,%eax test %eax,%eax jne 1175 <func0+0x2c> addl $0x1,-0x8(%rbp) addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x14(%rbp),%eax jle 1164 <func0+0x1b> mov -0x8(%rbp),%eax pop %rbp retq
func0: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_8], 0 mov [rbp+var_4], 1 jmp short loc_1179 loc_1164: mov eax, [rbp+var_14] cdq idiv [rbp+var_4] mov eax, edx test eax, eax jnz short loc_1175 add [rbp+var_8], 1 loc_1175: add [rbp+var_4], 1 loc_1179: mov eax, [rbp+var_4] cmp eax, [rbp+var_14] jle short loc_1164 mov eax, [rbp+var_8] pop rbp retn
long long func0(int a1) { unsigned int v2; // [rsp+Ch] [rbp-8h] int i; // [rsp+10h] [rbp-4h] v2 = 0; for ( i = 1; i <= a1; ++i ) { if ( !(a1 % i) ) ++v2; } return v2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x1 JMP 0x00101179 LAB_00101164: MOV EAX,dword ptr [RBP + -0x14] CDQ IDIV dword ptr [RBP + -0x4] MOV EAX,EDX TEST EAX,EAX JNZ 0x00101175 ADD dword ptr [RBP + -0x8],0x1 LAB_00101175: ADD dword ptr [RBP + -0x4],0x1 LAB_00101179: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x14] JLE 0x00101164 MOV EAX,dword ptr [RBP + -0x8] POP RBP RET
int func0(int param_1) { int4 local_10; int4 local_c; local_10 = 0; for (local_c = 1; local_c <= param_1; local_c = local_c + 1) { if (param_1 % local_c == 0) { local_10 = local_10 + 1; } } return local_10; }
4,277
func0
#include <assert.h> #include <stdio.h>
int func0(int n) { int count = 0; for (int i = 1; i <= n; i++) { if (n % i == 0) { count++; } } return count; }
int main() { assert(func0(15) == 4); assert(func0(12) == 6); assert(func0(9) == 3); return 0; }
O1
c
func0: endbr64 test %edi,%edi jle 1175 <func0+0x2c> lea 0x1(%rdi),%r8d mov $0x1,%ecx mov $0x0,%esi mov %edi,%eax cltd idiv %ecx cmp $0x1,%edx adc $0x0,%esi add $0x1,%ecx cmp %r8d,%ecx jne 115f <func0+0x16> mov %esi,%eax retq mov $0x0,%esi jmp 1172 <func0+0x29>
func0: endbr64 test edi, edi jle short loc_1175 lea r8d, [rdi+1] mov ecx, 1 mov esi, 0 loc_115F: mov eax, edi cdq idiv ecx cmp edx, 1 adc esi, 0 add ecx, 1 cmp ecx, r8d jnz short loc_115F loc_1172: mov eax, esi retn loc_1175: mov esi, 0 jmp short loc_1172
long long func0(int a1) { int v1; // ecx unsigned int v2; // esi if ( a1 <= 0 ) { return 0; } else { v1 = 1; v2 = 0; do v2 += a1 % v1++ == 0; while ( v1 != a1 + 1 ); } return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101175 LEA R8D,[RDI + 0x1] MOV ECX,0x1 MOV ESI,0x0 LAB_0010115f: MOV EAX,EDI CDQ IDIV ECX CMP EDX,0x1 ADC ESI,0x0 ADD ECX,0x1 CMP ECX,R8D JNZ 0x0010115f LAB_00101172: MOV EAX,ESI RET LAB_00101175: MOV ESI,0x0 JMP 0x00101172
int func0(int param_1) { int iVar1; int iVar2; if (param_1 < 1) { iVar2 = 0; } else { iVar1 = 1; iVar2 = 0; do { iVar2 = iVar2 + (uint)(param_1 % iVar1 == 0); iVar1 = iVar1 + 1; } while (iVar1 != param_1 + 1); } return iVar2; }
4,278
func0
#include <assert.h> #include <stdio.h>
int func0(int n) { int count = 0; for (int i = 1; i <= n; i++) { if (n % i == 0) { count++; } } return count; }
int main() { assert(func0(15) == 4); assert(func0(12) == 6); assert(func0(9) == 3); return 0; }
O2
c
func0: endbr64 test %edi,%edi jle 1270 <func0+0x30> lea 0x1(%rdi),%esi mov $0x1,%ecx xor %r8d,%r8d nopl 0x0(%rax,%rax,1) mov %edi,%eax cltd idiv %ecx cmp $0x1,%edx adc $0x0,%r8d add $0x1,%ecx cmp %esi,%ecx jne 1258 <func0+0x18> mov %r8d,%eax retq xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 test edi, edi jle short loc_1270 lea esi, [rdi+1] mov ecx, 1 xor r8d, r8d nop dword ptr [rax+rax+00h] loc_1258: mov eax, edi cdq idiv ecx cmp edx, 1 adc r8d, 0 add ecx, 1 cmp ecx, esi jnz short loc_1258 mov eax, r8d retn loc_1270: xor r8d, r8d mov eax, r8d retn
long long func0(int a1) { int v1; // ecx unsigned int v2; // r8d if ( a1 <= 0 ) return 0LL; v1 = 1; v2 = 0; do v2 += a1 % v1++ == 0; while ( v1 != a1 + 1 ); return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101270 LEA ESI,[RDI + 0x1] MOV ECX,0x1 XOR R8D,R8D NOP dword ptr [RAX + RAX*0x1] LAB_00101258: MOV EAX,EDI CDQ IDIV ECX CMP EDX,0x1 ADC R8D,0x0 ADD ECX,0x1 CMP ECX,ESI JNZ 0x00101258 MOV EAX,R8D RET LAB_00101270: XOR R8D,R8D MOV EAX,R8D RET
int func0(int param_1) { int iVar1; int iVar2; if (0 < param_1) { iVar1 = 1; iVar2 = 0; do { iVar2 = iVar2 + (uint)(param_1 % iVar1 == 0); iVar1 = iVar1 + 1; } while (iVar1 != param_1 + 1); return iVar2; } return 0; }
4,279
func0
#include <assert.h> #include <stdio.h>
int func0(int n) { int count = 0; for (int i = 1; i <= n; i++) { if (n % i == 0) { count++; } } return count; }
int main() { assert(func0(15) == 4); assert(func0(12) == 6); assert(func0(9) == 3); return 0; }
O3
c
func0: endbr64 test %edi,%edi jle 1170 <func0+0x30> lea 0x1(%rdi),%esi mov $0x1,%ecx xor %r8d,%r8d nopl 0x0(%rax,%rax,1) mov %edi,%eax cltd idiv %ecx cmp $0x1,%edx adc $0x0,%r8d add $0x1,%ecx cmp %ecx,%esi jne 1158 <func0+0x18> mov %r8d,%eax retq xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
func0: endbr64 test edi, edi jle short loc_1170 lea r8d, [rdi+1] mov ecx, 1 xor esi, esi nop dword ptr [rax+rax+00h] loc_1158: mov eax, edi cdq idiv ecx cmp edx, 1 adc esi, 0 add ecx, 1 cmp r8d, ecx jnz short loc_1158 mov eax, esi retn loc_1170: xor esi, esi mov eax, esi retn
long long func0(int a1) { int v1; // ecx unsigned int v2; // esi if ( a1 <= 0 ) return 0LL; v1 = 1; v2 = 0; do v2 += a1 % v1++ == 0; while ( a1 + 1 != v1 ); return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101170 LEA R8D,[RDI + 0x1] MOV ECX,0x1 XOR ESI,ESI NOP dword ptr [RAX + RAX*0x1] LAB_00101158: MOV EAX,EDI CDQ IDIV ECX CMP EDX,0x1 ADC ESI,0x0 ADD ECX,0x1 CMP R8D,ECX JNZ 0x00101158 MOV EAX,ESI RET LAB_00101170: XOR ESI,ESI MOV EAX,ESI RET
int func0(int param_1) { int iVar1; int iVar2; if (0 < param_1) { iVar1 = 1; iVar2 = 0; do { iVar2 = iVar2 + (uint)(param_1 % iVar1 == 0); iVar1 = iVar1 + 1; } while (param_1 + 1 != iVar1); return iVar2; } return 0; }
4,280
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int key; int value; } Pair; typedef struct { Pair *pairs; int size; int capacity; } Dictionary; void init_dictionary(Dictionary *dict) { dict->capacity = 10; dict->size = 0; dict->pairs = (Pair *)malloc(dict->capacity * sizeof(Pair)); } void free_dictionary(Dictionary *dict) { free(dict->pairs); } void dictionary_add(Dictionary *dict, int key) { for (int i = 0; i < dict->size; i++) { if (dict->pairs[i].key == key) { dict->pairs[i].value += 1; return; } } if (dict->size == dict->capacity) { dict->capacity *= 2; dict->pairs = (Pair *)realloc(dict->pairs, dict->capacity * sizeof(Pair)); } dict->pairs[dict->size].key = key; dict->pairs[dict->size].value = 1; dict->size += 1; }
Dictionary func0(int list1[][4], int numLists) { Dictionary dict; init_dictionary(&dict); for (int i = 0; i < numLists; i++) { for (int j = 0; j < 4; j++) { dictionary_add(&dict, list1[i][j]); } } return dict; }
int main() { int list1[3][4] = {{1, 2, 3, 2}, {4, 5, 6, 2}, {7, 8, 9, 5}}; Dictionary result1 = func0(list1, 3); assert(result1.size == 9); assert(result1.pairs[1].value == 3); assert(result1.pairs[4].value == 2); int list2[3][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}; Dictionary result2 = func0(list2, 3); assert(result2.size == 12); for (int i = 0; i < result2.size; i++) { assert(result2.pairs[i].value == 1); } int list3[3][4] = {{20, 30, 40, 17}, {18, 16, 14, 13}, {10, 20, 30, 40}}; Dictionary result3 = func0(list3, 3); assert(result3.size == 9); assert(result3.pairs[0].value == 2); assert(result3.pairs[1].value == 2); assert(result3.pairs[2].value == 2); free_dictionary(&result1); free_dictionary(&result2); free_dictionary(&result3); return 0; }
O0
c
func0: endbr64 push %rbp mov %rsp,%rbp sub $0x40,%rsp mov %rdi,-0x38(%rbp) mov %esi,-0x3c(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax lea -0x20(%rbp),%rax mov %rax,%rdi callq 11c9 <init_dictionary> movl $0x0,-0x28(%rbp) jmp 13c1 <func0+0x77> movl $0x0,-0x24(%rbp) jmp 13b7 <func0+0x6d> mov -0x28(%rbp),%eax cltq shl $0x4,%rax mov %rax,%rdx mov -0x38(%rbp),%rax add %rax,%rdx mov -0x24(%rbp),%eax cltq mov (%rdx,%rax,4),%edx lea -0x20(%rbp),%rax mov %edx,%esi mov %rax,%rdi callq 1233 <dictionary_add> addl $0x1,-0x24(%rbp) cmpl $0x3,-0x24(%rbp) jle 138a <func0+0x40> addl $0x1,-0x28(%rbp) mov -0x28(%rbp),%eax cmp -0x3c(%rbp),%eax jl 1381 <func0+0x37> mov -0x20(%rbp),%rax mov -0x18(%rbp),%rdx mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 13e5 <func0+0x9b> callq 10a0 <__stack_chk_fail@plt> leaveq retq
func0: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_38], rdi mov [rbp+var_3C], esi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax lea rax, [rbp+var_20] mov rdi, rax call init_dictionary mov [rbp+var_28], 0 jmp short loc_13C1 loc_1381: mov [rbp+var_24], 0 jmp short loc_13B7 loc_138A: mov eax, [rbp+var_28] cdqe shl rax, 4 mov rdx, rax mov rax, [rbp+var_38] add rdx, rax mov eax, [rbp+var_24] cdqe mov edx, [rdx+rax*4] lea rax, [rbp+var_20] mov esi, edx mov rdi, rax call dictionary_add add [rbp+var_24], 1 loc_13B7: cmp [rbp+var_24], 3 jle short loc_138A add [rbp+var_28], 1 loc_13C1: mov eax, [rbp+var_28] cmp eax, [rbp+var_3C] jl short loc_1381 mov rax, [rbp+var_20] mov rdx, [rbp+var_18] mov rcx, [rbp+var_8] sub rcx, fs:28h jz short locret_13E5 call ___stack_chk_fail locret_13E5: leave retn
long long func0(long long a1, int a2) { int i; // [rsp+18h] [rbp-28h] int j; // [rsp+1Ch] [rbp-24h] _QWORD v5[4]; // [rsp+20h] [rbp-20h] BYREF v5[3] = __readfsqword(0x28u); init_dictionary(v5); for ( i = 0; i < a2; ++i ) { for ( j = 0; j <= 3; ++j ) dictionary_add(v5, *(unsigned int *)(a1 + 16LL * i + 4LL * j)); } return v5[0]; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x38],RDI MOV dword ptr [RBP + -0x3c],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX LEA RAX,[RBP + -0x20] MOV RDI,RAX CALL 0x001011c9 MOV dword ptr [RBP + -0x28],0x0 JMP 0x001013c1 LAB_00101381: MOV dword ptr [RBP + -0x24],0x0 JMP 0x001013b7 LAB_0010138a: MOV EAX,dword ptr [RBP + -0x28] CDQE SHL RAX,0x4 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x38] ADD RDX,RAX MOV EAX,dword ptr [RBP + -0x24] CDQE MOV EDX,dword ptr [RDX + RAX*0x4] LEA RAX,[RBP + -0x20] MOV ESI,EDX MOV RDI,RAX CALL 0x00101233 ADD dword ptr [RBP + -0x24],0x1 LAB_001013b7: CMP dword ptr [RBP + -0x24],0x3 JLE 0x0010138a ADD dword ptr [RBP + -0x28],0x1 LAB_001013c1: MOV EAX,dword ptr [RBP + -0x28] CMP EAX,dword ptr [RBP + -0x3c] JL 0x00101381 MOV RAX,qword ptr [RBP + -0x20] MOV RDX,qword ptr [RBP + -0x18] MOV RCX,qword ptr [RBP + -0x8] SUB RCX,qword ptr FS:[0x28] JZ 0x001013e5 CALL 0x001010a0 LAB_001013e5: LEAVE RET
int8 func0(long param_1,int param_2) { long in_FS_OFFSET; int local_30; int local_2c; int8 local_28 [3]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); init_dictionary(local_28); for (local_30 = 0; local_30 < param_2; local_30 = local_30 + 1) { for (local_2c = 0; local_2c < 4; local_2c = local_2c + 1) { dictionary_add(local_28,*(int4 *)((long)local_30 * 0x10 + param_1 + (long)local_2c * 4)) ; } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_28[0]; }
4,281
func0
#include <stdio.h> #include <assert.h> #include <stdlib.h> typedef struct { int key; int value; } Pair; typedef struct { Pair *pairs; int size; int capacity; } Dictionary; void init_dictionary(Dictionary *dict) { dict->capacity = 10; dict->size = 0; dict->pairs = (Pair *)malloc(dict->capacity * sizeof(Pair)); } void free_dictionary(Dictionary *dict) { free(dict->pairs); } void dictionary_add(Dictionary *dict, int key) { for (int i = 0; i < dict->size; i++) { if (dict->pairs[i].key == key) { dict->pairs[i].value += 1; return; } } if (dict->size == dict->capacity) { dict->capacity *= 2; dict->pairs = (Pair *)realloc(dict->pairs, dict->capacity * sizeof(Pair)); } dict->pairs[dict->size].key = key; dict->pairs[dict->size].value = 1; dict->size += 1; }
Dictionary func0(int list1[][4], int numLists) { Dictionary dict; init_dictionary(&dict); for (int i = 0; i < numLists; i++) { for (int j = 0; j < 4; j++) { dictionary_add(&dict, list1[i][j]); } } return dict; }
int main() { int list1[3][4] = {{1, 2, 3, 2}, {4, 5, 6, 2}, {7, 8, 9, 5}}; Dictionary result1 = func0(list1, 3); assert(result1.size == 9); assert(result1.pairs[1].value == 3); assert(result1.pairs[4].value == 2); int list2[3][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}; Dictionary result2 = func0(list2, 3); assert(result2.size == 12); for (int i = 0; i < result2.size; i++) { assert(result2.pairs[i].value == 1); } int list3[3][4] = {{20, 30, 40, 17}, {18, 16, 14, 13}, {10, 20, 30, 40}}; Dictionary result3 = func0(list3, 3); assert(result3.size == 9); assert(result3.pairs[0].value == 2); assert(result3.pairs[1].value == 2); assert(result3.pairs[2].value == 2); free_dictionary(&result1); free_dictionary(&result2); free_dictionary(&result3); return 0; }
O1
c
func0: endbr64 push %r13 push %r12 push %rbp push %rbx sub $0x28,%rsp mov %rdi,%r12 mov %esi,%ebx mov %fs:0x28,%rax mov %rax,0x18(%rsp) xor %eax,%eax mov %rsp,%rdi callq 11c9 <init_dictionary> test %ebx,%ebx jle 12e9 <func0+0x67> lea 0x10(%r12),%rbp lea -0x1(%rbx),%eax shl $0x4,%rax lea 0x20(%r12,%rax,1),%r13 mov %rsp,%r12 jmp 12d0 <func0+0x4e> add $0x10,%rbp cmp %r13,%rbp je 12e9 <func0+0x67> lea -0x10(%rbp),%rbx mov (%rbx),%esi mov %r12,%rdi callq 1203 <dictionary_add> add $0x4,%rbx cmp %rbp,%rbx jne 12d4 <func0+0x52> jmp 12c7 <func0+0x45> mov (%rsp),%rax mov 0x8(%rsp),%rdx mov 0x18(%rsp),%rcx xor %fs:0x28,%rcx jne 130d <func0+0x8b> add $0x28,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq callq 10a0 <__stack_chk_fail@plt>
func0: endbr64 push r13 push r12 push rbp push rbx sub rsp, 28h mov r12, rdi mov ebx, esi mov rax, fs:28h mov [rsp+48h+var_30], rax xor eax, eax mov rdi, rsp call init_dictionary test ebx, ebx jle short loc_12E9 lea rbp, [r12+10h] lea eax, [rbx-1] shl rax, 4 lea r13, [r12+rax+20h] mov r12, rsp jmp short loc_12D0 loc_12C7: add rbp, 10h cmp rbp, r13 jz short loc_12E9 loc_12D0: lea rbx, [rbp-10h] loc_12D4: mov esi, [rbx] mov rdi, r12 call dictionary_add add rbx, 4 cmp rbx, rbp jnz short loc_12D4 jmp short loc_12C7 loc_12E9: mov rax, [rsp+48h+var_48] mov rdx, [rsp+48h+var_40] mov rcx, [rsp+48h+var_30] sub rcx, fs:28h jnz short loc_130D add rsp, 28h pop rbx pop rbp pop r12 pop r13 retn loc_130D: call ___stack_chk_fail
long long func0(long long a1, int a2) { unsigned int *v2; // rbp unsigned int *v3; // rbx _QWORD v5[9]; // [rsp+0h] [rbp-48h] BYREF v5[3] = __readfsqword(0x28u); init_dictionary(v5); if ( a2 > 0 ) { v2 = (unsigned int *)(a1 + 16); do { v3 = v2 - 4; do dictionary_add(v5, *v3++); while ( v3 != v2 ); v2 += 4; } while ( v2 != (unsigned int *)(a1 + 16LL * (unsigned int)(a2 - 1) + 32) ); } return v5[0]; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x28 MOV R12,RDI MOV EBX,ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x18],RAX XOR EAX,EAX MOV RDI,RSP CALL 0x001011c9 TEST EBX,EBX JLE 0x001012e9 LEA RBP,[R12 + 0x10] LEA EAX,[RBX + -0x1] SHL RAX,0x4 LEA R13,[R12 + RAX*0x1 + 0x20] MOV R12,RSP JMP 0x001012d0 LAB_001012c7: ADD RBP,0x10 CMP RBP,R13 JZ 0x001012e9 LAB_001012d0: LEA RBX,[RBP + -0x10] LAB_001012d4: MOV ESI,dword ptr [RBX] MOV RDI,R12 CALL 0x00101203 ADD RBX,0x4 CMP RBX,RBP JNZ 0x001012d4 JMP 0x001012c7 LAB_001012e9: MOV RAX,qword ptr [RSP] MOV RDX,qword ptr [RSP + 0x8] MOV RCX,qword ptr [RSP + 0x18] SUB RCX,qword ptr FS:[0x28] JNZ 0x0010130d ADD RSP,0x28 POP RBX POP RBP POP R12 POP R13 RET LAB_0010130d: CALL 0x001010a0
int8 func0(long param_1,int param_2) { int4 *puVar1; int4 *puVar2; long in_FS_OFFSET; int8 local_48 [3]; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); init_dictionary(local_48); if (0 < param_2) { puVar2 = (int4 *)(param_1 + 0x10); do { puVar1 = puVar2 + -4; do { dictionary_add(local_48,*puVar1); puVar1 = puVar1 + 1; } while (puVar1 != puVar2); puVar2 = puVar2 + 4; } while (puVar2 != (int4 *)(param_1 + 0x20 + (ulong)(param_2 - 1) * 0x10)); } if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return local_48[0]; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }