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,982 | func0 | #include <assert.h>
#include <stdio.h>
| int* func0(int test_list[][3], int length, int *output) {
for (int i = 0; i < length; i++) {
output[i] = test_list[i][2];
}
return output;
}
| int main() {
int list1[][3] = {{1, 'R', 21}, {2, 'V', 20}, {3, 'K', 19}};
int list2[][3] = {{1, 'S', 36}, {2, 'A', 25}, {3, 'S', 45}};
int list3[][3] = {{1, 'S', 14}, {2, 'V', 36}, {3, 'D', 56}};
int length1 = sizeof(list1) / sizeof(list1[0]);
int length2 = sizeof(list2) / sizeof(list2[0]);
int length3 = sizeof(list3) / sizeof(list3[0]);
int output1[3], output2[3], output3[3];
func0(list1, length1, output1);
func0(list2, length2, output2);
func0(list3, length3, output3);
assert(output1[0] == 21 && output1[1] == 20 && output1[2] == 19);
assert(output2[0] == 36 && output2[1] == 25 && output2[2] == 45);
assert(output3[0] == 14 && output3[1] == 36 && output3[2] == 56);
printf("All tests passed!\n");
return 0;
}
| O2 | c | func0:
endbr64
mov %rdx,%rax
test %esi,%esi
jle 11a2 <func0+0x32>
mov %rdx,%rcx
lea -0x1(%rsi),%edx
add $0x8,%rdi
lea 0x4(%rax,%rdx,4),%r8
nopw 0x0(%rax,%rax,1)
mov (%rdi),%esi
add $0x4,%rcx
add $0xc,%rdi
mov %esi,-0x4(%rcx)
cmp %r8,%rcx
jne 1190 <func0+0x20>
retq
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
mov rax, rdx
test esi, esi
jle short locret_11A2
mov rcx, rdx
lea edx, [rsi-1]
add rdi, 8
lea r8, [rax+rdx*4+4]
nop word ptr [rax+rax+00h]
loc_1190:
mov esi, [rdi]
add rcx, 4
add rdi, 0Ch
mov [rcx-4], esi
cmp rcx, r8
jnz short loc_1190
locret_11A2:
retn | long long func0(long long a1, int a2, long long a3)
{
long long result; // rax
long long v4; // rcx
int *v5; // rdi
long long v6; // r8
int v7; // esi
result = a3;
if ( a2 > 0 )
{
v4 = a3;
v5 = (int *)(a1 + 8);
v6 = a3 + 4LL * (unsigned int)(a2 - 1) + 4;
do
{
v7 = *v5;
v4 += 4LL;
v5 += 3;
*(_DWORD *)(v4 - 4) = v7;
}
while ( v4 != v6 );
}
return result;
} | func0:
ENDBR64
MOV RAX,RDX
TEST ESI,ESI
JLE 0x001011a2
MOV RCX,RDX
LEA EDX,[RSI + -0x1]
ADD RDI,0x8
LEA R8,[RAX + RDX*0x4 + 0x4]
NOP word ptr [RAX + RAX*0x1]
LAB_00101190:
MOV ESI,dword ptr [RDI]
ADD RCX,0x4
ADD RDI,0xc
MOV dword ptr [RCX + -0x4],ESI
CMP RCX,R8
JNZ 0x00101190
LAB_001011a2:
RET | void func0(long param_1,int param_2,int4 *param_3)
{
int4 uVar1;
int4 *puVar2;
int4 *puVar3;
int4 *puVar4;
if (0 < param_2) {
puVar4 = (int4 *)(param_1 + 8);
puVar2 = param_3;
do {
uVar1 = *puVar4;
puVar3 = puVar2 + 1;
puVar4 = puVar4 + 3;
*puVar2 = uVar1;
puVar2 = puVar3;
} while (puVar3 != param_3 + (ulong)(param_2 - 1) + 1);
}
return;
} |
4,983 | func0 | #include <assert.h>
#include <stdio.h>
| int* func0(int test_list[][3], int length, int *output) {
for (int i = 0; i < length; i++) {
output[i] = test_list[i][2];
}
return output;
}
| int main() {
int list1[][3] = {{1, 'R', 21}, {2, 'V', 20}, {3, 'K', 19}};
int list2[][3] = {{1, 'S', 36}, {2, 'A', 25}, {3, 'S', 45}};
int list3[][3] = {{1, 'S', 14}, {2, 'V', 36}, {3, 'D', 56}};
int length1 = sizeof(list1) / sizeof(list1[0]);
int length2 = sizeof(list2) / sizeof(list2[0]);
int length3 = sizeof(list3) / sizeof(list3[0]);
int output1[3], output2[3], output3[3];
func0(list1, length1, output1);
func0(list2, length2, output2);
func0(list3, length3, output3);
assert(output1[0] == 21 && output1[1] == 20 && output1[2] == 19);
assert(output2[0] == 36 && output2[1] == 25 && output2[2] == 45);
assert(output3[0] == 14 && output3[1] == 36 && output3[2] == 56);
printf("All tests passed!\n");
return 0;
}
| O3 | c | func0:
endbr64
mov %rdx,%rax
test %esi,%esi
jle 1272 <func0+0x102>
movslq %esi,%rdx
lea 0x8(%rdi),%rcx
lea -0x1(%rsi),%r8d
lea (%rax,%rdx,4),%r9
lea (%rdx,%rdx,2),%rdx
cmp %r9,%rcx
lea (%rdi,%rdx,4),%rdx
setae %r9b
cmp %rdx,%rax
setae %dl
or %dl,%r9b
je 1250 <func0+0xe0>
cmp $0x9,%r8d
jbe 1250 <func0+0xe0>
mov %esi,%r9d
mov %rax,%r8
shr $0x2,%r9d
shl $0x4,%r9
add %rax,%r9
nopw 0x0(%rax,%rax,1)
movd 0x18(%rcx),%xmm1
movd 0x24(%rcx),%xmm2
add $0x10,%r8
add $0x30,%rcx
movd -0x30(%rcx),%xmm0
movd -0x24(%rcx),%xmm3
punpckldq %xmm2,%xmm1
punpckldq %xmm3,%xmm0
punpcklqdq %xmm1,%xmm0
movups %xmm0,-0x10(%r8)
cmp %r9,%r8
jne 11d0 <func0+0x60>
mov %esi,%edx
and $0xfffffffc,%edx
test $0x3,%sil
je 1272 <func0+0x102>
mov %edx,%r8d
lea (%r8,%r8,2),%rcx
shl $0x2,%rcx
mov 0x8(%rdi,%rcx,1),%r9d
mov %r9d,(%rax,%r8,4)
lea 0x1(%rdx),%r8d
cmp %r8d,%esi
jle 1272 <func0+0x102>
mov 0x14(%rdi,%rcx,1),%r9d
movslq %r8d,%r8
add $0x2,%edx
mov %r9d,(%rax,%r8,4)
cmp %edx,%esi
jle 1272 <func0+0x102>
mov 0x20(%rdi,%rcx,1),%ecx
movslq %edx,%rdx
mov %ecx,(%rax,%rdx,4)
retq
nopl 0x0(%rax,%rax,1)
mov %rax,%rdx
lea 0x4(%rax,%r8,4),%rdi
nopl 0x0(%rax,%rax,1)
mov (%rcx),%esi
add $0x4,%rdx
add $0xc,%rcx
mov %esi,-0x4(%rdx)
cmp %rdi,%rdx
jne 1260 <func0+0xf0>
retq
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
mov ecx, esi
mov rsi, rdx
test ecx, ecx
jle short loc_11C2
lea r9d, [rcx-1]
movsxd r8, ecx
lea rax, [rdi+8]
cmp r9d, 3
jbe short loc_11A4
lea rdx, [r8+r8*2]
lea rdx, [rdi+rdx*4]
cmp rsi, rdx
jnb short loc_11D0
lea rdx, [rsi+r8*4]
cmp rax, rdx
jnb short loc_11D0
loc_11A4:
mov rdx, rsi
lea rdi, [rsi+r8*4]
nop dword ptr [rax+rax+00h]
loc_11B0:
mov ecx, [rax]
add rdx, 4
add rax, 0Ch
mov [rdx-4], ecx
cmp rdi, rdx
jnz short loc_11B0
loc_11C2:
mov rax, rsi
retn
loc_11D0:
mov r8d, r9d
mov rdx, rsi
shr r8d, 2
shl r8, 4
add r8, rsi
nop dword ptr [rax+00000000h]
loc_11E8:
movdqu xmm2, xmmword ptr [rax]
movdqu xmm1, xmmword ptr [rax+10h]
add rdx, 10h
add rax, 30h ; '0'
movdqa xmm0, xmm2
shufps xmm1, xmm2, 0Ah
shufps xmm0, xmm1, 8Ch
movdqu xmm1, xmmword ptr [rax-10h]
shufps xmm1, xmm0, 0A5h
shufps xmm0, xmm1, 24h ; '$'
movups xmmword ptr [rdx-10h], xmm0
cmp rdx, r8
jnz short loc_11E8
and r9d, 0FFFFFFFCh
movsxd rdx, r9d
lea rax, [rdx+rdx*2]
lea r8, ds:0[rdx*4]
shl rax, 2
mov r10d, [rdi+rax+8]
mov [rsi+rdx*4], r10d
lea edx, [r9+1]
cmp ecx, edx
jle loc_11C2
mov edx, [rdi+rax+14h]
mov [rsi+r8+4], edx
lea edx, [r9+2]
cmp ecx, edx
jle loc_11C2
mov edx, [rdi+rax+20h]
add r9d, 3
mov [rsi+r8+8], edx
cmp ecx, r9d
jle loc_11C2
mov eax, [rdi+rax+2Ch]
mov [rsi+r8+0Ch], eax
mov rax, rsi
retn | unsigned long long func0(long long a1, int a2, unsigned long long a3)
{
unsigned long long v4; // rsi
unsigned int v5; // r9d
const __m128i *v6; // rax
unsigned long long v7; // rdi
__int32 v8; // ecx
__m128 v10; // xmm2
__m128 v11; // xmm1
__m128 v12; // xmm0
signed int v13; // r9d
long long v14; // r8
long long v15; // rax
v4 = a3;
if ( a2 <= 0 )
return v4;
v5 = a2 - 1;
v6 = (const __m128i *)(a1 + 8);
if ( (unsigned int)(a2 - 1) <= 3 || a3 < a1 + 12LL * a2 && (unsigned long long)v6 < a3 + 4LL * a2 )
{
v7 = a3 + 4LL * a2;
do
{
v8 = v6->m128i_i32[0];
a3 += 4LL;
v6 = (const __m128i *)((char *)v6 + 12);
*(_DWORD *)(a3 - 4) = v8;
}
while ( v7 != a3 );
return v4;
}
do
{
v10 = (__m128)_mm_loadu_si128(v6);
v11 = (__m128)_mm_loadu_si128(v6 + 1);
a3 += 16LL;
v6 += 3;
v12 = _mm_shuffle_ps(v10, _mm_shuffle_ps(v11, v10, 10), 140);
*(__m128 *)(a3 - 16) = _mm_shuffle_ps(v12, _mm_shuffle_ps((__m128)_mm_loadu_si128(v6 - 1), v12, 165), 36);
}
while ( a3 != v4 + 16LL * (v5 >> 2) );
v13 = v5 & 0xFFFFFFFC;
v14 = 4LL * v13;
v15 = 12LL * v13;
*(_DWORD *)(v4 + v14) = *(_DWORD *)(a1 + v15 + 8);
if ( a2 <= v13 + 1 )
return v4;
*(_DWORD *)(v4 + v14 + 4) = *(_DWORD *)(a1 + v15 + 20);
if ( a2 <= v13 + 2 )
return v4;
*(_DWORD *)(v4 + v14 + 8) = *(_DWORD *)(a1 + v15 + 32);
if ( a2 <= v13 + 3 )
return v4;
*(_DWORD *)(v4 + v14 + 12) = *(_DWORD *)(a1 + v15 + 44);
return v4;
} | func0:
ENDBR64
MOV ECX,ESI
MOV RSI,RDX
TEST ECX,ECX
JLE 0x001011c2
LEA R9D,[RCX + -0x1]
MOVSXD R8,ECX
LEA RAX,[RDI + 0x8]
CMP R9D,0x3
JBE 0x001011a4
LEA RDX,[R8 + R8*0x2]
LEA RDX,[RDI + RDX*0x4]
CMP RSI,RDX
JNC 0x001011d0
LEA RDX,[RSI + R8*0x4]
CMP RAX,RDX
JNC 0x001011d0
LAB_001011a4:
MOV RDX,RSI
LEA RDI,[RSI + R8*0x4]
NOP dword ptr [RAX + RAX*0x1]
LAB_001011b0:
MOV ECX,dword ptr [RAX]
ADD RDX,0x4
ADD RAX,0xc
MOV dword ptr [RDX + -0x4],ECX
CMP RDI,RDX
JNZ 0x001011b0
LAB_001011c2:
MOV RAX,RSI
RET
LAB_001011d0:
MOV R8D,R9D
MOV RDX,RSI
SHR R8D,0x2
SHL R8,0x4
ADD R8,RSI
NOP dword ptr [RAX]
LAB_001011e8:
MOVDQU XMM2,xmmword ptr [RAX]
MOVDQU XMM1,xmmword ptr [RAX + 0x10]
ADD RDX,0x10
ADD RAX,0x30
MOVDQA XMM0,XMM2
SHUFPS XMM1,XMM2,0xa
SHUFPS XMM0,XMM1,0x8c
MOVDQU XMM1,xmmword ptr [RAX + -0x10]
SHUFPS XMM1,XMM0,0xa5
SHUFPS XMM0,XMM1,0x24
MOVUPS xmmword ptr [RDX + -0x10],XMM0
CMP RDX,R8
JNZ 0x001011e8
AND R9D,0xfffffffc
MOVSXD RDX,R9D
LEA RAX,[RDX + RDX*0x2]
LEA R8,[RDX*0x4]
SHL RAX,0x2
MOV R10D,dword ptr [RDI + RAX*0x1 + 0x8]
MOV dword ptr [RSI + RDX*0x4],R10D
LEA EDX,[R9 + 0x1]
CMP ECX,EDX
JLE 0x001011c2
MOV EDX,dword ptr [RDI + RAX*0x1 + 0x14]
MOV dword ptr [RSI + R8*0x1 + 0x4],EDX
LEA EDX,[R9 + 0x2]
CMP ECX,EDX
JLE 0x001011c2
MOV EDX,dword ptr [RDI + RAX*0x1 + 0x20]
ADD R9D,0x3
MOV dword ptr [RSI + R8*0x1 + 0x8],EDX
CMP ECX,R9D
JLE 0x001011c2
MOV EAX,dword ptr [RDI + RAX*0x1 + 0x2c]
MOV dword ptr [RSI + R8*0x1 + 0xc],EAX
MOV RAX,RSI
RET | int4 * func0(long param_1,int param_2,int4 *param_3)
{
int4 uVar1;
int4 uVar2;
int4 uVar3;
int4 *puVar4;
int4 *puVar5;
int4 *puVar6;
long lVar7;
long lVar8;
uint uVar9;
if (0 < param_2) {
uVar9 = param_2 - 1;
lVar8 = (long)param_2;
puVar4 = (int4 *)(param_1 + 8);
if ((uVar9 < 4) ||
((param_3 < (int4 *)(param_1 + lVar8 * 0xc) && (puVar4 < param_3 + lVar8)))) {
puVar6 = param_3;
do {
uVar1 = *puVar4;
puVar5 = puVar6 + 1;
puVar4 = puVar4 + 3;
*puVar6 = uVar1;
puVar6 = puVar5;
} while (param_3 + lVar8 != puVar5);
}
else {
puVar6 = param_3;
do {
uVar1 = puVar4[3];
uVar2 = puVar4[6];
puVar5 = puVar6 + 4;
uVar3 = puVar4[9];
*puVar6 = *puVar4;
puVar6[1] = uVar1;
puVar6[2] = uVar2;
puVar6[3] = uVar3;
puVar4 = puVar4 + 0xc;
puVar6 = puVar5;
} while (puVar5 != param_3 + (ulong)(uVar9 >> 2) * 4);
uVar9 = uVar9 & 0xfffffffc;
lVar7 = (long)(int)uVar9;
lVar8 = lVar7 * 0xc;
param_3[lVar7] = *(int4 *)(param_1 + 8 + lVar8);
if ((((int)(uVar9 + 1) < param_2) &&
(param_3[lVar7 + 1] = *(int4 *)(param_1 + 0x14 + lVar8), (int)(uVar9 + 2) < param_2)
) && (param_3[lVar7 + 2] = *(int4 *)(param_1 + 0x20 + lVar8),
(int)(uVar9 + 3) < param_2)) {
param_3[lVar7 + 3] = *(int4 *)(param_1 + 0x2c + lVar8);
return param_3;
}
}
}
return param_3;
} |
4,984 | func0 | #include <stdio.h>
#include <assert.h>
| int* func0(int* test_tup1, int* test_tup2, int n, int* res) {
for (int i = 0; i < n; i++) {
res[i] = test_tup1[i] - test_tup2[i];
}
return res;
}
| int main() {
int result1[3], result2[3], result3[3];
int tup1a[] = {10, 4, 5}, tup2a[] = {2, 5, 18};
int tup1b[] = {11, 2, 3}, tup2b[] = {24, 45, 16};
int tup1c[] = {7, 18, 9}, tup2c[] = {10, 11, 12};
int expected1[] = {8, -1, -13}, expected2[] = {-13, -43, -13}, expected3[] = {-3, 7, -3};
func0(tup1a, tup2a, 3, result1);
func0(tup1b, tup2b, 3, result2);
func0(tup1c, tup2c, 3, result3);
for (int i = 0; i < 3; i++) {
assert(result1[i] == expected1[i]);
assert(result2[i] == expected2[i]);
assert(result3[i] == expected3[i]);
}
printf("All tests passed successfully.\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %rsi,-0x20(%rbp)
mov %edx,-0x24(%rbp)
mov %rcx,-0x30(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11f3 <func0+0x6a>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%ecx
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x20(%rbp),%rax
add %rdx,%rax
mov (%rax),%edx
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rsi
mov -0x30(%rbp),%rax
add %rsi,%rax
sub %edx,%ecx
mov %ecx,%edx
mov %edx,(%rax)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x24(%rbp),%eax
jl 11a9 <func0+0x20>
mov -0x30(%rbp),%rax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_20], rsi
mov [rbp+var_24], edx
mov [rbp+var_30], rcx
mov [rbp+var_4], 0
jmp short loc_11F2
loc_11A9:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov ecx, [rax]
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_20]
add rax, rdx
mov eax, [rax]
mov edx, [rbp+var_4]
movsxd rdx, edx
lea rsi, ds:0[rdx*4]
mov rdx, [rbp+var_30]
add rdx, rsi
sub ecx, eax
mov [rdx], ecx
add [rbp+var_4], 1
loc_11F2:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_24]
jl short loc_11A9
mov rax, [rbp+var_30]
pop rbp
retn | long long func0(long long a1, long long a2, int a3, long long a4)
{
int i; // [rsp+2Ch] [rbp-4h]
for ( i = 0; i < a3; ++i )
*(_DWORD *)(4LL * i + a4) = *(_DWORD *)(4LL * i + a1) - *(_DWORD *)(4LL * i + a2);
return a4;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV qword ptr [RBP + -0x20],RSI
MOV dword ptr [RBP + -0x24],EDX
MOV qword ptr [RBP + -0x30],RCX
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011f2
LAB_001011a9:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV ECX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x20]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
MOV EDX,dword ptr [RBP + -0x4]
MOVSXD RDX,EDX
LEA RSI,[RDX*0x4]
MOV RDX,qword ptr [RBP + -0x30]
ADD RDX,RSI
SUB ECX,EAX
MOV dword ptr [RDX],ECX
ADD dword ptr [RBP + -0x4],0x1
LAB_001011f2:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x24]
JL 0x001011a9
MOV RAX,qword ptr [RBP + -0x30]
POP RBP
RET | long func0(long param_1,long param_2,int param_3,long param_4)
{
int4 local_c;
for (local_c = 0; local_c < param_3; local_c = local_c + 1) {
*(int *)(param_4 + (long)local_c * 4) =
*(int *)(param_1 + (long)local_c * 4) - *(int *)(param_2 + (long)local_c * 4);
}
return param_4;
} |
4,985 | func0 | #include <stdio.h>
#include <assert.h>
| int* func0(int* test_tup1, int* test_tup2, int n, int* res) {
for (int i = 0; i < n; i++) {
res[i] = test_tup1[i] - test_tup2[i];
}
return res;
}
| int main() {
int result1[3], result2[3], result3[3];
int tup1a[] = {10, 4, 5}, tup2a[] = {2, 5, 18};
int tup1b[] = {11, 2, 3}, tup2b[] = {24, 45, 16};
int tup1c[] = {7, 18, 9}, tup2c[] = {10, 11, 12};
int expected1[] = {8, -1, -13}, expected2[] = {-13, -43, -13}, expected3[] = {-3, 7, -3};
func0(tup1a, tup2a, 3, result1);
func0(tup1b, tup2b, 3, result2);
func0(tup1c, tup2c, 3, result3);
for (int i = 0; i < 3; i++) {
assert(result1[i] == expected1[i]);
assert(result2[i] == expected2[i]);
assert(result3[i] == expected3[i]);
}
printf("All tests passed successfully.\n");
return 0;
}
| O1 | c | func0:
endbr64
mov %rcx,%rax
test %edx,%edx
jle 11b4 <func0+0x2b>
lea -0x1(%rdx),%ecx
mov $0x0,%edx
mov (%rdi,%rdx,4),%r8d
sub (%rsi,%rdx,4),%r8d
mov %r8d,(%rax,%rdx,4)
mov %rdx,%r8
add $0x1,%rdx
cmp %rcx,%r8
jne 119c <func0+0x13>
retq
| func0:
endbr64
mov rax, rcx
test edx, edx
jle short locret_11B1
mov edx, edx
mov r8d, 0
loc_119C:
mov r9d, [rdi+r8*4]
sub r9d, [rsi+r8*4]
mov [rax+r8*4], r9d
add r8, 1
cmp r8, rdx
jnz short loc_119C
locret_11B1:
retn | long long func0(long long a1, long long a2, int a3, long long a4)
{
long long result; // rax
long long i; // r8
result = a4;
if ( a3 > 0 )
{
for ( i = 0LL; i != a3; ++i )
*(_DWORD *)(a4 + 4 * i) = *(_DWORD *)(a1 + 4 * i) - *(_DWORD *)(a2 + 4 * i);
}
return result;
} | func0:
ENDBR64
MOV RAX,RCX
TEST EDX,EDX
JLE 0x001011b1
MOV EDX,EDX
MOV R8D,0x0
LAB_0010119c:
MOV R9D,dword ptr [RDI + R8*0x4]
SUB R9D,dword ptr [RSI + R8*0x4]
MOV dword ptr [RAX + R8*0x4],R9D
ADD R8,0x1
CMP R8,RDX
JNZ 0x0010119c
LAB_001011b1:
RET | void func0(long param_1,long param_2,uint param_3,long param_4)
{
ulong uVar1;
if (0 < (int)param_3) {
uVar1 = 0;
do {
*(int *)(param_4 + uVar1 * 4) = *(int *)(param_1 + uVar1 * 4) - *(int *)(param_2 + uVar1 * 4);
uVar1 = uVar1 + 1;
} while (uVar1 != param_3);
}
return;
} |
4,986 | func0 | #include <stdio.h>
#include <assert.h>
| int* func0(int* test_tup1, int* test_tup2, int n, int* res) {
for (int i = 0; i < n; i++) {
res[i] = test_tup1[i] - test_tup2[i];
}
return res;
}
| int main() {
int result1[3], result2[3], result3[3];
int tup1a[] = {10, 4, 5}, tup2a[] = {2, 5, 18};
int tup1b[] = {11, 2, 3}, tup2b[] = {24, 45, 16};
int tup1c[] = {7, 18, 9}, tup2c[] = {10, 11, 12};
int expected1[] = {8, -1, -13}, expected2[] = {-13, -43, -13}, expected3[] = {-3, 7, -3};
func0(tup1a, tup2a, 3, result1);
func0(tup1b, tup2b, 3, result2);
func0(tup1c, tup2c, 3, result3);
for (int i = 0; i < 3; i++) {
assert(result1[i] == expected1[i]);
assert(result2[i] == expected2[i]);
assert(result3[i] == expected3[i]);
}
printf("All tests passed successfully.\n");
return 0;
}
| O2 | c | func0:
endbr64
mov %rcx,%rax
test %edx,%edx
jle 12f8 <func0+0x28>
lea -0x1(%rdx),%ecx
xor %edx,%edx
mov (%rdi,%rdx,4),%r8d
sub (%rsi,%rdx,4),%r8d
mov %r8d,(%rax,%rdx,4)
mov %rdx,%r8
add $0x1,%rdx
cmp %rcx,%r8
jne 12e0 <func0+0x10>
retq
nopl 0x0(%rax)
| func0:
endbr64
mov rax, rcx
test edx, edx
jle short locret_130D
movsxd rdx, edx
xor r8d, r8d
nop dword ptr [rax+00000000h]
loc_12F8:
mov r9d, [rdi+r8*4]
sub r9d, [rsi+r8*4]
mov [rax+r8*4], r9d
add r8, 1
cmp rdx, r8
jnz short loc_12F8
locret_130D:
retn | long long func0(long long a1, long long a2, int a3, long long a4)
{
long long result; // rax
long long i; // r8
result = a4;
if ( a3 > 0 )
{
for ( i = 0LL; i != a3; ++i )
*(_DWORD *)(a4 + 4 * i) = *(_DWORD *)(a1 + 4 * i) - *(_DWORD *)(a2 + 4 * i);
}
return result;
} | func0:
ENDBR64
MOV RAX,RCX
TEST EDX,EDX
JLE 0x0010130d
MOVSXD RDX,EDX
XOR R8D,R8D
NOP dword ptr [RAX]
LAB_001012f8:
MOV R9D,dword ptr [RDI + R8*0x4]
SUB R9D,dword ptr [RSI + R8*0x4]
MOV dword ptr [RAX + R8*0x4],R9D
ADD R8,0x1
CMP RDX,R8
JNZ 0x001012f8
LAB_0010130d:
RET | void func0(long param_1,long param_2,int param_3,long param_4)
{
long lVar1;
if (0 < param_3) {
lVar1 = 0;
do {
*(int *)(param_4 + lVar1 * 4) = *(int *)(param_1 + lVar1 * 4) - *(int *)(param_2 + lVar1 * 4);
lVar1 = lVar1 + 1;
} while (param_3 != lVar1);
}
return;
} |
4,987 | func0 | #include <stdio.h>
#include <assert.h>
| int* func0(int* test_tup1, int* test_tup2, int n, int* res) {
for (int i = 0; i < n; i++) {
res[i] = test_tup1[i] - test_tup2[i];
}
return res;
}
| int main() {
int result1[3], result2[3], result3[3];
int tup1a[] = {10, 4, 5}, tup2a[] = {2, 5, 18};
int tup1b[] = {11, 2, 3}, tup2b[] = {24, 45, 16};
int tup1c[] = {7, 18, 9}, tup2c[] = {10, 11, 12};
int expected1[] = {8, -1, -13}, expected2[] = {-13, -43, -13}, expected3[] = {-3, 7, -3};
func0(tup1a, tup2a, 3, result1);
func0(tup1b, tup2b, 3, result2);
func0(tup1c, tup2c, 3, result3);
for (int i = 0; i < 3; i++) {
assert(result1[i] == expected1[i]);
assert(result2[i] == expected2[i]);
assert(result3[i] == expected3[i]);
}
printf("All tests passed successfully.\n");
return 0;
}
| O3 | c | func0:
endbr64
mov %rcx,%rax
test %edx,%edx
jle 1245 <func0+0xd5>
lea 0xf(%rcx),%rcx
lea -0x1(%rdx),%r8d
mov %rcx,%r9
sub %rdi,%r9
cmp $0x1e,%r9
seta %r10b
cmp $0x2,%r8d
seta %r9b
test %r9b,%r10b
je 1228 <func0+0xb8>
sub %rsi,%rcx
cmp $0x1e,%rcx
jbe 1228 <func0+0xb8>
mov %edx,%ecx
xor %r8d,%r8d
shr $0x2,%ecx
shl $0x4,%rcx
nopl 0x0(%rax,%rax,1)
movdqu (%rdi,%r8,1),%xmm0
movdqu (%rsi,%r8,1),%xmm1
psubd %xmm1,%xmm0
movups %xmm0,(%rax,%r8,1)
add $0x10,%r8
cmp %rcx,%r8
jne 11c0 <func0+0x50>
mov %edx,%ecx
and $0xfffffffc,%ecx
test $0x3,%dl
je 1245 <func0+0xd5>
mov %ecx,%r8d
mov (%rdi,%r8,4),%r9d
sub (%rsi,%r8,4),%r9d
mov %r9d,(%rax,%r8,4)
lea 0x1(%rcx),%r8d
cmp %r8d,%edx
jle 1245 <func0+0xd5>
movslq %r8d,%r8
add $0x2,%ecx
mov (%rdi,%r8,4),%r9d
sub (%rsi,%r8,4),%r9d
mov %r9d,(%rax,%r8,4)
cmp %ecx,%edx
jle 1245 <func0+0xd5>
movslq %ecx,%rcx
mov (%rdi,%rcx,4),%edx
sub (%rsi,%rcx,4),%edx
mov %edx,(%rax,%rcx,4)
retq
nopl 0x0(%rax,%rax,1)
xor %edx,%edx
nopw 0x0(%rax,%rax,1)
mov (%rdi,%rdx,4),%ecx
sub (%rsi,%rdx,4),%ecx
mov %ecx,(%rax,%rdx,4)
mov %rdx,%rcx
add $0x1,%rdx
cmp %r8,%rcx
jne 1230 <func0+0xc0>
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
movsxd rax, edx
mov r8, rsi
test eax, eax
jle loc_1231
cmp eax, 1
jz loc_1238
lea rsi, [rdi+4]
mov rdx, rcx
sub rdx, rsi
cmp rdx, 8
jbe loc_1238
lea rsi, [r8+4]
mov rdx, rcx
sub rdx, rsi
cmp rdx, 8
jbe loc_1238
lea edx, [rax-1]
mov r9d, eax
cmp edx, 2
jbe loc_125F
mov esi, eax
xor edx, edx
shr esi, 2
shl rsi, 4
nop dword ptr [rax]
loc_11D0:
movdqu xmm0, xmmword ptr [rdi+rdx]
movdqu xmm2, xmmword ptr [r8+rdx]
psubd xmm0, xmm2
movups xmmword ptr [rcx+rdx], xmm0
add rdx, 10h
cmp rsi, rdx
jnz short loc_11D0
mov edx, eax
and edx, 0FFFFFFFCh
mov esi, edx
cmp eax, edx
jz short loc_1231
sub eax, edx
mov r9d, eax
cmp eax, 1
jz short loc_1224
loc_1201:
mov eax, esi
movq xmm0, qword ptr [rdi+rax*4]
movq xmm1, qword ptr [r8+rax*4]
psubd xmm0, xmm1
movq qword ptr [rcx+rax*4], xmm0
test r9b, 1
jz short loc_1231
and r9d, 0FFFFFFFEh
add edx, r9d
loc_1224:
movsxd rax, edx
mov edx, [rdi+rax*4]
sub edx, [r8+rax*4]
mov [rcx+rax*4], edx
loc_1231:
mov rax, rcx
retn
loc_1238:
lea rsi, ds:0[rax*4]
xor eax, eax
nop word ptr [rax+rax+00h]
loc_1248:
mov edx, [rdi+rax]
sub edx, [r8+rax]
mov [rcx+rax], edx
add rax, 4
cmp rax, rsi
jnz short loc_1248
mov rax, rcx
retn
loc_125F:
xor esi, esi
xor edx, edx
jmp short loc_1201 | long long func0(long long a1, long long a2, int a3, long long a4)
{
int v6; // r9d
long long v7; // rdx
signed int v8; // edx
unsigned int v9; // esi
long long v11; // rax
if ( a3 <= 0 )
return a4;
if ( a3 != 1 && (unsigned long long)(a4 - (a1 + 4)) > 8 && (unsigned long long)(a4 - (a2 + 4)) > 8 )
{
v6 = a3;
if ( (unsigned int)(a3 - 1) <= 2 )
{
v9 = 0;
v8 = 0;
}
else
{
v7 = 0LL;
do
{
*(__m128i *)(a4 + v7) = _mm_sub_epi32(
_mm_loadu_si128((const __m128i *)(a1 + v7)),
_mm_loadu_si128((const __m128i *)(a2 + v7)));
v7 += 16LL;
}
while ( 16LL * ((unsigned int)a3 >> 2) != v7 );
v8 = a3 & 0xFFFFFFFC;
v9 = a3 & 0xFFFFFFFC;
if ( a3 == (a3 & 0xFFFFFFFC) )
return a4;
v6 = a3 - v8;
if ( a3 - v8 == 1 )
goto LABEL_12;
}
*(_QWORD *)(a4 + 4LL * v9) = _mm_sub_epi32(
_mm_loadl_epi64((const __m128i *)(a1 + 4LL * v9)),
_mm_loadl_epi64((const __m128i *)(a2 + 4LL * v9))).m128i_u64[0];
if ( (v6 & 1) == 0 )
return a4;
v8 += v6 & 0xFFFFFFFE;
LABEL_12:
*(_DWORD *)(a4 + 4LL * v8) = *(_DWORD *)(a1 + 4LL * v8) - *(_DWORD *)(a2 + 4LL * v8);
return a4;
}
v11 = 0LL;
do
{
*(_DWORD *)(a4 + v11) = *(_DWORD *)(a1 + v11) - *(_DWORD *)(a2 + v11);
v11 += 4LL;
}
while ( v11 != 4LL * a3 );
return a4;
} | func0:
ENDBR64
MOVSXD RAX,EDX
MOV R8,RSI
TEST EAX,EAX
JLE 0x00101231
CMP EAX,0x1
JZ 0x00101238
LEA RSI,[RDI + 0x4]
MOV RDX,RCX
SUB RDX,RSI
CMP RDX,0x8
JBE 0x00101238
LEA RSI,[R8 + 0x4]
MOV RDX,RCX
SUB RDX,RSI
CMP RDX,0x8
JBE 0x00101238
LEA EDX,[RAX + -0x1]
MOV R9D,EAX
CMP EDX,0x2
JBE 0x0010125f
MOV ESI,EAX
XOR EDX,EDX
SHR ESI,0x2
SHL RSI,0x4
NOP dword ptr [RAX]
LAB_001011d0:
MOVDQU XMM0,xmmword ptr [RDI + RDX*0x1]
MOVDQU XMM2,xmmword ptr [R8 + RDX*0x1]
PSUBD XMM0,XMM2
MOVUPS xmmword ptr [RCX + RDX*0x1],XMM0
ADD RDX,0x10
CMP RSI,RDX
JNZ 0x001011d0
MOV EDX,EAX
AND EDX,0xfffffffc
MOV ESI,EDX
CMP EAX,EDX
JZ 0x00101231
SUB EAX,EDX
MOV R9D,EAX
CMP EAX,0x1
JZ 0x00101224
LAB_00101201:
MOV EAX,ESI
MOVQ XMM0,qword ptr [RDI + RAX*0x4]
MOVQ XMM1,qword ptr [R8 + RAX*0x4]
PSUBD XMM0,XMM1
MOVQ qword ptr [RCX + RAX*0x4],XMM0
TEST R9B,0x1
JZ 0x00101231
AND R9D,0xfffffffe
ADD EDX,R9D
LAB_00101224:
MOVSXD RAX,EDX
MOV EDX,dword ptr [RDI + RAX*0x4]
SUB EDX,dword ptr [R8 + RAX*0x4]
MOV dword ptr [RCX + RAX*0x4],EDX
LAB_00101231:
MOV RAX,RCX
RET
LAB_00101238:
LEA RSI,[RAX*0x4]
XOR EAX,EAX
NOP word ptr [RAX + RAX*0x1]
LAB_00101248:
MOV EDX,dword ptr [RDI + RAX*0x1]
SUB EDX,dword ptr [R8 + RAX*0x1]
MOV dword ptr [RCX + RAX*0x1],EDX
ADD RAX,0x4
CMP RAX,RSI
JNZ 0x00101248
MOV RAX,RCX
RET
LAB_0010125f:
XOR ESI,ESI
XOR EDX,EDX
JMP 0x00101201 | long func0(long param_1,long param_2,uint param_3,long param_4)
{
int *piVar1;
int *piVar2;
int *piVar3;
int8 uVar4;
int8 uVar5;
int iVar6;
int iVar7;
int iVar8;
int iVar9;
int iVar10;
int iVar11;
ulong uVar12;
uint uVar13;
long lVar14;
if ((int)param_3 < 1) {
return param_4;
}
if (((param_3 == 1) || ((ulong)(param_4 - (param_1 + 4)) < 9)) ||
((ulong)(param_4 - (param_2 + 4)) < 9)) {
lVar14 = 0;
do {
*(int *)(param_4 + lVar14) = *(int *)(param_1 + lVar14) - *(int *)(param_2 + lVar14);
lVar14 = lVar14 + 4;
} while (lVar14 != (long)(int)param_3 * 4);
return param_4;
}
if (param_3 - 1 < 3) {
uVar13 = 0;
}
else {
lVar14 = 0;
do {
piVar1 = (int *)(param_1 + lVar14);
iVar6 = piVar1[1];
iVar7 = piVar1[2];
iVar8 = piVar1[3];
piVar2 = (int *)(param_2 + lVar14);
iVar9 = piVar2[1];
iVar10 = piVar2[2];
iVar11 = piVar2[3];
piVar3 = (int *)(param_4 + lVar14);
*piVar3 = *piVar1 - *piVar2;
piVar3[1] = iVar6 - iVar9;
piVar3[2] = iVar7 - iVar10;
piVar3[3] = iVar8 - iVar11;
lVar14 = lVar14 + 0x10;
} while ((ulong)(param_3 >> 2) << 4 != lVar14);
uVar13 = param_3 & 0xfffffffc;
if (param_3 == uVar13) {
return param_4;
}
param_3 = param_3 - uVar13;
if (param_3 == 1) goto LAB_00101224;
}
uVar12 = (ulong)uVar13;
uVar4 = *(int8 *)(param_1 + uVar12 * 4);
uVar5 = *(int8 *)(param_2 + uVar12 * 4);
*(ulong *)(param_4 + uVar12 * 4) =
CONCAT44((int)((ulong)uVar4 >> 0x20) - (int)((ulong)uVar5 >> 0x20),(int)uVar4 - (int)uVar5);
if ((param_3 & 1) == 0) {
return param_4;
}
uVar13 = uVar13 + (param_3 & 0xfffffffe);
LAB_00101224:
lVar14 = (long)(int)uVar13;
*(int *)(param_4 + lVar14 * 4) = *(int *)(param_1 + lVar14 * 4) - *(int *)(param_2 + lVar14 * 4);
return param_4;
} |
4,988 | func0 |
#include <assert.h>
| int func0(int n) {
return (1 << (n - 1));
}
| int main() {
assert(func0(4) == 8);
assert(func0(6) == 32);
assert(func0(2) == 2);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %edi,-0x4(%rbp)
mov -0x4(%rbp),%eax
sub $0x1,%eax
mov $0x1,%edx
mov %eax,%ecx
shl %cl,%edx
mov %edx,%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_4], edi
mov eax, [rbp+var_4]
sub eax, 1
mov edx, 1
mov ecx, eax
shl edx, cl
mov eax, edx
pop rbp
retn | long long func0(char a1)
{
return (unsigned int)(1 << (a1 - 1));
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV dword ptr [RBP + -0x4],EDI
MOV EAX,dword ptr [RBP + -0x4]
SUB EAX,0x1
MOV EDX,0x1
MOV ECX,EAX
SHL EDX,CL
MOV EAX,EDX
POP RBP
RET | int func0(char param_1)
{
return 1 << (param_1 - 1U & 0x1f);
} |
4,989 | func0 |
#include <assert.h>
| int func0(int n) {
return (1 << (n - 1));
}
| int main() {
assert(func0(4) == 8);
assert(func0(6) == 32);
assert(func0(2) == 2);
return 0;
}
| O1 | c | func0:
endbr64
lea -0x1(%rdi),%ecx
mov $0x1,%eax
shl %cl,%eax
retq
| func0:
endbr64
lea ecx, [rdi-1]
mov eax, 1
shl eax, cl
retn | long long func0(char a1)
{
return (unsigned int)(1 << (a1 - 1));
} | func0:
ENDBR64
LEA ECX,[RDI + -0x1]
MOV EAX,0x1
SHL EAX,CL
RET | int func0(char param_1)
{
return 1 << (param_1 - 1U & 0x1f);
} |
4,990 | func0 |
#include <assert.h>
| int func0(int n) {
return (1 << (n - 1));
}
| int main() {
assert(func0(4) == 8);
assert(func0(6) == 32);
assert(func0(2) == 2);
return 0;
}
| O2 | c | func0:
endbr64
lea -0x1(%rdi),%ecx
mov $0x1,%eax
shl %cl,%eax
retq
| func0:
endbr64
lea ecx, [rdi-1]
mov eax, 1
shl eax, cl
retn | long long func0(char a1)
{
return (unsigned int)(1 << (a1 - 1));
} | func0:
ENDBR64
LEA ECX,[RDI + -0x1]
MOV EAX,0x1
SHL EAX,CL
RET | int func0(char param_1)
{
return 1 << (param_1 - 1U & 0x1f);
} |
4,991 | func0 |
#include <assert.h>
| int func0(int n) {
return (1 << (n - 1));
}
| int main() {
assert(func0(4) == 8);
assert(func0(6) == 32);
assert(func0(2) == 2);
return 0;
}
| O3 | c | func0:
endbr64
lea -0x1(%rdi),%ecx
mov $0x1,%eax
shl %cl,%eax
retq
| func0:
endbr64
lea ecx, [rdi-1]
mov eax, 1
shl eax, cl
retn | long long func0(char a1)
{
return (unsigned int)(1 << (a1 - 1));
} | func0:
ENDBR64
LEA ECX,[RDI + -0x1]
MOV EAX,0x1
SHL EAX,CL
RET | int func0(char param_1)
{
return 1 << (param_1 - 1U & 0x1f);
} |
4,992 | func0 | #include <assert.h>
| int func0(int a[], int n, int m) {
int i;
for (i = 0; i < n; i++) {
a[i] = (a[i] / m + (a[i] % m != 0));
}
int result = -1, maxx = -1;
for (i = n - 1; i >= 0; i--) {
if (maxx < a[i]) {
maxx = a[i];
result = i;
}
}
return result + 1;
}
| int main() {
int array1[3] = {2, 5, 4};
int array2[2] = {4, 3};
int array3[4] = {1, 2, 3, 4};
assert(func0(array1, 3, 2) == 2);
assert(func0(array2, 2, 2) == 2);
assert(func0(array3, 4, 1) == 4);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov %edx,-0x20(%rbp)
movl $0x0,-0xc(%rbp)
jmp 11e0 <func0+0x77>
mov -0xc(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cltd
idivl -0x20(%rbp)
mov %eax,%esi
mov -0xc(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cltd
idivl -0x20(%rbp)
mov %edx,%eax
test %eax,%eax
setne %al
movzbl %al,%edx
mov -0xc(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rcx
mov -0x18(%rbp),%rax
add %rcx,%rax
add %esi,%edx
mov %edx,(%rax)
addl $0x1,-0xc(%rbp)
mov -0xc(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 1184 <func0+0x1b>
movl $0xffffffff,-0x8(%rbp)
movl $0xffffffff,-0x4(%rbp)
mov -0x1c(%rbp),%eax
sub $0x1,%eax
mov %eax,-0xc(%rbp)
jmp 123f <func0+0xd6>
mov -0xc(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cmp %eax,-0x4(%rbp)
jge 123b <func0+0xd2>
mov -0xc(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
mov %eax,-0x4(%rbp)
mov -0xc(%rbp),%eax
mov %eax,-0x8(%rbp)
subl $0x1,-0xc(%rbp)
cmpl $0x0,-0xc(%rbp)
jns 1201 <func0+0x98>
mov -0x8(%rbp),%eax
add $0x1,%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_20], edx
mov [rbp+var_C], 0
jmp short loc_11E0
loc_1184:
mov eax, [rbp+var_C]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
cdq
idiv [rbp+var_20]
mov esi, eax
mov eax, [rbp+var_C]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
cdq
idiv [rbp+var_20]
mov eax, edx
test eax, eax
setnz al
movzx edx, al
mov eax, [rbp+var_C]
cdqe
lea rcx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rcx
add edx, esi
mov [rax], edx
add [rbp+var_C], 1
loc_11E0:
mov eax, [rbp+var_C]
cmp eax, [rbp+var_1C]
jl short loc_1184
mov [rbp+var_8], 0FFFFFFFFh
mov [rbp+var_4], 0FFFFFFFFh
mov eax, [rbp+var_1C]
sub eax, 1
mov [rbp+var_C], eax
jmp short loc_123F
loc_1201:
mov eax, [rbp+var_C]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
cmp [rbp+var_4], eax
jge short loc_123B
mov eax, [rbp+var_C]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
mov [rbp+var_4], eax
mov eax, [rbp+var_C]
mov [rbp+var_8], eax
loc_123B:
sub [rbp+var_C], 1
loc_123F:
cmp [rbp+var_C], 0
jns short loc_1201
mov eax, [rbp+var_8]
add eax, 1
pop rbp
retn | long long func0(long long a1, int a2, int a3)
{
int i; // [rsp+14h] [rbp-Ch]
int j; // [rsp+14h] [rbp-Ch]
int v6; // [rsp+18h] [rbp-8h]
int v7; // [rsp+1Ch] [rbp-4h]
for ( i = 0; i < a2; ++i )
*(_DWORD *)(4LL * i + a1) = *(_DWORD *)(4LL * i + a1) / a3 + (*(_DWORD *)(4LL * i + a1) % a3 != 0);
v6 = -1;
v7 = -1;
for ( j = a2 - 1; j >= 0; --j )
{
if ( v7 < *(_DWORD *)(4LL * j + a1) )
{
v7 = *(_DWORD *)(4LL * j + a1);
v6 = j;
}
}
return (unsigned int)(v6 + 1);
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x20],EDX
MOV dword ptr [RBP + -0xc],0x0
JMP 0x001011e0
LAB_00101184:
MOV EAX,dword ptr [RBP + -0xc]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
CDQ
IDIV dword ptr [RBP + -0x20]
MOV ESI,EAX
MOV EAX,dword ptr [RBP + -0xc]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
CDQ
IDIV dword ptr [RBP + -0x20]
MOV EAX,EDX
TEST EAX,EAX
SETNZ AL
MOVZX EDX,AL
MOV EAX,dword ptr [RBP + -0xc]
CDQE
LEA RCX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RCX
ADD EDX,ESI
MOV dword ptr [RAX],EDX
ADD dword ptr [RBP + -0xc],0x1
LAB_001011e0:
MOV EAX,dword ptr [RBP + -0xc]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x00101184
MOV dword ptr [RBP + -0x8],0xffffffff
MOV dword ptr [RBP + -0x4],0xffffffff
MOV EAX,dword ptr [RBP + -0x1c]
SUB EAX,0x1
MOV dword ptr [RBP + -0xc],EAX
JMP 0x0010123f
LAB_00101201:
MOV EAX,dword ptr [RBP + -0xc]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
CMP dword ptr [RBP + -0x4],EAX
JGE 0x0010123b
MOV EAX,dword ptr [RBP + -0xc]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
MOV dword ptr [RBP + -0x4],EAX
MOV EAX,dword ptr [RBP + -0xc]
MOV dword ptr [RBP + -0x8],EAX
LAB_0010123b:
SUB dword ptr [RBP + -0xc],0x1
LAB_0010123f:
CMP dword ptr [RBP + -0xc],0x0
JNS 0x00101201
MOV EAX,dword ptr [RBP + -0x8]
ADD EAX,0x1
POP RBP
RET | int func0(long param_1,int param_2,int param_3)
{
int4 local_14;
int4 local_10;
int4 local_c;
for (local_14 = 0; local_14 < param_2; local_14 = local_14 + 1) {
*(uint *)(param_1 + (long)local_14 * 4) =
(uint)(*(int *)(param_1 + (long)local_14 * 4) % param_3 != 0) +
*(int *)(param_1 + (long)local_14 * 4) / param_3;
}
local_10 = -1;
local_c = -1;
for (local_14 = param_2 + -1; -1 < local_14; local_14 = local_14 + -1) {
if (local_c < *(int *)(param_1 + (long)local_14 * 4)) {
local_c = *(int *)(param_1 + (long)local_14 * 4);
local_10 = local_14;
}
}
return local_10 + 1;
} |
4,993 | func0 | #include <assert.h>
| int func0(int a[], int n, int m) {
int i;
for (i = 0; i < n; i++) {
a[i] = (a[i] / m + (a[i] % m != 0));
}
int result = -1, maxx = -1;
for (i = n - 1; i >= 0; i--) {
if (maxx < a[i]) {
maxx = a[i];
result = i;
}
}
return result + 1;
}
| int main() {
int array1[3] = {2, 5, 4};
int array2[2] = {4, 3};
int array3[4] = {1, 2, 3, 4};
assert(func0(array1, 3, 2) == 2);
assert(func0(array2, 2, 2) == 2);
assert(func0(array3, 4, 1) == 4);
return 0;
}
| O1 | c | func0:
endbr64
mov %edx,%r8d
test %esi,%esi
jle 11c1 <func0+0x58>
mov %rdi,%rcx
lea -0x1(%rsi),%eax
lea 0x4(%rdi,%rax,4),%r9
mov (%rcx),%eax
cltd
idiv %r8d
test %edx,%edx
setne %dl
movzbl %dl,%edx
add %edx,%eax
mov %eax,(%rcx)
add $0x4,%rcx
cmp %r9,%rcx
jne 117f <func0+0x16>
sub $0x1,%esi
movslq %esi,%rdx
mov $0xffffffff,%esi
mov $0xffffffff,%eax
jmp 11b4 <func0+0x4b>
sub $0x1,%rdx
test %edx,%edx
js 11c6 <func0+0x5d>
mov (%rdi,%rdx,4),%ecx
cmp %esi,%ecx
jle 11ac <func0+0x43>
mov %ecx,%esi
mov %edx,%eax
jmp 11ac <func0+0x43>
mov $0xffffffff,%eax
add $0x1,%eax
retq
| func0:
endbr64
mov r8, rdi
mov edi, edx
test esi, esi
jle short loc_11BF
mov rcx, r8
lea eax, [rsi-1]
lea r9, [r8+rax*4+4]
loc_1181:
mov eax, [rcx]
cdq
idiv edi
cmp edx, 1
sbb eax, 0FFFFFFFFh
mov [rcx], eax
add rcx, 4
cmp rcx, r9
jnz short loc_1181
sub esi, 1
movsxd rdx, esi
mov esi, 0FFFFFFFFh
mov eax, 0FFFFFFFFh
jmp short loc_11B1
loc_11A9:
sub rdx, 1
test edx, edx
js short loc_11C4
loc_11B1:
mov ecx, [r8+rdx*4]
cmp ecx, esi
jle short loc_11A9
mov esi, ecx
mov eax, edx
jmp short loc_11A9
loc_11BF:
mov eax, 0FFFFFFFFh
loc_11C4:
add eax, 1
retn | long long func0(_DWORD *a1, int a2, int a3)
{
_DWORD *v3; // rcx
long long v4; // rdx
int v5; // esi
int v6; // eax
if ( a2 <= 0 )
{
v6 = -1;
}
else
{
v3 = a1;
do
{
*v3 = *v3 / a3 - ((*v3 % a3 == 0) - 1);
++v3;
}
while ( v3 != &a1[a2 - 1 + 1] );
v4 = a2 - 1;
v5 = -1;
v6 = -1;
do
{
if ( a1[v4] > v5 )
{
v5 = a1[v4];
v6 = v4;
}
--v4;
}
while ( (int)v4 >= 0 );
}
return (unsigned int)(v6 + 1);
} | func0:
ENDBR64
MOV R8,RDI
MOV EDI,EDX
TEST ESI,ESI
JLE 0x001011bf
MOV RCX,R8
LEA EAX,[RSI + -0x1]
LEA R9,[R8 + RAX*0x4 + 0x4]
LAB_00101181:
MOV EAX,dword ptr [RCX]
CDQ
IDIV EDI
CMP EDX,0x1
SBB EAX,-0x1
MOV dword ptr [RCX],EAX
ADD RCX,0x4
CMP RCX,R9
JNZ 0x00101181
SUB ESI,0x1
MOVSXD RDX,ESI
MOV ESI,0xffffffff
MOV EAX,0xffffffff
JMP 0x001011b1
LAB_001011a9:
SUB RDX,0x1
TEST EDX,EDX
JS 0x001011c4
LAB_001011b1:
MOV ECX,dword ptr [R8 + RDX*0x4]
CMP ECX,ESI
JLE 0x001011a9
MOV ESI,ECX
MOV EAX,EDX
JMP 0x001011a9
LAB_001011bf:
MOV EAX,0xffffffff
LAB_001011c4:
ADD EAX,0x1
RET | int func0(int *param_1,int param_2,int param_3)
{
int iVar1;
ulong uVar2;
int *piVar3;
ulong uVar4;
int iVar5;
if (param_2 < 1) {
iVar1 = -1;
}
else {
piVar3 = param_1;
do {
*piVar3 = (*piVar3 / param_3 + 1) - (uint)(*piVar3 % param_3 == 0);
piVar3 = piVar3 + 1;
} while (piVar3 != param_1 + (ulong)(param_2 - 1) + 1);
uVar4 = (ulong)(param_2 + -1);
iVar5 = -1;
uVar2 = 0xffffffff;
do {
if (iVar5 < param_1[uVar4]) {
uVar2 = uVar4 & 0xffffffff;
iVar5 = param_1[uVar4];
}
iVar1 = (int)uVar2;
uVar4 = uVar4 - 1;
} while (-1 < (int)uVar4);
}
return iVar1 + 1;
} |
4,994 | func0 | #include <assert.h>
| int func0(int a[], int n, int m) {
int i;
for (i = 0; i < n; i++) {
a[i] = (a[i] / m + (a[i] % m != 0));
}
int result = -1, maxx = -1;
for (i = n - 1; i >= 0; i--) {
if (maxx < a[i]) {
maxx = a[i];
result = i;
}
}
return result + 1;
}
| int main() {
int array1[3] = {2, 5, 4};
int array2[2] = {4, 3};
int array3[4] = {1, 2, 3, 4};
assert(func0(array1, 3, 2) == 2);
assert(func0(array2, 2, 2) == 2);
assert(func0(array3, 4, 1) == 4);
return 0;
}
| O2 | c | func0:
endbr64
mov %edx,%r9d
lea -0x1(%rsi),%r8d
test %esi,%esi
jle 1300 <func0+0x70>
mov %r8d,%eax
mov %rdi,%rcx
lea 0x4(%rdi,%rax,4),%rsi
nopw 0x0(%rax,%rax,1)
mov (%rcx),%eax
cltd
idiv %r9d
test %edx,%edx
setne %dl
add $0x4,%rcx
movzbl %dl,%edx
add %edx,%eax
mov %eax,-0x4(%rcx)
cmp %rcx,%rsi
jne 12b0 <func0+0x20>
movslq %r8d,%rdx
mov $0xffffffff,%esi
mov $0xffffffff,%eax
nopl 0x0(%rax)
mov (%rdi,%rdx,4),%ecx
cmp %esi,%ecx
jle 12eb <func0+0x5b>
mov %ecx,%esi
mov %edx,%eax
sub $0x1,%rdx
test %edx,%edx
jns 12e0 <func0+0x50>
add $0x1,%eax
retq
nopw 0x0(%rax,%rax,1)
test %r8d,%r8d
jns 12cc <func0+0x3c>
xor %eax,%eax
retq
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
mov r9, rdi
mov r8d, edx
lea edi, [rsi-1]
test esi, esi
jle short loc_12F0
mov eax, edi
mov rcx, r9
lea rsi, [r9+rax*4+4]
nop dword ptr [rax+rax+00h]
loc_12B0:
mov eax, [rcx]
cdq
idiv r8d
cmp edx, 1
sbb eax, 0FFFFFFFFh
add rcx, 4
mov [rcx-4], eax
cmp rsi, rcx
jnz short loc_12B0
loc_12C8:
movsxd rdx, edi
mov esi, 0FFFFFFFFh
mov eax, 0FFFFFFFFh
nop dword ptr [rax]
loc_12D8:
mov ecx, [r9+rdx*4]
cmp ecx, esi
jle short loc_12E4
mov esi, ecx
mov eax, edx
loc_12E4:
sub rdx, 1
test edx, edx
jns short loc_12D8
add eax, 1
retn
loc_12F0:
test edi, edi
jns short loc_12C8
xor eax, eax
retn | long long func0(_DWORD *a1, int a2, int a3)
{
int v4; // edi
_DWORD *v5; // rcx
int v6; // eax
long long v7; // rdx
int v8; // esi
int v9; // eax
v4 = a2 - 1;
if ( a2 <= 0 )
{
if ( v4 < 0 )
return 0LL;
}
else
{
v5 = a1;
do
{
v6 = *v5 / a3 - ((*v5 % a3 == 0) - 1);
*v5++ = v6;
}
while ( &a1[v4 + 1] != v5 );
}
v7 = v4;
v8 = -1;
v9 = -1;
do
{
if ( a1[v7] > v8 )
{
v8 = a1[v7];
v9 = v7;
}
--v7;
}
while ( (int)v7 >= 0 );
return (unsigned int)(v9 + 1);
} | func0:
ENDBR64
MOV R9,RDI
MOV R8D,EDX
LEA EDI,[RSI + -0x1]
TEST ESI,ESI
JLE 0x001012f0
MOV EAX,EDI
MOV RCX,R9
LEA RSI,[R9 + RAX*0x4 + 0x4]
NOP dword ptr [RAX + RAX*0x1]
LAB_001012b0:
MOV EAX,dword ptr [RCX]
CDQ
IDIV R8D
CMP EDX,0x1
SBB EAX,-0x1
ADD RCX,0x4
MOV dword ptr [RCX + -0x4],EAX
CMP RSI,RCX
JNZ 0x001012b0
LAB_001012c8:
MOVSXD RDX,EDI
MOV ESI,0xffffffff
MOV EAX,0xffffffff
NOP dword ptr [RAX]
LAB_001012d8:
MOV ECX,dword ptr [R9 + RDX*0x4]
CMP ECX,ESI
JLE 0x001012e4
MOV ESI,ECX
MOV EAX,EDX
LAB_001012e4:
SUB RDX,0x1
TEST EDX,EDX
JNS 0x001012d8
ADD EAX,0x1
RET
LAB_001012f0:
TEST EDI,EDI
JNS 0x001012c8
XOR EAX,EAX
RET | int func0(int *param_1,int param_2,int param_3)
{
ulong uVar1;
int *piVar2;
int *piVar3;
ulong uVar4;
int iVar5;
uint uVar6;
uVar6 = param_2 - 1;
if (param_2 < 1) {
if ((int)uVar6 < 0) {
return 0;
}
}
else {
piVar2 = param_1;
do {
piVar3 = piVar2 + 1;
*piVar2 = (*piVar2 / param_3 + 1) - (uint)(*piVar2 % param_3 == 0);
piVar2 = piVar3;
} while (param_1 + (ulong)uVar6 + 1 != piVar3);
}
uVar4 = (ulong)(int)uVar6;
iVar5 = -1;
uVar1 = 0xffffffff;
do {
if (iVar5 < param_1[uVar4]) {
uVar1 = uVar4 & 0xffffffff;
iVar5 = param_1[uVar4];
}
uVar4 = uVar4 - 1;
} while (-1 < (int)uVar4);
return (int)uVar1 + 1;
} |
4,995 | func0 | #include <assert.h>
| int func0(int a[], int n, int m) {
int i;
for (i = 0; i < n; i++) {
a[i] = (a[i] / m + (a[i] % m != 0));
}
int result = -1, maxx = -1;
for (i = n - 1; i >= 0; i--) {
if (maxx < a[i]) {
maxx = a[i];
result = i;
}
}
return result + 1;
}
| int main() {
int array1[3] = {2, 5, 4};
int array2[2] = {4, 3};
int array3[4] = {1, 2, 3, 4};
assert(func0(array1, 3, 2) == 2);
assert(func0(array2, 2, 2) == 2);
assert(func0(array3, 4, 1) == 4);
return 0;
}
| O3 | c | func0:
endbr64
mov %edx,%r9d
lea -0x1(%rsi),%r8d
test %esi,%esi
jle 12f0 <func0+0x70>
mov %r8d,%eax
mov %rdi,%rcx
lea 0x4(%rdi,%rax,4),%rsi
nopw 0x0(%rax,%rax,1)
mov (%rcx),%eax
cltd
idiv %r9d
test %edx,%edx
setne %dl
add $0x4,%rcx
movzbl %dl,%edx
add %edx,%eax
mov %eax,-0x4(%rcx)
cmp %rsi,%rcx
jne 12a0 <func0+0x20>
movslq %r8d,%rdx
mov $0xffffffff,%esi
mov $0xffffffff,%eax
nopl 0x0(%rax)
mov (%rdi,%rdx,4),%ecx
cmp %esi,%ecx
jle 12db <func0+0x5b>
mov %ecx,%esi
mov %edx,%eax
sub $0x1,%rdx
test %edx,%edx
jns 12d0 <func0+0x50>
add $0x1,%eax
retq
nopw 0x0(%rax,%rax,1)
test %r8d,%r8d
jns 12bc <func0+0x3c>
xor %eax,%eax
retq
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
mov r8, rdi
mov edi, edx
test esi, esi
jle short loc_12F0
movsxd rax, esi
mov rcx, r8
lea r9, [r8+rax*4]
nop word ptr [rax+rax+00000000h]
loc_12A0:
mov eax, [rcx]
cdq
idiv edi
cmp edx, 1
sbb eax, 0FFFFFFFFh
add rcx, 4
mov [rcx-4], eax
cmp rcx, r9
jnz short loc_12A0
sub esi, 1
mov ecx, 0FFFFFFFFh
mov eax, 0FFFFFFFFh
movsxd rdx, esi
nop word ptr [rax+rax+00000000h]
loc_12D0:
mov esi, [r8+rdx*4]
cmp esi, ecx
cmovg eax, edx
cmovg ecx, esi
sub rdx, 1
test edx, edx
jns short loc_12D0
add eax, 1
retn
loc_12F0:
xor eax, eax
retn | long long func0(_DWORD *a1, int a2, int a3)
{
_DWORD *v3; // rcx
int v4; // eax
int v5; // ecx
int v6; // eax
long long v7; // rdx
if ( a2 <= 0 )
return 0LL;
v3 = a1;
do
{
v4 = *v3 / a3 - ((*v3 % a3 == 0) - 1);
*v3++ = v4;
}
while ( v3 != &a1[a2] );
v5 = -1;
v6 = -1;
v7 = a2 - 1;
do
{
if ( a1[v7] > v5 )
{
v6 = v7;
v5 = a1[v7];
}
--v7;
}
while ( (int)v7 >= 0 );
return (unsigned int)(v6 + 1);
} | func0:
ENDBR64
MOV R8,RDI
MOV EDI,EDX
TEST ESI,ESI
JLE 0x001012f0
MOVSXD RAX,ESI
MOV RCX,R8
LEA R9,[R8 + RAX*0x4]
NOP word ptr [RAX + RAX*0x1]
LAB_001012a0:
MOV EAX,dword ptr [RCX]
CDQ
IDIV EDI
CMP EDX,0x1
SBB EAX,-0x1
ADD RCX,0x4
MOV dword ptr [RCX + -0x4],EAX
CMP RCX,R9
JNZ 0x001012a0
SUB ESI,0x1
MOV ECX,0xffffffff
MOV EAX,0xffffffff
MOVSXD RDX,ESI
NOP word ptr [RAX + RAX*0x1]
LAB_001012d0:
MOV ESI,dword ptr [R8 + RDX*0x4]
CMP ESI,ECX
CMOVG EAX,EDX
CMOVG ECX,ESI
SUB RDX,0x1
TEST EDX,EDX
JNS 0x001012d0
ADD EAX,0x1
RET
LAB_001012f0:
XOR EAX,EAX
RET | int func0(int *param_1,int param_2,int param_3)
{
ulong uVar1;
int iVar2;
int *piVar3;
int *piVar4;
ulong uVar5;
if (param_2 < 1) {
return 0;
}
piVar3 = param_1;
do {
piVar4 = piVar3 + 1;
*piVar3 = (*piVar3 / param_3 + 1) - (uint)(*piVar3 % param_3 == 0);
piVar3 = piVar4;
} while (piVar4 != param_1 + param_2);
iVar2 = -1;
uVar1 = 0xffffffff;
uVar5 = (ulong)(param_2 + -1);
do {
if (iVar2 < param_1[uVar5]) {
uVar1 = uVar5 & 0xffffffff;
iVar2 = param_1[uVar5];
}
uVar5 = uVar5 - 1;
} while (-1 < (int)uVar5);
return (int)uVar1 + 1;
} |
4,996 | func0 |
#include <assert.h>
#include <stdio.h>
| double func0(double r, double h) {
double volume = 3.1415 * r * r * h;
return volume;
}
| int main() {
assert(func0(10, 5) == 1570.7500000000002);
assert(func0(4, 5) == 251.32000000000002);
assert(func0(4, 10) == 502.64000000000004);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
movsd %xmm0,-0x18(%rbp)
movsd %xmm1,-0x20(%rbp)
movsd -0x18(%rbp),%xmm1
movsd 0xf58(%rip),%xmm0
mulsd %xmm1,%xmm0
mulsd -0x18(%rbp),%xmm0
movsd -0x20(%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 [rbp+var_20], xmm1
movsd xmm1, [rbp+var_18]
movsd xmm0, cs:qword_20A0
mulsd xmm0, xmm1
mulsd xmm0, [rbp+var_18]
movsd xmm1, [rbp+var_20]
mulsd xmm0, xmm1
movsd [rbp+var_8], xmm0
movsd xmm0, [rbp+var_8]
pop rbp
retn | double func0(double a1, double a2)
{
return 3.1415 * a1 * a1 * a2;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOVSD qword ptr [RBP + -0x18],XMM0
MOVSD qword ptr [RBP + -0x20],XMM1
MOVSD XMM1,qword ptr [RBP + -0x18]
MOVSD XMM0,qword ptr [0x001020a0]
MULSD XMM0,XMM1
MULSD XMM0,qword ptr [RBP + -0x18]
MOVSD XMM1,qword ptr [RBP + -0x20]
MULSD XMM0,XMM1
MOVSD qword ptr [RBP + -0x8],XMM0
MOVSD XMM0,qword ptr [RBP + -0x8]
POP RBP
RET | double func0(double param_1,double param_2)
{
return DAT_001020a0 * param_1 * param_1 * param_2;
} |
4,997 | func0 |
#include <assert.h>
#include <stdio.h>
| double func0(double r, double h) {
double volume = 3.1415 * r * r * h;
return volume;
}
| int main() {
assert(func0(10, 5) == 1570.7500000000002);
assert(func0(4, 5) == 251.32000000000002);
assert(func0(4, 10) == 502.64000000000004);
return 0;
}
| O1 | c | func0:
endbr64
movapd %xmm0,%xmm2
mulsd 0xecf(%rip),%xmm0
mulsd %xmm2,%xmm0
mulsd %xmm1,%xmm0
retq
| func0:
endbr64
movapd xmm2, xmm0
mulsd xmm0, cs:qword_2008
mulsd xmm0, xmm2
mulsd xmm0, xmm1
retn | double func0(double a1, double a2)
{
return a1 * 3.1415 * a1 * a2;
} | func0:
ENDBR64
MOVAPD XMM2,XMM0
MULSD XMM0,qword ptr [0x00102008]
MULSD XMM0,XMM2
MULSD XMM0,XMM1
RET | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
double func0(double param_1,double param_2)
{
return param_1 * _DAT_00102008 * param_1 * param_2;
} |
4,998 | func0 |
#include <assert.h>
#include <stdio.h>
| double func0(double r, double h) {
double volume = 3.1415 * r * r * h;
return volume;
}
| int main() {
assert(func0(10, 5) == 1570.7500000000002);
assert(func0(4, 5) == 251.32000000000002);
assert(func0(4, 10) == 502.64000000000004);
return 0;
}
| O2 | c | func0:
endbr64
movapd %xmm0,%xmm2
movsd 0xeb8(%rip),%xmm0
mulsd %xmm2,%xmm0
mulsd %xmm2,%xmm0
mulsd %xmm1,%xmm0
retq
nopl (%rax)
| func0:
endbr64
movapd xmm2, xmm0
movsd xmm0, cs:qword_2008
mulsd xmm0, xmm2
mulsd xmm0, xmm2
mulsd xmm0, xmm1
retn | double func0(double a1, double a2)
{
return 3.1415 * a1 * a1 * a2;
} | func0:
ENDBR64
MOVAPD XMM2,XMM0
MOVSD XMM0,qword ptr [0x00102008]
MULSD XMM0,XMM2
MULSD XMM0,XMM2
MULSD XMM0,XMM1
RET | double func0(double param_1,double param_2)
{
return DAT_00102008 * param_1 * param_1 * param_2;
} |
4,999 | func0 |
#include <assert.h>
#include <stdio.h>
| double func0(double r, double h) {
double volume = 3.1415 * r * r * h;
return volume;
}
| int main() {
assert(func0(10, 5) == 1570.7500000000002);
assert(func0(4, 5) == 251.32000000000002);
assert(func0(4, 10) == 502.64000000000004);
return 0;
}
| O3 | c | func0:
endbr64
movapd %xmm0,%xmm2
movsd 0xeb8(%rip),%xmm0
mulsd %xmm2,%xmm0
mulsd %xmm2,%xmm0
mulsd %xmm1,%xmm0
retq
nopl (%rax)
| func0:
endbr64
movapd xmm2, xmm0
movsd xmm0, cs:qword_2008
mulsd xmm0, xmm2
mulsd xmm0, xmm2
mulsd xmm0, xmm1
retn | double func0(double a1, double a2)
{
return 3.1415 * a1 * a1 * a2;
} | func0:
ENDBR64
MOVAPD XMM2,XMM0
MOVSD XMM0,qword ptr [0x00102008]
MULSD XMM0,XMM2
MULSD XMM0,XMM2
MULSD XMM0,XMM1
RET | double func0(double param_1,double param_2)
{
return DAT_00102008 * param_1 * param_1 * param_2;
} |
5,000 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
typedef struct {
char key[100];
int value;
} DictItem;
typedef struct {
DictItem* items;
int size;
} Dict;
| Dict func0(Dict input, int n) {
Dict result;
result.items = (DictItem*)malloc(input.size * sizeof(DictItem));
result.size = 0;
for (int i = 0; i < input.size; i++) {
if (input.items[i].value >= n) {
result.items[result.size] = input.items[i];
result.size++;
}
}
return result;
}
| int main() {
Dict d1, d2, d3;
d1.size = 4;
d1.items = (DictItem*)malloc(d1.size * sizeof(DictItem));
strcpy(d1.items[0].key, "Cierra Vega"); d1.items[0].value = 175;
strcpy(d1.items[1].key, "Alden Cantrell"); d1.items[1].value = 180;
strcpy(d1.items[2].key, "Kierra Gentry"); d1.items[2].value = 165;
strcpy(d1.items[3].key, "Pierre Cox"); d1.items[3].value = 190;
Dict result;
result = func0(d1, 170);
assert(result.size == 3 && strcmp(result.items[0].key, "Cierra Vega") == 0 && strcmp(result.items[1].key, "Alden Cantrell") == 0 && strcmp(result.items[2].key, "Pierre Cox") == 0);
result = func0(d1, 180);
assert(result.size == 2 && strcmp(result.items[0].key, "Alden Cantrell") == 0 && strcmp(result.items[1].key, "Pierre Cox") == 0);
result = func0(d1, 190);
assert(result.size == 1 && strcmp(result.items[0].key, "Pierre Cox") == 0);
free(d1.items);
free(result.items);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
sub $0x48,%rsp
mov %rdi,%rcx
mov %rsi,%rax
mov %rax,%rbx
mov %rcx,-0x40(%rbp)
mov %rbx,-0x38(%rbp)
mov %edx,-0x44(%rbp)
mov -0x38(%rbp),%eax
movslq %eax,%rdx
mov %rdx,%rax
add %rax,%rax
add %rdx,%rax
shl $0x2,%rax
add %rdx,%rax
shl $0x3,%rax
mov %rax,%rdi
callq 10b0 <malloc@plt>
mov %rax,-0x20(%rbp)
movl $0x0,-0x18(%rbp)
movl $0x0,-0x24(%rbp)
jmpq 12e6 <func0+0x13d>
mov -0x40(%rbp),%rcx
mov -0x24(%rbp),%eax
movslq %eax,%rdx
mov %rdx,%rax
add %rax,%rax
add %rdx,%rax
shl $0x2,%rax
add %rdx,%rax
shl $0x3,%rax
add %rcx,%rax
mov 0x64(%rax),%eax
cmp %eax,-0x44(%rbp)
jg 12e2 <func0+0x139>
mov -0x40(%rbp),%rcx
mov -0x24(%rbp),%eax
movslq %eax,%rdx
mov %rdx,%rax
add %rax,%rax
add %rdx,%rax
shl $0x2,%rax
add %rdx,%rax
shl $0x3,%rax
lea (%rcx,%rax,1),%rdx
mov -0x20(%rbp),%rsi
mov -0x18(%rbp),%eax
movslq %eax,%rcx
mov %rcx,%rax
add %rax,%rax
add %rcx,%rax
shl $0x2,%rax
add %rcx,%rax
shl $0x3,%rax
add %rsi,%rax
mov (%rdx),%rcx
mov 0x8(%rdx),%rbx
mov %rcx,(%rax)
mov %rbx,0x8(%rax)
mov 0x10(%rdx),%rcx
mov 0x18(%rdx),%rbx
mov %rcx,0x10(%rax)
mov %rbx,0x18(%rax)
mov 0x20(%rdx),%rcx
mov 0x28(%rdx),%rbx
mov %rcx,0x20(%rax)
mov %rbx,0x28(%rax)
mov 0x30(%rdx),%rcx
mov 0x38(%rdx),%rbx
mov %rcx,0x30(%rax)
mov %rbx,0x38(%rax)
mov 0x40(%rdx),%rcx
mov 0x48(%rdx),%rbx
mov %rcx,0x40(%rax)
mov %rbx,0x48(%rax)
mov 0x50(%rdx),%rcx
mov 0x58(%rdx),%rbx
mov %rcx,0x50(%rax)
mov %rbx,0x58(%rax)
mov 0x60(%rdx),%rdx
mov %rdx,0x60(%rax)
mov -0x18(%rbp),%eax
add $0x1,%eax
mov %eax,-0x18(%rbp)
addl $0x1,-0x24(%rbp)
mov -0x38(%rbp),%eax
cmp %eax,-0x24(%rbp)
jl 1203 <func0+0x5a>
mov -0x20(%rbp),%rax
mov -0x18(%rbp),%rdx
add $0x48,%rsp
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
push rbx
sub rsp, 48h
mov rax, rdi
mov rcx, rax
mov rbx, rdx
mov rbx, rsi
mov [rbp+var_40], rcx
mov [rbp+var_38], rbx
mov [rbp+var_44], edx
mov eax, dword ptr [rbp+var_38]
movsxd rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
shl rax, 2
add rax, rdx
shl rax, 3
mov rdi, rax; size
call _malloc
mov [rbp+var_20], rax
mov dword ptr [rbp+var_18], 0
mov [rbp+var_24], 0
jmp loc_12E9
loc_1206:
mov rcx, [rbp+var_40]
mov eax, [rbp+var_24]
movsxd rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
shl rax, 2
add rax, rdx
shl rax, 3
add rax, rcx
mov eax, [rax+64h]
cmp [rbp+var_44], eax
jg loc_12E5
mov rcx, [rbp+var_40]
mov eax, [rbp+var_24]
movsxd rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
shl rax, 2
add rax, rdx
shl rax, 3
lea rdx, [rcx+rax]
mov rsi, [rbp+var_20]
mov eax, dword ptr [rbp+var_18]
movsxd rcx, eax
mov rax, rcx
add rax, rax
add rax, rcx
shl rax, 2
add rax, rcx
shl rax, 3
add rax, rsi
mov rcx, [rdx]
mov rbx, [rdx+8]
mov [rax], rcx
mov [rax+8], rbx
mov rcx, [rdx+10h]
mov rbx, [rdx+18h]
mov [rax+10h], rcx
mov [rax+18h], rbx
mov rcx, [rdx+20h]
mov rbx, [rdx+28h]
mov [rax+20h], rcx
mov [rax+28h], rbx
mov rcx, [rdx+30h]
mov rbx, [rdx+38h]
mov [rax+30h], rcx
mov [rax+38h], rbx
mov rcx, [rdx+40h]
mov rbx, [rdx+48h]
mov [rax+40h], rcx
mov [rax+48h], rbx
mov rcx, [rdx+50h]
mov rbx, [rdx+58h]
mov [rax+50h], rcx
mov [rax+58h], rbx
mov rdx, [rdx+60h]
mov [rax+60h], rdx
mov eax, dword ptr [rbp+var_18]
add eax, 1
mov dword ptr [rbp+var_18], eax
loc_12E5:
add [rbp+var_24], 1
loc_12E9:
mov eax, dword ptr [rbp+var_38]
cmp [rbp+var_24], eax
jl loc_1206
mov rax, [rbp+var_20]
mov rdx, [rbp+var_18]
mov rbx, [rbp+var_8]
leave
retn | char * func0(long long a1, int a2, int a3)
{
_QWORD *v3; // rdx
char *v4; // rax
long long v5; // rbx
long long v6; // rbx
long long v7; // rbx
long long v8; // rbx
long long v9; // rbx
long long v10; // rbx
int i; // [rsp+2Ch] [rbp-24h]
char *v14; // [rsp+30h] [rbp-20h]
int v15; // [rsp+38h] [rbp-18h]
v14 = (char *)malloc(104LL * a2);
v15 = 0;
for ( i = 0; i < a2; ++i )
{
if ( a3 <= *(_DWORD *)(a1 + 104LL * i + 100) )
{
v3 = (_QWORD *)(a1 + 104LL * i);
v4 = &v14[104 * v15];
v5 = v3[1];
*(_QWORD *)v4 = *v3;
*((_QWORD *)v4 + 1) = v5;
v6 = v3[3];
*((_QWORD *)v4 + 2) = v3[2];
*((_QWORD *)v4 + 3) = v6;
v7 = v3[5];
*((_QWORD *)v4 + 4) = v3[4];
*((_QWORD *)v4 + 5) = v7;
v8 = v3[7];
*((_QWORD *)v4 + 6) = v3[6];
*((_QWORD *)v4 + 7) = v8;
v9 = v3[9];
*((_QWORD *)v4 + 8) = v3[8];
*((_QWORD *)v4 + 9) = v9;
v10 = v3[11];
*((_QWORD *)v4 + 10) = v3[10];
*((_QWORD *)v4 + 11) = v10;
*((_QWORD *)v4 + 12) = v3[12];
++v15;
}
}
return v14;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
PUSH RBX
SUB RSP,0x48
MOV RAX,RDI
MOV RCX,RAX
MOV RBX,RDX
MOV RBX,RSI
MOV qword ptr [RBP + -0x40],RCX
MOV qword ptr [RBP + -0x38],RBX
MOV dword ptr [RBP + -0x44],EDX
MOV EAX,dword ptr [RBP + -0x38]
MOVSXD RDX,EAX
MOV RAX,RDX
ADD RAX,RAX
ADD RAX,RDX
SHL RAX,0x2
ADD RAX,RDX
SHL RAX,0x3
MOV RDI,RAX
CALL 0x001010b0
MOV qword ptr [RBP + -0x20],RAX
MOV dword ptr [RBP + -0x18],0x0
MOV dword ptr [RBP + -0x24],0x0
JMP 0x001012e9
LAB_00101206:
MOV RCX,qword ptr [RBP + -0x40]
MOV EAX,dword ptr [RBP + -0x24]
MOVSXD RDX,EAX
MOV RAX,RDX
ADD RAX,RAX
ADD RAX,RDX
SHL RAX,0x2
ADD RAX,RDX
SHL RAX,0x3
ADD RAX,RCX
MOV EAX,dword ptr [RAX + 0x64]
CMP dword ptr [RBP + -0x44],EAX
JG 0x001012e5
MOV RCX,qword ptr [RBP + -0x40]
MOV EAX,dword ptr [RBP + -0x24]
MOVSXD RDX,EAX
MOV RAX,RDX
ADD RAX,RAX
ADD RAX,RDX
SHL RAX,0x2
ADD RAX,RDX
SHL RAX,0x3
LEA RDX,[RCX + RAX*0x1]
MOV RSI,qword ptr [RBP + -0x20]
MOV EAX,dword ptr [RBP + -0x18]
MOVSXD RCX,EAX
MOV RAX,RCX
ADD RAX,RAX
ADD RAX,RCX
SHL RAX,0x2
ADD RAX,RCX
SHL RAX,0x3
ADD RAX,RSI
MOV RCX,qword ptr [RDX]
MOV RBX,qword ptr [RDX + 0x8]
MOV qword ptr [RAX],RCX
MOV qword ptr [RAX + 0x8],RBX
MOV RCX,qword ptr [RDX + 0x10]
MOV RBX,qword ptr [RDX + 0x18]
MOV qword ptr [RAX + 0x10],RCX
MOV qword ptr [RAX + 0x18],RBX
MOV RCX,qword ptr [RDX + 0x20]
MOV RBX,qword ptr [RDX + 0x28]
MOV qword ptr [RAX + 0x20],RCX
MOV qword ptr [RAX + 0x28],RBX
MOV RCX,qword ptr [RDX + 0x30]
MOV RBX,qword ptr [RDX + 0x38]
MOV qword ptr [RAX + 0x30],RCX
MOV qword ptr [RAX + 0x38],RBX
MOV RCX,qword ptr [RDX + 0x40]
MOV RBX,qword ptr [RDX + 0x48]
MOV qword ptr [RAX + 0x40],RCX
MOV qword ptr [RAX + 0x48],RBX
MOV RCX,qword ptr [RDX + 0x50]
MOV RBX,qword ptr [RDX + 0x58]
MOV qword ptr [RAX + 0x50],RCX
MOV qword ptr [RAX + 0x58],RBX
MOV RDX,qword ptr [RDX + 0x60]
MOV qword ptr [RAX + 0x60],RDX
MOV EAX,dword ptr [RBP + -0x18]
ADD EAX,0x1
MOV dword ptr [RBP + -0x18],EAX
LAB_001012e5:
ADD dword ptr [RBP + -0x24],0x1
LAB_001012e9:
MOV EAX,dword ptr [RBP + -0x38]
CMP dword ptr [RBP + -0x24],EAX
JL 0x00101206
MOV RAX,qword ptr [RBP + -0x20]
MOV RDX,qword ptr [RBP + -0x18]
MOV RBX,qword ptr [RBP + -0x8]
LEAVE
RET | int [16] func0(long param_1,int param_2,int param_3)
{
int8 *puVar1;
int8 uVar2;
int auVar3 [16];
void *pvVar4;
int8 *puVar5;
int local_2c;
int local_20;
int4 uStack_1c;
pvVar4 = malloc((long)param_2 * 0x68);
local_20 = 0;
for (local_2c = 0; local_2c < param_2; local_2c = local_2c + 1) {
if (param_3 <= *(int *)((long)local_2c * 0x68 + param_1 + 100)) {
puVar1 = (int8 *)(param_1 + (long)local_2c * 0x68);
puVar5 = (int8 *)((long)local_20 * 0x68 + (long)pvVar4);
uVar2 = puVar1[1];
*puVar5 = *puVar1;
puVar5[1] = uVar2;
uVar2 = puVar1[3];
puVar5[2] = puVar1[2];
puVar5[3] = uVar2;
uVar2 = puVar1[5];
puVar5[4] = puVar1[4];
puVar5[5] = uVar2;
uVar2 = puVar1[7];
puVar5[6] = puVar1[6];
puVar5[7] = uVar2;
uVar2 = puVar1[9];
puVar5[8] = puVar1[8];
puVar5[9] = uVar2;
uVar2 = puVar1[0xb];
puVar5[10] = puVar1[10];
puVar5[0xb] = uVar2;
puVar5[0xc] = puVar1[0xc];
local_20 = local_20 + 1;
}
}
auVar3._8_4_ = local_20;
auVar3._0_8_ = pvVar4;
auVar3._12_4_ = uStack_1c;
return auVar3;
} |
5,001 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
typedef struct {
char key[100];
int value;
} DictItem;
typedef struct {
DictItem* items;
int size;
} Dict;
| Dict func0(Dict input, int n) {
Dict result;
result.items = (DictItem*)malloc(input.size * sizeof(DictItem));
result.size = 0;
for (int i = 0; i < input.size; i++) {
if (input.items[i].value >= n) {
result.items[result.size] = input.items[i];
result.size++;
}
}
return result;
}
| int main() {
Dict d1, d2, d3;
d1.size = 4;
d1.items = (DictItem*)malloc(d1.size * sizeof(DictItem));
strcpy(d1.items[0].key, "Cierra Vega"); d1.items[0].value = 175;
strcpy(d1.items[1].key, "Alden Cantrell"); d1.items[1].value = 180;
strcpy(d1.items[2].key, "Kierra Gentry"); d1.items[2].value = 165;
strcpy(d1.items[3].key, "Pierre Cox"); d1.items[3].value = 190;
Dict result;
result = func0(d1, 170);
assert(result.size == 3 && strcmp(result.items[0].key, "Cierra Vega") == 0 && strcmp(result.items[1].key, "Alden Cantrell") == 0 && strcmp(result.items[2].key, "Pierre Cox") == 0);
result = func0(d1, 180);
assert(result.size == 2 && strcmp(result.items[0].key, "Alden Cantrell") == 0 && strcmp(result.items[1].key, "Pierre Cox") == 0);
result = func0(d1, 190);
assert(result.size == 1 && strcmp(result.items[0].key, "Pierre Cox") == 0);
free(d1.items);
free(result.items);
return 0;
}
| O1 | c | func0:
endbr64
push %r12
push %rbp
push %rbx
mov %rdi,%r12
mov %rsi,%rbp
mov %edx,%ebx
movslq %esi,%rax
lea (%rax,%rax,2),%rdx
lea (%rax,%rdx,4),%rdi
shl $0x3,%rdi
callq 1090 <malloc@plt>
test %ebp,%ebp
jle 1229 <func0+0xa0>
mov %r12,%rcx
lea -0x1(%rbp),%edx
lea (%rdx,%rdx,2),%rsi
lea (%rdx,%rsi,4),%rdx
lea 0x68(%r12,%rdx,8),%rdi
mov $0x0,%edx
jmp 11d4 <func0+0x4b>
add $0x68,%rcx
cmp %rdi,%rcx
je 122e <func0+0xa5>
cmp %ebx,0x64(%rcx)
jl 11cb <func0+0x42>
movslq %edx,%rsi
lea (%rsi,%rsi,2),%r8
lea (%rsi,%r8,4),%rsi
lea (%rax,%rsi,8),%rsi
movdqu (%rcx),%xmm0
movups %xmm0,(%rsi)
movdqu 0x10(%rcx),%xmm1
movups %xmm1,0x10(%rsi)
movdqu 0x20(%rcx),%xmm2
movups %xmm2,0x20(%rsi)
movdqu 0x30(%rcx),%xmm3
movups %xmm3,0x30(%rsi)
movdqu 0x40(%rcx),%xmm4
movups %xmm4,0x40(%rsi)
movdqu 0x50(%rcx),%xmm5
movups %xmm5,0x50(%rsi)
mov 0x60(%rcx),%r8
mov %r8,0x60(%rsi)
add $0x1,%edx
jmp 11cb <func0+0x42>
mov $0x0,%edx
mov %edx,%edx
pop %rbx
pop %rbp
pop %r12
retq
| func0:
endbr64
push r12
push rbp
push rbx
mov r12, rdi
mov rbp, rsi
mov ebx, edx
movsxd rax, esi
lea rdx, [rax+rax*2]
lea rdi, [rax+rdx*4]
shl rdi, 3
call _malloc
mov r8, rax
test ebp, ebp
jle short loc_124C
mov rax, r12
lea edx, [rbp-1]
lea rcx, [rdx+rdx*2]
lea rdx, [rdx+rcx*4]
lea rsi, [r12+rdx*8+68h]
mov edx, 0
jmp short loc_11F7
loc_11EE:
add rax, 68h ; 'h'
cmp rax, rsi
jz short loc_1251
loc_11F7:
cmp [rax+64h], ebx
jl short loc_11EE
movsxd rcx, edx
lea rdi, [rcx+rcx*2]
lea rcx, [rcx+rdi*4]
lea rcx, [r8+rcx*8]
movdqu xmm0, xmmword ptr [rax]
movups xmmword ptr [rcx], xmm0
movdqu xmm1, xmmword ptr [rax+10h]
movups xmmword ptr [rcx+10h], xmm1
movdqu xmm2, xmmword ptr [rax+20h]
movups xmmword ptr [rcx+20h], xmm2
movdqu xmm3, xmmword ptr [rax+30h]
movups xmmword ptr [rcx+30h], xmm3
movdqu xmm4, xmmword ptr [rax+40h]
movups xmmword ptr [rcx+40h], xmm4
movdqu xmm5, xmmword ptr [rax+50h]
movups xmmword ptr [rcx+50h], xmm5
mov rdi, [rax+60h]
mov [rcx+60h], rdi
add edx, 1
jmp short loc_11EE
loc_124C:
mov edx, 0
loc_1251:
mov edx, edx
mov rax, r8
pop rbx
pop rbp
pop r12
retn | long long func0(const __m128i *a1, int a2, __int32 a3)
{
long long v4; // r8
const __m128i *v5; // rax
long long v6; // rsi
int v7; // edx
__m128i *v8; // rcx
v4 = malloc(104LL * a2);
if ( a2 > 0 )
{
v5 = a1;
v6 = (long long)&a1[6].m128i_i64[13 * (unsigned int)(a2 - 1) + 1];
v7 = 0;
do
{
if ( v5[6].m128i_i32[1] >= a3 )
{
v8 = (__m128i *)(v4 + 104LL * v7);
*v8 = _mm_loadu_si128(v5);
v8[1] = _mm_loadu_si128(v5 + 1);
v8[2] = _mm_loadu_si128(v5 + 2);
v8[3] = _mm_loadu_si128(v5 + 3);
v8[4] = _mm_loadu_si128(v5 + 4);
v8[5] = _mm_loadu_si128(v5 + 5);
v8[6].m128i_i64[0] = v5[6].m128i_i64[0];
++v7;
}
v5 = (const __m128i *)((char *)v5 + 104);
}
while ( v5 != (const __m128i *)v6 );
}
return v4;
} | func0:
ENDBR64
PUSH R12
PUSH RBP
PUSH RBX
MOV R12,RDI
MOV RBP,RSI
MOV EBX,EDX
MOVSXD RAX,ESI
LEA RDX,[RAX + RAX*0x2]
LEA RDI,[RAX + RDX*0x4]
SHL RDI,0x3
CALL 0x001010b0
MOV R8,RAX
TEST EBP,EBP
JLE 0x0010124c
MOV RAX,R12
LEA EDX,[RBP + -0x1]
LEA RCX,[RDX + RDX*0x2]
LEA RDX,[RDX + RCX*0x4]
LEA RSI,[R12 + RDX*0x8 + 0x68]
MOV EDX,0x0
JMP 0x001011f7
LAB_001011ee:
ADD RAX,0x68
CMP RAX,RSI
JZ 0x00101251
LAB_001011f7:
CMP dword ptr [RAX + 0x64],EBX
JL 0x001011ee
MOVSXD RCX,EDX
LEA RDI,[RCX + RCX*0x2]
LEA RCX,[RCX + RDI*0x4]
LEA RCX,[R8 + RCX*0x8]
MOVDQU XMM0,xmmword ptr [RAX]
MOVUPS xmmword ptr [RCX],XMM0
MOVDQU XMM1,xmmword ptr [RAX + 0x10]
MOVUPS xmmword ptr [RCX + 0x10],XMM1
MOVDQU XMM2,xmmword ptr [RAX + 0x20]
MOVUPS xmmword ptr [RCX + 0x20],XMM2
MOVDQU XMM3,xmmword ptr [RAX + 0x30]
MOVUPS xmmword ptr [RCX + 0x30],XMM3
MOVDQU XMM4,xmmword ptr [RAX + 0x40]
MOVUPS xmmword ptr [RCX + 0x40],XMM4
MOVDQU XMM5,xmmword ptr [RAX + 0x50]
MOVUPS xmmword ptr [RCX + 0x50],XMM5
MOV RDI,qword ptr [RAX + 0x60]
MOV qword ptr [RCX + 0x60],RDI
ADD EDX,0x1
JMP 0x001011ee
LAB_0010124c:
MOV EDX,0x0
LAB_00101251:
MOV EDX,EDX
MOV RAX,R8
POP RBX
POP RBP
POP R12
RET | int1 [16] func0(int8 *param_1,int param_2,int param_3)
{
int8 *puVar1;
int8 *puVar2;
int8 uVar3;
int iVar4;
int1 auVar5 [16];
auVar5._0_8_ = malloc((long)param_2 * 0x68);
if (param_2 < 1) {
iVar4 = 0;
}
else {
puVar2 = param_1 + (ulong)(param_2 - 1) * 0xd + 0xd;
iVar4 = 0;
do {
if (param_3 <= *(int *)((long)param_1 + 100)) {
puVar1 = (int8 *)((long)auVar5._0_8_ + (long)iVar4 * 0x68);
uVar3 = param_1[1];
*puVar1 = *param_1;
puVar1[1] = uVar3;
uVar3 = param_1[3];
puVar1[2] = param_1[2];
puVar1[3] = uVar3;
uVar3 = param_1[5];
puVar1[4] = param_1[4];
puVar1[5] = uVar3;
uVar3 = param_1[7];
puVar1[6] = param_1[6];
puVar1[7] = uVar3;
uVar3 = param_1[9];
puVar1[8] = param_1[8];
puVar1[9] = uVar3;
uVar3 = param_1[0xb];
puVar1[10] = param_1[10];
puVar1[0xb] = uVar3;
puVar1[0xc] = param_1[0xc];
iVar4 = iVar4 + 1;
}
param_1 = param_1 + 0xd;
} while (param_1 != puVar2);
}
auVar5._8_4_ = iVar4;
auVar5._12_4_ = 0;
return auVar5;
} |
5,002 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
typedef struct {
char key[100];
int value;
} DictItem;
typedef struct {
DictItem* items;
int size;
} Dict;
| Dict func0(Dict input, int n) {
Dict result;
result.items = (DictItem*)malloc(input.size * sizeof(DictItem));
result.size = 0;
for (int i = 0; i < input.size; i++) {
if (input.items[i].value >= n) {
result.items[result.size] = input.items[i];
result.size++;
}
}
return result;
}
| int main() {
Dict d1, d2, d3;
d1.size = 4;
d1.items = (DictItem*)malloc(d1.size * sizeof(DictItem));
strcpy(d1.items[0].key, "Cierra Vega"); d1.items[0].value = 175;
strcpy(d1.items[1].key, "Alden Cantrell"); d1.items[1].value = 180;
strcpy(d1.items[2].key, "Kierra Gentry"); d1.items[2].value = 165;
strcpy(d1.items[3].key, "Pierre Cox"); d1.items[3].value = 190;
Dict result;
result = func0(d1, 170);
assert(result.size == 3 && strcmp(result.items[0].key, "Cierra Vega") == 0 && strcmp(result.items[1].key, "Alden Cantrell") == 0 && strcmp(result.items[2].key, "Pierre Cox") == 0);
result = func0(d1, 180);
assert(result.size == 2 && strcmp(result.items[0].key, "Alden Cantrell") == 0 && strcmp(result.items[1].key, "Pierre Cox") == 0);
result = func0(d1, 190);
assert(result.size == 1 && strcmp(result.items[0].key, "Pierre Cox") == 0);
free(d1.items);
free(result.items);
return 0;
}
| O2 | c | func0:
endbr64
movslq %esi,%rax
push %r12
mov %rsi,%r12
push %rbp
mov %edx,%ebp
lea (%rax,%rax,2),%rdx
push %rbx
mov %rdi,%rbx
lea (%rax,%rdx,4),%rdi
shl $0x3,%rdi
callq 1090 <malloc@plt>
test %r12d,%r12d
jle 1478 <func0+0xa8>
lea -0x1(%r12),%edx
mov %rbx,%rdi
xor %esi,%esi
lea (%rdx,%rdx,2),%rcx
lea (%rdx,%rcx,4),%rdx
lea 0x68(%rbx,%rdx,8),%rdx
cmp %ebp,0x64(%rdi)
jl 1463 <func0+0x93>
movslq %esi,%rcx
movdqu (%rdi),%xmm0
movdqu 0x10(%rdi),%xmm1
add $0x1,%esi
lea (%rcx,%rcx,2),%r8
movdqu 0x20(%rdi),%xmm2
movdqu 0x30(%rdi),%xmm3
lea (%rcx,%r8,4),%rcx
mov 0x60(%rdi),%r8
movdqu 0x40(%rdi),%xmm4
lea (%rax,%rcx,8),%rcx
movdqu 0x50(%rdi),%xmm5
mov %r8,0x60(%rcx)
movups %xmm0,(%rcx)
movups %xmm1,0x10(%rcx)
movups %xmm2,0x20(%rcx)
movups %xmm3,0x30(%rcx)
movups %xmm4,0x40(%rcx)
movups %xmm5,0x50(%rcx)
add $0x68,%rdi
cmp %rdx,%rdi
jne 1410 <func0+0x40>
pop %rbx
mov %esi,%edx
pop %rbp
pop %r12
retq
nopl 0x0(%rax,%rax,1)
xor %esi,%esi
pop %rbx
pop %rbp
mov %esi,%edx
pop %r12
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
movsxd rax, esi
push r12
mov r12, rsi
push rbp
mov ebp, edx
lea rdx, [rax+rax*2]
push rbx
mov rbx, rdi
lea rdi, [rax+rdx*4]
shl rdi, 3
call _malloc
mov r8, rax
test r12d, r12d
jle loc_14A0
lea edx, [r12-1]
mov rax, rbx
lea rcx, [rdx+rdx*2]
lea rdx, [rdx+rcx*4]
lea rsi, [rbx+rdx*8+68h]
xor edx, edx
nop word ptr [rax+rax+00000000h]
loc_1430:
cmp [rax+64h], ebp
jl short loc_1483
movsxd rcx, edx
movdqu xmm0, xmmword ptr [rax]
movdqu xmm1, xmmword ptr [rax+10h]
add edx, 1
lea rdi, [rcx+rcx*2]
movdqu xmm2, xmmword ptr [rax+20h]
movdqu xmm3, xmmword ptr [rax+30h]
lea rcx, [rcx+rdi*4]
mov rdi, [rax+60h]
movdqu xmm4, xmmword ptr [rax+40h]
lea rcx, [r8+rcx*8]
movdqu xmm5, xmmword ptr [rax+50h]
mov [rcx+60h], rdi
movups xmmword ptr [rcx], xmm0
movups xmmword ptr [rcx+10h], xmm1
movups xmmword ptr [rcx+20h], xmm2
movups xmmword ptr [rcx+30h], xmm3
movups xmmword ptr [rcx+40h], xmm4
movups xmmword ptr [rcx+50h], xmm5
loc_1483:
add rax, 68h ; 'h'
cmp rax, rsi
jnz short loc_1430
pop rbx
mov edx, edx
mov rax, r8
pop rbp
pop r12
retn
loc_14A0:
xor edx, edx
pop rbx
mov rax, r8
pop rbp
mov edx, edx
pop r12
retn | long long func0(const __m128i *a1, int a2, __int32 a3)
{
long long result; // rax
long long v5; // r8
const __m128i *v6; // rax
long long v7; // rsi
int v8; // edx
long long v9; // rcx
__m128i v10; // xmm0
__m128i v11; // xmm1
__m128i v12; // xmm2
__m128i v13; // xmm3
__m128i v14; // xmm4
__m128i *v15; // rcx
__m128i v16; // xmm5
result = malloc(104LL * a2);
v5 = result;
if ( a2 > 0 )
{
v6 = a1;
v7 = (long long)&a1[6].m128i_i64[13 * (unsigned int)(a2 - 1) + 1];
v8 = 0;
do
{
if ( v6[6].m128i_i32[1] >= a3 )
{
v9 = v8;
v10 = _mm_loadu_si128(v6);
v11 = _mm_loadu_si128(v6 + 1);
++v8;
v12 = _mm_loadu_si128(v6 + 2);
v13 = _mm_loadu_si128(v6 + 3);
v14 = _mm_loadu_si128(v6 + 4);
v15 = (__m128i *)(v5 + 104 * v9);
v16 = _mm_loadu_si128(v6 + 5);
v15[6].m128i_i64[0] = v6[6].m128i_i64[0];
*v15 = v10;
v15[1] = v11;
v15[2] = v12;
v15[3] = v13;
v15[4] = v14;
v15[5] = v16;
}
v6 = (const __m128i *)((char *)v6 + 104);
}
while ( v6 != (const __m128i *)v7 );
return v5;
}
return result;
} | func0:
ENDBR64
MOVSXD RAX,ESI
PUSH R12
MOV R12,RSI
PUSH RBP
MOV EBP,EDX
LEA RDX,[RAX + RAX*0x2]
PUSH RBX
MOV RBX,RDI
LEA RDI,[RAX + RDX*0x4]
SHL RDI,0x3
CALL 0x001010b0
MOV R8,RAX
TEST R12D,R12D
JLE 0x001014a0
LEA EDX,[R12 + -0x1]
MOV RAX,RBX
LEA RCX,[RDX + RDX*0x2]
LEA RDX,[RDX + RCX*0x4]
LEA RSI,[RBX + RDX*0x8 + 0x68]
XOR EDX,EDX
NOP word ptr [RAX + RAX*0x1]
LAB_00101430:
CMP dword ptr [RAX + 0x64],EBP
JL 0x00101483
MOVSXD RCX,EDX
MOVDQU XMM0,xmmword ptr [RAX]
MOVDQU XMM1,xmmword ptr [RAX + 0x10]
ADD EDX,0x1
LEA RDI,[RCX + RCX*0x2]
MOVDQU XMM2,xmmword ptr [RAX + 0x20]
MOVDQU XMM3,xmmword ptr [RAX + 0x30]
LEA RCX,[RCX + RDI*0x4]
MOV RDI,qword ptr [RAX + 0x60]
MOVDQU XMM4,xmmword ptr [RAX + 0x40]
LEA RCX,[R8 + RCX*0x8]
MOVDQU XMM5,xmmword ptr [RAX + 0x50]
MOV qword ptr [RCX + 0x60],RDI
MOVUPS xmmword ptr [RCX],XMM0
MOVUPS xmmword ptr [RCX + 0x10],XMM1
MOVUPS xmmword ptr [RCX + 0x20],XMM2
MOVUPS xmmword ptr [RCX + 0x30],XMM3
MOVUPS xmmword ptr [RCX + 0x40],XMM4
MOVUPS xmmword ptr [RCX + 0x50],XMM5
LAB_00101483:
ADD RAX,0x68
CMP RAX,RSI
JNZ 0x00101430
POP RBX
MOV EDX,EDX
MOV RAX,R8
POP RBP
POP R12
RET
LAB_001014a0:
XOR EDX,EDX
POP RBX
MOV RAX,R8
POP RBP
MOV EDX,EDX
POP R12
RET | int1 [16] func0(int8 *param_1,int param_2,int param_3)
{
int8 *puVar1;
int8 *puVar2;
int8 uVar3;
int8 uVar4;
int8 uVar5;
int8 uVar6;
int8 uVar7;
int8 uVar8;
int8 uVar9;
int8 uVar10;
int8 uVar11;
int8 uVar12;
int8 uVar13;
int8 uVar14;
long lVar15;
int iVar16;
int1 auVar17 [16];
int1 auVar18 [16];
auVar17._0_8_ = malloc((long)param_2 * 0x68);
if (0 < param_2) {
puVar2 = param_1 + (ulong)(param_2 - 1) * 0xd + 0xd;
iVar16 = 0;
do {
if (param_3 <= *(int *)((long)param_1 + 100)) {
lVar15 = (long)iVar16;
uVar3 = *param_1;
uVar4 = param_1[1];
uVar5 = param_1[2];
uVar6 = param_1[3];
iVar16 = iVar16 + 1;
uVar7 = param_1[4];
uVar8 = param_1[5];
uVar9 = param_1[6];
uVar10 = param_1[7];
uVar11 = param_1[8];
uVar12 = param_1[9];
puVar1 = (int8 *)((long)auVar17._0_8_ + lVar15 * 0x68);
uVar13 = param_1[10];
uVar14 = param_1[0xb];
puVar1[0xc] = param_1[0xc];
*puVar1 = uVar3;
puVar1[1] = uVar4;
puVar1[2] = uVar5;
puVar1[3] = uVar6;
puVar1[4] = uVar7;
puVar1[5] = uVar8;
puVar1[6] = uVar9;
puVar1[7] = uVar10;
puVar1[8] = uVar11;
puVar1[9] = uVar12;
puVar1[10] = uVar13;
puVar1[0xb] = uVar14;
}
param_1 = param_1 + 0xd;
} while (param_1 != puVar2);
auVar17._8_4_ = iVar16;
auVar17._12_4_ = 0;
return auVar17;
}
auVar18._8_8_ = 0;
auVar18._0_8_ = auVar17._0_8_;
return auVar18;
} |
5,003 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
typedef struct {
char key[100];
int value;
} DictItem;
typedef struct {
DictItem* items;
int size;
} Dict;
| Dict func0(Dict input, int n) {
Dict result;
result.items = (DictItem*)malloc(input.size * sizeof(DictItem));
result.size = 0;
for (int i = 0; i < input.size; i++) {
if (input.items[i].value >= n) {
result.items[result.size] = input.items[i];
result.size++;
}
}
return result;
}
| int main() {
Dict d1, d2, d3;
d1.size = 4;
d1.items = (DictItem*)malloc(d1.size * sizeof(DictItem));
strcpy(d1.items[0].key, "Cierra Vega"); d1.items[0].value = 175;
strcpy(d1.items[1].key, "Alden Cantrell"); d1.items[1].value = 180;
strcpy(d1.items[2].key, "Kierra Gentry"); d1.items[2].value = 165;
strcpy(d1.items[3].key, "Pierre Cox"); d1.items[3].value = 190;
Dict result;
result = func0(d1, 170);
assert(result.size == 3 && strcmp(result.items[0].key, "Cierra Vega") == 0 && strcmp(result.items[1].key, "Alden Cantrell") == 0 && strcmp(result.items[2].key, "Pierre Cox") == 0);
result = func0(d1, 180);
assert(result.size == 2 && strcmp(result.items[0].key, "Alden Cantrell") == 0 && strcmp(result.items[1].key, "Pierre Cox") == 0);
result = func0(d1, 190);
assert(result.size == 1 && strcmp(result.items[0].key, "Pierre Cox") == 0);
free(d1.items);
free(result.items);
return 0;
}
| O3 | c | func0:
endbr64
movslq %esi,%rax
push %r12
mov %rsi,%r12
push %rbp
mov %edx,%ebp
lea (%rax,%rax,2),%rdx
push %rbx
mov %rdi,%rbx
lea (%rax,%rdx,4),%rdi
shl $0x3,%rdi
callq 1090 <malloc@plt>
test %r12d,%r12d
jle 1478 <func0+0xa8>
lea -0x1(%r12),%edx
mov %rbx,%rdi
xor %esi,%esi
lea (%rdx,%rdx,2),%rcx
lea (%rdx,%rcx,4),%rdx
lea 0x68(%rbx,%rdx,8),%rdx
cmp %ebp,0x64(%rdi)
jl 1463 <func0+0x93>
movslq %esi,%rcx
movdqu (%rdi),%xmm0
movdqu 0x10(%rdi),%xmm1
add $0x1,%esi
lea (%rcx,%rcx,2),%r8
movdqu 0x20(%rdi),%xmm2
movdqu 0x30(%rdi),%xmm3
lea (%rcx,%r8,4),%rcx
mov 0x60(%rdi),%r8
movdqu 0x40(%rdi),%xmm4
lea (%rax,%rcx,8),%rcx
movdqu 0x50(%rdi),%xmm5
mov %r8,0x60(%rcx)
movups %xmm0,(%rcx)
movups %xmm1,0x10(%rcx)
movups %xmm2,0x20(%rcx)
movups %xmm3,0x30(%rcx)
movups %xmm4,0x40(%rcx)
movups %xmm5,0x50(%rcx)
add $0x68,%rdi
cmp %rdx,%rdi
jne 1410 <func0+0x40>
pop %rbx
mov %esi,%edx
pop %rbp
pop %r12
retq
nopl 0x0(%rax,%rax,1)
xor %esi,%esi
pop %rbx
pop %rbp
mov %esi,%edx
pop %r12
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
movsxd rax, esi
push r13
mov r13, rsi
push r12
mov r12d, edx
lea rdx, [rax+rax*2]
push rbp
push rbx
mov rbx, rdi
lea rdi, [rax+rdx*4]
lea rbp, ds:0[rdi*8]
mov rdi, rbp; size
sub rsp, 8
call _malloc
test r13d, r13d
jle loc_1468
mov rcx, rbx
lea rdi, [rbp+rbx+0]
xor edx, edx
nop dword ptr [rax]
loc_13F8:
cmp [rcx+64h], r12d
jl short loc_144C
movsxd rsi, edx
movdqu xmm0, xmmword ptr [rcx]
movdqu xmm1, xmmword ptr [rcx+10h]
add edx, 1
lea r8, [rsi+rsi*2]
movdqu xmm2, xmmword ptr [rcx+20h]
movdqu xmm3, xmmword ptr [rcx+30h]
lea rsi, [rsi+r8*4]
mov r8, [rcx+60h]
movdqu xmm4, xmmword ptr [rcx+40h]
lea rsi, [rax+rsi*8]
movdqu xmm5, xmmword ptr [rcx+50h]
mov [rsi+60h], r8
movups xmmword ptr [rsi], xmm0
movups xmmword ptr [rsi+10h], xmm1
movups xmmword ptr [rsi+20h], xmm2
movups xmmword ptr [rsi+30h], xmm3
movups xmmword ptr [rsi+40h], xmm4
movups xmmword ptr [rsi+50h], xmm5
loc_144C:
add rcx, 68h ; 'h'
cmp rcx, rdi
jnz short loc_13F8
add rsp, 8
mov edx, edx
pop rbx
pop rbp
pop r12
pop r13
retn
loc_1468:
add rsp, 8
xor edx, edx
pop rbx
mov edx, edx
pop rbp
pop r12
pop r13
retn | char * func0(const __m128i *a1, int a2, __int32 a3)
{
size_t v4; // rbp
char *result; // rax
const __m128i *v6; // rcx
int v7; // edx
long long v8; // rsi
__m128i v9; // xmm0
__m128i v10; // xmm1
__m128i v11; // xmm2
__m128i v12; // xmm3
__m128i v13; // xmm4
__m128i *v14; // rsi
__m128i v15; // xmm5
v4 = 104LL * a2;
result = (char *)malloc(v4);
if ( a2 > 0 )
{
v6 = a1;
v7 = 0;
do
{
if ( v6[6].m128i_i32[1] >= a3 )
{
v8 = v7;
v9 = _mm_loadu_si128(v6);
v10 = _mm_loadu_si128(v6 + 1);
++v7;
v11 = _mm_loadu_si128(v6 + 2);
v12 = _mm_loadu_si128(v6 + 3);
v13 = _mm_loadu_si128(v6 + 4);
v14 = (__m128i *)&result[104 * v8];
v15 = _mm_loadu_si128(v6 + 5);
v14[6].m128i_i64[0] = v6[6].m128i_i64[0];
*v14 = v9;
v14[1] = v10;
v14[2] = v11;
v14[3] = v12;
v14[4] = v13;
v14[5] = v15;
}
v6 = (const __m128i *)((char *)v6 + 104);
}
while ( v6 != (const __m128i *)&a1->m128i_i8[v4] );
}
return result;
} | func0:
ENDBR64
MOVSXD RAX,ESI
PUSH R13
MOV R13,RSI
PUSH R12
MOV R12D,EDX
LEA RDX,[RAX + RAX*0x2]
PUSH RBP
PUSH RBX
MOV RBX,RDI
LEA RDI,[RAX + RDX*0x4]
LEA RBP,[RDI*0x8]
MOV RDI,RBP
SUB RSP,0x8
CALL 0x001010b0
TEST R13D,R13D
JLE 0x00101468
MOV RCX,RBX
LEA RDI,[RBP + RBX*0x1]
XOR EDX,EDX
NOP dword ptr [RAX]
LAB_001013f8:
CMP dword ptr [RCX + 0x64],R12D
JL 0x0010144c
MOVSXD RSI,EDX
MOVDQU XMM0,xmmword ptr [RCX]
MOVDQU XMM1,xmmword ptr [RCX + 0x10]
ADD EDX,0x1
LEA R8,[RSI + RSI*0x2]
MOVDQU XMM2,xmmword ptr [RCX + 0x20]
MOVDQU XMM3,xmmword ptr [RCX + 0x30]
LEA RSI,[RSI + R8*0x4]
MOV R8,qword ptr [RCX + 0x60]
MOVDQU XMM4,xmmword ptr [RCX + 0x40]
LEA RSI,[RAX + RSI*0x8]
MOVDQU XMM5,xmmword ptr [RCX + 0x50]
MOV qword ptr [RSI + 0x60],R8
MOVUPS xmmword ptr [RSI],XMM0
MOVUPS xmmword ptr [RSI + 0x10],XMM1
MOVUPS xmmword ptr [RSI + 0x20],XMM2
MOVUPS xmmword ptr [RSI + 0x30],XMM3
MOVUPS xmmword ptr [RSI + 0x40],XMM4
MOVUPS xmmword ptr [RSI + 0x50],XMM5
LAB_0010144c:
ADD RCX,0x68
CMP RCX,RDI
JNZ 0x001013f8
ADD RSP,0x8
MOV EDX,EDX
POP RBX
POP RBP
POP R12
POP R13
RET
LAB_00101468:
ADD RSP,0x8
XOR EDX,EDX
POP RBX
MOV EDX,EDX
POP RBP
POP R12
POP R13
RET | void func0(int8 *param_1,int param_2,int param_3)
{
int8 *puVar1;
int8 *puVar2;
int8 uVar3;
int8 uVar4;
int8 uVar5;
int8 uVar6;
int8 uVar7;
int8 uVar8;
int8 uVar9;
int8 uVar10;
int8 uVar11;
int8 uVar12;
int8 uVar13;
int8 uVar14;
void *pvVar15;
int iVar16;
long lVar17;
pvVar15 = malloc((long)param_2 * 0x68);
if (0 < param_2) {
puVar2 = param_1 + (long)param_2 * 0xd;
iVar16 = 0;
do {
if (param_3 <= *(int *)((long)param_1 + 100)) {
lVar17 = (long)iVar16;
uVar3 = *param_1;
uVar4 = param_1[1];
uVar5 = param_1[2];
uVar6 = param_1[3];
iVar16 = iVar16 + 1;
uVar7 = param_1[4];
uVar8 = param_1[5];
uVar9 = param_1[6];
uVar10 = param_1[7];
uVar11 = param_1[8];
uVar12 = param_1[9];
puVar1 = (int8 *)((long)pvVar15 + lVar17 * 0x68);
uVar13 = param_1[10];
uVar14 = param_1[0xb];
puVar1[0xc] = param_1[0xc];
*puVar1 = uVar3;
puVar1[1] = uVar4;
puVar1[2] = uVar5;
puVar1[3] = uVar6;
puVar1[4] = uVar7;
puVar1[5] = uVar8;
puVar1[6] = uVar9;
puVar1[7] = uVar10;
puVar1[8] = uVar11;
puVar1[9] = uVar12;
puVar1[10] = uVar13;
puVar1[0xb] = uVar14;
}
param_1 = param_1 + 0xd;
} while (param_1 != puVar2);
return;
}
return;
} |
5,004 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(const void* test_arr, int size) {
int count = 0;
for (int i = 0; i < size; i++) {
if (((const void **)test_arr)[i] != NULL) {
count++;
} else {
break;
}
}
return count;
}
| int main() {
const void* arr1[] = { (void*)1, (void*)5, (void*)7, NULL, (void*)10 };
const void* arr2[] = { (void*)2, (void*)9, NULL, (void*)11 };
const void* arr3[] = { (void*)11, (void*)15, (void*)5, (void*)8, NULL, (void*)8 };
assert(func0(arr1, 5) == 3);
assert(func0(arr2, 4) == 2);
assert(func0(arr3, 6) == 4);
printf("All tests passed.\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
movl $0x0,-0x8(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11cc <func0+0x43>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%rax
test %rax,%rax
je 11d6 <func0+0x4d>
addl $0x1,-0x8(%rbp)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 11a8 <func0+0x1f>
jmp 11d7 <func0+0x4e>
mov -0x8(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_8], 0
mov [rbp+var_4], 0
jmp short loc_11CC
loc_11A8:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_18]
add rax, rdx
mov rax, [rax]
test rax, rax
jz short loc_11D6
add [rbp+var_8], 1
add [rbp+var_4], 1
loc_11CC:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_11A8
jmp short loc_11D7
loc_11D6:
nop
loc_11D7:
mov eax, [rbp+var_8]
pop rbp
retn | long long func0(long long a1, int a2)
{
unsigned int v3; // [rsp+14h] [rbp-8h]
int i; // [rsp+18h] [rbp-4h]
v3 = 0;
for ( i = 0; i < a2 && *(_QWORD *)(8LL * i + a1); ++i )
++v3;
return v3;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x8],0x0
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011cc
LAB_001011a8:
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]
TEST RAX,RAX
JZ 0x001011d6
ADD dword ptr [RBP + -0x8],0x1
ADD dword ptr [RBP + -0x4],0x1
LAB_001011cc:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x001011a8
JMP 0x001011d7
LAB_001011d6:
NOP
LAB_001011d7:
MOV EAX,dword ptr [RBP + -0x8]
POP RBP
RET | int func0(long param_1,int param_2)
{
int local_10;
int local_c;
local_10 = 0;
local_c = 0;
while ((local_c < param_2 && (*(long *)(param_1 + (long)local_c * 8) != 0))) {
local_10 = local_10 + 1;
local_c = local_c + 1;
}
return local_10;
} |
5,005 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(const void* test_arr, int size) {
int count = 0;
for (int i = 0; i < size; i++) {
if (((const void **)test_arr)[i] != NULL) {
count++;
} else {
break;
}
}
return count;
}
| int main() {
const void* arr1[] = { (void*)1, (void*)5, (void*)7, NULL, (void*)10 };
const void* arr2[] = { (void*)2, (void*)9, NULL, (void*)11 };
const void* arr3[] = { (void*)11, (void*)15, (void*)5, (void*)8, NULL, (void*)8 };
assert(func0(arr1, 5) == 3);
assert(func0(arr2, 4) == 2);
assert(func0(arr3, 6) == 4);
printf("All tests passed.\n");
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 11b6 <func0+0x2d>
lea -0x1(%rsi),%esi
mov $0x0,%eax
jmp 119e <func0+0x15>
mov %rcx,%rax
mov %eax,%edx
cmpq $0x0,(%rdi,%rax,8)
je 11b3 <func0+0x2a>
lea 0x1(%rax),%edx
lea 0x1(%rax),%rcx
cmp %rsi,%rax
jne 119b <func0+0x12>
mov %edx,%eax
retq
mov $0x0,%edx
jmp 11b3 <func0+0x2a>
| func0:
endbr64
test esi, esi
jle short loc_11AA
mov eax, 0
loc_1196:
cmp qword ptr [rdi], 0
jz short locret_11AF
add eax, 1
add rdi, 8
cmp esi, eax
jnz short loc_1196
mov eax, esi
retn
loc_11AA:
mov eax, 0
locret_11AF:
retn | long long func0(_QWORD *a1, int a2)
{
long long result; // rax
if ( a2 <= 0 )
return 0LL;
result = 0LL;
while ( *a1 )
{
result = (unsigned int)(result + 1);
++a1;
if ( a2 == (_DWORD)result )
return (unsigned int)a2;
}
return result;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001011aa
MOV EAX,0x0
LAB_00101196:
CMP qword ptr [RDI],0x0
JZ 0x001011af
ADD EAX,0x1
ADD RDI,0x8
CMP ESI,EAX
JNZ 0x00101196
MOV EAX,ESI
RET
LAB_001011aa:
MOV EAX,0x0
LAB_001011af:
RET | int func0(long *param_1,int param_2)
{
int iVar1;
if (param_2 < 1) {
iVar1 = 0;
}
else {
iVar1 = 0;
while (*param_1 != 0) {
iVar1 = iVar1 + 1;
param_1 = param_1 + 1;
if (param_2 == iVar1) {
return param_2;
}
}
}
return iVar1;
} |
5,006 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(const void* test_arr, int size) {
int count = 0;
for (int i = 0; i < size; i++) {
if (((const void **)test_arr)[i] != NULL) {
count++;
} else {
break;
}
}
return count;
}
| int main() {
const void* arr1[] = { (void*)1, (void*)5, (void*)7, NULL, (void*)10 };
const void* arr2[] = { (void*)2, (void*)9, NULL, (void*)11 };
const void* arr3[] = { (void*)11, (void*)15, (void*)5, (void*)8, NULL, (void*)8 };
assert(func0(arr1, 5) == 3);
assert(func0(arr2, 4) == 2);
assert(func0(arr3, 6) == 4);
printf("All tests passed.\n");
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 119e <func0+0x2e>
lea -0x1(%rsi),%ecx
xor %eax,%eax
jmp 1190 <func0+0x20>
lea 0x1(%rax),%r8d
lea 0x1(%rax),%rdx
cmp %rcx,%rax
je 119a <func0+0x2a>
mov %rdx,%rax
cmpq $0x0,(%rdi,%rax,8)
mov %eax,%r8d
jne 1180 <func0+0x10>
mov %r8d,%eax
retq
xor %r8d,%r8d
jmp 119a <func0+0x2a>
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
xor eax, eax
test esi, esi
jg short loc_12EB
jmp short locret_12F1
loc_12E0:
add eax, 1
add rdi, 8
cmp esi, eax
jz short locret_12F8
loc_12EB:
cmp qword ptr [rdi], 0
jnz short loc_12E0
locret_12F1:
retn
locret_12F8:
retn | long long func0(_QWORD *a1, int a2)
{
long long result; // rax
result = 0LL;
if ( a2 > 0 )
{
do
{
if ( !*a1 )
break;
result = (unsigned int)(result + 1);
++a1;
}
while ( a2 != (_DWORD)result );
}
return result;
} | func0:
ENDBR64
XOR EAX,EAX
TEST ESI,ESI
JG 0x001012eb
JMP 0x001012f1
LAB_001012e0:
ADD EAX,0x1
ADD RDI,0x8
CMP ESI,EAX
JZ 0x001012f8
LAB_001012eb:
CMP qword ptr [RDI],0x0
JNZ 0x001012e0
LAB_001012f1:
RET
LAB_001012f8:
RET | void func0(long *param_1,int param_2)
{
int iVar1;
iVar1 = 0;
if (0 < param_2) {
while (*param_1 != 0) {
iVar1 = iVar1 + 1;
param_1 = param_1 + 1;
if (param_2 == iVar1) {
return;
}
}
}
return;
} |
5,007 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(const void* test_arr, int size) {
int count = 0;
for (int i = 0; i < size; i++) {
if (((const void **)test_arr)[i] != NULL) {
count++;
} else {
break;
}
}
return count;
}
| int main() {
const void* arr1[] = { (void*)1, (void*)5, (void*)7, NULL, (void*)10 };
const void* arr2[] = { (void*)2, (void*)9, NULL, (void*)11 };
const void* arr3[] = { (void*)11, (void*)15, (void*)5, (void*)8, NULL, (void*)8 };
assert(func0(arr1, 5) == 3);
assert(func0(arr2, 4) == 2);
assert(func0(arr3, 6) == 4);
printf("All tests passed.\n");
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 12ce <func0+0x2e>
lea -0x1(%rsi),%ecx
xor %eax,%eax
jmp 12c0 <func0+0x20>
lea 0x1(%rax),%r8d
lea 0x1(%rax),%rdx
cmp %rcx,%rax
je 12ca <func0+0x2a>
mov %rdx,%rax
cmpq $0x0,(%rdi,%rax,8)
mov %eax,%r8d
jne 12b0 <func0+0x10>
mov %r8d,%eax
retq
xor %r8d,%r8d
jmp 12ca <func0+0x2a>
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
xor eax, eax
test esi, esi
jg short loc_118B
retn
loc_1180:
add eax, 1
add rdi, 8
cmp esi, eax
jz short locret_1198
loc_118B:
cmp qword ptr [rdi], 0
jnz short loc_1180
retn
locret_1198:
retn | long long func0(_QWORD *a1, int a2)
{
long long result; // rax
result = 0LL;
if ( a2 > 0 )
{
do
{
if ( !*a1 )
break;
result = (unsigned int)(result + 1);
++a1;
}
while ( a2 != (_DWORD)result );
}
return result;
} | func0:
ENDBR64
XOR EAX,EAX
TEST ESI,ESI
JG 0x0010118b
RET
LAB_00101180:
ADD EAX,0x1
ADD RDI,0x8
CMP ESI,EAX
JZ 0x00101198
LAB_0010118b:
CMP qword ptr [RDI],0x0
JNZ 0x00101180
RET
LAB_00101198:
RET | void func0(long *param_1,int param_2)
{
int iVar1;
iVar1 = 0;
if (param_2 < 1) {
return;
}
do {
if (*param_1 == 0) {
return;
}
iVar1 = iVar1 + 1;
param_1 = param_1 + 1;
} while (param_2 != iVar1);
return;
} |
5,008 | func0 |
#include <assert.h>
| int func0(int n) {
return 4 * n * n - 3 * n;
}
| int main() {
assert(func0(3) == 27);
assert(func0(7) == 175);
assert(func0(10) == 370);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %edi,-0x4(%rbp)
mov -0x4(%rbp),%eax
imul %eax,%eax
lea 0x0(,%rax,4),%edx
mov -0x4(%rbp),%eax
mov %eax,%ecx
shl $0x2,%eax
sub %eax,%ecx
mov %ecx,%eax
add %edx,%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_4], edi
mov eax, [rbp+var_4]
imul eax, eax
lea ecx, ds:0[rax*4]
mov eax, [rbp+var_4]
mov edx, eax
shl eax, 2
sub edx, eax
lea eax, [rcx+rdx]
pop rbp
retn | long long func0(int a1)
{
return (unsigned int)(4 * a1 * a1 - 3 * a1);
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV dword ptr [RBP + -0x4],EDI
MOV EAX,dword ptr [RBP + -0x4]
IMUL EAX,EAX
LEA ECX,[RAX*0x4]
MOV EAX,dword ptr [RBP + -0x4]
MOV EDX,EAX
SHL EAX,0x2
SUB EDX,EAX
LEA EAX,[RCX + RDX*0x1]
POP RBP
RET | int func0(int param_1)
{
return param_1 * param_1 * 4 + param_1 * -3;
} |
5,009 | func0 |
#include <assert.h>
| int func0(int n) {
return 4 * n * n - 3 * n;
}
| int main() {
assert(func0(3) == 27);
assert(func0(7) == 175);
assert(func0(10) == 370);
return 0;
}
| O1 | c | func0:
endbr64
mov %edi,%eax
imul %edi,%eax
lea 0x0(,%rdi,4),%edx
sub %edx,%edi
lea (%rdi,%rax,4),%eax
retq
| func0:
endbr64
mov eax, edi
imul eax, edi
lea edx, ds:0[rdi*4]
sub edi, edx
lea eax, [rdi+rax*4]
retn | long long func0(int a1)
{
return (unsigned int)(-3 * a1 + 4 * a1 * a1);
} | func0:
ENDBR64
MOV EAX,EDI
IMUL EAX,EDI
LEA EDX,[RDI*0x4]
SUB EDI,EDX
LEA EAX,[RDI + RAX*0x4]
RET | int func0(int param_1)
{
return param_1 * -3 + param_1 * param_1 * 4;
} |
5,010 | func0 |
#include <assert.h>
| int func0(int n) {
return 4 * n * n - 3 * n;
}
| int main() {
assert(func0(3) == 27);
assert(func0(7) == 175);
assert(func0(10) == 370);
return 0;
}
| O2 | c | func0:
endbr64
mov %edi,%eax
lea 0x0(,%rdi,4),%edx
imul %edi,%eax
sub %edx,%edi
lea (%rdi,%rax,4),%eax
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
mov eax, edi
lea edx, ds:0[rdi*4]
imul eax, edi
sub edi, edx
lea eax, [rdi+rax*4]
retn | long long func0(int a1)
{
return (unsigned int)(-3 * a1 + 4 * a1 * a1);
} | func0:
ENDBR64
MOV EAX,EDI
LEA EDX,[RDI*0x4]
IMUL EAX,EDI
SUB EDI,EDX
LEA EAX,[RDI + RAX*0x4]
RET | int func0(int param_1)
{
return param_1 * -3 + param_1 * param_1 * 4;
} |
5,011 | func0 |
#include <assert.h>
| int func0(int n) {
return 4 * n * n - 3 * n;
}
| int main() {
assert(func0(3) == 27);
assert(func0(7) == 175);
assert(func0(10) == 370);
return 0;
}
| O3 | c | func0:
endbr64
mov %edi,%eax
lea 0x0(,%rdi,4),%edx
imul %edi,%eax
sub %edx,%edi
lea (%rdi,%rax,4),%eax
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
mov eax, edi
lea edx, ds:0[rdi*4]
imul eax, edi
sub edi, edx
lea eax, [rdi+rax*4]
retn | long long func0(int a1)
{
return (unsigned int)(-3 * a1 + 4 * a1 * a1);
} | func0:
ENDBR64
MOV EAX,EDI
LEA EDX,[RDI*0x4]
IMUL EAX,EDI
SUB EDI,EDX
LEA EAX,[RDI + RAX*0x4]
RET | int func0(int param_1)
{
return param_1 * -3 + param_1 * param_1 * 4;
} |
5,012 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int dlist[], int size, int item, int *pos) {
*pos = 0;
bool found = false;
while (*pos < size && !found) {
if (dlist[*pos] == item) {
found = true;
} else {
(*pos)++;
}
}
return found;
}
| int main() {
int pos;
bool found;
int list1[] = {11, 23, 58, 31, 56, 77, 43, 12, 65, 19};
found = func0(list1, 10, 31, &pos);
assert(found == true && pos == 3);
int list2[] = {12, 32, 45, 62, 35, 47, 44, 61};
found = func0(list2, 8, 61, &pos);
assert(found == true && pos == 7);
int list3[] = {9, 10, 17, 19, 22, 39, 48, 56};
found = func0(list3, 8, 48, &pos);
assert(found == true && pos == 6);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov %edx,-0x20(%rbp)
mov %rcx,-0x28(%rbp)
mov -0x28(%rbp),%rax
movl $0x0,(%rax)
movb $0x0,-0x1(%rbp)
jmp 11c2 <func0+0x59>
mov -0x28(%rbp),%rax
mov (%rax),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cmp %eax,-0x20(%rbp)
jne 11b3 <func0+0x4a>
movb $0x1,-0x1(%rbp)
jmp 11c2 <func0+0x59>
mov -0x28(%rbp),%rax
mov (%rax),%eax
lea 0x1(%rax),%edx
mov -0x28(%rbp),%rax
mov %edx,(%rax)
mov -0x28(%rbp),%rax
mov (%rax),%eax
cmp %eax,-0x1c(%rbp)
jle 11d8 <func0+0x6f>
movzbl -0x1(%rbp),%eax
xor $0x1,%eax
test %al,%al
jne 118f <func0+0x26>
movzbl -0x1(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_20], edx
mov [rbp+var_28], rcx
mov rax, [rbp+var_28]
mov dword ptr [rax], 0
mov [rbp+var_1], 0
jmp short loc_11C2
loc_118F:
mov rax, [rbp+var_28]
mov eax, [rax]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
cmp [rbp+var_20], eax
jnz short loc_11B3
mov [rbp+var_1], 1
jmp short loc_11C2
loc_11B3:
mov rax, [rbp+var_28]
mov eax, [rax]
lea edx, [rax+1]
mov rax, [rbp+var_28]
mov [rax], edx
loc_11C2:
mov rax, [rbp+var_28]
mov eax, [rax]
cmp [rbp+var_1C], eax
jle short loc_11D8
movzx eax, [rbp+var_1]
xor eax, 1
test al, al
jnz short loc_118F
loc_11D8:
movzx eax, [rbp+var_1]
pop rbp
retn | long long func0(long long a1, int a2, int a3, int *a4)
{
unsigned __int8 v5; // [rsp+27h] [rbp-1h]
*a4 = 0;
v5 = 0;
while ( a2 > *a4 && v5 != 1 )
{
if ( a3 == *(_DWORD *)(4LL * *a4 + a1) )
v5 = 1;
else
++*a4;
}
return v5;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x20],EDX
MOV qword ptr [RBP + -0x28],RCX
MOV RAX,qword ptr [RBP + -0x28]
MOV dword ptr [RAX],0x0
MOV byte ptr [RBP + -0x1],0x0
JMP 0x001011c2
LAB_0010118f:
MOV RAX,qword ptr [RBP + -0x28]
MOV EAX,dword ptr [RAX]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
CMP dword ptr [RBP + -0x20],EAX
JNZ 0x001011b3
MOV byte ptr [RBP + -0x1],0x1
JMP 0x001011c2
LAB_001011b3:
MOV RAX,qword ptr [RBP + -0x28]
MOV EAX,dword ptr [RAX]
LEA EDX,[RAX + 0x1]
MOV RAX,qword ptr [RBP + -0x28]
MOV dword ptr [RAX],EDX
LAB_001011c2:
MOV RAX,qword ptr [RBP + -0x28]
MOV EAX,dword ptr [RAX]
CMP dword ptr [RBP + -0x1c],EAX
JLE 0x001011d8
MOVZX EAX,byte ptr [RBP + -0x1]
XOR EAX,0x1
TEST AL,AL
JNZ 0x0010118f
LAB_001011d8:
MOVZX EAX,byte ptr [RBP + -0x1]
POP RBP
RET | char func0(long param_1,int param_2,int param_3,int *param_4)
{
int local_9;
*param_4 = 0;
local_9 = '\0';
while ((*param_4 < param_2 && (local_9 != '\x01'))) {
if (param_3 == *(int *)(param_1 + (long)*param_4 * 4)) {
local_9 = '\x01';
}
else {
*param_4 = *param_4 + 1;
}
}
return local_9;
} |
5,013 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int dlist[], int size, int item, int *pos) {
*pos = 0;
bool found = false;
while (*pos < size && !found) {
if (dlist[*pos] == item) {
found = true;
} else {
(*pos)++;
}
}
return found;
}
| int main() {
int pos;
bool found;
int list1[] = {11, 23, 58, 31, 56, 77, 43, 12, 65, 19};
found = func0(list1, 10, 31, &pos);
assert(found == true && pos == 3);
int list2[] = {12, 32, 45, 62, 35, 47, 44, 61};
found = func0(list2, 8, 61, &pos);
assert(found == true && pos == 7);
int list3[] = {9, 10, 17, 19, 22, 39, 48, 56};
found = func0(list3, 8, 48, &pos);
assert(found == true && pos == 6);
return 0;
}
| O1 | c | func0:
endbr64
push %rbx
movl $0x0,(%rcx)
mov $0x0,%ebx
mov $0x1,%r11d
mov (%rcx),%eax
cmp %esi,%eax
setge %r9b
movslq %eax,%r8
lea (%rdi,%r8,4),%r10
mov %ebx,%r8d
test %r8b,%r8b
jne 11aa <func0+0x41>
test %r9b,%r9b
jne 11aa <func0+0x41>
mov %r11d,%r8d
cmp %edx,(%r10)
je 1191 <func0+0x28>
add $0x1,%eax
mov %eax,(%rcx)
jmp 117f <func0+0x16>
mov %r8d,%eax
pop %rbx
retq
| func0:
endbr64
push rbx
mov r11, rdi
mov eax, 0
mov ebx, 0
mov r10d, 1
jmp short loc_1186
loc_1183:
add eax, 1
loc_1186:
mov [rcx], eax
cmp eax, esi
setnl r8b
movsxd rdi, eax
lea r9, [r11+rdi*4]
mov edi, ebx
loc_1197:
test dil, dil
jnz short loc_11AB
test r8b, r8b
jnz short loc_11AB
mov edi, r10d
cmp [r9], edx
jnz short loc_1183
jmp short loc_1197
loc_11AB:
mov eax, edi
pop rbx
retn | long long func0(long long a1, int a2, int a3, _DWORD *a4)
{
int v5; // eax
unsigned int v6; // edi
v5 = 0;
LABEL_3:
*a4 = v5;
v6 = 0;
while ( !(_BYTE)v6 && v5 < a2 )
{
v6 = 1;
if ( *(_DWORD *)(a1 + 4LL * v5) != a3 )
{
++v5;
goto LABEL_3;
}
}
return v6;
} | func0:
ENDBR64
PUSH RBX
MOV R11,RDI
MOV EAX,0x0
MOV EBX,0x0
MOV R10D,0x1
JMP 0x00101186
LAB_00101183:
ADD EAX,0x1
LAB_00101186:
MOV dword ptr [RCX],EAX
CMP EAX,ESI
SETGE R8B
MOVSXD RDI,EAX
LEA R9,[R11 + RDI*0x4]
MOV EDI,EBX
LAB_00101197:
TEST DIL,DIL
JNZ 0x001011ab
TEST R8B,R8B
JNZ 0x001011ab
MOV EDI,R10D
CMP dword ptr [R9],EDX
JNZ 0x00101183
JMP 0x00101197
LAB_001011ab:
MOV EAX,EDI
POP RBX
RET | char func0(long param_1,int param_2,int param_3,int *param_4)
{
int iVar1;
char cVar2;
iVar1 = 0;
do {
*param_4 = iVar1;
cVar2 = '\0';
do {
if ((cVar2 != '\0') || (param_2 <= iVar1)) {
return cVar2;
}
cVar2 = '\x01';
} while (*(int *)(param_1 + (long)iVar1 * 4) == param_3);
iVar1 = iVar1 + 1;
} while( true );
} |
5,014 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int dlist[], int size, int item, int *pos) {
*pos = 0;
bool found = false;
while (*pos < size && !found) {
if (dlist[*pos] == item) {
found = true;
} else {
(*pos)++;
}
}
return found;
}
| int main() {
int pos;
bool found;
int list1[] = {11, 23, 58, 31, 56, 77, 43, 12, 65, 19};
found = func0(list1, 10, 31, &pos);
assert(found == true && pos == 3);
int list2[] = {12, 32, 45, 62, 35, 47, 44, 61};
found = func0(list2, 8, 61, &pos);
assert(found == true && pos == 7);
int list3[] = {9, 10, 17, 19, 22, 39, 48, 56};
found = func0(list3, 8, 48, &pos);
assert(found == true && pos == 6);
return 0;
}
| O2 | c | func0:
endbr64
movl $0x0,(%rcx)
test %esi,%esi
jle 1381 <func0+0x31>
sub $0x1,%esi
mov $0x1,%eax
add $0x2,%rsi
nopw 0x0(%rax,%rax,1)
cmp %edx,-0x4(%rdi,%rax,4)
je 1388 <func0+0x38>
mov %eax,(%rcx)
add $0x1,%rax
cmp %rsi,%rax
jne 1370 <func0+0x20>
xor %eax,%eax
retq
nopl 0x0(%rax)
mov $0x1,%eax
retq
xchg %ax,%ax
| func0:
endbr64
mov dword ptr [rcx], 0
test esi, esi
jle short loc_1367
add esi, 1
mov eax, 1
loc_1356:
cmp [rdi+rax*4-4], edx
jz short loc_1370
mov [rcx], eax
add rax, 1
cmp rax, rsi
jnz short loc_1356
loc_1367:
xor eax, eax
retn
loc_1370:
mov eax, 1
retn | long long func0(long long a1, int a2, int a3, _DWORD *a4)
{
long long v4; // rsi
long long v5; // rax
*a4 = 0;
if ( a2 <= 0 )
return 0LL;
v4 = (unsigned int)(a2 + 1);
v5 = 1LL;
while ( *(_DWORD *)(a1 + 4 * v5 - 4) != a3 )
{
*a4 = v5++;
if ( v5 == v4 )
return 0LL;
}
return 1LL;
} | func0:
ENDBR64
MOV dword ptr [RCX],0x0
TEST ESI,ESI
JLE 0x00101367
ADD ESI,0x1
MOV EAX,0x1
LAB_00101356:
CMP dword ptr [RDI + RAX*0x4 + -0x4],EDX
JZ 0x00101370
MOV dword ptr [RCX],EAX
ADD RAX,0x1
CMP RAX,RSI
JNZ 0x00101356
LAB_00101367:
XOR EAX,EAX
RET
LAB_00101370:
MOV EAX,0x1
RET | int8 func0(long param_1,int param_2,int param_3,int4 *param_4)
{
ulong uVar1;
*param_4 = 0;
if (0 < param_2) {
uVar1 = 1;
do {
if (*(int *)(param_1 + -4 + uVar1 * 4) == param_3) {
return 1;
}
*param_4 = (int)uVar1;
uVar1 = uVar1 + 1;
} while (uVar1 != param_2 + 1);
}
return 0;
} |
5,015 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int dlist[], int size, int item, int *pos) {
*pos = 0;
bool found = false;
while (*pos < size && !found) {
if (dlist[*pos] == item) {
found = true;
} else {
(*pos)++;
}
}
return found;
}
| int main() {
int pos;
bool found;
int list1[] = {11, 23, 58, 31, 56, 77, 43, 12, 65, 19};
found = func0(list1, 10, 31, &pos);
assert(found == true && pos == 3);
int list2[] = {12, 32, 45, 62, 35, 47, 44, 61};
found = func0(list2, 8, 61, &pos);
assert(found == true && pos == 7);
int list3[] = {9, 10, 17, 19, 22, 39, 48, 56};
found = func0(list3, 8, 48, &pos);
assert(found == true && pos == 6);
return 0;
}
| O3 | c | func0:
endbr64
movl $0x0,(%rcx)
test %esi,%esi
jle 1301 <func0+0x31>
sub $0x1,%esi
mov $0x1,%eax
add $0x2,%rsi
nopw 0x0(%rax,%rax,1)
cmp %edx,-0x4(%rdi,%rax,4)
je 1308 <func0+0x38>
mov %eax,(%rcx)
add $0x1,%rax
cmp %rsi,%rax
jne 12f0 <func0+0x20>
xor %eax,%eax
retq
nopl 0x0(%rax)
mov $0x1,%eax
retq
xchg %ax,%ax
| func0:
endbr64
xor eax, eax
loc_1146:
mov [rcx], eax
cmp esi, eax
jle short loc_1160
add rax, 1
cmp edx, [rdi+rax*4-4]
jnz short loc_1146
mov eax, 1
retn
loc_1160:
xor eax, eax
retn | long long func0(long long a1, int a2, int a3, _DWORD *a4)
{
long long v4; // rax
v4 = 0LL;
while ( 1 )
{
*a4 = v4;
if ( a2 <= (int)v4 )
break;
++v4;
if ( a3 == *(_DWORD *)(a1 + 4 * v4 - 4) )
return 1LL;
}
return 0LL;
} | func0:
ENDBR64
XOR EAX,EAX
LAB_00101146:
MOV dword ptr [RCX],EAX
CMP ESI,EAX
JLE 0x00101160
ADD RAX,0x1
CMP EDX,dword ptr [RDI + RAX*0x4 + -0x4]
JNZ 0x00101146
MOV EAX,0x1
RET
LAB_00101160:
XOR EAX,EAX
RET | int8 func0(long param_1,int param_2,int param_3,int *param_4)
{
long lVar1;
lVar1 = 0;
do {
*param_4 = (int)lVar1;
if (param_2 <= (int)lVar1) {
return 0;
}
lVar1 = lVar1 + 1;
} while (param_3 != *(int *)(param_1 + -4 + lVar1 * 4));
return 1;
} |
5,016 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
| bool func0(int *test_list, int length) {
for (int i = 0; i < length - 1; i++) {
for (int j = i + 1; j < length; j++) {
if (test_list[i] == test_list[j]) {
return false;
}
}
}
return true;
}
| int main() {
int list1[] = {1, 2, 3};
int list2[] = {1, 2, 1, 2};
int list3[] = {1, 2, 3, 4, 5};
assert(func0(list1, sizeof(list1) / sizeof(list1[0])) == true);
assert(func0(list2, sizeof(list2) / sizeof(list2[0])) == false);
assert(func0(list3, sizeof(list3) / sizeof(list3[0])) == true);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
movl $0x0,-0x8(%rbp)
jmp 11d3 <func0+0x6a>
mov -0x8(%rbp),%eax
add $0x1,%eax
mov %eax,-0x4(%rbp)
jmp 11c7 <func0+0x5e>
mov -0x8(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%edx
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rcx
mov -0x18(%rbp),%rax
add %rcx,%rax
mov (%rax),%eax
cmp %eax,%edx
jne 11c3 <func0+0x5a>
mov $0x0,%eax
jmp 11e3 <func0+0x7a>
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 118c <func0+0x23>
addl $0x1,-0x8(%rbp)
mov -0x1c(%rbp),%eax
sub $0x1,%eax
cmp %eax,-0x8(%rbp)
jl 1181 <func0+0x18>
mov $0x1,%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_8], 0
jmp short loc_11D3
loc_1181:
mov eax, [rbp+var_8]
add eax, 1
mov [rbp+var_4], eax
jmp short loc_11C7
loc_118C:
mov eax, [rbp+var_8]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov edx, [rax]
mov eax, [rbp+var_4]
cdqe
lea rcx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rcx
mov eax, [rax]
cmp edx, eax
jnz short loc_11C3
mov eax, 0
jmp short loc_11E3
loc_11C3:
add [rbp+var_4], 1
loc_11C7:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_118C
add [rbp+var_8], 1
loc_11D3:
mov eax, [rbp+var_1C]
sub eax, 1
cmp [rbp+var_8], eax
jl short loc_1181
mov eax, 1
loc_11E3:
pop rbp
retn | long long func0(long long a1, int a2)
{
int i; // [rsp+14h] [rbp-8h]
int j; // [rsp+18h] [rbp-4h]
for ( i = 0; i < a2 - 1; ++i )
{
for ( j = i + 1; j < a2; ++j )
{
if ( *(_DWORD *)(4LL * i + a1) == *(_DWORD *)(4LL * j + a1) )
return 0LL;
}
}
return 1LL;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x8],0x0
JMP 0x001011d3
LAB_00101181:
MOV EAX,dword ptr [RBP + -0x8]
ADD EAX,0x1
MOV dword ptr [RBP + -0x4],EAX
JMP 0x001011c7
LAB_0010118c:
MOV EAX,dword ptr [RBP + -0x8]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RCX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RCX
MOV EAX,dword ptr [RAX]
CMP EDX,EAX
JNZ 0x001011c3
MOV EAX,0x0
JMP 0x001011e3
LAB_001011c3:
ADD dword ptr [RBP + -0x4],0x1
LAB_001011c7:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x0010118c
ADD dword ptr [RBP + -0x8],0x1
LAB_001011d3:
MOV EAX,dword ptr [RBP + -0x1c]
SUB EAX,0x1
CMP dword ptr [RBP + -0x8],EAX
JL 0x00101181
MOV EAX,0x1
LAB_001011e3:
POP RBP
RET | int8 func0(long param_1,int param_2)
{
int local_10;
int local_c;
local_10 = 0;
do {
local_c = local_10;
if (param_2 + -1 <= local_10) {
return 1;
}
while (local_c = local_c + 1, local_c < param_2) {
if (*(int *)(param_1 + (long)local_10 * 4) == *(int *)(param_1 + (long)local_c * 4)) {
return 0;
}
}
local_10 = local_10 + 1;
} while( true );
} |
5,017 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
| bool func0(int *test_list, int length) {
for (int i = 0; i < length - 1; i++) {
for (int j = i + 1; j < length; j++) {
if (test_list[i] == test_list[j]) {
return false;
}
}
}
return true;
}
| int main() {
int list1[] = {1, 2, 3};
int list2[] = {1, 2, 1, 2};
int list3[] = {1, 2, 3, 4, 5};
assert(func0(list1, sizeof(list1) / sizeof(list1[0])) == true);
assert(func0(list2, sizeof(list2) / sizeof(list2[0])) == false);
assert(func0(list3, sizeof(list3) / sizeof(list3[0])) == true);
return 0;
}
| O1 | c | func0:
endbr64
cmp $0x1,%esi
jle 11a6 <func0+0x3d>
lea -0x2(%rsi),%r8d
add $0x2,%r8
mov $0x1,%ecx
cmp %ecx,%esi
jle 1197 <func0+0x2e>
mov -0x4(%rdi,%rcx,4),%edx
mov %rcx,%rax
cmp (%rdi,%rax,4),%edx
je 11ac <func0+0x43>
add $0x1,%rax
cmp %eax,%esi
jg 118a <func0+0x21>
add $0x1,%rcx
cmp %r8,%rcx
jne 117f <func0+0x16>
mov $0x1,%eax
retq
mov $0x1,%eax
retq
mov $0x0,%eax
retq
| func0:
endbr64
cmp esi, 1
jle short loc_11A6
lea r8d, [rsi-2]
add r8, 2
mov ecx, 1
loc_117F:
cmp esi, ecx
jle short loc_1197
mov edx, [rdi+rcx*4-4]
mov rax, rcx
loc_118A:
cmp edx, [rdi+rax*4]
jz short loc_11AC
add rax, 1
cmp esi, eax
jg short loc_118A
loc_1197:
add rcx, 1
cmp rcx, r8
jnz short loc_117F
mov eax, 1
retn
loc_11A6:
mov eax, 1
retn
loc_11AC:
mov eax, 0
retn | long long func0(long long a1, int a2)
{
long long v2; // rcx
long long v3; // rax
if ( a2 <= 1 )
return 1LL;
v2 = 1LL;
while ( a2 <= (int)v2 )
{
LABEL_7:
if ( ++v2 == (unsigned int)(a2 - 2) + 2LL )
return 1LL;
}
v3 = v2;
while ( *(_DWORD *)(a1 + 4 * v2 - 4) != *(_DWORD *)(a1 + 4 * v3) )
{
if ( a2 <= (int)++v3 )
goto LABEL_7;
}
return 0LL;
} | func0:
ENDBR64
CMP ESI,0x1
JLE 0x001011a6
LEA R8D,[RSI + -0x2]
ADD R8,0x2
MOV ECX,0x1
LAB_0010117f:
CMP ESI,ECX
JLE 0x00101197
MOV EDX,dword ptr [RDI + RCX*0x4 + -0x4]
MOV RAX,RCX
LAB_0010118a:
CMP EDX,dword ptr [RDI + RAX*0x4]
JZ 0x001011ac
ADD RAX,0x1
CMP ESI,EAX
JG 0x0010118a
LAB_00101197:
ADD RCX,0x1
CMP RCX,R8
JNZ 0x0010117f
MOV EAX,0x1
RET
LAB_001011a6:
MOV EAX,0x1
RET
LAB_001011ac:
MOV EAX,0x0
RET | int8 func0(long param_1,int param_2)
{
long lVar1;
long lVar2;
if (param_2 < 2) {
return 1;
}
lVar2 = 1;
do {
if ((int)lVar2 < param_2) {
lVar1 = lVar2;
do {
if (*(int *)(param_1 + -4 + lVar2 * 4) == *(int *)(param_1 + lVar1 * 4)) {
return 0;
}
lVar1 = lVar1 + 1;
} while ((int)lVar1 < param_2);
}
lVar2 = lVar2 + 1;
} while (lVar2 != (ulong)(param_2 - 2) + 2);
return 1;
} |
5,018 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
| bool func0(int *test_list, int length) {
for (int i = 0; i < length - 1; i++) {
for (int j = i + 1; j < length; j++) {
if (test_list[i] == test_list[j]) {
return false;
}
}
}
return true;
}
| int main() {
int list1[] = {1, 2, 3};
int list2[] = {1, 2, 1, 2};
int list3[] = {1, 2, 3, 4, 5};
assert(func0(list1, sizeof(list1) / sizeof(list1[0])) == true);
assert(func0(list2, sizeof(list2) / sizeof(list2[0])) == false);
assert(func0(list3, sizeof(list3) / sizeof(list3[0])) == true);
return 0;
}
| O2 | c | func0:
endbr64
cmp $0x1,%esi
jle 12c9 <func0+0x49>
lea -0x2(%rsi),%r8d
mov $0x1,%ecx
add $0x2,%r8
cmp %ecx,%esi
jle 12c0 <func0+0x40>
mov -0x4(%rdi,%rcx,4),%edx
mov %rcx,%rax
jmp 12b0 <func0+0x30>
nopl 0x0(%rax,%rax,1)
add $0x1,%rax
cmp %eax,%esi
jle 12c0 <func0+0x40>
cmp (%rdi,%rax,4),%edx
jne 12a8 <func0+0x28>
xor %eax,%eax
retq
nopl 0x0(%rax,%rax,1)
add $0x1,%rcx
cmp %r8,%rcx
jne 1296 <func0+0x16>
mov $0x1,%eax
retq
| func0:
endbr64
cmp esi, 1
jle short loc_12C9
lea r8d, [rsi-2]
mov ecx, 1
add r8, 2
loc_1296:
cmp esi, ecx
jle short loc_12C0
mov edx, [rdi+rcx*4-4]
mov rax, rcx
jmp short loc_12B0
loc_12A8:
add rax, 1
cmp esi, eax
jle short loc_12C0
loc_12B0:
cmp edx, [rdi+rax*4]
jnz short loc_12A8
xor eax, eax
retn
loc_12C0:
add rcx, 1
cmp rcx, r8
jnz short loc_1296
loc_12C9:
mov eax, 1
retn | long long func0(long long a1, int a2)
{
long long v2; // rcx
long long v3; // rax
if ( a2 <= 1 )
return 1LL;
v2 = 1LL;
while ( a2 <= (int)v2 )
{
LABEL_8:
if ( ++v2 == (unsigned int)(a2 - 2) + 2LL )
return 1LL;
}
v3 = v2;
while ( *(_DWORD *)(a1 + 4 * v2 - 4) != *(_DWORD *)(a1 + 4 * v3) )
{
if ( a2 <= (int)++v3 )
goto LABEL_8;
}
return 0LL;
} | func0:
ENDBR64
CMP ESI,0x1
JLE 0x001012c9
LEA R8D,[RSI + -0x2]
MOV ECX,0x1
ADD R8,0x2
LAB_00101296:
CMP ESI,ECX
JLE 0x001012c0
MOV EDX,dword ptr [RDI + RCX*0x4 + -0x4]
MOV RAX,RCX
JMP 0x001012b0
LAB_001012a8:
ADD RAX,0x1
CMP ESI,EAX
JLE 0x001012c0
LAB_001012b0:
CMP EDX,dword ptr [RDI + RAX*0x4]
JNZ 0x001012a8
XOR EAX,EAX
RET
LAB_001012c0:
ADD RCX,0x1
CMP RCX,R8
JNZ 0x00101296
LAB_001012c9:
MOV EAX,0x1
RET | int8 func0(long param_1,int param_2)
{
long lVar1;
long lVar2;
if (1 < param_2) {
lVar2 = 1;
do {
if ((int)lVar2 < param_2) {
lVar1 = lVar2;
do {
if (*(int *)(param_1 + -4 + lVar2 * 4) == *(int *)(param_1 + lVar1 * 4)) {
return 0;
}
lVar1 = lVar1 + 1;
} while ((int)lVar1 < param_2);
}
lVar2 = lVar2 + 1;
} while (lVar2 != (ulong)(param_2 - 2) + 2);
}
return 1;
} |
5,019 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
| bool func0(int *test_list, int length) {
for (int i = 0; i < length - 1; i++) {
for (int j = i + 1; j < length; j++) {
if (test_list[i] == test_list[j]) {
return false;
}
}
}
return true;
}
| int main() {
int list1[] = {1, 2, 3};
int list2[] = {1, 2, 1, 2};
int list3[] = {1, 2, 3, 4, 5};
assert(func0(list1, sizeof(list1) / sizeof(list1[0])) == true);
assert(func0(list2, sizeof(list2) / sizeof(list2[0])) == false);
assert(func0(list3, sizeof(list3) / sizeof(list3[0])) == true);
return 0;
}
| O3 | c | func0:
endbr64
cmp $0x1,%esi
jle 12c9 <func0+0x49>
lea -0x2(%rsi),%r8d
mov $0x1,%ecx
add $0x2,%r8
cmp %ecx,%esi
jle 12c0 <func0+0x40>
mov -0x4(%rdi,%rcx,4),%edx
mov %rcx,%rax
jmp 12b0 <func0+0x30>
nopl 0x0(%rax,%rax,1)
add $0x1,%rax
cmp %eax,%esi
jle 12c0 <func0+0x40>
cmp (%rdi,%rax,4),%edx
jne 12a8 <func0+0x28>
xor %eax,%eax
retq
nopl 0x0(%rax,%rax,1)
add $0x1,%rcx
cmp %r8,%rcx
jne 1296 <func0+0x16>
mov $0x1,%eax
retq
| func0:
endbr64
cmp esi, 1
jle short loc_1179
mov r8d, esi
mov ecx, 1
loc_1151:
cmp esi, ecx
jle short loc_1170
mov edx, [rdi+rcx*4-4]
mov rax, rcx
jmp short loc_1168
loc_1160:
add rax, 1
cmp esi, eax
jle short loc_1170
loc_1168:
cmp edx, [rdi+rax*4]
jnz short loc_1160
xor eax, eax
retn
loc_1170:
add rcx, 1
cmp rcx, r8
jnz short loc_1151
loc_1179:
mov eax, 1
retn | long long func0(long long a1, int a2)
{
long long v2; // rcx
long long v3; // rax
if ( a2 <= 1 )
return 1LL;
v2 = 1LL;
while ( a2 <= (int)v2 )
{
LABEL_8:
if ( ++v2 == a2 )
return 1LL;
}
v3 = v2;
while ( *(_DWORD *)(a1 + 4 * v2 - 4) != *(_DWORD *)(a1 + 4 * v3) )
{
if ( a2 <= (int)++v3 )
goto LABEL_8;
}
return 0LL;
} | func0:
ENDBR64
CMP ESI,0x1
JLE 0x00101179
MOV R8D,ESI
MOV ECX,0x1
LAB_00101151:
CMP ESI,ECX
JLE 0x00101170
MOV EDX,dword ptr [RDI + RCX*0x4 + -0x4]
MOV RAX,RCX
JMP 0x00101168
LAB_00101160:
ADD RAX,0x1
CMP ESI,EAX
JLE 0x00101170
LAB_00101168:
CMP EDX,dword ptr [RDI + RAX*0x4]
JNZ 0x00101160
XOR EAX,EAX
RET
LAB_00101170:
ADD RCX,0x1
CMP RCX,R8
JNZ 0x00101151
LAB_00101179:
MOV EAX,0x1
RET | int8 func0(long param_1,uint param_2)
{
ulong uVar1;
ulong uVar2;
if (1 < (int)param_2) {
uVar2 = 1;
do {
if ((int)uVar2 < (int)param_2) {
uVar1 = uVar2;
do {
if (*(int *)(param_1 + -4 + uVar2 * 4) == *(int *)(param_1 + uVar1 * 4)) {
return 0;
}
uVar1 = uVar1 + 1;
} while ((int)uVar1 < (int)param_2);
}
uVar2 = uVar2 + 1;
} while (uVar2 != param_2);
}
return 1;
} |
5,020 | func0 |
#include <stdio.h>
#include <assert.h>
| int* func0(int nums1[], int nums2[], int size, int result[]) {
for (int i = 0; i < size; i++) {
result[i] = nums1[i] - nums2[i];
}
return result;
}
| int main() {
int result1[3], result2[2], result3[2];
int nums1a[] = {1, 2, 3}, nums2a[] = {4, 5, 6};
int nums1b[] = {1, 2}, nums2b[] = {3, 4};
int nums1c[] = {90, 120}, nums2c[] = {50, 70};
assert(func0(nums1a, nums2a, 3, result1)[0] == -3 && func0(nums1a, nums2a, 3, result1)[1] == -3 && func0(nums1a, nums2a, 3, result1)[2] == -3);
assert(func0(nums1b, nums2b, 2, result2)[0] == -2 && func0(nums1b, nums2b, 2, result2)[1] == -2);
assert(func0(nums1c, nums2c, 2, result3)[0] == 40 && func0(nums1c, nums2c, 2, result3)[1] == 50);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %rsi,-0x20(%rbp)
mov %edx,-0x24(%rbp)
mov %rcx,-0x30(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11d3 <func0+0x6a>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%ecx
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x20(%rbp),%rax
add %rdx,%rax
mov (%rax),%edx
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rsi
mov -0x30(%rbp),%rax
add %rsi,%rax
sub %edx,%ecx
mov %ecx,%edx
mov %edx,(%rax)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x24(%rbp),%eax
jl 1189 <func0+0x20>
mov -0x30(%rbp),%rax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_20], rsi
mov [rbp+var_24], edx
mov [rbp+var_30], rcx
mov [rbp+var_4], 0
jmp short loc_11D2
loc_1189:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov ecx, [rax]
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_20]
add rax, rdx
mov eax, [rax]
mov edx, [rbp+var_4]
movsxd rdx, edx
lea rsi, ds:0[rdx*4]
mov rdx, [rbp+var_30]
add rdx, rsi
sub ecx, eax
mov [rdx], ecx
add [rbp+var_4], 1
loc_11D2:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_24]
jl short loc_1189
mov rax, [rbp+var_30]
pop rbp
retn | long long func0(long long a1, long long a2, int a3, long long a4)
{
int i; // [rsp+2Ch] [rbp-4h]
for ( i = 0; i < a3; ++i )
*(_DWORD *)(4LL * i + a4) = *(_DWORD *)(4LL * i + a1) - *(_DWORD *)(4LL * i + a2);
return a4;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV qword ptr [RBP + -0x20],RSI
MOV dword ptr [RBP + -0x24],EDX
MOV qword ptr [RBP + -0x30],RCX
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011d2
LAB_00101189:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV ECX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x20]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
MOV EDX,dword ptr [RBP + -0x4]
MOVSXD RDX,EDX
LEA RSI,[RDX*0x4]
MOV RDX,qword ptr [RBP + -0x30]
ADD RDX,RSI
SUB ECX,EAX
MOV dword ptr [RDX],ECX
ADD dword ptr [RBP + -0x4],0x1
LAB_001011d2:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x24]
JL 0x00101189
MOV RAX,qword ptr [RBP + -0x30]
POP RBP
RET | long func0(long param_1,long param_2,int param_3,long param_4)
{
int4 local_c;
for (local_c = 0; local_c < param_3; local_c = local_c + 1) {
*(int *)(param_4 + (long)local_c * 4) =
*(int *)(param_1 + (long)local_c * 4) - *(int *)(param_2 + (long)local_c * 4);
}
return param_4;
} |
5,021 | func0 |
#include <stdio.h>
#include <assert.h>
| int* func0(int nums1[], int nums2[], int size, int result[]) {
for (int i = 0; i < size; i++) {
result[i] = nums1[i] - nums2[i];
}
return result;
}
| int main() {
int result1[3], result2[2], result3[2];
int nums1a[] = {1, 2, 3}, nums2a[] = {4, 5, 6};
int nums1b[] = {1, 2}, nums2b[] = {3, 4};
int nums1c[] = {90, 120}, nums2c[] = {50, 70};
assert(func0(nums1a, nums2a, 3, result1)[0] == -3 && func0(nums1a, nums2a, 3, result1)[1] == -3 && func0(nums1a, nums2a, 3, result1)[2] == -3);
assert(func0(nums1b, nums2b, 2, result2)[0] == -2 && func0(nums1b, nums2b, 2, result2)[1] == -2);
assert(func0(nums1c, nums2c, 2, result3)[0] == 40 && func0(nums1c, nums2c, 2, result3)[1] == 50);
return 0;
}
| O1 | c | func0:
endbr64
mov %rcx,%rax
test %edx,%edx
jle 1194 <func0+0x2b>
lea -0x1(%rdx),%ecx
mov $0x0,%edx
mov (%rdi,%rdx,4),%r8d
sub (%rsi,%rdx,4),%r8d
mov %r8d,(%rax,%rdx,4)
mov %rdx,%r8
add $0x1,%rdx
cmp %rcx,%r8
jne 117c <func0+0x13>
retq
| func0:
endbr64
mov rax, rcx
test edx, edx
jle short locret_1191
mov edx, edx
mov r8d, 0
loc_117C:
mov r9d, [rdi+r8*4]
sub r9d, [rsi+r8*4]
mov [rax+r8*4], r9d
add r8, 1
cmp r8, rdx
jnz short loc_117C
locret_1191:
retn | long long func0(long long a1, long long a2, int a3, long long a4)
{
long long result; // rax
long long i; // r8
result = a4;
if ( a3 > 0 )
{
for ( i = 0LL; i != a3; ++i )
*(_DWORD *)(a4 + 4 * i) = *(_DWORD *)(a1 + 4 * i) - *(_DWORD *)(a2 + 4 * i);
}
return result;
} | func0:
ENDBR64
MOV RAX,RCX
TEST EDX,EDX
JLE 0x00101191
MOV EDX,EDX
MOV R8D,0x0
LAB_0010117c:
MOV R9D,dword ptr [RDI + R8*0x4]
SUB R9D,dword ptr [RSI + R8*0x4]
MOV dword ptr [RAX + R8*0x4],R9D
ADD R8,0x1
CMP R8,RDX
JNZ 0x0010117c
LAB_00101191:
RET | void func0(long param_1,long param_2,uint param_3,long param_4)
{
ulong uVar1;
if (0 < (int)param_3) {
uVar1 = 0;
do {
*(int *)(param_4 + uVar1 * 4) = *(int *)(param_1 + uVar1 * 4) - *(int *)(param_2 + uVar1 * 4);
uVar1 = uVar1 + 1;
} while (uVar1 != param_3);
}
return;
} |
5,022 | func0 |
#include <stdio.h>
#include <assert.h>
| int* func0(int nums1[], int nums2[], int size, int result[]) {
for (int i = 0; i < size; i++) {
result[i] = nums1[i] - nums2[i];
}
return result;
}
| int main() {
int result1[3], result2[2], result3[2];
int nums1a[] = {1, 2, 3}, nums2a[] = {4, 5, 6};
int nums1b[] = {1, 2}, nums2b[] = {3, 4};
int nums1c[] = {90, 120}, nums2c[] = {50, 70};
assert(func0(nums1a, nums2a, 3, result1)[0] == -3 && func0(nums1a, nums2a, 3, result1)[1] == -3 && func0(nums1a, nums2a, 3, result1)[2] == -3);
assert(func0(nums1b, nums2b, 2, result2)[0] == -2 && func0(nums1b, nums2b, 2, result2)[1] == -2);
assert(func0(nums1c, nums2c, 2, result3)[0] == 40 && func0(nums1c, nums2c, 2, result3)[1] == 50);
return 0;
}
| O2 | c | func0:
endbr64
mov %rcx,%rax
test %edx,%edx
jle 1168 <func0+0x28>
lea -0x1(%rdx),%ecx
xor %edx,%edx
mov (%rdi,%rdx,4),%r8d
sub (%rsi,%rdx,4),%r8d
mov %r8d,(%rax,%rdx,4)
mov %rdx,%r8
add $0x1,%rdx
cmp %rcx,%r8
jne 1150 <func0+0x10>
retq
nopl 0x0(%rax)
| func0:
endbr64
mov rax, rcx
test edx, edx
jle short locret_116D
movsxd rdx, edx
xor r8d, r8d
nop dword ptr [rax+00000000h]
loc_1158:
mov r9d, [rdi+r8*4]
sub r9d, [rsi+r8*4]
mov [rax+r8*4], r9d
add r8, 1
cmp rdx, r8
jnz short loc_1158
locret_116D:
retn | long long func0(long long a1, long long a2, int a3, long long a4)
{
long long result; // rax
long long i; // r8
result = a4;
if ( a3 > 0 )
{
for ( i = 0LL; i != a3; ++i )
*(_DWORD *)(a4 + 4 * i) = *(_DWORD *)(a1 + 4 * i) - *(_DWORD *)(a2 + 4 * i);
}
return result;
} | func0:
ENDBR64
MOV RAX,RCX
TEST EDX,EDX
JLE 0x0010116d
MOVSXD RDX,EDX
XOR R8D,R8D
NOP dword ptr [RAX]
LAB_00101158:
MOV R9D,dword ptr [RDI + R8*0x4]
SUB R9D,dword ptr [RSI + R8*0x4]
MOV dword ptr [RAX + R8*0x4],R9D
ADD R8,0x1
CMP RDX,R8
JNZ 0x00101158
LAB_0010116d:
RET | void func0(long param_1,long param_2,int param_3,long param_4)
{
long lVar1;
if (0 < param_3) {
lVar1 = 0;
do {
*(int *)(param_4 + lVar1 * 4) = *(int *)(param_1 + lVar1 * 4) - *(int *)(param_2 + lVar1 * 4);
lVar1 = lVar1 + 1;
} while (param_3 != lVar1);
}
return;
} |
5,023 | func0 |
#include <stdio.h>
#include <assert.h>
| int* func0(int nums1[], int nums2[], int size, int result[]) {
for (int i = 0; i < size; i++) {
result[i] = nums1[i] - nums2[i];
}
return result;
}
| int main() {
int result1[3], result2[2], result3[2];
int nums1a[] = {1, 2, 3}, nums2a[] = {4, 5, 6};
int nums1b[] = {1, 2}, nums2b[] = {3, 4};
int nums1c[] = {90, 120}, nums2c[] = {50, 70};
assert(func0(nums1a, nums2a, 3, result1)[0] == -3 && func0(nums1a, nums2a, 3, result1)[1] == -3 && func0(nums1a, nums2a, 3, result1)[2] == -3);
assert(func0(nums1b, nums2b, 2, result2)[0] == -2 && func0(nums1b, nums2b, 2, result2)[1] == -2);
assert(func0(nums1c, nums2c, 2, result3)[0] == 40 && func0(nums1c, nums2c, 2, result3)[1] == 50);
return 0;
}
| O3 | c | func0:
endbr64
mov %rcx,%rax
test %edx,%edx
jle 1215 <func0+0xd5>
lea 0xf(%rcx),%rcx
lea -0x1(%rdx),%r8d
mov %rcx,%r9
sub %rdi,%r9
cmp $0x1e,%r9
seta %r10b
cmp $0x2,%r8d
seta %r9b
test %r9b,%r10b
je 11f8 <func0+0xb8>
sub %rsi,%rcx
cmp $0x1e,%rcx
jbe 11f8 <func0+0xb8>
mov %edx,%ecx
xor %r8d,%r8d
shr $0x2,%ecx
shl $0x4,%rcx
nopl 0x0(%rax,%rax,1)
movdqu (%rdi,%r8,1),%xmm0
movdqu (%rsi,%r8,1),%xmm1
psubd %xmm1,%xmm0
movups %xmm0,(%rax,%r8,1)
add $0x10,%r8
cmp %rcx,%r8
jne 1190 <func0+0x50>
mov %edx,%ecx
and $0xfffffffc,%ecx
test $0x3,%dl
je 1215 <func0+0xd5>
mov %ecx,%r8d
mov (%rdi,%r8,4),%r9d
sub (%rsi,%r8,4),%r9d
mov %r9d,(%rax,%r8,4)
lea 0x1(%rcx),%r8d
cmp %r8d,%edx
jle 1215 <func0+0xd5>
movslq %r8d,%r8
add $0x2,%ecx
mov (%rdi,%r8,4),%r9d
sub (%rsi,%r8,4),%r9d
mov %r9d,(%rax,%r8,4)
cmp %ecx,%edx
jle 1215 <func0+0xd5>
movslq %ecx,%rcx
mov (%rdi,%rcx,4),%edx
sub (%rsi,%rcx,4),%edx
mov %edx,(%rax,%rcx,4)
retq
nopl 0x0(%rax,%rax,1)
xor %edx,%edx
nopw 0x0(%rax,%rax,1)
mov (%rdi,%rdx,4),%ecx
sub (%rsi,%rdx,4),%ecx
mov %ecx,(%rax,%rdx,4)
mov %rdx,%rcx
add $0x1,%rdx
cmp %r8,%rcx
jne 1200 <func0+0xc0>
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
movsxd rax, edx
mov r8, rsi
test eax, eax
jle loc_1201
cmp eax, 1
jz loc_1208
lea rsi, [rdi+4]
mov rdx, rcx
sub rdx, rsi
cmp rdx, 8
jbe loc_1208
lea rsi, [r8+4]
mov rdx, rcx
sub rdx, rsi
cmp rdx, 8
jbe loc_1208
lea edx, [rax-1]
mov r9d, eax
cmp edx, 2
jbe loc_122F
mov esi, eax
xor edx, edx
shr esi, 2
shl rsi, 4
nop dword ptr [rax]
loc_11A0:
movdqu xmm0, xmmword ptr [rdi+rdx]
movdqu xmm2, xmmword ptr [r8+rdx]
psubd xmm0, xmm2
movups xmmword ptr [rcx+rdx], xmm0
add rdx, 10h
cmp rsi, rdx
jnz short loc_11A0
mov edx, eax
and edx, 0FFFFFFFCh
mov esi, edx
cmp eax, edx
jz short loc_1201
sub eax, edx
mov r9d, eax
cmp eax, 1
jz short loc_11F4
loc_11D1:
mov eax, esi
movq xmm0, qword ptr [rdi+rax*4]
movq xmm1, qword ptr [r8+rax*4]
psubd xmm0, xmm1
movq qword ptr [rcx+rax*4], xmm0
test r9b, 1
jz short loc_1201
and r9d, 0FFFFFFFEh
add edx, r9d
loc_11F4:
movsxd rax, edx
mov edx, [rdi+rax*4]
sub edx, [r8+rax*4]
mov [rcx+rax*4], edx
loc_1201:
mov rax, rcx
retn
loc_1208:
lea rsi, ds:0[rax*4]
xor eax, eax
nop word ptr [rax+rax+00h]
loc_1218:
mov edx, [rdi+rax]
sub edx, [r8+rax]
mov [rcx+rax], edx
add rax, 4
cmp rax, rsi
jnz short loc_1218
mov rax, rcx
retn
loc_122F:
xor esi, esi
xor edx, edx
jmp short loc_11D1 | long long func0(long long a1, long long a2, int a3, long long a4)
{
int v6; // r9d
long long v7; // rdx
signed int v8; // edx
unsigned int v9; // esi
long long v11; // rax
if ( a3 <= 0 )
return a4;
if ( a3 != 1 && (unsigned long long)(a4 - (a1 + 4)) > 8 && (unsigned long long)(a4 - (a2 + 4)) > 8 )
{
v6 = a3;
if ( (unsigned int)(a3 - 1) <= 2 )
{
v9 = 0;
v8 = 0;
}
else
{
v7 = 0LL;
do
{
*(__m128i *)(a4 + v7) = _mm_sub_epi32(
_mm_loadu_si128((const __m128i *)(a1 + v7)),
_mm_loadu_si128((const __m128i *)(a2 + v7)));
v7 += 16LL;
}
while ( 16LL * ((unsigned int)a3 >> 2) != v7 );
v8 = a3 & 0xFFFFFFFC;
v9 = a3 & 0xFFFFFFFC;
if ( a3 == (a3 & 0xFFFFFFFC) )
return a4;
v6 = a3 - v8;
if ( a3 - v8 == 1 )
goto LABEL_12;
}
*(_QWORD *)(a4 + 4LL * v9) = _mm_sub_epi32(
_mm_loadl_epi64((const __m128i *)(a1 + 4LL * v9)),
_mm_loadl_epi64((const __m128i *)(a2 + 4LL * v9))).m128i_u64[0];
if ( (v6 & 1) == 0 )
return a4;
v8 += v6 & 0xFFFFFFFE;
LABEL_12:
*(_DWORD *)(a4 + 4LL * v8) = *(_DWORD *)(a1 + 4LL * v8) - *(_DWORD *)(a2 + 4LL * v8);
return a4;
}
v11 = 0LL;
do
{
*(_DWORD *)(a4 + v11) = *(_DWORD *)(a1 + v11) - *(_DWORD *)(a2 + v11);
v11 += 4LL;
}
while ( v11 != 4LL * a3 );
return a4;
} | func0:
ENDBR64
MOVSXD RAX,EDX
MOV R8,RSI
TEST EAX,EAX
JLE 0x00101201
CMP EAX,0x1
JZ 0x00101208
LEA RSI,[RDI + 0x4]
MOV RDX,RCX
SUB RDX,RSI
CMP RDX,0x8
JBE 0x00101208
LEA RSI,[R8 + 0x4]
MOV RDX,RCX
SUB RDX,RSI
CMP RDX,0x8
JBE 0x00101208
LEA EDX,[RAX + -0x1]
MOV R9D,EAX
CMP EDX,0x2
JBE 0x0010122f
MOV ESI,EAX
XOR EDX,EDX
SHR ESI,0x2
SHL RSI,0x4
NOP dword ptr [RAX]
LAB_001011a0:
MOVDQU XMM0,xmmword ptr [RDI + RDX*0x1]
MOVDQU XMM2,xmmword ptr [R8 + RDX*0x1]
PSUBD XMM0,XMM2
MOVUPS xmmword ptr [RCX + RDX*0x1],XMM0
ADD RDX,0x10
CMP RSI,RDX
JNZ 0x001011a0
MOV EDX,EAX
AND EDX,0xfffffffc
MOV ESI,EDX
CMP EAX,EDX
JZ 0x00101201
SUB EAX,EDX
MOV R9D,EAX
CMP EAX,0x1
JZ 0x001011f4
LAB_001011d1:
MOV EAX,ESI
MOVQ XMM0,qword ptr [RDI + RAX*0x4]
MOVQ XMM1,qword ptr [R8 + RAX*0x4]
PSUBD XMM0,XMM1
MOVQ qword ptr [RCX + RAX*0x4],XMM0
TEST R9B,0x1
JZ 0x00101201
AND R9D,0xfffffffe
ADD EDX,R9D
LAB_001011f4:
MOVSXD RAX,EDX
MOV EDX,dword ptr [RDI + RAX*0x4]
SUB EDX,dword ptr [R8 + RAX*0x4]
MOV dword ptr [RCX + RAX*0x4],EDX
LAB_00101201:
MOV RAX,RCX
RET
LAB_00101208:
LEA RSI,[RAX*0x4]
XOR EAX,EAX
NOP word ptr [RAX + RAX*0x1]
LAB_00101218:
MOV EDX,dword ptr [RDI + RAX*0x1]
SUB EDX,dword ptr [R8 + RAX*0x1]
MOV dword ptr [RCX + RAX*0x1],EDX
ADD RAX,0x4
CMP RAX,RSI
JNZ 0x00101218
MOV RAX,RCX
RET
LAB_0010122f:
XOR ESI,ESI
XOR EDX,EDX
JMP 0x001011d1 | long func0(long param_1,long param_2,uint param_3,long param_4)
{
int *piVar1;
int *piVar2;
int *piVar3;
int8 uVar4;
int8 uVar5;
int iVar6;
int iVar7;
int iVar8;
int iVar9;
int iVar10;
int iVar11;
ulong uVar12;
uint uVar13;
long lVar14;
if ((int)param_3 < 1) {
return param_4;
}
if (((param_3 == 1) || ((ulong)(param_4 - (param_1 + 4)) < 9)) ||
((ulong)(param_4 - (param_2 + 4)) < 9)) {
lVar14 = 0;
do {
*(int *)(param_4 + lVar14) = *(int *)(param_1 + lVar14) - *(int *)(param_2 + lVar14);
lVar14 = lVar14 + 4;
} while (lVar14 != (long)(int)param_3 * 4);
return param_4;
}
if (param_3 - 1 < 3) {
uVar13 = 0;
}
else {
lVar14 = 0;
do {
piVar1 = (int *)(param_1 + lVar14);
iVar6 = piVar1[1];
iVar7 = piVar1[2];
iVar8 = piVar1[3];
piVar2 = (int *)(param_2 + lVar14);
iVar9 = piVar2[1];
iVar10 = piVar2[2];
iVar11 = piVar2[3];
piVar3 = (int *)(param_4 + lVar14);
*piVar3 = *piVar1 - *piVar2;
piVar3[1] = iVar6 - iVar9;
piVar3[2] = iVar7 - iVar10;
piVar3[3] = iVar8 - iVar11;
lVar14 = lVar14 + 0x10;
} while ((ulong)(param_3 >> 2) << 4 != lVar14);
uVar13 = param_3 & 0xfffffffc;
if (param_3 == uVar13) {
return param_4;
}
param_3 = param_3 - uVar13;
if (param_3 == 1) goto LAB_001011f4;
}
uVar12 = (ulong)uVar13;
uVar4 = *(int8 *)(param_1 + uVar12 * 4);
uVar5 = *(int8 *)(param_2 + uVar12 * 4);
*(ulong *)(param_4 + uVar12 * 4) =
CONCAT44((int)((ulong)uVar4 >> 0x20) - (int)((ulong)uVar5 >> 0x20),(int)uVar4 - (int)uVar5);
if ((param_3 & 1) == 0) {
return param_4;
}
uVar13 = uVar13 + (param_3 & 0xfffffffe);
LAB_001011f4:
lVar14 = (long)(int)uVar13;
*(int *)(param_4 + lVar14 * 4) = *(int *)(param_1 + lVar14 * 4) - *(int *)(param_2 + lVar14 * 4);
return param_4;
} |
5,024 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int n) {
int i, temp, count;
for (i = 0; i < 10; i++) {
temp = n;
count = 0;
while (temp > 0) {
if (temp % 10 == i) {
count++;
}
if (count > i) {
return false;
}
temp /= 10;
}
}
return true;
}
| int main() {
assert(func0(1234) == true);
assert(func0(51241) == false);
assert(func0(321) == true);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %edi,-0x14(%rbp)
movl $0x0,-0xc(%rbp)
jmp 11d6 <func0+0x8d>
mov -0x14(%rbp),%eax
mov %eax,-0x8(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11cc <func0+0x83>
mov -0x8(%rbp),%ecx
movslq %ecx,%rax
imul $0x66666667,%rax,%rax
shr $0x20,%rax
mov %eax,%edx
sar $0x2,%edx
mov %ecx,%eax
sar $0x1f,%eax
sub %eax,%edx
mov %edx,%eax
shl $0x2,%eax
add %edx,%eax
add %eax,%eax
sub %eax,%ecx
mov %ecx,%edx
cmp %edx,-0xc(%rbp)
jne 119f <func0+0x56>
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0xc(%rbp),%eax
jle 11ae <func0+0x65>
mov $0x0,%eax
jmp 11e1 <func0+0x98>
mov -0x8(%rbp),%eax
movslq %eax,%rdx
imul $0x66666667,%rdx,%rdx
shr $0x20,%rdx
sar $0x2,%edx
sar $0x1f,%eax
sub %eax,%edx
mov %edx,%eax
mov %eax,-0x8(%rbp)
cmpl $0x0,-0x8(%rbp)
jg 116c <func0+0x23>
addl $0x1,-0xc(%rbp)
cmpl $0x9,-0xc(%rbp)
jle 115d <func0+0x14>
mov $0x1,%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_14], edi
mov [rbp+var_C], 0
jmp short loc_11D6
loc_115D:
mov eax, [rbp+var_14]
mov [rbp+var_8], eax
mov [rbp+var_4], 0
jmp short loc_11CC
loc_116C:
mov ecx, [rbp+var_8]
movsxd rax, ecx
imul rax, 66666667h
shr rax, 20h
mov edx, eax
sar edx, 2
mov eax, ecx
sar eax, 1Fh
sub edx, eax
mov eax, edx
shl eax, 2
add eax, edx
add eax, eax
sub ecx, eax
mov edx, ecx
cmp [rbp+var_C], edx
jnz short loc_119F
add [rbp+var_4], 1
loc_119F:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_C]
jle short loc_11AE
mov eax, 0
jmp short loc_11E1
loc_11AE:
mov eax, [rbp+var_8]
movsxd rdx, eax
imul rdx, 66666667h
shr rdx, 20h
mov ecx, edx
sar ecx, 2
cdq
mov eax, ecx
sub eax, edx
mov [rbp+var_8], eax
loc_11CC:
cmp [rbp+var_8], 0
jg short loc_116C
add [rbp+var_C], 1
loc_11D6:
cmp [rbp+var_C], 9
jle short loc_115D
mov eax, 1
loc_11E1:
pop rbp
retn | long long func0(int a1)
{
int i; // [rsp+8h] [rbp-Ch]
int v3; // [rsp+Ch] [rbp-8h]
int v4; // [rsp+10h] [rbp-4h]
for ( i = 0; i <= 9; ++i )
{
v3 = a1;
v4 = 0;
while ( v3 > 0 )
{
if ( i == v3 % 10 )
++v4;
if ( v4 > i )
return 0LL;
v3 /= 10;
}
}
return 1LL;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV dword ptr [RBP + -0x14],EDI
MOV dword ptr [RBP + -0xc],0x0
JMP 0x001011d6
LAB_0010115d:
MOV EAX,dword ptr [RBP + -0x14]
MOV dword ptr [RBP + -0x8],EAX
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011cc
LAB_0010116c:
MOV ECX,dword ptr [RBP + -0x8]
MOVSXD RAX,ECX
IMUL RAX,RAX,0x66666667
SHR RAX,0x20
MOV EDX,EAX
SAR EDX,0x2
MOV EAX,ECX
SAR EAX,0x1f
SUB EDX,EAX
MOV EAX,EDX
SHL EAX,0x2
ADD EAX,EDX
ADD EAX,EAX
SUB ECX,EAX
MOV EDX,ECX
CMP dword ptr [RBP + -0xc],EDX
JNZ 0x0010119f
ADD dword ptr [RBP + -0x4],0x1
LAB_0010119f:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0xc]
JLE 0x001011ae
MOV EAX,0x0
JMP 0x001011e1
LAB_001011ae:
MOV EAX,dword ptr [RBP + -0x8]
MOVSXD RDX,EAX
IMUL RDX,RDX,0x66666667
SHR RDX,0x20
MOV ECX,EDX
SAR ECX,0x2
CDQ
MOV EAX,ECX
SUB EAX,EDX
MOV dword ptr [RBP + -0x8],EAX
LAB_001011cc:
CMP dword ptr [RBP + -0x8],0x0
JG 0x0010116c
ADD dword ptr [RBP + -0xc],0x1
LAB_001011d6:
CMP dword ptr [RBP + -0xc],0x9
JLE 0x0010115d
MOV EAX,0x1
LAB_001011e1:
POP RBP
RET | int8 func0(int param_1)
{
int local_14;
int local_10;
int local_c;
local_14 = 0;
do {
if (9 < local_14) {
return 1;
}
local_c = 0;
for (local_10 = param_1; 0 < local_10; local_10 = local_10 / 10) {
if (local_14 == local_10 % 10) {
local_c = local_c + 1;
}
if (local_14 < local_c) {
return 0;
}
}
local_14 = local_14 + 1;
} while( true );
} |
5,025 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int n) {
int i, temp, count;
for (i = 0; i < 10; i++) {
temp = n;
count = 0;
while (temp > 0) {
if (temp % 10 == i) {
count++;
}
if (count > i) {
return false;
}
temp /= 10;
}
}
return true;
}
| int main() {
assert(func0(1234) == true);
assert(func0(51241) == false);
assert(func0(321) == true);
return 0;
}
| O1 | c | func0:
endbr64
mov $0x0,%esi
mov %edi,%r8d
mov %r8d,%edx
mov $0x0,%ecx
test %edi,%edi
jg 1165 <func0+0x1c>
jmp 11b4 <func0+0x6b>
mov %eax,%edx
movslq %edx,%rax
imul $0x66666667,%rax,%rax
sar $0x22,%rax
mov %edx,%r9d
sar $0x1f,%r9d
sub %r9d,%eax
lea (%rax,%rax,4),%eax
add %eax,%eax
mov %edx,%r10d
sub %eax,%r10d
cmp %esi,%r10d
sete %al
movzbl %al,%eax
add %eax,%ecx
cmp %esi,%ecx
jg 11c2 <func0+0x79>
movslq %edx,%rax
imul $0x66666667,%rax,%rax
sar $0x22,%rax
mov %edx,%r9d
sar $0x1f,%r9d
sub %r9d,%eax
cmp $0x9,%edx
jg 1163 <func0+0x1a>
add $0x1,%esi
cmp $0xa,%esi
jne 1155 <func0+0xc>
mov $0x1,%eax
retq
mov $0x0,%eax
retq
| func0:
endbr64
mov esi, 0
loc_1152:
mov edx, edi
mov ecx, 0
test edi, edi
jg short loc_1161
jmp short loc_11B0
loc_115F:
mov edx, eax
loc_1161:
movsxd rax, edx
imul rax, 66666667h
sar rax, 22h
mov r8d, edx
sar r8d, 1Fh
sub eax, r8d
lea eax, [rax+rax*4]
add eax, eax
mov r8d, edx
sub r8d, eax
cmp r8d, esi
setz al
movzx eax, al
add ecx, eax
cmp ecx, esi
jg short loc_11BE
movsxd rax, edx
imul rax, 66666667h
sar rax, 22h
mov r8d, edx
sar r8d, 1Fh
sub eax, r8d
cmp edx, 9
jg short loc_115F
loc_11B0:
add esi, 1
cmp esi, 0Ah
jnz short loc_1152
mov eax, 1
retn
loc_11BE:
mov eax, 0
retn | long long func0(int a1)
{
int v1; // esi
int v2; // edx
int v3; // ecx
v1 = 0;
while ( 1 )
{
v2 = a1;
v3 = 0;
if ( a1 > 0 )
break;
LABEL_7:
if ( ++v1 == 10 )
return 1LL;
}
while ( 1 )
{
v3 += v2 % 10 == v1;
if ( v3 > v1 )
return 0LL;
if ( v2 <= 9 )
goto LABEL_7;
v2 /= 10;
}
} | func0:
ENDBR64
MOV ESI,0x0
LAB_00101152:
MOV EDX,EDI
MOV ECX,0x0
TEST EDI,EDI
JG 0x00101161
JMP 0x001011b0
LAB_0010115f:
MOV EDX,EAX
LAB_00101161:
MOVSXD RAX,EDX
IMUL RAX,RAX,0x66666667
SAR RAX,0x22
MOV R8D,EDX
SAR R8D,0x1f
SUB EAX,R8D
LEA EAX,[RAX + RAX*0x4]
ADD EAX,EAX
MOV R8D,EDX
SUB R8D,EAX
CMP R8D,ESI
SETZ AL
MOVZX EAX,AL
ADD ECX,EAX
CMP ECX,ESI
JG 0x001011be
MOVSXD RAX,EDX
IMUL RAX,RAX,0x66666667
SAR RAX,0x22
MOV R8D,EDX
SAR R8D,0x1f
SUB EAX,R8D
CMP EDX,0x9
JG 0x0010115f
LAB_001011b0:
ADD ESI,0x1
CMP ESI,0xa
JNZ 0x00101152
MOV EAX,0x1
RET
LAB_001011be:
MOV EAX,0x0
RET | int8 func0(int param_1)
{
bool bVar1;
int iVar2;
int iVar3;
int iVar4;
iVar4 = 0;
do {
iVar2 = 0;
iVar3 = param_1;
if (0 < param_1) {
do {
iVar2 = iVar2 + (uint)(iVar3 % 10 == iVar4);
if (iVar4 < iVar2) {
return 0;
}
bVar1 = 9 < iVar3;
iVar3 = iVar3 / 10;
} while (bVar1);
}
iVar4 = iVar4 + 1;
} while (iVar4 != 10);
return 1;
} |
5,026 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int n) {
int i, temp, count;
for (i = 0; i < 10; i++) {
temp = n;
count = 0;
while (temp > 0) {
if (temp % 10 == i) {
count++;
}
if (count > i) {
return false;
}
temp /= 10;
}
}
return true;
}
| int main() {
assert(func0(1234) == true);
assert(func0(51241) == false);
assert(func0(321) == true);
return 0;
}
| O2 | c | func0:
endbr64
xor %r8d,%r8d
mov $0xcccccccd,%r9d
mov %edi,%ecx
xor %esi,%esi
test %edi,%edi
jg 12f7 <func0+0x27>
jmp 1320 <func0+0x50>
nopw 0x0(%rax,%rax,1)
cmp $0x9,%ecx
jle 1320 <func0+0x50>
mov %eax,%ecx
mov %ecx,%eax
mov %ecx,%r10d
imul %r9,%rax
shr $0x23,%rax
lea (%rax,%rax,4),%edx
add %edx,%edx
sub %edx,%r10d
cmp %r8d,%r10d
sete %dl
movzbl %dl,%edx
add %edx,%esi
cmp %r8d,%esi
jle 12f0 <func0+0x20>
xor %eax,%eax
retq
add $0x1,%r8d
cmp $0xa,%r8d
jne 12dd <func0+0xd>
mov $0x1,%eax
retq
| func0:
endbr64
xor r8d, r8d
mov r10d, 0CCCCCCCDh
loc_11FD:
mov ecx, edi
xor esi, esi
test edi, edi
jg short loc_1217
jmp short loc_1240
loc_1210:
cmp ecx, 9
jle short loc_1240
mov ecx, eax
loc_1217:
mov eax, ecx
mov r9d, ecx
imul rax, r10
shr rax, 23h
lea edx, [rax+rax*4]
add edx, edx
sub r9d, edx
xor edx, edx
cmp r9d, r8d
setz dl
add esi, edx
cmp esi, r8d
jle short loc_1210
xor eax, eax
retn
loc_1240:
add r8d, 1
cmp r8d, 0Ah
jnz short loc_11FD
mov eax, 1
retn | long long func0(int a1)
{
int v1; // r8d
int v2; // ecx
int v3; // esi
v1 = 0;
while ( 1 )
{
v2 = a1;
v3 = 0;
if ( a1 > 0 )
break;
LABEL_8:
if ( ++v1 == 10 )
return 1LL;
}
while ( 1 )
{
v3 += v2 % 0xAu == v1;
if ( v3 > v1 )
return 0LL;
if ( v2 <= 9 )
goto LABEL_8;
v2 /= 0xAu;
}
} | func0:
ENDBR64
XOR R8D,R8D
MOV R10D,0xcccccccd
LAB_001011fd:
MOV ECX,EDI
XOR ESI,ESI
TEST EDI,EDI
JG 0x00101217
JMP 0x00101240
LAB_00101210:
CMP ECX,0x9
JLE 0x00101240
MOV ECX,EAX
LAB_00101217:
MOV EAX,ECX
MOV R9D,ECX
IMUL RAX,R10
SHR RAX,0x23
LEA EDX,[RAX + RAX*0x4]
ADD EDX,EDX
SUB R9D,EDX
XOR EDX,EDX
CMP R9D,R8D
SETZ DL
ADD ESI,EDX
CMP ESI,R8D
JLE 0x00101210
XOR EAX,EAX
RET
LAB_00101240:
ADD R8D,0x1
CMP R8D,0xa
JNZ 0x001011fd
MOV EAX,0x1
RET | int8 func0(uint param_1)
{
bool bVar1;
uint uVar2;
int iVar3;
uint uVar4;
uVar4 = 0;
do {
iVar3 = 0;
uVar2 = param_1;
if (0 < (int)param_1) {
do {
iVar3 = iVar3 + (uint)(uVar2 % 10 == uVar4);
if ((int)uVar4 < iVar3) {
return 0;
}
bVar1 = 9 < (int)uVar2;
uVar2 = uVar2 / 10;
} while (bVar1);
}
uVar4 = uVar4 + 1;
} while (uVar4 != 10);
return 1;
} |
5,027 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int n) {
int i, temp, count;
for (i = 0; i < 10; i++) {
temp = n;
count = 0;
while (temp > 0) {
if (temp % 10 == i) {
count++;
}
if (count > i) {
return false;
}
temp /= 10;
}
}
return true;
}
| int main() {
assert(func0(1234) == true);
assert(func0(51241) == false);
assert(func0(321) == true);
return 0;
}
| O3 | c | func0:
endbr64
xor %r8d,%r8d
mov $0xcccccccd,%r9d
mov %edi,%ecx
xor %esi,%esi
test %edi,%edi
jg 1207 <func0+0x27>
jmp 1230 <func0+0x50>
nopw 0x0(%rax,%rax,1)
cmp $0x9,%ecx
jle 1230 <func0+0x50>
mov %eax,%ecx
mov %ecx,%eax
mov %ecx,%r10d
imul %r9,%rax
shr $0x23,%rax
lea (%rax,%rax,4),%edx
add %edx,%edx
sub %edx,%r10d
cmp %r8d,%r10d
sete %dl
movzbl %dl,%edx
add %edx,%esi
cmp %r8d,%esi
jle 1200 <func0+0x20>
xor %eax,%eax
retq
add $0x1,%r8d
cmp $0xa,%r8d
jne 11ed <func0+0xd>
mov $0x1,%eax
retq
| func0:
endbr64
xor r8d, r8d
loc_11C7:
test edi, edi
jle short loc_1220
mov r10d, 0CCCCCCCDh
loc_11D1:
mov ecx, edi
xor esi, esi
jmp short loc_11E7
loc_11E0:
cmp ecx, 9
jle short loc_1210
mov ecx, eax
loc_11E7:
mov eax, ecx
mov r9d, ecx
imul rax, r10
shr rax, 23h
lea edx, [rax+rax*4]
add edx, edx
sub r9d, edx
xor edx, edx
cmp r9d, r8d
setz dl
add esi, edx
cmp r8d, esi
jge short loc_11E0
xor eax, eax
retn
loc_1210:
add r8d, 1
cmp r8d, 0Ah
jnz short loc_11D1
loc_121A:
mov eax, 1
retn
loc_1220:
add r8d, 1
cmp r8d, 0Ah
jnz short loc_11C7
jmp short loc_121A | long long func0(int a1)
{
int v1; // r8d
int v2; // ecx
int v3; // esi
v1 = 0;
while ( a1 <= 0 )
{
if ( ++v1 == 10 )
return 1LL;
}
do
{
v2 = a1;
v3 = 0;
while ( 1 )
{
v3 += v2 % 0xAu == v1;
if ( v1 < v3 )
return 0LL;
if ( v2 <= 9 )
break;
v2 /= 0xAu;
}
++v1;
}
while ( v1 != 10 );
return 1LL;
} | func0:
ENDBR64
XOR R8D,R8D
LAB_001011c7:
TEST EDI,EDI
JLE 0x00101220
MOV R10D,0xcccccccd
LAB_001011d1:
MOV ECX,EDI
XOR ESI,ESI
JMP 0x001011e7
LAB_001011e0:
CMP ECX,0x9
JLE 0x00101210
MOV ECX,EAX
LAB_001011e7:
MOV EAX,ECX
MOV R9D,ECX
IMUL RAX,R10
SHR RAX,0x23
LEA EDX,[RAX + RAX*0x4]
ADD EDX,EDX
SUB R9D,EDX
XOR EDX,EDX
CMP R9D,R8D
SETZ DL
ADD ESI,EDX
CMP R8D,ESI
JGE 0x001011e0
XOR EAX,EAX
RET
LAB_00101210:
ADD R8D,0x1
CMP R8D,0xa
JNZ 0x001011d1
LAB_0010121a:
MOV EAX,0x1
RET
LAB_00101220:
ADD R8D,0x1
CMP R8D,0xa
JNZ 0x001011c7
JMP 0x0010121a | int8 func0(uint param_1)
{
bool bVar1;
uint uVar2;
int iVar3;
uint uVar4;
uVar4 = 0;
do {
if (0 < (int)param_1) {
do {
iVar3 = 0;
uVar2 = param_1;
do {
iVar3 = iVar3 + (uint)(uVar2 % 10 == uVar4);
if ((int)uVar4 < iVar3) {
return 0;
}
bVar1 = 9 < (int)uVar2;
uVar2 = uVar2 / 10;
} while (bVar1);
uVar4 = uVar4 + 1;
} while (uVar4 != 10);
return 1;
}
uVar4 = uVar4 + 1;
} while (uVar4 != 10);
return 1;
} |
5,028 | func0 |
#include <assert.h>
#include <stdbool.h>
#include <string.h>
typedef enum { INT_TYPE, STRING_TYPE } ElementType;
typedef struct {
ElementType type;
union {
int int_val;
const char* str_val;
} value;
} Element;
| bool func0(Element list[], int size, Element element) {
for(int i = 0; i < size; i++) {
if(list[i].type != element.type){
return false;
}
if(element.type == INT_TYPE){
if(list[i].value.int_val != element.value.int_val){
return false;
}
} else if(element.type == STRING_TYPE){
if(strcmp(list[i].value.str_val, element.value.str_val) != 0){
return false;
}
}
}
return true;
}
| int main() {
Element list1[] = {
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "orange"},
{STRING_TYPE, .value.str_val = "black"},
{STRING_TYPE, .value.str_val = "white"}
};
Element element1 = {STRING_TYPE, .value.str_val = "blue"};
assert(func0(list1, 4, element1) == false);
Element list2[] = {
{INT_TYPE, .value.int_val = 1},
{INT_TYPE, .value.int_val = 2},
{INT_TYPE, .value.int_val = 3},
{INT_TYPE, .value.int_val = 4}
};
Element element2 = {INT_TYPE, .value.int_val = 7};
assert(func0(list2, 4, element2) == false);
Element list3[] = {
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"}
};
Element element3 = {STRING_TYPE, .value.str_val = "green"};
assert(func0(list3, 4, element3) == true);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x30,%rsp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov %edx,%eax
mov %rcx,%rdx
mov %rax,-0x30(%rbp)
mov %rdx,-0x28(%rbp)
movl $0x0,-0x4(%rbp)
jmpq 1240 <func0+0xb7>
mov -0x4(%rbp),%eax
cltq
shl $0x4,%rax
mov %rax,%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%edx
mov -0x30(%rbp),%eax
cmp %eax,%edx
je 11d8 <func0+0x4f>
mov $0x0,%eax
jmp 1251 <func0+0xc8>
mov -0x30(%rbp),%eax
test %eax,%eax
jne 1203 <func0+0x7a>
mov -0x4(%rbp),%eax
cltq
shl $0x4,%rax
mov %rax,%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov 0x8(%rax),%edx
mov -0x28(%rbp),%eax
cmp %eax,%edx
je 123c <func0+0xb3>
mov $0x0,%eax
jmp 1251 <func0+0xc8>
mov -0x30(%rbp),%eax
cmp $0x1,%eax
jne 123c <func0+0xb3>
mov -0x28(%rbp),%rdx
mov -0x4(%rbp),%eax
cltq
shl $0x4,%rax
mov %rax,%rcx
mov -0x18(%rbp),%rax
add %rcx,%rax
mov 0x8(%rax),%rax
mov %rdx,%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
je 123c <func0+0xb3>
mov $0x0,%eax
jmp 1251 <func0+0xc8>
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 11b5 <func0+0x2c>
mov $0x1,%eax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 30h
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov eax, edx
mov rdx, rcx
mov [rbp+var_30], rax
mov [rbp+s2], rdx
mov [rbp+var_4], 0
jmp loc_1240
loc_11B5:
mov eax, [rbp+var_4]
cdqe
shl rax, 4
mov rdx, rax
mov rax, [rbp+var_18]
add rax, rdx
mov edx, [rax]
mov eax, dword ptr [rbp+var_30]
cmp edx, eax
jz short loc_11D8
mov eax, 0
jmp short locret_1251
loc_11D8:
mov eax, dword ptr [rbp+var_30]
test eax, eax
jnz short loc_1203
mov eax, [rbp+var_4]
cdqe
shl rax, 4
mov rdx, rax
mov rax, [rbp+var_18]
add rax, rdx
mov edx, [rax+8]
mov eax, dword ptr [rbp+s2]
cmp edx, eax
jz short loc_123C
mov eax, 0
jmp short locret_1251
loc_1203:
mov eax, dword ptr [rbp+var_30]
cmp eax, 1
jnz short loc_123C
mov rdx, [rbp+s2]
mov eax, [rbp+var_4]
cdqe
shl rax, 4
mov rcx, rax
mov rax, [rbp+var_18]
add rax, rcx
mov rax, [rax+8]
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jz short loc_123C
mov eax, 0
jmp short locret_1251
loc_123C:
add [rbp+var_4], 1
loc_1240:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl loc_11B5
mov eax, 1
locret_1251:
leave
retn | long long func0(long long a1, int a2, int a3, const char *a4)
{
int i; // [rsp+2Ch] [rbp-4h]
for ( i = 0; i < a2; ++i )
{
if ( *(_DWORD *)(16LL * i + a1) != a3 )
return 0LL;
if ( a3 )
{
if ( a3 == 1 && strcmp(*(const char **)(16LL * i + a1 + 8), a4) )
return 0LL;
}
else if ( *(_DWORD *)(16LL * i + a1 + 8) != (_DWORD)a4 )
{
return 0LL;
}
}
return 1LL;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x30
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV EAX,EDX
MOV RDX,RCX
MOV qword ptr [RBP + -0x30],RAX
MOV qword ptr [RBP + -0x28],RDX
MOV dword ptr [RBP + -0x4],0x0
JMP 0x00101240
LAB_001011b5:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
SHL RAX,0x4
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x30]
CMP EDX,EAX
JZ 0x001011d8
MOV EAX,0x0
JMP 0x00101251
LAB_001011d8:
MOV EAX,dword ptr [RBP + -0x30]
TEST EAX,EAX
JNZ 0x00101203
MOV EAX,dword ptr [RBP + -0x4]
CDQE
SHL RAX,0x4
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EDX,dword ptr [RAX + 0x8]
MOV EAX,dword ptr [RBP + -0x28]
CMP EDX,EAX
JZ 0x0010123c
MOV EAX,0x0
JMP 0x00101251
LAB_00101203:
MOV EAX,dword ptr [RBP + -0x30]
CMP EAX,0x1
JNZ 0x0010123c
MOV RDX,qword ptr [RBP + -0x28]
MOV EAX,dword ptr [RBP + -0x4]
CDQE
SHL RAX,0x4
MOV RCX,RAX
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RCX
MOV RAX,qword ptr [RAX + 0x8]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JZ 0x0010123c
MOV EAX,0x0
JMP 0x00101251
LAB_0010123c:
ADD dword ptr [RBP + -0x4],0x1
LAB_00101240:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x001011b5
MOV EAX,0x1
LAB_00101251:
LEAVE
RET | int8 func0(long param_1,int param_2,int param_3,char *param_4)
{
int iVar1;
int local_30;
int local_c;
local_c = 0;
while( true ) {
if (param_2 <= local_c) {
return 1;
}
if (*(int *)(param_1 + (long)local_c * 0x10) != param_3) break;
if (param_3 == 0) {
local_30 = (int)param_4;
if (*(int *)(param_1 + (long)local_c * 0x10 + 8) != local_30) {
return 0;
}
}
else if ((param_3 == 1) &&
(iVar1 = strcmp(*(char **)(param_1 + (long)local_c * 0x10 + 8),param_4), iVar1 != 0)) {
return 0;
}
local_c = local_c + 1;
}
return 0;
} |
5,029 | func0 |
#include <assert.h>
#include <stdbool.h>
#include <string.h>
typedef enum { INT_TYPE, STRING_TYPE } ElementType;
typedef struct {
ElementType type;
union {
int int_val;
const char* str_val;
} value;
} Element;
| bool func0(Element list[], int size, Element element) {
for(int i = 0; i < size; i++) {
if(list[i].type != element.type){
return false;
}
if(element.type == INT_TYPE){
if(list[i].value.int_val != element.value.int_val){
return false;
}
} else if(element.type == STRING_TYPE){
if(strcmp(list[i].value.str_val, element.value.str_val) != 0){
return false;
}
}
}
return true;
}
| int main() {
Element list1[] = {
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "orange"},
{STRING_TYPE, .value.str_val = "black"},
{STRING_TYPE, .value.str_val = "white"}
};
Element element1 = {STRING_TYPE, .value.str_val = "blue"};
assert(func0(list1, 4, element1) == false);
Element list2[] = {
{INT_TYPE, .value.int_val = 1},
{INT_TYPE, .value.int_val = 2},
{INT_TYPE, .value.int_val = 3},
{INT_TYPE, .value.int_val = 4}
};
Element element2 = {INT_TYPE, .value.int_val = 7};
assert(func0(list2, 4, element2) == false);
Element list3[] = {
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"}
};
Element element3 = {STRING_TYPE, .value.str_val = "green"};
assert(func0(list3, 4, element3) == true);
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 11f3 <func0+0x6a>
push %r14
push %r13
push %r12
push %rbp
push %rbx
mov %rcx,%r13
mov %edx,%ebp
mov %rcx,%r14
lea 0x8(%rdi),%rbx
lea -0x1(%rsi),%eax
shl $0x4,%rax
lea 0x18(%rdi,%rax,1),%r12
jmp 11c1 <func0+0x38>
cmp $0x1,%ebp
je 11d6 <func0+0x4d>
add $0x10,%rbx
cmp %r12,%rbx
je 11ec <func0+0x63>
cmp %ebp,-0x8(%rbx)
jne 11f9 <func0+0x70>
test %ebp,%ebp
jne 11b3 <func0+0x2a>
cmp %r13d,(%rbx)
je 11b8 <func0+0x2f>
mov $0x0,%eax
jmp 11fe <func0+0x75>
mov %r14,%rsi
mov (%rbx),%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
je 11b8 <func0+0x2f>
mov $0x0,%eax
jmp 11fe <func0+0x75>
mov $0x1,%eax
jmp 11fe <func0+0x75>
mov $0x1,%eax
retq
mov $0x0,%eax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
retq
| func0:
endbr64
test esi, esi
jle short loc_11F3
push r14
push r13
push r12
push rbp
push rbx
mov r14, rcx
mov ebp, edx
mov r13d, ecx
lea rbx, [rdi+8]
lea eax, [rsi-1]
shl rax, 4
lea r12, [rdi+rax+18h]
jmp short loc_11C1
loc_11B3:
cmp ebp, 1
jz short loc_11D6
loc_11B8:
add rbx, 10h
cmp rbx, r12
jz short loc_11EC
loc_11C1:
cmp [rbx-8], ebp
jnz short loc_11F9
test ebp, ebp
jnz short loc_11B3
cmp [rbx], r13d
jz short loc_11B8
mov eax, 0
jmp short loc_11FE
loc_11D6:
mov rsi, r14
mov rdi, [rbx]
call _strcmp
test eax, eax
jz short loc_11B8
mov eax, 0
jmp short loc_11FE
loc_11EC:
mov eax, 1
jmp short loc_11FE
loc_11F3:
mov eax, 1
retn
loc_11F9:
mov eax, 0
loc_11FE:
pop rbx
pop rbp
pop r12
pop r13
pop r14
retn | long long func0(long long a1, int a2, int a3, long long a4)
{
int v6; // r13d
_QWORD *v7; // rbx
if ( a2 <= 0 )
return 1LL;
v6 = a4;
v7 = (_QWORD *)(a1 + 8);
while ( *((_DWORD *)v7 - 2) == a3 )
{
if ( a3 )
{
if ( a3 == 1 && (unsigned int)strcmp(*v7, a4) )
return 0LL;
}
else if ( *(_DWORD *)v7 != v6 )
{
return 0LL;
}
v7 += 2;
if ( v7 == (_QWORD *)(a1 + 16LL * (unsigned int)(a2 - 1) + 24) )
return 1LL;
}
return 0LL;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001011f3
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
MOV R14,RCX
MOV EBP,EDX
MOV R13D,ECX
LEA RBX,[RDI + 0x8]
LEA EAX,[RSI + -0x1]
SHL RAX,0x4
LEA R12,[RDI + RAX*0x1 + 0x18]
JMP 0x001011c1
LAB_001011b3:
CMP EBP,0x1
JZ 0x001011d6
LAB_001011b8:
ADD RBX,0x10
CMP RBX,R12
JZ 0x001011ec
LAB_001011c1:
CMP dword ptr [RBX + -0x8],EBP
JNZ 0x001011f9
TEST EBP,EBP
JNZ 0x001011b3
CMP dword ptr [RBX],R13D
JZ 0x001011b8
MOV EAX,0x0
JMP 0x001011fe
LAB_001011d6:
MOV RSI,R14
MOV RDI,qword ptr [RBX]
CALL 0x00101090
TEST EAX,EAX
JZ 0x001011b8
MOV EAX,0x0
JMP 0x001011fe
LAB_001011ec:
MOV EAX,0x1
JMP 0x001011fe
LAB_001011f3:
MOV EAX,0x1
RET
LAB_001011f9:
MOV EAX,0x0
LAB_001011fe:
POP RBX
POP RBP
POP R12
POP R13
POP R14
RET | int8 func0(long param_1,int param_2,int param_3,char *param_4)
{
int iVar1;
int *piVar2;
if (param_2 < 1) {
return 1;
}
piVar2 = (int *)(param_1 + 8);
do {
if (piVar2[-2] != param_3) {
return 0;
}
if (param_3 == 0) {
if (*piVar2 != (int)param_4) {
return 0;
}
}
else if ((param_3 == 1) && (iVar1 = strcmp(*(char **)piVar2,param_4), iVar1 != 0)) {
return 0;
}
piVar2 = piVar2 + 4;
if (piVar2 == (int *)(param_1 + 0x18 + (ulong)(param_2 - 1) * 0x10)) {
return 1;
}
} while( true );
} |
5,030 | func0 |
#include <assert.h>
#include <stdbool.h>
#include <string.h>
typedef enum { INT_TYPE, STRING_TYPE } ElementType;
typedef struct {
ElementType type;
union {
int int_val;
const char* str_val;
} value;
} Element;
| bool func0(Element list[], int size, Element element) {
for(int i = 0; i < size; i++) {
if(list[i].type != element.type){
return false;
}
if(element.type == INT_TYPE){
if(list[i].value.int_val != element.value.int_val){
return false;
}
} else if(element.type == STRING_TYPE){
if(strcmp(list[i].value.str_val, element.value.str_val) != 0){
return false;
}
}
}
return true;
}
| int main() {
Element list1[] = {
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "orange"},
{STRING_TYPE, .value.str_val = "black"},
{STRING_TYPE, .value.str_val = "white"}
};
Element element1 = {STRING_TYPE, .value.str_val = "blue"};
assert(func0(list1, 4, element1) == false);
Element list2[] = {
{INT_TYPE, .value.int_val = 1},
{INT_TYPE, .value.int_val = 2},
{INT_TYPE, .value.int_val = 3},
{INT_TYPE, .value.int_val = 4}
};
Element element2 = {INT_TYPE, .value.int_val = 7};
assert(func0(list2, 4, element2) == false);
Element list3[] = {
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"}
};
Element element3 = {STRING_TYPE, .value.str_val = "green"};
assert(func0(list3, 4, element3) == true);
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 13ee <func0+0x7e>
lea -0x1(%rsi),%eax
push %r14
mov %rcx,%r14
shl $0x4,%rax
push %r13
mov %ecx,%r13d
push %r12
lea 0x18(%rdi,%rax,1),%r12
push %rbp
mov %edx,%ebp
push %rbx
lea 0x8(%rdi),%rbx
jmp 13ae <func0+0x3e>
nopw 0x0(%rax,%rax,1)
cmp %r13d,(%rbx)
jne 13cb <func0+0x5b>
add $0x10,%rbx
cmp %r12,%rbx
je 13e0 <func0+0x70>
cmp %ebp,-0x8(%rbx)
jne 13cb <func0+0x5b>
test %ebp,%ebp
je 13a0 <func0+0x30>
cmp $0x1,%ebp
jne 13a5 <func0+0x35>
mov (%rbx),%rdi
mov %r14,%rsi
callq 1090 <strcmp@plt>
test %eax,%eax
je 13a5 <func0+0x35>
pop %rbx
xor %eax,%eax
pop %rbp
pop %r12
pop %r13
pop %r14
retq
nopw %cs:0x0(%rax,%rax,1)
pop %rbx
mov $0x1,%eax
pop %rbp
pop %r12
pop %r13
pop %r14
retq
mov $0x1,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
xchg %ax,%ax
| func0:
endbr64
test esi, esi
jle short loc_13EE
lea eax, [rsi-1]
push r14
mov r14, rcx
shl rax, 4
push r13
mov r13d, ecx
push r12
lea r12, [rdi+rax+18h]
push rbp
mov ebp, edx
push rbx
lea rbx, [rdi+8]
jmp short loc_13AE
loc_13A0:
cmp [rbx], r13d
jnz short loc_13CB
loc_13A5:
add rbx, 10h
cmp rbx, r12
jz short loc_13E0
loc_13AE:
cmp [rbx-8], ebp
jnz short loc_13CB
test ebp, ebp
jz short loc_13A0
cmp ebp, 1
jnz short loc_13A5
mov rdi, [rbx]
mov rsi, r14
call _strcmp
test eax, eax
jz short loc_13A5
loc_13CB:
pop rbx
xor eax, eax
pop rbp
pop r12
pop r13
pop r14
retn
loc_13E0:
pop rbx
mov eax, 1
pop rbp
pop r12
pop r13
pop r14
retn
loc_13EE:
mov eax, 1
retn | long long func0(long long a1, int a2, int a3, long long a4)
{
int v5; // r13d
_QWORD *v7; // rbx
if ( a2 <= 0 )
return 1LL;
v5 = a4;
v7 = (_QWORD *)(a1 + 8);
do
{
if ( *((_DWORD *)v7 - 2) != a3 )
return 0LL;
if ( a3 )
{
if ( a3 == 1 && (unsigned int)strcmp(*v7, a4) )
return 0LL;
}
else if ( *(_DWORD *)v7 != v5 )
{
return 0LL;
}
v7 += 2;
}
while ( v7 != (_QWORD *)(a1 + 16LL * (unsigned int)(a2 - 1) + 24) );
return 1LL;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001013ee
LEA EAX,[RSI + -0x1]
PUSH R14
MOV R14,RCX
SHL RAX,0x4
PUSH R13
MOV R13D,ECX
PUSH R12
LEA R12,[RDI + RAX*0x1 + 0x18]
PUSH RBP
MOV EBP,EDX
PUSH RBX
LEA RBX,[RDI + 0x8]
JMP 0x001013ae
LAB_001013a0:
CMP dword ptr [RBX],R13D
JNZ 0x001013cb
LAB_001013a5:
ADD RBX,0x10
CMP RBX,R12
JZ 0x001013e0
LAB_001013ae:
CMP dword ptr [RBX + -0x8],EBP
JNZ 0x001013cb
TEST EBP,EBP
JZ 0x001013a0
CMP EBP,0x1
JNZ 0x001013a5
MOV RDI,qword ptr [RBX]
MOV RSI,R14
CALL 0x00101090
TEST EAX,EAX
JZ 0x001013a5
LAB_001013cb:
POP RBX
XOR EAX,EAX
POP RBP
POP R12
POP R13
POP R14
RET
LAB_001013e0:
POP RBX
MOV EAX,0x1
POP RBP
POP R12
POP R13
POP R14
RET
LAB_001013ee:
MOV EAX,0x1
RET | int8 func0(long param_1,int param_2,int param_3,char *param_4)
{
int iVar1;
int *piVar2;
if (param_2 < 1) {
return 1;
}
piVar2 = (int *)(param_1 + 8);
do {
if (piVar2[-2] != param_3) {
return 0;
}
if (param_3 == 0) {
if (*piVar2 != (int)param_4) {
return 0;
}
}
else if ((param_3 == 1) && (iVar1 = strcmp(*(char **)piVar2,param_4), iVar1 != 0)) {
return 0;
}
piVar2 = piVar2 + 4;
if (piVar2 == (int *)(param_1 + 0x18 + (ulong)(param_2 - 1) * 0x10)) {
return 1;
}
} while( true );
} |
5,031 | func0 |
#include <assert.h>
#include <stdbool.h>
#include <string.h>
typedef enum { INT_TYPE, STRING_TYPE } ElementType;
typedef struct {
ElementType type;
union {
int int_val;
const char* str_val;
} value;
} Element;
| bool func0(Element list[], int size, Element element) {
for(int i = 0; i < size; i++) {
if(list[i].type != element.type){
return false;
}
if(element.type == INT_TYPE){
if(list[i].value.int_val != element.value.int_val){
return false;
}
} else if(element.type == STRING_TYPE){
if(strcmp(list[i].value.str_val, element.value.str_val) != 0){
return false;
}
}
}
return true;
}
| int main() {
Element list1[] = {
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "orange"},
{STRING_TYPE, .value.str_val = "black"},
{STRING_TYPE, .value.str_val = "white"}
};
Element element1 = {STRING_TYPE, .value.str_val = "blue"};
assert(func0(list1, 4, element1) == false);
Element list2[] = {
{INT_TYPE, .value.int_val = 1},
{INT_TYPE, .value.int_val = 2},
{INT_TYPE, .value.int_val = 3},
{INT_TYPE, .value.int_val = 4}
};
Element element2 = {INT_TYPE, .value.int_val = 7};
assert(func0(list2, 4, element2) == false);
Element list3[] = {
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"},
{STRING_TYPE, .value.str_val = "green"}
};
Element element3 = {STRING_TYPE, .value.str_val = "green"};
assert(func0(list3, 4, element3) == true);
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 1418 <func0+0xa8>
push %r12
push %rbp
mov %rcx,%rbp
push %rbx
cmp $0x1,%edx
je 13e0 <func0+0x70>
lea -0x1(%rsi),%eax
shl $0x4,%rax
lea 0x10(%rdi,%rax,1),%rax
test %edx,%edx
je 13c6 <func0+0x56>
cmp (%rdi),%edx
jne 13ad <func0+0x3d>
nopl 0x0(%rax)
add $0x10,%rdi
cmp %rax,%rdi
je 13d0 <func0+0x60>
cmp (%rdi),%edx
je 13a0 <func0+0x30>
pop %rbx
xor %eax,%eax
pop %rbp
pop %r12
retq
nopl 0x0(%rax)
cmp 0x8(%rdi),%ecx
jne 13ad <func0+0x3d>
add $0x10,%rdi
cmp %rax,%rdi
je 13d0 <func0+0x60>
mov (%rdi),%edx
test %edx,%edx
je 13b8 <func0+0x48>
jmp 13ad <func0+0x3d>
xchg %ax,%ax
pop %rbx
mov $0x1,%eax
pop %rbp
pop %r12
retq
nopw 0x0(%rax,%rax,1)
lea -0x1(%rsi),%eax
mov %rdi,%rbx
shl $0x4,%rax
lea 0x10(%rdi,%rax,1),%r12
jmp 1411 <func0+0xa1>
nopl 0x0(%rax)
mov 0x8(%rbx),%rdi
mov %rbp,%rsi
callq 1090 <strcmp@plt>
test %eax,%eax
jne 13ad <func0+0x3d>
add $0x10,%rbx
cmp %r12,%rbx
je 13d0 <func0+0x60>
cmpl $0x1,(%rbx)
je 13f8 <func0+0x88>
jmp 13ad <func0+0x3d>
mov $0x1,%eax
retq
xchg %ax,%ax
| func0:
endbr64
test esi, esi
jle loc_1410
push r12
mov r12, rcx
push rbp
push rbx
test edx, edx
jz short loc_13A8
cmp edx, 1
jz short loc_13E0
movsxd rsi, esi
mov ecx, edx
shl rsi, 4
lea rax, [rdi+rsi]
jmp short loc_1399
loc_1390:
add rdi, 10h
cmp rdi, rax
jz short loc_13D0
loc_1399:
cmp ecx, [rdi]
jz short loc_1390
loc_139D:
pop rbx
xor eax, eax
pop rbp
pop r12
retn
loc_13A8:
movsxd rsi, esi
shl rsi, 4
lea rax, [rdi+rsi]
jmp short loc_13C6
loc_13B8:
cmp [rdi+8], ecx
jnz short loc_139D
add rdi, 10h
cmp rdi, rax
jz short loc_13D0
loc_13C6:
mov edx, [rdi]
test edx, edx
jz short loc_13B8
jmp short loc_139D
loc_13D0:
pop rbx
mov eax, 1
pop rbp
pop r12
retn
loc_13E0:
movsxd rsi, esi
mov rbx, rdi
shl rsi, 4
lea rbp, [rdi+rsi]
jmp short loc_1409
loc_13F0:
mov rdi, [rbx+8]; s1
mov rsi, r12; s2
call _strcmp
test eax, eax
jnz short loc_139D
add rbx, 10h
cmp rbx, rbp
jz short loc_13D0
loc_1409:
cmp dword ptr [rbx], 1
jz short loc_13F0
jmp short loc_139D
loc_1410:
mov eax, 1
retn | long long func0(const char **a1, int a2, int a3, const char *a4)
{
const char **v5; // rax
const char **v7; // rax
const char **v8; // rbx
if ( a2 <= 0 )
return 1LL;
if ( a3 )
{
if ( a3 == 1 )
{
v8 = a1;
while ( *(_DWORD *)v8 == 1 && !strcmp(v8[1], a4) )
{
v8 += 2;
if ( v8 == &a1[2 * a2] )
return 1LL;
}
}
else
{
v5 = &a1[2 * a2];
while ( a3 == *(_DWORD *)a1 )
{
a1 += 2;
if ( a1 == v5 )
return 1LL;
}
}
}
else
{
v7 = &a1[2 * a2];
while ( !*(_DWORD *)a1 && *((_DWORD *)a1 + 2) == (_DWORD)a4 )
{
a1 += 2;
if ( a1 == v7 )
return 1LL;
}
}
return 0LL;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101410
PUSH R12
MOV R12,RCX
PUSH RBP
PUSH RBX
TEST EDX,EDX
JZ 0x001013a8
CMP EDX,0x1
JZ 0x001013e0
MOVSXD RSI,ESI
MOV ECX,EDX
SHL RSI,0x4
LEA RAX,[RDI + RSI*0x1]
JMP 0x00101399
LAB_00101390:
ADD RDI,0x10
CMP RDI,RAX
JZ 0x001013d0
LAB_00101399:
CMP ECX,dword ptr [RDI]
JZ 0x00101390
LAB_0010139d:
POP RBX
XOR EAX,EAX
POP RBP
POP R12
RET
LAB_001013a8:
MOVSXD RSI,ESI
SHL RSI,0x4
LEA RAX,[RDI + RSI*0x1]
JMP 0x001013c6
LAB_001013b8:
CMP dword ptr [RDI + 0x8],ECX
JNZ 0x0010139d
ADD RDI,0x10
CMP RDI,RAX
JZ 0x001013d0
LAB_001013c6:
MOV EDX,dword ptr [RDI]
TEST EDX,EDX
JZ 0x001013b8
JMP 0x0010139d
LAB_001013d0:
POP RBX
MOV EAX,0x1
POP RBP
POP R12
RET
LAB_001013e0:
MOVSXD RSI,ESI
MOV RBX,RDI
SHL RSI,0x4
LEA RBP,[RDI + RSI*0x1]
JMP 0x00101409
LAB_001013f0:
MOV RDI,qword ptr [RBX + 0x8]
MOV RSI,R12
CALL 0x00101090
TEST EAX,EAX
JNZ 0x0010139d
ADD RBX,0x10
CMP RBX,RBP
JZ 0x001013d0
LAB_00101409:
CMP dword ptr [RBX],0x1
JZ 0x001013f0
JMP 0x0010139d
LAB_00101410:
MOV EAX,0x1
RET | int8 func0(int *param_1,int param_2,int param_3,char *param_4)
{
int *piVar1;
int iVar2;
if (param_2 < 1) {
return 1;
}
if (param_3 == 0) {
piVar1 = param_1 + (long)param_2 * 4;
do {
if (*param_1 != 0) {
return 0;
}
if (param_1[2] != (int)param_4) {
return 0;
}
param_1 = param_1 + 4;
} while (param_1 != piVar1);
}
else if (param_3 == 1) {
piVar1 = param_1 + (long)param_2 * 4;
do {
if (*param_1 != 1) {
return 0;
}
iVar2 = strcmp(*(char **)(param_1 + 2),param_4);
if (iVar2 != 0) {
return 0;
}
param_1 = param_1 + 4;
} while (param_1 != piVar1);
}
else {
piVar1 = param_1 + (long)param_2 * 4;
do {
if (param_3 != *param_1) {
return 0;
}
param_1 = param_1 + 4;
} while (param_1 != piVar1);
}
return 1;
} |
5,032 | func0 |
#include <stdio.h>
#include <regex.h>
#include <assert.h>
| char* func0(const char *text) {
regex_t regex;
int result;
char* match_result;
char* pattern = "ab{2,3}";
regcomp(®ex, pattern, REG_EXTENDED);
result = regexec(®ex, text, 0, NULL, 0);
if (result == 0) {
match_result = "Found a match!";
} else {
match_result = "Not matched!";
}
regfree(®ex);
return match_result;
}
| int main() {
assert(func0("ac") == "Not matched!");
assert(func0("dc") == "Not matched!");
assert(func0("abbbba") == "Found a match!");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
add $0xffffffffffffff80,%rsp
mov %rdi,-0x78(%rbp)
mov %fs:0x28,%rax
mov %rax,-0x8(%rbp)
xor %eax,%eax
lea 0xe19(%rip),%rax
mov %rax,-0x58(%rbp)
mov -0x58(%rbp),%rcx
lea -0x50(%rbp),%rax
mov $0x1,%edx
mov %rcx,%rsi
mov %rax,%rdi
callq 10c0 <regcomp@plt>
mov -0x78(%rbp),%rsi
lea -0x50(%rbp),%rax
mov $0x0,%r8d
mov $0x0,%ecx
mov $0x0,%edx
mov %rax,%rdi
callq 10d0 <regexec@plt>
mov %eax,-0x64(%rbp)
cmpl $0x0,-0x64(%rbp)
jne 1241 <func0+0x78>
lea 0xdd5(%rip),%rax
mov %rax,-0x60(%rbp)
jmp 124c <func0+0x83>
lea 0xdd7(%rip),%rax
mov %rax,-0x60(%rbp)
lea -0x50(%rbp),%rax
mov %rax,%rdi
callq 1090 <regfree@plt>
mov -0x60(%rbp),%rax
mov -0x8(%rbp),%rdx
xor %fs:0x28,%rdx
je 1270 <func0+0xa7>
callq 10a0 <__stack_chk_fail@plt>
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
add rsp, 0FFFFFFFFFFFFFF80h
mov [rbp+string], rdi
mov rax, fs:28h
mov [rbp+var_8], rax
xor eax, eax
lea rax, aAb23; "ab{2,3}"
mov [rbp+pattern], rax
mov rcx, [rbp+pattern]
lea rax, [rbp+preg]
mov edx, 1; cflags
mov rsi, rcx; pattern
mov rdi, rax; preg
call _regcomp
mov rsi, [rbp+string]; string
lea rax, [rbp+preg]
mov r8d, 0; eflags
mov ecx, 0; pmatch
mov edx, 0; nmatch
mov rdi, rax; preg
call _regexec
mov [rbp+var_64], eax
cmp [rbp+var_64], 0
jnz short loc_1241
lea rax, aFoundAMatch; "Found a match!"
mov [rbp+var_60], rax
jmp short loc_124C
loc_1241:
lea rax, aNotMatched; "Not matched!"
mov [rbp+var_60], rax
loc_124C:
lea rax, [rbp+preg]
mov rdi, rax; preg
call _regfree
mov rax, [rbp+var_60]
mov rdx, [rbp+var_8]
sub rdx, fs:28h
jz short locret_1270
call ___stack_chk_fail
locret_1270:
leave
retn | const char * func0(const char *a1)
{
const char *v2; // [rsp+20h] [rbp-60h]
regex_t preg; // [rsp+30h] [rbp-50h] BYREF
unsigned long long v4; // [rsp+78h] [rbp-8h]
v4 = __readfsqword(0x28u);
regcomp(&preg, "ab{2,3}", 1);
if ( regexec(&preg, a1, 0LL, 0LL, 0) )
v2 = "Not matched!";
else
v2 = "Found a match!";
regfree(&preg);
return v2;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
ADD RSP,-0x80
MOV qword ptr [RBP + -0x78],RDI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x8],RAX
XOR EAX,EAX
LEA RAX,[0x102008]
MOV qword ptr [RBP + -0x58],RAX
MOV RCX,qword ptr [RBP + -0x58]
LEA RAX,[RBP + -0x50]
MOV EDX,0x1
MOV RSI,RCX
MOV RDI,RAX
CALL 0x001010c0
MOV RSI,qword ptr [RBP + -0x78]
LEA RAX,[RBP + -0x50]
MOV R8D,0x0
MOV ECX,0x0
MOV EDX,0x0
MOV RDI,RAX
CALL 0x001010d0
MOV dword ptr [RBP + -0x64],EAX
CMP dword ptr [RBP + -0x64],0x0
JNZ 0x00101241
LEA RAX,[0x102010]
MOV qword ptr [RBP + -0x60],RAX
JMP 0x0010124c
LAB_00101241:
LEA RAX,[0x10201f]
MOV qword ptr [RBP + -0x60],RAX
LAB_0010124c:
LEA RAX,[RBP + -0x50]
MOV RDI,RAX
CALL 0x00101090
MOV RAX,qword ptr [RBP + -0x60]
MOV RDX,qword ptr [RBP + -0x8]
SUB RDX,qword ptr FS:[0x28]
JZ 0x00101270
CALL 0x001010a0
LAB_00101270:
LEAVE
RET | char * func0(char *param_1)
{
int iVar1;
long in_FS_OFFSET;
char *local_68;
regex_t local_58;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
regcomp(&local_58,"ab{2,3}",1);
iVar1 = regexec(&local_58,param_1,0,(regmatch_t *)0x0,0);
if (iVar1 == 0) {
local_68 = "Found a match!";
}
else {
local_68 = "Not matched!";
}
regfree(&local_58);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return local_68;
} |
5,033 | func0 |
#include <stdio.h>
#include <regex.h>
#include <assert.h>
| char* func0(const char *text) {
regex_t regex;
int result;
char* match_result;
char* pattern = "ab{2,3}";
regcomp(®ex, pattern, REG_EXTENDED);
result = regexec(®ex, text, 0, NULL, 0);
if (result == 0) {
match_result = "Found a match!";
} else {
match_result = "Not matched!";
}
regfree(®ex);
return match_result;
}
| int main() {
assert(func0("ac") == "Not matched!");
assert(func0("dc") == "Not matched!");
assert(func0("abbbba") == "Found a match!");
return 0;
}
| O1 | c | func0:
endbr64
push %rbp
push %rbx
sub $0x58,%rsp
mov %rdi,%rbx
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%rbp
mov $0x1,%edx
lea 0xe2b(%rip),%rsi
mov %rbp,%rdi
callq 10c0 <regcomp@plt>
mov $0x0,%r8d
mov $0x0,%ecx
mov $0x0,%edx
mov %rbx,%rsi
mov %rbp,%rdi
callq 10d0 <regexec@plt>
test %eax,%eax
lea 0xde3(%rip),%rax
lea 0xdeb(%rip),%rbx
cmove %rax,%rbx
mov %rsp,%rdi
callq 1090 <regfree@plt>
mov 0x48(%rsp),%rax
xor %fs:0x28,%rax
jne 124e <func0+0x85>
mov %rbx,%rax
add $0x58,%rsp
pop %rbx
pop %rbp
retq
callq 10a0 <__stack_chk_fail@plt>
| func0:
endbr64
push rbp
push rbx
sub rsp, 58h
mov rbx, rdi
mov rax, fs:28h
mov [rsp+var_s48], rax
xor eax, eax
mov rbp, rsp
mov edx, 1
lea rsi, aAb23; "ab{2,3}"
mov rdi, rbp
call _regcomp
mov r8d, 0
mov ecx, 0
mov edx, 0
mov rsi, rbx
mov rdi, rbp
call _regexec
test eax, eax
lea rax, aFoundAMatch; "Found a match!"
lea rdx, aNotMatched; "Not matched!"
mov rbx, rdx
cmovz rbx, rax
mov rdi, rsp
call _regfree
mov rax, [rsp+var_s48]
sub rax, fs:28h
jnz short loc_1251
mov rax, rbx
add rsp, 58h
pop rbx
pop rbp
retn
loc_1251:
call ___stack_chk_fail | const char * func0(long long a1)
{
const char *v1; // rbx
_QWORD _0[13]; // [rsp+0h] [rbp+0h] BYREF
_0[9] = __readfsqword(0x28u);
regcomp(_0, "ab{2,3}", 1LL);
v1 = "Not matched!";
if ( !(unsigned int)regexec(_0, a1, 0LL, 0LL, 0LL) )
v1 = "Found a match!";
regfree(_0);
return v1;
} | func0:
ENDBR64
PUSH RBP
PUSH RBX
SUB RSP,0x58
MOV RBX,RDI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV RBP,RSP
MOV EDX,0x1
LEA RSI,[0x102020]
MOV RDI,RBP
CALL 0x001010c0
MOV R8D,0x0
MOV ECX,0x0
MOV EDX,0x0
MOV RSI,RBX
MOV RDI,RBP
CALL 0x001010d0
TEST EAX,EAX
LEA RAX,[0x102004]
LEA RDX,[0x102013]
MOV RBX,RDX
CMOVZ RBX,RAX
MOV RDI,RSP
CALL 0x00101090
MOV RAX,qword ptr [RSP + 0x48]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x00101251
MOV RAX,RBX
ADD RSP,0x58
POP RBX
POP RBP
RET
LAB_00101251:
CALL 0x001010a0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
regcomp(&rStack_68,"ab{2,3}",1);
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
pcVar2 = "Not matched!";
if (iVar1 == 0) {
pcVar2 = "Found a match!";
}
regfree(&rStack_68);
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar2;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
5,034 | func0 |
#include <stdio.h>
#include <regex.h>
#include <assert.h>
| char* func0(const char *text) {
regex_t regex;
int result;
char* match_result;
char* pattern = "ab{2,3}";
regcomp(®ex, pattern, REG_EXTENDED);
result = regexec(®ex, text, 0, NULL, 0);
if (result == 0) {
match_result = "Found a match!";
} else {
match_result = "Not matched!";
}
regfree(®ex);
return match_result;
}
| int main() {
assert(func0("ac") == "Not matched!");
assert(func0("dc") == "Not matched!");
assert(func0("abbbba") == "Found a match!");
return 0;
}
| O2 | c | func0:
endbr64
push %r12
mov $0x1,%edx
mov %rdi,%r12
lea 0xd8b(%rip),%rsi
push %rbp
sub $0x58,%rsp
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%rbp
mov %rbp,%rdi
callq 10c0 <regcomp@plt>
xor %r8d,%r8d
xor %ecx,%ecx
xor %edx,%edx
mov %r12,%rsi
mov %rbp,%rdi
lea 0xd4a(%rip),%r12
callq 10d0 <regexec@plt>
mov %rbp,%rdi
test %eax,%eax
lea 0xd2a(%rip),%rax
cmove %rax,%r12
callq 1090 <regfree@plt>
mov 0x48(%rsp),%rax
xor %fs:0x28,%rax
jne 12fe <func0+0x7e>
add $0x58,%rsp
mov %r12,%rax
pop %rbp
pop %r12
retq
callq 10a0 <__stack_chk_fail@plt>
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
push r12
mov edx, 1
mov r12, rdi
lea rsi, aAb23; "ab{2,3}"
push rbp
sub rsp, 58h
mov rax, fs:28h
mov [rsp+var_s48], rax
xor eax, eax
mov rbp, rsp
mov rdi, rbp
call _regcomp
xor edx, edx
xor r8d, r8d
xor ecx, ecx
mov rsi, r12
mov rdi, rbp
call _regexec
lea rdx, aNotMatched; "Not matched!"
mov rdi, rbp
test eax, eax
lea rax, aFoundAMatch; "Found a match!"
cmovz rdx, rax
mov r12, rdx
call _regfree
mov rax, [rsp+var_s48]
sub rax, fs:28h
jnz short loc_1301
add rsp, 58h
mov rax, r12
pop rbp
pop r12
retn
loc_1301:
call ___stack_chk_fail | const char * func0(long long a1)
{
int v1; // eax
const char *v2; // rdx
const char *v3; // r12
_QWORD _0[13]; // [rsp+0h] [rbp+0h] BYREF
_0[9] = __readfsqword(0x28u);
regcomp(_0, "ab{2,3}", 1LL);
v1 = regexec(_0, a1, 0LL, 0LL, 0LL);
v2 = "Not matched!";
if ( !v1 )
v2 = "Found a match!";
v3 = v2;
regfree(_0);
return v3;
} | func0:
ENDBR64
PUSH R12
MOV EDX,0x1
MOV R12,RDI
LEA RSI,[0x102020]
PUSH RBP
SUB RSP,0x58
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV RBP,RSP
MOV RDI,RBP
CALL 0x001010c0
XOR EDX,EDX
XOR R8D,R8D
XOR ECX,ECX
MOV RSI,R12
MOV RDI,RBP
CALL 0x001010d0
LEA RDX,[0x102013]
MOV RDI,RBP
TEST EAX,EAX
LEA RAX,[0x102004]
CMOVZ RDX,RAX
MOV R12,RDX
CALL 0x00101090
MOV RAX,qword ptr [RSP + 0x48]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x00101301
ADD RSP,0x58
MOV RAX,R12
POP RBP
POP R12
RET
LAB_00101301:
CALL 0x001010a0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
regcomp(&rStack_68,"ab{2,3}",1);
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
pcVar2 = "Not matched!";
if (iVar1 == 0) {
pcVar2 = "Found a match!";
}
regfree(&rStack_68);
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar2;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
5,035 | func0 |
#include <stdio.h>
#include <regex.h>
#include <assert.h>
| char* func0(const char *text) {
regex_t regex;
int result;
char* match_result;
char* pattern = "ab{2,3}";
regcomp(®ex, pattern, REG_EXTENDED);
result = regexec(®ex, text, 0, NULL, 0);
if (result == 0) {
match_result = "Found a match!";
} else {
match_result = "Not matched!";
}
regfree(®ex);
return match_result;
}
| int main() {
assert(func0("ac") == "Not matched!");
assert(func0("dc") == "Not matched!");
assert(func0("abbbba") == "Found a match!");
return 0;
}
| O3 | c | func0:
endbr64
push %r12
mov $0x1,%edx
mov %rdi,%r12
lea 0xd8b(%rip),%rsi
push %rbp
sub $0x58,%rsp
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%rbp
mov %rbp,%rdi
callq 10c0 <regcomp@plt>
xor %r8d,%r8d
xor %ecx,%ecx
xor %edx,%edx
mov %r12,%rsi
mov %rbp,%rdi
lea 0xd4a(%rip),%r12
callq 10d0 <regexec@plt>
mov %rbp,%rdi
test %eax,%eax
lea 0xd2a(%rip),%rax
cmove %rax,%r12
callq 1090 <regfree@plt>
mov 0x48(%rsp),%rax
xor %fs:0x28,%rax
jne 12fe <func0+0x7e>
add $0x58,%rsp
mov %r12,%rax
pop %rbp
pop %r12
retq
callq 10a0 <__stack_chk_fail@plt>
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
push rbp
mov edx, 1; cflags
mov rbp, rdi
lea rsi, pattern; "ab{2,3}"
push rbx
sub rsp, 58h
mov rax, fs:28h
mov [rsp+68h+var_20], rax
xor eax, eax
mov rbx, rsp
mov rdi, rbx; preg
call _regcomp
xor edx, edx; nmatch
xor r8d, r8d; eflags
xor ecx, ecx; pmatch
mov rsi, rbp; string
mov rdi, rbx; preg
call _regexec
lea rdx, aFoundAMatch; "Found a match!"
mov rdi, rbx; preg
test eax, eax
lea rax, aNotMatched; "Not matched!"
cmovnz rdx, rax
mov rbp, rdx
call _regfree
mov rax, [rsp+68h+var_20]
sub rax, fs:28h
jnz short loc_12FF
add rsp, 58h
mov rax, rbp
pop rbx
pop rbp
retn
loc_12FF:
call ___stack_chk_fail | const char * func0(char *string)
{
int v1; // eax
const char *v2; // rdx
const char *v3; // rbp
regex_t v5; // [rsp+0h] [rbp-68h] BYREF
unsigned long long v6; // [rsp+48h] [rbp-20h]
v6 = __readfsqword(0x28u);
regcomp(&v5, "ab{2,3}", 1);
v1 = regexec(&v5, string, 0LL, 0LL, 0);
v2 = "Found a match!";
if ( v1 )
v2 = "Not matched!";
v3 = v2;
regfree(&v5);
return v3;
} | func0:
ENDBR64
PUSH RBP
MOV EDX,0x1
MOV RBP,RDI
LEA RSI,[0x102020]
PUSH RBX
SUB RSP,0x58
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV RBX,RSP
MOV RDI,RBX
CALL 0x001010c0
XOR EDX,EDX
XOR R8D,R8D
XOR ECX,ECX
MOV RSI,RBP
MOV RDI,RBX
CALL 0x001010d0
LEA RDX,[0x102004]
MOV RDI,RBX
TEST EAX,EAX
LEA RAX,[0x102013]
CMOVNZ RDX,RAX
MOV RBP,RDX
CALL 0x00101090
MOV RAX,qword ptr [RSP + 0x48]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x001012ff
ADD RSP,0x58
MOV RAX,RBP
POP RBX
POP RBP
RET
LAB_001012ff:
CALL 0x001010a0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
regcomp(&rStack_68,"ab{2,3}",1);
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
pcVar2 = "Found a match!";
if (iVar1 != 0) {
pcVar2 = "Not matched!";
}
regfree(&rStack_68);
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar2;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
5,036 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(int a[], int n, int k) {
int max_so_far = -2147483648;
int max_ending_here = 0;
for (int i = 0; i < n * k; ++i) {
max_ending_here = max_ending_here + a[i % n];
if (max_so_far < max_ending_here) {
max_so_far = max_ending_here;
}
if (max_ending_here < 0) {
max_ending_here = 0;
}
}
return max_so_far;
}
| int main() {
int arr1[] = {10, 20, -30, -1};
assert(func0(arr1, 4, 3) == 30);
int arr2[] = {-1, 10, 20};
assert(func0(arr2, 3, 2) == 59);
int arr3[] = {-1, -2, -3};
assert(func0(arr3, 3, 3) == -1);
printf("All tests passed successfully.\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov %edx,-0x20(%rbp)
movl $0x80000000,-0xc(%rbp)
movl $0x0,-0x8(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11f0 <func0+0x67>
mov -0x4(%rbp),%eax
cltd
idivl -0x1c(%rbp)
mov %edx,%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
add %eax,-0x8(%rbp)
mov -0xc(%rbp),%eax
cmp -0x8(%rbp),%eax
jge 11df <func0+0x56>
mov -0x8(%rbp),%eax
mov %eax,-0xc(%rbp)
cmpl $0x0,-0x8(%rbp)
jns 11ec <func0+0x63>
movl $0x0,-0x8(%rbp)
addl $0x1,-0x4(%rbp)
mov -0x1c(%rbp),%eax
imul -0x20(%rbp),%eax
cmp %eax,-0x4(%rbp)
jl 11b2 <func0+0x29>
mov -0xc(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_20], edx
mov [rbp+var_C], 80000000h
mov [rbp+var_8], 0
mov [rbp+var_4], 0
jmp short loc_11F0
loc_11B2:
mov eax, [rbp+var_4]
cdq
idiv [rbp+var_1C]
mov eax, edx
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
add [rbp+var_8], eax
mov eax, [rbp+var_C]
cmp eax, [rbp+var_8]
jge short loc_11DF
mov eax, [rbp+var_8]
mov [rbp+var_C], eax
loc_11DF:
cmp [rbp+var_8], 0
jns short loc_11EC
mov [rbp+var_8], 0
loc_11EC:
add [rbp+var_4], 1
loc_11F0:
mov eax, [rbp+var_1C]
imul eax, [rbp+var_20]
cmp [rbp+var_4], eax
jl short loc_11B2
mov eax, [rbp+var_C]
pop rbp
retn | long long func0(long long a1, int a2, int a3)
{
unsigned int v4; // [rsp+14h] [rbp-Ch]
int v5; // [rsp+18h] [rbp-8h]
int i; // [rsp+1Ch] [rbp-4h]
v4 = 0x80000000;
v5 = 0;
for ( i = 0; i < a3 * a2; ++i )
{
v5 += *(_DWORD *)(4LL * (i % a2) + a1);
if ( (int)v4 < v5 )
v4 = v5;
if ( v5 < 0 )
v5 = 0;
}
return v4;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x20],EDX
MOV dword ptr [RBP + -0xc],0x80000000
MOV dword ptr [RBP + -0x8],0x0
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011f0
LAB_001011b2:
MOV EAX,dword ptr [RBP + -0x4]
CDQ
IDIV dword ptr [RBP + -0x1c]
MOV EAX,EDX
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
ADD dword ptr [RBP + -0x8],EAX
MOV EAX,dword ptr [RBP + -0xc]
CMP EAX,dword ptr [RBP + -0x8]
JGE 0x001011df
MOV EAX,dword ptr [RBP + -0x8]
MOV dword ptr [RBP + -0xc],EAX
LAB_001011df:
CMP dword ptr [RBP + -0x8],0x0
JNS 0x001011ec
MOV dword ptr [RBP + -0x8],0x0
LAB_001011ec:
ADD dword ptr [RBP + -0x4],0x1
LAB_001011f0:
MOV EAX,dword ptr [RBP + -0x1c]
IMUL EAX,dword ptr [RBP + -0x20]
CMP dword ptr [RBP + -0x4],EAX
JL 0x001011b2
MOV EAX,dword ptr [RBP + -0xc]
POP RBP
RET | int func0(long param_1,int param_2,int param_3)
{
int4 local_14;
int4 local_10;
int4 local_c;
local_14 = -0x80000000;
local_10 = 0;
for (local_c = 0; local_c < param_2 * param_3; local_c = local_c + 1) {
local_10 = local_10 + *(int *)(param_1 + (long)(local_c % param_2) * 4);
if (local_14 < local_10) {
local_14 = local_10;
}
if (local_10 < 0) {
local_10 = 0;
}
}
return local_14;
} |
5,037 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(int a[], int n, int k) {
int max_so_far = -2147483648;
int max_ending_here = 0;
for (int i = 0; i < n * k; ++i) {
max_ending_here = max_ending_here + a[i % n];
if (max_so_far < max_ending_here) {
max_so_far = max_ending_here;
}
if (max_ending_here < 0) {
max_ending_here = 0;
}
}
return max_so_far;
}
| int main() {
int arr1[] = {10, 20, -30, -1};
assert(func0(arr1, 4, 3) == 30);
int arr2[] = {-1, 10, 20};
assert(func0(arr2, 3, 2) == 59);
int arr3[] = {-1, -2, -3};
assert(func0(arr3, 3, 3) == -1);
printf("All tests passed successfully.\n");
return 0;
}
| O1 | c | func0:
endbr64
imul %esi,%edx
mov %edx,%r10d
test %edx,%edx
jle 11d8 <func0+0x4f>
mov $0x0,%r8d
mov $0x0,%ecx
mov $0x80000000,%r9d
mov $0x0,%r11d
mov %r8d,%eax
cltd
idiv %esi
movslq %edx,%rdx
mov %ecx,%eax
add (%rdi,%rdx,4),%eax
cmp %eax,%r9d
cmovl %eax,%r9d
test %eax,%eax
cmovs %r11d,%eax
mov %eax,%ecx
add $0x1,%r8d
cmp %r10d,%r8d
jne 11ae <func0+0x25>
mov %r9d,%eax
retq
mov $0x80000000,%r9d
jmp 11d4 <func0+0x4b>
| func0:
endbr64
mov r10, rdi
imul edx, esi
mov r9d, edx
test edx, edx
jle short loc_11D7
mov edi, 0
mov ecx, 0
mov r8d, 80000000h
loc_11AA:
mov eax, edi
cdq
idiv esi
movsxd rdx, edx
mov eax, ecx
add eax, [r10+rdx*4]
cmp r8d, eax
cmovl r8d, eax
test eax, eax
mov edx, 0
mov ecx, edx
cmovns ecx, eax
add edi, 1
cmp edi, r9d
jnz short loc_11AA
loc_11D3:
mov eax, r8d
retn
loc_11D7:
mov r8d, 80000000h
jmp short loc_11D3 | long long func0(long long a1, int a2, int a3)
{
int v4; // edi
int v5; // ecx
unsigned int v6; // r8d
int v7; // eax
if ( a2 * a3 <= 0 )
{
return 0x80000000;
}
else
{
v4 = 0;
v5 = 0;
v6 = 0x80000000;
do
{
v7 = *(_DWORD *)(a1 + 4LL * (v4 % a2)) + v5;
if ( (int)v6 < v7 )
v6 = *(_DWORD *)(a1 + 4LL * (v4 % a2)) + v5;
v5 = 0;
if ( v7 >= 0 )
v5 = v7;
++v4;
}
while ( v4 != a2 * a3 );
}
return v6;
} | func0:
ENDBR64
MOV R10,RDI
IMUL EDX,ESI
MOV R9D,EDX
TEST EDX,EDX
JLE 0x001011d7
MOV EDI,0x0
MOV ECX,0x0
MOV R8D,0x80000000
LAB_001011aa:
MOV EAX,EDI
CDQ
IDIV ESI
MOVSXD RDX,EDX
MOV EAX,ECX
ADD EAX,dword ptr [R10 + RDX*0x4]
CMP R8D,EAX
CMOVL R8D,EAX
TEST EAX,EAX
MOV EDX,0x0
MOV ECX,EDX
CMOVNS ECX,EAX
ADD EDI,0x1
CMP EDI,R9D
JNZ 0x001011aa
LAB_001011d3:
MOV EAX,R8D
RET
LAB_001011d7:
MOV R8D,0x80000000
JMP 0x001011d3 | int func0(long param_1,int param_2,int param_3)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
if (param_3 * param_2 < 1) {
iVar4 = -0x80000000;
}
else {
iVar3 = 0;
iVar2 = 0;
iVar4 = -0x80000000;
do {
iVar1 = iVar2 + *(int *)(param_1 + (long)(iVar3 % param_2) * 4);
if (iVar4 < iVar1) {
iVar4 = iVar1;
}
iVar2 = 0;
if (-1 < iVar1) {
iVar2 = iVar1;
}
iVar3 = iVar3 + 1;
} while (iVar3 != param_3 * param_2);
}
return iVar4;
} |
5,038 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(int a[], int n, int k) {
int max_so_far = -2147483648;
int max_ending_here = 0;
for (int i = 0; i < n * k; ++i) {
max_ending_here = max_ending_here + a[i % n];
if (max_so_far < max_ending_here) {
max_so_far = max_ending_here;
}
if (max_ending_here < 0) {
max_ending_here = 0;
}
}
return max_so_far;
}
| int main() {
int arr1[] = {10, 20, -30, -1};
assert(func0(arr1, 4, 3) == 30);
int arr2[] = {-1, 10, 20};
assert(func0(arr2, 3, 2) == 59);
int arr3[] = {-1, -2, -3};
assert(func0(arr3, 3, 3) == -1);
printf("All tests passed successfully.\n");
return 0;
}
| O2 | c | func0:
endbr64
imul %esi,%edx
mov %edx,%r10d
test %edx,%edx
jle 13b0 <func0+0x50>
xor %r8d,%r8d
xor %ecx,%ecx
mov $0x80000000,%r9d
xor %r11d,%r11d
nopl 0x0(%rax)
mov %r8d,%eax
cltd
idiv %esi
movslq %edx,%rdx
mov (%rdi,%rdx,4),%eax
add %ecx,%eax
cmp %eax,%r9d
cmovl %eax,%r9d
test %eax,%eax
cmovs %r11d,%eax
add $0x1,%r8d
mov %eax,%ecx
cmp %r10d,%r8d
jne 1380 <func0+0x20>
mov %r9d,%eax
retq
nopw 0x0(%rax,%rax,1)
mov $0x80000000,%r9d
mov %r9d,%eax
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
imul edx, esi
mov r10, rdi
mov r9d, edx
test edx, edx
jle short loc_13A0
xor edi, edi
xor ecx, ecx
mov r8d, 80000000h
nop dword ptr [rax+rax+00h]
loc_1370:
mov eax, edi
cdq
idiv esi
movsxd rdx, edx
mov eax, [r10+rdx*4]
add eax, ecx
cmp r8d, eax
cmovl r8d, eax
xor edx, edx
test eax, eax
mov ecx, edx
cmovns ecx, eax
add edi, 1
cmp edi, r9d
jnz short loc_1370
mov eax, r8d
retn
loc_13A0:
mov r8d, 80000000h
mov eax, r8d
retn | long long func0(long long a1, int a2, int a3)
{
int v4; // edi
int v5; // ecx
unsigned int v6; // r8d
int v7; // eax
if ( a2 * a3 <= 0 )
return 0x80000000LL;
v4 = 0;
v5 = 0;
v6 = 0x80000000;
do
{
v7 = v5 + *(_DWORD *)(a1 + 4LL * (v4 % a2));
if ( (int)v6 < v7 )
v6 = v5 + *(_DWORD *)(a1 + 4LL * (v4 % a2));
v5 = 0;
if ( v7 >= 0 )
v5 = v7;
++v4;
}
while ( v4 != a2 * a3 );
return v6;
} | func0:
ENDBR64
IMUL EDX,ESI
MOV R10,RDI
MOV R9D,EDX
TEST EDX,EDX
JLE 0x001013a0
XOR EDI,EDI
XOR ECX,ECX
MOV R8D,0x80000000
NOP dword ptr [RAX + RAX*0x1]
LAB_00101370:
MOV EAX,EDI
CDQ
IDIV ESI
MOVSXD RDX,EDX
MOV EAX,dword ptr [R10 + RDX*0x4]
ADD EAX,ECX
CMP R8D,EAX
CMOVL R8D,EAX
XOR EDX,EDX
TEST EAX,EAX
MOV ECX,EDX
CMOVNS ECX,EAX
ADD EDI,0x1
CMP EDI,R9D
JNZ 0x00101370
MOV EAX,R8D
RET
LAB_001013a0:
MOV R8D,0x80000000
MOV EAX,R8D
RET | int func0(long param_1,int param_2,int param_3)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
if (0 < param_3 * param_2) {
iVar3 = 0;
iVar2 = 0;
iVar4 = -0x80000000;
do {
iVar1 = *(int *)(param_1 + (long)(iVar3 % param_2) * 4) + iVar2;
if (iVar4 < iVar1) {
iVar4 = iVar1;
}
iVar2 = 0;
if (-1 < iVar1) {
iVar2 = iVar1;
}
iVar3 = iVar3 + 1;
} while (iVar3 != param_3 * param_2);
return iVar4;
}
return -0x80000000;
} |
5,039 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(int a[], int n, int k) {
int max_so_far = -2147483648;
int max_ending_here = 0;
for (int i = 0; i < n * k; ++i) {
max_ending_here = max_ending_here + a[i % n];
if (max_so_far < max_ending_here) {
max_so_far = max_ending_here;
}
if (max_ending_here < 0) {
max_ending_here = 0;
}
}
return max_so_far;
}
| int main() {
int arr1[] = {10, 20, -30, -1};
assert(func0(arr1, 4, 3) == 30);
int arr2[] = {-1, 10, 20};
assert(func0(arr2, 3, 2) == 59);
int arr3[] = {-1, -2, -3};
assert(func0(arr3, 3, 3) == -1);
printf("All tests passed successfully.\n");
return 0;
}
| O3 | c | func0:
endbr64
imul %esi,%edx
mov %edx,%r10d
test %edx,%edx
jle 1300 <func0+0x50>
xor %r8d,%r8d
xor %ecx,%ecx
mov $0x80000000,%r9d
xor %r11d,%r11d
nopl 0x0(%rax)
mov %r8d,%eax
cltd
idiv %esi
movslq %edx,%rdx
mov (%rdi,%rdx,4),%eax
add %ecx,%eax
cmp %eax,%r9d
cmovl %eax,%r9d
test %eax,%eax
cmovs %r11d,%eax
add $0x1,%r8d
mov %eax,%ecx
cmp %r10d,%r8d
jne 12d0 <func0+0x20>
mov %r9d,%eax
retq
nopw 0x0(%rax,%rax,1)
mov $0x80000000,%r9d
mov %r9d,%eax
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
imul edx, esi
mov r10, rdi
mov r9d, edx
test edx, edx
jle short loc_11C0
xor edi, edi
xor ecx, ecx
mov r8d, 80000000h
nop dword ptr [rax+rax+00h]
loc_1190:
mov eax, edi
cdq
idiv esi
movsxd rdx, edx
mov eax, [r10+rdx*4]
add eax, ecx
cmp r8d, eax
cmovl r8d, eax
xor edx, edx
test eax, eax
mov ecx, edx
cmovns ecx, eax
add edi, 1
cmp edi, r9d
jnz short loc_1190
mov eax, r8d
retn
loc_11C0:
mov r8d, 80000000h
mov eax, r8d
retn | long long func0(long long a1, int a2, int a3)
{
int v4; // edi
int v5; // ecx
unsigned int v6; // r8d
int v7; // eax
if ( a2 * a3 <= 0 )
return 0x80000000LL;
v4 = 0;
v5 = 0;
v6 = 0x80000000;
do
{
v7 = v5 + *(_DWORD *)(a1 + 4LL * (v4 % a2));
if ( (int)v6 < v7 )
v6 = v5 + *(_DWORD *)(a1 + 4LL * (v4 % a2));
v5 = 0;
if ( v7 >= 0 )
v5 = v7;
++v4;
}
while ( v4 != a2 * a3 );
return v6;
} | func0:
ENDBR64
IMUL EDX,ESI
MOV R10,RDI
MOV R9D,EDX
TEST EDX,EDX
JLE 0x001011c0
XOR EDI,EDI
XOR ECX,ECX
MOV R8D,0x80000000
NOP dword ptr [RAX + RAX*0x1]
LAB_00101190:
MOV EAX,EDI
CDQ
IDIV ESI
MOVSXD RDX,EDX
MOV EAX,dword ptr [R10 + RDX*0x4]
ADD EAX,ECX
CMP R8D,EAX
CMOVL R8D,EAX
XOR EDX,EDX
TEST EAX,EAX
MOV ECX,EDX
CMOVNS ECX,EAX
ADD EDI,0x1
CMP EDI,R9D
JNZ 0x00101190
MOV EAX,R8D
RET
LAB_001011c0:
MOV R8D,0x80000000
MOV EAX,R8D
RET | int func0(long param_1,int param_2,int param_3)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
if (0 < param_3 * param_2) {
iVar3 = 0;
iVar2 = 0;
iVar4 = -0x80000000;
do {
iVar1 = *(int *)(param_1 + (long)(iVar3 % param_2) * 4) + iVar2;
if (iVar4 < iVar1) {
iVar4 = iVar1;
}
iVar2 = 0;
if (-1 < iVar1) {
iVar2 = iVar1;
}
iVar3 = iVar3 + 1;
} while (iVar3 != param_3 * param_2);
return iVar4;
}
return -0x80000000;
} |
5,040 | func0 |
#include <assert.h>
| int func0(int n) {
return 2 * n * (n + 1) * (2 * n + 1) / 3;
}
| int main() {
assert(func0(2) == 20);
assert(func0(3) == 56);
assert(func0(4) == 120);
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 %edx,%edx
add $0x1,%edx
imul %edx,%eax
add %eax,%eax
movslq %eax,%rdx
imul $0x55555556,%rdx,%rdx
shr $0x20,%rdx
sar $0x1f,%eax
mov %edx,%ecx
sub %eax,%ecx
mov %ecx,%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_4], edi
mov eax, [rbp+var_4]
add eax, 1
imul eax, [rbp+var_4]
mov edx, [rbp+var_4]
add edx, edx
add edx, 1
imul eax, edx
add eax, eax
movsxd rdx, eax
imul rdx, 55555556h
shr rdx, 20h
sar eax, 1Fh
sub edx, eax
mov eax, edx
pop rbp
retn | long long func0(int a1)
{
return (unsigned int)(2 * (2 * a1 + 1) * a1 * (a1 + 1) / 3);
} | 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,EDX
ADD EDX,0x1
IMUL EAX,EDX
ADD EAX,EAX
MOVSXD RDX,EAX
IMUL RDX,RDX,0x55555556
SHR RDX,0x20
SAR EAX,0x1f
SUB EDX,EAX
MOV EAX,EDX
POP RBP
RET | int func0(int param_1)
{
return ((param_1 + 1) * param_1 * (param_1 * 2 + 1) * 2) / 3;
} |
5,041 | func0 |
#include <assert.h>
| int func0(int n) {
return 2 * n * (n + 1) * (2 * n + 1) / 3;
}
| int main() {
assert(func0(2) == 20);
assert(func0(3) == 56);
assert(func0(4) == 120);
return 0;
}
| O1 | c | func0:
endbr64
lea 0x1(%rdi),%edx
imul %edi,%edx
lea 0x1(%rdi,%rdi,1),%eax
imul %eax,%edx
add %edx,%edx
movslq %edx,%rax
imul $0x55555556,%rax,%rax
shr $0x20,%rax
sar $0x1f,%edx
sub %edx,%eax
retq
| func0:
endbr64
lea edx, [rdi+1]
imul edx, edi
lea eax, [rdi+rdi+1]
imul edx, eax
add edx, edx
movsxd rax, edx
imul rax, 55555556h
shr rax, 20h
sar edx, 1Fh
sub eax, edx
retn | long long func0(int a1)
{
return (unsigned int)(2 * (2 * a1 + 1) * a1 * (a1 + 1) / 3);
} | func0:
ENDBR64
LEA EDX,[RDI + 0x1]
IMUL EDX,EDI
LEA EAX,[RDI + RDI*0x1 + 0x1]
IMUL EDX,EAX
ADD EDX,EDX
MOVSXD RAX,EDX
IMUL RAX,RAX,0x55555556
SHR RAX,0x20
SAR EDX,0x1f
SUB EAX,EDX
RET | int func0(int param_1)
{
return ((param_1 + 1) * param_1 * (param_1 * 2 + 1) * 2) / 3;
} |
5,042 | func0 |
#include <assert.h>
| int func0(int n) {
return 2 * n * (n + 1) * (2 * n + 1) / 3;
}
| int main() {
assert(func0(2) == 20);
assert(func0(3) == 56);
assert(func0(4) == 120);
return 0;
}
| O2 | c | func0:
endbr64
lea 0x1(%rdi),%edx
lea 0x1(%rdi,%rdi,1),%eax
imul %edi,%edx
imul %eax,%edx
add %edx,%edx
movslq %edx,%rax
sar $0x1f,%edx
imul $0x55555556,%rax,%rax
shr $0x20,%rax
sub %edx,%eax
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
lea edx, [rdi+1]
lea eax, [rdi+rdi+1]
imul edx, edi
imul edx, eax
add edx, edx
movsxd rax, edx
sar edx, 1Fh
imul rax, 55555556h
shr rax, 20h
sub eax, edx
retn | long long func0(int a1)
{
return (unsigned int)(2 * (2 * a1 + 1) * a1 * (a1 + 1) / 3);
} | func0:
ENDBR64
LEA EDX,[RDI + 0x1]
LEA EAX,[RDI + RDI*0x1 + 0x1]
IMUL EDX,EDI
IMUL EDX,EAX
ADD EDX,EDX
MOVSXD RAX,EDX
SAR EDX,0x1f
IMUL RAX,RAX,0x55555556
SHR RAX,0x20
SUB EAX,EDX
RET | int func0(int param_1)
{
return ((param_1 + 1) * param_1 * (param_1 * 2 + 1) * 2) / 3;
} |
5,043 | func0 |
#include <assert.h>
| int func0(int n) {
return 2 * n * (n + 1) * (2 * n + 1) / 3;
}
| int main() {
assert(func0(2) == 20);
assert(func0(3) == 56);
assert(func0(4) == 120);
return 0;
}
| O3 | c | func0:
endbr64
lea 0x1(%rdi),%edx
lea 0x1(%rdi,%rdi,1),%eax
imul %edi,%edx
imul %eax,%edx
add %edx,%edx
movslq %edx,%rax
sar $0x1f,%edx
imul $0x55555556,%rax,%rax
shr $0x20,%rax
sub %edx,%eax
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
lea edx, [rdi+1]
lea eax, [rdi+rdi+1]
imul edx, edi
imul edx, eax
add edx, edx
movsxd rax, edx
sar edx, 1Fh
imul rax, 55555556h
shr rax, 20h
sub eax, edx
retn | long long func0(int a1)
{
return (unsigned int)(2 * (2 * a1 + 1) * a1 * (a1 + 1) / 3);
} | func0:
ENDBR64
LEA EDX,[RDI + 0x1]
LEA EAX,[RDI + RDI*0x1 + 0x1]
IMUL EDX,EDI
IMUL EDX,EAX
ADD EDX,EDX
MOVSXD RAX,EDX
SAR EDX,0x1f
IMUL RAX,RAX,0x55555556
SHR RAX,0x20
SUB EAX,EDX
RET | int func0(int param_1)
{
return ((param_1 + 1) * param_1 * (param_1 * 2 + 1) * 2) / 3;
} |
5,044 | func0 | #include <assert.h>
/* Function to calculate number of elements in array `arr` of length `N`
that are modular inverses under modulo `P` */
| int func0(int arr[], int N, int P) {
int current_element = 0;
for (int i = 0; i < N; i++) {
if ((arr[i] * arr[i]) % P == 1) {
current_element += 1;
}
}
return current_element;
}
| int main() {
int arr1[] = {1, 6, 4, 5};
int arr2[] = {1, 3, 8, 12, 12};
int arr3[] = {2, 3, 4, 5};
assert(func0(arr1, 4, 7) == 2);
assert(func0(arr2, 5, 13) == 3);
assert(func0(arr3, 4, 6) == 1);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov %edx,-0x20(%rbp)
movl $0x0,-0x8(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11cd <func0+0x64>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%edx
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rcx
mov -0x18(%rbp),%rax
add %rcx,%rax
mov (%rax),%eax
imul %edx,%eax
cltd
idivl -0x20(%rbp)
mov %edx,%eax
cmp $0x1,%eax
jne 11c9 <func0+0x60>
addl $0x1,-0x8(%rbp)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 118b <func0+0x22>
mov -0x8(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_20], edx
mov [rbp+var_8], 0
mov [rbp+var_4], 0
jmp short loc_11CD
loc_118B:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov edx, [rax]
mov eax, [rbp+var_4]
cdqe
lea rcx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rcx
mov eax, [rax]
imul eax, edx
cdq
idiv [rbp+var_20]
mov eax, edx
cmp eax, 1
jnz short loc_11C9
add [rbp+var_8], 1
loc_11C9:
add [rbp+var_4], 1
loc_11CD:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_118B
mov eax, [rbp+var_8]
pop rbp
retn | long long func0(long long a1, int a2, int a3)
{
unsigned int v4; // [rsp+18h] [rbp-8h]
int i; // [rsp+1Ch] [rbp-4h]
v4 = 0;
for ( i = 0; i < a2; ++i )
{
if ( *(_DWORD *)(4LL * i + a1) * *(_DWORD *)(4LL * i + a1) % a3 == 1 )
++v4;
}
return v4;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x20],EDX
MOV dword ptr [RBP + -0x8],0x0
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011cd
LAB_0010118b:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RCX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RCX
MOV EAX,dword ptr [RAX]
IMUL EAX,EDX
CDQ
IDIV dword ptr [RBP + -0x20]
MOV EAX,EDX
CMP EAX,0x1
JNZ 0x001011c9
ADD dword ptr [RBP + -0x8],0x1
LAB_001011c9:
ADD dword ptr [RBP + -0x4],0x1
LAB_001011cd:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x0010118b
MOV EAX,dword ptr [RBP + -0x8]
POP RBP
RET | int func0(long param_1,int param_2,int param_3)
{
int4 local_10;
int4 local_c;
local_10 = 0;
for (local_c = 0; local_c < param_2; local_c = local_c + 1) {
if ((*(int *)(param_1 + (long)local_c * 4) * *(int *)(param_1 + (long)local_c * 4)) % param_3 ==
1) {
local_10 = local_10 + 1;
}
}
return local_10;
} |
5,045 | func0 | #include <assert.h>
/* Function to calculate number of elements in array `arr` of length `N`
that are modular inverses under modulo `P` */
| int func0(int arr[], int N, int P) {
int current_element = 0;
for (int i = 0; i < N; i++) {
if ((arr[i] * arr[i]) % P == 1) {
current_element += 1;
}
}
return current_element;
}
| int main() {
int arr1[] = {1, 6, 4, 5};
int arr2[] = {1, 3, 8, 12, 12};
int arr3[] = {2, 3, 4, 5};
assert(func0(arr1, 4, 7) == 2);
assert(func0(arr2, 5, 13) == 3);
assert(func0(arr3, 4, 6) == 1);
return 0;
}
| O1 | c | func0:
endbr64
mov %edx,%r8d
test %esi,%esi
jle 11a4 <func0+0x3b>
mov %rdi,%rcx
lea -0x1(%rsi),%eax
lea 0x4(%rdi,%rax,4),%rdi
mov $0x0,%esi
mov (%rcx),%eax
imul %eax,%eax
cltd
idiv %r8d
cmp $0x1,%edx
sete %al
movzbl %al,%eax
add %eax,%esi
add $0x4,%rcx
cmp %rdi,%rcx
jne 1184 <func0+0x1b>
mov %esi,%eax
retq
mov $0x0,%esi
jmp 11a1 <func0+0x38>
| func0:
endbr64
mov r8d, edx
test esi, esi
jle short loc_11A4
mov rcx, rdi
lea eax, [rsi-1]
lea rdi, [rdi+rax*4+4]
mov esi, 0
loc_1184:
mov eax, [rcx]
imul eax, eax
cdq
idiv r8d
cmp edx, 1
setz al
movzx eax, al
add esi, eax
add rcx, 4
cmp rcx, rdi
jnz short loc_1184
loc_11A1:
mov eax, esi
retn
loc_11A4:
mov esi, 0
jmp short loc_11A1 | long long func0(_DWORD *a1, int a2, int a3)
{
_DWORD *v3; // rcx
long long v4; // rdi
unsigned int v5; // esi
if ( a2 <= 0 )
{
return 0;
}
else
{
v3 = a1;
v4 = (long long)&a1[a2 - 1 + 1];
v5 = 0;
do
{
v5 += *v3 * *v3 % a3 == 1;
++v3;
}
while ( v3 != (_DWORD *)v4 );
}
return v5;
} | func0:
ENDBR64
MOV R8D,EDX
TEST ESI,ESI
JLE 0x001011a4
MOV RCX,RDI
LEA EAX,[RSI + -0x1]
LEA RDI,[RDI + RAX*0x4 + 0x4]
MOV ESI,0x0
LAB_00101184:
MOV EAX,dword ptr [RCX]
IMUL EAX,EAX
CDQ
IDIV R8D
CMP EDX,0x1
SETZ AL
MOVZX EAX,AL
ADD ESI,EAX
ADD RCX,0x4
CMP RCX,RDI
JNZ 0x00101184
LAB_001011a1:
MOV EAX,ESI
RET
LAB_001011a4:
MOV ESI,0x0
JMP 0x001011a1 | int func0(int *param_1,int param_2,int param_3)
{
int *piVar1;
int iVar2;
if (param_2 < 1) {
iVar2 = 0;
}
else {
piVar1 = param_1 + (ulong)(param_2 - 1) + 1;
iVar2 = 0;
do {
iVar2 = iVar2 + (uint)((*param_1 * *param_1) % param_3 == 1);
param_1 = param_1 + 1;
} while (param_1 != piVar1);
}
return iVar2;
} |
5,046 | func0 | #include <assert.h>
/* Function to calculate number of elements in array `arr` of length `N`
that are modular inverses under modulo `P` */
| int func0(int arr[], int N, int P) {
int current_element = 0;
for (int i = 0; i < N; i++) {
if ((arr[i] * arr[i]) % P == 1) {
current_element += 1;
}
}
return current_element;
}
| int main() {
int arr1[] = {1, 6, 4, 5};
int arr2[] = {1, 3, 8, 12, 12};
int arr3[] = {2, 3, 4, 5};
assert(func0(arr1, 4, 7) == 2);
assert(func0(arr2, 5, 13) == 3);
assert(func0(arr3, 4, 6) == 1);
return 0;
}
| O2 | c | func0:
endbr64
mov %edx,%ecx
test %esi,%esi
jle 12f0 <func0+0x40>
lea -0x1(%rsi),%eax
xor %r8d,%r8d
lea 0x4(%rdi,%rax,4),%rsi
nopl (%rax)
mov (%rdi),%eax
imul %eax,%eax
cltd
idiv %ecx
xor %eax,%eax
cmp $0x1,%edx
sete %al
add $0x4,%rdi
add %eax,%r8d
cmp %rsi,%rdi
jne 12c8 <func0+0x18>
mov %r8d,%eax
retq
nopl 0x0(%rax,%rax,1)
xor %r8d,%r8d
mov %r8d,%eax
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
mov ecx, edx
test esi, esi
jle short loc_1350
lea eax, [rsi-1]
xor r8d, r8d
lea rsi, [rdi+rax*4+4]
nop dword ptr [rax]
loc_1328:
mov eax, [rdi]
imul eax, eax
cdq
idiv ecx
xor eax, eax
cmp edx, 1
setz al
add rdi, 4
add r8d, eax
cmp rdi, rsi
jnz short loc_1328
mov eax, r8d
retn
loc_1350:
xor r8d, r8d
mov eax, r8d
retn | long long func0(_DWORD *a1, int a2, int a3)
{
unsigned int v3; // r8d
long long v4; // rsi
int v5; // eax
if ( a2 <= 0 )
return 0LL;
v3 = 0;
v4 = (long long)&a1[a2 - 1 + 1];
do
{
v5 = *a1 * *a1 % a3 == 1;
++a1;
v3 += v5;
}
while ( a1 != (_DWORD *)v4 );
return v3;
} | func0:
ENDBR64
MOV ECX,EDX
TEST ESI,ESI
JLE 0x00101350
LEA EAX,[RSI + -0x1]
XOR R8D,R8D
LEA RSI,[RDI + RAX*0x4 + 0x4]
NOP dword ptr [RAX]
LAB_00101328:
MOV EAX,dword ptr [RDI]
IMUL EAX,EAX
CDQ
IDIV ECX
XOR EAX,EAX
CMP EDX,0x1
SETZ AL
ADD RDI,0x4
ADD R8D,EAX
CMP RDI,RSI
JNZ 0x00101328
MOV EAX,R8D
RET
LAB_00101350:
XOR R8D,R8D
MOV EAX,R8D
RET | int func0(int *param_1,int param_2,int param_3)
{
int *piVar1;
int iVar2;
int iVar3;
if (0 < param_2) {
iVar3 = 0;
piVar1 = param_1 + (ulong)(param_2 - 1) + 1;
do {
iVar2 = *param_1;
param_1 = param_1 + 1;
iVar3 = iVar3 + (uint)((iVar2 * iVar2) % param_3 == 1);
} while (param_1 != piVar1);
return iVar3;
}
return 0;
} |
5,047 | func0 | #include <assert.h>
/* Function to calculate number of elements in array `arr` of length `N`
that are modular inverses under modulo `P` */
| int func0(int arr[], int N, int P) {
int current_element = 0;
for (int i = 0; i < N; i++) {
if ((arr[i] * arr[i]) % P == 1) {
current_element += 1;
}
}
return current_element;
}
| int main() {
int arr1[] = {1, 6, 4, 5};
int arr2[] = {1, 3, 8, 12, 12};
int arr3[] = {2, 3, 4, 5};
assert(func0(arr1, 4, 7) == 2);
assert(func0(arr2, 5, 13) == 3);
assert(func0(arr3, 4, 6) == 1);
return 0;
}
| O3 | c | func0:
endbr64
mov %edx,%ecx
test %esi,%esi
jle 1270 <func0+0x40>
lea -0x1(%rsi),%eax
xor %r8d,%r8d
lea 0x4(%rdi,%rax,4),%rsi
nopl (%rax)
mov (%rdi),%eax
imul %eax,%eax
cltd
idiv %ecx
xor %eax,%eax
cmp $0x1,%edx
sete %al
add $0x4,%rdi
add %eax,%r8d
cmp %rdi,%rsi
jne 1248 <func0+0x18>
mov %r8d,%eax
retq
nopl 0x0(%rax,%rax,1)
xor %r8d,%r8d
mov %r8d,%eax
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
mov ecx, edx
test esi, esi
jle short loc_1180
movsxd rsi, esi
lea r8, [rdi+rsi*4]
xor esi, esi
nop dword ptr [rax+rax+00h]
loc_1158:
mov eax, [rdi]
imul eax, eax
cdq
idiv ecx
xor eax, eax
cmp edx, 1
setz al
add rdi, 4
add esi, eax
cmp r8, rdi
jnz short loc_1158
mov eax, esi
retn
loc_1180:
xor esi, esi
mov eax, esi
retn | long long func0(_DWORD *a1, int a2, int a3)
{
_DWORD *v3; // r8
unsigned int v4; // esi
int v5; // eax
if ( a2 <= 0 )
return 0LL;
v3 = &a1[a2];
v4 = 0;
do
{
v5 = *a1 * *a1 % a3 == 1;
++a1;
v4 += v5;
}
while ( v3 != a1 );
return v4;
} | func0:
ENDBR64
MOV ECX,EDX
TEST ESI,ESI
JLE 0x00101180
MOVSXD RSI,ESI
LEA R8,[RDI + RSI*0x4]
XOR ESI,ESI
NOP dword ptr [RAX + RAX*0x1]
LAB_00101158:
MOV EAX,dword ptr [RDI]
IMUL EAX,EAX
CDQ
IDIV ECX
XOR EAX,EAX
CMP EDX,0x1
SETZ AL
ADD RDI,0x4
ADD ESI,EAX
CMP R8,RDI
JNZ 0x00101158
MOV EAX,ESI
RET
LAB_00101180:
XOR ESI,ESI
MOV EAX,ESI
RET | int func0(int *param_1,int param_2,int param_3)
{
int *piVar1;
int iVar2;
int iVar3;
if (0 < param_2) {
piVar1 = param_1 + param_2;
iVar3 = 0;
do {
iVar2 = *param_1;
param_1 = param_1 + 1;
iVar3 = iVar3 + (uint)((iVar2 * iVar2) % param_3 == 1);
} while (piVar1 != param_1);
return iVar3;
}
return 0;
} |
5,048 | func0 |
#include <assert.h>
| int func0(int N) {
int hund1 = N / 100;
int hund4 = N / 400;
int leap = N >> 2;
int ordd = N - leap;
if (hund1) {
ordd += hund1;
leap -= hund1;
}
if (hund4) {
ordd -= hund4;
leap += hund4;
}
int days = ordd + leap * 2;
int odd = days % 7;
return odd;
}
| int main() {
assert(func0(100) == 5);
assert(func0(50) == 6);
assert(func0(75) == 2);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %edi,-0x24(%rbp)
mov -0x24(%rbp),%eax
movslq %eax,%rdx
imul $0x51eb851f,%rdx,%rdx
shr $0x20,%rdx
sar $0x5,%edx
sar $0x1f,%eax
sub %eax,%edx
mov %edx,%eax
mov %eax,-0x10(%rbp)
mov -0x24(%rbp),%eax
movslq %eax,%rdx
imul $0x51eb851f,%rdx,%rdx
shr $0x20,%rdx
sar $0x7,%edx
sar $0x1f,%eax
sub %eax,%edx
mov %edx,%eax
mov %eax,-0xc(%rbp)
mov -0x24(%rbp),%eax
sar $0x2,%eax
mov %eax,-0x18(%rbp)
mov -0x24(%rbp),%eax
sub -0x18(%rbp),%eax
mov %eax,-0x14(%rbp)
cmpl $0x0,-0x10(%rbp)
je 11b4 <func0+0x6b>
mov -0x10(%rbp),%eax
add %eax,-0x14(%rbp)
mov -0x10(%rbp),%eax
sub %eax,-0x18(%rbp)
cmpl $0x0,-0xc(%rbp)
je 11c6 <func0+0x7d>
mov -0xc(%rbp),%eax
sub %eax,-0x14(%rbp)
mov -0xc(%rbp),%eax
add %eax,-0x18(%rbp)
mov -0x18(%rbp),%eax
lea (%rax,%rax,1),%edx
mov -0x14(%rbp),%eax
add %edx,%eax
mov %eax,-0x8(%rbp)
mov -0x8(%rbp),%eax
movslq %eax,%rdx
imul $0xffffffff92492493,%rdx,%rdx
shr $0x20,%rdx
add %eax,%edx
mov %edx,%ecx
sar $0x2,%ecx
cltd
sub %edx,%ecx
mov %ecx,%edx
shl $0x3,%edx
sub %ecx,%edx
sub %edx,%eax
mov %eax,-0x4(%rbp)
mov -0x4(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_24], edi
mov eax, [rbp+var_24]
movsxd rdx, eax
imul rdx, 51EB851Fh
shr rdx, 20h
mov ecx, edx
sar ecx, 5
cdq
mov eax, ecx
sub eax, edx
mov [rbp+var_10], eax
mov eax, [rbp+var_24]
movsxd rdx, eax
imul rdx, 51EB851Fh
shr rdx, 20h
mov ecx, edx
sar ecx, 7
cdq
mov eax, ecx
sub eax, edx
mov [rbp+var_C], eax
mov eax, [rbp+var_24]
sar eax, 2
mov [rbp+var_18], eax
mov eax, [rbp+var_24]
sub eax, [rbp+var_18]
mov [rbp+var_14], eax
cmp [rbp+var_10], 0
jz short loc_11B4
mov eax, [rbp+var_10]
add [rbp+var_14], eax
mov eax, [rbp+var_10]
sub [rbp+var_18], eax
loc_11B4:
cmp [rbp+var_C], 0
jz short loc_11C6
mov eax, [rbp+var_C]
sub [rbp+var_14], eax
mov eax, [rbp+var_C]
add [rbp+var_18], eax
loc_11C6:
mov eax, [rbp+var_18]
lea edx, [rax+rax]
mov eax, [rbp+var_14]
add eax, edx
mov [rbp+var_8], eax
mov eax, [rbp+var_8]
movsxd rdx, eax
imul rdx, 0FFFFFFFF92492493h
shr rdx, 20h
add edx, eax
mov ecx, edx
sar ecx, 2
cdq
sub ecx, edx
mov edx, ecx
shl edx, 3
sub edx, ecx
sub eax, edx
mov [rbp+var_4], eax
mov eax, [rbp+var_4]
pop rbp
retn | long long func0(int a1)
{
int v2; // [rsp+Ch] [rbp-18h]
int v3; // [rsp+10h] [rbp-14h]
int v4; // [rsp+14h] [rbp-10h]
int v5; // [rsp+18h] [rbp-Ch]
v4 = a1 / 100;
v5 = a1 / 400;
v2 = a1 >> 2;
v3 = a1 - (a1 >> 2);
if ( a1 / 100 )
{
v3 += v4;
v2 -= v4;
}
if ( v5 )
{
v3 -= v5;
v2 += v5;
}
return (unsigned int)((2 * v2 + v3) % 7);
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV dword ptr [RBP + -0x24],EDI
MOV EAX,dword ptr [RBP + -0x24]
MOVSXD RDX,EAX
IMUL RDX,RDX,0x51eb851f
SHR RDX,0x20
MOV ECX,EDX
SAR ECX,0x5
CDQ
MOV EAX,ECX
SUB EAX,EDX
MOV dword ptr [RBP + -0x10],EAX
MOV EAX,dword ptr [RBP + -0x24]
MOVSXD RDX,EAX
IMUL RDX,RDX,0x51eb851f
SHR RDX,0x20
MOV ECX,EDX
SAR ECX,0x7
CDQ
MOV EAX,ECX
SUB EAX,EDX
MOV dword ptr [RBP + -0xc],EAX
MOV EAX,dword ptr [RBP + -0x24]
SAR EAX,0x2
MOV dword ptr [RBP + -0x18],EAX
MOV EAX,dword ptr [RBP + -0x24]
SUB EAX,dword ptr [RBP + -0x18]
MOV dword ptr [RBP + -0x14],EAX
CMP dword ptr [RBP + -0x10],0x0
JZ 0x001011b4
MOV EAX,dword ptr [RBP + -0x10]
ADD dword ptr [RBP + -0x14],EAX
MOV EAX,dword ptr [RBP + -0x10]
SUB dword ptr [RBP + -0x18],EAX
LAB_001011b4:
CMP dword ptr [RBP + -0xc],0x0
JZ 0x001011c6
MOV EAX,dword ptr [RBP + -0xc]
SUB dword ptr [RBP + -0x14],EAX
MOV EAX,dword ptr [RBP + -0xc]
ADD dword ptr [RBP + -0x18],EAX
LAB_001011c6:
MOV EAX,dword ptr [RBP + -0x18]
LEA EDX,[RAX + RAX*0x1]
MOV EAX,dword ptr [RBP + -0x14]
ADD EAX,EDX
MOV dword ptr [RBP + -0x8],EAX
MOV EAX,dword ptr [RBP + -0x8]
MOVSXD RDX,EAX
IMUL RDX,RDX,-0x6db6db6d
SHR RDX,0x20
ADD EDX,EAX
MOV ECX,EDX
SAR ECX,0x2
CDQ
SUB ECX,EDX
MOV EDX,ECX
SHL EDX,0x3
SUB EDX,ECX
SUB EAX,EDX
MOV dword ptr [RBP + -0x4],EAX
MOV EAX,dword ptr [RBP + -0x4]
POP RBP
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
int4 local_20;
int4 local_1c;
iVar1 = param_1 / 100;
iVar2 = param_1 / 400;
local_20 = param_1 >> 2;
local_1c = param_1 - local_20;
if (iVar1 != 0) {
local_1c = local_1c + iVar1;
local_20 = local_20 - iVar1;
}
if (iVar2 != 0) {
local_1c = local_1c - iVar2;
local_20 = local_20 + iVar2;
}
return (local_1c + local_20 * 2) % 7;
} |
5,049 | func0 |
#include <assert.h>
| int func0(int N) {
int hund1 = N / 100;
int hund4 = N / 400;
int leap = N >> 2;
int ordd = N - leap;
if (hund1) {
ordd += hund1;
leap -= hund1;
}
if (hund4) {
ordd -= hund4;
leap += hund4;
}
int days = ordd + leap * 2;
int odd = days % 7;
return odd;
}
| int main() {
assert(func0(100) == 5);
assert(func0(50) == 6);
assert(func0(75) == 2);
return 0;
}
| O1 | c | func0:
endbr64
movslq %edi,%rax
imul $0x51eb851f,%rax,%rax
mov %rax,%rsi
sar $0x25,%rsi
mov %rsi,%rcx
mov %edi,%esi
sar $0x1f,%esi
sar $0x27,%rax
sub %esi,%eax
mov %edi,%edx
sar $0x2,%edx
sub %edx,%edi
sub %esi,%ecx
je 115b <func0+0x32>
add %ecx,%edi
sub %ecx,%edx
test %eax,%eax
je 1163 <func0+0x3a>
sub %eax,%edi
add %eax,%edx
lea (%rdi,%rdx,2),%edx
movslq %edx,%rax
imul $0xffffffff92492493,%rax,%rax
shr $0x20,%rax
add %edx,%eax
sar $0x2,%eax
mov %edx,%ecx
sar $0x1f,%ecx
sub %ecx,%eax
lea 0x0(,%rax,8),%ecx
sub %eax,%ecx
mov %edx,%eax
sub %ecx,%eax
retq
| func0:
endbr64
movsxd rax, edi
imul rax, 51EB851Fh
mov rsi, rax
sar rsi, 25h
mov rcx, rsi
mov esi, edi
sar esi, 1Fh
sar rax, 27h
sub eax, esi
mov edx, edi
sar edx, 2
sub edi, edx
sub ecx, esi
jz short loc_115B
add edi, ecx
sub edx, ecx
loc_115B:
test eax, eax
jz short loc_1163
sub edi, eax
add edx, eax
loc_1163:
lea edx, [rdi+rdx*2]
movsxd rax, edx
imul rax, 0FFFFFFFF92492493h
shr rax, 20h
add eax, edx
sar eax, 2
mov ecx, edx
sar ecx, 1Fh
sub eax, ecx
lea ecx, ds:0[rax*8]
sub ecx, eax
mov eax, edx
sub eax, ecx
retn | long long func0(int a1)
{
int v2; // eax
int v3; // edx
int v4; // edi
int v5; // ecx
v2 = a1 / 400;
v3 = a1 >> 2;
v4 = a1 - (a1 >> 2);
v5 = a1 / 100;
if ( a1 / 100 )
{
v4 += v5;
v3 -= v5;
}
if ( v2 )
{
v4 -= v2;
v3 += v2;
}
return (unsigned int)((v4 + 2 * v3) % 7);
} | func0:
ENDBR64
MOVSXD RAX,EDI
IMUL RAX,RAX,0x51eb851f
MOV RSI,RAX
SAR RSI,0x25
MOV RCX,RSI
MOV ESI,EDI
SAR ESI,0x1f
SAR RAX,0x27
SUB EAX,ESI
MOV EDX,EDI
SAR EDX,0x2
SUB EDI,EDX
SUB ECX,ESI
JZ 0x0010115b
ADD EDI,ECX
SUB EDX,ECX
LAB_0010115b:
TEST EAX,EAX
JZ 0x00101163
SUB EDI,EAX
ADD EDX,EAX
LAB_00101163:
LEA EDX,[RDI + RDX*0x2]
MOVSXD RAX,EDX
IMUL RAX,RAX,-0x6db6db6d
SHR RAX,0x20
ADD EAX,EDX
SAR EAX,0x2
MOV ECX,EDX
SAR ECX,0x1f
SUB EAX,ECX
LEA ECX,[RAX*0x8]
SUB ECX,EAX
MOV EAX,EDX
SUB EAX,ECX
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
int iVar3;
iVar2 = param_1 / 100;
iVar1 = param_1 / 400;
iVar3 = param_1 >> 2;
param_1 = param_1 - iVar3;
if (iVar2 != 0) {
param_1 = param_1 + iVar2;
iVar3 = iVar3 - iVar2;
}
if (iVar1 != 0) {
param_1 = param_1 - iVar1;
iVar3 = iVar3 + iVar1;
}
return (param_1 + iVar3 * 2) % 7;
} |
5,050 | func0 |
#include <assert.h>
| int func0(int N) {
int hund1 = N / 100;
int hund4 = N / 400;
int leap = N >> 2;
int ordd = N - leap;
if (hund1) {
ordd += hund1;
leap -= hund1;
}
if (hund4) {
ordd -= hund4;
leap += hund4;
}
int days = ordd + leap * 2;
int odd = days % 7;
return odd;
}
| int main() {
assert(func0(100) == 5);
assert(func0(50) == 6);
assert(func0(75) == 2);
return 0;
}
| O2 | c | func0:
endbr64
movslq %edi,%rax
mov %edi,%edx
imul $0x51eb851f,%rax,%rax
sar $0x2,%edx
mov %rax,%rsi
sar $0x27,%rax
sar $0x25,%rsi
mov %rsi,%rcx
mov %edi,%esi
sub %edx,%edi
sar $0x1f,%esi
sub %esi,%eax
sub %esi,%ecx
je 1172 <func0+0x32>
add %ecx,%edi
sub %ecx,%edx
test %eax,%eax
je 117a <func0+0x3a>
sub %eax,%edi
add %eax,%edx
lea (%rdi,%rdx,2),%edx
movslq %edx,%rax
mov %edx,%ecx
imul $0xffffffff92492493,%rax,%rax
sar $0x1f,%ecx
shr $0x20,%rax
add %edx,%eax
sar $0x2,%eax
sub %ecx,%eax
lea 0x0(,%rax,8),%ecx
sub %eax,%ecx
mov %edx,%eax
sub %ecx,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
movsxd rax, edi
mov edx, edi
imul rax, 51EB851Fh
sar edx, 2
mov rsi, rax
sar rax, 27h
sar rsi, 25h
mov rcx, rsi
mov esi, edi
sub edi, edx
sar esi, 1Fh
sub eax, esi
sub ecx, esi
jz short loc_1172
add edi, ecx
sub edx, ecx
loc_1172:
test eax, eax
jz short loc_117A
sub edi, eax
add edx, eax
loc_117A:
lea edx, [rdi+rdx*2]
movsxd rax, edx
mov ecx, edx
imul rax, 0FFFFFFFF92492493h
sar ecx, 1Fh
shr rax, 20h
add eax, edx
sar eax, 2
sub eax, ecx
lea ecx, ds:0[rax*8]
sub ecx, eax
mov eax, edx
sub eax, ecx
retn | long long func0(int a1)
{
int v1; // edx
long long v2; // rax
int v5; // edi
int v6; // eax
int v7; // ecx
v1 = a1 >> 2;
v2 = (1374389535LL * a1) >> 39;
v5 = a1 - (a1 >> 2);
v6 = v2 - (a1 >> 31);
v7 = a1 / 100;
if ( a1 / 100 )
{
v5 += v7;
v1 -= v7;
}
if ( v6 )
{
v5 -= v6;
v1 += v6;
}
return (unsigned int)((v5 + 2 * v1) % 7);
} | func0:
ENDBR64
MOVSXD RAX,EDI
MOV EDX,EDI
IMUL RAX,RAX,0x51eb851f
SAR EDX,0x2
MOV RSI,RAX
SAR RAX,0x27
SAR RSI,0x25
MOV RCX,RSI
MOV ESI,EDI
SUB EDI,EDX
SAR ESI,0x1f
SUB EAX,ESI
SUB ECX,ESI
JZ 0x00101172
ADD EDI,ECX
SUB EDX,ECX
LAB_00101172:
TEST EAX,EAX
JZ 0x0010117a
SUB EDI,EAX
ADD EDX,EAX
LAB_0010117a:
LEA EDX,[RDI + RDX*0x2]
MOVSXD RAX,EDX
MOV ECX,EDX
IMUL RAX,RAX,-0x6db6db6d
SAR ECX,0x1f
SHR RAX,0x20
ADD EAX,EDX
SAR EAX,0x2
SUB EAX,ECX
LEA ECX,[RAX*0x8]
SUB ECX,EAX
MOV EAX,EDX
SUB EAX,ECX
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
int iVar3;
iVar3 = param_1 >> 2;
iVar1 = param_1 / 400;
iVar2 = param_1 / 100;
param_1 = param_1 - iVar3;
if (iVar2 != 0) {
param_1 = param_1 + iVar2;
iVar3 = iVar3 - iVar2;
}
if (iVar1 != 0) {
param_1 = param_1 - iVar1;
iVar3 = iVar3 + iVar1;
}
return (param_1 + iVar3 * 2) % 7;
} |
5,051 | func0 |
#include <assert.h>
| int func0(int N) {
int hund1 = N / 100;
int hund4 = N / 400;
int leap = N >> 2;
int ordd = N - leap;
if (hund1) {
ordd += hund1;
leap -= hund1;
}
if (hund4) {
ordd -= hund4;
leap += hund4;
}
int days = ordd + leap * 2;
int odd = days % 7;
return odd;
}
| int main() {
assert(func0(100) == 5);
assert(func0(50) == 6);
assert(func0(75) == 2);
return 0;
}
| O3 | c | func0:
endbr64
movslq %edi,%rax
mov %edi,%edx
imul $0x51eb851f,%rax,%rax
sar $0x2,%edx
mov %rax,%rsi
sar $0x27,%rax
sar $0x25,%rsi
mov %rsi,%rcx
mov %edi,%esi
sub %edx,%edi
sar $0x1f,%esi
sub %esi,%eax
sub %esi,%ecx
je 1172 <func0+0x32>
add %ecx,%edi
sub %ecx,%edx
test %eax,%eax
je 117a <func0+0x3a>
sub %eax,%edi
add %eax,%edx
lea (%rdi,%rdx,2),%edx
movslq %edx,%rax
mov %edx,%ecx
imul $0xffffffff92492493,%rax,%rax
sar $0x1f,%ecx
shr $0x20,%rax
add %edx,%eax
sar $0x2,%eax
sub %ecx,%eax
lea 0x0(,%rax,8),%ecx
sub %eax,%ecx
mov %edx,%eax
sub %ecx,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
movsxd rax, edi
mov edx, edi
imul rax, 51EB851Fh
sar edx, 2
mov rsi, rax
sar rax, 27h
sar rsi, 25h
mov rcx, rsi
mov esi, edi
sub edi, edx
sar esi, 1Fh
sub eax, esi
sub ecx, esi
jz short loc_1172
add edi, ecx
sub edx, ecx
loc_1172:
test eax, eax
jz short loc_117A
sub edi, eax
add edx, eax
loc_117A:
lea edx, [rdi+rdx*2]
movsxd rax, edx
mov ecx, edx
imul rax, 0FFFFFFFF92492493h
sar ecx, 1Fh
shr rax, 20h
add eax, edx
sar eax, 2
sub eax, ecx
lea ecx, ds:0[rax*8]
sub ecx, eax
mov eax, edx
sub eax, ecx
retn | long long func0(int a1)
{
int v1; // edx
long long v2; // rax
int v5; // edi
int v6; // eax
int v7; // ecx
v1 = a1 >> 2;
v2 = (1374389535LL * a1) >> 39;
v5 = a1 - (a1 >> 2);
v6 = v2 - (a1 >> 31);
v7 = a1 / 100;
if ( a1 / 100 )
{
v5 += v7;
v1 -= v7;
}
if ( v6 )
{
v5 -= v6;
v1 += v6;
}
return (unsigned int)((v5 + 2 * v1) % 7);
} | func0:
ENDBR64
MOVSXD RAX,EDI
MOV EDX,EDI
IMUL RAX,RAX,0x51eb851f
SAR EDX,0x2
MOV RSI,RAX
SAR RAX,0x27
SAR RSI,0x25
MOV RCX,RSI
MOV ESI,EDI
SUB EDI,EDX
SAR ESI,0x1f
SUB EAX,ESI
SUB ECX,ESI
JZ 0x00101172
ADD EDI,ECX
SUB EDX,ECX
LAB_00101172:
TEST EAX,EAX
JZ 0x0010117a
SUB EDI,EAX
ADD EDX,EAX
LAB_0010117a:
LEA EDX,[RDI + RDX*0x2]
MOVSXD RAX,EDX
MOV ECX,EDX
IMUL RAX,RAX,-0x6db6db6d
SAR ECX,0x1f
SHR RAX,0x20
ADD EAX,EDX
SAR EAX,0x2
SUB EAX,ECX
LEA ECX,[RAX*0x8]
SUB ECX,EAX
MOV EAX,EDX
SUB EAX,ECX
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
int iVar3;
iVar3 = param_1 >> 2;
iVar1 = param_1 / 400;
iVar2 = param_1 / 100;
param_1 = param_1 - iVar3;
if (iVar2 != 0) {
param_1 = param_1 + iVar2;
iVar3 = iVar3 - iVar2;
}
if (iVar1 != 0) {
param_1 = param_1 - iVar1;
iVar3 = iVar3 + iVar1;
}
return (param_1 + iVar3 * 2) % 7;
} |
5,052 | func0 | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int length;
int *array;
} Result;
void compareArrays(int *array1, int *array2, int size) {
for (int i = 0; i < size; i++) {
assert(array1[i] == array2[i]);
}
}
| Result func0(int **list, int size, int *sizes) {
Result result;
int maxLength = 0;
int *maxList = NULL;
for (int i = 0; i < size; i++) {
if (sizes[i] > maxLength) {
maxLength = sizes[i];
maxList = list[i];
}
}
result.length = maxLength;
result.array = maxList;
return result;
}
| int main() {
int arr1[] = {0};
int arr2[] = {1, 3};
int arr3[] = {5, 7};
int arr4[] = {9, 11};
int arr5[] = {13, 15, 17};
int *list1[] = {arr1, arr2, arr3, arr4, arr5};
int sizes1[] = {1, 2, 2, 2, 3};
Result res1 = func0(list1, 5, sizes1);
assert(res1.length == 3);
compareArrays(res1.array, arr5, 3);
int arr6[] = {1};
int arr7[] = {5, 7};
int arr8[] = {10, 12, 14, 15};
int *list2[] = {arr6, arr7, arr8};
int sizes2[] = {1, 2, 4};
Result res2 = func0(list2, 3, sizes2);
assert(res2.length == 4);
compareArrays(res2.array, arr8, 4);
int arr9[] = {5};
int arr10[] = {15, 20, 25};
int *list3[] = {arr9, arr10};
int sizes3[] = {1, 3};
Result res3 = func0(list3, 2, sizes3);
assert(res3.length == 3);
compareArrays(res3.array, arr10, 3);
printf("All tests passed successfully!\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
mov %rdi,-0x30(%rbp)
mov %esi,-0x34(%rbp)
mov %rdx,-0x40(%rbp)
movl $0x0,-0x28(%rbp)
movq $0x0,-0x20(%rbp)
movl $0x0,-0x24(%rbp)
jmp 1287 <func0+0x7f>
mov -0x24(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x40(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cmp %eax,-0x28(%rbp)
jge 1283 <func0+0x7b>
mov -0x24(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x40(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
mov %eax,-0x28(%rbp)
mov -0x24(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x30(%rbp),%rax
add %rdx,%rax
mov (%rax),%rax
mov %rax,-0x20(%rbp)
addl $0x1,-0x24(%rbp)
mov -0x24(%rbp),%eax
cmp -0x34(%rbp),%eax
jl 1234 <func0+0x2c>
mov -0x28(%rbp),%eax
mov %eax,-0x18(%rbp)
mov -0x20(%rbp),%rax
mov %rax,-0x10(%rbp)
mov -0x18(%rbp),%rax
mov -0x10(%rbp),%rdx
mov %rax,%rcx
mov %rdx,%rbx
mov %ecx,%eax
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
push rbx
mov [rbp+var_38], rdi
mov [rbp+var_3C], esi
mov [rbp+var_48], rdx
mov [rbp+var_30], 0
mov [rbp+var_28], 0
mov [rbp+var_2C], 0
jmp short loc_1290
loc_123D:
mov eax, [rbp+var_2C]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_48]
add rax, rdx
mov eax, [rax]
cmp [rbp+var_30], eax
jge short loc_128C
mov eax, [rbp+var_2C]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_48]
add rax, rdx
mov eax, [rax]
mov [rbp+var_30], eax
mov eax, [rbp+var_2C]
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_38]
add rax, rdx
mov rax, [rax]
mov [rbp+var_28], rax
loc_128C:
add [rbp+var_2C], 1
loc_1290:
mov eax, [rbp+var_2C]
cmp eax, [rbp+var_3C]
jl short loc_123D
mov eax, [rbp+var_30]
mov dword ptr [rbp+var_20], eax
mov rax, [rbp+var_28]
mov [rbp+var_18], rax
mov rax, [rbp+var_20]
mov rdx, [rbp+var_18]
mov rsi, rax
mov rdi, rdx
mov rcx, rax
mov rbx, rdx
mov eax, esi
mov rdx, rbx
mov rbx, [rbp+var_8]
leave
retn | long long func0(long long a1, int a2, long long a3)
{
unsigned int v4; // [rsp+18h] [rbp-30h]
int i; // [rsp+1Ch] [rbp-2Ch]
v4 = 0;
for ( i = 0; i < a2; ++i )
{
if ( (signed int)v4 < *(_DWORD *)(4LL * i + a3) )
v4 = *(_DWORD *)(4LL * i + a3);
}
return v4;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
PUSH RBX
MOV qword ptr [RBP + -0x38],RDI
MOV dword ptr [RBP + -0x3c],ESI
MOV qword ptr [RBP + -0x48],RDX
MOV dword ptr [RBP + -0x30],0x0
MOV qword ptr [RBP + -0x28],0x0
MOV dword ptr [RBP + -0x2c],0x0
JMP 0x00101290
LAB_0010123d:
MOV EAX,dword ptr [RBP + -0x2c]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x48]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
CMP dword ptr [RBP + -0x30],EAX
JGE 0x0010128c
MOV EAX,dword ptr [RBP + -0x2c]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x48]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
MOV dword ptr [RBP + -0x30],EAX
MOV EAX,dword ptr [RBP + -0x2c]
CDQE
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x38]
ADD RAX,RDX
MOV RAX,qword ptr [RAX]
MOV qword ptr [RBP + -0x28],RAX
LAB_0010128c:
ADD dword ptr [RBP + -0x2c],0x1
LAB_00101290:
MOV EAX,dword ptr [RBP + -0x2c]
CMP EAX,dword ptr [RBP + -0x3c]
JL 0x0010123d
MOV EAX,dword ptr [RBP + -0x30]
MOV dword ptr [RBP + -0x20],EAX
MOV RAX,qword ptr [RBP + -0x28]
MOV qword ptr [RBP + -0x18],RAX
MOV RAX,qword ptr [RBP + -0x20]
MOV RDX,qword ptr [RBP + -0x18]
MOV RSI,RAX
MOV RDI,RDX
MOV RCX,RAX
MOV RBX,RDX
MOV EAX,ESI
MOV RDX,RBX
MOV RBX,qword ptr [RBP + -0x8]
LEAVE
RET | int [16] func0(long param_1,int param_2,long param_3)
{
int auVar1 [16];
int4 local_38;
int4 local_34;
int8 local_30;
local_38 = 0;
local_30 = 0;
for (local_34 = 0; local_34 < param_2; local_34 = local_34 + 1) {
if ((int)local_38 < *(int *)(param_3 + (long)local_34 * 4)) {
local_38 = *(uint *)(param_3 + (long)local_34 * 4);
local_30 = *(int8 *)(param_1 + (long)local_34 * 8);
}
}
auVar1._4_4_ = 0;
auVar1._0_4_ = local_38;
auVar1._8_8_ = local_30;
return auVar1;
} |
5,053 | func0 | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int length;
int *array;
} Result;
void compareArrays(int *array1, int *array2, int size) {
for (int i = 0; i < size; i++) {
assert(array1[i] == array2[i]);
}
}
| Result func0(int **list, int size, int *sizes) {
Result result;
int maxLength = 0;
int *maxList = NULL;
for (int i = 0; i < size; i++) {
if (sizes[i] > maxLength) {
maxLength = sizes[i];
maxList = list[i];
}
}
result.length = maxLength;
result.array = maxList;
return result;
}
| int main() {
int arr1[] = {0};
int arr2[] = {1, 3};
int arr3[] = {5, 7};
int arr4[] = {9, 11};
int arr5[] = {13, 15, 17};
int *list1[] = {arr1, arr2, arr3, arr4, arr5};
int sizes1[] = {1, 2, 2, 2, 3};
Result res1 = func0(list1, 5, sizes1);
assert(res1.length == 3);
compareArrays(res1.array, arr5, 3);
int arr6[] = {1};
int arr7[] = {5, 7};
int arr8[] = {10, 12, 14, 15};
int *list2[] = {arr6, arr7, arr8};
int sizes2[] = {1, 2, 4};
Result res2 = func0(list2, 3, sizes2);
assert(res2.length == 4);
compareArrays(res2.array, arr8, 4);
int arr9[] = {5};
int arr10[] = {15, 20, 25};
int *list3[] = {arr9, arr10};
int sizes3[] = {1, 3};
Result res3 = func0(list3, 2, sizes3);
assert(res3.length == 3);
compareArrays(res3.array, arr10, 3);
printf("All tests passed successfully!\n");
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 120c <func0+0x39>
lea -0x1(%rsi),%r8d
mov $0x0,%ecx
mov $0x0,%r9d
mov $0x0,%eax
jmp 11fd <func0+0x2a>
lea 0x1(%rcx),%rsi
cmp %r8,%rcx
je 1217 <func0+0x44>
mov %rsi,%rcx
mov (%rdx,%rcx,4),%esi
cmp %eax,%esi
jle 11f1 <func0+0x1e>
mov (%rdi,%rcx,8),%r9
mov %esi,%eax
jmp 11f1 <func0+0x1e>
mov $0x0,%r9d
mov $0x0,%eax
mov %eax,%eax
mov %r9,%rdx
retq
| func0:
endbr64
test esi, esi
jle short loc_1204
mov esi, esi
mov ecx, 0
mov r9d, 0
mov eax, 0
jmp short loc_11F2
loc_11E9:
add rcx, 1
cmp rcx, rsi
jz short loc_120F
loc_11F2:
mov r8d, [rdx+rcx*4]
cmp r8d, eax
jle short loc_11E9
mov r9, [rdi+rcx*8]
mov eax, r8d
jmp short loc_11E9
loc_1204:
mov r9d, 0
mov eax, 0
loc_120F:
mov rdx, r9
retn | long long func0(long long a1, int a2, long long a3)
{
long long v3; // rcx
long long result; // rax
int v5; // r8d
if ( a2 <= 0 )
return 0LL;
v3 = 0LL;
result = 0LL;
do
{
v5 = *(_DWORD *)(a3 + 4 * v3);
if ( v5 > (int)result )
result = (unsigned int)v5;
++v3;
}
while ( v3 != a2 );
return result;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101204
MOV ESI,ESI
MOV ECX,0x0
MOV R9D,0x0
MOV EAX,0x0
JMP 0x001011f2
LAB_001011e9:
ADD RCX,0x1
CMP RCX,RSI
JZ 0x0010120f
LAB_001011f2:
MOV R8D,dword ptr [RDX + RCX*0x4]
CMP R8D,EAX
JLE 0x001011e9
MOV R9,qword ptr [RDI + RCX*0x8]
MOV EAX,R8D
JMP 0x001011e9
LAB_00101204:
MOV R9D,0x0
MOV EAX,0x0
LAB_0010120f:
MOV RDX,R9
RET | int1 [16] func0(long param_1,uint param_2,long param_3)
{
uint uVar1;
ulong uVar2;
ulong uVar3;
int8 uVar4;
int1 auVar5 [16];
if ((int)param_2 < 1) {
uVar4 = 0;
uVar2 = 0;
}
else {
uVar3 = 0;
uVar4 = 0;
uVar2 = 0;
do {
uVar1 = *(uint *)(param_3 + uVar3 * 4);
if ((int)uVar2 < (int)uVar1) {
uVar4 = *(int8 *)(param_1 + uVar3 * 8);
uVar2 = (ulong)uVar1;
}
uVar3 = uVar3 + 1;
} while (uVar3 != param_2);
}
auVar5._8_8_ = uVar4;
auVar5._0_8_ = uVar2;
return auVar5;
} |
5,054 | func0 | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int length;
int *array;
} Result;
void compareArrays(int *array1, int *array2, int size) {
for (int i = 0; i < size; i++) {
assert(array1[i] == array2[i]);
}
}
| Result func0(int **list, int size, int *sizes) {
Result result;
int maxLength = 0;
int *maxList = NULL;
for (int i = 0; i < size; i++) {
if (sizes[i] > maxLength) {
maxLength = sizes[i];
maxList = list[i];
}
}
result.length = maxLength;
result.array = maxList;
return result;
}
| int main() {
int arr1[] = {0};
int arr2[] = {1, 3};
int arr3[] = {5, 7};
int arr4[] = {9, 11};
int arr5[] = {13, 15, 17};
int *list1[] = {arr1, arr2, arr3, arr4, arr5};
int sizes1[] = {1, 2, 2, 2, 3};
Result res1 = func0(list1, 5, sizes1);
assert(res1.length == 3);
compareArrays(res1.array, arr5, 3);
int arr6[] = {1};
int arr7[] = {5, 7};
int arr8[] = {10, 12, 14, 15};
int *list2[] = {arr6, arr7, arr8};
int sizes2[] = {1, 2, 4};
Result res2 = func0(list2, 3, sizes2);
assert(res2.length == 4);
compareArrays(res2.array, arr8, 4);
int arr9[] = {5};
int arr10[] = {15, 20, 25};
int *list3[] = {arr9, arr10};
int sizes3[] = {1, 3};
Result res3 = func0(list3, 2, sizes3);
assert(res3.length == 3);
compareArrays(res3.array, arr10, 3);
printf("All tests passed successfully!\n");
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 1228 <func0+0x38>
lea -0x1(%rsi),%r8d
xor %ecx,%ecx
xor %r9d,%r9d
xor %eax,%eax
jmp 120b <func0+0x1b>
nopl (%rax)
mov %rsi,%rcx
mov (%rdx,%rcx,4),%esi
cmp %eax,%esi
jle 1218 <func0+0x28>
mov (%rdi,%rcx,8),%r9
mov %esi,%eax
lea 0x1(%rcx),%rsi
cmp %r8,%rcx
jne 1208 <func0+0x18>
mov %r9,%rdx
retq
nopl (%rax)
xor %r9d,%r9d
xor %eax,%eax
mov %r9,%rdx
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_14A8
movsxd rsi, esi
xor ecx, ecx
xor r9d, r9d
xor eax, eax
nop word ptr [rax+rax+00h]
loc_1488:
mov r8d, [rdx+rcx*4]
cmp r8d, eax
jle short loc_1498
mov r9, [rdi+rcx*8]
mov eax, r8d
loc_1498:
add rcx, 1
cmp rcx, rsi
jnz short loc_1488
mov rdx, r9
retn
loc_14A8:
xor r9d, r9d
xor eax, eax
mov rdx, r9
retn | long long func0(long long a1, int a2, long long a3)
{
long long v3; // rcx
long long result; // rax
int v5; // r8d
if ( a2 <= 0 )
return 0LL;
v3 = 0LL;
result = 0LL;
do
{
v5 = *(_DWORD *)(a3 + 4 * v3);
if ( v5 > (int)result )
result = (unsigned int)v5;
++v3;
}
while ( v3 != a2 );
return result;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001014a8
MOVSXD RSI,ESI
XOR ECX,ECX
XOR R9D,R9D
XOR EAX,EAX
NOP word ptr [RAX + RAX*0x1]
LAB_00101488:
MOV R8D,dword ptr [RDX + RCX*0x4]
CMP R8D,EAX
JLE 0x00101498
MOV R9,qword ptr [RDI + RCX*0x8]
MOV EAX,R8D
LAB_00101498:
ADD RCX,0x1
CMP RCX,RSI
JNZ 0x00101488
MOV RDX,R9
RET
LAB_001014a8:
XOR R9D,R9D
XOR EAX,EAX
MOV RDX,R9
RET | int1 [16] func0(long param_1,int param_2,long param_3)
{
uint uVar1;
ulong uVar2;
long lVar3;
int8 uVar4;
int1 auVar5 [16];
if (0 < param_2) {
lVar3 = 0;
uVar4 = 0;
uVar2 = 0;
do {
uVar1 = *(uint *)(param_3 + lVar3 * 4);
if ((int)uVar2 < (int)uVar1) {
uVar4 = *(int8 *)(param_1 + lVar3 * 8);
uVar2 = (ulong)uVar1;
}
lVar3 = lVar3 + 1;
} while (lVar3 != param_2);
auVar5._8_8_ = uVar4;
auVar5._0_8_ = uVar2;
return auVar5;
}
return ZEXT816(0);
} |
5,055 | func0 | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int length;
int *array;
} Result;
void compareArrays(int *array1, int *array2, int size) {
for (int i = 0; i < size; i++) {
assert(array1[i] == array2[i]);
}
}
| Result func0(int **list, int size, int *sizes) {
Result result;
int maxLength = 0;
int *maxList = NULL;
for (int i = 0; i < size; i++) {
if (sizes[i] > maxLength) {
maxLength = sizes[i];
maxList = list[i];
}
}
result.length = maxLength;
result.array = maxList;
return result;
}
| int main() {
int arr1[] = {0};
int arr2[] = {1, 3};
int arr3[] = {5, 7};
int arr4[] = {9, 11};
int arr5[] = {13, 15, 17};
int *list1[] = {arr1, arr2, arr3, arr4, arr5};
int sizes1[] = {1, 2, 2, 2, 3};
Result res1 = func0(list1, 5, sizes1);
assert(res1.length == 3);
compareArrays(res1.array, arr5, 3);
int arr6[] = {1};
int arr7[] = {5, 7};
int arr8[] = {10, 12, 14, 15};
int *list2[] = {arr6, arr7, arr8};
int sizes2[] = {1, 2, 4};
Result res2 = func0(list2, 3, sizes2);
assert(res2.length == 4);
compareArrays(res2.array, arr8, 4);
int arr9[] = {5};
int arr10[] = {15, 20, 25};
int *list3[] = {arr9, arr10};
int sizes3[] = {1, 3};
Result res3 = func0(list3, 2, sizes3);
assert(res3.length == 3);
compareArrays(res3.array, arr10, 3);
printf("All tests passed successfully!\n");
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 13b8 <func0+0x38>
lea -0x1(%rsi),%r8d
xor %ecx,%ecx
xor %r9d,%r9d
xor %eax,%eax
jmp 139b <func0+0x1b>
nopl (%rax)
mov %rsi,%rcx
mov (%rdx,%rcx,4),%esi
cmp %eax,%esi
jle 13a8 <func0+0x28>
mov (%rdi,%rcx,8),%r9
mov %esi,%eax
lea 0x1(%rcx),%rsi
cmp %r8,%rcx
jne 1398 <func0+0x18>
mov %r9,%rdx
retq
nopl (%rax)
xor %r9d,%r9d
xor %eax,%eax
mov %r9,%rdx
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_1248
movsxd rsi, esi
xor ecx, ecx
xor r9d, r9d
xor eax, eax
nop word ptr [rax+rax+00h]
loc_1228:
mov r8d, [rdx+rcx*4]
cmp r8d, eax
jle short loc_1238
mov r9, [rdi+rcx*8]
mov eax, r8d
loc_1238:
add rcx, 1
cmp rsi, rcx
jnz short loc_1228
mov rdx, r9
retn
loc_1248:
xor r9d, r9d
xor eax, eax
mov rdx, r9
retn | long long func0(long long a1, int a2, long long a3)
{
long long v3; // rcx
long long result; // rax
int v5; // r8d
if ( a2 <= 0 )
return 0LL;
v3 = 0LL;
result = 0LL;
do
{
v5 = *(_DWORD *)(a3 + 4 * v3);
if ( v5 > (int)result )
result = (unsigned int)v5;
++v3;
}
while ( a2 != v3 );
return result;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101248
MOVSXD RSI,ESI
XOR ECX,ECX
XOR R9D,R9D
XOR EAX,EAX
NOP word ptr [RAX + RAX*0x1]
LAB_00101228:
MOV R8D,dword ptr [RDX + RCX*0x4]
CMP R8D,EAX
JLE 0x00101238
MOV R9,qword ptr [RDI + RCX*0x8]
MOV EAX,R8D
LAB_00101238:
ADD RCX,0x1
CMP RSI,RCX
JNZ 0x00101228
MOV RDX,R9
RET
LAB_00101248:
XOR R9D,R9D
XOR EAX,EAX
MOV RDX,R9
RET | int [16] func0(long param_1,int param_2,long param_3)
{
uint uVar1;
ulong uVar2;
long lVar3;
int8 uVar4;
int auVar5 [16];
if (0 < param_2) {
lVar3 = 0;
uVar4 = 0;
uVar2 = 0;
do {
uVar1 = *(uint *)(param_3 + lVar3 * 4);
if ((int)uVar2 < (int)uVar1) {
uVar4 = *(int8 *)(param_1 + lVar3 * 8);
uVar2 = (ulong)uVar1;
}
lVar3 = lVar3 + 1;
} while (param_2 != lVar3);
auVar5._8_8_ = uVar4;
auVar5._0_8_ = uVar2;
return auVar5;
}
return ZEXT816(0);
} |
5,056 | func0 |
#include <assert.h>
#include <stdio.h>
#define MOD 1000000007
| int func0(int n, int k) {
int dp[n + 1];
dp[0] = 0;
dp[1] = k;
dp[2] = k * k;
for (int i = 3; i <= n; i++) {
dp[i] = ((k - 1) * (dp[i - 1] + dp[i - 2])) % MOD;
}
return dp[n];
}
| int main() {
assert(func0(2, 4) == 16);
assert(func0(3, 2) == 6);
assert(func0(4, 4) == 228);
printf("All test cases passed.\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
sub $0x38,%rsp
mov %edi,-0x34(%rbp)
mov %esi,-0x38(%rbp)
mov %fs:0x28,%rax
mov %rax,-0x18(%rbp)
xor %eax,%eax
mov %rsp,%rax
mov %rax,%rdi
mov -0x34(%rbp),%eax
add $0x1,%eax
movslq %eax,%rdx
sub $0x1,%rdx
mov %rdx,-0x28(%rbp)
movslq %eax,%rdx
mov %rdx,%r8
mov $0x0,%r9d
movslq %eax,%rdx
mov %rdx,%rcx
mov $0x0,%ebx
cltq
lea 0x0(,%rax,4),%rdx
mov $0x10,%eax
sub $0x1,%rax
add %rdx,%rax
mov $0x10,%ebx
mov $0x0,%edx
div %rbx
imul $0x10,%rax,%rax
mov %rax,%rdx
and $0xfffffffffffff000,%rdx
mov %rsp,%rbx
sub %rdx,%rbx
mov %rbx,%rdx
cmp %rdx,%rsp
je 122a <func0+0xa1>
sub $0x1000,%rsp
orq $0x0,0xff8(%rsp)
jmp 1213 <func0+0x8a>
mov %rax,%rdx
and $0xfff,%edx
sub %rdx,%rsp
mov %rax,%rdx
and $0xfff,%edx
test %rdx,%rdx
je 1254 <func0+0xcb>
and $0xfff,%eax
sub $0x8,%rax
add %rsp,%rax
orq $0x0,(%rax)
mov %rsp,%rax
add $0x3,%rax
shr $0x2,%rax
shl $0x2,%rax
mov %rax,-0x20(%rbp)
mov -0x20(%rbp),%rax
movl $0x0,(%rax)
mov -0x20(%rbp),%rax
mov -0x38(%rbp),%edx
mov %edx,0x4(%rax)
mov -0x38(%rbp),%eax
imul %eax,%eax
mov %eax,%edx
mov -0x20(%rbp),%rax
mov %edx,0x8(%rax)
movl $0x3,-0x2c(%rbp)
jmp 12f7 <func0+0x16e>
mov -0x38(%rbp),%eax
lea -0x1(%rax),%esi
mov -0x2c(%rbp),%eax
lea -0x1(%rax),%edx
mov -0x20(%rbp),%rax
movslq %edx,%rdx
mov (%rax,%rdx,4),%ecx
mov -0x2c(%rbp),%eax
lea -0x2(%rax),%edx
mov -0x20(%rbp),%rax
movslq %edx,%rdx
mov (%rax,%rdx,4),%eax
add %ecx,%eax
imul %eax,%esi
mov %esi,%edx
movslq %edx,%rax
imul $0x44b82f99,%rax,%rax
shr $0x20,%rax
mov %eax,%ecx
sar $0x1c,%ecx
mov %edx,%eax
sar $0x1f,%eax
sub %eax,%ecx
mov %ecx,%eax
imul $0x3b9aca07,%eax,%eax
sub %eax,%edx
mov %edx,%eax
mov -0x20(%rbp),%rdx
mov -0x2c(%rbp),%ecx
movslq %ecx,%rcx
mov %eax,(%rdx,%rcx,4)
addl $0x1,-0x2c(%rbp)
mov -0x2c(%rbp),%eax
cmp -0x34(%rbp),%eax
jle 1293 <func0+0x10a>
mov -0x20(%rbp),%rax
mov -0x34(%rbp),%edx
movslq %edx,%rdx
mov (%rax,%rdx,4),%eax
mov %rdi,%rsp
mov -0x18(%rbp),%rdi
xor %fs:0x28,%rdi
je 1323 <func0+0x19a>
callq 1080 <__stack_chk_fail@plt>
mov -0x8(%rbp),%rbx
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 30h
mov [rbp+var_24], edi
mov [rbp+var_28], esi
mov rax, fs:28h
mov [rbp+var_8], rax
xor eax, eax
mov rax, rsp
mov rdi, rax
mov eax, [rbp+var_24]
add eax, 1
movsxd rdx, eax
sub rdx, 1
mov [rbp+var_18], rdx
cdqe
lea rdx, ds:0[rax*4]
mov eax, 10h
sub rax, 1
add rax, rdx
mov esi, 10h
mov edx, 0
div rsi
imul rax, 10h
mov rcx, rax
and rcx, 0FFFFFFFFFFFFF000h
mov rdx, rsp
sub rdx, rcx
loc_11F8:
cmp rsp, rdx
jz short loc_120F
sub rsp, 1000h
or [rsp+1030h+var_38], 0
jmp short loc_11F8
loc_120F:
mov rdx, rax
and edx, 0FFFh
sub rsp, rdx
mov rdx, rax
and edx, 0FFFh
test rdx, rdx
jz short loc_1239
and eax, 0FFFh
sub rax, 8
add rax, rsp
or qword ptr [rax], 0
loc_1239:
mov rax, rsp
add rax, 3
shr rax, 2
shl rax, 2
mov [rbp+var_10], rax
mov rax, [rbp+var_10]
mov dword ptr [rax], 0
mov rax, [rbp+var_10]
mov edx, [rbp+var_28]
mov [rax+4], edx
mov eax, [rbp+var_28]
imul eax, eax
mov edx, eax
mov rax, [rbp+var_10]
mov [rax+8], edx
mov [rbp+var_1C], 3
jmp short loc_12D8
loc_1278:
mov eax, [rbp+var_28]
lea ecx, [rax-1]
mov eax, [rbp+var_1C]
lea edx, [rax-1]
mov rax, [rbp+var_10]
movsxd rdx, edx
mov esi, [rax+rdx*4]
mov eax, [rbp+var_1C]
lea edx, [rax-2]
mov rax, [rbp+var_10]
movsxd rdx, edx
mov eax, [rax+rdx*4]
add eax, esi
imul ecx, eax
mov edx, ecx
movsxd rax, edx
imul rax, 44B82F99h
shr rax, 20h
sar eax, 1Ch
mov ecx, edx
sar ecx, 1Fh
sub eax, ecx
imul ecx, eax, 3B9ACA07h
mov eax, edx
sub eax, ecx
mov rdx, [rbp+var_10]
mov ecx, [rbp+var_1C]
movsxd rcx, ecx
mov [rdx+rcx*4], eax
add [rbp+var_1C], 1
loc_12D8:
mov eax, [rbp+var_1C]
cmp eax, [rbp+var_24]
jle short loc_1278
mov rax, [rbp+var_10]
mov edx, [rbp+var_24]
movsxd rdx, edx
mov eax, [rax+rdx*4]
mov rsp, rdi
mov rdx, [rbp+var_8]
sub rdx, fs:28h
jz short locret_1304
call ___stack_chk_fail
locret_1304:
leave
retn | long long func0(int a1, int a2)
{
unsigned long long v2; // rax
void *v3; // rsp
_DWORD v5[2]; // [rsp+8h] [rbp-30h] BYREF
int v6; // [rsp+10h] [rbp-28h]
int v7; // [rsp+14h] [rbp-24h]
int i; // [rsp+1Ch] [rbp-1Ch]
long long v9; // [rsp+20h] [rbp-18h]
_DWORD *v10; // [rsp+28h] [rbp-10h]
unsigned long long v11; // [rsp+30h] [rbp-8h]
v7 = a1;
v6 = a2;
v11 = __readfsqword(0x28u);
v9 = a1 + 1 - 1LL;
v2 = 16 * ((4LL * (a1 + 1) + 15) / 0x10uLL);
while ( v5 != (_DWORD *)((char *)v5 - (v2 & 0xFFFFFFFFFFFFF000LL)) )
;
v3 = alloca(v2 & 0xFFF);
if ( (v2 & 0xFFF) != 0 )
*(_QWORD *)((char *)&v5[-2] + (v2 & 0xFFF)) = *(_QWORD *)((char *)&v5[-2] + (v2 & 0xFFF));
v10 = v5;
v5[0] = 0;
v5[1] = v6;
v6 *= v6;
for ( i = 3; i <= v7; ++i )
v10[i] = (v10[i - 1] + v10[i - 2]) * (v6 - 1) % 1000000007;
return (unsigned int)v10[v7];
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x30
MOV dword ptr [RBP + -0x24],EDI
MOV dword ptr [RBP + -0x28],ESI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x8],RAX
XOR EAX,EAX
MOV RAX,RSP
MOV RDI,RAX
MOV EAX,dword ptr [RBP + -0x24]
ADD EAX,0x1
MOVSXD RDX,EAX
SUB RDX,0x1
MOV qword ptr [RBP + -0x18],RDX
CDQE
LEA RDX,[RAX*0x4]
MOV EAX,0x10
SUB RAX,0x1
ADD RAX,RDX
MOV ESI,0x10
MOV EDX,0x0
DIV RSI
IMUL RAX,RAX,0x10
MOV RCX,RAX
AND RCX,-0x1000
MOV RDX,RSP
SUB RDX,RCX
LAB_001011f8:
CMP RSP,RDX
JZ 0x0010120f
SUB RSP,0x1000
OR qword ptr [RSP + 0xff8],0x0
JMP 0x001011f8
LAB_0010120f:
MOV RDX,RAX
AND EDX,0xfff
SUB RSP,RDX
MOV RDX,RAX
AND EDX,0xfff
TEST RDX,RDX
JZ 0x00101239
AND EAX,0xfff
SUB RAX,0x8
ADD RAX,RSP
OR qword ptr [RAX],0x0
LAB_00101239:
MOV RAX,RSP
ADD RAX,0x3
SHR RAX,0x2
SHL RAX,0x2
MOV qword ptr [RBP + -0x10],RAX
MOV RAX,qword ptr [RBP + -0x10]
MOV dword ptr [RAX],0x0
MOV RAX,qword ptr [RBP + -0x10]
MOV EDX,dword ptr [RBP + -0x28]
MOV dword ptr [RAX + 0x4],EDX
MOV EAX,dword ptr [RBP + -0x28]
IMUL EAX,EAX
MOV EDX,EAX
MOV RAX,qword ptr [RBP + -0x10]
MOV dword ptr [RAX + 0x8],EDX
MOV dword ptr [RBP + -0x1c],0x3
JMP 0x001012d8
LAB_00101278:
MOV EAX,dword ptr [RBP + -0x28]
LEA ECX,[RAX + -0x1]
MOV EAX,dword ptr [RBP + -0x1c]
LEA EDX,[RAX + -0x1]
MOV RAX,qword ptr [RBP + -0x10]
MOVSXD RDX,EDX
MOV ESI,dword ptr [RAX + RDX*0x4]
MOV EAX,dword ptr [RBP + -0x1c]
LEA EDX,[RAX + -0x2]
MOV RAX,qword ptr [RBP + -0x10]
MOVSXD RDX,EDX
MOV EAX,dword ptr [RAX + RDX*0x4]
ADD EAX,ESI
IMUL ECX,EAX
MOV EDX,ECX
MOVSXD RAX,EDX
IMUL RAX,RAX,0x44b82f99
SHR RAX,0x20
SAR EAX,0x1c
MOV ECX,EDX
SAR ECX,0x1f
SUB EAX,ECX
IMUL ECX,EAX,0x3b9aca07
MOV EAX,EDX
SUB EAX,ECX
MOV RDX,qword ptr [RBP + -0x10]
MOV ECX,dword ptr [RBP + -0x1c]
MOVSXD RCX,ECX
MOV dword ptr [RDX + RCX*0x4],EAX
ADD dword ptr [RBP + -0x1c],0x1
LAB_001012d8:
MOV EAX,dword ptr [RBP + -0x1c]
CMP EAX,dword ptr [RBP + -0x24]
JLE 0x00101278
MOV RAX,qword ptr [RBP + -0x10]
MOV EDX,dword ptr [RBP + -0x24]
MOVSXD RDX,EDX
MOV EAX,dword ptr [RAX + RDX*0x4]
MOV RSP,RDI
MOV RDX,qword ptr [RBP + -0x8]
SUB RDX,qword ptr FS:[0x28]
JZ 0x00101304
CALL 0x00101080
LAB_00101304:
LEAVE
RET | int4 func0(int param_1,int param_2)
{
long lVar1;
ulong uVar2;
int *puVar3;
long in_FS_OFFSET;
int auStack_38 [8];
int local_30;
int local_2c;
int local_24;
long local_20;
int *local_18;
long local_10;
local_2c = param_1;
local_30 = param_2;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_20 = (long)(param_1 + 1) + -1;
uVar2 = (((long)(param_1 + 1) * 4 + 0xfU) / 0x10) * 0x10;
for (puVar3 = auStack_38; puVar3 != auStack_38 + -(uVar2 & 0xfffffffffffff000);
puVar3 = puVar3 + -0x1000) {
*(int8 *)(puVar3 + -8) = *(int8 *)(puVar3 + -8);
}
lVar1 = -(ulong)((uint)uVar2 & 0xfff);
if ((uVar2 & 0xfff) != 0) {
*(int8 *)(puVar3 + ((ulong)((uint)uVar2 & 0xfff) - 8) + lVar1) =
*(int8 *)(puVar3 + ((ulong)((uint)uVar2 & 0xfff) - 8) + lVar1);
}
*(int4 *)(puVar3 + lVar1) = 0;
*(int *)(puVar3 + lVar1 + 4) = local_30;
*(int *)(puVar3 + lVar1 + 8) = local_30 * local_30;
for (local_24 = 3; local_24 <= local_2c; local_24 = local_24 + 1) {
*(int *)(puVar3 + (long)local_24 * 4 + lVar1) =
((local_30 + -1) *
(*(int *)(puVar3 + (long)(local_24 + -2) * 4 + lVar1) +
*(int *)(puVar3 + (long)(local_24 + -1) * 4 + lVar1))) % 0x3b9aca07;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
local_18 = puVar3 + lVar1;
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return *(int4 *)(puVar3 + (long)local_2c * 4 + lVar1);
} |
5,057 | func0 |
#include <assert.h>
#include <stdio.h>
#define MOD 1000000007
| int func0(int n, int k) {
int dp[n + 1];
dp[0] = 0;
dp[1] = k;
dp[2] = k * k;
for (int i = 3; i <= n; i++) {
dp[i] = ((k - 1) * (dp[i - 1] + dp[i - 2])) % MOD;
}
return dp[n];
}
| int main() {
assert(func0(2, 4) == 16);
assert(func0(3, 2) == 6);
assert(func0(4, 4) == 228);
printf("All test cases passed.\n");
return 0;
}
| O1 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x10,%rsp
mov %fs:0x28,%rax
mov %rax,-0x8(%rbp)
xor %eax,%eax
lea 0x1(%rdi),%eax
cltq
lea 0xf(,%rax,4),%rax
mov %rax,%rdx
and $0xfffffffffffffff0,%rdx
and $0xfffffffffffff000,%rax
mov %rsp,%rcx
sub %rax,%rcx
mov %rcx,%rax
cmp %rax,%rsp
je 11de <func0+0x55>
sub $0x1000,%rsp
orq $0x0,0xff8(%rsp)
jmp 11c7 <func0+0x3e>
mov %rdx,%rax
and $0xfff,%eax
sub %rax,%rsp
test %rax,%rax
je 11f4 <func0+0x6b>
orq $0x0,-0x8(%rsp,%rax,1)
lea 0x3(%rsp),%r9
mov %r9,%rax
shr $0x2,%rax
and $0xfffffffffffffffc,%r9
movl $0x0,0x0(,%rax,4)
mov %esi,0x4(,%rax,4)
mov %esi,%edx
imul %esi,%edx
mov %edx,0x8(,%rax,4)
cmp $0x2,%edi
jle 126a <func0+0xe1>
lea 0x4(%r9),%rcx
lea -0x3(%rdi),%eax
lea 0x8(%r9,%rax,4),%r8
sub $0x1,%esi
mov (%rcx),%eax
add 0x4(%rcx),%eax
imul %esi,%eax
movslq %eax,%rdx
imul $0x44b82f99,%rdx,%rdx
sar $0x3c,%rdx
mov %eax,%r10d
sar $0x1f,%r10d
sub %r10d,%edx
imul $0x3b9aca07,%edx,%edx
sub %edx,%eax
mov %eax,0x8(%rcx)
add $0x4,%rcx
cmp %r8,%rcx
jne 1236 <func0+0xad>
movslq %edi,%rdi
mov (%r9,%rdi,4),%eax
mov -0x8(%rbp),%rdi
xor %fs:0x28,%rdi
jne 1282 <func0+0xf9>
leaveq
retq
callq 1080 <__stack_chk_fail@plt>
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 10h
mov r8d, edi
mov rax, fs:28h
mov [rbp+var_8], rax
xor eax, eax
lea eax, [rdi+1]
cdqe
lea rax, ds:0Fh[rax*4]
mov rcx, rax
and rcx, 0FFFFFFFFFFFFFFF0h
and rax, 0FFFFFFFFFFFFF000h
mov rdx, rsp
sub rdx, rax
loc_11C7:
cmp rsp, rdx
jz short loc_11DE
sub rsp, 1000h
or [rsp+1010h+var_18], 0
jmp short loc_11C7
loc_11DE:
mov rax, rcx
and eax, 0FFFh
sub rsp, rax
test rax, rax
jz short loc_11F4
or [rsp+rax+10h+var_18], 0
loc_11F4:
lea r9, [rsp+10h+var_D]
mov rax, r9
shr rax, 2
and r9, 0FFFFFFFFFFFFFFFCh
mov ds:dword_0[rax*4], 0
mov dword ptr ds:byte_4[rax*4], esi
mov edx, esi
imul edx, esi
mov dword ptr ds:byte_8[rax*4], edx
cmp r8d, 2
jle short loc_126C
lea rcx, [r9+4]
lea eax, [r8-3]
lea rdi, [r9+rax*4+8]
sub esi, 1
loc_1238:
mov eax, [rcx]
add eax, [rcx+4]
imul eax, esi
movsxd rdx, eax
imul rdx, 44B82F99h
sar rdx, 3Ch
mov r10d, eax
sar r10d, 1Fh
sub edx, r10d
imul edx, 3B9ACA07h
sub eax, edx
mov [rcx+8], eax
add rcx, 4
cmp rcx, rdi
jnz short loc_1238
loc_126C:
movsxd r8, r8d
mov eax, [r9+r8*4]
mov rdx, [rbp+var_8]
sub rdx, fs:28h
jnz short loc_1284
leave
retn
loc_1284:
call ___stack_chk_fail | long long func0(int a1, int a2)
{
signed long long v3; // rax
void *v4; // rsp
unsigned long long v5; // rax
char *v6; // rcx
char *v7; // rdi
int v8; // esi
_BYTE v11[3]; // [rsp+8h] [rbp-10h] BYREF
char v12; // [rsp+Bh] [rbp-Dh] BYREF
int v13; // [rsp+Ch] [rbp-Ch] BYREF
unsigned long long v14; // [rsp+10h] [rbp-8h] BYREF
v14 = __readfsqword(0x28u);
while ( v11 != &v11[-((4LL * (a1 + 1) + 15) & 0xFFFFFFFFFFFFF000LL)] )
;
v3 = (4 * ((_WORD)a1 + 1) + 15) & 0xFF0;
v4 = alloca(v3);
if ( ((4 * ((_WORD)a1 + 1) + 15) & 0xFF0) != 0 )
*(_QWORD *)&v11[v3 - 8] = *(_QWORD *)&v11[v3 - 8];
v5 = (unsigned long long)&v12 >> 2;
*(_DWORD *)(4 * v5) = 0;
*(_DWORD *)&byte_4[4 * v5] = a2;
*(_DWORD *)&byte_8[4 * v5] = a2 * a2;
if ( a1 > 2 )
{
v6 = (char *)&v13;
v7 = (char *)&v14 + 4 * (unsigned int)(a1 - 3);
v8 = a2 - 1;
do
{
*((_DWORD *)v6 + 2) = v8 * (*((_DWORD *)v6 + 1) + *(_DWORD *)v6) % 1000000007;
v6 += 4;
}
while ( v6 != v7 );
}
return *(unsigned int *)&v11[4 * a1];
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x10
MOV R8D,EDI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x8],RAX
XOR EAX,EAX
LEA EAX,[RDI + 0x1]
CDQE
LEA RAX,[0xf + RAX*0x4]
MOV RCX,RAX
AND RCX,-0x10
AND RAX,-0x1000
MOV RDX,RSP
SUB RDX,RAX
LAB_001011c7:
CMP RSP,RDX
JZ 0x001011de
SUB RSP,0x1000
OR qword ptr [RSP + 0xff8],0x0
JMP 0x001011c7
LAB_001011de:
MOV RAX,RCX
AND EAX,0xfff
SUB RSP,RAX
TEST RAX,RAX
JZ 0x001011f4
OR qword ptr [RSP + RAX*0x1 + -0x8],0x0
LAB_001011f4:
LEA R9,[RSP + 0x3]
MOV RAX,R9
SHR RAX,0x2
AND R9,-0x4
MOV dword ptr [RAX*0x4],0x0
MOV dword ptr [0x4 + RAX*0x4],ESI
MOV EDX,ESI
IMUL EDX,ESI
MOV dword ptr [0x8 + RAX*0x4],EDX
CMP R8D,0x2
JLE 0x0010126c
LEA RCX,[R9 + 0x4]
LEA EAX,[R8 + -0x3]
LEA RDI,[R9 + RAX*0x4 + 0x8]
SUB ESI,0x1
LAB_00101238:
MOV EAX,dword ptr [RCX]
ADD EAX,dword ptr [RCX + 0x4]
IMUL EAX,ESI
MOVSXD RDX,EAX
IMUL RDX,RDX,0x44b82f99
SAR RDX,0x3c
MOV R10D,EAX
SAR R10D,0x1f
SUB EDX,R10D
IMUL EDX,EDX,0x3b9aca07
SUB EAX,EDX
MOV dword ptr [RCX + 0x8],EAX
ADD RCX,0x4
CMP RCX,RDI
JNZ 0x00101238
LAB_0010126c:
MOVSXD R8,R8D
MOV EAX,dword ptr [R9 + R8*0x4]
MOV RDX,qword ptr [RBP + -0x8]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x00101284
LEAVE
RET
LAB_00101284:
CALL 0x00101080 | int4 func0(int param_1,int param_2)
{
long lVar1;
ulong uVar2;
int *piVar3;
int1 *puVar4;
long in_FS_OFFSET;
int1 auStack_18 [8];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
uVar2 = (long)(param_1 + 1) * 4 + 0xf;
for (puVar4 = auStack_18; puVar4 != auStack_18 + -(uVar2 & 0xfffffffffffff000);
puVar4 = puVar4 + -0x1000) {
*(int8 *)(puVar4 + -8) = *(int8 *)(puVar4 + -8);
}
uVar2 = (ulong)((uint)uVar2 & 0xff0);
lVar1 = -uVar2;
if (uVar2 != 0) {
*(int8 *)(puVar4 + -8) = *(int8 *)(puVar4 + -8);
}
uVar2 = (ulong)(puVar4 + lVar1 + 3) >> 2;
*(int4 *)(uVar2 * 4) = 0;
*(int *)(uVar2 * 4 + 4) = param_2;
*(int *)(uVar2 * 4 + 8) = param_2 * param_2;
if (2 < param_1) {
piVar3 = (int *)(puVar4 + lVar1 + 4);
do {
piVar3[2] = ((*piVar3 + piVar3[1]) * (param_2 + -1)) % 0x3b9aca07;
piVar3 = piVar3 + 1;
} while (piVar3 != (int *)(puVar4 + (ulong)(param_1 - 3) * 4 + lVar1 + 8));
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return *(int4 *)(puVar4 + (long)param_1 * 4 + lVar1);
}
/* WARNING: Subroutine does not return */
*(code **)(puVar4 + lVar1 + -8) = main;
__stack_chk_fail();
} |
5,058 | func0 |
#include <assert.h>
#include <stdio.h>
#define MOD 1000000007
| int func0(int n, int k) {
int dp[n + 1];
dp[0] = 0;
dp[1] = k;
dp[2] = k * k;
for (int i = 3; i <= n; i++) {
dp[i] = ((k - 1) * (dp[i - 1] + dp[i - 2])) % MOD;
}
return dp[n];
}
| int main() {
assert(func0(2, 4) == 16);
assert(func0(3, 2) == 6);
assert(func0(4, 4) == 228);
printf("All test cases passed.\n");
return 0;
}
| O2 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x10,%rsp
mov %fs:0x28,%rax
mov %rax,-0x8(%rbp)
xor %eax,%eax
lea 0x1(%rdi),%eax
mov %rsp,%rcx
cltq
lea 0xf(,%rax,4),%rax
mov %rax,%rdx
and $0xfffffffffffff000,%rax
sub %rax,%rcx
and $0xfffffffffffffff0,%rdx
mov %rcx,%rax
cmp %rax,%rsp
je 11e8 <func0+0x58>
sub $0x1000,%rsp
orq $0x0,0xff8(%rsp)
cmp %rax,%rsp
jne 11d3 <func0+0x43>
and $0xfff,%edx
sub %rdx,%rsp
test %rdx,%rdx
jne 1290 <func0+0x100>
mov %esi,%eax
lea 0x3(%rsp),%r10
imul %esi,%eax
mov %r10,%rdx
and $0xfffffffffffffffc,%r10
shr $0x2,%rdx
movl $0x0,0x0(,%rdx,4)
mov %esi,0x4(,%rdx,4)
mov %eax,0x8(,%rdx,4)
cmp $0x2,%edi
jle 1273 <func0+0xe3>
lea -0x3(%rdi),%edx
lea -0x1(%rsi),%r9d
lea 0xc(%r10),%rcx
lea 0xc(%r10,%rdx,4),%r8
jmp 1247 <func0+0xb7>
mov -0x4(%rcx),%esi
add $0x4,%rcx
add %eax,%esi
imul %r9d,%esi
movslq %esi,%rax
mov %esi,%edx
imul $0x44b82f99,%rax,%rax
sar $0x1f,%edx
sar $0x3c,%rax
sub %edx,%eax
imul $0x3b9aca07,%eax,%edx
mov %esi,%eax
sub %edx,%eax
mov %eax,(%rcx)
cmp %r8,%rcx
jne 1240 <func0+0xb0>
movslq %edi,%rdi
mov (%r10,%rdi,4),%eax
mov -0x8(%rbp),%rdi
xor %fs:0x28,%rdi
jne 129b <func0+0x10b>
leaveq
retq
nopl 0x0(%rax,%rax,1)
orq $0x0,-0x8(%rsp,%rdx,1)
jmpq 11fa <func0+0x6a>
callq 1070 <__stack_chk_fail@plt>
| func0:
endbr64
push rbp
movsxd r9, edi
mov edx, esi
mov rbp, rsp
sub rsp, 10h
mov rax, fs:28h
mov [rbp+var_8], rax
xor eax, eax
lea eax, [r9+1]
mov rsi, rsp
cdqe
lea rax, ds:0Fh[rax*4]
mov rcx, rax
and rax, 0FFFFFFFFFFFFF000h
sub rsi, rax
and rcx, 0FFFFFFFFFFFFFFF0h
cmp rsp, rsi
jz short loc_12AB
loc_1296:
sub rsp, 1000h
or [rsp+1010h+var_18], 0
cmp rsp, rsi
jnz short loc_1296
loc_12AB:
and ecx, 0FFFh
sub rsp, rcx
test rcx, rcx
jnz loc_1350
loc_12BD:
mov eax, edx
lea r10, [rsp+1010h+var_100D]
imul eax, edx
mov rcx, r10
and r10, 0FFFFFFFFFFFFFFFCh
shr rcx, 2
mov ds:dword_0[rcx*4], 0
mov dword ptr ds:byte_4[rcx*4], edx
mov dword ptr ds:byte_8[rcx*4], eax
cmp r9d, 2
jle short loc_133B
lea esi, [r9-3]
lea r8d, [rdx-1]
lea rcx, [r10+0Ch]
lea rdi, [r10+rsi*4+0Ch]
jmp short loc_130F
loc_1308:
mov edx, [rcx-4]
add rcx, 4
loc_130F:
add edx, eax
imul edx, r8d
movsxd rax, edx
mov esi, edx
imul rax, 44B82F99h
sar esi, 1Fh
sar rax, 3Ch
sub eax, esi
imul esi, eax, 3B9ACA07h
mov eax, edx
sub eax, esi
mov [rcx], eax
cmp rdi, rcx
jnz short loc_1308
loc_133B:
mov eax, [r10+r9*4]
mov rdx, [rbp+var_8]
sub rdx, fs:28h
jnz short loc_135B
leave
retn
loc_1350:
or [rsp+rcx+1010h+var_1018], 0
jmp loc_12BD
loc_135B:
call ___stack_chk_fail | long long func0(int a1, int a2)
{
long long v3; // rcx
_BYTE *v4; // rsi
__int16 v5; // cx
signed long long v6; // rcx
void *v7; // rsp
int v8; // eax
unsigned long long v9; // rcx
int v10; // r8d
int *i; // rcx
_BYTE v14[3]; // [rsp+8h] [rbp-1010h] BYREF
char v15; // [rsp+Bh] [rbp-100Dh] BYREF
_DWORD v16[1019]; // [rsp+14h] [rbp-1004h] BYREF
_QWORD v17[2]; // [rsp+1008h] [rbp-10h] BYREF
v17[1] = __readfsqword(0x28u);
v3 = 4LL * (a1 + 1) + 15;
v4 = (char *)v17 - (v3 & 0xFFFFFFFFFFFFF000LL);
v5 = v3 & 0xFFF0;
if ( v17 != (_QWORD *)v4 )
{
while ( v14 != v4 )
;
}
v6 = v5 & 0xFFF;
v7 = alloca(v6);
if ( v6 )
*(_QWORD *)&v14[v6 - 8] = *(_QWORD *)&v14[v6 - 8];
v8 = a2 * a2;
v9 = (unsigned long long)&v15 >> 2;
*(_DWORD *)(4 * v9) = 0;
*(_DWORD *)&byte_4[4 * v9] = a2;
*(_DWORD *)&byte_8[4 * v9] = a2 * a2;
if ( a1 > 2 )
{
v10 = a2 - 1;
for ( i = v16; ; ++i )
{
v8 = v10 * (v8 + a2) % 1000000007;
*i = v8;
if ( &v16[a1 - 3] == i )
break;
a2 = *(i - 1);
}
}
return *(unsigned int *)&v14[4 * a1];
} | func0:
ENDBR64
PUSH RBP
MOVSXD R9,EDI
MOV EDX,ESI
MOV RBP,RSP
SUB RSP,0x10
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x8],RAX
XOR EAX,EAX
LEA EAX,[R9 + 0x1]
MOV RSI,RSP
CDQE
LEA RAX,[0xf + RAX*0x4]
MOV RCX,RAX
AND RAX,-0x1000
SUB RSI,RAX
AND RCX,-0x10
CMP RSP,RSI
JZ 0x001012ab
LAB_00101296:
SUB RSP,0x1000
OR qword ptr [RSP + 0xff8],0x0
CMP RSP,RSI
JNZ 0x00101296
LAB_001012ab:
AND ECX,0xfff
SUB RSP,RCX
TEST RCX,RCX
JNZ 0x00101350
LAB_001012bd:
MOV EAX,EDX
LEA R10,[RSP + 0x3]
IMUL EAX,EDX
MOV RCX,R10
AND R10,-0x4
SHR RCX,0x2
MOV dword ptr [RCX*0x4],0x0
MOV dword ptr [0x4 + RCX*0x4],EDX
MOV dword ptr [0x8 + RCX*0x4],EAX
CMP R9D,0x2
JLE 0x0010133b
LEA ESI,[R9 + -0x3]
LEA R8D,[RDX + -0x1]
LEA RCX,[R10 + 0xc]
LEA RDI,[R10 + RSI*0x4 + 0xc]
JMP 0x0010130f
LAB_00101308:
MOV EDX,dword ptr [RCX + -0x4]
ADD RCX,0x4
LAB_0010130f:
ADD EDX,EAX
IMUL EDX,R8D
MOVSXD RAX,EDX
MOV ESI,EDX
IMUL RAX,RAX,0x44b82f99
SAR ESI,0x1f
SAR RAX,0x3c
SUB EAX,ESI
IMUL ESI,EAX,0x3b9aca07
MOV EAX,EDX
SUB EAX,ESI
MOV dword ptr [RCX],EAX
CMP RDI,RCX
JNZ 0x00101308
LAB_0010133b:
MOV EAX,dword ptr [R10 + R9*0x4]
MOV RDX,qword ptr [RBP + -0x8]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x0010135b
LEAVE
RET
LAB_00101350:
OR qword ptr [RSP + RCX*0x1 + -0x8],0x0
JMP 0x001012bd
LAB_0010135b:
CALL 0x00101080 | int4 func0(int param_1,int param_2)
{
int iVar1;
long lVar2;
int1 *puVar3;
int iVar4;
ulong uVar5;
int *piVar6;
int1 *puVar7;
long in_FS_OFFSET;
int1 auStack_18 [8];
long local_10;
int1 *puVar8;
puVar7 = auStack_18;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
uVar5 = (long)(param_1 + 1) * 4 + 0xf;
puVar8 = auStack_18;
puVar3 = auStack_18;
while (puVar8 != auStack_18 + -(uVar5 & 0xfffffffffffff000)) {
puVar7 = puVar3 + -0x1000;
*(int8 *)(puVar3 + -8) = *(int8 *)(puVar3 + -8);
puVar8 = puVar3 + -0x1000;
puVar3 = puVar3 + -0x1000;
}
uVar5 = (ulong)((uint)uVar5 & 0xff0);
lVar2 = -uVar5;
if (uVar5 != 0) {
*(int8 *)(puVar7 + -8) = *(int8 *)(puVar7 + -8);
}
iVar4 = param_2 * param_2;
uVar5 = (ulong)(puVar7 + lVar2 + 3) >> 2;
*(int4 *)(uVar5 * 4) = 0;
*(int *)(uVar5 * 4 + 4) = param_2;
*(int *)(uVar5 * 4 + 8) = iVar4;
if (2 < param_1) {
iVar1 = param_2 + -1;
piVar6 = (int *)(puVar7 + lVar2 + 0xc);
while( true ) {
iVar4 = ((param_2 + iVar4) * iVar1) % 0x3b9aca07;
*piVar6 = iVar4;
if ((int *)(puVar7 + (ulong)(param_1 - 3) * 4 + lVar2 + 0xc) == piVar6) break;
param_2 = piVar6[-1];
piVar6 = piVar6 + 1;
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
*(code **)(puVar7 + lVar2 + -8) = _fini;
__stack_chk_fail();
}
return *(int4 *)(puVar7 + (long)param_1 * 4 + lVar2);
} |
5,059 | func0 |
#include <assert.h>
#include <stdio.h>
#define MOD 1000000007
| int func0(int n, int k) {
int dp[n + 1];
dp[0] = 0;
dp[1] = k;
dp[2] = k * k;
for (int i = 3; i <= n; i++) {
dp[i] = ((k - 1) * (dp[i - 1] + dp[i - 2])) % MOD;
}
return dp[n];
}
| int main() {
assert(func0(2, 4) == 16);
assert(func0(3, 2) == 6);
assert(func0(4, 4) == 228);
printf("All test cases passed.\n");
return 0;
}
| O3 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x10,%rsp
mov %fs:0x28,%rax
mov %rax,-0x8(%rbp)
xor %eax,%eax
lea 0x1(%rdi),%eax
mov %rsp,%rcx
cltq
lea 0xf(,%rax,4),%rax
mov %rax,%rdx
and $0xfffffffffffff000,%rax
sub %rax,%rcx
and $0xfffffffffffffff0,%rdx
mov %rcx,%rax
cmp %rax,%rsp
je 11e8 <func0+0x58>
sub $0x1000,%rsp
orq $0x0,0xff8(%rsp)
cmp %rax,%rsp
jne 11d3 <func0+0x43>
and $0xfff,%edx
sub %rdx,%rsp
test %rdx,%rdx
jne 1300 <func0+0x170>
mov %esi,%eax
lea 0x3(%rsp),%r8
imul %esi,%eax
mov %r8,%rdx
and $0xfffffffffffffffc,%r8
shr $0x2,%rdx
movl $0x0,0x0(,%rdx,4)
mov %esi,0x4(,%rdx,4)
mov %eax,0x8(,%rdx,4)
cmp $0x2,%edi
jle 12e7 <func0+0x157>
lea -0x1(%rsi),%r9d
cmp $0x4,%edi
jle 130b <func0+0x17b>
lea -0x5(%rdi),%edx
mov $0x5,%r10d
shr %edx
lea 0x7(%rdx,%rdx,1),%r11
lea (%rsi,%rax,1),%edx
imul %r9d,%edx
movslq %edx,%rsi
mov %edx,%ecx
imul $0x44b82f99,%rsi,%rsi
sar $0x1f,%ecx
sar $0x3c,%rsi
sub %ecx,%esi
imul $0x3b9aca07,%esi,%esi
sub %esi,%edx
mov %edx,-0x8(%r8,%r10,4)
mov %edx,%esi
lea (%rdx,%rax,1),%edx
imul %r9d,%edx
movslq %edx,%rax
mov %edx,%ecx
imul $0x44b82f99,%rax,%rax
sar $0x1f,%ecx
sar $0x3c,%rax
sub %ecx,%eax
movslq %r10d,%rcx
imul $0x3b9aca07,%eax,%eax
sub %eax,%edx
mov %edx,-0x4(%r8,%r10,4)
add $0x2,%r10
mov %edx,%eax
cmp %r10,%r11
jne 124e <func0+0xbe>
mov -0x4(%r8,%rcx,4),%eax
add -0x8(%r8,%rcx,4),%eax
imul %r9d,%eax
movslq %eax,%rdx
mov %eax,%esi
imul $0x44b82f99,%rdx,%rdx
sar $0x1f,%esi
sar $0x3c,%rdx
sub %esi,%edx
imul $0x3b9aca07,%edx,%edx
sub %edx,%eax
mov %eax,(%r8,%rcx,4)
add $0x1,%rcx
cmp %ecx,%edi
jge 12b0 <func0+0x120>
movslq %edi,%rdi
mov (%r8,%rdi,4),%eax
mov -0x8(%rbp),%rdi
xor %fs:0x28,%rdi
jne 1312 <func0+0x182>
leaveq
retq
orq $0x0,-0x8(%rsp,%rdx,1)
jmpq 11fa <func0+0x6a>
mov $0x3,%ecx
jmp 12b0 <func0+0x120>
callq 1070 <__stack_chk_fail@plt>
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
push rbp
mov eax, esi
mov rbp, rsp
sub rsp, 10h
mov rdx, fs:28h
mov [rbp+var_8], rdx
xor edx, edx
lea edx, [rdi+1]
mov rsi, rsp
movsxd rdx, edx
lea rdx, ds:0Fh[rdx*4]
mov rcx, rdx
and rdx, 0FFFFFFFFFFFFF000h
sub rsi, rdx
and rcx, 0FFFFFFFFFFFFFFF0h
cmp rsp, rsi
jz short loc_12A9
loc_1294:
sub rsp, 1000h
or [rsp+1010h+var_18], 0
cmp rsp, rsi
jnz short loc_1294
loc_12A9:
and ecx, 0FFFh
sub rsp, rcx
test rcx, rcx
jnz loc_13E0
loc_12BB:
mov edx, eax
lea rsi, [rsp+1010h+var_100D]
imul edx, eax
mov rcx, rsi
and rsi, 0FFFFFFFFFFFFFFFCh
shr rcx, 2
mov ds:dword_0[rcx*4], 0
mov dword ptr ds:byte_4[rcx*4], eax
mov dword ptr ds:byte_8[rcx*4], edx
cmp edi, 2
jle loc_13BF
lea r8d, [rax-1]
cmp edi, 4
jle loc_13EB
lea ecx, [rdi-5]
mov r9d, 5
shr ecx, 1
lea r10d, [rcx+rcx]
add r10, 7
loc_1312:
lea ecx, [rax+rdx]
imul ecx, r8d
movsxd rax, ecx
mov r11d, ecx
imul rax, 44B82F99h
sar r11d, 1Fh
sar rax, 3Ch
sub eax, r11d
imul r11d, eax, 3B9ACA07h
mov eax, ecx
sub eax, r11d
lea ecx, [rax+rdx]
mov [rsi+r9*4-8], eax
imul ecx, r8d
movsxd rdx, ecx
mov r11d, ecx
imul rdx, 44B82F99h
sar r11d, 1Fh
sar rdx, 3Ch
sub edx, r11d
imul r11d, edx, 3B9ACA07h
sub ecx, r11d
mov [rsi+r9*4-4], ecx
mov edx, ecx
mov rcx, r9
add r9, 2
cmp r10, r9
jnz short loc_1312
loc_137E:
movsxd rcx, ecx
nop dword ptr [rax+00000000h]
loc_1388:
mov eax, [rsi+rcx*4-8]
add eax, [rsi+rcx*4-4]
imul eax, r8d
movsxd rdx, eax
mov r9d, eax
imul rdx, 44B82F99h
sar r9d, 1Fh
sar rdx, 3Ch
sub edx, r9d
imul edx, 3B9ACA07h
sub eax, edx
mov [rsi+rcx*4], eax
add rcx, 1
cmp edi, ecx
jge short loc_1388
loc_13BF:
movsxd rdi, edi
mov eax, [rsi+rdi*4]
mov rdx, [rbp+var_8]
sub rdx, fs:28h
jnz short loc_13F2
leave
retn
loc_13E0:
or [rsp+rcx+1010h+var_1018], 0
jmp loc_12BB
loc_13EB:
mov ecx, 3
jmp short loc_137E
loc_13F2:
call ___stack_chk_fail | long long func0(int a1, int a2)
{
long long v3; // rcx
_BYTE *v4; // rsi
__int16 v5; // cx
signed long long v6; // rcx
void *v7; // rsp
int v8; // edx
unsigned long long v9; // rcx
int v10; // r8d
long long v11; // r9
long long v12; // rcx
_BYTE v15[3]; // [rsp+8h] [rbp-1010h] BYREF
char v16; // [rsp+Bh] [rbp-100Dh] BYREF
_QWORD v17[2]; // [rsp+1008h] [rbp-10h] BYREF
v17[1] = __readfsqword(0x28u);
v3 = 4LL * (a1 + 1) + 15;
v4 = (char *)v17 - (v3 & 0xFFFFFFFFFFFFF000LL);
v5 = v3 & 0xFFF0;
if ( v17 != (_QWORD *)v4 )
{
while ( v15 != v4 )
;
}
v6 = v5 & 0xFFF;
v7 = alloca(v6);
if ( v6 )
*(_QWORD *)&v15[v6 - 8] = *(_QWORD *)&v15[v6 - 8];
v8 = a2 * a2;
v9 = (unsigned long long)&v16 >> 2;
*(_DWORD *)(4 * v9) = 0;
*(_DWORD *)&byte_4[4 * v9] = a2;
*(_DWORD *)&byte_8[4 * v9] = a2 * a2;
if ( a1 > 2 )
{
v10 = a2 - 1;
if ( a1 <= 4 )
{
LODWORD(v12) = 3;
}
else
{
v11 = 5LL;
do
{
a2 = v10 * (a2 + v8) % 1000000007;
*(_DWORD *)&v15[4 * v11 - 8] = a2;
*(_DWORD *)&v15[4 * v11 - 4] = v10 * (a2 + v8) % 1000000007;
v8 = v10 * (a2 + v8) % 1000000007;
LODWORD(v12) = v11;
v11 += 2LL;
}
while ( 2 * ((unsigned int)(a1 - 5) >> 1) + 7LL != v11 );
}
v12 = (int)v12;
do
{
*(_DWORD *)&v15[4 * v12] = v10 * (*(_DWORD *)&v15[4 * v12 - 4] + *(_DWORD *)&v15[4 * v12 - 8]) % 1000000007;
++v12;
}
while ( a1 >= (int)v12 );
}
return *(unsigned int *)&v15[4 * a1];
} | func0:
ENDBR64
PUSH RBP
MOV EAX,ESI
MOV RBP,RSP
SUB RSP,0x10
MOV RDX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x8],RDX
XOR EDX,EDX
LEA EDX,[RDI + 0x1]
MOV RSI,RSP
MOVSXD RDX,EDX
LEA RDX,[0xf + RDX*0x4]
MOV RCX,RDX
AND RDX,-0x1000
SUB RSI,RDX
AND RCX,-0x10
CMP RSP,RSI
JZ 0x001012a9
LAB_00101294:
SUB RSP,0x1000
OR qword ptr [RSP + 0xff8],0x0
CMP RSP,RSI
JNZ 0x00101294
LAB_001012a9:
AND ECX,0xfff
SUB RSP,RCX
TEST RCX,RCX
JNZ 0x001013e0
LAB_001012bb:
MOV EDX,EAX
LEA RSI,[RSP + 0x3]
IMUL EDX,EAX
MOV RCX,RSI
AND RSI,-0x4
SHR RCX,0x2
MOV dword ptr [RCX*0x4],0x0
MOV dword ptr [0x4 + RCX*0x4],EAX
MOV dword ptr [0x8 + RCX*0x4],EDX
CMP EDI,0x2
JLE 0x001013bf
LEA R8D,[RAX + -0x1]
CMP EDI,0x4
JLE 0x001013eb
LEA ECX,[RDI + -0x5]
MOV R9D,0x5
SHR ECX,0x1
LEA R10D,[RCX + RCX*0x1]
ADD R10,0x7
LAB_00101312:
LEA ECX,[RAX + RDX*0x1]
IMUL ECX,R8D
MOVSXD RAX,ECX
MOV R11D,ECX
IMUL RAX,RAX,0x44b82f99
SAR R11D,0x1f
SAR RAX,0x3c
SUB EAX,R11D
IMUL R11D,EAX,0x3b9aca07
MOV EAX,ECX
SUB EAX,R11D
LEA ECX,[RAX + RDX*0x1]
MOV dword ptr [RSI + R9*0x4 + -0x8],EAX
IMUL ECX,R8D
MOVSXD RDX,ECX
MOV R11D,ECX
IMUL RDX,RDX,0x44b82f99
SAR R11D,0x1f
SAR RDX,0x3c
SUB EDX,R11D
IMUL R11D,EDX,0x3b9aca07
SUB ECX,R11D
MOV dword ptr [RSI + R9*0x4 + -0x4],ECX
MOV EDX,ECX
MOV RCX,R9
ADD R9,0x2
CMP R10,R9
JNZ 0x00101312
LAB_0010137e:
MOVSXD RCX,ECX
NOP dword ptr [RAX]
LAB_00101388:
MOV EAX,dword ptr [RSI + RCX*0x4 + -0x8]
ADD EAX,dword ptr [RSI + RCX*0x4 + -0x4]
IMUL EAX,R8D
MOVSXD RDX,EAX
MOV R9D,EAX
IMUL RDX,RDX,0x44b82f99
SAR R9D,0x1f
SAR RDX,0x3c
SUB EDX,R9D
IMUL EDX,EDX,0x3b9aca07
SUB EAX,EDX
MOV dword ptr [RSI + RCX*0x4],EAX
ADD RCX,0x1
CMP EDI,ECX
JGE 0x00101388
LAB_001013bf:
MOVSXD RDI,EDI
MOV EAX,dword ptr [RSI + RDI*0x4]
MOV RDX,qword ptr [RBP + -0x8]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x001013f2
LEAVE
RET
LAB_001013e0:
OR qword ptr [RSP + RCX*0x1 + -0x8],0x0
JMP 0x001012bb
LAB_001013eb:
MOV ECX,0x3
JMP 0x0010137e
LAB_001013f2:
CALL 0x00101080 | int4 func0(int param_1,int param_2)
{
int iVar1;
long lVar2;
int *puVar3;
int iVar4;
ulong uVar5;
int iVar6;
int *puVar7;
long lVar9;
long in_FS_OFFSET;
int auStack_18 [8];
long local_10;
int *puVar8;
puVar7 = auStack_18;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
uVar5 = (long)(param_1 + 1) * 4 + 0xf;
puVar8 = auStack_18;
puVar3 = auStack_18;
while (puVar8 != auStack_18 + -(uVar5 & 0xfffffffffffff000)) {
puVar7 = puVar3 + -0x1000;
*(int8 *)(puVar3 + -8) = *(int8 *)(puVar3 + -8);
puVar8 = puVar3 + -0x1000;
puVar3 = puVar3 + -0x1000;
}
uVar5 = (ulong)((uint)uVar5 & 0xff0);
lVar2 = -uVar5;
if (uVar5 != 0) {
*(int8 *)(puVar7 + -8) = *(int8 *)(puVar7 + -8);
}
iVar6 = param_2 * param_2;
uVar5 = (ulong)(puVar7 + lVar2 + 3) >> 2;
*(int4 *)(uVar5 * 4) = 0;
*(int *)(uVar5 * 4 + 4) = param_2;
*(int *)(uVar5 * 4 + 8) = iVar6;
if (2 < param_1) {
iVar1 = param_2 + -1;
if (param_1 < 5) {
iVar4 = 3;
}
else {
lVar9 = 5;
do {
param_2 = ((param_2 + iVar6) * iVar1) % 0x3b9aca07;
*(int *)(puVar7 + lVar9 * 4 + lVar2 + -8) = param_2;
iVar6 = ((param_2 + iVar6) * iVar1) % 0x3b9aca07;
*(int *)(puVar7 + lVar9 * 4 + lVar2 + -4) = iVar6;
iVar4 = (int)lVar9;
lVar9 = lVar9 + 2;
} while ((ulong)(param_1 - 5U & 0xfffffffe) + 7 != lVar9);
}
lVar9 = (long)iVar4;
do {
*(int *)(puVar7 + lVar9 * 4 + lVar2) =
((*(int *)(puVar7 + lVar9 * 4 + lVar2 + -8) + *(int *)(puVar7 + lVar9 * 4 + lVar2 + -4))
* iVar1) % 0x3b9aca07;
lVar9 = lVar9 + 1;
} while ((int)lVar9 <= param_1);
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
*(int8 *)(puVar7 + lVar2 + -8) = 0x1013f7;
__stack_chk_fail();
}
return *(int4 *)(puVar7 + (long)param_1 * 4 + lVar2);
} |
5,060 | func0 | #include <assert.h>
| int func0(int n, int m) {
int q = n / m;
return q;
}
| int main() {
assert(func0(10, 3) == 3);
assert(func0(4, 2) == 2);
assert(func0(20, 5) == 4);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %edi,-0x14(%rbp)
mov %esi,-0x18(%rbp)
mov -0x14(%rbp),%eax
cltd
idivl -0x18(%rbp)
mov %eax,-0x4(%rbp)
mov -0x4(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_14], edi
mov [rbp+var_18], esi
mov eax, [rbp+var_14]
cdq
idiv [rbp+var_18]
mov [rbp+var_4], eax
mov eax, [rbp+var_4]
pop rbp
retn | long long func0(int a1, int a2)
{
return (unsigned int)(a1 / a2);
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV dword ptr [RBP + -0x14],EDI
MOV dword ptr [RBP + -0x18],ESI
MOV EAX,dword ptr [RBP + -0x14]
CDQ
IDIV dword ptr [RBP + -0x18]
MOV dword ptr [RBP + -0x4],EAX
MOV EAX,dword ptr [RBP + -0x4]
POP RBP
RET | int func0(int param_1,int param_2)
{
return param_1 / param_2;
} |
5,061 | func0 | #include <assert.h>
| int func0(int n, int m) {
int q = n / m;
return q;
}
| int main() {
assert(func0(10, 3) == 3);
assert(func0(4, 2) == 2);
assert(func0(20, 5) == 4);
return 0;
}
| O1 | c | func0:
endbr64
mov %edi,%eax
cltd
idiv %esi
retq
| func0:
endbr64
mov eax, edi
cdq
idiv esi
retn | long long func0(int a1, int a2)
{
return (unsigned int)(a1 / a2);
} | func0:
ENDBR64
MOV EAX,EDI
CDQ
IDIV ESI
RET | int1 [16] func0(int param_1,int param_2)
{
int1 auVar1 [16];
auVar1._0_8_ = (long)param_1 / (long)param_2 & 0xffffffff;
auVar1._8_8_ = (long)param_1 % (long)param_2 & 0xffffffff;
return auVar1;
} |
5,062 | func0 | #include <assert.h>
| int func0(int n, int m) {
int q = n / m;
return q;
}
| int main() {
assert(func0(10, 3) == 3);
assert(func0(4, 2) == 2);
assert(func0(20, 5) == 4);
return 0;
}
| O2 | c | func0:
endbr64
mov %edi,%eax
cltd
idiv %esi
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
mov eax, edi
cdq
idiv esi
retn | long long func0(int a1, int a2)
{
return (unsigned int)(a1 / a2);
} | func0:
ENDBR64
MOV EAX,EDI
CDQ
IDIV ESI
RET | int1 [16] func0(int param_1,int param_2)
{
int1 auVar1 [16];
auVar1._0_8_ = (long)param_1 / (long)param_2 & 0xffffffff;
auVar1._8_8_ = (long)param_1 % (long)param_2 & 0xffffffff;
return auVar1;
} |
5,063 | func0 | #include <assert.h>
| int func0(int n, int m) {
int q = n / m;
return q;
}
| int main() {
assert(func0(10, 3) == 3);
assert(func0(4, 2) == 2);
assert(func0(20, 5) == 4);
return 0;
}
| O3 | c | func0:
endbr64
mov %edi,%eax
cltd
idiv %esi
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
mov eax, edi
cdq
idiv esi
retn | long long func0(int a1, int a2)
{
return (unsigned int)(a1 / a2);
} | func0:
ENDBR64
MOV EAX,EDI
CDQ
IDIV ESI
RET | int [16] func0(int param_1,int param_2)
{
int auVar1 [16];
auVar1._0_8_ = (long)param_1 / (long)param_2 & 0xffffffff;
auVar1._8_8_ = (long)param_1 % (long)param_2 & 0xffffffff;
return auVar1;
} |
5,064 | func0 |
#include <math.h>
#include <assert.h>
| double func0(int w, int h) {
double s = sqrt((w * w) + (h * h));
return s;
}
| int main() {
assert(func0(7, 8) == 10.63014581273465);
assert(func0(3, 4) == 5);
assert(func0(7, 15) == 16.55294535724685);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x20,%rsp
mov %edi,-0x14(%rbp)
mov %esi,-0x18(%rbp)
mov -0x14(%rbp),%eax
imul %eax,%eax
mov %eax,%edx
mov -0x18(%rbp),%eax
imul %eax,%eax
add %edx,%eax
cvtsi2sd %eax,%xmm0
callq 1070 <sqrt@plt>
movq %xmm0,%rax
mov %rax,-0x8(%rbp)
movsd -0x8(%rbp),%xmm0
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 20h
mov [rbp+var_14], edi
mov [rbp+var_18], esi
mov eax, [rbp+var_14]
imul eax, eax
mov edx, eax
mov eax, [rbp+var_18]
imul eax, eax
add eax, edx
pxor xmm1, xmm1
cvtsi2sd xmm1, eax
movq rax, xmm1
movq xmm0, rax; x
call _sqrt
movq rax, xmm0
mov [rbp+var_8], rax
movsd xmm0, [rbp+var_8]
leave
retn | long long func0(int a1, int a2)
{
return sqrt((double)(a1 * a1 + a2 * a2));
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x20
MOV dword ptr [RBP + -0x14],EDI
MOV dword ptr [RBP + -0x18],ESI
MOV EAX,dword ptr [RBP + -0x14]
IMUL EAX,EAX
MOV EDX,EAX
MOV EAX,dword ptr [RBP + -0x18]
IMUL EAX,EAX
ADD EAX,EDX
PXOR XMM1,XMM1
CVTSI2SD XMM1,EAX
MOVQ RAX,XMM1
MOVQ XMM0,RAX
CALL 0x00101070
MOVQ RAX,XMM0
MOV qword ptr [RBP + -0x8],RAX
MOVSD XMM0,qword ptr [RBP + -0x8]
LEAVE
RET | double func0(int param_1,int param_2)
{
double dVar1;
dVar1 = sqrt((double)(param_2 * param_2 + param_1 * param_1));
return dVar1;
} |
5,065 | func0 |
#include <math.h>
#include <assert.h>
| double func0(int w, int h) {
double s = sqrt((w * w) + (h * h));
return s;
}
| int main() {
assert(func0(7, 8) == 10.63014581273465);
assert(func0(3, 4) == 5);
assert(func0(7, 15) == 16.55294535724685);
return 0;
}
| O1 | c | func0:
endbr64
sub $0x18,%rsp
imul %edi,%edi
imul %esi,%esi
add %esi,%edi
pxor %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
movapd %xmm0,%xmm2
sqrtsd %xmm2,%xmm2
movsd %xmm2,0x8(%rsp)
pxor %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja 1184 <func0+0x3b>
movsd 0x8(%rsp),%xmm0
add $0x18,%rsp
retq
callq 1050 <sqrt@plt>
jmp 1179 <func0+0x30>
| func0:
endbr64
imul edi, edi
imul esi, esi
add edi, esi
pxor xmm0, xmm0
cvtsi2sd xmm0, edi
pxor xmm1, xmm1
ucomisd xmm1, xmm0
ja short loc_116C
sqrtsd xmm0, xmm0
retn
loc_116C:
sub rsp, 8
call _sqrt
add rsp, 8
retn | double func0(int a1, int a2)
{
double v2; // xmm0_8
v2 = (double)(a2 * a2 + a1 * a1);
if ( v2 < 0.0 )
return sqrt(v2);
else
return sqrt(v2);
} | func0:
ENDBR64
IMUL EDI,EDI
IMUL ESI,ESI
ADD EDI,ESI
PXOR XMM0,XMM0
CVTSI2SD XMM0,EDI
PXOR XMM1,XMM1
UCOMISD XMM1,XMM0
JA 0x0010116c
SQRTSD XMM0,XMM0
RET
LAB_0010116c:
SUB RSP,0x8
CALL 0x00101050
ADD RSP,0x8
RET | double func0(int param_1,int param_2)
{
double dVar1;
dVar1 = (double)(param_1 * param_1 + param_2 * param_2);
if (0.0 <= dVar1) {
return SQRT(dVar1);
}
dVar1 = sqrt(dVar1);
return dVar1;
} |
5,066 | func0 |
#include <math.h>
#include <assert.h>
| double func0(int w, int h) {
double s = sqrt((w * w) + (h * h));
return s;
}
| int main() {
assert(func0(7, 8) == 10.63014581273465);
assert(func0(3, 4) == 5);
assert(func0(7, 15) == 16.55294535724685);
return 0;
}
| O2 | c | func0:
endbr64
imul %edi,%edi
pxor %xmm0,%xmm0
pxor %xmm2,%xmm2
imul %esi,%esi
add %esi,%edi
cvtsi2sd %edi,%xmm0
ucomisd %xmm0,%xmm2
movapd %xmm0,%xmm1
sqrtsd %xmm1,%xmm1
ja 118b <func0+0x2b>
movapd %xmm1,%xmm0
retq
sub $0x18,%rsp
movsd %xmm1,0x8(%rsp)
callq 1050 <sqrt@plt>
movsd 0x8(%rsp),%xmm1
add $0x18,%rsp
movapd %xmm1,%xmm0
retq
nopl 0x0(%rax)
| func0:
endbr64
imul edi, edi
pxor xmm0, xmm0
pxor xmm1, xmm1
imul esi, esi
add edi, esi
cvtsi2sd xmm0, edi
ucomisd xmm1, xmm0
ja short loc_1183
sqrtsd xmm0, xmm0
retn
loc_1183:
jmp _sqrt | double func0(int a1, int a2)
{
double v2; // xmm0_8
v2 = (double)(a2 * a2 + a1 * a1);
if ( v2 < 0.0 )
return sqrt(v2);
else
return sqrt(v2);
} | func0:
ENDBR64
IMUL EDI,EDI
PXOR XMM0,XMM0
PXOR XMM1,XMM1
IMUL ESI,ESI
ADD EDI,ESI
CVTSI2SD XMM0,EDI
UCOMISD XMM1,XMM0
JA 0x00101183
SQRTSD XMM0,XMM0
RET
LAB_00101183:
JMP 0x00101050 | double func0(int param_1,int param_2)
{
double dVar1;
dVar1 = (double)(param_1 * param_1 + param_2 * param_2);
if (0.0 <= dVar1) {
return SQRT(dVar1);
}
dVar1 = sqrt(dVar1);
return dVar1;
} |
5,067 | func0 |
#include <math.h>
#include <assert.h>
| double func0(int w, int h) {
double s = sqrt((w * w) + (h * h));
return s;
}
| int main() {
assert(func0(7, 8) == 10.63014581273465);
assert(func0(3, 4) == 5);
assert(func0(7, 15) == 16.55294535724685);
return 0;
}
| O3 | c | func0:
endbr64
imul %edi,%edi
pxor %xmm0,%xmm0
pxor %xmm2,%xmm2
imul %esi,%esi
add %esi,%edi
cvtsi2sd %edi,%xmm0
ucomisd %xmm0,%xmm2
movapd %xmm0,%xmm1
sqrtsd %xmm1,%xmm1
ja 118b <func0+0x2b>
movapd %xmm1,%xmm0
retq
sub $0x18,%rsp
movsd %xmm1,0x8(%rsp)
callq 1050 <sqrt@plt>
movsd 0x8(%rsp),%xmm1
add $0x18,%rsp
movapd %xmm1,%xmm0
retq
nopl 0x0(%rax)
| func0:
endbr64
imul edi, edi
pxor xmm0, xmm0
pxor xmm1, xmm1
imul esi, esi
add edi, esi
cvtsi2sd xmm0, edi; x
ucomisd xmm1, xmm0
ja short loc_1183
sqrtsd xmm0, xmm0
retn
loc_1183:
jmp _sqrt | double func0(int a1, int a2)
{
double v2; // xmm0_8
v2 = (double)(a2 * a2 + a1 * a1);
if ( v2 < 0.0 )
return sqrt(v2);
else
return sqrt(v2);
} | func0:
ENDBR64
IMUL EDI,EDI
PXOR XMM0,XMM0
PXOR XMM1,XMM1
IMUL ESI,ESI
ADD EDI,ESI
CVTSI2SD XMM0,EDI
UCOMISD XMM1,XMM0
JA 0x00101183
SQRTSD XMM0,XMM0
RET
LAB_00101183:
JMP 0x00101050 | double func0(int param_1,int param_2)
{
double dVar1;
dVar1 = (double)(param_1 * param_1 + param_2 * param_2);
if (0.0 <= dVar1) {
return SQRT(dVar1);
}
dVar1 = sqrt(dVar1);
return dVar1;
} |
5,068 | func0 |
#include <assert.h>
#include <limits.h>
| int func0(int listval[], int size){
int max_val = INT_MIN;
for(int i = 0; i < size; i++){
if(listval[i] > max_val){
max_val = listval[i];
}
}
return max_val;
}
| int main() {
int array1[] = {3, 2, 4, 5};
int size1 = sizeof(array1)/sizeof(array1[0]);
int array2[] = {15, 20, 25};
int size2 = sizeof(array2)/sizeof(array2[0]);
int array3[] = {30, 20, 40, 50};
int size3 = sizeof(array3)/sizeof(array3[0]);
assert(func0(array1, size1) == 5);
assert(func0(array2, size2) == 25);
assert(func0(array3, size3) == 50);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
movl $0x80000000,-0x8(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11c0 <func0+0x57>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cmp %eax,-0x8(%rbp)
jge 11bc <func0+0x53>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
mov %eax,-0x8(%rbp)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 1188 <func0+0x1f>
mov -0x8(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_8], 80000000h
mov [rbp+var_4], 0
jmp short loc_11C0
loc_1188:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
cmp [rbp+var_8], eax
jge short loc_11BC
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
mov [rbp+var_8], eax
loc_11BC:
add [rbp+var_4], 1
loc_11C0:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_1188
mov eax, [rbp+var_8]
pop rbp
retn | long long func0(long long a1, int a2)
{
unsigned int v3; // [rsp+14h] [rbp-8h]
int i; // [rsp+18h] [rbp-4h]
v3 = 0x80000000;
for ( i = 0; i < a2; ++i )
{
if ( (signed int)v3 < *(_DWORD *)(4LL * i + a1) )
v3 = *(_DWORD *)(4LL * i + a1);
}
return v3;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x8],0x80000000
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011c0
LAB_00101188:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
CMP dword ptr [RBP + -0x8],EAX
JGE 0x001011bc
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
MOV dword ptr [RBP + -0x8],EAX
LAB_001011bc:
ADD dword ptr [RBP + -0x4],0x1
LAB_001011c0:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x00101188
MOV EAX,dword ptr [RBP + -0x8]
POP RBP
RET | int func0(long param_1,int param_2)
{
int4 local_10;
int4 local_c;
local_10 = -0x80000000;
for (local_c = 0; local_c < param_2; local_c = local_c + 1) {
if (local_10 < *(int *)(param_1 + (long)local_c * 4)) {
local_10 = *(int *)(param_1 + (long)local_c * 4);
}
}
return local_10;
} |
5,069 | func0 |
#include <assert.h>
#include <limits.h>
| int func0(int listval[], int size){
int max_val = INT_MIN;
for(int i = 0; i < size; i++){
if(listval[i] > max_val){
max_val = listval[i];
}
}
return max_val;
}
| int main() {
int array1[] = {3, 2, 4, 5};
int size1 = sizeof(array1)/sizeof(array1[0]);
int array2[] = {15, 20, 25};
int size2 = sizeof(array2)/sizeof(array2[0]);
int array3[] = {30, 20, 40, 50};
int size3 = sizeof(array3)/sizeof(array3[0]);
assert(func0(array1, size1) == 5);
assert(func0(array2, size2) == 25);
assert(func0(array3, size3) == 50);
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 1194 <func0+0x2b>
mov %rdi,%rax
lea -0x1(%rsi),%edx
lea 0x4(%rdi,%rdx,4),%rsi
mov $0x80000000,%edx
mov (%rax),%ecx
cmp %ecx,%edx
cmovl %ecx,%edx
add $0x4,%rax
cmp %rsi,%rax
jne 1181 <func0+0x18>
mov %edx,%eax
retq
mov $0x80000000,%edx
jmp 1191 <func0+0x28>
| func0:
endbr64
test esi, esi
jle short loc_1194
mov rax, rdi
lea edx, [rsi-1]
lea rsi, [rdi+rdx*4+4]
mov edx, 80000000h
loc_1181:
mov ecx, [rax]
cmp edx, ecx
cmovl edx, ecx
add rax, 4
cmp rax, rsi
jnz short loc_1181
loc_1191:
mov eax, edx
retn
loc_1194:
mov edx, 80000000h
jmp short loc_1191 | long long func0(unsigned int *a1, int a2)
{
unsigned int *v2; // rax
long long v3; // rsi
unsigned int v4; // edx
if ( a2 <= 0 )
{
return 0x80000000;
}
else
{
v2 = a1;
v3 = (long long)&a1[a2 - 1 + 1];
v4 = 0x80000000;
do
{
if ( (int)v4 < (int)*v2 )
v4 = *v2;
++v2;
}
while ( v2 != (unsigned int *)v3 );
}
return v4;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101194
MOV RAX,RDI
LEA EDX,[RSI + -0x1]
LEA RSI,[RDI + RDX*0x4 + 0x4]
MOV EDX,0x80000000
LAB_00101181:
MOV ECX,dword ptr [RAX]
CMP EDX,ECX
CMOVL EDX,ECX
ADD RAX,0x4
CMP RAX,RSI
JNZ 0x00101181
LAB_00101191:
MOV EAX,EDX
RET
LAB_00101194:
MOV EDX,0x80000000
JMP 0x00101191 | int func0(int *param_1,int param_2)
{
int *piVar1;
int iVar2;
if (param_2 < 1) {
iVar2 = -0x80000000;
}
else {
piVar1 = param_1 + (ulong)(param_2 - 1) + 1;
iVar2 = -0x80000000;
do {
if (iVar2 < *param_1) {
iVar2 = *param_1;
}
param_1 = param_1 + 1;
} while (param_1 != piVar1);
}
return iVar2;
} |
5,070 | func0 |
#include <assert.h>
#include <limits.h>
| int func0(int listval[], int size){
int max_val = INT_MIN;
for(int i = 0; i < size; i++){
if(listval[i] > max_val){
max_val = listval[i];
}
}
return max_val;
}
| int main() {
int array1[] = {3, 2, 4, 5};
int size1 = sizeof(array1)/sizeof(array1[0]);
int array2[] = {15, 20, 25};
int size2 = sizeof(array2)/sizeof(array2[0]);
int array3[] = {30, 20, 40, 50};
int size3 = sizeof(array3)/sizeof(array3[0]);
assert(func0(array1, size1) == 5);
assert(func0(array2, size2) == 25);
assert(func0(array3, size3) == 50);
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 1170 <func0+0x30>
lea -0x1(%rsi),%eax
lea 0x4(%rdi,%rax,4),%rcx
mov $0x80000000,%eax
nopl (%rax)
mov (%rdi),%edx
cmp %edx,%eax
cmovl %edx,%eax
add $0x4,%rdi
cmp %rcx,%rdi
jne 1158 <func0+0x18>
retq
nopl 0x0(%rax)
mov $0x80000000,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_1170
lea eax, [rsi-1]
lea rcx, [rdi+rax*4+4]
mov eax, 80000000h
nop dword ptr [rax]
loc_1158:
mov edx, [rdi]
cmp eax, edx
cmovl eax, edx
add rdi, 4
cmp rdi, rcx
jnz short loc_1158
retn
loc_1170:
mov eax, 80000000h
retn | long long func0(_DWORD *a1, int a2)
{
long long v2; // rcx
long long result; // rax
if ( a2 <= 0 )
return 0x80000000LL;
v2 = (long long)&a1[a2 - 1 + 1];
result = 0x80000000LL;
do
{
if ( (int)result < *a1 )
result = (unsigned int)*a1;
++a1;
}
while ( a1 != (_DWORD *)v2 );
return result;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101170
LEA EAX,[RSI + -0x1]
LEA RCX,[RDI + RAX*0x4 + 0x4]
MOV EAX,0x80000000
NOP dword ptr [RAX]
LAB_00101158:
MOV EDX,dword ptr [RDI]
CMP EAX,EDX
CMOVL EAX,EDX
ADD RDI,0x4
CMP RDI,RCX
JNZ 0x00101158
RET
LAB_00101170:
MOV EAX,0x80000000
RET | int func0(int *param_1,int param_2)
{
int *piVar1;
int iVar2;
if (0 < param_2) {
piVar1 = param_1 + (ulong)(param_2 - 1) + 1;
iVar2 = -0x80000000;
do {
if (iVar2 < *param_1) {
iVar2 = *param_1;
}
param_1 = param_1 + 1;
} while (param_1 != piVar1);
return iVar2;
}
return -0x80000000;
} |
5,071 | func0 |
#include <assert.h>
#include <limits.h>
| int func0(int listval[], int size){
int max_val = INT_MIN;
for(int i = 0; i < size; i++){
if(listval[i] > max_val){
max_val = listval[i];
}
}
return max_val;
}
| int main() {
int array1[] = {3, 2, 4, 5};
int size1 = sizeof(array1)/sizeof(array1[0]);
int array2[] = {15, 20, 25};
int size2 = sizeof(array2)/sizeof(array2[0]);
int array3[] = {30, 20, 40, 50};
int size3 = sizeof(array3)/sizeof(array3[0]);
assert(func0(array1, size1) == 5);
assert(func0(array2, size2) == 25);
assert(func0(array3, size3) == 50);
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 1210 <func0+0xd0>
lea -0x1(%rsi),%eax
cmp $0x2,%eax
jbe 1221 <func0+0xe1>
mov %esi,%edx
movdqa 0xeae(%rip),%xmm2
mov %rdi,%rax
shr $0x2,%edx
shl $0x4,%rdx
add %rdi,%rdx
movdqu (%rax),%xmm0
add $0x10,%rax
movdqa %xmm0,%xmm1
pcmpgtd %xmm2,%xmm1
pand %xmm1,%xmm0
pandn %xmm2,%xmm1
movdqa %xmm1,%xmm2
por %xmm0,%xmm2
cmp %rdx,%rax
jne 1170 <func0+0x30>
movdqa %xmm2,%xmm1
mov %esi,%edx
psrldq $0x8,%xmm1
and $0xfffffffc,%edx
movdqa %xmm1,%xmm0
pcmpgtd %xmm2,%xmm0
pand %xmm0,%xmm1
pandn %xmm2,%xmm0
por %xmm0,%xmm1
movdqa %xmm1,%xmm2
psrldq $0x4,%xmm2
movdqa %xmm2,%xmm0
pcmpgtd %xmm1,%xmm0
pand %xmm0,%xmm2
pandn %xmm1,%xmm0
por %xmm2,%xmm0
movd %xmm0,%eax
test $0x3,%sil
je 1220 <func0+0xe0>
movslq %edx,%rcx
mov (%rdi,%rcx,4),%ecx
cmp %ecx,%eax
cmovl %ecx,%eax
lea 0x1(%rdx),%ecx
cmp %ecx,%esi
jle 1215 <func0+0xd5>
movslq %ecx,%rcx
mov (%rdi,%rcx,4),%ecx
cmp %ecx,%eax
cmovl %ecx,%eax
add $0x2,%edx
cmp %edx,%esi
jle 1215 <func0+0xd5>
movslq %edx,%rdx
mov (%rdi,%rdx,4),%edx
cmp %edx,%eax
cmovl %edx,%eax
retq
xchg %ax,%ax
mov $0x80000000,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
retq
xor %edx,%edx
mov $0x80000000,%eax
jmp 11de <func0+0x9e>
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
mov ecx, esi
test esi, esi
jle loc_1220
lea eax, [rsi-1]
cmp eax, 2
jbe loc_1231
mov edx, esi
movdqa xmm2, cs:xmmword_2010
mov rax, rdi
shr edx, 2
shl rdx, 4
add rdx, rdi
nop dword ptr [rax+00000000h]
loc_1178:
movdqu xmm0, xmmword ptr [rax]
add rax, 10h
movdqa xmm1, xmm0
pcmpgtd xmm1, xmm2
pand xmm0, xmm1
pandn xmm1, xmm2
movdqa xmm2, xmm1
por xmm2, xmm0
cmp rax, rdx
jnz short loc_1178
movdqa xmm0, xmm2
mov edx, ecx
psrldq xmm0, 8
and edx, 0FFFFFFFCh
movdqa xmm1, xmm0
pcmpgtd xmm1, xmm2
pand xmm0, xmm1
pandn xmm1, xmm2
por xmm1, xmm0
movdqa xmm2, xmm1
psrldq xmm2, 4
movdqa xmm0, xmm2
pcmpgtd xmm0, xmm1
pand xmm2, xmm0
pandn xmm0, xmm1
por xmm0, xmm2
movd eax, xmm0
test cl, 3
jz short locret_1230
loc_11E5:
movsxd rsi, edx
lea r8, ds:0[rsi*4]
mov esi, [rdi+rsi*4]
cmp eax, esi
cmovl eax, esi
lea esi, [rdx+1]
cmp ecx, esi
jle short locret_1225
mov esi, [rdi+r8+4]
cmp eax, esi
cmovl eax, esi
add edx, 2
cmp ecx, edx
jle short locret_1225
mov edx, [rdi+r8+8]
cmp eax, edx
cmovl eax, edx
retn
loc_1220:
mov eax, 80000000h
locret_1225:
retn
locret_1230:
retn
loc_1231:
xor edx, edx
mov eax, 80000000h
jmp short loc_11E5 | long long func0(const __m128i *a1, int a2)
{
__m128i si128; // xmm2
const __m128i *v4; // rax
__m128i v5; // xmm0
__m128i v6; // xmm1
__m128i v7; // xmm0
signed int v8; // edx
__m128i v9; // xmm1
__m128i v10; // xmm1
__m128i v11; // xmm2
__m128i v12; // xmm0
long long result; // rax
long long v14; // r8
int v15; // esi
int v16; // esi
int v17; // edx
if ( a2 <= 0 )
return 0x80000000LL;
if ( (unsigned int)(a2 - 1) <= 2 )
{
v8 = 0;
result = 0x80000000LL;
}
else
{
si128 = _mm_load_si128((const __m128i *)&xmmword_2010);
v4 = a1;
do
{
v5 = _mm_loadu_si128(v4++);
v6 = _mm_cmpgt_epi32(v5, si128);
si128 = _mm_or_si128(_mm_andnot_si128(v6, si128), _mm_and_si128(v5, v6));
}
while ( v4 != &a1[(unsigned int)a2 >> 2] );
v7 = _mm_srli_si128(si128, 8);
v8 = a2 & 0xFFFFFFFC;
v9 = _mm_cmpgt_epi32(v7, si128);
v10 = _mm_or_si128(_mm_andnot_si128(v9, si128), _mm_and_si128(v7, v9));
v11 = _mm_srli_si128(v10, 4);
v12 = _mm_cmpgt_epi32(v11, v10);
result = (unsigned int)_mm_cvtsi128_si32(_mm_or_si128(_mm_andnot_si128(v12, v10), _mm_and_si128(v11, v12)));
if ( (a2 & 3) == 0 )
return result;
}
v14 = v8;
v15 = a1->m128i_i32[v14];
if ( (int)result < v15 )
result = (unsigned int)v15;
if ( a2 > v8 + 1 )
{
v16 = a1->m128i_i32[v14 + 1];
if ( (int)result < v16 )
result = (unsigned int)v16;
if ( a2 > v8 + 2 )
{
v17 = a1->m128i_i32[v14 + 2];
if ( (int)result < v17 )
return (unsigned int)v17;
}
}
return result;
} | func0:
ENDBR64
MOV ECX,ESI
TEST ESI,ESI
JLE 0x00101220
LEA EAX,[RSI + -0x1]
CMP EAX,0x2
JBE 0x00101231
MOV EDX,ESI
MOVDQA XMM2,xmmword ptr [0x00102010]
MOV RAX,RDI
SHR EDX,0x2
SHL RDX,0x4
ADD RDX,RDI
NOP dword ptr [RAX]
LAB_00101178:
MOVDQU XMM0,xmmword ptr [RAX]
ADD RAX,0x10
MOVDQA XMM1,XMM0
PCMPGTD XMM1,XMM2
PAND XMM0,XMM1
PANDN XMM1,XMM2
MOVDQA XMM2,XMM1
POR XMM2,XMM0
CMP RAX,RDX
JNZ 0x00101178
MOVDQA XMM0,XMM2
MOV EDX,ECX
PSRLDQ XMM0,0x8
AND EDX,0xfffffffc
MOVDQA XMM1,XMM0
PCMPGTD XMM1,XMM2
PAND XMM0,XMM1
PANDN XMM1,XMM2
POR XMM1,XMM0
MOVDQA XMM2,XMM1
PSRLDQ XMM2,0x4
MOVDQA XMM0,XMM2
PCMPGTD XMM0,XMM1
PAND XMM2,XMM0
PANDN XMM0,XMM1
POR XMM0,XMM2
MOVD EAX,XMM0
TEST CL,0x3
JZ 0x00101230
LAB_001011e5:
MOVSXD RSI,EDX
LEA R8,[RSI*0x4]
MOV ESI,dword ptr [RDI + RSI*0x4]
CMP EAX,ESI
CMOVL EAX,ESI
LEA ESI,[RDX + 0x1]
CMP ECX,ESI
JLE 0x00101225
MOV ESI,dword ptr [RDI + R8*0x1 + 0x4]
CMP EAX,ESI
CMOVL EAX,ESI
ADD EDX,0x2
CMP ECX,EDX
JLE 0x00101225
MOV EDX,dword ptr [RDI + R8*0x1 + 0x8]
CMP EAX,EDX
CMOVL EAX,EDX
RET
LAB_00101220:
MOV EAX,0x80000000
LAB_00101225:
RET
LAB_00101230:
RET
LAB_00101231:
XOR EDX,EDX
MOV EAX,0x80000000
JMP 0x001011e5 | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
uint func0(uint *param_1,uint param_2)
{
uint *puVar1;
uint *puVar2;
uint *puVar3;
uint *puVar4;
uint uVar5;
uint uVar6;
uint uVar7;
uint uVar8;
uint uVar9;
uint uVar10;
uint uVar11;
uint uVar12;
uint uVar13;
if ((int)param_2 < 1) {
uVar6 = 0x80000000;
}
else {
if (param_2 - 1 < 3) {
uVar5 = 0;
uVar6 = 0x80000000;
}
else {
puVar4 = param_1;
uVar6 = _DAT_00102010;
uVar11 = _UNK_00102014;
uVar12 = _UNK_00102018;
uVar13 = _UNK_0010201c;
do {
uVar5 = *puVar4;
puVar1 = puVar4 + 1;
puVar2 = puVar4 + 2;
puVar3 = puVar4 + 3;
puVar4 = puVar4 + 4;
uVar7 = -(uint)((int)uVar6 < (int)uVar5);
uVar8 = -(uint)((int)uVar11 < (int)*puVar1);
uVar9 = -(uint)((int)uVar12 < (int)*puVar2);
uVar10 = -(uint)((int)uVar13 < (int)*puVar3);
uVar6 = ~uVar7 & uVar6 | uVar5 & uVar7;
uVar11 = ~uVar8 & uVar11 | *puVar1 & uVar8;
uVar12 = ~uVar9 & uVar12 | *puVar2 & uVar9;
uVar13 = ~uVar10 & uVar13 | *puVar3 & uVar10;
} while (puVar4 != param_1 + (ulong)(param_2 >> 2) * 4);
uVar5 = param_2 & 0xfffffffc;
uVar12 = ~-(uint)((int)uVar6 < (int)uVar12) & uVar6 |
uVar12 & -(uint)((int)uVar6 < (int)uVar12);
uVar11 = ~-(uint)((int)uVar11 < (int)uVar13) & uVar11 |
uVar13 & -(uint)((int)uVar11 < (int)uVar13);
uVar6 = -(uint)((int)uVar12 < (int)uVar11);
uVar6 = ~uVar6 & uVar12 | uVar11 & uVar6;
if ((param_2 & 3) == 0) {
return uVar6;
}
}
if ((int)uVar6 < (int)param_1[(int)uVar5]) {
uVar6 = param_1[(int)uVar5];
}
if ((int)(uVar5 + 1) < (int)param_2) {
if ((int)uVar6 < (int)param_1[(long)(int)uVar5 + 1]) {
uVar6 = param_1[(long)(int)uVar5 + 1];
}
if ((int)(uVar5 + 2) < (int)param_2) {
if ((int)uVar6 < (int)param_1[(long)(int)uVar5 + 2]) {
uVar6 = param_1[(long)(int)uVar5 + 2];
}
return uVar6;
}
}
}
return uVar6;
} |
5,072 | func0 |
#include <assert.h>
| int func0(int number) {
int sum = 1;
for (int i = 2; i < number; i++) {
if (number % i == 0) {
sum += i;
}
}
return sum;
}
| int main() {
assert(func0(8) == 7);
assert(func0(12) == 16);
assert(func0(7) == 1);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %edi,-0x14(%rbp)
movl $0x1,-0x8(%rbp)
movl $0x2,-0x4(%rbp)
jmp 117b <func0+0x32>
mov -0x14(%rbp),%eax
cltd
idivl -0x4(%rbp)
mov %edx,%eax
test %eax,%eax
jne 1177 <func0+0x2e>
mov -0x4(%rbp),%eax
add %eax,-0x8(%rbp)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x14(%rbp),%eax
jl 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], 1
mov [rbp+var_4], 2
jmp short loc_117B
loc_1164:
mov eax, [rbp+var_14]
cdq
idiv [rbp+var_4]
mov eax, edx
test eax, eax
jnz short loc_1177
mov eax, [rbp+var_4]
add [rbp+var_8], eax
loc_1177:
add [rbp+var_4], 1
loc_117B:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_14]
jl 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 = 1;
for ( i = 2; i < a1; ++i )
{
if ( !(a1 % i) )
v2 += i;
}
return v2;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV dword ptr [RBP + -0x14],EDI
MOV dword ptr [RBP + -0x8],0x1
MOV dword ptr [RBP + -0x4],0x2
JMP 0x0010117b
LAB_00101164:
MOV EAX,dword ptr [RBP + -0x14]
CDQ
IDIV dword ptr [RBP + -0x4]
MOV EAX,EDX
TEST EAX,EAX
JNZ 0x00101177
MOV EAX,dword ptr [RBP + -0x4]
ADD dword ptr [RBP + -0x8],EAX
LAB_00101177:
ADD dword ptr [RBP + -0x4],0x1
LAB_0010117b:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x14]
JL 0x00101164
MOV EAX,dword ptr [RBP + -0x8]
POP RBP
RET | int func0(int param_1)
{
int4 local_10;
int4 local_c;
local_10 = 1;
for (local_c = 2; local_c < param_1; local_c = local_c + 1) {
if (param_1 % local_c == 0) {
local_10 = local_10 + local_c;
}
}
return local_10;
} |
5,073 | func0 |
#include <assert.h>
| int func0(int number) {
int sum = 1;
for (int i = 2; i < number; i++) {
if (number % i == 0) {
sum += i;
}
}
return sum;
}
| int main() {
assert(func0(8) == 7);
assert(func0(12) == 16);
assert(func0(7) == 1);
return 0;
}
| O1 | c | func0:
endbr64
cmp $0x2,%edi
jle 1173 <func0+0x2a>
mov $0x2,%ecx
mov $0x1,%esi
mov %edi,%eax
cltd
idiv %ecx
lea (%rsi,%rcx,1),%eax
test %edx,%edx
cmove %eax,%esi
add $0x1,%ecx
cmp %ecx,%edi
jne 115c <func0+0x13>
mov %esi,%eax
retq
mov $0x1,%esi
jmp 1170 <func0+0x27>
| func0:
endbr64
cmp edi, 2
jle short loc_1173
mov ecx, 2
mov esi, 1
loc_115C:
mov eax, edi
cdq
idiv ecx
lea eax, [rsi+rcx]
test edx, edx
cmovz esi, eax
add ecx, 1
cmp edi, ecx
jnz short loc_115C
loc_1170:
mov eax, esi
retn
loc_1173:
mov esi, 1
jmp short loc_1170 | long long func0(int a1)
{
int v1; // ecx
unsigned int v2; // esi
if ( a1 <= 2 )
{
return 1;
}
else
{
v1 = 2;
v2 = 1;
do
{
if ( !(a1 % v1) )
v2 += v1;
++v1;
}
while ( a1 != v1 );
}
return v2;
} | func0:
ENDBR64
CMP EDI,0x2
JLE 0x00101173
MOV ECX,0x2
MOV ESI,0x1
LAB_0010115c:
MOV EAX,EDI
CDQ
IDIV ECX
LEA EAX,[RSI + RCX*0x1]
TEST EDX,EDX
CMOVZ ESI,EAX
ADD ECX,0x1
CMP EDI,ECX
JNZ 0x0010115c
LAB_00101170:
MOV EAX,ESI
RET
LAB_00101173:
MOV ESI,0x1
JMP 0x00101170 | int func0(int param_1)
{
int iVar1;
int iVar2;
if (param_1 < 3) {
iVar2 = 1;
}
else {
iVar1 = 2;
iVar2 = 1;
do {
if (param_1 % iVar1 == 0) {
iVar2 = iVar2 + iVar1;
}
iVar1 = iVar1 + 1;
} while (param_1 != iVar1);
}
return iVar2;
} |
5,074 | func0 |
#include <assert.h>
| int func0(int number) {
int sum = 1;
for (int i = 2; i < number; i++) {
if (number % i == 0) {
sum += i;
}
}
return sum;
}
| int main() {
assert(func0(8) == 7);
assert(func0(12) == 16);
assert(func0(7) == 1);
return 0;
}
| O2 | c | func0:
endbr64
cmp $0x2,%edi
jle 1238 <func0+0x38>
mov $0x2,%ecx
mov $0x1,%r8d
nopl 0x0(%rax)
mov %edi,%eax
cltd
idiv %ecx
lea (%r8,%rcx,1),%eax
test %edx,%edx
cmove %eax,%r8d
add $0x1,%ecx
cmp %ecx,%edi
jne 1218 <func0+0x18>
mov %r8d,%eax
retq
nopw 0x0(%rax,%rax,1)
mov $0x1,%r8d
mov %r8d,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax)
| func0:
endbr64
cmp edi, 2
jle short loc_1238
mov ecx, 2
mov r8d, 1
nop dword ptr [rax+00h]
loc_1218:
mov eax, edi
cdq
idiv ecx
lea eax, [r8+rcx]
test edx, edx
cmovz r8d, eax
add ecx, 1
cmp edi, ecx
jnz short loc_1218
mov eax, r8d
retn
loc_1238:
mov r8d, 1
mov eax, r8d
retn | long long func0(int a1)
{
int v1; // ecx
unsigned int v2; // r8d
if ( a1 <= 2 )
return 1LL;
v1 = 2;
v2 = 1;
do
{
if ( !(a1 % v1) )
v2 += v1;
++v1;
}
while ( a1 != v1 );
return v2;
} | func0:
ENDBR64
CMP EDI,0x2
JLE 0x00101238
MOV ECX,0x2
MOV R8D,0x1
NOP dword ptr [RAX]
LAB_00101218:
MOV EAX,EDI
CDQ
IDIV ECX
LEA EAX,[R8 + RCX*0x1]
TEST EDX,EDX
CMOVZ R8D,EAX
ADD ECX,0x1
CMP EDI,ECX
JNZ 0x00101218
MOV EAX,R8D
RET
LAB_00101238:
MOV R8D,0x1
MOV EAX,R8D
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
if (2 < param_1) {
iVar1 = 2;
iVar2 = 1;
do {
if (param_1 % iVar1 == 0) {
iVar2 = iVar2 + iVar1;
}
iVar1 = iVar1 + 1;
} while (param_1 != iVar1);
return iVar2;
}
return 1;
} |
5,075 | func0 |
#include <assert.h>
| int func0(int number) {
int sum = 1;
for (int i = 2; i < number; i++) {
if (number % i == 0) {
sum += i;
}
}
return sum;
}
| int main() {
assert(func0(8) == 7);
assert(func0(12) == 16);
assert(func0(7) == 1);
return 0;
}
| O3 | c | func0:
endbr64
cmp $0x2,%edi
jle 1178 <func0+0x38>
mov $0x2,%ecx
mov $0x1,%r8d
nopl 0x0(%rax)
mov %edi,%eax
cltd
idiv %ecx
lea (%r8,%rcx,1),%eax
test %edx,%edx
cmove %eax,%r8d
add $0x1,%ecx
cmp %ecx,%edi
jne 1158 <func0+0x18>
mov %r8d,%eax
retq
nopw 0x0(%rax,%rax,1)
mov $0x1,%r8d
mov %r8d,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax)
| func0:
endbr64
cmp edi, 2
jle short loc_1170
mov ecx, 2
mov esi, 1
nop dword ptr [rax+rax+00h]
loc_1158:
mov eax, edi
cdq
idiv ecx
lea eax, [rsi+rcx]
test edx, edx
cmovz esi, eax
add ecx, 1
cmp edi, ecx
jnz short loc_1158
mov eax, esi
retn
loc_1170:
mov esi, 1
mov eax, esi
retn | long long func0(int a1)
{
int v1; // ecx
unsigned int v2; // esi
if ( a1 <= 2 )
return 1LL;
v1 = 2;
v2 = 1;
do
{
if ( !(a1 % v1) )
v2 += v1;
++v1;
}
while ( a1 != v1 );
return v2;
} | func0:
ENDBR64
CMP EDI,0x2
JLE 0x00101170
MOV ECX,0x2
MOV ESI,0x1
NOP dword ptr [RAX + RAX*0x1]
LAB_00101158:
MOV EAX,EDI
CDQ
IDIV ECX
LEA EAX,[RSI + RCX*0x1]
TEST EDX,EDX
CMOVZ ESI,EAX
ADD ECX,0x1
CMP EDI,ECX
JNZ 0x00101158
MOV EAX,ESI
RET
LAB_00101170:
MOV ESI,0x1
MOV EAX,ESI
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
if (2 < param_1) {
iVar1 = 2;
iVar2 = 1;
do {
if (param_1 % iVar1 == 0) {
iVar2 = iVar2 + iVar1;
}
iVar1 = iVar1 + 1;
} while (param_1 != iVar1);
return iVar2;
}
return 1;
} |
5,076 | func0 |
#include <assert.h>
| int func0(int arr[], int n) {
int inv_count = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (arr[i] > arr[j]) {
inv_count += 1;
}
}
}
return inv_count;
}
| int main() {
int arr1[] = {1, 20, 6, 4, 5};
int arr2[] = {1, 2, 1};
int arr3[] = {1, 2, 5, 6, 1};
assert(func0(arr1, 5) == 5);
assert(func0(arr2, 3) == 1);
assert(func0(arr3, 5) == 3);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
movl $0x0,-0xc(%rbp)
movl $0x0,-0x8(%rbp)
jmp 11d7 <func0+0x6e>
mov -0x8(%rbp),%eax
add $0x1,%eax
mov %eax,-0x4(%rbp)
jmp 11cb <func0+0x62>
mov -0x8(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%edx
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rcx
mov -0x18(%rbp),%rax
add %rcx,%rax
mov (%rax),%eax
cmp %eax,%edx
jle 11c7 <func0+0x5e>
addl $0x1,-0xc(%rbp)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 1193 <func0+0x2a>
addl $0x1,-0x8(%rbp)
mov -0x8(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 1188 <func0+0x1f>
mov -0xc(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_C], 0
mov [rbp+var_8], 0
jmp short loc_11D7
loc_1188:
mov eax, [rbp+var_8]
add eax, 1
mov [rbp+var_4], eax
jmp short loc_11CB
loc_1193:
mov eax, [rbp+var_8]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov edx, [rax]
mov eax, [rbp+var_4]
cdqe
lea rcx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rcx
mov eax, [rax]
cmp edx, eax
jle short loc_11C7
add [rbp+var_C], 1
loc_11C7:
add [rbp+var_4], 1
loc_11CB:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_1193
add [rbp+var_8], 1
loc_11D7:
mov eax, [rbp+var_8]
cmp eax, [rbp+var_1C]
jl short loc_1188
mov eax, [rbp+var_C]
pop rbp
retn | long long func0(long long a1, int a2)
{
unsigned int v3; // [rsp+10h] [rbp-Ch]
int i; // [rsp+14h] [rbp-8h]
int j; // [rsp+18h] [rbp-4h]
v3 = 0;
for ( i = 0; i < a2; ++i )
{
for ( j = i + 1; j < a2; ++j )
{
if ( *(_DWORD *)(4LL * i + a1) > *(_DWORD *)(4LL * j + a1) )
++v3;
}
}
return v3;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0xc],0x0
MOV dword ptr [RBP + -0x8],0x0
JMP 0x001011d7
LAB_00101188:
MOV EAX,dword ptr [RBP + -0x8]
ADD EAX,0x1
MOV dword ptr [RBP + -0x4],EAX
JMP 0x001011cb
LAB_00101193:
MOV EAX,dword ptr [RBP + -0x8]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RCX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RCX
MOV EAX,dword ptr [RAX]
CMP EDX,EAX
JLE 0x001011c7
ADD dword ptr [RBP + -0xc],0x1
LAB_001011c7:
ADD dword ptr [RBP + -0x4],0x1
LAB_001011cb:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x00101193
ADD dword ptr [RBP + -0x8],0x1
LAB_001011d7:
MOV EAX,dword ptr [RBP + -0x8]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x00101188
MOV EAX,dword ptr [RBP + -0xc]
POP RBP
RET | int func0(long param_1,int param_2)
{
int4 local_14;
int4 local_10;
int4 local_c;
local_14 = 0;
for (local_10 = 0; local_c = local_10, local_10 < param_2; local_10 = local_10 + 1) {
while (local_c = local_c + 1, local_c < param_2) {
if (*(int *)(param_1 + (long)local_c * 4) < *(int *)(param_1 + (long)local_10 * 4)) {
local_14 = local_14 + 1;
}
}
}
return local_14;
} |
5,077 | func0 |
#include <assert.h>
| int func0(int arr[], int n) {
int inv_count = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (arr[i] > arr[j]) {
inv_count += 1;
}
}
}
return inv_count;
}
| int main() {
int arr1[] = {1, 20, 6, 4, 5};
int arr2[] = {1, 2, 1};
int arr3[] = {1, 2, 5, 6, 1};
assert(func0(arr1, 5) == 5);
assert(func0(arr2, 3) == 1);
assert(func0(arr3, 5) == 3);
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 11ab <func0+0x42>
lea -0x1(%rsi),%r9d
add $0x1,%r9
mov $0x1,%r8d
mov $0x0,%ecx
jmp 119c <func0+0x33>
add $0x1,%rax
cmp %eax,%esi
jle 1198 <func0+0x2f>
cmp (%rdi,%rax,4),%edx
jle 1186 <func0+0x1d>
add $0x1,%ecx
jmp 1186 <func0+0x1d>
add $0x1,%r8
cmp %r9,%r8
je 11b0 <func0+0x47>
mov -0x4(%rdi,%r8,4),%edx
mov %r8,%rax
jmp 118e <func0+0x25>
mov $0x0,%ecx
mov %ecx,%eax
retq
| func0:
endbr64
test esi, esi
jle short loc_11A6
mov r9d, esi
mov r8d, 1
mov ecx, 0
jmp short loc_1197
loc_1181:
add rax, 1
cmp esi, eax
jle short loc_1193
loc_1189:
cmp edx, [rdi+rax*4]
jle short loc_1181
add ecx, 1
jmp short loc_1181
loc_1193:
add r8, 1
loc_1197:
cmp r8, r9
jz short loc_11AB
mov edx, [rdi+r8*4-4]
mov rax, r8
jmp short loc_1189
loc_11A6:
mov ecx, 0
loc_11AB:
mov eax, ecx
retn | long long func0(long long a1, int a2)
{
long long v2; // r8
unsigned int v3; // ecx
long long v4; // rax
if ( a2 <= 0 )
{
return 0;
}
else
{
v2 = 1LL;
v3 = 0;
while ( v2 != a2 )
{
v4 = v2;
do
{
if ( *(_DWORD *)(a1 + 4 * v2 - 4) > *(_DWORD *)(a1 + 4 * v4) )
++v3;
++v4;
}
while ( a2 > (int)v4 );
++v2;
}
}
return v3;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001011a6
MOV R9D,ESI
MOV R8D,0x1
MOV ECX,0x0
JMP 0x00101197
LAB_00101181:
ADD RAX,0x1
CMP ESI,EAX
JLE 0x00101193
LAB_00101189:
CMP EDX,dword ptr [RDI + RAX*0x4]
JLE 0x00101181
ADD ECX,0x1
JMP 0x00101181
LAB_00101193:
ADD R8,0x1
LAB_00101197:
CMP R8,R9
JZ 0x001011ab
MOV EDX,dword ptr [RDI + R8*0x4 + -0x4]
MOV RAX,R8
JMP 0x00101189
LAB_001011a6:
MOV ECX,0x0
LAB_001011ab:
MOV EAX,ECX
RET | int func0(long param_1,uint param_2)
{
ulong uVar1;
int iVar2;
ulong uVar3;
if ((int)param_2 < 1) {
iVar2 = 0;
}
else {
iVar2 = 0;
for (uVar3 = 1; uVar3 != param_2; uVar3 = uVar3 + 1) {
uVar1 = uVar3;
do {
if (*(int *)(param_1 + uVar1 * 4) < *(int *)(param_1 + -4 + uVar3 * 4)) {
iVar2 = iVar2 + 1;
}
uVar1 = uVar1 + 1;
} while ((int)uVar1 < (int)param_2);
}
}
return iVar2;
} |
5,078 | func0 |
#include <assert.h>
| int func0(int arr[], int n) {
int inv_count = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (arr[i] > arr[j]) {
inv_count += 1;
}
}
}
return inv_count;
}
| int main() {
int arr1[] = {1, 20, 6, 4, 5};
int arr2[] = {1, 2, 1};
int arr3[] = {1, 2, 5, 6, 1};
assert(func0(arr1, 5) == 5);
assert(func0(arr2, 3) == 1);
assert(func0(arr3, 5) == 3);
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 137e <func0+0x4e>
lea -0x1(%rsi),%r9d
mov $0x1,%ecx
xor %r8d,%r8d
add $0x1,%r9
cmp %r9,%rcx
je 137a <func0+0x4a>
nopl (%rax)
mov -0x4(%rdi,%rcx,4),%edx
mov %rcx,%rax
nopw 0x0(%rax,%rax,1)
cmp (%rdi,%rax,4),%edx
jle 1369 <func0+0x39>
add $0x1,%r8d
add $0x1,%rax
cmp %eax,%esi
jg 1360 <func0+0x30>
add $0x1,%rcx
cmp %r9,%rcx
jne 1350 <func0+0x20>
mov %r8d,%eax
retq
xor %r8d,%r8d
mov %r8d,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_12EE
movsxd r9, esi
mov ecx, 1
xor r8d, r8d
cmp rcx, r9
jz short loc_12EA
nop dword ptr [rax+rax+00000000h]
loc_12C0:
mov edx, [rdi+rcx*4-4]
mov rax, rcx
nop word ptr [rax+rax+00000000h]
loc_12D0:
cmp edx, [rdi+rax*4]
jle short loc_12D9
add r8d, 1
loc_12D9:
add rax, 1
cmp esi, eax
jg short loc_12D0
add rcx, 1
cmp rcx, r9
jnz short loc_12C0
loc_12EA:
mov eax, r8d
retn
loc_12EE:
xor r8d, r8d
mov eax, r8d
retn | long long func0(long long a1, int a2)
{
long long v2; // rcx
unsigned int i; // r8d
long long v4; // rax
if ( a2 <= 0 )
return 0LL;
v2 = 1LL;
for ( i = 0; v2 != a2; ++v2 )
{
v4 = v2;
do
{
if ( *(_DWORD *)(a1 + 4 * v2 - 4) > *(_DWORD *)(a1 + 4 * v4) )
++i;
++v4;
}
while ( a2 > (int)v4 );
}
return i;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001012ee
MOVSXD R9,ESI
MOV ECX,0x1
XOR R8D,R8D
CMP RCX,R9
JZ 0x001012ea
NOP dword ptr [RAX + RAX*0x1]
LAB_001012c0:
MOV EDX,dword ptr [RDI + RCX*0x4 + -0x4]
MOV RAX,RCX
NOP word ptr [RAX + RAX*0x1]
LAB_001012d0:
CMP EDX,dword ptr [RDI + RAX*0x4]
JLE 0x001012d9
ADD R8D,0x1
LAB_001012d9:
ADD RAX,0x1
CMP ESI,EAX
JG 0x001012d0
ADD RCX,0x1
CMP RCX,R9
JNZ 0x001012c0
LAB_001012ea:
MOV EAX,R8D
RET
LAB_001012ee:
XOR R8D,R8D
MOV EAX,R8D
RET | int func0(long param_1,int param_2)
{
long lVar1;
long lVar2;
int iVar3;
if (param_2 < 1) {
return 0;
}
lVar2 = 1;
iVar3 = 0;
if ((long)param_2 != 1) {
do {
lVar1 = lVar2;
do {
if (*(int *)(param_1 + lVar1 * 4) < *(int *)(param_1 + -4 + lVar2 * 4)) {
iVar3 = iVar3 + 1;
}
lVar1 = lVar1 + 1;
} while ((int)lVar1 < param_2);
lVar2 = lVar2 + 1;
} while (lVar2 != param_2);
}
return iVar3;
} |
5,079 | func0 |
#include <assert.h>
| int func0(int arr[], int n) {
int inv_count = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (arr[i] > arr[j]) {
inv_count += 1;
}
}
}
return inv_count;
}
| int main() {
int arr1[] = {1, 20, 6, 4, 5};
int arr2[] = {1, 2, 1};
int arr3[] = {1, 2, 5, 6, 1};
assert(func0(arr1, 5) == 5);
assert(func0(arr2, 3) == 1);
assert(func0(arr3, 5) == 3);
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 143d <func0+0x12d>
cmp $0x1,%esi
je 143d <func0+0x12d>
push %rbp
lea 0x4(%rdi),%r10
xor %r9d,%r9d
mov $0x1,%ecx
push %rbx
lea -0x1(%rsi),%ebp
mov $0x1,%ebx
nopl 0x0(%rax,%rax,1)
mov %esi,%r8d
mov %ebp,%eax
mov -0x4(%r10),%r11d
sub %ecx,%r8d
cmp %ecx,%esi
cmovle %ebx,%r8d
sub %ecx,%eax
cmp $0x3,%eax
jbe 1439 <func0+0x129>
cmp %ecx,%esi
jle 1439 <func0+0x129>
mov %r8d,%edx
movd %r11d,%xmm4
pxor %xmm0,%xmm0
mov %r10,%rax
shr $0x2,%edx
pshufd $0x0,%xmm4,%xmm2
shl $0x4,%rdx
add %r10,%rdx
nopl 0x0(%rax,%rax,1)
movdqu (%rax),%xmm3
movdqa %xmm2,%xmm1
add $0x10,%rax
pcmpgtd %xmm3,%xmm1
psubd %xmm1,%xmm0
cmp %rax,%rdx
jne 1388 <func0+0x78>
movdqa %xmm0,%xmm1
mov %r8d,%edx
psrldq $0x8,%xmm1
and $0xfffffffc,%edx
paddd %xmm1,%xmm0
movdqa %xmm0,%xmm1
psrldq $0x4,%xmm1
paddd %xmm1,%xmm0
movd %xmm0,%eax
add %eax,%r9d
lea (%rdx,%rcx,1),%eax
cmp %edx,%r8d
je 1424 <func0+0x114>
movslq %eax,%r8
cmp (%rdi,%r8,4),%r11d
lea 0x0(,%r8,4),%rdx
setg %r8b
movzbl %r8b,%r8d
add %r8d,%r9d
lea 0x1(%rax),%r8d
cmp %r8d,%esi
jle 1424 <func0+0x114>
cmp 0x4(%rdi,%rdx,1),%r11d
jle 13fe <func0+0xee>
add $0x1,%r9d
lea 0x2(%rax),%r8d
cmp %r8d,%esi
jle 1424 <func0+0x114>
cmp 0x8(%rdi,%rdx,1),%r11d
jle 1412 <func0+0x102>
add $0x1,%r9d
add $0x3,%eax
cmp %esi,%eax
jge 1424 <func0+0x114>
cmp 0xc(%rdi,%rdx,1),%r11d
jle 1424 <func0+0x114>
add $0x1,%r9d
add $0x1,%ecx
add $0x4,%r10
cmp %ecx,%esi
jne 1340 <func0+0x30>
mov %r9d,%eax
pop %rbx
pop %rbp
retq
mov %ecx,%eax
jmp 13d0 <func0+0xc0>
xor %r9d,%r9d
mov %r9d,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
xchg %ax,%ax
| func0:
endbr64
test esi, esi
jle loc_1248
cmp esi, 1
jz loc_1248
push rbp
mov r11, rdi
lea r8, [rdi+4]
xor r9d, r9d
push rbx
mov ecx, 1
lea ebp, [rsi-1]
mov ebx, 1
xchg ax, ax
loc_1170:
mov edi, esi
mov eax, ebp
mov r10d, [r8-4]
sub edi, ecx
cmp esi, ecx
cmovle edi, ebx
sub eax, ecx
cmp eax, 2
jbe loc_1244
cmp esi, ecx
jle loc_1244
mov edx, edi
movd xmm4, r10d
pxor xmm0, xmm0
mov rax, r8
shr edx, 2
pshufd xmm2, xmm4, 0
shl rdx, 4
add rdx, r8
nop
loc_11B0:
movdqu xmm3, xmmword ptr [rax]
movdqa xmm1, xmm2
add rax, 10h
pcmpgtd xmm1, xmm3
psubd xmm0, xmm1
cmp rax, rdx
jnz short loc_11B0
movdqa xmm1, xmm0
psrldq xmm1, 8
paddd xmm0, xmm1
movdqa xmm1, xmm0
psrldq xmm1, 4
paddd xmm0, xmm1
movd eax, xmm0
add r9d, eax
mov eax, edi
and eax, 0FFFFFFFCh
add eax, ecx
and edi, 3
jz short loc_122F
loc_11F6:
movsxd rdx, eax
lea rdi, ds:0[rdx*4]
cmp r10d, [r11+rdx*4]
jle short loc_120B
add r9d, 1
loc_120B:
lea edx, [rax+1]
cmp esi, edx
jle short loc_122F
cmp r10d, [r11+rdi+4]
jle short loc_121D
add r9d, 1
loc_121D:
add eax, 2
cmp esi, eax
jle short loc_122F
cmp r10d, [r11+rdi+8]
jle short loc_122F
add r9d, 1
loc_122F:
add ecx, 1
add r8, 4
cmp esi, ecx
jnz loc_1170
mov eax, r9d
pop rbx
pop rbp
retn
loc_1244:
mov eax, ecx
jmp short loc_11F6
loc_1248:
xor r9d, r9d
mov eax, r9d
retn | long long func0(long long a1, int a2)
{
const __m128i *v3; // r8
unsigned int v4; // r9d
int v5; // ecx
signed int v6; // r10d
unsigned int v7; // edi
__m128i v8; // xmm0
const __m128i *v9; // rax
__m128i v10; // xmm2
__m128i v11; // xmm3
__m128i v12; // xmm0
int v13; // eax
long long v14; // rdi
if ( a2 >= 2 )
{
v3 = (const __m128i *)(a1 + 4);
v4 = 0;
v5 = 1;
while ( 1 )
{
v6 = v3[-1].m128i_i32[3];
v7 = a2 - v5;
if ( a2 <= v5 )
v7 = 1;
if ( (unsigned int)(a2 - 1 - v5) <= 2 || a2 <= v5 )
break;
v8 = 0LL;
v9 = v3;
v10 = _mm_shuffle_epi32(_mm_cvtsi32_si128(v6), 0);
do
{
v11 = _mm_loadu_si128(v9++);
v8 = _mm_sub_epi32(v8, _mm_cmpgt_epi32(v10, v11));
}
while ( v9 != &v3[v7 >> 2] );
v12 = _mm_add_epi32(v8, _mm_srli_si128(v8, 8));
v4 += _mm_cvtsi128_si32(_mm_add_epi32(v12, _mm_srli_si128(v12, 4)));
v13 = v5 + (v7 & 0xFFFFFFFC);
if ( (v7 & 3) != 0 )
goto LABEL_10;
LABEL_18:
++v5;
v3 = (const __m128i *)((char *)v3 + 4);
if ( a2 == v5 )
return v4;
}
v13 = v5;
LABEL_10:
v14 = 4LL * v13;
if ( v6 > *(_DWORD *)(a1 + v14) )
++v4;
if ( a2 > v13 + 1 )
{
if ( v6 > *(_DWORD *)(a1 + v14 + 4) )
++v4;
if ( a2 > v13 + 2 && v6 > *(_DWORD *)(a1 + v14 + 8) )
++v4;
}
goto LABEL_18;
}
return 0LL;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101248
CMP ESI,0x1
JZ 0x00101248
PUSH RBP
MOV R11,RDI
LEA R8,[RDI + 0x4]
XOR R9D,R9D
PUSH RBX
MOV ECX,0x1
LEA EBP,[RSI + -0x1]
MOV EBX,0x1
NOP
LAB_00101170:
MOV EDI,ESI
MOV EAX,EBP
MOV R10D,dword ptr [R8 + -0x4]
SUB EDI,ECX
CMP ESI,ECX
CMOVLE EDI,EBX
SUB EAX,ECX
CMP EAX,0x2
JBE 0x00101244
CMP ESI,ECX
JLE 0x00101244
MOV EDX,EDI
MOVD XMM4,R10D
PXOR XMM0,XMM0
MOV RAX,R8
SHR EDX,0x2
PSHUFD XMM2,XMM4,0x0
SHL RDX,0x4
ADD RDX,R8
NOP
LAB_001011b0:
MOVDQU XMM3,xmmword ptr [RAX]
MOVDQA XMM1,XMM2
ADD RAX,0x10
PCMPGTD XMM1,XMM3
PSUBD XMM0,XMM1
CMP RAX,RDX
JNZ 0x001011b0
MOVDQA XMM1,XMM0
PSRLDQ XMM1,0x8
PADDD XMM0,XMM1
MOVDQA XMM1,XMM0
PSRLDQ XMM1,0x4
PADDD XMM0,XMM1
MOVD EAX,XMM0
ADD R9D,EAX
MOV EAX,EDI
AND EAX,0xfffffffc
ADD EAX,ECX
AND EDI,0x3
JZ 0x0010122f
LAB_001011f6:
MOVSXD RDX,EAX
LEA RDI,[RDX*0x4]
CMP R10D,dword ptr [R11 + RDX*0x4]
JLE 0x0010120b
ADD R9D,0x1
LAB_0010120b:
LEA EDX,[RAX + 0x1]
CMP ESI,EDX
JLE 0x0010122f
CMP R10D,dword ptr [R11 + RDI*0x1 + 0x4]
JLE 0x0010121d
ADD R9D,0x1
LAB_0010121d:
ADD EAX,0x2
CMP ESI,EAX
JLE 0x0010122f
CMP R10D,dword ptr [R11 + RDI*0x1 + 0x8]
JLE 0x0010122f
ADD R9D,0x1
LAB_0010122f:
ADD ECX,0x1
ADD R8,0x4
CMP ESI,ECX
JNZ 0x00101170
MOV EAX,R9D
POP RBX
POP RBP
RET
LAB_00101244:
MOV EAX,ECX
JMP 0x001011f6
LAB_00101248:
XOR R9D,R9D
MOV EAX,R9D
RET | int func0(long param_1,int param_2)
{
long lVar1;
int iVar2;
uint uVar3;
int iVar4;
int *piVar5;
int *piVar6;
int *piVar7;
int *piVar8;
int iVar9;
int *piVar10;
int iVar11;
int iVar12;
int iVar13;
int iVar14;
int iVar15;
if ((param_2 < 1) || (param_2 == 1)) {
return 0;
}
piVar10 = (int *)(param_1 + 4);
iVar11 = 0;
iVar9 = 1;
do {
iVar2 = piVar10[-1];
uVar3 = param_2 - iVar9;
if (param_2 <= iVar9) {
uVar3 = 1;
}
iVar12 = iVar9;
if (((uint)((param_2 + -1) - iVar9) < 3) || (param_2 <= iVar9)) {
LAB_001011f6:
lVar1 = (long)iVar12 * 4;
if (*(int *)(param_1 + (long)iVar12 * 4) < iVar2) {
iVar11 = iVar11 + 1;
}
if (iVar12 + 1 < param_2) {
if (*(int *)(param_1 + 4 + lVar1) < iVar2) {
iVar11 = iVar11 + 1;
}
if ((iVar12 + 2 < param_2) && (*(int *)(param_1 + 8 + lVar1) < iVar2)) {
iVar11 = iVar11 + 1;
}
}
}
else {
iVar12 = 0;
iVar13 = 0;
iVar14 = 0;
iVar15 = 0;
piVar8 = piVar10;
do {
iVar4 = *piVar8;
piVar5 = piVar8 + 1;
piVar6 = piVar8 + 2;
piVar7 = piVar8 + 3;
piVar8 = piVar8 + 4;
iVar12 = iVar12 + (uint)(iVar4 < iVar2);
iVar13 = iVar13 + (uint)(*piVar5 < iVar2);
iVar14 = iVar14 + (uint)(*piVar6 < iVar2);
iVar15 = iVar15 + (uint)(*piVar7 < iVar2);
} while (piVar8 != piVar10 + (ulong)(uVar3 >> 2) * 4);
iVar11 = iVar11 + iVar12 + iVar14 + iVar13 + iVar15;
iVar12 = (uVar3 & 0xfffffffc) + iVar9;
if ((uVar3 & 3) != 0) goto LAB_001011f6;
}
iVar9 = iVar9 + 1;
piVar10 = piVar10 + 1;
if (param_2 == iVar9) {
return iVar11;
}
} while( true );
} |
5,080 | func0 |
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
// Define a dynamic array structure
typedef struct {
int *data;
size_t size;
size_t capacity;
} DynamicArray;
// Initialize dynamic array
void init_array(DynamicArray *arr) {
arr->capacity = 16;
arr->size = 0;
arr->data = malloc(arr->capacity * sizeof(int));
if (!arr->data) {
perror("Failed to allocate memory");
exit(EXIT_FAILURE);
}
}
// Append to dynamic array
void append(DynamicArray *arr, int value) {
if (arr->size == arr->capacity) {
arr->capacity *= 2;
int *temp = realloc(arr->data, arr->capacity * sizeof(int));
if (!temp) {
perror("Failed to reallocate memory");
free(arr->data);
exit(EXIT_FAILURE);
}
arr->data = temp;
}
arr->data[arr->size++] = value;
}
// Reverse dynamic array
void reverse_array(DynamicArray *arr) {
for (size_t i = 0; i < arr->size / 2; ++i) {
int temp = arr->data[i];
arr->data[i] = arr->data[arr->size - 1 - i];
arr->data[arr->size - 1 - i] = temp;
}
}
// Flatten list function
| DynamicArray func0(int **list, size_t list_size, size_t *out_size) {
DynamicArray result;
init_array(&result);
if (list_size == 0) {
*out_size = 0;
return result;
}
// Implementing a simple stack using dynamic arrays
typedef struct {
int **data;
size_t size;
size_t capacity;
} Stack;
Stack stack;
stack.capacity = 16;
stack.size = 0;
stack.data = malloc(stack.capacity * sizeof(int *));
if (!stack.data) {
perror("Failed to allocate memory for stack");
exit(EXIT_FAILURE);
}
// Push the initial list to stack
stack.data[stack.size++] = NULL; // NULL indicates the main list
stack.data[stack.size++] = list;
while (stack.size > 0) {
int *current = stack.data[--stack.size];
if (current == NULL) continue;
// This simplistic implementation assumes all nested lists are NULL-terminated
for (size_t i = 0; i < list_size; ++i) {
append(&result, current[i]);
}
}
reverse_array(&result);
*out_size = result.size;
free(stack.data);
return result;
}
| int main() {
// First test case
int list1_part1[] = {0, 10};
int list1_part2[] = {20, 30};
int list1_part3[] = {40, 50};
int list1_part4[] = {60, 70, 80};
int list1_part5[] = {90, 100, 110, 120};
// For simplicity, we flatten manually
int flattened1[] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120};
// Second test case
int list2_part1[] = {10, 20};
int list2_part2[] = {40};
int list2_part3[] = {30, 56, 25};
int list2_part4[] = {10, 20};
int list2_part5[] = {33};
int list2_part6[] = {40};
int flattened2[] = {10, 20, 40, 30, 56, 25, 10, 20, 33, 40};
// Third test case
int list3_part1[] = {1,2,3};
int list3_part2[] = {4,5,6};
int list3_part3[] = {10,11,12};
int list3_part4[] = {7,8,9};
int flattened3[] = {1, 2, 3, 4, 5, 6, 10, 11, 12, 7, 8, 9};
// Since proper flattening is complex in C, we directly use the expected flattened arrays in asserts
// First assert
int expected1[] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120};
size_t size1 = 13;
DynamicArray result1 = func0(NULL, 0, &size1); // Dummy call
// Since we cannot implement full flattening, manually assign
result1.size = size1;
result1.data = expected1;
for(size_t i = 0; i < size1; ++i){
assert(result1.data[i] == expected1[i]);
}
// Second assert
int expected2[] = {10, 20, 40, 30, 56, 25, 10, 20, 33, 40};
size_t size2 = 10;
DynamicArray result2 = func0(NULL, 0, &size2); // Dummy call
result2.size = size2;
result2.data = expected2;
for(size_t i = 0; i < size2; ++i){
assert(result2.data[i] == expected2[i]);
}
// Third assert
int expected3[] = {1, 2, 3, 4, 5, 6, 10, 11, 12, 7, 8, 9};
size_t size3 = 12;
DynamicArray result3 = func0(NULL, 0, &size3); // Dummy call
result3.size = size3;
result3.data = expected3;
for(size_t i = 0; i < size3; ++i){
assert(result3.data[i] == expected3[i]);
}
printf("All assertions passed.\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x70,%rsp
mov %rdi,-0x58(%rbp)
mov %rsi,-0x60(%rbp)
mov %rdx,-0x68(%rbp)
mov %rcx,-0x70(%rbp)
mov %fs:0x28,%rax
mov %rax,-0x8(%rbp)
xor %eax,%eax
lea -0x40(%rbp),%rax
mov %rax,%rdi
callq 1229 <init_array>
cmpq $0x0,-0x68(%rbp)
jne 1464 <func0+0x69>
mov -0x70(%rbp),%rax
movq $0x0,(%rax)
mov -0x58(%rbp),%rcx
mov -0x40(%rbp),%rax
mov -0x38(%rbp),%rdx
mov %rax,(%rcx)
mov %rdx,0x8(%rcx)
mov -0x30(%rbp),%rax
mov %rax,0x10(%rcx)
jmpq 1594 <func0+0x199>
movq $0x10,-0x10(%rbp)
movq $0x0,-0x18(%rbp)
mov -0x10(%rbp),%rax
shl $0x3,%rax
mov %rax,%rdi
callq 1100 <malloc@plt>
mov %rax,-0x20(%rbp)
mov -0x20(%rbp),%rax
test %rax,%rax
jne 14a7 <func0+0xac>
lea 0xba8(%rip),%rdi
callq 1120 <perror@plt>
mov $0x1,%edi
callq 1130 <exit@plt>
mov -0x20(%rbp),%rcx
mov -0x18(%rbp),%rax
lea 0x1(%rax),%rdx
mov %rdx,-0x18(%rbp)
shl $0x3,%rax
add %rcx,%rax
movq $0x0,(%rax)
mov -0x20(%rbp),%rcx
mov -0x18(%rbp),%rax
lea 0x1(%rax),%rdx
mov %rdx,-0x18(%rbp)
shl $0x3,%rax
lea (%rcx,%rax,1),%rdx
mov -0x60(%rbp),%rax
mov %rax,(%rdx)
jmp 154d <func0+0x152>
mov -0x20(%rbp),%rax
mov -0x18(%rbp),%rdx
sub $0x1,%rdx
mov %rdx,-0x18(%rbp)
mov -0x18(%rbp),%rdx
shl $0x3,%rdx
add %rdx,%rax
mov (%rax),%rax
mov %rax,-0x48(%rbp)
cmpq $0x0,-0x48(%rbp)
jne 1511 <func0+0x116>
jmp 154d <func0+0x152>
movq $0x0,-0x50(%rbp)
jmp 1543 <func0+0x148>
mov -0x50(%rbp),%rax
lea 0x0(,%rax,4),%rdx
mov -0x48(%rbp),%rax
add %rdx,%rax
mov (%rax),%edx
lea -0x40(%rbp),%rax
mov %edx,%esi
mov %rax,%rdi
callq 1294 <append>
addq $0x1,-0x50(%rbp)
mov -0x50(%rbp),%rax
cmp -0x68(%rbp),%rax
jb 151b <func0+0x120>
mov -0x18(%rbp),%rax
test %rax,%rax
jne 14e6 <func0+0xeb>
lea -0x40(%rbp),%rax
mov %rax,%rdi
callq 1358 <reverse_array>
mov -0x38(%rbp),%rdx
mov -0x70(%rbp),%rax
mov %rdx,(%rax)
mov -0x20(%rbp),%rax
mov %rax,%rdi
callq 10c0 <free@plt>
mov -0x58(%rbp),%rcx
mov -0x40(%rbp),%rax
mov -0x38(%rbp),%rdx
mov %rax,(%rcx)
mov %rdx,0x8(%rcx)
mov -0x30(%rbp),%rax
mov %rax,0x10(%rcx)
mov -0x8(%rbp),%rax
xor %fs:0x28,%rax
je 15a8 <func0+0x1ad>
callq 10e0 <__stack_chk_fail@plt>
mov -0x58(%rbp),%rax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 70h
mov [rbp+var_58], rdi
mov [rbp+var_60], rsi
mov [rbp+var_68], rdx
mov [rbp+var_70], rcx
mov rax, fs:28h
mov [rbp+var_8], rax
xor eax, eax
lea rax, [rbp+var_40]
mov rdi, rax
call init_array
cmp [rbp+var_68], 0
jnz short loc_146A
mov rax, [rbp+var_70]
mov qword ptr [rax], 0
mov rcx, [rbp+var_58]
mov rax, [rbp+var_40]
mov rdx, [rbp+var_38]
mov [rcx], rax
mov [rcx+8], rdx
mov rax, [rbp+var_30]
mov [rcx+10h], rax
jmp loc_159E
loc_146A:
mov [rbp+var_10], 10h
mov [rbp+var_18], 0
mov rax, [rbp+var_10]
shl rax, 3
mov rdi, rax; size
call _malloc
mov [rbp+ptr], rax
mov rax, [rbp+ptr]
test rax, rax
jnz short loc_14B0
lea rax, aFailedToAlloca_0; "Failed to allocate memory for stack"
mov rdi, rax; s
call _perror
mov edi, 1; status
call _exit
loc_14B0:
mov rcx, [rbp+ptr]
mov rax, [rbp+var_18]
lea rdx, [rax+1]
mov [rbp+var_18], rdx
shl rax, 3
add rax, rcx
mov qword ptr [rax], 0
mov rcx, [rbp+ptr]
mov rax, [rbp+var_18]
lea rdx, [rax+1]
mov [rbp+var_18], rdx
shl rax, 3
lea rdx, [rcx+rax]
mov rax, [rbp+var_60]
mov [rdx], rax
jmp short loc_1557
loc_14EF:
mov rax, [rbp+ptr]
mov rdx, [rbp+var_18]
sub rdx, 1
mov [rbp+var_18], rdx
mov rdx, [rbp+var_18]
shl rdx, 3
add rax, rdx
mov rax, [rax]
mov [rbp+var_48], rax
cmp [rbp+var_48], 0
jz short loc_1556
mov [rbp+var_50], 0
jmp short loc_154A
loc_1522:
mov rax, [rbp+var_50]
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_48]
add rax, rdx
mov edx, [rax]
lea rax, [rbp+var_40]
mov esi, edx
mov rdi, rax
call append
add [rbp+var_50], 1
loc_154A:
mov rax, [rbp+var_50]
cmp rax, [rbp+var_68]
jb short loc_1522
jmp short loc_1557
loc_1556:
nop
loc_1557:
mov rax, [rbp+var_18]
test rax, rax
jnz short loc_14EF
lea rax, [rbp+var_40]
mov rdi, rax
call reverse_array
mov rdx, [rbp+var_38]
mov rax, [rbp+var_70]
mov [rax], rdx
mov rax, [rbp+ptr]
mov rdi, rax; ptr
call _free
mov rcx, [rbp+var_58]
mov rax, [rbp+var_40]
mov rdx, [rbp+var_38]
mov [rcx], rax
mov [rcx+8], rdx
mov rax, [rbp+var_30]
mov [rcx+10h], rax
loc_159E:
mov rax, [rbp+var_8]
sub rax, fs:28h
jz short loc_15B2
call ___stack_chk_fail
loc_15B2:
mov rax, [rbp+var_58]
leave
retn | _QWORD * func0(_QWORD *a1, long long a2, unsigned long long a3, _QWORD *a4)
{
long long v4; // rdx
long long v5; // rax
long long v6; // rax
long long v7; // rdx
unsigned long long i; // [rsp+20h] [rbp-50h]
long long v12; // [rsp+28h] [rbp-48h]
long long v13; // [rsp+30h] [rbp-40h] BYREF
long long v14; // [rsp+38h] [rbp-38h]
long long v15; // [rsp+40h] [rbp-30h]
void *ptr; // [rsp+50h] [rbp-20h]
long long v17; // [rsp+58h] [rbp-18h]
long long v18; // [rsp+60h] [rbp-10h]
unsigned long long v19; // [rsp+68h] [rbp-8h]
v19 = __readfsqword(0x28u);
init_array(&v13);
if ( a3 )
{
v18 = 16LL;
v17 = 0LL;
ptr = malloc(0x80uLL);
if ( !ptr )
{
perror("Failed to allocate memory for stack");
exit(1);
}
v5 = v17++;
*((_QWORD *)ptr + v5) = 0LL;
v6 = v17++;
*((_QWORD *)ptr + v6) = a2;
while ( v17 )
{
--v17;
v12 = *((_QWORD *)ptr + v17);
if ( v12 )
{
for ( i = 0LL; i < a3; ++i )
append(&v13, *(unsigned int *)(4 * i + v12));
}
}
reverse_array(&v13);
*a4 = v14;
free(ptr);
v7 = v14;
*a1 = v13;
a1[1] = v7;
a1[2] = v15;
}
else
{
*a4 = 0LL;
v4 = v14;
*a1 = v13;
a1[1] = v4;
a1[2] = v15;
}
return a1;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x70
MOV qword ptr [RBP + -0x58],RDI
MOV qword ptr [RBP + -0x60],RSI
MOV qword ptr [RBP + -0x68],RDX
MOV qword ptr [RBP + -0x70],RCX
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x8],RAX
XOR EAX,EAX
LEA RAX,[RBP + -0x40]
MOV RDI,RAX
CALL 0x00101229
CMP qword ptr [RBP + -0x68],0x0
JNZ 0x0010146a
MOV RAX,qword ptr [RBP + -0x70]
MOV qword ptr [RAX],0x0
MOV RCX,qword ptr [RBP + -0x58]
MOV RAX,qword ptr [RBP + -0x40]
MOV RDX,qword ptr [RBP + -0x38]
MOV qword ptr [RCX],RAX
MOV qword ptr [RCX + 0x8],RDX
MOV RAX,qword ptr [RBP + -0x30]
MOV qword ptr [RCX + 0x10],RAX
JMP 0x0010159e
LAB_0010146a:
MOV qword ptr [RBP + -0x10],0x10
MOV qword ptr [RBP + -0x18],0x0
MOV RAX,qword ptr [RBP + -0x10]
SHL RAX,0x3
MOV RDI,RAX
CALL 0x00101100
MOV qword ptr [RBP + -0x20],RAX
MOV RAX,qword ptr [RBP + -0x20]
TEST RAX,RAX
JNZ 0x001014b0
LEA RAX,[0x102040]
MOV RDI,RAX
CALL 0x00101120
MOV EDI,0x1
CALL 0x00101130
LAB_001014b0:
MOV RCX,qword ptr [RBP + -0x20]
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[RAX + 0x1]
MOV qword ptr [RBP + -0x18],RDX
SHL RAX,0x3
ADD RAX,RCX
MOV qword ptr [RAX],0x0
MOV RCX,qword ptr [RBP + -0x20]
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[RAX + 0x1]
MOV qword ptr [RBP + -0x18],RDX
SHL RAX,0x3
LEA RDX,[RCX + RAX*0x1]
MOV RAX,qword ptr [RBP + -0x60]
MOV qword ptr [RDX],RAX
JMP 0x00101557
LAB_001014ef:
MOV RAX,qword ptr [RBP + -0x20]
MOV RDX,qword ptr [RBP + -0x18]
SUB RDX,0x1
MOV qword ptr [RBP + -0x18],RDX
MOV RDX,qword ptr [RBP + -0x18]
SHL RDX,0x3
ADD RAX,RDX
MOV RAX,qword ptr [RAX]
MOV qword ptr [RBP + -0x48],RAX
CMP qword ptr [RBP + -0x48],0x0
JZ 0x00101556
MOV qword ptr [RBP + -0x50],0x0
JMP 0x0010154a
LAB_00101522:
MOV RAX,qword ptr [RBP + -0x50]
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x48]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
LEA RAX,[RBP + -0x40]
MOV ESI,EDX
MOV RDI,RAX
CALL 0x00101297
ADD qword ptr [RBP + -0x50],0x1
LAB_0010154a:
MOV RAX,qword ptr [RBP + -0x50]
CMP RAX,qword ptr [RBP + -0x68]
JC 0x00101522
JMP 0x00101557
LAB_00101556:
NOP
LAB_00101557:
MOV RAX,qword ptr [RBP + -0x18]
TEST RAX,RAX
JNZ 0x001014ef
LEA RAX,[RBP + -0x40]
MOV RDI,RAX
CALL 0x0010135e
MOV RDX,qword ptr [RBP + -0x38]
MOV RAX,qword ptr [RBP + -0x70]
MOV qword ptr [RAX],RDX
MOV RAX,qword ptr [RBP + -0x20]
MOV RDI,RAX
CALL 0x001010c0
MOV RCX,qword ptr [RBP + -0x58]
MOV RAX,qword ptr [RBP + -0x40]
MOV RDX,qword ptr [RBP + -0x38]
MOV qword ptr [RCX],RAX
MOV qword ptr [RCX + 0x8],RDX
MOV RAX,qword ptr [RBP + -0x30]
MOV qword ptr [RCX + 0x10],RAX
LAB_0010159e:
MOV RAX,qword ptr [RBP + -0x8]
SUB RAX,qword ptr FS:[0x28]
JZ 0x001015b2
CALL 0x001010e0
LAB_001015b2:
MOV RAX,qword ptr [RBP + -0x58]
LEAVE
RET | int8 * func0(int8 *param_1,int8 param_2,ulong param_3,int8 *param_4)
{
long lVar1;
long in_FS_OFFSET;
ulong local_58;
int8 local_48;
int8 local_40;
int8 local_38;
void *local_28;
long local_20;
int8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
init_array(&local_48);
if (param_3 == 0) {
*param_4 = 0;
*param_1 = local_48;
param_1[1] = local_40;
param_1[2] = local_38;
}
else {
local_18 = 0x10;
local_20 = 0;
local_28 = malloc(0x80);
if (local_28 == (void *)0x0) {
perror("Failed to allocate memory for stack");
/* WARNING: Subroutine does not return */
exit(1);
}
lVar1 = local_20 + 1;
*(int8 *)(local_20 * 8 + (long)local_28) = 0;
local_20 = local_20 + 2;
*(int8 *)((long)local_28 + lVar1 * 8) = param_2;
while (local_20 != 0) {
local_20 = local_20 + -1;
lVar1 = *(long *)((long)local_28 + local_20 * 8);
if (lVar1 != 0) {
for (local_58 = 0; local_58 < param_3; local_58 = local_58 + 1) {
append(&local_48,*(int4 *)(lVar1 + local_58 * 4));
}
}
}
reverse_array(&local_48);
*param_4 = local_40;
free(local_28);
*param_1 = local_48;
param_1[1] = local_40;
param_1[2] = local_38;
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return param_1;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
5,081 | func0 |
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
// Define a dynamic array structure
typedef struct {
int *data;
size_t size;
size_t capacity;
} DynamicArray;
// Initialize dynamic array
void init_array(DynamicArray *arr) {
arr->capacity = 16;
arr->size = 0;
arr->data = malloc(arr->capacity * sizeof(int));
if (!arr->data) {
perror("Failed to allocate memory");
exit(EXIT_FAILURE);
}
}
// Append to dynamic array
void append(DynamicArray *arr, int value) {
if (arr->size == arr->capacity) {
arr->capacity *= 2;
int *temp = realloc(arr->data, arr->capacity * sizeof(int));
if (!temp) {
perror("Failed to reallocate memory");
free(arr->data);
exit(EXIT_FAILURE);
}
arr->data = temp;
}
arr->data[arr->size++] = value;
}
// Reverse dynamic array
void reverse_array(DynamicArray *arr) {
for (size_t i = 0; i < arr->size / 2; ++i) {
int temp = arr->data[i];
arr->data[i] = arr->data[arr->size - 1 - i];
arr->data[arr->size - 1 - i] = temp;
}
}
// Flatten list function
| DynamicArray func0(int **list, size_t list_size, size_t *out_size) {
DynamicArray result;
init_array(&result);
if (list_size == 0) {
*out_size = 0;
return result;
}
// Implementing a simple stack using dynamic arrays
typedef struct {
int **data;
size_t size;
size_t capacity;
} Stack;
Stack stack;
stack.capacity = 16;
stack.size = 0;
stack.data = malloc(stack.capacity * sizeof(int *));
if (!stack.data) {
perror("Failed to allocate memory for stack");
exit(EXIT_FAILURE);
}
// Push the initial list to stack
stack.data[stack.size++] = NULL; // NULL indicates the main list
stack.data[stack.size++] = list;
while (stack.size > 0) {
int *current = stack.data[--stack.size];
if (current == NULL) continue;
// This simplistic implementation assumes all nested lists are NULL-terminated
for (size_t i = 0; i < list_size; ++i) {
append(&result, current[i]);
}
}
reverse_array(&result);
*out_size = result.size;
free(stack.data);
return result;
}
| int main() {
// First test case
int list1_part1[] = {0, 10};
int list1_part2[] = {20, 30};
int list1_part3[] = {40, 50};
int list1_part4[] = {60, 70, 80};
int list1_part5[] = {90, 100, 110, 120};
// For simplicity, we flatten manually
int flattened1[] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120};
// Second test case
int list2_part1[] = {10, 20};
int list2_part2[] = {40};
int list2_part3[] = {30, 56, 25};
int list2_part4[] = {10, 20};
int list2_part5[] = {33};
int list2_part6[] = {40};
int flattened2[] = {10, 20, 40, 30, 56, 25, 10, 20, 33, 40};
// Third test case
int list3_part1[] = {1,2,3};
int list3_part2[] = {4,5,6};
int list3_part3[] = {10,11,12};
int list3_part4[] = {7,8,9};
int flattened3[] = {1, 2, 3, 4, 5, 6, 10, 11, 12, 7, 8, 9};
// Since proper flattening is complex in C, we directly use the expected flattened arrays in asserts
// First assert
int expected1[] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120};
size_t size1 = 13;
DynamicArray result1 = func0(NULL, 0, &size1); // Dummy call
// Since we cannot implement full flattening, manually assign
result1.size = size1;
result1.data = expected1;
for(size_t i = 0; i < size1; ++i){
assert(result1.data[i] == expected1[i]);
}
// Second assert
int expected2[] = {10, 20, 40, 30, 56, 25, 10, 20, 33, 40};
size_t size2 = 10;
DynamicArray result2 = func0(NULL, 0, &size2); // Dummy call
result2.size = size2;
result2.data = expected2;
for(size_t i = 0; i < size2; ++i){
assert(result2.data[i] == expected2[i]);
}
// Third assert
int expected3[] = {1, 2, 3, 4, 5, 6, 10, 11, 12, 7, 8, 9};
size_t size3 = 12;
DynamicArray result3 = func0(NULL, 0, &size3); // Dummy call
result3.size = size3;
result3.data = expected3;
for(size_t i = 0; i < size3; ++i){
assert(result3.data[i] == expected3[i]);
}
printf("All assertions passed.\n");
return 0;
}
| O1 | c | func0:
endbr64
push %r15
push %r14
push %r13
push %r12
push %rbp
push %rbx
sub $0x28,%rsp
mov %rdi,%rbp
mov %rsi,%r12
mov %rdx,%r13
mov %rcx,%r14
mov %fs:0x28,%rax
mov %rax,0x18(%rsp)
xor %eax,%eax
mov %rsp,%rdi
callq 1209 <init_array>
test %r13,%r13
jne 1384 <func0+0x7a>
movq $0x0,(%r14)
movdqa (%rsp),%xmm0
movups %xmm0,0x0(%rbp)
mov 0x10(%rsp),%rax
mov %rax,0x10(%rbp)
mov 0x18(%rsp),%rax
xor %fs:0x28,%rax
jne 1408 <func0+0xfe>
mov %rbp,%rax
add $0x28,%rsp
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
mov $0x80,%edi
callq 10e0 <malloc@plt>
mov %rax,%r15
test %rax,%rax
je 13f2 <func0+0xe8>
movq $0x0,(%rax)
mov %r12,0x8(%rax)
test %r12,%r12
je 13c3 <func0+0xb9>
mov %r12,%rbx
lea (%r12,%r13,4),%r13
mov %rsp,%r12
mov (%rbx),%esi
mov %r12,%rdi
callq 124b <append>
add $0x4,%rbx
cmp %r13,%rbx
jne 13b0 <func0+0xa6>
mov %rsp,%rdi
callq 12b9 <reverse_array>
mov 0x8(%rsp),%rax
mov %rax,(%r14)
mov %r15,%rdi
callq 10b0 <free@plt>
movdqa (%rsp),%xmm1
movups %xmm1,0x0(%rbp)
mov 0x10(%rsp),%rax
mov %rax,0x10(%rbp)
jmpq 135e <func0+0x54>
lea 0xc5f(%rip),%rdi
callq 1100 <perror@plt>
mov $0x1,%edi
callq 1110 <exit@plt>
callq 10d0 <__stack_chk_fail@plt>
| func0:
endbr64
push r15
push r14
push r13
push r12
push rbp
push rbx
sub rsp, 38h
mov r13, rdi
mov r12, rsi
mov rbp, rdx
mov rbx, rcx
mov [rsp+68h+var_60], rcx
mov rax, fs:28h
mov [rsp+68h+var_40], rax
xor eax, eax
lea rdi, [rsp+68h+var_58]
call init_array
test rbp, rbp
jnz short loc_1387
mov qword ptr [rbx], 0
loc_134D:
movdqa xmm0, [rsp+68h+var_58]
movups xmmword ptr [r13+0], xmm0
mov rax, [rsp+68h+var_48]
mov [r13+10h], rax
mov rax, [rsp+68h+var_40]
sub rax, fs:28h
jnz loc_1402
mov rax, r13
add rsp, 38h
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_1387:
mov edi, 80h
call _malloc
mov r14, rax
test rax, rax
jz short loc_13EC
mov qword ptr [rax], 0
mov [rax+8], r12
test r12, r12
jz short loc_13C8
mov ebx, 0
lea r15, [rsp+68h+var_58]
loc_13B3:
mov esi, [r12+rbx*4]
mov rdi, r15
call append
add rbx, 1
cmp rbp, rbx
jnz short loc_13B3
loc_13C8:
lea rdi, [rsp+68h+var_58]
call reverse_array
mov rax, qword ptr [rsp+68h+var_58+8]
mov rdx, [rsp+68h+var_60]
mov [rdx], rax
mov rdi, r14
call _free
jmp loc_134D
loc_13EC:
lea rdi, aFailedToAlloca_0; "Failed to allocate memory for stack"
call _perror
mov edi, 1
call _exit
loc_1402:
call ___stack_chk_fail | __m128i * func0(__m128i *a1, long long a2, long long a3, _QWORD *a4)
{
_QWORD *v7; // rax
_QWORD *v8; // r14
long long v9; // rbx
__m128i v11; // [rsp+10h] [rbp-58h] BYREF
long long v12; // [rsp+20h] [rbp-48h]
unsigned long long v13; // [rsp+28h] [rbp-40h]
v13 = __readfsqword(0x28u);
init_array(&v11);
if ( a3 )
{
v7 = (_QWORD *)malloc(128LL);
v8 = v7;
if ( !v7 )
{
perror("Failed to allocate memory for stack");
exit(1LL);
}
*v7 = 0LL;
v7[1] = a2;
if ( a2 )
{
v9 = 0LL;
do
append(&v11, *(unsigned int *)(a2 + 4 * v9++));
while ( a3 != v9 );
}
reverse_array(&v11);
*a4 = v11.m128i_i64[1];
free(v8);
}
else
{
*a4 = 0LL;
}
*a1 = _mm_load_si128(&v11);
a1[1].m128i_i64[0] = v12;
return a1;
} | func0:
ENDBR64
PUSH R15
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0x38
MOV R13,RDI
MOV R12,RSI
MOV RBP,RDX
MOV RBX,RCX
MOV qword ptr [RSP + 0x8],RCX
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x28],RAX
XOR EAX,EAX
LEA RDI,[RSP + 0x10]
CALL 0x00101209
TEST RBP,RBP
JNZ 0x00101387
MOV qword ptr [RBX],0x0
LAB_0010134d:
MOVDQA XMM0,xmmword ptr [RSP + 0x10]
MOVUPS xmmword ptr [R13],XMM0
MOV RAX,qword ptr [RSP + 0x20]
MOV qword ptr [R13 + 0x10],RAX
MOV RAX,qword ptr [RSP + 0x28]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x00101402
MOV RAX,R13
ADD RSP,0x38
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_00101387:
MOV EDI,0x80
CALL 0x001010e0
MOV R14,RAX
TEST RAX,RAX
JZ 0x001013ec
MOV qword ptr [RAX],0x0
MOV qword ptr [RAX + 0x8],R12
TEST R12,R12
JZ 0x001013c8
MOV EBX,0x0
LEA R15,[RSP + 0x10]
LAB_001013b3:
MOV ESI,dword ptr [R12 + RBX*0x4]
MOV RDI,R15
CALL 0x0010124b
ADD RBX,0x1
CMP RBP,RBX
JNZ 0x001013b3
LAB_001013c8:
LEA RDI,[RSP + 0x10]
CALL 0x001012b9
MOV RAX,qword ptr [RSP + 0x18]
MOV RDX,qword ptr [RSP + 0x8]
MOV qword ptr [RDX],RAX
MOV RDI,R14
CALL 0x001010b0
JMP 0x0010134d
LAB_001013ec:
LEA RDI,[0x102058]
CALL 0x00101100
MOV EDI,0x1
CALL 0x00101110
LAB_00101402:
CALL 0x001010d0 | int8 * func0(int8 *param_1,long param_2,long param_3,int8 *param_4)
{
int8 *__ptr;
long lVar1;
long in_FS_OFFSET;
int8 local_58;
int8 uStack_50;
int8 local_48;
long local_40;
local_40 = *(long *)(in_FS_OFFSET + 0x28);
init_array(&local_58);
if (param_3 == 0) {
*param_4 = 0;
}
else {
__ptr = (int8 *)malloc(0x80);
if (__ptr == (int8 *)0x0) {
perror("Failed to allocate memory for stack");
/* WARNING: Subroutine does not return */
exit(1);
}
*__ptr = 0;
__ptr[1] = param_2;
if (param_2 != 0) {
lVar1 = 0;
do {
append(&local_58,*(int4 *)(param_2 + lVar1 * 4));
lVar1 = lVar1 + 1;
} while (param_3 != lVar1);
}
reverse_array(&local_58);
*param_4 = uStack_50;
free(__ptr);
}
*param_1 = local_58;
param_1[1] = uStack_50;
param_1[2] = local_48;
if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) {
return param_1;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.