index
int64 0
66.5k
| func_name
stringlengths 2
5.36k
| func_dep
stringlengths 16
2.19k
| func
stringlengths 8
55.3k
| test
stringlengths 0
7.07k
| opt
stringclasses 4
values | language
stringclasses 2
values | asm
stringlengths 0
45.4k
| ida_asm
stringlengths 0
44.7k
| ida_pseudo
stringlengths 0
44.3k
| ghidra_asm
stringlengths 0
49.1k
| ghidra_pseudo
stringlengths 0
64.7k
|
---|---|---|---|---|---|---|---|---|---|---|---|
6,982 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
| char* func0(const char* test_str, int K) {
// Make a copy of the input string to tokenize
char temp_copy[1000];
strncpy(temp_copy, test_str, sizeof(temp_copy));
temp_copy[sizeof(temp_copy) - 1] = '\0';
// Allocate memory for the result
char* res = malloc(strlen(test_str) + 1);
if (!res) {
perror("malloc failed");
exit(EXIT_FAILURE);
}
res[0] = '\0';
// Tokenize and filter words
char* token = strtok(temp_copy, " ");
while (token != NULL) {
if ((int)strlen(token) != K) {
strcat(res, token);
strcat(res, " ");
}
token = strtok(NULL, " ");
}
// Remove trailing space if present
size_t len = strlen(res);
if (len > 0 && res[len - 1] == ' ') {
res[len - 1] = '\0';
}
return res;
}
| int main() {
char* result1 = func0("The person is most value tet", 3);
assert(strcmp(result1, "person is most value") == 0);
free(result1);
char* result2 = func0("If you told me about this ok", 4);
assert(strcmp(result2, "If you me about ok") == 0);
free(result2);
char* result3 = func0("Forces of darkeness is come into the play", 4);
assert(strcmp(result3, "Forces of darkeness is the") == 0);
free(result3);
return 0;
}
| O2 | c | func0:
endbr64
push %r13
mov $0x3e8,%edx
push %r12
push %rbp
mov %rdi,%rbp
push %rbx
mov %esi,%ebx
mov %rdi,%rsi
sub $0x3f8,%rsp
mov %fs:0x28,%rax
mov %rax,0x3e8(%rsp)
xor %eax,%eax
mov %rsp,%r13
mov %r13,%rdi
callq 10f0 <strncpy@plt>
mov %rbp,%rdi
movb $0x0,0x3e7(%rsp)
callq 1110 <strlen@plt>
lea 0x1(%rax),%rdi
callq 1140 <malloc@plt>
test %rax,%rax
je 14fa <func0+0x16a>
movb $0x0,(%rax)
mov %r13,%rdi
lea 0xc17(%rip),%rsi
mov %rax,%r12
callq 1160 <strtok@plt>
mov %rax,%r13
test %rax,%rax
je 147f <func0+0xef>
lea 0xc00(%rip),%rbp
nopw 0x0(%rax,%rax,1)
mov %r13,%rdi
callq 1110 <strlen@plt>
cmp %eax,%ebx
je 146d <func0+0xdd>
mov %r12,%rdi
mov (%rdi),%eax
add $0x4,%rdi
lea -0x1010101(%rax),%edx
not %eax
and %eax,%edx
and $0x80808080,%edx
je 1427 <func0+0x97>
mov %edx,%eax
mov %r13,%rsi
shr $0x10,%eax
test $0x8080,%edx
cmove %eax,%edx
lea 0x2(%rdi),%rax
cmove %rax,%rdi
mov %edx,%eax
add %dl,%al
sbb $0x3,%rdi
callq 1100 <stpcpy@plt>
mov $0x20,%edx
mov %dx,(%rax)
mov %rbp,%rsi
xor %edi,%edi
callq 1160 <strtok@plt>
mov %rax,%r13
test %rax,%rax
jne 1418 <func0+0x88>
mov %r12,%rdx
mov (%rdx),%ecx
add $0x4,%rdx
lea -0x1010101(%rcx),%eax
not %ecx
and %ecx,%eax
and $0x80808080,%eax
je 1482 <func0+0xf2>
mov %eax,%ecx
shr $0x10,%ecx
test $0x8080,%eax
cmove %ecx,%eax
lea 0x2(%rdx),%rcx
cmove %rcx,%rdx
mov %eax,%ebx
add %al,%bl
sbb $0x3,%rdx
sub %r12,%rdx
je 14c5 <func0+0x135>
lea -0x1(%r12,%rdx,1),%rax
cmpb $0x20,(%rax)
je 14f0 <func0+0x160>
mov 0x3e8(%rsp),%rax
xor %fs:0x28,%rax
jne 14f5 <func0+0x165>
add $0x3f8,%rsp
mov %r12,%rax
pop %rbx
pop %rbp
pop %r12
pop %r13
retq
nopl 0x0(%rax)
movb $0x0,(%rax)
jmp 14c5 <func0+0x135>
callq 1120 <__stack_chk_fail@plt>
lea 0xb03(%rip),%rdi
callq 1150 <perror@plt>
mov $0x1,%edi
callq 1170 <exit@plt>
| func0:
endbr64
push r14
mov edx, 3E8h
push r13
push r12
push rbp
mov rbp, rdi
push rbx
mov ebx, esi
mov rsi, rdi
sub rsp, 3F0h
mov rax, fs:28h
mov [rsp+418h+var_30], rax
xor eax, eax
mov r14, rsp
mov rdi, r14
call _strncpy
mov rdi, rbp
mov [rsp+418h+var_31], 0
call _strlen
lea rdi, [rax+1]
call _malloc
test rax, rax
jz loc_1494
mov byte ptr [rax], 0
lea r13, asc_2012; " "
mov rdi, r14
mov r12, rax
mov rsi, r13
call _strtok
mov rbp, rax
test rax, rax
jz short loc_144A
loc_1410:
mov rdi, rbp
call _strlen
cmp ebx, eax
jz short loc_1438
mov rdi, r12
call _strlen
mov rsi, rbp
lea rdi, [r12+rax]
call _stpcpy
mov edx, 20h ; ' '
mov [rax], dx
loc_1438:
mov rsi, r13
xor edi, edi
call _strtok
mov rbp, rax
test rax, rax
jnz short loc_1410
loc_144A:
mov rdi, r12
call _strlen
test rax, rax
jnz short loc_1480
loc_1457:
mov rax, [rsp+418h+var_30]
sub rax, fs:28h
jnz short loc_148F
add rsp, 3F0h
mov rax, r12
pop rbx
pop rbp
pop r12
pop r13
pop r14
retn
loc_1480:
lea rax, [r12+rax-1]
cmp byte ptr [rax], 20h ; ' '
jnz short loc_1457
mov byte ptr [rax], 0
jmp short loc_1457
loc_148F:
call ___stack_chk_fail
loc_1494:
lea rdi, aMallocFailed; "malloc failed"
call _perror
mov edi, 1
call _exit | _BYTE * func0(long long a1, int a2)
{
long long v2; // rax
_BYTE *v3; // rax
_BYTE *v4; // r12
long long i; // rbp
long long v6; // rax
long long v7; // rax
_BYTE *v9; // rax
_BYTE v10[1000]; // [rsp+0h] [rbp-418h] BYREF
unsigned long long v11; // [rsp+3E8h] [rbp-30h]
v11 = __readfsqword(0x28u);
strncpy(v10, a1, 1000LL);
v10[999] = 0;
v2 = strlen(a1);
v3 = (_BYTE *)malloc(v2 + 1);
if ( !v3 )
{
perror("malloc failed");
exit(1LL);
}
*v3 = 0;
v4 = v3;
for ( i = strtok(v10, " "); i; i = strtok(0LL, " ") )
{
if ( a2 != (unsigned int)strlen(i) )
{
v6 = strlen(v4);
*(_WORD *)stpcpy(&v4[v6], i) = 32;
}
}
v7 = strlen(v4);
if ( v7 )
{
v9 = &v4[v7 - 1];
if ( *v9 == 32 )
*v9 = 0;
}
return v4;
} | func0:
ENDBR64
PUSH R14
MOV EDX,0x3e8
PUSH R13
PUSH R12
PUSH RBP
MOV RBP,RDI
PUSH RBX
MOV EBX,ESI
MOV RSI,RDI
SUB RSP,0x3f0
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x3e8],RAX
XOR EAX,EAX
MOV R14,RSP
MOV RDI,R14
CALL 0x00101100
MOV RDI,RBP
MOV byte ptr [RSP + 0x3e7],0x0
CALL 0x00101120
LEA RDI,[RAX + 0x1]
CALL 0x00101160
TEST RAX,RAX
JZ 0x00101494
MOV byte ptr [RAX],0x0
LEA R13,[0x102012]
MOV RDI,R14
MOV R12,RAX
MOV RSI,R13
CALL 0x00101180
MOV RBP,RAX
TEST RAX,RAX
JZ 0x0010144a
LAB_00101410:
MOV RDI,RBP
CALL 0x00101120
CMP EBX,EAX
JZ 0x00101438
MOV RDI,R12
CALL 0x00101120
MOV RSI,RBP
LEA RDI,[R12 + RAX*0x1]
CALL 0x00101110
MOV EDX,0x20
MOV word ptr [RAX],DX
LAB_00101438:
MOV RSI,R13
XOR EDI,EDI
CALL 0x00101180
MOV RBP,RAX
TEST RAX,RAX
JNZ 0x00101410
LAB_0010144a:
MOV RDI,R12
CALL 0x00101120
TEST RAX,RAX
JNZ 0x00101480
LAB_00101457:
MOV RAX,qword ptr [RSP + 0x3e8]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x0010148f
ADD RSP,0x3f0
MOV RAX,R12
POP RBX
POP RBP
POP R12
POP R13
POP R14
RET
LAB_00101480:
LEA RAX,[R12 + RAX*0x1 + -0x1]
CMP byte ptr [RAX],0x20
JNZ 0x00101457
MOV byte ptr [RAX],0x0
JMP 0x00101457
LAB_0010148f:
CALL 0x00101130
LAB_00101494:
LEA RDI,[0x102004]
CALL 0x00101170
MOV EDI,0x1
CALL 0x00101190 | char * func0(char *param_1,int param_2)
{
size_t sVar1;
char *__s;
char *pcVar2;
long in_FS_OFFSET;
char acStack_418 [999];
int1 local_31;
long local_30;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
strncpy(acStack_418,param_1,1000);
local_31 = 0;
sVar1 = strlen(param_1);
__s = (char *)malloc(sVar1 + 1);
if (__s == (char *)0x0) {
perror("malloc failed");
/* WARNING: Subroutine does not return */
exit(1);
}
*__s = '\0';
pcVar2 = strtok(acStack_418," ");
while (pcVar2 != (char *)0x0) {
sVar1 = strlen(pcVar2);
if (param_2 != (int)sVar1) {
sVar1 = strlen(__s);
pcVar2 = stpcpy(__s + sVar1,pcVar2);
pcVar2[0] = ' ';
pcVar2[1] = '\0';
}
pcVar2 = strtok((char *)0x0," ");
}
sVar1 = strlen(__s);
if ((sVar1 != 0) && (__s[sVar1 - 1] == ' ')) {
__s[sVar1 - 1] = '\0';
}
if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return __s;
} |
6,983 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
| char* func0(const char* test_str, int K) {
// Make a copy of the input string to tokenize
char temp_copy[1000];
strncpy(temp_copy, test_str, sizeof(temp_copy));
temp_copy[sizeof(temp_copy) - 1] = '\0';
// Allocate memory for the result
char* res = malloc(strlen(test_str) + 1);
if (!res) {
perror("malloc failed");
exit(EXIT_FAILURE);
}
res[0] = '\0';
// Tokenize and filter words
char* token = strtok(temp_copy, " ");
while (token != NULL) {
if ((int)strlen(token) != K) {
strcat(res, token);
strcat(res, " ");
}
token = strtok(NULL, " ");
}
// Remove trailing space if present
size_t len = strlen(res);
if (len > 0 && res[len - 1] == ' ') {
res[len - 1] = '\0';
}
return res;
}
| int main() {
char* result1 = func0("The person is most value tet", 3);
assert(strcmp(result1, "person is most value") == 0);
free(result1);
char* result2 = func0("If you told me about this ok", 4);
assert(strcmp(result2, "If you me about ok") == 0);
free(result2);
char* result3 = func0("Forces of darkeness is come into the play", 4);
assert(strcmp(result3, "Forces of darkeness is the") == 0);
free(result3);
return 0;
}
| O3 | c | func0:
endbr64
push %r13
mov $0x3e8,%edx
push %r12
push %rbp
mov %rdi,%rbp
push %rbx
mov %esi,%ebx
mov %rdi,%rsi
sub $0x3f8,%rsp
mov %fs:0x28,%rax
mov %rax,0x3e8(%rsp)
xor %eax,%eax
mov %rsp,%r13
mov %r13,%rdi
callq 10f0 <strncpy@plt>
mov %rbp,%rdi
movb $0x0,0x3e7(%rsp)
callq 1110 <strlen@plt>
lea 0x1(%rax),%rdi
callq 1140 <malloc@plt>
test %rax,%rax
je 14fa <func0+0x16a>
movb $0x0,(%rax)
mov %r13,%rdi
lea 0xc17(%rip),%rsi
mov %rax,%r12
callq 1160 <strtok@plt>
mov %rax,%r13
test %rax,%rax
je 147f <func0+0xef>
lea 0xc00(%rip),%rbp
nopw 0x0(%rax,%rax,1)
mov %r13,%rdi
callq 1110 <strlen@plt>
cmp %eax,%ebx
je 146d <func0+0xdd>
mov %r12,%rdi
mov (%rdi),%eax
add $0x4,%rdi
lea -0x1010101(%rax),%edx
not %eax
and %eax,%edx
and $0x80808080,%edx
je 1427 <func0+0x97>
mov %edx,%eax
mov %r13,%rsi
shr $0x10,%eax
test $0x8080,%edx
cmove %eax,%edx
lea 0x2(%rdi),%rax
cmove %rax,%rdi
mov %edx,%eax
add %dl,%al
sbb $0x3,%rdi
callq 1100 <stpcpy@plt>
mov $0x20,%edx
mov %dx,(%rax)
mov %rbp,%rsi
xor %edi,%edi
callq 1160 <strtok@plt>
mov %rax,%r13
test %rax,%rax
jne 1418 <func0+0x88>
mov %r12,%rdx
mov (%rdx),%ecx
add $0x4,%rdx
lea -0x1010101(%rcx),%eax
not %ecx
and %ecx,%eax
and $0x80808080,%eax
je 1482 <func0+0xf2>
mov %eax,%ecx
shr $0x10,%ecx
test $0x8080,%eax
cmove %ecx,%eax
lea 0x2(%rdx),%rcx
cmove %rcx,%rdx
mov %eax,%ebx
add %al,%bl
sbb $0x3,%rdx
sub %r12,%rdx
je 14c5 <func0+0x135>
lea -0x1(%r12,%rdx,1),%rax
cmpb $0x20,(%rax)
je 14f0 <func0+0x160>
mov 0x3e8(%rsp),%rax
xor %fs:0x28,%rax
jne 14f5 <func0+0x165>
add $0x3f8,%rsp
mov %r12,%rax
pop %rbx
pop %rbp
pop %r12
pop %r13
retq
nopl 0x0(%rax)
movb $0x0,(%rax)
jmp 14c5 <func0+0x135>
callq 1120 <__stack_chk_fail@plt>
lea 0xb03(%rip),%rdi
callq 1150 <perror@plt>
mov $0x1,%edi
callq 1170 <exit@plt>
| func0:
endbr64
push r15
mov edx, 3E8h; n
push r14
mov r14d, esi
mov rsi, rdi; src
push r13
push r12
push rbp
push rbx
mov rbx, rdi
sub rsp, 3F8h
mov rax, fs:28h
mov [rsp+428h+var_40], rax
xor eax, eax
mov r15, rsp
mov rdi, r15; dest
call _strncpy
mov rdi, rbx; s
mov [rsp+428h+var_41], 0
call _strlen
lea r13, [rax+1]
mov rdi, r13; size
call _malloc
test rax, rax
jz func0_cold
mov byte ptr [rax], 0
lea r12, delim; " "
mov rdi, r15; s
mov rbp, rax
mov rsi, r12; delim
call _strtok
mov rbx, rax
test rax, rax
jz short loc_14B0
nop word ptr [rax+rax+00000000h]
loc_1460:
mov rdi, rbx; s
call _strlen
cmp r14d, eax
jz short loc_149E
mov rdi, rbp; s
call _strlen
mov rdx, r13
mov rsi, rbx
lea rdi, [rbp+rax+0]
call ___stpcpy_chk
mov rcx, rbp
mov edx, 2
mov rsi, r12
sub rcx, rax
mov rdi, rax
add rcx, r13
call ___memcpy_chk
loc_149E:
mov rsi, r12; delim
xor edi, edi; s
call _strtok
mov rbx, rax
test rax, rax
jnz short loc_1460
loc_14B0:
mov rdi, rbp; s
call _strlen
test rax, rax
jz short loc_14C7
lea rax, [rbp+rax-1]
cmp byte ptr [rax], 20h ; ' '
jz short loc_14F0
loc_14C7:
mov rax, [rsp+428h+var_40]
sub rax, fs:28h
jnz short loc_14F5
add rsp, 3F8h
mov rax, rbp
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_14F0:
mov byte ptr [rax], 0
jmp short loc_14C7
loc_14F5:
call ___stack_chk_fail | const char * func0(char *s, int a2)
{
size_t v2; // r13
const char *v3; // rax
const char *v4; // rbp
char *i; // rbx
size_t v6; // rax
long long v7; // rax
size_t v8; // rax
const char *v9; // rax
char v11[1000]; // [rsp+0h] [rbp-428h] BYREF
unsigned long long v12; // [rsp+3E8h] [rbp-40h]
v12 = __readfsqword(0x28u);
strncpy(v11, s, 0x3E8uLL);
v11[999] = 0;
v2 = strlen(s) + 1;
v3 = (const char *)malloc(v2);
if ( !v3 )
func0_cold();
*v3 = 0;
v4 = v3;
for ( i = strtok(v11, " "); i; i = strtok(0LL, " ") )
{
if ( a2 != (unsigned int)strlen(i) )
{
v6 = strlen(v4);
v7 = __stpcpy_chk(&v4[v6], i, v2);
__memcpy_chk(v7, " ", 2LL, &v4[v2 - v7]);
}
}
v8 = strlen(v4);
if ( v8 )
{
v9 = &v4[v8 - 1];
if ( *v9 == 32 )
*v9 = 0;
}
return v4;
} | func0:
ENDBR64
PUSH R15
MOV EDX,0x3e8
PUSH R14
MOV R14D,ESI
MOV RSI,RDI
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
MOV RBX,RDI
SUB RSP,0x3f8
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x3e8],RAX
XOR EAX,EAX
MOV R15,RSP
MOV RDI,R15
CALL 0x00101110
MOV RDI,RBX
MOV byte ptr [RSP + 0x3e7],0x0
CALL 0x00101120
LEA R13,[RAX + 0x1]
MOV RDI,R13
CALL 0x00101180
TEST RAX,RAX
JZ 0x001011c0
MOV byte ptr [RAX],0x0
LEA R12,[0x102012]
MOV RDI,R15
MOV RBP,RAX
MOV RSI,R12
CALL 0x001011a0
MOV RBX,RAX
TEST RAX,RAX
JZ 0x001014b0
NOP word ptr CS:[RAX + RAX*0x1]
LAB_00101460:
MOV RDI,RBX
CALL 0x00101120
CMP R14D,EAX
JZ 0x0010149e
MOV RDI,RBP
CALL 0x00101120
MOV RDX,R13
MOV RSI,RBX
LEA RDI,[RBP + RAX*0x1]
CALL 0x00101170
MOV RCX,RBP
MOV EDX,0x2
MOV RSI,R12
SUB RCX,RAX
MOV RDI,RAX
ADD RCX,R13
CALL 0x00101160
LAB_0010149e:
MOV RSI,R12
XOR EDI,EDI
CALL 0x001011a0
MOV RBX,RAX
TEST RAX,RAX
JNZ 0x00101460
LAB_001014b0:
MOV RDI,RBP
CALL 0x00101120
TEST RAX,RAX
JZ 0x001014c7
LEA RAX,[RBP + RAX*0x1 + -0x1]
CMP byte ptr [RAX],0x20
JZ 0x001014f0
LAB_001014c7:
MOV RAX,qword ptr [RSP + 0x3e8]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x001014f5
ADD RSP,0x3f8
MOV RAX,RBP
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_001014f0:
MOV byte ptr [RAX],0x0
JMP 0x001014c7
LAB_001014f5:
CALL 0x00101130 | char * func0(char *param_1,int param_2)
{
size_t sVar1;
char *__s;
char *__s_00;
size_t sVar2;
long lVar3;
long in_FS_OFFSET;
char acStack_428 [999];
int local_41;
long local_40;
local_40 = *(long *)(in_FS_OFFSET + 0x28);
strncpy(acStack_428,param_1,1000);
local_41 = 0;
sVar1 = strlen(param_1);
sVar1 = sVar1 + 1;
__s = (char *)malloc(sVar1);
if (__s == (char *)0x0) {
perror("malloc failed");
/* WARNING: Subroutine does not return */
exit(1);
}
*__s = '\0';
__s_00 = strtok(acStack_428," ");
while (__s_00 != (char *)0x0) {
sVar2 = strlen(__s_00);
if (param_2 != (int)sVar2) {
sVar2 = strlen(__s);
lVar3 = __stpcpy_chk(__s + sVar2,__s_00,sVar1);
__memcpy_chk(lVar3,&DAT_00102012,2,__s + (sVar1 - lVar3));
}
__s_00 = strtok((char *)0x0," ");
}
sVar1 = strlen(__s);
if ((sVar1 != 0) && (__s[sVar1 - 1] == ' ')) {
__s[sVar1 - 1] = '\0';
}
if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) {
return __s;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
6,984 | func0 |
#include <stdio.h>
#include <string.h>
#include <assert.h>
typedef struct {
char substring[100];
int start;
int end;
} Occurrence;
| Occurrence func0(const char *text, const char *pattern) {
Occurrence result;
char *pos = strstr(text, pattern);
if (pos) {
result.start = pos - text;
result.end = result.start + strlen(pattern);
strncpy(result.substring, pos, strlen(pattern));
result.substring[strlen(pattern)] = '\0';
} else {
result.substring[0] = '\0';
result.start = -1;
result.end = -1;
}
return result;
}
| int main() {
Occurrence res1 = func0("python programming, python language", "python");
assert(strcmp(res1.substring, "python") == 0);
assert(res1.start == 0);
assert(res1.end == 6);
Occurrence res2 = func0("python programming,programming language", "programming");
assert(strcmp(res2.substring, "programming") == 0);
assert(res2.start == 7);
assert(res2.end == 18);
Occurrence res3 = func0("python programming,programming language", "language");
assert(strcmp(res3.substring, "language") == 0);
assert(res3.start == 31);
assert(res3.end == 39);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
sub $0xb8,%rsp
mov %rdi,-0xa8(%rbp)
mov %rsi,-0xb0(%rbp)
mov %rdx,-0xb8(%rbp)
mov %fs:0x28,%rax
mov %rax,-0x18(%rbp)
xor %eax,%eax
mov -0xb8(%rbp),%rdx
mov -0xb0(%rbp),%rax
mov %rdx,%rsi
mov %rax,%rdi
callq 10f0 <strstr@plt>
mov %rax,-0x98(%rbp)
cmpq $0x0,-0x98(%rbp)
je 12b5 <func0+0xcc>
mov -0x98(%rbp),%rax
sub -0xb0(%rbp),%rax
mov %eax,-0x2c(%rbp)
mov -0x2c(%rbp),%eax
mov %eax,%ebx
mov -0xb8(%rbp),%rax
mov %rax,%rdi
callq 10b0 <strlen@plt>
add %ebx,%eax
mov %eax,-0x28(%rbp)
mov -0xb8(%rbp),%rax
mov %rax,%rdi
callq 10b0 <strlen@plt>
mov %rax,%rdx
mov -0x98(%rbp),%rcx
lea -0x90(%rbp),%rax
mov %rcx,%rsi
mov %rax,%rdi
callq 10a0 <strncpy@plt>
mov -0xb8(%rbp),%rax
mov %rax,%rdi
callq 10b0 <strlen@plt>
movb $0x0,-0x90(%rbp,%rax,1)
jmp 12ca <func0+0xe1>
movb $0x0,-0x90(%rbp)
movl $0xffffffff,-0x2c(%rbp)
movl $0xffffffff,-0x28(%rbp)
mov -0xa8(%rbp),%rax
mov -0x90(%rbp),%rcx
mov -0x88(%rbp),%rbx
mov %rcx,(%rax)
mov %rbx,0x8(%rax)
mov -0x80(%rbp),%rcx
mov -0x78(%rbp),%rbx
mov %rcx,0x10(%rax)
mov %rbx,0x18(%rax)
mov -0x70(%rbp),%rcx
mov -0x68(%rbp),%rbx
mov %rcx,0x20(%rax)
mov %rbx,0x28(%rax)
mov -0x60(%rbp),%rcx
mov -0x58(%rbp),%rbx
mov %rcx,0x30(%rax)
mov %rbx,0x38(%rax)
mov -0x50(%rbp),%rcx
mov -0x48(%rbp),%rbx
mov %rcx,0x40(%rax)
mov %rbx,0x48(%rax)
mov -0x40(%rbp),%rcx
mov -0x38(%rbp),%rbx
mov %rcx,0x50(%rax)
mov %rbx,0x58(%rax)
mov -0x30(%rbp),%rdx
mov %rdx,0x60(%rax)
mov -0x28(%rbp),%edx
mov %edx,0x68(%rax)
mov -0x18(%rbp),%rax
xor %fs:0x28,%rax
je 1358 <func0+0x16f>
callq 10c0 <__stack_chk_fail@plt>
mov -0xa8(%rbp),%rax
add $0xb8,%rsp
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
push rbx
sub rsp, 0B8h
mov [rbp+var_A8], rdi
mov [rbp+haystack], rsi
mov [rbp+needle], rdx
mov rax, fs:28h
mov [rbp+var_18], rax
xor eax, eax
mov rdx, [rbp+needle]
mov rax, [rbp+haystack]
mov rsi, rdx; needle
mov rdi, rax; haystack
call _strstr
mov [rbp+src], rax
cmp [rbp+src], 0
jz short loc_12B5
mov rax, [rbp+src]
sub rax, [rbp+haystack]
mov dword ptr [rbp+var_2C], eax
mov eax, dword ptr [rbp+var_2C]
mov ebx, eax
mov rax, [rbp+needle]
mov rdi, rax; s
call _strlen
add eax, ebx
mov dword ptr [rbp+var_2C+4], eax
mov rax, [rbp+needle]
mov rdi, rax; s
call _strlen
mov rdx, rax; n
mov rcx, [rbp+src]
lea rax, [rbp+dest]
mov rsi, rcx; src
mov rdi, rax; dest
call _strncpy
mov rax, [rbp+needle]
mov rdi, rax; s
call _strlen
mov [rbp+rax+dest], 0
jmp short loc_12CA
loc_12B5:
mov [rbp+dest], 0
mov dword ptr [rbp+var_2C], 0FFFFFFFFh
mov dword ptr [rbp+var_2C+4], 0FFFFFFFFh
loc_12CA:
mov rax, [rbp+var_A8]
mov rcx, qword ptr [rbp+dest]
mov rbx, [rbp+var_88]
mov [rax], rcx
mov [rax+8], rbx
mov rcx, [rbp+var_80]
mov rbx, [rbp+var_78]
mov [rax+10h], rcx
mov [rax+18h], rbx
mov rcx, [rbp+var_70]
mov rbx, [rbp+var_68]
mov [rax+20h], rcx
mov [rax+28h], rbx
mov rcx, [rbp+var_60]
mov rbx, [rbp+var_58]
mov [rax+30h], rcx
mov [rax+38h], rbx
mov rcx, [rbp+var_50]
mov rbx, [rbp+var_48]
mov [rax+40h], rcx
mov [rax+48h], rbx
mov rcx, [rbp+var_40]
mov rbx, [rbp+var_38]
mov [rax+50h], rcx
mov [rax+58h], rbx
mov rcx, [rbp+var_38+4]
mov rbx, [rbp+var_2C]
mov [rax+5Ch], rcx
mov [rax+64h], rbx
mov rax, [rbp+var_18]
sub rax, fs:28h
jz short loc_135A
call ___stack_chk_fail
loc_135A:
mov rax, [rbp+var_A8]
mov rbx, [rbp+var_8]
leave
retn | _QWORD * func0(_QWORD *a1, const char *a2, const char *a3)
{
size_t v3; // rax
long long v4; // rbx
long long v5; // rbx
long long v6; // rbx
long long v7; // rbx
long long v8; // rbx
long long v9; // rbx
long long v10; // rbx
const char *src; // [rsp+28h] [rbp-98h]
char dest[8]; // [rsp+30h] [rbp-90h] BYREF
long long v15; // [rsp+38h] [rbp-88h]
long long v16; // [rsp+40h] [rbp-80h]
long long v17; // [rsp+48h] [rbp-78h]
long long v18; // [rsp+50h] [rbp-70h]
long long v19; // [rsp+58h] [rbp-68h]
long long v20; // [rsp+60h] [rbp-60h]
long long v21; // [rsp+68h] [rbp-58h]
long long v22; // [rsp+70h] [rbp-50h]
long long v23; // [rsp+78h] [rbp-48h]
long long v24; // [rsp+80h] [rbp-40h]
_BYTE v25[12]; // [rsp+88h] [rbp-38h]
long long v26; // [rsp+94h] [rbp-2Ch]
unsigned long long v27; // [rsp+A8h] [rbp-18h]
v27 = __readfsqword(0x28u);
src = strstr(a2, a3);
if ( src )
{
LODWORD(v26) = (_DWORD)src - (_DWORD)a2;
HIDWORD(v26) = (_DWORD)src - (_DWORD)a2 + strlen(a3);
v3 = strlen(a3);
strncpy(dest, src, v3);
dest[strlen(a3)] = 0;
}
else
{
dest[0] = 0;
v26 = -1LL;
}
v4 = v15;
*a1 = *(_QWORD *)dest;
a1[1] = v4;
v5 = v17;
a1[2] = v16;
a1[3] = v5;
v6 = v19;
a1[4] = v18;
a1[5] = v6;
v7 = v21;
a1[6] = v20;
a1[7] = v7;
v8 = v23;
a1[8] = v22;
a1[9] = v8;
v9 = *(_QWORD *)v25;
a1[10] = v24;
a1[11] = v9;
v10 = v26;
*(_QWORD *)((char *)a1 + 92) = *(_QWORD *)&v25[4];
*(_QWORD *)((char *)a1 + 100) = v10;
return a1;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
PUSH RBX
SUB RSP,0xb8
MOV qword ptr [RBP + -0xa8],RDI
MOV qword ptr [RBP + -0xb0],RSI
MOV qword ptr [RBP + -0xb8],RDX
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x18],RAX
XOR EAX,EAX
MOV RDX,qword ptr [RBP + -0xb8]
MOV RAX,qword ptr [RBP + -0xb0]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x001010f0
MOV qword ptr [RBP + -0x98],RAX
CMP qword ptr [RBP + -0x98],0x0
JZ 0x001012b5
MOV RAX,qword ptr [RBP + -0x98]
SUB RAX,qword ptr [RBP + -0xb0]
MOV dword ptr [RBP + -0x2c],EAX
MOV EAX,dword ptr [RBP + -0x2c]
MOV EBX,EAX
MOV RAX,qword ptr [RBP + -0xb8]
MOV RDI,RAX
CALL 0x001010b0
ADD EAX,EBX
MOV dword ptr [RBP + -0x28],EAX
MOV RAX,qword ptr [RBP + -0xb8]
MOV RDI,RAX
CALL 0x001010b0
MOV RDX,RAX
MOV RCX,qword ptr [RBP + -0x98]
LEA RAX,[RBP + -0x90]
MOV RSI,RCX
MOV RDI,RAX
CALL 0x001010a0
MOV RAX,qword ptr [RBP + -0xb8]
MOV RDI,RAX
CALL 0x001010b0
MOV byte ptr [RBP + RAX*0x1 + -0x90],0x0
JMP 0x001012ca
LAB_001012b5:
MOV byte ptr [RBP + -0x90],0x0
MOV dword ptr [RBP + -0x2c],0xffffffff
MOV dword ptr [RBP + -0x28],0xffffffff
LAB_001012ca:
MOV RAX,qword ptr [RBP + -0xa8]
MOV RCX,qword ptr [RBP + -0x90]
MOV RBX,qword ptr [RBP + -0x88]
MOV qword ptr [RAX],RCX
MOV qword ptr [RAX + 0x8],RBX
MOV RCX,qword ptr [RBP + -0x80]
MOV RBX,qword ptr [RBP + -0x78]
MOV qword ptr [RAX + 0x10],RCX
MOV qword ptr [RAX + 0x18],RBX
MOV RCX,qword ptr [RBP + -0x70]
MOV RBX,qword ptr [RBP + -0x68]
MOV qword ptr [RAX + 0x20],RCX
MOV qword ptr [RAX + 0x28],RBX
MOV RCX,qword ptr [RBP + -0x60]
MOV RBX,qword ptr [RBP + -0x58]
MOV qword ptr [RAX + 0x30],RCX
MOV qword ptr [RAX + 0x38],RBX
MOV RCX,qword ptr [RBP + -0x50]
MOV RBX,qword ptr [RBP + -0x48]
MOV qword ptr [RAX + 0x40],RCX
MOV qword ptr [RAX + 0x48],RBX
MOV RCX,qword ptr [RBP + -0x40]
MOV RBX,qword ptr [RBP + -0x38]
MOV qword ptr [RAX + 0x50],RCX
MOV qword ptr [RAX + 0x58],RBX
MOV RCX,qword ptr [RBP + -0x34]
MOV RBX,qword ptr [RBP + -0x2c]
MOV qword ptr [RAX + 0x5c],RCX
MOV qword ptr [RAX + 0x64],RBX
MOV RAX,qword ptr [RBP + -0x18]
SUB RAX,qword ptr FS:[0x28]
JZ 0x0010135a
CALL 0x001010c0
LAB_0010135a:
MOV RAX,qword ptr [RBP + -0xa8]
MOV RBX,qword ptr [RBP + -0x8]
LEAVE
RET | int8 * func0(int8 *param_1,char *param_2,char *param_3)
{
int iVar1;
char *__src;
size_t sVar2;
long in_FS_OFFSET;
char local_98;
int7 uStack_97;
int8 local_90;
int8 local_88;
int8 local_80;
int8 local_78;
int8 local_70;
int8 local_68;
int8 local_60;
int8 local_58;
int8 local_50;
int8 local_48;
int4 local_40;
int4 uStack_3c;
int4 uStack_38;
int local_34;
int iStack_30;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
__src = strstr(param_2,param_3);
if (__src == (char *)0x0) {
local_98 = '\0';
local_34 = -1;
iStack_30 = -1;
}
else {
iVar1 = (int)__src - (int)param_2;
local_34 = iVar1;
sVar2 = strlen(param_3);
iStack_30 = (int)sVar2 + iVar1;
sVar2 = strlen(param_3);
strncpy(&local_98,__src,sVar2);
sVar2 = strlen(param_3);
(&local_98)[sVar2] = '\0';
}
*param_1 = CONCAT71(uStack_97,local_98);
param_1[1] = local_90;
param_1[2] = local_88;
param_1[3] = local_80;
param_1[4] = local_78;
param_1[5] = local_70;
param_1[6] = local_68;
param_1[7] = local_60;
param_1[8] = local_58;
param_1[9] = local_50;
param_1[10] = local_48;
param_1[0xb] = CONCAT44(uStack_3c,local_40);
*(ulong *)((long)param_1 + 0x5c) = CONCAT44(uStack_38,uStack_3c);
*(ulong *)((long)param_1 + 100) = CONCAT44(iStack_30,local_34);
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return param_1;
} |
6,985 | func0 |
#include <stdio.h>
#include <string.h>
#include <assert.h>
typedef struct {
char substring[100];
int start;
int end;
} Occurrence;
| Occurrence func0(const char *text, const char *pattern) {
Occurrence result;
char *pos = strstr(text, pattern);
if (pos) {
result.start = pos - text;
result.end = result.start + strlen(pattern);
strncpy(result.substring, pos, strlen(pattern));
result.substring[strlen(pattern)] = '\0';
} else {
result.substring[0] = '\0';
result.start = -1;
result.end = -1;
}
return result;
}
| int main() {
Occurrence res1 = func0("python programming, python language", "python");
assert(strcmp(res1.substring, "python") == 0);
assert(res1.start == 0);
assert(res1.end == 6);
Occurrence res2 = func0("python programming,programming language", "programming");
assert(strcmp(res2.substring, "programming") == 0);
assert(res2.start == 7);
assert(res2.end == 18);
Occurrence res3 = func0("python programming,programming language", "language");
assert(strcmp(res3.substring, "language") == 0);
assert(res3.start == 31);
assert(res3.end == 39);
return 0;
}
| O1 | c | func0:
endbr64
push %r13
push %r12
push %rbp
push %rbx
sub $0x88,%rsp
mov %rdi,%rbx
mov %rsi,%r12
mov %rdx,%rbp
mov %fs:0x28,%rax
mov %rax,0x78(%rsp)
xor %eax,%eax
mov %rdx,%rsi
mov %r12,%rdi
callq 10b0 <strstr@plt>
test %rax,%rax
je 12b7 <func0+0x10e>
mov %rax,%rsi
mov %rax,%rdx
sub %r12,%rdx
mov %edx,0x64(%rsp)
mov $0xffffffffffffffff,%r13
mov $0x0,%r12d
mov %r13,%rcx
mov %rbp,%rdi
mov %r12d,%eax
repnz scas %es:(%rdi),%al
not %rcx
lea -0x1(%rcx,%rdx,1),%eax
mov %eax,0x68(%rsp)
mov %r13,%rcx
mov %rbp,%rdi
mov %r12d,%eax
repnz scas %es:(%rdi),%al
not %rcx
lea -0x1(%rcx),%rdx
mov %rsp,%rdi
mov $0x64,%ecx
callq 10a0 <__strncpy_chk@plt>
mov %r13,%rcx
mov %rbp,%rdi
mov %r12d,%eax
repnz scas %es:(%rdi),%al
mov %rcx,%rbp
not %rbp
movb $0x0,-0x1(%rsp,%rbp,1)
movdqa (%rsp),%xmm0
movups %xmm0,(%rbx)
movdqa 0x10(%rsp),%xmm1
movups %xmm1,0x10(%rbx)
movdqa 0x20(%rsp),%xmm2
movups %xmm2,0x20(%rbx)
movdqa 0x30(%rsp),%xmm3
movups %xmm3,0x30(%rbx)
movdqa 0x40(%rsp),%xmm4
movups %xmm4,0x40(%rbx)
movdqa 0x50(%rsp),%xmm5
movups %xmm5,0x50(%rbx)
mov 0x60(%rsp),%rax
mov %rax,0x60(%rbx)
mov 0x68(%rsp),%eax
mov %eax,0x68(%rbx)
mov 0x78(%rsp),%rax
xor %fs:0x28,%rax
jne 12d0 <func0+0x127>
mov %rbx,%rax
add $0x88,%rsp
pop %rbx
pop %rbp
pop %r12
pop %r13
retq
movb $0x0,(%rsp)
movl $0xffffffff,0x64(%rsp)
movl $0xffffffff,0x68(%rsp)
jmpq 124c <func0+0xa3>
callq 1080 <__stack_chk_fail@plt>
| func0:
endbr64
push r14
push r13
push r12
push rbp
push rbx
add rsp, 0FFFFFFFFFFFFFF80h
mov rbx, rdi
mov r13, rsi
mov rbp, rdx
mov rax, fs:28h
mov [rsp+0A8h+var_30], rax
xor eax, eax
mov rsi, rdx
mov rdi, r13
call _strstr
test rax, rax
jz loc_12D5
mov r12, rax
mov r14, rax
sub r14, r13
mov [rsp+0A8h+var_44], r14d
mov rdi, rbp
call _strlen
add r14d, eax
mov [rsp+0A8h+var_40], r14d
mov rdi, rbp
call _strlen
mov rdx, rax
mov rdi, rsp
mov ecx, 64h ; 'd'
mov rsi, r12
call ___strncpy_chk
mov rdi, rbp
call _strlen
mov byte ptr [rsp+rax+0A8h+var_A8], 0
loc_126B:
movdqa xmm0, [rsp+0A8h+var_A8]
movups xmmword ptr [rbx], xmm0
movdqa xmm1, [rsp+0A8h+var_98]
movups xmmword ptr [rbx+10h], xmm1
movdqa xmm2, [rsp+0A8h+var_88]
movups xmmword ptr [rbx+20h], xmm2
movdqa xmm3, [rsp+0A8h+var_78]
movups xmmword ptr [rbx+30h], xmm3
movdqa xmm4, [rsp+0A8h+var_68]
movups xmmword ptr [rbx+40h], xmm4
movdqa xmm5, [rsp+0A8h+var_58]
movups xmmword ptr [rbx+50h], xmm5
mov rax, [rsp+60h]
mov [rbx+60h], rax
mov eax, [rsp+0A8h+var_40]
mov [rbx+68h], eax
mov rax, [rsp+0A8h+var_30]
sub rax, fs:28h
jnz short loc_12EB
mov rax, rbx
sub rsp, 0FFFFFFFFFFFFFF80h
pop rbx
pop rbp
pop r12
pop r13
pop r14
retn
loc_12D5:
mov byte ptr [rsp+0A8h+var_A8], 0
mov [rsp+0A8h+var_44], 0FFFFFFFFh
mov [rsp+0A8h+var_40], 0FFFFFFFFh
jmp short loc_126B
loc_12EB:
call ___stack_chk_fail | __m128i * func0(__m128i *a1, long long a2, long long a3)
{
long long v4; // rax
long long v5; // r12
long long v6; // rax
__m128i v8; // [rsp+0h] [rbp-A8h] BYREF
__m128i v9; // [rsp+10h] [rbp-98h] BYREF
__m128i v10; // [rsp+20h] [rbp-88h] BYREF
__m128i v11; // [rsp+30h] [rbp-78h] BYREF
__m128i v12; // [rsp+40h] [rbp-68h] BYREF
__m128i v13; // [rsp+50h] [rbp-58h] BYREF
long long v14; // [rsp+60h] [rbp-48h]
int v15; // [rsp+68h] [rbp-40h]
unsigned long long v16; // [rsp+78h] [rbp-30h]
v16 = __readfsqword(0x28u);
v4 = strstr(a2, a3);
if ( v4 )
{
v5 = v4;
HIDWORD(v14) = v4 - a2;
v15 = strlen(a3) + v4 - a2;
v6 = strlen(a3);
__strncpy_chk(&v8, v5, v6, 100LL);
v8.m128i_i8[strlen(a3)] = 0;
}
else
{
v8.m128i_i8[0] = 0;
HIDWORD(v14) = -1;
v15 = -1;
}
*a1 = _mm_load_si128(&v8);
a1[1] = _mm_load_si128(&v9);
a1[2] = _mm_load_si128(&v10);
a1[3] = _mm_load_si128(&v11);
a1[4] = _mm_load_si128(&v12);
a1[5] = _mm_load_si128(&v13);
a1[6].m128i_i64[0] = v14;
a1[6].m128i_i32[2] = v15;
return a1;
} | func0:
ENDBR64
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
ADD RSP,-0x80
MOV RBX,RDI
MOV R13,RSI
MOV RBP,RDX
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x78],RAX
XOR EAX,EAX
MOV RSI,RDX
MOV RDI,R13
CALL 0x001010f0
TEST RAX,RAX
JZ 0x001012d5
MOV R12,RAX
MOV R14,RAX
SUB R14,R13
MOV dword ptr [RSP + 0x64],R14D
MOV RDI,RBP
CALL 0x001010a0
ADD R14D,EAX
MOV dword ptr [RSP + 0x68],R14D
MOV RDI,RBP
CALL 0x001010a0
MOV RDX,RAX
MOV RDI,RSP
MOV ECX,0x64
MOV RSI,R12
CALL 0x001010e0
MOV RDI,RBP
CALL 0x001010a0
MOV byte ptr [RSP + RAX*0x1],0x0
LAB_0010126b:
MOVDQA XMM0,xmmword ptr [RSP]
MOVUPS xmmword ptr [RBX],XMM0
MOVDQA XMM1,xmmword ptr [RSP + 0x10]
MOVUPS xmmword ptr [RBX + 0x10],XMM1
MOVDQA XMM2,xmmword ptr [RSP + 0x20]
MOVUPS xmmword ptr [RBX + 0x20],XMM2
MOVDQA XMM3,xmmword ptr [RSP + 0x30]
MOVUPS xmmword ptr [RBX + 0x30],XMM3
MOVDQA XMM4,xmmword ptr [RSP + 0x40]
MOVUPS xmmword ptr [RBX + 0x40],XMM4
MOVDQA XMM5,xmmword ptr [RSP + 0x50]
MOVUPS xmmword ptr [RBX + 0x50],XMM5
MOV RAX,qword ptr [RSP + 0x60]
MOV qword ptr [RBX + 0x60],RAX
MOV EAX,dword ptr [RSP + 0x68]
MOV dword ptr [RBX + 0x68],EAX
MOV RAX,qword ptr [RSP + 0x78]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x001012eb
MOV RAX,RBX
SUB RSP,-0x80
POP RBX
POP RBP
POP R12
POP R13
POP R14
RET
LAB_001012d5:
MOV byte ptr [RSP],0x0
MOV dword ptr [RSP + 0x64],0xffffffff
MOV dword ptr [RSP + 0x68],0xffffffff
JMP 0x0010126b
LAB_001012eb:
CALL 0x001010b0 | int8 * func0(int8 *param_1,char *param_2,char *param_3)
{
char *pcVar1;
size_t sVar2;
int iVar3;
long in_FS_OFFSET;
int1 local_a8;
int7 uStack_a7;
int8 uStack_a0;
int8 local_98;
int8 uStack_90;
int8 local_88;
int8 uStack_80;
int8 local_78;
int8 uStack_70;
int8 local_68;
int8 uStack_60;
int8 local_58;
int8 uStack_50;
int4 local_48;
int iStack_44;
int local_40;
long local_30;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
pcVar1 = strstr(param_2,param_3);
if (pcVar1 == (char *)0x0) {
local_a8 = 0;
iStack_44 = -1;
local_40 = -1;
}
else {
iVar3 = (int)pcVar1 - (int)param_2;
iStack_44 = iVar3;
sVar2 = strlen(param_3);
local_40 = iVar3 + (int)sVar2;
sVar2 = strlen(param_3);
__strncpy_chk(&local_a8,pcVar1,sVar2,100);
sVar2 = strlen(param_3);
(&local_a8)[sVar2] = 0;
}
*param_1 = CONCAT71(uStack_a7,local_a8);
param_1[1] = uStack_a0;
param_1[2] = local_98;
param_1[3] = uStack_90;
param_1[4] = local_88;
param_1[5] = uStack_80;
param_1[6] = local_78;
param_1[7] = uStack_70;
param_1[8] = local_68;
param_1[9] = uStack_60;
param_1[10] = local_58;
param_1[0xb] = uStack_50;
param_1[0xc] = CONCAT44(iStack_44,local_48);
*(int *)(param_1 + 0xd) = local_40;
if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) {
return param_1;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
6,986 | func0 |
#include <stdio.h>
#include <string.h>
#include <assert.h>
typedef struct {
char substring[100];
int start;
int end;
} Occurrence;
| Occurrence func0(const char *text, const char *pattern) {
Occurrence result;
char *pos = strstr(text, pattern);
if (pos) {
result.start = pos - text;
result.end = result.start + strlen(pattern);
strncpy(result.substring, pos, strlen(pattern));
result.substring[strlen(pattern)] = '\0';
} else {
result.substring[0] = '\0';
result.start = -1;
result.end = -1;
}
return result;
}
| int main() {
Occurrence res1 = func0("python programming, python language", "python");
assert(strcmp(res1.substring, "python") == 0);
assert(res1.start == 0);
assert(res1.end == 6);
Occurrence res2 = func0("python programming,programming language", "programming");
assert(strcmp(res2.substring, "programming") == 0);
assert(res2.start == 7);
assert(res2.end == 18);
Occurrence res3 = func0("python programming,programming language", "language");
assert(strcmp(res3.substring, "language") == 0);
assert(res3.start == 31);
assert(res3.end == 39);
return 0;
}
| O2 | c | func0:
endbr64
push %r14
push %r13
mov %rdx,%r13
push %r12
mov %rdi,%r12
push %rbp
push %rbx
mov %rsi,%rbx
mov %rdx,%rsi
mov %rbx,%rdi
add $0xffffffffffffff80,%rsp
mov %fs:0x28,%rax
mov %rax,0x78(%rsp)
xor %eax,%eax
callq 10d0 <strstr@plt>
test %rax,%rax
je 1500 <func0+0xf0>
mov %rax,%r14
mov %r13,%rdi
mov %rax,%rbp
sub %rbx,%r14
mov %r14d,0x64(%rsp)
callq 1090 <strlen@plt>
mov %rsp,%rdi
mov $0x64,%ecx
mov %rbp,%rsi
mov %rax,%rbx
add %eax,%r14d
mov %rax,%rdx
mov %r14d,0x68(%rsp)
callq 10c0 <__strncpy_chk@plt>
movb $0x0,(%rsp,%rbx,1)
mov 0x60(%rsp),%rax
movdqa (%rsp),%xmm0
movdqa 0x10(%rsp),%xmm1
movdqa 0x20(%rsp),%xmm2
mov %rax,0x60(%r12)
mov 0x68(%rsp),%eax
movdqa 0x30(%rsp),%xmm3
movdqa 0x40(%rsp),%xmm4
movups %xmm0,(%r12)
mov %eax,0x68(%r12)
movdqa 0x50(%rsp),%xmm5
movups %xmm1,0x10(%r12)
movups %xmm2,0x20(%r12)
movups %xmm3,0x30(%r12)
movups %xmm4,0x40(%r12)
movups %xmm5,0x50(%r12)
mov 0x78(%rsp),%rax
xor %fs:0x28,%rax
jne 1512 <func0+0x102>
sub $0xffffffffffffff80,%rsp
mov %r12,%rax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
retq
xchg %ax,%ax
movb $0x0,(%rsp)
movq $0xffffffffffffffff,0x64(%rsp)
jmpq 1485 <func0+0x75>
callq 10a0 <__stack_chk_fail@plt>
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
push r14
push r13
mov r13, rdx
push r12
mov r12, rdi
push rbp
push rbx
mov rbx, rsi
mov rsi, rdx
mov rdi, rbx
add rsp, 0FFFFFFFFFFFFFF80h
mov rax, fs:28h
mov [rsp+0A8h+var_30], rax
xor eax, eax
call _strstr
test rax, rax
jz loc_1500
mov r14, rax
mov rdi, r13
mov rbp, rax
sub r14, rbx
mov dword ptr [rsp+0A8h+var_44], r14d
call _strlen
mov rdi, rsp
mov ecx, 64h ; 'd'
mov rsi, rbp
mov rbx, rax
add r14d, eax
mov rdx, rax
mov dword ptr [rsp+0A8h+var_44+4], r14d
call ___strncpy_chk
mov byte ptr [rsp+rbx+0A8h+var_A8], 0
loc_1485:
mov rax, [rsp+60h]
movdqa xmm0, [rsp+0A8h+var_A8]
movdqa xmm1, [rsp+0A8h+var_98]
movdqa xmm2, [rsp+0A8h+var_88]
mov [r12+60h], rax
mov eax, dword ptr [rsp+0A8h+var_44+4]
movdqa xmm3, [rsp+0A8h+var_78]
movdqa xmm4, [rsp+0A8h+var_68]
movups xmmword ptr [r12], xmm0
movdqa xmm5, [rsp+0A8h+var_58]
mov [r12+68h], eax
movups xmmword ptr [r12+10h], xmm1
movups xmmword ptr [r12+20h], xmm2
movups xmmword ptr [r12+30h], xmm3
movups xmmword ptr [r12+40h], xmm4
movups xmmword ptr [r12+50h], xmm5
mov rax, [rsp+0A8h+var_30]
sub rax, fs:28h
jnz short loc_1512
sub rsp, 0FFFFFFFFFFFFFF80h
mov rax, r12
pop rbx
pop rbp
pop r12
pop r13
pop r14
retn
loc_1500:
mov byte ptr [rsp+0A8h+var_A8], 0
mov [rsp+0A8h+var_44], 0FFFFFFFFFFFFFFFFh
jmp loc_1485
loc_1512:
call ___stack_chk_fail | __m128i * func0(__m128i *a1, long long a2, long long a3)
{
long long v4; // rax
long long v5; // rbp
int v6; // r14d
long long v7; // rbx
__m128i v8; // xmm0
__m128i v9; // xmm1
__m128i v10; // xmm2
__int32 v11; // eax
__m128i v12; // xmm3
__m128i v13; // xmm4
__m128i v14; // xmm5
__m128i v16; // [rsp+0h] [rbp-A8h] BYREF
__m128i v17; // [rsp+10h] [rbp-98h] BYREF
__m128i v18; // [rsp+20h] [rbp-88h] BYREF
__m128i v19; // [rsp+30h] [rbp-78h] BYREF
__m128i v20; // [rsp+40h] [rbp-68h] BYREF
__m128i v21; // [rsp+50h] [rbp-58h] BYREF
_BYTE v22[12]; // [rsp+60h] [rbp-48h]
unsigned long long v23; // [rsp+78h] [rbp-30h]
v23 = __readfsqword(0x28u);
v4 = strstr(a2, a3);
if ( v4 )
{
v5 = v4;
v6 = v4 - a2;
*(_DWORD *)&v22[4] = v4 - a2;
v7 = strlen(a3);
*(_DWORD *)&v22[8] = v7 + v6;
__strncpy_chk(&v16, v5, v7, 100LL);
v16.m128i_i8[v7] = 0;
}
else
{
v16.m128i_i8[0] = 0;
*(_QWORD *)&v22[4] = -1LL;
}
v8 = _mm_load_si128(&v16);
v9 = _mm_load_si128(&v17);
v10 = _mm_load_si128(&v18);
a1[6].m128i_i64[0] = *(_QWORD *)v22;
v11 = *(_DWORD *)&v22[8];
v12 = _mm_load_si128(&v19);
v13 = _mm_load_si128(&v20);
*a1 = v8;
v14 = _mm_load_si128(&v21);
a1[6].m128i_i32[2] = v11;
a1[1] = v9;
a1[2] = v10;
a1[3] = v12;
a1[4] = v13;
a1[5] = v14;
return a1;
} | func0:
ENDBR64
PUSH R14
PUSH R13
MOV R13,RDX
PUSH R12
MOV R12,RDI
PUSH RBP
PUSH RBX
MOV RBX,RSI
MOV RSI,RDX
MOV RDI,RBX
ADD RSP,-0x80
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x78],RAX
XOR EAX,EAX
CALL 0x001010d0
TEST RAX,RAX
JZ 0x00101500
MOV R14,RAX
MOV RDI,R13
MOV RBP,RAX
SUB R14,RBX
MOV dword ptr [RSP + 0x64],R14D
CALL 0x00101090
MOV RDI,RSP
MOV ECX,0x64
MOV RSI,RBP
MOV RBX,RAX
ADD R14D,EAX
MOV RDX,RAX
MOV dword ptr [RSP + 0x68],R14D
CALL 0x001010c0
MOV byte ptr [RSP + RBX*0x1],0x0
LAB_00101485:
MOV RAX,qword ptr [RSP + 0x60]
MOVDQA XMM0,xmmword ptr [RSP]
MOVDQA XMM1,xmmword ptr [RSP + 0x10]
MOVDQA XMM2,xmmword ptr [RSP + 0x20]
MOV qword ptr [R12 + 0x60],RAX
MOV EAX,dword ptr [RSP + 0x68]
MOVDQA XMM3,xmmword ptr [RSP + 0x30]
MOVDQA XMM4,xmmword ptr [RSP + 0x40]
MOVUPS xmmword ptr [R12],XMM0
MOVDQA XMM5,xmmword ptr [RSP + 0x50]
MOV dword ptr [R12 + 0x68],EAX
MOVUPS xmmword ptr [R12 + 0x10],XMM1
MOVUPS xmmword ptr [R12 + 0x20],XMM2
MOVUPS xmmword ptr [R12 + 0x30],XMM3
MOVUPS xmmword ptr [R12 + 0x40],XMM4
MOVUPS xmmword ptr [R12 + 0x50],XMM5
MOV RAX,qword ptr [RSP + 0x78]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x00101512
SUB RSP,-0x80
MOV RAX,R12
POP RBX
POP RBP
POP R12
POP R13
POP R14
RET
LAB_00101500:
MOV byte ptr [RSP],0x0
MOV qword ptr [RSP + 0x64],-0x1
JMP 0x00101485
LAB_00101512:
CALL 0x001010a0 | int8 * func0(int8 *param_1,char *param_2,char *param_3)
{
char *pcVar1;
size_t sVar2;
int iVar3;
long in_FS_OFFSET;
int1 local_a8;
int7 uStack_a7;
int8 uStack_a0;
int8 local_98;
int8 uStack_90;
int8 local_88;
int8 uStack_80;
int8 local_78;
int8 uStack_70;
int8 local_68;
int8 uStack_60;
int8 local_58;
int8 uStack_50;
int4 local_48;
int iStack_44;
int local_40;
long local_30;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
pcVar1 = strstr(param_2,param_3);
if (pcVar1 == (char *)0x0) {
local_a8 = 0;
iStack_44 = -1;
local_40 = -1;
}
else {
iVar3 = (int)pcVar1 - (int)param_2;
iStack_44 = iVar3;
sVar2 = strlen(param_3);
local_40 = iVar3 + (int)sVar2;
__strncpy_chk(&local_a8,pcVar1,sVar2,100);
(&local_a8)[sVar2] = 0;
}
param_1[0xc] = CONCAT44(iStack_44,local_48);
*param_1 = CONCAT71(uStack_a7,local_a8);
param_1[1] = uStack_a0;
*(int *)(param_1 + 0xd) = local_40;
param_1[2] = local_98;
param_1[3] = uStack_90;
param_1[4] = local_88;
param_1[5] = uStack_80;
param_1[6] = local_78;
param_1[7] = uStack_70;
param_1[8] = local_68;
param_1[9] = uStack_60;
param_1[10] = local_58;
param_1[0xb] = uStack_50;
if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) {
return param_1;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
6,987 | func0 |
#include <stdio.h>
#include <string.h>
#include <assert.h>
typedef struct {
char substring[100];
int start;
int end;
} Occurrence;
| Occurrence func0(const char *text, const char *pattern) {
Occurrence result;
char *pos = strstr(text, pattern);
if (pos) {
result.start = pos - text;
result.end = result.start + strlen(pattern);
strncpy(result.substring, pos, strlen(pattern));
result.substring[strlen(pattern)] = '\0';
} else {
result.substring[0] = '\0';
result.start = -1;
result.end = -1;
}
return result;
}
| int main() {
Occurrence res1 = func0("python programming, python language", "python");
assert(strcmp(res1.substring, "python") == 0);
assert(res1.start == 0);
assert(res1.end == 6);
Occurrence res2 = func0("python programming,programming language", "programming");
assert(strcmp(res2.substring, "programming") == 0);
assert(res2.start == 7);
assert(res2.end == 18);
Occurrence res3 = func0("python programming,programming language", "language");
assert(strcmp(res3.substring, "language") == 0);
assert(res3.start == 31);
assert(res3.end == 39);
return 0;
}
| O3 | c | func0:
endbr64
push %r14
push %r13
mov %rdx,%r13
push %r12
mov %rdi,%r12
push %rbp
push %rbx
mov %rsi,%rbx
mov %rdx,%rsi
mov %rbx,%rdi
add $0xffffffffffffff80,%rsp
mov %fs:0x28,%rax
mov %rax,0x78(%rsp)
xor %eax,%eax
callq 10d0 <strstr@plt>
test %rax,%rax
je 1500 <func0+0xf0>
mov %rax,%r14
mov %r13,%rdi
mov %rax,%rbp
sub %rbx,%r14
mov %r14d,0x64(%rsp)
callq 1090 <strlen@plt>
mov %rsp,%rdi
mov $0x64,%ecx
mov %rbp,%rsi
mov %rax,%rbx
add %eax,%r14d
mov %rax,%rdx
mov %r14d,0x68(%rsp)
callq 10c0 <__strncpy_chk@plt>
movb $0x0,(%rsp,%rbx,1)
mov 0x60(%rsp),%rax
movdqa (%rsp),%xmm0
movdqa 0x10(%rsp),%xmm1
movdqa 0x20(%rsp),%xmm2
mov %rax,0x60(%r12)
mov 0x68(%rsp),%eax
movdqa 0x30(%rsp),%xmm3
movdqa 0x40(%rsp),%xmm4
movups %xmm0,(%r12)
mov %eax,0x68(%r12)
movdqa 0x50(%rsp),%xmm5
movups %xmm1,0x10(%r12)
movups %xmm2,0x20(%r12)
movups %xmm3,0x30(%r12)
movups %xmm4,0x40(%r12)
movups %xmm5,0x50(%r12)
mov 0x78(%rsp),%rax
xor %fs:0x28,%rax
jne 1512 <func0+0x102>
sub $0xffffffffffffff80,%rsp
mov %r12,%rax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
retq
xchg %ax,%ax
movb $0x0,(%rsp)
movq $0xffffffffffffffff,0x64(%rsp)
jmpq 1485 <func0+0x75>
callq 10a0 <__stack_chk_fail@plt>
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
push r14
push r13
mov r13, rsi
mov rsi, rdx; needle
push r12
mov r12, rdx
push rbp
push rbx
mov rbx, rdi
mov rdi, r13; haystack
add rsp, 0FFFFFFFFFFFFFF80h
mov rax, fs:28h
mov [rsp+0A8h+var_30], rax
xor eax, eax
call _strstr
test rax, rax
jz loc_14F0
mov r14, rax
mov rdi, r12; s
mov rbp, rax
sub r14, r13
mov dword ptr [rsp+0A8h+var_44], r14d
call _strlen
mov rdi, rsp
mov ecx, 64h ; 'd'
mov rsi, rbp
mov r12, rax
add r14d, eax
mov rdx, rax
mov dword ptr [rsp+0A8h+var_44+4], r14d
call ___strncpy_chk
mov byte ptr [rsp+r12+0A8h+var_A8], 0
loc_1486:
movdqa xmm0, [rsp+0A8h+var_A8]
movdqa xmm1, [rsp+0A8h+var_98]
movdqa xmm2, [rsp+0A8h+var_88]
movdqa xmm3, [rsp+0A8h+var_78]
movdqa xmm4, [rsp+0A8h+var_68]
movdqa xmm5, [rsp+0A8h+var_58]
movups xmmword ptr [rbx], xmm0
movdqu xmm6, [rsp+0A8h+var_58+0Ch]
movups xmmword ptr [rbx+10h], xmm1
movups xmmword ptr [rbx+50h], xmm5
movups xmmword ptr [rbx+20h], xmm2
movups xmmword ptr [rbx+30h], xmm3
movups xmmword ptr [rbx+40h], xmm4
movups xmmword ptr [rbx+5Ch], xmm6
mov rax, [rsp+0A8h+var_30]
sub rax, fs:28h
jnz short loc_14FF
sub rsp, 0FFFFFFFFFFFFFF80h
mov rax, rbx
pop rbx
pop rbp
pop r12
pop r13
pop r14
retn
loc_14F0:
mov byte ptr [rsp+0A8h+var_A8], 0
mov [rsp+0A8h+var_44], 0FFFFFFFFFFFFFFFFh
jmp short loc_1486
loc_14FF:
call ___stack_chk_fail | long long func0(long long a1, const char *a2, const char *a3)
{
char *v4; // rax
char *v5; // rbp
int v6; // r14d
size_t v7; // r12
__m128i v8; // xmm1
__m128i v9; // xmm2
__m128i v10; // xmm3
__m128i v11; // xmm4
__m128i v12; // xmm5
__m128i v13; // xmm6
__m128i v15; // [rsp+0h] [rbp-A8h] BYREF
__m128i v16; // [rsp+10h] [rbp-98h] BYREF
__m128i v17; // [rsp+20h] [rbp-88h] BYREF
__m128i v18; // [rsp+30h] [rbp-78h] BYREF
__m128i v19; // [rsp+40h] [rbp-68h] BYREF
__m128i v20; // [rsp+50h] [rbp-58h] BYREF
long long v21; // [rsp+64h] [rbp-44h]
unsigned long long v22; // [rsp+78h] [rbp-30h]
v22 = __readfsqword(0x28u);
v4 = strstr(a2, a3);
if ( v4 )
{
v5 = v4;
v6 = (_DWORD)v4 - (_DWORD)a2;
LODWORD(v21) = (_DWORD)v4 - (_DWORD)a2;
v7 = strlen(a3);
HIDWORD(v21) = v7 + v6;
__strncpy_chk(&v15, v5, v7, 100LL);
v15.m128i_i8[v7] = 0;
}
else
{
v15.m128i_i8[0] = 0;
v21 = -1LL;
}
v8 = _mm_load_si128(&v16);
v9 = _mm_load_si128(&v17);
v10 = _mm_load_si128(&v18);
v11 = _mm_load_si128(&v19);
v12 = _mm_load_si128(&v20);
*(__m128i *)a1 = _mm_load_si128(&v15);
v13 = _mm_loadu_si128((const __m128i *)((char *)&v20.m128i_u64[1] + 4));
*(__m128i *)(a1 + 16) = v8;
*(__m128i *)(a1 + 80) = v12;
*(__m128i *)(a1 + 32) = v9;
*(__m128i *)(a1 + 48) = v10;
*(__m128i *)(a1 + 64) = v11;
*(__m128i *)(a1 + 92) = v13;
return a1;
} | func0:
ENDBR64
PUSH R14
PUSH R13
MOV R13,RSI
MOV RSI,RDX
PUSH R12
MOV R12,RDX
PUSH RBP
PUSH RBX
MOV RBX,RDI
MOV RDI,R13
ADD RSP,-0x80
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x78],RAX
XOR EAX,EAX
CALL 0x001010d0
TEST RAX,RAX
JZ 0x001014f0
MOV R14,RAX
MOV RDI,R12
MOV RBP,RAX
SUB R14,R13
MOV dword ptr [RSP + 0x64],R14D
CALL 0x00101090
MOV RDI,RSP
MOV ECX,0x64
MOV RSI,RBP
MOV R12,RAX
ADD R14D,EAX
MOV RDX,RAX
MOV dword ptr [RSP + 0x68],R14D
CALL 0x001010c0
MOV byte ptr [RSP + R12*0x1],0x0
LAB_00101486:
MOVDQA XMM0,xmmword ptr [RSP]
MOVDQA XMM1,xmmword ptr [RSP + 0x10]
MOVDQA XMM2,xmmword ptr [RSP + 0x20]
MOVDQA XMM3,xmmword ptr [RSP + 0x30]
MOVDQA XMM4,xmmword ptr [RSP + 0x40]
MOVDQA XMM5,xmmword ptr [RSP + 0x50]
MOVUPS xmmword ptr [RBX],XMM0
MOVDQU XMM6,xmmword ptr [RSP + 0x5c]
MOVUPS xmmword ptr [RBX + 0x10],XMM1
MOVUPS xmmword ptr [RBX + 0x50],XMM5
MOVUPS xmmword ptr [RBX + 0x20],XMM2
MOVUPS xmmword ptr [RBX + 0x30],XMM3
MOVUPS xmmword ptr [RBX + 0x40],XMM4
MOVUPS xmmword ptr [RBX + 0x5c],XMM6
MOV RAX,qword ptr [RSP + 0x78]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x001014ff
SUB RSP,-0x80
MOV RAX,RBX
POP RBX
POP RBP
POP R12
POP R13
POP R14
RET
LAB_001014f0:
MOV byte ptr [RSP],0x0
MOV qword ptr [RSP + 0x64],-0x1
JMP 0x00101486
LAB_001014ff:
CALL 0x001010a0 | int8 * func0(int8 *param_1,char *param_2,char *param_3)
{
char *pcVar1;
size_t sVar2;
int iVar3;
long in_FS_OFFSET;
int local_a8;
int7 uStack_a7;
int8 uStack_a0;
int8 local_98;
int8 uStack_90;
int8 local_88;
int8 uStack_80;
int8 local_78;
int8 uStack_70;
int8 local_68;
int8 uStack_60;
int8 local_58;
int4 uStack_50;
int4 uStack_4c;
int4 uStack_48;
int8 local_44;
long local_30;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
pcVar1 = strstr(param_2,param_3);
if (pcVar1 == (char *)0x0) {
local_a8 = 0;
local_44 = 0xffffffffffffffff;
}
else {
iVar3 = (int)pcVar1 - (int)param_2;
local_44 = CONCAT44(local_44._4_4_,iVar3);
sVar2 = strlen(param_3);
local_44 = CONCAT44(iVar3 + (int)sVar2,(int4)local_44);
__strncpy_chk(&local_a8,pcVar1,sVar2,100);
(&local_a8)[sVar2] = 0;
}
*param_1 = CONCAT71(uStack_a7,local_a8);
param_1[1] = uStack_a0;
param_1[2] = local_98;
param_1[3] = uStack_90;
param_1[10] = local_58;
param_1[0xb] = CONCAT44(uStack_4c,uStack_50);
param_1[4] = local_88;
param_1[5] = uStack_80;
param_1[6] = local_78;
param_1[7] = uStack_70;
param_1[8] = local_68;
param_1[9] = uStack_60;
*(ulong *)((long)param_1 + 0x5c) = CONCAT44(uStack_48,uStack_4c);
*(int8 *)((long)param_1 + 100) = local_44;
if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) {
return param_1;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
6,988 | func0 |
#include <stdio.h>
#include <string.h>
#include <regex.h>
#include <assert.h>
| char* func0(const char* email) {
const char* regex_pattern = "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$";
regex_t regex;
int ret;
ret = regcomp(®ex, regex_pattern, REG_EXTENDED | REG_NOSUB);
if (ret) {
return "Invalid Email";
}
ret = regexec(®ex, email, 0, NULL, 0);
regfree(®ex);
if (!ret) {
return "Valid Email";
} else {
return "Invalid Email";
}
}
| int main() {
assert(strcmp(func0("[email protected]"), "Valid Email") == 0);
assert(strcmp(func0("[email protected]"), "Valid Email") == 0);
assert(strcmp(func0("ankitaoie326.com"), "Invalid Email") == 0);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x70,%rsp
mov %rdi,-0x68(%rbp)
mov %fs:0x28,%rax
mov %rax,-0x8(%rbp)
xor %eax,%eax
lea 0xdf9(%rip),%rax
mov %rax,-0x58(%rbp)
mov -0x58(%rbp),%rcx
lea -0x50(%rbp),%rax
mov $0x9,%edx
mov %rcx,%rsi
mov %rax,%rdi
callq 10d0 <regcomp@plt>
mov %eax,-0x5c(%rbp)
cmpl $0x0,-0x5c(%rbp)
je 123d <func0+0x54>
lea 0xdf8(%rip),%rax
jmp 1282 <func0+0x99>
mov -0x68(%rbp),%rsi
lea -0x50(%rbp),%rax
mov $0x0,%r8d
mov $0x0,%ecx
mov $0x0,%edx
mov %rax,%rdi
callq 10f0 <regexec@plt>
mov %eax,-0x5c(%rbp)
lea -0x50(%rbp),%rax
mov %rax,%rdi
callq 10a0 <regfree@plt>
cmpl $0x0,-0x5c(%rbp)
jne 127b <func0+0x92>
lea 0xdc8(%rip),%rax
jmp 1282 <func0+0x99>
lea 0xdb1(%rip),%rax
mov -0x8(%rbp),%rdx
xor %fs:0x28,%rdx
je 1296 <func0+0xad>
callq 10b0 <__stack_chk_fail@plt>
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 70h
mov [rbp+string], rdi
mov rax, fs:28h
mov [rbp+var_8], rax
xor eax, eax
lea rax, aAZ09AZ09WW23; "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w"...
mov [rbp+pattern], rax
mov rcx, [rbp+pattern]
lea rax, [rbp+preg]
mov edx, 9; cflags
mov rsi, rcx; pattern
mov rdi, rax; preg
call _regcomp
mov [rbp+var_5C], eax
cmp [rbp+var_5C], 0
jz short loc_123D
lea rax, aInvalidEmail; "Invalid Email"
jmp short loc_1282
loc_123D:
mov rsi, [rbp+string]; string
lea rax, [rbp+preg]
mov r8d, 0; eflags
mov ecx, 0; pmatch
mov edx, 0; nmatch
mov rdi, rax; preg
call _regexec
mov [rbp+var_5C], eax
lea rax, [rbp+preg]
mov rdi, rax; preg
call _regfree
cmp [rbp+var_5C], 0
jnz short loc_127B
lea rax, s2; "Valid Email"
jmp short loc_1282
loc_127B:
lea rax, aInvalidEmail; "Invalid Email"
loc_1282:
mov rdx, [rbp+var_8]
sub rdx, fs:28h
jz short locret_1296
call ___stack_chk_fail
locret_1296:
leave
retn | const char * func0(const char *a1)
{
int v2; // [rsp+14h] [rbp-5Ch]
regex_t preg; // [rsp+20h] [rbp-50h] BYREF
unsigned long long v4; // [rsp+68h] [rbp-8h]
v4 = __readfsqword(0x28u);
if ( regcomp(&preg, "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$", 9) )
return "Invalid Email";
v2 = regexec(&preg, a1, 0LL, 0LL, 0);
regfree(&preg);
if ( v2 )
return "Invalid Email";
else
return "Valid Email";
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x70
MOV qword ptr [RBP + -0x68],RDI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x8],RAX
XOR EAX,EAX
LEA RAX,[0x102008]
MOV qword ptr [RBP + -0x58],RAX
MOV RCX,qword ptr [RBP + -0x58]
LEA RAX,[RBP + -0x50]
MOV EDX,0x9
MOV RSI,RCX
MOV RDI,RAX
CALL 0x001010d0
MOV dword ptr [RBP + -0x5c],EAX
CMP dword ptr [RBP + -0x5c],0x0
JZ 0x0010123d
LEA RAX,[0x102033]
JMP 0x00101282
LAB_0010123d:
MOV RSI,qword ptr [RBP + -0x68]
LEA RAX,[RBP + -0x50]
MOV R8D,0x0
MOV ECX,0x0
MOV EDX,0x0
MOV RDI,RAX
CALL 0x001010f0
MOV dword ptr [RBP + -0x5c],EAX
LEA RAX,[RBP + -0x50]
MOV RDI,RAX
CALL 0x001010a0
CMP dword ptr [RBP + -0x5c],0x0
JNZ 0x0010127b
LEA RAX,[0x102041]
JMP 0x00101282
LAB_0010127b:
LEA RAX,[0x102033]
LAB_00101282:
MOV RDX,qword ptr [RBP + -0x8]
SUB RDX,qword ptr FS:[0x28]
JZ 0x00101296
CALL 0x001010b0
LAB_00101296:
LEAVE
RET | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t local_58;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&local_58,"^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$",9);
if (iVar1 == 0) {
iVar1 = regexec(&local_58,param_1,0,(regmatch_t *)0x0,0);
regfree(&local_58);
if (iVar1 == 0) {
pcVar2 = "Valid Email";
}
else {
pcVar2 = "Invalid Email";
}
}
else {
pcVar2 = "Invalid Email";
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return pcVar2;
} |
6,989 | func0 |
#include <stdio.h>
#include <string.h>
#include <regex.h>
#include <assert.h>
| char* func0(const char* email) {
const char* regex_pattern = "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$";
regex_t regex;
int ret;
ret = regcomp(®ex, regex_pattern, REG_EXTENDED | REG_NOSUB);
if (ret) {
return "Invalid Email";
}
ret = regexec(®ex, email, 0, NULL, 0);
regfree(®ex);
if (!ret) {
return "Valid Email";
} else {
return "Invalid Email";
}
}
| int main() {
assert(strcmp(func0("[email protected]"), "Valid Email") == 0);
assert(strcmp(func0("[email protected]"), "Valid Email") == 0);
assert(strcmp(func0("ankitaoie326.com"), "Invalid Email") == 0);
return 0;
}
| O1 | c | func0:
endbr64
push %rbp
push %rbx
sub $0x58,%rsp
mov %rdi,%rbx
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%rdi
mov $0x9,%edx
lea 0xe6b(%rip),%rsi
callq 10c0 <regcomp@plt>
mov %eax,%edx
lea 0xe01(%rip),%rax
test %edx,%edx
je 121e <func0+0x55>
mov 0x48(%rsp),%rcx
xor %fs:0x28,%rcx
jne 125c <func0+0x93>
add $0x58,%rsp
pop %rbx
pop %rbp
retq
mov %rsp,%rbp
mov $0x0,%r8d
mov $0x0,%ecx
mov $0x0,%edx
mov %rbx,%rsi
mov %rbp,%rdi
callq 10d0 <regexec@plt>
mov %eax,%ebx
mov %rbp,%rdi
callq 1090 <regfree@plt>
test %ebx,%ebx
lea 0xdc3(%rip),%rax
lea 0xdae(%rip),%rdx
cmovne %rdx,%rax
jmp 1207 <func0+0x3e>
callq 10a0 <__stack_chk_fail@plt>
| func0:
endbr64
push rbp
push rbx
sub rsp, 58h
mov rbx, rdi
mov rax, fs:28h
mov [rsp+68h+var_20], rax
xor eax, eax
mov rdi, rsp
mov edx, 9
lea rsi, aAZ09AZ09WW23; "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w"...
call _regcomp
mov edx, eax
lea rax, aInvalidEmail; "Invalid Email"
test edx, edx
jz short loc_123E
loc_1227:
mov rdx, [rsp+68h+var_20]
sub rdx, fs:28h
jnz short loc_127C
add rsp, 58h
pop rbx
pop rbp
retn
loc_123E:
mov rbp, rsp
mov r8d, 0
mov ecx, 0
mov edx, 0
mov rsi, rbx
mov rdi, rbp
call _regexec
mov ebx, eax
mov rdi, rbp
call _regfree
test ebx, ebx
lea rax, aValidEmail; "Valid Email"
lea rdx, aInvalidEmail; "Invalid Email"
cmovnz rax, rdx
jmp short loc_1227
loc_127C:
call ___stack_chk_fail | const char * func0(long long a1)
{
int v1; // edx
const char *result; // rax
int v3; // ebx
_QWORD v4[13]; // [rsp+0h] [rbp-68h] BYREF
v4[9] = __readfsqword(0x28u);
v1 = regcomp(v4, "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$", 9LL);
result = "Invalid Email";
if ( !v1 )
{
v3 = regexec(v4, a1, 0LL, 0LL, 0LL);
regfree(v4);
result = "Valid Email";
if ( v3 )
return "Invalid Email";
}
return result;
} | func0:
ENDBR64
PUSH RBP
PUSH RBX
SUB RSP,0x58
MOV RBX,RDI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV RDI,RSP
MOV EDX,0x9
LEA RSI,[0x102080]
CALL 0x001010d0
MOV EDX,EAX
LEA RAX,[0x102004]
TEST EDX,EDX
JZ 0x0010123e
LAB_00101227:
MOV RDX,qword ptr [RSP + 0x48]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x0010127c
ADD RSP,0x58
POP RBX
POP RBP
RET
LAB_0010123e:
MOV RBP,RSP
MOV R8D,0x0
MOV ECX,0x0
MOV EDX,0x0
MOV RSI,RBX
MOV RDI,RBP
CALL 0x001010f0
MOV EBX,EAX
MOV RDI,RBP
CALL 0x001010a0
TEST EBX,EBX
LEA RAX,[0x102012]
LEA RDX,[0x102004]
CMOVNZ RAX,RDX
JMP 0x00101227
LAB_0010127c:
CALL 0x001010b0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&rStack_68,"^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$",9);
pcVar2 = "Invalid Email";
if (iVar1 == 0) {
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
regfree(&rStack_68);
pcVar2 = "Valid Email";
if (iVar1 != 0) {
pcVar2 = "Invalid Email";
}
}
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return pcVar2;
} |
6,990 | func0 |
#include <stdio.h>
#include <string.h>
#include <regex.h>
#include <assert.h>
| char* func0(const char* email) {
const char* regex_pattern = "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$";
regex_t regex;
int ret;
ret = regcomp(®ex, regex_pattern, REG_EXTENDED | REG_NOSUB);
if (ret) {
return "Invalid Email";
}
ret = regexec(®ex, email, 0, NULL, 0);
regfree(®ex);
if (!ret) {
return "Valid Email";
} else {
return "Invalid Email";
}
}
| int main() {
assert(strcmp(func0("[email protected]"), "Valid Email") == 0);
assert(strcmp(func0("[email protected]"), "Valid Email") == 0);
assert(strcmp(func0("ankitaoie326.com"), "Invalid Email") == 0);
return 0;
}
| O2 | c | func0:
endbr64
push %r12
mov $0x9,%edx
lea 0xd9e(%rip),%rsi
push %rbp
mov %rdi,%rbp
sub $0x58,%rsp
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%r12
mov %r12,%rdi
callq 10c0 <regcomp@plt>
test %eax,%eax
je 1310 <func0+0x60>
lea 0xd14(%rip),%rax
mov 0x48(%rsp),%rcx
xor %fs:0x28,%rcx
jne 1339 <func0+0x89>
add $0x58,%rsp
pop %rbp
pop %r12
retq
nopl 0x0(%rax,%rax,1)
mov %rbp,%rsi
xor %r8d,%r8d
xor %ecx,%ecx
xor %edx,%edx
mov %r12,%rdi
callq 10d0 <regexec@plt>
mov %r12,%rdi
mov %eax,%ebp
callq 1090 <regfree@plt>
lea 0xcdf(%rip),%rax
test %ebp,%ebp
je 12f0 <func0+0x40>
jmp 12e9 <func0+0x39>
callq 10a0 <__stack_chk_fail@plt>
xchg %ax,%ax
| func0:
endbr64
push r12
mov edx, 9
lea rsi, aAZ09AZ09WW23; "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w"...
push rbp
mov rbp, rdi
sub rsp, 58h
mov rax, fs:28h
mov [rsp+68h+var_20], rax
xor eax, eax
mov r12, rsp
mov rdi, r12
call _regcomp
test eax, eax
jz short loc_1320
loc_12F9:
lea rax, aInvalidEmail; "Invalid Email"
loc_1300:
mov rdx, [rsp+68h+var_20]
sub rdx, fs:28h
jnz short loc_1349
add rsp, 58h
pop rbp
pop r12
retn
loc_1320:
mov rsi, rbp
xor r8d, r8d
xor ecx, ecx
xor edx, edx
mov rdi, r12
call _regexec
mov rdi, r12
mov ebp, eax
call _regfree
lea rax, aValidEmail; "Valid Email"
test ebp, ebp
jz short loc_1300
jmp short loc_12F9
loc_1349:
call ___stack_chk_fail | const char * func0(long long a1)
{
const char *result; // rax
int v2; // ebp
_QWORD v3[13]; // [rsp+0h] [rbp-68h] BYREF
v3[9] = __readfsqword(0x28u);
if ( (unsigned int)regcomp(v3, "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$", 9LL) )
return "Invalid Email";
v2 = regexec(v3, a1, 0LL, 0LL, 0LL);
regfree(v3);
result = "Valid Email";
if ( v2 )
return "Invalid Email";
return result;
} | func0:
ENDBR64
PUSH R12
MOV EDX,0x9
LEA RSI,[0x102080]
PUSH RBP
MOV RBP,RDI
SUB RSP,0x58
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV R12,RSP
MOV RDI,R12
CALL 0x001010d0
TEST EAX,EAX
JZ 0x00101320
LAB_001012f9:
LEA RAX,[0x102004]
LAB_00101300:
MOV RDX,qword ptr [RSP + 0x48]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x00101349
ADD RSP,0x58
POP RBP
POP R12
RET
LAB_00101320:
MOV RSI,RBP
XOR R8D,R8D
XOR ECX,ECX
XOR EDX,EDX
MOV RDI,R12
CALL 0x001010f0
MOV RDI,R12
MOV EBP,EAX
CALL 0x001010a0
LEA RAX,[0x102012]
TEST EBP,EBP
JZ 0x00101300
JMP 0x001012f9
LAB_00101349:
CALL 0x001010b0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&rStack_68,"^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$",9);
if (iVar1 == 0) {
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
regfree(&rStack_68);
pcVar2 = "Valid Email";
if (iVar1 == 0) goto LAB_00101300;
}
pcVar2 = "Invalid Email";
LAB_00101300:
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return pcVar2;
} |
6,991 | func0 |
#include <stdio.h>
#include <string.h>
#include <regex.h>
#include <assert.h>
| char* func0(const char* email) {
const char* regex_pattern = "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$";
regex_t regex;
int ret;
ret = regcomp(®ex, regex_pattern, REG_EXTENDED | REG_NOSUB);
if (ret) {
return "Invalid Email";
}
ret = regexec(®ex, email, 0, NULL, 0);
regfree(®ex);
if (!ret) {
return "Valid Email";
} else {
return "Invalid Email";
}
}
| int main() {
assert(strcmp(func0("[email protected]"), "Valid Email") == 0);
assert(strcmp(func0("[email protected]"), "Valid Email") == 0);
assert(strcmp(func0("ankitaoie326.com"), "Invalid Email") == 0);
return 0;
}
| O3 | c | func0:
endbr64
push %r12
mov $0x9,%edx
lea 0xd9e(%rip),%rsi
push %rbp
mov %rdi,%rbp
sub $0x58,%rsp
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%r12
mov %r12,%rdi
callq 10c0 <regcomp@plt>
test %eax,%eax
je 1310 <func0+0x60>
lea 0xd14(%rip),%rax
mov 0x48(%rsp),%rcx
xor %fs:0x28,%rcx
jne 1339 <func0+0x89>
add $0x58,%rsp
pop %rbp
pop %r12
retq
nopl 0x0(%rax,%rax,1)
mov %rbp,%rsi
xor %r8d,%r8d
xor %ecx,%ecx
xor %edx,%edx
mov %r12,%rdi
callq 10d0 <regexec@plt>
mov %r12,%rdi
mov %eax,%ebp
callq 1090 <regfree@plt>
lea 0xcdf(%rip),%rax
test %ebp,%ebp
je 12f0 <func0+0x40>
jmp 12e9 <func0+0x39>
callq 10a0 <__stack_chk_fail@plt>
xchg %ax,%ax
| func0:
endbr64
push rbp
mov edx, 9; cflags
lea rsi, pattern; "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w"...
push rbx
mov rbx, rdi
sub rsp, 58h
mov rax, fs:28h
mov [rsp+var_s48], rax
xor eax, eax
mov rbp, rsp
mov rdi, rbp; preg
call _regcomp
test eax, eax
jz short loc_1320
loc_12F8:
lea rax, aInvalidEmail; "Invalid Email"
loc_12FF:
mov rdx, [rsp+var_s48]
sub rdx, fs:28h
jnz short loc_1349
add rsp, 58h
pop rbx
pop rbp
retn
loc_1320:
xor r8d, r8d; eflags
xor ecx, ecx; pmatch
xor edx, edx; nmatch
mov rsi, rbx; string
mov rdi, rbp; preg
call _regexec
mov rdi, rbp; preg
mov ebx, eax
call _regfree
test ebx, ebx
jnz short loc_12F8
lea rax, s2; "Valid Email"
jmp short loc_12FF
loc_1349:
call ___stack_chk_fail | const char * func0(char *string)
{
int v2; // ebx
regex_t _0; // [rsp+0h] [rbp+0h] BYREF
unsigned long long vars48; // [rsp+48h] [rbp+48h]
vars48 = __readfsqword(0x28u);
if ( regcomp(&_0, "^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$", 9) )
return "Invalid Email";
v2 = regexec(&_0, string, 0LL, 0LL, 0);
regfree(&_0);
if ( v2 )
return "Invalid Email";
else
return "Valid Email";
} | func0:
ENDBR64
PUSH RBP
MOV EDX,0x9
LEA RSI,[0x102080]
PUSH RBX
MOV RBX,RDI
SUB RSP,0x58
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV RBP,RSP
MOV RDI,RBP
CALL 0x001010d0
TEST EAX,EAX
JZ 0x00101320
LAB_001012f8:
LEA RAX,[0x102004]
LAB_001012ff:
MOV RDX,qword ptr [RSP + 0x48]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x00101349
ADD RSP,0x58
POP RBX
POP RBP
RET
LAB_00101320:
XOR R8D,R8D
XOR ECX,ECX
XOR EDX,EDX
MOV RSI,RBX
MOV RDI,RBP
CALL 0x001010f0
MOV RDI,RBP
MOV EBX,EAX
CALL 0x001010a0
TEST EBX,EBX
JNZ 0x001012f8
LEA RAX,[0x102012]
JMP 0x001012ff
LAB_00101349:
CALL 0x001010b0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&rStack_68,"^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$",9);
if (iVar1 == 0) {
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
regfree(&rStack_68);
if (iVar1 == 0) {
pcVar2 = "Valid Email";
goto LAB_001012ff;
}
}
pcVar2 = "Invalid Email";
LAB_001012ff:
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar2;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
6,992 | func0 |
#include <assert.h>
#include <stdbool.h>
| bool func0(const int* nums, int size) {
for (int i = 0; i < size; i++) {
if (nums[i] % 2 != i % 2) {
return false;
}
}
return true;
}
| int main() {
int arr1[] = {2, 1, 4, 3, 6, 7, 6, 3};
int arr2[] = {4, 1, 2};
int arr3[] = {1, 2, 3};
assert(func0(arr1, sizeof(arr1)/sizeof(arr1[0])));
assert(func0(arr2, sizeof(arr2)/sizeof(arr2[0])));
assert(!func0(arr3, sizeof(arr3)/sizeof(arr3[0])));
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11c1 <func0+0x58>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cltd
shr $0x1f,%edx
add %edx,%eax
and $0x1,%eax
sub %edx,%eax
mov %eax,%ecx
mov -0x4(%rbp),%eax
cltd
shr $0x1f,%edx
add %edx,%eax
and $0x1,%eax
sub %edx,%eax
cmp %eax,%ecx
je 11bd <func0+0x54>
mov $0x0,%eax
jmp 11ce <func0+0x65>
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 1181 <func0+0x18>
mov $0x1,%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_4], 0
jmp short loc_11CB
loc_1181:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov edx, [rax]
mov eax, edx
sar eax, 1Fh
shr eax, 1Fh
add edx, eax
and edx, 1
sub edx, eax
mov ecx, edx
mov edx, [rbp+var_4]
mov eax, edx
sar eax, 1Fh
shr eax, 1Fh
add edx, eax
and edx, 1
sub edx, eax
mov eax, edx
cmp ecx, eax
jz short loc_11C7
mov eax, 0
jmp short loc_11D8
loc_11C7:
add [rbp+var_4], 1
loc_11CB:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_1181
mov eax, 1
loc_11D8:
pop rbp
retn | long long func0(long long a1, int a2)
{
int i; // [rsp+18h] [rbp-4h]
for ( i = 0; i < a2; ++i )
{
if ( *(_DWORD *)(4LL * i + a1) % 2 != i % 2 )
return 0LL;
}
return 1LL;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011cb
LAB_00101181:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
MOV EAX,EDX
SAR EAX,0x1f
SHR EAX,0x1f
ADD EDX,EAX
AND EDX,0x1
SUB EDX,EAX
MOV ECX,EDX
MOV EDX,dword ptr [RBP + -0x4]
MOV EAX,EDX
SAR EAX,0x1f
SHR EAX,0x1f
ADD EDX,EAX
AND EDX,0x1
SUB EDX,EAX
MOV EAX,EDX
CMP ECX,EAX
JZ 0x001011c7
MOV EAX,0x0
JMP 0x001011d8
LAB_001011c7:
ADD dword ptr [RBP + -0x4],0x1
LAB_001011cb:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x00101181
MOV EAX,0x1
LAB_001011d8:
POP RBP
RET | int8 func0(long param_1,int param_2)
{
int local_c;
local_c = 0;
while( true ) {
if (param_2 <= local_c) {
return 1;
}
if (*(int *)(param_1 + (long)local_c * 4) % 2 != local_c % 2) break;
local_c = local_c + 1;
}
return 0;
} |
6,993 | func0 |
#include <assert.h>
#include <stdbool.h>
| bool func0(const int* nums, int size) {
for (int i = 0; i < size; i++) {
if (nums[i] % 2 != i % 2) {
return false;
}
}
return true;
}
| int main() {
int arr1[] = {2, 1, 4, 3, 6, 7, 6, 3};
int arr2[] = {4, 1, 2};
int arr3[] = {1, 2, 3};
assert(func0(arr1, sizeof(arr1)/sizeof(arr1[0])));
assert(func0(arr2, sizeof(arr2)/sizeof(arr2[0])));
assert(!func0(arr3, sizeof(arr3)/sizeof(arr3[0])));
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 11ae <func0+0x45>
lea -0x1(%rsi),%r8d
mov $0x0,%ecx
jmp 117f <func0+0x16>
mov %rax,%rcx
mov (%rdi,%rcx,4),%eax
mov %eax,%edx
shr $0x1f,%edx
add %edx,%eax
and $0x1,%eax
sub %edx,%eax
mov %ecx,%esi
shr $0x1f,%esi
lea (%rsi,%rcx,1),%edx
and $0x1,%edx
sub %esi,%edx
cmp %edx,%eax
jne 11b4 <func0+0x4b>
lea 0x1(%rcx),%rax
cmp %r8,%rcx
jne 117c <func0+0x13>
mov $0x1,%eax
retq
mov $0x1,%eax
retq
mov $0x0,%eax
retq
| func0:
endbr64
test esi, esi
jle short loc_11AB
mov esi, esi
mov ecx, 0
loc_1178:
mov eax, [rdi+rcx*4]
mov edx, eax
shr edx, 1Fh
add eax, edx
and eax, 1
sub eax, edx
mov r8d, ecx
shr r8d, 1Fh
lea edx, [r8+rcx]
and edx, 1
sub edx, r8d
cmp eax, edx
jnz short loc_11B1
add rcx, 1
cmp rcx, rsi
jnz short loc_1178
mov eax, 1
retn
loc_11AB:
mov eax, 1
retn
loc_11B1:
mov eax, 0
retn | long long func0(long long a1, int a2)
{
long long v2; // rcx
if ( a2 <= 0 )
return 1LL;
v2 = 0LL;
while ( *(_DWORD *)(a1 + 4 * v2) % 2 == (int)v2 % 2 )
{
if ( ++v2 == a2 )
return 1LL;
}
return 0LL;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001011ab
MOV ESI,ESI
MOV ECX,0x0
LAB_00101178:
MOV EAX,dword ptr [RDI + RCX*0x4]
MOV EDX,EAX
SHR EDX,0x1f
ADD EAX,EDX
AND EAX,0x1
SUB EAX,EDX
MOV R8D,ECX
SHR R8D,0x1f
LEA EDX,[R8 + RCX*0x1]
AND EDX,0x1
SUB EDX,R8D
CMP EAX,EDX
JNZ 0x001011b1
ADD RCX,0x1
CMP RCX,RSI
JNZ 0x00101178
MOV EAX,0x1
RET
LAB_001011ab:
MOV EAX,0x1
RET
LAB_001011b1:
MOV EAX,0x0
RET | int8 func0(long param_1,uint param_2)
{
uint uVar1;
ulong uVar2;
if ((int)param_2 < 1) {
return 1;
}
uVar2 = 0;
do {
uVar1 = (uint)(uVar2 >> 0x1f) & 1;
if (*(int *)(param_1 + uVar2 * 4) % 2 != (uVar1 + (int)uVar2 & 1) - uVar1) {
return 0;
}
uVar2 = uVar2 + 1;
} while (uVar2 != param_2);
return 1;
} |
6,994 | func0 |
#include <assert.h>
#include <stdbool.h>
| bool func0(const int* nums, int size) {
for (int i = 0; i < size; i++) {
if (nums[i] % 2 != i % 2) {
return false;
}
}
return true;
}
| int main() {
int arr1[] = {2, 1, 4, 3, 6, 7, 6, 3};
int arr2[] = {4, 1, 2};
int arr3[] = {1, 2, 3};
assert(func0(arr1, sizeof(arr1)/sizeof(arr1[0])));
assert(func0(arr2, sizeof(arr2)/sizeof(arr2[0])));
assert(!func0(arr3, sizeof(arr3)/sizeof(arr3[0])));
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 1270 <func0+0x40>
sub $0x1,%esi
xor %edx,%edx
jmp 124c <func0+0x1c>
lea 0x1(%rdx),%rax
cmp %rsi,%rdx
je 1270 <func0+0x40>
mov %rax,%rdx
mov (%rdi,%rdx,4),%eax
mov %eax,%ecx
shr $0x1f,%ecx
add %ecx,%eax
and $0x1,%eax
sub %ecx,%eax
mov %edx,%ecx
and $0x1,%ecx
cmp %ecx,%eax
je 1240 <func0+0x10>
xor %eax,%eax
retq
nopw 0x0(%rax,%rax,1)
mov $0x1,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_1268
movsxd rsi, esi
xor edx, edx
jmp short loc_1249
loc_1240:
add rdx, 1
cmp rdx, rsi
jz short loc_1268
loc_1249:
mov eax, [rdi+rdx*4]
mov ecx, eax
shr ecx, 1Fh
add eax, ecx
and eax, 1
sub eax, ecx
mov ecx, edx
and ecx, 1
cmp eax, ecx
jz short loc_1240
xor eax, eax
retn
loc_1268:
mov eax, 1
retn | long long func0(long long a1, int a2)
{
long long v2; // rdx
if ( a2 <= 0 )
return 1LL;
v2 = 0LL;
while ( *(_DWORD *)(a1 + 4 * v2) % 2 == (v2 & 1) )
{
if ( ++v2 == a2 )
return 1LL;
}
return 0LL;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101268
MOVSXD RSI,ESI
XOR EDX,EDX
JMP 0x00101249
LAB_00101240:
ADD RDX,0x1
CMP RDX,RSI
JZ 0x00101268
LAB_00101249:
MOV EAX,dword ptr [RDI + RDX*0x4]
MOV ECX,EAX
SHR ECX,0x1f
ADD EAX,ECX
AND EAX,0x1
SUB EAX,ECX
MOV ECX,EDX
AND ECX,0x1
CMP EAX,ECX
JZ 0x00101240
XOR EAX,EAX
RET
LAB_00101268:
MOV EAX,0x1
RET | int8 func0(long param_1,int param_2)
{
long lVar1;
if (0 < param_2) {
lVar1 = 0;
do {
if (*(int *)(param_1 + lVar1 * 4) % 2 != ((uint)lVar1 & 1)) {
return 0;
}
lVar1 = lVar1 + 1;
} while (lVar1 != param_2);
}
return 1;
} |
6,995 | func0 |
#include <assert.h>
#include <stdbool.h>
| bool func0(const int* nums, int size) {
for (int i = 0; i < size; i++) {
if (nums[i] % 2 != i % 2) {
return false;
}
}
return true;
}
| int main() {
int arr1[] = {2, 1, 4, 3, 6, 7, 6, 3};
int arr2[] = {4, 1, 2};
int arr3[] = {1, 2, 3};
assert(func0(arr1, sizeof(arr1)/sizeof(arr1[0])));
assert(func0(arr2, sizeof(arr2)/sizeof(arr2[0])));
assert(!func0(arr3, sizeof(arr3)/sizeof(arr3[0])));
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 1270 <func0+0x40>
sub $0x1,%esi
xor %edx,%edx
jmp 124c <func0+0x1c>
lea 0x1(%rdx),%rax
cmp %rsi,%rdx
je 1270 <func0+0x40>
mov %rax,%rdx
mov (%rdi,%rdx,4),%eax
mov %eax,%ecx
shr $0x1f,%ecx
add %ecx,%eax
and $0x1,%eax
sub %ecx,%eax
mov %edx,%ecx
and $0x1,%ecx
cmp %ecx,%eax
je 1240 <func0+0x10>
xor %eax,%eax
retq
nopw 0x0(%rax,%rax,1)
mov $0x1,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_1178
movsxd rsi, esi
xor edx, edx
jmp short loc_1159
loc_1150:
add rdx, 1
cmp rsi, rdx
jz short loc_1178
loc_1159:
mov eax, [rdi+rdx*4]
mov ecx, eax
shr ecx, 1Fh
add eax, ecx
and eax, 1
sub eax, ecx
mov ecx, edx
and ecx, 1
cmp eax, ecx
jz short loc_1150
xor eax, eax
retn
loc_1178:
mov eax, 1
retn | long long func0(long long a1, int a2)
{
long long v2; // rdx
if ( a2 <= 0 )
return 1LL;
v2 = 0LL;
while ( *(_DWORD *)(a1 + 4 * v2) % 2 == (v2 & 1) )
{
if ( a2 == ++v2 )
return 1LL;
}
return 0LL;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101178
MOVSXD RSI,ESI
XOR EDX,EDX
JMP 0x00101159
LAB_00101150:
ADD RDX,0x1
CMP RSI,RDX
JZ 0x00101178
LAB_00101159:
MOV EAX,dword ptr [RDI + RDX*0x4]
MOV ECX,EAX
SHR ECX,0x1f
ADD EAX,ECX
AND EAX,0x1
SUB EAX,ECX
MOV ECX,EDX
AND ECX,0x1
CMP EAX,ECX
JZ 0x00101150
XOR EAX,EAX
RET
LAB_00101178:
MOV EAX,0x1
RET | int8 func0(long param_1,int param_2)
{
long lVar1;
if (0 < param_2) {
lVar1 = 0;
do {
if (*(int *)(param_1 + lVar1 * 4) % 2 != ((uint)lVar1 & 1)) {
return 0;
}
lVar1 = lVar1 + 1;
} while (param_2 != lVar1);
}
return 1;
} |
6,996 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
| int func0(const char *test_str) {
int res = 0;
const char *vow_list = "aeiou";
int len = strlen(test_str);
for (int idx = 1; idx < len - 1; idx++) {
if (strchr(vow_list, test_str[idx]) == NULL &&
(strchr(vow_list, test_str[idx - 1]) != NULL || strchr(vow_list, test_str[idx + 1]) != NULL)) {
res += 1;
}
}
if (strchr(vow_list, test_str[0]) == NULL && strchr(vow_list, test_str[1]) != NULL) {
res += 1;
}
if (strchr(vow_list, test_str[len - 1]) == NULL && strchr(vow_list, test_str[len - 2]) != NULL) {
res += 1;
}
return res;
}
| int main() {
assert(func0("bestinstareels") == 7);
assert(func0("partofthejourneyistheend") == 12);
assert(func0("amazonprime") == 5);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x30,%rsp
mov %rdi,-0x28(%rbp)
movl $0x0,-0x14(%rbp)
lea 0xe61(%rip),%rax
mov %rax,-0x8(%rbp)
mov -0x28(%rbp),%rax
mov %rax,%rdi
callq 1070 <strlen@plt>
mov %eax,-0xc(%rbp)
movl $0x1,-0x10(%rbp)
jmpq 1246 <func0+0xbd>
mov -0x10(%rbp),%eax
movslq %eax,%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
movsbl %al,%edx
mov -0x8(%rbp),%rax
mov %edx,%esi
mov %rax,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
jne 1242 <func0+0xb9>
mov -0x10(%rbp),%eax
cltq
lea -0x1(%rax),%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
movsbl %al,%edx
mov -0x8(%rbp),%rax
mov %edx,%esi
mov %rax,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
jne 123e <func0+0xb5>
mov -0x10(%rbp),%eax
cltq
lea 0x1(%rax),%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
movsbl %al,%edx
mov -0x8(%rbp),%rax
mov %edx,%esi
mov %rax,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
je 1242 <func0+0xb9>
addl $0x1,-0x14(%rbp)
addl $0x1,-0x10(%rbp)
mov -0xc(%rbp),%eax
sub $0x1,%eax
cmp %eax,-0x10(%rbp)
jl 11c6 <func0+0x3d>
mov -0x28(%rbp),%rax
movzbl (%rax),%eax
movsbl %al,%edx
mov -0x8(%rbp),%rax
mov %edx,%esi
mov %rax,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
jne 1297 <func0+0x10e>
mov -0x28(%rbp),%rax
add $0x1,%rax
movzbl (%rax),%eax
movsbl %al,%edx
mov -0x8(%rbp),%rax
mov %edx,%esi
mov %rax,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
je 1297 <func0+0x10e>
addl $0x1,-0x14(%rbp)
mov -0xc(%rbp),%eax
cltq
lea -0x1(%rax),%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
movsbl %al,%edx
mov -0x8(%rbp),%rax
mov %edx,%esi
mov %rax,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
jne 12ed <func0+0x164>
mov -0xc(%rbp),%eax
cltq
lea -0x2(%rax),%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
movzbl (%rax),%eax
movsbl %al,%edx
mov -0x8(%rbp),%rax
mov %edx,%esi
mov %rax,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
je 12ed <func0+0x164>
addl $0x1,-0x14(%rbp)
mov -0x14(%rbp),%eax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 30h
mov [rbp+s], rdi
mov [rbp+var_14], 0
lea rax, aAeiou; "aeiou"
mov [rbp+var_8], rax
mov rax, [rbp+s]
mov rdi, rax; s
call _strlen
mov [rbp+var_C], eax
mov [rbp+var_10], 1
jmp loc_1246
loc_11C6:
mov eax, [rbp+var_10]
movsxd rdx, eax
mov rax, [rbp+s]
add rax, rdx
movzx eax, byte ptr [rax]
movsx edx, al
mov rax, [rbp+var_8]
mov esi, edx; c
mov rdi, rax; s
call _strchr
test rax, rax
jnz short loc_1242
mov eax, [rbp+var_10]
cdqe
lea rdx, [rax-1]
mov rax, [rbp+s]
add rax, rdx
movzx eax, byte ptr [rax]
movsx edx, al
mov rax, [rbp+var_8]
mov esi, edx; c
mov rdi, rax; s
call _strchr
test rax, rax
jnz short loc_123E
mov eax, [rbp+var_10]
cdqe
lea rdx, [rax+1]
mov rax, [rbp+s]
add rax, rdx
movzx eax, byte ptr [rax]
movsx edx, al
mov rax, [rbp+var_8]
mov esi, edx; c
mov rdi, rax; s
call _strchr
test rax, rax
jz short loc_1242
loc_123E:
add [rbp+var_14], 1
loc_1242:
add [rbp+var_10], 1
loc_1246:
mov eax, [rbp+var_C]
sub eax, 1
cmp [rbp+var_10], eax
jl loc_11C6
mov rax, [rbp+s]
movzx eax, byte ptr [rax]
movsx edx, al
mov rax, [rbp+var_8]
mov esi, edx; c
mov rdi, rax; s
call _strchr
test rax, rax
jnz short loc_1297
mov rax, [rbp+s]
add rax, 1
movzx eax, byte ptr [rax]
movsx edx, al
mov rax, [rbp+var_8]
mov esi, edx; c
mov rdi, rax; s
call _strchr
test rax, rax
jz short loc_1297
add [rbp+var_14], 1
loc_1297:
mov eax, [rbp+var_C]
cdqe
lea rdx, [rax-1]
mov rax, [rbp+s]
add rax, rdx
movzx eax, byte ptr [rax]
movsx edx, al
mov rax, [rbp+var_8]
mov esi, edx; c
mov rdi, rax; s
call _strchr
test rax, rax
jnz short loc_12ED
mov eax, [rbp+var_C]
cdqe
lea rdx, [rax-2]
mov rax, [rbp+s]
add rax, rdx
movzx eax, byte ptr [rax]
movsx edx, al
mov rax, [rbp+var_8]
mov esi, edx; c
mov rdi, rax; s
call _strchr
test rax, rax
jz short loc_12ED
add [rbp+var_14], 1
loc_12ED:
mov eax, [rbp+var_14]
leave
retn | long long func0(const char *a1)
{
unsigned int v2; // [rsp+1Ch] [rbp-14h]
int i; // [rsp+20h] [rbp-10h]
int v4; // [rsp+24h] [rbp-Ch]
v2 = 0;
v4 = strlen(a1);
for ( i = 1; i < v4 - 1; ++i )
{
if ( !strchr("aeiou", a1[i]) && (strchr("aeiou", a1[i - 1]) || strchr("aeiou", a1[i + 1])) )
++v2;
}
if ( !strchr("aeiou", *a1) && strchr("aeiou", a1[1]) )
++v2;
if ( !strchr("aeiou", a1[v4 - 1]) && strchr("aeiou", a1[v4 - 2]) )
++v2;
return v2;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x30
MOV qword ptr [RBP + -0x28],RDI
MOV dword ptr [RBP + -0x14],0x0
LEA RAX,[0x102008]
MOV qword ptr [RBP + -0x8],RAX
MOV RAX,qword ptr [RBP + -0x28]
MOV RDI,RAX
CALL 0x00101070
MOV dword ptr [RBP + -0xc],EAX
MOV dword ptr [RBP + -0x10],0x1
JMP 0x00101246
LAB_001011c6:
MOV EAX,dword ptr [RBP + -0x10]
MOVSXD RDX,EAX
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
MOVSX EDX,AL
MOV RAX,qword ptr [RBP + -0x8]
MOV ESI,EDX
MOV RDI,RAX
CALL 0x00101080
TEST RAX,RAX
JNZ 0x00101242
MOV EAX,dword ptr [RBP + -0x10]
CDQE
LEA RDX,[RAX + -0x1]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
MOVSX EDX,AL
MOV RAX,qword ptr [RBP + -0x8]
MOV ESI,EDX
MOV RDI,RAX
CALL 0x00101080
TEST RAX,RAX
JNZ 0x0010123e
MOV EAX,dword ptr [RBP + -0x10]
CDQE
LEA RDX,[RAX + 0x1]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
MOVSX EDX,AL
MOV RAX,qword ptr [RBP + -0x8]
MOV ESI,EDX
MOV RDI,RAX
CALL 0x00101080
TEST RAX,RAX
JZ 0x00101242
LAB_0010123e:
ADD dword ptr [RBP + -0x14],0x1
LAB_00101242:
ADD dword ptr [RBP + -0x10],0x1
LAB_00101246:
MOV EAX,dword ptr [RBP + -0xc]
SUB EAX,0x1
CMP dword ptr [RBP + -0x10],EAX
JL 0x001011c6
MOV RAX,qword ptr [RBP + -0x28]
MOVZX EAX,byte ptr [RAX]
MOVSX EDX,AL
MOV RAX,qword ptr [RBP + -0x8]
MOV ESI,EDX
MOV RDI,RAX
CALL 0x00101080
TEST RAX,RAX
JNZ 0x00101297
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,0x1
MOVZX EAX,byte ptr [RAX]
MOVSX EDX,AL
MOV RAX,qword ptr [RBP + -0x8]
MOV ESI,EDX
MOV RDI,RAX
CALL 0x00101080
TEST RAX,RAX
JZ 0x00101297
ADD dword ptr [RBP + -0x14],0x1
LAB_00101297:
MOV EAX,dword ptr [RBP + -0xc]
CDQE
LEA RDX,[RAX + -0x1]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
MOVSX EDX,AL
MOV RAX,qword ptr [RBP + -0x8]
MOV ESI,EDX
MOV RDI,RAX
CALL 0x00101080
TEST RAX,RAX
JNZ 0x001012ed
MOV EAX,dword ptr [RBP + -0xc]
CDQE
LEA RDX,[RAX + -0x2]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOVZX EAX,byte ptr [RAX]
MOVSX EDX,AL
MOV RAX,qword ptr [RBP + -0x8]
MOV ESI,EDX
MOV RDI,RAX
CALL 0x00101080
TEST RAX,RAX
JZ 0x001012ed
ADD dword ptr [RBP + -0x14],0x1
LAB_001012ed:
MOV EAX,dword ptr [RBP + -0x14]
LEAVE
RET | int func0(char *param_1)
{
int iVar1;
size_t sVar2;
char *pcVar3;
int local_1c;
int local_18;
local_1c = 0;
sVar2 = strlen(param_1);
iVar1 = (int)sVar2;
local_18 = 1;
do {
if (iVar1 + -1 <= local_18) {
pcVar3 = strchr("aeiou",(int)*param_1);
if (pcVar3 == (char *)0x0) {
pcVar3 = strchr("aeiou",(int)param_1[1]);
if (pcVar3 != (char *)0x0) {
local_1c = local_1c + 1;
}
}
pcVar3 = strchr("aeiou",(int)param_1[(long)iVar1 + -1]);
if (pcVar3 == (char *)0x0) {
pcVar3 = strchr("aeiou",(int)param_1[(long)iVar1 + -2]);
if (pcVar3 != (char *)0x0) {
local_1c = local_1c + 1;
}
}
return local_1c;
}
pcVar3 = strchr("aeiou",(int)param_1[local_18]);
if (pcVar3 == (char *)0x0) {
pcVar3 = strchr("aeiou",(int)param_1[(long)local_18 + -1]);
if (pcVar3 == (char *)0x0) {
pcVar3 = strchr("aeiou",(int)param_1[(long)local_18 + 1]);
if (pcVar3 == (char *)0x0) goto LAB_00101242;
}
local_1c = local_1c + 1;
}
LAB_00101242:
local_18 = local_18 + 1;
} while( true );
} |
6,997 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
| int func0(const char *test_str) {
int res = 0;
const char *vow_list = "aeiou";
int len = strlen(test_str);
for (int idx = 1; idx < len - 1; idx++) {
if (strchr(vow_list, test_str[idx]) == NULL &&
(strchr(vow_list, test_str[idx - 1]) != NULL || strchr(vow_list, test_str[idx + 1]) != NULL)) {
res += 1;
}
}
if (strchr(vow_list, test_str[0]) == NULL && strchr(vow_list, test_str[1]) != NULL) {
res += 1;
}
if (strchr(vow_list, test_str[len - 1]) == NULL && strchr(vow_list, test_str[len - 2]) != NULL) {
res += 1;
}
return res;
}
| int main() {
assert(func0("bestinstareels") == 7);
assert(func0("partofthejourneyistheend") == 12);
assert(func0("amazonprime") == 5);
return 0;
}
| O1 | c | func0:
endbr64
push %r15
push %r14
push %r13
push %r12
push %rbp
push %rbx
sub $0x18,%rsp
mov %rdi,%r14
mov $0xffffffffffffffff,%rcx
mov $0x0,%eax
repnz scas %es:(%rdi),%al
not %rcx
lea -0x1(%rcx),%rbp
cmp $0x2,%ebp
jle 11fd <func0+0x94>
mov %r14,%rbx
lea -0x3(%rbp),%eax
lea 0x1(%r14,%rax,1),%r13
mov $0x0,%r15d
lea 0xe54(%rip),%r12
jmp 11bf <func0+0x56>
add $0x1,%r15d
add $0x1,%rbx
cmp %r13,%rbx
je 1203 <func0+0x9a>
mov %rbx,0x8(%rsp)
movsbl 0x1(%rbx),%esi
mov %r12,%rdi
callq 1060 <strchr@plt>
test %rax,%rax
jne 11b6 <func0+0x4d>
movsbl (%rbx),%esi
mov %r12,%rdi
callq 1060 <strchr@plt>
test %rax,%rax
jne 11b2 <func0+0x49>
mov 0x8(%rsp),%rax
movsbl 0x2(%rax),%esi
mov %r12,%rdi
callq 1060 <strchr@plt>
test %rax,%rax
jne 11b2 <func0+0x49>
jmp 11b6 <func0+0x4d>
mov $0x0,%r15d
movsbl (%r14),%esi
lea 0xdf6(%rip),%rdi
callq 1060 <strchr@plt>
test %rax,%rax
je 1244 <func0+0xdb>
movslq %ebp,%rbp
movsbl -0x1(%r14,%rbp,1),%esi
lea 0xddc(%rip),%rdi
callq 1060 <strchr@plt>
test %rax,%rax
je 125f <func0+0xf6>
mov %r15d,%eax
add $0x18,%rsp
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
movsbl 0x1(%r14),%esi
lea 0xdb4(%rip),%rdi
callq 1060 <strchr@plt>
cmp $0x1,%rax
sbb $0xffffffff,%r15d
jmp 1218 <func0+0xaf>
movsbl -0x2(%r14,%rbp,1),%esi
lea 0xd98(%rip),%rdi
callq 1060 <strchr@plt>
cmp $0x1,%rax
sbb $0xffffffff,%r15d
jmp 1232 <func0+0xc9>
| func0:
endbr64
push r15
push r14
push r13
push r12
push rbp
push rbx
sub rsp, 18h
mov r13, rdi
call _strlen
mov r14, rax
cmp eax, 2
jle short loc_120B
mov rbx, r13
lea eax, [rax-3]
lea r12, [r13+rax+1]
mov r15d, 0
lea rbp, aAeiou; "aeiou"
jmp short loc_11D2
loc_11C5:
add r15d, 1
loc_11C9:
add rbx, 1
cmp rbx, r12
jz short loc_1211
loc_11D2:
mov [rsp+48h+var_40], rbx
movsx esi, byte ptr [rbx+1]
mov rdi, rbp
call _strchr
test rax, rax
jnz short loc_11C9
movsx esi, byte ptr [rbx]
mov rdi, rbp
call _strchr
test rax, rax
jnz short loc_11C5
movsx esi, byte ptr [rbx+2]
mov rdi, rbp
call _strchr
test rax, rax
jnz short loc_11C5
jmp short loc_11C9
loc_120B:
mov r15d, 0
loc_1211:
movsx esi, byte ptr [r13+0]
lea rdi, aAeiou; "aeiou"
call _strchr
test rax, rax
jz short loc_1253
loc_1227:
movsxd r14, r14d
movsx esi, byte ptr [r13+r14-1]
lea rdi, aAeiou; "aeiou"
call _strchr
test rax, rax
jz short loc_126E
loc_1241:
mov eax, r15d
add rsp, 18h
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_1253:
movsx esi, byte ptr [r13+1]
lea rdi, aAeiou; "aeiou"
call _strchr
cmp rax, 1
sbb r15d, 0FFFFFFFFh
jmp short loc_1227
loc_126E:
movsx esi, byte ptr [r13+r14-2]
lea rdi, aAeiou; "aeiou"
call _strchr
cmp rax, 1
sbb r15d, 0FFFFFFFFh
jmp short loc_1241 | long long func0(char *a1)
{
int v1; // eax
int v2; // r14d
char *v3; // rbx
long long v4; // r12
unsigned int v5; // r15d
v1 = strlen();
v2 = v1;
if ( v1 <= 2 )
{
v5 = 0;
}
else
{
v3 = a1;
v4 = (long long)&a1[v1 - 3 + 1];
v5 = 0;
do
{
if ( !strchr("aeiou", (unsigned int)v3[1])
&& (strchr("aeiou", (unsigned int)*v3) || strchr("aeiou", (unsigned int)v3[2])) )
{
++v5;
}
++v3;
}
while ( v3 != (char *)v4 );
}
if ( !strchr("aeiou", (unsigned int)*a1) )
v5 -= (strchr("aeiou", (unsigned int)a1[1]) == 0) - 1;
if ( !strchr("aeiou", (unsigned int)a1[v2 - 1]) )
v5 -= (strchr("aeiou", (unsigned int)a1[v2 - 2]) == 0) - 1;
return v5;
} | func0:
ENDBR64
PUSH R15
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0x18
MOV R13,RDI
CALL 0x00101070
MOV R14,RAX
CMP EAX,0x2
JLE 0x0010120b
MOV RBX,R13
LEA EAX,[RAX + -0x3]
LEA R12,[R13 + RAX*0x1 + 0x1]
MOV R15D,0x0
LEA RBP,[0x102004]
JMP 0x001011d2
LAB_001011c5:
ADD R15D,0x1
LAB_001011c9:
ADD RBX,0x1
CMP RBX,R12
JZ 0x00101211
LAB_001011d2:
MOV qword ptr [RSP + 0x8],RBX
MOVSX ESI,byte ptr [RBX + 0x1]
MOV RDI,RBP
CALL 0x00101080
TEST RAX,RAX
JNZ 0x001011c9
MOVSX ESI,byte ptr [RBX]
MOV RDI,RBP
CALL 0x00101080
TEST RAX,RAX
JNZ 0x001011c5
MOVSX ESI,byte ptr [RBX + 0x2]
MOV RDI,RBP
CALL 0x00101080
TEST RAX,RAX
JNZ 0x001011c5
JMP 0x001011c9
LAB_0010120b:
MOV R15D,0x0
LAB_00101211:
MOVSX ESI,byte ptr [R13]
LEA RDI,[0x102004]
CALL 0x00101080
TEST RAX,RAX
JZ 0x00101253
LAB_00101227:
MOVSXD R14,R14D
MOVSX ESI,byte ptr [R13 + R14*0x1 + -0x1]
LEA RDI,[0x102004]
CALL 0x00101080
TEST RAX,RAX
JZ 0x0010126e
LAB_00101241:
MOV EAX,R15D
ADD RSP,0x18
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_00101253:
MOVSX ESI,byte ptr [R13 + 0x1]
LEA RDI,[0x102004]
CALL 0x00101080
CMP RAX,0x1
SBB R15D,-0x1
JMP 0x00101227
LAB_0010126e:
MOVSX ESI,byte ptr [R13 + R14*0x1 + -0x2]
LEA RDI,[0x102004]
CALL 0x00101080
CMP RAX,0x1
SBB R15D,-0x1
JMP 0x00101241 | int func0(char *param_1)
{
int iVar1;
size_t sVar2;
char *pcVar3;
char *pcVar4;
int iVar5;
sVar2 = strlen(param_1);
iVar1 = (int)sVar2;
if (iVar1 < 3) {
iVar5 = 0;
}
else {
iVar5 = 0;
pcVar4 = param_1;
do {
pcVar3 = strchr("aeiou",(int)pcVar4[1]);
if ((pcVar3 == (char *)0x0) &&
((pcVar3 = strchr("aeiou",(int)*pcVar4), pcVar3 != (char *)0x0 ||
(pcVar3 = strchr("aeiou",(int)pcVar4[2]), pcVar3 != (char *)0x0)))) {
iVar5 = iVar5 + 1;
}
pcVar4 = pcVar4 + 1;
} while (pcVar4 != param_1 + (ulong)(iVar1 - 3) + 1);
}
pcVar4 = strchr("aeiou",(int)*param_1);
if (pcVar4 == (char *)0x0) {
pcVar4 = strchr("aeiou",(int)param_1[1]);
iVar5 = (iVar5 + 1) - (uint)(pcVar4 == (char *)0x0);
}
pcVar4 = strchr("aeiou",(int)param_1[(long)iVar1 + -1]);
if (pcVar4 == (char *)0x0) {
pcVar4 = strchr("aeiou",(int)param_1[(long)iVar1 + -2]);
iVar5 = (iVar5 + 1) - (uint)(pcVar4 == (char *)0x0);
}
return iVar5;
} |
6,998 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
| int func0(const char *test_str) {
int res = 0;
const char *vow_list = "aeiou";
int len = strlen(test_str);
for (int idx = 1; idx < len - 1; idx++) {
if (strchr(vow_list, test_str[idx]) == NULL &&
(strchr(vow_list, test_str[idx - 1]) != NULL || strchr(vow_list, test_str[idx + 1]) != NULL)) {
res += 1;
}
}
if (strchr(vow_list, test_str[0]) == NULL && strchr(vow_list, test_str[1]) != NULL) {
res += 1;
}
if (strchr(vow_list, test_str[len - 1]) == NULL && strchr(vow_list, test_str[len - 2]) != NULL) {
res += 1;
}
return res;
}
| int main() {
assert(func0("bestinstareels") == 7);
assert(func0("partofthejourneyistheend") == 12);
assert(func0("amazonprime") == 5);
return 0;
}
| O2 | c | func0:
endbr64
push %r15
push %r14
push %r13
mov %rdi,%r13
push %r12
push %rbp
push %rbx
sub $0x8,%rsp
callq 1070 <strlen@plt>
mov %rax,%r14
cmp $0x2,%eax
jle 1350 <func0+0x120>
lea -0x3(%rax),%eax
mov %r13,%rbx
lea 0xda1(%rip),%rbp
xor %r15d,%r15d
lea 0x1(%r13,%rax,1),%r12
jmp 1279 <func0+0x49>
nopl (%rax)
add $0x1,%rbx
cmp %r12,%rbx
je 12a7 <func0+0x77>
movsbl 0x1(%rbx),%esi
mov %rbp,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
jne 1270 <func0+0x40>
movsbl (%rbx),%esi
mov %rbp,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
je 12f0 <func0+0xc0>
add $0x1,%rbx
add $0x1,%r15d
cmp %r12,%rbx
jne 1279 <func0+0x49>
movsbl 0x0(%r13),%esi
lea 0xd51(%rip),%rdi
callq 1080 <strchr@plt>
test %rax,%rax
je 1310 <func0+0xe0>
movslq %r14d,%r14
lea 0xd3d(%rip),%rdi
movsbl -0x1(%r13,%r14,1),%esi
callq 1080 <strchr@plt>
test %rax,%rax
je 1330 <func0+0x100>
add $0x8,%rsp
mov %r15d,%eax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
nopl 0x0(%rax)
movsbl 0x2(%rbx),%esi
mov %rbp,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
jne 129a <func0+0x6a>
jmpq 1270 <func0+0x40>
nopw %cs:0x0(%rax,%rax,1)
movsbl 0x1(%r13),%esi
lea 0xce8(%rip),%rdi
callq 1080 <strchr@plt>
cmp $0x1,%rax
sbb $0xffffffff,%r15d
jmp 12bd <func0+0x8d>
nopl 0x0(%rax,%rax,1)
movsbl -0x2(%r13,%r14,1),%esi
lea 0xcc7(%rip),%rdi
callq 1080 <strchr@plt>
cmp $0x1,%rax
sbb $0xffffffff,%r15d
jmp 12d7 <func0+0xa7>
nopl 0x0(%rax)
xor %r15d,%r15d
jmpq 12a7 <func0+0x77>
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
push r15
push r14
push r13
push r12
mov r12, rdi
push rbp
push rbx
sub rsp, 8
call _strlen
mov r13, rax
cmp eax, 2
jle loc_1340
lea eax, [rax-3]
mov rbx, r12
lea r15, aAeiou; "aeiou"
xor r14d, r14d
lea rbp, [r12+rax+1]
jmp short loc_1279
loc_1270:
add rbx, 1
cmp rbx, rbp
jz short loc_12A7
loc_1279:
movsx esi, byte ptr [rbx+1]
mov rdi, r15
call _strchr
test rax, rax
jnz short loc_1270
movsx esi, byte ptr [rbx]
mov rdi, r15
call _strchr
test rax, rax
jz short loc_12E8
loc_129A:
add rbx, 1
add r14d, 1
cmp rbx, rbp
jnz short loc_1279
loc_12A7:
movsx esi, byte ptr [r12]
mov rdi, r15
call _strchr
test rax, rax
jz short loc_1300
loc_12B9:
movsxd r13, r13d
mov rdi, r15
movsx esi, byte ptr [r12+r13-1]
call _strchr
test rax, rax
jz short loc_1320
loc_12CF:
add rsp, 8
mov eax, r14d
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_12E8:
movsx esi, byte ptr [rbx+2]
mov rdi, r15
call _strchr
test rax, rax
jnz short loc_129A
jmp loc_1270
loc_1300:
movsx esi, byte ptr [r12+1]
mov rdi, r15
call _strchr
cmp rax, 1
sbb r14d, 0FFFFFFFFh
jmp short loc_12B9
loc_1320:
movsx esi, byte ptr [r12+r13-2]
mov rdi, r15
call _strchr
cmp rax, 1
sbb r14d, 0FFFFFFFFh
jmp short loc_12CF
loc_1340:
xor r14d, r14d
lea r15, aAeiou; "aeiou"
jmp loc_12A7 | long long func0(char *a1)
{
int v1; // eax
int v2; // r13d
char *v3; // rbx
unsigned int v4; // r14d
long long v5; // rbp
v1 = strlen();
v2 = v1;
if ( v1 <= 2 )
{
v4 = 0;
}
else
{
v3 = a1;
v4 = 0;
v5 = (long long)&a1[v1 - 3 + 1];
do
{
while ( strchr("aeiou", (unsigned int)v3[1])
|| !strchr("aeiou", (unsigned int)*v3) && !strchr("aeiou", (unsigned int)v3[2]) )
{
if ( ++v3 == (char *)v5 )
goto LABEL_7;
}
++v3;
++v4;
}
while ( v3 != (char *)v5 );
}
LABEL_7:
if ( !strchr("aeiou", (unsigned int)*a1) )
v4 -= (strchr("aeiou", (unsigned int)a1[1]) == 0) - 1;
if ( !strchr("aeiou", (unsigned int)a1[v2 - 1]) )
v4 -= (strchr("aeiou", (unsigned int)a1[v2 - 2]) == 0) - 1;
return v4;
} | func0:
ENDBR64
PUSH R15
PUSH R14
PUSH R13
PUSH R12
MOV R12,RDI
PUSH RBP
PUSH RBX
SUB RSP,0x8
CALL 0x00101070
MOV R13,RAX
CMP EAX,0x2
JLE 0x00101340
LEA EAX,[RAX + -0x3]
MOV RBX,R12
LEA R15,[0x102004]
XOR R14D,R14D
LEA RBP,[R12 + RAX*0x1 + 0x1]
JMP 0x00101279
LAB_00101270:
ADD RBX,0x1
CMP RBX,RBP
JZ 0x001012a7
LAB_00101279:
MOVSX ESI,byte ptr [RBX + 0x1]
MOV RDI,R15
CALL 0x00101080
TEST RAX,RAX
JNZ 0x00101270
MOVSX ESI,byte ptr [RBX]
MOV RDI,R15
CALL 0x00101080
TEST RAX,RAX
JZ 0x001012e8
LAB_0010129a:
ADD RBX,0x1
ADD R14D,0x1
CMP RBX,RBP
JNZ 0x00101279
LAB_001012a7:
MOVSX ESI,byte ptr [R12]
MOV RDI,R15
CALL 0x00101080
TEST RAX,RAX
JZ 0x00101300
LAB_001012b9:
MOVSXD R13,R13D
MOV RDI,R15
MOVSX ESI,byte ptr [R12 + R13*0x1 + -0x1]
CALL 0x00101080
TEST RAX,RAX
JZ 0x00101320
LAB_001012cf:
ADD RSP,0x8
MOV EAX,R14D
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_001012e8:
MOVSX ESI,byte ptr [RBX + 0x2]
MOV RDI,R15
CALL 0x00101080
TEST RAX,RAX
JNZ 0x0010129a
JMP 0x00101270
LAB_00101300:
MOVSX ESI,byte ptr [R12 + 0x1]
MOV RDI,R15
CALL 0x00101080
CMP RAX,0x1
SBB R14D,-0x1
JMP 0x001012b9
LAB_00101320:
MOVSX ESI,byte ptr [R12 + R13*0x1 + -0x2]
MOV RDI,R15
CALL 0x00101080
CMP RAX,0x1
SBB R14D,-0x1
JMP 0x001012cf
LAB_00101340:
XOR R14D,R14D
LEA R15,[0x102004]
JMP 0x001012a7 | int func0(char *param_1)
{
int iVar1;
size_t sVar2;
char *pcVar3;
char *pcVar4;
int iVar5;
sVar2 = strlen(param_1);
iVar1 = (int)sVar2;
if (iVar1 < 3) {
iVar5 = 0;
}
else {
iVar5 = 0;
pcVar4 = param_1;
do {
while ((pcVar3 = strchr("aeiou",(int)pcVar4[1]), pcVar3 == (char *)0x0 &&
((pcVar3 = strchr("aeiou",(int)*pcVar4), pcVar3 != (char *)0x0 ||
(pcVar3 = strchr("aeiou",(int)pcVar4[2]), pcVar3 != (char *)0x0))))) {
pcVar4 = pcVar4 + 1;
iVar5 = iVar5 + 1;
if (pcVar4 == param_1 + (ulong)(iVar1 - 3) + 1) goto LAB_001012a7;
}
pcVar4 = pcVar4 + 1;
} while (pcVar4 != param_1 + (ulong)(iVar1 - 3) + 1);
}
LAB_001012a7:
pcVar4 = strchr("aeiou",(int)*param_1);
if (pcVar4 == (char *)0x0) {
pcVar4 = strchr("aeiou",(int)param_1[1]);
iVar5 = (iVar5 + 1) - (uint)(pcVar4 == (char *)0x0);
}
pcVar4 = strchr("aeiou",(int)param_1[(long)iVar1 + -1]);
if (pcVar4 == (char *)0x0) {
pcVar4 = strchr("aeiou",(int)param_1[(long)iVar1 + -2]);
iVar5 = (iVar5 + 1) - (uint)(pcVar4 == (char *)0x0);
}
return iVar5;
} |
6,999 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
| int func0(const char *test_str) {
int res = 0;
const char *vow_list = "aeiou";
int len = strlen(test_str);
for (int idx = 1; idx < len - 1; idx++) {
if (strchr(vow_list, test_str[idx]) == NULL &&
(strchr(vow_list, test_str[idx - 1]) != NULL || strchr(vow_list, test_str[idx + 1]) != NULL)) {
res += 1;
}
}
if (strchr(vow_list, test_str[0]) == NULL && strchr(vow_list, test_str[1]) != NULL) {
res += 1;
}
if (strchr(vow_list, test_str[len - 1]) == NULL && strchr(vow_list, test_str[len - 2]) != NULL) {
res += 1;
}
return res;
}
| int main() {
assert(func0("bestinstareels") == 7);
assert(func0("partofthejourneyistheend") == 12);
assert(func0("amazonprime") == 5);
return 0;
}
| O3 | c | func0:
endbr64
push %r15
push %r14
push %r13
mov %rdi,%r13
push %r12
push %rbp
push %rbx
sub $0x8,%rsp
callq 1070 <strlen@plt>
mov %rax,%r14
cmp $0x2,%eax
jle 1350 <func0+0x120>
lea -0x3(%rax),%eax
mov %r13,%rbx
lea 0xda1(%rip),%rbp
xor %r15d,%r15d
lea 0x1(%r13,%rax,1),%r12
jmp 1279 <func0+0x49>
nopl (%rax)
add $0x1,%rbx
cmp %rbx,%r12
je 12a7 <func0+0x77>
movsbl 0x1(%rbx),%esi
mov %rbp,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
jne 1270 <func0+0x40>
movsbl (%rbx),%esi
mov %rbp,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
je 12f0 <func0+0xc0>
add $0x1,%rbx
add $0x1,%r15d
cmp %rbx,%r12
jne 1279 <func0+0x49>
movsbl 0x0(%r13),%esi
lea 0xd51(%rip),%rdi
callq 1080 <strchr@plt>
test %rax,%rax
je 1310 <func0+0xe0>
movslq %r14d,%r14
lea 0xd3d(%rip),%rdi
movsbl -0x1(%r13,%r14,1),%esi
callq 1080 <strchr@plt>
test %rax,%rax
je 1330 <func0+0x100>
add $0x8,%rsp
mov %r15d,%eax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
nopl 0x0(%rax)
movsbl 0x2(%rbx),%esi
mov %rbp,%rdi
callq 1080 <strchr@plt>
test %rax,%rax
jne 129a <func0+0x6a>
jmpq 1270 <func0+0x40>
nopw %cs:0x0(%rax,%rax,1)
movsbl 0x1(%r13),%esi
lea 0xce8(%rip),%rdi
callq 1080 <strchr@plt>
cmp $0x1,%rax
sbb $0xffffffff,%r15d
jmp 12bd <func0+0x8d>
nopl 0x0(%rax,%rax,1)
movsbl -0x2(%r13,%r14,1),%esi
lea 0xcc7(%rip),%rdi
callq 1080 <strchr@plt>
cmp $0x1,%rax
sbb $0xffffffff,%r15d
jmp 12d7 <func0+0xa7>
nopl 0x0(%rax)
xor %r15d,%r15d
jmpq 12a7 <func0+0x77>
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
push r15
push r14
push r13
mov r13, rdi
push r12
push rbp
push rbx
sub rsp, 8
call _strlen
mov r14, rax
cmp eax, 2
jle loc_1340
lea eax, [rax-3]
mov rbx, r13
lea rbp, s; "aeiou"
xor r15d, r15d
lea r12, [r13+rax+1]
jmp short loc_1279
loc_1270:
add rbx, 1
cmp r12, rbx
jz short loc_12A7
loc_1279:
movsx esi, byte ptr [rbx+1]; c
mov rdi, rbp; s
call _strchr
test rax, rax
jnz short loc_1270
movsx esi, byte ptr [rbx]; c
mov rdi, rbp; s
call _strchr
test rax, rax
jz short loc_12E8
loc_129A:
add rbx, 1
add r15d, 1
cmp r12, rbx
jnz short loc_1279
loc_12A7:
movsx esi, byte ptr [r13+0]; c
mov rdi, rbp; s
call _strchr
test rax, rax
jz short loc_1300
loc_12B9:
movsxd r14, r14d
mov rdi, rbp; s
movsx esi, byte ptr [r13+r14-1]; c
call _strchr
test rax, rax
jz short loc_1320
loc_12CF:
add rsp, 8
mov eax, r15d
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_12E8:
movsx esi, byte ptr [rbx+2]; c
mov rdi, rbp; s
call _strchr
test rax, rax
jnz short loc_129A
jmp loc_1270
loc_1300:
movsx esi, byte ptr [r13+1]; c
mov rdi, rbp; s
call _strchr
cmp rax, 1
sbb r15d, 0FFFFFFFFh
jmp short loc_12B9
loc_1320:
movsx esi, byte ptr [r13+r14-2]; c
mov rdi, rbp; s
call _strchr
cmp rax, 1
sbb r15d, 0FFFFFFFFh
jmp short loc_12CF
loc_1340:
xor r15d, r15d
lea rbp, s; "aeiou"
jmp loc_12A7 | long long func0(const char *a1)
{
int v1; // eax
int v2; // r14d
char *v3; // rbx
unsigned int v4; // r15d
long long v5; // r12
v1 = strlen(a1);
v2 = v1;
if ( v1 <= 2 )
{
v4 = 0;
}
else
{
v3 = (char *)a1;
v4 = 0;
v5 = (long long)&a1[v1 - 3 + 1];
do
{
while ( strchr("aeiou", v3[1]) || !strchr("aeiou", *v3) && !strchr("aeiou", v3[2]) )
{
if ( (char *)v5 == ++v3 )
goto LABEL_7;
}
++v3;
++v4;
}
while ( (char *)v5 != v3 );
}
LABEL_7:
if ( !strchr("aeiou", *a1) )
v4 -= (strchr("aeiou", a1[1]) == 0LL) - 1;
if ( !strchr("aeiou", a1[v2 - 1]) )
v4 -= (strchr("aeiou", a1[v2 - 2]) == 0LL) - 1;
return v4;
} | func0:
ENDBR64
PUSH R15
PUSH R14
PUSH R13
MOV R13,RDI
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0x8
CALL 0x00101070
MOV R14,RAX
CMP EAX,0x2
JLE 0x00101340
LEA EAX,[RAX + -0x3]
MOV RBX,R13
LEA RBP,[0x102004]
XOR R15D,R15D
LEA R12,[R13 + RAX*0x1 + 0x1]
JMP 0x00101279
LAB_00101270:
ADD RBX,0x1
CMP R12,RBX
JZ 0x001012a7
LAB_00101279:
MOVSX ESI,byte ptr [RBX + 0x1]
MOV RDI,RBP
CALL 0x00101080
TEST RAX,RAX
JNZ 0x00101270
MOVSX ESI,byte ptr [RBX]
MOV RDI,RBP
CALL 0x00101080
TEST RAX,RAX
JZ 0x001012e8
LAB_0010129a:
ADD RBX,0x1
ADD R15D,0x1
CMP R12,RBX
JNZ 0x00101279
LAB_001012a7:
MOVSX ESI,byte ptr [R13]
MOV RDI,RBP
CALL 0x00101080
TEST RAX,RAX
JZ 0x00101300
LAB_001012b9:
MOVSXD R14,R14D
MOV RDI,RBP
MOVSX ESI,byte ptr [R13 + R14*0x1 + -0x1]
CALL 0x00101080
TEST RAX,RAX
JZ 0x00101320
LAB_001012cf:
ADD RSP,0x8
MOV EAX,R15D
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_001012e8:
MOVSX ESI,byte ptr [RBX + 0x2]
MOV RDI,RBP
CALL 0x00101080
TEST RAX,RAX
JNZ 0x0010129a
JMP 0x00101270
LAB_00101300:
MOVSX ESI,byte ptr [R13 + 0x1]
MOV RDI,RBP
CALL 0x00101080
CMP RAX,0x1
SBB R15D,-0x1
JMP 0x001012b9
LAB_00101320:
MOVSX ESI,byte ptr [R13 + R14*0x1 + -0x2]
MOV RDI,RBP
CALL 0x00101080
CMP RAX,0x1
SBB R15D,-0x1
JMP 0x001012cf
LAB_00101340:
XOR R15D,R15D
LEA RBP,[0x102004]
JMP 0x001012a7 | int func0(char *param_1)
{
int iVar1;
size_t sVar2;
char *pcVar3;
char *pcVar4;
int iVar5;
sVar2 = strlen(param_1);
iVar1 = (int)sVar2;
if (iVar1 < 3) {
iVar5 = 0;
}
else {
iVar5 = 0;
pcVar4 = param_1;
do {
while ((pcVar3 = strchr("aeiou",(int)pcVar4[1]), pcVar3 == (char *)0x0 &&
((pcVar3 = strchr("aeiou",(int)*pcVar4), pcVar3 != (char *)0x0 ||
(pcVar3 = strchr("aeiou",(int)pcVar4[2]), pcVar3 != (char *)0x0))))) {
pcVar4 = pcVar4 + 1;
iVar5 = iVar5 + 1;
if (param_1 + (ulong)(iVar1 - 3) + 1 == pcVar4) goto LAB_001012a7;
}
pcVar4 = pcVar4 + 1;
} while (param_1 + (ulong)(iVar1 - 3) + 1 != pcVar4);
}
LAB_001012a7:
pcVar4 = strchr("aeiou",(int)*param_1);
if (pcVar4 == (char *)0x0) {
pcVar4 = strchr("aeiou",(int)param_1[1]);
iVar5 = (iVar5 + 1) - (uint)(pcVar4 == (char *)0x0);
}
pcVar4 = strchr("aeiou",(int)param_1[(long)iVar1 + -1]);
if (pcVar4 == (char *)0x0) {
pcVar4 = strchr("aeiou",(int)param_1[(long)iVar1 + -2]);
iVar5 = (iVar5 + 1) - (uint)(pcVar4 == (char *)0x0);
}
return iVar5;
} |
7,000 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
int compare(const void* a, const void* b) {
return (*(int*)a - *(int*)b);
}
| int func0(int* arr, int n) {
qsort(arr, n, sizeof(int), compare);
int sum = arr[0];
for (int i = 0; i < n - 1; i++) {
if (arr[i] != arr[i + 1]) {
sum += arr[i + 1];
}
}
return sum;
}
| int main() {
int arr1[] = {1, 2, 3, 1, 1, 4, 5, 6};
int arr2[] = {1, 10, 9, 4, 2, 10, 10, 45, 4};
int arr3[] = {12, 10, 9, 45, 2, 10, 10, 45, 10};
assert(func0(arr1, 8) == 21);
assert(func0(arr2, 9) == 71);
assert(func0(arr3, 9) == 78);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x20,%rsp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov -0x1c(%rbp),%eax
movslq %eax,%rsi
mov -0x18(%rbp),%rax
lea -0x46(%rip),%rcx
mov $0x4,%edx
mov %rax,%rdi
callq 1070 <qsort@plt>
mov -0x18(%rbp),%rax
mov (%rax),%eax
mov %eax,-0x8(%rbp)
movl $0x0,-0x4(%rbp)
jmp 1243 <func0+0x98>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%edx
mov -0x4(%rbp),%eax
cltq
add $0x1,%rax
lea 0x0(,%rax,4),%rcx
mov -0x18(%rbp),%rax
add %rcx,%rax
mov (%rax),%eax
cmp %eax,%edx
je 123f <func0+0x94>
mov -0x4(%rbp),%eax
cltq
add $0x1,%rax
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
add %eax,-0x8(%rbp)
addl $0x1,-0x4(%rbp)
mov -0x1c(%rbp),%eax
sub $0x1,%eax
cmp %eax,-0x4(%rbp)
jl 11ee <func0+0x43>
mov -0x8(%rbp),%eax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 20h
mov [rbp+base], rdi
mov [rbp+var_1C], esi
mov eax, [rbp+var_1C]
movsxd rsi, eax; nmemb
mov rax, [rbp+base]
lea rdx, compare
mov rcx, rdx; compar
mov edx, 4; size
mov rdi, rax; base
call _qsort
mov rax, [rbp+base]
mov eax, [rax]
mov [rbp+var_8], eax
mov [rbp+var_4], 0
jmp short loc_1246
loc_11F1:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+base]
add rax, rdx
mov edx, [rax]
mov eax, [rbp+var_4]
cdqe
add rax, 1
lea rcx, ds:0[rax*4]
mov rax, [rbp+base]
add rax, rcx
mov eax, [rax]
cmp edx, eax
jz short loc_1242
mov eax, [rbp+var_4]
cdqe
add rax, 1
lea rdx, ds:0[rax*4]
mov rax, [rbp+base]
add rax, rdx
mov eax, [rax]
add [rbp+var_8], eax
loc_1242:
add [rbp+var_4], 1
loc_1246:
mov eax, [rbp+var_1C]
sub eax, 1
cmp [rbp+var_4], eax
jl short loc_11F1
mov eax, [rbp+var_8]
leave
retn | long long func0(_DWORD *a1, int a2)
{
unsigned int v3; // [rsp+18h] [rbp-8h]
int i; // [rsp+1Ch] [rbp-4h]
qsort(a1, a2, 4uLL, compare);
v3 = *a1;
for ( i = 0; i < a2 - 1; ++i )
{
if ( a1[i] != a1[i + 1] )
v3 += a1[i + 1];
}
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 EAX,dword ptr [RBP + -0x1c]
MOVSXD RSI,EAX
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x101189]
MOV RCX,RDX
MOV EDX,0x4
MOV RDI,RAX
CALL 0x00101070
MOV RAX,qword ptr [RBP + -0x18]
MOV EAX,dword ptr [RAX]
MOV dword ptr [RBP + -0x8],EAX
MOV dword ptr [RBP + -0x4],0x0
JMP 0x00101246
LAB_001011f1:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x4]
CDQE
ADD RAX,0x1
LEA RCX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RCX
MOV EAX,dword ptr [RAX]
CMP EDX,EAX
JZ 0x00101242
MOV EAX,dword ptr [RBP + -0x4]
CDQE
ADD RAX,0x1
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
ADD dword ptr [RBP + -0x8],EAX
LAB_00101242:
ADD dword ptr [RBP + -0x4],0x1
LAB_00101246:
MOV EAX,dword ptr [RBP + -0x1c]
SUB EAX,0x1
CMP dword ptr [RBP + -0x4],EAX
JL 0x001011f1
MOV EAX,dword ptr [RBP + -0x8]
LEAVE
RET | int func0(int *param_1,int param_2)
{
int local_10;
int local_c;
qsort(param_1,(long)param_2,4,compare);
local_10 = *param_1;
for (local_c = 0; local_c < param_2 + -1; local_c = local_c + 1) {
if (param_1[local_c] != param_1[(long)local_c + 1]) {
local_10 = local_10 + param_1[(long)local_c + 1];
}
}
return local_10;
} |
7,001 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
int compare(const void* a, const void* b) {
return (*(int*)a - *(int*)b);
}
| int func0(int* arr, int n) {
qsort(arr, n, sizeof(int), compare);
int sum = arr[0];
for (int i = 0; i < n - 1; i++) {
if (arr[i] != arr[i + 1]) {
sum += arr[i + 1];
}
}
return sum;
}
| int main() {
int arr1[] = {1, 2, 3, 1, 1, 4, 5, 6};
int arr2[] = {1, 10, 9, 4, 2, 10, 10, 45, 4};
int arr3[] = {12, 10, 9, 45, 2, 10, 10, 45, 10};
assert(func0(arr1, 8) == 21);
assert(func0(arr2, 9) == 71);
assert(func0(arr3, 9) == 78);
return 0;
}
| O1 | c | func0:
endbr64
push %rbp
push %rbx
sub $0x8,%rsp
mov %rdi,%rbx
mov %esi,%ebp
movslq %esi,%rsi
lea -0x22(%rip),%rcx
mov $0x4,%edx
callq 1070 <qsort@plt>
mov (%rbx),%edx
cmp $0x1,%ebp
jle 11db <func0+0x49>
mov %rbx,%rax
lea -0x2(%rbp),%ecx
lea 0x4(%rbx,%rcx,4),%rdi
mov 0x4(%rax),%ecx
lea (%rdx,%rcx,1),%esi
cmp %ecx,(%rax)
cmovne %esi,%edx
add $0x4,%rax
cmp %rdi,%rax
jne 11c7 <func0+0x35>
mov %edx,%eax
add $0x8,%rsp
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
push rbx
sub rsp, 8
mov rbx, rdi
mov ebp, esi
movsxd rsi, esi
lea rcx, compare
mov edx, 4
call _qsort
mov edx, [rbx]
cmp ebp, 1
jle short loc_11DB
mov rax, rbx
lea ecx, [rbp-2]
lea rdi, [rbx+rcx*4+4]
loc_11C7:
mov ecx, [rax+4]
lea esi, [rdx+rcx]
cmp [rax], ecx
cmovnz edx, esi
add rax, 4
cmp rax, rdi
jnz short loc_11C7
loc_11DB:
mov eax, edx
add rsp, 8
pop rbx
pop rbp
retn | long long func0(unsigned int *a1, int a2)
{
unsigned int v2; // edx
unsigned int *v3; // rax
long long v4; // rdi
unsigned int v5; // ecx
qsort(a1, a2, 4LL, compare);
v2 = *a1;
if ( a2 > 1 )
{
v3 = a1;
v4 = (long long)&a1[a2 - 2 + 1];
do
{
v5 = v3[1];
if ( *v3 != v5 )
v2 += v5;
++v3;
}
while ( v3 != (unsigned int *)v4 );
}
return v2;
} | func0:
ENDBR64
PUSH RBP
PUSH RBX
SUB RSP,0x8
MOV RBX,RDI
MOV EBP,ESI
MOVSXD RSI,ESI
LEA RCX,[0x101189]
MOV EDX,0x4
CALL 0x00101070
MOV EDX,dword ptr [RBX]
CMP EBP,0x1
JLE 0x001011db
MOV RAX,RBX
LEA ECX,[RBP + -0x2]
LEA RDI,[RBX + RCX*0x4 + 0x4]
LAB_001011c7:
MOV ECX,dword ptr [RAX + 0x4]
LEA ESI,[RDX + RCX*0x1]
CMP dword ptr [RAX],ECX
CMOVNZ EDX,ESI
ADD RAX,0x4
CMP RAX,RDI
JNZ 0x001011c7
LAB_001011db:
MOV EAX,EDX
ADD RSP,0x8
POP RBX
POP RBP
RET | int func0(int *param_1,int param_2)
{
int *piVar1;
int iVar2;
qsort(param_1,(long)param_2,4,compare);
iVar2 = *param_1;
if (1 < param_2) {
piVar1 = param_1 + (ulong)(param_2 - 2) + 1;
do {
if (*param_1 != param_1[1]) {
iVar2 = iVar2 + param_1[1];
}
param_1 = param_1 + 1;
} while (param_1 != piVar1);
}
return iVar2;
} |
7,002 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
int compare(const void* a, const void* b) {
return (*(int*)a - *(int*)b);
}
| int func0(int* arr, int n) {
qsort(arr, n, sizeof(int), compare);
int sum = arr[0];
for (int i = 0; i < n - 1; i++) {
if (arr[i] != arr[i + 1]) {
sum += arr[i + 1];
}
}
return sum;
}
| int main() {
int arr1[] = {1, 2, 3, 1, 1, 4, 5, 6};
int arr2[] = {1, 10, 9, 4, 2, 10, 10, 45, 4};
int arr3[] = {12, 10, 9, 45, 2, 10, 10, 45, 10};
assert(func0(arr1, 8) == 21);
assert(func0(arr2, 9) == 71);
assert(func0(arr3, 9) == 78);
return 0;
}
| O2 | c | func0:
endbr64
push %rbp
movslq %esi,%rsi
lea -0x1f(%rip),%rcx
mov $0x4,%edx
push %rbx
mov %rsi,%rbp
mov %rdi,%rbx
sub $0x8,%rsp
callq 1070 <qsort@plt>
mov (%rbx),%r8d
cmp $0x1,%ebp
jle 1377 <func0+0x57>
lea 0x4(%rbx),%rdi
lea -0x2(%rbp),%eax
mov %r8d,%ecx
lea (%rdi,%rax,4),%rsi
jmp 1366 <func0+0x46>
nopl 0x0(%rax)
add $0x4,%rdi
mov %eax,%ecx
mov (%rdi),%eax
lea (%r8,%rax,1),%edx
cmp %ecx,%eax
cmovne %edx,%r8d
cmp %rsi,%rdi
jne 1360 <func0+0x40>
add $0x8,%rsp
mov %r8d,%eax
pop %rbx
pop %rbp
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
push rbp
movsxd rsi, esi
lea rcx, compare
mov edx, 4
push rbx
mov rbp, rsi
mov rbx, rdi
sub rsp, 8
call _qsort
mov r8d, [rbx]
cmp ebp, 1
jle short loc_1377
lea rdi, [rbx+4]
lea eax, [rbp-2]
mov ecx, r8d
lea rsi, [rdi+rax*4]
jmp short loc_1366
loc_1360:
add rdi, 4
mov ecx, eax
loc_1366:
mov eax, [rdi]
lea edx, [r8+rax]
cmp eax, ecx
cmovnz r8d, edx
cmp rdi, rsi
jnz short loc_1360
loc_1377:
add rsp, 8
mov eax, r8d
pop rbx
pop rbp
retn | long long func0(unsigned int *a1, int a2)
{
unsigned int v3; // r8d
int *v4; // rdi
unsigned int i; // ecx
unsigned int v6; // eax
qsort(a1, a2, 4LL, compare);
v3 = *a1;
if ( a2 > 1 )
{
v4 = (int *)(a1 + 1);
for ( i = v3; ; i = v6 )
{
v6 = *v4;
if ( *v4 != i )
v3 += *v4;
if ( v4 == (int *)&a1[a2 - 2 + 1] )
break;
++v4;
}
}
return v3;
} | func0:
ENDBR64
PUSH RBP
MOVSXD RSI,ESI
LEA RCX,[0x101310]
MOV EDX,0x4
PUSH RBX
MOV RBP,RSI
MOV RBX,RDI
SUB RSP,0x8
CALL 0x00101070
MOV R8D,dword ptr [RBX]
CMP EBP,0x1
JLE 0x00101377
LEA RDI,[RBX + 0x4]
LEA EAX,[RBP + -0x2]
MOV ECX,R8D
LEA RSI,[RDI + RAX*0x4]
JMP 0x00101366
LAB_00101360:
ADD RDI,0x4
MOV ECX,EAX
LAB_00101366:
MOV EAX,dword ptr [RDI]
LEA EDX,[R8 + RAX*0x1]
CMP EAX,ECX
CMOVNZ R8D,EDX
CMP RDI,RSI
JNZ 0x00101360
LAB_00101377:
ADD RSP,0x8
MOV EAX,R8D
POP RBX
POP RBP
RET | int func0(int *param_1,int param_2)
{
int *piVar1;
int iVar2;
int iVar3;
int iVar4;
qsort(param_1,(long)param_2,4,compare);
iVar4 = *param_1;
if (1 < param_2) {
param_1 = param_1 + 1;
piVar1 = param_1 + (param_2 - 2);
iVar3 = iVar4;
while( true ) {
iVar2 = *param_1;
if (iVar2 != iVar3) {
iVar4 = iVar4 + iVar2;
}
if (param_1 == piVar1) break;
param_1 = param_1 + 1;
iVar3 = iVar2;
}
}
return iVar4;
} |
7,003 | func0 |
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
int compare(const void* a, const void* b) {
return (*(int*)a - *(int*)b);
}
| int func0(int* arr, int n) {
qsort(arr, n, sizeof(int), compare);
int sum = arr[0];
for (int i = 0; i < n - 1; i++) {
if (arr[i] != arr[i + 1]) {
sum += arr[i + 1];
}
}
return sum;
}
| int main() {
int arr1[] = {1, 2, 3, 1, 1, 4, 5, 6};
int arr2[] = {1, 10, 9, 4, 2, 10, 10, 45, 4};
int arr3[] = {12, 10, 9, 45, 2, 10, 10, 45, 10};
assert(func0(arr1, 8) == 21);
assert(func0(arr2, 9) == 71);
assert(func0(arr3, 9) == 78);
return 0;
}
| O3 | c | func0:
endbr64
push %rbp
movslq %esi,%rsi
lea -0x1f(%rip),%rcx
mov $0x4,%edx
push %rbx
mov %rsi,%rbp
mov %rdi,%rbx
sub $0x8,%rsp
callq 1070 <qsort@plt>
lea -0x1(%rbp),%ecx
mov (%rbx),%r8d
test %ecx,%ecx
jle 13af <func0+0xdf>
sub $0x2,%ebp
cmp $0x2,%ebp
jbe 13b9 <func0+0xe9>
mov %ecx,%edx
mov %rbx,%rax
pxor %xmm1,%xmm1
shr $0x2,%edx
shl $0x4,%rdx
add %rbx,%rdx
nopl 0x0(%rax)
movdqu 0x4(%rax),%xmm2
movdqu (%rax),%xmm0
add $0x10,%rax
pcmpeqd %xmm2,%xmm0
pandn %xmm2,%xmm0
paddd %xmm0,%xmm1
cmp %rdx,%rax
jne 1328 <func0+0x58>
movdqa %xmm1,%xmm0
psrldq $0x8,%xmm0
paddd %xmm0,%xmm1
movdqa %xmm1,%xmm0
psrldq $0x4,%xmm0
paddd %xmm0,%xmm1
movd %xmm1,%eax
add %eax,%r8d
mov %ecx,%eax
and $0xfffffffc,%eax
test $0x3,%cl
je 13af <func0+0xdf>
movslq %eax,%rdx
mov 0x4(%rbx,%rdx,4),%esi
cmp %esi,(%rbx,%rdx,4)
je 1380 <func0+0xb0>
add %esi,%r8d
lea 0x1(%rax),%edx
cmp %edx,%ecx
jle 13af <func0+0xdf>
movslq %edx,%rdx
mov 0x4(%rbx,%rdx,4),%edx
cmp %esi,%edx
lea (%r8,%rdx,1),%edi
cmovne %edi,%r8d
add $0x2,%eax
cmp %eax,%ecx
jle 13af <func0+0xdf>
cltq
mov 0x4(%rbx,%rax,4),%eax
lea (%r8,%rax,1),%ecx
cmp %eax,%edx
cmovne %ecx,%r8d
add $0x8,%rsp
mov %r8d,%eax
pop %rbx
pop %rbp
retq
xor %eax,%eax
jmp 1371 <func0+0xa1>
nopl (%rax)
| func0:
endbr64
push rbp
movsxd rsi, esi; nmemb
lea rcx, compare; compar
mov edx, 4; size
push rbx
mov rbp, rsi
mov rbx, rdi
sub rsp, 8
call _qsort
mov ecx, [rbx]
cmp ebp, 1
jle loc_13B5
lea esi, [rbp-1]
sub ebp, 2
cmp ebp, 2
jbe loc_13BE
mov edx, esi
mov rax, rbx
pxor xmm1, xmm1
shr edx, 2
shl rdx, 4
add rdx, rbx
nop dword ptr [rax+00000000h]
loc_1328:
movdqu xmm2, xmmword ptr [rax+4]
movdqu xmm0, xmmword ptr [rax]
add rax, 10h
pcmpeqd xmm0, xmm2
pandn xmm0, xmm2
paddd xmm1, xmm0
cmp rdx, rax
jnz short loc_1328
movdqa xmm0, xmm1
psrldq xmm0, 8
paddd xmm1, xmm0
movdqa xmm0, xmm1
psrldq xmm0, 4
paddd xmm1, xmm0
movd eax, xmm1
add ecx, eax
mov eax, esi
and eax, 0FFFFFFFCh
test sil, 3
jz short loc_13B5
loc_1371:
movsxd r8, eax
lea rdx, ds:0[r8*4]
mov edi, [rbx+rdx+4]
cmp [rbx+r8*4], edi
jz short loc_1388
add ecx, edi
loc_1388:
lea r8d, [rax+1]
cmp esi, r8d
jle short loc_13B5
mov r8d, [rbx+rdx+8]
cmp edi, r8d
lea r9d, [rcx+r8]
cmovnz ecx, r9d
add eax, 2
cmp esi, eax
jle short loc_13B5
mov eax, [rbx+rdx+0Ch]
lea edx, [rcx+rax]
cmp r8d, eax
cmovnz ecx, edx
loc_13B5:
add rsp, 8
mov eax, ecx
pop rbx
pop rbp
retn
loc_13BE:
xor eax, eax
jmp short loc_1371 | long long func0(_DWORD *a1, int a2)
{
unsigned int v4; // ecx
int v5; // esi
_DWORD *v6; // rax
__m128i v7; // xmm1
__m128i v8; // xmm2
__m128i v9; // xmm0
__m128i v10; // xmm1
signed int v11; // eax
long long v12; // rdx
int v13; // edi
int v14; // r8d
int v15; // eax
qsort(a1, a2, 4uLL, compare);
v4 = *a1;
if ( a2 > 1 )
{
v5 = a2 - 1;
if ( (unsigned int)(a2 - 2) <= 2 )
{
v11 = 0;
}
else
{
v6 = a1;
v7 = 0LL;
do
{
v8 = _mm_loadu_si128((const __m128i *)(v6 + 1));
v9 = _mm_loadu_si128((const __m128i *)v6);
v6 += 4;
v7 = _mm_add_epi32(v7, _mm_andnot_si128(_mm_cmpeq_epi32(v9, v8), v8));
}
while ( &a1[4 * ((unsigned int)v5 >> 2)] != v6 );
v10 = _mm_add_epi32(v7, _mm_srli_si128(v7, 8));
v4 += _mm_cvtsi128_si32(_mm_add_epi32(v10, _mm_srli_si128(v10, 4)));
v11 = v5 & 0xFFFFFFFC;
if ( (v5 & 3) == 0 )
return v4;
}
v12 = v11;
v13 = a1[v12 + 1];
if ( a1[v12] != v13 )
v4 += v13;
if ( v5 > v11 + 1 )
{
v14 = a1[v12 + 2];
if ( v13 != v14 )
v4 += v14;
if ( v5 > v11 + 2 )
{
v15 = a1[v12 + 3];
if ( v14 != v15 )
v4 += v15;
}
}
}
return v4;
} | func0:
ENDBR64
PUSH RBP
MOVSXD RSI,ESI
LEA RCX,[0x1012c0]
MOV EDX,0x4
PUSH RBX
MOV RBP,RSI
MOV RBX,RDI
SUB RSP,0x8
CALL 0x00101070
MOV ECX,dword ptr [RBX]
CMP EBP,0x1
JLE 0x001013b5
LEA ESI,[RBP + -0x1]
SUB EBP,0x2
CMP EBP,0x2
JBE 0x001013be
MOV EDX,ESI
MOV RAX,RBX
PXOR XMM1,XMM1
SHR EDX,0x2
SHL RDX,0x4
ADD RDX,RBX
NOP dword ptr [RAX]
LAB_00101328:
MOVDQU XMM2,xmmword ptr [RAX + 0x4]
MOVDQU XMM0,xmmword ptr [RAX]
ADD RAX,0x10
PCMPEQD XMM0,XMM2
PANDN XMM0,XMM2
PADDD XMM1,XMM0
CMP RDX,RAX
JNZ 0x00101328
MOVDQA XMM0,XMM1
PSRLDQ XMM0,0x8
PADDD XMM1,XMM0
MOVDQA XMM0,XMM1
PSRLDQ XMM0,0x4
PADDD XMM1,XMM0
MOVD EAX,XMM1
ADD ECX,EAX
MOV EAX,ESI
AND EAX,0xfffffffc
TEST SIL,0x3
JZ 0x001013b5
LAB_00101371:
MOVSXD R8,EAX
LEA RDX,[R8*0x4]
MOV EDI,dword ptr [RBX + RDX*0x1 + 0x4]
CMP dword ptr [RBX + R8*0x4],EDI
JZ 0x00101388
ADD ECX,EDI
LAB_00101388:
LEA R8D,[RAX + 0x1]
CMP ESI,R8D
JLE 0x001013b5
MOV R8D,dword ptr [RBX + RDX*0x1 + 0x8]
CMP EDI,R8D
LEA R9D,[RCX + R8*0x1]
CMOVNZ ECX,R9D
ADD EAX,0x2
CMP ESI,EAX
JLE 0x001013b5
MOV EAX,dword ptr [RBX + RDX*0x1 + 0xc]
LEA EDX,[RCX + RAX*0x1]
CMP R8D,EAX
CMOVNZ ECX,EDX
LAB_001013b5:
ADD RSP,0x8
MOV EAX,ECX
POP RBX
POP RBP
RET
LAB_001013be:
XOR EAX,EAX
JMP 0x00101371 | uint func0(uint *param_1,int param_2)
{
uint *puVar1;
uint uVar2;
uint uVar3;
uint *puVar4;
uint *puVar5;
uint *puVar6;
uint *puVar7;
uint *puVar8;
uint *puVar9;
uint uVar10;
uint *puVar11;
uint uVar12;
uint uVar13;
int iVar14;
int iVar15;
int iVar16;
int iVar17;
qsort(param_1,(long)param_2,4,compare);
uVar12 = *param_1;
if (1 < param_2) {
uVar13 = param_2 - 1;
if (param_2 - 2U < 3) {
uVar10 = 0;
}
else {
iVar14 = 0;
iVar15 = 0;
iVar16 = 0;
iVar17 = 0;
puVar11 = param_1;
do {
puVar1 = puVar11 + 1;
puVar4 = puVar11 + 2;
puVar5 = puVar11 + 3;
puVar6 = puVar11 + 4;
uVar10 = *puVar11;
puVar7 = puVar11 + 1;
puVar8 = puVar11 + 2;
puVar9 = puVar11 + 3;
puVar11 = puVar11 + 4;
iVar14 = iVar14 + (~-(uint)(uVar10 == *puVar1) & *puVar1);
iVar15 = iVar15 + (~-(uint)(*puVar7 == *puVar4) & *puVar4);
iVar16 = iVar16 + (~-(uint)(*puVar8 == *puVar5) & *puVar5);
iVar17 = iVar17 + (~-(uint)(*puVar9 == *puVar6) & *puVar6);
} while (param_1 + (ulong)(uVar13 >> 2) * 4 != puVar11);
uVar12 = uVar12 + iVar14 + iVar16 + iVar15 + iVar17;
uVar10 = uVar13 & 0xfffffffc;
if ((uVar13 & 3) == 0) {
return uVar12;
}
}
uVar2 = param_1[(long)(int)uVar10 + 1];
if (param_1[(int)uVar10] != uVar2) {
uVar12 = uVar12 + uVar2;
}
if ((int)(uVar10 + 1) < (int)uVar13) {
uVar3 = param_1[(long)(int)uVar10 + 2];
if (uVar2 != uVar3) {
uVar12 = uVar12 + uVar3;
}
if (((int)(uVar10 + 2) < (int)uVar13) && (uVar3 != param_1[(long)(int)uVar10 + 3])) {
uVar12 = uVar12 + param_1[(long)(int)uVar10 + 3];
}
}
}
return uVar12;
} |
7,004 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int **group;
int *groupSize;
int numGroups;
} PackResult;
int compare_arrays(int a[], int b[], int a_size, int b_size) {
if (a_size != b_size)
return 0;
for (int i = 0; i < a_size; i++) {
if (a[i] != b[i]) {
return 0;
}
}
return 1;
}
| PackResult* func0(int list1[], int size) {
PackResult *result = malloc(sizeof(PackResult));
result->group = malloc(sizeof(int*) * size);
result->groupSize = malloc(sizeof(int) * size);
result->numGroups = 0;
if (size == 0) {
return result;
}
int current_value = list1[0];
int group_count = 0;
result->group[result->numGroups] = malloc(sizeof(int) * size);
result->group[result->numGroups][group_count++] = current_value;
for (int i = 1; i < size; i++) {
if (list1[i] == current_value) {
result->group[result->numGroups][group_count++] = list1[i];
} else {
result->groupSize[result->numGroups] = group_count;
result->numGroups++;
current_value = list1[i];
result->group[result->numGroups] = malloc(sizeof(int) * size);
group_count = 0;
result->group[result->numGroups][group_count++] = current_value;
}
}
result->groupSize[result->numGroups] = group_count;
result->numGroups++;
return result;
}
| int main() {
// Test Case 1
int input1[] = {0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4};
int size1 = sizeof(input1)/sizeof(input1[0]);
PackResult* result1 = func0(input1, size1);
assert(result1->numGroups == 11);
assert(compare_arrays(result1->group[0], (int[]){0, 0}, result1->groupSize[0], 2));
assert(compare_arrays(result1->group[1], (int[]){1}, result1->groupSize[1], 1));
assert(compare_arrays(result1->group[4], (int[]){4, 4}, result1->groupSize[4], 2));
assert(compare_arrays(result1->group[10], (int[]){4, 4}, result1->groupSize[10], 2));
// Test Case 2
int input2[] = {10, 10, 15, 19, 18, 18, 17, 26, 26, 17, 18, 10};
int size2 = sizeof(input2)/sizeof(input2[0]);
PackResult* result2 = func0(input2, size2);
assert(result2->numGroups == 9);
assert(compare_arrays(result2->group[0], (int[]){10, 10}, result2->groupSize[0], 2));
assert(compare_arrays(result2->group[5], (int[]){26, 26}, result2->groupSize[5], 2));
// Cleaning up memory
for (int i = 0; i < result1->numGroups; i++) {
free(result1->group[i]);
}
free(result1->group);
free(result1->groupSize);
free(result1);
for (int i = 0; i < result2->numGroups; i++) {
free(result2->group[i]);
}
free(result2->group);
free(result2->groupSize);
free(result2);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
sub $0x38,%rsp
mov %rdi,-0x38(%rbp)
mov %esi,-0x3c(%rbp)
mov $0x18,%edi
callq 10b0 <malloc@plt>
mov %rax,-0x18(%rbp)
mov -0x3c(%rbp),%eax
cltq
shl $0x3,%rax
mov %rax,%rdi
callq 10b0 <malloc@plt>
mov %rax,%rdx
mov -0x18(%rbp),%rax
mov %rdx,(%rax)
mov -0x3c(%rbp),%eax
cltq
shl $0x2,%rax
mov %rax,%rdi
callq 10b0 <malloc@plt>
mov %rax,%rdx
mov -0x18(%rbp),%rax
mov %rdx,0x8(%rax)
mov -0x18(%rbp),%rax
movl $0x0,0x10(%rax)
cmpl $0x0,-0x3c(%rbp)
jne 1294 <func0+0x73>
mov -0x18(%rbp),%rax
jmpq 1464 <func0+0x243>
mov -0x38(%rbp),%rax
mov (%rax),%eax
mov %eax,-0x24(%rbp)
movl $0x0,-0x20(%rbp)
mov -0x3c(%rbp),%eax
cltq
shl $0x2,%rax
mov -0x18(%rbp),%rdx
mov (%rdx),%rcx
mov -0x18(%rbp),%rdx
mov 0x10(%rdx),%edx
movslq %edx,%rdx
shl $0x3,%rdx
lea (%rcx,%rdx,1),%rbx
mov %rax,%rdi
callq 10b0 <malloc@plt>
mov %rax,(%rbx)
mov -0x18(%rbp),%rax
mov (%rax),%rdx
mov -0x18(%rbp),%rax
mov 0x10(%rax),%eax
cltq
shl $0x3,%rax
add %rdx,%rax
mov (%rax),%rcx
mov -0x20(%rbp),%eax
lea 0x1(%rax),%edx
mov %edx,-0x20(%rbp)
cltq
shl $0x2,%rax
lea (%rcx,%rax,1),%rdx
mov -0x24(%rbp),%eax
mov %eax,(%rdx)
movl $0x1,-0x1c(%rbp)
jmpq 1426 <func0+0x205>
mov -0x1c(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x38(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cmp %eax,-0x24(%rbp)
jne 1375 <func0+0x154>
mov -0x1c(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x38(%rbp),%rax
lea (%rdx,%rax,1),%rcx
mov -0x18(%rbp),%rax
mov (%rax),%rdx
mov -0x18(%rbp),%rax
mov 0x10(%rax),%eax
cltq
shl $0x3,%rax
add %rdx,%rax
mov (%rax),%rsi
mov -0x20(%rbp),%eax
lea 0x1(%rax),%edx
mov %edx,-0x20(%rbp)
cltq
shl $0x2,%rax
lea (%rsi,%rax,1),%rdx
mov (%rcx),%eax
mov %eax,(%rdx)
jmpq 1422 <func0+0x201>
mov -0x18(%rbp),%rax
mov 0x8(%rax),%rdx
mov -0x18(%rbp),%rax
mov 0x10(%rax),%eax
cltq
shl $0x2,%rax
add %rax,%rdx
mov -0x20(%rbp),%eax
mov %eax,(%rdx)
mov -0x18(%rbp),%rax
mov 0x10(%rax),%eax
lea 0x1(%rax),%edx
mov -0x18(%rbp),%rax
mov %edx,0x10(%rax)
mov -0x1c(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x38(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
mov %eax,-0x24(%rbp)
mov -0x3c(%rbp),%eax
cltq
shl $0x2,%rax
mov -0x18(%rbp),%rdx
mov (%rdx),%rcx
mov -0x18(%rbp),%rdx
mov 0x10(%rdx),%edx
movslq %edx,%rdx
shl $0x3,%rdx
lea (%rcx,%rdx,1),%rbx
mov %rax,%rdi
callq 10b0 <malloc@plt>
mov %rax,(%rbx)
movl $0x0,-0x20(%rbp)
mov -0x18(%rbp),%rax
mov (%rax),%rdx
mov -0x18(%rbp),%rax
mov 0x10(%rax),%eax
cltq
shl $0x3,%rax
add %rdx,%rax
mov (%rax),%rcx
mov -0x20(%rbp),%eax
lea 0x1(%rax),%edx
mov %edx,-0x20(%rbp)
cltq
shl $0x2,%rax
lea (%rcx,%rax,1),%rdx
mov -0x24(%rbp),%eax
mov %eax,(%rdx)
addl $0x1,-0x1c(%rbp)
mov -0x1c(%rbp),%eax
cmp -0x3c(%rbp),%eax
jl 130f <func0+0xee>
mov -0x18(%rbp),%rax
mov 0x8(%rax),%rdx
mov -0x18(%rbp),%rax
mov 0x10(%rax),%eax
cltq
shl $0x2,%rax
add %rax,%rdx
mov -0x20(%rbp),%eax
mov %eax,(%rdx)
mov -0x18(%rbp),%rax
mov 0x10(%rax),%eax
lea 0x1(%rax),%edx
mov -0x18(%rbp),%rax
mov %edx,0x10(%rax)
mov -0x18(%rbp),%rax
add $0x38,%rsp
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
push rbx
sub rsp, 38h
mov [rbp+var_38], rdi
mov [rbp+var_3C], esi
mov edi, 18h; size
call _malloc
mov [rbp+var_18], rax
mov eax, [rbp+var_3C]
cdqe
shl rax, 3
mov rdi, rax; size
call _malloc
mov rdx, rax
mov rax, [rbp+var_18]
mov [rax], rdx
mov eax, [rbp+var_3C]
cdqe
shl rax, 2
mov rdi, rax; size
call _malloc
mov rdx, rax
mov rax, [rbp+var_18]
mov [rax+8], rdx
mov rax, [rbp+var_18]
mov dword ptr [rax+10h], 0
cmp [rbp+var_3C], 0
jnz short loc_1294
mov rax, [rbp+var_18]
jmp loc_1464
loc_1294:
mov rax, [rbp+var_38]
mov eax, [rax]
mov [rbp+var_24], eax
mov [rbp+var_20], 0
mov eax, [rbp+var_3C]
cdqe
shl rax, 2
mov rdx, [rbp+var_18]
mov rcx, [rdx]
mov rdx, [rbp+var_18]
mov edx, [rdx+10h]
movsxd rdx, edx
shl rdx, 3
lea rbx, [rcx+rdx]
mov rdi, rax; size
call _malloc
mov [rbx], rax
mov rax, [rbp+var_18]
mov rdx, [rax]
mov rax, [rbp+var_18]
mov eax, [rax+10h]
cdqe
shl rax, 3
add rax, rdx
mov rcx, [rax]
mov eax, [rbp+var_20]
lea edx, [rax+1]
mov [rbp+var_20], edx
cdqe
shl rax, 2
lea rdx, [rcx+rax]
mov eax, [rbp+var_24]
mov [rdx], eax
mov [rbp+var_1C], 1
jmp loc_1426
loc_130F:
mov eax, [rbp+var_1C]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_38]
add rax, rdx
mov eax, [rax]
cmp [rbp+var_24], eax
jnz short loc_1375
mov eax, [rbp+var_1C]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_38]
lea rcx, [rdx+rax]
mov rax, [rbp+var_18]
mov rdx, [rax]
mov rax, [rbp+var_18]
mov eax, [rax+10h]
cdqe
shl rax, 3
add rax, rdx
mov rsi, [rax]
mov eax, [rbp+var_20]
lea edx, [rax+1]
mov [rbp+var_20], edx
cdqe
shl rax, 2
lea rdx, [rsi+rax]
mov eax, [rcx]
mov [rdx], eax
jmp loc_1422
loc_1375:
mov rax, [rbp+var_18]
mov rdx, [rax+8]
mov rax, [rbp+var_18]
mov eax, [rax+10h]
cdqe
shl rax, 2
add rdx, rax
mov eax, [rbp+var_20]
mov [rdx], eax
mov rax, [rbp+var_18]
mov eax, [rax+10h]
lea edx, [rax+1]
mov rax, [rbp+var_18]
mov [rax+10h], edx
mov eax, [rbp+var_1C]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_38]
add rax, rdx
mov eax, [rax]
mov [rbp+var_24], eax
mov eax, [rbp+var_3C]
cdqe
shl rax, 2
mov rdx, [rbp+var_18]
mov rcx, [rdx]
mov rdx, [rbp+var_18]
mov edx, [rdx+10h]
movsxd rdx, edx
shl rdx, 3
lea rbx, [rcx+rdx]
mov rdi, rax; size
call _malloc
mov [rbx], rax
mov [rbp+var_20], 0
mov rax, [rbp+var_18]
mov rdx, [rax]
mov rax, [rbp+var_18]
mov eax, [rax+10h]
cdqe
shl rax, 3
add rax, rdx
mov rcx, [rax]
mov eax, [rbp+var_20]
lea edx, [rax+1]
mov [rbp+var_20], edx
cdqe
shl rax, 2
lea rdx, [rcx+rax]
mov eax, [rbp+var_24]
mov [rdx], eax
loc_1422:
add [rbp+var_1C], 1
loc_1426:
mov eax, [rbp+var_1C]
cmp eax, [rbp+var_3C]
jl loc_130F
mov rax, [rbp+var_18]
mov rdx, [rax+8]
mov rax, [rbp+var_18]
mov eax, [rax+10h]
cdqe
shl rax, 2
add rdx, rax
mov eax, [rbp+var_20]
mov [rdx], eax
mov rax, [rbp+var_18]
mov eax, [rax+10h]
lea edx, [rax+1]
mov rax, [rbp+var_18]
mov [rax+10h], edx
mov rax, [rbp+var_18]
loc_1464:
mov rbx, [rbp+var_8]
leave
retn | _QWORD * func0(int *a1, int a2)
{
void **v3; // rbx
int v4; // eax
void **v5; // rbx
int v6; // [rsp+1Ch] [rbp-24h]
int v7; // [rsp+20h] [rbp-20h]
int i; // [rsp+24h] [rbp-1Ch]
_QWORD *v9; // [rsp+28h] [rbp-18h]
v9 = malloc(0x18uLL);
*v9 = malloc(8LL * a2);
v9[1] = malloc(4LL * a2);
*((_DWORD *)v9 + 4) = 0;
if ( !a2 )
return v9;
v6 = *a1;
v3 = (void **)(*v9 + 8LL * *((int *)v9 + 4));
*v3 = malloc(4LL * a2);
v7 = 1;
**(_DWORD **)(*v9 + 8LL * *((int *)v9 + 4)) = v6;
for ( i = 1; i < a2; ++i )
{
if ( v6 == a1[i] )
{
v4 = v7++;
*(_DWORD *)(*(_QWORD *)(*v9 + 8LL * *((int *)v9 + 4)) + 4LL * v4) = a1[i];
}
else
{
*(_DWORD *)(4LL * (int)(*((_DWORD *)v9 + 4))++ + v9[1]) = v7;
v6 = a1[i];
v5 = (void **)(*v9 + 8LL * *((int *)v9 + 4));
*v5 = malloc(4LL * a2);
v7 = 1;
**(_DWORD **)(*v9 + 8LL * *((int *)v9 + 4)) = v6;
}
}
*(_DWORD *)(4LL * (int)(*((_DWORD *)v9 + 4))++ + v9[1]) = v7;
return v9;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
PUSH RBX
SUB RSP,0x38
MOV qword ptr [RBP + -0x38],RDI
MOV dword ptr [RBP + -0x3c],ESI
MOV EDI,0x18
CALL 0x001010b0
MOV qword ptr [RBP + -0x18],RAX
MOV EAX,dword ptr [RBP + -0x3c]
CDQE
SHL RAX,0x3
MOV RDI,RAX
CALL 0x001010b0
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0x18]
MOV qword ptr [RAX],RDX
MOV EAX,dword ptr [RBP + -0x3c]
CDQE
SHL RAX,0x2
MOV RDI,RAX
CALL 0x001010b0
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0x18]
MOV qword ptr [RAX + 0x8],RDX
MOV RAX,qword ptr [RBP + -0x18]
MOV dword ptr [RAX + 0x10],0x0
CMP dword ptr [RBP + -0x3c],0x0
JNZ 0x00101294
MOV RAX,qword ptr [RBP + -0x18]
JMP 0x00101464
LAB_00101294:
MOV RAX,qword ptr [RBP + -0x38]
MOV EAX,dword ptr [RAX]
MOV dword ptr [RBP + -0x24],EAX
MOV dword ptr [RBP + -0x20],0x0
MOV EAX,dword ptr [RBP + -0x3c]
CDQE
SHL RAX,0x2
MOV RDX,qword ptr [RBP + -0x18]
MOV RCX,qword ptr [RDX]
MOV RDX,qword ptr [RBP + -0x18]
MOV EDX,dword ptr [RDX + 0x10]
MOVSXD RDX,EDX
SHL RDX,0x3
LEA RBX,[RCX + RDX*0x1]
MOV RDI,RAX
CALL 0x001010b0
MOV qword ptr [RBX],RAX
MOV RAX,qword ptr [RBP + -0x18]
MOV RDX,qword ptr [RAX]
MOV RAX,qword ptr [RBP + -0x18]
MOV EAX,dword ptr [RAX + 0x10]
CDQE
SHL RAX,0x3
ADD RAX,RDX
MOV RCX,qword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x20]
LEA EDX,[RAX + 0x1]
MOV dword ptr [RBP + -0x20],EDX
CDQE
SHL RAX,0x2
LEA RDX,[RCX + RAX*0x1]
MOV EAX,dword ptr [RBP + -0x24]
MOV dword ptr [RDX],EAX
MOV dword ptr [RBP + -0x1c],0x1
JMP 0x00101426
LAB_0010130f:
MOV EAX,dword ptr [RBP + -0x1c]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x38]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
CMP dword ptr [RBP + -0x24],EAX
JNZ 0x00101375
MOV EAX,dword ptr [RBP + -0x1c]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x38]
LEA RCX,[RDX + RAX*0x1]
MOV RAX,qword ptr [RBP + -0x18]
MOV RDX,qword ptr [RAX]
MOV RAX,qword ptr [RBP + -0x18]
MOV EAX,dword ptr [RAX + 0x10]
CDQE
SHL RAX,0x3
ADD RAX,RDX
MOV RSI,qword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x20]
LEA EDX,[RAX + 0x1]
MOV dword ptr [RBP + -0x20],EDX
CDQE
SHL RAX,0x2
LEA RDX,[RSI + RAX*0x1]
MOV EAX,dword ptr [RCX]
MOV dword ptr [RDX],EAX
JMP 0x00101422
LAB_00101375:
MOV RAX,qword ptr [RBP + -0x18]
MOV RDX,qword ptr [RAX + 0x8]
MOV RAX,qword ptr [RBP + -0x18]
MOV EAX,dword ptr [RAX + 0x10]
CDQE
SHL RAX,0x2
ADD RDX,RAX
MOV EAX,dword ptr [RBP + -0x20]
MOV dword ptr [RDX],EAX
MOV RAX,qword ptr [RBP + -0x18]
MOV EAX,dword ptr [RAX + 0x10]
LEA EDX,[RAX + 0x1]
MOV RAX,qword ptr [RBP + -0x18]
MOV dword ptr [RAX + 0x10],EDX
MOV EAX,dword ptr [RBP + -0x1c]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x38]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
MOV dword ptr [RBP + -0x24],EAX
MOV EAX,dword ptr [RBP + -0x3c]
CDQE
SHL RAX,0x2
MOV RDX,qword ptr [RBP + -0x18]
MOV RCX,qword ptr [RDX]
MOV RDX,qword ptr [RBP + -0x18]
MOV EDX,dword ptr [RDX + 0x10]
MOVSXD RDX,EDX
SHL RDX,0x3
LEA RBX,[RCX + RDX*0x1]
MOV RDI,RAX
CALL 0x001010b0
MOV qword ptr [RBX],RAX
MOV dword ptr [RBP + -0x20],0x0
MOV RAX,qword ptr [RBP + -0x18]
MOV RDX,qword ptr [RAX]
MOV RAX,qword ptr [RBP + -0x18]
MOV EAX,dword ptr [RAX + 0x10]
CDQE
SHL RAX,0x3
ADD RAX,RDX
MOV RCX,qword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x20]
LEA EDX,[RAX + 0x1]
MOV dword ptr [RBP + -0x20],EDX
CDQE
SHL RAX,0x2
LEA RDX,[RCX + RAX*0x1]
MOV EAX,dword ptr [RBP + -0x24]
MOV dword ptr [RDX],EAX
LAB_00101422:
ADD dword ptr [RBP + -0x1c],0x1
LAB_00101426:
MOV EAX,dword ptr [RBP + -0x1c]
CMP EAX,dword ptr [RBP + -0x3c]
JL 0x0010130f
MOV RAX,qword ptr [RBP + -0x18]
MOV RDX,qword ptr [RAX + 0x8]
MOV RAX,qword ptr [RBP + -0x18]
MOV EAX,dword ptr [RAX + 0x10]
CDQE
SHL RAX,0x2
ADD RDX,RAX
MOV EAX,dword ptr [RBP + -0x20]
MOV dword ptr [RDX],EAX
MOV RAX,qword ptr [RBP + -0x18]
MOV EAX,dword ptr [RAX + 0x10]
LEA EDX,[RAX + 0x1]
MOV RAX,qword ptr [RBP + -0x18]
MOV dword ptr [RAX + 0x10],EDX
MOV RAX,qword ptr [RBP + -0x18]
LAB_00101464:
MOV RBX,qword ptr [RBP + -0x8]
LEAVE
RET | long * func0(int *param_1,int param_2)
{
int iVar1;
long lVar2;
long *plVar3;
void *pvVar4;
int local_2c;
int local_28;
int local_24;
plVar3 = (long *)malloc(0x18);
pvVar4 = malloc((long)param_2 << 3);
*plVar3 = (long)pvVar4;
pvVar4 = malloc((long)param_2 << 2);
plVar3[1] = (long)pvVar4;
*(int4 *)(plVar3 + 2) = 0;
if (param_2 != 0) {
local_2c = *param_1;
lVar2 = *plVar3;
iVar1 = *(int *)(plVar3 + 2);
pvVar4 = malloc((long)param_2 << 2);
*(void **)(lVar2 + (long)iVar1 * 8) = pvVar4;
local_28 = 1;
**(int **)((long)*(int *)(plVar3 + 2) * 8 + *plVar3) = local_2c;
for (local_24 = 1; local_24 < param_2; local_24 = local_24 + 1) {
if (local_2c == param_1[local_24]) {
*(int *)(*(long *)((long)*(int *)(plVar3 + 2) * 8 + *plVar3) + (long)local_28 * 4) =
param_1[local_24];
local_28 = local_28 + 1;
}
else {
*(int *)(plVar3[1] + (long)*(int *)(plVar3 + 2) * 4) = local_28;
*(int *)(plVar3 + 2) = *(int *)(plVar3 + 2) + 1;
local_2c = param_1[local_24];
lVar2 = *plVar3;
iVar1 = *(int *)(plVar3 + 2);
pvVar4 = malloc((long)param_2 << 2);
*(void **)(lVar2 + (long)iVar1 * 8) = pvVar4;
local_28 = 1;
**(int **)((long)*(int *)(plVar3 + 2) * 8 + *plVar3) = local_2c;
}
}
*(int *)(plVar3[1] + (long)*(int *)(plVar3 + 2) * 4) = local_28;
*(int *)(plVar3 + 2) = *(int *)(plVar3 + 2) + 1;
}
return plVar3;
} |
7,005 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int **group;
int *groupSize;
int numGroups;
} PackResult;
int compare_arrays(int a[], int b[], int a_size, int b_size) {
if (a_size != b_size)
return 0;
for (int i = 0; i < a_size; i++) {
if (a[i] != b[i]) {
return 0;
}
}
return 1;
}
| PackResult* func0(int list1[], int size) {
PackResult *result = malloc(sizeof(PackResult));
result->group = malloc(sizeof(int*) * size);
result->groupSize = malloc(sizeof(int) * size);
result->numGroups = 0;
if (size == 0) {
return result;
}
int current_value = list1[0];
int group_count = 0;
result->group[result->numGroups] = malloc(sizeof(int) * size);
result->group[result->numGroups][group_count++] = current_value;
for (int i = 1; i < size; i++) {
if (list1[i] == current_value) {
result->group[result->numGroups][group_count++] = list1[i];
} else {
result->groupSize[result->numGroups] = group_count;
result->numGroups++;
current_value = list1[i];
result->group[result->numGroups] = malloc(sizeof(int) * size);
group_count = 0;
result->group[result->numGroups][group_count++] = current_value;
}
}
result->groupSize[result->numGroups] = group_count;
result->numGroups++;
return result;
}
| int main() {
// Test Case 1
int input1[] = {0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4};
int size1 = sizeof(input1)/sizeof(input1[0]);
PackResult* result1 = func0(input1, size1);
assert(result1->numGroups == 11);
assert(compare_arrays(result1->group[0], (int[]){0, 0}, result1->groupSize[0], 2));
assert(compare_arrays(result1->group[1], (int[]){1}, result1->groupSize[1], 1));
assert(compare_arrays(result1->group[4], (int[]){4, 4}, result1->groupSize[4], 2));
assert(compare_arrays(result1->group[10], (int[]){4, 4}, result1->groupSize[10], 2));
// Test Case 2
int input2[] = {10, 10, 15, 19, 18, 18, 17, 26, 26, 17, 18, 10};
int size2 = sizeof(input2)/sizeof(input2[0]);
PackResult* result2 = func0(input2, size2);
assert(result2->numGroups == 9);
assert(compare_arrays(result2->group[0], (int[]){10, 10}, result2->groupSize[0], 2));
assert(compare_arrays(result2->group[5], (int[]){26, 26}, result2->groupSize[5], 2));
// Cleaning up memory
for (int i = 0; i < result1->numGroups; i++) {
free(result1->group[i]);
}
free(result1->group);
free(result1->groupSize);
free(result1);
for (int i = 0; i < result2->numGroups; i++) {
free(result2->group[i]);
}
free(result2->group);
free(result2->groupSize);
free(result2);
return 0;
}
| O1 | c | func0:
endbr64
push %r15
push %r14
push %r13
push %r12
push %rbp
push %rbx
sub $0x8,%rsp
mov %rdi,%r15
mov %esi,%r14d
mov $0x18,%edi
callq 10b0 <malloc@plt>
mov %rax,%rbx
movslq %r14d,%r13
lea 0x0(,%r13,8),%rdi
callq 10b0 <malloc@plt>
mov %rax,%rbp
mov %rax,(%rbx)
shl $0x2,%r13
mov %r13,%rdi
callq 10b0 <malloc@plt>
mov %rax,0x8(%rbx)
movl $0x0,0x10(%rbx)
test %r14d,%r14d
jne 1253 <func0+0x69>
mov %rbx,%rax
add $0x8,%rsp
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
mov (%r15),%r12d
mov %r13,%rdi
callq 10b0 <malloc@plt>
mov %rax,0x0(%rbp)
mov %r12d,(%rax)
cmp $0x1,%r14d
jle 12e4 <func0+0xfa>
lea 0x4(%r15),%rbp
lea -0x2(%r14),%eax
lea 0x8(%r15,%rax,4),%r14
mov $0x1,%eax
jmp 12c7 <func0+0xdd>
movslq 0x10(%rbx),%rcx
mov 0x8(%rbx),%rdx
mov %eax,(%rdx,%rcx,4)
mov 0x10(%rbx),%eax
add $0x1,%eax
mov %eax,0x10(%rbx)
mov 0x0(%rbp),%r12d
cltq
mov (%rbx),%rdx
lea (%rdx,%rax,8),%r15
mov %r13,%rdi
callq 10b0 <malloc@plt>
mov %rax,(%r15)
movslq 0x10(%rbx),%rdx
mov (%rbx),%rax
mov (%rax,%rdx,8),%rax
mov %r12d,(%rax)
mov $0x1,%eax
add $0x4,%rbp
cmp %r14,%rbp
je 12e9 <func0+0xff>
cmp %r12d,0x0(%rbp)
jne 127f <func0+0x95>
movslq 0x10(%rbx),%rsi
mov (%rbx),%rdx
movslq %eax,%rcx
mov (%rdx,%rsi,8),%rdx
mov %r12d,(%rdx,%rcx,4)
lea 0x1(%rax),%eax
jmp 12be <func0+0xd4>
mov $0x1,%eax
movslq 0x10(%rbx),%rcx
mov 0x8(%rbx),%rdx
mov %eax,(%rdx,%rcx,4)
addl $0x1,0x10(%rbx)
jmpq 1241 <func0+0x57>
| func0:
endbr64
push r15
push r14
push r13
push r12
push rbp
push rbx
sub rsp, 8
mov r15, rdi
mov r14d, esi
mov edi, 18h
call _malloc
mov rbx, rax
movsxd r13, r14d
lea rdi, ds:0[r13*8]
call _malloc
mov rbp, rax
mov [rbx], rax
shl r13, 2
mov rdi, r13
call _malloc
mov [rbx+8], rax
mov dword ptr [rbx+10h], 0
test r14d, r14d
jnz short loc_1253
loc_1241:
mov rax, rbx
add rsp, 8
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_1253:
mov r12d, [r15]
mov rdi, r13
call _malloc
mov [rbp+0], rax
mov [rax], r12d
cmp r14d, 1
jle short loc_12D8
lea rbp, [r15+4]
lea eax, [r14-2]
lea r14, [r15+rax*4+8]
mov edx, 1
jmp short loc_12BB
loc_127F:
mov eax, [rbx+10h]
movsxd rsi, eax
mov rcx, [rbx+8]
mov [rcx+rsi*4], edx
add eax, 1
mov [rbx+10h], eax
mov r12d, [rbp+0]
cdqe
mov rdx, [rbx]
lea r15, [rdx+rax*8]
mov rdi, r13
call _malloc
mov [r15], rax
mov [rax], r12d
mov edx, 1
loc_12B2:
add rbp, 4
cmp rbp, r14
jz short loc_12DD
loc_12BB:
cmp [rbp+0], r12d
jnz short loc_127F
movsxd rsi, dword ptr [rbx+10h]
mov rax, [rbx]
movsxd rcx, edx
mov rax, [rax+rsi*8]
mov [rax+rcx*4], r12d
lea edx, [rdx+1]
jmp short loc_12B2
loc_12D8:
mov edx, 1
loc_12DD:
mov eax, [rbx+10h]
movsxd rsi, eax
mov rcx, [rbx+8]
mov [rcx+rsi*4], edx
add eax, 1
mov [rbx+10h], eax
jmp loc_1241 | long long func0(int *a1, int a2)
{
long long v2; // rbx
_QWORD *v3; // rbp
long long v4; // r13
int v6; // r12d
_DWORD *v7; // rax
int *v8; // rbp
int v9; // edx
int v10; // eax
_QWORD *v11; // r15
_DWORD *v12; // rax
int v13; // eax
v2 = malloc(24LL);
v3 = (_QWORD *)malloc(8LL * a2);
*(_QWORD *)v2 = v3;
v4 = 4LL * a2;
*(_QWORD *)(v2 + 8) = malloc(v4);
*(_DWORD *)(v2 + 16) = 0;
if ( a2 )
{
v6 = *a1;
v7 = (_DWORD *)malloc(v4);
*v3 = v7;
*v7 = v6;
if ( a2 <= 1 )
{
v9 = 1;
}
else
{
v8 = a1 + 1;
v9 = 1;
do
{
if ( *v8 == v6 )
{
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)v2 + 8LL * *(int *)(v2 + 16)) + 4LL * v9++) = v6;
}
else
{
v10 = *(_DWORD *)(v2 + 16);
*(_DWORD *)(*(_QWORD *)(v2 + 8) + 4LL * v10++) = v9;
*(_DWORD *)(v2 + 16) = v10;
v6 = *v8;
v11 = (_QWORD *)(*(_QWORD *)v2 + 8LL * v10);
v12 = (_DWORD *)malloc(v4);
*v11 = v12;
*v12 = v6;
v9 = 1;
}
++v8;
}
while ( v8 != &a1[a2 - 2 + 2] );
}
v13 = *(_DWORD *)(v2 + 16);
*(_DWORD *)(*(_QWORD *)(v2 + 8) + 4LL * v13) = v9;
*(_DWORD *)(v2 + 16) = v13 + 1;
}
return v2;
} | ||
7,006 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int **group;
int *groupSize;
int numGroups;
} PackResult;
int compare_arrays(int a[], int b[], int a_size, int b_size) {
if (a_size != b_size)
return 0;
for (int i = 0; i < a_size; i++) {
if (a[i] != b[i]) {
return 0;
}
}
return 1;
}
| PackResult* func0(int list1[], int size) {
PackResult *result = malloc(sizeof(PackResult));
result->group = malloc(sizeof(int*) * size);
result->groupSize = malloc(sizeof(int) * size);
result->numGroups = 0;
if (size == 0) {
return result;
}
int current_value = list1[0];
int group_count = 0;
result->group[result->numGroups] = malloc(sizeof(int) * size);
result->group[result->numGroups][group_count++] = current_value;
for (int i = 1; i < size; i++) {
if (list1[i] == current_value) {
result->group[result->numGroups][group_count++] = list1[i];
} else {
result->groupSize[result->numGroups] = group_count;
result->numGroups++;
current_value = list1[i];
result->group[result->numGroups] = malloc(sizeof(int) * size);
group_count = 0;
result->group[result->numGroups][group_count++] = current_value;
}
}
result->groupSize[result->numGroups] = group_count;
result->numGroups++;
return result;
}
| int main() {
// Test Case 1
int input1[] = {0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4};
int size1 = sizeof(input1)/sizeof(input1[0]);
PackResult* result1 = func0(input1, size1);
assert(result1->numGroups == 11);
assert(compare_arrays(result1->group[0], (int[]){0, 0}, result1->groupSize[0], 2));
assert(compare_arrays(result1->group[1], (int[]){1}, result1->groupSize[1], 1));
assert(compare_arrays(result1->group[4], (int[]){4, 4}, result1->groupSize[4], 2));
assert(compare_arrays(result1->group[10], (int[]){4, 4}, result1->groupSize[10], 2));
// Test Case 2
int input2[] = {10, 10, 15, 19, 18, 18, 17, 26, 26, 17, 18, 10};
int size2 = sizeof(input2)/sizeof(input2[0]);
PackResult* result2 = func0(input2, size2);
assert(result2->numGroups == 9);
assert(compare_arrays(result2->group[0], (int[]){10, 10}, result2->groupSize[0], 2));
assert(compare_arrays(result2->group[5], (int[]){26, 26}, result2->groupSize[5], 2));
// Cleaning up memory
for (int i = 0; i < result1->numGroups; i++) {
free(result1->group[i]);
}
free(result1->group);
free(result1->groupSize);
free(result1);
for (int i = 0; i < result2->numGroups; i++) {
free(result2->group[i]);
}
free(result2->group);
free(result2->groupSize);
free(result2);
return 0;
}
| O2 | c | func0:
endbr64
push %r15
push %r14
movslq %esi,%r14
push %r13
push %r12
mov %rdi,%r12
mov $0x18,%edi
push %rbp
mov %r14,%rbp
push %rbx
sub $0x28,%rsp
callq 10b0 <malloc@plt>
lea 0x0(,%r14,8),%rdi
shl $0x2,%r14
mov %rax,%r15
callq 10b0 <malloc@plt>
mov %r14,%rdi
mov %rax,(%r15)
mov %rax,%r13
callq 10b0 <malloc@plt>
movl $0x0,0x10(%r15)
mov %rax,0x8(%r15)
mov %rax,0x8(%rsp)
test %ebp,%ebp
jne 1650 <func0+0x70>
add $0x28,%rsp
mov %r15,%rax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
xchg %ax,%ax
mov (%r12),%esi
mov %r14,%rdi
mov %esi,0x10(%rsp)
callq 10b0 <malloc@plt>
mov 0x10(%rsp),%esi
cmp $0x1,%ebp
mov 0x8(%rsp),%rcx
mov %rax,0x0(%r13)
mov %esi,(%rax)
jle 1720 <func0+0x140>
lea -0x2(%rbp),%eax
lea 0x4(%r12),%rbx
xor %ebp,%ebp
xor %edx,%edx
lea 0x8(%r12,%rax,4),%rax
mov %rax,0x8(%rsp)
mov $0x1,%eax
jmp 16b8 <func0+0xd8>
nopl (%rax)
mov 0x0(%r13,%rdx,8),%rdx
movslq %eax,%rdi
add $0x4,%rbx
add $0x1,%eax
mov %esi,(%rdx,%rdi,4)
movslq 0x10(%r15),%rdx
mov %rdx,%rbp
cmp 0x8(%rsp),%rbx
je 1704 <func0+0x124>
mov (%rbx),%r12d
cmp %esi,%r12d
je 1698 <func0+0xb8>
mov %eax,(%rcx,%rdx,4)
add $0x1,%ebp
mov %r14,%rdi
add $0x4,%rbx
movslq %ebp,%rdx
mov %rcx,0x18(%rsp)
mov %rdx,0x10(%rsp)
mov %ebp,0x10(%r15)
callq 10b0 <malloc@plt>
mov 0x10(%rsp),%rdx
mov 0x18(%rsp),%rcx
mov %r12d,%esi
mov %r12d,(%rax)
mov %rax,0x0(%r13,%rdx,8)
mov $0x1,%eax
cmp 0x8(%rsp),%rbx
jne 16b8 <func0+0xd8>
lea (%rcx,%rdx,4),%rcx
add $0x1,%ebp
mov %eax,(%rcx)
mov %ebp,0x10(%r15)
jmpq 163c <func0+0x5c>
nopw %cs:0x0(%rax,%rax,1)
mov $0x1,%ebp
mov $0x1,%eax
jmp 170b <func0+0x12b>
nopl 0x0(%rax)
| func0:
endbr64
push r15
push r14
mov r14, rdi
mov edi, 18h
push r13
movsxd r13, esi
push r12
push rbp
mov rbp, r13
push rbx
sub rsp, 28h
call _malloc
lea rdi, ds:0[r13*8]
shl r13, 2
mov r12, rax
call _malloc
mov rdi, r13
mov [r12], rax
mov [rsp+58h+var_48], rax
call _malloc
mov dword ptr [r12+10h], 0
mov [r12+8], rax
mov [rsp+58h+var_50], rax
test ebp, ebp
jnz short loc_1678
loc_1661:
add rsp, 28h
mov rax, r12
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_1678:
mov esi, [r14]
mov rdi, r13
mov dword ptr [rsp+58h+var_40], esi
call _malloc
mov rcx, [rsp+58h+var_48]
mov esi, dword ptr [rsp+58h+var_40]
cmp ebp, 1
mov rdx, [rsp+58h+var_50]
mov [rcx], rax
mov [rax], esi
jle loc_1740
lea eax, [rbp-2]
lea rbx, [r14+4]
xor r15d, r15d
lea rax, [r14+rax*4+8]
xor r14d, r14d
mov [rsp+58h+var_50], rax
mov eax, 1
jmp short loc_16E1
loc_16C8:
mov rdi, [rcx+r14*8]
movsxd r9, eax
add rbx, 4
add eax, 1
mov [rdi+r9*4], esi
cmp [rsp+58h+var_50], rbx
jz short loc_172B
loc_16E1:
mov ebp, [rbx]
cmp ebp, esi
jz short loc_16C8
mov [rdx+r14*4], eax
add r15d, 1
mov rdi, r13
add rbx, 4
mov [rsp+58h+var_40], rcx
movsxd r14, r15d
mov [rsp+58h+var_48], rdx
mov [r12+10h], r15d
call _malloc
mov rcx, [rsp+58h+var_40]
mov rdx, [rsp+58h+var_48]
mov esi, ebp
mov [rax], ebp
mov [rcx+r14*8], rax
mov eax, 1
cmp [rsp+58h+var_50], rbx
jnz short loc_16E1
loc_172B:
lea rdx, [rdx+r14*4]
add r15d, 1
loc_1733:
mov [rdx], eax
mov [r12+10h], r15d
jmp loc_1661
loc_1740:
mov r15d, 1
mov eax, 1
jmp short loc_1733 | long long func0(int *a1, int a2)
{
long long v3; // r13
long long v4; // r12
long long v5; // rax
long long v6; // rax
_DWORD *v8; // rax
_QWORD *v9; // rcx
int v10; // esi
int *v11; // rdx
int *v12; // rbx
int v13; // r15d
long long v14; // r14
int v15; // eax
long long v16; // r9
int v17; // ebp
_DWORD *v18; // rax
int v19; // r15d
int *v20; // [rsp+8h] [rbp-50h]
long long v21; // [rsp+8h] [rbp-50h]
_QWORD *v22; // [rsp+10h] [rbp-48h]
int *v23; // [rsp+10h] [rbp-48h]
int v24; // [rsp+18h] [rbp-40h]
_QWORD *v25; // [rsp+18h] [rbp-40h]
v3 = 4LL * a2;
v4 = malloc(24LL);
v5 = malloc(8LL * a2);
*(_QWORD *)v4 = v5;
v22 = (_QWORD *)v5;
v6 = malloc(v3);
*(_DWORD *)(v4 + 16) = 0;
*(_QWORD *)(v4 + 8) = v6;
v20 = (int *)v6;
if ( a2 )
{
v24 = *a1;
v8 = (_DWORD *)malloc(v3);
v9 = v22;
v10 = v24;
v11 = v20;
*v22 = v8;
*v8 = v24;
if ( a2 <= 1 )
{
v19 = 1;
v15 = 1;
}
else
{
v12 = a1 + 1;
v13 = 0;
v14 = 0LL;
v21 = (long long)&a1[a2 - 2 + 2];
v15 = 1;
do
{
while ( 1 )
{
v17 = *v12;
if ( *v12 != v10 )
break;
v16 = v15;
++v12;
++v15;
*(_DWORD *)(v9[v14] + 4 * v16) = v10;
if ( (int *)v21 == v12 )
goto LABEL_8;
}
v11[v14] = v15;
++v13;
++v12;
v25 = v9;
v14 = v13;
v23 = v11;
*(_DWORD *)(v4 + 16) = v13;
v18 = (_DWORD *)malloc(v3);
v9 = v25;
v11 = v23;
v10 = v17;
*v18 = v17;
v25[v13] = v18;
v15 = 1;
}
while ( (int *)v21 != v12 );
LABEL_8:
v11 += v14;
v19 = v13 + 1;
}
*v11 = v15;
*(_DWORD *)(v4 + 16) = v19;
}
return v4;
} | func0:
ENDBR64
PUSH R15
PUSH R14
MOV R14,RDI
MOV EDI,0x18
PUSH R13
MOVSXD R13,ESI
PUSH R12
PUSH RBP
MOV RBP,R13
PUSH RBX
SUB RSP,0x28
CALL 0x001010b0
LEA RDI,[R13*0x8]
SHL R13,0x2
MOV R12,RAX
CALL 0x001010b0
MOV RDI,R13
MOV qword ptr [R12],RAX
MOV qword ptr [RSP + 0x10],RAX
CALL 0x001010b0
MOV dword ptr [R12 + 0x10],0x0
MOV qword ptr [R12 + 0x8],RAX
MOV qword ptr [RSP + 0x8],RAX
TEST EBP,EBP
JNZ 0x00101678
LAB_00101661:
ADD RSP,0x28
MOV RAX,R12
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_00101678:
MOV ESI,dword ptr [R14]
MOV RDI,R13
MOV dword ptr [RSP + 0x18],ESI
CALL 0x001010b0
MOV RCX,qword ptr [RSP + 0x10]
MOV ESI,dword ptr [RSP + 0x18]
CMP EBP,0x1
MOV RDX,qword ptr [RSP + 0x8]
MOV qword ptr [RCX],RAX
MOV dword ptr [RAX],ESI
JLE 0x00101740
LEA EAX,[RBP + -0x2]
LEA RBX,[R14 + 0x4]
XOR R15D,R15D
LEA RAX,[R14 + RAX*0x4 + 0x8]
XOR R14D,R14D
MOV qword ptr [RSP + 0x8],RAX
MOV EAX,0x1
JMP 0x001016e1
LAB_001016c8:
MOV RDI,qword ptr [RCX + R14*0x8]
MOVSXD R9,EAX
ADD RBX,0x4
ADD EAX,0x1
MOV dword ptr [RDI + R9*0x4],ESI
CMP qword ptr [RSP + 0x8],RBX
JZ 0x0010172b
LAB_001016e1:
MOV EBP,dword ptr [RBX]
CMP EBP,ESI
JZ 0x001016c8
MOV dword ptr [RDX + R14*0x4],EAX
ADD R15D,0x1
MOV RDI,R13
ADD RBX,0x4
MOV qword ptr [RSP + 0x18],RCX
MOVSXD R14,R15D
MOV qword ptr [RSP + 0x10],RDX
MOV dword ptr [R12 + 0x10],R15D
CALL 0x001010b0
MOV RCX,qword ptr [RSP + 0x18]
MOV RDX,qword ptr [RSP + 0x10]
MOV ESI,EBP
MOV dword ptr [RAX],EBP
MOV qword ptr [RCX + R14*0x8],RAX
MOV EAX,0x1
CMP qword ptr [RSP + 0x8],RBX
JNZ 0x001016e1
LAB_0010172b:
LEA RDX,[RDX + R14*0x4]
ADD R15D,0x1
LAB_00101733:
MOV dword ptr [RDX],EAX
MOV dword ptr [R12 + 0x10],R15D
JMP 0x00101661
LAB_00101740:
MOV R15D,0x1
MOV EAX,0x1
JMP 0x00101733 | int8 * func0(int *param_1,int param_2)
{
int iVar1;
int iVar2;
int8 *puVar3;
int8 *puVar4;
int *piVar5;
int *piVar6;
int *piVar7;
int iVar8;
long lVar9;
size_t __size;
long lVar10;
int iVar11;
puVar3 = (int8 *)malloc(0x18);
__size = (long)param_2 << 2;
puVar4 = (int8 *)malloc((long)param_2 * 8);
*puVar3 = puVar4;
piVar5 = (int *)malloc(__size);
*(int4 *)(puVar3 + 2) = 0;
puVar3[1] = piVar5;
if (param_2 != 0) {
iVar8 = *param_1;
piVar6 = (int *)malloc(__size);
*puVar4 = piVar6;
*piVar6 = iVar8;
if (param_2 < 2) {
iVar11 = 1;
iVar2 = 1;
}
else {
piVar6 = param_1 + 1;
iVar11 = 0;
lVar10 = 0;
iVar2 = 1;
do {
while (iVar1 = *piVar6, iVar1 != iVar8) {
piVar5[lVar10] = iVar2;
iVar11 = iVar11 + 1;
piVar6 = piVar6 + 1;
lVar10 = (long)iVar11;
*(int *)(puVar3 + 2) = iVar11;
piVar7 = (int *)malloc(__size);
*piVar7 = iVar1;
puVar4[lVar10] = piVar7;
iVar2 = 1;
iVar8 = iVar1;
if (param_1 + (ulong)(param_2 - 2) + 2 == piVar6) goto LAB_0010172b;
}
lVar9 = (long)iVar2;
piVar6 = piVar6 + 1;
iVar2 = iVar2 + 1;
*(int *)(puVar4[lVar10] + lVar9 * 4) = iVar8;
} while (param_1 + (ulong)(param_2 - 2) + 2 != piVar6);
LAB_0010172b:
piVar5 = piVar5 + lVar10;
iVar11 = iVar11 + 1;
}
*piVar5 = iVar2;
*(int *)(puVar3 + 2) = iVar11;
}
return puVar3;
} |
7,007 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int **group;
int *groupSize;
int numGroups;
} PackResult;
int compare_arrays(int a[], int b[], int a_size, int b_size) {
if (a_size != b_size)
return 0;
for (int i = 0; i < a_size; i++) {
if (a[i] != b[i]) {
return 0;
}
}
return 1;
}
| PackResult* func0(int list1[], int size) {
PackResult *result = malloc(sizeof(PackResult));
result->group = malloc(sizeof(int*) * size);
result->groupSize = malloc(sizeof(int) * size);
result->numGroups = 0;
if (size == 0) {
return result;
}
int current_value = list1[0];
int group_count = 0;
result->group[result->numGroups] = malloc(sizeof(int) * size);
result->group[result->numGroups][group_count++] = current_value;
for (int i = 1; i < size; i++) {
if (list1[i] == current_value) {
result->group[result->numGroups][group_count++] = list1[i];
} else {
result->groupSize[result->numGroups] = group_count;
result->numGroups++;
current_value = list1[i];
result->group[result->numGroups] = malloc(sizeof(int) * size);
group_count = 0;
result->group[result->numGroups][group_count++] = current_value;
}
}
result->groupSize[result->numGroups] = group_count;
result->numGroups++;
return result;
}
| int main() {
// Test Case 1
int input1[] = {0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4};
int size1 = sizeof(input1)/sizeof(input1[0]);
PackResult* result1 = func0(input1, size1);
assert(result1->numGroups == 11);
assert(compare_arrays(result1->group[0], (int[]){0, 0}, result1->groupSize[0], 2));
assert(compare_arrays(result1->group[1], (int[]){1}, result1->groupSize[1], 1));
assert(compare_arrays(result1->group[4], (int[]){4, 4}, result1->groupSize[4], 2));
assert(compare_arrays(result1->group[10], (int[]){4, 4}, result1->groupSize[10], 2));
// Test Case 2
int input2[] = {10, 10, 15, 19, 18, 18, 17, 26, 26, 17, 18, 10};
int size2 = sizeof(input2)/sizeof(input2[0]);
PackResult* result2 = func0(input2, size2);
assert(result2->numGroups == 9);
assert(compare_arrays(result2->group[0], (int[]){10, 10}, result2->groupSize[0], 2));
assert(compare_arrays(result2->group[5], (int[]){26, 26}, result2->groupSize[5], 2));
// Cleaning up memory
for (int i = 0; i < result1->numGroups; i++) {
free(result1->group[i]);
}
free(result1->group);
free(result1->groupSize);
free(result1);
for (int i = 0; i < result2->numGroups; i++) {
free(result2->group[i]);
}
free(result2->group);
free(result2->groupSize);
free(result2);
return 0;
}
| O3 | c | func0:
endbr64
push %r15
push %r14
mov %rdi,%r14
mov $0x18,%edi
push %r13
push %r12
movslq %esi,%r12
push %rbp
mov %r12,%r13
push %rbx
sub $0x28,%rsp
callq 10b0 <malloc@plt>
lea 0x0(,%r12,8),%rdi
shl $0x2,%r12
mov %rax,%rbp
callq 10b0 <malloc@plt>
mov %r12,%rdi
mov %rax,0x8(%rsp)
mov %rax,%rbx
mov %rax,0x0(%rbp)
callq 10b0 <malloc@plt>
movl $0x0,0x10(%rbp)
mov %rax,0x8(%rbp)
mov %rax,0x10(%rsp)
test %r13d,%r13d
jne 1608 <func0+0x78>
add $0x28,%rsp
mov %rbp,%rax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
nopl 0x0(%rax)
mov (%r14),%ecx
mov %r12,%rdi
mov %ecx,0x18(%rsp)
callq 10b0 <malloc@plt>
mov 0x18(%rsp),%ecx
cmp $0x1,%r13d
mov 0x10(%rsp),%rdx
mov %rax,(%rbx)
mov %ecx,(%rax)
jle 16e0 <func0+0x150>
lea -0x2(%r13),%eax
lea 0x4(%r14),%rbx
xor %r13d,%r13d
lea 0x8(%r14,%rax,4),%rax
xor %r14d,%r14d
mov %rax,0x10(%rsp)
mov $0x1,%eax
jmp 1674 <func0+0xe4>
xchg %ax,%ax
mov 0x8(%rsp),%rsi
lea 0x1(%rax),%edi
add $0x4,%rbx
mov (%rsi,%r13,8),%rsi
mov %ecx,(%rsi,%rax,4)
movslq 0x10(%rbp),%r13
mov %r13,%r14
cmp 0x10(%rsp),%rbx
je 16c5 <func0+0x135>
movslq %edi,%rax
mov (%rbx),%r15d
cmp %ecx,%r15d
je 1650 <func0+0xc0>
mov %eax,(%rdx,%r13,4)
add $0x1,%r14d
mov %r12,%rdi
add $0x4,%rbx
mov %rdx,0x18(%rsp)
movslq %r14d,%r13
mov %r14d,0x10(%rbp)
callq 10b0 <malloc@plt>
mov 0x8(%rsp),%rcx
cmp %rbx,0x10(%rsp)
mov %r15d,(%rax)
mov 0x18(%rsp),%rdx
mov %rax,(%rcx,%r13,8)
je 16c0 <func0+0x130>
mov %r15d,%ecx
mov $0x1,%edi
jmp 1671 <func0+0xe1>
xchg %ax,%ax
mov $0x1,%edi
lea (%rdx,%r13,4),%rdx
add $0x1,%r14d
mov %edi,(%rdx)
mov %r14d,0x10(%rbp)
jmpq 15f2 <func0+0x62>
nopl 0x0(%rax,%rax,1)
mov $0x1,%r14d
mov $0x1,%edi
jmp 16cd <func0+0x13d>
nopl (%rax)
| func0:
endbr64
push r15
mov r15, rdi
mov edi, 18h; size
push r14
push r13
movsxd r13, esi
push r12
mov r14, r13
push rbp
lea rbp, ds:0[r13*4]
push rbx
sub rsp, 28h
call _malloc
lea rdi, ds:0[r13*8]; size
mov r12, rax
call _malloc
mov rdi, rbp; size
mov [rsp+58h+size], rbp
mov [r12], rax
mov [rsp+58h+var_50], rax
call _malloc
mov dword ptr [r12+10h], 0
mov [r12+8], rax
test r13d, r13d
jnz short loc_15F0
loc_15D6:
add rsp, 28h
mov rax, r12
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_15F0:
mov rdi, rbp; size
mov ebx, [r15]
mov r13, rax
call _malloc
mov rcx, [rsp+58h+var_50]
mov [rax], ebx
mov [rcx], rax
cmp r14d, 1
jle loc_16B0
lea eax, [r14-2]
lea rbp, [r15+4]
xor r14d, r14d
lea rax, [r15+rax*4+8]
xor r15d, r15d
mov [rsp+58h+var_50], rax
mov eax, 1
jmp short loc_1651
loc_1638:
mov rdi, [rcx+r14*8]
movsxd r8, eax
add rbp, 4
add eax, 1
mov [rdi+r8*4], ebx
cmp [rsp+58h+var_50], rbp
jz short loc_1695
loc_1651:
mov edi, ebx
mov ebx, [rbp+0]
cmp ebx, edi
jz short loc_1638
add r15d, 1
mov [r13+r14*4+0], eax
mov rdi, [rsp+58h+size]; size
add rbp, 4
mov [r12+10h], r15d
movsxd r14, r15d
mov [rsp+58h+var_48], rcx
call _malloc
mov rcx, [rsp+58h+var_48]
mov [rax], ebx
mov [rcx+r14*8], rax
mov eax, 1
cmp [rsp+58h+var_50], rbp
jnz short loc_1651
loc_1695:
lea r13, [r13+r14*4+0]
add r15d, 1
loc_169E:
mov [r13+0], eax
mov [r12+10h], r15d
jmp loc_15D6
loc_16B0:
mov r15d, 1
mov eax, 1
jmp short loc_169E | _DWORD * func0(int *a1, int a2)
{
_DWORD *v2; // r12
_QWORD *v3; // rax
int *v4; // rax
int v6; // ebx
int *v7; // r13
_DWORD *v8; // rax
_QWORD *v9; // rcx
int *v10; // rbp
long long v11; // r14
int v12; // r15d
int v13; // eax
long long v14; // r8
int v15; // edi
_DWORD *v16; // rax
int v17; // r15d
_QWORD *v18; // [rsp+8h] [rbp-50h]
long long v19; // [rsp+8h] [rbp-50h]
_QWORD *v20; // [rsp+10h] [rbp-48h]
v2 = malloc(0x18uLL);
v3 = malloc(8LL * a2);
*(_QWORD *)v2 = v3;
v18 = v3;
v4 = (int *)malloc(4LL * a2);
v2[4] = 0;
*((_QWORD *)v2 + 1) = v4;
if ( a2 )
{
v6 = *a1;
v7 = v4;
v8 = malloc(4LL * a2);
v9 = v18;
*v8 = v6;
*v18 = v8;
if ( a2 <= 1 )
{
v17 = 1;
v13 = 1;
}
else
{
v10 = a1 + 1;
v11 = 0LL;
v12 = 0;
v19 = (long long)&a1[a2 - 2 + 2];
v13 = 1;
do
{
while ( 1 )
{
v15 = v6;
v6 = *v10;
if ( *v10 != v15 )
break;
v14 = v13;
++v10;
++v13;
*(_DWORD *)(v9[v11] + 4 * v14) = v6;
if ( (int *)v19 == v10 )
goto LABEL_8;
}
++v12;
v7[v11] = v13;
++v10;
v2[4] = v12;
v11 = v12;
v20 = v9;
v16 = malloc(4LL * a2);
v9 = v20;
*v16 = v6;
v20[v12] = v16;
v13 = 1;
}
while ( (int *)v19 != v10 );
LABEL_8:
v7 += v11;
v17 = v12 + 1;
}
*v7 = v13;
v2[4] = v17;
}
return v2;
} | func0:
ENDBR64
PUSH R15
MOV R15,RDI
MOV EDI,0x18
PUSH R14
PUSH R13
MOVSXD R13,ESI
PUSH R12
MOV R14,R13
PUSH RBP
LEA RBP,[R13*0x4]
PUSH RBX
SUB RSP,0x28
CALL 0x001010b0
LEA RDI,[R13*0x8]
MOV R12,RAX
CALL 0x001010b0
MOV RDI,RBP
MOV qword ptr [RSP + 0x18],RBP
MOV qword ptr [R12],RAX
MOV qword ptr [RSP + 0x8],RAX
CALL 0x001010b0
MOV dword ptr [R12 + 0x10],0x0
MOV qword ptr [R12 + 0x8],RAX
TEST R13D,R13D
JNZ 0x001015f0
LAB_001015d6:
ADD RSP,0x28
MOV RAX,R12
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_001015f0:
MOV RDI,RBP
MOV EBX,dword ptr [R15]
MOV R13,RAX
CALL 0x001010b0
MOV RCX,qword ptr [RSP + 0x8]
MOV dword ptr [RAX],EBX
MOV qword ptr [RCX],RAX
CMP R14D,0x1
JLE 0x001016b0
LEA EAX,[R14 + -0x2]
LEA RBP,[R15 + 0x4]
XOR R14D,R14D
LEA RAX,[R15 + RAX*0x4 + 0x8]
XOR R15D,R15D
MOV qword ptr [RSP + 0x8],RAX
MOV EAX,0x1
JMP 0x00101651
LAB_00101638:
MOV RDI,qword ptr [RCX + R14*0x8]
MOVSXD R8,EAX
ADD RBP,0x4
ADD EAX,0x1
MOV dword ptr [RDI + R8*0x4],EBX
CMP qword ptr [RSP + 0x8],RBP
JZ 0x00101695
LAB_00101651:
MOV EDI,EBX
MOV EBX,dword ptr [RBP]
CMP EBX,EDI
JZ 0x00101638
ADD R15D,0x1
MOV dword ptr [R13 + R14*0x4],EAX
MOV RDI,qword ptr [RSP + 0x18]
ADD RBP,0x4
MOV dword ptr [R12 + 0x10],R15D
MOVSXD R14,R15D
MOV qword ptr [RSP + 0x10],RCX
CALL 0x001010b0
MOV RCX,qword ptr [RSP + 0x10]
MOV dword ptr [RAX],EBX
MOV qword ptr [RCX + R14*0x8],RAX
MOV EAX,0x1
CMP qword ptr [RSP + 0x8],RBP
JNZ 0x00101651
LAB_00101695:
LEA R13,[R13 + R14*0x4]
ADD R15D,0x1
LAB_0010169e:
MOV dword ptr [R13],EAX
MOV dword ptr [R12 + 0x10],R15D
JMP 0x001015d6
LAB_001016b0:
MOV R15D,0x1
MOV EAX,0x1
JMP 0x0010169e | int8 * func0(int *param_1,int param_2)
{
size_t __size;
int iVar1;
int iVar2;
int8 *puVar3;
int8 *puVar4;
int *piVar5;
int *piVar6;
int *piVar7;
int iVar8;
long lVar9;
long lVar10;
int iVar11;
__size = (long)param_2 * 4;
puVar3 = (int8 *)malloc(0x18);
puVar4 = (int8 *)malloc((long)param_2 * 8);
*puVar3 = puVar4;
piVar5 = (int *)malloc(__size);
*(int4 *)(puVar3 + 2) = 0;
puVar3[1] = piVar5;
if (param_2 != 0) {
iVar8 = *param_1;
piVar6 = (int *)malloc(__size);
*piVar6 = iVar8;
*puVar4 = piVar6;
if (param_2 < 2) {
iVar11 = 1;
iVar2 = 1;
}
else {
piVar6 = param_1 + 1;
lVar10 = 0;
iVar11 = 0;
iVar2 = 1;
do {
while (iVar1 = *piVar6, iVar1 != iVar8) {
iVar11 = iVar11 + 1;
piVar5[lVar10] = iVar2;
piVar6 = piVar6 + 1;
*(int *)(puVar3 + 2) = iVar11;
lVar10 = (long)iVar11;
piVar7 = (int *)malloc(__size);
*piVar7 = iVar1;
puVar4[lVar10] = piVar7;
iVar2 = 1;
iVar8 = iVar1;
if (param_1 + (ulong)(param_2 - 2) + 2 == piVar6) goto LAB_00101695;
}
lVar9 = (long)iVar2;
piVar6 = piVar6 + 1;
iVar2 = iVar2 + 1;
*(int *)(puVar4[lVar10] + lVar9 * 4) = iVar1;
iVar8 = iVar1;
} while (param_1 + (ulong)(param_2 - 2) + 2 != piVar6);
LAB_00101695:
piVar5 = piVar5 + lVar10;
iVar11 = iVar11 + 1;
}
*piVar5 = iVar2;
*(int *)(puVar3 + 2) = iVar11;
}
return puVar3;
} |
7,008 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
// Structure to hold key-value pairs
typedef struct {
char key[100];
int count;
} DictEntry;
// Function to convert integer list to string key
void int_list_to_key(int *list, int size, char *key) {
strcpy(key, "(");
for(int i = 0; i < size; i++) {
char num[20];
sprintf(num, "%d", list[i]);
strcat(key, num);
if(i < size - 1)
strcat(key, ", ");
}
strcat(key, ")");
}
// Function to convert string list to key
void str_list_to_key(char **list, int size, char *key) {
strcpy(key, "(");
for(int i = 0; i < size; i++) {
strcat(key, "'");
strcat(key, list[i]);
strcat(key, "'");
if(i < size - 1)
strcat(key, ", ");
}
strcat(key, ")");
}
// Unique sublists for string lists
DictEntry* unique_sublists_str(char ***list1, int *sizes, int n, int *unique_count) {
DictEntry *result = malloc(n * sizeof(DictEntry));
*unique_count = 0;
for(int i = 0; i < n; i++) {
char key[100];
str_list_to_key(list1[i], sizes[i], key);
int found = 0;
for(int j = 0; j < *unique_count; j++) {
if(strcmp(result[j].key, key) == 0) {
result[j].count += 1;
found = 1;
break;
}
}
if(!found) {
strcpy(result[*unique_count].key, key);
result[*unique_count].count = 1;
(*unique_count)++;
}
}
return result;
}
// Function to compare two DictEntry arrays
int compare_dict(DictEntry *dict1, int count1, DictEntry *dict2, int count2) {
if(count1 != count2)
return 0;
for(int i = 0; i < count1; i++) {
int found = 0;
for(int j = 0; j < count2; j++) {
if(strcmp(dict1[i].key, dict2[j].key) == 0 && dict1[i].count == dict2[j].count) {
found = 1;
break;
}
}
if(!found)
return 0;
}
return 1;
}
// Unique sublists for integer lists
| DictEntry* func0(int **list1, int *sizes, int n, int *unique_count) {
DictEntry *result = malloc(n * sizeof(DictEntry));
*unique_count = 0;
for(int i = 0; i < n; i++) {
char key[100];
int_list_to_key(list1[i], sizes[i], key);
int found = 0;
for(int j = 0; j < *unique_count; j++) {
if(strcmp(result[j].key, key) == 0) {
result[j].count += 1;
found = 1;
break;
}
}
if(!found) {
strcpy(result[*unique_count].key, key);
result[*unique_count].count = 1;
(*unique_count)++;
}
}
return result;
}
| int main() {
// Test case 1
int list1_case1_data[][3] = { {1, 3}, {5, 7}, {1, 3}, {13, 15, 17}, {5, 7}, {9, 11} };
int sizes_case1[] = {2, 2, 2, 3, 2, 2};
int *list1_case1[6];
for(int i = 0; i < 6; i++) {
list1_case1[i] = list1_case1_data[i];
}
int unique_count1;
DictEntry *result1 = func0(list1_case1, sizes_case1, 6, &unique_count1);
DictEntry expected1[] = { {"(1, 3)", 2}, {"(5, 7)", 2}, {"(13, 15, 17)", 1}, {"(9, 11)", 1} };
assert(compare_dict(result1, unique_count1, expected1, 4));
free(result1);
// Test case 2
char *list1_case2_data[][2] = { {"green", "orange"}, {"black"}, {"green", "orange"}, {"white"} };
int sizes_case2[] = {2, 1, 2, 1};
char **list1_case2[4];
for(int i = 0; i < 4; i++) {
list1_case2[i] = list1_case2_data[i];
}
int unique_count2;
DictEntry *result2 = unique_sublists_str(list1_case2, sizes_case2, 4, &unique_count2);
DictEntry expected2[] = { {"('green', 'orange')", 2}, {"('black')", 1}, {"('white')", 1} };
assert(compare_dict(result2, unique_count2, expected2, 3));
free(result2);
// Test case 3
int list1_case3_data[][2] = { {1, 2}, {3, 4}, {4, 5}, {6, 7} };
int sizes_case3[] = {2, 2, 2, 2};
int *list1_case3[4];
for(int i = 0; i < 4; i++) {
list1_case3[i] = list1_case3_data[i];
}
int unique_count3;
DictEntry *result3 = func0(list1_case3, sizes_case3, 4, &unique_count3);
DictEntry expected3[] = { {"(1, 2)", 1}, {"(3, 4)", 1}, {"(4, 5)", 1}, {"(6, 7)", 1} };
assert(compare_dict(result3, unique_count3, expected3, 4));
free(result3);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0xb0,%rsp
mov %rdi,-0x98(%rbp)
mov %rsi,-0xa0(%rbp)
mov %edx,-0xa4(%rbp)
mov %rcx,-0xb0(%rbp)
mov %fs:0x28,%rax
mov %rax,-0x8(%rbp)
xor %eax,%eax
mov -0xa4(%rbp),%eax
movslq %eax,%rdx
mov %rdx,%rax
add %rax,%rax
add %rdx,%rax
shl $0x2,%rax
add %rdx,%rax
shl $0x3,%rax
mov %rax,%rdi
callq 1110 <malloc@plt>
mov %rax,-0x78(%rbp)
mov -0xb0(%rbp),%rax
movl $0x0,(%rax)
movl $0x0,-0x84(%rbp)
jmpq 19ed <func0+0x215>
mov -0x84(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0xa0(%rbp),%rax
add %rdx,%rax
mov (%rax),%ecx
mov -0x84(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x98(%rbp),%rax
add %rdx,%rax
mov (%rax),%rax
lea -0x70(%rbp),%rdx
mov %ecx,%esi
mov %rax,%rdi
callq 1229 <int_list_to_key>
movl $0x0,-0x80(%rbp)
movl $0x0,-0x7c(%rbp)
jmpq 1948 <func0+0x170>
mov -0x7c(%rbp),%eax
movslq %eax,%rdx
mov %rdx,%rax
add %rax,%rax
add %rdx,%rax
shl $0x2,%rax
add %rdx,%rax
shl $0x3,%rax
mov %rax,%rdx
mov -0x78(%rbp),%rax
add %rdx,%rax
mov %rax,%rdx
lea -0x70(%rbp),%rax
mov %rax,%rsi
mov %rdx,%rdi
callq 1100 <strcmp@plt>
test %eax,%eax
jne 1944 <func0+0x16c>
mov -0x7c(%rbp),%eax
movslq %eax,%rdx
mov %rdx,%rax
add %rax,%rax
add %rdx,%rax
shl $0x2,%rax
add %rdx,%rax
shl $0x3,%rax
mov %rax,%rdx
mov -0x78(%rbp),%rax
add %rdx,%rax
mov 0x64(%rax),%ecx
mov -0x7c(%rbp),%eax
movslq %eax,%rdx
mov %rdx,%rax
add %rax,%rax
add %rdx,%rax
shl $0x2,%rax
add %rdx,%rax
shl $0x3,%rax
mov %rax,%rdx
mov -0x78(%rbp),%rax
add %rdx,%rax
lea 0x1(%rcx),%edx
mov %edx,0x64(%rax)
movl $0x1,-0x80(%rbp)
jmp 195a <func0+0x182>
addl $0x1,-0x7c(%rbp)
mov -0xb0(%rbp),%rax
mov (%rax),%eax
cmp %eax,-0x7c(%rbp)
jl 18b0 <func0+0xd8>
cmpl $0x0,-0x80(%rbp)
jne 19e6 <func0+0x20e>
mov -0xb0(%rbp),%rax
mov (%rax),%eax
movslq %eax,%rdx
mov %rdx,%rax
add %rax,%rax
add %rdx,%rax
shl $0x2,%rax
add %rdx,%rax
shl $0x3,%rax
mov %rax,%rdx
mov -0x78(%rbp),%rax
add %rdx,%rax
mov %rax,%rdx
lea -0x70(%rbp),%rax
mov %rax,%rsi
mov %rdx,%rdi
callq 10d0 <strcpy@plt>
mov -0xb0(%rbp),%rax
mov (%rax),%eax
movslq %eax,%rdx
mov %rdx,%rax
add %rax,%rax
add %rdx,%rax
shl $0x2,%rax
add %rdx,%rax
shl $0x3,%rax
mov %rax,%rdx
mov -0x78(%rbp),%rax
add %rdx,%rax
movl $0x1,0x64(%rax)
mov -0xb0(%rbp),%rax
mov (%rax),%eax
lea 0x1(%rax),%edx
mov -0xb0(%rbp),%rax
mov %edx,(%rax)
addl $0x1,-0x84(%rbp)
mov -0x84(%rbp),%eax
cmp -0xa4(%rbp),%eax
jl 1856 <func0+0x7e>
mov -0x78(%rbp),%rax
mov -0x8(%rbp),%rsi
xor %fs:0x28,%rsi
je 1a17 <func0+0x23f>
callq 10e0 <__stack_chk_fail@plt>
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 0B0h
mov [rbp+var_98], rdi
mov [rbp+var_A0], rsi
mov [rbp+var_A4], edx
mov [rbp+var_B0], rcx
mov rax, fs:28h
mov [rbp+var_8], rax
xor eax, eax
mov eax, [rbp+var_A4]
movsxd rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
shl rax, 2
add rax, rdx
shl rax, 3
mov rdi, rax; size
call _malloc
mov [rbp+var_78], rax
mov rax, [rbp+var_B0]
mov dword ptr [rax], 0
mov [rbp+var_84], 0
jmp loc_1997
loc_1800:
mov eax, [rbp+var_84]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_A0]
add rax, rdx
mov ecx, [rax]
mov eax, [rbp+var_84]
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_98]
add rax, rdx
mov rax, [rax]
lea rdx, [rbp+s2]
mov esi, ecx
mov rdi, rax
call int_list_to_key
mov [rbp+var_80], 0
mov [rbp+var_7C], 0
jmp loc_18F2
loc_185A:
mov eax, [rbp+var_7C]
movsxd rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
shl rax, 2
add rax, rdx
shl rax, 3
mov rdx, rax
mov rax, [rbp+var_78]
add rax, rdx
mov rdx, rax
lea rax, [rbp+s2]
mov rsi, rax; s2
mov rdi, rdx; s1
call _strcmp
test eax, eax
jnz short loc_18EE
mov eax, [rbp+var_7C]
movsxd rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
shl rax, 2
add rax, rdx
shl rax, 3
mov rdx, rax
mov rax, [rbp+var_78]
add rax, rdx
mov ecx, [rax+64h]
mov eax, [rbp+var_7C]
movsxd rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
shl rax, 2
add rax, rdx
shl rax, 3
mov rdx, rax
mov rax, [rbp+var_78]
add rax, rdx
lea edx, [rcx+1]
mov [rax+64h], edx
mov [rbp+var_80], 1
jmp short loc_1904
loc_18EE:
add [rbp+var_7C], 1
loc_18F2:
mov rax, [rbp+var_B0]
mov eax, [rax]
cmp [rbp+var_7C], eax
jl loc_185A
loc_1904:
cmp [rbp+var_80], 0
jnz loc_1990
mov rax, [rbp+var_B0]
mov eax, [rax]
movsxd rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
shl rax, 2
add rax, rdx
shl rax, 3
mov rdx, rax
mov rax, [rbp+var_78]
add rax, rdx
mov rdx, rax
lea rax, [rbp+s2]
mov rsi, rax; src
mov rdi, rdx; dest
call _strcpy
mov rax, [rbp+var_B0]
mov eax, [rax]
movsxd rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
shl rax, 2
add rax, rdx
shl rax, 3
mov rdx, rax
mov rax, [rbp+var_78]
add rax, rdx
mov dword ptr [rax+64h], 1
mov rax, [rbp+var_B0]
mov eax, [rax]
lea edx, [rax+1]
mov rax, [rbp+var_B0]
mov [rax], edx
loc_1990:
add [rbp+var_84], 1
loc_1997:
mov eax, [rbp+var_84]
cmp eax, [rbp+var_A4]
jl loc_1800
mov rax, [rbp+var_78]
mov rdx, [rbp+var_8]
sub rdx, fs:28h
jz short locret_19C1
call ___stack_chk_fail
locret_19C1:
leave
retn | _DWORD * func0(long long a1, long long a2, int a3, int *a4)
{
int i; // [rsp+2Ch] [rbp-84h]
int v8; // [rsp+30h] [rbp-80h]
int j; // [rsp+34h] [rbp-7Ch]
_DWORD *v10; // [rsp+38h] [rbp-78h]
char s2[104]; // [rsp+40h] [rbp-70h] BYREF
unsigned long long v12; // [rsp+A8h] [rbp-8h]
v12 = __readfsqword(0x28u);
v10 = malloc(104LL * a3);
*a4 = 0;
for ( i = 0; i < a3; ++i )
{
int_list_to_key(*(_QWORD *)(8LL * i + a1), *(unsigned int *)(4LL * i + a2), s2);
v8 = 0;
for ( j = 0; j < *a4; ++j )
{
if ( !strcmp((const char *)&v10[26 * j], s2) )
{
++v10[26 * j + 25];
v8 = 1;
break;
}
}
if ( !v8 )
{
strcpy((char *)&v10[26 * *a4], s2);
v10[26 * (*a4)++ + 25] = 1;
}
}
return v10;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0xb0
MOV qword ptr [RBP + -0x98],RDI
MOV qword ptr [RBP + -0xa0],RSI
MOV dword ptr [RBP + -0xa4],EDX
MOV qword ptr [RBP + -0xb0],RCX
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x8],RAX
XOR EAX,EAX
MOV EAX,dword ptr [RBP + -0xa4]
MOVSXD RDX,EAX
MOV RAX,RDX
ADD RAX,RAX
ADD RAX,RDX
SHL RAX,0x2
ADD RAX,RDX
SHL RAX,0x3
MOV RDI,RAX
CALL 0x00101130
MOV qword ptr [RBP + -0x78],RAX
MOV RAX,qword ptr [RBP + -0xb0]
MOV dword ptr [RAX],0x0
MOV dword ptr [RBP + -0x84],0x0
JMP 0x00101997
LAB_00101800:
MOV EAX,dword ptr [RBP + -0x84]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0xa0]
ADD RAX,RDX
MOV ECX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x84]
CDQE
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x98]
ADD RAX,RDX
MOV RAX,qword ptr [RAX]
LEA RDX,[RBP + -0x70]
MOV ESI,ECX
MOV RDI,RAX
CALL 0x00101249
MOV dword ptr [RBP + -0x80],0x0
MOV dword ptr [RBP + -0x7c],0x0
JMP 0x001018f2
LAB_0010185a:
MOV EAX,dword ptr [RBP + -0x7c]
MOVSXD RDX,EAX
MOV RAX,RDX
ADD RAX,RAX
ADD RAX,RDX
SHL RAX,0x2
ADD RAX,RDX
SHL RAX,0x3
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0x78]
ADD RAX,RDX
MOV RDX,RAX
LEA RAX,[RBP + -0x70]
MOV RSI,RAX
MOV RDI,RDX
CALL 0x00101120
TEST EAX,EAX
JNZ 0x001018ee
MOV EAX,dword ptr [RBP + -0x7c]
MOVSXD RDX,EAX
MOV RAX,RDX
ADD RAX,RAX
ADD RAX,RDX
SHL RAX,0x2
ADD RAX,RDX
SHL RAX,0x3
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0x78]
ADD RAX,RDX
MOV ECX,dword ptr [RAX + 0x64]
MOV EAX,dword ptr [RBP + -0x7c]
MOVSXD RDX,EAX
MOV RAX,RDX
ADD RAX,RAX
ADD RAX,RDX
SHL RAX,0x2
ADD RAX,RDX
SHL RAX,0x3
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0x78]
ADD RAX,RDX
LEA EDX,[RCX + 0x1]
MOV dword ptr [RAX + 0x64],EDX
MOV dword ptr [RBP + -0x80],0x1
JMP 0x00101904
LAB_001018ee:
ADD dword ptr [RBP + -0x7c],0x1
LAB_001018f2:
MOV RAX,qword ptr [RBP + -0xb0]
MOV EAX,dword ptr [RAX]
CMP dword ptr [RBP + -0x7c],EAX
JL 0x0010185a
LAB_00101904:
CMP dword ptr [RBP + -0x80],0x0
JNZ 0x00101990
MOV RAX,qword ptr [RBP + -0xb0]
MOV EAX,dword ptr [RAX]
MOVSXD RDX,EAX
MOV RAX,RDX
ADD RAX,RAX
ADD RAX,RDX
SHL RAX,0x2
ADD RAX,RDX
SHL RAX,0x3
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0x78]
ADD RAX,RDX
MOV RDX,RAX
LEA RAX,[RBP + -0x70]
MOV RSI,RAX
MOV RDI,RDX
CALL 0x001010e0
MOV RAX,qword ptr [RBP + -0xb0]
MOV EAX,dword ptr [RAX]
MOVSXD RDX,EAX
MOV RAX,RDX
ADD RAX,RAX
ADD RAX,RDX
SHL RAX,0x2
ADD RAX,RDX
SHL RAX,0x3
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0x78]
ADD RAX,RDX
MOV dword ptr [RAX + 0x64],0x1
MOV RAX,qword ptr [RBP + -0xb0]
MOV EAX,dword ptr [RAX]
LEA EDX,[RAX + 0x1]
MOV RAX,qword ptr [RBP + -0xb0]
MOV dword ptr [RAX],EDX
LAB_00101990:
ADD dword ptr [RBP + -0x84],0x1
LAB_00101997:
MOV EAX,dword ptr [RBP + -0x84]
CMP EAX,dword ptr [RBP + -0xa4]
JL 0x00101800
MOV RAX,qword ptr [RBP + -0x78]
MOV RDX,qword ptr [RBP + -0x8]
SUB RDX,qword ptr FS:[0x28]
JZ 0x001019c1
CALL 0x00101100
LAB_001019c1:
LEAVE
RET | void * func0(long param_1,long param_2,int param_3,int *param_4)
{
bool bVar1;
int iVar2;
void *pvVar3;
long in_FS_OFFSET;
int local_8c;
int local_84;
char local_78 [104];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
pvVar3 = malloc((long)param_3 * 0x68);
*param_4 = 0;
local_8c = 0;
do {
if (param_3 <= local_8c) {
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return pvVar3;
}
int_list_to_key(*(int8 *)(param_1 + (long)local_8c * 8),
*(int4 *)(param_2 + (long)local_8c * 4),local_78);
bVar1 = false;
for (local_84 = 0; local_84 < *param_4; local_84 = local_84 + 1) {
iVar2 = strcmp((char *)((long)pvVar3 + (long)local_84 * 0x68),local_78);
if (iVar2 == 0) {
*(int *)((long)pvVar3 + (long)local_84 * 0x68 + 100) =
*(int *)((long)pvVar3 + (long)local_84 * 0x68 + 100) + 1;
bVar1 = true;
break;
}
}
if (!bVar1) {
strcpy((char *)((long)pvVar3 + (long)*param_4 * 0x68),local_78);
*(int4 *)((long)pvVar3 + (long)*param_4 * 0x68 + 100) = 1;
*param_4 = *param_4 + 1;
}
local_8c = local_8c + 1;
} while( true );
} |
7,009 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
// Structure to hold key-value pairs
typedef struct {
char key[100];
int count;
} DictEntry;
// Function to convert integer list to string key
void int_list_to_key(int *list, int size, char *key) {
strcpy(key, "(");
for(int i = 0; i < size; i++) {
char num[20];
sprintf(num, "%d", list[i]);
strcat(key, num);
if(i < size - 1)
strcat(key, ", ");
}
strcat(key, ")");
}
// Function to convert string list to key
void str_list_to_key(char **list, int size, char *key) {
strcpy(key, "(");
for(int i = 0; i < size; i++) {
strcat(key, "'");
strcat(key, list[i]);
strcat(key, "'");
if(i < size - 1)
strcat(key, ", ");
}
strcat(key, ")");
}
// Unique sublists for string lists
DictEntry* unique_sublists_str(char ***list1, int *sizes, int n, int *unique_count) {
DictEntry *result = malloc(n * sizeof(DictEntry));
*unique_count = 0;
for(int i = 0; i < n; i++) {
char key[100];
str_list_to_key(list1[i], sizes[i], key);
int found = 0;
for(int j = 0; j < *unique_count; j++) {
if(strcmp(result[j].key, key) == 0) {
result[j].count += 1;
found = 1;
break;
}
}
if(!found) {
strcpy(result[*unique_count].key, key);
result[*unique_count].count = 1;
(*unique_count)++;
}
}
return result;
}
// Function to compare two DictEntry arrays
int compare_dict(DictEntry *dict1, int count1, DictEntry *dict2, int count2) {
if(count1 != count2)
return 0;
for(int i = 0; i < count1; i++) {
int found = 0;
for(int j = 0; j < count2; j++) {
if(strcmp(dict1[i].key, dict2[j].key) == 0 && dict1[i].count == dict2[j].count) {
found = 1;
break;
}
}
if(!found)
return 0;
}
return 1;
}
// Unique sublists for integer lists
| DictEntry* func0(int **list1, int *sizes, int n, int *unique_count) {
DictEntry *result = malloc(n * sizeof(DictEntry));
*unique_count = 0;
for(int i = 0; i < n; i++) {
char key[100];
int_list_to_key(list1[i], sizes[i], key);
int found = 0;
for(int j = 0; j < *unique_count; j++) {
if(strcmp(result[j].key, key) == 0) {
result[j].count += 1;
found = 1;
break;
}
}
if(!found) {
strcpy(result[*unique_count].key, key);
result[*unique_count].count = 1;
(*unique_count)++;
}
}
return result;
}
| int main() {
// Test case 1
int list1_case1_data[][3] = { {1, 3}, {5, 7}, {1, 3}, {13, 15, 17}, {5, 7}, {9, 11} };
int sizes_case1[] = {2, 2, 2, 3, 2, 2};
int *list1_case1[6];
for(int i = 0; i < 6; i++) {
list1_case1[i] = list1_case1_data[i];
}
int unique_count1;
DictEntry *result1 = func0(list1_case1, sizes_case1, 6, &unique_count1);
DictEntry expected1[] = { {"(1, 3)", 2}, {"(5, 7)", 2}, {"(13, 15, 17)", 1}, {"(9, 11)", 1} };
assert(compare_dict(result1, unique_count1, expected1, 4));
free(result1);
// Test case 2
char *list1_case2_data[][2] = { {"green", "orange"}, {"black"}, {"green", "orange"}, {"white"} };
int sizes_case2[] = {2, 1, 2, 1};
char **list1_case2[4];
for(int i = 0; i < 4; i++) {
list1_case2[i] = list1_case2_data[i];
}
int unique_count2;
DictEntry *result2 = unique_sublists_str(list1_case2, sizes_case2, 4, &unique_count2);
DictEntry expected2[] = { {"('green', 'orange')", 2}, {"('black')", 1}, {"('white')", 1} };
assert(compare_dict(result2, unique_count2, expected2, 3));
free(result2);
// Test case 3
int list1_case3_data[][2] = { {1, 2}, {3, 4}, {4, 5}, {6, 7} };
int sizes_case3[] = {2, 2, 2, 2};
int *list1_case3[4];
for(int i = 0; i < 4; i++) {
list1_case3[i] = list1_case3_data[i];
}
int unique_count3;
DictEntry *result3 = func0(list1_case3, sizes_case3, 4, &unique_count3);
DictEntry expected3[] = { {"(1, 2)", 1}, {"(3, 4)", 1}, {"(4, 5)", 1}, {"(6, 7)", 1} };
assert(compare_dict(result3, unique_count3, expected3, 4));
free(result3);
return 0;
}
| O1 | c | func0:
endbr64
push %r15
push %r14
push %r13
push %r12
push %rbp
push %rbx
sub $0xa8,%rsp
mov %rdi,0x18(%rsp)
mov %rsi,0x20(%rsp)
mov %edx,%ebx
mov %rcx,%r15
mov %rcx,0x10(%rsp)
mov %fs:0x28,%rax
mov %rax,0x98(%rsp)
xor %eax,%eax
movslq %edx,%rax
lea (%rax,%rax,2),%rdx
lea (%rax,%rdx,4),%rdi
shl $0x3,%rdi
callq 1100 <malloc@plt>
mov %rax,0x8(%rsp)
movl $0x0,(%r15)
test %ebx,%ebx
jle 171c <func0+0x128>
lea -0x1(%rbx),%eax
mov %rax,0x28(%rsp)
mov $0x0,%r15d
lea 0x30(%rsp),%rbp
jmp 16b8 <func0+0xc4>
addl $0x1,0x64(%rbx)
jmp 16aa <func0+0xb6>
movslq %r14d,%rax
lea (%rax,%rax,2),%rdx
lea (%rax,%rdx,4),%rax
mov 0x8(%rsp),%rcx
lea (%rcx,%rax,8),%rbx
mov $0x64,%edx
mov %rbp,%rsi
mov %rbx,%rdi
callq 1110 <__strcpy_chk@plt>
movl $0x1,0x64(%rbx)
add $0x1,%r14d
mov 0x10(%rsp),%rax
mov %r14d,(%rax)
lea 0x1(%r15),%rax
cmp 0x28(%rsp),%r15
je 171c <func0+0x128>
mov %rax,%r15
mov 0x20(%rsp),%rax
mov (%rax,%r15,4),%esi
mov 0x18(%rsp),%rax
mov (%rax,%r15,8),%rdi
mov %rbp,%rdx
callq 1229 <int_list_to_key>
mov 0x10(%rsp),%rax
mov (%rax),%r14d
test %r14d,%r14d
jle 1673 <func0+0x7f>
mov 0x8(%rsp),%rcx
mov %rcx,%rbx
lea -0x1(%r14),%eax
add $0x1,%rax
lea (%rax,%rax,2),%rdx
lea (%rax,%rdx,4),%rax
lea (%rcx,%rax,8),%r13
mov %rbp,%rsi
mov %rbx,%rdi
callq 10f0 <strcmp@plt>
test %eax,%eax
je 166d <func0+0x79>
add $0x68,%rbx
cmp %r13,%rbx
jne 16fb <func0+0x107>
jmpq 1673 <func0+0x7f>
mov 0x98(%rsp),%rax
xor %fs:0x28,%rax
jne 1746 <func0+0x152>
mov 0x8(%rsp),%rax
add $0xa8,%rsp
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
callq 10d0 <__stack_chk_fail@plt>
| func0:
endbr64
push r15
push r14
push r13
push r12
push rbp
push rbx
sub rsp, 0A8h
mov [rsp+0D8h+var_C0], rdi
mov [rsp+0D8h+var_B8], rsi
mov ebx, edx
mov r14, rcx
mov [rsp+0D8h+var_C8], rcx
mov rax, fs:28h
mov [rsp+0D8h+var_40], rax
xor eax, eax
movsxd rax, edx
lea rdx, [rax+rax*2]
lea rdi, [rax+rdx*4]
shl rdi, 3
call _malloc
mov [rsp+0D8h+var_D0], rax
mov dword ptr [r14], 0
test ebx, ebx
jle loc_16BE
mov eax, ebx
mov [rsp+0D8h+var_B0], rax
mov r14d, 0
lea rbp, [rsp+0D8h+var_A8]
jmp short loc_165F
loc_1617:
add dword ptr [rbx+64h], 1
jmp short loc_1654
loc_161D:
movsxd rax, r15d
lea rdx, [rax+rax*2]
lea rax, [rax+rdx*4]
mov rdx, [rsp+0D8h+var_D0]
lea rbx, [rdx+rax*8]
mov edx, 64h ; 'd'
mov rsi, rbp
mov rdi, rbx
call ___strcpy_chk
mov dword ptr [rbx+64h], 1
add r15d, 1
mov rax, [rsp+0D8h+var_C8]
mov [rax], r15d
loc_1654:
add r14, 1
cmp r14, [rsp+0D8h+var_B0]
jz short loc_16BE
loc_165F:
mov rax, [rsp+0D8h+var_B8]
mov esi, [rax+r14*4]
mov rax, [rsp+0D8h+var_C0]
mov rdi, [rax+r14*8]
mov rdx, rbp
call int_list_to_key
mov rax, [rsp+0D8h+var_C8]
mov r15d, [rax]
test r15d, r15d
jle short loc_161D
mov rcx, [rsp+0D8h+var_D0]
mov rbx, rcx
mov eax, r15d
lea rdx, [rax+rax*2]
lea rax, [rax+rdx*4]
lea r13, [rcx+rax*8]
loc_169D:
mov rsi, rbp
mov rdi, rbx
call _strcmp
test eax, eax
jz loc_1617
add rbx, 68h ; 'h'
cmp rbx, r13
jnz short loc_169D
jmp loc_161D
loc_16BE:
mov rax, [rsp+0D8h+var_40]
sub rax, fs:28h
jnz short loc_16E8
mov rax, [rsp+0D8h+var_D0]
add rsp, 0A8h
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_16E8:
call ___stack_chk_fail | long long func0(long long a1, long long a2, int a3, int *a4)
{
long long i; // r14
int v7; // r15d
long long v8; // rbx
long long v10; // [rsp+8h] [rbp-D0h]
long long v12; // [rsp+28h] [rbp-B0h]
_BYTE v13[104]; // [rsp+30h] [rbp-A8h] BYREF
unsigned long long v14; // [rsp+98h] [rbp-40h]
v14 = __readfsqword(0x28u);
v10 = malloc(104LL * a3);
*a4 = 0;
if ( a3 > 0 )
{
v12 = (unsigned int)a3;
for ( i = 0LL; i != v12; ++i )
{
int_list_to_key(*(_QWORD *)(a1 + 8 * i), *(unsigned int *)(a2 + 4 * i), v13);
v7 = *a4;
if ( *a4 <= 0 )
{
LABEL_4:
__strcpy_chk(v10 + 104LL * v7, v13, 100LL);
*(_DWORD *)(v10 + 104LL * v7 + 100) = 1;
*a4 = v7 + 1;
}
else
{
v8 = v10;
while ( (unsigned int)strcmp(v8, v13) )
{
v8 += 104LL;
if ( v8 == v10 + 104LL * (unsigned int)v7 )
goto LABEL_4;
}
++*(_DWORD *)(v8 + 100);
}
}
}
return v10;
} | func0:
ENDBR64
PUSH R15
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0xa8
MOV qword ptr [RSP + 0x18],RDI
MOV qword ptr [RSP + 0x20],RSI
MOV EBX,EDX
MOV R14,RCX
MOV qword ptr [RSP + 0x10],RCX
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x98],RAX
XOR EAX,EAX
MOVSXD RAX,EDX
LEA RDX,[RAX + RAX*0x2]
LEA RDI,[RAX + RDX*0x4]
SHL RDI,0x3
CALL 0x00101120
MOV qword ptr [RSP + 0x8],RAX
MOV dword ptr [R14],0x0
TEST EBX,EBX
JLE 0x001016be
MOV EAX,EBX
MOV qword ptr [RSP + 0x28],RAX
MOV R14D,0x0
LEA RBP,[RSP + 0x30]
JMP 0x0010165f
LAB_00101617:
ADD dword ptr [RBX + 0x64],0x1
JMP 0x00101654
LAB_0010161d:
MOVSXD RAX,R15D
LEA RDX,[RAX + RAX*0x2]
LEA RAX,[RAX + RDX*0x4]
MOV RDX,qword ptr [RSP + 0x8]
LEA RBX,[RDX + RAX*0x8]
MOV EDX,0x64
MOV RSI,RBP
MOV RDI,RBX
CALL 0x00101130
MOV dword ptr [RBX + 0x64],0x1
ADD R15D,0x1
MOV RAX,qword ptr [RSP + 0x10]
MOV dword ptr [RAX],R15D
LAB_00101654:
ADD R14,0x1
CMP R14,qword ptr [RSP + 0x28]
JZ 0x001016be
LAB_0010165f:
MOV RAX,qword ptr [RSP + 0x20]
MOV ESI,dword ptr [RAX + R14*0x4]
MOV RAX,qword ptr [RSP + 0x18]
MOV RDI,qword ptr [RAX + R14*0x8]
MOV RDX,RBP
CALL 0x00101249
MOV RAX,qword ptr [RSP + 0x10]
MOV R15D,dword ptr [RAX]
TEST R15D,R15D
JLE 0x0010161d
MOV RCX,qword ptr [RSP + 0x8]
MOV RBX,RCX
MOV EAX,R15D
LEA RDX,[RAX + RAX*0x2]
LEA RAX,[RAX + RDX*0x4]
LEA R13,[RCX + RAX*0x8]
LAB_0010169d:
MOV RSI,RBP
MOV RDI,RBX
CALL 0x00101110
TEST EAX,EAX
JZ 0x00101617
ADD RBX,0x68
CMP RBX,R13
JNZ 0x0010169d
JMP 0x0010161d
LAB_001016be:
MOV RAX,qword ptr [RSP + 0x98]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x001016e8
MOV RAX,qword ptr [RSP + 0x8]
ADD RSP,0xa8
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_001016e8:
CALL 0x001010f0 | char * func0(long param_1,long param_2,uint param_3,uint *param_4)
{
uint uVar1;
int iVar2;
char *pcVar3;
char *pcVar4;
ulong uVar5;
long in_FS_OFFSET;
char local_a8 [104];
long local_40;
local_40 = *(long *)(in_FS_OFFSET + 0x28);
pcVar3 = (char *)malloc((long)(int)param_3 * 0x68);
*param_4 = 0;
if (0 < (int)param_3) {
uVar5 = 0;
do {
int_list_to_key(*(int8 *)(param_1 + uVar5 * 8),*(int4 *)(param_2 + uVar5 * 4),
local_a8);
uVar1 = *param_4;
if (0 < (int)uVar1) {
pcVar4 = pcVar3;
do {
iVar2 = strcmp(pcVar4,local_a8);
if (iVar2 == 0) {
*(int *)(pcVar4 + 100) = *(int *)(pcVar4 + 100) + 1;
goto LAB_00101654;
}
pcVar4 = pcVar4 + 0x68;
} while (pcVar4 != pcVar3 + (ulong)uVar1 * 0x68);
}
pcVar4 = pcVar3 + (long)(int)uVar1 * 0x68;
__strcpy_chk(pcVar4,local_a8,100);
pcVar4[100] = '\x01';
pcVar4[0x65] = '\0';
pcVar4[0x66] = '\0';
pcVar4[0x67] = '\0';
*param_4 = uVar1 + 1;
LAB_00101654:
uVar5 = uVar5 + 1;
} while (uVar5 != param_3);
}
if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return pcVar3;
} |
7,010 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
// Structure to hold key-value pairs
typedef struct {
char key[100];
int count;
} DictEntry;
// Function to convert integer list to string key
void int_list_to_key(int *list, int size, char *key) {
strcpy(key, "(");
for(int i = 0; i < size; i++) {
char num[20];
sprintf(num, "%d", list[i]);
strcat(key, num);
if(i < size - 1)
strcat(key, ", ");
}
strcat(key, ")");
}
// Function to convert string list to key
void str_list_to_key(char **list, int size, char *key) {
strcpy(key, "(");
for(int i = 0; i < size; i++) {
strcat(key, "'");
strcat(key, list[i]);
strcat(key, "'");
if(i < size - 1)
strcat(key, ", ");
}
strcat(key, ")");
}
// Unique sublists for string lists
DictEntry* unique_sublists_str(char ***list1, int *sizes, int n, int *unique_count) {
DictEntry *result = malloc(n * sizeof(DictEntry));
*unique_count = 0;
for(int i = 0; i < n; i++) {
char key[100];
str_list_to_key(list1[i], sizes[i], key);
int found = 0;
for(int j = 0; j < *unique_count; j++) {
if(strcmp(result[j].key, key) == 0) {
result[j].count += 1;
found = 1;
break;
}
}
if(!found) {
strcpy(result[*unique_count].key, key);
result[*unique_count].count = 1;
(*unique_count)++;
}
}
return result;
}
// Function to compare two DictEntry arrays
int compare_dict(DictEntry *dict1, int count1, DictEntry *dict2, int count2) {
if(count1 != count2)
return 0;
for(int i = 0; i < count1; i++) {
int found = 0;
for(int j = 0; j < count2; j++) {
if(strcmp(dict1[i].key, dict2[j].key) == 0 && dict1[i].count == dict2[j].count) {
found = 1;
break;
}
}
if(!found)
return 0;
}
return 1;
}
// Unique sublists for integer lists
| DictEntry* func0(int **list1, int *sizes, int n, int *unique_count) {
DictEntry *result = malloc(n * sizeof(DictEntry));
*unique_count = 0;
for(int i = 0; i < n; i++) {
char key[100];
int_list_to_key(list1[i], sizes[i], key);
int found = 0;
for(int j = 0; j < *unique_count; j++) {
if(strcmp(result[j].key, key) == 0) {
result[j].count += 1;
found = 1;
break;
}
}
if(!found) {
strcpy(result[*unique_count].key, key);
result[*unique_count].count = 1;
(*unique_count)++;
}
}
return result;
}
| int main() {
// Test case 1
int list1_case1_data[][3] = { {1, 3}, {5, 7}, {1, 3}, {13, 15, 17}, {5, 7}, {9, 11} };
int sizes_case1[] = {2, 2, 2, 3, 2, 2};
int *list1_case1[6];
for(int i = 0; i < 6; i++) {
list1_case1[i] = list1_case1_data[i];
}
int unique_count1;
DictEntry *result1 = func0(list1_case1, sizes_case1, 6, &unique_count1);
DictEntry expected1[] = { {"(1, 3)", 2}, {"(5, 7)", 2}, {"(13, 15, 17)", 1}, {"(9, 11)", 1} };
assert(compare_dict(result1, unique_count1, expected1, 4));
free(result1);
// Test case 2
char *list1_case2_data[][2] = { {"green", "orange"}, {"black"}, {"green", "orange"}, {"white"} };
int sizes_case2[] = {2, 1, 2, 1};
char **list1_case2[4];
for(int i = 0; i < 4; i++) {
list1_case2[i] = list1_case2_data[i];
}
int unique_count2;
DictEntry *result2 = unique_sublists_str(list1_case2, sizes_case2, 4, &unique_count2);
DictEntry expected2[] = { {"('green', 'orange')", 2}, {"('black')", 1}, {"('white')", 1} };
assert(compare_dict(result2, unique_count2, expected2, 3));
free(result2);
// Test case 3
int list1_case3_data[][2] = { {1, 2}, {3, 4}, {4, 5}, {6, 7} };
int sizes_case3[] = {2, 2, 2, 2};
int *list1_case3[4];
for(int i = 0; i < 4; i++) {
list1_case3[i] = list1_case3_data[i];
}
int unique_count3;
DictEntry *result3 = func0(list1_case3, sizes_case3, 4, &unique_count3);
DictEntry expected3[] = { {"(1, 2)", 1}, {"(3, 4)", 1}, {"(4, 5)", 1}, {"(6, 7)", 1} };
assert(compare_dict(result3, unique_count3, expected3, 4));
free(result3);
return 0;
}
| O2 | c | func0:
endbr64
push %r15
mov %rcx,%r15
push %r14
push %r13
push %r12
push %rbp
push %rbx
mov %edx,%ebx
sub $0x98,%rsp
mov %rdi,0x8(%rsp)
mov %rsi,0x10(%rsp)
mov %rcx,(%rsp)
mov %fs:0x28,%rax
mov %rax,0x88(%rsp)
xor %eax,%eax
movslq %edx,%rax
lea (%rax,%rax,2),%rdx
lea (%rax,%rdx,4),%rdi
shl $0x3,%rdi
callq 1130 <malloc@plt>
movl $0x0,(%r15)
mov %rax,%r14
test %ebx,%ebx
jle 1b2c <func0+0x12c>
lea -0x1(%rbx),%eax
xor %r13d,%r13d
lea 0x20(%rsp),%rbx
mov %rax,0x18(%rsp)
nopl 0x0(%rax)
mov 0x10(%rsp),%rax
mov %rbx,%rdx
mov (%rax,%r13,4),%esi
mov 0x8(%rsp),%rax
mov (%rax,%r13,8),%rdi
callq 1700 <int_list_to_key>
mov (%rsp),%rax
mov (%rax),%r12d
test %r12d,%r12d
jle 1af0 <func0+0xf0>
lea -0x1(%r12),%eax
mov %r14,%r15
add $0x1,%rax
lea (%rax,%rax,2),%rcx
lea (%rax,%rcx,4),%rax
lea (%r14,%rax,8),%rbp
jmp 1ac9 <func0+0xc9>
nopl 0x0(%rax,%rax,1)
add $0x68,%r15
cmp %r15,%rbp
je 1af0 <func0+0xf0>
mov %rbx,%rsi
mov %r15,%rdi
callq 1120 <strcmp@plt>
test %eax,%eax
jne 1ac0 <func0+0xc0>
addl $0x1,0x64(%r15)
lea 0x1(%r13),%rax
cmp 0x18(%rsp),%r13
je 1b2c <func0+0x12c>
mov %rax,%r13
jmp 1a78 <func0+0x78>
nopl (%rax)
movslq %r12d,%rax
mov %rbx,%rsi
add $0x1,%r12d
lea (%rax,%rax,2),%rdx
lea (%rax,%rdx,4),%rax
mov $0x64,%edx
lea (%r14,%rax,8),%rcx
mov %rcx,%rdi
callq 1140 <__strcpy_chk@plt>
movl $0x1,0x64(%rax)
mov (%rsp),%rax
mov %r12d,(%rax)
lea 0x1(%r13),%rax
cmp 0x18(%rsp),%r13
jne 1ae8 <func0+0xe8>
mov 0x88(%rsp),%rax
xor %fs:0x28,%rax
jne 1b54 <func0+0x154>
add $0x98,%rsp
mov %r14,%rax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
callq 1100 <__stack_chk_fail@plt>
nopl 0x0(%rax)
| func0:
endbr64
push r15
movsxd rdx, edx
mov r15, rcx
push r14
push r13
push r12
push rbp
push rbx
mov rbx, rdx
sub rsp, 98h
mov [rsp+0C8h+var_C0], rdi
mov [rsp+0C8h+var_B8], rsi
mov [rsp+0C8h+var_C8], rcx
mov rax, fs:28h
mov [rsp+0C8h+var_40], rax
xor eax, eax
lea rax, [rdx+rdx*2]
mov [rsp+0C8h+var_B0], rdx
lea rdi, [rdx+rax*4]
shl rdi, 3
call _malloc
mov dword ptr [r15], 0
mov r14, rax
test ebx, ebx
jle short loc_1AB8
xor r12d, r12d
lea rbx, [rsp+0C8h+var_A8]
nop dword ptr [rax+rax+00h]
loc_1A50:
mov rax, [rsp+0C8h+var_B8]
mov rdx, rbx
mov esi, [rax+r12*4]
mov rax, [rsp+0C8h+var_C0]
mov rdi, [rax+r12*8]
call int_list_to_key
mov rax, [rsp+0C8h+var_C8]
mov r13d, [rax]
test r13d, r13d
jle short loc_1AE0
mov eax, r13d
mov r15, r14
lea rcx, [rax+rax*2]
lea rax, [rax+rcx*4]
lea rbp, [r14+rax*8]
jmp short loc_1A99
loc_1A90:
add r15, 68h ; 'h'
cmp rbp, r15
jz short loc_1AE0
loc_1A99:
mov rsi, rbx
mov rdi, r15
call _strcmp
test eax, eax
jnz short loc_1A90
add dword ptr [r15+64h], 1
loc_1AAD:
add r12, 1
cmp r12, [rsp+0C8h+var_B0]
jnz short loc_1A50
loc_1AB8:
mov rax, [rsp+0C8h+var_40]
sub rax, fs:28h
jnz short loc_1B13
add rsp, 98h
mov rax, r14
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_1AE0:
movsxd rax, r13d
mov rsi, rbx
add r13d, 1
lea rdx, [rax+rax*2]
lea rax, [rax+rdx*4]
mov edx, 64h ; 'd'
lea rcx, [r14+rax*8]
mov rdi, rcx
call ___strcpy_chk
mov dword ptr [rax+64h], 1
mov rax, [rsp+0C8h+var_C8]
mov [rax], r13d
jmp short loc_1AAD
loc_1B13:
call ___stack_chk_fail | long long func0(long long a1, long long a2, int a3, int *a4)
{
long long v6; // rax
long long v7; // r14
long long v8; // r12
int v9; // r13d
long long v10; // r15
long long v13; // [rsp+18h] [rbp-B0h]
_BYTE v14[104]; // [rsp+20h] [rbp-A8h] BYREF
unsigned long long v15; // [rsp+88h] [rbp-40h]
v15 = __readfsqword(0x28u);
v13 = a3;
v6 = malloc(104LL * a3);
*a4 = 0;
v7 = v6;
if ( a3 > 0 )
{
v8 = 0LL;
do
{
int_list_to_key(*(_QWORD *)(a1 + 8 * v8), *(unsigned int *)(a2 + 4 * v8), v14);
v9 = *a4;
if ( *a4 <= 0 )
{
LABEL_10:
*(_DWORD *)(__strcpy_chk(v7 + 104LL * v9, v14, 100LL) + 100) = 1;
*a4 = v9 + 1;
}
else
{
v10 = v7;
while ( (unsigned int)strcmp(v10, v14) )
{
v10 += 104LL;
if ( v7 + 104LL * (unsigned int)v9 == v10 )
goto LABEL_10;
}
++*(_DWORD *)(v10 + 100);
}
++v8;
}
while ( v8 != v13 );
}
return v7;
} | func0:
ENDBR64
PUSH R15
MOVSXD RDX,EDX
MOV R15,RCX
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
MOV RBX,RDX
SUB RSP,0x98
MOV qword ptr [RSP + 0x8],RDI
MOV qword ptr [RSP + 0x10],RSI
MOV qword ptr [RSP],RCX
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x88],RAX
XOR EAX,EAX
LEA RAX,[RDX + RDX*0x2]
MOV qword ptr [RSP + 0x18],RDX
LEA RDI,[RDX + RAX*0x4]
SHL RDI,0x3
CALL 0x00101130
MOV dword ptr [R15],0x0
MOV R14,RAX
TEST EBX,EBX
JLE 0x00101ab8
XOR R12D,R12D
LEA RBX,[RSP + 0x20]
NOP dword ptr [RAX + RAX*0x1]
LAB_00101a50:
MOV RAX,qword ptr [RSP + 0x10]
MOV RDX,RBX
MOV ESI,dword ptr [RAX + R12*0x4]
MOV RAX,qword ptr [RSP + 0x8]
MOV RDI,qword ptr [RAX + R12*0x8]
CALL 0x00101700
MOV RAX,qword ptr [RSP]
MOV R13D,dword ptr [RAX]
TEST R13D,R13D
JLE 0x00101ae0
MOV EAX,R13D
MOV R15,R14
LEA RCX,[RAX + RAX*0x2]
LEA RAX,[RAX + RCX*0x4]
LEA RBP,[R14 + RAX*0x8]
JMP 0x00101a99
LAB_00101a90:
ADD R15,0x68
CMP RBP,R15
JZ 0x00101ae0
LAB_00101a99:
MOV RSI,RBX
MOV RDI,R15
CALL 0x00101120
TEST EAX,EAX
JNZ 0x00101a90
ADD dword ptr [R15 + 0x64],0x1
LAB_00101aad:
ADD R12,0x1
CMP R12,qword ptr [RSP + 0x18]
JNZ 0x00101a50
LAB_00101ab8:
MOV RAX,qword ptr [RSP + 0x88]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x00101b13
ADD RSP,0x98
MOV RAX,R14
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_00101ae0:
MOVSXD RAX,R13D
MOV RSI,RBX
ADD R13D,0x1
LEA RDX,[RAX + RAX*0x2]
LEA RAX,[RAX + RDX*0x4]
MOV EDX,0x64
LEA RCX,[R14 + RAX*0x8]
MOV RDI,RCX
CALL 0x00101140
MOV dword ptr [RAX + 0x64],0x1
MOV RAX,qword ptr [RSP]
MOV dword ptr [RAX],R13D
JMP 0x00101aad
LAB_00101b13:
CALL 0x00101100 | char * func0(long param_1,long param_2,int param_3,uint *param_4)
{
uint uVar1;
int iVar2;
char *pcVar3;
long lVar4;
long lVar5;
char *__s1;
long in_FS_OFFSET;
char local_a8 [104];
long local_40;
local_40 = *(long *)(in_FS_OFFSET + 0x28);
pcVar3 = (char *)malloc((long)param_3 * 0x68);
*param_4 = 0;
if (0 < param_3) {
lVar5 = 0;
do {
int_list_to_key(*(int8 *)(param_1 + lVar5 * 8),*(int4 *)(param_2 + lVar5 * 4),
local_a8);
uVar1 = *param_4;
if (0 < (int)uVar1) {
__s1 = pcVar3;
do {
iVar2 = strcmp(__s1,local_a8);
if (iVar2 == 0) {
*(int *)(__s1 + 100) = *(int *)(__s1 + 100) + 1;
goto LAB_00101aad;
}
__s1 = __s1 + 0x68;
} while (pcVar3 + (ulong)uVar1 * 0x68 != __s1);
}
lVar4 = __strcpy_chk(pcVar3 + (long)(int)uVar1 * 0x68,local_a8,100);
*(int4 *)(lVar4 + 100) = 1;
*param_4 = uVar1 + 1;
LAB_00101aad:
lVar5 = lVar5 + 1;
} while (lVar5 != param_3);
}
if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar3;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
7,011 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
// Structure to hold key-value pairs
typedef struct {
char key[100];
int count;
} DictEntry;
// Function to convert integer list to string key
void int_list_to_key(int *list, int size, char *key) {
strcpy(key, "(");
for(int i = 0; i < size; i++) {
char num[20];
sprintf(num, "%d", list[i]);
strcat(key, num);
if(i < size - 1)
strcat(key, ", ");
}
strcat(key, ")");
}
// Function to convert string list to key
void str_list_to_key(char **list, int size, char *key) {
strcpy(key, "(");
for(int i = 0; i < size; i++) {
strcat(key, "'");
strcat(key, list[i]);
strcat(key, "'");
if(i < size - 1)
strcat(key, ", ");
}
strcat(key, ")");
}
// Unique sublists for string lists
DictEntry* unique_sublists_str(char ***list1, int *sizes, int n, int *unique_count) {
DictEntry *result = malloc(n * sizeof(DictEntry));
*unique_count = 0;
for(int i = 0; i < n; i++) {
char key[100];
str_list_to_key(list1[i], sizes[i], key);
int found = 0;
for(int j = 0; j < *unique_count; j++) {
if(strcmp(result[j].key, key) == 0) {
result[j].count += 1;
found = 1;
break;
}
}
if(!found) {
strcpy(result[*unique_count].key, key);
result[*unique_count].count = 1;
(*unique_count)++;
}
}
return result;
}
// Function to compare two DictEntry arrays
int compare_dict(DictEntry *dict1, int count1, DictEntry *dict2, int count2) {
if(count1 != count2)
return 0;
for(int i = 0; i < count1; i++) {
int found = 0;
for(int j = 0; j < count2; j++) {
if(strcmp(dict1[i].key, dict2[j].key) == 0 && dict1[i].count == dict2[j].count) {
found = 1;
break;
}
}
if(!found)
return 0;
}
return 1;
}
// Unique sublists for integer lists
| DictEntry* func0(int **list1, int *sizes, int n, int *unique_count) {
DictEntry *result = malloc(n * sizeof(DictEntry));
*unique_count = 0;
for(int i = 0; i < n; i++) {
char key[100];
int_list_to_key(list1[i], sizes[i], key);
int found = 0;
for(int j = 0; j < *unique_count; j++) {
if(strcmp(result[j].key, key) == 0) {
result[j].count += 1;
found = 1;
break;
}
}
if(!found) {
strcpy(result[*unique_count].key, key);
result[*unique_count].count = 1;
(*unique_count)++;
}
}
return result;
}
| int main() {
// Test case 1
int list1_case1_data[][3] = { {1, 3}, {5, 7}, {1, 3}, {13, 15, 17}, {5, 7}, {9, 11} };
int sizes_case1[] = {2, 2, 2, 3, 2, 2};
int *list1_case1[6];
for(int i = 0; i < 6; i++) {
list1_case1[i] = list1_case1_data[i];
}
int unique_count1;
DictEntry *result1 = func0(list1_case1, sizes_case1, 6, &unique_count1);
DictEntry expected1[] = { {"(1, 3)", 2}, {"(5, 7)", 2}, {"(13, 15, 17)", 1}, {"(9, 11)", 1} };
assert(compare_dict(result1, unique_count1, expected1, 4));
free(result1);
// Test case 2
char *list1_case2_data[][2] = { {"green", "orange"}, {"black"}, {"green", "orange"}, {"white"} };
int sizes_case2[] = {2, 1, 2, 1};
char **list1_case2[4];
for(int i = 0; i < 4; i++) {
list1_case2[i] = list1_case2_data[i];
}
int unique_count2;
DictEntry *result2 = unique_sublists_str(list1_case2, sizes_case2, 4, &unique_count2);
DictEntry expected2[] = { {"('green', 'orange')", 2}, {"('black')", 1}, {"('white')", 1} };
assert(compare_dict(result2, unique_count2, expected2, 3));
free(result2);
// Test case 3
int list1_case3_data[][2] = { {1, 2}, {3, 4}, {4, 5}, {6, 7} };
int sizes_case3[] = {2, 2, 2, 2};
int *list1_case3[4];
for(int i = 0; i < 4; i++) {
list1_case3[i] = list1_case3_data[i];
}
int unique_count3;
DictEntry *result3 = func0(list1_case3, sizes_case3, 4, &unique_count3);
DictEntry expected3[] = { {"(1, 2)", 1}, {"(3, 4)", 1}, {"(4, 5)", 1}, {"(6, 7)", 1} };
assert(compare_dict(result3, unique_count3, expected3, 4));
free(result3);
return 0;
}
| O3 | c | func0:
endbr64
push %r15
push %r14
mov %rcx,%r14
push %r13
push %r12
push %rbp
push %rbx
mov %edx,%ebx
sub $0xd8,%rsp
mov %rdi,0x28(%rsp)
mov %rsi,0x30(%rsp)
mov %rcx,0x10(%rsp)
mov %fs:0x28,%rax
mov %rax,0xc8(%rsp)
xor %eax,%eax
movslq %edx,%rax
lea (%rax,%rax,2),%rdx
lea (%rax,%rdx,4),%rdi
shl $0x3,%rdi
callq 1190 <malloc@plt>
movl $0x0,(%r14)
mov %rax,0x20(%rsp)
test %ebx,%ebx
jle 203a <func0+0x2ba>
lea -0x1(%rbx),%eax
movq $0x0,(%rsp)
lea 0x60(%rsp),%r15
mov %rax,0x38(%rsp)
mov (%rsp),%rax
lea 0x1200(%rip),%r14
nopl 0x0(%rax)
mov 0x30(%rsp),%rsi
mov $0x28,%edx
mov %dx,(%r15)
mov (%rsi,%rax,4),%r13d
mov 0x28(%rsp),%rsi
mov (%rsi,%rax,8),%rax
mov %rax,0x8(%rsp)
test %r13d,%r13d
jle 1f34 <func0+0x1b4>
lea -0x1(%r13),%eax
test %eax,%eax
jle 1fe0 <func0+0x260>
mov 0x8(%rsp),%r12
mov %r13d,0x1c(%rsp)
xor %ebx,%ebx
mov %eax,%r13d
lea 0x40(%rsp),%rbp
nopl 0x0(%rax)
mov (%r12),%r8d
mov %rbp,%rdi
mov %r14,%rcx
mov $0x14,%edx
mov $0x1,%esi
xor %eax,%eax
callq 11b0 <__sprintf_chk@plt>
mov %r15,%rdi
mov (%rdi),%edx
add $0x4,%rdi
lea -0x1010101(%rdx),%eax
not %edx
and %edx,%eax
and $0x80808080,%eax
je 1e76 <func0+0xf6>
mov %eax,%edx
shr $0x10,%edx
test $0x8080,%eax
cmove %edx,%eax
lea 0x2(%rdi),%rdx
cmove %rdx,%rdi
mov $0x64,%edx
mov %eax,%esi
add %al,%sil
mov %rbp,%rsi
sbb $0x3,%rdi
add $0x1,%ebx
add $0x4,%r12
callq 1180 <__stpcpy_chk@plt>
mov %r15,%rcx
mov $0x3,%edx
lea 0x113b(%rip),%rsi
sub %rax,%rcx
mov %rax,%rdi
add $0x64,%rcx
callq 1170 <__memcpy_chk@plt>
cmp %r13d,%ebx
jl 1e58 <func0+0xd8>
mov 0x1c(%rsp),%r13d
cmp %ebx,%r13d
jle 1f34 <func0+0x1b4>
mov 0x8(%rsp),%r12
movslq %ebx,%rbx
nopl 0x0(%rax,%rax,1)
mov (%r12,%rbx,4),%r8d
mov %r14,%rcx
mov $0x14,%edx
mov %rbp,%rdi
mov $0x1,%esi
xor %eax,%eax
add $0x1,%rbx
callq 11b0 <__sprintf_chk@plt>
mov $0x64,%edx
mov %rbp,%rsi
mov %r15,%rdi
callq 1100 <__strcat_chk@plt>
cmp %ebx,%r13d
jg 1f00 <func0+0x180>
mov %r15,%rbx
mov (%rbx),%edx
add $0x4,%rbx
lea -0x1010101(%rdx),%eax
not %edx
and %edx,%eax
and $0x80808080,%eax
je 1f37 <func0+0x1b7>
mov %eax,%edx
shr $0x10,%edx
test $0x8080,%eax
cmove %edx,%eax
lea 0x2(%rbx),%rdx
cmove %rdx,%rbx
mov %eax,%esi
add %al,%sil
mov $0x29,%eax
sbb $0x3,%rbx
mov %ax,(%rbx)
mov 0x10(%rsp),%rax
add $0x1,%rbx
mov (%rax),%r12d
test %r12d,%r12d
jle 1ff0 <func0+0x270>
lea -0x1(%r12),%eax
mov 0x20(%rsp),%rsi
add $0x1,%rax
lea (%rax,%rax,2),%rdx
mov %rsi,%r13
lea (%rax,%rdx,4),%rax
lea (%rsi,%rax,8),%rbp
jmp 1fb1 <func0+0x231>
nopl 0x0(%rax)
add $0x68,%r13
cmp %rbp,%r13
je 1ff0 <func0+0x270>
mov %r15,%rsi
mov %r13,%rdi
callq 1160 <strcmp@plt>
test %eax,%eax
jne 1fa8 <func0+0x228>
mov (%rsp),%rsi
addl $0x1,0x64(%r13)
lea 0x1(%rsi),%rax
cmp 0x38(%rsp),%rsi
je 203a <func0+0x2ba>
mov %rax,(%rsp)
jmpq 1e08 <func0+0x88>
nopl (%rax)
xor %ebx,%ebx
lea 0x40(%rsp),%rbp
jmpq 1ef0 <func0+0x170>
nopl 0x0(%rax)
movslq %r12d,%rax
mov 0x20(%rsp),%rsi
sub %r15,%rbx
mov $0x64,%ecx
lea (%rax,%rax,2),%rdx
add $0x1,%r12d
lea (%rax,%rdx,4),%rax
lea 0x1(%rbx),%rdx
lea (%rsi,%rax,8),%rdi
mov %r15,%rsi
callq 1170 <__memcpy_chk@plt>
mov (%rsp),%rsi
movl $0x1,0x64(%rax)
mov 0x10(%rsp),%rax
mov %r12d,(%rax)
lea 0x1(%rsi),%rax
cmp 0x38(%rsp),%rsi
jne 1fd4 <func0+0x254>
mov 0xc8(%rsp),%rax
xor %fs:0x28,%rax
jne 2064 <func0+0x2e4>
mov 0x20(%rsp),%rax
add $0xd8,%rsp
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
callq 1140 <__stack_chk_fail@plt>
nopl 0x0(%rax)
| func0:
endbr64
push r15
mov r15, rdi
push r14
mov r14, rcx
push r13
mov r13, rsi
push r12
push rbp
movsxd rbp, edx
push rbx
sub rsp, 0A8h
mov [rsp+0D8h+var_C0], rcx
mov rax, fs:28h
mov [rsp+0D8h+var_40], rax
xor eax, eax
lea rax, [rbp+rbp*2+0]
lea rax, [rbp+rax*4+0]
shl rax, 3
mov rdi, rax; size
mov [rsp+0D8h+var_B0], rax
call _malloc
mov dword ptr [r14], 0
mov [rsp+0D8h+s1], rax
test ebp, ebp
jle loc_1C3F
lea rax, [r13+rbp*4+0]
lea rbx, [rsp+0D8h+s2]
mov [rsp+0D8h+var_B8], rax
nop word ptr [rax+rax+00000000h]
loc_1BD0:
mov esi, [r13+0]
mov rdi, [r15]
mov rdx, rbx
call int_list_to_key
mov rax, [rsp+0D8h+var_C0]
mov eax, [rax]
mov [rsp+0D8h+var_CC], eax
movsxd r12, eax
test eax, eax
jle short loc_1C70
movsxd r12, [rsp+0D8h+var_CC]
mov rcx, [rsp+0D8h+s1]
lea rax, [r12+r12*2]
mov r14, rcx
lea rax, [r12+rax*4]
lea rbp, [rcx+rax*8]
jmp short loc_1C19
loc_1C10:
add r14, 68h ; 'h'
cmp r14, rbp
jz short loc_1C70
loc_1C19:
mov rsi, rbx; s2
mov rdi, r14; s1
call _strcmp
test eax, eax
jnz short loc_1C10
add dword ptr [r14+64h], 1
loc_1C2D:
mov rax, [rsp+0D8h+var_B8]
add r13, 4
add r15, 8
cmp r13, rax
jnz short loc_1BD0
loc_1C3F:
mov rax, [rsp+0D8h+var_40]
sub rax, fs:28h
jnz short loc_1CC7
mov rax, [rsp+0D8h+s1]
add rsp, 0A8h
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_1C70:
lea rax, [r12+r12*2]
mov rdx, [rsp+0D8h+var_B0]
mov rcx, [rsp+0D8h+s1]
mov rsi, rbx
lea rax, [r12+rax*4]
shl rax, 3
add rcx, rax
cmp rdx, rax
cmovb rdx, rax
mov rdi, rcx
sub rdx, rax
mov eax, 64h ; 'd'
cmp rdx, rax
cmova rdx, rax
call ___strcpy_chk
mov r14d, [rsp+0D8h+var_CC]
mov dword ptr [rax+64h], 1
mov rax, [rsp+0D8h+var_C0]
add r14d, 1
mov [rax], r14d
jmp loc_1C2D
loc_1CC7:
call ___stack_chk_fail | char * func0(_QWORD *a1, unsigned int *a2, int a3, int *a4)
{
unsigned int *v6; // r13
long long v7; // rbp
char *v8; // rax
long long v9; // r12
char *v10; // r14
long long v12; // rdx
unsigned long long v13; // rdx
int v14; // [rsp+Ch] [rbp-CCh]
char *s1; // [rsp+10h] [rbp-C8h]
size_t v17; // [rsp+28h] [rbp-B0h]
char s2[104]; // [rsp+30h] [rbp-A8h] BYREF
unsigned long long v19; // [rsp+98h] [rbp-40h]
v6 = a2;
v7 = a3;
v19 = __readfsqword(0x28u);
v17 = 104LL * a3;
v8 = (char *)malloc(v17);
*a4 = 0;
s1 = v8;
if ( (int)v7 > 0 )
{
do
{
int_list_to_key(*a1, *v6, s2);
v14 = *a4;
v9 = *a4;
if ( *a4 <= 0 )
{
LABEL_9:
v12 = v17;
if ( v17 < 104 * v9 )
v12 = 104 * v9;
v13 = v12 - 104 * v9;
if ( v13 > 0x64 )
v13 = 100LL;
*(_DWORD *)(__strcpy_chk(&s1[104 * v9], s2, v13, &s1[104 * v9]) + 100) = 1;
*a4 = v14 + 1;
}
else
{
v9 = v14;
v10 = s1;
while ( strcmp(v10, s2) )
{
v10 += 104;
if ( v10 == &s1[104 * v14] )
goto LABEL_9;
}
++*((_DWORD *)v10 + 25);
}
++v6;
++a1;
}
while ( v6 != &a2[v7] );
}
return s1;
} | func0:
ENDBR64
PUSH R15
MOV R15,RDI
PUSH R14
MOV R14,RCX
PUSH R13
MOV R13,RSI
PUSH R12
PUSH RBP
MOVSXD RBP,EDX
PUSH RBX
SUB RSP,0xa8
MOV qword ptr [RSP + 0x18],RCX
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x98],RAX
XOR EAX,EAX
LEA RAX,[RBP + RBP*0x2]
LEA RAX,[RBP + RAX*0x4]
SHL RAX,0x3
MOV RDI,RAX
MOV qword ptr [RSP + 0x28],RAX
CALL 0x00101140
MOV dword ptr [R14],0x0
MOV qword ptr [RSP + 0x10],RAX
TEST EBP,EBP
JLE 0x00101c3f
LEA RAX,[R13 + RBP*0x4]
LEA RBX,[RSP + 0x30]
MOV qword ptr [RSP + 0x20],RAX
NOP word ptr [RAX + RAX*0x1]
LAB_00101bd0:
MOV ESI,dword ptr [R13]
MOV RDI,qword ptr [R15]
MOV RDX,RBX
CALL 0x00101700
MOV RAX,qword ptr [RSP + 0x18]
MOV EAX,dword ptr [RAX]
MOV dword ptr [RSP + 0xc],EAX
MOVSXD R12,EAX
TEST EAX,EAX
JLE 0x00101c70
MOVSXD R12,dword ptr [RSP + 0xc]
MOV RCX,qword ptr [RSP + 0x10]
LEA RAX,[R12 + R12*0x2]
MOV R14,RCX
LEA RAX,[R12 + RAX*0x4]
LEA RBP,[RCX + RAX*0x8]
JMP 0x00101c19
LAB_00101c10:
ADD R14,0x68
CMP R14,RBP
JZ 0x00101c70
LAB_00101c19:
MOV RSI,RBX
MOV RDI,R14
CALL 0x00101130
TEST EAX,EAX
JNZ 0x00101c10
ADD dword ptr [R14 + 0x64],0x1
LAB_00101c2d:
MOV RAX,qword ptr [RSP + 0x20]
ADD R13,0x4
ADD R15,0x8
CMP R13,RAX
JNZ 0x00101bd0
LAB_00101c3f:
MOV RAX,qword ptr [RSP + 0x98]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x00101cc7
MOV RAX,qword ptr [RSP + 0x10]
ADD RSP,0xa8
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_00101c70:
LEA RAX,[R12 + R12*0x2]
MOV RDX,qword ptr [RSP + 0x28]
MOV RCX,qword ptr [RSP + 0x10]
MOV RSI,RBX
LEA RAX,[R12 + RAX*0x4]
SHL RAX,0x3
ADD RCX,RAX
CMP RDX,RAX
CMOVC RDX,RAX
MOV RDI,RCX
SUB RDX,RAX
MOV EAX,0x64
CMP RDX,RAX
CMOVA RDX,RAX
CALL 0x00101150
MOV R14D,dword ptr [RSP + 0xc]
MOV dword ptr [RAX + 0x64],0x1
MOV RAX,qword ptr [RSP + 0x18]
ADD R14D,0x1
MOV dword ptr [RAX],R14D
JMP 0x00101c2d
LAB_00101cc7:
CALL 0x00101110 | char * func0(int8 *param_1,int4 *param_2,int param_3,int *param_4)
{
int4 *puVar1;
int iVar2;
int iVar3;
size_t __size;
char *pcVar4;
ulong uVar5;
long lVar6;
size_t sVar7;
ulong uVar8;
char *__s1;
long in_FS_OFFSET;
char local_a8 [104];
long local_40;
local_40 = *(long *)(in_FS_OFFSET + 0x28);
__size = (long)param_3 * 0x68;
pcVar4 = (char *)malloc(__size);
*param_4 = 0;
if (0 < param_3) {
puVar1 = param_2 + param_3;
do {
int_list_to_key(*param_1,*param_2,local_a8);
iVar2 = *param_4;
if (0 < iVar2) {
__s1 = pcVar4;
do {
iVar3 = strcmp(__s1,local_a8);
if (iVar3 == 0) {
*(int *)(__s1 + 100) = *(int *)(__s1 + 100) + 1;
goto LAB_00101c2d;
}
__s1 = __s1 + 0x68;
} while (__s1 != pcVar4 + (long)iVar2 * 0x68);
}
uVar5 = (long)iVar2 * 0x68;
sVar7 = __size;
if (__size < uVar5) {
sVar7 = uVar5;
}
uVar8 = sVar7 + (long)iVar2 * -0x68;
if (100 < uVar8) {
uVar8 = 100;
}
lVar6 = __strcpy_chk(pcVar4 + uVar5,local_a8,uVar8);
*(int4 *)(lVar6 + 100) = 1;
*param_4 = iVar2 + 1;
LAB_00101c2d:
param_2 = param_2 + 1;
param_1 = param_1 + 1;
} while (param_2 != puVar1);
}
if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar4;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
7,012 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int first;
int second;
} Pair;
| Pair *func0(Pair test_list[], int size) {
Pair *res = (Pair*)malloc(sizeof(Pair) * size * (size - 1) / 2);
int index = 0;
for (int i = 0; i < size; i++) {
for (int j = i + 1; j < size; j++) {
res[index].first = test_list[i].first + test_list[j].first;
res[index].second = test_list[i].second + test_list[j].second;
index++;
}
}
return res;
}
| int main() {
Pair test1[] = {{2, 4}, {6, 7}, {5, 1}, {6, 10}};
Pair test2[] = {{3, 5}, {7, 8}, {6, 2}, {7, 11}};
Pair test3[] = {{4, 6}, {8, 9}, {7, 3}, {8, 12}};
Pair *result1 = func0(test1, 4);
Pair expected1[] = {{8, 11}, {7, 5}, {8, 14}, {11, 8}, {12, 17}, {11, 11}};
for (int i = 0; i < 6; i++)
assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second);
Pair *result2 = func0(test2, 4);
Pair expected2[] = {{10, 13}, {9, 7}, {10, 16}, {13, 10}, {14, 19}, {13, 13}};
for (int i = 0; i < 6; i++)
assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second);
Pair *result3 = func0(test3, 4);
Pair expected3[] = {{12, 15}, {11, 9}, {12, 18}, {15, 12}, {16, 21}, {15, 15}};
for (int i = 0; i < 6; i++)
assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second);
free(result1);
free(result2);
free(result3);
printf("All tests passed successfully.\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x30,%rsp
mov %rdi,-0x28(%rbp)
mov %esi,-0x2c(%rbp)
mov -0x2c(%rbp),%eax
movslq %eax,%rdx
mov -0x2c(%rbp),%eax
sub $0x1,%eax
cltq
imul %rdx,%rax
shl $0x3,%rax
shr %rax
mov %rax,%rdi
callq 10d0 <malloc@plt>
mov %rax,-0x8(%rbp)
movl $0x0,-0x14(%rbp)
movl $0x0,-0x10(%rbp)
jmpq 12c5 <func0+0xfc>
mov -0x10(%rbp),%eax
add $0x1,%eax
mov %eax,-0xc(%rbp)
jmpq 12b5 <func0+0xec>
mov -0x10(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
mov (%rax),%ecx
mov -0xc(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
mov (%rax),%edx
mov -0x14(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rsi
mov -0x8(%rbp),%rax
add %rsi,%rax
add %ecx,%edx
mov %edx,(%rax)
mov -0x10(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
mov 0x4(%rax),%ecx
mov -0xc(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rdx
mov -0x28(%rbp),%rax
add %rdx,%rax
mov 0x4(%rax),%edx
mov -0x14(%rbp),%eax
cltq
lea 0x0(,%rax,8),%rsi
mov -0x8(%rbp),%rax
add %rsi,%rax
add %ecx,%edx
mov %edx,0x4(%rax)
addl $0x1,-0x14(%rbp)
addl $0x1,-0xc(%rbp)
mov -0xc(%rbp),%eax
cmp -0x2c(%rbp),%eax
jl 1222 <func0+0x59>
addl $0x1,-0x10(%rbp)
mov -0x10(%rbp),%eax
cmp -0x2c(%rbp),%eax
jl 1214 <func0+0x4b>
mov -0x8(%rbp),%rax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 30h
mov [rbp+var_28], rdi
mov [rbp+var_2C], esi
mov eax, [rbp+var_2C]
movsxd rdx, eax
mov eax, [rbp+var_2C]
sub eax, 1
cdqe
imul rax, rdx
shl rax, 3
shr rax, 1
mov rdi, rax; size
call _malloc
mov [rbp+var_8], rax
mov [rbp+var_14], 0
mov [rbp+var_10], 0
jmp loc_12C5
loc_1214:
mov eax, [rbp+var_10]
add eax, 1
mov [rbp+var_C], eax
jmp loc_12B5
loc_1222:
mov eax, [rbp+var_10]
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_28]
add rax, rdx
mov ecx, [rax]
mov eax, [rbp+var_C]
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_28]
add rax, rdx
mov edx, [rax]
mov eax, [rbp+var_14]
cdqe
lea rsi, ds:0[rax*8]
mov rax, [rbp+var_8]
add rax, rsi
add edx, ecx
mov [rax], edx
mov eax, [rbp+var_10]
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_28]
add rax, rdx
mov ecx, [rax+4]
mov eax, [rbp+var_C]
cdqe
lea rdx, ds:0[rax*8]
mov rax, [rbp+var_28]
add rax, rdx
mov edx, [rax+4]
mov eax, [rbp+var_14]
cdqe
lea rsi, ds:0[rax*8]
mov rax, [rbp+var_8]
add rax, rsi
add edx, ecx
mov [rax+4], edx
add [rbp+var_14], 1
add [rbp+var_C], 1
loc_12B5:
mov eax, [rbp+var_C]
cmp eax, [rbp+var_2C]
jl loc_1222
add [rbp+var_10], 1
loc_12C5:
mov eax, [rbp+var_10]
cmp eax, [rbp+var_2C]
jl loc_1214
mov rax, [rbp+var_8]
leave
retn | _DWORD * func0(long long a1, int a2)
{
int v3; // [rsp+1Ch] [rbp-14h]
int i; // [rsp+20h] [rbp-10h]
int j; // [rsp+24h] [rbp-Ch]
_DWORD *v6; // [rsp+28h] [rbp-8h]
v6 = malloc((unsigned long long)(8 * a2 * (long long)(a2 - 1)) >> 1);
v3 = 0;
for ( i = 0; i < a2; ++i )
{
for ( j = i + 1; j < a2; ++j )
{
v6[2 * v3] = *(_DWORD *)(8LL * i + a1) + *(_DWORD *)(8LL * j + a1);
v6[2 * v3++ + 1] = *(_DWORD *)(8LL * i + a1 + 4) + *(_DWORD *)(8LL * j + a1 + 4);
}
}
return v6;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x30
MOV qword ptr [RBP + -0x28],RDI
MOV dword ptr [RBP + -0x2c],ESI
MOV EAX,dword ptr [RBP + -0x2c]
MOVSXD RDX,EAX
MOV EAX,dword ptr [RBP + -0x2c]
SUB EAX,0x1
CDQE
IMUL RAX,RDX
SHL RAX,0x3
SHR RAX,0x1
MOV RDI,RAX
CALL 0x001010d0
MOV qword ptr [RBP + -0x8],RAX
MOV dword ptr [RBP + -0x14],0x0
MOV dword ptr [RBP + -0x10],0x0
JMP 0x001012c5
LAB_00101214:
MOV EAX,dword ptr [RBP + -0x10]
ADD EAX,0x1
MOV dword ptr [RBP + -0xc],EAX
JMP 0x001012b5
LAB_00101222:
MOV EAX,dword ptr [RBP + -0x10]
CDQE
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOV ECX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0xc]
CDQE
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
MOV EAX,dword ptr [RBP + -0x14]
CDQE
LEA RSI,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x8]
ADD RAX,RSI
ADD EDX,ECX
MOV dword ptr [RAX],EDX
MOV EAX,dword ptr [RBP + -0x10]
CDQE
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOV ECX,dword ptr [RAX + 0x4]
MOV EAX,dword ptr [RBP + -0xc]
CDQE
LEA RDX,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x28]
ADD RAX,RDX
MOV EDX,dword ptr [RAX + 0x4]
MOV EAX,dword ptr [RBP + -0x14]
CDQE
LEA RSI,[RAX*0x8]
MOV RAX,qword ptr [RBP + -0x8]
ADD RAX,RSI
ADD EDX,ECX
MOV dword ptr [RAX + 0x4],EDX
ADD dword ptr [RBP + -0x14],0x1
ADD dword ptr [RBP + -0xc],0x1
LAB_001012b5:
MOV EAX,dword ptr [RBP + -0xc]
CMP EAX,dword ptr [RBP + -0x2c]
JL 0x00101222
ADD dword ptr [RBP + -0x10],0x1
LAB_001012c5:
MOV EAX,dword ptr [RBP + -0x10]
CMP EAX,dword ptr [RBP + -0x2c]
JL 0x00101214
MOV RAX,qword ptr [RBP + -0x8]
LEAVE
RET | void * func0(long param_1,int param_2)
{
void *pvVar1;
int local_1c;
int local_18;
int local_14;
pvVar1 = malloc((ulong)((long)(param_2 + -1) * (long)param_2 * 8) >> 1);
local_1c = 0;
for (local_18 = 0; local_14 = local_18, local_18 < param_2; local_18 = local_18 + 1) {
while (local_14 = local_14 + 1, local_14 < param_2) {
*(int *)((long)pvVar1 + (long)local_1c * 8) =
*(int *)(param_1 + (long)local_14 * 8) + *(int *)(param_1 + (long)local_18 * 8);
*(int *)((long)pvVar1 + (long)local_1c * 8 + 4) =
*(int *)(param_1 + (long)local_14 * 8 + 4) + *(int *)(param_1 + (long)local_18 * 8 + 4);
local_1c = local_1c + 1;
}
}
return pvVar1;
} |
7,013 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int first;
int second;
} Pair;
| Pair *func0(Pair test_list[], int size) {
Pair *res = (Pair*)malloc(sizeof(Pair) * size * (size - 1) / 2);
int index = 0;
for (int i = 0; i < size; i++) {
for (int j = i + 1; j < size; j++) {
res[index].first = test_list[i].first + test_list[j].first;
res[index].second = test_list[i].second + test_list[j].second;
index++;
}
}
return res;
}
| int main() {
Pair test1[] = {{2, 4}, {6, 7}, {5, 1}, {6, 10}};
Pair test2[] = {{3, 5}, {7, 8}, {6, 2}, {7, 11}};
Pair test3[] = {{4, 6}, {8, 9}, {7, 3}, {8, 12}};
Pair *result1 = func0(test1, 4);
Pair expected1[] = {{8, 11}, {7, 5}, {8, 14}, {11, 8}, {12, 17}, {11, 11}};
for (int i = 0; i < 6; i++)
assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second);
Pair *result2 = func0(test2, 4);
Pair expected2[] = {{10, 13}, {9, 7}, {10, 16}, {13, 10}, {14, 19}, {13, 13}};
for (int i = 0; i < 6; i++)
assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second);
Pair *result3 = func0(test3, 4);
Pair expected3[] = {{12, 15}, {11, 9}, {12, 18}, {15, 12}, {16, 21}, {15, 15}};
for (int i = 0; i < 6; i++)
assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second);
free(result1);
free(result2);
free(result3);
printf("All tests passed successfully.\n");
return 0;
}
| O1 | c | func0:
endbr64
push %r15
push %r14
push %r13
push %r12
push %rbp
push %rbx
sub $0x8,%rsp
mov %rdi,%rbp
mov %esi,%ebx
lea -0x1(%rsi),%edi
movslq %edi,%rdi
movslq %esi,%rax
imul %rax,%rdi
shl $0x3,%rdi
shr %rdi
callq 10d0 <malloc@plt>
mov %rax,%r12
test %ebx,%ebx
jle 1272 <func0+0xa9>
mov %rbp,%r10
mov $0x0,%r11d
mov $0x0,%eax
lea -0x1(%rbx),%r15d
lea 0x8(%r12),%r14
lea 0x1(%rbx),%r13d
add $0x1,%r11d
cmp %r11d,%ebx
je 1272 <func0+0xa9>
mov (%r10),%r9d
mov 0x4(%r10),%r8d
movslq %eax,%rsi
lea (%r12,%rsi,8),%rdx
mov %r11d,%ebp
mov %r15d,%ecx
sub %r11d,%ecx
add %rsi,%rcx
lea (%r14,%rcx,8),%rdi
mov %r10,%rcx
mov %r9d,%esi
add 0x8(%rcx),%esi
mov %esi,(%rdx)
mov %r8d,%esi
add 0xc(%rcx),%esi
mov %esi,0x4(%rdx)
add $0x8,%rcx
add $0x8,%rdx
cmp %rdi,%rdx
jne 1245 <func0+0x7c>
mov %r13d,%edx
sub %ebp,%edx
lea -0x1(%rax,%rdx,1),%eax
add $0x8,%r10
jmp 121b <func0+0x52>
mov %r12,%rax
add $0x8,%rsp
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
| func0:
endbr64
push r15
push r14
push r13
push r12
push rbp
push rbx
sub rsp, 8
mov rbp, rdi
mov ebx, esi
lea edi, [rsi-1]
movsxd rdi, edi
movsxd rax, esi
imul rdi, rax
shl rdi, 3
shr rdi, 1
call _malloc
mov r12, rax
test ebx, ebx
jle short loc_1272
mov r9, rbp
mov r10d, 0
mov r11d, 0
lea r15d, [rbx-1]
lea r14, [rax+8]
lea r13d, [rbx+1]
loc_121B:
add r10d, 1
cmp ebx, r10d
jz short loc_1272
mov r8d, [r9]
mov edi, [r9+4]
movsxd rcx, r11d
lea rax, [r12+rcx*8]
mov ebp, r10d
mov edx, r15d
sub edx, r10d
add rdx, rcx
lea rsi, [r14+rdx*8]
mov rdx, r9
loc_1245:
mov ecx, r8d
add ecx, [rdx+8]
mov [rax], ecx
mov ecx, edi
add ecx, [rdx+0Ch]
mov [rax+4], ecx
add rdx, 8
add rax, 8
cmp rax, rsi
jnz short loc_1245
mov eax, r13d
sub eax, ebp
lea r11d, [r11+rax-1]
add r9, 8
jmp short loc_121B
loc_1272:
mov rax, r12
add rsp, 8
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn | long long func0(_DWORD *a1, int a2)
{
long long v2; // rax
long long v3; // r12
int v5; // r10d
int v6; // r11d
long long v7; // r14
int v8; // r8d
int v9; // edi
_DWORD *v10; // rax
_DWORD *v11; // rdx
v2 = malloc((unsigned long long)(8 * a2 * (long long)(a2 - 1)) >> 1);
v3 = v2;
if ( a2 > 0 )
{
v5 = 0;
v6 = 0;
v7 = v2 + 8;
while ( a2 != ++v5 )
{
v8 = *a1;
v9 = a1[1];
v10 = (_DWORD *)(v3 + 8LL * v6);
v11 = a1;
do
{
*v10 = v11[2] + v8;
v10[1] = v11[3] + v9;
v11 += 2;
v10 += 2;
}
while ( v10 != (_DWORD *)(v7 + 8 * (v6 + (unsigned long long)(unsigned int)(a2 - 1 - v5))) );
v6 += a2 - v5;
a1 += 2;
}
}
return v3;
} | func0:
ENDBR64
PUSH R15
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0x8
MOV RBP,RDI
MOV EBX,ESI
LEA EDI,[RSI + -0x1]
MOVSXD RDI,EDI
MOVSXD RAX,ESI
IMUL RDI,RAX
SHL RDI,0x3
SHR RDI,0x1
CALL 0x001010d0
MOV R12,RAX
TEST EBX,EBX
JLE 0x00101272
MOV R9,RBP
MOV R10D,0x0
MOV R11D,0x0
LEA R15D,[RBX + -0x1]
LEA R14,[RAX + 0x8]
LEA R13D,[RBX + 0x1]
LAB_0010121b:
ADD R10D,0x1
CMP EBX,R10D
JZ 0x00101272
MOV R8D,dword ptr [R9]
MOV EDI,dword ptr [R9 + 0x4]
MOVSXD RCX,R11D
LEA RAX,[R12 + RCX*0x8]
MOV EBP,R10D
MOV EDX,R15D
SUB EDX,R10D
ADD RDX,RCX
LEA RSI,[R14 + RDX*0x8]
MOV RDX,R9
LAB_00101245:
MOV ECX,R8D
ADD ECX,dword ptr [RDX + 0x8]
MOV dword ptr [RAX],ECX
MOV ECX,EDI
ADD ECX,dword ptr [RDX + 0xc]
MOV dword ptr [RAX + 0x4],ECX
ADD RDX,0x8
ADD RAX,0x8
CMP RAX,RSI
JNZ 0x00101245
MOV EAX,R13D
SUB EAX,EBP
LEA R11D,[R11 + RAX*0x1 + -0x1]
ADD R9,0x8
JMP 0x0010121b
LAB_00101272:
MOV RAX,R12
ADD RSP,0x8
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET | void * func0(int *param_1,int param_2)
{
int iVar1;
int iVar2;
void *pvVar3;
int *piVar4;
int *piVar5;
int iVar6;
int iVar7;
pvVar3 = malloc((ulong)((long)(param_2 + -1) * (long)param_2 * 8) >> 1);
if (0 < param_2) {
iVar6 = 0;
iVar7 = 0;
while (iVar6 = iVar6 + 1, param_2 != iVar6) {
iVar1 = *param_1;
iVar2 = param_1[1];
piVar4 = (int *)((long)pvVar3 + (long)iVar7 * 8);
piVar5 = param_1;
do {
*piVar4 = iVar1 + piVar5[2];
piVar4[1] = iVar2 + piVar5[3];
piVar5 = piVar5 + 2;
piVar4 = piVar4 + 2;
} while (piVar4 != (int *)((long)pvVar3 +
((ulong)(uint)((param_2 + -1) - iVar6) + (long)iVar7) * 8 + 8));
iVar7 = iVar7 + (param_2 - iVar6);
param_1 = param_1 + 2;
}
}
return pvVar3;
} |
7,014 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int first;
int second;
} Pair;
| Pair *func0(Pair test_list[], int size) {
Pair *res = (Pair*)malloc(sizeof(Pair) * size * (size - 1) / 2);
int index = 0;
for (int i = 0; i < size; i++) {
for (int j = i + 1; j < size; j++) {
res[index].first = test_list[i].first + test_list[j].first;
res[index].second = test_list[i].second + test_list[j].second;
index++;
}
}
return res;
}
| int main() {
Pair test1[] = {{2, 4}, {6, 7}, {5, 1}, {6, 10}};
Pair test2[] = {{3, 5}, {7, 8}, {6, 2}, {7, 11}};
Pair test3[] = {{4, 6}, {8, 9}, {7, 3}, {8, 12}};
Pair *result1 = func0(test1, 4);
Pair expected1[] = {{8, 11}, {7, 5}, {8, 14}, {11, 8}, {12, 17}, {11, 11}};
for (int i = 0; i < 6; i++)
assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second);
Pair *result2 = func0(test2, 4);
Pair expected2[] = {{10, 13}, {9, 7}, {10, 16}, {13, 10}, {14, 19}, {13, 13}};
for (int i = 0; i < 6; i++)
assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second);
Pair *result3 = func0(test3, 4);
Pair expected3[] = {{12, 15}, {11, 9}, {12, 18}, {15, 12}, {16, 21}, {15, 15}};
for (int i = 0; i < 6; i++)
assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second);
free(result1);
free(result2);
free(result3);
printf("All tests passed successfully.\n");
return 0;
}
| O2 | c | func0:
endbr64
movslq %esi,%rax
push %r14
push %r13
mov %rdi,%r13
push %r12
push %rbp
lea -0x1(%rax),%ebp
movslq %ebp,%rdi
push %rbx
mov %rax,%rbx
imul %rax,%rdi
shl $0x3,%rdi
shr %rdi
callq 10d0 <malloc@plt>
mov %rax,%r12
test %ebx,%ebx
jle 1603 <func0+0xa3>
xor %eax,%eax
mov %r13,%r11
lea 0x8(%r12),%r14
xor %esi,%esi
add $0x1,%eax
lea 0x1(%rbx),%r13d
cmp %eax,%ebx
je 1603 <func0+0xa3>
nopl 0x0(%rax)
mov %ebp,%ecx
movslq %esi,%rdi
mov (%r11),%r10d
mov 0x4(%r11),%r9d
sub %eax,%ecx
lea (%r12,%rdi,8),%rdx
add %rdi,%rcx
lea (%r14,%rcx,8),%r8
mov %r11,%rcx
nopl 0x0(%rax)
mov 0x8(%rcx),%edi
add $0x8,%rdx
add $0x8,%rcx
add %r10d,%edi
mov %edi,-0x8(%rdx)
mov 0x4(%rcx),%edi
add %r9d,%edi
mov %edi,-0x4(%rdx)
cmp %r8,%rdx
jne 15d0 <func0+0x70>
mov %r13d,%edx
add $0x8,%r11
sub %eax,%edx
add $0x1,%eax
lea -0x1(%rsi,%rdx,1),%esi
cmp %eax,%ebx
jne 15b0 <func0+0x50>
pop %rbx
mov %r12,%rax
pop %rbp
pop %r12
pop %r13
pop %r14
retq
| func0:
endbr64
movsxd rax, esi
push r14
push r13
mov r13, rdi
push r12
push rbp
lea ebp, [rax-1]
movsxd rdi, ebp
push rbx
mov rbx, rax
imul rdi, rax
shl rdi, 3
shr rdi, 1
call _malloc
mov r12, rax
test ebx, ebx
jle short loc_1606
xor r10d, r10d
mov r9, r13
lea r14, [rax+8]
xor r11d, r11d
add r10d, 1
lea r13d, [rbx+1]
cmp ebx, r10d
jz short loc_1606
nop dword ptr [rax+00h]
loc_15B0:
mov edx, ebp
movsxd rcx, r11d
mov r8d, [r9]
mov edi, [r9+4]
sub edx, r10d
lea rax, [r12+rcx*8]
add rdx, rcx
lea rsi, [r14+rdx*8]
mov rdx, r9
nop dword ptr [rax]
loc_15D0:
mov ecx, [rdx+8]
add rax, 8
add rdx, 8
add ecx, r8d
mov [rax-8], ecx
mov ecx, [rdx+4]
add ecx, edi
mov [rax-4], ecx
cmp rax, rsi
jnz short loc_15D0
mov eax, r13d
add r9, 8
sub eax, r10d
add r10d, 1
lea r11d, [r11+rax-1]
cmp ebx, r10d
jnz short loc_15B0
loc_1606:
pop rbx
mov rax, r12
pop rbp
pop r12
pop r13
pop r14
retn | long long func0(_DWORD *a1, int a2)
{
long long v2; // rax
long long v3; // r12
long long v5; // r14
int v6; // r11d
int i; // r10d
int v8; // r8d
int v9; // edi
long long v10; // rax
_DWORD *v11; // rdx
int v12; // ecx
int v13; // eax
v2 = malloc((unsigned long long)(8 * a2 * (long long)(a2 - 1)) >> 1);
v3 = v2;
if ( a2 > 0 )
{
v5 = v2 + 8;
v6 = 0;
for ( i = 1; a2 != i; v6 = v6 + v13 - 1 )
{
v8 = *a1;
v9 = a1[1];
v10 = v3 + 8LL * v6;
v11 = a1;
do
{
v12 = v11[2];
v10 += 8LL;
v11 += 2;
*(_DWORD *)(v10 - 8) = v8 + v12;
*(_DWORD *)(v10 - 4) = v9 + v11[1];
}
while ( v10 != v5 + 8 * (v6 + (unsigned long long)(unsigned int)(a2 - 1 - i)) );
a1 += 2;
v13 = a2 + 1 - i++;
}
}
return v3;
} | func0:
ENDBR64
MOVSXD RAX,ESI
PUSH R14
PUSH R13
MOV R13,RDI
PUSH R12
PUSH RBP
LEA EBP,[RAX + -0x1]
MOVSXD RDI,EBP
PUSH RBX
MOV RBX,RAX
IMUL RDI,RAX
SHL RDI,0x3
SHR RDI,0x1
CALL 0x001010d0
MOV R12,RAX
TEST EBX,EBX
JLE 0x00101606
XOR R10D,R10D
MOV R9,R13
LEA R14,[RAX + 0x8]
XOR R11D,R11D
ADD R10D,0x1
LEA R13D,[RBX + 0x1]
CMP EBX,R10D
JZ 0x00101606
NOP dword ptr [RAX]
LAB_001015b0:
MOV EDX,EBP
MOVSXD RCX,R11D
MOV R8D,dword ptr [R9]
MOV EDI,dword ptr [R9 + 0x4]
SUB EDX,R10D
LEA RAX,[R12 + RCX*0x8]
ADD RDX,RCX
LEA RSI,[R14 + RDX*0x8]
MOV RDX,R9
NOP dword ptr [RAX]
LAB_001015d0:
MOV ECX,dword ptr [RDX + 0x8]
ADD RAX,0x8
ADD RDX,0x8
ADD ECX,R8D
MOV dword ptr [RAX + -0x8],ECX
MOV ECX,dword ptr [RDX + 0x4]
ADD ECX,EDI
MOV dword ptr [RAX + -0x4],ECX
CMP RAX,RSI
JNZ 0x001015d0
MOV EAX,R13D
ADD R9,0x8
SUB EAX,R10D
ADD R10D,0x1
LEA R11D,[R11 + RAX*0x1 + -0x1]
CMP EBX,R10D
JNZ 0x001015b0
LAB_00101606:
POP RBX
MOV RAX,R12
POP RBP
POP R12
POP R13
POP R14
RET | void * func0(int *param_1,int param_2)
{
int iVar1;
int iVar2;
void *pvVar3;
int *piVar4;
int *piVar5;
int *piVar6;
int iVar7;
int iVar8;
pvVar3 = malloc((ulong)((long)(param_2 + -1) * (long)param_2 * 8) >> 1);
if (0 < param_2) {
iVar8 = 0;
iVar7 = 1;
if (param_2 != 1) {
do {
iVar2 = *param_1;
iVar1 = param_1[1];
piVar4 = (int *)((long)pvVar3 + (long)iVar8 * 8);
piVar6 = param_1;
do {
piVar5 = piVar4 + 2;
*piVar4 = piVar6[2] + iVar2;
piVar4[1] = piVar6[3] + iVar1;
piVar4 = piVar5;
piVar6 = piVar6 + 2;
} while (piVar5 != (int *)((long)pvVar3 +
((ulong)(uint)((param_2 + -1) - iVar7) + (long)iVar8) * 8 + 8));
param_1 = param_1 + 2;
iVar2 = param_2 - iVar7;
iVar7 = iVar7 + 1;
iVar8 = iVar8 + iVar2;
} while (param_2 != iVar7);
}
}
return pvVar3;
} |
7,015 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct {
int first;
int second;
} Pair;
| Pair *func0(Pair test_list[], int size) {
Pair *res = (Pair*)malloc(sizeof(Pair) * size * (size - 1) / 2);
int index = 0;
for (int i = 0; i < size; i++) {
for (int j = i + 1; j < size; j++) {
res[index].first = test_list[i].first + test_list[j].first;
res[index].second = test_list[i].second + test_list[j].second;
index++;
}
}
return res;
}
| int main() {
Pair test1[] = {{2, 4}, {6, 7}, {5, 1}, {6, 10}};
Pair test2[] = {{3, 5}, {7, 8}, {6, 2}, {7, 11}};
Pair test3[] = {{4, 6}, {8, 9}, {7, 3}, {8, 12}};
Pair *result1 = func0(test1, 4);
Pair expected1[] = {{8, 11}, {7, 5}, {8, 14}, {11, 8}, {12, 17}, {11, 11}};
for (int i = 0; i < 6; i++)
assert(result1[i].first == expected1[i].first && result1[i].second == expected1[i].second);
Pair *result2 = func0(test2, 4);
Pair expected2[] = {{10, 13}, {9, 7}, {10, 16}, {13, 10}, {14, 19}, {13, 13}};
for (int i = 0; i < 6; i++)
assert(result2[i].first == expected2[i].first && result2[i].second == expected2[i].second);
Pair *result3 = func0(test3, 4);
Pair expected3[] = {{12, 15}, {11, 9}, {12, 18}, {15, 12}, {16, 21}, {15, 15}};
for (int i = 0; i < 6; i++)
assert(result3[i].first == expected3[i].first && result3[i].second == expected3[i].second);
free(result1);
free(result2);
free(result3);
printf("All tests passed successfully.\n");
return 0;
}
| O3 | c | func0:
endbr64
movslq %esi,%rax
push %r14
push %r13
push %r12
lea -0x1(%rax),%r12d
push %rbp
mov %rax,%rbp
push %rbx
mov %rdi,%rbx
movslq %r12d,%rdi
imul %rax,%rdi
shl $0x3,%rdi
shr %rdi
callq 10d0 <malloc@plt>
cmp $0x1,%ebp
jle 16cb <func0+0xfb>
mov %r12d,%r10d
lea 0x8(%rbx),%r8
xor %esi,%esi
mov $0x1,%r9d
mov $0x1,%r11d
nopw 0x0(%rax,%rax,1)
cmp %r9d,%ebp
mov %r11d,%r13d
mov -0x8(%r8),%edi
mov -0x4(%r8),%ecx
cmovg %r10d,%r13d
jle 16d4 <func0+0x104>
cmp $0x1,%r10d
je 16d4 <func0+0x104>
movd %edi,%xmm1
movd %ecx,%xmm2
mov %r13d,%r12d
movslq %esi,%rdx
punpckldq %xmm2,%xmm1
shr %r12d
lea (%rax,%rdx,8),%r14
xor %edx,%edx
punpcklqdq %xmm1,%xmm1
shl $0x4,%r12
nopl (%rax)
movdqu (%r8,%rdx,1),%xmm0
paddd %xmm1,%xmm0
movups %xmm0,(%r14,%rdx,1)
add $0x10,%rdx
cmp %rdx,%r12
jne 1668 <func0+0x98>
mov %r13d,%r14d
and $0xfffffffe,%r14d
lea (%rsi,%r14,1),%edx
lea (%r9,%r14,1),%r12d
cmp %r14d,%r13d
je 16b3 <func0+0xe3>
movslq %r12d,%r12
movslq %edx,%rdx
lea (%rbx,%r12,8),%r13
lea (%rax,%rdx,8),%r12
add 0x0(%r13),%edi
add 0x4(%r13),%ecx
mov %edi,(%r12)
mov %ecx,0x4(%r12)
add $0x1,%r9d
add %r10d,%esi
add $0x8,%r8
sub $0x1,%r10d
cmp %r9d,%ebp
jne 1620 <func0+0x50>
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
retq
mov %r9d,%r12d
mov %esi,%edx
jmp 1694 <func0+0xc4>
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
movsxd rax, esi
push r14
push r13
lea r13d, [rax-1]
push r12
mov r12, rax
push rbp
mov rbp, rdi
movsxd rdi, r13d
imul rdi, rax
push rbx
shl rdi, 3
shr rdi, 1; size
call _malloc
mov rbx, rax
test r12d, r12d
jle loc_1539
cmp r12d, 1
jz loc_1539
mov r8d, r13d
lea rcx, [rbp+8]
mov r14d, r12d
mov r9d, 1
xor r11d, r11d
mov r13d, 1
nop dword ptr [rax+rax+00h]
loc_14C0:
cmp r12d, r9d
mov esi, r13d
movq xmm2, qword ptr [rcx-8]
cmovg esi, r8d
jle short loc_1545
cmp r8d, 1
jz short loc_1545
mov edx, esi
movdqa xmm1, xmm2
movsxd r10, r11d
xor eax, eax
shr edx, 1
punpcklqdq xmm1, xmm2
lea rdi, [rbx+r10*8]
shl rdx, 4
loc_14F0:
movdqu xmm0, xmmword ptr [rcx+rax]
paddd xmm0, xmm1
movups xmmword ptr [rdi+rax], xmm0
add rax, 10h
cmp rdx, rax
jnz short loc_14F0
test sil, 1
jz short loc_1525
and esi, 0FFFFFFFEh
loc_150F:
add r10, rsi
add rsi, r9
movq xmm0, qword ptr [rbp+rsi*8+0]
paddd xmm0, xmm2
movq qword ptr [rbx+r10*8], xmm0
loc_1525:
add r9, 1
add r11d, r8d
add rcx, 8
sub r8d, 1
cmp r14, r9
jnz short loc_14C0
loc_1539:
mov rax, rbx
pop rbx
pop rbp
pop r12
pop r13
pop r14
retn
loc_1545:
xor esi, esi
movsxd r10, r11d
jmp short loc_150F | _QWORD * func0(long long a1, int a2)
{
_QWORD *v3; // rbx
unsigned int v4; // r8d
long long v5; // rcx
long long v6; // r9
int v7; // r11d
__m128i v8; // xmm2
long long v9; // r10
long long v10; // rax
__m128i v11; // xmm1
long long v12; // rsi
v3 = malloc((unsigned long long)(8 * a2 * (long long)(a2 - 1)) >> 1);
if ( a2 >= 2 )
{
v4 = a2 - 1;
v5 = a1 + 8;
v6 = 1LL;
v7 = 0;
do
{
v8 = _mm_loadl_epi64((const __m128i *)(v5 - 8));
if ( a2 <= (int)v6 || v4 == 1 )
{
v12 = 0LL;
v9 = v7;
}
else
{
v9 = v7;
v10 = 0LL;
v11 = _mm_unpacklo_epi64(v8, v8);
do
{
*(__m128i *)&v3[v7 + v10] = _mm_add_epi32(_mm_loadu_si128((const __m128i *)(v5 + v10 * 8)), v11);
v10 += 2LL;
}
while ( 2LL * (v4 >> 1) != v10 );
if ( (v4 & 1) == 0 )
goto LABEL_10;
v12 = v4 & 0xFFFFFFFE;
}
v3[v12 + v9] = _mm_add_epi32(_mm_loadl_epi64((const __m128i *)(a1 + 8 * (v6 + v12))), v8).m128i_u64[0];
LABEL_10:
++v6;
v7 += v4;
v5 += 8LL;
--v4;
}
while ( a2 != v6 );
}
return v3;
} | func0:
ENDBR64
MOVSXD RAX,ESI
PUSH R14
PUSH R13
LEA R13D,[RAX + -0x1]
PUSH R12
MOV R12,RAX
PUSH RBP
MOV RBP,RDI
MOVSXD RDI,R13D
IMUL RDI,RAX
PUSH RBX
SHL RDI,0x3
SHR RDI,0x1
CALL 0x001010d0
MOV RBX,RAX
TEST R12D,R12D
JLE 0x00101539
CMP R12D,0x1
JZ 0x00101539
MOV R8D,R13D
LEA RCX,[RBP + 0x8]
MOV R14D,R12D
MOV R9D,0x1
XOR R11D,R11D
MOV R13D,0x1
NOP dword ptr [RAX + RAX*0x1]
LAB_001014c0:
CMP R12D,R9D
MOV ESI,R13D
MOVQ XMM2,qword ptr [RCX + -0x8]
CMOVG ESI,R8D
JLE 0x00101545
CMP R8D,0x1
JZ 0x00101545
MOV EDX,ESI
MOVDQA XMM1,XMM2
MOVSXD R10,R11D
XOR EAX,EAX
SHR EDX,0x1
PUNPCKLQDQ XMM1,XMM2
LEA RDI,[RBX + R10*0x8]
SHL RDX,0x4
LAB_001014f0:
MOVDQU XMM0,xmmword ptr [RCX + RAX*0x1]
PADDD XMM0,XMM1
MOVUPS xmmword ptr [RDI + RAX*0x1],XMM0
ADD RAX,0x10
CMP RDX,RAX
JNZ 0x001014f0
TEST SIL,0x1
JZ 0x00101525
AND ESI,0xfffffffe
LAB_0010150f:
ADD R10,RSI
ADD RSI,R9
MOVQ XMM0,qword ptr [RBP + RSI*0x8]
PADDD XMM0,XMM2
MOVQ qword ptr [RBX + R10*0x8],XMM0
LAB_00101525:
ADD R9,0x1
ADD R11D,R8D
ADD RCX,0x8
SUB R8D,0x1
CMP R14,R9
JNZ 0x001014c0
LAB_00101539:
MOV RAX,RBX
POP RBX
POP RBP
POP R12
POP R13
POP R14
RET
LAB_00101545:
XOR ESI,ESI
MOVSXD R10,R11D
JMP 0x0010150f | void * func0(long param_1,uint param_2)
{
int *piVar1;
int *piVar2;
int8 uVar3;
int iVar4;
int iVar5;
int iVar6;
void *pvVar7;
long lVar8;
long lVar9;
ulong uVar10;
ulong uVar11;
int iVar12;
uint uVar13;
int iVar14;
int iVar15;
uVar13 = param_2 - 1;
pvVar7 = malloc((ulong)((long)(int)uVar13 * (long)(int)param_2 * 8) >> 1);
if ((0 < (int)param_2) && (param_2 != 1)) {
lVar9 = param_1 + 8;
uVar11 = 1;
iVar12 = 0;
do {
uVar10 = 1;
if ((int)uVar11 < (int)param_2) {
uVar10 = (ulong)uVar13;
}
iVar14 = (int)*(int8 *)(lVar9 + -8);
iVar15 = (int)((ulong)*(int8 *)(lVar9 + -8) >> 0x20);
if (((int)uVar11 < (int)param_2) && (uVar13 != 1)) {
lVar8 = 0;
do {
piVar1 = (int *)(lVar9 + lVar8);
iVar4 = piVar1[1];
iVar5 = piVar1[2];
iVar6 = piVar1[3];
piVar2 = (int *)((long)pvVar7 + lVar8 + (long)iVar12 * 8);
*piVar2 = *piVar1 + iVar14;
piVar2[1] = iVar4 + iVar15;
piVar2[2] = iVar5 + iVar14;
piVar2[3] = iVar6 + iVar15;
lVar8 = lVar8 + 0x10;
} while ((uVar10 >> 1) << 4 != lVar8);
if ((uVar10 & 1) != 0) {
uVar10 = (ulong)((uint)uVar10 & 0xfffffffe);
goto LAB_0010150f;
}
}
else {
uVar10 = 0;
LAB_0010150f:
uVar3 = *(int8 *)(param_1 + (uVar10 + uVar11) * 8);
*(ulong *)((long)pvVar7 + ((long)iVar12 + uVar10) * 8) =
CONCAT44((int)((ulong)uVar3 >> 0x20) + iVar15,(int)uVar3 + iVar14);
}
uVar11 = uVar11 + 1;
iVar12 = iVar12 + uVar13;
lVar9 = lVar9 + 8;
uVar13 = uVar13 - 1;
} while (param_2 != uVar11);
}
return pvVar7;
} |
7,016 | func0 |
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
| char* func0(int n) {
int count = 0;
for (int i = 1; i < ((int)sqrt(n)) + 2; i++) {
if (n % i == 0) {
if (n / i == i) {
count++;
} else {
count += 2;
}
}
}
if (count % 2 == 0) {
return "Even";
} else {
return "Odd";
}
}
| int main() {
assert(strcmp(func0(10), "Even") == 0);
assert(strcmp(func0(100), "Odd") == 0);
assert(strcmp(func0(125), "Even") == 0);
printf("All test cases passed!\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x20,%rsp
mov %edi,-0x14(%rbp)
movl $0x0,-0x8(%rbp)
movl $0x1,-0x4(%rbp)
jmp 11ef <func0+0x46>
mov -0x14(%rbp),%eax
cltd
idivl -0x4(%rbp)
mov %edx,%eax
test %eax,%eax
jne 11eb <func0+0x42>
mov -0x14(%rbp),%eax
cltd
idivl -0x4(%rbp)
cmp %eax,-0x4(%rbp)
jne 11e7 <func0+0x3e>
addl $0x1,-0x8(%rbp)
jmp 11eb <func0+0x42>
addl $0x2,-0x8(%rbp)
addl $0x1,-0x4(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
callq 10b0 <sqrt@plt>
cvttsd2si %xmm0,%eax
add $0x1,%eax
cmp %eax,-0x4(%rbp)
jle 11c8 <func0+0x1f>
mov -0x8(%rbp),%eax
and $0x1,%eax
test %eax,%eax
jne 1218 <func0+0x6f>
lea 0xdf2(%rip),%rax
jmp 121f <func0+0x76>
lea 0xdee(%rip),%rax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 20h
mov [rbp+var_14], edi
mov [rbp+var_8], 0
mov [rbp+var_4], 1
jmp short loc_11EF
loc_11C8:
mov eax, [rbp+var_14]
cdq
idiv [rbp+var_4]
mov eax, edx
test eax, eax
jnz short loc_11EB
mov eax, [rbp+var_14]
cdq
idiv [rbp+var_4]
cmp [rbp+var_4], eax
jnz short loc_11E7
add [rbp+var_8], 1
jmp short loc_11EB
loc_11E7:
add [rbp+var_8], 2
loc_11EB:
add [rbp+var_4], 1
loc_11EF:
pxor xmm1, xmm1
cvtsi2sd xmm1, [rbp+var_14]
movq rax, xmm1
movq xmm0, rax; x
call _sqrt
cvttsd2si eax, xmm0
add eax, 1
cmp [rbp+var_4], eax
jle short loc_11C8
mov eax, [rbp+var_8]
and eax, 1
test eax, eax
jnz short loc_1226
lea rax, s2; "Even"
jmp short locret_122D
loc_1226:
lea rax, aOdd; "Odd"
locret_122D:
leave
retn | const char * func0(int a1)
{
int v2; // [rsp+18h] [rbp-8h]
int i; // [rsp+1Ch] [rbp-4h]
v2 = 0;
for ( i = 1; i <= (int)sqrt((double)a1) + 1; ++i )
{
if ( !(a1 % i) )
{
if ( i == a1 / i )
++v2;
else
v2 += 2;
}
}
if ( (v2 & 1) != 0 )
return "Odd";
else
return "Even";
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x20
MOV dword ptr [RBP + -0x14],EDI
MOV dword ptr [RBP + -0x8],0x0
MOV dword ptr [RBP + -0x4],0x1
JMP 0x001011ef
LAB_001011c8:
MOV EAX,dword ptr [RBP + -0x14]
CDQ
IDIV dword ptr [RBP + -0x4]
MOV EAX,EDX
TEST EAX,EAX
JNZ 0x001011eb
MOV EAX,dword ptr [RBP + -0x14]
CDQ
IDIV dword ptr [RBP + -0x4]
CMP dword ptr [RBP + -0x4],EAX
JNZ 0x001011e7
ADD dword ptr [RBP + -0x8],0x1
JMP 0x001011eb
LAB_001011e7:
ADD dword ptr [RBP + -0x8],0x2
LAB_001011eb:
ADD dword ptr [RBP + -0x4],0x1
LAB_001011ef:
PXOR XMM1,XMM1
CVTSI2SD XMM1,dword ptr [RBP + -0x14]
MOVQ RAX,XMM1
MOVQ XMM0,RAX
CALL 0x001010b0
CVTTSD2SI EAX,XMM0
ADD EAX,0x1
CMP dword ptr [RBP + -0x4],EAX
JLE 0x001011c8
MOV EAX,dword ptr [RBP + -0x8]
AND EAX,0x1
TEST EAX,EAX
JNZ 0x00101226
LEA RAX,[0x102008]
JMP 0x0010122d
LAB_00101226:
LEA RAX,[0x10200d]
LAB_0010122d:
LEAVE
RET | int * func0(int param_1)
{
byte bVar1;
int *puVar2;
double dVar3;
int local_c;
bVar1 = 0;
for (local_c = 1; dVar3 = sqrt((double)param_1), local_c <= (int)dVar3 + 1; local_c = local_c + 1)
{
if ((param_1 % local_c == 0) && (local_c == param_1 / local_c)) {
bVar1 = bVar1 + 1;
}
}
if ((bool)(bVar1 & 1)) {
puVar2 = &DAT_0010200d;
}
else {
puVar2 = &DAT_00102008;
}
return puVar2;
} |
7,017 | func0 |
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
| char* func0(int n) {
int count = 0;
for (int i = 1; i < ((int)sqrt(n)) + 2; i++) {
if (n % i == 0) {
if (n / i == i) {
count++;
} else {
count += 2;
}
}
}
if (count % 2 == 0) {
return "Even";
} else {
return "Odd";
}
}
| int main() {
assert(strcmp(func0(10), "Even") == 0);
assert(strcmp(func0(100), "Odd") == 0);
assert(strcmp(func0(125), "Even") == 0);
printf("All test cases passed!\n");
return 0;
}
| O1 | c | func0:
endbr64
push %r13
push %r12
push %rbp
push %rbx
sub $0x18,%rsp
mov %edi,%ebp
pxor %xmm3,%xmm3
cvtsi2sd %edi,%xmm3
movsd %xmm3,0x8(%rsp)
movapd %xmm3,%xmm0
sqrtsd %xmm0,%xmm0
cvttsd2si %xmm0,%r13d
add $0x1,%r13d
mov $0x1,%ebx
mov $0x0,%r12d
jmp 11c8 <func0+0x3f>
add $0x1,%ebx
pxor %xmm1,%xmm1
ucomisd 0x8(%rsp),%xmm1
ja 11fb <func0+0x72>
cmp %ebx,%r13d
jl 1208 <func0+0x7f>
mov %ebp,%eax
cltd
idiv %ebx
test %edx,%edx
jne 11c5 <func0+0x3c>
mov %ebp,%eax
cltd
idiv %ebx
mov %r12d,%edx
cmp %ebx,%eax
setne %r12b
movzbl %r12b,%r12d
lea 0x1(%r12,%rdx,1),%r12d
jmp 11c5 <func0+0x3c>
movsd 0x8(%rsp),%xmm0
callq 1090 <sqrt@plt>
jmp 11d4 <func0+0x4b>
test $0x1,%r12b
lea 0xdf1(%rip),%rax
lea 0xdef(%rip),%rdx
cmovne %rdx,%rax
add $0x18,%rsp
pop %rbx
pop %rbp
pop %r12
pop %r13
retq
| func0:
endbr64
push r12
push rbp
push rbx
mov ebp, edi
mov ebx, 1
mov r12d, 0
jmp short loc_11C3
loc_11C0:
add ebx, 1
loc_11C3:
pxor xmm0, xmm0
cvtsi2sd xmm0, ebp
pxor xmm1, xmm1
ucomisd xmm1, xmm0
ja short loc_1206
sqrtsd xmm0, xmm0
loc_11D9:
cvttsd2si eax, xmm0
add eax, 1
cmp eax, ebx
jl short loc_120D
mov eax, ebp
cdq
idiv ebx
test edx, edx
jnz short loc_11C0
mov eax, ebp
cdq
idiv ebx
mov edx, r12d
cmp eax, ebx
setnz r12b
movzx r12d, r12b
lea r12d, [r12+rdx+1]
jmp short loc_11C0
loc_1206:
call _sqrt
jmp short loc_11D9
loc_120D:
test r12b, 1
lea rax, aEven; "Even"
lea rdx, aOdd; "Odd"
cmovnz rax, rdx
pop rbx
pop rbp
pop r12
retn | const char * func0(int a1)
{
int v1; // ebx
char v2; // r12
double v3; // xmm0_8
double v4; // xmm0_8
const char *result; // rax
v1 = 1;
v2 = 0;
while ( 1 )
{
v3 = (double)a1;
v4 = (double)a1 < 0.0 ? sqrt(v3) : sqrt(v3);
if ( (int)v4 + 1 < v1 )
break;
if ( !(a1 % v1) )
v2 += (a1 / v1 != v1) + 1;
++v1;
}
result = "Even";
if ( (v2 & 1) != 0 )
return "Odd";
return result;
} | func0:
ENDBR64
PUSH R12
PUSH RBP
PUSH RBX
MOV EBP,EDI
MOV EBX,0x1
MOV R12D,0x0
JMP 0x001011c3
LAB_001011c0:
ADD EBX,0x1
LAB_001011c3:
PXOR XMM0,XMM0
CVTSI2SD XMM0,EBP
PXOR XMM1,XMM1
UCOMISD XMM1,XMM0
JA 0x00101206
SQRTSD XMM0,XMM0
LAB_001011d9:
CVTTSD2SI EAX,XMM0
ADD EAX,0x1
CMP EAX,EBX
JL 0x0010120d
MOV EAX,EBP
CDQ
IDIV EBX
TEST EDX,EDX
JNZ 0x001011c0
MOV EAX,EBP
CDQ
IDIV EBX
MOV EDX,R12D
CMP EAX,EBX
SETNZ R12B
MOVZX R12D,R12B
LEA R12D,[R12 + RDX*0x1 + 0x1]
JMP 0x001011c0
LAB_00101206:
CALL 0x001010b0
JMP 0x001011d9
LAB_0010120d:
TEST R12B,0x1
LEA RAX,[0x102004]
LEA RDX,[0x102009]
CMOVNZ RAX,RDX
POP RBX
POP RBP
POP R12
RET | int * func0(int param_1)
{
int *puVar1;
int iVar2;
byte bVar3;
double dVar4;
iVar2 = 1;
bVar3 = 0;
while( true ) {
dVar4 = (double)param_1;
if (dVar4 < 0.0) {
dVar4 = sqrt(dVar4);
}
else {
dVar4 = SQRT(dVar4);
}
if ((int)dVar4 + 1 < iVar2) break;
if (param_1 % iVar2 == 0) {
bVar3 = (param_1 / iVar2 == iVar2) + bVar3;
}
iVar2 = iVar2 + 1;
}
puVar1 = &DAT_00102004;
if ((bool)(bVar3 & 1)) {
puVar1 = &DAT_00102009;
}
return puVar1;
} |
7,018 | func0 |
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
| char* func0(int n) {
int count = 0;
for (int i = 1; i < ((int)sqrt(n)) + 2; i++) {
if (n % i == 0) {
if (n / i == i) {
count++;
} else {
count += 2;
}
}
}
if (count % 2 == 0) {
return "Even";
} else {
return "Odd";
}
}
| int main() {
assert(strcmp(func0(10), "Even") == 0);
assert(strcmp(func0(100), "Odd") == 0);
assert(strcmp(func0(125), "Even") == 0);
printf("All test cases passed!\n");
return 0;
}
| O2 | c | func0:
endbr64
pxor %xmm1,%xmm1
push %r12
pxor %xmm2,%xmm2
cvtsi2sd %edi,%xmm1
push %rbp
xor %ebp,%ebp
push %rbx
mov $0x1,%ebx
movapd %xmm1,%xmm0
sub $0x10,%rsp
sqrtsd %xmm0,%xmm0
cvttsd2si %xmm0,%r12d
add $0x1,%r12d
jmp 12c2 <func0+0x52>
nopw 0x0(%rax,%rax,1)
mov %edi,%eax
cltd
idiv %ebx
test %edx,%edx
jne 12bf <func0+0x4f>
mov %ebp,%edx
xor %ebp,%ebp
cmp %ebx,%eax
setne %bpl
lea 0x1(%rbp,%rdx,1),%ebp
add $0x1,%ebx
ucomisd %xmm1,%xmm2
ja 12eb <func0+0x7b>
cmp %ebx,%r12d
jge 12a8 <func0+0x38>
and $0x1,%ebp
lea 0xd2d(%rip),%rax
lea 0xd2b(%rip),%rdx
cmovne %rdx,%rax
add $0x10,%rsp
pop %rbx
pop %rbp
pop %r12
retq
movapd %xmm1,%xmm0
mov %edi,0xc(%rsp)
movsd %xmm1,(%rsp)
callq 1090 <sqrt@plt>
mov 0xc(%rsp),%edi
movsd (%rsp),%xmm1
pxor %xmm2,%xmm2
jmp 12c8 <func0+0x58>
nopl 0x0(%rax)
| func0:
endbr64
push rbp
pxor xmm1, xmm1
xor ebp, ebp
pxor xmm2, xmm2
push rbx
cvtsi2sd xmm1, edi
mov ebx, 1
sub rsp, 18h
jmp short loc_12BA
loc_12A0:
mov eax, edi
cdq
idiv ebx
test edx, edx
jnz short loc_12B7
mov edx, ebp
xor ebp, ebp
cmp eax, ebx
setnz bpl
lea ebp, [rbp+rdx+1]
loc_12B7:
add ebx, 1
loc_12BA:
ucomisd xmm2, xmm1
ja short loc_12EF
movapd xmm0, xmm1
sqrtsd xmm0, xmm0
loc_12C8:
cvttsd2si edx, xmm0
add edx, 1
cmp edx, ebx
jge short loc_12A0
and ebp, 1
lea rax, aEven; "Even"
lea rdx, aOdd; "Odd"
cmovnz rax, rdx
add rsp, 18h
pop rbx
pop rbp
retn
loc_12EF:
movapd xmm0, xmm1
mov [rsp+28h+var_1C], edi
movsd [rsp+28h+var_28], xmm1
call _sqrt
mov edi, [rsp+28h+var_1C]
movsd xmm1, [rsp+28h+var_28]
pxor xmm2, xmm2
jmp short loc_12C8 | const char * func0(int a1)
{
char v1; // bp
double v2; // xmm1_8
int i; // ebx
double v4; // xmm0_8
const char *result; // rax
v1 = 0;
v2 = (double)a1;
for ( i = 1; ; ++i )
{
v4 = v2 < 0.0 ? sqrt(v2) : sqrt(v2);
if ( (int)v4 + 1 < i )
break;
if ( !(a1 % i) )
v1 += (a1 / i != i) + 1;
}
result = "Even";
if ( (v1 & 1) != 0 )
return "Odd";
return result;
} | func0:
ENDBR64
PUSH RBP
PXOR XMM1,XMM1
XOR EBP,EBP
PXOR XMM2,XMM2
PUSH RBX
CVTSI2SD XMM1,EDI
MOV EBX,0x1
SUB RSP,0x18
JMP 0x001012ba
LAB_001012a0:
MOV EAX,EDI
CDQ
IDIV EBX
TEST EDX,EDX
JNZ 0x001012b7
MOV EDX,EBP
XOR EBP,EBP
CMP EAX,EBX
SETNZ BPL
LEA EBP,[RBP + RDX*0x1 + 0x1]
LAB_001012b7:
ADD EBX,0x1
LAB_001012ba:
UCOMISD XMM2,XMM1
JA 0x001012ef
MOVAPD XMM0,XMM1
SQRTSD XMM0,XMM0
LAB_001012c8:
CVTTSD2SI EDX,XMM0
ADD EDX,0x1
CMP EDX,EBX
JGE 0x001012a0
AND EBP,0x1
LEA RAX,[0x102004]
LEA RDX,[0x102009]
CMOVNZ RAX,RDX
ADD RSP,0x18
POP RBX
POP RBP
RET
LAB_001012ef:
MOVAPD XMM0,XMM1
MOV dword ptr [RSP + 0xc],EDI
MOVSD qword ptr [RSP],XMM1
CALL 0x001010b0
MOV EDI,dword ptr [RSP + 0xc]
MOVSD XMM1,qword ptr [RSP]
PXOR XMM2,XMM2
JMP 0x001012c8 | int * func0(int param_1)
{
int *puVar1;
int iVar2;
byte bVar3;
double dVar4;
double __x;
bVar3 = 0;
__x = (double)param_1;
iVar2 = 1;
while( true ) {
if (__x < 0.0) {
dVar4 = sqrt(__x);
}
else {
dVar4 = SQRT(__x);
}
if ((int)dVar4 + 1 < iVar2) break;
if (param_1 % iVar2 == 0) {
bVar3 = (param_1 / iVar2 == iVar2) + bVar3;
}
iVar2 = iVar2 + 1;
}
puVar1 = &DAT_00102004;
if ((bool)(bVar3 & 1)) {
puVar1 = &DAT_00102009;
}
return puVar1;
} |
7,019 | func0 |
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
| char* func0(int n) {
int count = 0;
for (int i = 1; i < ((int)sqrt(n)) + 2; i++) {
if (n % i == 0) {
if (n / i == i) {
count++;
} else {
count += 2;
}
}
}
if (count % 2 == 0) {
return "Even";
} else {
return "Odd";
}
}
| int main() {
assert(strcmp(func0(10), "Even") == 0);
assert(strcmp(func0(100), "Odd") == 0);
assert(strcmp(func0(125), "Even") == 0);
printf("All test cases passed!\n");
return 0;
}
| O3 | c | func0:
endbr64
pxor %xmm1,%xmm1
push %r12
cvtsi2sd %edi,%xmm1
push %rbp
push %rbx
movapd %xmm1,%xmm0
sub $0x10,%rsp
sqrtsd %xmm0,%xmm0
cvttsd2si %xmm0,%esi
pxor %xmm0,%xmm0
ucomisd %xmm1,%xmm0
lea 0x1(%rsi),%ebp
ja 12f3 <func0+0x83>
add $0x2,%esi
mov $0x1,%ecx
xor %ebx,%ebx
lea 0xd56(%rip),%rax
test %ebp,%ebp
jle 12ea <func0+0x7a>
nopw 0x0(%rax,%rax,1)
mov %edi,%eax
cltd
idiv %ecx
test %edx,%edx
jne 12ce <func0+0x5e>
mov %ebx,%edx
xor %ebx,%ebx
cmp %ecx,%eax
setne %bl
lea 0x1(%rbx,%rdx,1),%ebx
add $0x1,%ecx
cmp %esi,%ecx
jne 12b8 <func0+0x48>
and $0x1,%ebx
lea 0xd25(%rip),%rax
lea 0xd23(%rip),%rdx
cmovne %rdx,%rax
add $0x10,%rsp
pop %rbx
pop %rbp
pop %r12
retq
mov $0x1,%r12d
xor %ebx,%ebx
jmp 1322 <func0+0xb2>
mov 0xc(%rsp),%edi
movsd (%rsp),%xmm1
mov %edi,%eax
cltd
idiv %r12d
test %edx,%edx
jne 131e <func0+0xae>
mov %ebx,%edx
xor %ebx,%ebx
cmp %eax,%r12d
setne %bl
lea 0x1(%rbx,%rdx,1),%ebx
add $0x1,%r12d
movapd %xmm1,%xmm0
mov %edi,0xc(%rsp)
movsd %xmm1,(%rsp)
callq 1090 <sqrt@plt>
cmp %r12d,%ebp
jge 12fd <func0+0x8d>
jmp 12d5 <func0+0x65>
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
pxor xmm1, xmm1
push r12
pxor xmm0, xmm0
cvtsi2sd xmm1, edi
push rbp
sub rsp, 18h
ucomisd xmm0, xmm1
ja short loc_12FF
sqrtsd xmm1, xmm1
mov ecx, 1
xor ebp, ebp
cvttsd2si esi, xmm1
test esi, esi
jns short loc_12BA
jmp short loc_12F0
loc_12B8:
mov ecx, eax
loc_12BA:
mov eax, edi
cdq
idiv ecx
test edx, edx
jnz short loc_12D1
mov edx, ebp
xor ebp, ebp
cmp eax, ecx
setnz bpl
lea ebp, [rbp+rdx+1]
loc_12D1:
lea eax, [rcx+1]
cmp esi, ecx
jge short loc_12B8
loc_12D8:
and ebp, 1
lea rax, aOdd; "Odd"
jz short loc_12F0
add rsp, 18h
pop rbp
pop r12
retn
loc_12F0:
add rsp, 18h
lea rax, s2; "Even"
pop rbp
pop r12
retn
loc_12FF:
mov r12d, 1
xor ebp, ebp
jmp short loc_132F
loc_1309:
mov edi, [rsp+28h+var_1C]
movsd xmm1, [rsp+28h+var_28]
mov eax, edi
cdq
idiv r12d
test edx, edx
jnz short loc_132B
mov edx, ebp
xor ebp, ebp
cmp r12d, eax
setnz bpl
lea ebp, [rbp+rdx+1]
loc_132B:
add r12d, 1
loc_132F:
movapd xmm0, xmm1; x
mov [rsp+28h+var_1C], edi
movsd [rsp+28h+var_28], xmm1
call _sqrt
cvttsd2si eax, xmm0
add eax, 1
cmp r12d, eax
jle short loc_1309
jmp short loc_12D8 | const char * func0(int a1)
{
double v1; // xmm1_8
int v2; // ecx
char v3; // bp
int v4; // esi
const char *result; // rax
int v6; // r12d
v1 = (double)a1;
if ( (double)a1 < 0.0 )
{
v6 = 1;
v3 = 0;
while ( v6 <= (int)sqrt(v1) + 1 )
{
if ( !(a1 % v6) )
v3 += (v6 != a1 / v6) + 1;
++v6;
}
LABEL_8:
result = "Odd";
if ( (v3 & 1) != 0 )
return result;
return "Even";
}
v2 = 1;
v3 = 0;
v4 = (int)sqrt(v1);
if ( v4 >= 0 )
{
while ( 1 )
{
if ( !(a1 % v2) )
v3 += (a1 / v2 != v2) + 1;
if ( v4 < v2 )
break;
++v2;
}
goto LABEL_8;
}
return "Even";
} | func0:
ENDBR64
PXOR XMM1,XMM1
PUSH R12
PXOR XMM0,XMM0
CVTSI2SD XMM1,EDI
PUSH RBP
SUB RSP,0x18
UCOMISD XMM0,XMM1
JA 0x001012ff
SQRTSD XMM1,XMM1
MOV ECX,0x1
XOR EBP,EBP
CVTTSD2SI ESI,XMM1
TEST ESI,ESI
JNS 0x001012ba
JMP 0x001012f0
LAB_001012b8:
MOV ECX,EAX
LAB_001012ba:
MOV EAX,EDI
CDQ
IDIV ECX
TEST EDX,EDX
JNZ 0x001012d1
MOV EDX,EBP
XOR EBP,EBP
CMP EAX,ECX
SETNZ BPL
LEA EBP,[RBP + RDX*0x1 + 0x1]
LAB_001012d1:
LEA EAX,[RCX + 0x1]
CMP ESI,ECX
JGE 0x001012b8
LAB_001012d8:
AND EBP,0x1
LEA RAX,[0x102009]
JZ 0x001012f0
ADD RSP,0x18
POP RBP
POP R12
RET
LAB_001012f0:
ADD RSP,0x18
LEA RAX,[0x102004]
POP RBP
POP R12
RET
LAB_001012ff:
MOV R12D,0x1
XOR EBP,EBP
JMP 0x0010132f
LAB_00101309:
MOV EDI,dword ptr [RSP + 0xc]
MOVSD XMM1,qword ptr [RSP]
MOV EAX,EDI
CDQ
IDIV R12D
TEST EDX,EDX
JNZ 0x0010132b
MOV EDX,EBP
XOR EBP,EBP
CMP R12D,EAX
SETNZ BPL
LEA EBP,[RBP + RDX*0x1 + 0x1]
LAB_0010132b:
ADD R12D,0x1
LAB_0010132f:
MOVAPD XMM0,XMM1
MOV dword ptr [RSP + 0xc],EDI
MOVSD qword ptr [RSP],XMM1
CALL 0x001010b0
CVTTSD2SI EAX,XMM0
ADD EAX,0x1
CMP R12D,EAX
JLE 0x00101309
JMP 0x001012d8 | int * func0(int param_1)
{
bool bVar1;
byte bVar2;
int iVar3;
double dVar4;
double __x;
__x = (double)param_1;
if (__x < 0.0) {
bVar2 = 0;
for (iVar3 = 1; dVar4 = sqrt(__x), iVar3 <= (int)dVar4 + 1; iVar3 = iVar3 + 1) {
if (param_1 % iVar3 == 0) {
bVar2 = (iVar3 == param_1 / iVar3) + bVar2;
}
}
}
else {
bVar2 = 0;
iVar3 = 1;
if ((int)SQRT(__x) < 0) goto LAB_001012f0;
do {
if (param_1 % iVar3 == 0) {
bVar2 = param_1 / iVar3 == iVar3 ^ bVar2;
}
bVar1 = iVar3 <= (int)SQRT(__x);
iVar3 = iVar3 + 1;
} while (bVar1);
}
if ((bool)(bVar2 & 1)) {
return &DAT_00102009;
}
LAB_001012f0:
return &DAT_00102004;
} |
7,020 | func0 |
#include <assert.h>
| int func0(int arr[], int l) {
int Sum = 0;
for (int i = 0; i < l; i++) {
Sum += ((((i + 1) * (l - i) + 1) / 2) * arr[i]);
}
return Sum;
}
| int main() {
int arr1[] = {1, 2, 4};
int arr2[] = {1, 2, 1, 2};
int arr3[] = {1, 7};
assert(func0(arr1, 3) == 14);
assert(func0(arr2, 4) == 15);
assert(func0(arr3, 2) == 8);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
movl $0x0,-0x8(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11c5 <func0+0x5c>
mov -0x4(%rbp),%eax
lea 0x1(%rax),%edx
mov -0x1c(%rbp),%eax
sub -0x4(%rbp),%eax
imul %edx,%eax
add $0x1,%eax
mov %eax,%edx
shr $0x1f,%edx
add %edx,%eax
sar %eax
mov %eax,%ecx
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
imul %ecx,%eax
add %eax,-0x8(%rbp)
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 1188 <func0+0x1f>
mov -0x8(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_8], 0
mov [rbp+var_4], 0
jmp short loc_11C5
loc_1188:
mov eax, [rbp+var_4]
lea edx, [rax+1]
mov eax, [rbp+var_1C]
sub eax, [rbp+var_4]
imul eax, edx
add eax, 1
mov edx, eax
shr edx, 1Fh
add eax, edx
sar eax, 1
mov ecx, eax
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
imul eax, ecx
add [rbp+var_8], eax
add [rbp+var_4], 1
loc_11C5:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_1188
mov eax, [rbp+var_8]
pop rbp
retn | long long func0(long long a1, int a2)
{
unsigned int v3; // [rsp+14h] [rbp-8h]
int i; // [rsp+18h] [rbp-4h]
v3 = 0;
for ( i = 0; i < a2; ++i )
v3 += ((i + 1) * (a2 - i) + 1) / 2 * *(_DWORD *)(4LL * i + a1);
return v3;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x8],0x0
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011c5
LAB_00101188:
MOV EAX,dword ptr [RBP + -0x4]
LEA EDX,[RAX + 0x1]
MOV EAX,dword ptr [RBP + -0x1c]
SUB EAX,dword ptr [RBP + -0x4]
IMUL EAX,EDX
ADD EAX,0x1
MOV EDX,EAX
SHR EDX,0x1f
ADD EAX,EDX
SAR EAX,0x1
MOV ECX,EAX
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]
IMUL EAX,ECX
ADD dword ptr [RBP + -0x8],EAX
ADD dword ptr [RBP + -0x4],0x1
LAB_001011c5:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x00101188
MOV EAX,dword ptr [RBP + -0x8]
POP RBP
RET | int func0(long param_1,int param_2)
{
int4 local_10;
int4 local_c;
local_10 = 0;
for (local_c = 0; local_c < param_2; local_c = local_c + 1) {
local_10 = local_10 +
*(int *)(param_1 + (long)local_c * 4) *
(((param_2 - local_c) * (local_c + 1) + 1) / 2);
}
return local_10;
} |
7,021 | func0 |
#include <assert.h>
| int func0(int arr[], int l) {
int Sum = 0;
for (int i = 0; i < l; i++) {
Sum += ((((i + 1) * (l - i) + 1) / 2) * arr[i]);
}
return Sum;
}
| int main() {
int arr1[] = {1, 2, 4};
int arr2[] = {1, 2, 1, 2};
int arr3[] = {1, 7};
assert(func0(arr1, 3) == 14);
assert(func0(arr2, 4) == 15);
assert(func0(arr3, 2) == 8);
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 11af <func0+0x46>
lea -0x1(%rsi),%r9d
add $0x2,%r9
mov $0x1,%ecx
mov $0x0,%r8d
add $0x1,%esi
mov %esi,%eax
sub %ecx,%eax
imul %ecx,%eax
lea 0x1(%rax),%edx
mov %edx,%eax
shr $0x1f,%eax
add %edx,%eax
sar %eax
imul -0x4(%rdi,%rcx,4),%eax
add %eax,%r8d
add $0x1,%rcx
cmp %r9,%rcx
jne 1187 <func0+0x1e>
mov %r8d,%eax
retq
mov $0x0,%r8d
jmp 11ab <func0+0x42>
| func0:
endbr64
test esi, esi
jle short loc_11AB
lea r9d, [rsi+1]
mov ecx, 1
mov r8d, 0
add esi, 1
loc_1183:
mov edx, esi
sub edx, ecx
imul edx, ecx
add edx, 1
mov eax, edx
shr eax, 1Fh
add eax, edx
sar eax, 1
imul eax, [rdi+rcx*4-4]
add r8d, eax
add rcx, 1
cmp rcx, r9
jnz short loc_1183
loc_11A7:
mov eax, r8d
retn
loc_11AB:
mov r8d, 0
jmp short loc_11A7 | long long func0(long long a1, int a2)
{
long long v2; // r9
long long v3; // rcx
unsigned int v4; // r8d
int v5; // esi
if ( a2 <= 0 )
{
return 0;
}
else
{
v2 = (unsigned int)(a2 + 1);
v3 = 1LL;
v4 = 0;
v5 = a2 + 1;
do
{
v4 += *(_DWORD *)(a1 + 4 * v3 - 4) * (((int)v3 * (v5 - (int)v3) + 1) / 2);
++v3;
}
while ( v3 != v2 );
}
return v4;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001011ab
LEA R9D,[RSI + 0x1]
MOV ECX,0x1
MOV R8D,0x0
ADD ESI,0x1
LAB_00101183:
MOV EDX,ESI
SUB EDX,ECX
IMUL EDX,ECX
ADD EDX,0x1
MOV EAX,EDX
SHR EAX,0x1f
ADD EAX,EDX
SAR EAX,0x1
IMUL EAX,dword ptr [RDI + RCX*0x4 + -0x4]
ADD R8D,EAX
ADD RCX,0x1
CMP RCX,R9
JNZ 0x00101183
LAB_001011a7:
MOV EAX,R8D
RET
LAB_001011ab:
MOV R8D,0x0
JMP 0x001011a7 | int func0(long param_1,int param_2)
{
ulong uVar1;
int iVar2;
if (param_2 < 1) {
iVar2 = 0;
}
else {
uVar1 = 1;
iVar2 = 0;
do {
iVar2 = iVar2 + ((((param_2 + 1) - (int)uVar1) * (int)uVar1 + 1) / 2) *
*(int *)(param_1 + -4 + uVar1 * 4);
uVar1 = uVar1 + 1;
} while (uVar1 != param_2 + 1);
}
return iVar2;
} |
7,022 | func0 |
#include <assert.h>
| int func0(int arr[], int l) {
int Sum = 0;
for (int i = 0; i < l; i++) {
Sum += ((((i + 1) * (l - i) + 1) / 2) * arr[i]);
}
return Sum;
}
| int main() {
int arr1[] = {1, 2, 4};
int arr2[] = {1, 2, 1, 2};
int arr3[] = {1, 7};
assert(func0(arr1, 3) == 14);
assert(func0(arr2, 4) == 15);
assert(func0(arr3, 2) == 8);
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 1188 <func0+0x48>
lea -0x1(%rsi),%ecx
mov $0x1,%edx
xor %r8d,%r8d
add $0x1,%esi
add $0x2,%rcx
nopw 0x0(%rax,%rax,1)
mov %esi,%eax
sub %edx,%eax
imul %edx,%eax
add $0x1,%eax
sar %eax
imul -0x4(%rdi,%rdx,4),%eax
add $0x1,%rdx
add %eax,%r8d
cmp %rdx,%rcx
jne 1160 <func0+0x20>
mov %r8d,%eax
retq
nopl 0x0(%rax)
xor %r8d,%r8d
mov %r8d,%eax
retq
| func0:
endbr64
test esi, esi
jle short loc_12B8
lea ecx, [rsi+1]
mov edx, 1
xor r8d, r8d
mov rsi, rcx
nop word ptr [rax+rax+00000000h]
loc_1290:
mov eax, esi
sub eax, edx
imul eax, edx
add eax, 1
sar eax, 1
imul eax, [rdi+rdx*4-4]
add rdx, 1
add r8d, eax
cmp rcx, rdx
jnz short loc_1290
mov eax, r8d
retn
loc_12B8:
xor r8d, r8d
mov eax, r8d
retn | long long func0(long long a1, int a2)
{
long long v2; // rcx
long long v3; // rdx
unsigned int v4; // r8d
int v5; // esi
int v6; // eax
if ( a2 <= 0 )
return 0LL;
v2 = (unsigned int)(a2 + 1);
v3 = 1LL;
v4 = 0;
v5 = a2 + 1;
do
{
v6 = *(_DWORD *)(a1 + 4 * v3 - 4) * (((int)v3 * (v5 - (int)v3) + 1) >> 1);
++v3;
v4 += v6;
}
while ( v2 != v3 );
return v4;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001012b8
LEA ECX,[RSI + 0x1]
MOV EDX,0x1
XOR R8D,R8D
MOV RSI,RCX
NOP word ptr CS:[RAX + RAX*0x1]
LAB_00101290:
MOV EAX,ESI
SUB EAX,EDX
IMUL EAX,EDX
ADD EAX,0x1
SAR EAX,0x1
IMUL EAX,dword ptr [RDI + RDX*0x4 + -0x4]
ADD RDX,0x1
ADD R8D,EAX
CMP RCX,RDX
JNZ 0x00101290
MOV EAX,R8D
RET
LAB_001012b8:
XOR R8D,R8D
MOV EAX,R8D
RET | int func0(long param_1,int param_2)
{
long lVar1;
int iVar2;
ulong uVar3;
int iVar4;
if (0 < param_2) {
uVar3 = 1;
iVar4 = 0;
do {
iVar2 = (int)uVar3;
lVar1 = uVar3 * 4;
uVar3 = uVar3 + 1;
iVar4 = iVar4 + ((int)(((param_2 + 1U) - iVar2) * iVar2 + 1) >> 1) *
*(int *)(param_1 + -4 + lVar1);
} while (param_2 + 1U != uVar3);
return iVar4;
}
return 0;
} |
7,023 | func0 |
#include <assert.h>
| int func0(int arr[], int l) {
int Sum = 0;
for (int i = 0; i < l; i++) {
Sum += ((((i + 1) * (l - i) + 1) / 2) * arr[i]);
}
return Sum;
}
| int main() {
int arr1[] = {1, 2, 4};
int arr2[] = {1, 2, 1, 2};
int arr3[] = {1, 7};
assert(func0(arr1, 3) == 14);
assert(func0(arr2, 4) == 15);
assert(func0(arr3, 2) == 8);
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 12b0 <func0+0x170>
lea -0x1(%rsi),%eax
cmp $0x3,%eax
jbe 12b9 <func0+0x179>
mov %esi,%edx
movd %esi,%xmm5
pxor %xmm2,%xmm2
mov %rdi,%rax
shr $0x2,%edx
pshufd $0x0,%xmm5,%xmm6
movdqa 0xe9b(%rip),%xmm3
movdqa 0xea3(%rip),%xmm5
shl $0x4,%rdx
movdqa 0xea7(%rip),%xmm4
add %rdi,%rdx
nopl 0x0(%rax)
movdqa %xmm3,%xmm0
movdqa %xmm6,%xmm7
paddd %xmm5,%xmm3
add $0x10,%rax
movdqa %xmm0,%xmm1
psubd %xmm0,%xmm7
paddd %xmm4,%xmm1
movdqa %xmm1,%xmm0
psrlq $0x20,%xmm1
pmuludq %xmm7,%xmm0
psrlq $0x20,%xmm7
pmuludq %xmm7,%xmm1
movdqu -0x10(%rax),%xmm7
psrlq $0x20,%xmm7
pshufd $0x8,%xmm0,%xmm0
pshufd $0x8,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
movdqu -0x10(%rax),%xmm1
paddd %xmm4,%xmm0
psrad $0x1,%xmm0
pmuludq %xmm0,%xmm1
psrlq $0x20,%xmm0
pmuludq %xmm7,%xmm0
pshufd $0x8,%xmm1,%xmm1
pshufd $0x8,%xmm0,%xmm0
punpckldq %xmm0,%xmm1
paddd %xmm1,%xmm2
cmp %rdx,%rax
jne 1190 <func0+0x50>
movdqa %xmm2,%xmm0
mov %esi,%ecx
psrldq $0x8,%xmm0
and $0xfffffffc,%ecx
paddd %xmm0,%xmm2
movdqa %xmm2,%xmm0
psrldq $0x4,%xmm0
paddd %xmm0,%xmm2
movd %xmm2,%eax
test $0x3,%sil
je 12b8 <func0+0x178>
mov %esi,%edx
lea 0x1(%rcx),%r8d
movslq %ecx,%r9
sub %ecx,%edx
imul %r8d,%edx
add $0x1,%edx
sar %edx
imul (%rdi,%r9,4),%edx
add %edx,%eax
cmp %esi,%r8d
jge 12b2 <func0+0x172>
mov %esi,%edx
lea 0x2(%rcx),%r9d
sub %r8d,%edx
movslq %r8d,%r8
imul %r9d,%edx
sar %edx
imul (%rdi,%r8,4),%edx
add %edx,%eax
cmp %r9d,%esi
jle 12b2 <func0+0x172>
mov %esi,%edx
lea 0x3(%rcx),%r8d
sub %r9d,%edx
movslq %r9d,%r9
imul %r8d,%edx
add $0x1,%edx
sar %edx
imul (%rdi,%r9,4),%edx
add %edx,%eax
cmp %r8d,%esi
jle 12b2 <func0+0x172>
sub %r8d,%esi
add $0x4,%ecx
movslq %r8d,%r8
imul %ecx,%esi
sar %esi
imul (%rdi,%r8,4),%esi
add %esi,%eax
retq
xchg %ax,%ax
xor %eax,%eax
retq
nopl 0x0(%rax,%rax,1)
retq
xor %ecx,%ecx
xor %eax,%eax
jmpq 1239 <func0+0xf9>
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax)
| func0:
endbr64
mov edx, esi
test esi, esi
jle loc_12C0
lea eax, [rsi-1]
cmp eax, 2
jbe loc_12C9
mov ecx, esi
movd xmm5, esi
pxor xmm2, xmm2
mov rax, rdi
shr ecx, 2
movdqa xmm3, cs:xmmword_2010
movdqa xmm6, cs:xmmword_2020
pshufd xmm7, xmm5, 0
shl rcx, 4
movdqa xmm4, cs:xmmword_2030
movdqa xmm5, xmm2
add rcx, rdi
nop word ptr [rax+rax+00h]
loc_1198:
movdqa xmm0, xmm3
movdqa xmm8, xmm7
paddd xmm3, xmm6
add rax, 10h
movdqa xmm1, xmm0
psubd xmm8, xmm0
paddd xmm1, xmm4
movdqa xmm0, xmm1
psrlq xmm1, 20h ; ' '
pmuludq xmm0, xmm8
psrlq xmm8, 20h ; ' '
pmuludq xmm1, xmm8
movdqu xmm8, xmmword ptr [rax-10h]
psrlq xmm8, 20h ; ' '
pshufd xmm0, xmm0, 8
pshufd xmm1, xmm1, 8
punpckldq xmm0, xmm1
movdqa xmm1, xmm5
paddd xmm0, xmm4
pcmpgtd xmm1, xmm0
psubd xmm0, xmm1
movdqu xmm1, xmmword ptr [rax-10h]
psrad xmm0, 1
pmuludq xmm1, xmm0
psrlq xmm0, 20h ; ' '
pmuludq xmm0, xmm8
pshufd xmm1, xmm1, 8
pshufd xmm0, xmm0, 8
punpckldq xmm1, xmm0
paddd xmm2, xmm1
cmp rcx, rax
jnz loc_1198
movdqa xmm0, xmm2
mov esi, edx
psrldq xmm0, 8
and esi, 0FFFFFFFCh
paddd xmm2, xmm0
movdqa xmm0, xmm2
psrldq xmm0, 4
paddd xmm2, xmm0
movd eax, xmm2
test dl, 3
jz short locret_12C8
loc_1254:
mov r9d, edx
lea r10d, [rsi+1]
movsxd r11, esi
sub r9d, esi
lea r8, ds:0[r11*4]
imul r9d, r10d
add r9d, 1
mov ecx, r9d
shr ecx, 1Fh
add ecx, r9d
sar ecx, 1
imul ecx, [rdi+r11*4]
add eax, ecx
cmp r10d, edx
jge short locret_12C2
mov ecx, edx
lea r9d, [rsi+2]
sub ecx, r10d
imul ecx, r9d
sar ecx, 1
imul ecx, [rdi+r8+4]
add eax, ecx
cmp edx, r9d
jle short locret_12C2
sub edx, r9d
add esi, 3
imul edx, esi
add edx, 1
sar edx, 1
imul edx, [rdi+r8+8]
add eax, edx
retn
loc_12C0:
xor eax, eax
locret_12C2:
retn
locret_12C8:
retn
loc_12C9:
xor esi, esi
xor eax, eax
jmp short loc_1254 | long long func0(long long a1, signed int a2)
{
__m128i v3; // xmm2
long long v4; // rax
__m128i si128; // xmm3
__m128i v6; // xmm6
__m128i v7; // xmm7
__m128i v8; // xmm4
__m128i v9; // xmm0
__m128i v10; // xmm8
__m128i v11; // xmm0
__m128i v12; // xmm0
__m128i v13; // xmm0
signed int v14; // esi
__m128i v15; // xmm2
long long result; // rax
long long v17; // r8
if ( a2 <= 0 )
return 0LL;
if ( (unsigned int)(a2 - 1) <= 2 )
{
v14 = 0;
LODWORD(result) = 0;
}
else
{
v3 = 0LL;
v4 = a1;
si128 = _mm_load_si128((const __m128i *)&xmmword_2010);
v6 = _mm_load_si128((const __m128i *)&xmmword_2020);
v7 = _mm_shuffle_epi32(_mm_cvtsi32_si128(a2), 0);
v8 = _mm_load_si128((const __m128i *)&xmmword_2030);
do
{
v9 = si128;
si128 = _mm_add_epi32(si128, v6);
v4 += 16LL;
v10 = _mm_sub_epi32(v7, v9);
v11 = _mm_add_epi32(v9, v8);
v12 = _mm_add_epi32(
_mm_unpacklo_epi32(
_mm_shuffle_epi32(_mm_mul_epu32(v11, v10), 8),
_mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_epi64(v11, 0x20u), _mm_srli_epi64(v10, 0x20u)), 8)),
v8);
v13 = _mm_srai_epi32(_mm_sub_epi32(v12, _mm_cmpgt_epi32((__m128i)0LL, v12)), 1u);
v3 = _mm_add_epi32(
v3,
_mm_unpacklo_epi32(
_mm_shuffle_epi32(_mm_mul_epu32(_mm_loadu_si128((const __m128i *)(v4 - 16)), v13), 8),
_mm_shuffle_epi32(
_mm_mul_epu32(
_mm_srli_epi64(v13, 0x20u),
_mm_srli_epi64(_mm_loadu_si128((const __m128i *)(v4 - 16)), 0x20u)),
8)));
}
while ( a1 + 16LL * ((unsigned int)a2 >> 2) != v4 );
v14 = a2 & 0xFFFFFFFC;
v15 = _mm_add_epi32(v3, _mm_srli_si128(v3, 8));
result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v15, _mm_srli_si128(v15, 4)));
if ( (a2 & 3) == 0 )
return result;
}
v17 = 4LL * v14;
result = (unsigned int)(*(_DWORD *)(a1 + v17) * (((v14 + 1) * (a2 - v14) + 1) / 2) + result);
if ( v14 + 1 < a2 )
{
result = (unsigned int)(*(_DWORD *)(a1 + v17 + 4) * (((v14 + 2) * (a2 - (v14 + 1))) >> 1) + result);
if ( a2 > v14 + 2 )
return (unsigned int)(*(_DWORD *)(a1 + v17 + 8) * (((v14 + 3) * (a2 - (v14 + 2)) + 1) >> 1) + result);
}
return result;
} | func0:
ENDBR64
MOV EDX,ESI
TEST ESI,ESI
JLE 0x001012c0
LEA EAX,[RSI + -0x1]
CMP EAX,0x2
JBE 0x001012c9
MOV ECX,ESI
MOVD XMM5,ESI
PXOR XMM2,XMM2
MOV RAX,RDI
SHR ECX,0x2
MOVDQA XMM3,xmmword ptr [0x00102010]
MOVDQA XMM6,xmmword ptr [0x00102020]
PSHUFD XMM7,XMM5,0x0
SHL RCX,0x4
MOVDQA XMM4,xmmword ptr [0x00102030]
MOVDQA XMM5,XMM2
ADD RCX,RDI
NOP word ptr [RAX + RAX*0x1]
LAB_00101198:
MOVDQA XMM0,XMM3
MOVDQA XMM8,XMM7
PADDD XMM3,XMM6
ADD RAX,0x10
MOVDQA XMM1,XMM0
PSUBD XMM8,XMM0
PADDD XMM1,XMM4
MOVDQA XMM0,XMM1
PSRLQ XMM1,0x20
PMULUDQ XMM0,XMM8
PSRLQ XMM8,0x20
PMULUDQ XMM1,XMM8
MOVDQU XMM8,xmmword ptr [RAX + -0x10]
PSRLQ XMM8,0x20
PSHUFD XMM0,XMM0,0x8
PSHUFD XMM1,XMM1,0x8
PUNPCKLDQ XMM0,XMM1
MOVDQA XMM1,XMM5
PADDD XMM0,XMM4
PCMPGTD XMM1,XMM0
PSUBD XMM0,XMM1
MOVDQU XMM1,xmmword ptr [RAX + -0x10]
PSRAD XMM0,0x1
PMULUDQ XMM1,XMM0
PSRLQ XMM0,0x20
PMULUDQ XMM0,XMM8
PSHUFD XMM1,XMM1,0x8
PSHUFD XMM0,XMM0,0x8
PUNPCKLDQ XMM1,XMM0
PADDD XMM2,XMM1
CMP RCX,RAX
JNZ 0x00101198
MOVDQA XMM0,XMM2
MOV ESI,EDX
PSRLDQ XMM0,0x8
AND ESI,0xfffffffc
PADDD XMM2,XMM0
MOVDQA XMM0,XMM2
PSRLDQ XMM0,0x4
PADDD XMM2,XMM0
MOVD EAX,XMM2
TEST DL,0x3
JZ 0x001012c8
LAB_00101254:
MOV R9D,EDX
LEA R10D,[RSI + 0x1]
MOVSXD R11,ESI
SUB R9D,ESI
LEA R8,[R11*0x4]
IMUL R9D,R10D
ADD R9D,0x1
MOV ECX,R9D
SHR ECX,0x1f
ADD ECX,R9D
SAR ECX,0x1
IMUL ECX,dword ptr [RDI + R11*0x4]
ADD EAX,ECX
CMP R10D,EDX
JGE 0x001012c2
MOV ECX,EDX
LEA R9D,[RSI + 0x2]
SUB ECX,R10D
IMUL ECX,R9D
SAR ECX,0x1
IMUL ECX,dword ptr [RDI + R8*0x1 + 0x4]
ADD EAX,ECX
CMP EDX,R9D
JLE 0x001012c2
SUB EDX,R9D
ADD ESI,0x3
IMUL EDX,ESI
ADD EDX,0x1
SAR EDX,0x1
IMUL EDX,dword ptr [RDI + R8*0x1 + 0x8]
ADD EAX,EDX
RET
LAB_001012c0:
XOR EAX,EAX
LAB_001012c2:
RET
LAB_001012c8:
RET
LAB_001012c9:
XOR ESI,ESI
XOR EAX,EAX
JMP 0x00101254 | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
int func0(ulong *param_1,uint param_2)
{
long lVar1;
ulong *puVar2;
ulong *puVar3;
uint uVar4;
int iVar5;
int iVar7;
int iVar8;
int iVar9;
int auVar6 [16];
int auVar10 [16];
int iVar11;
int iVar12;
int iVar13;
int iVar14;
int iVar15;
int iVar16;
int iVar17;
int iVar18;
int auVar19 [16];
if ((int)param_2 < 1) {
iVar12 = 0;
}
else {
if (param_2 - 1 < 3) {
uVar4 = 0;
iVar12 = 0;
}
else {
iVar11 = 0;
iVar13 = 0;
iVar14 = 0;
iVar15 = 0;
puVar2 = param_1;
iVar12 = _DAT_00102010;
iVar16 = _UNK_00102014;
iVar17 = _UNK_00102018;
iVar18 = _UNK_0010201c;
do {
puVar3 = puVar2 + 2;
auVar19._0_4_ = param_2 - iVar12;
auVar19._4_4_ = param_2 - iVar16;
auVar19._8_4_ = param_2 - iVar17;
auVar19._12_4_ = param_2 - iVar18;
auVar10._0_4_ = iVar12 + _DAT_00102030;
auVar10._4_4_ = iVar16 + _UNK_00102034;
auVar10._8_4_ = iVar17 + _UNK_00102038;
auVar10._12_4_ = iVar18 + _UNK_0010203c;
iVar5 = auVar10._0_4_ * auVar19._0_4_ + _DAT_00102030;
iVar7 = auVar10._4_4_ * auVar19._4_4_ + _UNK_00102034;
iVar8 = (int)((auVar10._8_8_ & 0xffffffff) * (ulong)auVar19._8_4_) + _UNK_00102038;
iVar9 = (int)((auVar10._8_8_ >> 0x20) * (auVar19._8_8_ >> 0x20)) + _UNK_0010203c;
auVar6._0_4_ = (int)(iVar5 + (uint)(iVar5 < 0)) >> 1;
auVar6._4_4_ = (int)(iVar7 + (uint)(iVar7 < 0)) >> 1;
auVar6._8_4_ = (int)(iVar8 + (uint)(iVar8 < 0)) >> 1;
auVar6._12_4_ = (int)(iVar9 + (uint)(iVar9 < 0)) >> 1;
iVar11 = iVar11 + (int)((*puVar2 & 0xffffffff) * (ulong)auVar6._0_4_);
iVar13 = iVar13 + (int)((ulong)auVar6._4_4_ * (*puVar2 >> 0x20));
iVar14 = iVar14 + (int)((puVar2[1] & 0xffffffff) * (ulong)auVar6._8_4_);
iVar15 = iVar15 + (int)((auVar6._8_8_ >> 0x20) * (puVar2[1] >> 0x20));
puVar2 = puVar3;
iVar12 = iVar12 + _DAT_00102020;
iVar16 = iVar16 + _UNK_00102024;
iVar17 = iVar17 + _UNK_00102028;
iVar18 = iVar18 + _UNK_0010202c;
} while (param_1 + (ulong)(param_2 >> 2) * 2 != puVar3);
uVar4 = param_2 & 0xfffffffc;
iVar12 = iVar11 + iVar14 + iVar13 + iVar15;
if ((param_2 & 3) == 0) {
return iVar12;
}
}
iVar16 = uVar4 + 1;
lVar1 = (long)(int)uVar4 * 4;
iVar12 = iVar12 + ((int)((param_2 - uVar4) * iVar16 + 1) / 2) *
*(int *)((long)param_1 + (long)(int)uVar4 * 4);
if (iVar16 < (int)param_2) {
iVar17 = uVar4 + 2;
iVar12 = iVar12 + ((int)((param_2 - iVar16) * iVar17) >> 1) *
*(int *)((long)param_1 + lVar1 + 4);
if (iVar17 < (int)param_2) {
return iVar12 + ((int)((param_2 - iVar17) * (uVar4 + 3) + 1) >> 1) *
*(int *)((long)param_1 + lVar1 + 8);
}
}
}
return iVar12;
} |
7,024 | func0 | #include <math.h>
#include <stdio.h>
#include <assert.h>
| void func0(int r, int g, int b, double *h, double *s, double *v) {
double rd = r / 255.0;
double gd = g / 255.0;
double bd = b / 255.0;
double mx = fmax(rd, fmax(gd, bd));
double mn = fmin(rd, fmin(gd, bd));
double df = mx - mn;
*h = 0;
if (df > 0) {
if (mx == rd) {
*h = fmod((60.0 * ((gd - bd) / df) + 360.0), 360.0);
} else if (mx == gd) {
*h = fmod((60.0 * ((bd - rd) / df) + 120.0), 360.0);
} else if (mx == bd) {
*h = fmod((60.0 * ((rd - gd) / df) + 240.0), 360.0);
}
}
if (mx == 0) {
*s = 0;
} else {
*s = (df / mx) * 100.0;
}
*v = mx * 100.0;
}
| int main() {
double h, s, v;
func0(255, 255, 255, &h, &s, &v);
assert(h == 0 && s == 0.0 && v == 100.0);
func0(0, 215, 0, &h, &s, &v);
assert(h == 120.0 && s == 100.0 && v == 84.31372549019608);
func0(10, 215, 110, &h, &s, &v);
assert(h == 149.26829268292684 && s == 95.34883720930233 && v == 84.31372549019608);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x60,%rsp
mov %edi,-0x34(%rbp)
mov %esi,-0x38(%rbp)
mov %edx,-0x3c(%rbp)
mov %rcx,-0x48(%rbp)
mov %r8,-0x50(%rbp)
mov %r9,-0x58(%rbp)
cvtsi2sdl -0x34(%rbp),%xmm0
movsd 0xf09(%rip),%xmm1
divsd %xmm1,%xmm0
movsd %xmm0,-0x30(%rbp)
cvtsi2sdl -0x38(%rbp),%xmm0
movsd 0xef3(%rip),%xmm1
divsd %xmm1,%xmm0
movsd %xmm0,-0x28(%rbp)
cvtsi2sdl -0x3c(%rbp),%xmm0
movsd 0xedd(%rip),%xmm1
divsd %xmm1,%xmm0
movsd %xmm0,-0x20(%rbp)
movsd -0x20(%rbp),%xmm0
mov -0x28(%rbp),%rax
movapd %xmm0,%xmm1
movq %rax,%xmm0
callq 1090 <fmax@plt>
mov -0x30(%rbp),%rax
movapd %xmm0,%xmm1
movq %rax,%xmm0
callq 1090 <fmax@plt>
movq %xmm0,%rax
mov %rax,-0x18(%rbp)
movsd -0x20(%rbp),%xmm0
mov -0x28(%rbp),%rax
movapd %xmm0,%xmm1
movq %rax,%xmm0
callq 10d0 <fmin@plt>
mov -0x30(%rbp),%rax
movapd %xmm0,%xmm1
movq %rax,%xmm0
callq 10d0 <fmin@plt>
movq %xmm0,%rax
mov %rax,-0x10(%rbp)
movsd -0x18(%rbp),%xmm0
subsd -0x10(%rbp),%xmm0
movsd %xmm0,-0x8(%rbp)
mov -0x48(%rbp),%rax
pxor %xmm0,%xmm0
movsd %xmm0,(%rax)
movsd -0x8(%rbp),%xmm0
pxor %xmm1,%xmm1
comisd %xmm1,%xmm0
jbe 13d9 <func0+0x210>
movsd -0x18(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jp 131f <func0+0x156>
movsd -0x18(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jne 131f <func0+0x156>
movsd -0x28(%rbp),%xmm0
subsd -0x20(%rbp),%xmm0
movapd %xmm0,%xmm1
divsd -0x8(%rbp),%xmm1
movsd 0xe17(%rip),%xmm0
mulsd %xmm0,%xmm1
movsd 0xe13(%rip),%xmm0
addsd %xmm1,%xmm0
movsd 0xe07(%rip),%xmm1
callq 10c0 <fmod@plt>
movq %xmm0,%rax
mov -0x48(%rbp),%rdx
mov %rax,(%rdx)
jmpq 13d9 <func0+0x210>
movsd -0x18(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jp 137d <func0+0x1b4>
movsd -0x18(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne 137d <func0+0x1b4>
movsd -0x20(%rbp),%xmm0
subsd -0x30(%rbp),%xmm0
movapd %xmm0,%xmm1
divsd -0x8(%rbp),%xmm1
movsd 0xdb6(%rip),%xmm0
mulsd %xmm0,%xmm1
movsd 0xdba(%rip),%xmm0
addsd %xmm1,%xmm0
movsd 0xda6(%rip),%xmm1
callq 10c0 <fmod@plt>
movq %xmm0,%rax
mov -0x48(%rbp),%rdx
mov %rax,(%rdx)
jmp 13d9 <func0+0x210>
movsd -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jp 13d9 <func0+0x210>
movsd -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jne 13d9 <func0+0x210>
movsd -0x30(%rbp),%xmm0
subsd -0x28(%rbp),%xmm0
movapd %xmm0,%xmm1
divsd -0x8(%rbp),%xmm1
movsd 0xd58(%rip),%xmm0
mulsd %xmm0,%xmm1
movsd 0xd64(%rip),%xmm0
addsd %xmm1,%xmm0
movsd 0xd48(%rip),%xmm1
callq 10c0 <fmod@plt>
movq %xmm0,%rax
mov -0x48(%rbp),%rdx
mov %rax,(%rdx)
pxor %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jp 13fd <func0+0x234>
pxor %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jne 13fd <func0+0x234>
mov -0x50(%rbp),%rax
pxor %xmm0,%xmm0
movsd %xmm0,(%rax)
jmp 141f <func0+0x256>
movsd -0x8(%rbp),%xmm0
movapd %xmm0,%xmm1
divsd -0x18(%rbp),%xmm1
movsd 0xd15(%rip),%xmm0
mulsd %xmm1,%xmm0
mov -0x50(%rbp),%rax
movsd %xmm0,(%rax)
movsd -0x18(%rbp),%xmm1
movsd 0xcfc(%rip),%xmm0
mulsd %xmm1,%xmm0
mov -0x58(%rbp),%rax
movsd %xmm0,(%rax)
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 60h
mov [rbp+var_34], edi
mov [rbp+var_38], esi
mov [rbp+var_3C], edx
mov [rbp+var_48], rcx
mov [rbp+var_50], r8
mov [rbp+var_58], r9
pxor xmm0, xmm0
cvtsi2sd xmm0, [rbp+var_34]
movsd xmm1, cs:qword_20E0
divsd xmm0, xmm1
movsd [rbp+var_30], xmm0
pxor xmm0, xmm0
cvtsi2sd xmm0, [rbp+var_38]
movsd xmm1, cs:qword_20E0
divsd xmm0, xmm1
movsd [rbp+x], xmm0
pxor xmm0, xmm0
cvtsi2sd xmm0, [rbp+var_3C]
movsd xmm1, cs:qword_20E0
divsd xmm0, xmm1
movsd [rbp+y], xmm0
movsd xmm0, [rbp+y]
mov rax, [rbp+x]
movapd xmm1, xmm0; y
movq xmm0, rax; x
call _fmax
movq rdx, xmm0
mov rax, [rbp+var_30]
movq xmm1, rdx; y
movq xmm0, rax; x
call _fmax
movq rax, xmm0
mov [rbp+var_18], rax
movsd xmm0, [rbp+y]
mov rax, [rbp+x]
movapd xmm1, xmm0; y
movq xmm0, rax; x
call _fmin
movq rdx, xmm0
mov rax, [rbp+var_30]
movq xmm1, rdx; y
movq xmm0, rax; x
call _fmin
movq rax, xmm0
mov [rbp+var_10], rax
movsd xmm0, [rbp+var_18]
subsd xmm0, [rbp+var_10]
movsd [rbp+var_8], xmm0
mov rax, [rbp+var_48]
pxor xmm0, xmm0
movsd qword ptr [rax], xmm0
movsd xmm0, [rbp+var_8]
pxor xmm1, xmm1
comisd xmm0, xmm1
jbe loc_141B
movsd xmm0, [rbp+var_18]
ucomisd xmm0, [rbp+var_30]
jp short loc_1345
movsd xmm0, [rbp+var_18]
ucomisd xmm0, [rbp+var_30]
jnz short loc_1345
movsd xmm0, [rbp+x]
subsd xmm0, [rbp+y]
movapd xmm1, xmm0
divsd xmm1, [rbp+var_8]
movsd xmm0, cs:qword_20E8
mulsd xmm1, xmm0
movsd xmm0, cs:y
addsd xmm1, xmm0
movq rax, xmm1
movsd xmm0, cs:y
movapd xmm1, xmm0; y
movq xmm0, rax; x
call _fmod
movq rax, xmm0
mov rdx, [rbp+var_48]
mov [rdx], rax
jmp loc_141B
loc_1345:
movsd xmm0, [rbp+var_18]
ucomisd xmm0, [rbp+x]
jp short loc_13B1
movsd xmm0, [rbp+var_18]
ucomisd xmm0, [rbp+x]
jnz short loc_13B1
movsd xmm0, [rbp+y]
subsd xmm0, [rbp+var_30]
movapd xmm1, xmm0
divsd xmm1, [rbp+var_8]
movsd xmm0, cs:qword_20E8
mulsd xmm1, xmm0
movsd xmm0, cs:qword_20F8
addsd xmm1, xmm0
movq rax, xmm1
movsd xmm0, cs:y
movapd xmm1, xmm0; y
movq xmm0, rax; x
call _fmod
movq rax, xmm0
mov rdx, [rbp+var_48]
mov [rdx], rax
jmp short loc_141B
loc_13B1:
movsd xmm0, [rbp+var_18]
ucomisd xmm0, [rbp+y]
jp short loc_141B
movsd xmm0, [rbp+var_18]
ucomisd xmm0, [rbp+y]
jnz short loc_141B
movsd xmm0, [rbp+var_30]
subsd xmm0, [rbp+x]
movapd xmm1, xmm0
divsd xmm1, [rbp+var_8]
movsd xmm0, cs:qword_20E8
mulsd xmm1, xmm0
movsd xmm0, cs:qword_2100
addsd xmm1, xmm0
movq rax, xmm1
movsd xmm0, cs:y
movapd xmm1, xmm0; y
movq xmm0, rax; x
call _fmod
movq rax, xmm0
mov rdx, [rbp+var_48]
mov [rdx], rax
loc_141B:
pxor xmm0, xmm0
ucomisd xmm0, [rbp+var_18]
jp short loc_143F
pxor xmm0, xmm0
ucomisd xmm0, [rbp+var_18]
jnz short loc_143F
mov rax, [rbp+var_50]
pxor xmm0, xmm0
movsd qword ptr [rax], xmm0
jmp short loc_1461
loc_143F:
movsd xmm0, [rbp+var_8]
movapd xmm1, xmm0
divsd xmm1, [rbp+var_18]
movsd xmm0, cs:qword_2108
mulsd xmm0, xmm1
mov rax, [rbp+var_50]
movsd qword ptr [rax], xmm0
loc_1461:
movsd xmm1, [rbp+var_18]
movsd xmm0, cs:qword_2108
mulsd xmm0, xmm1
mov rax, [rbp+var_58]
movsd qword ptr [rax], xmm0
nop
leave
retn | double * func0(int a1, int a2, int a3, double *a4, double *a5, double *a6)
{
double v6; // xmm0_8
double v7; // xmm0_8
double *result; // rax
double v12; // [rsp+30h] [rbp-30h]
double x; // [rsp+38h] [rbp-28h]
double y; // [rsp+40h] [rbp-20h]
double v15; // [rsp+48h] [rbp-18h]
double v16; // [rsp+58h] [rbp-8h]
v12 = (double)a1 / 255.0;
x = (double)a2 / 255.0;
y = (double)a3 / 255.0;
v6 = fmax(x, y);
v15 = fmax(v12, v6);
v7 = fmin(x, y);
v16 = v15 - fmin(v12, v7);
*a4 = 0.0;
if ( v16 > 0.0 )
{
if ( v15 == v12 )
{
*a4 = fmod((x - y) / v16 * 60.0 + 360.0, 360.0);
}
else if ( v15 == x )
{
*a4 = fmod((y - v12) / v16 * 60.0 + 120.0, 360.0);
}
else if ( v15 == y )
{
*a4 = fmod((v12 - x) / v16 * 60.0 + 240.0, 360.0);
}
}
if ( v15 == 0.0 )
*a5 = 0.0;
else
*a5 = 100.0 * (v16 / v15);
result = a6;
*a6 = 100.0 * v15;
return result;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x60
MOV dword ptr [RBP + -0x34],EDI
MOV dword ptr [RBP + -0x38],ESI
MOV dword ptr [RBP + -0x3c],EDX
MOV qword ptr [RBP + -0x48],RCX
MOV qword ptr [RBP + -0x50],R8
MOV qword ptr [RBP + -0x58],R9
PXOR XMM0,XMM0
CVTSI2SD XMM0,dword ptr [RBP + -0x34]
MOVSD XMM1,qword ptr [0x001020e0]
DIVSD XMM0,XMM1
MOVSD qword ptr [RBP + -0x30],XMM0
PXOR XMM0,XMM0
CVTSI2SD XMM0,dword ptr [RBP + -0x38]
MOVSD XMM1,qword ptr [0x001020e0]
DIVSD XMM0,XMM1
MOVSD qword ptr [RBP + -0x28],XMM0
PXOR XMM0,XMM0
CVTSI2SD XMM0,dword ptr [RBP + -0x3c]
MOVSD XMM1,qword ptr [0x001020e0]
DIVSD XMM0,XMM1
MOVSD qword ptr [RBP + -0x20],XMM0
MOVSD XMM0,qword ptr [RBP + -0x20]
MOV RAX,qword ptr [RBP + -0x28]
MOVAPD XMM1,XMM0
MOVQ XMM0,RAX
CALL 0x00101090
MOVQ RDX,XMM0
MOV RAX,qword ptr [RBP + -0x30]
MOVQ XMM1,RDX
MOVQ XMM0,RAX
CALL 0x00101090
MOVQ RAX,XMM0
MOV qword ptr [RBP + -0x18],RAX
MOVSD XMM0,qword ptr [RBP + -0x20]
MOV RAX,qword ptr [RBP + -0x28]
MOVAPD XMM1,XMM0
MOVQ XMM0,RAX
CALL 0x001010c0
MOVQ RDX,XMM0
MOV RAX,qword ptr [RBP + -0x30]
MOVQ XMM1,RDX
MOVQ XMM0,RAX
CALL 0x001010c0
MOVQ RAX,XMM0
MOV qword ptr [RBP + -0x10],RAX
MOVSD XMM0,qword ptr [RBP + -0x18]
SUBSD XMM0,qword ptr [RBP + -0x10]
MOVSD qword ptr [RBP + -0x8],XMM0
MOV RAX,qword ptr [RBP + -0x48]
PXOR XMM0,XMM0
MOVSD qword ptr [RAX],XMM0
MOVSD XMM0,qword ptr [RBP + -0x8]
PXOR XMM1,XMM1
COMISD XMM0,XMM1
JBE 0x0010141b
MOVSD XMM0,qword ptr [RBP + -0x18]
UCOMISD XMM0,qword ptr [RBP + -0x30]
JP 0x00101345
MOVSD XMM0,qword ptr [RBP + -0x18]
UCOMISD XMM0,qword ptr [RBP + -0x30]
JNZ 0x00101345
MOVSD XMM0,qword ptr [RBP + -0x28]
SUBSD XMM0,qword ptr [RBP + -0x20]
MOVAPD XMM1,XMM0
DIVSD XMM1,qword ptr [RBP + -0x8]
MOVSD XMM0,qword ptr [0x001020e8]
MULSD XMM1,XMM0
MOVSD XMM0,qword ptr [0x001020f0]
ADDSD XMM1,XMM0
MOVQ RAX,XMM1
MOVSD XMM0,qword ptr [0x001020f0]
MOVAPD XMM1,XMM0
MOVQ XMM0,RAX
CALL 0x001010d0
MOVQ RAX,XMM0
MOV RDX,qword ptr [RBP + -0x48]
MOV qword ptr [RDX],RAX
JMP 0x0010141b
LAB_00101345:
MOVSD XMM0,qword ptr [RBP + -0x18]
UCOMISD XMM0,qword ptr [RBP + -0x28]
JP 0x001013b1
MOVSD XMM0,qword ptr [RBP + -0x18]
UCOMISD XMM0,qword ptr [RBP + -0x28]
JNZ 0x001013b1
MOVSD XMM0,qword ptr [RBP + -0x20]
SUBSD XMM0,qword ptr [RBP + -0x30]
MOVAPD XMM1,XMM0
DIVSD XMM1,qword ptr [RBP + -0x8]
MOVSD XMM0,qword ptr [0x001020e8]
MULSD XMM1,XMM0
MOVSD XMM0,qword ptr [0x001020f8]
ADDSD XMM1,XMM0
MOVQ RAX,XMM1
MOVSD XMM0,qword ptr [0x001020f0]
MOVAPD XMM1,XMM0
MOVQ XMM0,RAX
CALL 0x001010d0
MOVQ RAX,XMM0
MOV RDX,qword ptr [RBP + -0x48]
MOV qword ptr [RDX],RAX
JMP 0x0010141b
LAB_001013b1:
MOVSD XMM0,qword ptr [RBP + -0x18]
UCOMISD XMM0,qword ptr [RBP + -0x20]
JP 0x0010141b
MOVSD XMM0,qword ptr [RBP + -0x18]
UCOMISD XMM0,qword ptr [RBP + -0x20]
JNZ 0x0010141b
MOVSD XMM0,qword ptr [RBP + -0x30]
SUBSD XMM0,qword ptr [RBP + -0x28]
MOVAPD XMM1,XMM0
DIVSD XMM1,qword ptr [RBP + -0x8]
MOVSD XMM0,qword ptr [0x001020e8]
MULSD XMM1,XMM0
MOVSD XMM0,qword ptr [0x00102100]
ADDSD XMM1,XMM0
MOVQ RAX,XMM1
MOVSD XMM0,qword ptr [0x001020f0]
MOVAPD XMM1,XMM0
MOVQ XMM0,RAX
CALL 0x001010d0
MOVQ RAX,XMM0
MOV RDX,qword ptr [RBP + -0x48]
MOV qword ptr [RDX],RAX
LAB_0010141b:
PXOR XMM0,XMM0
UCOMISD XMM0,qword ptr [RBP + -0x18]
JP 0x0010143f
PXOR XMM0,XMM0
UCOMISD XMM0,qword ptr [RBP + -0x18]
JNZ 0x0010143f
MOV RAX,qword ptr [RBP + -0x50]
PXOR XMM0,XMM0
MOVSD qword ptr [RAX],XMM0
JMP 0x00101461
LAB_0010143f:
MOVSD XMM0,qword ptr [RBP + -0x8]
MOVAPD XMM1,XMM0
DIVSD XMM1,qword ptr [RBP + -0x18]
MOVSD XMM0,qword ptr [0x00102108]
MULSD XMM0,XMM1
MOV RAX,qword ptr [RBP + -0x50]
MOVSD qword ptr [RAX],XMM0
LAB_00101461:
MOVSD XMM1,qword ptr [RBP + -0x18]
MOVSD XMM0,qword ptr [0x00102108]
MULSD XMM0,XMM1
MOV RAX,qword ptr [RBP + -0x58]
MOVSD qword ptr [RAX],XMM0
NOP
LEAVE
RET | void func0(int param_1,int param_2,int param_3,double *param_4,double *param_5,double *param_6)
{
double dVar1;
double __x;
double __y;
double dVar2;
double dVar3;
dVar1 = (double)param_1 / DAT_001020e0;
__x = (double)param_2 / DAT_001020e0;
__y = (double)param_3 / DAT_001020e0;
dVar2 = fmax(__x,__y);
dVar2 = fmax(dVar1,dVar2);
dVar3 = fmin(__x,__y);
dVar3 = fmin(dVar1,dVar3);
dVar3 = dVar2 - dVar3;
*param_4 = 0.0;
if (0.0 < dVar3) {
if (dVar2 == dVar1) {
dVar1 = fmod(((__x - __y) / dVar3) * DAT_001020e8 + DAT_001020f0,DAT_001020f0);
*param_4 = dVar1;
}
else if (dVar2 == __x) {
dVar1 = fmod(((__y - dVar1) / dVar3) * DAT_001020e8 + DAT_001020f8,DAT_001020f0);
*param_4 = dVar1;
}
else if (dVar2 == __y) {
dVar1 = fmod(((dVar1 - __x) / dVar3) * DAT_001020e8 + DAT_00102100,DAT_001020f0);
*param_4 = dVar1;
}
}
if (dVar2 == 0.0) {
*param_5 = 0.0;
}
else {
*param_5 = DAT_00102108 * (dVar3 / dVar2);
}
*param_6 = DAT_00102108 * dVar2;
return;
} |
7,025 | func0 | #include <math.h>
#include <stdio.h>
#include <assert.h>
| void func0(int r, int g, int b, double *h, double *s, double *v) {
double rd = r / 255.0;
double gd = g / 255.0;
double bd = b / 255.0;
double mx = fmax(rd, fmax(gd, bd));
double mn = fmin(rd, fmin(gd, bd));
double df = mx - mn;
*h = 0;
if (df > 0) {
if (mx == rd) {
*h = fmod((60.0 * ((gd - bd) / df) + 360.0), 360.0);
} else if (mx == gd) {
*h = fmod((60.0 * ((bd - rd) / df) + 120.0), 360.0);
} else if (mx == bd) {
*h = fmod((60.0 * ((rd - gd) / df) + 240.0), 360.0);
}
}
if (mx == 0) {
*s = 0;
} else {
*s = (df / mx) * 100.0;
}
*v = mx * 100.0;
}
| int main() {
double h, s, v;
func0(255, 255, 255, &h, &s, &v);
assert(h == 0 && s == 0.0 && v == 100.0);
func0(0, 215, 0, &h, &s, &v);
assert(h == 120.0 && s == 100.0 && v == 84.31372549019608);
func0(10, 215, 110, &h, &s, &v);
assert(h == 149.26829268292684 && s == 95.34883720930233 && v == 84.31372549019608);
return 0;
}
| O1 | c | func0:
endbr64
push %r12
push %rbp
push %rbx
sub $0x30,%rsp
mov %rcx,%rbx
mov %r8,%r12
mov %r9,%rbp
pxor %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
movsd 0xf1a(%rip),%xmm0
divsd %xmm0,%xmm1
movsd %xmm1,0x10(%rsp)
pxor %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
movapd %xmm1,%xmm5
divsd %xmm0,%xmm5
pxor %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
movapd %xmm1,%xmm6
divsd %xmm0,%xmm6
movsd %xmm6,0x20(%rsp)
movapd %xmm6,%xmm1
movsd %xmm5,0x18(%rsp)
movapd %xmm5,%xmm0
callq 1090 <fmax@plt>
movapd %xmm0,%xmm1
movsd 0x10(%rsp),%xmm0
callq 1090 <fmax@plt>
movsd %xmm0,0x8(%rsp)
movsd 0x20(%rsp),%xmm1
movsd 0x18(%rsp),%xmm0
callq 10d0 <fmin@plt>
movapd %xmm0,%xmm1
movsd 0x10(%rsp),%xmm0
callq 10d0 <fmin@plt>
movsd 0x8(%rsp),%xmm3
movapd %xmm3,%xmm4
subsd %xmm0,%xmm4
movsd %xmm4,0x28(%rsp)
movq $0x0,(%rbx)
comisd 0xe77(%rip),%xmm4
jbe 1321 <func0+0x158>
movsd 0x10(%rsp),%xmm2
ucomisd %xmm3,%xmm2
jnp 12f2 <func0+0x129>
movsd 0x18(%rsp),%xmm2
ucomisd 0x8(%rsp),%xmm2
jnp 1339 <func0+0x170>
movsd 0x20(%rsp),%xmm2
ucomisd 0x8(%rsp),%xmm2
jp 1321 <func0+0x158>
jne 1321 <func0+0x158>
movsd 0x10(%rsp),%xmm0
subsd 0x18(%rsp),%xmm0
divsd 0x28(%rsp),%xmm0
mulsd 0xe41(%rip),%xmm0
addsd 0xe49(%rip),%xmm0
movsd 0xe29(%rip),%xmm1
callq 10c0 <fmod@plt>
movsd %xmm0,(%rbx)
jmp 1321 <func0+0x158>
jne 129b <func0+0xd2>
movsd 0xe14(%rip),%xmm1
movsd 0x18(%rsp),%xmm0
subsd 0x20(%rsp),%xmm0
divsd %xmm4,%xmm0
mulsd 0xe04(%rip),%xmm0
addsd %xmm1,%xmm0
callq 10c0 <fmod@plt>
movsd %xmm0,(%rbx)
movsd 0x8(%rsp),%xmm7
ucomisd 0xdd1(%rip),%xmm7
jp 1374 <func0+0x1ab>
jne 1374 <func0+0x1ab>
pxor %xmm0,%xmm0
jmp 1388 <func0+0x1bf>
jne 12ad <func0+0xe4>
movsd 0x20(%rsp),%xmm0
subsd 0x10(%rsp),%xmm0
divsd 0x28(%rsp),%xmm0
mulsd 0xdbf(%rip),%xmm0
addsd 0xdbf(%rip),%xmm0
movsd 0xda7(%rip),%xmm1
callq 10c0 <fmod@plt>
movsd %xmm0,(%rbx)
jmp 1321 <func0+0x158>
movsd 0x28(%rsp),%xmm0
divsd 0x8(%rsp),%xmm0
mulsd 0xda8(%rip),%xmm0
movsd %xmm0,(%r12)
movsd 0x8(%rsp),%xmm0
mulsd 0xd94(%rip),%xmm0
movsd %xmm0,0x0(%rbp)
add $0x30,%rsp
pop %rbx
pop %rbp
pop %r12
retq
| func0:
endbr64
push r12
push rbp
push rbx
sub rsp, 30h
mov rbx, rcx
mov r12, r8
mov rbp, r9
pxor xmm1, xmm1
cvtsi2sd xmm1, edi
movsd xmm0, cs:qword_20E8
divsd xmm1, xmm0
movsd [rsp+48h+var_38], xmm1
pxor xmm1, xmm1
cvtsi2sd xmm1, esi
movapd xmm5, xmm1
divsd xmm5, xmm0
pxor xmm1, xmm1
cvtsi2sd xmm1, edx
movapd xmm6, xmm1
divsd xmm6, xmm0
movsd [rsp+48h+var_28], xmm6
movapd xmm1, xmm6
movsd [rsp+48h+var_30], xmm5
movapd xmm0, xmm5
call _fmax
movapd xmm1, xmm0
movsd xmm0, [rsp+48h+var_38]
call _fmax
movsd [rsp+48h+var_40], xmm0
movsd xmm1, [rsp+48h+var_28]
movsd xmm0, [rsp+48h+var_30]
call _fmin
movapd xmm1, xmm0
movsd xmm0, [rsp+48h+var_38]
call _fmin
movsd xmm3, [rsp+48h+var_40]
movapd xmm4, xmm3
subsd xmm4, xmm0
movsd [rsp+48h+var_20], xmm4
mov qword ptr [rbx], 0
comisd xmm4, cs:qword_20E0
jbe loc_132B
movsd xmm2, [rsp+48h+var_38]
ucomisd xmm2, xmm3
jp short loc_129D
jz short loc_12FE
loc_129D:
movsd xmm2, [rsp+48h+var_30]
movsd xmm5, [rsp+48h+var_40]
ucomisd xmm2, xmm5
jp short loc_12B5
jz loc_1363
loc_12B5:
movsd xmm3, [rsp+48h+var_28]
movsd xmm2, [rsp+48h+var_40]
ucomisd xmm3, xmm2
jp short loc_132B
jnz short loc_132B
movsd xmm0, [rsp+48h+var_38]
subsd xmm0, [rsp+48h+var_30]
divsd xmm0, [rsp+48h+var_20]
mulsd xmm0, cs:qword_20F8
addsd xmm0, cs:qword_2108
movsd xmm1, cs:qword_20F0
call _fmod
movsd qword ptr [rbx], xmm0
jmp short loc_132B
loc_12FE:
movsd xmm1, cs:qword_20F0
movsd xmm0, [rsp+48h+var_30]
subsd xmm0, [rsp+48h+var_28]
divsd xmm0, xmm4
mulsd xmm0, cs:qword_20F8
addsd xmm0, xmm1
call _fmod
movsd qword ptr [rbx], xmm0
loc_132B:
movsd xmm7, [rsp+48h+var_40]
ucomisd xmm7, cs:qword_20E0
jp short loc_1398
pxor xmm0, xmm0
jnz short loc_1398
loc_1341:
movsd qword ptr [r12], xmm0
movsd xmm0, [rsp+48h+var_40]
mulsd xmm0, cs:qword_2110
movsd qword ptr [rbp+0], xmm0
add rsp, 30h
pop rbx
pop rbp
pop r12
retn
loc_1363:
movsd xmm0, [rsp+48h+var_28]
subsd xmm0, [rsp+48h+var_38]
divsd xmm0, [rsp+48h+var_20]
mulsd xmm0, cs:qword_20F8
addsd xmm0, cs:qword_2100
movsd xmm1, cs:qword_20F0
call _fmod
movsd qword ptr [rbx], xmm0
jmp short loc_132B
loc_1398:
movsd xmm0, [rsp+48h+var_20]
divsd xmm0, [rsp+48h+var_40]
mulsd xmm0, cs:qword_2110
jmp short loc_1341 | void func0(int a1, int a2, int a3, double *a4, double *a5, double *a6)
{
double v9; // xmm0_8
double v10; // xmm0_8
double v11; // xmm4_8
double v12; // xmm0_8
double v13; // [rsp+8h] [rbp-40h]
double v14; // [rsp+10h] [rbp-38h]
double v15; // [rsp+18h] [rbp-30h]
double v16; // [rsp+20h] [rbp-28h]
double v17; // [rsp+28h] [rbp-20h]
v14 = (double)a1 / 255.0;
v16 = (double)a3 / 255.0;
v15 = (double)a2 / 255.0;
v9 = fmax(v15, v16);
v13 = fmax(v14, v9);
v10 = fmin(v15, v16);
v11 = v13 - fmin(v14, v10);
v17 = v11;
*a4 = 0.0;
if ( v11 > 0.0 )
{
if ( v14 == v13 )
{
*a4 = fmod((v15 - v16) / v11 * 60.0 + 360.0, 360.0);
}
else if ( v15 == v13 )
{
*a4 = fmod((v16 - v14) / v11 * 60.0 + 120.0, 360.0);
}
else if ( v16 == v13 )
{
*a4 = fmod((v14 - v15) / v11 * 60.0 + 240.0, 360.0);
}
}
v12 = 0.0;
if ( v13 != 0.0 )
v12 = v17 / v13 * 100.0;
*a5 = v12;
*a6 = v13 * 100.0;
} | func0:
ENDBR64
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0x30
MOV RBX,RCX
MOV R12,R8
MOV RBP,R9
PXOR XMM1,XMM1
CVTSI2SD XMM1,EDI
MOVSD XMM0,qword ptr [0x001020e8]
DIVSD XMM1,XMM0
MOVSD qword ptr [RSP + 0x10],XMM1
PXOR XMM1,XMM1
CVTSI2SD XMM1,ESI
MOVAPD XMM5,XMM1
DIVSD XMM5,XMM0
PXOR XMM1,XMM1
CVTSI2SD XMM1,EDX
MOVAPD XMM6,XMM1
DIVSD XMM6,XMM0
MOVSD qword ptr [RSP + 0x20],XMM6
MOVAPD XMM1,XMM6
MOVSD qword ptr [RSP + 0x18],XMM5
MOVAPD XMM0,XMM5
CALL 0x00101090
MOVAPD XMM1,XMM0
MOVSD XMM0,qword ptr [RSP + 0x10]
CALL 0x00101090
MOVSD qword ptr [RSP + 0x8],XMM0
MOVSD XMM1,qword ptr [RSP + 0x20]
MOVSD XMM0,qword ptr [RSP + 0x18]
CALL 0x001010d0
MOVAPD XMM1,XMM0
MOVSD XMM0,qword ptr [RSP + 0x10]
CALL 0x001010d0
MOVSD XMM3,qword ptr [RSP + 0x8]
MOVAPD XMM4,XMM3
SUBSD XMM4,XMM0
MOVSD qword ptr [RSP + 0x28],XMM4
MOV qword ptr [RBX],0x0
COMISD XMM4,qword ptr [0x001020e0]
JBE 0x0010132b
MOVSD XMM2,qword ptr [RSP + 0x10]
UCOMISD XMM2,XMM3
JP 0x0010129d
JZ 0x001012fe
LAB_0010129d:
MOVSD XMM2,qword ptr [RSP + 0x18]
MOVSD XMM5,qword ptr [RSP + 0x8]
UCOMISD XMM2,XMM5
JP 0x001012b5
JZ 0x00101363
LAB_001012b5:
MOVSD XMM3,qword ptr [RSP + 0x20]
MOVSD XMM2,qword ptr [RSP + 0x8]
UCOMISD XMM3,XMM2
JP 0x0010132b
JNZ 0x0010132b
MOVSD XMM0,qword ptr [RSP + 0x10]
SUBSD XMM0,qword ptr [RSP + 0x18]
DIVSD XMM0,qword ptr [RSP + 0x28]
MULSD XMM0,qword ptr [0x001020f8]
ADDSD XMM0,qword ptr [0x00102108]
MOVSD XMM1,qword ptr [0x001020f0]
CALL 0x001010c0
MOVSD qword ptr [RBX],XMM0
JMP 0x0010132b
LAB_001012fe:
MOVSD XMM1,qword ptr [0x001020f0]
MOVSD XMM0,qword ptr [RSP + 0x18]
SUBSD XMM0,qword ptr [RSP + 0x20]
DIVSD XMM0,XMM4
MULSD XMM0,qword ptr [0x001020f8]
ADDSD XMM0,XMM1
CALL 0x001010c0
MOVSD qword ptr [RBX],XMM0
LAB_0010132b:
MOVSD XMM7,qword ptr [RSP + 0x8]
UCOMISD XMM7,qword ptr [0x001020e0]
JP 0x00101398
PXOR XMM0,XMM0
JNZ 0x00101398
LAB_00101341:
MOVSD qword ptr [R12],XMM0
MOVSD XMM0,qword ptr [RSP + 0x8]
MULSD XMM0,qword ptr [0x00102110]
MOVSD qword ptr [RBP],XMM0
ADD RSP,0x30
POP RBX
POP RBP
POP R12
RET
LAB_00101363:
MOVSD XMM0,qword ptr [RSP + 0x20]
SUBSD XMM0,qword ptr [RSP + 0x10]
DIVSD XMM0,qword ptr [RSP + 0x28]
MULSD XMM0,qword ptr [0x001020f8]
ADDSD XMM0,qword ptr [0x00102100]
MOVSD XMM1,qword ptr [0x001020f0]
CALL 0x001010c0
MOVSD qword ptr [RBX],XMM0
JMP 0x0010132b
LAB_00101398:
MOVSD XMM0,qword ptr [RSP + 0x28]
DIVSD XMM0,qword ptr [RSP + 0x8]
MULSD XMM0,qword ptr [0x00102110]
JMP 0x00101341 | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
void func0(int param_1,int param_2,int param_3,double *param_4,double *param_5,double *param_6)
{
double dVar1;
double dVar2;
double dVar3;
double __x;
double __y;
dVar3 = (double)param_1 / DAT_001020e8;
__x = (double)param_2 / DAT_001020e8;
__y = (double)param_3 / DAT_001020e8;
dVar1 = fmax(__x,__y);
dVar1 = fmax(dVar3,dVar1);
dVar2 = fmin(__x,__y);
dVar2 = fmin(dVar3,dVar2);
dVar2 = dVar1 - dVar2;
*param_4 = 0.0;
if (_DAT_001020e0 < dVar2) {
if (dVar3 == dVar1) {
dVar3 = fmod(((__x - __y) / dVar2) * _DAT_001020f8 + DAT_001020f0,DAT_001020f0);
*param_4 = dVar3;
}
else if (__x == dVar1) {
dVar3 = fmod(((__y - dVar3) / dVar2) * _DAT_001020f8 + DAT_00102100,DAT_001020f0);
*param_4 = dVar3;
}
else if (__y == dVar1) {
dVar3 = fmod(((dVar3 - __x) / dVar2) * _DAT_001020f8 + _DAT_00102108,DAT_001020f0);
*param_4 = dVar3;
}
}
dVar3 = 0.0;
if (dVar1 != _DAT_001020e0) {
dVar3 = (dVar2 / dVar1) * DAT_00102110;
}
*param_5 = dVar3;
*param_6 = dVar1 * DAT_00102110;
return;
} |
7,026 | func0 | #include <math.h>
#include <stdio.h>
#include <assert.h>
| void func0(int r, int g, int b, double *h, double *s, double *v) {
double rd = r / 255.0;
double gd = g / 255.0;
double bd = b / 255.0;
double mx = fmax(rd, fmax(gd, bd));
double mn = fmin(rd, fmin(gd, bd));
double df = mx - mn;
*h = 0;
if (df > 0) {
if (mx == rd) {
*h = fmod((60.0 * ((gd - bd) / df) + 360.0), 360.0);
} else if (mx == gd) {
*h = fmod((60.0 * ((bd - rd) / df) + 120.0), 360.0);
} else if (mx == bd) {
*h = fmod((60.0 * ((rd - gd) / df) + 240.0), 360.0);
}
}
if (mx == 0) {
*s = 0;
} else {
*s = (df / mx) * 100.0;
}
*v = mx * 100.0;
}
| int main() {
double h, s, v;
func0(255, 255, 255, &h, &s, &v);
assert(h == 0 && s == 0.0 && v == 100.0);
func0(0, 215, 0, &h, &s, &v);
assert(h == 120.0 && s == 100.0 && v == 84.31372549019608);
func0(10, 215, 110, &h, &s, &v);
assert(h == 149.26829268292684 && s == 95.34883720930233 && v == 84.31372549019608);
return 0;
}
| O2 | c | func0:
endbr64
push %r12
pxor %xmm1,%xmm1
pxor %xmm3,%xmm3
pxor %xmm4,%xmm4
push %rbp
cvtsi2sd %edi,%xmm1
mov %r8,%r12
mov %r9,%rbp
push %rbx
cvtsi2sd %esi,%xmm3
mov %rcx,%rbx
cvtsi2sd %edx,%xmm4
sub $0x20,%rsp
movsd 0xd3b(%rip),%xmm0
divsd %xmm0,%xmm4
divsd %xmm0,%xmm3
movsd %xmm4,0x18(%rsp)
divsd %xmm0,%xmm1
movapd %xmm3,%xmm0
movsd %xmm3,0x10(%rsp)
movsd %xmm1,(%rsp)
movapd %xmm4,%xmm1
callq 1090 <fmax@plt>
movapd %xmm0,%xmm1
movsd (%rsp),%xmm0
callq 1090 <fmax@plt>
movsd 0x18(%rsp),%xmm4
movsd 0x10(%rsp),%xmm3
movsd %xmm0,0x8(%rsp)
movapd %xmm4,%xmm1
movapd %xmm3,%xmm0
callq 10d0 <fmin@plt>
movapd %xmm0,%xmm1
movsd (%rsp),%xmm0
callq 10d0 <fmin@plt>
movsd 0x8(%rsp),%xmm2
pxor %xmm5,%xmm5
movq $0x0,(%rbx)
movapd %xmm2,%xmm6
subsd %xmm0,%xmm6
comisd %xmm5,%xmm6
jbe 1478 <func0+0xe8>
movsd (%rsp),%xmm1
movsd 0x10(%rsp),%xmm3
movsd 0x18(%rsp),%xmm4
ucomisd %xmm2,%xmm1
jnp 14c0 <func0+0x130>
ucomisd %xmm2,%xmm3
jnp 1560 <func0+0x1d0>
ucomisd %xmm2,%xmm4
jnp 1508 <func0+0x178>
nopl 0x0(%rax)
ucomisd %xmm5,%xmm2
jp 14a0 <func0+0x110>
jne 14a0 <func0+0x110>
movsd 0xca0(%rip),%xmm0
mulsd %xmm0,%xmm2
movsd %xmm5,(%r12)
movsd %xmm2,0x0(%rbp)
add $0x20,%rsp
pop %rbx
pop %rbp
pop %r12
retq
divsd %xmm2,%xmm6
movsd 0xc7c(%rip),%xmm0
movapd %xmm6,%xmm5
mulsd %xmm0,%xmm5
jmp 1488 <func0+0xf8>
nopw %cs:0x0(%rax,%rax,1)
jne 1460 <func0+0xd0>
subsd %xmm4,%xmm3
movsd 0xc3a(%rip),%xmm1
movsd %xmm6,(%rsp)
movapd %xmm3,%xmm0
divsd %xmm6,%xmm0
mulsd 0xc2d(%rip),%xmm0
addsd %xmm1,%xmm0
callq 10c0 <fmod@plt>
movsd (%rsp),%xmm6
movsd 0x8(%rsp),%xmm2
pxor %xmm5,%xmm5
movsd %xmm0,(%rbx)
jmpq 1478 <func0+0xe8>
nopl 0x0(%rax)
jne 1478 <func0+0xe8>
movsd (%rsp),%xmm0
movsd 0xbed(%rip),%xmm1
movsd %xmm6,(%rsp)
movsd %xmm2,0x8(%rsp)
subsd %xmm3,%xmm0
divsd %xmm6,%xmm0
mulsd 0xbda(%rip),%xmm0
addsd 0xbe2(%rip),%xmm0
callq 10c0 <fmod@plt>
movsd 0x8(%rsp),%xmm2
movsd (%rsp),%xmm6
pxor %xmm5,%xmm5
movsd %xmm0,(%rbx)
jmpq 1478 <func0+0xe8>
nopl 0x0(%rax,%rax,1)
jne 146a <func0+0xda>
subsd (%rsp),%xmm4
movsd 0xb95(%rip),%xmm1
movsd %xmm6,(%rsp)
movsd %xmm2,0x8(%rsp)
movapd %xmm4,%xmm0
divsd %xmm6,%xmm0
mulsd 0xb82(%rip),%xmm0
addsd 0xb82(%rip),%xmm0
jmpq 14e7 <func0+0x157>
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
push r12
pxor xmm1, xmm1
pxor xmm3, xmm3
pxor xmm4, xmm4
push rbp
cvtsi2sd xmm1, edi
mov r12, r8
mov rbp, r9
push rbx
cvtsi2sd xmm3, esi
mov rbx, rcx
cvtsi2sd xmm4, edx
sub rsp, 20h
movsd xmm0, cs:qword_20E0
divsd xmm4, xmm0
divsd xmm3, xmm0
movsd [rsp+38h+var_20], xmm4
divsd xmm1, xmm0
movapd xmm0, xmm3
movsd [rsp+38h+var_28], xmm3
movsd [rsp+38h+var_38], xmm1
movapd xmm1, xmm4
call _fmax
movapd xmm1, xmm0
movsd xmm0, [rsp+38h+var_38]
call _fmax
movsd xmm4, [rsp+38h+var_20]
movsd xmm3, [rsp+38h+var_28]
movsd [rsp+38h+var_30], xmm0
movapd xmm1, xmm4
movapd xmm0, xmm3
call _fmin
movapd xmm1, xmm0
movsd xmm0, [rsp+38h+var_38]
call _fmin
movsd xmm2, [rsp+38h+var_30]
pxor xmm5, xmm5
mov qword ptr [rbx], 0
movapd xmm6, xmm2
subsd xmm6, xmm0
comisd xmm6, xmm5
jbe short loc_1480
movsd xmm1, [rsp+38h+var_38]
movsd xmm3, [rsp+38h+var_28]
movsd xmm4, [rsp+38h+var_20]
ucomisd xmm1, xmm2
jp short loc_1462
jz short loc_14D0
loc_1462:
ucomisd xmm3, xmm2
jp short loc_146E
jz loc_1568
loc_146E:
ucomisd xmm4, xmm2
jp short loc_1480
jz loc_1518
nop word ptr [rax+rax+00h]
loc_1480:
ucomisd xmm2, xmm5
jp short loc_14B0
movsd xmm0, cs:qword_2108
jnz short loc_14B0
loc_1490:
mulsd xmm2, xmm0
movsd qword ptr [r12], xmm5
movsd qword ptr [rbp+0], xmm2
add rsp, 20h
pop rbx
pop rbp
pop r12
retn
loc_14B0:
divsd xmm6, xmm2
movsd xmm0, cs:qword_2108
movapd xmm5, xmm6
mulsd xmm5, xmm0
jmp short loc_1490
loc_14D0:
subsd xmm3, xmm4
movsd xmm1, cs:qword_20E8
movsd [rsp+38h+var_38], xmm6
movapd xmm0, xmm3
divsd xmm0, xmm6
mulsd xmm0, cs:qword_20F0
addsd xmm0, xmm1
loc_14F5:
call _fmod
movsd xmm6, [rsp+38h+var_38]
movsd xmm2, [rsp+38h+var_30]
pxor xmm5, xmm5
movsd qword ptr [rbx], xmm0
jmp loc_1480
loc_1518:
movsd xmm0, [rsp+38h+var_38]
movsd xmm1, cs:qword_20E8
movsd [rsp+38h+var_38], xmm6
movsd [rsp+38h+var_30], xmm2
subsd xmm0, xmm3
divsd xmm0, xmm6
mulsd xmm0, cs:qword_20F0
addsd xmm0, cs:qword_2100
call _fmod
movsd xmm2, [rsp+38h+var_30]
movsd xmm6, [rsp+38h+var_38]
pxor xmm5, xmm5
movsd qword ptr [rbx], xmm0
jmp loc_1480
loc_1568:
subsd xmm4, [rsp+38h+var_38]
movsd xmm1, cs:qword_20E8
movsd [rsp+38h+var_38], xmm6
movsd [rsp+38h+var_30], xmm2
movapd xmm0, xmm4
divsd xmm0, xmm6
mulsd xmm0, cs:qword_20F0
addsd xmm0, cs:qword_20F8
jmp loc_14F5 | void func0(int a1, int a2, int a3, double *a4, double *a5, double *a6)
{
double v9; // xmm0_8
double v10; // xmm0_8
double v11; // xmm0_8
double v12; // xmm2_8
double v13; // xmm5_8
double v14; // xmm6_8
double v15; // xmm0_8
double v16; // xmm0_8
double v17; // xmm0_8
double v18; // xmm4_8
double v19; // [rsp+0h] [rbp-38h]
double v20; // [rsp+0h] [rbp-38h]
double v21; // [rsp+8h] [rbp-30h]
double v22; // [rsp+10h] [rbp-28h]
double v23; // [rsp+18h] [rbp-20h]
v23 = (double)a3 / 255.0;
v22 = (double)a2 / 255.0;
v19 = (double)a1 / 255.0;
v9 = fmax(v22, v23);
v21 = fmax(v19, v9);
v10 = fmin(v22, v23);
v11 = fmin(v19, v10);
v12 = v21;
v13 = 0.0;
*a4 = 0.0;
v14 = v21 - v11;
if ( v21 - v11 <= 0.0 )
goto LABEL_6;
if ( v19 == v21 )
{
v20 = v21 - v11;
v15 = (v22 - v23) / v14 * 60.0 + 360.0;
LABEL_10:
v16 = fmod(v15, 360.0);
v14 = v20;
v12 = v21;
v13 = 0.0;
*a4 = v16;
goto LABEL_6;
}
if ( v22 == v21 )
{
v18 = v23 - v19;
v20 = v21 - v11;
v15 = v18 / v14 * 60.0 + 120.0;
goto LABEL_10;
}
if ( v23 == v21 )
{
v17 = fmod((v19 - v22) / v14 * 60.0 + 240.0, 360.0);
v13 = 0.0;
*a4 = v17;
}
LABEL_6:
if ( v12 != 0.0 )
v13 = v14 / v12 * 100.0;
*a5 = v13;
*a6 = v12 * 100.0;
} | func0:
ENDBR64
PUSH R12
PXOR XMM1,XMM1
PXOR XMM3,XMM3
PXOR XMM4,XMM4
PUSH RBP
CVTSI2SD XMM1,EDI
MOV R12,R8
MOV RBP,R9
PUSH RBX
CVTSI2SD XMM3,ESI
MOV RBX,RCX
CVTSI2SD XMM4,EDX
SUB RSP,0x20
MOVSD XMM0,qword ptr [0x001020e0]
DIVSD XMM4,XMM0
DIVSD XMM3,XMM0
MOVSD qword ptr [RSP + 0x18],XMM4
DIVSD XMM1,XMM0
MOVAPD XMM0,XMM3
MOVSD qword ptr [RSP + 0x10],XMM3
MOVSD qword ptr [RSP],XMM1
MOVAPD XMM1,XMM4
CALL 0x00101090
MOVAPD XMM1,XMM0
MOVSD XMM0,qword ptr [RSP]
CALL 0x00101090
MOVSD XMM4,qword ptr [RSP + 0x18]
MOVSD XMM3,qword ptr [RSP + 0x10]
MOVSD qword ptr [RSP + 0x8],XMM0
MOVAPD XMM1,XMM4
MOVAPD XMM0,XMM3
CALL 0x001010d0
MOVAPD XMM1,XMM0
MOVSD XMM0,qword ptr [RSP]
CALL 0x001010d0
MOVSD XMM2,qword ptr [RSP + 0x8]
PXOR XMM5,XMM5
MOV qword ptr [RBX],0x0
MOVAPD XMM6,XMM2
SUBSD XMM6,XMM0
COMISD XMM6,XMM5
JBE 0x00101480
MOVSD XMM1,qword ptr [RSP]
MOVSD XMM3,qword ptr [RSP + 0x10]
MOVSD XMM4,qword ptr [RSP + 0x18]
UCOMISD XMM1,XMM2
JP 0x00101462
JZ 0x001014d0
LAB_00101462:
UCOMISD XMM3,XMM2
JP 0x0010146e
JZ 0x00101568
LAB_0010146e:
UCOMISD XMM4,XMM2
JP 0x00101480
JZ 0x00101518
NOP word ptr [RAX + RAX*0x1]
LAB_00101480:
UCOMISD XMM2,XMM5
JP 0x001014b0
MOVSD XMM0,qword ptr [0x00102108]
JNZ 0x001014b0
LAB_00101490:
MULSD XMM2,XMM0
MOVSD qword ptr [R12],XMM5
MOVSD qword ptr [RBP],XMM2
ADD RSP,0x20
POP RBX
POP RBP
POP R12
RET
LAB_001014b0:
DIVSD XMM6,XMM2
MOVSD XMM0,qword ptr [0x00102108]
MOVAPD XMM5,XMM6
MULSD XMM5,XMM0
JMP 0x00101490
LAB_001014d0:
SUBSD XMM3,XMM4
MOVSD XMM1,qword ptr [0x001020e8]
MOVSD qword ptr [RSP],XMM6
MOVAPD XMM0,XMM3
DIVSD XMM0,XMM6
MULSD XMM0,qword ptr [0x001020f0]
ADDSD XMM0,XMM1
LAB_001014f5:
CALL 0x001010c0
MOVSD XMM6,qword ptr [RSP]
MOVSD XMM2,qword ptr [RSP + 0x8]
PXOR XMM5,XMM5
MOVSD qword ptr [RBX],XMM0
JMP 0x00101480
LAB_00101518:
MOVSD XMM0,qword ptr [RSP]
MOVSD XMM1,qword ptr [0x001020e8]
MOVSD qword ptr [RSP],XMM6
MOVSD qword ptr [RSP + 0x8],XMM2
SUBSD XMM0,XMM3
DIVSD XMM0,XMM6
MULSD XMM0,qword ptr [0x001020f0]
ADDSD XMM0,qword ptr [0x00102100]
CALL 0x001010c0
MOVSD XMM2,qword ptr [RSP + 0x8]
MOVSD XMM6,qword ptr [RSP]
PXOR XMM5,XMM5
MOVSD qword ptr [RBX],XMM0
JMP 0x00101480
LAB_00101568:
SUBSD XMM4,qword ptr [RSP]
MOVSD XMM1,qword ptr [0x001020e8]
MOVSD qword ptr [RSP],XMM6
MOVSD qword ptr [RSP + 0x8],XMM2
MOVAPD XMM0,XMM4
DIVSD XMM0,XMM6
MULSD XMM0,qword ptr [0x001020f0]
ADDSD XMM0,qword ptr [0x001020f8]
JMP 0x001014f5 | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
void func0(int param_1,int param_2,int param_3,double *param_4,double *param_5,double *param_6)
{
double dVar1;
double dVar2;
double dVar3;
double __x;
double __y;
__y = (double)param_3 / DAT_001020e0;
__x = (double)param_2 / DAT_001020e0;
dVar3 = (double)param_1 / DAT_001020e0;
dVar1 = fmax(__x,__y);
dVar1 = fmax(dVar3,dVar1);
dVar2 = fmin(__x,__y);
dVar2 = fmin(dVar3,dVar2);
*param_4 = 0.0;
dVar2 = dVar1 - dVar2;
if (0.0 < dVar2) {
if (dVar3 == dVar1) {
dVar3 = ((__x - __y) / dVar2) * _DAT_001020f0 + DAT_001020e8;
}
else {
if (__x != dVar1) {
if (__y == dVar1) {
dVar3 = fmod(((dVar3 - __x) / dVar2) * _DAT_001020f0 + _DAT_00102100,DAT_001020e8);
*param_4 = dVar3;
}
goto LAB_00101480;
}
dVar3 = ((__y - dVar3) / dVar2) * _DAT_001020f0 + DAT_001020f8;
}
dVar3 = fmod(dVar3,DAT_001020e8);
*param_4 = dVar3;
}
LAB_00101480:
dVar3 = 0.0;
if (dVar1 != 0.0) {
dVar3 = (dVar2 / dVar1) * DAT_00102108;
}
dVar1 = dVar1 * DAT_00102108;
*param_5 = dVar3;
*param_6 = dVar1;
return;
} |
7,027 | func0 | #include <math.h>
#include <stdio.h>
#include <assert.h>
| void func0(int r, int g, int b, double *h, double *s, double *v) {
double rd = r / 255.0;
double gd = g / 255.0;
double bd = b / 255.0;
double mx = fmax(rd, fmax(gd, bd));
double mn = fmin(rd, fmin(gd, bd));
double df = mx - mn;
*h = 0;
if (df > 0) {
if (mx == rd) {
*h = fmod((60.0 * ((gd - bd) / df) + 360.0), 360.0);
} else if (mx == gd) {
*h = fmod((60.0 * ((bd - rd) / df) + 120.0), 360.0);
} else if (mx == bd) {
*h = fmod((60.0 * ((rd - gd) / df) + 240.0), 360.0);
}
}
if (mx == 0) {
*s = 0;
} else {
*s = (df / mx) * 100.0;
}
*v = mx * 100.0;
}
| int main() {
double h, s, v;
func0(255, 255, 255, &h, &s, &v);
assert(h == 0 && s == 0.0 && v == 100.0);
func0(0, 215, 0, &h, &s, &v);
assert(h == 120.0 && s == 100.0 && v == 84.31372549019608);
func0(10, 215, 110, &h, &s, &v);
assert(h == 149.26829268292684 && s == 95.34883720930233 && v == 84.31372549019608);
return 0;
}
| O3 | c | func0:
endbr64
push %r12
pxor %xmm1,%xmm1
pxor %xmm3,%xmm3
pxor %xmm4,%xmm4
push %rbp
cvtsi2sd %edi,%xmm1
mov %r8,%r12
mov %r9,%rbp
push %rbx
cvtsi2sd %esi,%xmm3
mov %rcx,%rbx
cvtsi2sd %edx,%xmm4
sub $0x20,%rsp
movsd 0xd3b(%rip),%xmm0
divsd %xmm0,%xmm4
divsd %xmm0,%xmm3
movsd %xmm4,0x18(%rsp)
divsd %xmm0,%xmm1
movapd %xmm3,%xmm0
movsd %xmm3,0x10(%rsp)
movsd %xmm1,(%rsp)
movapd %xmm4,%xmm1
callq 1090 <fmax@plt>
movapd %xmm0,%xmm1
movsd (%rsp),%xmm0
callq 1090 <fmax@plt>
movsd 0x18(%rsp),%xmm4
movsd 0x10(%rsp),%xmm3
movsd %xmm0,0x8(%rsp)
movapd %xmm4,%xmm1
movapd %xmm3,%xmm0
callq 10d0 <fmin@plt>
movapd %xmm0,%xmm1
movsd (%rsp),%xmm0
callq 10d0 <fmin@plt>
movsd 0x8(%rsp),%xmm2
pxor %xmm5,%xmm5
movq $0x0,(%rbx)
movapd %xmm2,%xmm6
subsd %xmm0,%xmm6
comisd %xmm5,%xmm6
jbe 1478 <func0+0xe8>
movsd (%rsp),%xmm1
movsd 0x10(%rsp),%xmm3
movsd 0x18(%rsp),%xmm4
ucomisd %xmm2,%xmm1
jnp 14c0 <func0+0x130>
ucomisd %xmm2,%xmm3
jnp 1560 <func0+0x1d0>
ucomisd %xmm2,%xmm4
jnp 1508 <func0+0x178>
nopl 0x0(%rax)
ucomisd %xmm5,%xmm2
jp 14a0 <func0+0x110>
jne 14a0 <func0+0x110>
movsd 0xca0(%rip),%xmm0
mulsd %xmm0,%xmm2
movsd %xmm5,(%r12)
movsd %xmm2,0x0(%rbp)
add $0x20,%rsp
pop %rbx
pop %rbp
pop %r12
retq
divsd %xmm2,%xmm6
movsd 0xc7c(%rip),%xmm0
movapd %xmm6,%xmm5
mulsd %xmm0,%xmm5
jmp 1488 <func0+0xf8>
nopw %cs:0x0(%rax,%rax,1)
jne 1460 <func0+0xd0>
subsd %xmm4,%xmm3
movsd 0xc3a(%rip),%xmm1
movsd %xmm6,(%rsp)
movapd %xmm3,%xmm0
divsd %xmm6,%xmm0
mulsd 0xc2d(%rip),%xmm0
addsd %xmm1,%xmm0
callq 10c0 <fmod@plt>
movsd (%rsp),%xmm6
movsd 0x8(%rsp),%xmm2
pxor %xmm5,%xmm5
movsd %xmm0,(%rbx)
jmpq 1478 <func0+0xe8>
nopl 0x0(%rax)
jne 1478 <func0+0xe8>
movsd (%rsp),%xmm0
movsd 0xbed(%rip),%xmm1
movsd %xmm6,(%rsp)
movsd %xmm2,0x8(%rsp)
subsd %xmm3,%xmm0
divsd %xmm6,%xmm0
mulsd 0xbda(%rip),%xmm0
addsd 0xbe2(%rip),%xmm0
callq 10c0 <fmod@plt>
movsd 0x8(%rsp),%xmm2
movsd (%rsp),%xmm6
pxor %xmm5,%xmm5
movsd %xmm0,(%rbx)
jmpq 1478 <func0+0xe8>
nopl 0x0(%rax,%rax,1)
jne 146a <func0+0xda>
subsd (%rsp),%xmm4
movsd 0xb95(%rip),%xmm1
movsd %xmm6,(%rsp)
movsd %xmm2,0x8(%rsp)
movapd %xmm4,%xmm0
divsd %xmm6,%xmm0
mulsd 0xb82(%rip),%xmm0
addsd 0xb82(%rip),%xmm0
jmpq 14e7 <func0+0x157>
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
push r12
pxor xmm1, xmm1
mov r12, rcx
push rbp
cvtsi2sd xmm1, edi
mov rbp, r8
push rbx
mov rbx, r9
sub rsp, 20h
movsd xmm0, cs:qword_20E0
divsd xmm1, xmm0
movsd [rsp+38h+y], xmm1
pxor xmm1, xmm1
cvtsi2sd xmm1, esi
movapd xmm5, xmm1
pxor xmm1, xmm1
cvtsi2sd xmm1, edx
divsd xmm5, xmm0
movapd xmm6, xmm1
divsd xmm6, xmm0
movapd xmm0, xmm5; x
movsd [rsp+38h+x], xmm5
movapd xmm1, xmm6; y
movsd [rsp+38h+var_28], xmm6
call _fmax
movsd xmm1, [rsp+38h+y]; y
call _fmax
movsd xmm1, [rsp+38h+var_28]; y
movsd [rsp+38h+var_20], xmm0
movsd xmm0, [rsp+38h+x]; x
call _fmin
movsd xmm1, [rsp+38h+y]; y
call _fmin
movsd xmm2, [rsp+38h+var_20]
mov qword ptr [r12], 0
movapd xmm3, xmm2
subsd xmm3, xmm0
pxor xmm0, xmm0
comisd xmm3, xmm0
jbe short loc_1478
movsd xmm1, [rsp+38h+y]
ucomisd xmm1, xmm2
jp short loc_144F
jz short loc_14C8
loc_144F:
movsd xmm7, [rsp+38h+x]
ucomisd xmm7, xmm2
jp short loc_1461
jz loc_1570
loc_1461:
movsd xmm7, [rsp+38h+var_28]
ucomisd xmm7, xmm2
jp short loc_1478
jz loc_1530
nop dword ptr [rax+rax+00h]
loc_1478:
pxor xmm0, xmm0
ucomisd xmm2, xmm0
jp short loc_14B0
jnz short loc_14B0
movsd xmm0, cs:qword_2108
pxor xmm3, xmm3
loc_1490:
mulsd xmm2, xmm0
movsd qword ptr [rbp+0], xmm3
movsd qword ptr [rbx], xmm2
add rsp, 20h
pop rbx
pop rbp
pop r12
retn
loc_14B0:
divsd xmm3, xmm2
movsd xmm0, cs:qword_2108
mulsd xmm3, xmm0
jmp short loc_1490
loc_14C8:
movsd xmm0, [rsp+38h+x]
subsd xmm0, [rsp+38h+var_28]
fld cs:y
divsd xmm0, xmm3
mulsd xmm0, cs:qword_20E8
addsd xmm0, cs:y
movsd [rsp+38h+x], xmm0
fld [rsp+38h+x]
loc_14F8:
fprem
fnstsw ax
test ah, 4
jnz short loc_14F8
fstp st(1)
jmp short loc_1512
loc_1508:
fstp st(1)
jmp short loc_1512
loc_1510:
fstp st(1)
loc_1512:
fstp [rsp+38h+y]
movsd xmm4, [rsp+38h+y]
ucomisd xmm4, xmm4
jp loc_15AE
loc_1524:
movsd qword ptr [r12], xmm4
jmp loc_1478
loc_1530:
movsd xmm0, [rsp+38h+y]
subsd xmm0, [rsp+38h+x]
fld cs:y
divsd xmm0, xmm3
mulsd xmm0, cs:qword_20E8
addsd xmm0, cs:qword_2100
movsd [rsp+38h+x], xmm0
fld [rsp+38h+x]
loc_155F:
fprem
fnstsw ax
test ah, 4
jz short loc_1508
jmp short loc_155F
loc_1570:
movsd xmm0, [rsp+38h+var_28]
subsd xmm0, [rsp+38h+y]
fld cs:y
divsd xmm0, xmm3
mulsd xmm0, cs:qword_20E8
addsd xmm0, cs:qword_20F8
movsd [rsp+38h+x], xmm0
fld [rsp+38h+x]
loc_159F:
fprem
fnstsw ax
test ah, 4
jz loc_1510
jmp short loc_159F
loc_15AE:
movsd xmm1, cs:y; y
movsd xmm0, [rsp+38h+x]; x
movsd [rsp+38h+var_20], xmm3
movsd [rsp+38h+var_28], xmm2
call _fmod
movsd xmm3, [rsp+38h+var_20]
movsd xmm2, [rsp+38h+var_28]
movsd xmm4, [rsp+38h+y]
jmp loc_1524 | void func0(int a1, int a2, int a3, double *a4, double *a5, double *a6)
{
double v9; // xmm0_8
double v10; // xmm0_8
double v11; // xmm0_8
double v12; // xmm3_8
double v13; // xmm3_8
long double v14; // fst6
char v16; // c2
long double v17; // fst7
long double v18; // fst6
char v20; // c2
long double v21; // fst6
char v23; // c2
double y; // [rsp+0h] [rbp-38h]
double x; // [rsp+8h] [rbp-30h]
double v26; // [rsp+10h] [rbp-28h]
double v27; // [rsp+18h] [rbp-20h]
y = (double)a1 / 255.0;
x = (double)a2 / 255.0;
v26 = (double)a3 / 255.0;
v9 = fmax(x, v26);
v27 = fmax(v9, y);
v10 = fmin(x, v26);
v11 = fmin(v10, y);
*a4 = 0.0;
v12 = v27 - v11;
if ( v27 - v11 <= 0.0 )
goto LABEL_5;
if ( y == v27 )
{
v14 = (x - v26) / v12 * 60.0 + 360.0;
do
v14 = __FPREM__(v14, 360.0);
while ( v16 );
v17 = v14;
}
else if ( x == v27 )
{
v21 = (v26 - y) / v12 * 60.0 + 120.0;
do
v21 = __FPREM__(v21, 360.0);
while ( v23 );
v17 = v21;
}
else
{
if ( v26 != v27 )
goto LABEL_5;
v18 = (y - x) / v12 * 60.0 + 240.0;
do
v18 = __FPREM__(v18, 360.0);
while ( v20 );
v17 = v18;
}
*a4 = v17;
LABEL_5:
if ( v27 == 0.0 )
v13 = 0.0;
else
v13 = v12 / v27 * 100.0;
*a5 = v13;
*a6 = v27 * 100.0;
} | func0:
ENDBR64
PUSH R12
PXOR XMM1,XMM1
MOV R12,RCX
PUSH RBP
CVTSI2SD XMM1,EDI
MOV RBP,R8
PUSH RBX
MOV RBX,R9
SUB RSP,0x20
MOVSD XMM0,qword ptr [0x001020e0]
DIVSD XMM1,XMM0
MOVSD qword ptr [RSP],XMM1
PXOR XMM1,XMM1
CVTSI2SD XMM1,ESI
MOVAPD XMM5,XMM1
PXOR XMM1,XMM1
CVTSI2SD XMM1,EDX
DIVSD XMM5,XMM0
MOVAPD XMM6,XMM1
DIVSD XMM6,XMM0
MOVAPD XMM0,XMM5
MOVSD qword ptr [RSP + 0x8],XMM5
MOVAPD XMM1,XMM6
MOVSD qword ptr [RSP + 0x10],XMM6
CALL 0x00101090
MOVSD XMM1,qword ptr [RSP]
CALL 0x00101090
MOVSD XMM1,qword ptr [RSP + 0x10]
MOVSD qword ptr [RSP + 0x18],XMM0
MOVSD XMM0,qword ptr [RSP + 0x8]
CALL 0x001010c0
MOVSD XMM1,qword ptr [RSP]
CALL 0x001010c0
MOVSD XMM2,qword ptr [RSP + 0x18]
MOV qword ptr [R12],0x0
MOVAPD XMM3,XMM2
SUBSD XMM3,XMM0
PXOR XMM0,XMM0
COMISD XMM3,XMM0
JBE 0x00101478
MOVSD XMM1,qword ptr [RSP]
UCOMISD XMM1,XMM2
JP 0x0010144f
JZ 0x001014c8
LAB_0010144f:
MOVSD XMM7,qword ptr [RSP + 0x8]
UCOMISD XMM7,XMM2
JP 0x00101461
JZ 0x00101570
LAB_00101461:
MOVSD XMM7,qword ptr [RSP + 0x10]
UCOMISD XMM7,XMM2
JP 0x00101478
JZ 0x00101530
NOP dword ptr [RAX + RAX*0x1]
LAB_00101478:
PXOR XMM0,XMM0
UCOMISD XMM2,XMM0
JP 0x001014b0
JNZ 0x001014b0
MOVSD XMM0,qword ptr [0x00102108]
PXOR XMM3,XMM3
LAB_00101490:
MULSD XMM2,XMM0
MOVSD qword ptr [RBP],XMM3
MOVSD qword ptr [RBX],XMM2
ADD RSP,0x20
POP RBX
POP RBP
POP R12
RET
LAB_001014b0:
DIVSD XMM3,XMM2
MOVSD XMM0,qword ptr [0x00102108]
MULSD XMM3,XMM0
JMP 0x00101490
LAB_001014c8:
MOVSD XMM0,qword ptr [RSP + 0x8]
SUBSD XMM0,qword ptr [RSP + 0x10]
FLD qword ptr [0x001020f0]
DIVSD XMM0,XMM3
MULSD XMM0,qword ptr [0x001020e8]
ADDSD XMM0,qword ptr [0x001020f0]
MOVSD qword ptr [RSP + 0x8],XMM0
FLD qword ptr [RSP + 0x8]
LAB_001014f8:
FPREM
FNSTSW AX
TEST AH,0x4
JNZ 0x001014f8
FSTP ST1
JMP 0x00101512
LAB_00101508:
FSTP ST1
JMP 0x00101512
LAB_00101510:
FSTP ST1
LAB_00101512:
FSTP qword ptr [RSP]
MOVSD XMM4,qword ptr [RSP]
UCOMISD XMM4,XMM4
JP 0x001015ae
LAB_00101524:
MOVSD qword ptr [R12],XMM4
JMP 0x00101478
LAB_00101530:
MOVSD XMM0,qword ptr [RSP]
SUBSD XMM0,qword ptr [RSP + 0x8]
FLD qword ptr [0x001020f0]
DIVSD XMM0,XMM3
MULSD XMM0,qword ptr [0x001020e8]
ADDSD XMM0,qword ptr [0x00102100]
MOVSD qword ptr [RSP + 0x8],XMM0
FLD qword ptr [RSP + 0x8]
LAB_0010155f:
FPREM
FNSTSW AX
TEST AH,0x4
JZ 0x00101508
JMP 0x0010155f
LAB_00101570:
MOVSD XMM0,qword ptr [RSP + 0x10]
SUBSD XMM0,qword ptr [RSP]
FLD qword ptr [0x001020f0]
DIVSD XMM0,XMM3
MULSD XMM0,qword ptr [0x001020e8]
ADDSD XMM0,qword ptr [0x001020f8]
MOVSD qword ptr [RSP + 0x8],XMM0
FLD qword ptr [RSP + 0x8]
LAB_0010159f:
FPREM
FNSTSW AX
TEST AH,0x4
JZ 0x00101510
JMP 0x0010159f
LAB_001015ae:
MOVSD XMM1,qword ptr [0x001020f0]
MOVSD XMM0,qword ptr [RSP + 0x8]
MOVSD qword ptr [RSP + 0x18],XMM3
MOVSD qword ptr [RSP + 0x10],XMM2
CALL 0x001010d0
MOVSD XMM3,qword ptr [RSP + 0x18]
MOVSD XMM2,qword ptr [RSP + 0x10]
MOVSD XMM4,qword ptr [RSP]
JMP 0x00101524 | /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
void func0(int param_1,int param_2,int param_3,double *param_4,double *param_5,double *param_6)
{
ushort in_FPUStatusWord;
double dVar1;
double dVar2;
double dVar3;
double __x;
double __y;
double local_30;
dVar3 = (double)param_1 / DAT_001020e0;
__x = (double)param_2 / DAT_001020e0;
__y = (double)param_3 / DAT_001020e0;
dVar1 = fmax(__x,__y);
dVar1 = fmax(dVar1,dVar3);
dVar2 = fmin(__x,__y);
dVar2 = fmin(dVar2,dVar3);
*param_4 = 0.0;
dVar2 = dVar1 - dVar2;
if (0.0 < dVar2) {
if (dVar3 == dVar1) {
local_30 = ((__x - __y) / dVar2) * _DAT_001020e8 + DAT_001020f0;
dVar3 = local_30;
do {
dVar3 = dVar3 - (dVar3 / DAT_001020f0) * DAT_001020f0;
} while ((in_FPUStatusWord & 0x400) != 0);
}
else if (__x == dVar1) {
local_30 = ((__y - dVar3) / dVar2) * _DAT_001020e8 + DAT_001020f8;
dVar3 = local_30;
do {
dVar3 = dVar3 - (dVar3 / DAT_001020f0) * DAT_001020f0;
} while ((in_FPUStatusWord & 0x400) != 0);
}
else {
if (__y != dVar1) goto LAB_00101478;
local_30 = ((dVar3 - __x) / dVar2) * _DAT_001020e8 + _DAT_00102100;
dVar3 = local_30;
do {
dVar3 = dVar3 - (dVar3 / DAT_001020f0) * DAT_001020f0;
} while ((in_FPUStatusWord & 0x400) != 0);
}
if (NAN(dVar3)) {
fmod(local_30,DAT_001020f0);
}
*param_4 = dVar3;
}
LAB_00101478:
if (dVar1 == 0.0) {
dVar2 = 0.0;
}
else {
dVar2 = (dVar2 / dVar1) * DAT_00102108;
}
dVar1 = dVar1 * DAT_00102108;
*param_5 = dVar2;
*param_6 = dVar1;
return;
} |
7,028 | func0 | #include <assert.h>
| int func0(int list1[], int n) {
int first_even = -1;
int first_odd = -1;
for (int i = 0; i < n; i++) {
if (list1[i] % 2 == 0 && first_even == -1) {
first_even = list1[i];
}
if (list1[i] % 2 != 0 && first_odd == -1) {
first_odd = list1[i];
}
if (first_even != -1 && first_odd != -1) {
break;
}
}
return first_even * first_odd;
}
| int main() {
int list1[] = {1,3,5,7,4,1,6,8};
int n1 = sizeof(list1) / sizeof(list1[0]);
assert(func0(list1, n1) == 4);
int list2[] = {1,2,3,4,5,6,7,8,9,10};
int n2 = sizeof(list2) / sizeof(list2[0]);
assert(func0(list2, n2) == 2);
int list3[] = {1,5,7,9,10};
int n3 = sizeof(list3) / sizeof(list3[0]);
assert(func0(list3, n3) == 10);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
movl $0xffffffff,-0xc(%rbp)
movl $0xffffffff,-0x8(%rbp)
movl $0x0,-0x4(%rbp)
jmpq 121a <func0+0xb1>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
and $0x1,%eax
test %eax,%eax
jne 11ce <func0+0x65>
cmpl $0xffffffff,-0xc(%rbp)
jne 11ce <func0+0x65>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
mov %eax,-0xc(%rbp)
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
and $0x1,%eax
test %eax,%eax
je 120a <func0+0xa1>
cmpl $0xffffffff,-0x8(%rbp)
jne 120a <func0+0xa1>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
mov %eax,-0x8(%rbp)
cmpl $0xffffffff,-0xc(%rbp)
je 1216 <func0+0xad>
cmpl $0xffffffff,-0x8(%rbp)
jne 1228 <func0+0xbf>
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 1192 <func0+0x29>
jmp 1229 <func0+0xc0>
mov -0xc(%rbp),%eax
imul -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_C], 0FFFFFFFFh
mov [rbp+var_8], 0FFFFFFFFh
mov [rbp+var_4], 0
jmp loc_121A
loc_1192:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
and eax, 1
test eax, eax
jnz short loc_11CE
cmp [rbp+var_C], 0FFFFFFFFh
jnz short loc_11CE
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
mov [rbp+var_C], eax
loc_11CE:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
and eax, 1
test eax, eax
jz short loc_120A
cmp [rbp+var_8], 0FFFFFFFFh
jnz short loc_120A
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov eax, [rax]
mov [rbp+var_8], eax
loc_120A:
cmp [rbp+var_C], 0FFFFFFFFh
jz short loc_1216
cmp [rbp+var_8], 0FFFFFFFFh
jnz short loc_1228
loc_1216:
add [rbp+var_4], 1
loc_121A:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl loc_1192
jmp short loc_1229
loc_1228:
nop
loc_1229:
mov eax, [rbp+var_C]
imul eax, [rbp+var_8]
pop rbp
retn | long long func0(long long a1, int a2)
{
int v3; // [rsp+10h] [rbp-Ch]
int v4; // [rsp+14h] [rbp-8h]
int i; // [rsp+18h] [rbp-4h]
v3 = -1;
v4 = -1;
for ( i = 0; i < a2; ++i )
{
if ( (*(_DWORD *)(4LL * i + a1) & 1) == 0 && v3 == -1 )
v3 = *(_DWORD *)(4LL * i + a1);
if ( (*(_DWORD *)(4LL * i + a1) & 1) != 0 && v4 == -1 )
v4 = *(_DWORD *)(4LL * i + a1);
if ( v3 != -1 && v4 != -1 )
break;
}
return (unsigned int)(v4 * 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],0xffffffff
MOV dword ptr [RBP + -0x8],0xffffffff
MOV dword ptr [RBP + -0x4],0x0
JMP 0x0010121a
LAB_00101192:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
AND EAX,0x1
TEST EAX,EAX
JNZ 0x001011ce
CMP dword ptr [RBP + -0xc],-0x1
JNZ 0x001011ce
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
MOV dword ptr [RBP + -0xc],EAX
LAB_001011ce:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
AND EAX,0x1
TEST EAX,EAX
JZ 0x0010120a
CMP dword ptr [RBP + -0x8],-0x1
JNZ 0x0010120a
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EAX,dword ptr [RAX]
MOV dword ptr [RBP + -0x8],EAX
LAB_0010120a:
CMP dword ptr [RBP + -0xc],-0x1
JZ 0x00101216
CMP dword ptr [RBP + -0x8],-0x1
JNZ 0x00101228
LAB_00101216:
ADD dword ptr [RBP + -0x4],0x1
LAB_0010121a:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x00101192
JMP 0x00101229
LAB_00101228:
NOP
LAB_00101229:
MOV EAX,dword ptr [RBP + -0xc]
IMUL EAX,dword ptr [RBP + -0x8]
POP RBP
RET | int func0(long param_1,int param_2)
{
int local_14;
int local_10;
int local_c;
local_14 = -1;
local_10 = -1;
for (local_c = 0; local_c < param_2; local_c = local_c + 1) {
if (((*(uint *)(param_1 + (long)local_c * 4) & 1) == 0) && (local_14 == -1)) {
local_14 = *(int *)(param_1 + (long)local_c * 4);
}
if (((*(uint *)(param_1 + (long)local_c * 4) & 1) != 0) && (local_10 == -1)) {
local_10 = *(int *)(param_1 + (long)local_c * 4);
}
if ((local_14 != -1) && (local_10 != -1)) break;
}
return local_14 * local_10;
} |
7,029 | func0 | #include <assert.h>
| int func0(int list1[], int n) {
int first_even = -1;
int first_odd = -1;
for (int i = 0; i < n; i++) {
if (list1[i] % 2 == 0 && first_even == -1) {
first_even = list1[i];
}
if (list1[i] % 2 != 0 && first_odd == -1) {
first_odd = list1[i];
}
if (first_even != -1 && first_odd != -1) {
break;
}
}
return first_even * first_odd;
}
| int main() {
int list1[] = {1,3,5,7,4,1,6,8};
int n1 = sizeof(list1) / sizeof(list1[0]);
assert(func0(list1, n1) == 4);
int list2[] = {1,2,3,4,5,6,7,8,9,10};
int n2 = sizeof(list2) / sizeof(list2[0]);
assert(func0(list2, n2) == 2);
int list3[] = {1,5,7,9,10};
int n3 = sizeof(list3) / sizeof(list3[0]);
assert(func0(list3, n3) == 10);
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 11b9 <func0+0x50>
mov %rdi,%rdx
lea -0x1(%rsi),%eax
lea 0x4(%rdi,%rax,4),%r8
mov $0xffffffff,%esi
mov $0xffffffff,%eax
jmp 11a5 <func0+0x3c>
cmp $0xffffffff,%esi
jne 1192 <func0+0x29>
test %edi,%edi
cmovne %ecx,%esi
cmp $0xffffffff,%eax
je 119c <func0+0x33>
cmp $0xffffffff,%esi
jne 11c3 <func0+0x5a>
add $0x4,%rdx
cmp %r8,%rdx
je 11c3 <func0+0x5a>
mov (%rdx),%ecx
mov %ecx,%edi
and $0x1,%edi
cmp $0xffffffff,%eax
jne 1188 <func0+0x1f>
test %edi,%edi
jne 1188 <func0+0x1f>
mov %ecx,%eax
jmp 1192 <func0+0x29>
mov $0xffffffff,%esi
mov $0xffffffff,%eax
imul %esi,%eax
retq
| func0:
endbr64
test esi, esi
jle short loc_11B9
mov rdx, rdi
lea eax, [rsi-1]
lea r8, [rdi+rax*4+4]
mov esi, 0FFFFFFFFh
mov eax, 0FFFFFFFFh
jmp short loc_11A5
loc_1188:
cmp esi, 0FFFFFFFFh
jnz short loc_1192
test edi, edi
cmovnz esi, ecx
loc_1192:
cmp eax, 0FFFFFFFFh
jz short loc_119C
cmp esi, 0FFFFFFFFh
jnz short loc_11C3
loc_119C:
add rdx, 4
cmp rdx, r8
jz short loc_11C3
loc_11A5:
mov ecx, [rdx]
mov edi, ecx
and edi, 1
cmp eax, 0FFFFFFFFh
jnz short loc_1188
test edi, edi
jnz short loc_1188
mov eax, ecx
jmp short loc_1192
loc_11B9:
mov esi, 0FFFFFFFFh
mov eax, 0FFFFFFFFh
loc_11C3:
imul eax, esi
retn | long long func0(int *a1, int a2)
{
int *v2; // rdx
long long v3; // r8
int v4; // esi
int v5; // eax
int v6; // edi
if ( a2 <= 0 )
{
v4 = -1;
v5 = -1;
}
else
{
v2 = a1;
v3 = (long long)&a1[a2 - 1 + 1];
v4 = -1;
v5 = -1;
do
{
v6 = *v2 & 1;
if ( v5 != -1 || v6 )
{
if ( v4 == -1 && v6 )
v4 = *v2;
}
else
{
v5 = *v2;
}
if ( v5 != -1 && v4 != -1 )
break;
++v2;
}
while ( v2 != (int *)v3 );
}
return (unsigned int)(v4 * v5);
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001011b9
MOV RDX,RDI
LEA EAX,[RSI + -0x1]
LEA R8,[RDI + RAX*0x4 + 0x4]
MOV ESI,0xffffffff
MOV EAX,0xffffffff
JMP 0x001011a5
LAB_00101188:
CMP ESI,-0x1
JNZ 0x00101192
TEST EDI,EDI
CMOVNZ ESI,ECX
LAB_00101192:
CMP EAX,-0x1
JZ 0x0010119c
CMP ESI,-0x1
JNZ 0x001011c3
LAB_0010119c:
ADD RDX,0x4
CMP RDX,R8
JZ 0x001011c3
LAB_001011a5:
MOV ECX,dword ptr [RDX]
MOV EDI,ECX
AND EDI,0x1
CMP EAX,-0x1
JNZ 0x00101188
TEST EDI,EDI
JNZ 0x00101188
MOV EAX,ECX
JMP 0x00101192
LAB_001011b9:
MOV ESI,0xffffffff
MOV EAX,0xffffffff
LAB_001011c3:
IMUL EAX,ESI
RET | int func0(uint *param_1,int param_2)
{
uint *puVar1;
uint uVar2;
uint uVar3;
uint uVar4;
uint uVar5;
if (param_2 < 1) {
uVar5 = 0xffffffff;
uVar3 = 0xffffffff;
}
else {
puVar1 = param_1 + (ulong)(param_2 - 1) + 1;
uVar5 = 0xffffffff;
uVar4 = 0xffffffff;
do {
uVar2 = *param_1;
if ((((uVar4 != 0xffffffff) || (uVar3 = uVar2, (uVar2 & 1) != 0)) &&
(uVar3 = uVar4, uVar5 == 0xffffffff)) && ((uVar2 & 1) != 0)) {
uVar5 = uVar2;
}
} while (((uVar3 == 0xffffffff) || (uVar5 == 0xffffffff)) &&
(param_1 = param_1 + 1, uVar4 = uVar3, param_1 != puVar1));
}
return uVar3 * uVar5;
} |
7,030 | func0 | #include <assert.h>
| int func0(int list1[], int n) {
int first_even = -1;
int first_odd = -1;
for (int i = 0; i < n; i++) {
if (list1[i] % 2 == 0 && first_even == -1) {
first_even = list1[i];
}
if (list1[i] % 2 != 0 && first_odd == -1) {
first_odd = list1[i];
}
if (first_even != -1 && first_odd != -1) {
break;
}
}
return first_even * first_odd;
}
| int main() {
int list1[] = {1,3,5,7,4,1,6,8};
int n1 = sizeof(list1) / sizeof(list1[0]);
assert(func0(list1, n1) == 4);
int list2[] = {1,2,3,4,5,6,7,8,9,10};
int n2 = sizeof(list2) / sizeof(list2[0]);
assert(func0(list2, n2) == 2);
int list3[] = {1,5,7,9,10};
int n3 = sizeof(list3) / sizeof(list3[0]);
assert(func0(list3, n3) == 10);
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 1344 <func0+0x54>
lea -0x1(%rsi),%eax
mov $0xffffffff,%ecx
lea 0x4(%rdi,%rax,4),%rsi
mov $0xffffffff,%eax
jmp 1329 <func0+0x39>
nopl 0x0(%rax)
cmp $0xffffffff,%eax
cmove %edx,%eax
cmp $0xffffffff,%eax
je 1320 <func0+0x30>
cmp $0xffffffff,%ecx
jne 1340 <func0+0x50>
add $0x4,%rdi
cmp %rsi,%rdi
je 1340 <func0+0x50>
mov (%rdi),%edx
test $0x1,%dl
je 1310 <func0+0x20>
cmp $0xffffffff,%ecx
cmove %edx,%ecx
jmp 1316 <func0+0x26>
nopl 0x0(%rax,%rax,1)
imul %ecx,%eax
retq
mov $0x1,%eax
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_1344
lea eax, [rsi-1]
mov ecx, 0FFFFFFFFh
lea rsi, [rdi+rax*4+4]
mov eax, 0FFFFFFFFh
jmp short loc_1329
loc_1310:
cmp ecx, 0FFFFFFFFh
cmovz ecx, edx
loc_1316:
cmp ecx, 0FFFFFFFFh
jz short loc_1320
cmp eax, 0FFFFFFFFh
jnz short loc_1340
loc_1320:
add rdi, 4
cmp rdi, rsi
jz short loc_1340
loc_1329:
mov edx, [rdi]
test dl, 1
jz short loc_1310
cmp eax, 0FFFFFFFFh
cmovz eax, edx
jmp short loc_1316
loc_1340:
imul eax, ecx
retn
loc_1344:
mov eax, 1
retn | long long func0(int *a1, int a2)
{
int v2; // ecx
long long v3; // rsi
int v4; // eax
if ( a2 <= 0 )
return 1LL;
v2 = -1;
v3 = (long long)&a1[a2 - 1 + 1];
v4 = -1;
do
{
if ( (*a1 & 1) != 0 )
{
if ( v4 == -1 )
v4 = *a1;
}
else if ( v2 == -1 )
{
v2 = *a1;
}
if ( v2 != -1 && v4 != -1 )
break;
++a1;
}
while ( a1 != (int *)v3 );
return (unsigned int)(v2 * v4);
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101344
LEA EAX,[RSI + -0x1]
MOV ECX,0xffffffff
LEA RSI,[RDI + RAX*0x4 + 0x4]
MOV EAX,0xffffffff
JMP 0x00101329
LAB_00101310:
CMP ECX,-0x1
CMOVZ ECX,EDX
LAB_00101316:
CMP ECX,-0x1
JZ 0x00101320
CMP EAX,-0x1
JNZ 0x00101340
LAB_00101320:
ADD RDI,0x4
CMP RDI,RSI
JZ 0x00101340
LAB_00101329:
MOV EDX,dword ptr [RDI]
TEST DL,0x1
JZ 0x00101310
CMP EAX,-0x1
CMOVZ EAX,EDX
JMP 0x00101316
LAB_00101340:
IMUL EAX,ECX
RET
LAB_00101344:
MOV EAX,0x1
RET | int func0(uint *param_1,int param_2)
{
uint *puVar1;
uint uVar2;
uint uVar3;
uint uVar4;
if (param_2 < 1) {
return 1;
}
uVar4 = 0xffffffff;
puVar1 = param_1 + (ulong)(param_2 - 1) + 1;
uVar3 = 0xffffffff;
do {
uVar2 = *param_1;
if ((uVar2 & 1) == 0) {
if (uVar4 == 0xffffffff) {
uVar4 = uVar2;
}
}
else if (uVar3 == 0xffffffff) {
uVar3 = uVar2;
}
} while (((uVar4 == 0xffffffff) || (uVar3 == 0xffffffff)) &&
(param_1 = param_1 + 1, param_1 != puVar1));
return uVar3 * uVar4;
} |
7,031 | func0 | #include <assert.h>
| int func0(int list1[], int n) {
int first_even = -1;
int first_odd = -1;
for (int i = 0; i < n; i++) {
if (list1[i] % 2 == 0 && first_even == -1) {
first_even = list1[i];
}
if (list1[i] % 2 != 0 && first_odd == -1) {
first_odd = list1[i];
}
if (first_even != -1 && first_odd != -1) {
break;
}
}
return first_even * first_odd;
}
| int main() {
int list1[] = {1,3,5,7,4,1,6,8};
int n1 = sizeof(list1) / sizeof(list1[0]);
assert(func0(list1, n1) == 4);
int list2[] = {1,2,3,4,5,6,7,8,9,10};
int n2 = sizeof(list2) / sizeof(list2[0]);
assert(func0(list2, n2) == 2);
int list3[] = {1,5,7,9,10};
int n3 = sizeof(list3) / sizeof(list3[0]);
assert(func0(list3, n3) == 10);
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 12f4 <func0+0x54>
lea -0x1(%rsi),%eax
mov $0xffffffff,%ecx
lea 0x4(%rdi,%rax,4),%rsi
mov $0xffffffff,%eax
jmp 12d9 <func0+0x39>
nopl 0x0(%rax)
cmp $0xffffffff,%eax
cmove %edx,%eax
cmp $0xffffffff,%eax
je 12d0 <func0+0x30>
cmp $0xffffffff,%ecx
jne 12f0 <func0+0x50>
add $0x4,%rdi
cmp %rsi,%rdi
je 12f0 <func0+0x50>
mov (%rdi),%edx
test $0x1,%dl
je 12c0 <func0+0x20>
cmp $0xffffffff,%ecx
cmove %edx,%ecx
jmp 12c6 <func0+0x26>
nopl 0x0(%rax,%rax,1)
imul %ecx,%eax
retq
mov $0x1,%eax
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_12F4
movsxd rsi, esi
mov eax, 0FFFFFFFFh
mov ecx, 0FFFFFFFFh
lea rsi, [rdi+rsi*4]
jmp short loc_12D9
loc_12C0:
cmp eax, 0FFFFFFFFh
cmovz eax, edx
loc_12C6:
cmp ecx, 0FFFFFFFFh
jz short loc_12D0
cmp eax, 0FFFFFFFFh
jnz short loc_12F0
loc_12D0:
add rdi, 4
cmp rsi, rdi
jz short loc_12F0
loc_12D9:
mov edx, [rdi]
test dl, 1
jnz short loc_12C0
cmp ecx, 0FFFFFFFFh
cmovz ecx, edx
jmp short loc_12C6
loc_12F0:
imul eax, ecx
retn
loc_12F4:
mov eax, 1
retn | long long func0(int *a1, int a2)
{
int v2; // eax
int v3; // ecx
int *v4; // rsi
if ( a2 <= 0 )
return 1LL;
v2 = -1;
v3 = -1;
v4 = &a1[a2];
do
{
if ( (*a1 & 1) != 0 )
{
if ( v2 == -1 )
v2 = *a1;
}
else if ( v3 == -1 )
{
v3 = *a1;
}
if ( v3 != -1 && v2 != -1 )
break;
++a1;
}
while ( v4 != a1 );
return (unsigned int)(v3 * v2);
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001012f4
MOVSXD RSI,ESI
MOV EAX,0xffffffff
MOV ECX,0xffffffff
LEA RSI,[RDI + RSI*0x4]
JMP 0x001012d9
LAB_001012c0:
CMP EAX,-0x1
CMOVZ EAX,EDX
LAB_001012c6:
CMP ECX,-0x1
JZ 0x001012d0
CMP EAX,-0x1
JNZ 0x001012f0
LAB_001012d0:
ADD RDI,0x4
CMP RSI,RDI
JZ 0x001012f0
LAB_001012d9:
MOV EDX,dword ptr [RDI]
TEST DL,0x1
JNZ 0x001012c0
CMP ECX,-0x1
CMOVZ ECX,EDX
JMP 0x001012c6
LAB_001012f0:
IMUL EAX,ECX
RET
LAB_001012f4:
MOV EAX,0x1
RET | int func0(uint *param_1,int param_2)
{
uint *puVar1;
uint uVar2;
uint uVar3;
uint uVar4;
if (param_2 < 1) {
return 1;
}
uVar3 = 0xffffffff;
uVar4 = 0xffffffff;
puVar1 = param_1 + param_2;
do {
uVar2 = *param_1;
if ((uVar2 & 1) == 0) {
if (uVar4 == 0xffffffff) {
uVar4 = uVar2;
}
}
else if (uVar3 == 0xffffffff) {
uVar3 = uVar2;
}
} while (((uVar4 == 0xffffffff) || (uVar3 == 0xffffffff)) &&
(param_1 = param_1 + 1, puVar1 != param_1));
return uVar3 * uVar4;
} |
7,032 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
| int* func0(const char *test_str, int *size) {
char *str = strdup(test_str);
str = strtok(str, "(), ");
int initial_size = 4, count = 0;
int *res = malloc(initial_size * sizeof(int));
while (str != NULL) {
if (count == initial_size) {
initial_size *= 2;
res = realloc(res, initial_size * sizeof(int));
}
res[count++] = atoi(str);
str = strtok(NULL, "(), ");
}
free(str);
*size = count;
return res;
}
| int main() {
int size;
int *result;
result = func0("(7, 8, 9)", &size);
assert(size == 3 && result[0] == 7 && result[1] == 8 && result[2] == 9);
free(result);
result = func0("(1, 2, 3)", &size);
assert(size == 3 && result[0] == 1 && result[1] == 2 && result[2] == 3);
free(result);
result = func0("(4, 5, 6)", &size);
assert(size == 3 && result[0] == 4 && result[1] == 5 && result[2] == 6);
free(result);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
sub $0x38,%rsp
mov %rdi,-0x38(%rbp)
mov %rsi,-0x40(%rbp)
mov -0x38(%rbp),%rax
mov %rax,%rdi
callq 1130 <strdup@plt>
mov %rax,-0x20(%rbp)
mov -0x20(%rbp),%rax
lea 0xdaf(%rip),%rsi
mov %rax,%rdi
callq 1110 <strtok@plt>
mov %rax,-0x20(%rbp)
movl $0x4,-0x28(%rbp)
movl $0x0,-0x24(%rbp)
mov -0x28(%rbp),%eax
cltq
shl $0x2,%rax
mov %rax,%rdi
callq 10f0 <malloc@plt>
mov %rax,-0x18(%rbp)
jmp 12f3 <func0+0xca>
mov -0x24(%rbp),%eax
cmp -0x28(%rbp),%eax
jne 12b5 <func0+0x8c>
shll -0x28(%rbp)
mov -0x28(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
mov %rdx,%rsi
mov %rax,%rdi
callq 1100 <realloc@plt>
mov %rax,-0x18(%rbp)
mov -0x24(%rbp),%eax
lea 0x1(%rax),%edx
mov %edx,-0x24(%rbp)
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
lea (%rdx,%rax,1),%rbx
mov -0x20(%rbp),%rax
mov %rax,%rdi
callq 1120 <atoi@plt>
mov %eax,(%rbx)
lea 0xd23(%rip),%rsi
mov $0x0,%edi
callq 1110 <strtok@plt>
mov %rax,-0x20(%rbp)
cmpq $0x0,-0x20(%rbp)
jne 128a <func0+0x61>
mov -0x20(%rbp),%rax
mov %rax,%rdi
callq 10c0 <free@plt>
mov -0x40(%rbp),%rax
mov -0x24(%rbp),%edx
mov %edx,(%rax)
mov -0x18(%rbp),%rax
add $0x38,%rsp
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
push rbx
sub rsp, 38h
mov [rbp+s], rdi
mov [rbp+var_40], rsi
mov rax, [rbp+s]
mov rdi, rax; s
call _strdup
mov [rbp+nptr], rax
mov rax, [rbp+nptr]
lea rdx, delim; "(), "
mov rsi, rdx; delim
mov rdi, rax; s
call _strtok
mov [rbp+nptr], rax
mov [rbp+var_28], 4
mov [rbp+var_24], 0
mov eax, [rbp+var_28]
cdqe
shl rax, 2
mov rdi, rax; size
call _malloc
mov [rbp+ptr], rax
jmp short loc_12F9
loc_128D:
mov eax, [rbp+var_24]
cmp eax, [rbp+var_28]
jnz short loc_12B8
shl [rbp+var_28], 1
mov eax, [rbp+var_28]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+ptr]
mov rsi, rdx; size
mov rdi, rax; ptr
call _realloc
mov [rbp+ptr], rax
loc_12B8:
mov eax, [rbp+var_24]
lea edx, [rax+1]
mov [rbp+var_24], edx
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+ptr]
lea rbx, [rdx+rax]
mov rax, [rbp+nptr]
mov rdi, rax; nptr
call _atoi
mov [rbx], eax
lea rax, delim; "(), "
mov rsi, rax; delim
mov edi, 0; s
call _strtok
mov [rbp+nptr], rax
loc_12F9:
cmp [rbp+nptr], 0
jnz short loc_128D
mov rax, [rbp+nptr]
mov rdi, rax; ptr
call _free
mov rax, [rbp+var_40]
mov edx, [rbp+var_24]
mov [rax], edx
mov rax, [rbp+ptr]
mov rbx, [rbp+var_8]
leave
retn | void * func0(const char *a1, _DWORD *a2)
{
char *v2; // rax
int v3; // eax
int v5; // [rsp+18h] [rbp-28h]
int v6; // [rsp+1Ch] [rbp-24h]
const char *nptr; // [rsp+20h] [rbp-20h]
void *ptr; // [rsp+28h] [rbp-18h]
v2 = strdup(a1);
nptr = strtok(v2, "(), ");
v5 = 4;
v6 = 0;
ptr = malloc(0x10uLL);
while ( nptr )
{
if ( v6 == v5 )
{
v5 *= 2;
ptr = realloc(ptr, 4LL * v5);
}
v3 = v6++;
*((_DWORD *)ptr + v3) = atoi(nptr);
nptr = strtok(0LL, "(), ");
}
free(0LL);
*a2 = v6;
return ptr;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
PUSH RBX
SUB RSP,0x38
MOV qword ptr [RBP + -0x38],RDI
MOV qword ptr [RBP + -0x40],RSI
MOV RAX,qword ptr [RBP + -0x38]
MOV RDI,RAX
CALL 0x00101130
MOV qword ptr [RBP + -0x20],RAX
MOV RAX,qword ptr [RBP + -0x20]
LEA RDX,[0x102008]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101110
MOV qword ptr [RBP + -0x20],RAX
MOV dword ptr [RBP + -0x28],0x4
MOV dword ptr [RBP + -0x24],0x0
MOV EAX,dword ptr [RBP + -0x28]
CDQE
SHL RAX,0x2
MOV RDI,RAX
CALL 0x001010f0
MOV qword ptr [RBP + -0x18],RAX
JMP 0x001012f9
LAB_0010128d:
MOV EAX,dword ptr [RBP + -0x24]
CMP EAX,dword ptr [RBP + -0x28]
JNZ 0x001012b8
SHL dword ptr [RBP + -0x28],0x1
MOV EAX,dword ptr [RBP + -0x28]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x00101100
MOV qword ptr [RBP + -0x18],RAX
LAB_001012b8:
MOV EAX,dword ptr [RBP + -0x24]
LEA EDX,[RAX + 0x1]
MOV dword ptr [RBP + -0x24],EDX
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
LEA RBX,[RDX + RAX*0x1]
MOV RAX,qword ptr [RBP + -0x20]
MOV RDI,RAX
CALL 0x00101120
MOV dword ptr [RBX],EAX
LEA RAX,[0x102008]
MOV RSI,RAX
MOV EDI,0x0
CALL 0x00101110
MOV qword ptr [RBP + -0x20],RAX
LAB_001012f9:
CMP qword ptr [RBP + -0x20],0x0
JNZ 0x0010128d
MOV RAX,qword ptr [RBP + -0x20]
MOV RDI,RAX
CALL 0x001010c0
MOV RAX,qword ptr [RBP + -0x40]
MOV EDX,dword ptr [RBP + -0x24]
MOV dword ptr [RAX],EDX
MOV RAX,qword ptr [RBP + -0x18]
MOV RBX,qword ptr [RBP + -0x8]
LEAVE
RET | void * func0(char *param_1,int *param_2)
{
int iVar1;
char *__s;
int local_30;
int local_2c;
char *local_28;
void *local_20;
__s = strdup(param_1);
local_28 = strtok(__s,"(), ");
local_30 = 4;
local_2c = 0;
local_20 = malloc(0x10);
while (local_28 != (char *)0x0) {
if (local_2c == local_30) {
local_30 = local_30 << 1;
local_20 = realloc(local_20,(long)local_30 * 4);
}
iVar1 = atoi(local_28);
*(int *)((long)local_2c * 4 + (long)local_20) = iVar1;
local_28 = strtok((char *)0x0,"(), ");
local_2c = local_2c + 1;
}
free((void *)0x0);
*param_2 = local_2c;
return local_20;
} |
7,033 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
| int* func0(const char *test_str, int *size) {
char *str = strdup(test_str);
str = strtok(str, "(), ");
int initial_size = 4, count = 0;
int *res = malloc(initial_size * sizeof(int));
while (str != NULL) {
if (count == initial_size) {
initial_size *= 2;
res = realloc(res, initial_size * sizeof(int));
}
res[count++] = atoi(str);
str = strtok(NULL, "(), ");
}
free(str);
*size = count;
return res;
}
| int main() {
int size;
int *result;
result = func0("(7, 8, 9)", &size);
assert(size == 3 && result[0] == 7 && result[1] == 8 && result[2] == 9);
free(result);
result = func0("(1, 2, 3)", &size);
assert(size == 3 && result[0] == 1 && result[1] == 2 && result[2] == 3);
free(result);
result = func0("(4, 5, 6)", &size);
assert(size == 3 && result[0] == 4 && result[1] == 5 && result[2] == 6);
free(result);
return 0;
}
| O1 | c | func0:
endbr64
push %r15
push %r14
push %r13
push %r12
push %rbp
push %rbx
sub $0x18,%rsp
mov %rsi,0x8(%rsp)
callq 1130 <strdup@plt>
mov %rax,%rdi
lea 0xdb5(%rip),%rsi
callq 1120 <strtok@plt>
mov %rax,%rbx
mov $0x10,%edi
callq 1100 <malloc@plt>
mov %rax,%r13
mov $0x0,%r12d
mov $0x4,%r15d
mov $0x0,%r14d
test %rbx,%rbx
jne 12ae <func0+0x85>
mov 0x8(%rsp),%rax
mov %r14d,(%rax)
mov %r13,%rax
add $0x18,%rsp
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
add %r15d,%r15d
movslq %r15d,%rsi
shl $0x2,%rsi
mov %r13,%rdi
callq 1110 <realloc@plt>
mov %rax,%r13
add $0x1,%r12
lea 0x1(%r12),%r14d
lea 0x0(%r13,%r12,4),%rbp
mov $0xa,%edx
mov $0x0,%esi
mov %rbx,%rdi
callq 10f0 <strtol@plt>
mov %eax,0x0(%rbp)
lea 0xd30(%rip),%rsi
mov $0x0,%edi
callq 1120 <strtok@plt>
mov %rax,%rbx
test %rax,%rax
je 127b <func0+0x52>
cmp %r14d,%r15d
jne 12aa <func0+0x81>
jmp 1295 <func0+0x6c>
| func0:
endbr64
push r15
push r14
push r13
push r12
push rbp
push rbx
sub rsp, 18h
mov [rsp+48h+var_40], rsi
call _strdup
mov rdi, rax
lea rsi, asc_2004; "(), "
call _strtok
mov rbx, rax
mov edi, 10h
call _malloc
mov r13, rax
mov r12d, 0
mov r15d, 4
mov r14d, 0
test rbx, rbx
jnz short loc_12AE
loc_127B:
mov rax, [rsp+48h+var_40]
mov [rax], r14d
mov rax, r13
add rsp, 18h
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_1295:
add r15d, r15d
movsxd rsi, r15d
shl rsi, 2
mov rdi, r13
call _realloc
mov r13, rax
loc_12AA:
add r12, 1
loc_12AE:
lea r14d, [r12+1]
lea rbp, [r13+r12*4+0]
mov edx, 0Ah
mov esi, 0
mov rdi, rbx
call _strtol
mov [rbp+0], eax
lea rsi, asc_2004; "(), "
mov edi, 0
call _strtok
mov rbx, rax
test rax, rax
jz short loc_127B
cmp r15d, r14d
jnz short loc_12AA
jmp short loc_1295 | long long func0(long long a1, _DWORD *a2)
{
long long v2; // rax
long long v3; // rbx
long long v4; // r13
long long v5; // r12
int v6; // r15d
int v7; // r14d
v2 = strdup();
v3 = strtok(v2, "(), ");
v4 = malloc(16LL);
v5 = 0LL;
v6 = 4;
v7 = 0;
if ( v3 )
{
while ( 1 )
{
v7 = v5 + 1;
*(_DWORD *)(v4 + 4 * v5) = strtol(v3, 0LL, 10LL);
v3 = strtok(0LL, "(), ");
if ( !v3 )
break;
if ( v6 == v7 )
{
v6 *= 2;
v4 = realloc(v4, 4LL * v6);
}
++v5;
}
}
*a2 = v7;
return v4;
} | func0:
ENDBR64
PUSH R15
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0x18
MOV qword ptr [RSP + 0x8],RSI
CALL 0x00101130
MOV RDI,RAX
LEA RSI,[0x102004]
CALL 0x00101120
MOV RBX,RAX
MOV EDI,0x10
CALL 0x00101100
MOV R13,RAX
MOV R12D,0x0
MOV R15D,0x4
MOV R14D,0x0
TEST RBX,RBX
JNZ 0x001012ae
LAB_0010127b:
MOV RAX,qword ptr [RSP + 0x8]
MOV dword ptr [RAX],R14D
MOV RAX,R13
ADD RSP,0x18
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_00101295:
ADD R15D,R15D
MOVSXD RSI,R15D
SHL RSI,0x2
MOV RDI,R13
CALL 0x00101110
MOV R13,RAX
LAB_001012aa:
ADD R12,0x1
LAB_001012ae:
LEA R14D,[R12 + 0x1]
LEA RBP,[R13 + R12*0x4]
MOV EDX,0xa
MOV ESI,0x0
MOV RDI,RBX
CALL 0x001010f0
MOV dword ptr [RBP],EAX
LEA RSI,[0x102004]
MOV EDI,0x0
CALL 0x00101120
MOV RBX,RAX
TEST RAX,RAX
JZ 0x0010127b
CMP R15D,R14D
JNZ 0x001012aa
JMP 0x00101295 | void * func0(char *param_1,int *param_2)
{
char *pcVar1;
void *__ptr;
long lVar2;
long lVar3;
int iVar4;
int iVar5;
pcVar1 = strdup(param_1);
pcVar1 = strtok(pcVar1,"(), ");
__ptr = malloc(0x10);
lVar3 = 0;
iVar5 = 4;
iVar4 = 0;
if (pcVar1 != (char *)0x0) {
while( true ) {
iVar4 = (int)lVar3 + 1;
lVar2 = strtol(pcVar1,(char **)0x0,10);
*(int *)((long)__ptr + lVar3 * 4) = (int)lVar2;
pcVar1 = strtok((char *)0x0,"(), ");
if (pcVar1 == (char *)0x0) break;
if (iVar5 == iVar4) {
iVar5 = iVar5 * 2;
__ptr = realloc(__ptr,(long)iVar5 << 2);
}
lVar3 = lVar3 + 1;
}
}
*param_2 = iVar4;
return __ptr;
} |
7,034 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
| int* func0(const char *test_str, int *size) {
char *str = strdup(test_str);
str = strtok(str, "(), ");
int initial_size = 4, count = 0;
int *res = malloc(initial_size * sizeof(int));
while (str != NULL) {
if (count == initial_size) {
initial_size *= 2;
res = realloc(res, initial_size * sizeof(int));
}
res[count++] = atoi(str);
str = strtok(NULL, "(), ");
}
free(str);
*size = count;
return res;
}
| int main() {
int size;
int *result;
result = func0("(7, 8, 9)", &size);
assert(size == 3 && result[0] == 7 && result[1] == 8 && result[2] == 9);
free(result);
result = func0("(1, 2, 3)", &size);
assert(size == 3 && result[0] == 1 && result[1] == 2 && result[2] == 3);
free(result);
result = func0("(4, 5, 6)", &size);
assert(size == 3 && result[0] == 4 && result[1] == 5 && result[2] == 6);
free(result);
return 0;
}
| O2 | c | func0:
endbr64
push %r15
push %r14
push %r13
push %r12
xor %r12d,%r12d
push %rbp
push %rbx
sub $0x18,%rsp
mov %rsi,0x8(%rsp)
callq 1130 <strdup@plt>
lea 0xc5e(%rip),%rsi
mov %rax,%rdi
callq 1120 <strtok@plt>
mov $0x10,%edi
mov %rax,%r15
callq 1100 <malloc@plt>
movl $0x4,0x4(%rsp)
mov %rax,%rbp
test %r15,%r15
je 1438 <func0+0xb8>
xor %r13d,%r13d
lea 0xc2f(%rip),%r14
jmp 13e4 <func0+0x64>
nopw 0x0(%rax,%rax,1)
add $0x1,%r13
mov %r15,%rdi
mov $0xa,%edx
lea 0x0(%rbp,%r13,4),%rbx
xor %esi,%esi
callq 10f0 <strtol@plt>
mov %r14,%rsi
xor %edi,%edi
lea 0x1(%r13),%r12d
mov %eax,(%rbx)
callq 1120 <strtok@plt>
mov %rax,%r15
test %rax,%rax
je 1438 <func0+0xb8>
cmp %r12d,0x4(%rsp)
jne 13e0 <func0+0x60>
shll 0x4(%rsp)
movslq 0x4(%rsp),%rsi
mov %rbp,%rdi
shl $0x2,%rsi
callq 1110 <realloc@plt>
mov %rax,%rbp
jmp 13e0 <func0+0x60>
nopl 0x0(%rax)
mov 0x8(%rsp),%rax
mov %r12d,(%rax)
add $0x18,%rsp
mov %rbp,%rax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax)
| func0:
endbr64
push r15
push r14
lea r14, asc_2004; "(), "
push r13
push r12
xor r12d, r12d
push rbp
push rbx
sub rsp, 18h
mov [rsp+48h+var_40], rsi
call _strdup
mov rsi, r14
mov rdi, rax
call _strtok
mov edi, 10h
mov r15, rax
call _malloc
mov [rsp+48h+var_44], 4
mov rbp, rax
test r15, r15
jz short loc_1430
xor r13d, r13d
jmp short loc_13DC
loc_13D8:
add r13, 1
loc_13DC:
mov rdi, r15
mov edx, 0Ah
lea rbx, [rbp+r13*4+0]
xor esi, esi
call _strtol
mov rsi, r14
xor edi, edi
lea r12d, [r13+1]
mov [rbx], eax
call _strtok
mov r15, rax
test rax, rax
jz short loc_1430
cmp [rsp+48h+var_44], r12d
jnz short loc_13D8
shl [rsp+48h+var_44], 1
movsxd rsi, [rsp+48h+var_44]
mov rdi, rbp
shl rsi, 2
call _realloc
mov rbp, rax
jmp short loc_13D8
loc_1430:
mov rax, [rsp+48h+var_40]
mov [rax], r12d
add rsp, 18h
mov rax, rbp
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn | long long func0(long long a1, _DWORD *a2)
{
int v2; // r12d
long long v3; // rax
long long v4; // r15
long long v5; // rbp
long long i; // r13
int v8; // [rsp+4h] [rbp-44h]
v2 = 0;
v3 = strdup();
v4 = strtok(v3, "(), ");
v8 = 4;
v5 = malloc(16LL);
if ( v4 )
{
for ( i = 0LL; ; ++i )
{
v2 = i + 1;
*(_DWORD *)(v5 + 4 * i) = strtol(v4, 0LL, 10LL);
v4 = strtok(0LL, "(), ");
if ( !v4 )
break;
if ( v8 == v2 )
{
v8 *= 2;
v5 = realloc(v5, 4LL * v8);
}
}
}
*a2 = v2;
return v5;
} | func0:
ENDBR64
PUSH R15
PUSH R14
LEA R14,[0x102004]
PUSH R13
PUSH R12
XOR R12D,R12D
PUSH RBP
PUSH RBX
SUB RSP,0x18
MOV qword ptr [RSP + 0x8],RSI
CALL 0x00101130
MOV RSI,R14
MOV RDI,RAX
CALL 0x00101120
MOV EDI,0x10
MOV R15,RAX
CALL 0x00101100
MOV dword ptr [RSP + 0x4],0x4
MOV RBP,RAX
TEST R15,R15
JZ 0x00101430
XOR R13D,R13D
JMP 0x001013dc
LAB_001013d8:
ADD R13,0x1
LAB_001013dc:
MOV RDI,R15
MOV EDX,0xa
LEA RBX,[RBP + R13*0x4]
XOR ESI,ESI
CALL 0x001010f0
MOV RSI,R14
XOR EDI,EDI
LEA R12D,[R13 + 0x1]
MOV dword ptr [RBX],EAX
CALL 0x00101120
MOV R15,RAX
TEST RAX,RAX
JZ 0x00101430
CMP dword ptr [RSP + 0x4],R12D
JNZ 0x001013d8
SHL dword ptr [RSP + 0x4],0x1
MOVSXD RSI,dword ptr [RSP + 0x4]
MOV RDI,RBP
SHL RSI,0x2
CALL 0x00101110
MOV RBP,RAX
JMP 0x001013d8
LAB_00101430:
MOV RAX,qword ptr [RSP + 0x8]
MOV dword ptr [RAX],R12D
ADD RSP,0x18
MOV RAX,RBP
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET | void * func0(char *param_1,int *param_2)
{
char *pcVar1;
void *__ptr;
long lVar2;
int iVar3;
long lVar4;
int local_44;
iVar3 = 0;
pcVar1 = strdup(param_1);
pcVar1 = strtok(pcVar1,"(), ");
__ptr = malloc(0x10);
local_44 = 4;
if (pcVar1 != (char *)0x0) {
lVar4 = 0;
while( true ) {
lVar2 = strtol(pcVar1,(char **)0x0,10);
iVar3 = (int)lVar4 + 1;
*(int *)((long)__ptr + lVar4 * 4) = (int)lVar2;
pcVar1 = strtok((char *)0x0,"(), ");
if (pcVar1 == (char *)0x0) break;
if (local_44 == iVar3) {
local_44 = local_44 << 1;
__ptr = realloc(__ptr,(long)local_44 << 2);
}
lVar4 = lVar4 + 1;
}
}
*param_2 = iVar3;
return __ptr;
} |
7,035 | func0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
| int* func0(const char *test_str, int *size) {
char *str = strdup(test_str);
str = strtok(str, "(), ");
int initial_size = 4, count = 0;
int *res = malloc(initial_size * sizeof(int));
while (str != NULL) {
if (count == initial_size) {
initial_size *= 2;
res = realloc(res, initial_size * sizeof(int));
}
res[count++] = atoi(str);
str = strtok(NULL, "(), ");
}
free(str);
*size = count;
return res;
}
| int main() {
int size;
int *result;
result = func0("(7, 8, 9)", &size);
assert(size == 3 && result[0] == 7 && result[1] == 8 && result[2] == 9);
free(result);
result = func0("(1, 2, 3)", &size);
assert(size == 3 && result[0] == 1 && result[1] == 2 && result[2] == 3);
free(result);
result = func0("(4, 5, 6)", &size);
assert(size == 3 && result[0] == 4 && result[1] == 5 && result[2] == 6);
free(result);
return 0;
}
| O3 | c | func0:
endbr64
push %r15
push %r14
push %r13
push %r12
xor %r12d,%r12d
push %rbp
push %rbx
sub $0x18,%rsp
mov %rsi,0x8(%rsp)
callq 1130 <strdup@plt>
lea 0xc5e(%rip),%rsi
mov %rax,%rdi
callq 1120 <strtok@plt>
mov $0x10,%edi
mov %rax,%r15
callq 1100 <malloc@plt>
movl $0x4,0x4(%rsp)
mov %rax,%rbp
test %r15,%r15
je 1438 <func0+0xb8>
xor %r13d,%r13d
lea 0xc2f(%rip),%r14
jmp 13e4 <func0+0x64>
nopw 0x0(%rax,%rax,1)
add $0x1,%r13
mov %r15,%rdi
mov $0xa,%edx
lea 0x0(%rbp,%r13,4),%rbx
xor %esi,%esi
callq 10f0 <strtol@plt>
mov %r14,%rsi
xor %edi,%edi
lea 0x1(%r13),%r12d
mov %eax,(%rbx)
callq 1120 <strtok@plt>
mov %rax,%r15
test %rax,%rax
je 1438 <func0+0xb8>
cmp %r12d,0x4(%rsp)
jne 13e0 <func0+0x60>
shll 0x4(%rsp)
movslq 0x4(%rsp),%rsi
mov %rbp,%rdi
shl $0x2,%rsi
callq 1110 <realloc@plt>
mov %rax,%rbp
jmp 13e0 <func0+0x60>
nopl 0x0(%rax)
mov 0x8(%rsp),%rax
mov %r12d,(%rax)
add $0x18,%rsp
mov %rbp,%rax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax)
| func0:
endbr64
push r15
push r14
lea r14, delim; "(), "
push r13
push r12
push rbp
push rbx
sub rsp, 18h
mov [rsp+48h+var_40], rsi
call _strdup
mov rsi, r14; delim
mov rdi, rax; s
call _strtok
mov edi, 10h; size
mov rbx, rax
call _malloc
mov rbp, rax
test rbx, rbx
jz loc_1460
xor r13d, r13d
mov r12d, 4
jmp short loc_1408
loc_13D8:
mov edx, 0Ah; base
xor esi, esi; endptr
lea r15, [rbp+r13*4+0]
mov rdi, rbx; nptr
call _strtol
mov [r15], eax
loc_13EF:
mov rsi, r14; delim
xor edi, edi; s
call _strtok
mov rbx, rax
lea rax, [r13+1]
test rbx, rbx
jz short loc_1440
mov r13, rax
loc_1408:
cmp r12d, r13d
jnz short loc_13D8
add r12d, r12d
mov rdi, rbp; ptr
movsxd rsi, r12d
shl rsi, 2; size
call _realloc
mov edx, 0Ah; base
xor esi, esi; endptr
mov rdi, rbx; nptr
lea r15, [rax+r13*4]
mov rbp, rax
call _strtol
mov [r15], eax
jmp short loc_13EF
loc_1440:
lea eax, [r13+1]
loc_1444:
mov rcx, [rsp+48h+var_40]
mov [rcx], eax
add rsp, 18h
mov rax, rbp
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_1460:
xor eax, eax
jmp short loc_1444 | void * func0(const char *a1, _DWORD *a2)
{
char *v2; // rax
char *v3; // rbx
void *v4; // rbp
long long v5; // r13
int v6; // r12d
int v7; // eax
v2 = strdup(a1);
v3 = strtok(v2, "(), ");
v4 = malloc(0x10uLL);
if ( v3 )
{
v5 = 0LL;
v6 = 4;
while ( 1 )
{
if ( v6 == (_DWORD)v5 )
{
v6 *= 2;
v4 = realloc(v4, 4LL * v6);
}
*((_DWORD *)v4 + v5) = strtol(v3, 0LL, 10);
v3 = strtok(0LL, "(), ");
if ( !v3 )
break;
++v5;
}
v7 = v5 + 1;
}
else
{
v7 = 0;
}
*a2 = v7;
return v4;
} | func0:
ENDBR64
PUSH R15
PUSH R14
LEA R14,[0x102004]
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0x18
MOV qword ptr [RSP + 0x8],RSI
CALL 0x00101130
MOV RSI,R14
MOV RDI,RAX
CALL 0x00101120
MOV EDI,0x10
MOV RBX,RAX
CALL 0x00101100
MOV RBP,RAX
TEST RBX,RBX
JZ 0x00101460
XOR R13D,R13D
MOV R12D,0x4
JMP 0x00101408
LAB_001013d8:
MOV EDX,0xa
XOR ESI,ESI
LEA R15,[RBP + R13*0x4]
MOV RDI,RBX
CALL 0x001010f0
MOV dword ptr [R15],EAX
LAB_001013ef:
MOV RSI,R14
XOR EDI,EDI
CALL 0x00101120
MOV RBX,RAX
LEA RAX,[R13 + 0x1]
TEST RBX,RBX
JZ 0x00101440
MOV R13,RAX
LAB_00101408:
CMP R12D,R13D
JNZ 0x001013d8
ADD R12D,R12D
MOV RDI,RBP
MOVSXD RSI,R12D
SHL RSI,0x2
CALL 0x00101110
MOV EDX,0xa
XOR ESI,ESI
MOV RDI,RBX
LEA R15,[RAX + R13*0x4]
MOV RBP,RAX
CALL 0x001010f0
MOV dword ptr [R15],EAX
JMP 0x001013ef
LAB_00101440:
LEA EAX,[R13 + 0x1]
LAB_00101444:
MOV RCX,qword ptr [RSP + 0x8]
MOV dword ptr [RCX],EAX
ADD RSP,0x18
MOV RAX,RBP
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_00101460:
XOR EAX,EAX
JMP 0x00101444 | void * func0(char *param_1,int *param_2)
{
int iVar1;
char *pcVar2;
void *__ptr;
long lVar3;
int iVar4;
long lVar5;
pcVar2 = strdup(param_1);
pcVar2 = strtok(pcVar2,"(), ");
__ptr = malloc(0x10);
if (pcVar2 == (char *)0x0) {
iVar1 = 0;
}
else {
lVar5 = 0;
iVar4 = 4;
do {
iVar1 = (int)lVar5;
if (iVar4 == iVar1) {
iVar4 = iVar4 * 2;
__ptr = realloc(__ptr,(long)iVar4 << 2);
lVar3 = strtol(pcVar2,(char **)0x0,10);
*(int *)((long)__ptr + lVar5 * 4) = (int)lVar3;
}
else {
lVar3 = strtol(pcVar2,(char **)0x0,10);
*(int *)((long)__ptr + lVar5 * 4) = (int)lVar3;
}
pcVar2 = strtok((char *)0x0,"(), ");
lVar5 = lVar5 + 1;
} while (pcVar2 != (char *)0x0);
iVar1 = iVar1 + 1;
}
*param_2 = iVar1;
return __ptr;
} |
7,036 | func0 |
#include <assert.h>
#include <stdlib.h>
| int func0(int* a, int n, int x) {
int i = 0;
for (; i < n; i++) {
if (a[i] > x) {
break;
}
}
return i;
}
| int main() {
int arr1[] = {1, 2, 4, 5};
int arr2[] = {1, 2, 4, 5};
int arr3[] = {1, 2, 4, 5};
assert(func0(arr1, 4, 6) == 4);
assert(func0(arr2, 4, 3) == 2);
assert(func0(arr3, 4, 7) == 4);
return EXIT_SUCCESS;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov %edx,-0x20(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11a3 <func0+0x3a>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cmp %eax,-0x20(%rbp)
jl 11ad <func0+0x44>
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 1184 <func0+0x1b>
jmp 11ae <func0+0x45>
mov -0x4(%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_4], 0
jmp short loc_11A3
loc_1184:
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
jl short loc_11AD
add [rbp+var_4], 1
loc_11A3:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_1184
jmp short loc_11AE
loc_11AD:
nop
loc_11AE:
mov eax, [rbp+var_4]
pop rbp
retn | long long func0(long long a1, int a2, int a3)
{
unsigned int i; // [rsp+1Ch] [rbp-4h]
for ( i = 0; (int)i < a2 && a3 >= *(_DWORD *)(4LL * (int)i + a1); ++i )
;
return i;
} | 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 + -0x4],0x0
JMP 0x001011a3
LAB_00101184:
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
JL 0x001011ad
ADD dword ptr [RBP + -0x4],0x1
LAB_001011a3:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x00101184
JMP 0x001011ae
LAB_001011ad:
NOP
LAB_001011ae:
MOV EAX,dword ptr [RBP + -0x4]
POP RBP
RET | int func0(long param_1,int param_2,int param_3)
{
int local_c;
local_c = 0;
while ((local_c < param_2 && (*(int *)(param_1 + (long)local_c * 4) <= param_3))) {
local_c = local_c + 1;
}
return local_c;
} |
7,037 | func0 |
#include <assert.h>
#include <stdlib.h>
| int func0(int* a, int n, int x) {
int i = 0;
for (; i < n; i++) {
if (a[i] > x) {
break;
}
}
return i;
}
| int main() {
int arr1[] = {1, 2, 4, 5};
int arr2[] = {1, 2, 4, 5};
int arr3[] = {1, 2, 4, 5};
assert(func0(arr1, 4, 6) == 4);
assert(func0(arr2, 4, 3) == 2);
assert(func0(arr3, 4, 7) == 4);
return EXIT_SUCCESS;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 1195 <func0+0x2c>
lea -0x1(%rsi),%r8d
mov $0x0,%eax
jmp 117f <func0+0x16>
mov %rsi,%rax
mov %eax,%ecx
cmp %edx,(%rdi,%rax,4)
jg 1192 <func0+0x29>
lea 0x1(%rax),%ecx
lea 0x1(%rax),%rsi
cmp %r8,%rax
jne 117c <func0+0x13>
mov %ecx,%eax
retq
mov $0x0,%ecx
jmp 1192 <func0+0x29>
| func0:
endbr64
test esi, esi
jle short loc_1188
mov eax, 0
loc_1176:
cmp [rdi], edx
jg short locret_118D
add eax, 1
add rdi, 4
cmp esi, eax
jnz short loc_1176
mov eax, esi
retn
loc_1188:
mov eax, 0
locret_118D:
retn | long long func0(_DWORD *a1, int a2, int a3)
{
long long result; // rax
if ( a2 <= 0 )
return 0LL;
result = 0LL;
while ( *a1 <= a3 )
{
result = (unsigned int)(result + 1);
++a1;
if ( a2 == (_DWORD)result )
return (unsigned int)a2;
}
return result;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101188
MOV EAX,0x0
LAB_00101176:
CMP dword ptr [RDI],EDX
JG 0x0010118d
ADD EAX,0x1
ADD RDI,0x4
CMP ESI,EAX
JNZ 0x00101176
MOV EAX,ESI
RET
LAB_00101188:
MOV EAX,0x0
LAB_0010118d:
RET | int func0(int *param_1,int param_2,int param_3)
{
int iVar1;
if (param_2 < 1) {
iVar1 = 0;
}
else {
iVar1 = 0;
while (*param_1 <= param_3) {
iVar1 = iVar1 + 1;
param_1 = param_1 + 1;
if (param_2 == iVar1) {
return param_2;
}
}
}
return iVar1;
} |
7,038 | func0 |
#include <assert.h>
#include <stdlib.h>
| int func0(int* a, int n, int x) {
int i = 0;
for (; i < n; i++) {
if (a[i] > x) {
break;
}
}
return i;
}
| int main() {
int arr1[] = {1, 2, 4, 5};
int arr2[] = {1, 2, 4, 5};
int arr3[] = {1, 2, 4, 5};
assert(func0(arr1, 4, 6) == 4);
assert(func0(arr2, 4, 3) == 2);
assert(func0(arr3, 4, 7) == 4);
return EXIT_SUCCESS;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 116c <func0+0x2c>
sub $0x1,%esi
xor %eax,%eax
jmp 1160 <func0+0x20>
lea 0x1(%rax),%r8d
lea 0x1(%rax),%rcx
cmp %rsi,%rax
je 1168 <func0+0x28>
mov %rcx,%rax
mov %eax,%r8d
cmp %edx,(%rdi,%rax,4)
jle 1150 <func0+0x10>
mov %r8d,%eax
retq
xor %r8d,%r8d
jmp 1168 <func0+0x28>
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
xor eax, eax
test esi, esi
jg short loc_115B
jmp short locret_115F
loc_1150:
add eax, 1
add rdi, 4
cmp esi, eax
jz short locret_1160
loc_115B:
cmp [rdi], edx
jle short loc_1150
locret_115F:
retn
locret_1160:
retn | long long func0(_DWORD *a1, int a2, int a3)
{
long long result; // rax
result = 0LL;
if ( a2 > 0 )
{
do
{
if ( *a1 > a3 )
break;
result = (unsigned int)(result + 1);
++a1;
}
while ( a2 != (_DWORD)result );
}
return result;
} | func0:
ENDBR64
XOR EAX,EAX
TEST ESI,ESI
JG 0x0010115b
JMP 0x0010115f
LAB_00101150:
ADD EAX,0x1
ADD RDI,0x4
CMP ESI,EAX
JZ 0x00101160
LAB_0010115b:
CMP dword ptr [RDI],EDX
JLE 0x00101150
LAB_0010115f:
RET
LAB_00101160:
RET | void func0(int *param_1,int param_2,int param_3)
{
int iVar1;
iVar1 = 0;
if (0 < param_2) {
while (*param_1 <= param_3) {
iVar1 = iVar1 + 1;
param_1 = param_1 + 1;
if (param_2 == iVar1) {
return;
}
}
}
return;
} |
7,039 | func0 |
#include <assert.h>
#include <stdlib.h>
| int func0(int* a, int n, int x) {
int i = 0;
for (; i < n; i++) {
if (a[i] > x) {
break;
}
}
return i;
}
| int main() {
int arr1[] = {1, 2, 4, 5};
int arr2[] = {1, 2, 4, 5};
int arr3[] = {1, 2, 4, 5};
assert(func0(arr1, 4, 6) == 4);
assert(func0(arr2, 4, 3) == 2);
assert(func0(arr3, 4, 7) == 4);
return EXIT_SUCCESS;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 116c <func0+0x2c>
sub $0x1,%esi
xor %eax,%eax
jmp 1160 <func0+0x20>
lea 0x1(%rax),%r8d
lea 0x1(%rax),%rcx
cmp %rsi,%rax
je 1168 <func0+0x28>
mov %rcx,%rax
mov %eax,%r8d
cmp %edx,(%rdi,%rax,4)
jle 1150 <func0+0x10>
mov %r8d,%eax
retq
xor %r8d,%r8d
jmp 1168 <func0+0x28>
nopw %cs:0x0(%rax,%rax,1)
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
xor eax, eax
test esi, esi
jg short loc_115B
retn
loc_1150:
add eax, 1
add rdi, 4
cmp esi, eax
jz short locret_1160
loc_115B:
cmp [rdi], edx
jle short loc_1150
retn
locret_1160:
retn | long long func0(_DWORD *a1, int a2, int a3)
{
long long result; // rax
result = 0LL;
if ( a2 > 0 )
{
do
{
if ( *a1 > a3 )
break;
result = (unsigned int)(result + 1);
++a1;
}
while ( a2 != (_DWORD)result );
}
return result;
} | func0:
ENDBR64
XOR EAX,EAX
TEST ESI,ESI
JG 0x0010115b
RET
LAB_00101150:
ADD EAX,0x1
ADD RDI,0x4
CMP ESI,EAX
JZ 0x00101160
LAB_0010115b:
CMP dword ptr [RDI],EDX
JLE 0x00101150
RET
LAB_00101160:
RET | void func0(int *param_1,int param_2,int param_3)
{
int iVar1;
iVar1 = 0;
if (param_2 < 1) {
return;
}
do {
if (param_3 < *param_1) {
return;
}
iVar1 = iVar1 + 1;
param_1 = param_1 + 1;
} while (param_2 != iVar1);
return;
} |
7,040 | func0 |
#include <stdio.h>
#include <assert.h>
#include <regex.h>
#include <string.h>
| char* func0(const char* text) {
regex_t regex;
int reti;
char* patterns = "ab{3}";
reti = regcomp(®ex, patterns, REG_EXTENDED);
if (reti) {
fprintf(stderr, "Could not compile regex\n");
return "Regex compilation error";
}
reti = regexec(®ex, text, 0, NULL, 0);
regfree(®ex); // Free memory consumed by regex
if (!reti)
return "Found a match!";
else
return "Not matched!";
}
| int main() {
assert(strcmp(func0("ac"), "Not matched!") == 0);
assert(strcmp(func0("dc"), "Not matched!") == 0);
assert(strcmp(func0("abbbba"), "Found a match!") == 0);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x70,%rsp
mov %rdi,-0x68(%rbp)
mov %fs:0x28,%rax
mov %rax,-0x8(%rbp)
xor %eax,%eax
lea 0xdd9(%rip),%rax
mov %rax,-0x58(%rbp)
mov -0x58(%rbp),%rcx
lea -0x50(%rbp),%rax
mov $0x1,%edx
mov %rcx,%rsi
mov %rax,%rdi
callq 10e0 <regcomp@plt>
mov %eax,-0x5c(%rbp)
cmpl $0x0,-0x5c(%rbp)
je 127d <func0+0x74>
mov 0x2dc5(%rip),%rax
mov %rax,%rcx
mov $0x18,%edx
mov $0x1,%esi
lea 0xd9f(%rip),%rdi
callq 1110 <fwrite@plt>
lea 0xdac(%rip),%rax
jmp 12c2 <func0+0xb9>
mov -0x68(%rbp),%rsi
lea -0x50(%rbp),%rax
mov $0x0,%r8d
mov $0x0,%ecx
mov $0x0,%edx
mov %rax,%rdi
callq 1100 <regexec@plt>
mov %eax,-0x5c(%rbp)
lea -0x50(%rbp),%rax
mov %rax,%rdi
callq 10b0 <regfree@plt>
cmpl $0x0,-0x5c(%rbp)
jne 12bb <func0+0xb2>
lea 0xd86(%rip),%rax
jmp 12c2 <func0+0xb9>
lea 0xd8c(%rip),%rax
mov -0x8(%rbp),%rdx
xor %fs:0x28,%rdx
je 12d6 <func0+0xcd>
callq 10c0 <__stack_chk_fail@plt>
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 70h
mov [rbp+string], rdi
mov rax, fs:28h
mov [rbp+var_8], rax
xor eax, eax
lea rax, aAb3; "ab{3}"
mov [rbp+pattern], rax
mov rcx, [rbp+pattern]
lea rax, [rbp+preg]
mov edx, 1; cflags
mov rsi, rcx; pattern
mov rdi, rax; preg
call _regcomp
mov [rbp+var_5C], eax
cmp [rbp+var_5C], 0
jz short loc_1280
mov rax, cs:__bss_start
mov rcx, rax; s
mov edx, 18h; n
mov esi, 1; size
lea rax, aCouldNotCompil; "Could not compile regex\n"
mov rdi, rax; ptr
call _fwrite
lea rax, aRegexCompilati; "Regex compilation error"
jmp short loc_12C5
loc_1280:
mov rsi, [rbp+string]; string
lea rax, [rbp+preg]
mov r8d, 0; eflags
mov ecx, 0; pmatch
mov edx, 0; nmatch
mov rdi, rax; preg
call _regexec
mov [rbp+var_5C], eax
lea rax, [rbp+preg]
mov rdi, rax; preg
call _regfree
cmp [rbp+var_5C], 0
jnz short loc_12BE
lea rax, aFoundAMatch; "Found a match!"
jmp short loc_12C5
loc_12BE:
lea rax, s2; "Not matched!"
loc_12C5:
mov rdx, [rbp+var_8]
sub rdx, fs:28h
jz short locret_12D9
call ___stack_chk_fail
locret_12D9:
leave
retn | const char * func0(const char *a1)
{
int v2; // [rsp+14h] [rbp-5Ch]
regex_t preg; // [rsp+20h] [rbp-50h] BYREF
unsigned long long v4; // [rsp+68h] [rbp-8h]
v4 = __readfsqword(0x28u);
if ( regcomp(&preg, "ab{3}", 1) )
{
fwrite("Could not compile regex\n", 1uLL, 0x18uLL, _bss_start);
return "Regex compilation error";
}
else
{
v2 = regexec(&preg, a1, 0LL, 0LL, 0);
regfree(&preg);
if ( v2 )
return "Not matched!";
else
return "Found a match!";
}
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x70
MOV qword ptr [RBP + -0x68],RDI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x8],RAX
XOR EAX,EAX
LEA RAX,[0x102008]
MOV qword ptr [RBP + -0x58],RAX
MOV RCX,qword ptr [RBP + -0x58]
LEA RAX,[RBP + -0x50]
MOV EDX,0x1
MOV RSI,RCX
MOV RDI,RAX
CALL 0x001010e0
MOV dword ptr [RBP + -0x5c],EAX
CMP dword ptr [RBP + -0x5c],0x0
JZ 0x00101280
MOV RAX,qword ptr [0x00104020]
MOV RCX,RAX
MOV EDX,0x18
MOV ESI,0x1
LEA RAX,[0x10200e]
MOV RDI,RAX
CALL 0x00101110
LEA RAX,[0x102027]
JMP 0x001012c5
LAB_00101280:
MOV RSI,qword ptr [RBP + -0x68]
LEA RAX,[RBP + -0x50]
MOV R8D,0x0
MOV ECX,0x0
MOV EDX,0x0
MOV RDI,RAX
CALL 0x00101100
MOV dword ptr [RBP + -0x5c],EAX
LEA RAX,[RBP + -0x50]
MOV RDI,RAX
CALL 0x001010b0
CMP dword ptr [RBP + -0x5c],0x0
JNZ 0x001012be
LEA RAX,[0x10203f]
JMP 0x001012c5
LAB_001012be:
LEA RAX,[0x10204e]
LAB_001012c5:
MOV RDX,qword ptr [RBP + -0x8]
SUB RDX,qword ptr FS:[0x28]
JZ 0x001012d9
CALL 0x001010c0
LAB_001012d9:
LEAVE
RET | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t local_58;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&local_58,"ab{3}",1);
if (iVar1 == 0) {
iVar1 = regexec(&local_58,param_1,0,(regmatch_t *)0x0,0);
regfree(&local_58);
if (iVar1 == 0) {
pcVar2 = "Found a match!";
}
else {
pcVar2 = "Not matched!";
}
}
else {
fwrite("Could not compile regex\n",1,0x18,stderr);
pcVar2 = "Regex compilation error";
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return pcVar2;
} |
7,041 | func0 |
#include <stdio.h>
#include <assert.h>
#include <regex.h>
#include <string.h>
| char* func0(const char* text) {
regex_t regex;
int reti;
char* patterns = "ab{3}";
reti = regcomp(®ex, patterns, REG_EXTENDED);
if (reti) {
fprintf(stderr, "Could not compile regex\n");
return "Regex compilation error";
}
reti = regexec(®ex, text, 0, NULL, 0);
regfree(®ex); // Free memory consumed by regex
if (!reti)
return "Found a match!";
else
return "Not matched!";
}
| int main() {
assert(strcmp(func0("ac"), "Not matched!") == 0);
assert(strcmp(func0("dc"), "Not matched!") == 0);
assert(strcmp(func0("abbbba"), "Found a match!") == 0);
return 0;
}
| O1 | c | func0:
endbr64
push %rbp
push %rbx
sub $0x58,%rsp
mov %rdi,%rbx
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%rdi
mov $0x1,%edx
lea 0xe23(%rip),%rsi
callq 10d0 <regcomp@plt>
test %eax,%eax
jne 1271 <func0+0x88>
mov %rsp,%rbp
mov $0x0,%r8d
mov $0x0,%ecx
mov $0x0,%edx
mov %rbx,%rsi
mov %rbp,%rdi
callq 10e0 <regexec@plt>
mov %eax,%ebx
mov %rbp,%rdi
callq 10a0 <regfree@plt>
test %ebx,%ebx
lea 0xdcd(%rip),%rax
lea 0xdd5(%rip),%rdx
cmovne %rdx,%rax
mov 0x48(%rsp),%rcx
xor %fs:0x28,%rcx
jne 1297 <func0+0xae>
add $0x58,%rsp
pop %rbx
pop %rbp
retq
mov 0x2da8(%rip),%rcx
mov $0x18,%edx
mov $0x1,%esi
lea 0xdb5(%rip),%rdi
callq 10f0 <fwrite@plt>
lea 0xd6f(%rip),%rax
jmp 125a <func0+0x71>
callq 10b0 <__stack_chk_fail@plt>
| func0:
endbr64
push rbp
push rbx
sub rsp, 58h
mov rbx, rdi
mov rax, fs:28h
mov [rsp+68h+var_20], rax
xor eax, eax
mov rdi, rsp
mov edx, 1
lea rsi, aAb3; "ab{3}"
call _regcomp
test eax, eax
jnz short loc_1291
mov rbp, rsp
mov r8d, 0
mov ecx, 0
mov edx, 0
mov rsi, rbx
mov rdi, rbp
call _regexec
mov ebx, eax
mov rdi, rbp
call _regfree
test ebx, ebx
lea rax, aFoundAMatch; "Found a match!"
lea rdx, aNotMatched; "Not matched!"
cmovnz rax, rdx
loc_127A:
mov rdx, [rsp+68h+var_20]
sub rdx, fs:28h
jnz short loc_12B7
add rsp, 58h
pop rbx
pop rbp
retn
loc_1291:
mov rcx, cs:stderr@GLIBC_2_2_5
mov edx, 18h
mov esi, 1
lea rdi, aCouldNotCompil; "Could not compile regex\n"
call _fwrite
lea rax, aRegexCompilati; "Regex compilation error"
jmp short loc_127A
loc_12B7:
call ___stack_chk_fail | const char * func0(long long a1)
{
int v1; // ebx
const char *result; // rax
_QWORD v3[13]; // [rsp+0h] [rbp-68h] BYREF
v3[9] = __readfsqword(0x28u);
if ( (unsigned int)regcomp(v3, "ab{3}", 1LL) )
{
fwrite("Could not compile regex\n", 1LL, 24LL, stderr);
return "Regex compilation error";
}
else
{
v1 = regexec(v3, a1, 0LL, 0LL, 0LL);
regfree(v3);
result = "Found a match!";
if ( v1 )
return "Not matched!";
}
return result;
} | func0:
ENDBR64
PUSH RBP
PUSH RBX
SUB RSP,0x58
MOV RBX,RDI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV RDI,RSP
MOV EDX,0x1
LEA RSI,[0x102038]
CALL 0x001010e0
TEST EAX,EAX
JNZ 0x00101291
MOV RBP,RSP
MOV R8D,0x0
MOV ECX,0x0
MOV EDX,0x0
MOV RSI,RBX
MOV RDI,RBP
CALL 0x00101100
MOV EBX,EAX
MOV RDI,RBP
CALL 0x001010b0
TEST EBX,EBX
LEA RAX,[0x10201c]
LEA RDX,[0x10202b]
CMOVNZ RAX,RDX
LAB_0010127a:
MOV RDX,qword ptr [RSP + 0x48]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x001012b7
ADD RSP,0x58
POP RBX
POP RBP
RET
LAB_00101291:
MOV RCX,qword ptr [0x00104020]
MOV EDX,0x18
MOV ESI,0x1
LEA RDI,[0x10203e]
CALL 0x00101110
LEA RAX,[0x102004]
JMP 0x0010127a
LAB_001012b7:
CALL 0x001010c0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&rStack_68,"ab{3}",1);
if (iVar1 == 0) {
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
regfree(&rStack_68);
pcVar2 = "Found a match!";
if (iVar1 != 0) {
pcVar2 = "Not matched!";
}
}
else {
fwrite("Could not compile regex\n",1,0x18,stderr);
pcVar2 = "Regex compilation error";
}
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar2;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
7,042 | func0 |
#include <stdio.h>
#include <assert.h>
#include <regex.h>
#include <string.h>
| char* func0(const char* text) {
regex_t regex;
int reti;
char* patterns = "ab{3}";
reti = regcomp(®ex, patterns, REG_EXTENDED);
if (reti) {
fprintf(stderr, "Could not compile regex\n");
return "Regex compilation error";
}
reti = regexec(®ex, text, 0, NULL, 0);
regfree(®ex); // Free memory consumed by regex
if (!reti)
return "Found a match!";
else
return "Not matched!";
}
| int main() {
assert(strcmp(func0("ac"), "Not matched!") == 0);
assert(strcmp(func0("dc"), "Not matched!") == 0);
assert(strcmp(func0("abbbba"), "Found a match!") == 0);
return 0;
}
| O2 | c | func0:
endbr64
push %r12
mov $0x1,%edx
lea 0xd56(%rip),%rsi
push %rbp
mov %rdi,%rbp
sub $0x58,%rsp
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%r12
mov %r12,%rdi
callq 10d0 <regcomp@plt>
test %eax,%eax
jne 1358 <func0+0x88>
xor %edx,%edx
xor %r8d,%r8d
xor %ecx,%ecx
mov %rbp,%rsi
mov %r12,%rdi
callq 10e0 <regexec@plt>
mov %r12,%rdi
mov %eax,%ebp
callq 10a0 <regfree@plt>
test %ebp,%ebp
lea 0xcee(%rip),%rax
lea 0xcf6(%rip),%rdx
cmovne %rdx,%rax
mov 0x48(%rsp),%rcx
xor %fs:0x28,%rcx
jne 137e <func0+0xae>
add $0x58,%rsp
pop %rbp
pop %r12
retq
nopl 0x0(%rax)
mov 0x2cc1(%rip),%rcx
mov $0x18,%edx
mov $0x1,%esi
lea 0xcce(%rip),%rdi
callq 10f0 <fwrite@plt>
lea 0xc88(%rip),%rax
jmp 1339 <func0+0x69>
callq 10b0 <__stack_chk_fail@plt>
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
push r12
mov edx, 1
lea rsi, aAb3; "ab{3}"
push rbp
mov rbp, rdi
sub rsp, 58h
mov rax, fs:28h
mov [rsp+68h+var_20], rax
xor eax, eax
mov r12, rsp
mov rdi, r12
call _regcomp
test eax, eax
jnz short loc_1368
xor edx, edx
xor r8d, r8d
xor ecx, ecx
mov rsi, rbp
mov rdi, r12
call _regexec
mov rdi, r12
mov ebp, eax
call _regfree
test ebp, ebp
lea rax, aFoundAMatch; "Found a match!"
lea rdx, aNotMatched; "Not matched!"
cmovnz rax, rdx
loc_1349:
mov rdx, [rsp+68h+var_20]
sub rdx, fs:28h
jnz short loc_138E
add rsp, 58h
pop rbp
pop r12
retn
loc_1368:
mov rcx, cs:stderr@GLIBC_2_2_5
mov edx, 18h
mov esi, 1
lea rdi, aCouldNotCompil; "Could not compile regex\n"
call _fwrite
lea rax, aRegexCompilati; "Regex compilation error"
jmp short loc_1349
loc_138E:
call ___stack_chk_fail | const char * func0(long long a1)
{
int v1; // ebp
const char *result; // rax
_QWORD v3[13]; // [rsp+0h] [rbp-68h] BYREF
v3[9] = __readfsqword(0x28u);
if ( (unsigned int)regcomp(v3, "ab{3}", 1LL) )
{
fwrite("Could not compile regex\n", 1LL, 24LL, stderr);
return "Regex compilation error";
}
else
{
v1 = regexec(v3, a1, 0LL, 0LL, 0LL);
regfree(v3);
result = "Found a match!";
if ( v1 )
return "Not matched!";
}
return result;
} | func0:
ENDBR64
PUSH R12
MOV EDX,0x1
LEA RSI,[0x102038]
PUSH RBP
MOV RBP,RDI
SUB RSP,0x58
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV R12,RSP
MOV RDI,R12
CALL 0x001010e0
TEST EAX,EAX
JNZ 0x00101368
XOR EDX,EDX
XOR R8D,R8D
XOR ECX,ECX
MOV RSI,RBP
MOV RDI,R12
CALL 0x00101100
MOV RDI,R12
MOV EBP,EAX
CALL 0x001010b0
TEST EBP,EBP
LEA RAX,[0x10201c]
LEA RDX,[0x10202b]
CMOVNZ RAX,RDX
LAB_00101349:
MOV RDX,qword ptr [RSP + 0x48]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x0010138e
ADD RSP,0x58
POP RBP
POP R12
RET
LAB_00101368:
MOV RCX,qword ptr [0x00104020]
MOV EDX,0x18
MOV ESI,0x1
LEA RDI,[0x10203e]
CALL 0x00101110
LEA RAX,[0x102004]
JMP 0x00101349
LAB_0010138e:
CALL 0x001010c0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&rStack_68,"ab{3}",1);
if (iVar1 == 0) {
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
regfree(&rStack_68);
pcVar2 = "Found a match!";
if (iVar1 != 0) {
pcVar2 = "Not matched!";
}
}
else {
fwrite("Could not compile regex\n",1,0x18,stderr);
pcVar2 = "Regex compilation error";
}
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar2;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
7,043 | func0 |
#include <stdio.h>
#include <assert.h>
#include <regex.h>
#include <string.h>
| char* func0(const char* text) {
regex_t regex;
int reti;
char* patterns = "ab{3}";
reti = regcomp(®ex, patterns, REG_EXTENDED);
if (reti) {
fprintf(stderr, "Could not compile regex\n");
return "Regex compilation error";
}
reti = regexec(®ex, text, 0, NULL, 0);
regfree(®ex); // Free memory consumed by regex
if (!reti)
return "Found a match!";
else
return "Not matched!";
}
| int main() {
assert(strcmp(func0("ac"), "Not matched!") == 0);
assert(strcmp(func0("dc"), "Not matched!") == 0);
assert(strcmp(func0("abbbba"), "Found a match!") == 0);
return 0;
}
| O3 | c | func0:
endbr64
push %r12
mov $0x1,%edx
lea 0xd56(%rip),%rsi
push %rbp
mov %rdi,%rbp
sub $0x58,%rsp
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%r12
mov %r12,%rdi
callq 10d0 <regcomp@plt>
test %eax,%eax
jne 1358 <func0+0x88>
xor %edx,%edx
xor %r8d,%r8d
xor %ecx,%ecx
mov %rbp,%rsi
mov %r12,%rdi
callq 10e0 <regexec@plt>
mov %r12,%rdi
mov %eax,%ebp
callq 10a0 <regfree@plt>
test %ebp,%ebp
lea 0xcee(%rip),%rax
lea 0xcf6(%rip),%rdx
cmovne %rdx,%rax
mov 0x48(%rsp),%rcx
xor %fs:0x28,%rcx
jne 137e <func0+0xae>
add $0x58,%rsp
pop %rbp
pop %r12
retq
nopl 0x0(%rax)
mov 0x2cc1(%rip),%rcx
mov $0x18,%edx
mov $0x1,%esi
lea 0xcce(%rip),%rdi
callq 10f0 <fwrite@plt>
lea 0xc88(%rip),%rax
jmp 1339 <func0+0x69>
callq 10b0 <__stack_chk_fail@plt>
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
push rbp
mov edx, 1; cflags
lea rsi, pattern; "ab{3}"
push rbx
mov rbx, rdi
sub rsp, 58h
mov rax, fs:28h
mov [rsp+var_s48], rax
xor eax, eax
mov rbp, rsp
mov rdi, rbp; preg
call _regcomp
test eax, eax
jnz short loc_1360
xor edx, edx; nmatch
xor r8d, r8d; eflags
xor ecx, ecx; pmatch
mov rsi, rbx; string
mov rdi, rbp; preg
call _regexec
mov rdi, rbp; preg
mov ebx, eax
call _regfree
test ebx, ebx
lea rax, s2; "Not matched!"
lea rdx, aFoundAMatch; "Found a match!"
cmovz rax, rdx
loc_1348:
mov rdx, [rsp+var_s48]
sub rdx, fs:28h
jnz short loc_1386
add rsp, 58h
pop rbx
pop rbp
retn
loc_1360:
mov rcx, cs:__bss_start; s
mov edx, 18h; n
mov esi, 1; size
lea rdi, aCouldNotCompil; "Could not compile regex\n"
call _fwrite
lea rax, aRegexCompilati; "Regex compilation error"
jmp short loc_1348
loc_1386:
call ___stack_chk_fail | const char * func0(char *string)
{
int v1; // ebx
const char *result; // rax
regex_t _0; // [rsp+0h] [rbp+0h] BYREF
unsigned long long vars48; // [rsp+48h] [rbp+48h]
vars48 = __readfsqword(0x28u);
if ( regcomp(&_0, "ab{3}", 1) )
{
fwrite("Could not compile regex\n", 1uLL, 0x18uLL, _bss_start);
return "Regex compilation error";
}
else
{
v1 = regexec(&_0, string, 0LL, 0LL, 0);
regfree(&_0);
result = "Not matched!";
if ( !v1 )
return "Found a match!";
}
return result;
} | func0:
ENDBR64
PUSH RBP
MOV EDX,0x1
LEA RSI,[0x102038]
PUSH RBX
MOV RBX,RDI
SUB RSP,0x58
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV RBP,RSP
MOV RDI,RBP
CALL 0x001010e0
TEST EAX,EAX
JNZ 0x00101360
XOR EDX,EDX
XOR R8D,R8D
XOR ECX,ECX
MOV RSI,RBX
MOV RDI,RBP
CALL 0x00101100
MOV RDI,RBP
MOV EBX,EAX
CALL 0x001010b0
TEST EBX,EBX
LEA RAX,[0x10202b]
LEA RDX,[0x10201c]
CMOVZ RAX,RDX
LAB_00101348:
MOV RDX,qword ptr [RSP + 0x48]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x00101386
ADD RSP,0x58
POP RBX
POP RBP
RET
LAB_00101360:
MOV RCX,qword ptr [0x00104020]
MOV EDX,0x18
MOV ESI,0x1
LEA RDI,[0x10203e]
CALL 0x00101110
LEA RAX,[0x102004]
JMP 0x00101348
LAB_00101386:
CALL 0x001010c0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&rStack_68,"ab{3}",1);
if (iVar1 == 0) {
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
regfree(&rStack_68);
pcVar2 = "Not matched!";
if (iVar1 == 0) {
pcVar2 = "Found a match!";
}
}
else {
fwrite("Could not compile regex\n",1,0x18,stderr);
pcVar2 = "Regex compilation error";
}
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar2;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
7,044 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
struct dynamicTuple {
char elements[100];
};
| struct dynamicTuple func0(char test_list[][100], int listSize, char test_str[]) {
struct dynamicTuple result;
strcpy(result.elements, "");
for (int i = 0; i < listSize; i++) {
strcat(result.elements, test_list[i]);
strcat(result.elements, ", ");
}
strcat(result.elements, test_str);
return result;
}
| int main() {
char list1[2][100] = {"WEB", "is"};
char list2[2][100] = {"We", "are"};
char list3[2][100] = {"Part", "is"};
struct dynamicTuple result;
result = func0(list1, 2, "best");
assert(strcmp(result.elements, "WEB, is, best") == 0);
result = func0(list2, 2, "Developers");
assert(strcmp(result.elements, "We, are, Developers") == 0);
result = func0(list3, 2, "Wrong");
assert(strcmp(result.elements, "Part, is, Wrong") == 0);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
push %rbx
sub $0xa8,%rsp
mov %rdi,-0x98(%rbp)
mov %rsi,-0xa0(%rbp)
mov %edx,-0xa4(%rbp)
mov %rcx,-0xb0(%rbp)
mov %fs:0x28,%rax
mov %rax,-0x18(%rbp)
xor %eax,%eax
movb $0x0,-0x80(%rbp)
movl $0x0,-0x84(%rbp)
jmp 126a <func0+0xc1>
mov -0x84(%rbp),%eax
movslq %eax,%rdx
mov %rdx,%rax
shl $0x2,%rax
add %rdx,%rax
lea 0x0(,%rax,4),%rdx
add %rdx,%rax
shl $0x2,%rax
mov %rax,%rdx
mov -0xa0(%rbp),%rax
add %rax,%rdx
lea -0x80(%rbp),%rax
mov %rdx,%rsi
mov %rax,%rdi
callq 10b0 <strcat@plt>
lea -0x80(%rbp),%rax
mov $0xffffffffffffffff,%rcx
mov %rax,%rdx
mov $0x0,%eax
mov %rdx,%rdi
repnz scas %es:(%rdi),%al
mov %rcx,%rax
not %rax
lea -0x1(%rax),%rdx
lea -0x80(%rbp),%rax
add %rdx,%rax
movw $0x202c,(%rax)
movb $0x0,0x2(%rax)
addl $0x1,-0x84(%rbp)
mov -0x84(%rbp),%eax
cmp -0xa4(%rbp),%eax
jl 11f3 <func0+0x4a>
mov -0xb0(%rbp),%rdx
lea -0x80(%rbp),%rax
mov %rdx,%rsi
mov %rax,%rdi
callq 10b0 <strcat@plt>
mov -0x98(%rbp),%rax
mov -0x80(%rbp),%rcx
mov -0x78(%rbp),%rbx
mov %rcx,(%rax)
mov %rbx,0x8(%rax)
mov -0x70(%rbp),%rcx
mov -0x68(%rbp),%rbx
mov %rcx,0x10(%rax)
mov %rbx,0x18(%rax)
mov -0x60(%rbp),%rcx
mov -0x58(%rbp),%rbx
mov %rcx,0x20(%rax)
mov %rbx,0x28(%rax)
mov -0x50(%rbp),%rcx
mov -0x48(%rbp),%rbx
mov %rcx,0x30(%rax)
mov %rbx,0x38(%rax)
mov -0x40(%rbp),%rcx
mov -0x38(%rbp),%rbx
mov %rcx,0x40(%rax)
mov %rbx,0x48(%rax)
mov -0x30(%rbp),%rcx
mov -0x28(%rbp),%rbx
mov %rcx,0x50(%rax)
mov %rbx,0x58(%rax)
mov -0x20(%rbp),%edx
mov %edx,0x60(%rax)
mov -0x18(%rbp),%rax
xor %fs:0x28,%rax
je 1312 <func0+0x169>
callq 1080 <__stack_chk_fail@plt>
mov -0x98(%rbp),%rax
add $0xa8,%rsp
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
push rbx
sub rsp, 0A8h
mov [rbp+var_98], rdi
mov [rbp+var_A0], rsi
mov [rbp+var_A4], edx
mov [rbp+src], rcx
mov rax, fs:28h
mov [rbp+var_18], rax
xor eax, eax
mov [rbp+dest], 0
mov [rbp+var_84], 0
jmp short loc_1277
loc_1213:
mov eax, [rbp+var_84]
movsxd rdx, eax
mov rax, rdx
shl rax, 2
add rax, rdx
lea rdx, ds:0[rax*4]
add rax, rdx
shl rax, 2
mov rdx, rax
mov rax, [rbp+var_A0]
add rdx, rax
lea rax, [rbp+dest]
mov rsi, rdx; src
mov rdi, rax; dest
call _strcat
lea rax, [rbp+dest]
mov rdi, rax; s
call _strlen
mov rdx, rax
lea rax, [rbp+dest]
add rax, rdx
mov word ptr [rax], 202Ch
mov byte ptr [rax+2], 0
add [rbp+var_84], 1
loc_1277:
mov eax, [rbp+var_84]
cmp eax, [rbp+var_A4]
jl short loc_1213
mov rdx, [rbp+src]
lea rax, [rbp+dest]
mov rsi, rdx; src
mov rdi, rax; dest
call _strcat
mov rax, [rbp+var_98]
mov rcx, qword ptr [rbp+dest]
mov rbx, [rbp+var_78]
mov [rax], rcx
mov [rax+8], rbx
mov rcx, [rbp+var_70]
mov rbx, [rbp+var_68]
mov [rax+10h], rcx
mov [rax+18h], rbx
mov rcx, [rbp+var_60]
mov rbx, [rbp+var_58]
mov [rax+20h], rcx
mov [rax+28h], rbx
mov rcx, [rbp+var_50]
mov rbx, [rbp+var_48]
mov [rax+30h], rcx
mov [rax+38h], rbx
mov rcx, [rbp+var_40]
mov rbx, [rbp+var_38]
mov [rax+40h], rcx
mov [rax+48h], rbx
mov rcx, [rbp+var_30]
mov rbx, [rbp+var_28]
mov [rax+50h], rcx
mov [rax+58h], rbx
mov edx, [rbp+var_20]
mov [rax+60h], edx
mov rax, [rbp+var_18]
sub rax, fs:28h
jz short loc_131B
call ___stack_chk_fail
loc_131B:
mov rax, [rbp+var_98]
mov rbx, [rbp+var_8]
leave
retn | long long func0(long long a1, long long a2, int a3, const char *a4)
{
long long v4; // rbx
long long v5; // rbx
long long v6; // rbx
long long v7; // rbx
long long v8; // rbx
long long v9; // rbx
int i; // [rsp+2Ch] [rbp-84h]
char dest[8]; // [rsp+30h] [rbp-80h] BYREF
long long v15; // [rsp+38h] [rbp-78h]
long long v16; // [rsp+40h] [rbp-70h]
long long v17; // [rsp+48h] [rbp-68h]
long long v18; // [rsp+50h] [rbp-60h]
long long v19; // [rsp+58h] [rbp-58h]
long long v20; // [rsp+60h] [rbp-50h]
long long v21; // [rsp+68h] [rbp-48h]
long long v22; // [rsp+70h] [rbp-40h]
long long v23; // [rsp+78h] [rbp-38h]
long long v24; // [rsp+80h] [rbp-30h]
long long v25; // [rsp+88h] [rbp-28h]
int v26; // [rsp+90h] [rbp-20h]
unsigned long long v27; // [rsp+98h] [rbp-18h]
v27 = __readfsqword(0x28u);
dest[0] = 0;
for ( i = 0; i < a3; ++i )
{
strcat(dest, (const char *)(a2 + 100LL * i));
strcpy(&dest[strlen(dest)], ", ");
}
strcat(dest, a4);
v4 = v15;
*(_QWORD *)a1 = *(_QWORD *)dest;
*(_QWORD *)(a1 + 8) = v4;
v5 = v17;
*(_QWORD *)(a1 + 16) = v16;
*(_QWORD *)(a1 + 24) = v5;
v6 = v19;
*(_QWORD *)(a1 + 32) = v18;
*(_QWORD *)(a1 + 40) = v6;
v7 = v21;
*(_QWORD *)(a1 + 48) = v20;
*(_QWORD *)(a1 + 56) = v7;
v8 = v23;
*(_QWORD *)(a1 + 64) = v22;
*(_QWORD *)(a1 + 72) = v8;
v9 = v25;
*(_QWORD *)(a1 + 80) = v24;
*(_QWORD *)(a1 + 88) = v9;
*(_DWORD *)(a1 + 96) = v26;
return a1;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
PUSH RBX
SUB RSP,0xa8
MOV qword ptr [RBP + -0x98],RDI
MOV qword ptr [RBP + -0xa0],RSI
MOV dword ptr [RBP + -0xa4],EDX
MOV qword ptr [RBP + -0xb0],RCX
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x18],RAX
XOR EAX,EAX
MOV byte ptr [RBP + -0x80],0x0
MOV dword ptr [RBP + -0x84],0x0
JMP 0x00101277
LAB_00101213:
MOV EAX,dword ptr [RBP + -0x84]
MOVSXD RDX,EAX
MOV RAX,RDX
SHL RAX,0x2
ADD RAX,RDX
LEA RDX,[RAX*0x4]
ADD RAX,RDX
SHL RAX,0x2
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0xa0]
ADD RDX,RAX
LEA RAX,[RBP + -0x80]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x001010d0
LEA RAX,[RBP + -0x80]
MOV RDI,RAX
CALL 0x00101090
MOV RDX,RAX
LEA RAX,[RBP + -0x80]
ADD RAX,RDX
MOV word ptr [RAX],0x202c
MOV byte ptr [RAX + 0x2],0x0
ADD dword ptr [RBP + -0x84],0x1
LAB_00101277:
MOV EAX,dword ptr [RBP + -0x84]
CMP EAX,dword ptr [RBP + -0xa4]
JL 0x00101213
MOV RDX,qword ptr [RBP + -0xb0]
LEA RAX,[RBP + -0x80]
MOV RSI,RDX
MOV RDI,RAX
CALL 0x001010d0
MOV RAX,qword ptr [RBP + -0x98]
MOV RCX,qword ptr [RBP + -0x80]
MOV RBX,qword ptr [RBP + -0x78]
MOV qword ptr [RAX],RCX
MOV qword ptr [RAX + 0x8],RBX
MOV RCX,qword ptr [RBP + -0x70]
MOV RBX,qword ptr [RBP + -0x68]
MOV qword ptr [RAX + 0x10],RCX
MOV qword ptr [RAX + 0x18],RBX
MOV RCX,qword ptr [RBP + -0x60]
MOV RBX,qword ptr [RBP + -0x58]
MOV qword ptr [RAX + 0x20],RCX
MOV qword ptr [RAX + 0x28],RBX
MOV RCX,qword ptr [RBP + -0x50]
MOV RBX,qword ptr [RBP + -0x48]
MOV qword ptr [RAX + 0x30],RCX
MOV qword ptr [RAX + 0x38],RBX
MOV RCX,qword ptr [RBP + -0x40]
MOV RBX,qword ptr [RBP + -0x38]
MOV qword ptr [RAX + 0x40],RCX
MOV qword ptr [RAX + 0x48],RBX
MOV RCX,qword ptr [RBP + -0x30]
MOV RBX,qword ptr [RBP + -0x28]
MOV qword ptr [RAX + 0x50],RCX
MOV qword ptr [RAX + 0x58],RBX
MOV EDX,dword ptr [RBP + -0x20]
MOV dword ptr [RAX + 0x60],EDX
MOV RAX,qword ptr [RBP + -0x18]
SUB RAX,qword ptr FS:[0x28]
JZ 0x0010131b
CALL 0x001010a0
LAB_0010131b:
MOV RAX,qword ptr [RBP + -0x98]
MOV RBX,qword ptr [RBP + -0x8]
LEAVE
RET | int8 * func0(int8 *param_1,long param_2,int param_3,char *param_4)
{
size_t sVar1;
long in_FS_OFFSET;
int local_8c;
char local_88;
int auStack_87 [7];
int8 local_80;
int8 local_78;
int8 local_70;
int8 local_68;
int8 local_60;
int8 local_58;
int8 local_50;
int8 local_48;
int8 local_40;
int8 local_38;
int8 local_30;
int4 local_28;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_88 = '\0';
for (local_8c = 0; local_8c < param_3; local_8c = local_8c + 1) {
strcat(&local_88,(char *)((long)local_8c * 100 + param_2));
sVar1 = strlen(&local_88);
*(int2 *)(auStack_87 + (sVar1 - 1)) = 0x202c;
auStack_87[sVar1 + 1] = 0;
}
strcat(&local_88,param_4);
*param_1 = CONCAT71(auStack_87,local_88);
param_1[1] = local_80;
param_1[2] = local_78;
param_1[3] = local_70;
param_1[4] = local_68;
param_1[5] = local_60;
param_1[6] = local_58;
param_1[7] = local_50;
param_1[8] = local_48;
param_1[9] = local_40;
param_1[10] = local_38;
param_1[0xb] = local_30;
*(int4 *)(param_1 + 0xc) = local_28;
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return param_1;
} |
7,045 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
struct dynamicTuple {
char elements[100];
};
| struct dynamicTuple func0(char test_list[][100], int listSize, char test_str[]) {
struct dynamicTuple result;
strcpy(result.elements, "");
for (int i = 0; i < listSize; i++) {
strcat(result.elements, test_list[i]);
strcat(result.elements, ", ");
}
strcat(result.elements, test_str);
return result;
}
| int main() {
char list1[2][100] = {"WEB", "is"};
char list2[2][100] = {"We", "are"};
char list3[2][100] = {"Part", "is"};
struct dynamicTuple result;
result = func0(list1, 2, "best");
assert(strcmp(result.elements, "WEB, is, best") == 0);
result = func0(list2, 2, "Developers");
assert(strcmp(result.elements, "We, are, Developers") == 0);
result = func0(list3, 2, "Wrong");
assert(strcmp(result.elements, "Part, is, Wrong") == 0);
return 0;
}
| O1 | c | func0:
endbr64
push %r14
push %r13
push %r12
push %rbp
push %rbx
sub $0x70,%rsp
mov %rdi,%r12
mov %rcx,%r14
mov %fs:0x28,%rax
mov %rax,0x68(%rsp)
xor %eax,%eax
movb $0x0,(%rsp)
test %edx,%edx
jle 11fa <func0+0x71>
mov %rsi,%rbx
lea -0x1(%rdx),%eax
lea (%rax,%rax,4),%rax
lea (%rax,%rax,4),%rax
lea 0x64(%rsi,%rax,4),%r13
mov %rsp,%rbp
mov $0x64,%edx
mov %rbx,%rsi
mov %rbp,%rdi
callq 1070 <__strcat_chk@plt>
mov $0x64,%edx
lea 0xe1b(%rip),%rsi
mov %rbp,%rdi
callq 1070 <__strcat_chk@plt>
add $0x64,%rbx
cmp %r13,%rbx
jne 11cd <func0+0x44>
mov %rsp,%rdi
mov $0x64,%edx
mov %r14,%rsi
callq 1070 <__strcat_chk@plt>
movdqa (%rsp),%xmm0
movups %xmm0,(%r12)
movdqa 0x10(%rsp),%xmm1
movups %xmm1,0x10(%r12)
movdqa 0x20(%rsp),%xmm2
movups %xmm2,0x20(%r12)
movdqa 0x30(%rsp),%xmm3
movups %xmm3,0x30(%r12)
movdqa 0x40(%rsp),%xmm4
movups %xmm4,0x40(%r12)
movdqa 0x50(%rsp),%xmm5
movups %xmm5,0x50(%r12)
mov 0x60(%rsp),%eax
mov %eax,0x60(%r12)
mov 0x68(%rsp),%rax
xor %fs:0x28,%rax
jne 1279 <func0+0xf0>
mov %r12,%rax
add $0x70,%rsp
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
retq
callq 1080 <__stack_chk_fail@plt>
| func0:
endbr64
push r15
push r14
push r13
push r12
push rbp
push rbx
sub rsp, 78h
mov r12, rdi
mov r15, rcx
mov rax, fs:28h
mov [rsp+0A8h+var_40], rax
xor eax, eax
mov byte ptr [rsp+0A8h+var_A8], 0
test edx, edx
jle short loc_121F
mov rbx, rsi
lea eax, [rdx-1]
lea rax, [rax+rax*4]
lea rax, [rax+rax*4]
lea r14, [rsi+rax*4+64h]
lea r13, unk_2004
loc_11F3:
mov rbp, rsp
mov edx, 64h ; 'd'
mov rsi, rbx
mov rdi, rbp
call ___strcat_chk
mov edx, 64h ; 'd'
mov rsi, r13
mov rdi, rbp
call ___strcat_chk
add rbx, 64h ; 'd'
cmp rbx, r14
jnz short loc_11F3
loc_121F:
mov rdi, rsp
mov edx, 64h ; 'd'
mov rsi, r15
call ___strcat_chk
movdqa xmm0, [rsp+0A8h+var_A8]
movups xmmword ptr [r12], xmm0
movdqa xmm1, [rsp+0A8h+var_98]
movups xmmword ptr [r12+10h], xmm1
movdqa xmm2, [rsp+0A8h+var_88]
movups xmmword ptr [r12+20h], xmm2
movdqa xmm3, [rsp+0A8h+var_78]
movups xmmword ptr [r12+30h], xmm3
movdqa xmm4, [rsp+0A8h+var_68]
movups xmmword ptr [r12+40h], xmm4
movdqa xmm5, [rsp+0A8h+var_58]
movups xmmword ptr [r12+50h], xmm5
mov eax, [rsp+0A8h+var_48]
mov [r12+60h], eax
mov rax, [rsp+0A8h+var_40]
sub rax, fs:28h
jnz short loc_12A0
mov rax, r12
add rsp, 78h
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_12A0:
call ___stack_chk_fail | __m128i * func0(__m128i *a1, long long a2, int a3, long long a4)
{
long long v5; // rbx
long long v6; // r14
__m128i v8; // [rsp+0h] [rbp-A8h] BYREF
__m128i v9; // [rsp+10h] [rbp-98h] BYREF
__m128i v10; // [rsp+20h] [rbp-88h] BYREF
__m128i v11; // [rsp+30h] [rbp-78h] BYREF
__m128i v12; // [rsp+40h] [rbp-68h] BYREF
__m128i v13; // [rsp+50h] [rbp-58h] BYREF
__int32 v14; // [rsp+60h] [rbp-48h]
unsigned long long v15; // [rsp+68h] [rbp-40h]
v15 = __readfsqword(0x28u);
v8.m128i_i8[0] = 0;
if ( a3 > 0 )
{
v5 = a2;
v6 = a2 + 100LL * (unsigned int)(a3 - 1) + 100;
do
{
__strcat_chk(&v8, v5, 100LL);
__strcat_chk(&v8, &unk_2004, 100LL);
v5 += 100LL;
}
while ( v5 != v6 );
}
__strcat_chk(&v8, a4, 100LL);
*a1 = _mm_load_si128(&v8);
a1[1] = _mm_load_si128(&v9);
a1[2] = _mm_load_si128(&v10);
a1[3] = _mm_load_si128(&v11);
a1[4] = _mm_load_si128(&v12);
a1[5] = _mm_load_si128(&v13);
a1[6].m128i_i32[0] = v14;
return a1;
} | func0:
ENDBR64
PUSH R15
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0x78
MOV R12,RDI
MOV R15,RCX
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x68],RAX
XOR EAX,EAX
MOV byte ptr [RSP],0x0
TEST EDX,EDX
JLE 0x0010121f
MOV RBX,RSI
LEA EAX,[RDX + -0x1]
LEA RAX,[RAX + RAX*0x4]
LEA RAX,[RAX + RAX*0x4]
LEA R14,[RSI + RAX*0x4 + 0x64]
LEA R13,[0x102004]
LAB_001011f3:
MOV RBP,RSP
MOV EDX,0x64
MOV RSI,RBX
MOV RDI,RBP
CALL 0x00101080
MOV EDX,0x64
MOV RSI,R13
MOV RDI,RBP
CALL 0x00101080
ADD RBX,0x64
CMP RBX,R14
JNZ 0x001011f3
LAB_0010121f:
MOV RDI,RSP
MOV EDX,0x64
MOV RSI,R15
CALL 0x00101080
MOVDQA XMM0,xmmword ptr [RSP]
MOVUPS xmmword ptr [R12],XMM0
MOVDQA XMM1,xmmword ptr [RSP + 0x10]
MOVUPS xmmword ptr [R12 + 0x10],XMM1
MOVDQA XMM2,xmmword ptr [RSP + 0x20]
MOVUPS xmmword ptr [R12 + 0x20],XMM2
MOVDQA XMM3,xmmword ptr [RSP + 0x30]
MOVUPS xmmword ptr [R12 + 0x30],XMM3
MOVDQA XMM4,xmmword ptr [RSP + 0x40]
MOVUPS xmmword ptr [R12 + 0x40],XMM4
MOVDQA XMM5,xmmword ptr [RSP + 0x50]
MOVUPS xmmword ptr [R12 + 0x50],XMM5
MOV EAX,dword ptr [RSP + 0x60]
MOV dword ptr [R12 + 0x60],EAX
MOV RAX,qword ptr [RSP + 0x68]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x001012a0
MOV RAX,R12
ADD RSP,0x78
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_001012a0:
CALL 0x00101090 | int8 * func0(int8 *param_1,long param_2,int param_3,int8 param_4)
{
long lVar1;
long in_FS_OFFSET;
int1 local_a8;
int7 uStack_a7;
int8 uStack_a0;
int8 local_98;
int8 uStack_90;
int8 local_88;
int8 uStack_80;
int8 local_78;
int8 uStack_70;
int8 local_68;
int8 uStack_60;
int8 local_58;
int8 uStack_50;
int4 local_48;
long local_40;
local_40 = *(long *)(in_FS_OFFSET + 0x28);
local_a8 = 0;
if (0 < param_3) {
lVar1 = param_2 + 100;
do {
__strcat_chk(&local_a8,param_2,100);
__strcat_chk(&local_a8,&DAT_00102004,100);
param_2 = param_2 + 100;
} while (param_2 != lVar1 + (ulong)(param_3 - 1) * 100);
}
__strcat_chk(&local_a8,param_4,100);
*param_1 = CONCAT71(uStack_a7,local_a8);
param_1[1] = uStack_a0;
param_1[2] = local_98;
param_1[3] = uStack_90;
param_1[4] = local_88;
param_1[5] = uStack_80;
param_1[6] = local_78;
param_1[7] = uStack_70;
param_1[8] = local_68;
param_1[9] = uStack_60;
param_1[10] = local_58;
param_1[0xb] = uStack_50;
*(int4 *)(param_1 + 0xc) = local_48;
if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) {
return param_1;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
7,046 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
struct dynamicTuple {
char elements[100];
};
| struct dynamicTuple func0(char test_list[][100], int listSize, char test_str[]) {
struct dynamicTuple result;
strcpy(result.elements, "");
for (int i = 0; i < listSize; i++) {
strcat(result.elements, test_list[i]);
strcat(result.elements, ", ");
}
strcat(result.elements, test_str);
return result;
}
| int main() {
char list1[2][100] = {"WEB", "is"};
char list2[2][100] = {"We", "are"};
char list3[2][100] = {"Part", "is"};
struct dynamicTuple result;
result = func0(list1, 2, "best");
assert(strcmp(result.elements, "WEB, is, best") == 0);
result = func0(list2, 2, "Developers");
assert(strcmp(result.elements, "We, are, Developers") == 0);
result = func0(list3, 2, "Wrong");
assert(strcmp(result.elements, "Part, is, Wrong") == 0);
return 0;
}
| O2 | c | func0:
endbr64
push %r15
push %r14
mov %rcx,%r14
push %r13
push %r12
mov %rdi,%r12
push %rbp
push %rbx
sub $0x78,%rsp
mov %fs:0x28,%rax
mov %rax,0x68(%rsp)
xor %eax,%eax
mov %rsp,%rbp
movb $0x0,(%rsp)
test %edx,%edx
jle 15c0 <func0+0xc0>
lea -0x1(%rdx),%eax
mov %rsi,%r15
lea 0xac0(%rip),%rbx
mov %rsp,%rbp
lea (%rax,%rax,4),%rax
lea (%rax,%rax,4),%rax
lea 0x64(%rsi,%rax,4),%r13
nopl 0x0(%rax)
mov %rbp,%rdi
mov (%rdi),%edx
add $0x4,%rdi
lea -0x1010101(%rdx),%eax
not %edx
and %edx,%eax
and $0x80808080,%eax
je 155b <func0+0x5b>
mov %eax,%edx
shr $0x10,%edx
test $0x8080,%eax
cmove %edx,%eax
lea 0x2(%rdi),%rdx
cmove %rdx,%rdi
mov $0x64,%edx
mov %eax,%esi
add %al,%sil
mov %r15,%rsi
sbb $0x3,%rdi
add $0x64,%r15
callq 10d0 <__stpcpy_chk@plt>
mov %rbp,%rcx
mov $0x3,%edx
mov %rbx,%rsi
sub %rax,%rcx
mov %rax,%rdi
add $0x64,%rcx
callq 10c0 <__memcpy_chk@plt>
cmp %r13,%r15
jne 1558 <func0+0x58>
mov $0x64,%edx
mov %r14,%rsi
mov %rbp,%rdi
callq 1090 <__strcat_chk@plt>
mov 0x60(%rsp),%eax
movdqa (%rsp),%xmm0
movdqa 0x10(%rsp),%xmm1
movdqa 0x20(%rsp),%xmm2
mov %eax,0x60(%r12)
movdqa 0x30(%rsp),%xmm3
movdqa 0x40(%rsp),%xmm4
movdqa 0x50(%rsp),%xmm5
movups %xmm0,(%r12)
movups %xmm1,0x10(%r12)
movups %xmm2,0x20(%r12)
movups %xmm3,0x30(%r12)
movups %xmm4,0x40(%r12)
movups %xmm5,0x50(%r12)
mov 0x68(%rsp),%rax
xor %fs:0x28,%rax
jne 1641 <func0+0x141>
add $0x78,%rsp
mov %r12,%rax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
callq 10a0 <__stack_chk_fail@plt>
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
push r15
push r14
mov r14, rcx
push r13
push r12
mov r12, rdi
push rbp
push rbx
sub rsp, 78h
mov rax, fs:28h
mov [rsp+var_s68], rax
xor eax, eax
mov rbp, rsp
mov byte ptr [rsp+var_s0], 0
test edx, edx
jle short loc_15AD
lea eax, [rdx-1]
mov r15, rsi
lea rbx, unk_2004
mov rbp, rsp
lea rax, [rax+rax*4]
lea rax, [rax+rax*4]
lea r13, [rsi+rax*4+64h]
loc_1570:
mov rdi, rbp
call _strlen
mov rsi, r15
mov edx, 64h ; 'd'
add r15, 64h ; 'd'
lea rdi, [rbp+rax+var_s0]
call ___stpcpy_chk
mov rcx, rbp
mov edx, 3
mov rsi, rbx
sub rcx, rax
mov rdi, rax
add rcx, 64h ; 'd'
call ___memcpy_chk
cmp r15, r13
jnz short loc_1570
loc_15AD:
mov edx, 64h ; 'd'
mov rsi, r14
mov rdi, rbp
call ___strcat_chk
mov eax, [rsp+var_s60]
movdqa xmm0, [rsp+var_s0]
movdqa xmm1, [rsp+var_s10]
movdqa xmm2, [rsp+var_s20]
movdqa xmm3, [rsp+var_s30]
movdqa xmm4, [rsp+var_s40]
mov [r12+60h], eax
movdqa xmm5, [rsp+var_s50]
movups xmmword ptr [r12], xmm0
movups xmmword ptr [r12+10h], xmm1
movups xmmword ptr [r12+20h], xmm2
movups xmmword ptr [r12+30h], xmm3
movups xmmword ptr [r12+40h], xmm4
movups xmmword ptr [r12+50h], xmm5
mov rax, [rsp+var_s68]
sub rax, fs:28h
jnz short loc_162E
add rsp, 78h
mov rax, r12
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_162E:
call ___stack_chk_fail | __m128i * func0(__m128i *a1, long long a2, int a3, long long a4)
{
long long v5; // r15
long long v6; // r13
long long v7; // rax
long long v8; // rsi
long long v9; // rax
__m128i v10; // xmm0
__m128i v11; // xmm1
__m128i v12; // xmm2
__m128i v13; // xmm3
__m128i v14; // xmm4
__m128i v15; // xmm5
__m128i vars0; // [rsp+0h] [rbp+0h] BYREF
__m128i vars10; // [rsp+10h] [rbp+10h] BYREF
__m128i vars20; // [rsp+20h] [rbp+20h] BYREF
__m128i vars30; // [rsp+30h] [rbp+30h] BYREF
__m128i vars40; // [rsp+40h] [rbp+40h] BYREF
__m128i vars50; // [rsp+50h] [rbp+50h] BYREF
__int32 vars60; // [rsp+60h] [rbp+60h]
unsigned long long vars68; // [rsp+68h] [rbp+68h]
vars68 = __readfsqword(0x28u);
vars0.m128i_i8[0] = 0;
if ( a3 > 0 )
{
v5 = a2;
v6 = a2 + 100LL * (unsigned int)(a3 - 1) + 100;
do
{
v7 = strlen(&vars0);
v8 = v5;
v5 += 100LL;
v9 = __stpcpy_chk(&vars0.m128i_i8[v7], v8, 100LL);
__memcpy_chk(v9, &unk_2004, 3LL, (char *)&vars0 - v9 + 100);
}
while ( v5 != v6 );
}
__strcat_chk(&vars0, a4, 100LL);
v10 = _mm_load_si128(&vars0);
v11 = _mm_load_si128(&vars10);
v12 = _mm_load_si128(&vars20);
v13 = _mm_load_si128(&vars30);
v14 = _mm_load_si128(&vars40);
a1[6].m128i_i32[0] = vars60;
v15 = _mm_load_si128(&vars50);
*a1 = v10;
a1[1] = v11;
a1[2] = v12;
a1[3] = v13;
a1[4] = v14;
a1[5] = v15;
return a1;
} | func0:
ENDBR64
PUSH R15
PUSH R14
MOV R14,RCX
PUSH R13
PUSH R12
MOV R12,RDI
PUSH RBP
PUSH RBX
SUB RSP,0x78
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x68],RAX
XOR EAX,EAX
MOV RBP,RSP
MOV byte ptr [RSP],0x0
TEST EDX,EDX
JLE 0x001015ad
LEA EAX,[RDX + -0x1]
MOV R15,RSI
LEA RBX,[0x102004]
MOV RBP,RSP
LEA RAX,[RAX + RAX*0x4]
LEA RAX,[RAX + RAX*0x4]
LEA R13,[RSI + RAX*0x4 + 0x64]
LAB_00101570:
MOV RDI,RBP
CALL 0x001010b0
MOV RSI,R15
MOV EDX,0x64
ADD R15,0x64
LEA RDI,[RBP + RAX*0x1]
CALL 0x001010f0
MOV RCX,RBP
MOV EDX,0x3
MOV RSI,RBX
SUB RCX,RAX
MOV RDI,RAX
ADD RCX,0x64
CALL 0x001010e0
CMP R15,R13
JNZ 0x00101570
LAB_001015ad:
MOV EDX,0x64
MOV RSI,R14
MOV RDI,RBP
CALL 0x001010a0
MOV EAX,dword ptr [RSP + 0x60]
MOVDQA XMM0,xmmword ptr [RSP]
MOVDQA XMM1,xmmword ptr [RSP + 0x10]
MOVDQA XMM2,xmmword ptr [RSP + 0x20]
MOVDQA XMM3,xmmword ptr [RSP + 0x30]
MOVDQA XMM4,xmmword ptr [RSP + 0x40]
MOV dword ptr [R12 + 0x60],EAX
MOVDQA XMM5,xmmword ptr [RSP + 0x50]
MOVUPS xmmword ptr [R12],XMM0
MOVUPS xmmword ptr [R12 + 0x10],XMM1
MOVUPS xmmword ptr [R12 + 0x20],XMM2
MOVUPS xmmword ptr [R12 + 0x30],XMM3
MOVUPS xmmword ptr [R12 + 0x40],XMM4
MOVUPS xmmword ptr [R12 + 0x50],XMM5
MOV RAX,qword ptr [RSP + 0x68]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x0010162e
ADD RSP,0x78
MOV RAX,R12
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_0010162e:
CALL 0x001010c0 | int8 * func0(int8 *param_1,long param_2,int param_3,int8 param_4)
{
size_t sVar1;
long lVar2;
long lVar3;
long in_FS_OFFSET;
char local_a8;
int7 uStack_a7;
int8 uStack_a0;
int8 local_98;
int8 uStack_90;
int8 local_88;
int8 uStack_80;
int8 local_78;
int8 uStack_70;
int8 local_68;
int8 uStack_60;
int8 local_58;
int8 uStack_50;
int4 local_48;
int1 auStack_44 [4];
long local_40;
local_40 = *(long *)(in_FS_OFFSET + 0x28);
local_a8 = '\0';
if (0 < param_3) {
lVar2 = param_2;
do {
sVar1 = strlen(&local_a8);
lVar3 = lVar2 + 100;
lVar2 = __stpcpy_chk(&local_a8 + sVar1,lVar2,100);
__memcpy_chk(lVar2,&DAT_00102004,3,auStack_44 + -lVar2);
lVar2 = lVar3;
} while (lVar3 != param_2 + 100 + (ulong)(param_3 - 1) * 100);
}
__strcat_chk(&local_a8,param_4,100);
*(int4 *)(param_1 + 0xc) = local_48;
*param_1 = CONCAT71(uStack_a7,local_a8);
param_1[1] = uStack_a0;
param_1[2] = local_98;
param_1[3] = uStack_90;
param_1[4] = local_88;
param_1[5] = uStack_80;
param_1[6] = local_78;
param_1[7] = uStack_70;
param_1[8] = local_68;
param_1[9] = uStack_60;
param_1[10] = local_58;
param_1[0xb] = uStack_50;
if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) {
return param_1;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
7,047 | func0 |
#include <stdio.h>
#include <assert.h>
#include <string.h>
struct dynamicTuple {
char elements[100];
};
| struct dynamicTuple func0(char test_list[][100], int listSize, char test_str[]) {
struct dynamicTuple result;
strcpy(result.elements, "");
for (int i = 0; i < listSize; i++) {
strcat(result.elements, test_list[i]);
strcat(result.elements, ", ");
}
strcat(result.elements, test_str);
return result;
}
| int main() {
char list1[2][100] = {"WEB", "is"};
char list2[2][100] = {"We", "are"};
char list3[2][100] = {"Part", "is"};
struct dynamicTuple result;
result = func0(list1, 2, "best");
assert(strcmp(result.elements, "WEB, is, best") == 0);
result = func0(list2, 2, "Developers");
assert(strcmp(result.elements, "We, are, Developers") == 0);
result = func0(list3, 2, "Wrong");
assert(strcmp(result.elements, "Part, is, Wrong") == 0);
return 0;
}
| O3 | c | func0:
endbr64
push %r15
push %r14
mov %rcx,%r14
push %r13
push %r12
mov %rdi,%r12
push %rbp
push %rbx
sub $0x78,%rsp
mov %fs:0x28,%rax
mov %rax,0x68(%rsp)
xor %eax,%eax
mov %rsp,%rbp
movb $0x0,(%rsp)
test %edx,%edx
jle 15c0 <func0+0xc0>
lea -0x1(%rdx),%eax
mov %rsi,%r15
lea 0xac0(%rip),%rbx
mov %rsp,%rbp
lea (%rax,%rax,4),%rax
lea (%rax,%rax,4),%rax
lea 0x64(%rsi,%rax,4),%r13
nopl 0x0(%rax)
mov %rbp,%rdi
mov (%rdi),%edx
add $0x4,%rdi
lea -0x1010101(%rdx),%eax
not %edx
and %edx,%eax
and $0x80808080,%eax
je 155b <func0+0x5b>
mov %eax,%edx
shr $0x10,%edx
test $0x8080,%eax
cmove %edx,%eax
lea 0x2(%rdi),%rdx
cmove %rdx,%rdi
mov $0x64,%edx
mov %eax,%esi
add %al,%sil
mov %r15,%rsi
sbb $0x3,%rdi
add $0x64,%r15
callq 10d0 <__stpcpy_chk@plt>
mov %rbp,%rcx
mov $0x3,%edx
mov %rbx,%rsi
sub %rax,%rcx
mov %rax,%rdi
add $0x64,%rcx
callq 10c0 <__memcpy_chk@plt>
cmp %r13,%r15
jne 1558 <func0+0x58>
mov $0x64,%edx
mov %r14,%rsi
mov %rbp,%rdi
callq 1090 <__strcat_chk@plt>
mov 0x60(%rsp),%eax
movdqa (%rsp),%xmm0
movdqa 0x10(%rsp),%xmm1
movdqa 0x20(%rsp),%xmm2
mov %eax,0x60(%r12)
movdqa 0x30(%rsp),%xmm3
movdqa 0x40(%rsp),%xmm4
movdqa 0x50(%rsp),%xmm5
movups %xmm0,(%r12)
movups %xmm1,0x10(%r12)
movups %xmm2,0x20(%r12)
movups %xmm3,0x30(%r12)
movups %xmm4,0x40(%r12)
movups %xmm5,0x50(%r12)
mov 0x68(%rsp),%rax
xor %fs:0x28,%rax
jne 1641 <func0+0x141>
add $0x78,%rsp
mov %r12,%rax
pop %rbx
pop %rbp
pop %r12
pop %r13
pop %r14
pop %r15
retq
callq 10a0 <__stack_chk_fail@plt>
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
push r15
mov r15, rcx
push r14
push r13
push r12
mov r12, rdi
push rbp
push rbx
sub rsp, 78h
mov rax, fs:28h
mov [rsp+var_s68], rax
xor eax, eax
mov rbp, rsp
mov byte ptr [rsp+var_s0], 0
test edx, edx
jle short loc_15AD
movsxd rdx, edx
mov rbx, rsi
lea r13, unk_2004
mov rbp, rsp
lea rax, [rdx+rdx*4]
lea rax, [rax+rax*4]
lea r14, [rsi+rax*4]
nop
loc_1570:
mov rdi, rbp; s
call _strlen
mov rsi, rbx
mov edx, 64h ; 'd'
add rbx, 64h ; 'd'
lea rdi, [rbp+rax+var_s0]
call ___stpcpy_chk
mov rcx, rbp
mov edx, 3
mov rsi, r13
sub rcx, rax
mov rdi, rax
add rcx, 64h ; 'd'
call ___memcpy_chk
cmp rbx, r14
jnz short loc_1570
loc_15AD:
mov edx, 64h ; 'd'
mov rsi, r15
mov rdi, rbp
call ___strcat_chk
mov eax, [rsp+var_s60]
movdqa xmm0, [rsp+var_s0]
movdqa xmm1, [rsp+var_s10]
movdqa xmm2, [rsp+var_s20]
movdqa xmm3, [rsp+var_s30]
movdqa xmm4, [rsp+var_s40]
mov [r12+60h], eax
movdqa xmm5, [rsp+var_s50]
movups xmmword ptr [r12], xmm0
movups xmmword ptr [r12+10h], xmm1
movups xmmword ptr [r12+20h], xmm2
movups xmmword ptr [r12+30h], xmm3
movups xmmword ptr [r12+40h], xmm4
movups xmmword ptr [r12+50h], xmm5
mov rax, [rsp+var_s68]
sub rax, fs:28h
jnz short loc_162E
add rsp, 78h
mov rax, r12
pop rbx
pop rbp
pop r12
pop r13
pop r14
pop r15
retn
loc_162E:
call ___stack_chk_fail | __m128i * func0(__m128i *a1, long long a2, int a3, long long a4)
{
long long v5; // rbx
long long v6; // r14
size_t v7; // rax
long long v8; // rsi
long long v9; // rax
__m128i v10; // xmm0
__m128i v11; // xmm1
__m128i v12; // xmm2
__m128i v13; // xmm3
__m128i v14; // xmm4
__m128i v15; // xmm5
__m128i vars0; // [rsp+0h] [rbp+0h] BYREF
__m128i vars10; // [rsp+10h] [rbp+10h] BYREF
__m128i vars20; // [rsp+20h] [rbp+20h] BYREF
__m128i vars30; // [rsp+30h] [rbp+30h] BYREF
__m128i vars40; // [rsp+40h] [rbp+40h] BYREF
__m128i vars50; // [rsp+50h] [rbp+50h] BYREF
__int32 vars60; // [rsp+60h] [rbp+60h]
unsigned long long vars68; // [rsp+68h] [rbp+68h]
vars68 = __readfsqword(0x28u);
vars0.m128i_i8[0] = 0;
if ( a3 > 0 )
{
v5 = a2;
v6 = a2 + 100LL * a3;
do
{
v7 = strlen(vars0.m128i_i8);
v8 = v5;
v5 += 100LL;
v9 = __stpcpy_chk(&vars0.m128i_i8[v7], v8, 100LL);
__memcpy_chk(v9, &unk_2004, 3LL, (char *)&vars0 - v9 + 100);
}
while ( v5 != v6 );
}
__strcat_chk(&vars0, a4, 100LL);
v10 = _mm_load_si128(&vars0);
v11 = _mm_load_si128(&vars10);
v12 = _mm_load_si128(&vars20);
v13 = _mm_load_si128(&vars30);
v14 = _mm_load_si128(&vars40);
a1[6].m128i_i32[0] = vars60;
v15 = _mm_load_si128(&vars50);
*a1 = v10;
a1[1] = v11;
a1[2] = v12;
a1[3] = v13;
a1[4] = v14;
a1[5] = v15;
return a1;
} | func0:
ENDBR64
PUSH R15
MOV R15,RCX
PUSH R14
PUSH R13
PUSH R12
MOV R12,RDI
PUSH RBP
PUSH RBX
SUB RSP,0x78
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x68],RAX
XOR EAX,EAX
MOV RBP,RSP
MOV byte ptr [RSP],0x0
TEST EDX,EDX
JLE 0x001015ad
MOVSXD RDX,EDX
MOV RBX,RSI
LEA R13,[0x102004]
MOV RBP,RSP
LEA RAX,[RDX + RDX*0x4]
LEA RAX,[RAX + RAX*0x4]
LEA R14,[RSI + RAX*0x4]
NOP
LAB_00101570:
MOV RDI,RBP
CALL 0x001010b0
MOV RSI,RBX
MOV EDX,0x64
ADD RBX,0x64
LEA RDI,[RBP + RAX*0x1]
CALL 0x001010f0
MOV RCX,RBP
MOV EDX,0x3
MOV RSI,R13
SUB RCX,RAX
MOV RDI,RAX
ADD RCX,0x64
CALL 0x001010e0
CMP RBX,R14
JNZ 0x00101570
LAB_001015ad:
MOV EDX,0x64
MOV RSI,R15
MOV RDI,RBP
CALL 0x001010a0
MOV EAX,dword ptr [RSP + 0x60]
MOVDQA XMM0,xmmword ptr [RSP]
MOVDQA XMM1,xmmword ptr [RSP + 0x10]
MOVDQA XMM2,xmmword ptr [RSP + 0x20]
MOVDQA XMM3,xmmword ptr [RSP + 0x30]
MOVDQA XMM4,xmmword ptr [RSP + 0x40]
MOV dword ptr [R12 + 0x60],EAX
MOVDQA XMM5,xmmword ptr [RSP + 0x50]
MOVUPS xmmword ptr [R12],XMM0
MOVUPS xmmword ptr [R12 + 0x10],XMM1
MOVUPS xmmword ptr [R12 + 0x20],XMM2
MOVUPS xmmword ptr [R12 + 0x30],XMM3
MOVUPS xmmword ptr [R12 + 0x40],XMM4
MOVUPS xmmword ptr [R12 + 0x50],XMM5
MOV RAX,qword ptr [RSP + 0x68]
SUB RAX,qword ptr FS:[0x28]
JNZ 0x0010162e
ADD RSP,0x78
MOV RAX,R12
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
LAB_0010162e:
CALL 0x001010c0 | int8 * func0(int8 *param_1,long param_2,int param_3,int8 param_4)
{
size_t sVar1;
long lVar2;
long lVar3;
long in_FS_OFFSET;
char local_a8;
int7 uStack_a7;
int8 uStack_a0;
int8 local_98;
int8 uStack_90;
int8 local_88;
int8 uStack_80;
int8 local_78;
int8 uStack_70;
int8 local_68;
int8 uStack_60;
int8 local_58;
int8 uStack_50;
int4 local_48;
int auStack_44 [4];
long local_40;
local_40 = *(long *)(in_FS_OFFSET + 0x28);
local_a8 = '\0';
if (0 < param_3) {
lVar2 = param_2;
do {
sVar1 = strlen(&local_a8);
lVar3 = lVar2 + 100;
lVar2 = __stpcpy_chk(&local_a8 + sVar1,lVar2,100);
__memcpy_chk(lVar2,&DAT_00102004,3,auStack_44 + -lVar2);
lVar2 = lVar3;
} while (lVar3 != param_2 + (long)param_3 * 100);
}
__strcat_chk(&local_a8,param_4,100);
*(int4 *)(param_1 + 0xc) = local_48;
*param_1 = CONCAT71(uStack_a7,local_a8);
param_1[1] = uStack_a0;
param_1[2] = local_98;
param_1[3] = uStack_90;
param_1[4] = local_88;
param_1[5] = uStack_80;
param_1[6] = local_78;
param_1[7] = uStack_70;
param_1[8] = local_68;
param_1[9] = uStack_60;
param_1[10] = local_58;
param_1[0xb] = uStack_50;
if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) {
return param_1;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
7,048 | func0 | #include <assert.h>
| double func0(int s, int l) {
double perimeter = s * l;
return perimeter;
}
| int main() {
assert(func0(4, 20) == 80);
assert(func0(10, 15) == 150);
assert(func0(9, 7) == 63);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %edi,-0x14(%rbp)
mov %esi,-0x18(%rbp)
mov -0x14(%rbp),%eax
imul -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd %xmm0,-0x8(%rbp)
movsd -0x8(%rbp),%xmm0
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_14], edi
mov [rbp+var_18], esi
mov eax, [rbp+var_14]
imul eax, [rbp+var_18]
pxor xmm0, xmm0
cvtsi2sd xmm0, eax
movsd [rbp+var_8], xmm0
movsd xmm0, [rbp+var_8]
pop rbp
retn | double func0(int a1, int a2)
{
return (double)(a2 * a1);
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV dword ptr [RBP + -0x14],EDI
MOV dword ptr [RBP + -0x18],ESI
MOV EAX,dword ptr [RBP + -0x14]
IMUL EAX,dword ptr [RBP + -0x18]
PXOR XMM0,XMM0
CVTSI2SD XMM0,EAX
MOVSD qword ptr [RBP + -0x8],XMM0
MOVSD XMM0,qword ptr [RBP + -0x8]
POP RBP
RET | double func0(int param_1,int param_2)
{
return (double)(param_1 * param_2);
} |
7,049 | func0 | #include <assert.h>
| double func0(int s, int l) {
double perimeter = s * l;
return perimeter;
}
| int main() {
assert(func0(4, 20) == 80);
assert(func0(10, 15) == 150);
assert(func0(9, 7) == 63);
return 0;
}
| O1 | c | func0:
endbr64
imul %esi,%edi
pxor %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
retq
| func0:
endbr64
imul edi, esi
pxor xmm0, xmm0
cvtsi2sd xmm0, edi
retn | double func0(int a1, int a2)
{
return (double)(a2 * a1);
} | func0:
ENDBR64
IMUL EDI,ESI
PXOR XMM0,XMM0
CVTSI2SD XMM0,EDI
RET | double func0(int param_1,int param_2)
{
return (double)(param_1 * param_2);
} |
7,050 | func0 | #include <assert.h>
| double func0(int s, int l) {
double perimeter = s * l;
return perimeter;
}
| int main() {
assert(func0(4, 20) == 80);
assert(func0(10, 15) == 150);
assert(func0(9, 7) == 63);
return 0;
}
| O2 | c | func0:
endbr64
imul %esi,%edi
pxor %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
retq
| func0:
endbr64
imul edi, esi
pxor xmm0, xmm0
cvtsi2sd xmm0, edi
retn | double func0(int a1, int a2)
{
return (double)(a2 * a1);
} | func0:
ENDBR64
IMUL EDI,ESI
PXOR XMM0,XMM0
CVTSI2SD XMM0,EDI
RET | double func0(int param_1,int param_2)
{
return (double)(param_1 * param_2);
} |
7,051 | func0 | #include <assert.h>
| double func0(int s, int l) {
double perimeter = s * l;
return perimeter;
}
| int main() {
assert(func0(4, 20) == 80);
assert(func0(10, 15) == 150);
assert(func0(9, 7) == 63);
return 0;
}
| O3 | c | func0:
endbr64
imul %esi,%edi
pxor %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
retq
| func0:
endbr64
imul edi, esi
pxor xmm0, xmm0
cvtsi2sd xmm0, edi
retn | double func0(int a1, int a2)
{
return (double)(a2 * a1);
} | func0:
ENDBR64
IMUL EDI,ESI
PXOR XMM0,XMM0
CVTSI2SD XMM0,EDI
RET | double func0(int param_1,int param_2)
{
return (double)(param_1 * param_2);
} |
7,052 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int nums[], int length) {
for (int i = 0; i < length; i++) {
if (nums[i] % 2 != i % 2) {
return false;
}
}
return true;
}
| int main() {
int arr1[] = {3, 2, 1};
int arr2[] = {1, 2, 3};
int arr3[] = {2, 1, 4};
assert(func0(arr1, 3) == false);
assert(func0(arr2, 3) == false);
assert(func0(arr3, 3) == true);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11c1 <func0+0x58>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cltd
shr $0x1f,%edx
add %edx,%eax
and $0x1,%eax
sub %edx,%eax
mov %eax,%ecx
mov -0x4(%rbp),%eax
cltd
shr $0x1f,%edx
add %edx,%eax
and $0x1,%eax
sub %edx,%eax
cmp %eax,%ecx
je 11bd <func0+0x54>
mov $0x0,%eax
jmp 11ce <func0+0x65>
addl $0x1,-0x4(%rbp)
mov -0x4(%rbp),%eax
cmp -0x1c(%rbp),%eax
jl 1181 <func0+0x18>
mov $0x1,%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_4], 0
jmp short loc_11CB
loc_1181:
mov eax, [rbp+var_4]
cdqe
lea rdx, ds:0[rax*4]
mov rax, [rbp+var_18]
add rax, rdx
mov edx, [rax]
mov eax, edx
sar eax, 1Fh
shr eax, 1Fh
add edx, eax
and edx, 1
sub edx, eax
mov ecx, edx
mov edx, [rbp+var_4]
mov eax, edx
sar eax, 1Fh
shr eax, 1Fh
add edx, eax
and edx, 1
sub edx, eax
mov eax, edx
cmp ecx, eax
jz short loc_11C7
mov eax, 0
jmp short loc_11D8
loc_11C7:
add [rbp+var_4], 1
loc_11CB:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_1181
mov eax, 1
loc_11D8:
pop rbp
retn | long long func0(long long a1, int a2)
{
int i; // [rsp+18h] [rbp-4h]
for ( i = 0; i < a2; ++i )
{
if ( *(_DWORD *)(4LL * i + a1) % 2 != i % 2 )
return 0LL;
}
return 1LL;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011cb
LAB_00101181:
MOV EAX,dword ptr [RBP + -0x4]
CDQE
LEA RDX,[RAX*0x4]
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EDX,dword ptr [RAX]
MOV EAX,EDX
SAR EAX,0x1f
SHR EAX,0x1f
ADD EDX,EAX
AND EDX,0x1
SUB EDX,EAX
MOV ECX,EDX
MOV EDX,dword ptr [RBP + -0x4]
MOV EAX,EDX
SAR EAX,0x1f
SHR EAX,0x1f
ADD EDX,EAX
AND EDX,0x1
SUB EDX,EAX
MOV EAX,EDX
CMP ECX,EAX
JZ 0x001011c7
MOV EAX,0x0
JMP 0x001011d8
LAB_001011c7:
ADD dword ptr [RBP + -0x4],0x1
LAB_001011cb:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x00101181
MOV EAX,0x1
LAB_001011d8:
POP RBP
RET | int8 func0(long param_1,int param_2)
{
int local_c;
local_c = 0;
while( true ) {
if (param_2 <= local_c) {
return 1;
}
if (*(int *)(param_1 + (long)local_c * 4) % 2 != local_c % 2) break;
local_c = local_c + 1;
}
return 0;
} |
7,053 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int nums[], int length) {
for (int i = 0; i < length; i++) {
if (nums[i] % 2 != i % 2) {
return false;
}
}
return true;
}
| int main() {
int arr1[] = {3, 2, 1};
int arr2[] = {1, 2, 3};
int arr3[] = {2, 1, 4};
assert(func0(arr1, 3) == false);
assert(func0(arr2, 3) == false);
assert(func0(arr3, 3) == true);
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 11ae <func0+0x45>
lea -0x1(%rsi),%r8d
mov $0x0,%ecx
jmp 117f <func0+0x16>
mov %rax,%rcx
mov (%rdi,%rcx,4),%eax
mov %eax,%edx
shr $0x1f,%edx
add %edx,%eax
and $0x1,%eax
sub %edx,%eax
mov %ecx,%esi
shr $0x1f,%esi
lea (%rsi,%rcx,1),%edx
and $0x1,%edx
sub %esi,%edx
cmp %edx,%eax
jne 11b4 <func0+0x4b>
lea 0x1(%rcx),%rax
cmp %r8,%rcx
jne 117c <func0+0x13>
mov $0x1,%eax
retq
mov $0x1,%eax
retq
mov $0x0,%eax
retq
| func0:
endbr64
test esi, esi
jle short loc_11AB
mov esi, esi
mov ecx, 0
loc_1178:
mov eax, [rdi+rcx*4]
mov edx, eax
shr edx, 1Fh
add eax, edx
and eax, 1
sub eax, edx
mov r8d, ecx
shr r8d, 1Fh
lea edx, [r8+rcx]
and edx, 1
sub edx, r8d
cmp eax, edx
jnz short loc_11B1
add rcx, 1
cmp rcx, rsi
jnz short loc_1178
mov eax, 1
retn
loc_11AB:
mov eax, 1
retn
loc_11B1:
mov eax, 0
retn | long long func0(long long a1, int a2)
{
long long v2; // rcx
if ( a2 <= 0 )
return 1LL;
v2 = 0LL;
while ( *(_DWORD *)(a1 + 4 * v2) % 2 == (int)v2 % 2 )
{
if ( ++v2 == a2 )
return 1LL;
}
return 0LL;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001011ab
MOV ESI,ESI
MOV ECX,0x0
LAB_00101178:
MOV EAX,dword ptr [RDI + RCX*0x4]
MOV EDX,EAX
SHR EDX,0x1f
ADD EAX,EDX
AND EAX,0x1
SUB EAX,EDX
MOV R8D,ECX
SHR R8D,0x1f
LEA EDX,[R8 + RCX*0x1]
AND EDX,0x1
SUB EDX,R8D
CMP EAX,EDX
JNZ 0x001011b1
ADD RCX,0x1
CMP RCX,RSI
JNZ 0x00101178
MOV EAX,0x1
RET
LAB_001011ab:
MOV EAX,0x1
RET
LAB_001011b1:
MOV EAX,0x0
RET | int8 func0(long param_1,uint param_2)
{
uint uVar1;
ulong uVar2;
if ((int)param_2 < 1) {
return 1;
}
uVar2 = 0;
do {
uVar1 = (uint)(uVar2 >> 0x1f) & 1;
if (*(int *)(param_1 + uVar2 * 4) % 2 != (uVar1 + (int)uVar2 & 1) - uVar1) {
return 0;
}
uVar2 = uVar2 + 1;
} while (uVar2 != param_2);
return 1;
} |
7,054 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int nums[], int length) {
for (int i = 0; i < length; i++) {
if (nums[i] % 2 != i % 2) {
return false;
}
}
return true;
}
| int main() {
int arr1[] = {3, 2, 1};
int arr2[] = {1, 2, 3};
int arr3[] = {2, 1, 4};
assert(func0(arr1, 3) == false);
assert(func0(arr2, 3) == false);
assert(func0(arr3, 3) == true);
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 1180 <func0+0x40>
sub $0x1,%esi
xor %edx,%edx
jmp 115c <func0+0x1c>
lea 0x1(%rdx),%rax
cmp %rsi,%rdx
je 1180 <func0+0x40>
mov %rax,%rdx
mov (%rdi,%rdx,4),%eax
mov %eax,%ecx
shr $0x1f,%ecx
add %ecx,%eax
and $0x1,%eax
sub %ecx,%eax
mov %edx,%ecx
and $0x1,%ecx
cmp %ecx,%eax
je 1150 <func0+0x10>
xor %eax,%eax
retq
nopw 0x0(%rax,%rax,1)
mov $0x1,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_1178
movsxd rsi, esi
xor edx, edx
jmp short loc_1159
loc_1150:
add rdx, 1
cmp rdx, rsi
jz short loc_1178
loc_1159:
mov eax, [rdi+rdx*4]
mov ecx, eax
shr ecx, 1Fh
add eax, ecx
and eax, 1
sub eax, ecx
mov ecx, edx
and ecx, 1
cmp eax, ecx
jz short loc_1150
xor eax, eax
retn
loc_1178:
mov eax, 1
retn | long long func0(long long a1, int a2)
{
long long v2; // rdx
if ( a2 <= 0 )
return 1LL;
v2 = 0LL;
while ( *(_DWORD *)(a1 + 4 * v2) % 2 == (v2 & 1) )
{
if ( ++v2 == a2 )
return 1LL;
}
return 0LL;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101178
MOVSXD RSI,ESI
XOR EDX,EDX
JMP 0x00101159
LAB_00101150:
ADD RDX,0x1
CMP RDX,RSI
JZ 0x00101178
LAB_00101159:
MOV EAX,dword ptr [RDI + RDX*0x4]
MOV ECX,EAX
SHR ECX,0x1f
ADD EAX,ECX
AND EAX,0x1
SUB EAX,ECX
MOV ECX,EDX
AND ECX,0x1
CMP EAX,ECX
JZ 0x00101150
XOR EAX,EAX
RET
LAB_00101178:
MOV EAX,0x1
RET | int8 func0(long param_1,int param_2)
{
long lVar1;
if (0 < param_2) {
lVar1 = 0;
do {
if (*(int *)(param_1 + lVar1 * 4) % 2 != ((uint)lVar1 & 1)) {
return 0;
}
lVar1 = lVar1 + 1;
} while (lVar1 != param_2);
}
return 1;
} |
7,055 | func0 |
#include <stdbool.h>
#include <assert.h>
| bool func0(int nums[], int length) {
for (int i = 0; i < length; i++) {
if (nums[i] % 2 != i % 2) {
return false;
}
}
return true;
}
| int main() {
int arr1[] = {3, 2, 1};
int arr2[] = {1, 2, 3};
int arr3[] = {2, 1, 4};
assert(func0(arr1, 3) == false);
assert(func0(arr2, 3) == false);
assert(func0(arr3, 3) == true);
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 1180 <func0+0x40>
sub $0x1,%esi
xor %edx,%edx
jmp 115c <func0+0x1c>
lea 0x1(%rdx),%rax
cmp %rsi,%rdx
je 1180 <func0+0x40>
mov %rax,%rdx
mov (%rdi,%rdx,4),%eax
mov %eax,%ecx
shr $0x1f,%ecx
add %ecx,%eax
and $0x1,%eax
sub %ecx,%eax
mov %edx,%ecx
and $0x1,%ecx
cmp %ecx,%eax
je 1150 <func0+0x10>
xor %eax,%eax
retq
nopw 0x0(%rax,%rax,1)
mov $0x1,%eax
retq
nopw %cs:0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_1178
movsxd rsi, esi
xor edx, edx
jmp short loc_1159
loc_1150:
add rdx, 1
cmp rsi, rdx
jz short loc_1178
loc_1159:
mov eax, [rdi+rdx*4]
mov ecx, eax
shr ecx, 1Fh
add eax, ecx
and eax, 1
sub eax, ecx
mov ecx, edx
and ecx, 1
cmp eax, ecx
jz short loc_1150
xor eax, eax
retn
loc_1178:
mov eax, 1
retn | long long func0(long long a1, int a2)
{
long long v2; // rdx
if ( a2 <= 0 )
return 1LL;
v2 = 0LL;
while ( *(_DWORD *)(a1 + 4 * v2) % 2 == (v2 & 1) )
{
if ( a2 == ++v2 )
return 1LL;
}
return 0LL;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101178
MOVSXD RSI,ESI
XOR EDX,EDX
JMP 0x00101159
LAB_00101150:
ADD RDX,0x1
CMP RSI,RDX
JZ 0x00101178
LAB_00101159:
MOV EAX,dword ptr [RDI + RDX*0x4]
MOV ECX,EAX
SHR ECX,0x1f
ADD EAX,ECX
AND EAX,0x1
SUB EAX,ECX
MOV ECX,EDX
AND ECX,0x1
CMP EAX,ECX
JZ 0x00101150
XOR EAX,EAX
RET
LAB_00101178:
MOV EAX,0x1
RET | int8 func0(long param_1,int param_2)
{
long lVar1;
if (0 < param_2) {
lVar1 = 0;
do {
if (*(int *)(param_1 + lVar1 * 4) % 2 != ((uint)lVar1 & 1)) {
return 0;
}
lVar1 = lVar1 + 1;
} while (param_2 != lVar1);
}
return 1;
} |
7,056 | func0 | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
typedef struct {
int *elements;
int size;
} Tuple;
| Tuple func0(Tuple test_tup) {
Tuple res;
int *elements = (int*)malloc(test_tup.size * sizeof(int));
int count = 0;
for (int i = 0; i < test_tup.size; i++) {
// Assuming we are not handling nested tuples within C as Python handles
// We'd be adding checks for flat integers only
elements[count] = test_tup.elements[i];
count++;
}
res.elements = elements;
res.size = count;
return res;
}
| int main() {
Tuple test_tup1 = {(int[]){1, 5, 7, 10}, 4};
Tuple test_tup2 = {(int[]){2, 6, 8, 11}, 4};
Tuple test_tup3 = {(int[]){3, 7, 9, 12}, 4};
Tuple result1 = func0(test_tup1);
Tuple result2 = func0(test_tup2);
Tuple result3 = func0(test_tup3);
assert(result1.size == 4 && result1.elements[0] == 1 && result1.elements[1] == 5 && result1.elements[2] == 7 && result1.elements[3] == 10);
assert(result2.size == 4 && result2.elements[0] == 2 && result2.elements[1] == 6 && result2.elements[2] == 8 && result2.elements[3] == 11);
assert(result3.size == 4 && result3.elements[0] == 3 && result3.elements[1] == 7 && result3.elements[2] == 9 && result3.elements[3] == 12);
printf("All tests passed!\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x30,%rsp
mov %rdi,%rax
mov %rsi,%rcx
mov %rcx,%rdx
mov %rax,-0x30(%rbp)
mov %rdx,-0x28(%rbp)
mov -0x28(%rbp),%eax
cltq
shl $0x2,%rax
mov %rax,%rdi
callq 10b0 <malloc@plt>
mov %rax,-0x18(%rbp)
movl $0x0,-0x20(%rbp)
movl $0x0,-0x1c(%rbp)
jmp 121d <func0+0x74>
mov -0x30(%rbp),%rax
mov -0x1c(%rbp),%edx
movslq %edx,%rdx
shl $0x2,%rdx
add %rdx,%rax
mov -0x20(%rbp),%edx
movslq %edx,%rdx
lea 0x0(,%rdx,4),%rcx
mov -0x18(%rbp),%rdx
add %rcx,%rdx
mov (%rax),%eax
mov %eax,(%rdx)
addl $0x1,-0x20(%rbp)
addl $0x1,-0x1c(%rbp)
mov -0x28(%rbp),%eax
cmp %eax,-0x1c(%rbp)
jl 11eb <func0+0x42>
mov -0x18(%rbp),%rax
mov %rax,-0x10(%rbp)
mov -0x20(%rbp),%eax
mov %eax,-0x8(%rbp)
mov -0x10(%rbp),%rax
mov -0x8(%rbp),%rdx
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 30h
mov rax, rdi
mov rcx, rsi
mov rdx, rcx
mov [rbp+var_30], rax
mov [rbp+var_28], rdx
mov eax, dword ptr [rbp+var_28]
cdqe
shl rax, 2
mov rdi, rax; size
call _malloc
mov [rbp+var_18], rax
mov [rbp+var_20], 0
mov [rbp+var_1C], 0
jmp short loc_121D
loc_11EB:
mov rax, [rbp+var_30]
mov edx, [rbp+var_1C]
movsxd rdx, edx
shl rdx, 2
add rax, rdx
mov edx, [rbp+var_20]
movsxd rdx, edx
lea rcx, ds:0[rdx*4]
mov rdx, [rbp+var_18]
add rdx, rcx
mov eax, [rax]
mov [rdx], eax
add [rbp+var_20], 1
add [rbp+var_1C], 1
loc_121D:
mov eax, dword ptr [rbp+var_28]
cmp [rbp+var_1C], eax
jl short loc_11EB
mov rax, [rbp+var_18]
mov [rbp+var_10], rax
mov eax, [rbp+var_20]
mov dword ptr [rbp+var_8], eax
mov rax, [rbp+var_10]
mov rdx, [rbp+var_8]
leave
retn | _DWORD * func0(long long a1, int a2)
{
int v3; // [rsp+10h] [rbp-20h]
int i; // [rsp+14h] [rbp-1Ch]
_DWORD *v5; // [rsp+18h] [rbp-18h]
v5 = malloc(4LL * a2);
v3 = 0;
for ( i = 0; i < a2; ++i )
v5[v3++] = *(_DWORD *)(4LL * i + a1);
return v5;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x30
MOV RAX,RDI
MOV RCX,RSI
MOV RDX,RCX
MOV qword ptr [RBP + -0x30],RAX
MOV qword ptr [RBP + -0x28],RDX
MOV EAX,dword ptr [RBP + -0x28]
CDQE
SHL RAX,0x2
MOV RDI,RAX
CALL 0x001010b0
MOV qword ptr [RBP + -0x18],RAX
MOV dword ptr [RBP + -0x20],0x0
MOV dword ptr [RBP + -0x1c],0x0
JMP 0x0010121d
LAB_001011eb:
MOV RAX,qword ptr [RBP + -0x30]
MOV EDX,dword ptr [RBP + -0x1c]
MOVSXD RDX,EDX
SHL RDX,0x2
ADD RAX,RDX
MOV EDX,dword ptr [RBP + -0x20]
MOVSXD RDX,EDX
LEA RCX,[RDX*0x4]
MOV RDX,qword ptr [RBP + -0x18]
ADD RDX,RCX
MOV EAX,dword ptr [RAX]
MOV dword ptr [RDX],EAX
ADD dword ptr [RBP + -0x20],0x1
ADD dword ptr [RBP + -0x1c],0x1
LAB_0010121d:
MOV EAX,dword ptr [RBP + -0x28]
CMP dword ptr [RBP + -0x1c],EAX
JL 0x001011eb
MOV RAX,qword ptr [RBP + -0x18]
MOV qword ptr [RBP + -0x10],RAX
MOV EAX,dword ptr [RBP + -0x20]
MOV dword ptr [RBP + -0x8],EAX
MOV RAX,qword ptr [RBP + -0x10]
MOV RDX,qword ptr [RBP + -0x8]
LEAVE
RET | int [16] func0(long param_1,int param_2)
{
int auVar1 [16];
void *pvVar2;
int4 local_28;
int4 local_24;
int4 uStack_c;
pvVar2 = malloc((long)param_2 << 2);
local_28 = 0;
for (local_24 = 0; local_24 < param_2; local_24 = local_24 + 1) {
*(int4 *)((long)pvVar2 + (long)local_28 * 4) =
*(int4 *)(param_1 + (long)local_24 * 4);
local_28 = local_28 + 1;
}
auVar1._8_4_ = local_28;
auVar1._0_8_ = pvVar2;
auVar1._12_4_ = uStack_c;
return auVar1;
} |
7,057 | func0 | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
typedef struct {
int *elements;
int size;
} Tuple;
| Tuple func0(Tuple test_tup) {
Tuple res;
int *elements = (int*)malloc(test_tup.size * sizeof(int));
int count = 0;
for (int i = 0; i < test_tup.size; i++) {
// Assuming we are not handling nested tuples within C as Python handles
// We'd be adding checks for flat integers only
elements[count] = test_tup.elements[i];
count++;
}
res.elements = elements;
res.size = count;
return res;
}
| int main() {
Tuple test_tup1 = {(int[]){1, 5, 7, 10}, 4};
Tuple test_tup2 = {(int[]){2, 6, 8, 11}, 4};
Tuple test_tup3 = {(int[]){3, 7, 9, 12}, 4};
Tuple result1 = func0(test_tup1);
Tuple result2 = func0(test_tup2);
Tuple result3 = func0(test_tup3);
assert(result1.size == 4 && result1.elements[0] == 1 && result1.elements[1] == 5 && result1.elements[2] == 7 && result1.elements[3] == 10);
assert(result2.size == 4 && result2.elements[0] == 2 && result2.elements[1] == 6 && result2.elements[2] == 8 && result2.elements[3] == 11);
assert(result3.size == 4 && result3.elements[0] == 3 && result3.elements[1] == 7 && result3.elements[2] == 9 && result3.elements[3] == 12);
printf("All tests passed!\n");
return 0;
}
| O1 | c | func0:
endbr64
push %r12
push %rbp
push %rbx
mov %rdi,%rbp
mov %rsi,%r12
mov %esi,%ebx
movslq %esi,%rdi
shl $0x2,%rdi
callq 10b0 <malloc@plt>
test %r12d,%r12d
jle 11f0 <func0+0x47>
mov %rbp,%rdi
lea -0x1(%r12),%esi
mov $0x0,%edx
mov (%rdi,%rdx,4),%ecx
mov %ecx,(%rax,%rdx,4)
mov %rdx,%rcx
add $0x1,%rdx
cmp %rsi,%rcx
jne 11d7 <func0+0x2e>
mov %ebx,%edx
pop %rbx
pop %rbp
pop %r12
retq
mov $0x0,%ebx
jmp 11e9 <func0+0x40>
| func0:
endbr64
push r12
push rbp
push rbx
mov rbp, rdi
mov rbx, rsi
mov r12d, esi
movsxd rdi, esi
shl rdi, 2
call _malloc
test ebx, ebx
jle short loc_11E9
mov esi, ebx
mov edx, 0
loc_11D1:
mov ecx, [rbp+rdx*4+0]
mov [rax+rdx*4], ecx
add rdx, 1
cmp rdx, rsi
jnz short loc_11D1
loc_11E1:
mov edx, r12d
pop rbx
pop rbp
pop r12
retn
loc_11E9:
mov r12d, 0
jmp short loc_11E1 | long long func0(long long a1, int a2)
{
long long result; // rax
long long i; // rdx
result = malloc(4LL * a2);
if ( a2 > 0 )
{
for ( i = 0LL; i != a2; ++i )
*(_DWORD *)(result + 4 * i) = *(_DWORD *)(a1 + 4 * i);
}
return result;
} | func0:
ENDBR64
PUSH R12
PUSH RBP
PUSH RBX
MOV RBP,RDI
MOV RBX,RSI
MOV R12D,ESI
MOVSXD RDI,ESI
SHL RDI,0x2
CALL 0x001010b0
TEST EBX,EBX
JLE 0x001011e9
MOV ESI,EBX
MOV EDX,0x0
LAB_001011d1:
MOV ECX,dword ptr [RBP + RDX*0x4]
MOV dword ptr [RAX + RDX*0x4],ECX
ADD RDX,0x1
CMP RDX,RSI
JNZ 0x001011d1
LAB_001011e1:
MOV EDX,R12D
POP RBX
POP RBP
POP R12
RET
LAB_001011e9:
MOV R12D,0x0
JMP 0x001011e1 | void func0(long param_1,uint param_2)
{
void *pvVar1;
ulong uVar2;
pvVar1 = malloc((long)(int)param_2 << 2);
if (0 < (int)param_2) {
uVar2 = 0;
do {
*(int4 *)((long)pvVar1 + uVar2 * 4) = *(int4 *)(param_1 + uVar2 * 4);
uVar2 = uVar2 + 1;
} while (uVar2 != param_2);
}
return;
} |
7,058 | func0 | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
typedef struct {
int *elements;
int size;
} Tuple;
| Tuple func0(Tuple test_tup) {
Tuple res;
int *elements = (int*)malloc(test_tup.size * sizeof(int));
int count = 0;
for (int i = 0; i < test_tup.size; i++) {
// Assuming we are not handling nested tuples within C as Python handles
// We'd be adding checks for flat integers only
elements[count] = test_tup.elements[i];
count++;
}
res.elements = elements;
res.size = count;
return res;
}
| int main() {
Tuple test_tup1 = {(int[]){1, 5, 7, 10}, 4};
Tuple test_tup2 = {(int[]){2, 6, 8, 11}, 4};
Tuple test_tup3 = {(int[]){3, 7, 9, 12}, 4};
Tuple result1 = func0(test_tup1);
Tuple result2 = func0(test_tup2);
Tuple result3 = func0(test_tup3);
assert(result1.size == 4 && result1.elements[0] == 1 && result1.elements[1] == 5 && result1.elements[2] == 7 && result1.elements[3] == 10);
assert(result2.size == 4 && result2.elements[0] == 2 && result2.elements[1] == 6 && result2.elements[2] == 8 && result2.elements[3] == 11);
assert(result3.size == 4 && result3.elements[0] == 3 && result3.elements[1] == 7 && result3.elements[2] == 9 && result3.elements[3] == 12);
printf("All tests passed!\n");
return 0;
}
| O2 | c | func0:
endbr64
push %r12
mov %rsi,%r12
push %rbp
mov %rdi,%rbp
movslq %esi,%rdi
push %rbx
shl $0x2,%rdi
mov %esi,%ebx
callq 10b0 <malloc@plt>
test %r12d,%r12d
jle 13c0 <func0+0x50>
lea -0x1(%r12),%esi
xor %edx,%edx
nopl 0x0(%rax,%rax,1)
mov 0x0(%rbp,%rdx,4),%ecx
mov %ecx,(%rax,%rdx,4)
mov %rdx,%rcx
add $0x1,%rdx
cmp %rcx,%rsi
jne 13a0 <func0+0x30>
mov %ebx,%edx
pop %rbx
pop %rbp
pop %r12
retq
nopw 0x0(%rax,%rax,1)
xor %ebx,%ebx
mov %ebx,%edx
pop %rbx
pop %rbp
pop %r12
retq
nopl 0x0(%rax)
| func0:
endbr64
push r13
mov r13, rdi
push r12
movsxd r12, esi
push rbp
shl r12, 2
mov ebp, esi
push rbx
mov rdi, r12
mov rbx, rsi
sub rsp, 8
call _malloc
mov r8, rax
test ebx, ebx
jle short loc_13E0
mov rdx, r12
mov rsi, r13
mov rdi, rax
call _memcpy
add rsp, 8
mov edx, ebp
mov r8, rax
pop rbx
pop rbp
mov rax, r8
pop r12
pop r13
retn
loc_13E0:
add rsp, 8
xor ebp, ebp
mov rax, r8
pop rbx
mov edx, ebp
pop rbp
pop r12
pop r13
retn | long long func0(long long a1, int a2)
{
long long result; // rax
long long v3; // rcx
result = malloc(4LL * a2);
if ( a2 > 0 )
return memcpy(result, a1, 4LL * a2, v3, result);
return result;
} | func0:
ENDBR64
PUSH R13
MOV R13,RDI
PUSH R12
MOVSXD R12,ESI
PUSH RBP
SHL R12,0x2
MOV EBP,ESI
PUSH RBX
MOV RDI,R12
MOV RBX,RSI
SUB RSP,0x8
CALL 0x001010d0
MOV R8,RAX
TEST EBX,EBX
JLE 0x001013e0
MOV RDX,R12
MOV RSI,R13
MOV RDI,RAX
CALL 0x001010c0
ADD RSP,0x8
MOV EDX,EBP
MOV R8,RAX
POP RBX
POP RBP
MOV RAX,R8
POP R12
POP R13
RET
LAB_001013e0:
ADD RSP,0x8
XOR EBP,EBP
MOV RAX,R8
POP RBX
MOV EDX,EBP
POP RBP
POP R12
POP R13
RET | int1 [16] func0(void *param_1,int param_2)
{
int1 auVar1 [16];
int1 auVar2 [16];
auVar2._0_8_ = malloc((long)param_2 << 2);
if (0 < param_2) {
auVar1._0_8_ = memcpy(auVar2._0_8_,param_1,(long)param_2 << 2);
auVar1._8_4_ = param_2;
auVar1._12_4_ = 0;
return auVar1;
}
auVar2._8_8_ = 0;
return auVar2;
} |
7,059 | func0 | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
typedef struct {
int *elements;
int size;
} Tuple;
| Tuple func0(Tuple test_tup) {
Tuple res;
int *elements = (int*)malloc(test_tup.size * sizeof(int));
int count = 0;
for (int i = 0; i < test_tup.size; i++) {
// Assuming we are not handling nested tuples within C as Python handles
// We'd be adding checks for flat integers only
elements[count] = test_tup.elements[i];
count++;
}
res.elements = elements;
res.size = count;
return res;
}
| int main() {
Tuple test_tup1 = {(int[]){1, 5, 7, 10}, 4};
Tuple test_tup2 = {(int[]){2, 6, 8, 11}, 4};
Tuple test_tup3 = {(int[]){3, 7, 9, 12}, 4};
Tuple result1 = func0(test_tup1);
Tuple result2 = func0(test_tup2);
Tuple result3 = func0(test_tup3);
assert(result1.size == 4 && result1.elements[0] == 1 && result1.elements[1] == 5 && result1.elements[2] == 7 && result1.elements[3] == 10);
assert(result2.size == 4 && result2.elements[0] == 2 && result2.elements[1] == 6 && result2.elements[2] == 8 && result2.elements[3] == 11);
assert(result3.size == 4 && result3.elements[0] == 3 && result3.elements[1] == 7 && result3.elements[2] == 9 && result3.elements[3] == 12);
printf("All tests passed!\n");
return 0;
}
| O3 | c | func0:
endbr64
push %r12
mov %rdi,%r12
movslq %esi,%rdi
push %rbp
shl $0x2,%rdi
mov %esi,%ebp
push %rbx
mov %rsi,%rbx
callq 10d0 <malloc@plt>
mov %rax,%r8
test %ebx,%ebx
jle 13b0 <func0+0x50>
lea -0x1(%rbx),%eax
mov %r12,%rsi
mov %r8,%rdi
lea 0x4(,%rax,4),%rdx
callq 10c0 <memcpy@plt>
mov %ebp,%edx
pop %rbx
pop %rbp
mov %rax,%r8
pop %r12
mov %r8,%rax
retq
nopw %cs:0x0(%rax,%rax,1)
xor %ebp,%ebp
pop %rbx
mov %r8,%rax
mov %ebp,%edx
pop %rbp
pop %r12
retq
nopl 0x0(%rax)
| func0:
endbr64
push r12
mov r12d, esi
push rbp
mov rbp, rdi
movsxd rdi, esi
push rbx
shl rdi, 2; size
mov rbx, rsi
call _malloc
mov rcx, rax
test ebx, ebx
jle short loc_13A8
mov edx, ebx
mov rsi, rbp; src
mov rdi, rax; dest
shl rdx, 2; n
call _memcpy
mov edx, r12d
pop rbx
pop rbp
mov rcx, rax
pop r12
mov rax, rcx
retn
loc_13A8:
xor r12d, r12d
pop rbx
mov rax, rcx
pop rbp
mov edx, r12d
pop r12
retn | void * func0(void *src, int a2)
{
void *result; // rax
result = malloc(4LL * a2);
if ( a2 > 0 )
return memcpy(result, src, 4LL * (unsigned int)a2);
return result;
} | func0:
ENDBR64
PUSH R12
MOV R12D,ESI
PUSH RBP
MOV RBP,RDI
MOVSXD RDI,ESI
PUSH RBX
SHL RDI,0x2
MOV RBX,RSI
CALL 0x001010d0
MOV RCX,RAX
TEST EBX,EBX
JLE 0x001013a8
MOV EDX,EBX
MOV RSI,RBP
MOV RDI,RAX
SHL RDX,0x2
CALL 0x001010c0
MOV EDX,R12D
POP RBX
POP RBP
MOV RCX,RAX
POP R12
MOV RAX,RCX
RET
LAB_001013a8:
XOR R12D,R12D
POP RBX
MOV RAX,RCX
POP RBP
MOV EDX,R12D
POP R12
RET | int [16] func0(void *param_1,uint param_2)
{
int auVar1 [16];
int auVar2 [16];
auVar2._0_8_ = malloc((long)(int)param_2 << 2);
if (0 < (int)param_2) {
auVar1._0_8_ = memcpy(auVar2._0_8_,param_1,(ulong)param_2 << 2);
auVar1._8_4_ = param_2;
auVar1._12_4_ = 0;
return auVar1;
}
auVar2._8_8_ = 0;
return auVar2;
} |
7,060 | func0 |
#include <assert.h>
| int func0(int input_list[][2], int size) {
return size;
}
| int main() {
int list1[][2] = {{1, 3}, {5, 7}, {9, 11}, {13, 15}};
int list2[][2] = {{1, 2}, {2, 3}, {4, 5}};
int list3[][2] = {{1, 0}, {2, 0}};
assert(func0(list1, 4) == 4);
assert(func0(list2, 3) == 3);
assert(func0(list3, 2) == 2);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x8(%rbp)
mov %esi,-0xc(%rbp)
mov -0xc(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_8], rdi
mov [rbp+var_C], esi
mov eax, [rbp+var_C]
pop rbp
retn | long long func0(long long a1, unsigned int a2)
{
return a2;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x8],RDI
MOV dword ptr [RBP + -0xc],ESI
MOV EAX,dword ptr [RBP + -0xc]
POP RBP
RET | int4 func0(int8 param_1,int4 param_2)
{
return param_2;
} |
7,061 | func0 |
#include <assert.h>
| int func0(int input_list[][2], int size) {
return size;
}
| int main() {
int list1[][2] = {{1, 3}, {5, 7}, {9, 11}, {13, 15}};
int list2[][2] = {{1, 2}, {2, 3}, {4, 5}};
int list3[][2] = {{1, 0}, {2, 0}};
assert(func0(list1, 4) == 4);
assert(func0(list2, 3) == 3);
assert(func0(list3, 2) == 2);
return 0;
}
| O1 | c | func0:
endbr64
mov %esi,%eax
retq
| func0:
endbr64
mov eax, esi
retn | long long func0(long long a1, unsigned int a2)
{
return a2;
} | func0:
ENDBR64
MOV EAX,ESI
RET | int4 func0(int8 param_1,int4 param_2)
{
return param_2;
} |
7,062 | func0 |
#include <assert.h>
| int func0(int input_list[][2], int size) {
return size;
}
| int main() {
int list1[][2] = {{1, 3}, {5, 7}, {9, 11}, {13, 15}};
int list2[][2] = {{1, 2}, {2, 3}, {4, 5}};
int list3[][2] = {{1, 0}, {2, 0}};
assert(func0(list1, 4) == 4);
assert(func0(list2, 3) == 3);
assert(func0(list3, 2) == 2);
return 0;
}
| O2 | c | func0:
endbr64
mov %esi,%eax
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
mov eax, esi
retn | long long func0(long long a1, unsigned int a2)
{
return a2;
} | func0:
ENDBR64
MOV EAX,ESI
RET | int4 func0(int8 param_1,int4 param_2)
{
return param_2;
} |
7,063 | func0 |
#include <assert.h>
| int func0(int input_list[][2], int size) {
return size;
}
| int main() {
int list1[][2] = {{1, 3}, {5, 7}, {9, 11}, {13, 15}};
int list2[][2] = {{1, 2}, {2, 3}, {4, 5}};
int list3[][2] = {{1, 0}, {2, 0}};
assert(func0(list1, 4) == 4);
assert(func0(list2, 3) == 3);
assert(func0(list3, 2) == 2);
return 0;
}
| O3 | c | func0:
endbr64
mov %esi,%eax
retq
nopw 0x0(%rax,%rax,1)
| func0:
endbr64
mov eax, esi
retn | long long func0(long long a1, unsigned int a2)
{
return a2;
} | func0:
ENDBR64
MOV EAX,ESI
RET | int4 func0(int8 param_1,int4 param_2)
{
return param_2;
} |
7,064 | func0 |
#include <assert.h>
| int func0(int arr[], int x, int n) {
int low = 0;
int high = n - 1;
int res = -1;
while (low <= high) {
int mid = (low + high) / 2;
if (arr[mid] > x) {
high = mid - 1;
} else if (arr[mid] < x) {
low = mid + 1;
} else {
res = mid;
low = mid + 1;
}
}
return res;
}
| int main() {
int arr1[] = {1, 2, 3};
assert(func0(arr1, 1, 3) == 0);
int arr2[] = {1, 1, 1, 2, 3, 4};
assert(func0(arr2, 1, 6) == 2);
int arr3[] = {2, 3, 2, 3, 6, 8, 9};
assert(func0(arr3, 3, 7) == 3);
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,-0x10(%rbp)
mov -0x20(%rbp),%eax
sub $0x1,%eax
mov %eax,-0xc(%rbp)
movl $0xffffffff,-0x8(%rbp)
jmp 1203 <func0+0x9a>
mov -0x10(%rbp),%edx
mov -0xc(%rbp),%eax
add %edx,%eax
mov %eax,%edx
shr $0x1f,%edx
add %edx,%eax
sar %eax
mov %eax,-0x4(%rbp)
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cmp %eax,-0x1c(%rbp)
jge 11ce <func0+0x65>
mov -0x4(%rbp),%eax
sub $0x1,%eax
mov %eax,-0xc(%rbp)
jmp 1203 <func0+0x9a>
mov -0x4(%rbp),%eax
cltq
lea 0x0(,%rax,4),%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov (%rax),%eax
cmp %eax,-0x1c(%rbp)
jle 11f4 <func0+0x8b>
mov -0x4(%rbp),%eax
add $0x1,%eax
mov %eax,-0x10(%rbp)
jmp 1203 <func0+0x9a>
mov -0x4(%rbp),%eax
mov %eax,-0x8(%rbp)
mov -0x4(%rbp),%eax
add $0x1,%eax
mov %eax,-0x10(%rbp)
mov -0x10(%rbp),%eax
cmp -0xc(%rbp),%eax
jle 1194 <func0+0x2b>
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_10], 0
mov eax, [rbp+var_20]
sub eax, 1
mov [rbp+var_C], eax
mov [rbp+var_8], 0FFFFFFFFh
jmp short loc_1203
loc_1194:
mov edx, [rbp+var_10]
mov eax, [rbp+var_C]
add eax, edx
mov edx, eax
shr edx, 1Fh
add eax, edx
sar eax, 1
mov [rbp+var_4], eax
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_1C], eax
jge short loc_11CE
mov eax, [rbp+var_4]
sub eax, 1
mov [rbp+var_C], eax
jmp short loc_1203
loc_11CE:
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_1C], eax
jle short loc_11F4
mov eax, [rbp+var_4]
add eax, 1
mov [rbp+var_10], eax
jmp short loc_1203
loc_11F4:
mov eax, [rbp+var_4]
mov [rbp+var_8], eax
mov eax, [rbp+var_4]
add eax, 1
mov [rbp+var_10], eax
loc_1203:
mov eax, [rbp+var_10]
cmp eax, [rbp+var_C]
jle short loc_1194
mov eax, [rbp+var_8]
pop rbp
retn | long long func0(long long a1, int a2, int a3)
{
int v4; // [rsp+10h] [rbp-10h]
int v5; // [rsp+14h] [rbp-Ch]
unsigned int v6; // [rsp+18h] [rbp-8h]
int v7; // [rsp+1Ch] [rbp-4h]
v4 = 0;
v5 = a3 - 1;
v6 = -1;
while ( v4 <= v5 )
{
v7 = (v4 + v5) / 2;
if ( a2 >= *(_DWORD *)(4LL * v7 + a1) )
{
if ( a2 <= *(_DWORD *)(4LL * v7 + a1) )
v6 = (v4 + v5) / 2;
v4 = v7 + 1;
}
else
{
v5 = v7 - 1;
}
}
return v6;
} | 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 + -0x10],0x0
MOV EAX,dword ptr [RBP + -0x20]
SUB EAX,0x1
MOV dword ptr [RBP + -0xc],EAX
MOV dword ptr [RBP + -0x8],0xffffffff
JMP 0x00101203
LAB_00101194:
MOV EDX,dword ptr [RBP + -0x10]
MOV EAX,dword ptr [RBP + -0xc]
ADD EAX,EDX
MOV EDX,EAX
SHR EDX,0x1f
ADD EAX,EDX
SAR EAX,0x1
MOV dword ptr [RBP + -0x4],EAX
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 + -0x1c],EAX
JGE 0x001011ce
MOV EAX,dword ptr [RBP + -0x4]
SUB EAX,0x1
MOV dword ptr [RBP + -0xc],EAX
JMP 0x00101203
LAB_001011ce:
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 + -0x1c],EAX
JLE 0x001011f4
MOV EAX,dword ptr [RBP + -0x4]
ADD EAX,0x1
MOV dword ptr [RBP + -0x10],EAX
JMP 0x00101203
LAB_001011f4:
MOV EAX,dword ptr [RBP + -0x4]
MOV dword ptr [RBP + -0x8],EAX
MOV EAX,dword ptr [RBP + -0x4]
ADD EAX,0x1
MOV dword ptr [RBP + -0x10],EAX
LAB_00101203:
MOV EAX,dword ptr [RBP + -0x10]
CMP EAX,dword ptr [RBP + -0xc]
JLE 0x00101194
MOV EAX,dword ptr [RBP + -0x8]
POP RBP
RET | int func0(long param_1,int param_2,int param_3)
{
int iVar1;
int4 local_18;
int4 local_14;
int4 local_10;
local_18 = 0;
local_14 = param_3 + -1;
local_10 = -1;
while (local_18 <= local_14) {
iVar1 = (local_14 + local_18) / 2;
if (param_2 < *(int *)(param_1 + (long)iVar1 * 4)) {
local_14 = iVar1 + -1;
}
else if (*(int *)(param_1 + (long)iVar1 * 4) < param_2) {
local_18 = iVar1 + 1;
}
else {
local_18 = iVar1 + 1;
local_10 = iVar1;
}
}
return local_10;
} |
7,065 | func0 |
#include <assert.h>
| int func0(int arr[], int x, int n) {
int low = 0;
int high = n - 1;
int res = -1;
while (low <= high) {
int mid = (low + high) / 2;
if (arr[mid] > x) {
high = mid - 1;
} else if (arr[mid] < x) {
low = mid + 1;
} else {
res = mid;
low = mid + 1;
}
}
return res;
}
| int main() {
int arr1[] = {1, 2, 3};
assert(func0(arr1, 1, 3) == 0);
int arr2[] = {1, 1, 1, 2, 3, 4};
assert(func0(arr2, 1, 6) == 2);
int arr3[] = {2, 3, 2, 3, 6, 8, 9};
assert(func0(arr3, 3, 7) == 3);
return 0;
}
| O1 | c | func0:
endbr64
sub $0x1,%edx
js 11ae <func0+0x45>
mov $0xffffffff,%r9d
mov $0x0,%r8d
jmp 1192 <func0+0x29>
lea 0x1(%rax),%r8d
jl 118d <func0+0x24>
lea 0x1(%rax),%r8d
mov %eax,%r9d
cmp %edx,%r8d
jg 11b4 <func0+0x4b>
lea (%r8,%rdx,1),%ecx
mov %ecx,%eax
shr $0x1f,%eax
add %ecx,%eax
sar %eax
movslq %eax,%rcx
mov (%rdi,%rcx,4),%ecx
cmp %esi,%ecx
jle 1180 <func0+0x17>
lea -0x1(%rax),%edx
jmp 118d <func0+0x24>
mov $0xffffffff,%r9d
mov %r9d,%eax
retq
| func0:
endbr64
sub edx, 1
js short loc_11AE
mov r9d, 0FFFFFFFFh
mov r8d, 0
jmp short loc_1192
loc_1180:
lea r8d, [rax+1]
jl short loc_118D
lea r8d, [rax+1]
mov r9d, eax
loc_118D:
cmp r8d, edx
jg short loc_11B4
loc_1192:
lea ecx, [r8+rdx]
mov eax, ecx
shr eax, 1Fh
add eax, ecx
sar eax, 1
movsxd rcx, eax
mov ecx, [rdi+rcx*4]
cmp ecx, esi
jle short loc_1180
lea edx, [rax-1]
jmp short loc_118D
loc_11AE:
mov r9d, 0FFFFFFFFh
loc_11B4:
mov eax, r9d
retn | long long func0(long long a1, int a2, int a3)
{
int v3; // edx
unsigned int v4; // r9d
int v5; // r8d
int v6; // eax
int v7; // ecx
v3 = a3 - 1;
if ( v3 < 0 )
{
return (unsigned int)-1;
}
else
{
v4 = -1;
v5 = 0;
do
{
v6 = (v5 + v3) / 2;
v7 = *(_DWORD *)(a1 + 4LL * v6);
if ( v7 <= a2 )
{
v5 = v6 + 1;
if ( v7 >= a2 )
{
v5 = v6 + 1;
v4 = v6;
}
}
else
{
v3 = v6 - 1;
}
}
while ( v5 <= v3 );
}
return v4;
} | func0:
ENDBR64
SUB EDX,0x1
JS 0x001011ae
MOV R9D,0xffffffff
MOV R8D,0x0
JMP 0x00101192
LAB_00101180:
LEA R8D,[RAX + 0x1]
JL 0x0010118d
LEA R8D,[RAX + 0x1]
MOV R9D,EAX
LAB_0010118d:
CMP R8D,EDX
JG 0x001011b4
LAB_00101192:
LEA ECX,[R8 + RDX*0x1]
MOV EAX,ECX
SHR EAX,0x1f
ADD EAX,ECX
SAR EAX,0x1
MOVSXD RCX,EAX
MOV ECX,dword ptr [RDI + RCX*0x4]
CMP ECX,ESI
JLE 0x00101180
LEA EDX,[RAX + -0x1]
JMP 0x0010118d
LAB_001011ae:
MOV R9D,0xffffffff
LAB_001011b4:
MOV EAX,R9D
RET | int func0(long param_1,int param_2,int param_3)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
param_3 = param_3 + -1;
if (param_3 < 0) {
iVar4 = -1;
}
else {
iVar4 = -1;
iVar3 = 0;
do {
iVar2 = (iVar3 + param_3) / 2;
iVar1 = *(int *)(param_1 + (long)iVar2 * 4);
if (param_2 < iVar1) {
param_3 = iVar2 + -1;
}
else {
iVar3 = iVar2 + 1;
if (param_2 <= iVar1) {
iVar3 = iVar2 + 1;
iVar4 = iVar2;
}
}
} while (iVar3 <= param_3);
}
return iVar4;
} |
7,066 | func0 |
#include <assert.h>
| int func0(int arr[], int x, int n) {
int low = 0;
int high = n - 1;
int res = -1;
while (low <= high) {
int mid = (low + high) / 2;
if (arr[mid] > x) {
high = mid - 1;
} else if (arr[mid] < x) {
low = mid + 1;
} else {
res = mid;
low = mid + 1;
}
}
return res;
}
| int main() {
int arr1[] = {1, 2, 3};
assert(func0(arr1, 1, 3) == 0);
int arr2[] = {1, 1, 1, 2, 3, 4};
assert(func0(arr2, 1, 6) == 2);
int arr3[] = {2, 3, 2, 3, 6, 8, 9};
assert(func0(arr3, 3, 7) == 3);
return 0;
}
| O2 | c | func0:
endbr64
mov $0xffffffff,%r9d
sub $0x1,%edx
js 136b <func0+0x3b>
xor %ecx,%ecx
jmp 134f <func0+0x1f>
nopl 0x0(%rax,%rax,1)
lea -0x1(%rax),%edx
cmp %ecx,%edx
jl 136b <func0+0x3b>
lea (%rdx,%rcx,1),%eax
sar %eax
movslq %eax,%r8
mov (%rdi,%r8,4),%r8d
cmp %esi,%r8d
jg 1348 <func0+0x18>
lea 0x1(%rax),%ecx
cmovge %eax,%r9d
cmp %ecx,%edx
jge 134f <func0+0x1f>
mov %r9d,%eax
retq
| func0:
endbr64
mov r9d, 0FFFFFFFFh
sub edx, 1
js short loc_12FB
xor ecx, ecx
jmp short loc_12DF
loc_12D8:
lea edx, [rax-1]
cmp edx, ecx
jl short loc_12FB
loc_12DF:
lea eax, [rdx+rcx]
sar eax, 1
movsxd r8, eax
mov r8d, [rdi+r8*4]
cmp r8d, esi
jg short loc_12D8
lea ecx, [rax+1]
cmovge r9d, eax
cmp edx, ecx
jge short loc_12DF
loc_12FB:
mov eax, r9d
retn | long long func0(long long a1, int a2, int a3)
{
unsigned int v3; // r9d
int v4; // edx
int v5; // ecx
int v6; // eax
int v7; // r8d
v3 = -1;
v4 = a3 - 1;
if ( v4 >= 0 )
{
v5 = 0;
do
{
while ( 1 )
{
v6 = (v4 + v5) >> 1;
v7 = *(_DWORD *)(a1 + 4LL * v6);
if ( v7 <= a2 )
break;
v4 = v6 - 1;
if ( v6 - 1 < v5 )
return v3;
}
v5 = v6 + 1;
if ( v7 >= a2 )
v3 = v6;
}
while ( v4 >= v5 );
}
return v3;
} | func0:
ENDBR64
MOV R9D,0xffffffff
SUB EDX,0x1
JS 0x001012fb
XOR ECX,ECX
JMP 0x001012df
LAB_001012d8:
LEA EDX,[RAX + -0x1]
CMP EDX,ECX
JL 0x001012fb
LAB_001012df:
LEA EAX,[RDX + RCX*0x1]
SAR EAX,0x1
MOVSXD R8,EAX
MOV R8D,dword ptr [RDI + R8*0x4]
CMP R8D,ESI
JG 0x001012d8
LEA ECX,[RAX + 0x1]
CMOVGE R9D,EAX
CMP EDX,ECX
JGE 0x001012df
LAB_001012fb:
MOV EAX,R9D
RET | int func0(long param_1,int param_2,int param_3)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
iVar4 = -1;
param_3 = param_3 + -1;
if (-1 < param_3) {
iVar3 = 0;
do {
while( true ) {
iVar2 = param_3 + iVar3 >> 1;
iVar1 = *(int *)(param_1 + (long)iVar2 * 4);
if (param_2 < iVar1) break;
iVar3 = iVar2 + 1;
if (param_2 <= iVar1) {
iVar4 = iVar2;
}
if (param_3 < iVar3) {
return iVar4;
}
}
param_3 = iVar2 + -1;
} while (iVar3 <= param_3);
}
return iVar4;
} |
7,067 | func0 |
#include <assert.h>
| int func0(int arr[], int x, int n) {
int low = 0;
int high = n - 1;
int res = -1;
while (low <= high) {
int mid = (low + high) / 2;
if (arr[mid] > x) {
high = mid - 1;
} else if (arr[mid] < x) {
low = mid + 1;
} else {
res = mid;
low = mid + 1;
}
}
return res;
}
| int main() {
int arr1[] = {1, 2, 3};
assert(func0(arr1, 1, 3) == 0);
int arr2[] = {1, 1, 1, 2, 3, 4};
assert(func0(arr2, 1, 6) == 2);
int arr3[] = {2, 3, 2, 3, 6, 8, 9};
assert(func0(arr3, 3, 7) == 3);
return 0;
}
| O3 | c | func0:
endbr64
mov $0xffffffff,%r9d
sub $0x1,%edx
js 134b <func0+0x3b>
xor %ecx,%ecx
jmp 132f <func0+0x1f>
nopl 0x0(%rax,%rax,1)
lea -0x1(%rax),%edx
cmp %edx,%ecx
jg 134b <func0+0x3b>
lea (%rdx,%rcx,1),%eax
sar %eax
movslq %eax,%r8
mov (%rdi,%r8,4),%r8d
cmp %r8d,%esi
jl 1328 <func0+0x18>
lea 0x1(%rax),%ecx
cmovle %eax,%r9d
cmp %edx,%ecx
jle 132f <func0+0x1f>
mov %r9d,%eax
retq
| func0:
endbr64
mov r9d, 0FFFFFFFFh
sub edx, 1
js short loc_1364
xor r8d, r8d
jmp short loc_1340
loc_1338:
lea edx, [rax-1]
cmp r8d, edx
jg short loc_1364
loc_1340:
lea ecx, [rdx+r8]
mov eax, ecx
shr eax, 1Fh
add eax, ecx
sar eax, 1
movsxd rcx, eax
mov ecx, [rdi+rcx*4]
cmp esi, ecx
jl short loc_1338
lea r8d, [rax+1]
cmovle r9d, eax
cmp r8d, edx
jle short loc_1340
loc_1364:
mov eax, r9d
retn | long long func0(long long a1, int a2, int a3)
{
unsigned int v3; // r9d
int v4; // edx
int v5; // r8d
int v6; // eax
int v7; // ecx
v3 = -1;
v4 = a3 - 1;
if ( v4 >= 0 )
{
v5 = 0;
do
{
while ( 1 )
{
v6 = (v4 + v5) / 2;
v7 = *(_DWORD *)(a1 + 4LL * v6);
if ( a2 >= v7 )
break;
v4 = v6 - 1;
if ( v5 > v6 - 1 )
return v3;
}
v5 = v6 + 1;
if ( a2 <= v7 )
v3 = v6;
}
while ( v5 <= v4 );
}
return v3;
} | func0:
ENDBR64
MOV R9D,0xffffffff
SUB EDX,0x1
JS 0x00101364
XOR R8D,R8D
JMP 0x00101340
LAB_00101338:
LEA EDX,[RAX + -0x1]
CMP R8D,EDX
JG 0x00101364
LAB_00101340:
LEA ECX,[RDX + R8*0x1]
MOV EAX,ECX
SHR EAX,0x1f
ADD EAX,ECX
SAR EAX,0x1
MOVSXD RCX,EAX
MOV ECX,dword ptr [RDI + RCX*0x4]
CMP ESI,ECX
JL 0x00101338
LEA R8D,[RAX + 0x1]
CMOVLE R9D,EAX
CMP R8D,EDX
JLE 0x00101340
LAB_00101364:
MOV EAX,R9D
RET | int func0(long param_1,int param_2,int param_3)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
iVar4 = -1;
param_3 = param_3 + -1;
if (-1 < param_3) {
iVar3 = 0;
do {
while( true ) {
iVar2 = (param_3 + iVar3) / 2;
iVar1 = *(int *)(param_1 + (long)iVar2 * 4);
if (param_2 < iVar1) break;
iVar3 = iVar2 + 1;
if (param_2 <= iVar1) {
iVar4 = iVar2;
}
if (param_3 < iVar3) {
return iVar4;
}
}
param_3 = iVar2 + -1;
} while (iVar3 <= param_3);
}
return iVar4;
} |
7,068 | func0 | #include <stdio.h>
#include <string.h>
#include <assert.h>
#include <regex.h>
| char* func0(const char* text) {
regex_t regex;
int result;
char* pattern = "a.*?b$";
// Compile regex
result = regcomp(®ex, pattern, REG_EXTENDED);
if (result) {
fprintf(stderr, "Could not compile regex\n");
return "Error";
}
// Execute regex
result = regexec(®ex, text, 0, NULL, 0);
// Free memory allocated to the pattern buffer by regcomp()
regfree(®ex);
if (result == 0) {
return "Found a match!";
} else {
return "Not matched!";
}
}
| int main() {
assert(strcmp(func0("aabbbb"), "Found a match!") == 0);
assert(strcmp(func0("aabAbbbc"), "Not matched!") == 0);
assert(strcmp(func0("accddbbjjj"), "Not matched!") == 0);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x70,%rsp
mov %rdi,-0x68(%rbp)
mov %fs:0x28,%rax
mov %rax,-0x8(%rbp)
xor %eax,%eax
lea 0xdd9(%rip),%rax
mov %rax,-0x58(%rbp)
mov -0x58(%rbp),%rcx
lea -0x50(%rbp),%rax
mov $0x1,%edx
mov %rcx,%rsi
mov %rax,%rdi
callq 10e0 <regcomp@plt>
mov %eax,-0x5c(%rbp)
cmpl $0x0,-0x5c(%rbp)
je 127d <func0+0x74>
mov 0x2dc5(%rip),%rax
mov %rax,%rcx
mov $0x18,%edx
mov $0x1,%esi
lea 0xda0(%rip),%rdi
callq 1110 <fwrite@plt>
lea 0xdad(%rip),%rax
jmp 12c2 <func0+0xb9>
mov -0x68(%rbp),%rsi
lea -0x50(%rbp),%rax
mov $0x0,%r8d
mov $0x0,%ecx
mov $0x0,%edx
mov %rax,%rdi
callq 1100 <regexec@plt>
mov %eax,-0x5c(%rbp)
lea -0x50(%rbp),%rax
mov %rax,%rdi
callq 10b0 <regfree@plt>
cmpl $0x0,-0x5c(%rbp)
jne 12bb <func0+0xb2>
lea 0xd75(%rip),%rax
jmp 12c2 <func0+0xb9>
lea 0xd7b(%rip),%rax
mov -0x8(%rbp),%rdx
xor %fs:0x28,%rdx
je 12d6 <func0+0xcd>
callq 10c0 <__stack_chk_fail@plt>
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 70h
mov [rbp+string], rdi
mov rax, fs:28h
mov [rbp+var_8], rax
xor eax, eax
lea rax, aAB; "a.*?b$"
mov [rbp+pattern], rax
mov rcx, [rbp+pattern]
lea rax, [rbp+preg]
mov edx, 1; cflags
mov rsi, rcx; pattern
mov rdi, rax; preg
call _regcomp
mov [rbp+var_5C], eax
cmp [rbp+var_5C], 0
jz short loc_1280
mov rax, cs:__bss_start
mov rcx, rax; s
mov edx, 18h; n
mov esi, 1; size
lea rax, aCouldNotCompil; "Could not compile regex\n"
mov rdi, rax; ptr
call _fwrite
lea rax, aError; "Error"
jmp short loc_12C5
loc_1280:
mov rsi, [rbp+string]; string
lea rax, [rbp+preg]
mov r8d, 0; eflags
mov ecx, 0; pmatch
mov edx, 0; nmatch
mov rdi, rax; preg
call _regexec
mov [rbp+var_5C], eax
lea rax, [rbp+preg]
mov rdi, rax; preg
call _regfree
cmp [rbp+var_5C], 0
jnz short loc_12BE
lea rax, s2; "Found a match!"
jmp short loc_12C5
loc_12BE:
lea rax, aNotMatched; "Not matched!"
loc_12C5:
mov rdx, [rbp+var_8]
sub rdx, fs:28h
jz short locret_12D9
call ___stack_chk_fail
locret_12D9:
leave
retn | const char * func0(const char *a1)
{
int v2; // [rsp+14h] [rbp-5Ch]
regex_t preg; // [rsp+20h] [rbp-50h] BYREF
unsigned long long v4; // [rsp+68h] [rbp-8h]
v4 = __readfsqword(0x28u);
if ( regcomp(&preg, "a.*?b$", 1) )
{
fwrite("Could not compile regex\n", 1uLL, 0x18uLL, _bss_start);
return "Error";
}
else
{
v2 = regexec(&preg, a1, 0LL, 0LL, 0);
regfree(&preg);
if ( v2 )
return "Not matched!";
else
return "Found a match!";
}
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x70
MOV qword ptr [RBP + -0x68],RDI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RBP + -0x8],RAX
XOR EAX,EAX
LEA RAX,[0x102008]
MOV qword ptr [RBP + -0x58],RAX
MOV RCX,qword ptr [RBP + -0x58]
LEA RAX,[RBP + -0x50]
MOV EDX,0x1
MOV RSI,RCX
MOV RDI,RAX
CALL 0x001010e0
MOV dword ptr [RBP + -0x5c],EAX
CMP dword ptr [RBP + -0x5c],0x0
JZ 0x00101280
MOV RAX,qword ptr [0x00104020]
MOV RCX,RAX
MOV EDX,0x18
MOV ESI,0x1
LEA RAX,[0x10200f]
MOV RDI,RAX
CALL 0x00101110
LEA RAX,[0x102028]
JMP 0x001012c5
LAB_00101280:
MOV RSI,qword ptr [RBP + -0x68]
LEA RAX,[RBP + -0x50]
MOV R8D,0x0
MOV ECX,0x0
MOV EDX,0x0
MOV RDI,RAX
CALL 0x00101100
MOV dword ptr [RBP + -0x5c],EAX
LEA RAX,[RBP + -0x50]
MOV RDI,RAX
CALL 0x001010b0
CMP dword ptr [RBP + -0x5c],0x0
JNZ 0x001012be
LEA RAX,[0x10202e]
JMP 0x001012c5
LAB_001012be:
LEA RAX,[0x10203d]
LAB_001012c5:
MOV RDX,qword ptr [RBP + -0x8]
SUB RDX,qword ptr FS:[0x28]
JZ 0x001012d9
CALL 0x001010c0
LAB_001012d9:
LEAVE
RET | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t local_58;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&local_58,"a.*?b$",1);
if (iVar1 == 0) {
iVar1 = regexec(&local_58,param_1,0,(regmatch_t *)0x0,0);
regfree(&local_58);
if (iVar1 == 0) {
pcVar2 = "Found a match!";
}
else {
pcVar2 = "Not matched!";
}
}
else {
fwrite("Could not compile regex\n",1,0x18,stderr);
pcVar2 = "Error";
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return pcVar2;
} |
7,069 | func0 | #include <stdio.h>
#include <string.h>
#include <assert.h>
#include <regex.h>
| char* func0(const char* text) {
regex_t regex;
int result;
char* pattern = "a.*?b$";
// Compile regex
result = regcomp(®ex, pattern, REG_EXTENDED);
if (result) {
fprintf(stderr, "Could not compile regex\n");
return "Error";
}
// Execute regex
result = regexec(®ex, text, 0, NULL, 0);
// Free memory allocated to the pattern buffer by regcomp()
regfree(®ex);
if (result == 0) {
return "Found a match!";
} else {
return "Not matched!";
}
}
| int main() {
assert(strcmp(func0("aabbbb"), "Found a match!") == 0);
assert(strcmp(func0("aabAbbbc"), "Not matched!") == 0);
assert(strcmp(func0("accddbbjjj"), "Not matched!") == 0);
return 0;
}
| O1 | c | func0:
endbr64
push %rbp
push %rbx
sub $0x58,%rsp
mov %rdi,%rbx
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%rdi
mov $0x1,%edx
lea 0xe11(%rip),%rsi
callq 10d0 <regcomp@plt>
test %eax,%eax
jne 1271 <func0+0x88>
mov %rsp,%rbp
mov $0x0,%r8d
mov $0x0,%ecx
mov $0x0,%edx
mov %rbx,%rsi
mov %rbp,%rdi
callq 10e0 <regexec@plt>
mov %eax,%ebx
mov %rbp,%rdi
callq 10a0 <regfree@plt>
test %ebx,%ebx
lea 0xdbb(%rip),%rax
lea 0xdc3(%rip),%rdx
cmovne %rdx,%rax
mov 0x48(%rsp),%rcx
xor %fs:0x28,%rcx
jne 1297 <func0+0xae>
add $0x58,%rsp
pop %rbx
pop %rbp
retq
mov 0x2da8(%rip),%rcx
mov $0x18,%edx
mov $0x1,%esi
lea 0xda4(%rip),%rdi
callq 10f0 <fwrite@plt>
lea 0xd6f(%rip),%rax
jmp 125a <func0+0x71>
callq 10b0 <__stack_chk_fail@plt>
| func0:
endbr64
push rbp
push rbx
sub rsp, 58h
mov rbx, rdi
mov rax, fs:28h
mov [rsp+68h+var_20], rax
xor eax, eax
mov rdi, rsp
mov edx, 1
lea rsi, aAB; "a.*?b$"
call _regcomp
test eax, eax
jnz short loc_1291
mov rbp, rsp
mov r8d, 0
mov ecx, 0
mov edx, 0
mov rsi, rbx
mov rdi, rbp
call _regexec
mov ebx, eax
mov rdi, rbp
call _regfree
test ebx, ebx
lea rax, aFoundAMatch; "Found a match!"
lea rdx, aNotMatched; "Not matched!"
cmovnz rax, rdx
loc_127A:
mov rdx, [rsp+68h+var_20]
sub rdx, fs:28h
jnz short loc_12B7
add rsp, 58h
pop rbx
pop rbp
retn
loc_1291:
mov rcx, cs:stderr@GLIBC_2_2_5
mov edx, 18h
mov esi, 1
lea rdi, aCouldNotCompil; "Could not compile regex\n"
call _fwrite
lea rax, aError; "Error"
jmp short loc_127A
loc_12B7:
call ___stack_chk_fail | const char * func0(long long a1)
{
int v1; // ebx
const char *result; // rax
_QWORD v3[13]; // [rsp+0h] [rbp-68h] BYREF
v3[9] = __readfsqword(0x28u);
if ( (unsigned int)regcomp(v3, "a.*?b$", 1LL) )
{
fwrite("Could not compile regex\n", 1LL, 24LL, stderr);
return "Error";
}
else
{
v1 = regexec(v3, a1, 0LL, 0LL, 0LL);
regfree(v3);
result = "Found a match!";
if ( v1 )
return "Not matched!";
}
return result;
} | func0:
ENDBR64
PUSH RBP
PUSH RBX
SUB RSP,0x58
MOV RBX,RDI
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV RDI,RSP
MOV EDX,0x1
LEA RSI,[0x102026]
CALL 0x001010e0
TEST EAX,EAX
JNZ 0x00101291
MOV RBP,RSP
MOV R8D,0x0
MOV ECX,0x0
MOV EDX,0x0
MOV RSI,RBX
MOV RDI,RBP
CALL 0x00101100
MOV EBX,EAX
MOV RDI,RBP
CALL 0x001010b0
TEST EBX,EBX
LEA RAX,[0x10200a]
LEA RDX,[0x102019]
CMOVNZ RAX,RDX
LAB_0010127a:
MOV RDX,qword ptr [RSP + 0x48]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x001012b7
ADD RSP,0x58
POP RBX
POP RBP
RET
LAB_00101291:
MOV RCX,qword ptr [0x00104020]
MOV EDX,0x18
MOV ESI,0x1
LEA RDI,[0x10202d]
CALL 0x00101110
LEA RAX,[0x102004]
JMP 0x0010127a
LAB_001012b7:
CALL 0x001010c0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&rStack_68,"a.*?b$",1);
if (iVar1 == 0) {
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
regfree(&rStack_68);
pcVar2 = "Found a match!";
if (iVar1 != 0) {
pcVar2 = "Not matched!";
}
}
else {
fwrite("Could not compile regex\n",1,0x18,stderr);
pcVar2 = "Error";
}
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar2;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
7,070 | func0 | #include <stdio.h>
#include <string.h>
#include <assert.h>
#include <regex.h>
| char* func0(const char* text) {
regex_t regex;
int result;
char* pattern = "a.*?b$";
// Compile regex
result = regcomp(®ex, pattern, REG_EXTENDED);
if (result) {
fprintf(stderr, "Could not compile regex\n");
return "Error";
}
// Execute regex
result = regexec(®ex, text, 0, NULL, 0);
// Free memory allocated to the pattern buffer by regcomp()
regfree(®ex);
if (result == 0) {
return "Found a match!";
} else {
return "Not matched!";
}
}
| int main() {
assert(strcmp(func0("aabbbb"), "Found a match!") == 0);
assert(strcmp(func0("aabAbbbc"), "Not matched!") == 0);
assert(strcmp(func0("accddbbjjj"), "Not matched!") == 0);
return 0;
}
| O2 | c | func0:
endbr64
push %r12
mov $0x1,%edx
lea 0xd44(%rip),%rsi
push %rbp
mov %rdi,%rbp
sub $0x58,%rsp
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%r12
mov %r12,%rdi
callq 10d0 <regcomp@plt>
test %eax,%eax
jne 1358 <func0+0x88>
xor %edx,%edx
xor %r8d,%r8d
xor %ecx,%ecx
mov %rbp,%rsi
mov %r12,%rdi
callq 10e0 <regexec@plt>
mov %r12,%rdi
mov %eax,%ebp
callq 10a0 <regfree@plt>
test %ebp,%ebp
lea 0xcdc(%rip),%rax
lea 0xce4(%rip),%rdx
cmovne %rdx,%rax
mov 0x48(%rsp),%rcx
xor %fs:0x28,%rcx
jne 137e <func0+0xae>
add $0x58,%rsp
pop %rbp
pop %r12
retq
nopl 0x0(%rax)
mov 0x2cc1(%rip),%rcx
mov $0x18,%edx
mov $0x1,%esi
lea 0xcbd(%rip),%rdi
callq 10f0 <fwrite@plt>
lea 0xc88(%rip),%rax
jmp 1339 <func0+0x69>
callq 10b0 <__stack_chk_fail@plt>
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
push r12
mov edx, 1
lea rsi, aAB; "a.*?b$"
push rbp
mov rbp, rdi
sub rsp, 58h
mov rax, fs:28h
mov [rsp+68h+var_20], rax
xor eax, eax
mov r12, rsp
mov rdi, r12
call _regcomp
test eax, eax
jnz short loc_1368
xor edx, edx
xor r8d, r8d
xor ecx, ecx
mov rsi, rbp
mov rdi, r12
call _regexec
mov rdi, r12
mov ebp, eax
call _regfree
test ebp, ebp
lea rax, aFoundAMatch; "Found a match!"
lea rdx, aNotMatched; "Not matched!"
cmovnz rax, rdx
loc_1349:
mov rdx, [rsp+68h+var_20]
sub rdx, fs:28h
jnz short loc_138E
add rsp, 58h
pop rbp
pop r12
retn
loc_1368:
mov rcx, cs:stderr@GLIBC_2_2_5
mov edx, 18h
mov esi, 1
lea rdi, aCouldNotCompil; "Could not compile regex\n"
call _fwrite
lea rax, aError; "Error"
jmp short loc_1349
loc_138E:
call ___stack_chk_fail | const char * func0(long long a1)
{
int v1; // ebp
const char *result; // rax
_QWORD v3[13]; // [rsp+0h] [rbp-68h] BYREF
v3[9] = __readfsqword(0x28u);
if ( (unsigned int)regcomp(v3, "a.*?b$", 1LL) )
{
fwrite("Could not compile regex\n", 1LL, 24LL, stderr);
return "Error";
}
else
{
v1 = regexec(v3, a1, 0LL, 0LL, 0LL);
regfree(v3);
result = "Found a match!";
if ( v1 )
return "Not matched!";
}
return result;
} | func0:
ENDBR64
PUSH R12
MOV EDX,0x1
LEA RSI,[0x102026]
PUSH RBP
MOV RBP,RDI
SUB RSP,0x58
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV R12,RSP
MOV RDI,R12
CALL 0x001010e0
TEST EAX,EAX
JNZ 0x00101368
XOR EDX,EDX
XOR R8D,R8D
XOR ECX,ECX
MOV RSI,RBP
MOV RDI,R12
CALL 0x00101100
MOV RDI,R12
MOV EBP,EAX
CALL 0x001010b0
TEST EBP,EBP
LEA RAX,[0x10200a]
LEA RDX,[0x102019]
CMOVNZ RAX,RDX
LAB_00101349:
MOV RDX,qword ptr [RSP + 0x48]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x0010138e
ADD RSP,0x58
POP RBP
POP R12
RET
LAB_00101368:
MOV RCX,qword ptr [0x00104020]
MOV EDX,0x18
MOV ESI,0x1
LEA RDI,[0x10202d]
CALL 0x00101110
LEA RAX,[0x102004]
JMP 0x00101349
LAB_0010138e:
CALL 0x001010c0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&rStack_68,"a.*?b$",1);
if (iVar1 == 0) {
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
regfree(&rStack_68);
pcVar2 = "Found a match!";
if (iVar1 != 0) {
pcVar2 = "Not matched!";
}
}
else {
fwrite("Could not compile regex\n",1,0x18,stderr);
pcVar2 = "Error";
}
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar2;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
7,071 | func0 | #include <stdio.h>
#include <string.h>
#include <assert.h>
#include <regex.h>
| char* func0(const char* text) {
regex_t regex;
int result;
char* pattern = "a.*?b$";
// Compile regex
result = regcomp(®ex, pattern, REG_EXTENDED);
if (result) {
fprintf(stderr, "Could not compile regex\n");
return "Error";
}
// Execute regex
result = regexec(®ex, text, 0, NULL, 0);
// Free memory allocated to the pattern buffer by regcomp()
regfree(®ex);
if (result == 0) {
return "Found a match!";
} else {
return "Not matched!";
}
}
| int main() {
assert(strcmp(func0("aabbbb"), "Found a match!") == 0);
assert(strcmp(func0("aabAbbbc"), "Not matched!") == 0);
assert(strcmp(func0("accddbbjjj"), "Not matched!") == 0);
return 0;
}
| O3 | c | func0:
endbr64
push %r12
mov $0x1,%edx
lea 0xd44(%rip),%rsi
push %rbp
mov %rdi,%rbp
sub $0x58,%rsp
mov %fs:0x28,%rax
mov %rax,0x48(%rsp)
xor %eax,%eax
mov %rsp,%r12
mov %r12,%rdi
callq 10d0 <regcomp@plt>
test %eax,%eax
jne 1358 <func0+0x88>
xor %edx,%edx
xor %r8d,%r8d
xor %ecx,%ecx
mov %rbp,%rsi
mov %r12,%rdi
callq 10e0 <regexec@plt>
mov %r12,%rdi
mov %eax,%ebp
callq 10a0 <regfree@plt>
test %ebp,%ebp
lea 0xcdc(%rip),%rax
lea 0xce4(%rip),%rdx
cmovne %rdx,%rax
mov 0x48(%rsp),%rcx
xor %fs:0x28,%rcx
jne 137e <func0+0xae>
add $0x58,%rsp
pop %rbp
pop %r12
retq
nopl 0x0(%rax)
mov 0x2cc1(%rip),%rcx
mov $0x18,%edx
mov $0x1,%esi
lea 0xcbd(%rip),%rdi
callq 10f0 <fwrite@plt>
lea 0xc88(%rip),%rax
jmp 1339 <func0+0x69>
callq 10b0 <__stack_chk_fail@plt>
nopw %cs:0x0(%rax,%rax,1)
nopl (%rax)
| func0:
endbr64
push rbp
mov edx, 1; cflags
lea rsi, pattern; "a.*?b$"
push rbx
mov rbx, rdi
sub rsp, 58h
mov rax, fs:28h
mov [rsp+var_s48], rax
xor eax, eax
mov rbp, rsp
mov rdi, rbp; preg
call _regcomp
test eax, eax
jnz short loc_1360
xor edx, edx; nmatch
xor r8d, r8d; eflags
xor ecx, ecx; pmatch
mov rsi, rbx; string
mov rdi, rbp; preg
call _regexec
mov rdi, rbp; preg
mov ebx, eax
call _regfree
test ebx, ebx
lea rax, aNotMatched; "Not matched!"
lea rdx, s2; "Found a match!"
cmovz rax, rdx
loc_1348:
mov rdx, [rsp+var_s48]
sub rdx, fs:28h
jnz short loc_1386
add rsp, 58h
pop rbx
pop rbp
retn
loc_1360:
mov rcx, cs:__bss_start; s
mov edx, 18h; n
mov esi, 1; size
lea rdi, aCouldNotCompil; "Could not compile regex\n"
call _fwrite
lea rax, aError; "Error"
jmp short loc_1348
loc_1386:
call ___stack_chk_fail | const char * func0(char *string)
{
int v1; // ebx
const char *result; // rax
regex_t _0; // [rsp+0h] [rbp+0h] BYREF
unsigned long long vars48; // [rsp+48h] [rbp+48h]
vars48 = __readfsqword(0x28u);
if ( regcomp(&_0, "a.*?b$", 1) )
{
fwrite("Could not compile regex\n", 1uLL, 0x18uLL, _bss_start);
return "Error";
}
else
{
v1 = regexec(&_0, string, 0LL, 0LL, 0);
regfree(&_0);
result = "Not matched!";
if ( !v1 )
return "Found a match!";
}
return result;
} | func0:
ENDBR64
PUSH RBP
MOV EDX,0x1
LEA RSI,[0x102026]
PUSH RBX
MOV RBX,RDI
SUB RSP,0x58
MOV RAX,qword ptr FS:[0x28]
MOV qword ptr [RSP + 0x48],RAX
XOR EAX,EAX
MOV RBP,RSP
MOV RDI,RBP
CALL 0x001010e0
TEST EAX,EAX
JNZ 0x00101360
XOR EDX,EDX
XOR R8D,R8D
XOR ECX,ECX
MOV RSI,RBX
MOV RDI,RBP
CALL 0x00101100
MOV RDI,RBP
MOV EBX,EAX
CALL 0x001010b0
TEST EBX,EBX
LEA RAX,[0x102019]
LEA RDX,[0x10200a]
CMOVZ RAX,RDX
LAB_00101348:
MOV RDX,qword ptr [RSP + 0x48]
SUB RDX,qword ptr FS:[0x28]
JNZ 0x00101386
ADD RSP,0x58
POP RBX
POP RBP
RET
LAB_00101360:
MOV RCX,qword ptr [0x00104020]
MOV EDX,0x18
MOV ESI,0x1
LEA RDI,[0x10202d]
CALL 0x00101110
LEA RAX,[0x102004]
JMP 0x00101348
LAB_00101386:
CALL 0x001010c0 | char * func0(char *param_1)
{
int iVar1;
char *pcVar2;
long in_FS_OFFSET;
regex_t rStack_68;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = regcomp(&rStack_68,"a.*?b$",1);
if (iVar1 == 0) {
iVar1 = regexec(&rStack_68,param_1,0,(regmatch_t *)0x0,0);
regfree(&rStack_68);
pcVar2 = "Not matched!";
if (iVar1 == 0) {
pcVar2 = "Found a match!";
}
}
else {
fwrite("Could not compile regex\n",1,0x18,stderr);
pcVar2 = "Error";
}
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return pcVar2;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
} |
7,072 | func0 |
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct {
char* name;
double price;
} Item;
int compare(const void *a, const void *b) {
Item *itemA = (Item *)a;
Item *itemB = (Item *)b;
if (itemA->price > itemB->price) return 1;
if (itemA->price < itemB->price) return -1;
return 0;
}
| Item* func0(Item items[], int totalItems, int n) {
qsort(items, totalItems, sizeof(Item), compare);
Item* result = (Item*)malloc(n * sizeof(Item));
for (int i = 0; i < n; i++) {
result[i] = items[i];
}
return result;
}
| int main() {
Item items1[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}};
Item* result1 = func0(items1, 2, 1);
assert(result1[0].price == 101.1);
Item items2[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}};
Item* result2 = func0(items2, 2, 2);
assert(result2[0].price == 101.1 && result2[1].price == 555.22);
Item items3[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}, {.name = "Item-3", .price = 45.09}, {.name = "Item-4", .price = 22.75}};
Item* result3 = func0(items3, 4, 1);
assert(result3[0].price == 22.75);
free(result1);
free(result2);
free(result3);
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
sub $0x20,%rsp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
mov %edx,-0x20(%rbp)
mov -0x1c(%rbp),%eax
movslq %eax,%rsi
mov -0x18(%rbp),%rax
lea -0x8c(%rip),%rcx
mov $0x10,%edx
mov %rax,%rdi
callq 10a0 <qsort@plt>
mov -0x20(%rbp),%eax
cltq
shl $0x4,%rax
mov %rax,%rdi
callq 10d0 <malloc@plt>
mov %rax,-0x8(%rbp)
movl $0x0,-0xc(%rbp)
jmp 12b9 <func0+0x8b>
mov -0xc(%rbp),%eax
cltq
shl $0x4,%rax
mov %rax,%rdx
mov -0x18(%rbp),%rax
add %rdx,%rax
mov -0xc(%rbp),%edx
movslq %edx,%rdx
mov %rdx,%rcx
shl $0x4,%rcx
mov -0x8(%rbp),%rdx
add %rdx,%rcx
mov 0x8(%rax),%rdx
mov (%rax),%rax
mov %rax,(%rcx)
mov %rdx,0x8(%rcx)
addl $0x1,-0xc(%rbp)
mov -0xc(%rbp),%eax
cmp -0x20(%rbp),%eax
jl 1280 <func0+0x52>
mov -0x8(%rbp),%rax
leaveq
retq
| func0:
endbr64
push rbp
mov rbp, rsp
sub rsp, 20h
mov [rbp+base], rdi
mov [rbp+var_1C], esi
mov [rbp+var_20], edx
mov eax, [rbp+var_1C]
movsxd rsi, eax; nmemb
mov rax, [rbp+base]
lea rdx, compare
mov rcx, rdx; compar
mov edx, 10h; size
mov rdi, rax; base
call _qsort
mov eax, [rbp+var_20]
cdqe
shl rax, 4
mov rdi, rax; size
call _malloc
mov [rbp+var_8], rax
mov [rbp+var_C], 0
jmp short loc_12BC
loc_1283:
mov eax, [rbp+var_C]
cdqe
shl rax, 4
mov rdx, rax
mov rax, [rbp+base]
add rax, rdx
mov edx, [rbp+var_C]
movsxd rdx, edx
mov rcx, rdx
shl rcx, 4
mov rdx, [rbp+var_8]
add rcx, rdx
mov rdx, [rax+8]
mov rax, [rax]
mov [rcx], rax
mov [rcx+8], rdx
add [rbp+var_C], 1
loc_12BC:
mov eax, [rbp+var_C]
cmp eax, [rbp+var_20]
jl short loc_1283
mov rax, [rbp+var_8]
leave
retn | char * func0(char *a1, int a2, int a3)
{
char *v3; // rax
char *v4; // rcx
long long v5; // rdx
int i; // [rsp+14h] [rbp-Ch]
char *v9; // [rsp+18h] [rbp-8h]
qsort(a1, a2, 0x10uLL, compare);
v9 = (char *)malloc(16LL * a3);
for ( i = 0; i < a3; ++i )
{
v3 = &a1[16 * i];
v4 = &v9[16 * i];
v5 = *((_QWORD *)v3 + 1);
*(_QWORD *)v4 = *(_QWORD *)v3;
*((_QWORD *)v4 + 1) = v5;
}
return v9;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
SUB RSP,0x20
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x20],EDX
MOV EAX,dword ptr [RBP + -0x1c]
MOVSXD RSI,EAX
MOV RAX,qword ptr [RBP + -0x18]
LEA RDX,[0x1011c9]
MOV RCX,RDX
MOV EDX,0x10
MOV RDI,RAX
CALL 0x001010a0
MOV EAX,dword ptr [RBP + -0x20]
CDQE
SHL RAX,0x4
MOV RDI,RAX
CALL 0x001010d0
MOV qword ptr [RBP + -0x8],RAX
MOV dword ptr [RBP + -0xc],0x0
JMP 0x001012bc
LAB_00101283:
MOV EAX,dword ptr [RBP + -0xc]
CDQE
SHL RAX,0x4
MOV RDX,RAX
MOV RAX,qword ptr [RBP + -0x18]
ADD RAX,RDX
MOV EDX,dword ptr [RBP + -0xc]
MOVSXD RDX,EDX
MOV RCX,RDX
SHL RCX,0x4
MOV RDX,qword ptr [RBP + -0x8]
ADD RCX,RDX
MOV RDX,qword ptr [RAX + 0x8]
MOV RAX,qword ptr [RAX]
MOV qword ptr [RCX],RAX
MOV qword ptr [RCX + 0x8],RDX
ADD dword ptr [RBP + -0xc],0x1
LAB_001012bc:
MOV EAX,dword ptr [RBP + -0xc]
CMP EAX,dword ptr [RBP + -0x20]
JL 0x00101283
MOV RAX,qword ptr [RBP + -0x8]
LEAVE
RET | void * func0(void *param_1,int param_2,int param_3)
{
int8 uVar1;
void *pvVar2;
int8 *puVar3;
int8 *puVar4;
int local_14;
qsort(param_1,(long)param_2,0x10,compare);
pvVar2 = malloc((long)param_3 << 4);
for (local_14 = 0; local_14 < param_3; local_14 = local_14 + 1) {
puVar3 = (int8 *)((long)param_1 + (long)local_14 * 0x10);
puVar4 = (int8 *)((long)local_14 * 0x10 + (long)pvVar2);
uVar1 = puVar3[1];
*puVar4 = *puVar3;
puVar4[1] = uVar1;
}
return pvVar2;
} |
7,073 | func0 |
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct {
char* name;
double price;
} Item;
int compare(const void *a, const void *b) {
Item *itemA = (Item *)a;
Item *itemB = (Item *)b;
if (itemA->price > itemB->price) return 1;
if (itemA->price < itemB->price) return -1;
return 0;
}
| Item* func0(Item items[], int totalItems, int n) {
qsort(items, totalItems, sizeof(Item), compare);
Item* result = (Item*)malloc(n * sizeof(Item));
for (int i = 0; i < n; i++) {
result[i] = items[i];
}
return result;
}
| int main() {
Item items1[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}};
Item* result1 = func0(items1, 2, 1);
assert(result1[0].price == 101.1);
Item items2[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}};
Item* result2 = func0(items2, 2, 2);
assert(result2[0].price == 101.1 && result2[1].price == 555.22);
Item items3[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}, {.name = "Item-3", .price = 45.09}, {.name = "Item-4", .price = 22.75}};
Item* result3 = func0(items3, 4, 1);
assert(result3[0].price == 22.75);
free(result1);
free(result2);
free(result3);
return 0;
}
| O1 | c | func0:
endbr64
push %rbp
push %rbx
sub $0x8,%rsp
mov %rdi,%rbx
mov %edx,%ebp
movslq %esi,%rsi
lea -0x3f(%rip),%rcx
mov $0x10,%edx
callq 10a0 <qsort@plt>
movslq %ebp,%rdi
shl $0x4,%rdi
callq 10d0 <malloc@plt>
test %ebp,%ebp
jle 1244 <func0+0x55>
lea -0x1(%rbp),%ecx
add $0x1,%rcx
shl $0x4,%rcx
mov $0x0,%edx
movdqu (%rbx,%rdx,1),%xmm0
movups %xmm0,(%rax,%rdx,1)
add $0x10,%rdx
cmp %rcx,%rdx
jne 1232 <func0+0x43>
add $0x8,%rsp
pop %rbx
pop %rbp
retq
| func0:
endbr64
push rbp
push rbx
sub rsp, 8
mov rbp, rdi
mov ebx, edx
movsxd rsi, esi
lea rcx, compare
mov edx, 10h
call _qsort
movsxd rdi, ebx
shl rdi, 4
call _malloc
test ebx, ebx
jle short loc_1240
mov ecx, ebx
shl rcx, 4
mov edx, 0
loc_122D:
movdqu xmm0, xmmword ptr [rbp+rdx+0]
movups xmmword ptr [rax+rdx], xmm0
add rdx, 10h
cmp rdx, rcx
jnz short loc_122D
loc_1240:
add rsp, 8
pop rbx
pop rbp
retn | long long func0(long long a1, int a2, int a3)
{
long long result; // rax
long long v5; // rdx
qsort(a1, a2, 16LL, compare);
result = malloc(16LL * a3);
if ( a3 > 0 )
{
v5 = 0LL;
do
{
*(__m128i *)(result + v5) = _mm_loadu_si128((const __m128i *)(a1 + v5));
v5 += 16LL;
}
while ( v5 != 16LL * (unsigned int)a3 );
}
return result;
} | func0:
ENDBR64
PUSH RBP
PUSH RBX
SUB RSP,0x8
MOV RBP,RDI
MOV EBX,EDX
MOVSXD RSI,ESI
LEA RCX,[0x1011c9]
MOV EDX,0x10
CALL 0x001010a0
MOVSXD RDI,EBX
SHL RDI,0x4
CALL 0x001010d0
TEST EBX,EBX
JLE 0x00101240
MOV ECX,EBX
SHL RCX,0x4
MOV EDX,0x0
LAB_0010122d:
MOVDQU XMM0,xmmword ptr [RBP + RDX*0x1]
MOVUPS xmmword ptr [RAX + RDX*0x1],XMM0
ADD RDX,0x10
CMP RDX,RCX
JNZ 0x0010122d
LAB_00101240:
ADD RSP,0x8
POP RBX
POP RBP
RET | void func0(void *param_1,int param_2,uint param_3)
{
int8 uVar1;
void *pvVar2;
long lVar3;
qsort(param_1,(long)param_2,0x10,compare);
pvVar2 = malloc((long)(int)param_3 << 4);
if (0 < (int)param_3) {
lVar3 = 0;
do {
uVar1 = ((int8 *)((long)param_1 + lVar3))[1];
*(int8 *)((long)pvVar2 + lVar3) = *(int8 *)((long)param_1 + lVar3);
((int8 *)((long)pvVar2 + lVar3))[1] = uVar1;
lVar3 = lVar3 + 0x10;
} while (lVar3 != (ulong)param_3 << 4);
}
return;
} |
7,074 | func0 |
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct {
char* name;
double price;
} Item;
int compare(const void *a, const void *b) {
Item *itemA = (Item *)a;
Item *itemB = (Item *)b;
if (itemA->price > itemB->price) return 1;
if (itemA->price < itemB->price) return -1;
return 0;
}
| Item* func0(Item items[], int totalItems, int n) {
qsort(items, totalItems, sizeof(Item), compare);
Item* result = (Item*)malloc(n * sizeof(Item));
for (int i = 0; i < n; i++) {
result[i] = items[i];
}
return result;
}
| int main() {
Item items1[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}};
Item* result1 = func0(items1, 2, 1);
assert(result1[0].price == 101.1);
Item items2[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}};
Item* result2 = func0(items2, 2, 2);
assert(result2[0].price == 101.1 && result2[1].price == 555.22);
Item items3[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}, {.name = "Item-3", .price = 45.09}, {.name = "Item-4", .price = 22.75}};
Item* result3 = func0(items3, 4, 1);
assert(result3[0].price == 22.75);
free(result1);
free(result2);
free(result3);
return 0;
}
| O2 | c | func0:
endbr64
push %rbp
movslq %esi,%rsi
mov %edx,%ebp
lea -0x41(%rip),%rcx
push %rbx
mov $0x10,%edx
mov %rdi,%rbx
sub $0x8,%rsp
callq 10a0 <qsort@plt>
movslq %ebp,%rdi
shl $0x4,%rdi
callq 10d0 <malloc@plt>
test %ebp,%ebp
jle 1462 <func0+0x52>
lea -0x1(%rbp),%ecx
xor %edx,%edx
add $0x1,%rcx
shl $0x4,%rcx
movdqu (%rbx,%rdx,1),%xmm0
movups %xmm0,(%rax,%rdx,1)
add $0x10,%rdx
cmp %rcx,%rdx
jne 1450 <func0+0x40>
add $0x8,%rsp
pop %rbx
pop %rbp
retq
nopl 0x0(%rax)
| func0:
endbr64
push r12
movsxd r12, edx
movsxd rsi, esi
lea rcx, compare
push rbp
mov edx, 10h
mov rbp, rdi
push rbx
mov rbx, r12
shl r12, 4
call _qsort
mov rdi, r12
call _malloc
mov r8, rax
test ebx, ebx
jle short loc_1479
mov rdx, r12
mov rsi, rbp
mov rdi, rax
call _memcpy
mov r8, rax
loc_1479:
pop rbx
mov rax, r8
pop rbp
pop r12
retn | long long func0(long long a1, int a2, int a3)
{
long long v4; // r12
long long v5; // rax
long long v6; // rcx
long long v7; // r8
v4 = 16LL * a3;
qsort(a1, a2, 16LL, compare);
v5 = malloc(v4);
v7 = v5;
if ( a3 > 0 )
return memcpy(v5, a1, v4, v6, v5);
return v7;
} | func0:
ENDBR64
PUSH R12
MOVSXD R12,EDX
MOVSXD RSI,ESI
LEA RCX,[0x101400]
PUSH RBP
MOV EDX,0x10
MOV RBP,RDI
PUSH RBX
MOV RBX,R12
SHL R12,0x4
CALL 0x001010b0
MOV RDI,R12
CALL 0x001010f0
MOV R8,RAX
TEST EBX,EBX
JLE 0x00101479
MOV RDX,R12
MOV RSI,RBP
MOV RDI,RAX
CALL 0x001010e0
MOV R8,RAX
LAB_00101479:
POP RBX
MOV RAX,R8
POP RBP
POP R12
RET | void * func0(void *param_1,int param_2,int param_3)
{
void *__dest;
qsort(param_1,(long)param_2,0x10,compare);
__dest = malloc((long)param_3 << 4);
if (0 < param_3) {
__dest = memcpy(__dest,param_1,(long)param_3 << 4);
}
return __dest;
} |
7,075 | func0 |
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct {
char* name;
double price;
} Item;
int compare(const void *a, const void *b) {
Item *itemA = (Item *)a;
Item *itemB = (Item *)b;
if (itemA->price > itemB->price) return 1;
if (itemA->price < itemB->price) return -1;
return 0;
}
| Item* func0(Item items[], int totalItems, int n) {
qsort(items, totalItems, sizeof(Item), compare);
Item* result = (Item*)malloc(n * sizeof(Item));
for (int i = 0; i < n; i++) {
result[i] = items[i];
}
return result;
}
| int main() {
Item items1[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}};
Item* result1 = func0(items1, 2, 1);
assert(result1[0].price == 101.1);
Item items2[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}};
Item* result2 = func0(items2, 2, 2);
assert(result2[0].price == 101.1 && result2[1].price == 555.22);
Item items3[] = {{.name = "Item-1", .price = 101.1}, {.name = "Item-2", .price = 555.22}, {.name = "Item-3", .price = 45.09}, {.name = "Item-4", .price = 22.75}};
Item* result3 = func0(items3, 4, 1);
assert(result3[0].price == 22.75);
free(result1);
free(result2);
free(result3);
return 0;
}
| O3 | c | func0:
endbr64
push %rbp
movslq %esi,%rsi
lea -0x3f(%rip),%rcx
mov %rdi,%rbp
push %rbx
mov %edx,%ebx
mov $0x10,%edx
sub $0x8,%rsp
callq 10b0 <qsort@plt>
movslq %ebx,%rdi
shl $0x4,%rdi
callq 10f0 <malloc@plt>
mov %rax,%r8
test %ebx,%ebx
jle 146f <func0+0x4f>
lea -0x1(%rbx),%edx
mov %rbp,%rsi
mov %rax,%rdi
add $0x1,%rdx
shl $0x4,%rdx
callq 10e0 <memcpy@plt>
mov %rax,%r8
add $0x8,%rsp
mov %r8,%rax
pop %rbx
pop %rbp
retq
nopl 0x0(%rax)
| func0:
endbr64
push rbp
lea rcx, compare; compar
movsxd rsi, esi; nmemb
mov rbp, rdi
push rbx
mov ebx, edx
mov edx, 10h; size
sub rsp, 8
call _qsort
movsxd rdi, ebx
shl rdi, 4; size
call _malloc
mov rcx, rax
test ebx, ebx
jle short loc_146A
mov edx, ebx
mov rsi, rbp; src
mov rdi, rax; dest
shl rdx, 4; n
call _memcpy
mov rcx, rax
loc_146A:
add rsp, 8
mov rax, rcx
pop rbx
pop rbp
retn | void * func0(void *src, int a2, int a3)
{
void *v4; // rax
void *v5; // rcx
qsort(src, a2, 0x10uLL, compare);
v4 = malloc(16LL * a3);
v5 = v4;
if ( a3 > 0 )
return memcpy(v4, src, 16LL * (unsigned int)a3);
return v5;
} | func0:
ENDBR64
PUSH RBP
LEA RCX,[0x1013f0]
MOVSXD RSI,ESI
MOV RBP,RDI
PUSH RBX
MOV EBX,EDX
MOV EDX,0x10
SUB RSP,0x8
CALL 0x001010b0
MOVSXD RDI,EBX
SHL RDI,0x4
CALL 0x001010f0
MOV RCX,RAX
TEST EBX,EBX
JLE 0x0010146a
MOV EDX,EBX
MOV RSI,RBP
MOV RDI,RAX
SHL RDX,0x4
CALL 0x001010e0
MOV RCX,RAX
LAB_0010146a:
ADD RSP,0x8
MOV RAX,RCX
POP RBX
POP RBP
RET | void * func0(void *param_1,int param_2,uint param_3)
{
void *__dest;
qsort(param_1,(long)param_2,0x10,compare);
__dest = malloc((long)(int)param_3 << 4);
if (0 < (int)param_3) {
__dest = memcpy(__dest,param_1,(ulong)param_3 << 4);
}
return __dest;
} |
7,076 | func0 |
#include <assert.h>
#include <stdio.h>
| int func0(int dict[], int size) {
int sum = 0;
for (int i = 0; i < size; i++) {
sum += dict[i];
}
return sum;
}
| int main() {
int dict1[] = {100, 200, 300};
int dict2[] = {25, 18, 45};
int dict3[] = {36, 39, 49};
assert(func0(dict1, 3) == 600);
assert(func0(dict2, 3) == 88);
assert(func0(dict3, 3) == 124);
printf("All tests passed successfully.\n");
return 0;
}
| O0 | c | func0:
endbr64
push %rbp
mov %rsp,%rbp
mov %rdi,-0x18(%rbp)
mov %esi,-0x1c(%rbp)
movl $0x0,-0x8(%rbp)
movl $0x0,-0x4(%rbp)
jmp 11c5 <func0+0x3c>
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 -0x1c(%rbp),%eax
jl 11a8 <func0+0x1f>
mov -0x8(%rbp),%eax
pop %rbp
retq
| func0:
endbr64
push rbp
mov rbp, rsp
mov [rbp+var_18], rdi
mov [rbp+var_1C], esi
mov [rbp+var_8], 0
mov [rbp+var_4], 0
jmp short loc_11C5
loc_11A8:
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_11C5:
mov eax, [rbp+var_4]
cmp eax, [rbp+var_1C]
jl short loc_11A8
mov eax, [rbp+var_8]
pop rbp
retn | long long func0(long long a1, int a2)
{
unsigned int v3; // [rsp+14h] [rbp-8h]
int i; // [rsp+18h] [rbp-4h]
v3 = 0;
for ( i = 0; i < a2; ++i )
v3 += *(_DWORD *)(4LL * i + a1);
return v3;
} | func0:
ENDBR64
PUSH RBP
MOV RBP,RSP
MOV qword ptr [RBP + -0x18],RDI
MOV dword ptr [RBP + -0x1c],ESI
MOV dword ptr [RBP + -0x8],0x0
MOV dword ptr [RBP + -0x4],0x0
JMP 0x001011c5
LAB_001011a8:
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_001011c5:
MOV EAX,dword ptr [RBP + -0x4]
CMP EAX,dword ptr [RBP + -0x1c]
JL 0x001011a8
MOV EAX,dword ptr [RBP + -0x8]
POP RBP
RET | int func0(long param_1,int param_2)
{
int4 local_10;
int4 local_c;
local_10 = 0;
for (local_c = 0; local_c < param_2; local_c = local_c + 1) {
local_10 = local_10 + *(int *)(param_1 + (long)local_c * 4);
}
return local_10;
} |
7,077 | func0 |
#include <assert.h>
#include <stdio.h>
| int func0(int dict[], int size) {
int sum = 0;
for (int i = 0; i < size; i++) {
sum += dict[i];
}
return sum;
}
| int main() {
int dict1[] = {100, 200, 300};
int dict2[] = {25, 18, 45};
int dict3[] = {36, 39, 49};
assert(func0(dict1, 3) == 600);
assert(func0(dict2, 3) == 88);
assert(func0(dict3, 3) == 124);
printf("All tests passed successfully.\n");
return 0;
}
| O1 | c | func0:
endbr64
test %esi,%esi
jle 11af <func0+0x26>
mov %rdi,%rax
lea -0x1(%rsi),%edx
lea 0x4(%rdi,%rdx,4),%rcx
mov $0x0,%edx
add (%rax),%edx
add $0x4,%rax
cmp %rcx,%rax
jne 11a1 <func0+0x18>
mov %edx,%eax
retq
mov $0x0,%edx
jmp 11ac <func0+0x23>
| func0:
endbr64
test esi, esi
jle short loc_11AF
mov rax, rdi
lea edx, [rsi-1]
lea rcx, [rdi+rdx*4+4]
mov edx, 0
loc_11A1:
add edx, [rax]
add rax, 4
cmp rax, rcx
jnz short loc_11A1
loc_11AC:
mov eax, edx
retn
loc_11AF:
mov edx, 0
jmp short loc_11AC | long long func0(_DWORD *a1, int a2)
{
_DWORD *v2; // rax
unsigned int v3; // edx
if ( a2 <= 0 )
{
return 0;
}
else
{
v2 = a1;
v3 = 0;
do
v3 += *v2++;
while ( v2 != &a1[a2 - 1 + 1] );
}
return v3;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x001011af
MOV RAX,RDI
LEA EDX,[RSI + -0x1]
LEA RCX,[RDI + RDX*0x4 + 0x4]
MOV EDX,0x0
LAB_001011a1:
ADD EDX,dword ptr [RAX]
ADD RAX,0x4
CMP RAX,RCX
JNZ 0x001011a1
LAB_001011ac:
MOV EAX,EDX
RET
LAB_001011af:
MOV EDX,0x0
JMP 0x001011ac | int func0(int *param_1,int param_2)
{
int *piVar1;
int iVar2;
if (param_2 < 1) {
iVar2 = 0;
}
else {
piVar1 = param_1 + (ulong)(param_2 - 1) + 1;
iVar2 = 0;
do {
iVar2 = iVar2 + *param_1;
param_1 = param_1 + 1;
} while (param_1 != piVar1);
}
return iVar2;
} |
7,078 | func0 |
#include <assert.h>
#include <stdio.h>
| int func0(int dict[], int size) {
int sum = 0;
for (int i = 0; i < size; i++) {
sum += dict[i];
}
return sum;
}
| int main() {
int dict1[] = {100, 200, 300};
int dict2[] = {25, 18, 45};
int dict3[] = {36, 39, 49};
assert(func0(dict1, 3) == 600);
assert(func0(dict2, 3) == 88);
assert(func0(dict3, 3) == 124);
printf("All tests passed successfully.\n");
return 0;
}
| O2 | c | func0:
endbr64
test %esi,%esi
jle 1198 <func0+0x28>
lea -0x1(%rsi),%eax
lea 0x4(%rdi,%rax,4),%rdx
xor %eax,%eax
nopw 0x0(%rax,%rax,1)
add (%rdi),%eax
add $0x4,%rdi
cmp %rdx,%rdi
jne 1188 <func0+0x18>
retq
nopl 0x0(%rax)
xor %eax,%eax
retq
nopl 0x0(%rax,%rax,1)
| func0:
endbr64
test esi, esi
jle short loc_1198
lea eax, [rsi-1]
lea rdx, [rdi+rax*4+4]
xor eax, eax
nop word ptr [rax+rax+00h]
loc_1188:
add eax, [rdi]
add rdi, 4
cmp rdi, rdx
jnz short loc_1188
retn
loc_1198:
xor eax, eax
retn | long long func0(_DWORD *a1, int a2)
{
long long v2; // rdx
long long result; // rax
if ( a2 <= 0 )
return 0LL;
v2 = (long long)&a1[a2 - 1 + 1];
LODWORD(result) = 0;
do
result = (unsigned int)(*a1++ + result);
while ( a1 != (_DWORD *)v2 );
return result;
} | func0:
ENDBR64
TEST ESI,ESI
JLE 0x00101198
LEA EAX,[RSI + -0x1]
LEA RDX,[RDI + RAX*0x4 + 0x4]
XOR EAX,EAX
NOP word ptr [RAX + RAX*0x1]
LAB_00101188:
ADD EAX,dword ptr [RDI]
ADD RDI,0x4
CMP RDI,RDX
JNZ 0x00101188
RET
LAB_00101198:
XOR EAX,EAX
RET | int func0(int *param_1,int param_2)
{
int *piVar1;
int iVar2;
if (0 < param_2) {
piVar1 = param_1 + (ulong)(param_2 - 1) + 1;
iVar2 = 0;
do {
iVar2 = iVar2 + *param_1;
param_1 = param_1 + 1;
} while (param_1 != piVar1);
return iVar2;
}
return 0;
} |
7,079 | func0 |
#include <assert.h>
#include <stdio.h>
| int func0(int dict[], int size) {
int sum = 0;
for (int i = 0; i < size; i++) {
sum += dict[i];
}
return sum;
}
| int main() {
int dict1[] = {100, 200, 300};
int dict2[] = {25, 18, 45};
int dict3[] = {36, 39, 49};
assert(func0(dict1, 3) == 600);
assert(func0(dict2, 3) == 88);
assert(func0(dict3, 3) == 124);
printf("All tests passed successfully.\n");
return 0;
}
| O3 | c | func0:
endbr64
test %esi,%esi
jle 1210 <func0+0xa0>
lea -0x1(%rsi),%eax
cmp $0x3,%eax
jbe 1219 <func0+0xa9>
mov %esi,%edx
mov %rdi,%rax
pxor %xmm0,%xmm0
shr $0x2,%edx
shl $0x4,%rdx
add %rdi,%rdx
nopl 0x0(%rax,%rax,1)
movdqu (%rax),%xmm2
add $0x10,%rax
paddd %xmm2,%xmm0
cmp %rdx,%rax
jne 11a0 <func0+0x30>
movdqa %xmm0,%xmm1
mov %esi,%edx
psrldq $0x8,%xmm1
and $0xfffffffc,%edx
paddd %xmm1,%xmm0
movdqa %xmm0,%xmm1
psrldq $0x4,%xmm1
paddd %xmm1,%xmm0
movd %xmm0,%eax
test $0x3,%sil
je 1218 <func0+0xa8>
movslq %edx,%rcx
add (%rdi,%rcx,4),%eax
lea 0x1(%rdx),%ecx
cmp %ecx,%esi
jle 1212 <func0+0xa2>
movslq %ecx,%rcx
add (%rdi,%rcx,4),%eax
lea 0x2(%rdx),%ecx
cmp %ecx,%esi
jle 1212 <func0+0xa2>
movslq %ecx,%rcx
add $0x3,%edx
add (%rdi,%rcx,4),%eax
cmp %edx,%esi
jle 1212 <func0+0xa2>
movslq %edx,%rdx
add (%rdi,%rdx,4),%eax
retq
nopl 0x0(%rax,%rax,1)
xor %eax,%eax
retq
nopl 0x0(%rax,%rax,1)
retq
xor %edx,%edx
xor %eax,%eax
jmp 11da <func0+0x6a>
| func0:
endbr64
mov rcx, rdi
test esi, esi
jle loc_1208
lea eax, [rsi-1]
cmp eax, 2
jbe loc_1211
mov edx, esi
mov rax, rdi
pxor xmm0, xmm0
shr edx, 2
shl rdx, 4
add rdx, rdi
xchg ax, ax
loc_11A0:
movdqu xmm2, xmmword ptr [rax]
add rax, 10h
paddd xmm0, xmm2
cmp rax, rdx
jnz short loc_11A0
movdqa xmm1, xmm0
mov edx, esi
psrldq xmm1, 8
and edx, 0FFFFFFFCh
paddd xmm0, xmm1
movdqa xmm1, xmm0
psrldq xmm1, 4
paddd xmm0, xmm1
movd eax, xmm0
test sil, 3
jz short locret_1210
loc_11DA:
movsxd rdi, edx
lea r8, ds:0[rdi*4]
add eax, [rcx+rdi*4]
lea edi, [rdx+1]
cmp esi, edi
jle short locret_120A
add edx, 2
add eax, [rcx+r8+4]
cmp esi, edx
jle short locret_120A
add eax, [rcx+r8+8]
retn
loc_1208:
xor eax, eax
locret_120A:
retn
locret_1210:
retn
loc_1211:
xor edx, edx
xor eax, eax
jmp short loc_11DA | long long func0(const __m128i *a1, int a2)
{
const __m128i *v2; // rax
__m128i v3; // xmm0
__m128i v4; // xmm2
int v5; // edx
__m128i v6; // xmm0
long long result; // rax
long long v8; // r8
if ( a2 <= 0 )
return 0LL;
if ( (unsigned int)(a2 - 1) <= 2 )
{
v5 = 0;
LODWORD(result) = 0;
}
else
{
v2 = a1;
v3 = 0LL;
do
{
v4 = _mm_loadu_si128(v2++);
v3 = _mm_add_epi32(v3, v4);
}
while ( v2 != &a1[(unsigned int)a2 >> 2] );
v5 = a2 & 0x7FFFFFFC;
v6 = _mm_add_epi32(v3, _mm_srli_si128(v3, 8));
result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v6, _mm_srli_si128(v6, 4)));
if ( (a2 & 3) == 0 )
return result;
}
v8 = v5;
result = (unsigned int)(a1->m128i_i32[v8] + result);
if ( a2 > v5 + 1 )
{
result = (unsigned int)(a1->m128i_i32[v8 + 1] + result);
if ( a2 > v5 + 2 )
return (unsigned int)(a1->m128i_i32[v8 + 2] + result);
}
return result;
} | func0:
ENDBR64
MOV RCX,RDI
TEST ESI,ESI
JLE 0x00101208
LEA EAX,[RSI + -0x1]
CMP EAX,0x2
JBE 0x00101211
MOV EDX,ESI
MOV RAX,RDI
PXOR XMM0,XMM0
SHR EDX,0x2
SHL RDX,0x4
ADD RDX,RDI
NOP
LAB_001011a0:
MOVDQU XMM2,xmmword ptr [RAX]
ADD RAX,0x10
PADDD XMM0,XMM2
CMP RAX,RDX
JNZ 0x001011a0
MOVDQA XMM1,XMM0
MOV EDX,ESI
PSRLDQ XMM1,0x8
AND EDX,0xfffffffc
PADDD XMM0,XMM1
MOVDQA XMM1,XMM0
PSRLDQ XMM1,0x4
PADDD XMM0,XMM1
MOVD EAX,XMM0
TEST SIL,0x3
JZ 0x00101210
LAB_001011da:
MOVSXD RDI,EDX
LEA R8,[RDI*0x4]
ADD EAX,dword ptr [RCX + RDI*0x4]
LEA EDI,[RDX + 0x1]
CMP ESI,EDI
JLE 0x0010120a
ADD EDX,0x2
ADD EAX,dword ptr [RCX + R8*0x1 + 0x4]
CMP ESI,EDX
JLE 0x0010120a
ADD EAX,dword ptr [RCX + R8*0x1 + 0x8]
RET
LAB_00101208:
XOR EAX,EAX
LAB_0010120a:
RET
LAB_00101210:
RET
LAB_00101211:
XOR EDX,EDX
XOR EAX,EAX
JMP 0x001011da | int func0(int *param_1,uint param_2)
{
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) {
iVar7 = 0;
}
else {
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 + iVar1;
iVar8 = iVar8 + *piVar2;
iVar9 = iVar9 + *piVar3;
iVar10 = iVar10 + *piVar4;
} while (piVar5 != param_1 + (ulong)(param_2 >> 2) * 4);
uVar6 = param_2 & 0xfffffffc;
iVar7 = iVar7 + iVar9 + iVar8 + iVar10;
if ((param_2 & 3) == 0) {
return iVar7;
}
}
iVar7 = iVar7 + param_1[(int)uVar6];
if ((int)(uVar6 + 1) < (int)param_2) {
iVar7 = iVar7 + param_1[(long)(int)uVar6 + 1];
if ((int)(uVar6 + 2) < (int)param_2) {
return iVar7 + param_1[(long)(int)uVar6 + 2];
}
}
}
return iVar7;
} |
7,080 | func0 |
#include <assert.h>
int sum_Odd(int n) {
int terms = (n + 1) / 2;
int sum1 = terms * terms;
return sum1;
}
| int func0(int l, int r) {
return sum_Odd(r) - sum_Odd(l - 1);
}
| int main() {
assert(func0(2, 5) == 8);
assert(func0(5, 7) == 12);
assert(func0(7, 13) == 40);
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 -0x10(%rbp),%eax
mov %eax,%edi
callq 1149 <sum_Odd>
mov %eax,%ebx
mov -0xc(%rbp),%eax
sub $0x1,%eax
mov %eax,%edi
callq 1149 <sum_Odd>
sub %eax,%ebx
mov %ebx,%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_10]
mov edi, eax
call sum_Odd
mov ebx, eax
mov eax, [rbp+var_C]
sub eax, 1
mov edi, eax
call sum_Odd
mov edx, ebx
sub edx, eax
mov eax, edx
mov rbx, [rbp+var_8]
leave
retn | long long func0(int a1, unsigned int a2)
{
int v2; // ebx
v2 = sum_Odd(a2);
return v2 - (unsigned int)sum_Odd((unsigned int)(a1 - 1));
} | 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 + -0x10]
MOV EDI,EAX
CALL 0x00101149
MOV EBX,EAX
MOV EAX,dword ptr [RBP + -0xc]
SUB EAX,0x1
MOV EDI,EAX
CALL 0x00101149
MOV EDX,EBX
SUB EDX,EAX
MOV EAX,EDX
MOV RBX,qword ptr [RBP + -0x8]
LEAVE
RET | int func0(int param_1,int4 param_2)
{
int iVar1;
int iVar2;
iVar1 = sum_Odd(param_2);
iVar2 = sum_Odd(param_1 + -1);
return iVar1 - iVar2;
} |
7,081 | func0 |
#include <assert.h>
int sum_Odd(int n) {
int terms = (n + 1) / 2;
int sum1 = terms * terms;
return sum1;
}
| int func0(int l, int r) {
return sum_Odd(r) - sum_Odd(l - 1);
}
| int main() {
assert(func0(2, 5) == 8);
assert(func0(5, 7) == 12);
assert(func0(7, 13) == 40);
return 0;
}
| O1 | c | func0:
endbr64
add $0x1,%esi
mov %esi,%eax
shr $0x1f,%eax
add %esi,%eax
sar %eax
mov %edi,%edx
shr $0x1f,%edx
lea (%rdx,%rdi,1),%edx
sar %edx
imul %eax,%eax
imul %edx,%edx
sub %edx,%eax
retq
| func0:
endbr64
add esi, 1
mov eax, esi
shr eax, 1Fh
add eax, esi
sar eax, 1
mov edx, edi
shr edx, 1Fh
lea edx, [rdx+rdi]
sar edx, 1
imul eax, eax
imul edx, edx
sub eax, edx
retn | long long func0(int a1, int a2)
{
return (unsigned int)((a2 + 1) / 2 * ((a2 + 1) / 2) - a1 / 2 * (a1 / 2));
} | func0:
ENDBR64
ADD ESI,0x1
MOV EAX,ESI
SHR EAX,0x1f
ADD EAX,ESI
SAR EAX,0x1
MOV EDX,EDI
SHR EDX,0x1f
LEA EDX,[RDX + RDI*0x1]
SAR EDX,0x1
IMUL EAX,EAX
IMUL EDX,EDX
SUB EAX,EDX
RET | int func0(int param_1,int param_2)
{
int iVar1;
iVar1 = (param_2 + 1) / 2;
return iVar1 * iVar1 - (param_1 / 2) * (param_1 / 2);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.