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
3,182
func0
#include <iostream> #include <unordered_map> #include <cassert>
int func0(std::unordered_map<char, int> dict) { int sum = 0; for (auto const& pair : dict) { sum += pair.second; } return sum; }
int main() { assert(func0({{'a', 100}, {'b', 200}, {'c', 300}}) == 600); assert(func0({{'a', 25}, {'b', 18}, {'c', 45}}) == 88); assert(func0({{'a', 36}, {'b', 39}, {'c', 49}}) == 124); return 0; }
O2
cpp
func0(std::unordered_map<char, int, std::hash<char>, std::equal_to<char>, std::allocator<std::pair<char const, int> > >): endbr64 mov 0x10(%rdi),%rax xor %r8d,%r8d test %rax,%rax je 164c <_Z5func0St13unordered_mapIciSt4hashIcESt8equal_toIcESaISt4pairIKciEEE+0x1c> add 0xc(%rax),%r8d mov (%rax),%rax test %rax,%rax jne 1640 <_Z5func0St13unordered_mapIciSt4hashIcESt8equal_toIcESaISt4pairIKciEEE+0x10> mov %r8d,%eax retq
_Z5func0St13unordered_mapIciSt4hashIcESt8equal_toIcESaISt4pairIKciEEE: endbr64 mov rax, [rdi+10h] xor edx, edx test rax, rax jz short loc_14DB nop loc_14D0: add edx, [rax+0Ch] mov rax, [rax] test rax, rax jnz short loc_14D0 loc_14DB: mov eax, edx retn
long long func0(long long a1) { long long *v1; // rax unsigned int i; // edx v1 = *(long long **)(a1 + 16); for ( i = 0; v1; v1 = (long long *)*v1 ) i += *((_DWORD *)v1 + 3); return i; }
func0: ENDBR64 MOV RAX,qword ptr [RDI + 0x10] XOR EDX,EDX TEST RAX,RAX JZ 0x001014db NOP LAB_001014d0: ADD EDX,dword ptr [RAX + 0xc] MOV RAX,qword ptr [RAX] TEST RAX,RAX JNZ 0x001014d0 LAB_001014db: MOV EAX,EDX RET
/* func0(std::unordered_map<char, int, std::hash<char>, std::equal_to<char>, std::allocator<std::pair<char const, int> > >) */ int func0(unordered_map param_1) { int8 *puVar1; int iVar2; int4 in_register_0000003c; iVar2 = 0; for (puVar1 = *(int8 **)(CONCAT44(in_register_0000003c,param_1) + 0x10); puVar1 != (int8 *)0x0; puVar1 = (int8 *)*puVar1) { iVar2 = iVar2 + *(int *)((long)puVar1 + 0xc); } return iVar2; }
3,183
func0
#include <iostream> #include <unordered_map> #include <cassert>
int func0(std::unordered_map<char, int> dict) { int sum = 0; for (auto const& pair : dict) { sum += pair.second; } return sum; }
int main() { assert(func0({{'a', 100}, {'b', 200}, {'c', 300}}) == 600); assert(func0({{'a', 25}, {'b', 18}, {'c', 45}}) == 88); assert(func0({{'a', 36}, {'b', 39}, {'c', 49}}) == 124); return 0; }
O3
cpp
func0(std::unordered_map<char, int, std::hash<char>, std::equal_to<char>, std::allocator<std::pair<char const, int> > >): endbr64 mov 0x10(%rdi),%rax xor %r8d,%r8d test %rax,%rax je 158c <_Z5func0St13unordered_mapIciSt4hashIcESt8equal_toIcESaISt4pairIKciEEE+0x1c> add 0xc(%rax),%r8d mov (%rax),%rax test %rax,%rax jne 1580 <_Z5func0St13unordered_mapIciSt4hashIcESt8equal_toIcESaISt4pairIKciEEE+0x10> mov %r8d,%eax retq
_Z5func0St13unordered_mapIciSt4hashIcESt8equal_toIcESaISt4pairIKciEEE: endbr64 mov rax, [rdi+10h] xor edx, edx test rax, rax jz short loc_153B nop loc_1530: add edx, [rax+0Ch] mov rax, [rax] test rax, rax jnz short loc_1530 loc_153B: mov eax, edx retn
long long func0(long long a1) { long long *v1; // rax unsigned int i; // edx v1 = *(long long **)(a1 + 16); for ( i = 0; v1; v1 = (long long *)*v1 ) i += *((_DWORD *)v1 + 3); return i; }
func0: ENDBR64 MOV RAX,qword ptr [RDI + 0x10] XOR EDX,EDX TEST RAX,RAX JZ 0x0010153b NOP LAB_00101530: ADD EDX,dword ptr [RAX + 0xc] MOV RAX,qword ptr [RAX] TEST RAX,RAX JNZ 0x00101530 LAB_0010153b: MOV EAX,EDX RET
/* func0(std::unordered_map<char, int, std::hash<char>, std::equal_to<char>, std::allocator<std::pair<char const, int> > >) */ int func0(unordered_map param_1) { int8 *puVar1; int iVar2; int4 in_register_0000003c; iVar2 = 0; for (puVar1 = *(int8 **)(CONCAT44(in_register_0000003c,param_1) + 0x10); puVar1 != (int8 *)0x0; puVar1 = (int8 *)*puVar1) { iVar2 = iVar2 + *(int *)((long)puVar1 + 0xc); } return iVar2; }
3,184
func0
#include <cassert>
int func0(int l, int r) { int terms1 = (r + 1) / 2; int sum1 = terms1 * terms1; int terms2 = l / 2; int sum2 = terms2 * terms2; return sum1 - sum2; }
int main() { assert(func0(2, 5) == 8); assert(func0(5, 7) == 12); assert(func0(7, 13) == 40); return 0; }
O0
cpp
func0(int, int): endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) mov -0x18(%rbp),%eax add $0x1,%eax mov %eax,%edx shr $0x1f,%edx add %edx,%eax sar %eax mov %eax,-0x10(%rbp) mov -0x10(%rbp),%eax imul %eax,%eax mov %eax,-0xc(%rbp) mov -0x14(%rbp),%eax mov %eax,%edx shr $0x1f,%edx add %edx,%eax sar %eax mov %eax,-0x8(%rbp) mov -0x8(%rbp),%eax imul %eax,%eax mov %eax,-0x4(%rbp) mov -0xc(%rbp),%eax sub -0x4(%rbp),%eax pop %rbp retq
_Z5func0ii: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_18], esi mov eax, [rbp+var_18] add eax, 1 mov edx, eax shr edx, 1Fh add eax, edx sar eax, 1 mov [rbp+var_10], eax mov eax, [rbp+var_10] imul eax, eax mov [rbp+var_C], eax mov eax, [rbp+var_14] mov edx, eax shr edx, 1Fh add eax, edx sar eax, 1 mov [rbp+var_8], eax mov eax, [rbp+var_8] imul eax, eax mov [rbp+var_4], eax mov eax, [rbp+var_C] sub eax, [rbp+var_4] pop rbp retn
long long func0(int a1, int a2) { return (unsigned int)((a2 + 1) / 2 * ((a2 + 1) / 2) - a1 / 2 * (a1 / 2)); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x18],ESI MOV EAX,dword ptr [RBP + -0x18] ADD EAX,0x1 MOV EDX,EAX SHR EDX,0x1f ADD EAX,EDX SAR EAX,0x1 MOV dword ptr [RBP + -0x10],EAX MOV EAX,dword ptr [RBP + -0x10] IMUL EAX,EAX MOV dword ptr [RBP + -0xc],EAX MOV EAX,dword ptr [RBP + -0x14] MOV EDX,EAX SHR EDX,0x1f ADD EAX,EDX SAR EAX,0x1 MOV dword ptr [RBP + -0x8],EAX MOV EAX,dword ptr [RBP + -0x8] IMUL EAX,EAX MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0xc] SUB EAX,dword ptr [RBP + -0x4] POP RBP RET
/* func0(int, int) */ int func0(int param_1,int param_2) { int iVar1; iVar1 = (param_2 + 1) / 2; return iVar1 * iVar1 - (param_1 / 2) * (param_1 / 2); }
3,185
func0
#include <cassert>
int func0(int l, int r) { int terms1 = (r + 1) / 2; int sum1 = terms1 * terms1; int terms2 = l / 2; int sum2 = terms2 * terms2; return sum1 - sum2; }
int main() { assert(func0(2, 5) == 8); assert(func0(5, 7) == 12); assert(func0(7, 13) == 40); return 0; }
O1
cpp
func0(int, int): 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
_Z5func0ii: 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
/* func0(int, int) */ int func0(int param_1,int param_2) { int iVar1; iVar1 = (param_2 + 1) / 2; return iVar1 * iVar1 - (param_1 / 2) * (param_1 / 2); }
3,186
func0
#include <cassert>
int func0(int l, int r) { int terms1 = (r + 1) / 2; int sum1 = terms1 * terms1; int terms2 = l / 2; int sum2 = terms2 * terms2; return sum1 - sum2; }
int main() { assert(func0(2, 5) == 8); assert(func0(5, 7) == 12); assert(func0(7, 13) == 40); return 0; }
O2
cpp
func0(int, int): endbr64 add $0x1,%esi mov %edi,%edx mov %esi,%eax shr $0x1f,%edx shr $0x1f,%eax add %edi,%edx add %esi,%eax sar %edx sar %eax imul %edx,%edx imul %eax,%eax sub %edx,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
_Z5func0ii: endbr64 add esi, 1 mov edx, edi mov eax, esi shr edx, 1Fh shr eax, 1Fh add edx, edi add eax, esi sar edx, 1 sar eax, 1 imul edx, edx imul eax, eax 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 EDX,EDI MOV EAX,ESI SHR EDX,0x1f SHR EAX,0x1f ADD EDX,EDI ADD EAX,ESI SAR EDX,0x1 SAR EAX,0x1 IMUL EDX,EDX IMUL EAX,EAX SUB EAX,EDX RET
/* func0(int, int) */ int func0(int param_1,int param_2) { int iVar1; iVar1 = (param_2 + 1) / 2; return iVar1 * iVar1 - (param_1 / 2) * (param_1 / 2); }
3,187
func0
#include <cassert>
int func0(int l, int r) { int terms1 = (r + 1) / 2; int sum1 = terms1 * terms1; int terms2 = l / 2; int sum2 = terms2 * terms2; return sum1 - sum2; }
int main() { assert(func0(2, 5) == 8); assert(func0(5, 7) == 12); assert(func0(7, 13) == 40); return 0; }
O3
cpp
func0(int, int): endbr64 add $0x1,%esi mov %edi,%edx mov %esi,%eax shr $0x1f,%edx shr $0x1f,%eax add %edi,%edx add %esi,%eax sar %edx sar %eax imul %edx,%edx imul %eax,%eax sub %edx,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
_Z5func0ii: endbr64 add esi, 1 mov edx, edi mov eax, esi shr edx, 1Fh shr eax, 1Fh add edx, edi add eax, esi sar edx, 1 sar eax, 1 imul edx, edx imul eax, eax 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 EDX,EDI MOV EAX,ESI SHR EDX,0x1f SHR EAX,0x1f ADD EDX,EDI ADD EAX,ESI SAR EDX,0x1 SAR EAX,0x1 IMUL EDX,EDX IMUL EAX,EAX SUB EAX,EDX RET
/* func0(int, int) */ int func0(int param_1,int param_2) { int iVar1; iVar1 = (param_2 + 1) / 2; return iVar1 * iVar1 - (param_1 / 2) * (param_1 / 2); }
3,188
func0
#include <iostream> #include <vector> #include <assert.h>
int func0(const std::vector<int>& arr) { int sum = 0; for (int i : arr) { sum += i; } return sum; }
int main() { assert(func0({1, 2, 3}) == 6); assert(func0({15, 12, 13, 10}) == 50); assert(func0({0, 1, 2}) == 3); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> > const&): endbr64 push %rbp mov %rsp,%rbp sub $0x40,%rsp mov %rdi,-0x38(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax movl $0x0,-0x28(%rbp) mov -0x38(%rbp),%rax mov %rax,-0x10(%rbp) mov -0x10(%rbp),%rax mov %rax,%rdi callq 1604 <_ZNKSt6vectorIiSaIiEE5beginEv> mov %rax,-0x20(%rbp) mov -0x10(%rbp),%rax mov %rax,%rdi callq 165c <_ZNKSt6vectorIiSaIiEE3endEv> mov %rax,-0x18(%rbp) lea -0x18(%rbp),%rdx lea -0x20(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 16b4 <_ZN9__gnu_cxxneIPKiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESB_> test %al,%al je 12f3 <_Z5func0RKSt6vectorIiSaIiEE+0x8a> lea -0x20(%rbp),%rax mov %rax,%rdi callq 1718 <_ZNK9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEdeEv> mov (%rax),%eax mov %eax,-0x24(%rbp) mov -0x24(%rbp),%eax add %eax,-0x28(%rbp) lea -0x20(%rbp),%rax mov %rax,%rdi callq 16f4 <_ZN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEppEv> jmp 12b7 <_Z5func0RKSt6vectorIiSaIiEE+0x4e> mov -0x28(%rbp),%eax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 130a <_Z5func0RKSt6vectorIiSaIiEE+0xa1> callq 1140 <__stack_chk_fail@plt> leaveq retq
_Z5func0RKSt6vectorIiSaIiEE: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_38], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov [rbp+var_28], 0 mov rax, [rbp+var_38] mov [rbp+var_10], rax mov rax, [rbp+var_10] mov rdi, rax call _ZNKSt6vectorIiSaIiEE5beginEv; std::vector<int>::begin(void) mov [rbp+var_20], rax mov rax, [rbp+var_10] mov rdi, rax call _ZNKSt6vectorIiSaIiEE3endEv; std::vector<int>::end(void) mov [rbp+var_18], rax jmp short loc_12BC loc_1299: lea rax, [rbp+var_20] mov rdi, rax call _ZNK9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEdeEv; __gnu_cxx::__normal_iterator<int const*,std::vector<int>>::operator*(void) mov eax, [rax] mov [rbp+var_24], eax mov eax, [rbp+var_24] add [rbp+var_28], eax lea rax, [rbp+var_20] mov rdi, rax call _ZN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEppEv; __gnu_cxx::__normal_iterator<int const*,std::vector<int>>::operator++(void) loc_12BC: lea rdx, [rbp+var_18] lea rax, [rbp+var_20] mov rsi, rdx mov rdi, rax call _ZN9__gnu_cxxneIPKiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESB_; __gnu_cxx::operator!=<int const*,std::vector<int>>(__gnu_cxx::__normal_iterator<int const*,std::vector<int>> const&,__gnu_cxx::__normal_iterator<int const*,std::vector<int>> const&) test al, al jnz short loc_1299 mov eax, [rbp+var_28] mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_12EA call ___stack_chk_fail locret_12EA: leave retn
long long func0(long long a1) { unsigned int v2; // [rsp+18h] [rbp-28h] long long v3; // [rsp+20h] [rbp-20h] BYREF _QWORD v4[3]; // [rsp+28h] [rbp-18h] BYREF v4[2] = __readfsqword(0x28u); v2 = 0; v4[1] = a1; v3 = std::vector<int>::begin(a1); v4[0] = std::vector<int>::end(a1); while ( (unsigned __int8)__gnu_cxx::operator!=<int const*,std::vector<int>>(&v3, v4) ) { v2 += *(_DWORD *)__gnu_cxx::__normal_iterator<int const*,std::vector<int>>::operator*(&v3); __gnu_cxx::__normal_iterator<int const*,std::vector<int>>::operator++(&v3); } return v2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x38],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV dword ptr [RBP + -0x28],0x0 MOV RAX,qword ptr [RBP + -0x38] MOV qword ptr [RBP + -0x10],RAX MOV RAX,qword ptr [RBP + -0x10] MOV RDI,RAX CALL 0x001015e2 MOV qword ptr [RBP + -0x20],RAX MOV RAX,qword ptr [RBP + -0x10] MOV RDI,RAX CALL 0x0010162e MOV qword ptr [RBP + -0x18],RAX JMP 0x001012bc LAB_00101299: LEA RAX,[RBP + -0x20] MOV RDI,RAX CALL 0x001016e2 MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x24],EAX MOV EAX,dword ptr [RBP + -0x24] ADD dword ptr [RBP + -0x28],EAX LEA RAX,[RBP + -0x20] MOV RDI,RAX CALL 0x001016be LAB_001012bc: LEA RDX,[RBP + -0x18] LEA RAX,[RBP + -0x20] MOV RSI,RDX MOV RDI,RAX CALL 0x0010167e TEST AL,AL JNZ 0x00101299 MOV EAX,dword ptr [RBP + -0x28] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001012ea CALL 0x00101130 LAB_001012ea: LEAVE RET
/* func0(std::vector<int, std::allocator<int> > const&) */ int func0(vector *param_1) { bool bVar1; int *piVar2; long in_FS_OFFSET; int local_30; int8 local_28; int8 local_20; vector<int,std::allocator<int>> *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_30 = 0; local_18 = (vector<int,std::allocator<int>> *)param_1; local_28 = std::vector<int,std::allocator<int>>::begin((vector<int,std::allocator<int>> *)param_1) ; local_20 = std::vector<int,std::allocator<int>>::end(local_18); while( true ) { bVar1 = operator!=((__normal_iterator *)&local_28,(__normal_iterator *)&local_20); if (!bVar1) break; piVar2 = (int *)__normal_iterator<int_const*,std::vector<int,std::allocator<int>>>::operator* ((__normal_iterator<int_const*,std::vector<int,std::allocator<int>>> * )&local_28); local_30 = local_30 + *piVar2; __normal_iterator<int_const*,std::vector<int,std::allocator<int>>>::operator++ ((__normal_iterator<int_const*,std::vector<int,std::allocator<int>>> *)&local_28); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_30; }
3,189
func0
#include <iostream> #include <vector> #include <assert.h>
int func0(const std::vector<int>& arr) { int sum = 0; for (int i : arr) { sum += i; } return sum; }
int main() { assert(func0({1, 2, 3}) == 6); assert(func0({15, 12, 13, 10}) == 50); assert(func0({0, 1, 2}) == 3); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> > const&): endbr64 mov (%rdi),%rax mov 0x8(%rdi),%rcx cmp %rcx,%rax je 126c <_Z5func0RKSt6vectorIiSaIiEE+0x23> mov $0x0,%edx add (%rax),%edx add $0x4,%rax cmp %rax,%rcx jne 125e <_Z5func0RKSt6vectorIiSaIiEE+0x15> mov %edx,%eax retq mov $0x0,%edx jmp 1269 <_Z5func0RKSt6vectorIiSaIiEE+0x20>
_Z5func0RKSt6vectorIiSaIiEE: endbr64 mov rax, [rdi] mov rcx, [rdi+8] cmp rcx, rax jz short loc_122C mov edx, 0 loc_121E: add edx, [rax] add rax, 4 cmp rax, rcx jnz short loc_121E loc_1229: mov eax, edx retn loc_122C: mov edx, 0 jmp short loc_1229
long long func0(long long a1) { _DWORD *v1; // rax _DWORD *v2; // rcx unsigned int v3; // edx v1 = *(_DWORD **)a1; v2 = *(_DWORD **)(a1 + 8); if ( v2 == *(_DWORD **)a1 ) { return 0; } else { v3 = 0; do v3 += *v1++; while ( v1 != v2 ); } return v3; }
func0: ENDBR64 MOV RAX,qword ptr [RDI] MOV RCX,qword ptr [RDI + 0x8] CMP RCX,RAX JZ 0x0010122c MOV EDX,0x0 LAB_0010121e: ADD EDX,dword ptr [RAX] ADD RAX,0x4 CMP RAX,RCX JNZ 0x0010121e LAB_00101229: MOV EAX,EDX RET LAB_0010122c: MOV EDX,0x0 JMP 0x00101229
/* func0(std::vector<int, std::allocator<int> > const&) */ int func0(vector *param_1) { int *piVar1; int iVar2; piVar1 = *(int **)param_1; if (*(int **)(param_1 + 8) == piVar1) { iVar2 = 0; } else { iVar2 = 0; do { iVar2 = iVar2 + *piVar1; piVar1 = piVar1 + 1; } while (piVar1 != *(int **)(param_1 + 8)); } return iVar2; }
3,190
func0
#include <iostream> #include <vector> #include <assert.h>
int func0(const std::vector<int>& arr) { int sum = 0; for (int i : arr) { sum += i; } return sum; }
int main() { assert(func0({1, 2, 3}) == 6); assert(func0({15, 12, 13, 10}) == 50); assert(func0({0, 1, 2}) == 3); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> > const&): endbr64 mov (%rdi),%rax mov 0x8(%rdi),%rdx xor %r8d,%r8d cmp %rdx,%rax je 1494 <_Z5func0RKSt6vectorIiSaIiEE+0x24> nopl 0x0(%rax,%rax,1) add (%rax),%r8d add $0x4,%rax cmp %rax,%rdx jne 1488 <_Z5func0RKSt6vectorIiSaIiEE+0x18> mov %r8d,%eax retq nopl 0x0(%rax,%rax,1)
_Z5func0RKSt6vectorIiSaIiEE: endbr64 mov rax, [rdi] mov rcx, [rdi+8] xor edx, edx cmp rcx, rax jz short loc_13F3 nop word ptr [rax+rax+00h] loc_13E8: add edx, [rax] add rax, 4 cmp rax, rcx jnz short loc_13E8 loc_13F3: mov eax, edx retn
long long func0(long long a1) { _DWORD *v1; // rax _DWORD *v2; // rcx unsigned int v3; // edx v1 = *(_DWORD **)a1; v2 = *(_DWORD **)(a1 + 8); v3 = 0; if ( v2 != *(_DWORD **)a1 ) { do v3 += *v1++; while ( v1 != v2 ); } return v3; }
func0: ENDBR64 MOV RAX,qword ptr [RDI] MOV RCX,qword ptr [RDI + 0x8] XOR EDX,EDX CMP RCX,RAX JZ 0x001013f3 NOP word ptr [RAX + RAX*0x1] LAB_001013e8: ADD EDX,dword ptr [RAX] ADD RAX,0x4 CMP RAX,RCX JNZ 0x001013e8 LAB_001013f3: MOV EAX,EDX RET
/* func0(std::vector<int, std::allocator<int> > const&) */ int func0(vector *param_1) { int *piVar1; int iVar2; iVar2 = 0; for (piVar1 = *(int **)param_1; *(int **)(param_1 + 8) != piVar1; piVar1 = piVar1 + 1) { iVar2 = iVar2 + *piVar1; } return iVar2; }
3,191
func0
#include <iostream> #include <vector> #include <assert.h>
int func0(const std::vector<int>& arr) { int sum = 0; for (int i : arr) { sum += i; } return sum; }
int main() { assert(func0({1, 2, 3}) == 6); assert(func0({15, 12, 13, 10}) == 50); assert(func0({0, 1, 2}) == 3); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> > const&): endbr64 mov (%rdi),%rdx mov 0x8(%rdi),%rsi cmp %rsi,%rdx je 16e0 <_Z5func0RKSt6vectorIiSaIiEE+0xc0> lea -0x4(%rsi),%rcx mov %rdx,%rax movabs $0x3ffffffffffffffc,%r8 sub %rdx,%rcx shr $0x2,%rcx lea 0x1(%rcx),%rdi test %r8,%rcx je 16e9 <_Z5func0RKSt6vectorIiSaIiEE+0xc9> mov %rdi,%rcx pxor %xmm0,%xmm0 shr $0x2,%rcx shl $0x4,%rcx add %rdx,%rcx nopl 0x0(%rax,%rax,1) movdqu (%rax),%xmm2 add $0x10,%rax paddd %xmm2,%xmm0 cmp %rcx,%rax jne 1670 <_Z5func0RKSt6vectorIiSaIiEE+0x50> movdqa %xmm0,%xmm1 mov %rdi,%rcx psrldq $0x8,%xmm1 and $0xfffffffffffffffc,%rcx paddd %xmm1,%xmm0 lea (%rdx,%rcx,4),%rdx movdqa %xmm0,%xmm1 psrldq $0x4,%xmm1 paddd %xmm1,%xmm0 movd %xmm0,%eax cmp %rcx,%rdi je 16e8 <_Z5func0RKSt6vectorIiSaIiEE+0xc8> lea 0x4(%rdx),%rcx add (%rdx),%eax cmp %rcx,%rsi je 16e2 <_Z5func0RKSt6vectorIiSaIiEE+0xc2> lea 0x8(%rdx),%rcx add 0x4(%rdx),%eax cmp %rcx,%rsi je 16e2 <_Z5func0RKSt6vectorIiSaIiEE+0xc2> lea 0xc(%rdx),%rcx add 0x8(%rdx),%eax cmp %rcx,%rsi je 16e2 <_Z5func0RKSt6vectorIiSaIiEE+0xc2> add 0xc(%rdx),%eax retq nopw %cs:0x0(%rax,%rax,1) xor %eax,%eax retq nopl 0x0(%rax,%rax,1) retq xor %eax,%eax jmp 16af <_Z5func0RKSt6vectorIiSaIiEE+0x8f> nopl (%rax)
_Z5func0RKSt6vectorIiSaIiEE: endbr64 mov rdx, [rdi] mov rdi, [rdi+8] cmp rdi, rdx jz loc_15F0 lea rcx, [rdi-4] mov rax, rdx sub rcx, rdx mov rsi, rcx shr rsi, 2 add rsi, 1 cmp rcx, 8 jbe short loc_15F3 mov rcx, rsi pxor xmm0, xmm0 shr rcx, 2 shl rcx, 4 add rcx, rdx nop dword ptr [rax+00000000h] loc_1598: movdqu xmm2, xmmword ptr [rax] add rax, 10h paddd xmm0, xmm2 cmp rax, rcx jnz short loc_1598 movdqa xmm1, xmm0 psrldq xmm1, 8 paddd xmm0, xmm1 movdqa xmm1, xmm0 psrldq xmm1, 4 paddd xmm0, xmm1 movd eax, xmm0 test sil, 3 jz short locret_15F2 and rsi, 0FFFFFFFFFFFFFFFCh lea rdx, [rdx+rsi*4] loc_15D5: lea rcx, [rdx+4] add eax, [rdx] cmp rdi, rcx jz short locret_15F2 lea rcx, [rdx+8] add eax, [rdx+4] cmp rdi, rcx jz short locret_15F2 add eax, [rdx+8] retn loc_15F0: xor eax, eax locret_15F2: retn loc_15F3: xor eax, eax jmp short loc_15D5
long long func0(const __m128i **a1) { const __m128i *v1; // rdx const __m128i *v2; // rdi const __m128i *v3; // rax unsigned long long v4; // rsi __m128i v5; // xmm0 __m128i v6; // xmm2 __m128i v7; // xmm0 long long result; // rax v1 = *a1; v2 = a1[1]; if ( v2 == v1 ) return 0LL; v3 = v1; v4 = ((unsigned long long)((char *)&v2[-1].m128i_u64[1] + 4 - (char *)v1) >> 2) + 1; if ( (unsigned long long)((char *)&v2[-1].m128i_u64[1] + 4 - (char *)v1) <= 8 ) { LODWORD(result) = 0; } else { v5 = 0LL; do { v6 = _mm_loadu_si128(v3++); v5 = _mm_add_epi32(v5, v6); } while ( v3 != &v1[v4 >> 2] ); v7 = _mm_add_epi32(v5, _mm_srli_si128(v5, 8)); result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v7, _mm_srli_si128(v7, 4))); if ( (v4 & 3) == 0 ) return result; v1 = (const __m128i *)((char *)v1 + 4 * (v4 & 0xFFFFFFFFFFFFFFFCLL)); } result = (unsigned int)(v1->m128i_i32[0] + result); if ( v2 != (const __m128i *)((char *)v1->m128i_i64 + 4) ) { result = (unsigned int)(v1->m128i_i32[1] + result); if ( v2 != (const __m128i *)&v1->m128i_u64[1] ) return (unsigned int)(v1->m128i_i32[2] + result); } return result; }
func0: ENDBR64 MOV RDX,qword ptr [RDI] MOV RDI,qword ptr [RDI + 0x8] CMP RDI,RDX JZ 0x001015f0 LEA RCX,[RDI + -0x4] MOV RAX,RDX SUB RCX,RDX MOV RSI,RCX SHR RSI,0x2 ADD RSI,0x1 CMP RCX,0x8 JBE 0x001015f3 MOV RCX,RSI PXOR XMM0,XMM0 SHR RCX,0x2 SHL RCX,0x4 ADD RCX,RDX NOP dword ptr [RAX] LAB_00101598: MOVDQU XMM2,xmmword ptr [RAX] ADD RAX,0x10 PADDD XMM0,XMM2 CMP RAX,RCX JNZ 0x00101598 MOVDQA XMM1,XMM0 PSRLDQ XMM1,0x8 PADDD XMM0,XMM1 MOVDQA XMM1,XMM0 PSRLDQ XMM1,0x4 PADDD XMM0,XMM1 MOVD EAX,XMM0 TEST SIL,0x3 JZ 0x001015f2 AND RSI,-0x4 LEA RDX,[RDX + RSI*0x4] LAB_001015d5: LEA RCX,[RDX + 0x4] ADD EAX,dword ptr [RDX] CMP RDI,RCX JZ 0x001015f2 LEA RCX,[RDX + 0x8] ADD EAX,dword ptr [RDX + 0x4] CMP RDI,RCX JZ 0x001015f2 ADD EAX,dword ptr [RDX + 0x8] RET LAB_001015f0: XOR EAX,EAX LAB_001015f2: RET LAB_001015f3: XOR EAX,EAX JMP 0x001015d5
/* func0(std::vector<int, std::allocator<int> > const&) */ int func0(vector *param_1) { int *piVar1; int iVar2; int *piVar3; int *piVar4; int *piVar5; int *piVar6; ulong uVar7; int *piVar8; ulong uVar9; int iVar10; int iVar11; int iVar12; int iVar13; piVar8 = *(int **)param_1; piVar1 = *(int **)(param_1 + 8); if (piVar1 == piVar8) { iVar10 = 0; } else { uVar7 = (long)piVar1 + (-4 - (long)piVar8); uVar9 = (uVar7 >> 2) + 1; if (uVar7 < 9) { iVar10 = 0; } else { iVar10 = 0; iVar11 = 0; iVar12 = 0; iVar13 = 0; piVar6 = piVar8; do { iVar2 = *piVar6; piVar3 = piVar6 + 1; piVar4 = piVar6 + 2; piVar5 = piVar6 + 3; piVar6 = piVar6 + 4; iVar10 = iVar10 + iVar2; iVar11 = iVar11 + *piVar3; iVar12 = iVar12 + *piVar4; iVar13 = iVar13 + *piVar5; } while (piVar6 != piVar8 + (uVar9 & 0xfffffffffffffffc)); iVar10 = iVar10 + iVar12 + iVar11 + iVar13; if ((uVar9 & 3) == 0) { return iVar10; } piVar8 = piVar8 + (uVar9 & 0xfffffffffffffffc); } iVar10 = iVar10 + *piVar8; if ((piVar1 != piVar8 + 1) && (iVar10 = iVar10 + piVar8[1], piVar1 != piVar8 + 2)) { return iVar10 + piVar8[2]; } } return iVar10; }
3,192
func0
#include <iostream> #include <assert.h> using namespace std; const int INT_BITS = 32;
int func0(int n, int d) { return (n << d) | (n >> (INT_BITS - d)); }
int main() { assert(func0(16, 2) == 64); assert(func0(10, 2) == 40); assert(func0(99, 3) == 792); return 0; }
O0
cpp
func0(int, int): endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov %esi,-0x8(%rbp) mov -0x8(%rbp),%eax mov -0x4(%rbp),%edx mov %edx,%esi mov %eax,%ecx shl %cl,%esi mov $0x20,%eax sub -0x8(%rbp),%eax mov -0x4(%rbp),%edx mov %eax,%ecx sar %cl,%edx mov %edx,%eax or %esi,%eax pop %rbp retq
_Z5func0ii: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov [rbp+var_8], esi mov eax, [rbp+var_8] mov edx, [rbp+var_4] mov esi, edx mov ecx, eax shl esi, cl mov eax, 20h ; ' ' sub eax, [rbp+var_8] mov edx, [rbp+var_4] mov ecx, eax sar edx, cl mov eax, edx or eax, esi pop rbp retn
long long func0(int a1, char a2) { return (a1 << a2) | (unsigned int)(a1 >> (32 - a2)); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV dword ptr [RBP + -0x8],ESI MOV EAX,dword ptr [RBP + -0x8] MOV EDX,dword ptr [RBP + -0x4] MOV ESI,EDX MOV ECX,EAX SHL ESI,CL MOV EAX,0x20 SUB EAX,dword ptr [RBP + -0x8] MOV EDX,dword ptr [RBP + -0x4] MOV ECX,EAX SAR EDX,CL MOV EAX,EDX OR EAX,ESI POP RBP RET
/* func0(int, int) */ uint func0(int param_1,int param_2) { return param_1 >> (0x20 - (byte)param_2 & 0x1f) | param_1 << ((byte)param_2 & 0x1f); }
3,193
func0
#include <iostream> #include <assert.h> using namespace std; const int INT_BITS = 32;
int func0(int n, int d) { return (n << d) | (n >> (INT_BITS - d)); }
int main() { assert(func0(16, 2) == 64); assert(func0(10, 2) == 40); assert(func0(99, 3) == 792); return 0; }
O1
cpp
func0(int, int): endbr64 mov $0x20,%ecx sub %esi,%ecx mov %edi,%eax sar %cl,%eax mov %esi,%ecx shl %cl,%edi or %edi,%eax retq
_Z5func0ii: endbr64 mov ecx, 20h ; ' ' sub ecx, esi mov eax, edi sar eax, cl mov ecx, esi shl edi, cl or eax, edi retn
long long func0(int a1, char a2) { return (a1 << a2) | (unsigned int)(a1 >> (32 - a2)); }
func0: ENDBR64 MOV ECX,0x20 SUB ECX,ESI MOV EAX,EDI SAR EAX,CL MOV ECX,ESI SHL EDI,CL OR EAX,EDI RET
/* func0(int, int) */ uint func0(int param_1,int param_2) { return param_1 >> (0x20 - (byte)param_2 & 0x1f) | param_1 << ((byte)param_2 & 0x1f); }
3,194
func0
#include <iostream> #include <assert.h> using namespace std; const int INT_BITS = 32;
int func0(int n, int d) { return (n << d) | (n >> (INT_BITS - d)); }
int main() { assert(func0(16, 2) == 64); assert(func0(10, 2) == 40); assert(func0(99, 3) == 792); return 0; }
O2
cpp
func0(int, int): endbr64 mov $0x20,%ecx mov %edi,%eax sub %esi,%ecx sar %cl,%eax mov %esi,%ecx shl %cl,%edi or %edi,%eax retq nopw %cs:0x0(%rax,%rax,1)
_Z5func0ii: endbr64 mov ecx, 20h ; ' ' mov eax, edi sub ecx, esi sar eax, cl mov ecx, esi shl edi, cl or eax, edi retn
long long func0(int a1, char a2) { return (a1 << a2) | (unsigned int)(a1 >> (32 - a2)); }
func0: ENDBR64 MOV ECX,0x20 MOV EAX,EDI SUB ECX,ESI SAR EAX,CL MOV ECX,ESI SHL EDI,CL OR EAX,EDI RET
/* func0(int, int) */ uint func0(int param_1,int param_2) { return param_1 >> (0x20 - (byte)param_2 & 0x1f) | param_1 << ((byte)param_2 & 0x1f); }
3,195
func0
#include <iostream> #include <assert.h> using namespace std; const int INT_BITS = 32;
int func0(int n, int d) { return (n << d) | (n >> (INT_BITS - d)); }
int main() { assert(func0(16, 2) == 64); assert(func0(10, 2) == 40); assert(func0(99, 3) == 792); return 0; }
O3
cpp
func0(int, int): endbr64 mov $0x20,%ecx mov %edi,%eax sub %esi,%ecx sar %cl,%eax mov %esi,%ecx shl %cl,%edi or %edi,%eax retq nopw %cs:0x0(%rax,%rax,1)
_Z5func0ii: endbr64 mov ecx, 20h ; ' ' mov eax, edi sub ecx, esi sar eax, cl mov ecx, esi shl edi, cl or eax, edi retn
long long func0(int a1, char a2) { return (a1 << a2) | (unsigned int)(a1 >> (32 - a2)); }
func0: ENDBR64 MOV ECX,0x20 MOV EAX,EDI SUB ECX,ESI SAR EAX,CL MOV ECX,ESI SHL EDI,CL OR EAX,EDI RET
/* func0(int, int) */ uint func0(int param_1,int param_2) { return param_1 >> (0x20 - (byte)param_2 & 0x1f) | param_1 << ((byte)param_2 & 0x1f); }
3,196
func0
#include <iostream> #include <regex> #include <assert.h>
std::string func0(const std::string& text) { std::regex space_regex("\\s+"); return std::regex_replace(text, space_regex, ""); }
int main() { assert(func0("python program") == "pythonprogram"); assert(func0("python programming language") == "pythonprogramminglanguage"); assert(func0("python program") == "pythonprogram"); return 0; }
O0
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x48,%rsp mov %rdi,-0x48(%rbp) mov %rsi,-0x50(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax lea -0x40(%rbp),%rax mov $0x10,%edx lea 0x2d3cc(%rip),%rsi mov %rax,%rdi callq 712c <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEEC1EPKcNSt15regex_constants18syntax_option_typeE> mov -0x48(%rbp),%rax lea -0x40(%rbp),%rdx mov -0x50(%rbp),%rsi mov $0x0,%r8d lea 0x2d3af(%rip),%rcx mov %rax,%rdi callq 71e9 <_ZSt13regex_replaceINSt7__cxx1112regex_traitsIcEEcSt11char_traitsIcESaIcEENS0_12basic_stringIT0_T1_T2_EERKSA_RKNS0_11basic_regexIS7_T_EEPKS7_NSt15regex_constants15match_flag_typeE> lea -0x40(%rbp),%rax mov %rax,%rdi callq 71b6 <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED1Ev> mov -0x18(%rbp),%rax xor %fs:0x28,%rax je 5d28 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x9f> jmp 5d23 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x9a> endbr64 mov %rax,%rbx lea -0x40(%rbp),%rax mov %rax,%rdi callq 71b6 <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 5b00 <_Unwind_Resume@plt> callq 5960 <__stack_chk_fail@plt> mov -0x48(%rbp),%rax add $0x48,%rsp pop %rbx pop %rbp retq
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 48h mov [rbp+var_48], rdi mov [rbp+var_50], rsi mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax lea rax, [rbp+var_40] mov edx, 10h lea rcx, aS; "\\s+" mov rsi, rcx mov rdi, rax call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEEC2EPKcNSt15regex_constants18syntax_option_typeE; std::basic_regex<char,std::regex_traits<char>>::basic_regex(char const*,std::regex_constants::syntax_option_type) mov rax, [rbp+var_48] lea rdx, [rbp+var_40] mov rsi, [rbp+var_50] mov r8d, 0 lea rcx, unk_34055 mov rdi, rax call _ZSt13regex_replaceINSt7__cxx1112regex_traitsIcEEcSt11char_traitsIcESaIcEENS0_12basic_stringIT0_T1_T2_EERKSA_RKNS0_11basic_regexIS7_T_EEPKS7_NSt15regex_constants15match_flag_typeE; std::regex_replace<std::regex_traits<char>,char,std::char_traits<char>,std::allocator<char>>(std::string const&,std::basic_regex<char,std::regex_traits<char>> const&,char const*,std::regex_constants::match_flag_type) nop lea rax, [rbp+var_40] mov rdi, rax call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED2Ev; std::basic_regex<char,std::regex_traits<char>>::~basic_regex() nop mov rax, [rbp+var_18] sub rax, fs:28h jz short loc_4BDF jmp short loc_4BDA endbr64 mov rbx, rax lea rax, [rbp+var_40] mov rdi, rax call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED2Ev; std::basic_regex<char,std::regex_traits<char>>::~basic_regex() mov rax, rbx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_4BD2 call ___stack_chk_fail loc_4BD2: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_4BDA: call ___stack_chk_fail loc_4BDF: mov rax, [rbp+var_48] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, long long a2) { _BYTE v3[40]; // [rsp+10h] [rbp-40h] BYREF unsigned long long v4; // [rsp+38h] [rbp-18h] v4 = __readfsqword(0x28u); std::basic_regex<char,std::regex_traits<char>>::basic_regex(v3, "\\s+", 16LL); std::regex_replace<std::regex_traits<char>,char,std::char_traits<char>,std::allocator<char>>( a1, a2, v3, &unk_34055, 0LL); std::basic_regex<char,std::regex_traits<char>>::~basic_regex(v3); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x48 MOV qword ptr [RBP + -0x48],RDI MOV qword ptr [RBP + -0x50],RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX LEA RAX,[RBP + -0x40] MOV EDX,0x10 LEA RCX,[0x134051] MOV RSI,RCX MOV RDI,RAX LAB_00104b63: CALL 0x00106152 MOV RAX,qword ptr [RBP + -0x48] LEA RDX,[RBP + -0x40] MOV RSI,qword ptr [RBP + -0x50] MOV R8D,0x0 LEA RCX,[0x134055] MOV RDI,RAX LAB_00104b84: CALL 0x00106223 NOP LEA RAX,[RBP + -0x40] MOV RDI,RAX CALL 0x001061f0 NOP MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x00104bdf JMP 0x00104bda LAB_00104bda: CALL 0x00104860 LAB_00104bdf: MOV RAX,qword ptr [RBP + -0x48] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::string const&) */ string * func0(string *param_1) { int8 in_RSI; long in_FS_OFFSET; regex local_48 [40]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); std::regex::basic_regex(local_48,"\\s+",0x10); /* try { // try from 00104b84 to 00104b88 has its CatchHandler @ 00104ba8 */ std::regex_replace<std::regex_traits<char>,char,std::char_traits<char>,std::allocator<char>> (param_1,in_RSI,local_48,&DAT_00134055,0); std::regex::~basic_regex(local_48); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
3,197
func0
#include <iostream> #include <regex> #include <assert.h>
std::string func0(const std::string& text) { std::regex space_regex("\\s+"); return std::regex_replace(text, space_regex, ""); }
int main() { assert(func0("python program") == "pythonprogram"); assert(func0("python programming language") == "pythonprogramminglanguage"); assert(func0("python program") == "pythonprogram"); return 0; }
O1
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 push %r13 push %r12 push %rbp push %rbx sub $0x48,%rsp mov %rdi,%rbx mov %rsi,%rbp mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax lea 0x8(%rsp),%r13 mov %r13,%rdi callq 4730 <_ZNSt6localeC1Ev@plt> movl $0x10,0x10(%rsp) lea 0x18(%rsp),%r12 mov %r13,%rsi mov %r12,%rdi callq 44d0 <_ZNSt6localeC1ERKS_@plt> lea 0x20(%rsp),%rdi mov 0x10(%rsp),%r8d mov %r12,%rcx lea 0x15e2c(%rip),%rdx lea -0x3(%rdx),%rsi callq 19187 <_ZNSt8__detail13__compile_nfaINSt7__cxx1112regex_traitsIcEEPKcEENSt9enable_ifIXsrNS_20__is_contiguous_iterIT0_EE5valueESt10shared_ptrIKNS_4_NFAIT_EEEE4typeES8_S8_RKNSC_11locale_typeENSt15regex_constants18syntax_option_typeE> jmp 48b4 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x8b> endbr64 mov %rax,%rbx lea 0x18(%rsp),%rdi callq 4660 <_ZNSt6localeD1Ev@plt> lea 0x8(%rsp),%rdi callq 4660 <_ZNSt6localeD1Ev@plt> mov %rbx,%rdi callq 46c0 <_Unwind_Resume@plt> lea 0x8(%rsp),%rdi callq 4660 <_ZNSt6localeD1Ev@plt> lea 0x10(%rbx),%r12 mov %r12,(%rbx) movq $0x0,0x8(%rbx) movb $0x0,0x10(%rbx) mov 0x0(%rbp),%rsi mov %rsi,%rdx add 0x8(%rbp),%rdx lea 0x10(%rsp),%rcx mov $0x0,%r9d lea 0x159ab(%rip),%r8 mov %rbx,%rdi callq ee37 <_ZSt13regex_replaceISt20back_insert_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN9__gnu_cxx17__normal_iteratorIPKcS6_EENS1_12regex_traitsIcEEcET_SF_T0_SG_RKNS1_11basic_regexIT2_T1_EEPKSI_NSt15regex_constants15match_flag_typeE> mov 0x28(%rsp),%rbp test %rbp,%rbp je 4919 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xf0> cmpq $0x0,0x1c6c0(%rip) je 4967 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x13e> mov $0xffffffff,%eax lock xadd %eax,0x8(%rbp) cmp $0x1,%eax je 4972 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x149> lea 0x18(%rsp),%rdi callq 4660 <_ZNSt6localeD1Ev@plt> mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 49af <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x186> mov %rbx,%rax add $0x48,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq endbr64 mov %rax,%rbp mov (%rbx),%rdi cmp %rdi,%r12 je 4955 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x12c> callq 4570 <_ZdlPv@plt> lea 0x10(%rsp),%rdi callq 5776 <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED1Ev> mov %rbp,%rdi callq 46c0 <_Unwind_Resume@plt> mov 0x8(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0x8(%rbp) jmp 4914 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xeb> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x10(%rax) cmpq $0x0,0x1c644(%rip) je 49a4 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x17b> mov $0xffffffff,%eax lock xadd %eax,0xc(%rbp) cmp $0x1,%eax jne 4919 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xf0> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x18(%rax) jmpq 4919 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xf0> mov 0xc(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0xc(%rbp) jmp 4990 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x167> callq 45d0 <__stack_chk_fail@plt>
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp push r14 push r12 push rbx sub rsp, 38h mov rbx, rdi mov r14, rsi mov rax, fs:28h mov [rbp+var_28], rax xor eax, eax lea r12, [rbp+var_50] lea rdi, [rbp+var_48]; this call __ZNSt6localeC1Ev; std::locale::locale(void) mov [rbp+var_40], 0 mov [rbp+var_38], 0 mov ecx, 10h lea rdx, aS+3; "" lea rsi, [rdx-3] mov rdi, r12 call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEE10_M_compileEPKcS5_NSt15regex_constants18syntax_option_typeE; std::basic_regex<char,std::regex_traits<char>>::_M_compile(char const*,char const*,std::regex_constants::syntax_option_type) jmp short loc_48A0 endbr64 mov rbx, rax mov rdi, [rbp+var_38] test rdi, rdi jz short loc_487B call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release(void) loc_487B: lea rdi, [rbp+var_48]; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rbp+var_28] sub rax, fs:28h jz short loc_4898 call ___stack_chk_fail loc_4898: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume loc_48A0: lea rax, [rbx+10h] mov [rbx], rax mov qword ptr [rbx+8], 0 mov byte ptr [rbx+10h], 0 mov rsi, [r14] mov rdx, rsi add rdx, [r14+8] lea rcx, [rbp+var_50] sub rsp, 8 push 0 mov r9d, 0 lea r8, asc_19651+7; "" mov rdi, rbx call _ZSt15__regex_replaceISt20back_insert_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN9__gnu_cxx17__normal_iteratorIPKcS6_EENS1_12regex_traitsIcEEcET_SF_T0_SG_RKNS1_11basic_regexIT2_T1_EEPKSI_mNSt15regex_constants15match_flag_typeE; std::__regex_replace<std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::regex_traits<char>,char>(std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::basic_regex<char,std::regex_traits<char>> const&,char const*,ulong,std::regex_constants::match_flag_type) add rsp, 10h mov rax, [rbp+var_38] mov rdi, rax test rax, rax jz short loc_4922 lea rcx, [rax+8] mov rdx, [rax+8] mov rax, 100000001h cmp rdx, rax jz short loc_497C cmp cs:__libc_single_threaded@GLIBC_2_32, 0 jz loc_499F mov eax, [rdi+8] lea edx, [rax-1] mov [rdi+8], edx loc_4919: cmp eax, 1 jz loc_49AD loc_4922: lea rdi, [rbp+var_48]; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rbp+var_28] sub rax, fs:28h jnz short loc_49B7 mov rax, rbx lea rsp, [rbp-18h] pop rbx pop r12 pop r14 pop rbp retn endbr64 mov r14, rax mov rdi, rbx call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv; std::string::_M_dispose(void) lea rdi, [rbp+var_50] call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED2Ev; std::basic_regex<char,std::regex_traits<char>>::~basic_regex() mov rax, [rbp+var_28] sub rax, fs:28h jz short loc_4974 call ___stack_chk_fail loc_4974: mov rdi, r14; struct _Unwind_Exception * call __Unwind_Resume loc_497C: mov r12, rdi mov dword ptr [rdi+8], 0 mov dword ptr [rdi+0Ch], 0 mov rax, [rdi] call qword ptr [rax+10h] mov rdi, r12 mov rax, [r12] call qword ptr [rax+18h] jmp short loc_4922 loc_499F: mov eax, 0FFFFFFFFh lock xadd [rcx], eax jmp loc_4919 loc_49AD: call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE24_M_release_last_use_coldEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(void) jmp loc_4922 loc_49B7: call ___stack_chk_fail
long long func0(long long a1, long long *a2) { long long v4; // rsi _DWORD *v5; // rdi volatile signed __int32 *v6; // rcx long long v7; // rdx signed __int32 v8; // eax _BYTE v10[8]; // [rsp+0h] [rbp-50h] BYREF _BYTE v11[8]; // [rsp+8h] [rbp-48h] BYREF long long v12; // [rsp+10h] [rbp-40h] long long v13; // [rsp+18h] [rbp-38h] unsigned long long v14; // [rsp+28h] [rbp-28h] v14 = __readfsqword(0x28u); std::locale::locale((std::locale *)v11); v12 = 0LL; v13 = 0LL; std::basic_regex<char,std::regex_traits<char>>::_M_compile(v10, "\\s+", "", 16LL); *(_QWORD *)a1 = a1 + 16; *(_QWORD *)(a1 + 8) = 0LL; *(_BYTE *)(a1 + 16) = 0; v4 = *a2; std::__regex_replace<std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::regex_traits<char>,char>( a1, *a2, *((_DWORD *)a2 + 2) + *(_DWORD *)a2, (unsigned int)v10, (unsigned int)"", 0, 0); v5 = (_DWORD *)v13; if ( v13 ) { v6 = (volatile signed __int32 *)(v13 + 8); v7 = *(_QWORD *)(v13 + 8); if ( v7 == 0x100000001LL ) { *(_DWORD *)(v13 + 8) = 0; v5[3] = 0; (*(void ( **)(_DWORD *, long long, long long, volatile signed __int32 *))(*(_QWORD *)v5 + 16LL))( v5, v4, 0x100000001LL, v6); (*(void ( **)(_DWORD *))(*(_QWORD *)v5 + 24LL))(v5); } else { if ( _libc_single_threaded ) { v8 = *(_DWORD *)(v13 + 8); v7 = (unsigned int)(v8 - 1); *(_DWORD *)(v13 + 8) = v7; } else { v8 = _InterlockedExchangeAdd(v6, 0xFFFFFFFF); } if ( v8 == 1 ) std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(v5, v4, v7, v6); } } std::locale::~locale((std::locale *)v11); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R14 PUSH R12 PUSH RBX SUB RSP,0x38 MOV RBX,RDI MOV R14,RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x28],RAX XOR EAX,EAX LEA R12,[RBP + -0x50] LEA RDI,[RBP + -0x48] CALL 0x00104710 MOV qword ptr [RBP + -0x40],0x0 MOV qword ptr [RBP + -0x38],0x0 MOV ECX,0x10 LEA RDX,[0x1196ea] LEA RSI,[RDX + -0x3] MOV RDI,R12 LAB_0010485f: CALL 0x00117714 JMP 0x001048a0 LAB_001048a0: LEA RAX,[RBX + 0x10] MOV qword ptr [RBX],RAX MOV qword ptr [RBX + 0x8],0x0 MOV byte ptr [RBX + 0x10],0x0 MOV RSI,qword ptr [R14] MOV RDX,RSI ADD RDX,qword ptr [R14 + 0x8] LEA RCX,[RBP + -0x50] SUB RSP,0x8 PUSH 0x0 MOV R9D,0x0 LEA R8,[0x119658] MOV RDI,RBX LAB_001048d7: CALL 0x0010edca ADD RSP,0x10 MOV RAX,qword ptr [RBP + -0x38] MOV RDI,RAX TEST RAX,RAX JZ 0x00104922 LEA RCX,[RAX + 0x8] MOV RDX,qword ptr [RAX + 0x8] MOV RAX,0x100000001 CMP RDX,RAX JZ 0x0010497c CMP byte ptr [0x0011f460],0x0 JZ 0x0010499f MOV EAX,dword ptr [RDI + 0x8] LEA EDX,[RAX + -0x1] MOV dword ptr [RDI + 0x8],EDX LAB_00104919: CMP EAX,0x1 JZ 0x001049ad LAB_00104922: LEA RDI,[RBP + -0x48] CALL 0x00104650 MOV RAX,qword ptr [RBP + -0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x001049b7 MOV RAX,RBX LEA RSP,[RBP + -0x18] POP RBX POP R12 POP R14 POP RBP RET LAB_0010497c: MOV R12,RDI MOV dword ptr [RDI + 0x8],0x0 MOV dword ptr [RDI + 0xc],0x0 MOV RAX,qword ptr [RDI] CALL qword ptr [RAX + 0x10] MOV RDI,R12 MOV RAX,qword ptr [R12] CALL qword ptr [RAX + 0x18] JMP 0x00104922 LAB_0010499f: MOV EAX,0xffffffff XADD.LOCK dword ptr [RCX],EAX JMP 0x00104919 LAB_001049ad: CALL 0x0010588a JMP 0x00104922 LAB_001049b7: CALL 0x001045a0
/* func0(std::string const&) */ string * func0(string *param_1) { _Sp_counted_base<(_Lock_policy)2> *p_Var1; _Sp_counted_base<(_Lock_policy)2> *p_Var2; int iVar3; int8 *in_RSI; long in_FS_OFFSET; regex local_58 [8]; int local_50 [8]; int8 local_48; _Sp_counted_base<(_Lock_policy)2> *local_40; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); std::locale::locale(local_50); local_48 = 0; local_40 = (_Sp_counted_base<(_Lock_policy)2> *)0x0; /* try { // try from 0010485f to 00104863 has its CatchHandler @ 00104866 */ std::regex::_M_compile(local_58,"\\s+","",0x10); *(string **)param_1 = param_1 + 0x10; *(int8 *)(param_1 + 8) = 0; param_1[0x10] = (string)0x0; /* try { // try from 001048d7 to 001048db has its CatchHandler @ 00104948 */ std:: __regex_replace<std::back_insert_iterator<std::string>,__normal_iterator<char_const*,std::string>,std::regex_traits<char>,char> ((back_insert_iterator)param_1,(__normal_iterator)*in_RSI, (__normal_iterator)*in_RSI + (int)in_RSI[1],local_58,"",0,0); p_Var2 = local_40; if (local_40 != (_Sp_counted_base<(_Lock_policy)2> *)0x0) { p_Var1 = local_40 + 8; if (*(long *)(local_40 + 8) == 0x100000001) { *(int4 *)(local_40 + 8) = 0; *(int4 *)(local_40 + 0xc) = 0; (**(code **)(*(long *)local_40 + 0x10))(); (**(code **)(*(long *)p_Var2 + 0x18))(p_Var2); } else { if (__libc_single_threaded == '\0') { LOCK(); iVar3 = *(int *)p_Var1; *(int *)p_Var1 = *(int *)p_Var1 + -1; UNLOCK(); } else { iVar3 = *(int *)(local_40 + 8); *(int *)(local_40 + 8) = iVar3 + -1; } if (iVar3 == 1) { std::_Sp_counted_base<(_Lock_policy)2>::_M_release_last_use_cold(local_40); } } } std::locale::~locale(local_50); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,198
func0
#include <iostream> #include <regex> #include <assert.h>
std::string func0(const std::string& text) { std::regex space_regex("\\s+"); return std::regex_replace(text, space_regex, ""); }
int main() { assert(func0("python program") == "pythonprogram"); assert(func0("python programming language") == "pythonprogramminglanguage"); assert(func0("python program") == "pythonprogram"); return 0; }
O2
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 push %r14 push %r13 push %r12 mov %rdi,%r12 push %rbp push %rbx mov %rsi,%rbx sub $0x40,%rsp mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax lea 0x8(%rsp),%rbp lea 0x18(%rsp),%r13 mov %rbp,%rdi callq 4770 <_ZNSt6localeC1Ev@plt> mov %rbp,%rsi mov %r13,%rdi movl $0x10,0x10(%rsp) callq 4500 <_ZNSt6localeC1ERKS_@plt> lea 0x16ae0(%rip),%rdx mov 0x10(%rsp),%r8d mov %r13,%rcx lea 0x20(%rsp),%rdi lea -0x3(%rdx),%rsi callq 1a620 <_ZNSt8__detail13__compile_nfaINSt7__cxx1112regex_traitsIcEEPKcEENSt9enable_ifIXsrNS_20__is_contiguous_iterIT0_EE5valueESt10shared_ptrIKNS_4_NFAIT_EEEE4typeES8_S8_RKNSC_11locale_typeENSt15regex_constants18syntax_option_typeE> mov %rbp,%rdi lea 0x10(%r12),%r14 lea 0x10(%rsp),%rbp callq 46a0 <_ZNSt6localeD1Ev@plt> mov %r14,(%r12) xor %r9d,%r9d mov %rbp,%rcx movb $0x0,0x10(%r12) mov (%rbx),%rsi lea 0x16685(%rip),%r8 mov %r12,%rdi movq $0x0,0x8(%r12) mov 0x8(%rbx),%rdx add %rsi,%rdx callq e770 <_ZSt13regex_replaceISt20back_insert_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN9__gnu_cxx17__normal_iteratorIPKcS6_EENS1_12regex_traitsIcEEcET_SF_T0_SG_RKNS1_11basic_regexIT2_T1_EEPKSI_NSt15regex_constants15match_flag_typeE> mov 0x28(%rsp),%rbp test %rbp,%rbp je 4c58 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x1d37b(%rip),%rbx test %rbx,%rbx je 4c80 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x100> mov $0xffffffff,%eax lock xadd %eax,0x8(%rbp) cmp $0x1,%eax je 4c8e <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x10e> nopl 0x0(%rax) mov %r13,%rdi callq 46a0 <_ZNSt6localeD1Ev@plt> mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 4ccb <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x14b> add $0x40,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq mov 0x8(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0x8(%rbp) cmp $0x1,%eax jne 4c58 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x10(%rax) test %rbx,%rbx je 4cc0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x140> mov $0xffffffff,%eax lock xadd %eax,0xc(%rbp) cmp $0x1,%eax jne 4c58 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x18(%rax) jmp 4c58 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> nopl 0x0(%rax,%rax,1) mov 0xc(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0xc(%rbp) jmp 4ca7 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x127> callq 4610 <__stack_chk_fail@plt> endbr64 mov %rax,%r13 jmpq 47e3 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold> endbr64 mov %rax,%r12 jmpq 4801 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold+0x1e> nopl 0x0(%rax,%rax,1)
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp push r14 mov r14, rsi push r13 lea r13, [rbp+var_50] push r12 lea r12, [rbp+var_48] push rbx mov rbx, rdi mov rdi, r12; this sub rsp, 30h mov rax, fs:28h mov [rbp+var_28], rax xor eax, eax call __ZNSt6localeC1Ev; std::locale::locale(void) lea rdx, aS+3; "" pxor xmm0, xmm0 mov rdi, r13 mov ecx, 10h lea rsi, [rdx-3] movaps [rbp+var_40], xmm0 call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEE10_M_compileEPKcS5_NSt15regex_constants18syntax_option_typeE; std::basic_regex<char,std::regex_traits<char>>::_M_compile(char const*,char const*,std::regex_constants::syntax_option_type) lea rax, [rbx+10h] sub rsp, 8 mov byte ptr [rbx+10h], 0 xor r9d, r9d mov [rbx], rax mov rsi, [r14] lea r8, asc_1A651+7; "" mov rcx, r13 mov qword ptr [rbx+8], 0 mov rdx, [r14+8] mov rdi, rbx; int push 0 add rdx, rsi call _ZSt15__regex_replaceISt20back_insert_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN9__gnu_cxx17__normal_iteratorIPKcS6_EENS1_12regex_traitsIcEEcET_SF_T0_SG_RKNS1_11basic_regexIT2_T1_EEPKSI_mNSt15regex_constants15match_flag_typeE; std::__regex_replace<std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::regex_traits<char>,char>(std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::basic_regex<char,std::regex_traits<char>> const&,char const*,ulong,std::regex_constants::match_flag_type) pop rax mov rax, qword ptr [rbp+var_40+8] pop rdx mov rdi, rax test rax, rax jz short loc_612C mov rdx, [rax+8] lea rcx, [rax+8] mov rax, 100000001h cmp rdx, rax jz short loc_6158 cmp cs:__libc_single_threaded@GLIBC_2_32, 0 jz short loc_6178 mov eax, [rdi+8] lea edx, [rax-1] mov [rdi+8], edx loc_6127: cmp eax, 1 jz short loc_6188 loc_612C: mov rdi, r12; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rbp+var_28] sub rax, fs:28h jnz short loc_618F lea rsp, [rbp-20h] mov rax, rbx pop rbx pop r12 pop r13 pop r14 pop rbp retn loc_6158: mov rax, [rdi] mov r13, rdi mov qword ptr [rdi+8], 0 call qword ptr [rax+10h] mov rax, [r13+0] mov rdi, r13 call qword ptr [rax+18h] jmp short loc_612C loc_6178: mov eax, 0FFFFFFFFh lock xadd [rcx], eax jmp short loc_6127 loc_6188: call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE24_M_release_last_use_coldEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(void) jmp short loc_612C loc_618F: call ___stack_chk_fail endbr64 mov r14, rax jmp _Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE_cold; func0(std::string const&) [clone] endbr64 mov rbx, rax jmp loc_486C
long long func0(long long a1, long long *a2) { long long v3; // rsi long long v4; // rdi long long v5; // rdx volatile signed __int32 *v6; // rcx signed __int32 v7; // eax long long v9; // rax _BYTE v10[8]; // [rsp+0h] [rbp-50h] BYREF _BYTE v11[8]; // [rsp+8h] [rbp-48h] BYREF __int128 v12; // [rsp+10h] [rbp-40h] unsigned long long v13; // [rsp+28h] [rbp-28h] v13 = __readfsqword(0x28u); std::locale::locale((std::locale *)v11); v12 = 0LL; std::basic_regex<char,std::regex_traits<char>>::_M_compile(v10, "\\s+", "", 16LL); *(_BYTE *)(a1 + 16) = 0; *(_QWORD *)a1 = a1 + 16; v3 = *a2; *(_QWORD *)(a1 + 8) = 0LL; std::__regex_replace<std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::regex_traits<char>,char>(a1); v4 = *((_QWORD *)&v12 + 1); if ( *((_QWORD *)&v12 + 1) ) { v5 = *(_QWORD *)(*((_QWORD *)&v12 + 1) + 8LL); v6 = (volatile signed __int32 *)(*((_QWORD *)&v12 + 1) + 8LL); if ( v5 == 0x100000001LL ) { v9 = **((_QWORD **)&v12 + 1); *(_QWORD *)(*((_QWORD *)&v12 + 1) + 8LL) = 0LL; (*(void ( **)(long long, long long, long long, volatile signed __int32 *))(v9 + 16))( v4, v3, 0x100000001LL, v6); (*(void ( **)(long long))(*(_QWORD *)v4 + 24LL))(v4); } else { if ( _libc_single_threaded ) { v7 = *(_DWORD *)(*((_QWORD *)&v12 + 1) + 8LL); v5 = (unsigned int)(v7 - 1); *(_DWORD *)(*((_QWORD *)&v12 + 1) + 8LL) = v5; } else { v7 = _InterlockedExchangeAdd(v6, 0xFFFFFFFF); } if ( v7 == 1 ) std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(v4, v3, v5, v6); } } std::locale::~locale((std::locale *)v11); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R14 MOV R14,RSI PUSH R13 LEA R13,[RBP + -0x50] PUSH R12 LEA R12,[RBP + -0x48] PUSH RBX MOV RBX,RDI MOV RDI,R12 SUB RSP,0x30 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x28],RAX XOR EAX,EAX CALL 0x001046f0 LEA RDX,[0x11a6ea] PXOR XMM0,XMM0 MOV RDI,R13 MOV ECX,0x10 LEA RSI,[RDX + -0x3] MOVAPS xmmword ptr [RBP + -0x40],XMM0 LAB_001060b3: CALL 0x001194c0 LEA RAX,[RBX + 0x10] SUB RSP,0x8 MOV byte ptr [RBX + 0x10],0x0 XOR R9D,R9D MOV qword ptr [RBX],RAX MOV RSI,qword ptr [R14] LEA R8,[0x11a658] MOV RCX,R13 MOV qword ptr [RBX + 0x8],0x0 MOV RDX,qword ptr [R14 + 0x8] MOV RDI,RBX PUSH 0x0 ADD RDX,RSI LAB_001060eb: CALL 0x00112130 POP RAX MOV RAX,qword ptr [RBP + -0x38] POP RDX MOV RDI,RAX TEST RAX,RAX JZ 0x0010612c MOV RDX,qword ptr [RAX + 0x8] LEA RCX,[RAX + 0x8] MOV RAX,0x100000001 CMP RDX,RAX JZ 0x00106158 CMP byte ptr [0x00120460],0x0 JZ 0x00106178 MOV EAX,dword ptr [RDI + 0x8] LEA EDX,[RAX + -0x1] MOV dword ptr [RDI + 0x8],EDX LAB_00106127: CMP EAX,0x1 JZ 0x00106188 LAB_0010612c: MOV RDI,R12 CALL 0x00104640 MOV RAX,qword ptr [RBP + -0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010618f LEA RSP,[RBP + -0x20] MOV RAX,RBX POP RBX POP R12 POP R13 POP R14 POP RBP RET LAB_00106158: MOV RAX,qword ptr [RDI] MOV R13,RDI MOV qword ptr [RDI + 0x8],0x0 CALL qword ptr [RAX + 0x10] MOV RAX,qword ptr [R13] MOV RDI,R13 CALL qword ptr [RAX + 0x18] JMP 0x0010612c LAB_00106178: MOV EAX,0xffffffff XADD.LOCK dword ptr [RCX],EAX JMP 0x00106127 LAB_00106188: CALL 0x001073b0 JMP 0x0010612c LAB_0010618f: CALL 0x001045a0
/* func0(std::string const&) */ string * func0(string *param_1) { _Sp_counted_base<(_Lock_policy)2> *p_Var1; int8 uVar2; int iVar3; int8 *in_RSI; long in_FS_OFFSET; regex local_58 [8]; int local_50 [8]; int local_48 [24]; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); std::locale::locale(local_50); local_48._0_16_ = (int [16])0x0; /* try { // try from 001060b3 to 001060b7 has its CatchHandler @ 001061a0 */ std::regex::_M_compile(local_58,"\\s+","",0x10); param_1[0x10] = (string)0x0; *(string **)param_1 = param_1 + 0x10; uVar2 = *in_RSI; *(int8 *)(param_1 + 8) = 0; /* try { // try from 001060eb to 001060ef has its CatchHandler @ 00106194 */ std:: __regex_replace<std::back_insert_iterator<std::string>,__normal_iterator<char_const*,std::string>,std::regex_traits<char>,char> ((back_insert_iterator)param_1,(__normal_iterator)uVar2, (int)in_RSI[1] + (__normal_iterator)uVar2,local_58,"",0,0); uVar2 = local_48._8_8_; if ((_Sp_counted_base<(_Lock_policy)2> *)local_48._8_8_ != (_Sp_counted_base<(_Lock_policy)2> *)0x0) { p_Var1 = (_Sp_counted_base<(_Lock_policy)2> *)(local_48._8_8_ + 8); if (*(long *)(local_48._8_8_ + 8) == 0x100000001) { *(int8 *)(local_48._8_8_ + 8) = 0; (**(code **)(*(long *)local_48._8_8_ + 0x10))(); (**(code **)(*(long *)uVar2 + 0x18))(uVar2); } else { if (__libc_single_threaded == '\0') { LOCK(); iVar3 = *(int *)p_Var1; *(int *)p_Var1 = *(int *)p_Var1 + -1; UNLOCK(); } else { iVar3 = *(int *)(local_48._8_8_ + 8); *(int *)(local_48._8_8_ + 8) = iVar3 + -1; } if (iVar3 == 1) { std::_Sp_counted_base<(_Lock_policy)2>::_M_release_last_use_cold ((_Sp_counted_base<(_Lock_policy)2> *)local_48._8_8_); } } } std::locale::~locale(local_50); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,199
func0
#include <iostream> #include <regex> #include <assert.h>
std::string func0(const std::string& text) { std::regex space_regex("\\s+"); return std::regex_replace(text, space_regex, ""); }
int main() { assert(func0("python program") == "pythonprogram"); assert(func0("python programming language") == "pythonprogramminglanguage"); assert(func0("python program") == "pythonprogram"); return 0; }
O3
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 push %r14 push %r13 push %r12 mov %rdi,%r12 push %rbp push %rbx mov %rsi,%rbx sub $0x40,%rsp mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax lea 0x8(%rsp),%rbp lea 0x18(%rsp),%r13 mov %rbp,%rdi callq 47b0 <_ZNSt6localeC1Ev@plt> mov %rbp,%rsi mov %r13,%rdi movl $0x10,0x10(%rsp) callq 4530 <_ZNSt6localeC1ERKS_@plt> lea 0x171c8(%rip),%rdx mov 0x10(%rsp),%r8d mov %r13,%rcx lea 0x20(%rsp),%rdi lea -0x3(%rdx),%rsi callq 1ac90 <_ZNSt8__detail13__compile_nfaINSt7__cxx1112regex_traitsIcEEPKcEENSt9enable_ifIXsrNS_20__is_contiguous_iterIT0_EE5valueESt10shared_ptrIKNS_4_NFAIT_EEEE4typeES8_S8_RKNSC_11locale_typeENSt15regex_constants18syntax_option_typeE> mov %rbp,%rdi lea 0x10(%r12),%r14 lea 0x10(%rsp),%rbp callq 46e0 <_ZNSt6localeD1Ev@plt> mov %r14,(%r12) xor %r9d,%r9d mov %rbp,%rcx movb $0x0,0x10(%r12) mov (%rbx),%rsi lea 0x16d35(%rip),%r8 mov %r12,%rdi movq $0x0,0x8(%r12) mov 0x8(%rbx),%rdx add %rsi,%rdx callq 10d00 <_ZSt13regex_replaceISt20back_insert_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN9__gnu_cxx17__normal_iteratorIPKcS6_EENS1_12regex_traitsIcEEcET_SF_T0_SG_RKNS1_11basic_regexIT2_T1_EEPKSI_NSt15regex_constants15match_flag_typeE> mov 0x28(%rsp),%rbp test %rbp,%rbp je 55a8 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x1da3b(%rip),%rbx test %rbx,%rbx je 55d0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x100> mov $0xffffffff,%eax lock xadd %eax,0x8(%rbp) cmp $0x1,%eax je 55de <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x10e> nopl 0x0(%rax) mov %r13,%rdi callq 46e0 <_ZNSt6localeD1Ev@plt> mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 561b <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x14b> add $0x40,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq mov 0x8(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0x8(%rbp) cmp $0x1,%eax jne 55a8 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x10(%rax) test %rbx,%rbx je 5610 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x140> mov $0xffffffff,%eax lock xadd %eax,0xc(%rbp) cmp $0x1,%eax jne 55a8 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x18(%rax) jmp 55a8 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> nopl 0x0(%rax,%rax,1) mov 0xc(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0xc(%rbp) jmp 55f7 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x127> callq 4640 <__stack_chk_fail@plt> endbr64 mov %rax,%r13 jmpq 4836 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold> endbr64 mov %rax,%r12 jmpq 4854 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold+0x1e> nopl 0x0(%rax,%rax,1)
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp push r15 push r14 lea r14, [rbp+var_E0] push r13 push r12 mov r12, rsi push rbx mov rbx, rdi sub rsp, 108h mov rax, fs:28h mov [rbp+var_38], rax xor eax, eax lea rax, [rbp+var_D8] mov [rbp+var_130], r14 mov rdi, rax; this mov [rbp+var_128], rax call __ZNSt6localeC1Ev; std::locale::locale(void) lea rdx, aS+3; "" pxor xmm0, xmm0 mov rdi, r14 mov ecx, 10h lea rsi, [rdx-3] movaps xmmword ptr [rbp-0D0h], xmm0 call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEE10_M_compileEPKcS5_NSt15regex_constants18syntax_option_typeE; std::basic_regex<char,std::regex_traits<char>>::_M_compile(char const*,char const*,std::regex_constants::syntax_option_type) lea rax, [rbx+10h] mov byte ptr [rbx+10h], 0 sub rsp, 8 xor r9d, r9d mov [rbx], rax mov rcx, [rbp+var_130] xor r8d, r8d mov [rbp+var_100], rax mov rax, [r12] mov qword ptr [rbx+8], 0 mov r13, [r12+8] movq xmm0, rax mov r15, rax mov [rbp+var_B0], rcx mov [rbp+var_A8], 0 lea r12, [rax+r13] lea rax, [rbp+var_A0] movq xmm1, r12 mov [rbp+var_120], rax mov rdx, rax punpcklqdq xmm0, xmm1 movaps [rbp+var_C0], xmm0 movq rdi, xmm0 pxor xmm0, xmm0 mov rsi, qword ptr [rbp+var_C0+8] movaps [rbp+var_A0], xmm0 movaps [rbp+var_90], xmm0 push 0 call _ZNSt8__detail17__regex_algo_implIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEEcNS5_12regex_traitsIcEEEEbT_SH_RNS5_13match_resultsISH_T0_EERKNS5_11basic_regexIT1_T2_EENSt15regex_constants15match_flag_typeENS_20_RegexExecutorPolicyEb; std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>(__gnu_cxx::__normal_iterator<char const*,std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::match_results<__gnu_cxx::__normal_iterator<char const*,std::string>> &,std::basic_regex<char,std::regex_traits<char>> const&,std::regex_constants::match_flag_type,std::__detail::_RegexExecutorPolicy,bool) pop r8 pop r9 test al, al jz loc_65D3 loc_6217: lea rax, [rbp+var_C0] pxor xmm0, xmm0 lea rsi, [rbp+var_80] mov qword ptr [rbp+var_70], 0 mov rdi, rax mov dword ptr [rbp+var_70+8], 0 mov [rbp+var_118], rsi mov [rbp+var_110], rax movaps [rbp+var_80], xmm0 movaps [rbp+var_60], xmm0 movaps [rbp+var_50], xmm0 call _ZNKSt7__cxx1114regex_iteratorIN9__gnu_cxx17__normal_iteratorIPKcNS_12basic_stringIcSt11char_traitsIcESaIcEEEEEcNS_12regex_traitsIcEEEeqERKSD_; std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>>::operator==(std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>> const&) test al, al jz loc_6312 test r13, r13 jle short loc_6283 nop dword ptr [rax+00h] loc_6268: movsx esi, byte ptr [r15] mov rdi, rbx mov r14, r15 call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc; std::string::push_back(char) add r14, 1 mov r15, r14 cmp r12, r14 jnz short loc_6268 loc_6283: lea rdi, [rbp+var_60] call _ZNSt6vectorINSt7__cxx119sub_matchIN9__gnu_cxx17__normal_iteratorIPKcNS0_12basic_stringIcSt11char_traitsIcESaIcEEEEEEESaISC_EED2Ev; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector() mov rdi, [rbp+var_120] call _ZNSt6vectorINSt7__cxx119sub_matchIN9__gnu_cxx17__normal_iteratorIPKcNS0_12basic_stringIcSt11char_traitsIcESaIcEEEEEEESaISC_EED2Ev; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector() mov rax, [rbp+var_C8] mov rdi, rax test rax, rax jz short loc_62E1 mov rcx, [rax+8] lea rdx, [rax+8] mov rax, 100000001h cmp rcx, rax jz loc_6641 cmp cs:__libc_single_threaded@GLIBC_2_32, 0 jz loc_6660 mov eax, [rdi+8] lea edx, [rax-1] mov [rdi+8], edx loc_62D8: cmp eax, 1 jz loc_666E loc_62E1: mov rdi, [rbp+var_128]; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rbp+var_38] sub rax, fs:28h jnz loc_6678 lea rsp, [rbp-28h] mov rax, rbx pop rbx pop r12 pop r13 pop r14 pop r15 pop rbp retn loc_6312: lea rdi, [rbp+var_F0] xor r13d, r13d xor r15d, r15d mov [rbp+var_108], rdi test al, al jnz loc_6508 xchg ax, ax loc_6330: mov rdx, qword ptr [rbp+var_A0] mov rax, qword ptr [rbp+var_A0+8] sub rax, rdx lea rcx, [rdx+rax-30h] cmp rax, 49h ; 'I' lea rdx, [rdx+rax-48h] mov rax, rcx cmovb rax, rdx mov r15, [rax+8] mov r12, [rax] mov rax, r15 sub rax, r12 test rax, rax jg short loc_6390 jmp short loc_63DB loc_6370: mov rcx, [rbp+var_F8] add r12, 1 mov [rax+rcx], r14b mov rax, [rbx] mov [rbx+8], r13 mov byte ptr [rax+rcx+1], 0 cmp r15, r12 jz short loc_63DB loc_6390: mov rax, [rbx+8] movzx r14d, byte ptr [r12] mov [rbp+var_F8], rax lea r13, [rax+1] mov rax, [rbx] cmp [rbp+var_100], rax jz loc_6540 mov rdx, [rbx+10h] loc_63B8: cmp rdx, r13 jnb short loc_6370 mov rsi, [rbp+var_F8] xor ecx, ecx xor edx, edx mov rdi, rbx mov r8d, 1 call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEmmPKcm; std::string::_M_mutate(ulong,ulong,char const*,ulong) mov rax, [rbx] jmp short loc_6370 loc_63DB: mov r15, [rbp+var_108] mov rdi, r15; this call __ZNSt6localeC1Ev; std::locale::locale(void) lea rax, [rbp+var_E8] mov rsi, r15; std::locale * mov rdi, rax; this mov r14, rax call __ZNSt6localeC1ERKS_; std::locale::locale(std::locale const&) lea rdi, _ZNSt5ctypeIcE2idE@GLIBCXX_3_4; this call __ZNKSt6locale2id5_M_idEv; std::locale::id::_M_id(void) mov rdx, rax mov rax, [rbp+var_E8] mov rax, [rax+8] cmp qword ptr [rax+rdx*8], 0 jz loc_667D mov rdi, r14; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rdi, [rbp+var_108]; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rsi, qword ptr [rbp+var_A0+8] mov rax, qword ptr [rbp+var_A0] mov rcx, rsi sub rcx, rax cmp rcx, 48h ; 'H' jbe loc_6550 lea rdx, [rax+rcx-18h] cmp rsi, rax mov r15, [rdx] mov r13, [rdx+8] lea rdx, [rsi+rcx-48h] cmovnz rdx, rax loc_646E: cmp byte ptr [rdx+10h], 0 jz short loc_64ED cmp rsi, rax jz loc_65C9 loc_647D: mov r12, [rax+8] mov rdi, r12 cmp r12, [rax] jz loc_657E loc_648D: mov r8d, [rbp+var_A8] sub rsp, 8 mov rcx, [rbp+var_B0] xor r9d, r9d mov rdx, [rbp+var_120] mov rsi, qword ptr [rbp+var_C0+8] or r8b, 80h mov [rbp+var_A8], r8d push 0 call _ZNSt8__detail17__regex_algo_implIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEEcNS5_12regex_traitsIcEEEEbT_SH_RNS5_13match_resultsISH_T0_EERKNS5_11basic_regexIT1_T2_EENSt15regex_constants15match_flag_typeENS_20_RegexExecutorPolicyEb; std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>(__gnu_cxx::__normal_iterator<char const*,std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::match_results<__gnu_cxx::__normal_iterator<char const*,std::string>> &,std::basic_regex<char,std::regex_traits<char>> const&,std::regex_constants::match_flag_type,std::__detail::_RegexExecutorPolicy,bool) pop rdx pop rcx test al, al jz loc_656E loc_64CC: mov rax, qword ptr [rbp+var_A0+8] cmp [rax-28h], r12 mov [rax-30h], r12 setnz byte ptr [rax-20h] mov rax, qword ptr [rbp+var_C0] mov qword ptr [rbp+var_90+8], rax loc_64ED: mov rsi, [rbp+var_118] mov rdi, [rbp+var_110] call _ZNKSt7__cxx1114regex_iteratorIN9__gnu_cxx17__normal_iteratorIPKcNS_12basic_stringIcSt11char_traitsIcESaIcEEEEEcNS_12regex_traitsIcEEEeqERKSD_; std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>>::operator==(std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>> const&) test al, al jz loc_6330 loc_6508: mov rax, r13 sub rax, r15 test rax, rax jle loc_6283 nop word ptr [rax+rax+00000000h] loc_6520: movsx esi, byte ptr [r15] mov rdi, rbx call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc; std::string::push_back(char) add r15, 1 cmp r13, r15 jnz short loc_6520 jmp loc_6283 loc_6540: mov edx, 0Fh jmp loc_63B8 loc_6550: lea rdx, [rax+rcx-48h] mov r15, [rdx] mov r13, [rdx+8] jz loc_646E cmp rsi, rax cmovnz rdx, rax jmp loc_646E loc_656E: mov [rbp+var_B0], 0 jmp loc_64ED loc_657E: cmp r12, qword ptr [rbp+var_C0+8] jz short loc_656E sub rsp, 8 mov r8d, [rbp+var_A8] mov rcx, [rbp+var_B0] xor r9d, r9d mov rdx, [rbp+var_120] mov rsi, qword ptr [rbp+var_C0+8] push 0 or r8d, 60h call _ZNSt8__detail17__regex_algo_implIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEEcNS5_12regex_traitsIcEEEEbT_SH_RNS5_13match_resultsISH_T0_EERKNS5_11basic_regexIT1_T2_EENSt15regex_constants15match_flag_typeENS_20_RegexExecutorPolicyEb; std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>(__gnu_cxx::__normal_iterator<char const*,std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::match_results<__gnu_cxx::__normal_iterator<char const*,std::string>> &,std::basic_regex<char,std::regex_traits<char>> const&,std::regex_constants::match_flag_type,std::__detail::_RegexExecutorPolicy,bool) pop rsi pop rdi lea rdi, [r12+1] test al, al jz loc_648D jmp loc_64CC loc_65C9: lea rax, [rax+rcx-48h] jmp loc_647D loc_65D3: pxor xmm0, xmm0 lea r14, [rbp+var_60] mov rdi, [rbp+var_120] mov qword ptr [rbp+var_C0], 0 movaps [rbp+var_70], xmm0 mov rsi, r14 pxor xmm0, xmm0 mov qword ptr [rbp+var_C0+8], 0 mov [rbp+var_B0], 0 mov [rbp+var_A8], 0 movaps [rbp+var_80], xmm0 movaps [rbp+var_60], xmm0 movaps [rbp+var_50], xmm0 call _ZNSt6vectorINSt7__cxx119sub_matchIN9__gnu_cxx17__normal_iteratorIPKcNS0_12basic_stringIcSt11char_traitsIcESaIcEEEEEEESaISC_EEaSERKSE__isra_0; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::operator=(std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>> const&) [clone] mov rax, qword ptr [rbp+var_50+8] mov rdi, r14 mov qword ptr [rbp+var_90+8], rax call _ZNSt6vectorINSt7__cxx119sub_matchIN9__gnu_cxx17__normal_iteratorIPKcNS0_12basic_stringIcSt11char_traitsIcESaIcEEEEEEESaISC_EED2Ev; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector() jmp loc_6217 loc_6641: mov rax, [rdi] mov r15, rdi mov qword ptr [rdi+8], 0 call qword ptr [rax+10h] mov rax, [r15] mov rdi, r15 call qword ptr [rax+18h] jmp loc_62E1 loc_6660: mov eax, 0FFFFFFFFh lock xadd [rdx], eax jmp loc_62D8 loc_666E: call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE24_M_release_last_use_coldEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(void) jmp loc_62E1 loc_6678: call ___stack_chk_fail loc_667D: mov rax, [rbp+var_38] sub rax, fs:28h jnz short loc_6691 call __ZSt16__throw_bad_castv; std::__throw_bad_cast(void) loc_6691: call ___stack_chk_fail endbr64 mov r12, rax jmp _Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE_cold; func0(std::string const&) [clone] endbr64 mov r14, rax jmp loc_488C endbr64 mov r15, rax jmp loc_48C8 endbr64 mov r14, rax jmp loc_4883 endbr64 mov rbx, rax jmp loc_48D5
_QWORD * func0(_QWORD *a1, char **a2) { char *v3; // rax long long v4; // r13 char *v5; // r15 char *v6; // r12 char v7; // al long long v8; // rdx long long v9; // rcx long long v10; // r8 long long v11; // r9 unsigned long long v12; // rsi long long v13; // rdi volatile signed __int32 *v14; // rdx signed __int32 v15; // eax long long v17; // rax char *v18; // r15 char *v19; // r12 long long v20; // rax char v21; // r14 unsigned long long v22; // r13 long long v23; // rax unsigned long long v24; // rdx long long v25; // rax long long v26; // r8 long long v27; // r9 _QWORD *v28; // rax long long v29; // rcx char *v30; // r15 char *v31; // r13 long long v32; // rdx long long v33; // r12 int v34; // edi int v35; // r8d char v36; // al long long v37; // rax bool v38; // zf long long v39; // rax long long v40; // [rsp-10h] [rbp-140h] long long v41; // [rsp-10h] [rbp-140h] long long v42; // [rsp-8h] [rbp-138h] _QWORD *v43; // [rsp+30h] [rbp-100h] long long v44; // [rsp+38h] [rbp-F8h] char v45[8]; // [rsp+40h] [rbp-F0h] BYREF long long v46; // [rsp+48h] [rbp-E8h] BYREF char v47[8]; // [rsp+50h] [rbp-E0h] BYREF char v48[8]; // [rsp+58h] [rbp-D8h] BYREF __int128 v49; // [rsp+60h] [rbp-D0h] __m128i v50; // [rsp+70h] [rbp-C0h] BYREF char *v51; // [rsp+80h] [rbp-B0h] int v52; // [rsp+88h] [rbp-A8h] __int128 v53; // [rsp+90h] [rbp-A0h] BYREF __int128 v54; // [rsp+A0h] [rbp-90h] __int128 v55; // [rsp+B0h] [rbp-80h] BYREF __int128 v56; // [rsp+C0h] [rbp-70h] __int128 v57; // [rsp+D0h] [rbp-60h] BYREF __int128 v58; // [rsp+E0h] [rbp-50h] unsigned long long v59; // [rsp+F8h] [rbp-38h] v59 = __readfsqword(0x28u); std::locale::locale((std::locale *)v48); v49 = 0LL; std::basic_regex<char,std::regex_traits<char>>::_M_compile(v47, "\\s+", "", 16LL); *((_BYTE *)a1 + 16) = 0; *a1 = a1 + 2; v43 = a1 + 2; v3 = *a2; a1[1] = 0LL; v4 = (long long)a2[1]; v5 = v3; v51 = v47; v52 = 0; v6 = &v3[v4]; v50 = _mm_unpacklo_epi64((__m128i)(unsigned long long)v3, (__m128i)(unsigned long long)&v3[v4]); v53 = 0LL; v54 = 0LL; v7 = std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>( v50.m128i_i32[0], v50.m128i_i32[2], (unsigned int)&v53, (unsigned int)v47, 0, 0, 0); v10 = v40; v11 = v42; if ( !v7 ) { v50 = 0uLL; v56 = 0LL; v51 = 0LL; v52 = 0; v55 = 0LL; v57 = 0LL; v58 = 0LL; ((void ( *)(__int128 *, __int128 *, long long, long long, long long))std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::operator=)( &v53, &v57, v8, v9, v40); *((_QWORD *)&v54 + 1) = *((_QWORD *)&v58 + 1); std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v57); } v12 = (unsigned long long)&v55; *(_QWORD *)&v56 = 0LL; DWORD2(v56) = 0; v55 = 0LL; v57 = 0LL; v58 = 0LL; if ( (unsigned __int8)std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>>::operator==( &v50, &v55, v8, v9, v10, v11) ) { if ( v4 > 0 ) { do { v12 = (unsigned int)*v5; std::string::push_back(a1, v12); ++v5; } while ( v6 != v5 ); } goto LABEL_6; } do { v17 = *((_QWORD *)&v53 + 1) - 48LL; if ( *((_QWORD *)&v53 + 1) - (_QWORD)v53 < 0x49uLL ) v17 = *((_QWORD *)&v53 + 1) - 72LL; v18 = *(char **)(v17 + 8); v19 = *(char **)v17; if ( (long long)&v18[-*(_QWORD *)v17] > 0 ) { do { v21 = *v19; v44 = a1[1]; v22 = v44 + 1; v23 = *a1; if ( v43 == (_QWORD *)*a1 ) v24 = 15LL; else v24 = a1[2]; if ( v24 < v22 ) { std::string::_M_mutate(a1, v44, 0LL, 0LL, 1LL); v23 = *a1; } ++v19; *(_BYTE *)(v23 + v44) = v21; v20 = *a1; a1[1] = v22; *(_BYTE *)(v20 + v44 + 1) = 0; } while ( v18 != v19 ); } std::locale::locale((std::locale *)v45); std::locale::locale((std::locale *)&v46, (const std::locale *)v45); v25 = std::locale::id::_M_id((std::locale::id *)&std::ctype<char>::id); if ( !*(_QWORD *)(*(_QWORD *)(v46 + 8) + 8 * v25) ) std::__throw_bad_cast(); std::locale::~locale((std::locale *)&v46); std::locale::~locale((std::locale *)v45); v28 = (_QWORD *)v53; v29 = *((_QWORD *)&v53 + 1) - v53; if ( *((_QWORD *)&v53 + 1) - (_QWORD)v53 <= 0x48uLL ) { v32 = *((_QWORD *)&v53 + 1) - 72LL; v30 = *(char **)(*((_QWORD *)&v53 + 1) - 72LL); v31 = *(char **)(*((_QWORD *)&v53 + 1) - 72LL + 8); if ( *((_QWORD *)&v53 + 1) - (_QWORD)v53 != 72LL && *((_QWORD *)&v53 + 1) != (_QWORD)v53 ) v32 = v53; } else { v30 = *(char **)(*((_QWORD *)&v53 + 1) - 24LL); v31 = *(char **)(*((_QWORD *)&v53 + 1) - 24LL + 8); v32 = *((_QWORD *)&v53 + 1) + v29 - 72; if ( *((_QWORD *)&v53 + 1) != (_QWORD)v53 ) v32 = v53; } if ( *(_BYTE *)(v32 + 16) ) { if ( *((_QWORD *)&v53 + 1) == (_QWORD)v53 ) v28 = (_QWORD *)(*((_QWORD *)&v53 + 1) - 72LL); v33 = v28[1]; v34 = v33; if ( v33 == *v28 ) { if ( v33 == v50.m128i_i64[1] ) { LABEL_41: v51 = 0LL; goto LABEL_32; } v34 = v33 + 1; if ( (unsigned __int8)std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>( v33, v50.m128i_i32[2], (unsigned int)&v53, (_DWORD)v51, v52 | 0x60u, 0, 0) ) { LABEL_31: v37 = *((_QWORD *)&v53 + 1); v38 = *(_QWORD *)(*((_QWORD *)&v53 + 1) - 40LL) == v33; *(_QWORD *)(*((_QWORD *)&v53 + 1) - 48LL) = v33; *(_BYTE *)(v37 - 32) = !v38; *((_QWORD *)&v54 + 1) = v50.m128i_i64[0]; goto LABEL_32; } } v35 = v52; LOBYTE(v35) = v52 | 0x80; v52 = v35; v36 = std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>( v34, v50.m128i_i32[2], (unsigned int)&v53, (_DWORD)v51, v35, 0, 0); v32 = v41; v29 = v42; if ( v36 ) goto LABEL_31; goto LABEL_41; } LABEL_32: v12 = (unsigned long long)&v55; } while ( !(unsigned __int8)std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>>::operator==( &v50, &v55, v32, v29, v26, v27) ); if ( v31 - v30 > 0 ) { do { v12 = (unsigned int)*v30; std::string::push_back(a1, v12); ++v30; } while ( v31 != v30 ); } LABEL_6: std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v57); std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v53); v13 = *((_QWORD *)&v49 + 1); if ( *((_QWORD *)&v49 + 1) ) { v14 = (volatile signed __int32 *)(*((_QWORD *)&v49 + 1) + 8LL); if ( *(_QWORD *)(*((_QWORD *)&v49 + 1) + 8LL) == 0x100000001LL ) { v39 = **((_QWORD **)&v49 + 1); *(_QWORD *)(*((_QWORD *)&v49 + 1) + 8LL) = 0LL; (*(void ( **)(long long, unsigned long long, volatile signed __int32 *))(v39 + 16))(v13, v12, v14); (*(void ( **)(long long))(*(_QWORD *)v13 + 24LL))(v13); } else { if ( _libc_single_threaded ) { v15 = *(_DWORD *)(*((_QWORD *)&v49 + 1) + 8LL); *(_DWORD *)(*((_QWORD *)&v49 + 1) + 8LL) = v15 - 1; } else { v15 = _InterlockedExchangeAdd(v14, 0xFFFFFFFF); } if ( v15 == 1 ) std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(v13); } } std::locale::~locale((std::locale *)v48); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R15 PUSH R14 LEA R14,[RBP + -0xe0] PUSH R13 PUSH R12 MOV R12,RSI PUSH RBX MOV RBX,RDI SUB RSP,0x108 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x38],RAX XOR EAX,EAX LEA RAX,[RBP + -0xd8] MOV qword ptr [RBP + -0x130],R14 MOV RDI,RAX MOV qword ptr [RBP + -0x128],RAX CALL 0x00104730 LEA RDX,[0x11b72f] PXOR XMM0,XMM0 MOV RDI,R14 MOV ECX,0x10 LEA RSI,[RDX + -0x3] MOVAPS xmmword ptr [RBP + -0xd0],XMM0 LAB_0010616f: CALL 0x00119bf0 LEA RAX,[RBX + 0x10] MOV byte ptr [RBX + 0x10],0x0 SUB RSP,0x8 XOR R9D,R9D MOV qword ptr [RBX],RAX MOV RCX,qword ptr [RBP + -0x130] XOR R8D,R8D MOV qword ptr [RBP + -0x100],RAX MOV RAX,qword ptr [R12] MOV qword ptr [RBX + 0x8],0x0 MOV R13,qword ptr [R12 + 0x8] MOVQ XMM0,RAX MOV R15,RAX MOV qword ptr [RBP + -0xb0],RCX MOV dword ptr [RBP + -0xa8],0x0 LEA R12,[RAX + R13*0x1] LEA RAX,[RBP + -0xa0] MOVQ XMM1,R12 MOV qword ptr [RBP + -0x120],RAX MOV RDX,RAX PUNPCKLQDQ XMM0,XMM1 MOVAPS xmmword ptr [RBP + -0xc0],XMM0 MOVQ RDI,XMM0 PXOR XMM0,XMM0 MOV RSI,qword ptr [RBP + -0xb8] MOVAPS xmmword ptr [RBP + -0xa0],XMM0 MOVAPS xmmword ptr [RBP + -0x90],XMM0 PUSH 0x0 LAB_00106206: CALL 0x00113120 POP R8 POP R9 TEST AL,AL JZ 0x001065d3 LAB_00106217: LEA RAX,[RBP + -0xc0] PXOR XMM0,XMM0 LEA RSI,[RBP + -0x80] MOV qword ptr [RBP + -0x70],0x0 MOV RDI,RAX MOV dword ptr [RBP + -0x68],0x0 MOV qword ptr [RBP + -0x118],RSI MOV qword ptr [RBP + -0x110],RAX MOVAPS xmmword ptr [RBP + -0x80],XMM0 MOVAPS xmmword ptr [RBP + -0x60],XMM0 MOVAPS xmmword ptr [RBP + -0x50],XMM0 CALL 0x00107c90 TEST AL,AL JZ 0x00106312 TEST R13,R13 JLE 0x00106283 NOP dword ptr [RAX] LAB_00106268: MOVSX ESI,byte ptr [R15] MOV RDI,RBX MOV R14,R15 LAB_00106272: CALL 0x00104580 ADD R14,0x1 MOV R15,R14 CMP R12,R14 JNZ 0x00106268 LAB_00106283: LEA RDI,[RBP + -0x60] CALL 0x00107c60 MOV RDI,qword ptr [RBP + -0x120] CALL 0x00107c60 MOV RAX,qword ptr [RBP + -0xc8] MOV RDI,RAX TEST RAX,RAX JZ 0x001062e1 MOV RCX,qword ptr [RAX + 0x8] LEA RDX,[RAX + 0x8] MOV RAX,0x100000001 CMP RCX,RAX JZ 0x00106641 CMP byte ptr [0x00121460],0x0 JZ 0x00106660 MOV EAX,dword ptr [RDI + 0x8] LEA EDX,[RAX + -0x1] MOV dword ptr [RDI + 0x8],EDX LAB_001062d8: CMP EAX,0x1 JZ 0x0010666e LAB_001062e1: MOV RDI,qword ptr [RBP + -0x128] CALL 0x00104680 MOV RAX,qword ptr [RBP + -0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x00106678 LEA RSP,[RBP + -0x28] MOV RAX,RBX POP RBX POP R12 POP R13 POP R14 POP R15 POP RBP RET LAB_00106312: LEA RDI,[RBP + -0xf0] XOR R13D,R13D XOR R15D,R15D MOV qword ptr [RBP + -0x108],RDI TEST AL,AL JNZ 0x00106508 NOP LAB_00106330: MOV RDX,qword ptr [RBP + -0xa0] MOV RAX,qword ptr [RBP + -0x98] SUB RAX,RDX LEA RCX,[RDX + RAX*0x1 + -0x30] CMP RAX,0x49 LEA RDX,[RDX + RAX*0x1 + -0x48] MOV RAX,RCX CMOVC RAX,RDX MOV R15,qword ptr [RAX + 0x8] MOV R12,qword ptr [RAX] MOV RAX,R15 SUB RAX,R12 TEST RAX,RAX JG 0x00106390 JMP 0x001063db LAB_00106370: MOV RCX,qword ptr [RBP + -0xf8] ADD R12,0x1 MOV byte ptr [RAX + RCX*0x1],R14B MOV RAX,qword ptr [RBX] MOV qword ptr [RBX + 0x8],R13 MOV byte ptr [RAX + RCX*0x1 + 0x1],0x0 CMP R15,R12 JZ 0x001063db LAB_00106390: MOV RAX,qword ptr [RBX + 0x8] MOVZX R14D,byte ptr [R12] MOV qword ptr [RBP + -0xf8],RAX LEA R13,[RAX + 0x1] MOV RAX,qword ptr [RBX] CMP qword ptr [RBP + -0x100],RAX JZ 0x00106540 MOV RDX,qword ptr [RBX + 0x10] LAB_001063b8: CMP RDX,R13 JNC 0x00106370 MOV RSI,qword ptr [RBP + -0xf8] XOR ECX,ECX XOR EDX,EDX MOV RDI,RBX MOV R8D,0x1 CALL 0x001046f0 MOV RAX,qword ptr [RBX] JMP 0x00106370 LAB_001063db: MOV R15,qword ptr [RBP + -0x108] MOV RDI,R15 CALL 0x00104730 LEA RAX,[RBP + -0xe8] MOV RSI,R15 MOV RDI,RAX MOV R14,RAX CALL 0x001044f0 LEA RDI,[0x121480] CALL 0x001044a0 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0xe8] MOV RAX,qword ptr [RAX + 0x8] CMP qword ptr [RAX + RDX*0x8],0x0 JZ 0x0010667d MOV RDI,R14 CALL 0x00104680 MOV RDI,qword ptr [RBP + -0x108] CALL 0x00104680 MOV RSI,qword ptr [RBP + -0x98] MOV RAX,qword ptr [RBP + -0xa0] MOV RCX,RSI SUB RCX,RAX CMP RCX,0x48 JBE 0x00106550 LEA RDX,[RAX + RCX*0x1 + -0x18] CMP RSI,RAX MOV R15,qword ptr [RDX] MOV R13,qword ptr [RDX + 0x8] LEA RDX,[RSI + RCX*0x1 + -0x48] CMOVNZ RDX,RAX LAB_0010646e: CMP byte ptr [RDX + 0x10],0x0 JZ 0x001064ed CMP RSI,RAX JZ 0x001065c9 LAB_0010647d: MOV R12,qword ptr [RAX + 0x8] MOV RDI,R12 CMP R12,qword ptr [RAX] JZ 0x0010657e LAB_0010648d: MOV R8D,dword ptr [RBP + -0xa8] SUB RSP,0x8 MOV RCX,qword ptr [RBP + -0xb0] XOR R9D,R9D MOV RDX,qword ptr [RBP + -0x120] MOV RSI,qword ptr [RBP + -0xb8] OR R8B,0x80 MOV dword ptr [RBP + -0xa8],R8D PUSH 0x0 CALL 0x00113120 POP RDX POP RCX TEST AL,AL JZ 0x0010656e LAB_001064cc: MOV RAX,qword ptr [RBP + -0x98] CMP qword ptr [RAX + -0x28],R12 MOV qword ptr [RAX + -0x30],R12 SETNZ byte ptr [RAX + -0x20] MOV RAX,qword ptr [RBP + -0xc0] MOV qword ptr [RBP + -0x88],RAX LAB_001064ed: MOV RSI,qword ptr [RBP + -0x118] MOV RDI,qword ptr [RBP + -0x110] CALL 0x00107c90 TEST AL,AL JZ 0x00106330 LAB_00106508: MOV RAX,R13 SUB RAX,R15 TEST RAX,RAX JLE 0x00106283 NOP word ptr [RAX + RAX*0x1] LAB_00106520: MOVSX ESI,byte ptr [R15] MOV RDI,RBX CALL 0x00104580 ADD R15,0x1 CMP R13,R15 JNZ 0x00106520 JMP 0x00106283 LAB_00106540: MOV EDX,0xf JMP 0x001063b8 LAB_00106550: LEA RDX,[RAX + RCX*0x1 + -0x48] MOV R15,qword ptr [RDX] MOV R13,qword ptr [RDX + 0x8] JZ 0x0010646e CMP RSI,RAX CMOVNZ RDX,RAX JMP 0x0010646e LAB_0010656e: MOV qword ptr [RBP + -0xb0],0x0 JMP 0x001064ed LAB_0010657e: CMP R12,qword ptr [RBP + -0xb8] JZ 0x0010656e SUB RSP,0x8 MOV R8D,dword ptr [RBP + -0xa8] MOV RCX,qword ptr [RBP + -0xb0] XOR R9D,R9D MOV RDX,qword ptr [RBP + -0x120] MOV RSI,qword ptr [RBP + -0xb8] PUSH 0x0 OR R8D,0x60 CALL 0x00113120 POP RSI POP RDI LEA RDI,[R12 + 0x1] TEST AL,AL JZ 0x0010648d JMP 0x001064cc LAB_001065c9: LEA RAX,[RAX + RCX*0x1 + -0x48] JMP 0x0010647d LAB_001065d3: PXOR XMM0,XMM0 LEA R14,[RBP + -0x60] MOV RDI,qword ptr [RBP + -0x120] MOV qword ptr [RBP + -0xc0],0x0 MOVAPS xmmword ptr [RBP + -0x70],XMM0 MOV RSI,R14 PXOR XMM0,XMM0 MOV qword ptr [RBP + -0xb8],0x0 MOV qword ptr [RBP + -0xb0],0x0 MOV dword ptr [RBP + -0xa8],0x0 MOVAPS xmmword ptr [RBP + -0x80],XMM0 MOVAPS xmmword ptr [RBP + -0x60],XMM0 MOVAPS xmmword ptr [RBP + -0x50],XMM0 LAB_00106624: CALL 0x001050a0 MOV RAX,qword ptr [RBP + -0x48] MOV RDI,R14 MOV qword ptr [RBP + -0x88],RAX CALL 0x00107c60 JMP 0x00106217 LAB_00106641: MOV RAX,qword ptr [RDI] MOV R15,RDI MOV qword ptr [RDI + 0x8],0x0 CALL qword ptr [RAX + 0x10] MOV RAX,qword ptr [R15] MOV RDI,R15 CALL qword ptr [RAX + 0x18] JMP 0x001062e1 LAB_00106660: MOV EAX,0xffffffff XADD.LOCK dword ptr [RDX],EAX JMP 0x001062d8 LAB_0010666e: CALL 0x001078d0 JMP 0x001062e1 LAB_00106678: CALL 0x001045e0 LAB_0010667d: MOV RAX,qword ptr [RBP + -0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x00106691 LAB_0010668c: CALL 0x00104630 LAB_00106691: CALL 0x001045e0
/* func0(std::string const&) */ string * func0(string *param_1) { _Sp_counted_base<(_Lock_policy)2> *p_Var1; string sVar2; string *psVar3; long lVar4; int8 uVar5; bool bVar6; char cVar7; int iVar8; int8 *puVar9; string *psVar10; long lVar11; long *plVar12; ulong uVar13; ulong uVar14; long *in_RSI; long lVar15; string *psVar16; long lVar17; long in_FS_OFFSET; locale local_f8 [2]; long local_f0; regex local_e8 [8]; int local_e0 [8]; int local_d8 [16]; long local_c8; long lStack_c0; regex *local_b8; uint local_b0; int local_a8 [16]; int local_98 [16]; regex_iterator local_88 [16]; int local_78 [16]; vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> local_68 [16]; int local_58 [16]; long local_40; local_78._12_4_ = SUB84(local_78._0_8_,4); local_40 = *(long *)(in_FS_OFFSET + 0x28); std::locale::locale(local_e0); local_d8 = (int [16])0x0; /* try { // try from 0010616f to 00106173 has its CatchHandler @ 001066c6 */ std::regex::_M_compile(local_e8,"\\s+","",0x10); param_1[0x10] = (string)0x0; *(string **)param_1 = param_1 + 0x10; lVar17 = *in_RSI; *(int8 *)(param_1 + 8) = 0; lVar15 = in_RSI[1]; local_b0 = 0; lVar11 = lVar17 + lVar15; local_a8 = (int [16])0x0; local_98 = (int [16])0x0; local_c8 = lVar17; lStack_c0 = lVar11; local_b8 = local_e8; /* try { // try from 00106206 to 0010620a has its CatchHandler @ 001066a2 */ bVar6 = std::__detail:: __regex_algo_impl<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,char,std::regex_traits<char>> ((__normal_iterator)lVar17,(__normal_iterator)lVar11,(match_results *)local_a8, local_e8,0,0,false); if (!bVar6) { local_c8 = 0; local_78 = (int [16])0x0; lStack_c0 = 0; local_b8 = (regex *)0x0; local_b0 = 0; local_88[0] = (regex_iterator)0x0; local_88[1] = (regex_iterator)0x0; local_88[2] = (regex_iterator)0x0; local_88[3] = (regex_iterator)0x0; local_88[4] = (regex_iterator)0x0; local_88[5] = (regex_iterator)0x0; local_88[6] = (regex_iterator)0x0; local_88[7] = (regex_iterator)0x0; local_88[8] = (regex_iterator)0x0; local_88[9] = (regex_iterator)0x0; local_88[10] = (regex_iterator)0x0; local_88[0xb] = (regex_iterator)0x0; local_88[0xc] = (regex_iterator)0x0; local_88[0xd] = (regex_iterator)0x0; local_88[0xe] = (regex_iterator)0x0; local_88[0xf] = (regex_iterator)0x0; local_68[0] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[1] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[2] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[3] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[4] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[5] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[6] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[7] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[8] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[9] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[10] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xb] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xc] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xd] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xe] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xf] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_58 = (int [16])0x0; /* try { // try from 00106624 to 00106628 has its CatchHandler @ 001066ae */ std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::operator=((vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> *)local_a8,(vector *)local_68); local_98._8_8_ = local_58._8_8_; std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::~vector(local_68); } local_78._0_12_ = ZEXT812(0); local_88[0] = (regex_iterator)0x0; local_88[1] = (regex_iterator)0x0; local_88[2] = (regex_iterator)0x0; local_88[3] = (regex_iterator)0x0; local_88[4] = (regex_iterator)0x0; local_88[5] = (regex_iterator)0x0; local_88[6] = (regex_iterator)0x0; local_88[7] = (regex_iterator)0x0; local_88[8] = (regex_iterator)0x0; local_88[9] = (regex_iterator)0x0; local_88[10] = (regex_iterator)0x0; local_88[0xb] = (regex_iterator)0x0; local_88[0xc] = (regex_iterator)0x0; local_88[0xd] = (regex_iterator)0x0; local_88[0xe] = (regex_iterator)0x0; local_88[0xf] = (regex_iterator)0x0; local_68[0] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[1] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[2] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[3] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[4] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[5] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[6] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[7] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[8] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[9] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[10] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xb] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xc] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xd] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xe] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xf] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_58 = (int [16])0x0; cVar7 = std:: regex_iterator<__normal_iterator<char_const*,std::string>,char,std::regex_traits<char>>:: operator==((regex_iterator<__normal_iterator<char_const*,std::string>,char,std::regex_traits<char>> *)&local_c8,local_88); if (cVar7 == '\0') { do { lVar11 = local_a8._0_8_ + -0x30; if ((ulong)(local_a8._8_8_ - local_a8._0_8_) < 0x49) { lVar11 = local_a8._0_8_ + -0x48; } puVar9 = (int8 *)(lVar11 + (local_a8._8_8_ - local_a8._0_8_)); psVar3 = (string *)puVar9[1]; psVar16 = (string *)*puVar9; if (psVar3 != psVar16 && -1 < (long)psVar3 - (long)psVar16) { do { uVar13 = *(ulong *)(param_1 + 8); sVar2 = *psVar16; psVar10 = *(string **)param_1; if (param_1 + 0x10 == psVar10) { uVar14 = 0xf; } else { uVar14 = *(ulong *)(param_1 + 0x10); } if (uVar14 < uVar13 + 1) { std::string::_M_mutate((ulong)param_1,uVar13,(char *)0x0,0); psVar10 = *(string **)param_1; } psVar16 = psVar16 + 1; psVar10[uVar13] = sVar2; *(ulong *)(param_1 + 8) = uVar13 + 1; *(int *)(*(long *)param_1 + 1 + uVar13) = 0; } while (psVar3 != psVar16); } std::locale::locale(local_f8); std::locale::locale(&local_f0,local_f8); lVar11 = std::locale::id::_M_id(); if (*(long *)(*(long *)(local_f0 + 8) + lVar11 * 8) == 0) { if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ /* try { // try from 0010668c to 00106690 has its CatchHandler @ 00106696 */ std::__throw_bad_cast(); } /* WARNING: Subroutine does not return */ __stack_chk_fail(); } std::locale::~locale(&local_f0); std::locale::~locale(local_f8); uVar13 = local_a8._8_8_ - local_a8._0_8_; if (uVar13 < 0x49) { plVar12 = (long *)(local_a8._0_8_ + (uVar13 - 0x48)); lVar11 = *plVar12; lVar17 = plVar12[1]; if ((uVar13 != 0x48) && (local_a8._8_8_ != local_a8._0_8_)) { plVar12 = (long *)local_a8._0_8_; } } else { plVar12 = (long *)(local_a8._0_8_ + (uVar13 - 0x18)); lVar11 = *plVar12; lVar17 = plVar12[1]; plVar12 = (long *)(local_a8._8_8_ + (uVar13 - 0x48)); if (local_a8._8_8_ != local_a8._0_8_) { plVar12 = (long *)local_a8._0_8_; } } if (*(char *)(plVar12 + 2) != '\0') { plVar12 = (long *)local_a8._0_8_; if (local_a8._8_8_ == local_a8._0_8_) { plVar12 = (long *)(local_a8._0_8_ + (uVar13 - 0x48)); } lVar4 = plVar12[1]; lVar15 = lVar4; if (lVar4 == *plVar12) { if (lVar4 == lStack_c0) goto LAB_0010656e; bVar6 = std::__detail:: __regex_algo_impl<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,char,std::regex_traits<char>> ((__normal_iterator)lVar4,(__normal_iterator)lStack_c0, (match_results *)local_a8,local_b8,local_b0 | 0x60,0,false); lVar15 = lVar4 + 1; if (!bVar6) goto LAB_0010648d; } else { LAB_0010648d: local_b0 = local_b0 | 0x80; bVar6 = std::__detail:: __regex_algo_impl<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,char,std::regex_traits<char>> ((__normal_iterator)lVar15,(__normal_iterator)lStack_c0, (match_results *)local_a8,local_b8,local_b0,0,false); if (!bVar6) { LAB_0010656e: local_b8 = (regex *)0x0; goto LAB_001064ed; } } *(long *)(local_a8._8_8_ + -0x30) = lVar4; *(bool *)(local_a8._8_8_ + -0x20) = *(long *)(local_a8._8_8_ + -0x28) != lVar4; local_98._8_8_ = local_c8; } LAB_001064ed: cVar7 = std:: regex_iterator<__normal_iterator<char_const*,std::string>,char,std::regex_traits<char>> ::operator==((regex_iterator<__normal_iterator<char_const*,std::string>,char,std::regex_traits<char>> *)&local_c8,local_88); } while (cVar7 == '\0'); if (lVar17 != lVar11 && -1 < lVar17 - lVar11) { do { std::string::push_back((char)param_1); lVar11 = lVar11 + 1; } while (lVar17 != lVar11); } } else if (0 < lVar15) { do { /* try { // try from 00106272 to 001065b4 has its CatchHandler @ 001066ba */ std::string::push_back((char)param_1); lVar17 = lVar17 + 1; } while (lVar11 != lVar17); } std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::~vector(local_68); std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::~vector((vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> *)local_a8); uVar5 = local_d8._8_8_; if ((_Sp_counted_base<(_Lock_policy)2> *)local_d8._8_8_ != (_Sp_counted_base<(_Lock_policy)2> *)0x0) { p_Var1 = (_Sp_counted_base<(_Lock_policy)2> *)(local_d8._8_8_ + 8); if (*(long *)(local_d8._8_8_ + 8) == 0x100000001) { *(int8 *)(local_d8._8_8_ + 8) = 0; (**(code **)(*(long *)local_d8._8_8_ + 0x10))(); (**(code **)(*(long *)uVar5 + 0x18))(uVar5); } else { if (__libc_single_threaded == '\0') { LOCK(); iVar8 = *(int *)p_Var1; *(int *)p_Var1 = *(int *)p_Var1 + -1; UNLOCK(); } else { iVar8 = *(int *)(local_d8._8_8_ + 8); *(int *)(local_d8._8_8_ + 8) = iVar8 + -1; } if (iVar8 == 1) { std::_Sp_counted_base<(_Lock_policy)2>::_M_release_last_use_cold ((_Sp_counted_base<(_Lock_policy)2> *)local_d8._8_8_); } } } std::locale::~locale(local_e0); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,200
func0
#include <iostream> #include <assert.h>
int func0(int x, int y, int z) { int count[3] = {x, y, z}; int unique = 0; for (int i=0; i<3; i++) { bool is_unique = true; for (int j=0; j<i; j++) { if (count[i] == count[j]) { is_unique = false; break; } } if (is_unique) { unique++; } } if (unique == 3) { return 0; } else { return 4 - unique; } }
int main() { assert(func0(1, 1, 1) == 3); assert(func0(-1, -2, -3) == 0); assert(func0(1, 2, 2) == 2); std::cout << "All test cases passed." << std::endl; return 0; }
O0
cpp
func0(int, int, int): endbr64 push %rbp mov %rsp,%rbp sub $0x40,%rsp mov %edi,-0x34(%rbp) mov %esi,-0x38(%rbp) mov %edx,-0x3c(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax mov -0x34(%rbp),%eax mov %eax,-0x14(%rbp) mov -0x38(%rbp),%eax mov %eax,-0x10(%rbp) mov -0x3c(%rbp),%eax mov %eax,-0xc(%rbp) movl $0x0,-0x20(%rbp) movl $0x0,-0x1c(%rbp) cmpl $0x2,-0x1c(%rbp) jg 1278 <_Z5func0iii+0x8f> movb $0x1,-0x21(%rbp) movl $0x0,-0x18(%rbp) mov -0x18(%rbp),%eax cmp -0x1c(%rbp),%eax jge 1268 <_Z5func0iii+0x7f> mov -0x1c(%rbp),%eax cltq mov -0x14(%rbp,%rax,4),%edx mov -0x18(%rbp),%eax cltq mov -0x14(%rbp,%rax,4),%eax cmp %eax,%edx jne 1262 <_Z5func0iii+0x79> movb $0x0,-0x21(%rbp) jmp 1268 <_Z5func0iii+0x7f> addl $0x1,-0x18(%rbp) jmp 123e <_Z5func0iii+0x55> cmpb $0x0,-0x21(%rbp) je 1272 <_Z5func0iii+0x89> addl $0x1,-0x20(%rbp) addl $0x1,-0x1c(%rbp) jmp 122d <_Z5func0iii+0x44> cmpl $0x3,-0x20(%rbp) jne 1285 <_Z5func0iii+0x9c> mov $0x0,%eax jmp 128d <_Z5func0iii+0xa4> mov $0x4,%eax sub -0x20(%rbp),%eax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 12a1 <_Z5func0iii+0xb8> callq 10e0 <__stack_chk_fail@plt> leaveq retq
_Z5func0iii: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_34], edi mov [rbp+var_38], esi mov [rbp+var_3C], edx mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov eax, [rbp+var_34] mov [rbp+var_14], eax mov eax, [rbp+var_38] mov [rbp+var_10], eax mov eax, [rbp+var_3C] mov [rbp+var_C], eax mov [rbp+var_20], 0 mov [rbp+var_1C], 0 jmp short loc_1232 loc_11EF: mov [rbp+var_21], 1 mov [rbp+var_18], 0 jmp short loc_121C loc_11FC: mov eax, [rbp+var_1C] cdqe mov edx, [rbp+rax*4+var_14] mov eax, [rbp+var_18] cdqe mov eax, [rbp+rax*4+var_14] cmp edx, eax jnz short loc_1218 mov [rbp+var_21], 0 jmp short loc_1224 loc_1218: add [rbp+var_18], 1 loc_121C: mov eax, [rbp+var_18] cmp eax, [rbp+var_1C] jl short loc_11FC loc_1224: cmp [rbp+var_21], 0 jz short loc_122E add [rbp+var_20], 1 loc_122E: add [rbp+var_1C], 1 loc_1232: cmp [rbp+var_1C], 2 jle short loc_11EF cmp [rbp+var_20], 3 jnz short loc_1245 mov eax, 0 jmp short loc_124D loc_1245: mov eax, 4 sub eax, [rbp+var_20] loc_124D: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_1261 call ___stack_chk_fail locret_1261: leave retn
long long func0(int a1, int a2, int a3) { char v4; // [rsp+1Fh] [rbp-21h] int v5; // [rsp+20h] [rbp-20h] int i; // [rsp+24h] [rbp-1Ch] int j; // [rsp+28h] [rbp-18h] _DWORD v8[3]; // [rsp+2Ch] [rbp-14h] unsigned long long v9; // [rsp+38h] [rbp-8h] v9 = __readfsqword(0x28u); v8[0] = a1; v8[1] = a2; v8[2] = a3; v5 = 0; for ( i = 0; i <= 2; ++i ) { v4 = 1; for ( j = 0; j < i; ++j ) { if ( v8[i] == v8[j] ) { v4 = 0; break; } } if ( v4 ) ++v5; } if ( v5 == 3 ) return 0LL; else return (unsigned int)(4 - v5); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV dword ptr [RBP + -0x34],EDI MOV dword ptr [RBP + -0x38],ESI MOV dword ptr [RBP + -0x3c],EDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV EAX,dword ptr [RBP + -0x34] MOV dword ptr [RBP + -0x14],EAX MOV EAX,dword ptr [RBP + -0x38] MOV dword ptr [RBP + -0x10],EAX MOV EAX,dword ptr [RBP + -0x3c] MOV dword ptr [RBP + -0xc],EAX MOV dword ptr [RBP + -0x20],0x0 MOV dword ptr [RBP + -0x1c],0x0 JMP 0x00101232 LAB_001011ef: MOV byte ptr [RBP + -0x21],0x1 MOV dword ptr [RBP + -0x18],0x0 JMP 0x0010121c LAB_001011fc: MOV EAX,dword ptr [RBP + -0x1c] CDQE MOV EDX,dword ptr [RBP + RAX*0x4 + -0x14] MOV EAX,dword ptr [RBP + -0x18] CDQE MOV EAX,dword ptr [RBP + RAX*0x4 + -0x14] CMP EDX,EAX JNZ 0x00101218 MOV byte ptr [RBP + -0x21],0x0 JMP 0x00101224 LAB_00101218: ADD dword ptr [RBP + -0x18],0x1 LAB_0010121c: MOV EAX,dword ptr [RBP + -0x18] CMP EAX,dword ptr [RBP + -0x1c] JL 0x001011fc LAB_00101224: CMP byte ptr [RBP + -0x21],0x0 JZ 0x0010122e ADD dword ptr [RBP + -0x20],0x1 LAB_0010122e: ADD dword ptr [RBP + -0x1c],0x1 LAB_00101232: CMP dword ptr [RBP + -0x1c],0x2 JLE 0x001011ef CMP dword ptr [RBP + -0x20],0x3 JNZ 0x00101245 MOV EAX,0x0 JMP 0x0010124d LAB_00101245: MOV EAX,0x4 SUB EAX,dword ptr [RBP + -0x20] LAB_0010124d: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x00101261 CALL 0x001010b0 LAB_00101261: LEAVE RET
/* func0(int, int, int) */ int func0(int param_1,int param_2,int param_3) { bool bVar1; long in_FS_OFFSET; int local_28; int local_24; int local_20; int local_1c [3]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_1c[0] = param_1; local_1c[1] = param_2; local_1c[2] = param_3; local_28 = 0; local_24 = 0; do { if (2 < local_24) { if (local_28 == 3) { local_28 = 0; } else { local_28 = 4 - local_28; } if (*(long *)(in_FS_OFFSET + 0x28) != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_28; } bVar1 = true; for (local_20 = 0; local_20 < local_24; local_20 = local_20 + 1) { if (local_1c[local_24] == local_1c[local_20]) { bVar1 = false; break; } } if (bVar1) { local_28 = local_28 + 1; } local_24 = local_24 + 1; } while( true ); }
3,201
func0
#include <iostream> #include <assert.h>
int func0(int x, int y, int z) { int count[3] = {x, y, z}; int unique = 0; for (int i=0; i<3; i++) { bool is_unique = true; for (int j=0; j<i; j++) { if (count[i] == count[j]) { is_unique = false; break; } } if (is_unique) { unique++; } } if (unique == 3) { return 0; } else { return 4 - unique; } }
int main() { assert(func0(1, 1, 1) == 3); assert(func0(-1, -2, -3) == 0); assert(func0(1, 2, 2) == 2); std::cout << "All test cases passed." << std::endl; return 0; }
O1
cpp
func0(int, int, int): endbr64 sub $0x28,%rsp mov %fs:0x28,%rax mov %rax,0x18(%rsp) xor %eax,%eax mov %edi,0xc(%rsp) mov %esi,0x10(%rsp) mov %edx,0x14(%rsp) mov $0x0,%edi mov $0x0,%r8d jmp 1251 <_Z5func0iii+0x68> mov $0x4,%eax sub %r8d,%eax cmp $0x3,%r8d mov $0x0,%edx cmove %edx,%eax mov 0x18(%rsp),%rdi xor %fs:0x28,%rdi jne 1274 <_Z5func0iii+0x8b> add $0x28,%rsp retq add $0x1,%r8d add $0x1,%rdi cmp $0x3,%rdi je 121a <_Z5func0iii+0x31> mov %edi,%esi test %edi,%edi jle 1243 <_Z5func0iii+0x5a> mov 0xc(%rsp,%rdi,4),%ecx mov $0x0,%eax lea 0xc(%rsp),%rdx cmp (%rdx,%rax,4),%ecx je 1247 <_Z5func0iii+0x5e> add $0x1,%rax cmp %eax,%esi jg 1265 <_Z5func0iii+0x7c> jmp 1243 <_Z5func0iii+0x5a> callq 10d0 <__stack_chk_fail@plt>
_Z5func0iii: endbr64 sub rsp, 28h mov rax, fs:28h mov [rsp+28h+var_10], rax xor eax, eax mov [rsp+28h+var_1C], edi mov [rsp+28h+var_18], esi mov [rsp+28h+var_14], edx mov ecx, 0 jmp short loc_11DE loc_11D4: add rax, 1 cmp rax, 3 jz short loc_11FC loc_11DE: mov r8d, eax test eax, eax jle short loc_11F7 mov edx, [rsp+rax*4+28h+var_1C] cmp edx, edi jz short loc_11D4 cmp r8d, 1 jle short loc_11F7 cmp edx, esi jz short loc_11D4 loc_11F7: add ecx, 1 jmp short loc_11D4 loc_11FC: mov eax, 4 sub eax, ecx cmp ecx, 3 mov edx, 0 cmovz eax, edx mov rdx, [rsp+28h+var_10] sub rdx, fs:28h jnz short loc_1223 add rsp, 28h retn loc_1223: call ___stack_chk_fail
long long func0(int a1, int a2, int a3) { long long v3; // rax int v4; // ecx int v5; // edx long long result; // rax _DWORD v7[3]; // [rsp+Ch] [rbp-1Ch] unsigned long long v8; // [rsp+18h] [rbp-10h] v8 = __readfsqword(0x28u); v3 = 0LL; v7[0] = a1; v7[1] = a2; v7[2] = a3; v4 = 0; do { if ( (int)v3 <= 0 || (v5 = v7[v3], v5 != a1) && ((int)v3 <= 1 || v5 != a2) ) ++v4; ++v3; } while ( v3 != 3 ); result = (unsigned int)(4 - v4); if ( v4 == 3 ) return 0LL; return result; }
func0: ENDBR64 SUB RSP,0x28 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x18],RAX XOR EAX,EAX MOV dword ptr [RSP + 0xc],EDI MOV dword ptr [RSP + 0x10],ESI MOV dword ptr [RSP + 0x14],EDX MOV ECX,0x0 JMP 0x001011de LAB_001011d4: ADD RAX,0x1 CMP RAX,0x3 JZ 0x001011fc LAB_001011de: MOV R8D,EAX TEST EAX,EAX JLE 0x001011f7 MOV EDX,dword ptr [RSP + RAX*0x4 + 0xc] CMP EDX,EDI JZ 0x001011d4 CMP R8D,0x1 JLE 0x001011f7 CMP EDX,ESI JZ 0x001011d4 LAB_001011f7: ADD ECX,0x1 JMP 0x001011d4 LAB_001011fc: MOV EAX,0x4 SUB EAX,ECX CMP ECX,0x3 MOV EDX,0x0 CMOVZ EAX,EDX MOV RDX,qword ptr [RSP + 0x18] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101223 ADD RSP,0x28 RET LAB_00101223: CALL 0x001010b0
/* func0(int, int, int) */ int func0(int param_1,int param_2,int param_3) { int iVar1; long lVar2; int iVar3; long in_FS_OFFSET; int local_1c [3]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); lVar2 = 0; local_1c[0] = param_1; local_1c[1] = param_2; local_1c[2] = param_3; iVar3 = 0; do { if (((int)lVar2 < 1) || ((local_1c[lVar2] != param_1 && (((int)lVar2 < 2 || (local_1c[lVar2] != param_2)))))) { iVar3 = iVar3 + 1; } lVar2 = lVar2 + 1; } while (lVar2 != 3); iVar1 = 4 - iVar3; if (iVar3 == 3) { iVar1 = 0; } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,202
func0
#include <iostream> #include <assert.h>
int func0(int x, int y, int z) { int count[3] = {x, y, z}; int unique = 0; for (int i=0; i<3; i++) { bool is_unique = true; for (int j=0; j<i; j++) { if (count[i] == count[j]) { is_unique = false; break; } } if (is_unique) { unique++; } } if (unique == 3) { return 0; } else { return 4 - unique; } }
int main() { assert(func0(1, 1, 1) == 3); assert(func0(-1, -2, -3) == 0); assert(func0(1, 2, 2) == 2); std::cout << "All test cases passed." << std::endl; return 0; }
O2
cpp
func0(int, int, int): endbr64 sub $0x28,%rsp xor %r8d,%r8d xor %r10d,%r10d mov %fs:0x28,%rax mov %rax,0x18(%rsp) xor %eax,%eax mov %edi,0xc(%rsp) lea 0xc(%rsp),%r9 mov %esi,0x10(%rsp) mov %edx,0x14(%rsp) test %r8,%r8 je 1548 <_Z5func0iii+0x98> lea -0x1(%r8),%edx mov (%r9,%r8,4),%ecx mov %r9,%rax lea (%r9,%rdx,4),%rsi mov %edi,%edx jmp 150c <_Z5func0iii+0x5c> nopw 0x0(%rax,%rax,1) cmp %rsi,%rax je 1548 <_Z5func0iii+0x98> mov 0x4(%rax),%edx add $0x4,%rax cmp %edx,%ecx jne 1500 <_Z5func0iii+0x50> add $0x1,%r8 cmp $0x3,%r8 jne 14df <_Z5func0iii+0x2f> mov $0x4,%eax mov $0x0,%edx sub %r10d,%eax cmp $0x3,%r10d cmove %edx,%eax mov 0x18(%rsp),%rdi xor %fs:0x28,%rdi jne 1558 <_Z5func0iii+0xa8> add $0x28,%rsp retq nopl 0x0(%rax,%rax,1) add $0x1,%r8 add $0x1,%r10d cmp $0x3,%r8 jne 14df <_Z5func0iii+0x2f> jmp 151a <_Z5func0iii+0x6a> callq 10d0 <__stack_chk_fail@plt> nopl (%rax)
_Z5func0iii: endbr64 sub rsp, 28h mov rax, fs:28h mov [rsp+28h+var_10], rax xor eax, eax mov [rsp+28h+var_1C], edi lea r9, [rsp+28h+var_1C] mov [rsp+28h+var_18], esi mov [rsp+28h+var_14], edx xor edx, edx loc_137B: mov r8d, eax test eax, eax jz short loc_13AC loc_1382: mov ecx, [r9+rax*4] cmp ecx, edi jz short loc_139A cmp r8d, 2 jnz short loc_13E7 cmp ecx, esi setnz cl movzx ecx, cl add edx, ecx loc_139A: cmp rax, 2 jz short loc_13C0 mov eax, 2 mov r8d, eax test eax, eax jnz short loc_1382 loc_13AC: add edx, 1 mov eax, 1 jmp short loc_137B loc_13C0: mov eax, 4 sub eax, edx cmp edx, 3 mov edx, 0 cmovz eax, edx mov rdx, [rsp+28h+var_10] sub rdx, fs:28h jnz short loc_13F1 add rsp, 28h retn loc_13E7: add edx, 1 mov eax, 2 jmp short loc_137B loc_13F1: call ___stack_chk_fail
long long func0(int a1, int a2, int a3) { long long v3; // rax int v4; // edx int v5; // r8d int v6; // ecx long long result; // rax _DWORD v8[3]; // [rsp+Ch] [rbp-1Ch] unsigned long long v9; // [rsp+18h] [rbp-10h] v9 = __readfsqword(0x28u); v3 = 0LL; v8[0] = a1; v8[1] = a2; v8[2] = a3; v4 = 0; LABEL_2: while ( 1 ) { v5 = v3; if ( (_DWORD)v3 ) break; ++v4; v3 = 1LL; } while ( 1 ) { v6 = v8[v3]; if ( v6 != a1 ) { if ( v5 != 2 ) { ++v4; v3 = 2LL; goto LABEL_2; } v4 += v6 != a2; } if ( v3 == 2 ) break; v3 = 2LL; v5 = 2; } result = (unsigned int)(4 - v4); if ( v4 == 3 ) return 0LL; return result; }
func0: ENDBR64 SUB RSP,0x28 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x18],RAX XOR EAX,EAX MOV dword ptr [RSP + 0xc],EDI LEA R9,[RSP + 0xc] MOV dword ptr [RSP + 0x10],ESI MOV dword ptr [RSP + 0x14],EDX XOR EDX,EDX LAB_0010137b: MOV R8D,EAX TEST EAX,EAX JZ 0x001013ac LAB_00101382: MOV ECX,dword ptr [R9 + RAX*0x4] CMP ECX,EDI JZ 0x0010139a CMP R8D,0x2 JNZ 0x001013e7 CMP ECX,ESI SETNZ CL MOVZX ECX,CL ADD EDX,ECX LAB_0010139a: CMP RAX,0x2 JZ 0x001013c0 MOV EAX,0x2 MOV R8D,EAX TEST EAX,EAX JNZ 0x00101382 LAB_001013ac: ADD EDX,0x1 MOV EAX,0x1 JMP 0x0010137b LAB_001013c0: MOV EAX,0x4 SUB EAX,EDX CMP EDX,0x3 MOV EDX,0x0 CMOVZ EAX,EDX MOV RDX,qword ptr [RSP + 0x18] SUB RDX,qword ptr FS:[0x28] JNZ 0x001013f1 ADD RSP,0x28 RET LAB_001013e7: ADD EDX,0x1 MOV EAX,0x2 JMP 0x0010137b LAB_001013f1: CALL 0x001010f0
/* func0(int, int, int) */ int func0(int param_1,int param_2,int param_3) { int iVar1; long lVar2; int iVar3; long in_FS_OFFSET; int local_1c [3]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); lVar2 = 0; local_1c[0] = param_1; local_1c[1] = param_2; local_1c[2] = param_3; iVar3 = 0; LAB_0010137b: while ((int)lVar2 == 0) { iVar3 = iVar3 + 1; lVar2 = 1; } do { if (local_1c[lVar2] != param_1) { if ((int)lVar2 != 2) break; iVar3 = iVar3 + (uint)(local_1c[lVar2] != param_2); } if (lVar2 == 2) { iVar1 = 4 - iVar3; if (iVar3 == 3) { iVar1 = 0; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return iVar1; } lVar2 = 2; } while( true ); iVar3 = iVar3 + 1; lVar2 = 2; goto LAB_0010137b; }
3,203
func0
#include <iostream> #include <assert.h>
int func0(int x, int y, int z) { int count[3] = {x, y, z}; int unique = 0; for (int i=0; i<3; i++) { bool is_unique = true; for (int j=0; j<i; j++) { if (count[i] == count[j]) { is_unique = false; break; } } if (is_unique) { unique++; } } if (unique == 3) { return 0; } else { return 4 - unique; } }
int main() { assert(func0(1, 1, 1) == 3); assert(func0(-1, -2, -3) == 0); assert(func0(1, 2, 2) == 2); std::cout << "All test cases passed." << std::endl; return 0; }
O3
cpp
func0(int, int, int): endbr64 xor %ecx,%ecx cmp %esi,%edi setne %cl add $0x1,%ecx cmp %edx,%edi je 1252 <_Z5func0iii+0x22> cmp %edx,%esi je 1252 <_Z5func0iii+0x22> xor %eax,%eax cmp $0x2,%ecx je 1260 <_Z5func0iii+0x30> mov $0x2,%ecx mov $0x4,%eax sub %ecx,%eax retq nopw 0x0(%rax,%rax,1) retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
_Z5func0iii: endbr64 cmp edi, esi jz short loc_1340 cmp edi, edx jz short loc_1333 xor eax, eax cmp esi, edx jz short loc_1333 retn loc_1333: mov edx, 2 loc_1338: mov eax, 4 sub eax, edx retn loc_1340: cmp edi, edx setnz dl movzx edx, dl add edx, 1 jmp short loc_1338
long long func0(int a1, int a2, int a3) { long long result; // rax int v4; // edx if ( a1 == a2 ) { v4 = (a1 != a3) + 1; return (unsigned int)(4 - v4); } if ( a1 == a3 || (result = 0LL, a2 == a3) ) { v4 = 2; return (unsigned int)(4 - v4); } return result; }
func0: ENDBR64 CMP EDI,ESI JZ 0x00101340 CMP EDI,EDX JZ 0x00101333 XOR EAX,EAX CMP ESI,EDX JZ 0x00101333 RET LAB_00101333: MOV EDX,0x2 LAB_00101338: MOV EAX,0x4 SUB EAX,EDX RET LAB_00101340: CMP EDI,EDX SETNZ DL MOVZX EDX,DL ADD EDX,0x1 JMP 0x00101338
/* func0(int, int, int) */ int func0(int param_1,int param_2,int param_3) { int iVar1; if (param_1 == param_2) { iVar1 = (param_1 != param_3) + 1; } else { if ((param_1 != param_3) && (param_2 != param_3)) { return 0; } iVar1 = 2; } return 4 - iVar1; }
3,204
func0
#include <assert.h>
int func0(int arr[], int n) { for (int i = 1; i < n; i++) { if (arr[i] < arr[i - 1]) { return i; } } return 0; }
int main() { int arr1[] = {3, 2, 1}; int arr2[] = {4, 5, 1, 2, 3}; int arr3[] = {7, 8, 9, 1, 2, 3}; assert(func0(arr1, 3) == 1); assert(func0(arr2, 5) == 2); assert(func0(arr3, 6) == 3); return 0; }
O0
cpp
func0(int*, int): endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jge 11c2 <_Z5func0Pii+0x59> 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 shl $0x2,%rax lea -0x4(%rax),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jge 11bc <_Z5func0Pii+0x53> mov -0x4(%rbp),%eax jmp 11c7 <_Z5func0Pii+0x5e> addl $0x1,-0x4(%rbp) jmp 117f <_Z5func0Pii+0x16> mov $0x0,%eax pop %rbp retq
_Z5func0Pii: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_4], 1 jmp short loc_11BA 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, [rbp+var_4] cdqe shl rax, 2 lea rcx, [rax-4] mov rax, [rbp+var_18] add rax, rcx mov eax, [rax] cmp edx, eax jge short loc_11B6 mov eax, [rbp+var_4] jmp short loc_11C7 loc_11B6: add [rbp+var_4], 1 loc_11BA: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1181 mov eax, 0 loc_11C7: pop rbp retn
long long func0(int *a1, int a2) { int i; // [rsp+18h] [rbp-4h] for ( i = 1; i < a2; ++i ) { if ( a1[i] < a1[i - 1] ) return (unsigned int)i; } return 0LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x4],0x1 JMP 0x001011ba 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,dword ptr [RBP + -0x4] CDQE SHL RAX,0x2 LEA RCX,[RAX + -0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JGE 0x001011b6 MOV EAX,dword ptr [RBP + -0x4] JMP 0x001011c7 LAB_001011b6: ADD dword ptr [RBP + -0x4],0x1 LAB_001011ba: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101181 MOV EAX,0x0 LAB_001011c7: POP RBP RET
/* func0(int*, int) */ int func0(int *param_1,int param_2) { int local_c; local_c = 1; while( true ) { if (param_2 <= local_c) { return 0; } if (param_1[local_c] < param_1[(long)local_c + -1]) break; local_c = local_c + 1; } return local_c; }
3,205
func0
#include <assert.h>
int func0(int arr[], int n) { for (int i = 1; i < n; i++) { if (arr[i] < arr[i - 1]) { return i; } } return 0; }
int main() { int arr1[] = {3, 2, 1}; int arr2[] = {4, 5, 1, 2, 3}; int arr3[] = {7, 8, 9, 1, 2, 3}; assert(func0(arr1, 3) == 1); assert(func0(arr2, 5) == 2); assert(func0(arr3, 6) == 3); return 0; }
O1
cpp
func0(int*, int): endbr64 cmp $0x1,%esi jle 119a <_Z5func0Pii+0x31> lea -0x2(%rsi),%edx add $0x2,%rdx mov $0x1,%eax mov %eax,%ecx mov -0x4(%rdi,%rax,4),%esi cmp %esi,(%rdi,%rax,4) jl 1197 <_Z5func0Pii+0x2e> add $0x1,%rax cmp %rdx,%rax jne 117e <_Z5func0Pii+0x15> mov $0x0,%ecx mov %ecx,%eax retq mov $0x0,%ecx jmp 1197 <_Z5func0Pii+0x2e>
_Z5func0Pii: endbr64 cmp esi, 1 jle short loc_1191 mov esi, esi mov eax, 1 loc_1179: mov edx, [rdi+rax*4-4] cmp [rdi+rax*4], edx jl short locret_1196 add rax, 1 cmp rax, rsi jnz short loc_1179 mov eax, 0 retn loc_1191: mov eax, 0 locret_1196: retn
long long func0(int *a1, int a2) { long long result; // rax if ( a2 <= 1 ) return 0LL; result = 1LL; while ( a1[result] >= a1[result - 1] ) { if ( ++result == a2 ) return 0LL; } return result; }
func0: ENDBR64 CMP ESI,0x1 JLE 0x00101191 MOV ESI,ESI MOV EAX,0x1 LAB_00101179: MOV EDX,dword ptr [RDI + RAX*0x4 + -0x4] CMP dword ptr [RDI + RAX*0x4],EDX JL 0x00101196 ADD RAX,0x1 CMP RAX,RSI JNZ 0x00101179 MOV EAX,0x0 RET LAB_00101191: MOV EAX,0x0 LAB_00101196: RET
/* func0(int*, int) */ ulong func0(int *param_1,int param_2) { ulong uVar1; if (param_2 < 2) { uVar1 = 0; } else { uVar1 = 1; while (param_1[uVar1 - 1] <= param_1[uVar1]) { uVar1 = uVar1 + 1; if (uVar1 == (uint)param_2) { return 0; } } } return uVar1; }
3,206
func0
#include <assert.h>
int func0(int arr[], int n) { for (int i = 1; i < n; i++) { if (arr[i] < arr[i - 1]) { return i; } } return 0; }
int main() { int arr1[] = {3, 2, 1}; int arr2[] = {4, 5, 1, 2, 3}; int arr3[] = {7, 8, 9, 1, 2, 3}; assert(func0(arr1, 3) == 1); assert(func0(arr2, 5) == 2); assert(func0(arr3, 6) == 3); return 0; }
O2
cpp
func0(int*, int): endbr64 cmp $0x1,%esi jle 1180 <_Z5func0Pii+0x40> lea -0x2(%rsi),%edx mov $0x1,%eax add $0x2,%rdx jmp 1169 <_Z5func0Pii+0x29> nopw 0x0(%rax,%rax,1) add $0x1,%rax cmp %rdx,%rax je 1180 <_Z5func0Pii+0x40> mov -0x4(%rdi,%rax,4),%ecx mov %eax,%r8d cmp %ecx,(%rdi,%rax,4) jge 1160 <_Z5func0Pii+0x20> mov %r8d,%eax retq nopl 0x0(%rax) xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
_Z5func0Pii: endbr64 cmp esi, 1 jle short loc_12B0 mov edx, [rdi] mov esi, esi mov eax, 1 jmp short loc_12A1 loc_1298: add rax, 1 cmp rax, rsi jz short loc_12B0 loc_12A1: mov ecx, edx mov edx, [rdi+rax*4] cmp edx, ecx jge short loc_1298 retn loc_12B0: xor eax, eax retn
long long func0(int *a1, int a2) { int v2; // edx long long result; // rax int v4; // ecx if ( a2 <= 1 ) return 0LL; v2 = *a1; result = 1LL; while ( 1 ) { v4 = v2; v2 = a1[result]; if ( v2 < v4 ) break; if ( ++result == a2 ) return 0LL; } return result; }
func0: ENDBR64 CMP ESI,0x1 JLE 0x001012b0 MOV EDX,dword ptr [RDI] MOV ESI,ESI MOV EAX,0x1 JMP 0x001012a1 LAB_00101298: ADD RAX,0x1 CMP RAX,RSI JZ 0x001012b0 LAB_001012a1: MOV ECX,EDX MOV EDX,dword ptr [RDI + RAX*0x4] CMP EDX,ECX JGE 0x00101298 RET LAB_001012b0: XOR EAX,EAX RET
/* func0(int*, int) */ ulong func0(int *param_1,int param_2) { int *piVar1; ulong uVar2; int iVar3; if (1 < param_2) { uVar2 = 1; iVar3 = *param_1; do { piVar1 = param_1 + uVar2; if (*piVar1 < iVar3) { return uVar2; } uVar2 = uVar2 + 1; iVar3 = *piVar1; } while (uVar2 != (uint)param_2); } return 0; }
3,207
func0
#include <assert.h>
int func0(int arr[], int n) { for (int i = 1; i < n; i++) { if (arr[i] < arr[i - 1]) { return i; } } return 0; }
int main() { int arr1[] = {3, 2, 1}; int arr2[] = {4, 5, 1, 2, 3}; int arr3[] = {7, 8, 9, 1, 2, 3}; assert(func0(arr1, 3) == 1); assert(func0(arr2, 5) == 2); assert(func0(arr3, 6) == 3); return 0; }
O3
cpp
func0(int*, int): endbr64 cmp $0x1,%esi jle 1240 <_Z5func0Pii+0x40> sub $0x2,%esi mov (%rdi),%edx mov $0x1,%eax add $0x2,%rsi jmp 1229 <_Z5func0Pii+0x29> nopl 0x0(%rax) add $0x1,%rax cmp %rsi,%rax je 1240 <_Z5func0Pii+0x40> mov %edx,%ecx mov (%rdi,%rax,4),%edx mov %eax,%r8d cmp %ecx,%edx jge 1220 <_Z5func0Pii+0x20> mov %r8d,%eax retq nopl 0x0(%rax) xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
_Z5func0Pii: endbr64 cmp esi, 1 jle short loc_1170 mov edx, [rdi] mov esi, esi mov eax, 1 jmp short loc_1161 loc_1158: add rax, 1 cmp rax, rsi jz short loc_1170 loc_1161: mov ecx, edx mov edx, [rdi+rax*4] cmp edx, ecx jge short loc_1158 retn loc_1170: xor eax, eax retn
long long func0(int *a1, int a2) { int v2; // edx long long result; // rax int v4; // ecx if ( a2 <= 1 ) return 0LL; v2 = *a1; result = 1LL; while ( 1 ) { v4 = v2; v2 = a1[result]; if ( v2 < v4 ) break; if ( ++result == a2 ) return 0LL; } return result; }
func0: ENDBR64 CMP ESI,0x1 JLE 0x00101170 MOV EDX,dword ptr [RDI] MOV ESI,ESI MOV EAX,0x1 JMP 0x00101161 LAB_00101158: ADD RAX,0x1 CMP RAX,RSI JZ 0x00101170 LAB_00101161: MOV ECX,EDX MOV EDX,dword ptr [RDI + RAX*0x4] CMP EDX,ECX JGE 0x00101158 RET LAB_00101170: XOR EAX,EAX RET
/* func0(int*, int) */ ulong func0(int *param_1,int param_2) { int *piVar1; ulong uVar2; int iVar3; if (1 < param_2) { uVar2 = 1; iVar3 = *param_1; do { piVar1 = param_1 + uVar2; if (*piVar1 < iVar3) { return uVar2; } uVar2 = uVar2 + 1; iVar3 = *piVar1; } while (uVar2 != (uint)param_2); } return 0; }
3,208
func0
#include <iostream> #include <assert.h>
bool func0(int n) { int i = 1; while (i * i <= n) { if ((n % i == 0) && (n / i == i)) { return true; } i = i + 1; } return false; }
int main() { assert(func0(10) == false); assert(func0(36) == true); assert(func0(14) == false); return 0; }
O0
cpp
func0(int): endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) movl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax imul %eax,%eax cmp %eax,-0x14(%rbp) jl 11cc <_Z5func0i+0x43> mov -0x14(%rbp),%eax cltd idivl -0x4(%rbp) mov %edx,%eax test %eax,%eax jne 11c6 <_Z5func0i+0x3d> mov -0x14(%rbp),%eax cltd idivl -0x4(%rbp) cmp %eax,-0x4(%rbp) jne 11c6 <_Z5func0i+0x3d> mov $0x1,%eax jmp 11d1 <_Z5func0i+0x48> addl $0x1,-0x4(%rbp) jmp 119b <_Z5func0i+0x12> mov $0x0,%eax pop %rbp retq
_Z5func0i: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_4], 1 jmp short loc_1181 loc_115D: mov eax, [rbp+var_14] cdq idiv [rbp+var_4] mov eax, edx test eax, eax jnz short loc_117D mov eax, [rbp+var_14] cdq idiv [rbp+var_4] cmp [rbp+var_4], eax jnz short loc_117D mov eax, 1 jmp short loc_1191 loc_117D: add [rbp+var_4], 1 loc_1181: mov eax, [rbp+var_4] imul eax, eax cmp [rbp+var_14], eax jge short loc_115D mov eax, 0 loc_1191: pop rbp retn
long long func0(int a1) { int i; // [rsp+10h] [rbp-4h] for ( i = 1; a1 >= i * i; ++i ) { if ( !(a1 % i) && i == a1 / i ) return 1LL; } return 0LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x4],0x1 JMP 0x00101181 LAB_0010115d: MOV EAX,dword ptr [RBP + -0x14] CDQ IDIV dword ptr [RBP + -0x4] MOV EAX,EDX TEST EAX,EAX JNZ 0x0010117d MOV EAX,dword ptr [RBP + -0x14] CDQ IDIV dword ptr [RBP + -0x4] CMP dword ptr [RBP + -0x4],EAX JNZ 0x0010117d MOV EAX,0x1 JMP 0x00101191 LAB_0010117d: ADD dword ptr [RBP + -0x4],0x1 LAB_00101181: MOV EAX,dword ptr [RBP + -0x4] IMUL EAX,EAX CMP dword ptr [RBP + -0x14],EAX JGE 0x0010115d MOV EAX,0x0 LAB_00101191: POP RBP RET
/* func0(int) */ int8 func0(int param_1) { int local_c; local_c = 1; while( true ) { if (param_1 < local_c * local_c) { return 0; } if ((param_1 % local_c == 0) && (local_c == param_1 / local_c)) break; local_c = local_c + 1; } return 1; }
3,209
func0
#include <iostream> #include <assert.h>
bool func0(int n) { int i = 1; while (i * i <= n) { if ((n % i == 0) && (n / i == i)) { return true; } i = i + 1; } return false; }
int main() { assert(func0(10) == false); assert(func0(36) == true); assert(func0(14) == false); return 0; }
O1
cpp
func0(int): endbr64 test %edi,%edi jle 11c2 <_Z5func0i+0x39> mov $0x1,%ecx jmp 11a4 <_Z5func0i+0x1b> add $0x1,%ecx mov %ecx,%eax imul %ecx,%eax cmp %edi,%eax jg 11bc <_Z5func0i+0x33> mov %edi,%eax cltd idiv %ecx test %edx,%edx jne 1198 <_Z5func0i+0xf> mov %edi,%eax cltd idiv %ecx cmp %ecx,%eax jne 1198 <_Z5func0i+0xf> mov $0x1,%eax retq mov $0x0,%eax retq mov $0x0,%eax retq
_Z5func0i: endbr64 test edi, edi jle short loc_1182 mov ecx, 1 jmp short loc_1164 loc_1158: add ecx, 1 mov eax, ecx imul eax, ecx cmp eax, edi jg short loc_117C loc_1164: mov eax, edi cdq idiv ecx test edx, edx jnz short loc_1158 mov eax, edi cdq idiv ecx cmp eax, ecx jnz short loc_1158 mov eax, 1 retn loc_117C: mov eax, 0 retn loc_1182: mov eax, 0 retn
long long func0(int a1) { int v1; // ecx if ( a1 <= 0 ) return 0LL; v1 = 1; do { if ( !(a1 % v1) && a1 / v1 == v1 ) return 1LL; ++v1; } while ( v1 * v1 <= a1 ); return 0LL; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101182 MOV ECX,0x1 JMP 0x00101164 LAB_00101158: ADD ECX,0x1 MOV EAX,ECX IMUL EAX,ECX CMP EAX,EDI JG 0x0010117c LAB_00101164: MOV EAX,EDI CDQ IDIV ECX TEST EDX,EDX JNZ 0x00101158 MOV EAX,EDI CDQ IDIV ECX CMP EAX,ECX JNZ 0x00101158 MOV EAX,0x1 RET LAB_0010117c: MOV EAX,0x0 RET LAB_00101182: MOV EAX,0x0 RET
/* func0(int) */ int [16] func0(int param_1) { int auVar1 [16]; int auVar2 [16]; int iVar3; ulong in_RDX; int auVar4 [16]; if (param_1 < 1) { auVar2._8_8_ = 0; auVar2._0_8_ = in_RDX; return auVar2 << 0x40; } iVar3 = 1; while ((auVar4._8_8_ = (long)param_1 % (long)iVar3 & 0xffffffff, (int)((long)param_1 % (long)iVar3) != 0 || (auVar4._8_8_ = (long)param_1 % (long)iVar3 & 0xffffffff, param_1 / iVar3 != iVar3))) { iVar3 = iVar3 + 1; if (param_1 < iVar3 * iVar3) { auVar1._8_8_ = 0; auVar1._0_8_ = auVar4._8_8_; return auVar1 << 0x40; } } auVar4._0_8_ = 1; return auVar4; }
3,210
func0
#include <iostream> #include <assert.h>
bool func0(int n) { int i = 1; while (i * i <= n) { if ((n % i == 0) && (n / i == i)) { return true; } i = i + 1; } return false; }
int main() { assert(func0(10) == false); assert(func0(36) == true); assert(func0(14) == false); return 0; }
O2
cpp
func0(int): endbr64 test %edi,%edi jle 12e9 <_Z5func0i+0x29> mov $0x1,%ecx nopl (%rax) mov %edi,%eax cltd idiv %ecx test %edx,%edx jne 12dd <_Z5func0i+0x1d> cmp %ecx,%eax je 12f0 <_Z5func0i+0x30> add $0x1,%ecx mov %ecx,%eax imul %ecx,%eax cmp %edi,%eax jle 12d0 <_Z5func0i+0x10> xor %eax,%eax retq nopl 0x0(%rax) mov $0x1,%eax retq nopw %cs:0x0(%rax,%rax,1)
_Z5func0i: endbr64 test edi, edi jle short loc_1219 mov ecx, 1 nop dword ptr [rax] loc_1200: mov eax, edi cdq idiv ecx test edx, edx jnz short loc_120D cmp eax, ecx jz short loc_1220 loc_120D: add ecx, 1 mov eax, ecx imul eax, ecx cmp eax, edi jle short loc_1200 loc_1219: xor eax, eax retn loc_1220: mov eax, 1 retn
long long func0(int a1) { int v1; // ecx if ( a1 <= 0 ) return 0LL; v1 = 1; while ( a1 % v1 || a1 / v1 != v1 ) { ++v1; if ( v1 * v1 > a1 ) return 0LL; } return 1LL; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101219 MOV ECX,0x1 NOP dword ptr [RAX] LAB_00101200: MOV EAX,EDI CDQ IDIV ECX TEST EDX,EDX JNZ 0x0010120d CMP EAX,ECX JZ 0x00101220 LAB_0010120d: ADD ECX,0x1 MOV EAX,ECX IMUL EAX,ECX CMP EAX,EDI JLE 0x00101200 LAB_00101219: XOR EAX,EAX RET LAB_00101220: MOV EAX,0x1 RET
/* func0(int) */ int8 func0(int param_1) { int iVar1; if (0 < param_1) { iVar1 = 1; do { if ((param_1 % iVar1 == 0) && (param_1 / iVar1 == iVar1)) { return 1; } iVar1 = iVar1 + 1; } while (iVar1 * iVar1 <= param_1); } return 0; }
3,211
func0
#include <iostream> #include <assert.h>
bool func0(int n) { int i = 1; while (i * i <= n) { if ((n % i == 0) && (n / i == i)) { return true; } i = i + 1; } return false; }
int main() { assert(func0(10) == false); assert(func0(36) == true); assert(func0(14) == false); return 0; }
O3
cpp
func0(int): endbr64 test %edi,%edi jle 12e9 <_Z5func0i+0x29> mov $0x1,%ecx nopl (%rax) mov %edi,%eax cltd idiv %ecx test %edx,%edx jne 12dd <_Z5func0i+0x1d> cmp %ecx,%eax je 12f0 <_Z5func0i+0x30> add $0x1,%ecx mov %ecx,%eax imul %ecx,%eax cmp %edi,%eax jle 12d0 <_Z5func0i+0x10> xor %eax,%eax retq nopl 0x0(%rax) mov $0x1,%eax retq nopw %cs:0x0(%rax,%rax,1)
_Z5func0i: endbr64 test edi, edi jle short loc_1269 mov ecx, 1 nop dword ptr [rax] loc_1250: mov eax, edi cdq idiv ecx test edx, edx jnz short loc_125D cmp eax, ecx jz short loc_1270 loc_125D: add ecx, 1 mov eax, ecx imul eax, ecx cmp eax, edi jle short loc_1250 loc_1269: xor eax, eax retn loc_1270: mov eax, 1 retn
long long func0(int a1) { int v1; // ecx if ( a1 <= 0 ) return 0LL; v1 = 1; while ( a1 % v1 || a1 / v1 != v1 ) { ++v1; if ( v1 * v1 > a1 ) return 0LL; } return 1LL; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101269 MOV ECX,0x1 NOP dword ptr [RAX] LAB_00101250: MOV EAX,EDI CDQ IDIV ECX TEST EDX,EDX JNZ 0x0010125d CMP EAX,ECX JZ 0x00101270 LAB_0010125d: ADD ECX,0x1 MOV EAX,ECX IMUL EAX,ECX CMP EAX,EDI JLE 0x00101250 LAB_00101269: XOR EAX,EAX RET LAB_00101270: MOV EAX,0x1 RET
/* func0(int) */ int8 func0(int param_1) { int iVar1; if (0 < param_1) { iVar1 = 1; do { if ((param_1 % iVar1 == 0) && (param_1 / iVar1 == iVar1)) { return 1; } iVar1 = iVar1 + 1; } while (iVar1 * iVar1 <= param_1); } return 0; }
3,212
func0
#include <iostream> #include <assert.h> #include <vector>
bool func0(std::vector<int> arr, int n) { for(int i = 0; i < n; i++) { if ((arr[i] & 1) == 0) { return true; } } return false; }
int main() { assert(func0({1, 2, 3}, 3) == true); assert(func0({1, 2, 1, 4}, 4) == true); assert(func0({1, 1}, 2) == false); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> >, int): endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jge 12bb <_Z5func0St6vectorIiSaIiEEi+0x52> mov -0x4(%rbp),%eax movslq %eax,%rdx mov -0x18(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 15ca <_ZNSt6vectorIiSaIiEEixEm> mov (%rax),%eax and $0x1,%eax test %eax,%eax sete %al test %al,%al je 12b5 <_Z5func0St6vectorIiSaIiEEi+0x4c> mov $0x1,%eax jmp 12c0 <_Z5func0St6vectorIiSaIiEEi+0x57> addl $0x1,-0x4(%rbp) jmp 1283 <_Z5func0St6vectorIiSaIiEEi+0x1a> mov $0x0,%eax leaveq retq
_Z5func0St6vectorIiSaIiEEi: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_4], 0 jmp short loc_1293 loc_1265: mov eax, [rbp+var_4] movsxd rdx, eax mov rax, [rbp+var_18] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] and eax, 1 test eax, eax setz al test al, al jz short loc_128F mov eax, 1 jmp short locret_12A0 loc_128F: add [rbp+var_4], 1 loc_1293: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1265 mov eax, 0 locret_12A0: leave retn
long long func0(long long a1, int a2) { int i; // [rsp+1Ch] [rbp-4h] for ( i = 0; i < a2; ++i ) { if ( (*(_DWORD *)std::vector<int>::operator[](a1, i) & 1) == 0 ) return 1LL; } return 0LL; }
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 + -0x4],0x0 JMP 0x00101293 LAB_00101265: MOV EAX,dword ptr [RBP + -0x4] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] MOV RSI,RDX MOV RDI,RAX CALL 0x001015a8 MOV EAX,dword ptr [RAX] AND EAX,0x1 TEST EAX,EAX SETZ AL TEST AL,AL JZ 0x0010128f MOV EAX,0x1 JMP 0x001012a0 LAB_0010128f: ADD dword ptr [RBP + -0x4],0x1 LAB_00101293: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101265 MOV EAX,0x0 LAB_001012a0: LEAVE RET
/* func0(std::vector<int, std::allocator<int> >, int) */ int8 func0(vector param_1,int param_2) { uint *puVar1; int4 in_register_0000003c; int local_c; local_c = 0; while( true ) { if (param_2 <= local_c) { return 0; } puVar1 = (uint *)std::vector<int,std::allocator<int>>::operator[] ((vector<int,std::allocator<int>> *) CONCAT44(in_register_0000003c,param_1),(long)local_c); if ((*puVar1 & 1) == 0) break; local_c = local_c + 1; } return 1; }
3,213
func0
#include <iostream> #include <assert.h> #include <vector>
bool func0(std::vector<int> arr, int n) { for(int i = 0; i < n; i++) { if ((arr[i] & 1) == 0) { return true; } } return false; }
int main() { assert(func0({1, 2, 3}, 3) == true); assert(func0({1, 2, 1, 4}, 4) == true); assert(func0({1, 1}, 2) == false); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> >, int): endbr64 test %esi,%esi jle 1270 <_Z5func0St6vectorIiSaIiEEi+0x27> mov (%rdi),%rax lea -0x1(%rsi),%edx lea 0x4(%rax,%rdx,4),%rdx testb $0x1,(%rax) je 1276 <_Z5func0St6vectorIiSaIiEEi+0x2d> add $0x4,%rax cmp %rdx,%rax jne 125c <_Z5func0St6vectorIiSaIiEEi+0x13> mov $0x0,%eax retq mov $0x0,%eax retq mov $0x1,%eax retq
_Z5func0St6vectorIiSaIiEEi: endbr64 test esi, esi jle short loc_122F mov rax, [rdi] movsxd rsi, esi lea rdx, [rax+rsi*4] loc_121B: test byte ptr [rax], 1 jz short loc_1235 add rax, 4 cmp rax, rdx jnz short loc_121B mov eax, 0 retn loc_122F: mov eax, 0 retn loc_1235: mov eax, 1 retn
long long func0(_BYTE **a1, int a2) { _BYTE *v2; // rax if ( a2 <= 0 ) return 0LL; v2 = *a1; while ( (*v2 & 1) != 0 ) { v2 += 4; if ( v2 == &(*a1)[4 * a2] ) return 0LL; } return 1LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x0010122f MOV RAX,qword ptr [RDI] MOVSXD RSI,ESI LEA RDX,[RAX + RSI*0x4] LAB_0010121b: TEST byte ptr [RAX],0x1 JZ 0x00101235 ADD RAX,0x4 CMP RAX,RDX JNZ 0x0010121b MOV EAX,0x0 RET LAB_0010122f: MOV EAX,0x0 RET LAB_00101235: MOV EAX,0x1 RET
/* func0(std::vector<int, std::allocator<int> >, int) */ int8 func0(vector param_1,int param_2) { byte *pbVar1; byte *pbVar2; int4 in_register_0000003c; if (param_2 < 1) { return 0; } pbVar2 = *(byte **)CONCAT44(in_register_0000003c,param_1); pbVar1 = pbVar2 + (long)param_2 * 4; do { if ((*pbVar2 & 1) == 0) { return 1; } pbVar2 = pbVar2 + 4; } while (pbVar2 != pbVar1); return 0; }
3,214
func0
#include <iostream> #include <assert.h> #include <vector>
bool func0(std::vector<int> arr, int n) { for(int i = 0; i < n; i++) { if ((arr[i] & 1) == 0) { return true; } } return false; }
int main() { assert(func0({1, 2, 3}, 3) == true); assert(func0({1, 2, 1, 4}, 4) == true); assert(func0({1, 1}, 2) == false); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> >, int): endbr64 test %esi,%esi jle 1450 <_Z5func0St6vectorIiSaIiEEi+0x30> mov (%rdi),%rax lea -0x1(%rsi),%edx lea 0x4(%rax,%rdx,4),%rdx jmp 1441 <_Z5func0St6vectorIiSaIiEEi+0x21> nopl (%rax) add $0x4,%rax cmp %rdx,%rax je 1450 <_Z5func0St6vectorIiSaIiEEi+0x30> testb $0x1,(%rax) jne 1438 <_Z5func0St6vectorIiSaIiEEi+0x18> mov $0x1,%eax retq nopl 0x0(%rax) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
_Z5func0St6vectorIiSaIiEEi: endbr64 test esi, esi jle short loc_13C0 mov rax, [rdi] movsxd rsi, esi lea rdx, [rax+rsi*4] jmp short loc_13B1 loc_13A8: add rax, 4 cmp rax, rdx jz short loc_13C0 loc_13B1: test byte ptr [rax], 1 jnz short loc_13A8 mov eax, 1 retn loc_13C0: xor eax, eax retn
long long func0(_BYTE **a1, int a2) { _BYTE *v2; // rax if ( a2 <= 0 ) return 0LL; v2 = *a1; while ( (*v2 & 1) != 0 ) { v2 += 4; if ( v2 == &(*a1)[4 * a2] ) return 0LL; } return 1LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001013c0 MOV RAX,qword ptr [RDI] MOVSXD RSI,ESI LEA RDX,[RAX + RSI*0x4] JMP 0x001013b1 LAB_001013a8: ADD RAX,0x4 CMP RAX,RDX JZ 0x001013c0 LAB_001013b1: TEST byte ptr [RAX],0x1 JNZ 0x001013a8 MOV EAX,0x1 RET LAB_001013c0: XOR EAX,EAX RET
/* func0(std::vector<int, std::allocator<int> >, int) */ int8 func0(vector param_1,int param_2) { byte *pbVar1; byte *pbVar2; int4 in_register_0000003c; if (0 < param_2) { pbVar2 = *(byte **)CONCAT44(in_register_0000003c,param_1); pbVar1 = pbVar2 + (long)param_2 * 4; do { if ((*pbVar2 & 1) == 0) { return 1; } pbVar2 = pbVar2 + 4; } while (pbVar2 != pbVar1); } return 0; }
3,215
func0
#include <iostream> #include <assert.h> #include <vector>
bool func0(std::vector<int> arr, int n) { for(int i = 0; i < n; i++) { if ((arr[i] & 1) == 0) { return true; } } return false; }
int main() { assert(func0({1, 2, 3}, 3) == true); assert(func0({1, 2, 1, 4}, 4) == true); assert(func0({1, 1}, 2) == false); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> >, int): endbr64 test %esi,%esi jle 1430 <_Z5func0St6vectorIiSaIiEEi+0x30> mov (%rdi),%rax lea -0x1(%rsi),%edx lea 0x4(%rax,%rdx,4),%rdx jmp 1421 <_Z5func0St6vectorIiSaIiEEi+0x21> nopl (%rax) add $0x4,%rax cmp %rdx,%rax je 1430 <_Z5func0St6vectorIiSaIiEEi+0x30> testb $0x1,(%rax) jne 1418 <_Z5func0St6vectorIiSaIiEEi+0x18> mov $0x1,%eax retq nopl 0x0(%rax) xor %eax,%eax retq nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
_Z5func0St6vectorIiSaIiEEi: endbr64 test esi, esi jle short loc_13C0 mov rax, [rdi] movsxd rsi, esi lea rdx, [rax+rsi*4] jmp short loc_13B1 loc_13A8: add rax, 4 cmp rax, rdx jz short loc_13C0 loc_13B1: test byte ptr [rax], 1 jnz short loc_13A8 mov eax, 1 retn loc_13C0: xor eax, eax retn
long long func0(_BYTE **a1, int a2) { _BYTE *v2; // rax if ( a2 <= 0 ) return 0LL; v2 = *a1; while ( (*v2 & 1) != 0 ) { v2 += 4; if ( v2 == &(*a1)[4 * a2] ) return 0LL; } return 1LL; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001013c0 MOV RAX,qword ptr [RDI] MOVSXD RSI,ESI LEA RDX,[RAX + RSI*0x4] JMP 0x001013b1 LAB_001013a8: ADD RAX,0x4 CMP RAX,RDX JZ 0x001013c0 LAB_001013b1: TEST byte ptr [RAX],0x1 JNZ 0x001013a8 MOV EAX,0x1 RET LAB_001013c0: XOR EAX,EAX RET
/* func0(std::vector<int, std::allocator<int> >, int) */ int8 func0(vector param_1,int param_2) { byte *pbVar1; byte *pbVar2; int4 in_register_0000003c; if (0 < param_2) { pbVar2 = *(byte **)CONCAT44(in_register_0000003c,param_1); pbVar1 = pbVar2 + (long)param_2 * 4; do { if ((*pbVar2 & 1) == 0) { return 1; } pbVar2 = pbVar2 + 4; } while (pbVar2 != pbVar1); } return 0; }
3,216
func0
#include <vector> #include <algorithm> #include <assert.h> #include <numeric>
std::vector<int> func0(const std::vector<std::vector<int>>& lists) { return *std::max_element(lists.begin(), lists.end(), [](const std::vector<int>& a, const std::vector<int>& b) { return std::accumulate(a.begin(), a.end(), 0) < std::accumulate(b.begin(), b.end(), 0); }); }
int main() { assert((func0({{1, 2, 3}, {4, 5, 6}, {10, 11, 12}, {7, 8, 9}}) == std::vector<int>{10, 11, 12})); assert((func0({{3, 2, 1}, {6, 5, 4}, {12, 11, 10}}) == std::vector<int>{12, 11, 10})); assert((func0({{2, 3, 1}}) == std::vector<int>{2, 3, 1})); return 0; }
O0
cpp
func0(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&)::{lambda(std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&)#1}::operator()(std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&) const: push %rbp mov %rsp,%rbp push %r12 push %rbx sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov %rdx,-0x28(%rbp) mov -0x20(%rbp),%rax mov %rax,%rdi callq 22a0 <_ZNKSt6vectorIiSaIiEE3endEv> mov %rax,%rbx mov -0x20(%rbp),%rax mov %rax,%rdi callq 2248 <_ZNKSt6vectorIiSaIiEE5beginEv> mov $0x0,%edx mov %rbx,%rsi mov %rax,%rdi callq 22f8 <_ZSt10accumulateIN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEEiET0_T_S9_S8_> mov %eax,%ebx mov -0x28(%rbp),%rax mov %rax,%rdi callq 22a0 <_ZNKSt6vectorIiSaIiEE3endEv> mov %rax,%r12 mov -0x28(%rbp),%rax mov %rax,%rdi callq 2248 <_ZNKSt6vectorIiSaIiEE5beginEv> mov $0x0,%edx mov %r12,%rsi mov %rax,%rdi callq 22f8 <_ZSt10accumulateIN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEEiET0_T_S9_S8_> cmp %eax,%ebx setl %al add $0x20,%rsp pop %rbx pop %r12 pop %rbp retq
_ZZ5func0RKSt6vectorIS_IiSaIiEESaIS1_EEENKUlRKS1_S7_E_clES7_S7_: push rbp mov rbp, rsp push r12 push rbx sub rsp, 20h mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov [rbp+var_28], rdx mov rax, [rbp+var_20] mov rdi, rax call _ZNKSt6vectorIiSaIiEE3endEv; std::vector<int>::end(void) mov rbx, rax mov rax, [rbp+var_20] mov rdi, rax call _ZNKSt6vectorIiSaIiEE5beginEv; std::vector<int>::begin(void) mov edx, 0 mov rsi, rbx mov rdi, rax call _ZSt10accumulateIN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEEiET0_T_S9_S8_; std::accumulate<__gnu_cxx::__normal_iterator<int const*,std::vector<int>>,int>(__gnu_cxx::__normal_iterator<int const*,std::vector<int>>,__gnu_cxx::__normal_iterator<int const*,std::vector<int>>,int) mov ebx, eax mov rax, [rbp+var_28] mov rdi, rax call _ZNKSt6vectorIiSaIiEE3endEv; std::vector<int>::end(void) mov r12, rax mov rax, [rbp+var_28] mov rdi, rax call _ZNKSt6vectorIiSaIiEE5beginEv; std::vector<int>::begin(void) mov edx, 0 mov rsi, r12 mov rdi, rax call _ZSt10accumulateIN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEEiET0_T_S9_S8_; std::accumulate<__gnu_cxx::__normal_iterator<int const*,std::vector<int>>,int>(__gnu_cxx::__normal_iterator<int const*,std::vector<int>>,__gnu_cxx::__normal_iterator<int const*,std::vector<int>>,int) cmp ebx, eax setl al add rsp, 20h pop rbx pop r12 pop rbp retn
bool func0(std::vector<std::vector<int>> const&)::{lambda(std::vector<int> const&,std::vector<int> const&)#1}::operator()( long long a1, long long a2, long long a3) { long long v3; // rbx long long v4; // rax long long v5; // r12 long long v6; // rax v3 = std::vector<int>::end(a2); v4 = std::vector<int>::begin(a2); LODWORD(v3) = std::accumulate<__gnu_cxx::__normal_iterator<int const*,std::vector<int>>,int>(v4, v3, 0LL); v5 = std::vector<int>::end(a3); v6 = std::vector<int>::begin(a3); return (int)v3 < (int)std::accumulate<__gnu_cxx::__normal_iterator<int const*,std::vector<int>>,int>(v6, v5, 0LL); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x28 MOV qword ptr [RBP + -0x28],RDI MOV qword ptr [RBP + -0x30],RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV RAX,qword ptr [RBP + -0x30] MOV RDI,RAX CALL 0x00102250 MOV RBX,RAX MOV RAX,qword ptr [RBP + -0x30] MOV RDI,RAX CALL 0x00102204 MOV RSI,RBX MOV RDI,RAX CALL 0x0010204f MOV qword ptr [RBP + -0x20],RAX LEA RAX,[RBP + -0x20] MOV RDI,RAX CALL 0x0010238e MOV RDX,RAX MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x001023a4 MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x001013c7 CALL 0x00101190 LAB_001013c7: MOV RAX,qword ptr [RBP + -0x28] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) */ vector * func0(vector *param_1) { __normal_iterator _Var1; __normal_iterator _Var2; int4 extraout_var; vector *pvVar3; _lambda_std__vector<int,std::allocator<int>_>_const__std__vector<int,std::allocator<int>_>_const___1_ extraout_EDX; vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>> *in_RSI; long in_FS_OFFSET; int8 local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); _Var1 = std:: vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>> ::end(in_RSI); _Var2 = std:: vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>> ::begin(in_RSI); _Var1 = std:: max_element<__normal_iterator<std::vector<int,std::allocator<int>>const*,std::vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>>>,func0(std::vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>>const&)::_lambda(std::vector<int,std::allocator<int>>const&,std::vector<int,std::allocator<int>>const&)_1_> (_Var2,_Var1,extraout_EDX); local_28 = CONCAT44(extraout_var,_Var1); pvVar3 = (vector *) __normal_iterator<std::vector<int,std::allocator<int>>const*,std::vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>>> ::operator*((__normal_iterator<std::vector<int,std::allocator<int>>const*,std::vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>>> *)&local_28); std::vector<int,std::allocator<int>>::vector((vector<int,std::allocator<int>> *)param_1,pvVar3); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
3,217
func0
#include <vector> #include <algorithm> #include <assert.h> #include <numeric>
std::vector<int> func0(const std::vector<std::vector<int>>& lists) { return *std::max_element(lists.begin(), lists.end(), [](const std::vector<int>& a, const std::vector<int>& b) { return std::accumulate(a.begin(), a.end(), 0) < std::accumulate(b.begin(), b.end(), 0); }); }
int main() { assert((func0({{1, 2, 3}, {4, 5, 6}, {10, 11, 12}, {7, 8, 9}}) == std::vector<int>{10, 11, 12})); assert((func0({{3, 2, 1}, {6, 5, 4}, {12, 11, 10}}) == std::vector<int>{12, 11, 10})); assert((func0({{2, 3, 1}}) == std::vector<int>{2, 3, 1})); return 0; }
O1
cpp
func0(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&): endbr64 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%rbp mov 0x8(%rsi),%r8 mov (%rsi),%rbx cmp %r8,%rbx je 12fa <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x31> lea 0x18(%rbx),%rdx cmp %rdx,%r8 je 12fd <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x34> mov $0x0,%r10d jmpq 13bd <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xf4> mov %r8,%rbx mov 0x8(%rbx),%r13 sub (%rbx),%r13 movq $0x0,0x0(%rbp) movq $0x0,0x8(%rbp) movq $0x0,0x10(%rbp) mov %r13,%rax sar $0x2,%rax je 1385 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xbc> movabs $0x1fffffffffffffff,%rdx cmp %rdx,%rax ja 1380 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xb7> mov %r13,%rdi callq 1180 <_Znwm@plt> mov %rax,%r12 mov %r12,0x0(%rbp) mov %r12,0x8(%rbp) add %r12,%r13 mov %r13,0x10(%rbp) mov 0x8(%rbx),%rax mov (%rbx),%rsi mov %rax,%rbx sub %rsi,%rbx cmp %rsi,%rax je 136b <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xa2> mov %rbx,%rdx mov %r12,%rdi callq 11b0 <memmove@plt> add %rbx,%r12 mov %r12,0x8(%rbp) mov %rbp,%rax add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq callq 1110 <_ZSt17__throw_bad_allocv@plt> mov $0x0,%r12d jmp 133f <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x76> mov 0x8(%rdx),%rdi mov (%rdx),%rax mov %r10d,%ecx cmp %rdi,%rax je 13b0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xe7> mov %r10d,%esi add (%rax),%esi add $0x4,%rax cmp %rax,%rdi jne 139f <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xd6> cmp %ecx,%esi cmovg %r9,%rbx add $0x18,%rdx cmp %rdx,%r8 je 12fd <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x34> mov %rdx,%r9 mov 0x8(%rbx),%rsi mov (%rbx),%rax cmp %rax,%rsi je 138d <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xc4> mov %r10d,%ecx add (%rax),%ecx add $0x4,%rax cmp %rax,%rsi jne 13cf <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x106> mov 0x8(%r9),%rdi mov (%r9),%rax cmp %rax,%rdi jne 139c <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xd3> mov %r10d,%esi jmp 13aa <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xe1>
_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov rbp, rdi mov r9, [rsi+8] mov rbx, [rsi] cmp rbx, r9 jz short loc_12FA lea rdi, [rbx+18h] cmp r9, rdi jz short loc_12FD mov r10d, 0 jmp loc_13BE loc_12FA: mov rbx, r9 loc_12FD: mov r13, [rbx+8] sub r13, [rbx] mov qword ptr [rbp+0], 0 mov qword ptr [rbp+8], 0 mov qword ptr [rbp+10h], 0 jz short loc_137C mov rax, 7FFFFFFFFFFFFFFCh cmp rax, r13 jb short loc_1377 mov rdi, r13; unsigned __int64 call __Znwm; operator new(ulong) mov r12, rax loc_1338: mov [rbp+0], r12 mov [rbp+8], r12 add r13, r12 mov [rbp+10h], r13 mov rsi, [rbx]; src mov rbx, [rbx+8] sub rbx, rsi cmp rbx, 4 jle short loc_1384 mov rdx, rbx; n mov rdi, r12; dest call _memmove loc_1362: add r12, rbx mov [rbp+8], r12 mov rax, rbp add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_1377: call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) loc_137C: mov r12d, 0 jmp short loc_1338 loc_1384: jnz short loc_1362 mov eax, [rsi] mov [r12], eax jmp short loc_1362 loc_138E: mov rsi, [rdi+8] mov rax, [rdi] mov edx, r10d cmp rsi, rax jz short loc_13B1 loc_139D: mov ecx, r10d loc_13A0: add ecx, [rax] add rax, 4 cmp rsi, rax jnz short loc_13A0 loc_13AB: cmp edx, ecx cmovl rbx, r8 loc_13B1: add rdi, 18h cmp r9, rdi jz loc_12FD loc_13BE: mov r8, rdi mov rcx, [rbx+8] mov rax, [rbx] cmp rcx, rax jz short loc_138E mov edx, r10d loc_13D0: add edx, [rax] add rax, 4 cmp rax, rcx jnz short loc_13D0 mov rsi, [r8+8] mov rax, [r8] cmp rsi, rax jnz short loc_139D mov ecx, 0 jmp short loc_13AB
_QWORD * func0(_QWORD *a1, long long *a2) { long long v3; // r9 long long v4; // rbx long long v5; // rdi unsigned long long v6; // r13 _DWORD *v7; // r12 _DWORD *v8; // rsi signed long long v9; // rbx _DWORD *v11; // rsi _DWORD *v12; // rax int v13; // edx int v14; // ecx _DWORD *v15; // rcx _DWORD *v16; // rax v3 = a2[1]; v4 = *a2; if ( *a2 == v3 ) { v4 = a2[1]; } else { v5 = v4 + 24; if ( v3 != v4 + 24 ) { while ( 1 ) { v15 = *(_DWORD **)(v4 + 8); v16 = *(_DWORD **)v4; if ( v15 != *(_DWORD **)v4 ) break; v11 = *(_DWORD **)(v5 + 8); v12 = *(_DWORD **)v5; v13 = 0; if ( v11 != *(_DWORD **)v5 ) goto LABEL_16; LABEL_20: v5 += 24LL; if ( v3 == v5 ) goto LABEL_5; } v13 = 0; do v13 += *v16++; while ( v16 != v15 ); v11 = *(_DWORD **)(v5 + 8); v12 = *(_DWORD **)v5; if ( v11 == *(_DWORD **)v5 ) { v14 = 0; } else { LABEL_16: v14 = 0; do v14 += *v12++; while ( v11 != v12 ); } if ( v13 < v14 ) v4 = v5; goto LABEL_20; } } LABEL_5: v6 = *(_QWORD *)(v4 + 8) - *(_QWORD *)v4; *a1 = 0LL; a1[1] = 0LL; a1[2] = 0LL; if ( v6 ) { if ( v6 <= 0x7FFFFFFFFFFFFFFCLL ) { v7 = (_DWORD *)operator new(v6); goto LABEL_8; } std::__throw_bad_array_new_length(); } v7 = 0LL; LABEL_8: *a1 = v7; a1[1] = v7; a1[2] = (char *)v7 + v6; v8 = *(_DWORD **)v4; v9 = *(_QWORD *)(v4 + 8) - *(_QWORD *)v4; if ( v9 <= 4 ) { if ( v9 == 4 ) *v7 = *v8; } else { memmove(v7, v8, v9); } a1[1] = (char *)v7 + v9; return a1; }
func0: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBP,RDI MOV R9,qword ptr [RSI + 0x8] MOV RBX,qword ptr [RSI] CMP RBX,R9 JZ 0x001012fa LEA RDI,[RBX + 0x18] CMP R9,RDI JZ 0x001012fd MOV R10D,0x0 JMP 0x001013be LAB_001012fa: MOV RBX,R9 LAB_001012fd: MOV R13,qword ptr [RBX + 0x8] SUB R13,qword ptr [RBX] MOV qword ptr [RBP],0x0 MOV qword ptr [RBP + 0x8],0x0 MOV qword ptr [RBP + 0x10],0x0 JZ 0x0010137c MOV RAX,0x7ffffffffffffffc CMP RAX,R13 JC 0x00101377 MOV RDI,R13 CALL 0x00101170 MOV R12,RAX LAB_00101338: MOV qword ptr [RBP],R12 MOV qword ptr [RBP + 0x8],R12 ADD R13,R12 MOV qword ptr [RBP + 0x10],R13 MOV RSI,qword ptr [RBX] MOV RBX,qword ptr [RBX + 0x8] SUB RBX,RSI CMP RBX,0x4 JLE 0x00101384 MOV RDX,RBX MOV RDI,R12 CALL 0x001011b0 LAB_00101362: ADD R12,RBX MOV qword ptr [RBP + 0x8],R12 MOV RAX,RBP ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_00101377: CALL 0x00101150 LAB_0010137c: MOV R12D,0x0 JMP 0x00101338 LAB_00101384: JNZ 0x00101362 MOV EAX,dword ptr [RSI] MOV dword ptr [R12],EAX JMP 0x00101362 LAB_0010138e: MOV RSI,qword ptr [RDI + 0x8] MOV RAX,qword ptr [RDI] MOV EDX,R10D CMP RSI,RAX JZ 0x001013b1 LAB_0010139d: MOV ECX,R10D LAB_001013a0: ADD ECX,dword ptr [RAX] ADD RAX,0x4 CMP RSI,RAX JNZ 0x001013a0 LAB_001013ab: CMP EDX,ECX CMOVL RBX,R8 LAB_001013b1: ADD RDI,0x18 CMP R9,RDI JZ 0x001012fd LAB_001013be: MOV R8,RDI MOV RCX,qword ptr [RBX + 0x8] MOV RAX,qword ptr [RBX] CMP RCX,RAX JZ 0x0010138e MOV EDX,R10D LAB_001013d0: ADD EDX,dword ptr [RAX] ADD RAX,0x4 CMP RAX,RCX JNZ 0x001013d0 MOV RSI,qword ptr [R8 + 0x8] MOV RAX,qword ptr [R8] CMP RSI,RAX JNZ 0x0010139d MOV ECX,0x0 JMP 0x001013ab
/* func0(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) */ vector * func0(vector *param_1) { long *plVar1; long *plVar2; int4 *__src; long *plVar3; int4 *__dest; int *piVar4; int *piVar5; int iVar6; int iVar7; long *plVar8; size_t __n; int8 *in_RSI; ulong uVar9; plVar1 = (long *)in_RSI[1]; plVar2 = (long *)*in_RSI; plVar8 = plVar1; plVar3 = plVar2; if (plVar2 != plVar1) { joined_r0x001012ed: plVar2 = plVar2 + 3; plVar8 = plVar3; if (plVar1 != plVar2) { piVar5 = (int *)*plVar3; if ((int *)plVar3[1] == piVar5) goto LAB_0010138e; iVar7 = 0; do { iVar7 = iVar7 + *piVar5; piVar5 = piVar5 + 1; } while (piVar5 != (int *)plVar3[1]); piVar5 = (int *)plVar2[1]; piVar4 = (int *)*plVar2; if (piVar5 != piVar4) goto LAB_0010139d; iVar6 = 0; goto LAB_001013ab; } } uVar9 = plVar8[1] - *plVar8; *(int8 *)param_1 = 0; *(int8 *)(param_1 + 8) = 0; *(int8 *)(param_1 + 0x10) = 0; if (uVar9 != 0) { if (uVar9 < 0x7ffffffffffffffd) { __dest = (int4 *)operator_new(uVar9); goto LAB_00101338; } std::__throw_bad_array_new_length(); } __dest = (int4 *)0x0; LAB_00101338: *(int4 **)param_1 = __dest; *(int4 **)(param_1 + 8) = __dest; *(ulong *)(param_1 + 0x10) = uVar9 + (long)__dest; __src = (int4 *)*plVar8; __n = plVar8[1] - (long)__src; if ((long)__n < 5) { if (__n == 4) { *__dest = *__src; } } else { memmove(__dest,__src,__n); } *(size_t *)(param_1 + 8) = (long)__dest + __n; return param_1; LAB_0010138e: piVar5 = (int *)plVar2[1]; piVar4 = (int *)*plVar2; iVar7 = 0; if (piVar5 != piVar4) { LAB_0010139d: iVar6 = 0; do { iVar6 = iVar6 + *piVar4; piVar4 = piVar4 + 1; } while (piVar5 != piVar4); LAB_001013ab: if (iVar7 < iVar6) { plVar3 = plVar2; } } goto joined_r0x001012ed; }
3,218
func0
#include <vector> #include <algorithm> #include <assert.h> #include <numeric>
std::vector<int> func0(const std::vector<std::vector<int>>& lists) { return *std::max_element(lists.begin(), lists.end(), [](const std::vector<int>& a, const std::vector<int>& b) { return std::accumulate(a.begin(), a.end(), 0) < std::accumulate(b.begin(), b.end(), 0); }); }
int main() { assert((func0({{1, 2, 3}, {4, 5, 6}, {10, 11, 12}, {7, 8, 9}}) == std::vector<int>{10, 11, 12})); assert((func0({{3, 2, 1}, {6, 5, 4}, {12, 11, 10}}) == std::vector<int>{12, 11, 10})); assert((func0({{2, 3, 1}}) == std::vector<int>{2, 3, 1})); return 0; }
O2
cpp
func0(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&): endbr64 push %r12 mov %rdi,%r12 push %rbp push %rbx mov (%rsi),%rbp mov 0x8(%rsi),%r11 mov 0x0(%rbp),%rdi mov 0x8(%rbp),%rax cmp %rbp,%r11 je 195b <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x8b> lea 0x18(%rbp),%rdx cmp %rdx,%r11 je 195b <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x8b> nopl 0x0(%rax,%rax,1) mov (%rdx),%r10 mov 0x8(%rdx),%r9 cmp %rdi,%rax je 19e0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x110> mov %rdi,%rsi xor %ecx,%ecx nopl (%rax) add (%rsi),%ecx add $0x4,%rsi cmp %rsi,%rax jne 1918 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x48> cmp %r9,%r10 je 19f0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x120> mov %r10,%r8 xor %esi,%esi nopl 0x0(%rax) add (%r8),%esi add $0x4,%r8 cmp %r8,%r9 jne 1938 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x68> cmp %esi,%ecx cmovl %r9,%rax cmovl %r10,%rdi cmovl %rdx,%rbp add $0x18,%rdx cmp %rdx,%r11 jne 1900 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x30> sub %rdi,%rax movq $0x0,(%r12) movq $0x0,0x8(%r12) mov %rax,%rbx sar $0x2,%rax movq $0x0,0x10(%r12) je 1a00 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x130> movabs $0x1fffffffffffffff,%rdx cmp %rdx,%rax ja 1a04 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x134> mov %rbx,%rdi callq 1180 <_Znwm@plt> mov %rax,%rcx lea (%rcx,%rbx,1),%rax mov %rcx,(%r12) mov %rcx,0x8(%r12) mov %rax,0x10(%r12) mov 0x8(%rbp),%rax mov 0x0(%rbp),%rsi mov %rax,%rbx sub %rsi,%rbx cmp %rsi,%rax je 19ce <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xfe> mov %rcx,%rdi mov %rbx,%rdx callq 11b0 <memmove@plt> mov %rax,%rcx add %rbx,%rcx mov %r12,%rax pop %rbx pop %rbp mov %rcx,0x8(%r12) pop %r12 retq xchg %ax,%ax xor %ecx,%ecx cmp %r9,%r10 jne 192c <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x5c> jmpq 1952 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x82> xor %esi,%esi jmpq 1944 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x74> nopw 0x0(%rax,%rax,1) xor %ecx,%ecx jmp 199b <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xcb> callq 1110 <_ZSt17__throw_bad_allocv@plt> nopl 0x0(%rax)
_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE: endbr64 push r12 push rbp mov rbp, rdi push rbx mov r12, [rsi] mov r11, [rsi+8] mov r9, [r12] mov rsi, [r12+8] cmp r12, r11 jz short loc_1A1A lea r8, [r12+18h] cmp r11, r8 jz short loc_1A1A nop word ptr [rax+rax+00h] loc_19C0: mov rdi, [r8+8] mov r10, [r8] cmp rsi, r9 jz loc_1A90 mov rax, r9 xor edx, edx nop dword ptr [rax] loc_19D8: add edx, [rax] add rax, 4 cmp rax, rsi jnz short loc_19D8 cmp rdi, r10 jz loc_1AA0 loc_19EC: mov rax, r10 xor ecx, ecx nop dword ptr [rax+00000000h] loc_19F8: add ecx, [rax] add rax, 4 cmp rdi, rax jnz short loc_19F8 loc_1A03: cmp edx, ecx cmovl r9, r10 cmovl rsi, rdi cmovl r12, r8 loc_1A11: add r8, 18h cmp r11, r8 jnz short loc_19C0 loc_1A1A: pxor xmm0, xmm0 mov rbx, rsi mov qword ptr [rbp+10h], 0 movups xmmword ptr [rbp+0], xmm0 sub rbx, r9 jz short loc_1AA7 mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbx jb short loc_1AB3 mov rdi, rbx; unsigned __int64 call __Znwm; operator new(ulong) mov rcx, rax loc_1A4C: movq xmm0, rcx lea rsi, [rcx+rbx] punpcklqdq xmm0, xmm0 mov [rbp+10h], rsi movups xmmword ptr [rbp+0], xmm0 mov rsi, [r12]; src mov rbx, [r12+8] sub rbx, rsi cmp rbx, 4 jle short loc_1AAB mov rdi, rcx; dest mov rdx, rbx; n call _memmove mov rcx, rax loc_1A81: add rcx, rbx mov rax, rbp mov [rbp+8], rcx pop rbx pop rbp pop r12 retn loc_1A90: xor edx, edx cmp rdi, r10 jnz loc_19EC jmp loc_1A11 loc_1AA0: xor ecx, ecx jmp loc_1A03 loc_1AA7: xor ecx, ecx jmp short loc_1A4C loc_1AAB: jnz short loc_1A81 mov eax, [rsi] mov [rcx], eax jmp short loc_1A81 loc_1AB3: call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) nop dword ptr [rax+rax+00000000h]
long long func0(long long a1, char ***a2) { char **v3; // r12 char **v4; // r11 char *v5; // r9 char *v6; // rsi char **v7; // r8 char *v8; // rdi char *v9; // r10 char *v10; // rax int v11; // edx char *v12; // rax int v13; // ecx unsigned long long v14; // rbx _DWORD *v15; // rcx char *v16; // rsi long long v17; // rbx long long result; // rax v3 = *a2; v4 = a2[1]; v5 = **a2; v6 = (*a2)[1]; if ( v3 != v4 ) { v7 = v3 + 3; if ( v4 != v3 + 3 ) { while ( 1 ) { v8 = v7[1]; v9 = *v7; if ( v6 != v5 ) break; v11 = 0; if ( v8 != v9 ) goto LABEL_7; LABEL_11: v7 += 3; if ( v4 == v7 ) goto LABEL_12; } v10 = v5; v11 = 0; do { v11 += *(_DWORD *)v10; v10 += 4; } while ( v10 != v6 ); if ( v8 == v9 ) { v13 = 0; } else { LABEL_7: v12 = *v7; v13 = 0; do { v13 += *(_DWORD *)v12; v12 += 4; } while ( v8 != v12 ); } if ( v11 < v13 ) { v5 = *v7; v6 = v7[1]; v3 = v7; } goto LABEL_11; } } LABEL_12: *(_QWORD *)(a1 + 16) = 0LL; *(_OWORD *)a1 = 0LL; v14 = v6 - v5; if ( v6 == v5 ) { v15 = 0LL; } else { if ( v14 > 0x7FFFFFFFFFFFFFFCLL ) { std::__throw_bad_array_new_length(); return std::vector<int>::~vector(); } v15 = (_DWORD *)operator new(v6 - v5); } *(_QWORD *)(a1 + 16) = (char *)v15 + v14; *(__m128i *)a1 = _mm_unpacklo_epi64((__m128i)(unsigned long long)v15, (__m128i)(unsigned long long)v15); v16 = *v3; v17 = v3[1] - *v3; if ( v17 <= 4 ) { if ( v17 == 4 ) *v15 = *(_DWORD *)v16; } else { v15 = memmove(v15, v16, v3[1] - *v3); } result = a1; *(_QWORD *)(a1 + 8) = (char *)v15 + v17; return result; }
func0: ENDBR64 PUSH R12 PUSH RBP MOV RBP,RDI PUSH RBX MOV R12,qword ptr [RSI] MOV R11,qword ptr [RSI + 0x8] MOV R9,qword ptr [R12] MOV RSI,qword ptr [R12 + 0x8] CMP R12,R11 JZ 0x00101a1a LEA R8,[R12 + 0x18] CMP R11,R8 JZ 0x00101a1a NOP word ptr [RAX + RAX*0x1] LAB_001019c0: MOV RDI,qword ptr [R8 + 0x8] MOV R10,qword ptr [R8] CMP RSI,R9 JZ 0x00101a90 MOV RAX,R9 XOR EDX,EDX NOP dword ptr [RAX] LAB_001019d8: ADD EDX,dword ptr [RAX] ADD RAX,0x4 CMP RAX,RSI JNZ 0x001019d8 CMP RDI,R10 JZ 0x00101aa0 LAB_001019ec: MOV RAX,R10 XOR ECX,ECX NOP dword ptr [RAX] LAB_001019f8: ADD ECX,dword ptr [RAX] ADD RAX,0x4 CMP RDI,RAX JNZ 0x001019f8 LAB_00101a03: CMP EDX,ECX CMOVL R9,R10 CMOVL RSI,RDI CMOVL R12,R8 LAB_00101a11: ADD R8,0x18 CMP R11,R8 JNZ 0x001019c0 LAB_00101a1a: PXOR XMM0,XMM0 MOV RBX,RSI MOV qword ptr [RBP + 0x10],0x0 MOVUPS xmmword ptr [RBP],XMM0 SUB RBX,R9 JZ 0x00101aa7 MOV RAX,0x7ffffffffffffffc CMP RAX,RBX JC 0x00101ab3 MOV RDI,RBX CALL 0x00101190 MOV RCX,RAX LAB_00101a4c: MOVQ XMM0,RCX LEA RSI,[RCX + RBX*0x1] PUNPCKLQDQ XMM0,XMM0 MOV qword ptr [RBP + 0x10],RSI MOVUPS xmmword ptr [RBP],XMM0 MOV RSI,qword ptr [R12] MOV RBX,qword ptr [R12 + 0x8] SUB RBX,RSI CMP RBX,0x4 JLE 0x00101aab MOV RDI,RCX MOV RDX,RBX CALL 0x001011d0 MOV RCX,RAX LAB_00101a81: ADD RCX,RBX MOV RAX,RBP MOV qword ptr [RBP + 0x8],RCX POP RBX POP RBP POP R12 RET LAB_00101a90: XOR EDX,EDX CMP RDI,R10 JNZ 0x001019ec JMP 0x00101a11 LAB_00101aa0: XOR ECX,ECX JMP 0x00101a03 LAB_00101aa7: XOR ECX,ECX JMP 0x00101a4c LAB_00101aab: JNZ 0x00101a81 MOV EAX,dword ptr [RSI] MOV dword ptr [RCX],EAX JMP 0x00101a81 LAB_00101ab3: CALL 0x00101170 NOP dword ptr [RAX + RAX*0x1]
/* func0(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) */ vector * func0(vector *param_1) { vector *pvVar1; int4 *__src; int8 *puVar2; vector *pvVar3; int4 *__dest; vector *extraout_RAX; int iVar4; int iVar5; ulong uVar6; size_t __n; int8 *in_RSI; vector *pvVar7; vector *pvVar8; vector *pvVar9; int8 *puVar10; puVar10 = (int8 *)*in_RSI; pvVar9 = (vector *)*puVar10; pvVar7 = (vector *)puVar10[1]; pvVar8 = param_1; puVar2 = puVar10; if (puVar10 != (int8 *)in_RSI[1]) { joined_r0x001019b8: puVar2 = puVar2 + 3; if ((int8 *)in_RSI[1] != puVar2) { pvVar8 = (vector *)puVar2[1]; pvVar1 = (vector *)*puVar2; if (pvVar7 == pvVar9) goto LAB_00101a90; iVar5 = 0; pvVar3 = pvVar9; do { iVar5 = iVar5 + *(int *)pvVar3; pvVar3 = pvVar3 + 4; } while (pvVar3 != pvVar7); if (pvVar8 != pvVar1) goto LAB_001019ec; iVar4 = 0; goto LAB_00101a03; } } *(int8 *)(param_1 + 0x10) = 0; *(int (*) [16])param_1 = (int [16])0x0; uVar6 = (long)pvVar7 - (long)pvVar9; if (uVar6 == 0) { __dest = (int4 *)0x0; } else { if (0x7ffffffffffffffc < uVar6) { std::__throw_bad_array_new_length(); pvVar9 = *(vector **)pvVar8; if (pvVar9 != (vector *)0x0) { operator_delete(pvVar9,*(long *)(pvVar8 + 0x10) - (long)pvVar9); return extraout_RAX; } return pvVar9; } __dest = (int4 *)operator_new(uVar6); } *(ulong *)(param_1 + 0x10) = (long)__dest + uVar6; *(int4 **)param_1 = __dest; *(int4 **)(param_1 + 8) = __dest; __src = (int4 *)*puVar10; __n = puVar10[1] - (long)__src; if ((long)__n < 5) { if (__n == 4) { *__dest = *__src; } } else { __dest = (int4 *)memmove(__dest,__src,__n); } *(size_t *)(param_1 + 8) = (long)__dest + __n; return param_1; LAB_00101a90: iVar5 = 0; if (pvVar8 != pvVar1) { LAB_001019ec: iVar4 = 0; pvVar3 = pvVar1; do { iVar4 = iVar4 + *(int *)pvVar3; pvVar3 = pvVar3 + 4; } while (pvVar8 != pvVar3); LAB_00101a03: if (iVar5 < iVar4) { puVar10 = puVar2; pvVar9 = pvVar1; pvVar7 = pvVar8; } } goto joined_r0x001019b8; }
3,219
func0
#include <vector> #include <algorithm> #include <assert.h> #include <numeric>
std::vector<int> func0(const std::vector<std::vector<int>>& lists) { return *std::max_element(lists.begin(), lists.end(), [](const std::vector<int>& a, const std::vector<int>& b) { return std::accumulate(a.begin(), a.end(), 0) < std::accumulate(b.begin(), b.end(), 0); }); }
int main() { assert((func0({{1, 2, 3}, {4, 5, 6}, {10, 11, 12}, {7, 8, 9}}) == std::vector<int>{10, 11, 12})); assert((func0({{3, 2, 1}, {6, 5, 4}, {12, 11, 10}}) == std::vector<int>{12, 11, 10})); assert((func0({{2, 3, 1}}) == std::vector<int>{2, 3, 1})); return 0; }
O3
cpp
func0(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&): endbr64 push %r14 push %r13 push %r12 mov %rdi,%r12 push %rbp push %rbx mov (%rsi),%rbp mov 0x8(%rsi),%r10 mov 0x0(%rbp),%rcx mov 0x8(%rbp),%rbx cmp %rbp,%r10 je 1af0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x1a0> movabs $0x3ffffffffffffffc,%r11 lea 0x18(%rbp),%rsi cmp %rsi,%r10 je 1af0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x1a0> xchg %ax,%ax mov (%rsi),%r8 mov 0x8(%rsi),%r9 cmp %rcx,%rbx je 1b80 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x230> lea -0x4(%rbx),%rax mov %rcx,%rdx sub %rcx,%rax shr $0x2,%rax lea 0x1(%rax),%rdi test %r11,%rax je 1bb0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x260> mov %rdi,%rax pxor %xmm0,%xmm0 shr $0x2,%rax shl $0x4,%rax add %rcx,%rax nopl (%rax) movdqu (%rdx),%xmm2 add $0x10,%rdx paddd %xmm2,%xmm0 cmp %rdx,%rax jne 19d0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x80> movdqa %xmm0,%xmm1 mov %rdi,%r13 psrldq $0x8,%xmm1 and $0xfffffffffffffffc,%r13 paddd %xmm1,%xmm0 lea (%rcx,%r13,4),%rdx movdqa %xmm0,%xmm1 psrldq $0x4,%xmm1 paddd %xmm1,%xmm0 movd %xmm0,%eax cmp %r13,%rdi je 1a35 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xe5> lea 0x4(%rdx),%rdi add (%rdx),%eax cmp %rdi,%rbx je 1a35 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xe5> lea 0x8(%rdx),%rdi add 0x4(%rdx),%eax cmp %rdi,%rbx je 1a35 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xe5> lea 0xc(%rdx),%rdi add 0x8(%rdx),%eax cmp %rdi,%rbx je 1a35 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xe5> add 0xc(%rdx),%eax cmp %r9,%r8 je 1b90 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x240> lea -0x4(%r9),%rdx mov %r8,%rdi sub %r8,%rdx shr $0x2,%rdx lea 0x1(%rdx),%r13 test %r11,%rdx je 1ba0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x250> mov %r13,%rdx pxor %xmm0,%xmm0 shr $0x2,%rdx shl $0x4,%rdx add %r8,%rdx nopl 0x0(%rax,%rax,1) movdqu (%rdi),%xmm3 add $0x10,%rdi paddd %xmm3,%xmm0 cmp %rdi,%rdx jne 1a70 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x120> movdqa %xmm0,%xmm1 mov %r13,%r14 psrldq $0x8,%xmm1 and $0xfffffffffffffffc,%r14 paddd %xmm1,%xmm0 lea (%r8,%r14,4),%rdi movdqa %xmm0,%xmm1 psrldq $0x4,%xmm1 paddd %xmm1,%xmm0 movd %xmm0,%edx cmp %r14,%r13 je 1ad5 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x185> lea 0x4(%rdi),%r13 add (%rdi),%edx cmp %r13,%r9 je 1ad5 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x185> lea 0x8(%rdi),%r13 add 0x4(%rdi),%edx cmp %r13,%r9 je 1ad5 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x185> lea 0xc(%rdi),%r13 add 0x8(%rdi),%edx cmp %r13,%r9 je 1ad5 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x185> add 0xc(%rdi),%edx cmp %edx,%eax cmovl %r9,%rbx cmovl %r8,%rcx cmovl %rsi,%rbp add $0x18,%rsi cmp %rsi,%r10 jne 1990 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x40> movq $0x0,0x10(%r12) sub %rcx,%rbx pxor %xmm0,%xmm0 mov %rbx,%rax movups %xmm0,(%r12) sar $0x2,%rax je 1bc0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x270> movabs $0x1fffffffffffffff,%rdx cmp %rdx,%rax ja 1bc7 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x277> mov %rbx,%rdi callq 1180 <_Znwm@plt> mov %rax,%rcx movq %rcx,%xmm0 add %rcx,%rbx punpcklqdq %xmm0,%xmm0 mov %rbx,0x10(%r12) movups %xmm0,(%r12) mov 0x8(%rbp),%rax mov 0x0(%rbp),%rsi mov %rax,%rbx sub %rsi,%rbx cmp %rsi,%rax je 1b67 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x217> mov %rcx,%rdi mov %rbx,%rdx callq 11b0 <memmove@plt> mov %rax,%rcx add %rbx,%rcx mov %r12,%rax pop %rbx pop %rbp mov %rcx,0x8(%r12) pop %r12 pop %r13 pop %r14 retq nopl 0x0(%rax,%rax,1) xor %eax,%eax cmp %r9,%r8 jne 1a3e <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xee> jmpq 1ae3 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x193> xor %edx,%edx jmpq 1ad5 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x185> nopw 0x0(%rax,%rax,1) xor %edx,%edx jmpq 1aaf <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x15f> nopw 0x0(%rax,%rax,1) xor %eax,%eax jmpq 1a0f <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xbf> nopw 0x0(%rax,%rax,1) xor %ecx,%ecx jmpq 1b30 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x1e0> callq 1110 <_ZSt17__throw_bad_allocv@plt> nopl 0x0(%rax)
_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE: endbr64 push r12 push rbp push rbx mov rbp, [rsi] mov rbx, rdi mov r11, [rsi+8] mov rdi, [rbp+8] mov rsi, [rbp+0] cmp rbp, r11 jz loc_1BB2 lea r8, [rbp+18h] cmp r11, r8 jz loc_1BB2 loc_1A60: mov r10, [r8+8] mov r9, [r8] cmp rdi, rsi jz loc_1C30 lea rdx, [rdi-4] mov rax, rsi sub rdx, rsi mov rcx, rdx shr rcx, 2 add rcx, 1 cmp rdx, 8 jbe loc_1C51 mov rdx, rcx pxor xmm0, xmm0 shr rdx, 2 shl rdx, 4 add rdx, rsi nop dword ptr [rax+00000000h] loc_1AA8: movdqu xmm2, xmmword ptr [rax] add rax, 10h paddd xmm0, xmm2 cmp rdx, rax jnz short loc_1AA8 movdqa xmm1, xmm0 psrldq xmm1, 8 paddd xmm0, xmm1 movdqa xmm1, xmm0 psrldq xmm1, 4 paddd xmm0, xmm1 movd edx, xmm0 test cl, 3 jz short loc_1AFE and rcx, 0FFFFFFFFFFFFFFFCh lea rax, [rsi+rcx*4] loc_1AE4: lea rcx, [rax+4] add edx, [rax] cmp rdi, rcx jz short loc_1AFE lea rcx, [rax+8] add edx, [rax+4] cmp rdi, rcx jz short loc_1AFE add edx, [rax+8] loc_1AFE: cmp r10, r9 jz loc_1C40 loc_1B07: lea rcx, [r10-4] mov rax, r9 sub rcx, r9 mov r12, rcx shr r12, 2 add r12, 1 cmp rcx, 8 jbe loc_1C47 mov rcx, r12 pxor xmm0, xmm0 shr rcx, 2 shl rcx, 4 add rcx, r9 nop dword ptr [rax+rax+00000000h] loc_1B40: movdqu xmm3, xmmword ptr [rax] add rax, 10h paddd xmm0, xmm3 cmp rax, rcx jnz short loc_1B40 movdqa xmm1, xmm0 psrldq xmm1, 8 paddd xmm0, xmm1 movdqa xmm1, xmm0 psrldq xmm1, 4 paddd xmm0, xmm1 movd eax, xmm0 test r12b, 3 jz short loc_1B97 and r12, 0FFFFFFFFFFFFFFFCh lea rcx, [r9+r12*4] loc_1B7D: lea r12, [rcx+4] add eax, [rcx] cmp r10, r12 jz short loc_1B97 lea r12, [rcx+8] add eax, [rcx+4] cmp r10, r12 jz short loc_1B97 add eax, [rcx+8] loc_1B97: cmp edx, eax cmovl rsi, r9 cmovl rdi, r10 cmovl rbp, r8 loc_1BA5: add r8, 18h cmp r11, r8 jnz loc_1A60 loc_1BB2: pxor xmm0, xmm0 sub rdi, rsi; unsigned __int64 mov qword ptr [rbx+10h], 0 movups xmmword ptr [rbx], xmm0 mov r12, rdi jz loc_1C58 mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rdi jb loc_1C64 call __Znwm; operator new(ulong) mov rcx, rax loc_1BE8: movq xmm0, rcx lea rdi, [rcx+r12] punpcklqdq xmm0, xmm0 mov [rbx+10h], rdi movups xmmword ptr [rbx], xmm0 mov rsi, [rbp+0]; src mov rbp, [rbp+8] sub rbp, rsi cmp rbp, 4 jle short loc_1C5C mov rdi, rcx; dest mov rdx, rbp; n call _memmove mov rcx, rax loc_1C1B: add rcx, rbp mov rax, rbx mov [rbx+8], rcx pop rbx pop rbp pop r12 retn loc_1C30: xor edx, edx cmp r10, r9 jnz loc_1B07 jmp loc_1BA5 loc_1C40: xor eax, eax jmp loc_1B97 loc_1C47: mov rcx, r9 xor eax, eax jmp loc_1B7D loc_1C51: xor edx, edx jmp loc_1AE4 loc_1C58: xor ecx, ecx jmp short loc_1BE8 loc_1C5C: jnz short loc_1C1B mov eax, [rsi] mov [rcx], eax jmp short loc_1C1B loc_1C64: call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) nop dword ptr [rax+00000000h]
long long func0(long long a1, const __m128i ***a2) { const __m128i **v2; // rbp const __m128i **v4; // r11 const __m128i *v5; // rdi const __m128i *v6; // rsi const __m128i **v7; // r8 const __m128i *v8; // r10 const __m128i *v9; // r9 const __m128i *v10; // rax unsigned long long v11; // rcx __m128i v12; // xmm0 __m128i v13; // xmm2 __m128i v14; // xmm0 int v15; // edx const __m128i *v16; // rax unsigned long long v17; // r12 __m128i v18; // xmm0 __m128i v19; // xmm3 __m128i v20; // xmm0 int v21; // eax const __m128i *v22; // rcx unsigned long long v23; // rdi _DWORD *v24; // rcx const __m128i *v25; // rsi signed long long v26; // rbp long long result; // rax v2 = *a2; v4 = a2[1]; v5 = (*a2)[1]; v6 = **a2; if ( v2 != v4 ) { v7 = v2 + 3; if ( v4 != v2 + 3 ) { while ( 1 ) { v8 = v7[1]; v9 = *v7; if ( v5 != v6 ) break; v15 = 0; if ( v8 != v9 ) goto LABEL_13; LABEL_23: v7 += 3; if ( v4 == v7 ) goto LABEL_24; } v10 = v6; v11 = ((unsigned long long)((char *)&v5[-1].m128i_u64[1] + 4 - (char *)v6) >> 2) + 1; if ( (unsigned long long)((char *)&v5[-1].m128i_u64[1] + 4 - (char *)v6) <= 8 ) { v15 = 0; } else { v12 = 0LL; do { v13 = _mm_loadu_si128(v10++); v12 = _mm_add_epi32(v12, v13); } while ( &v6[v11 >> 2] != v10 ); v14 = _mm_add_epi32(v12, _mm_srli_si128(v12, 8)); v15 = _mm_cvtsi128_si32(_mm_add_epi32(v14, _mm_srli_si128(v14, 4))); if ( (v11 & 3) == 0 ) goto LABEL_12; v10 = (const __m128i *)((char *)v6 + 4 * (v11 & 0xFFFFFFFFFFFFFFFCLL)); } v15 += v10->m128i_i32[0]; if ( v5 != (const __m128i *)((char *)v10->m128i_i64 + 4) ) { v15 += v10->m128i_i32[1]; if ( v5 != (const __m128i *)&v10->m128i_u64[1] ) v15 += v10->m128i_i32[2]; } LABEL_12: if ( v8 == v9 ) { v21 = 0; } else { LABEL_13: v16 = *v7; v17 = ((unsigned long long)((char *)&v8[-1].m128i_u64[1] + 4 - (char *)v9) >> 2) + 1; if ( (unsigned long long)((char *)&v8[-1].m128i_u64[1] + 4 - (char *)v9) <= 8 ) { v22 = *v7; v21 = 0; goto LABEL_18; } v18 = 0LL; do { v19 = _mm_loadu_si128(v16++); v18 = _mm_add_epi32(v18, v19); } while ( v16 != &v9[v17 >> 2] ); v20 = _mm_add_epi32(v18, _mm_srli_si128(v18, 8)); v21 = _mm_cvtsi128_si32(_mm_add_epi32(v20, _mm_srli_si128(v20, 4))); if ( (v17 & 3) != 0 ) { v22 = (const __m128i *)((char *)v9 + 4 * (v17 & 0xFFFFFFFFFFFFFFFCLL)); LABEL_18: v21 += v22->m128i_i32[0]; if ( v8 != (const __m128i *)((char *)v22->m128i_i64 + 4) ) { v21 += v22->m128i_i32[1]; if ( v8 != (const __m128i *)&v22->m128i_u64[1] ) v21 += v22->m128i_i32[2]; } } } if ( v15 < v21 ) { v6 = *v7; v5 = v7[1]; v2 = v7; } goto LABEL_23; } } LABEL_24: v23 = (char *)v5 - (char *)v6; *(_QWORD *)(a1 + 16) = 0LL; *(_OWORD *)a1 = 0LL; if ( v23 ) { if ( v23 > 0x7FFFFFFFFFFFFFFCLL ) { std::__throw_bad_array_new_length(); return std::vector<int>::~vector(); } v24 = (_DWORD *)operator new(v23); } else { v24 = 0LL; } *(_QWORD *)(a1 + 16) = (char *)v24 + v23; *(__m128i *)a1 = _mm_unpacklo_epi64((__m128i)(unsigned long long)v24, (__m128i)(unsigned long long)v24); v25 = *v2; v26 = (char *)v2[1] - (char *)*v2; if ( v26 <= 4 ) { if ( v26 == 4 ) *v24 = v25->m128i_i32[0]; } else { v24 = memmove(v24, v25, v26); } result = a1; *(_QWORD *)(a1 + 8) = (char *)v24 + v26; return result; }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX MOV RBP,qword ptr [RSI] MOV RBX,RDI MOV R11,qword ptr [RSI + 0x8] MOV RDI,qword ptr [RBP + 0x8] MOV RSI,qword ptr [RBP] CMP RBP,R11 JZ 0x00101bb2 LEA R8,[RBP + 0x18] CMP R11,R8 JZ 0x00101bb2 LAB_00101a60: MOV R10,qword ptr [R8 + 0x8] MOV R9,qword ptr [R8] CMP RDI,RSI JZ 0x00101c30 LEA RDX,[RDI + -0x4] MOV RAX,RSI SUB RDX,RSI MOV RCX,RDX SHR RCX,0x2 ADD RCX,0x1 CMP RDX,0x8 JBE 0x00101c51 MOV RDX,RCX PXOR XMM0,XMM0 SHR RDX,0x2 SHL RDX,0x4 ADD RDX,RSI NOP dword ptr [RAX] LAB_00101aa8: MOVDQU XMM2,xmmword ptr [RAX] ADD RAX,0x10 PADDD XMM0,XMM2 CMP RDX,RAX JNZ 0x00101aa8 MOVDQA XMM1,XMM0 PSRLDQ XMM1,0x8 PADDD XMM0,XMM1 MOVDQA XMM1,XMM0 PSRLDQ XMM1,0x4 PADDD XMM0,XMM1 MOVD EDX,XMM0 TEST CL,0x3 JZ 0x00101afe AND RCX,-0x4 LEA RAX,[RSI + RCX*0x4] LAB_00101ae4: LEA RCX,[RAX + 0x4] ADD EDX,dword ptr [RAX] CMP RDI,RCX JZ 0x00101afe LEA RCX,[RAX + 0x8] ADD EDX,dword ptr [RAX + 0x4] CMP RDI,RCX JZ 0x00101afe ADD EDX,dword ptr [RAX + 0x8] LAB_00101afe: CMP R10,R9 JZ 0x00101c40 LAB_00101b07: LEA RCX,[R10 + -0x4] MOV RAX,R9 SUB RCX,R9 MOV R12,RCX SHR R12,0x2 ADD R12,0x1 CMP RCX,0x8 JBE 0x00101c47 MOV RCX,R12 PXOR XMM0,XMM0 SHR RCX,0x2 SHL RCX,0x4 ADD RCX,R9 NOP dword ptr [RAX + RAX*0x1] LAB_00101b40: MOVDQU XMM3,xmmword ptr [RAX] ADD RAX,0x10 PADDD XMM0,XMM3 CMP RAX,RCX JNZ 0x00101b40 MOVDQA XMM1,XMM0 PSRLDQ XMM1,0x8 PADDD XMM0,XMM1 MOVDQA XMM1,XMM0 PSRLDQ XMM1,0x4 PADDD XMM0,XMM1 MOVD EAX,XMM0 TEST R12B,0x3 JZ 0x00101b97 AND R12,-0x4 LEA RCX,[R9 + R12*0x4] LAB_00101b7d: LEA R12,[RCX + 0x4] ADD EAX,dword ptr [RCX] CMP R10,R12 JZ 0x00101b97 LEA R12,[RCX + 0x8] ADD EAX,dword ptr [RCX + 0x4] CMP R10,R12 JZ 0x00101b97 ADD EAX,dword ptr [RCX + 0x8] LAB_00101b97: CMP EDX,EAX CMOVL RSI,R9 CMOVL RDI,R10 CMOVL RBP,R8 LAB_00101ba5: ADD R8,0x18 CMP R11,R8 JNZ 0x00101a60 LAB_00101bb2: PXOR XMM0,XMM0 SUB RDI,RSI MOV qword ptr [RBX + 0x10],0x0 MOVUPS xmmword ptr [RBX],XMM0 MOV R12,RDI JZ 0x00101c58 MOV RAX,0x7ffffffffffffffc CMP RAX,RDI JC 0x00101c64 CALL 0x00101190 MOV RCX,RAX LAB_00101be8: MOVQ XMM0,RCX LEA RDI,[RCX + R12*0x1] PUNPCKLQDQ XMM0,XMM0 MOV qword ptr [RBX + 0x10],RDI MOVUPS xmmword ptr [RBX],XMM0 MOV RSI,qword ptr [RBP] MOV RBP,qword ptr [RBP + 0x8] SUB RBP,RSI CMP RBP,0x4 JLE 0x00101c5c MOV RDI,RCX MOV RDX,RBP CALL 0x001011d0 MOV RCX,RAX LAB_00101c1b: ADD RCX,RBP MOV RAX,RBX MOV qword ptr [RBX + 0x8],RCX POP RBX POP RBP POP R12 RET LAB_00101c30: XOR EDX,EDX CMP R10,R9 JNZ 0x00101b07 JMP 0x00101ba5 LAB_00101c40: XOR EAX,EAX JMP 0x00101b97 LAB_00101c47: MOV RCX,R9 XOR EAX,EAX JMP 0x00101b7d LAB_00101c51: XOR EDX,EDX JMP 0x00101ae4 LAB_00101c58: XOR ECX,ECX JMP 0x00101be8 LAB_00101c5c: JNZ 0x00101c1b MOV EAX,dword ptr [RSI] MOV dword ptr [RCX],EAX JMP 0x00101c1b LAB_00101c64: CALL 0x00101170 NOP dword ptr [RAX]
/* func0(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&) */ vector * func0(vector *param_1) { int *piVar1; int *piVar2; int4 *__src; vector *pvVar3; int *piVar4; int *piVar5; int *piVar6; int iVar7; int8 *puVar8; int *piVar9; int4 *__dest; vector *extraout_RAX; ulong uVar10; ulong uVar11; int8 *puVar12; size_t __n; int8 *in_RSI; int *piVar13; int *piVar14; int8 *puVar15; int iVar16; int iVar17; int iVar18; int iVar19; int iVar20; puVar12 = (int8 *)*in_RSI; piVar14 = (int *)puVar12[1]; piVar13 = (int *)*puVar12; puVar15 = puVar12; if (puVar12 == (int8 *)in_RSI[1]) { LAB_00101bb2: puVar15 = (int8 *)((long)piVar14 - (long)piVar13); *(int8 *)(param_1 + 0x10) = 0; *(int (*) [16])param_1 = (int [16])0x0; if (puVar15 == (int8 *)0x0) { __dest = (int4 *)0x0; } else { if ((int8 *)0x7ffffffffffffffc < puVar15) { std::__throw_bad_array_new_length(); pvVar3 = (vector *)*puVar15; if (pvVar3 == (vector *)0x0) { return pvVar3; } operator_delete(pvVar3,puVar15[2] - (long)pvVar3); return extraout_RAX; } __dest = (int4 *)operator_new((ulong)puVar15); } *(long *)(param_1 + 0x10) = (long)__dest + (long)puVar15; *(int4 **)param_1 = __dest; *(int4 **)(param_1 + 8) = __dest; __src = (int4 *)*puVar12; __n = puVar12[1] - (long)__src; if ((long)__n < 5) { if (__n == 4) { *__dest = *__src; } } else { __dest = (int4 *)memmove(__dest,__src,__n); } *(size_t *)(param_1 + 8) = (long)__dest + __n; return param_1; } joined_r0x00101a5a: puVar8 = puVar15 + 3; if ((int8 *)in_RSI[1] != puVar8) { piVar1 = (int *)puVar15[4]; piVar2 = (int *)*puVar8; puVar15 = puVar8; if (piVar14 == piVar13) goto LAB_00101c30; uVar11 = (long)piVar14 + (-4 - (long)piVar13); uVar10 = (uVar11 >> 2) + 1; if (uVar11 < 9) { iVar16 = 0; piVar9 = piVar13; LAB_00101ae4: iVar16 = iVar16 + *piVar9; if ((piVar14 != piVar9 + 1) && (iVar16 = iVar16 + piVar9[1], piVar14 != piVar9 + 2)) { iVar16 = iVar16 + piVar9[2]; } } else { iVar16 = 0; iVar17 = 0; iVar18 = 0; iVar19 = 0; piVar9 = piVar13; do { iVar20 = *piVar9; piVar4 = piVar9 + 1; piVar5 = piVar9 + 2; piVar6 = piVar9 + 3; piVar9 = piVar9 + 4; iVar16 = iVar16 + iVar20; iVar17 = iVar17 + *piVar4; iVar18 = iVar18 + *piVar5; iVar19 = iVar19 + *piVar6; } while (piVar13 + (uVar10 & 0xfffffffffffffffc) != piVar9); iVar16 = iVar16 + iVar18 + iVar17 + iVar19; if ((uVar10 & 3) != 0) { piVar9 = piVar13 + (uVar10 & 0xfffffffffffffffc); goto LAB_00101ae4; } } if (piVar1 != piVar2) goto LAB_00101b07; iVar17 = 0; goto LAB_00101b97; } goto LAB_00101bb2; LAB_00101c30: iVar16 = 0; if (piVar1 == piVar2) goto joined_r0x00101a5a; LAB_00101b07: uVar10 = (long)piVar1 + (-4 - (long)piVar2); uVar11 = (uVar10 >> 2) + 1; if (uVar10 < 9) { iVar17 = 0; piVar9 = piVar2; } else { iVar17 = 0; iVar18 = 0; iVar19 = 0; iVar20 = 0; piVar9 = piVar2; do { iVar7 = *piVar9; piVar4 = piVar9 + 1; piVar5 = piVar9 + 2; piVar6 = piVar9 + 3; piVar9 = piVar9 + 4; iVar17 = iVar17 + iVar7; iVar18 = iVar18 + *piVar4; iVar19 = iVar19 + *piVar5; iVar20 = iVar20 + *piVar6; } while (piVar9 != piVar2 + (uVar11 & 0xfffffffffffffffc)); iVar17 = iVar17 + iVar19 + iVar18 + iVar20; if ((uVar11 & 3) == 0) goto LAB_00101b97; piVar9 = piVar2 + (uVar11 & 0xfffffffffffffffc); } iVar17 = iVar17 + *piVar9; if ((piVar1 != piVar9 + 1) && (iVar17 = iVar17 + piVar9[1], piVar1 != piVar9 + 2)) { iVar17 = iVar17 + piVar9[2]; } LAB_00101b97: if (iVar16 < iVar17) { puVar12 = puVar8; piVar14 = piVar1; piVar13 = piVar2; } goto joined_r0x00101a5a; }
3,220
func0
#include <string> #include <cassert>
int func0(std::string test_str) { int cnt = 0; int res = 0; for (int idx = 0; idx < test_str.length(); ++idx) { if (isupper(test_str[idx])) { cnt += 1; } else { if (cnt > res) { res = cnt; } cnt = 0; } } if (isupper(test_str[test_str.length() - 1])) { if (cnt > res) { res = cnt; } } return res; }
int main() { assert(func0("GeMKSForGERksISBESt") == 5); assert(func0("PrECIOusMOVemENTSYT") == 6); assert(func0("GooGLEFluTTER") == 4); return 0; }
O0
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x28,%rsp mov %rdi,-0x28(%rbp) movl $0x0,-0x1c(%rbp) movl $0x0,-0x18(%rbp) movl $0x0,-0x14(%rbp) mov -0x14(%rbp),%eax movslq %eax,%rbx mov -0x28(%rbp),%rax mov %rax,%rdi callq 12b0 <_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv@plt> cmp %rax,%rbx setb %al test %al,%al je 1497 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x8e> mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1310 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm@plt> movzbl (%rax),%eax movsbl %al,%eax mov %eax,%edi callq 1210 <isupper@plt> test %eax,%eax setne %al test %al,%al je 147c <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x73> addl $0x1,-0x1c(%rbp) jmp 1491 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x88> mov -0x1c(%rbp),%eax cmp -0x18(%rbp),%eax jle 148a <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x81> mov -0x1c(%rbp),%eax mov %eax,-0x18(%rbp) movl $0x0,-0x1c(%rbp) addl $0x1,-0x14(%rbp) jmp 142f <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x26> mov -0x28(%rbp),%rax mov %rax,%rdi callq 12b0 <_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv@plt> lea -0x1(%rax),%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1310 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm@plt> movzbl (%rax),%eax movsbl %al,%eax mov %eax,%edi callq 1210 <isupper@plt> test %eax,%eax setne %al test %al,%al je 14da <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd1> mov -0x1c(%rbp),%eax cmp -0x18(%rbp),%eax jle 14da <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd1> mov -0x1c(%rbp),%eax mov %eax,-0x18(%rbp) mov -0x18(%rbp),%eax add $0x28,%rsp pop %rbx pop %rbp retq
_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 28h mov [rbp+var_28], rdi mov [rbp+var_1C], 0 mov [rbp+var_18], 0 mov [rbp+var_14], 0 jmp short loc_13DB loc_1391: mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm; std::string::operator[](ulong) movzx eax, byte ptr [rax] movsx eax, al mov edi, eax; int call _isupper test eax, eax setnz al test al, al jz short loc_13C2 add [rbp+var_1C], 1 jmp short loc_13D7 loc_13C2: mov eax, [rbp+var_1C] cmp eax, [rbp+var_18] jle short loc_13D0 mov eax, [rbp+var_1C] mov [rbp+var_18], eax loc_13D0: mov [rbp+var_1C], 0 loc_13D7: add [rbp+var_14], 1 loc_13DB: mov eax, [rbp+var_14] movsxd rbx, eax mov rax, [rbp+var_28] mov rdi, rax call __ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv; std::string::length(void) cmp rbx, rax setb al test al, al jnz short loc_1391 mov rax, [rbp+var_28] mov rdi, rax call __ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv; std::string::length(void) lea rdx, [rax-1] mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm; std::string::operator[](ulong) movzx eax, byte ptr [rax] movsx eax, al mov edi, eax; int call _isupper test eax, eax setnz al test al, al jz short loc_143A mov eax, [rbp+var_1C] cmp eax, [rbp+var_18] jle short loc_143A mov eax, [rbp+var_1C] mov [rbp+var_18], eax loc_143A: mov eax, [rbp+var_18] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1) { char *v1; // rax long long v2; // rax char *v3; // rax signed int v5; // [rsp+14h] [rbp-1Ch] signed int v6; // [rsp+18h] [rbp-18h] int i; // [rsp+1Ch] [rbp-14h] v5 = 0; v6 = 0; for ( i = 0; i < (unsigned long long)std::string::length(a1); ++i ) { v1 = (char *)std::string::operator[](a1, i); if ( isupper(*v1) ) { ++v5; } else { if ( v5 > v6 ) v6 = v5; v5 = 0; } } v2 = std::string::length(a1); v3 = (char *)std::string::operator[](a1, v2 - 1); if ( isupper(*v3) && v5 > v6 ) return (unsigned int)v5; return (unsigned int)v6; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x28 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x1c],0x0 MOV dword ptr [RBP + -0x18],0x0 MOV dword ptr [RBP + -0x14],0x0 JMP 0x001013db LAB_00101391: MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x00101270 MOVZX EAX,byte ptr [RAX] MOVSX EAX,AL MOV EDI,EAX CALL 0x001011b0 TEST EAX,EAX SETNZ AL TEST AL,AL JZ 0x001013c2 ADD dword ptr [RBP + -0x1c],0x1 JMP 0x001013d7 LAB_001013c2: MOV EAX,dword ptr [RBP + -0x1c] CMP EAX,dword ptr [RBP + -0x18] JLE 0x001013d0 MOV EAX,dword ptr [RBP + -0x1c] MOV dword ptr [RBP + -0x18],EAX LAB_001013d0: MOV dword ptr [RBP + -0x1c],0x0 LAB_001013d7: ADD dword ptr [RBP + -0x14],0x1 LAB_001013db: MOV EAX,dword ptr [RBP + -0x14] MOVSXD RBX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RDI,RAX CALL 0x00101230 CMP RBX,RAX SETC AL TEST AL,AL JNZ 0x00101391 MOV RAX,qword ptr [RBP + -0x28] MOV RDI,RAX CALL 0x00101230 LEA RDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x00101270 MOVZX EAX,byte ptr [RAX] MOVSX EAX,AL MOV EDI,EAX CALL 0x001011b0 TEST EAX,EAX SETNZ AL TEST AL,AL JZ 0x0010143a MOV EAX,dword ptr [RBP + -0x1c] CMP EAX,dword ptr [RBP + -0x18] JLE 0x0010143a MOV EAX,dword ptr [RBP + -0x1c] MOV dword ptr [RBP + -0x18],EAX LAB_0010143a: MOV EAX,dword ptr [RBP + -0x18] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::string) */ int func0(ulong param_1) { int iVar1; ulong uVar2; char *pcVar3; int4 local_24; int4 local_20; int4 local_1c; local_24 = 0; local_20 = 0; local_1c = 0; while( true ) { uVar2 = std::string::length(); if (uVar2 <= (ulong)(long)local_1c) break; pcVar3 = (char *)std::string::operator[](param_1); iVar1 = isupper((int)*pcVar3); if (iVar1 == 0) { if (local_20 < local_24) { local_20 = local_24; } local_24 = 0; } else { local_24 = local_24 + 1; } local_1c = local_1c + 1; } std::string::length(); pcVar3 = (char *)std::string::operator[](param_1); iVar1 = isupper((int)*pcVar3); if ((iVar1 != 0) && (local_20 < local_24)) { local_20 = local_24; } return local_20; }
3,221
func0
#include <string> #include <cassert>
int func0(std::string test_str) { int cnt = 0; int res = 0; for (int idx = 0; idx < test_str.length(); ++idx) { if (isupper(test_str[idx])) { cnt += 1; } else { if (cnt > res) { res = cnt; } cnt = 0; } } if (isupper(test_str[test_str.length() - 1])) { if (cnt > res) { res = cnt; } } return res; }
int main() { assert(func0("GeMKSForGERksISBESt") == 5); assert(func0("PrECIOusMOVemENTSYT") == 6); assert(func0("GooGLEFluTTER") == 4); return 0; }
O1
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov %rdi,%r14 mov 0x8(%rdi),%r15 test %r15,%r15 je 125e <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x55> mov (%rdi),%rbx lea (%rbx,%r15,1),%r13 mov $0x0,%r12d mov $0x0,%ebp jmp 124d <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x44> cmp %ebp,%r12d cmovl %ebp,%r12d mov %eax,%ebp add $0x1,%rbx cmp %r13,%rbx je 1269 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x60> movsbl (%rbx),%edi callq 10d0 <isupper@plt> test %eax,%eax je 123b <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x32> add $0x1,%ebp jmp 1244 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x3b> mov $0x0,%r12d mov $0x0,%ebp mov (%r14),%rax movsbl -0x1(%rax,%r15,1),%edi callq 10d0 <isupper@plt> test %eax,%eax je 1282 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x79> cmp %ebp,%r12d cmovl %ebp,%r12d mov %r12d,%eax add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq
_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 8 mov r14, rdi mov r15, [rdi+8] test r15, r15 jz short loc_127E mov rbx, [rdi] lea r13, [rbx+r15] mov r12d, 0 mov ebp, 0 jmp short loc_126D loc_125B: cmp r12d, ebp cmovl r12d, ebp mov ebp, eax loc_1264: add rbx, 1 cmp rbx, r13 jz short loc_1289 loc_126D: movsx edi, byte ptr [rbx]; int call _isupper test eax, eax jz short loc_125B add ebp, 1 jmp short loc_1264 loc_127E: mov r12d, 0 mov ebp, 0 loc_1289: mov rax, [r14] movsx edi, byte ptr [rax+r15-1]; int call _isupper cmp r12d, ebp cmovge ebp, r12d test eax, eax cmovnz r12d, ebp mov eax, r12d add rsp, 8 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn
long long func0(char **a1) { char *v1; // r15 char *v2; // rbx char *v3; // r13 signed int v4; // r12d signed int v5; // ebp int v6; // eax v1 = a1[1]; if ( v1 ) { v2 = *a1; v3 = &v1[(_QWORD)*a1]; v4 = 0; v5 = 0; do { if ( isupper(*v2) ) { ++v5; } else { if ( v4 < v5 ) v4 = v5; v5 = 0; } ++v2; } while ( v2 != v3 ); } else { v4 = 0; v5 = 0; } v6 = isupper(v1[(_QWORD)*a1 - 1]); if ( v4 >= v5 ) v5 = v4; if ( v6 ) return (unsigned int)v5; return (unsigned int)v4; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R14,RDI MOV R15,qword ptr [RDI + 0x8] TEST R15,R15 JZ 0x0010127e MOV RBX,qword ptr [RDI] LEA R13,[RBX + R15*0x1] MOV R12D,0x0 MOV EBP,0x0 JMP 0x0010126d LAB_0010125b: CMP R12D,EBP CMOVL R12D,EBP MOV EBP,EAX LAB_00101264: ADD RBX,0x1 CMP RBX,R13 JZ 0x00101289 LAB_0010126d: MOVSX EDI,byte ptr [RBX] CALL 0x001010f0 TEST EAX,EAX JZ 0x0010125b ADD EBP,0x1 JMP 0x00101264 LAB_0010127e: MOV R12D,0x0 MOV EBP,0x0 LAB_00101289: MOV RAX,qword ptr [R14] MOVSX EDI,byte ptr [RAX + R15*0x1 + -0x1] CALL 0x001010f0 CMP R12D,EBP CMOVGE EBP,R12D TEST EAX,EAX CMOVNZ R12D,EBP MOV EAX,R12D ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET
/* func0(std::string) */ int func0(long *param_1) { char *pcVar1; long lVar2; int iVar3; char *pcVar4; int iVar5; int iVar6; lVar2 = param_1[1]; if (lVar2 == 0) { iVar6 = 0; iVar5 = 0; } else { pcVar4 = (char *)*param_1; pcVar1 = pcVar4 + lVar2; iVar6 = 0; iVar5 = 0; do { iVar3 = isupper((int)*pcVar4); if (iVar3 == 0) { if (iVar6 < iVar5) { iVar6 = iVar5; } iVar5 = 0; } else { iVar5 = iVar5 + 1; } pcVar4 = pcVar4 + 1; } while (pcVar4 != pcVar1); } iVar3 = isupper((int)*(char *)(*param_1 + -1 + lVar2)); if (iVar5 <= iVar6) { iVar5 = iVar6; } if (iVar3 != 0) { iVar6 = iVar5; } return iVar6; }
3,222
func0
#include <string> #include <cassert>
int func0(std::string test_str) { int cnt = 0; int res = 0; for (int idx = 0; idx < test_str.length(); ++idx) { if (isupper(test_str[idx])) { cnt += 1; } else { if (cnt > res) { res = cnt; } cnt = 0; } } if (isupper(test_str[test_str.length() - 1])) { if (cnt > res) { res = cnt; } } return res; }
int main() { assert(func0("GeMKSForGERksISBESt") == 5); assert(func0("PrECIOusMOVemENTSYT") == 6); assert(func0("GooGLEFluTTER") == 4); return 0; }
O2
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov 0x8(%rdi),%r14 mov (%rdi),%r15 test %r14,%r14 je 13f8 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x88> mov %r15,%rbx lea (%r14,%r15,1),%r13 xor %r12d,%r12d xor %ebp,%ebp jmp 13ac <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x3c> nopl 0x0(%rax) add $0x1,%rbx add $0x1,%ebp cmp %rbx,%r13 je 13ca <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x5a> movsbl (%rbx),%edi callq 10f0 <isupper@plt> test %eax,%eax jne 13a0 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x30> cmp %ebp,%r12d cmovl %ebp,%r12d add $0x1,%rbx xor %ebp,%ebp cmp %rbx,%r13 jne 13ac <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x3c> sub $0x1,%r14 movsbl (%r15,%r14,1),%edi callq 10f0 <isupper@plt> test %eax,%eax je 13e3 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x73> cmp %ebp,%r12d cmovl %ebp,%r12d add $0x8,%rsp mov %r12d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl (%rax) mov $0xffffffffffffffff,%r14 xor %r12d,%r12d xor %ebp,%ebp jmp 13ce <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x5e> nopw %cs:0x0(%rax,%rax,1)
_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 8 mov r14, [rdi+8] mov r15, [rdi] test r14, r14 jz short loc_13E0 mov rbx, r15 lea r13, [r15+r14] xor r12d, r12d xor ebp, ebp jmp short loc_138C loc_1380: add rbx, 1 add ebp, 1 cmp r13, rbx jz short loc_13AA loc_138C: movsx edi, byte ptr [rbx]; int call _isupper test eax, eax jnz short loc_1380 cmp r12d, ebp cmovl r12d, ebp add rbx, 1 xor ebp, ebp cmp r13, rbx jnz short loc_138C loc_13AA: sub r14, 1 loc_13AE: movsx edi, byte ptr [r15+r14]; int call _isupper cmp r12d, ebp cmovge ebp, r12d test eax, eax cmovnz r12d, ebp add rsp, 8 pop rbx pop rbp mov eax, r12d pop r12 pop r13 pop r14 pop r15 retn loc_13E0: mov r14, 0FFFFFFFFFFFFFFFFh xor r12d, r12d xor ebp, ebp jmp short loc_13AE
long long func0(char **a1) { char *v1; // r14 char *v2; // r15 char *v3; // rbx char *v4; // r13 signed int v5; // r12d signed int v6; // ebp long long v7; // r14 int v8; // eax v1 = a1[1]; v2 = *a1; if ( v1 ) { v3 = *a1; v4 = &v1[(_QWORD)v2]; v5 = 0; v6 = 0; do { while ( isupper(*v3) ) { ++v3; ++v6; if ( v4 == v3 ) goto LABEL_8; } if ( v5 < v6 ) v5 = v6; ++v3; v6 = 0; } while ( v4 != v3 ); LABEL_8: v7 = (long long)(v1 - 1); } else { v7 = -1LL; v5 = 0; v6 = 0; } v8 = isupper(v2[v7]); if ( v5 >= v6 ) v6 = v5; if ( v8 ) return (unsigned int)v6; return (unsigned int)v5; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R14,qword ptr [RDI + 0x8] MOV R15,qword ptr [RDI] TEST R14,R14 JZ 0x001013e0 MOV RBX,R15 LEA R13,[R15 + R14*0x1] XOR R12D,R12D XOR EBP,EBP JMP 0x0010138c LAB_00101380: ADD RBX,0x1 ADD EBP,0x1 CMP R13,RBX JZ 0x001013aa LAB_0010138c: MOVSX EDI,byte ptr [RBX] CALL 0x001010f0 TEST EAX,EAX JNZ 0x00101380 CMP R12D,EBP CMOVL R12D,EBP ADD RBX,0x1 XOR EBP,EBP CMP R13,RBX JNZ 0x0010138c LAB_001013aa: SUB R14,0x1 LAB_001013ae: MOVSX EDI,byte ptr [R15 + R14*0x1] CALL 0x001010f0 CMP R12D,EBP CMOVGE EBP,R12D TEST EAX,EAX CMOVNZ R12D,EBP ADD RSP,0x8 POP RBX POP RBP MOV EAX,R12D POP R12 POP R13 POP R14 POP R15 RET LAB_001013e0: MOV R14,-0x1 XOR R12D,R12D XOR EBP,EBP JMP 0x001013ae
/* func0(std::string) */ int func0(int8 *param_1) { char *pcVar1; int iVar2; char *pcVar3; int iVar4; int iVar5; long lVar6; lVar6 = param_1[1]; pcVar1 = (char *)*param_1; if (lVar6 == 0) { lVar6 = -1; iVar5 = 0; iVar4 = 0; } else { iVar5 = 0; iVar4 = 0; pcVar3 = pcVar1; do { while( true ) { iVar2 = isupper((int)*pcVar3); if (iVar2 != 0) break; if (iVar5 < iVar4) { iVar5 = iVar4; } pcVar3 = pcVar3 + 1; iVar4 = 0; if (pcVar1 + lVar6 == pcVar3) goto LAB_001013aa; } pcVar3 = pcVar3 + 1; iVar4 = iVar4 + 1; } while (pcVar1 + lVar6 != pcVar3); LAB_001013aa: lVar6 = lVar6 + -1; } iVar2 = isupper((int)pcVar1[lVar6]); if (iVar4 <= iVar5) { iVar4 = iVar5; } if (iVar2 != 0) { iVar5 = iVar4; } return iVar5; }
3,223
func0
#include <string> #include <cassert>
int func0(std::string test_str) { int cnt = 0; int res = 0; for (int idx = 0; idx < test_str.length(); ++idx) { if (isupper(test_str[idx])) { cnt += 1; } else { if (cnt > res) { res = cnt; } cnt = 0; } } if (isupper(test_str[test_str.length() - 1])) { if (cnt > res) { res = cnt; } } return res; }
int main() { assert(func0("GeMKSForGERksISBESt") == 5); assert(func0("PrECIOusMOVemENTSYT") == 6); assert(func0("GooGLEFluTTER") == 4); return 0; }
O3
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov 0x8(%rdi),%r14 mov (%rdi),%r15 test %r14,%r14 je 13f8 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x88> mov %r15,%rbx lea (%r14,%r15,1),%r13 xor %r12d,%r12d xor %ebp,%ebp jmp 13ac <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x3c> nopl 0x0(%rax) add $0x1,%rbx add $0x1,%ebp cmp %rbx,%r13 je 13ca <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x5a> movsbl (%rbx),%edi callq 10f0 <isupper@plt> test %eax,%eax jne 13a0 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x30> cmp %ebp,%r12d cmovl %ebp,%r12d add $0x1,%rbx xor %ebp,%ebp cmp %rbx,%r13 jne 13ac <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x3c> sub $0x1,%r14 movsbl (%r15,%r14,1),%edi callq 10f0 <isupper@plt> test %eax,%eax je 13e3 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x73> cmp %ebp,%r12d cmovl %ebp,%r12d add $0x8,%rsp mov %r12d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl (%rax) mov $0xffffffffffffffff,%r14 xor %r12d,%r12d xor %ebp,%ebp jmp 13ce <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x5e> nopw %cs:0x0(%rax,%rax,1)
_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 8 mov r14, [rdi+8] mov r15, [rdi] test r14, r14 jz short loc_13E0 mov rbx, r15 lea r13, [r15+r14] xor r12d, r12d xor ebp, ebp jmp short loc_138C loc_1380: add rbx, 1 add ebp, 1 cmp r13, rbx jz short loc_13AA loc_138C: movsx edi, byte ptr [rbx]; int call _isupper test eax, eax jnz short loc_1380 cmp r12d, ebp cmovl r12d, ebp add rbx, 1 xor ebp, ebp cmp r13, rbx jnz short loc_138C loc_13AA: sub r14, 1 loc_13AE: movsx edi, byte ptr [r15+r14]; int call _isupper cmp r12d, ebp cmovge ebp, r12d test eax, eax cmovnz r12d, ebp add rsp, 8 pop rbx pop rbp mov eax, r12d pop r12 pop r13 pop r14 pop r15 retn loc_13E0: mov r14, 0FFFFFFFFFFFFFFFFh xor r12d, r12d xor ebp, ebp jmp short loc_13AE
long long func0(char **a1) { char *v1; // r14 char *v2; // r15 char *v3; // rbx char *v4; // r13 signed int v5; // r12d signed int v6; // ebp long long v7; // r14 int v8; // eax v1 = a1[1]; v2 = *a1; if ( v1 ) { v3 = *a1; v4 = &v1[(_QWORD)v2]; v5 = 0; v6 = 0; do { while ( isupper(*v3) ) { ++v3; ++v6; if ( v4 == v3 ) goto LABEL_8; } if ( v5 < v6 ) v5 = v6; ++v3; v6 = 0; } while ( v4 != v3 ); LABEL_8: v7 = (long long)(v1 - 1); } else { v7 = -1LL; v5 = 0; v6 = 0; } v8 = isupper(v2[v7]); if ( v5 >= v6 ) v6 = v5; if ( v8 ) return (unsigned int)v6; return (unsigned int)v5; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV R14,qword ptr [RDI + 0x8] MOV R15,qword ptr [RDI] TEST R14,R14 JZ 0x001013e0 MOV RBX,R15 LEA R13,[R15 + R14*0x1] XOR R12D,R12D XOR EBP,EBP JMP 0x0010138c LAB_00101380: ADD RBX,0x1 ADD EBP,0x1 CMP R13,RBX JZ 0x001013aa LAB_0010138c: MOVSX EDI,byte ptr [RBX] CALL 0x001010f0 TEST EAX,EAX JNZ 0x00101380 CMP R12D,EBP CMOVL R12D,EBP ADD RBX,0x1 XOR EBP,EBP CMP R13,RBX JNZ 0x0010138c LAB_001013aa: SUB R14,0x1 LAB_001013ae: MOVSX EDI,byte ptr [R15 + R14*0x1] CALL 0x001010f0 CMP R12D,EBP CMOVGE EBP,R12D TEST EAX,EAX CMOVNZ R12D,EBP ADD RSP,0x8 POP RBX POP RBP MOV EAX,R12D POP R12 POP R13 POP R14 POP R15 RET LAB_001013e0: MOV R14,-0x1 XOR R12D,R12D XOR EBP,EBP JMP 0x001013ae
/* func0(std::string) */ int func0(int8 *param_1) { char *pcVar1; int iVar2; char *pcVar3; int iVar4; int iVar5; long lVar6; lVar6 = param_1[1]; pcVar1 = (char *)*param_1; if (lVar6 == 0) { lVar6 = -1; iVar5 = 0; iVar4 = 0; } else { iVar5 = 0; iVar4 = 0; pcVar3 = pcVar1; do { while( true ) { iVar2 = isupper((int)*pcVar3); if (iVar2 != 0) break; if (iVar5 < iVar4) { iVar5 = iVar4; } pcVar3 = pcVar3 + 1; iVar4 = 0; if (pcVar1 + lVar6 == pcVar3) goto LAB_001013aa; } pcVar3 = pcVar3 + 1; iVar4 = iVar4 + 1; } while (pcVar1 + lVar6 != pcVar3); LAB_001013aa: lVar6 = lVar6 + -1; } iVar2 = isupper((int)pcVar1[lVar6]); if (iVar4 <= iVar5) { iVar4 = iVar5; } if (iVar2 != 0) { iVar5 = iVar4; } return iVar5; }
3,224
func0
#include <vector> #include <cassert>
int func0(std::vector<int> nums) { for (int el : nums) { if (el % 2 != 0) { return el; } } return -1; }
int main() { assert(func0({1, 3, 5}) == 1); assert(func0({2, 4, 1, 3}) == 1); assert(func0({8, 9, 1}) == 9); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> >): endbr64 push %rbp mov %rsp,%rbp sub $0x40,%rsp mov %rdi,-0x38(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax mov -0x38(%rbp),%rax mov %rax,-0x10(%rbp) mov -0x10(%rbp),%rax mov %rax,%rdi callq 1562 <_ZNSt6vectorIiSaIiEE5beginEv> mov %rax,-0x20(%rbp) mov -0x10(%rbp),%rax mov %rax,%rdi callq 15ae <_ZNSt6vectorIiSaIiEE3endEv> mov %rax,-0x18(%rbp) lea -0x18(%rbp),%rdx lea -0x20(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 15fe <_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_> test %al,%al je 12b5 <_Z5func0St6vectorIiSaIiEE+0x8c> lea -0x20(%rbp),%rax mov %rax,%rdi callq 1662 <_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv> mov (%rax),%eax mov %eax,-0x24(%rbp) mov -0x24(%rbp),%eax and $0x1,%eax test %eax,%eax je 12a7 <_Z5func0St6vectorIiSaIiEE+0x7e> mov -0x24(%rbp),%eax jmp 12ba <_Z5func0St6vectorIiSaIiEE+0x91> lea -0x20(%rbp),%rax mov %rax,%rdi callq 163e <_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv> jmp 1270 <_Z5func0St6vectorIiSaIiEE+0x47> mov $0xffffffff,%eax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 12ce <_Z5func0St6vectorIiSaIiEE+0xa5> callq 1110 <__stack_chk_fail@plt> leaveq retq
_Z5func0St6vectorIiSaIiEE: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_38], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov rax, [rbp+var_38] mov [rbp+var_10], rax mov rax, [rbp+var_10] mov rdi, rax call _ZNSt6vectorIiSaIiEE5beginEv; std::vector<int>::begin(void) mov [rbp+var_20], rax mov rax, [rbp+var_10] mov rdi, rax call _ZNSt6vectorIiSaIiEE3endEv; std::vector<int>::end(void) mov [rbp+var_18], rax jmp short loc_12BE loc_1292: lea rax, [rbp+var_20] mov rdi, rax call _ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv; __gnu_cxx::__normal_iterator<int *,std::vector<int>>::operator*(void) mov eax, [rax] mov [rbp+var_24], eax mov eax, [rbp+var_24] and eax, 1 test eax, eax jz short loc_12B2 mov eax, [rbp+var_24] jmp short loc_12DA loc_12B2: lea rax, [rbp+var_20] mov rdi, rax call _ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv; __gnu_cxx::__normal_iterator<int *,std::vector<int>>::operator++(void) loc_12BE: lea rdx, [rbp+var_18] lea rax, [rbp+var_20] mov rsi, rdx mov rdi, rax call _ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_; __gnu_cxx::operator!=<int *,std::vector<int>>(__gnu_cxx::__normal_iterator<int *,std::vector<int>> const&,__gnu_cxx::__normal_iterator<int *,std::vector<int>> const&) test al, al jnz short loc_1292 mov eax, 0FFFFFFFFh loc_12DA: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_12EE call ___stack_chk_fail locret_12EE: leave retn
long long func0(long long a1) { unsigned int v2; // [rsp+1Ch] [rbp-24h] long long v3; // [rsp+20h] [rbp-20h] BYREF _QWORD v4[3]; // [rsp+28h] [rbp-18h] BYREF v4[2] = __readfsqword(0x28u); v4[1] = a1; v3 = std::vector<int>::begin(a1); v4[0] = std::vector<int>::end(a1); while ( (unsigned __int8)__gnu_cxx::operator!=<int *,std::vector<int>>(&v3, v4) ) { v2 = *(_DWORD *)__gnu_cxx::__normal_iterator<int *,std::vector<int>>::operator*(&v3); if ( (v2 & 1) != 0 ) return v2; __gnu_cxx::__normal_iterator<int *,std::vector<int>>::operator++(&v3); } return 0xFFFFFFFFLL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x38],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV RAX,qword ptr [RBP + -0x38] MOV qword ptr [RBP + -0x10],RAX MOV RAX,qword ptr [RBP + -0x10] MOV RDI,RAX CALL 0x001015e6 MOV qword ptr [RBP + -0x20],RAX MOV RAX,qword ptr [RBP + -0x10] MOV RDI,RAX CALL 0x00101632 MOV qword ptr [RBP + -0x18],RAX JMP 0x001012be LAB_00101292: LEA RAX,[RBP + -0x20] MOV RDI,RAX CALL 0x001016e6 MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x24],EAX MOV EAX,dword ptr [RBP + -0x24] AND EAX,0x1 TEST EAX,EAX JZ 0x001012b2 MOV EAX,dword ptr [RBP + -0x24] JMP 0x001012da LAB_001012b2: LEA RAX,[RBP + -0x20] MOV RDI,RAX CALL 0x001016c2 LAB_001012be: LEA RDX,[RBP + -0x18] LEA RAX,[RBP + -0x20] MOV RSI,RDX MOV RDI,RAX CALL 0x00101682 TEST AL,AL JNZ 0x00101292 MOV EAX,0xffffffff LAB_001012da: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001012ee CALL 0x00101130 LAB_001012ee: LEAVE RET
/* func0(std::vector<int, std::allocator<int> >) */ uint func0(vector param_1) { bool bVar1; uint uVar2; uint *puVar3; int4 in_register_0000003c; long in_FS_OFFSET; int8 local_28; int8 local_20; vector<int,std::allocator<int>> *local_18; long local_10; local_18 = (vector<int,std::allocator<int>> *)CONCAT44(in_register_0000003c,param_1); local_10 = *(long *)(in_FS_OFFSET + 0x28); local_28 = std::vector<int,std::allocator<int>>::begin(local_18); local_20 = std::vector<int,std::allocator<int>>::end(local_18); while (bVar1 = operator!=((__normal_iterator *)&local_28,(__normal_iterator *)&local_20), bVar1) { puVar3 = (uint *)__normal_iterator<int*,std::vector<int,std::allocator<int>>>::operator* ((__normal_iterator<int*,std::vector<int,std::allocator<int>>> *) &local_28); uVar2 = *puVar3; if ((uVar2 & 1) != 0) goto LAB_001012da; __normal_iterator<int*,std::vector<int,std::allocator<int>>>::operator++ ((__normal_iterator<int*,std::vector<int,std::allocator<int>>> *)&local_28); } uVar2 = 0xffffffff; LAB_001012da: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,225
func0
#include <vector> #include <cassert>
int func0(std::vector<int> nums) { for (int el : nums) { if (el % 2 != 0) { return el; } } return -1; }
int main() { assert(func0({1, 3, 5}) == 1); assert(func0({2, 4, 1, 3}) == 1); assert(func0({8, 9, 1}) == 9); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> >): endbr64 mov (%rdi),%rax mov 0x8(%rdi),%rcx cmp %rcx,%rax je 1231 <_Z5func0St6vectorIiSaIiEE+0x28> mov (%rax),%edx test $0x1,%dl jne 122e <_Z5func0St6vectorIiSaIiEE+0x25> add $0x4,%rax cmp %rax,%rcx jne 1219 <_Z5func0St6vectorIiSaIiEE+0x10> mov $0xffffffff,%edx mov %edx,%eax retq mov $0xffffffff,%edx jmp 122e <_Z5func0St6vectorIiSaIiEE+0x25>
_Z5func0St6vectorIiSaIiEE: endbr64 mov rax, [rdi] mov rcx, [rdi+8] cmp rcx, rax jz short loc_1231 loc_1219: mov edx, [rax] test dl, 1 jnz short loc_122E add rax, 4 cmp rcx, rax jnz short loc_1219 mov edx, 0FFFFFFFFh loc_122E: mov eax, edx retn loc_1231: mov edx, 0FFFFFFFFh jmp short loc_122E
long long func0(unsigned int **a1) { unsigned int *v1; // rax unsigned int *v2; // rcx unsigned int v3; // edx v1 = *a1; v2 = a1[1]; if ( v2 == *a1 ) { return (unsigned int)-1; } else { while ( 1 ) { v3 = *v1; if ( (*v1 & 1) != 0 ) break; if ( v2 == ++v1 ) return (unsigned int)-1; } } return v3; }
func0: ENDBR64 MOV RAX,qword ptr [RDI] MOV RCX,qword ptr [RDI + 0x8] CMP RCX,RAX JZ 0x00101231 LAB_00101219: MOV EDX,dword ptr [RAX] TEST DL,0x1 JNZ 0x0010122e ADD RAX,0x4 CMP RCX,RAX JNZ 0x00101219 MOV EDX,0xffffffff LAB_0010122e: MOV EAX,EDX RET LAB_00101231: MOV EDX,0xffffffff JMP 0x0010122e
/* func0(std::vector<int, std::allocator<int> >) */ uint func0(vector param_1) { uint *puVar1; int4 in_register_0000003c; puVar1 = *(uint **)CONCAT44(in_register_0000003c,param_1); while( true ) { if (*(uint **)(CONCAT44(in_register_0000003c,param_1) + 8) == puVar1) { return 0xffffffff; } if ((*puVar1 & 1) != 0) break; puVar1 = puVar1 + 1; } return *puVar1; }
3,226
func0
#include <vector> #include <cassert>
int func0(std::vector<int> nums) { for (int el : nums) { if (el % 2 != 0) { return el; } } return -1; }
int main() { assert(func0({1, 3, 5}) == 1); assert(func0({2, 4, 1, 3}) == 1); assert(func0({8, 9, 1}) == 9); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> >): endbr64 mov (%rdi),%rax mov 0x8(%rdi),%rdx cmp %rdx,%rax jne 1421 <_Z5func0St6vectorIiSaIiEE+0x21> jmp 1430 <_Z5func0St6vectorIiSaIiEE+0x30> nopw 0x0(%rax,%rax,1) add $0x4,%rax cmp %rax,%rdx je 1430 <_Z5func0St6vectorIiSaIiEE+0x30> mov (%rax),%r8d test $0x1,%r8b je 1418 <_Z5func0St6vectorIiSaIiEE+0x18> mov %r8d,%eax retq xchg %ax,%ax mov $0xffffffff,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
_Z5func0St6vectorIiSaIiEE: endbr64 mov rax, [rdi] mov rcx, [rdi+8] cmp rcx, rax jnz short loc_1401 jmp short loc_1410 loc_13F8: add rax, 4 cmp rcx, rax jz short loc_1410 loc_1401: mov edx, [rax] test dl, 1 jz short loc_13F8 mov eax, edx retn loc_1410: mov edx, 0FFFFFFFFh mov eax, edx retn
long long func0(unsigned int **a1) { unsigned int *v1; // rax unsigned int *v2; // rcx v1 = *a1; v2 = a1[1]; if ( v2 == *a1 ) return 0xFFFFFFFFLL; while ( (*v1 & 1) == 0 ) { if ( v2 == ++v1 ) return 0xFFFFFFFFLL; } return *v1; }
func0: ENDBR64 MOV RAX,qword ptr [RDI] MOV RCX,qword ptr [RDI + 0x8] CMP RCX,RAX JNZ 0x00101401 JMP 0x00101410 LAB_001013f8: ADD RAX,0x4 CMP RCX,RAX JZ 0x00101410 LAB_00101401: MOV EDX,dword ptr [RAX] TEST DL,0x1 JZ 0x001013f8 MOV EAX,EDX RET LAB_00101410: MOV EDX,0xffffffff MOV EAX,EDX RET
/* func0(std::vector<int, std::allocator<int> >) */ uint func0(vector param_1) { uint *puVar1; int4 in_register_0000003c; puVar1 = *(uint **)CONCAT44(in_register_0000003c,param_1); while( true ) { if (*(uint **)(CONCAT44(in_register_0000003c,param_1) + 8) == puVar1) { return 0xffffffff; } if ((*puVar1 & 1) != 0) break; puVar1 = puVar1 + 1; } return *puVar1; }
3,227
func0
#include <vector> #include <cassert>
int func0(std::vector<int> nums) { for (int el : nums) { if (el % 2 != 0) { return el; } } return -1; }
int main() { assert(func0({1, 3, 5}) == 1); assert(func0({2, 4, 1, 3}) == 1); assert(func0({8, 9, 1}) == 9); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> >): endbr64 mov (%rdi),%rax mov 0x8(%rdi),%rdx cmp %rdx,%rax jne 1411 <_Z5func0St6vectorIiSaIiEE+0x21> jmp 1420 <_Z5func0St6vectorIiSaIiEE+0x30> nopw 0x0(%rax,%rax,1) add $0x4,%rax cmp %rax,%rdx je 1420 <_Z5func0St6vectorIiSaIiEE+0x30> mov (%rax),%r8d test $0x1,%r8b je 1408 <_Z5func0St6vectorIiSaIiEE+0x18> mov %r8d,%eax retq xchg %ax,%ax mov $0xffffffff,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
_Z5func0St6vectorIiSaIiEE: endbr64 mov rax, [rdi] mov rcx, [rdi+8] cmp rcx, rax jnz short loc_1401 jmp short loc_1410 loc_13F8: add rax, 4 cmp rcx, rax jz short loc_1410 loc_1401: mov edx, [rax] test dl, 1 jz short loc_13F8 mov eax, edx retn loc_1410: mov edx, 0FFFFFFFFh mov eax, edx retn
long long func0(unsigned int **a1) { unsigned int *v1; // rax unsigned int *v2; // rcx v1 = *a1; v2 = a1[1]; if ( v2 == *a1 ) return 0xFFFFFFFFLL; while ( (*v1 & 1) == 0 ) { if ( v2 == ++v1 ) return 0xFFFFFFFFLL; } return *v1; }
func0: ENDBR64 MOV RAX,qword ptr [RDI] MOV RCX,qword ptr [RDI + 0x8] CMP RCX,RAX JNZ 0x00101401 JMP 0x00101410 LAB_001013f8: ADD RAX,0x4 CMP RCX,RAX JZ 0x00101410 LAB_00101401: MOV EDX,dword ptr [RAX] TEST DL,0x1 JZ 0x001013f8 MOV EAX,EDX RET LAB_00101410: MOV EDX,0xffffffff MOV EAX,EDX RET
/* func0(std::vector<int, std::allocator<int> >) */ uint func0(vector param_1) { uint *puVar1; int4 in_register_0000003c; puVar1 = *(uint **)CONCAT44(in_register_0000003c,param_1); while( true ) { if (*(uint **)(CONCAT44(in_register_0000003c,param_1) + 8) == puVar1) { return 0xffffffff; } if ((*puVar1 & 1) != 0) break; puVar1 = puVar1 + 1; } return *puVar1; }
3,228
func0
#include <iostream> #include <tuple> #include <cassert>
bool func0(const std::tuple<int, int, int, int, int, int>& test_tup, int K) { bool res = false; auto [x1, x2, x3, x4, x5, x6] = test_tup; int arr[] = {x1, x2, x3, x4, x5, x6}; for(int ele : arr) { if(ele == K) { res = true; break; } } return res; }
int main() { assert(func0(std::make_tuple(10, 4, 5, 6, 8, 0), 6) == true); assert(func0(std::make_tuple(1, 2, 3, 4, 5, 6), 7) == false); assert(func0(std::make_tuple(7, 8, 9, 44, 11, 12), 11) == true); return 0; }
O0
cpp
func0(std::tuple<int, int, int, int, int, int> const&, int): endbr64 push %rbp mov %rsp,%rbp sub $0xa0,%rsp mov %rdi,-0x98(%rbp) mov %esi,-0x9c(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax movb $0x0,-0x8d(%rbp) mov -0x98(%rbp),%rcx mov (%rcx),%rax mov 0x8(%rcx),%rdx mov %rax,-0x40(%rbp) mov %rdx,-0x38(%rbp) mov 0x10(%rcx),%rax mov %rax,-0x30(%rbp) lea -0x40(%rbp),%rax mov %rax,%rdi callq 1596 <_ZSt3getILm0EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_> mov %rax,-0x80(%rbp) lea -0x40(%rbp),%rax mov %rax,%rdi callq 163e <_ZSt3getILm1EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_> mov %rax,-0x78(%rbp) lea -0x40(%rbp),%rax mov %rax,%rdi callq 16d4 <_ZSt3getILm2EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_> mov %rax,-0x70(%rbp) lea -0x40(%rbp),%rax mov %rax,%rdi callq 176a <_ZSt3getILm3EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_> mov %rax,-0x68(%rbp) lea -0x40(%rbp),%rax mov %rax,%rdi callq 1800 <_ZSt3getILm4EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_> mov %rax,-0x60(%rbp) lea -0x40(%rbp),%rax mov %rax,%rdi callq 1896 <_ZSt3getILm5EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_> mov %rax,-0x58(%rbp) mov -0x80(%rbp),%rax mov (%rax),%eax mov %eax,-0x20(%rbp) mov -0x78(%rbp),%rax mov (%rax),%eax mov %eax,-0x1c(%rbp) mov -0x70(%rbp),%rax mov (%rax),%eax mov %eax,-0x18(%rbp) mov -0x68(%rbp),%rax mov (%rax),%eax mov %eax,-0x14(%rbp) mov -0x60(%rbp),%rax mov (%rax),%eax mov %eax,-0x10(%rbp) mov -0x58(%rbp),%rax mov (%rax),%eax mov %eax,-0xc(%rbp) lea -0x20(%rbp),%rax mov %rax,-0x50(%rbp) mov -0x50(%rbp),%rax mov %rax,-0x88(%rbp) mov -0x50(%rbp),%rax add $0x18,%rax mov %rax,-0x48(%rbp) mov -0x88(%rbp),%rax cmp -0x48(%rbp),%rax je 130b <_Z5func0RKSt5tupleIJiiiiiiEEi+0x142> mov -0x88(%rbp),%rax mov (%rax),%eax mov %eax,-0x8c(%rbp) mov -0x8c(%rbp),%eax cmp -0x9c(%rbp),%eax jne 1301 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x138> movb $0x1,-0x8d(%rbp) jmp 130b <_Z5func0RKSt5tupleIJiiiiiiEEi+0x142> addq $0x4,-0x88(%rbp) jmp 12ce <_Z5func0RKSt5tupleIJiiiiiiEEi+0x105> movzbl -0x8d(%rbp),%eax mov -0x8(%rbp),%rdx xor %fs:0x28,%rdx je 1326 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x15d> callq 10b0 <__stack_chk_fail@plt> leaveq retq
_Z5func0RKSt5tupleIJiiiiiiEEi: endbr64 push rbp mov rbp, rsp sub rsp, 0A0h mov [rbp+var_98], rdi mov [rbp+var_9C], esi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov [rbp+var_8D], 0 mov rcx, [rbp+var_98] mov rax, [rcx] mov rdx, [rcx+8] mov [rbp+var_40], rax mov [rbp+var_38], rdx mov rax, [rcx+10h] mov [rbp+var_30], rax lea rax, [rbp+var_40] mov rdi, rax call _ZSt3getILm0EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_; std::get<0ul,int,int,int,int,int,int>(std::tuple<int,int,int,int,int,int>&&) mov [rbp+var_80], rax lea rax, [rbp+var_40] mov rdi, rax call _ZSt3getILm1EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_; std::get<1ul,int,int,int,int,int,int>(std::tuple<int,int,int,int,int,int>&&) mov [rbp+var_78], rax lea rax, [rbp+var_40] mov rdi, rax call _ZSt3getILm2EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_; std::get<2ul,int,int,int,int,int,int>(std::tuple<int,int,int,int,int,int>&&) mov [rbp+var_70], rax lea rax, [rbp+var_40] mov rdi, rax call _ZSt3getILm3EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_; std::get<3ul,int,int,int,int,int,int>(std::tuple<int,int,int,int,int,int>&&) mov [rbp+var_68], rax lea rax, [rbp+var_40] mov rdi, rax call _ZSt3getILm4EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_; std::get<4ul,int,int,int,int,int,int>(std::tuple<int,int,int,int,int,int>&&) mov [rbp+var_60], rax lea rax, [rbp+var_40] mov rdi, rax call _ZSt3getILm5EJiiiiiiEEONSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEOS4_; std::get<5ul,int,int,int,int,int,int>(std::tuple<int,int,int,int,int,int>&&) mov [rbp+var_58], rax mov rax, [rbp+var_80] mov eax, [rax] mov [rbp+var_20], eax mov rax, [rbp+var_78] mov eax, [rax] mov [rbp+var_1C], eax mov rax, [rbp+var_70] mov eax, [rax] mov [rbp+var_18], eax mov rax, [rbp+var_68] mov eax, [rax] mov [rbp+var_14], eax mov rax, [rbp+var_60] mov eax, [rax] mov [rbp+var_10], eax mov rax, [rbp+var_58] mov eax, [rax] mov [rbp+var_C], eax lea rax, [rbp+var_20] mov [rbp+var_50], rax mov rax, [rbp+var_50] mov [rbp+var_88], rax mov rax, [rbp+var_50] add rax, 18h mov [rbp+var_48], rax jmp short loc_129E loc_1270: mov rax, [rbp+var_88] mov eax, [rax] mov [rbp+var_8C], eax mov eax, [rbp+var_8C] cmp eax, [rbp+var_9C] jnz short loc_1296 mov [rbp+var_8D], 1 jmp short loc_12AB loc_1296: add [rbp+var_88], 4 loc_129E: mov rax, [rbp+var_88] cmp rax, [rbp+var_48] jnz short loc_1270 loc_12AB: movzx eax, [rbp+var_8D] mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_12C6 call ___stack_chk_fail locret_12C6: leave retn
long long func0(_QWORD *a1, int a2) { long long v2; // rdx unsigned __int8 v4; // [rsp+13h] [rbp-8Dh] unsigned long long *i; // [rsp+18h] [rbp-88h] _DWORD *v6; // [rsp+20h] [rbp-80h] _DWORD *v7; // [rsp+28h] [rbp-78h] _DWORD *v8; // [rsp+30h] [rbp-70h] _DWORD *v9; // [rsp+38h] [rbp-68h] _DWORD *v10; // [rsp+40h] [rbp-60h] _DWORD *v11; // [rsp+48h] [rbp-58h] _QWORD v12[4]; // [rsp+60h] [rbp-40h] BYREF _DWORD v13[6]; // [rsp+80h] [rbp-20h] BYREF unsigned long long v14; // [rsp+98h] [rbp-8h] BYREF v14 = __readfsqword(0x28u); v4 = 0; v2 = a1[1]; v12[0] = *a1; v12[1] = v2; v12[2] = a1[2]; v6 = (_DWORD *)std::get<0ul,int,int,int,int,int,int>(v12); v7 = (_DWORD *)std::get<1ul,int,int,int,int,int,int>(v12); v8 = (_DWORD *)std::get<2ul,int,int,int,int,int,int>(v12); v9 = (_DWORD *)std::get<3ul,int,int,int,int,int,int>(v12); v10 = (_DWORD *)std::get<4ul,int,int,int,int,int,int>(v12); v11 = (_DWORD *)std::get<5ul,int,int,int,int,int,int>(v12); v13[0] = *v6; v13[1] = *v7; v13[2] = *v8; v13[3] = *v9; v13[4] = *v10; v13[5] = *v11; for ( i = (unsigned long long *)v13; i != &v14; i = (unsigned long long *)((char *)i + 4) ) { if ( *(_DWORD *)i == a2 ) return 1; } return v4; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0xa0 MOV qword ptr [RBP + -0x98],RDI MOV dword ptr [RBP + -0x9c],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV byte ptr [RBP + -0x8d],0x0 MOV RCX,qword ptr [RBP + -0x98] MOV RAX,qword ptr [RCX] MOV RDX,qword ptr [RCX + 0x8] MOV qword ptr [RBP + -0x40],RAX MOV qword ptr [RBP + -0x38],RDX MOV RAX,qword ptr [RCX + 0x10] MOV qword ptr [RBP + -0x30],RAX LEA RAX,[RBP + -0x40] MOV RDI,RAX CALL 0x001014c5 MOV qword ptr [RBP + -0x80],RAX LEA RAX,[RBP + -0x40] MOV RDI,RAX CALL 0x0010154f MOV qword ptr [RBP + -0x78],RAX LEA RAX,[RBP + -0x40] MOV RDI,RAX CALL 0x001015c7 MOV qword ptr [RBP + -0x70],RAX LEA RAX,[RBP + -0x40] MOV RDI,RAX CALL 0x0010163f MOV qword ptr [RBP + -0x68],RAX LEA RAX,[RBP + -0x40] MOV RDI,RAX CALL 0x001016b7 MOV qword ptr [RBP + -0x60],RAX LEA RAX,[RBP + -0x40] MOV RDI,RAX CALL 0x0010172f MOV qword ptr [RBP + -0x58],RAX MOV RAX,qword ptr [RBP + -0x80] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x20],EAX MOV RAX,qword ptr [RBP + -0x78] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x1c],EAX MOV RAX,qword ptr [RBP + -0x70] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x18],EAX MOV RAX,qword ptr [RBP + -0x68] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x14],EAX MOV RAX,qword ptr [RBP + -0x60] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x10],EAX MOV RAX,qword ptr [RBP + -0x58] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0xc],EAX LEA RAX,[RBP + -0x20] MOV qword ptr [RBP + -0x50],RAX MOV RAX,qword ptr [RBP + -0x50] MOV qword ptr [RBP + -0x88],RAX MOV RAX,qword ptr [RBP + -0x50] ADD RAX,0x18 MOV qword ptr [RBP + -0x48],RAX JMP 0x0010129e LAB_00101270: MOV RAX,qword ptr [RBP + -0x88] MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x8c],EAX MOV EAX,dword ptr [RBP + -0x8c] CMP EAX,dword ptr [RBP + -0x9c] JNZ 0x00101296 MOV byte ptr [RBP + -0x8d],0x1 JMP 0x001012ab LAB_00101296: ADD qword ptr [RBP + -0x88],0x4 LAB_0010129e: MOV RAX,qword ptr [RBP + -0x88] CMP RAX,qword ptr [RBP + -0x48] JNZ 0x00101270 LAB_001012ab: MOVZX EAX,byte ptr [RBP + -0x8d] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001012c6 CALL 0x00101070 LAB_001012c6: LEAVE RET
/* func0(std::tuple<int, int, int, int, int, int> const&, int) */ int func0(tuple *param_1,int param_2) { type *ptVar1; type *ptVar2; type *ptVar3; type *ptVar4; type *ptVar5; type *ptVar6; long in_FS_OFFSET; int local_95; long *local_90; int8 local_48; int8 local_40; int8 local_38; int4 local_28; int4 local_24; int4 local_20; int4 local_1c; int4 local_18; int4 local_14; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_95 = 0; local_48 = *(int8 *)param_1; local_40 = *(int8 *)(param_1 + 8); local_38 = *(int8 *)(param_1 + 0x10); ptVar1 = std::get<0ul,int,int,int,int,int,int>((tuple *)&local_48); ptVar2 = std::get<1ul,int,int,int,int,int,int>((tuple *)&local_48); ptVar3 = std::get<2ul,int,int,int,int,int,int>((tuple *)&local_48); ptVar4 = std::get<3ul,int,int,int,int,int,int>((tuple *)&local_48); ptVar5 = std::get<4ul,int,int,int,int,int,int>((tuple *)&local_48); ptVar6 = std::get<5ul,int,int,int,int,int,int>((tuple *)&local_48); local_28 = *(int4 *)ptVar1; local_24 = *(int4 *)ptVar2; local_20 = *(int4 *)ptVar3; local_1c = *(int4 *)ptVar4; local_18 = *(int4 *)ptVar5; local_14 = *(int4 *)ptVar6; local_90 = (long *)&local_28; do { if (local_90 == &local_10) { LAB_001012ab: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_95; } if (*(int *)local_90 == param_2) { local_95 = 1; goto LAB_001012ab; } local_90 = (long *)((long)local_90 + 4); } while( true ); }
3,229
func0
#include <iostream> #include <tuple> #include <cassert>
bool func0(const std::tuple<int, int, int, int, int, int>& test_tup, int K) { bool res = false; auto [x1, x2, x3, x4, x5, x6] = test_tup; int arr[] = {x1, x2, x3, x4, x5, x6}; for(int ele : arr) { if(ele == K) { res = true; break; } } return res; }
int main() { assert(func0(std::make_tuple(10, 4, 5, 6, 8, 0), 6) == true); assert(func0(std::make_tuple(1, 2, 3, 4, 5, 6), 7) == false); assert(func0(std::make_tuple(7, 8, 9, 44, 11, 12), 11) == true); return 0; }
O1
cpp
func0(std::tuple<int, int, int, int, int, int> const&, int): endbr64 sub $0x28,%rsp mov %fs:0x28,%rax mov %rax,0x18(%rsp) xor %eax,%eax mov (%rdi),%eax mov 0x4(%rdi),%edx mov 0x8(%rdi),%ecx mov 0xc(%rdi),%r8d mov 0x10(%rdi),%r9d mov 0x14(%rdi),%edi mov %edi,(%rsp) mov %r9d,0x4(%rsp) mov %r8d,0x8(%rsp) mov %ecx,0xc(%rsp) mov %edx,0x10(%rsp) mov %eax,0x14(%rsp) mov %rsp,%rax lea 0x18(%rsp),%rdx cmp %esi,(%rax) je 121c <_Z5func0RKSt5tupleIJiiiiiiEEi+0x73> add $0x4,%rax cmp %rdx,%rax jne 11f5 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x4c> mov $0x0,%eax mov 0x18(%rsp),%rcx xor %fs:0x28,%rcx jne 1223 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x7a> add $0x28,%rsp retq mov $0x1,%eax jmp 1207 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x5e> callq 10a0 <__stack_chk_fail@plt>
_Z5func0RKSt5tupleIJiiiiiiEEi: endbr64 sub rsp, 28h mov rax, fs:28h mov [rsp+28h+var_10], rax xor eax, eax mov eax, [rdi] mov edx, [rdi+4] mov ecx, [rdi+8] mov r8d, [rdi+0Ch] mov r9d, [rdi+10h] mov edi, [rdi+14h] mov [rsp+28h+var_28], edi mov [rsp+28h+var_24], r9d mov [rsp+28h+var_20], r8d mov [rsp+28h+var_1C], ecx mov [rsp+28h+var_18], edx mov [rsp+28h+var_14], eax mov rax, rsp lea rdx, [rsp+28h+var_10] loc_11B5: cmp [rax], esi jz short loc_11DC add rax, 4 cmp rax, rdx jnz short loc_11B5 mov eax, 0 loc_11C7: mov rdx, [rsp+28h+var_10] sub rdx, fs:28h jnz short loc_11E3 add rsp, 28h retn loc_11DC: mov eax, 1 jmp short loc_11C7 loc_11E3: call ___stack_chk_fail
long long func0(int *a1, int a2) { int v2; // eax int v3; // edx int v4; // ecx int v5; // r8d int v6; // r9d unsigned long long *v7; // rax _DWORD v9[6]; // [rsp+0h] [rbp-28h] BYREF unsigned long long v10; // [rsp+18h] [rbp-10h] BYREF v10 = __readfsqword(0x28u); v2 = *a1; v3 = a1[1]; v4 = a1[2]; v5 = a1[3]; v6 = a1[4]; v9[0] = a1[5]; v9[1] = v6; v9[2] = v5; v9[3] = v4; v9[4] = v3; v9[5] = v2; v7 = (unsigned long long *)v9; while ( *(_DWORD *)v7 != a2 ) { v7 = (unsigned long long *)((char *)v7 + 4); if ( v7 == &v10 ) return 0LL; } return 1LL; }
func0: ENDBR64 SUB RSP,0x28 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x18],RAX XOR EAX,EAX MOV EAX,dword ptr [RDI] MOV EDX,dword ptr [RDI + 0x4] MOV ECX,dword ptr [RDI + 0x8] MOV R8D,dword ptr [RDI + 0xc] MOV R9D,dword ptr [RDI + 0x10] MOV EDI,dword ptr [RDI + 0x14] MOV dword ptr [RSP],EDI MOV dword ptr [RSP + 0x4],R9D MOV dword ptr [RSP + 0x8],R8D MOV dword ptr [RSP + 0xc],ECX MOV dword ptr [RSP + 0x10],EDX MOV dword ptr [RSP + 0x14],EAX MOV RAX,RSP LEA RDX,[RSP + 0x18] LAB_001011b5: CMP dword ptr [RAX],ESI JZ 0x001011dc ADD RAX,0x4 CMP RAX,RDX JNZ 0x001011b5 MOV EAX,0x0 LAB_001011c7: MOV RDX,qword ptr [RSP + 0x18] SUB RDX,qword ptr FS:[0x28] JNZ 0x001011e3 ADD RSP,0x28 RET LAB_001011dc: MOV EAX,0x1 JMP 0x001011c7 LAB_001011e3: CALL 0x00101070
/* func0(std::tuple<int, int, int, int, int, int> const&, int) */ int8 func0(tuple *param_1,int param_2) { long *plVar1; int8 uVar2; long in_FS_OFFSET; int8 local_28; int4 local_20; int4 local_1c; int4 local_18; int4 local_14; long local_10 [2]; plVar1 = &local_28; local_10[0] = *(long *)(in_FS_OFFSET + 0x28); local_28._0_4_ = *(int4 *)(param_1 + 0x14); local_28._4_4_ = *(int4 *)(param_1 + 0x10); local_20 = *(int4 *)(param_1 + 0xc); local_1c = *(int4 *)(param_1 + 8); local_18 = *(int4 *)(param_1 + 4); local_14 = *(int4 *)param_1; do { if (*(int *)plVar1 == param_2) { uVar2 = 1; goto LAB_001011c7; } plVar1 = (long *)((long)plVar1 + 4); } while (plVar1 != local_10); uVar2 = 0; LAB_001011c7: if (local_10[0] == *(long *)(in_FS_OFFSET + 0x28)) { return uVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,230
func0
#include <iostream> #include <tuple> #include <cassert>
bool func0(const std::tuple<int, int, int, int, int, int>& test_tup, int K) { bool res = false; auto [x1, x2, x3, x4, x5, x6] = test_tup; int arr[] = {x1, x2, x3, x4, x5, x6}; for(int ele : arr) { if(ele == K) { res = true; break; } } return res; }
int main() { assert(func0(std::make_tuple(10, 4, 5, 6, 8, 0), 6) == true); assert(func0(std::make_tuple(1, 2, 3, 4, 5, 6), 7) == false); assert(func0(std::make_tuple(7, 8, 9, 44, 11, 12), 11) == true); return 0; }
O2
cpp
func0(std::tuple<int, int, int, int, int, int> const&, int): endbr64 sub $0x28,%rsp mov 0x4(%rdi),%ecx mov 0x8(%rdi),%r8d mov %fs:0x28,%rax mov %rax,0x18(%rsp) xor %eax,%eax mov 0xc(%rdi),%r9d mov (%rdi),%eax mov 0x10(%rdi),%r10d mov 0x14(%rdi),%edx mov %ecx,0x10(%rsp) lea 0x18(%rsp),%rcx mov %eax,0x14(%rsp) mov %rsp,%rax mov %edx,(%rsp) mov %r10d,0x4(%rsp) mov %r9d,0x8(%rsp) mov %r8d,0xc(%rsp) cmp %edx,%esi je 13b1 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x61> add $0x4,%rax cmp %rcx,%rax je 13c0 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x70> mov (%rax),%edx cmp %edx,%esi jne 13a2 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x52> mov $0x1,%eax jmp 13c2 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x72> nopl 0x0(%rax,%rax,1) xor %eax,%eax mov 0x18(%rsp),%rcx xor %fs:0x28,%rcx jne 13d7 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x87> add $0x28,%rsp retq callq 10a0 <__stack_chk_fail@plt> nopl 0x0(%rax)
_Z5func0RKSt5tupleIJiiiiiiEEi: endbr64 sub rsp, 28h movd xmm2, dword ptr [rdi+0Ch] movd xmm3, dword ptr [rdi+8] movd xmm0, dword ptr [rdi+14h] movd xmm4, dword ptr [rdi+10h] lea rdx, [rsp+28h+var_10] mov rax, fs:28h mov [rsp+28h+var_10], rax xor eax, eax movq xmm1, qword ptr [rdi] punpckldq xmm2, xmm3 mov rax, rsp punpckldq xmm0, xmm4 punpcklqdq xmm0, xmm2 pshufd xmm1, xmm1, 0E1h movaps [rsp+28h+var_28], xmm0 movq [rsp+28h+var_18], xmm1 loc_12E3: cmp [rax], esi jz short loc_1310 add rax, 4 cmp rdx, rax jnz short loc_12E3 xor eax, eax loc_12F2: mov rdx, [rsp+28h+var_10] sub rdx, fs:28h jnz short loc_1317 add rsp, 28h retn loc_1310: mov eax, 1 jmp short loc_12F2 loc_1317: call ___stack_chk_fail
long long func0(const __m128i *a1, int a2) { __m128i v2; // xmm2 __m128i v3; // xmm3 __m128i v4; // xmm0 __m128i v5; // xmm4 __m128i *v6; // rax unsigned long long v7; // xmm1_8 __m128i v9; // [rsp+0h] [rbp-28h] BYREF unsigned long long v10; // [rsp+10h] [rbp-18h] unsigned long long v11; // [rsp+18h] [rbp-10h] BYREF v2 = _mm_cvtsi32_si128(a1->m128i_u32[3]); v3 = _mm_cvtsi32_si128(a1->m128i_u32[2]); v4 = _mm_cvtsi32_si128(a1[1].m128i_u32[1]); v5 = _mm_cvtsi32_si128(a1[1].m128i_u32[0]); v11 = __readfsqword(0x28u); v6 = &v9; v7 = _mm_shuffle_epi32(_mm_loadl_epi64(a1), 225).m128i_u64[0]; v9 = _mm_unpacklo_epi64(_mm_unpacklo_epi32(v4, v5), _mm_unpacklo_epi32(v2, v3)); v10 = v7; while ( v6->m128i_i32[0] != a2 ) { v6 = (__m128i *)((char *)v6 + 4); if ( &v11 == (unsigned long long *)v6 ) return 0LL; } return 1LL; }
func0: ENDBR64 SUB RSP,0x28 MOVD XMM2,dword ptr [RDI + 0xc] MOVD XMM3,dword ptr [RDI + 0x8] MOVD XMM0,dword ptr [RDI + 0x14] MOVD XMM4,dword ptr [RDI + 0x10] LEA RDX,[RSP + 0x18] MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x18],RAX XOR EAX,EAX MOVQ XMM1,qword ptr [RDI] PUNPCKLDQ XMM2,XMM3 MOV RAX,RSP PUNPCKLDQ XMM0,XMM4 PUNPCKLQDQ XMM0,XMM2 PSHUFD XMM1,XMM1,0xe1 MOVAPS xmmword ptr [RSP],XMM0 MOVQ qword ptr [RSP + 0x10],XMM1 LAB_001012e3: CMP dword ptr [RAX],ESI JZ 0x00101310 ADD RAX,0x4 CMP RDX,RAX JNZ 0x001012e3 XOR EAX,EAX LAB_001012f2: MOV RDX,qword ptr [RSP + 0x18] SUB RDX,qword ptr FS:[0x28] JNZ 0x00101317 ADD RSP,0x28 RET LAB_00101310: MOV EAX,0x1 JMP 0x001012f2 LAB_00101317: CALL 0x00101070
/* func0(std::tuple<int, int, int, int, int, int> const&, int) */ int8 func0(tuple *param_1,int param_2) { long *plVar1; int8 uVar2; long in_FS_OFFSET; long local_28; int8 uStack_20; int8 local_18; long local_10 [2]; plVar1 = &local_28; local_10[0] = *(long *)(in_FS_OFFSET + 0x28); local_28 = CONCAT44(*(int4 *)(param_1 + 0x10),*(int4 *)(param_1 + 0x14)); uStack_20 = CONCAT44(*(int4 *)(param_1 + 8),*(int4 *)(param_1 + 0xc)); local_18 = CONCAT44((int)*(int8 *)param_1,(int)((ulong)*(int8 *)param_1 >> 0x20)); do { if (*(int *)plVar1 == param_2) { uVar2 = 1; goto LAB_001012f2; } plVar1 = (long *)((long)plVar1 + 4); } while (local_10 != plVar1); uVar2 = 0; LAB_001012f2: if (local_10[0] == *(long *)(in_FS_OFFSET + 0x28)) { return uVar2; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,231
func0
#include <iostream> #include <tuple> #include <cassert>
bool func0(const std::tuple<int, int, int, int, int, int>& test_tup, int K) { bool res = false; auto [x1, x2, x3, x4, x5, x6] = test_tup; int arr[] = {x1, x2, x3, x4, x5, x6}; for(int ele : arr) { if(ele == K) { res = true; break; } } return res; }
int main() { assert(func0(std::make_tuple(10, 4, 5, 6, 8, 0), 6) == true); assert(func0(std::make_tuple(1, 2, 3, 4, 5, 6), 7) == false); assert(func0(std::make_tuple(7, 8, 9, 44, 11, 12), 11) == true); return 0; }
O3
cpp
func0(std::tuple<int, int, int, int, int, int> const&, int): endbr64 mov (%rdi),%r9d mov 0x4(%rdi),%r8d mov 0x8(%rdi),%ecx mov 0xc(%rdi),%edx mov 0x10(%rdi),%eax cmp 0x14(%rdi),%esi je 12d8 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x38> cmp %esi,%eax je 12d8 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x38> cmp %esi,%edx je 12d8 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x38> cmp %ecx,%esi je 12d8 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x38> cmp %esi,%r8d je 12d8 <_Z5func0RKSt5tupleIJiiiiiiEEi+0x38> cmp %esi,%r9d sete %al retq nopl 0x0(%rax) mov $0x1,%eax retq xchg %ax,%ax
_Z5func0RKSt5tupleIJiiiiiiEEi: endbr64 mov r9d, [rdi] mov r8d, [rdi+4] mov ecx, [rdi+8] mov edx, [rdi+0Ch] mov eax, [rdi+10h] cmp esi, [rdi+14h] jz short loc_1178 cmp eax, esi jz short loc_1178 cmp edx, esi jz short loc_1178 cmp esi, ecx jz short loc_1178 cmp r8d, esi jz short loc_1178 cmp r9d, esi setz al retn loc_1178: mov eax, 1 retn
bool func0(_DWORD *a1, int a2) { return a2 == a1[5] || a1[4] == a2 || a1[3] == a2 || a2 == a1[2] || a1[1] == a2 || *a1 == a2; }
func0: ENDBR64 MOV R9D,dword ptr [RDI] MOV R8D,dword ptr [RDI + 0x4] MOV ECX,dword ptr [RDI + 0x8] MOV EDX,dword ptr [RDI + 0xc] MOV EAX,dword ptr [RDI + 0x10] CMP ESI,dword ptr [RDI + 0x14] JZ 0x00101178 CMP EAX,ESI JZ 0x00101178 CMP EDX,ESI JZ 0x00101178 CMP ESI,ECX JZ 0x00101178 CMP R8D,ESI JZ 0x00101178 CMP R9D,ESI SETZ AL RET LAB_00101178: MOV EAX,0x1 RET
/* func0(std::tuple<int, int, int, int, int, int> const&, int) */ int4 func0(tuple *param_1,int param_2) { if ((((param_2 != *(int *)(param_1 + 0x14)) && (*(int *)(param_1 + 0x10) != param_2)) && (*(int *)(param_1 + 0xc) != param_2)) && ((param_2 != *(int *)(param_1 + 8) && (*(int *)(param_1 + 4) != param_2)))) { return CONCAT31((int3)((uint)*(int *)(param_1 + 0x10) >> 8),*(int *)param_1 == param_2); } return 1; }
3,232
func0
#include <cassert> #include <tuple> #include <algorithm>
bool func0(const std::tuple<int, int, int>& test_tup1, const std::tuple<int, int, int>& test_tup2) { return std::get<0>(test_tup1) > std::get<0>(test_tup2) && std::get<1>(test_tup1) > std::get<1>(test_tup2) && std::get<2>(test_tup1) > std::get<2>(test_tup2); }
int main() { assert(func0(std::make_tuple(1, 2, 3), std::make_tuple(2, 3, 4)) == false); assert(func0(std::make_tuple(4, 5, 6), std::make_tuple(3, 4, 5)) == true); assert(func0(std::make_tuple(11, 12, 13), std::make_tuple(10, 11, 12)) == true); return 0; }
O0
cpp
func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x18,%rsp mov %rdi,-0x18(%rbp) mov %rsi,-0x20(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 1428 <_ZSt3getILm0EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%ebx mov -0x20(%rbp),%rax mov %rax,%rdi callq 1428 <_ZSt3getILm0EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%eax cmp %eax,%ebx jle 1205 <_Z5func0RKSt5tupleIJiiiEES2_+0x7c> mov -0x18(%rbp),%rax mov %rax,%rdi callq 1498 <_ZSt3getILm1EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%ebx mov -0x20(%rbp),%rax mov %rax,%rdi callq 1498 <_ZSt3getILm1EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%eax cmp %eax,%ebx jle 1205 <_Z5func0RKSt5tupleIJiiiEES2_+0x7c> mov -0x18(%rbp),%rax mov %rax,%rdi callq 1508 <_ZSt3getILm2EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%ebx mov -0x20(%rbp),%rax mov %rax,%rdi callq 1508 <_ZSt3getILm2EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%eax cmp %eax,%ebx jle 1205 <_Z5func0RKSt5tupleIJiiiEES2_+0x7c> mov $0x1,%eax jmp 120a <_Z5func0RKSt5tupleIJiiiEES2_+0x81> mov $0x0,%eax add $0x18,%rsp pop %rbx pop %rbp retq
_Z5func0RKSt5tupleIJiiiEES2_: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 18h mov [rbp+var_18], rdi mov [rbp+var_20], rsi mov rax, [rbp+var_18] mov rdi, rax call _ZSt3getILm0EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_; std::get<0ul,int,int,int>(std::tuple<int,int,int> const&) mov ebx, [rax] mov rax, [rbp+var_20] mov rdi, rax call _ZSt3getILm0EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_; std::get<0ul,int,int,int>(std::tuple<int,int,int> const&) mov eax, [rax] cmp ebx, eax jle short loc_11E5 mov rax, [rbp+var_18] mov rdi, rax call _ZSt3getILm1EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_; std::get<1ul,int,int,int>(std::tuple<int,int,int> const&) mov ebx, [rax] mov rax, [rbp+var_20] mov rdi, rax call _ZSt3getILm1EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_; std::get<1ul,int,int,int>(std::tuple<int,int,int> const&) mov eax, [rax] cmp ebx, eax jle short loc_11E5 mov rax, [rbp+var_18] mov rdi, rax call _ZSt3getILm2EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_; std::get<2ul,int,int,int>(std::tuple<int,int,int> const&) mov ebx, [rax] mov rax, [rbp+var_20] mov rdi, rax call _ZSt3getILm2EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_; std::get<2ul,int,int,int>(std::tuple<int,int,int> const&) mov eax, [rax] cmp ebx, eax jle short loc_11E5 mov eax, 1 jmp short loc_11EA loc_11E5: mov eax, 0 loc_11EA: mov rbx, [rbp+var_8] leave retn
_BOOL8 func0(long long a1, long long a2) { int v2; // ebx int v3; // ebx int v4; // ebx _BOOL8 result; // rax v2 = *(_DWORD *)std::get<0ul,int,int,int>(a1); result = 0; if ( v2 > *(_DWORD *)std::get<0ul,int,int,int>(a2) ) { v3 = *(_DWORD *)std::get<1ul,int,int,int>(a1); if ( v3 > *(_DWORD *)std::get<1ul,int,int,int>(a2) ) { v4 = *(_DWORD *)std::get<2ul,int,int,int>(a1); if ( v4 > *(_DWORD *)std::get<2ul,int,int,int>(a2) ) return 1; } } return result; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x18 MOV qword ptr [RBP + -0x18],RDI MOV qword ptr [RBP + -0x20],RSI MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x001013fc MOV EBX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x001013fc MOV EAX,dword ptr [RAX] CMP EBX,EAX JLE 0x001011e5 MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x0010141a MOV EBX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x0010141a MOV EAX,dword ptr [RAX] CMP EBX,EAX JLE 0x001011e5 MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101438 MOV EBX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x00101438 MOV EAX,dword ptr [RAX] CMP EBX,EAX JLE 0x001011e5 MOV EAX,0x1 JMP 0x001011ea LAB_001011e5: MOV EAX,0x0 LAB_001011ea: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&) */ int8 func0(tuple *param_1,tuple *param_2) { int iVar1; type *ptVar2; type *ptVar3; type *ptVar4; ptVar2 = std::get<0ul,int,int,int>(param_1); iVar1 = *(int *)ptVar2; ptVar2 = std::get<0ul,int,int,int>(param_2); if (*(int *)ptVar2 < iVar1) { ptVar3 = std::get<1ul,int,int,int>(param_1); iVar1 = *(int *)ptVar3; ptVar3 = std::get<1ul,int,int,int>(param_2); if (*(int *)ptVar3 < iVar1) { ptVar4 = std::get<2ul,int,int,int>(param_1); iVar1 = *(int *)ptVar4; ptVar4 = std::get<2ul,int,int,int>(param_2); if (*(int *)ptVar4 < iVar1) { return 1; } } } return 0; }
3,233
func0
#include <cassert> #include <tuple> #include <algorithm>
bool func0(const std::tuple<int, int, int>& test_tup1, const std::tuple<int, int, int>& test_tup2) { return std::get<0>(test_tup1) > std::get<0>(test_tup2) && std::get<1>(test_tup1) > std::get<1>(test_tup2) && std::get<2>(test_tup1) > std::get<2>(test_tup2); }
int main() { assert(func0(std::make_tuple(1, 2, 3), std::make_tuple(2, 3, 4)) == false); assert(func0(std::make_tuple(4, 5, 6), std::make_tuple(3, 4, 5)) == true); assert(func0(std::make_tuple(11, 12, 13), std::make_tuple(10, 11, 12)) == true); return 0; }
O1
cpp
func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&): endbr64 mov $0x0,%eax mov 0x8(%rsi),%edx cmp %edx,0x8(%rdi) jle 1189 <_Z5func0RKSt5tupleIJiiiEES2_+0x20> mov 0x4(%rsi),%ecx cmp %ecx,0x4(%rdi) jle 1189 <_Z5func0RKSt5tupleIJiiiEES2_+0x20> mov (%rsi),%eax cmp %eax,(%rdi) setg %al retq
_Z5func0RKSt5tupleIJiiiEES2_: endbr64 mov eax, 0 mov edx, [rsi+8] cmp [rdi+8], edx jle short locret_1189 mov ecx, [rsi+4] cmp [rdi+4], ecx jle short locret_1189 mov eax, [rsi] cmp [rdi], eax setnle al locret_1189: retn
bool func0(_DWORD *a1, _DWORD *a2) { bool result; // al result = 0; if ( a1[2] > a2[2] && a1[1] > a2[1] ) return *a1 > *a2; return result; }
func0: ENDBR64 MOV EAX,0x0 MOV EDX,dword ptr [RSI + 0x8] CMP dword ptr [RDI + 0x8],EDX JLE 0x00101189 MOV ECX,dword ptr [RSI + 0x4] CMP dword ptr [RDI + 0x4],ECX JLE 0x00101189 MOV EAX,dword ptr [RSI] CMP dword ptr [RDI],EAX SETG AL LAB_00101189: RET
/* func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&) */ int4 func0(tuple *param_1,tuple *param_2) { int4 uVar1; uVar1 = 0; if ((*(int *)(param_2 + 8) < *(int *)(param_1 + 8)) && (*(int *)(param_2 + 4) < *(int *)(param_1 + 4))) { uVar1 = CONCAT31((int3)((uint)*(int *)param_2 >> 8),*(int *)param_2 < *(int *)param_1); } return uVar1; }
3,234
func0
#include <cassert> #include <tuple> #include <algorithm>
bool func0(const std::tuple<int, int, int>& test_tup1, const std::tuple<int, int, int>& test_tup2) { return std::get<0>(test_tup1) > std::get<0>(test_tup2) && std::get<1>(test_tup1) > std::get<1>(test_tup2) && std::get<2>(test_tup1) > std::get<2>(test_tup2); }
int main() { assert(func0(std::make_tuple(1, 2, 3), std::make_tuple(2, 3, 4)) == false); assert(func0(std::make_tuple(4, 5, 6), std::make_tuple(3, 4, 5)) == true); assert(func0(std::make_tuple(11, 12, 13), std::make_tuple(10, 11, 12)) == true); return 0; }
O2
cpp
func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&): endbr64 mov 0x8(%rsi),%edx xor %eax,%eax cmp %edx,0x8(%rdi) jle 115d <_Z5func0RKSt5tupleIJiiiEES2_+0x1d> mov 0x4(%rsi),%ecx cmp %ecx,0x4(%rdi) jle 115d <_Z5func0RKSt5tupleIJiiiEES2_+0x1d> mov (%rsi),%eax cmp %eax,(%rdi) setg %al retq xchg %ax,%ax
_Z5func0RKSt5tupleIJiiiEES2_: endbr64 mov edx, [rsi+8] xor eax, eax cmp [rdi+8], edx jle short locret_115D mov ecx, [rsi+4] cmp [rdi+4], ecx jle short locret_115D mov eax, [rsi] cmp [rdi], eax setnle al locret_115D: retn
bool func0(_DWORD *a1, _DWORD *a2) { bool result; // al result = 0; if ( a1[2] > a2[2] && a1[1] > a2[1] ) return *a1 > *a2; return result; }
func0: ENDBR64 MOV EDX,dword ptr [RSI + 0x8] XOR EAX,EAX CMP dword ptr [RDI + 0x8],EDX JLE 0x0010115d MOV ECX,dword ptr [RSI + 0x4] CMP dword ptr [RDI + 0x4],ECX JLE 0x0010115d MOV EAX,dword ptr [RSI] CMP dword ptr [RDI],EAX SETG AL LAB_0010115d: RET
/* func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&) */ int4 func0(tuple *param_1,tuple *param_2) { int4 uVar1; uVar1 = 0; if ((*(int *)(param_2 + 8) < *(int *)(param_1 + 8)) && (*(int *)(param_2 + 4) < *(int *)(param_1 + 4))) { uVar1 = CONCAT31((int3)((uint)*(int *)param_2 >> 8),*(int *)param_2 < *(int *)param_1); } return uVar1; }
3,235
func0
#include <cassert> #include <tuple> #include <algorithm>
bool func0(const std::tuple<int, int, int>& test_tup1, const std::tuple<int, int, int>& test_tup2) { return std::get<0>(test_tup1) > std::get<0>(test_tup2) && std::get<1>(test_tup1) > std::get<1>(test_tup2) && std::get<2>(test_tup1) > std::get<2>(test_tup2); }
int main() { assert(func0(std::make_tuple(1, 2, 3), std::make_tuple(2, 3, 4)) == false); assert(func0(std::make_tuple(4, 5, 6), std::make_tuple(3, 4, 5)) == true); assert(func0(std::make_tuple(11, 12, 13), std::make_tuple(10, 11, 12)) == true); return 0; }
O3
cpp
func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&): endbr64 mov 0x8(%rsi),%edx xor %eax,%eax cmp %edx,0x8(%rdi) jle 115d <_Z5func0RKSt5tupleIJiiiEES2_+0x1d> mov 0x4(%rsi),%ecx cmp %ecx,0x4(%rdi) jle 115d <_Z5func0RKSt5tupleIJiiiEES2_+0x1d> mov (%rsi),%eax cmp %eax,(%rdi) setg %al retq xchg %ax,%ax
_Z5func0RKSt5tupleIJiiiEES2_: endbr64 mov edx, [rsi+8] xor eax, eax cmp [rdi+8], edx jle short locret_115D mov ecx, [rsi+4] cmp [rdi+4], ecx jle short locret_115D mov eax, [rsi] cmp [rdi], eax setnle al locret_115D: retn
bool func0(_DWORD *a1, _DWORD *a2) { bool result; // al result = 0; if ( a1[2] > a2[2] && a1[1] > a2[1] ) return *a1 > *a2; return result; }
func0: ENDBR64 MOV EDX,dword ptr [RSI + 0x8] XOR EAX,EAX CMP dword ptr [RDI + 0x8],EDX JLE 0x0010115d MOV ECX,dword ptr [RSI + 0x4] CMP dword ptr [RDI + 0x4],ECX JLE 0x0010115d MOV EAX,dword ptr [RSI] CMP dword ptr [RDI],EAX SETG AL LAB_0010115d: RET
/* func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&) */ int4 func0(tuple *param_1,tuple *param_2) { int4 uVar1; uVar1 = 0; if ((*(int *)(param_2 + 8) < *(int *)(param_1 + 8)) && (*(int *)(param_2 + 4) < *(int *)(param_1 + 4))) { uVar1 = CONCAT31((int3)((uint)*(int *)param_2 >> 8),*(int *)param_2 < *(int *)param_1); } return uVar1; }
3,236
func0
#include <vector> #include <string> #include <map> #include <assert.h>
std::vector<std::string> func0(int a, int b, int c, int d) { std::map<std::string, int> counts = {{"p", a}, {"q", b}, {"r", c}, {"s", d}}; std::vector<std::string> result; for (auto const& elem : counts) { for (int i = 0; i < elem.second; ++i) { result.push_back(elem.first); } } return result; }
int main() { assert((func0(4,2,0,-2) == std::vector<std::string>{"p", "p", "p", "p", "q", "q"})); assert((func0(0,1,2,3) == std::vector<std::string>{"q", "r", "r", "s", "s", "s"})); assert((func0(11,15,12,23) == std::vector<std::string>{"p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s"})); return 0; }
O0
cpp
func0[abi:cxx11](int, int, int, int): endbr64 push %rbp mov %rsp,%rbp push %r13 push %r12 push %rbx sub $0x138,%rsp mov %rdi,-0x138(%rbp) mov %esi,-0x13c(%rbp) mov %edx,-0x140(%rbp) mov %ecx,-0x144(%rbp) mov %r8d,-0x148(%rbp) mov %fs:0x28,%rax mov %rax,-0x28(%rbp) xor %eax,%eax lea -0x13c(%rbp),%rdx lea -0xd0(%rbp),%rax lea 0x5a67(%rip),%rsi mov %rax,%rdi callq 494c <_ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEC1IRA2_KcRiLb1EEEOT_OT0_> lea -0x140(%rbp),%rax lea -0xd0(%rbp),%rdx lea 0x28(%rdx),%rcx mov %rax,%rdx lea 0x5a45(%rip),%rsi mov %rcx,%rdi callq 494c <_ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEC1IRA2_KcRiLb1EEEOT_OT0_> lea -0x144(%rbp),%rax lea -0xd0(%rbp),%rdx lea 0x50(%rdx),%rcx mov %rax,%rdx lea 0x5a23(%rip),%rsi mov %rcx,%rdi callq 494c <_ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEC1IRA2_KcRiLb1EEEOT_OT0_> lea -0x148(%rbp),%rax lea -0xd0(%rbp),%rdx lea 0x78(%rdx),%rcx mov %rax,%rdx lea 0x5a01(%rip),%rsi mov %rcx,%rdi callq 494c <_ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEC1IRA2_KcRiLb1EEEOT_OT0_> lea -0xd0(%rbp),%rax mov %rax,%r12 mov $0x4,%r13d lea -0x118(%rbp),%rax mov %rax,%rdi callq 4bf4 <_ZNSaISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEEC1Ev> lea -0x118(%rbp),%r8 lea -0x120(%rbp),%rdx mov %r12,%rsi mov %r13,%rdi mov %r12,%rcx mov %r13,%rbx mov %rbx,%rdi lea -0x100(%rbp),%rax mov %rdx,%rcx mov %rdi,%rdx mov %rax,%rdi callq 4c34 <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEC1ESt16initializer_listISA_ERKS7_RKSB_> lea -0x118(%rbp),%rax mov %rax,%rdi callq 4c14 <_ZNSaISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEED1Ev> lea -0xd0(%rbp),%rbx add $0xa0,%rbx lea -0xd0(%rbp),%rax cmp %rax,%rbx je 269d <_Z5func0B5cxx11iiii+0x154> sub $0x28,%rbx mov %rbx,%rdi callq 492c <_ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiED1Ev> jmp 2683 <_Z5func0B5cxx11iiii+0x13a> mov -0x138(%rbp),%rax mov %rax,%rdi callq 4a62 <_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEC1Ev> lea -0x100(%rbp),%rax mov %rax,-0x110(%rbp) mov -0x110(%rbp),%rax mov %rax,%rdi callq 4e72 <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEE5beginEv> mov %rax,-0x120(%rbp) mov -0x110(%rbp),%rax mov %rax,%rdi callq 4e90 <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEE3endEv> mov %rax,-0x118(%rbp) lea -0x118(%rbp),%rdx lea -0x120(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 4eae <_ZStneRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESB_> test %al,%al je 276b <_Z5func0B5cxx11iiii+0x222> lea -0x120(%rbp),%rax mov %rax,%rdi callq 4f00 <_ZNKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEEdeEv> mov %rax,-0x108(%rbp) movl $0x0,-0x124(%rbp) mov -0x108(%rbp),%rax mov 0x20(%rax),%eax cmp %eax,-0x124(%rbp) jge 2757 <_Z5func0B5cxx11iiii+0x20e> mov -0x108(%rbp),%rdx mov -0x138(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 4f22 <_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE9push_backERKS5_> addl $0x1,-0x124(%rbp) jmp 2723 <_Z5func0B5cxx11iiii+0x1da> lea -0x120(%rbp),%rax mov %rax,%rdi callq 4ed4 <_ZNSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEEppEv> jmpq 26e6 <_Z5func0B5cxx11iiii+0x19d> lea -0x100(%rbp),%rax mov %rax,%rdi callq 4a02 <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEED1Ev> mov -0x28(%rbp),%rax xor %fs:0x28,%rax je 2812 <_Z5func0B5cxx11iiii+0x2c9> jmp 280d <_Z5func0B5cxx11iiii+0x2c4> endbr64 mov %rax,%rbx lea -0x118(%rbp),%rax mov %rax,%rdi callq 4c14 <_ZNSaISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEED1Ev> mov %rbx,%r12 lea -0xd0(%rbp),%rbx add $0xa0,%rbx lea -0xd0(%rbp),%rax cmp %rax,%rbx je 27d2 <_Z5func0B5cxx11iiii+0x289> sub $0x28,%rbx mov %rbx,%rdi callq 492c <_ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiED1Ev> jmp 27b8 <_Z5func0B5cxx11iiii+0x26f> mov %r12,%rax mov %rax,%rdi callq 2420 <_Unwind_Resume@plt> endbr64 mov %rax,%rbx mov -0x138(%rbp),%rax mov %rax,%rdi callq 4e2a <_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED1Ev> lea -0x100(%rbp),%rax mov %rax,%rdi callq 4a02 <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 2420 <_Unwind_Resume@plt> callq 23d0 <__stack_chk_fail@plt> mov -0x138(%rbp),%rax add $0x138,%rsp pop %rbx pop %r12 pop %r13 pop %rbp retq
_Z5func0B5cxx11iiii: endbr64 push rbp mov rbp, rsp push r15 push r14 push r13 push r12 push rbx sub rsp, 138h mov [rbp+var_148], rdi mov [rbp+var_14C], esi mov [rbp+var_150], edx mov [rbp+var_154], ecx mov [rbp+var_158], r8d mov rax, fs:28h mov [rbp+var_38], rax xor eax, eax lea r13, [rbp+var_E0] mov ebx, 3 lea rax, [rbp+var_14C] mov rdx, rax lea rax, aPqrs; "pqrs" mov rsi, rax mov rdi, r13 call _ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEC1IRA2_KcRiLb1EEEOT_OT0_; std::pair<std::string const,int>::pair<char const(&)[2],int &,true>(char const(&)[2] &&,int &) lea r12, [r13+28h] sub rbx, 1 lea rax, [rbp+var_150] mov rdx, rax lea rax, aPqrs+2; "qrs" mov rsi, rax mov rdi, r12 call _ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEC1IRA2_KcRiLb1EEEOT_OT0_; std::pair<std::string const,int>::pair<char const(&)[2],int &,true>(char const(&)[2] &&,int &) add r12, 28h ; '(' sub rbx, 1 lea rax, [rbp+var_154] mov rdx, rax lea rax, aPqrs+4; "rs" mov rsi, rax mov rdi, r12 call _ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEC1IRA2_KcRiLb1EEEOT_OT0_; std::pair<std::string const,int>::pair<char const(&)[2],int &,true>(char const(&)[2] &&,int &) lea rcx, [r12+28h] sub rbx, 1 lea rax, [rbp+var_158] mov rdx, rax lea rax, aPqrs+6; "s" mov rsi, rax mov rdi, rcx call _ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEC1IRA2_KcRiLb1EEEOT_OT0_; std::pair<std::string const,int>::pair<char const(&)[2],int &,true>(char const(&)[2] &&,int &) mov ebx, 3 lea rax, [rbp+var_E0] mov r14, rax mov r15d, 4 lea rax, [rbp+var_130] mov [rbp+var_118], rax nop nop lea rcx, [rbp+var_130] lea rdx, [rbp+var_138] mov rsi, r14 mov rdi, r15 mov r8, r14 mov r9, r15 mov rdi, r9 lea rax, [rbp+var_110] mov r8, rcx mov rcx, rdx mov rdx, rdi mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEC2ESt16initializer_listISA_ERKS7_RKSB_; std::map<std::string,int>::map(std::initializer_list<std::pair<std::string const,int>>,std::less<std::string> const&,std::allocator<std::pair<std::string const,int>> const&) lea rax, [rbp+var_130] mov rdi, rax call _ZNSt15__new_allocatorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEED2Ev; std::__new_allocator<std::pair<std::string const,int>>::~__new_allocator() nop lea rbx, [rbp+var_E0] add rbx, 0A0h loc_267D: lea rax, [rbp+var_E0] cmp rbx, rax jz short loc_2697 sub rbx, 28h ; '(' mov rdi, rbx call _ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiED2Ev; std::pair<std::string const,int>::~pair() jmp short loc_267D loc_2697: mov rax, [rbp+var_148] mov rdi, rax call _ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEC2Ev; std::vector<std::string>::vector(void) lea rax, [rbp+var_110] mov [rbp+var_128], rax mov rax, [rbp+var_128] mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEE5beginEv; std::map<std::string,int>::begin(void) mov [rbp+var_138], rax mov rax, [rbp+var_128] mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEE3endEv; std::map<std::string,int>::end(void) mov [rbp+var_130], rax jmp short loc_2745 loc_26E2: lea rax, [rbp+var_138] mov rdi, rax call _ZNKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEEdeEv; std::_Rb_tree_iterator<std::pair<std::string const,int>>::operator*(void) mov [rbp+var_120], rax mov [rbp+var_13C], 0 jmp short loc_2724 loc_2704: mov rdx, [rbp+var_120] mov rax, [rbp+var_148] mov rsi, rdx mov rdi, rax call _ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE9push_backERKS5_; std::vector<std::string>::push_back(std::string const&) add [rbp+var_13C], 1 loc_2724: mov rax, [rbp+var_120] mov eax, [rax+20h] cmp [rbp+var_13C], eax jl short loc_2704 lea rax, [rbp+var_138] mov rdi, rax call _ZNSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEEppEv; std::_Rb_tree_iterator<std::pair<std::string const,int>>::operator++(void) loc_2745: lea rdx, [rbp+var_130] lea rax, [rbp+var_138] mov rsi, rdx mov rdi, rax call _ZStneRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESB_; std::operator!=(std::_Rb_tree_iterator<std::pair<std::string const,int>> const&,std::_Rb_tree_iterator<std::pair<std::string const,int>> const&) test al, al jnz short loc_26E2 nop lea rax, [rbp+var_110] mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEED2Ev; std::map<std::string,int>::~map() nop mov rax, [rbp+var_38] sub rax, fs:28h jz loc_2877 jmp loc_2872 endbr64 mov r12, rax lea rax, [rbp+var_130] mov rdi, rax call _ZNSt15__new_allocatorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEED2Ev; std::__new_allocator<std::pair<std::string const,int>>::~__new_allocator() nop mov r14, r12 lea r12, [rbp+var_E0] add r12, 0A0h loc_27B3: lea rax, [rbp+var_E0] cmp r12, rax jz short loc_27CD sub r12, 28h ; '(' mov rdi, r12 call _ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiED2Ev; std::pair<std::string const,int>::~pair() jmp short loc_27B3 loc_27CD: mov r12, r14 jmp short loc_27D9 endbr64 mov r12, rax loc_27D9: test r13, r13 jz short loc_280F mov eax, 3 sub rax, rbx mov rdx, rax mov rax, rdx shl rax, 2 add rax, rdx shl rax, 3 lea rbx, [r13+rax+0] loc_27FC: cmp rbx, r13 jz short loc_280F sub rbx, 28h ; '(' mov rdi, rbx call _ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiED2Ev; std::pair<std::string const,int>::~pair() jmp short loc_27FC loc_280F: mov rax, r12 mov rdx, [rbp+var_38] sub rdx, fs:28h jz short loc_2826 call ___stack_chk_fail loc_2826: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume endbr64 mov rbx, rax mov rax, [rbp+var_148] mov rdi, rax call _ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED2Ev; std::vector<std::string>::~vector() lea rax, [rbp+var_110] mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEED2Ev; std::map<std::string,int>::~map() mov rax, rbx mov rdx, [rbp+var_38] sub rdx, fs:28h jz short loc_286A call ___stack_chk_fail loc_286A: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_2872: call ___stack_chk_fail loc_2877: mov rax, [rbp+var_148] add rsp, 138h pop rbx pop r12 pop r13 pop r14 pop r15 pop rbp retn
long long func0[abi:cxx11](long long a1, int a2, int a3, int a4, int a5) { _BYTE *i; // rbx int v7; // [rsp+8h] [rbp-158h] BYREF int v8; // [rsp+Ch] [rbp-154h] BYREF int v9; // [rsp+10h] [rbp-150h] BYREF int v10; // [rsp+14h] [rbp-14Ch] BYREF long long v11; // [rsp+18h] [rbp-148h] int j; // [rsp+24h] [rbp-13Ch] long long v13; // [rsp+28h] [rbp-138h] BYREF long long v14; // [rsp+30h] [rbp-130h] BYREF _BYTE *v15; // [rsp+38h] [rbp-128h] long long v16; // [rsp+40h] [rbp-120h] long long *v17; // [rsp+48h] [rbp-118h] _BYTE v18[48]; // [rsp+50h] [rbp-110h] BYREF _BYTE v19[40]; // [rsp+80h] [rbp-E0h] BYREF long long v20; // [rsp+A8h] [rbp-B8h] BYREF long long v21; // [rsp+D0h] [rbp-90h] BYREF long long v22; // [rsp+F8h] [rbp-68h] BYREF _QWORD v23[8]; // [rsp+120h] [rbp-40h] BYREF v11 = a1; v10 = a2; v9 = a3; v8 = a4; v7 = a5; v23[1] = __readfsqword(0x28u); std::pair<std::string const,int>::pair<char const(&)[2],int &,true>(v19, aPqrs, &v10); std::pair<std::string const,int>::pair<char const(&)[2],int &,true>(&v20, &aPqrs[1], &v9); std::pair<std::string const,int>::pair<char const(&)[2],int &,true>(&v21, &aPqrs[2], &v8); std::pair<std::string const,int>::pair<char const(&)[2],int &,true>(&v22, &aPqrs[3], &v7); v17 = &v14; std::map<std::string,int>::map(v18, v19, 4LL, &v13, &v14); std::__new_allocator<std::pair<std::string const,int>>::~__new_allocator(&v14); for ( i = v23; i != v19; std::pair<std::string const,int>::~pair(i) ) i -= 40; std::vector<std::string>::vector(v11); v15 = v18; v13 = std::map<std::string,int>::begin(v18); v14 = std::map<std::string,int>::end(v15); while ( (unsigned __int8)std::operator!=(&v13, &v14) ) { v16 = std::_Rb_tree_iterator<std::pair<std::string const,int>>::operator*(&v13); for ( j = 0; j < *(_DWORD *)(v16 + 32); ++j ) std::vector<std::string>::push_back(v11, v16); std::_Rb_tree_iterator<std::pair<std::string const,int>>::operator++(&v13); } std::map<std::string,int>::~map(v18); return v11; }
func0[abi:cxx11]: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBX SUB RSP,0x138 MOV qword ptr [RBP + -0x148],RDI MOV dword ptr [RBP + -0x14c],ESI MOV dword ptr [RBP + -0x150],EDX MOV dword ptr [RBP + -0x154],ECX MOV dword ptr [RBP + -0x158],R8D MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x38],RAX XOR EAX,EAX LEA R13,[RBP + -0xe0] MOV EBX,0x3 LEA RAX,[RBP + -0x14c] MOV RDX,RAX LEA RAX,[0x107008] MOV RSI,RAX MOV RDI,R13 LAB_00102593: CALL 0x00103b5c LEA R12,[R13 + 0x28] SUB RBX,0x1 LEA RAX,[RBP + -0x150] MOV RDX,RAX LEA RAX,[0x10700a] MOV RSI,RAX MOV RDI,R12 CALL 0x00103b5c ADD R12,0x28 SUB RBX,0x1 LEA RAX,[RBP + -0x154] MOV RDX,RAX LEA RAX,[0x10700c] MOV RSI,RAX MOV RDI,R12 CALL 0x00103b5c LEA RCX,[R12 + 0x28] SUB RBX,0x1 LEA RAX,[RBP + -0x158] MOV RDX,RAX LEA RAX,[0x10700e] MOV RSI,RAX MOV RDI,RCX CALL 0x00103b5c MOV EBX,0x3 LEA RAX,[RBP + -0xe0] MOV R14,RAX MOV R15D,0x4 LEA RAX,[RBP + -0x130] MOV qword ptr [RBP + -0x118],RAX NOP NOP LEA RCX,[RBP + -0x130] LEA RDX,[RBP + -0x138] MOV RSI,R14 MOV RDI,R15 MOV R8,R14 MOV R9,R15 MOV RDI,R9 LEA RAX,[RBP + -0x110] MOV R8,RCX MOV RCX,RDX MOV RDX,RDI MOV RDI,RAX LAB_0010265a: CALL 0x00103e10 LEA RAX,[RBP + -0x130] MOV RDI,RAX CALL 0x00104526 NOP LEA RBX,[RBP + -0xe0] ADD RBX,0xa0 LAB_0010267d: LEA RAX,[RBP + -0xe0] CMP RBX,RAX JZ 0x00102697 SUB RBX,0x28 MOV RDI,RBX CALL 0x00103b3c JMP 0x0010267d LAB_00102697: MOV RAX,qword ptr [RBP + -0x148] MOV RDI,RAX CALL 0x00103c8e LEA RAX,[RBP + -0x110] MOV qword ptr [RBP + -0x128],RAX MOV RAX,qword ptr [RBP + -0x128] MOV RDI,RAX CALL 0x00104080 MOV qword ptr [RBP + -0x138],RAX MOV RAX,qword ptr [RBP + -0x128] MOV RDI,RAX CALL 0x0010409e MOV qword ptr [RBP + -0x130],RAX JMP 0x00102745 LAB_001026e2: LEA RAX,[RBP + -0x138] MOV RDI,RAX CALL 0x0010410e MOV qword ptr [RBP + -0x120],RAX MOV dword ptr [RBP + -0x13c],0x0 JMP 0x00102724 LAB_00102704: MOV RDX,qword ptr [RBP + -0x120] MOV RAX,qword ptr [RBP + -0x148] MOV RSI,RDX MOV RDI,RAX LAB_00102718: CALL 0x00104130 ADD dword ptr [RBP + -0x13c],0x1 LAB_00102724: MOV RAX,qword ptr [RBP + -0x120] MOV EAX,dword ptr [RAX + 0x20] CMP dword ptr [RBP + -0x13c],EAX JL 0x00102704 LEA RAX,[RBP + -0x138] MOV RDI,RAX CALL 0x001040e2 LAB_00102745: LEA RDX,[RBP + -0x130] LEA RAX,[RBP + -0x138] MOV RSI,RDX MOV RDI,RAX CALL 0x001040bc TEST AL,AL JNZ 0x001026e2 NOP LEA RAX,[RBP + -0x110] MOV RDI,RAX CALL 0x00103c26 NOP MOV RAX,qword ptr [RBP + -0x38] SUB RAX,qword ptr FS:[0x28] JZ 0x00102877 JMP 0x00102872 LAB_00102872: CALL 0x001023c0 LAB_00102877: MOV RAX,qword ptr [RBP + -0x148] ADD RSP,0x138 POP RBX POP R12 POP R13 POP R14 POP R15 POP RBP RET
/* func0[abi:cxx11](int, int, int, int) */ vector<std::string,std::allocator<std::string>> * func0_abi_cxx11_(int param_1,int param_2,int param_3,int param_4) { char cVar1; pair<std::string_const,int> *this; int4 in_register_0000003c; long in_FS_OFFSET; int local_160; int local_15c; int local_158; int local_154; vector<std::string,std::allocator<std::string>> *local_150; int local_144; int8 local_140; int8 local_138; map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> *local_130; string *local_128; int8 *local_120; map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> local_118 [48]; pair<std::string_const,int> local_e8 [40]; pair<std::string_const,int> local_c0 [40]; pair<std::string_const,int> apStack_98 [40]; pair<std::string_const,int> local_70 [40]; pair<std::string_const,int> apStack_48 [8]; long local_40; local_150 = (vector<std::string,std::allocator<std::string>> *) CONCAT44(in_register_0000003c,param_1); local_40 = *(long *)(in_FS_OFFSET + 0x28); local_15c = param_4; local_158 = param_3; local_154 = param_2; /* try { // try from 00102593 to 00102604 has its CatchHandler @ 001027d2 */ std::pair<std::string_const,int>::pair<char_const(&)[2],int&,true>(local_e8,"p",&local_154); std::pair<std::string_const,int>::pair<char_const(&)[2],int&,true>(local_c0,"q",&local_158); std::pair<std::string_const,int>::pair<char_const(&)[2],int&,true>(apStack_98,"r",&local_15c); std::pair<std::string_const,int>::pair<char_const(&)[2],int&,true>(local_70,"s",&local_160); local_120 = &local_138; /* try { // try from 0010265a to 0010265e has its CatchHandler @ 0010278b */ std::map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::map((initializer_list)local_118,(less *)local_e8,(allocator *)0x4); std::__new_allocator<std::pair<std::string_const,int>>::~__new_allocator ((__new_allocator<std::pair<std::string_const,int>> *)&local_138); this = apStack_48; while (this != local_e8) { this = this + -0x28; std::pair<std::string_const,int>::~pair(this); } std::vector<std::string,std::allocator<std::string>>::vector(local_150); local_130 = local_118; local_140 = std:: map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::begin(local_130); local_138 = std:: map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::end(local_130); while( true ) { cVar1 = std::operator!=((_Rb_tree_iterator *)&local_140,(_Rb_tree_iterator *)&local_138); if (cVar1 == '\0') break; local_128 = (string *) std::_Rb_tree_iterator<std::pair<std::string_const,int>>::operator* ((_Rb_tree_iterator<std::pair<std::string_const,int>> *)&local_140); for (local_144 = 0; local_144 < *(int *)(local_128 + 0x20); local_144 = local_144 + 1) { /* try { // try from 00102718 to 0010271c has its CatchHandler @ 0010282e */ std::vector<std::string,std::allocator<std::string>>::push_back(local_150,local_128); } std::_Rb_tree_iterator<std::pair<std::string_const,int>>::operator++ ((_Rb_tree_iterator<std::pair<std::string_const,int>> *)&local_140); } std::map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::~map(local_118); if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_150; }
3,237
func0
#include <vector> #include <string> #include <map> #include <assert.h>
std::vector<std::string> func0(int a, int b, int c, int d) { std::map<std::string, int> counts = {{"p", a}, {"q", b}, {"r", c}, {"s", d}}; std::vector<std::string> result; for (auto const& elem : counts) { for (int i = 0; i < elem.second; ++i) { result.push_back(elem.first); } } return result; }
int main() { assert((func0(4,2,0,-2) == std::vector<std::string>{"p", "p", "p", "p", "q", "q"})); assert((func0(0,1,2,3) == std::vector<std::string>{"q", "r", "r", "s", "s", "s"})); assert((func0(11,15,12,23) == std::vector<std::string>{"p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s"})); return 0; }
O1
cpp
func0[abi:cxx11](int, int, int, int): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0xf8,%rsp mov %rdi,%rbx mov %esi,%r15d mov %edx,%r14d mov %ecx,%r13d mov %r8d,%r12d mov %fs:0x28,%rax mov %rax,0xe8(%rsp) xor %eax,%eax lea 0x40(%rsp),%rbp lea 0x50(%rsp),%rax mov %rax,0x40(%rsp) lea 0x1d0e(%rip),%rdx lea -0x1(%rdx),%rsi mov %rbp,%rdi callq 214e <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag> mov %r15d,0x60(%rsp) lea 0x78(%rsp),%rax mov %rax,0x68(%rsp) lea 0x68(%rsp),%rdi lea 0x1ce9(%rip),%rdx lea -0x1(%rdx),%rsi callq 214e <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag> mov %r14d,0x88(%rsp) lea 0xa0(%rsp),%rax mov %rax,0x90(%rsp) lea 0x90(%rsp),%rdi lea 0x1cbb(%rip),%rdx lea -0x1(%rdx),%rsi callq 214e <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag> mov %r13d,0xb0(%rsp) lea 0xc8(%rsp),%rax mov %rax,0xb8(%rsp) lea 0xb8(%rsp),%rdi lea 0x1c8d(%rip),%rdx lea -0x1(%rdx),%rsi callq 214e <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag> mov %r12d,0xd8(%rsp) movl $0x0,0x18(%rsp) movq $0x0,0x20(%rsp) lea 0x10(%rsp),%rdx lea 0x18(%rsp),%rax mov %rax,0x28(%rsp) mov %rax,0x30(%rsp) movq $0x0,0x38(%rsp) mov %rdx,0x8(%rsp) mov %rdx,%r12 jmp 1457 <_Z5func0B5cxx11iiii+0x12e> add $0x28,%rbp lea 0xe0(%rsp),%rax cmp %rax,%rbp je 1481 <_Z5func0B5cxx11iiii+0x158> lea 0x18(%rsp),%rsi mov %rbp,%rdx mov %r12,%rdi callq 2892 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS8_ERS7_> test %rdx,%rdx je 1446 <_Z5func0B5cxx11iiii+0x11d> lea 0x8(%rsp),%r8 mov %rbp,%rcx mov %rax,%rsi mov %r12,%rdi callq 2430 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE10_M_insert_IRKS8_NSE_11_Alloc_nodeEEESt17_Rb_tree_iteratorIS8_EPSt18_Rb_tree_node_baseSM_OT_RT0_> jmp 1446 <_Z5func0B5cxx11iiii+0x11d> mov %rax,%rbp lea 0x40(%rsp),%r12 jmp 14d5 <_Z5func0B5cxx11iiii+0x1ac> endbr64 mov %rax,%rbp lea 0x10(%rsp),%rdi mov 0x20(%rsp),%rsi callq 2102 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E> lea 0xe0(%rsp),%rbx lea 0x40(%rsp),%r12 sub $0x28,%rbx mov (%rbx),%rdi lea 0x10(%rbx),%rax cmp %rax,%rdi je 14c3 <_Z5func0B5cxx11iiii+0x19a> callq 11c0 <_ZdlPv@plt> cmp %r12,%rbx jne 14ae <_Z5func0B5cxx11iiii+0x185> mov %rbp,%rdi callq 1220 <_Unwind_Resume@plt> cmp %r12,%rbp je 14ed <_Z5func0B5cxx11iiii+0x1c4> sub $0x28,%rbp mov 0x0(%rbp),%rdi lea 0x10(%rbp),%rax cmp %rax,%rdi je 14d0 <_Z5func0B5cxx11iiii+0x1a7> callq 11c0 <_ZdlPv@plt> jmp 14d0 <_Z5func0B5cxx11iiii+0x1a7> movq $0x0,(%rbx) movq $0x0,0x8(%rbx) movq $0x0,0x10(%rbx) mov 0x28(%rsp),%rbp lea 0x18(%rsp),%rax cmp %rax,%rbp je 157c <_Z5func0B5cxx11iiii+0x253> mov %rax,%r14 jmp 156a <_Z5func0B5cxx11iiii+0x241> addq $0x20,0x8(%rbx) add $0x1,%r12d cmp %r12d,0x40(%rbp) jle 155a <_Z5func0B5cxx11iiii+0x231> mov 0x8(%rbx),%rdi cmp 0x10(%rbx),%rdi je 154a <_Z5func0B5cxx11iiii+0x221> lea 0x10(%rdi),%rax mov %rax,(%rdi) mov 0x20(%rbp),%rsi mov %rsi,%rdx add 0x28(%rbp),%rdx callq 224c <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag> jmp 1518 <_Z5func0B5cxx11iiii+0x1ef> mov %r13,%rdx mov %rdi,%rsi mov %rbx,%rdi callq 2542 <_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_realloc_insertIJRKS5_EEEvN9__gnu_cxx17__normal_iteratorIPS5_S7_EEDpOT_> jmp 151d <_Z5func0B5cxx11iiii+0x1f4> mov %rbp,%rdi callq 1190 <_ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base@plt> mov %rax,%rbp cmp %r14,%rax je 157c <_Z5func0B5cxx11iiii+0x253> cmpl $0x0,0x40(%rbp) jle 155a <_Z5func0B5cxx11iiii+0x231> mov $0x0,%r12d lea 0x20(%rbp),%r13 jmp 1527 <_Z5func0B5cxx11iiii+0x1fe> lea 0x10(%rsp),%rdi mov 0x20(%rsp),%rsi callq 2102 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E> mov 0xe8(%rsp),%rax xor %fs:0x28,%rax jne 15d9 <_Z5func0B5cxx11iiii+0x2b0> mov %rbx,%rax add $0xf8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq endbr64 mov %rax,%rbp mov %rbx,%rdi callq 2040 <_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED1Ev> lea 0x10(%rsp),%rdi mov 0x20(%rsp),%rsi callq 2102 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E> mov %rbp,%rdi callq 1220 <_Unwind_Resume@plt> callq 11f0 <__stack_chk_fail@plt>
_Z5func0B5cxx11iiii: endbr64 push r14 push r13 push r12 push rbp push rbx sub rsp, 0F0h mov rbx, rdi mov r14d, esi mov r13d, edx mov r12d, ecx mov ebp, r8d mov rax, fs:28h mov [rsp+118h+var_30], rax xor eax, eax lea rdi, [rsp+118h+var_D8] lea rax, [rsp+118h+var_C8] mov [rsp+118h+var_D8], rax lea rdx, aPqrs+1; "焀爀猀" lea rsi, [rdx-1] call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag; std::string::_M_construct<char const*>(char const*,char const*,std::forward_iterator_tag) jmp short loc_13F8 endbr64 mov rbx, rax mov edx, 3 loc_13CB: mov eax, 3 sub rax, rdx imul rax, 28h ; '(' lea rbp, [rsp+rax+arg_38] lea r12, [rsp+arg_38] loc_13E1: cmp rbp, r12 jz loc_1668 sub rbp, 28h ; '(' mov rdi, rbp call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv; std::string::_M_dispose(void) jmp short loc_13E1 loc_13F8: mov [rsp+118h+var_B8], r14d lea rax, [rsp+118h+var_A0] mov [rsp+118h+var_B0], rax lea rdi, [rsp+118h+var_B0] lea rdx, aPqrs+3; "爀猀" lea rsi, [rdx-1] call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag; std::string::_M_construct<char const*>(char const*,char const*,std::forward_iterator_tag) jmp short loc_142C endbr64 mov rbx, rax mov edx, 2 jmp short loc_13CB loc_142C: mov [rsp+118h+var_90], r13d lea rax, [rsp+118h+var_78] mov [rsp+118h+var_88], rax lea rdi, [rsp+118h+var_88] lea rdx, aPqrs+5; "猀" lea rsi, [rdx-1] call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag; std::string::_M_construct<char const*>(char const*,char const*,std::forward_iterator_tag) jmp short loc_146F endbr64 mov rbx, rax mov edx, 1 jmp loc_13CB loc_146F: mov [rsp+118h+var_68], r12d lea rax, [rsp+118h+var_50] mov [rsp+118h+var_60], rax lea rdi, [rsp+118h+var_60] lea rdx, aPqrs+7; "" lea rsi, [rdx-1] call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag; std::string::_M_construct<char const*>(char const*,char const*,std::forward_iterator_tag) jmp short loc_14B2 endbr64 mov rbx, rax mov edx, 0 jmp loc_13CB loc_14B2: mov [rsp+118h+var_40], ebp mov [rsp+118h+var_100], 0 mov [rsp+118h+var_F8], 0 lea rdx, [rsp+118h+var_108] lea rax, [rsp+118h+var_100] mov [rsp+118h+var_F0], rax mov [rsp+118h+var_E8], rax mov [rsp+118h+var_E0], 0 mov [rsp+118h+var_110], rdx lea rbp, [rsp+118h+var_D8] mov r12, rdx jmp short loc_1507 loc_14F6: add rbp, 28h ; '(' lea rax, [rsp+118h+var_38] cmp rbp, rax jz short loc_1531 loc_1507: lea rsi, [rsp+118h+var_100] mov rdx, rbp mov rdi, r12 call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS8_ERS7_; std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<std::string const,int>>,std::string const&) test rdx, rdx jz short loc_14F6 lea r8, [rsp+118h+var_110] mov rcx, rbp mov rsi, rax mov rdi, r12 call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE10_M_insert_IRKS8_NSE_11_Alloc_nodeEEESt17_Rb_tree_iteratorIS8_EPSt18_Rb_tree_node_baseSM_OT_RT0_; std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_insert_<std::pair<std::string const,int> const&,std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_Alloc_node>(std::_Rb_tree_node_base *,std::_Rb_tree_node_base *,std::pair<std::string const,int> const&,std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_Alloc_node &) jmp short loc_14F6 loc_1531: mov rbp, rax lea r12, [rsp+118h+var_D8] loc_1539: sub rbp, 28h ; '(' mov rdi, [rbp+0]; void * lea rax, [rbp+10h] cmp rdi, rax jz short loc_1557 mov rax, [rbp+10h] lea rsi, [rax+1]; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_1557: cmp rbp, r12 jnz short loc_1539 mov qword ptr [rbx], 0 mov qword ptr [rbx+8], 0 mov qword ptr [rbx+10h], 0 mov rbp, [rsp+118h+var_F0] lea rax, [rsp+118h+var_100] mov r14, rax cmp rbp, rax jnz loc_1656 loc_1589: lea rdi, [rsp+118h+var_108] mov rsi, [rsp+118h+var_F8] call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E; std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,int>> *) mov rax, [rsp+118h+var_30] sub rax, fs:28h jnz loc_16C6 mov rax, rbx add rsp, 0F0h pop rbx pop rbp pop r12 pop r13 pop r14 retn endbr64 mov rbx, rax lea rdi, [rsp+arg_8] mov rsi, [rsp+arg_18] call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E; std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,int>> *) lea rbp, [rsp+arg_D8] lea r12, [rsp+arg_38] loc_15E5: sub rbp, 28h ; '(' mov rdi, rbp call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv; std::string::_M_dispose(void) cmp rbp, r12 jnz short loc_15E5 mov edx, 3 jmp loc_13CB loc_1600: add qword ptr [rbx+8], 20h ; ' ' loc_1605: add r12d, 1 cmp [rbp+40h], r12d jle short loc_1642 loc_160F: mov rdi, [rbx+8] cmp rdi, [rbx+10h] jz short loc_1632 lea rax, [rdi+10h] mov [rdi], rax mov rsi, [rbp+20h] mov rdx, rsi add rdx, [rbp+28h] call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag; std::string::_M_construct<char *>(char *,char *,std::forward_iterator_tag) jmp short loc_1600 loc_1632: mov rdx, r13 mov rsi, rdi mov rdi, rbx call _ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_realloc_insertIJRKS5_EEEvN9__gnu_cxx17__normal_iteratorIPS5_S7_EEDpOT_; std::vector<std::string>::_M_realloc_insert<std::string const&>(__gnu_cxx::__normal_iterator<std::string*,std::vector<std::string>>,std::string const&) jmp short loc_1605 loc_1642: mov rdi, rbp call __ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base; std::_Rb_tree_increment(std::_Rb_tree_node_base *) mov rbp, rax cmp rax, r14 jz loc_1589 loc_1656: mov r12d, 0 lea r13, [rbp+20h] cmp dword ptr [rbp+40h], 0 jg short loc_160F jmp short loc_1642 loc_1668: mov rax, [rsp+arg_E0] sub rax, fs:28h jz short loc_1680 call ___stack_chk_fail loc_1680: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume endbr64 mov rbp, rax mov rdi, rbx call _ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED2Ev; std::vector<std::string>::~vector() lea rdi, [rsp+arg_8] mov rsi, [rsp+arg_18] call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E; std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,int>> *) mov rax, [rsp+arg_E0] sub rax, fs:28h jz short loc_16BE call ___stack_chk_fail loc_16BE: mov rdi, rbp; struct _Unwind_Exception * call __Unwind_Resume loc_16C6: call ___stack_chk_fail
_QWORD * func0[abi:cxx11](_QWORD *a1, int a2, int a3, int a4, int a5) { char *v9; // rbp long long insert_hint_unique_pos; // rax long long v11; // rdx char *v12; // rbp long long i; // rbp int j; // r12d _QWORD *v16; // rdi _BYTE *v17; // [rsp+8h] [rbp-110h] BYREF _BYTE v18[8]; // [rsp+10h] [rbp-108h] BYREF int v19; // [rsp+18h] [rbp-100h] BYREF long long v20; // [rsp+20h] [rbp-F8h] int *v21; // [rsp+28h] [rbp-F0h] int *v22; // [rsp+30h] [rbp-E8h] long long v23; // [rsp+38h] [rbp-E0h] _QWORD v24[2]; // [rsp+40h] [rbp-D8h] BYREF char v25; // [rsp+50h] [rbp-C8h] BYREF int v26; // [rsp+60h] [rbp-B8h] char *v27; // [rsp+68h] [rbp-B0h] BYREF char v28; // [rsp+78h] [rbp-A0h] BYREF int v29; // [rsp+88h] [rbp-90h] char *v30; // [rsp+90h] [rbp-88h] BYREF char v31; // [rsp+A0h] [rbp-78h] BYREF int v32; // [rsp+B0h] [rbp-68h] char *v33; // [rsp+B8h] [rbp-60h] BYREF char v34; // [rsp+C8h] [rbp-50h] BYREF int v35; // [rsp+D8h] [rbp-40h] char v36; // [rsp+E0h] [rbp-38h] BYREF unsigned long long v37; // [rsp+E8h] [rbp-30h] v37 = __readfsqword(0x28u); v24[0] = &v25; std::string::_M_construct<char const*>(v24, aPqrs); v26 = a2; v27 = &v28; std::string::_M_construct<char const*>(&v27, &aPqrs[1]); v29 = a3; v30 = &v31; std::string::_M_construct<char const*>(&v30, &aPqrs[2]); v32 = a4; v33 = &v34; std::string::_M_construct<char const*>(&v33, &aPqrs[3]); v35 = a5; v19 = 0; v20 = 0LL; v21 = &v19; v22 = &v19; v23 = 0LL; v17 = v18; v9 = (char *)v24; do { insert_hint_unique_pos = std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_get_insert_hint_unique_pos( v18, &v19, v9); if ( v11 ) std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_insert_<std::pair<std::string const,int> const&,std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_Alloc_node>( v18, insert_hint_unique_pos, v11, v9, &v17); v9 += 40; } while ( v9 != &v36 ); v12 = &v36; do { v12 -= 40; if ( *(char **)v12 != v12 + 16 ) operator delete(*(void **)v12, *((_QWORD *)v12 + 2) + 1LL); } while ( v12 != (char *)v24 ); *a1 = 0LL; a1[1] = 0LL; a1[2] = 0LL; for ( i = (long long)v21; (int *)i != &v19; i = std::_Rb_tree_increment(i) ) { for ( j = 0; *(_DWORD *)(i + 64) > j; ++j ) { v16 = (_QWORD *)a1[1]; if ( v16 == (_QWORD *)a1[2] ) { std::vector<std::string>::_M_realloc_insert<std::string const&>(a1, a1[1], i + 32); } else { *v16 = v16 + 2; std::string::_M_construct<char *>(v16, *(_QWORD *)(i + 32), *(_QWORD *)(i + 40) + *(_QWORD *)(i + 32)); a1[1] += 32LL; } } } std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_erase( v18, v20); return a1; }
func0[abi:cxx11]: ENDBR64 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0xf0 MOV RBX,RDI MOV R14D,ESI MOV R13D,EDX MOV R12D,ECX MOV EBP,R8D MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0xe8],RAX XOR EAX,EAX LEA RDI,[RSP + 0x40] LEA RAX,[RSP + 0x50] MOV qword ptr [RSP + 0x40],RAX LEA RDX,[0x1042b5] LEA RSI,[RDX + -0x1] LAB_001013b8: CALL 0x0010280e JMP 0x001013f8 LAB_001013f8: MOV dword ptr [RSP + 0x60],R14D LEA RAX,[RSP + 0x78] MOV qword ptr [RSP + 0x68],RAX LEA RDI,[RSP + 0x68] LEA RDX,[0x1042b7] LEA RSI,[RDX + -0x1] LAB_00101417: CALL 0x0010280e JMP 0x0010142c LAB_0010142c: MOV dword ptr [RSP + 0x88],R13D LEA RAX,[RSP + 0xa0] MOV qword ptr [RSP + 0x90],RAX LEA RDI,[RSP + 0x90] LEA RDX,[0x1042b9] LEA RSI,[RDX + -0x1] LAB_00101457: CALL 0x0010280e JMP 0x0010146f LAB_0010146f: MOV dword ptr [RSP + 0xb0],R12D LEA RAX,[RSP + 0xc8] MOV qword ptr [RSP + 0xb8],RAX LEA RDI,[RSP + 0xb8] LEA RDX,[0x1042bb] LEA RSI,[RDX + -0x1] LAB_0010149a: CALL 0x0010280e JMP 0x001014b2 LAB_001014b2: MOV dword ptr [RSP + 0xd8],EBP MOV dword ptr [RSP + 0x18],0x0 MOV qword ptr [RSP + 0x20],0x0 LEA RDX,[RSP + 0x10] LEA RAX,[RSP + 0x18] MOV qword ptr [RSP + 0x28],RAX MOV qword ptr [RSP + 0x30],RAX MOV qword ptr [RSP + 0x38],0x0 MOV qword ptr [RSP + 0x8],RDX LEA RBP,[RSP + 0x40] MOV R12,RDX JMP 0x00101507 LAB_001014f6: ADD RBP,0x28 LEA RAX,[RSP + 0xe0] CMP RBP,RAX JZ 0x00101531 LAB_00101507: LEA RSI,[RSP + 0x18] MOV RDX,RBP MOV RDI,R12 CALL 0x001030b4 TEST RDX,RDX JZ 0x001014f6 LEA R8,[RSP + 0x8] MOV RCX,RBP MOV RSI,RAX MOV RDI,R12 LAB_0010152a: CALL 0x00102e5a JMP 0x001014f6 LAB_00101531: MOV RBP,RAX LEA R12,[RSP + 0x40] LAB_00101539: SUB RBP,0x28 MOV RDI,qword ptr [RBP] LEA RAX,[RBP + 0x10] CMP RDI,RAX JZ 0x00101557 MOV RAX,qword ptr [RBP + 0x10] LEA RSI,[RAX + 0x1] CALL 0x00101200 LAB_00101557: CMP RBP,R12 JNZ 0x00101539 MOV qword ptr [RBX],0x0 MOV qword ptr [RBX + 0x8],0x0 MOV qword ptr [RBX + 0x10],0x0 MOV RBP,qword ptr [RSP + 0x28] LEA RAX,[RSP + 0x18] MOV R14,RAX CMP RBP,RAX JNZ 0x00101656 LAB_00101589: LEA RDI,[RSP + 0x10] MOV RSI,qword ptr [RSP + 0x20] CALL 0x001028f0 MOV RAX,qword ptr [RSP + 0xe8] SUB RAX,qword ptr FS:[0x28] JNZ 0x001016c6 MOV RAX,RBX ADD RSP,0xf0 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_00101600: ADD qword ptr [RBX + 0x8],0x20 LAB_00101605: ADD R12D,0x1 CMP dword ptr [RBP + 0x40],R12D JLE 0x00101642 LAB_0010160f: MOV RDI,qword ptr [RBX + 0x8] CMP RDI,qword ptr [RBX + 0x10] JZ 0x00101632 LEA RAX,[RDI + 0x10] MOV qword ptr [RDI],RAX MOV RSI,qword ptr [RBP + 0x20] MOV RDX,RSI ADD RDX,qword ptr [RBP + 0x28] LAB_0010162b: CALL 0x0010294a JMP 0x00101600 LAB_00101632: MOV RDX,R13 MOV RSI,RDI MOV RDI,RBX CALL 0x001029e6 JMP 0x00101605 LAB_00101642: MOV RDI,RBP CALL 0x001011c0 MOV RBP,RAX CMP RAX,R14 JZ 0x00101589 LAB_00101656: MOV R12D,0x0 LEA R13,[RBP + 0x20] CMP dword ptr [RBP + 0x40],0x0 JG 0x0010160f JMP 0x00101642 LAB_001016c6: CALL 0x00101220
/* func0[abi:cxx11](int, int, int, int) */ vector<std::string,std::allocator<std::string>> * func0_abi_cxx11_(int param_1,int param_2,int param_3,int param_4) { long *plVar1; _Rb_tree_node_base *p_Var2; string *psVar3; string *psVar4; int4 in_register_0000003c; vector<std::string,std::allocator<std::string>> *this; int iVar5; long in_FS_OFFSET; int auVar6 [16]; _Rb_tree<std::string,std::pair<std::string_const,int>,std::_Select1st<std::pair<std::string_const,int>>,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> local_108 [8]; int4 local_100 [2]; _Rb_tree_node *local_f8; _Rb_tree_node_base *local_f0; _Rb_tree_node_base *local_e8; int8 local_e0; int *local_d8 [2]; int local_c8 [16]; int local_b8; int *local_b0 [2]; int local_a0 [16]; int local_90; int *local_88 [2]; int local_78 [16]; int local_68; int *local_60 [2]; int local_50 [24]; string local_38 [8]; long local_30; this = (vector<std::string,std::allocator<std::string>> *)CONCAT44(in_register_0000003c,param_1); local_30 = *(long *)(in_FS_OFFSET + 0x28); local_d8[0] = local_c8; /* try { // try from 001013b8 to 001013bc has its CatchHandler @ 001013bf */ std::string::_M_construct<char_const*>((char *)local_d8,"p",0x1042b5); local_b0[0] = local_a0; local_b8 = param_2; /* try { // try from 00101417 to 0010141b has its CatchHandler @ 0010141e */ std::string::_M_construct<char_const*>((char *)local_b0,"q",0x1042b7); local_88[0] = local_78; local_90 = param_3; /* try { // try from 00101457 to 0010145b has its CatchHandler @ 0010145e */ std::string::_M_construct<char_const*>((char *)local_88,"r",0x1042b9); local_60[0] = local_50; local_68 = param_4; /* try { // try from 0010149a to 0010149e has its CatchHandler @ 001014a1 */ std::string::_M_construct<char_const*>((char *)local_60,"s",0x1042bb); local_100[0] = 0; local_f8 = (_Rb_tree_node *)0x0; local_f0 = (_Rb_tree_node_base *)local_100; local_e0 = 0; psVar3 = (string *)local_d8; local_e8 = local_f0; do { auVar6 = std:: _Rb_tree<std::string,std::pair<std::string_const,int>,std::_Select1st<std::pair<std::string_const,int>>,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::_M_get_insert_hint_unique_pos(local_108,(_Rb_tree_const_iterator)local_100,psVar3); if (auVar6._8_8_ != (pair *)0x0) { /* try { // try from 0010152a to 0010152e has its CatchHandler @ 001015c2 */ std:: _Rb_tree<std::string,std::pair<std::string_const,int>,std::_Select1st<std::pair<std::string_const,int>>,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> :: _M_insert_<std::pair<std::string_const,int>const&,std::_Rb_tree<std::string,std::pair<std::string_const,int>,std::_Select1st<std::pair<std::string_const,int>>,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>>::_Alloc_node> ((_Rb_tree_node_base *)local_108,auVar6._0_8_,auVar6._8_8_,(_Alloc_node *)psVar3); } psVar3 = psVar3 + 0x28; } while (psVar3 != local_38); psVar3 = local_38; do { psVar4 = psVar3 + -0x28; if (*(string **)psVar4 != psVar3 + -0x18) { operator_delete(*(string **)psVar4,*(long *)(psVar3 + -0x18) + 1); } psVar3 = psVar4; } while (psVar4 != (string *)local_d8); *(int8 *)this = 0; *(int8 *)(this + 8) = 0; *(int8 *)(this + 0x10) = 0; for (p_Var2 = local_f0; p_Var2 != (_Rb_tree_node_base *)local_100; p_Var2 = (_Rb_tree_node_base *)std::_Rb_tree_increment(p_Var2)) { iVar5 = 0; if (0 < *(int *)(p_Var2 + 0x40)) { do { plVar1 = *(long **)(this + 8); if (plVar1 == *(long **)(this + 0x10)) { std::vector<std::string,std::allocator<std::string>>:: _M_realloc_insert<std::string_const&> (this,(__normal_iterator)plVar1,(string *)(p_Var2 + 0x20)); } else { *plVar1 = (long)(plVar1 + 2); /* try { // try from 0010162b to 0010163f has its CatchHandler @ 00101688 */ std::string::_M_construct<char*> ((char *)plVar1,*(char **)(p_Var2 + 0x20), (int)*(char **)(p_Var2 + 0x20) + (int)*(int8 *)(p_Var2 + 0x28)); *(long *)(this + 8) = *(long *)(this + 8) + 0x20; } iVar5 = iVar5 + 1; } while (iVar5 < *(int *)(p_Var2 + 0x40)); } } std:: _Rb_tree<std::string,std::pair<std::string_const,int>,std::_Select1st<std::pair<std::string_const,int>>,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::_M_erase(local_108,local_f8); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return this; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,238
func0
#include <vector> #include <string> #include <map> #include <assert.h>
std::vector<std::string> func0(int a, int b, int c, int d) { std::map<std::string, int> counts = {{"p", a}, {"q", b}, {"r", c}, {"s", d}}; std::vector<std::string> result; for (auto const& elem : counts) { for (int i = 0; i < elem.second; ++i) { result.push_back(elem.first); } } return result; }
int main() { assert((func0(4,2,0,-2) == std::vector<std::string>{"p", "p", "p", "p", "q", "q"})); assert((func0(0,1,2,3) == std::vector<std::string>{"q", "r", "r", "s", "s", "s"})); assert((func0(11,15,12,23) == std::vector<std::string>{"p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s"})); return 0; }
O2
cpp
func0[abi:cxx11](int, int, int, int): endbr64 push %r15 mov $0x71,%r9d mov $0x72,%r10d mov $0x73,%r11d push %r14 push %r13 push %r12 mov %rdi,%r12 mov $0x70,%edi push %rbp push %rbx sub $0x108,%rsp mov %fs:0x28,%rax mov %rax,0xf8(%rsp) xor %eax,%eax lea 0x60(%rsp),%rax lea 0x28(%rsp),%r14 movq $0x1,0x58(%rsp) mov %rax,0x50(%rsp) lea 0x50(%rsp),%rbx lea 0x20(%rsp),%r15 lea 0x88(%rsp),%rax mov %rbx,0x10(%rsp) mov %rax,0x78(%rsp) lea 0xb0(%rsp),%rax mov %rax,0xa0(%rsp) lea 0xd8(%rsp),%rax mov %rax,0xc8(%rsp) lea 0xf0(%rsp),%rax mov %di,0x60(%rsp) mov %esi,0x70(%rsp) movq $0x1,0x80(%rsp) mov %r9w,0x88(%rsp) mov %edx,0x98(%rsp) movq $0x1,0xa8(%rsp) mov %r10w,0xb0(%rsp) mov %ecx,0xc0(%rsp) movq $0x1,0xd0(%rsp) mov %r11w,0xd8(%rsp) mov %r8d,0xe8(%rsp) movl $0x0,0x28(%rsp) movq $0x0,0x30(%rsp) mov %r14,0x38(%rsp) mov %r14,0x40(%rsp) movq $0x0,0x48(%rsp) mov %rax,0x8(%rsp) nopl (%rax) mov %rbx,%rdx mov %r14,%rsi mov %r15,%rdi callq 27a0 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS8_ERS7_> mov %rdx,%r13 test %rdx,%rdx je 1eff <_Z5func0B5cxx11iiii+0x19f> test %rax,%rax setne %al cmp %r14,%rdx sete %dil or %dil,%al mov %al,0x4(%rsp) je 1ff0 <_Z5func0B5cxx11iiii+0x290> mov $0x48,%edi callq 11f0 <_Znwm@plt> mov %rax,%rbp lea 0x20(%rax),%rdi lea 0x30(%rax),%rax mov (%rbx),%rsi mov 0x8(%rbx),%rdx mov %rax,0x20(%rbp) add %rsi,%rdx callq 21d0 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag> mov 0x20(%rbx),%eax movzbl 0x4(%rsp),%edi mov %r14,%rcx mov %r13,%rdx mov %rbp,%rsi mov %eax,0x40(%rbp) callq 1150 <_ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_@plt> addq $0x1,0x48(%rsp) add $0x28,%rbx cmp 0x8(%rsp),%rbx jne 1e88 <_Z5func0B5cxx11iiii+0x128> sub $0x28,%rbx mov (%rbx),%rdi lea 0x10(%rbx),%rax cmp %rax,%rdi je 1f23 <_Z5func0B5cxx11iiii+0x1c3> callq 11e0 <_ZdlPv@plt> cmp 0x10(%rsp),%rbx jne 1f0e <_Z5func0B5cxx11iiii+0x1ae> mov 0x38(%rsp),%rbp movq $0x0,(%r12) movq $0x0,0x8(%r12) movq $0x0,0x10(%r12) cmp %r14,%rbp je 1fb7 <_Z5func0B5cxx11iiii+0x257> xchg %ax,%ax mov 0x40(%rbp),%eax lea 0x20(%rbp),%r13 xor %ebx,%ebx test %eax,%eax jg 1f85 <_Z5func0B5cxx11iiii+0x225> jmp 1fa7 <_Z5func0B5cxx11iiii+0x247> lea 0x10(%rdi),%rax mov 0x28(%rbp),%rdx mov %rax,(%rdi) mov 0x20(%rbp),%rsi add %rsi,%rdx callq 21d0 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag> addq $0x20,0x8(%r12) add $0x1,%ebx cmp %ebx,0x40(%rbp) jle 1fa7 <_Z5func0B5cxx11iiii+0x247> mov 0x8(%r12),%rdi cmp 0x10(%r12),%rdi jne 1f60 <_Z5func0B5cxx11iiii+0x200> mov %rdi,%rsi mov %r13,%rdx mov %r12,%rdi callq 23d0 <_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_realloc_insertIJRKS5_EEEvN9__gnu_cxx17__normal_iteratorIPS5_S7_EEDpOT_> add $0x1,%ebx cmp %ebx,0x40(%rbp) jg 1f85 <_Z5func0B5cxx11iiii+0x225> mov %rbp,%rdi callq 11b0 <_ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base@plt> mov %rax,%rbp cmp %r14,%rax jne 1f50 <_Z5func0B5cxx11iiii+0x1f0> mov 0x30(%rsp),%rsi mov %r15,%rdi callq 2170 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E> mov 0xf8(%rsp),%rax xor %fs:0x28,%rax jne 2059 <_Z5func0B5cxx11iiii+0x2f9> add $0x108,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq mov 0x8(%rbx),%rbp mov 0x28(%rdx),%rcx cmp %rcx,%rbp mov %rcx,%rdx cmovbe %rbp,%rdx test %rdx,%rdx je 2021 <_Z5func0B5cxx11iiii+0x2c1> mov 0x20(%r13),%rsi mov (%rbx),%rdi mov %rcx,0x18(%rsp) callq 1180 <memcmp@plt> mov 0x18(%rsp),%rcx test %eax,%eax jne 2043 <_Z5func0B5cxx11iiii+0x2e3> sub %rcx,%rbp mov $0x80000000,%eax cmp %rax,%rbp jge 1eb8 <_Z5func0B5cxx11iiii+0x158> movabs $0xffffffff7fffffff,%rax cmp %rax,%rbp jle 204f <_Z5func0B5cxx11iiii+0x2ef> mov %ebp,%eax shr $0x1f,%eax mov %eax,0x4(%rsp) jmpq 1eb8 <_Z5func0B5cxx11iiii+0x158> movb $0x1,0x4(%rsp) jmpq 1eb8 <_Z5func0B5cxx11iiii+0x158> callq 1210 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 1260 <_Z5func0B5cxx11iiii.cold> endbr64 mov %rax,%rdi jmpq 127d <_Z5func0B5cxx11iiii.cold+0x1d> endbr64 mov %rax,%rbp jmpq 129b <_Z5func0B5cxx11iiii.cold+0x3b> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
_Z5func0B5cxx11iiii: endbr64 push r15 push r14 mov r14d, esi push r13 mov r13d, edx lea rdx, aP+1; "" push r12 lea rsi, [rdx-1] mov r12d, ecx push rbp mov ebp, r8d push rbx mov rbx, rdi sub rsp, 108h mov rax, fs:28h mov [rsp+138h+var_40], rax xor eax, eax lea rdi, [rsp+138h+var_E8] lea rax, [rsp+138h+var_D8] mov [rsp+138h+var_128], rdi mov [rsp+138h+var_E8], rax call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag_isra_0; std::string::_M_construct<char const*>(char const*,char const*,std::forward_iterator_tag) [clone] lea rdx, aQ+1; "" lea rdi, [rsp+138h+var_C0] mov [rsp+138h+var_C8], r14d lea rax, [rsp+138h+var_B0] lea rsi, [rdx-1] mov [rsp+138h+var_C0], rax call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag_isra_0; std::string::_M_construct<char const*>(char const*,char const*,std::forward_iterator_tag) [clone] lea rdx, aR+1; "" lea rax, [rsp+138h+var_88] mov [rsp+138h+var_A0], r13d lea rdi, [rsp+138h+var_98] lea rsi, [rdx-1] mov [rsp+138h+var_98], rax call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag_isra_0; std::string::_M_construct<char const*>(char const*,char const*,std::forward_iterator_tag) [clone] lea rdx, aS+1; "" lea rax, [rsp+138h+var_60] mov [rsp+138h+var_78], r12d lea rdi, [rsp+138h+var_70] lea rsi, [rdx-1] mov [rsp+138h+var_70], rax call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag_isra_0; std::string::_M_construct<char const*>(char const*,char const*,std::forward_iterator_tag) [clone] lea r14, [rsp+138h+var_110] lea rax, [rsp+138h+var_118] mov [rsp+138h+var_50], ebp mov rbp, [rsp+138h+var_128] mov [rsp+138h+var_110], 0 lea r15, [rsp+138h+var_48] mov [rsp+138h+var_108], 0 mov [rsp+138h+var_100], r14 mov [rsp+138h+var_F8], r14 mov [rsp+138h+var_F0], 0 mov [rsp+138h+var_138], rax jmp short loc_27B6 loc_2760: mov edi, 48h ; 'H'; unsigned __int64 call __Znwm; operator new(ulong) mov r13, rax lea rdi, [rax+20h] lea rax, [rax+30h] mov rsi, [rbp+0] mov rdx, [rbp+8] mov [r13+20h], rax add rdx, rsi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag_isra_0; std::string::_M_construct<char *>(char *,char *,std::forward_iterator_tag) [clone] mov eax, [rbp+20h] movzx edi, byte ptr [rsp+138h+var_12C] mov rcx, r14 mov rdx, r12 mov rsi, r13 mov [r13+40h], eax call __ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_; std::_Rb_tree_insert_and_rebalance(bool,std::_Rb_tree_node_base *,std::_Rb_tree_node_base *,std::_Rb_tree_node_base&) add [rsp+138h+var_F0], 1 loc_27A9: add rbp, 28h ; '(' cmp rbp, r15 jz loc_2848 loc_27B6: mov rdi, [rsp+138h+var_138] mov rdx, rbp mov rsi, r14 call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS8_ERS7_; std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<std::string const,int>>,std::string const&) mov r12, rdx test rdx, rdx jz short loc_27A9 cmp rdx, r14 setz dl test rax, rax setnz al or dl, al mov byte ptr [rsp+138h+var_12C], dl jnz loc_2760 mov r13, [rbp+8] mov rcx, [r12+28h] cmp r13, rcx mov rdx, rcx cmovbe rdx, r13; n test rdx, rdx jz short loc_2819 mov rsi, [r12+20h]; s2 mov rdi, [rbp+0]; s1 mov [rsp+138h+var_120], rcx call _memcmp mov rcx, [rsp+138h+var_120] test eax, eax jnz short loc_2839 loc_2819: sub r13, rcx cmp r13, 7FFFFFFFh jg loc_2760 cmp r13, 0FFFFFFFF80000000h jl loc_292A mov eax, r13d loc_2839: shr eax, 1Fh mov [rsp+138h+var_12C], eax jmp loc_2760 loc_2848: sub rbp, 28h ; '(' mov rdi, [rbp+0]; void * lea rax, [rbp+10h] cmp rdi, rax jz short loc_2866 mov rax, [rbp+10h] lea rsi, [rax+1]; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_2866: mov rax, [rsp+138h+var_128] cmp rbp, rax jnz short loc_2848 mov rbp, [rsp+138h+var_100] pxor xmm0, xmm0 mov qword ptr [rbx+10h], 0 movups xmmword ptr [rbx], xmm0 cmp rbp, r14 jz short loc_28F8 nop dword ptr [rax+00000000h] loc_2890: mov eax, [rbp+40h] xor r12d, r12d lea r13, [rbp+20h] test eax, eax jg short loc_28C6 jmp short loc_28E8 loc_28A0: lea rax, [rdi+10h] mov rdx, [rbp+28h] mov [rdi], rax mov rsi, [rbp+20h] add rdx, rsi call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag_isra_0; std::string::_M_construct<char *>(char *,char *,std::forward_iterator_tag) [clone] add qword ptr [rbx+8], 20h ; ' ' add r12d, 1 cmp [rbp+40h], r12d jle short loc_28E8 loc_28C6: mov rdi, [rbx+8] cmp rdi, [rbx+10h] jnz short loc_28A0 mov rsi, rdi mov rdx, r13 mov rdi, rbx call _ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_realloc_insertIJRKS5_EEEvN9__gnu_cxx17__normal_iteratorIPS5_S7_EEDpOT_; std::vector<std::string>::_M_realloc_insert<std::string const&>(__gnu_cxx::__normal_iterator<std::string*,std::vector<std::string>>,std::string const&) add r12d, 1 cmp [rbp+40h], r12d jg short loc_28C6 loc_28E8: mov rdi, rbp call __ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base; std::_Rb_tree_increment(std::_Rb_tree_node_base *) mov rbp, rax cmp rax, r14 jnz short loc_2890 loc_28F8: mov rdi, [rsp+138h+var_108]; void * call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E_isra_0; std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,int>> *) [clone] mov rax, [rsp+138h+var_40] sub rax, fs:28h jnz short loc_2934 add rsp, 108h mov rax, rbx pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_292A: mov byte ptr [rsp+138h+var_12C], 1 jmp loc_2760 loc_2934: call ___stack_chk_fail endbr64 mov rbp, rax jmp _Z5func0B5cxx11iiii_cold; func0(int,int,int,int) [clone] endbr64 mov rbx, rax jmp loc_12B1 endbr64 mov rbx, rax jmp loc_132B endbr64 mov rdi, rax; void * jmp loc_1337 endbr64 mov rbx, rax jmp loc_1303 endbr64 mov rbx, rax jmp loc_1366 endbr64 mov rbx, rax jmp loc_136D
long long func0[abi:cxx11](long long a1, int a2, int a3, int a4, int a5) { char *v9; // rbp long long i; // rax int *v11; // rdx long long v12; // r13 char *v13; // rsi long long v14; // rdx int *v15; // r12 size_t v16; // r13 size_t v17; // rcx size_t v18; // rdx unsigned int v19; // eax long long v20; // r13 long long v21; // rbp int j; // r12d long long v23; // rdx _QWORD *v24; // rdi unsigned int v26; // [rsp+Ch] [rbp-12Ch] size_t v27; // [rsp+18h] [rbp-120h] char v28[8]; // [rsp+20h] [rbp-118h] BYREF int v29; // [rsp+28h] [rbp-110h] BYREF void *v30; // [rsp+30h] [rbp-108h] int *v31; // [rsp+38h] [rbp-100h] int *v32; // [rsp+40h] [rbp-F8h] long long v33; // [rsp+48h] [rbp-F0h] _QWORD v34[2]; // [rsp+50h] [rbp-E8h] BYREF char v35; // [rsp+60h] [rbp-D8h] BYREF int v36; // [rsp+70h] [rbp-C8h] char *v37; // [rsp+78h] [rbp-C0h] BYREF char v38; // [rsp+88h] [rbp-B0h] BYREF int v39; // [rsp+98h] [rbp-A0h] char *v40; // [rsp+A0h] [rbp-98h] BYREF char v41; // [rsp+B0h] [rbp-88h] BYREF int v42; // [rsp+C0h] [rbp-78h] char *v43; // [rsp+C8h] [rbp-70h] BYREF char v44; // [rsp+D8h] [rbp-60h] BYREF int v45; // [rsp+E8h] [rbp-50h] char v46; // [rsp+F0h] [rbp-48h] BYREF unsigned long long v47; // [rsp+F8h] [rbp-40h] v47 = __readfsqword(0x28u); v34[0] = &v35; std::string::_M_construct<char const*>(v34, "p"); v36 = a2; v37 = &v38; std::string::_M_construct<char const*>(&v37, "q"); v39 = a3; v40 = &v41; std::string::_M_construct<char const*>(&v40, "r"); v42 = a4; v43 = &v44; std::string::_M_construct<char const*>(&v43, "s"); v45 = a5; v9 = (char *)v34; v29 = 0; v30 = 0LL; v31 = &v29; v32 = &v29; v33 = 0LL; for ( i = std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_get_insert_hint_unique_pos( v28, &v29, v34); ; i = std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_get_insert_hint_unique_pos( v28, &v29, v9) ) { v15 = v11; if ( v11 ) { LOBYTE(v26) = i != 0 || v11 == &v29; if ( !(_BYTE)v26 ) { v16 = *((_QWORD *)v9 + 1); v18 = *((_QWORD *)v11 + 5); v17 = v18; if ( v16 <= v18 ) v18 = *((_QWORD *)v9 + 1); if ( v18 ) { v27 = *((_QWORD *)v15 + 5); v19 = memcmp(*(const void **)v9, *((const void **)v15 + 4), v18); v17 = v27; if ( v19 ) { LABEL_14: v26 = v19 >> 31; goto LABEL_2; } } v20 = v16 - v17; if ( v20 <= 0x7FFFFFFF ) { if ( v20 < (long long)0xFFFFFFFF80000000LL ) { LOBYTE(v26) = 1; goto LABEL_2; } v19 = v20; goto LABEL_14; } } LABEL_2: v12 = operator new(0x48uLL); v13 = *(char **)v9; v14 = *((_QWORD *)v9 + 1); *(_QWORD *)(v12 + 32) = v12 + 48; std::string::_M_construct<char *>(v12 + 32, v13, &v13[v14]); *(_DWORD *)(v12 + 64) = *((_DWORD *)v9 + 8); std::_Rb_tree_insert_and_rebalance((unsigned __int8)v26, v12, v15, &v29); ++v33; } v9 += 40; if ( v9 == &v46 ) break; } do { v9 -= 40; if ( *(char **)v9 != v9 + 16 ) operator delete(*(void **)v9, *((_QWORD *)v9 + 2) + 1LL); } while ( v9 != (char *)v34 ); v21 = (long long)v31; *(_QWORD *)(a1 + 16) = 0LL; for ( *(_OWORD *)a1 = 0LL; (int *)v21 != &v29; v21 = std::_Rb_tree_increment(v21) ) { for ( j = 0; *(_DWORD *)(v21 + 64) > j; ++j ) { while ( 1 ) { v24 = *(_QWORD **)(a1 + 8); if ( v24 == *(_QWORD **)(a1 + 16) ) break; v23 = *(_QWORD *)(v21 + 40); *v24 = v24 + 2; std::string::_M_construct<char *>(v24, *(_QWORD *)(v21 + 32), *(_QWORD *)(v21 + 32) + v23); *(_QWORD *)(a1 + 8) += 32LL; if ( *(_DWORD *)(v21 + 64) <= ++j ) goto LABEL_24; } std::vector<std::string>::_M_realloc_insert<std::string const&>(a1, *(_QWORD *)(a1 + 8), v21 + 32); } LABEL_24: ; } std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_erase(v30); return a1; }
func0[abi:cxx11]: ENDBR64 PUSH R15 PUSH R14 MOV R14D,ESI PUSH R13 MOV R13D,EDX LEA RDX,[0x1042b4] PUSH R12 LEA RSI,[RDX + -0x1] MOV R12D,ECX PUSH RBP MOV EBP,R8D PUSH RBX MOV RBX,RDI SUB RSP,0x108 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0xf8],RAX XOR EAX,EAX LEA RDI,[RSP + 0x50] LEA RAX,[RSP + 0x60] MOV qword ptr [RSP + 0x10],RDI MOV qword ptr [RSP + 0x50],RAX LAB_00102686: CALL 0x00102320 LEA RDX,[0x1042b6] LEA RDI,[RSP + 0x78] MOV dword ptr [RSP + 0x70],R14D LEA RAX,[RSP + 0x88] LEA RSI,[RDX + -0x1] MOV qword ptr [RSP + 0x78],RAX LAB_001026ad: CALL 0x00102320 LEA RDX,[0x1042b8] LEA RAX,[RSP + 0xb0] MOV dword ptr [RSP + 0x98],R13D LEA RDI,[RSP + 0xa0] LEA RSI,[RDX + -0x1] MOV qword ptr [RSP + 0xa0],RAX LAB_001026dd: CALL 0x00102320 LEA RDX,[0x1042ba] LEA RAX,[RSP + 0xd8] MOV dword ptr [RSP + 0xc0],R12D LEA RDI,[RSP + 0xc8] LEA RSI,[RDX + -0x1] MOV qword ptr [RSP + 0xc8],RAX LAB_0010270d: CALL 0x00102320 LEA R14,[RSP + 0x28] LEA RAX,[RSP + 0x20] MOV dword ptr [RSP + 0xe8],EBP MOV RBP,qword ptr [RSP + 0x10] MOV dword ptr [RSP + 0x28],0x0 LEA R15,[RSP + 0xf0] MOV qword ptr [RSP + 0x30],0x0 MOV qword ptr [RSP + 0x38],R14 MOV qword ptr [RSP + 0x40],R14 MOV qword ptr [RSP + 0x48],0x0 MOV qword ptr [RSP],RAX JMP 0x001027b6 LAB_00102760: MOV EDI,0x48 LAB_00102765: CALL 0x001011f0 MOV R13,RAX LEA RDI,[RAX + 0x20] LEA RAX,[RAX + 0x30] MOV RSI,qword ptr [RBP] MOV RDX,qword ptr [RBP + 0x8] MOV qword ptr [R13 + 0x20],RAX ADD RDX,RSI LAB_00102784: CALL 0x00102450 MOV EAX,dword ptr [RBP + 0x20] MOVZX EDI,byte ptr [RSP + 0xc] MOV RCX,R14 MOV RDX,R12 MOV RSI,R13 MOV dword ptr [R13 + 0x40],EAX CALL 0x00101160 ADD qword ptr [RSP + 0x48],0x1 LAB_001027a9: ADD RBP,0x28 CMP RBP,R15 JZ 0x00102848 LAB_001027b6: MOV RDI,qword ptr [RSP] MOV RDX,RBP MOV RSI,R14 CALL 0x00103120 MOV R12,RDX TEST RDX,RDX JZ 0x001027a9 CMP RDX,R14 SETZ DL TEST RAX,RAX SETNZ AL OR DL,AL MOV byte ptr [RSP + 0xc],DL JNZ 0x00102760 MOV R13,qword ptr [RBP + 0x8] MOV RCX,qword ptr [R12 + 0x28] CMP R13,RCX MOV RDX,RCX CMOVBE RDX,R13 TEST RDX,RDX JZ 0x00102819 MOV RSI,qword ptr [R12 + 0x20] MOV RDI,qword ptr [RBP] MOV qword ptr [RSP + 0x18],RCX CALL 0x00101190 MOV RCX,qword ptr [RSP + 0x18] TEST EAX,EAX JNZ 0x00102839 LAB_00102819: SUB R13,RCX CMP R13,0x7fffffff JG 0x00102760 CMP R13,-0x80000000 JL 0x0010292a MOV EAX,R13D LAB_00102839: SHR EAX,0x1f MOV dword ptr [RSP + 0xc],EAX JMP 0x00102760 LAB_00102848: SUB RBP,0x28 MOV RDI,qword ptr [RBP] LEA RAX,[RBP + 0x10] CMP RDI,RAX JZ 0x00102866 MOV RAX,qword ptr [RBP + 0x10] LEA RSI,[RAX + 0x1] CALL 0x00101200 LAB_00102866: MOV RAX,qword ptr [RSP + 0x10] CMP RBP,RAX JNZ 0x00102848 MOV RBP,qword ptr [RSP + 0x38] PXOR XMM0,XMM0 MOV qword ptr [RBX + 0x10],0x0 MOVUPS xmmword ptr [RBX],XMM0 CMP RBP,R14 JZ 0x001028f8 NOP dword ptr [RAX] LAB_00102890: MOV EAX,dword ptr [RBP + 0x40] XOR R12D,R12D LEA R13,[RBP + 0x20] TEST EAX,EAX JG 0x001028c6 JMP 0x001028e8 LAB_001028a0: LEA RAX,[RDI + 0x10] MOV RDX,qword ptr [RBP + 0x28] MOV qword ptr [RDI],RAX MOV RSI,qword ptr [RBP + 0x20] ADD RDX,RSI LAB_001028b2: CALL 0x00102450 ADD qword ptr [RBX + 0x8],0x20 ADD R12D,0x1 CMP dword ptr [RBP + 0x40],R12D JLE 0x001028e8 LAB_001028c6: MOV RDI,qword ptr [RBX + 0x8] CMP RDI,qword ptr [RBX + 0x10] JNZ 0x001028a0 MOV RSI,RDI MOV RDX,R13 MOV RDI,RBX CALL 0x00102c00 ADD R12D,0x1 CMP dword ptr [RBP + 0x40],R12D JG 0x001028c6 LAB_001028e8: MOV RDI,RBP CALL 0x001011c0 MOV RBP,RAX CMP RAX,R14 JNZ 0x00102890 LAB_001028f8: MOV RDI,qword ptr [RSP + 0x30] CALL 0x00102500 MOV RAX,qword ptr [RSP + 0xf8] SUB RAX,qword ptr FS:[0x28] JNZ 0x00102934 ADD RSP,0x108 MOV RAX,RBX POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010292a: MOV byte ptr [RSP + 0xc],0x1 JMP 0x00102760 LAB_00102934: CALL 0x00101220
/* func0[abi:cxx11](int, int, int, int) */ vector<std::string,std::allocator<std::string>> * func0_abi_cxx11_(int param_1,int param_2,int param_3,int param_4) { _Rb_tree_node_base *p_Var1; char *pcVar2; int8 uVar3; ulong uVar4; ulong uVar5; long *plVar6; int iVar7; _Rb_tree_node_base *p_Var8; _Rb_tree_node_base *p_Var9; ulong __n; string *psVar10; string *psVar11; int4 in_register_0000003c; vector<std::string,std::allocator<std::string>> *this; long lVar12; long in_FS_OFFSET; bool bVar13; int auVar14 [16]; bool local_12c; _Rb_tree<std::string,std::pair<std::string_const,int>,std::_Select1st<std::pair<std::string_const,int>>,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> local_118 [8]; int4 local_110 [2]; _Rb_tree_node *local_108; _Rb_tree_node_base *local_100; _Rb_tree_node_base *local_f8; long local_f0; int *local_e8 [2]; int local_d8 [16]; int local_c8; int *local_c0 [2]; int local_b0 [16]; int local_a0; int *local_98 [2]; int local_88 [16]; int local_78; int *local_70 [2]; int local_60 [24]; string local_48 [8]; long local_40; this = (vector<std::string,std::allocator<std::string>> *)CONCAT44(in_register_0000003c,param_1); local_40 = *(long *)(in_FS_OFFSET + 0x28); local_e8[0] = local_d8; /* try { // try from 00102686 to 0010268a has its CatchHandler @ 00102951 */ std::string::_M_construct<char_const*>((char *)local_e8,"p",0x1042b4); local_c0[0] = local_b0; local_c8 = param_2; /* try { // try from 001026ad to 001026b1 has its CatchHandler @ 00102945 */ std::string::_M_construct<char_const*>((char *)local_c0,"q",0x1042b6); local_98[0] = local_88; local_a0 = param_3; /* try { // try from 001026dd to 001026e1 has its CatchHandler @ 00102981 */ std::string::_M_construct<char_const*>((char *)local_98,"r",0x1042b8); local_70[0] = local_60; local_78 = param_4; /* try { // try from 0010270d to 00102711 has its CatchHandler @ 00102975 */ std::string::_M_construct<char_const*>((char *)local_70,"s",0x1042ba); p_Var1 = (_Rb_tree_node_base *)local_110; local_110[0] = 0; local_108 = (_Rb_tree_node *)0x0; local_f0 = 0; psVar10 = (string *)local_e8; local_100 = p_Var1; local_f8 = p_Var1; do { auVar14 = std:: _Rb_tree<std::string,std::pair<std::string_const,int>,std::_Select1st<std::pair<std::string_const,int>>,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::_M_get_insert_hint_unique_pos(local_118,(_Rb_tree_const_iterator)p_Var1,psVar10); p_Var9 = auVar14._8_8_; if (p_Var9 != (_Rb_tree_node_base *)0x0) { bVar13 = auVar14._0_8_ != 0; local_12c = p_Var9 == p_Var1 || bVar13; if (p_Var9 != p_Var1 && !bVar13) { uVar4 = *(ulong *)(psVar10 + 8); uVar5 = *(ulong *)(p_Var9 + 0x28); __n = uVar5; if (uVar4 <= uVar5) { __n = uVar4; } if ((__n == 0) || (iVar7 = memcmp(*(void **)psVar10,*(void **)(p_Var9 + 0x20),__n), iVar7 == 0)) { lVar12 = uVar4 - uVar5; if (lVar12 < 0x80000000) { if (-0x80000001 < lVar12) { iVar7 = (int)lVar12; goto LAB_00102839; } local_12c = true; } } else { LAB_00102839: local_12c = SUB41((uint)iVar7 >> 0x1f,0); } } /* try { // try from 00102765 to 00102769 has its CatchHandler @ 00102969 */ p_Var8 = (_Rb_tree_node_base *)operator_new(0x48); pcVar2 = *(char **)psVar10; uVar3 = *(int8 *)(psVar10 + 8); *(_Rb_tree_node_base **)(p_Var8 + 0x20) = p_Var8 + 0x30; /* try { // try from 00102784 to 00102788 has its CatchHandler @ 0010295d */ std::string::_M_construct<char*>((char *)(p_Var8 + 0x20),pcVar2,(int)uVar3 + (int)pcVar2); *(int4 *)(p_Var8 + 0x40) = *(int4 *)(psVar10 + 0x20); std::_Rb_tree_insert_and_rebalance(local_12c,p_Var8,p_Var9,p_Var1); local_f0 = local_f0 + 1; } psVar10 = psVar10 + 0x28; if (psVar10 == local_48) { do { psVar11 = psVar10 + -0x28; if (*(string **)psVar11 != psVar10 + -0x18) { operator_delete(*(string **)psVar11,(ulong)(*(int **)(psVar10 + -0x18) + 1)); } psVar10 = psVar11; } while (psVar11 != (string *)local_e8); *(int8 *)(this + 0x10) = 0; *(int (*) [16])this = (int [16])0x0; p_Var9 = local_100; do { if (p_Var9 == p_Var1) { std:: _Rb_tree<std::string,std::pair<std::string_const,int>,std::_Select1st<std::pair<std::string_const,int>>,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::_M_erase(local_108); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return this; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); } iVar7 = 0; if (0 < *(int *)(p_Var9 + 0x40)) { do { while (plVar6 = *(long **)(this + 8), plVar6 == *(long **)(this + 0x10)) { std::vector<std::string,std::allocator<std::string>>:: _M_realloc_insert<std::string_const&> (this,(__normal_iterator)plVar6,(string *)(p_Var9 + 0x20)); iVar7 = iVar7 + 1; if (*(int *)(p_Var9 + 0x40) <= iVar7) goto LAB_001028e8; } uVar3 = *(int8 *)(p_Var9 + 0x28); *plVar6 = (long)(plVar6 + 2); /* try { // try from 001028b2 to 001028dd has its CatchHandler @ 00102939 */ std::string::_M_construct<char*> ((char *)plVar6,*(char **)(p_Var9 + 0x20), (int)uVar3 + (int)*(char **)(p_Var9 + 0x20)); *(long *)(this + 8) = *(long *)(this + 8) + 0x20; iVar7 = iVar7 + 1; } while (iVar7 < *(int *)(p_Var9 + 0x40)); } LAB_001028e8: p_Var9 = (_Rb_tree_node_base *)std::_Rb_tree_increment(p_Var9); } while( true ); } } while( true ); }
3,239
func0
#include <vector> #include <string> #include <map> #include <assert.h>
std::vector<std::string> func0(int a, int b, int c, int d) { std::map<std::string, int> counts = {{"p", a}, {"q", b}, {"r", c}, {"s", d}}; std::vector<std::string> result; for (auto const& elem : counts) { for (int i = 0; i < elem.second; ++i) { result.push_back(elem.first); } } return result; }
int main() { assert((func0(4,2,0,-2) == std::vector<std::string>{"p", "p", "p", "p", "q", "q"})); assert((func0(0,1,2,3) == std::vector<std::string>{"q", "r", "r", "s", "s", "s"})); assert((func0(11,15,12,23) == std::vector<std::string>{"p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "q", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "r", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s"})); return 0; }
O3
cpp
func0[abi:cxx11](int, int, int, int): endbr64 push %r15 mov $0x71,%r9d mov %rdi,%r15 mov $0x72,%r10d push %r14 mov $0x70,%edi mov $0x73,%r11d push %r13 push %r12 push %rbp push %rbx sub $0x128,%rsp mov %fs:0x28,%rax mov %rax,0x118(%rsp) xor %eax,%eax lea 0x80(%rsp),%rax lea 0x70(%rsp),%rbx movq $0x1,0x78(%rsp) mov %rax,0x70(%rsp) lea 0xa8(%rsp),%rax mov %rax,0x98(%rsp) lea 0xd0(%rsp),%rax mov %rax,0xc0(%rsp) lea 0xf8(%rsp),%rax mov %rax,0xe8(%rsp) lea 0x48(%rsp),%rax mov %rax,0x8(%rsp) mov %rax,0x58(%rsp) mov %rax,0x60(%rsp) lea 0x40(%rsp),%rax mov %rbx,0x20(%rsp) mov %di,0x80(%rsp) mov %esi,0x90(%rsp) movq $0x1,0xa0(%rsp) mov %r9w,0xa8(%rsp) mov %edx,0xb8(%rsp) movq $0x1,0xc8(%rsp) mov %r10w,0xd0(%rsp) mov %ecx,0xe0(%rsp) movq $0x1,0xf0(%rsp) mov %r11w,0xf8(%rsp) mov %r8d,0x108(%rsp) movl $0x0,0x48(%rsp) movq $0x0,0x50(%rsp) movq $0x0,0x68(%rsp) mov %rax,0x18(%rsp) lea 0x110(%rsp),%rax mov %rax,0x10(%rsp) lea 0x38(%rsp),%rax mov %rax,0x28(%rsp) jmp 1cb9 <_Z5func0B5cxx11iiii+0x199> nopw 0x0(%rax,%rax,1) cmp $0x1,%r13 jne 1f40 <_Z5func0B5cxx11iiii+0x420> movzbl (%r14),%eax mov %al,0x30(%rbp) mov %r13,0x28(%rbp) mov 0x8(%rsp),%rcx mov %r12,%rdx mov %rbp,%rsi movb $0x0,(%rdi,%r13,1) mov 0x20(%rbx),%eax movzbl (%rsp),%edi mov %eax,0x40(%rbp) callq 1140 <_ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_@plt> addq $0x1,0x68(%rsp) add $0x28,%rbx cmp 0x10(%rsp),%rbx je 1d6f <_Z5func0B5cxx11iiii+0x24f> mov 0x8(%rsp),%r14 mov 0x18(%rsp),%rdi mov %rbx,%rdx mov %r14,%rsi callq 2800 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS8_ERS7_> mov %rdx,%r12 test %rdx,%rdx je 1caa <_Z5func0B5cxx11iiii+0x18a> test %rax,%rax setne %dil cmp %r14,%rdx sete %al or %al,%dil mov %dil,(%rsp) je 1f50 <_Z5func0B5cxx11iiii+0x430> mov $0x48,%edi callq 11d0 <_Znwm@plt> mov (%rbx),%r14 lea 0x30(%rax),%rdi mov 0x8(%rbx),%r13 mov %rax,%rbp mov %rdi,0x20(%rax) mov %r14,%rax add %r13,%rax je 1d1d <_Z5func0B5cxx11iiii+0x1fd> test %r14,%r14 je 1fbf <_Z5func0B5cxx11iiii+0x49f> mov %r13,0x38(%rsp) cmp $0xf,%r13 jbe 1c70 <_Z5func0B5cxx11iiii+0x150> mov 0x28(%rsp),%rsi lea 0x20(%rbp),%rdi xor %edx,%edx callq 1230 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@plt> mov %rax,0x20(%rbp) mov %rax,%rdi mov 0x38(%rsp),%rax mov %rax,0x30(%rbp) mov %r13,%rdx mov %r14,%rsi callq 11b0 <memcpy@plt> mov 0x38(%rsp),%r13 mov 0x20(%rbp),%rdi jmpq 1c81 <_Z5func0B5cxx11iiii+0x161> nopl (%rax) cmp 0x20(%rsp),%rbx je 1d8b <_Z5func0B5cxx11iiii+0x26b> sub $0x28,%rbx mov (%rbx),%rdi lea 0x10(%rbx),%rax cmp %rax,%rdi je 1d68 <_Z5func0B5cxx11iiii+0x248> callq 11c0 <_ZdlPv@plt> cmp 0x20(%rsp),%rbx jne 1d6f <_Z5func0B5cxx11iiii+0x24f> pxor %xmm0,%xmm0 lea 0x38(%rsp),%rax mov 0x58(%rsp),%r13 movq $0x0,0x10(%r15) mov %rax,0x10(%rsp) movups %xmm0,(%r15) cmp 0x8(%rsp),%r13 je 1e60 <_Z5func0B5cxx11iiii+0x340> nopl (%rax) lea 0x20(%r13),%rax xor %ebx,%ebx mov %rax,(%rsp) mov 0x40(%r13),%eax test %eax,%eax jg 1e28 <_Z5func0B5cxx11iiii+0x308> jmp 1e4a <_Z5func0B5cxx11iiii+0x32a> nopl 0x0(%rax) lea 0x10(%rbp),%rdi mov 0x28(%r13),%r12 mov %rdi,0x0(%rbp) mov 0x20(%r13),%r14 mov %r14,%rax add %r12,%rax je 1df1 <_Z5func0B5cxx11iiii+0x2d1> test %r14,%r14 je 1fae <_Z5func0B5cxx11iiii+0x48e> mov %r12,0x38(%rsp) cmp $0xf,%r12 ja 1ec0 <_Z5func0B5cxx11iiii+0x3a0> cmp $0x1,%r12 jne 1eb0 <_Z5func0B5cxx11iiii+0x390> movzbl (%r14),%eax mov %al,0x10(%rbp) mov %r12,0x8(%rbp) add $0x1,%ebx movb $0x0,(%rdi,%r12,1) addq $0x20,0x8(%r15) cmp %ebx,0x40(%r13) jle 1e4a <_Z5func0B5cxx11iiii+0x32a> mov 0x8(%r15),%rbp cmp 0x10(%r15),%rbp jne 1dd0 <_Z5func0B5cxx11iiii+0x2b0> mov (%rsp),%rdx mov %rbp,%rsi mov %r15,%rdi callq 2340 <_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_realloc_insertIJRKS5_EEEvN9__gnu_cxx17__normal_iteratorIPS5_S7_EEDpOT_> add $0x1,%ebx cmp %ebx,0x40(%r13) jg 1e28 <_Z5func0B5cxx11iiii+0x308> mov %r13,%rdi callq 1190 <_ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base@plt> mov %rax,%r13 cmp 0x8(%rsp),%rax jne 1db8 <_Z5func0B5cxx11iiii+0x298> mov 0x50(%rsp),%rbp mov 0x18(%rsp),%r12 test %rbp,%rbp je 1f0d <_Z5func0B5cxx11iiii+0x3ed> mov 0x18(%rbp),%rsi mov %r12,%rdi callq 22d0 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E> mov 0x20(%rbp),%rdi lea 0x30(%rbp),%rax mov 0x10(%rbp),%rbx cmp %rax,%rdi je 1f00 <_Z5func0B5cxx11iiii+0x3e0> callq 11c0 <_ZdlPv@plt> mov %rbp,%rdi callq 11c0 <_ZdlPv@plt> test %rbx,%rbx je 1f0d <_Z5func0B5cxx11iiii+0x3ed> mov %rbx,%rbp jmp 1e73 <_Z5func0B5cxx11iiii+0x353> nopw 0x0(%rax,%rax,1) test %r12,%r12 je 1e11 <_Z5func0B5cxx11iiii+0x2f1> jmp 1edf <_Z5func0B5cxx11iiii+0x3bf> nopl 0x0(%rax,%rax,1) mov 0x10(%rsp),%rsi xor %edx,%edx mov %rbp,%rdi callq 1230 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@plt> mov %rax,0x0(%rbp) mov %rax,%rdi mov 0x38(%rsp),%rax mov %rax,0x10(%rbp) mov %r12,%rdx mov %r14,%rsi callq 11b0 <memcpy@plt> mov 0x38(%rsp),%r12 mov 0x0(%rbp),%rdi jmpq 1e11 <_Z5func0B5cxx11iiii+0x2f1> nopl 0x0(%rax,%rax,1) mov %rbp,%rdi callq 11c0 <_ZdlPv@plt> test %rbx,%rbx jne 1ea2 <_Z5func0B5cxx11iiii+0x382> mov 0x118(%rsp),%rax xor %fs:0x28,%rax jne 1fba <_Z5func0B5cxx11iiii+0x49a> add $0x128,%rsp mov %r15,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) test %r13,%r13 je 1c81 <_Z5func0B5cxx11iiii+0x161> jmpq 1d4c <_Z5func0B5cxx11iiii+0x22c> xchg %ax,%ax mov 0x8(%rbx),%rbp mov 0x28(%rdx),%r13 cmp %r13,%rbp mov %r13,%rdx cmovbe %rbp,%rdx test %rdx,%rdx je 1f78 <_Z5func0B5cxx11iiii+0x458> mov 0x20(%r12),%rsi mov (%rbx),%rdi callq 1160 <memcmp@plt> test %eax,%eax jne 1f9a <_Z5func0B5cxx11iiii+0x47a> sub %r13,%rbp mov $0x80000000,%eax cmp %rax,%rbp jge 1cf0 <_Z5func0B5cxx11iiii+0x1d0> movabs $0xffffffff7fffffff,%rax cmp %rax,%rbp jle 1fa5 <_Z5func0B5cxx11iiii+0x485> mov %ebp,%eax shr $0x1f,%eax mov %eax,(%rsp) jmpq 1cf0 <_Z5func0B5cxx11iiii+0x1d0> movb $0x1,(%rsp) jmpq 1cf0 <_Z5func0B5cxx11iiii+0x1d0> lea 0x108b(%rip),%rdi callq 11a0 <_ZSt19__throw_logic_errorPKc@plt> callq 11f0 <__stack_chk_fail@plt> lea 0x107a(%rip),%rdi callq 11a0 <_ZSt19__throw_logic_errorPKc@plt> endbr64 mov %rax,%rbp jmpq 124d <_Z5func0B5cxx11iiii.cold+0xd> endbr64 mov %rax,%rdi jmpq 1285 <_Z5func0B5cxx11iiii.cold+0x45> endbr64 mov %rax,%rbp jmpq 1297 <_Z5func0B5cxx11iiii.cold+0x57>
_Z5func0B5cxx11iiii: endbr64 push r15 mov r9d, 71h ; 'q' mov r10d, 72h ; 'r' mov r11d, 73h ; 's' push r14 push r13 push r12 mov r12, rdi mov edi, 70h ; 'p' push rbp push rbx sub rsp, 128h mov rax, fs:28h mov [rsp+158h+var_40], rax xor eax, eax lea rax, [rsp+158h+var_D8] lea rbx, [rsp+158h+var_E8] mov [rsp+158h+var_E0], 1 mov [rsp+158h+var_E8], rax lea rax, [rsp+158h+var_B0] lea r15, [rsp+158h+var_48] mov [rsp+158h+var_C0], rax lea rax, [rsp+158h+var_88] mov [rsp+158h+var_98], rax lea rax, [rsp+158h+var_60] mov [rsp+158h+var_70], rax lea rax, [rsp+158h+var_110] mov [rsp+158h+var_130], rbx mov [rsp+158h+var_D8], di mov [rsp+158h+var_C8], esi mov [rsp+158h+var_B8], 1 mov [rsp+158h+var_B0], r9w mov [rsp+158h+var_A0], edx mov [rsp+158h+var_90], 1 mov [rsp+158h+var_88], r10w mov [rsp+158h+var_78], ecx mov [rsp+158h+var_68], 1 mov [rsp+158h+var_60], r11w mov [rsp+158h+var_50], r8d mov [rsp+158h+var_148], rax mov [rsp+158h+var_100], rax mov [rsp+158h+var_F8], rax lea rax, [rsp+158h+var_118] mov [rsp+158h+var_110], 0 mov [rsp+158h+var_108], 0 mov [rsp+158h+var_F0], 0 mov [rsp+158h+var_150], rax jmp short loc_212A loc_20E0: cmp r14, 1 jz loc_2380 test r14, r14 jnz loc_21B2 loc_20F3: mov [rbp+28h], r14 mov rcx, [rsp+158h+var_148] mov rdx, r13 mov rsi, rbp mov byte ptr [rdi+r14], 0 mov eax, [rbx+20h] movzx edi, byte ptr [rsp+158h+var_140] mov [rbp+40h], eax call __ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_; std::_Rb_tree_insert_and_rebalance(bool,std::_Rb_tree_node_base *,std::_Rb_tree_node_base *,std::_Rb_tree_node_base&) add [rsp+158h+var_F0], 1 loc_211D: add rbx, 28h ; '(' cmp rbx, r15 jz loc_21E0 loc_212A: mov r14, [rsp+158h+var_148] mov rdi, [rsp+158h+var_150] mov rdx, rbx mov rsi, r14 call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS8_ERS7_; std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<std::string const,int>>,std::string const&) mov r13, rdx test rdx, rdx jz short loc_211D test rax, rax setnz dl cmp r13, r14 setz al or dl, al mov byte ptr [rsp+158h+var_140], dl jz loc_23C0 loc_215F: mov edi, 48h ; 'H'; unsigned __int64 call __Znwm; operator new(ulong) mov rbp, rax mov rcx, [rbx] mov r14, [rbx+8] lea rax, [rax+20h] lea rdi, [rbp+30h] mov [rbp+20h], rdi mov [rsp+158h+src], rcx mov [rsp+158h+var_120], r14 cmp r14, 0Fh jbe loc_20E0 lea rsi, [rsp+158h+var_120] xor edx, edx mov rdi, rax call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm; std::string::_M_create(ulong &,ulong) mov [rbp+20h], rax mov rdi, rax; dest mov rax, [rsp+158h+var_120] mov [rbp+30h], rax loc_21B2: mov rsi, [rsp+158h+src]; src mov rdx, r14; n call _memcpy mov r14, [rsp+158h+var_120] mov rdi, [rbp+20h] jmp loc_20F3 loc_21CD: mov rax, [rsp+158h+var_130] cmp rbx, rax jz short loc_2207 nop word ptr [rax+rax+00000000h] loc_21E0: sub rbx, 28h ; '(' mov rdi, [rbx]; void * lea rax, [rbx+10h] cmp rdi, rax jz short loc_21CD mov rax, [rbx+10h] lea rsi, [rax+1]; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) mov rax, [rsp+158h+var_130] cmp rbx, rax jnz short loc_21E0 loc_2207: lea rax, [rsp+158h+var_120] mov r13, [rsp+158h+var_100] pxor xmm0, xmm0 mov qword ptr [r12+10h], 0 mov [rsp+158h+var_140], rax mov rax, [rsp+158h+var_148] movups xmmword ptr [r12], xmm0 cmp r13, rax jz loc_22E8 nop word ptr [rax+rax+00000000h] loc_2240: lea rax, [r13+20h] xor r14d, r14d mov [rsp+158h+var_150], rax mov eax, [r13+40h] test eax, eax jg short loc_22A9 jmp short loc_22CF loc_2260: mov rbp, [r13+28h] lea rdi, [rbx+10h] mov [rbx], rdi mov r15, [r13+20h] mov [rsp+158h+var_120], rbp cmp rbp, 0Fh ja loc_2348 cmp rbp, 1 jz loc_2338 test rbp, rbp jnz loc_2366 loc_2291: mov [rbx+8], rbp add r14d, 1 mov byte ptr [rdi+rbp], 0 add qword ptr [r12+8], 20h ; ' ' cmp [r13+40h], r14d jle short loc_22CF loc_22A9: mov rbx, [r12+8] cmp rbx, [r12+10h] jnz short loc_2260 mov rdx, [rsp+158h+var_150] mov rsi, rbx mov rdi, r12 call _ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_realloc_insertIJRKS5_EEEvN9__gnu_cxx17__normal_iteratorIPS5_S7_EEDpOT_; std::vector<std::string>::_M_realloc_insert<std::string const&>(__gnu_cxx::__normal_iterator<std::string*,std::vector<std::string>>,std::string const&) add r14d, 1 cmp [r13+40h], r14d jg short loc_22A9 loc_22CF: mov rdi, r13 call __ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base; std::_Rb_tree_increment(std::_Rb_tree_node_base *) mov r13, rax mov rax, [rsp+158h+var_148] cmp r13, rax jnz loc_2240 loc_22E8: mov rbx, [rsp+158h+var_108] test rbx, rbx jz loc_2390 loc_22F6: mov rdi, [rbx+18h] call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E_isra_0; std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,int>> *) [clone] mov rdi, [rbx+20h]; void * lea rax, [rbx+30h] mov rbp, [rbx+10h] cmp rdi, rax jz short loc_231D mov rax, [rbx+30h] lea rsi, [rax+1]; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_231D: mov esi, 48h ; 'H'; unsigned __int64 mov rdi, rbx; void * call __ZdlPvm; operator delete(void *,ulong) test rbp, rbp jz short loc_2390 mov rbx, rbp jmp short loc_22F6 loc_2338: movzx eax, byte ptr [r15] mov [rbx+10h], al jmp loc_2291 loc_2348: mov rsi, [rsp+158h+var_140] xor edx, edx mov rdi, rbx call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm; std::string::_M_create(ulong &,ulong) mov [rbx], rax mov rdi, rax; dest mov rax, [rsp+158h+var_120] mov [rbx+10h], rax loc_2366: mov rdx, rbp; n mov rsi, r15; src call _memcpy mov rbp, [rsp+158h+var_120] mov rdi, [rbx] jmp loc_2291 loc_2380: movzx eax, byte ptr [rcx] mov [rbp+30h], al jmp loc_20F3 loc_2390: mov rax, [rsp+158h+var_40] sub rax, fs:28h jnz short loc_2418 add rsp, 128h mov rax, r12 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_23C0: mov rbp, [rbx+8] mov r14, [r13+28h] cmp rbp, r14 mov rdx, r14 cmovbe rdx, rbp; n test rdx, rdx jz short loc_23E7 mov rsi, [r13+20h]; s2 mov rdi, [rbx]; s1 call _memcmp test eax, eax jnz short loc_2402 loc_23E7: sub rbp, r14 cmp rbp, 7FFFFFFFh jg loc_215F cmp rbp, 0FFFFFFFF80000000h jl short loc_240E mov eax, ebp loc_2402: shr eax, 1Fh mov dword ptr [rsp+158h+var_140], eax jmp loc_215F loc_240E: mov byte ptr [rsp+158h+var_140], 1 jmp loc_215F loc_2418: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0B5cxx11iiii_cold; func0(int,int,int,int) [clone] endbr64 mov rdi, rax jmp loc_1271 endbr64 mov rbx, rax jmp loc_12A7
long long func0[abi:cxx11](long long a1, int a2, int a3, int a4, int a5) { char *v6; // rbx long long insert_hint_unique_pos; // rax int *v8; // rdx const void **v9; // r13 long long v10; // rbp _BYTE *v11; // rcx size_t v12; // r14 _BYTE *v13; // rdi long long v14; // rax long long v15; // r13 int v16; // r14d size_t v17; // rbp void *v18; // rdi _BYTE *v19; // r15 long long *v20; // rbx _QWORD *v21; // rbx _QWORD *v22; // rdi _QWORD *v23; // rbp long long v24; // rax size_t v26; // rbp size_t v27; // r14 size_t v28; // rdx unsigned int v29; // eax long long v30; // rbp unsigned int v31; // [rsp+18h] [rbp-140h] void *src; // [rsp+20h] [rbp-138h] size_t v33; // [rsp+38h] [rbp-120h] BYREF char v34[8]; // [rsp+40h] [rbp-118h] BYREF int v35; // [rsp+48h] [rbp-110h] BYREF void *v36; // [rsp+50h] [rbp-108h] int *v37; // [rsp+58h] [rbp-100h] int *v38; // [rsp+60h] [rbp-F8h] long long v39; // [rsp+68h] [rbp-F0h] _QWORD v40[2]; // [rsp+70h] [rbp-E8h] BYREF __int16 v41; // [rsp+80h] [rbp-D8h] BYREF int v42; // [rsp+90h] [rbp-C8h] __int16 *v43; // [rsp+98h] [rbp-C0h] long long v44; // [rsp+A0h] [rbp-B8h] __int16 v45; // [rsp+A8h] [rbp-B0h] BYREF int v46; // [rsp+B8h] [rbp-A0h] __int16 *v47; // [rsp+C0h] [rbp-98h] long long v48; // [rsp+C8h] [rbp-90h] __int16 v49; // [rsp+D0h] [rbp-88h] BYREF int v50; // [rsp+E0h] [rbp-78h] __int16 *v51; // [rsp+E8h] [rbp-70h] long long v52; // [rsp+F0h] [rbp-68h] __int16 v53; // [rsp+F8h] [rbp-60h] BYREF int v54; // [rsp+108h] [rbp-50h] char v55; // [rsp+110h] [rbp-48h] BYREF unsigned long long v56; // [rsp+118h] [rbp-40h] v56 = __readfsqword(0x28u); v6 = (char *)v40; v40[1] = 1LL; v40[0] = &v41; v43 = &v45; v47 = &v49; v51 = &v53; v41 = 112; v42 = a2; v44 = 1LL; v45 = 113; v46 = a3; v48 = 1LL; v49 = 114; v50 = a4; v52 = 1LL; v53 = 115; v54 = a5; v37 = &v35; v38 = &v35; v35 = 0; v36 = 0LL; v39 = 0LL; do { insert_hint_unique_pos = std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_get_insert_hint_unique_pos( v34, &v35, v6); v9 = (const void **)v8; if ( v8 ) { LOBYTE(v31) = v8 == &v35 || insert_hint_unique_pos != 0; if ( (_BYTE)v31 ) goto LABEL_8; v26 = *((_QWORD *)v6 + 1); v28 = *((_QWORD *)v8 + 5); v27 = v28; if ( v26 <= v28 ) v28 = *((_QWORD *)v6 + 1); if ( !v28 || (v29 = memcmp(*(const void **)v6, v9[4], v28)) == 0 ) { v30 = v26 - v27; if ( v30 > 0x7FFFFFFF ) goto LABEL_8; if ( v30 < (long long)0xFFFFFFFF80000000LL ) { LOBYTE(v31) = 1; LABEL_8: v10 = operator new(0x48uLL); v11 = *(_BYTE **)v6; v12 = *((_QWORD *)v6 + 1); v13 = (_BYTE *)(v10 + 48); *(_QWORD *)(v10 + 32) = v10 + 48; src = v11; v33 = v12; if ( v12 <= 0xF ) { if ( v12 == 1 ) { *(_BYTE *)(v10 + 48) = *v11; goto LABEL_4; } if ( !v12 ) { LABEL_4: *(_QWORD *)(v10 + 40) = v12; v13[v12] = 0; *(_DWORD *)(v10 + 64) = *((_DWORD *)v6 + 8); std::_Rb_tree_insert_and_rebalance((unsigned __int8)v31, v10, v9, &v35); ++v39; goto LABEL_5; } } else { v14 = std::string::_M_create(v10 + 32, &v33, 0LL); *(_QWORD *)(v10 + 32) = v14; v13 = (_BYTE *)v14; *(_QWORD *)(v10 + 48) = v33; } memcpy(v13, src, v12); v12 = v33; v13 = *(_BYTE **)(v10 + 32); goto LABEL_4; } v29 = v30; } v31 = v29 >> 31; goto LABEL_8; } LABEL_5: v6 += 40; } while ( v6 != &v55 ); do { while ( 1 ) { v6 -= 40; if ( *(char **)v6 != v6 + 16 ) break; if ( v6 == (char *)v40 ) goto LABEL_14; } operator delete(*(void **)v6, *((_QWORD *)v6 + 2) + 1LL); } while ( v6 != (char *)v40 ); LABEL_14: v15 = (long long)v37; *(_QWORD *)(a1 + 16) = 0LL; *(_OWORD *)a1 = 0LL; if ( (int *)v15 != &v35 ) { while ( 1 ) { v16 = 0; if ( *(int *)(v15 + 64) > 0 ) break; LABEL_23: v15 = std::_Rb_tree_increment(v15); if ( (int *)v15 == &v35 ) goto LABEL_24; } while ( 2 ) { while ( 1 ) { v20 = *(long long **)(a1 + 8); if ( v20 != *(long long **)(a1 + 16) ) break; std::vector<std::string>::_M_realloc_insert<std::string const&>(a1, *(_QWORD *)(a1 + 8), v15 + 32); if ( *(_DWORD *)(v15 + 64) <= ++v16 ) goto LABEL_23; } v17 = *(_QWORD *)(v15 + 40); v18 = v20 + 2; *v20 = (long long)(v20 + 2); v19 = *(_BYTE **)(v15 + 32); v33 = v17; if ( v17 <= 0xF ) { if ( v17 == 1 ) { *((_BYTE *)v20 + 16) = *v19; } else { if ( !v17 ) goto LABEL_20; LABEL_31: memcpy(v18, v19, v17); v17 = v33; v18 = (void *)*v20; } LABEL_20: v20[1] = v17; ++v16; *((_BYTE *)v18 + v17) = 0; *(_QWORD *)(a1 + 8) += 32LL; if ( *(_DWORD *)(v15 + 64) <= v16 ) goto LABEL_23; continue; } break; } v24 = std::string::_M_create(v20, &v33, 0LL); *v20 = v24; v18 = (void *)v24; v20[2] = v33; goto LABEL_31; } LABEL_24: v21 = v36; if ( v36 ) { while ( 1 ) { std::_Rb_tree<std::string,std::pair<std::string const,int>,std::_Select1st<std::pair<std::string const,int>>,std::less<std::string>,std::allocator<std::pair<std::string const,int>>>::_M_erase(v21[3]); v22 = (_QWORD *)v21[4]; v23 = (_QWORD *)v21[2]; if ( v22 != v21 + 6 ) operator delete(v22, v21[6] + 1LL); operator delete(v21, 0x48uLL); if ( !v23 ) break; v21 = v23; } } return a1; }
func0[abi:cxx11]: ENDBR64 PUSH R15 MOV R9D,0x71 MOV R10D,0x72 MOV R11D,0x73 PUSH R14 PUSH R13 PUSH R12 MOV R12,RDI MOV EDI,0x70 PUSH RBP PUSH RBX SUB RSP,0x128 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x118],RAX XOR EAX,EAX LEA RAX,[RSP + 0x80] LEA RBX,[RSP + 0x70] MOV qword ptr [RSP + 0x78],0x1 MOV qword ptr [RSP + 0x70],RAX LEA RAX,[RSP + 0xa8] LEA R15,[RSP + 0x110] MOV qword ptr [RSP + 0x98],RAX LEA RAX,[RSP + 0xd0] MOV qword ptr [RSP + 0xc0],RAX LEA RAX,[RSP + 0xf8] MOV qword ptr [RSP + 0xe8],RAX LEA RAX,[RSP + 0x48] MOV qword ptr [RSP + 0x28],RBX MOV word ptr [RSP + 0x80],DI MOV dword ptr [RSP + 0x90],ESI MOV qword ptr [RSP + 0xa0],0x1 MOV word ptr [RSP + 0xa8],R9W MOV dword ptr [RSP + 0xb8],EDX MOV qword ptr [RSP + 0xc8],0x1 MOV word ptr [RSP + 0xd0],R10W MOV dword ptr [RSP + 0xe0],ECX MOV qword ptr [RSP + 0xf0],0x1 MOV word ptr [RSP + 0xf8],R11W MOV dword ptr [RSP + 0x108],R8D MOV qword ptr [RSP + 0x10],RAX MOV qword ptr [RSP + 0x58],RAX MOV qword ptr [RSP + 0x60],RAX LEA RAX,[RSP + 0x40] MOV dword ptr [RSP + 0x48],0x0 MOV qword ptr [RSP + 0x50],0x0 MOV qword ptr [RSP + 0x68],0x0 MOV qword ptr [RSP + 0x8],RAX JMP 0x0010212a LAB_001020e0: CMP R14,0x1 JZ 0x00102380 TEST R14,R14 JNZ 0x001021b2 LAB_001020f3: MOV qword ptr [RBP + 0x28],R14 MOV RCX,qword ptr [RSP + 0x10] MOV RDX,R13 MOV RSI,RBP MOV byte ptr [RDI + R14*0x1],0x0 MOV EAX,dword ptr [RBX + 0x20] MOVZX EDI,byte ptr [RSP + 0x18] MOV dword ptr [RBP + 0x40],EAX CALL 0x00101140 ADD qword ptr [RSP + 0x68],0x1 LAB_0010211d: ADD RBX,0x28 CMP RBX,R15 JZ 0x001021e0 LAB_0010212a: MOV R14,qword ptr [RSP + 0x10] MOV RDI,qword ptr [RSP + 0x8] MOV RDX,RBX MOV RSI,R14 CALL 0x00102cd0 MOV R13,RDX TEST RDX,RDX JZ 0x0010211d TEST RAX,RAX SETNZ DL CMP R13,R14 SETZ AL OR DL,AL MOV byte ptr [RSP + 0x18],DL JZ 0x001023c0 LAB_0010215f: MOV EDI,0x48 LAB_00102164: CALL 0x001011b0 MOV RBP,RAX MOV RCX,qword ptr [RBX] MOV R14,qword ptr [RBX + 0x8] LEA RAX,[RAX + 0x20] LEA RDI,[RBP + 0x30] MOV qword ptr [RBP + 0x20],RDI MOV qword ptr [RSP + 0x20],RCX MOV qword ptr [RSP + 0x38],R14 CMP R14,0xf JBE 0x001020e0 LEA RSI,[RSP + 0x38] XOR EDX,EDX MOV RDI,RAX LAB_0010219d: CALL 0x00101230 MOV qword ptr [RBP + 0x20],RAX MOV RDI,RAX MOV RAX,qword ptr [RSP + 0x38] MOV qword ptr [RBP + 0x30],RAX LAB_001021b2: MOV RSI,qword ptr [RSP + 0x20] MOV RDX,R14 CALL 0x001011a0 MOV R14,qword ptr [RSP + 0x38] MOV RDI,qword ptr [RBP + 0x20] JMP 0x001020f3 LAB_001021cd: MOV RAX,qword ptr [RSP + 0x28] CMP RBX,RAX JZ 0x00102207 NOP word ptr [RAX + RAX*0x1] LAB_001021e0: SUB RBX,0x28 MOV RDI,qword ptr [RBX] LEA RAX,[RBX + 0x10] CMP RDI,RAX JZ 0x001021cd MOV RAX,qword ptr [RBX + 0x10] LEA RSI,[RAX + 0x1] CALL 0x001011c0 MOV RAX,qword ptr [RSP + 0x28] CMP RBX,RAX JNZ 0x001021e0 LAB_00102207: LEA RAX,[RSP + 0x38] MOV R13,qword ptr [RSP + 0x58] PXOR XMM0,XMM0 MOV qword ptr [R12 + 0x10],0x0 MOV qword ptr [RSP + 0x18],RAX MOV RAX,qword ptr [RSP + 0x10] MOVUPS xmmword ptr [R12],XMM0 CMP R13,RAX JZ 0x001022e8 NOP word ptr CS:[RAX + RAX*0x1] LAB_00102240: LEA RAX,[R13 + 0x20] XOR R14D,R14D MOV qword ptr [RSP + 0x8],RAX MOV EAX,dword ptr [R13 + 0x40] TEST EAX,EAX JG 0x001022a9 JMP 0x001022cf LAB_00102260: MOV RBP,qword ptr [R13 + 0x28] LEA RDI,[RBX + 0x10] MOV qword ptr [RBX],RDI MOV R15,qword ptr [R13 + 0x20] MOV qword ptr [RSP + 0x38],RBP CMP RBP,0xf JA 0x00102348 CMP RBP,0x1 JZ 0x00102338 TEST RBP,RBP JNZ 0x00102366 LAB_00102291: MOV qword ptr [RBX + 0x8],RBP ADD R14D,0x1 MOV byte ptr [RDI + RBP*0x1],0x0 ADD qword ptr [R12 + 0x8],0x20 CMP dword ptr [R13 + 0x40],R14D JLE 0x001022cf LAB_001022a9: MOV RBX,qword ptr [R12 + 0x8] CMP RBX,qword ptr [R12 + 0x10] JNZ 0x00102260 MOV RDX,qword ptr [RSP + 0x8] MOV RSI,RBX MOV RDI,R12 LAB_001022c0: CALL 0x001026d0 ADD R14D,0x1 CMP dword ptr [R13 + 0x40],R14D JG 0x001022a9 LAB_001022cf: MOV RDI,R13 CALL 0x00101190 MOV R13,RAX MOV RAX,qword ptr [RSP + 0x10] CMP R13,RAX JNZ 0x00102240 LAB_001022e8: MOV RBX,qword ptr [RSP + 0x50] TEST RBX,RBX JZ 0x00102390 LAB_001022f6: MOV RDI,qword ptr [RBX + 0x18] CALL 0x00101c40 MOV RDI,qword ptr [RBX + 0x20] LEA RAX,[RBX + 0x30] MOV RBP,qword ptr [RBX + 0x10] CMP RDI,RAX JZ 0x0010231d MOV RAX,qword ptr [RBX + 0x30] LEA RSI,[RAX + 0x1] CALL 0x001011c0 LAB_0010231d: MOV ESI,0x48 MOV RDI,RBX CALL 0x001011c0 TEST RBP,RBP JZ 0x00102390 MOV RBX,RBP JMP 0x001022f6 LAB_00102338: MOVZX EAX,byte ptr [R15] MOV byte ptr [RBX + 0x10],AL JMP 0x00102291 LAB_00102348: MOV RSI,qword ptr [RSP + 0x18] XOR EDX,EDX MOV RDI,RBX CALL 0x00101230 MOV qword ptr [RBX],RAX MOV RDI,RAX MOV RAX,qword ptr [RSP + 0x38] MOV qword ptr [RBX + 0x10],RAX LAB_00102366: MOV RDX,RBP MOV RSI,R15 CALL 0x001011a0 MOV RBP,qword ptr [RSP + 0x38] MOV RDI,qword ptr [RBX] JMP 0x00102291 LAB_00102380: MOVZX EAX,byte ptr [RCX] MOV byte ptr [RBP + 0x30],AL JMP 0x001020f3 LAB_00102390: MOV RAX,qword ptr [RSP + 0x118] SUB RAX,qword ptr FS:[0x28] JNZ 0x00102418 ADD RSP,0x128 MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001023c0: MOV RBP,qword ptr [RBX + 0x8] MOV R14,qword ptr [R13 + 0x28] CMP RBP,R14 MOV RDX,R14 CMOVBE RDX,RBP TEST RDX,RDX JZ 0x001023e7 MOV RSI,qword ptr [R13 + 0x20] MOV RDI,qword ptr [RBX] CALL 0x00101160 TEST EAX,EAX JNZ 0x00102402 LAB_001023e7: SUB RBP,R14 CMP RBP,0x7fffffff JG 0x0010215f CMP RBP,-0x80000000 JL 0x0010240e MOV EAX,EBP LAB_00102402: SHR EAX,0x1f MOV dword ptr [RSP + 0x18],EAX JMP 0x0010215f LAB_0010240e: MOV byte ptr [RSP + 0x18],0x1 JMP 0x0010215f LAB_00102418: CALL 0x001011e0
/* func0[abi:cxx11](int, int, int, int) */ vector<std::string,std::allocator<std::string>> * func0_abi_cxx11_(int param_1,int param_2,int param_3,int param_4) { _Rb_tree_node_base *p_Var1; _Rb_tree_node_base *__src; ulong uVar2; int *__src_00; ulong *puVar3; void *pvVar4; ulong uVar5; void *pvVar6; _Rb_tree_node_base *p_Var7; _Rb_tree_node_base *__dest; _Rb_tree_node_base *p_Var8; ulong *__dest_00; ulong __n; string *psVar9; string *psVar10; long lVar11; int4 in_register_0000003c; vector<std::string,std::allocator<std::string>> *this; int iVar12; long in_FS_OFFSET; bool bVar13; int auVar14 [16]; bool local_140; ulong local_120; _Rb_tree<std::string,std::pair<std::string_const,int>,std::_Select1st<std::pair<std::string_const,int>>,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> local_118 [8]; int4 local_110 [2]; void *local_108; _Rb_tree_node_base *local_100; _Rb_tree_node_base *local_f8; long local_f0; int2 *local_e8; int8 local_e0; int2 local_d8 [8]; int local_c8; int2 *local_c0; int8 local_b8; int2 local_b0 [8]; int local_a0; int2 *local_98; int8 local_90; int2 local_88 [8]; int local_78; int2 *local_70; int8 local_68; int2 local_60 [12]; string local_48 [8]; long local_40; this = (vector<std::string,std::allocator<std::string>> *)CONCAT44(in_register_0000003c,param_1); local_40 = *(long *)(in_FS_OFFSET + 0x28); local_e8 = local_d8; local_e0 = 1; local_c0 = local_b0; local_98 = local_88; local_70 = local_60; p_Var1 = (_Rb_tree_node_base *)local_110; local_d8[0] = 0x70; local_b8 = 1; local_b0[0] = 0x71; local_90 = 1; local_88[0] = 0x72; local_68 = 1; local_60[0] = 0x73; local_110[0] = 0; local_108 = (void *)0x0; local_f0 = 0; psVar9 = (string *)&local_e8; local_100 = p_Var1; local_f8 = p_Var1; local_c8 = param_2; local_a0 = param_3; local_78 = param_4; do { auVar14 = std:: _Rb_tree<std::string,std::pair<std::string_const,int>,std::_Select1st<std::pair<std::string_const,int>>,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::_M_get_insert_hint_unique_pos(local_118,(_Rb_tree_const_iterator)p_Var1,psVar9); p_Var8 = auVar14._8_8_; if (p_Var8 != (_Rb_tree_node_base *)0x0) { bVar13 = auVar14._0_8_ != 0; local_140 = bVar13 || p_Var8 == p_Var1; if (!bVar13 && p_Var8 != p_Var1) { uVar2 = *(ulong *)(psVar9 + 8); uVar5 = *(ulong *)(p_Var8 + 0x28); __n = uVar5; if (uVar2 <= uVar5) { __n = uVar2; } if ((__n == 0) || (iVar12 = memcmp(*(void **)psVar9,*(void **)(p_Var8 + 0x20),__n), iVar12 == 0)) { lVar11 = uVar2 - uVar5; if (lVar11 < 0x80000000) { if (-0x80000001 < lVar11) { iVar12 = (int)lVar11; goto LAB_00102402; } local_140 = true; } } else { LAB_00102402: local_140 = SUB41((uint)iVar12 >> 0x1f,0); } } /* try { // try from 00102164 to 00102168 has its CatchHandler @ 00102435 */ p_Var7 = (_Rb_tree_node_base *)operator_new(0x48); __src = *(_Rb_tree_node_base **)psVar9; uVar2 = *(ulong *)(psVar9 + 8); __dest = p_Var7 + 0x30; *(_Rb_tree_node_base **)(p_Var7 + 0x20) = __dest; local_120 = uVar2; if (uVar2 < 0x10) { if (uVar2 == 1) { p_Var7[0x30] = *__src; } else if (uVar2 != 0) goto LAB_001021b2; } else { /* try { // try from 0010219d to 001021a1 has its CatchHandler @ 00102429 */ __dest = (_Rb_tree_node_base *) std::string::_M_create((ulong *)(p_Var7 + 0x20),(ulong)&local_120); *(_Rb_tree_node_base **)(p_Var7 + 0x20) = __dest; *(ulong *)(p_Var7 + 0x30) = local_120; LAB_001021b2: memcpy(__dest,__src,uVar2); __dest = *(_Rb_tree_node_base **)(p_Var7 + 0x20); } *(ulong *)(p_Var7 + 0x28) = local_120; __dest[local_120] = (_Rb_tree_node_base)0x0; *(int4 *)(p_Var7 + 0x40) = *(int4 *)(psVar9 + 0x20); std::_Rb_tree_insert_and_rebalance(local_140,p_Var7,p_Var8,p_Var1); local_f0 = local_f0 + 1; } psVar9 = psVar9 + 0x28; } while (psVar9 != local_48); do { while( true ) { psVar10 = psVar9 + -0x28; if (*(string **)psVar10 != psVar9 + -0x18) break; psVar9 = psVar10; if (psVar10 == (string *)&local_e8) goto LAB_00102207; } operator_delete(*(string **)psVar10,*(long *)(psVar9 + -0x18) + 1); psVar9 = psVar10; } while (psVar10 != (string *)&local_e8); LAB_00102207: *(int8 *)(this + 0x10) = 0; *(int (*) [16])this = (int [16])0x0; p_Var8 = local_100; do { pvVar6 = local_108; if (p_Var8 == p_Var1) { while (pvVar6 != (void *)0x0) { std:: _Rb_tree<std::string,std::pair<std::string_const,int>,std::_Select1st<std::pair<std::string_const,int>>,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::_M_erase(*(_Rb_tree_node **)((long)pvVar6 + 0x18)); pvVar4 = *(void **)((long)pvVar6 + 0x10); if (*(void **)((long)pvVar6 + 0x20) != (void *)((long)pvVar6 + 0x30)) { operator_delete(*(void **)((long)pvVar6 + 0x20),*(long *)((long)pvVar6 + 0x30) + 1); } operator_delete(pvVar6,0x48); pvVar6 = pvVar4; } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return this; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); } iVar12 = 0; if (0 < *(int *)(p_Var8 + 0x40)) { do { while (puVar3 = *(ulong **)(this + 8), puVar3 == *(ulong **)(this + 0x10)) { /* try { // try from 001022c0 to 00102356 has its CatchHandler @ 0010241d */ std::vector<std::string,std::allocator<std::string>>:: _M_realloc_insert<std::string_const&> (this,(__normal_iterator)puVar3,(string *)(p_Var8 + 0x20)); iVar12 = iVar12 + 1; if (*(int *)(p_Var8 + 0x40) <= iVar12) goto LAB_001022cf; } uVar2 = *(ulong *)(p_Var8 + 0x28); __dest_00 = puVar3 + 2; *puVar3 = (ulong)__dest_00; __src_00 = *(int **)(p_Var8 + 0x20); local_120 = uVar2; if (uVar2 < 0x10) { if (uVar2 == 1) { *(int *)(puVar3 + 2) = *__src_00; } else if (uVar2 != 0) goto LAB_00102366; } else { __dest_00 = (ulong *)std::string::_M_create(puVar3,(ulong)&local_120); *puVar3 = (ulong)__dest_00; puVar3[2] = local_120; LAB_00102366: memcpy(__dest_00,__src_00,uVar2); __dest_00 = (ulong *)*puVar3; } puVar3[1] = local_120; iVar12 = iVar12 + 1; *(int *)((long)__dest_00 + local_120) = 0; *(long *)(this + 8) = *(long *)(this + 8) + 0x20; } while (iVar12 < *(int *)(p_Var8 + 0x40)); } LAB_001022cf: p_Var8 = (_Rb_tree_node_base *)std::_Rb_tree_increment(p_Var8); } while( true ); }
3,240
func0
#include <iostream> #include <vector> #include <utility> #include <assert.h>
bool func0(const std::vector<std::pair<int, int>>& test_list1, const std::vector<std::pair<int, int>>& test_list2) { return test_list1 == test_list2; }
int main() { assert(func0({{10, 4}, {2, 5}}, {{10, 4}, {2, 5}}) == true); assert(func0({{1, 2}, {3, 7}}, {{12, 14}, {12, 45}}) == false); assert(func0({{2, 14}, {12, 25}}, {{2, 14}, {12, 25}}) == true); return 0; }
O0
cpp
func0(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&): endbr64 push %rbp mov %rsp,%rbp sub $0x10,%rsp mov %rdi,-0x8(%rbp) mov %rsi,-0x10(%rbp) mov -0x10(%rbp),%rdx mov -0x8(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 18ae <_ZSteqISt4pairIiiESaIS1_EEbRKSt6vectorIT_T0_ES8_> leaveq retq
_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_: endbr64 push rbp mov rbp, rsp sub rsp, 10h mov [rbp+var_8], rdi mov [rbp+var_10], rsi mov rdx, [rbp+var_10] mov rax, [rbp+var_8] mov rsi, rdx mov rdi, rax call _ZSteqISt4pairIiiESaIS1_EEbRKSt6vectorIT_T0_ES8_; std::operator==<std::pair<int,int>,std::allocator<std::pair<int,int>>>(std::vector<std::pair<int,int>> const&,std::vector<std::pair<int,int>> const&) leave retn
long long func0(long long a1, long long a2) { return std::operator==<std::pair<int,int>,std::allocator<std::pair<int,int>>>(a1, a2); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x10 MOV qword ptr [RBP + -0x8],RDI MOV qword ptr [RBP + -0x10],RSI MOV RDX,qword ptr [RBP + -0x10] MOV RAX,qword ptr [RBP + -0x8] MOV RSI,RDX MOV RDI,RAX CALL 0x00101870 LEAVE RET
/* func0(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&) */ void func0(vector *param_1,vector *param_2) { std::operator==(param_1,param_2); return; }
3,241
func0
#include <iostream> #include <vector> #include <utility> #include <assert.h>
bool func0(const std::vector<std::pair<int, int>>& test_list1, const std::vector<std::pair<int, int>>& test_list2) { return test_list1 == test_list2; }
int main() { assert(func0({{10, 4}, {2, 5}}, {{10, 4}, {2, 5}}) == true); assert(func0({{1, 2}, {3, 7}}, {{12, 14}, {12, 45}}) == false); assert(func0({{2, 14}, {12, 25}}, {{2, 14}, {12, 25}}) == true); return 0; }
O1
cpp
func0(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&): endbr64 mov 0x8(%rdi),%r8 mov (%rdi),%rdx mov (%rsi),%rcx mov %r8,%rdi sub %rdx,%rdi mov 0x8(%rsi),%rax sub %rcx,%rax mov $0x0,%esi cmp %rax,%rdi je 1251 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x28> mov %esi,%eax retq cmp %rdx,%r8 je 1286 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x5d> mov (%rcx),%eax cmp %eax,(%rdx) je 1263 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x3a> mov $0x0,%esi jmp 124e <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x25> mov 0x4(%rcx),%eax cmp %eax,0x4(%rdx) je 1272 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x49> mov $0x0,%esi jmp 124e <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x25> add $0x8,%rdx add $0x8,%rcx cmp %rdx,%r8 jne 1256 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x2d> mov $0x1,%esi jmp 124e <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x25> mov $0x1,%esi jmp 124e <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x25>
_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_: endbr64 mov r8, [rdi+8] mov rdx, [rdi] mov rcx, [rsi] mov rdi, r8 sub rdi, rdx mov rax, [rsi+8] sub rax, rcx mov esi, 0 cmp rdi, rax jz short loc_1211 loc_120E: mov eax, esi retn loc_1211: cmp r8, rdx jz short loc_1246 loc_1216: mov eax, [rcx] cmp [rdx], eax jz short loc_1223 mov esi, 0 jmp short loc_120E loc_1223: mov eax, [rcx+4] cmp [rdx+4], eax jz short loc_1232 mov esi, 0 jmp short loc_120E loc_1232: add rdx, 8 add rcx, 8 cmp r8, rdx jnz short loc_1216 mov esi, 1 jmp short loc_120E loc_1246: mov esi, 1 jmp short loc_120E
long long func0(long long a1, long long a2) { _DWORD *v2; // r8 _DWORD *v3; // rdx _DWORD *v4; // rcx _DWORD *v5; // rax unsigned int v6; // esi v2 = *(_DWORD **)(a1 + 8); v3 = *(_DWORD **)a1; v4 = *(_DWORD **)a2; v5 = (_DWORD *)(*(_QWORD *)(a2 + 8) - *(_QWORD *)a2); v6 = 0; if ( (_DWORD *)((char *)v2 - *(_QWORD *)a1) == v5 ) { if ( v2 == v3 ) { return 1; } else { do { if ( *v3 != *v4 ) return 0; if ( v3[1] != v4[1] ) return 0; v3 += 2; v4 += 2; } while ( v2 != v3 ); return 1; } } return v6; }
func0: ENDBR64 MOV R8,qword ptr [RDI + 0x8] MOV RDX,qword ptr [RDI] MOV RCX,qword ptr [RSI] MOV RDI,R8 SUB RDI,RDX MOV RAX,qword ptr [RSI + 0x8] SUB RAX,RCX MOV ESI,0x0 CMP RDI,RAX JZ 0x00101211 LAB_0010120e: MOV EAX,ESI RET LAB_00101211: CMP R8,RDX JZ 0x00101246 LAB_00101216: MOV EAX,dword ptr [RCX] CMP dword ptr [RDX],EAX JZ 0x00101223 MOV ESI,0x0 JMP 0x0010120e LAB_00101223: MOV EAX,dword ptr [RCX + 0x4] CMP dword ptr [RDX + 0x4],EAX JZ 0x00101232 MOV ESI,0x0 JMP 0x0010120e LAB_00101232: ADD RDX,0x8 ADD RCX,0x8 CMP R8,RDX JNZ 0x00101216 MOV ESI,0x1 JMP 0x0010120e LAB_00101246: MOV ESI,0x1 JMP 0x0010120e
/* func0(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&) */ int8 func0(vector *param_1,vector *param_2) { int *piVar1; int *piVar2; int *piVar3; int8 uVar4; piVar1 = *(int **)(param_1 + 8); piVar3 = *(int **)param_1; piVar2 = *(int **)param_2; uVar4 = 0; if ((long)piVar1 - (long)piVar3 == *(long *)(param_2 + 8) - (long)piVar2) { if (piVar1 == piVar3) { uVar4 = 1; } else { do { if (*piVar3 != *piVar2) { return 0; } if (piVar3[1] != piVar2[1]) { return 0; } piVar3 = piVar3 + 2; piVar2 = piVar2 + 2; } while (piVar1 != piVar3); uVar4 = 1; } } return uVar4; }
3,242
func0
#include <iostream> #include <vector> #include <utility> #include <assert.h>
bool func0(const std::vector<std::pair<int, int>>& test_list1, const std::vector<std::pair<int, int>>& test_list2) { return test_list1 == test_list2; }
int main() { assert(func0({{10, 4}, {2, 5}}, {{10, 4}, {2, 5}}) == true); assert(func0({{1, 2}, {3, 7}}, {{12, 14}, {12, 45}}) == false); assert(func0({{2, 14}, {12, 25}}, {{2, 14}, {12, 25}}) == true); return 0; }
O2
cpp
func0(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&): endbr64 mov (%rdi),%rdx mov 0x8(%rdi),%rdi xor %r8d,%r8d mov (%rsi),%rcx mov 0x8(%rsi),%rax mov %rdi,%r9 sub %rdx,%r9 sub %rcx,%rax cmp %rax,%r9 je 1550 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x30> mov %r8d,%eax retq nopw 0x0(%rax,%rax,1) cmp %rdi,%rdx je 1580 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x60> mov (%rcx),%eax cmp %eax,(%rdx) je 1568 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x48> xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1) mov 0x4(%rcx),%eax cmp %eax,0x4(%rdx) jne 155b <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x3b> add $0x8,%rdx add $0x8,%rcx cmp %rdx,%rdi jne 1555 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x35> nopl (%rax) mov $0x1,%r8d jmp 1543 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x23> nopl 0x0(%rax,%rax,1)
_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_: endbr64 mov rdx, [rdi] mov rdi, [rdi+8] mov rcx, [rsi] mov rax, [rsi+8] xor esi, esi mov r8, rdi sub r8, rdx sub rax, rcx cmp r8, rax jz short loc_14E8 loc_14E2: mov eax, esi retn loc_14E8: cmp rdx, rdi jz short loc_1518 loc_14ED: mov eax, [rcx] cmp [rdx], eax jz short loc_1500 loc_14F3: xor esi, esi mov eax, esi retn loc_1500: mov eax, [rcx+4] cmp [rdx+4], eax jnz short loc_14F3 add rdx, 8 add rcx, 8 cmp rdi, rdx jnz short loc_14ED nop dword ptr [rax] loc_1518: mov esi, 1 jmp short loc_14E2
long long func0(char **a1, long long a2) { char *v2; // rdx char *v3; // rdi _DWORD *v4; // rcx long long v5; // rax unsigned int v6; // esi v2 = *a1; v3 = a1[1]; v4 = *(_DWORD **)a2; v5 = *(_QWORD *)(a2 + 8); v6 = 0; if ( v3 - v2 != v5 - (_QWORD)v4 ) return v6; if ( v2 == v3 ) return 1; while ( *(_DWORD *)v2 == *v4 && *((_DWORD *)v2 + 1) == v4[1] ) { v2 += 8; v4 += 2; if ( v3 == v2 ) return 1; } return 0LL; }
func0: ENDBR64 MOV RDX,qword ptr [RDI] MOV RDI,qword ptr [RDI + 0x8] MOV RCX,qword ptr [RSI] MOV RAX,qword ptr [RSI + 0x8] XOR ESI,ESI MOV R8,RDI SUB R8,RDX SUB RAX,RCX CMP R8,RAX JZ 0x001014e8 LAB_001014e2: MOV EAX,ESI RET LAB_001014e8: CMP RDX,RDI JZ 0x00101518 LAB_001014ed: MOV EAX,dword ptr [RCX] CMP dword ptr [RDX],EAX JZ 0x00101500 LAB_001014f3: XOR ESI,ESI MOV EAX,ESI RET LAB_00101500: MOV EAX,dword ptr [RCX + 0x4] CMP dword ptr [RDX + 0x4],EAX JNZ 0x001014f3 ADD RDX,0x8 ADD RCX,0x8 CMP RDI,RDX JNZ 0x001014ed NOP dword ptr [RAX] LAB_00101518: MOV ESI,0x1 JMP 0x001014e2
/* func0(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&) */ int8 func0(vector *param_1,vector *param_2) { int *piVar1; int *piVar2; int8 uVar3; piVar2 = *(int **)param_1; piVar1 = *(int **)param_2; uVar3 = 0; if ((long)*(int **)(param_1 + 8) - (long)piVar2 == *(long *)(param_2 + 8) - (long)piVar1) { for (; piVar2 != *(int **)(param_1 + 8); piVar2 = piVar2 + 2) { if ((*piVar2 != *piVar1) || (piVar2[1] != piVar1[1])) { return 0; } piVar1 = piVar1 + 2; } uVar3 = 1; } return uVar3; }
3,243
func0
#include <iostream> #include <vector> #include <utility> #include <assert.h>
bool func0(const std::vector<std::pair<int, int>>& test_list1, const std::vector<std::pair<int, int>>& test_list2) { return test_list1 == test_list2; }
int main() { assert(func0({{10, 4}, {2, 5}}, {{10, 4}, {2, 5}}) == true); assert(func0({{1, 2}, {3, 7}}, {{12, 14}, {12, 45}}) == false); assert(func0({{2, 14}, {12, 25}}, {{2, 14}, {12, 25}}) == true); return 0; }
O3
cpp
func0(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&): endbr64 mov (%rdi),%rdx mov 0x8(%rdi),%rdi xor %r8d,%r8d mov (%rsi),%rcx mov 0x8(%rsi),%rax mov %rdi,%r9 sub %rdx,%r9 sub %rcx,%rax cmp %rax,%r9 je 1500 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x30> mov %r8d,%eax retq nopw 0x0(%rax,%rax,1) cmp %rdi,%rdx je 1530 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x60> mov (%rcx),%eax cmp %eax,(%rdx) je 1518 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x48> xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1) mov 0x4(%rcx),%eax cmp %eax,0x4(%rdx) jne 150b <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x3b> add $0x8,%rdx add $0x8,%rcx cmp %rdx,%rdi jne 1505 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x35> nopl (%rax) mov $0x1,%r8d jmp 14f3 <_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_+0x23> nopl 0x0(%rax,%rax,1)
_Z5func0RKSt6vectorISt4pairIiiESaIS1_EES5_: endbr64 mov r8, [rdi+8] mov rdx, [rdi] mov rcx, [rsi] mov rax, [rsi+8] xor esi, esi mov rdi, r8 sub rdi, rdx sub rax, rcx cmp rdi, rax jz short loc_1530 loc_1512: mov eax, esi retn loc_1518: mov eax, [rcx+4] cmp [rdx+4], eax jnz short loc_153B add rdx, 8 add rcx, 8 nop dword ptr [rax+rax+00000000h] loc_1530: cmp r8, rdx jz short loc_1540 mov eax, [rcx] cmp [rdx], eax jz short loc_1518 loc_153B: xor esi, esi mov eax, esi retn loc_1540: mov esi, 1 jmp short loc_1512
long long func0(char **a1, long long a2) { char *v2; // rdx _DWORD *v3; // rcx long long v4; // rax unsigned int v5; // esi v2 = *a1; v3 = *(_DWORD **)a2; v4 = *(_QWORD *)(a2 + 8); v5 = 0; if ( a1[1] - *a1 == v4 - (_QWORD)v3 ) { while ( a1[1] != v2 ) { if ( *(_DWORD *)v2 != *v3 || *((_DWORD *)v2 + 1) != v3[1] ) return 0LL; v2 += 8; v3 += 2; } return 1; } return v5; }
func0: ENDBR64 MOV R8,qword ptr [RDI + 0x8] MOV RDX,qword ptr [RDI] MOV RCX,qword ptr [RSI] MOV RAX,qword ptr [RSI + 0x8] XOR ESI,ESI MOV RDI,R8 SUB RDI,RDX SUB RAX,RCX CMP RDI,RAX JZ 0x00101530 LAB_00101512: MOV EAX,ESI RET LAB_00101518: MOV EAX,dword ptr [RCX + 0x4] CMP dword ptr [RDX + 0x4],EAX JNZ 0x0010153b ADD RDX,0x8 ADD RCX,0x8 NOP dword ptr [RAX + RAX*0x1] LAB_00101530: CMP R8,RDX JZ 0x00101540 MOV EAX,dword ptr [RCX] CMP dword ptr [RDX],EAX JZ 0x00101518 LAB_0010153b: XOR ESI,ESI MOV EAX,ESI RET LAB_00101540: MOV ESI,0x1 JMP 0x00101512
/* func0(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&) */ int8 func0(vector *param_1,vector *param_2) { int *piVar1; int *piVar2; int8 uVar3; piVar2 = *(int **)param_1; piVar1 = *(int **)param_2; uVar3 = 0; if ((long)*(int **)(param_1 + 8) - (long)piVar2 == *(long *)(param_2 + 8) - (long)piVar1) { for (; *(int **)(param_1 + 8) != piVar2; piVar2 = piVar2 + 2) { if ((*piVar2 != *piVar1) || (piVar2[1] != piVar1[1])) { return 0; } piVar1 = piVar1 + 2; } uVar3 = 1; } return uVar3; }
3,244
func0
#include <iostream> #include <regex> #include <cassert>
std::string func0(const std::string& street) { std::regex pattern("Road$"); std::string new_street = std::regex_replace(street, pattern, "Rd."); return new_street; }
int main() { assert(func0("ravipadu Road") == "ravipadu Rd."); assert(func0("palnadu Road") == "palnadu Rd."); assert(func0("eshwar enclave Road") == "eshwar enclave Rd."); return 0; }
O0
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x48,%rsp mov %rdi,-0x48(%rbp) mov %rsi,-0x50(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax lea -0x40(%rbp),%rax mov $0x10,%edx lea 0x2d3cc(%rip),%rsi mov %rax,%rdi callq 712c <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEEC1EPKcNSt15regex_constants18syntax_option_typeE> mov -0x48(%rbp),%rax lea -0x40(%rbp),%rdx mov -0x50(%rbp),%rsi mov $0x0,%r8d lea 0x2d3b1(%rip),%rcx mov %rax,%rdi callq 71e9 <_ZSt13regex_replaceINSt7__cxx1112regex_traitsIcEEcSt11char_traitsIcESaIcEENS0_12basic_stringIT0_T1_T2_EERKSA_RKNS0_11basic_regexIS7_T_EEPKS7_NSt15regex_constants15match_flag_typeE> lea -0x40(%rbp),%rax mov %rax,%rdi callq 71b6 <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED1Ev> mov -0x18(%rbp),%rax xor %fs:0x28,%rax je 5d28 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x9f> jmp 5d23 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x9a> endbr64 mov %rax,%rbx lea -0x40(%rbp),%rax mov %rax,%rdi callq 71b6 <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 5b00 <_Unwind_Resume@plt> callq 5960 <__stack_chk_fail@plt> mov -0x48(%rbp),%rax add $0x48,%rsp pop %rbx pop %rbp retq
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 48h mov [rbp+var_48], rdi mov [rbp+var_50], rsi mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax lea rax, [rbp+var_40] mov edx, 10h lea rcx, aRoad; "Road$" mov rsi, rcx mov rdi, rax call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEEC2EPKcNSt15regex_constants18syntax_option_typeE; std::basic_regex<char,std::regex_traits<char>>::basic_regex(char const*,std::regex_constants::syntax_option_type) mov rax, [rbp+var_48] lea rdx, [rbp+var_40] mov rsi, [rbp+var_50] mov r8d, 0 lea rcx, aRd; "Rd." mov rdi, rax call _ZSt13regex_replaceINSt7__cxx1112regex_traitsIcEEcSt11char_traitsIcESaIcEENS0_12basic_stringIT0_T1_T2_EERKSA_RKNS0_11basic_regexIS7_T_EEPKS7_NSt15regex_constants15match_flag_typeE; std::regex_replace<std::regex_traits<char>,char,std::char_traits<char>,std::allocator<char>>(std::string const&,std::basic_regex<char,std::regex_traits<char>> const&,char const*,std::regex_constants::match_flag_type) nop lea rax, [rbp+var_40] mov rdi, rax call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED2Ev; std::basic_regex<char,std::regex_traits<char>>::~basic_regex() nop mov rax, [rbp+var_18] sub rax, fs:28h jz short loc_4BDF jmp short loc_4BDA endbr64 mov rbx, rax lea rax, [rbp+var_40] mov rdi, rax call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED2Ev; std::basic_regex<char,std::regex_traits<char>>::~basic_regex() mov rax, rbx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_4BD2 call ___stack_chk_fail loc_4BD2: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_4BDA: call ___stack_chk_fail loc_4BDF: mov rax, [rbp+var_48] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, long long a2) { _BYTE v3[40]; // [rsp+10h] [rbp-40h] BYREF unsigned long long v4; // [rsp+38h] [rbp-18h] v4 = __readfsqword(0x28u); std::basic_regex<char,std::regex_traits<char>>::basic_regex(v3, "Road$", 16LL); std::regex_replace<std::regex_traits<char>,char,std::char_traits<char>,std::allocator<char>>(a1, a2, v3, "Rd.", 0LL); std::basic_regex<char,std::regex_traits<char>>::~basic_regex(v3); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x48 MOV qword ptr [RBP + -0x48],RDI MOV qword ptr [RBP + -0x50],RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX LEA RAX,[RBP + -0x40] MOV EDX,0x10 LEA RCX,[0x134051] MOV RSI,RCX MOV RDI,RAX LAB_00104b63: CALL 0x00106152 MOV RAX,qword ptr [RBP + -0x48] LEA RDX,[RBP + -0x40] MOV RSI,qword ptr [RBP + -0x50] MOV R8D,0x0 LEA RCX,[0x134057] MOV RDI,RAX LAB_00104b84: CALL 0x00106223 NOP LEA RAX,[RBP + -0x40] MOV RDI,RAX CALL 0x001061f0 NOP MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x00104bdf JMP 0x00104bda LAB_00104bda: CALL 0x00104860 LAB_00104bdf: MOV RAX,qword ptr [RBP + -0x48] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::string const&) */ string * func0(string *param_1) { int8 in_RSI; long in_FS_OFFSET; regex local_48 [40]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); std::regex::basic_regex(local_48,"Road$",0x10); /* try { // try from 00104b84 to 00104b88 has its CatchHandler @ 00104ba8 */ std::regex_replace<std::regex_traits<char>,char,std::char_traits<char>,std::allocator<char>> (param_1,in_RSI,local_48,&DAT_00134057,0); std::regex::~basic_regex(local_48); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
3,245
func0
#include <iostream> #include <regex> #include <cassert>
std::string func0(const std::string& street) { std::regex pattern("Road$"); std::string new_street = std::regex_replace(street, pattern, "Rd."); return new_street; }
int main() { assert(func0("ravipadu Road") == "ravipadu Rd."); assert(func0("palnadu Road") == "palnadu Rd."); assert(func0("eshwar enclave Road") == "eshwar enclave Rd."); return 0; }
O1
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 push %r13 push %r12 push %rbp push %rbx sub $0x48,%rsp mov %rdi,%rbx mov %rsi,%rbp mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax lea 0x8(%rsp),%r13 mov %r13,%rdi callq 4730 <_ZNSt6localeC1Ev@plt> movl $0x10,0x10(%rsp) lea 0x18(%rsp),%r12 mov %r13,%rsi mov %r12,%rdi callq 44d0 <_ZNSt6localeC1ERKS_@plt> lea 0x20(%rsp),%rdi mov 0x10(%rsp),%r8d mov %r12,%rcx lea 0x15e2e(%rip),%rdx lea -0x5(%rdx),%rsi callq 19187 <_ZNSt8__detail13__compile_nfaINSt7__cxx1112regex_traitsIcEEPKcEENSt9enable_ifIXsrNS_20__is_contiguous_iterIT0_EE5valueESt10shared_ptrIKNS_4_NFAIT_EEEE4typeES8_S8_RKNSC_11locale_typeENSt15regex_constants18syntax_option_typeE> jmp 48b4 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x8b> endbr64 mov %rax,%rbx lea 0x18(%rsp),%rdi callq 4660 <_ZNSt6localeD1Ev@plt> lea 0x8(%rsp),%rdi callq 4660 <_ZNSt6localeD1Ev@plt> mov %rbx,%rdi callq 46c0 <_Unwind_Resume@plt> lea 0x8(%rsp),%rdi callq 4660 <_ZNSt6localeD1Ev@plt> lea 0x10(%rbx),%r12 mov %r12,(%rbx) movq $0x0,0x8(%rbx) movb $0x0,0x10(%rbx) mov 0x0(%rbp),%rsi mov %rsi,%rdx add 0x8(%rbp),%rdx lea 0x10(%rsp),%rcx mov $0x0,%r9d lea 0x15e29(%rip),%r8 mov %rbx,%rdi callq ee37 <_ZSt13regex_replaceISt20back_insert_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN9__gnu_cxx17__normal_iteratorIPKcS6_EENS1_12regex_traitsIcEEcET_SF_T0_SG_RKNS1_11basic_regexIT2_T1_EEPKSI_NSt15regex_constants15match_flag_typeE> mov 0x28(%rsp),%rbp test %rbp,%rbp je 4919 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xf0> cmpq $0x0,0x1c6c0(%rip) je 4967 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x13e> mov $0xffffffff,%eax lock xadd %eax,0x8(%rbp) cmp $0x1,%eax je 4972 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x149> lea 0x18(%rsp),%rdi callq 4660 <_ZNSt6localeD1Ev@plt> mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 49af <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x186> mov %rbx,%rax add $0x48,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq endbr64 mov %rax,%rbp mov (%rbx),%rdi cmp %rdi,%r12 je 4955 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x12c> callq 4570 <_ZdlPv@plt> lea 0x10(%rsp),%rdi callq 5776 <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED1Ev> mov %rbp,%rdi callq 46c0 <_Unwind_Resume@plt> mov 0x8(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0x8(%rbp) jmp 4914 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xeb> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x10(%rax) cmpq $0x0,0x1c644(%rip) je 49a4 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x17b> mov $0xffffffff,%eax lock xadd %eax,0xc(%rbp) cmp $0x1,%eax jne 4919 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xf0> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x18(%rax) jmpq 4919 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xf0> mov 0xc(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0xc(%rbp) jmp 4990 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x167> callq 45d0 <__stack_chk_fail@plt>
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp push r14 push r12 push rbx sub rsp, 38h mov rbx, rdi mov r14, rsi mov rax, fs:28h mov [rbp+var_28], rax xor eax, eax lea r12, [rbp+var_50] lea rdi, [rbp+var_48]; this call __ZNSt6localeC1Ev; std::locale::locale(void) mov [rbp+var_40], 0 mov [rbp+var_38], 0 mov ecx, 10h lea rdx, aRoad+5; "" lea rsi, [rdx-5] mov rdi, r12 call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEE10_M_compileEPKcS5_NSt15regex_constants18syntax_option_typeE; std::basic_regex<char,std::regex_traits<char>>::_M_compile(char const*,char const*,std::regex_constants::syntax_option_type) jmp short loc_48A0 endbr64 mov rbx, rax mov rdi, [rbp+var_38] test rdi, rdi jz short loc_487B call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release(void) loc_487B: lea rdi, [rbp+var_48]; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rbp+var_28] sub rax, fs:28h jz short loc_4898 call ___stack_chk_fail loc_4898: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume loc_48A0: lea rax, [rbx+10h] mov [rbx], rax mov qword ptr [rbx+8], 0 mov byte ptr [rbx+10h], 0 mov rsi, [r14] mov rdx, rsi add rdx, [r14+8] lea rcx, [rbp+var_50] sub rsp, 8 push 0 mov r9d, 3 lea r8, aEshwarEnclaveR_0+0Fh; "Rd." mov rdi, rbx call _ZSt15__regex_replaceISt20back_insert_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN9__gnu_cxx17__normal_iteratorIPKcS6_EENS1_12regex_traitsIcEEcET_SF_T0_SG_RKNS1_11basic_regexIT2_T1_EEPKSI_mNSt15regex_constants15match_flag_typeE; std::__regex_replace<std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::regex_traits<char>,char>(std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::basic_regex<char,std::regex_traits<char>> const&,char const*,ulong,std::regex_constants::match_flag_type) add rsp, 10h mov rax, [rbp+var_38] mov rdi, rax test rax, rax jz short loc_4922 lea rcx, [rax+8] mov rdx, [rax+8] mov rax, 100000001h cmp rdx, rax jz short loc_497C cmp cs:__libc_single_threaded@GLIBC_2_32, 0 jz loc_499F mov eax, [rdi+8] lea edx, [rax-1] mov [rdi+8], edx loc_4919: cmp eax, 1 jz loc_49AD loc_4922: lea rdi, [rbp+var_48]; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rbp+var_28] sub rax, fs:28h jnz short loc_49B7 mov rax, rbx lea rsp, [rbp-18h] pop rbx pop r12 pop r14 pop rbp retn endbr64 mov r14, rax mov rdi, rbx call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv; std::string::_M_dispose(void) lea rdi, [rbp+var_50] call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED2Ev; std::basic_regex<char,std::regex_traits<char>>::~basic_regex() mov rax, [rbp+var_28] sub rax, fs:28h jz short loc_4974 call ___stack_chk_fail loc_4974: mov rdi, r14; struct _Unwind_Exception * call __Unwind_Resume loc_497C: mov r12, rdi mov dword ptr [rdi+8], 0 mov dword ptr [rdi+0Ch], 0 mov rax, [rdi] call qword ptr [rax+10h] mov rdi, r12 mov rax, [r12] call qword ptr [rax+18h] jmp short loc_4922 loc_499F: mov eax, 0FFFFFFFFh lock xadd [rcx], eax jmp loc_4919 loc_49AD: call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE24_M_release_last_use_coldEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(void) jmp loc_4922 loc_49B7: call ___stack_chk_fail
long long func0(long long a1, long long *a2) { long long v4; // rsi _DWORD *v5; // rdi volatile signed __int32 *v6; // rcx long long v7; // rdx signed __int32 v8; // eax _BYTE v10[8]; // [rsp+0h] [rbp-50h] BYREF _BYTE v11[8]; // [rsp+8h] [rbp-48h] BYREF long long v12; // [rsp+10h] [rbp-40h] long long v13; // [rsp+18h] [rbp-38h] unsigned long long v14; // [rsp+28h] [rbp-28h] v14 = __readfsqword(0x28u); std::locale::locale((std::locale *)v11); v12 = 0LL; v13 = 0LL; std::basic_regex<char,std::regex_traits<char>>::_M_compile(v10, "Road$", "", 16LL); *(_QWORD *)a1 = a1 + 16; *(_QWORD *)(a1 + 8) = 0LL; *(_BYTE *)(a1 + 16) = 0; v4 = *a2; std::__regex_replace<std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::regex_traits<char>,char>( a1, *a2, *((_DWORD *)a2 + 2) + *(_DWORD *)a2, (unsigned int)v10, (unsigned int)"Rd.", 3, 0); v5 = (_DWORD *)v13; if ( v13 ) { v6 = (volatile signed __int32 *)(v13 + 8); v7 = *(_QWORD *)(v13 + 8); if ( v7 == 0x100000001LL ) { *(_DWORD *)(v13 + 8) = 0; v5[3] = 0; (*(void ( **)(_DWORD *, long long, long long, volatile signed __int32 *))(*(_QWORD *)v5 + 16LL))( v5, v4, 0x100000001LL, v6); (*(void ( **)(_DWORD *))(*(_QWORD *)v5 + 24LL))(v5); } else { if ( _libc_single_threaded ) { v8 = *(_DWORD *)(v13 + 8); v7 = (unsigned int)(v8 - 1); *(_DWORD *)(v13 + 8) = v7; } else { v8 = _InterlockedExchangeAdd(v6, 0xFFFFFFFF); } if ( v8 == 1 ) std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(v5, v4, v7, v6); } } std::locale::~locale((std::locale *)v11); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R14 PUSH R12 PUSH RBX SUB RSP,0x38 MOV RBX,RDI MOV R14,RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x28],RAX XOR EAX,EAX LEA R12,[RBP + -0x50] LEA RDI,[RBP + -0x48] CALL 0x00104710 MOV qword ptr [RBP + -0x40],0x0 MOV qword ptr [RBP + -0x38],0x0 MOV ECX,0x10 LEA RDX,[0x11966c] LEA RSI,[RDX + -0x5] MOV RDI,R12 LAB_0010485f: CALL 0x00117714 JMP 0x001048a0 LAB_001048a0: LEA RAX,[RBX + 0x10] MOV qword ptr [RBX],RAX MOV qword ptr [RBX + 0x8],0x0 MOV byte ptr [RBX + 0x10],0x0 MOV RSI,qword ptr [R14] MOV RDX,RSI ADD RDX,qword ptr [R14 + 0x8] LEA RCX,[RBP + -0x50] SUB RSP,0x8 PUSH 0x0 MOV R9D,0x3 LEA R8,[0x1196cf] MOV RDI,RBX LAB_001048d7: CALL 0x0010edca ADD RSP,0x10 MOV RAX,qword ptr [RBP + -0x38] MOV RDI,RAX TEST RAX,RAX JZ 0x00104922 LEA RCX,[RAX + 0x8] MOV RDX,qword ptr [RAX + 0x8] MOV RAX,0x100000001 CMP RDX,RAX JZ 0x0010497c CMP byte ptr [0x0011f460],0x0 JZ 0x0010499f MOV EAX,dword ptr [RDI + 0x8] LEA EDX,[RAX + -0x1] MOV dword ptr [RDI + 0x8],EDX LAB_00104919: CMP EAX,0x1 JZ 0x001049ad LAB_00104922: LEA RDI,[RBP + -0x48] CALL 0x00104650 MOV RAX,qword ptr [RBP + -0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x001049b7 MOV RAX,RBX LEA RSP,[RBP + -0x18] POP RBX POP R12 POP R14 POP RBP RET LAB_0010497c: MOV R12,RDI MOV dword ptr [RDI + 0x8],0x0 MOV dword ptr [RDI + 0xc],0x0 MOV RAX,qword ptr [RDI] CALL qword ptr [RAX + 0x10] MOV RDI,R12 MOV RAX,qword ptr [R12] CALL qword ptr [RAX + 0x18] JMP 0x00104922 LAB_0010499f: MOV EAX,0xffffffff XADD.LOCK dword ptr [RCX],EAX JMP 0x00104919 LAB_001049ad: CALL 0x0010588a JMP 0x00104922 LAB_001049b7: CALL 0x001045a0
/* func0(std::string const&) */ string * func0(string *param_1) { _Sp_counted_base<(_Lock_policy)2> *p_Var1; _Sp_counted_base<(_Lock_policy)2> *p_Var2; int iVar3; int8 *in_RSI; long in_FS_OFFSET; regex local_58 [8]; int local_50 [8]; int8 local_48; _Sp_counted_base<(_Lock_policy)2> *local_40; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); std::locale::locale(local_50); local_48 = 0; local_40 = (_Sp_counted_base<(_Lock_policy)2> *)0x0; /* try { // try from 0010485f to 00104863 has its CatchHandler @ 00104866 */ std::regex::_M_compile(local_58,"Road$","",0x10); *(string **)param_1 = param_1 + 0x10; *(int8 *)(param_1 + 8) = 0; param_1[0x10] = (string)0x0; /* try { // try from 001048d7 to 001048db has its CatchHandler @ 00104948 */ std:: __regex_replace<std::back_insert_iterator<std::string>,__normal_iterator<char_const*,std::string>,std::regex_traits<char>,char> ((back_insert_iterator)param_1,(__normal_iterator)*in_RSI, (__normal_iterator)*in_RSI + (int)in_RSI[1],local_58,"Rd.",3,0); p_Var2 = local_40; if (local_40 != (_Sp_counted_base<(_Lock_policy)2> *)0x0) { p_Var1 = local_40 + 8; if (*(long *)(local_40 + 8) == 0x100000001) { *(int4 *)(local_40 + 8) = 0; *(int4 *)(local_40 + 0xc) = 0; (**(code **)(*(long *)local_40 + 0x10))(); (**(code **)(*(long *)p_Var2 + 0x18))(p_Var2); } else { if (__libc_single_threaded == '\0') { LOCK(); iVar3 = *(int *)p_Var1; *(int *)p_Var1 = *(int *)p_Var1 + -1; UNLOCK(); } else { iVar3 = *(int *)(local_40 + 8); *(int *)(local_40 + 8) = iVar3 + -1; } if (iVar3 == 1) { std::_Sp_counted_base<(_Lock_policy)2>::_M_release_last_use_cold(local_40); } } } std::locale::~locale(local_50); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,246
func0
#include <iostream> #include <regex> #include <cassert>
std::string func0(const std::string& street) { std::regex pattern("Road$"); std::string new_street = std::regex_replace(street, pattern, "Rd."); return new_street; }
int main() { assert(func0("ravipadu Road") == "ravipadu Rd."); assert(func0("palnadu Road") == "palnadu Rd."); assert(func0("eshwar enclave Road") == "eshwar enclave Rd."); return 0; }
O2
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 push %r14 push %r13 push %r12 mov %rdi,%r12 push %rbp push %rbx mov %rsi,%rbx sub $0x40,%rsp mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax lea 0x8(%rsp),%rbp lea 0x18(%rsp),%r13 mov %rbp,%rdi callq 4770 <_ZNSt6localeC1Ev@plt> mov %rbp,%rsi mov %r13,%rdi movl $0x10,0x10(%rsp) callq 4500 <_ZNSt6localeC1ERKS_@plt> lea 0x16ae2(%rip),%rdx mov 0x10(%rsp),%r8d mov %r13,%rcx lea 0x20(%rsp),%rdi lea -0x5(%rdx),%rsi callq 1a620 <_ZNSt8__detail13__compile_nfaINSt7__cxx1112regex_traitsIcEEPKcEENSt9enable_ifIXsrNS_20__is_contiguous_iterIT0_EE5valueESt10shared_ptrIKNS_4_NFAIT_EEEE4typeES8_S8_RKNSC_11locale_typeENSt15regex_constants18syntax_option_typeE> mov %rbp,%rdi lea 0x10(%r12),%r14 lea 0x10(%rsp),%rbp callq 46a0 <_ZNSt6localeD1Ev@plt> mov %r14,(%r12) xor %r9d,%r9d mov %rbp,%rcx movb $0x0,0x10(%r12) mov (%rbx),%rsi lea 0x16b03(%rip),%r8 mov %r12,%rdi movq $0x0,0x8(%r12) mov 0x8(%rbx),%rdx add %rsi,%rdx callq e770 <_ZSt13regex_replaceISt20back_insert_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN9__gnu_cxx17__normal_iteratorIPKcS6_EENS1_12regex_traitsIcEEcET_SF_T0_SG_RKNS1_11basic_regexIT2_T1_EEPKSI_NSt15regex_constants15match_flag_typeE> mov 0x28(%rsp),%rbp test %rbp,%rbp je 4c58 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x1d37b(%rip),%rbx test %rbx,%rbx je 4c80 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x100> mov $0xffffffff,%eax lock xadd %eax,0x8(%rbp) cmp $0x1,%eax je 4c8e <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x10e> nopl 0x0(%rax) mov %r13,%rdi callq 46a0 <_ZNSt6localeD1Ev@plt> mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 4ccb <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x14b> add $0x40,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq mov 0x8(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0x8(%rbp) cmp $0x1,%eax jne 4c58 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x10(%rax) test %rbx,%rbx je 4cc0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x140> mov $0xffffffff,%eax lock xadd %eax,0xc(%rbp) cmp $0x1,%eax jne 4c58 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x18(%rax) jmp 4c58 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> nopl 0x0(%rax,%rax,1) mov 0xc(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0xc(%rbp) jmp 4ca7 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x127> callq 4610 <__stack_chk_fail@plt> endbr64 mov %rax,%r13 jmpq 47e3 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold> endbr64 mov %rax,%r12 jmpq 4801 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold+0x1e> nopl 0x0(%rax,%rax,1)
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp push r14 mov r14, rsi push r13 lea r13, [rbp+var_50] push r12 lea r12, [rbp+var_48] push rbx mov rbx, rdi mov rdi, r12; this sub rsp, 30h mov rax, fs:28h mov [rbp+var_28], rax xor eax, eax call __ZNSt6localeC1Ev; std::locale::locale(void) lea rdx, aRoad+5; "" pxor xmm0, xmm0 mov rdi, r13 mov ecx, 10h lea rsi, [rdx-5] movaps [rbp+var_40], xmm0 call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEE10_M_compileEPKcS5_NSt15regex_constants18syntax_option_typeE; std::basic_regex<char,std::regex_traits<char>>::_M_compile(char const*,char const*,std::regex_constants::syntax_option_type) lea rax, [rbx+10h] sub rsp, 8 mov byte ptr [rbx+10h], 0 mov rcx, r13 mov [rbx], rax mov rsi, [r14] mov r9d, 3 mov rdi, rbx; int mov qword ptr [rbx+8], 0 mov rdx, [r14+8] lea r8, aEshwarEnclaveR_0+0Fh; "Rd." push 0 add rdx, rsi call _ZSt15__regex_replaceISt20back_insert_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN9__gnu_cxx17__normal_iteratorIPKcS6_EENS1_12regex_traitsIcEEcET_SF_T0_SG_RKNS1_11basic_regexIT2_T1_EEPKSI_mNSt15regex_constants15match_flag_typeE; std::__regex_replace<std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::regex_traits<char>,char>(std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::basic_regex<char,std::regex_traits<char>> const&,char const*,ulong,std::regex_constants::match_flag_type) pop rax mov rax, qword ptr [rbp+var_40+8] pop rdx mov rdi, rax test rax, rax jz short loc_612F mov rdx, [rax+8] lea rcx, [rax+8] mov rax, 100000001h cmp rdx, rax jz short loc_6160 cmp cs:__libc_single_threaded@GLIBC_2_32, 0 jz short loc_6180 mov eax, [rdi+8] lea edx, [rax-1] mov [rdi+8], edx loc_612A: cmp eax, 1 jz short loc_6190 loc_612F: mov rdi, r12; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rbp+var_28] sub rax, fs:28h jnz short loc_6197 lea rsp, [rbp-20h] mov rax, rbx pop rbx pop r12 pop r13 pop r14 pop rbp retn loc_6160: mov rax, [rdi] mov r13, rdi mov qword ptr [rdi+8], 0 call qword ptr [rax+10h] mov rax, [r13+0] mov rdi, r13 call qword ptr [rax+18h] jmp short loc_612F loc_6180: mov eax, 0FFFFFFFFh lock xadd [rcx], eax jmp short loc_612A loc_6190: call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE24_M_release_last_use_coldEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(void) jmp short loc_612F loc_6197: call ___stack_chk_fail endbr64 mov r14, rax jmp _Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE_cold; func0(std::string const&) [clone] endbr64 mov rbx, rax jmp loc_486C
long long func0(long long a1, long long *a2) { long long v3; // rsi long long v4; // rdi long long v5; // rdx volatile signed __int32 *v6; // rcx signed __int32 v7; // eax long long v9; // rax _BYTE v10[8]; // [rsp+0h] [rbp-50h] BYREF _BYTE v11[8]; // [rsp+8h] [rbp-48h] BYREF __int128 v12; // [rsp+10h] [rbp-40h] unsigned long long v13; // [rsp+28h] [rbp-28h] v13 = __readfsqword(0x28u); std::locale::locale((std::locale *)v11); v12 = 0LL; std::basic_regex<char,std::regex_traits<char>>::_M_compile(v10, "Road$", "", 16LL); *(_BYTE *)(a1 + 16) = 0; *(_QWORD *)a1 = a1 + 16; v3 = *a2; *(_QWORD *)(a1 + 8) = 0LL; std::__regex_replace<std::back_insert_iterator<std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::regex_traits<char>,char>(a1); v4 = *((_QWORD *)&v12 + 1); if ( *((_QWORD *)&v12 + 1) ) { v5 = *(_QWORD *)(*((_QWORD *)&v12 + 1) + 8LL); v6 = (volatile signed __int32 *)(*((_QWORD *)&v12 + 1) + 8LL); if ( v5 == 0x100000001LL ) { v9 = **((_QWORD **)&v12 + 1); *(_QWORD *)(*((_QWORD *)&v12 + 1) + 8LL) = 0LL; (*(void ( **)(long long, long long, long long, volatile signed __int32 *))(v9 + 16))( v4, v3, 0x100000001LL, v6); (*(void ( **)(long long))(*(_QWORD *)v4 + 24LL))(v4); } else { if ( _libc_single_threaded ) { v7 = *(_DWORD *)(*((_QWORD *)&v12 + 1) + 8LL); v5 = (unsigned int)(v7 - 1); *(_DWORD *)(*((_QWORD *)&v12 + 1) + 8LL) = v5; } else { v7 = _InterlockedExchangeAdd(v6, 0xFFFFFFFF); } if ( v7 == 1 ) std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(v4, v3, v5, v6); } } std::locale::~locale((std::locale *)v11); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R14 MOV R14,RSI PUSH R13 LEA R13,[RBP + -0x50] PUSH R12 LEA R12,[RBP + -0x48] PUSH RBX MOV RBX,RDI MOV RDI,R12 SUB RSP,0x30 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x28],RAX XOR EAX,EAX CALL 0x001046f0 LEA RDX,[0x11a66c] PXOR XMM0,XMM0 MOV RDI,R13 MOV ECX,0x10 LEA RSI,[RDX + -0x5] MOVAPS xmmword ptr [RBP + -0x40],XMM0 LAB_001060b3: CALL 0x001194d0 LEA RAX,[RBX + 0x10] SUB RSP,0x8 MOV byte ptr [RBX + 0x10],0x0 MOV RCX,R13 MOV qword ptr [RBX],RAX MOV RSI,qword ptr [R14] MOV R9D,0x3 MOV RDI,RBX MOV qword ptr [RBX + 0x8],0x0 MOV RDX,qword ptr [R14 + 0x8] LEA R8,[0x11a6cf] PUSH 0x0 ADD RDX,RSI LAB_001060ee: CALL 0x00112140 POP RAX MOV RAX,qword ptr [RBP + -0x38] POP RDX MOV RDI,RAX TEST RAX,RAX JZ 0x0010612f MOV RDX,qword ptr [RAX + 0x8] LEA RCX,[RAX + 0x8] MOV RAX,0x100000001 CMP RDX,RAX JZ 0x00106160 CMP byte ptr [0x00120460],0x0 JZ 0x00106180 MOV EAX,dword ptr [RDI + 0x8] LEA EDX,[RAX + -0x1] MOV dword ptr [RDI + 0x8],EDX LAB_0010612a: CMP EAX,0x1 JZ 0x00106190 LAB_0010612f: MOV RDI,R12 CALL 0x00104640 MOV RAX,qword ptr [RBP + -0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x00106197 LEA RSP,[RBP + -0x20] MOV RAX,RBX POP RBX POP R12 POP R13 POP R14 POP RBP RET LAB_00106160: MOV RAX,qword ptr [RDI] MOV R13,RDI MOV qword ptr [RDI + 0x8],0x0 CALL qword ptr [RAX + 0x10] MOV RAX,qword ptr [R13] MOV RDI,R13 CALL qword ptr [RAX + 0x18] JMP 0x0010612f LAB_00106180: MOV EAX,0xffffffff XADD.LOCK dword ptr [RCX],EAX JMP 0x0010612a LAB_00106190: CALL 0x001073c0 JMP 0x0010612f LAB_00106197: CALL 0x001045a0
/* func0(std::string const&) */ string * func0(string *param_1) { _Sp_counted_base<(_Lock_policy)2> *p_Var1; int8 uVar2; int iVar3; int8 *in_RSI; long in_FS_OFFSET; regex local_58 [8]; int local_50 [8]; int local_48 [24]; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); std::locale::locale(local_50); local_48._0_16_ = (int [16])0x0; /* try { // try from 001060b3 to 001060b7 has its CatchHandler @ 001061a8 */ std::regex::_M_compile(local_58,"Road$","",0x10); param_1[0x10] = (string)0x0; *(string **)param_1 = param_1 + 0x10; uVar2 = *in_RSI; *(int8 *)(param_1 + 8) = 0; /* try { // try from 001060ee to 001060f2 has its CatchHandler @ 0010619c */ std:: __regex_replace<std::back_insert_iterator<std::string>,__normal_iterator<char_const*,std::string>,std::regex_traits<char>,char> ((back_insert_iterator)param_1,(__normal_iterator)uVar2, (int)in_RSI[1] + (__normal_iterator)uVar2,local_58,"Rd.",3,0); uVar2 = local_48._8_8_; if ((_Sp_counted_base<(_Lock_policy)2> *)local_48._8_8_ != (_Sp_counted_base<(_Lock_policy)2> *)0x0) { p_Var1 = (_Sp_counted_base<(_Lock_policy)2> *)(local_48._8_8_ + 8); if (*(long *)(local_48._8_8_ + 8) == 0x100000001) { *(int8 *)(local_48._8_8_ + 8) = 0; (**(code **)(*(long *)local_48._8_8_ + 0x10))(); (**(code **)(*(long *)uVar2 + 0x18))(uVar2); } else { if (__libc_single_threaded == '\0') { LOCK(); iVar3 = *(int *)p_Var1; *(int *)p_Var1 = *(int *)p_Var1 + -1; UNLOCK(); } else { iVar3 = *(int *)(local_48._8_8_ + 8); *(int *)(local_48._8_8_ + 8) = iVar3 + -1; } if (iVar3 == 1) { std::_Sp_counted_base<(_Lock_policy)2>::_M_release_last_use_cold ((_Sp_counted_base<(_Lock_policy)2> *)local_48._8_8_); } } } std::locale::~locale(local_50); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,247
func0
#include <iostream> #include <regex> #include <cassert>
std::string func0(const std::string& street) { std::regex pattern("Road$"); std::string new_street = std::regex_replace(street, pattern, "Rd."); return new_street; }
int main() { assert(func0("ravipadu Road") == "ravipadu Rd."); assert(func0("palnadu Road") == "palnadu Rd."); assert(func0("eshwar enclave Road") == "eshwar enclave Rd."); return 0; }
O3
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 push %r14 push %r13 push %r12 mov %rdi,%r12 push %rbp push %rbx mov %rsi,%rbx sub $0x40,%rsp mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax lea 0x8(%rsp),%rbp lea 0x18(%rsp),%r13 mov %rbp,%rdi callq 47b0 <_ZNSt6localeC1Ev@plt> mov %rbp,%rsi mov %r13,%rdi movl $0x10,0x10(%rsp) callq 4530 <_ZNSt6localeC1ERKS_@plt> lea 0x171ca(%rip),%rdx mov 0x10(%rsp),%r8d mov %r13,%rcx lea 0x20(%rsp),%rdi lea -0x5(%rdx),%rsi callq 1ac90 <_ZNSt8__detail13__compile_nfaINSt7__cxx1112regex_traitsIcEEPKcEENSt9enable_ifIXsrNS_20__is_contiguous_iterIT0_EE5valueESt10shared_ptrIKNS_4_NFAIT_EEEE4typeES8_S8_RKNSC_11locale_typeENSt15regex_constants18syntax_option_typeE> mov %rbp,%rdi lea 0x10(%r12),%r14 lea 0x10(%rsp),%rbp callq 46e0 <_ZNSt6localeD1Ev@plt> mov %r14,(%r12) xor %r9d,%r9d mov %rbp,%rcx movb $0x0,0x10(%r12) mov (%rbx),%rsi lea 0x171eb(%rip),%r8 mov %r12,%rdi movq $0x0,0x8(%r12) mov 0x8(%rbx),%rdx add %rsi,%rdx callq 10d00 <_ZSt13regex_replaceISt20back_insert_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN9__gnu_cxx17__normal_iteratorIPKcS6_EENS1_12regex_traitsIcEEcET_SF_T0_SG_RKNS1_11basic_regexIT2_T1_EEPKSI_NSt15regex_constants15match_flag_typeE> mov 0x28(%rsp),%rbp test %rbp,%rbp je 55a8 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x1da3b(%rip),%rbx test %rbx,%rbx je 55d0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x100> mov $0xffffffff,%eax lock xadd %eax,0x8(%rbp) cmp $0x1,%eax je 55de <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x10e> nopl 0x0(%rax) mov %r13,%rdi callq 46e0 <_ZNSt6localeD1Ev@plt> mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 561b <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x14b> add $0x40,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq mov 0x8(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0x8(%rbp) cmp $0x1,%eax jne 55a8 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x10(%rax) test %rbx,%rbx je 5610 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x140> mov $0xffffffff,%eax lock xadd %eax,0xc(%rbp) cmp $0x1,%eax jne 55a8 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x18(%rax) jmp 55a8 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd8> nopl 0x0(%rax,%rax,1) mov 0xc(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0xc(%rbp) jmp 55f7 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x127> callq 4640 <__stack_chk_fail@plt> endbr64 mov %rax,%r13 jmpq 4836 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold> endbr64 mov %rax,%r12 jmpq 4854 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold+0x1e> nopl 0x0(%rax,%rax,1)
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp push r15 push r14 lea r14, [rbp+var_E0] push r13 push r12 mov r12, rsi push rbx mov rbx, rdi sub rsp, 108h mov rax, fs:28h mov [rbp+var_38], rax xor eax, eax lea rax, [rbp+var_D8] mov [rbp+var_130], r14 mov rdi, rax; this mov [rbp+var_128], rax call __ZNSt6localeC1Ev; std::locale::locale(void) lea rdx, aRoad+5; "" pxor xmm0, xmm0 mov rdi, r14 mov ecx, 10h lea rsi, [rdx-5] movaps [rbp+var_D0], xmm0 call _ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEE10_M_compileEPKcS5_NSt15regex_constants18syntax_option_typeE; std::basic_regex<char,std::regex_traits<char>>::_M_compile(char const*,char const*,std::regex_constants::syntax_option_type) lea rax, [rbx+10h] mov byte ptr [rbx+10h], 0 sub rsp, 8 xor r9d, r9d mov [rbx], rax mov rcx, [rbp+var_130] xor r8d, r8d mov [rbp+var_100], rax mov rax, [r12] mov qword ptr [rbx+8], 0 mov r13, [r12+8] movq xmm0, rax mov r15, rax mov [rbp+var_B0], rcx mov [rbp+var_A8], 0 lea r12, [rax+r13] lea rax, [rbp+var_A0] movq xmm1, r12 mov [rbp+var_120], rax mov rdx, rax punpcklqdq xmm0, xmm1 movaps [rbp+var_C0], xmm0 movq rdi, xmm0 pxor xmm0, xmm0 mov rsi, qword ptr [rbp+var_C0+8] movaps [rbp+var_A0], xmm0 movaps [rbp+var_90], xmm0 push 0 call _ZNSt8__detail17__regex_algo_implIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEEcNS5_12regex_traitsIcEEEEbT_SH_RNS5_13match_resultsISH_T0_EERKNS5_11basic_regexIT1_T2_EENSt15regex_constants15match_flag_typeENS_20_RegexExecutorPolicyEb; std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>(__gnu_cxx::__normal_iterator<char const*,std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::match_results<__gnu_cxx::__normal_iterator<char const*,std::string>> &,std::basic_regex<char,std::regex_traits<char>> const&,std::regex_constants::match_flag_type,std::__detail::_RegexExecutorPolicy,bool) pop r8 pop r9 test al, al jz loc_65F7 loc_6217: lea rax, [rbp+var_C0] pxor xmm0, xmm0 lea rsi, [rbp+var_80] mov qword ptr [rbp+var_70], 0 mov rdi, rax mov dword ptr [rbp+var_70+8], 0 mov [rbp+var_118], rsi mov [rbp+var_110], rax movaps [rbp+var_80], xmm0 movaps [rbp+var_60], xmm0 movaps [rbp+var_50], xmm0 call _ZNKSt7__cxx1114regex_iteratorIN9__gnu_cxx17__normal_iteratorIPKcNS_12basic_stringIcSt11char_traitsIcESaIcEEEEEcNS_12regex_traitsIcEEEeqERKSD_; std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>>::operator==(std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>> const&) test al, al jz loc_6312 test r13, r13 jle short loc_6283 nop dword ptr [rax+00h] loc_6268: movsx esi, byte ptr [r15] mov rdi, rbx mov r14, r15 call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc; std::string::push_back(char) add r14, 1 mov r15, r14 cmp r12, r14 jnz short loc_6268 loc_6283: lea rdi, [rbp+var_60] call _ZNSt6vectorINSt7__cxx119sub_matchIN9__gnu_cxx17__normal_iteratorIPKcNS0_12basic_stringIcSt11char_traitsIcESaIcEEEEEEESaISC_EED2Ev; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector() mov rdi, [rbp+var_120] call _ZNSt6vectorINSt7__cxx119sub_matchIN9__gnu_cxx17__normal_iteratorIPKcNS0_12basic_stringIcSt11char_traitsIcESaIcEEEEEEESaISC_EED2Ev; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector() mov rax, qword ptr [rbp+var_D0+8] mov rdi, rax test rax, rax jz short loc_62E1 mov rcx, [rax+8] lea rdx, [rax+8] mov rax, 100000001h cmp rcx, rax jz loc_6665 cmp cs:__libc_single_threaded@GLIBC_2_32, 0 jz loc_6684 mov eax, [rdi+8] lea edx, [rax-1] mov [rdi+8], edx loc_62D8: cmp eax, 1 jz loc_6692 loc_62E1: mov rdi, [rbp+var_128]; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rbp+var_38] sub rax, fs:28h jnz loc_66B0 lea rsp, [rbp-28h] mov rax, rbx pop rbx pop r12 pop r13 pop r14 pop r15 pop rbp retn loc_6312: lea rdi, [rbp+var_F0] xor r13d, r13d xor r15d, r15d mov [rbp+var_108], rdi test al, al jnz loc_652F xchg ax, ax loc_6330: mov rdx, qword ptr [rbp+var_A0] mov rax, qword ptr [rbp+var_A0+8] sub rax, rdx lea rcx, [rdx+rax-30h] cmp rax, 49h ; 'I' lea rdx, [rdx+rax-48h] mov rax, rcx cmovb rax, rdx mov r15, [rax+8] mov r12, [rax] mov rax, r15 sub rax, r12 test rax, rax jg short loc_6390 jmp short loc_63DB loc_6370: mov rcx, [rbp+var_F8] add r12, 1 mov [rax+rcx], r14b mov rax, [rbx] mov [rbx+8], r13 mov byte ptr [rax+rcx+1], 0 cmp r15, r12 jz short loc_63DB loc_6390: mov rax, [rbx+8] movzx r14d, byte ptr [r12] mov [rbp+var_F8], rax lea r13, [rax+1] mov rax, [rbx] cmp [rbp+var_100], rax jz loc_6560 mov rdx, [rbx+10h] loc_63B8: cmp rdx, r13 jnb short loc_6370 mov rsi, [rbp+var_F8] xor ecx, ecx xor edx, edx mov rdi, rbx mov r8d, 1 call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEmmPKcm; std::string::_M_mutate(ulong,ulong,char const*,ulong) mov rax, [rbx] jmp short loc_6370 loc_63DB: mov r15, [rbp+var_108] mov rdi, r15; this call __ZNSt6localeC1Ev; std::locale::locale(void) lea rax, [rbp+var_E8] mov rsi, r15; std::locale * mov rdi, rax; this mov r14, rax call __ZNSt6localeC1ERKS_; std::locale::locale(std::locale const&) lea rdi, _ZNSt5ctypeIcE2idE@GLIBCXX_3_4; this call __ZNKSt6locale2id5_M_idEv; std::locale::id::_M_id(void) mov rdx, rax mov rax, [rbp+var_E8] mov rax, [rax+8] cmp qword ptr [rax+rdx*8], 0 jz loc_669C mov rdi, r14; this call __ZNSt6localeD1Ev; std::locale::~locale() mov esi, 52h ; 'R' mov rdi, rbx call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc; std::string::push_back(char) mov esi, 64h ; 'd' mov rdi, rbx call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc; std::string::push_back(char) mov esi, 2Eh ; '.' mov rdi, rbx call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc; std::string::push_back(char) mov rdi, [rbp+var_108]; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rcx, qword ptr [rbp+var_A0+8] mov rax, qword ptr [rbp+var_A0] mov rsi, rcx sub rsi, rax cmp rsi, 48h ; 'H' jbe loc_6570 lea rdx, [rax+rsi-18h] cmp rcx, rax mov r15, [rdx] mov r13, [rdx+8] lea rdx, [rcx+rsi-48h] cmovnz rdx, rax loc_6495: cmp byte ptr [rdx+10h], 0 jz short loc_6514 cmp rcx, rax jz loc_65ED loc_64A4: mov r12, [rax+8] mov rdi, r12 cmp r12, [rax] jz loc_65A2 loc_64B4: mov r8d, [rbp+var_A8] sub rsp, 8 mov rcx, [rbp+var_B0] xor r9d, r9d mov rdx, [rbp+var_120] mov rsi, qword ptr [rbp+var_C0+8] or r8b, 80h mov [rbp+var_A8], r8d push 0 call _ZNSt8__detail17__regex_algo_implIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEEcNS5_12regex_traitsIcEEEEbT_SH_RNS5_13match_resultsISH_T0_EERKNS5_11basic_regexIT1_T2_EENSt15regex_constants15match_flag_typeENS_20_RegexExecutorPolicyEb; std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>(__gnu_cxx::__normal_iterator<char const*,std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::match_results<__gnu_cxx::__normal_iterator<char const*,std::string>> &,std::basic_regex<char,std::regex_traits<char>> const&,std::regex_constants::match_flag_type,std::__detail::_RegexExecutorPolicy,bool) pop rdx pop rcx test al, al jz loc_6592 loc_64F3: mov rax, qword ptr [rbp+var_A0+8] cmp [rax-28h], r12 mov [rax-30h], r12 setnz byte ptr [rax-20h] mov rax, qword ptr [rbp+var_C0] mov qword ptr [rbp+var_90+8], rax loc_6514: mov rsi, [rbp+var_118] mov rdi, [rbp+var_110] call _ZNKSt7__cxx1114regex_iteratorIN9__gnu_cxx17__normal_iteratorIPKcNS_12basic_stringIcSt11char_traitsIcESaIcEEEEEcNS_12regex_traitsIcEEEeqERKSD_; std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>>::operator==(std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>> const&) test al, al jz loc_6330 loc_652F: mov rax, r13 sub rax, r15 test rax, rax jle loc_6283 xchg ax, ax loc_6540: movsx esi, byte ptr [r15] mov rdi, rbx call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc; std::string::push_back(char) add r15, 1 cmp r15, r13 jnz short loc_6540 jmp loc_6283 loc_6560: mov edx, 0Fh jmp loc_63B8 loc_6570: lea rdx, [rax+rsi-48h] mov r15, [rdx] mov r13, [rdx+8] cmp rcx, rax jz loc_6495 cmp rsi, 48h ; 'H' cmovnz rdx, rax jmp loc_6495 loc_6592: mov [rbp+var_B0], 0 jmp loc_6514 loc_65A2: cmp r12, qword ptr [rbp+var_C0+8] jz short loc_6592 sub rsp, 8 mov r8d, [rbp+var_A8] mov rcx, [rbp+var_B0] xor r9d, r9d mov rdx, [rbp+var_120] mov rsi, qword ptr [rbp+var_C0+8] push 0 or r8d, 60h call _ZNSt8__detail17__regex_algo_implIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEEcNS5_12regex_traitsIcEEEEbT_SH_RNS5_13match_resultsISH_T0_EERKNS5_11basic_regexIT1_T2_EENSt15regex_constants15match_flag_typeENS_20_RegexExecutorPolicyEb; std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>(__gnu_cxx::__normal_iterator<char const*,std::string>,__gnu_cxx::__normal_iterator<char const*,std::string>,std::match_results<__gnu_cxx::__normal_iterator<char const*,std::string>> &,std::basic_regex<char,std::regex_traits<char>> const&,std::regex_constants::match_flag_type,std::__detail::_RegexExecutorPolicy,bool) pop rsi pop rdi lea rdi, [r12+1] test al, al jz loc_64B4 jmp loc_64F3 loc_65ED: lea rax, [rax+rsi-48h] jmp loc_64A4 loc_65F7: pxor xmm0, xmm0 lea r14, [rbp+var_60] mov rdi, [rbp+var_120] mov qword ptr [rbp+var_C0], 0 movaps [rbp+var_70], xmm0 mov rsi, r14 pxor xmm0, xmm0 mov qword ptr [rbp+var_C0+8], 0 mov [rbp+var_B0], 0 mov [rbp+var_A8], 0 movaps [rbp+var_80], xmm0 movaps [rbp+var_60], xmm0 movaps [rbp+var_50], xmm0 call _ZNSt6vectorINSt7__cxx119sub_matchIN9__gnu_cxx17__normal_iteratorIPKcNS0_12basic_stringIcSt11char_traitsIcESaIcEEEEEEESaISC_EEaSERKSE__isra_0; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::operator=(std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>> const&) [clone] mov rax, qword ptr [rbp+var_50+8] mov rdi, r14 mov qword ptr [rbp+var_90+8], rax call _ZNSt6vectorINSt7__cxx119sub_matchIN9__gnu_cxx17__normal_iteratorIPKcNS0_12basic_stringIcSt11char_traitsIcESaIcEEEEEEESaISC_EED2Ev; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector() jmp loc_6217 loc_6665: mov rax, [rdi] mov r15, rdi mov qword ptr [rdi+8], 0 call qword ptr [rax+10h] mov rax, [r15] mov rdi, r15 call qword ptr [rax+18h] jmp loc_62E1 loc_6684: mov eax, 0FFFFFFFFh lock xadd [rdx], eax jmp loc_62D8 loc_6692: call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE24_M_release_last_use_coldEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(void) jmp loc_62E1 loc_669C: mov rax, [rbp+var_38] sub rax, fs:28h jnz short loc_66B5 call __ZSt16__throw_bad_castv; std::__throw_bad_cast(void) loc_66B0: call ___stack_chk_fail loc_66B5: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE_cold; func0(std::string const&) [clone] endbr64 mov r14, rax jmp loc_48B7 endbr64 mov r14, rax jmp loc_48AB endbr64 mov r12, rax jmp loc_48A0 endbr64 mov r14, rax jmp loc_48C0 endbr64 mov r15, rax jmp loc_4901
_QWORD * func0(_QWORD *a1, char **a2) { char *v3; // rax long long v4; // r13 char *v5; // r15 char *v6; // r12 char v7; // al long long v8; // rdx long long v9; // rcx long long v10; // r8 long long v11; // r9 unsigned long long v12; // rsi long long v13; // rdi volatile signed __int32 *v14; // rdx signed __int32 v15; // eax long long v17; // rax char *v18; // r15 char *v19; // r12 long long v20; // rax char v21; // r14 unsigned long long v22; // r13 long long v23; // rax unsigned long long v24; // rdx long long v25; // rax long long v26; // r8 long long v27; // r9 long long v28; // rcx _QWORD *v29; // rax long long v30; // rsi char *v31; // r15 char *v32; // r13 long long v33; // rdx long long v34; // r12 int v35; // edi int v36; // r8d char v37; // al long long v38; // rax bool v39; // zf long long v40; // rax long long v41; // [rsp-10h] [rbp-140h] long long v42; // [rsp-10h] [rbp-140h] long long v43; // [rsp-8h] [rbp-138h] _QWORD *v44; // [rsp+30h] [rbp-100h] long long v45; // [rsp+38h] [rbp-F8h] char v46[8]; // [rsp+40h] [rbp-F0h] BYREF long long v47; // [rsp+48h] [rbp-E8h] BYREF char v48[8]; // [rsp+50h] [rbp-E0h] BYREF char v49[8]; // [rsp+58h] [rbp-D8h] BYREF __int128 v50; // [rsp+60h] [rbp-D0h] __m128i v51; // [rsp+70h] [rbp-C0h] BYREF char *v52; // [rsp+80h] [rbp-B0h] int v53; // [rsp+88h] [rbp-A8h] __int128 v54; // [rsp+90h] [rbp-A0h] BYREF __int128 v55; // [rsp+A0h] [rbp-90h] __int128 v56; // [rsp+B0h] [rbp-80h] BYREF __int128 v57; // [rsp+C0h] [rbp-70h] __int128 v58; // [rsp+D0h] [rbp-60h] BYREF __int128 v59; // [rsp+E0h] [rbp-50h] unsigned long long v60; // [rsp+F8h] [rbp-38h] v60 = __readfsqword(0x28u); std::locale::locale((std::locale *)v49); v50 = 0LL; std::basic_regex<char,std::regex_traits<char>>::_M_compile(v48, "Road$", "", 16LL); *((_BYTE *)a1 + 16) = 0; *a1 = a1 + 2; v44 = a1 + 2; v3 = *a2; a1[1] = 0LL; v4 = (long long)a2[1]; v5 = v3; v52 = v48; v53 = 0; v6 = &v3[v4]; v51 = _mm_unpacklo_epi64((__m128i)(unsigned long long)v3, (__m128i)(unsigned long long)&v3[v4]); v54 = 0LL; v55 = 0LL; v7 = std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>( v51.m128i_i32[0], v51.m128i_i32[2], (unsigned int)&v54, (unsigned int)v48, 0, 0, 0); v10 = v41; v11 = v43; if ( !v7 ) { v51 = 0uLL; v57 = 0LL; v52 = 0LL; v53 = 0; v56 = 0LL; v58 = 0LL; v59 = 0LL; ((void ( *)(__int128 *, __int128 *, long long, long long, long long))std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::operator=)( &v54, &v58, v8, v9, v41); *((_QWORD *)&v55 + 1) = *((_QWORD *)&v59 + 1); std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v58); } v12 = (unsigned long long)&v56; *(_QWORD *)&v57 = 0LL; DWORD2(v57) = 0; v56 = 0LL; v58 = 0LL; v59 = 0LL; if ( (unsigned __int8)std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>>::operator==( &v51, &v56, v8, v9, v10, v11) ) { if ( v4 > 0 ) { do { v12 = (unsigned int)*v5; std::string::push_back(a1, v12); ++v5; } while ( v6 != v5 ); } goto LABEL_6; } do { v17 = *((_QWORD *)&v54 + 1) - 48LL; if ( *((_QWORD *)&v54 + 1) - (_QWORD)v54 < 0x49uLL ) v17 = *((_QWORD *)&v54 + 1) - 72LL; v18 = *(char **)(v17 + 8); v19 = *(char **)v17; if ( (long long)&v18[-*(_QWORD *)v17] > 0 ) { do { v21 = *v19; v45 = a1[1]; v22 = v45 + 1; v23 = *a1; if ( v44 == (_QWORD *)*a1 ) v24 = 15LL; else v24 = a1[2]; if ( v24 < v22 ) { std::string::_M_mutate(a1, v45, 0LL, 0LL, 1LL); v23 = *a1; } ++v19; *(_BYTE *)(v23 + v45) = v21; v20 = *a1; a1[1] = v22; *(_BYTE *)(v20 + v45 + 1) = 0; } while ( v18 != v19 ); } std::locale::locale((std::locale *)v46); std::locale::locale((std::locale *)&v47, (const std::locale *)v46); v25 = std::locale::id::_M_id((std::locale::id *)&std::ctype<char>::id); if ( !*(_QWORD *)(*(_QWORD *)(v47 + 8) + 8 * v25) ) std::__throw_bad_cast(); std::locale::~locale((std::locale *)&v47); std::string::push_back(a1, 82LL); std::string::push_back(a1, 100LL); std::string::push_back(a1, 46LL); std::locale::~locale((std::locale *)v46); v28 = *((_QWORD *)&v54 + 1); v29 = (_QWORD *)v54; v30 = *((_QWORD *)&v54 + 1) - v54; if ( *((_QWORD *)&v54 + 1) - (_QWORD)v54 <= 0x48uLL ) { v33 = *((_QWORD *)&v54 + 1) - 72LL; v31 = *(char **)(*((_QWORD *)&v54 + 1) - 72LL); v32 = *(char **)(*((_QWORD *)&v54 + 1) - 72LL + 8); if ( *((_QWORD *)&v54 + 1) != (_QWORD)v54 && v30 != 72 ) v33 = v54; } else { v31 = *(char **)(*((_QWORD *)&v54 + 1) - 24LL); v32 = *(char **)(*((_QWORD *)&v54 + 1) - 24LL + 8); v33 = *((_QWORD *)&v54 + 1) + v30 - 72; if ( *((_QWORD *)&v54 + 1) != (_QWORD)v54 ) v33 = v54; } if ( *(_BYTE *)(v33 + 16) ) { if ( *((_QWORD *)&v54 + 1) == (_QWORD)v54 ) v29 = (_QWORD *)(*((_QWORD *)&v54 + 1) - 72LL); v34 = v29[1]; v35 = v34; if ( v34 == *v29 ) { if ( v34 == v51.m128i_i64[1] ) { LABEL_41: v52 = 0LL; goto LABEL_32; } v35 = v34 + 1; if ( (unsigned __int8)std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>( v34, v51.m128i_i32[2], (unsigned int)&v54, (_DWORD)v52, v53 | 0x60u, 0, 0) ) { LABEL_31: v38 = *((_QWORD *)&v54 + 1); v39 = *(_QWORD *)(*((_QWORD *)&v54 + 1) - 40LL) == v34; *(_QWORD *)(*((_QWORD *)&v54 + 1) - 48LL) = v34; *(_BYTE *)(v38 - 32) = !v39; *((_QWORD *)&v55 + 1) = v51.m128i_i64[0]; goto LABEL_32; } } v36 = v53; LOBYTE(v36) = v53 | 0x80; v53 = v36; v37 = std::__detail::__regex_algo_impl<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,char,std::regex_traits<char>>( v35, v51.m128i_i32[2], (unsigned int)&v54, (_DWORD)v52, v36, 0, 0); v33 = v42; v28 = v43; if ( v37 ) goto LABEL_31; goto LABEL_41; } LABEL_32: v12 = (unsigned long long)&v56; } while ( !(unsigned __int8)std::regex_iterator<__gnu_cxx::__normal_iterator<char const*,std::string>,char,std::regex_traits<char>>::operator==( &v51, &v56, v33, v28, v26, v27) ); if ( v32 - v31 > 0 ) { do { v12 = (unsigned int)*v31; std::string::push_back(a1, v12); ++v31; } while ( v31 != v32 ); } LABEL_6: std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v58); std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v54); v13 = *((_QWORD *)&v50 + 1); if ( *((_QWORD *)&v50 + 1) ) { v14 = (volatile signed __int32 *)(*((_QWORD *)&v50 + 1) + 8LL); if ( *(_QWORD *)(*((_QWORD *)&v50 + 1) + 8LL) == 0x100000001LL ) { v40 = **((_QWORD **)&v50 + 1); *(_QWORD *)(*((_QWORD *)&v50 + 1) + 8LL) = 0LL; (*(void ( **)(long long, unsigned long long, volatile signed __int32 *))(v40 + 16))(v13, v12, v14); (*(void ( **)(long long))(*(_QWORD *)v13 + 24LL))(v13); } else { if ( _libc_single_threaded ) { v15 = *(_DWORD *)(*((_QWORD *)&v50 + 1) + 8LL); *(_DWORD *)(*((_QWORD *)&v50 + 1) + 8LL) = v15 - 1; } else { v15 = _InterlockedExchangeAdd(v14, 0xFFFFFFFF); } if ( v15 == 1 ) std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(v13); } } std::locale::~locale((std::locale *)v49); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R15 PUSH R14 LEA R14,[RBP + -0xe0] PUSH R13 PUSH R12 MOV R12,RSI PUSH RBX MOV RBX,RDI SUB RSP,0x108 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x38],RAX XOR EAX,EAX LEA RAX,[RBP + -0xd8] MOV qword ptr [RBP + -0x130],R14 MOV RDI,RAX MOV qword ptr [RBP + -0x128],RAX CALL 0x00104730 LEA RDX,[0x11b6b1] PXOR XMM0,XMM0 MOV RDI,R14 MOV ECX,0x10 LEA RSI,[RDX + -0x5] MOVAPS xmmword ptr [RBP + -0xd0],XMM0 LAB_0010616f: CALL 0x00119c20 LEA RAX,[RBX + 0x10] MOV byte ptr [RBX + 0x10],0x0 SUB RSP,0x8 XOR R9D,R9D MOV qword ptr [RBX],RAX MOV RCX,qword ptr [RBP + -0x130] XOR R8D,R8D MOV qword ptr [RBP + -0x100],RAX MOV RAX,qword ptr [R12] MOV qword ptr [RBX + 0x8],0x0 MOV R13,qword ptr [R12 + 0x8] MOVQ XMM0,RAX MOV R15,RAX MOV qword ptr [RBP + -0xb0],RCX MOV dword ptr [RBP + -0xa8],0x0 LEA R12,[RAX + R13*0x1] LEA RAX,[RBP + -0xa0] MOVQ XMM1,R12 MOV qword ptr [RBP + -0x120],RAX MOV RDX,RAX PUNPCKLQDQ XMM0,XMM1 MOVAPS xmmword ptr [RBP + -0xc0],XMM0 MOVQ RDI,XMM0 PXOR XMM0,XMM0 MOV RSI,qword ptr [RBP + -0xb8] MOVAPS xmmword ptr [RBP + -0xa0],XMM0 MOVAPS xmmword ptr [RBP + -0x90],XMM0 PUSH 0x0 LAB_00106206: CALL 0x00113150 POP R8 POP R9 TEST AL,AL JZ 0x001065f7 LAB_00106217: LEA RAX,[RBP + -0xc0] PXOR XMM0,XMM0 LEA RSI,[RBP + -0x80] MOV qword ptr [RBP + -0x70],0x0 MOV RDI,RAX MOV dword ptr [RBP + -0x68],0x0 MOV qword ptr [RBP + -0x118],RSI MOV qword ptr [RBP + -0x110],RAX MOVAPS xmmword ptr [RBP + -0x80],XMM0 MOVAPS xmmword ptr [RBP + -0x60],XMM0 MOVAPS xmmword ptr [RBP + -0x50],XMM0 CALL 0x00107cc0 TEST AL,AL JZ 0x00106312 TEST R13,R13 JLE 0x00106283 NOP dword ptr [RAX] LAB_00106268: MOVSX ESI,byte ptr [R15] MOV RDI,RBX MOV R14,R15 LAB_00106272: CALL 0x00104580 ADD R14,0x1 MOV R15,R14 CMP R12,R14 JNZ 0x00106268 LAB_00106283: LEA RDI,[RBP + -0x60] CALL 0x00107c90 MOV RDI,qword ptr [RBP + -0x120] CALL 0x00107c90 MOV RAX,qword ptr [RBP + -0xc8] MOV RDI,RAX TEST RAX,RAX JZ 0x001062e1 MOV RCX,qword ptr [RAX + 0x8] LEA RDX,[RAX + 0x8] MOV RAX,0x100000001 CMP RCX,RAX JZ 0x00106665 CMP byte ptr [0x00121460],0x0 JZ 0x00106684 MOV EAX,dword ptr [RDI + 0x8] LEA EDX,[RAX + -0x1] MOV dword ptr [RDI + 0x8],EDX LAB_001062d8: CMP EAX,0x1 JZ 0x00106692 LAB_001062e1: MOV RDI,qword ptr [RBP + -0x128] CALL 0x00104680 MOV RAX,qword ptr [RBP + -0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x001066b0 LEA RSP,[RBP + -0x28] MOV RAX,RBX POP RBX POP R12 POP R13 POP R14 POP R15 POP RBP RET LAB_00106312: LEA RDI,[RBP + -0xf0] XOR R13D,R13D XOR R15D,R15D MOV qword ptr [RBP + -0x108],RDI TEST AL,AL JNZ 0x0010652f NOP LAB_00106330: MOV RDX,qword ptr [RBP + -0xa0] MOV RAX,qword ptr [RBP + -0x98] SUB RAX,RDX LEA RCX,[RDX + RAX*0x1 + -0x30] CMP RAX,0x49 LEA RDX,[RDX + RAX*0x1 + -0x48] MOV RAX,RCX CMOVC RAX,RDX MOV R15,qword ptr [RAX + 0x8] MOV R12,qword ptr [RAX] MOV RAX,R15 SUB RAX,R12 TEST RAX,RAX JG 0x00106390 JMP 0x001063db LAB_00106370: MOV RCX,qword ptr [RBP + -0xf8] ADD R12,0x1 MOV byte ptr [RAX + RCX*0x1],R14B MOV RAX,qword ptr [RBX] MOV qword ptr [RBX + 0x8],R13 MOV byte ptr [RAX + RCX*0x1 + 0x1],0x0 CMP R15,R12 JZ 0x001063db LAB_00106390: MOV RAX,qword ptr [RBX + 0x8] MOVZX R14D,byte ptr [R12] MOV qword ptr [RBP + -0xf8],RAX LEA R13,[RAX + 0x1] MOV RAX,qword ptr [RBX] CMP qword ptr [RBP + -0x100],RAX JZ 0x00106560 MOV RDX,qword ptr [RBX + 0x10] LAB_001063b8: CMP RDX,R13 JNC 0x00106370 MOV RSI,qword ptr [RBP + -0xf8] XOR ECX,ECX XOR EDX,EDX MOV RDI,RBX MOV R8D,0x1 CALL 0x001046f0 MOV RAX,qword ptr [RBX] JMP 0x00106370 LAB_001063db: MOV R15,qword ptr [RBP + -0x108] MOV RDI,R15 CALL 0x00104730 LEA RAX,[RBP + -0xe8] MOV RSI,R15 MOV RDI,RAX MOV R14,RAX CALL 0x001044f0 LEA RDI,[0x121480] CALL 0x001044a0 MOV RDX,RAX MOV RAX,qword ptr [RBP + -0xe8] MOV RAX,qword ptr [RAX + 0x8] CMP qword ptr [RAX + RDX*0x8],0x0 JZ 0x0010669c MOV RDI,R14 CALL 0x00104680 MOV ESI,0x52 MOV RDI,RBX LAB_00106434: CALL 0x00104580 MOV ESI,0x64 MOV RDI,RBX CALL 0x00104580 MOV ESI,0x2e MOV RDI,RBX CALL 0x00104580 MOV RDI,qword ptr [RBP + -0x108] CALL 0x00104680 MOV RCX,qword ptr [RBP + -0x98] MOV RAX,qword ptr [RBP + -0xa0] MOV RSI,RCX SUB RSI,RAX CMP RSI,0x48 JBE 0x00106570 LEA RDX,[RAX + RSI*0x1 + -0x18] CMP RCX,RAX MOV R15,qword ptr [RDX] MOV R13,qword ptr [RDX + 0x8] LEA RDX,[RCX + RSI*0x1 + -0x48] CMOVNZ RDX,RAX LAB_00106495: CMP byte ptr [RDX + 0x10],0x0 JZ 0x00106514 CMP RCX,RAX JZ 0x001065ed LAB_001064a4: MOV R12,qword ptr [RAX + 0x8] MOV RDI,R12 CMP R12,qword ptr [RAX] JZ 0x001065a2 LAB_001064b4: MOV R8D,dword ptr [RBP + -0xa8] SUB RSP,0x8 MOV RCX,qword ptr [RBP + -0xb0] XOR R9D,R9D MOV RDX,qword ptr [RBP + -0x120] MOV RSI,qword ptr [RBP + -0xb8] OR R8B,0x80 MOV dword ptr [RBP + -0xa8],R8D PUSH 0x0 LAB_001064e4: CALL 0x00113150 POP RDX POP RCX TEST AL,AL JZ 0x00106592 LAB_001064f3: MOV RAX,qword ptr [RBP + -0x98] CMP qword ptr [RAX + -0x28],R12 MOV qword ptr [RAX + -0x30],R12 SETNZ byte ptr [RAX + -0x20] MOV RAX,qword ptr [RBP + -0xc0] MOV qword ptr [RBP + -0x88],RAX LAB_00106514: MOV RSI,qword ptr [RBP + -0x118] MOV RDI,qword ptr [RBP + -0x110] CALL 0x00107cc0 TEST AL,AL JZ 0x00106330 LAB_0010652f: MOV RAX,R13 SUB RAX,R15 TEST RAX,RAX JLE 0x00106283 NOP LAB_00106540: MOVSX ESI,byte ptr [R15] MOV RDI,RBX CALL 0x00104580 ADD R15,0x1 CMP R15,R13 JNZ 0x00106540 JMP 0x00106283 LAB_00106560: MOV EDX,0xf JMP 0x001063b8 LAB_00106570: LEA RDX,[RAX + RSI*0x1 + -0x48] MOV R15,qword ptr [RDX] MOV R13,qword ptr [RDX + 0x8] CMP RCX,RAX JZ 0x00106495 CMP RSI,0x48 CMOVNZ RDX,RAX JMP 0x00106495 LAB_00106592: MOV qword ptr [RBP + -0xb0],0x0 JMP 0x00106514 LAB_001065a2: CMP R12,qword ptr [RBP + -0xb8] JZ 0x00106592 SUB RSP,0x8 MOV R8D,dword ptr [RBP + -0xa8] MOV RCX,qword ptr [RBP + -0xb0] XOR R9D,R9D MOV RDX,qword ptr [RBP + -0x120] MOV RSI,qword ptr [RBP + -0xb8] PUSH 0x0 OR R8D,0x60 CALL 0x00113150 POP RSI POP RDI LEA RDI,[R12 + 0x1] TEST AL,AL JZ 0x001064b4 JMP 0x001064f3 LAB_001065ed: LEA RAX,[RAX + RSI*0x1 + -0x48] JMP 0x001064a4 LAB_001065f7: PXOR XMM0,XMM0 LEA R14,[RBP + -0x60] MOV RDI,qword ptr [RBP + -0x120] MOV qword ptr [RBP + -0xc0],0x0 MOVAPS xmmword ptr [RBP + -0x70],XMM0 MOV RSI,R14 PXOR XMM0,XMM0 MOV qword ptr [RBP + -0xb8],0x0 MOV qword ptr [RBP + -0xb0],0x0 MOV dword ptr [RBP + -0xa8],0x0 MOVAPS xmmword ptr [RBP + -0x80],XMM0 MOVAPS xmmword ptr [RBP + -0x60],XMM0 MOVAPS xmmword ptr [RBP + -0x50],XMM0 LAB_00106648: CALL 0x001050a0 MOV RAX,qword ptr [RBP + -0x48] MOV RDI,R14 MOV qword ptr [RBP + -0x88],RAX CALL 0x00107c90 JMP 0x00106217 LAB_00106665: MOV RAX,qword ptr [RDI] MOV R15,RDI MOV qword ptr [RDI + 0x8],0x0 CALL qword ptr [RAX + 0x10] MOV RAX,qword ptr [R15] MOV RDI,R15 CALL qword ptr [RAX + 0x18] JMP 0x001062e1 LAB_00106684: MOV EAX,0xffffffff XADD.LOCK dword ptr [RDX],EAX JMP 0x001062d8 LAB_00106692: CALL 0x00107900 JMP 0x001062e1 LAB_0010669c: MOV RAX,qword ptr [RBP + -0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x001066b5 LAB_001066ab: CALL 0x00104630 LAB_001066b0: CALL 0x001045e0 LAB_001066b5: CALL 0x001045e0
/* func0(std::string const&) */ string * func0(string *param_1) { _Sp_counted_base<(_Lock_policy)2> *p_Var1; string sVar2; string *psVar3; long lVar4; int8 uVar5; bool bVar6; char cVar7; int iVar8; int8 *puVar9; string *psVar10; long lVar11; long *plVar12; ulong uVar13; long *in_RSI; ulong uVar14; char cVar15; long lVar16; string *psVar17; long lVar18; long in_FS_OFFSET; locale local_f8 [2]; long local_f0; regex local_e8 [8]; int local_e0 [8]; int local_d8 [16]; long local_c8; long lStack_c0; regex *local_b8; uint local_b0; int local_a8 [16]; int local_98 [16]; regex_iterator local_88 [16]; int local_78 [16]; vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> local_68 [16]; int local_58 [16]; long local_40; local_78._12_4_ = SUB84(local_78._0_8_,4); local_40 = *(long *)(in_FS_OFFSET + 0x28); std::locale::locale(local_e0); local_d8 = (int [16])0x0; /* try { // try from 0010616f to 00106173 has its CatchHandler @ 001066ba */ std::regex::_M_compile(local_e8,"Road$","",0x10); param_1[0x10] = (string)0x0; *(string **)param_1 = param_1 + 0x10; lVar18 = *in_RSI; *(int8 *)(param_1 + 8) = 0; lVar16 = in_RSI[1]; local_b0 = 0; lVar11 = lVar18 + lVar16; local_a8 = (int [16])0x0; local_98 = (int [16])0x0; local_c8 = lVar18; lStack_c0 = lVar11; local_b8 = local_e8; /* try { // try from 00106206 to 0010620a has its CatchHandler @ 001066ea */ bVar6 = std::__detail:: __regex_algo_impl<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,char,std::regex_traits<char>> ((__normal_iterator)lVar18,(__normal_iterator)lVar11,(match_results *)local_a8, local_e8,0,0,false); if (!bVar6) { local_c8 = 0; local_78 = (int [16])0x0; lStack_c0 = 0; local_b8 = (regex *)0x0; local_b0 = 0; local_88[0] = (regex_iterator)0x0; local_88[1] = (regex_iterator)0x0; local_88[2] = (regex_iterator)0x0; local_88[3] = (regex_iterator)0x0; local_88[4] = (regex_iterator)0x0; local_88[5] = (regex_iterator)0x0; local_88[6] = (regex_iterator)0x0; local_88[7] = (regex_iterator)0x0; local_88[8] = (regex_iterator)0x0; local_88[9] = (regex_iterator)0x0; local_88[10] = (regex_iterator)0x0; local_88[0xb] = (regex_iterator)0x0; local_88[0xc] = (regex_iterator)0x0; local_88[0xd] = (regex_iterator)0x0; local_88[0xe] = (regex_iterator)0x0; local_88[0xf] = (regex_iterator)0x0; local_68[0] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[1] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[2] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[3] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[4] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[5] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[6] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[7] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[8] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[9] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[10] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xb] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xc] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xd] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xe] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xf] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_58 = (int [16])0x0; /* try { // try from 00106648 to 0010664c has its CatchHandler @ 001066f6 */ std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::operator=((vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> *)local_a8,(vector *)local_68); local_98._8_8_ = local_58._8_8_; std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::~vector(local_68); } local_78._0_12_ = ZEXT812(0); local_88[0] = (regex_iterator)0x0; local_88[1] = (regex_iterator)0x0; local_88[2] = (regex_iterator)0x0; local_88[3] = (regex_iterator)0x0; local_88[4] = (regex_iterator)0x0; local_88[5] = (regex_iterator)0x0; local_88[6] = (regex_iterator)0x0; local_88[7] = (regex_iterator)0x0; local_88[8] = (regex_iterator)0x0; local_88[9] = (regex_iterator)0x0; local_88[10] = (regex_iterator)0x0; local_88[0xb] = (regex_iterator)0x0; local_88[0xc] = (regex_iterator)0x0; local_88[0xd] = (regex_iterator)0x0; local_88[0xe] = (regex_iterator)0x0; local_88[0xf] = (regex_iterator)0x0; local_68[0] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[1] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[2] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[3] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[4] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[5] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[6] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[7] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[8] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[9] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[10] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xb] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xc] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xd] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xe] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_68[0xf] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_58 = (int [16])0x0; cVar7 = std:: regex_iterator<__normal_iterator<char_const*,std::string>,char,std::regex_traits<char>>:: operator==((regex_iterator<__normal_iterator<char_const*,std::string>,char,std::regex_traits<char>> *)&local_c8,local_88); cVar15 = (char)param_1; if (cVar7 == '\0') { do { lVar11 = local_a8._0_8_ + -0x30; if ((ulong)(local_a8._8_8_ - local_a8._0_8_) < 0x49) { lVar11 = local_a8._0_8_ + -0x48; } puVar9 = (int8 *)(lVar11 + (local_a8._8_8_ - local_a8._0_8_)); psVar3 = (string *)puVar9[1]; psVar17 = (string *)*puVar9; if (psVar3 != psVar17 && -1 < (long)psVar3 - (long)psVar17) { do { uVar14 = *(ulong *)(param_1 + 8); sVar2 = *psVar17; psVar10 = *(string **)param_1; if (param_1 + 0x10 == psVar10) { uVar13 = 0xf; } else { uVar13 = *(ulong *)(param_1 + 0x10); } if (uVar13 < uVar14 + 1) { std::string::_M_mutate((ulong)param_1,uVar14,(char *)0x0,0); psVar10 = *(string **)param_1; } psVar17 = psVar17 + 1; psVar10[uVar14] = sVar2; *(ulong *)(param_1 + 8) = uVar14 + 1; *(int *)(*(long *)param_1 + 1 + uVar14) = 0; } while (psVar3 != psVar17); } std::locale::locale(local_f8); std::locale::locale(&local_f0,local_f8); lVar11 = std::locale::id::_M_id(); if (*(long *)(*(long *)(local_f0 + 8) + lVar11 * 8) == 0) { if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ /* try { // try from 001066ab to 001066af has its CatchHandler @ 001066de */ std::__throw_bad_cast(); } /* WARNING: Subroutine does not return */ __stack_chk_fail(); } std::locale::~locale(&local_f0); /* try { // try from 00106434 to 00106452 has its CatchHandler @ 001066d2 */ std::string::push_back(cVar15); std::string::push_back(cVar15); std::string::push_back(cVar15); std::locale::~locale(local_f8); uVar14 = local_a8._8_8_ - local_a8._0_8_; if (uVar14 < 0x49) { plVar12 = (long *)(local_a8._0_8_ + (uVar14 - 0x48)); lVar11 = *plVar12; lVar18 = plVar12[1]; if ((local_a8._8_8_ != local_a8._0_8_) && (uVar14 != 0x48)) { plVar12 = (long *)local_a8._0_8_; } } else { plVar12 = (long *)(local_a8._0_8_ + (uVar14 - 0x18)); lVar11 = *plVar12; lVar18 = plVar12[1]; plVar12 = (long *)(local_a8._8_8_ + (uVar14 - 0x48)); if (local_a8._8_8_ != local_a8._0_8_) { plVar12 = (long *)local_a8._0_8_; } } if (*(char *)(plVar12 + 2) != '\0') { plVar12 = (long *)local_a8._0_8_; if (local_a8._8_8_ == local_a8._0_8_) { plVar12 = (long *)(local_a8._0_8_ + (uVar14 - 0x48)); } lVar4 = plVar12[1]; lVar16 = lVar4; if (lVar4 == *plVar12) { if (lVar4 == lStack_c0) goto LAB_00106592; bVar6 = std::__detail:: __regex_algo_impl<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,char,std::regex_traits<char>> ((__normal_iterator)lVar4,(__normal_iterator)lStack_c0, (match_results *)local_a8,local_b8,local_b0 | 0x60,0,false); lVar16 = lVar4 + 1; if (!bVar6) goto LAB_001064b4; } else { LAB_001064b4: local_b0 = local_b0 | 0x80; /* try { // try from 001064e4 to 001065d8 has its CatchHandler @ 001066c6 */ bVar6 = std::__detail:: __regex_algo_impl<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,char,std::regex_traits<char>> ((__normal_iterator)lVar16,(__normal_iterator)lStack_c0, (match_results *)local_a8,local_b8,local_b0,0,false); if (!bVar6) { LAB_00106592: local_b8 = (regex *)0x0; goto LAB_00106514; } } *(long *)(local_a8._8_8_ + -0x30) = lVar4; *(bool *)(local_a8._8_8_ + -0x20) = *(long *)(local_a8._8_8_ + -0x28) != lVar4; local_98._8_8_ = local_c8; } LAB_00106514: cVar7 = std:: regex_iterator<__normal_iterator<char_const*,std::string>,char,std::regex_traits<char>> ::operator==((regex_iterator<__normal_iterator<char_const*,std::string>,char,std::regex_traits<char>> *)&local_c8,local_88); } while (cVar7 == '\0'); if (lVar18 != lVar11 && -1 < lVar18 - lVar11) { do { std::string::push_back(cVar15); lVar11 = lVar11 + 1; } while (lVar11 != lVar18); } } else if (0 < lVar16) { do { /* try { // try from 00106272 to 001063d5 has its CatchHandler @ 001066c6 */ std::string::push_back(cVar15); lVar18 = lVar18 + 1; } while (lVar11 != lVar18); } std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::~vector(local_68); std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::~vector((vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> *)local_a8); uVar5 = local_d8._8_8_; if ((_Sp_counted_base<(_Lock_policy)2> *)local_d8._8_8_ != (_Sp_counted_base<(_Lock_policy)2> *)0x0) { p_Var1 = (_Sp_counted_base<(_Lock_policy)2> *)(local_d8._8_8_ + 8); if (*(long *)(local_d8._8_8_ + 8) == 0x100000001) { *(int8 *)(local_d8._8_8_ + 8) = 0; (**(code **)(*(long *)local_d8._8_8_ + 0x10))(); (**(code **)(*(long *)uVar5 + 0x18))(uVar5); } else { if (__libc_single_threaded == '\0') { LOCK(); iVar8 = *(int *)p_Var1; *(int *)p_Var1 = *(int *)p_Var1 + -1; UNLOCK(); } else { iVar8 = *(int *)(local_d8._8_8_ + 8); *(int *)(local_d8._8_8_ + 8) = iVar8 + -1; } if (iVar8 == 1) { std::_Sp_counted_base<(_Lock_policy)2>::_M_release_last_use_cold ((_Sp_counted_base<(_Lock_policy)2> *)local_d8._8_8_); } } } std::locale::~locale(local_e0); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,248
func0
#include <string> #include <cassert>
int func0(std::string str1) { int count = 0; for (char ch : str1) { count += 1; } return count; }
int main() { assert(func0("python") == 6); assert(func0("program") == 7); assert(func0("language") == 8); return 0; }
O0
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >): endbr64 push %rbp mov %rsp,%rbp sub $0x40,%rsp mov %rdi,-0x38(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax movl $0x0,-0x24(%rbp) mov -0x38(%rbp),%rax mov %rax,-0x10(%rbp) mov -0x10(%rbp),%rax mov %rax,%rdi callq 1230 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5beginEv@plt> mov %rax,-0x20(%rbp) mov -0x10(%rbp),%rax mov %rax,%rdi callq 11c0 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE3endEv@plt> mov %rax,-0x18(%rbp) lea -0x18(%rbp),%rdx lea -0x20(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 176b <_ZN9__gnu_cxxneIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEbRKNS_17__normal_iteratorIT_T0_EESD_> test %al,%al je 1472 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x89> lea -0x20(%rbp),%rax mov %rax,%rdi callq 17d0 <_ZNK9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEdeEv> movzbl (%rax),%eax mov %al,-0x25(%rbp) addl $0x1,-0x24(%rbp) lea -0x20(%rbp),%rax mov %rax,%rdi callq 17ac <_ZN9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEppEv> jmp 1437 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x4e> mov -0x24(%rbp),%eax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 1489 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xa0> callq 1280 <__stack_chk_fail@plt> leaveq retq
_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_38], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov [rbp+var_24], 0 mov rax, [rbp+var_38] mov [rbp+var_10], rax mov rax, [rbp+var_10] mov rdi, rax call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5beginEv; std::string::begin(void) mov [rbp+var_20], rax mov rax, [rbp+var_10] mov rdi, rax call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE3endEv; std::string::end(void) mov [rbp+var_18], rax jmp short loc_13BB loc_1399: lea rax, [rbp+var_20] mov rdi, rax call _ZNK9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEdeEv; __gnu_cxx::__normal_iterator<char *,std::string>::operator*(void) movzx eax, byte ptr [rax] mov [rbp+var_25], al add [rbp+var_24], 1 lea rax, [rbp+var_20] mov rdi, rax call _ZN9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEppEv; __gnu_cxx::__normal_iterator<char *,std::string>::operator++(void) loc_13BB: lea rdx, [rbp+var_18] lea rax, [rbp+var_20] mov rsi, rdx mov rdi, rax call _ZN9__gnu_cxxneIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEbRKNS_17__normal_iteratorIT_T0_EESD_; __gnu_cxx::operator!=<char *,std::string>(__gnu_cxx::__normal_iterator<char *,std::string> const&,__gnu_cxx::__normal_iterator<char *,std::string> const&) test al, al jnz short loc_1399 mov eax, [rbp+var_24] mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_13E9 call ___stack_chk_fail locret_13E9: leave retn
long long func0(long long a1) { unsigned int v2; // [rsp+1Ch] [rbp-24h] long long v3; // [rsp+20h] [rbp-20h] BYREF _QWORD v4[3]; // [rsp+28h] [rbp-18h] BYREF v4[2] = __readfsqword(0x28u); v2 = 0; v4[1] = a1; v3 = std::string::begin(a1); v4[0] = std::string::end(a1); while ( (unsigned __int8)__gnu_cxx::operator!=<char *,std::string>(&v3, v4) ) { __gnu_cxx::__normal_iterator<char *,std::string>::operator*(&v3); ++v2; __gnu_cxx::__normal_iterator<char *,std::string>::operator++(&v3); } return v2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x38],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX MOV dword ptr [RBP + -0x24],0x0 MOV RAX,qword ptr [RBP + -0x38] MOV qword ptr [RBP + -0x10],RAX MOV RAX,qword ptr [RBP + -0x10] MOV RDI,RAX CALL 0x001011d0 MOV qword ptr [RBP + -0x20],RAX MOV RAX,qword ptr [RBP + -0x10] MOV RDI,RAX CALL 0x00101160 MOV qword ptr [RBP + -0x18],RAX JMP 0x001013bb LAB_00101399: LEA RAX,[RBP + -0x20] MOV RDI,RAX CALL 0x0010176a MOVZX EAX,byte ptr [RAX] MOV byte ptr [RBP + -0x25],AL ADD dword ptr [RBP + -0x24],0x1 LEA RAX,[RBP + -0x20] MOV RDI,RAX CALL 0x00101746 LAB_001013bb: LEA RDX,[RBP + -0x18] LEA RAX,[RBP + -0x20] MOV RSI,RDX MOV RDI,RAX CALL 0x00101706 TEST AL,AL JNZ 0x00101399 MOV EAX,dword ptr [RBP + -0x24] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001013e9 CALL 0x00101210 LAB_001013e9: LEAVE RET
/* func0(std::string) */ int func0(int8 param_1) { bool bVar1; long in_FS_OFFSET; int local_2c; int8 local_28; int8 local_20; int8 local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_2c = 0; local_18 = param_1; local_28 = std::string::begin(); local_20 = std::string::end(); while( true ) { bVar1 = operator!=((__normal_iterator *)&local_28,(__normal_iterator *)&local_20); if (!bVar1) break; __normal_iterator<char*,std::string>::operator* ((__normal_iterator<char*,std::string> *)&local_28); local_2c = local_2c + 1; __normal_iterator<char*,std::string>::operator++ ((__normal_iterator<char*,std::string> *)&local_28); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_2c; }
3,249
func0
#include <string> #include <cassert>
int func0(std::string str1) { int count = 0; for (char ch : str1) { count += 1; } return count; }
int main() { assert(func0("python") == 6); assert(func0("program") == 7); assert(func0("language") == 8); return 0; }
O1
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >): endbr64 mov (%rdi),%rdx mov 0x8(%rdi),%rax lea (%rdx,%rax,1),%rcx cmp %rcx,%rdx je 120c <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x23> mov %eax,%ecx mov $0x0,%edx add $0x1,%edx cmp %ecx,%edx jne 1204 <_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1b> retq mov $0x0,%eax retq
_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 mov rdx, [rdi] mov rax, [rdi+8] lea rcx, [rdx+rax] cmp rdx, rcx jz short loc_122C mov ecx, eax mov edx, 0 loc_1224: add edx, 1 cmp edx, ecx jnz short loc_1224 retn loc_122C: mov eax, 0 retn
long long func0(_QWORD *a1) { long long result; // rax int v2; // edx result = a1[1]; if ( *a1 == *a1 + result ) return 0LL; v2 = 0; do ++v2; while ( v2 != (_DWORD)result ); return result; }
func0: ENDBR64 MOV RDX,qword ptr [RDI] MOV RAX,qword ptr [RDI + 0x8] LEA RCX,[RDX + RAX*0x1] CMP RDX,RCX JZ 0x0010122c MOV ECX,EAX MOV EDX,0x0 LAB_00101224: ADD EDX,0x1 CMP EDX,ECX JNZ 0x00101224 RET LAB_0010122c: MOV EAX,0x0 RET
/* func0(std::string) */ long func0(long *param_1) { long lVar1; int iVar2; lVar1 = param_1[1]; if (*param_1 != *param_1 + lVar1) { iVar2 = 0; do { iVar2 = iVar2 + 1; } while (iVar2 != (int)lVar1); return lVar1; } return 0; }
3,250
func0
#include <string> #include <cassert>
int func0(std::string str1) { int count = 0; for (char ch : str1) { count += 1; } return count; }
int main() { assert(func0("python") == 6); assert(func0("program") == 7); assert(func0("language") == 8); return 0; }
O2
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >): endbr64 mov (%rdi),%rdx mov 0x8(%rdi),%rax lea (%rdx,%rax,1),%rcx cmp %rcx,%rdx mov $0x0,%edx cmove %edx,%eax retq nopl 0x0(%rax,%rax,1)
_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 mov rdx, [rdi+8] test rdx, rdx mov eax, edx mov edx, 0 cmovz eax, edx retn
long long func0(long long a1) { long long result; // rax result = (unsigned int)*(_QWORD *)(a1 + 8); if ( !*(_QWORD *)(a1 + 8) ) return 0LL; return result; }
func0: ENDBR64 MOV RDX,qword ptr [RDI + 0x8] TEST RDX,RDX MOV EAX,EDX MOV EDX,0x0 CMOVZ EAX,EDX RET
/* func0(std::string) */ ulong func0(long param_1) { ulong uVar1; uVar1 = *(ulong *)(param_1 + 8) & 0xffffffff; if (*(ulong *)(param_1 + 8) == 0) { uVar1 = 0; } return uVar1; }
3,251
func0
#include <string> #include <cassert>
int func0(std::string str1) { int count = 0; for (char ch : str1) { count += 1; } return count; }
int main() { assert(func0("python") == 6); assert(func0("program") == 7); assert(func0("language") == 8); return 0; }
O3
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >): endbr64 mov (%rdi),%rdx mov 0x8(%rdi),%rax lea (%rdx,%rax,1),%rcx cmp %rcx,%rdx mov $0x0,%edx cmove %edx,%eax retq nopl 0x0(%rax,%rax,1)
_Z5func0NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 mov rdx, [rdi+8] test rdx, rdx mov eax, edx mov edx, 0 cmovz eax, edx retn
long long func0(long long a1) { long long result; // rax result = (unsigned int)*(_QWORD *)(a1 + 8); if ( !*(_QWORD *)(a1 + 8) ) return 0LL; return result; }
func0: ENDBR64 MOV RDX,qword ptr [RDI + 0x8] TEST RDX,RDX MOV EAX,EDX MOV EDX,0x0 CMOVZ EAX,EDX RET
/* func0(std::string) */ ulong func0(long param_1) { ulong uVar1; uVar1 = *(ulong *)(param_1 + 8) & 0xffffffff; if (*(ulong *)(param_1 + 8) == 0) { uVar1 = 0; } return uVar1; }
3,252
func0
#include <cassert>
double func0(double p, double q) { double area = (p * q) / 2; return area; }
int main() { assert(func0(10, 20) == 100); assert(func0(10, 5) == 25); assert(func0(4, 2) == 4); return 0; }
O0
cpp
func0(double, double): endbr64 push %rbp mov %rsp,%rbp movsd %xmm0,-0x18(%rbp) movsd %xmm1,-0x20(%rbp) movsd -0x18(%rbp),%xmm0 mulsd -0x20(%rbp),%xmm0 movsd 0xf2b(%rip),%xmm1 divsd %xmm1,%xmm0 movsd %xmm0,-0x8(%rbp) movsd -0x8(%rbp),%xmm0 pop %rbp retq
_Z5func0dd: endbr64 push rbp mov rbp, rsp movsd [rbp+var_18], xmm0 movsd [rbp+var_20], xmm1 movsd xmm0, [rbp+var_18] mulsd xmm0, [rbp+var_20] movsd xmm1, cs:dbl_2078 divsd xmm0, xmm1 movsd [rbp+var_8], xmm0 movsd xmm0, [rbp+var_8] pop rbp retn
double func0(double a1, double a2) { return a1 * a2 / 2.0; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOVSD qword ptr [RBP + -0x18],XMM0 MOVSD qword ptr [RBP + -0x20],XMM1 MOVSD XMM0,qword ptr [RBP + -0x18] MULSD XMM0,qword ptr [RBP + -0x20] MOVSD XMM1,qword ptr [0x00102078] DIVSD XMM0,XMM1 MOVSD qword ptr [RBP + -0x8],XMM0 MOVSD XMM0,qword ptr [RBP + -0x8] POP RBP RET
/* func0(double, double) */ double func0(double param_1,double param_2) { return (param_1 * param_2) / DAT_00102078; }
3,253
func0
#include <cassert>
double func0(double p, double q) { double area = (p * q) / 2; return area; }
int main() { assert(func0(10, 20) == 100); assert(func0(10, 5) == 25); assert(func0(4, 2) == 4); return 0; }
O1
cpp
func0(double, double): endbr64 mulsd %xmm1,%xmm0 mulsd 0xecf(%rip),%xmm0 retq
_Z5func0dd: endbr64 mulsd xmm0, xmm1 mulsd xmm0, cs:qword_2008 retn
double func0(double a1, double a2) { return a1 * a2 * 0.5; }
func0: ENDBR64 MULSD XMM0,XMM1 MULSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ /* func0(double, double) */ double func0(double param_1,double param_2) { return param_1 * param_2 * _DAT_00102008; }
3,254
func0
#include <cassert>
double func0(double p, double q) { double area = (p * q) / 2; return area; }
int main() { assert(func0(10, 20) == 100); assert(func0(10, 5) == 25); assert(func0(4, 2) == 4); return 0; }
O2
cpp
func0(double, double): endbr64 mulsd %xmm1,%xmm0 mulsd 0xeb8(%rip),%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
_Z5func0dd: endbr64 mulsd xmm0, xmm1 mulsd xmm0, cs:qword_2008 retn
double func0(double a1, double a2) { return a1 * a2 * 0.5; }
func0: ENDBR64 MULSD XMM0,XMM1 MULSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ /* func0(double, double) */ double func0(double param_1,double param_2) { return param_1 * param_2 * _DAT_00102008; }
3,255
func0
#include <cassert>
double func0(double p, double q) { double area = (p * q) / 2; return area; }
int main() { assert(func0(10, 20) == 100); assert(func0(10, 5) == 25); assert(func0(4, 2) == 4); return 0; }
O3
cpp
func0(double, double): endbr64 mulsd %xmm1,%xmm0 mulsd 0xeb8(%rip),%xmm0 retq nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
_Z5func0dd: endbr64 mulsd xmm0, xmm1 mulsd xmm0, cs:qword_2008 retn
double func0(double a1, double a2) { return a1 * a2 * 0.5; }
func0: ENDBR64 MULSD XMM0,XMM1 MULSD XMM0,qword ptr [0x00102008] RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ /* func0(double, double) */ double func0(double param_1,double param_2) { return param_1 * param_2 * _DAT_00102008; }
3,256
func0
#include <iostream> #include <vector> #include <assert.h>
std::vector<int> func0(std::vector<int> arr, int n) { int low = 0; int mid = 0; int high = n - 1; while (mid <= high) { if (arr[mid] == 0) { std::swap(arr[low], arr[mid]); low++; mid++; } else if (arr[mid] == 1) { mid++; } else { std::swap(arr[mid], arr[high]); high--; } } return arr; }
int main() { std::vector<int> result1 = func0({1,2,0,1,0,1,2,1,1}, 9); std::vector<int> expected1 = {0, 0, 1, 1, 1, 1, 1, 2, 2}; assert(result1 == expected1); std::vector<int> result2 = func0({1,0,0,1,2,1,2,2,1,0}, 10); std::vector<int> expected2 = {0, 0, 0, 1, 1, 1, 1, 2, 2, 2}; assert(result2 == expected2); std::vector<int> result3 = func0({2,2,1,0,0,0,1,1,2,1}, 10); std::vector<int> expected3 = {0, 0, 0, 1, 1, 1, 1, 2, 2, 2}; assert(result3 == expected3); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> >, int): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x38,%rsp mov %rdi,-0x28(%rbp) mov %rsi,-0x30(%rbp) mov %edx,-0x34(%rbp) movl $0x0,-0x1c(%rbp) movl $0x0,-0x18(%rbp) mov -0x34(%rbp),%eax sub $0x1,%eax mov %eax,-0x14(%rbp) mov -0x18(%rbp),%eax cmp -0x14(%rbp),%eax jg 1391 <_Z5func0St6vectorIiSaIiEEi+0x108> mov -0x18(%rbp),%eax movslq %eax,%rdx mov -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1b32 <_ZNSt6vectorIiSaIiEEixEm> mov (%rax),%eax test %eax,%eax sete %al test %al,%al je 1326 <_Z5func0St6vectorIiSaIiEEi+0x9d> mov -0x18(%rbp),%eax movslq %eax,%rdx mov -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1b32 <_ZNSt6vectorIiSaIiEEixEm> mov %rax,%rbx mov -0x1c(%rbp),%eax movslq %eax,%rdx mov -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1b32 <_ZNSt6vectorIiSaIiEEixEm> mov %rbx,%rsi mov %rax,%rdi callq 1b68 <_ZSt4swapIiENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS4_ESt18is_move_assignableIS4_EEE5valueEvE4typeERS4_SE_> addl $0x1,-0x1c(%rbp) addl $0x1,-0x18(%rbp) jmp 12b8 <_Z5func0St6vectorIiSaIiEEi+0x2f> mov -0x18(%rbp),%eax movslq %eax,%rdx mov -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1b32 <_ZNSt6vectorIiSaIiEEixEm> mov (%rax),%eax cmp $0x1,%eax sete %al test %al,%al je 1350 <_Z5func0St6vectorIiSaIiEEi+0xc7> addl $0x1,-0x18(%rbp) jmpq 12b8 <_Z5func0St6vectorIiSaIiEEi+0x2f> mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1b32 <_ZNSt6vectorIiSaIiEEixEm> mov %rax,%rbx mov -0x18(%rbp),%eax movslq %eax,%rdx mov -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1b32 <_ZNSt6vectorIiSaIiEEixEm> mov %rbx,%rsi mov %rax,%rdi callq 1b68 <_ZSt4swapIiENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS4_ESt18is_move_assignableIS4_EEE5valueEvE4typeERS4_SE_> subl $0x1,-0x14(%rbp) jmpq 12b8 <_Z5func0St6vectorIiSaIiEEi+0x2f> mov -0x30(%rbp),%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1b08 <_ZNSt6vectorIiSaIiEEC1EOS1_> mov -0x28(%rbp),%rax add $0x38,%rsp pop %rbx pop %rbp retq
_Z5func0St6vectorIiSaIiEEi: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 38h mov [rbp+var_28], rdi mov [rbp+var_30], rsi mov [rbp+var_34], edx mov [rbp+var_1C], 0 mov [rbp+var_18], 0 mov eax, [rbp+var_34] sub eax, 1 mov [rbp+var_14], eax jmp loc_1362 loc_129D: mov eax, [rbp+var_18] movsxd rdx, eax mov rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] test eax, eax setz al test al, al jz short loc_12FF mov eax, [rbp+var_18] movsxd rdx, eax mov rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov rbx, rax mov eax, [rbp+var_1C] movsxd rdx, eax mov rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov rsi, rbx mov rdi, rax call _ZSt4swapIiENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS4_ESt18is_move_assignableIS4_EEE5valueEvE4typeERS4_SE_; std::swap<int>(int&,int&) add [rbp+var_1C], 1 add [rbp+var_18], 1 jmp short loc_1362 loc_12FF: mov eax, [rbp+var_18] movsxd rdx, eax mov rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] cmp eax, 1 setz al test al, al jz short loc_1326 add [rbp+var_18], 1 jmp short loc_1362 loc_1326: mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov rbx, rax mov eax, [rbp+var_18] movsxd rdx, eax mov rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov rsi, rbx mov rdi, rax call _ZSt4swapIiENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS4_ESt18is_move_assignableIS4_EEE5valueEvE4typeERS4_SE_; std::swap<int>(int&,int&) sub [rbp+var_14], 1 loc_1362: mov eax, [rbp+var_18] cmp eax, [rbp+var_14] jle loc_129D mov rdx, [rbp+var_30] mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEC2EOS1_; std::vector<int>::vector(std::vector<int>&&) mov rax, [rbp+var_28] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, long long a2, int a3) { long long v3; // rbx long long v4; // rax long long v5; // rbx long long v6; // rax int v8; // [rsp+24h] [rbp-1Ch] int v9; // [rsp+28h] [rbp-18h] int v10; // [rsp+2Ch] [rbp-14h] v8 = 0; v9 = 0; v10 = a3 - 1; while ( v9 <= v10 ) { if ( *(_DWORD *)std::vector<int>::operator[](a2, v9) ) { if ( *(_DWORD *)std::vector<int>::operator[](a2, v9) == 1 ) { ++v9; } else { v5 = std::vector<int>::operator[](a2, v10); v6 = std::vector<int>::operator[](a2, v9); std::swap<int>(v6, v5); --v10; } } else { v3 = std::vector<int>::operator[](a2, v9); v4 = std::vector<int>::operator[](a2, v8); std::swap<int>(v4, v3); ++v8; ++v9; } } std::vector<int>::vector(a1, a2); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x38 MOV qword ptr [RBP + -0x28],RDI MOV qword ptr [RBP + -0x30],RSI MOV dword ptr [RBP + -0x34],EDX MOV dword ptr [RBP + -0x1c],0x0 MOV dword ptr [RBP + -0x18],0x0 MOV EAX,dword ptr [RBP + -0x34] SUB EAX,0x1 MOV dword ptr [RBP + -0x14],EAX JMP 0x00101362 LAB_0010129d: MOV EAX,dword ptr [RBP + -0x18] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00101aea MOV EAX,dword ptr [RAX] TEST EAX,EAX SETZ AL TEST AL,AL JZ 0x001012ff MOV EAX,dword ptr [RBP + -0x18] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00101aea MOV RBX,RAX MOV EAX,dword ptr [RBP + -0x1c] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00101aea MOV RSI,RBX MOV RDI,RAX CALL 0x00101b0e ADD dword ptr [RBP + -0x1c],0x1 ADD dword ptr [RBP + -0x18],0x1 JMP 0x00101362 LAB_001012ff: MOV EAX,dword ptr [RBP + -0x18] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00101aea MOV EAX,dword ptr [RAX] CMP EAX,0x1 SETZ AL TEST AL,AL JZ 0x00101326 ADD dword ptr [RBP + -0x18],0x1 JMP 0x00101362 LAB_00101326: MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00101aea MOV RBX,RAX MOV EAX,dword ptr [RBP + -0x18] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00101aea MOV RSI,RBX MOV RDI,RAX CALL 0x00101b0e SUB dword ptr [RBP + -0x14],0x1 LAB_00101362: MOV EAX,dword ptr [RBP + -0x18] CMP EAX,dword ptr [RBP + -0x14] JLE 0x0010129d MOV RDX,qword ptr [RBP + -0x30] MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x00101ac0 MOV RAX,qword ptr [RBP + -0x28] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::vector<int, std::allocator<int> >, int) */ vector<int,std::allocator<int>> * func0(vector param_1,int param_2) { int *piVar1; int *piVar2; int in_EDX; int4 in_register_00000034; vector<int,std::allocator<int>> *this; int4 in_register_0000003c; int4 local_24; int4 local_20; int4 local_1c; this = (vector<int,std::allocator<int>> *)CONCAT44(in_register_00000034,param_2); local_24 = 0; local_20 = 0; local_1c = in_EDX + -1; while (local_20 <= local_1c) { piVar1 = (int *)std::vector<int,std::allocator<int>>::operator[](this,(long)local_20); if (*piVar1 == 0) { piVar1 = (int *)std::vector<int,std::allocator<int>>::operator[](this,(long)local_20); piVar2 = (int *)std::vector<int,std::allocator<int>>::operator[](this,(long)local_24); std::swap<int>(piVar2,piVar1); local_24 = local_24 + 1; local_20 = local_20 + 1; } else { piVar1 = (int *)std::vector<int,std::allocator<int>>::operator[](this,(long)local_20); if (*piVar1 == 1) { local_20 = local_20 + 1; } else { piVar1 = (int *)std::vector<int,std::allocator<int>>::operator[](this,(long)local_1c); piVar2 = (int *)std::vector<int,std::allocator<int>>::operator[](this,(long)local_20); std::swap<int>(piVar2,piVar1); local_1c = local_1c + -1; } } } std::vector<int,std::allocator<int>>::vector ((vector<int,std::allocator<int>> *)CONCAT44(in_register_0000003c,param_1), (vector *)this); return (vector<int,std::allocator<int>> *)CONCAT44(in_register_0000003c,param_1); }
3,257
func0
#include <iostream> #include <vector> #include <assert.h>
std::vector<int> func0(std::vector<int> arr, int n) { int low = 0; int mid = 0; int high = n - 1; while (mid <= high) { if (arr[mid] == 0) { std::swap(arr[low], arr[mid]); low++; mid++; } else if (arr[mid] == 1) { mid++; } else { std::swap(arr[mid], arr[high]); high--; } } return arr; }
int main() { std::vector<int> result1 = func0({1,2,0,1,0,1,2,1,1}, 9); std::vector<int> expected1 = {0, 0, 1, 1, 1, 1, 1, 2, 2}; assert(result1 == expected1); std::vector<int> result2 = func0({1,0,0,1,2,1,2,2,1,0}, 10); std::vector<int> expected2 = {0, 0, 0, 1, 1, 1, 1, 2, 2, 2}; assert(result2 == expected2); std::vector<int> result3 = func0({2,2,1,0,0,0,1,1,2,1}, 10); std::vector<int> expected3 = {0, 0, 0, 1, 1, 1, 1, 2, 2, 2}; assert(result3 == expected3); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> >, int): endbr64 push %rbx sub $0x1,%edx js 12d0 <_Z5func0St6vectorIiSaIiEEi+0x67> mov (%rsi),%r10 mov $0x0,%ecx mov $0x0,%r11d jmp 129f <_Z5func0St6vectorIiSaIiEEi+0x36> cmp $0x1,%r8d je 12cb <_Z5func0St6vectorIiSaIiEEi+0x62> movslq %edx,%rax lea (%r10,%rax,4),%rax mov (%rax),%ebx mov %ebx,(%r9) mov %r8d,(%rax) sub $0x1,%edx cmp %edx,%ecx jg 12d0 <_Z5func0St6vectorIiSaIiEEi+0x67> movslq %ecx,%r8 lea (%r10,%r8,4),%r9 mov (%r9),%r8d test %r8d,%r8d jne 1283 <_Z5func0St6vectorIiSaIiEEi+0x1a> movslq %r11d,%r8 lea (%r10,%r8,4),%r8 mov (%r8),%eax movl $0x0,(%r8) mov %eax,(%r9) add $0x1,%r11d add $0x1,%ecx jmp 129b <_Z5func0St6vectorIiSaIiEEi+0x32> add $0x1,%ecx jmp 129b <_Z5func0St6vectorIiSaIiEEi+0x32> mov (%rsi),%rax mov %rax,(%rdi) mov 0x8(%rsi),%rax mov %rax,0x8(%rdi) mov 0x10(%rsi),%rax mov %rax,0x10(%rdi) movq $0x0,0x10(%rsi) movq $0x0,0x8(%rsi) movq $0x0,(%rsi) mov %rdi,%rax pop %rbx retq
_Z5func0St6vectorIiSaIiEEi: endbr64 mov r10, rdi mov r8, rsi sub edx, 1 js short loc_128F mov eax, 0 mov r9d, 0 jmp short loc_1260 loc_1245: cmp ecx, 1 jz short loc_128A movsxd r11, edx lea rdi, [rdi+r11*4] mov r11d, [rdi] mov [rsi], r11d mov [rdi], ecx sub edx, 1 loc_125C: cmp edx, eax jl short loc_128F loc_1260: mov rdi, [r8] movsxd rcx, eax lea rsi, [rdi+rcx*4] mov ecx, [rsi] test ecx, ecx jnz short loc_1245 movsxd rcx, r9d lea rcx, [rdi+rcx*4] mov edi, [rcx] mov dword ptr [rcx], 0 mov [rsi], edi add r9d, 1 add eax, 1 jmp short loc_125C loc_128A: add eax, 1 jmp short loc_125C loc_128F: mov rax, [r8] mov [r10], rax mov rax, [r8+8] mov [r10+8], rax mov rax, [r8+10h] mov [r10+10h], rax mov qword ptr [r8+10h], 0 mov qword ptr [r8+8], 0 mov qword ptr [r8], 0 mov rax, r10 retn
long long * func0(long long *a1, long long *a2, int a3) { int v5; // edx int v6; // eax int v7; // r9d int *v8; // rdi long long v9; // rdi int *v10; // rsi int v11; // ecx int *v12; // rcx int v13; // edi v5 = a3 - 1; if ( v5 >= 0 ) { v6 = 0; v7 = 0; do { v9 = *a2; v10 = (int *)(*a2 + 4LL * v6); v11 = *v10; if ( *v10 ) { if ( v11 == 1 ) { ++v6; } else { v8 = (int *)(v9 + 4LL * v5); *v10 = *v8; *v8 = v11; --v5; } } else { v12 = (int *)(v9 + 4LL * v7); v13 = *v12; *v12 = 0; *v10 = v13; ++v7; ++v6; } } while ( v5 >= v6 ); } *a1 = *a2; a1[1] = a2[1]; a1[2] = a2[2]; a2[2] = 0LL; a2[1] = 0LL; *a2 = 0LL; return a1; }
func0: ENDBR64 MOV R10,RDI MOV R8,RSI SUB EDX,0x1 JS 0x0010128f MOV EAX,0x0 MOV R9D,0x0 JMP 0x00101260 LAB_00101245: CMP ECX,0x1 JZ 0x0010128a MOVSXD R11,EDX LEA RDI,[RDI + R11*0x4] MOV R11D,dword ptr [RDI] MOV dword ptr [RSI],R11D MOV dword ptr [RDI],ECX SUB EDX,0x1 LAB_0010125c: CMP EDX,EAX JL 0x0010128f LAB_00101260: MOV RDI,qword ptr [R8] MOVSXD RCX,EAX LEA RSI,[RDI + RCX*0x4] MOV ECX,dword ptr [RSI] TEST ECX,ECX JNZ 0x00101245 MOVSXD RCX,R9D LEA RCX,[RDI + RCX*0x4] MOV EDI,dword ptr [RCX] MOV dword ptr [RCX],0x0 MOV dword ptr [RSI],EDI ADD R9D,0x1 ADD EAX,0x1 JMP 0x0010125c LAB_0010128a: ADD EAX,0x1 JMP 0x0010125c LAB_0010128f: MOV RAX,qword ptr [R8] MOV qword ptr [R10],RAX MOV RAX,qword ptr [R8 + 0x8] MOV qword ptr [R10 + 0x8],RAX MOV RAX,qword ptr [R8 + 0x10] MOV qword ptr [R10 + 0x10],RAX MOV qword ptr [R8 + 0x10],0x0 MOV qword ptr [R8 + 0x8],0x0 MOV qword ptr [R8],0x0 MOV RAX,R10 RET
/* func0(std::vector<int, std::allocator<int> >, int) */ long * func0(vector param_1,int param_2) { int *piVar1; int *piVar2; int iVar3; long lVar4; int iVar5; int in_EDX; int iVar6; int4 in_register_00000034; long *plVar7; int4 in_register_0000003c; long *plVar8; int iVar9; plVar8 = (long *)CONCAT44(in_register_0000003c,param_1); plVar7 = (long *)CONCAT44(in_register_00000034,param_2); iVar6 = in_EDX + -1; if (-1 < iVar6) { iVar5 = 0; iVar9 = 0; do { lVar4 = *plVar7; piVar1 = (int *)(lVar4 + (long)iVar5 * 4); iVar3 = *piVar1; if (iVar3 == 0) { piVar2 = (int *)(lVar4 + (long)iVar9 * 4); iVar3 = *piVar2; *piVar2 = 0; *piVar1 = iVar3; iVar9 = iVar9 + 1; iVar5 = iVar5 + 1; } else if (iVar3 == 1) { iVar5 = iVar5 + 1; } else { piVar2 = (int *)(lVar4 + (long)iVar6 * 4); *piVar1 = *piVar2; *piVar2 = iVar3; iVar6 = iVar6 + -1; } } while (iVar5 <= iVar6); } *plVar8 = *plVar7; plVar8[1] = plVar7[1]; plVar8[2] = plVar7[2]; plVar7[2] = 0; plVar7[1] = 0; *plVar7 = 0; return plVar8; }
3,258
func0
#include <iostream> #include <vector> #include <assert.h>
std::vector<int> func0(std::vector<int> arr, int n) { int low = 0; int mid = 0; int high = n - 1; while (mid <= high) { if (arr[mid] == 0) { std::swap(arr[low], arr[mid]); low++; mid++; } else if (arr[mid] == 1) { mid++; } else { std::swap(arr[mid], arr[high]); high--; } } return arr; }
int main() { std::vector<int> result1 = func0({1,2,0,1,0,1,2,1,1}, 9); std::vector<int> expected1 = {0, 0, 1, 1, 1, 1, 1, 2, 2}; assert(result1 == expected1); std::vector<int> result2 = func0({1,0,0,1,2,1,2,2,1,0}, 10); std::vector<int> expected2 = {0, 0, 0, 1, 1, 1, 1, 2, 2, 2}; assert(result2 == expected2); std::vector<int> result3 = func0({2,2,1,0,0,0,1,1,2,1}, 10); std::vector<int> expected3 = {0, 0, 0, 1, 1, 1, 1, 2, 2, 2}; assert(result3 == expected3); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> >, int): endbr64 push %r12 mov (%rsi),%r10 mov %rdi,%r12 sub $0x1,%edx js 17ba <_Z5func0St6vectorIiSaIiEEi+0x6a> xor %ecx,%ecx xor %r11d,%r11d jmp 178f <_Z5func0St6vectorIiSaIiEEi+0x3f> nopl 0x0(%rax,%rax,1) movslq %r11d,%r8 add $0x1,%ecx add $0x1,%r11d lea (%r10,%r8,4),%r8 mov (%r8),%eax movl $0x0,(%r8) mov %eax,(%r9) cmp %ecx,%edx jl 17ba <_Z5func0St6vectorIiSaIiEEi+0x6a> movslq %ecx,%r8 lea (%r10,%r8,4),%r9 mov (%r9),%r8d test %r8d,%r8d je 1770 <_Z5func0St6vectorIiSaIiEEi+0x20> cmp $0x1,%r8d je 17f0 <_Z5func0St6vectorIiSaIiEEi+0xa0> movslq %edx,%rax sub $0x1,%edx lea (%r10,%rax,4),%rax mov (%rax),%edi mov %edi,(%r9) mov %r8d,(%rax) cmp %ecx,%edx jge 178f <_Z5func0St6vectorIiSaIiEEi+0x3f> mov 0x8(%rsi),%rax mov %r10,(%r12) movq $0x0,0x8(%rsi) mov %rax,0x8(%r12) mov 0x10(%rsi),%rax movq $0x0,(%rsi) mov %rax,0x10(%r12) mov %r12,%rax pop %r12 movq $0x0,0x10(%rsi) retq nopl (%rax) add $0x1,%ecx jmp 178b <_Z5func0St6vectorIiSaIiEEi+0x3b> nopw %cs:0x0(%rax,%rax,1)
_Z5func0St6vectorIiSaIiEEi: endbr64 push rbx mov r11, rdi mov r10, rsi mov rdi, [rsi] sub edx, 1 js short loc_16C6 xor eax, eax xor r8d, r8d jmp short loc_169E loc_1680: movsxd rcx, r8d add eax, 1 add r8d, 1 lea rcx, [rdi+rcx*4] mov r9d, [rcx] mov dword ptr [rcx], 0 mov [rsi], r9d loc_169A: cmp eax, edx jg short loc_16C6 loc_169E: movsxd rcx, eax lea rsi, [rdi+rcx*4] mov ecx, [rsi] test ecx, ecx jz short loc_1680 cmp ecx, 1 jz short loc_16F8 movsxd r9, edx sub edx, 1 lea r9, [rdi+r9*4] mov ebx, [r9] mov [rsi], ebx mov [r9], ecx cmp eax, edx jle short loc_169E loc_16C6: movq xmm0, rdi mov rax, [r10+10h] pop rbx mov qword ptr [r10+10h], 0 movhps xmm0, qword ptr [r10+8] movups xmmword ptr [r11], xmm0 pxor xmm0, xmm0 mov [r11+10h], rax mov rax, r11 movups xmmword ptr [r10], xmm0 retn loc_16F8: add eax, 1 jmp short loc_169A
__m128 * func0(__m128 *a1, const double *a2, int a3) { double v5; // rdi int v6; // edx int v7; // eax int v8; // r8d long long v9; // rcx int *v10; // rcx int v11; // r9d int *v12; // rsi int v13; // ecx long long v14; // r9 int *v15; // r9 unsigned long long v16; // rax __m128 *result; // rax v5 = *a2; v6 = a3 - 1; if ( v6 >= 0 ) { v7 = 0; v8 = 0; do { while ( 1 ) { v12 = (int *)(*(_QWORD *)&v5 + 4LL * v7); v13 = *v12; if ( *v12 ) break; v9 = v8; ++v7; ++v8; v10 = (int *)(*(_QWORD *)&v5 + 4 * v9); v11 = *v10; *v10 = 0; *v12 = v11; LABEL_4: if ( v7 > v6 ) goto LABEL_8; } if ( v13 == 1 ) { ++v7; goto LABEL_4; } v14 = v6--; v15 = (int *)(*(_QWORD *)&v5 + 4 * v14); *v12 = *v15; *v15 = v13; } while ( v7 <= v6 ); } LABEL_8: v16 = *((_QWORD *)a2 + 2); a2[2] = 0.0; *a1 = _mm_loadh_ps(a2 + 1); a1[1].m128_u64[0] = v16; result = a1; *(_OWORD *)a2 = 0LL; return result; }
func0: ENDBR64 PUSH RBX MOV R11,RDI MOV R10,RSI MOV RDI,qword ptr [RSI] SUB EDX,0x1 JS 0x001016c6 XOR EAX,EAX XOR R8D,R8D JMP 0x0010169e LAB_00101680: MOVSXD RCX,R8D ADD EAX,0x1 ADD R8D,0x1 LEA RCX,[RDI + RCX*0x4] MOV R9D,dword ptr [RCX] MOV dword ptr [RCX],0x0 MOV dword ptr [RSI],R9D LAB_0010169a: CMP EAX,EDX JG 0x001016c6 LAB_0010169e: MOVSXD RCX,EAX LEA RSI,[RDI + RCX*0x4] MOV ECX,dword ptr [RSI] TEST ECX,ECX JZ 0x00101680 CMP ECX,0x1 JZ 0x001016f8 MOVSXD R9,EDX SUB EDX,0x1 LEA R9,[RDI + R9*0x4] MOV EBX,dword ptr [R9] MOV dword ptr [RSI],EBX MOV dword ptr [R9],ECX CMP EAX,EDX JLE 0x0010169e LAB_001016c6: MOVQ XMM0,RDI MOV RAX,qword ptr [R10 + 0x10] POP RBX MOV qword ptr [R10 + 0x10],0x0 MOVHPS XMM0,qword ptr [R10 + 0x8] MOVUPS xmmword ptr [R11],XMM0 PXOR XMM0,XMM0 MOV qword ptr [R11 + 0x10],RAX MOV RAX,R11 MOVUPS xmmword ptr [R10],XMM0 RET LAB_001016f8: ADD EAX,0x1 JMP 0x0010169a
/* func0(std::vector<int, std::allocator<int> >, int) */ long * func0(long *param_1,int (*param_2) [16],int param_3) { int *piVar1; int *piVar2; int iVar3; long lVar4; long lVar5; int iVar6; int iVar7; long lVar8; lVar4 = *(long *)*param_2; param_3 = param_3 + -1; if (-1 < param_3) { iVar6 = 0; iVar7 = 0; do { while( true ) { piVar1 = (int *)(lVar4 + (long)iVar6 * 4); iVar3 = *piVar1; if (iVar3 != 0) break; lVar8 = (long)iVar7; iVar7 = iVar7 + 1; piVar2 = (int *)(lVar4 + lVar8 * 4); iVar3 = *piVar2; *piVar2 = 0; *piVar1 = iVar3; LAB_0010169a: iVar6 = iVar6 + 1; if (param_3 < iVar6) goto LAB_001016c6; } if (iVar3 == 1) goto LAB_0010169a; lVar8 = (long)param_3; param_3 = param_3 + -1; piVar2 = (int *)(lVar4 + lVar8 * 4); *piVar1 = *piVar2; *piVar2 = iVar3; } while (iVar6 <= param_3); } LAB_001016c6: lVar5 = *(long *)param_2[1]; *(int8 *)param_2[1] = 0; lVar8 = *(long *)(*param_2 + 8); *param_1 = lVar4; param_1[1] = lVar8; param_1[2] = lVar5; *param_2 = (int [16])0x0; return param_1; }
3,259
func0
#include <iostream> #include <vector> #include <assert.h>
std::vector<int> func0(std::vector<int> arr, int n) { int low = 0; int mid = 0; int high = n - 1; while (mid <= high) { if (arr[mid] == 0) { std::swap(arr[low], arr[mid]); low++; mid++; } else if (arr[mid] == 1) { mid++; } else { std::swap(arr[mid], arr[high]); high--; } } return arr; }
int main() { std::vector<int> result1 = func0({1,2,0,1,0,1,2,1,1}, 9); std::vector<int> expected1 = {0, 0, 1, 1, 1, 1, 1, 2, 2}; assert(result1 == expected1); std::vector<int> result2 = func0({1,0,0,1,2,1,2,2,1,0}, 10); std::vector<int> expected2 = {0, 0, 0, 1, 1, 1, 1, 2, 2, 2}; assert(result2 == expected2); std::vector<int> result3 = func0({2,2,1,0,0,0,1,1,2,1}, 10); std::vector<int> expected3 = {0, 0, 0, 1, 1, 1, 1, 2, 2, 2}; assert(result3 == expected3); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> >, int): endbr64 push %r12 mov (%rsi),%r10 mov %rdi,%r12 sub $0x1,%edx js 172a <_Z5func0St6vectorIiSaIiEEi+0x6a> xor %ecx,%ecx xor %r11d,%r11d jmp 16ff <_Z5func0St6vectorIiSaIiEEi+0x3f> nopl 0x0(%rax,%rax,1) movslq %r11d,%r8 add $0x1,%ecx add $0x1,%r11d lea (%r10,%r8,4),%r8 mov (%r8),%eax movl $0x0,(%r8) mov %eax,(%r9) cmp %ecx,%edx jl 172a <_Z5func0St6vectorIiSaIiEEi+0x6a> movslq %ecx,%r8 lea (%r10,%r8,4),%r9 mov (%r9),%r8d test %r8d,%r8d je 16e0 <_Z5func0St6vectorIiSaIiEEi+0x20> cmp $0x1,%r8d je 1758 <_Z5func0St6vectorIiSaIiEEi+0x98> movslq %edx,%rax sub $0x1,%edx lea (%r10,%rax,4),%rax mov (%rax),%edi mov %edi,(%r9) mov %r8d,(%rax) cmp %ecx,%edx jge 16ff <_Z5func0St6vectorIiSaIiEEi+0x3f> mov 0x8(%rsi),%rax pxor %xmm0,%xmm0 mov %r10,(%r12) movups %xmm0,(%rsi) mov %rax,0x8(%r12) mov 0x10(%rsi),%rax movq $0x0,0x10(%rsi) mov %rax,0x10(%r12) mov %r12,%rax pop %r12 retq nopl (%rax) add $0x1,%ecx jmp 16fb <_Z5func0St6vectorIiSaIiEEi+0x3b> nopl (%rax)
_Z5func0St6vectorIiSaIiEEi: endbr64 push rbx mov r11, rdi mov r10, rsi mov rdi, [rsi] sub edx, 1 js short loc_16C6 xor eax, eax xor r8d, r8d jmp short loc_169E loc_1680: movsxd rcx, r8d add eax, 1 add r8d, 1 lea rcx, [rdi+rcx*4] mov r9d, [rcx] mov dword ptr [rcx], 0 mov [rsi], r9d loc_169A: cmp eax, edx jg short loc_16C6 loc_169E: movsxd rcx, eax lea rsi, [rdi+rcx*4] mov ecx, [rsi] test ecx, ecx jz short loc_1680 cmp ecx, 1 jz short loc_16F8 movsxd r9, edx sub edx, 1 lea r9, [rdi+r9*4] mov ebx, [r9] mov [rsi], ebx mov [r9], ecx cmp eax, edx jle short loc_169E loc_16C6: movq xmm0, rdi mov rax, [r10+10h] pop rbx mov qword ptr [r10+10h], 0 movhps xmm0, qword ptr [r10+8] movups xmmword ptr [r11], xmm0 pxor xmm0, xmm0 mov [r11+10h], rax mov rax, r11 movups xmmword ptr [r10], xmm0 retn loc_16F8: add eax, 1 jmp short loc_169A
__m128 * func0(__m128 *a1, const double *a2, int a3) { double v5; // rdi int v6; // edx int v7; // eax int v8; // r8d long long v9; // rcx int *v10; // rcx int v11; // r9d int *v12; // rsi int v13; // ecx long long v14; // r9 int *v15; // r9 unsigned long long v16; // rax __m128 *result; // rax v5 = *a2; v6 = a3 - 1; if ( v6 >= 0 ) { v7 = 0; v8 = 0; do { while ( 1 ) { v12 = (int *)(*(_QWORD *)&v5 + 4LL * v7); v13 = *v12; if ( *v12 ) break; v9 = v8; ++v7; ++v8; v10 = (int *)(*(_QWORD *)&v5 + 4 * v9); v11 = *v10; *v10 = 0; *v12 = v11; LABEL_4: if ( v7 > v6 ) goto LABEL_8; } if ( v13 == 1 ) { ++v7; goto LABEL_4; } v14 = v6--; v15 = (int *)(*(_QWORD *)&v5 + 4 * v14); *v12 = *v15; *v15 = v13; } while ( v7 <= v6 ); } LABEL_8: v16 = *((_QWORD *)a2 + 2); a2[2] = 0.0; *a1 = _mm_loadh_ps(a2 + 1); a1[1].m128_u64[0] = v16; result = a1; *(_OWORD *)a2 = 0LL; return result; }
func0: ENDBR64 PUSH RBX MOV R11,RDI MOV R10,RSI MOV RDI,qword ptr [RSI] SUB EDX,0x1 JS 0x001016c6 XOR EAX,EAX XOR R8D,R8D JMP 0x0010169e LAB_00101680: MOVSXD RCX,R8D ADD EAX,0x1 ADD R8D,0x1 LEA RCX,[RDI + RCX*0x4] MOV R9D,dword ptr [RCX] MOV dword ptr [RCX],0x0 MOV dword ptr [RSI],R9D LAB_0010169a: CMP EAX,EDX JG 0x001016c6 LAB_0010169e: MOVSXD RCX,EAX LEA RSI,[RDI + RCX*0x4] MOV ECX,dword ptr [RSI] TEST ECX,ECX JZ 0x00101680 CMP ECX,0x1 JZ 0x001016f8 MOVSXD R9,EDX SUB EDX,0x1 LEA R9,[RDI + R9*0x4] MOV EBX,dword ptr [R9] MOV dword ptr [RSI],EBX MOV dword ptr [R9],ECX CMP EAX,EDX JLE 0x0010169e LAB_001016c6: MOVQ XMM0,RDI MOV RAX,qword ptr [R10 + 0x10] POP RBX MOV qword ptr [R10 + 0x10],0x0 MOVHPS XMM0,qword ptr [R10 + 0x8] MOVUPS xmmword ptr [R11],XMM0 PXOR XMM0,XMM0 MOV qword ptr [R11 + 0x10],RAX MOV RAX,R11 MOVUPS xmmword ptr [R10],XMM0 RET LAB_001016f8: ADD EAX,0x1 JMP 0x0010169a
/* func0(std::vector<int, std::allocator<int> >, int) */ long * func0(long *param_1,int (*param_2) [16],int param_3) { int *piVar1; int *piVar2; int iVar3; long lVar4; long lVar5; int iVar6; int iVar7; long lVar8; lVar4 = *(long *)*param_2; param_3 = param_3 + -1; if (-1 < param_3) { iVar6 = 0; iVar7 = 0; do { while( true ) { piVar1 = (int *)(lVar4 + (long)iVar6 * 4); iVar3 = *piVar1; if (iVar3 != 0) break; lVar8 = (long)iVar7; iVar7 = iVar7 + 1; piVar2 = (int *)(lVar4 + lVar8 * 4); iVar3 = *piVar2; *piVar2 = 0; *piVar1 = iVar3; LAB_0010169a: iVar6 = iVar6 + 1; if (param_3 < iVar6) goto LAB_001016c6; } if (iVar3 == 1) goto LAB_0010169a; lVar8 = (long)param_3; param_3 = param_3 + -1; piVar2 = (int *)(lVar4 + lVar8 * 4); *piVar1 = *piVar2; *piVar2 = iVar3; } while (iVar6 <= param_3); } LAB_001016c6: lVar5 = *(long *)param_2[1]; *(int8 *)param_2[1] = 0; lVar8 = *(long *)(*param_2 + 8); *param_1 = lVar4; param_1[1] = lVar8; param_1[2] = lVar5; *param_2 = (int [16])0x0; return param_1; }
3,260
func0
#include <tuple> #include <cassert>
std::tuple<> func0(std::tuple<int, int, int, int, int> test_tup) { std::tuple<> empty_tuple; return empty_tuple; }
int main() { assert(func0(std::make_tuple(1, 5, 3, 6, 8)) == std::make_tuple()); assert(func0(std::make_tuple(2, 1, 4, 5, 6)) == std::make_tuple()); assert(func0(std::make_tuple(3, 2, 5, 6, 8)) == std::make_tuple()); return 0; }
O0
cpp
func0(std::tuple<int, int, int, int, int>): endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %fs:0x28,%rdx mov %rdx,-0x8(%rbp) xor %edx,%edx mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 11bc <_Z5func0St5tupleIJiiiiiEE+0x33> callq 1080 <__stack_chk_fail@plt> leaveq retq
_Z5func0St5tupleIJiiiiiEE: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax nop mov rax, [rbp+var_8] sub rax, fs:28h jz short locret_119D call ___stack_chk_fail locret_119D: leave retn
long long func0() { return 0LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x8],RAX XOR EAX,EAX NOP MOV RAX,qword ptr [RBP + -0x8] SUB RAX,qword ptr FS:[0x28] JZ 0x0010119d CALL 0x00101070 LAB_0010119d: LEAVE RET
/* func0(std::tuple<int, int, int, int, int>) */ void func0(tuple param_1) { long in_FS_OFFSET; if (*(long *)(in_FS_OFFSET + 0x28) != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return; }
3,261
func0
#include <tuple> #include <cassert>
std::tuple<> func0(std::tuple<int, int, int, int, int> test_tup) { std::tuple<> empty_tuple; return empty_tuple; }
int main() { assert(func0(std::make_tuple(1, 5, 3, 6, 8)) == std::make_tuple()); assert(func0(std::make_tuple(2, 1, 4, 5, 6)) == std::make_tuple()); assert(func0(std::make_tuple(3, 2, 5, 6, 8)) == std::make_tuple()); return 0; }
O1
cpp
func0(std::tuple<int, int, int, int, int>): endbr64 mov $0x0,%eax retq
_Z5func0St5tupleIJiiiiiEE: endbr64 retn
void func0() { ; }
func0: ENDBR64 RET
/* func0(std::tuple<int, int, int, int, int>) */ void func0(tuple param_1) { return; }
3,262
func0
#include <tuple> #include <cassert>
std::tuple<> func0(std::tuple<int, int, int, int, int> test_tup) { std::tuple<> empty_tuple; return empty_tuple; }
int main() { assert(func0(std::make_tuple(1, 5, 3, 6, 8)) == std::make_tuple()); assert(func0(std::make_tuple(2, 1, 4, 5, 6)) == std::make_tuple()); assert(func0(std::make_tuple(3, 2, 5, 6, 8)) == std::make_tuple()); return 0; }
O2
cpp
func0(std::tuple<int, int, int, int, int>): endbr64 xor %eax,%eax retq nopw 0x0(%rax,%rax,1)
_Z5func0St5tupleIJiiiiiEE: endbr64 retn
void func0() { ; }
func0: ENDBR64 RET
/* func0(std::tuple<int, int, int, int, int>) */ void func0(tuple param_1) { return; }
3,263
func0
#include <tuple> #include <cassert>
std::tuple<> func0(std::tuple<int, int, int, int, int> test_tup) { std::tuple<> empty_tuple; return empty_tuple; }
int main() { assert(func0(std::make_tuple(1, 5, 3, 6, 8)) == std::make_tuple()); assert(func0(std::make_tuple(2, 1, 4, 5, 6)) == std::make_tuple()); assert(func0(std::make_tuple(3, 2, 5, 6, 8)) == std::make_tuple()); return 0; }
O3
cpp
func0(std::tuple<int, int, int, int, int>): endbr64 xor %eax,%eax retq nopw 0x0(%rax,%rax,1)
_Z5func0St5tupleIJiiiiiEE: endbr64 retn
void func0() { ; }
func0: ENDBR64 RET
/* func0(std::tuple<int, int, int, int, int>) */ void func0(tuple param_1) { return; }
3,264
func0
#include <vector> #include <cassert>
std::vector<int> func0(const std::vector<int>& nums, int m, int n) { std::vector<int> result; for (int num : nums) { if (num % m == 0 || num % n == 0) { result.push_back(num); } } return result; }
int main() { assert((func0({19, 65, 57, 39, 152, 639, 121, 44, 90, 190}, 19, 13) == std::vector<int>{19, 65, 57, 39, 152, 190})); assert((func0({1, 2, 3, 5, 7, 8, 10}, 2, 5) == std::vector<int>{2, 5, 8, 10})); assert((func0({10, 15, 14, 13, 18, 12, 20}, 10, 5) == std::vector<int>{10, 15, 20})); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> > const&, int, int): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x58,%rsp mov %rdi,-0x48(%rbp) mov %rsi,-0x50(%rbp) mov %edx,-0x54(%rbp) mov %ecx,-0x58(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax mov -0x48(%rbp),%rax mov %rax,%rdi callq 1a48 <_ZNSt6vectorIiSaIiEEC1Ev> mov -0x50(%rbp),%rax mov %rax,-0x20(%rbp) mov -0x20(%rbp),%rax mov %rax,%rdi callq 1b4e <_ZNKSt6vectorIiSaIiEE5beginEv> mov %rax,-0x30(%rbp) mov -0x20(%rbp),%rax mov %rax,%rdi callq 1ba6 <_ZNKSt6vectorIiSaIiEE3endEv> mov %rax,-0x28(%rbp) lea -0x28(%rbp),%rdx lea -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1bfe <_ZN9__gnu_cxxneIPKiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESB_> test %al,%al je 1328 <_Z5func0RKSt6vectorIiSaIiEEii+0xdf> lea -0x30(%rbp),%rax mov %rax,%rdi callq 1c62 <_ZNK9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEdeEv> mov (%rax),%eax mov %eax,-0x34(%rbp) mov -0x34(%rbp),%eax cltd idivl -0x54(%rbp) mov %edx,%eax test %eax,%eax je 12e9 <_Z5func0RKSt6vectorIiSaIiEEii+0xa0> mov -0x34(%rbp),%eax cltd idivl -0x58(%rbp) mov %edx,%eax test %eax,%eax jne 12fc <_Z5func0RKSt6vectorIiSaIiEEii+0xb3> lea -0x34(%rbp),%rdx mov -0x48(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1c78 <_ZNSt6vectorIiSaIiEE9push_backERKi> lea -0x30(%rbp),%rax mov %rax,%rdi callq 1c3e <_ZN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEppEv> jmp 12a7 <_Z5func0RKSt6vectorIiSaIiEEii+0x5e> endbr64 mov %rax,%rbx mov -0x48(%rbp),%rax mov %rax,%rdi callq 1b06 <_ZNSt6vectorIiSaIiEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 1150 <_Unwind_Resume@plt> mov -0x18(%rbp),%rax xor %fs:0x28,%rax je 133d <_Z5func0RKSt6vectorIiSaIiEEii+0xf4> callq 1130 <__stack_chk_fail@plt> mov -0x48(%rbp),%rax add $0x58,%rsp pop %rbx pop %rbp retq
_Z5func0RKSt6vectorIiSaIiEEii: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 58h mov [rbp+var_48], rdi mov [rbp+var_50], rsi mov [rbp+var_54], edx mov [rbp+var_58], ecx mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax mov rax, [rbp+var_48] mov rdi, rax call _ZNSt6vectorIiSaIiEEC2Ev; std::vector<int>::vector(void) mov rax, [rbp+var_50] mov [rbp+var_20], rax mov rax, [rbp+var_20] mov rdi, rax call _ZNKSt6vectorIiSaIiEE5beginEv; std::vector<int>::begin(void) mov [rbp+var_30], rax mov rax, [rbp+var_20] mov rdi, rax call _ZNKSt6vectorIiSaIiEE3endEv; std::vector<int>::end(void) mov [rbp+var_28], rax jmp short loc_1313 loc_12C9: lea rax, [rbp+var_30] mov rdi, rax call _ZNK9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEdeEv; __gnu_cxx::__normal_iterator<int const*,std::vector<int>>::operator*(void) mov eax, [rax] mov [rbp+var_34], eax mov eax, [rbp+var_34] cdq idiv [rbp+var_54] mov eax, edx test eax, eax jz short loc_12F4 mov eax, [rbp+var_34] cdq idiv [rbp+var_58] mov eax, edx test eax, eax jnz short loc_1307 loc_12F4: lea rdx, [rbp+var_34] mov rax, [rbp+var_48] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEE9push_backERKi; std::vector<int>::push_back(int const&) loc_1307: lea rax, [rbp+var_30] mov rdi, rax call _ZN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEppEv; __gnu_cxx::__normal_iterator<int const*,std::vector<int>>::operator++(void) loc_1313: lea rdx, [rbp+var_28] lea rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZN9__gnu_cxxneIPKiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESB_; __gnu_cxx::operator!=<int const*,std::vector<int>>(__gnu_cxx::__normal_iterator<int const*,std::vector<int>> const&,__gnu_cxx::__normal_iterator<int const*,std::vector<int>> const&) test al, al jnz short loc_12C9 jmp short loc_135E endbr64 mov rbx, rax mov rax, [rbp+var_48] mov rdi, rax call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() mov rax, rbx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_1356 call ___stack_chk_fail loc_1356: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_135E: mov rax, [rbp+var_18] sub rax, fs:28h jz short loc_1372 call ___stack_chk_fail loc_1372: mov rax, [rbp+var_48] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, long long a2, int a3, int a4) { int v7; // [rsp+2Ch] [rbp-34h] BYREF long long v8; // [rsp+30h] [rbp-30h] BYREF _QWORD v9[4]; // [rsp+38h] [rbp-28h] BYREF v9[2] = __readfsqword(0x28u); std::vector<int>::vector(a1); v9[1] = a2; v8 = std::vector<int>::begin(a2); v9[0] = std::vector<int>::end(a2); while ( (unsigned __int8)__gnu_cxx::operator!=<int const*,std::vector<int>>(&v8, v9) ) { v7 = *(_DWORD *)__gnu_cxx::__normal_iterator<int const*,std::vector<int>>::operator*(&v8); if ( !(v7 % a3) || !(v7 % a4) ) std::vector<int>::push_back(a1, &v7); __gnu_cxx::__normal_iterator<int const*,std::vector<int>>::operator++(&v8); } return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x58 MOV qword ptr [RBP + -0x48],RDI MOV qword ptr [RBP + -0x50],RSI MOV dword ptr [RBP + -0x54],EDX MOV dword ptr [RBP + -0x58],ECX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV RAX,qword ptr [RBP + -0x48] MOV RDI,RAX CALL 0x00101acc MOV RAX,qword ptr [RBP + -0x50] MOV qword ptr [RBP + -0x20],RAX MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x00101bca MOV qword ptr [RBP + -0x30],RAX MOV RAX,qword ptr [RBP + -0x20] MOV RDI,RAX CALL 0x00101c16 MOV qword ptr [RBP + -0x28],RAX JMP 0x00101313 LAB_001012c9: LEA RAX,[RBP + -0x30] MOV RDI,RAX CALL 0x00101cca MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x34],EAX MOV EAX,dword ptr [RBP + -0x34] CDQ IDIV dword ptr [RBP + -0x54] MOV EAX,EDX TEST EAX,EAX JZ 0x001012f4 MOV EAX,dword ptr [RBP + -0x34] CDQ IDIV dword ptr [RBP + -0x58] MOV EAX,EDX TEST EAX,EAX JNZ 0x00101307 LAB_001012f4: LEA RDX,[RBP + -0x34] MOV RAX,qword ptr [RBP + -0x48] MOV RSI,RDX MOV RDI,RAX LAB_00101302: CALL 0x00101ce0 LAB_00101307: LEA RAX,[RBP + -0x30] MOV RDI,RAX CALL 0x00101ca6 LAB_00101313: LEA RDX,[RBP + -0x28] LEA RAX,[RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00101c66 TEST AL,AL JNZ 0x001012c9 JMP 0x0010135e LAB_0010135e: MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x00101372 CALL 0x00101150 LAB_00101372: MOV RAX,qword ptr [RBP + -0x48] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::vector<int, std::allocator<int> > const&, int, int) */ vector * func0(vector *param_1,int param_2,int param_3) { bool bVar1; int *piVar2; int in_ECX; int4 in_register_00000034; long in_FS_OFFSET; int local_3c; int8 local_38; int8 local_30; vector<int,std::allocator<int>> *local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); std::vector<int,std::allocator<int>>::vector((vector<int,std::allocator<int>> *)param_1); local_28 = (vector<int,std::allocator<int>> *)CONCAT44(in_register_00000034,param_2); local_38 = std::vector<int,std::allocator<int>>::begin ((vector<int,std::allocator<int>> *)CONCAT44(in_register_00000034,param_2)); local_30 = std::vector<int,std::allocator<int>>::end(local_28); while( true ) { bVar1 = operator!=((__normal_iterator *)&local_38,(__normal_iterator *)&local_30); if (!bVar1) break; piVar2 = (int *)__normal_iterator<int_const*,std::vector<int,std::allocator<int>>>::operator* ((__normal_iterator<int_const*,std::vector<int,std::allocator<int>>> * )&local_38); local_3c = *piVar2; if ((local_3c % param_3 == 0) || (local_3c % in_ECX == 0)) { /* try { // try from 00101302 to 00101306 has its CatchHandler @ 0010132c */ std::vector<int,std::allocator<int>>::push_back ((vector<int,std::allocator<int>> *)param_1,&local_3c); } __normal_iterator<int_const*,std::vector<int,std::allocator<int>>>::operator++ ((__normal_iterator<int_const*,std::vector<int,std::allocator<int>>> *)&local_38); } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
3,265
func0
#include <vector> #include <cassert>
std::vector<int> func0(const std::vector<int>& nums, int m, int n) { std::vector<int> result; for (int num : nums) { if (num % m == 0 || num % n == 0) { result.push_back(num); } } return result; }
int main() { assert((func0({19, 65, 57, 39, 152, 639, 121, 44, 90, 190}, 19, 13) == std::vector<int>{19, 65, 57, 39, 152, 190})); assert((func0({1, 2, 3, 5, 7, 8, 10}, 2, 5) == std::vector<int>{2, 5, 8, 10})); assert((func0({10, 15, 14, 13, 18, 12, 20}, 10, 5) == std::vector<int>{10, 15, 20})); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> > const&, int, int): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov %rdi,%rbp mov %fs:0x28,%rax mov %rax,0x8(%rsp) xor %eax,%eax movq $0x0,(%rdi) movq $0x0,0x8(%rdi) movq $0x0,0x10(%rdi) mov (%rsi),%rbx mov 0x8(%rsi),%r14 cmp %r14,%rbx je 12fe <_Z5func0RKSt6vectorIiSaIiEEii+0xb5> mov %edx,%r12d mov %ecx,%r13d lea 0x4(%rsp),%r15 jmp 12b8 <_Z5func0RKSt6vectorIiSaIiEEii+0x6f> mov 0x8(%rbp),%rsi cmp 0x10(%rbp),%rsi je 12d4 <_Z5func0RKSt6vectorIiSaIiEEii+0x8b> mov %ecx,(%rsi) addq $0x4,0x8(%rbp) add $0x4,%rbx cmp %rbx,%r14 je 12fe <_Z5func0RKSt6vectorIiSaIiEEii+0xb5> mov (%rbx),%ecx mov %ecx,0x4(%rsp) mov %ecx,%eax cltd idiv %r12d test %edx,%edx je 129e <_Z5func0RKSt6vectorIiSaIiEEii+0x55> mov %ecx,%eax cltd idiv %r13d test %edx,%edx jne 12af <_Z5func0RKSt6vectorIiSaIiEEii+0x66> jmp 129e <_Z5func0RKSt6vectorIiSaIiEEii+0x55> mov %r15,%rdx mov %rbp,%rdi callq 1898 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> jmp 12af <_Z5func0RKSt6vectorIiSaIiEEii+0x66> endbr64 mov %rax,%rbx mov 0x0(%rbp),%rdi test %rdi,%rdi je 12f6 <_Z5func0RKSt6vectorIiSaIiEEii+0xad> callq 1110 <_ZdlPv@plt> mov %rbx,%rdi callq 1150 <_Unwind_Resume@plt> mov 0x8(%rsp),%rax xor %fs:0x28,%rax jne 1320 <_Z5func0RKSt6vectorIiSaIiEEii+0xd7> mov %rbp,%rax add $0x18,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 1130 <__stack_chk_fail@plt>
_Z5func0RKSt6vectorIiSaIiEEii: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 18h mov rbp, rdi mov rax, fs:28h mov [rsp+48h+var_40], rax xor eax, eax mov qword ptr [rdi], 0 mov qword ptr [rdi+8], 0 mov qword ptr [rdi+10h], 0 mov rbx, [rsi] mov r14, [rsi+8] cmp r14, rbx jz short loc_130D mov r12d, edx mov r13d, ecx lea r15, [rsp+48h+var_44] jmp short loc_12B8 loc_129E: mov rsi, [rbp+8] cmp rsi, [rbp+10h] jz short loc_12D4 mov [rsi], ecx add qword ptr [rbp+8], 4 loc_12AF: add rbx, 4 cmp r14, rbx jz short loc_130D loc_12B8: mov ecx, [rbx] mov [rsp+48h+var_44], ecx mov eax, ecx cdq idiv r12d test edx, edx jz short loc_129E mov eax, ecx cdq idiv r13d test edx, edx jnz short loc_12AF jmp short loc_129E loc_12D4: mov rdx, r15 mov rdi, rbp call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) jmp short loc_12AF endbr64 mov rbx, rax mov rdi, rbp call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() mov rax, [rsp+arg_0] sub rax, fs:28h jz short loc_1305 call ___stack_chk_fail loc_1305: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume loc_130D: mov rax, [rsp+48h+var_40] sub rax, fs:28h jnz short loc_132F mov rax, rbp add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_132F: call ___stack_chk_fail
_QWORD * func0(_QWORD *a1, int **a2, int a3, int a4) { int *v4; // rbx int *v5; // r14 _DWORD *v8; // rsi int v9; // ecx int v11; // [rsp+4h] [rbp-44h] BYREF unsigned long long v12; // [rsp+8h] [rbp-40h] v12 = __readfsqword(0x28u); *a1 = 0LL; a1[1] = 0LL; a1[2] = 0LL; v4 = *a2; v5 = a2[1]; if ( v5 != *a2 ) { do { v9 = *v4; v11 = v9; if ( !(v9 % a3) || !(v9 % a4) ) { v8 = (_DWORD *)a1[1]; if ( v8 == (_DWORD *)a1[2] ) { std::vector<int>::_M_realloc_insert<int const&>(a1, v8, &v11); } else { *v8 = v9; a1[1] += 4LL; } } ++v4; } while ( v5 != v4 ); } return a1; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV RBP,RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x8],RAX XOR EAX,EAX MOV qword ptr [RDI],0x0 MOV qword ptr [RDI + 0x8],0x0 MOV qword ptr [RDI + 0x10],0x0 MOV RBX,qword ptr [RSI] MOV R14,qword ptr [RSI + 0x8] CMP R14,RBX JZ 0x0010130d MOV R12D,EDX MOV R13D,ECX LEA R15,[RSP + 0x4] JMP 0x001012b8 LAB_0010129e: MOV RSI,qword ptr [RBP + 0x8] CMP RSI,qword ptr [RBP + 0x10] JZ 0x001012d4 MOV dword ptr [RSI],ECX ADD qword ptr [RBP + 0x8],0x4 LAB_001012af: ADD RBX,0x4 CMP R14,RBX JZ 0x0010130d LAB_001012b8: MOV ECX,dword ptr [RBX] MOV dword ptr [RSP + 0x4],ECX MOV EAX,ECX CDQ IDIV R12D TEST EDX,EDX JZ 0x0010129e MOV EAX,ECX CDQ IDIV R13D TEST EDX,EDX JNZ 0x001012af JMP 0x0010129e LAB_001012d4: MOV RDX,R15 MOV RDI,RBP LAB_001012da: CALL 0x001018e2 JMP 0x001012af LAB_0010130d: MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010132f MOV RAX,RBP ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010132f: CALL 0x00101130
/* func0(std::vector<int, std::allocator<int> > const&, int, int) */ vector * func0(vector *param_1,int param_2,int param_3) { int *piVar1; int *piVar2; int in_ECX; int *piVar3; int4 in_register_00000034; long in_FS_OFFSET; int local_44; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); *(int8 *)param_1 = 0; *(int8 *)(param_1 + 8) = 0; *(int8 *)(param_1 + 0x10) = 0; piVar3 = *(int **)CONCAT44(in_register_00000034,param_2); piVar1 = (int *)((int8 *)CONCAT44(in_register_00000034,param_2))[1]; if (piVar1 != piVar3) { do { local_44 = *piVar3; if ((local_44 % param_3 == 0) || (local_44 % in_ECX == 0)) { piVar2 = *(int **)(param_1 + 8); if (piVar2 == *(int **)(param_1 + 0x10)) { /* try { // try from 001012da to 001012de has its CatchHandler @ 001012e1 */ std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)param_1,(__normal_iterator)piVar2,&local_44) ; } else { *piVar2 = local_44; *(long *)(param_1 + 8) = *(long *)(param_1 + 8) + 4; } } piVar3 = piVar3 + 1; } while (piVar1 != piVar3); } if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
3,266
func0
#include <vector> #include <cassert>
std::vector<int> func0(const std::vector<int>& nums, int m, int n) { std::vector<int> result; for (int num : nums) { if (num % m == 0 || num % n == 0) { result.push_back(num); } } return result; }
int main() { assert((func0({19, 65, 57, 39, 152, 639, 121, 44, 90, 190}, 19, 13) == std::vector<int>{19, 65, 57, 39, 152, 190})); assert((func0({1, 2, 3, 5, 7, 8, 10}, 2, 5) == std::vector<int>{2, 5, 8, 10})); assert((func0({10, 15, 14, 13, 18, 12, 20}, 10, 5) == std::vector<int>{10, 15, 20})); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> > const&, int, int): endbr64 push %r15 push %r14 push %r13 push %r12 mov %rdi,%r12 push %rbp push %rbx sub $0x18,%rsp mov %fs:0x28,%rax mov %rax,0x8(%rsp) xor %eax,%eax movq $0x0,(%rdi) movq $0x0,0x8(%rdi) movq $0x0,0x10(%rdi) mov (%rsi),%rbx mov 0x8(%rsi),%r14 cmp %r14,%rbx je 1738 <_Z5func0RKSt6vectorIiSaIiEEii+0xa8> mov %edx,%ebp mov %ecx,%r13d lea 0x4(%rsp),%r15 jmp 16fc <_Z5func0RKSt6vectorIiSaIiEEii+0x6c> nopl 0x0(%rax) mov %ecx,(%rsi) add $0x4,%rsi mov %rsi,0x8(%r12) add $0x4,%rbx cmp %rbx,%r14 je 1738 <_Z5func0RKSt6vectorIiSaIiEEii+0xa8> mov (%rbx),%ecx mov %ecx,%eax mov %ecx,0x4(%rsp) cltd idiv %ebp test %edx,%edx je 1715 <_Z5func0RKSt6vectorIiSaIiEEii+0x85> mov %ecx,%eax cltd idiv %r13d test %edx,%edx jne 16f3 <_Z5func0RKSt6vectorIiSaIiEEii+0x63> mov 0x8(%r12),%rsi cmp 0x10(%r12),%rsi jne 16e8 <_Z5func0RKSt6vectorIiSaIiEEii+0x58> mov %r15,%rdx mov %r12,%rdi callq 1880 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> add $0x4,%rbx cmp %rbx,%r14 jne 16fc <_Z5func0RKSt6vectorIiSaIiEEii+0x6c> nopl (%rax) mov 0x8(%rsp),%rax xor %fs:0x28,%rax jne 175a <_Z5func0RKSt6vectorIiSaIiEEii+0xca> add $0x18,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 1130 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 1160 <_Z5func0RKSt6vectorIiSaIiEEii.cold> nopl 0x0(%rax,%rax,1)
_Z5func0RKSt6vectorIiSaIiEEii: endbr64 push r15 pxor xmm0, xmm0 push r14 push r13 push r12 push rbp mov rbp, rdi push rbx sub rsp, 18h mov rax, fs:28h mov [rsp+48h+var_40], rax xor eax, eax mov qword ptr [rdi+10h], 0 movups xmmword ptr [rdi], xmm0 mov rbx, [rsi] mov r14, [rsi+8] cmp r14, rbx jz short loc_16F0 mov r12d, edx mov r13d, ecx lea r15, [rsp+48h+var_44] jmp short loc_16B3 loc_16A0: mov [rsi], ecx add rsi, 4 mov [rbp+8], rsi loc_16AA: add rbx, 4 cmp r14, rbx jz short loc_16F0 loc_16B3: mov ecx, [rbx] mov eax, ecx mov [rsp+48h+var_44], ecx cdq idiv r12d test edx, edx jz short loc_16CD mov eax, ecx cdq idiv r13d test edx, edx jnz short loc_16AA loc_16CD: mov rsi, [rbp+8] cmp rsi, [rbp+10h] jnz short loc_16A0 mov rdx, r15 mov rdi, rbp call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) add rbx, 4 cmp r14, rbx jnz short loc_16B3 nop dword ptr [rax+rax+00h] loc_16F0: mov rax, [rsp+48h+var_40] sub rax, fs:28h jnz short loc_1712 add rsp, 18h mov rax, rbp pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1712: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0RKSt6vectorIiSaIiEEii_cold; func0(std::vector<int> const&,int,int) [clone]
long long func0(long long a1, int **a2, int a3, int a4) { int *v4; // rbx int *v5; // r14 _DWORD *v8; // rsi int v10; // [rsp+0h] [rbp-44h] BYREF unsigned long long v11; // [rsp+4h] [rbp-40h] v11 = __readfsqword(0x28u); *(_QWORD *)(a1 + 16) = 0LL; *(_OWORD *)a1 = 0LL; v4 = *a2; v5 = a2[1]; if ( v5 != *a2 ) { while ( 1 ) { v10 = *v4; if ( v10 % a3 && v10 % a4 ) goto LABEL_4; v8 = *(_DWORD **)(a1 + 8); if ( v8 == *(_DWORD **)(a1 + 16) ) { std::vector<int>::_M_realloc_insert<int const&>(a1, v8, &v10); if ( v5 == ++v4 ) return a1; } else { *v8 = v10; *(_QWORD *)(a1 + 8) = v8 + 1; LABEL_4: if ( v5 == ++v4 ) return a1; } } } return a1; }
func0: ENDBR64 PUSH R15 PXOR XMM0,XMM0 PUSH R14 PUSH R13 PUSH R12 PUSH RBP MOV RBP,RDI PUSH RBX SUB RSP,0x18 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x8],RAX XOR EAX,EAX MOV qword ptr [RDI + 0x10],0x0 MOVUPS xmmword ptr [RDI],XMM0 MOV RBX,qword ptr [RSI] MOV R14,qword ptr [RSI + 0x8] CMP R14,RBX JZ 0x001016f0 MOV R12D,EDX MOV R13D,ECX LEA R15,[RSP + 0x4] JMP 0x001016b3 LAB_001016a0: MOV dword ptr [RSI],ECX ADD RSI,0x4 MOV qword ptr [RBP + 0x8],RSI LAB_001016aa: ADD RBX,0x4 CMP R14,RBX JZ 0x001016f0 LAB_001016b3: MOV ECX,dword ptr [RBX] MOV EAX,ECX MOV dword ptr [RSP + 0x4],ECX CDQ IDIV R12D TEST EDX,EDX JZ 0x001016cd MOV EAX,ECX CDQ IDIV R13D TEST EDX,EDX JNZ 0x001016aa LAB_001016cd: MOV RSI,qword ptr [RBP + 0x8] CMP RSI,qword ptr [RBP + 0x10] JNZ 0x001016a0 MOV RDX,R15 MOV RDI,RBP LAB_001016dd: CALL 0x00101840 ADD RBX,0x4 CMP R14,RBX JNZ 0x001016b3 NOP dword ptr [RAX + RAX*0x1] LAB_001016f0: MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101712 ADD RSP,0x18 MOV RAX,RBP POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101712: CALL 0x00101130
/* func0(std::vector<int, std::allocator<int> > const&, int, int) */ vector * func0(vector *param_1,int param_2,int param_3) { int *piVar1; int *piVar2; int in_ECX; int *piVar3; int4 in_register_00000034; long in_FS_OFFSET; int local_44; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); *(int8 *)(param_1 + 0x10) = 0; *(int (*) [16])param_1 = (int [16])0x0; piVar3 = *(int **)CONCAT44(in_register_00000034,param_2); piVar1 = (int *)((int8 *)CONCAT44(in_register_00000034,param_2))[1]; if (piVar1 != piVar3) { do { while ((local_44 = *piVar3, local_44 % param_3 != 0 && (local_44 % in_ECX != 0))) { LAB_001016aa: piVar3 = piVar3 + 1; if (piVar1 == piVar3) goto LAB_001016f0; } piVar2 = *(int **)(param_1 + 8); if (piVar2 != *(int **)(param_1 + 0x10)) { *piVar2 = local_44; *(int **)(param_1 + 8) = piVar2 + 1; goto LAB_001016aa; } /* try { // try from 001016dd to 001016e1 has its CatchHandler @ 00101717 */ std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)param_1,(__normal_iterator)piVar2,&local_44); piVar3 = piVar3 + 1; } while (piVar1 != piVar3); } LAB_001016f0: if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
3,267
func0
#include <vector> #include <cassert>
std::vector<int> func0(const std::vector<int>& nums, int m, int n) { std::vector<int> result; for (int num : nums) { if (num % m == 0 || num % n == 0) { result.push_back(num); } } return result; }
int main() { assert((func0({19, 65, 57, 39, 152, 639, 121, 44, 90, 190}, 19, 13) == std::vector<int>{19, 65, 57, 39, 152, 190})); assert((func0({1, 2, 3, 5, 7, 8, 10}, 2, 5) == std::vector<int>{2, 5, 8, 10})); assert((func0({10, 15, 14, 13, 18, 12, 20}, 10, 5) == std::vector<int>{10, 15, 20})); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> > const&, int, int): endbr64 push %r15 pxor %xmm0,%xmm0 push %r14 push %r13 push %r12 mov %rdi,%r12 push %rbp push %rbx sub $0x18,%rsp mov %fs:0x28,%rax mov %rax,0x8(%rsp) xor %eax,%eax movq $0x0,0x10(%rdi) movups %xmm0,(%rdi) mov (%rsi),%rbx mov 0x8(%rsi),%r14 cmp %r14,%rbx je 16d0 <_Z5func0RKSt6vectorIiSaIiEEii+0xa0> mov %edx,%ebp mov %ecx,%r13d lea 0x4(%rsp),%r15 jmp 1694 <_Z5func0RKSt6vectorIiSaIiEEii+0x64> nopl 0x0(%rax) mov %ecx,(%rsi) add $0x4,%rsi mov %rsi,0x8(%r12) add $0x4,%rbx cmp %rbx,%r14 je 16d0 <_Z5func0RKSt6vectorIiSaIiEEii+0xa0> mov (%rbx),%ecx mov %ecx,%eax mov %ecx,0x4(%rsp) cltd idiv %ebp test %edx,%edx je 16ad <_Z5func0RKSt6vectorIiSaIiEEii+0x7d> mov %ecx,%eax cltd idiv %r13d test %edx,%edx jne 168b <_Z5func0RKSt6vectorIiSaIiEEii+0x5b> mov 0x8(%r12),%rsi cmp 0x10(%r12),%rsi jne 1680 <_Z5func0RKSt6vectorIiSaIiEEii+0x50> mov %r15,%rdx mov %r12,%rdi callq 1810 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> add $0x4,%rbx cmp %rbx,%r14 jne 1694 <_Z5func0RKSt6vectorIiSaIiEEii+0x64> nopl (%rax) mov 0x8(%rsp),%rax xor %fs:0x28,%rax jne 16f2 <_Z5func0RKSt6vectorIiSaIiEEii+0xc2> add $0x18,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 1130 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 1160 <_Z5func0RKSt6vectorIiSaIiEEii.cold> nopw %cs:0x0(%rax,%rax,1) nopl (%rax)
_Z5func0RKSt6vectorIiSaIiEEii: endbr64 push r15 pxor xmm0, xmm0 push r14 push r13 push r12 push rbp mov rbp, rdi push rbx sub rsp, 18h mov rax, fs:28h mov [rsp+48h+var_40], rax xor eax, eax mov qword ptr [rdi+10h], 0 movups xmmword ptr [rdi], xmm0 mov rbx, [rsi] mov r14, [rsi+8] cmp r14, rbx jz short loc_16F0 mov r12d, edx mov r13d, ecx lea r15, [rsp+48h+var_44] jmp short loc_16B3 loc_16A0: mov [rsi], ecx add rsi, 4 mov [rbp+8], rsi loc_16AA: add rbx, 4 cmp r14, rbx jz short loc_16F0 loc_16B3: mov ecx, [rbx] mov eax, ecx mov [rsp+48h+var_44], ecx cdq idiv r12d test edx, edx jz short loc_16CD mov eax, ecx cdq idiv r13d test edx, edx jnz short loc_16AA loc_16CD: mov rsi, [rbp+8] cmp rsi, [rbp+10h] jnz short loc_16A0 mov rdx, r15 mov rdi, rbp call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) add rbx, 4 cmp r14, rbx jnz short loc_16B3 nop dword ptr [rax+rax+00h] loc_16F0: mov rax, [rsp+48h+var_40] sub rax, fs:28h jnz short loc_1712 add rsp, 18h mov rax, rbp pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1712: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0RKSt6vectorIiSaIiEEii_cold; func0(std::vector<int> const&,int,int) [clone]
long long func0(long long a1, int **a2, int a3, int a4) { int *v4; // rbx int *v5; // r14 _DWORD *v8; // rsi int v10; // [rsp+0h] [rbp-44h] BYREF unsigned long long v11; // [rsp+4h] [rbp-40h] v11 = __readfsqword(0x28u); *(_QWORD *)(a1 + 16) = 0LL; *(_OWORD *)a1 = 0LL; v4 = *a2; v5 = a2[1]; if ( v5 != *a2 ) { while ( 1 ) { v10 = *v4; if ( v10 % a3 && v10 % a4 ) goto LABEL_4; v8 = *(_DWORD **)(a1 + 8); if ( v8 == *(_DWORD **)(a1 + 16) ) { std::vector<int>::_M_realloc_insert<int const&>(a1, v8, &v10); if ( v5 == ++v4 ) return a1; } else { *v8 = v10; *(_QWORD *)(a1 + 8) = v8 + 1; LABEL_4: if ( v5 == ++v4 ) return a1; } } } return a1; }
func0: ENDBR64 PUSH R15 PXOR XMM0,XMM0 PUSH R14 PUSH R13 PUSH R12 PUSH RBP MOV RBP,RDI PUSH RBX SUB RSP,0x18 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x8],RAX XOR EAX,EAX MOV qword ptr [RDI + 0x10],0x0 MOVUPS xmmword ptr [RDI],XMM0 MOV RBX,qword ptr [RSI] MOV R14,qword ptr [RSI + 0x8] CMP R14,RBX JZ 0x001016f0 MOV R12D,EDX MOV R13D,ECX LEA R15,[RSP + 0x4] JMP 0x001016b3 LAB_001016a0: MOV dword ptr [RSI],ECX ADD RSI,0x4 MOV qword ptr [RBP + 0x8],RSI LAB_001016aa: ADD RBX,0x4 CMP R14,RBX JZ 0x001016f0 LAB_001016b3: MOV ECX,dword ptr [RBX] MOV EAX,ECX MOV dword ptr [RSP + 0x4],ECX CDQ IDIV R12D TEST EDX,EDX JZ 0x001016cd MOV EAX,ECX CDQ IDIV R13D TEST EDX,EDX JNZ 0x001016aa LAB_001016cd: MOV RSI,qword ptr [RBP + 0x8] CMP RSI,qword ptr [RBP + 0x10] JNZ 0x001016a0 MOV RDX,R15 MOV RDI,RBP LAB_001016dd: CALL 0x00101840 ADD RBX,0x4 CMP R14,RBX JNZ 0x001016b3 NOP dword ptr [RAX + RAX*0x1] LAB_001016f0: MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101712 ADD RSP,0x18 MOV RAX,RBP POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101712: CALL 0x00101130
/* func0(std::vector<int, std::allocator<int> > const&, int, int) */ vector * func0(vector *param_1,int param_2,int param_3) { int *piVar1; int *piVar2; int in_ECX; int *piVar3; int4 in_register_00000034; long in_FS_OFFSET; int local_44; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); *(int8 *)(param_1 + 0x10) = 0; *(int (*) [16])param_1 = (int [16])0x0; piVar3 = *(int **)CONCAT44(in_register_00000034,param_2); piVar1 = (int *)((int8 *)CONCAT44(in_register_00000034,param_2))[1]; if (piVar1 != piVar3) { do { while ((local_44 = *piVar3, local_44 % param_3 != 0 && (local_44 % in_ECX != 0))) { LAB_001016aa: piVar3 = piVar3 + 1; if (piVar1 == piVar3) goto LAB_001016f0; } piVar2 = *(int **)(param_1 + 8); if (piVar2 != *(int **)(param_1 + 0x10)) { *piVar2 = local_44; *(int **)(param_1 + 8) = piVar2 + 1; goto LAB_001016aa; } /* try { // try from 001016dd to 001016e1 has its CatchHandler @ 00101717 */ std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)param_1,(__normal_iterator)piVar2,&local_44); piVar3 = piVar3 + 1; } while (piVar1 != piVar3); } LAB_001016f0: if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
3,268
func0
#include <iostream> #include <string> #include <assert.h>
int func0(const std::string& str) { int lower_ctr = 0; for (int i = 0; i < str.length(); i++) { if (str[i] >= 'a' and str[i] <= 'z') { lower_ctr++; } } return lower_ctr; }
int main() { assert(func0("abc") == 3); assert(func0("string") == 6); assert(func0("Python") == 5); return 0; }
O0
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x28,%rsp mov %rdi,-0x28(%rbp) movl $0x0,-0x18(%rbp) movl $0x0,-0x14(%rbp) mov -0x14(%rbp),%eax movslq %eax,%rbx mov -0x28(%rbp),%rax mov %rax,%rdi callq 22d0 <_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv@plt> cmp %rax,%rbx setb %al test %al,%al je 24b6 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x8d> mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 2280 <_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm@plt> movzbl (%rax),%eax cmp $0x60,%al jle 24a3 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x7a> mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 2280 <_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm@plt> movzbl (%rax),%eax cmp $0x7a,%al jg 24a3 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x7a> mov $0x1,%eax jmp 24a8 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x7f> mov $0x0,%eax test %al,%al je 24b0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x87> addl $0x1,-0x18(%rbp) addl $0x1,-0x14(%rbp) jmp 2448 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1f> mov -0x18(%rbp),%eax add $0x28,%rsp pop %rbx pop %rbp retq
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 28h mov [rbp+var_28], rdi mov [rbp+var_18], 0 mov [rbp+var_14], 0 jmp short loc_13BA loc_136A: mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call __ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm; std::string::operator[](ulong) movzx eax, byte ptr [rax] cmp al, 60h ; '`' jle short loc_13A9 mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call __ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm; std::string::operator[](ulong) movzx eax, byte ptr [rax] cmp al, 7Ah ; 'z' jg short loc_13A9 mov eax, 1 jmp short loc_13AE loc_13A9: mov eax, 0 loc_13AE: test al, al jz short loc_13B6 add [rbp+var_18], 1 loc_13B6: add [rbp+var_14], 1 loc_13BA: mov eax, [rbp+var_14] movsxd rbx, eax mov rax, [rbp+var_28] mov rdi, rax call __ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv; std::string::length(void) cmp rbx, rax setb al test al, al jnz short loc_136A mov eax, [rbp+var_18] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1) { unsigned int v3; // [rsp+18h] [rbp-18h] int i; // [rsp+1Ch] [rbp-14h] v3 = 0; for ( i = 0; i < (unsigned long long)std::string::length(a1); ++i ) { if ( *(char *)std::string::operator[](a1, i) > 96 && *(char *)std::string::operator[](a1, i) <= 122 ) ++v3; } return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x28 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x18],0x0 MOV dword ptr [RBP + -0x14],0x0 JMP 0x001013ba LAB_0010136a: MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x001011e0 MOVZX EAX,byte ptr [RAX] CMP AL,0x60 JLE 0x001013a9 MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x001011e0 MOVZX EAX,byte ptr [RAX] CMP AL,0x7a JG 0x001013a9 MOV EAX,0x1 JMP 0x001013ae LAB_001013a9: MOV EAX,0x0 LAB_001013ae: TEST AL,AL JZ 0x001013b6 ADD dword ptr [RBP + -0x18],0x1 LAB_001013b6: ADD dword ptr [RBP + -0x14],0x1 LAB_001013ba: MOV EAX,dword ptr [RBP + -0x14] MOVSXD RBX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RDI,RAX CALL 0x00101220 CMP RBX,RAX SETC AL TEST AL,AL JNZ 0x0010136a MOV EAX,dword ptr [RBP + -0x18] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::string const&) */ int func0(string *param_1) { bool bVar1; char *pcVar2; ulong uVar3; int4 local_20; int4 local_1c; local_20 = 0; local_1c = 0; do { uVar3 = std::string::length(); if (uVar3 <= (ulong)(long)local_1c) { return local_20; } pcVar2 = (char *)std::string::operator[]((ulong)param_1); if (*pcVar2 < 'a') { LAB_001013a9: bVar1 = false; } else { pcVar2 = (char *)std::string::operator[]((ulong)param_1); if ('z' < *pcVar2) goto LAB_001013a9; bVar1 = true; } if (bVar1) { local_20 = local_20 + 1; } local_1c = local_1c + 1; } while( true ); }
3,269
func0
#include <iostream> #include <string> #include <assert.h>
int func0(const std::string& str) { int lower_ctr = 0; for (int i = 0; i < str.length(); i++) { if (str[i] >= 'a' and str[i] <= 'z') { lower_ctr++; } } return lower_ctr; }
int main() { assert(func0("abc") == 3); assert(func0("string") == 6); assert(func0("Python") == 5); return 0; }
O1
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 mov 0x8(%rdi),%rsi test %rsi,%rsi je 1259 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x30> mov (%rdi),%rax add %rax,%rsi mov $0x0,%ecx movzbl (%rax),%edi lea -0x61(%rdi),%edx cmp $0x1a,%dl adc $0x0,%ecx add $0x1,%rax cmp %rax,%rsi jne 1241 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x18> mov %ecx,%eax retq mov $0x0,%ecx jmp 1256 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x2d>
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 mov rsi, [rdi+8] test rsi, rsi jz short loc_1239 mov rax, [rdi] add rsi, rax mov ecx, 0 loc_1221: movzx edi, byte ptr [rax] lea edx, [rdi-61h] cmp dl, 1Ah adc ecx, 0 add rax, 1 cmp rsi, rax jnz short loc_1221 loc_1236: mov eax, ecx retn loc_1239: mov ecx, 0 jmp short loc_1236
long long func0(_QWORD *a1) { long long v1; // rsi _BYTE *v2; // rax _BYTE *v3; // rsi unsigned int v4; // ecx v1 = a1[1]; if ( v1 ) { v2 = (_BYTE *)*a1; v3 = (_BYTE *)(*a1 + v1); v4 = 0; do v4 += (unsigned __int8)(*v2++ - 97) < 0x1Au; while ( v3 != v2 ); } else { return 0; } return v4; }
func0: ENDBR64 MOV RSI,qword ptr [RDI + 0x8] TEST RSI,RSI JZ 0x00101239 MOV RAX,qword ptr [RDI] ADD RSI,RAX MOV ECX,0x0 LAB_00101221: MOVZX EDI,byte ptr [RAX] LEA EDX,[RDI + -0x61] CMP DL,0x1a ADC ECX,0x0 ADD RAX,0x1 CMP RSI,RAX JNZ 0x00101221 LAB_00101236: MOV EAX,ECX RET LAB_00101239: MOV ECX,0x0 JMP 0x00101236
/* func0(std::string const&) */ int func0(string *param_1) { char *pcVar1; int iVar2; char *pcVar3; if (*(long *)(param_1 + 8) == 0) { iVar2 = 0; } else { pcVar1 = *(char **)param_1; pcVar3 = pcVar1 + *(long *)(param_1 + 8); iVar2 = 0; do { iVar2 = iVar2 + (uint)((byte)(*pcVar1 + 0x9fU) < 0x1a); pcVar1 = pcVar1 + 1; } while (pcVar3 != pcVar1); } return iVar2; }
3,270
func0
#include <iostream> #include <string> #include <assert.h>
int func0(const std::string& str) { int lower_ctr = 0; for (int i = 0; i < str.length(); i++) { if (str[i] >= 'a' and str[i] <= 'z') { lower_ctr++; } } return lower_ctr; }
int main() { assert(func0("abc") == 3); assert(func0("string") == 6); assert(func0("Python") == 5); return 0; }
O2
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 mov 0x8(%rdi),%rcx test %rcx,%rcx je 1490 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x40> mov (%rdi),%rax xor %r8d,%r8d add %rax,%rcx nopw %cs:0x0(%rax,%rax,1) movzbl (%rax),%esi lea -0x61(%rsi),%edx cmp $0x1a,%dl adc $0x0,%r8d add $0x1,%rax cmp %rcx,%rax jne 1470 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x20> mov %r8d,%eax retq nopw 0x0(%rax,%rax,1) xor %r8d,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 mov rsi, [rdi+8] test rsi, rsi jz short loc_1360 mov rax, [rdi] xor ecx, ecx add rsi, rax nop dword ptr [rax] loc_1348: movzx edi, byte ptr [rax] lea edx, [rdi-61h] cmp dl, 1Ah adc ecx, 0 add rax, 1 cmp rsi, rax jnz short loc_1348 mov eax, ecx retn loc_1360: xor ecx, ecx mov eax, ecx retn
long long func0(_QWORD *a1) { long long v1; // rsi _BYTE *v2; // rax unsigned int v3; // ecx _BYTE *v4; // rsi v1 = a1[1]; if ( !v1 ) return 0LL; v2 = (_BYTE *)*a1; v3 = 0; v4 = (_BYTE *)(*a1 + v1); do v3 += (unsigned __int8)(*v2++ - 97) < 0x1Au; while ( v4 != v2 ); return v3; }
func0: ENDBR64 MOV RSI,qword ptr [RDI + 0x8] TEST RSI,RSI JZ 0x00101360 MOV RAX,qword ptr [RDI] XOR ECX,ECX ADD RSI,RAX NOP dword ptr [RAX] LAB_00101348: MOVZX EDI,byte ptr [RAX] LEA EDX,[RDI + -0x61] CMP DL,0x1a ADC ECX,0x0 ADD RAX,0x1 CMP RSI,RAX JNZ 0x00101348 MOV EAX,ECX RET LAB_00101360: XOR ECX,ECX MOV EAX,ECX RET
/* func0(std::string const&) */ int func0(string *param_1) { char *pcVar1; int iVar2; char *pcVar3; if (*(long *)(param_1 + 8) != 0) { pcVar1 = *(char **)param_1; iVar2 = 0; pcVar3 = pcVar1 + *(long *)(param_1 + 8); do { iVar2 = iVar2 + (uint)((byte)(*pcVar1 + 0x9fU) < 0x1a); pcVar1 = pcVar1 + 1; } while (pcVar3 != pcVar1); return iVar2; } return 0; }
3,271
func0
#include <iostream> #include <string> #include <assert.h>
int func0(const std::string& str) { int lower_ctr = 0; for (int i = 0; i < str.length(); i++) { if (str[i] >= 'a' and str[i] <= 'z') { lower_ctr++; } } return lower_ctr; }
int main() { assert(func0("abc") == 3); assert(func0("string") == 6); assert(func0("Python") == 5); return 0; }
O3
cpp
func0(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): endbr64 mov 0x8(%rdi),%rdx test %rdx,%rdx je 1e10 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x290> lea -0x1(%rdx),%rax mov (%rdi),%rcx cmp $0xe,%rax jbe 1e13 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x293> mov %rdx,%rsi mov %rcx,%rax pxor %xmm1,%xmm1 movdqa 0x52c(%rip),%xmm7 and $0xfffffffffffffff0,%rsi movdqa 0x530(%rip),%xmm6 pxor %xmm4,%xmm4 pxor %xmm3,%xmm3 movdqa 0x530(%rip),%xmm5 add %rcx,%rsi nopl 0x0(%rax,%rax,1) movdqu (%rax),%xmm0 movdqa %xmm4,%xmm8 add $0x10,%rax paddb %xmm7,%xmm0 psubusb %xmm6,%xmm0 pcmpeqb %xmm4,%xmm0 pand %xmm5,%xmm0 pcmpgtb %xmm0,%xmm8 movdqa %xmm0,%xmm2 punpcklbw %xmm8,%xmm2 punpckhbw %xmm8,%xmm0 movdqa %xmm3,%xmm8 pcmpgtw %xmm2,%xmm8 movdqa %xmm2,%xmm9 punpcklwd %xmm8,%xmm9 punpckhwd %xmm8,%xmm2 movdqa %xmm0,%xmm8 paddd %xmm9,%xmm1 paddd %xmm2,%xmm1 movdqa %xmm3,%xmm2 pcmpgtw %xmm0,%xmm2 punpcklwd %xmm2,%xmm8 punpckhwd %xmm2,%xmm0 paddd %xmm8,%xmm1 paddd %xmm0,%xmm1 cmp %rsi,%rax jne 1bd8 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x58> movdqa %xmm1,%xmm0 mov %rdx,%rdi psrldq $0x8,%xmm0 and $0xfffffffffffffff0,%rdi paddd %xmm1,%xmm0 mov %edi,%esi movdqa %xmm0,%xmm1 psrldq $0x4,%xmm1 paddd %xmm1,%xmm0 movd %xmm0,%eax cmp %rdi,%rdx je 1e1e <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x29e> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0x1(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdx,%rdi jae 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0x2(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdx,%rdi jae 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0x3(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0x4(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0x5(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0x6(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0x7(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0x8(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0x9(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0xa(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0xb(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0xc(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil lea 0xd(%rsi),%edi movslq %edi,%rdi adc $0x0,%eax cmp %rdi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rdi,1),%edi sub $0x61,%edi cmp $0x1a,%dil adc $0x0,%eax add $0xe,%esi movslq %esi,%rsi cmp %rsi,%rdx jbe 1e12 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x292> movzbl (%rcx,%rsi,1),%edx sub $0x61,%edx cmp $0x1a,%dl adc $0x0,%eax retq xchg %ax,%ax xor %eax,%eax retq xor %esi,%esi xor %eax,%eax xor %edi,%edi jmpq 1c7e <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xfe> retq
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 mov rcx, [rdi+8] test rcx, rcx jz loc_1C80 lea rax, [rcx-1] mov rsi, [rdi] cmp rax, 0Eh jbe loc_1C83 mov rdx, rcx pxor xmm1, xmm1 pxor xmm3, xmm3 mov rax, rsi and rdx, 0FFFFFFFFFFFFFFF0h movdqa xmm6, cs:xmmword_20C0 movdqa xmm5, cs:xmmword_20D0 pxor xmm4, xmm4 lea rdi, [rdx+rsi] nop dword ptr [rax+00h] loc_1A80: movdqu xmm2, xmmword ptr [rax] movdqa xmm0, xmm5 movdqa xmm7, xmm3 add rax, 10h paddb xmm2, xmm6 psubusb xmm0, xmm2 pcmpeqb xmm0, xmm3 pcmpeqb xmm0, xmm3 pcmpgtb xmm7, xmm0 movdqa xmm2, xmm0 punpcklbw xmm2, xmm7 punpckhbw xmm0, xmm7 movdqa xmm7, xmm4 pcmpgtw xmm7, xmm2 movdqa xmm8, xmm2 punpcklwd xmm8, xmm7 punpckhwd xmm2, xmm7 movdqa xmm7, xmm0 psubd xmm1, xmm8 psubd xmm1, xmm2 movdqa xmm2, xmm4 pcmpgtw xmm2, xmm0 punpcklwd xmm7, xmm2 punpckhwd xmm0, xmm2 psubd xmm1, xmm7 psubd xmm1, xmm0 cmp rdi, rax jnz short loc_1A80 movdqa xmm0, xmm1 mov edi, edx psrldq xmm0, 8 paddd xmm0, xmm1 movdqa xmm2, xmm0 psrldq xmm2, 4 paddd xmm0, xmm2 movd eax, xmm0 movdqa xmm0, xmm1 psrldq xmm1, 8 paddd xmm1, xmm0 cmp rcx, rdx jz locret_1C92 loc_1B26: mov r8, rcx sub r8, rdx lea r9, [r8-1] cmp r9, 6 jbe loc_1BDE movq xmm2, qword ptr cs:xmmword_20C0 movq xmm0, qword ptr [rsi+rdx] paddb xmm0, xmm2 movq xmm2, cs:qword_20E0 pminub xmm2, xmm0 pcmpeqb xmm0, xmm2 pxor xmm2, xmm2 pcmpgtb xmm2, xmm0 movdqa xmm3, xmm0 punpcklbw xmm3, xmm2 punpcklbw xmm0, xmm2 pxor xmm2, xmm2 movdqa xmm4, xmm2 movdqa xmm5, xmm3 pshufd xmm0, xmm0, 4Eh ; 'N' pcmpgtw xmm4, xmm3 pcmpgtw xmm2, xmm0 punpcklwd xmm5, xmm4 punpcklwd xmm3, xmm4 psubd xmm1, xmm5 pshufd xmm3, xmm3, 4Eh ; 'N' psubd xmm1, xmm3 movdqa xmm3, xmm0 punpcklwd xmm0, xmm2 punpcklwd xmm3, xmm2 pshufd xmm0, xmm0, 4Eh ; 'N' psubd xmm1, xmm3 psubd xmm1, xmm0 movd r9d, xmm1 pshufd xmm6, xmm1, 0E5h movd eax, xmm6 add eax, r9d mov r9, r8 and r9, 0FFFFFFFFFFFFFFF8h add rdx, r9 add edi, r9d and r8d, 7 jz locret_1C82 loc_1BDE: movzx edx, byte ptr [rsi+rdx] sub edx, 61h ; 'a' cmp dl, 1Ah lea edx, [rdi+1] movsxd rdx, edx adc eax, 0 cmp rdx, rcx jnb locret_1C82 movzx edx, byte ptr [rsi+rdx] sub edx, 61h ; 'a' cmp dl, 1Ah lea edx, [rdi+2] movsxd rdx, edx adc eax, 0 cmp rdx, rcx jnb short locret_1C82 movzx edx, byte ptr [rsi+rdx] sub edx, 61h ; 'a' cmp dl, 1Ah lea edx, [rdi+3] movsxd rdx, edx adc eax, 0 cmp rdx, rcx jnb short locret_1C82 movzx edx, byte ptr [rsi+rdx] sub edx, 61h ; 'a' cmp dl, 1Ah lea edx, [rdi+4] movsxd rdx, edx adc eax, 0 cmp rdx, rcx jnb short locret_1C82 movzx edx, byte ptr [rsi+rdx] sub edx, 61h ; 'a' cmp dl, 1Ah lea edx, [rdi+5] movsxd rdx, edx adc eax, 0 cmp rdx, rcx jnb short locret_1C82 movzx edx, byte ptr [rsi+rdx] sub edx, 61h ; 'a' cmp dl, 1Ah adc eax, 0 add edi, 6 movsxd rdi, edi cmp rdi, rcx jnb short locret_1C82 movzx edx, byte ptr [rsi+rdi] sub edx, 61h ; 'a' cmp dl, 1Ah adc eax, 0 retn loc_1C80: xor eax, eax locret_1C82: retn loc_1C83: pxor xmm1, xmm1 xor edi, edi xor eax, eax xor edx, edx jmp loc_1B26 locret_1C92: retn
long long func0(const __m128i **a1) { const __m128i *v1; // rcx const __m128i *v2; // rsi __m128i v3; // xmm1 const __m128i *v4; // rax unsigned long long v5; // rdx __m128i si128; // xmm6 __m128i v7; // xmm5 __m128i v8; // xmm2 __m128i v9; // xmm0 __m128i v10; // xmm7 __m128i v11; // xmm2 __m128i v12; // xmm0 __m128i v13; // xmm7 __m128i v14; // xmm1 __m128i v15; // xmm2 unsigned int v16; // edi __m128i v17; // xmm0 long long result; // rax __m128i v19; // xmm1 long long v20; // r8 __m128i v21; // xmm0 __m128i v22; // xmm0 __m128i v23; // xmm3 __m128i v24; // xmm0 __m128i v25; // xmm2 __m128i v26; // xmm3 __m128i v27; // xmm1 bool v28; // cf unsigned long long v29; // rdx unsigned long long v30; // rdx unsigned long long v31; // rdx unsigned long long v32; // rdx unsigned long long v33; // rdx unsigned long long v34; // rdi v1 = a1[1]; if ( !v1 ) return 0LL; v2 = *a1; if ( (unsigned long long)&v1[-1].m128i_u64[1] + 7 <= 0xE ) { v19 = 0LL; v16 = 0; LODWORD(result) = 0; v5 = 0LL; } else { v3 = 0LL; v4 = *a1; v5 = (unsigned long long)v1 & 0xFFFFFFFFFFFFFFF0LL; si128 = _mm_load_si128((const __m128i *)&xmmword_20C0); v7 = _mm_load_si128((const __m128i *)&xmmword_20D0); do { v8 = _mm_loadu_si128(v4++); v9 = _mm_cmpeq_epi8(_mm_cmpeq_epi8(_mm_subs_epu8(v7, _mm_add_epi8(v8, si128)), (__m128i)0LL), (__m128i)0LL); v10 = _mm_cmpgt_epi8((__m128i)0LL, v9); v11 = _mm_unpacklo_epi8(v9, v10); v12 = _mm_unpackhi_epi8(v9, v10); v13 = _mm_cmpgt_epi16((__m128i)0LL, v11); v14 = _mm_sub_epi32(_mm_sub_epi32(v3, _mm_unpacklo_epi16(v11, v13)), _mm_unpackhi_epi16(v11, v13)); v15 = _mm_cmpgt_epi16((__m128i)0LL, v12); v3 = _mm_sub_epi32(_mm_sub_epi32(v14, _mm_unpacklo_epi16(v12, v15)), _mm_unpackhi_epi16(v12, v15)); } while ( &v2->m128i_i8[(unsigned long long)v1 & 0xFFFFFFFFFFFFFFF0LL] != (__int8 *)v4 ); v16 = (unsigned int)v1 & 0xFFFFFFF0; v17 = _mm_add_epi32(_mm_srli_si128(v3, 8), v3); result = (unsigned int)_mm_cvtsi128_si32(_mm_add_epi32(v17, _mm_srli_si128(v17, 4))); v19 = v17; if ( v1 == (const __m128i *)v5 ) return result; } v20 = (long long)v1->m128i_i64 - v5; if ( (unsigned long long)v1 - v5 - 1 <= 6 ) goto LABEL_8; v21 = _mm_add_epi8( _mm_loadl_epi64((const __m128i *)((char *)v2 + v5)), _mm_loadl_epi64((const __m128i *)&xmmword_20C0)); v22 = _mm_cmpeq_epi8(v21, _mm_min_epu8(_mm_loadl_epi64((const __m128i *)&qword_20E0), v21)); v23 = _mm_unpacklo_epi8(v22, _mm_cmpgt_epi8((__m128i)0LL, v22)); v24 = _mm_shuffle_epi32(v23, 78); v25 = _mm_cmpgt_epi16((__m128i)0LL, v24); v26 = _mm_unpacklo_epi16(v23, _mm_cmpgt_epi16((__m128i)0LL, v23)); v27 = _mm_sub_epi32( _mm_sub_epi32( _mm_sub_epi32(_mm_sub_epi32(v19, v26), _mm_shuffle_epi32(v26, 78)), _mm_unpacklo_epi16(v24, v25)), _mm_shuffle_epi32(_mm_unpacklo_epi16(v24, v25), 78)); result = (unsigned int)(_mm_cvtsi128_si32(v27) + _mm_cvtsi128_si32(_mm_shuffle_epi32(v27, 229))); v5 += v20 & 0xFFFFFFFFFFFFFFF8LL; v16 += v20 & 0xFFFFFFF8; if ( (v20 & 7) != 0 ) { LABEL_8: v28 = (unsigned __int8)(v2->m128i_i8[v5] - 97) < 0x1Au; v29 = (int)(v16 + 1); result = v28 + (unsigned int)result; if ( v29 < (unsigned long long)v1 ) { v28 = (unsigned __int8)(v2->m128i_i8[v29] - 97) < 0x1Au; v30 = (int)(v16 + 2); result = v28 + (unsigned int)result; if ( v30 < (unsigned long long)v1 ) { v28 = (unsigned __int8)(v2->m128i_i8[v30] - 97) < 0x1Au; v31 = (int)(v16 + 3); result = v28 + (unsigned int)result; if ( v31 < (unsigned long long)v1 ) { v28 = (unsigned __int8)(v2->m128i_i8[v31] - 97) < 0x1Au; v32 = (int)(v16 + 4); result = v28 + (unsigned int)result; if ( v32 < (unsigned long long)v1 ) { v28 = (unsigned __int8)(v2->m128i_i8[v32] - 97) < 0x1Au; v33 = (int)(v16 + 5); result = v28 + (unsigned int)result; if ( v33 < (unsigned long long)v1 ) { result = ((unsigned __int8)(v2->m128i_i8[v33] - 97) < 0x1Au) + (unsigned int)result; v34 = (int)(v16 + 6); if ( v34 < (unsigned long long)v1 ) return ((unsigned __int8)(v2->m128i_i8[v34] - 97) < 0x1Au) + (unsigned int)result; } } } } } } return result; }
func0: ENDBR64 MOV RCX,qword ptr [RDI + 0x8] TEST RCX,RCX JZ 0x00101c80 LEA RAX,[RCX + -0x1] MOV RSI,qword ptr [RDI] CMP RAX,0xe JBE 0x00101c83 MOV RDX,RCX PXOR XMM1,XMM1 PXOR XMM3,XMM3 MOV RAX,RSI AND RDX,-0x10 MOVDQA XMM6,xmmword ptr [0x001020c0] MOVDQA XMM5,xmmword ptr [0x001020d0] PXOR XMM4,XMM4 LEA RDI,[RDX + RSI*0x1] NOP dword ptr [RAX] LAB_00101a80: MOVDQU XMM2,xmmword ptr [RAX] MOVDQA XMM0,XMM5 MOVDQA XMM7,XMM3 ADD RAX,0x10 PADDB XMM2,XMM6 PSUBUSB XMM0,XMM2 PCMPEQB XMM0,XMM3 PCMPEQB XMM0,XMM3 PCMPGTB XMM7,XMM0 MOVDQA XMM2,XMM0 PUNPCKLBW XMM2,XMM7 PUNPCKHBW XMM0,XMM7 MOVDQA XMM7,XMM4 PCMPGTW XMM7,XMM2 MOVDQA XMM8,XMM2 PUNPCKLWD XMM8,XMM7 PUNPCKHWD XMM2,XMM7 MOVDQA XMM7,XMM0 PSUBD XMM1,XMM8 PSUBD XMM1,XMM2 MOVDQA XMM2,XMM4 PCMPGTW XMM2,XMM0 PUNPCKLWD XMM7,XMM2 PUNPCKHWD XMM0,XMM2 PSUBD XMM1,XMM7 PSUBD XMM1,XMM0 CMP RDI,RAX JNZ 0x00101a80 MOVDQA XMM0,XMM1 MOV EDI,EDX PSRLDQ XMM0,0x8 PADDD XMM0,XMM1 MOVDQA XMM2,XMM0 PSRLDQ XMM2,0x4 PADDD XMM0,XMM2 MOVD EAX,XMM0 MOVDQA XMM0,XMM1 PSRLDQ XMM1,0x8 PADDD XMM1,XMM0 CMP RCX,RDX JZ 0x00101c92 LAB_00101b26: MOV R8,RCX SUB R8,RDX LEA R9,[R8 + -0x1] CMP R9,0x6 JBE 0x00101bde MOVQ XMM2,qword ptr [0x001020c0] MOVQ XMM0,qword ptr [RSI + RDX*0x1] PADDB XMM0,XMM2 MOVQ XMM2,qword ptr [0x001020e0] PMINUB XMM2,XMM0 PCMPEQB XMM0,XMM2 PXOR XMM2,XMM2 PCMPGTB XMM2,XMM0 MOVDQA XMM3,XMM0 PUNPCKLBW XMM3,XMM2 PUNPCKLBW XMM0,XMM2 PXOR XMM2,XMM2 MOVDQA XMM4,XMM2 MOVDQA XMM5,XMM3 PSHUFD XMM0,XMM0,0x4e PCMPGTW XMM4,XMM3 PCMPGTW XMM2,XMM0 PUNPCKLWD XMM5,XMM4 PUNPCKLWD XMM3,XMM4 PSUBD XMM1,XMM5 PSHUFD XMM3,XMM3,0x4e PSUBD XMM1,XMM3 MOVDQA XMM3,XMM0 PUNPCKLWD XMM0,XMM2 PUNPCKLWD XMM3,XMM2 PSHUFD XMM0,XMM0,0x4e PSUBD XMM1,XMM3 PSUBD XMM1,XMM0 MOVD R9D,XMM1 PSHUFD XMM6,XMM1,0xe5 MOVD EAX,XMM6 ADD EAX,R9D MOV R9,R8 AND R9,-0x8 ADD RDX,R9 ADD EDI,R9D AND R8D,0x7 JZ 0x00101c82 LAB_00101bde: MOVZX EDX,byte ptr [RSI + RDX*0x1] SUB EDX,0x61 CMP DL,0x1a LEA EDX,[RDI + 0x1] MOVSXD RDX,EDX ADC EAX,0x0 CMP RDX,RCX JNC 0x00101c82 MOVZX EDX,byte ptr [RSI + RDX*0x1] SUB EDX,0x61 CMP DL,0x1a LEA EDX,[RDI + 0x2] MOVSXD RDX,EDX ADC EAX,0x0 CMP RDX,RCX JNC 0x00101c82 MOVZX EDX,byte ptr [RSI + RDX*0x1] SUB EDX,0x61 CMP DL,0x1a LEA EDX,[RDI + 0x3] MOVSXD RDX,EDX ADC EAX,0x0 CMP RDX,RCX JNC 0x00101c82 MOVZX EDX,byte ptr [RSI + RDX*0x1] SUB EDX,0x61 CMP DL,0x1a LEA EDX,[RDI + 0x4] MOVSXD RDX,EDX ADC EAX,0x0 CMP RDX,RCX JNC 0x00101c82 MOVZX EDX,byte ptr [RSI + RDX*0x1] SUB EDX,0x61 CMP DL,0x1a LEA EDX,[RDI + 0x5] MOVSXD RDX,EDX ADC EAX,0x0 CMP RDX,RCX JNC 0x00101c82 MOVZX EDX,byte ptr [RSI + RDX*0x1] SUB EDX,0x61 CMP DL,0x1a ADC EAX,0x0 ADD EDI,0x6 MOVSXD RDI,EDI CMP RDI,RCX JNC 0x00101c82 MOVZX EDX,byte ptr [RSI + RDI*0x1] SUB EDX,0x61 CMP DL,0x1a ADC EAX,0x0 RET LAB_00101c80: XOR EAX,EAX LAB_00101c82: RET LAB_00101c83: PXOR XMM1,XMM1 XOR EDI,EDI XOR EAX,EAX XOR EDX,EDX JMP 0x00101b26 LAB_00101c92: RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ /* func0(std::string const&) */ int func0(string *param_1) { ulong uVar1; char *pcVar2; bool bVar3; bool bVar4; bool bVar5; bool bVar6; bool bVar7; bool bVar8; bool bVar9; bool bVar10; bool bVar11; bool bVar12; bool bVar13; bool bVar14; bool bVar15; bool bVar16; bool bVar17; bool bVar18; char *pcVar19; char *pcVar20; char *pcVar21; char *pcVar22; char *pcVar23; char *pcVar24; char *pcVar25; char *pcVar26; char *pcVar27; char *pcVar28; char *pcVar29; char *pcVar30; char *pcVar31; char *pcVar32; char *pcVar33; int auVar34 [14]; int auVar35 [12]; unkbyte10 Var36; int auVar37 [12]; int auVar38 [14]; int auVar39 [12]; int auVar40 [16]; int auVar41 [16]; int auVar42 [16]; int auVar43 [12]; unkbyte9 Var44; int6 uVar45; int4 uVar46; int2 uVar47; char *pcVar48; ulong uVar49; uint uVar50; ulong uVar51; byte bVar52; short sVar53; int4 uVar54; int iVar55; byte bVar78; byte bVar80; byte bVar84; byte bVar89; int auVar58 [11]; int auVar60 [12]; int auVar62 [12]; byte bVar79; byte bVar81; short sVar83; byte bVar86; char cVar88; int auVar66 [16]; int auVar68 [16]; int auVar75 [16]; int iVar91; int iVar92; int iVar93; int iVar94; int iVar95; char cVar100; char cVar101; char cVar102; char cVar103; char cVar104; char cVar105; short sVar106; short sVar107; int auVar97 [16]; int auVar98 [16]; int auVar108 [16]; int auVar115 [16]; int auVar118 [16]; int auVar122 [16]; int auVar125 [16]; int auVar130 [16]; int6 uVar56; int8 uVar57; int auVar69 [16]; int auVar59 [12]; int auVar70 [16]; int auVar76 [16]; int auVar61 [12]; int auVar71 [16]; int auVar64 [14]; int auVar67 [16]; int auVar63 [13]; int auVar72 [16]; int auVar77 [16]; int auVar65 [14]; int auVar73 [16]; int auVar74 [16]; char cVar82; char cVar85; char cVar87; long lVar90; int auVar96 [12]; int auVar99 [16]; int auVar119 [16]; int auVar109 [16]; int auVar110 [16]; int auVar116 [16]; int auVar120 [16]; int auVar111 [16]; int auVar112 [16]; int auVar117 [16]; int auVar121 [16]; int auVar113 [16]; int auVar114 [16]; int auVar123 [16]; int auVar124 [16]; int auVar126 [16]; int auVar127 [16]; int auVar128 [16]; int auVar129 [16]; int auVar131 [16]; int auVar132 [16]; uVar1 = *(ulong *)(param_1 + 8); if (uVar1 == 0) { iVar55 = 0; } else { pcVar2 = *(char **)param_1; if (uVar1 - 1 < 0xf) { iVar93 = 0; iVar94 = 0; uVar50 = 0; iVar55 = 0; uVar49 = 0; } else { iVar91 = 0; iVar92 = 0; iVar93 = 0; iVar94 = 0; uVar49 = uVar1 & 0xfffffffffffffff0; pcVar48 = pcVar2; do { cVar88 = *pcVar48; pcVar19 = pcVar48 + 1; pcVar20 = pcVar48 + 2; pcVar21 = pcVar48 + 3; pcVar22 = pcVar48 + 4; pcVar23 = pcVar48 + 5; pcVar24 = pcVar48 + 6; pcVar25 = pcVar48 + 7; pcVar26 = pcVar48 + 8; pcVar27 = pcVar48 + 9; pcVar28 = pcVar48 + 10; pcVar29 = pcVar48 + 0xb; pcVar30 = pcVar48 + 0xc; pcVar31 = pcVar48 + 0xd; pcVar32 = pcVar48 + 0xe; pcVar33 = pcVar48 + 0xf; pcVar48 = pcVar48 + 0x10; auVar97[0] = cVar88 + (char)DAT_001020c0; auVar97[1] = *pcVar19 + DAT_001020c0._1_1_; auVar97[2] = *pcVar20 + DAT_001020c0._2_1_; auVar97[3] = *pcVar21 + DAT_001020c0._3_1_; auVar97[4] = *pcVar22 + DAT_001020c0._4_1_; auVar97[5] = *pcVar23 + DAT_001020c0._5_1_; auVar97[6] = *pcVar24 + DAT_001020c0._6_1_; auVar97[7] = *pcVar25 + DAT_001020c0._7_1_; auVar97[8] = *pcVar26 + UNK_001020c8; auVar97[9] = *pcVar27 + UNK_001020c9; auVar97[10] = *pcVar28 + UNK_001020ca; auVar97[0xb] = *pcVar29 + UNK_001020cb; auVar97[0xc] = *pcVar30 + UNK_001020cc; auVar97[0xd] = *pcVar31 + UNK_001020cd; auVar97[0xe] = *pcVar32 + UNK_001020ce; auVar97[0xf] = *pcVar33 + UNK_001020cf; auVar66 = psubusb(_DAT_001020d0,auVar97); bVar3 = auVar66[0] != '\0'; bVar4 = auVar66[1] != '\0'; bVar5 = auVar66[2] != '\0'; bVar6 = auVar66[3] != '\0'; bVar7 = auVar66[4] != '\0'; bVar8 = auVar66[5] != '\0'; bVar9 = auVar66[6] != '\0'; bVar10 = auVar66[7] != '\0'; bVar11 = auVar66[8] != '\0'; bVar12 = auVar66[9] != '\0'; bVar13 = auVar66[10] != '\0'; bVar14 = auVar66[0xb] != '\0'; bVar15 = auVar66[0xc] != '\0'; bVar16 = auVar66[0xd] != '\0'; bVar17 = auVar66[0xe] != '\0'; bVar18 = auVar66[0xf] != '\0'; cVar88 = -bVar10; uVar47 = CONCAT11(-bVar10,cVar88); uVar46 = CONCAT31(CONCAT21(uVar47,-bVar9),-bVar9); uVar45 = CONCAT51(CONCAT41(uVar46,-bVar8),-bVar8); Var44 = CONCAT72(CONCAT61(uVar45,-bVar7),CONCAT11(-bVar7,cVar88)); lVar90 = (long)((unkuint9)Var44 >> 8); Var36 = CONCAT91(CONCAT81(lVar90,-bVar6),-bVar6); auVar35._2_10_ = Var36; auVar35[1] = -bVar5; auVar35[0] = -bVar5; auVar34._2_12_ = auVar35; auVar34[1] = -bVar4; auVar34[0] = -bVar4; auVar98._0_2_ = CONCAT11(-bVar3,-bVar3); auVar98._2_14_ = auVar34; uVar54 = CONCAT13(-bVar12,CONCAT12(-bVar12,CONCAT11(-bVar11,-bVar11))); uVar56 = CONCAT15(-bVar13,CONCAT14(-bVar13,uVar54)); uVar57 = CONCAT17(-bVar14,CONCAT16(-bVar14,uVar56)); auVar59._0_10_ = CONCAT19(-bVar15,CONCAT18(-bVar15,uVar57)); auVar59[10] = -bVar16; auVar59[0xb] = -bVar16; auVar64[0xc] = -bVar17; auVar64._0_12_ = auVar59; auVar64[0xd] = -bVar17; auVar66[0xe] = -bVar18; auVar66._0_14_ = auVar64; auVar66[0xf] = -bVar18; sVar53 = (short)Var36; sVar83 = (short)((unkuint9)Var44 >> 8); sVar106 = (short)uVar45; sVar107 = (short)uVar46; auVar132._0_12_ = auVar98._0_12_; auVar132._12_2_ = sVar53; auVar132._14_2_ = -(ushort)(sVar53 < 0); auVar131._12_4_ = auVar132._12_4_; auVar131._0_10_ = auVar98._0_10_; auVar131._10_2_ = -(ushort)(auVar35._0_2_ < 0); auVar130._10_6_ = auVar131._10_6_; auVar130._0_8_ = auVar98._0_8_; auVar130._8_2_ = auVar35._0_2_; auVar37._4_8_ = auVar130._8_8_; auVar37._2_2_ = -(ushort)(auVar34._0_2_ < 0); auVar37._0_2_ = auVar34._0_2_; iVar95 = CONCAT22(-(ushort)(sVar83 < 0),sVar83); auVar96._0_8_ = CONCAT26(-(ushort)(sVar106 < 0),CONCAT24(sVar106,iVar95)); auVar96._8_2_ = sVar107; auVar96._10_2_ = -(ushort)(sVar107 < 0); auVar99._12_2_ = uVar47; auVar99._0_12_ = auVar96; auVar99._14_2_ = -(ushort)(lVar90 < 0); sVar53 = (short)((unkuint10)auVar59._0_10_ >> 0x40); auVar129._12_2_ = (short)((ulong)uVar57 >> 0x30); auVar129._0_12_ = auVar59; auVar129._14_2_ = -(ushort)bVar14; auVar128._12_4_ = auVar129._12_4_; auVar128._10_2_ = -(ushort)bVar13; auVar128._0_10_ = auVar59._0_10_; auVar127._10_6_ = auVar128._10_6_; auVar127._8_2_ = (short)((uint6)uVar56 >> 0x20); auVar127._0_8_ = uVar57; auVar126._8_8_ = auVar127._8_8_; auVar126._6_2_ = -(ushort)bVar12; auVar126._0_6_ = uVar56; auVar125._6_10_ = auVar126._6_10_; auVar125._4_2_ = (short)((uint)uVar54 >> 0x10); auVar125._0_4_ = uVar54; iVar55 = CONCAT22(-(ushort)(sVar53 < 0),sVar53); auVar60._0_8_ = CONCAT26(-(ushort)(auVar59._10_2_ < 0),CONCAT24(auVar59._10_2_,iVar55)); auVar60._8_2_ = auVar64._12_2_; auVar60._10_2_ = -(ushort)(auVar64._12_2_ < 0); auVar67._12_2_ = auVar66._14_2_; auVar67._0_12_ = auVar60; auVar67._14_2_ = -(ushort)(auVar66._14_2_ < 0); iVar91 = (((iVar91 - CONCAT22(-(ushort)bVar3,auVar98._0_2_)) - iVar95) - CONCAT22(-(ushort)bVar11,CONCAT11(-bVar11,-bVar11))) - iVar55; iVar92 = (((iVar92 - auVar37._0_4_) - (int)((ulong)auVar96._0_8_ >> 0x20)) - auVar125._4_4_) - (int)((ulong)auVar60._0_8_ >> 0x20); iVar93 = (((iVar93 - auVar130._8_4_) - auVar96._8_4_) - auVar127._8_4_) - auVar60._8_4_; iVar94 = (((iVar94 - auVar131._12_4_) - auVar99._12_4_) - auVar128._12_4_) - auVar67._12_4_; } while (pcVar2 + uVar49 != pcVar48); uVar50 = (uint)uVar1 & 0xfffffff0; iVar55 = iVar93 + iVar91 + iVar94 + iVar92; iVar93 = iVar93 + iVar91; iVar94 = iVar94 + iVar92; if (uVar1 == uVar49) { return iVar55; } } uVar51 = uVar1 - uVar49; if (6 < uVar51 - 1) { uVar57 = *(int8 *)(pcVar2 + uVar49); bVar52 = (char)uVar57 + (char)DAT_001020c0; bVar78 = (char)((ulong)uVar57 >> 8) + DAT_001020c0._1_1_; bVar79 = (char)((ulong)uVar57 >> 0x10) + DAT_001020c0._2_1_; bVar80 = (char)((ulong)uVar57 >> 0x18) + DAT_001020c0._3_1_; bVar81 = (char)((ulong)uVar57 >> 0x20) + DAT_001020c0._4_1_; bVar84 = (char)((ulong)uVar57 >> 0x28) + DAT_001020c0._5_1_; bVar86 = (char)((ulong)uVar57 >> 0x30) + DAT_001020c0._6_1_; bVar89 = (char)((ulong)uVar57 >> 0x38) + DAT_001020c0._7_1_; bVar3 = bVar52 == (byte)((bVar52 < (byte)DAT_001020e0) * bVar52 | (bVar52 >= (byte)DAT_001020e0) * (byte)DAT_001020e0); auVar68[0] = -bVar3; bVar4 = bVar78 == (byte)((bVar78 < DAT_001020e0._1_1_) * bVar78 | (bVar78 >= DAT_001020e0._1_1_) * DAT_001020e0._1_1_); cVar88 = -bVar4; bVar5 = bVar79 == (byte)((bVar79 < DAT_001020e0._2_1_) * bVar79 | (bVar79 >= DAT_001020e0._2_1_) * DAT_001020e0._2_1_); bVar6 = bVar80 == (byte)((bVar80 < DAT_001020e0._3_1_) * bVar80 | (bVar80 >= DAT_001020e0._3_1_) * DAT_001020e0._3_1_); bVar7 = bVar81 == (byte)((bVar81 < DAT_001020e0._4_1_) * bVar81 | (bVar81 >= DAT_001020e0._4_1_) * DAT_001020e0._4_1_); cVar82 = -bVar7; bVar8 = bVar84 == (byte)((bVar84 < DAT_001020e0._5_1_) * bVar84 | (bVar84 >= DAT_001020e0._5_1_) * DAT_001020e0._5_1_); cVar85 = -bVar8; bVar9 = bVar86 == (byte)((bVar86 < DAT_001020e0._6_1_) * bVar86 | (bVar86 >= DAT_001020e0._6_1_) * DAT_001020e0._6_1_); cVar87 = -bVar9; bVar10 = bVar89 == (byte)((bVar89 < DAT_001020e0._7_1_) * bVar89 | (bVar89 >= DAT_001020e0._7_1_) * DAT_001020e0._7_1_); bVar52 = -bVar10; auVar69._0_9_ = CONCAT18(0xff,(ulong)bVar52 << 0x38); auVar58._0_10_ = CONCAT19(0xff,auVar69._0_9_); auVar58[10] = 0xff; auVar61[0xb] = 0xff; auVar61._0_11_ = auVar58; auVar63[0xc] = 0xff; auVar63._0_12_ = auVar61; auVar65[0xd] = 0xff; auVar65._0_13_ = auVar63; cVar100 = -bVar4; cVar101 = -bVar6; cVar102 = -bVar7; cVar103 = -bVar8; cVar104 = -bVar9; cVar105 = -bVar10; auVar114[0xe] = bVar52; auVar114._0_14_ = auVar65; auVar114[0xf] = cVar105; auVar113._14_2_ = auVar114._14_2_; auVar113[0xd] = cVar104; auVar113._0_13_ = auVar63; auVar112._13_3_ = auVar113._13_3_; auVar112[0xc] = cVar87; auVar112._0_12_ = auVar61; auVar111._12_4_ = auVar112._12_4_; auVar111[0xb] = cVar103; auVar111._0_11_ = auVar58; auVar110._11_5_ = auVar111._11_5_; auVar110[10] = cVar85; auVar110._0_10_ = auVar58._0_10_; auVar109._10_6_ = auVar110._10_6_; auVar109[9] = cVar102; auVar109._0_9_ = auVar69._0_9_; Var36 = CONCAT91(CONCAT81((long)(CONCAT72(auVar109._9_7_,CONCAT11(cVar82,bVar52)) >> 8), cVar101),-bVar6); auVar39._2_10_ = Var36; auVar39[1] = -bVar5; auVar39[0] = -bVar5; auVar38._2_12_ = auVar39; auVar38[1] = cVar100; auVar38[0] = cVar88; auVar108._0_2_ = CONCAT11(-bVar3,auVar68[0]); auVar108._2_14_ = auVar38; auVar74[0xe] = bVar52; auVar74._0_14_ = auVar65; auVar74[0xf] = cVar105; auVar73._14_2_ = auVar74._14_2_; auVar73[0xd] = cVar104; auVar73._0_13_ = auVar63; auVar72._13_3_ = auVar73._13_3_; auVar72[0xc] = cVar87; auVar72._0_12_ = auVar61; auVar71._12_4_ = auVar72._12_4_; auVar71[0xb] = cVar103; auVar71._0_11_ = auVar58; auVar70._11_5_ = auVar71._11_5_; auVar70[10] = cVar85; auVar70._0_10_ = auVar58._0_10_; auVar69._10_6_ = auVar70._10_6_; auVar69[9] = cVar102; Var44 = CONCAT72(auVar69._9_7_,CONCAT11(cVar82,bVar52)); lVar90 = (long)((unkuint9)Var44 >> 8); auVar42._1_8_ = lVar90; auVar42[0] = cVar101; auVar42._9_7_ = 0; auVar41._10_6_ = 0; auVar41._0_10_ = SUB1610(auVar42 << 0x38,6); auVar40._11_5_ = 0; auVar40._0_11_ = SUB1611(auVar41 << 0x30,5); auVar68._4_12_ = SUB1612(auVar40 << 0x28,4); auVar68[3] = cVar100; auVar68[2] = cVar88; auVar68[1] = -bVar3; iVar55 = (int)((unkuint9)Var44 >> 8); auVar62._8_4_ = auVar68._0_4_; auVar62._0_8_ = lVar90; sVar106 = auVar39._0_2_; sVar107 = (short)Var36; sVar53 = (short)((unkuint9)Var44 >> 8); sVar83 = auVar72._12_2_; auVar124._0_12_ = auVar108._0_12_; auVar124._12_2_ = sVar107; auVar124._14_2_ = -(ushort)(sVar107 < 0); auVar123._12_4_ = auVar124._12_4_; auVar123._0_10_ = auVar108._0_10_; auVar123._10_2_ = -(ushort)(sVar106 < 0); auVar122._10_6_ = auVar123._10_6_; auVar122._0_8_ = auVar108._0_8_; auVar122._8_2_ = sVar106; auVar43._4_8_ = auVar122._8_8_; auVar43._2_2_ = -(ushort)(auVar38._0_2_ < 0); auVar43._0_2_ = auVar38._0_2_; auVar117._12_2_ = sVar107; auVar117._0_12_ = auVar124._0_12_; auVar117._14_2_ = -(ushort)(sVar107 < 0); auVar116._12_4_ = auVar117._12_4_; auVar116._10_2_ = -(ushort)(sVar106 < 0); auVar116._0_10_ = auVar123._0_10_; auVar115._10_6_ = auVar116._10_6_; auVar115._8_2_ = sVar106; auVar115._0_8_ = auVar122._0_8_; auVar77._12_2_ = auVar73._14_2_; auVar77._0_12_ = auVar62; auVar77._14_2_ = -(ushort)(lVar90 < 0); auVar76._12_4_ = auVar77._12_4_; auVar76._0_10_ = auVar62._0_10_; auVar76._10_2_ = -(ushort)(sVar83 < 0); auVar75._10_6_ = auVar76._10_6_; auVar75._8_2_ = sVar83; auVar75._0_8_ = lVar90; auVar121._12_2_ = auVar73._14_2_; auVar121._0_12_ = auVar62; auVar121._14_2_ = -(ushort)(lVar90 < 0); auVar120._12_4_ = auVar121._12_4_; auVar120._10_2_ = -(ushort)(sVar83 < 0); auVar120._0_10_ = auVar76._0_10_; auVar119._10_6_ = auVar120._10_6_; auVar119._8_2_ = sVar83; auVar119._0_8_ = lVar90; auVar118._8_8_ = auVar119._8_8_; auVar118._6_2_ = -(ushort)(iVar55 < 0); auVar118._4_2_ = auVar70._10_2_; auVar118._0_4_ = iVar55; iVar55 = ((((iVar94 - auVar43._0_4_) - auVar116._12_4_) - auVar118._4_4_) - auVar76._12_4_) + ((((iVar93 - CONCAT22(-(ushort)bVar3,auVar108._0_2_)) - auVar115._8_4_) - CONCAT22(-(ushort)(sVar53 < 0),sVar53)) - auVar75._8_4_); uVar49 = uVar49 + (uVar51 & 0xfffffffffffffff8); uVar50 = uVar50 + (int)(uVar51 & 0xfffffffffffffff8); if ((uVar51 & 7) == 0) { return iVar55; } } iVar55 = iVar55 + (uint)((byte)(pcVar2[uVar49] + 0x9fU) < 0x1a); if ((ulong)(long)(int)(uVar50 + 1) < uVar1) { iVar55 = iVar55 + (uint)((byte)(pcVar2[(int)(uVar50 + 1)] + 0x9fU) < 0x1a); if ((ulong)(long)(int)(uVar50 + 2) < uVar1) { iVar55 = iVar55 + (uint)((byte)(pcVar2[(int)(uVar50 + 2)] + 0x9fU) < 0x1a); if ((ulong)(long)(int)(uVar50 + 3) < uVar1) { iVar55 = iVar55 + (uint)((byte)(pcVar2[(int)(uVar50 + 3)] + 0x9fU) < 0x1a); if ((ulong)(long)(int)(uVar50 + 4) < uVar1) { iVar55 = iVar55 + (uint)((byte)(pcVar2[(int)(uVar50 + 4)] + 0x9fU) < 0x1a); if ((ulong)(long)(int)(uVar50 + 5) < uVar1) { iVar55 = iVar55 + (uint)((byte)(pcVar2[(int)(uVar50 + 5)] + 0x9fU) < 0x1a); if ((ulong)(long)(int)(uVar50 + 6) < uVar1) { return iVar55 + (uint)((byte)(pcVar2[(int)(uVar50 + 6)] + 0x9fU) < 0x1a); } } } } } } } return iVar55; }
3,272
func0
#include <vector> #include <cassert>
std::pair<std::vector<int>, std::vector<int>> func0(const std::vector<int>& lists) { std::vector<int> elements; std::vector<int> frequencies; if (lists.empty()) { return std::make_pair(elements, frequencies); } int running_count = 1; for (size_t i = 0; i < lists.size() - 1; ++i) { if (lists[i] == lists[i + 1]) { running_count++; } else { frequencies.push_back(running_count); elements.push_back(lists[i]); running_count = 1; } } frequencies.push_back(running_count); elements.push_back(lists[lists.size() - 1]); return std::make_pair(elements, frequencies); }
int main() { assert((func0({1,2,2,2,4,4,4,5,5,5,5}) == std::make_pair(std::vector<int>{1, 2, 4, 5}, std::vector<int>{1, 3, 3, 4}))); assert((func0({2,2,3,1,2,6,7,9}) == std::make_pair(std::vector<int>{2, 3, 1, 2, 6, 7, 9}, std::vector<int>{2, 1, 1, 1, 1, 1, 1}))); assert((func0({2,1,5,6,8,3,4,9,10,11,8,12}) == std::make_pair(std::vector<int>{2, 1, 5, 6, 8, 3, 4, 9, 10, 11, 8, 12}, std::vector<int>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}))); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> > const&): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x68,%rsp mov %rdi,-0x68(%rbp) mov %rsi,-0x70(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax lea -0x50(%rbp),%rax mov %rax,%rdi callq 1f66 <_ZNSt6vectorIiSaIiEEC1Ev> lea -0x30(%rbp),%rax mov %rax,%rdi callq 1f66 <_ZNSt6vectorIiSaIiEEC1Ev> mov -0x70(%rbp),%rax mov %rax,%rdi callq 209c <_ZNKSt6vectorIiSaIiEE5emptyEv> test %al,%al je 12b1 <_Z5func0RKSt6vectorIiSaIiEE+0x68> mov -0x68(%rbp),%rax lea -0x30(%rbp),%rdx lea -0x50(%rbp),%rcx mov %rcx,%rsi mov %rax,%rdi callq 2104 <_ZSt9make_pairIRSt6vectorIiSaIiEES3_ESt4pairINSt17__decay_and_stripIT_E6__typeENS5_IT0_E6__typeEEOS6_OS9_> jmpq 13c5 <_Z5func0RKSt6vectorIiSaIiEE+0x17c> movl $0x1,-0x5c(%rbp) movq $0x0,-0x58(%rbp) mov -0x70(%rbp),%rax mov %rax,%rdi callq 2158 <_ZNKSt6vectorIiSaIiEE4sizeEv> sub $0x1,%rax cmp %rax,-0x58(%rbp) setb %al test %al,%al je 136a <_Z5func0RKSt6vectorIiSaIiEE+0x121> mov -0x58(%rbp),%rdx mov -0x70(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 2180 <_ZNKSt6vectorIiSaIiEEixEm> mov (%rax),%ebx mov -0x58(%rbp),%rax lea 0x1(%rax),%rdx mov -0x70(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 2180 <_ZNKSt6vectorIiSaIiEEixEm> mov (%rax),%eax cmp %eax,%ebx sete %al test %al,%al je 1321 <_Z5func0RKSt6vectorIiSaIiEE+0xd8> mov -0x5c(%rbp),%eax add $0x1,%eax mov %eax,-0x5c(%rbp) jmp 1360 <_Z5func0RKSt6vectorIiSaIiEE+0x117> lea -0x5c(%rbp),%rdx lea -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 21a4 <_ZNSt6vectorIiSaIiEE9push_backERKi> mov -0x58(%rbp),%rdx mov -0x70(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 2180 <_ZNKSt6vectorIiSaIiEEixEm> mov %rax,%rdx lea -0x50(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 21a4 <_ZNSt6vectorIiSaIiEE9push_backERKi> movl $0x1,-0x5c(%rbp) addq $0x1,-0x58(%rbp) jmpq 12c0 <_Z5func0RKSt6vectorIiSaIiEE+0x77> lea -0x5c(%rbp),%rdx lea -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 21a4 <_ZNSt6vectorIiSaIiEE9push_backERKi> mov -0x70(%rbp),%rax mov %rax,%rdi callq 2158 <_ZNKSt6vectorIiSaIiEE4sizeEv> lea -0x1(%rax),%rdx mov -0x70(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 2180 <_ZNKSt6vectorIiSaIiEEixEm> mov %rax,%rdx lea -0x50(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 21a4 <_ZNSt6vectorIiSaIiEE9push_backERKi> mov -0x68(%rbp),%rax lea -0x30(%rbp),%rdx lea -0x50(%rbp),%rcx mov %rcx,%rsi mov %rax,%rdi callq 2104 <_ZSt9make_pairIRSt6vectorIiSaIiEES3_ESt4pairINSt17__decay_and_stripIT_E6__typeENS5_IT0_E6__typeEEOS6_OS9_> lea -0x30(%rbp),%rax mov %rax,%rdi callq 2054 <_ZNSt6vectorIiSaIiEED1Ev> lea -0x50(%rbp),%rax mov %rax,%rdi callq 2054 <_ZNSt6vectorIiSaIiEED1Ev> mov -0x18(%rbp),%rax xor %fs:0x28,%rax je 141d <_Z5func0RKSt6vectorIiSaIiEE+0x1d4> jmp 1418 <_Z5func0RKSt6vectorIiSaIiEE+0x1cf> endbr64 mov %rax,%rbx lea -0x30(%rbp),%rax mov %rax,%rdi callq 2054 <_ZNSt6vectorIiSaIiEED1Ev> lea -0x50(%rbp),%rax mov %rax,%rdi callq 2054 <_ZNSt6vectorIiSaIiEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 1150 <_Unwind_Resume@plt> callq 1130 <__stack_chk_fail@plt> mov -0x68(%rbp),%rax add $0x68,%rsp pop %rbx pop %rbp retq
_Z5func0RKSt6vectorIiSaIiEE: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 68h mov [rbp+var_68], rdi mov [rbp+var_70], rsi mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax lea rax, [rbp+var_50] mov rdi, rax call _ZNSt6vectorIiSaIiEEC2Ev; std::vector<int>::vector(void) lea rax, [rbp+var_30] mov rdi, rax call _ZNSt6vectorIiSaIiEEC2Ev; std::vector<int>::vector(void) mov rax, [rbp+var_70] mov rdi, rax call _ZNKSt6vectorIiSaIiEE5emptyEv; std::vector<int>::empty(void) test al, al jz short loc_12D1 mov rax, [rbp+var_68] lea rdx, [rbp+var_30] lea rcx, [rbp+var_50] mov rsi, rcx mov rdi, rax call _ZSt9make_pairIRSt6vectorIiSaIiEES3_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS5_INS6_IT0_E4typeEE6__typeEEOS7_OSC_; std::make_pair<std::vector<int> &,std::vector<int> &>(std::vector<int> &&&,std::vector<int> &&&) jmp loc_13E5 loc_12D1: mov [rbp+var_5C], 1 mov [rbp+var_58], 0 jmp loc_136B loc_12E5: mov rdx, [rbp+var_58] mov rax, [rbp+var_70] mov rsi, rdx mov rdi, rax call _ZNKSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov ebx, [rax] mov rax, [rbp+var_58] lea rdx, [rax+1] mov rax, [rbp+var_70] mov rsi, rdx mov rdi, rax call _ZNKSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] cmp ebx, eax setz al test al, al jz short loc_1327 mov eax, [rbp+var_5C] add eax, 1 mov [rbp+var_5C], eax jmp short loc_1366 loc_1327: lea rdx, [rbp+var_5C] lea rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEE9push_backERKi; std::vector<int>::push_back(int const&) mov rdx, [rbp+var_58] mov rax, [rbp+var_70] mov rsi, rdx mov rdi, rax call _ZNKSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov rdx, rax lea rax, [rbp+var_50] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEE9push_backERKi; std::vector<int>::push_back(int const&) mov [rbp+var_5C], 1 loc_1366: add [rbp+var_58], 1 loc_136B: mov rax, [rbp+var_70] mov rdi, rax call _ZNKSt6vectorIiSaIiEE4sizeEv; std::vector<int>::size(void) sub rax, 1 cmp [rbp+var_58], rax setb al test al, al jnz loc_12E5 lea rdx, [rbp+var_5C] lea rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEE9push_backERKi; std::vector<int>::push_back(int const&) mov rax, [rbp+var_70] mov rdi, rax call _ZNKSt6vectorIiSaIiEE4sizeEv; std::vector<int>::size(void) lea rdx, [rax-1] mov rax, [rbp+var_70] mov rsi, rdx mov rdi, rax call _ZNKSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov rdx, rax lea rax, [rbp+var_50] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEE9push_backERKi; std::vector<int>::push_back(int const&) mov rax, [rbp+var_68] lea rdx, [rbp+var_30] lea rcx, [rbp+var_50] mov rsi, rcx mov rdi, rax call _ZSt9make_pairIRSt6vectorIiSaIiEES3_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS5_INS6_IT0_E4typeEE6__typeEEOS7_OSC_; std::make_pair<std::vector<int> &,std::vector<int> &>(std::vector<int> &&&,std::vector<int> &&&) loc_13E5: lea rax, [rbp+var_30] mov rdi, rax call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() lea rax, [rbp+var_50] mov rdi, rax call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() mov rax, [rbp+var_18] sub rax, fs:28h jz short loc_1451 jmp short loc_144C endbr64 mov rbx, rax lea rax, [rbp+var_30] mov rdi, rax call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() lea rax, [rbp+var_50] mov rdi, rax call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() mov rax, rbx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_1444 call ___stack_chk_fail loc_1444: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_144C: call ___stack_chk_fail loc_1451: mov rax, [rbp+var_68] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, long long a2) { int v2; // ebx long long v3; // rax long long v4; // rax long long v5; // rax long long v6; // rax int v8; // [rsp+14h] [rbp-5Ch] BYREF unsigned long long i; // [rsp+18h] [rbp-58h] _BYTE v10[32]; // [rsp+20h] [rbp-50h] BYREF _BYTE v11[24]; // [rsp+40h] [rbp-30h] BYREF unsigned long long v12; // [rsp+58h] [rbp-18h] v12 = __readfsqword(0x28u); std::vector<int>::vector(v10); std::vector<int>::vector(v11); if ( (unsigned __int8)std::vector<int>::empty(a2) ) { std::make_pair<std::vector<int> &,std::vector<int> &>(a1, v10, v11); } else { v8 = 1; for ( i = 0LL; ; ++i ) { v4 = std::vector<int>::size(a2); if ( i >= v4 - 1 ) break; v2 = *(_DWORD *)std::vector<int>::operator[](a2, i); if ( v2 == *(_DWORD *)std::vector<int>::operator[](a2, i + 1) ) { ++v8; } else { std::vector<int>::push_back(v11, &v8); v3 = std::vector<int>::operator[](a2, i); std::vector<int>::push_back(v10, v3); v8 = 1; } } std::vector<int>::push_back(v11, &v8); v5 = std::vector<int>::size(a2); v6 = std::vector<int>::operator[](a2, v5 - 1); std::vector<int>::push_back(v10, v6); std::make_pair<std::vector<int> &,std::vector<int> &>(a1, v10, v11); } std::vector<int>::~vector(v11); std::vector<int>::~vector(v10); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x68 MOV qword ptr [RBP + -0x68],RDI MOV qword ptr [RBP + -0x70],RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x00102002 LEA RAX,[RBP + -0x30] MOV RDI,RAX CALL 0x00102002 MOV RAX,qword ptr [RBP + -0x70] MOV RDI,RAX CALL 0x00102130 TEST AL,AL JZ 0x001012d1 MOV RAX,qword ptr [RBP + -0x68] LEA RDX,[RBP + -0x30] LEA RCX,[RBP + -0x50] MOV RSI,RCX MOV RDI,RAX LAB_001012c7: CALL 0x00102198 JMP 0x001013e5 LAB_001012d1: MOV dword ptr [RBP + -0x5c],0x1 MOV qword ptr [RBP + -0x58],0x0 JMP 0x0010136b LAB_001012e5: MOV RDX,qword ptr [RBP + -0x58] MOV RAX,qword ptr [RBP + -0x70] MOV RSI,RDX MOV RDI,RAX CALL 0x00102214 MOV EBX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x58] LEA RDX,[RAX + 0x1] MOV RAX,qword ptr [RBP + -0x70] MOV RSI,RDX MOV RDI,RAX CALL 0x00102214 MOV EAX,dword ptr [RAX] CMP EBX,EAX SETZ AL TEST AL,AL JZ 0x00101327 MOV EAX,dword ptr [RBP + -0x5c] ADD EAX,0x1 MOV dword ptr [RBP + -0x5c],EAX JMP 0x00101366 LAB_00101327: LEA RDX,[RBP + -0x5c] LEA RAX,[RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00102238 MOV RDX,qword ptr [RBP + -0x58] MOV RAX,qword ptr [RBP + -0x70] MOV RSI,RDX MOV RDI,RAX CALL 0x00102214 MOV RDX,RAX LEA RAX,[RBP + -0x50] MOV RSI,RDX MOV RDI,RAX CALL 0x00102238 MOV dword ptr [RBP + -0x5c],0x1 LAB_00101366: ADD qword ptr [RBP + -0x58],0x1 LAB_0010136b: MOV RAX,qword ptr [RBP + -0x70] MOV RDI,RAX CALL 0x001021ec SUB RAX,0x1 CMP qword ptr [RBP + -0x58],RAX SETC AL TEST AL,AL JNZ 0x001012e5 LEA RDX,[RBP + -0x5c] LEA RAX,[RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00102238 MOV RAX,qword ptr [RBP + -0x70] MOV RDI,RAX CALL 0x001021ec LEA RDX,[RAX + -0x1] MOV RAX,qword ptr [RBP + -0x70] MOV RSI,RDX MOV RDI,RAX CALL 0x00102214 MOV RDX,RAX LEA RAX,[RBP + -0x50] MOV RSI,RDX MOV RDI,RAX CALL 0x00102238 MOV RAX,qword ptr [RBP + -0x68] LEA RDX,[RBP + -0x30] LEA RCX,[RBP + -0x50] MOV RSI,RCX MOV RDI,RAX CALL 0x00102198 LAB_001013e5: LEA RAX,[RBP + -0x30] MOV RDI,RAX CALL 0x001020d6 LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001020d6 MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x00101451 JMP 0x0010144c LAB_0010144c: CALL 0x00101150 LAB_00101451: MOV RAX,qword ptr [RBP + -0x68] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::vector<int, std::allocator<int> > const&) */ vector * func0(vector *param_1) { int iVar1; char cVar2; long lVar3; int *piVar4; vector<int,std::allocator<int>> *in_RSI; long in_FS_OFFSET; int local_64; ulong local_60; vector<int,std::allocator<int>> local_58 [32]; vector<int,std::allocator<int>> local_38 [24]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); std::vector<int,std::allocator<int>>::vector(local_58); std::vector<int,std::allocator<int>>::vector(local_38); cVar2 = std::vector<int,std::allocator<int>>::empty(in_RSI); if (cVar2 == '\0') { local_64 = 1; local_60 = 0; while( true ) { lVar3 = std::vector<int,std::allocator<int>>::size(in_RSI); if (lVar3 - 1U <= local_60) break; piVar4 = (int *)std::vector<int,std::allocator<int>>::operator[](in_RSI,local_60); iVar1 = *piVar4; piVar4 = (int *)std::vector<int,std::allocator<int>>::operator[](in_RSI,local_60 + 1); if (iVar1 == *piVar4) { local_64 = local_64 + 1; } else { std::vector<int,std::allocator<int>>::push_back(local_38,&local_64); piVar4 = (int *)std::vector<int,std::allocator<int>>::operator[](in_RSI,local_60); std::vector<int,std::allocator<int>>::push_back(local_58,piVar4); local_64 = 1; } local_60 = local_60 + 1; } std::vector<int,std::allocator<int>>::push_back(local_38,&local_64); lVar3 = std::vector<int,std::allocator<int>>::size(in_RSI); piVar4 = (int *)std::vector<int,std::allocator<int>>::operator[](in_RSI,lVar3 - 1); std::vector<int,std::allocator<int>>::push_back(local_58,piVar4); std::make_pair<std::vector<int,std::allocator<int>>&,std::vector<int,std::allocator<int>>&> (param_1,(vector *)local_58); } else { /* try { // try from 001012c7 to 001013e4 has its CatchHandler @ 0010140e */ std::make_pair<std::vector<int,std::allocator<int>>&,std::vector<int,std::allocator<int>>&> (param_1,(vector *)local_58); } std::vector<int,std::allocator<int>>::~vector(local_38); std::vector<int,std::allocator<int>>::~vector(local_58); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
3,273
func0
#include <vector> #include <cassert>
std::pair<std::vector<int>, std::vector<int>> func0(const std::vector<int>& lists) { std::vector<int> elements; std::vector<int> frequencies; if (lists.empty()) { return std::make_pair(elements, frequencies); } int running_count = 1; for (size_t i = 0; i < lists.size() - 1; ++i) { if (lists[i] == lists[i + 1]) { running_count++; } else { frequencies.push_back(running_count); elements.push_back(lists[i]); running_count = 1; } } frequencies.push_back(running_count); elements.push_back(lists[lists.size() - 1]); return std::make_pair(elements, frequencies); }
int main() { assert((func0({1,2,2,2,4,4,4,5,5,5,5}) == std::make_pair(std::vector<int>{1, 2, 4, 5}, std::vector<int>{1, 3, 3, 4}))); assert((func0({2,2,3,1,2,6,7,9}) == std::make_pair(std::vector<int>{2, 3, 1, 2, 6, 7, 9}, std::vector<int>{2, 1, 1, 1, 1, 1, 1}))); assert((func0({2,1,5,6,8,3,4,9,10,11,8,12}) == std::make_pair(std::vector<int>{2, 1, 5, 6, 8, 3, 4, 9, 10, 11, 8, 12}, std::vector<int>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}))); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> > const&): endbr64 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x50,%rsp mov %rdi,%r12 mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax movq $0x0,0x10(%rsp) movq $0x0,0x18(%rsp) movq $0x0,0x20(%rsp) movq $0x0,0x30(%rsp) movq $0x0,0x38(%rsp) movq $0x0,0x40(%rsp) mov 0x8(%rsi),%rax mov (%rsi),%rdx cmp %rax,%rdx je 1309 <_Z5func0RKSt6vectorIiSaIiEE+0xa0> mov %rsi,%rbp movl $0x1,0xc(%rsp) sub %rdx,%rax mov $0x0,%ebx lea 0x10(%rsp),%r13 mov $0x0,%esi cmp $0x4,%rax jne 1392 <_Z5func0RKSt6vectorIiSaIiEE+0x129> lea 0xc(%rsp),%rdx lea 0x30(%rsp),%rdi callq 2004 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> jmpq 13ea <_Z5func0RKSt6vectorIiSaIiEE+0x181> movq $0x0,(%rdi) movq $0x0,0x8(%rdi) movq $0x0,0x10(%rdi) movq $0x0,0x18(%rdi) movq $0x0,0x20(%rdi) movq $0x0,0x28(%rdi) jmpq 1588 <_Z5func0RKSt6vectorIiSaIiEE+0x31f> mov 0x38(%rsp),%rsi cmp 0x40(%rsp),%rsi je 13b0 <_Z5func0RKSt6vectorIiSaIiEE+0x147> mov 0xc(%rsp),%eax mov %eax,(%rsi) addq $0x4,0x38(%rsp) mov %r14,%rdx add 0x0(%rbp),%rdx mov 0x18(%rsp),%rsi cmp 0x20(%rsp),%rsi je 13c1 <_Z5func0RKSt6vectorIiSaIiEE+0x158> mov (%rdx),%eax mov %eax,(%rsi) addq $0x4,0x18(%rsp) movl $0x1,0xc(%rsp) mov 0x0(%rbp),%rdx mov 0x8(%rbp),%rax sub %rdx,%rax sar $0x2,%rax sub $0x1,%rax cmp %rbx,%rax jbe 13cb <_Z5func0RKSt6vectorIiSaIiEE+0x162> lea 0x0(,%rbx,4),%r14 add $0x1,%rbx mov 0x4(%rdx,%r14,1),%eax cmp %eax,(%rdx,%r14,1) jne 133d <_Z5func0RKSt6vectorIiSaIiEE+0xd4> addl $0x1,0xc(%rsp) jmp 137a <_Z5func0RKSt6vectorIiSaIiEE+0x111> lea 0xc(%rsp),%rdx lea 0x30(%rsp),%rdi callq 2004 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> jmp 1355 <_Z5func0RKSt6vectorIiSaIiEE+0xec> mov %r13,%rdi callq 2004 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> jmp 1372 <_Z5func0RKSt6vectorIiSaIiEE+0x109> mov 0x38(%rsp),%rax mov 0x40(%rsp),%rsi cmp %rsi,%rax je 12f5 <_Z5func0RKSt6vectorIiSaIiEE+0x8c> mov 0xc(%rsp),%edx mov %edx,(%rax) addq $0x4,0x38(%rsp) mov 0x8(%rbp),%rax lea -0x4(%rax),%rdx mov 0x18(%rsp),%rsi cmp 0x20(%rsp),%rsi je 1452 <_Z5func0RKSt6vectorIiSaIiEE+0x1e9> mov (%rdx),%eax mov %eax,(%rsi) addq $0x4,0x18(%rsp) mov 0x18(%rsp),%rbp sub 0x10(%rsp),%rbp movq $0x0,(%r12) movq $0x0,0x8(%r12) movq $0x0,0x10(%r12) mov %rbp,%rax sar $0x2,%rax je 14f6 <_Z5func0RKSt6vectorIiSaIiEE+0x28d> movabs $0x1fffffffffffffff,%rdx cmp %rdx,%rax ja 145e <_Z5func0RKSt6vectorIiSaIiEE+0x1f5> mov %rbp,%rdi callq 1140 <_Znwm@plt> jmp 146f <_Z5func0RKSt6vectorIiSaIiEE+0x206> lea 0x10(%rsp),%rdi callq 2004 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> jmp 1408 <_Z5func0RKSt6vectorIiSaIiEE+0x19f> callq 10e0 <_ZSt17__throw_bad_allocv@plt> endbr64 mov %rax,%rbx jmpq 151a <_Z5func0RKSt6vectorIiSaIiEE+0x2b1> mov %rax,%rbx mov %rbx,(%r12) mov %rbx,0x8(%r12) add %rbx,%rbp mov %rbp,0x10(%r12) mov 0x18(%rsp),%rax mov 0x10(%rsp),%rsi mov %rax,%rbp sub %rsi,%rbp cmp %rsi,%rax je 14a3 <_Z5func0RKSt6vectorIiSaIiEE+0x23a> mov %rbp,%rdx mov %rbx,%rdi callq 1160 <memmove@plt> add %rbp,%rbx mov %rbx,0x8(%r12) mov 0x38(%rsp),%rbx sub 0x30(%rsp),%rbx movq $0x0,0x18(%r12) movq $0x0,0x20(%r12) movq $0x0,0x28(%r12) mov %rbx,%rax sar $0x2,%rax je 15b7 <_Z5func0RKSt6vectorIiSaIiEE+0x34e> movabs $0x1fffffffffffffff,%rdx cmp %rdx,%rax ja 1500 <_Z5func0RKSt6vectorIiSaIiEE+0x297> mov %rbx,%rdi callq 1140 <_Znwm@plt> jmp 1540 <_Z5func0RKSt6vectorIiSaIiEE+0x2d7> mov $0x0,%ebx jmpq 1472 <_Z5func0RKSt6vectorIiSaIiEE+0x209> callq 10e0 <_ZSt17__throw_bad_allocv@plt> endbr64 mov %rax,%rbx mov (%r12),%rdi test %rdi,%rdi je 151a <_Z5func0RKSt6vectorIiSaIiEE+0x2b1> callq 1130 <_ZdlPv@plt> mov 0x30(%rsp),%rdi test %rdi,%rdi je 1529 <_Z5func0RKSt6vectorIiSaIiEE+0x2c0> callq 1130 <_ZdlPv@plt> mov 0x10(%rsp),%rdi test %rdi,%rdi je 1538 <_Z5func0RKSt6vectorIiSaIiEE+0x2cf> callq 1130 <_ZdlPv@plt> mov %rbx,%rdi callq 1170 <_Unwind_Resume@plt> mov %rax,%rbp mov %rbp,0x18(%r12) mov %rbp,0x20(%r12) add %rbp,%rbx mov %rbx,0x28(%r12) mov 0x38(%rsp),%rax mov 0x30(%rsp),%rbx mov %rax,%r13 sub %rbx,%r13 cmp %rbx,%rax je 15be <_Z5func0RKSt6vectorIiSaIiEE+0x355> mov %r13,%rdx mov %rbx,%rsi mov %rbp,%rdi callq 1160 <memmove@plt> add %r13,%rbp mov %rbp,0x20(%r12) mov %rbx,%rdi callq 1130 <_ZdlPv@plt> mov 0x10(%rsp),%rdi test %rdi,%rdi je 1597 <_Z5func0RKSt6vectorIiSaIiEE+0x32e> callq 1130 <_ZdlPv@plt> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 15cd <_Z5func0RKSt6vectorIiSaIiEE+0x364> mov %r12,%rax add $0x50,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq mov $0x0,%ebp jmp 1543 <_Z5func0RKSt6vectorIiSaIiEE+0x2da> add %r13,%rbp mov %rbp,0x20(%r12) test %rbx,%rbx je 1588 <_Z5func0RKSt6vectorIiSaIiEE+0x31f> jmp 1580 <_Z5func0RKSt6vectorIiSaIiEE+0x317> callq 1150 <__stack_chk_fail@plt>
_Z5func0RKSt6vectorIiSaIiEE: endbr64 push r14 push r13 push r12 push rbp push rbx sub rsp, 50h mov r12, rdi mov rax, fs:28h mov [rsp+78h+var_30], rax xor eax, eax mov [rsp+78h+src], 0 mov [rsp+78h+var_60], 0 mov [rsp+78h+var_58], 0 mov [rsp+78h+var_48], 0 mov [rsp+78h+var_40], 0 mov [rsp+78h+var_38], 0 mov rdx, [rsi] cmp rdx, [rsi+8] jz short loc_12F7 mov rbp, rsi mov [rsp+78h+var_6C], 1 mov rax, [rsi+8] sub rax, rdx cmp rax, 4 jz loc_1444 mov ebx, 0 mov r13d, 1 jmp loc_1383 loc_12F7: mov qword ptr [rdi], 0 mov qword ptr [rdi+8], 0 mov qword ptr [rdi+10h], 0 mov qword ptr [rdi+18h], 0 mov qword ptr [rdi+20h], 0 mov qword ptr [rdi+28h], 0 jmp loc_1597 loc_132B: mov rsi, [rsp+78h+var_40] cmp rsi, [rsp+78h+var_38] jz short loc_13A3 mov eax, [rsp+78h+var_6C] mov [rsi], eax add rsi, 4 mov [rsp+78h+var_40], rsi loc_1346: add r14, [rbp+0] mov rsi, [rsp+78h+var_60] cmp rsi, [rsp+78h+var_58] jz short loc_13B4 mov eax, [r14] mov [rsi], eax add rsi, 4 mov [rsp+78h+var_60], rsi loc_1364: mov ecx, r13d loc_1367: mov [rsp+78h+var_6C], ecx mov rdx, [rbp+0] mov rax, [rbp+8] sub rax, rdx sar rax, 2 sub rax, 1 cmp rbx, rax jnb short loc_13C3 loc_1383: lea r14, ds:0[rbx*4] add rbx, 1 mov eax, [rdx+r14+4] cmp [rdx+r14], eax jnz short loc_132B mov eax, [rsp+78h+var_6C] lea ecx, [rax+1] jmp short loc_1367 loc_13A3: lea rdx, [rsp+78h+var_6C] lea rdi, [rsp+78h+var_48] call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) jmp short loc_1346 loc_13B4: lea rdi, [rsp+78h+src] mov rdx, r14 call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) jmp short loc_1364 loc_13C3: mov rax, [rsp+78h+var_40] mov rsi, [rsp+78h+var_38] cmp rax, rsi jz short loc_1449 mov [rax], ecx add rax, 4 mov [rsp+78h+var_40], rax loc_13DD: mov rax, [rbp+8] lea rdx, [rax-4] mov rsi, [rsp+78h+var_60] cmp rsi, [rsp+78h+var_58] jz short loc_145A mov eax, [rdx] mov [rsi], eax add rsi, 4 mov [rsp+78h+var_60], rsi loc_13FE: mov rbp, [rsp+78h+src] mov qword ptr [r12], 0 mov qword ptr [r12+8], 0 mov qword ptr [r12+10h], 0 mov rbx, [rsp+78h+var_60] sub rbx, rbp jz loc_15FF mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbx jb short loc_1466 mov rdi, rbx; unsigned __int64 call __Znwm; operator new(ulong) jmp short loc_148C loc_1444: mov esi, 0 loc_1449: lea rdx, [rsp+78h+var_6C] lea rdi, [rsp+78h+var_48] call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) jmp short loc_13DD loc_145A: lea rdi, [rsp+78h+src] call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) jmp short loc_13FE loc_1466: mov rax, [rsp+78h+var_30] sub rax, fs:28h jnz short loc_1487 call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) endbr64 mov rbx, rax jmp loc_1529 loc_1487: call ___stack_chk_fail loc_148C: mov rdi, rax; dest mov [r12], rax mov [r12+8], rax lea r13, [rax+rbx] mov [r12+10h], r13 cmp rbx, 4 jle short loc_14FE mov rdx, rbx; n mov rsi, rbp; src call _memmove loc_14B2: mov [r12+8], r13 mov rbp, [rsp+78h+var_48] mov qword ptr [r12+18h], 0 mov qword ptr [r12+20h], 0 mov qword ptr [r12+28h], 0 mov rbx, [rsp+78h+var_40] sub rbx, rbp jz loc_15DD mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbx jb short loc_1505 mov rdi, rbx; unsigned __int64 call __Znwm; operator new(ulong) jmp short loc_155B loc_14FE: mov eax, [rbp+0] mov [rdi], eax jmp short loc_14B2 loc_1505: mov rax, [rsp+78h+var_30] sub rax, fs:28h jnz short loc_1556 call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) endbr64 mov rbx, rax mov rdi, r12 call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() loc_1529: lea rdi, [rsp+78h+var_48] call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() lea rdi, [rsp+78h+src] call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() mov rax, [rsp+78h+var_30] sub rax, fs:28h jz loc_15D5 call ___stack_chk_fail loc_1556: call ___stack_chk_fail loc_155B: mov rdi, rax; dest mov [r12+18h], rax mov [r12+20h], rax lea r13, [rax+rbx] mov [r12+28h], r13 cmp rbx, 4 jle short loc_15CE mov rdx, rbx; n mov rsi, rbp; src call _memmove loc_1582: mov [r12+20h], r13 loc_1587: mov rsi, [rsp+78h+var_38] sub rsi, rbp; unsigned __int64 mov rdi, rbp; void * call __ZdlPvm; operator delete(void *,ulong) loc_1597: mov rdi, [rsp+78h+src]; void * test rdi, rdi jz short loc_15AE mov rsi, [rsp+78h+var_58] sub rsi, rdi; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_15AE: mov rax, [rsp+78h+var_30] sub rax, fs:28h jnz short loc_161B mov rax, r12 add rsp, 50h pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_15CE: mov eax, [rbp+0] mov [rdi], eax jmp short loc_1582 loc_15D5: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume loc_15DD: mov qword ptr [r12+18h], 0 mov qword ptr [r12+28h], 0 mov qword ptr [r12+20h], 0 test rbp, rbp jz short loc_1597 jmp short loc_1587 loc_15FF: mov qword ptr [r12], 0 mov qword ptr [r12+10h], 0 mov r13d, 0 jmp loc_14B2 loc_161B: call ___stack_chk_fail
_QWORD * func0(_QWORD *a1, long long *a2) { long long v2; // rdx unsigned long long v4; // rbx int *v5; // rsi _DWORD *v6; // r14 char *v7; // rsi int v8; // ecx long long v9; // r14 int *v10; // rax int *v11; // rsi _DWORD *v12; // rdx char *v13; // rsi char *v14; // rbp signed long long v15; // rbx _DWORD *v16; // rax struct _Unwind_Exception *v17; // rbx char *v18; // r13 char *v19; // rbp signed long long v20; // rbx _DWORD *v21; // rax char *v22; // r13 int v24; // [rsp+Ch] [rbp-6Ch] BYREF void *src; // [rsp+10h] [rbp-68h] BYREF char *v26; // [rsp+18h] [rbp-60h] char *v27; // [rsp+20h] [rbp-58h] void *v28; // [rsp+30h] [rbp-48h] BYREF int *v29; // [rsp+38h] [rbp-40h] int *v30; // [rsp+40h] [rbp-38h] unsigned long long v31; // [rsp+48h] [rbp-30h] v31 = __readfsqword(0x28u); src = 0LL; v26 = 0LL; v27 = 0LL; v28 = 0LL; v29 = 0LL; v30 = 0LL; v2 = *a2; if ( *a2 == a2[1] ) { *a1 = 0LL; a1[1] = 0LL; a1[2] = 0LL; a1[3] = 0LL; a1[4] = 0LL; a1[5] = 0LL; goto LABEL_38; } v24 = 1; if ( a2[1] - v2 == 4 ) { v11 = 0LL; } else { v4 = 0LL; do { v9 = 4 * v4++; if ( *(_DWORD *)(v2 + v9) == *(_DWORD *)(v2 + v9 + 4) ) { v8 = v24 + 1; } else { v5 = v29; if ( v29 == v30 ) { std::vector<int>::_M_realloc_insert<int const&>(&v28, v29, &v24); } else { *v29 = v24; v29 = v5 + 1; } v6 = (_DWORD *)(*a2 + v9); v7 = v26; if ( v26 == v27 ) { std::vector<int>::_M_realloc_insert<int const&>(&src, v26, v6); } else { *(_DWORD *)v26 = *v6; v26 = v7 + 4; } v8 = 1; } v24 = v8; v2 = *a2; } while ( v4 < ((a2[1] - *a2) >> 2) - 1 ); v10 = v29; v11 = v30; if ( v29 != v30 ) { *v29 = v8; v29 = v10 + 1; goto LABEL_17; } } std::vector<int>::_M_realloc_insert<int const&>(&v28, v11, &v24); LABEL_17: v12 = (_DWORD *)(a2[1] - 4); v13 = v26; if ( v26 == v27 ) { std::vector<int>::_M_realloc_insert<int const&>(&src, v26, v12); } else { *(_DWORD *)v26 = *v12; v26 = v13 + 4; } v14 = (char *)src; *a1 = 0LL; a1[1] = 0LL; a1[2] = 0LL; v15 = v26 - v14; if ( v26 == v14 ) { *a1 = 0LL; a1[2] = 0LL; v18 = 0LL; } else { if ( (unsigned long long)v15 > 0x7FFFFFFFFFFFFFFCLL ) { v17 = (struct _Unwind_Exception *)std::__throw_bad_array_new_length(); goto LABEL_33; } v16 = (_DWORD *)operator new(v26 - v14); *a1 = v16; a1[1] = v16; v18 = (char *)v16 + v15; a1[2] = (char *)v16 + v15; if ( v15 <= 4 ) *v16 = *(_DWORD *)v14; else memmove(v16, v14, v15); } a1[1] = v18; v19 = (char *)v28; a1[3] = 0LL; a1[4] = 0LL; a1[5] = 0LL; v20 = (char *)v29 - v19; if ( v29 != (int *)v19 ) { if ( (unsigned long long)v20 <= 0x7FFFFFFFFFFFFFFCLL ) { v21 = (_DWORD *)operator new((char *)v29 - v19); a1[3] = v21; a1[4] = v21; v22 = (char *)v21 + v20; a1[5] = (char *)v21 + v20; if ( v20 <= 4 ) *v21 = *(_DWORD *)v19; else memmove(v21, v19, v20); a1[4] = v22; goto LABEL_37; } v17 = (struct _Unwind_Exception *)std::__throw_bad_array_new_length(); std::vector<int>::~vector(a1); LABEL_33: std::vector<int>::~vector(&v28); std::vector<int>::~vector(&src); _Unwind_Resume(v17); } a1[3] = 0LL; a1[5] = 0LL; a1[4] = 0LL; if ( v19 ) LABEL_37: operator delete(v19, (char *)v30 - v19); LABEL_38: if ( src ) operator delete(src, v27 - (_BYTE *)src); return a1; }
func0: ENDBR64 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x50 MOV R12,RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV qword ptr [RSP + 0x10],0x0 MOV qword ptr [RSP + 0x18],0x0 MOV qword ptr [RSP + 0x20],0x0 MOV qword ptr [RSP + 0x30],0x0 MOV qword ptr [RSP + 0x38],0x0 MOV qword ptr [RSP + 0x40],0x0 MOV RDX,qword ptr [RSI] CMP RDX,qword ptr [RSI + 0x8] JZ 0x001012f7 MOV RBP,RSI MOV dword ptr [RSP + 0xc],0x1 MOV RAX,qword ptr [RSI + 0x8] SUB RAX,RDX CMP RAX,0x4 JZ 0x00101444 MOV EBX,0x0 MOV R13D,0x1 JMP 0x00101383 LAB_001012f7: MOV qword ptr [RDI],0x0 MOV qword ptr [RDI + 0x8],0x0 MOV qword ptr [RDI + 0x10],0x0 MOV qword ptr [RDI + 0x18],0x0 MOV qword ptr [RDI + 0x20],0x0 MOV qword ptr [RDI + 0x28],0x0 JMP 0x00101597 LAB_0010132b: MOV RSI,qword ptr [RSP + 0x38] CMP RSI,qword ptr [RSP + 0x40] JZ 0x001013a3 MOV EAX,dword ptr [RSP + 0xc] MOV dword ptr [RSI],EAX ADD RSI,0x4 MOV qword ptr [RSP + 0x38],RSI LAB_00101346: ADD R14,qword ptr [RBP] MOV RSI,qword ptr [RSP + 0x18] CMP RSI,qword ptr [RSP + 0x20] JZ 0x001013b4 MOV EAX,dword ptr [R14] MOV dword ptr [RSI],EAX ADD RSI,0x4 MOV qword ptr [RSP + 0x18],RSI LAB_00101364: MOV ECX,R13D LAB_00101367: MOV dword ptr [RSP + 0xc],ECX MOV RDX,qword ptr [RBP] MOV RAX,qword ptr [RBP + 0x8] SUB RAX,RDX SAR RAX,0x2 SUB RAX,0x1 CMP RBX,RAX JNC 0x001013c3 LAB_00101383: LEA R14,[RBX*0x4] ADD RBX,0x1 MOV EAX,dword ptr [RDX + R14*0x1 + 0x4] CMP dword ptr [RDX + R14*0x1],EAX JNZ 0x0010132b MOV EAX,dword ptr [RSP + 0xc] LEA ECX,[RAX + 0x1] JMP 0x00101367 LAB_001013a3: LEA RDX,[RSP + 0xc] LEA RDI,[RSP + 0x30] LAB_001013ad: CALL 0x001020f0 JMP 0x00101346 LAB_001013b4: LEA RDI,[RSP + 0x10] MOV RDX,R14 CALL 0x001020f0 JMP 0x00101364 LAB_001013c3: MOV RAX,qword ptr [RSP + 0x38] MOV RSI,qword ptr [RSP + 0x40] CMP RAX,RSI JZ 0x00101449 MOV dword ptr [RAX],ECX ADD RAX,0x4 MOV qword ptr [RSP + 0x38],RAX LAB_001013dd: MOV RAX,qword ptr [RBP + 0x8] LEA RDX,[RAX + -0x4] MOV RSI,qword ptr [RSP + 0x18] CMP RSI,qword ptr [RSP + 0x20] JZ 0x0010145a MOV EAX,dword ptr [RDX] MOV dword ptr [RSI],EAX ADD RSI,0x4 MOV qword ptr [RSP + 0x18],RSI LAB_001013fe: MOV RBP,qword ptr [RSP + 0x10] MOV qword ptr [R12],0x0 MOV qword ptr [R12 + 0x8],0x0 MOV qword ptr [R12 + 0x10],0x0 MOV RBX,qword ptr [RSP + 0x18] SUB RBX,RBP JZ 0x001015ff MOV RAX,0x7ffffffffffffffc CMP RAX,RBX JC 0x00101466 MOV RDI,RBX CALL 0x00101130 JMP 0x0010148c LAB_00101444: MOV ESI,0x0 LAB_00101449: LEA RDX,[RSP + 0xc] LEA RDI,[RSP + 0x30] CALL 0x001020f0 JMP 0x001013dd LAB_0010145a: LEA RDI,[RSP + 0x10] CALL 0x001020f0 JMP 0x001013fe LAB_00101466: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101487 CALL 0x00101110 LAB_0010147b: ENDBR64 MOV RBX,RAX JMP 0x00101529 LAB_00101487: CALL 0x00101150 LAB_0010148c: MOV RDI,RAX MOV qword ptr [R12],RAX MOV qword ptr [R12 + 0x8],RAX LEA R13,[RAX + RBX*0x1] MOV qword ptr [R12 + 0x10],R13 CMP RBX,0x4 JLE 0x001014fe MOV RDX,RBX MOV RSI,RBP CALL 0x00101160 LAB_001014b2: MOV qword ptr [R12 + 0x8],R13 MOV RBP,qword ptr [RSP + 0x30] MOV qword ptr [R12 + 0x18],0x0 MOV qword ptr [R12 + 0x20],0x0 MOV qword ptr [R12 + 0x28],0x0 MOV RBX,qword ptr [RSP + 0x38] SUB RBX,RBP JZ 0x001015dd MOV RAX,0x7ffffffffffffffc CMP RAX,RBX JC 0x00101505 MOV RDI,RBX LAB_001014f7: CALL 0x00101130 JMP 0x0010155b LAB_001014fe: MOV EAX,dword ptr [RBP] MOV dword ptr [RDI],EAX JMP 0x001014b2 LAB_00101505: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101556 CALL 0x00101110 LAB_0010151a: ENDBR64 MOV RBX,RAX MOV RDI,R12 CALL 0x00101f7a LAB_00101529: LEA RDI,[RSP + 0x30] CALL 0x00101f7a LEA RDI,[RSP + 0x10] CALL 0x00101f7a MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JZ 0x001015d5 CALL 0x00101150 LAB_00101556: CALL 0x00101150 LAB_0010155b: MOV RDI,RAX MOV qword ptr [R12 + 0x18],RAX MOV qword ptr [R12 + 0x20],RAX LEA R13,[RAX + RBX*0x1] MOV qword ptr [R12 + 0x28],R13 CMP RBX,0x4 JLE 0x001015ce MOV RDX,RBX MOV RSI,RBP CALL 0x00101160 LAB_00101582: MOV qword ptr [R12 + 0x20],R13 LAB_00101587: MOV RSI,qword ptr [RSP + 0x40] SUB RSI,RBP MOV RDI,RBP CALL 0x00101140 LAB_00101597: MOV RDI,qword ptr [RSP + 0x10] TEST RDI,RDI JZ 0x001015ae MOV RSI,qword ptr [RSP + 0x20] SUB RSI,RDI CALL 0x00101140 LAB_001015ae: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010161b MOV RAX,R12 ADD RSP,0x50 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_001015ce: MOV EAX,dword ptr [RBP] MOV dword ptr [RDI],EAX JMP 0x00101582 LAB_001015d5: MOV RDI,RBX LAB_001015d8: CALL 0x00101170 LAB_001015dd: MOV qword ptr [R12 + 0x18],0x0 MOV qword ptr [R12 + 0x28],0x0 MOV qword ptr [R12 + 0x20],0x0 TEST RBP,RBP JZ 0x00101597 JMP 0x00101587 LAB_001015ff: MOV qword ptr [R12],0x0 MOV qword ptr [R12 + 0x10],0x0 MOV R13D,0x0 JMP 0x001014b2 LAB_0010161b: CALL 0x00101150
/* func0(std::vector<int, std::allocator<int> > const&) */ vector * func0(vector *param_1) { long lVar1; int4 *puVar2; int4 *puVar3; int8 uVar4; ulong uVar5; long *in_RSI; long lVar6; long in_FS_OFFSET; int local_6c; int4 *local_68; int *local_60; int *local_58; int4 *local_48; int *local_40; int *local_38; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); local_68 = (int4 *)0x0; local_60 = (int *)0x0; local_58 = (int *)0x0; local_48 = (int4 *)0x0; local_40 = (int *)0x0; local_38 = (int *)0x0; lVar6 = *in_RSI; if (lVar6 == in_RSI[1]) { *(int8 *)param_1 = 0; *(int8 *)(param_1 + 8) = 0; *(int8 *)(param_1 + 0x10) = 0; *(int8 *)(param_1 + 0x18) = 0; *(int8 *)(param_1 + 0x20) = 0; *(int8 *)(param_1 + 0x28) = 0; goto LAB_00101597; } local_6c = 1; if (in_RSI[1] - lVar6 == 4) { LAB_00101449: std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)&local_48,(__normal_iterator)local_38,&local_6c); } else { uVar5 = 0; do { lVar1 = uVar5 * 4; uVar5 = uVar5 + 1; if (*(int *)(lVar6 + lVar1) == *(int *)(lVar6 + 4 + lVar1)) { local_6c = local_6c + 1; } else { if (local_40 == local_38) { /* try { // try from 001013ad to 0010147a has its CatchHandler @ 0010147b */ std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)&local_48,(__normal_iterator)local_40, &local_6c); } else { *local_40 = local_6c; local_40 = local_40 + 1; } if (local_60 == local_58) { std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)&local_68,(__normal_iterator)local_60, (int *)(lVar1 + *in_RSI)); } else { *local_60 = *(int *)(lVar1 + *in_RSI); local_60 = local_60 + 1; } local_6c = 1; } lVar6 = *in_RSI; } while (uVar5 < (in_RSI[1] - lVar6 >> 2) - 1U); if (local_40 == local_38) goto LAB_00101449; *local_40 = local_6c; local_40 = local_40 + 1; } if (local_60 == local_58) { std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)&local_68,(__normal_iterator)local_60, (int *)(in_RSI[1] + -4)); } else { *local_60 = *(int *)(in_RSI[1] + -4); local_60 = local_60 + 1; } puVar2 = local_68; *(int8 *)param_1 = 0; *(int8 *)(param_1 + 8) = 0; *(int8 *)(param_1 + 0x10) = 0; uVar5 = (long)local_60 - (long)local_68; if (uVar5 == 0) { *(int8 *)param_1 = 0; *(int8 *)(param_1 + 0x10) = 0; lVar6 = 0; } else { if (0x7ffffffffffffffc < uVar5) { if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } uVar4 = std::__throw_bad_array_new_length(); /* catch() { ... } // from try @ 001013ad with catch @ 0010147b */ goto LAB_00101529; } puVar3 = (int4 *)operator_new(uVar5); *(int4 **)param_1 = puVar3; *(int4 **)(param_1 + 8) = puVar3; lVar6 = (long)puVar3 + uVar5; *(long *)(param_1 + 0x10) = lVar6; if ((long)uVar5 < 5) { *puVar3 = *puVar2; } else { memmove(puVar3,puVar2,uVar5); } } puVar2 = local_48; *(long *)(param_1 + 8) = lVar6; *(int8 *)(param_1 + 0x18) = 0; *(int8 *)(param_1 + 0x20) = 0; *(int8 *)(param_1 + 0x28) = 0; uVar5 = (long)local_40 - (long)local_48; if (uVar5 == 0) { *(int8 *)(param_1 + 0x18) = 0; *(int8 *)(param_1 + 0x28) = 0; *(int8 *)(param_1 + 0x20) = 0; if (local_48 == (int4 *)0x0) goto LAB_00101597; } else { if (0x7ffffffffffffffc < uVar5) { if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } uVar4 = std::__throw_bad_array_new_length(); /* catch() { ... } // from try @ 001014f7 with catch @ 0010151a */ std::vector<int,std::allocator<int>>::~vector((vector<int,std::allocator<int>> *)param_1); LAB_00101529: std::vector<int,std::allocator<int>>::~vector((vector<int,std::allocator<int>> *)&local_48); std::vector<int,std::allocator<int>>::~vector((vector<int,std::allocator<int>> *)&local_68); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ _Unwind_Resume(uVar4); } /* WARNING: Subroutine does not return */ __stack_chk_fail(); } /* try { // try from 001014f7 to 00101519 has its CatchHandler @ 0010151a */ puVar3 = (int4 *)operator_new(uVar5); *(int4 **)(param_1 + 0x18) = puVar3; *(int4 **)(param_1 + 0x20) = puVar3; *(ulong *)(param_1 + 0x28) = (long)puVar3 + uVar5; if ((long)uVar5 < 5) { *puVar3 = *puVar2; } else { memmove(puVar3,puVar2,uVar5); } *(ulong *)(param_1 + 0x20) = (long)puVar3 + uVar5; } operator_delete(puVar2,(long)local_38 - (long)puVar2); LAB_00101597: if (local_68 != (int4 *)0x0) { operator_delete(local_68,(long)local_58 - (long)local_68); } if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
3,274
func0
#include <vector> #include <cassert>
std::pair<std::vector<int>, std::vector<int>> func0(const std::vector<int>& lists) { std::vector<int> elements; std::vector<int> frequencies; if (lists.empty()) { return std::make_pair(elements, frequencies); } int running_count = 1; for (size_t i = 0; i < lists.size() - 1; ++i) { if (lists[i] == lists[i + 1]) { running_count++; } else { frequencies.push_back(running_count); elements.push_back(lists[i]); running_count = 1; } } frequencies.push_back(running_count); elements.push_back(lists[lists.size() - 1]); return std::make_pair(elements, frequencies); }
int main() { assert((func0({1,2,2,2,4,4,4,5,5,5,5}) == std::make_pair(std::vector<int>{1, 2, 4, 5}, std::vector<int>{1, 3, 3, 4}))); assert((func0({2,2,3,1,2,6,7,9}) == std::make_pair(std::vector<int>{2, 3, 1, 2, 6, 7, 9}, std::vector<int>{2, 1, 1, 1, 1, 1, 1}))); assert((func0({2,1,5,6,8,3,4,9,10,11,8,12}) == std::make_pair(std::vector<int>{2, 1, 5, 6, 8, 3, 4, 9, 10, 11, 8, 12}, std::vector<int>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}))); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> > const&): endbr64 push %r14 push %r13 push %r12 mov %rdi,%r12 push %rbp push %rbx sub $0x50,%rsp mov 0x8(%rsi),%r8 mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov (%rsi),%rax movq $0x0,0x10(%rsp) movq $0x0,0x18(%rsp) movq $0x0,0x20(%rsp) movq $0x0,0x30(%rsp) movq $0x0,0x38(%rsp) movq $0x0,0x40(%rsp) cmp %r8,%rax je 1dd8 <_Z5func0RKSt6vectorIiSaIiEE+0x338> mov %r8,%rdx mov %rsi,%r13 movl $0x1,0xc(%rsp) xor %esi,%esi sub %rax,%rdx xor %r9d,%r9d lea 0x10(%rsp),%r14 xor %ebp,%ebp cmp $0x4,%rdx jne 1b56 <_Z5func0RKSt6vectorIiSaIiEE+0xb6> jmpq 1e10 <_Z5func0RKSt6vectorIiSaIiEE+0x370> nopl 0x0(%rax) addl $0x1,0xc(%rsp) mov %rax,%rdi mov %r8,%rcx sub %rax,%rcx mov %rcx,%rdx sar $0x2,%rdx sub $0x1,%rdx cmp %rbp,%rdx jbe 1bc8 <_Z5func0RKSt6vectorIiSaIiEE+0x128> lea 0x0(,%rbp,4),%rbx add $0x1,%rbp mov 0x4(%rax,%rbx,1),%edi cmp %edi,(%rax,%rbx,1) je 1b38 <_Z5func0RKSt6vectorIiSaIiEE+0x98> cmp %r9,%rsi je 1d88 <_Z5func0RKSt6vectorIiSaIiEE+0x2e8> mov 0xc(%rsp),%edx add $0x4,%rsi mov %edx,-0x4(%rsi) mov %rsi,0x38(%rsp) mov 0x18(%rsp),%rsi mov %rax,%rdi lea (%rax,%rbx,1),%rdx cmp 0x20(%rsp),%rsi je 1d70 <_Z5func0RKSt6vectorIiSaIiEE+0x2d0> mov (%rdx),%edx add $0x4,%rsi mov %edx,-0x4(%rsi) mov %rsi,0x18(%rsp) movl $0x1,0xc(%rsp) mov 0x38(%rsp),%rsi mov 0x40(%rsp),%r9 mov 0x8(%r13),%r8 jmpq 1b40 <_Z5func0RKSt6vectorIiSaIiEE+0xa0> nopl 0x0(%rax) cmp %r9,%rsi je 1e10 <_Z5func0RKSt6vectorIiSaIiEE+0x370> mov 0xc(%rsp),%eax add $0x4,%rsi mov %eax,-0x4(%rsi) mov %rsi,0x38(%rsp) mov 0x18(%rsp),%rsi lea -0x4(%rdi,%rcx,1),%rdx cmp 0x20(%rsp),%rsi je 1e30 <_Z5func0RKSt6vectorIiSaIiEE+0x390> mov (%rdx),%eax add $0x4,%rsi mov %eax,-0x4(%rsi) mov %rsi,0x18(%rsp) mov 0x10(%rsp),%r8 mov %rsi,%rbx movq $0x0,(%r12) movq $0x0,0x8(%r12) movq $0x0,0x10(%r12) sub %r8,%rbx mov %rbx,%rax sar $0x2,%rax je 1dc8 <_Z5func0RKSt6vectorIiSaIiEE+0x328> movabs $0x1fffffffffffffff,%rdx cmp %rdx,%rax ja 1e49 <_Z5func0RKSt6vectorIiSaIiEE+0x3a9> mov %rbx,%rdi callq 1140 <_Znwm@plt> mov 0x18(%rsp),%rsi mov 0x10(%rsp),%r8 mov %rax,%rcx mov %rsi,%rbp sub %r8,%rbp lea (%rcx,%rbx,1),%rax mov %rcx,(%r12) mov %rcx,0x8(%r12) mov %rax,0x10(%r12) cmp %r8,%rsi je 1c8c <_Z5func0RKSt6vectorIiSaIiEE+0x1ec> mov %rcx,%rdi mov %rbp,%rdx mov %r8,%rsi callq 1160 <memmove@plt> mov %rax,%rcx mov 0x38(%rsp),%rdx add %rbp,%rcx mov 0x30(%rsp),%rbp movq $0x0,0x18(%r12) mov %rcx,0x8(%r12) movq $0x0,0x20(%r12) mov %rdx,%rbx movq $0x0,0x28(%r12) sub %rbp,%rbx mov %rbx,%rax sar $0x2,%rax je 1db8 <_Z5func0RKSt6vectorIiSaIiEE+0x318> movabs $0x1fffffffffffffff,%rdx cmp %rdx,%rax ja 1e4e <_Z5func0RKSt6vectorIiSaIiEE+0x3ae> mov %rbx,%rdi callq 1140 <_Znwm@plt> mov 0x38(%rsp),%rdx mov 0x30(%rsp),%rbp mov %rax,%rcx mov %rdx,%r13 sub %rbp,%r13 lea (%rcx,%rbx,1),%rax mov %rcx,0x18(%r12) mov %rcx,0x20(%r12) mov %rax,0x28(%r12) cmp %rbp,%rdx je 1da0 <_Z5func0RKSt6vectorIiSaIiEE+0x300> mov %rcx,%rdi mov %r13,%rdx mov %rbp,%rsi callq 1160 <memmove@plt> mov %rax,%rcx add %r13,%rcx mov %rcx,0x20(%r12) mov %rbp,%rdi callq 1130 <_ZdlPv@plt> mov 0x10(%rsp),%rdi test %rdi,%rdi je 1d46 <_Z5func0RKSt6vectorIiSaIiEE+0x2a6> callq 1130 <_ZdlPv@plt> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 1e44 <_Z5func0RKSt6vectorIiSaIiEE+0x3a4> add $0x50,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq nopw 0x0(%rax,%rax,1) mov %r14,%rdi callq 1ff0 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> mov 0x0(%r13),%rax mov %rax,%rdi jmpq 1ba9 <_Z5func0RKSt6vectorIiSaIiEE+0x109> nopl 0x0(%rax) lea 0xc(%rsp),%rdx lea 0x30(%rsp),%rdi callq 1ff0 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> mov 0x0(%r13),%rax jmpq 1b84 <_Z5func0RKSt6vectorIiSaIiEE+0xe4> add %r13,%rcx mov %rcx,0x20(%r12) test %rdx,%rdx je 1d37 <_Z5func0RKSt6vectorIiSaIiEE+0x297> jmpq 1d2f <_Z5func0RKSt6vectorIiSaIiEE+0x28f> nopw 0x0(%rax,%rax,1) mov %rbx,%r13 xor %ecx,%ecx jmpq 1cfa <_Z5func0RKSt6vectorIiSaIiEE+0x25a> nopw 0x0(%rax,%rax,1) mov %rbx,%rbp xor %ecx,%ecx jmpq 1c64 <_Z5func0RKSt6vectorIiSaIiEE+0x1c4> nopw 0x0(%rax,%rax,1) movq $0x0,(%rdi) movq $0x0,0x8(%rdi) movq $0x0,0x10(%rdi) movq $0x0,0x18(%rdi) movq $0x0,0x20(%rdi) movq $0x0,0x28(%rdi) jmpq 1d46 <_Z5func0RKSt6vectorIiSaIiEE+0x2a6> nopl 0x0(%rax) lea 0xc(%rsp),%rdx lea 0x30(%rsp),%rdi callq 1ff0 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> mov 0x0(%r13),%rdi mov 0x8(%r13),%rcx sub %rdi,%rcx jmpq 1be1 <_Z5func0RKSt6vectorIiSaIiEE+0x141> lea 0x10(%rsp),%rdi callq 1ff0 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> mov 0x18(%rsp),%rsi jmpq 1c04 <_Z5func0RKSt6vectorIiSaIiEE+0x164> callq 1150 <__stack_chk_fail@plt> callq 10e0 <_ZSt17__throw_bad_allocv@plt> callq 10e0 <_ZSt17__throw_bad_allocv@plt> endbr64 mov %rax,%rbp jmpq 1180 <_Z5func0RKSt6vectorIiSaIiEE.cold> endbr64 mov %rax,%rbp jmpq 118e <_Z5func0RKSt6vectorIiSaIiEE.cold+0xe> nopl 0x0(%rax,%rax,1)
_Z5func0RKSt6vectorIiSaIiEE: endbr64 push r15 pxor xmm0, xmm0 push r14 push r13 mov r13, rdi push r12 push rbp push rbx sub rsp, 58h mov rdx, [rsi+8] mov rax, fs:28h mov [rsp+88h+var_40], rax xor eax, eax mov rax, [rsi] movaps xmmword ptr [rsp+88h+src], xmm0 mov [rsp+88h+var_68], 0 mov [rsp+88h+var_48], 0 movaps xmmword ptr [rsp+88h+var_58], xmm0 cmp rax, rdx jz loc_1C58 sub rdx, rax mov [rsp+88h+var_7C], 1 mov r12, rsi cmp rdx, 4 jz loc_1C70 xor edi, edi xor esi, esi xor ebp, ebp jmp short loc_19E9 loc_19C8: add [rsp+88h+var_7C], 1 mov rax, [r12] loc_19D1: mov rdx, [r12+8] sub rdx, rax mov rcx, rdx sar rcx, 2 sub rcx, 1 cmp rbp, rcx jnb short loc_1A58 loc_19E9: lea rbx, ds:0[rbp*4] add rbp, 1 mov ecx, [rax+rbx+4] cmp [rax+rbx], ecx jz short loc_19C8 cmp rsi, rdi jz loc_1BF0 mov eax, [rsp+88h+var_7C] add rsi, 4 mov [rsi-4], eax mov [rsp+88h+var_58+8], rsi loc_1A17: mov rax, [r12] mov rsi, [rsp+88h+src+8] lea rdx, [rax+rbx] cmp rsi, [rsp+88h+var_68] jz loc_1BD0 mov edx, [rdx] add rsi, 4 mov [rsi-4], edx mov [rsp+88h+src+8], rsi loc_1A3D: mov [rsp+88h+var_7C], 1 mov rsi, [rsp+88h+var_58+8] mov rdi, [rsp+88h+var_48] jmp short loc_19D1 loc_1A58: cmp rdi, rsi jz loc_1C72 mov ecx, [rsp+88h+var_7C] add rsi, 4 mov [rsi-4], ecx mov [rsp+88h+var_58+8], rsi loc_1A71: mov rsi, [rsp+88h+src+8] lea rdx, [rax+rdx-4] cmp rsi, [rsp+88h+var_68] jz loc_1CA0 mov eax, [rdx] add rsi, 4 mov [rsi-4], eax mov [rsp+88h+src+8], rsi loc_1A94: mov rbp, [rsp+88h+src] pxor xmm0, xmm0 mov rbx, rsi mov qword ptr [r13+10h], 0 movups xmmword ptr [r13+0], xmm0 sub rbx, rbp jz loc_1C10 mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbx jb loc_1CBC mov rdi, rbx; unsigned __int64 lea r15, [rsp+88h+var_58] lea r14, [rsp+88h+src] call __Znwm; operator new(ulong) movq xmm0, rax lea r12, [rax+rbx] mov rdi, rax; dest punpcklqdq xmm0, xmm0 mov [r13+10h], r12 movups xmmword ptr [r13+0], xmm0 cmp rbx, 4 jle loc_1CF5 mov rdx, rbx; n mov rsi, rbp; src call _memmove loc_1B09: mov [r13+8], r12 mov rbx, [rsp+88h+var_58+8] pxor xmm0, xmm0 mov r12, [rsp+88h+var_58] mov qword ptr [r13+28h], 0 movups xmmword ptr [r13+18h], xmm0 sub rbx, r12 jz loc_1C30 mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbx jb loc_1CDB mov rdi, rbx; unsigned __int64 call __Znwm; operator new(ulong) movq xmm0, rax lea r14, [rax+rbx] mov rdi, rax; dest punpcklqdq xmm0, xmm0 mov [r13+28h], r14 movups xmmword ptr [r13+18h], xmm0 cmp rbx, 4 jle loc_1D05 mov rdx, rbx; n mov rsi, r12; src call _memmove mov [r13+20h], r14 loc_1B7E: mov rsi, [rsp+88h+var_48] mov rdi, r12; void * sub rsi, r12; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_1B8E: mov rsi, [rsp+88h+var_68] sub rsi, rbp; unsigned __int64 test rbp, rbp jz short loc_1BA3 mov rdi, rbp; void * call __ZdlPvm; operator delete(void *,ulong) loc_1BA3: mov rax, [rsp+88h+var_40] sub rax, fs:28h jnz loc_1CF0 add rsp, 58h mov rax, r13 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1BD0: lea r14, [rsp+88h+src] lea r15, [rsp+88h+var_58] mov rdi, r14 call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) mov rax, [r12] jmp loc_1A3D loc_1BF0: lea r15, [rsp+88h+var_58] lea rdx, [rsp+88h+var_7C] mov rdi, r15 lea r14, [rsp+88h+src] call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) jmp loc_1A17 loc_1C10: mov qword ptr [r13+0], 0 xor r12d, r12d mov qword ptr [r13+10h], 0 jmp loc_1B09 loc_1C30: mov qword ptr [r13+18h], 0 xor r14d, r14d mov qword ptr [r13+28h], 0 loc_1C43: mov [r13+20h], r14 test r12, r12 jz loc_1B8E jmp loc_1B7E loc_1C58: movups xmmword ptr [rdi], xmm0 movups xmmword ptr [rdi+10h], xmm0 movups xmmword ptr [rdi+20h], xmm0 jmp loc_1BA3 loc_1C70: xor esi, esi loc_1C72: lea r15, [rsp+88h+var_58] lea rdx, [rsp+88h+var_7C] mov rdi, r15 lea r14, [rsp+88h+src] call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) mov rax, [r12] mov rdx, [r12+8] sub rdx, rax jmp loc_1A71 loc_1CA0: lea r14, [rsp+88h+src] lea r15, [rsp+88h+var_58] mov rdi, r14 call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) mov rsi, [rsp+88h+src+8] jmp loc_1A94 loc_1CBC: mov rax, [rsp+88h+var_40] sub rax, fs:28h jnz short loc_1CF0 lea r15, [rsp+88h+var_58] lea r14, [rsp+88h+src] call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) loc_1CDB: mov rax, [rsp+88h+var_40] sub rax, fs:28h jnz short loc_1CF0 call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) loc_1CF0: call ___stack_chk_fail loc_1CF5: jnz loc_1B09 mov eax, [rbp+0] mov [rdi], eax jmp loc_1B09 loc_1D05: jnz loc_1C43 mov eax, [r12] mov [rdi], eax mov [r13+20h], r14 jmp loc_1B7E endbr64 mov rbx, rax jmp loc_1192 endbr64 mov rbx, rax jmp _Z5func0RKSt6vectorIiSaIiEE_cold; func0(std::vector<int> const&) [clone]
long long func0(long long a1, long long *a2) { long long v3; // rdx long long v4; // rax char *v6; // rdi char *v7; // rsi unsigned long long v8; // rbp long long v9; // rdx long long v10; // rbx _DWORD *v11; // rsi _DWORD *v12; // rdx char *v13; // rsi _DWORD *v14; // rsi _DWORD *v15; // rdx char *v16; // rsi char *v17; // rbp long long v18; // rbx _DWORD *v19; // rax char *v20; // r12 _BYTE *v21; // rbx _DWORD *v22; // r12 signed long long v23; // rbx _DWORD *v24; // rax char *v25; // r14 int v27; // [rsp+4h] [rbp-7Ch] BYREF void *src[2]; // [rsp+8h] [rbp-78h] BYREF _BYTE *v29; // [rsp+18h] [rbp-68h] void *v30[2]; // [rsp+28h] [rbp-58h] BYREF char *v31; // [rsp+38h] [rbp-48h] unsigned long long v32; // [rsp+40h] [rbp-40h] v3 = a2[1]; v32 = __readfsqword(0x28u); v4 = *a2; *(_OWORD *)src = 0LL; v29 = 0LL; v31 = 0LL; *(_OWORD *)v30 = 0LL; if ( v4 == v3 ) { *(_OWORD *)a1 = 0LL; *(_OWORD *)(a1 + 16) = 0LL; *(_OWORD *)(a1 + 32) = 0LL; return a1; } v27 = 1; if ( v3 - v4 == 4 ) { v7 = 0LL; } else { v6 = 0LL; v7 = 0LL; v8 = 0LL; do { v10 = 4 * v8++; if ( *(_DWORD *)(v4 + v10) == *(_DWORD *)(v4 + v10 + 4) ) { ++v27; v4 = *a2; } else { if ( v7 == v6 ) { std::vector<int>::_M_realloc_insert<int const&>(v30, v7, &v27); } else { v11 = v7 + 4; *(v11 - 1) = v27; v30[1] = v11; } v4 = *a2; v12 = (_DWORD *)(*a2 + v10); if ( src[1] == v29 ) { std::vector<int>::_M_realloc_insert<int const&>(src, src[1], v12); v4 = *a2; } else { v13 = (char *)src[1] + 4; *(_DWORD *)src[1] = *v12; src[1] = v13; } v27 = 1; v7 = (char *)v30[1]; v6 = v31; } v9 = a2[1] - v4; } while ( v8 < (v9 >> 2) - 1 ); if ( v6 != v7 ) { v14 = v7 + 4; *(v14 - 1) = v27; v30[1] = v14; goto LABEL_14; } } std::vector<int>::_M_realloc_insert<int const&>(v30, v7, &v27); v4 = *a2; v9 = a2[1] - *a2; LABEL_14: v15 = (_DWORD *)(v4 + v9 - 4); if ( src[1] == v29 ) { std::vector<int>::_M_realloc_insert<int const&>(src, src[1], v15); v16 = (char *)src[1]; } else { v16 = (char *)src[1] + 4; *(_DWORD *)src[1] = *v15; src[1] = v16; } v17 = (char *)src[0]; *(_QWORD *)(a1 + 16) = 0LL; *(_OWORD *)a1 = 0LL; v18 = v16 - v17; if ( v16 == v17 ) { *(_QWORD *)a1 = 0LL; v20 = 0LL; *(_QWORD *)(a1 + 16) = 0LL; } else { if ( (unsigned long long)v18 > 0x7FFFFFFFFFFFFFFCLL ) { std::__throw_bad_array_new_length(); goto LABEL_39; } v19 = (_DWORD *)operator new(v16 - v17); v20 = (char *)v19 + v18; *(_QWORD *)(a1 + 16) = (char *)v19 + v18; *(__m128i *)a1 = _mm_unpacklo_epi64((__m128i)(unsigned long long)v19, (__m128i)(unsigned long long)v19); if ( v18 <= 4 ) { if ( v18 == 4 ) *v19 = *(_DWORD *)v17; } else { memmove(v19, v17, v16 - v17); } } *(_QWORD *)(a1 + 8) = v20; v21 = v30[1]; v22 = v30[0]; *(_QWORD *)(a1 + 40) = 0LL; *(_OWORD *)(a1 + 24) = 0LL; v23 = v21 - (_BYTE *)v22; if ( !v23 ) { *(_QWORD *)(a1 + 24) = 0LL; v25 = 0LL; *(_QWORD *)(a1 + 40) = 0LL; goto LABEL_32; } if ( (unsigned long long)v23 > 0x7FFFFFFFFFFFFFFCLL ) LABEL_39: std::__throw_bad_array_new_length(); v24 = (_DWORD *)operator new(v23); v25 = (char *)v24 + v23; *(_QWORD *)(a1 + 40) = (char *)v24 + v23; *(__m128i *)(a1 + 24) = _mm_unpacklo_epi64((__m128i)(unsigned long long)v24, (__m128i)(unsigned long long)v24); if ( v23 > 4 ) { memmove(v24, v22, v23); *(_QWORD *)(a1 + 32) = v25; LABEL_24: operator delete(v22, v31 - (char *)v22); goto LABEL_25; } if ( v23 == 4 ) { *v24 = *v22; *(_QWORD *)(a1 + 32) = v25; goto LABEL_24; } LABEL_32: *(_QWORD *)(a1 + 32) = v25; if ( v22 ) goto LABEL_24; LABEL_25: if ( v17 ) operator delete(v17, v29 - v17); return a1; }
func0: ENDBR64 PUSH R15 PXOR XMM0,XMM0 PUSH R14 PUSH R13 MOV R13,RDI PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x58 MOV RDX,qword ptr [RSI + 0x8] MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV RAX,qword ptr [RSI] MOVAPS xmmword ptr [RSP + 0x10],XMM0 MOV qword ptr [RSP + 0x20],0x0 MOV qword ptr [RSP + 0x40],0x0 MOVAPS xmmword ptr [RSP + 0x30],XMM0 CMP RAX,RDX JZ 0x00101c58 SUB RDX,RAX MOV dword ptr [RSP + 0xc],0x1 MOV R12,RSI CMP RDX,0x4 JZ 0x00101c70 XOR EDI,EDI XOR ESI,ESI XOR EBP,EBP JMP 0x001019e9 LAB_001019c8: ADD dword ptr [RSP + 0xc],0x1 MOV RAX,qword ptr [R12] LAB_001019d1: MOV RDX,qword ptr [R12 + 0x8] SUB RDX,RAX MOV RCX,RDX SAR RCX,0x2 SUB RCX,0x1 CMP RBP,RCX JNC 0x00101a58 LAB_001019e9: LEA RBX,[RBP*0x4] ADD RBP,0x1 MOV ECX,dword ptr [RAX + RBX*0x1 + 0x4] CMP dword ptr [RAX + RBX*0x1],ECX JZ 0x001019c8 CMP RSI,RDI JZ 0x00101bf0 MOV EAX,dword ptr [RSP + 0xc] ADD RSI,0x4 MOV dword ptr [RSI + -0x4],EAX MOV qword ptr [RSP + 0x38],RSI LAB_00101a17: MOV RAX,qword ptr [R12] MOV RSI,qword ptr [RSP + 0x18] LEA RDX,[RAX + RBX*0x1] CMP RSI,qword ptr [RSP + 0x20] JZ 0x00101bd0 MOV EDX,dword ptr [RDX] ADD RSI,0x4 MOV dword ptr [RSI + -0x4],EDX MOV qword ptr [RSP + 0x18],RSI LAB_00101a3d: MOV dword ptr [RSP + 0xc],0x1 MOV RSI,qword ptr [RSP + 0x38] MOV RDI,qword ptr [RSP + 0x40] JMP 0x001019d1 LAB_00101a58: CMP RDI,RSI JZ 0x00101c72 MOV ECX,dword ptr [RSP + 0xc] ADD RSI,0x4 MOV dword ptr [RSI + -0x4],ECX MOV qword ptr [RSP + 0x38],RSI LAB_00101a71: MOV RSI,qword ptr [RSP + 0x18] LEA RDX,[RAX + RDX*0x1 + -0x4] CMP RSI,qword ptr [RSP + 0x20] JZ 0x00101ca0 MOV EAX,dword ptr [RDX] ADD RSI,0x4 MOV dword ptr [RSI + -0x4],EAX MOV qword ptr [RSP + 0x18],RSI LAB_00101a94: MOV RBP,qword ptr [RSP + 0x10] PXOR XMM0,XMM0 MOV RBX,RSI MOV qword ptr [R13 + 0x10],0x0 MOVUPS xmmword ptr [R13],XMM0 SUB RBX,RBP JZ 0x00101c10 MOV RAX,0x7ffffffffffffffc CMP RAX,RBX JC 0x00101cbc MOV RDI,RBX LEA R15,[RSP + 0x30] LEA R14,[RSP + 0x10] LAB_00101ad6: CALL 0x00101130 MOVQ XMM0,RAX LEA R12,[RAX + RBX*0x1] MOV RDI,RAX PUNPCKLQDQ XMM0,XMM0 MOV qword ptr [R13 + 0x10],R12 MOVUPS xmmword ptr [R13],XMM0 CMP RBX,0x4 JLE 0x00101cf5 MOV RDX,RBX MOV RSI,RBP CALL 0x00101160 LAB_00101b09: MOV qword ptr [R13 + 0x8],R12 MOV RBX,qword ptr [RSP + 0x38] PXOR XMM0,XMM0 MOV R12,qword ptr [RSP + 0x30] MOV qword ptr [R13 + 0x28],0x0 MOVUPS xmmword ptr [R13 + 0x18],XMM0 SUB RBX,R12 JZ 0x00101c30 MOV RAX,0x7ffffffffffffffc CMP RAX,RBX JC 0x00101cdb MOV RDI,RBX LAB_00101b47: CALL 0x00101130 MOVQ XMM0,RAX LEA R14,[RAX + RBX*0x1] MOV RDI,RAX PUNPCKLQDQ XMM0,XMM0 MOV qword ptr [R13 + 0x28],R14 MOVUPS xmmword ptr [R13 + 0x18],XMM0 CMP RBX,0x4 JLE 0x00101d05 MOV RDX,RBX MOV RSI,R12 CALL 0x00101160 MOV qword ptr [R13 + 0x20],R14 LAB_00101b7e: MOV RSI,qword ptr [RSP + 0x40] MOV RDI,R12 SUB RSI,R12 CALL 0x00101140 LAB_00101b8e: MOV RSI,qword ptr [RSP + 0x20] SUB RSI,RBP TEST RBP,RBP JZ 0x00101ba3 MOV RDI,RBP CALL 0x00101140 LAB_00101ba3: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101cf0 ADD RSP,0x58 MOV RAX,R13 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101bd0: LEA R14,[RSP + 0x10] LEA R15,[RSP + 0x30] MOV RDI,R14 LAB_00101bdd: CALL 0x00101ed0 MOV RAX,qword ptr [R12] JMP 0x00101a3d LAB_00101bf0: LEA R15,[RSP + 0x30] LEA RDX,[RSP + 0xc] MOV RDI,R15 LEA R14,[RSP + 0x10] CALL 0x00101ed0 JMP 0x00101a17 LAB_00101c10: MOV qword ptr [R13],0x0 XOR R12D,R12D MOV qword ptr [R13 + 0x10],0x0 JMP 0x00101b09 LAB_00101c30: MOV qword ptr [R13 + 0x18],0x0 XOR R14D,R14D MOV qword ptr [R13 + 0x28],0x0 LAB_00101c43: MOV qword ptr [R13 + 0x20],R14 TEST R12,R12 JZ 0x00101b8e JMP 0x00101b7e LAB_00101c58: MOVUPS xmmword ptr [RDI],XMM0 MOVUPS xmmword ptr [RDI + 0x10],XMM0 MOVUPS xmmword ptr [RDI + 0x20],XMM0 JMP 0x00101ba3 LAB_00101c70: XOR ESI,ESI LAB_00101c72: LEA R15,[RSP + 0x30] LEA RDX,[RSP + 0xc] MOV RDI,R15 LEA R14,[RSP + 0x10] CALL 0x00101ed0 MOV RAX,qword ptr [R12] MOV RDX,qword ptr [R12 + 0x8] SUB RDX,RAX JMP 0x00101a71 LAB_00101ca0: LEA R14,[RSP + 0x10] LEA R15,[RSP + 0x30] MOV RDI,R14 CALL 0x00101ed0 MOV RSI,qword ptr [RSP + 0x18] JMP 0x00101a94 LAB_00101cbc: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101cf0 LEA R15,[RSP + 0x30] LEA R14,[RSP + 0x10] CALL 0x00101110 LAB_00101cdb: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101cf0 LAB_00101ceb: CALL 0x00101110 LAB_00101cf0: CALL 0x00101150 LAB_00101cf5: JNZ 0x00101b09 MOV EAX,dword ptr [RBP] MOV dword ptr [RDI],EAX JMP 0x00101b09 LAB_00101d05: JNZ 0x00101c43 MOV EAX,dword ptr [R12] MOV dword ptr [RDI],EAX MOV qword ptr [R13 + 0x20],R14 JMP 0x00101b7e
/* func0(std::vector<int, std::allocator<int> > const&) */ vector * func0(vector *param_1) { int8 __src; int8 __src_00; long lVar1; int4 *puVar2; long lVar3; ulong uVar4; long *in_RSI; int *piVar5; int *piVar6; long in_FS_OFFSET; int local_7c; int local_78 [16]; int *local_68; int local_58 [16]; int *local_48; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); lVar1 = *in_RSI; local_78 = (int [16])0x0; local_68 = (int *)0x0; local_48 = (int *)0x0; local_58 = (int [16])0x0; if (lVar1 == in_RSI[1]) { *(int (*) [16])param_1 = (int [16])0x0; *(int (*) [16])(param_1 + 0x10) = (int [16])0x0; *(int (*) [16])(param_1 + 0x20) = (int [16])0x0; } else { local_7c = 1; if (in_RSI[1] - lVar1 == 4) { piVar5 = (int *)0x0; LAB_00101c72: std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)local_58,(__normal_iterator)piVar5,&local_7c); lVar1 = *in_RSI; lVar3 = in_RSI[1] - lVar1; } else { piVar6 = (int *)0x0; piVar5 = (int *)0x0; uVar4 = 0; do { lVar3 = uVar4 * 4; uVar4 = uVar4 + 1; if (*(int *)(lVar1 + lVar3) == *(int *)(lVar1 + 4 + lVar3)) { local_7c = local_7c + 1; lVar1 = *in_RSI; } else { if (piVar5 == piVar6) { std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)local_58,(__normal_iterator)piVar5, &local_7c); } else { *piVar5 = local_7c; local_58._8_8_ = piVar5 + 1; } lVar1 = *in_RSI; if ((int *)local_78._8_8_ == local_68) { /* try { // try from 00101bdd to 00101cda has its CatchHandler @ 00101d1a */ std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)local_78,local_78._8_4_, (int *)(lVar1 + lVar3)); lVar1 = *in_RSI; } else { *(int *)local_78._8_8_ = *(int *)(lVar1 + lVar3); local_78._8_8_ = (int *)(local_78._8_8_ + 4); } local_7c = 1; piVar5 = (int *)local_58._8_8_; piVar6 = local_48; } lVar3 = in_RSI[1] - lVar1; } while (uVar4 < (lVar3 >> 2) - 1U); if (piVar6 == piVar5) goto LAB_00101c72; *piVar5 = local_7c; local_58._8_8_ = piVar5 + 1; } piVar5 = (int *)(lVar1 + -4 + lVar3); if ((int *)local_78._8_8_ == local_68) { std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)local_78,local_78._8_4_,piVar5); piVar6 = (int *)local_78._8_8_; } else { piVar6 = (int *)(local_78._8_8_ + 4); *(int *)local_78._8_8_ = *piVar5; local_78._8_8_ = piVar6; } __src = local_78._0_8_; *(int8 *)(param_1 + 0x10) = 0; *(int (*) [16])param_1 = (int [16])0x0; uVar4 = (long)piVar6 - local_78._0_8_; if (uVar4 != 0) { if (uVar4 < 0x7ffffffffffffffd) { /* try { // try from 00101ad6 to 00101ada has its CatchHandler @ 00101d1a */ puVar2 = (int4 *)operator_new(uVar4); lVar1 = (long)puVar2 + uVar4; *(long *)(param_1 + 0x10) = lVar1; *(int4 **)param_1 = puVar2; *(int4 **)(param_1 + 8) = puVar2; if ((long)uVar4 < 5) { if (uVar4 == 4) { *puVar2 = *(int4 *)__src; } } else { memmove(puVar2,(void *)__src,uVar4); } goto LAB_00101b09; } if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) goto LAB_00101cf0; std::__throw_bad_array_new_length(); LAB_00101cdb: if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { /* try { // try from 00101ceb to 00101cef has its CatchHandler @ 00101d26 */ std::__throw_bad_array_new_length(); } goto LAB_00101cf0; } *(int8 *)param_1 = 0; lVar1 = 0; *(int8 *)(param_1 + 0x10) = 0; LAB_00101b09: *(long *)(param_1 + 8) = lVar1; __src_00 = local_58._0_8_; *(int8 *)(param_1 + 0x28) = 0; *(int (*) [16])(param_1 + 0x18) = (int [16])0x0; uVar4 = local_58._8_8_ - local_58._0_8_; if (uVar4 == 0) { *(int8 *)(param_1 + 0x18) = 0; lVar1 = 0; *(int8 *)(param_1 + 0x28) = 0; LAB_00101c43: *(long *)(param_1 + 0x20) = lVar1; if ((int4 *)__src_00 != (int4 *)0x0) goto LAB_00101b7e; } else { if (0x7ffffffffffffffc < uVar4) goto LAB_00101cdb; /* try { // try from 00101b47 to 00101b4b has its CatchHandler @ 00101d26 */ puVar2 = (int4 *)operator_new(uVar4); lVar1 = (long)puVar2 + uVar4; *(long *)(param_1 + 0x28) = lVar1; *(int4 **)(param_1 + 0x18) = puVar2; *(int4 **)(param_1 + 0x20) = puVar2; if ((long)uVar4 < 5) { if (uVar4 != 4) goto LAB_00101c43; *puVar2 = *(int4 *)__src_00; *(long *)(param_1 + 0x20) = lVar1; } else { memmove(puVar2,(void *)__src_00,uVar4); *(long *)(param_1 + 0x20) = lVar1; } LAB_00101b7e: operator_delete((void *)__src_00,(long)local_48 - __src_00); } if ((int4 *)__src != (int4 *)0x0) { operator_delete((void *)__src,(long)local_68 - __src); } } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } LAB_00101cf0: /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,275
func0
#include <vector> #include <cassert>
std::pair<std::vector<int>, std::vector<int>> func0(const std::vector<int>& lists) { std::vector<int> elements; std::vector<int> frequencies; if (lists.empty()) { return std::make_pair(elements, frequencies); } int running_count = 1; for (size_t i = 0; i < lists.size() - 1; ++i) { if (lists[i] == lists[i + 1]) { running_count++; } else { frequencies.push_back(running_count); elements.push_back(lists[i]); running_count = 1; } } frequencies.push_back(running_count); elements.push_back(lists[lists.size() - 1]); return std::make_pair(elements, frequencies); }
int main() { assert((func0({1,2,2,2,4,4,4,5,5,5,5}) == std::make_pair(std::vector<int>{1, 2, 4, 5}, std::vector<int>{1, 3, 3, 4}))); assert((func0({2,2,3,1,2,6,7,9}) == std::make_pair(std::vector<int>{2, 3, 1, 2, 6, 7, 9}, std::vector<int>{2, 1, 1, 1, 1, 1, 1}))); assert((func0({2,1,5,6,8,3,4,9,10,11,8,12}) == std::make_pair(std::vector<int>{2, 1, 5, 6, 8, 3, 4, 9, 10, 11, 8, 12}, std::vector<int>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}))); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> > const&): endbr64 push %r14 pxor %xmm0,%xmm0 push %r13 push %r12 mov %rdi,%r12 push %rbp push %rbx sub $0x50,%rsp mov 0x8(%rsi),%r9 mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov (%rsi),%rax movaps %xmm0,0x10(%rsp) movq $0x0,0x20(%rsp) movq $0x0,0x40(%rsp) movaps %xmm0,0x30(%rsp) cmp %r9,%rax je 1c78 <_Z5func0RKSt6vectorIiSaIiEE+0x328> mov %r9,%rdx mov %rsi,%r13 movl $0x1,0xc(%rsp) xor %esi,%esi sub %rax,%rdx cmp $0x4,%rdx je 1c90 <_Z5func0RKSt6vectorIiSaIiEE+0x340> mov $0x1,%ecx xor %r10d,%r10d xor %esi,%esi xor %ebp,%ebp lea 0x10(%rsp),%r14 jmp 19f8 <_Z5func0RKSt6vectorIiSaIiEE+0xa8> nopl 0x0(%rax,%rax,1) add $0x1,%ecx mov %rax,%r8 mov %ecx,0xc(%rsp) mov %r9,%rdi sub %rax,%rdi mov %rdi,%rdx sar $0x2,%rdx sub $0x1,%rdx cmp %rbp,%rdx jbe 1a70 <_Z5func0RKSt6vectorIiSaIiEE+0x120> lea 0x0(,%rbp,4),%rbx add $0x1,%rbp mov 0x4(%rax,%rbx,1),%edi cmp %edi,(%rax,%rbx,1) je 19d8 <_Z5func0RKSt6vectorIiSaIiEE+0x88> cmp %r10,%rsi je 1c28 <_Z5func0RKSt6vectorIiSaIiEE+0x2d8> mov %ecx,(%rsi) add $0x4,%rsi mov %rsi,0x38(%rsp) mov 0x18(%rsp),%rsi mov %rax,%r8 lea (%rax,%rbx,1),%rdx cmp 0x20(%rsp),%rsi je 1c10 <_Z5func0RKSt6vectorIiSaIiEE+0x2c0> mov (%rdx),%edx add $0x4,%rsi mov %edx,-0x4(%rsi) mov %rsi,0x18(%rsp) mov 0x38(%rsp),%rsi mov 0x40(%rsp),%r10 mov $0x1,%ecx movl $0x1,0xc(%rsp) mov 0x8(%r13),%r9 jmpq 19e2 <_Z5func0RKSt6vectorIiSaIiEE+0x92> nopw %cs:0x0(%rax,%rax,1) cmp %r10,%rsi je 1c90 <_Z5func0RKSt6vectorIiSaIiEE+0x340> mov %ecx,(%rsi) add $0x4,%rsi mov %rsi,0x38(%rsp) mov 0x18(%rsp),%rsi lea -0x4(%r8,%rdi,1),%rdx cmp 0x20(%rsp),%rsi je 1cb0 <_Z5func0RKSt6vectorIiSaIiEE+0x360> mov (%rdx),%eax add $0x4,%rsi mov %eax,-0x4(%rsi) mov %rsi,0x18(%rsp) mov 0x10(%rsp),%r8 mov %rsi,%rbx pxor %xmm0,%xmm0 movq $0x0,0x10(%r12) movups %xmm0,(%r12) sub %r8,%rbx mov %rbx,%rax sar $0x2,%rax je 1c68 <_Z5func0RKSt6vectorIiSaIiEE+0x318> movabs $0x1fffffffffffffff,%rdx cmp %rdx,%rax ja 1cc9 <_Z5func0RKSt6vectorIiSaIiEE+0x379> mov %rbx,%rdi callq 1140 <_Znwm@plt> mov 0x18(%rsp),%rsi mov 0x10(%rsp),%r8 mov %rax,%rcx mov %rsi,%rbp sub %r8,%rbp movq %rcx,%xmm0 lea (%rcx,%rbx,1),%rax punpcklqdq %xmm0,%xmm0 mov %rax,0x10(%r12) movups %xmm0,(%r12) cmp %r8,%rsi je 1b2c <_Z5func0RKSt6vectorIiSaIiEE+0x1dc> mov %rcx,%rdi mov %rbp,%rdx mov %r8,%rsi callq 1160 <memmove@plt> mov %rax,%rcx mov 0x38(%rsp),%rdx add %rbp,%rcx pxor %xmm0,%xmm0 mov 0x30(%rsp),%rbp mov %rcx,0x8(%r12) mov %rdx,%rbx movups %xmm0,0x18(%r12) movq $0x0,0x28(%r12) sub %rbp,%rbx mov %rbx,%rax sar $0x2,%rax je 1c58 <_Z5func0RKSt6vectorIiSaIiEE+0x308> movabs $0x1fffffffffffffff,%rdx cmp %rdx,%rax ja 1cce <_Z5func0RKSt6vectorIiSaIiEE+0x37e> mov %rbx,%rdi callq 1140 <_Znwm@plt> mov 0x38(%rsp),%rdx mov 0x30(%rsp),%rbp mov %rax,%rcx mov %rdx,%r13 sub %rbp,%r13 movq %rcx,%xmm0 lea (%rcx,%rbx,1),%rax punpcklqdq %xmm0,%xmm0 mov %rax,0x28(%r12) movups %xmm0,0x18(%r12) cmp %rbp,%rdx je 1c40 <_Z5func0RKSt6vectorIiSaIiEE+0x2f0> mov %rcx,%rdi mov %r13,%rdx mov %rbp,%rsi callq 1160 <memmove@plt> mov %rax,%rcx add %r13,%rcx mov %rcx,0x20(%r12) mov %rbp,%rdi callq 1130 <_ZdlPv@plt> mov 0x10(%rsp),%rdi test %rdi,%rdi je 1be3 <_Z5func0RKSt6vectorIiSaIiEE+0x293> callq 1130 <_ZdlPv@plt> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 1cc4 <_Z5func0RKSt6vectorIiSaIiEE+0x374> add $0x50,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq nopw 0x0(%rax,%rax,1) mov %r14,%rdi callq 1db0 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> mov 0x0(%r13),%rax mov %rax,%r8 jmpq 1a46 <_Z5func0RKSt6vectorIiSaIiEE+0xf6> nopl 0x0(%rax) lea 0xc(%rsp),%rdx lea 0x30(%rsp),%rdi callq 1db0 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> mov 0x0(%r13),%rax jmpq 1a21 <_Z5func0RKSt6vectorIiSaIiEE+0xd1> add %r13,%rcx mov %rcx,0x20(%r12) test %rdx,%rdx je 1bd4 <_Z5func0RKSt6vectorIiSaIiEE+0x284> jmpq 1bcc <_Z5func0RKSt6vectorIiSaIiEE+0x27c> nopw 0x0(%rax,%rax,1) mov %rbx,%r13 xor %ecx,%ecx jmpq 1b92 <_Z5func0RKSt6vectorIiSaIiEE+0x242> nopw 0x0(%rax,%rax,1) mov %rbx,%rbp xor %ecx,%ecx jmpq 1aff <_Z5func0RKSt6vectorIiSaIiEE+0x1af> nopw 0x0(%rax,%rax,1) movups %xmm0,(%rdi) movups %xmm0,0x10(%rdi) movups %xmm0,0x20(%rdi) jmpq 1be3 <_Z5func0RKSt6vectorIiSaIiEE+0x293> nopl 0x0(%rax,%rax,1) lea 0xc(%rsp),%rdx lea 0x30(%rsp),%rdi callq 1db0 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> mov 0x0(%r13),%r8 mov 0x8(%r13),%rdi sub %r8,%rdi jmpq 1a84 <_Z5func0RKSt6vectorIiSaIiEE+0x134> lea 0x10(%rsp),%rdi callq 1db0 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> mov 0x18(%rsp),%rsi jmpq 1aa7 <_Z5func0RKSt6vectorIiSaIiEE+0x157> callq 1150 <__stack_chk_fail@plt> callq 10e0 <_ZSt17__throw_bad_allocv@plt> callq 10e0 <_ZSt17__throw_bad_allocv@plt> endbr64 mov %rax,%rbp jmpq 1195 <_Z5func0RKSt6vectorIiSaIiEE.cold> endbr64 mov %rax,%rbp jmpq 11a3 <_Z5func0RKSt6vectorIiSaIiEE.cold+0xe> nopl 0x0(%rax,%rax,1)
_Z5func0RKSt6vectorIiSaIiEE: endbr64 push r15 pxor xmm0, xmm0 push r14 push r13 push r12 mov r12, rdi push rbp push rbx sub rsp, 58h mov r8, [rsi+8] mov rax, fs:28h mov [rsp+88h+var_40], rax xor eax, eax mov rax, [rsi] movaps xmmword ptr [rsp+88h+src], xmm0 mov [rsp+88h+var_68], 0 mov [rsp+88h+var_48], 0 movaps xmmword ptr [rsp+88h+var_58], xmm0 cmp rax, r8 jz loc_1C60 mov rdx, r8 mov [rsp+88h+var_7C], 1 mov r13, rsi sub rdx, rax cmp rdx, 4 jz loc_1C70 mov ecx, 1 xor r9d, r9d xor esi, esi xor ebp, ebp jmp short loc_19ED loc_19D0: add ecx, 1 mov [rsp+88h+var_7C], ecx loc_19D7: mov rdi, r8 sub rdi, rax mov rdx, rdi sar rdx, 2 sub rdx, 1 cmp rbp, rdx jnb short loc_1A58 loc_19ED: lea rbx, ds:0[rbp*4] add rbp, 1 mov edi, [rax+rbx+4] cmp [rax+rbx], edi jz short loc_19D0 cmp rsi, r9 jz loc_1BF0 mov [rsi], ecx add rsi, 4 mov [rsp+88h+var_58+8], rsi loc_1A16: mov rsi, [rsp+88h+src+8] lea rdx, [rax+rbx] cmp rsi, [rsp+88h+var_68] jz loc_1BD0 mov edx, [rdx] add rsi, 4 mov [rsi-4], edx mov [rsp+88h+src+8], rsi loc_1A38: mov r8, [r13+8] mov rsi, [rsp+88h+var_58+8] mov ecx, 1 mov [rsp+88h+var_7C], 1 mov r9, [rsp+88h+var_48] jmp short loc_19D7 loc_1A58: cmp r9, rsi jz loc_1C72 mov [rsi], ecx add rsi, 4 mov [rsp+88h+var_58+8], rsi loc_1A6C: mov rsi, [rsp+88h+src+8] lea rdx, [rax+rdi-4] cmp rsi, [rsp+88h+var_68] jz loc_1CA0 mov eax, [rdx] add rsi, 4 mov [rsi-4], eax mov [rsp+88h+src+8], rsi loc_1A8F: mov rbp, [rsp+88h+src] pxor xmm0, xmm0 mov rbx, rsi mov qword ptr [r12+10h], 0 movups xmmword ptr [r12], xmm0 sub rbx, rbp jz loc_1C10 mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbx jb loc_1CBC mov rdi, rbx; unsigned __int64 lea r15, [rsp+88h+var_58] lea r14, [rsp+88h+src] call __Znwm; operator new(ulong) movq xmm0, rax lea r13, [rax+rbx] mov rdi, rax; dest punpcklqdq xmm0, xmm0 mov [r12+10h], r13 movups xmmword ptr [r12], xmm0 cmp rbx, 4 jle loc_1CF5 mov rdx, rbx; n mov rsi, rbp; src call _memmove loc_1B06: mov [r12+8], r13 mov rbx, [rsp+88h+var_58+8] pxor xmm0, xmm0 mov r13, [rsp+88h+var_58] movups xmmword ptr [r12+18h], xmm0 mov qword ptr [r12+28h], 0 sub rbx, r13 jz loc_1C30 mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbx jb loc_1CDB mov rdi, rbx; unsigned __int64 call __Znwm; operator new(ulong) movq xmm0, rax lea r14, [rax+rbx] mov rdi, rax; dest punpcklqdq xmm0, xmm0 mov [r12+28h], r14 movups xmmword ptr [r12+18h], xmm0 cmp rbx, 4 jle loc_1D05 mov rdx, rbx; n mov rsi, r13; src call _memmove mov [r12+20h], r14 loc_1B81: mov rsi, [rsp+88h+var_48] mov rdi, r13; void * sub rsi, r13; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_1B91: mov rsi, [rsp+88h+var_68] sub rsi, rbp; unsigned __int64 test rbp, rbp jz short loc_1BA6 mov rdi, rbp; void * call __ZdlPvm; operator delete(void *,ulong) loc_1BA6: mov rax, [rsp+88h+var_40] sub rax, fs:28h jnz loc_1CF0 add rsp, 58h mov rax, r12 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1BD0: lea r14, [rsp+88h+src] lea r15, [rsp+88h+var_58] mov rdi, r14 call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) mov rax, [r13+0] jmp loc_1A38 loc_1BF0: lea r15, [rsp+88h+var_58] lea rdx, [rsp+88h+var_7C] mov rdi, r15 lea r14, [rsp+88h+src] call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) mov rax, [r13+0] jmp loc_1A16 loc_1C10: mov qword ptr [r12], 0 xor r13d, r13d mov qword ptr [r12+10h], 0 jmp loc_1B06 loc_1C30: mov qword ptr [r12+18h], 0 xor r14d, r14d mov qword ptr [r12+28h], 0 loc_1C45: mov [r12+20h], r14 test r13, r13 jz loc_1B91 jmp loc_1B81 loc_1C60: movups xmmword ptr [rdi], xmm0 movups xmmword ptr [rdi+10h], xmm0 movups xmmword ptr [rdi+20h], xmm0 jmp loc_1BA6 loc_1C70: xor esi, esi loc_1C72: lea r15, [rsp+88h+var_58] lea rdx, [rsp+88h+var_7C] mov rdi, r15 lea r14, [rsp+88h+src] call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) mov rax, [r13+0] mov rdi, [r13+8] sub rdi, rax jmp loc_1A6C loc_1CA0: lea r14, [rsp+88h+src] lea r15, [rsp+88h+var_58] mov rdi, r14 call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int const&) mov rsi, [rsp+88h+src+8] jmp loc_1A8F loc_1CBC: mov rax, [rsp+88h+var_40] sub rax, fs:28h jnz short loc_1CF0 lea r15, [rsp+88h+var_58] lea r14, [rsp+88h+src] call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) loc_1CDB: mov rax, [rsp+88h+var_40] sub rax, fs:28h jnz short loc_1CF0 call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) loc_1CF0: call ___stack_chk_fail loc_1CF5: jnz loc_1B06 mov eax, [rbp+0] mov [rdi], eax jmp loc_1B06 loc_1D05: jnz loc_1C45 mov eax, [r13+0] mov [rdi], eax mov [r12+20h], r14 jmp loc_1B81 endbr64 mov rbx, rax jmp loc_1192 endbr64 mov rbx, rax jmp _Z5func0RKSt6vectorIiSaIiEE_cold; func0(std::vector<int> const&) [clone]
long long func0(long long a1, long long *a2, long long a3, long long a4) { long long v5; // r8 long long v6; // rax _DWORD *v8; // r9 _DWORD *v9; // rsi unsigned long long v10; // rbp long long v11; // rdi long long v12; // rbx _DWORD *v13; // rdx char *v14; // rsi _DWORD *v15; // rdx char *v16; // rsi char *v17; // rbp long long v18; // rbx _DWORD *v19; // rax char *v20; // r13 _BYTE *v21; // rbx _DWORD *v22; // r13 signed long long v23; // rbx _DWORD *v24; // rax char *v25; // r14 int v27; // [rsp+4h] [rbp-7Ch] BYREF void *src[2]; // [rsp+8h] [rbp-78h] BYREF _BYTE *v29; // [rsp+18h] [rbp-68h] void *v30[2]; // [rsp+28h] [rbp-58h] BYREF _DWORD *v31; // [rsp+38h] [rbp-48h] unsigned long long v32; // [rsp+40h] [rbp-40h] v5 = a2[1]; v32 = __readfsqword(0x28u); v6 = *a2; *(_OWORD *)src = 0LL; v29 = 0LL; v31 = 0LL; *(_OWORD *)v30 = 0LL; if ( v6 == v5 ) { *(_OWORD *)a1 = 0LL; *(_OWORD *)(a1 + 16) = 0LL; *(_OWORD *)(a1 + 32) = 0LL; return a1; } v27 = 1; if ( v5 - v6 == 4 ) { v9 = 0LL; } else { a4 = 1LL; v8 = 0LL; v9 = 0LL; v10 = 0LL; do { v12 = 4 * v10++; if ( *(_DWORD *)(v6 + v12) == *(_DWORD *)(v6 + v12 + 4) ) { a4 = (unsigned int)(a4 + 1); v27 = a4; } else { if ( v9 == v8 ) { std::vector<int>::_M_realloc_insert<int const&>(v30, v9, &v27, a4); v6 = *a2; } else { *v9 = a4; v30[1] = v9 + 1; } v13 = (_DWORD *)(v6 + v12); if ( src[1] == v29 ) { std::vector<int>::_M_realloc_insert<int const&>(src, src[1], v13, a4); v6 = *a2; } else { v14 = (char *)src[1] + 4; *(_DWORD *)src[1] = *v13; src[1] = v14; } v5 = a2[1]; v9 = v30[1]; a4 = 1LL; v27 = 1; v8 = v31; } v11 = v5 - v6; } while ( v10 < ((v5 - v6) >> 2) - 1 ); if ( v8 != v9 ) { *v9 = a4; v30[1] = v9 + 1; goto LABEL_14; } } std::vector<int>::_M_realloc_insert<int const&>(v30, v9, &v27, a4); v6 = *a2; v11 = a2[1] - *a2; LABEL_14: v15 = (_DWORD *)(v6 + v11 - 4); if ( src[1] == v29 ) { std::vector<int>::_M_realloc_insert<int const&>(src, src[1], v15, a4); v16 = (char *)src[1]; } else { v16 = (char *)src[1] + 4; *(_DWORD *)src[1] = *v15; src[1] = v16; } v17 = (char *)src[0]; *(_QWORD *)(a1 + 16) = 0LL; *(_OWORD *)a1 = 0LL; v18 = v16 - v17; if ( v16 == v17 ) { *(_QWORD *)a1 = 0LL; v20 = 0LL; *(_QWORD *)(a1 + 16) = 0LL; } else { if ( (unsigned long long)v18 > 0x7FFFFFFFFFFFFFFCLL ) { std::__throw_bad_array_new_length(); goto LABEL_39; } v19 = (_DWORD *)operator new(v16 - v17); v20 = (char *)v19 + v18; *(_QWORD *)(a1 + 16) = (char *)v19 + v18; *(__m128i *)a1 = _mm_unpacklo_epi64((__m128i)(unsigned long long)v19, (__m128i)(unsigned long long)v19); if ( v18 <= 4 ) { if ( v18 == 4 ) *v19 = *(_DWORD *)v17; } else { memmove(v19, v17, v16 - v17); } } *(_QWORD *)(a1 + 8) = v20; v21 = v30[1]; v22 = v30[0]; *(_OWORD *)(a1 + 24) = 0LL; *(_QWORD *)(a1 + 40) = 0LL; v23 = v21 - (_BYTE *)v22; if ( !v23 ) { *(_QWORD *)(a1 + 24) = 0LL; v25 = 0LL; *(_QWORD *)(a1 + 40) = 0LL; goto LABEL_32; } if ( (unsigned long long)v23 > 0x7FFFFFFFFFFFFFFCLL ) LABEL_39: std::__throw_bad_array_new_length(); v24 = (_DWORD *)operator new(v23); v25 = (char *)v24 + v23; *(_QWORD *)(a1 + 40) = (char *)v24 + v23; *(__m128i *)(a1 + 24) = _mm_unpacklo_epi64((__m128i)(unsigned long long)v24, (__m128i)(unsigned long long)v24); if ( v23 > 4 ) { memmove(v24, v22, v23); *(_QWORD *)(a1 + 32) = v25; LABEL_24: operator delete(v22, (char *)v31 - (char *)v22); goto LABEL_25; } if ( v23 == 4 ) { *v24 = *v22; *(_QWORD *)(a1 + 32) = v25; goto LABEL_24; } LABEL_32: *(_QWORD *)(a1 + 32) = v25; if ( v22 ) goto LABEL_24; LABEL_25: if ( v17 ) operator delete(v17, v29 - v17); return a1; }
func0: ENDBR64 PUSH R15 PXOR XMM0,XMM0 PUSH R14 PUSH R13 PUSH R12 MOV R12,RDI PUSH RBP PUSH RBX SUB RSP,0x58 MOV R8,qword ptr [RSI + 0x8] MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV RAX,qword ptr [RSI] MOVAPS xmmword ptr [RSP + 0x10],XMM0 MOV qword ptr [RSP + 0x20],0x0 MOV qword ptr [RSP + 0x40],0x0 MOVAPS xmmword ptr [RSP + 0x30],XMM0 CMP RAX,R8 JZ 0x00101c60 MOV RDX,R8 MOV dword ptr [RSP + 0xc],0x1 MOV R13,RSI SUB RDX,RAX CMP RDX,0x4 JZ 0x00101c70 MOV ECX,0x1 XOR R9D,R9D XOR ESI,ESI XOR EBP,EBP JMP 0x001019ed LAB_001019d0: ADD ECX,0x1 MOV dword ptr [RSP + 0xc],ECX LAB_001019d7: MOV RDI,R8 SUB RDI,RAX MOV RDX,RDI SAR RDX,0x2 SUB RDX,0x1 CMP RBP,RDX JNC 0x00101a58 LAB_001019ed: LEA RBX,[RBP*0x4] ADD RBP,0x1 MOV EDI,dword ptr [RAX + RBX*0x1 + 0x4] CMP dword ptr [RAX + RBX*0x1],EDI JZ 0x001019d0 CMP RSI,R9 JZ 0x00101bf0 MOV dword ptr [RSI],ECX ADD RSI,0x4 MOV qword ptr [RSP + 0x38],RSI LAB_00101a16: MOV RSI,qword ptr [RSP + 0x18] LEA RDX,[RAX + RBX*0x1] CMP RSI,qword ptr [RSP + 0x20] JZ 0x00101bd0 MOV EDX,dword ptr [RDX] ADD RSI,0x4 MOV dword ptr [RSI + -0x4],EDX MOV qword ptr [RSP + 0x18],RSI LAB_00101a38: MOV R8,qword ptr [R13 + 0x8] MOV RSI,qword ptr [RSP + 0x38] MOV ECX,0x1 MOV dword ptr [RSP + 0xc],0x1 MOV R9,qword ptr [RSP + 0x40] JMP 0x001019d7 LAB_00101a58: CMP R9,RSI JZ 0x00101c72 MOV dword ptr [RSI],ECX ADD RSI,0x4 MOV qword ptr [RSP + 0x38],RSI LAB_00101a6c: MOV RSI,qword ptr [RSP + 0x18] LEA RDX,[RAX + RDI*0x1 + -0x4] CMP RSI,qword ptr [RSP + 0x20] JZ 0x00101ca0 MOV EAX,dword ptr [RDX] ADD RSI,0x4 MOV dword ptr [RSI + -0x4],EAX MOV qword ptr [RSP + 0x18],RSI LAB_00101a8f: MOV RBP,qword ptr [RSP + 0x10] PXOR XMM0,XMM0 MOV RBX,RSI MOV qword ptr [R12 + 0x10],0x0 MOVUPS xmmword ptr [R12],XMM0 SUB RBX,RBP JZ 0x00101c10 MOV RAX,0x7ffffffffffffffc CMP RAX,RBX JC 0x00101cbc MOV RDI,RBX LEA R15,[RSP + 0x30] LEA R14,[RSP + 0x10] LAB_00101ad2: CALL 0x00101130 MOVQ XMM0,RAX LEA R13,[RAX + RBX*0x1] MOV RDI,RAX PUNPCKLQDQ XMM0,XMM0 MOV qword ptr [R12 + 0x10],R13 MOVUPS xmmword ptr [R12],XMM0 CMP RBX,0x4 JLE 0x00101cf5 MOV RDX,RBX MOV RSI,RBP CALL 0x00101160 LAB_00101b06: MOV qword ptr [R12 + 0x8],R13 MOV RBX,qword ptr [RSP + 0x38] PXOR XMM0,XMM0 MOV R13,qword ptr [RSP + 0x30] MOVUPS xmmword ptr [R12 + 0x18],XMM0 MOV qword ptr [R12 + 0x28],0x0 SUB RBX,R13 JZ 0x00101c30 MOV RAX,0x7ffffffffffffffc CMP RAX,RBX JC 0x00101cdb MOV RDI,RBX LAB_00101b47: CALL 0x00101130 MOVQ XMM0,RAX LEA R14,[RAX + RBX*0x1] MOV RDI,RAX PUNPCKLQDQ XMM0,XMM0 MOV qword ptr [R12 + 0x28],R14 MOVUPS xmmword ptr [R12 + 0x18],XMM0 CMP RBX,0x4 JLE 0x00101d05 MOV RDX,RBX MOV RSI,R13 CALL 0x00101160 MOV qword ptr [R12 + 0x20],R14 LAB_00101b81: MOV RSI,qword ptr [RSP + 0x40] MOV RDI,R13 SUB RSI,R13 CALL 0x00101140 LAB_00101b91: MOV RSI,qword ptr [RSP + 0x20] SUB RSI,RBP TEST RBP,RBP JZ 0x00101ba6 MOV RDI,RBP CALL 0x00101140 LAB_00101ba6: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101cf0 ADD RSP,0x58 MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101bd0: LEA R14,[RSP + 0x10] LEA R15,[RSP + 0x30] MOV RDI,R14 LAB_00101bdd: CALL 0x00101ed0 MOV RAX,qword ptr [R13] JMP 0x00101a38 LAB_00101bf0: LEA R15,[RSP + 0x30] LEA RDX,[RSP + 0xc] MOV RDI,R15 LEA R14,[RSP + 0x10] CALL 0x00101ed0 MOV RAX,qword ptr [R13] JMP 0x00101a16 LAB_00101c10: MOV qword ptr [R12],0x0 XOR R13D,R13D MOV qword ptr [R12 + 0x10],0x0 JMP 0x00101b06 LAB_00101c30: MOV qword ptr [R12 + 0x18],0x0 XOR R14D,R14D MOV qword ptr [R12 + 0x28],0x0 LAB_00101c45: MOV qword ptr [R12 + 0x20],R14 TEST R13,R13 JZ 0x00101b91 JMP 0x00101b81 LAB_00101c60: MOVUPS xmmword ptr [RDI],XMM0 MOVUPS xmmword ptr [RDI + 0x10],XMM0 MOVUPS xmmword ptr [RDI + 0x20],XMM0 JMP 0x00101ba6 LAB_00101c70: XOR ESI,ESI LAB_00101c72: LEA R15,[RSP + 0x30] LEA RDX,[RSP + 0xc] MOV RDI,R15 LEA R14,[RSP + 0x10] CALL 0x00101ed0 MOV RAX,qword ptr [R13] MOV RDI,qword ptr [R13 + 0x8] SUB RDI,RAX JMP 0x00101a6c LAB_00101ca0: LEA R14,[RSP + 0x10] LEA R15,[RSP + 0x30] MOV RDI,R14 CALL 0x00101ed0 MOV RSI,qword ptr [RSP + 0x18] JMP 0x00101a8f LAB_00101cbc: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101cf0 LEA R15,[RSP + 0x30] LEA R14,[RSP + 0x10] CALL 0x00101110 LAB_00101cdb: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101cf0 LAB_00101ceb: CALL 0x00101110 LAB_00101cf0: CALL 0x00101150 LAB_00101cf5: JNZ 0x00101b06 MOV EAX,dword ptr [RBP] MOV dword ptr [RDI],EAX JMP 0x00101b06 LAB_00101d05: JNZ 0x00101c45 MOV EAX,dword ptr [R13] MOV dword ptr [RDI],EAX MOV qword ptr [R12 + 0x20],R14 JMP 0x00101b81
/* func0(std::vector<int, std::allocator<int> > const&) */ vector * func0(vector *param_1) { int8 __src; int8 __src_00; long lVar1; int4 *puVar2; ulong uVar3; long *in_RSI; int *piVar4; int *piVar5; long lVar6; long lVar7; long in_FS_OFFSET; int local_7c; int local_78 [16]; int *local_68; int local_58 [16]; int *local_48; long local_40; lVar7 = in_RSI[1]; local_40 = *(long *)(in_FS_OFFSET + 0x28); lVar1 = *in_RSI; local_78 = (int [16])0x0; local_68 = (int *)0x0; local_48 = (int *)0x0; local_58 = (int [16])0x0; if (lVar1 == lVar7) { *(int (*) [16])param_1 = (int [16])0x0; *(int (*) [16])(param_1 + 0x10) = (int [16])0x0; *(int (*) [16])(param_1 + 0x20) = (int [16])0x0; } else { local_7c = 1; if (lVar7 - lVar1 == 4) { piVar4 = (int *)0x0; LAB_00101c72: std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)local_58,(__normal_iterator)piVar4,&local_7c); lVar1 = *in_RSI; lVar6 = in_RSI[1] - lVar1; } else { piVar5 = (int *)0x0; piVar4 = (int *)0x0; uVar3 = 0; do { lVar6 = uVar3 * 4; uVar3 = uVar3 + 1; if (*(int *)(lVar1 + lVar6) == *(int *)(lVar1 + 4 + lVar6)) { local_7c = local_7c + 1; } else { if (piVar4 == piVar5) { std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)local_58,(__normal_iterator)piVar4, &local_7c); lVar1 = *in_RSI; } else { *piVar4 = local_7c; local_58._8_8_ = piVar4 + 1; } if ((int *)local_78._8_8_ == local_68) { /* try { // try from 00101bdd to 00101cda has its CatchHandler @ 00101d1b */ std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)local_78,local_78._8_4_, (int *)(lVar1 + lVar6)); lVar1 = *in_RSI; } else { *(int *)local_78._8_8_ = *(int *)(lVar1 + lVar6); local_78._8_8_ = (int *)(local_78._8_8_ + 4); } lVar7 = in_RSI[1]; local_7c = 1; piVar4 = (int *)local_58._8_8_; piVar5 = local_48; } lVar6 = lVar7 - lVar1; } while (uVar3 < (lVar6 >> 2) - 1U); if (piVar5 == piVar4) goto LAB_00101c72; *piVar4 = local_7c; local_58._8_8_ = piVar4 + 1; } piVar4 = (int *)(lVar1 + -4 + lVar6); if ((int *)local_78._8_8_ == local_68) { std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)local_78,local_78._8_4_,piVar4); piVar5 = (int *)local_78._8_8_; } else { piVar5 = (int *)(local_78._8_8_ + 4); *(int *)local_78._8_8_ = *piVar4; local_78._8_8_ = piVar5; } __src = local_78._0_8_; *(int8 *)(param_1 + 0x10) = 0; *(int (*) [16])param_1 = (int [16])0x0; uVar3 = (long)piVar5 - local_78._0_8_; if (uVar3 != 0) { if (uVar3 < 0x7ffffffffffffffd) { /* try { // try from 00101ad2 to 00101ad6 has its CatchHandler @ 00101d1b */ puVar2 = (int4 *)operator_new(uVar3); lVar7 = (long)puVar2 + uVar3; *(long *)(param_1 + 0x10) = lVar7; *(int4 **)param_1 = puVar2; *(int4 **)(param_1 + 8) = puVar2; if ((long)uVar3 < 5) { if (uVar3 == 4) { *puVar2 = *(int4 *)__src; } } else { memmove(puVar2,(void *)__src,uVar3); } goto LAB_00101b06; } if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) goto LAB_00101cf0; std::__throw_bad_array_new_length(); LAB_00101cdb: if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { /* try { // try from 00101ceb to 00101cef has its CatchHandler @ 00101d27 */ std::__throw_bad_array_new_length(); } goto LAB_00101cf0; } *(int8 *)param_1 = 0; lVar7 = 0; *(int8 *)(param_1 + 0x10) = 0; LAB_00101b06: *(long *)(param_1 + 8) = lVar7; __src_00 = local_58._0_8_; *(int (*) [16])(param_1 + 0x18) = (int [16])0x0; *(int8 *)(param_1 + 0x28) = 0; uVar3 = local_58._8_8_ - local_58._0_8_; if (uVar3 == 0) { *(int8 *)(param_1 + 0x18) = 0; lVar7 = 0; *(int8 *)(param_1 + 0x28) = 0; LAB_00101c45: *(long *)(param_1 + 0x20) = lVar7; if ((int4 *)__src_00 != (int4 *)0x0) goto LAB_00101b81; } else { if (0x7ffffffffffffffc < uVar3) goto LAB_00101cdb; /* try { // try from 00101b47 to 00101b4b has its CatchHandler @ 00101d27 */ puVar2 = (int4 *)operator_new(uVar3); lVar7 = (long)puVar2 + uVar3; *(long *)(param_1 + 0x28) = lVar7; *(int4 **)(param_1 + 0x18) = puVar2; *(int4 **)(param_1 + 0x20) = puVar2; if ((long)uVar3 < 5) { if (uVar3 != 4) goto LAB_00101c45; *puVar2 = *(int4 *)__src_00; *(long *)(param_1 + 0x20) = lVar7; } else { memmove(puVar2,(void *)__src_00,uVar3); *(long *)(param_1 + 0x20) = lVar7; } LAB_00101b81: operator_delete((void *)__src_00,(long)local_48 - __src_00); } if ((int4 *)__src != (int4 *)0x0) { operator_delete((void *)__src,(long)local_68 - __src); } } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } LAB_00101cf0: /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
3,276
func0
#include <assert.h>
bool func0(int monthnum1) { if (monthnum1 == 2) { return true; } else { return false; } }
int main() { assert(func0(2) == true); assert(func0(1) == false); assert(func0(3) == false); return 0; }
O0
cpp
func0(int): endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) cmpl $0x2,-0x4(%rbp) jne 1161 <_Z5func0i+0x18> mov $0x1,%eax jmp 1166 <_Z5func0i+0x1d> mov $0x0,%eax pop %rbp retq
_Z5func0i: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi cmp [rbp+var_4], 2 jnz short loc_1161 mov eax, 1 jmp short loc_1166 loc_1161: mov eax, 0 loc_1166: pop rbp retn
_BOOL8 func0(int a1) { return a1 == 2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI CMP dword ptr [RBP + -0x4],0x2 JNZ 0x00101161 MOV EAX,0x1 JMP 0x00101166 LAB_00101161: MOV EAX,0x0 LAB_00101166: POP RBP RET
/* func0(int) */ bool func0(int param_1) { return param_1 == 2; }
3,277
func0
#include <assert.h>
bool func0(int monthnum1) { if (monthnum1 == 2) { return true; } else { return false; } }
int main() { assert(func0(2) == true); assert(func0(1) == false); assert(func0(3) == false); return 0; }
O1
cpp
func0(int): endbr64 cmp $0x2,%edi sete %al retq
_Z5func0i: endbr64 cmp edi, 2 setz al retn
bool func0(int a1) { return a1 == 2; }
func0: ENDBR64 CMP EDI,0x2 SETZ AL RET
/* func0(int) */ bool func0(int param_1) { return param_1 == 2; }
3,278
func0
#include <assert.h>
bool func0(int monthnum1) { if (monthnum1 == 2) { return true; } else { return false; } }
int main() { assert(func0(2) == true); assert(func0(1) == false); assert(func0(3) == false); return 0; }
O2
cpp
func0(int): endbr64 cmp $0x2,%edi sete %al retq nopl 0x0(%rax,%rax,1)
_Z5func0i: endbr64 cmp edi, 2 setz al retn
bool func0(int a1) { return a1 == 2; }
func0: ENDBR64 CMP EDI,0x2 SETZ AL RET
/* func0(int) */ bool func0(int param_1) { return param_1 == 2; }
3,279
func0
#include <assert.h>
bool func0(int monthnum1) { if (monthnum1 == 2) { return true; } else { return false; } }
int main() { assert(func0(2) == true); assert(func0(1) == false); assert(func0(3) == false); return 0; }
O3
cpp
func0(int): endbr64 cmp $0x2,%edi sete %al retq nopl 0x0(%rax,%rax,1)
_Z5func0i: endbr64 cmp edi, 2 setz al retn
bool func0(int a1) { return a1 == 2; }
func0: ENDBR64 CMP EDI,0x2 SETZ AL RET
/* func0(int) */ bool func0(int param_1) { return param_1 == 2; }
3,280
func0
#include <cassert> #include <map> #include <string>
std::map<std::string, std::string> func0(const std::map<std::string, std::string>& dict1, const std::map<std::string, std::string>& dict2) { std::map<std::string, std::string> merged_dict; for (const auto &pair : dict1) { merged_dict.insert(pair); } for (const auto &pair : dict2) { if (merged_dict.find(pair.first) == merged_dict.end()) { merged_dict.insert(pair); } } return merged_dict; }
int main() { { std::map<std::string, std::string> d1 = { {"R", "Red"}, {"B", "Black"}, {"P", "Pink"} }; std::map<std::string, std::string> d2 = { {"G", "Green"}, {"W", "White"} }; std::map<std::string, std::string> expected = { {"B", "Black"}, {"G", "Green"}, {"P", "Pink"}, {"R", "Red"}, {"W", "White"} }; assert(func0(d1, d2) == expected); } { std::map<std::string, std::string> d1 = { {"R", "Red"}, {"B", "Black"}, {"P", "Pink"} }; std::map<std::string, std::string> d2 = { {"O", "Orange"}, {"W", "White"}, {"B", "Black"} }; std::map<std::string, std::string> expected = { {"B", "Black"}, {"O", "Orange"}, {"P", "Pink"}, {"R", "Red"}, {"W", "White"} }; assert(func0(d1, d2) == expected); } { std::map<std::string, std::string> d1 = { {"G", "Green"}, {"W", "White"} }; std::map<std::string, std::string> d2 = { {"O", "Orange"}, {"W", "White"}, {"B", "Black"} }; std::map<std::string, std::string> expected = { {"B", "Black"}, {"G", "Green"}, {"O", "Orange"}, {"W", "White"} }; assert(func0(d1, d2) == expected); } return 0; }
O0
cpp
func0(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x78,%rsp mov %rdi,-0x68(%rbp) mov %rsi,-0x70(%rbp) mov %rdx,-0x78(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax mov -0x68(%rbp),%rax mov %rax,%rdi callq 37bc <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEEC1Ev> mov -0x70(%rbp),%rax mov %rax,-0x38(%rbp) mov -0x38(%rbp),%rax mov %rax,%rdi callq 3daa <_ZNKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE5beginEv> mov %rax,-0x48(%rbp) mov -0x38(%rbp),%rax mov %rax,%rdi callq 3dc8 <_ZNKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE3endEv> mov %rax,-0x40(%rbp) lea -0x40(%rbp),%rdx lea -0x48(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 3de6 <_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EESB_> test %al,%al je 25cd <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0xa4> lea -0x48(%rbp),%rax mov %rax,%rdi callq 3e38 <_ZNKSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EEdeEv> mov %rax,-0x20(%rbp) mov -0x20(%rbp),%rdx mov -0x68(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 3e5a <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE6insertERKSA_> lea -0x48(%rbp),%rax mov %rax,%rdi callq 3e0c <_ZNSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EEppEv> jmp 2585 <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0x5c> mov -0x78(%rbp),%rax mov %rax,-0x30(%rbp) mov -0x30(%rbp),%rax mov %rax,%rdi callq 3daa <_ZNKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE5beginEv> mov %rax,-0x58(%rbp) mov -0x30(%rbp),%rax mov %rax,%rdi callq 3dc8 <_ZNKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE3endEv> mov %rax,-0x50(%rbp) lea -0x50(%rbp),%rdx lea -0x58(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 3de6 <_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EESB_> test %al,%al je 26a0 <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0x177> lea -0x58(%rbp),%rax mov %rax,%rdi callq 3e38 <_ZNKSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EEdeEv> mov %rax,-0x28(%rbp) mov -0x68(%rbp),%rax mov %rax,%rdi callq 3eae <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE3endEv> mov %rax,-0x40(%rbp) mov -0x28(%rbp),%rdx mov -0x68(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 3e84 <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE4findERS9_> mov %rax,-0x48(%rbp) lea -0x40(%rbp),%rdx lea -0x48(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 3ecc <_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EESB_> test %al,%al je 2671 <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0x148> mov -0x28(%rbp),%rdx mov -0x68(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 3e5a <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE6insertERKSA_> lea -0x58(%rbp),%rax mov %rax,%rdi callq 3e0c <_ZNSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EEppEv> jmpq 25f5 <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0xcc> endbr64 mov %rax,%rbx mov -0x68(%rbp),%rax mov %rax,%rdi callq 37dc <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 2400 <_Unwind_Resume@plt> mov -0x18(%rbp),%rax xor %fs:0x28,%rax je 26b5 <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0x18c> callq 23a0 <__stack_chk_fail@plt> mov -0x68(%rbp),%rax add $0x78,%rsp pop %rbx pop %rbp retq
_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 78h mov [rbp+var_68], rdi mov [rbp+var_70], rsi mov [rbp+var_78], rdx mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax mov rax, [rbp+var_68] mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEEC2Ev; std::map<std::string,std::string>::map(void) mov rax, [rbp+var_70] mov [rbp+var_38], rax mov rax, [rbp+var_38] mov rdi, rax call _ZNKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE5beginEv; std::map<std::string,std::string>::begin(void) mov [rbp+var_48], rax mov rax, [rbp+var_38] mov rdi, rax call _ZNKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE3endEv; std::map<std::string,std::string>::end(void) mov [rbp+var_40], rax jmp short loc_2596 loc_2567: lea rax, [rbp+var_48] mov rdi, rax call _ZNKSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EEdeEv; std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>>::operator*(void) mov [rbp+var_20], rax mov rdx, [rbp+var_20] mov rax, [rbp+var_68] mov rsi, rdx mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE6insertERKSA_; std::map<std::string,std::string>::insert(std::pair<std::string const,std::string> const&) lea rax, [rbp+var_48] mov rdi, rax call _ZNSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EEppEv; std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>>::operator++(void) loc_2596: lea rdx, [rbp+var_40] lea rax, [rbp+var_48] mov rsi, rdx mov rdi, rax call _ZStneRKSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EESB_; std::operator!=(std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>> const&,std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>> const&) test al, al jnz short loc_2567 mov rax, [rbp+var_78] mov [rbp+var_30], rax mov rax, [rbp+var_30] mov rdi, rax call _ZNKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE5beginEv; std::map<std::string,std::string>::begin(void) mov [rbp+var_58], rax mov rax, [rbp+var_30] mov rdi, rax call _ZNKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE3endEv; std::map<std::string,std::string>::end(void) mov [rbp+var_50], rax jmp short loc_2644 loc_25D7: lea rax, [rbp+var_58] mov rdi, rax call _ZNKSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EEdeEv; std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>>::operator*(void) mov [rbp+var_28], rax mov rax, [rbp+var_68] mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE3endEv; std::map<std::string,std::string>::end(void) mov [rbp+var_40], rax mov rdx, [rbp+var_28] mov rax, [rbp+var_68] mov rsi, rdx mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE4findERS9_; std::map<std::string,std::string>::find(std::string const&) mov [rbp+var_48], rax lea rdx, [rbp+var_40] lea rax, [rbp+var_48] mov rsi, rdx mov rdi, rax call _ZSteqRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EESB_; std::operator==(std::_Rb_tree_iterator<std::pair<std::string const,std::string>> const&,std::_Rb_tree_iterator<std::pair<std::string const,std::string>> const&) test al, al jz short loc_2638 mov rdx, [rbp+var_28] mov rax, [rbp+var_68] mov rsi, rdx mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEE6insertERKSA_; std::map<std::string,std::string>::insert(std::pair<std::string const,std::string> const&) loc_2638: lea rax, [rbp+var_58] mov rdi, rax call _ZNSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EEppEv; std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>>::operator++(void) loc_2644: lea rdx, [rbp+var_50] lea rax, [rbp+var_58] mov rsi, rdx mov rdi, rax call _ZStneRKSt23_Rb_tree_const_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_EESB_; std::operator!=(std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>> const&,std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>> const&) test al, al jnz loc_25D7 jmp short loc_2693 endbr64 mov rbx, rax mov rax, [rbp+var_68] mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEED2Ev; std::map<std::string,std::string>::~map() mov rax, rbx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_268B call ___stack_chk_fail loc_268B: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_2693: mov rax, [rbp+var_18] sub rax, fs:28h jz short loc_26A7 call ___stack_chk_fail loc_26A7: mov rax, [rbp+var_68] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, long long a2, long long a3) { long long v5; // [rsp+28h] [rbp-58h] BYREF long long v6; // [rsp+30h] [rbp-50h] BYREF long long v7; // [rsp+38h] [rbp-48h] BYREF _QWORD v8[2]; // [rsp+40h] [rbp-40h] BYREF long long v9; // [rsp+50h] [rbp-30h] long long v10; // [rsp+58h] [rbp-28h] long long v11; // [rsp+60h] [rbp-20h] unsigned long long v12; // [rsp+68h] [rbp-18h] v12 = __readfsqword(0x28u); std::map<std::string,std::string>::map(a1); v8[1] = a2; v7 = std::map<std::string,std::string>::begin(a2); v8[0] = std::map<std::string,std::string>::end(a2); while ( (unsigned __int8)std::operator!=(&v7, v8) ) { v11 = std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>>::operator*(&v7); std::map<std::string,std::string>::insert(a1, v11); std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>>::operator++(&v7); } v9 = a3; v5 = std::map<std::string,std::string>::begin(a3); v6 = std::map<std::string,std::string>::end(v9); while ( (unsigned __int8)std::operator!=(&v5, &v6) ) { v10 = std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>>::operator*(&v5); v8[0] = std::map<std::string,std::string>::end(a1); v7 = std::map<std::string,std::string>::find(a1, v10); if ( (unsigned __int8)std::operator==(&v7, v8) ) std::map<std::string,std::string>::insert(a1, v10); std::_Rb_tree_const_iterator<std::pair<std::string const,std::string>>::operator++(&v5); } return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x78 MOV qword ptr [RBP + -0x68],RDI MOV qword ptr [RBP + -0x70],RSI MOV qword ptr [RBP + -0x78],RDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV RAX,qword ptr [RBP + -0x68] MOV RDI,RAX CALL 0x00103adc MOV RAX,qword ptr [RBP + -0x70] MOV qword ptr [RBP + -0x38],RAX MOV RAX,qword ptr [RBP + -0x38] MOV RDI,RAX CALL 0x00104132 MOV qword ptr [RBP + -0x48],RAX MOV RAX,qword ptr [RBP + -0x38] MOV RDI,RAX CALL 0x00104150 MOV qword ptr [RBP + -0x40],RAX JMP 0x00102596 LAB_00102567: LEA RAX,[RBP + -0x48] MOV RDI,RAX CALL 0x001041c0 MOV qword ptr [RBP + -0x20],RAX MOV RDX,qword ptr [RBP + -0x20] MOV RAX,qword ptr [RBP + -0x68] MOV RSI,RDX MOV RDI,RAX LAB_00102585: CALL 0x001041e2 LEA RAX,[RBP + -0x48] MOV RDI,RAX CALL 0x00104194 LAB_00102596: LEA RDX,[RBP + -0x40] LEA RAX,[RBP + -0x48] MOV RSI,RDX MOV RDI,RAX CALL 0x0010416e TEST AL,AL JNZ 0x00102567 MOV RAX,qword ptr [RBP + -0x78] MOV qword ptr [RBP + -0x30],RAX MOV RAX,qword ptr [RBP + -0x30] MOV RDI,RAX CALL 0x00104132 MOV qword ptr [RBP + -0x58],RAX MOV RAX,qword ptr [RBP + -0x30] MOV RDI,RAX CALL 0x00104150 MOV qword ptr [RBP + -0x50],RAX JMP 0x00102644 LAB_001025d7: LEA RAX,[RBP + -0x58] MOV RDI,RAX CALL 0x001041c0 MOV qword ptr [RBP + -0x28],RAX MOV RAX,qword ptr [RBP + -0x68] MOV RDI,RAX CALL 0x00104236 MOV qword ptr [RBP + -0x40],RAX MOV RDX,qword ptr [RBP + -0x28] MOV RAX,qword ptr [RBP + -0x68] MOV RSI,RDX MOV RDI,RAX CALL 0x0010420c MOV qword ptr [RBP + -0x48],RAX LEA RDX,[RBP + -0x40] LEA RAX,[RBP + -0x48] MOV RSI,RDX MOV RDI,RAX CALL 0x00104254 TEST AL,AL JZ 0x00102638 MOV RDX,qword ptr [RBP + -0x28] MOV RAX,qword ptr [RBP + -0x68] MOV RSI,RDX MOV RDI,RAX CALL 0x001041e2 LAB_00102638: LEA RAX,[RBP + -0x58] MOV RDI,RAX CALL 0x00104194 LAB_00102644: LEA RDX,[RBP + -0x50] LEA RAX,[RBP + -0x58] MOV RSI,RDX MOV RDI,RAX CALL 0x0010416e TEST AL,AL JNZ 0x001025d7 JMP 0x00102693 LAB_00102693: MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x001026a7 CALL 0x00102390 LAB_001026a7: MOV RAX,qword ptr [RBP + -0x68] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::map<std::string, std::string, std::less<std::string >, std::allocator<std::pair<std::string const, std::string > > > const&, std::map<std::string, std::string, std::less<std::string >, std::allocator<std::pair<std::string const, std::string > > > const&) */ map * func0(map *param_1,map *param_2) { char cVar1; map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *in_RDX; long in_FS_OFFSET; int8 local_60; int8 local_58; int8 local_50; int8 local_48; map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *local_40; map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *local_38; string *local_30; pair *local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); std:: map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::map((map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *)param_1); local_40 = (map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *)param_2; local_50 = std:: map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::begin((map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *)param_2); local_48 = std:: map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::end(local_40); while( true ) { cVar1 = std::operator!=((_Rb_tree_const_iterator *)&local_50, (_Rb_tree_const_iterator *)&local_48); if (cVar1 == '\0') break; local_28 = (pair *)std::_Rb_tree_const_iterator<std::pair<std::string_const,std::string>>:: operator*((_Rb_tree_const_iterator<std::pair<std::string_const,std::string>> *)&local_50); /* try { // try from 00102585 to 00102637 has its CatchHandler @ 00102661 */ std:: map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::insert((map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *)param_1,local_28); std::_Rb_tree_const_iterator<std::pair<std::string_const,std::string>>::operator++ ((_Rb_tree_const_iterator<std::pair<std::string_const,std::string>> *)&local_50); } local_38 = in_RDX; local_60 = std:: map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::begin(in_RDX); local_58 = std:: map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::end(local_38); while( true ) { cVar1 = std::operator!=((_Rb_tree_const_iterator *)&local_60, (_Rb_tree_const_iterator *)&local_58); if (cVar1 == '\0') break; local_30 = (string *) std::_Rb_tree_const_iterator<std::pair<std::string_const,std::string>>::operator* ((_Rb_tree_const_iterator<std::pair<std::string_const,std::string>> *) &local_60); local_48 = std:: map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::end((map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *)param_1); local_50 = std:: map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::find((map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *)param_1,local_30); cVar1 = std::operator==((_Rb_tree_iterator *)&local_50,(_Rb_tree_iterator *)&local_48); if (cVar1 != '\0') { std:: map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::insert((map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *)param_1,(pair *)local_30); } std::_Rb_tree_const_iterator<std::pair<std::string_const,std::string>>::operator++ ((_Rb_tree_const_iterator<std::pair<std::string_const,std::string>> *)&local_60); } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
3,281
func0
#include <cassert> #include <map> #include <string>
std::map<std::string, std::string> func0(const std::map<std::string, std::string>& dict1, const std::map<std::string, std::string>& dict2) { std::map<std::string, std::string> merged_dict; for (const auto &pair : dict1) { merged_dict.insert(pair); } for (const auto &pair : dict2) { if (merged_dict.find(pair.first) == merged_dict.end()) { merged_dict.insert(pair); } } return merged_dict; }
int main() { { std::map<std::string, std::string> d1 = { {"R", "Red"}, {"B", "Black"}, {"P", "Pink"} }; std::map<std::string, std::string> d2 = { {"G", "Green"}, {"W", "White"} }; std::map<std::string, std::string> expected = { {"B", "Black"}, {"G", "Green"}, {"P", "Pink"}, {"R", "Red"}, {"W", "White"} }; assert(func0(d1, d2) == expected); } { std::map<std::string, std::string> d1 = { {"R", "Red"}, {"B", "Black"}, {"P", "Pink"} }; std::map<std::string, std::string> d2 = { {"O", "Orange"}, {"W", "White"}, {"B", "Black"} }; std::map<std::string, std::string> expected = { {"B", "Black"}, {"O", "Orange"}, {"P", "Pink"}, {"R", "Red"}, {"W", "White"} }; assert(func0(d1, d2) == expected); } { std::map<std::string, std::string> d1 = { {"G", "Green"}, {"W", "White"} }; std::map<std::string, std::string> d2 = { {"O", "Orange"}, {"W", "White"}, {"B", "Black"} }; std::map<std::string, std::string> expected = { {"B", "Black"}, {"G", "Green"}, {"O", "Orange"}, {"W", "White"} }; assert(func0(d1, d2) == expected); } return 0; }
O1
cpp
func0(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&): endbr64 push %r14 push %r13 push %r12 push %rbp push %rbx mov %rdi,%r12 mov %rdx,%r14 movl $0x0,0x8(%rdi) movq $0x0,0x10(%rdi) lea 0x8(%rdi),%r13 mov %r13,0x18(%rdi) mov %r13,0x20(%rdi) movq $0x0,0x28(%rdi) mov 0x18(%rsi),%rbx lea 0x8(%rsi),%rbp cmp %rbp,%rbx jne 1394 <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0x6b> mov 0x18(%r14),%rbx add $0x8,%r14 cmp %rbx,%r14 jne 13b2 <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0x89> mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq mov %rbx,%rdi callq 11f0 <_ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base@plt> mov %rax,%rbx cmp %rax,%rbp je 136b <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0x42> lea 0x20(%rbx),%rsi mov %r12,%rdi callq 2ac4 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE16_M_insert_uniqueIRKS8_EES6_ISt17_Rb_tree_iteratorIS8_EbEOT_> jmp 1384 <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0x5b> mov %rbx,%rdi callq 11f0 <_ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base@plt> mov %rax,%rbx cmp %rax,%r14 je 1378 <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0x4f> lea 0x20(%rbx),%rbp mov %rbp,%rsi mov %r12,%rdi callq 2068 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE4findERS7_> cmp %rax,%r13 jne 13a2 <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0x79> mov %rbp,%rsi mov %r12,%rdi callq 2ac4 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE16_M_insert_uniqueIRKS8_EES6_ISt17_Rb_tree_iteratorIS8_EbEOT_> jmp 13a2 <_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_+0x79> endbr64 mov %rax,%rbx mov 0x10(%r12),%rsi mov %r12,%rdi callq 200a <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E> mov %rbx,%rdi callq 1220 <_Unwind_Resume@plt>
_Z5func0RKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4lessIS5_ESaISt4pairIKS5_S5_EEESE_: endbr64 push r14 push r13 push r12 push rbp push rbx mov r12, rdi mov r14, rdx mov dword ptr [rdi+8], 0 mov qword ptr [rdi+10h], 0 lea r13, [rdi+8] mov [rdi+18h], r13 mov [rdi+20h], r13 mov qword ptr [rdi+28h], 0 mov rbx, [rsi+18h] lea rbp, [rsi+8] cmp rbp, rbx jnz short loc_13B4 loc_138B: mov rbx, [r14+18h] add r14, 8 cmp r14, rbx jnz short loc_13D2 loc_1398: mov rax, r12 pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_13A4: mov rdi, rbx call __ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base; std::_Rb_tree_increment(std::_Rb_tree_node_base const*) mov rbx, rax cmp rbp, rax jz short loc_138B loc_13B4: lea rsi, [rbx+20h] mov rdi, r12 call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE16_M_insert_uniqueIRKS8_EES6_ISt17_Rb_tree_iteratorIS8_EbEOT_; std::_Rb_tree<std::string,std::pair<std::string const,std::string>,std::_Select1st<std::pair<std::string const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string const,std::string>>>::_M_insert_unique<std::pair<std::string const,std::string> const&>(std::pair<std::string const,std::string> const&) jmp short loc_13A4 loc_13C2: mov rdi, rbx call __ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base; std::_Rb_tree_increment(std::_Rb_tree_node_base const*) mov rbx, rax cmp r14, rax jz short loc_1398 loc_13D2: lea rbp, [rbx+20h] mov rsi, rbp mov rdi, r12 call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE4findERS7_; std::_Rb_tree<std::string,std::pair<std::string const,std::string>,std::_Select1st<std::pair<std::string const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string const,std::string>>>::find(std::string const&) cmp r13, rax jnz short loc_13C2 mov rsi, rbp mov rdi, r12 call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE16_M_insert_uniqueIRKS8_EES6_ISt17_Rb_tree_iteratorIS8_EbEOT_; std::_Rb_tree<std::string,std::pair<std::string const,std::string>,std::_Select1st<std::pair<std::string const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string const,std::string>>>::_M_insert_unique<std::pair<std::string const,std::string> const&>(std::pair<std::string const,std::string> const&) jmp short loc_13C2 endbr64 mov rbx, rax mov rsi, [r12+10h] mov rdi, r12 call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E; std::_Rb_tree<std::string,std::pair<std::string const,std::string>,std::_Select1st<std::pair<std::string const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string const,std::string>>>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,std::string>> *) mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume
long long func0(long long a1, long long a2, long long a3) { long long i; // rbx long long v5; // rbx long long j; // r14 *(_DWORD *)(a1 + 8) = 0; *(_QWORD *)(a1 + 16) = 0LL; *(_QWORD *)(a1 + 24) = a1 + 8; *(_QWORD *)(a1 + 32) = a1 + 8; *(_QWORD *)(a1 + 40) = 0LL; for ( i = *(_QWORD *)(a2 + 24); a2 + 8 != i; i = std::_Rb_tree_increment(i) ) std::_Rb_tree<std::string,std::pair<std::string const,std::string>,std::_Select1st<std::pair<std::string const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string const,std::string>>>::_M_insert_unique<std::pair<std::string const,std::string> const&>( a1, i + 32); v5 = *(_QWORD *)(a3 + 24); for ( j = a3 + 8; j != v5; v5 = std::_Rb_tree_increment(v5) ) { if ( a1 + 8 == std::_Rb_tree<std::string,std::pair<std::string const,std::string>,std::_Select1st<std::pair<std::string const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string const,std::string>>>::find( a1, v5 + 32) ) std::_Rb_tree<std::string,std::pair<std::string const,std::string>,std::_Select1st<std::pair<std::string const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string const,std::string>>>::_M_insert_unique<std::pair<std::string const,std::string> const&>( a1, v5 + 32); } return a1; }
func0: ENDBR64 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX MOV R12,RDI MOV R14,RDX MOV dword ptr [RDI + 0x8],0x0 MOV qword ptr [RDI + 0x10],0x0 LEA R13,[RDI + 0x8] MOV qword ptr [RDI + 0x18],R13 MOV qword ptr [RDI + 0x20],R13 MOV qword ptr [RDI + 0x28],0x0 MOV RBX,qword ptr [RSI + 0x18] LEA RBP,[RSI + 0x8] CMP RBP,RBX JNZ 0x001013b4 LAB_0010138b: MOV RBX,qword ptr [R14 + 0x18] ADD R14,0x8 CMP R14,RBX JNZ 0x001013d2 LAB_00101398: MOV RAX,R12 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_001013a4: MOV RDI,RBX CALL 0x00101200 MOV RBX,RAX CMP RBP,RAX JZ 0x0010138b LAB_001013b4: LEA RSI,[RBX + 0x20] MOV RDI,R12 LAB_001013bb: CALL 0x00102cb4 JMP 0x001013a4 LAB_001013c2: MOV RDI,RBX CALL 0x00101200 MOV RBX,RAX CMP R14,RAX JZ 0x00101398 LAB_001013d2: LEA RBP,[RBX + 0x20] MOV RSI,RBP MOV RDI,R12 CALL 0x001027e4 CMP R13,RAX JNZ 0x001013c2 MOV RSI,RBP MOV RDI,R12 CALL 0x00102cb4 JMP 0x001013c2
/* func0(std::map<std::string, std::string, std::less<std::string >, std::allocator<std::pair<std::string const, std::string > > > const&, std::map<std::string, std::string, std::less<std::string >, std::allocator<std::pair<std::string const, std::string > > > const&) */ map * func0(map *param_1,map *param_2) { map *pmVar1; _Rb_tree_node_base *p_Var2; map *pmVar3; long in_RDX; *(int4 *)(param_1 + 8) = 0; *(int8 *)(param_1 + 0x10) = 0; pmVar1 = param_1 + 8; *(map **)(param_1 + 0x18) = pmVar1; *(map **)(param_1 + 0x20) = pmVar1; *(int8 *)(param_1 + 0x28) = 0; for (p_Var2 = *(_Rb_tree_node_base **)(param_2 + 0x18); (_Rb_tree_node_base *)(param_2 + 8) != p_Var2; p_Var2 = (_Rb_tree_node_base *)std::_Rb_tree_increment(p_Var2)) { /* try { // try from 001013bb to 001013f0 has its CatchHandler @ 001013f3 */ std:: _Rb_tree<std::string,std::pair<std::string_const,std::string>,std::_Select1st<std::pair<std::string_const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::_M_insert_unique<std::pair<std::string_const,std::string>const&> ((_Rb_tree<std::string,std::pair<std::string_const,std::string>,std::_Select1st<std::pair<std::string_const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *)param_1,p_Var2 + 0x20); } for (p_Var2 = *(_Rb_tree_node_base **)(in_RDX + 0x18); (_Rb_tree_node_base *)(in_RDX + 8) != p_Var2; p_Var2 = (_Rb_tree_node_base *)std::_Rb_tree_increment(p_Var2)) { pmVar3 = (map *)std:: _Rb_tree<std::string,std::pair<std::string_const,std::string>,std::_Select1st<std::pair<std::string_const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::find((_Rb_tree<std::string,std::pair<std::string_const,std::string>,std::_Select1st<std::pair<std::string_const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *)param_1,(string *)(p_Var2 + 0x20)); if (pmVar1 == pmVar3) { std:: _Rb_tree<std::string,std::pair<std::string_const,std::string>,std::_Select1st<std::pair<std::string_const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> ::_M_insert_unique<std::pair<std::string_const,std::string>const&> ((_Rb_tree<std::string,std::pair<std::string_const,std::string>,std::_Select1st<std::pair<std::string_const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string_const,std::string>>> *)param_1,(string *)(p_Var2 + 0x20)); } } return param_1; }