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,482 | func0 | #include <assert.h>
#include <stdio.h>
| int func0(int tri[3][3], int m, int n) {
for (int i = m-1; i >= 0; i--) {
for (int j = 0; j <= i; j++) {
if (tri[i+1][j] > tri[i+1][j+1]) {
tri[i][j] += tri[i+1][j];
} else {
tri[i][j] += tri[i+1][j+1];
}
}
}
return tri[0][0];
}
| int main() {
int tri1[3][3] = {{1, 0, 0}, {4, 8, 0}, {1, 5, 3}};
int tri2[3][3] = {{13, 0, 0}, {7, 4, 0}, {2, 4, 6}};
int tri3[3][3] = {{2, 0, 0}, {11, 18, 0}, {21, 25, 33}};
assert(func0(tri1, 2, 2) == 14);
assert(func0(tri2, 2, 2) == 24);
assert(func0(tri3, 2, 2) == 53);
return 0;
}
| O2 | c | func0:
endbr64
sub $0x1,%esi
mov %esi,%r9d
js 135a <func0+0x5a>
movslq %esi,%rax
lea (%rax,%rax,2),%rax
lea (%rdi,%rax,4),%rcx
nopw 0x0(%rax,%rax,1)
lea 0xc(%rcx),%r10
xor %eax,%eax
mov (%r10,%rax,4),%r8d
mov 0x4(%r10,%rax,4),%esi
mov (%rcx,%rax,4),%edx
lea (%rsi,%rdx,1),%r11d
add %r8d,%edx
cmp %esi,%r8d
cmovle %r11d,%edx
mov %edx,(%rcx,%rax,4)
add $0x1,%rax
cmp %eax,%r9d
jge 1326 <func0+0x26>
sub $0x1,%r9d
sub $0xc,%rcx
cmp $0xffffffff,%r9d
jne 1320 <func0+0x20>
mov (%rdi),%eax
retq
nopl (%rax)
| func0:
endbr64
sub esi, 1
js short loc_134F
movsxd rax, esi
lea rax, [rax+rax*2]
lea rcx, [rdi+rax*4]
nop dword ptr [rax+00h]
loc_1318:
lea r10, [rcx+0Ch]
xor eax, eax
loc_131E:
mov r9d, [r10+rax*4]
mov r8d, [r10+rax*4+4]
mov edx, [rcx+rax*4]
lea r11d, [r9+rdx]
add edx, r8d
cmp r9d, r8d
cmovg edx, r11d
mov [rcx+rax*4], edx
add rax, 1
cmp esi, eax
jge short loc_131E
sub esi, 1
sub rcx, 0Ch
cmp esi, 0FFFFFFFFh
jnz short loc_1318
loc_134F:
mov eax, [rdi]
retn | long long func0(unsigned int *a1, int a2)
{
int v2; // esi
unsigned int *v3; // rcx
unsigned int *v4; // r10
long long v5; // rax
signed int v6; // r9d
signed int v7; // r8d
unsigned int v8; // edx
unsigned int v9; // r11d
unsigned int v10; // edx
v2 = a2 - 1;
if ( v2 >= 0 )
{
v3 = &a1[3 * v2];
do
{
v4 = v3 + 3;
v5 = 0LL;
do
{
v6 = v4[v5];
v7 = v4[v5 + 1];
v8 = v3[v5];
v9 = v6 + v8;
v10 = v7 + v8;
if ( v6 > v7 )
v10 = v9;
v3[v5++] = v10;
}
while ( v2 >= (int)v5 );
--v2;
v3 -= 3;
}
while ( v2 != -1 );
}
return *a1;
} | func0:
ENDBR64
SUB ESI,0x1
JS 0x0010134f
MOVSXD RAX,ESI
LEA RAX,[RAX + RAX*0x2]
LEA RCX,[RDI + RAX*0x4]
NOP dword ptr [RAX]
LAB_00101318:
LEA R10,[RCX + 0xc]
XOR EAX,EAX
LAB_0010131e:
MOV R9D,dword ptr [R10 + RAX*0x4]
MOV R8D,dword ptr [R10 + RAX*0x4 + 0x4]
MOV EDX,dword ptr [RCX + RAX*0x4]
LEA R11D,[R9 + RDX*0x1]
ADD EDX,R8D
CMP R9D,R8D
CMOVG EDX,R11D
MOV dword ptr [RCX + RAX*0x4],EDX
ADD RAX,0x1
CMP ESI,EAX
JGE 0x0010131e
SUB ESI,0x1
SUB RCX,0xc
CMP ESI,-0x1
JNZ 0x00101318
LAB_0010134f:
MOV EAX,dword ptr [RDI]
RET | int4 func0(int4 *param_1,int param_2)
{
int iVar1;
long lVar2;
int4 *puVar3;
param_2 = param_2 + -1;
if (-1 < param_2) {
puVar3 = param_1 + (long)param_2 * 3;
do {
lVar2 = 0;
do {
iVar1 = puVar3[lVar2 + 4];
if ((int)puVar3[lVar2 + 4] < (int)puVar3[lVar2 + 3]) {
iVar1 = puVar3[lVar2 + 3];
}
puVar3[lVar2] = puVar3[lVar2] + iVar1;
lVar2 = lVar2 + 1;
} while ((int)lVar2 <= param_2);
param_2 = param_2 + -1;
puVar3 = puVar3 + -3;
} while (param_2 != -1);
}
return *param_1;
} |
4,483 | func0 | #include <assert.h>
#include <stdio.h>
| int func0(int tri[3][3], int m, int n) {
for (int i = m-1; i >= 0; i--) {
for (int j = 0; j <= i; j++) {
if (tri[i+1][j] > tri[i+1][j+1]) {
tri[i][j] += tri[i+1][j];
} else {
tri[i][j] += tri[i+1][j+1];
}
}
}
return tri[0][0];
}
| int main() {
int tri1[3][3] = {{1, 0, 0}, {4, 8, 0}, {1, 5, 3}};
int tri2[3][3] = {{13, 0, 0}, {7, 4, 0}, {2, 4, 6}};
int tri3[3][3] = {{2, 0, 0}, {11, 18, 0}, {21, 25, 33}};
assert(func0(tri1, 2, 2) == 14);
assert(func0(tri2, 2, 2) == 24);
assert(func0(tri3, 2, 2) == 53);
return 0;
}
| O3 | c | func0:
endbr64
sub $0x1,%esi
js 1378 <func0+0xb8>
movslq %esi,%rax
lea (%rax,%rax,2),%rax
lea (%rdi,%rax,4),%rax
nopl 0x0(%rax,%rax,1)
mov (%rax),%edx
mov 0xc(%rax),%r8d
lea 0xc(%rax),%r10
mov 0x10(%rax),%ecx
lea (%rcx,%rdx,1),%r9d
add %r8d,%edx
cmp %r8d,%ecx
cmovge %r9d,%edx
mov %edx,(%rax)
test %esi,%esi
je 1368 <func0+0xa8>
mov 0x4(%rax),%edx
mov 0x14(%rax),%r8d
lea (%r8,%rdx,1),%r9d
add %ecx,%edx
cmp %ecx,%r8d
cmovge %r9d,%edx
mov %edx,0x4(%rax)
cmp $0x1,%esi
je 1368 <func0+0xa8>
mov 0x8(%rax),%edx
mov 0x18(%rax),%ecx
lea (%rcx,%rdx,1),%r9d
add %r8d,%edx
cmp %ecx,%r8d
cmovle %r9d,%edx
mov %edx,0x8(%rax)
cmp $0x2,%esi
je 1368 <func0+0xa8>
mov $0x3,%edx
mov (%r10,%rdx,4),%r9d
mov 0x4(%r10,%rdx,4),%r8d
mov (%rax,%rdx,4),%ecx
lea (%r9,%rcx,1),%r11d
add %r8d,%ecx
cmp %r8d,%r9d
cmovg %r11d,%ecx
mov %ecx,(%rax,%rdx,4)
add $0x1,%rdx
cmp %edx,%esi
jge 133e <func0+0x7e>
nopl 0x0(%rax,%rax,1)
sub $0x1,%esi
sub $0xc,%rax
cmp $0xffffffff,%esi
jne 12e0 <func0+0x20>
mov (%rdi),%eax
retq
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
mov eax, esi
mov rcx, rdi
sub eax, 1
js loc_1561
cdqe
push r12
lea rax, [rax+rax*2]
push rbp
lea rax, [rdi+rax*4]
mov edi, esi
push rbx
lea rdx, [rax+0Ch]
sub edi, 1
jz loc_1514
nop
loc_12F0:
mov r8d, esi
shr r8d, 1
lea r9d, [r8-2]
cmp r8d, 3
jbe loc_1550
movq xmm0, qword ptr [rax+0Ch]
movq xmm3, qword ptr [rax+10h]
lea r10, [rax+18h]
lea r11, [rax+24h]
movq xmm1, qword ptr [rax]
movq xmm2, qword ptr [rax+8]
mov ebx, 3
movdqa xmm4, xmm0
pcmpgtd xmm0, xmm3
paddd xmm4, xmm1
paddd xmm1, xmm3
pand xmm4, xmm0
pandn xmm0, xmm1
movq xmm1, qword ptr [rax+18h]
por xmm0, xmm4
movq qword ptr [rax], xmm0
movq xmm0, qword ptr [rax+14h]
movdqa xmm4, xmm0
pcmpgtd xmm0, xmm1
paddd xmm4, xmm2
paddd xmm2, xmm1
pand xmm4, xmm0
pandn xmm0, xmm2
movq xmm2, qword ptr [rax+20h]
por xmm0, xmm4
movq qword ptr [rax+8], xmm0
movq xmm0, qword ptr [rax+1Ch]
movdqa xmm4, xmm0
pcmpgtd xmm0, xmm2
paddd xmm4, xmm3
paddd xmm3, xmm2
pand xmm4, xmm0
pandn xmm0, xmm3
por xmm0, xmm4
movq qword ptr [rax+10h], xmm0
cmp r9d, 4
jbe loc_1540
loc_13A4:
movq xmm0, qword ptr [r11]
movq xmm3, qword ptr [r10+10h]
mov ebp, ebx
mov r12, r10
add ebp, 4
add r11, 18h
add r10, 18h
add ebx, 3
movdqa xmm4, xmm0
pcmpgtd xmm0, xmm3
paddd xmm4, xmm1
paddd xmm1, xmm3
pand xmm4, xmm0
pandn xmm0, xmm1
movq xmm1, qword ptr [r10]
por xmm0, xmm4
movq qword ptr [r10-18h], xmm0
movq xmm0, qword ptr [r11-10h]
movdqa xmm4, xmm0
pcmpgtd xmm0, xmm1
paddd xmm4, xmm2
paddd xmm2, xmm1
pand xmm4, xmm0
pandn xmm0, xmm2
movq xmm2, qword ptr [r10+8]
por xmm0, xmm4
movq qword ptr [r10-10h], xmm0
movq xmm0, qword ptr [r11-8]
movdqa xmm4, xmm0
pcmpgtd xmm0, xmm2
paddd xmm4, xmm3
paddd xmm3, xmm2
pand xmm4, xmm0
pandn xmm0, xmm3
por xmm0, xmm4
movq qword ptr [r10-8], xmm0
cmp ebp, r9d
jb loc_13A4
lea r9, [r12+28h]
loc_144D:
movq xmm0, qword ptr [r11]
movq xmm3, qword ptr [r9]
add ebx, 1
movq xmm1, qword ptr [r10]
movdqa xmm2, xmm0
pcmpgtd xmm0, xmm3
paddd xmm2, xmm1
paddd xmm1, xmm3
pand xmm2, xmm0
pandn xmm0, xmm1
por xmm0, xmm2
movq qword ptr [r10], xmm0
cmp ebx, r8d
jnb short loc_14CC
xor ebp, ebp
loc_1487:
movq xmm0, qword ptr [r11+rbp*8+8]
movq xmm3, qword ptr [r9+rbp*8+8]
movq xmm1, qword ptr [r10+rbp*8+8]
movdqa xmm2, xmm0
pcmpgtd xmm0, xmm3
paddd xmm2, xmm1
paddd xmm1, xmm3
pand xmm2, xmm0
pandn xmm0, xmm1
por xmm0, xmm2
movq qword ptr [r10+rbp*8+8], xmm0
add rbp, 1
lea r12d, [rbx+rbp]
cmp r12d, r8d
jb short loc_1487
loc_14CC:
test sil, 1
jz short loc_1530
and esi, 0FFFFFFFEh
loc_14D5:
movsxd rsi, esi
shl rsi, 2
add rdx, rsi
add rsi, rax
mov r9d, [rdx]
mov r8d, [rdx+4]
mov edx, [rsi]
lea r10d, [r8+rdx]
add edx, r9d
cmp r9d, r8d
cmovle edx, r10d
sub rax, 0Ch
mov [rsi], edx
test edi, edi
jz short loc_1520
mov esi, edi
loc_1505:
mov edi, esi
lea rdx, [rax+0Ch]
sub edi, 1
jnz loc_12F0
loc_1514:
xor esi, esi
jmp short loc_14D5
loc_1520:
pop rbx
mov eax, [rcx]
pop rbp
pop r12
retn
loc_1530:
sub rax, 0Ch
mov esi, edi
jmp short loc_1505
loc_1540:
lea r9, [rax+28h]
mov ebx, 3
jmp loc_144D
loc_1550:
lea r9, [rax+10h]
mov r10, rax
mov r11, rdx
xor ebx, ebx
jmp loc_144D
loc_1561:
mov eax, [rdi]
retn | long long func0(unsigned int *a1, unsigned int i)
{
unsigned int *v3; // rax
const __m128i *v4; // rdx
unsigned int v5; // edi
unsigned int v6; // r8d
unsigned int v7; // r9d
__m128i v8; // xmm3
unsigned int *v9; // r10
const __m128i *v10; // r11
__m128i v11; // xmm1
__m128i v12; // xmm2
int v13; // ebx
__m128i v14; // xmm4
__m128i v15; // xmm0
__m128i v16; // xmm4
__m128i v17; // xmm0
__m128i v18; // xmm1
__m128i v19; // xmm4
__m128i v20; // xmm0
__m128i v21; // xmm4
__m128i v22; // xmm0
__m128i v23; // xmm2
__m128i v24; // xmm4
__m128i v25; // xmm0
__m128i v26; // xmm0
__m128i v27; // xmm3
unsigned int *v28; // r12
unsigned int v29; // ebp
__m128i v30; // xmm4
__m128i v31; // xmm0
__m128i v32; // xmm4
__m128i v33; // xmm0
__m128i v34; // xmm4
__m128i v35; // xmm0
__m128i v36; // xmm4
__m128i v37; // xmm0
__m128i v38; // xmm4
__m128i v39; // xmm0
const __m128i *v40; // r9
__m128i v41; // xmm3
unsigned int v42; // ebx
__m128i v43; // xmm1
__m128i v44; // xmm2
__m128i v45; // xmm0
long long v46; // rbp
__m128i v47; // xmm3
__m128i v48; // xmm1
__m128i v49; // xmm2
__m128i v50; // xmm0
signed int v51; // esi
long long v52; // rsi
__int32 *v53; // rdx
int *v54; // rsi
__int32 v55; // r9d
__int32 v56; // r8d
int v57; // edx
if ( (int)(i - 1) < 0 )
return *a1;
v3 = &a1[3 * (i - 1)];
v4 = (const __m128i *)(v3 + 3);
v5 = i - 1;
if ( i != 1 )
goto LABEL_3;
while ( 1 )
{
v51 = 0;
LABEL_12:
v52 = v51;
v53 = &v4->m128i_i32[v52];
v54 = (int *)&v3[v52];
v55 = *v53;
v56 = v53[1];
v57 = *v53 + *v54;
if ( v55 <= v56 )
v57 = v56 + *v54;
v3 -= 3;
*v54 = v57;
if ( !v5 )
return *a1;
for ( i = v5; ; i = v5 )
{
v4 = (const __m128i *)(v3 + 3);
v5 = i - 1;
if ( i == 1 )
break;
LABEL_3:
v6 = i >> 1;
v7 = (i >> 1) - 2;
if ( i >> 1 <= 3 )
{
v40 = (const __m128i *)(v3 + 4);
v9 = v3;
v10 = v4;
v13 = 0;
}
else
{
v8 = _mm_loadl_epi64((const __m128i *)v3 + 1);
v9 = v3 + 6;
v10 = (const __m128i *)(v3 + 9);
v11 = _mm_loadl_epi64((const __m128i *)v3);
v12 = _mm_loadl_epi64((const __m128i *)(v3 + 2));
v13 = 3;
v14 = _mm_loadl_epi64((const __m128i *)(v3 + 3));
v15 = _mm_cmpgt_epi32(v14, v8);
v16 = _mm_and_si128(_mm_add_epi32(v14, v11), v15);
v17 = _mm_andnot_si128(v15, _mm_add_epi32(v11, v8));
v18 = _mm_loadl_epi64((const __m128i *)(v3 + 6));
*(_QWORD *)v3 = _mm_or_si128(v17, v16).m128i_u64[0];
v19 = _mm_loadl_epi64((const __m128i *)(v3 + 5));
v20 = _mm_cmpgt_epi32(v19, v18);
v21 = _mm_and_si128(_mm_add_epi32(v19, v12), v20);
v22 = _mm_andnot_si128(v20, _mm_add_epi32(v12, v18));
v23 = _mm_loadl_epi64((const __m128i *)v3 + 2);
*((_QWORD *)v3 + 1) = _mm_or_si128(v22, v21).m128i_u64[0];
v24 = _mm_loadl_epi64((const __m128i *)(v3 + 7));
v25 = _mm_cmpgt_epi32(v24, v23);
*((_QWORD *)v3 + 2) = _mm_or_si128(
_mm_andnot_si128(v25, _mm_add_epi32(v8, v23)),
_mm_and_si128(_mm_add_epi32(v24, v8), v25)).m128i_u64[0];
if ( v7 <= 4 )
{
v40 = (const __m128i *)(v3 + 10);
v13 = 3;
}
else
{
do
{
v26 = _mm_loadl_epi64(v10);
v27 = _mm_loadl_epi64((const __m128i *)v9 + 1);
v28 = v9;
v29 = v13 + 4;
v10 = (const __m128i *)((char *)v10 + 24);
v9 += 6;
v13 += 3;
v30 = v26;
v31 = _mm_cmpgt_epi32(v26, v27);
v32 = _mm_and_si128(_mm_add_epi32(v30, v18), v31);
v33 = _mm_andnot_si128(v31, _mm_add_epi32(v18, v27));
v18 = _mm_loadl_epi64((const __m128i *)v9);
*((_QWORD *)v9 - 3) = _mm_or_si128(v33, v32).m128i_u64[0];
v34 = _mm_loadl_epi64(v10 - 1);
v35 = _mm_cmpgt_epi32(v34, v18);
v36 = _mm_and_si128(_mm_add_epi32(v34, v23), v35);
v37 = _mm_andnot_si128(v35, _mm_add_epi32(v23, v18));
v23 = _mm_loadl_epi64((const __m128i *)(v9 + 2));
*((_QWORD *)v9 - 2) = _mm_or_si128(v37, v36).m128i_u64[0];
v38 = _mm_loadl_epi64((const __m128i *)((char *)v10 - 8));
v39 = _mm_cmpgt_epi32(v38, v23);
*((_QWORD *)v9 - 1) = _mm_or_si128(
_mm_andnot_si128(v39, _mm_add_epi32(v27, v23)),
_mm_and_si128(_mm_add_epi32(v38, v27), v39)).m128i_u64[0];
}
while ( v29 < v7 );
v40 = (const __m128i *)(v28 + 10);
}
}
v41 = _mm_loadl_epi64(v40);
v42 = v13 + 1;
v43 = _mm_loadl_epi64((const __m128i *)v9);
v44 = _mm_loadl_epi64(v10);
v45 = _mm_cmpgt_epi32(v44, v41);
*(_QWORD *)v9 = _mm_or_si128(
_mm_andnot_si128(v45, _mm_add_epi32(v43, v41)),
_mm_and_si128(_mm_add_epi32(v44, v43), v45)).m128i_u64[0];
if ( v42 < v6 )
{
v46 = 0LL;
do
{
v47 = _mm_loadl_epi64((const __m128i *)&v40->m128i_u64[v46 + 1]);
v48 = _mm_loadl_epi64((const __m128i *)&v9[2 * v46 + 2]);
v49 = _mm_loadl_epi64((const __m128i *)&v10->m128i_u64[v46 + 1]);
v50 = _mm_cmpgt_epi32(v49, v47);
*(_QWORD *)&v9[2 * v46++ + 2] = _mm_or_si128(
_mm_andnot_si128(v50, _mm_add_epi32(v48, v47)),
_mm_and_si128(_mm_add_epi32(v49, v48), v50)).m128i_u64[0];
}
while ( v42 + (unsigned int)v46 < v6 );
}
if ( (i & 1) != 0 )
{
v51 = i & 0xFFFFFFFE;
goto LABEL_12;
}
v3 -= 3;
}
}
} | func0:
ENDBR64
MOV EAX,ESI
MOV RCX,RDI
SUB EAX,0x1
JS 0x00101561
CDQE
PUSH R12
LEA RAX,[RAX + RAX*0x2]
PUSH RBP
LEA RAX,[RDI + RAX*0x4]
MOV EDI,ESI
PUSH RBX
LEA RDX,[RAX + 0xc]
SUB EDI,0x1
JZ 0x00101514
NOP
LAB_001012f0:
MOV R8D,ESI
SHR R8D,0x1
LEA R9D,[R8 + -0x2]
CMP R8D,0x3
JBE 0x00101550
MOVQ XMM0,qword ptr [RAX + 0xc]
MOVQ XMM3,qword ptr [RAX + 0x10]
LEA R10,[RAX + 0x18]
LEA R11,[RAX + 0x24]
MOVQ XMM1,qword ptr [RAX]
MOVQ XMM2,qword ptr [RAX + 0x8]
MOV EBX,0x3
MOVDQA XMM4,XMM0
PCMPGTD XMM0,XMM3
PADDD XMM4,XMM1
PADDD XMM1,XMM3
PAND XMM4,XMM0
PANDN XMM0,XMM1
MOVQ XMM1,qword ptr [RAX + 0x18]
POR XMM0,XMM4
MOVQ qword ptr [RAX],XMM0
MOVQ XMM0,qword ptr [RAX + 0x14]
MOVDQA XMM4,XMM0
PCMPGTD XMM0,XMM1
PADDD XMM4,XMM2
PADDD XMM2,XMM1
PAND XMM4,XMM0
PANDN XMM0,XMM2
MOVQ XMM2,qword ptr [RAX + 0x20]
POR XMM0,XMM4
MOVQ qword ptr [RAX + 0x8],XMM0
MOVQ XMM0,qword ptr [RAX + 0x1c]
MOVDQA XMM4,XMM0
PCMPGTD XMM0,XMM2
PADDD XMM4,XMM3
PADDD XMM3,XMM2
PAND XMM4,XMM0
PANDN XMM0,XMM3
POR XMM0,XMM4
MOVQ qword ptr [RAX + 0x10],XMM0
CMP R9D,0x4
JBE 0x00101540
LAB_001013a4:
MOVQ XMM0,qword ptr [R11]
MOVQ XMM3,qword ptr [R10 + 0x10]
MOV EBP,EBX
MOV R12,R10
ADD EBP,0x4
ADD R11,0x18
ADD R10,0x18
ADD EBX,0x3
MOVDQA XMM4,XMM0
PCMPGTD XMM0,XMM3
PADDD XMM4,XMM1
PADDD XMM1,XMM3
PAND XMM4,XMM0
PANDN XMM0,XMM1
MOVQ XMM1,qword ptr [R10]
POR XMM0,XMM4
MOVQ qword ptr [R10 + -0x18],XMM0
MOVQ XMM0,qword ptr [R11 + -0x10]
MOVDQA XMM4,XMM0
PCMPGTD XMM0,XMM1
PADDD XMM4,XMM2
PADDD XMM2,XMM1
PAND XMM4,XMM0
PANDN XMM0,XMM2
MOVQ XMM2,qword ptr [R10 + 0x8]
POR XMM0,XMM4
MOVQ qword ptr [R10 + -0x10],XMM0
MOVQ XMM0,qword ptr [R11 + -0x8]
MOVDQA XMM4,XMM0
PCMPGTD XMM0,XMM2
PADDD XMM4,XMM3
PADDD XMM3,XMM2
PAND XMM4,XMM0
PANDN XMM0,XMM3
POR XMM0,XMM4
MOVQ qword ptr [R10 + -0x8],XMM0
CMP EBP,R9D
JC 0x001013a4
LEA R9,[R12 + 0x28]
LAB_0010144d:
MOVQ XMM0,qword ptr [R11]
MOVQ XMM3,qword ptr [R9]
ADD EBX,0x1
MOVQ XMM1,qword ptr [R10]
MOVDQA XMM2,XMM0
PCMPGTD XMM0,XMM3
PADDD XMM2,XMM1
PADDD XMM1,XMM3
PAND XMM2,XMM0
PANDN XMM0,XMM1
POR XMM0,XMM2
MOVQ qword ptr [R10],XMM0
CMP EBX,R8D
JNC 0x001014cc
XOR EBP,EBP
LAB_00101487:
MOVQ XMM0,qword ptr [R11 + RBP*0x8 + 0x8]
MOVQ XMM3,qword ptr [R9 + RBP*0x8 + 0x8]
MOVQ XMM1,qword ptr [R10 + RBP*0x8 + 0x8]
MOVDQA XMM2,XMM0
PCMPGTD XMM0,XMM3
PADDD XMM2,XMM1
PADDD XMM1,XMM3
PAND XMM2,XMM0
PANDN XMM0,XMM1
POR XMM0,XMM2
MOVQ qword ptr [R10 + RBP*0x8 + 0x8],XMM0
ADD RBP,0x1
LEA R12D,[RBX + RBP*0x1]
CMP R12D,R8D
JC 0x00101487
LAB_001014cc:
TEST SIL,0x1
JZ 0x00101530
AND ESI,0xfffffffe
LAB_001014d5:
MOVSXD RSI,ESI
SHL RSI,0x2
ADD RDX,RSI
ADD RSI,RAX
MOV R9D,dword ptr [RDX]
MOV R8D,dword ptr [RDX + 0x4]
MOV EDX,dword ptr [RSI]
LEA R10D,[R8 + RDX*0x1]
ADD EDX,R9D
CMP R9D,R8D
CMOVLE EDX,R10D
SUB RAX,0xc
MOV dword ptr [RSI],EDX
TEST EDI,EDI
JZ 0x00101520
MOV ESI,EDI
LAB_00101505:
MOV EDI,ESI
LEA RDX,[RAX + 0xc]
SUB EDI,0x1
JNZ 0x001012f0
LAB_00101514:
XOR ESI,ESI
JMP 0x001014d5
LAB_00101520:
POP RBX
MOV EAX,dword ptr [RCX]
POP RBP
POP R12
RET
LAB_00101530:
SUB RAX,0xc
MOV ESI,EDI
JMP 0x00101505
LAB_00101540:
LEA R9,[RAX + 0x28]
MOV EBX,0x3
JMP 0x0010144d
LAB_00101550:
LEA R9,[RAX + 0x10]
MOV R10,RAX
MOV R11,RDX
XOR EBX,EBX
JMP 0x0010144d
LAB_00101561:
MOV EAX,dword ptr [RDI]
RET | int4 func0(int4 *param_1,uint param_2)
{
int iVar1;
ulong *puVar2;
ulong *puVar3;
int *piVar4;
int iVar5;
uint uVar6;
long lVar7;
int *piVar8;
uint uVar9;
uint uVar10;
ulong *puVar11;
ulong *puVar12;
ulong *puVar13;
ulong *puVar14;
int iVar15;
ulong uVar17;
ulong uVar18;
int iVar19;
int iVar20;
int iVar21;
int iVar22;
int iVar23;
ulong uVar16;
if ((int)(param_2 - 1) < 0) {
return *param_1;
}
puVar2 = (ulong *)(param_1 + (long)(int)(param_2 - 1) * 3);
puVar3 = (ulong *)((long)puVar2 + 0xc);
uVar9 = param_2 - 1;
if (uVar9 == 0) goto LAB_00101514;
do {
uVar10 = param_2 >> 1;
if (uVar10 < 4) {
puVar11 = puVar2 + 2;
iVar5 = 0;
puVar12 = puVar2;
puVar14 = puVar3;
}
else {
iVar5 = 3;
iVar15 = (int)*(int8 *)((long)puVar2 + 0xc);
iVar22 = (int)puVar2[2];
iVar1 = (int)((ulong)*(int8 *)((long)puVar2 + 0xc) >> 0x20);
iVar23 = (int)(puVar2[2] >> 0x20);
uVar16 = CONCAT44(-(uint)(iVar23 < iVar1),-(uint)(iVar22 < iVar15));
iVar19 = (int)*puVar2;
iVar20 = (int)(*puVar2 >> 0x20);
uVar18 = puVar2[3];
*puVar2 = ~uVar16 & CONCAT44(iVar20 + iVar23,iVar19 + iVar22) |
CONCAT44(iVar1 + iVar20,iVar15 + iVar19) & uVar16;
iVar15 = (int)*(int8 *)((long)puVar2 + 0x14);
iVar1 = (int)((ulong)*(int8 *)((long)puVar2 + 0x14) >> 0x20);
iVar19 = (int)(uVar18 >> 0x20);
uVar17 = CONCAT44(-(uint)(iVar19 < iVar1),-(uint)((int)uVar18 < iVar15));
iVar20 = (int)puVar2[1];
iVar21 = (int)(puVar2[1] >> 0x20);
uVar16 = puVar2[4];
puVar2[1] = ~uVar17 & CONCAT44(iVar21 + iVar19,iVar20 + (int)uVar18) |
CONCAT44(iVar1 + iVar21,iVar15 + iVar20) & uVar17;
iVar15 = (int)*(int8 *)((long)puVar2 + 0x1c);
iVar1 = (int)((ulong)*(int8 *)((long)puVar2 + 0x1c) >> 0x20);
iVar19 = (int)(uVar16 >> 0x20);
uVar17 = CONCAT44(-(uint)(iVar19 < iVar1),-(uint)((int)uVar16 < iVar15));
puVar2[2] = ~uVar17 & CONCAT44(iVar23 + iVar19,iVar22 + (int)uVar16) |
CONCAT44(iVar1 + iVar23,iVar15 + iVar22) & uVar17;
puVar12 = puVar2 + 3;
puVar13 = (ulong *)((long)puVar2 + 0x24);
if (uVar10 - 2 < 5) {
puVar11 = puVar2 + 5;
iVar5 = 3;
puVar14 = (ulong *)((long)puVar2 + 0x24);
}
else {
do {
puVar11 = puVar12;
uVar6 = iVar5 + 4;
puVar14 = puVar13 + 3;
puVar12 = puVar11 + 3;
iVar5 = iVar5 + 3;
iVar15 = (int)*puVar13;
iVar22 = (int)puVar11[2];
iVar1 = (int)(*puVar13 >> 0x20);
iVar23 = (int)(puVar11[2] >> 0x20);
uVar17 = CONCAT44(-(uint)(iVar23 < iVar1),-(uint)(iVar22 < iVar15));
iVar19 = (int)uVar18;
iVar20 = (int)(uVar18 >> 0x20);
uVar18 = *puVar12;
*puVar11 = ~uVar17 & CONCAT44(iVar20 + iVar23,iVar19 + iVar22) |
CONCAT44(iVar1 + iVar20,iVar15 + iVar19) & uVar17;
iVar15 = (int)puVar13[1];
iVar1 = (int)(puVar13[1] >> 0x20);
iVar19 = (int)(uVar18 >> 0x20);
uVar17 = CONCAT44(-(uint)(iVar19 < iVar1),-(uint)((int)uVar18 < iVar15));
iVar20 = (int)uVar16;
iVar21 = (int)(uVar16 >> 0x20);
uVar16 = puVar11[4];
puVar11[1] = ~uVar17 & CONCAT44(iVar21 + iVar19,iVar20 + (int)uVar18) |
CONCAT44(iVar1 + iVar21,iVar15 + iVar20) & uVar17;
iVar15 = (int)puVar13[2];
iVar1 = (int)(puVar13[2] >> 0x20);
iVar19 = (int)(uVar16 >> 0x20);
uVar17 = CONCAT44(-(uint)(iVar19 < iVar1),-(uint)((int)uVar16 < iVar15));
puVar11[2] = ~uVar17 & CONCAT44(iVar23 + iVar19,iVar22 + (int)uVar16) |
CONCAT44(iVar1 + iVar23,iVar15 + iVar22) & uVar17;
puVar13 = puVar14;
} while (uVar6 < uVar10 - 2);
puVar11 = puVar11 + 5;
}
}
iVar15 = (int)*puVar14;
iVar21 = (int)*puVar11;
iVar1 = (int)(*puVar14 >> 0x20);
iVar22 = (int)(*puVar11 >> 0x20);
uVar18 = CONCAT44(-(uint)(iVar22 < iVar1),-(uint)(iVar21 < iVar15));
iVar19 = (int)*puVar12;
iVar20 = (int)(*puVar12 >> 0x20);
*puVar12 = ~uVar18 & CONCAT44(iVar20 + iVar22,iVar19 + iVar21) |
CONCAT44(iVar1 + iVar20,iVar15 + iVar19) & uVar18;
if (iVar5 + 1U < uVar10) {
lVar7 = 0;
do {
iVar15 = (int)puVar14[lVar7 + 1];
iVar21 = (int)puVar11[lVar7 + 1];
iVar1 = (int)(puVar14[lVar7 + 1] >> 0x20);
iVar22 = (int)(puVar11[lVar7 + 1] >> 0x20);
uVar18 = CONCAT44(-(uint)(iVar22 < iVar1),-(uint)(iVar21 < iVar15));
iVar19 = (int)puVar12[lVar7 + 1];
iVar20 = (int)(puVar12[lVar7 + 1] >> 0x20);
puVar12[lVar7 + 1] =
~uVar18 & CONCAT44(iVar20 + iVar22,iVar19 + iVar21) |
CONCAT44(iVar1 + iVar20,iVar15 + iVar19) & uVar18;
lVar7 = lVar7 + 1;
} while (iVar5 + 1U + (int)lVar7 < uVar10);
}
if ((param_2 & 1) == 0) goto LAB_00101505;
param_2 = param_2 & 0xfffffffe;
while( true ) {
piVar4 = (int *)((long)puVar3 + (long)(int)param_2 * 4);
piVar8 = (int *)((long)(int)param_2 * 4 + (long)puVar2);
iVar1 = *piVar4;
iVar5 = piVar4[1];
if (iVar1 <= iVar5) {
iVar1 = iVar5;
}
*piVar8 = *piVar8 + iVar1;
if (uVar9 == 0) {
return *param_1;
}
LAB_00101505:
puVar3 = puVar2;
param_2 = uVar9;
puVar2 = (ulong *)((long)puVar3 + -0xc);
uVar9 = param_2 - 1;
if (uVar9 != 0) break;
LAB_00101514:
param_2 = 0;
}
} while( true );
} |
4,484 | func0 |
#include <assert.h>
int sum_digits_single(int x) {
int ans = 0;
while (x) {
ans += x % 10;
x /= 10;
}
return ans;
}
int closest(int x) {
int ans = 0;
while (ans * 10 + 9 <= x) {
ans = ans * 10 + 9;
}
return ans;
}
| int func0(int N) {
int A = closest(N);
return sum_digits_single(A) + sum_digits_single(N - A);
}
| int main() {
assert(func0(35) == 17);
assert(func0(7) == 7);
assert(func0(100) == 19);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
sub $0x18,%rsp
mov %edi,-0x1c(%rbp)
mov -0x1c(%rbp),%eax
mov %eax,%edi
callq 11b3 <closest>
mov %eax,-0xc(%rbp)
mov -0xc(%rbp),%eax
mov %eax,%edi
callq 1149 <sum_digits_single>
mov %eax,%ebx
mov -0x1c(%rbp),%eax
sub -0xc(%rbp),%eax
mov %eax,%edi
callq 1149 <sum_digits_single>
add %ebx,%eax
add $0x18,%rsp
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
push rbx
sub rsp, 18h
mov [rbp+var_1C], edi
mov eax, [rbp+var_1C]
mov edi, eax
call closest
mov [rbp+var_C], eax
mov eax, [rbp+var_C]
mov edi, eax
call sum_digits_single
mov ebx, eax
mov eax, [rbp+var_1C]
sub eax, [rbp+var_C]
mov edi, eax
call sum_digits_single
add eax, ebx
mov rbx, [rbp+var_8]
leave
retn | long long func0(unsigned int a1)
{
int v1; // ebx
unsigned int v3; // [rsp+14h] [rbp-Ch]
v3 = closest(a1);
v1 = sum_digits_single(v3);
return v1 + (unsigned int)sum_digits_single(a1 - v3);
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
PUSH RBX
SUB RSP,0x18
MOV dword ptr [RBP + -0x1c],EDI
MOV EAX,dword ptr [RBP + -0x1c]
MOV EDI,EAX
CALL 0x001011b3
MOV dword ptr [RBP + -0xc],EAX
MOV EAX,dword ptr [RBP + -0xc]
MOV EDI,EAX
CALL 0x00101149
MOV EBX,EAX
MOV EAX,dword ptr [RBP + -0x1c]
SUB EAX,dword ptr [RBP + -0xc]
MOV EDI,EAX
CALL 0x00101149
ADD EAX,EBX
MOV RBX,qword ptr [RBP + -0x8]
LEAVE
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
iVar1 = closest(param_1);
iVar2 = sum_digits_single(iVar1);
iVar1 = sum_digits_single(param_1 - iVar1);
return iVar1 + iVar2;
} |
4,485 | func0 |
#include <assert.h>
int sum_digits_single(int x) {
int ans = 0;
while (x) {
ans += x % 10;
x /= 10;
}
return ans;
}
int closest(int x) {
int ans = 0;
while (ans * 10 + 9 <= x) {
ans = ans * 10 + 9;
}
return ans;
}
| int func0(int N) {
int A = closest(N);
return sum_digits_single(A) + sum_digits_single(N - A);
}
| int main() {
assert(func0(35) == 17);
assert(func0(7) == 7);
assert(func0(100) == 19);
return 0;
}
| O1 | c | func0:
endbr64
push %r12
push %rbp
push %rbx
mov %edi,%ebx
callq 1181 <closest>
mov %eax,%r12d
mov %eax,%edi
callq 1149 <sum_digits_single>
mov %eax,%ebp
sub %r12d,%ebx
mov %ebx,%edi
callq 1149 <sum_digits_single>
add %ebp,%eax
pop %rbx
pop %rbp
pop %r12
retq
| func0:
endbr64
push r12
push rbp
push rbx
mov ebx, edi
call closest
mov r12d, eax
mov edi, eax
call sum_digits_single
mov ebp, eax
sub ebx, r12d
mov edi, ebx
call sum_digits_single
add eax, ebp
pop rbx
pop rbp
pop r12
retn | long long func0(int a1)
{
long long v1; // r12
int v2; // ebp
v1 = (unsigned int)closest();
v2 = sum_digits_single(v1);
return v2 + (unsigned int)sum_digits_single((unsigned int)(a1 - v1));
} | func0:
ENDBR64
PUSH R12
PUSH RBP
PUSH RBX
MOV EBX,EDI
CALL 0x00101181
MOV R12D,EAX
MOV EDI,EAX
CALL 0x00101149
MOV EBP,EAX
SUB EBX,R12D
MOV EDI,EBX
CALL 0x00101149
ADD EAX,EBP
POP RBX
POP RBP
POP R12
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
iVar1 = closest();
iVar2 = sum_digits_single(iVar1);
iVar1 = sum_digits_single(param_1 - iVar1);
return iVar1 + iVar2;
} |
4,486 | func0 |
#include <assert.h>
int sum_digits_single(int x) {
int ans = 0;
while (x) {
ans += x % 10;
x /= 10;
}
return ans;
}
int closest(int x) {
int ans = 0;
while (ans * 10 + 9 <= x) {
ans = ans * 10 + 9;
}
return ans;
}
| int func0(int N) {
int A = closest(N);
return sum_digits_single(A) + sum_digits_single(N - A);
}
| int main() {
assert(func0(35) == 17);
assert(func0(7) == 7);
assert(func0(100) == 19);
return 0;
}
| O2 | c | func0:
endbr64
cmp $0x8,%edi
jle 12a8 <func0+0x88>
xor %eax,%eax
nopl 0x0(%rax,%rax,1)
lea 0x9(%rax),%esi
lea (%rsi,%rsi,4),%eax
add %eax,%eax
lea 0x8(%rax),%edx
cmp %edx,%edi
jg 1230 <func0+0x10>
mov %esi,%edx
xor %r8d,%r8d
mov $0xcccccccd,%r9d
nopw 0x0(%rax,%rax,1)
mov %edx,%eax
imul %r9,%rax
shr $0x23,%rax
lea (%rax,%rax,4),%ecx
add %ecx,%ecx
sub %ecx,%edx
add %edx,%r8d
mov %eax,%edx
test %eax,%eax
jne 1250 <func0+0x30>
sub %esi,%edi
test %edi,%edi
je 129f <func0+0x7f>
xor %ecx,%ecx
nopw 0x0(%rax,%rax,1)
movslq %edi,%rax
mov %edi,%edx
imul $0x66666667,%rax,%rax
sar $0x1f,%edx
sar $0x22,%rax
sub %edx,%eax
lea (%rax,%rax,4),%edx
add %edx,%edx
sub %edx,%edi
add %edi,%ecx
mov %eax,%edi
test %eax,%eax
jne 1278 <func0+0x58>
add %ecx,%r8d
mov %r8d,%eax
retq
nopl 0x0(%rax,%rax,1)
xor %r8d,%r8d
jmp 126c <func0+0x4c>
nopl (%rax)
| func0:
endbr64
mov edx, edi
cmp edi, 8
jle short loc_12E8
xor eax, eax
nop dword ptr [rax]
loc_1270:
lea edi, [rax+9]
lea eax, [rdi+rdi*4]
add eax, eax
lea ecx, [rax+8]
cmp edx, ecx
jg short loc_1270
mov ecx, edi
xor r8d, r8d
mov r9d, 0CCCCCCCDh
nop word ptr [rax+rax+00h]
loc_1290:
mov eax, ecx
imul rax, r9
shr rax, 23h
lea esi, [rax+rax*4]
add esi, esi
sub ecx, esi
add r8d, ecx
mov ecx, eax
test eax, eax
jnz short loc_1290
sub edx, edi
loc_12AC:
test edx, edx
jz short loc_12DF
xor esi, esi
nop word ptr [rax+rax+00h]
loc_12B8:
movsxd rax, edx
mov ecx, edx
imul rax, 66666667h
sar ecx, 1Fh
sar rax, 22h
sub eax, ecx
lea ecx, [rax+rax*4]
add ecx, ecx
sub edx, ecx
add esi, edx
mov edx, eax
test eax, eax
jnz short loc_12B8
add r8d, esi
loc_12DF:
mov eax, r8d
retn
loc_12E8:
xor r8d, r8d
jmp short loc_12AC | long long func0(int a1)
{
int v1; // edx
int v2; // eax
int v3; // edi
unsigned int v4; // ecx
unsigned int v5; // r8d
int v6; // esi
v1 = a1;
if ( a1 <= 8 )
{
v5 = 0;
}
else
{
v2 = 0;
do
{
v3 = v2 + 9;
v2 = 10 * (v2 + 9);
}
while ( v1 > v2 + 8 );
v4 = v3;
v5 = 0;
do
{
v5 += v4 % 0xA;
v4 /= 0xAu;
}
while ( v4 );
v1 -= v3;
}
if ( v1 )
{
v6 = 0;
do
{
v6 += v1 % 10;
v1 /= 10;
}
while ( v1 );
v5 += v6;
}
return v5;
} | func0:
ENDBR64
MOV EDX,EDI
CMP EDI,0x8
JLE 0x001012e8
XOR EAX,EAX
NOP dword ptr [RAX]
LAB_00101270:
LEA EDI,[RAX + 0x9]
LEA EAX,[RDI + RDI*0x4]
ADD EAX,EAX
LEA ECX,[RAX + 0x8]
CMP EDX,ECX
JG 0x00101270
MOV ECX,EDI
XOR R8D,R8D
MOV R9D,0xcccccccd
NOP word ptr [RAX + RAX*0x1]
LAB_00101290:
MOV EAX,ECX
IMUL RAX,R9
SHR RAX,0x23
LEA ESI,[RAX + RAX*0x4]
ADD ESI,ESI
SUB ECX,ESI
ADD R8D,ECX
MOV ECX,EAX
TEST EAX,EAX
JNZ 0x00101290
SUB EDX,EDI
LAB_001012ac:
TEST EDX,EDX
JZ 0x001012df
XOR ESI,ESI
NOP word ptr [RAX + RAX*0x1]
LAB_001012b8:
MOVSXD RAX,EDX
MOV ECX,EDX
IMUL RAX,RAX,0x66666667
SAR ECX,0x1f
SAR RAX,0x22
SUB EAX,ECX
LEA ECX,[RAX + RAX*0x4]
ADD ECX,ECX
SUB EDX,ECX
ADD ESI,EDX
MOV EDX,EAX
TEST EAX,EAX
JNZ 0x001012b8
ADD R8D,ESI
LAB_001012df:
MOV EAX,R8D
RET
LAB_001012e8:
XOR R8D,R8D
JMP 0x001012ac | int func0(int param_1)
{
int iVar1;
uint uVar2;
int iVar3;
uint uVar4;
int iVar5;
if (param_1 < 9) {
iVar5 = 0;
}
else {
iVar5 = 0;
do {
uVar4 = iVar5 + 9;
iVar5 = uVar4 * 10;
} while (iVar5 + 8 < param_1);
iVar5 = 0;
uVar2 = uVar4;
do {
iVar5 = iVar5 + uVar2 % 10;
uVar2 = uVar2 / 10;
} while (uVar2 != 0);
param_1 = param_1 - uVar4;
}
if (param_1 != 0) {
iVar3 = 0;
do {
iVar1 = param_1 / 10;
iVar3 = iVar3 + param_1 % 10;
param_1 = iVar1;
} while (iVar1 != 0);
iVar5 = iVar5 + iVar3;
}
return iVar5;
} |
4,487 | func0 |
#include <assert.h>
int sum_digits_single(int x) {
int ans = 0;
while (x) {
ans += x % 10;
x /= 10;
}
return ans;
}
int closest(int x) {
int ans = 0;
while (ans * 10 + 9 <= x) {
ans = ans * 10 + 9;
}
return ans;
}
| int func0(int N) {
int A = closest(N);
return sum_digits_single(A) + sum_digits_single(N - A);
}
| int main() {
assert(func0(35) == 17);
assert(func0(7) == 7);
assert(func0(100) == 19);
return 0;
}
| O3 | c | func0:
endbr64
cmp $0x8,%edi
jle 12a8 <func0+0x88>
xor %eax,%eax
nopl 0x0(%rax,%rax,1)
lea 0x9(%rax),%esi
lea (%rsi,%rsi,4),%eax
add %eax,%eax
lea 0x8(%rax),%edx
cmp %edx,%edi
jg 1230 <func0+0x10>
mov %esi,%edx
xor %r8d,%r8d
mov $0xcccccccd,%r9d
nopw 0x0(%rax,%rax,1)
mov %edx,%eax
imul %r9,%rax
shr $0x23,%rax
lea (%rax,%rax,4),%ecx
add %ecx,%ecx
sub %ecx,%edx
add %edx,%r8d
mov %eax,%edx
test %eax,%eax
jne 1250 <func0+0x30>
sub %esi,%edi
test %edi,%edi
je 129f <func0+0x7f>
xor %ecx,%ecx
nopw 0x0(%rax,%rax,1)
movslq %edi,%rax
mov %edi,%edx
imul $0x66666667,%rax,%rax
sar $0x1f,%edx
sar $0x22,%rax
sub %edx,%eax
lea (%rax,%rax,4),%edx
add %edx,%edx
sub %edx,%edi
add %edi,%ecx
mov %eax,%edi
test %eax,%eax
jne 1278 <func0+0x58>
add %ecx,%r8d
mov %r8d,%eax
retq
nopl 0x0(%rax,%rax,1)
xor %r8d,%r8d
jmp 126c <func0+0x4c>
nopl (%rax)
| func0:
endbr64
mov edx, edi
cmp edi, 8
jle loc_12B0
xor eax, eax
nop dword ptr [rax+00000000h]
loc_1238:
lea r8d, [rax+9]
lea eax, [r8+r8*4]
add eax, eax
lea ecx, [rax+8]
cmp edx, ecx
jg short loc_1238
mov ecx, r8d
xor edi, edi
xchg ax, ax
loc_1250:
movsxd rax, ecx
mov esi, ecx
imul rax, 66666667h
sar esi, 1Fh
sar rax, 22h
sub eax, esi
lea esi, [rax+rax*4]
add esi, esi
sub ecx, esi
add edi, ecx
mov ecx, eax
test eax, eax
jnz short loc_1250
sub edx, r8d
loc_1277:
test edx, edx
jz short loc_12A6
xor esi, esi
nop dword ptr [rax]
loc_1280:
movsxd rax, edx
mov ecx, edx
imul rax, 66666667h
sar ecx, 1Fh
sar rax, 22h
sub eax, ecx
lea ecx, [rax+rax*4]
add ecx, ecx
sub edx, ecx
add esi, edx
mov edx, eax
test eax, eax
jnz short loc_1280
add edi, esi
loc_12A6:
mov eax, edi
retn
loc_12B0:
xor edi, edi
jmp short loc_1277 | long long func0(int a1)
{
int v1; // edx
int v2; // eax
int v3; // r8d
int v4; // ecx
unsigned int v5; // edi
int v6; // esi
v1 = a1;
if ( a1 <= 8 )
{
v5 = 0;
}
else
{
v2 = 0;
do
{
v3 = v2 + 9;
v2 = 10 * (v2 + 9);
}
while ( a1 > v2 + 8 );
v4 = v3;
v5 = 0;
do
{
v5 += v4 % 10;
v4 /= 10;
}
while ( v4 );
v1 -= v3;
}
if ( v1 )
{
v6 = 0;
do
{
v6 += v1 % 10;
v1 /= 10;
}
while ( v1 );
v5 += v6;
}
return v5;
} | func0:
ENDBR64
MOV EDX,EDI
CMP EDI,0x8
JLE 0x001012b0
XOR EAX,EAX
NOP dword ptr [RAX]
LAB_00101238:
LEA R8D,[RAX + 0x9]
LEA EAX,[R8 + R8*0x4]
ADD EAX,EAX
LEA ECX,[RAX + 0x8]
CMP EDX,ECX
JG 0x00101238
MOV ECX,R8D
XOR EDI,EDI
NOP
LAB_00101250:
MOVSXD RAX,ECX
MOV ESI,ECX
IMUL RAX,RAX,0x66666667
SAR ESI,0x1f
SAR RAX,0x22
SUB EAX,ESI
LEA ESI,[RAX + RAX*0x4]
ADD ESI,ESI
SUB ECX,ESI
ADD EDI,ECX
MOV ECX,EAX
TEST EAX,EAX
JNZ 0x00101250
SUB EDX,R8D
LAB_00101277:
TEST EDX,EDX
JZ 0x001012a6
XOR ESI,ESI
NOP dword ptr [RAX]
LAB_00101280:
MOVSXD RAX,EDX
MOV ECX,EDX
IMUL RAX,RAX,0x66666667
SAR ECX,0x1f
SAR RAX,0x22
SUB EAX,ECX
LEA ECX,[RAX + RAX*0x4]
ADD ECX,ECX
SUB EDX,ECX
ADD ESI,EDX
MOV EDX,EAX
TEST EAX,EAX
JNZ 0x00101280
ADD EDI,ESI
LAB_001012a6:
MOV EAX,EDI
RET
LAB_001012b0:
XOR EDI,EDI
JMP 0x00101277 | int func0(int param_1)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
if (param_1 < 9) {
iVar3 = 0;
}
else {
iVar3 = 0;
do {
iVar4 = iVar3 + 9;
iVar3 = iVar4 * 10;
} while (iVar3 + 8 < param_1);
iVar3 = 0;
iVar2 = iVar4;
do {
iVar1 = iVar2 / 10;
iVar3 = iVar3 + iVar2 % 10;
iVar2 = iVar1;
} while (iVar1 != 0);
param_1 = param_1 - iVar4;
}
if (param_1 != 0) {
iVar4 = 0;
do {
iVar2 = param_1 / 10;
iVar4 = iVar4 + param_1 % 10;
param_1 = iVar2;
} while (iVar2 != 0);
iVar3 = iVar3 + iVar4;
}
return iVar3;
} |
4,488 | func0 |
#include <assert.h>
#include <stdio.h>
| int func0(int arr[], int n) {
int dp[n];
for (int i = 0; i < n; i++) {
dp[i] = 1;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
if (arr[i] == arr[j] + 1 || arr[i] == arr[j] - 1) {
if (dp[i] < dp[j] + 1) {
dp[i] = dp[j] + 1;
}
}
}
}
int result = 1;
for (int i = 0; i < n; i++) {
if (result < dp[i]) {
result = dp[i];
}
}
return result;
}
| int main() {
assert(func0((int[]){1, 2, 3, 4, 5, 3, 2}, 7) == 6);
assert(func0((int[]){10, 9, 4, 5, 4, 8, 6}, 7) == 3);
assert(func0((int[]){1, 2, 3, 2, 3, 7, 2, 1}, 8) == 7);
printf("All tests passed!\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
sub $0x48,%rsp
mov %rdi,-0x48(%rbp)
mov %esi,-0x4c(%rbp)
mov %fs:0x28,%rax
mov %rax,-0x18(%rbp)
xor %eax,%eax
mov %rsp,%rax
mov %rax,%rsi
mov -0x4c(%rbp),%eax
movslq %eax,%rdx
sub $0x1,%rdx
mov %rdx,-0x28(%rbp)
movslq %eax,%rdx
mov %rdx,%r8
mov $0x0,%r9d
movslq %eax,%rdx
mov %rdx,%rcx
mov $0x0,%ebx
cltq
lea 0x0(,%rax,4),%rdx
mov $0x10,%eax
sub $0x1,%rax
add %rdx,%rax
mov $0x10,%edi
mov $0x0,%edx
div %rdi
imul $0x10,%rax,%rax
mov %rax,%rdx
and $0xfffffffffffff000,%rdx
mov %rsp,%rbx
sub %rdx,%rbx
mov %rbx,%rdx
cmp %rdx,%rsp
je 1228 <func0+0x9f>
sub $0x1000,%rsp
orq $0x0,0xff8(%rsp)
jmp 1211 <func0+0x88>
mov %rax,%rdx
and $0xfff,%edx
sub %rdx,%rsp
mov %rax,%rdx
and $0xfff,%edx
test %rdx,%rdx
je 1252 <func0+0xc9>
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)
movl $0x0,-0x30(%rbp)
jmp 1283 <func0+0xfa>
mov -0x20(%rbp),%rax
mov -0x30(%rbp),%edx
movslq %edx,%rdx
movl $0x1,(%rax,%rdx,4)
addl $0x1,-0x30(%rbp)
mov -0x30(%rbp),%eax
cmp -0x4c(%rbp),%eax
jl 126e <func0+0xe5>
movl $0x0,-0x34(%rbp)
jmpq 135a <func0+0x1d1>
movl $0x0,-0x38(%rbp)
jmpq 134a <func0+0x1c1>
mov -0x34(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x48(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
mov -0x38(%rbp),%edx
movslq %edx,%rdx
lea 0x0(,%rdx,4),%rcx
mov -0x48(%rbp),%rdx
add %rcx,%rdx
mov (%rdx),%edx
add $0x1,%edx
cmp %edx,%eax
je 130b <func0+0x182>
mov -0x34(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x48(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
mov -0x38(%rbp),%edx
movslq %edx,%rdx
lea 0x0(,%rdx,4),%rcx
mov -0x48(%rbp),%rdx
add %rcx,%rdx
mov (%rdx),%edx
sub $0x1,%edx
cmp %edx,%eax
jne 1346 <func0+0x1bd>
mov -0x20(%rbp),%rax
mov -0x38(%rbp),%edx
movslq %edx,%rdx
mov (%rax,%rdx,4),%ecx
mov -0x20(%rbp),%rax
mov -0x34(%rbp),%edx
movslq %edx,%rdx
mov (%rax,%rdx,4),%eax
cmp %eax,%ecx
jl 1346 <func0+0x1bd>
mov -0x20(%rbp),%rax
mov -0x38(%rbp),%edx
movslq %edx,%rdx
mov (%rax,%rdx,4),%eax
lea 0x1(%rax),%ecx
mov -0x20(%rbp),%rax
mov -0x34(%rbp),%edx
movslq %edx,%rdx
mov %ecx,(%rax,%rdx,4)
addl $0x1,-0x38(%rbp)
mov -0x38(%rbp),%eax
cmp -0x34(%rbp),%eax
jl 12a3 <func0+0x11a>
addl $0x1,-0x34(%rbp)
mov -0x34(%rbp),%eax
cmp -0x4c(%rbp),%eax
jl 1297 <func0+0x10e>
movl $0x1,-0x3c(%rbp)
movl $0x0,-0x2c(%rbp)
jmp 139c <func0+0x213>
mov -0x20(%rbp),%rax
mov -0x2c(%rbp),%edx
movslq %edx,%rdx
mov (%rax,%rdx,4),%eax
cmp %eax,-0x3c(%rbp)
jge 1398 <func0+0x20f>
mov -0x20(%rbp),%rax
mov -0x2c(%rbp),%edx
movslq %edx,%rdx
mov (%rax,%rdx,4),%eax
mov %eax,-0x3c(%rbp)
addl $0x1,-0x2c(%rbp)
mov -0x2c(%rbp),%eax
cmp -0x4c(%rbp),%eax
jl 1376 <func0+0x1ed>
mov -0x3c(%rbp),%eax
mov %rsi,%rsp
mov -0x18(%rbp),%rdi
xor %fs:0x28,%rdi
je 13be <func0+0x235>
callq 1080 <__stack_chk_fail@plt>
mov -0x8(%rbp),%rbx
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 40h
mov [rbp+var_38], rdi
mov [rbp+var_3C], esi
mov rax, fs:28h
mov [rbp+var_8], rax
xor eax, eax
mov rax, rsp
mov rsi, rax
mov eax, [rbp+var_3C]
movsxd rdx, eax
sub rdx, 1
mov [rbp+var_18], rdx
cdqe
lea rdx, ds:0[rax*4]
mov eax, 10h
sub rax, 1
add rax, rdx
mov edi, 10h
mov edx, 0
div rdi
imul rax, 10h
mov rcx, rax
and rcx, 0FFFFFFFFFFFFF000h
mov rdx, rsp
sub rdx, rcx
loc_11F6:
cmp rsp, rdx
jz short loc_120D
sub rsp, 1000h
or [rsp+1040h+var_48], 0
jmp short loc_11F6
loc_120D:
mov rdx, rax
and edx, 0FFFh
sub rsp, rdx
mov rdx, rax
and edx, 0FFFh
test rdx, rdx
jz short loc_1237
and eax, 0FFFh
sub rax, 8
add rax, rsp
or qword ptr [rax], 0
loc_1237:
mov rax, rsp
add rax, 3
shr rax, 2
shl rax, 2
mov [rbp+var_10], rax
mov [rbp+var_2C], 0
jmp short loc_1268
loc_1253:
mov rax, [rbp+var_10]
mov edx, [rbp+var_2C]
movsxd rdx, edx
mov dword ptr [rax+rdx*4], 1
add [rbp+var_2C], 1
loc_1268:
mov eax, [rbp+var_2C]
cmp eax, [rbp+var_3C]
jl short loc_1253
mov [rbp+var_28], 0
jmp loc_133D
loc_127C:
mov [rbp+var_24], 0
jmp loc_132D
loc_1288:
mov eax, [rbp+var_28]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_38]
add rax, rdx
mov edx, [rax]
mov eax, [rbp+var_24]
cdqe
lea rcx, ds:0[rax*4]
mov rax, [rbp+var_38]
add rax, rcx
mov eax, [rax]
add eax, 1
cmp edx, eax
jz short loc_12EE
mov eax, [rbp+var_28]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_38]
add rax, rdx
mov edx, [rax]
mov eax, [rbp+var_24]
cdqe
lea rcx, ds:0[rax*4]
mov rax, [rbp+var_38]
add rax, rcx
mov eax, [rax]
sub eax, 1
cmp edx, eax
jnz short loc_1329
loc_12EE:
mov rax, [rbp+var_10]
mov edx, [rbp+var_24]
movsxd rdx, edx
mov ecx, [rax+rdx*4]
mov rax, [rbp+var_10]
mov edx, [rbp+var_28]
movsxd rdx, edx
mov eax, [rax+rdx*4]
cmp ecx, eax
jl short loc_1329
mov rax, [rbp+var_10]
mov edx, [rbp+var_24]
movsxd rdx, edx
mov eax, [rax+rdx*4]
lea ecx, [rax+1]
mov rax, [rbp+var_10]
mov edx, [rbp+var_28]
movsxd rdx, edx
mov [rax+rdx*4], ecx
loc_1329:
add [rbp+var_24], 1
loc_132D:
mov eax, [rbp+var_24]
cmp eax, [rbp+var_28]
jl loc_1288
add [rbp+var_28], 1
loc_133D:
mov eax, [rbp+var_28]
cmp eax, [rbp+var_3C]
jl loc_127C
mov [rbp+var_20], 1
mov [rbp+var_1C], 0
jmp short loc_137F
loc_1359:
mov rax, [rbp+var_10]
mov edx, [rbp+var_1C]
movsxd rdx, edx
mov eax, [rax+rdx*4]
cmp [rbp+var_20], eax
jge short loc_137B
mov rax, [rbp+var_10]
mov edx, [rbp+var_1C]
movsxd rdx, edx
mov eax, [rax+rdx*4]
mov [rbp+var_20], eax
loc_137B:
add [rbp+var_1C], 1
loc_137F:
mov eax, [rbp+var_1C]
cmp eax, [rbp+var_3C]
jl short loc_1359
mov eax, [rbp+var_20]
mov rsp, rsi
mov rdx, [rbp+var_8]
sub rdx, fs:28h
jz short locret_13A1
call ___stack_chk_fail
locret_13A1:
leave
retn | long long func0(long long a1, int a2)
{
unsigned long long v2; // rax
void *v3; // rsp
_BYTE v5[4]; // [rsp+8h] [rbp-40h] BYREF
int v6; // [rsp+Ch] [rbp-3Ch]
long long v7; // [rsp+10h] [rbp-38h]
int i; // [rsp+1Ch] [rbp-2Ch]
int j; // [rsp+20h] [rbp-28h]
int k; // [rsp+24h] [rbp-24h]
int v11; // [rsp+28h] [rbp-20h]
int m; // [rsp+2Ch] [rbp-1Ch]
long long v13; // [rsp+30h] [rbp-18h]
_BYTE *v14; // [rsp+38h] [rbp-10h]
unsigned long long v15; // [rsp+40h] [rbp-8h]
v7 = a1;
v6 = a2;
v15 = __readfsqword(0x28u);
v13 = a2 - 1LL;
v2 = 16 * ((4LL * a2 + 15) / 0x10uLL);
while ( v5 != &v5[-(v2 & 0xFFFFFFFFFFFFF000LL)] )
;
v3 = alloca(v2 & 0xFFF);
if ( (v2 & 0xFFF) != 0 )
*(_QWORD *)&v5[(v2 & 0xFFF) - 8] = *(_QWORD *)&v5[(v2 & 0xFFF) - 8];
v14 = v5;
for ( i = 0; i < v6; ++i )
*(_DWORD *)&v14[4 * i] = 1;
for ( j = 0; j < v6; ++j )
{
for ( k = 0; k < j; ++k )
{
if ( (*(_DWORD *)(4LL * j + v7) == *(_DWORD *)(4LL * k + v7) + 1
|| *(_DWORD *)(4LL * j + v7) == *(_DWORD *)(4LL * k + v7) - 1)
&& *(_DWORD *)&v14[4 * k] >= *(_DWORD *)&v14[4 * j] )
{
*(_DWORD *)&v14[4 * j] = *(_DWORD *)&v14[4 * k] + 1;
}
}
}
v11 = 1;
for ( m = 0; m < v6; ++m )
{
if ( v11 < *(_DWORD *)&v14[4 * m] )
v11 = *(_DWORD *)&v14[4 * m];
}
return (unsigned int)v11;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x40
MOV qword ptr [RBP + -0x38],RDI
MOV dword ptr [RBP + -0x3c],ESI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x8],RAX
XOR EAX,EAX
MOV RAX,RSP
MOV RSI,RAX
MOV EAX,dword ptr [RBP + -0x3c]
MOVSXD RDX,EAX
SUB RDX,0x1
MOV qword ptr [RBP + -0x18],RDX
CDQE
LEA RDX,[RAX*0x4]
MOV EAX,0x10
SUB RAX,0x1
ADD RAX,RDX
MOV EDI,0x10
MOV EDX,0x0
DIV RDI
IMUL RAX,RAX,0x10
MOV RCX,RAX
AND RCX,-0x1000
MOV RDX,RSP
SUB RDX,RCX
LAB_001011f6:
CMP RSP,RDX
JZ 0x0010120d
SUB RSP,0x1000
OR qword ptr [RSP + 0xff8],0x0
JMP 0x001011f6
LAB_0010120d:
MOV RDX,RAX
AND EDX,0xfff
SUB RSP,RDX
MOV RDX,RAX
AND EDX,0xfff
TEST RDX,RDX
JZ 0x00101237
AND EAX,0xfff
SUB RAX,0x8
ADD RAX,RSP
OR qword ptr [RAX],0x0
LAB_00101237:
MOV RAX,RSP
ADD RAX,0x3
SHR RAX,0x2
SHL RAX,0x2
MOV qword ptr [RBP + -0x10],RAX
MOV dword ptr [RBP + -0x2c],0x0
JMP 0x00101268
LAB_00101253:
MOV RAX,qword ptr [RBP + -0x10]
MOV EDX,dword ptr [RBP + -0x2c]
MOVSXD RDX,EDX
MOV dword ptr [RAX + RDX*0x4],0x1
ADD dword ptr [RBP + -0x2c],0x1
LAB_00101268:
MOV EAX,dword ptr [RBP + -0x2c]
CMP EAX,dword ptr [RBP + -0x3c]
JL 0x00101253
MOV dword ptr [RBP + -0x28],0x0
JMP 0x0010133d
LAB_0010127c:
MOV dword ptr [RBP + -0x24],0x0
JMP 0x0010132d
LAB_00101288:
MOV EAX,dword ptr [RBP + -0x28]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x38]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x24]
CDQE
LEA RCX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x38]
ADD RAX,RCX
MOV EAX,dword ptr [RAX]
ADD EAX,0x1
CMP EDX,EAX
JZ 0x001012ee
MOV EAX,dword ptr [RBP + -0x28]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x38]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x24]
CDQE
LEA RCX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x38]
ADD RAX,RCX
MOV EAX,dword ptr [RAX]
SUB EAX,0x1
CMP EDX,EAX
JNZ 0x00101329
LAB_001012ee:
MOV RAX,qword ptr [RBP + -0x10]
MOV EDX,dword ptr [RBP + -0x24]
MOVSXD RDX,EDX
MOV ECX,dword ptr [RAX + RDX*0x4]
MOV RAX,qword ptr [RBP + -0x10]
MOV EDX,dword ptr [RBP + -0x28]
MOVSXD RDX,EDX
MOV EAX,dword ptr [RAX + RDX*0x4]
CMP ECX,EAX
JL 0x00101329
MOV RAX,qword ptr [RBP + -0x10]
MOV EDX,dword ptr [RBP + -0x24]
MOVSXD RDX,EDX
MOV EAX,dword ptr [RAX + RDX*0x4]
LEA ECX,[RAX + 0x1]
MOV RAX,qword ptr [RBP + -0x10]
MOV EDX,dword ptr [RBP + -0x28]
MOVSXD RDX,EDX
MOV dword ptr [RAX + RDX*0x4],ECX
LAB_00101329:
ADD dword ptr [RBP + -0x24],0x1
LAB_0010132d:
MOV EAX,dword ptr [RBP + -0x24]
CMP EAX,dword ptr [RBP + -0x28]
JL 0x00101288
ADD dword ptr [RBP + -0x28],0x1
LAB_0010133d:
MOV EAX,dword ptr [RBP + -0x28]
CMP EAX,dword ptr [RBP + -0x3c]
JL 0x0010127c
MOV dword ptr [RBP + -0x20],0x1
MOV dword ptr [RBP + -0x1c],0x0
JMP 0x0010137f
LAB_00101359:
MOV RAX,qword ptr [RBP + -0x10]
MOV EDX,dword ptr [RBP + -0x1c]
MOVSXD RDX,EDX
MOV EAX,dword ptr [RAX + RDX*0x4]
CMP dword ptr [RBP + -0x20],EAX
JGE 0x0010137b
MOV RAX,qword ptr [RBP + -0x10]
MOV EDX,dword ptr [RBP + -0x1c]
MOVSXD RDX,EDX
MOV EAX,dword ptr [RAX + RDX*0x4]
MOV dword ptr [RBP + -0x20],EAX
LAB_0010137b:
ADD dword ptr [RBP + -0x1c],0x1
LAB_0010137f:
MOV EAX,dword ptr [RBP + -0x1c]
CMP EAX,dword ptr [RBP + -0x3c]
JL 0x00101359
MOV EAX,dword ptr [RBP + -0x20]
MOV RSP,RSI
MOV RDX,qword ptr [RBP + -0x8]
SUB RDX,qword ptr FS:[0x28]
JZ 0x001013a1
CALL 0x00101080
LAB_001013a1:
LEAVE
RET | int func0(long param_1,int param_2)
{
long lVar1;
ulong uVar2;
int *puVar3;
long in_FS_OFFSET;
int auStack_48 [4];
int local_44;
long local_40;
int local_34;
int local_30;
int local_2c;
int local_28;
int local_24;
long local_20;
int *local_18;
long local_10;
local_40 = param_1;
local_44 = param_2;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_20 = (long)param_2 + -1;
uVar2 = (((long)param_2 * 4 + 0xfU) / 0x10) * 0x10;
for (puVar3 = auStack_48; puVar3 != auStack_48 + -(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);
}
for (local_34 = 0; local_34 < local_44; local_34 = local_34 + 1) {
*(int4 *)(puVar3 + (long)local_34 * 4 + lVar1) = 1;
}
for (local_30 = 0; local_30 < local_44; local_30 = local_30 + 1) {
for (local_2c = 0; local_2c < local_30; local_2c = local_2c + 1) {
if (((*(int *)(local_40 + (long)local_30 * 4) == *(int *)(local_40 + (long)local_2c * 4) + 1)
|| (*(int *)(local_40 + (long)local_30 * 4) ==
*(int *)(local_40 + (long)local_2c * 4) + -1)) &&
(*(int *)(puVar3 + (long)local_30 * 4 + lVar1) <=
*(int *)(puVar3 + (long)local_2c * 4 + lVar1))) {
*(int *)(puVar3 + (long)local_30 * 4 + lVar1) =
*(int *)(puVar3 + (long)local_2c * 4 + lVar1) + 1;
}
}
}
local_28 = 1;
for (local_24 = 0; local_24 < local_44; local_24 = local_24 + 1) {
if (local_28 < *(int *)(puVar3 + (long)local_24 * 4 + lVar1)) {
local_28 = *(int *)(puVar3 + (long)local_24 * 4 + lVar1);
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
local_18 = puVar3 + lVar1;
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return local_28;
} |
4,489 | func0 |
#include <assert.h>
#include <stdio.h>
| int func0(int arr[], int n) {
int dp[n];
for (int i = 0; i < n; i++) {
dp[i] = 1;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
if (arr[i] == arr[j] + 1 || arr[i] == arr[j] - 1) {
if (dp[i] < dp[j] + 1) {
dp[i] = dp[j] + 1;
}
}
}
}
int result = 1;
for (int i = 0; i < n; i++) {
if (result < dp[i]) {
result = dp[i];
}
}
return result;
}
| int main() {
assert(func0((int[]){1, 2, 3, 4, 5, 3, 2}, 7) == 6);
assert(func0((int[]){10, 9, 4, 5, 4, 8, 6}, 7) == 3);
assert(func0((int[]){1, 2, 3, 2, 3, 7, 2, 1}, 8) == 7);
printf("All tests passed!\n");
return 0;
}
| O1 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %r13
push %r12
push %rbx
sub $0x18,%rsp
mov %fs:0x28,%rax
mov %rax,-0x28(%rbp)
xor %eax,%eax
movslq %esi,%rax
lea 0xf(,%rax,4),%rax
mov %rax,%rdx
and $0xfffffffffffffff0,%rdx
and $0xfffffffffffff000,%rax
mov %rsp,%rbx
sub %rax,%rbx
mov %rbx,%rax
cmp %rax,%rsp
je 11e1 <func0+0x58>
sub $0x1000,%rsp
orq $0x0,0xff8(%rsp)
jmp 11ca <func0+0x41>
mov %rdx,%rax
and $0xfff,%eax
sub %rax,%rsp
test %rax,%rax
je 11f7 <func0+0x6e>
orq $0x0,-0x8(%rsp,%rax,1)
mov %rsp,%rax
mov %rax,%r9
test %esi,%esi
jle 12ac <func0+0x123>
mov %rax,%r11
lea -0x1(%rsi),%r12d
lea 0x4(%rax,%r12,4),%rbx
movl $0x1,(%rax)
add $0x4,%rax
cmp %rbx,%rax
jne 1211 <func0+0x88>
mov $0x0,%r8d
mov $0x0,%r13d
jmp 126a <func0+0xe1>
mov (%r9,%rax,4),%edx
cmp (%r9,%r8,4),%edx
jl 123f <func0+0xb6>
add $0x1,%edx
mov %edx,(%r9,%r8,4)
lea 0x1(%rax),%rdx
cmp %rax,%r10
je 125e <func0+0xd5>
mov %rdx,%rax
mov (%rdi,%rax,4),%edx
lea 0x1(%rdx),%ecx
cmp %ecx,%esi
je 122e <func0+0xa5>
sub $0x1,%edx
cmp %edx,%esi
jne 123f <func0+0xb6>
jmp 122e <func0+0xa5>
lea 0x1(%r8),%rax
cmp %r12,%r8
je 127c <func0+0xf3>
mov %rax,%r8
test %r8d,%r8d
jle 125e <func0+0xd5>
mov (%rdi,%r8,4),%esi
lea -0x1(%r8),%r10d
mov %r13,%rax
jmp 124b <func0+0xc2>
mov $0x1,%eax
mov (%r11),%edx
cmp %edx,%eax
cmovl %edx,%eax
add $0x4,%r11
cmp %rbx,%r11
jne 1281 <func0+0xf8>
mov -0x28(%rbp),%rbx
xor %fs:0x28,%rbx
jne 12b3 <func0+0x12a>
lea -0x18(%rbp),%rsp
pop %rbx
pop %r12
pop %r13
pop %rbp
retq
mov $0x1,%eax
jmp 1292 <func0+0x109>
callq 1080 <__stack_chk_fail@plt>
| func0:
endbr64
push rbp
mov rbp, rsp
push r13
push r12
push rbx
sub rsp, 18h
mov r9, rdi
mov r12d, esi
mov rax, fs:28h
mov [rbp+var_28], rax
xor eax, eax
movsxd rax, esi
lea rax, ds:0Fh[rax*4]
mov rcx, rax
and rcx, 0FFFFFFFFFFFFFFF0h
and rax, 0FFFFFFFFFFFFF000h
mov rdx, rsp
sub rdx, rax
loc_11CD:
cmp rsp, rdx
jz short loc_11E4
sub rsp, 1000h
or [rsp+1030h+var_38], 0
jmp short loc_11CD
loc_11E4:
mov rax, rcx
and eax, 0FFFh
sub rsp, rax
test rax, rax
jz short loc_11FA
or [rsp+rax+30h+var_38], 0
loc_11FA:
mov r8, rsp
test r12d, r12d
jle loc_12AD
mov r11, r8
mov eax, r12d
lea rbx, [r8+rax*4]
mov rax, r8
loc_1213:
mov dword ptr [rax], 1
add rax, 4
cmp rax, rbx
jnz short loc_1213
mov r12d, r12d
mov edi, 0
mov r13d, 0
jmp short loc_126C
loc_1232:
mov edx, [r8+rax*4]
cmp edx, [r8+rdi*4]
jl short loc_1243
add edx, 1
mov [r8+rdi*4], edx
loc_1243:
lea rdx, [rax+1]
cmp r10, rax
jz short loc_1263
mov rax, rdx
loc_124F:
mov edx, [r9+rax*4]
lea ecx, [rdx+1]
cmp esi, ecx
jz short loc_1232
sub edx, 1
cmp esi, edx
jnz short loc_1243
jmp short loc_1232
loc_1263:
add rdi, 1
cmp rdi, r12
jz short loc_127D
loc_126C:
test edi, edi
jle short loc_1263
mov esi, [r9+rdi*4]
lea r10d, [rdi-1]
mov rax, r13
jmp short loc_124F
loc_127D:
mov eax, 1
loc_1282:
mov edx, [r11]
cmp eax, edx
cmovl eax, edx
add r11, 4
cmp r11, rbx
jnz short loc_1282
loc_1293:
mov rdx, [rbp+var_28]
sub rdx, fs:28h
jnz short loc_12B4
lea rsp, [rbp-18h]
pop rbx
pop r12
pop r13
pop rbp
retn
loc_12AD:
mov eax, 1
jmp short loc_1293
loc_12B4:
call ___stack_chk_fail | long long func0(long long a1, int a2)
{
signed long long v4; // rax
void *v5; // rsp
_DWORD *v6; // r11
_DWORD *v7; // rbx
_DWORD *v8; // rax
long long i; // rdi
int v10; // edx
long long j; // rax
int v12; // edx
int v13; // esi
long long result; // rax
_DWORD v16[2]; // [rsp+8h] [rbp-30h] BYREF
unsigned long long v17; // [rsp+10h] [rbp-28h]
v17 = __readfsqword(0x28u);
while ( v16 != (_DWORD *)((char *)v16 - ((4LL * a2 + 15) & 0xFFFFFFFFFFFFF000LL)) )
;
v4 = (4 * (_WORD)a2 + 15) & 0xFF0;
v5 = alloca(v4);
if ( ((4 * (_WORD)a2 + 15) & 0xFF0) != 0 )
*(_QWORD *)((char *)&v16[-2] + v4) = *(_QWORD *)((char *)&v16[-2] + v4);
if ( a2 <= 0 )
return 1LL;
v6 = v16;
v7 = &v16[a2];
v8 = v16;
do
*v8++ = 1;
while ( v8 != v7 );
for ( i = 0LL; i != a2; ++i )
{
if ( (int)i > 0 )
{
v13 = *(_DWORD *)(a1 + 4 * i);
for ( j = 0LL; ; ++j )
{
v12 = *(_DWORD *)(a1 + 4 * j);
if ( v13 == v12 + 1 || v13 == v12 - 1 )
{
v10 = v16[j];
if ( v10 >= v16[i] )
v16[i] = v10 + 1;
}
if ( (_DWORD)i - 1 == j )
break;
}
}
}
result = 1LL;
do
{
if ( (int)result < *v6 )
result = (unsigned int)*v6;
++v6;
}
while ( v6 != v7 );
return result;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
PUSH R13
PUSH R12
PUSH RBX
SUB RSP,0x18
MOV R9,RDI
MOV R12D,ESI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x28],RAX
XOR EAX,EAX
MOVSXD RAX,ESI
LEA RAX,[0xf + RAX*0x4]
MOV RCX,RAX
AND RCX,-0x10
AND RAX,-0x1000
MOV RDX,RSP
SUB RDX,RAX
LAB_001011cd:
CMP RSP,RDX
JZ 0x001011e4
SUB RSP,0x1000
OR qword ptr [RSP + 0xff8],0x0
JMP 0x001011cd
LAB_001011e4:
MOV RAX,RCX
AND EAX,0xfff
SUB RSP,RAX
TEST RAX,RAX
JZ 0x001011fa
OR qword ptr [RSP + RAX*0x1 + -0x8],0x0
LAB_001011fa:
MOV R8,RSP
TEST R12D,R12D
JLE 0x001012ad
MOV R11,R8
MOV EAX,R12D
LEA RBX,[R8 + RAX*0x4]
MOV RAX,R8
LAB_00101213:
MOV dword ptr [RAX],0x1
ADD RAX,0x4
CMP RAX,RBX
JNZ 0x00101213
MOV R12D,R12D
MOV EDI,0x0
MOV R13D,0x0
JMP 0x0010126c
LAB_00101232:
MOV EDX,dword ptr [R8 + RAX*0x4]
CMP EDX,dword ptr [R8 + RDI*0x4]
JL 0x00101243
ADD EDX,0x1
MOV dword ptr [R8 + RDI*0x4],EDX
LAB_00101243:
LEA RDX,[RAX + 0x1]
CMP R10,RAX
JZ 0x00101263
MOV RAX,RDX
LAB_0010124f:
MOV EDX,dword ptr [R9 + RAX*0x4]
LEA ECX,[RDX + 0x1]
CMP ESI,ECX
JZ 0x00101232
SUB EDX,0x1
CMP ESI,EDX
JNZ 0x00101243
JMP 0x00101232
LAB_00101263:
ADD RDI,0x1
CMP RDI,R12
JZ 0x0010127d
LAB_0010126c:
TEST EDI,EDI
JLE 0x00101263
MOV ESI,dword ptr [R9 + RDI*0x4]
LEA R10D,[RDI + -0x1]
MOV RAX,R13
JMP 0x0010124f
LAB_0010127d:
MOV EAX,0x1
LAB_00101282:
MOV EDX,dword ptr [R11]
CMP EAX,EDX
CMOVL EAX,EDX
ADD R11,0x4
CMP R11,RBX
JNZ 0x00101282
LAB_00101293:
MOV RDX,qword ptr [RBP + -0x28]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x001012b4
LEA RSP,[RBP + -0x18]
POP RBX
POP R12
POP R13
POP RBP
RET
LAB_001012ad:
MOV EAX,0x1
JMP 0x00101293
LAB_001012b4:
CALL 0x00101080 | int func0(long param_1,uint param_2)
{
int iVar1;
long lVar2;
int iVar3;
int *piVar4;
ulong uVar5;
int1 *puVar6;
ulong uVar7;
int *piVar8;
long in_FS_OFFSET;
bool bVar9;
int1 auStack_38 [8];
long local_30;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
uVar7 = (long)(int)param_2 * 4 + 0xf;
for (puVar6 = auStack_38; puVar6 != auStack_38 + -(uVar7 & 0xfffffffffffff000);
puVar6 = puVar6 + -0x1000) {
*(int8 *)(puVar6 + -8) = *(int8 *)(puVar6 + -8);
}
uVar7 = (ulong)((uint)uVar7 & 0xff0);
lVar2 = -uVar7;
piVar4 = (int *)(puVar6 + lVar2);
piVar8 = (int *)(puVar6 + lVar2);
if (uVar7 != 0) {
*(int8 *)(puVar6 + -8) = *(int8 *)(puVar6 + -8);
}
if ((int)param_2 < 1) {
iVar3 = 1;
}
else {
do {
*piVar4 = 1;
piVar4 = piVar4 + 1;
} while (piVar4 != (int *)(puVar6 + (ulong)param_2 * 4 + lVar2));
uVar7 = 0;
do {
if (0 < (int)uVar7) {
iVar3 = *(int *)(param_1 + uVar7 * 4);
uVar5 = 0;
do {
iVar1 = *(int *)(param_1 + uVar5 * 4);
if (((iVar3 == iVar1 + 1) || (iVar3 == iVar1 + -1)) &&
(*(int *)(puVar6 + uVar7 * 4 + lVar2) <= *(int *)(puVar6 + uVar5 * 4 + lVar2))) {
*(int *)(puVar6 + uVar7 * 4 + lVar2) = *(int *)(puVar6 + uVar5 * 4 + lVar2) + 1;
}
bVar9 = (int)uVar7 - 1 != uVar5;
uVar5 = uVar5 + 1;
} while (bVar9);
}
uVar7 = uVar7 + 1;
} while (uVar7 != param_2);
iVar3 = 1;
do {
if (iVar3 < *piVar8) {
iVar3 = *piVar8;
}
piVar8 = piVar8 + 1;
} while (piVar8 != (int *)(puVar6 + (ulong)param_2 * 4 + lVar2));
}
if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
*(code **)(puVar6 + lVar2 + -8) = main;
__stack_chk_fail();
}
return iVar3;
} |
4,490 | func0 |
#include <assert.h>
#include <stdio.h>
| int func0(int arr[], int n) {
int dp[n];
for (int i = 0; i < n; i++) {
dp[i] = 1;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
if (arr[i] == arr[j] + 1 || arr[i] == arr[j] - 1) {
if (dp[i] < dp[j] + 1) {
dp[i] = dp[j] + 1;
}
}
}
}
int result = 1;
for (int i = 0; i < n; i++) {
if (result < dp[i]) {
result = dp[i];
}
}
return result;
}
| int main() {
assert(func0((int[]){1, 2, 3, 4, 5, 3, 2}, 7) == 6);
assert(func0((int[]){10, 9, 4, 5, 4, 8, 6}, 7) == 3);
assert(func0((int[]){1, 2, 3, 2, 3, 7, 2, 1}, 8) == 7);
printf("All tests passed!\n");
return 0;
}
| O2 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %r12
push %rbx
sub $0x10,%rsp
mov %fs:0x28,%rax
mov %rax,-0x18(%rbp)
xor %eax,%eax
movslq %esi,%rax
mov %rsp,%rbx
lea 0xf(,%rax,4),%rax
mov %rax,%rdx
and $0xfffffffffffff000,%rax
sub %rax,%rbx
and $0xfffffffffffffff0,%rdx
mov %rbx,%rax
cmp %rax,%rsp
je 1369 <func0+0x59>
sub $0x1000,%rsp
orq $0x0,0xff8(%rsp)
cmp %rax,%rsp
jne 1354 <func0+0x44>
and $0xfff,%edx
sub %rdx,%rsp
test %rdx,%rdx
jne 1441 <func0+0x131>
mov %rsp,%r9
test %esi,%esi
jle 144c <func0+0x13c>
lea -0x1(%rsi),%r12d
mov %r9,%r11
mov %r9,%rax
lea 0x4(%r9,%r12,4),%rbx
nopl (%rax)
movl $0x1,(%rax)
add $0x4,%rax
cmp %rbx,%rax
jne 1398 <func0+0x88>
xor %r8d,%r8d
nopw 0x0(%rax,%rax,1)
test %r8,%r8
je 13ff <func0+0xef>
mov (%rdi,%r8,4),%esi
lea -0x1(%r8),%r10d
xor %eax,%eax
jmp 13db <func0+0xcb>
nopl 0x0(%rax)
sub $0x1,%edx
cmp %edx,%esi
je 13e5 <func0+0xd5>
lea 0x1(%rax),%rdx
cmp %rax,%r10
je 13ff <func0+0xef>
mov %rdx,%rax
mov (%rdi,%rax,4),%edx
lea 0x1(%rdx),%ecx
cmp %ecx,%esi
jne 13c8 <func0+0xb8>
mov (%r9,%rax,4),%edx
cmp (%r9,%r8,4),%edx
jl 13cf <func0+0xbf>
add $0x1,%edx
mov %edx,(%r9,%r8,4)
lea 0x1(%rax),%rdx
cmp %rax,%r10
jne 13d8 <func0+0xc8>
lea 0x1(%r8),%rax
cmp %r12,%r8
je 1410 <func0+0x100>
mov %rax,%r8
jmp 13b0 <func0+0xa0>
nopl (%rax)
mov $0x1,%eax
nopl (%rax)
mov (%r11),%edx
cmp %edx,%eax
cmovl %edx,%eax
add $0x4,%r11
cmp %rbx,%r11
jne 1418 <func0+0x108>
mov -0x18(%rbp),%rbx
xor %fs:0x28,%rbx
jne 1453 <func0+0x143>
lea -0x10(%rbp),%rsp
pop %rbx
pop %r12
pop %rbp
retq
orq $0x0,-0x8(%rsp,%rdx,1)
jmpq 137b <func0+0x6b>
mov $0x1,%eax
jmp 1429 <func0+0x119>
callq 1080 <__stack_chk_fail@plt>
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
push rbp
mov r9, rdi
mov rbp, rsp
push r12
push rbx
sub rsp, 10h
mov rax, fs:28h
mov [rbp+var_18], rax
xor eax, eax
movsxd rax, esi
mov rcx, rsp
lea rax, ds:0Fh[rax*4]
mov rdx, rax
and rax, 0FFFFFFFFFFFFF000h
sub rcx, rax
and rdx, 0FFFFFFFFFFFFFFF0h
cmp rsp, rcx
jz short loc_1369
loc_1354:
sub rsp, 1000h
or [rsp+1020h+var_28], 0
cmp rsp, rcx
jnz short loc_1354
loc_1369:
and edx, 0FFFh
sub rsp, rdx
test rdx, rdx
jnz loc_1439
loc_137B:
mov r8, rsp
test esi, esi
jle loc_1444
mov r12d, esi
mov r11, r8
mov rax, r8
lea rbx, [r8+r12*4]
nop dword ptr [rax+rax+00h]
loc_1398:
mov dword ptr [rax], 1
add rax, 4
cmp rax, rbx
jnz short loc_1398
xor edi, edi
nop dword ptr [rax+00000000h]
loc_13B0:
test rdi, rdi
jz short loc_1400
mov esi, [r9+rdi*4]
lea r10d, [rdi-1]
xor eax, eax
jmp short loc_13DB
loc_13C8:
sub edx, 1
cmp esi, edx
jz short loc_13E6
loc_13CF:
lea rdx, [rax+1]
cmp r10, rax
jz short loc_1400
loc_13D8:
mov rax, rdx
loc_13DB:
mov edx, [r9+rax*4]
lea ecx, [rdx+1]
cmp esi, ecx
jnz short loc_13C8
loc_13E6:
mov edx, [r8+rax*4]
cmp edx, [r8+rdi*4]
jl short loc_13CF
add edx, 1
mov [r8+rdi*4], edx
lea rdx, [rax+1]
cmp r10, rax
jnz short loc_13D8
loc_1400:
add rdi, 1
cmp rdi, r12
jnz short loc_13B0
mov eax, 1
xchg ax, ax
loc_1410:
mov edx, [r11]
cmp eax, edx
cmovl eax, edx
add r11, 4
cmp r11, rbx
jnz short loc_1410
loc_1421:
mov rdx, [rbp+var_18]
sub rdx, fs:28h
jnz short loc_144B
lea rsp, [rbp-10h]
pop rbx
pop r12
pop rbp
retn
loc_1439:
or [rsp+rdx+1020h+var_1028], 0
jmp loc_137B
loc_1444:
mov eax, 1
jmp short loc_1421
loc_144B:
call ___stack_chk_fail | long long func0(long long a1, int a2)
{
long long v3; // rdx
_DWORD *v4; // rcx
__int16 v5; // dx
signed long long v6; // rdx
void *v7; // rsp
long long v8; // r12
_DWORD *v9; // r11
_DWORD *v10; // rax
_DWORD *v11; // rbx
long long i; // rdi
int v13; // esi
long long v14; // r10
long long j; // rax
long long v16; // rdx
int v17; // edx
int v18; // edx
long long result; // rax
_DWORD v21[1022]; // [rsp+8h] [rbp-1020h] BYREF
_QWORD v22[4]; // [rsp+1008h] [rbp-20h] BYREF
v22[1] = __readfsqword(0x28u);
v3 = 4LL * a2 + 15;
v4 = (_DWORD *)((char *)v22 - (v3 & 0xFFFFFFFFFFFFF000LL));
v5 = v3 & 0xFFF0;
if ( v22 != (_QWORD *)v4 )
{
while ( v21 != v4 )
;
}
v6 = v5 & 0xFFF;
v7 = alloca(v6);
if ( v6 )
*(_QWORD *)((char *)&v21[-2] + v6) = *(_QWORD *)((char *)&v21[-2] + v6);
if ( a2 <= 0 )
return 1LL;
v8 = (unsigned int)a2;
v9 = v21;
v10 = v21;
v11 = &v21[a2];
do
*v10++ = 1;
while ( v10 != v11 );
for ( i = 0LL; i != v8; ++i )
{
if ( i )
{
v13 = *(_DWORD *)(a1 + 4 * i);
v14 = (unsigned int)(i - 1);
for ( j = 0LL; ; j = v16 )
{
v17 = *(_DWORD *)(a1 + 4 * j);
if ( (v13 == v17 + 1 || v13 == v17 - 1) && (v18 = v21[j], v18 >= v21[i]) )
{
v21[i] = v18 + 1;
v16 = j + 1;
if ( v14 == j )
break;
}
else
{
v16 = j + 1;
if ( v14 == j )
break;
}
}
}
}
result = 1LL;
do
{
if ( (int)result < *v9 )
result = (unsigned int)*v9;
++v9;
}
while ( v9 != v11 );
return result;
} | func0:
ENDBR64
PUSH RBP
MOV R9,RDI
MOV RBP,RSP
PUSH R12
PUSH RBX
SUB RSP,0x10
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x18],RAX
XOR EAX,EAX
MOVSXD RAX,ESI
MOV RCX,RSP
LEA RAX,[0xf + RAX*0x4]
MOV RDX,RAX
AND RAX,-0x1000
SUB RCX,RAX
AND RDX,-0x10
CMP RSP,RCX
JZ 0x00101369
LAB_00101354:
SUB RSP,0x1000
OR qword ptr [RSP + 0xff8],0x0
CMP RSP,RCX
JNZ 0x00101354
LAB_00101369:
AND EDX,0xfff
SUB RSP,RDX
TEST RDX,RDX
JNZ 0x00101439
LAB_0010137b:
MOV R8,RSP
TEST ESI,ESI
JLE 0x00101444
MOV R12D,ESI
MOV R11,R8
MOV RAX,R8
LEA RBX,[R8 + R12*0x4]
NOP dword ptr [RAX + RAX*0x1]
LAB_00101398:
MOV dword ptr [RAX],0x1
ADD RAX,0x4
CMP RAX,RBX
JNZ 0x00101398
XOR EDI,EDI
NOP dword ptr [RAX]
LAB_001013b0:
TEST RDI,RDI
JZ 0x00101400
MOV ESI,dword ptr [R9 + RDI*0x4]
LEA R10D,[RDI + -0x1]
XOR EAX,EAX
JMP 0x001013db
LAB_001013c8:
SUB EDX,0x1
CMP ESI,EDX
JZ 0x001013e6
LAB_001013cf:
LEA RDX,[RAX + 0x1]
CMP R10,RAX
JZ 0x00101400
LAB_001013d8:
MOV RAX,RDX
LAB_001013db:
MOV EDX,dword ptr [R9 + RAX*0x4]
LEA ECX,[RDX + 0x1]
CMP ESI,ECX
JNZ 0x001013c8
LAB_001013e6:
MOV EDX,dword ptr [R8 + RAX*0x4]
CMP EDX,dword ptr [R8 + RDI*0x4]
JL 0x001013cf
ADD EDX,0x1
MOV dword ptr [R8 + RDI*0x4],EDX
LEA RDX,[RAX + 0x1]
CMP R10,RAX
JNZ 0x001013d8
LAB_00101400:
ADD RDI,0x1
CMP RDI,R12
JNZ 0x001013b0
MOV EAX,0x1
NOP
LAB_00101410:
MOV EDX,dword ptr [R11]
CMP EAX,EDX
CMOVL EAX,EDX
ADD R11,0x4
CMP R11,RBX
JNZ 0x00101410
LAB_00101421:
MOV RDX,qword ptr [RBP + -0x18]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x0010144b
LEA RSP,[RBP + -0x10]
POP RBX
POP R12
POP RBP
RET
LAB_00101439:
OR qword ptr [RSP + RDX*0x1 + -0x8],0x0
JMP 0x0010137b
LAB_00101444:
MOV EAX,0x1
JMP 0x00101421
LAB_0010144b:
CALL 0x00101080 | int func0(long param_1,uint param_2)
{
int iVar1;
long lVar2;
int1 *puVar3;
int iVar4;
int *piVar5;
ulong uVar6;
int1 *puVar7;
ulong uVar9;
int *piVar10;
long in_FS_OFFSET;
int1 auStack_28 [8];
long local_20;
int1 *puVar8;
puVar7 = auStack_28;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
uVar9 = (long)(int)param_2 * 4 + 0xf;
puVar8 = auStack_28;
puVar3 = auStack_28;
while (puVar8 != auStack_28 + -(uVar9 & 0xfffffffffffff000)) {
puVar7 = puVar3 + -0x1000;
*(int8 *)(puVar3 + -8) = *(int8 *)(puVar3 + -8);
puVar8 = puVar3 + -0x1000;
puVar3 = puVar3 + -0x1000;
}
uVar9 = (ulong)((uint)uVar9 & 0xff0);
lVar2 = -uVar9;
piVar5 = (int *)(puVar7 + lVar2);
piVar10 = (int *)(puVar7 + lVar2);
if (uVar9 != 0) {
*(int8 *)(puVar7 + -8) = *(int8 *)(puVar7 + -8);
}
if ((int)param_2 < 1) {
iVar4 = 1;
}
else {
do {
*piVar5 = 1;
piVar5 = piVar5 + 1;
} while (piVar5 != (int *)(puVar7 + (ulong)param_2 * 4 + lVar2));
uVar9 = 0;
do {
if (uVar9 != 0) {
iVar4 = *(int *)(param_1 + uVar9 * 4);
uVar6 = 0;
while( true ) {
iVar1 = *(int *)(param_1 + uVar6 * 4);
if (((iVar4 == iVar1 + 1) || (iVar4 == iVar1 + -1)) &&
(*(int *)(puVar7 + uVar9 * 4 + lVar2) <= *(int *)(puVar7 + uVar6 * 4 + lVar2))) {
*(int *)(puVar7 + uVar9 * 4 + lVar2) = *(int *)(puVar7 + uVar6 * 4 + lVar2) + 1;
}
if ((int)uVar9 - 1 == uVar6) break;
uVar6 = uVar6 + 1;
}
}
uVar9 = uVar9 + 1;
} while (uVar9 != param_2);
iVar4 = 1;
do {
if (iVar4 < *piVar10) {
iVar4 = *piVar10;
}
piVar10 = piVar10 + 1;
} while (piVar10 != (int *)(puVar7 + (ulong)param_2 * 4 + lVar2));
}
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return iVar4;
}
/* WARNING: Subroutine does not return */
*(code **)(puVar7 + lVar2 + -8) = _fini;
__stack_chk_fail();
} |
4,491 | func0 |
#include <assert.h>
#include <stdio.h>
| int func0(int arr[], int n) {
int dp[n];
for (int i = 0; i < n; i++) {
dp[i] = 1;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
if (arr[i] == arr[j] + 1 || arr[i] == arr[j] - 1) {
if (dp[i] < dp[j] + 1) {
dp[i] = dp[j] + 1;
}
}
}
}
int result = 1;
for (int i = 0; i < n; i++) {
if (result < dp[i]) {
result = dp[i];
}
}
return result;
}
| int main() {
assert(func0((int[]){1, 2, 3, 4, 5, 3, 2}, 7) == 6);
assert(func0((int[]){10, 9, 4, 5, 4, 8, 6}, 7) == 3);
assert(func0((int[]){1, 2, 3, 2, 3, 7, 2, 1}, 8) == 7);
printf("All tests passed!\n");
return 0;
}
| O3 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
sub $0x18,%rsp
mov %fs:0x28,%rax
mov %rax,-0x18(%rbp)
xor %eax,%eax
movslq %esi,%rax
mov %rsp,%rbx
lea 0xf(,%rax,4),%rax
mov %rax,%rdx
and $0xfffffffffffff000,%rax
sub %rax,%rbx
and $0xfffffffffffffff0,%rdx
mov %rbx,%rax
cmp %rax,%rsp
je 1327 <func0+0x57>
sub $0x1000,%rsp
orq $0x0,0xff8(%rsp)
cmp %rax,%rsp
jne 1312 <func0+0x42>
and $0xfff,%edx
sub %rdx,%rsp
test %rdx,%rdx
jne 14f5 <func0+0x225>
lea 0x3(%rsp),%r10
mov %r10,%r11
and $0xfffffffffffffffc,%r10
shr $0x2,%r11
test %esi,%esi
jle 1520 <func0+0x250>
lea -0x1(%rsi),%ebx
cmp $0x2,%ebx
jbe 1527 <func0+0x257>
mov %esi,%edx
movdqa 0xd89(%rip),%xmm0
mov %r10,%rax
shr $0x2,%edx
shl $0x4,%rdx
add %r10,%rdx
nopl 0x0(%rax)
movups %xmm0,(%rax)
add $0x10,%rax
cmp %rdx,%rax
jne 1378 <func0+0xa8>
mov %esi,%eax
and $0xfffffffc,%eax
test $0x3,%sil
je 13bd <func0+0xed>
movslq %eax,%rdx
movl $0x1,(%r10,%rdx,4)
lea 0x1(%rax),%edx
cmp %edx,%esi
jle 13bd <func0+0xed>
movslq %edx,%rdx
add $0x2,%eax
movl $0x1,(%r10,%rdx,4)
cmp %eax,%esi
jle 13bd <func0+0xed>
cltq
movl $0x1,(%r10,%rax,4)
mov $0x1,%ecx
cmp $0x1,%esi
je 1500 <func0+0x230>
nopl 0x0(%rax,%rax,1)
mov (%rdi,%rcx,4),%r9d
xor %eax,%eax
jmp 13f0 <func0+0x120>
nopl 0x0(%rax,%rax,1)
sub $0x1,%edx
cmp %edx,%r9d
je 13fc <func0+0x12c>
add $0x1,%rax
cmp %ecx,%eax
jge 1415 <func0+0x145>
mov (%rdi,%rax,4),%edx
lea 0x1(%rdx),%r8d
cmp %r9d,%r8d
jne 13e0 <func0+0x110>
mov (%r10,%rax,4),%edx
cmp (%r10,%rcx,4),%edx
jl 13e8 <func0+0x118>
add $0x1,%edx
add $0x1,%rax
mov %edx,(%r10,%rcx,4)
cmp %ecx,%eax
jl 13f0 <func0+0x120>
add $0x1,%rcx
cmp %ecx,%esi
jg 13d0 <func0+0x100>
cmp $0x2,%ebx
jbe 152e <func0+0x25e>
mov %esi,%edx
movdqa 0xcc0(%rip),%xmm2
mov %r10,%rax
shr $0x2,%edx
shl $0x4,%rdx
add %r10,%rdx
nopl (%rax)
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 1440 <func0+0x170>
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 14e0 <func0+0x210>
movslq %edx,%rcx
mov (%r10,%rcx,4),%ecx
cmp %ecx,%eax
cmovl %ecx,%eax
add $0x1,%edx
cmp %edx,%esi
jle 14e0 <func0+0x210>
movslq %edx,%rcx
mov (%r10,%rcx,4),%ecx
cmp %ecx,%eax
cmovl %ecx,%eax
add $0x1,%edx
cmp %esi,%edx
jge 14e0 <func0+0x210>
movslq %edx,%rdx
mov (%r10,%rdx,4),%edx
cmp %edx,%eax
cmovl %edx,%eax
mov -0x18(%rbp),%rbx
xor %fs:0x28,%rbx
jne 1550 <func0+0x280>
mov -0x8(%rbp),%rbx
leaveq
retq
orq $0x0,-0x8(%rsp,%rdx,1)
jmpq 1339 <func0+0x69>
cmp $0x2,%ebx
ja 1426 <func0+0x156>
mov 0x0(,%r11,4),%eax
test %eax,%eax
mov %esi,%eax
cmovg 0x0(,%r11,4),%eax
jmp 14e0 <func0+0x210>
mov $0x1,%eax
jmp 14e0 <func0+0x210>
xor %eax,%eax
jmpq 138f <func0+0xbf>
mov 0x0(,%r11,4),%edx
mov $0x1,%eax
test %edx,%edx
mov $0x1,%edx
cmovg 0x0(,%r11,4),%eax
jmpq 14c1 <func0+0x1f1>
callq 1080 <__stack_chk_fail@plt>
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
push rbp
mov r10, rdi
mov r9d, esi
mov rbp, rsp
push r13
push r12
push rbx
sub rsp, 18h
mov rax, fs:28h
mov [rbp+var_28], rax
xor eax, eax
movsxd rax, esi
mov rcx, rsp
lea rax, ds:0Fh[rax*4]
mov rdx, rax
and rax, 0FFFFFFFFFFFFF000h
sub rcx, rax
and rdx, 0FFFFFFFFFFFFFFF0h
cmp rsp, rcx
jz short loc_132E
loc_1319:
sub rsp, 1000h
or [rsp+1030h+var_38], 0
cmp rsp, rcx
jnz short loc_1319
loc_132E:
and edx, 0FFFh
sub rsp, rdx
test rdx, rdx
jnz loc_151A
loc_1340:
lea rsi, [rsp+1030h+var_102D]
mov r13, rsi
and rsi, 0FFFFFFFFFFFFFFFCh
shr r13, 2
mov r11, rsi
test r9d, r9d
jle loc_1540
lea ebx, [r9-1]
cmp ebx, 2
jbe loc_1525
mov edx, r9d
movdqa xmm0, cs:xmmword_20D0
mov rax, rsi
shr edx, 2
shl rdx, 4
lea rcx, [rsi+rdx]
and edx, 10h
jz short loc_1398
lea rax, [rsi+10h]
movups xmmword ptr [rsi], xmm0
cmp rax, rcx
jz short loc_13A8
nop dword ptr [rax+rax+00h]
loc_1398:
movups xmmword ptr [rax], xmm0
add rax, 20h ; ' '
movups xmmword ptr [rax-10h], xmm0
cmp rax, rcx
jnz short loc_1398
loc_13A8:
mov eax, r9d
and eax, 0FFFFFFFCh
test r9b, 3
jz short loc_13DE
mov edx, eax
lea ecx, [rax+1]
lea rdx, [rsi+rdx*4]
mov dword ptr [rdx], 1
cmp r9d, ecx
jle short loc_13DE
loc_13C8:
add eax, 2
mov dword ptr [rdx+4], 1
cmp r9d, eax
jle short loc_13DE
mov dword ptr [rdx+8], 1
loc_13DE:
mov r12d, r9d
mov ecx, 1
nop word ptr [rax+rax+00000000h]
loc_13F0:
mov r8d, [r10+rcx*4]
xor eax, eax
jmp short loc_1410
loc_1400:
sub edx, 1
cmp r8d, edx
jz short loc_141C
loc_1408:
add rax, 1
cmp eax, ecx
jge short loc_1432
loc_1410:
mov edx, [r10+rax*4]
lea edi, [rdx+1]
cmp edi, r8d
jnz short loc_1400
loc_141C:
mov edx, [rsi+rax*4]
cmp [rsi+rcx*4], edx
jg short loc_1408
add edx, 1
add rax, 1
mov [rsi+rcx*4], edx
cmp eax, ecx
jl short loc_1410
loc_1432:
add rcx, 1
cmp rcx, r12
jnz short loc_13F0
cmp ebx, 2
jbe loc_1547
mov edx, r9d
movdqa xmm2, cs:xmmword_20D0
mov rax, rsi
shr edx, 2
shl rdx, 4
add rdx, rsi
nop dword ptr [rax+00h]
loc_1460:
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_1460
movdqa xmm0, xmm2
mov edx, r9d
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 r9b, 3
jz short loc_1500
movsxd rcx, edx
lea r11, [rsi+rcx*4]
mov ecx, [r11]
cmp eax, ecx
cmovl eax, ecx
lea ecx, [rdx+1]
cmp r9d, ecx
jle short loc_1500
loc_14E6:
mov ecx, [r11+4]
cmp eax, ecx
cmovl eax, ecx
add edx, 2
cmp r9d, edx
jle short loc_1500
mov edx, [r11+8]
cmp eax, edx
cmovl eax, edx
loc_1500:
mov rdx, [rbp+var_28]
sub rdx, fs:28h
jnz short loc_155D
lea rsp, [rbp-18h]
pop rbx
pop r12
pop r13
pop rbp
retn
loc_151A:
or [rsp+rdx+1030h+var_1038], 0
jmp loc_1340
loc_1525:
mov ds:dword_0[r13*4], 1
mov rdx, rsi
xor eax, eax
cmp r9d, 1
jnz loc_13C8
loc_1540:
mov eax, 1
jmp short loc_1500
loc_1547:
mov eax, ds:dword_0[r13*4]
mov edx, 1
test eax, eax
cmovle eax, edx
xor edx, edx
jmp short loc_14E6
loc_155D:
call ___stack_chk_fail | long long func0(long long a1, int a2)
{
long long v2; // rdx
__m128i *v3; // rcx
__int16 v4; // dx
signed long long v5; // rdx
void *v6; // rsp
int *v7; // r11
__m128i si128; // xmm0
__m128i *v9; // rax
long long v10; // rdx
__m128i *v11; // rcx
int v12; // eax
__m128i *v13; // rdx
long long v14; // rcx
int v15; // r8d
long long v16; // rax
int v17; // edx
__int32 v18; // edx
__m128i v19; // xmm2
const __m128i *v20; // rax
__m128i v21; // xmm0
__m128i v22; // xmm1
__m128i v23; // xmm0
unsigned int v24; // edx
__m128i v25; // xmm1
__m128i v26; // xmm1
__m128i v27; // xmm2
__m128i v28; // xmm0
long long result; // rax
int v30; // ecx
int v31; // edx
long long v32; // [rsp+0h] [rbp-1038h]
__m128i v33; // [rsp+8h] [rbp-1030h] BYREF
_BYTE v34[4072]; // [rsp+18h] [rbp-1020h] BYREF
_QWORD v35[6]; // [rsp+1008h] [rbp-30h] BYREF
v35[1] = __readfsqword(0x28u);
v2 = 4LL * a2 + 15;
v3 = (__m128i *)((char *)v35 - (v2 & 0xFFFFFFFFFFFFF000LL));
v4 = v2 & 0xFFF0;
if ( v35 != (_QWORD *)v3 )
{
while ( &v33 != v3 )
;
}
v5 = v4 & 0xFFF;
v6 = alloca(v5);
if ( v5 )
*(long long *)((char *)&v32 + v5) = *(long long *)((char *)&v32 + v5);
v7 = (int *)&v33;
if ( a2 <= 0 )
return 1LL;
if ( (unsigned int)(a2 - 1) > 2 )
{
si128 = _mm_load_si128((const __m128i *)&xmmword_20D0);
v9 = &v33;
v10 = 16LL * ((unsigned int)a2 >> 2);
v11 = (__m128i *)((char *)&v33 + v10);
if ( (v10 & 0x10) == 0 || (v9 = (__m128i *)v34, v33 = si128, v34 != (_BYTE *)v11) )
{
do
{
*v9 = si128;
v9 += 2;
v9[-1] = si128;
}
while ( v9 != v11 );
}
v12 = a2 & 0x7FFFFFFC;
if ( (a2 & 3) == 0 )
goto LABEL_14;
v13 = (__m128i *)((char *)&v33 + 4 * (unsigned int)v12);
v13->m128i_i32[0] = 1;
if ( a2 <= v12 + 1 )
goto LABEL_14;
goto LABEL_12;
}
v33.m128i_i32[0] = 1;
v13 = &v33;
v12 = 0;
if ( a2 == 1 )
return 1LL;
LABEL_12:
v13->m128i_i32[1] = 1;
if ( a2 > v12 + 2 )
v13->m128i_i32[2] = 1;
LABEL_14:
v14 = 1LL;
do
{
v15 = *(_DWORD *)(a1 + 4 * v14);
v16 = 0LL;
do
{
while ( 1 )
{
v17 = *(_DWORD *)(a1 + 4 * v16);
if ( v17 + 1 == v15 || v15 == v17 - 1 )
{
v18 = v33.m128i_i32[v16];
if ( v33.m128i_i32[v14] <= v18 )
break;
}
if ( (int)++v16 >= (int)v14 )
goto LABEL_21;
}
++v16;
v33.m128i_i32[v14] = v18 + 1;
}
while ( (int)v16 < (int)v14 );
LABEL_21:
++v14;
}
while ( v14 != a2 );
if ( (unsigned int)(a2 - 1) <= 2 )
{
result = v33.m128i_u32[0];
if ( v33.m128i_i32[0] <= 0 )
result = 1LL;
v24 = 0;
goto LABEL_29;
}
v19 = _mm_load_si128((const __m128i *)&xmmword_20D0);
v20 = &v33;
do
{
v21 = _mm_loadu_si128(v20++);
v22 = _mm_cmpgt_epi32(v21, v19);
v19 = _mm_or_si128(_mm_andnot_si128(v22, v19), _mm_and_si128(v21, v22));
}
while ( v20 != &v33 + ((unsigned int)a2 >> 2) );
v23 = _mm_srli_si128(v19, 8);
v24 = a2 & 0xFFFFFFFC;
v25 = _mm_cmpgt_epi32(v23, v19);
v26 = _mm_or_si128(_mm_andnot_si128(v25, v19), _mm_and_si128(v23, v25));
v27 = _mm_srli_si128(v26, 4);
v28 = _mm_cmpgt_epi32(v27, v26);
result = (unsigned int)_mm_cvtsi128_si32(_mm_or_si128(_mm_andnot_si128(v28, v26), _mm_and_si128(v27, v28)));
if ( (a2 & 3) != 0 )
{
v7 = &v33.m128i_i32[v24];
if ( (int)result < *v7 )
result = (unsigned int)*v7;
if ( a2 > (int)(v24 + 1) )
{
LABEL_29:
v30 = v7[1];
if ( (int)result < v30 )
result = (unsigned int)v30;
if ( a2 > (int)(v24 + 2) )
{
v31 = v7[2];
if ( (int)result < v31 )
return (unsigned int)v31;
}
}
}
return result;
} | func0:
ENDBR64
PUSH RBP
MOV R10,RDI
MOV R9D,ESI
MOV RBP,RSP
PUSH R13
PUSH R12
PUSH RBX
SUB RSP,0x18
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x28],RAX
XOR EAX,EAX
MOVSXD RAX,ESI
MOV RCX,RSP
LEA RAX,[0xf + RAX*0x4]
MOV RDX,RAX
AND RAX,-0x1000
SUB RCX,RAX
AND RDX,-0x10
CMP RSP,RCX
JZ 0x0010132e
LAB_00101319:
SUB RSP,0x1000
OR qword ptr [RSP + 0xff8],0x0
CMP RSP,RCX
JNZ 0x00101319
LAB_0010132e:
AND EDX,0xfff
SUB RSP,RDX
TEST RDX,RDX
JNZ 0x0010151a
LAB_00101340:
LEA RSI,[RSP + 0x3]
MOV R13,RSI
AND RSI,-0x4
SHR R13,0x2
MOV R11,RSI
TEST R9D,R9D
JLE 0x00101540
LEA EBX,[R9 + -0x1]
CMP EBX,0x2
JBE 0x00101525
MOV EDX,R9D
MOVDQA XMM0,xmmword ptr [0x001020d0]
MOV RAX,RSI
SHR EDX,0x2
SHL RDX,0x4
LEA RCX,[RSI + RDX*0x1]
AND EDX,0x10
JZ 0x00101398
LEA RAX,[RSI + 0x10]
MOVUPS xmmword ptr [RSI],XMM0
CMP RAX,RCX
JZ 0x001013a8
NOP dword ptr [RAX + RAX*0x1]
LAB_00101398:
MOVUPS xmmword ptr [RAX],XMM0
ADD RAX,0x20
MOVUPS xmmword ptr [RAX + -0x10],XMM0
CMP RAX,RCX
JNZ 0x00101398
LAB_001013a8:
MOV EAX,R9D
AND EAX,0xfffffffc
TEST R9B,0x3
JZ 0x001013de
MOV EDX,EAX
LEA ECX,[RAX + 0x1]
LEA RDX,[RSI + RDX*0x4]
MOV dword ptr [RDX],0x1
CMP R9D,ECX
JLE 0x001013de
LAB_001013c8:
ADD EAX,0x2
MOV dword ptr [RDX + 0x4],0x1
CMP R9D,EAX
JLE 0x001013de
MOV dword ptr [RDX + 0x8],0x1
LAB_001013de:
MOV R12D,R9D
MOV ECX,0x1
NOP word ptr CS:[RAX + RAX*0x1]
LAB_001013f0:
MOV R8D,dword ptr [R10 + RCX*0x4]
XOR EAX,EAX
JMP 0x00101410
LAB_00101400:
SUB EDX,0x1
CMP R8D,EDX
JZ 0x0010141c
LAB_00101408:
ADD RAX,0x1
CMP EAX,ECX
JGE 0x00101432
LAB_00101410:
MOV EDX,dword ptr [R10 + RAX*0x4]
LEA EDI,[RDX + 0x1]
CMP EDI,R8D
JNZ 0x00101400
LAB_0010141c:
MOV EDX,dword ptr [RSI + RAX*0x4]
CMP dword ptr [RSI + RCX*0x4],EDX
JG 0x00101408
ADD EDX,0x1
ADD RAX,0x1
MOV dword ptr [RSI + RCX*0x4],EDX
CMP EAX,ECX
JL 0x00101410
LAB_00101432:
ADD RCX,0x1
CMP RCX,R12
JNZ 0x001013f0
CMP EBX,0x2
JBE 0x00101547
MOV EDX,R9D
MOVDQA XMM2,xmmword ptr [0x001020d0]
MOV RAX,RSI
SHR EDX,0x2
SHL RDX,0x4
ADD RDX,RSI
NOP dword ptr [RAX]
LAB_00101460:
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 0x00101460
MOVDQA XMM0,XMM2
MOV EDX,R9D
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 R9B,0x3
JZ 0x00101500
MOVSXD RCX,EDX
LEA R11,[RSI + RCX*0x4]
MOV ECX,dword ptr [R11]
CMP EAX,ECX
CMOVL EAX,ECX
LEA ECX,[RDX + 0x1]
CMP R9D,ECX
JLE 0x00101500
LAB_001014e6:
MOV ECX,dword ptr [R11 + 0x4]
CMP EAX,ECX
CMOVL EAX,ECX
ADD EDX,0x2
CMP R9D,EDX
JLE 0x00101500
MOV EDX,dword ptr [R11 + 0x8]
CMP EAX,EDX
CMOVL EAX,EDX
LAB_00101500:
MOV RDX,qword ptr [RBP + -0x28]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x0010155d
LEA RSP,[RBP + -0x18]
POP RBX
POP R12
POP R13
POP RBP
RET
LAB_0010151a:
OR qword ptr [RSP + RDX*0x1 + -0x8],0x0
JMP 0x00101340
LAB_00101525:
MOV dword ptr [R13*0x4],0x1
MOV RDX,RSI
XOR EAX,EAX
CMP R9D,0x1
JNZ 0x001013c8
LAB_00101540:
MOV EAX,0x1
JMP 0x00101500
LAB_00101547:
MOV EAX,dword ptr [R13*0x4]
MOV EDX,0x1
TEST EAX,EAX
CMOVLE EAX,EDX
XOR EDX,EDX
JMP 0x001014e6
LAB_0010155d:
CALL 0x00101080 | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
uint func0(long param_1,uint param_2)
{
long lVar1;
int iVar2;
int iVar3;
long lVar4;
uint *puVar5;
uint *puVar6;
int8 uVar7;
int8 uVar8;
int *puVar9;
uint uVar10;
int8 *puVar11;
long lVar12;
uint *puVar13;
uint uVar14;
ulong uVar15;
int4 *puVar16;
int *puVar17;
uint *puVar19;
long in_FS_OFFSET;
uint uVar20;
uint uVar21;
uint uVar22;
uint uVar23;
uint uVar24;
uint uVar25;
uint uVar26;
int auStack_38 [8];
long local_30;
int *puVar18;
puVar17 = auStack_38;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
uVar15 = (long)(int)param_2 * 4 + 0xf;
puVar18 = auStack_38;
puVar9 = auStack_38;
while (puVar18 != auStack_38 + -(uVar15 & 0xfffffffffffff000)) {
puVar17 = puVar9 + -0x1000;
*(int8 *)(puVar9 + -8) = *(int8 *)(puVar9 + -8);
puVar18 = puVar9 + -0x1000;
puVar9 = puVar9 + -0x1000;
}
uVar15 = (ulong)((uint)uVar15 & 0xff0);
lVar4 = -uVar15;
puVar11 = (int8 *)(puVar17 + lVar4);
puVar16 = (int4 *)(puVar17 + lVar4);
puVar13 = (uint *)(puVar17 + lVar4);
puVar19 = (uint *)(puVar17 + lVar4);
if (uVar15 != 0) {
*(int8 *)(puVar17 + -8) = *(int8 *)(puVar17 + -8);
}
if ((int)param_2 < 1) {
LAB_00101540:
uVar10 = 1;
goto LAB_00101500;
}
if (param_2 - 1 < 3) {
*(int4 *)(((ulong)(puVar17 + lVar4 + 3) >> 2) * 4) = 1;
uVar10 = 0;
if (param_2 == 1) goto LAB_00101540;
LAB_001013c8:
puVar16[1] = 1;
if ((int)(uVar10 + 2) < (int)param_2) {
puVar16[2] = 1;
}
}
else {
uVar7 = CONCAT44(_UNK_001020d4,_DAT_001020d0);
uVar8 = CONCAT44(_UNK_001020dc,_UNK_001020d8);
uVar15 = (ulong)(param_2 >> 2) * 0x10;
if ((uVar15 & 0x10) == 0) goto LAB_00101398;
*(int8 *)(puVar17 + lVar4) = uVar7;
*(int8 *)(puVar17 + lVar4 + 8) = uVar8;
for (puVar11 = (int8 *)(puVar17 + lVar4 + 0x10);
puVar11 != (int8 *)(puVar17 + uVar15 + lVar4); puVar11 = puVar11 + 4) {
LAB_00101398:
*puVar11 = uVar7;
puVar11[1] = uVar8;
puVar11[2] = uVar7;
puVar11[3] = uVar8;
}
uVar10 = param_2 & 0xfffffffc;
if ((param_2 & 3) != 0) {
puVar16 = (int4 *)(puVar17 + (ulong)uVar10 * 4 + lVar4);
*puVar16 = 1;
if ((int)(uVar10 + 1) < (int)param_2) goto LAB_001013c8;
}
}
uVar15 = 1;
do {
iVar2 = *(int *)(param_1 + uVar15 * 4);
lVar12 = 0;
do {
while( true ) {
iVar3 = *(int *)(param_1 + lVar12 * 4);
if (((iVar3 + 1 != iVar2) && (iVar2 != iVar3 + -1)) ||
(lVar1 = lVar12 * 4,
*(int *)(puVar17 + lVar1 + lVar4) < *(int *)(puVar17 + uVar15 * 4 + lVar4))) break;
lVar12 = lVar12 + 1;
*(int *)(puVar17 + uVar15 * 4 + lVar4) = *(int *)(puVar17 + lVar1 + lVar4) + 1;
if ((int)uVar15 <= (int)lVar12) goto LAB_00101432;
}
lVar12 = lVar12 + 1;
} while ((int)lVar12 < (int)uVar15);
LAB_00101432:
uVar15 = uVar15 + 1;
} while (uVar15 != param_2);
if (param_2 - 1 < 3) {
uVar10 = *(uint *)(((ulong)(puVar17 + lVar4 + 3) >> 2) * 4);
if ((int)uVar10 < 1) {
uVar10 = 1;
}
uVar14 = 0;
}
else {
uVar10 = _DAT_001020d0;
uVar24 = _UNK_001020d4;
uVar25 = _UNK_001020d8;
uVar26 = _UNK_001020dc;
do {
uVar14 = *puVar13;
puVar19 = puVar13 + 1;
puVar5 = puVar13 + 2;
puVar6 = puVar13 + 3;
puVar13 = puVar13 + 4;
uVar20 = -(uint)((int)uVar10 < (int)uVar14);
uVar21 = -(uint)((int)uVar24 < (int)*puVar19);
uVar22 = -(uint)((int)uVar25 < (int)*puVar5);
uVar23 = -(uint)((int)uVar26 < (int)*puVar6);
uVar10 = ~uVar20 & uVar10 | uVar14 & uVar20;
uVar24 = ~uVar21 & uVar24 | *puVar19 & uVar21;
uVar25 = ~uVar22 & uVar25 | *puVar5 & uVar22;
uVar26 = ~uVar23 & uVar26 | *puVar6 & uVar23;
} while (puVar13 != (uint *)(puVar17 + (ulong)(param_2 >> 2) * 0x10 + lVar4));
uVar14 = param_2 & 0xfffffffc;
uVar25 = ~-(uint)((int)uVar10 < (int)uVar25) & uVar10 |
uVar25 & -(uint)((int)uVar10 < (int)uVar25);
uVar24 = ~-(uint)((int)uVar24 < (int)uVar26) & uVar24 |
uVar26 & -(uint)((int)uVar24 < (int)uVar26);
uVar10 = -(uint)((int)uVar25 < (int)uVar24);
uVar10 = ~uVar10 & uVar25 | uVar24 & uVar10;
if ((param_2 & 3) == 0) goto LAB_00101500;
puVar19 = (uint *)(puVar17 + (long)(int)uVar14 * 4 + lVar4);
if ((int)uVar10 < (int)*puVar19) {
uVar10 = *puVar19;
}
if ((int)param_2 <= (int)(uVar14 + 1)) goto LAB_00101500;
}
if ((int)uVar10 < (int)puVar19[1]) {
uVar10 = puVar19[1];
}
if (((int)(uVar14 + 2) < (int)param_2) && ((int)uVar10 < (int)puVar19[2])) {
uVar10 = puVar19[2];
}
LAB_00101500:
if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
*(int8 *)(puVar17 + lVar4 + -8) = 0x101562;
__stack_chk_fail();
}
return uVar10;
} |
4,492 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int a, int b, int c) {
if (a == b) {
return true;
}
if ((b - a) * c > 0 && (b - a) % c == 0) {
return true;
}
return false;
}
| int main() {
assert(func0(1, 7, 3) == true);
assert(func0(1, -3, 5) == false);
assert(func0(3, 2, 5) == false);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %edi,-0x4(%rbp)
mov %esi,-0x8(%rbp)
mov %edx,-0xc(%rbp)
mov -0x4(%rbp),%eax
cmp -0x8(%rbp),%eax
jne 1169 <func0+0x20>
mov $0x1,%eax
jmp 1193 <func0+0x4a>
mov -0x8(%rbp),%eax
sub -0x4(%rbp),%eax
imul -0xc(%rbp),%eax
test %eax,%eax
jle 118e <func0+0x45>
mov -0x8(%rbp),%eax
sub -0x4(%rbp),%eax
cltd
idivl -0xc(%rbp)
mov %edx,%eax
test %eax,%eax
jne 118e <func0+0x45>
mov $0x1,%eax
jmp 1193 <func0+0x4a>
mov $0x0,%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_4], edi
mov [rbp+var_8], esi
mov [rbp+var_C], edx
mov eax, [rbp+var_4]
cmp eax, [rbp+var_8]
jnz short loc_1169
mov eax, 1
jmp short loc_1193
loc_1169:
mov eax, [rbp+var_8]
sub eax, [rbp+var_4]
imul eax, [rbp+var_C]
test eax, eax
jle short loc_118E
mov eax, [rbp+var_8]
sub eax, [rbp+var_4]
cdq
idiv [rbp+var_C]
mov eax, edx
test eax, eax
jnz short loc_118E
mov eax, 1
jmp short loc_1193
loc_118E:
mov eax, 0
loc_1193:
pop rbp
retn | _BOOL8 func0(int a1, int a2, int a3)
{
if ( a1 == a2 )
return 1LL;
return a3 * (a2 - a1) > 0 && !((a2 - a1) % a3);
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV dword ptr [RBP + -0x4],EDI
MOV dword ptr [RBP + -0x8],ESI
MOV dword ptr [RBP + -0xc],EDX
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x8]
JNZ 0x00101169
MOV EAX,0x1
JMP 0x00101193
LAB_00101169:
MOV EAX,dword ptr [RBP + -0x8]
SUB EAX,dword ptr [RBP + -0x4]
IMUL EAX,dword ptr [RBP + -0xc]
TEST EAX,EAX
JLE 0x0010118e
MOV EAX,dword ptr [RBP + -0x8]
SUB EAX,dword ptr [RBP + -0x4]
CDQ
IDIV dword ptr [RBP + -0xc]
MOV EAX,EDX
TEST EAX,EAX
JNZ 0x0010118e
MOV EAX,0x1
JMP 0x00101193
LAB_0010118e:
MOV EAX,0x0
LAB_00101193:
POP RBP
RET | int8 func0(int param_1,int param_2,int param_3)
{
int8 uVar1;
if (param_1 == param_2) {
uVar1 = 1;
}
else if (((param_2 - param_1) * param_3 < 1) || ((param_2 - param_1) % param_3 != 0)) {
uVar1 = 0;
}
else {
uVar1 = 1;
}
return uVar1;
} |
4,493 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int a, int b, int c) {
if (a == b) {
return true;
}
if ((b - a) * c > 0 && (b - a) % c == 0) {
return true;
}
return false;
}
| int main() {
assert(func0(1, 7, 3) == true);
assert(func0(1, -3, 5) == false);
assert(func0(3, 2, 5) == false);
return 0;
}
| O1 | c | func0:
endbr64
mov %esi,%eax
mov %edx,%ecx
mov $0x1,%edx
cmp %esi,%edi
je 1152 <func0+0x29>
sub %edi,%eax
mov %eax,%esi
imul %ecx,%esi
mov $0x0,%edx
test %esi,%esi
jle 1152 <func0+0x29>
cltd
idiv %ecx
test %edx,%edx
sete %dl
mov %edx,%eax
retq
| func0:
endbr64
mov eax, esi
mov ecx, edx
mov edx, 1
cmp edi, esi
jz short loc_1152
sub eax, edi
mov esi, eax
imul esi, ecx
mov edx, 0
test esi, esi
jle short loc_1152
cdq
idiv ecx
test edx, edx
setz dl
loc_1152:
mov eax, edx
retn | long long func0(int a1, int a2, int a3)
{
unsigned int v4; // edx
int v5; // eax
v4 = 1;
if ( a1 != a2 )
{
v5 = a2 - a1;
v4 = 0;
if ( a3 * (a2 - a1) > 0 )
{
v4 = v5 % a3;
LOBYTE(v4) = v5 % a3 == 0;
}
}
return v4;
} | func0:
ENDBR64
MOV EAX,ESI
MOV ECX,EDX
MOV EDX,0x1
CMP EDI,ESI
JZ 0x00101152
SUB EAX,EDI
MOV ESI,EAX
IMUL ESI,ECX
MOV EDX,0x0
TEST ESI,ESI
JLE 0x00101152
CDQ
IDIV ECX
TEST EDX,EDX
SETZ DL
LAB_00101152:
MOV EAX,EDX
RET | ulong func0(int param_1,int param_2,int param_3)
{
long lVar1;
ulong uVar2;
uVar2 = 1;
if (param_1 != param_2) {
uVar2 = 0;
if (0 < (param_2 - param_1) * param_3) {
lVar1 = (long)(param_2 - param_1) % (long)param_3;
uVar2 = CONCAT71((int7)((ulong)lVar1 >> 8),(int)lVar1 == 0) & 0xffffffff;
}
}
return uVar2;
} |
4,494 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int a, int b, int c) {
if (a == b) {
return true;
}
if ((b - a) * c > 0 && (b - a) % c == 0) {
return true;
}
return false;
}
| int main() {
assert(func0(1, 7, 3) == true);
assert(func0(1, -3, 5) == false);
assert(func0(3, 2, 5) == false);
return 0;
}
| O2 | c | func0:
endbr64
mov %esi,%eax
mov %edx,%ecx
mov $0x1,%r8d
cmp %esi,%edi
je 1169 <func0+0x29>
sub %edi,%eax
xor %r8d,%r8d
mov %eax,%edx
imul %ecx,%edx
test %edx,%edx
jle 1169 <func0+0x29>
cltd
idiv %ecx
test %edx,%edx
sete %r8b
mov %r8d,%eax
retq
nopl (%rax)
| func0:
endbr64
mov eax, esi
mov ecx, edx
mov r8d, 1
cmp edi, esi
jz short loc_1169
sub eax, edi
xor r8d, r8d
mov edx, eax
imul edx, ecx
test edx, edx
jle short loc_1169
cdq
idiv ecx
test edx, edx
setz r8b
loc_1169:
mov eax, r8d
retn | long long func0(int a1, int a2, int a3)
{
unsigned int v3; // r8d
v3 = 1;
if ( a1 != a2 )
{
v3 = 0;
if ( a3 * (a2 - a1) > 0 )
LOBYTE(v3) = (a2 - a1) % a3 == 0;
}
return v3;
} | func0:
ENDBR64
MOV EAX,ESI
MOV ECX,EDX
MOV R8D,0x1
CMP EDI,ESI
JZ 0x00101169
SUB EAX,EDI
XOR R8D,R8D
MOV EDX,EAX
IMUL EDX,ECX
TEST EDX,EDX
JLE 0x00101169
CDQ
IDIV ECX
TEST EDX,EDX
SETZ R8B
LAB_00101169:
MOV EAX,R8D
RET | bool func0(int param_1,int param_2,int param_3)
{
bool bVar1;
bVar1 = true;
if (param_1 != param_2) {
bVar1 = false;
if (0 < (param_2 - param_1) * param_3) {
bVar1 = (param_2 - param_1) % param_3 == 0;
}
}
return bVar1;
} |
4,495 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int a, int b, int c) {
if (a == b) {
return true;
}
if ((b - a) * c > 0 && (b - a) % c == 0) {
return true;
}
return false;
}
| int main() {
assert(func0(1, 7, 3) == true);
assert(func0(1, -3, 5) == false);
assert(func0(3, 2, 5) == false);
return 0;
}
| O3 | c | func0:
endbr64
mov %esi,%eax
mov %edx,%ecx
mov $0x1,%r8d
cmp %esi,%edi
je 1169 <func0+0x29>
sub %edi,%eax
xor %r8d,%r8d
mov %eax,%edx
imul %ecx,%edx
test %edx,%edx
jle 1169 <func0+0x29>
cltd
idiv %ecx
test %edx,%edx
sete %r8b
mov %r8d,%eax
retq
nopl (%rax)
| func0:
endbr64
mov ecx, edx
mov eax, esi
mov edx, 1
cmp edi, esi
jz short loc_1166
sub eax, edi
xor edx, edx
mov esi, eax
imul esi, ecx
test esi, esi
jle short loc_1166
cdq
idiv ecx
test edx, edx
setz dl
loc_1166:
mov eax, edx
retn | long long func0(int a1, int a2, int a3)
{
unsigned int v4; // edx
int v5; // eax
v4 = 1;
if ( a1 != a2 )
{
v5 = a2 - a1;
v4 = 0;
if ( a3 * (a2 - a1) > 0 )
{
v4 = v5 % a3;
LOBYTE(v4) = v5 % a3 == 0;
}
}
return v4;
} | func0:
ENDBR64
MOV ECX,EDX
MOV EAX,ESI
MOV EDX,0x1
CMP EDI,ESI
JZ 0x00101166
SUB EAX,EDI
XOR EDX,EDX
MOV ESI,EAX
IMUL ESI,ECX
TEST ESI,ESI
JLE 0x00101166
CDQ
IDIV ECX
TEST EDX,EDX
SETZ DL
LAB_00101166:
MOV EAX,EDX
RET | ulong func0(int param_1,int param_2,int param_3)
{
long lVar1;
ulong uVar2;
uVar2 = 1;
if (param_1 != param_2) {
uVar2 = 0;
if (0 < (param_2 - param_1) * param_3) {
lVar1 = (long)(param_2 - param_1) % (long)param_3;
uVar2 = CONCAT71((int7)((ulong)lVar1 >> 8),(int)lVar1 == 0) & 0xffffffff;
}
}
return uVar2;
} |
4,496 | func0 |
#include <assert.h>
int gcd(int p, int q) {
while (q != 0) {
int temp = q;
q = p % q;
p = temp;
}
return p;
}
| int func0(int x, int y) {
return gcd(x, y) == 1;
}
| int main() {
assert(func0(17, 13) == 1);
assert(func0(15, 21) == 0);
assert(func0(25, 45) == 0);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x8,%rsp
mov %edi,-0x4(%rbp)
mov %esi,-0x8(%rbp)
mov -0x8(%rbp),%edx
mov -0x4(%rbp),%eax
mov %edx,%esi
mov %eax,%edi
callq 1149 <gcd>
cmp $0x1,%eax
sete %al
movzbl %al,%eax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 8
mov [rbp+var_4], edi
mov [rbp+var_8], esi
mov edx, [rbp+var_8]
mov eax, [rbp+var_4]
mov esi, edx
mov edi, eax
call gcd
cmp eax, 1
setz al
movzx eax, al
leave
retn | _BOOL8 func0(unsigned int a1, unsigned int a2)
{
return (unsigned int)gcd(a1, a2) == 1;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x8
MOV dword ptr [RBP + -0x4],EDI
MOV dword ptr [RBP + -0x8],ESI
MOV EDX,dword ptr [RBP + -0x8]
MOV EAX,dword ptr [RBP + -0x4]
MOV ESI,EDX
MOV EDI,EAX
CALL 0x00101149
CMP EAX,0x1
SETZ AL
MOVZX EAX,AL
LEAVE
RET | bool func0(int4 param_1,int4 param_2)
{
int iVar1;
iVar1 = gcd(param_1,param_2);
return iVar1 == 1;
} |
4,497 | func0 |
#include <assert.h>
int gcd(int p, int q) {
while (q != 0) {
int temp = q;
q = p % q;
p = temp;
}
return p;
}
| int func0(int x, int y) {
return gcd(x, y) == 1;
}
| int main() {
assert(func0(17, 13) == 1);
assert(func0(15, 21) == 0);
assert(func0(25, 45) == 0);
return 0;
}
| O1 | c | func0:
endbr64
mov %edi,%eax
test %esi,%esi
je 1188 <func0+0x21>
mov %esi,%ecx
cltd
idiv %esi
mov %edx,%esi
mov %ecx,%eax
test %edx,%edx
jne 1171 <func0+0xa>
cmp $0x1,%ecx
sete %al
movzbl %al,%eax
retq
mov %edi,%ecx
jmp 117e <func0+0x17>
| func0:
endbr64
mov eax, edi
test esi, esi
jz short loc_1188
loc_1171:
mov ecx, esi
cdq
idiv esi
mov esi, edx
mov eax, ecx
test edx, edx
jnz short loc_1171
loc_117E:
cmp ecx, 1
setz al
movzx eax, al
retn
loc_1188:
mov ecx, edi
jmp short loc_117E | _BOOL8 func0(int a1, int a2)
{
int v2; // eax
int v3; // ecx
v2 = a1;
if ( a2 )
{
do
{
v3 = a2;
a2 = v2 % a2;
v2 = v3;
}
while ( a2 );
}
else
{
v3 = a1;
}
return v3 == 1;
} | func0:
ENDBR64
MOV EAX,EDI
TEST ESI,ESI
JZ 0x00101188
LAB_00101171:
MOV ECX,ESI
CDQ
IDIV ESI
MOV ESI,EDX
MOV EAX,ECX
TEST EDX,EDX
JNZ 0x00101171
LAB_0010117e:
CMP ECX,0x1
SETZ AL
MOVZX EAX,AL
RET
LAB_00101188:
MOV ECX,EDI
JMP 0x0010117e | bool func0(int param_1,int param_2)
{
int iVar1;
iVar1 = param_1;
if (param_2 != 0) {
do {
param_1 = param_2;
param_2 = iVar1 % param_1;
iVar1 = param_1;
} while (param_2 != 0);
}
return param_1 == 1;
} |
4,498 | func0 |
#include <assert.h>
int gcd(int p, int q) {
while (q != 0) {
int temp = q;
q = p % q;
p = temp;
}
return p;
}
| int func0(int x, int y) {
return gcd(x, y) == 1;
}
| int main() {
assert(func0(17, 13) == 1);
assert(func0(15, 21) == 0);
assert(func0(25, 45) == 0);
return 0;
}
| O2 | c | func0:
endbr64
mov %edi,%eax
mov %esi,%edx
test %esi,%esi
je 1278 <func0+0x28>
nopl 0x0(%rax)
mov %edx,%ecx
cltd
idiv %ecx
mov %ecx,%eax
test %edx,%edx
jne 1260 <func0+0x10>
xor %eax,%eax
cmp $0x1,%ecx
sete %al
retq
nopl 0x0(%rax)
mov %edi,%ecx
xor %eax,%eax
cmp $0x1,%ecx
sete %al
retq
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
mov eax, edi
mov edx, esi
test esi, esi
jz short loc_1278
nop dword ptr [rax+00h]
loc_1260:
mov ecx, edx
cdq
idiv ecx
mov eax, ecx
test edx, edx
jnz short loc_1260
xor eax, eax
cmp ecx, 1
setz al
retn
loc_1278:
mov ecx, edi
xor eax, eax
cmp ecx, 1
setz al
retn | _BOOL8 func0(int a1, int a2)
{
int v2; // eax
int v3; // edx
int v4; // ecx
v2 = a1;
v3 = a2;
if ( !a2 )
return a1 == 1;
do
{
v4 = v3;
v3 = v2 % v3;
v2 = v4;
}
while ( v3 );
return v4 == 1;
} | func0:
ENDBR64
MOV EAX,EDI
MOV EDX,ESI
TEST ESI,ESI
JZ 0x00101278
NOP dword ptr [RAX]
LAB_00101260:
MOV ECX,EDX
CDQ
IDIV ECX
MOV EAX,ECX
TEST EDX,EDX
JNZ 0x00101260
XOR EAX,EAX
CMP ECX,0x1
SETZ AL
RET
LAB_00101278:
MOV ECX,EDI
XOR EAX,EAX
CMP ECX,0x1
SETZ AL
RET | bool func0(int param_1,int param_2)
{
int iVar1;
if (param_2 != 0) {
do {
iVar1 = param_2;
param_2 = param_1 % iVar1;
param_1 = iVar1;
} while (param_2 != 0);
return iVar1 == 1;
}
return param_1 == 1;
} |
4,499 | func0 |
#include <assert.h>
int gcd(int p, int q) {
while (q != 0) {
int temp = q;
q = p % q;
p = temp;
}
return p;
}
| int func0(int x, int y) {
return gcd(x, y) == 1;
}
| int main() {
assert(func0(17, 13) == 1);
assert(func0(15, 21) == 0);
assert(func0(25, 45) == 0);
return 0;
}
| O3 | c | func0:
endbr64
mov %edi,%eax
mov %esi,%edx
test %esi,%esi
je 1278 <func0+0x28>
nopl 0x0(%rax)
mov %edx,%ecx
cltd
idiv %ecx
mov %ecx,%eax
test %edx,%edx
jne 1260 <func0+0x10>
xor %eax,%eax
cmp $0x1,%ecx
sete %al
retq
nopl 0x0(%rax)
mov %edi,%ecx
xor %eax,%eax
cmp $0x1,%ecx
sete %al
retq
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
mov eax, edi
mov edx, esi
test esi, esi
jz short loc_1278
nop dword ptr [rax+00h]
loc_1260:
mov ecx, edx
cdq
idiv ecx
mov eax, ecx
test edx, edx
jnz short loc_1260
xor eax, eax
cmp ecx, 1
setz al
retn
loc_1278:
mov ecx, edi
xor eax, eax
cmp ecx, 1
setz al
retn | _BOOL8 func0(int a1, int a2)
{
int v2; // eax
int v3; // edx
int v4; // ecx
v2 = a1;
v3 = a2;
if ( !a2 )
return a1 == 1;
do
{
v4 = v3;
v3 = v2 % v3;
v2 = v4;
}
while ( v3 );
return v4 == 1;
} | func0:
ENDBR64
MOV EAX,EDI
MOV EDX,ESI
TEST ESI,ESI
JZ 0x00101278
NOP dword ptr [RAX]
LAB_00101260:
MOV ECX,EDX
CDQ
IDIV ECX
MOV EAX,ECX
TEST EDX,EDX
JNZ 0x00101260
XOR EAX,EAX
CMP ECX,0x1
SETZ AL
RET
LAB_00101278:
MOV ECX,EDI
XOR EAX,EAX
CMP ECX,0x1
SETZ AL
RET | bool func0(int param_1,int param_2)
{
int iVar1;
if (param_2 != 0) {
do {
iVar1 = param_2;
param_2 = param_1 % iVar1;
param_1 = iVar1;
} while (param_2 != 0);
return iVar1 == 1;
}
return param_1 == 1;
} |
4,500 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
void merge(int a[], int a_len, int b[], int b_len, int c[]) {
int i = 0, j = 0, k = 0;
while (i < a_len && j < b_len) {
if (a[i] < b[j]) {
c[k++] = a[i++];
} else {
c[k++] = b[j++];
}
}
while (i < a_len) {
c[k++] = a[i++];
}
while (j < b_len) {
c[k++] = b[j++];
}
}
| void func0(int arr[], int len) {
if (len < 2) {
return;
}
int mid = len / 2;
int *left = (int *)malloc(mid * sizeof(int));
int *right = (int *)malloc((len - mid) * sizeof(int));
for (int i = 0; i < mid; i++) {
left[i] = arr[i];
}
for (int i = mid; i < len; i++) {
right[i - mid] = arr[i];
}
func0(left, mid);
func0(right, len - mid);
merge(left, mid, right, len - mid, arr);
free(left);
free(right);
}
| int main() {
int arr1[] = {3, 4, 2, 6, 5, 7, 1, 9};
func0(arr1, 8);
int sorted1[] = {1, 2, 3, 4, 5, 6, 7, 9};
for (int i = 0; i < 8; i++) {
assert(arr1[i] == sorted1[i]);
}
int arr2[] = {7, 25, 45, 78, 11, 33, 19};
func0(arr2, 7);
int sorted2[] = {7, 11, 19, 25, 33, 45, 78};
for (int i = 0; i < 7; i++) {
assert(arr2[i] == sorted2[i]);
}
int arr3[] = {3, 1, 4, 9, 8};
func0(arr3, 5);
int sorted3[] = {1, 3, 4, 8, 9};
for (int i = 0; i < 5; i++) {
assert(arr3[i] == sorted3[i]);
}
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x30,%rsp
mov %rdi,-0x28(%rbp)
mov %esi,-0x2c(%rbp)
cmpl $0x1,-0x2c(%rbp)
jle 1461 <func0+0x142>
mov -0x2c(%rbp),%eax
mov %eax,%edx
shr $0x1f,%edx
add %edx,%eax
sar %eax
mov %eax,-0x14(%rbp)
mov -0x14(%rbp),%eax
cltq
shl $0x2,%rax
mov %rax,%rdi
callq 10b0 <malloc@plt>
mov %rax,-0x10(%rbp)
mov -0x2c(%rbp),%eax
sub -0x14(%rbp),%eax
cltq
shl $0x2,%rax
mov %rax,%rdi
callq 10b0 <malloc@plt>
mov %rax,-0x8(%rbp)
movl $0x0,-0x1c(%rbp)
jmp 13b2 <func0+0x93>
mov -0x1c(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
mov -0x1c(%rbp),%edx
movslq %edx,%rdx
lea 0x0(,%rdx,4),%rcx
mov -0x10(%rbp),%rdx
add %rcx,%rdx
mov (%rax),%eax
mov %eax,(%rdx)
addl $0x1,-0x1c(%rbp)
mov -0x1c(%rbp),%eax
cmp -0x14(%rbp),%eax
jl 1381 <func0+0x62>
mov -0x14(%rbp),%eax
mov %eax,-0x18(%rbp)
jmp 13f6 <func0+0xd7>
mov -0x18(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x28(%rbp),%rax
lea (%rdx,%rax,1),%rcx
mov -0x18(%rbp),%eax
sub -0x14(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x8(%rbp),%rax
add %rax,%rdx
mov (%rcx),%eax
mov %eax,(%rdx)
addl $0x1,-0x18(%rbp)
mov -0x18(%rbp),%eax
cmp -0x2c(%rbp),%eax
jl 13c2 <func0+0xa3>
mov -0x14(%rbp),%edx
mov -0x10(%rbp),%rax
mov %edx,%esi
mov %rax,%rdi
callq 131f <func0>
mov -0x2c(%rbp),%eax
sub -0x14(%rbp),%eax
mov %eax,%edx
mov -0x8(%rbp),%rax
mov %edx,%esi
mov %rax,%rdi
callq 131f <func0>
mov -0x2c(%rbp),%eax
sub -0x14(%rbp),%eax
mov %eax,%ecx
mov -0x28(%rbp),%rdi
mov -0x8(%rbp),%rdx
mov -0x14(%rbp),%esi
mov -0x10(%rbp),%rax
mov %rdi,%r8
mov %rax,%rdi
callq 11a9 <merge>
mov -0x10(%rbp),%rax
mov %rax,%rdi
callq 1080 <free@plt>
mov -0x8(%rbp),%rax
mov %rax,%rdi
callq 1080 <free@plt>
jmp 1462 <func0+0x143>
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 30h
mov [rbp+var_28], rdi
mov [rbp+var_2C], esi
cmp [rbp+var_2C], 1
jle loc_1461
mov eax, [rbp+var_2C]
mov edx, eax
shr edx, 1Fh
add eax, edx
sar eax, 1
mov [rbp+var_14], eax
mov eax, [rbp+var_14]
cdqe
shl rax, 2
mov rdi, rax; size
call _malloc
mov [rbp+ptr], rax
mov eax, [rbp+var_2C]
sub eax, [rbp+var_14]
cdqe
shl rax, 2
mov rdi, rax; size
call _malloc
mov [rbp+var_8], rax
mov [rbp+var_1C], 0
jmp short loc_13B2
loc_1381:
mov eax, [rbp+var_1C]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_28]
add rax, rdx
mov edx, [rbp+var_1C]
movsxd rdx, edx
lea rcx, ds:0[rdx*4]
mov rdx, [rbp+ptr]
add rdx, rcx
mov eax, [rax]
mov [rdx], eax
add [rbp+var_1C], 1
loc_13B2:
mov eax, [rbp+var_1C]
cmp eax, [rbp+var_14]
jl short loc_1381
mov eax, [rbp+var_14]
mov [rbp+var_18], eax
jmp short loc_13F6
loc_13C2:
mov eax, [rbp+var_18]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_28]
lea rcx, [rdx+rax]
mov eax, [rbp+var_18]
sub eax, [rbp+var_14]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_8]
add rdx, rax
mov eax, [rcx]
mov [rdx], eax
add [rbp+var_18], 1
loc_13F6:
mov eax, [rbp+var_18]
cmp eax, [rbp+var_2C]
jl short loc_13C2
mov edx, [rbp+var_14]
mov rax, [rbp+ptr]
mov esi, edx
mov rdi, rax
call func0
mov eax, [rbp+var_2C]
sub eax, [rbp+var_14]
mov edx, eax
mov rax, [rbp+var_8]
mov esi, edx
mov rdi, rax
call func0
mov eax, [rbp+var_2C]
sub eax, [rbp+var_14]
mov ecx, eax
mov rdi, [rbp+var_28]
mov rdx, [rbp+var_8]
mov esi, [rbp+var_14]
mov rax, [rbp+ptr]
mov r8, rdi
mov rdi, rax
call merge
mov rax, [rbp+ptr]
mov rdi, rax; ptr
call _free
mov rax, [rbp+var_8]
mov rdi, rax; ptr
call _free
jmp short locret_1462
loc_1461:
nop
locret_1462:
leave
retn | void func0(long long a1, int a2)
{
signed int i; // [rsp+14h] [rbp-1Ch]
int j; // [rsp+18h] [rbp-18h]
unsigned int v4; // [rsp+1Ch] [rbp-14h]
_DWORD *ptr; // [rsp+20h] [rbp-10h]
_DWORD *v6; // [rsp+28h] [rbp-8h]
if ( a2 > 1 )
{
v4 = a2 / 2;
ptr = malloc(4LL * (a2 / 2));
v6 = malloc(4LL * (a2 - a2 / 2));
for ( i = 0; i < (int)v4; ++i )
ptr[i] = *(_DWORD *)(4LL * i + a1);
for ( j = a2 / 2; j < a2; ++j )
v6[j - v4] = *(_DWORD *)(4LL * j + a1);
func0(ptr, v4);
func0(v6, a2 - v4);
merge(ptr, v4, v6, a2 - v4, a1);
free(ptr);
free(v6);
}
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x30
MOV qword ptr [RBP + -0x28],RDI
MOV dword ptr [RBP + -0x2c],ESI
CMP dword ptr [RBP + -0x2c],0x1
JLE 0x00101461
MOV EAX,dword ptr [RBP + -0x2c]
MOV EDX,EAX
SHR EDX,0x1f
ADD EAX,EDX
SAR EAX,0x1
MOV dword ptr [RBP + -0x14],EAX
MOV EAX,dword ptr [RBP + -0x14]
CDQE
SHL RAX,0x2
MOV RDI,RAX
CALL 0x001010b0
MOV qword ptr [RBP + -0x10],RAX
MOV EAX,dword ptr [RBP + -0x2c]
SUB EAX,dword ptr [RBP + -0x14]
CDQE
SHL RAX,0x2
MOV RDI,RAX
CALL 0x001010b0
MOV qword ptr [RBP + -0x8],RAX
MOV dword ptr [RBP + -0x1c],0x0
JMP 0x001013b2
LAB_00101381:
MOV EAX,dword ptr [RBP + -0x1c]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOV EDX,dword ptr [RBP + -0x1c]
MOVSXD RDX,EDX
LEA RCX,[RDX*0x4]
MOV RDX,qword ptr [RBP + -0x10]
ADD RDX,RCX
MOV EAX,dword ptr [RAX]
MOV dword ptr [RDX],EAX
ADD dword ptr [RBP + -0x1c],0x1
LAB_001013b2:
MOV EAX,dword ptr [RBP + -0x1c]
CMP EAX,dword ptr [RBP + -0x14]
JL 0x00101381
MOV EAX,dword ptr [RBP + -0x14]
MOV dword ptr [RBP + -0x18],EAX
JMP 0x001013f6
LAB_001013c2:
MOV EAX,dword ptr [RBP + -0x18]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x28]
LEA RCX,[RDX + RAX*0x1]
MOV EAX,dword ptr [RBP + -0x18]
SUB EAX,dword ptr [RBP + -0x14]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x8]
ADD RDX,RAX
MOV EAX,dword ptr [RCX]
MOV dword ptr [RDX],EAX
ADD dword ptr [RBP + -0x18],0x1
LAB_001013f6:
MOV EAX,dword ptr [RBP + -0x18]
CMP EAX,dword ptr [RBP + -0x2c]
JL 0x001013c2
MOV EDX,dword ptr [RBP + -0x14]
MOV RAX,qword ptr [RBP + -0x10]
MOV ESI,EDX
MOV RDI,RAX
CALL 0x0010131f
MOV EAX,dword ptr [RBP + -0x2c]
SUB EAX,dword ptr [RBP + -0x14]
MOV EDX,EAX
MOV RAX,qword ptr [RBP + -0x8]
MOV ESI,EDX
MOV RDI,RAX
CALL 0x0010131f
MOV EAX,dword ptr [RBP + -0x2c]
SUB EAX,dword ptr [RBP + -0x14]
MOV ECX,EAX
MOV RDI,qword ptr [RBP + -0x28]
MOV RDX,qword ptr [RBP + -0x8]
MOV ESI,dword ptr [RBP + -0x14]
MOV RAX,qword ptr [RBP + -0x10]
MOV R8,RDI
MOV RDI,RAX
CALL 0x001011a9
MOV RAX,qword ptr [RBP + -0x10]
MOV RDI,RAX
CALL 0x00101080
MOV RAX,qword ptr [RBP + -0x8]
MOV RDI,RAX
CALL 0x00101080
JMP 0x00101462
LAB_00101461:
NOP
LAB_00101462:
LEAVE
RET | void func0(long param_1,int param_2)
{
int iVar1;
void *__ptr;
void *__ptr_00;
int4 local_24;
int4 local_20;
if (1 < param_2) {
iVar1 = param_2 / 2;
__ptr = malloc((long)iVar1 << 2);
__ptr_00 = malloc((long)(param_2 - iVar1) << 2);
for (local_24 = 0; local_20 = iVar1, local_24 < iVar1; local_24 = local_24 + 1) {
*(int4 *)((long)__ptr + (long)local_24 * 4) =
*(int4 *)(param_1 + (long)local_24 * 4);
}
for (; local_20 < param_2; local_20 = local_20 + 1) {
*(int4 *)((long)(local_20 - iVar1) * 4 + (long)__ptr_00) =
*(int4 *)((long)local_20 * 4 + param_1);
}
func0(__ptr,iVar1);
func0(__ptr_00,param_2 - iVar1);
merge(__ptr,iVar1,__ptr_00,param_2 - iVar1,param_1);
free(__ptr);
free(__ptr_00);
}
return;
} |
4,501 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
void merge(int a[], int a_len, int b[], int b_len, int c[]) {
int i = 0, j = 0, k = 0;
while (i < a_len && j < b_len) {
if (a[i] < b[j]) {
c[k++] = a[i++];
} else {
c[k++] = b[j++];
}
}
while (i < a_len) {
c[k++] = a[i++];
}
while (j < b_len) {
c[k++] = b[j++];
}
}
| void func0(int arr[], int len) {
if (len < 2) {
return;
}
int mid = len / 2;
int *left = (int *)malloc(mid * sizeof(int));
int *right = (int *)malloc((len - mid) * sizeof(int));
for (int i = 0; i < mid; i++) {
left[i] = arr[i];
}
for (int i = mid; i < len; i++) {
right[i - mid] = arr[i];
}
func0(left, mid);
func0(right, len - mid);
merge(left, mid, right, len - mid, arr);
free(left);
free(right);
}
| int main() {
int arr1[] = {3, 4, 2, 6, 5, 7, 1, 9};
func0(arr1, 8);
int sorted1[] = {1, 2, 3, 4, 5, 6, 7, 9};
for (int i = 0; i < 8; i++) {
assert(arr1[i] == sorted1[i]);
}
int arr2[] = {7, 25, 45, 78, 11, 33, 19};
func0(arr2, 7);
int sorted2[] = {7, 11, 19, 25, 33, 45, 78};
for (int i = 0; i < 7; i++) {
assert(arr2[i] == sorted2[i]);
}
int arr3[] = {3, 1, 4, 9, 8};
func0(arr3, 5);
int sorted3[] = {1, 3, 4, 8, 9};
for (int i = 0; i < 5; i++) {
assert(arr3[i] == sorted3[i]);
}
return 0;
}
| O1 | c | func0:
endbr64
cmp $0x1,%esi
jle 1340 <func0+0xe2>
push %r15
push %r14
push %r13
push %r12
push %rbp
push %rbx
sub $0x18,%rsp
mov %rdi,%rbp
mov %esi,%r12d
mov %esi,%r14d
shr $0x1f,%r14d
add %esi,%r14d
sar %r14d
movslq %r14d,%rbx
lea 0x0(,%rbx,4),%rdi
callq 10b0 <malloc@plt>
mov %rax,%r13
mov %r12d,%eax
sub %r14d,%eax
mov %eax,0xc(%rsp)
movslq %eax,%rdi
shl $0x2,%rdi
callq 10b0 <malloc@plt>
mov %rax,%r15
lea -0x1(%r14),%ecx
mov $0x0,%eax
mov 0x0(%rbp,%rax,4),%edx
mov %edx,0x0(%r13,%rax,4)
mov %rax,%rdx
add $0x1,%rax
cmp %rcx,%rdx
jne 12c1 <func0+0x63>
cmp %r14d,%r12d
jle 12f5 <func0+0x97>
mov %rbx,%rax
neg %rax
lea (%r15,%rax,4),%rdx
mov 0x0(%rbp,%rbx,4),%eax
mov %eax,(%rdx,%rbx,4)
add $0x1,%rbx
cmp %ebx,%r12d
jg 12e5 <func0+0x87>
mov %r14d,%esi
mov %r13,%rdi
callq 125e <func0>
mov 0xc(%rsp),%ebx
mov %ebx,%esi
mov %r15,%rdi
callq 125e <func0>
mov %rbp,%r8
mov %ebx,%ecx
mov %r15,%rdx
mov %r14d,%esi
mov %r13,%rdi
callq 11a9 <merge>
mov %r13,%rdi
callq 1080 <free@plt>
mov %r15,%rdi
callq 1080 <free@plt>
add $0x18,%rsp
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
retq
| func0:
endbr64
cmp esi, 1
jle locret_134C
push r15
push r14
push r13
push r12
push rbp
push rbx
sub rsp, 18h
mov rbp, rdi
mov r12d, esi
mov r14d, esi
shr r14d, 1Fh
add r14d, esi
sar r14d, 1
movsxd rbx, r14d
lea rdi, ds:0[rbx*4]
call _malloc
mov r13, rax
mov eax, r12d
sub eax, r14d
mov [rsp+48h+var_3C], eax
movsxd rdi, eax
shl rdi, 2
call _malloc
mov r15, rax
mov ecx, r14d
mov eax, 0
loc_12D0:
mov edx, [rbp+rax*4+0]
mov [r13+rax*4+0], edx
add rax, 1
cmp rax, rcx
jnz short loc_12D0
cmp r12d, r14d
jle short loc_1301
mov rax, rbx
neg rax
lea rdx, [r15+rax*4]
loc_12F1:
mov eax, [rbp+rbx*4+0]
mov [rdx+rbx*4], eax
add rbx, 1
cmp r12d, ebx
jg short loc_12F1
loc_1301:
mov esi, r14d
mov rdi, r13
call func0
mov ebx, [rsp+48h+var_3C]
mov esi, ebx
mov rdi, r15
call func0
mov r8, rbp
mov ecx, ebx
mov rdx, r15
mov esi, r14d
mov rdi, r13
call merge
mov rdi, r13
call _free
mov rdi, r15
call _free
add rsp, 18h
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
locret_134C:
retn | void func0(long long a1, int a2)
{
unsigned int v2; // r14d
long long v3; // rbx
long long v4; // r13
long long v5; // r15
long long v6; // rax
long long v7; // rdx
long long v8; // rdx
long long v9; // rcx
unsigned int v10; // [rsp+0h] [rbp-3Ch]
if ( a2 > 1 )
{
v2 = a2 / 2;
v3 = a2 / 2;
v4 = malloc(4 * v3);
v10 = a2 - a2 / 2;
v5 = malloc(4LL * (int)v10);
v6 = 0LL;
do
{
v7 = *(unsigned int *)(a1 + 4 * v6);
*(_DWORD *)(v4 + 4 * v6++) = v7;
}
while ( v6 != v2 );
if ( a2 > (int)v2 )
{
v7 = v5 - 4LL * (int)v2;
do
{
*(_DWORD *)(v7 + 4 * v3) = *(_DWORD *)(a1 + 4 * v3);
++v3;
}
while ( a2 > (int)v3 );
}
func0(v4, v2, v7, v2);
func0(v5, v10, v8, v9);
merge(v4, v2, v5, v10, a1);
free(v4);
free(v5);
}
} | func0:
ENDBR64
CMP ESI,0x1
JLE 0x0010134c
PUSH R15
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0x18
MOV RBP,RDI
MOV R12D,ESI
MOV R14D,ESI
SHR R14D,0x1f
ADD R14D,ESI
SAR R14D,0x1
MOVSXD RBX,R14D
LEA RDI,[RBX*0x4]
CALL 0x001010b0
MOV R13,RAX
MOV EAX,R12D
SUB EAX,R14D
MOV dword ptr [RSP + 0xc],EAX
MOVSXD RDI,EAX
SHL RDI,0x2
CALL 0x001010b0
MOV R15,RAX
MOV ECX,R14D
MOV EAX,0x0
LAB_001012d0:
MOV EDX,dword ptr [RBP + RAX*0x4]
MOV dword ptr [R13 + RAX*0x4],EDX
ADD RAX,0x1
CMP RAX,RCX
JNZ 0x001012d0
CMP R12D,R14D
JLE 0x00101301
MOV RAX,RBX
NEG RAX
LEA RDX,[R15 + RAX*0x4]
LAB_001012f1:
MOV EAX,dword ptr [RBP + RBX*0x4]
MOV dword ptr [RDX + RBX*0x4],EAX
ADD RBX,0x1
CMP R12D,EBX
JG 0x001012f1
LAB_00101301:
MOV ESI,R14D
MOV RDI,R13
CALL 0x0010126e
MOV EBX,dword ptr [RSP + 0xc]
MOV ESI,EBX
MOV RDI,R15
CALL 0x0010126e
MOV R8,RBP
MOV ECX,EBX
MOV RDX,R15
MOV ESI,R14D
MOV RDI,R13
CALL 0x001011a9
MOV RDI,R13
CALL 0x00101080
MOV RDI,R15
CALL 0x00101080
ADD RSP,0x18
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_0010134c:
RET | void func0(long param_1,int param_2)
{
long lVar1;
int iVar2;
void *__ptr;
void *__ptr_00;
ulong uVar3;
long lVar4;
uint uVar5;
if (1 < param_2) {
uVar5 = param_2 / 2;
lVar4 = (long)(int)uVar5;
__ptr = malloc(lVar4 * 4);
iVar2 = param_2 - uVar5;
__ptr_00 = malloc((long)iVar2 << 2);
uVar3 = 0;
do {
*(int4 *)((long)__ptr + uVar3 * 4) = *(int4 *)(param_1 + uVar3 * 4);
uVar3 = uVar3 + 1;
} while (uVar3 != uVar5);
if ((int)uVar5 < param_2) {
lVar1 = lVar4 * -4;
do {
*(int4 *)((long)__ptr_00 + lVar4 * 4 + lVar1) = *(int4 *)(param_1 + lVar4 * 4);
lVar4 = lVar4 + 1;
} while ((int)lVar4 < param_2);
}
func0(__ptr,uVar5);
func0(__ptr_00,iVar2);
merge(__ptr,uVar5,__ptr_00,iVar2,param_1);
free(__ptr);
free(__ptr_00);
return;
}
return;
} |
4,502 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
void merge(int a[], int a_len, int b[], int b_len, int c[]) {
int i = 0, j = 0, k = 0;
while (i < a_len && j < b_len) {
if (a[i] < b[j]) {
c[k++] = a[i++];
} else {
c[k++] = b[j++];
}
}
while (i < a_len) {
c[k++] = a[i++];
}
while (j < b_len) {
c[k++] = b[j++];
}
}
| void func0(int arr[], int len) {
if (len < 2) {
return;
}
int mid = len / 2;
int *left = (int *)malloc(mid * sizeof(int));
int *right = (int *)malloc((len - mid) * sizeof(int));
for (int i = 0; i < mid; i++) {
left[i] = arr[i];
}
for (int i = mid; i < len; i++) {
right[i - mid] = arr[i];
}
func0(left, mid);
func0(right, len - mid);
merge(left, mid, right, len - mid, arr);
free(left);
free(right);
}
| int main() {
int arr1[] = {3, 4, 2, 6, 5, 7, 1, 9};
func0(arr1, 8);
int sorted1[] = {1, 2, 3, 4, 5, 6, 7, 9};
for (int i = 0; i < 8; i++) {
assert(arr1[i] == sorted1[i]);
}
int arr2[] = {7, 25, 45, 78, 11, 33, 19};
func0(arr2, 7);
int sorted2[] = {7, 11, 19, 25, 33, 45, 78};
for (int i = 0; i < 7; i++) {
assert(arr2[i] == sorted2[i]);
}
int arr3[] = {3, 1, 4, 9, 8};
func0(arr3, 5);
int sorted3[] = {1, 3, 4, 8, 9};
for (int i = 0; i < 5; i++) {
assert(arr3[i] == sorted3[i]);
}
return 0;
}
| O2 | c | func0:
endbr64
cmp $0x1,%esi
jle 1510 <func0+0x10>
jmp 1520 <func0.part.0>
nopl 0x0(%rax,%rax,1)
retq
data16 nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax)
| func0_part_0:
push r15
push r14
mov r14, rdi
push r13
push r12
push rbp
mov ebp, esi
push rbx
sar ebp, 1
mov ebx, esi
movsxd rdx, ebp
mov r15d, ebx
shl rdx, 2
sub r15d, ebp
sub rsp, 18h
mov rdi, rdx
mov [rsp+48h+var_40], rdx
call _malloc
movsxd rdi, r15d
shl rdi, 2
mov r12, rax
call _malloc
mov rdx, [rsp+48h+var_40]
mov rsi, r14
mov rdi, r12
mov r13, rax
call _memcpy
cmp ebx, ebp
jle short loc_1588
sub ebx, 1
mov rdx, [rsp+48h+var_40]
mov rdi, r13
sub ebx, ebp
lea r8, ds:4[rbx*4]
lea rsi, [r14+rdx]
mov rdx, r8
call _memcpy
loc_1588:
cmp ebp, 1
jz short loc_1597
mov esi, ebp
mov rdi, r12
call func0_part_0
loc_1597:
cmp r15d, 1
jle short loc_15A8
mov esi, r15d
mov rdi, r13
call func0_part_0
loc_15A8:
mov r8, r14
mov ecx, r15d
mov rdx, r13
mov esi, ebp
mov rdi, r12
call merge
mov rdi, r12
call _free
add rsp, 18h
mov rdi, r13
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
jmp _free | long long func0_part_0(long long a1, int a2)
{
unsigned int v2; // ebp
int v3; // r15d
long long v4; // r12
long long v5; // r13
long long v7; // [rsp+8h] [rbp-40h]
v2 = a2 >> 1;
v3 = a2 - (a2 >> 1);
v7 = 4LL * (a2 >> 1);
v4 = malloc(v7);
v5 = malloc(4LL * v3);
memcpy(v4, a1, v7);
if ( a2 > a2 >> 1 )
memcpy(v5, a1 + v7, 4LL * (a2 - 1 - v2) + 4);
if ( v2 != 1 )
func0_part_0(v4, v2);
if ( v3 > 1 )
func0_part_0(v5, (unsigned int)v3);
merge(v4, v2, v5, (unsigned int)v3, a1);
free(v4);
return free(v5);
} | func0.part.0:
PUSH R15
PUSH R14
MOV R14,RDI
PUSH R13
PUSH R12
PUSH RBP
MOV EBP,ESI
PUSH RBX
SAR EBP,0x1
MOV EBX,ESI
MOVSXD RDX,EBP
MOV R15D,EBX
SHL RDX,0x2
SUB R15D,EBP
SUB RSP,0x18
MOV RDI,RDX
MOV qword ptr [RSP + 0x8],RDX
CALL 0x001010d0
MOVSXD RDI,R15D
SHL RDI,0x2
MOV R12,RAX
CALL 0x001010d0
MOV RDX,qword ptr [RSP + 0x8]
MOV RSI,R14
MOV RDI,R12
MOV R13,RAX
CALL 0x001010c0
CMP EBX,EBP
JLE 0x00101588
SUB EBX,0x1
MOV RDX,qword ptr [RSP + 0x8]
MOV RDI,R13
SUB EBX,EBP
LEA R8,[0x4 + RBX*0x4]
LEA RSI,[R14 + RDX*0x1]
MOV RDX,R8
CALL 0x001010c0
LAB_00101588:
CMP EBP,0x1
JZ 0x00101597
MOV ESI,EBP
MOV RDI,R12
CALL 0x00101510
LAB_00101597:
CMP R15D,0x1
JLE 0x001015a8
MOV ESI,R15D
MOV RDI,R13
CALL 0x00101510
LAB_001015a8:
MOV R8,R14
MOV ECX,R15D
MOV RDX,R13
MOV ESI,EBP
MOV RDI,R12
CALL 0x00101440
MOV RDI,R12
CALL 0x00101090
ADD RSP,0x18
MOV RDI,R13
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
JMP 0x00101090 | void func0_part_0(void *param_1,int param_2)
{
void *__dest;
void *__dest_00;
size_t __size;
int iVar1;
int iVar2;
iVar1 = param_2 >> 1;
__size = (long)iVar1 * 4;
iVar2 = param_2 - iVar1;
__dest = malloc(__size);
__dest_00 = malloc((long)iVar2 << 2);
memcpy(__dest,param_1,__size);
if (iVar1 < param_2) {
memcpy(__dest_00,(void *)((long)param_1 + __size),(ulong)(uint)((param_2 + -1) - iVar1) * 4 + 4)
;
}
if (iVar1 != 1) {
func0_part_0(__dest,iVar1);
}
if (1 < iVar2) {
func0_part_0(__dest_00,iVar2);
}
merge(__dest,iVar1,__dest_00,iVar2,param_1);
free(__dest);
free(__dest_00);
return;
} |
4,503 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
void merge(int a[], int a_len, int b[], int b_len, int c[]) {
int i = 0, j = 0, k = 0;
while (i < a_len && j < b_len) {
if (a[i] < b[j]) {
c[k++] = a[i++];
} else {
c[k++] = b[j++];
}
}
while (i < a_len) {
c[k++] = a[i++];
}
while (j < b_len) {
c[k++] = b[j++];
}
}
| void func0(int arr[], int len) {
if (len < 2) {
return;
}
int mid = len / 2;
int *left = (int *)malloc(mid * sizeof(int));
int *right = (int *)malloc((len - mid) * sizeof(int));
for (int i = 0; i < mid; i++) {
left[i] = arr[i];
}
for (int i = mid; i < len; i++) {
right[i - mid] = arr[i];
}
func0(left, mid);
func0(right, len - mid);
merge(left, mid, right, len - mid, arr);
free(left);
free(right);
}
| int main() {
int arr1[] = {3, 4, 2, 6, 5, 7, 1, 9};
func0(arr1, 8);
int sorted1[] = {1, 2, 3, 4, 5, 6, 7, 9};
for (int i = 0; i < 8; i++) {
assert(arr1[i] == sorted1[i]);
}
int arr2[] = {7, 25, 45, 78, 11, 33, 19};
func0(arr2, 7);
int sorted2[] = {7, 11, 19, 25, 33, 45, 78};
for (int i = 0; i < 7; i++) {
assert(arr2[i] == sorted2[i]);
}
int arr3[] = {3, 1, 4, 9, 8};
func0(arr3, 5);
int sorted3[] = {1, 3, 4, 8, 9};
for (int i = 0; i < 5; i++) {
assert(arr3[i] == sorted3[i]);
}
return 0;
}
| O3 | c | func0:
endbr64
cmp $0x1,%esi
jle 17d0 <func0+0x10>
jmpq 16f0 <func0.part.0>
xchg %ax,%ax
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax,%rax,1)
| func0_part_0:
push r15
push r14
mov r14, rdi
push r13
push r12
push rbp
mov ebp, esi
push rbx
sar ebp, 1
mov ebx, esi
movsxd rcx, ebp
mov r15d, ebx
shl rcx, 2
sub r15d, ebp
sub rsp, 18h
mov rdi, rcx; size
mov [rsp+48h+var_40], rcx
call _malloc
movsxd rdi, r15d
shl rdi, 2; size
mov r12, rax
call _malloc
mov edx, ebp
mov rsi, r14; src
mov rdi, r12; dest
shl rdx, 2; n
mov r13, rax
call _memcpy
cmp ebx, ebp
mov rcx, [rsp+48h+var_40]
jle short loc_16CB
sub ebx, 1
lea rsi, [r14+rcx]; src
mov rdi, r13; dest
sub ebx, ebp
lea rdx, ds:4[rbx*4]; n
call _memcpy
cmp ebp, 1
jz short loc_16D5
loc_16CB:
mov esi, ebp
mov rdi, r12
call func0_part_0
loc_16D5:
cmp r15d, 1
jle short loc_16E6
mov esi, r15d
mov rdi, r13
call func0_part_0
loc_16E6:
mov r8, r14
mov ecx, r15d
mov rdx, r13
mov esi, ebp
mov rdi, r12
call merge
mov rdi, r12; ptr
call _free
add rsp, 18h
mov rdi, r13; ptr
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
jmp _free | void func0_part_0(char *a1, int a2)
{
unsigned int v2; // ebp
int v3; // r15d
void *v4; // r12
void *v5; // r13
long long v6; // rdx
long long v7; // rcx
v2 = a2 >> 1;
v3 = a2 - (a2 >> 1);
v4 = malloc(4LL * (a2 >> 1));
v5 = malloc(4LL * v3);
memcpy(v4, a1, 4LL * (unsigned int)(a2 >> 1));
v7 = 4LL * (a2 >> 1);
if ( a2 <= a2 >> 1 || (memcpy(v5, &a1[4 * v2], 4LL * (a2 - 1 - v2) + 4), v2 != 1) )
func0_part_0(v4, v2, v6, v7);
if ( v3 > 1 )
func0_part_0(v5, (unsigned int)v3, v6, v7);
merge(v4, v2, v5, (unsigned int)v3, a1);
free(v4);
free(v5);
} | func0.part.0:
PUSH R15
PUSH R14
MOV R14,RDI
PUSH R13
PUSH R12
PUSH RBP
MOV EBP,ESI
PUSH RBX
SAR EBP,0x1
MOV EBX,ESI
MOVSXD RCX,EBP
MOV R15D,EBX
SHL RCX,0x2
SUB R15D,EBP
SUB RSP,0x18
MOV RDI,RCX
MOV qword ptr [RSP + 0x8],RCX
CALL 0x001010d0
MOVSXD RDI,R15D
SHL RDI,0x2
MOV R12,RAX
CALL 0x001010d0
MOV EDX,EBP
MOV RSI,R14
MOV RDI,R12
SHL RDX,0x2
MOV R13,RAX
CALL 0x001010c0
CMP EBX,EBP
MOV RCX,qword ptr [RSP + 0x8]
JLE 0x001016cb
SUB EBX,0x1
LEA RSI,[R14 + RCX*0x1]
MOV RDI,R13
SUB EBX,EBP
LEA RDX,[0x4 + RBX*0x4]
CALL 0x001010c0
CMP EBP,0x1
JZ 0x001016d5
LAB_001016cb:
MOV ESI,EBP
MOV RDI,R12
CALL 0x00101650
LAB_001016d5:
CMP R15D,0x1
JLE 0x001016e6
MOV ESI,R15D
MOV RDI,R13
CALL 0x00101650
LAB_001016e6:
MOV R8,R14
MOV ECX,R15D
MOV RDX,R13
MOV ESI,EBP
MOV RDI,R12
CALL 0x001013a0
MOV RDI,R12
CALL 0x00101090
ADD RSP,0x18
MOV RDI,R13
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
JMP 0x00101090 | void func0_part_0(void *param_1,int param_2)
{
void *__dest;
void *__dest_00;
uint uVar1;
int iVar2;
uVar1 = param_2 >> 1;
iVar2 = param_2 - uVar1;
__dest = malloc((long)(int)uVar1 * 4);
__dest_00 = malloc((long)iVar2 << 2);
memcpy(__dest,param_1,(ulong)uVar1 << 2);
if ((int)uVar1 < param_2) {
memcpy(__dest_00,(void *)((long)param_1 + (long)(int)uVar1 * 4),
(ulong)((param_2 + -1) - uVar1) * 4 + 4);
if (uVar1 == 1) goto LAB_001016d5;
}
func0_part_0(__dest,uVar1);
LAB_001016d5:
if (1 < iVar2) {
func0_part_0(__dest_00,iVar2);
}
merge(__dest,uVar1,__dest_00,iVar2,param_1);
free(__dest);
free(__dest_00);
return;
} |
4,504 | func0 |
#include <assert.h>
| double* func0(double a, double b, double c) {
static double vertex[2];
vertex[0] = -b / (2 * a);
vertex[1] = ((4 * a * c) - (b * b)) / (4 * a);
return vertex;
}
| int main() {
double *result;
result = func0(5, 3, 2);
assert(result[0] == -0.3 && result[1] == 1.55);
result = func0(9, 8, 4);
assert(result[0] == -0.4444444444444444 && result[1] == 2.2222222222222223);
result = func0(2, 4, 6);
assert(result[0] == -1.0 && result[1] == 4.0);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
movsd %xmm0,-0x8(%rbp)
movsd %xmm1,-0x10(%rbp)
movsd %xmm2,-0x18(%rbp)
movsd -0x10(%rbp),%xmm0
movq 0xf83(%rip),%xmm1
xorpd %xmm0,%xmm1
movsd -0x8(%rbp),%xmm0
addsd %xmm0,%xmm0
divsd %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd %xmm0,0x2e96(%rip)
movsd -0x8(%rbp),%xmm1
movsd 0xf69(%rip),%xmm0
mulsd %xmm1,%xmm0
movapd %xmm0,%xmm1
mulsd -0x18(%rbp),%xmm1
movsd -0x10(%rbp),%xmm0
mulsd %xmm0,%xmm0
subsd %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd -0x8(%rbp),%xmm2
movsd 0xf3e(%rip),%xmm1
mulsd %xmm2,%xmm1
divsd %xmm1,%xmm0
movsd %xmm0,0x2e56(%rip)
lea 0x2e47(%rip),%rax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
movsd [rbp+var_8], xmm0
movsd [rbp+var_10], xmm1
movsd [rbp+var_18], xmm2
movsd xmm0, [rbp+var_10]
movq xmm1, cs:qword_20D0
xorpd xmm1, xmm0
movsd xmm0, [rbp+var_8]
movapd xmm2, xmm0
addsd xmm2, xmm0
divsd xmm1, xmm2
movapd xmm0, xmm1
movsd cs:vertex_1, xmm0
movsd xmm1, [rbp+var_8]
movsd xmm0, cs:qword_20E0
mulsd xmm0, xmm1
movapd xmm1, xmm0
mulsd xmm1, [rbp+var_18]
movsd xmm0, [rbp+var_10]
movapd xmm2, xmm0
mulsd xmm2, xmm0
movapd xmm0, xmm1
subsd xmm0, xmm2
movsd xmm2, [rbp+var_8]
movsd xmm1, cs:qword_20E0
mulsd xmm1, xmm2
divsd xmm0, xmm1
movsd cs:qword_4028, xmm0
lea rax, vertex_1
pop rbp
retn | long long * func0(double a1, double a2, double a3)
{
*(double *)&vertex_1 = -a2 / (a1 + a1);
*(double *)&qword_4028 = (4.0 * a1 * a3 - a2 * a2) / (4.0 * a1);
return &vertex_1;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOVSD qword ptr [RBP + -0x8],XMM0
MOVSD qword ptr [RBP + -0x10],XMM1
MOVSD qword ptr [RBP + -0x18],XMM2
MOVSD XMM0,qword ptr [RBP + -0x10]
MOVQ XMM1,qword ptr [0x001020d0]
XORPD XMM1,XMM0
MOVSD XMM0,qword ptr [RBP + -0x8]
MOVAPD XMM2,XMM0
ADDSD XMM2,XMM0
DIVSD XMM1,XMM2
MOVAPD XMM0,XMM1
MOVSD qword ptr [0x00104020],XMM0
MOVSD XMM1,qword ptr [RBP + -0x8]
MOVSD XMM0,qword ptr [0x001020e0]
MULSD XMM0,XMM1
MOVAPD XMM1,XMM0
MULSD XMM1,qword ptr [RBP + -0x18]
MOVSD XMM0,qword ptr [RBP + -0x10]
MOVAPD XMM2,XMM0
MULSD XMM2,XMM0
MOVAPD XMM0,XMM1
SUBSD XMM0,XMM2
MOVSD XMM2,qword ptr [RBP + -0x8]
MOVSD XMM1,qword ptr [0x001020e0]
MULSD XMM1,XMM2
DIVSD XMM0,XMM1
MOVSD qword ptr [0x00104028],XMM0
LEA RAX,[0x104020]
POP RBP
RET | int1 * func0(double param_1,double param_2,double param_3)
{
vertex_1._0_8_ = (double)(DAT_001020d0 ^ (ulong)param_2) / (param_1 + param_1);
vertex_1._8_8_ = (DAT_001020e0 * param_1 * param_3 - param_2 * param_2) / (DAT_001020e0 * param_1)
;
return vertex_1;
} |
4,505 | func0 |
#include <assert.h>
| double* func0(double a, double b, double c) {
static double vertex[2];
vertex[0] = -b / (2 * a);
vertex[1] = ((4 * a * c) - (b * b)) / (4 * a);
return vertex;
}
| int main() {
double *result;
result = func0(5, 3, 2);
assert(result[0] == -0.3 && result[1] == 1.55);
result = func0(9, 8, 4);
assert(result[0] == -0.4444444444444444 && result[1] == 2.2222222222222223);
result = func0(2, 4, 6);
assert(result[0] == -1.0 && result[1] == 4.0);
return 0;
}
| O1 | c | func0:
endbr64
movapd %xmm1,%xmm3
xorpd 0xed7(%rip),%xmm3
movapd %xmm0,%xmm4
addsd %xmm0,%xmm4
divsd %xmm4,%xmm3
movsd %xmm3,0x2ed3(%rip)
mulsd 0xecb(%rip),%xmm0
mulsd %xmm0,%xmm2
mulsd %xmm1,%xmm1
subsd %xmm1,%xmm2
divsd %xmm0,%xmm2
movsd %xmm2,0x2ebb(%rip)
lea 0x2eac(%rip),%rax
retq
| func0:
endbr64
movapd xmm3, xmm1
xorpd xmm3, cs:xmmword_2010
movapd xmm4, xmm0
addsd xmm4, xmm0
divsd xmm3, xmm4
movsd cs:vertex_1, xmm3
mulsd xmm0, cs:qword_2020
mulsd xmm2, xmm0
mulsd xmm1, xmm1
subsd xmm2, xmm1
divsd xmm2, xmm0
movsd cs:qword_4028, xmm2
lea rax, vertex_1
retn | long long * func0(double a1, double a2, double a3)
{
*(double *)&vertex_1 = -a2 / (a1 + a1);
*(double *)&qword_4028 = (a3 * (a1 * 4.0) - a2 * a2) / (a1 * 4.0);
return &vertex_1;
} | func0:
ENDBR64
MOVAPD XMM3,XMM1
XORPD XMM3,xmmword ptr [0x00102010]
MOVAPD XMM4,XMM0
ADDSD XMM4,XMM0
DIVSD XMM3,XMM4
MOVSD qword ptr [0x00104020],XMM3
MULSD XMM0,qword ptr [0x00102020]
MULSD XMM2,XMM0
MULSD XMM1,XMM1
SUBSD XMM2,XMM1
DIVSD XMM2,XMM0
MOVSD qword ptr [0x00104028],XMM2
LEA RAX,[0x104020]
RET | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
int1 * func0(double param_1,double param_2,double param_3)
{
vertex_1._0_8_ = (double)((ulong)param_2 ^ _DAT_00102010) / (param_1 + param_1);
vertex_1._8_8_ = (param_3 * param_1 * DAT_00102020 - param_2 * param_2) / (param_1 * DAT_00102020)
;
return vertex_1;
} |
4,506 | func0 |
#include <assert.h>
| double* func0(double a, double b, double c) {
static double vertex[2];
vertex[0] = -b / (2 * a);
vertex[1] = ((4 * a * c) - (b * b)) / (4 * a);
return vertex;
}
| int main() {
double *result;
result = func0(5, 3, 2);
assert(result[0] == -0.3 && result[1] == 1.55);
result = func0(9, 8, 4);
assert(result[0] == -0.4444444444444444 && result[1] == 2.2222222222222223);
result = func0(2, 4, 6);
assert(result[0] == -1.0 && result[1] == 4.0);
return 0;
}
| O2 | c | func0:
endbr64
movapd %xmm0,%xmm4
movapd %xmm1,%xmm3
xorpd 0xe9c(%rip),%xmm3
addsd %xmm0,%xmm4
mulsd %xmm1,%xmm1
lea 0x2e9d(%rip),%rax
mulsd 0xe95(%rip),%xmm0
divsd %xmm4,%xmm3
mulsd %xmm0,%xmm2
subsd %xmm1,%xmm2
divsd %xmm0,%xmm2
movsd %xmm3,0x2e7d(%rip)
movsd %xmm2,0x2e7d(%rip)
retq
nopl 0x0(%rax)
| func0:
endbr64
movapd xmm4, xmm0
movapd xmm3, xmm1
xorpd xmm3, cs:xmmword_2010
addsd xmm4, xmm0
mulsd xmm1, xmm1
lea rax, vertex_1
mulsd xmm0, cs:qword_2020
divsd xmm3, xmm4
mulsd xmm2, xmm0
subsd xmm2, xmm1
divsd xmm2, xmm0
movsd cs:vertex_1, xmm3
movsd cs:qword_4028, xmm2
retn | long long * func0(double a1, double a2, double a3)
{
long long *result; // rax
result = &vertex_1;
*(double *)&vertex_1 = -a2 / (a1 + a1);
*(double *)&qword_4028 = (a3 * (a1 * 4.0) - a2 * a2) / (a1 * 4.0);
return result;
} | func0:
ENDBR64
MOVAPD XMM4,XMM0
MOVAPD XMM3,XMM1
XORPD XMM3,xmmword ptr [0x00102010]
ADDSD XMM4,XMM0
MULSD XMM1,XMM1
LEA RAX,[0x104020]
MULSD XMM0,qword ptr [0x00102020]
DIVSD XMM3,XMM4
MULSD XMM2,XMM0
SUBSD XMM2,XMM1
DIVSD XMM2,XMM0
MOVSD qword ptr [0x00104020],XMM3
MOVSD qword ptr [0x00104028],XMM2
RET | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
int1 * func0(double param_1,double param_2,double param_3)
{
vertex_1._0_8_ = (double)((ulong)param_2 ^ _DAT_00102010) / (param_1 + param_1);
vertex_1._8_8_ = (param_3 * param_1 * DAT_00102020 - param_2 * param_2) / (param_1 * DAT_00102020)
;
return vertex_1;
} |
4,507 | func0 |
#include <assert.h>
| double* func0(double a, double b, double c) {
static double vertex[2];
vertex[0] = -b / (2 * a);
vertex[1] = ((4 * a * c) - (b * b)) / (4 * a);
return vertex;
}
| int main() {
double *result;
result = func0(5, 3, 2);
assert(result[0] == -0.3 && result[1] == 1.55);
result = func0(9, 8, 4);
assert(result[0] == -0.4444444444444444 && result[1] == 2.2222222222222223);
result = func0(2, 4, 6);
assert(result[0] == -1.0 && result[1] == 4.0);
return 0;
}
| O3 | c | func0:
endbr64
movapd %xmm0,%xmm4
movapd %xmm1,%xmm3
xorpd 0xeac(%rip),%xmm3
addsd %xmm0,%xmm4
mulsd %xmm1,%xmm1
lea 0x2ead(%rip),%rax
mulsd 0xeb5(%rip),%xmm0
divsd %xmm4,%xmm3
mulsd %xmm0,%xmm2
subsd %xmm1,%xmm2
divsd %xmm0,%xmm2
movsd %xmm3,0x2e8d(%rip)
movsd %xmm2,0x2e8d(%rip)
retq
nopl 0x0(%rax)
| func0:
endbr64
unpcklpd xmm0, xmm0
movapd xmm3, xmm1
xorpd xmm3, cs:xmmword_2020
mulpd xmm0, cs:xmmword_2010
lea rax, vertex_1
mulsd xmm1, xmm1
movapd xmm5, xmm0
unpckhpd xmm5, xmm5
movapd xmm4, xmm5
mulsd xmm4, xmm2
subsd xmm4, xmm1
movapd xmm1, xmm3
unpcklpd xmm1, xmm4
divpd xmm1, xmm0
movaps cs:vertex_1, xmm1
retn | __int128 * func0(__m128d a1, __m128d a2, double a3)
{
__m128d v3; // xmm0
__int128 *result; // rax
__m128d v5; // xmm5
__m128d v6; // xmm4
v3 = _mm_mul_pd(_mm_unpacklo_pd(a1, a1), (__m128d)xmmword_2010);
result = &vertex_1;
v5 = _mm_unpackhi_pd(v3, v3);
v6.m128d_f64[1] = v5.m128d_f64[1];
v6.m128d_f64[0] = v5.m128d_f64[0] * a3 - a2.m128d_f64[0] * a2.m128d_f64[0];
vertex_1 = (__int128)_mm_div_pd(_mm_unpacklo_pd(_mm_xor_pd(a2, (__m128d)xmmword_2020), v6), v3);
return result;
} | func0:
ENDBR64
UNPCKLPD XMM0,XMM0
MOVAPD XMM3,XMM1
XORPD XMM3,xmmword ptr [0x00102020]
MULPD XMM0,xmmword ptr [0x00102010]
LEA RAX,[0x104020]
MULSD XMM1,XMM1
MOVAPD XMM5,XMM0
UNPCKHPD XMM5,XMM5
MOVAPD XMM4,XMM5
MULSD XMM4,XMM2
SUBSD XMM4,XMM1
MOVAPD XMM1,XMM3
UNPCKLPD XMM1,XMM4
DIVPD XMM1,XMM0
MOVAPS xmmword ptr [0x00104020],XMM1
RET | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
int1 * func0(double param_1,double param_2,double param_3)
{
int auVar1 [16];
int auVar2 [16];
auVar2._8_8_ = param_1 * _UNK_00102018 * param_3 - param_2 * param_2;
auVar2._0_8_ = (ulong)param_2 ^ _DAT_00102020;
auVar1._8_8_ = param_1 * _UNK_00102018;
auVar1._0_8_ = param_1 * _DAT_00102010;
vertex_1 = (int1 [16])divpd(auVar2,auVar1);
return vertex_1;
} |
4,508 | func0 |
#include <stdio.h>
#include <assert.h>
| int* func0(int nums[][4], int rows, int N, int* result) {
for (int i = 0; i < rows; i++) {
result[i] = nums[i][N];
}
return result;
}
| int main() {
int nums[3][4] = {{1, 2, 3, 2}, {4, 5, 6, 2}, {7, 1, 9, 5}};
int result[3];
func0(nums, 3, 0, result);
assert(result[0] == 1 && result[1] == 4 && result[2] == 7);
func0(nums, 3, 2, result);
assert(result[0] == 3 && result[1] == 6 && result[2] == 9);
func0(nums, 3, 3, result);
assert(result[0] == 2 && result[1] == 2 && result[2] == 5);
printf("All tests passed.\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov %edx,-0x20(%rbp)
mov %rcx,-0x28(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11de <func0+0x55>
mov -0x4(%rbp),%eax
cltq
shl $0x4,%rax
mov %rax,%rdx
mov -0x18(%rbp),%rax
lea (%rdx,%rax,1),%rcx
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x28(%rbp),%rax
add %rax,%rdx
mov -0x20(%rbp),%eax
cltq
mov (%rcx,%rax,4),%eax
mov %eax,(%rdx)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 11a8 <func0+0x1f>
mov -0x28(%rbp),%rax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_20], edx
mov [rbp+var_28], rcx
mov [rbp+var_4], 0
jmp short loc_11DE
loc_11A8:
mov eax, [rbp+var_4]
cdqe
shl rax, 4
mov rdx, rax
mov rax, [rbp+var_18]
lea rcx, [rdx+rax]
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_28]
add rdx, rax
mov eax, [rbp+var_20]
cdqe
mov eax, [rcx+rax*4]
mov [rdx], eax
add [rbp+var_4], 1
loc_11DE:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_11A8
mov rax, [rbp+var_28]
pop rbp
retn | long long func0(long long a1, int a2, int a3, long long a4)
{
int i; // [rsp+24h] [rbp-4h]
for ( i = 0; i < a2; ++i )
*(_DWORD *)(a4 + 4LL * i) = *(_DWORD *)(16LL * i + a1 + 4LL * a3);
return a4;
} | 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 dword ptr [RBP + -0x4],0x0
JMP 0x001011de
LAB_001011a8:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
SHL RAX,0x4
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0x18]
LEA RCX,[RDX + RAX*0x1]
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x28]
ADD RDX,RAX
MOV EAX,dword ptr [RBP + -0x20]
CDQE
MOV EAX,dword ptr [RCX + RAX*0x4]
MOV dword ptr [RDX],EAX
ADD dword ptr [RBP + -0x4],0x1
LAB_001011de:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x001011a8
MOV RAX,qword ptr [RBP + -0x28]
POP RBP
RET | long func0(long param_1,int param_2,int param_3,long param_4)
{
int4 local_c;
for (local_c = 0; local_c < param_2; local_c = local_c + 1) {
*(int4 *)((long)local_c * 4 + param_4) =
*(int4 *)((long)local_c * 0x10 + param_1 + (long)param_3 * 4);
}
return param_4;
} |
4,509 | func0 |
#include <stdio.h>
#include <assert.h>
| int* func0(int nums[][4], int rows, int N, int* result) {
for (int i = 0; i < rows; i++) {
result[i] = nums[i][N];
}
return result;
}
| int main() {
int nums[3][4] = {{1, 2, 3, 2}, {4, 5, 6, 2}, {7, 1, 9, 5}};
int result[3];
func0(nums, 3, 0, result);
assert(result[0] == 1 && result[1] == 4 && result[2] == 7);
func0(nums, 3, 2, result);
assert(result[0] == 3 && result[1] == 6 && result[2] == 9);
func0(nums, 3, 3, result);
assert(result[0] == 2 && result[1] == 2 && result[2] == 5);
printf("All tests passed.\n");
return 0;
}
| O1 | c | func0:
endbr64
mov %rcx,%rax
test %esi,%esi
jle 11b7 <func0+0x2e>
movslq %edx,%rdx
lea (%rdi,%rdx,4),%rdi
mov %rcx,%rdx
lea -0x1(%rsi),%ecx
lea 0x4(%rax,%rcx,4),%r8
mov (%rdi),%esi
mov %esi,(%rdx)
add $0x10,%rdi
add $0x4,%rdx
cmp %r8,%rdx
jne 11a6 <func0+0x1d>
retq
| func0:
endbr64
mov rax, rcx
test esi, esi
jle short locret_11B7
movsxd rdx, edx
lea rdi, [rdi+rdx*4]
mov rdx, rcx
lea ecx, [rsi-1]
lea r8, [rax+rcx*4+4]
loc_11A6:
mov esi, [rdi]
mov [rdx], esi
add rdi, 10h
add rdx, 4
cmp rdx, r8
jnz short loc_11A6
locret_11B7:
retn | _DWORD * func0(long long a1, int a2, int a3, _DWORD *a4)
{
_DWORD *result; // rax
_DWORD *v5; // rdi
_DWORD *v6; // rdx
result = a4;
if ( a2 > 0 )
{
v5 = (_DWORD *)(a1 + 4LL * a3);
v6 = a4;
do
{
*v6 = *v5;
v5 += 4;
++v6;
}
while ( v6 != &a4[a2 - 1 + 1] );
}
return result;
} | func0:
ENDBR64
MOV RAX,RCX
TEST ESI,ESI
JLE 0x001011b7
MOVSXD RDX,EDX
LEA RDI,[RDI + RDX*0x4]
MOV RDX,RCX
LEA ECX,[RSI + -0x1]
LEA R8,[RAX + RCX*0x4 + 0x4]
LAB_001011a6:
MOV ESI,dword ptr [RDI]
MOV dword ptr [RDX],ESI
ADD RDI,0x10
ADD RDX,0x4
CMP RDX,R8
JNZ 0x001011a6
LAB_001011b7:
RET | void func0(long param_1,int param_2,int param_3,int4 *param_4)
{
int4 *puVar1;
int4 *puVar2;
if (0 < param_2) {
puVar2 = (int4 *)(param_1 + (long)param_3 * 4);
puVar1 = param_4 + (ulong)(param_2 - 1) + 1;
do {
*param_4 = *puVar2;
puVar2 = puVar2 + 4;
param_4 = param_4 + 1;
} while (param_4 != puVar1);
}
return;
} |
4,510 | func0 |
#include <stdio.h>
#include <assert.h>
| int* func0(int nums[][4], int rows, int N, int* result) {
for (int i = 0; i < rows; i++) {
result[i] = nums[i][N];
}
return result;
}
| int main() {
int nums[3][4] = {{1, 2, 3, 2}, {4, 5, 6, 2}, {7, 1, 9, 5}};
int result[3];
func0(nums, 3, 0, result);
assert(result[0] == 1 && result[1] == 4 && result[2] == 7);
func0(nums, 3, 2, result);
assert(result[0] == 3 && result[1] == 6 && result[2] == 9);
func0(nums, 3, 3, result);
assert(result[0] == 2 && result[1] == 2 && result[2] == 5);
printf("All tests passed.\n");
return 0;
}
| O2 | c | func0:
endbr64
mov %rcx,%rax
test %esi,%esi
jle 11a2 <func0+0x32>
movslq %edx,%rdx
lea (%rdi,%rdx,4),%rdi
mov %rcx,%rdx
lea -0x1(%rsi),%ecx
lea 0x4(%rax,%rcx,4),%r8
nopl (%rax)
mov (%rdi),%esi
add $0x4,%rdx
add $0x10,%rdi
mov %esi,-0x4(%rdx)
cmp %r8,%rdx
jne 1190 <func0+0x20>
retq
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
mov rax, rcx
test esi, esi
jle short locret_11A2
movsxd rdx, edx
lea rdi, [rdi+rdx*4]
mov rdx, rcx
lea ecx, [rsi-1]
lea r8, [rax+rcx*4+4]
nop dword ptr [rax]
loc_1190:
mov esi, [rdi]
add rdx, 4
add rdi, 10h
mov [rdx-4], esi
cmp rdx, r8
jnz short loc_1190
locret_11A2:
retn | long long func0(long long a1, int a2, int a3, long long a4)
{
long long result; // rax
int *v5; // rdi
long long v6; // rdx
long long v7; // r8
int v8; // esi
result = a4;
if ( a2 > 0 )
{
v5 = (int *)(a1 + 4LL * a3);
v6 = a4;
v7 = a4 + 4LL * (unsigned int)(a2 - 1) + 4;
do
{
v8 = *v5;
v6 += 4LL;
v5 += 4;
*(_DWORD *)(v6 - 4) = v8;
}
while ( v6 != v7 );
}
return result;
} | func0:
ENDBR64
MOV RAX,RCX
TEST ESI,ESI
JLE 0x001011a2
MOVSXD RDX,EDX
LEA RDI,[RDI + RDX*0x4]
MOV RDX,RCX
LEA ECX,[RSI + -0x1]
LEA R8,[RAX + RCX*0x4 + 0x4]
NOP dword ptr [RAX]
LAB_00101190:
MOV ESI,dword ptr [RDI]
ADD RDX,0x4
ADD RDI,0x10
MOV dword ptr [RDX + -0x4],ESI
CMP RDX,R8
JNZ 0x00101190
LAB_001011a2:
RET | void func0(long param_1,int param_2,int param_3,int4 *param_4)
{
int4 uVar1;
int4 *puVar2;
int4 *puVar3;
int4 *puVar4;
if (0 < param_2) {
puVar4 = (int4 *)(param_1 + (long)param_3 * 4);
puVar2 = param_4;
do {
uVar1 = *puVar4;
puVar3 = puVar2 + 1;
puVar4 = puVar4 + 4;
*puVar2 = uVar1;
puVar2 = puVar3;
} while (puVar3 != param_4 + (ulong)(param_2 - 1) + 1);
}
return;
} |
4,511 | func0 |
#include <stdio.h>
#include <assert.h>
| int* func0(int nums[][4], int rows, int N, int* result) {
for (int i = 0; i < rows; i++) {
result[i] = nums[i][N];
}
return result;
}
| int main() {
int nums[3][4] = {{1, 2, 3, 2}, {4, 5, 6, 2}, {7, 1, 9, 5}};
int result[3];
func0(nums, 3, 0, result);
assert(result[0] == 1 && result[1] == 4 && result[2] == 7);
func0(nums, 3, 2, result);
assert(result[0] == 3 && result[1] == 6 && result[2] == 9);
func0(nums, 3, 3, result);
assert(result[0] == 2 && result[1] == 2 && result[2] == 5);
printf("All tests passed.\n");
return 0;
}
| O3 | c | func0:
endbr64
mov %rcx,%rax
test %esi,%esi
jle 1292 <func0+0x122>
movslq %esi,%r8
movslq %edx,%rcx
lea -0x1(%rsi),%r10d
lea -0x3(%rcx,%r8,4),%r9
lea (%rdi,%rcx,4),%rdx
lea (%rdi,%r9,4),%r9
lea (%rax,%r8,4),%r8
cmp %r9,%rax
setae %r9b
cmp %r8,%rdx
setae %r8b
or %r8b,%r9b
je 1278 <func0+0x108>
cmp $0x5,%r10d
jbe 1278 <func0+0x108>
mov %r10d,%r9d
mov %rax,%r8
shr $0x2,%r9d
shl $0x6,%r9
add %rdx,%r9
nopl 0x0(%rax)
movdqu (%rdx),%xmm0
movdqu 0x10(%rdx),%xmm2
add $0x40,%rdx
add $0x10,%r8
movdqu -0x20(%rdx),%xmm1
movdqu -0x10(%rdx),%xmm3
shufps $0x88,%xmm2,%xmm0
shufps $0x88,%xmm3,%xmm1
shufps $0x88,%xmm1,%xmm0
movups %xmm0,-0x10(%r8)
cmp %r9,%rdx
jne 11d0 <func0+0x60>
mov %r10d,%edx
and $0xfffffffc,%edx
mov %edx,%r9d
mov %r9,%r8
shl $0x4,%r8
add %rdi,%r8
mov (%r8,%rcx,4),%r8d
mov %r8d,(%rax,%r9,4)
lea 0x1(%rdx),%r8d
cmp %r8d,%esi
jle 1292 <func0+0x122>
movslq %r8d,%r8
mov %r8,%r9
shl $0x4,%r9
add %rdi,%r9
mov (%r9,%rcx,4),%r9d
mov %r9d,(%rax,%r8,4)
lea 0x2(%rdx),%r8d
cmp %r8d,%esi
jle 1292 <func0+0x122>
movslq %r8d,%r8
add $0x3,%edx
mov %r8,%r9
shl $0x4,%r9
add %rdi,%r9
mov (%r9,%rcx,4),%r9d
mov %r9d,(%rax,%r8,4)
cmp %edx,%esi
jle 1292 <func0+0x122>
movslq %edx,%rdx
mov %rdx,%rsi
shl $0x4,%rsi
add %rsi,%rdi
mov (%rdi,%rcx,4),%ecx
mov %ecx,(%rax,%rdx,4)
retq
nopl 0x0(%rax,%rax,1)
mov %rax,%rsi
lea 0x4(%rax,%r10,4),%rdi
mov (%rdx),%ecx
add $0x4,%rsi
add $0x10,%rdx
mov %ecx,-0x4(%rsi)
cmp %rdi,%rsi
jne 1280 <func0+0x110>
retq
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
mov r8, rdi
mov edi, esi
mov rsi, rcx
test edi, edi
jle loc_12A0
lea r9d, [rdi-1]
push rbx
movsxd r11, edi
cmp r9d, 3
jbe loc_1290
movsxd rdx, edx
lea rcx, ds:0[r11*4]
lea rbx, [rcx+rdx]
lea r10, ds:0[rdx*4]
lea rbx, [r8+rbx*4-0Ch]
lea rax, [r8+r10]
cmp rsi, rbx
jnb short loc_11F0
add rcx, rsi
cmp rax, rcx
jnb short loc_11F0
loc_11C3:
lea rdx, [r8+rdx*4]
mov rax, rsi
lea rdi, [rsi+r11*4]
xchg ax, ax
loc_11D0:
mov ecx, [rdx]
add rax, 4
add rdx, 10h
mov [rax-4], ecx
cmp rdi, rax
jnz short loc_11D0
loc_11E2:
mov rax, rsi
pop rbx
retn
loc_11F0:
mov ecx, r9d
mov rdx, rsi
shr ecx, 2
shl rcx, 6
add rcx, rax
loc_1200:
movdqu xmm0, xmmword ptr [rax]
movdqu xmm2, xmmword ptr [rax+10h]
add rax, 40h ; '@'
add rdx, 10h
movdqu xmm1, xmmword ptr [rax-20h]
movdqu xmm3, xmmword ptr [rax-10h]
shufps xmm0, xmm2, 88h
shufps xmm1, xmm3, 88h
shufps xmm0, xmm1, 88h
movups xmmword ptr [rdx-10h], xmm0
cmp rax, rcx
jnz short loc_1200
and r9d, 0FFFFFFFCh
movsxd rdx, r9d
mov rax, rdx
lea rcx, ds:0[rdx*4]
shl rax, 4
add rax, r8
add rax, r10
mov r8d, [rax]
mov [rsi+rdx*4], r8d
lea edx, [r9+1]
cmp edi, edx
jle short loc_11E2
mov edx, [rax+10h]
mov [rsi+rcx+4], edx
lea edx, [r9+2]
cmp edx, edi
jge loc_11E2
mov edx, [rax+20h]
add r9d, 3
mov [rsi+rcx+8], edx
cmp edi, r9d
jle loc_11E2
mov eax, [rax+30h]
mov [rsi+rcx+0Ch], eax
mov rax, rsi
pop rbx
retn
loc_1290:
movsxd rdx, edx
jmp loc_11C3
loc_12A0:
mov rax, rcx
retn | unsigned long long func0(long long a1, int a2, long long a3, unsigned long long a4)
{
unsigned int v7; // r9d
long long v8; // r10
const __m128i *v9; // rax
int *v10; // rdx
unsigned long long v11; // rax
unsigned long long v12; // rdi
int v13; // ecx
unsigned long long v15; // rdx
const __m128i *v16; // rcx
__m128 v17; // xmm0
__m128 v18; // xmm2
signed int v19; // r9d
long long v20; // rcx
_DWORD *v21; // rax
if ( a2 <= 0 )
return a4;
v7 = a2 - 1;
if ( (unsigned int)(a2 - 1) <= 3 )
{
a3 = (int)a3;
LABEL_5:
v10 = (int *)(a1 + 4 * a3);
v11 = a4;
v12 = a4 + 4LL * a2;
do
{
v13 = *v10;
v11 += 4LL;
v10 += 4;
*(_DWORD *)(v11 - 4) = v13;
}
while ( v12 != v11 );
return a4;
}
a3 = (int)a3;
v8 = 4LL * (int)a3;
v9 = (const __m128i *)(a1 + v8);
if ( a4 < a1 + 4 * (4LL * a2 + (int)a3) - 12 && (unsigned long long)v9 < a4 + 4LL * a2 )
goto LABEL_5;
v15 = a4;
v16 = &v9[4 * (unsigned long long)(v7 >> 2)];
do
{
v17 = (__m128)_mm_loadu_si128(v9);
v18 = (__m128)_mm_loadu_si128(v9 + 1);
v9 += 4;
v15 += 16LL;
*(__m128 *)(v15 - 16) = _mm_shuffle_ps(
_mm_shuffle_ps(v17, v18, 136),
_mm_shuffle_ps((__m128)_mm_loadu_si128(v9 - 2), (__m128)_mm_loadu_si128(v9 - 1), 136),
136);
}
while ( v9 != v16 );
v19 = v7 & 0xFFFFFFFC;
v20 = 4LL * v19;
v21 = (_DWORD *)(v8 + a1 + 16LL * v19);
*(_DWORD *)(a4 + v20) = *v21;
if ( a2 <= v19 + 1 )
return a4;
*(_DWORD *)(a4 + v20 + 4) = v21[4];
if ( v19 + 2 >= a2 )
return a4;
*(_DWORD *)(a4 + v20 + 8) = v21[8];
if ( a2 <= v19 + 3 )
return a4;
*(_DWORD *)(a4 + v20 + 12) = v21[12];
return a4;
} | func0:
ENDBR64
MOV R8,RDI
MOV EDI,ESI
MOV RSI,RCX
TEST EDI,EDI
JLE 0x001012a0
LEA R9D,[RDI + -0x1]
PUSH RBX
MOVSXD R11,EDI
CMP R9D,0x3
JBE 0x00101290
MOVSXD RDX,EDX
LEA RCX,[R11*0x4]
LEA RBX,[RCX + RDX*0x1]
LEA R10,[RDX*0x4]
LEA RBX,[R8 + RBX*0x4 + -0xc]
LEA RAX,[R8 + R10*0x1]
CMP RSI,RBX
JNC 0x001011f0
ADD RCX,RSI
CMP RAX,RCX
JNC 0x001011f0
LAB_001011c3:
LEA RDX,[R8 + RDX*0x4]
MOV RAX,RSI
LEA RDI,[RSI + R11*0x4]
NOP
LAB_001011d0:
MOV ECX,dword ptr [RDX]
ADD RAX,0x4
ADD RDX,0x10
MOV dword ptr [RAX + -0x4],ECX
CMP RDI,RAX
JNZ 0x001011d0
LAB_001011e2:
MOV RAX,RSI
POP RBX
RET
LAB_001011f0:
MOV ECX,R9D
MOV RDX,RSI
SHR ECX,0x2
SHL RCX,0x6
ADD RCX,RAX
LAB_00101200:
MOVDQU XMM0,xmmword ptr [RAX]
MOVDQU XMM2,xmmword ptr [RAX + 0x10]
ADD RAX,0x40
ADD RDX,0x10
MOVDQU XMM1,xmmword ptr [RAX + -0x20]
MOVDQU XMM3,xmmword ptr [RAX + -0x10]
SHUFPS XMM0,XMM2,0x88
SHUFPS XMM1,XMM3,0x88
SHUFPS XMM0,XMM1,0x88
MOVUPS xmmword ptr [RDX + -0x10],XMM0
CMP RAX,RCX
JNZ 0x00101200
AND R9D,0xfffffffc
MOVSXD RDX,R9D
MOV RAX,RDX
LEA RCX,[RDX*0x4]
SHL RAX,0x4
ADD RAX,R8
ADD RAX,R10
MOV R8D,dword ptr [RAX]
MOV dword ptr [RSI + RDX*0x4],R8D
LEA EDX,[R9 + 0x1]
CMP EDI,EDX
JLE 0x001011e2
MOV EDX,dword ptr [RAX + 0x10]
MOV dword ptr [RSI + RCX*0x1 + 0x4],EDX
LEA EDX,[R9 + 0x2]
CMP EDX,EDI
JGE 0x001011e2
MOV EDX,dword ptr [RAX + 0x20]
ADD R9D,0x3
MOV dword ptr [RSI + RCX*0x1 + 0x8],EDX
CMP EDI,R9D
JLE 0x001011e2
MOV EAX,dword ptr [RAX + 0x30]
MOV dword ptr [RSI + RCX*0x1 + 0xc],EAX
MOV RAX,RSI
POP RBX
RET
LAB_00101290:
MOVSXD RDX,EDX
JMP 0x001011c3
LAB_001012a0:
MOV RAX,RCX
RET | int4 * func0(long param_1,int param_2,int param_3,int4 *param_4)
{
long lVar1;
int4 uVar2;
int4 uVar3;
int4 uVar4;
int4 *puVar5;
int4 *puVar6;
int4 *puVar7;
int4 *puVar8;
uint uVar9;
long lVar10;
if (param_2 < 1) {
return param_4;
}
uVar9 = param_2 - 1;
lVar10 = (long)param_2;
if (3 < uVar9) {
lVar1 = (long)param_3 * 4;
puVar7 = (int4 *)(param_1 + lVar1);
if (((int4 *)(param_1 + -0xc + (lVar10 * 4 + (long)param_3) * 4) <= param_4) ||
(param_4 + lVar10 <= puVar7)) {
puVar5 = puVar7;
puVar8 = param_4;
do {
uVar2 = puVar5[4];
puVar6 = puVar5 + 0x10;
uVar3 = puVar5[8];
uVar4 = puVar5[0xc];
*puVar8 = *puVar5;
puVar8[1] = uVar2;
puVar8[2] = uVar3;
puVar8[3] = uVar4;
puVar5 = puVar6;
puVar8 = puVar8 + 4;
} while (puVar6 != puVar7 + (ulong)(uVar9 >> 2) * 0x10);
uVar9 = uVar9 & 0xfffffffc;
lVar10 = (long)(int)uVar9;
puVar7 = (int4 *)(lVar10 * 0x10 + param_1 + lVar1);
param_4[lVar10] = *puVar7;
if (param_2 <= (int)(uVar9 + 1)) {
return param_4;
}
param_4[lVar10 + 1] = puVar7[4];
if (param_2 <= (int)(uVar9 + 2)) {
return param_4;
}
param_4[lVar10 + 2] = puVar7[8];
if (param_2 <= (int)(uVar9 + 3)) {
return param_4;
}
param_4[lVar10 + 3] = puVar7[0xc];
return param_4;
}
}
puVar7 = (int4 *)(param_1 + (long)param_3 * 4);
puVar5 = param_4;
do {
uVar2 = *puVar7;
puVar8 = puVar5 + 1;
puVar7 = puVar7 + 4;
*puVar5 = uVar2;
puVar5 = puVar8;
} while (param_4 + lVar10 != puVar8);
return param_4;
} |
4,512 | func0 |
#include <assert.h>
| int func0(int n) {
int res = 0, count = 0, temp = n;
while (temp > 0) {
if (count % 2 == 1) {
res = res | (1 << count);
}
count++;
temp >>= 1;
}
return n ^ res;
}
| int main() {
assert(func0(10) == 0);
assert(func0(20) == 30);
assert(func0(30) == 20);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %edi,-0x14(%rbp)
movl $0x0,-0xc(%rbp)
movl $0x0,-0x8(%rbp)
mov -0x14(%rbp),%eax
mov %eax,-0x4(%rbp)
jmp 1195 <func0+0x4c>
mov -0x8(%rbp),%eax
cltd
shr $0x1f,%edx
add %edx,%eax
and $0x1,%eax
sub %edx,%eax
cmp $0x1,%eax
jne 118e <func0+0x45>
mov -0x8(%rbp),%eax
mov $0x1,%edx
mov %eax,%ecx
shl %cl,%edx
mov %edx,%eax
or %eax,-0xc(%rbp)
addl $0x1,-0x8(%rbp)
sarl -0x4(%rbp)
cmpl $0x0,-0x4(%rbp)
jg 116a <func0+0x21>
mov -0x14(%rbp),%eax
xor -0xc(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_14], edi
mov [rbp+var_C], 0
mov [rbp+var_8], 0
mov eax, [rbp+var_14]
mov [rbp+var_4], eax
jmp short loc_119B
loc_116A:
mov edx, [rbp+var_8]
mov eax, edx
sar eax, 1Fh
shr eax, 1Fh
add edx, eax
and edx, 1
sub edx, eax
mov eax, edx
cmp eax, 1
jnz short loc_1194
mov eax, [rbp+var_8]
mov edx, 1
mov ecx, eax
shl edx, cl
mov eax, edx
or [rbp+var_C], eax
loc_1194:
add [rbp+var_8], 1
sar [rbp+var_4], 1
loc_119B:
cmp [rbp+var_4], 0
jg short loc_116A
mov eax, [rbp+var_14]
xor eax, [rbp+var_C]
pop rbp
retn | long long func0(int a1)
{
int v2; // [rsp+8h] [rbp-Ch]
int v3; // [rsp+Ch] [rbp-8h]
int i; // [rsp+10h] [rbp-4h]
v2 = 0;
v3 = 0;
for ( i = a1; i > 0; i >>= 1 )
{
if ( v3 % 2 == 1 )
v2 |= 1 << v3;
++v3;
}
return v2 ^ (unsigned int)a1;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV dword ptr [RBP + -0x14],EDI
MOV dword ptr [RBP + -0xc],0x0
MOV dword ptr [RBP + -0x8],0x0
MOV EAX,dword ptr [RBP + -0x14]
MOV dword ptr [RBP + -0x4],EAX
JMP 0x0010119b
LAB_0010116a:
MOV EDX,dword ptr [RBP + -0x8]
MOV EAX,EDX
SAR EAX,0x1f
SHR EAX,0x1f
ADD EDX,EAX
AND EDX,0x1
SUB EDX,EAX
MOV EAX,EDX
CMP EAX,0x1
JNZ 0x00101194
MOV EAX,dword ptr [RBP + -0x8]
MOV EDX,0x1
MOV ECX,EAX
SHL EDX,CL
MOV EAX,EDX
OR dword ptr [RBP + -0xc],EAX
LAB_00101194:
ADD dword ptr [RBP + -0x8],0x1
SAR dword ptr [RBP + -0x4],0x1
LAB_0010119b:
CMP dword ptr [RBP + -0x4],0x0
JG 0x0010116a
MOV EAX,dword ptr [RBP + -0x14]
XOR EAX,dword ptr [RBP + -0xc]
POP RBP
RET | uint func0(uint param_1)
{
int4 local_14;
int4 local_10;
int4 local_c;
local_14 = 0;
local_10 = 0;
for (local_c = param_1; 0 < (int)local_c; local_c = (int)local_c >> 1) {
if (local_10 % 2 == 1) {
local_14 = local_14 | 1 << ((byte)local_10 & 0x1f);
}
local_10 = local_10 + 1;
}
return param_1 ^ local_14;
} |
4,513 | func0 |
#include <assert.h>
| int func0(int n) {
int res = 0, count = 0, temp = n;
while (temp > 0) {
if (count % 2 == 1) {
res = res | (1 << count);
}
count++;
temp >>= 1;
}
return n ^ res;
}
| int main() {
assert(func0(10) == 0);
assert(func0(20) == 30);
assert(func0(30) == 20);
return 0;
}
| O1 | c | func0:
endbr64
mov %edi,%r10d
mov %edi,%esi
mov $0x0,%ecx
mov $0x0,%eax
mov $0x1,%r9d
test %edi,%edi
jle 1193 <func0+0x4a>
add $0x1,%ecx
sar %esi
test %esi,%esi
jle 1193 <func0+0x4a>
mov %ecx,%r8d
shr $0x1f,%r8d
lea (%rcx,%r8,1),%edx
and $0x1,%edx
sub %r8d,%edx
mov %eax,%r8d
mov %r9d,%edi
shl %cl,%edi
or %edi,%eax
cmp $0x1,%edx
cmovne %r8d,%eax
jmp 1166 <func0+0x1d>
xor %r10d,%eax
retq
| func0:
endbr64
mov eax, edi
mov r8d, edi
mov ecx, 0
mov esi, 0
mov r11d, 1
test edi, edi
jg short loc_118C
jmp short loc_1197
loc_1168:
mov r9d, ecx
shr r9d, 1Fh
lea edx, [rcx+r9]
and edx, 1
sub edx, r9d
mov r9d, esi
mov r10d, r11d
shl r10d, cl
or esi, r10d
cmp edx, 1
cmovnz esi, r9d
loc_118C:
add ecx, 1
sar r8d, 1
test r8d, r8d
jg short loc_1168
loc_1197:
xor eax, esi
retn | long long func0(int a1)
{
int v1; // r8d
int v2; // ecx
int v3; // esi
int v4; // r9d
v1 = a1;
v2 = 0;
v3 = 0;
if ( a1 > 0 )
{
while ( 1 )
{
++v2;
v1 >>= 1;
if ( v1 <= 0 )
break;
v4 = v3;
v3 |= 1 << v2;
if ( v2 % 2 != 1 )
v3 = v4;
}
}
return v3 ^ (unsigned int)a1;
} | func0:
ENDBR64
MOV EAX,EDI
MOV R8D,EDI
MOV ECX,0x0
MOV ESI,0x0
MOV R11D,0x1
TEST EDI,EDI
JG 0x0010118c
JMP 0x00101197
LAB_00101168:
MOV R9D,ECX
SHR R9D,0x1f
LEA EDX,[RCX + R9*0x1]
AND EDX,0x1
SUB EDX,R9D
MOV R9D,ESI
MOV R10D,R11D
SHL R10D,CL
OR ESI,R10D
CMP EDX,0x1
CMOVNZ ESI,R9D
LAB_0010118c:
ADD ECX,0x1
SAR R8D,0x1
TEST R8D,R8D
JG 0x00101168
LAB_00101197:
XOR EAX,ESI
RET | uint func0(uint param_1)
{
uint uVar1;
int iVar2;
uint uVar3;
uint uVar4;
iVar2 = 0;
uVar3 = 0;
uVar4 = param_1;
uVar1 = uVar3;
if (0 < (int)param_1) {
while( true ) {
uVar3 = uVar1;
iVar2 = iVar2 + 1;
uVar4 = (int)uVar4 >> 1;
if ((int)uVar4 < 1) break;
uVar1 = uVar3 | 1 << ((byte)iVar2 & 0x1f);
if (iVar2 % 2 != 1) {
uVar1 = uVar3;
}
}
}
return param_1 ^ uVar3;
} |
4,514 | func0 |
#include <assert.h>
| int func0(int n) {
int res = 0, count = 0, temp = n;
while (temp > 0) {
if (count % 2 == 1) {
res = res | (1 << count);
}
count++;
temp >>= 1;
}
return n ^ res;
}
| int main() {
assert(func0(10) == 0);
assert(func0(20) == 30);
assert(func0(30) == 20);
return 0;
}
| O2 | c | func0:
endbr64
mov %edi,%edx
xor %ecx,%ecx
xor %eax,%eax
mov $0x1,%r8d
test %edi,%edi
jle 1178 <func0+0x38>
add $0x1,%ecx
sar %edx
je 116e <func0+0x2e>
test $0x1,%cl
je 1154 <func0+0x14>
mov %r8d,%esi
shl %cl,%esi
add $0x1,%ecx
or %esi,%eax
sar %edx
jne 115b <func0+0x1b>
xor %edi,%eax
retq
nopl 0x0(%rax)
mov %edi,%eax
retq
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
mov edx, edi
xor ecx, ecx
xor eax, eax
mov r8d, 1
test edi, edi
jle short loc_1228
nop dword ptr [rax+00h]
loc_1208:
add ecx, 1
sar edx, 1
jz short loc_1222
loc_120F:
test cl, 1
jz short loc_1208
mov esi, r8d
shl esi, cl
add ecx, 1
or eax, esi
sar edx, 1
jnz short loc_120F
loc_1222:
xor eax, edi
retn
loc_1228:
mov eax, edi
retn | long long func0(int a1)
{
int v1; // edx
int v2; // ecx
unsigned int v3; // eax
int v4; // esi
v1 = a1;
v2 = 0;
v3 = 0;
if ( a1 <= 0 )
return (unsigned int)a1;
while ( 1 )
{
++v2;
v1 >>= 1;
if ( !v1 )
break;
while ( (v2 & 1) != 0 )
{
v4 = 1 << v2++;
v3 |= v4;
v1 >>= 1;
if ( !v1 )
return a1 ^ v3;
}
}
return a1 ^ v3;
} | func0:
ENDBR64
MOV EDX,EDI
XOR ECX,ECX
XOR EAX,EAX
MOV R8D,0x1
TEST EDI,EDI
JLE 0x00101228
NOP dword ptr [RAX]
LAB_00101208:
ADD ECX,0x1
SAR EDX,0x1
JZ 0x00101222
LAB_0010120f:
TEST CL,0x1
JZ 0x00101208
MOV ESI,R8D
SHL ESI,CL
ADD ECX,0x1
OR EAX,ESI
SAR EDX,0x1
JNZ 0x0010120f
LAB_00101222:
XOR EAX,EDI
RET
LAB_00101228:
MOV EAX,EDI
RET | uint func0(uint param_1)
{
bool bVar1;
uint uVar2;
uint uVar3;
bVar1 = false;
uVar2 = 0;
uVar3 = param_1;
if ((int)param_1 < 1) {
return param_1;
}
while (uVar3 = (int)uVar3 >> 1, uVar3 != 0) {
while( true ) {
bVar1 = (bool)(bVar1 ^ 1);
if (!bVar1) break;
uVar2 = uVar2 | 1 << bVar1;
uVar3 = (int)uVar3 >> 1;
if (uVar3 == 0) goto LAB_00101222;
}
}
LAB_00101222:
return uVar2 ^ param_1;
} |
4,515 | func0 |
#include <assert.h>
| int func0(int n) {
int res = 0, count = 0, temp = n;
while (temp > 0) {
if (count % 2 == 1) {
res = res | (1 << count);
}
count++;
temp >>= 1;
}
return n ^ res;
}
| int main() {
assert(func0(10) == 0);
assert(func0(20) == 30);
assert(func0(30) == 20);
return 0;
}
| O3 | c | func0:
endbr64
test %edi,%edi
jle 1180 <func0+0x40>
mov %edi,%edx
sar %edx
je 1188 <func0+0x48>
mov $0x1,%ecx
xor %eax,%eax
mov $0x1,%r8d
nopl 0x0(%rax,%rax,1)
test $0x1,%cl
je 116c <func0+0x2c>
mov %r8d,%esi
shl %cl,%esi
or %esi,%eax
add $0x1,%ecx
sar %edx
jne 1160 <func0+0x20>
xor %edi,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
mov %edi,%eax
retq
nopl 0x0(%rax,%rax,1)
xor %eax,%eax
jmp 1173 <func0+0x33>
nopl 0x0(%rax)
| func0:
endbr64
test edi, edi
jle short loc_1178
mov edx, edi
xor ecx, ecx
xor esi, esi
mov eax, 1
nop dword ptr [rax+rax+00h]
loc_1158:
test cl, 1
jz short loc_1166
mov r8d, eax
shl r8d, cl
or esi, r8d
loc_1166:
add ecx, 1
sar edx, 1
jnz short loc_1158
mov eax, edi
xor eax, esi
retn
loc_1178:
mov eax, edi
retn | long long func0(int a1)
{
int v1; // edx
char v2; // cl
int v3; // esi
if ( a1 <= 0 )
return (unsigned int)a1;
v1 = a1;
v2 = 0;
v3 = 0;
do
{
if ( (v2 & 1) != 0 )
v3 |= 1 << v2;
++v2;
v1 >>= 1;
}
while ( v1 );
return v3 ^ (unsigned int)a1;
} | func0:
ENDBR64
TEST EDI,EDI
JLE 0x00101178
MOV EDX,EDI
XOR ECX,ECX
XOR ESI,ESI
MOV EAX,0x1
NOP dword ptr [RAX + RAX*0x1]
LAB_00101158:
TEST CL,0x1
JZ 0x00101166
MOV R8D,EAX
SHL R8D,CL
OR ESI,R8D
LAB_00101166:
ADD ECX,0x1
SAR EDX,0x1
JNZ 0x00101158
MOV EAX,EDI
XOR EAX,ESI
RET
LAB_00101178:
MOV EAX,EDI
RET | uint func0(uint param_1)
{
byte bVar1;
uint uVar2;
uint uVar3;
if (0 < (int)param_1) {
bVar1 = 0;
uVar3 = 0;
uVar2 = param_1;
do {
if ((bool)(bVar1 & 1)) {
uVar3 = uVar3 | 1 << (bVar1 & 0x1f);
}
bVar1 = bVar1 + 1;
uVar2 = (int)uVar2 >> 1;
} while (uVar2 != 0);
return param_1 ^ uVar3;
}
return param_1;
} |
4,516 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdlib.h> // for atoi
typedef struct {
int first;
int second;
} TupleInt;
| void func0(const char *tuple_str[], int size, TupleInt result[]) {
for (int i = 0; i < size; i++) {
result[i].first = atoi(tuple_str[2 * i]);
result[i].second = atoi(tuple_str[2 * i + 1]);
}
}
| int main() {
const char *input1[] = {"333", "33", "1416", "55"};
TupleInt result1[2];
func0(input1, 2, result1);
assert(result1[0].first == 333 && result1[0].second == 33);
assert(result1[1].first == 1416 && result1[1].second == 55);
const char *input2[] = {"999", "99", "1000", "500"};
TupleInt result2[2];
func0(input2, 2, result2);
assert(result2[0].first == 999 && result2[0].second == 99);
assert(result2[1].first == 1000 && result2[1].second == 500);
const char *input3[] = {"666", "66", "1500", "555"};
TupleInt result3[2];
func0(input3, 2, result3);
assert(result3[0].first == 666 && result3[0].second == 66);
assert(result3[1].first == 1500 && result3[1].second == 555);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
sub $0x38,%rsp
mov %rdi,-0x28(%rbp)
mov %esi,-0x2c(%rbp)
mov %rdx,-0x38(%rbp)
movl $0x0,-0x14(%rbp)
jmp 1225 <func0+0x9c>
mov -0x14(%rbp),%eax
add %eax,%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
mov (%rax),%rax
mov -0x14(%rbp),%edx
movslq %edx,%rdx
lea 0x0(,%rdx,8),%rcx
mov -0x38(%rbp),%rdx
lea (%rcx,%rdx,1),%rbx
mov %rax,%rdi
callq 1090 <atoi@plt>
mov %eax,(%rbx)
mov -0x14(%rbp),%eax
add %eax,%eax
cltq
add $0x1,%rax
lea 0x0(,%rax,8),%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
mov (%rax),%rax
mov -0x14(%rbp),%edx
movslq %edx,%rdx
lea 0x0(,%rdx,8),%rcx
mov -0x38(%rbp),%rdx
lea (%rcx,%rdx,1),%rbx
mov %rax,%rdi
callq 1090 <atoi@plt>
mov %eax,0x4(%rbx)
addl $0x1,-0x14(%rbp)
mov -0x14(%rbp),%eax
cmp -0x2c(%rbp),%eax
jl 11aa <func0+0x21>
add $0x38,%rsp
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
push rbx
sub rsp, 38h
mov [rbp+var_28], rdi
mov [rbp+var_2C], esi
mov [rbp+var_38], rdx
mov [rbp+var_14], 0
jmp short loc_1225
loc_11AA:
mov eax, [rbp+var_14]
add eax, eax
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_28]
add rax, rdx
mov rax, [rax]
mov edx, [rbp+var_14]
movsxd rdx, edx
lea rcx, ds:0[rdx*8]
mov rdx, [rbp+var_38]
lea rbx, [rcx+rdx]
mov rdi, rax; nptr
call _atoi
mov [rbx], eax
mov eax, [rbp+var_14]
add eax, eax
cdqe
add rax, 1
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_28]
add rax, rdx
mov rax, [rax]
mov edx, [rbp+var_14]
movsxd rdx, edx
lea rcx, ds:0[rdx*8]
mov rdx, [rbp+var_38]
lea rbx, [rcx+rdx]
mov rdi, rax; nptr
call _atoi
mov [rbx+4], eax
add [rbp+var_14], 1
loc_1225:
mov eax, [rbp+var_14]
cmp eax, [rbp+var_2C]
jl loc_11AA
nop
nop
mov rbx, [rbp+var_8]
leave
retn | long long func0(long long a1, int a2, long long a3)
{
long long result; // rax
unsigned int i; // [rsp+2Ch] [rbp-14h]
for ( i = 0; ; ++i )
{
result = i;
if ( (int)i >= a2 )
break;
*(_DWORD *)(8LL * (int)i + a3) = atoi(*(const char **)(8LL * (int)(2 * i) + a1));
*(_DWORD *)(8LL * (int)i + a3 + 4) = atoi(*(const char **)(8 * ((int)(2 * i) + 1LL) + a1));
}
return result;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
PUSH RBX
SUB RSP,0x38
MOV qword ptr [RBP + -0x28],RDI
MOV dword ptr [RBP + -0x2c],ESI
MOV qword ptr [RBP + -0x38],RDX
MOV dword ptr [RBP + -0x14],0x0
JMP 0x00101225
LAB_001011aa:
MOV EAX,dword ptr [RBP + -0x14]
ADD EAX,EAX
CDQE
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOV RAX,qword ptr [RAX]
MOV EDX,dword ptr [RBP + -0x14]
MOVSXD RDX,EDX
LEA RCX,[RDX*0x8]
MOV RDX,qword ptr [RBP + -0x38]
LEA RBX,[RCX + RDX*0x1]
MOV RDI,RAX
CALL 0x00101090
MOV dword ptr [RBX],EAX
MOV EAX,dword ptr [RBP + -0x14]
ADD EAX,EAX
CDQE
ADD RAX,0x1
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOV RAX,qword ptr [RAX]
MOV EDX,dword ptr [RBP + -0x14]
MOVSXD RDX,EDX
LEA RCX,[RDX*0x8]
MOV RDX,qword ptr [RBP + -0x38]
LEA RBX,[RCX + RDX*0x1]
MOV RDI,RAX
CALL 0x00101090
MOV dword ptr [RBX + 0x4],EAX
ADD dword ptr [RBP + -0x14],0x1
LAB_00101225:
MOV EAX,dword ptr [RBP + -0x14]
CMP EAX,dword ptr [RBP + -0x2c]
JL 0x001011aa
NOP
NOP
MOV RBX,qword ptr [RBP + -0x8]
LEAVE
RET | void func0(long param_1,int param_2,long param_3)
{
int iVar1;
int4 local_1c;
for (local_1c = 0; local_1c < param_2; local_1c = local_1c + 1) {
iVar1 = atoi(*(char **)(param_1 + (long)(local_1c * 2) * 8));
*(int *)((long)local_1c * 8 + param_3) = iVar1;
iVar1 = atoi(*(char **)(param_1 + ((long)(local_1c * 2) + 1) * 8));
*(int *)((long)local_1c * 8 + param_3 + 4) = iVar1;
}
return;
} |
4,517 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdlib.h> // for atoi
typedef struct {
int first;
int second;
} TupleInt;
| void func0(const char *tuple_str[], int size, TupleInt result[]) {
for (int i = 0; i < size; i++) {
result[i].first = atoi(tuple_str[2 * i]);
result[i].second = atoi(tuple_str[2 * i + 1]);
}
}
| int main() {
const char *input1[] = {"333", "33", "1416", "55"};
TupleInt result1[2];
func0(input1, 2, result1);
assert(result1[0].first == 333 && result1[0].second == 33);
assert(result1[1].first == 1416 && result1[1].second == 55);
const char *input2[] = {"999", "99", "1000", "500"};
TupleInt result2[2];
func0(input2, 2, result2);
assert(result2[0].first == 999 && result2[0].second == 99);
assert(result2[1].first == 1000 && result2[1].second == 500);
const char *input3[] = {"666", "66", "1500", "555"};
TupleInt result3[2];
func0(input3, 2, result3);
assert(result3[0].first == 666 && result3[0].second == 66);
assert(result3[1].first == 1500 && result3[1].second == 555);
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 11e6 <func0+0x5d>
push %r12
push %rbp
push %rbx
lea 0x8(%rdi),%rbx
lea 0x4(%rdx),%rbp
lea -0x1(%rsi),%eax
shl $0x4,%rax
lea 0x18(%rdi,%rax,1),%r12
mov -0x8(%rbx),%rdi
mov $0xa,%edx
mov $0x0,%esi
callq 1090 <strtol@plt>
mov %eax,-0x4(%rbp)
mov $0xa,%edx
mov $0x0,%esi
mov (%rbx),%rdi
callq 1090 <strtol@plt>
mov %eax,0x0(%rbp)
add $0x10,%rbx
add $0x8,%rbp
cmp %r12,%rbx
jne 11a9 <func0+0x20>
pop %rbx
pop %rbp
pop %r12
retq
retq
| func0:
endbr64
test esi, esi
jle short locret_11E6
push r12
push rbp
push rbx
lea rbx, [rdi+8]
lea rbp, [rdx+4]
lea eax, [rsi-1]
shl rax, 4
lea r12, [rdi+rax+18h]
loc_11A9:
mov rdi, [rbx-8]
mov edx, 0Ah
mov esi, 0
call _strtol
mov [rbp-4], eax
mov edx, 0Ah
mov esi, 0
mov rdi, [rbx]
call _strtol
mov [rbp+0], eax
add rbx, 10h
add rbp, 8
cmp rbx, r12
jnz short loc_11A9
pop rbx
pop rbp
pop r12
retn
locret_11E6:
retn | void func0(long long a1, int a2, long long a3)
{
_QWORD *v3; // rbx
_DWORD *v4; // rbp
if ( a2 > 0 )
{
v3 = (_QWORD *)(a1 + 8);
v4 = (_DWORD *)(a3 + 4);
do
{
*(v4 - 1) = strtol(*(v3 - 1), 0LL, 10LL);
*v4 = strtol(*v3, 0LL, 10LL);
v3 += 2;
v4 += 2;
}
while ( v3 != (_QWORD *)(a1 + 16LL * (unsigned int)(a2 - 1) + 24) );
}
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001011e6
PUSH R12
PUSH RBP
PUSH RBX
LEA RBX,[RDI + 0x8]
LEA RBP,[RDX + 0x4]
LEA EAX,[RSI + -0x1]
SHL RAX,0x4
LEA R12,[RDI + RAX*0x1 + 0x18]
LAB_001011a9:
MOV RDI,qword ptr [RBX + -0x8]
MOV EDX,0xa
MOV ESI,0x0
CALL 0x00101090
MOV dword ptr [RBP + -0x4],EAX
MOV EDX,0xa
MOV ESI,0x0
MOV RDI,qword ptr [RBX]
CALL 0x00101090
MOV dword ptr [RBP],EAX
ADD RBX,0x10
ADD RBP,0x8
CMP RBX,R12
JNZ 0x001011a9
POP RBX
POP RBP
POP R12
RET
LAB_001011e6:
RET | void func0(long param_1,int param_2,long param_3)
{
long lVar1;
int8 *puVar2;
int4 *puVar3;
if (0 < param_2) {
puVar2 = (int8 *)(param_1 + 8);
puVar3 = (int4 *)(param_3 + 4);
do {
lVar1 = strtol((char *)puVar2[-1],(char **)0x0,10);
puVar3[-1] = (int)lVar1;
lVar1 = strtol((char *)*puVar2,(char **)0x0,10);
*puVar3 = (int)lVar1;
puVar2 = puVar2 + 2;
puVar3 = puVar3 + 2;
} while (puVar2 != (int8 *)(param_1 + 0x18 + (ulong)(param_2 - 1) * 0x10));
return;
}
return;
} |
4,518 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdlib.h> // for atoi
typedef struct {
int first;
int second;
} TupleInt;
| void func0(const char *tuple_str[], int size, TupleInt result[]) {
for (int i = 0; i < size; i++) {
result[i].first = atoi(tuple_str[2 * i]);
result[i].second = atoi(tuple_str[2 * i + 1]);
}
}
| int main() {
const char *input1[] = {"333", "33", "1416", "55"};
TupleInt result1[2];
func0(input1, 2, result1);
assert(result1[0].first == 333 && result1[0].second == 33);
assert(result1[1].first == 1416 && result1[1].second == 55);
const char *input2[] = {"999", "99", "1000", "500"};
TupleInt result2[2];
func0(input2, 2, result2);
assert(result2[0].first == 999 && result2[0].second == 99);
assert(result2[1].first == 1000 && result2[1].second == 500);
const char *input3[] = {"666", "66", "1500", "555"};
TupleInt result3[2];
func0(input3, 2, result3);
assert(result3[0].first == 666 && result3[0].second == 66);
assert(result3[1].first == 1500 && result3[1].second == 555);
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 1450 <func0+0x60>
lea -0x1(%rsi),%eax
push %r12
shl $0x4,%rax
push %rbp
lea 0x4(%rdx),%rbp
push %rbx
lea 0x18(%rdi,%rax,1),%r12
lea 0x8(%rdi),%rbx
mov -0x8(%rbx),%rdi
mov $0xa,%edx
xor %esi,%esi
add $0x10,%rbx
add $0x8,%rbp
callq 1090 <strtol@plt>
mov -0x10(%rbx),%rdi
mov $0xa,%edx
xor %esi,%esi
mov %eax,-0xc(%rbp)
callq 1090 <strtol@plt>
mov %eax,-0x8(%rbp)
cmp %r12,%rbx
jne 1410 <func0+0x20>
pop %rbx
pop %rbp
pop %r12
retq
nopl 0x0(%rax,%rax,1)
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short locret_1450
lea eax, [rsi-1]
push r12
shl rax, 4
push rbp
lea rbp, [rdx+4]
push rbx
lea r12, [rdi+rax+18h]
lea rbx, [rdi+8]
loc_1410:
mov rdi, [rbx-8]
mov edx, 0Ah
xor esi, esi
add rbx, 10h
add rbp, 8
call _strtol
mov rdi, [rbx-10h]
mov edx, 0Ah
xor esi, esi
mov [rbp-0Ch], eax
call _strtol
mov [rbp-8], eax
cmp rbx, r12
jnz short loc_1410
pop rbx
pop rbp
pop r12
retn
locret_1450:
retn | void func0(long long a1, int a2, long long a3)
{
long long v3; // rbp
long long v4; // r12
long long v5; // rbx
long long v6; // rdi
int v7; // eax
long long v8; // rdi
if ( a2 > 0 )
{
v3 = a3 + 4;
v4 = a1 + 16LL * (unsigned int)(a2 - 1) + 24;
v5 = a1 + 8;
do
{
v6 = *(_QWORD *)(v5 - 8);
v5 += 16LL;
v3 += 8LL;
v7 = strtol(v6, 0LL, 10LL);
v8 = *(_QWORD *)(v5 - 16);
*(_DWORD *)(v3 - 12) = v7;
*(_DWORD *)(v3 - 8) = strtol(v8, 0LL, 10LL);
}
while ( v5 != v4 );
}
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101450
LEA EAX,[RSI + -0x1]
PUSH R12
SHL RAX,0x4
PUSH RBP
LEA RBP,[RDX + 0x4]
PUSH RBX
LEA R12,[RDI + RAX*0x1 + 0x18]
LEA RBX,[RDI + 0x8]
LAB_00101410:
MOV RDI,qword ptr [RBX + -0x8]
MOV EDX,0xa
XOR ESI,ESI
ADD RBX,0x10
ADD RBP,0x8
CALL 0x00101090
MOV RDI,qword ptr [RBX + -0x10]
MOV EDX,0xa
XOR ESI,ESI
MOV dword ptr [RBP + -0xc],EAX
CALL 0x00101090
MOV dword ptr [RBP + -0x8],EAX
CMP RBX,R12
JNZ 0x00101410
POP RBX
POP RBP
POP R12
RET
LAB_00101450:
RET | void func0(long param_1,int param_2,long param_3)
{
char *__nptr;
long lVar1;
int8 *puVar2;
int8 *puVar3;
int4 *puVar4;
if (0 < param_2) {
puVar2 = (int8 *)(param_1 + 8);
puVar4 = (int4 *)(param_3 + 4);
do {
puVar3 = puVar2 + 2;
lVar1 = strtol((char *)puVar2[-1],(char **)0x0,10);
__nptr = (char *)*puVar2;
puVar4[-1] = (int)lVar1;
lVar1 = strtol(__nptr,(char **)0x0,10);
*puVar4 = (int)lVar1;
puVar2 = puVar3;
puVar4 = puVar4 + 2;
} while (puVar3 != (int8 *)(param_1 + 0x18 + (ulong)(param_2 - 1) * 0x10));
return;
}
return;
} |
4,519 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdlib.h> // for atoi
typedef struct {
int first;
int second;
} TupleInt;
| void func0(const char *tuple_str[], int size, TupleInt result[]) {
for (int i = 0; i < size; i++) {
result[i].first = atoi(tuple_str[2 * i]);
result[i].second = atoi(tuple_str[2 * i + 1]);
}
}
| int main() {
const char *input1[] = {"333", "33", "1416", "55"};
TupleInt result1[2];
func0(input1, 2, result1);
assert(result1[0].first == 333 && result1[0].second == 33);
assert(result1[1].first == 1416 && result1[1].second == 55);
const char *input2[] = {"999", "99", "1000", "500"};
TupleInt result2[2];
func0(input2, 2, result2);
assert(result2[0].first == 999 && result2[0].second == 99);
assert(result2[1].first == 1000 && result2[1].second == 500);
const char *input3[] = {"666", "66", "1500", "555"};
TupleInt result3[2];
func0(input3, 2, result3);
assert(result3[0].first == 666 && result3[0].second == 66);
assert(result3[1].first == 1500 && result3[1].second == 555);
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 1480 <func0+0x60>
lea -0x1(%rsi),%eax
push %r12
shl $0x4,%rax
push %rbp
lea 0x4(%rdx),%rbp
push %rbx
lea 0x18(%rdi,%rax,1),%r12
lea 0x8(%rdi),%rbx
mov -0x8(%rbx),%rdi
mov $0xa,%edx
xor %esi,%esi
add $0x10,%rbx
add $0x8,%rbp
callq 1090 <strtol@plt>
mov -0x10(%rbx),%rdi
mov $0xa,%edx
xor %esi,%esi
mov %eax,-0xc(%rbp)
callq 1090 <strtol@plt>
mov %eax,-0x8(%rbp)
cmp %rbx,%r12
jne 1440 <func0+0x20>
pop %rbx
pop %rbp
pop %r12
retq
nopl 0x0(%rax,%rax,1)
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short locret_1480
movsxd rsi, esi
push r12
shl rsi, 4
push rbp
lea rbp, [rdx+4]
push rbx
lea r12, [rdi+rsi]
mov rbx, rdi
xchg ax, ax
loc_1440:
mov rdi, [rbx]; nptr
mov edx, 0Ah; base
xor esi, esi; endptr
add rbx, 10h
add rbp, 8
call _strtol
mov rdi, [rbx-8]; nptr
mov edx, 0Ah; base
xor esi, esi; endptr
mov [rbp-0Ch], eax
call _strtol
mov [rbp-8], eax
cmp r12, rbx
jnz short loc_1440
pop rbx
pop rbp
pop r12
retn
locret_1480:
retn | void func0(const char **a1, int a2, long long a3)
{
long long v3; // rbp
const char **v4; // r12
const char **v5; // rbx
const char *v6; // rdi
int v7; // eax
const char *v8; // rdi
if ( a2 > 0 )
{
v3 = a3 + 4;
v4 = &a1[2 * a2];
v5 = a1;
do
{
v6 = *v5;
v5 += 2;
v3 += 8LL;
v7 = strtol(v6, 0LL, 10);
v8 = *(v5 - 1);
*(_DWORD *)(v3 - 12) = v7;
*(_DWORD *)(v3 - 8) = strtol(v8, 0LL, 10);
}
while ( v4 != v5 );
}
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101480
MOVSXD RSI,ESI
PUSH R12
SHL RSI,0x4
PUSH RBP
LEA RBP,[RDX + 0x4]
PUSH RBX
LEA R12,[RDI + RSI*0x1]
MOV RBX,RDI
NOP
LAB_00101440:
MOV RDI,qword ptr [RBX]
MOV EDX,0xa
XOR ESI,ESI
ADD RBX,0x10
ADD RBP,0x8
CALL 0x00101090
MOV RDI,qword ptr [RBX + -0x8]
MOV EDX,0xa
XOR ESI,ESI
MOV dword ptr [RBP + -0xc],EAX
CALL 0x00101090
MOV dword ptr [RBP + -0x8],EAX
CMP R12,RBX
JNZ 0x00101440
POP RBX
POP RBP
POP R12
RET
LAB_00101480:
RET | void func0(int8 *param_1,int param_2,long param_3)
{
char *__nptr;
long lVar1;
int8 *puVar2;
int8 *puVar3;
int4 *puVar4;
if (0 < param_2) {
puVar2 = param_1;
puVar4 = (int4 *)(param_3 + 4);
do {
puVar3 = puVar2 + 2;
lVar1 = strtol((char *)*puVar2,(char **)0x0,10);
__nptr = (char *)puVar2[1];
puVar4[-1] = (int)lVar1;
lVar1 = strtol(__nptr,(char **)0x0,10);
*puVar4 = (int)lVar1;
puVar2 = puVar3;
puVar4 = puVar4 + 2;
} while (param_1 + (long)param_2 * 2 != puVar3);
return;
}
return;
} |
4,520 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
struct Pair {
int count;
char value;
};
| struct Pair* func0(char *list1, int *returnSize) {
struct Pair *result = (struct Pair *)malloc(sizeof(struct Pair) * strlen(list1));
char current = list1[0];
int count = 1;
int res_idx = 0;
for (int i = 1; list1[i] != '\0'; i++) {
if (list1[i] == current) {
count++;
} else {
result[res_idx].count = count;
result[res_idx].value = current;
res_idx++;
current = list1[i];
count = 1;
}
}
result[res_idx].count = count;
result[res_idx].value = current;
res_idx++;
*returnSize = res_idx;
return result;
}
| int main() {
int size1, size2, size3;
struct Pair *encoded1 = func0("11234", &size1);
assert(size1 == 4 && encoded1[0].count == 2 && encoded1[0].value == '1' &&
encoded1[1].count == 1 && encoded1[1].value == '2' &&
encoded1[2].count == 1 && encoded1[2].value == '3' &&
encoded1[3].count == 1 && encoded1[3].value == '4');
struct Pair *encoded2 = func0("automatically", &size2);
assert(size2 == 12 && encoded2[10].count == 2 && encoded2[10].value == 'l');
struct Pair *encoded3 = func0("python", &size3);
assert(size3 == 6 && encoded3[0].count == 1 && encoded3[0].value == 'p');
free(encoded1);
free(encoded2);
free(encoded3);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x30,%rsp
mov %rdi,-0x28(%rbp)
mov %rsi,-0x30(%rbp)
mov -0x28(%rbp),%rax
mov %rax,%rdi
callq 10a0 <strlen@plt>
shl $0x3,%rax
mov %rax,%rdi
callq 10d0 <malloc@plt>
mov %rax,-0x8(%rbp)
mov -0x28(%rbp),%rax
movzbl (%rax),%eax
mov %al,-0x15(%rbp)
movl $0x1,-0x14(%rbp)
movl $0x0,-0x10(%rbp)
movl $0x1,-0xc(%rbp)
jmp 128b <func0+0xc2>
mov -0xc(%rbp),%eax
movslq %eax,%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
cmp %al,-0x15(%rbp)
jne 1235 <func0+0x6c>
addl $0x1,-0x14(%rbp)
jmp 1287 <func0+0xbe>
mov -0x10(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x8(%rbp),%rax
add %rax,%rdx
mov -0x14(%rbp),%eax
mov %eax,(%rdx)
mov -0x10(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x8(%rbp),%rax
add %rax,%rdx
movzbl -0x15(%rbp),%eax
mov %al,0x4(%rdx)
addl $0x1,-0x10(%rbp)
mov -0xc(%rbp),%eax
movslq %eax,%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
mov %al,-0x15(%rbp)
movl $0x1,-0x14(%rbp)
addl $0x1,-0xc(%rbp)
mov -0xc(%rbp),%eax
movslq %eax,%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
test %al,%al
jne 121a <func0+0x51>
mov -0x10(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x8(%rbp),%rax
add %rax,%rdx
mov -0x14(%rbp),%eax
mov %eax,(%rdx)
mov -0x10(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x8(%rbp),%rax
add %rax,%rdx
movzbl -0x15(%rbp),%eax
mov %al,0x4(%rdx)
addl $0x1,-0x10(%rbp)
mov -0x30(%rbp),%rax
mov -0x10(%rbp),%edx
mov %edx,(%rax)
mov -0x8(%rbp),%rax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 30h
mov [rbp+s], rdi
mov [rbp+var_30], rsi
mov rax, [rbp+s]
mov rdi, rax; s
call _strlen
shl rax, 3
mov rdi, rax; size
call _malloc
mov [rbp+var_8], rax
mov rax, [rbp+s]
movzx eax, byte ptr [rax]
mov [rbp+var_15], al
mov [rbp+var_14], 1
mov [rbp+var_10], 0
mov [rbp+var_C], 1
jmp short loc_128B
loc_121A:
mov eax, [rbp+var_C]
movsxd rdx, eax
mov rax, [rbp+s]
add rax, rdx
movzx eax, byte ptr [rax]
cmp [rbp+var_15], al
jnz short loc_1235
add [rbp+var_14], 1
jmp short loc_1287
loc_1235:
mov eax, [rbp+var_10]
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_8]
add rdx, rax
mov eax, [rbp+var_14]
mov [rdx], eax
mov eax, [rbp+var_10]
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_8]
add rdx, rax
movzx eax, [rbp+var_15]
mov [rdx+4], al
add [rbp+var_10], 1
mov eax, [rbp+var_C]
movsxd rdx, eax
mov rax, [rbp+s]
add rax, rdx
movzx eax, byte ptr [rax]
mov [rbp+var_15], al
mov [rbp+var_14], 1
loc_1287:
add [rbp+var_C], 1
loc_128B:
mov eax, [rbp+var_C]
movsxd rdx, eax
mov rax, [rbp+s]
add rax, rdx
movzx eax, byte ptr [rax]
test al, al
jnz loc_121A
mov eax, [rbp+var_10]
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_8]
add rdx, rax
mov eax, [rbp+var_14]
mov [rdx], eax
mov eax, [rbp+var_10]
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_8]
add rdx, rax
movzx eax, [rbp+var_15]
mov [rdx+4], al
add [rbp+var_10], 1
mov rax, [rbp+var_30]
mov edx, [rbp+var_10]
mov [rax], edx
mov rax, [rbp+var_8]
leave
retn | _DWORD * func0(const char *a1, _DWORD *a2)
{
size_t v2; // rax
char v4; // [rsp+1Bh] [rbp-15h]
int v5; // [rsp+1Ch] [rbp-14h]
int v6; // [rsp+20h] [rbp-10h]
int i; // [rsp+24h] [rbp-Ch]
_DWORD *v8; // [rsp+28h] [rbp-8h]
v2 = strlen(a1);
v8 = malloc(8 * v2);
v4 = *a1;
v5 = 1;
v6 = 0;
for ( i = 1; a1[i]; ++i )
{
if ( v4 == a1[i] )
{
++v5;
}
else
{
v8[2 * v6] = v5;
LOBYTE(v8[2 * v6++ + 1]) = v4;
v4 = a1[i];
v5 = 1;
}
}
v8[2 * v6] = v5;
LOBYTE(v8[2 * v6 + 1]) = v4;
*a2 = v6 + 1;
return v8;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x30
MOV qword ptr [RBP + -0x28],RDI
MOV qword ptr [RBP + -0x30],RSI
MOV RAX,qword ptr [RBP + -0x28]
MOV RDI,RAX
CALL 0x001010a0
SHL RAX,0x3
MOV RDI,RAX
CALL 0x001010d0
MOV qword ptr [RBP + -0x8],RAX
MOV RAX,qword ptr [RBP + -0x28]
MOVZX EAX,byte ptr [RAX]
MOV byte ptr [RBP + -0x15],AL
MOV dword ptr [RBP + -0x14],0x1
MOV dword ptr [RBP + -0x10],0x0
MOV dword ptr [RBP + -0xc],0x1
JMP 0x0010128b
LAB_0010121a:
MOV EAX,dword ptr [RBP + -0xc]
MOVSXD RDX,EAX
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
CMP byte ptr [RBP + -0x15],AL
JNZ 0x00101235
ADD dword ptr [RBP + -0x14],0x1
JMP 0x00101287
LAB_00101235:
MOV EAX,dword ptr [RBP + -0x10]
CDQE
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x8]
ADD RDX,RAX
MOV EAX,dword ptr [RBP + -0x14]
MOV dword ptr [RDX],EAX
MOV EAX,dword ptr [RBP + -0x10]
CDQE
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x8]
ADD RDX,RAX
MOVZX EAX,byte ptr [RBP + -0x15]
MOV byte ptr [RDX + 0x4],AL
ADD dword ptr [RBP + -0x10],0x1
MOV EAX,dword ptr [RBP + -0xc]
MOVSXD RDX,EAX
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
MOV byte ptr [RBP + -0x15],AL
MOV dword ptr [RBP + -0x14],0x1
LAB_00101287:
ADD dword ptr [RBP + -0xc],0x1
LAB_0010128b:
MOV EAX,dword ptr [RBP + -0xc]
MOVSXD RDX,EAX
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
TEST AL,AL
JNZ 0x0010121a
MOV EAX,dword ptr [RBP + -0x10]
CDQE
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x8]
ADD RDX,RAX
MOV EAX,dword ptr [RBP + -0x14]
MOV dword ptr [RDX],EAX
MOV EAX,dword ptr [RBP + -0x10]
CDQE
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x8]
ADD RDX,RAX
MOVZX EAX,byte ptr [RBP + -0x15]
MOV byte ptr [RDX + 0x4],AL
ADD dword ptr [RBP + -0x10],0x1
MOV RAX,qword ptr [RBP + -0x30]
MOV EDX,dword ptr [RBP + -0x10]
MOV dword ptr [RAX],EDX
MOV RAX,qword ptr [RBP + -0x8]
LEAVE
RET | void * func0(char *param_1,int *param_2)
{
size_t sVar1;
void *pvVar2;
char local_1d;
int local_1c;
int local_18;
int local_14;
sVar1 = strlen(param_1);
pvVar2 = malloc(sVar1 << 3);
local_1d = *param_1;
local_1c = 1;
local_18 = 0;
for (local_14 = 1; param_1[local_14] != '\0'; local_14 = local_14 + 1) {
if (local_1d == param_1[local_14]) {
local_1c = local_1c + 1;
}
else {
*(int *)((long)local_18 * 8 + (long)pvVar2) = local_1c;
*(char *)((long)pvVar2 + (long)local_18 * 8 + 4) = local_1d;
local_18 = local_18 + 1;
local_1d = param_1[local_14];
local_1c = 1;
}
}
*(int *)((long)local_18 * 8 + (long)pvVar2) = local_1c;
*(char *)((long)pvVar2 + (long)local_18 * 8 + 4) = local_1d;
*param_2 = local_18 + 1;
return pvVar2;
} |
4,521 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
struct Pair {
int count;
char value;
};
| struct Pair* func0(char *list1, int *returnSize) {
struct Pair *result = (struct Pair *)malloc(sizeof(struct Pair) * strlen(list1));
char current = list1[0];
int count = 1;
int res_idx = 0;
for (int i = 1; list1[i] != '\0'; i++) {
if (list1[i] == current) {
count++;
} else {
result[res_idx].count = count;
result[res_idx].value = current;
res_idx++;
current = list1[i];
count = 1;
}
}
result[res_idx].count = count;
result[res_idx].value = current;
res_idx++;
*returnSize = res_idx;
return result;
}
| int main() {
int size1, size2, size3;
struct Pair *encoded1 = func0("11234", &size1);
assert(size1 == 4 && encoded1[0].count == 2 && encoded1[0].value == '1' &&
encoded1[1].count == 1 && encoded1[1].value == '2' &&
encoded1[2].count == 1 && encoded1[2].value == '3' &&
encoded1[3].count == 1 && encoded1[3].value == '4');
struct Pair *encoded2 = func0("automatically", &size2);
assert(size2 == 12 && encoded2[10].count == 2 && encoded2[10].value == 'l');
struct Pair *encoded3 = func0("python", &size3);
assert(size3 == 6 && encoded3[0].count == 1 && encoded3[0].value == 'p');
free(encoded1);
free(encoded2);
free(encoded3);
return 0;
}
| O1 | c | func0:
endbr64
push %rbp
push %rbx
sub $0x8,%rsp
mov %rdi,%rbx
mov %rsi,%rbp
mov $0xffffffffffffffff,%rcx
mov $0x0,%eax
repnz scas %es:(%rdi),%al
not %rcx
lea -0x8(,%rcx,8),%rdi
callq 10b0 <malloc@plt>
movzbl (%rbx),%esi
movzbl 0x1(%rbx),%edx
test %dl,%dl
je 1223 <func0+0x7a>
lea 0x2(%rbx),%rdi
mov $0x0,%ecx
mov $0x1,%r8d
jmp 1218 <func0+0x6f>
movslq %ecx,%r9
lea (%rax,%r9,8),%r9
mov %r8d,(%r9)
mov %sil,0x4(%r9)
add $0x1,%ecx
mov %edx,%esi
mov $0x1,%r8d
add $0x1,%rdi
movzbl -0x1(%rdi),%edx
test %dl,%dl
je 122e <func0+0x85>
cmp %sil,%dl
jne 11f3 <func0+0x4a>
add $0x1,%r8d
jmp 120c <func0+0x63>
mov $0x0,%ecx
mov $0x1,%r8d
movslq %ecx,%rdx
lea (%rax,%rdx,8),%rdx
mov %r8d,(%rdx)
mov %sil,0x4(%rdx)
add $0x1,%ecx
mov %ecx,0x0(%rbp)
add $0x8,%rsp
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
push rbx
sub rsp, 8
mov rbx, rdi
mov rbp, rsi
call _strlen
lea rdi, ds:0[rax*8]
call _malloc
movzx edi, byte ptr [rbx]
movzx edx, byte ptr [rbx+1]
test dl, dl
jz short loc_1237
lea rcx, [rbx+2]
mov esi, 0
mov r8d, 1
jmp short loc_1217
loc_1207:
add r8d, 1
loc_120B:
add rcx, 1
movzx edx, byte ptr [rcx-1]
test dl, dl
jz short loc_1242
loc_1217:
cmp dl, dil
jz short loc_1207
movsxd r9, esi
lea r9, [rax+r9*8]
mov [r9], r8d
mov [r9+4], dil
add esi, 1
mov edi, edx
mov r8d, 1
jmp short loc_120B
loc_1237:
mov esi, 0
mov r8d, 1
loc_1242:
movsxd rdx, esi
lea rdx, [rax+rdx*8]
mov [rdx], r8d
mov [rdx+4], dil
add esi, 1
mov [rbp+0], esi
add rsp, 8
pop rbx
pop rbp
retn | long long func0(char *a1, _DWORD *a2)
{
long long v4; // rax
long long result; // rax
char v6; // di
char v7; // dl
char *v8; // rcx
int v9; // esi
int v10; // r8d
long long v11; // r9
long long v12; // rdx
v4 = strlen();
result = malloc(8 * v4);
v6 = *a1;
v7 = a1[1];
if ( v7 )
{
v8 = a1 + 2;
v9 = 0;
v10 = 1;
do
{
if ( v7 == v6 )
{
++v10;
}
else
{
v11 = result + 8LL * v9;
*(_DWORD *)v11 = v10;
*(_BYTE *)(v11 + 4) = v6;
++v9;
v6 = v7;
v10 = 1;
}
v7 = *v8++;
}
while ( v7 );
}
else
{
v9 = 0;
v10 = 1;
}
v12 = result + 8LL * v9;
*(_DWORD *)v12 = v10;
*(_BYTE *)(v12 + 4) = v6;
*a2 = v9 + 1;
return result;
} | func0:
ENDBR64
PUSH RBP
PUSH RBX
SUB RSP,0x8
MOV RBX,RDI
MOV RBP,RSI
CALL 0x001010a0
LEA RDI,[RAX*0x8]
CALL 0x001010d0
MOVZX EDI,byte ptr [RBX]
MOVZX EDX,byte ptr [RBX + 0x1]
TEST DL,DL
JZ 0x00101237
LEA RCX,[RBX + 0x2]
MOV ESI,0x0
MOV R8D,0x1
JMP 0x00101217
LAB_00101207:
ADD R8D,0x1
LAB_0010120b:
ADD RCX,0x1
MOVZX EDX,byte ptr [RCX + -0x1]
TEST DL,DL
JZ 0x00101242
LAB_00101217:
CMP DL,DIL
JZ 0x00101207
MOVSXD R9,ESI
LEA R9,[RAX + R9*0x8]
MOV dword ptr [R9],R8D
MOV byte ptr [R9 + 0x4],DIL
ADD ESI,0x1
MOV EDI,EDX
MOV R8D,0x1
JMP 0x0010120b
LAB_00101237:
MOV ESI,0x0
MOV R8D,0x1
LAB_00101242:
MOVSXD RDX,ESI
LEA RDX,[RAX + RDX*0x8]
MOV dword ptr [RDX],R8D
MOV byte ptr [RDX + 0x4],DIL
ADD ESI,0x1
MOV dword ptr [RBP],ESI
ADD RSP,0x8
POP RBX
POP RBP
RET | void func0(char *param_1,int *param_2)
{
int *piVar1;
size_t sVar2;
void *pvVar3;
char *pcVar4;
char cVar5;
int iVar6;
char cVar7;
int iVar8;
sVar2 = strlen(param_1);
pvVar3 = malloc(sVar2 * 8);
cVar7 = *param_1;
cVar5 = param_1[1];
if (cVar5 == '\0') {
iVar6 = 0;
iVar8 = 1;
}
else {
iVar6 = 0;
iVar8 = 1;
pcVar4 = param_1 + 2;
do {
if (cVar5 == cVar7) {
iVar8 = iVar8 + 1;
}
else {
piVar1 = (int *)((long)pvVar3 + (long)iVar6 * 8);
*piVar1 = iVar8;
*(char *)(piVar1 + 1) = cVar7;
iVar6 = iVar6 + 1;
iVar8 = 1;
cVar7 = cVar5;
}
cVar5 = *pcVar4;
pcVar4 = pcVar4 + 1;
} while (cVar5 != '\0');
}
piVar1 = (int *)((long)pvVar3 + (long)iVar6 * 8);
*piVar1 = iVar8;
*(char *)(piVar1 + 1) = cVar7;
*param_2 = iVar6 + 1;
return;
} |
4,522 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
struct Pair {
int count;
char value;
};
| struct Pair* func0(char *list1, int *returnSize) {
struct Pair *result = (struct Pair *)malloc(sizeof(struct Pair) * strlen(list1));
char current = list1[0];
int count = 1;
int res_idx = 0;
for (int i = 1; list1[i] != '\0'; i++) {
if (list1[i] == current) {
count++;
} else {
result[res_idx].count = count;
result[res_idx].value = current;
res_idx++;
current = list1[i];
count = 1;
}
}
result[res_idx].count = count;
result[res_idx].value = current;
res_idx++;
*returnSize = res_idx;
return result;
}
| int main() {
int size1, size2, size3;
struct Pair *encoded1 = func0("11234", &size1);
assert(size1 == 4 && encoded1[0].count == 2 && encoded1[0].value == '1' &&
encoded1[1].count == 1 && encoded1[1].value == '2' &&
encoded1[2].count == 1 && encoded1[2].value == '3' &&
encoded1[3].count == 1 && encoded1[3].value == '4');
struct Pair *encoded2 = func0("automatically", &size2);
assert(size2 == 12 && encoded2[10].count == 2 && encoded2[10].value == 'l');
struct Pair *encoded3 = func0("python", &size3);
assert(size3 == 6 && encoded3[0].count == 1 && encoded3[0].value == 'p');
free(encoded1);
free(encoded2);
free(encoded3);
return 0;
}
| O2 | c | func0:
endbr64
push %rbp
mov %rsi,%rbp
push %rbx
mov %rdi,%rbx
sub $0x8,%rsp
callq 10a0 <strlen@plt>
lea 0x0(,%rax,8),%rdi
callq 10d0 <malloc@plt>
movzbl 0x1(%rbx),%ecx
movzbl (%rbx),%r10d
test %cl,%cl
je 13f0 <func0+0xa0>
lea 0x2(%rbx),%rdi
xor %r8d,%r8d
mov $0x1,%r11d
jmp 13b8 <func0+0x68>
nopl (%rax)
add $0x1,%rdi
mov %r10b,0x4(%r9)
mov %ecx,%r10d
movzbl -0x1(%rdi),%ecx
mov %r11d,(%r9)
lea 0x8(%rax,%rdx,1),%r9
mov $0x1,%r11d
lea 0x2(%r8),%edx
mov %ebx,%r8d
test %cl,%cl
je 13dd <func0+0x8d>
movslq %r8d,%rdx
lea 0x1(%r8),%ebx
shl $0x3,%rdx
lea (%rax,%rdx,1),%r9
cmp %cl,%r10b
jne 1390 <func0+0x40>
movzbl (%rdi),%ecx
add $0x1,%rdi
add $0x1,%r11d
mov %ebx,%edx
test %cl,%cl
jne 13b8 <func0+0x68>
mov %r11d,(%r9)
mov %r10b,0x4(%r9)
mov %edx,0x0(%rbp)
add $0x8,%rsp
pop %rbx
pop %rbp
retq
xchg %ax,%ax
mov %rax,%r9
mov $0x1,%edx
mov $0x1,%r11d
jmp 13dd <func0+0x8d>
| func0:
endbr64
push rbp
mov rbp, rsi
push rbx
mov rbx, rdi
sub rsp, 8
call _strlen
lea rdi, ds:0[rax*8]
call _malloc
movzx edx, byte ptr [rbx+1]
movzx ecx, byte ptr [rbx]
test dl, dl
jz short loc_13E8
lea rdi, [rbx+2]
xor esi, esi
mov r8d, 1
jmp short loc_13B5
loc_1390:
movsxd r9, esi
add rdi, 1
add esi, 1
lea r9, [rax+r9*8]
mov [r9+4], cl
mov ecx, edx
movzx edx, byte ptr [rdi-1]
mov [r9], r8d
mov r8d, 1
test dl, dl
jz short loc_13C8
loc_13B5:
cmp cl, dl
jnz short loc_1390
movzx edx, byte ptr [rdi]
add rdi, 1
add r8d, 1
test dl, dl
jnz short loc_13B5
loc_13C8:
movsxd rdx, esi
add esi, 1
lea rdx, [rax+rdx*8]
mov [rbp+0], esi
mov [rdx], r8d
mov [rdx+4], cl
add rsp, 8
pop rbx
pop rbp
retn
loc_13E8:
mov rdx, rax
mov esi, 1
mov r8d, 1
mov [rdx], r8d
mov [rdx+4], cl
mov [rbp+0], esi
add rsp, 8
pop rbx
pop rbp
retn | long long func0(char *a1, _DWORD *a2)
{
long long v3; // rax
long long result; // rax
char v5; // dl
char v6; // cl
char *v7; // rdi
int v8; // esi
int v9; // r8d
long long v10; // r9
long long v11; // r9
long long v12; // rdx
v3 = strlen();
result = malloc(8 * v3);
v5 = a1[1];
v6 = *a1;
if ( v5 )
{
v7 = a1 + 2;
v8 = 0;
v9 = 1;
do
{
while ( v6 != v5 )
{
v10 = v8;
++v7;
++v8;
v11 = result + 8 * v10;
*(_BYTE *)(v11 + 4) = v6;
v6 = v5;
v5 = *(v7 - 1);
*(_DWORD *)v11 = v9;
v9 = 1;
if ( !v5 )
goto LABEL_6;
}
v5 = *v7++;
++v9;
}
while ( v5 );
LABEL_6:
v12 = result + 8LL * v8;
*a2 = v8 + 1;
*(_DWORD *)v12 = v9;
*(_BYTE *)(v12 + 4) = v6;
}
else
{
*(_DWORD *)result = 1;
*(_BYTE *)(result + 4) = v6;
*a2 = 1;
}
return result;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSI
PUSH RBX
MOV RBX,RDI
SUB RSP,0x8
CALL 0x001010a0
LEA RDI,[RAX*0x8]
CALL 0x001010d0
MOVZX EDX,byte ptr [RBX + 0x1]
MOVZX ECX,byte ptr [RBX]
TEST DL,DL
JZ 0x001013e8
LEA RDI,[RBX + 0x2]
XOR ESI,ESI
MOV R8D,0x1
JMP 0x001013b5
LAB_00101390:
MOVSXD R9,ESI
ADD RDI,0x1
ADD ESI,0x1
LEA R9,[RAX + R9*0x8]
MOV byte ptr [R9 + 0x4],CL
MOV ECX,EDX
MOVZX EDX,byte ptr [RDI + -0x1]
MOV dword ptr [R9],R8D
MOV R8D,0x1
TEST DL,DL
JZ 0x001013c8
LAB_001013b5:
CMP CL,DL
JNZ 0x00101390
MOVZX EDX,byte ptr [RDI]
ADD RDI,0x1
ADD R8D,0x1
TEST DL,DL
JNZ 0x001013b5
LAB_001013c8:
MOVSXD RDX,ESI
ADD ESI,0x1
LEA RDX,[RAX + RDX*0x8]
MOV dword ptr [RBP],ESI
MOV dword ptr [RDX],R8D
MOV byte ptr [RDX + 0x4],CL
ADD RSP,0x8
POP RBX
POP RBP
RET
LAB_001013e8:
MOV RDX,RAX
MOV ESI,0x1
MOV R8D,0x1
MOV dword ptr [RDX],R8D
MOV byte ptr [RDX + 0x4],CL
MOV dword ptr [RBP],ESI
ADD RSP,0x8
POP RBX
POP RBP
RET | void func0(char *param_1,int *param_2)
{
char cVar1;
size_t sVar2;
int4 *puVar3;
char cVar4;
char cVar5;
int iVar6;
char *pcVar7;
int iVar8;
long lVar9;
sVar2 = strlen(param_1);
puVar3 = (int4 *)malloc(sVar2 * 8);
cVar4 = *param_1;
if (param_1[1] == '\0') {
*puVar3 = 1;
*(char *)(puVar3 + 1) = cVar4;
*param_2 = 1;
return;
}
iVar6 = 0;
iVar8 = 1;
pcVar7 = param_1 + 2;
cVar1 = param_1[1];
do {
while (cVar5 = cVar1, cVar4 == cVar5) {
cVar1 = *pcVar7;
iVar8 = iVar8 + 1;
pcVar7 = pcVar7 + 1;
cVar5 = cVar4;
if (cVar1 == '\0') goto LAB_001013c8;
}
lVar9 = (long)iVar6;
iVar6 = iVar6 + 1;
*(char *)(puVar3 + lVar9 * 2 + 1) = cVar4;
cVar1 = *pcVar7;
puVar3[lVar9 * 2] = iVar8;
iVar8 = 1;
pcVar7 = pcVar7 + 1;
cVar4 = cVar5;
} while (cVar1 != '\0');
LAB_001013c8:
*param_2 = iVar6 + 1;
puVar3[(long)iVar6 * 2] = iVar8;
*(char *)(puVar3 + (long)iVar6 * 2 + 1) = cVar5;
return;
} |
4,523 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
struct Pair {
int count;
char value;
};
| struct Pair* func0(char *list1, int *returnSize) {
struct Pair *result = (struct Pair *)malloc(sizeof(struct Pair) * strlen(list1));
char current = list1[0];
int count = 1;
int res_idx = 0;
for (int i = 1; list1[i] != '\0'; i++) {
if (list1[i] == current) {
count++;
} else {
result[res_idx].count = count;
result[res_idx].value = current;
res_idx++;
current = list1[i];
count = 1;
}
}
result[res_idx].count = count;
result[res_idx].value = current;
res_idx++;
*returnSize = res_idx;
return result;
}
| int main() {
int size1, size2, size3;
struct Pair *encoded1 = func0("11234", &size1);
assert(size1 == 4 && encoded1[0].count == 2 && encoded1[0].value == '1' &&
encoded1[1].count == 1 && encoded1[1].value == '2' &&
encoded1[2].count == 1 && encoded1[2].value == '3' &&
encoded1[3].count == 1 && encoded1[3].value == '4');
struct Pair *encoded2 = func0("automatically", &size2);
assert(size2 == 12 && encoded2[10].count == 2 && encoded2[10].value == 'l');
struct Pair *encoded3 = func0("python", &size3);
assert(size3 == 6 && encoded3[0].count == 1 && encoded3[0].value == 'p');
free(encoded1);
free(encoded2);
free(encoded3);
return 0;
}
| O3 | c | func0:
endbr64
push %rbp
mov %rsi,%rbp
push %rbx
mov %rdi,%rbx
sub $0x8,%rsp
callq 10a0 <strlen@plt>
lea 0x0(,%rax,8),%rdi
callq 10d0 <malloc@plt>
movzbl 0x1(%rbx),%r8d
movzbl (%rbx),%r10d
test %r8b,%r8b
je 1420 <func0+0xd0>
lea 0x2(%rbx),%rdi
mov $0x1,%r11d
xor %ebx,%ebx
xor %esi,%esi
mov $0x1,%r9d
jmp 13d1 <func0+0x81>
nopw 0x0(%rax,%rax,1)
add $0x1,%rdi
mov %r11d,(%rdx)
add $0x2,%ebx
mov %r10b,0x4(%rdx)
lea 0x8(%rax,%rcx,1),%rdx
movzbl -0x1(%rdi),%ecx
test %cl,%cl
je 1400 <func0+0xb0>
mov %r9d,%ebx
movslq %r9d,%rsi
mov %r8d,%r10d
mov $0x1,%r11d
add $0x1,%r9d
mov %ecx,%r8d
lea 0x0(,%rsi,8),%rcx
lea (%rax,%rcx,1),%rdx
cmp %r8b,%r10b
jne 13a0 <func0+0x50>
movzbl (%rdi),%ecx
add $0x1,%rdi
add $0x1,%r11d
test %cl,%cl
jne 13ce <func0+0x7e>
mov %r9d,%ebx
jmp 1406 <func0+0xb6>
nopw %cs:0x0(%rax,%rax,1)
mov $0x1,%r11d
mov %r11d,(%rdx)
mov %r8b,0x4(%rdx)
mov %ebx,0x0(%rbp)
add $0x8,%rsp
pop %rbx
pop %rbp
retq
nopw 0x0(%rax,%rax,1)
mov %rax,%rdx
mov %r10d,%r8d
mov $0x1,%ebx
mov $0x1,%r11d
jmp 1406 <func0+0xb6>
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
push rbp
mov rbp, rsi
push rbx
mov rbx, rdi
sub rsp, 8
call _strlen
lea rdi, ds:0[rax*8]; size
call _malloc
movzx edx, byte ptr [rbx+1]
movzx esi, byte ptr [rbx]
test dl, dl
jz short loc_13F0
lea rdi, [rbx+2]
xor r8d, r8d
mov r9d, 1
jmp short loc_13B8
loc_1390:
movsxd rcx, r8d
add rdi, 1
add r8d, 1
lea rcx, [rax+rcx*8]
mov [rcx], r9d
mov r9d, 1
mov [rcx+4], sil
movzx ecx, byte ptr [rdi-1]
test cl, cl
jz short loc_13CC
loc_13B4:
mov esi, edx
mov edx, ecx
loc_13B8:
cmp dl, sil
jnz short loc_1390
movzx ecx, byte ptr [rdi]
add rdi, 1
add r9d, 1
test cl, cl
jnz short loc_13B4
loc_13CC:
movsxd rcx, r8d
add r8d, 1
lea rcx, [rax+rcx*8]
loc_13D7:
mov [rcx], r9d
mov [rcx+4], dl
mov [rbp+0], r8d
add rsp, 8
pop rbx
pop rbp
retn
loc_13F0:
mov rcx, rax
mov edx, esi
mov r8d, 1
mov r9d, 1
jmp short loc_13D7 | char * func0(long long a1, int *a2)
{
size_t v3; // rax
char *result; // rax
char v5; // dl
char v6; // si
char *v7; // rdi
int v8; // r8d
int v9; // r9d
long long v10; // rcx
char *v11; // rcx
char v12; // cl
long long v13; // rcx
int v14; // r8d
char *v15; // rcx
v3 = strlen((const char *)a1);
result = (char *)malloc(8 * v3);
v5 = *(_BYTE *)(a1 + 1);
v6 = *(_BYTE *)a1;
if ( !v5 )
{
v15 = result;
v5 = *(_BYTE *)a1;
v14 = 1;
v9 = 1;
goto LABEL_8;
}
v7 = (char *)(a1 + 2);
v8 = 0;
v9 = 1;
while ( v5 != v6 )
{
v10 = v8;
++v7;
++v8;
v11 = &result[8 * v10];
*(_DWORD *)v11 = v9;
v9 = 1;
v11[4] = v6;
v12 = *(v7 - 1);
if ( !v12 )
goto LABEL_7;
LABEL_4:
v6 = v5;
v5 = v12;
}
v12 = *v7++;
++v9;
if ( v12 )
goto LABEL_4;
LABEL_7:
v13 = v8;
v14 = v8 + 1;
v15 = &result[8 * v13];
LABEL_8:
*(_DWORD *)v15 = v9;
v15[4] = v5;
*a2 = v14;
return result;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSI
PUSH RBX
MOV RBX,RDI
SUB RSP,0x8
CALL 0x001010a0
LEA RDI,[RAX*0x8]
CALL 0x001010d0
MOVZX EDX,byte ptr [RBX + 0x1]
MOVZX ESI,byte ptr [RBX]
TEST DL,DL
JZ 0x001013f0
LEA RDI,[RBX + 0x2]
XOR R8D,R8D
MOV R9D,0x1
JMP 0x001013b8
LAB_00101390:
MOVSXD RCX,R8D
ADD RDI,0x1
ADD R8D,0x1
LEA RCX,[RAX + RCX*0x8]
MOV dword ptr [RCX],R9D
MOV R9D,0x1
MOV byte ptr [RCX + 0x4],SIL
MOVZX ECX,byte ptr [RDI + -0x1]
TEST CL,CL
JZ 0x001013cc
LAB_001013b4:
MOV ESI,EDX
MOV EDX,ECX
LAB_001013b8:
CMP DL,SIL
JNZ 0x00101390
MOVZX ECX,byte ptr [RDI]
ADD RDI,0x1
ADD R9D,0x1
TEST CL,CL
JNZ 0x001013b4
LAB_001013cc:
MOVSXD RCX,R8D
ADD R8D,0x1
LEA RCX,[RAX + RCX*0x8]
LAB_001013d7:
MOV dword ptr [RCX],R9D
MOV byte ptr [RCX + 0x4],DL
MOV dword ptr [RBP],R8D
ADD RSP,0x8
POP RBX
POP RBP
RET
LAB_001013f0:
MOV RCX,RAX
MOV EDX,ESI
MOV R8D,0x1
MOV R9D,0x1
JMP 0x001013d7 | void func0(char *param_1,int *param_2)
{
char cVar1;
size_t sVar2;
int *piVar3;
long lVar4;
char cVar5;
char cVar6;
char *pcVar7;
int iVar8;
int iVar9;
int iVar10;
sVar2 = strlen(param_1);
piVar3 = (int *)malloc(sVar2 * 8);
cVar5 = *param_1;
if (param_1[1] == '\0') {
iVar9 = 1;
iVar10 = 1;
}
else {
pcVar7 = param_1 + 2;
iVar8 = 0;
iVar10 = 1;
cVar1 = param_1[1];
cVar6 = cVar5;
while( true ) {
cVar5 = cVar1;
if (cVar5 == cVar6) {
cVar1 = *pcVar7;
iVar10 = iVar10 + 1;
}
else {
lVar4 = (long)iVar8;
iVar8 = iVar8 + 1;
piVar3[lVar4 * 2] = iVar10;
iVar10 = 1;
*(char *)(piVar3 + lVar4 * 2 + 1) = cVar6;
cVar1 = *pcVar7;
}
if (cVar1 == '\0') break;
pcVar7 = pcVar7 + 1;
cVar6 = cVar5;
}
iVar9 = iVar8 + 1;
piVar3 = piVar3 + (long)iVar8 * 2;
}
*piVar3 = iVar10;
*(char *)(piVar3 + 1) = cVar5;
*param_2 = iVar9;
return;
} |
4,524 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(int arr[], int n, int k) {
int max1 = arr[0];
int res = 0;
for (int i = 1; i < n; i++) {
if (arr[i] > max1) {
max1 = arr[i];
}
}
for (int i = 0; i < n; i++) {
if ((max1 - arr[i]) % k != 0) {
return -1;
} else {
res += (max1 - arr[i]) / k;
}
}
return res;
}
| int main() {
int arr1[] = {2, 2, 2, 2};
int arr2[] = {4, 2, 6, 8};
int arr3[] = {21, 33, 9, 45, 63};
assert(func0(arr1, 4, 3) == 0);
assert(func0(arr2, 4, 3) == -1);
assert(func0(arr3, 5, 6) == 24);
printf("All test cases passed!\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov %edx,-0x20(%rbp)
mov -0x18(%rbp),%rax
mov (%rax),%eax
mov %eax,-0x10(%rbp)
movl $0x0,-0xc(%rbp)
movl $0x1,-0x8(%rbp)
jmp 11ec <func0+0x63>
mov -0x8(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cmp %eax,-0x10(%rbp)
jge 11e8 <func0+0x5f>
mov -0x8(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
mov %eax,-0x10(%rbp)
addl $0x1,-0x8(%rbp)
mov -0x8(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 11b4 <func0+0x2b>
movl $0x0,-0x4(%rbp)
jmp 1253 <func0+0xca>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
mov -0x10(%rbp),%edx
sub %eax,%edx
mov %edx,%eax
cltd
idivl -0x20(%rbp)
mov %edx,%eax
test %eax,%eax
je 122b <func0+0xa2>
mov $0xffffffff,%eax
jmp 125e <func0+0xd5>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
mov -0x10(%rbp),%edx
sub %eax,%edx
mov %edx,%eax
cltd
idivl -0x20(%rbp)
add %eax,-0xc(%rbp)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 11fd <func0+0x74>
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 rax, [rbp+var_18]
mov eax, [rax]
mov [rbp+var_10], eax
mov [rbp+var_C], 0
mov [rbp+var_8], 1
jmp short loc_11EC
loc_11B4:
mov eax, [rbp+var_8]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
cmp [rbp+var_10], eax
jge short loc_11E8
mov eax, [rbp+var_8]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
mov [rbp+var_10], eax
loc_11E8:
add [rbp+var_8], 1
loc_11EC:
mov eax, [rbp+var_8]
cmp eax, [rbp+var_1C]
jl short loc_11B4
mov [rbp+var_4], 0
jmp short loc_1253
loc_11FD:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
mov edx, [rbp+var_10]
sub edx, eax
mov eax, edx
cdq
idiv [rbp+var_20]
mov eax, edx
test eax, eax
jz short loc_122B
mov eax, 0FFFFFFFFh
jmp short loc_125E
loc_122B:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
mov edx, [rbp+var_10]
sub edx, eax
mov eax, edx
cdq
idiv [rbp+var_20]
add [rbp+var_C], eax
add [rbp+var_4], 1
loc_1253:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_11FD
mov eax, [rbp+var_C]
loc_125E:
pop rbp
retn | long long func0(int *a1, int a2, int a3)
{
int v4; // [rsp+10h] [rbp-10h]
unsigned int v5; // [rsp+14h] [rbp-Ch]
int i; // [rsp+18h] [rbp-8h]
int j; // [rsp+1Ch] [rbp-4h]
v4 = *a1;
v5 = 0;
for ( i = 1; i < a2; ++i )
{
if ( v4 < a1[i] )
v4 = a1[i];
}
for ( j = 0; j < a2; ++j )
{
if ( (v4 - a1[j]) % a3 )
return 0xFFFFFFFFLL;
v5 += (v4 - a1[j]) / a3;
}
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 RAX,qword ptr [RBP + -0x18]
MOV EAX,dword ptr [RAX]
MOV dword ptr [RBP + -0x10],EAX
MOV dword ptr [RBP + -0xc],0x0
MOV dword ptr [RBP + -0x8],0x1
JMP 0x001011ec
LAB_001011b4:
MOV EAX,dword ptr [RBP + -0x8]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
CMP dword ptr [RBP + -0x10],EAX
JGE 0x001011e8
MOV EAX,dword ptr [RBP + -0x8]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
MOV dword ptr [RBP + -0x10],EAX
LAB_001011e8:
ADD dword ptr [RBP + -0x8],0x1
LAB_001011ec:
MOV EAX,dword ptr [RBP + -0x8]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x001011b4
MOV dword ptr [RBP + -0x4],0x0
JMP 0x00101253
LAB_001011fd:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
MOV EDX,dword ptr [RBP + -0x10]
SUB EDX,EAX
MOV EAX,EDX
CDQ
IDIV dword ptr [RBP + -0x20]
MOV EAX,EDX
TEST EAX,EAX
JZ 0x0010122b
MOV EAX,0xffffffff
JMP 0x0010125e
LAB_0010122b:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
MOV EDX,dword ptr [RBP + -0x10]
SUB EDX,EAX
MOV EAX,EDX
CDQ
IDIV dword ptr [RBP + -0x20]
ADD dword ptr [RBP + -0xc],EAX
ADD dword ptr [RBP + -0x4],0x1
LAB_00101253:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x001011fd
MOV EAX,dword ptr [RBP + -0xc]
LAB_0010125e:
POP RBP
RET | int [16] func0(int *param_1,int param_2,ulong param_3)
{
ulong uVar1;
int iVar2;
int auVar3 [16];
int local_18;
uint local_14;
int local_10;
int local_c;
iVar2 = (int)param_3;
local_18 = *param_1;
local_14 = 0;
for (local_10 = 1; local_10 < param_2; local_10 = local_10 + 1) {
if (local_18 < param_1[local_10]) {
local_18 = param_1[local_10];
}
param_3 = (long)local_10 * 4;
}
local_c = 0;
do {
if (param_2 <= local_c) {
uVar1 = (ulong)local_14;
LAB_0010125e:
auVar3._8_8_ = param_3;
auVar3._0_8_ = uVar1;
return auVar3;
}
uVar1 = (long)(local_18 - param_1[local_c]) % (long)iVar2;
param_3 = uVar1 & 0xffffffff;
if ((int)uVar1 != 0) {
uVar1 = 0xffffffff;
goto LAB_0010125e;
}
param_3 = (long)(local_18 - param_1[local_c]) % (long)iVar2 & 0xffffffff;
local_14 = local_14 + (local_18 - param_1[local_c]) / iVar2;
local_c = local_c + 1;
} while( true );
} |
4,525 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(int arr[], int n, int k) {
int max1 = arr[0];
int res = 0;
for (int i = 1; i < n; i++) {
if (arr[i] > max1) {
max1 = arr[i];
}
}
for (int i = 0; i < n; i++) {
if ((max1 - arr[i]) % k != 0) {
return -1;
} else {
res += (max1 - arr[i]) / k;
}
}
return res;
}
| int main() {
int arr1[] = {2, 2, 2, 2};
int arr2[] = {4, 2, 6, 8};
int arr3[] = {21, 33, 9, 45, 63};
assert(func0(arr1, 4, 3) == 0);
assert(func0(arr2, 4, 3) == -1);
assert(func0(arr3, 5, 6) == 24);
printf("All test cases passed!\n");
return 0;
}
| O1 | c | func0:
endbr64
mov %edx,%r8d
mov (%rdi),%r10d
cmp $0x1,%esi
jle 11e7 <func0+0x5e>
lea 0x4(%rdi),%rax
lea -0x2(%rsi),%edx
lea 0x8(%rdi,%rdx,4),%rcx
mov (%rax),%edx
cmp %edx,%r10d
cmovl %edx,%r10d
add $0x4,%rax
cmp %rcx,%rax
jne 11a4 <func0+0x1b>
mov $0x0,%r9d
mov $0x0,%r11d
mov %r10d,%ecx
sub (%rdi,%r9,4),%ecx
mov %ecx,%eax
cltd
idiv %r8d
test %edx,%edx
jne 11f1 <func0+0x68>
mov %ecx,%eax
cltd
idiv %r8d
add %eax,%r11d
add $0x1,%r9
cmp %r9d,%esi
jg 11c2 <func0+0x39>
jmp 11f7 <func0+0x6e>
mov $0x0,%r11d
je 11b6 <func0+0x2d>
jmp 11f7 <func0+0x6e>
mov $0xffffffff,%r11d
mov %r11d,%eax
retq
| func0:
endbr64
mov r10, rdi
mov r11d, esi
mov esi, edx
mov r8d, [rdi]
cmp r11d, 1
jle short loc_11EB
lea rax, [rdi+4]
lea edx, [r11-2]
lea rcx, [rdi+rdx*4+8]
loc_11AB:
mov edx, [rax]
cmp r8d, edx
cmovl r8d, edx
add rax, 4
cmp rax, rcx
jnz short loc_11AB
loc_11BD:
mov edi, 0
mov r9d, 0
loc_11C8:
mov ecx, r8d
sub ecx, [r10+rdi*4]
mov eax, ecx
cdq
idiv esi
test edx, edx
jnz short loc_11F5
mov eax, ecx
cdq
idiv esi
add r9d, eax
add rdi, 1
cmp r11d, edi
jg short loc_11C8
jmp short loc_11FB
loc_11EB:
mov r9d, 0
jnz short loc_11FB
jmp short loc_11BD
loc_11F5:
mov r9d, 0FFFFFFFFh
loc_11FB:
mov eax, r9d
retn | long long func0(int *a1, int a2, int a3)
{
int v4; // r8d
int *v5; // rax
long long v6; // rdi
unsigned int v7; // r9d
v4 = *a1;
if ( a2 <= 1 )
{
v7 = 0;
if ( a2 != 1 )
return v7;
}
else
{
v5 = a1 + 1;
do
{
if ( v4 < *v5 )
v4 = *v5;
++v5;
}
while ( v5 != &a1[a2 - 2 + 2] );
}
v6 = 0LL;
v7 = 0;
while ( !((v4 - a1[v6]) % a3) )
{
v7 += (v4 - a1[v6++]) / a3;
if ( a2 <= (int)v6 )
return v7;
}
return (unsigned int)-1;
} | func0:
ENDBR64
MOV R10,RDI
MOV R11D,ESI
MOV ESI,EDX
MOV R8D,dword ptr [RDI]
CMP R11D,0x1
JLE 0x001011eb
LEA RAX,[RDI + 0x4]
LEA EDX,[R11 + -0x2]
LEA RCX,[RDI + RDX*0x4 + 0x8]
LAB_001011ab:
MOV EDX,dword ptr [RAX]
CMP R8D,EDX
CMOVL R8D,EDX
ADD RAX,0x4
CMP RAX,RCX
JNZ 0x001011ab
LAB_001011bd:
MOV EDI,0x0
MOV R9D,0x0
LAB_001011c8:
MOV ECX,R8D
SUB ECX,dword ptr [R10 + RDI*0x4]
MOV EAX,ECX
CDQ
IDIV ESI
TEST EDX,EDX
JNZ 0x001011f5
MOV EAX,ECX
CDQ
IDIV ESI
ADD R9D,EAX
ADD RDI,0x1
CMP R11D,EDI
JG 0x001011c8
JMP 0x001011fb
LAB_001011eb:
MOV R9D,0x0
JNZ 0x001011fb
JMP 0x001011bd
LAB_001011f5:
MOV R9D,0xffffffff
LAB_001011fb:
MOV EAX,R9D
RET | int1 [16] func0(int *param_1,int param_2,ulong param_3)
{
int *piVar1;
int iVar2;
ulong uVar3;
int iVar4;
long lVar5;
int iVar6;
uint uVar7;
int1 auVar8 [16];
iVar6 = *param_1;
if (param_2 < 2) {
uVar7 = 0;
uVar3 = param_3;
if (param_2 != 1) goto LAB_001011fb;
}
else {
piVar1 = param_1 + 1;
do {
if (iVar6 < *piVar1) {
iVar6 = *piVar1;
}
piVar1 = piVar1 + 1;
} while (piVar1 != param_1 + (ulong)(param_2 - 2) + 2);
}
lVar5 = 0;
uVar7 = 0;
do {
iVar2 = iVar6 - param_1[lVar5];
iVar4 = (int)param_3;
if ((int)((long)iVar2 % (long)iVar4) != 0) {
uVar7 = 0xffffffff;
uVar3 = (long)iVar2 % (long)iVar4 & 0xffffffff;
break;
}
uVar3 = (long)iVar2 % (long)iVar4 & 0xffffffff;
uVar7 = uVar7 + iVar2 / iVar4;
lVar5 = lVar5 + 1;
} while ((int)lVar5 < param_2);
LAB_001011fb:
auVar8._4_4_ = 0;
auVar8._0_4_ = uVar7;
auVar8._8_8_ = uVar3;
return auVar8;
} |
4,526 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(int arr[], int n, int k) {
int max1 = arr[0];
int res = 0;
for (int i = 1; i < n; i++) {
if (arr[i] > max1) {
max1 = arr[i];
}
}
for (int i = 0; i < n; i++) {
if ((max1 - arr[i]) % k != 0) {
return -1;
} else {
res += (max1 - arr[i]) / k;
}
}
return res;
}
| int main() {
int arr1[] = {2, 2, 2, 2};
int arr2[] = {4, 2, 6, 8};
int arr3[] = {21, 33, 9, 45, 63};
assert(func0(arr1, 4, 3) == 0);
assert(func0(arr2, 4, 3) == -1);
assert(func0(arr3, 5, 6) == 24);
printf("All test cases passed!\n");
return 0;
}
| O2 | c | func0:
endbr64
mov (%rdi),%r11d
mov %edx,%r9d
cmp $0x1,%esi
jle 1340 <func0+0x70>
lea -0x2(%rsi),%edx
lea 0x4(%rdi),%rax
mov %r11d,%ecx
lea 0x8(%rdi,%rdx,4),%r8
xchg %ax,%ax
mov (%rax),%edx
cmp %edx,%ecx
cmovl %edx,%ecx
add $0x4,%rax
cmp %rax,%r8
jne 12f0 <func0+0x20>
xor %r8d,%r8d
xor %r10d,%r10d
jmp 1320 <func0+0x50>
nopl 0x0(%rax,%rax,1)
add $0x1,%r8
add %eax,%r10d
cmp %r8d,%esi
jle 1333 <func0+0x63>
mov (%rdi,%r8,4),%r11d
mov %ecx,%eax
sub %r11d,%eax
cltd
idiv %r9d
test %edx,%edx
je 1310 <func0+0x40>
mov $0xffffffff,%r10d
mov %r10d,%eax
retq
nopw 0x0(%rax,%rax,1)
mov $0x0,%r10d
jne 1333 <func0+0x63>
mov %r11d,%ecx
jmp 1300 <func0+0x30>
nopl (%rax)
| func0:
endbr64
mov r10, rdi
mov r11d, esi
mov edi, edx
mov r9d, [r10]
cmp esi, 1
jle short loc_1340
lea edx, [rsi-2]
lea rax, [r10+4]
mov ecx, r9d
lea rsi, [r10+rdx*4+8]
nop dword ptr [rax+rax+00h]
loc_12F8:
mov edx, [rax]
cmp ecx, edx
cmovl ecx, edx
add rax, 4
cmp rsi, rax
jnz short loc_12F8
loc_1308:
xor esi, esi
xor r8d, r8d
jmp short loc_1320
loc_1310:
add rsi, 1
add r8d, eax
cmp r11d, esi
jle short loc_1332
mov r9d, [r10+rsi*4]
loc_1320:
mov eax, ecx
sub eax, r9d
cdq
idiv edi
test edx, edx
jz short loc_1310
mov r8d, 0FFFFFFFFh
loc_1332:
mov eax, r8d
retn
loc_1340:
mov r8d, 0
jnz short loc_1332
mov ecx, r9d
jmp short loc_1308 | long long func0(int *a1, int a2, int a3)
{
int v4; // r9d
int *v5; // rax
int v6; // ecx
long long v7; // rsi
long long v8; // rsi
unsigned int v9; // r8d
v4 = *a1;
if ( a2 <= 1 )
{
v9 = 0;
if ( a2 != 1 )
return v9;
v6 = *a1;
}
else
{
v5 = a1 + 1;
v6 = *a1;
v7 = (long long)&a1[a2 - 2 + 2];
do
{
if ( v6 < *v5 )
v6 = *v5;
++v5;
}
while ( (int *)v7 != v5 );
}
v8 = 0LL;
v9 = 0;
while ( !((v6 - v4) % a3) )
{
++v8;
v9 += (v6 - v4) / a3;
if ( a2 <= (int)v8 )
return v9;
v4 = a1[v8];
}
return (unsigned int)-1;
} | func0:
ENDBR64
MOV R10,RDI
MOV R11D,ESI
MOV EDI,EDX
MOV R9D,dword ptr [R10]
CMP ESI,0x1
JLE 0x00101340
LEA EDX,[RSI + -0x2]
LEA RAX,[R10 + 0x4]
MOV ECX,R9D
LEA RSI,[R10 + RDX*0x4 + 0x8]
NOP dword ptr [RAX + RAX*0x1]
LAB_001012f8:
MOV EDX,dword ptr [RAX]
CMP ECX,EDX
CMOVL ECX,EDX
ADD RAX,0x4
CMP RSI,RAX
JNZ 0x001012f8
LAB_00101308:
XOR ESI,ESI
XOR R8D,R8D
JMP 0x00101320
LAB_00101310:
ADD RSI,0x1
ADD R8D,EAX
CMP R11D,ESI
JLE 0x00101332
MOV R9D,dword ptr [R10 + RSI*0x4]
LAB_00101320:
MOV EAX,ECX
SUB EAX,R9D
CDQ
IDIV EDI
TEST EDX,EDX
JZ 0x00101310
MOV R8D,0xffffffff
LAB_00101332:
MOV EAX,R8D
RET
LAB_00101340:
MOV R8D,0x0
JNZ 0x00101332
MOV ECX,R9D
JMP 0x00101308 | int func0(int *param_1,int param_2,int param_3)
{
int *piVar1;
int iVar2;
long lVar3;
int iVar4;
int iVar5;
iVar5 = *param_1;
iVar2 = iVar5;
if (param_2 < 2) {
if (param_2 != 1) {
return 0;
}
}
else {
piVar1 = param_1 + 1;
do {
if (iVar2 < *piVar1) {
iVar2 = *piVar1;
}
piVar1 = piVar1 + 1;
} while (param_1 + (ulong)(param_2 - 2) + 2 != piVar1);
}
lVar3 = 0;
iVar4 = 0;
while( true ) {
if ((iVar2 - iVar5) % param_3 != 0) {
return -1;
}
lVar3 = lVar3 + 1;
iVar4 = iVar4 + (iVar2 - iVar5) / param_3;
if (param_2 <= (int)lVar3) break;
iVar5 = param_1[lVar3];
}
return iVar4;
} |
4,527 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(int arr[], int n, int k) {
int max1 = arr[0];
int res = 0;
for (int i = 1; i < n; i++) {
if (arr[i] > max1) {
max1 = arr[i];
}
}
for (int i = 0; i < n; i++) {
if ((max1 - arr[i]) % k != 0) {
return -1;
} else {
res += (max1 - arr[i]) / k;
}
}
return res;
}
| int main() {
int arr1[] = {2, 2, 2, 2};
int arr2[] = {4, 2, 6, 8};
int arr3[] = {21, 33, 9, 45, 63};
assert(func0(arr1, 4, 3) == 0);
assert(func0(arr2, 4, 3) == -1);
assert(func0(arr3, 5, 6) == 24);
printf("All test cases passed!\n");
return 0;
}
| O3 | c | func0:
endbr64
mov (%rdi),%r9d
mov %edx,%r10d
cmp $0x1,%esi
jle 13c8 <func0+0x118>
lea -0x2(%rsi),%eax
lea -0x1(%rsi),%ecx
cmp $0x2,%eax
jbe 13d2 <func0+0x122>
mov %ecx,%edx
movd %r9d,%xmm3
mov %rdi,%rax
shr $0x2,%edx
pshufd $0x0,%xmm3,%xmm2
shl $0x4,%rdx
add %rdi,%rdx
nopl 0x0(%rax,%rax,1)
movdqu 0x4(%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 12f0 <func0+0x40>
movdqa %xmm2,%xmm0
mov %ecx,%edx
psrldq $0x8,%xmm0
and $0xfffffffc,%edx
movdqa %xmm0,%xmm1
lea 0x1(%rdx),%eax
pcmpgtd %xmm2,%xmm1
pand %xmm1,%xmm0
pandn %xmm2,%xmm1
por %xmm1,%xmm0
movdqa %xmm0,%xmm2
psrldq $0x4,%xmm2
movdqa %xmm2,%xmm1
pcmpgtd %xmm0,%xmm1
pand %xmm1,%xmm2
pandn %xmm0,%xmm1
por %xmm2,%xmm1
movd %xmm1,%r9d
cmp %ecx,%edx
je 1395 <func0+0xe5>
movslq %eax,%rdx
mov (%rdi,%rdx,4),%edx
cmp %edx,%r9d
cmovl %edx,%r9d
lea 0x1(%rax),%edx
cmp %edx,%esi
jle 1395 <func0+0xe5>
movslq %edx,%rdx
mov (%rdi,%rdx,4),%edx
cmp %edx,%r9d
cmovl %edx,%r9d
add $0x2,%eax
cmp %eax,%esi
jle 1395 <func0+0xe5>
cltq
mov (%rdi,%rax,4),%eax
cmp %eax,%r9d
cmovl %eax,%r9d
xor %ecx,%ecx
xor %r8d,%r8d
jmp 13ab <func0+0xfb>
nopl 0x0(%rax)
add $0x1,%rcx
add %eax,%r8d
cmp %ecx,%esi
jle 13bf <func0+0x10f>
mov %r9d,%eax
sub (%rdi,%rcx,4),%eax
cltd
idiv %r10d
test %edx,%edx
je 13a0 <func0+0xf0>
mov $0xffffffff,%r8d
mov %r8d,%eax
retq
nopl 0x0(%rax,%rax,1)
mov $0x0,%r8d
je 1395 <func0+0xe5>
jmp 13bf <func0+0x10f>
mov $0x1,%eax
jmp 1361 <func0+0xb1>
nopl 0x0(%rax)
| func0:
endbr64
movsxd r9, esi
mov rcx, rdi
mov r8d, edx
mov edi, [rdi]
cmp r9d, 1
jle loc_13D0
lea eax, [r9-2]
lea esi, [r9-1]
cmp eax, 2
jbe loc_13D9
mov edx, esi
movd xmm3, edi
mov rax, rcx
shr edx, 2
pshufd xmm2, xmm3, 0
shl rdx, 4
add rdx, rcx
nop word ptr [rax+rax+00h]
loc_12F8:
movdqu xmm0, xmmword ptr [rax+4]
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_12F8
movdqa xmm1, xmm2
mov eax, esi
psrldq xmm1, 8
and eax, 0FFFFFFFCh
movdqa xmm0, xmm1
add eax, 1
and esi, 3
pcmpgtd xmm0, xmm2
pand xmm1, xmm0
pandn xmm0, xmm2
por xmm0, xmm1
movdqa xmm2, xmm0
psrldq xmm2, 4
movdqa xmm1, xmm2
pcmpgtd xmm1, xmm0
pand xmm2, xmm1
pandn xmm1, xmm0
por xmm1, xmm2
movd edi, xmm1
jz short loc_139E
loc_1369:
movsxd rdx, eax
lea rsi, ds:0[rdx*4]
mov edx, [rcx+rdx*4]
cmp edi, edx
cmovl edi, edx
lea edx, [rax+1]
cmp r9d, edx
jle short loc_139E
mov edx, [rcx+rsi+4]
cmp edi, edx
cmovl edi, edx
add eax, 2
cmp r9d, eax
jle short loc_139E
mov eax, [rcx+rsi+8]
cmp edi, eax
cmovl edi, eax
loc_139E:
lea r9, [rcx+r9*4]
xor esi, esi
jmp short loc_13BB
loc_13B0:
add rcx, 4
add esi, eax
cmp rcx, r9
jz short loc_13CC
loc_13BB:
mov eax, edi
sub eax, [rcx]
cdq
idiv r8d
test edx, edx
jz short loc_13B0
mov esi, 0FFFFFFFFh
loc_13CC:
mov eax, esi
retn
loc_13D0:
mov esi, 0
jnz short loc_13CC
jmp short loc_139E
loc_13D9:
mov eax, 1
jmp short loc_1369 | long long func0(signed int *a1, int a2, int a3)
{
long long v3; // r9
signed int *v4; // rcx
signed int v5; // edi
bool v6; // zf
unsigned int v7; // esi
signed int *v8; // rax
__m128i v9; // xmm2
__m128i v10; // xmm0
__m128i v11; // xmm1
__m128i v12; // xmm1
signed int v13; // eax
__m128i v14; // xmm0
__m128i v15; // xmm0
__m128i v16; // xmm2
__m128i v17; // xmm1
long long v18; // rsi
signed int *v19; // r9
unsigned int v20; // esi
int v21; // eax
v3 = a2;
v4 = a1;
v5 = *a1;
v6 = a2 == 1;
if ( a2 <= 1 )
{
v20 = 0;
if ( !v6 )
return v20;
goto LABEL_14;
}
v7 = a2 - 1;
if ( (unsigned int)(v3 - 2) <= 2 )
{
v13 = 1;
}
else
{
v8 = v4;
v9 = _mm_shuffle_epi32(_mm_cvtsi32_si128(v5), 0);
do
{
v10 = _mm_loadu_si128((const __m128i *)(v8 + 1));
v8 += 4;
v11 = _mm_cmpgt_epi32(v10, v9);
v9 = _mm_or_si128(_mm_andnot_si128(v11, v9), _mm_and_si128(v10, v11));
}
while ( v8 != &v4[4 * (v7 >> 2)] );
v12 = _mm_srli_si128(v9, 8);
v13 = (v7 & 0xFFFFFFFC) + 1;
v14 = _mm_cmpgt_epi32(v12, v9);
v15 = _mm_or_si128(_mm_andnot_si128(v14, v9), _mm_and_si128(v12, v14));
v16 = _mm_srli_si128(v15, 4);
v17 = _mm_cmpgt_epi32(v16, v15);
v5 = _mm_cvtsi128_si32(_mm_or_si128(_mm_andnot_si128(v17, v15), _mm_and_si128(v16, v17)));
if ( (v7 & 3) == 0 )
goto LABEL_14;
}
v18 = v13;
if ( v5 < v4[v18] )
v5 = v4[v13];
if ( (int)v3 > v13 + 1 )
{
if ( v5 < v4[v18 + 1] )
v5 = v4[v18 + 1];
if ( (int)v3 > v13 + 2 && v5 < v4[v18 + 2] )
v5 = v4[v18 + 2];
}
LABEL_14:
v19 = &v4[v3];
v20 = 0;
while ( 1 )
{
v21 = (v5 - *v4) / a3;
if ( (v5 - *v4) % a3 )
break;
++v4;
v20 += v21;
if ( v4 == v19 )
return v20;
}
return (unsigned int)-1;
} | func0:
ENDBR64
MOVSXD R9,ESI
MOV RCX,RDI
MOV R8D,EDX
MOV EDI,dword ptr [RDI]
CMP R9D,0x1
JLE 0x001013d0
LEA EAX,[R9 + -0x2]
LEA ESI,[R9 + -0x1]
CMP EAX,0x2
JBE 0x001013d9
MOV EDX,ESI
MOVD XMM3,EDI
MOV RAX,RCX
SHR EDX,0x2
PSHUFD XMM2,XMM3,0x0
SHL RDX,0x4
ADD RDX,RCX
NOP word ptr [RAX + RAX*0x1]
LAB_001012f8:
MOVDQU XMM0,xmmword ptr [RAX + 0x4]
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 0x001012f8
MOVDQA XMM1,XMM2
MOV EAX,ESI
PSRLDQ XMM1,0x8
AND EAX,0xfffffffc
MOVDQA XMM0,XMM1
ADD EAX,0x1
AND ESI,0x3
PCMPGTD XMM0,XMM2
PAND XMM1,XMM0
PANDN XMM0,XMM2
POR XMM0,XMM1
MOVDQA XMM2,XMM0
PSRLDQ XMM2,0x4
MOVDQA XMM1,XMM2
PCMPGTD XMM1,XMM0
PAND XMM2,XMM1
PANDN XMM1,XMM0
POR XMM1,XMM2
MOVD EDI,XMM1
JZ 0x0010139e
LAB_00101369:
MOVSXD RDX,EAX
LEA RSI,[RDX*0x4]
MOV EDX,dword ptr [RCX + RDX*0x4]
CMP EDI,EDX
CMOVL EDI,EDX
LEA EDX,[RAX + 0x1]
CMP R9D,EDX
JLE 0x0010139e
MOV EDX,dword ptr [RCX + RSI*0x1 + 0x4]
CMP EDI,EDX
CMOVL EDI,EDX
ADD EAX,0x2
CMP R9D,EAX
JLE 0x0010139e
MOV EAX,dword ptr [RCX + RSI*0x1 + 0x8]
CMP EDI,EAX
CMOVL EDI,EAX
LAB_0010139e:
LEA R9,[RCX + R9*0x4]
XOR ESI,ESI
JMP 0x001013bb
LAB_001013b0:
ADD RCX,0x4
ADD ESI,EAX
CMP RCX,R9
JZ 0x001013cc
LAB_001013bb:
MOV EAX,EDI
SUB EAX,dword ptr [RCX]
CDQ
IDIV R8D
TEST EDX,EDX
JZ 0x001013b0
MOV ESI,0xffffffff
LAB_001013cc:
MOV EAX,ESI
RET
LAB_001013d0:
MOV ESI,0x0
JNZ 0x001013cc
JMP 0x0010139e
LAB_001013d9:
MOV EAX,0x1
JMP 0x00101369 | int func0(uint *param_1,int param_2,int param_3)
{
uint *puVar1;
uint *puVar2;
uint *puVar3;
uint *puVar4;
int iVar5;
uint *puVar6;
uint uVar7;
uint uVar8;
uint uVar9;
uint uVar10;
uint uVar11;
uint uVar12;
uint uVar13;
uint uVar14;
uint uVar15;
uVar8 = *param_1;
if (param_2 < 2) {
if (param_2 != 1) {
return 0;
}
}
else {
uVar7 = param_2 - 1;
if (param_2 - 2U < 3) {
iVar5 = 1;
}
else {
puVar6 = param_1;
uVar14 = uVar8;
uVar10 = uVar8;
uVar15 = uVar8;
do {
puVar1 = puVar6 + 1;
puVar2 = puVar6 + 2;
puVar3 = puVar6 + 3;
puVar4 = puVar6 + 4;
puVar6 = puVar6 + 4;
uVar9 = -(uint)((int)uVar8 < (int)*puVar1);
uVar11 = -(uint)((int)uVar14 < (int)*puVar2);
uVar12 = -(uint)((int)uVar10 < (int)*puVar3);
uVar13 = -(uint)((int)uVar15 < (int)*puVar4);
uVar8 = ~uVar9 & uVar8 | *puVar1 & uVar9;
uVar14 = ~uVar11 & uVar14 | *puVar2 & uVar11;
uVar10 = ~uVar12 & uVar10 | *puVar3 & uVar12;
uVar15 = ~uVar13 & uVar15 | *puVar4 & uVar13;
} while (puVar6 != param_1 + (ulong)(uVar7 >> 2) * 4);
iVar5 = (uVar7 & 0xfffffffc) + 1;
uVar8 = ~-(uint)((int)uVar8 < (int)uVar10) & uVar8 |
uVar10 & -(uint)((int)uVar8 < (int)uVar10);
uVar14 = ~-(uint)((int)uVar14 < (int)uVar15) & uVar14 |
uVar15 & -(uint)((int)uVar14 < (int)uVar15);
uVar10 = -(uint)((int)uVar8 < (int)uVar14);
uVar8 = ~uVar10 & uVar8 | uVar14 & uVar10;
if ((uVar7 & 3) == 0) goto LAB_0010139e;
}
if ((int)uVar8 < (int)param_1[iVar5]) {
uVar8 = param_1[iVar5];
}
if (iVar5 + 1 < param_2) {
if ((int)uVar8 < (int)param_1[(long)iVar5 + 1]) {
uVar8 = param_1[(long)iVar5 + 1];
}
if ((iVar5 + 2 < param_2) && ((int)uVar8 < (int)param_1[(long)iVar5 + 2])) {
uVar8 = param_1[(long)iVar5 + 2];
}
}
}
LAB_0010139e:
puVar6 = param_1 + param_2;
iVar5 = 0;
do {
uVar7 = *param_1;
if ((int)(uVar8 - uVar7) % param_3 != 0) {
return -1;
}
param_1 = param_1 + 1;
iVar5 = iVar5 + (int)(uVar8 - uVar7) / param_3;
} while (param_1 != puVar6);
return iVar5;
} |
4,528 | func0 |
#include <stdio.h>
#include <string.h>
#include <assert.h>
| const char* func0(const char* month, int days) {
const char* season;
if (strcmp(month, "January") == 0 || strcmp(month, "February") == 0 || strcmp(month, "March") == 0) {
season = "winter";
} else if (strcmp(month, "April") == 0 || strcmp(month, "May") == 0 || strcmp(month, "June") == 0) {
season = "spring";
} else if (strcmp(month, "July") == 0 || strcmp(month, "August") == 0 || strcmp(month, "September") == 0) {
season = "summer";
} else {
season = "autumn";
}
if ((strcmp(month, "March") == 0 && days > 19) ||
(strcmp(month, "June") == 0 && days > 20) ||
(strcmp(month, "September") == 0 && days > 21)) {
if (strcmp(month, "March") == 0) {
season = "spring";
}
if (strcmp(month, "June") == 0) {
season = "summer";
}
if (strcmp(month, "September") == 0) {
season = "autumn";
}
} else if ((strcmp(month, "December") == 0 && days > 20)) {
season = "winter";
}
return season;
}
| int main() {
assert(strcmp(func0("January", 4), "winter") == 0);
assert(strcmp(func0("October", 28), "autumn") == 0);
assert(strcmp(func0("June", 6), "spring") == 0);
printf("All test cases passed.\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x20,%rsp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov -0x18(%rbp),%rax
lea 0xe61(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
je 11e1 <func0+0x58>
mov -0x18(%rbp),%rax
lea 0xe52(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
je 11e1 <func0+0x58>
mov -0x18(%rbp),%rax
lea 0xe44(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
jne 11f1 <func0+0x68>
lea 0xe37(%rip),%rax
mov %rax,-0x8(%rbp)
jmpq 12a0 <func0+0x117>
mov -0x18(%rbp),%rax
lea 0xe2a(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
je 1236 <func0+0xad>
mov -0x18(%rbp),%rax
lea 0xe19(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
je 1236 <func0+0xad>
mov -0x18(%rbp),%rax
lea 0xe06(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
jne 1243 <func0+0xba>
lea 0xdf8(%rip),%rax
mov %rax,-0x8(%rbp)
jmp 12a0 <func0+0x117>
mov -0x18(%rbp),%rax
lea 0xdee(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
je 1288 <func0+0xff>
mov -0x18(%rbp),%rax
lea 0xddc(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
je 1288 <func0+0xff>
mov -0x18(%rbp),%rax
lea 0xdcc(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
jne 1295 <func0+0x10c>
lea 0xdc3(%rip),%rax
mov %rax,-0x8(%rbp)
jmp 12a0 <func0+0x117>
lea 0xdbd(%rip),%rax
mov %rax,-0x8(%rbp)
mov -0x18(%rbp),%rax
lea 0xd6e(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
jne 12bd <func0+0x134>
cmpl $0x13,-0x1c(%rbp)
jg 12f7 <func0+0x16e>
mov -0x18(%rbp),%rax
lea 0xd68(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
jne 12da <func0+0x151>
cmpl $0x14,-0x1c(%rbp)
jg 12f7 <func0+0x16e>
mov -0x18(%rbp),%rax
lea 0xd63(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
jne 135f <func0+0x1d6>
cmpl $0x15,-0x1c(%rbp)
jle 135f <func0+0x1d6>
mov -0x18(%rbp),%rax
lea 0xd17(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
jne 1319 <func0+0x190>
lea 0xd20(%rip),%rax
mov %rax,-0x8(%rbp)
mov -0x18(%rbp),%rax
lea 0xd0c(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
jne 133b <func0+0x1b2>
lea 0xd1b(%rip),%rax
mov %rax,-0x8(%rbp)
mov -0x18(%rbp),%rax
lea 0xd02(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
jne 1387 <func0+0x1fe>
lea 0xd00(%rip),%rax
mov %rax,-0x8(%rbp)
jmp 1387 <func0+0x1fe>
mov -0x18(%rbp),%rax
lea 0xcf6(%rip),%rsi
mov %rax,%rdi
callq 1090 <strcmp@plt>
test %eax,%eax
jne 1387 <func0+0x1fe>
cmpl $0x14,-0x1c(%rbp)
jle 1387 <func0+0x1fe>
lea 0xc9c(%rip),%rax
mov %rax,-0x8(%rbp)
mov -0x8(%rbp),%rax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 20h
mov [rbp+s1], rdi
mov [rbp+var_1C], esi
mov rax, [rbp+s1]
lea rdx, s2; "January"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jz short loc_11EA
mov rax, [rbp+s1]
lea rdx, aFebruary; "February"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jz short loc_11EA
mov rax, [rbp+s1]
lea rdx, aMarch; "March"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jnz short loc_11FA
loc_11EA:
lea rax, aWinter; "winter"
mov [rbp+var_8], rax
jmp loc_12BB
loc_11FA:
mov rax, [rbp+s1]
lea rdx, aApril; "April"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jz short loc_1248
mov rax, [rbp+s1]
lea rdx, aMay; "May"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jz short loc_1248
mov rax, [rbp+s1]
lea rdx, aJune; "June"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jnz short loc_1255
loc_1248:
lea rax, aSpring; "spring"
mov [rbp+var_8], rax
jmp short loc_12BB
loc_1255:
mov rax, [rbp+s1]
lea rdx, aJuly; "July"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jz short loc_12A3
mov rax, [rbp+s1]
lea rdx, aAugust; "August"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jz short loc_12A3
mov rax, [rbp+s1]
lea rdx, aSeptember; "September"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jnz short loc_12B0
loc_12A3:
lea rax, aSummer; "summer"
mov [rbp+var_8], rax
jmp short loc_12BB
loc_12B0:
lea rax, aAutumn; "autumn"
mov [rbp+var_8], rax
loc_12BB:
mov rax, [rbp+s1]
lea rdx, aMarch; "March"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jnz short loc_12DB
cmp [rbp+var_1C], 13h
jg short loc_131B
loc_12DB:
mov rax, [rbp+s1]
lea rdx, aJune; "June"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jnz short loc_12FB
cmp [rbp+var_1C], 14h
jg short loc_131B
loc_12FB:
mov rax, [rbp+s1]
lea rdx, aSeptember; "September"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jnz short loc_138C
cmp [rbp+var_1C], 15h
jle short loc_138C
loc_131B:
mov rax, [rbp+s1]
lea rdx, aMarch; "March"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jnz short loc_1340
lea rax, aSpring; "spring"
mov [rbp+var_8], rax
loc_1340:
mov rax, [rbp+s1]
lea rdx, aJune; "June"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jnz short loc_1365
lea rax, aSummer; "summer"
mov [rbp+var_8], rax
loc_1365:
mov rax, [rbp+s1]
lea rdx, aSeptember; "September"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jnz short loc_13B7
lea rax, aAutumn; "autumn"
mov [rbp+var_8], rax
jmp short loc_13B7
loc_138C:
mov rax, [rbp+s1]
lea rdx, aDecember; "December"
mov rsi, rdx; s2
mov rdi, rax; s1
call _strcmp
test eax, eax
jnz short loc_13B7
cmp [rbp+var_1C], 14h
jle short loc_13B7
lea rax, aWinter; "winter"
mov [rbp+var_8], rax
loc_13B7:
mov rax, [rbp+var_8]
leave
retn | const char * func0(const char *a1, int a2)
{
const char *v3; // [rsp+18h] [rbp-8h]
if ( !strcmp(a1, "January") || !strcmp(a1, "February") || !strcmp(a1, "March") )
{
v3 = "winter";
}
else if ( !strcmp(a1, "April") || !strcmp(a1, "May") || !strcmp(a1, "June") )
{
v3 = "spring";
}
else if ( !strcmp(a1, "July") || !strcmp(a1, "August") || !strcmp(a1, "September") )
{
v3 = "summer";
}
else
{
v3 = "autumn";
}
if ( !strcmp(a1, "March") && a2 > 19 || !strcmp(a1, "June") && a2 > 20 || !strcmp(a1, "September") && a2 > 21 )
{
if ( !strcmp(a1, "March") )
v3 = "spring";
if ( !strcmp(a1, "June") )
v3 = "summer";
if ( !strcmp(a1, "September") )
return "autumn";
}
else if ( !strcmp(a1, "December") && a2 > 20 )
{
return "winter";
}
return v3;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x20
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102008]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JZ 0x001011ea
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102010]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JZ 0x001011ea
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102019]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x001011fa
LAB_001011ea:
LEA RAX,[0x10201f]
MOV qword ptr [RBP + -0x8],RAX
JMP 0x001012bb
LAB_001011fa:
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102026]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JZ 0x00101248
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x10202c]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JZ 0x00101248
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102030]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x00101255
LAB_00101248:
LEA RAX,[0x102035]
MOV qword ptr [RBP + -0x8],RAX
JMP 0x001012bb
LAB_00101255:
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x10203c]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JZ 0x001012a3
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102041]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JZ 0x001012a3
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102048]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x001012b0
LAB_001012a3:
LEA RAX,[0x102052]
MOV qword ptr [RBP + -0x8],RAX
JMP 0x001012bb
LAB_001012b0:
LEA RAX,[0x102059]
MOV qword ptr [RBP + -0x8],RAX
LAB_001012bb:
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102019]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x001012db
CMP dword ptr [RBP + -0x1c],0x13
JG 0x0010131b
LAB_001012db:
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102030]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x001012fb
CMP dword ptr [RBP + -0x1c],0x14
JG 0x0010131b
LAB_001012fb:
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102048]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x0010138c
CMP dword ptr [RBP + -0x1c],0x15
JLE 0x0010138c
LAB_0010131b:
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102019]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x00101340
LEA RAX,[0x102035]
MOV qword ptr [RBP + -0x8],RAX
LAB_00101340:
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102030]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x00101365
LEA RAX,[0x102052]
MOV qword ptr [RBP + -0x8],RAX
LAB_00101365:
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102048]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x001013b7
LEA RAX,[0x102059]
MOV qword ptr [RBP + -0x8],RAX
JMP 0x001013b7
LAB_0010138c:
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x102060]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x001013b7
CMP dword ptr [RBP + -0x1c],0x14
JLE 0x001013b7
LEA RAX,[0x10201f]
MOV qword ptr [RBP + -0x8],RAX
LAB_001013b7:
MOV RAX,qword ptr [RBP + -0x8]
LEAVE
RET | char * func0(char *param_1,int param_2)
{
int iVar1;
char *local_10;
iVar1 = strcmp(param_1,"January");
if (((iVar1 == 0) || (iVar1 = strcmp(param_1,"February"), iVar1 == 0)) ||
(iVar1 = strcmp(param_1,"March"), iVar1 == 0)) {
local_10 = "winter";
}
else {
iVar1 = strcmp(param_1,"April");
if (((iVar1 == 0) || (iVar1 = strcmp(param_1,"May"), iVar1 == 0)) ||
(iVar1 = strcmp(param_1,"June"), iVar1 == 0)) {
local_10 = "spring";
}
else {
iVar1 = strcmp(param_1,"July");
if (((iVar1 == 0) || (iVar1 = strcmp(param_1,"August"), iVar1 == 0)) ||
(iVar1 = strcmp(param_1,"September"), iVar1 == 0)) {
local_10 = "summer";
}
else {
local_10 = "autumn";
}
}
}
iVar1 = strcmp(param_1,"March");
if (((iVar1 == 0) && (0x13 < param_2)) ||
(((iVar1 = strcmp(param_1,"June"), iVar1 == 0 && (0x14 < param_2)) ||
((iVar1 = strcmp(param_1,"September"), iVar1 == 0 && (0x15 < param_2)))))) {
iVar1 = strcmp(param_1,"March");
if (iVar1 == 0) {
local_10 = "spring";
}
iVar1 = strcmp(param_1,"June");
if (iVar1 == 0) {
local_10 = "summer";
}
iVar1 = strcmp(param_1,"September");
if (iVar1 == 0) {
local_10 = "autumn";
}
return local_10;
}
iVar1 = strcmp(param_1,"December");
if (iVar1 != 0) {
return local_10;
}
if (param_2 < 0x15) {
return local_10;
}
return "winter";
} |
4,529 | func0 |
#include <stdio.h>
#include <string.h>
#include <assert.h>
| const char* func0(const char* month, int days) {
const char* season;
if (strcmp(month, "January") == 0 || strcmp(month, "February") == 0 || strcmp(month, "March") == 0) {
season = "winter";
} else if (strcmp(month, "April") == 0 || strcmp(month, "May") == 0 || strcmp(month, "June") == 0) {
season = "spring";
} else if (strcmp(month, "July") == 0 || strcmp(month, "August") == 0 || strcmp(month, "September") == 0) {
season = "summer";
} else {
season = "autumn";
}
if ((strcmp(month, "March") == 0 && days > 19) ||
(strcmp(month, "June") == 0 && days > 20) ||
(strcmp(month, "September") == 0 && days > 21)) {
if (strcmp(month, "March") == 0) {
season = "spring";
}
if (strcmp(month, "June") == 0) {
season = "summer";
}
if (strcmp(month, "September") == 0) {
season = "autumn";
}
} else if ((strcmp(month, "December") == 0 && days > 20)) {
season = "winter";
}
return season;
}
| int main() {
assert(strcmp(func0("January", 4), "winter") == 0);
assert(strcmp(func0("October", 28), "autumn") == 0);
assert(strcmp(func0("June", 6), "spring") == 0);
printf("All test cases passed.\n");
return 0;
}
| O1 | c | func0:
endbr64
mov %rdi,%rdx
mov %esi,%eax
mov $0x8,%ecx
lea 0xea2(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
je 1294 <func0+0x12b>
mov $0x9,%ecx
lea 0xe8b(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
je 1294 <func0+0x12b>
mov $0x6,%ecx
lea 0xe75(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
je 1294 <func0+0x12b>
mov $0x6,%ecx
lea 0xe5c(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
lea 0xe1e(%rip),%r8
test %cl,%cl
je 128c <func0+0x123>
mov $0x4,%ecx
lea 0xe3c(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
je 128c <func0+0x123>
mov $0x5,%ecx
lea 0xe25(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
je 128c <func0+0x123>
mov $0x5,%ecx
lea 0xe0f(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
lea 0xdc9(%rip),%r8
test %cl,%cl
je 128c <func0+0x123>
mov $0x7,%ecx
lea 0xdf2(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
je 128c <func0+0x123>
mov $0xa,%ecx
lea 0xdde(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
lea 0xd91(%rip),%rcx
cmovne %rcx,%r8
mov $0x0,%r9d
jmp 12c6 <func0+0x15d>
mov $0x6,%ecx
lea 0xd91(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
sete %r9b
cmp $0x13,%eax
jle 12bf <func0+0x156>
test %r9b,%r9b
jne 1373 <func0+0x20a>
lea 0xd3e(%rip),%r8
mov $0x5,%ecx
lea 0xd6f(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
cmp $0x14,%eax
setg %r10b
test %cl,%cl
jne 12f1 <func0+0x188>
test %r10b,%r10b
jne 13c4 <func0+0x25b>
mov $0xa,%ecx
lea 0xd55(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
movsbl %cl,%ecx
cmp $0x15,%eax
jle 1314 <func0+0x1ab>
test %ecx,%ecx
je 1342 <func0+0x1d9>
mov $0x9,%ecx
lea 0xd3c(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %al
sbb $0x0,%al
test %al,%al
jne 13c0 <func0+0x257>
test %r10b,%r10b
lea 0xcc8(%rip),%rax
cmovne %rax,%r8
jmp 13c0 <func0+0x257>
test %r9b,%r9b
lea 0xcbf(%rip),%rax
cmovne %rax,%r8
mov $0x5,%ecx
lea 0xce5(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %al
sbb $0x0,%al
test %al,%al
jne 139d <func0+0x234>
lea 0xca8(%rip),%r8
jmp 13c0 <func0+0x257>
mov $0x5,%ecx
lea 0xcc2(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %al
sbb $0x0,%al
test %al,%al
lea 0xc80(%rip),%r8
lea 0xc72(%rip),%rax
cmovne %rax,%r8
mov $0xa,%ecx
lea 0xca9(%rip),%rdi
mov %rdx,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %al
sbb $0x0,%al
test %al,%al
lea 0xc5d(%rip),%rax
cmove %rax,%r8
mov %r8,%rax
retq
lea 0xc47(%rip),%r8
jmp 139d <func0+0x234>
| func0:
endbr64
push r14
push r13
push r12
push rbp
push rbx
mov rbx, rdi
mov ebp, esi
lea rsi, aJanuary; "January"
call _strcmp
test eax, eax
jz loc_126D
lea rsi, aFebruary; "February"
mov rdi, rbx
call _strcmp
test eax, eax
jz loc_126D
lea rsi, aMarch; "March"
mov rdi, rbx
call _strcmp
test eax, eax
jz loc_126D
lea rsi, aApril; "April"
mov rdi, rbx
call _strcmp
lea r12, aSpring; "spring"
test eax, eax
jz short loc_1265
lea rsi, aMay; "May"
mov rdi, rbx
call _strcmp
test eax, eax
jz short loc_1265
lea rsi, aJune; "June"
mov rdi, rbx
call _strcmp
test eax, eax
jz short loc_1265
lea rsi, aJuly; "July"
mov rdi, rbx
call _strcmp
lea r12, aSummer; "summer"
test eax, eax
jz short loc_1265
lea rsi, aAugust; "August"
mov rdi, rbx
call _strcmp
test eax, eax
jz short loc_1265
lea rsi, aSeptember; "September"
mov rdi, rbx
call _strcmp
test eax, eax
lea rax, aAutumn; "autumn"
cmovnz r12, rax
loc_1265:
mov r13d, 0
jmp short loc_1297
loc_126D:
lea rsi, aMarch; "March"
mov rdi, rbx
call _strcmp
test eax, eax
setz r13b
cmp ebp, 13h
jle short loc_1290
test r13b, r13b
jnz loc_131F
loc_1290:
lea r12, aWinter; "winter"
loc_1297:
lea rsi, aJune; "June"
mov rdi, rbx
call _strcmp
cmp ebp, 14h
setnle r14b
test eax, eax
jnz short loc_12BA
test r14b, r14b
jnz loc_136A
loc_12BA:
lea rsi, aSeptember; "September"
mov rdi, rbx
call _strcmp
cmp ebp, 15h
jle short loc_12D2
test eax, eax
jz short loc_12F5
loc_12D2:
lea rsi, aDecember; "December"
mov rdi, rbx
call _strcmp
test eax, eax
jnz short loc_135E
test r14b, r14b
lea rax, aWinter; "winter"
cmovnz r12, rax
jmp short loc_135E
loc_12F5:
test r13b, r13b
lea rax, aSpring; "spring"
cmovnz r12, rax
lea rsi, aJune; "June"
mov rdi, rbx
call _strcmp
test eax, eax
jnz short loc_1342
lea r12, aAutumn; "autumn"
jmp short loc_135E
loc_131F:
lea rsi, aJune; "June"
mov rdi, rbx
call _strcmp
test eax, eax
lea r12, aSummer; "summer"
lea rax, aSpring; "spring"
cmovnz r12, rax
loc_1342:
lea rsi, aSeptember; "September"
mov rdi, rbx
call _strcmp
test eax, eax
lea rax, aAutumn; "autumn"
cmovz r12, rax
loc_135E:
mov rax, r12
pop rbx
pop rbp
pop r12
pop r13
pop r14
retn
loc_136A:
lea r12, aSummer; "summer"
jmp short loc_1342 | const char * func0(long long a1, int a2)
{
const char *v2; // r12
bool v3; // r13
int v4; // eax
int v5; // eax
if ( !(unsigned int)strcmp(a1, "January")
|| !(unsigned int)strcmp(a1, "February")
|| !(unsigned int)strcmp(a1, "March") )
{
v4 = strcmp(a1, "March");
v3 = v4 == 0;
if ( a2 > 19 && !v4 )
{
v2 = "summer";
if ( (unsigned int)strcmp(a1, "June") )
v2 = "spring";
goto LABEL_29;
}
v2 = "winter";
}
else
{
v2 = "spring";
if ( (unsigned int)strcmp(a1, "April") )
{
if ( (unsigned int)strcmp(a1, "May") )
{
if ( (unsigned int)strcmp(a1, "June") )
{
v2 = "summer";
if ( (unsigned int)strcmp(a1, "July") )
{
if ( (unsigned int)strcmp(a1, "August") && (unsigned int)strcmp(a1, "September") )
v2 = "autumn";
}
}
}
}
v3 = 0;
}
if ( !(unsigned int)strcmp(a1, "June") && a2 > 20 )
{
v2 = "summer";
}
else
{
v5 = strcmp(a1, "September");
if ( a2 <= 21 || v5 )
{
if ( !(unsigned int)strcmp(a1, "December") && a2 > 20 )
return "winter";
return v2;
}
if ( v3 )
v2 = "spring";
if ( !(unsigned int)strcmp(a1, "June") )
return "autumn";
}
LABEL_29:
if ( !(unsigned int)strcmp(a1, "September") )
return "autumn";
return v2;
} | func0:
ENDBR64
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
MOV RBX,RDI
MOV EBP,ESI
LEA RSI,[0x102020]
CALL 0x00101090
TEST EAX,EAX
JZ 0x0010126d
LEA RSI,[0x102028]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
JZ 0x0010126d
LEA RSI,[0x102031]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
JZ 0x0010126d
LEA RSI,[0x102037]
MOV RDI,RBX
CALL 0x00101090
LEA R12,[0x10200b]
TEST EAX,EAX
JZ 0x00101265
LEA RSI,[0x10203d]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
JZ 0x00101265
LEA RSI,[0x102041]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
JZ 0x00101265
LEA RSI,[0x102046]
MOV RDI,RBX
CALL 0x00101090
LEA R12,[0x102012]
TEST EAX,EAX
JZ 0x00101265
LEA RSI,[0x10204b]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
JZ 0x00101265
LEA RSI,[0x102052]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
LEA RAX,[0x102019]
CMOVNZ R12,RAX
LAB_00101265:
MOV R13D,0x0
JMP 0x00101297
LAB_0010126d:
LEA RSI,[0x102031]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
SETZ R13B
CMP EBP,0x13
JLE 0x00101290
TEST R13B,R13B
JNZ 0x0010131f
LAB_00101290:
LEA R12,[0x102004]
LAB_00101297:
LEA RSI,[0x102041]
MOV RDI,RBX
CALL 0x00101090
CMP EBP,0x14
SETG R14B
TEST EAX,EAX
JNZ 0x001012ba
TEST R14B,R14B
JNZ 0x0010136a
LAB_001012ba:
LEA RSI,[0x102052]
MOV RDI,RBX
CALL 0x00101090
CMP EBP,0x15
JLE 0x001012d2
TEST EAX,EAX
JZ 0x001012f5
LAB_001012d2:
LEA RSI,[0x10205c]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x0010135e
TEST R14B,R14B
LEA RAX,[0x102004]
CMOVNZ R12,RAX
JMP 0x0010135e
LAB_001012f5:
TEST R13B,R13B
LEA RAX,[0x10200b]
CMOVNZ R12,RAX
LEA RSI,[0x102041]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x00101342
LEA R12,[0x102019]
JMP 0x0010135e
LAB_0010131f:
LEA RSI,[0x102041]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
LEA R12,[0x102012]
LEA RAX,[0x10200b]
CMOVNZ R12,RAX
LAB_00101342:
LEA RSI,[0x102052]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
LEA RAX,[0x102019]
CMOVZ R12,RAX
LAB_0010135e:
MOV RAX,R12
POP RBX
POP RBP
POP R12
POP R13
POP R14
RET
LAB_0010136a:
LEA R12,[0x102012]
JMP 0x00101342 | char * func0(char *param_1,int param_2)
{
int iVar1;
char *pcVar2;
bool bVar3;
iVar1 = strcmp(param_1,"January");
if (((iVar1 == 0) || (iVar1 = strcmp(param_1,"February"), iVar1 == 0)) ||
(iVar1 = strcmp(param_1,"March"), iVar1 == 0)) {
iVar1 = strcmp(param_1,"March");
bVar3 = iVar1 == 0;
if ((0x13 < param_2) && (bVar3)) {
iVar1 = strcmp(param_1,"June");
pcVar2 = "summer";
if (iVar1 != 0) {
pcVar2 = "spring";
}
goto LAB_00101342;
}
pcVar2 = "winter";
}
else {
iVar1 = strcmp(param_1,"April");
pcVar2 = "spring";
if (((iVar1 != 0) && (iVar1 = strcmp(param_1,"May"), iVar1 != 0)) &&
(iVar1 = strcmp(param_1,"June"), iVar1 != 0)) {
iVar1 = strcmp(param_1,"July");
pcVar2 = "summer";
if (((iVar1 != 0) && (iVar1 = strcmp(param_1,"August"), iVar1 != 0)) &&
(iVar1 = strcmp(param_1,"September"), iVar1 != 0)) {
pcVar2 = "autumn";
}
}
bVar3 = false;
}
iVar1 = strcmp(param_1,"June");
if ((iVar1 != 0) || (param_2 < 0x15)) {
iVar1 = strcmp(param_1,"September");
if ((param_2 < 0x16) || (iVar1 != 0)) {
iVar1 = strcmp(param_1,"December");
if (iVar1 != 0) {
return pcVar2;
}
if (param_2 < 0x15) {
return pcVar2;
}
return "winter";
}
if (bVar3) {
pcVar2 = "spring";
}
iVar1 = strcmp(param_1,"June");
if (iVar1 == 0) {
return "autumn";
}
}
else {
pcVar2 = "summer";
}
LAB_00101342:
iVar1 = strcmp(param_1,"September");
if (iVar1 == 0) {
pcVar2 = "autumn";
}
return pcVar2;
} |
4,530 | func0 |
#include <stdio.h>
#include <string.h>
#include <assert.h>
| const char* func0(const char* month, int days) {
const char* season;
if (strcmp(month, "January") == 0 || strcmp(month, "February") == 0 || strcmp(month, "March") == 0) {
season = "winter";
} else if (strcmp(month, "April") == 0 || strcmp(month, "May") == 0 || strcmp(month, "June") == 0) {
season = "spring";
} else if (strcmp(month, "July") == 0 || strcmp(month, "August") == 0 || strcmp(month, "September") == 0) {
season = "summer";
} else {
season = "autumn";
}
if ((strcmp(month, "March") == 0 && days > 19) ||
(strcmp(month, "June") == 0 && days > 20) ||
(strcmp(month, "September") == 0 && days > 21)) {
if (strcmp(month, "March") == 0) {
season = "spring";
}
if (strcmp(month, "June") == 0) {
season = "summer";
}
if (strcmp(month, "September") == 0) {
season = "autumn";
}
} else if ((strcmp(month, "December") == 0 && days > 20)) {
season = "winter";
}
return season;
}
| int main() {
assert(strcmp(func0("January", 4), "winter") == 0);
assert(strcmp(func0("October", 28), "autumn") == 0);
assert(strcmp(func0("June", 6), "spring") == 0);
printf("All test cases passed.\n");
return 0;
}
| O2 | c | func0:
endbr64
mov %rdi,%rax
mov $0x8,%ecx
mov %esi,%r10d
lea 0xd9a(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
mov $0x6,%ecx
lea 0xd91(%rip),%rdi
mov %rax,%rsi
seta %r11b
sbb $0x0,%r11b
repz cmpsb %es:(%rdi),%ds:(%rsi)
mov $0x5,%ecx
lea 0xd7e(%rip),%rdi
mov %rax,%rsi
seta %r8b
sbb $0x0,%r8b
repz cmpsb %es:(%rdi),%ds:(%rsi)
mov $0xa,%ecx
mov %rax,%rsi
movsbl %r8b,%r8d
lea 0xd63(%rip),%rdi
seta %dl
sbb $0x0,%dl
repz cmpsb %es:(%rdi),%ds:(%rsi)
movsbl %dl,%edx
seta %r9b
sbb $0x0,%r9b
movsbl %r9b,%r9d
test %r11b,%r11b
je 130b <func0+0x9b>
mov $0x9,%ecx
lea 0xd45(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
jne 13a0 <func0+0x130>
test %r8d,%r8d
jne 1316 <func0+0xa6>
cmp $0x13,%r10d
jg 1370 <func0+0x100>
cmp $0x14,%r10d
setg %cl
mov %ecx,%r11d
test %edx,%edx
jne 132c <func0+0xbc>
test %cl,%cl
jne 14b0 <func0+0x240>
test %r9d,%r9d
jne 133b <func0+0xcb>
cmp $0x15,%r10d
jg 1450 <func0+0x1e0>
lea 0xcd7(%rip),%r10
mov %rax,%rsi
mov $0x9,%ecx
lea 0xd0b(%rip),%rdi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %al
sbb $0x0,%al
test %al,%al
jne 1392 <func0+0x122>
test %r11b,%r11b
lea 0xcb3(%rip),%rax
cmovne %rax,%r10
mov %r10,%rax
retq
xchg %ax,%ax
test %edx,%edx
lea 0xc92(%rip),%r10
lea 0xc84(%rip),%rax
cmovne %rax,%r10
test %r9d,%r9d
lea 0xc84(%rip),%rax
cmove %rax,%r10
mov %r10,%rax
retq
nopw %cs:0x0(%rax,%rax,1)
test %r8d,%r8d
je 1310 <func0+0xa0>
mov $0x6,%ecx
lea 0xc91(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
je 1480 <func0+0x210>
mov $0x4,%ecx
lea 0xc78(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
je 1480 <func0+0x210>
test %edx,%edx
je 1480 <func0+0x210>
mov $0x5,%ecx
lea 0xc55(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %dl
sbb $0x0,%dl
test %dl,%dl
je 14c0 <func0+0x250>
mov $0x7,%ecx
lea 0xc3b(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %dl
sbb $0x0,%dl
test %dl,%dl
je 14c0 <func0+0x250>
test %r9d,%r9d
je 14c0 <func0+0x250>
cmp $0x14,%r10d
lea 0xbd1(%rip),%r10
setg %r11b
jmpq 1342 <func0+0xd2>
nopw 0x0(%rax,%rax,1)
lea 0xbbb(%rip),%r10
test %r8d,%r8d
je 1392 <func0+0x122>
lea 0xbb2(%rip),%r10
test %edx,%edx
jne 1384 <func0+0x114>
lea 0xb9c(%rip),%r10
jmpq 1392 <func0+0x122>
nopl 0x0(%rax,%rax,1)
cmp $0x14,%r10d
setg %cl
mov %ecx,%r11d
test %edx,%edx
jne 1492 <func0+0x222>
test %cl,%cl
jne 14b0 <func0+0x240>
cmp $0x15,%r10d
lea 0xb67(%rip),%r10
jle 1342 <func0+0xd2>
test %r9d,%r9d
jne 1342 <func0+0xd2>
jmp 1467 <func0+0x1f7>
xchg %ax,%ax
lea 0xb54(%rip),%r10
jmpq 1384 <func0+0x114>
nopl 0x0(%rax)
cmp $0x14,%r10d
setg %r11b
test %r9d,%r9d
jne 14d3 <func0+0x263>
cmp $0x15,%r10d
jg 14b0 <func0+0x240>
lea 0xb31(%rip),%r10
jmpq 1342 <func0+0xd2>
| func0:
endbr64
push r15
push r14
push r13
push r12
push rbp
mov rbp, rdi
push rbx
mov ebx, esi
lea rsi, aJanuary; "January"
sub rsp, 18h
call _strcmp
lea rsi, aMarch; "March"
mov rdi, rbp
mov r12d, eax
call _strcmp
lea rsi, aJune; "June"
mov rdi, rbp
mov r14d, eax
call _strcmp
lea rsi, aSeptember; "September"
mov rdi, rbp
mov r13d, eax
call _strcmp
mov r15d, eax
test r12d, r12d
jz short loc_12F8
lea rsi, aFebruary; "February"
mov rdi, rbp
call _strcmp
test eax, eax
jnz loc_1398
loc_12F8:
test r14d, r14d
jnz short loc_1302
loc_12FD:
cmp ebx, 13h
jg short loc_1360
loc_1302:
cmp ebx, 14h
setnle al
mov edx, eax
test r13d, r13d
jnz short loc_1317
test al, al
jnz loc_1480
loc_1317:
test r15d, r15d
jnz short loc_1325
cmp ebx, 15h
jg loc_1420
loc_1325:
lea r12, aWinter; "winter"
loc_132C:
lea rsi, aDecember; "December"
mov rdi, rbp
mov [rsp+48h+var_39], dl
call _strcmp
test eax, eax
jnz short loc_1383
movzx edx, [rsp+48h+var_39]
lea rax, aWinter; "winter"
test dl, dl
cmovnz r12, rax
jmp short loc_1383
loc_1360:
test r13d, r13d
lea r12, aSummer; "summer"
lea rax, aSpring; "spring"
cmovnz r12, rax
loc_1375:
test r15d, r15d
lea rax, aAutumn; "autumn"
cmovz r12, rax
loc_1383:
add rsp, 18h
mov rax, r12
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_1398:
test r14d, r14d
jz loc_12FD
lea rsi, aApril; "April"
mov rdi, rbp
call _strcmp
test eax, eax
jz loc_1450
lea rsi, aMay; "May"
mov rdi, rbp
call _strcmp
test eax, eax
jz loc_1450
test r13d, r13d
jz short loc_1450
lea rsi, aJuly; "July"
mov rdi, rbp
call _strcmp
test eax, eax
jz loc_1490
lea rsi, aAugust; "August"
mov rdi, rbp
call _strcmp
test eax, eax
jz loc_1490
test r15d, r15d
jz loc_1490
cmp ebx, 14h
lea r12, aAutumn; "autumn"
setnle dl
jmp loc_132C
loc_1420:
lea r12, aAutumn; "autumn"
test r14d, r14d
jz loc_1383
lea r12, aWinter; "winter"
loc_1437:
test r13d, r13d
jnz loc_1375
lea r12, aAutumn; "autumn"
jmp loc_1383
loc_1450:
cmp ebx, 14h
setnle al
mov edx, eax
test r13d, r13d
jnz short loc_1461
test al, al
jnz short loc_1480
loc_1461:
lea r12, aSpring; "spring"
test r15d, r15d
jnz loc_132C
cmp ebx, 15h
jle loc_132C
jmp short loc_1437
loc_1480:
lea r12, aSummer; "summer"
jmp loc_1375
loc_1490:
cmp ebx, 14h
setnle dl
cmp ebx, 15h
jle short loc_14A0
test r15d, r15d
jz short loc_1480
loc_14A0:
lea r12, aSummer; "summer"
jmp loc_132C | const char * func0(long long a1, int a2)
{
int v2; // r12d
int v3; // r14d
int v4; // r13d
int v5; // r15d
bool v6; // dl
const char *v7; // r12
bool v9; // [rsp+Fh] [rbp-39h]
v2 = strcmp(a1, "January");
v3 = strcmp(a1, "March");
v4 = strcmp(a1, "June");
v5 = strcmp(a1, "September");
if ( v2 && (unsigned int)strcmp(a1, "February") )
{
if ( v3 )
{
if ( !(unsigned int)strcmp(a1, "April") || !(unsigned int)strcmp(a1, "May") || !v4 )
{
v6 = a2 > 20;
if ( v4 || a2 <= 20 )
{
v7 = "spring";
if ( v5 || a2 <= 21 )
{
LABEL_10:
v9 = v6;
if ( !(unsigned int)strcmp(a1, "December") && v9 )
return "winter";
return v7;
}
goto LABEL_29;
}
}
else
{
if ( (unsigned int)strcmp(a1, "July") && (unsigned int)strcmp(a1, "August") && v5 )
{
v7 = "autumn";
v6 = a2 > 20;
goto LABEL_10;
}
v6 = a2 > 20;
if ( a2 <= 21 || v5 )
{
v7 = "summer";
goto LABEL_10;
}
}
goto LABEL_36;
}
goto LABEL_4;
}
if ( !v3 )
{
LABEL_4:
if ( a2 > 19 )
{
v7 = "summer";
if ( v4 )
v7 = "spring";
goto LABEL_16;
}
}
v6 = a2 > 20;
if ( v4 || a2 <= 20 )
{
if ( v5 || a2 <= 21 )
{
v7 = "winter";
goto LABEL_10;
}
v7 = "autumn";
if ( !v3 )
return v7;
v7 = "winter";
LABEL_29:
if ( !v4 )
return "autumn";
goto LABEL_16;
}
LABEL_36:
v7 = "summer";
LABEL_16:
if ( !v5 )
return "autumn";
return v7;
} | func0:
ENDBR64
PUSH R15
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
MOV RBP,RDI
PUSH RBX
MOV EBX,ESI
LEA RSI,[0x102020]
SUB RSP,0x18
CALL 0x00101090
LEA RSI,[0x102028]
MOV RDI,RBP
MOV R12D,EAX
CALL 0x00101090
LEA RSI,[0x10202e]
MOV RDI,RBP
MOV R14D,EAX
CALL 0x00101090
LEA RSI,[0x102033]
MOV RDI,RBP
MOV R13D,EAX
CALL 0x00101090
MOV R15D,EAX
TEST R12D,R12D
JZ 0x001012f8
LEA RSI,[0x10203d]
MOV RDI,RBP
CALL 0x00101090
TEST EAX,EAX
JNZ 0x00101398
LAB_001012f8:
TEST R14D,R14D
JNZ 0x00101302
LAB_001012fd:
CMP EBX,0x13
JG 0x00101360
LAB_00101302:
CMP EBX,0x14
SETG AL
MOV EDX,EAX
TEST R13D,R13D
JNZ 0x00101317
TEST AL,AL
JNZ 0x00101480
LAB_00101317:
TEST R15D,R15D
JNZ 0x00101325
CMP EBX,0x15
JG 0x00101420
LAB_00101325:
LEA R12,[0x102012]
LAB_0010132c:
LEA RSI,[0x10205c]
MOV RDI,RBP
MOV byte ptr [RSP + 0xf],DL
CALL 0x00101090
TEST EAX,EAX
JNZ 0x00101383
MOVZX EDX,byte ptr [RSP + 0xf]
LEA RAX,[0x102012]
TEST DL,DL
CMOVNZ R12,RAX
JMP 0x00101383
LAB_00101360:
TEST R13D,R13D
LEA R12,[0x10200b]
LEA RAX,[0x102004]
CMOVNZ R12,RAX
LAB_00101375:
TEST R15D,R15D
LEA RAX,[0x102019]
CMOVZ R12,RAX
LAB_00101383:
ADD RSP,0x18
MOV RAX,R12
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_00101398:
TEST R14D,R14D
JZ 0x001012fd
LEA RSI,[0x102046]
MOV RDI,RBP
CALL 0x00101090
TEST EAX,EAX
JZ 0x00101450
LEA RSI,[0x10204c]
MOV RDI,RBP
CALL 0x00101090
TEST EAX,EAX
JZ 0x00101450
TEST R13D,R13D
JZ 0x00101450
LEA RSI,[0x102050]
MOV RDI,RBP
CALL 0x00101090
TEST EAX,EAX
JZ 0x00101490
LEA RSI,[0x102055]
MOV RDI,RBP
CALL 0x00101090
TEST EAX,EAX
JZ 0x00101490
TEST R15D,R15D
JZ 0x00101490
CMP EBX,0x14
LEA R12,[0x102019]
SETG DL
JMP 0x0010132c
LAB_00101420:
LEA R12,[0x102019]
TEST R14D,R14D
JZ 0x00101383
LEA R12,[0x102012]
LAB_00101437:
TEST R13D,R13D
JNZ 0x00101375
LEA R12,[0x102019]
JMP 0x00101383
LAB_00101450:
CMP EBX,0x14
SETG AL
MOV EDX,EAX
TEST R13D,R13D
JNZ 0x00101461
TEST AL,AL
JNZ 0x00101480
LAB_00101461:
LEA R12,[0x102004]
TEST R15D,R15D
JNZ 0x0010132c
CMP EBX,0x15
JLE 0x0010132c
JMP 0x00101437
LAB_00101480:
LEA R12,[0x10200b]
JMP 0x00101375
LAB_00101490:
CMP EBX,0x14
SETG DL
CMP EBX,0x15
JLE 0x001014a0
TEST R15D,R15D
JZ 0x00101480
LAB_001014a0:
LEA R12,[0x10200b]
JMP 0x0010132c | char * func0(char *param_1,int param_2)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
char *pcVar5;
iVar1 = strcmp(param_1,"January");
iVar2 = strcmp(param_1,"March");
iVar3 = strcmp(param_1,"June");
iVar4 = strcmp(param_1,"September");
if ((iVar1 == 0) || (iVar1 = strcmp(param_1,"February"), iVar1 == 0)) {
if (iVar2 == 0) goto LAB_001012fd;
LAB_00101302:
if ((iVar3 != 0) || (param_2 < 0x15)) {
if ((iVar4 != 0) || (param_2 < 0x16)) {
pcVar5 = "winter";
LAB_0010132c:
iVar1 = strcmp(param_1,"December");
if (iVar1 != 0) {
return pcVar5;
}
if (param_2 < 0x15) {
return pcVar5;
}
return "winter";
}
if (iVar2 == 0) {
return "autumn";
}
pcVar5 = "winter";
LAB_00101437:
if (iVar3 == 0) {
return "autumn";
}
goto LAB_00101375;
}
}
else {
if (iVar2 == 0) {
LAB_001012fd:
if (0x13 < param_2) {
pcVar5 = "summer";
if (iVar3 != 0) {
pcVar5 = "spring";
}
goto LAB_00101375;
}
goto LAB_00101302;
}
iVar1 = strcmp(param_1,"April");
if (((iVar1 == 0) || (iVar1 = strcmp(param_1,"May"), iVar1 == 0)) || (iVar3 == 0)) {
if ((iVar3 == 0) && (0x14 < param_2)) goto LAB_00101480;
pcVar5 = "spring";
if ((iVar4 != 0) || (param_2 < 0x16)) goto LAB_0010132c;
goto LAB_00101437;
}
iVar1 = strcmp(param_1,"July");
if (((iVar1 != 0) && (iVar1 = strcmp(param_1,"August"), iVar1 != 0)) && (iVar4 != 0)) {
pcVar5 = "autumn";
goto LAB_0010132c;
}
if ((param_2 < 0x16) || (iVar4 != 0)) {
pcVar5 = "summer";
goto LAB_0010132c;
}
}
LAB_00101480:
pcVar5 = "summer";
LAB_00101375:
if (iVar4 == 0) {
pcVar5 = "autumn";
}
return pcVar5;
} |
4,531 | func0 |
#include <stdio.h>
#include <string.h>
#include <assert.h>
| const char* func0(const char* month, int days) {
const char* season;
if (strcmp(month, "January") == 0 || strcmp(month, "February") == 0 || strcmp(month, "March") == 0) {
season = "winter";
} else if (strcmp(month, "April") == 0 || strcmp(month, "May") == 0 || strcmp(month, "June") == 0) {
season = "spring";
} else if (strcmp(month, "July") == 0 || strcmp(month, "August") == 0 || strcmp(month, "September") == 0) {
season = "summer";
} else {
season = "autumn";
}
if ((strcmp(month, "March") == 0 && days > 19) ||
(strcmp(month, "June") == 0 && days > 20) ||
(strcmp(month, "September") == 0 && days > 21)) {
if (strcmp(month, "March") == 0) {
season = "spring";
}
if (strcmp(month, "June") == 0) {
season = "summer";
}
if (strcmp(month, "September") == 0) {
season = "autumn";
}
} else if ((strcmp(month, "December") == 0 && days > 20)) {
season = "winter";
}
return season;
}
| int main() {
assert(strcmp(func0("January", 4), "winter") == 0);
assert(strcmp(func0("October", 28), "autumn") == 0);
assert(strcmp(func0("June", 6), "spring") == 0);
printf("All test cases passed.\n");
return 0;
}
| O3 | c | func0:
endbr64
mov %rdi,%rax
mov $0x8,%ecx
mov %esi,%r10d
lea 0xd9a(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
mov $0x6,%ecx
lea 0xd91(%rip),%rdi
mov %rax,%rsi
seta %r11b
sbb $0x0,%r11b
repz cmpsb %es:(%rdi),%ds:(%rsi)
mov $0x5,%ecx
lea 0xd7e(%rip),%rdi
mov %rax,%rsi
seta %r8b
sbb $0x0,%r8b
repz cmpsb %es:(%rdi),%ds:(%rsi)
mov $0xa,%ecx
mov %rax,%rsi
movsbl %r8b,%r8d
lea 0xd63(%rip),%rdi
seta %dl
sbb $0x0,%dl
repz cmpsb %es:(%rdi),%ds:(%rsi)
movsbl %dl,%edx
seta %r9b
sbb $0x0,%r9b
movsbl %r9b,%r9d
test %r11b,%r11b
je 130b <func0+0x9b>
mov $0x9,%ecx
lea 0xd45(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
jne 13a0 <func0+0x130>
test %r8d,%r8d
jne 1316 <func0+0xa6>
cmp $0x13,%r10d
jg 1370 <func0+0x100>
cmp $0x14,%r10d
setg %cl
mov %ecx,%r11d
test %edx,%edx
jne 132c <func0+0xbc>
test %cl,%cl
jne 14b0 <func0+0x240>
test %r9d,%r9d
jne 133b <func0+0xcb>
cmp $0x15,%r10d
jg 1450 <func0+0x1e0>
lea 0xcd7(%rip),%r10
mov %rax,%rsi
mov $0x9,%ecx
lea 0xd0b(%rip),%rdi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %al
sbb $0x0,%al
test %al,%al
jne 1392 <func0+0x122>
test %r11b,%r11b
lea 0xcb3(%rip),%rax
cmovne %rax,%r10
mov %r10,%rax
retq
xchg %ax,%ax
test %edx,%edx
lea 0xc92(%rip),%r10
lea 0xc84(%rip),%rax
cmovne %rax,%r10
test %r9d,%r9d
lea 0xc84(%rip),%rax
cmove %rax,%r10
mov %r10,%rax
retq
nopw %cs:0x0(%rax,%rax,1)
test %r8d,%r8d
je 1310 <func0+0xa0>
mov $0x6,%ecx
lea 0xc91(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
je 1480 <func0+0x210>
mov $0x4,%ecx
lea 0xc78(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %cl
sbb $0x0,%cl
test %cl,%cl
je 1480 <func0+0x210>
test %edx,%edx
je 1480 <func0+0x210>
mov $0x5,%ecx
lea 0xc55(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %dl
sbb $0x0,%dl
test %dl,%dl
je 14c0 <func0+0x250>
mov $0x7,%ecx
lea 0xc3b(%rip),%rdi
mov %rax,%rsi
repz cmpsb %es:(%rdi),%ds:(%rsi)
seta %dl
sbb $0x0,%dl
test %dl,%dl
je 14c0 <func0+0x250>
test %r9d,%r9d
je 14c0 <func0+0x250>
cmp $0x14,%r10d
lea 0xbd1(%rip),%r10
setg %r11b
jmpq 1342 <func0+0xd2>
nopw 0x0(%rax,%rax,1)
lea 0xbbb(%rip),%r10
test %r8d,%r8d
je 1392 <func0+0x122>
lea 0xbb2(%rip),%r10
test %edx,%edx
jne 1384 <func0+0x114>
lea 0xb9c(%rip),%r10
jmpq 1392 <func0+0x122>
nopl 0x0(%rax,%rax,1)
cmp $0x14,%r10d
setg %cl
mov %ecx,%r11d
test %edx,%edx
jne 1492 <func0+0x222>
test %cl,%cl
jne 14b0 <func0+0x240>
cmp $0x15,%r10d
lea 0xb67(%rip),%r10
jle 1342 <func0+0xd2>
test %r9d,%r9d
jne 1342 <func0+0xd2>
jmp 1467 <func0+0x1f7>
xchg %ax,%ax
lea 0xb54(%rip),%r10
jmpq 1384 <func0+0x114>
nopl 0x0(%rax)
cmp $0x14,%r10d
setg %r11b
test %r9d,%r9d
jne 14d3 <func0+0x263>
cmp $0x15,%r10d
jg 14b0 <func0+0x240>
lea 0xb31(%rip),%r10
jmpq 1342 <func0+0xd2>
| func0:
endbr64
push r14
push r13
push r12
mov r12d, esi
lea rsi, s1; "January"
push rbp
push rbx
mov rbx, rdi
call _strcmp
lea rsi, aMarch; "March"
mov rdi, rbx; s1
mov r13d, eax
call _strcmp
mov ebp, eax
test r13d, r13d
jz short loc_12CA
lea rsi, aFebruary; "February"
mov rdi, rbx; s1
call _strcmp
test eax, eax
jnz short loc_1330
loc_12CA:
test ebp, ebp
jz short loc_1334
lea rsi, aJune; "June"
mov rdi, rbx; s1
lea rbp, s2; "winter"
call _strcmp
mov r13d, eax
loc_12E7:
lea r14, aSeptember; "September"
test r13d, r13d
jnz loc_1430
loc_12F7:
cmp r12d, 14h
jle short loc_1320
lea rsi, aSeptember; "September"
mov rdi, rbx; s1
lea rbp, aSummer; "summer"
call _strcmp
test eax, eax
lea rax, aAutumn; "autumn"
cmovz rbp, rax
loc_1320:
pop rbx
mov rax, rbp
pop rbp
pop r12
pop r13
pop r14
retn
loc_1330:
test ebp, ebp
jnz short loc_1390
loc_1334:
lea rbp, s2; "winter"
cmp r12d, 13h
jle short loc_1320
mov rdi, rbx; s1
lea rsi, aJune; "June"
call _strcmp
mov rdi, rbx; s1
lea rsi, aSeptember; "September"
mov ebp, eax
call _strcmp
test ebp, ebp
lea rdx, aSpring; "spring"
pop rbx
lea rbp, aSummer; "summer"
cmovnz rbp, rdx
test eax, eax
lea rax, aAutumn; "autumn"
cmovz rbp, rax
mov rax, rbp
pop rbp
pop r12
pop r13
pop r14
retn
loc_1390:
lea rsi, aApril; "April"
mov rdi, rbx; s1
call _strcmp
lea rsi, aJune; "June"
mov rdi, rbx; s1
mov ebp, eax
call _strcmp
mov r13d, eax
test ebp, ebp
jz loc_1498
lea rsi, aMay; "May"
mov rdi, rbx; s1
call _strcmp
test eax, eax
jz loc_1498
test r13d, r13d
jz loc_14A8
lea rsi, aJuly; "July"
mov rdi, rbx; s1
lea rbp, aSummer; "summer"
call _strcmp
lea r14, aSeptember; "September"
test eax, eax
jz short loc_1430
lea rsi, aAugust; "August"
mov rdi, rbx; s1
call _strcmp
test eax, eax
jz short loc_1430
mov rsi, r14; s2
mov rdi, rbx; s1
call _strcmp
test eax, eax
lea rax, aAutumn; "autumn"
cmovnz rbp, rax
nop word ptr [rax+rax+00000000h]
loc_1430:
mov rsi, r14; s2
mov rdi, rbx; s1
call _strcmp
test eax, eax
jnz short loc_1460
cmp r12d, 15h
jle short loc_1460
lea rbp, aAutumn; "autumn"
pop rbx
mov rax, rbp
pop rbp
pop r12
pop r13
pop r14
retn
loc_1460:
lea rsi, aDecember; "December"
mov rdi, rbx; s1
call _strcmp
cmp r12d, 14h
jle loc_1320
test eax, eax
lea rax, s2; "winter"
pop rbx
cmovz rbp, rax
mov rax, rbp
pop rbp
pop r12
pop r13
pop r14
retn
loc_1498:
lea rbp, aSpring; "spring"
jmp loc_12E7
loc_14A8:
lea rbp, aSpring; "spring"
jmp loc_12F7 | const char * func0(char *s1, int a2)
{
int v2; // r13d
int v3; // ebp
const char *v4; // rbp
int v5; // r13d
int v7; // ebp
int v8; // eax
bool v9; // zf
const char *v10; // rbp
int v11; // ebp
int v12; // eax
v2 = strcmp(s1, "January");
v3 = strcmp(s1, "March");
if ( v2 && strcmp(s1, "February") )
{
if ( v3 )
{
v11 = strcmp(s1, "April");
v5 = strcmp(s1, "June");
if ( v11 && strcmp(s1, "May") )
{
if ( !v5 )
{
v4 = "spring";
LABEL_6:
if ( a2 > 20 )
{
v4 = "summer";
if ( !strcmp(s1, "September") )
return "autumn";
}
return v4;
}
v4 = "summer";
if ( strcmp(s1, "July") && strcmp(s1, "August") && strcmp(s1, "September") )
v4 = "autumn";
LABEL_24:
if ( !strcmp(s1, "September") && a2 > 21 )
return "autumn";
v12 = strcmp(s1, "December");
if ( a2 > 20 )
{
if ( !v12 )
return "winter";
return v4;
}
return v4;
}
v4 = "spring";
LABEL_5:
if ( !v5 )
goto LABEL_6;
goto LABEL_24;
}
}
else if ( v3 )
{
v4 = "winter";
v5 = strcmp(s1, "June");
goto LABEL_5;
}
v4 = "winter";
if ( a2 <= 19 )
return v4;
v7 = strcmp(s1, "June");
v8 = strcmp(s1, "September");
v9 = v7 == 0;
v10 = "summer";
if ( !v9 )
v10 = "spring";
if ( !v8 )
return "autumn";
return v10;
} | func0:
ENDBR64
PUSH R14
PUSH R13
PUSH R12
MOV R12D,ESI
LEA RSI,[0x102020]
PUSH RBP
PUSH RBX
MOV RBX,RDI
CALL 0x00101090
LEA RSI,[0x102028]
MOV RDI,RBX
MOV R13D,EAX
CALL 0x00101090
MOV EBP,EAX
TEST R13D,R13D
JZ 0x001012ca
LEA RSI,[0x10202e]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x00101330
LAB_001012ca:
TEST EBP,EBP
JZ 0x00101334
LEA RSI,[0x10203d]
MOV RDI,RBX
LEA RBP,[0x102004]
CALL 0x00101090
MOV R13D,EAX
LAB_001012e7:
LEA R14,[0x102052]
TEST R13D,R13D
JNZ 0x00101430
LAB_001012f7:
CMP R12D,0x14
JLE 0x00101320
LEA RSI,[0x102052]
MOV RDI,RBX
LEA RBP,[0x102012]
CALL 0x00101090
TEST EAX,EAX
LEA RAX,[0x102019]
CMOVZ RBP,RAX
LAB_00101320:
POP RBX
MOV RAX,RBP
POP RBP
POP R12
POP R13
POP R14
RET
LAB_00101330:
TEST EBP,EBP
JNZ 0x00101390
LAB_00101334:
LEA RBP,[0x102004]
CMP R12D,0x13
JLE 0x00101320
MOV RDI,RBX
LEA RSI,[0x10203d]
CALL 0x00101090
MOV RDI,RBX
LEA RSI,[0x102052]
MOV EBP,EAX
CALL 0x00101090
TEST EBP,EBP
LEA RDX,[0x10200b]
POP RBX
LEA RBP,[0x102012]
CMOVNZ RBP,RDX
TEST EAX,EAX
LEA RAX,[0x102019]
CMOVZ RBP,RAX
MOV RAX,RBP
POP RBP
POP R12
POP R13
POP R14
RET
LAB_00101390:
LEA RSI,[0x102037]
MOV RDI,RBX
CALL 0x00101090
LEA RSI,[0x10203d]
MOV RDI,RBX
MOV EBP,EAX
CALL 0x00101090
MOV R13D,EAX
TEST EBP,EBP
JZ 0x00101498
LEA RSI,[0x102042]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
JZ 0x00101498
TEST R13D,R13D
JZ 0x001014a8
LEA RSI,[0x102046]
MOV RDI,RBX
LEA RBP,[0x102012]
CALL 0x00101090
LEA R14,[0x102052]
TEST EAX,EAX
JZ 0x00101430
LEA RSI,[0x10204b]
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
JZ 0x00101430
MOV RSI,R14
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
LEA RAX,[0x102019]
CMOVNZ RBP,RAX
NOP word ptr [RAX + RAX*0x1]
LAB_00101430:
MOV RSI,R14
MOV RDI,RBX
CALL 0x00101090
TEST EAX,EAX
JNZ 0x00101460
CMP R12D,0x15
JLE 0x00101460
LEA RBP,[0x102019]
POP RBX
MOV RAX,RBP
POP RBP
POP R12
POP R13
POP R14
RET
LAB_00101460:
LEA RSI,[0x10205c]
MOV RDI,RBX
CALL 0x00101090
CMP R12D,0x14
JLE 0x00101320
TEST EAX,EAX
LEA RAX,[0x102004]
POP RBX
CMOVZ RBP,RAX
MOV RAX,RBP
POP RBP
POP R12
POP R13
POP R14
RET
LAB_00101498:
LEA RBP,[0x10200b]
JMP 0x001012e7
LAB_001014a8:
LEA RBP,[0x10200b]
JMP 0x001012f7 | char * func0(char *param_1,int param_2)
{
int iVar1;
int iVar2;
char *pcVar3;
iVar1 = strcmp(param_1,"January");
iVar2 = strcmp(param_1,"March");
if ((iVar1 == 0) || (iVar1 = strcmp(param_1,"February"), iVar1 == 0)) {
if (iVar2 == 0) goto LAB_00101334;
pcVar3 = "winter";
iVar1 = strcmp(param_1,"June");
}
else {
if (iVar2 == 0) {
LAB_00101334:
if (param_2 < 0x14) {
return "winter";
}
iVar1 = strcmp(param_1,"June");
iVar2 = strcmp(param_1,"September");
pcVar3 = "summer";
if (iVar1 != 0) {
pcVar3 = "spring";
}
if (iVar2 == 0) {
pcVar3 = "autumn";
}
return pcVar3;
}
iVar2 = strcmp(param_1,"April");
iVar1 = strcmp(param_1,"June");
if ((iVar2 != 0) && (iVar2 = strcmp(param_1,"May"), iVar2 != 0)) {
if (iVar1 != 0) {
pcVar3 = "summer";
iVar1 = strcmp(param_1,"July");
if (((iVar1 != 0) && (iVar1 = strcmp(param_1,"August"), iVar1 != 0)) &&
(iVar1 = strcmp(param_1,"September"), iVar1 != 0)) {
pcVar3 = "autumn";
}
goto LAB_00101430;
}
pcVar3 = "spring";
goto LAB_001012f7;
}
pcVar3 = "spring";
}
if (iVar1 != 0) {
LAB_00101430:
iVar1 = strcmp(param_1,"September");
if ((iVar1 == 0) && (0x15 < param_2)) {
return "autumn";
}
iVar1 = strcmp(param_1,"December");
if (param_2 < 0x15) {
return pcVar3;
}
if (iVar1 == 0) {
pcVar3 = "winter";
}
return pcVar3;
}
LAB_001012f7:
if (0x14 < param_2) {
pcVar3 = "summer";
iVar1 = strcmp(param_1,"September");
if (iVar1 == 0) {
pcVar3 = "autumn";
}
}
return pcVar3;
} |
4,532 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
| char* func0(int a, int b, int n) {
int i = 0;
static char result[50];
while (i * a <= n) {
if ((n - (i * a)) % b == 0) {
sprintf(result, "x = %d, y = %d", i, (n - (i * a)) / b);
return result;
}
i++;
}
return "No solution";
}
| int main() {
assert(strcmp(func0(2, 3, 7), "x = 2, y = 1") == 0);
assert(strcmp(func0(4, 2, 7), "No solution") == 0);
assert(strcmp(func0(1, 13, 17), "x = 4, y = 1") == 0);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x20,%rsp
mov %edi,-0x14(%rbp)
mov %esi,-0x18(%rbp)
mov %edx,-0x1c(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11ff <func0+0x76>
mov -0x4(%rbp),%eax
imul -0x14(%rbp),%eax
mov -0x1c(%rbp),%edx
sub %eax,%edx
mov %edx,%eax
cltd
idivl -0x18(%rbp)
mov %edx,%eax
test %eax,%eax
jne 11fb <func0+0x72>
mov -0x4(%rbp),%eax
imul -0x14(%rbp),%eax
mov -0x1c(%rbp),%edx
sub %eax,%edx
mov %edx,%eax
cltd
idivl -0x18(%rbp)
mov %eax,%edx
mov -0x4(%rbp),%eax
mov %edx,%ecx
mov %eax,%edx
lea 0xe27(%rip),%rsi
lea 0x2e58(%rip),%rdi
mov $0x0,%eax
callq 1090 <sprintf@plt>
lea 0x2e47(%rip),%rax
jmp 1212 <func0+0x89>
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
imul -0x14(%rbp),%eax
cmp %eax,-0x1c(%rbp)
jge 11a7 <func0+0x1e>
lea 0xe05(%rip),%rax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 20h
mov [rbp+var_14], edi
mov [rbp+var_18], esi
mov [rbp+var_1C], edx
mov [rbp+var_4], 0
jmp short loc_1205
loc_11A7:
mov eax, [rbp+var_4]
imul eax, [rbp+var_14]
mov edx, [rbp+var_1C]
sub edx, eax
mov eax, edx
cdq
idiv [rbp+var_18]
mov eax, edx
test eax, eax
jnz short loc_1201
mov eax, [rbp+var_4]
imul eax, [rbp+var_14]
mov edx, [rbp+var_1C]
sub edx, eax
mov eax, edx
cdq
idiv [rbp+var_18]
mov edx, eax
mov eax, [rbp+var_4]
mov ecx, edx
mov edx, eax
lea rax, format; "x = %d, y = %d"
mov rsi, rax; format
lea rax, result_1
mov rdi, rax; s
mov eax, 0
call _sprintf
lea rax, result_1
jmp short locret_1218
loc_1201:
add [rbp+var_4], 1
loc_1205:
mov eax, [rbp+var_4]
imul eax, [rbp+var_14]
cmp [rbp+var_1C], eax
jge short loc_11A7
lea rax, aNoSolution; "No solution"
locret_1218:
leave
retn | char * func0(int a1, int a2, int a3)
{
int i; // [rsp+1Ch] [rbp-4h]
for ( i = 0; a3 >= a1 * i; ++i )
{
if ( !((a3 - a1 * i) % a2) )
{
sprintf(result_1, "x = %d, y = %d", i, (a3 - a1 * i) / a2);
return result_1;
}
}
return "No solution";
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x20
MOV dword ptr [RBP + -0x14],EDI
MOV dword ptr [RBP + -0x18],ESI
MOV dword ptr [RBP + -0x1c],EDX
MOV dword ptr [RBP + -0x4],0x0
JMP 0x00101205
LAB_001011a7:
MOV EAX,dword ptr [RBP + -0x4]
IMUL EAX,dword ptr [RBP + -0x14]
MOV EDX,dword ptr [RBP + -0x1c]
SUB EDX,EAX
MOV EAX,EDX
CDQ
IDIV dword ptr [RBP + -0x18]
MOV EAX,EDX
TEST EAX,EAX
JNZ 0x00101201
MOV EAX,dword ptr [RBP + -0x4]
IMUL EAX,dword ptr [RBP + -0x14]
MOV EDX,dword ptr [RBP + -0x1c]
SUB EDX,EAX
MOV EAX,EDX
CDQ
IDIV dword ptr [RBP + -0x18]
MOV EDX,EAX
MOV EAX,dword ptr [RBP + -0x4]
MOV ECX,EDX
MOV EDX,EAX
LEA RAX,[0x102008]
MOV RSI,RAX
LEA RAX,[0x104040]
MOV RDI,RAX
MOV EAX,0x0
CALL 0x00101090
LEA RAX,[0x104040]
JMP 0x00101218
LAB_00101201:
ADD dword ptr [RBP + -0x4],0x1
LAB_00101205:
MOV EAX,dword ptr [RBP + -0x4]
IMUL EAX,dword ptr [RBP + -0x14]
CMP dword ptr [RBP + -0x1c],EAX
JGE 0x001011a7
LEA RAX,[0x102017]
LAB_00101218:
LEAVE
RET | char * func0(int param_1,int param_2,int param_3)
{
uint local_c;
local_c = 0;
while( true ) {
if (param_3 < (int)(local_c * param_1)) {
return "No solution";
}
if ((int)(param_3 - local_c * param_1) % param_2 == 0) break;
local_c = local_c + 1;
}
sprintf(result_1,"x = %d, y = %d",(ulong)local_c,
(long)(int)(param_3 - local_c * param_1) / (long)param_2 & 0xffffffff);
return result_1;
} |
4,533 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
| char* func0(int a, int b, int n) {
int i = 0;
static char result[50];
while (i * a <= n) {
if ((n - (i * a)) % b == 0) {
sprintf(result, "x = %d, y = %d", i, (n - (i * a)) / b);
return result;
}
i++;
}
return "No solution";
}
| int main() {
assert(strcmp(func0(2, 3, 7), "x = 2, y = 1") == 0);
assert(strcmp(func0(4, 2, 7), "No solution") == 0);
assert(strcmp(func0(1, 13, 17), "x = 4, y = 1") == 0);
return 0;
}
| O1 | c | func0:
endbr64
lea 0xe90(%rip),%rax
test %edx,%edx
js 11f5 <func0+0x8c>
push %rbx
mov %edx,%r11d
mov %edx,%eax
cltd
idiv %esi
mov %edx,%r8d
test %edx,%edx
je 11e7 <func0+0x7e>
mov %edi,%ebx
mov %r11d,%r10d
sub %edi,%r10d
mov %edi,%ecx
mov $0x0,%r8d
add $0x1,%r8d
cmp %ecx,%r11d
jl 11ec <func0+0x83>
mov %r10d,%r9d
add %ebx,%ecx
sub %edi,%r10d
mov %r9d,%eax
cltd
idiv %esi
test %edx,%edx
jne 1198 <func0+0x2f>
mov %r9d,%eax
cltd
idiv %esi
mov %eax,%r9d
lea 0xe4d(%rip),%rcx
mov $0x32,%edx
mov $0x1,%esi
lea 0x2e6c(%rip),%rdi
mov $0x0,%eax
callq 1070 <__sprintf_chk@plt>
lea 0x2e5b(%rip),%rax
pop %rbx
retq
mov %r11d,%r9d
jmp 11b3 <func0+0x4a>
lea 0xe11(%rip),%rax
jmp 11e5 <func0+0x7c>
retq
| func0:
endbr64
lea rax, aNoSolution; "No solution"
test edx, edx
js locret_121C
mov r10d, edi
mov edi, esi
mov r11d, edx
mov eax, edx
cdq
idiv esi
mov r8d, edx
test edx, edx
jz short loc_120F
mov esi, r11d
sub esi, r10d
mov ecx, r10d
mov r8d, 0
loc_11BF:
add r8d, 1
cmp r11d, ecx
jl short loc_1214
mov r9d, esi
add ecx, r10d
sub esi, r10d
mov eax, r9d
cdq
idiv edi
test edx, edx
jnz short loc_11BF
loc_11DB:
push rbx
mov eax, r9d
cdq
idiv edi
mov r9d, eax
lea rcx, aXDYD; "x = %d, y = %d"
mov edx, 32h ; '2'
mov esi, 1
lea rbx, result_1
mov rdi, rbx
mov eax, 0
call ___sprintf_chk
mov rax, rbx
pop rbx
retn
loc_120F:
mov r9d, r11d
jmp short loc_11DB
loc_1214:
lea rax, aNoSolution; "No solution"
retn
locret_121C:
retn | const char * func0(int a1, int a2, int a3)
{
const char *result; // rax
int v6; // r8d
int v7; // esi
int v8; // ecx
int v9; // r9d
result = "No solution";
if ( a3 >= 0 )
{
v6 = a3 % a2;
if ( a3 % a2 )
{
v7 = a3 - a1;
v8 = a1;
v6 = 0;
while ( 1 )
{
++v6;
if ( a3 < v8 )
return "No solution";
v9 = v7;
v8 += a1;
v7 -= a1;
if ( !(v9 % a2) )
goto LABEL_6;
}
}
else
{
v9 = a3;
LABEL_6:
__sprintf_chk(&result_1, 1LL, 50LL, "x = %d, y = %d", v6, v9 / a2);
return (const char *)&result_1;
}
}
return result;
} | func0:
ENDBR64
LEA RAX,[0x102004]
TEST EDX,EDX
JS 0x0010121c
MOV R10D,EDI
MOV EDI,ESI
MOV R11D,EDX
MOV EAX,EDX
CDQ
IDIV ESI
MOV R8D,EDX
TEST EDX,EDX
JZ 0x0010120f
MOV ESI,R11D
SUB ESI,R10D
MOV ECX,R10D
MOV R8D,0x0
LAB_001011bf:
ADD R8D,0x1
CMP R11D,ECX
JL 0x00101214
MOV R9D,ESI
ADD ECX,R10D
SUB ESI,R10D
MOV EAX,R9D
CDQ
IDIV EDI
TEST EDX,EDX
JNZ 0x001011bf
LAB_001011db:
PUSH RBX
MOV EAX,R9D
CDQ
IDIV EDI
MOV R9D,EAX
LEA RCX,[0x102010]
MOV EDX,0x32
MOV ESI,0x1
LEA RBX,[0x104040]
MOV RDI,RBX
MOV EAX,0x0
CALL 0x00101090
MOV RAX,RBX
POP RBX
RET
LAB_0010120f:
MOV R9D,R11D
JMP 0x001011db
LAB_00101214:
LEA RAX,[0x102004]
RET
LAB_0010121c:
RET | int1 * func0(int param_1,int param_2,int param_3)
{
int iVar1;
int iVar2;
ulong uVar3;
int iVar4;
if (param_3 < 0) {
return "No solution";
}
uVar3 = (long)param_3 % (long)param_2 & 0xffffffff;
iVar4 = param_3;
if ((int)((long)param_3 % (long)param_2) != 0) {
uVar3 = 0;
iVar1 = param_3 - param_1;
iVar2 = param_1;
do {
iVar4 = iVar1;
uVar3 = (ulong)((int)uVar3 + 1);
if (param_3 < iVar2) {
return "No solution";
}
iVar2 = iVar2 + param_1;
iVar1 = iVar4 - param_1;
} while (iVar4 % param_2 != 0);
}
__sprintf_chk(result_1,1,0x32,"x = %d, y = %d",uVar3,(long)iVar4 / (long)param_2 & 0xffffffff);
return result_1;
} |
4,534 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
| char* func0(int a, int b, int n) {
int i = 0;
static char result[50];
while (i * a <= n) {
if ((n - (i * a)) % b == 0) {
sprintf(result, "x = %d, y = %d", i, (n - (i * a)) / b);
return result;
}
i++;
}
return "No solution";
}
| int main() {
assert(strcmp(func0(2, 3, 7), "x = 2, y = 1") == 0);
assert(strcmp(func0(4, 2, 7), "No solution") == 0);
assert(strcmp(func0(1, 13, 17), "x = 4, y = 1") == 0);
return 0;
}
| O2 | c | func0:
endbr64
lea 0xd89(%rip),%rax
test %edx,%edx
js 12fe <func0+0x8e>
mov %edx,%eax
mov %edx,%r11d
cltd
idiv %esi
mov %edx,%r8d
test %edx,%edx
je 12c3 <func0+0x53>
mov %r11d,%r10d
mov %edi,%ecx
xor %r8d,%r8d
sub %edi,%r10d
jmp 12b2 <func0+0x42>
nopl 0x0(%rax,%rax,1)
mov %r10d,%r9d
add %edi,%ecx
sub %edi,%r10d
mov %r9d,%eax
cltd
idiv %esi
test %edx,%edx
je 12c6 <func0+0x56>
add $0x1,%r8d
cmp %ecx,%r11d
jge 12a0 <func0+0x30>
lea 0xd42(%rip),%rax
retq
mov %r11d,%r9d
mov %r9d,%eax
sub $0x8,%rsp
lea 0xd3c(%rip),%rcx
cltd
lea 0x2d64(%rip),%rdi
idiv %esi
mov $0x32,%edx
mov $0x1,%esi
mov %eax,%r9d
xor %eax,%eax
callq 1070 <__sprintf_chk@plt>
lea 0x2d47(%rip),%rax
add $0x8,%rsp
retq
retq
| func0:
endbr64
lea rax, aNoSolution; "No solution"
test edx, edx
js short locret_1308
mov eax, edx
mov r11d, edx
cdq
idiv esi
mov r8d, edx
test edx, edx
jz short loc_12D4
mov r10d, edi
mov edi, r11d
xor r8d, r8d
sub edi, r10d
mov ecx, r10d
jmp short loc_12C3
loc_12B0:
mov r9d, edi
add ecx, r10d
sub edi, r10d
mov eax, r9d
cdq
idiv esi
test edx, edx
jz short loc_12D7
loc_12C3:
add r8d, 1
cmp r11d, ecx
jge short loc_12B0
lea rax, aNoSolution; "No solution"
retn
loc_12D4:
mov r9d, r11d
loc_12D7:
mov eax, r9d
push rbx
lea rbx, result_1
lea rcx, aXDYD; "x = %d, y = %d"
cdq
mov rdi, rbx
idiv esi
mov edx, 32h ; '2'
mov esi, 1
mov r9d, eax
xor eax, eax
call ___sprintf_chk
mov rax, rbx
pop rbx
retn
locret_1308:
retn | const char * func0(int a1, int a2, int a3)
{
const char *result; // rax
int v4; // r8d
int v6; // edi
int v7; // ecx
int v8; // r9d
result = "No solution";
if ( a3 >= 0 )
{
v4 = a3 % a2;
if ( a3 % a2 )
{
v4 = 0;
v6 = a3 - a1;
v7 = a1;
while ( 1 )
{
++v4;
if ( a3 < v7 )
return "No solution";
v8 = v6;
v7 += a1;
v6 -= a1;
if ( !(v8 % a2) )
goto LABEL_8;
}
}
else
{
v8 = a3;
LABEL_8:
__sprintf_chk(&result_1, 1LL, 50LL, "x = %d, y = %d", v4, v8 / a2);
return (const char *)&result_1;
}
}
return result;
} | func0:
ENDBR64
LEA RAX,[0x102004]
TEST EDX,EDX
JS 0x00101308
MOV EAX,EDX
MOV R11D,EDX
CDQ
IDIV ESI
MOV R8D,EDX
TEST EDX,EDX
JZ 0x001012d4
MOV R10D,EDI
MOV EDI,R11D
XOR R8D,R8D
SUB EDI,R10D
MOV ECX,R10D
JMP 0x001012c3
LAB_001012b0:
MOV R9D,EDI
ADD ECX,R10D
SUB EDI,R10D
MOV EAX,R9D
CDQ
IDIV ESI
TEST EDX,EDX
JZ 0x001012d7
LAB_001012c3:
ADD R8D,0x1
CMP R11D,ECX
JGE 0x001012b0
LEA RAX,[0x102004]
RET
LAB_001012d4:
MOV R9D,R11D
LAB_001012d7:
MOV EAX,R9D
PUSH RBX
LEA RBX,[0x104040]
LEA RCX,[0x102010]
CDQ
MOV RDI,RBX
IDIV ESI
MOV EDX,0x32
MOV ESI,0x1
MOV R9D,EAX
XOR EAX,EAX
CALL 0x00101090
MOV RAX,RBX
POP RBX
RET
LAB_00101308:
RET | char * func0(int param_1,int param_2,int param_3)
{
int iVar1;
int iVar2;
ulong uVar3;
int iVar4;
if (param_3 < 0) {
return "No solution";
}
uVar3 = (long)param_3 % (long)param_2 & 0xffffffff;
iVar4 = param_3;
if ((int)((long)param_3 % (long)param_2) != 0) {
uVar3 = 0;
iVar1 = param_3 - param_1;
iVar2 = param_1;
do {
iVar4 = iVar1;
uVar3 = (ulong)((int)uVar3 + 1);
if (param_3 < iVar2) {
return "No solution";
}
iVar2 = iVar2 + param_1;
iVar1 = iVar4 - param_1;
} while (iVar4 % param_2 != 0);
}
__sprintf_chk(result_1,1,0x32,"x = %d, y = %d",uVar3,(long)iVar4 / (long)param_2 & 0xffffffff);
return result_1;
} |
4,535 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
| char* func0(int a, int b, int n) {
int i = 0;
static char result[50];
while (i * a <= n) {
if ((n - (i * a)) % b == 0) {
sprintf(result, "x = %d, y = %d", i, (n - (i * a)) / b);
return result;
}
i++;
}
return "No solution";
}
| int main() {
assert(strcmp(func0(2, 3, 7), "x = 2, y = 1") == 0);
assert(strcmp(func0(4, 2, 7), "No solution") == 0);
assert(strcmp(func0(1, 13, 17), "x = 4, y = 1") == 0);
return 0;
}
| O3 | c | func0:
endbr64
lea 0xd89(%rip),%rax
test %edx,%edx
js 12fe <func0+0x8e>
mov %edx,%eax
mov %edx,%r11d
cltd
idiv %esi
mov %edx,%r8d
test %edx,%edx
je 12c3 <func0+0x53>
mov %r11d,%r10d
mov %edi,%ecx
xor %r8d,%r8d
sub %edi,%r10d
jmp 12b2 <func0+0x42>
nopl 0x0(%rax,%rax,1)
mov %r10d,%r9d
add %edi,%ecx
sub %edi,%r10d
mov %r9d,%eax
cltd
idiv %esi
test %edx,%edx
je 12c6 <func0+0x56>
add $0x1,%r8d
cmp %ecx,%r11d
jge 12a0 <func0+0x30>
lea 0xd42(%rip),%rax
retq
mov %r11d,%r9d
mov %r9d,%eax
sub $0x8,%rsp
lea 0xd3c(%rip),%rcx
cltd
lea 0x2d64(%rip),%rdi
idiv %esi
mov $0x32,%edx
mov $0x1,%esi
mov %eax,%r9d
xor %eax,%eax
callq 1070 <__sprintf_chk@plt>
lea 0x2d47(%rip),%rax
add $0x8,%rsp
retq
retq
| func0:
endbr64
lea rax, aNoSolution; "No solution"
test edx, edx
js short locret_1308
mov eax, edx
mov r11d, edx
cdq
idiv esi
mov r8d, edx
test edx, edx
jz short loc_12D4
mov r10d, edi
mov edi, r11d
xor r8d, r8d
sub edi, r10d
mov ecx, r10d
jmp short loc_12C3
loc_12B0:
mov r9d, edi
add ecx, r10d
sub edi, r10d
mov eax, r9d
cdq
idiv esi
test edx, edx
jz short loc_12D7
loc_12C3:
add r8d, 1
cmp r11d, ecx
jge short loc_12B0
lea rax, aNoSolution; "No solution"
retn
loc_12D4:
mov r9d, r11d
loc_12D7:
mov eax, r9d
push rbx
lea rbx, result_1
lea rcx, aXDYD; "x = %d, y = %d"
cdq
mov rdi, rbx
idiv esi
mov edx, 32h ; '2'
mov esi, 2
mov r9d, eax
xor eax, eax
call ___sprintf_chk
mov rax, rbx
pop rbx
retn
locret_1308:
retn | const char * func0(int a1, int a2, int a3)
{
const char *result; // rax
int v4; // r8d
int v6; // edi
int v7; // ecx
int v8; // r9d
result = "No solution";
if ( a3 >= 0 )
{
v4 = a3 % a2;
if ( a3 % a2 )
{
v4 = 0;
v6 = a3 - a1;
v7 = a1;
while ( 1 )
{
++v4;
if ( a3 < v7 )
return "No solution";
v8 = v6;
v7 += a1;
v6 -= a1;
if ( !(v8 % a2) )
goto LABEL_8;
}
}
else
{
v8 = a3;
LABEL_8:
__sprintf_chk(&result_1, 2LL, 50LL, "x = %d, y = %d", v4, v8 / a2);
return (const char *)&result_1;
}
}
return result;
} | func0:
ENDBR64
LEA RAX,[0x102004]
TEST EDX,EDX
JS 0x00101308
MOV EAX,EDX
MOV R11D,EDX
CDQ
IDIV ESI
MOV R8D,EDX
TEST EDX,EDX
JZ 0x001012d4
MOV R10D,EDI
MOV EDI,R11D
XOR R8D,R8D
SUB EDI,R10D
MOV ECX,R10D
JMP 0x001012c3
LAB_001012b0:
MOV R9D,EDI
ADD ECX,R10D
SUB EDI,R10D
MOV EAX,R9D
CDQ
IDIV ESI
TEST EDX,EDX
JZ 0x001012d7
LAB_001012c3:
ADD R8D,0x1
CMP R11D,ECX
JGE 0x001012b0
LEA RAX,[0x102004]
RET
LAB_001012d4:
MOV R9D,R11D
LAB_001012d7:
MOV EAX,R9D
PUSH RBX
LEA RBX,[0x104040]
LEA RCX,[0x102010]
CDQ
MOV RDI,RBX
IDIV ESI
MOV EDX,0x32
MOV ESI,0x2
MOV R9D,EAX
XOR EAX,EAX
CALL 0x00101090
MOV RAX,RBX
POP RBX
RET
LAB_00101308:
RET | char * func0(int param_1,int param_2,int param_3)
{
int iVar1;
int iVar2;
ulong uVar3;
int iVar4;
if (param_3 < 0) {
return "No solution";
}
uVar3 = (long)param_3 % (long)param_2 & 0xffffffff;
iVar4 = param_3;
if ((int)((long)param_3 % (long)param_2) != 0) {
uVar3 = 0;
iVar1 = param_3 - param_1;
iVar2 = param_1;
do {
iVar4 = iVar1;
uVar3 = (ulong)((int)uVar3 + 1);
if (param_3 < iVar2) {
return "No solution";
}
iVar2 = iVar2 + param_1;
iVar1 = iVar4 - param_1;
} while (iVar4 % param_2 != 0);
}
__sprintf_chk(result_1,2,0x32,"x = %d, y = %d",uVar3,(long)iVar4 / (long)param_2 & 0xffffffff);
return result_1;
} |
4,536 | func0 |
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
| int* func0(const int* list1, int list1_size, const int* list2, int list2_size, int* result_size) {
static int result[1000]; // Assuming maximum size of resulting array is 1000.
int index = 0;
for (int i = 0; i < list1_size; i++) {
bool found = false;
for (int j = 0; j < list2_size; j++) {
if (list1[i] == list2[j]) {
found = true;
break;
}
}
if (!found) {
result[index++] = list1[i];
}
}
*result_size = index;
return result;
}
| int main() {
int result_size;
const int list1[] = {1,2,3,4,5,6,7,8,9,10};
const int list2[] = {2,4,6,8};
const int list3[] = {1, 3, 5, 7};
const int list4[] = {5, 7};
int expected1[] = {1, 3, 5, 7, 9, 10};
int expected2[] = {2, 4, 6, 8, 9, 10};
int expected3[] = {1, 2, 3, 4, 6, 8, 9, 10};
int* result;
result = func0(list1, 10, list2, 4, &result_size);
assert(result_size == 6);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected1[i]);
}
result = func0(list1, 10, list3, 4, &result_size);
assert(result_size == 6);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected2[i]);
}
result = func0(list1, 10, list4, 2, &result_size);
assert(result_size == 8);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected3[i]);
}
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov %rdx,-0x28(%rbp)
mov %ecx,-0x20(%rbp)
mov %r8,-0x30(%rbp)
movl $0x0,-0xc(%rbp)
movl $0x0,-0x8(%rbp)
jmpq 1228 <func0+0xbf>
movb $0x0,-0xd(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11dd <func0+0x74>
mov -0x8(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%edx
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rcx
mov -0x28(%rbp),%rax
add %rcx,%rax
mov (%rax),%eax
cmp %eax,%edx
jne 11d9 <func0+0x70>
movb $0x1,-0xd(%rbp)
jmp 11e5 <func0+0x7c>
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x20(%rbp),%eax
jl 11a3 <func0+0x3a>
movzbl -0xd(%rbp),%eax
xor $0x1,%eax
test %al,%al
je 1224 <func0+0xbb>
mov -0x8(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
lea (%rdx,%rax,1),%rcx
mov -0xc(%rbp),%eax
lea 0x1(%rax),%edx
mov %edx,-0xc(%rbp)
mov (%rcx),%edx
cltq
lea 0x0(,%rax,4),%rcx
lea 0x2e1f(%rip),%rax
mov %edx,(%rcx,%rax,1)
addl $0x1,-0x8(%rbp)
mov -0x8(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 1196 <func0+0x2d>
mov -0x30(%rbp),%rax
mov -0xc(%rbp),%edx
mov %edx,(%rax)
lea 0x2dfc(%rip),%rax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_28], rdx
mov [rbp+var_20], ecx
mov [rbp+var_30], r8
mov [rbp+var_C], 0
mov [rbp+var_8], 0
jmp loc_1228
loc_1196:
mov [rbp+var_D], 0
mov [rbp+var_4], 0
jmp short loc_11DD
loc_11A3:
mov eax, [rbp+var_8]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov edx, [rax]
mov eax, [rbp+var_4]
cdqe
lea rcx, ds:0[rax*4]
mov rax, [rbp+var_28]
add rax, rcx
mov eax, [rax]
cmp edx, eax
jnz short loc_11D9
mov [rbp+var_D], 1
jmp short loc_11E5
loc_11D9:
add [rbp+var_4], 1
loc_11DD:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_20]
jl short loc_11A3
loc_11E5:
movzx eax, [rbp+var_D]
xor eax, 1
test al, al
jz short loc_1224
mov eax, [rbp+var_8]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
lea rcx, [rdx+rax]
mov eax, [rbp+var_C]
lea edx, [rax+1]
mov [rbp+var_C], edx
mov edx, [rcx]
cdqe
lea rcx, ds:0[rax*4]
lea rax, result_1
mov [rcx+rax], edx
loc_1224:
add [rbp+var_8], 1
loc_1228:
mov eax, [rbp+var_8]
cmp eax, [rbp+var_1C]
jl loc_1196
mov rax, [rbp+var_30]
mov edx, [rbp+var_C]
mov [rax], edx
lea rax, result_1
pop rbp
retn | _DWORD * func0(long long a1, int a2, long long a3, int a4, _DWORD *a5)
{
int v5; // eax
char v7; // [rsp+23h] [rbp-Dh]
int v8; // [rsp+24h] [rbp-Ch]
int i; // [rsp+28h] [rbp-8h]
int j; // [rsp+2Ch] [rbp-4h]
v8 = 0;
for ( i = 0; i < a2; ++i )
{
v7 = 0;
for ( j = 0; j < a4; ++j )
{
if ( *(_DWORD *)(4LL * i + a1) == *(_DWORD *)(4LL * j + a3) )
{
v7 = 1;
break;
}
}
if ( v7 != 1 )
{
v5 = v8++;
result_1[v5] = *(_DWORD *)(4LL * i + a1);
}
}
*a5 = v8;
return result_1;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV qword ptr [RBP + -0x28],RDX
MOV dword ptr [RBP + -0x20],ECX
MOV qword ptr [RBP + -0x30],R8
MOV dword ptr [RBP + -0xc],0x0
MOV dword ptr [RBP + -0x8],0x0
JMP 0x00101228
LAB_00101196:
MOV byte ptr [RBP + -0xd],0x0
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011dd
LAB_001011a3:
MOV EAX,dword ptr [RBP + -0x8]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RCX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RCX
MOV EAX,dword ptr [RAX]
CMP EDX,EAX
JNZ 0x001011d9
MOV byte ptr [RBP + -0xd],0x1
JMP 0x001011e5
LAB_001011d9:
ADD dword ptr [RBP + -0x4],0x1
LAB_001011dd:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x20]
JL 0x001011a3
LAB_001011e5:
MOVZX EAX,byte ptr [RBP + -0xd]
XOR EAX,0x1
TEST AL,AL
JZ 0x00101224
MOV EAX,dword ptr [RBP + -0x8]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
LEA RCX,[RDX + RAX*0x1]
MOV EAX,dword ptr [RBP + -0xc]
LEA EDX,[RAX + 0x1]
MOV dword ptr [RBP + -0xc],EDX
MOV EDX,dword ptr [RCX]
CDQE
LEA RCX,[RAX*0x4]
LEA RAX,[0x104040]
MOV dword ptr [RCX + RAX*0x1],EDX
LAB_00101224:
ADD dword ptr [RBP + -0x8],0x1
LAB_00101228:
MOV EAX,dword ptr [RBP + -0x8]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x00101196
MOV RAX,qword ptr [RBP + -0x30]
MOV EDX,dword ptr [RBP + -0xc]
MOV dword ptr [RAX],EDX
LEA RAX,[0x104040]
POP RBP
RET | int1 * func0(long param_1,int param_2,long param_3,int param_4,int *param_5)
{
bool bVar1;
int local_14;
int local_10;
int local_c;
local_14 = 0;
local_10 = 0;
do {
if (param_2 <= local_10) {
*param_5 = local_14;
return result_1;
}
bVar1 = false;
for (local_c = 0; local_c < param_4; local_c = local_c + 1) {
if (*(int *)(param_1 + (long)local_10 * 4) == *(int *)(param_3 + (long)local_c * 4)) {
bVar1 = true;
break;
}
}
if (!bVar1) {
*(int4 *)(result_1 + (long)local_14 * 4) = *(int4 *)((long)local_10 * 4 + param_1)
;
local_14 = local_14 + 1;
}
local_10 = local_10 + 1;
} while( true );
} |
4,537 | func0 |
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
| int* func0(const int* list1, int list1_size, const int* list2, int list2_size, int* result_size) {
static int result[1000]; // Assuming maximum size of resulting array is 1000.
int index = 0;
for (int i = 0; i < list1_size; i++) {
bool found = false;
for (int j = 0; j < list2_size; j++) {
if (list1[i] == list2[j]) {
found = true;
break;
}
}
if (!found) {
result[index++] = list1[i];
}
}
*result_size = index;
return result;
}
| int main() {
int result_size;
const int list1[] = {1,2,3,4,5,6,7,8,9,10};
const int list2[] = {2,4,6,8};
const int list3[] = {1, 3, 5, 7};
const int list4[] = {5, 7};
int expected1[] = {1, 3, 5, 7, 9, 10};
int expected2[] = {2, 4, 6, 8, 9, 10};
int expected3[] = {1, 2, 3, 4, 6, 8, 9, 10};
int* result;
result = func0(list1, 10, list2, 4, &result_size);
assert(result_size == 6);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected1[i]);
}
result = func0(list1, 10, list3, 4, &result_size);
assert(result_size == 6);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected2[i]);
}
result = func0(list1, 10, list4, 2, &result_size);
assert(result_size == 8);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected3[i]);
}
return 0;
}
| O1 | c | func0:
endbr64
push %rbx
mov %r8,%rbx
test %esi,%esi
jle 1199 <func0+0x30>
mov %rdi,%r9
lea -0x1(%rsi),%eax
lea 0x4(%rdi,%rax,4),%r10
mov %rdx,%r11
lea -0x1(%rcx),%eax
lea 0x4(%rdx,%rax,4),%rsi
mov $0x0,%edi
lea 0x2ea9(%rip),%r8
jmp 11bf <func0+0x56>
mov $0x0,%edi
mov %edi,(%rbx)
lea 0x2e99(%rip),%rax
pop %rbx
retq
mov (%r9),%edx
movslq %edi,%rax
mov %edx,(%r8,%rax,4)
lea 0x1(%rdi),%edi
add $0x4,%r9
cmp %r10,%r9
je 119e <func0+0x35>
test %ecx,%ecx
jle 11a9 <func0+0x40>
mov (%r9),%edx
mov %r11,%rax
cmp (%rax),%edx
je 11b6 <func0+0x4d>
add $0x4,%rax
cmp %rsi,%rax
jne 11c9 <func0+0x60>
jmp 11a9 <func0+0x40>
| func0:
endbr64
push rbx
mov rbx, r8
test esi, esi
jle short loc_119C
mov r11, rdx
mov r10d, ecx
mov r9, rdi
lea eax, [rsi-1]
lea rdi, [rdi+rax*4+4]
lea eax, [rcx-1]
lea rcx, [rdx+rax*4+4]
mov esi, 0
lea r8, result_1
jmp short loc_11C2
loc_119C:
mov esi, 0
loc_11A1:
mov [rbx], esi
lea rax, result_1
pop rbx
retn
loc_11AC:
mov edx, [r9]
movsxd rax, esi
mov [r8+rax*4], edx
lea esi, [rsi+1]
loc_11B9:
add r9, 4
cmp r9, rdi
jz short loc_11A1
loc_11C2:
test r10d, r10d
jle short loc_11AC
mov edx, [r9]
mov rax, r11
loc_11CD:
cmp edx, [rax]
jz short loc_11B9
add rax, 4
cmp rax, rcx
jnz short loc_11CD
jmp short loc_11AC | _DWORD * func0(_DWORD *a1, int a2, _DWORD *a3, int a4, _DWORD *a5)
{
_DWORD *v6; // r9
long long v7; // rdi
long long v8; // rcx
int v9; // esi
_DWORD *v11; // rax
if ( a2 <= 0 )
{
v9 = 0;
}
else
{
v6 = a1;
v7 = (long long)&a1[a2 - 1 + 1];
v8 = (long long)&a3[a4 - 1 + 1];
v9 = 0;
do
{
if ( a4 <= 0 )
{
LABEL_5:
result_1[v9++] = *v6;
}
else
{
v11 = a3;
while ( *v6 != *v11 )
{
if ( ++v11 == (_DWORD *)v8 )
goto LABEL_5;
}
}
++v6;
}
while ( v6 != (_DWORD *)v7 );
}
*a5 = v9;
return result_1;
} | func0:
ENDBR64
PUSH RBX
MOV RBX,R8
TEST ESI,ESI
JLE 0x0010119c
MOV R11,RDX
MOV R10D,ECX
MOV R9,RDI
LEA EAX,[RSI + -0x1]
LEA RDI,[RDI + RAX*0x4 + 0x4]
LEA EAX,[RCX + -0x1]
LEA RCX,[RDX + RAX*0x4 + 0x4]
MOV ESI,0x0
LEA R8,[0x104040]
JMP 0x001011c2
LAB_0010119c:
MOV ESI,0x0
LAB_001011a1:
MOV dword ptr [RBX],ESI
LEA RAX,[0x104040]
POP RBX
RET
LAB_001011ac:
MOV EDX,dword ptr [R9]
MOVSXD RAX,ESI
MOV dword ptr [R8 + RAX*0x4],EDX
LEA ESI,[RSI + 0x1]
LAB_001011b9:
ADD R9,0x4
CMP R9,RDI
JZ 0x001011a1
LAB_001011c2:
TEST R10D,R10D
JLE 0x001011ac
MOV EDX,dword ptr [R9]
MOV RAX,R11
LAB_001011cd:
CMP EDX,dword ptr [RAX]
JZ 0x001011b9
ADD RAX,0x4
CMP RAX,RCX
JNZ 0x001011cd
JMP 0x001011ac | int4 * func0(int *param_1,int param_2,int *param_3,int param_4,int *param_5)
{
int *piVar1;
int *piVar2;
int iVar3;
if (param_2 < 1) {
iVar3 = 0;
}
else {
piVar1 = param_1 + (ulong)(param_2 - 1) + 1;
iVar3 = 0;
do {
if (0 < param_4) {
piVar2 = param_3;
do {
if (*param_1 == *piVar2) goto LAB_001011b9;
piVar2 = piVar2 + 1;
} while (piVar2 != param_3 + (ulong)(param_4 - 1) + 1);
}
(&result_1)[iVar3] = *param_1;
iVar3 = iVar3 + 1;
LAB_001011b9:
param_1 = param_1 + 1;
} while (param_1 != piVar1);
}
*param_5 = iVar3;
return &result_1;
} |
4,538 | func0 |
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
| int* func0(const int* list1, int list1_size, const int* list2, int list2_size, int* result_size) {
static int result[1000]; // Assuming maximum size of resulting array is 1000.
int index = 0;
for (int i = 0; i < list1_size; i++) {
bool found = false;
for (int j = 0; j < list2_size; j++) {
if (list1[i] == list2[j]) {
found = true;
break;
}
}
if (!found) {
result[index++] = list1[i];
}
}
*result_size = index;
return result;
}
| int main() {
int result_size;
const int list1[] = {1,2,3,4,5,6,7,8,9,10};
const int list2[] = {2,4,6,8};
const int list3[] = {1, 3, 5, 7};
const int list4[] = {5, 7};
int expected1[] = {1, 3, 5, 7, 9, 10};
int expected2[] = {2, 4, 6, 8, 9, 10};
int expected3[] = {1, 2, 3, 4, 6, 8, 9, 10};
int* result;
result = func0(list1, 10, list2, 4, &result_size);
assert(result_size == 6);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected1[i]);
}
result = func0(list1, 10, list3, 4, &result_size);
assert(result_size == 6);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected2[i]);
}
result = func0(list1, 10, list4, 2, &result_size);
assert(result_size == 8);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected3[i]);
}
return 0;
}
| O2 | c | func0:
endbr64
push %rbx
mov %r8,%rbx
test %esi,%esi
jle 14be <func0+0x7e>
lea -0x1(%rsi),%eax
mov %rdi,%r9
lea 0x2be7(%rip),%r8
xor %r10d,%r10d
lea 0x4(%rdi,%rax,4),%r11
lea -0x1(%rcx),%eax
lea 0x4(%rdx,%rax,4),%rdi
nopl 0x0(%rax)
mov (%r9),%esi
mov %rdx,%rax
test %ecx,%ecx
jg 1489 <func0+0x49>
jmp 14a8 <func0+0x68>
nopl 0x0(%rax)
add $0x4,%rax
cmp %rdi,%rax
je 14a8 <func0+0x68>
cmp %esi,(%rax)
jne 1480 <func0+0x40>
add $0x4,%r9
cmp %r11,%r9
jne 1470 <func0+0x30>
mov %r10d,(%rbx)
lea 0x2ba0(%rip),%rax
pop %rbx
retq
nopw 0x0(%rax,%rax,1)
movslq %r10d,%rax
add $0x4,%r9
add $0x1,%r10d
mov %esi,(%r8,%rax,4)
cmp %r11,%r9
jne 1470 <func0+0x30>
jmp 1496 <func0+0x56>
xor %r10d,%r10d
lea 0x2b78(%rip),%rax
mov %r10d,(%rbx)
pop %rbx
retq
nopl (%rax)
| func0:
endbr64
push r12
test esi, esi
jle short loc_14A5
lea eax, [rsi-1]
mov r10d, ecx
mov r9, rdx
xor esi, esi
lea r11, [rdi+rax*4+4]
lea eax, [rcx-1]
lea rcx, [rdx+rax*4+4]
lea r12, result_1
nop dword ptr [rax+00000000h]
loc_1460:
mov edx, [rdi]
mov rax, r9
test r10d, r10d
jg short loc_1479
jmp short loc_1490
loc_1470:
add rax, 4
cmp rcx, rax
jz short loc_1490
loc_1479:
cmp [rax], edx
jnz short loc_1470
add rdi, 4
cmp rdi, r11
jnz short loc_1460
loc_1486:
mov rax, r12
mov [r8], esi
pop r12
retn
loc_1490:
movsxd rax, esi
add rdi, 4
add esi, 1
mov [r12+rax*4], edx
cmp rdi, r11
jnz short loc_1460
jmp short loc_1486
loc_14A5:
lea r12, result_1
xor esi, esi
mov rax, r12
mov [r8], esi
pop r12
retn | _DWORD * func0(int *a1, int a2, _DWORD *a3, int a4, _DWORD *a5)
{
long long v5; // rax
int v8; // esi
long long v9; // r11
long long v10; // rcx
int v11; // edx
_DWORD *v12; // rax
_DWORD *result; // rax
long long v14; // rax
if ( a2 <= 0 )
{
result = result_1;
*a5 = 0;
}
else
{
v5 = (unsigned int)(a2 - 1);
v8 = 0;
v9 = (long long)&a1[v5 + 1];
v10 = (long long)&a3[a4 - 1 + 1];
do
{
while ( 1 )
{
v11 = *a1;
v12 = a3;
if ( a4 > 0 )
break;
LABEL_9:
v14 = v8;
++a1;
++v8;
result_1[v14] = v11;
if ( a1 == (int *)v9 )
goto LABEL_8;
}
while ( *v12 != v11 )
{
if ( (_DWORD *)v10 == ++v12 )
goto LABEL_9;
}
++a1;
}
while ( a1 != (int *)v9 );
LABEL_8:
result = result_1;
*a5 = v8;
}
return result;
} | func0:
ENDBR64
PUSH R12
TEST ESI,ESI
JLE 0x001014a5
LEA EAX,[RSI + -0x1]
MOV R10D,ECX
MOV R9,RDX
XOR ESI,ESI
LEA R11,[RDI + RAX*0x4 + 0x4]
LEA EAX,[RCX + -0x1]
LEA RCX,[RDX + RAX*0x4 + 0x4]
LEA R12,[0x104040]
NOP dword ptr [RAX]
LAB_00101460:
MOV EDX,dword ptr [RDI]
MOV RAX,R9
TEST R10D,R10D
JG 0x00101479
JMP 0x00101490
LAB_00101470:
ADD RAX,0x4
CMP RCX,RAX
JZ 0x00101490
LAB_00101479:
CMP dword ptr [RAX],EDX
JNZ 0x00101470
ADD RDI,0x4
CMP RDI,R11
JNZ 0x00101460
LAB_00101486:
MOV RAX,R12
MOV dword ptr [R8],ESI
POP R12
RET
LAB_00101490:
MOVSXD RAX,ESI
ADD RDI,0x4
ADD ESI,0x1
MOV dword ptr [R12 + RAX*0x4],EDX
CMP RDI,R11
JNZ 0x00101460
JMP 0x00101486
LAB_001014a5:
LEA R12,[0x104040]
XOR ESI,ESI
MOV RAX,R12
MOV dword ptr [R8],ESI
POP R12
RET | int4 * func0(int *param_1,int param_2,int *param_3,int param_4,int *param_5)
{
int *piVar1;
int *piVar2;
long lVar3;
int iVar4;
if (param_2 < 1) {
*param_5 = 0;
return &result_1;
}
iVar4 = 0;
piVar1 = param_1 + (ulong)(param_2 - 1) + 1;
do {
piVar2 = param_3;
if (0 < param_4) {
do {
if (*piVar2 == *param_1) goto joined_r0x00101484;
piVar2 = piVar2 + 1;
} while (param_3 + (ulong)(param_4 - 1) + 1 != piVar2);
}
lVar3 = (long)iVar4;
iVar4 = iVar4 + 1;
(&result_1)[lVar3] = *param_1;
joined_r0x00101484:
param_1 = param_1 + 1;
if (param_1 == piVar1) {
*param_5 = iVar4;
return &result_1;
}
} while( true );
} |
4,539 | func0 |
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
| int* func0(const int* list1, int list1_size, const int* list2, int list2_size, int* result_size) {
static int result[1000]; // Assuming maximum size of resulting array is 1000.
int index = 0;
for (int i = 0; i < list1_size; i++) {
bool found = false;
for (int j = 0; j < list2_size; j++) {
if (list1[i] == list2[j]) {
found = true;
break;
}
}
if (!found) {
result[index++] = list1[i];
}
}
*result_size = index;
return result;
}
| int main() {
int result_size;
const int list1[] = {1,2,3,4,5,6,7,8,9,10};
const int list2[] = {2,4,6,8};
const int list3[] = {1, 3, 5, 7};
const int list4[] = {5, 7};
int expected1[] = {1, 3, 5, 7, 9, 10};
int expected2[] = {2, 4, 6, 8, 9, 10};
int expected3[] = {1, 2, 3, 4, 6, 8, 9, 10};
int* result;
result = func0(list1, 10, list2, 4, &result_size);
assert(result_size == 6);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected1[i]);
}
result = func0(list1, 10, list3, 4, &result_size);
assert(result_size == 6);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected2[i]);
}
result = func0(list1, 10, list4, 2, &result_size);
assert(result_size == 8);
for (int i = 0; i < result_size; i++) {
assert(result[i] == expected3[i]);
}
return 0;
}
| O3 | c | func0:
endbr64
push %rbx
mov %r8,%rbx
test %esi,%esi
jle 14ce <func0+0x7e>
lea -0x1(%rsi),%eax
mov %rdi,%r9
lea 0x2bd7(%rip),%r8
xor %r10d,%r10d
lea 0x4(%rdi,%rax,4),%r11
lea -0x1(%rcx),%eax
lea 0x4(%rdx,%rax,4),%rdi
nopl 0x0(%rax)
mov (%r9),%esi
mov %rdx,%rax
test %ecx,%ecx
jg 1499 <func0+0x49>
jmp 14b8 <func0+0x68>
nopl 0x0(%rax)
add $0x4,%rax
cmp %rax,%rdi
je 14b8 <func0+0x68>
cmp %esi,(%rax)
jne 1490 <func0+0x40>
add $0x4,%r9
cmp %r9,%r11
jne 1480 <func0+0x30>
mov %r10d,(%rbx)
lea 0x2b90(%rip),%rax
pop %rbx
retq
nopw 0x0(%rax,%rax,1)
movslq %r10d,%rax
add $0x4,%r9
add $0x1,%r10d
mov %esi,(%r8,%rax,4)
cmp %r9,%r11
jne 1480 <func0+0x30>
jmp 14a6 <func0+0x56>
xor %r10d,%r10d
lea 0x2b68(%rip),%rax
mov %r10d,(%rbx)
pop %rbx
retq
nopl (%rax)
| func0:
endbr64
push rbx
mov rbx, r8
test esi, esi
jle short loc_144E
movsxd rsi, esi
movsxd rax, ecx
mov r11d, ecx
mov r9, rdx
lea r10, [rdi+rsi*4]
lea rcx, [rdx+rax*4]
xor esi, esi
lea r8, result_1
nop dword ptr [rax+00000000h]
loc_1400:
mov edx, [rdi]
test r11d, r11d
jle short loc_1430
loc_1407:
mov rax, r9
jmp short loc_1419
loc_1410:
add rax, 4
cmp rax, rcx
jz short loc_1430
loc_1419:
cmp [rax], edx
jnz short loc_1410
add rdi, 4
cmp rdi, r10
jz short loc_1445
mov edx, [rdi]
jmp short loc_1407
loc_1430:
add rdi, 4
mov [r8+rsi*4], edx
lea eax, [rsi+1]
cmp rdi, r10
jz short loc_1447
movsxd rsi, eax
jmp short loc_1400
loc_1445:
mov eax, esi
loc_1447:
mov [rbx], eax
mov rax, r8
pop rbx
retn
loc_144E:
xor eax, eax
lea r8, result_1
mov [rbx], eax
mov rax, r8
pop rbx
retn | _DWORD * func0(int *a1, int a2, _DWORD *a3, int a4, _DWORD *a5)
{
int *v7; // r10
_DWORD *v8; // rcx
long long i; // rsi
int v10; // edx
_DWORD *v11; // rax
int v12; // eax
if ( a2 <= 0 )
{
*a5 = 0;
return result_1;
}
else
{
v7 = &a1[a2];
v8 = &a3[a4];
for ( i = 0LL; ; i = v12 )
{
v10 = *a1;
if ( a4 > 0 )
break;
LABEL_9:
++a1;
result_1[i] = v10;
v12 = i + 1;
if ( a1 == v7 )
goto LABEL_12;
}
while ( 1 )
{
v11 = a3;
while ( *v11 != v10 )
{
if ( ++v11 == v8 )
goto LABEL_9;
}
if ( ++a1 == v7 )
break;
v10 = *a1;
}
v12 = i;
LABEL_12:
*a5 = v12;
return result_1;
}
} | func0:
ENDBR64
PUSH RBX
MOV RBX,R8
TEST ESI,ESI
JLE 0x0010144e
MOVSXD RSI,ESI
MOVSXD RAX,ECX
MOV R11D,ECX
MOV R9,RDX
LEA R10,[RDI + RSI*0x4]
LEA RCX,[RDX + RAX*0x4]
XOR ESI,ESI
LEA R8,[0x104040]
NOP dword ptr [RAX]
LAB_00101400:
MOV EDX,dword ptr [RDI]
TEST R11D,R11D
JLE 0x00101430
LAB_00101407:
MOV RAX,R9
JMP 0x00101419
LAB_00101410:
ADD RAX,0x4
CMP RAX,RCX
JZ 0x00101430
LAB_00101419:
CMP dword ptr [RAX],EDX
JNZ 0x00101410
ADD RDI,0x4
CMP RDI,R10
JZ 0x00101445
MOV EDX,dword ptr [RDI]
JMP 0x00101407
LAB_00101430:
ADD RDI,0x4
MOV dword ptr [R8 + RSI*0x4],EDX
LEA EAX,[RSI + 0x1]
CMP RDI,R10
JZ 0x00101447
MOVSXD RSI,EAX
JMP 0x00101400
LAB_00101445:
MOV EAX,ESI
LAB_00101447:
MOV dword ptr [RBX],EAX
MOV RAX,R8
POP RBX
RET
LAB_0010144e:
XOR EAX,EAX
LEA R8,[0x104040]
MOV dword ptr [RBX],EAX
MOV RAX,R8
POP RBX
RET | int4 * func0(int *param_1,int param_2,int *param_3,int param_4,int *param_5)
{
int *piVar1;
int iVar2;
int *piVar3;
int iVar4;
long lVar5;
if (param_2 < 1) {
*param_5 = 0;
return &result_1;
}
piVar1 = param_1 + param_2;
lVar5 = 0;
while( true ) {
iVar4 = *param_1;
iVar2 = (int)lVar5;
piVar3 = param_3;
if (0 < param_4) {
do {
while (*piVar3 == iVar4) {
param_1 = param_1 + 1;
if (param_1 == piVar1) goto LAB_00101447;
piVar3 = param_3;
iVar4 = *param_1;
}
piVar3 = piVar3 + 1;
} while (piVar3 != param_3 + param_4);
}
param_1 = param_1 + 1;
(&result_1)[lVar5] = iVar4;
iVar2 = iVar2 + 1;
if (param_1 == piVar1) break;
lVar5 = (long)iVar2;
}
LAB_00101447:
*param_5 = iVar2;
return &result_1;
} |
4,540 | func0 |
#include <assert.h>
| int func0(int n) {
if (n < 1) {
return 0;
} else {
return n + func0(n - 2);
}
}
| int main() {
assert(func0(6) == 12);
assert(func0(10) == 30);
assert(func0(9) == 25);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x10,%rsp
mov %edi,-0x4(%rbp)
cmpl $0x0,-0x4(%rbp)
jg 1165 <func0+0x1c>
mov $0x0,%eax
jmp 1177 <func0+0x2e>
mov -0x4(%rbp),%eax
sub $0x2,%eax
mov %eax,%edi
callq 1149 <func0>
mov -0x4(%rbp),%edx
add %edx,%eax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 10h
mov [rbp+var_4], edi
cmp [rbp+var_4], 0
jg short loc_1165
mov eax, 0
jmp short locret_1177
loc_1165:
mov eax, [rbp+var_4]
sub eax, 2
mov edi, eax
call func0
mov edx, [rbp+var_4]
add eax, edx
locret_1177:
leave
retn | long long func0(int a1)
{
if ( a1 > 0 )
return a1 + (unsigned int)func0((unsigned int)(a1 - 2));
else
return 0LL;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x10
MOV dword ptr [RBP + -0x4],EDI
CMP dword ptr [RBP + -0x4],0x0
JG 0x00101165
MOV EAX,0x0
JMP 0x00101177
LAB_00101165:
MOV EAX,dword ptr [RBP + -0x4]
SUB EAX,0x2
MOV EDI,EAX
CALL 0x00101149
MOV EDX,dword ptr [RBP + -0x4]
ADD EAX,EDX
LAB_00101177:
LEAVE
RET | int func0(int param_1)
{
int iVar1;
if (param_1 < 1) {
iVar1 = 0;
}
else {
iVar1 = func0(param_1 + -2);
iVar1 = iVar1 + param_1;
}
return iVar1;
} |
4,541 | func0 |
#include <assert.h>
| int func0(int n) {
if (n < 1) {
return 0;
} else {
return n + func0(n - 2);
}
}
| int main() {
assert(func0(6) == 12);
assert(func0(10) == 30);
assert(func0(9) == 25);
return 0;
}
| O1 | c | func0:
endbr64
mov $0x0,%eax
test %edi,%edi
jg 1157 <func0+0xe>
retq
push %rbx
mov %edi,%ebx
lea -0x2(%rdi),%edi
callq 1149 <func0>
add %ebx,%eax
pop %rbx
retq
| func0:
endbr64
mov eax, 0
test edi, edi
jg short loc_1157
retn
loc_1157:
push rbx
mov ebx, edi
lea edi, [rdi-2]
call func0
add eax, ebx
pop rbx
retn | long long func0(int a1)
{
long long result; // rax
result = 0LL;
if ( a1 > 0 )
return a1 + (unsigned int)func0((unsigned int)(a1 - 2));
return result;
} | func0:
ENDBR64
MOV EAX,0x0
TEST EDI,EDI
JG 0x00101157
RET
LAB_00101157:
PUSH RBX
MOV EBX,EDI
LEA EDI,[RDI + -0x2]
CALL 0x00101149
ADD EAX,EBX
POP RBX
RET | int func0(int param_1)
{
int iVar1;
if (param_1 < 1) {
return 0;
}
iVar1 = func0(param_1 + -2);
return iVar1 + param_1;
} |
4,542 | func0 |
#include <assert.h>
| int func0(int n) {
if (n < 1) {
return 0;
} else {
return n + func0(n - 2);
}
}
| int main() {
assert(func0(6) == 12);
assert(func0(10) == 30);
assert(func0(9) == 25);
return 0;
}
| O2 | c | func0:
endbr64
xor %r8d,%r8d
test %edi,%edi
jle 116e <func0+0x2e>
lea -0x2(%rdi),%eax
lea -0x1(%rdi),%edx
xor %r8d,%r8d
and $0xfffffffe,%edx
mov %eax,%ecx
sub %edx,%ecx
jmp 1163 <func0+0x23>
nopl (%rax)
sub $0x2,%eax
mov %edi,%edx
mov %eax,%edi
add %edx,%r8d
cmp %ecx,%eax
jne 1160 <func0+0x20>
mov %r8d,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax)
| func0:
endbr64
xor r8d, r8d
test edi, edi
jle short loc_116E
lea eax, [rdi-2]
lea edx, [rdi-1]
xor r8d, r8d
and edx, 0FFFFFFFEh
mov ecx, eax
sub ecx, edx
jmp short loc_1163
loc_1160:
sub eax, 2
loc_1163:
mov edx, edi
mov edi, eax
add r8d, edx
cmp eax, ecx
jnz short loc_1160
loc_116E:
mov eax, r8d
retn | long long func0(int a1)
{
unsigned int v1; // r8d
int v2; // eax
unsigned int v3; // ecx
int v4; // edx
v1 = 0;
if ( a1 > 0 )
{
v2 = a1 - 2;
v1 = 0;
v3 = a1 - 2 - ((a1 - 1) & 0xFFFFFFFE);
while ( 1 )
{
v4 = a1;
a1 = v2;
v1 += v4;
if ( v2 == v3 )
break;
v2 -= 2;
}
}
return v1;
} | func0:
ENDBR64
XOR R8D,R8D
TEST EDI,EDI
JLE 0x0010116e
LEA EAX,[RDI + -0x2]
LEA EDX,[RDI + -0x1]
XOR R8D,R8D
AND EDX,0xfffffffe
MOV ECX,EAX
SUB ECX,EDX
JMP 0x00101163
LAB_00101160:
SUB EAX,0x2
LAB_00101163:
MOV EDX,EDI
MOV EDI,EAX
ADD R8D,EDX
CMP EAX,ECX
JNZ 0x00101160
LAB_0010116e:
MOV EAX,R8D
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
int iVar3;
iVar3 = 0;
if (0 < param_1) {
iVar3 = 0;
iVar2 = param_1;
for (iVar1 = param_1 + -2; iVar3 = iVar3 + iVar2,
iVar1 != (param_1 + -2) - (param_1 - 1U & 0xfffffffe); iVar1 = iVar1 + -2) {
iVar2 = iVar1;
}
}
return iVar3;
} |
4,543 | func0 |
#include <assert.h>
| int func0(int n) {
if (n < 1) {
return 0;
} else {
return n + func0(n - 2);
}
}
| int main() {
assert(func0(6) == 12);
assert(func0(10) == 30);
assert(func0(9) == 25);
return 0;
}
| O3 | c | func0:
endbr64
test %edi,%edi
jle 11e8 <func0+0xa8>
lea -0x1(%rdi),%eax
mov %eax,%ecx
shr %ecx
add $0x1,%ecx
cmp $0x23,%eax
jbe 11eb <func0+0xab>
movd %edi,%xmm4
mov %ecx,%edx
movdqa 0xeb3(%rip),%xmm3
xor %eax,%eax
pshufd $0x0,%xmm4,%xmm1
paddd 0xe94(%rip),%xmm1
shr $0x2,%edx
pxor %xmm0,%xmm0
nopl 0x0(%rax,%rax,1)
movdqa %xmm1,%xmm2
add $0x1,%eax
paddd %xmm3,%xmm1
paddd %xmm2,%xmm0
cmp %edx,%eax
jne 1188 <func0+0x48>
movdqa %xmm0,%xmm1
mov %ecx,%edx
psrldq $0x8,%xmm1
and $0xfffffffc,%edx
paddd %xmm1,%xmm0
mov %edx,%esi
movdqa %xmm0,%xmm1
neg %esi
psrldq $0x4,%xmm1
lea (%rdi,%rsi,2),%edi
paddd %xmm1,%xmm0
movd %xmm0,%eax
cmp %edx,%ecx
je 11e0 <func0+0xa0>
nopl 0x0(%rax)
mov %edi,%edx
sub $0x2,%edi
add %edx,%eax
test %edi,%edi
jg 11d0 <func0+0x90>
retq
nopl 0x0(%rax)
retq
nopl 0x0(%rax)
xor %eax,%eax
retq
xor %eax,%eax
jmp 11d0 <func0+0x90>
| func0:
endbr64
mov edx, edi
test edi, edi
jle loc_1220
lea eax, [rdi-1]
mov ecx, eax
shr ecx, 1
add ecx, 1
cmp eax, 13h
jbe loc_1223
movd xmm4, edi
mov esi, ecx
movdqa xmm3, cs:xmmword_2020
xor eax, eax
pshufd xmm1, xmm4, 0
paddd xmm1, cs:xmmword_2010
shr esi, 2
pxor xmm0, xmm0
nop dword ptr [rax]
loc_1188:
movdqa xmm2, xmm1
add eax, 1
paddd xmm1, xmm3
paddd xmm0, xmm2
cmp eax, esi
jnz short loc_1188
movdqa xmm1, xmm0
psrldq xmm1, 8
paddd xmm0, xmm1
movdqa xmm1, xmm0
psrldq xmm1, 4
paddd xmm0, xmm1
movd eax, xmm0
test cl, 3
jz short locret_121B
and ecx, 0FFFFFFFCh
neg ecx
lea edx, [rdx+rcx*2]
loc_11C6:
lea ecx, [rdx-2]
add eax, edx
test ecx, ecx
jle short locret_121B
lea esi, [rdx-4]
add eax, ecx
test esi, esi
jle short locret_121B
lea ecx, [rdx-6]
add eax, esi
test ecx, ecx
jle short locret_121B
lea esi, [rdx-8]
add eax, ecx
test esi, esi
jle short locret_121B
lea ecx, [rdx-0Ah]
add eax, esi
test ecx, ecx
jle short locret_121B
lea esi, [rdx-0Ch]
add eax, ecx
test esi, esi
jle short locret_121B
lea ecx, [rdx-0Eh]
add eax, esi
test ecx, ecx
jle short locret_121B
lea esi, [rdx-10h]
add eax, ecx
test esi, esi
jle short locret_121B
add eax, esi
sub edx, 12h
lea ecx, [rax+rdx]
test edx, edx
cmovg eax, ecx
locret_121B:
retn
loc_1220:
xor eax, eax
retn
loc_1223:
xor eax, eax
jmp short loc_11C6 | long long func0(signed int a1)
{
signed int v1; // edx
unsigned int v2; // ecx
__m128i si128; // xmm3
int v4; // eax
__m128i v5; // xmm1
__m128i v6; // xmm0
__m128i v7; // xmm2
__m128i v8; // xmm0
long long result; // rax
int v10; // edx
v1 = a1;
if ( a1 <= 0 )
return 0LL;
v2 = ((unsigned int)(a1 - 1) >> 1) + 1;
if ( (unsigned int)(a1 - 1) <= 0x13 )
{
LODWORD(result) = 0;
}
else
{
si128 = _mm_load_si128((const __m128i *)&xmmword_2020);
v4 = 0;
v5 = _mm_add_epi32(_mm_shuffle_epi32(_mm_cvtsi32_si128(a1), 0), (__m128i)xmmword_2010);
v6 = 0LL;
do
{
v7 = v5;
++v4;
v5 = _mm_add_epi32(v5, si128);
v6 = _mm_add_epi32(v6, v7);
}
while ( v4 != v2 >> 2 );
v8 = _mm_add_epi32(v6, _mm_srli_si128(v6, 8));
result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v8, _mm_srli_si128(v8, 4)));
if ( (v2 & 3) == 0 )
return result;
v1 = a1 - 2 * (v2 & 0xFFFFFFFC);
}
result = (unsigned int)(v1 + result);
if ( v1 - 2 > 0 )
{
result = (unsigned int)(v1 - 2 + result);
if ( v1 - 4 > 0 )
{
result = (unsigned int)(v1 - 4 + result);
if ( v1 - 6 > 0 )
{
result = (unsigned int)(v1 - 6 + result);
if ( v1 - 8 > 0 )
{
result = (unsigned int)(v1 - 8 + result);
if ( v1 - 10 > 0 )
{
result = (unsigned int)(v1 - 10 + result);
if ( v1 - 12 > 0 )
{
result = (unsigned int)(v1 - 12 + result);
if ( v1 - 14 > 0 )
{
result = (unsigned int)(v1 - 14 + result);
if ( v1 - 16 > 0 )
{
result = (unsigned int)(v1 - 16 + result);
v10 = v1 - 18;
if ( v10 > 0 )
return (unsigned int)(result + v10);
}
}
}
}
}
}
}
}
return result;
} | func0:
ENDBR64
MOV EDX,EDI
TEST EDI,EDI
JLE 0x00101220
LEA EAX,[RDI + -0x1]
MOV ECX,EAX
SHR ECX,0x1
ADD ECX,0x1
CMP EAX,0x13
JBE 0x00101223
MOVD XMM4,EDI
MOV ESI,ECX
MOVDQA XMM3,xmmword ptr [0x00102020]
XOR EAX,EAX
PSHUFD XMM1,XMM4,0x0
PADDD XMM1,xmmword ptr [0x00102010]
SHR ESI,0x2
PXOR XMM0,XMM0
NOP dword ptr [RAX]
LAB_00101188:
MOVDQA XMM2,XMM1
ADD EAX,0x1
PADDD XMM1,XMM3
PADDD XMM0,XMM2
CMP EAX,ESI
JNZ 0x00101188
MOVDQA XMM1,XMM0
PSRLDQ XMM1,0x8
PADDD XMM0,XMM1
MOVDQA XMM1,XMM0
PSRLDQ XMM1,0x4
PADDD XMM0,XMM1
MOVD EAX,XMM0
TEST CL,0x3
JZ 0x0010121b
AND ECX,0xfffffffc
NEG ECX
LEA EDX,[RDX + RCX*0x2]
LAB_001011c6:
LEA ECX,[RDX + -0x2]
ADD EAX,EDX
TEST ECX,ECX
JLE 0x0010121b
LEA ESI,[RDX + -0x4]
ADD EAX,ECX
TEST ESI,ESI
JLE 0x0010121b
LEA ECX,[RDX + -0x6]
ADD EAX,ESI
TEST ECX,ECX
JLE 0x0010121b
LEA ESI,[RDX + -0x8]
ADD EAX,ECX
TEST ESI,ESI
JLE 0x0010121b
LEA ECX,[RDX + -0xa]
ADD EAX,ESI
TEST ECX,ECX
JLE 0x0010121b
LEA ESI,[RDX + -0xc]
ADD EAX,ECX
TEST ESI,ESI
JLE 0x0010121b
LEA ECX,[RDX + -0xe]
ADD EAX,ESI
TEST ECX,ECX
JLE 0x0010121b
LEA ESI,[RDX + -0x10]
ADD EAX,ECX
TEST ESI,ESI
JLE 0x0010121b
ADD EAX,ESI
SUB EDX,0x12
LEA ECX,[RAX + RDX*0x1]
TEST EDX,EDX
CMOVG EAX,ECX
LAB_0010121b:
RET
LAB_00101220:
XOR EAX,EAX
RET
LAB_00101223:
XOR EAX,EAX
JMP 0x001011c6 | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
int func0(int param_1)
{
uint uVar1;
int iVar2;
uint uVar3;
int iVar4;
int iVar5;
int iVar6;
int iVar7;
int iVar8;
int iVar9;
int iVar10;
if (param_1 < 1) {
return 0;
}
uVar3 = (param_1 - 1U >> 1) + 1;
if (param_1 - 1U < 0x14) {
iVar5 = 0;
}
else {
uVar1 = 0;
iVar4 = 0;
iVar6 = 0;
iVar7 = 0;
iVar8 = 0;
iVar5 = param_1 + _DAT_00102010;
iVar2 = param_1 + _UNK_00102014;
iVar9 = param_1 + _UNK_00102018;
iVar10 = param_1 + _UNK_0010201c;
do {
uVar1 = uVar1 + 1;
iVar4 = iVar4 + iVar5;
iVar6 = iVar6 + iVar2;
iVar7 = iVar7 + iVar9;
iVar8 = iVar8 + iVar10;
iVar5 = iVar5 + _DAT_00102020;
iVar2 = iVar2 + _UNK_00102024;
iVar9 = iVar9 + _UNK_00102028;
iVar10 = iVar10 + _UNK_0010202c;
} while (uVar1 != uVar3 >> 2);
iVar5 = iVar4 + iVar7 + iVar6 + iVar8;
if ((uVar3 & 3) == 0) {
return iVar5;
}
param_1 = param_1 + (uVar3 & 0xfffffffc) * -2;
}
iVar2 = iVar5 + param_1;
if (0 < param_1 + -2) {
iVar2 = iVar5 + param_1 + param_1 + -2;
if (0 < param_1 + -4) {
iVar2 = iVar2 + param_1 + -4;
if (0 < param_1 + -6) {
iVar2 = iVar2 + param_1 + -6;
if (0 < param_1 + -8) {
iVar2 = iVar2 + param_1 + -8;
if (0 < param_1 + -10) {
iVar2 = iVar2 + param_1 + -10;
if (0 < param_1 + -0xc) {
iVar2 = iVar2 + param_1 + -0xc;
if (0 < param_1 + -0xe) {
iVar2 = iVar2 + param_1 + -0xe;
if (0 < param_1 + -0x10) {
iVar2 = iVar2 + param_1 + -0x10;
if (0 < param_1 + -0x12) {
iVar2 = iVar2 + param_1 + -0x12;
}
}
}
}
}
}
}
}
}
return iVar2;
} |
4,544 | func0 |
#include <math.h>
#include <assert.h>
| double func0(int s, double l) {
double area = s * (l * l) / (4 * tan(M_PI / s));
return area;
}
| int main() {
assert(func0(4, 20) == 400.00000000000006);
assert(func0(10, 15) == 1731.1969896610804);
assert(func0(9, 7) == 302.90938549487214);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x30,%rsp
mov %edi,-0x14(%rbp)
movsd %xmm0,-0x20(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd -0x20(%rbp),%xmm0
mulsd %xmm0,%xmm0
mulsd %xmm0,%xmm1
movsd %xmm1,-0x28(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd 0xf1f(%rip),%xmm0
divsd %xmm1,%xmm0
callq 1070 <tan@plt>
movsd 0xf16(%rip),%xmm1
mulsd %xmm1,%xmm0
movsd -0x28(%rbp),%xmm1
divsd %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd %xmm0,-0x8(%rbp)
movsd -0x8(%rbp),%xmm0
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 30h
mov [rbp+var_14], edi
movsd [rbp+var_20], xmm0
pxor xmm1, xmm1
cvtsi2sd xmm1, [rbp+var_14]
movsd xmm0, [rbp+var_20]
mulsd xmm0, xmm0
mulsd xmm1, xmm0
movsd [rbp+var_28], xmm1
pxor xmm1, xmm1
cvtsi2sd xmm1, [rbp+var_14]
movsd xmm0, cs:qword_20A0
movapd xmm2, xmm0
divsd xmm2, xmm1
movq rax, xmm2
movq xmm0, rax; x
call _tan
movsd xmm1, cs:qword_20A8
mulsd xmm1, xmm0
movsd xmm0, [rbp+var_28]
divsd xmm0, xmm1
movsd [rbp+var_8], xmm0
movsd xmm0, [rbp+var_8]
leave
retn | double func0(int a1, double a2)
{
return (double)a1 * (a2 * a2) / (4.0 * tan(3.141592653589793 / (double)a1));
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x30
MOV dword ptr [RBP + -0x14],EDI
MOVSD qword ptr [RBP + -0x20],XMM0
PXOR XMM1,XMM1
CVTSI2SD XMM1,dword ptr [RBP + -0x14]
MOVSD XMM0,qword ptr [RBP + -0x20]
MULSD XMM0,XMM0
MULSD XMM1,XMM0
MOVSD qword ptr [RBP + -0x28],XMM1
PXOR XMM1,XMM1
CVTSI2SD XMM1,dword ptr [RBP + -0x14]
MOVSD XMM0,qword ptr [0x001020a0]
MOVAPD XMM2,XMM0
DIVSD XMM2,XMM1
MOVQ RAX,XMM2
MOVQ XMM0,RAX
CALL 0x00101070
MOVSD XMM1,qword ptr [0x001020a8]
MULSD XMM1,XMM0
MOVSD XMM0,qword ptr [RBP + -0x28]
DIVSD XMM0,XMM1
MOVSD qword ptr [RBP + -0x8],XMM0
MOVSD XMM0,qword ptr [RBP + -0x8]
LEAVE
RET | double func0(double param_1,int param_2)
{
double dVar1;
dVar1 = tan(DAT_001020a0 / (double)param_2);
return ((double)param_2 * param_1 * param_1) / (DAT_001020a8 * dVar1);
} |
4,545 | func0 |
#include <math.h>
#include <assert.h>
| double func0(int s, double l) {
double area = s * (l * l) / (4 * tan(M_PI / s));
return area;
}
| int main() {
assert(func0(4, 20) == 400.00000000000006);
assert(func0(10, 15) == 1731.1969896610804);
assert(func0(9, 7) == 302.90938549487214);
return 0;
}
| O1 | c | func0:
endbr64
sub $0x18,%rsp
movsd %xmm0,0x8(%rsp)
pxor %xmm2,%xmm2
cvtsi2sd %edi,%xmm2
movsd 0xea1(%rip),%xmm0
movsd %xmm2,(%rsp)
divsd %xmm2,%xmm0
callq 1050 <tan@plt>
movapd %xmm0,%xmm1
movsd 0x8(%rsp),%xmm0
mulsd %xmm0,%xmm0
mulsd (%rsp),%xmm0
mulsd 0xe80(%rip),%xmm1
divsd %xmm1,%xmm0
add $0x18,%rsp
retq
| func0:
endbr64
sub rsp, 18h
movsd [rsp+18h+var_10], xmm0
pxor xmm2, xmm2
cvtsi2sd xmm2, edi
movsd xmm0, cs:qword_2008
movsd [rsp+18h+var_18], xmm2
divsd xmm0, xmm2
call _tan
movapd xmm1, xmm0
movsd xmm0, [rsp+18h+var_10]
mulsd xmm0, xmm0
mulsd xmm0, [rsp+18h+var_18]
mulsd xmm1, cs:qword_2010
divsd xmm0, xmm1
add rsp, 18h
retn | double func0(int a1, double a2)
{
return a2 * a2 * (double)a1 / (tan(3.141592653589793 / (double)a1) * 4.0);
} | func0:
ENDBR64
SUB RSP,0x18
MOVSD qword ptr [RSP + 0x8],XMM0
PXOR XMM2,XMM2
CVTSI2SD XMM2,EDI
MOVSD XMM0,qword ptr [0x00102008]
MOVSD qword ptr [RSP],XMM2
DIVSD XMM0,XMM2
CALL 0x00101050
MOVAPD XMM1,XMM0
MOVSD XMM0,qword ptr [RSP + 0x8]
MULSD XMM0,XMM0
MULSD XMM0,qword ptr [RSP]
MULSD XMM1,qword ptr [0x00102010]
DIVSD XMM0,XMM1
ADD RSP,0x18
RET | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
double func0(double param_1,int param_2)
{
double dVar1;
dVar1 = tan(DAT_00102008 / (double)param_2);
return (param_1 * param_1 * (double)param_2) / (dVar1 * _DAT_00102010);
} |
4,546 | func0 |
#include <math.h>
#include <assert.h>
| double func0(int s, double l) {
double area = s * (l * l) / (4 * tan(M_PI / s));
return area;
}
| int main() {
assert(func0(4, 20) == 400.00000000000006);
assert(func0(10, 15) == 1731.1969896610804);
assert(func0(9, 7) == 302.90938549487214);
return 0;
}
| O2 | c | func0:
endbr64
pxor %xmm2,%xmm2
sub $0x18,%rsp
cvtsi2sd %edi,%xmm2
movsd %xmm0,0x8(%rsp)
movsd 0xe8a(%rip),%xmm0
divsd %xmm2,%xmm0
movsd %xmm2,(%rsp)
callq 1050 <tan@plt>
movsd 0x8(%rsp),%xmm1
movsd (%rsp),%xmm2
mulsd 0xe71(%rip),%xmm0
add $0x18,%rsp
mulsd %xmm1,%xmm1
mulsd %xmm2,%xmm1
divsd %xmm0,%xmm1
movapd %xmm1,%xmm0
retq
nopw %cs:0x0(%rax,%rax,1)
xchg %ax,%ax
| func0:
endbr64
pxor xmm2, xmm2
sub rsp, 18h
cvtsi2sd xmm2, edi
movsd [rsp+18h+var_10], xmm0
movsd xmm0, cs:qword_2008
divsd xmm0, xmm2
movsd [rsp+18h+var_18], xmm2
call _tan
movsd xmm1, [rsp+18h+var_10]
movsd xmm2, [rsp+18h+var_18]
mulsd xmm0, cs:qword_2010
add rsp, 18h
mulsd xmm1, xmm1
mulsd xmm1, xmm2
divsd xmm1, xmm0
movapd xmm0, xmm1
retn | __int128 __usercall func0@<xmm0>(int a1@<edi>, double a2@<xmm0>)
{
__int128 v2; // xmm1
v2 = *(unsigned long long *)&a2;
*(double *)&v2 = *(double *)&v2 * *(double *)&v2 * (double)a1 / (tan(3.141592653589793 / (double)a1) * 4.0);
return v2;
} | func0:
ENDBR64
PXOR XMM2,XMM2
SUB RSP,0x18
CVTSI2SD XMM2,EDI
MOVSD qword ptr [RSP + 0x8],XMM0
MOVSD XMM0,qword ptr [0x00102008]
DIVSD XMM0,XMM2
MOVSD qword ptr [RSP],XMM2
CALL 0x00101050
MOVSD XMM1,qword ptr [RSP + 0x8]
MOVSD XMM2,qword ptr [RSP]
MULSD XMM0,qword ptr [0x00102010]
ADD RSP,0x18
MULSD XMM1,XMM1
MULSD XMM1,XMM2
DIVSD XMM1,XMM0
MOVAPD XMM0,XMM1
RET | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
double func0(double param_1,int param_2)
{
double dVar1;
dVar1 = tan(DAT_00102008 / (double)param_2);
return (param_1 * param_1 * (double)param_2) / (dVar1 * _DAT_00102010);
} |
4,547 | func0 |
#include <math.h>
#include <assert.h>
| double func0(int s, double l) {
double area = s * (l * l) / (4 * tan(M_PI / s));
return area;
}
| int main() {
assert(func0(4, 20) == 400.00000000000006);
assert(func0(10, 15) == 1731.1969896610804);
assert(func0(9, 7) == 302.90938549487214);
return 0;
}
| O3 | c | func0:
endbr64
pxor %xmm2,%xmm2
sub $0x18,%rsp
cvtsi2sd %edi,%xmm2
movsd %xmm0,0x8(%rsp)
movsd 0xe8a(%rip),%xmm0
divsd %xmm2,%xmm0
movsd %xmm2,(%rsp)
callq 1050 <tan@plt>
movsd 0x8(%rsp),%xmm1
movsd (%rsp),%xmm2
mulsd 0xe71(%rip),%xmm0
add $0x18,%rsp
mulsd %xmm1,%xmm1
mulsd %xmm2,%xmm1
divsd %xmm0,%xmm1
movapd %xmm1,%xmm0
retq
nopw %cs:0x0(%rax,%rax,1)
xchg %ax,%ax
| func0:
endbr64
pxor xmm2, xmm2
sub rsp, 18h
cvtsi2sd xmm2, edi
movsd [rsp+18h+var_10], xmm0
movsd xmm0, cs:qword_2008
divsd xmm0, xmm2; x
movsd [rsp+18h+var_18], xmm2
call _tan
movsd xmm1, [rsp+18h+var_10]
movsd xmm2, [rsp+18h+var_18]
mulsd xmm0, cs:qword_2010
add rsp, 18h
mulsd xmm1, xmm1
mulsd xmm1, xmm2
divsd xmm1, xmm0
movapd xmm0, xmm1
retn | __int128 __usercall func0@<xmm0>(int a1@<edi>, double a2@<xmm0>)
{
__int128 v2; // xmm1
v2 = *(unsigned long long *)&a2;
*(double *)&v2 = *(double *)&v2 * *(double *)&v2 * (double)a1 / (tan(3.141592653589793 / (double)a1) * 4.0);
return v2;
} | func0:
ENDBR64
PXOR XMM2,XMM2
SUB RSP,0x18
CVTSI2SD XMM2,EDI
MOVSD qword ptr [RSP + 0x8],XMM0
MOVSD XMM0,qword ptr [0x00102008]
DIVSD XMM0,XMM2
MOVSD qword ptr [RSP],XMM2
CALL 0x00101050
MOVSD XMM1,qword ptr [RSP + 0x8]
MOVSD XMM2,qword ptr [RSP]
MULSD XMM0,qword ptr [0x00102010]
ADD RSP,0x18
MULSD XMM1,XMM1
MULSD XMM1,XMM2
DIVSD XMM1,XMM0
MOVAPD XMM0,XMM1
RET | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
double func0(double param_1,int param_2)
{
double dVar1;
dVar1 = tan(DAT_00102008 / (double)param_2);
return (param_1 * param_1 * (double)param_2) / (dVar1 * _DAT_00102010);
} |
4,548 | func0 |
#include <math.h>
#include <assert.h>
int divSum(int n) {
int sum = 1;
int i = 2;
while (i * i <= n) {
if (n % i == 0) {
sum += i + (int)floor(n / i);
}
i++;
}
return sum;
}
| int func0(int num1, int num2) {
return divSum(num1) == divSum(num2);
}
| int main() {
assert(func0(36, 57) == 0);
assert(func0(2, 4) == 0);
assert(func0(23, 47) == 1);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
sub $0x8,%rsp
mov %edi,-0xc(%rbp)
mov %esi,-0x10(%rbp)
mov -0xc(%rbp),%eax
mov %eax,%edi
callq 1149 <divSum>
mov %eax,%ebx
mov -0x10(%rbp),%eax
mov %eax,%edi
callq 1149 <divSum>
cmp %eax,%ebx
sete %al
movzbl %al,%eax
add $0x8,%rsp
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
push rbx
sub rsp, 8
mov [rbp+var_C], edi
mov [rbp+var_10], esi
mov eax, [rbp+var_C]
mov edi, eax
call divSum
mov ebx, eax
mov eax, [rbp+var_10]
mov edi, eax
call divSum
cmp ebx, eax
setz al
movzx eax, al
mov rbx, [rbp+var_8]
leave
retn | _BOOL8 func0(unsigned int a1, unsigned int a2)
{
int v2; // ebx
v2 = divSum(a1);
return v2 == (unsigned int)divSum(a2);
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
PUSH RBX
SUB RSP,0x8
MOV dword ptr [RBP + -0xc],EDI
MOV dword ptr [RBP + -0x10],ESI
MOV EAX,dword ptr [RBP + -0xc]
MOV EDI,EAX
CALL 0x00101149
MOV EBX,EAX
MOV EAX,dword ptr [RBP + -0x10]
MOV EDI,EAX
CALL 0x00101149
CMP EBX,EAX
SETZ AL
MOVZX EAX,AL
MOV RBX,qword ptr [RBP + -0x8]
LEAVE
RET | bool func0(int4 param_1,int4 param_2)
{
int iVar1;
int iVar2;
iVar1 = divSum(param_1);
iVar2 = divSum(param_2);
return iVar1 == iVar2;
} |
4,549 | func0 |
#include <math.h>
#include <assert.h>
int divSum(int n) {
int sum = 1;
int i = 2;
while (i * i <= n) {
if (n % i == 0) {
sum += i + (int)floor(n / i);
}
i++;
}
return sum;
}
| int func0(int num1, int num2) {
return divSum(num1) == divSum(num2);
}
| int main() {
assert(func0(36, 57) == 0);
assert(func0(2, 4) == 0);
assert(func0(23, 47) == 1);
return 0;
}
| O1 | c | func0:
endbr64
push %rbp
push %rbx
mov %esi,%ebp
callq 1149 <divSum>
mov %eax,%ebx
mov %ebp,%edi
callq 1149 <divSum>
cmp %eax,%ebx
sete %al
movzbl %al,%eax
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
push rbx
mov ebp, esi
call divSum
mov ebx, eax
mov edi, ebp
call divSum
cmp ebx, eax
setz al
movzx eax, al
pop rbx
pop rbp
retn | _BOOL8 func0(long long a1, unsigned int a2)
{
int v2; // ebx
v2 = ((long long (*)(void))divSum)();
return v2 == (unsigned int)divSum(a2);
} | func0:
ENDBR64
PUSH RBP
PUSH RBX
MOV EBP,ESI
CALL 0x00101149
MOV EBX,EAX
MOV EDI,EBP
CALL 0x00101149
CMP EBX,EAX
SETZ AL
MOVZX EAX,AL
POP RBX
POP RBP
RET | bool func0(int8 param_1,int4 param_2)
{
int iVar1;
int iVar2;
iVar1 = divSum();
iVar2 = divSum(param_2);
return iVar1 == iVar2;
} |
4,550 | func0 |
#include <math.h>
#include <assert.h>
int divSum(int n) {
int sum = 1;
int i = 2;
while (i * i <= n) {
if (n % i == 0) {
sum += i + (int)floor(n / i);
}
i++;
}
return sum;
}
| int func0(int num1, int num2) {
return divSum(num1) == divSum(num2);
}
| int main() {
assert(func0(36, 57) == 0);
assert(func0(2, 4) == 0);
assert(func0(23, 47) == 1);
return 0;
}
| O2 | c | func0:
endbr64
mov $0x1,%r8d
cmp $0x3,%edi
jle 1284 <func0+0x34>
mov $0x2,%ecx
nopl 0x0(%rax)
mov %edi,%eax
cltd
idiv %ecx
add %ecx,%eax
add %r8d,%eax
test %edx,%edx
cmove %eax,%r8d
add $0x1,%ecx
mov %ecx,%eax
imul %ecx,%eax
cmp %eax,%edi
jge 1268 <func0+0x18>
mov $0x1,%edi
cmp $0x3,%esi
jle 12b2 <func0+0x62>
mov $0x2,%ecx
nopl 0x0(%rax,%rax,1)
mov %esi,%eax
cltd
idiv %ecx
add %ecx,%eax
add %edi,%eax
test %edx,%edx
cmove %eax,%edi
add $0x1,%ecx
mov %ecx,%eax
imul %ecx,%eax
cmp %eax,%esi
jge 1298 <func0+0x48>
xor %eax,%eax
cmp %r8d,%edi
sete %al
retq
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
mov r8d, 1
cmp edi, 3
jle short loc_1294
mov ecx, 2
nop dword ptr [rax+00h]
loc_1278:
mov eax, edi
cdq
idiv ecx
add eax, ecx
add eax, r8d
test edx, edx
cmovz r8d, eax
add ecx, 1
mov eax, ecx
imul eax, ecx
cmp edi, eax
jge short loc_1278
loc_1294:
mov edi, 1
cmp esi, 3
jle short loc_12C2
mov ecx, 2
nop dword ptr [rax+rax+00h]
loc_12A8:
mov eax, esi
cdq
idiv ecx
add eax, ecx
add eax, edi
test edx, edx
cmovz edi, eax
add ecx, 1
mov eax, ecx
imul eax, ecx
cmp esi, eax
jge short loc_12A8
loc_12C2:
xor eax, eax
cmp edi, r8d
setz al
retn | _BOOL8 func0(int a1, int a2)
{
int v2; // r8d
int v3; // ecx
int v4; // edi
int v5; // ecx
v2 = 1;
if ( a1 > 3 )
{
v3 = 2;
do
{
if ( !(a1 % v3) )
v2 += v3 + a1 / v3;
++v3;
}
while ( a1 >= v3 * v3 );
}
v4 = 1;
if ( a2 > 3 )
{
v5 = 2;
do
{
if ( !(a2 % v5) )
v4 += v5 + a2 / v5;
++v5;
}
while ( a2 >= v5 * v5 );
}
return v4 == v2;
} | func0:
ENDBR64
MOV R8D,0x1
CMP EDI,0x3
JLE 0x00101294
MOV ECX,0x2
NOP dword ptr [RAX]
LAB_00101278:
MOV EAX,EDI
CDQ
IDIV ECX
ADD EAX,ECX
ADD EAX,R8D
TEST EDX,EDX
CMOVZ R8D,EAX
ADD ECX,0x1
MOV EAX,ECX
IMUL EAX,ECX
CMP EDI,EAX
JGE 0x00101278
LAB_00101294:
MOV EDI,0x1
CMP ESI,0x3
JLE 0x001012c2
MOV ECX,0x2
NOP dword ptr [RAX + RAX*0x1]
LAB_001012a8:
MOV EAX,ESI
CDQ
IDIV ECX
ADD EAX,ECX
ADD EAX,EDI
TEST EDX,EDX
CMOVZ EDI,EAX
ADD ECX,0x1
MOV EAX,ECX
IMUL EAX,ECX
CMP ESI,EAX
JGE 0x001012a8
LAB_001012c2:
XOR EAX,EAX
CMP EDI,R8D
SETZ AL
RET | bool func0(int param_1,int param_2)
{
int iVar1;
int iVar2;
int iVar3;
iVar3 = 1;
if (3 < param_1) {
iVar1 = 2;
do {
if (param_1 % iVar1 == 0) {
iVar3 = param_1 / iVar1 + iVar1 + iVar3;
}
iVar1 = iVar1 + 1;
} while (iVar1 * iVar1 <= param_1);
}
iVar1 = 1;
if (3 < param_2) {
iVar2 = 2;
do {
if (param_2 % iVar2 == 0) {
iVar1 = param_2 / iVar2 + iVar2 + iVar1;
}
iVar2 = iVar2 + 1;
} while (iVar2 * iVar2 <= param_2);
}
return iVar1 == iVar3;
} |
4,551 | func0 |
#include <math.h>
#include <assert.h>
int divSum(int n) {
int sum = 1;
int i = 2;
while (i * i <= n) {
if (n % i == 0) {
sum += i + (int)floor(n / i);
}
i++;
}
return sum;
}
| int func0(int num1, int num2) {
return divSum(num1) == divSum(num2);
}
| int main() {
assert(func0(36, 57) == 0);
assert(func0(2, 4) == 0);
assert(func0(23, 47) == 1);
return 0;
}
| O3 | c | func0:
endbr64
mov $0x1,%r8d
cmp $0x3,%edi
jle 1284 <func0+0x34>
mov $0x2,%ecx
nopl 0x0(%rax)
mov %edi,%eax
cltd
idiv %ecx
add %ecx,%eax
add %r8d,%eax
test %edx,%edx
cmove %eax,%r8d
add $0x1,%ecx
mov %ecx,%eax
imul %ecx,%eax
cmp %eax,%edi
jge 1268 <func0+0x18>
mov $0x1,%edi
cmp $0x3,%esi
jle 12b2 <func0+0x62>
mov $0x2,%ecx
nopl 0x0(%rax,%rax,1)
mov %esi,%eax
cltd
idiv %ecx
add %ecx,%eax
add %edi,%eax
test %edx,%edx
cmove %eax,%edi
add $0x1,%ecx
mov %ecx,%eax
imul %ecx,%eax
cmp %eax,%esi
jge 1298 <func0+0x48>
xor %eax,%eax
cmp %r8d,%edi
sete %al
retq
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
mov r8d, 1
cmp edi, 3
jle short loc_1274
mov ecx, 2
nop dword ptr [rax+00h]
loc_1258:
mov eax, edi
cdq
idiv ecx
add eax, ecx
add eax, r8d
test edx, edx
cmovz r8d, eax
add ecx, 1
mov eax, ecx
imul eax, ecx
cmp edi, eax
jge short loc_1258
loc_1274:
mov edi, 1
cmp esi, 3
jle short loc_12A2
mov ecx, 2
nop dword ptr [rax+rax+00h]
loc_1288:
mov eax, esi
cdq
idiv ecx
add eax, ecx
add eax, edi
test edx, edx
cmovz edi, eax
add ecx, 1
mov eax, ecx
imul eax, ecx
cmp esi, eax
jge short loc_1288
loc_12A2:
xor eax, eax
cmp edi, r8d
setz al
retn | _BOOL8 func0(int a1, int a2)
{
int v2; // r8d
int v3; // ecx
int v4; // edi
int v5; // ecx
v2 = 1;
if ( a1 > 3 )
{
v3 = 2;
do
{
if ( !(a1 % v3) )
v2 += v3 + a1 / v3;
++v3;
}
while ( a1 >= v3 * v3 );
}
v4 = 1;
if ( a2 > 3 )
{
v5 = 2;
do
{
if ( !(a2 % v5) )
v4 += v5 + a2 / v5;
++v5;
}
while ( a2 >= v5 * v5 );
}
return v4 == v2;
} | func0:
ENDBR64
MOV R8D,0x1
CMP EDI,0x3
JLE 0x00101274
MOV ECX,0x2
NOP dword ptr [RAX]
LAB_00101258:
MOV EAX,EDI
CDQ
IDIV ECX
ADD EAX,ECX
ADD EAX,R8D
TEST EDX,EDX
CMOVZ R8D,EAX
ADD ECX,0x1
MOV EAX,ECX
IMUL EAX,ECX
CMP EDI,EAX
JGE 0x00101258
LAB_00101274:
MOV EDI,0x1
CMP ESI,0x3
JLE 0x001012a2
MOV ECX,0x2
NOP dword ptr [RAX + RAX*0x1]
LAB_00101288:
MOV EAX,ESI
CDQ
IDIV ECX
ADD EAX,ECX
ADD EAX,EDI
TEST EDX,EDX
CMOVZ EDI,EAX
ADD ECX,0x1
MOV EAX,ECX
IMUL EAX,ECX
CMP ESI,EAX
JGE 0x00101288
LAB_001012a2:
XOR EAX,EAX
CMP EDI,R8D
SETZ AL
RET | bool func0(int param_1,int param_2)
{
int iVar1;
int iVar2;
int iVar3;
iVar3 = 1;
if (3 < param_1) {
iVar1 = 2;
do {
if (param_1 % iVar1 == 0) {
iVar3 = param_1 / iVar1 + iVar1 + iVar3;
}
iVar1 = iVar1 + 1;
} while (iVar1 * iVar1 <= param_1);
}
iVar1 = 1;
if (3 < param_2) {
iVar2 = 2;
do {
if (param_2 % iVar2 == 0) {
iVar1 = param_2 / iVar2 + iVar2 + iVar1;
}
iVar2 = iVar2 + 1;
} while (iVar2 * iVar2 <= param_2);
}
return iVar1 == iVar3;
} |
4,552 | func0 |
#include <assert.h>
#include <string.h>
| int func0(const char *str1) {
int count_chars = 0;
int length = strlen(str1);
for (int i = 0; i < length; i++) {
if ((i == (str1[i] - 'A')) || (i == (str1[i] - 'a'))) {
count_chars += 1;
}
}
return count_chars;
}
| int main() {
assert(func0("xbcefg") == 2);
assert(func0("ABcED") == 3);
assert(func0("AbgdeF") == 5);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x20,%rsp
mov %rdi,-0x18(%rbp)
movl $0x0,-0xc(%rbp)
mov -0x18(%rbp),%rax
mov %rax,%rdi
callq 1060 <strlen@plt>
mov %eax,-0x4(%rbp)
movl $0x0,-0x8(%rbp)
jmp 11d6 <func0+0x6d>
mov -0x8(%rbp),%eax
movslq %eax,%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
movsbl %al,%eax
sub $0x41,%eax
cmp %eax,-0x8(%rbp)
je 11ce <func0+0x65>
mov -0x8(%rbp),%eax
movslq %eax,%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
movsbl %al,%eax
sub $0x61,%eax
cmp %eax,-0x8(%rbp)
jne 11d2 <func0+0x69>
addl $0x1,-0xc(%rbp)
addl $0x1,-0x8(%rbp)
mov -0x8(%rbp),%eax
cmp -0x4(%rbp),%eax
jl 1198 <func0+0x2f>
mov -0xc(%rbp),%eax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 20h
mov [rbp+s], rdi
mov [rbp+var_C], 0
mov rax, [rbp+s]
mov rdi, rax; s
call _strlen
mov [rbp+var_4], eax
mov [rbp+var_8], 0
jmp short loc_11D6
loc_1198:
mov eax, [rbp+var_8]
movsxd rdx, eax
mov rax, [rbp+s]
add rax, rdx
movzx eax, byte ptr [rax]
movsx eax, al
sub eax, 41h ; 'A'
cmp [rbp+var_8], eax
jz short loc_11CE
mov eax, [rbp+var_8]
movsxd rdx, eax
mov rax, [rbp+s]
add rax, rdx
movzx eax, byte ptr [rax]
movsx eax, al
sub eax, 61h ; 'a'
cmp [rbp+var_8], eax
jnz short loc_11D2
loc_11CE:
add [rbp+var_C], 1
loc_11D2:
add [rbp+var_8], 1
loc_11D6:
mov eax, [rbp+var_8]
cmp eax, [rbp+var_4]
jl short loc_1198
mov eax, [rbp+var_C]
leave
retn | long long func0(const char *a1)
{
unsigned int v2; // [rsp+14h] [rbp-Ch]
int i; // [rsp+18h] [rbp-8h]
int v4; // [rsp+1Ch] [rbp-4h]
v2 = 0;
v4 = strlen(a1);
for ( i = 0; i < v4; ++i )
{
if ( i == a1[i] - 65 || i == a1[i] - 97 )
++v2;
}
return v2;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x20
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0xc],0x0
MOV RAX,qword ptr [RBP + -0x18]
MOV RDI,RAX
CALL 0x00101060
MOV dword ptr [RBP + -0x4],EAX
MOV dword ptr [RBP + -0x8],0x0
JMP 0x001011d6
LAB_00101198:
MOV EAX,dword ptr [RBP + -0x8]
MOVSXD RDX,EAX
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
MOVSX EAX,AL
SUB EAX,0x41
CMP dword ptr [RBP + -0x8],EAX
JZ 0x001011ce
MOV EAX,dword ptr [RBP + -0x8]
MOVSXD RDX,EAX
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
MOVSX EAX,AL
SUB EAX,0x61
CMP dword ptr [RBP + -0x8],EAX
JNZ 0x001011d2
LAB_001011ce:
ADD dword ptr [RBP + -0xc],0x1
LAB_001011d2:
ADD dword ptr [RBP + -0x8],0x1
LAB_001011d6:
MOV EAX,dword ptr [RBP + -0x8]
CMP EAX,dword ptr [RBP + -0x4]
JL 0x00101198
MOV EAX,dword ptr [RBP + -0xc]
LEAVE
RET | int func0(char *param_1)
{
size_t sVar1;
int local_14;
int local_10;
local_14 = 0;
sVar1 = strlen(param_1);
for (local_10 = 0; local_10 < (int)sVar1; local_10 = local_10 + 1) {
if ((local_10 == param_1[local_10] + -0x41) || (local_10 == param_1[local_10] + -0x61)) {
local_14 = local_14 + 1;
}
}
return local_14;
} |
4,553 | func0 |
#include <assert.h>
#include <string.h>
| int func0(const char *str1) {
int count_chars = 0;
int length = strlen(str1);
for (int i = 0; i < length; i++) {
if ((i == (str1[i] - 'A')) || (i == (str1[i] - 'a'))) {
count_chars += 1;
}
}
return count_chars;
}
| int main() {
assert(func0("xbcefg") == 2);
assert(func0("ABcED") == 3);
assert(func0("AbgdeF") == 5);
return 0;
}
| O1 | c | func0:
endbr64
mov %rdi,%rsi
mov $0xffffffffffffffff,%rcx
mov $0x0,%eax
repnz scas %es:(%rdi),%al
not %rcx
sub $0x1,%rcx
test %ecx,%ecx
jle 119c <func0+0x53>
lea -0x1(%rcx),%r8d
mov $0x0,%eax
mov $0x0,%edi
jmp 1188 <func0+0x3f>
add $0x1,%edi
lea 0x1(%rax),%rdx
cmp %r8,%rax
je 11a1 <func0+0x58>
mov %rdx,%rax
movsbl (%rsi,%rax,1),%edx
lea -0x41(%rdx),%ecx
cmp %eax,%ecx
je 1179 <func0+0x30>
sub $0x61,%edx
cmp %eax,%edx
jne 117c <func0+0x33>
jmp 1179 <func0+0x30>
mov $0x0,%edi
mov %edi,%eax
retq
| func0:
endbr64
push rbx
mov rbx, rdi
call _strlen
test eax, eax
jle short loc_11AC
lea edi, [rax-1]
mov eax, 0
mov esi, 0
jmp short loc_1198
loc_1189:
add esi, 1
loc_118C:
lea rdx, [rax+1]
cmp rax, rdi
jz short loc_11B1
mov rax, rdx
loc_1198:
movsx edx, byte ptr [rbx+rax]
lea ecx, [rdx-41h]
cmp ecx, eax
jz short loc_1189
sub edx, 61h ; 'a'
cmp edx, eax
jnz short loc_118C
jmp short loc_1189
loc_11AC:
mov esi, 0
loc_11B1:
mov eax, esi
pop rbx
retn | long long func0(long long a1)
{
int v2; // eax
long long v3; // rdi
long long v4; // rax
unsigned int v5; // esi
int v6; // edx
v2 = strlen();
if ( v2 <= 0 )
{
return 0;
}
else
{
v3 = (unsigned int)(v2 - 1);
v4 = 0LL;
v5 = 0;
while ( 1 )
{
v6 = *(char *)(a1 + v4);
if ( v6 - 65 == (_DWORD)v4 || v6 - 97 == (_DWORD)v4 )
++v5;
if ( v4 == v3 )
break;
++v4;
}
}
return v5;
} | func0:
ENDBR64
PUSH RBX
MOV RBX,RDI
CALL 0x00101060
TEST EAX,EAX
JLE 0x001011ac
LEA EDI,[RAX + -0x1]
MOV EAX,0x0
MOV ESI,0x0
JMP 0x00101198
LAB_00101189:
ADD ESI,0x1
LAB_0010118c:
LEA RDX,[RAX + 0x1]
CMP RAX,RDI
JZ 0x001011b1
MOV RAX,RDX
LAB_00101198:
MOVSX EDX,byte ptr [RBX + RAX*0x1]
LEA ECX,[RDX + -0x41]
CMP ECX,EAX
JZ 0x00101189
SUB EDX,0x61
CMP EDX,EAX
JNZ 0x0010118c
JMP 0x00101189
LAB_001011ac:
MOV ESI,0x0
LAB_001011b1:
MOV EAX,ESI
POP RBX
RET | int func0(char *param_1)
{
size_t sVar1;
ulong uVar2;
int iVar3;
bool bVar4;
sVar1 = strlen(param_1);
if ((int)sVar1 < 1) {
iVar3 = 0;
}
else {
iVar3 = 0;
uVar2 = 0;
do {
if ((param_1[uVar2] + -0x41 == (int)uVar2) || (param_1[uVar2] + -0x61 == (int)uVar2)) {
iVar3 = iVar3 + 1;
}
bVar4 = uVar2 != (int)sVar1 - 1;
uVar2 = uVar2 + 1;
} while (bVar4);
}
return iVar3;
} |
4,554 | func0 |
#include <assert.h>
#include <string.h>
| int func0(const char *str1) {
int count_chars = 0;
int length = strlen(str1);
for (int i = 0; i < length; i++) {
if ((i == (str1[i] - 'A')) || (i == (str1[i] - 'a'))) {
count_chars += 1;
}
}
return count_chars;
}
| int main() {
assert(func0("xbcefg") == 2);
assert(func0("ABcED") == 3);
assert(func0("AbgdeF") == 5);
return 0;
}
| O2 | c | func0:
endbr64
push %rbx
mov %rdi,%rbx
callq 1060 <strlen@plt>
test %eax,%eax
jle 1260 <func0+0x50>
lea -0x1(%rax),%esi
xor %r8d,%r8d
xor %eax,%eax
jmp 1243 <func0+0x33>
nopl 0x0(%rax,%rax,1)
sub $0x61,%edx
cmp %eax,%edx
je 124e <func0+0x3e>
lea 0x1(%rax),%rdx
cmp %rsi,%rax
je 125b <func0+0x4b>
mov %rdx,%rax
movsbl (%rbx,%rax,1),%edx
lea -0x41(%rdx),%ecx
cmp %eax,%ecx
jne 1230 <func0+0x20>
add $0x1,%r8d
lea 0x1(%rax),%rdx
cmp %rsi,%rax
jne 1240 <func0+0x30>
mov %r8d,%eax
pop %rbx
retq
xor %r8d,%r8d
pop %rbx
mov %r8d,%eax
retq
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
push rbx
mov rbx, rdi
call _strlen
test eax, eax
jle short loc_1260
lea esi, [rax-1]
xor r8d, r8d
xor eax, eax
jmp short loc_1243
loc_1230:
sub edx, 61h ; 'a'
cmp edx, eax
jz short loc_124E
lea rdx, [rax+1]
cmp rax, rsi
jz short loc_125B
loc_1240:
mov rax, rdx
loc_1243:
movsx edx, byte ptr [rbx+rax]
lea ecx, [rdx-41h]
cmp ecx, eax
jnz short loc_1230
loc_124E:
add r8d, 1
lea rdx, [rax+1]
cmp rax, rsi
jnz short loc_1240
loc_125B:
mov eax, r8d
pop rbx
retn
loc_1260:
xor r8d, r8d
pop rbx
mov eax, r8d
retn | long long func0(long long a1)
{
int v1; // eax
long long v2; // rsi
unsigned int v3; // r8d
long long i; // rax
long long v5; // rdx
int v6; // edx
v1 = strlen();
if ( v1 > 0 )
{
v2 = (unsigned int)(v1 - 1);
v3 = 0;
for ( i = 0LL; ; i = v5 )
{
v6 = *(char *)(a1 + i);
if ( v6 - 65 == (_DWORD)i || v6 - 97 == (_DWORD)i )
{
++v3;
v5 = i + 1;
if ( i == v2 )
return v3;
}
else
{
v5 = i + 1;
if ( i == v2 )
return v3;
}
}
}
return 0LL;
} | func0:
ENDBR64
PUSH RBX
MOV RBX,RDI
CALL 0x00101060
TEST EAX,EAX
JLE 0x00101260
LEA ESI,[RAX + -0x1]
XOR R8D,R8D
XOR EAX,EAX
JMP 0x00101243
LAB_00101230:
SUB EDX,0x61
CMP EDX,EAX
JZ 0x0010124e
LEA RDX,[RAX + 0x1]
CMP RAX,RSI
JZ 0x0010125b
LAB_00101240:
MOV RAX,RDX
LAB_00101243:
MOVSX EDX,byte ptr [RBX + RAX*0x1]
LEA ECX,[RDX + -0x41]
CMP ECX,EAX
JNZ 0x00101230
LAB_0010124e:
ADD R8D,0x1
LEA RDX,[RAX + 0x1]
CMP RAX,RSI
JNZ 0x00101240
LAB_0010125b:
MOV EAX,R8D
POP RBX
RET
LAB_00101260:
XOR R8D,R8D
POP RBX
MOV EAX,R8D
RET | int func0(char *param_1)
{
size_t sVar1;
ulong uVar2;
int iVar3;
sVar1 = strlen(param_1);
if ((int)sVar1 < 1) {
return 0;
}
iVar3 = 0;
uVar2 = 0;
while( true ) {
if ((param_1[uVar2] + -0x41 == (int)uVar2) || (param_1[uVar2] + -0x61 == (int)uVar2)) {
iVar3 = iVar3 + 1;
}
if (uVar2 == (int)sVar1 - 1) break;
uVar2 = uVar2 + 1;
}
return iVar3;
} |
4,555 | func0 |
#include <assert.h>
#include <string.h>
| int func0(const char *str1) {
int count_chars = 0;
int length = strlen(str1);
for (int i = 0; i < length; i++) {
if ((i == (str1[i] - 'A')) || (i == (str1[i] - 'a'))) {
count_chars += 1;
}
}
return count_chars;
}
| int main() {
assert(func0("xbcefg") == 2);
assert(func0("ABcED") == 3);
assert(func0("AbgdeF") == 5);
return 0;
}
| O3 | c | func0:
endbr64
push %rbx
mov %rdi,%rbx
sub $0x10,%rsp
callq 1060 <strlen@plt>
test %eax,%eax
jle 1420 <func0+0x210>
mov %rax,%rdi
mov %eax,%esi
lea -0x1(%rax),%eax
cmp $0xe,%eax
jbe 142c <func0+0x21c>
movdqa 0xe5e(%rip),%xmm2
mov %edi,%ecx
mov %rbx,%rdx
movdqa 0xea0(%rip),%xmm11
movdqa 0xea7(%rip),%xmm10
shr $0x4,%ecx
shl $0x4,%rcx
movaps %xmm2,(%rsp)
pxor %xmm2,%xmm2
add %rbx,%rcx
movdqa %xmm2,%xmm9
movdqu (%rdx),%xmm0
pxor %xmm3,%xmm3
movdqa (%rsp),%xmm6
pxor %xmm12,%xmm12
movdqa %xmm11,%xmm15
movdqa %xmm11,%xmm14
movdqa %xmm11,%xmm13
movdqa 0xe26(%rip),%xmm8
pcmpgtb %xmm0,%xmm3
movdqa %xmm0,%xmm1
movdqa %xmm6,%xmm5
add $0x10,%rdx
paddd 0xdfe(%rip),%xmm6
movdqa 0xe16(%rip),%xmm7
paddd %xmm5,%xmm8
punpcklbw %xmm3,%xmm1
punpckhbw %xmm3,%xmm0
pxor %xmm3,%xmm3
movaps %xmm6,(%rsp)
pcmpgtw %xmm1,%xmm3
movdqa %xmm1,%xmm4
paddd %xmm5,%xmm7
movdqa 0xdfd(%rip),%xmm6
pcmpgtw %xmm0,%xmm12
paddd %xmm5,%xmm6
punpcklwd %xmm3,%xmm4
punpckhwd %xmm3,%xmm1
movdqa %xmm0,%xmm3
paddd %xmm4,%xmm15
paddd %xmm10,%xmm4
punpcklwd %xmm12,%xmm3
paddd %xmm1,%xmm14
pcmpeqd %xmm5,%xmm4
paddd %xmm10,%xmm1
pcmpeqd %xmm15,%xmm5
punpckhwd %xmm12,%xmm0
paddd %xmm3,%xmm13
pcmpeqd %xmm8,%xmm1
movdqa %xmm11,%xmm12
paddd %xmm10,%xmm3
pcmpeqd %xmm14,%xmm8
pcmpeqd %xmm7,%xmm3
paddd %xmm0,%xmm12
pcmpeqd %xmm13,%xmm7
paddd %xmm10,%xmm0
movdqa %xmm5,%xmm15
pcmpeqd %xmm6,%xmm0
pcmpeqd %xmm12,%xmm6
movdqa %xmm8,%xmm14
pcmpeqd %xmm9,%xmm15
movdqa %xmm7,%xmm13
pcmpeqd %xmm9,%xmm14
movdqa %xmm6,%xmm12
pcmpeqd %xmm9,%xmm13
pcmpeqd %xmm9,%xmm12
pand %xmm15,%xmm4
por %xmm4,%xmm5
pand %xmm14,%xmm1
psubd %xmm5,%xmm2
por %xmm1,%xmm8
pand %xmm13,%xmm3
psubd %xmm8,%xmm2
por %xmm3,%xmm7
pand %xmm12,%xmm0
psubd %xmm7,%xmm2
por %xmm0,%xmm6
psubd %xmm6,%xmm2
cmp %rcx,%rdx
jne 1270 <func0+0x60>
movdqa %xmm2,%xmm0
mov %edi,%eax
psrldq $0x8,%xmm0
and $0xfffffff0,%eax
and $0xf,%edi
paddd %xmm0,%xmm2
movdqa %xmm2,%xmm0
psrldq $0x4,%xmm0
paddd %xmm0,%xmm2
movd %xmm2,%r8d
je 1416 <func0+0x206>
cltq
jmp 13ff <func0+0x1ef>
nopl 0x0(%rax,%rax,1)
sub $0x61,%edx
cmp %edx,%eax
je 140a <func0+0x1fa>
add $0x1,%rax
cmp %eax,%esi
jle 1416 <func0+0x206>
movsbl (%rbx,%rax,1),%edx
lea -0x41(%rdx),%ecx
cmp %ecx,%eax
jne 13f0 <func0+0x1e0>
add $0x1,%rax
add $0x1,%r8d
cmp %eax,%esi
jg 13ff <func0+0x1ef>
add $0x10,%rsp
mov %r8d,%eax
pop %rbx
retq
xor %r8d,%r8d
add $0x10,%rsp
mov %r8d,%eax
pop %rbx
retq
xor %eax,%eax
xor %r8d,%r8d
jmp 13e4 <func0+0x1d4>
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
push rbx
mov rbx, rdi
call _strlen
test eax, eax
jle loc_16F0
mov rcx, rax
lea eax, [rax-1]
cmp eax, 0Eh
jbe loc_16F4
mov edx, ecx
pxor xmm2, xmm2
pxor xmm15, xmm15
mov rax, rbx
shr edx, 4
movdqa xmm5, xmm2
movdqa xmm11, cs:xmmword_2080
movdqa xmm10, cs:xmmword_20D0
shl rdx, 4
movdqa xmm4, xmm2
movdqa xmm9, cs:xmmword_20E0
movdqa xmm8, cs:xmmword_20F0
add rdx, rbx
nop dword ptr [rax+rax+00000000h]
loc_1280:
movdqu xmm0, xmmword ptr [rax]
pxor xmm2, xmm2
movdqa xmm14, xmm15
movdqa xmm3, cs:xmmword_20A0
movdqa xmm7, xmm11
add rax, 10h
movdqa xmm12, cs:xmmword_20B0
movdqa xmm13, cs:xmmword_20C0
pcmpgtb xmm2, xmm0
movdqa xmm1, xmm0
paddd xmm3, xmm7
paddd xmm12, xmm7
paddd xmm13, xmm7
paddd xmm11, cs:xmmword_2090
punpcklbw xmm1, xmm2
punpckhbw xmm0, xmm2
movdqa xmm2, xmm15
pcmpgtw xmm2, xmm1
pcmpgtw xmm14, xmm0
movdqa xmm6, xmm1
punpcklwd xmm6, xmm2
punpckhwd xmm1, xmm2
movdqa xmm2, xmm0
punpcklwd xmm2, xmm14
punpckhwd xmm0, xmm14
movdqa xmm14, xmm10
paddd xmm14, xmm1
paddd xmm1, xmm9
pcmpeqd xmm14, xmm3
pcmpeqd xmm3, xmm1
pcmpeqd xmm14, xmm5
pcmpeqd xmm3, xmm5
movdqa xmm1, xmm14
pand xmm1, xmm3
movdqa xmm3, xmm10
paddd xmm3, xmm2
paddd xmm2, xmm9
pandn xmm1, xmm8
pcmpeqd xmm3, xmm12
pcmpeqd xmm2, xmm12
movdqa xmm12, xmm10
paddd xmm12, xmm0
pcmpeqd xmm12, xmm13
pcmpeqd xmm2, xmm5
pcmpeqd xmm3, xmm5
pcmpeqd xmm12, xmm5
pand xmm3, xmm2
movdqa xmm2, xmm0
paddd xmm2, xmm9
pandn xmm3, xmm8
pcmpeqd xmm2, xmm13
movdqa xmm0, xmm12
pcmpeqd xmm2, xmm5
pand xmm0, xmm2
movdqa xmm2, xmm10
paddd xmm2, xmm6
paddd xmm6, xmm9
pandn xmm0, xmm8
pcmpeqd xmm2, xmm7
pcmpeqd xmm6, xmm7
pcmpeqd xmm2, xmm5
pcmpeqd xmm6, xmm5
pand xmm2, xmm6
pandn xmm2, xmm8
paddd xmm2, xmm4
movdqa xmm4, xmm0
paddd xmm1, xmm2
paddd xmm3, xmm1
paddd xmm4, xmm3
cmp rdx, rax
jnz loc_1280
movdqa xmm0, xmm4
movdqa xmm2, xmm4
movdqa xmm5, xmm4
mov edi, ecx
psrldq xmm0, 8
and edi, 0FFFFFFF0h
psrldq xmm2, 8
paddd xmm0, xmm4
paddd xmm5, xmm2
mov edx, edi
movdqa xmm1, xmm0
psrldq xmm1, 4
paddd xmm0, xmm1
movd eax, xmm0
test cl, 0Fh
jz loc_168D
loc_140E:
mov esi, ecx
sub esi, edi
lea r8d, [rsi-1]
cmp r8d, 6
jbe loc_1596
lea eax, [rdx+1]
pxor xmm1, xmm1
movd xmm9, edx
movq xmm13, cs:qword_2100
movd xmm4, eax
mov eax, edi
pxor xmm7, xmm7
movq xmm11, cs:qword_2108
movq xmm2, qword ptr [rbx+rax]
punpckldq xmm9, xmm4
movq xmm4, qword ptr cs:xmmword_20E0
paddd xmm13, xmm9
paddd xmm11, xmm9
movq xmm12, qword ptr cs:xmmword_20A0
pcmpgtb xmm1, xmm2
movdqa xmm0, xmm2
paddd xmm12, xmm9
punpcklbw xmm2, xmm1
punpcklbw xmm0, xmm1
pxor xmm1, xmm1
pshufd xmm2, xmm2, 4Eh ; 'N'
movdqa xmm3, xmm1
movdqa xmm10, xmm0
pcmpgtw xmm1, xmm2
pcmpgtw xmm3, xmm0
movdqa xmm8, xmm2
punpcklwd xmm8, xmm1
punpcklwd xmm2, xmm1
punpcklwd xmm0, xmm3
movq xmm1, qword ptr cs:xmmword_20D0
pshufd xmm0, xmm0, 4Eh ; 'N'
pshufd xmm2, xmm2, 4Eh ; 'N'
punpcklwd xmm10, xmm3
movdqa xmm6, xmm1
movdqa xmm3, xmm1
paddd xmm6, xmm0
paddd xmm0, xmm4
paddd xmm3, xmm8
paddd xmm8, xmm4
pcmpeqd xmm6, xmm13
pcmpeqd xmm0, xmm13
pcmpeqd xmm3, xmm12
pcmpeqd xmm8, xmm12
pcmpeqd xmm0, xmm7
pcmpeqd xmm6, xmm7
pcmpeqd xmm3, xmm7
pcmpeqd xmm8, xmm7
pand xmm6, xmm0
movdqa xmm0, xmm1
paddd xmm1, xmm10
paddd xmm0, xmm2
paddd xmm2, xmm4
pand xmm3, xmm8
paddd xmm4, xmm10
pcmpeqd xmm1, xmm9
pcmpeqd xmm0, xmm11
pcmpeqd xmm2, xmm11
pcmpeqd xmm4, xmm9
pcmpeqd xmm1, xmm7
pcmpeqd xmm2, xmm7
pcmpeqd xmm0, xmm7
pcmpeqd xmm4, xmm7
pand xmm0, xmm2
movq xmm2, qword ptr cs:xmmword_20F0
pand xmm1, xmm4
pandn xmm1, xmm2
pandn xmm6, xmm2
pandn xmm3, xmm2
paddd xmm5, xmm1
pandn xmm0, xmm2
paddd xmm6, xmm5
paddd xmm3, xmm6
paddd xmm0, xmm3
movd edi, xmm0
pshufd xmm7, xmm0, 0E5h
movd eax, xmm7
add eax, edi
mov edi, esi
and edi, 0FFFFFFF8h
add edx, edi
and esi, 7
jz loc_168D
loc_1596:
movsxd rsi, edx
movsx esi, byte ptr [rbx+rsi]
lea edi, [rsi-41h]
cmp edi, edx
jz loc_1690
sub esi, 61h ; 'a'
cmp esi, edx
jz loc_1690
loc_15B3:
lea esi, [rdx+1]
cmp esi, ecx
jge loc_168D
movsxd rdi, esi
movsx edi, byte ptr [rbx+rdi]
lea r8d, [rdi-41h]
cmp esi, r8d
jz loc_16B0
sub edi, 61h ; 'a'
cmp esi, edi
jz loc_16B0
loc_15DD:
lea esi, [rdx+2]
cmp ecx, esi
jle loc_168D
movsxd rdi, esi
movsx edi, byte ptr [rbx+rdi]
lea r8d, [rdi-41h]
cmp esi, r8d
jz loc_16C0
sub edi, 61h ; 'a'
cmp esi, edi
jz loc_16C0
loc_1607:
lea esi, [rdx+3]
cmp ecx, esi
jle short loc_168D
movsxd rdi, esi
movsx edi, byte ptr [rbx+rdi]
lea r8d, [rdi-41h]
cmp r8d, esi
jz loc_16D0
sub edi, 61h ; 'a'
cmp edi, esi
jz loc_16D0
loc_162D:
lea esi, [rdx+4]
cmp ecx, esi
jle short loc_168D
movsxd rdi, esi
movsx edi, byte ptr [rbx+rdi]
lea r8d, [rdi-41h]
cmp esi, r8d
jz loc_16E0
sub edi, 61h ; 'a'
cmp esi, edi
jz loc_16E0
loc_1653:
lea esi, [rdx+5]
cmp ecx, esi
jle short loc_168D
movsxd rdi, esi
movsx edi, byte ptr [rbx+rdi]
lea r8d, [rdi-41h]
cmp r8d, esi
jz short loc_16A0
sub edi, 61h ; 'a'
cmp esi, edi
jz short loc_16A0
loc_1671:
add edx, 6
cmp ecx, edx
jle short loc_168D
movsxd rcx, edx
movsx ecx, byte ptr [rbx+rcx]
lea esi, [rcx-41h]
cmp esi, edx
jz short loc_16A8
sub ecx, 61h ; 'a'
cmp ecx, edx
jz short loc_16A8
loc_168D:
pop rbx
retn
loc_1690:
add eax, 1
jmp loc_15B3
loc_16A0:
add eax, 1
jmp short loc_1671
loc_16A8:
add eax, 1
pop rbx
retn
loc_16B0:
add eax, 1
jmp loc_15DD
loc_16C0:
add eax, 1
jmp loc_1607
loc_16D0:
add eax, 1
jmp loc_162D
loc_16E0:
add eax, 1
jmp loc_1653
loc_16F0:
xor eax, eax
pop rbx
retn
loc_16F4:
pxor xmm5, xmm5
xor edi, edi
xor edx, edx
xor eax, eax
jmp loc_140E | long long func0(const char *a1)
{
int v2; // eax
int v3; // ecx
const __m128i *v4; // rax
__m128i si128; // xmm11
__m128i v6; // xmm10
__m128i v7; // xmm4
__m128i v8; // xmm9
__m128i v9; // xmm8
__m128i v10; // xmm0
__m128i v11; // xmm7
__m128i v12; // xmm2
__m128i v13; // xmm3
__m128i v14; // xmm12
__m128i v15; // xmm13
__m128i v16; // xmm1
__m128i v17; // xmm0
__m128i v18; // xmm2
__m128i v19; // xmm14
__m128i v20; // xmm6
__m128i v21; // xmm1
__m128i v22; // xmm2
__m128i v23; // xmm0
unsigned int v24; // edi
__m128i v25; // xmm0
__m128i v26; // xmm5
signed int v27; // edx
long long result; // rax
unsigned int v29; // esi
__m128i v30; // xmm2
__m128i v31; // xmm9
__m128i v32; // xmm4
__m128i v33; // xmm13
__m128i v34; // xmm11
__m128i v35; // xmm1
__m128i v36; // xmm0
__m128i v37; // xmm12
__m128i v38; // xmm2
__m128i v39; // xmm10
__m128i v40; // xmm3
__m128i v41; // xmm8
__m128i v42; // xmm1
__m128i v43; // xmm0
__m128i v44; // xmm2
__m128i v45; // xmm10
__m128i v46; // xmm6
__m128i v47; // xmm0
__m128i v48; // xmm2
__m128i v49; // xmm0
int v50; // esi
int v51; // esi
int v52; // edi
int v53; // esi
int v54; // edi
int v55; // esi
int v56; // edi
int v57; // esi
int v58; // edi
int v59; // esi
int v60; // edi
int v61; // edx
int v62; // ecx
v2 = strlen(a1);
if ( v2 <= 0 )
return 0LL;
v3 = v2;
if ( (unsigned int)(v2 - 1) <= 0xE )
{
v26 = 0LL;
v24 = 0;
v27 = 0;
result = 0LL;
}
else
{
v4 = (const __m128i *)a1;
si128 = _mm_load_si128((const __m128i *)&xmmword_2080);
v6 = _mm_load_si128((const __m128i *)&xmmword_20D0);
v7 = 0LL;
v8 = _mm_load_si128((const __m128i *)&xmmword_20E0);
v9 = _mm_load_si128((const __m128i *)&xmmword_20F0);
do
{
v10 = _mm_loadu_si128(v4);
v11 = si128;
++v4;
v12 = _mm_cmpgt_epi8((__m128i)0LL, v10);
v13 = _mm_add_epi32(_mm_load_si128((const __m128i *)&xmmword_20A0), si128);
v14 = _mm_add_epi32(_mm_load_si128((const __m128i *)&xmmword_20B0), si128);
v15 = _mm_add_epi32(_mm_load_si128((const __m128i *)&xmmword_20C0), si128);
si128 = _mm_add_epi32(si128, (__m128i)xmmword_2090);
v16 = _mm_unpacklo_epi8(v10, v12);
v17 = _mm_unpackhi_epi8(v10, v12);
v18 = _mm_cmpgt_epi16((__m128i)0LL, v16);
v19 = _mm_cmpgt_epi16((__m128i)0LL, v17);
v20 = _mm_unpacklo_epi16(v16, v18);
v21 = _mm_unpackhi_epi16(v16, v18);
v22 = _mm_unpacklo_epi16(v17, v19);
v23 = _mm_unpackhi_epi16(v17, v19);
v7 = _mm_add_epi32(
_mm_andnot_si128(
_mm_and_si128(
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v6, v23), v15), (__m128i)0LL),
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v23, v8), v15), (__m128i)0LL)),
v9),
_mm_add_epi32(
_mm_andnot_si128(
_mm_and_si128(
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v6, v22), v14), (__m128i)0LL),
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v22, v8), v14), (__m128i)0LL)),
v9),
_mm_add_epi32(
_mm_andnot_si128(
_mm_and_si128(
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v6, v21), v13), (__m128i)0LL),
_mm_cmpeq_epi32(_mm_cmpeq_epi32(v13, _mm_add_epi32(v21, v8)), (__m128i)0LL)),
v9),
_mm_add_epi32(
_mm_andnot_si128(
_mm_and_si128(
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v6, v20), v11), (__m128i)0LL),
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v20, v8), v11), (__m128i)0LL)),
v9),
v7))));
}
while ( &a1[16 * ((unsigned int)v3 >> 4)] != (const char *)v4 );
v24 = v3 & 0x7FFFFFF0;
v25 = _mm_add_epi32(_mm_srli_si128(v7, 8), v7);
v26 = _mm_add_epi32(v7, _mm_srli_si128(v7, 8));
v27 = v3 & 0xFFFFFFF0;
result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v25, _mm_srli_si128(v25, 4)));
if ( (v3 & 0xF) == 0 )
return result;
}
v29 = v3 - v24;
if ( v3 - v24 - 1 <= 6 )
goto LABEL_8;
v30 = _mm_loadl_epi64((const __m128i *)&a1[v24]);
v31 = _mm_unpacklo_epi32(_mm_cvtsi32_si128(v27), _mm_cvtsi32_si128(v27 + 1));
v32 = _mm_loadl_epi64((const __m128i *)&xmmword_20E0);
v33 = _mm_add_epi32(_mm_loadl_epi64((const __m128i *)&qword_2100), v31);
v34 = _mm_add_epi32(_mm_loadl_epi64((const __m128i *)&qword_2108), v31);
v35 = _mm_cmpgt_epi8((__m128i)0LL, v30);
v36 = v30;
v37 = _mm_add_epi32(_mm_loadl_epi64((const __m128i *)&xmmword_20A0), v31);
v38 = _mm_shuffle_epi32(_mm_unpacklo_epi8(v30, v35), 78);
v39 = _mm_unpacklo_epi8(v36, v35);
v40 = _mm_cmpgt_epi16((__m128i)0LL, v39);
v41 = _mm_unpacklo_epi16(v38, _mm_cmpgt_epi16((__m128i)0LL, v38));
v42 = _mm_loadl_epi64((const __m128i *)&xmmword_20D0);
v43 = _mm_shuffle_epi32(_mm_unpacklo_epi16(v39, v40), 78);
v44 = _mm_shuffle_epi32(v41, 78);
v45 = _mm_unpacklo_epi16(v39, v40);
v46 = _mm_and_si128(
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v42, v43), v33), (__m128i)0LL),
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v43, v32), v33), (__m128i)0LL));
v47 = _mm_and_si128(
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v42, v44), v34), (__m128i)0LL),
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v44, v32), v34), (__m128i)0LL));
v48 = _mm_loadl_epi64((const __m128i *)&xmmword_20F0);
v49 = _mm_add_epi32(
_mm_andnot_si128(v47, v48),
_mm_add_epi32(
_mm_andnot_si128(
_mm_and_si128(
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v42, v41), v37), (__m128i)0LL),
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v41, v32), v37), (__m128i)0LL)),
v48),
_mm_add_epi32(
_mm_andnot_si128(v46, v48),
_mm_add_epi32(
v26,
_mm_andnot_si128(
_mm_and_si128(
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v42, v45), v31), (__m128i)0LL),
_mm_cmpeq_epi32(_mm_cmpeq_epi32(_mm_add_epi32(v32, v45), v31), (__m128i)0LL)),
v48)))));
result = (unsigned int)(_mm_cvtsi128_si32(v49) + _mm_cvtsi128_si32(_mm_shuffle_epi32(v49, 229)));
v27 += v29 & 0xFFFFFFF8;
if ( (v29 & 7) != 0 )
{
LABEL_8:
v50 = a1[v27];
if ( v50 - 65 == v27 || v50 - 97 == v27 )
result = (unsigned int)(result + 1);
v51 = v27 + 1;
if ( v27 + 1 < v3 )
{
v52 = a1[v51];
if ( v51 == v52 - 65 || v51 == v52 - 97 )
result = (unsigned int)(result + 1);
v53 = v27 + 2;
if ( v3 > v27 + 2 )
{
v54 = a1[v53];
if ( v53 == v54 - 65 || v53 == v54 - 97 )
result = (unsigned int)(result + 1);
v55 = v27 + 3;
if ( v3 > v27 + 3 )
{
v56 = a1[v55];
if ( v56 - 65 == v55 || v56 - 97 == v55 )
result = (unsigned int)(result + 1);
v57 = v27 + 4;
if ( v3 > v27 + 4 )
{
v58 = a1[v57];
if ( v57 == v58 - 65 || v57 == v58 - 97 )
result = (unsigned int)(result + 1);
v59 = v27 + 5;
if ( v3 > v27 + 5 )
{
v60 = a1[v59];
if ( v60 - 65 == v59 || v59 == v60 - 97 )
result = (unsigned int)(result + 1);
v61 = v27 + 6;
if ( v3 > v61 )
{
v62 = a1[v61];
if ( v62 - 65 == v61 || v62 - 97 == v61 )
return (unsigned int)(result + 1);
}
}
}
}
}
}
}
return result;
} | func0:
ENDBR64
PUSH RBX
MOV RBX,RDI
CALL 0x00101060
TEST EAX,EAX
JLE 0x001016f0
MOV RCX,RAX
LEA EAX,[RAX + -0x1]
CMP EAX,0xe
JBE 0x001016f4
MOV EDX,ECX
PXOR XMM2,XMM2
PXOR XMM15,XMM15
MOV RAX,RBX
SHR EDX,0x4
MOVDQA XMM5,XMM2
MOVDQA XMM11,xmmword ptr [0x00102080]
MOVDQA XMM10,xmmword ptr [0x001020d0]
SHL RDX,0x4
MOVDQA XMM4,XMM2
MOVDQA XMM9,xmmword ptr [0x001020e0]
MOVDQA XMM8,xmmword ptr [0x001020f0]
ADD RDX,RBX
NOP dword ptr [RAX + RAX*0x1]
LAB_00101280:
MOVDQU XMM0,xmmword ptr [RAX]
PXOR XMM2,XMM2
MOVDQA XMM14,XMM15
MOVDQA XMM3,xmmword ptr [0x001020a0]
MOVDQA XMM7,XMM11
ADD RAX,0x10
MOVDQA XMM12,xmmword ptr [0x001020b0]
MOVDQA XMM13,xmmword ptr [0x001020c0]
PCMPGTB XMM2,XMM0
MOVDQA XMM1,XMM0
PADDD XMM3,XMM7
PADDD XMM12,XMM7
PADDD XMM13,XMM7
PADDD XMM11,xmmword ptr [0x00102090]
PUNPCKLBW XMM1,XMM2
PUNPCKHBW XMM0,XMM2
MOVDQA XMM2,XMM15
PCMPGTW XMM2,XMM1
PCMPGTW XMM14,XMM0
MOVDQA XMM6,XMM1
PUNPCKLWD XMM6,XMM2
PUNPCKHWD XMM1,XMM2
MOVDQA XMM2,XMM0
PUNPCKLWD XMM2,XMM14
PUNPCKHWD XMM0,XMM14
MOVDQA XMM14,XMM10
PADDD XMM14,XMM1
PADDD XMM1,XMM9
PCMPEQD XMM14,XMM3
PCMPEQD XMM3,XMM1
PCMPEQD XMM14,XMM5
PCMPEQD XMM3,XMM5
MOVDQA XMM1,XMM14
PAND XMM1,XMM3
MOVDQA XMM3,XMM10
PADDD XMM3,XMM2
PADDD XMM2,XMM9
PANDN XMM1,XMM8
PCMPEQD XMM3,XMM12
PCMPEQD XMM2,XMM12
MOVDQA XMM12,XMM10
PADDD XMM12,XMM0
PCMPEQD XMM12,XMM13
PCMPEQD XMM2,XMM5
PCMPEQD XMM3,XMM5
PCMPEQD XMM12,XMM5
PAND XMM3,XMM2
MOVDQA XMM2,XMM0
PADDD XMM2,XMM9
PANDN XMM3,XMM8
PCMPEQD XMM2,XMM13
MOVDQA XMM0,XMM12
PCMPEQD XMM2,XMM5
PAND XMM0,XMM2
MOVDQA XMM2,XMM10
PADDD XMM2,XMM6
PADDD XMM6,XMM9
PANDN XMM0,XMM8
PCMPEQD XMM2,XMM7
PCMPEQD XMM6,XMM7
PCMPEQD XMM2,XMM5
PCMPEQD XMM6,XMM5
PAND XMM2,XMM6
PANDN XMM2,XMM8
PADDD XMM2,XMM4
MOVDQA XMM4,XMM0
PADDD XMM1,XMM2
PADDD XMM3,XMM1
PADDD XMM4,XMM3
CMP RDX,RAX
JNZ 0x00101280
MOVDQA XMM0,XMM4
MOVDQA XMM2,XMM4
MOVDQA XMM5,XMM4
MOV EDI,ECX
PSRLDQ XMM0,0x8
AND EDI,0xfffffff0
PSRLDQ XMM2,0x8
PADDD XMM0,XMM4
PADDD XMM5,XMM2
MOV EDX,EDI
MOVDQA XMM1,XMM0
PSRLDQ XMM1,0x4
PADDD XMM0,XMM1
MOVD EAX,XMM0
TEST CL,0xf
JZ 0x0010168d
LAB_0010140e:
MOV ESI,ECX
SUB ESI,EDI
LEA R8D,[RSI + -0x1]
CMP R8D,0x6
JBE 0x00101596
LEA EAX,[RDX + 0x1]
PXOR XMM1,XMM1
MOVD XMM9,EDX
MOVQ XMM13,qword ptr [0x00102100]
MOVD XMM4,EAX
MOV EAX,EDI
PXOR XMM7,XMM7
MOVQ XMM11,qword ptr [0x00102108]
MOVQ XMM2,qword ptr [RBX + RAX*0x1]
PUNPCKLDQ XMM9,XMM4
MOVQ XMM4,qword ptr [0x001020e0]
PADDD XMM13,XMM9
PADDD XMM11,XMM9
MOVQ XMM12,qword ptr [0x001020a0]
PCMPGTB XMM1,XMM2
MOVDQA XMM0,XMM2
PADDD XMM12,XMM9
PUNPCKLBW XMM2,XMM1
PUNPCKLBW XMM0,XMM1
PXOR XMM1,XMM1
PSHUFD XMM2,XMM2,0x4e
MOVDQA XMM3,XMM1
MOVDQA XMM10,XMM0
PCMPGTW XMM1,XMM2
PCMPGTW XMM3,XMM0
MOVDQA XMM8,XMM2
PUNPCKLWD XMM8,XMM1
PUNPCKLWD XMM2,XMM1
PUNPCKLWD XMM0,XMM3
MOVQ XMM1,qword ptr [0x001020d0]
PSHUFD XMM0,XMM0,0x4e
PSHUFD XMM2,XMM2,0x4e
PUNPCKLWD XMM10,XMM3
MOVDQA XMM6,XMM1
MOVDQA XMM3,XMM1
PADDD XMM6,XMM0
PADDD XMM0,XMM4
PADDD XMM3,XMM8
PADDD XMM8,XMM4
PCMPEQD XMM6,XMM13
PCMPEQD XMM0,XMM13
PCMPEQD XMM3,XMM12
PCMPEQD XMM8,XMM12
PCMPEQD XMM0,XMM7
PCMPEQD XMM6,XMM7
PCMPEQD XMM3,XMM7
PCMPEQD XMM8,XMM7
PAND XMM6,XMM0
MOVDQA XMM0,XMM1
PADDD XMM1,XMM10
PADDD XMM0,XMM2
PADDD XMM2,XMM4
PAND XMM3,XMM8
PADDD XMM4,XMM10
PCMPEQD XMM1,XMM9
PCMPEQD XMM0,XMM11
PCMPEQD XMM2,XMM11
PCMPEQD XMM4,XMM9
PCMPEQD XMM1,XMM7
PCMPEQD XMM2,XMM7
PCMPEQD XMM0,XMM7
PCMPEQD XMM4,XMM7
PAND XMM0,XMM2
MOVQ XMM2,qword ptr [0x001020f0]
PAND XMM1,XMM4
PANDN XMM1,XMM2
PANDN XMM6,XMM2
PANDN XMM3,XMM2
PADDD XMM5,XMM1
PANDN XMM0,XMM2
PADDD XMM6,XMM5
PADDD XMM3,XMM6
PADDD XMM0,XMM3
MOVD EDI,XMM0
PSHUFD XMM7,XMM0,0xe5
MOVD EAX,XMM7
ADD EAX,EDI
MOV EDI,ESI
AND EDI,0xfffffff8
ADD EDX,EDI
AND ESI,0x7
JZ 0x0010168d
LAB_00101596:
MOVSXD RSI,EDX
MOVSX ESI,byte ptr [RBX + RSI*0x1]
LEA EDI,[RSI + -0x41]
CMP EDI,EDX
JZ 0x00101690
SUB ESI,0x61
CMP ESI,EDX
JZ 0x00101690
LAB_001015b3:
LEA ESI,[RDX + 0x1]
CMP ESI,ECX
JGE 0x0010168d
MOVSXD RDI,ESI
MOVSX EDI,byte ptr [RBX + RDI*0x1]
LEA R8D,[RDI + -0x41]
CMP ESI,R8D
JZ 0x001016b0
SUB EDI,0x61
CMP ESI,EDI
JZ 0x001016b0
LAB_001015dd:
LEA ESI,[RDX + 0x2]
CMP ECX,ESI
JLE 0x0010168d
MOVSXD RDI,ESI
MOVSX EDI,byte ptr [RBX + RDI*0x1]
LEA R8D,[RDI + -0x41]
CMP ESI,R8D
JZ 0x001016c0
SUB EDI,0x61
CMP ESI,EDI
JZ 0x001016c0
LAB_00101607:
LEA ESI,[RDX + 0x3]
CMP ECX,ESI
JLE 0x0010168d
MOVSXD RDI,ESI
MOVSX EDI,byte ptr [RBX + RDI*0x1]
LEA R8D,[RDI + -0x41]
CMP R8D,ESI
JZ 0x001016d0
SUB EDI,0x61
CMP EDI,ESI
JZ 0x001016d0
LAB_0010162d:
LEA ESI,[RDX + 0x4]
CMP ECX,ESI
JLE 0x0010168d
MOVSXD RDI,ESI
MOVSX EDI,byte ptr [RBX + RDI*0x1]
LEA R8D,[RDI + -0x41]
CMP ESI,R8D
JZ 0x001016e0
SUB EDI,0x61
CMP ESI,EDI
JZ 0x001016e0
LAB_00101653:
LEA ESI,[RDX + 0x5]
CMP ECX,ESI
JLE 0x0010168d
MOVSXD RDI,ESI
MOVSX EDI,byte ptr [RBX + RDI*0x1]
LEA R8D,[RDI + -0x41]
CMP R8D,ESI
JZ 0x001016a0
SUB EDI,0x61
CMP ESI,EDI
JZ 0x001016a0
LAB_00101671:
ADD EDX,0x6
CMP ECX,EDX
JLE 0x0010168d
MOVSXD RCX,EDX
MOVSX ECX,byte ptr [RBX + RCX*0x1]
LEA ESI,[RCX + -0x41]
CMP ESI,EDX
JZ 0x001016a8
SUB ECX,0x61
CMP ECX,EDX
JZ 0x001016a8
LAB_0010168d:
POP RBX
RET
LAB_00101690:
ADD EAX,0x1
JMP 0x001015b3
LAB_001016a0:
ADD EAX,0x1
JMP 0x00101671
LAB_001016a8:
ADD EAX,0x1
POP RBX
RET
LAB_001016b0:
ADD EAX,0x1
JMP 0x001015dd
LAB_001016c0:
ADD EAX,0x1
JMP 0x00101607
LAB_001016d0:
ADD EAX,0x1
JMP 0x0010162d
LAB_001016e0:
ADD EAX,0x1
JMP 0x00101653
LAB_001016f0:
XOR EAX,EAX
POP RBX
RET
LAB_001016f4:
PXOR XMM5,XMM5
XOR EDI,EDI
XOR EDX,EDX
XOR EAX,EAX
JMP 0x0010140e | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
int func0(int (*param_1) [16])
{
ulong uVar1;
int auVar2 [14];
int auVar3 [12];
unkbyte10 Var4;
int auVar5 [12];
int auVar6 [16];
int auVar7 [16];
int auVar8 [16];
int auVar9 [14];
int auVar10 [12];
int auVar11 [12];
uint uVar12;
size_t sVar13;
int (*pauVar14) [16];
uint uVar15;
uint uVar16;
int2 uVar17;
int iVar19;
int iVar20;
short sVar39;
int iVar40;
char cVar42;
char cVar43;
char cVar44;
int auVar28 [16];
short sVar41;
int auVar36 [16];
char cVar45;
int iVar46;
char cVar57;
int iVar58;
int auVar48 [16];
int iVar59;
int auVar60 [12];
char cVar77;
short sVar78;
char cVar79;
char cVar80;
int uVar81;
int auVar66 [16];
int auVar74 [16];
int iVar83;
int iVar84;
int iVar85;
int iVar86;
int iVar87;
int iVar88;
int iVar89;
int iVar93;
int auVar98 [16];
int4 uVar18;
int6 uVar21;
int8 uVar22;
int auVar24 [12];
int auVar29 [16];
int auVar30 [16];
int auVar31 [16];
int auVar32 [16];
int auVar33 [16];
int auVar34 [16];
int auVar35 [16];
int auVar23 [12];
int auVar37 [16];
int auVar25 [14];
int auVar27 [16];
int auVar38 [16];
int auVar26 [16];
int auVar49 [16];
int auVar47 [12];
int auVar50 [16];
int auVar51 [16];
int auVar52 [16];
int auVar53 [16];
int auVar56 [16];
int auVar54 [16];
int auVar55 [16];
int auVar61 [16];
int auVar62 [16];
int auVar63 [16];
int auVar67 [16];
int auVar68 [16];
int auVar69 [16];
int auVar70 [16];
int auVar71 [16];
int auVar72 [16];
int auVar73 [16];
int auVar64 [16];
int auVar75 [16];
int auVar65 [16];
int auVar76 [16];
long lVar82;
int auVar90 [16];
int auVar91 [16];
int auVar92 [16];
int auVar94 [16];
int auVar95 [16];
int auVar96 [16];
int auVar97 [16];
int auVar99 [16];
int auVar100 [16];
sVar13 = strlen((char *)param_1);
uVar12 = (uint)sVar13;
if ((int)uVar12 < 1) {
return 0;
}
if (uVar12 - 1 < 0xf) {
iVar87 = 0;
iVar88 = 0;
uVar16 = 0;
iVar20 = 0;
}
else {
iVar83 = 0;
iVar84 = 0;
iVar85 = 0;
iVar86 = 0;
pauVar14 = param_1;
iVar20 = _DAT_00102080;
iVar87 = _UNK_00102084;
iVar88 = _UNK_00102088;
iVar93 = _UNK_0010208c;
do {
auVar27 = *pauVar14;
pauVar14 = pauVar14 + 1;
cVar45 = auVar27[0];
cVar57 = auVar27[8];
cVar42 = auVar27[9];
cVar43 = auVar27[10];
cVar44 = auVar27[0xb];
auVar55._0_14_ = auVar27._0_14_;
auVar55[0xe] = auVar27[7];
auVar55[0xf] = -(auVar27[7] < '\0');
auVar54._14_2_ = auVar55._14_2_;
auVar54._0_13_ = auVar27._0_13_;
auVar54[0xd] = -(auVar27[6] < '\0');
auVar53._13_3_ = auVar54._13_3_;
auVar53._0_12_ = auVar27._0_12_;
auVar53[0xc] = auVar27[6];
auVar52._12_4_ = auVar53._12_4_;
auVar52._0_11_ = auVar27._0_11_;
auVar52[0xb] = -(auVar27[5] < '\0');
auVar51._11_5_ = auVar52._11_5_;
auVar51._0_10_ = auVar27._0_10_;
auVar51[10] = auVar27[5];
auVar50._10_6_ = auVar51._10_6_;
auVar50._0_9_ = auVar27._0_9_;
auVar50[9] = -(auVar27[4] < '\0');
auVar49._9_7_ = auVar50._9_7_;
auVar49._0_8_ = auVar27._0_8_;
auVar49[8] = auVar27[4];
Var4 = CONCAT91(CONCAT81(auVar49._8_8_,-(auVar27[3] < '\0')),auVar27[3]);
auVar3._2_10_ = Var4;
auVar3[1] = -(auVar27[2] < '\0');
auVar3[0] = auVar27[2];
auVar2._2_12_ = auVar3;
auVar2[1] = -(auVar27[1] < '\0');
auVar2[0] = auVar27[1];
auVar48._0_2_ = CONCAT11(-(cVar45 < '\0'),cVar45);
auVar48._2_14_ = auVar2;
uVar17 = CONCAT11(-(cVar57 < '\0'),cVar57);
uVar18 = CONCAT13(-(cVar42 < '\0'),CONCAT12(cVar42,uVar17));
uVar21 = CONCAT15(-(cVar43 < '\0'),CONCAT14(cVar43,uVar18));
uVar22 = CONCAT17(-(cVar44 < '\0'),CONCAT16(cVar44,uVar21));
auVar23._0_10_ = CONCAT19(-(auVar27[0xc] < '\0'),CONCAT18(auVar27[0xc],uVar22));
auVar23[10] = auVar27[0xd];
auVar23[0xb] = -(auVar27[0xd] < '\0');
auVar25[0xc] = auVar27[0xe];
auVar25._0_12_ = auVar23;
auVar25[0xd] = -(auVar27[0xe] < '\0');
auVar26[0xe] = auVar27[0xf];
auVar26._0_14_ = auVar25;
auVar26[0xf] = -(auVar27[0xf] < '\0');
sVar41 = (short)Var4;
sVar39 = (short)((unkuint10)auVar23._0_10_ >> 0x40);
auVar92._0_12_ = auVar48._0_12_;
auVar92._12_2_ = sVar41;
auVar92._14_2_ = -(ushort)(sVar41 < 0);
auVar91._12_4_ = auVar92._12_4_;
auVar91._0_10_ = auVar48._0_10_;
auVar91._10_2_ = -(ushort)(auVar3._0_2_ < 0);
auVar90._10_6_ = auVar91._10_6_;
auVar90._0_8_ = auVar48._0_8_;
auVar90._8_2_ = auVar3._0_2_;
auVar5._4_8_ = auVar90._8_8_;
auVar5._2_2_ = -(ushort)(auVar2._0_2_ < 0);
auVar5._0_2_ = auVar2._0_2_;
iVar89 = CONCAT22(-(ushort)(cVar45 < '\0'),auVar48._0_2_);
iVar46 = CONCAT22(-(ushort)(auVar49._8_2_ < 0),auVar49._8_2_);
auVar47._0_8_ = CONCAT26(-(ushort)(auVar51._10_2_ < 0),CONCAT24(auVar51._10_2_,iVar46));
auVar47._8_2_ = auVar53._12_2_;
auVar47._10_2_ = -(ushort)(auVar53._12_2_ < 0);
auVar56._12_2_ = auVar54._14_2_;
auVar56._0_12_ = auVar47;
auVar56._14_2_ = -(ushort)(auVar49._8_8_ < 0);
auVar65._12_2_ = (short)((ulong)uVar22 >> 0x30);
auVar65._0_12_ = auVar23;
auVar65._14_2_ = -(ushort)(cVar44 < '\0');
auVar64._12_4_ = auVar65._12_4_;
auVar64._10_2_ = -(ushort)(cVar43 < '\0');
auVar64._0_10_ = auVar23._0_10_;
auVar63._10_6_ = auVar64._10_6_;
auVar63._8_2_ = (short)((uint6)uVar21 >> 0x20);
auVar63._0_8_ = uVar22;
auVar62._8_8_ = auVar63._8_8_;
auVar62._6_2_ = -(ushort)(cVar42 < '\0');
auVar62._0_6_ = uVar21;
auVar61._6_10_ = auVar62._6_10_;
auVar61._4_2_ = (short)((uint)uVar18 >> 0x10);
auVar61._0_4_ = uVar18;
iVar59 = CONCAT22(-(ushort)(cVar57 < '\0'),uVar17);
iVar19 = CONCAT22(-(ushort)(sVar39 < 0),sVar39);
auVar24._0_8_ = CONCAT26(-(ushort)(auVar23._10_2_ < 0),CONCAT24(auVar23._10_2_,iVar19));
auVar24._8_2_ = auVar25._12_2_;
auVar24._10_2_ = -(ushort)(auVar25._12_2_ < 0);
auVar27._12_2_ = auVar26._14_2_;
auVar27._0_12_ = auVar24;
auVar27._14_2_ = -(ushort)(auVar26._14_2_ < 0);
iVar58 = (int)((ulong)auVar47._0_8_ >> 0x20);
iVar40 = (int)((ulong)auVar24._0_8_ >> 0x20);
iVar83 = (~-(uint)((int)DAT_001020d0 + iVar19 != _DAT_001020c0 + iVar20 &&
iVar19 + (int)DAT_001020e0 != _DAT_001020c0 + iVar20) & (uint)DAT_001020f0)
+ (~-(uint)((int)DAT_001020d0 + iVar59 != _DAT_001020b0 + iVar20 &&
iVar59 + (int)DAT_001020e0 != _DAT_001020b0 + iVar20) & (uint)DAT_001020f0
) + (~-(uint)((int)DAT_001020d0 + iVar46 != (int)DAT_001020a0 + iVar20 &&
(int)DAT_001020a0 + iVar20 != iVar46 + (int)DAT_001020e0) &
(uint)DAT_001020f0) +
(~-(uint)((int)DAT_001020d0 + iVar89 != iVar20 &&
iVar89 + (int)DAT_001020e0 != iVar20) & (uint)DAT_001020f0) + iVar83;
iVar84 = (~-(uint)(DAT_001020d0._4_4_ + iVar40 != _UNK_001020c4 + iVar87 &&
iVar40 + DAT_001020e0._4_4_ != _UNK_001020c4 + iVar87) & DAT_001020f0._4_4_)
+ (~-(uint)(DAT_001020d0._4_4_ + auVar61._4_4_ != _UNK_001020b4 + iVar87 &&
auVar61._4_4_ + DAT_001020e0._4_4_ != _UNK_001020b4 + iVar87) &
DAT_001020f0._4_4_) +
(~-(uint)(DAT_001020d0._4_4_ + iVar58 != DAT_001020a0._4_4_ + iVar87 &&
DAT_001020a0._4_4_ + iVar87 != iVar58 + DAT_001020e0._4_4_) &
DAT_001020f0._4_4_) +
(~-(uint)(DAT_001020d0._4_4_ + auVar5._0_4_ != iVar87 &&
auVar5._0_4_ + DAT_001020e0._4_4_ != iVar87) & DAT_001020f0._4_4_) +
iVar84;
iVar85 = (~-(uint)(_UNK_001020d8 + auVar24._8_4_ != _UNK_001020c8 + iVar88 &&
auVar24._8_4_ + _UNK_001020e8 != _UNK_001020c8 + iVar88) & _UNK_001020f8) +
(~-(uint)(_UNK_001020d8 + auVar63._8_4_ != _UNK_001020b8 + iVar88 &&
auVar63._8_4_ + _UNK_001020e8 != _UNK_001020b8 + iVar88) & _UNK_001020f8) +
(~-(uint)(_UNK_001020d8 + auVar47._8_4_ != _UNK_001020a8 + iVar88 &&
_UNK_001020a8 + iVar88 != auVar47._8_4_ + _UNK_001020e8) & _UNK_001020f8) +
(~-(uint)(_UNK_001020d8 + auVar90._8_4_ != iVar88 &&
auVar90._8_4_ + _UNK_001020e8 != iVar88) & _UNK_001020f8) + iVar85;
iVar86 = (~-(uint)(_UNK_001020dc + auVar27._12_4_ != _UNK_001020cc + iVar93 &&
auVar27._12_4_ + _UNK_001020ec != _UNK_001020cc + iVar93) & _UNK_001020fc) +
(~-(uint)(_UNK_001020dc + auVar64._12_4_ != _UNK_001020bc + iVar93 &&
auVar64._12_4_ + _UNK_001020ec != _UNK_001020bc + iVar93) & _UNK_001020fc) +
(~-(uint)(_UNK_001020dc + auVar56._12_4_ != _UNK_001020ac + iVar93 &&
_UNK_001020ac + iVar93 != auVar56._12_4_ + _UNK_001020ec) & _UNK_001020fc) +
(~-(uint)(_UNK_001020dc + auVar91._12_4_ != iVar93 &&
auVar91._12_4_ + _UNK_001020ec != iVar93) & _UNK_001020fc) + iVar86;
iVar20 = iVar20 + _DAT_00102090;
iVar87 = iVar87 + _UNK_00102094;
iVar88 = iVar88 + _UNK_00102098;
iVar93 = iVar93 + _UNK_0010209c;
} while (param_1 + (sVar13 >> 4 & 0xfffffff) != pauVar14);
uVar16 = uVar12 & 0xfffffff0;
iVar87 = iVar83 + iVar85;
iVar88 = iVar84 + iVar86;
iVar20 = iVar85 + iVar83 + iVar86 + iVar84;
if ((sVar13 & 0xf) == 0) {
return iVar20;
}
}
uVar15 = uVar12 - uVar16;
if (6 < uVar15 - 1) {
iVar20 = uVar16 + 1;
uVar1 = *(ulong *)(*param_1 + uVar16);
auVar66[0] = (char)uVar1;
cVar45 = -(auVar66[0] < '\0');
cVar42 = (char)(uVar1 >> 8);
cVar43 = (char)(uVar1 >> 0x10);
cVar44 = (char)(uVar1 >> 0x18);
cVar57 = -(cVar44 < '\0');
cVar77 = (char)(uVar1 >> 0x20);
cVar79 = (char)(uVar1 >> 0x28);
cVar80 = (char)(uVar1 >> 0x30);
uVar81 = (int)(uVar1 >> 0x38);
auVar73._8_6_ = 0;
auVar73._0_8_ = uVar1;
auVar73[0xe] = uVar81;
auVar73[0xf] = -((long)uVar1 < 0);
auVar72._14_2_ = auVar73._14_2_;
auVar72._8_5_ = 0;
auVar72._0_8_ = uVar1;
auVar72[0xd] = -(cVar80 < '\0');
auVar71._13_3_ = auVar72._13_3_;
auVar71._8_4_ = 0;
auVar71._0_8_ = uVar1;
auVar71[0xc] = cVar80;
auVar70._12_4_ = auVar71._12_4_;
auVar70._8_3_ = 0;
auVar70._0_8_ = uVar1;
auVar70[0xb] = -(cVar79 < '\0');
auVar69._11_5_ = auVar70._11_5_;
auVar69._8_2_ = 0;
auVar69._0_8_ = uVar1;
auVar69[10] = cVar79;
auVar68._10_6_ = auVar69._10_6_;
auVar68[8] = 0;
auVar68._0_8_ = uVar1;
auVar68[9] = -(cVar77 < '\0');
auVar67._9_7_ = auVar68._9_7_;
auVar67[8] = cVar77;
auVar67._0_8_ = uVar1;
lVar82 = auVar67._8_8_;
auVar8._1_8_ = lVar82;
auVar8[0] = cVar57;
auVar8._9_7_ = 0;
auVar7._10_6_ = 0;
auVar7._0_10_ = SUB1610(auVar8 << 0x38,6);
auVar6._11_5_ = 0;
auVar6._0_11_ = SUB1611(auVar7 << 0x30,5);
auVar66._4_12_ = SUB1612(auVar6 << 0x28,4);
auVar66[3] = -(cVar42 < '\0');
auVar66[2] = cVar42;
auVar66[1] = cVar45;
auVar35._8_6_ = 0;
auVar35._0_8_ = uVar1;
auVar35[0xe] = uVar81;
auVar35[0xf] = -((long)uVar1 < 0);
auVar34._14_2_ = auVar35._14_2_;
auVar34._8_5_ = 0;
auVar34._0_8_ = uVar1;
auVar34[0xd] = -(cVar80 < '\0');
auVar33._13_3_ = auVar34._13_3_;
auVar33._8_4_ = 0;
auVar33._0_8_ = uVar1;
auVar33[0xc] = cVar80;
auVar32._12_4_ = auVar33._12_4_;
auVar32._8_3_ = 0;
auVar32._0_8_ = uVar1;
auVar32[0xb] = -(cVar79 < '\0');
auVar31._11_5_ = auVar32._11_5_;
auVar31._8_2_ = 0;
auVar31._0_8_ = uVar1;
auVar31[10] = cVar79;
auVar30._10_6_ = auVar31._10_6_;
auVar30[8] = 0;
auVar30._0_8_ = uVar1;
auVar30[9] = -(cVar77 < '\0');
auVar29._9_7_ = auVar30._9_7_;
auVar29[8] = cVar77;
auVar29._0_8_ = uVar1;
Var4 = CONCAT91(CONCAT81(auVar29._8_8_,cVar57),cVar44);
auVar10._2_10_ = Var4;
auVar10[1] = -(cVar43 < '\0');
auVar10[0] = cVar43;
auVar9._2_12_ = auVar10;
auVar9[1] = -(cVar42 < '\0');
auVar9[0] = cVar42;
auVar28._0_2_ = CONCAT11(cVar45,auVar66[0]);
auVar28._2_14_ = auVar9;
auVar60._8_4_ = auVar66._0_4_;
auVar60._0_8_ = lVar82;
sVar78 = auVar71._12_2_;
sVar39 = auVar10._0_2_;
sVar41 = (short)Var4;
auVar97._12_2_ = auVar72._14_2_;
auVar97._0_12_ = auVar60;
auVar97._14_2_ = -(ushort)(lVar82 < 0);
auVar96._12_4_ = auVar97._12_4_;
auVar96._0_10_ = auVar60._0_10_;
auVar96._10_2_ = -(ushort)(sVar78 < 0);
auVar95._10_6_ = auVar96._10_6_;
auVar95._8_2_ = sVar78;
auVar95._0_8_ = lVar82;
auVar94._8_8_ = auVar95._8_8_;
auVar94._6_2_ = -(ushort)(auVar67._8_4_ < 0);
auVar94._4_2_ = auVar69._10_2_;
auVar94._0_4_ = auVar67._8_4_;
iVar93 = CONCAT22(-(ushort)(auVar67._8_2_ < 0),auVar67._8_2_);
auVar76._12_2_ = auVar72._14_2_;
auVar76._0_12_ = auVar60;
auVar76._14_2_ = -(ushort)(lVar82 < 0);
auVar75._12_4_ = auVar76._12_4_;
auVar75._10_2_ = -(ushort)(sVar78 < 0);
auVar75._0_10_ = auVar96._0_10_;
auVar74._10_6_ = auVar75._10_6_;
auVar74._8_2_ = sVar78;
auVar74._0_8_ = lVar82;
auVar38._0_12_ = auVar28._0_12_;
auVar38._12_2_ = sVar41;
auVar38._14_2_ = -(ushort)(sVar41 < 0);
auVar37._12_4_ = auVar38._12_4_;
auVar37._0_10_ = auVar28._0_10_;
auVar37._10_2_ = -(ushort)(sVar39 < 0);
auVar36._10_6_ = auVar37._10_6_;
auVar36._0_8_ = auVar28._0_8_;
auVar36._8_2_ = sVar39;
auVar100._12_2_ = sVar41;
auVar100._0_12_ = auVar38._0_12_;
auVar100._14_2_ = -(ushort)(sVar41 < 0);
auVar99._12_4_ = auVar100._12_4_;
auVar99._10_2_ = -(ushort)(sVar39 < 0);
auVar99._0_10_ = auVar37._0_10_;
auVar98._10_6_ = auVar99._10_6_;
auVar98._8_2_ = sVar39;
auVar98._0_8_ = auVar36._0_8_;
auVar11._4_8_ = auVar98._8_8_;
auVar11._2_2_ = -(ushort)(auVar9._0_2_ < 0);
auVar11._0_2_ = auVar9._0_2_;
iVar83 = CONCAT22(-(ushort)(auVar66[0] < '\0'),auVar28._0_2_);
iVar20 = (~-(uint)(DAT_001020d0._4_4_ + auVar75._12_4_ != DAT_00102108._4_4_ + iVar20 &&
auVar75._12_4_ + DAT_001020e0._4_4_ != DAT_00102108._4_4_ + iVar20) &
DAT_001020f0._4_4_) +
(~-(uint)(DAT_001020d0._4_4_ + auVar94._4_4_ != DAT_001020a0._4_4_ + iVar20 &&
auVar94._4_4_ + DAT_001020e0._4_4_ != DAT_001020a0._4_4_ + iVar20) &
DAT_001020f0._4_4_) +
(~-(uint)(DAT_001020d0._4_4_ + auVar37._12_4_ != DAT_00102100._4_4_ + iVar20 &&
auVar37._12_4_ + DAT_001020e0._4_4_ != DAT_00102100._4_4_ + iVar20) &
DAT_001020f0._4_4_) +
iVar88 + (~-(uint)(DAT_001020d0._4_4_ + auVar11._0_4_ != iVar20 &&
DAT_001020e0._4_4_ + auVar11._0_4_ != iVar20) & DAT_001020f0._4_4_) +
(~-(uint)((int)DAT_001020d0 + auVar74._8_4_ != (int)DAT_00102108 + uVar16 &&
auVar74._8_4_ + (int)DAT_001020e0 != (int)DAT_00102108 + uVar16) &
(uint)DAT_001020f0) +
(~-(uint)((int)DAT_001020d0 + iVar93 != (int)DAT_001020a0 + uVar16 &&
iVar93 + (int)DAT_001020e0 != (int)DAT_001020a0 + uVar16) & (uint)DAT_001020f0
) + (~-(uint)((int)DAT_001020d0 + auVar36._8_4_ != (int)DAT_00102100 + uVar16 &&
auVar36._8_4_ + (int)DAT_001020e0 != (int)DAT_00102100 + uVar16) &
(uint)DAT_001020f0) +
iVar87 + (~-(uint)((int)DAT_001020d0 + iVar83 != uVar16 &&
(int)DAT_001020e0 + iVar83 != uVar16) & (uint)DAT_001020f0);
uVar16 = uVar16 + (uVar15 & 0xfffffff8);
if ((uVar15 & 7) == 0) {
return iVar20;
}
}
if (((int)(char)(*param_1)[(int)uVar16] - 0x41U == uVar16) ||
((int)(char)(*param_1)[(int)uVar16] - 0x61U == uVar16)) {
iVar20 = iVar20 + 1;
}
iVar87 = uVar16 + 1;
if (iVar87 < (int)uVar12) {
if ((iVar87 == (char)(*param_1)[iVar87] + -0x41) || (iVar87 == (char)(*param_1)[iVar87] + -0x61)
) {
iVar20 = iVar20 + 1;
}
iVar87 = uVar16 + 2;
if (iVar87 < (int)uVar12) {
if ((iVar87 == (char)(*param_1)[iVar87] + -0x41) ||
(iVar87 == (char)(*param_1)[iVar87] + -0x61)) {
iVar20 = iVar20 + 1;
}
iVar87 = uVar16 + 3;
if (iVar87 < (int)uVar12) {
if (((char)(*param_1)[iVar87] + -0x41 == iVar87) ||
((char)(*param_1)[iVar87] + -0x61 == iVar87)) {
iVar20 = iVar20 + 1;
}
iVar87 = uVar16 + 4;
if (iVar87 < (int)uVar12) {
if ((iVar87 == (char)(*param_1)[iVar87] + -0x41) ||
(iVar87 == (char)(*param_1)[iVar87] + -0x61)) {
iVar20 = iVar20 + 1;
}
iVar87 = uVar16 + 5;
if (iVar87 < (int)uVar12) {
if (((char)(*param_1)[iVar87] + -0x41 == iVar87) ||
(iVar87 == (char)(*param_1)[iVar87] + -0x61)) {
iVar20 = iVar20 + 1;
}
iVar87 = uVar16 + 6;
if ((iVar87 < (int)uVar12) &&
(((char)(*param_1)[iVar87] + -0x41 == iVar87 ||
((char)(*param_1)[iVar87] + -0x61 == iVar87)))) {
return iVar20 + 1;
}
}
}
}
}
}
return iVar20;
} |
4,556 | func0 |
#include <assert.h>
| int func0(int A[], int N) {
int evenPair = 0;
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if ((A[i] ^ A[j]) % 2 == 0) {
evenPair++;
}
}
}
return evenPair;
}
| int main() {
int arr1[] = {5, 4, 7, 2, 1};
assert(func0(arr1, 5) == 4);
int arr2[] = {7, 2, 8, 1, 0, 5, 11};
assert(func0(arr2, 7) == 9);
int arr3[] = {1, 2, 3};
assert(func0(arr3, 3) == 1);
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 11dc <func0+0x73>
mov -0x8(%rbp),%eax
add $0x1,%eax
mov %eax,-0x4(%rbp)
jmp 11d0 <func0+0x67>
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
xor %edx,%eax
and $0x1,%eax
test %eax,%eax
jne 11cc <func0+0x63>
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_11DC
loc_1188:
mov eax, [rbp+var_8]
add eax, 1
mov [rbp+var_4], eax
jmp short loc_11D0
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]
xor eax, edx
and eax, 1
test eax, eax
jnz short loc_11CC
add [rbp+var_C], 1
loc_11CC:
add [rbp+var_4], 1
loc_11D0:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_1193
add [rbp+var_8], 1
loc_11DC:
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 ( (((unsigned __int8)*(_DWORD *)(4LL * i + a1) ^ (unsigned __int8)*(_DWORD *)(4LL * j + a1)) & 1) == 0 )
++v3;
}
}
return v3;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0xc],0x0
MOV dword ptr [RBP + -0x8],0x0
JMP 0x001011dc
LAB_00101188:
MOV EAX,dword ptr [RBP + -0x8]
ADD EAX,0x1
MOV dword ptr [RBP + -0x4],EAX
JMP 0x001011d0
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]
XOR EAX,EDX
AND EAX,0x1
TEST EAX,EAX
JNZ 0x001011cc
ADD dword ptr [RBP + -0xc],0x1
LAB_001011cc:
ADD dword ptr [RBP + -0x4],0x1
LAB_001011d0:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x00101193
ADD dword ptr [RBP + -0x8],0x1
LAB_001011dc:
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 (((*(uint *)(param_1 + (long)local_c * 4) ^ *(uint *)(param_1 + (long)local_10 * 4)) & 1)
== 0) {
local_14 = local_14 + 1;
}
}
}
return local_14;
} |
4,557 | func0 |
#include <assert.h>
| int func0(int A[], int N) {
int evenPair = 0;
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if ((A[i] ^ A[j]) % 2 == 0) {
evenPair++;
}
}
}
return evenPair;
}
| int main() {
int arr1[] = {5, 4, 7, 2, 1};
assert(func0(arr1, 5) == 4);
int arr2[] = {7, 2, 8, 1, 0, 5, 11};
assert(func0(arr2, 7) == 9);
int arr3[] = {1, 2, 3};
assert(func0(arr3, 3) == 1);
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 11ae <func0+0x45>
lea -0x1(%rsi),%r10d
add $0x1,%r10
mov $0x1,%r9d
mov $0x0,%ecx
cmp %r10,%r9
je 11b3 <func0+0x4a>
mov -0x4(%rdi,%r9,4),%r8d
mov %r9,%rax
mov %r8d,%edx
xor (%rdi,%rax,4),%edx
and $0x1,%edx
cmp $0x1,%edx
adc $0x0,%ecx
add $0x1,%rax
cmp %eax,%esi
jg 1191 <func0+0x28>
add $0x1,%r9
jmp 1184 <func0+0x1b>
mov $0x0,%ecx
mov %ecx,%eax
retq
| func0:
endbr64
test esi, esi
jle short loc_11A9
mov r10d, esi
mov r9d, 1
mov ecx, 0
loc_117F:
cmp r9, r10
jz short loc_11AE
mov r8d, [rdi+r9*4-4]
mov rax, r9
loc_118C:
mov edx, r8d
xor edx, [rdi+rax*4]
and edx, 1
cmp edx, 1
adc ecx, 0
add rax, 1
cmp esi, eax
jg short loc_118C
add r9, 1
jmp short loc_117F
loc_11A9:
mov ecx, 0
loc_11AE:
mov eax, ecx
retn | long long func0(long long a1, int a2)
{
long long v2; // r9
unsigned int v3; // ecx
long long v4; // rax
if ( a2 <= 0 )
{
return 0;
}
else
{
v2 = 1LL;
v3 = 0;
while ( v2 != a2 )
{
v4 = v2;
do
v3 += ((*(_DWORD *)(a1 + 4 * v4++) ^ *(_DWORD *)(a1 + 4 * v2 - 4)) & 1) == 0;
while ( a2 > (int)v4 );
++v2;
}
}
return v3;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001011a9
MOV R10D,ESI
MOV R9D,0x1
MOV ECX,0x0
LAB_0010117f:
CMP R9,R10
JZ 0x001011ae
MOV R8D,dword ptr [RDI + R9*0x4 + -0x4]
MOV RAX,R9
LAB_0010118c:
MOV EDX,R8D
XOR EDX,dword ptr [RDI + RAX*0x4]
AND EDX,0x1
CMP EDX,0x1
ADC ECX,0x0
ADD RAX,0x1
CMP ESI,EAX
JG 0x0010118c
ADD R9,0x1
JMP 0x0010117f
LAB_001011a9:
MOV ECX,0x0
LAB_001011ae:
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 {
iVar2 = iVar2 + (uint)(((*(uint *)(param_1 + -4 + uVar3 * 4) ^
*(uint *)(param_1 + uVar1 * 4)) & 1) == 0);
uVar1 = uVar1 + 1;
} while ((int)uVar1 < (int)param_2);
}
}
return iVar2;
} |
4,558 | func0 |
#include <assert.h>
| int func0(int A[], int N) {
int evenPair = 0;
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if ((A[i] ^ A[j]) % 2 == 0) {
evenPair++;
}
}
}
return evenPair;
}
| int main() {
int arr1[] = {5, 4, 7, 2, 1};
assert(func0(arr1, 5) == 4);
int arr2[] = {7, 2, 8, 1, 0, 5, 11};
assert(func0(arr2, 7) == 9);
int arr3[] = {1, 2, 3};
assert(func0(arr3, 3) == 1);
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 13b4 <func0+0x54>
lea -0x1(%rsi),%r10d
mov $0x1,%r9d
xor %r8d,%r8d
add $0x1,%r10
cmp %r10,%r9
je 13b0 <func0+0x50>
xchg %ax,%ax
mov -0x4(%rdi,%r9,4),%ecx
mov %r9,%rax
nopl 0x0(%rax,%rax,1)
mov (%rdi,%rax,4),%edx
xor %ecx,%edx
and $0x1,%edx
cmp $0x1,%edx
adc $0x0,%r8d
add $0x1,%rax
cmp %eax,%esi
jg 1390 <func0+0x30>
add $0x1,%r9
cmp %r10,%r9
jne 1380 <func0+0x20>
mov %r8d,%eax
retq
xor %r8d,%r8d
mov %r8d,%eax
retq
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_1304
movsxd r10, esi
mov r9d, 1
xor r8d, r8d
cmp r9, r10
jz short loc_1300
nop dword ptr [rax+00000000h]
loc_12D0:
mov ecx, [rdi+r9*4-4]
mov rax, r9
nop dword ptr [rax+rax+00000000h]
loc_12E0:
mov edx, [rdi+rax*4]
xor edx, ecx
and edx, 1
cmp edx, 1
adc r8d, 0
add rax, 1
cmp esi, eax
jg short loc_12E0
add r9, 1
cmp r9, r10
jnz short loc_12D0
loc_1300:
mov eax, r8d
retn
loc_1304:
xor r8d, r8d
mov eax, r8d
retn | long long func0(long long a1, int a2)
{
long long v2; // r9
unsigned int i; // r8d
long long v4; // rax
if ( a2 <= 0 )
return 0LL;
v2 = 1LL;
for ( i = 0; v2 != a2; ++v2 )
{
v4 = v2;
do
i += (((unsigned __int8)*(_DWORD *)(a1 + 4 * v2 - 4) ^ (unsigned __int8)*(_DWORD *)(a1 + 4 * v4++)) & 1) == 0;
while ( a2 > (int)v4 );
}
return i;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101304
MOVSXD R10,ESI
MOV R9D,0x1
XOR R8D,R8D
CMP R9,R10
JZ 0x00101300
NOP dword ptr [RAX]
LAB_001012d0:
MOV ECX,dword ptr [RDI + R9*0x4 + -0x4]
MOV RAX,R9
NOP dword ptr [RAX + RAX*0x1]
LAB_001012e0:
MOV EDX,dword ptr [RDI + RAX*0x4]
XOR EDX,ECX
AND EDX,0x1
CMP EDX,0x1
ADC R8D,0x0
ADD RAX,0x1
CMP ESI,EAX
JG 0x001012e0
ADD R9,0x1
CMP R9,R10
JNZ 0x001012d0
LAB_00101300:
MOV EAX,R8D
RET
LAB_00101304:
XOR R8D,R8D
MOV EAX,R8D
RET | int func0(long param_1,int param_2)
{
long lVar1;
int iVar2;
long lVar3;
if (0 < param_2) {
lVar3 = 1;
iVar2 = 0;
if ((long)param_2 != 1) {
do {
lVar1 = lVar3;
do {
iVar2 = iVar2 + (uint)(((*(uint *)(param_1 + lVar1 * 4) ^
*(uint *)(param_1 + -4 + lVar3 * 4)) & 1) == 0);
lVar1 = lVar1 + 1;
} while ((int)lVar1 < param_2);
lVar3 = lVar3 + 1;
} while (lVar3 != param_2);
}
return iVar2;
}
return 0;
} |
4,559 | func0 |
#include <assert.h>
| int func0(int A[], int N) {
int evenPair = 0;
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if ((A[i] ^ A[j]) % 2 == 0) {
evenPair++;
}
}
}
return evenPair;
}
| int main() {
int arr1[] = {5, 4, 7, 2, 1};
assert(func0(arr1, 5) == 4);
int arr2[] = {7, 2, 8, 1, 0, 5, 11};
assert(func0(arr2, 7) == 9);
int arr3[] = {1, 2, 3};
assert(func0(arr3, 3) == 1);
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 148f <func0+0x14f>
cmp $0x1,%esi
je 148f <func0+0x14f>
push %r14
lea 0x4(%rdi),%r10
xor %r8d,%r8d
mov $0x1,%ecx
movdqa 0xd25(%rip),%xmm4
push %rbp
mov $0x1,%r11d
pxor %xmm3,%xmm3
push %rbx
lea -0x1(%rsi),%ebx
nopw 0x0(%rax,%rax,1)
mov %esi,%ebp
mov %ebx,%eax
mov -0x4(%r10),%r9d
sub %ecx,%ebp
cmp %ecx,%esi
cmovle %r11d,%ebp
sub %ecx,%eax
cmp $0x3,%eax
jbe 1488 <func0+0x148>
cmp %ecx,%esi
jle 1488 <func0+0x148>
mov %ebp,%edx
movd %r9d,%xmm5
pxor %xmm1,%xmm1
mov %r10,%rax
shr $0x2,%edx
pshufd $0x0,%xmm5,%xmm2
shl $0x4,%rdx
add %r10,%rdx
movdqu (%rax),%xmm0
add $0x10,%rax
pxor %xmm2,%xmm0
pand %xmm4,%xmm0
pcmpeqd %xmm3,%xmm0
psubd %xmm0,%xmm1
cmp %rdx,%rax
jne 13c0 <func0+0x80>
movdqa %xmm1,%xmm0
mov %ebp,%edx
psrldq $0x8,%xmm0
and $0xfffffffc,%edx
paddd %xmm0,%xmm1
movdqa %xmm1,%xmm0
psrldq $0x4,%xmm0
paddd %xmm0,%xmm1
movd %xmm1,%eax
add %eax,%r8d
lea (%rdx,%rcx,1),%eax
cmp %edx,%ebp
je 1471 <func0+0x131>
movslq %eax,%rdx
mov (%rdi,%rdx,4),%r14d
lea 0x0(,%rdx,4),%rbp
xor %r9d,%r14d
mov %r14d,%edx
and $0x1,%edx
cmp $0x1,%edx
lea 0x1(%rax),%edx
adc $0x0,%r8d
cmp %edx,%esi
jle 1471 <func0+0x131>
mov 0x4(%rdi,%rbp,1),%edx
xor %r9d,%edx
and $0x1,%edx
cmp $0x1,%edx
lea 0x2(%rax),%edx
adc $0x0,%r8d
cmp %edx,%esi
jle 1471 <func0+0x131>
mov 0x8(%rdi,%rbp,1),%edx
xor %r9d,%edx
and $0x1,%edx
cmp $0x1,%edx
adc $0x0,%r8d
add $0x3,%eax
cmp %esi,%eax
jge 1471 <func0+0x131>
xor 0xc(%rdi,%rbp,1),%r9d
and $0x1,%r9d
cmp $0x1,%r9d
adc $0x0,%r8d
add $0x1,%ecx
add $0x4,%r10
cmp %ecx,%esi
jne 1380 <func0+0x40>
pop %rbx
mov %r8d,%eax
pop %rbp
pop %r14
retq
mov %ecx,%eax
jmpq 140a <func0+0xca>
xor %r8d,%r8d
mov %r8d,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle loc_127A
mov r8d, esi
cmp esi, 1
jz loc_127A
push r14
mov r11, rdi
lea r10, [rdi+4]
mov ecx, 1
movdqa xmm4, cs:xmmword_2010
push rbp
xor edi, edi
lea ebp, [rsi-1]
push rbx
pxor xmm3, xmm3
mov ebx, 1
xchg ax, ax
loc_1180:
mov r9d, r8d
mov eax, ebp
mov esi, [r10-4]
sub r9d, ecx
cmp r8d, ecx
cmovle r9d, ebx
sub eax, ecx
cmp eax, 2
jbe loc_1276
cmp r8d, ecx
jle loc_1276
mov edx, r9d
movd xmm5, esi
pxor xmm1, xmm1
mov rax, r10
shr edx, 2
pshufd xmm2, xmm5, 0
shl rdx, 4
add rdx, r10
nop dword ptr [rax+00h]
loc_11C8:
movdqu xmm0, xmmword ptr [rax]
add rax, 10h
pxor xmm0, xmm2
pand xmm0, xmm4
pcmpeqd xmm0, xmm3
psubd xmm1, xmm0
cmp rax, rdx
jnz short loc_11C8
movdqa xmm0, xmm1
psrldq xmm0, 8
paddd xmm1, xmm0
movdqa xmm0, xmm1
psrldq xmm0, 4
paddd xmm1, xmm0
movd eax, xmm1
add edi, eax
mov eax, r9d
and eax, 0FFFFFFFCh
add eax, ecx
and r9d, 3
jz short loc_125F
loc_1213:
movsxd rdx, eax
mov r14d, [r11+rdx*4]
lea r9, ds:0[rdx*4]
xor r14d, esi
mov edx, r14d
and edx, 1
cmp edx, 1
lea edx, [rax+1]
adc edi, 0
cmp r8d, edx
jle short loc_125F
mov edx, [r11+r9+4]
xor edx, esi
and edx, 1
cmp edx, 1
adc edi, 0
add eax, 2
cmp r8d, eax
jle short loc_125F
xor esi, [r11+r9+8]
and esi, 1
cmp esi, 1
adc edi, 0
loc_125F:
add ecx, 1
add r10, 4
cmp r8d, ecx
jnz loc_1180
pop rbx
mov eax, edi
pop rbp
pop r14
retn
loc_1276:
mov eax, ecx
jmp short loc_1213
loc_127A:
xor edi, edi
mov eax, edi
retn | long long func0(long long a1, int a2)
{
const __m128i *v4; // r10
int v5; // ecx
__m128i si128; // xmm4
unsigned int v7; // edi
int v8; // ebp
unsigned int v9; // esi
unsigned int v10; // r9d
__m128i v11; // xmm1
const __m128i *v12; // rax
__m128i v13; // xmm2
__m128i v14; // xmm0
__m128i v15; // xmm1
int v16; // eax
long long v17; // r9
if ( a2 > 0 && a2 != 1 )
{
v4 = (const __m128i *)(a1 + 4);
v5 = 1;
si128 = _mm_load_si128((const __m128i *)&xmmword_2010);
v7 = 0;
v8 = a2 - 1;
while ( 1 )
{
v9 = v4[-1].m128i_u32[3];
v10 = a2 - v5;
if ( a2 <= v5 )
v10 = 1;
if ( (unsigned int)(v8 - v5) <= 2 || a2 <= v5 )
break;
v11 = 0LL;
v12 = v4;
v13 = _mm_shuffle_epi32(_mm_cvtsi32_si128(v9), 0);
do
{
v14 = _mm_loadu_si128(v12++);
v11 = _mm_sub_epi32(v11, _mm_cmpeq_epi32(_mm_and_si128(_mm_xor_si128(v14, v13), si128), (__m128i)0LL));
}
while ( v12 != &v4[v10 >> 2] );
v15 = _mm_add_epi32(v11, _mm_srli_si128(v11, 8));
v7 += _mm_cvtsi128_si32(_mm_add_epi32(v15, _mm_srli_si128(v15, 4)));
v16 = v5 + (v10 & 0xFFFFFFFC);
if ( (v10 & 3) != 0 )
goto LABEL_11;
LABEL_14:
++v5;
v4 = (const __m128i *)((char *)v4 + 4);
if ( a2 == v5 )
return v7;
}
v16 = v5;
LABEL_11:
v17 = 4LL * v16;
v7 += (((unsigned __int8)v9 ^ *(_BYTE *)(a1 + v17)) & 1) == 0;
if ( a2 > v16 + 1 )
{
v7 += (((unsigned __int8)v9 ^ (unsigned __int8)*(_DWORD *)(a1 + v17 + 4)) & 1) == 0;
if ( a2 > v16 + 2 )
v7 += ((*(_DWORD *)(a1 + v17 + 8) ^ v9) & 1) == 0;
}
goto LABEL_14;
}
return 0LL;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x0010127a
MOV R8D,ESI
CMP ESI,0x1
JZ 0x0010127a
PUSH R14
MOV R11,RDI
LEA R10,[RDI + 0x4]
MOV ECX,0x1
MOVDQA XMM4,xmmword ptr [0x00102010]
PUSH RBP
XOR EDI,EDI
LEA EBP,[RSI + -0x1]
PUSH RBX
PXOR XMM3,XMM3
MOV EBX,0x1
NOP
LAB_00101180:
MOV R9D,R8D
MOV EAX,EBP
MOV ESI,dword ptr [R10 + -0x4]
SUB R9D,ECX
CMP R8D,ECX
CMOVLE R9D,EBX
SUB EAX,ECX
CMP EAX,0x2
JBE 0x00101276
CMP R8D,ECX
JLE 0x00101276
MOV EDX,R9D
MOVD XMM5,ESI
PXOR XMM1,XMM1
MOV RAX,R10
SHR EDX,0x2
PSHUFD XMM2,XMM5,0x0
SHL RDX,0x4
ADD RDX,R10
NOP dword ptr [RAX]
LAB_001011c8:
MOVDQU XMM0,xmmword ptr [RAX]
ADD RAX,0x10
PXOR XMM0,XMM2
PAND XMM0,XMM4
PCMPEQD XMM0,XMM3
PSUBD XMM1,XMM0
CMP RAX,RDX
JNZ 0x001011c8
MOVDQA XMM0,XMM1
PSRLDQ XMM0,0x8
PADDD XMM1,XMM0
MOVDQA XMM0,XMM1
PSRLDQ XMM0,0x4
PADDD XMM1,XMM0
MOVD EAX,XMM1
ADD EDI,EAX
MOV EAX,R9D
AND EAX,0xfffffffc
ADD EAX,ECX
AND R9D,0x3
JZ 0x0010125f
LAB_00101213:
MOVSXD RDX,EAX
MOV R14D,dword ptr [R11 + RDX*0x4]
LEA R9,[RDX*0x4]
XOR R14D,ESI
MOV EDX,R14D
AND EDX,0x1
CMP EDX,0x1
LEA EDX,[RAX + 0x1]
ADC EDI,0x0
CMP R8D,EDX
JLE 0x0010125f
MOV EDX,dword ptr [R11 + R9*0x1 + 0x4]
XOR EDX,ESI
AND EDX,0x1
CMP EDX,0x1
ADC EDI,0x0
ADD EAX,0x2
CMP R8D,EAX
JLE 0x0010125f
XOR ESI,dword ptr [R11 + R9*0x1 + 0x8]
AND ESI,0x1
CMP ESI,0x1
ADC EDI,0x0
LAB_0010125f:
ADD ECX,0x1
ADD R10,0x4
CMP R8D,ECX
JNZ 0x00101180
POP RBX
MOV EAX,EDI
POP RBP
POP R14
RET
LAB_00101276:
MOV EAX,ECX
JMP 0x00101213
LAB_0010127a:
XOR EDI,EDI
MOV EAX,EDI
RET | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
int func0(long param_1,int param_2)
{
long lVar1;
uint uVar2;
uint uVar3;
uint uVar4;
uint *puVar5;
uint *puVar6;
uint *puVar7;
uint *puVar8;
int iVar9;
int iVar10;
uint *puVar11;
int iVar12;
int iVar13;
int iVar14;
int iVar15;
if ((param_2 < 1) || (param_2 == 1)) {
return 0;
}
puVar11 = (uint *)(param_1 + 4);
iVar9 = 1;
iVar10 = 0;
do {
uVar2 = puVar11[-1];
uVar3 = param_2 - iVar9;
if (param_2 <= iVar9) {
uVar3 = 1;
}
iVar12 = iVar9;
if (((uint)((param_2 + -1) - iVar9) < 3) || (param_2 <= iVar9)) {
LAB_00101213:
lVar1 = (long)iVar12 * 4;
iVar10 = iVar10 + (uint)(((*(uint *)(param_1 + (long)iVar12 * 4) ^ uVar2) & 1) == 0);
if ((iVar12 + 1 < param_2) &&
(iVar10 = iVar10 + (uint)(((*(uint *)(param_1 + 4 + lVar1) ^ uVar2) & 1) == 0),
iVar12 + 2 < param_2)) {
iVar10 = iVar10 + (uint)(((uVar2 ^ *(uint *)(param_1 + 8 + lVar1)) & 1) == 0);
}
}
else {
iVar12 = 0;
iVar13 = 0;
iVar14 = 0;
iVar15 = 0;
puVar8 = puVar11;
do {
uVar4 = *puVar8;
puVar5 = puVar8 + 1;
puVar6 = puVar8 + 2;
puVar7 = puVar8 + 3;
puVar8 = puVar8 + 4;
iVar12 = iVar12 + (uint)(((uVar4 ^ uVar2) & _DAT_00102010) == 0);
iVar13 = iVar13 + (uint)(((*puVar5 ^ uVar2) & _UNK_00102014) == 0);
iVar14 = iVar14 + (uint)(((*puVar6 ^ uVar2) & _UNK_00102018) == 0);
iVar15 = iVar15 + (uint)(((*puVar7 ^ uVar2) & _UNK_0010201c) == 0);
} while (puVar8 != puVar11 + (ulong)(uVar3 >> 2) * 4);
iVar10 = iVar10 + iVar12 + iVar14 + iVar13 + iVar15;
iVar12 = (uVar3 & 0xfffffffc) + iVar9;
if ((uVar3 & 3) != 0) goto LAB_00101213;
}
iVar9 = iVar9 + 1;
puVar11 = puVar11 + 1;
if (param_2 == iVar9) {
return iVar10;
}
} while( true );
} |
4,560 | func0 |
#include <assert.h>
| int func0(int n) {
int count = 0;
if (n && !(n & (n - 1))) {
return n;
}
while (n != 0) {
n >>= 1;
count += 1;
}
return 1 << count;
}
| int main() {
assert(func0(0) == 1);
assert(func0(5) == 8);
assert(func0(17) == 32);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %edi,-0x14(%rbp)
movl $0x0,-0x4(%rbp)
cmpl $0x0,-0x14(%rbp)
je 117a <func0+0x31>
mov -0x14(%rbp),%eax
sub $0x1,%eax
and -0x14(%rbp),%eax
test %eax,%eax
jne 117a <func0+0x31>
mov -0x14(%rbp),%eax
jmp 118e <func0+0x45>
sarl -0x14(%rbp)
addl $0x1,-0x4(%rbp)
cmpl $0x0,-0x14(%rbp)
jne 1173 <func0+0x2a>
mov -0x4(%rbp),%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_14], edi
mov [rbp+var_4], 0
cmp [rbp+var_14], 0
jz short loc_117A
mov eax, [rbp+var_14]
sub eax, 1
and eax, [rbp+var_14]
test eax, eax
jnz short loc_117A
mov eax, [rbp+var_14]
jmp short loc_118E
loc_1173:
sar [rbp+var_14], 1
add [rbp+var_4], 1
loc_117A:
cmp [rbp+var_14], 0
jnz short loc_1173
mov eax, [rbp+var_4]
mov edx, 1
mov ecx, eax
shl edx, cl
mov eax, edx
loc_118E:
pop rbp
retn | long long func0(unsigned int a1)
{
int v2; // [rsp+0h] [rbp-14h]
char v3; // [rsp+10h] [rbp-4h]
v2 = a1;
v3 = 0;
if ( a1 && (a1 & (a1 - 1)) == 0 )
return a1;
while ( v2 )
{
v2 >>= 1;
++v3;
}
return (unsigned int)(1 << v3);
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV dword ptr [RBP + -0x14],EDI
MOV dword ptr [RBP + -0x4],0x0
CMP dword ptr [RBP + -0x14],0x0
JZ 0x0010117a
MOV EAX,dword ptr [RBP + -0x14]
SUB EAX,0x1
AND EAX,dword ptr [RBP + -0x14]
TEST EAX,EAX
JNZ 0x0010117a
MOV EAX,dword ptr [RBP + -0x14]
JMP 0x0010118e
LAB_00101173:
SAR dword ptr [RBP + -0x14],0x1
ADD dword ptr [RBP + -0x4],0x1
LAB_0010117a:
CMP dword ptr [RBP + -0x14],0x0
JNZ 0x00101173
MOV EAX,dword ptr [RBP + -0x4]
MOV EDX,0x1
MOV ECX,EAX
SHL EDX,CL
MOV EAX,EDX
LAB_0010118e:
POP RBP
RET | uint func0(uint param_1)
{
byte bVar1;
int4 local_1c;
bVar1 = 0;
local_1c = param_1;
if ((param_1 == 0) || ((param_1 - 1 & param_1) != 0)) {
for (; local_1c != 0; local_1c = (int)local_1c >> 1) {
bVar1 = bVar1 + 1;
}
param_1 = 1 << (bVar1 & 0x1f);
}
return param_1;
} |
4,561 | func0 |
#include <assert.h>
| int func0(int n) {
int count = 0;
if (n && !(n & (n - 1))) {
return n;
}
while (n != 0) {
n >>= 1;
count += 1;
}
return 1 << count;
}
| int main() {
assert(func0(0) == 1);
assert(func0(5) == 8);
assert(func0(17) == 32);
return 0;
}
| O1 | c | func0:
endbr64
test %edi,%edi
je 1166 <func0+0x1d>
lea -0x1(%rdi),%edx
mov %edi,%eax
test %edi,%edx
je 116f <func0+0x26>
mov $0x0,%edi
add $0x1,%edi
sar %eax
jne 115f <func0+0x16>
mov $0x1,%eax
mov %edi,%ecx
shl %cl,%eax
retq
| func0:
endbr64
test edi, edi
jz short loc_1166
lea edx, [rdi-1]
mov eax, edi
test edx, edi
jz short locret_116F
mov edi, 0
loc_115F:
add edi, 1
sar eax, 1
jnz short loc_115F
loc_1166:
mov eax, 1
mov ecx, edi
shl eax, cl
locret_116F:
retn | long long func0(unsigned int a1)
{
long long result; // rax
if ( a1 )
{
result = a1;
if ( (a1 & (a1 - 1)) == 0 )
return result;
LOBYTE(a1) = 0;
do
{
LOBYTE(a1) = a1 + 1;
LODWORD(result) = (int)result >> 1;
}
while ( (_DWORD)result );
}
return (unsigned int)(1 << a1);
} | func0:
ENDBR64
TEST EDI,EDI
JZ 0x00101166
LEA EDX,[RDI + -0x1]
MOV EAX,EDI
TEST EDX,EDI
JZ 0x0010116f
MOV EDI,0x0
LAB_0010115f:
ADD EDI,0x1
SAR EAX,0x1
JNZ 0x0010115f
LAB_00101166:
MOV EAX,0x1
MOV ECX,EDI
SHL EAX,CL
LAB_0010116f:
RET | uint func0(uint param_1)
{
uint uVar1;
uint uVar2;
if (param_1 != 0) {
if ((param_1 - 1 & param_1) == 0) {
return param_1;
}
uVar2 = 0;
uVar1 = param_1;
do {
param_1 = uVar2 + 1;
uVar1 = (int)uVar1 >> 1;
uVar2 = param_1;
} while (uVar1 != 0);
}
return 1 << ((byte)param_1 & 0x1f);
} |
4,562 | func0 |
#include <assert.h>
| int func0(int n) {
int count = 0;
if (n && !(n & (n - 1))) {
return n;
}
while (n != 0) {
n >>= 1;
count += 1;
}
return 1 << count;
}
| int main() {
assert(func0(0) == 1);
assert(func0(5) == 8);
assert(func0(17) == 32);
return 0;
}
| O2 | c | func0:
endbr64
mov $0x1,%eax
test %edi,%edi
je 116e <func0+0x2e>
lea -0x1(%rdi),%edx
mov %edi,%eax
test %edi,%edx
je 116e <func0+0x2e>
xor %ecx,%ecx
nopl 0x0(%rax,%rax,1)
add $0x1,%ecx
sar %edi
jne 1160 <func0+0x20>
mov $0x1,%eax
shl %cl,%eax
retq
| func0:
endbr64
mov eax, 1
test edi, edi
jz short locret_116E
lea edx, [rdi-1]
mov eax, edi
test edx, edi
jz short locret_116E
xor ecx, ecx
nop dword ptr [rax+rax+00000000h]
loc_1160:
add ecx, 1
sar edi, 1
jnz short loc_1160
mov eax, 1
shl eax, cl
locret_116E:
retn | long long func0(int a1)
{
long long result; // rax
char v2; // cl
result = 1LL;
if ( a1 )
{
result = (unsigned int)a1;
if ( (a1 & (a1 - 1)) != 0 )
{
v2 = 0;
do
{
++v2;
a1 >>= 1;
}
while ( a1 );
return (unsigned int)(1 << v2);
}
}
return result;
} | func0:
ENDBR64
MOV EAX,0x1
TEST EDI,EDI
JZ 0x0010116e
LEA EDX,[RDI + -0x1]
MOV EAX,EDI
TEST EDX,EDI
JZ 0x0010116e
XOR ECX,ECX
NOP dword ptr [RAX + RAX*0x1]
LAB_00101160:
ADD ECX,0x1
SAR EDI,0x1
JNZ 0x00101160
MOV EAX,0x1
SHL EAX,CL
LAB_0010116e:
RET | uint func0(uint param_1)
{
uint uVar1;
byte bVar2;
uVar1 = 1;
if ((param_1 != 0) && (uVar1 = param_1, (param_1 - 1 & param_1) != 0)) {
bVar2 = 0;
do {
bVar2 = bVar2 + 1;
param_1 = (int)param_1 >> 1;
} while (param_1 != 0);
uVar1 = 1 << (bVar2 & 0x1f);
}
return uVar1;
} |
4,563 | func0 |
#include <assert.h>
| int func0(int n) {
int count = 0;
if (n && !(n & (n - 1))) {
return n;
}
while (n != 0) {
n >>= 1;
count += 1;
}
return 1 << count;
}
| int main() {
assert(func0(0) == 1);
assert(func0(5) == 8);
assert(func0(17) == 32);
return 0;
}
| O3 | c | func0:
endbr64
mov $0x1,%eax
test %edi,%edi
je 116e <func0+0x2e>
lea -0x1(%rdi),%edx
mov %edi,%eax
test %edi,%edx
je 116e <func0+0x2e>
xor %ecx,%ecx
nopl 0x0(%rax,%rax,1)
add $0x1,%ecx
sar %edi
jne 1160 <func0+0x20>
mov $0x1,%eax
shl %cl,%eax
retq
| func0:
endbr64
mov eax, 1
test edi, edi
jz short locret_116E
lea edx, [rdi-1]
mov eax, edi
test edx, edi
jz short locret_116E
xor ecx, ecx
nop dword ptr [rax+rax+00000000h]
loc_1160:
add ecx, 1
sar edi, 1
jnz short loc_1160
mov eax, 1
shl eax, cl
locret_116E:
retn | long long func0(int a1)
{
long long result; // rax
char v2; // cl
result = 1LL;
if ( a1 )
{
result = (unsigned int)a1;
if ( (a1 & (a1 - 1)) != 0 )
{
v2 = 0;
do
{
++v2;
a1 >>= 1;
}
while ( a1 );
return (unsigned int)(1 << v2);
}
}
return result;
} | func0:
ENDBR64
MOV EAX,0x1
TEST EDI,EDI
JZ 0x0010116e
LEA EDX,[RDI + -0x1]
MOV EAX,EDI
TEST EDX,EDI
JZ 0x0010116e
XOR ECX,ECX
NOP dword ptr [RAX + RAX*0x1]
LAB_00101160:
ADD ECX,0x1
SAR EDI,0x1
JNZ 0x00101160
MOV EAX,0x1
SHL EAX,CL
LAB_0010116e:
RET | uint func0(uint param_1)
{
uint uVar1;
byte bVar2;
uVar1 = 1;
if ((param_1 != 0) && (uVar1 = param_1, (param_1 - 1 & param_1) != 0)) {
bVar2 = 0;
do {
bVar2 = bVar2 + 1;
param_1 = (int)param_1 >> 1;
} while (param_1 != 0);
uVar1 = 1 << (bVar2 & 0x1f);
}
return uVar1;
} |
4,564 | func0 |
#include <assert.h>
| int func0(int a[], int n, int x) {
int count = 0;
for (int i = 0; i < n; i++) {
if (a[i] == x) count++;
}
return count;
}
| int main() {
int arr1[] = {1, 2, 3};
assert(func0(arr1, 3, 4) == 0);
int arr2[] = {1, 2, 2, 3, 3, 3, 4};
assert(func0(arr2, 7, 3) == 3);
int arr3[] = {0, 1, 2, 3, 1, 2};
assert(func0(arr3, 6, 1) == 2);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov %edx,-0x20(%rbp)
movl $0x0,-0x8(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11ae <func0+0x45>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cmp %eax,-0x20(%rbp)
jne 11aa <func0+0x41>
addl $0x1,-0x8(%rbp)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 118b <func0+0x22>
mov -0x8(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_20], edx
mov [rbp+var_8], 0
mov [rbp+var_4], 0
jmp short loc_11AE
loc_118B:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
cmp [rbp+var_20], eax
jnz short loc_11AA
add [rbp+var_8], 1
loc_11AA:
add [rbp+var_4], 1
loc_11AE:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_118B
mov eax, [rbp+var_8]
pop rbp
retn | long long func0(long long a1, int a2, int a3)
{
unsigned int v4; // [rsp+18h] [rbp-8h]
int i; // [rsp+1Ch] [rbp-4h]
v4 = 0;
for ( i = 0; i < a2; ++i )
{
if ( a3 == *(_DWORD *)(4LL * i + a1) )
++v4;
}
return v4;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x20],EDX
MOV dword ptr [RBP + -0x8],0x0
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011ae
LAB_0010118b:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
CMP dword ptr [RBP + -0x20],EAX
JNZ 0x001011aa
ADD dword ptr [RBP + -0x8],0x1
LAB_001011aa:
ADD dword ptr [RBP + -0x4],0x1
LAB_001011ae:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x0010118b
MOV EAX,dword ptr [RBP + -0x8]
POP RBP
RET | int func0(long param_1,int param_2,int param_3)
{
int4 local_10;
int4 local_c;
local_10 = 0;
for (local_c = 0; local_c < param_2; local_c = local_c + 1) {
if (param_3 == *(int *)(param_1 + (long)local_c * 4)) {
local_10 = local_10 + 1;
}
}
return local_10;
} |
4,565 | func0 |
#include <assert.h>
| int func0(int a[], int n, int x) {
int count = 0;
for (int i = 0; i < n; i++) {
if (a[i] == x) count++;
}
return count;
}
| int main() {
int arr1[] = {1, 2, 3};
assert(func0(arr1, 3, 4) == 0);
int arr2[] = {1, 2, 2, 3, 3, 3, 4};
assert(func0(arr2, 7, 3) == 3);
int arr3[] = {0, 1, 2, 3, 1, 2};
assert(func0(arr3, 6, 1) == 2);
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 1199 <func0+0x30>
mov %rdi,%rax
lea -0x1(%rsi),%ecx
lea 0x4(%rdi,%rcx,4),%rdi
mov $0x0,%ecx
cmp %edx,(%rax)
sete %sil
movzbl %sil,%esi
add %esi,%ecx
add $0x4,%rax
cmp %rdi,%rax
jne 1181 <func0+0x18>
mov %ecx,%eax
retq
mov $0x0,%ecx
jmp 1196 <func0+0x2d>
| func0:
endbr64
test esi, esi
jle short loc_1199
mov rax, rdi
lea ecx, [rsi-1]
lea rdi, [rdi+rcx*4+4]
mov ecx, 0
loc_1181:
cmp [rax], edx
setz sil
movzx esi, sil
add ecx, esi
add rax, 4
cmp rax, rdi
jnz short loc_1181
loc_1196:
mov eax, ecx
retn
loc_1199:
mov ecx, 0
jmp short loc_1196 | long long func0(_DWORD *a1, int a2, int a3)
{
_DWORD *v3; // rax
long long v4; // rdi
unsigned int v5; // ecx
if ( a2 <= 0 )
{
return 0;
}
else
{
v3 = a1;
v4 = (long long)&a1[a2 - 1 + 1];
v5 = 0;
do
v5 += *v3++ == a3;
while ( v3 != (_DWORD *)v4 );
}
return v5;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101199
MOV RAX,RDI
LEA ECX,[RSI + -0x1]
LEA RDI,[RDI + RCX*0x4 + 0x4]
MOV ECX,0x0
LAB_00101181:
CMP dword ptr [RAX],EDX
SETZ SIL
MOVZX ESI,SIL
ADD ECX,ESI
ADD RAX,0x4
CMP RAX,RDI
JNZ 0x00101181
LAB_00101196:
MOV EAX,ECX
RET
LAB_00101199:
MOV ECX,0x0
JMP 0x00101196 | int func0(int *param_1,int param_2,int param_3)
{
int *piVar1;
int iVar2;
if (param_2 < 1) {
iVar2 = 0;
}
else {
piVar1 = param_1 + (ulong)(param_2 - 1) + 1;
iVar2 = 0;
do {
iVar2 = iVar2 + (uint)(*param_1 == param_3);
param_1 = param_1 + 1;
} while (param_1 != piVar1);
}
return iVar2;
} |
4,566 | func0 |
#include <assert.h>
| int func0(int a[], int n, int x) {
int count = 0;
for (int i = 0; i < n; i++) {
if (a[i] == x) count++;
}
return count;
}
| int main() {
int arr1[] = {1, 2, 3};
assert(func0(arr1, 3, 4) == 0);
int arr2[] = {1, 2, 2, 3, 3, 3, 4};
assert(func0(arr2, 7, 3) == 3);
int arr3[] = {0, 1, 2, 3, 1, 2};
assert(func0(arr3, 6, 1) == 2);
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 12d0 <func0+0x30>
lea -0x1(%rsi),%eax
lea 0x4(%rdi,%rax,4),%rsi
xor %eax,%eax
nopw 0x0(%rax,%rax,1)
xor %ecx,%ecx
cmp %edx,(%rdi)
sete %cl
add $0x4,%rdi
add %ecx,%eax
cmp %rsi,%rdi
jne 12b8 <func0+0x18>
retq
nopl 0x0(%rax,%rax,1)
xor %eax,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
test esi, esi
jle short loc_12D0
lea eax, [rsi-1]
lea rsi, [rdi+rax*4+4]
xor eax, eax
nop word ptr [rax+rax+00h]
loc_12B8:
xor ecx, ecx
cmp [rdi], edx
setz cl
add rdi, 4
add eax, ecx
cmp rdi, rsi
jnz short loc_12B8
retn
loc_12D0:
xor eax, eax
retn | long long func0(_DWORD *a1, int a2, int a3)
{
long long v3; // rsi
long long result; // rax
BOOL v5; // ecx
if ( a2 <= 0 )
return 0LL;
v3 = (long long)&a1[a2 - 1 + 1];
LODWORD(result) = 0;
do
{
v5 = *a1++ == a3;
result = (unsigned int)(v5 + result);
}
while ( a1 != (_DWORD *)v3 );
return result;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001012d0
LEA EAX,[RSI + -0x1]
LEA RSI,[RDI + RAX*0x4 + 0x4]
XOR EAX,EAX
NOP word ptr [RAX + RAX*0x1]
LAB_001012b8:
XOR ECX,ECX
CMP dword ptr [RDI],EDX
SETZ CL
ADD RDI,0x4
ADD EAX,ECX
CMP RDI,RSI
JNZ 0x001012b8
RET
LAB_001012d0:
XOR EAX,EAX
RET | int func0(int *param_1,int param_2,int param_3)
{
int *piVar1;
int iVar2;
int iVar3;
if (0 < param_2) {
piVar1 = param_1 + (ulong)(param_2 - 1) + 1;
iVar3 = 0;
do {
iVar2 = *param_1;
param_1 = param_1 + 1;
iVar3 = iVar3 + (uint)(iVar2 == param_3);
} while (param_1 != piVar1);
return iVar3;
}
return 0;
} |
4,567 | func0 |
#include <assert.h>
| int func0(int a[], int n, int x) {
int count = 0;
for (int i = 0; i < n; i++) {
if (a[i] == x) count++;
}
return count;
}
| int main() {
int arr1[] = {1, 2, 3};
assert(func0(arr1, 3, 4) == 0);
int arr2[] = {1, 2, 2, 3, 3, 3, 4};
assert(func0(arr2, 7, 3) == 3);
int arr3[] = {0, 1, 2, 3, 1, 2};
assert(func0(arr3, 6, 1) == 2);
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 1378 <func0+0xe8>
lea -0x1(%rsi),%eax
cmp $0x3,%eax
jbe 137b <func0+0xeb>
mov %esi,%ecx
movd %edx,%xmm3
pxor %xmm0,%xmm0
mov %rdi,%rax
shr $0x2,%ecx
pshufd $0x0,%xmm3,%xmm2
shl $0x4,%rcx
add %rdi,%rcx
nopl 0x0(%rax)
movdqu (%rax),%xmm1
add $0x10,%rax
pcmpeqd %xmm2,%xmm1
psubd %xmm1,%xmm0
cmp %rcx,%rax
jne 12c8 <func0+0x38>
movdqa %xmm0,%xmm1
mov %esi,%ecx
psrldq $0x8,%xmm1
and $0xfffffffc,%ecx
paddd %xmm1,%xmm0
movdqa %xmm0,%xmm1
psrldq $0x4,%xmm1
paddd %xmm1,%xmm0
movd %xmm0,%eax
test $0x3,%sil
je 1358 <func0+0xc8>
movslq %ecx,%r8
cmp %edx,(%rdi,%r8,4)
je 1348 <func0+0xb8>
lea 0x1(%rcx),%r8d
cmp %esi,%r8d
jge 1342 <func0+0xb2>
movslq %r8d,%r8
cmp (%rdi,%r8,4),%edx
je 1350 <func0+0xc0>
lea 0x2(%rcx),%r8d
cmp %r8d,%esi
jle 1342 <func0+0xb2>
movslq %r8d,%r8
cmp (%rdi,%r8,4),%edx
je 1360 <func0+0xd0>
add $0x3,%ecx
cmp %ecx,%esi
jle 1342 <func0+0xb2>
movslq %ecx,%rcx
cmp (%rdi,%rcx,4),%edx
je 1370 <func0+0xe0>
retq
nopl 0x0(%rax,%rax,1)
add $0x1,%eax
jmp 130f <func0+0x7f>
nopl (%rax)
add $0x1,%eax
jmp 1321 <func0+0x91>
nopl (%rax)
retq
nopl 0x0(%rax)
add $0x3,%ecx
add $0x1,%eax
cmp %ecx,%esi
jg 133a <func0+0xaa>
jmp 1342 <func0+0xb2>
nopl 0x0(%rax)
add $0x1,%eax
retq
nopl 0x0(%rax)
xor %eax,%eax
retq
xor %ecx,%ecx
xor %eax,%eax
jmp 1306 <func0+0x76>
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle loc_1210
lea eax, [rsi-1]
cmp eax, 2
jbe loc_1213
mov ecx, esi
movd xmm3, edx
pxor xmm0, xmm0
mov rax, rdi
shr ecx, 2
pshufd xmm2, xmm3, 0
shl rcx, 4
add rcx, rdi
nop dword ptr [rax+00h]
loc_1178:
movdqu xmm1, xmmword ptr [rax]
add rax, 10h
pcmpeqd xmm1, xmm2
psubd xmm0, xmm1
cmp rcx, rax
jnz short loc_1178
movdqa xmm1, xmm0
mov ecx, esi
psrldq xmm1, 8
and ecx, 0FFFFFFFCh
paddd xmm0, xmm1
movdqa xmm1, xmm0
psrldq xmm1, 4
paddd xmm0, xmm1
movd eax, xmm0
test sil, 3
jz short locret_1200
loc_11B6:
movsxd r8, ecx
lea r9, ds:0[r8*4]
cmp [rdi+r8*4], edx
jz short loc_11F0
loc_11C7:
lea r8d, [rcx+1]
cmp esi, r8d
jle short locret_11E5
cmp edx, [rdi+r9+4]
jz short loc_11F8
loc_11D7:
add ecx, 2
cmp esi, ecx
jle short locret_11E5
cmp edx, [rdi+r9+8]
jz short loc_1208
locret_11E5:
retn
loc_11F0:
add eax, 1
jmp short loc_11C7
loc_11F8:
add eax, 1
jmp short loc_11D7
locret_1200:
retn
loc_1208:
add eax, 1
retn
loc_1210:
xor eax, eax
retn
loc_1213:
xor ecx, ecx
xor eax, eax
jmp short loc_11B6 | long long func0(const __m128i *a1, int a2, unsigned int a3)
{
__m128i v3; // xmm0
const __m128i *v4; // rax
__m128i v5; // xmm2
__m128i v6; // xmm1
int v7; // ecx
__m128i v8; // xmm0
long long result; // rax
long long v10; // r9
if ( a2 <= 0 )
return 0LL;
if ( (unsigned int)(a2 - 1) <= 2 )
{
v7 = 0;
result = 0LL;
}
else
{
v3 = 0LL;
v4 = a1;
v5 = _mm_shuffle_epi32(_mm_cvtsi32_si128(a3), 0);
do
{
v6 = _mm_loadu_si128(v4++);
v3 = _mm_sub_epi32(v3, _mm_cmpeq_epi32(v6, v5));
}
while ( &a1[(unsigned int)a2 >> 2] != v4 );
v7 = a2 & 0x7FFFFFFC;
v8 = _mm_add_epi32(v3, _mm_srli_si128(v3, 8));
result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v8, _mm_srli_si128(v8, 4)));
if ( (a2 & 3) == 0 )
return result;
}
v10 = v7;
if ( a1->m128i_i32[v10] == a3 )
result = (unsigned int)(result + 1);
if ( a2 > v7 + 1 )
{
if ( a3 == a1->m128i_i32[v10 + 1] )
result = (unsigned int)(result + 1);
if ( a2 > v7 + 2 && a3 == a1->m128i_i32[v10 + 2] )
return (unsigned int)(result + 1);
}
return result;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101210
LEA EAX,[RSI + -0x1]
CMP EAX,0x2
JBE 0x00101213
MOV ECX,ESI
MOVD XMM3,EDX
PXOR XMM0,XMM0
MOV RAX,RDI
SHR ECX,0x2
PSHUFD XMM2,XMM3,0x0
SHL RCX,0x4
ADD RCX,RDI
NOP dword ptr [RAX]
LAB_00101178:
MOVDQU XMM1,xmmword ptr [RAX]
ADD RAX,0x10
PCMPEQD XMM1,XMM2
PSUBD XMM0,XMM1
CMP RCX,RAX
JNZ 0x00101178
MOVDQA XMM1,XMM0
MOV ECX,ESI
PSRLDQ XMM1,0x8
AND ECX,0xfffffffc
PADDD XMM0,XMM1
MOVDQA XMM1,XMM0
PSRLDQ XMM1,0x4
PADDD XMM0,XMM1
MOVD EAX,XMM0
TEST SIL,0x3
JZ 0x00101200
LAB_001011b6:
MOVSXD R8,ECX
LEA R9,[R8*0x4]
CMP dword ptr [RDI + R8*0x4],EDX
JZ 0x001011f0
LAB_001011c7:
LEA R8D,[RCX + 0x1]
CMP ESI,R8D
JLE 0x001011e5
CMP EDX,dword ptr [RDI + R9*0x1 + 0x4]
JZ 0x001011f8
LAB_001011d7:
ADD ECX,0x2
CMP ESI,ECX
JLE 0x001011e5
CMP EDX,dword ptr [RDI + R9*0x1 + 0x8]
JZ 0x00101208
LAB_001011e5:
RET
LAB_001011f0:
ADD EAX,0x1
JMP 0x001011c7
LAB_001011f8:
ADD EAX,0x1
JMP 0x001011d7
LAB_00101200:
RET
LAB_00101208:
ADD EAX,0x1
RET
LAB_00101210:
XOR EAX,EAX
RET
LAB_00101213:
XOR ECX,ECX
XOR EAX,EAX
JMP 0x001011b6 | int func0(int *param_1,uint param_2,int param_3)
{
int iVar1;
int *piVar2;
int *piVar3;
int *piVar4;
int *piVar5;
uint uVar6;
int iVar7;
int iVar8;
int iVar9;
int iVar10;
if ((int)param_2 < 1) {
return 0;
}
if (param_2 - 1 < 3) {
uVar6 = 0;
iVar7 = 0;
}
else {
iVar7 = 0;
iVar8 = 0;
iVar9 = 0;
iVar10 = 0;
piVar5 = param_1;
do {
iVar1 = *piVar5;
piVar2 = piVar5 + 1;
piVar3 = piVar5 + 2;
piVar4 = piVar5 + 3;
piVar5 = piVar5 + 4;
iVar7 = iVar7 + (uint)(iVar1 == param_3);
iVar8 = iVar8 + (uint)(*piVar2 == param_3);
iVar9 = iVar9 + (uint)(*piVar3 == param_3);
iVar10 = iVar10 + (uint)(*piVar4 == param_3);
} while (param_1 + (ulong)(param_2 >> 2) * 4 != piVar5);
uVar6 = param_2 & 0xfffffffc;
iVar7 = iVar7 + iVar9 + iVar8 + iVar10;
if ((param_2 & 3) == 0) {
return iVar7;
}
}
if (param_1[(int)uVar6] == param_3) {
iVar7 = iVar7 + 1;
}
if ((int)(uVar6 + 1) < (int)param_2) {
if (param_3 == param_1[(long)(int)uVar6 + 1]) {
iVar7 = iVar7 + 1;
}
if (((int)(uVar6 + 2) < (int)param_2) && (param_3 == param_1[(long)(int)uVar6 + 2])) {
return iVar7 + 1;
}
}
return iVar7;
} |
4,568 | func0 |
#include <assert.h>
| int func0(int n) {
if (n <= 2) {
return n;
}
int a = 1;
int b = 2;
int c;
for (int i = 3; i <= n; i++) {
c = 2 * b + a;
a = b;
b = c;
}
return b;
}
| int main() {
assert(func0(4) == 12);
assert(func0(7) == 169);
assert(func0(8) == 408);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %edi,-0x14(%rbp)
cmpl $0x2,-0x14(%rbp)
jg 115f <func0+0x16>
mov -0x14(%rbp),%eax
jmp 119f <func0+0x56>
movl $0x1,-0x10(%rbp)
movl $0x2,-0xc(%rbp)
movl $0x3,-0x8(%rbp)
jmp 1194 <func0+0x4b>
mov -0xc(%rbp),%eax
lea (%rax,%rax,1),%edx
mov -0x10(%rbp),%eax
add %edx,%eax
mov %eax,-0x4(%rbp)
mov -0xc(%rbp),%eax
mov %eax,-0x10(%rbp)
mov -0x4(%rbp),%eax
mov %eax,-0xc(%rbp)
addl $0x1,-0x8(%rbp)
mov -0x8(%rbp),%eax
cmp -0x14(%rbp),%eax
jle 1176 <func0+0x2d>
mov -0xc(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_14], edi
cmp [rbp+var_14], 2
jg short loc_115F
mov eax, [rbp+var_14]
jmp short loc_119F
loc_115F:
mov [rbp+var_10], 1
mov [rbp+var_C], 2
mov [rbp+var_8], 3
jmp short loc_1194
loc_1176:
mov eax, [rbp+var_C]
lea edx, [rax+rax]
mov eax, [rbp+var_10]
add eax, edx
mov [rbp+var_4], eax
mov eax, [rbp+var_C]
mov [rbp+var_10], eax
mov eax, [rbp+var_4]
mov [rbp+var_C], eax
add [rbp+var_8], 1
loc_1194:
mov eax, [rbp+var_8]
cmp eax, [rbp+var_14]
jle short loc_1176
mov eax, [rbp+var_C]
loc_119F:
pop rbp
retn | long long func0(int a1)
{
int v2; // [rsp+4h] [rbp-10h]
unsigned int v3; // [rsp+8h] [rbp-Ch]
int i; // [rsp+Ch] [rbp-8h]
unsigned int v5; // [rsp+10h] [rbp-4h]
if ( a1 <= 2 )
return (unsigned int)a1;
v2 = 1;
v3 = 2;
for ( i = 3; i <= a1; ++i )
{
v5 = 2 * v3 + v2;
v2 = v3;
v3 = v5;
}
return v3;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV dword ptr [RBP + -0x14],EDI
CMP dword ptr [RBP + -0x14],0x2
JG 0x0010115f
MOV EAX,dword ptr [RBP + -0x14]
JMP 0x0010119f
LAB_0010115f:
MOV dword ptr [RBP + -0x10],0x1
MOV dword ptr [RBP + -0xc],0x2
MOV dword ptr [RBP + -0x8],0x3
JMP 0x00101194
LAB_00101176:
MOV EAX,dword ptr [RBP + -0xc]
LEA EDX,[RAX + RAX*0x1]
MOV EAX,dword ptr [RBP + -0x10]
ADD EAX,EDX
MOV dword ptr [RBP + -0x4],EAX
MOV EAX,dword ptr [RBP + -0xc]
MOV dword ptr [RBP + -0x10],EAX
MOV EAX,dword ptr [RBP + -0x4]
MOV dword ptr [RBP + -0xc],EAX
ADD dword ptr [RBP + -0x8],0x1
LAB_00101194:
MOV EAX,dword ptr [RBP + -0x8]
CMP EAX,dword ptr [RBP + -0x14]
JLE 0x00101176
MOV EAX,dword ptr [RBP + -0xc]
LAB_0010119f:
POP RBP
RET | int func0(int param_1)
{
int iVar1;
int4 local_18;
int4 local_14;
int4 local_10;
local_14 = param_1;
if (2 < param_1) {
local_18 = 1;
local_14 = 2;
for (local_10 = 3; local_10 <= param_1; local_10 = local_10 + 1) {
iVar1 = local_18 + local_14 * 2;
local_18 = local_14;
local_14 = iVar1;
}
}
return local_14;
} |
4,569 | func0 |
#include <assert.h>
| int func0(int n) {
if (n <= 2) {
return n;
}
int a = 1;
int b = 2;
int c;
for (int i = 3; i <= n; i++) {
c = 2 * b + a;
a = b;
b = c;
}
return b;
}
| int main() {
assert(func0(4) == 12);
assert(func0(7) == 169);
assert(func0(8) == 408);
return 0;
}
| O1 | c | func0:
endbr64
mov %edi,%eax
cmp $0x2,%edi
jle 1174 <func0+0x2b>
add $0x1,%edi
mov $0x3,%edx
mov $0x2,%eax
mov $0x1,%ecx
mov %eax,%esi
lea (%rcx,%rax,2),%eax
add $0x1,%edx
mov %esi,%ecx
cmp %edi,%edx
jne 1166 <func0+0x1d>
retq
| func0:
endbr64
mov eax, edi
cmp edi, 2
jle short locret_1174
add edi, 1
mov edx, 3
mov eax, 2
mov ecx, 1
loc_1166:
mov esi, eax
lea eax, [rcx+rax*2]
add edx, 1
mov ecx, esi
cmp edx, edi
jnz short loc_1166
locret_1174:
retn | long long func0(int a1)
{
long long result; // rax
int v2; // edi
int v3; // edx
int v4; // ecx
int v5; // esi
result = (unsigned int)a1;
if ( a1 > 2 )
{
v2 = a1 + 1;
v3 = 3;
LODWORD(result) = 2;
v4 = 1;
do
{
v5 = result;
result = (unsigned int)(v4 + 2 * result);
++v3;
v4 = v5;
}
while ( v3 != v2 );
}
return result;
} | func0:
ENDBR64
MOV EAX,EDI
CMP EDI,0x2
JLE 0x00101174
ADD EDI,0x1
MOV EDX,0x3
MOV EAX,0x2
MOV ECX,0x1
LAB_00101166:
MOV ESI,EAX
LEA EAX,[RCX + RAX*0x2]
ADD EDX,0x1
MOV ECX,ESI
CMP EDX,EDI
JNZ 0x00101166
LAB_00101174:
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
if (2 < param_1) {
iVar4 = param_1 + 1;
iVar3 = 3;
iVar2 = 1;
iVar1 = 2;
do {
param_1 = iVar2 + iVar1 * 2;
iVar3 = iVar3 + 1;
iVar2 = iVar1;
iVar1 = param_1;
} while (iVar3 != iVar4);
}
return param_1;
} |
4,570 | func0 |
#include <assert.h>
| int func0(int n) {
if (n <= 2) {
return n;
}
int a = 1;
int b = 2;
int c;
for (int i = 3; i <= n; i++) {
c = 2 * b + a;
a = b;
b = c;
}
return b;
}
| int main() {
assert(func0(4) == 12);
assert(func0(7) == 169);
assert(func0(8) == 408);
return 0;
}
| O2 | c | func0:
endbr64
mov %edi,%r8d
cmp $0x2,%edi
jle 11d0 <func0+0x30>
add $0x1,%edi
mov $0x3,%eax
mov $0x1,%ecx
mov $0x2,%edx
jmp 11c3 <func0+0x23>
mov %r8d,%edx
add $0x1,%eax
lea (%rcx,%rdx,2),%r8d
mov %edx,%ecx
cmp %eax,%edi
jne 11c0 <func0+0x20>
mov %r8d,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
xchg %ax,%ax
| func0:
endbr64
mov r8d, edi
cmp edi, 2
jle short loc_11D0
add edi, 1
mov eax, 3
mov ecx, 1
mov edx, 2
jmp short loc_11C3
loc_11C0:
mov edx, r8d
loc_11C3:
add eax, 1
lea r8d, [rcx+rdx*2]
mov ecx, edx
cmp eax, edi
jnz short loc_11C0
loc_11D0:
mov eax, r8d
retn | long long func0(int a1)
{
unsigned int v1; // r8d
int v2; // edi
int v3; // eax
int v4; // ecx
int i; // edx
v1 = a1;
if ( a1 > 2 )
{
v2 = a1 + 1;
v3 = 3;
v4 = 1;
for ( i = 2; ; i = v1 )
{
++v3;
v1 = v4 + 2 * i;
v4 = i;
if ( v3 == v2 )
break;
}
}
return v1;
} | func0:
ENDBR64
MOV R8D,EDI
CMP EDI,0x2
JLE 0x001011d0
ADD EDI,0x1
MOV EAX,0x3
MOV ECX,0x1
MOV EDX,0x2
JMP 0x001011c3
LAB_001011c0:
MOV EDX,R8D
LAB_001011c3:
ADD EAX,0x1
LEA R8D,[RCX + RDX*0x2]
MOV ECX,EDX
CMP EAX,EDI
JNZ 0x001011c0
LAB_001011d0:
MOV EAX,R8D
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
if (2 < param_1) {
iVar4 = param_1 + 1;
iVar1 = 3;
iVar2 = 1;
iVar3 = 2;
do {
iVar1 = iVar1 + 1;
param_1 = iVar2 + iVar3 * 2;
iVar2 = iVar3;
iVar3 = param_1;
} while (iVar1 != iVar4);
}
return param_1;
} |
4,571 | func0 |
#include <assert.h>
| int func0(int n) {
if (n <= 2) {
return n;
}
int a = 1;
int b = 2;
int c;
for (int i = 3; i <= n; i++) {
c = 2 * b + a;
a = b;
b = c;
}
return b;
}
| int main() {
assert(func0(4) == 12);
assert(func0(7) == 169);
assert(func0(8) == 408);
return 0;
}
| O3 | c | func0:
endbr64
mov %edi,%r8d
cmp $0x2,%edi
jle 1170 <func0+0x30>
add $0x1,%edi
mov $0x3,%eax
mov $0x1,%ecx
mov $0x2,%edx
jmp 1163 <func0+0x23>
mov %r8d,%edx
add $0x1,%eax
lea (%rcx,%rdx,2),%r8d
mov %edx,%ecx
cmp %edi,%eax
jne 1160 <func0+0x20>
mov %r8d,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
xchg %ax,%ax
| func0:
endbr64
mov ecx, edi
cmp edi, 2
jle short loc_116E
add edi, 1
mov eax, 3
mov esi, 1
mov edx, 2
jmp short loc_1162
loc_1160:
mov edx, ecx
loc_1162:
add eax, 1
lea ecx, [rsi+rdx*2]
mov esi, edx
cmp edi, eax
jnz short loc_1160
loc_116E:
mov eax, ecx
retn | long long func0(int a1)
{
unsigned int v1; // ecx
int v2; // edi
int v3; // eax
int v4; // esi
int i; // edx
v1 = a1;
if ( a1 > 2 )
{
v2 = a1 + 1;
v3 = 3;
v4 = 1;
for ( i = 2; ; i = v1 )
{
++v3;
v1 = v4 + 2 * i;
v4 = i;
if ( v2 == v3 )
break;
}
}
return v1;
} | func0:
ENDBR64
MOV ECX,EDI
CMP EDI,0x2
JLE 0x0010116e
ADD EDI,0x1
MOV EAX,0x3
MOV ESI,0x1
MOV EDX,0x2
JMP 0x00101162
LAB_00101160:
MOV EDX,ECX
LAB_00101162:
ADD EAX,0x1
LEA ECX,[RSI + RDX*0x2]
MOV ESI,EDX
CMP EDI,EAX
JNZ 0x00101160
LAB_0010116e:
MOV EAX,ECX
RET | int func0(int param_1)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
if (2 < param_1) {
iVar4 = param_1 + 1;
iVar1 = 3;
iVar3 = 1;
iVar2 = 2;
do {
iVar1 = iVar1 + 1;
param_1 = iVar3 + iVar2 * 2;
iVar3 = iVar2;
iVar2 = param_1;
} while (iVar4 != iVar1);
}
return param_1;
} |
4,572 | func0 | #include <assert.h>
| int func0(int list1[], int m, int n) {
int sum_range = 0;
for (int i = m; i <= n; i++) {
sum_range += list1[i];
}
return sum_range;
}
| int main() {
int list1[] = {2, 1, 5, 6, 8, 3, 4, 9, 10, 11, 8, 12};
assert(func0(list1, 8, 10) == 29);
assert(func0(list1, 5, 7) == 16);
assert(func0(list1, 7, 10) == 38);
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)
mov -0x1c(%rbp),%eax
mov %eax,-0x4(%rbp)
jmp 11a7 <func0+0x3e>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
add %eax,-0x8(%rbp)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x20(%rbp),%eax
jle 118a <func0+0x21>
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 eax, [rbp+var_1C]
mov [rbp+var_4], eax
jmp short loc_11A7
loc_118A:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
add [rbp+var_8], eax
add [rbp+var_4], 1
loc_11A7:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_20]
jle short loc_118A
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]
v4 = 0;
while ( a2 <= a3 )
v4 += *(_DWORD *)(4LL * a2++ + a1);
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 EAX,dword ptr [RBP + -0x1c]
MOV dword ptr [RBP + -0x4],EAX
JMP 0x001011a7
LAB_0010118a:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
ADD dword ptr [RBP + -0x8],EAX
ADD dword ptr [RBP + -0x4],0x1
LAB_001011a7:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x20]
JLE 0x0010118a
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 = param_2; local_c <= param_3; local_c = local_c + 1) {
local_10 = local_10 + *(int *)(param_1 + (long)local_c * 4);
}
return local_10;
} |
4,573 | func0 | #include <assert.h>
| int func0(int list1[], int m, int n) {
int sum_range = 0;
for (int i = m; i <= n; i++) {
sum_range += list1[i];
}
return sum_range;
}
| int main() {
int list1[] = {2, 1, 5, 6, 8, 3, 4, 9, 10, 11, 8, 12};
assert(func0(list1, 8, 10) == 29);
assert(func0(list1, 5, 7) == 16);
assert(func0(list1, 7, 10) == 38);
return 0;
}
| O1 | c | func0:
endbr64
cmp %edx,%esi
jg 1195 <func0+0x2c>
movslq %esi,%rcx
lea (%rdi,%rcx,4),%rax
sub %esi,%edx
add %rcx,%rdx
lea 0x4(%rdi,%rdx,4),%rcx
mov $0x0,%edx
add (%rax),%edx
add $0x4,%rax
cmp %rcx,%rax
jne 1187 <func0+0x1e>
mov %edx,%eax
retq
mov $0x0,%edx
jmp 1192 <func0+0x29>
| func0:
endbr64
cmp esi, edx
jg short loc_1195
movsxd rcx, esi
lea rax, [rdi+rcx*4]
sub edx, esi
add rdx, rcx
lea rcx, [rdi+rdx*4+4]
mov edx, 0
loc_1187:
add edx, [rax]
add rax, 4
cmp rax, rcx
jnz short loc_1187
loc_1192:
mov eax, edx
retn
loc_1195:
mov edx, 0
jmp short loc_1192 | long long func0(long long a1, int a2, int a3)
{
_DWORD *v3; // rax
unsigned long long v4; // rcx
unsigned int v5; // edx
if ( a2 > a3 )
{
return 0;
}
else
{
v3 = (_DWORD *)(a1 + 4LL * a2);
v4 = a1 + 4 * (a2 + (unsigned long long)(unsigned int)(a3 - a2)) + 4;
v5 = 0;
do
v5 += *v3++;
while ( v3 != (_DWORD *)v4 );
}
return v5;
} | func0:
ENDBR64
CMP ESI,EDX
JG 0x00101195
MOVSXD RCX,ESI
LEA RAX,[RDI + RCX*0x4]
SUB EDX,ESI
ADD RDX,RCX
LEA RCX,[RDI + RDX*0x4 + 0x4]
MOV EDX,0x0
LAB_00101187:
ADD EDX,dword ptr [RAX]
ADD RAX,0x4
CMP RAX,RCX
JNZ 0x00101187
LAB_00101192:
MOV EAX,EDX
RET
LAB_00101195:
MOV EDX,0x0
JMP 0x00101192 | int func0(long param_1,int param_2,int param_3)
{
int *piVar1;
int iVar2;
if (param_3 < param_2) {
iVar2 = 0;
}
else {
piVar1 = (int *)(param_1 + (long)param_2 * 4);
iVar2 = 0;
do {
iVar2 = iVar2 + *piVar1;
piVar1 = piVar1 + 1;
} while (piVar1 != (int *)(param_1 + 4 + ((ulong)(uint)(param_3 - param_2) + (long)param_2) * 4)
);
}
return iVar2;
} |
4,574 | func0 | #include <assert.h>
| int func0(int list1[], int m, int n) {
int sum_range = 0;
for (int i = m; i <= n; i++) {
sum_range += list1[i];
}
return sum_range;
}
| int main() {
int list1[] = {2, 1, 5, 6, 8, 3, 4, 9, 10, 11, 8, 12};
assert(func0(list1, 8, 10) == 29);
assert(func0(list1, 5, 7) == 16);
assert(func0(list1, 7, 10) == 38);
return 0;
}
| O2 | c | func0:
endbr64
cmp %edx,%esi
jg 1170 <func0+0x30>
movslq %esi,%rcx
sub %esi,%edx
xor %r8d,%r8d
add %rcx,%rdx
lea (%rdi,%rcx,4),%rax
lea 0x4(%rdi,%rdx,4),%rdx
nopl 0x0(%rax)
add (%rax),%r8d
add $0x4,%rax
cmp %rdx,%rax
jne 1160 <func0+0x20>
mov %r8d,%eax
retq
xor %r8d,%r8d
mov %r8d,%eax
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
cmp esi, edx
jg short loc_1170
movsxd rcx, esi
sub edx, esi
xor r8d, r8d
add rdx, rcx
lea rax, [rdi+rcx*4]
lea rdx, [rdi+rdx*4+4]
nop dword ptr [rax+00h]
loc_1160:
add r8d, [rax]
add rax, 4
cmp rax, rdx
jnz short loc_1160
mov eax, r8d
retn
loc_1170:
xor r8d, r8d
mov eax, r8d
retn | long long func0(long long a1, int a2, int a3)
{
unsigned int v3; // r8d
_DWORD *v4; // rax
unsigned long long v5; // rdx
if ( a2 > a3 )
return 0LL;
v3 = 0;
v4 = (_DWORD *)(a1 + 4LL * a2);
v5 = a1 + 4 * (a2 + (unsigned long long)(unsigned int)(a3 - a2)) + 4;
do
v3 += *v4++;
while ( v4 != (_DWORD *)v5 );
return v3;
} | func0:
ENDBR64
CMP ESI,EDX
JG 0x00101170
MOVSXD RCX,ESI
SUB EDX,ESI
XOR R8D,R8D
ADD RDX,RCX
LEA RAX,[RDI + RCX*0x4]
LEA RDX,[RDI + RDX*0x4 + 0x4]
NOP dword ptr [RAX]
LAB_00101160:
ADD R8D,dword ptr [RAX]
ADD RAX,0x4
CMP RAX,RDX
JNZ 0x00101160
MOV EAX,R8D
RET
LAB_00101170:
XOR R8D,R8D
MOV EAX,R8D
RET | int func0(long param_1,int param_2,int param_3)
{
int *piVar1;
int iVar2;
if (param_2 <= param_3) {
iVar2 = 0;
piVar1 = (int *)(param_1 + (long)param_2 * 4);
do {
iVar2 = iVar2 + *piVar1;
piVar1 = piVar1 + 1;
} while (piVar1 != (int *)(param_1 + 4 + ((ulong)(uint)(param_3 - param_2) + (long)param_2) * 4)
);
return iVar2;
}
return 0;
} |
4,575 | func0 | #include <assert.h>
| int func0(int list1[], int m, int n) {
int sum_range = 0;
for (int i = m; i <= n; i++) {
sum_range += list1[i];
}
return sum_range;
}
| int main() {
int list1[] = {2, 1, 5, 6, 8, 3, 4, 9, 10, 11, 8, 12};
assert(func0(list1, 8, 10) == 29);
assert(func0(list1, 5, 7) == 16);
assert(func0(list1, 7, 10) == 38);
return 0;
}
| O3 | c | func0:
endbr64
cmp %edx,%esi
jg 11f0 <func0+0xb0>
mov %edx,%eax
lea 0x1(%rdx),%r8d
sub %esi,%eax
sub %esi,%r8d
cmp $0x3,%eax
jbe 11f9 <func0+0xb9>
mov %r8d,%ecx
movslq %esi,%rax
pxor %xmm0,%xmm0
shr $0x2,%ecx
lea (%rdi,%rax,4),%rax
shl $0x4,%rcx
add %rax,%rcx
nopl 0x0(%rax,%rax,1)
movdqu (%rax),%xmm2
add $0x10,%rax
paddd %xmm2,%xmm0
cmp %rcx,%rax
jne 1180 <func0+0x40>
movdqa %xmm0,%xmm1
mov %r8d,%ecx
psrldq $0x8,%xmm1
and $0xfffffffc,%ecx
paddd %xmm1,%xmm0
add %ecx,%esi
movdqa %xmm0,%xmm1
psrldq $0x4,%xmm1
paddd %xmm1,%xmm0
movd %xmm0,%eax
cmp %ecx,%r8d
je 11f8 <func0+0xb8>
movslq %esi,%rcx
add (%rdi,%rcx,4),%eax
lea 0x1(%rsi),%ecx
cmp %ecx,%edx
jl 11f2 <func0+0xb2>
movslq %ecx,%rcx
add (%rdi,%rcx,4),%eax
lea 0x2(%rsi),%ecx
cmp %ecx,%edx
jl 11f2 <func0+0xb2>
movslq %ecx,%rcx
add $0x3,%esi
add (%rdi,%rcx,4),%eax
cmp %esi,%edx
jl 11f2 <func0+0xb2>
movslq %esi,%rsi
add (%rdi,%rsi,4),%eax
retq
nopw 0x0(%rax,%rax,1)
xor %eax,%eax
retq
nopl 0x0(%rax,%rax,1)
retq
xor %eax,%eax
jmp 11bc <func0+0x7c>
nopl (%rax)
| func0:
endbr64
mov ecx, esi
mov esi, edx
cmp ecx, edx
jg loc_11E0
mov eax, edx
sub eax, ecx
lea r8d, [rax+1]
cmp eax, 2
jbe loc_11E3
mov edx, r8d
movsxd rax, ecx
pxor xmm0, xmm0
shr edx, 2
lea rax, [rdi+rax*4]
shl rdx, 4
add rdx, rax
nop dword ptr [rax+00000000h]
loc_1180:
movdqu xmm2, xmmword ptr [rax]
add rax, 10h
paddd xmm0, xmm2
cmp rax, rdx
jnz short loc_1180
movdqa xmm1, xmm0
psrldq xmm1, 8
paddd xmm0, xmm1
movdqa xmm1, xmm0
psrldq xmm1, 4
paddd xmm0, xmm1
movd eax, xmm0
test r8b, 3
jz short locret_11E2
and r8d, 0FFFFFFFCh
add ecx, r8d
loc_11BC:
movsxd rdx, ecx
lea r8, ds:0[rdx*4]
add eax, [rdi+rdx*4]
cmp esi, ecx
jle short locret_11E2
add ecx, 2
add eax, [rdi+r8+4]
cmp esi, ecx
jl short locret_11E2
add eax, [rdi+r8+8]
retn
loc_11E0:
xor eax, eax
locret_11E2:
retn
loc_11E3:
xor eax, eax
jmp short loc_11BC | long long func0(long long a1, int a2, int a3)
{
unsigned int v5; // r8d
__m128i v6; // xmm0
const __m128i *v7; // rax
const __m128i *v8; // rdx
__m128i v9; // xmm2
__m128i v10; // xmm0
long long result; // rax
long long v12; // r8
if ( a2 > a3 )
return 0LL;
v5 = a3 - a2 + 1;
if ( (unsigned int)(a3 - a2) <= 2 )
{
LODWORD(result) = 0;
}
else
{
v6 = 0LL;
v7 = (const __m128i *)(a1 + 4LL * a2);
v8 = &v7[v5 >> 2];
do
{
v9 = _mm_loadu_si128(v7++);
v6 = _mm_add_epi32(v6, v9);
}
while ( v7 != v8 );
v10 = _mm_add_epi32(v6, _mm_srli_si128(v6, 8));
result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v10, _mm_srli_si128(v10, 4)));
if ( (v5 & 3) == 0 )
return result;
a2 += v5 & 0xFFFFFFFC;
}
v12 = 4LL * a2;
result = (unsigned int)(*(_DWORD *)(a1 + v12) + result);
if ( a3 > a2 )
{
result = (unsigned int)(*(_DWORD *)(a1 + v12 + 4) + result);
if ( a3 >= a2 + 2 )
return (unsigned int)(*(_DWORD *)(a1 + v12 + 8) + result);
}
return result;
} | func0:
ENDBR64
MOV ECX,ESI
MOV ESI,EDX
CMP ECX,EDX
JG 0x001011e0
MOV EAX,EDX
SUB EAX,ECX
LEA R8D,[RAX + 0x1]
CMP EAX,0x2
JBE 0x001011e3
MOV EDX,R8D
MOVSXD RAX,ECX
PXOR XMM0,XMM0
SHR EDX,0x2
LEA RAX,[RDI + RAX*0x4]
SHL RDX,0x4
ADD RDX,RAX
NOP dword ptr [RAX]
LAB_00101180:
MOVDQU XMM2,xmmword ptr [RAX]
ADD RAX,0x10
PADDD XMM0,XMM2
CMP RAX,RDX
JNZ 0x00101180
MOVDQA XMM1,XMM0
PSRLDQ XMM1,0x8
PADDD XMM0,XMM1
MOVDQA XMM1,XMM0
PSRLDQ XMM1,0x4
PADDD XMM0,XMM1
MOVD EAX,XMM0
TEST R8B,0x3
JZ 0x001011e2
AND R8D,0xfffffffc
ADD ECX,R8D
LAB_001011bc:
MOVSXD RDX,ECX
LEA R8,[RDX*0x4]
ADD EAX,dword ptr [RDI + RDX*0x4]
CMP ESI,ECX
JLE 0x001011e2
ADD ECX,0x2
ADD EAX,dword ptr [RDI + R8*0x1 + 0x4]
CMP ESI,ECX
JL 0x001011e2
ADD EAX,dword ptr [RDI + R8*0x1 + 0x8]
RET
LAB_001011e0:
XOR EAX,EAX
LAB_001011e2:
RET
LAB_001011e3:
XOR EAX,EAX
JMP 0x001011bc | int func0(long param_1,int param_2,int param_3)
{
uint uVar1;
long lVar2;
int iVar3;
int *piVar4;
int *piVar5;
int *piVar6;
int *piVar7;
int *piVar8;
int iVar9;
int iVar10;
int iVar11;
int iVar12;
if (param_3 < param_2) {
iVar9 = 0;
}
else {
uVar1 = (param_3 - param_2) + 1;
if ((uint)(param_3 - param_2) < 3) {
iVar9 = 0;
}
else {
iVar9 = 0;
iVar10 = 0;
iVar11 = 0;
iVar12 = 0;
piVar7 = (int *)(param_1 + (long)param_2 * 4);
piVar8 = piVar7 + (ulong)(uVar1 >> 2) * 4;
do {
iVar3 = *piVar7;
piVar4 = piVar7 + 1;
piVar5 = piVar7 + 2;
piVar6 = piVar7 + 3;
piVar7 = piVar7 + 4;
iVar9 = iVar9 + iVar3;
iVar10 = iVar10 + *piVar4;
iVar11 = iVar11 + *piVar5;
iVar12 = iVar12 + *piVar6;
} while (piVar7 != piVar8);
iVar9 = iVar9 + iVar11 + iVar10 + iVar12;
if ((uVar1 & 3) == 0) {
return iVar9;
}
param_2 = param_2 + (uVar1 & 0xfffffffc);
}
lVar2 = (long)param_2 * 4;
iVar9 = iVar9 + *(int *)(param_1 + (long)param_2 * 4);
if ((param_2 < param_3) &&
(iVar9 = iVar9 + *(int *)(param_1 + 4 + lVar2), param_2 + 2 <= param_3)) {
return iVar9 + *(int *)(param_1 + 8 + lVar2);
}
}
return iVar9;
} |
4,576 | func0 |
#include <assert.h>
#include <math.h>
| double func0(double a) {
double perimeter = 5 * a;
return perimeter;
}
| int main() {
assert(func0(5) == 25);
assert(func0(10) == 50);
assert(func0(15) == 75);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
movsd %xmm0,-0x18(%rbp)
movsd -0x18(%rbp),%xmm1
movsd 0xf15(%rip),%xmm0
mulsd %xmm1,%xmm0
movsd %xmm0,-0x8(%rbp)
movsd -0x8(%rbp),%xmm0
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
movsd [rbp+var_18], xmm0
movsd xmm1, [rbp+var_18]
movsd xmm0, cs:qword_2060
mulsd xmm0, xmm1
movsd [rbp+var_8], xmm0
movsd xmm0, [rbp+var_8]
pop rbp
retn | double func0(double a1)
{
return 5.0 * a1;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOVSD qword ptr [RBP + -0x18],XMM0
MOVSD XMM1,qword ptr [RBP + -0x18]
MOVSD XMM0,qword ptr [0x00102060]
MULSD XMM0,XMM1
MOVSD qword ptr [RBP + -0x8],XMM0
MOVSD XMM0,qword ptr [RBP + -0x8]
POP RBP
RET | double func0(double param_1)
{
return DAT_00102060 * param_1;
} |
4,577 | func0 |
#include <assert.h>
#include <math.h>
| double func0(double a) {
double perimeter = 5 * a;
return perimeter;
}
| int main() {
assert(func0(5) == 25);
assert(func0(10) == 50);
assert(func0(15) == 75);
return 0;
}
| O1 | c | func0:
endbr64
mulsd 0xed3(%rip),%xmm0
retq
| func0:
endbr64
mulsd xmm0, cs:qword_2008
retn | double func0(double a1)
{
return a1 * 5.0;
} | func0:
ENDBR64
MULSD XMM0,qword ptr [0x00102008]
RET | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
double func0(double param_1)
{
return param_1 * _DAT_00102008;
} |
4,578 | func0 |
#include <assert.h>
#include <math.h>
| double func0(double a) {
double perimeter = 5 * a;
return perimeter;
}
| int main() {
assert(func0(5) == 25);
assert(func0(10) == 50);
assert(func0(15) == 75);
return 0;
}
| O2 | c | func0:
endbr64
mulsd 0xebc(%rip),%xmm0
retq
nopl (%rax)
| func0:
endbr64
mulsd xmm0, cs:qword_2008
retn | double func0(double a1)
{
return a1 * 5.0;
} | func0:
ENDBR64
MULSD XMM0,qword ptr [0x00102008]
RET | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
double func0(double param_1)
{
return param_1 * _DAT_00102008;
} |
4,579 | func0 |
#include <assert.h>
#include <math.h>
| double func0(double a) {
double perimeter = 5 * a;
return perimeter;
}
| int main() {
assert(func0(5) == 25);
assert(func0(10) == 50);
assert(func0(15) == 75);
return 0;
}
| O3 | c | func0:
endbr64
mulsd 0xebc(%rip),%xmm0
retq
nopl (%rax)
| func0:
endbr64
mulsd xmm0, cs:qword_2008
retn | double func0(double a1)
{
return a1 * 5.0;
} | func0:
ENDBR64
MULSD XMM0,qword ptr [0x00102008]
RET | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
double func0(double param_1)
{
return param_1 * _DAT_00102008;
} |
4,580 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(const char* s) {
int count = 0;
int i;
int len = 0;
while(s[len] != '\0') {
len++;
}
for (i = 0; i < len - 2; i++) {
if (s[i] == 's' && s[i + 1] == 't' && s[i + 2] == 'd') {
count++;
}
}
return count;
}
| int main() {
assert(func0("letstdlenstdporstd") == 3);
assert(func0("truststdsolensporsd") == 1);
assert(func0("makestdsostdworthit") == 2);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
movl $0x0,-0xc(%rbp)
movl $0x0,-0x4(%rbp)
jmp 1169 <func0+0x20>
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
movslq %eax,%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
test %al,%al
jne 1165 <func0+0x1c>
movl $0x0,-0x8(%rbp)
jmp 11d0 <func0+0x87>
mov -0x8(%rbp),%eax
movslq %eax,%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
cmp $0x73,%al
jne 11cc <func0+0x83>
mov -0x8(%rbp),%eax
cltq
lea 0x1(%rax),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
cmp $0x74,%al
jne 11cc <func0+0x83>
mov -0x8(%rbp),%eax
cltq
lea 0x2(%rax),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
cmp $0x64,%al
jne 11cc <func0+0x83>
addl $0x1,-0xc(%rbp)
addl $0x1,-0x8(%rbp)
mov -0x4(%rbp),%eax
sub $0x2,%eax
cmp %eax,-0x8(%rbp)
jl 1186 <func0+0x3d>
mov -0xc(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_C], 0
mov [rbp+var_4], 0
jmp short loc_1169
loc_1165:
add [rbp+var_4], 1
loc_1169:
mov eax, [rbp+var_4]
movsxd rdx, eax
mov rax, [rbp+var_18]
add rax, rdx
movzx eax, byte ptr [rax]
test al, al
jnz short loc_1165
mov [rbp+var_8], 0
jmp short loc_11D0
loc_1186:
mov eax, [rbp+var_8]
movsxd rdx, eax
mov rax, [rbp+var_18]
add rax, rdx
movzx eax, byte ptr [rax]
cmp al, 73h ; 's'
jnz short loc_11CC
mov eax, [rbp+var_8]
cdqe
lea rdx, [rax+1]
mov rax, [rbp+var_18]
add rax, rdx
movzx eax, byte ptr [rax]
cmp al, 74h ; 't'
jnz short loc_11CC
mov eax, [rbp+var_8]
cdqe
lea rdx, [rax+2]
mov rax, [rbp+var_18]
add rax, rdx
movzx eax, byte ptr [rax]
cmp al, 64h ; 'd'
jnz short loc_11CC
add [rbp+var_C], 1
loc_11CC:
add [rbp+var_8], 1
loc_11D0:
mov eax, [rbp+var_4]
sub eax, 2
cmp [rbp+var_8], eax
jl short loc_1186
mov eax, [rbp+var_C]
pop rbp
retn | long long func0(long long a1)
{
unsigned int v2; // [rsp+Ch] [rbp-Ch]
int j; // [rsp+10h] [rbp-8h]
int i; // [rsp+14h] [rbp-4h]
v2 = 0;
for ( i = 0; *(_BYTE *)(i + a1); ++i )
;
for ( j = 0; j < i - 2; ++j )
{
if ( *(_BYTE *)(j + a1) == 115 && *(_BYTE *)(j + 1LL + a1) == 116 && *(_BYTE *)(j + 2LL + a1) == 100 )
++v2;
}
return v2;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0xc],0x0
MOV dword ptr [RBP + -0x4],0x0
JMP 0x00101169
LAB_00101165:
ADD dword ptr [RBP + -0x4],0x1
LAB_00101169:
MOV EAX,dword ptr [RBP + -0x4]
MOVSXD RDX,EAX
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
TEST AL,AL
JNZ 0x00101165
MOV dword ptr [RBP + -0x8],0x0
JMP 0x001011d0
LAB_00101186:
MOV EAX,dword ptr [RBP + -0x8]
MOVSXD RDX,EAX
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
CMP AL,0x73
JNZ 0x001011cc
MOV EAX,dword ptr [RBP + -0x8]
CDQE
LEA RDX,[RAX + 0x1]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
CMP AL,0x74
JNZ 0x001011cc
MOV EAX,dword ptr [RBP + -0x8]
CDQE
LEA RDX,[RAX + 0x2]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
CMP AL,0x64
JNZ 0x001011cc
ADD dword ptr [RBP + -0xc],0x1
LAB_001011cc:
ADD dword ptr [RBP + -0x8],0x1
LAB_001011d0:
MOV EAX,dword ptr [RBP + -0x4]
SUB EAX,0x2
CMP dword ptr [RBP + -0x8],EAX
JL 0x00101186
MOV EAX,dword ptr [RBP + -0xc]
POP RBP
RET | int func0(long param_1)
{
int4 local_14;
int4 local_10;
int4 local_c;
local_14 = 0;
for (local_c = 0; *(char *)(param_1 + local_c) != '\0'; local_c = local_c + 1) {
}
for (local_10 = 0; local_10 < local_c + -2; local_10 = local_10 + 1) {
if (((*(char *)(param_1 + local_10) == 's') && (*(char *)(param_1 + (long)local_10 + 1) == 't'))
&& (*(char *)(param_1 + (long)local_10 + 2) == 'd')) {
local_14 = local_14 + 1;
}
}
return local_14;
} |
4,581 | func0 |
#include <stdio.h>
#include <assert.h>
| int func0(const char* s) {
int count = 0;
int i;
int len = 0;
while(s[len] != '\0') {
len++;
}
for (i = 0; i < len - 2; i++) {
if (s[i] == 's' && s[i + 1] == 't' && s[i + 2] == 'd') {
count++;
}
}
return count;
}
| int main() {
assert(func0("letstdlenstdporstd") == 3);
assert(func0("truststdsolensporsd") == 1);
assert(func0("makestdsostdworthit") == 2);
return 0;
}
| O1 | c | func0:
endbr64
cmpb $0x0,(%rdi)
je 119c <func0+0x53>
mov $0x0,%eax
mov %eax,%ecx
add $0x1,%rax
cmpb $0x0,(%rdi,%rax,1)
jne 1157 <func0+0xe>
cmp $0x1,%ecx
jle 11a4 <func0+0x5b>
mov %rdi,%rax
lea -0x2(%rcx),%edx
lea 0x1(%rdi,%rdx,1),%rcx
mov $0x0,%esi
jmp 1183 <func0+0x3a>
add $0x1,%rax
cmp %rcx,%rax
je 11a1 <func0+0x58>
cmpb $0x73,(%rax)
jne 117a <func0+0x31>
cmpb $0x74,0x1(%rax)
jne 117a <func0+0x31>
cmpb $0x64,0x2(%rax)
sete %dl
movzbl %dl,%edx
add %edx,%esi
jmp 117a <func0+0x31>
mov $0x0,%esi
mov %esi,%eax
retq
mov $0x0,%esi
jmp 11a1 <func0+0x58>
| func0:
endbr64
cmp byte ptr [rdi], 0
jz short loc_119C
mov eax, 0
loc_1157:
mov ecx, eax
add rax, 1
cmp byte ptr [rdi+rax], 0
jnz short loc_1157
cmp ecx, 1
jle short loc_11A4
mov rax, rdi
lea edx, [rcx-2]
lea rcx, [rdi+rdx+1]
mov esi, 0
jmp short loc_1183
loc_117A:
add rax, 1
cmp rax, rcx
jz short loc_11A1
loc_1183:
cmp byte ptr [rax], 73h ; 's'
jnz short loc_117A
cmp byte ptr [rax+1], 74h ; 't'
jnz short loc_117A
cmp byte ptr [rax+2], 64h ; 'd'
setz dl
movzx edx, dl
add esi, edx
jmp short loc_117A
loc_119C:
mov esi, 0
loc_11A1:
mov eax, esi
retn
loc_11A4:
mov esi, 0
jmp short loc_11A1 | long long func0(_BYTE *a1)
{
long long v1; // rax
int v2; // ecx
_BYTE *v3; // rax
long long v4; // rcx
unsigned int v5; // esi
if ( *a1 )
{
v1 = 0LL;
do
v2 = v1++;
while ( a1[v1] );
if ( v2 <= 1 )
{
return 0;
}
else
{
v3 = a1;
v4 = (long long)&a1[v2 - 2 + 1];
v5 = 0;
do
{
if ( *v3 == 115 && v3[1] == 116 )
v5 += v3[2] == 100;
++v3;
}
while ( v3 != (_BYTE *)v4 );
}
}
else
{
return 0;
}
return v5;
} | func0:
ENDBR64
CMP byte ptr [RDI],0x0
JZ 0x0010119c
MOV EAX,0x0
LAB_00101157:
MOV ECX,EAX
ADD RAX,0x1
CMP byte ptr [RDI + RAX*0x1],0x0
JNZ 0x00101157
CMP ECX,0x1
JLE 0x001011a4
MOV RAX,RDI
LEA EDX,[RCX + -0x2]
LEA RCX,[RDI + RDX*0x1 + 0x1]
MOV ESI,0x0
JMP 0x00101183
LAB_0010117a:
ADD RAX,0x1
CMP RAX,RCX
JZ 0x001011a1
LAB_00101183:
CMP byte ptr [RAX],0x73
JNZ 0x0010117a
CMP byte ptr [RAX + 0x1],0x74
JNZ 0x0010117a
CMP byte ptr [RAX + 0x2],0x64
SETZ DL
MOVZX EDX,DL
ADD ESI,EDX
JMP 0x0010117a
LAB_0010119c:
MOV ESI,0x0
LAB_001011a1:
MOV EAX,ESI
RET
LAB_001011a4:
MOV ESI,0x0
JMP 0x001011a1 | int func0(char *param_1)
{
char *pcVar1;
long lVar2;
long lVar3;
int iVar4;
if (*param_1 == '\0') {
iVar4 = 0;
}
else {
lVar3 = 0;
do {
lVar2 = lVar3;
lVar3 = lVar2 + 1;
} while (param_1[lVar3] != '\0');
iVar4 = (int)lVar2;
if (iVar4 < 2) {
iVar4 = 0;
}
else {
pcVar1 = param_1 + (ulong)(iVar4 - 2) + 1;
iVar4 = 0;
do {
if ((*param_1 == 's') && (param_1[1] == 't')) {
iVar4 = iVar4 + (uint)(param_1[2] == 'd');
}
param_1 = param_1 + 1;
} while (param_1 != pcVar1);
}
}
return iVar4;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.