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
1,082
func0
#include <assert.h>
long long func0(int n) { long long sum = 0; for (int i = 1; i <= n; i++) { int j = 2 * i; sum += (long long)j * j * j * j * j; } return sum; }
int main() { assert(func0(2) == 1056); assert(func0(3) == 8832); assert(func0(1) == 32); return 0; }
O2
cpp
func0(int): endbr64 test %edi,%edi jle 1180 <_Z5func0i+0x40> lea -0x1(%rdi),%eax mov $0x2,%edx xor %r8d,%r8d lea 0x4(%rax,%rax,1),%rcx nopl 0x0(%rax,%rax,1) mov %rdx,%rax imul %rdx,%rax imul %rax,%rax imul %rdx,%rax add $0x2,%rdx add %rax,%r8 cmp %rcx,%rdx jne 1160 <_Z5func0i+0x20> mov %r8,%rax retq xor %r8d,%r8d mov %r8,%rax retq nopw 0x0(%rax,%rax,1)
_Z5func0i: endbr64 test edi, edi jle short loc_1180 lea esi, [rdi+1] mov edx, 2 xor ecx, ecx add rsi, rsi nop dword ptr [rax] loc_1158: mov rax, rdx imul rax, rdx imul rax, rax imul rax, rdx add rdx, 2 add rcx, rax cmp rdx, rsi jnz short loc_1158 mov rax, rcx retn loc_1180: xor ecx, ecx mov rax, rcx retn
long long func0(int a1) { long long v1; // rdx long long v2; // rcx long long v3; // rax if ( a1 <= 0 ) return 0LL; v1 = 2LL; v2 = 0LL; do { v3 = v1 * v1 * v1 * v1 * v1; v1 += 2LL; v2 += v3; } while ( v1 != 2LL * (unsigned int)(a1 + 1) ); return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101180 LEA ESI,[RDI + 0x1] MOV EDX,0x2 XOR ECX,ECX ADD RSI,RSI NOP dword ptr [RAX] LAB_00101158: MOV RAX,RDX IMUL RAX,RDX IMUL RAX,RAX IMUL RAX,RDX ADD RDX,0x2 ADD RCX,RAX CMP RDX,RSI JNZ 0x00101158 MOV RAX,RCX RET LAB_00101180: XOR ECX,ECX MOV RAX,RCX RET
/* func0(int) */ long func0(int param_1) { long lVar1; long lVar2; long lVar3; if (0 < param_1) { lVar3 = 2; lVar2 = 0; do { lVar1 = lVar3 * lVar3 * lVar3 * lVar3 * lVar3; lVar3 = lVar3 + 2; lVar2 = lVar2 + lVar1; } while (lVar3 != (ulong)(param_1 + 1) * 2); return lVar2; } return 0; }
1,083
func0
#include <assert.h>
long long func0(int n) { long long sum = 0; for (int i = 1; i <= n; i++) { int j = 2 * i; sum += (long long)j * j * j * j * j; } return sum; }
int main() { assert(func0(2) == 1056); assert(func0(3) == 8832); assert(func0(1) == 32); return 0; }
O3
cpp
func0(int): endbr64 test %edi,%edi jle 1180 <_Z5func0i+0x40> lea -0x1(%rdi),%eax mov $0x2,%edx xor %r8d,%r8d lea 0x4(%rax,%rax,1),%rcx nopl 0x0(%rax,%rax,1) mov %rdx,%rax imul %rdx,%rax imul %rax,%rax imul %rdx,%rax add $0x2,%rdx add %rax,%r8 cmp %rdx,%rcx jne 1160 <_Z5func0i+0x20> mov %r8,%rax retq xor %r8d,%r8d mov %r8,%rax retq nopw 0x0(%rax,%rax,1)
_Z5func0i: endbr64 test edi, edi jle short loc_1180 lea esi, [rdi+1] mov edx, 2 xor ecx, ecx add rsi, rsi nop dword ptr [rax] loc_1158: mov rax, rdx imul rax, rdx imul rax, rax imul rax, rdx add rdx, 2 add rcx, rax cmp rsi, rdx jnz short loc_1158 mov rax, rcx retn loc_1180: xor ecx, ecx mov rax, rcx retn
long long func0(int a1) { long long v1; // rdx long long v2; // rcx long long v3; // rax if ( a1 <= 0 ) return 0LL; v1 = 2LL; v2 = 0LL; do { v3 = v1 * v1 * v1 * v1 * v1; v1 += 2LL; v2 += v3; } while ( 2LL * (unsigned int)(a1 + 1) != v1 ); return v2; }
func0: ENDBR64 TEST EDI,EDI JLE 0x00101180 LEA ESI,[RDI + 0x1] MOV EDX,0x2 XOR ECX,ECX ADD RSI,RSI NOP dword ptr [RAX] LAB_00101158: MOV RAX,RDX IMUL RAX,RDX IMUL RAX,RAX IMUL RAX,RDX ADD RDX,0x2 ADD RCX,RAX CMP RSI,RDX JNZ 0x00101158 MOV RAX,RCX RET LAB_00101180: XOR ECX,ECX MOV RAX,RCX RET
/* func0(int) */ long func0(int param_1) { long lVar1; long lVar2; long lVar3; if (0 < param_1) { lVar3 = 2; lVar2 = 0; do { lVar1 = lVar3 * lVar3 * lVar3 * lVar3 * lVar3; lVar3 = lVar3 + 2; lVar2 = lVar2 + lVar1; } while ((ulong)(param_1 + 1) * 2 != lVar3); return lVar2; } return 0; }
1,084
func0
#include <vector> #include <tuple> #include <assert.h>
std::vector<int> func0(const std::vector<std::tuple<int, std::string, int>>& test_list) { std::vector<int> res; for (const auto& lis : test_list) { res.push_back(std::get<2>(lis)); } return res; }
int main() { std::vector<std::tuple<int, std::string, int>> input1 = {{1, "Rash", 21}, {2, "Varsha", 20}, {3, "Kil", 19}}; assert(func0(input1) == std::vector<int>({21, 20, 19})); std::vector<std::tuple<int, std::string, int>> input2 = {{1, "Sai", 36}, {2, "Ayesha", 25}, {3, "Salman", 45}}; assert(func0(input2) == std::vector<int>({36, 25, 45})); std::vector<std::tuple<int, std::string, int>> input3 = {{1, "Sudeep", 14}, {2, "Vandana", 36}, {3, "Dawood", 56}}; assert(func0(input3) == std::vector<int>({14, 36, 56})); return 0; }
O0
cpp
func0(std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int>, std::allocator<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > > 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 mov -0x48(%rbp),%rax mov %rax,%rdi callq 2f92 <_ZNSt6vectorIiSaIiEEC1Ev> mov -0x50(%rbp),%rax mov %rax,-0x28(%rbp) mov -0x28(%rbp),%rax mov %rax,%rdi callq 39fc <_ZNKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE5beginEv> mov %rax,-0x38(%rbp) mov -0x28(%rbp),%rax mov %rax,%rdi callq 3a54 <_ZNKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE3endEv> mov %rax,-0x30(%rbp) lea -0x30(%rbp),%rdx lea -0x38(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 3aac <_ZN9__gnu_cxxneIPKSt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESt6vectorIS8_SaIS8_EEEEbRKNS_17__normal_iteratorIT_T0_EESJ_> test %al,%al je 2552 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0xc9> lea -0x38(%rbp),%rax mov %rax,%rdi callq 3b10 <_ZNK9__gnu_cxx17__normal_iteratorIPKSt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESt6vectorIS8_SaIS8_EEEdeEv> mov %rax,-0x20(%rbp) mov -0x20(%rbp),%rax mov %rax,%rdi callq 3b25 <_ZSt3getILm2EJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKSA_> mov %rax,%rdx mov -0x48(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 3b44 <_ZNSt6vectorIiSaIiEE9push_backERKi> lea -0x38(%rbp),%rax mov %rax,%rdi callq 3aec <_ZN9__gnu_cxx17__normal_iteratorIPKSt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESt6vectorIS8_SaIS8_EEEppEv> jmp 24e1 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x58> endbr64 mov %rax,%rbx mov -0x48(%rbp),%rax mov %rax,%rdi callq 39b4 <_ZNSt6vectorIiSaIiEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 2360 <_Unwind_Resume@plt> mov -0x18(%rbp),%rax xor %fs:0x28,%rax je 2567 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0xde> callq 2310 <__stack_chk_fail@plt> mov -0x48(%rbp),%rax add $0x48,%rsp pop %rbx pop %rbp retq
1,085
func0
#include <vector> #include <tuple> #include <assert.h>
std::vector<int> func0(const std::vector<std::tuple<int, std::string, int>>& test_list) { std::vector<int> res; for (const auto& lis : test_list) { res.push_back(std::get<2>(lis)); } return res; }
int main() { std::vector<std::tuple<int, std::string, int>> input1 = {{1, "Rash", 21}, {2, "Varsha", 20}, {3, "Kil", 19}}; assert(func0(input1) == std::vector<int>({21, 20, 19})); std::vector<std::tuple<int, std::string, int>> input2 = {{1, "Sai", 36}, {2, "Ayesha", 25}, {3, "Salman", 45}}; assert(func0(input2) == std::vector<int>({36, 25, 45})); std::vector<std::tuple<int, std::string, int>> input3 = {{1, "Sudeep", 14}, {2, "Vandana", 36}, {3, "Dawood", 56}}; assert(func0(input3) == std::vector<int>({14, 36, 56})); return 0; }
O1
cpp
func0(std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int>, std::allocator<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > > const&): endbr64 push %r12 push %rbp push %rbx mov %rdi,%rbx movq $0x0,(%rdi) movq $0x0,0x8(%rdi) movq $0x0,0x10(%rdi) mov (%rsi),%rbp mov 0x8(%rsi),%r12 cmp %r12,%rbp jne 1333 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x4a> mov %rbx,%rax pop %rbx pop %rbp pop %r12 retq mov %rbp,%rdx mov %rbx,%rdi callq 1dca <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> add $0x30,%rbp cmp %rbp,%r12 je 1317 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x2e> mov 0x8(%rbx),%rsi cmp 0x10(%rbx),%rsi je 131f <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x36> mov 0x0(%rbp),%eax mov %eax,(%rsi) addq $0x4,0x8(%rbx) jmp 132a <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x41> endbr64 mov %rax,%rbp mov (%rbx),%rdi test %rdi,%rdi je 135d <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x74> callq 1180 <_ZdlPv@plt> mov %rbp,%rdi callq 11e0 <_Unwind_Resume@plt>
1,086
func0
#include <vector> #include <tuple> #include <assert.h>
std::vector<int> func0(const std::vector<std::tuple<int, std::string, int>>& test_list) { std::vector<int> res; for (const auto& lis : test_list) { res.push_back(std::get<2>(lis)); } return res; }
int main() { std::vector<std::tuple<int, std::string, int>> input1 = {{1, "Rash", 21}, {2, "Varsha", 20}, {3, "Kil", 19}}; assert(func0(input1) == std::vector<int>({21, 20, 19})); std::vector<std::tuple<int, std::string, int>> input2 = {{1, "Sai", 36}, {2, "Ayesha", 25}, {3, "Salman", 45}}; assert(func0(input2) == std::vector<int>({36, 25, 45})); std::vector<std::tuple<int, std::string, int>> input3 = {{1, "Sudeep", 14}, {2, "Vandana", 36}, {3, "Dawood", 56}}; assert(func0(input3) == std::vector<int>({14, 36, 56})); return 0; }
O2
cpp
func0(std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int>, std::allocator<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > > const&): endbr64 push %r12 mov %rdi,%r12 push %rbp push %rbx mov (%rsi),%rbx mov 0x8(%rsi),%rbp movq $0x0,(%rdi) movq $0x0,0x8(%rdi) movq $0x0,0x10(%rdi) cmp %rbp,%rbx je 1982 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x72> xor %eax,%eax xor %esi,%esi jmp 1969 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x59> nopl 0x0(%rax) mov (%rbx),%eax add $0x4,%rsi add $0x30,%rbx mov %eax,-0x4(%rsi) mov %rsi,0x8(%r12) cmp %rbx,%rbp je 1982 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x72> mov 0x8(%r12),%rsi mov 0x10(%r12),%rax cmp %rax,%rsi jne 1948 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x38> mov %rbx,%rdx mov %r12,%rdi callq 1e10 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> add $0x30,%rbx cmp %rbx,%rbp jne 195f <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x4f> mov %r12,%rax pop %rbx pop %rbp pop %r12 retq endbr64 mov %rax,%rbp jmpq 1220 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE.cold> nopw %cs:0x0(%rax,%rax,1)
1,087
func0
#include <vector> #include <tuple> #include <assert.h>
std::vector<int> func0(const std::vector<std::tuple<int, std::string, int>>& test_list) { std::vector<int> res; for (const auto& lis : test_list) { res.push_back(std::get<2>(lis)); } return res; }
int main() { std::vector<std::tuple<int, std::string, int>> input1 = {{1, "Rash", 21}, {2, "Varsha", 20}, {3, "Kil", 19}}; assert(func0(input1) == std::vector<int>({21, 20, 19})); std::vector<std::tuple<int, std::string, int>> input2 = {{1, "Sai", 36}, {2, "Ayesha", 25}, {3, "Salman", 45}}; assert(func0(input2) == std::vector<int>({36, 25, 45})); std::vector<std::tuple<int, std::string, int>> input3 = {{1, "Sudeep", 14}, {2, "Vandana", 36}, {3, "Dawood", 56}}; assert(func0(input3) == std::vector<int>({14, 36, 56})); return 0; }
O3
cpp
func0(std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int>, std::allocator<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > > const&): endbr64 push %r15 pxor %xmm0,%xmm0 push %r14 push %r13 push %r12 mov %rdi,%r12 push %rbp push %rbx sub $0x18,%rsp mov 0x8(%rsi),%r13 mov (%rsi),%rbx movups %xmm0,(%rdi) movq $0x0,0x10(%rdi) cmp %r13,%rbx je 1ae9 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0xe9> xor %ecx,%ecx xor %ebp,%ebp jmp 1a5b <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x5b> nopw 0x0(%rax,%rax,1) mov (%rbx),%eax add $0x4,%rbp add $0x30,%rbx mov %eax,-0x4(%rbp) mov %rbp,0x8(%r12) cmp %rbx,%r13 je 1ae9 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0xe9> cmp %rcx,%rbp jne 1a40 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x40> mov (%r12),%r15 mov %rbp,%r14 movabs $0x1fffffffffffffff,%rdx sub %r15,%r14 mov %r14,%rax sar $0x2,%rax cmp %rdx,%rax je 1b62 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x162> test %rax,%rax je 1b58 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x158> movabs $0x7ffffffffffffffc,%rbp lea (%rax,%rax,1),%rdx cmp %rdx,%rax jbe 1b00 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x100> mov %rbp,%rdi callq 11b0 <_Znwm@plt> mov %rax,%r8 lea (%rax,%rbp,1),%rcx mov (%rbx),%eax lea 0x4(%r8,%r14,1),%rbp mov %eax,(%r8,%r14,1) test %r14,%r14 jg 1b1a <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x11a> test %r15,%r15 jne 1b33 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x133> movq %r8,%xmm0 movq %rbp,%xmm1 add $0x30,%rbx mov %rcx,0x10(%r12) punpcklqdq %xmm1,%xmm0 movups %xmm0,(%r12) cmp %rbx,%r13 jne 1a5b <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x5b> add $0x18,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax,%rax,1) test %rdx,%rdx jne 1b6e <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0x16e> mov (%rbx),%eax xor %r8d,%r8d xor %ecx,%ecx lea 0x4(%r8,%r14,1),%rbp mov %eax,(%r8,%r14,1) test %r14,%r14 jle 1abf <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0xbf> mov %r8,%rdi mov %r14,%rdx mov %r15,%rsi mov %rcx,(%rsp) callq 11e0 <memmove@plt> mov (%rsp),%rcx mov %rax,%r8 mov %r15,%rdi mov %r8,0x8(%rsp) mov %rcx,(%rsp) callq 11a0 <_ZdlPv@plt> mov 0x8(%rsp),%r8 mov (%rsp),%rcx jmpq 1ac4 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0xc4> nopw 0x0(%rax,%rax,1) mov $0x4,%ebp jmpq 1aa0 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0xa0> lea 0x5a7(%rip),%rdi callq 1160 <_ZSt20__throw_length_errorPKc@plt> movabs $0x1fffffffffffffff,%rax cmp %rax,%rdx cmova %rax,%rdx lea 0x0(,%rdx,4),%rbp jmpq 1aa0 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE+0xa0> endbr64 mov %rax,%rbp jmpq 1220 <_Z5func0RKSt6vectorISt5tupleIJiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESaIS7_EE.cold> nopl 0x0(%rax,%rax,1)
1,088
func0
#include <iostream> #include <tuple> #include <vector> #include <cassert>
std::tuple<int, int, int> func0(const std::tuple<int, int, int>& test_tup1, const std::tuple<int, int, int>& test_tup2) { int first = std::get<0>(test_tup1) - std::get<0>(test_tup2); int second = std::get<1>(test_tup1) - std::get<1>(test_tup2); int third = std::get<2>(test_tup1) - std::get<2>(test_tup2); return std::make_tuple(first, second, third); }
int main() { assert(func0(std::make_tuple(10, 4, 5), std::make_tuple(2, 5, 18)) == std::make_tuple(8, -1, -13)); assert(func0(std::make_tuple(11, 2, 3), std::make_tuple(24, 45, 16)) == std::make_tuple(-13, -43, -13)); assert(func0(std::make_tuple(7, 18, 9), std::make_tuple(10, 11, 12)) == std::make_tuple(-3, 7, -3)); 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 $0x48,%rsp mov %rdi,-0x38(%rbp) mov %rsi,-0x40(%rbp) mov %rdx,-0x48(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax mov -0x40(%rbp),%rax mov %rax,%rdi callq 15f3 <_ZSt3getILm0EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%ebx mov -0x48(%rbp),%rax mov %rax,%rdi callq 15f3 <_ZSt3getILm0EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%eax sub %eax,%ebx mov %ebx,%eax mov %eax,-0x24(%rbp) mov -0x40(%rbp),%rax mov %rax,%rdi callq 1663 <_ZSt3getILm1EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%ebx mov -0x48(%rbp),%rax mov %rax,%rdi callq 1663 <_ZSt3getILm1EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%eax sub %eax,%ebx mov %ebx,%eax mov %eax,-0x20(%rbp) mov -0x40(%rbp),%rax mov %rax,%rdi callq 16d3 <_ZSt3getILm2EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%ebx mov -0x48(%rbp),%rax mov %rax,%rdi callq 16d3 <_ZSt3getILm2EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_> mov (%rax),%eax sub %eax,%ebx mov %ebx,%eax mov %eax,-0x1c(%rbp) mov -0x38(%rbp),%rax lea -0x1c(%rbp),%rcx lea -0x20(%rbp),%rdx lea -0x24(%rbp),%rsi mov %rax,%rdi callq 173f <_ZSt10make_tupleIJRiS0_S0_EESt5tupleIJDpNSt17__decay_and_stripIT_E6__typeEEEDpOS3_> mov -0x18(%rbp),%rax xor %fs:0x28,%rax je 1286 <_Z5func0RKSt5tupleIJiiiEES2_+0xbd> callq 10b0 <__stack_chk_fail@plt> mov -0x38(%rbp),%rax add $0x48,%rsp pop %rbx pop %rbp retq
_Z5func0RKSt5tupleIJiiiEES2_: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 48h mov [rbp+var_38], rdi mov [rbp+var_40], rsi mov [rbp+var_48], rdx mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax mov rax, [rbp+var_40] 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_48] mov rdi, rax call _ZSt3getILm0EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_; std::get<0ul,int,int,int>(std::tuple<int,int,int> const&) mov eax, [rax] sub ebx, eax mov edx, ebx mov [rbp+var_24], edx mov rax, [rbp+var_40] 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_48] mov rdi, rax call _ZSt3getILm1EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_; std::get<1ul,int,int,int>(std::tuple<int,int,int> const&) mov eax, [rax] sub ebx, eax mov edx, ebx mov [rbp+var_20], edx mov rax, [rbp+var_40] 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_48] mov rdi, rax call _ZSt3getILm2EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_; std::get<2ul,int,int,int>(std::tuple<int,int,int> const&) mov eax, [rax] mov edx, ebx sub edx, eax mov [rbp+var_1C], edx mov rax, [rbp+var_38] lea rcx, [rbp+var_1C] lea rdx, [rbp+var_20] lea rsi, [rbp+var_24] mov rdi, rax call _ZSt10make_tupleIJRiS0_S0_EESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS4_; std::make_tuple<int &,int &,int &>(int &,int &,int &&&) mov rax, [rbp+var_18] sub rax, fs:28h jz short loc_1226 call ___stack_chk_fail loc_1226: mov rax, [rbp+var_38] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, long long a2, long long a3) { int v3; // ebx int v4; // ebx int v5; // ebx int v8; // [rsp+2Ch] [rbp-24h] BYREF int v9; // [rsp+30h] [rbp-20h] BYREF int v10; // [rsp+34h] [rbp-1Ch] BYREF unsigned long long v11; // [rsp+38h] [rbp-18h] v11 = __readfsqword(0x28u); v3 = *(_DWORD *)std::get<0ul,int,int,int>(a2); v8 = v3 - *(_DWORD *)std::get<0ul,int,int,int>(a3); v4 = *(_DWORD *)std::get<1ul,int,int,int>(a2); v9 = v4 - *(_DWORD *)std::get<1ul,int,int,int>(a3); v5 = *(_DWORD *)std::get<2ul,int,int,int>(a2); v10 = v5 - *(_DWORD *)std::get<2ul,int,int,int>(a3); std::make_tuple<int &,int &,int &>(a1, &v8, &v9, &v10); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x48 MOV qword ptr [RBP + -0x38],RDI MOV qword ptr [RBP + -0x40],RSI MOV qword ptr [RBP + -0x48],RDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV RAX,qword ptr [RBP + -0x40] MOV RDI,RAX CALL 0x001014fd MOV EBX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x48] MOV RDI,RAX CALL 0x001014fd MOV EAX,dword ptr [RAX] SUB EBX,EAX MOV EDX,EBX MOV dword ptr [RBP + -0x24],EDX MOV RAX,qword ptr [RBP + -0x40] MOV RDI,RAX CALL 0x0010151b MOV EBX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x48] MOV RDI,RAX CALL 0x0010151b MOV EAX,dword ptr [RAX] SUB EBX,EAX MOV EDX,EBX MOV dword ptr [RBP + -0x20],EDX MOV RAX,qword ptr [RBP + -0x40] MOV RDI,RAX CALL 0x00101539 MOV EBX,dword ptr [RAX] MOV RAX,qword ptr [RBP + -0x48] MOV RDI,RAX CALL 0x00101539 MOV EAX,dword ptr [RAX] MOV EDX,EBX SUB EDX,EAX MOV dword ptr [RBP + -0x1c],EDX MOV RAX,qword ptr [RBP + -0x38] LEA RCX,[RBP + -0x1c] LEA RDX,[RBP + -0x20] LEA RSI,[RBP + -0x24] MOV RDI,RAX CALL 0x00101557 MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x00101226 CALL 0x00101070 LAB_00101226: MOV RAX,qword ptr [RBP + -0x38] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&) */ tuple * func0(tuple *param_1,tuple *param_2) { int iVar1; type *ptVar2; type *ptVar3; type *ptVar4; tuple *in_RDX; long in_FS_OFFSET; int local_2c; int local_28; int local_24; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); ptVar2 = std::get<0ul,int,int,int>(param_2); iVar1 = *(int *)ptVar2; ptVar2 = std::get<0ul,int,int,int>(in_RDX); local_2c = iVar1 - *(int *)ptVar2; ptVar3 = std::get<1ul,int,int,int>(param_2); iVar1 = *(int *)ptVar3; ptVar3 = std::get<1ul,int,int,int>(in_RDX); local_28 = iVar1 - *(int *)ptVar3; ptVar4 = std::get<2ul,int,int,int>(param_2); iVar1 = *(int *)ptVar4; ptVar4 = std::get<2ul,int,int,int>(in_RDX); local_24 = iVar1 - *(int *)ptVar4; std::make_tuple<int&,int&,int&>(param_1,&local_2c,&local_28,&local_24); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
1,089
func0
#include <iostream> #include <tuple> #include <vector> #include <cassert>
std::tuple<int, int, int> func0(const std::tuple<int, int, int>& test_tup1, const std::tuple<int, int, int>& test_tup2) { int first = std::get<0>(test_tup1) - std::get<0>(test_tup2); int second = std::get<1>(test_tup1) - std::get<1>(test_tup2); int third = std::get<2>(test_tup1) - std::get<2>(test_tup2); return std::make_tuple(first, second, third); }
int main() { assert(func0(std::make_tuple(10, 4, 5), std::make_tuple(2, 5, 18)) == std::make_tuple(8, -1, -13)); assert(func0(std::make_tuple(11, 2, 3), std::make_tuple(24, 45, 16)) == std::make_tuple(-13, -43, -13)); assert(func0(std::make_tuple(7, 18, 9), std::make_tuple(10, 11, 12)) == std::make_tuple(-3, 7, -3)); return 0; }
O1
cpp
func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&): endbr64 mov %rdi,%rax mov 0x8(%rsi),%ecx sub 0x8(%rdx),%ecx mov 0x4(%rsi),%edi sub 0x4(%rdx),%edi mov (%rsi),%esi sub (%rdx),%esi mov %esi,(%rax) mov %edi,0x4(%rax) mov %ecx,0x8(%rax) retq
_Z5func0RKSt5tupleIJiiiEES2_: endbr64 mov rax, rdi mov ecx, [rsi+8] sub ecx, [rdx+8] mov edi, [rsi+4] sub edi, [rdx+4] mov esi, [rsi] sub esi, [rdx] mov [rax], esi mov [rax+4], edi mov [rax+8], ecx retn
_DWORD * func0(_DWORD *a1, _DWORD *a2, _DWORD *a3) { _DWORD *result; // rax int v4; // ecx int v5; // edi result = a1; v4 = a2[2] - a3[2]; v5 = a2[1] - a3[1]; *result = *a2 - *a3; result[1] = v5; result[2] = v4; return result; }
func0: ENDBR64 MOV RAX,RDI MOV ECX,dword ptr [RSI + 0x8] SUB ECX,dword ptr [RDX + 0x8] MOV EDI,dword ptr [RSI + 0x4] SUB EDI,dword ptr [RDX + 0x4] MOV ESI,dword ptr [RSI] SUB ESI,dword ptr [RDX] MOV dword ptr [RAX],ESI MOV dword ptr [RAX + 0x4],EDI MOV dword ptr [RAX + 0x8],ECX RET
/* func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&) */ void func0(tuple *param_1,tuple *param_2) { int iVar1; int iVar2; int iVar3; int iVar4; int *in_RDX; iVar1 = *(int *)(param_2 + 8); iVar2 = in_RDX[2]; iVar3 = *(int *)(param_2 + 4); iVar4 = in_RDX[1]; *(int *)param_1 = *(int *)param_2 - *in_RDX; *(int *)(param_1 + 4) = iVar3 - iVar4; *(int *)(param_1 + 8) = iVar1 - iVar2; return; }
1,090
func0
#include <iostream> #include <tuple> #include <vector> #include <cassert>
std::tuple<int, int, int> func0(const std::tuple<int, int, int>& test_tup1, const std::tuple<int, int, int>& test_tup2) { int first = std::get<0>(test_tup1) - std::get<0>(test_tup2); int second = std::get<1>(test_tup1) - std::get<1>(test_tup2); int third = std::get<2>(test_tup1) - std::get<2>(test_tup2); return std::make_tuple(first, second, third); }
int main() { assert(func0(std::make_tuple(10, 4, 5), std::make_tuple(2, 5, 18)) == std::make_tuple(8, -1, -13)); assert(func0(std::make_tuple(11, 2, 3), std::make_tuple(24, 45, 16)) == std::make_tuple(-13, -43, -13)); assert(func0(std::make_tuple(7, 18, 9), std::make_tuple(10, 11, 12)) == std::make_tuple(-3, 7, -3)); return 0; }
O2
cpp
func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&): endbr64 mov 0x8(%rsi),%ecx mov %rdi,%rax sub 0x8(%rdx),%ecx mov 0x4(%rsi),%edi mov (%rsi),%esi sub 0x4(%rdx),%edi sub (%rdx),%esi mov %ecx,0x8(%rax) mov %esi,(%rax) mov %edi,0x4(%rax) retq
_Z5func0RKSt5tupleIJiiiEES2_: endbr64 movq xmm0, qword ptr [rsi] movq xmm1, qword ptr [rdx] mov rax, rdi mov ecx, [rsi+8] sub ecx, [rdx+8] psubd xmm0, xmm1 mov [rdi+8], ecx movq qword ptr [rdi], xmm0 retn
long long func0(long long a1, const __m128i *a2, const __m128i *a3) { long long result; // rax unsigned long long v4; // xmm0_8 result = a1; v4 = _mm_sub_epi32(_mm_loadl_epi64(a2), _mm_loadl_epi64(a3)).m128i_u64[0]; *(_DWORD *)(a1 + 8) = a2->m128i_i32[2] - a3->m128i_i32[2]; *(_QWORD *)a1 = v4; return result; }
func0: ENDBR64 MOVQ XMM0,qword ptr [RSI] MOVQ XMM1,qword ptr [RDX] MOV RAX,RDI MOV ECX,dword ptr [RSI + 0x8] SUB ECX,dword ptr [RDX + 0x8] PSUBD XMM0,XMM1 MOV dword ptr [RDI + 0x8],ECX MOVQ qword ptr [RDI],XMM0 RET
/* func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&) */ tuple * func0(tuple *param_1,tuple *param_2) { int8 uVar1; int8 uVar2; int8 *in_RDX; uVar1 = *(int8 *)param_2; uVar2 = *in_RDX; *(int *)(param_1 + 8) = *(int *)(param_2 + 8) - *(int *)(in_RDX + 1); *(ulong *)param_1 = CONCAT44((int)((ulong)uVar1 >> 0x20) - (int)((ulong)uVar2 >> 0x20),(int)uVar1 - (int)uVar2); return param_1; }
1,091
func0
#include <iostream> #include <tuple> #include <vector> #include <cassert>
std::tuple<int, int, int> func0(const std::tuple<int, int, int>& test_tup1, const std::tuple<int, int, int>& test_tup2) { int first = std::get<0>(test_tup1) - std::get<0>(test_tup2); int second = std::get<1>(test_tup1) - std::get<1>(test_tup2); int third = std::get<2>(test_tup1) - std::get<2>(test_tup2); return std::make_tuple(first, second, third); }
int main() { assert(func0(std::make_tuple(10, 4, 5), std::make_tuple(2, 5, 18)) == std::make_tuple(8, -1, -13)); assert(func0(std::make_tuple(11, 2, 3), std::make_tuple(24, 45, 16)) == std::make_tuple(-13, -43, -13)); assert(func0(std::make_tuple(7, 18, 9), std::make_tuple(10, 11, 12)) == std::make_tuple(-3, 7, -3)); return 0; }
O3
cpp
func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&): endbr64 mov 0x8(%rsi),%ecx mov %rdi,%rax sub 0x8(%rdx),%ecx mov 0x4(%rsi),%edi mov (%rsi),%esi sub 0x4(%rdx),%edi sub (%rdx),%esi mov %ecx,0x8(%rax) mov %esi,(%rax) mov %edi,0x4(%rax) retq
_Z5func0RKSt5tupleIJiiiEES2_: endbr64 movq xmm0, qword ptr [rsi] movq xmm1, qword ptr [rdx] mov rax, rdi mov ecx, [rsi+8] sub ecx, [rdx+8] psubd xmm0, xmm1 mov [rdi+8], ecx movq qword ptr [rdi], xmm0 retn
long long func0(long long a1, const __m128i *a2, const __m128i *a3) { long long result; // rax unsigned long long v4; // xmm0_8 result = a1; v4 = _mm_sub_epi32(_mm_loadl_epi64(a2), _mm_loadl_epi64(a3)).m128i_u64[0]; *(_DWORD *)(a1 + 8) = a2->m128i_i32[2] - a3->m128i_i32[2]; *(_QWORD *)a1 = v4; return result; }
func0: ENDBR64 MOVQ XMM0,qword ptr [RSI] MOVQ XMM1,qword ptr [RDX] MOV RAX,RDI MOV ECX,dword ptr [RSI + 0x8] SUB ECX,dword ptr [RDX + 0x8] PSUBD XMM0,XMM1 MOV dword ptr [RDI + 0x8],ECX MOVQ qword ptr [RDI],XMM0 RET
/* func0(std::tuple<int, int, int> const&, std::tuple<int, int, int> const&) */ tuple * func0(tuple *param_1,tuple *param_2) { int8 uVar1; int8 uVar2; int8 *in_RDX; uVar1 = *(int8 *)param_2; uVar2 = *in_RDX; *(int *)(param_1 + 8) = *(int *)(param_2 + 8) - *(int *)(in_RDX + 1); *(ulong *)param_1 = CONCAT44((int)((ulong)uVar1 >> 0x20) - (int)((ulong)uVar2 >> 0x20),(int)uVar1 - (int)uVar2); return param_1; }
1,092
func0
#include <iostream> #include <assert.h>
int func0(int n) { return (1 << (n - 1)); }
int main() { assert(func0(4) == 8); assert(func0(6) == 32); assert(func0(2) == 2); return 0; }
O0
cpp
func0(int): endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov -0x4(%rbp),%eax sub $0x1,%eax mov $0x1,%edx mov %eax,%ecx shl %cl,%edx mov %edx,%eax pop %rbp retq
_Z5func0i: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov eax, [rbp+var_4] sub eax, 1 mov edx, 1 mov ecx, eax shl edx, cl mov eax, edx pop rbp retn
long long func0(char a1) { return (unsigned int)(1 << (a1 - 1)); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV EAX,dword ptr [RBP + -0x4] SUB EAX,0x1 MOV EDX,0x1 MOV ECX,EAX SHL EDX,CL MOV EAX,EDX POP RBP RET
/* func0(int) */ int func0(int param_1) { return 1 << ((char)param_1 - 1U & 0x1f); }
1,093
func0
#include <iostream> #include <assert.h>
int func0(int n) { return (1 << (n - 1)); }
int main() { assert(func0(4) == 8); assert(func0(6) == 32); assert(func0(2) == 2); return 0; }
O1
cpp
func0(int): endbr64 lea -0x1(%rdi),%ecx mov $0x1,%eax shl %cl,%eax retq
_Z5func0i: endbr64 lea ecx, [rdi-1] mov eax, 1 shl eax, cl retn
long long func0(char a1) { return (unsigned int)(1 << (a1 - 1)); }
func0: ENDBR64 LEA ECX,[RDI + -0x1] MOV EAX,0x1 SHL EAX,CL RET
/* func0(int) */ int func0(int param_1) { return 1 << ((char)param_1 - 1U & 0x1f); }
1,094
func0
#include <iostream> #include <assert.h>
int func0(int n) { return (1 << (n - 1)); }
int main() { assert(func0(4) == 8); assert(func0(6) == 32); assert(func0(2) == 2); return 0; }
O2
cpp
func0(int): endbr64 lea -0x1(%rdi),%ecx mov $0x1,%eax shl %cl,%eax retq
_Z5func0i: endbr64 lea ecx, [rdi-1] mov eax, 1 shl eax, cl retn
long long func0(char a1) { return (unsigned int)(1 << (a1 - 1)); }
func0: ENDBR64 LEA ECX,[RDI + -0x1] MOV EAX,0x1 SHL EAX,CL RET
/* func0(int) */ int func0(int param_1) { return 1 << ((char)param_1 - 1U & 0x1f); }
1,095
func0
#include <iostream> #include <assert.h>
int func0(int n) { return (1 << (n - 1)); }
int main() { assert(func0(4) == 8); assert(func0(6) == 32); assert(func0(2) == 2); return 0; }
O3
cpp
func0(int): endbr64 lea -0x1(%rdi),%ecx mov $0x1,%eax shl %cl,%eax retq
_Z5func0i: endbr64 lea ecx, [rdi-1] mov eax, 1 shl eax, cl retn
long long func0(char a1) { return (unsigned int)(1 << (a1 - 1)); }
func0: ENDBR64 LEA ECX,[RDI + -0x1] MOV EAX,0x1 SHL EAX,CL RET
/* func0(int) */ int func0(int param_1) { return 1 << ((char)param_1 - 1U & 0x1f); }
1,096
func0
#include <iostream> #include <vector> #include <assert.h>
int func0(std::vector<int> a, int n, int m) { for (int i = 0; i < n; ++i) { a[i] = a[i] / m + (a[i] % m != 0); } int result = -1, maxx = -1; for (int i = n - 1; i >= 0; --i) { if (maxx < a[i]) { maxx = a[i]; result = i; } } return result + 1; }
int main() { assert(func0({2, 5, 4}, 3, 2) == 2); assert(func0({4, 3}, 2, 2) == 2); assert(func0({1, 2, 3, 4}, 4, 1) == 4); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> >, int, int): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x28,%rsp mov %rdi,-0x28(%rbp) mov %esi,-0x2c(%rbp) mov %edx,-0x30(%rbp) movl $0x0,-0x20(%rbp) mov -0x20(%rbp),%eax cmp -0x2c(%rbp),%eax jge 12f0 <_Z5func0St6vectorIiSaIiEEii+0x87> mov -0x20(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1670 <_ZNSt6vectorIiSaIiEEixEm> mov (%rax),%eax cltd idivl -0x30(%rbp) mov %eax,%ebx mov -0x20(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1670 <_ZNSt6vectorIiSaIiEEixEm> mov (%rax),%eax cltd idivl -0x30(%rbp) mov %edx,%eax test %eax,%eax setne %al movzbl %al,%eax add %eax,%ebx mov -0x20(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1670 <_ZNSt6vectorIiSaIiEEixEm> mov %ebx,(%rax) addl $0x1,-0x20(%rbp) jmp 1287 <_Z5func0St6vectorIiSaIiEEii+0x1e> movl $0xffffffff,-0x1c(%rbp) movl $0xffffffff,-0x18(%rbp) mov -0x2c(%rbp),%eax sub $0x1,%eax mov %eax,-0x14(%rbp) cmpl $0x0,-0x14(%rbp) js 1354 <_Z5func0St6vectorIiSaIiEEii+0xeb> mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1670 <_ZNSt6vectorIiSaIiEEixEm> mov (%rax),%eax cmp %eax,-0x18(%rbp) setl %al test %al,%al je 134e <_Z5func0St6vectorIiSaIiEEii+0xe5> mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1670 <_ZNSt6vectorIiSaIiEEixEm> mov (%rax),%eax mov %eax,-0x18(%rbp) mov -0x14(%rbp),%eax mov %eax,-0x1c(%rbp) subl $0x1,-0x14(%rbp) jmp 1307 <_Z5func0St6vectorIiSaIiEEii+0x9e> mov -0x1c(%rbp),%eax add $0x1,%eax add $0x28,%rsp pop %rbx pop %rbp retq
_Z5func0St6vectorIiSaIiEEii: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 28h mov [rbp+var_28], rdi mov [rbp+var_2C], esi mov [rbp+var_30], edx mov [rbp+var_20], 0 jmp short loc_12C8 loc_1269: mov eax, [rbp+var_20] movsxd rdx, eax mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] cdq idiv [rbp+var_30] mov ebx, eax mov eax, [rbp+var_20] movsxd rdx, eax mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] cdq idiv [rbp+var_30] mov eax, edx test eax, eax setnz al movzx eax, al add ebx, eax mov eax, [rbp+var_20] movsxd rdx, eax mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov [rax], ebx add [rbp+var_20], 1 loc_12C8: mov eax, [rbp+var_20] cmp eax, [rbp+var_2C] jl short loc_1269 mov [rbp+var_1C], 0FFFFFFFFh mov [rbp+var_18], 0FFFFFFFFh mov eax, [rbp+var_2C] sub eax, 1 mov [rbp+var_14], eax jmp short loc_132E loc_12E9: mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] cmp [rbp+var_18], eax setl al test al, al jz short loc_132A mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] mov [rbp+var_18], eax mov eax, [rbp+var_14] mov [rbp+var_1C], eax loc_132A: sub [rbp+var_14], 1 loc_132E: cmp [rbp+var_14], 0 jns short loc_12E9 mov eax, [rbp+var_1C] add eax, 1 mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, int a2, int a3) { int v3; // ebx int v4; // ebx int i; // [rsp+10h] [rbp-20h] int v8; // [rsp+14h] [rbp-1Ch] int v9; // [rsp+18h] [rbp-18h] int j; // [rsp+1Ch] [rbp-14h] for ( i = 0; i < a2; ++i ) { v3 = *(_DWORD *)std::vector<int>::operator[](a1, i) / a3; v4 = (*(_DWORD *)std::vector<int>::operator[](a1, i) % a3 != 0) + v3; *(_DWORD *)std::vector<int>::operator[](a1, i) = v4; } v8 = -1; v9 = -1; for ( j = a2 - 1; j >= 0; --j ) { if ( v9 < *(_DWORD *)std::vector<int>::operator[](a1, j) ) { v9 = *(_DWORD *)std::vector<int>::operator[](a1, j); v8 = j; } } return (unsigned int)(v8 + 1); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x28 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x2c],ESI MOV dword ptr [RBP + -0x30],EDX MOV dword ptr [RBP + -0x20],0x0 JMP 0x001012c8 LAB_00101269: MOV EAX,dword ptr [RBP + -0x20] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x0010164c MOV EAX,dword ptr [RAX] CDQ IDIV dword ptr [RBP + -0x30] MOV EBX,EAX MOV EAX,dword ptr [RBP + -0x20] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x0010164c MOV EAX,dword ptr [RAX] CDQ IDIV dword ptr [RBP + -0x30] MOV EAX,EDX TEST EAX,EAX SETNZ AL MOVZX EAX,AL ADD EBX,EAX MOV EAX,dword ptr [RBP + -0x20] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x0010164c MOV dword ptr [RAX],EBX ADD dword ptr [RBP + -0x20],0x1 LAB_001012c8: MOV EAX,dword ptr [RBP + -0x20] CMP EAX,dword ptr [RBP + -0x2c] JL 0x00101269 MOV dword ptr [RBP + -0x1c],0xffffffff MOV dword ptr [RBP + -0x18],0xffffffff MOV EAX,dword ptr [RBP + -0x2c] SUB EAX,0x1 MOV dword ptr [RBP + -0x14],EAX JMP 0x0010132e LAB_001012e9: MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x0010164c MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x18],EAX SETL AL TEST AL,AL JZ 0x0010132a MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x0010164c MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x18],EAX MOV EAX,dword ptr [RBP + -0x14] MOV dword ptr [RBP + -0x1c],EAX LAB_0010132a: SUB dword ptr [RBP + -0x14],0x1 LAB_0010132e: CMP dword ptr [RBP + -0x14],0x0 JNS 0x001012e9 MOV EAX,dword ptr [RBP + -0x1c] ADD EAX,0x1 MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::vector<int, std::allocator<int> >, int, int) */ int func0(vector param_1,int param_2,int param_3) { int iVar1; int iVar2; int *piVar3; int4 in_register_0000003c; vector<int,std::allocator<int>> *this; int4 local_28; int4 local_24; int4 local_20; int4 local_1c; this = (vector<int,std::allocator<int>> *)CONCAT44(in_register_0000003c,param_1); for (local_28 = 0; local_28 < param_2; local_28 = local_28 + 1) { piVar3 = (int *)std::vector<int,std::allocator<int>>::operator[](this,(long)local_28); iVar1 = *piVar3; piVar3 = (int *)std::vector<int,std::allocator<int>>::operator[](this,(long)local_28); iVar2 = *piVar3; piVar3 = (int *)std::vector<int,std::allocator<int>>::operator[](this,(long)local_28); *piVar3 = iVar1 / param_3 + (uint)(iVar2 % param_3 != 0); } local_24 = -1; local_20 = -1; for (local_1c = param_2 + -1; -1 < local_1c; local_1c = local_1c + -1) { piVar3 = (int *)std::vector<int,std::allocator<int>>::operator[](this,(long)local_1c); if (local_20 < *piVar3) { piVar3 = (int *)std::vector<int,std::allocator<int>>::operator[](this,(long)local_1c); local_20 = *piVar3; local_24 = local_1c; } } return local_24 + 1; }
1,097
func0
#include <iostream> #include <vector> #include <assert.h>
int func0(std::vector<int> a, int n, int m) { for (int i = 0; i < n; ++i) { a[i] = a[i] / m + (a[i] % m != 0); } int result = -1, maxx = -1; for (int i = n - 1; i >= 0; --i) { if (maxx < a[i]) { maxx = a[i]; result = i; } } return result + 1; }
int main() { assert(func0({2, 5, 4}, 3, 2) == 2); assert(func0({4, 3}, 2, 2) == 2); assert(func0({1, 2, 3, 4}, 4, 1) == 4); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> >, int, int): endbr64 mov %edx,%r8d test %esi,%esi jle 12a4 <_Z5func0St6vectorIiSaIiEEii+0x5b> mov (%rdi),%rcx lea -0x1(%rsi),%eax lea 0x4(%rcx,%rax,4),%r9 mov (%rcx),%eax cltd idiv %r8d test %edx,%edx setne %dl movzbl %dl,%edx add %edx,%eax mov %eax,(%rcx) add $0x4,%rcx cmp %r9,%rcx jne 125f <_Z5func0St6vectorIiSaIiEEii+0x16> mov (%rdi),%rdi sub $0x1,%esi movslq %esi,%rdx mov $0xffffffff,%esi mov $0xffffffff,%eax jmp 1297 <_Z5func0St6vectorIiSaIiEEii+0x4e> sub $0x1,%rdx test %edx,%edx js 12a9 <_Z5func0St6vectorIiSaIiEEii+0x60> mov (%rdi,%rdx,4),%ecx cmp %esi,%ecx jle 128f <_Z5func0St6vectorIiSaIiEEii+0x46> mov %ecx,%esi mov %edx,%eax jmp 128f <_Z5func0St6vectorIiSaIiEEii+0x46> mov $0xffffffff,%eax add $0x1,%eax retq
_Z5func0St6vectorIiSaIiEEii: endbr64 mov r9d, edx test esi, esi jle short loc_1269 movsxd r10, esi shl r10, 2 mov ecx, 0 loc_1220: mov r8, rcx add r8, [rdi] mov eax, [r8] cdq idiv r9d cmp edx, 1 sbb eax, 0FFFFFFFFh mov [r8], eax add rcx, 4 cmp rcx, r10 jnz short loc_1220 mov rdi, [rdi] sub esi, 1 movsxd rdx, esi mov ecx, 0FFFFFFFFh mov eax, 0FFFFFFFFh loc_1252: mov esi, [rdi+rdx*4] cmp esi, ecx cmovg eax, edx cmovg ecx, esi sub rdx, 1 test edx, edx jns short loc_1252 loc_1265: add eax, 1 retn loc_1269: mov eax, 0FFFFFFFFh jmp short loc_1265
long long func0(long long *a1, int a2, int a3) { long long v3; // rcx long long v4; // rdi long long v5; // rdx int v6; // ecx int v7; // eax if ( a2 <= 0 ) { v7 = -1; } else { v3 = 0LL; do { *(_DWORD *)(*a1 + v3) = *(_DWORD *)(*a1 + v3) / a3 - ((*(_DWORD *)(*a1 + v3) % a3 == 0) - 1); v3 += 4LL; } while ( v3 != 4LL * a2 ); v4 = *a1; v5 = a2 - 1; v6 = -1; v7 = -1; do { if ( *(_DWORD *)(v4 + 4 * v5) > v6 ) { v7 = v5; v6 = *(_DWORD *)(v4 + 4 * v5); } --v5; } while ( (int)v5 >= 0 ); } return (unsigned int)(v7 + 1); }
func0: ENDBR64 MOV R9D,EDX TEST ESI,ESI JLE 0x00101269 MOVSXD R10,ESI SHL R10,0x2 MOV ECX,0x0 LAB_00101220: MOV R8,RCX ADD R8,qword ptr [RDI] MOV EAX,dword ptr [R8] CDQ IDIV R9D CMP EDX,0x1 SBB EAX,-0x1 MOV dword ptr [R8],EAX ADD RCX,0x4 CMP RCX,R10 JNZ 0x00101220 MOV RDI,qword ptr [RDI] SUB ESI,0x1 MOVSXD RDX,ESI MOV ECX,0xffffffff MOV EAX,0xffffffff LAB_00101252: MOV ESI,dword ptr [RDI + RDX*0x4] CMP ESI,ECX CMOVG EAX,EDX CMOVG ECX,ESI SUB RDX,0x1 TEST EDX,EDX JNS 0x00101252 LAB_00101265: ADD EAX,0x1 RET LAB_00101269: MOV EAX,0xffffffff JMP 0x00101265
/* func0(std::vector<int, std::allocator<int> >, int, int) */ int func0(vector param_1,int param_2,int param_3) { int iVar1; int iVar2; ulong uVar3; int iVar4; long lVar5; ulong uVar6; int4 in_register_0000003c; int *piVar7; if (param_2 < 1) { iVar2 = -1; } else { lVar5 = 0; do { piVar7 = (int *)(lVar5 + *(long *)CONCAT44(in_register_0000003c,param_1)); iVar2 = *piVar7; *piVar7 = (iVar2 / param_3 + 1) - (uint)(iVar2 % param_3 == 0); lVar5 = lVar5 + 4; } while (lVar5 != (long)param_2 * 4); uVar6 = (ulong)(param_2 + -1); iVar4 = -1; uVar3 = 0xffffffff; do { iVar1 = *(int *)(*(long *)CONCAT44(in_register_0000003c,param_1) + uVar6 * 4); if (iVar4 < iVar1) { uVar3 = uVar6 & 0xffffffff; } iVar2 = (int)uVar3; if (iVar4 < iVar1) { iVar4 = iVar1; } uVar6 = uVar6 - 1; } while (-1 < (int)uVar6); } return iVar2 + 1; }
1,098
func0
#include <iostream> #include <vector> #include <assert.h>
int func0(std::vector<int> a, int n, int m) { for (int i = 0; i < n; ++i) { a[i] = a[i] / m + (a[i] % m != 0); } int result = -1, maxx = -1; for (int i = n - 1; i >= 0; --i) { if (maxx < a[i]) { maxx = a[i]; result = i; } } return result + 1; }
int main() { assert(func0({2, 5, 4}, 3, 2) == 2); assert(func0({4, 3}, 2, 2) == 2); assert(func0({1, 2, 3, 4}, 4, 1) == 4); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> >, int, int): endbr64 mov %edx,%r9d lea -0x1(%rsi),%r8d test %esi,%esi jle 14b0 <_Z5func0St6vectorIiSaIiEEii+0x70> mov (%rdi),%rdi mov %r8d,%eax mov %rdi,%rcx lea 0x4(%rdi,%rax,4),%rsi nopl (%rax) mov (%rcx),%eax cltd idiv %r9d test %edx,%edx setne %dl add $0x4,%rcx movzbl %dl,%edx add %edx,%eax mov %eax,-0x4(%rcx) cmp %rcx,%rsi jne 1460 <_Z5func0St6vectorIiSaIiEEii+0x20> movslq %r8d,%rdx mov $0xffffffff,%esi mov $0xffffffff,%eax nopl 0x0(%rax) mov (%rdi,%rdx,4),%ecx cmp %esi,%ecx jle 149b <_Z5func0St6vectorIiSaIiEEii+0x5b> mov %ecx,%esi mov %edx,%eax sub $0x1,%rdx test %edx,%edx jns 1490 <_Z5func0St6vectorIiSaIiEEii+0x50> add $0x1,%eax retq nopw 0x0(%rax,%rax,1) test %r8d,%r8d jns 14b8 <_Z5func0St6vectorIiSaIiEEii+0x78> xor %eax,%eax retq mov (%rdi),%rdi jmp 147c <_Z5func0St6vectorIiSaIiEEii+0x3c> nopl (%rax)
_Z5func0St6vectorIiSaIiEEii: endbr64 mov r8d, edx test esi, esi jle short loc_1400 mov rdi, [rdi] movsxd rax, esi mov rcx, rdi lea r9, [rdi+rax*4] nop dword ptr [rax+rax+00000000h] loc_13B0: mov eax, [rcx] cdq idiv r8d cmp edx, 1 sbb eax, 0FFFFFFFFh add rcx, 4 mov [rcx-4], eax cmp rcx, r9 jnz short loc_13B0 sub esi, 1 mov ecx, 0FFFFFFFFh mov eax, 0FFFFFFFFh movsxd rdx, esi nop dword ptr [rax+rax+00000000h] loc_13E0: mov esi, [rdi+rdx*4] cmp esi, ecx cmovg eax, edx cmovg ecx, esi sub rdx, 1 test edx, edx jns short loc_13E0 add eax, 1 retn loc_1400: xor eax, eax retn
long long func0(_QWORD *a1, int a2, int a3) { _DWORD *v3; // rdi _DWORD *v4; // rcx int v5; // eax int v6; // ecx int v7; // eax long long v8; // rdx if ( a2 <= 0 ) return 0LL; v3 = (_DWORD *)*a1; v4 = v3; do { v5 = *v4 / a3 - ((*v4 % a3 == 0) - 1); *v4++ = v5; } while ( v4 != &v3[a2] ); v6 = -1; v7 = -1; v8 = a2 - 1; do { if ( v3[v8] > v6 ) { v7 = v8; v6 = v3[v8]; } --v8; } while ( (int)v8 >= 0 ); return (unsigned int)(v7 + 1); }
func0: ENDBR64 MOV R8D,EDX TEST ESI,ESI JLE 0x00101400 MOV RDI,qword ptr [RDI] MOVSXD RAX,ESI MOV RCX,RDI LEA R9,[RDI + RAX*0x4] NOP dword ptr [RAX + RAX*0x1] LAB_001013b0: MOV EAX,dword ptr [RCX] CDQ IDIV R8D CMP EDX,0x1 SBB EAX,-0x1 ADD RCX,0x4 MOV dword ptr [RCX + -0x4],EAX CMP RCX,R9 JNZ 0x001013b0 SUB ESI,0x1 MOV ECX,0xffffffff MOV EAX,0xffffffff MOVSXD RDX,ESI NOP dword ptr [RAX + RAX*0x1] LAB_001013e0: MOV ESI,dword ptr [RDI + RDX*0x4] CMP ESI,ECX CMOVG EAX,EDX CMOVG ECX,ESI SUB RDX,0x1 TEST EDX,EDX JNS 0x001013e0 ADD EAX,0x1 RET LAB_00101400: XOR EAX,EAX RET
/* func0(std::vector<int, std::allocator<int> >, int, int) */ int func0(vector param_1,int param_2,int param_3) { int *piVar1; ulong uVar2; int iVar3; int *piVar4; int *piVar5; ulong uVar6; int4 in_register_0000003c; if (param_2 < 1) { return 0; } piVar1 = *(int **)CONCAT44(in_register_0000003c,param_1); piVar4 = piVar1; do { piVar5 = piVar4 + 1; *piVar4 = (*piVar4 / param_3 + 1) - (uint)(*piVar4 % param_3 == 0); piVar4 = piVar5; } while (piVar5 != piVar1 + param_2); iVar3 = -1; uVar2 = 0xffffffff; uVar6 = (ulong)(param_2 + -1); do { if (iVar3 < piVar1[uVar6]) { uVar2 = uVar6 & 0xffffffff; iVar3 = piVar1[uVar6]; } uVar6 = uVar6 - 1; } while (-1 < (int)uVar6); return (int)uVar2 + 1; }
1,099
func0
#include <iostream> #include <vector> #include <assert.h>
int func0(std::vector<int> a, int n, int m) { for (int i = 0; i < n; ++i) { a[i] = a[i] / m + (a[i] % m != 0); } int result = -1, maxx = -1; for (int i = n - 1; i >= 0; --i) { if (maxx < a[i]) { maxx = a[i]; result = i; } } return result + 1; }
int main() { assert(func0({2, 5, 4}, 3, 2) == 2); assert(func0({4, 3}, 2, 2) == 2); assert(func0({1, 2, 3, 4}, 4, 1) == 4); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> >, int, int): endbr64 mov %edx,%r9d lea -0x1(%rsi),%r8d test %esi,%esi jle 1490 <_Z5func0St6vectorIiSaIiEEii+0x70> mov (%rdi),%rdi mov %r8d,%eax mov %rdi,%rcx lea 0x4(%rdi,%rax,4),%rsi nopl (%rax) mov (%rcx),%eax cltd idiv %r9d test %edx,%edx setne %dl add $0x4,%rcx movzbl %dl,%edx add %edx,%eax mov %eax,-0x4(%rcx) cmp %rsi,%rcx jne 1440 <_Z5func0St6vectorIiSaIiEEii+0x20> movslq %r8d,%rdx mov $0xffffffff,%esi mov $0xffffffff,%eax nopl 0x0(%rax) mov (%rdi,%rdx,4),%ecx cmp %esi,%ecx jle 147b <_Z5func0St6vectorIiSaIiEEii+0x5b> mov %ecx,%esi mov %edx,%eax sub $0x1,%rdx test %edx,%edx jns 1470 <_Z5func0St6vectorIiSaIiEEii+0x50> add $0x1,%eax retq nopw 0x0(%rax,%rax,1) test %r8d,%r8d jns 1498 <_Z5func0St6vectorIiSaIiEEii+0x78> xor %eax,%eax retq mov (%rdi),%rdi jmp 145c <_Z5func0St6vectorIiSaIiEEii+0x3c> nopl (%rax)
_Z5func0St6vectorIiSaIiEEii: endbr64 mov r8d, edx test esi, esi jle short loc_1400 mov rdi, [rdi] movsxd rax, esi mov rcx, rdi lea r9, [rdi+rax*4] nop dword ptr [rax+rax+00000000h] loc_13B0: mov eax, [rcx] cdq idiv r8d cmp edx, 1 sbb eax, 0FFFFFFFFh add rcx, 4 mov [rcx-4], eax cmp rcx, r9 jnz short loc_13B0 sub esi, 1 mov ecx, 0FFFFFFFFh mov eax, 0FFFFFFFFh movsxd rdx, esi nop dword ptr [rax+rax+00000000h] loc_13E0: mov esi, [rdi+rdx*4] cmp esi, ecx cmovg eax, edx cmovg ecx, esi sub rdx, 1 test edx, edx jns short loc_13E0 add eax, 1 retn loc_1400: xor eax, eax retn
long long func0(_QWORD *a1, int a2, int a3) { _DWORD *v3; // rdi _DWORD *v4; // rcx int v5; // eax int v6; // ecx int v7; // eax long long v8; // rdx if ( a2 <= 0 ) return 0LL; v3 = (_DWORD *)*a1; v4 = v3; do { v5 = *v4 / a3 - ((*v4 % a3 == 0) - 1); *v4++ = v5; } while ( v4 != &v3[a2] ); v6 = -1; v7 = -1; v8 = a2 - 1; do { if ( v3[v8] > v6 ) { v7 = v8; v6 = v3[v8]; } --v8; } while ( (int)v8 >= 0 ); return (unsigned int)(v7 + 1); }
func0: ENDBR64 MOV R8D,EDX TEST ESI,ESI JLE 0x00101400 MOV RDI,qword ptr [RDI] MOVSXD RAX,ESI MOV RCX,RDI LEA R9,[RDI + RAX*0x4] NOP dword ptr [RAX + RAX*0x1] LAB_001013b0: MOV EAX,dword ptr [RCX] CDQ IDIV R8D CMP EDX,0x1 SBB EAX,-0x1 ADD RCX,0x4 MOV dword ptr [RCX + -0x4],EAX CMP RCX,R9 JNZ 0x001013b0 SUB ESI,0x1 MOV ECX,0xffffffff MOV EAX,0xffffffff MOVSXD RDX,ESI NOP dword ptr [RAX + RAX*0x1] LAB_001013e0: MOV ESI,dword ptr [RDI + RDX*0x4] CMP ESI,ECX CMOVG EAX,EDX CMOVG ECX,ESI SUB RDX,0x1 TEST EDX,EDX JNS 0x001013e0 ADD EAX,0x1 RET LAB_00101400: XOR EAX,EAX RET
/* func0(std::vector<int, std::allocator<int> >, int, int) */ int func0(vector param_1,int param_2,int param_3) { int *piVar1; ulong uVar2; int iVar3; int *piVar4; int *piVar5; ulong uVar6; int4 in_register_0000003c; if (param_2 < 1) { return 0; } piVar1 = *(int **)CONCAT44(in_register_0000003c,param_1); piVar4 = piVar1; do { piVar5 = piVar4 + 1; *piVar4 = (*piVar4 / param_3 + 1) - (uint)(*piVar4 % param_3 == 0); piVar4 = piVar5; } while (piVar5 != piVar1 + param_2); iVar3 = -1; uVar2 = 0xffffffff; uVar6 = (ulong)(param_2 + -1); do { if (iVar3 < piVar1[uVar6]) { uVar2 = uVar6 & 0xffffffff; iVar3 = piVar1[uVar6]; } uVar6 = uVar6 - 1; } while (-1 < (int)uVar6); return (int)uVar2 + 1; }
1,100
func0
#include <iostream> #include <assert.h>
double func0(double r, double h) { double volume = 3.1415 * r * r * h; return volume; }
int main() { assert(func0(10, 5) == 1570.7500000000002); assert(func0(4, 5) == 251.32000000000002); assert(func0(4, 10) == 502.64000000000004); return 0; }
O0
cpp
func0(double, double): endbr64 push %rbp mov %rsp,%rbp movsd %xmm0,-0x18(%rbp) movsd %xmm1,-0x20(%rbp) movsd -0x18(%rbp),%xmm1 movsd 0xf30(%rip),%xmm0 mulsd %xmm1,%xmm0 mulsd -0x18(%rbp),%xmm0 movsd -0x20(%rbp),%xmm1 mulsd %xmm1,%xmm0 movsd %xmm0,-0x8(%rbp) movsd -0x8(%rbp),%xmm0 pop %rbp retq
_Z5func0dd: endbr64 push rbp mov rbp, rsp movsd [rbp+var_18], xmm0 movsd [rbp+var_20], xmm1 movsd xmm1, [rbp+var_18] movsd xmm0, cs:qword_20B8 mulsd xmm0, xmm1 mulsd xmm0, [rbp+var_18] movsd xmm1, [rbp+var_20] mulsd xmm0, xmm1 movsd [rbp+var_8], xmm0 movsd xmm0, [rbp+var_8] pop rbp retn
double func0(double a1, double a2) { return 3.1415 * a1 * a1 * a2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOVSD qword ptr [RBP + -0x18],XMM0 MOVSD qword ptr [RBP + -0x20],XMM1 MOVSD XMM1,qword ptr [RBP + -0x18] MOVSD XMM0,qword ptr [0x001020b8] MULSD XMM0,XMM1 MULSD XMM0,qword ptr [RBP + -0x18] MOVSD XMM1,qword ptr [RBP + -0x20] MULSD XMM0,XMM1 MOVSD qword ptr [RBP + -0x8],XMM0 MOVSD XMM0,qword ptr [RBP + -0x8] POP RBP RET
/* func0(double, double) */ double func0(double param_1,double param_2) { return DAT_001020b8 * param_1 * param_1 * param_2; }
1,101
func0
#include <iostream> #include <assert.h>
double func0(double r, double h) { double volume = 3.1415 * r * r * h; return volume; }
int main() { assert(func0(10, 5) == 1570.7500000000002); assert(func0(4, 5) == 251.32000000000002); assert(func0(4, 10) == 502.64000000000004); return 0; }
O1
cpp
func0(double, double): endbr64 movapd %xmm0,%xmm2 mulsd 0xe8f(%rip),%xmm0 mulsd %xmm2,%xmm0 mulsd %xmm1,%xmm0 retq
_Z5func0dd: endbr64 movapd xmm2, xmm0 mulsd xmm0, cs:qword_2008 mulsd xmm0, xmm2 mulsd xmm0, xmm1 retn
double func0(double a1, double a2) { return a1 * 3.1415 * a1 * a2; }
func0: ENDBR64 MOVAPD XMM2,XMM0 MULSD XMM0,qword ptr [0x00102008] MULSD XMM0,XMM2 MULSD XMM0,XMM1 RET
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ /* func0(double, double) */ double func0(double param_1,double param_2) { return param_1 * _DAT_00102008 * param_1 * param_2; }
1,102
func0
#include <iostream> #include <assert.h>
double func0(double r, double h) { double volume = 3.1415 * r * r * h; return volume; }
int main() { assert(func0(10, 5) == 1570.7500000000002); assert(func0(4, 5) == 251.32000000000002); assert(func0(4, 10) == 502.64000000000004); return 0; }
O2
cpp
func0(double, double): endbr64 movapd %xmm0,%xmm2 movsd 0xe38(%rip),%xmm0 mulsd %xmm2,%xmm0 mulsd %xmm2,%xmm0 mulsd %xmm1,%xmm0 retq nopl (%rax)
_Z5func0dd: endbr64 movapd xmm2, xmm0 movsd xmm0, cs:qword_2008 mulsd xmm0, xmm2 mulsd xmm0, xmm2 mulsd xmm0, xmm1 retn
double func0(double a1, double a2) { return 3.1415 * a1 * a1 * a2; }
func0: ENDBR64 MOVAPD XMM2,XMM0 MOVSD XMM0,qword ptr [0x00102008] MULSD XMM0,XMM2 MULSD XMM0,XMM2 MULSD XMM0,XMM1 RET
/* func0(double, double) */ double func0(double param_1,double param_2) { return DAT_00102008 * param_1 * param_1 * param_2; }
1,103
func0
#include <iostream> #include <assert.h>
double func0(double r, double h) { double volume = 3.1415 * r * r * h; return volume; }
int main() { assert(func0(10, 5) == 1570.7500000000002); assert(func0(4, 5) == 251.32000000000002); assert(func0(4, 10) == 502.64000000000004); return 0; }
O3
cpp
func0(double, double): endbr64 movapd %xmm0,%xmm2 movsd 0xe38(%rip),%xmm0 mulsd %xmm2,%xmm0 mulsd %xmm2,%xmm0 mulsd %xmm1,%xmm0 retq nopl (%rax)
_Z5func0dd: endbr64 movapd xmm2, xmm0 movsd xmm0, cs:qword_2008 mulsd xmm0, xmm2 mulsd xmm0, xmm2 mulsd xmm0, xmm1 retn
double func0(double a1, double a2) { return 3.1415 * a1 * a1 * a2; }
func0: ENDBR64 MOVAPD XMM2,XMM0 MOVSD XMM0,qword ptr [0x00102008] MULSD XMM0,XMM2 MULSD XMM0,XMM2 MULSD XMM0,XMM1 RET
/* func0(double, double) */ double func0(double param_1,double param_2) { return DAT_00102008 * param_1 * param_1 * param_2; }
1,104
func0
#include <iostream> #include <map> #include <cassert>
std::map<std::string, int> func0(std::map<std::string, int> dict, int n) { std::map<std::string, int> result; for (const auto& pair : dict) { if (pair.second >= n) { result[pair.first] = pair.second; } } return result; }
int main() { std::map<std::string, int> input = {{"Cierra Vega", 175}, {"Alden Cantrell", 180}, {"Kierra Gentry", 165}, {"Pierre Cox", 190}}; std::map<std::string, int> expected; expected = {{"Cierra Vega", 175}, {"Alden Cantrell", 180}, {"Pierre Cox", 190}}; assert(func0(input, 170) == expected); expected = {{"Alden Cantrell", 180}, {"Pierre Cox", 190}}; assert(func0(input, 180) == expected); expected = {{"Pierre Cox", 190}}; assert(func0(input, 190) == expected); std::cout << "All tests passed successfully." << std::endl; return 0; }
O0
cpp
func0(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, 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, 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 %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax mov -0x48(%rbp),%rax mov %rax,%rdi callq 30ea <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEC1Ev> mov -0x50(%rbp),%rax mov %rax,-0x28(%rbp) mov -0x28(%rbp),%rax mov %rax,%rdi callq 359a <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEE5beginEv> mov %rax,-0x38(%rbp) mov -0x28(%rbp),%rax mov %rax,%rdi callq 35b8 <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEE3endEv> mov %rax,-0x30(%rbp) lea -0x30(%rbp),%rdx lea -0x38(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 35d6 <_ZStneRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEESB_> test %al,%al je 267f <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xd6> lea -0x38(%rbp),%rax mov %rax,%rdi callq 3628 <_ZNKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEEdeEv> mov %rax,-0x20(%rbp) mov -0x20(%rbp),%rax mov 0x20(%rax),%eax cmp %eax,-0x54(%rbp) jg 2653 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xaa> mov -0x20(%rbp),%rax mov 0x20(%rax),%ebx mov -0x20(%rbp),%rdx mov -0x48(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 364a <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEixERS9_> mov %ebx,(%rax) lea -0x38(%rbp),%rax mov %rax,%rdi callq 35fc <_ZNSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEEppEv> jmp 2604 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x5b> endbr64 mov %rax,%rbx mov -0x48(%rbp),%rax mov %rax,%rdi callq 310a <_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 2480 <_Unwind_Resume@plt> mov -0x18(%rbp),%rax xor %fs:0x28,%rax je 2694 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xeb> callq 2410 <__stack_chk_fail@plt> mov -0x48(%rbp),%rax add $0x58,%rsp pop %rbx pop %rbp retq
_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi: 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 rax, fs:28h mov [rbp+var_18], rax xor eax, eax mov rax, [rbp+var_48] mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEC2Ev; std::map<std::string,int>::map(void) mov rax, [rbp+var_50] mov [rbp+var_28], rax mov rax, [rbp+var_28] mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEE5beginEv; std::map<std::string,int>::begin(void) mov [rbp+var_38], rax mov rax, [rbp+var_28] mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEE3endEv; std::map<std::string,int>::end(void) mov [rbp+var_30], rax jmp short loc_25EA loc_25A6: lea rax, [rbp+var_38] 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_20], rax mov rax, [rbp+var_20] mov eax, [rax+20h] cmp [rbp+var_54], eax jg short loc_25DE mov rax, [rbp+var_20] mov ebx, [rax+20h] mov rdx, [rbp+var_20] mov rax, [rbp+var_48] mov rsi, rdx mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEixERS9_; std::map<std::string,int>::operator[](std::string const&) mov [rax], ebx loc_25DE: lea rax, [rbp+var_38] mov rdi, rax call _ZNSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiEEppEv; std::_Rb_tree_iterator<std::pair<std::string const,int>>::operator++(void) loc_25EA: lea rdx, [rbp+var_30] lea rax, [rbp+var_38] 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_25A6 jmp short loc_2635 endbr64 mov rbx, rax mov rax, [rbp+var_48] mov rdi, rax call _ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEED2Ev; std::map<std::string,int>::~map() mov rax, rbx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_262D call ___stack_chk_fail loc_262D: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_2635: mov rax, [rbp+var_18] sub rax, fs:28h jz short loc_2649 call ___stack_chk_fail loc_2649: mov rax, [rbp+var_48] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, long long a2, int a3) { int v3; // ebx long long v6; // [rsp+28h] [rbp-38h] BYREF _QWORD v7[2]; // [rsp+30h] [rbp-30h] BYREF long long v8; // [rsp+40h] [rbp-20h] unsigned long long v9; // [rsp+48h] [rbp-18h] v9 = __readfsqword(0x28u); std::map<std::string,int>::map(a1); v7[1] = a2; v6 = std::map<std::string,int>::begin(a2); v7[0] = std::map<std::string,int>::end(a2); while ( (unsigned __int8)std::operator!=(&v6, v7) ) { v8 = std::_Rb_tree_iterator<std::pair<std::string const,int>>::operator*(&v6); if ( a3 <= *(_DWORD *)(v8 + 32) ) { v3 = *(_DWORD *)(v8 + 32); *(_DWORD *)std::map<std::string,int>::operator[](a1, v8) = v3; } std::_Rb_tree_iterator<std::pair<std::string const,int>>::operator++(&v6); } 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 RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV RAX,qword ptr [RBP + -0x48] MOV RDI,RAX CALL 0x001031bc MOV RAX,qword ptr [RBP + -0x50] MOV qword ptr [RBP + -0x28],RAX MOV RAX,qword ptr [RBP + -0x28] MOV RDI,RAX CALL 0x00103684 MOV qword ptr [RBP + -0x38],RAX MOV RAX,qword ptr [RBP + -0x28] MOV RDI,RAX CALL 0x001036a2 MOV qword ptr [RBP + -0x30],RAX JMP 0x001025ea LAB_001025a6: LEA RAX,[RBP + -0x38] MOV RDI,RAX CALL 0x00103712 MOV qword ptr [RBP + -0x20],RAX MOV RAX,qword ptr [RBP + -0x20] MOV EAX,dword ptr [RAX + 0x20] CMP dword ptr [RBP + -0x54],EAX JG 0x001025de MOV RAX,qword ptr [RBP + -0x20] MOV EBX,dword ptr [RAX + 0x20] MOV RDX,qword ptr [RBP + -0x20] MOV RAX,qword ptr [RBP + -0x48] MOV RSI,RDX MOV RDI,RAX LAB_001025d7: CALL 0x00103734 MOV dword ptr [RAX],EBX LAB_001025de: LEA RAX,[RBP + -0x38] MOV RDI,RAX CALL 0x001036e6 LAB_001025ea: LEA RDX,[RBP + -0x30] LEA RAX,[RBP + -0x38] MOV RSI,RDX MOV RDI,RAX CALL 0x001036c0 TEST AL,AL JNZ 0x001025a6 JMP 0x00102635 LAB_00102635: MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x00102649 CALL 0x001023d0 LAB_00102649: MOV RAX,qword ptr [RBP + -0x48] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::map<std::string, int, std::less<std::string >, std::allocator<std::pair<std::string const, int> > >, int) */ map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> * func0(map param_1,int param_2) { int4 uVar1; char cVar2; int4 *puVar3; int in_EDX; int4 in_register_00000034; int4 in_register_0000003c; map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> *this ; long in_FS_OFFSET; int8 local_40; int8 local_38; map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> *local_30; string *local_28; long local_20; this = (map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> *)CONCAT44(in_register_0000003c,param_1); local_20 = *(long *)(in_FS_OFFSET + 0x28); std::map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::map(this); local_30 = (map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> *)CONCAT44(in_register_00000034,param_2); local_40 = std:: map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::begin((map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> *)CONCAT44(in_register_00000034,param_2)); local_38 = std:: map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::end(local_30); while( true ) { cVar2 = std::operator!=((_Rb_tree_iterator *)&local_40,(_Rb_tree_iterator *)&local_38); if (cVar2 == '\0') break; local_28 = (string *) std::_Rb_tree_iterator<std::pair<std::string_const,int>>::operator* ((_Rb_tree_iterator<std::pair<std::string_const,int>> *)&local_40); if (in_EDX <= *(int *)(local_28 + 0x20)) { uVar1 = *(int4 *)(local_28 + 0x20); /* try { // try from 001025d7 to 001025db has its CatchHandler @ 00102603 */ puVar3 = (int4 *) std:: map<std::string,int,std::less<std::string>,std::allocator<std::pair<std::string_const,int>>> ::operator[](this,local_28); *puVar3 = uVar1; } std::_Rb_tree_iterator<std::pair<std::string_const,int>>::operator++ ((_Rb_tree_iterator<std::pair<std::string_const,int>> *)&local_40); } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return this; }
1,105
func0
#include <iostream> #include <map> #include <cassert>
std::map<std::string, int> func0(std::map<std::string, int> dict, int n) { std::map<std::string, int> result; for (const auto& pair : dict) { if (pair.second >= n) { result[pair.first] = pair.second; } } return result; }
int main() { std::map<std::string, int> input = {{"Cierra Vega", 175}, {"Alden Cantrell", 180}, {"Kierra Gentry", 165}, {"Pierre Cox", 190}}; std::map<std::string, int> expected; expected = {{"Cierra Vega", 175}, {"Alden Cantrell", 180}, {"Pierre Cox", 190}}; assert(func0(input, 170) == expected); expected = {{"Alden Cantrell", 180}, {"Pierre Cox", 190}}; assert(func0(input, 180) == expected); expected = {{"Pierre Cox", 190}}; assert(func0(input, 190) == expected); std::cout << "All tests passed successfully." << std::endl; return 0; }
O1
cpp
func0(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, 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, int> > >, int): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x58,%rsp mov %rdi,0x20(%rsp) mov %edx,0x14(%rsp) mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax movl $0x0,0x8(%rdi) movq $0x0,0x10(%rdi) lea 0x8(%rdi),%rcx mov %rcx,0x18(%rsp) mov %rcx,0x18(%rdi) mov %rcx,0x20(%rdi) movq $0x0,0x28(%rdi) mov 0x18(%rsi),%rbp lea 0x8(%rsi),%rcx mov %rcx,0x8(%rsp) cmp %rcx,%rbp je 1564 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1bb> mov %rdi,0x28(%rsp) jmpq 1515 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x16c> sub %r12,%r13 mov $0x80000000,%eax cmp %rax,%r13 jge 143f <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x96> movabs $0xffffffff7fffffff,%rax cmp %rax,%r13 jle 1473 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xca> mov %r13d,%edx test %edx,%edx js 1473 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xca> mov %rbx,%r14 mov 0x10(%rbx),%rbx test %rbx,%rbx je 1479 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xd0> mov 0x28(%rbx),%r13 cmp %r12,%r13 mov %r12,%rdx cmovbe %r13,%rdx test %rdx,%rdx je 141c <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x73> mov 0x20(%rbx),%rdi mov (%rsp),%rsi callq 11a0 <memcmp@plt> mov %eax,%edx test %eax,%eax jne 143b <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x92> jmp 141c <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x73> mov 0x18(%rbx),%rbx jmp 1446 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x9d> cmp %r14,0x18(%rsp) je 14c9 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x120> mov 0x28(%r14),%rbx cmp %rbx,%r12 mov %rbx,%rdx cmovbe %r12,%rdx test %rdx,%rdx je 14a6 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xfd> mov 0x20(%r14),%rsi mov (%rsp),%rdi callq 11a0 <memcmp@plt> mov %eax,%edx test %eax,%eax jne 14c5 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x11c> sub %rbx,%r12 mov $0x80000000,%eax cmp %rax,%r12 jge 14ff <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x156> movabs $0xffffffff7fffffff,%rax cmp %rax,%r12 jle 14c9 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x120> mov %r12d,%edx test %edx,%edx jns 14ff <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x156> mov 0x28(%rsp),%rdi mov %rdi,%rbx lea 0x20(%rbp),%rax mov %rax,0x40(%rsp) lea 0x40(%rsp),%rcx lea 0x3f(%rsp),%r8 lea 0x1c4c(%rip),%rdx mov %r14,%rsi callq 2298 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESJ_IJEEEEESt17_Rb_tree_iteratorIS8_ESt23_Rb_tree_const_iteratorIS8_EDpOT_> jmp 14fc <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x153> mov 0x18(%rsp),%r14 jmp 14c9 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x120> mov %rax,%r14 mov %r15d,0x40(%r14) mov %rbp,%rdi callq 11d0 <_ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base@plt> mov %rax,%rbp cmp %rax,0x8(%rsp) je 1564 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1bb> mov 0x40(%rbp),%r15d cmp 0x14(%rsp),%r15d jl 1503 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x15a> mov 0x20(%rsp),%rax mov 0x10(%rax),%rbx test %rbx,%rbx je 14f5 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x14c> mov 0x28(%rbp),%r12 mov 0x20(%rbp),%rax mov %rax,(%rsp) mov 0x18(%rsp),%r14 jmpq 144b <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xa2> endbr64 mov %rax,%rbp mov 0x20(%rsp),%rax mov 0x10(%rax),%rsi mov %rbx,%rdi callq 1d3c <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E> mov %rbp,%rdi callq 12a0 <_Unwind_Resume@plt> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 1588 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1df> mov 0x20(%rsp),%rax add $0x58,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 1240 <__stack_chk_fail@plt>
_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 58h mov [rsp+88h+var_68], rdi mov [rsp+88h+var_6C], edx mov rax, fs:28h mov [rsp+88h+var_40], rax xor eax, eax mov dword ptr [rdi+8], 0 mov qword ptr [rdi+10h], 0 lea rcx, [rdi+8] mov [rsp+88h+var_60], rcx mov [rdi+18h], rcx mov [rdi+20h], rcx mov qword ptr [rdi+28h], 0 mov r13, [rsi+18h] lea rax, [rsi+8] mov [rsp+88h+var_78], rax cmp rax, r13 jnz loc_1546 loc_1412: mov rax, [rsp+88h+var_40] sub rax, fs:28h jnz loc_15AA mov rax, [rsp+88h+var_68] add rsp, 58h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_143A: sub rbx, r12 mov eax, 80000000h cmp rbx, rax jge short loc_145C mov rax, 0FFFFFFFF7FFFFFFFh cmp rbx, rax jle short loc_1491 mov edx, ebx loc_1458: test edx, edx js short loc_1491 loc_145C: mov [rsp+88h+var_80], rbp mov rbp, [rbp+10h] loc_1465: test rbp, rbp jz short loc_1497 loc_146A: mov rbx, [rbp+28h] cmp rbx, r12 mov rdx, r12 cmovbe rdx, rbx; n mov rdi, [rbp+20h]; s1 test rdx, rdx jz short loc_143A mov rsi, r15; s2 call _memcmp mov edx, eax test eax, eax jnz short loc_1458 jmp short loc_143A loc_1491: mov rbp, [rbp+18h] jmp short loc_1465 loc_1497: mov rax, [rsp+88h+var_80] cmp [rsp+88h+var_60], rax jz short loc_14EB mov rbx, [rax+28h] cmp r12, rbx mov rdx, rbx cmovbe rdx, r12; n mov rsi, [rax+20h]; s2 test rdx, rdx jz short loc_14C8 mov rdi, r15; s1 call _memcmp mov edx, eax test eax, eax jnz short loc_14E7 loc_14C8: sub r12, rbx mov eax, 80000000h cmp r12, rax jge short loc_1527 mov rax, 0FFFFFFFF7FFFFFFFh cmp r12, rax jle short loc_14EB mov edx, r12d loc_14E7: test edx, edx jns short loc_1527 loc_14EB: lea rax, [r13+20h] mov [rsp+88h+var_48], rax lea rcx, [rsp+88h+var_48] lea r8, [rsp+88h+var_49] lea rdx, _ZSt19piecewise_construct; std::piecewise_construct mov rsi, [rsp+88h+var_80] mov rdi, [rsp+88h+var_68] call _ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESJ_IJEEEEESt17_Rb_tree_iteratorIS8_ESt23_Rb_tree_const_iteratorIS8_EDpOT_; 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_emplace_hint_unique<std::piecewise_construct_t const&,std::tuple<std::string const&>,std::tuple<>>(std::_Rb_tree_const_iterator<std::pair<std::string const,int>>) jmp short loc_1522 loc_1516: mov rax, [rsp+88h+var_60] mov [rsp+88h+var_80], rax jmp short loc_14EB loc_1522: mov [rsp+88h+var_80], rax loc_1527: mov rax, [rsp+88h+var_80] mov [rax+40h], r14d loc_1530: mov rdi, r13 call __ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base; std::_Rb_tree_increment(std::_Rb_tree_node_base *) mov r13, rax cmp [rsp+88h+var_78], rax jz loc_1412 loc_1546: mov r14d, [r13+40h] mov eax, [rsp+88h+var_6C] cmp r14d, eax jl short loc_1530 mov rax, [rsp+88h+var_68] mov rbp, [rax+10h] test rbp, rbp jz short loc_1516 mov r12, [r13+28h] mov r15, [r13+20h] mov rax, [rsp+88h+var_60] mov [rsp+88h+var_80], rax jmp loc_146A endbr64 mov rbx, rax mov rdi, [rsp+arg_18] mov rsi, [rdi+10h] 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_40] sub rax, fs:28h jz short loc_15A2 call ___stack_chk_fail loc_15A2: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume loc_15AA: call ___stack_chk_fail
long long func0(long long a1, _QWORD *a2, size_t a3) { long long v3; // r13 long long v5; // rbx int v6; // edx long long v7; // rbp size_t v8; // rbx size_t v9; // rdx size_t v10; // rbx unsigned int v11; // eax long long v12; // r12 int v13; // r14d size_t v14; // r12 const void *v15; // r15 long long v16; // [rsp+8h] [rbp-80h] _QWORD *v17; // [rsp+10h] [rbp-78h] int v18; // [rsp+1Ch] [rbp-6Ch] char v19; // [rsp+3Fh] [rbp-49h] BYREF _QWORD v20[9]; // [rsp+40h] [rbp-48h] BYREF v18 = a3; v20[1] = __readfsqword(0x28u); *(_DWORD *)(a1 + 8) = 0; *(_QWORD *)(a1 + 16) = 0LL; *(_QWORD *)(a1 + 24) = a1 + 8; *(_QWORD *)(a1 + 32) = a1 + 8; *(_QWORD *)(a1 + 40) = 0LL; v3 = a2[3]; v17 = a2 + 1; if ( a2 + 1 == (_QWORD *)v3 ) return a1; while ( 2 ) { v13 = *(_DWORD *)(v3 + 64); if ( v13 < v18 ) goto LABEL_27; v7 = *(_QWORD *)(a1 + 16); if ( !v7 ) { v16 = a1 + 8; goto LABEL_24; } v14 = *(_QWORD *)(v3 + 40); v15 = *(const void **)(v3 + 32); v16 = a1 + 8; do { v8 = *(_QWORD *)(v7 + 40); v9 = v14; if ( v8 <= v14 ) v9 = *(_QWORD *)(v7 + 40); if ( v9 ) { v6 = memcmp(*(const void **)(v7 + 32), v15, v9); if ( v6 ) goto LABEL_6; } v5 = v8 - v14; if ( v5 >= 0x80000000LL ) goto LABEL_7; if ( v5 > (long long)0xFFFFFFFF7FFFFFFFLL ) { v6 = v5; LABEL_6: if ( v6 >= 0 ) { LABEL_7: v16 = v7; v7 = *(_QWORD *)(v7 + 16); continue; } } v7 = *(_QWORD *)(v7 + 24); } while ( v7 ); if ( a1 + 8 == v16 ) goto LABEL_24; v10 = *(_QWORD *)(v16 + 40); a3 = v10; if ( v14 <= v10 ) a3 = v14; a2 = *(_QWORD **)(v16 + 32); if ( a3 && (v11 = memcmp(v15, a2, a3), (a3 = v11) != 0) ) { LABEL_23: if ( (a3 & 0x80000000) != 0LL ) goto LABEL_24; } else { v12 = v14 - v10; if ( v12 < 0x80000000LL ) { if ( v12 > (long long)0xFFFFFFFF7FFFFFFFLL ) { a3 = (unsigned int)v12; goto LABEL_23; } LABEL_24: v20[0] = v3 + 32; a2 = (_QWORD *)v16; v16 = 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_emplace_hint_unique<std::piecewise_construct_t const&,std::tuple<std::string const&>,std::tuple<>>( a1, v16, &std::piecewise_construct, v20, &v19); } } *(_DWORD *)(v16 + 64) = v13; LABEL_27: v3 = std::_Rb_tree_increment(v3, a2, a3); if ( v17 != (_QWORD *)v3 ) continue; return a1; } }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x58 MOV qword ptr [RSP + 0x20],RDI MOV dword ptr [RSP + 0x1c],EDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV dword ptr [RDI + 0x8],0x0 MOV qword ptr [RDI + 0x10],0x0 LEA RCX,[RDI + 0x8] MOV qword ptr [RSP + 0x28],RCX MOV qword ptr [RDI + 0x18],RCX MOV qword ptr [RDI + 0x20],RCX MOV qword ptr [RDI + 0x28],0x0 MOV R13,qword ptr [RSI + 0x18] LEA RAX,[RSI + 0x8] MOV qword ptr [RSP + 0x10],RAX CMP RAX,R13 JNZ 0x00101546 LAB_00101412: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x001015aa MOV RAX,qword ptr [RSP + 0x20] ADD RSP,0x58 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010143a: SUB RBX,R12 MOV EAX,0x80000000 CMP RBX,RAX JGE 0x0010145c MOV RAX,-0x80000001 CMP RBX,RAX JLE 0x00101491 MOV EDX,EBX LAB_00101458: TEST EDX,EDX JS 0x00101491 LAB_0010145c: MOV qword ptr [RSP + 0x8],RBP MOV RBP,qword ptr [RBP + 0x10] LAB_00101465: TEST RBP,RBP JZ 0x00101497 LAB_0010146a: MOV RBX,qword ptr [RBP + 0x28] CMP RBX,R12 MOV RDX,R12 CMOVBE RDX,RBX MOV RDI,qword ptr [RBP + 0x20] TEST RDX,RDX JZ 0x0010143a MOV RSI,R15 CALL 0x001011b0 MOV EDX,EAX TEST EAX,EAX JNZ 0x00101458 JMP 0x0010143a LAB_00101491: MOV RBP,qword ptr [RBP + 0x18] JMP 0x00101465 LAB_00101497: MOV RAX,qword ptr [RSP + 0x8] CMP qword ptr [RSP + 0x28],RAX JZ 0x001014eb MOV RBX,qword ptr [RAX + 0x28] CMP R12,RBX MOV RDX,RBX CMOVBE RDX,R12 MOV RSI,qword ptr [RAX + 0x20] TEST RDX,RDX JZ 0x001014c8 MOV RDI,R15 CALL 0x001011b0 MOV EDX,EAX TEST EAX,EAX JNZ 0x001014e7 LAB_001014c8: SUB R12,RBX MOV EAX,0x80000000 CMP R12,RAX JGE 0x00101527 MOV RAX,-0x80000001 CMP R12,RAX JLE 0x001014eb MOV EDX,R12D LAB_001014e7: TEST EDX,EDX JNS 0x00101527 LAB_001014eb: LEA RAX,[R13 + 0x20] MOV qword ptr [RSP + 0x40],RAX LEA RCX,[RSP + 0x40] LEA R8,[RSP + 0x3f] LEA RDX,[0x103118] MOV RSI,qword ptr [RSP + 0x8] MOV RDI,qword ptr [RSP + 0x20] LAB_0010150f: CALL 0x001023a6 JMP 0x00101522 LAB_00101516: MOV RAX,qword ptr [RSP + 0x28] MOV qword ptr [RSP + 0x8],RAX JMP 0x001014eb LAB_00101522: MOV qword ptr [RSP + 0x8],RAX LAB_00101527: MOV RAX,qword ptr [RSP + 0x8] MOV dword ptr [RAX + 0x40],R14D LAB_00101530: MOV RDI,R13 CALL 0x001011e0 MOV R13,RAX CMP qword ptr [RSP + 0x10],RAX JZ 0x00101412 LAB_00101546: MOV R14D,dword ptr [R13 + 0x40] MOV EAX,dword ptr [RSP + 0x1c] CMP R14D,EAX JL 0x00101530 MOV RAX,qword ptr [RSP + 0x20] MOV RBP,qword ptr [RAX + 0x10] TEST RBP,RBP JZ 0x00101516 MOV R12,qword ptr [R13 + 0x28] MOV R15,qword ptr [R13 + 0x20] MOV RAX,qword ptr [RSP + 0x28] MOV qword ptr [RSP + 0x8],RAX JMP 0x0010146a LAB_001015aa: CALL 0x00101250
/* func0(std::map<std::string, int, std::less<std::string >, std::allocator<std::pair<std::string const, int> > >, int) */ long func0(map param_1,int param_2) { piecewise_construct_t *ppVar1; int iVar2; ulong uVar3; ulong uVar4; void *__s2; int iVar5; _Rb_tree_iterator _Var6; int4 extraout_var; _Rb_tree_node_base *p_Var7; int in_EDX; ulong uVar8; long lVar9; piecewise_construct_t *ppVar10; piecewise_construct_t *ppVar11; int4 in_register_00000034; int4 in_register_0000003c; long lVar12; long in_FS_OFFSET; piecewise_construct_t *local_80; _Rb_tree_node_base *local_48; long local_40; lVar12 = CONCAT44(in_register_0000003c,param_1); local_40 = *(long *)(in_FS_OFFSET + 0x28); *(int4 *)(lVar12 + 8) = 0; *(int8 *)(lVar12 + 0x10) = 0; ppVar1 = (piecewise_construct_t *)(lVar12 + 8); *(piecewise_construct_t **)(lVar12 + 0x18) = ppVar1; *(piecewise_construct_t **)(lVar12 + 0x20) = ppVar1; *(int8 *)(lVar12 + 0x28) = 0; p_Var7 = *(_Rb_tree_node_base **)(CONCAT44(in_register_00000034,param_2) + 0x18); do { if ((_Rb_tree_node_base *)(CONCAT44(in_register_00000034,param_2) + 8) == p_Var7) { if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return lVar12; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); } iVar2 = *(int *)(p_Var7 + 0x40); if (in_EDX <= iVar2) { local_80 = ppVar1; if (*(piecewise_construct_t **)(lVar12 + 0x10) == (piecewise_construct_t *)0x0) { LAB_001014eb: local_48 = p_Var7 + 0x20; /* try { // try from 0010150f to 00101513 has its CatchHandler @ 00101578 */ _Var6 = 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_emplace_hint_unique<std::piecewise_construct_t_const&,std::tuple<std::string_const&>,std::tuple<>> (param_1,local_80,(tuple *)&std::piecewise_construct,(tuple *)&local_48); local_80 = (piecewise_construct_t *)CONCAT44(extraout_var,_Var6); } else { uVar4 = *(ulong *)(p_Var7 + 0x28); __s2 = *(void **)(p_Var7 + 0x20); ppVar11 = *(piecewise_construct_t **)(lVar12 + 0x10); do { uVar3 = *(ulong *)(ppVar11 + 0x28); uVar8 = uVar4; if (uVar3 <= uVar4) { uVar8 = uVar3; } if ((uVar8 == 0) || (iVar5 = memcmp(*(void **)(ppVar11 + 0x20),__s2,uVar8), iVar5 == 0)) { lVar9 = uVar3 - uVar4; if (lVar9 < 0x80000000) { if (-0x80000001 < lVar9) { iVar5 = (int)lVar9; goto LAB_00101458; } goto LAB_00101491; } LAB_0010145c: ppVar10 = *(piecewise_construct_t **)(ppVar11 + 0x10); local_80 = ppVar11; } else { LAB_00101458: if (-1 < iVar5) goto LAB_0010145c; LAB_00101491: ppVar10 = *(piecewise_construct_t **)(ppVar11 + 0x18); } ppVar11 = ppVar10; } while (ppVar10 != (piecewise_construct_t *)0x0); if (ppVar1 == local_80) goto LAB_001014eb; uVar3 = *(ulong *)(local_80 + 0x28); uVar8 = uVar3; if (uVar4 <= uVar3) { uVar8 = uVar4; } if ((uVar8 == 0) || (iVar5 = memcmp(__s2,*(void **)(local_80 + 0x20),uVar8), iVar5 == 0)) { lVar9 = uVar4 - uVar3; if (lVar9 < 0x80000000) { if (lVar9 < -0x80000000) goto LAB_001014eb; iVar5 = (int)lVar9; goto LAB_001014e7; } } else { LAB_001014e7: if (iVar5 < 0) goto LAB_001014eb; } } *(int *)(local_80 + 0x40) = iVar2; } p_Var7 = (_Rb_tree_node_base *)std::_Rb_tree_increment(p_Var7); } while( true ); }
1,106
func0
#include <iostream> #include <map> #include <cassert>
std::map<std::string, int> func0(std::map<std::string, int> dict, int n) { std::map<std::string, int> result; for (const auto& pair : dict) { if (pair.second >= n) { result[pair.first] = pair.second; } } return result; }
int main() { std::map<std::string, int> input = {{"Cierra Vega", 175}, {"Alden Cantrell", 180}, {"Kierra Gentry", 165}, {"Pierre Cox", 190}}; std::map<std::string, int> expected; expected = {{"Cierra Vega", 175}, {"Alden Cantrell", 180}, {"Pierre Cox", 190}}; assert(func0(input, 170) == expected); expected = {{"Alden Cantrell", 180}, {"Pierre Cox", 190}}; assert(func0(input, 180) == expected); expected = {{"Pierre Cox", 190}}; assert(func0(input, 190) == expected); std::cout << "All tests passed successfully." << std::endl; return 0; }
O2
cpp
func0(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, 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, int> > >, int): endbr64 push %r15 lea 0x8(%rdi),%rcx push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x58,%rsp mov %rdi,0x18(%rsp) lea 0x3f(%rsp),%rbx mov %edx,0xc(%rsp) mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax movq $0x0,0x10(%rdi) lea 0x8(%rsi),%rax mov %rcx,0x18(%rdi) mov %rcx,0x20(%rdi) mov 0x18(%rsi),%rbp movl $0x0,0x8(%rdi) mov %rcx,0x10(%rsp) movq $0x0,0x28(%rdi) mov %rax,(%rsp) mov %rbx,0x28(%rsp) cmp %rax,%rbp jne 1c8d <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x8d> jmpq 1db8 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1b8> nopl 0x0(%rax,%rax,1) mov %rbp,%rdi callq 11f0 <_ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base@plt> mov %rax,%rbp cmp %rax,(%rsp) je 1db8 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1b8> mov 0x40(%rbp),%ebx cmp 0xc(%rsp),%ebx jl 1c78 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x78> mov 0x18(%rsp),%rax mov 0x10(%rax),%r13 test %r13,%r13 je 1de0 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1e0> mov 0x20(%rbp),%r14 mov 0x28(%rbp),%r15 mov %ebx,0x20(%rsp) mov 0x10(%rsp),%r12 mov %r14,%rbx jmp 1cc9 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xc9> xchg %ax,%ax mov 0x18(%r13),%r13 test %r13,%r13 je 1d1b <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x11b> mov 0x28(%r13),%r14 mov %r15,%rdx cmp %r15,%r14 cmovbe %r14,%rdx test %rdx,%rdx je 1cec <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xec> mov 0x20(%r13),%rdi mov %rbx,%rsi callq 11c0 <memcmp@plt> test %eax,%eax jne 1d0b <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x10b> mov %r14,%rax mov $0x80000000,%ecx sub %r15,%rax cmp %rcx,%rax jge 1d0f <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x10f> movabs $0xffffffff7fffffff,%rsi cmp %rsi,%rax jle 1cc0 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xc0> test %eax,%eax js 1cc0 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xc0> mov %r13,%r12 mov 0x10(%r13),%r13 test %r13,%r13 jne 1cc9 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xc9> mov %rbx,%r14 mov 0x20(%rsp),%ebx cmp %r12,0x10(%rsp) je 1d7e <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x17e> mov 0x28(%r12),%rcx cmp %rcx,%r15 mov %rcx,%rdx cmovbe %r15,%rdx test %rdx,%rdx je 1d58 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x158> mov 0x20(%r12),%rsi mov %r14,%rdi mov %rcx,0x20(%rsp) callq 11c0 <memcmp@plt> mov 0x20(%rsp),%rcx test %eax,%eax jne 1d7a <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x17a> mov %r15,%r8 mov $0x80000000,%eax sub %rcx,%r8 cmp %rax,%r8 jge 1da8 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1a8> movabs $0xffffffff7fffffff,%rax cmp %rax,%r8 jle 1d7e <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x17e> mov %r8d,%eax test %eax,%eax jns 1da8 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1a8> mov 0x28(%rsp),%r8 mov 0x18(%rsp),%rdi lea 0x20(%rbp),%rax lea 0x40(%rsp),%rcx lea 0x139f(%rip),%rdx mov %r12,%rsi mov %rax,0x40(%rsp) callq 2420 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESJ_IJEEEEESt17_Rb_tree_iteratorIS8_ESt23_Rb_tree_const_iteratorIS8_EDpOT_> mov %rax,%r12 mov %ebx,0x40(%r12) jmpq 1c78 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x78> nopw 0x0(%rax,%rax,1) mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 1de7 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1e7> mov 0x18(%rsp),%rax add $0x58,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) mov 0x10(%rsp),%r12 jmp 1d7e <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x17e> callq 1260 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 12e0 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi.cold> nopl 0x0(%rax,%rax,1)
_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi: endbr64 push r15 lea rcx, [rdi+8] push r14 push r13 push r12 push rbp push rbx sub rsp, 48h mov [rsp+78h+var_60], rdi mov [rsp+78h+var_74], edx mov rax, fs:28h mov [rsp+78h+var_40], rax xor eax, eax mov [rdi+18h], rcx mov rbx, [rsi+18h] lea rax, [rsi+8] mov dword ptr [rdi+8], 0 mov qword ptr [rdi+10h], 0 mov [rsp+78h+var_68], rcx mov [rdi+20h], rcx mov qword ptr [rdi+28h], 0 mov [rsp+78h+var_70], rax cmp rax, rbx jnz short loc_1E96 jmp loc_2050 loc_1E80: mov rdi, rbx call __ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base; std::_Rb_tree_increment(std::_Rb_tree_node_base *) mov rbx, rax cmp [rsp+78h+var_70], rax jz loc_2050 loc_1E96: mov r12d, [rbx+40h] mov eax, [rsp+78h+var_74] cmp r12d, eax jl short loc_1E80 mov rax, [rsp+78h+var_60] mov r14, [rax+10h] test r14, r14 jz loc_2108 mov r15, [rbx+28h] mov r13, [rbx+20h] mov [rsp+78h+var_58], rbx mov rbp, [rsp+78h+var_68] mov rbx, r15 mov r15, r14 jmp short loc_1ED9 loc_1ED0: mov r15, [r15+18h] test r15, r15 jz short loc_1F2B loc_1ED9: mov r14, [r15+28h] mov rdx, rbx mov rdi, [r15+20h]; s1 cmp r14, rbx cmovbe rdx, r14; n test rdx, rdx jz short loc_1EFC mov rsi, r13; s2 call _memcmp test eax, eax jnz short loc_1F1B loc_1EFC: sub r14, rbx mov eax, 80000000h cmp r14, rax jge short loc_1F1F mov rax, 0FFFFFFFF7FFFFFFFh cmp r14, rax jle short loc_1ED0 mov eax, r14d loc_1F1B: test eax, eax js short loc_1ED0 loc_1F1F: mov rbp, r15 mov r15, [r15+10h] test r15, r15 jnz short loc_1ED9 loc_1F2B: mov r15, rbx mov rbx, [rsp+78h+var_58] cmp [rsp+78h+var_68], rbp jz short loc_1F95 mov rcx, [rbp+28h] mov rdx, r15 mov rsi, [rbp+20h]; s2 cmp rcx, r15 cmovbe rdx, rcx; n test rdx, rdx jz short loc_1F67 mov rdi, r13; s1 mov [rsp+78h+var_58], rcx call _memcmp mov rcx, [rsp+78h+var_58] test eax, eax jnz short loc_1F8D loc_1F67: mov r8, r15 mov eax, 80000000h sub r8, rcx cmp r8, rax jge loc_2047 mov rax, 0FFFFFFFF7FFFFFFFh cmp r8, rax jle short loc_1F95 mov eax, r8d loc_1F8D: test eax, eax jns loc_2047 loc_1F95: mov edi, 48h ; 'H'; unsigned __int64 mov r14, rbp call __Znwm; operator new(ulong) mov rbp, rax lea rax, [rax+20h] mov r13, [rbx+28h] mov r15, rax lea rax, [rbp+30h] mov [rsp+78h+var_58], rax mov [rbp+20h], rax mov rax, [rbx+20h] mov [rsp+78h+var_48], r13 mov [rsp+78h+src], rax cmp r13, 0Fh ja loc_20C8 cmp r13, 1 jz loc_2080 test r13, r13 jnz loc_217A loc_1FE8: mov rax, [rsp+78h+var_58] loc_1FED: mov [rbp+28h], r13 mov rdi, [rsp+78h+var_60] mov rdx, r15 mov rsi, r14 mov byte ptr [rax+r13], 0 mov dword ptr [rbp+40h], 0 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, rax mov r8, rdx test rdx, rdx jz short loc_2090 cmp [rsp+78h+var_68], rdx jz short loc_2028 test rax, rax jz loc_2112 loc_2028: mov edi, 1 loc_202D: mov rcx, [rsp+78h+var_68] mov rdx, r8 mov rsi, rbp 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&) mov rax, [rsp+78h+var_60] add qword ptr [rax+28h], 1 loc_2047: mov [rbp+40h], r12d jmp loc_1E80 loc_2050: mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz loc_2184 mov rax, [rsp+78h+var_60] add rsp, 48h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_2080: mov rax, [rsp+78h+src] movzx eax, byte ptr [rax] mov [rbp+30h], al jmp loc_1FE8 loc_2090: mov rdi, [rbp+20h]; void * cmp [rsp+78h+var_58], rdi jz short loc_20A8 mov rax, [rbp+30h] lea rsi, [rax+1]; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_20A8: mov rdi, rbp; void * mov esi, 48h ; 'H'; unsigned __int64 mov rbp, r13 call __ZdlPvm; operator delete(void *,ulong) mov [rbp+40h], r12d jmp loc_1E80 loc_20C8: lea rsi, [rsp+78h+var_48] xor edx, edx mov rdi, r15 call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm; std::string::_M_create(ulong &,ulong) mov [rbp+20h], rax mov rdi, rax; dest mov rax, [rsp+78h+var_48] mov [rbp+30h], rax loc_20E7: mov rsi, [rsp+78h+src]; src mov rdx, r13; n call _memcpy mov r13, [rsp+78h+var_48] mov rax, [rbp+20h] jmp loc_1FED loc_2108: mov rbp, [rsp+78h+var_68] jmp loc_1F95 loc_2112: mov r13, [rbp+28h] mov rcx, [rdx+28h] cmp r13, rcx mov rdx, rcx cmovbe rdx, r13; n test rdx, rdx jz short loc_2150 mov rsi, [r8+20h]; s2 mov rdi, [rbp+20h]; s1 mov [rsp+78h+src], rcx mov [rsp+78h+var_58], r8 call _memcmp mov r8, [rsp+78h+var_58] mov rcx, [rsp+78h+src] test eax, eax mov edi, eax jnz short loc_2172 loc_2150: sub r13, rcx xor edi, edi cmp r13, 7FFFFFFFh jg loc_202D cmp r13, 0FFFFFFFF80000000h jl loc_2028 mov edi, r13d loc_2172: shr edi, 1Fh jmp loc_202D loc_217A: mov rdi, [rsp+78h+var_58] jmp loc_20E7 loc_2184: call ___stack_chk_fail endbr64 mov rdi, rax jmp _Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi_cold; func0(std::map<std::string,int>,int) [clone] endbr64 mov rbx, rax jmp loc_1353
long long func0(long long a1, long long a2, int a3) { long long v3; // rbx int v4; // r12d const void *v5; // r13 long long v6; // rbp size_t v7; // rbx long long v8; // r15 size_t v9; // r14 size_t v10; // rdx int v11; // eax long long v12; // r14 size_t v13; // r15 size_t v14; // rcx size_t v15; // rdx int v16; // eax long long v17; // r14 size_t v18; // r13 long long v19; // r15 _BYTE *v20; // rax long long v21; // rax long long insert_hint_unique_pos; // rax long long v23; // rdx long long v24; // r13 long long v25; // r8 long long v26; // rdi void *v28; // rdi long long v29; // rax void *v30; // rdi size_t v31; // r13 void *v32; // rcx size_t v33; // rdx int v34; // eax unsigned int v35; // edi long long v36; // r13 long long v38; // [rsp+10h] [rbp-68h] long long v40; // [rsp+20h] [rbp-58h] size_t v41; // [rsp+20h] [rbp-58h] long long v42; // [rsp+20h] [rbp-58h] void *src; // [rsp+28h] [rbp-50h] void *srca; // [rsp+28h] [rbp-50h] _QWORD v45[9]; // [rsp+30h] [rbp-48h] BYREF v45[1] = __readfsqword(0x28u); *(_QWORD *)(a1 + 24) = a1 + 8; v3 = *(_QWORD *)(a2 + 24); *(_DWORD *)(a1 + 8) = 0; *(_QWORD *)(a1 + 16) = 0LL; v38 = a1 + 8; *(_QWORD *)(a1 + 32) = a1 + 8; *(_QWORD *)(a1 + 40) = 0LL; if ( a2 + 8 == v3 ) return a1; while ( 2 ) { v4 = *(_DWORD *)(v3 + 64); if ( v4 < a3 ) goto LABEL_3; if ( !*(_QWORD *)(a1 + 16) ) { v6 = v38; goto LABEL_26; } v5 = *(const void **)(v3 + 32); v40 = v3; v6 = v38; v7 = *(_QWORD *)(v3 + 40); v8 = *(_QWORD *)(a1 + 16); do { while ( 1 ) { v9 = *(_QWORD *)(v8 + 40); v10 = v7; if ( v9 <= v7 ) v10 = *(_QWORD *)(v8 + 40); if ( v10 ) { v11 = memcmp(*(const void **)(v8 + 32), v5, v10); if ( v11 ) break; } v12 = v9 - v7; if ( v12 >= 0x80000000LL ) goto LABEL_16; if ( v12 > (long long)0xFFFFFFFF7FFFFFFFLL ) { v11 = v12; break; } LABEL_7: v8 = *(_QWORD *)(v8 + 24); if ( !v8 ) goto LABEL_17; } if ( v11 < 0 ) goto LABEL_7; LABEL_16: v6 = v8; v8 = *(_QWORD *)(v8 + 16); } while ( v8 ); LABEL_17: v13 = v7; v3 = v40; if ( v38 == v6 ) goto LABEL_26; v14 = *(_QWORD *)(v6 + 40); v15 = v13; if ( v14 <= v13 ) v15 = *(_QWORD *)(v6 + 40); if ( v15 ) { v41 = *(_QWORD *)(v6 + 40); v16 = memcmp(v5, *(const void **)(v6 + 32), v15); v14 = v41; if ( v16 ) { LABEL_25: if ( v16 < 0 ) goto LABEL_26; goto LABEL_35; } } if ( (long long)(v13 - v14) >= 0x80000000LL ) goto LABEL_35; if ( (long long)(v13 - v14) > (long long)0xFFFFFFFF7FFFFFFFLL ) { v16 = v13 - v14; goto LABEL_25; } LABEL_26: v17 = v6; v6 = operator new(0x48uLL); v18 = *(_QWORD *)(v3 + 40); v19 = v6 + 32; *(_QWORD *)(v6 + 32) = v6 + 48; v20 = *(_BYTE **)(v3 + 32); v45[0] = v18; src = v20; if ( v18 > 0xF ) { v29 = std::string::_M_create(v19, v45, 0LL); *(_QWORD *)(v6 + 32) = v29; v30 = (void *)v29; *(_QWORD *)(v6 + 48) = v45[0]; goto LABEL_42; } if ( v18 == 1 ) { *(_BYTE *)(v6 + 48) = *v20; LABEL_29: v21 = v6 + 48; } else { if ( !v18 ) goto LABEL_29; v30 = (void *)(v6 + 48); LABEL_42: memcpy(v30, src, v18); v18 = v45[0]; v21 = *(_QWORD *)(v6 + 32); } *(_QWORD *)(v6 + 40) = v18; *(_BYTE *)(v21 + v18) = 0; *(_DWORD *)(v6 + 64) = 0; 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( a1, v17, v19); v24 = insert_hint_unique_pos; v25 = v23; if ( v23 ) { if ( v38 == v23 || insert_hint_unique_pos ) { LABEL_33: v26 = 1LL; goto LABEL_34; } v31 = *(_QWORD *)(v6 + 40); v33 = *(_QWORD *)(v23 + 40); v32 = (void *)v33; if ( v31 <= v33 ) v33 = *(_QWORD *)(v6 + 40); if ( v33 && (srca = v32, v42 = v25, v34 = memcmp(*(const void **)(v6 + 32), *(const void **)(v25 + 32), v33), v25 = v42, v32 = srca, (v35 = v34) != 0) ) { LABEL_51: v26 = v35 >> 31; } else { v36 = v31 - (_QWORD)v32; v26 = 0LL; if ( v36 <= 0x7FFFFFFF ) { if ( v36 < (long long)0xFFFFFFFF80000000LL ) goto LABEL_33; v35 = v36; goto LABEL_51; } } LABEL_34: std::_Rb_tree_insert_and_rebalance(v26, v6, v25, v38); ++*(_QWORD *)(a1 + 40); LABEL_35: *(_DWORD *)(v6 + 64) = v4; } else { v28 = *(void **)(v6 + 32); if ( (void *)(v6 + 48) != v28 ) operator delete(v28, *(_QWORD *)(v6 + 48) + 1LL); operator delete((void *)v6, 0x48uLL); *(_DWORD *)(v24 + 64) = v4; } LABEL_3: v3 = std::_Rb_tree_increment(v3); if ( a2 + 8 != v3 ) continue; return a1; } }
func0: ENDBR64 PUSH R15 LEA RCX,[RDI + 0x8] PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x48 MOV qword ptr [RSP + 0x18],RDI MOV dword ptr [RSP + 0x4],EDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x38],RAX XOR EAX,EAX MOV qword ptr [RDI + 0x18],RCX MOV RBX,qword ptr [RSI + 0x18] LEA RAX,[RSI + 0x8] MOV dword ptr [RDI + 0x8],0x0 MOV qword ptr [RDI + 0x10],0x0 MOV qword ptr [RSP + 0x10],RCX MOV qword ptr [RDI + 0x20],RCX MOV qword ptr [RDI + 0x28],0x0 MOV qword ptr [RSP + 0x8],RAX CMP RAX,RBX JNZ 0x00101e96 JMP 0x00102050 LAB_00101e80: MOV RDI,RBX CALL 0x00101220 MOV RBX,RAX CMP qword ptr [RSP + 0x8],RAX JZ 0x00102050 LAB_00101e96: MOV R12D,dword ptr [RBX + 0x40] MOV EAX,dword ptr [RSP + 0x4] CMP R12D,EAX JL 0x00101e80 MOV RAX,qword ptr [RSP + 0x18] MOV R14,qword ptr [RAX + 0x10] TEST R14,R14 JZ 0x00102108 MOV R15,qword ptr [RBX + 0x28] MOV R13,qword ptr [RBX + 0x20] MOV qword ptr [RSP + 0x20],RBX MOV RBP,qword ptr [RSP + 0x10] MOV RBX,R15 MOV R15,R14 JMP 0x00101ed9 LAB_00101ed0: MOV R15,qword ptr [R15 + 0x18] TEST R15,R15 JZ 0x00101f2b LAB_00101ed9: MOV R14,qword ptr [R15 + 0x28] MOV RDX,RBX MOV RDI,qword ptr [R15 + 0x20] CMP R14,RBX CMOVBE RDX,R14 TEST RDX,RDX JZ 0x00101efc MOV RSI,R13 CALL 0x001011f0 TEST EAX,EAX JNZ 0x00101f1b LAB_00101efc: SUB R14,RBX MOV EAX,0x80000000 CMP R14,RAX JGE 0x00101f1f MOV RAX,-0x80000001 CMP R14,RAX JLE 0x00101ed0 MOV EAX,R14D LAB_00101f1b: TEST EAX,EAX JS 0x00101ed0 LAB_00101f1f: MOV RBP,R15 MOV R15,qword ptr [R15 + 0x10] TEST R15,R15 JNZ 0x00101ed9 LAB_00101f2b: MOV R15,RBX MOV RBX,qword ptr [RSP + 0x20] CMP qword ptr [RSP + 0x10],RBP JZ 0x00101f95 MOV RCX,qword ptr [RBP + 0x28] MOV RDX,R15 MOV RSI,qword ptr [RBP + 0x20] CMP RCX,R15 CMOVBE RDX,RCX TEST RDX,RDX JZ 0x00101f67 MOV RDI,R13 MOV qword ptr [RSP + 0x20],RCX CALL 0x001011f0 MOV RCX,qword ptr [RSP + 0x20] TEST EAX,EAX JNZ 0x00101f8d LAB_00101f67: MOV R8,R15 MOV EAX,0x80000000 SUB R8,RCX CMP R8,RAX JGE 0x00102047 MOV RAX,-0x80000001 CMP R8,RAX JLE 0x00101f95 MOV EAX,R8D LAB_00101f8d: TEST EAX,EAX JNS 0x00102047 LAB_00101f95: MOV EDI,0x48 MOV R14,RBP LAB_00101f9d: CALL 0x00101260 MOV RBP,RAX LEA RAX,[RAX + 0x20] MOV R13,qword ptr [RBX + 0x28] MOV R15,RAX LEA RAX,[RBP + 0x30] MOV qword ptr [RSP + 0x20],RAX MOV qword ptr [RBP + 0x20],RAX MOV RAX,qword ptr [RBX + 0x20] MOV qword ptr [RSP + 0x30],R13 MOV qword ptr [RSP + 0x28],RAX CMP R13,0xf JA 0x001020c8 CMP R13,0x1 JZ 0x00102080 TEST R13,R13 JNZ 0x0010217a LAB_00101fe8: MOV RAX,qword ptr [RSP + 0x20] LAB_00101fed: MOV qword ptr [RBP + 0x28],R13 MOV RDI,qword ptr [RSP + 0x18] MOV RDX,R15 MOV RSI,R14 MOV byte ptr [RAX + R13*0x1],0x0 MOV dword ptr [RBP + 0x40],0x0 CALL 0x00102850 MOV R13,RAX MOV R8,RDX TEST RDX,RDX JZ 0x00102090 CMP qword ptr [RSP + 0x10],RDX JZ 0x00102028 TEST RAX,RAX JZ 0x00102112 LAB_00102028: MOV EDI,0x1 LAB_0010202d: MOV RCX,qword ptr [RSP + 0x10] MOV RDX,R8 MOV RSI,RBP CALL 0x001011c0 MOV RAX,qword ptr [RSP + 0x18] ADD qword ptr [RAX + 0x28],0x1 LAB_00102047: MOV dword ptr [RBP + 0x40],R12D JMP 0x00101e80 LAB_00102050: MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x00102184 MOV RAX,qword ptr [RSP + 0x18] ADD RSP,0x48 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00102080: MOV RAX,qword ptr [RSP + 0x28] MOVZX EAX,byte ptr [RAX] MOV byte ptr [RBP + 0x30],AL JMP 0x00101fe8 LAB_00102090: MOV RDI,qword ptr [RBP + 0x20] CMP qword ptr [RSP + 0x20],RDI JZ 0x001020a8 MOV RAX,qword ptr [RBP + 0x30] LEA RSI,[RAX + 0x1] CALL 0x00101270 LAB_001020a8: MOV RDI,RBP MOV ESI,0x48 MOV RBP,R13 CALL 0x00101270 MOV dword ptr [RBP + 0x40],R12D JMP 0x00101e80 LAB_001020c8: LEA RSI,[RSP + 0x30] XOR EDX,EDX MOV RDI,R15 LAB_001020d2: CALL 0x00101310 MOV qword ptr [RBP + 0x20],RAX MOV RDI,RAX MOV RAX,qword ptr [RSP + 0x30] MOV qword ptr [RBP + 0x30],RAX LAB_001020e7: MOV RSI,qword ptr [RSP + 0x28] MOV RDX,R13 CALL 0x00101240 MOV R13,qword ptr [RSP + 0x30] MOV RAX,qword ptr [RBP + 0x20] JMP 0x00101fed LAB_00102108: MOV RBP,qword ptr [RSP + 0x10] JMP 0x00101f95 LAB_00102112: MOV R13,qword ptr [RBP + 0x28] MOV RCX,qword ptr [RDX + 0x28] CMP R13,RCX MOV RDX,RCX CMOVBE RDX,R13 TEST RDX,RDX JZ 0x00102150 MOV RSI,qword ptr [R8 + 0x20] MOV RDI,qword ptr [RBP + 0x20] MOV qword ptr [RSP + 0x28],RCX MOV qword ptr [RSP + 0x20],R8 CALL 0x001011f0 MOV R8,qword ptr [RSP + 0x20] MOV RCX,qword ptr [RSP + 0x28] TEST EAX,EAX MOV EDI,EAX JNZ 0x00102172 LAB_00102150: SUB R13,RCX XOR EDI,EDI CMP R13,0x7fffffff JG 0x0010202d CMP R13,-0x80000000 JL 0x00102028 MOV EDI,R13D LAB_00102172: SHR EDI,0x1f JMP 0x0010202d LAB_0010217a: MOV RDI,qword ptr [RSP + 0x20] JMP 0x001020e7 LAB_00102184: CALL 0x00101290
/* func0(std::map<std::string, int, std::less<std::string >, std::allocator<std::pair<std::string const, int> > >, int) */ _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>>> * func0(map param_1,int param_2) { _Rb_tree_node_base *p_Var1; _Rb_tree_node_base *p_Var2; int iVar3; ulong uVar4; void *__s2; ulong uVar5; _Rb_tree_node_base *__src; int iVar6; _Rb_tree_node_base *p_Var7; _Rb_tree_node_base *p_Var8; _Rb_tree_node_base *p_Var9; int in_EDX; ulong uVar10; _Rb_tree_node_base *p_Var11; int4 in_register_00000034; bool bVar12; int4 in_register_0000003c; _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>>> *this; long lVar13; long in_FS_OFFSET; int auVar14 [16]; ulong local_48; long local_40; this = (_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>>> *)CONCAT44(in_register_0000003c,param_1); p_Var1 = (_Rb_tree_node_base *)(this + 8); local_40 = *(long *)(in_FS_OFFSET + 0x28); *(_Rb_tree_node_base **)(this + 0x18) = p_Var1; p_Var7 = *(_Rb_tree_node_base **)(CONCAT44(in_register_00000034,param_2) + 0x18); *(int4 *)(this + 8) = 0; *(int8 *)(this + 0x10) = 0; *(_Rb_tree_node_base **)(this + 0x20) = p_Var1; *(int8 *)(this + 0x28) = 0; do { if ((_Rb_tree_node_base *)(CONCAT44(in_register_00000034,param_2) + 8) == p_Var7) { if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return this; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); } iVar3 = *(int *)(p_Var7 + 0x40); if (in_EDX <= iVar3) { p_Var11 = p_Var1; if (*(_Rb_tree_node_base **)(this + 0x10) == (_Rb_tree_node_base *)0x0) { LAB_00101f95: /* try { // try from 00101f9d to 00101fa1 has its CatchHandler @ 00102195 */ p_Var8 = (_Rb_tree_node_base *)operator_new(0x48); uVar4 = *(ulong *)(p_Var7 + 0x28); p_Var2 = p_Var8 + 0x30; *(_Rb_tree_node_base **)(p_Var8 + 0x20) = p_Var2; __src = *(_Rb_tree_node_base **)(p_Var7 + 0x20); local_48 = uVar4; if (uVar4 < 0x10) { p_Var9 = p_Var2; if (uVar4 == 1) { p_Var8[0x30] = *__src; } else if (uVar4 != 0) goto LAB_001020e7; } else { /* try { // try from 001020d2 to 001020d6 has its CatchHandler @ 00102189 */ p_Var9 = (_Rb_tree_node_base *) std::string::_M_create((ulong *)(p_Var8 + 0x20),(ulong)&local_48); *(_Rb_tree_node_base **)(p_Var8 + 0x20) = p_Var9; *(ulong *)(p_Var8 + 0x30) = local_48; LAB_001020e7: memcpy(p_Var9,__src,uVar4); p_Var9 = *(_Rb_tree_node_base **)(p_Var8 + 0x20); } *(ulong *)(p_Var8 + 0x28) = local_48; p_Var9[local_48] = (_Rb_tree_node_base)0x0; *(int4 *)(p_Var8 + 0x40) = 0; 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 (this,(_Rb_tree_const_iterator)p_Var11,(string *)(p_Var8 + 0x20)); p_Var11 = auVar14._8_8_; if (p_Var11 == (_Rb_tree_node_base *)0x0) { if (p_Var2 != *(_Rb_tree_node_base **)(p_Var8 + 0x20)) { operator_delete(*(_Rb_tree_node_base **)(p_Var8 + 0x20),*(long *)(p_Var8 + 0x30) + 1); } operator_delete(p_Var8,0x48); *(int *)(auVar14._0_8_ + 0x40) = iVar3; goto LAB_00101e80; } if ((p_Var1 == p_Var11) || (auVar14._0_8_ != 0)) { LAB_00102028: bVar12 = true; } else { uVar4 = *(ulong *)(p_Var8 + 0x28); uVar5 = *(ulong *)(p_Var11 + 0x28); uVar10 = uVar5; if (uVar4 <= uVar5) { uVar10 = uVar4; } if ((uVar10 == 0) || (iVar6 = memcmp(*(void **)(p_Var8 + 0x20),*(void **)(p_Var11 + 0x20),uVar10), iVar6 == 0)) { lVar13 = uVar4 - uVar5; bVar12 = false; if (0x7fffffff < lVar13) goto LAB_0010202d; if (lVar13 < -0x80000000) goto LAB_00102028; iVar6 = (int)lVar13; } bVar12 = SUB41((uint)iVar6 >> 0x1f,0); } LAB_0010202d: std::_Rb_tree_insert_and_rebalance(bVar12,p_Var8,p_Var11,p_Var1); *(long *)(this + 0x28) = *(long *)(this + 0x28) + 1; } else { uVar4 = *(ulong *)(p_Var7 + 0x28); __s2 = *(void **)(p_Var7 + 0x20); p_Var8 = p_Var1; p_Var11 = *(_Rb_tree_node_base **)(this + 0x10); do { while( true ) { uVar5 = *(ulong *)(p_Var11 + 0x28); uVar10 = uVar4; if (uVar5 <= uVar4) { uVar10 = uVar5; } if ((uVar10 != 0) && (iVar6 = memcmp(*(void **)(p_Var11 + 0x20),__s2,uVar10), iVar6 != 0)) break; lVar13 = uVar5 - uVar4; if (lVar13 < 0x80000000) { if (-0x80000001 < lVar13) { iVar6 = (int)lVar13; break; } goto LAB_00101ed0; } LAB_00101f1f: p_Var2 = p_Var11 + 0x10; p_Var8 = p_Var11; p_Var11 = *(_Rb_tree_node_base **)p_Var2; if (*(_Rb_tree_node_base **)p_Var2 == (_Rb_tree_node_base *)0x0) goto LAB_00101f2b; } if (-1 < iVar6) goto LAB_00101f1f; LAB_00101ed0: p_Var11 = *(_Rb_tree_node_base **)(p_Var11 + 0x18); } while (p_Var11 != (_Rb_tree_node_base *)0x0); LAB_00101f2b: p_Var11 = p_Var8; if (p_Var1 == p_Var8) goto LAB_00101f95; uVar5 = *(ulong *)(p_Var8 + 0x28); uVar10 = uVar4; if (uVar5 <= uVar4) { uVar10 = uVar5; } if ((uVar10 == 0) || (iVar6 = memcmp(__s2,*(void **)(p_Var8 + 0x20),uVar10), iVar6 == 0)) { lVar13 = uVar4 - uVar5; if (lVar13 < 0x80000000) { if (lVar13 < -0x80000000) goto LAB_00101f95; iVar6 = (int)lVar13; goto LAB_00101f8d; } } else { LAB_00101f8d: if (iVar6 < 0) goto LAB_00101f95; } } *(int *)(p_Var8 + 0x40) = iVar3; } LAB_00101e80: p_Var7 = (_Rb_tree_node_base *)std::_Rb_tree_increment(p_Var7); } while( true ); }
1,107
func0
#include <iostream> #include <map> #include <cassert>
std::map<std::string, int> func0(std::map<std::string, int> dict, int n) { std::map<std::string, int> result; for (const auto& pair : dict) { if (pair.second >= n) { result[pair.first] = pair.second; } } return result; }
int main() { std::map<std::string, int> input = {{"Cierra Vega", 175}, {"Alden Cantrell", 180}, {"Kierra Gentry", 165}, {"Pierre Cox", 190}}; std::map<std::string, int> expected; expected = {{"Cierra Vega", 175}, {"Alden Cantrell", 180}, {"Pierre Cox", 190}}; assert(func0(input, 170) == expected); expected = {{"Alden Cantrell", 180}, {"Pierre Cox", 190}}; assert(func0(input, 180) == expected); expected = {{"Pierre Cox", 190}}; assert(func0(input, 190) == expected); std::cout << "All tests passed successfully." << std::endl; return 0; }
O3
cpp
func0(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, 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, int> > >, int): endbr64 push %r15 lea 0x8(%rdi),%rcx push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x58,%rsp mov %rdi,0x18(%rsp) lea 0x3f(%rsp),%rbx mov %edx,0xc(%rsp) mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax movq $0x0,0x10(%rdi) lea 0x8(%rsi),%rax mov %rcx,0x18(%rdi) mov %rcx,0x20(%rdi) mov 0x18(%rsi),%rbp movl $0x0,0x8(%rdi) mov %rcx,0x10(%rsp) movq $0x0,0x28(%rdi) mov %rax,(%rsp) mov %rbx,0x28(%rsp) cmp %rax,%rbp jne 1ded <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x8d> jmpq 1f18 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1b8> nopl 0x0(%rax,%rax,1) mov %rbp,%rdi callq 11f0 <_ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base@plt> mov %rax,%rbp cmp %rax,(%rsp) je 1f18 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1b8> mov 0x40(%rbp),%ebx cmp 0xc(%rsp),%ebx jl 1dd8 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x78> mov 0x18(%rsp),%rax mov 0x10(%rax),%r13 test %r13,%r13 je 1f40 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1e0> mov 0x20(%rbp),%r14 mov 0x28(%rbp),%r15 mov %ebx,0x20(%rsp) mov 0x10(%rsp),%r12 mov %r14,%rbx jmp 1e29 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xc9> xchg %ax,%ax mov 0x18(%r13),%r13 test %r13,%r13 je 1e7b <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x11b> mov 0x28(%r13),%r14 mov %r15,%rdx cmp %r15,%r14 cmovbe %r14,%rdx test %rdx,%rdx je 1e4c <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xec> mov 0x20(%r13),%rdi mov %rbx,%rsi callq 11c0 <memcmp@plt> test %eax,%eax jne 1e6b <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x10b> mov %r14,%rax mov $0x80000000,%ecx sub %r15,%rax cmp %rcx,%rax jge 1e6f <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x10f> movabs $0xffffffff7fffffff,%rsi cmp %rsi,%rax jle 1e20 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xc0> test %eax,%eax js 1e20 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xc0> mov %r13,%r12 mov 0x10(%r13),%r13 test %r13,%r13 jne 1e29 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0xc9> mov %rbx,%r14 mov 0x20(%rsp),%ebx cmp %r12,0x10(%rsp) je 1ede <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x17e> mov 0x28(%r12),%rcx cmp %rcx,%r15 mov %rcx,%rdx cmovbe %r15,%rdx test %rdx,%rdx je 1eb8 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x158> mov 0x20(%r12),%rsi mov %r14,%rdi mov %rcx,0x20(%rsp) callq 11c0 <memcmp@plt> mov 0x20(%rsp),%rcx test %eax,%eax jne 1eda <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x17a> mov %r15,%r8 mov $0x80000000,%eax sub %rcx,%r8 cmp %rax,%r8 jge 1f08 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1a8> movabs $0xffffffff7fffffff,%rax cmp %rax,%r8 jle 1ede <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x17e> mov %r8d,%eax test %eax,%eax jns 1f08 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1a8> mov 0x28(%rsp),%r8 mov 0x18(%rsp),%rdi lea 0x20(%rbp),%rax lea 0x40(%rsp),%rcx lea 0x1240(%rip),%rdx mov %r12,%rsi mov %rax,0x40(%rsp) callq 23e0 <_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_iESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESJ_IJEEEEESt17_Rb_tree_iteratorIS8_ESt23_Rb_tree_const_iteratorIS8_EDpOT_> mov %rax,%r12 mov %ebx,0x40(%r12) jmpq 1dd8 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x78> nopw 0x0(%rax,%rax,1) mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 1f47 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x1e7> mov 0x18(%rsp),%rax add $0x58,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) mov 0x10(%rsp),%r12 jmp 1ede <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi+0x17e> callq 1260 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 12e0 <_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi.cold> nopl 0x0(%rax,%rax,1)
_Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi: endbr64 push r15 lea rcx, [rdi+8] push r14 push r13 push r12 push rbp push rbx sub rsp, 48h mov [rsp+78h+var_60], rdi mov [rsp+78h+var_74], edx mov rax, fs:28h mov [rsp+78h+var_40], rax xor eax, eax mov [rdi+18h], rcx mov rbx, [rsi+18h] lea rax, [rsi+8] mov dword ptr [rdi+8], 0 mov qword ptr [rdi+10h], 0 mov [rsp+78h+var_68], rcx mov [rdi+20h], rcx mov qword ptr [rdi+28h], 0 mov [rsp+78h+var_70], rax cmp rax, rbx jnz short loc_2206 jmp loc_23C0 loc_21F0: mov rdi, rbx call __ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base; std::_Rb_tree_increment(std::_Rb_tree_node_base *) mov rbx, rax cmp [rsp+78h+var_70], rax jz loc_23C0 loc_2206: mov r12d, [rbx+40h] mov eax, [rsp+78h+var_74] cmp r12d, eax jl short loc_21F0 mov rax, [rsp+78h+var_60] mov r13, [rbx+20h] mov r15, [rbx+28h] mov rbp, [rsp+78h+var_68] mov r14, [rax+10h] test r14, r14 jz loc_2305 mov [rsp+78h+var_58], rbx mov rbx, r15 mov r15, r14 jmp short loc_2249 loc_2240: mov r15, [r15+18h] test r15, r15 jz short loc_229B loc_2249: mov r14, [r15+28h] mov rdi, [r15+20h]; s1 cmp rbx, r14 mov rdx, r14 cmovbe rdx, rbx; n test rdx, rdx jz short loc_226C mov rsi, r13; s2 call _memcmp test eax, eax jnz short loc_228B loc_226C: sub r14, rbx mov eax, 80000000h cmp r14, rax jge short loc_228F mov rax, 0FFFFFFFF7FFFFFFFh cmp r14, rax jle short loc_2240 mov eax, r14d loc_228B: test eax, eax js short loc_2240 loc_228F: mov rbp, r15 mov r15, [r15+10h] test r15, r15 jnz short loc_2249 loc_229B: mov r15, rbx mov rbx, [rsp+78h+var_58] cmp [rsp+78h+var_68], rbp jz short loc_2305 mov rcx, [rbp+28h] mov rsi, [rbp+20h]; s2 cmp r15, rcx mov rdx, rcx cmovbe rdx, r15; n test rdx, rdx jz short loc_22D7 mov rdi, r13; s1 mov [rsp+78h+var_58], rcx call _memcmp mov rcx, [rsp+78h+var_58] test eax, eax jnz short loc_22FD loc_22D7: mov r8, r15 mov eax, 80000000h sub r8, rcx cmp r8, rax jge loc_23B7 mov rax, 0FFFFFFFF7FFFFFFFh cmp r8, rax jle short loc_2305 mov eax, r8d loc_22FD: test eax, eax jns loc_23B7 loc_2305: mov edi, 48h ; 'H'; unsigned __int64 mov r14, rbp call __Znwm; operator new(ulong) mov rbp, rax lea rax, [rax+20h] mov r13, [rbx+28h] mov r15, rax lea rax, [rbp+30h] mov [rsp+78h+var_58], rax mov [rbp+20h], rax mov rax, [rbx+20h] mov [rsp+78h+var_48], r13 mov [rsp+78h+src], rax cmp r13, 0Fh ja loc_2438 cmp r13, 1 jz loc_23F0 test r13, r13 jnz loc_24DA loc_2358: mov rax, [rsp+78h+var_58] loc_235D: mov [rbp+28h], r13 mov rdi, [rsp+78h+var_60] mov rdx, r15 mov rsi, r14 mov byte ptr [rax+r13], 0 mov dword ptr [rbp+40h], 0 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, rax mov r8, rdx test rdx, rdx jz short loc_2400 cmp [rsp+78h+var_68], rdx jz short loc_2398 test rax, rax jz loc_2472 loc_2398: mov edi, 1 loc_239D: mov rcx, [rsp+78h+var_68] mov rdx, r8 mov rsi, rbp 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&) mov rax, [rsp+78h+var_60] add qword ptr [rax+28h], 1 loc_23B7: mov [rbp+40h], r12d jmp loc_21F0 loc_23C0: mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz loc_24E4 mov rax, [rsp+78h+var_60] add rsp, 48h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_23F0: movzx eax, byte ptr [rax] mov [rbp+30h], al jmp loc_2358 loc_2400: mov rdi, [rbp+20h]; void * cmp [rsp+78h+var_58], rdi jz short loc_2418 mov rax, [rbp+30h] lea rsi, [rax+1]; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_2418: mov rdi, rbp; void * mov esi, 48h ; 'H'; unsigned __int64 mov rbp, r13 call __ZdlPvm; operator delete(void *,ulong) mov [rbp+40h], r12d jmp loc_21F0 loc_2438: lea rsi, [rsp+78h+var_48] xor edx, edx mov rdi, r15 call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm; std::string::_M_create(ulong &,ulong) mov [rbp+20h], rax mov rdi, rax; dest mov rax, [rsp+78h+var_48] mov [rbp+30h], rax loc_2457: mov rsi, [rsp+78h+src]; src mov rdx, r13; n call _memcpy mov r13, [rsp+78h+var_48] mov rax, [rbp+20h] jmp loc_235D loc_2472: mov r13, [rbp+28h] mov rcx, [rdx+28h] cmp r13, rcx mov rdx, rcx cmovbe rdx, r13; n test rdx, rdx jz short loc_24B0 mov rsi, [r8+20h]; s2 mov rdi, [rbp+20h]; s1 mov [rsp+78h+src], rcx mov [rsp+78h+var_58], r8 call _memcmp mov r8, [rsp+78h+var_58] mov rcx, [rsp+78h+src] test eax, eax mov edi, eax jnz short loc_24D2 loc_24B0: sub r13, rcx xor edi, edi cmp r13, 7FFFFFFFh jg loc_239D cmp r13, 0FFFFFFFF80000000h jl loc_2398 mov edi, r13d loc_24D2: shr edi, 1Fh jmp loc_239D loc_24DA: mov rdi, [rsp+78h+var_58] jmp loc_2457 loc_24E4: call ___stack_chk_fail endbr64 mov rdi, rax jmp _Z5func0St3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiSt4lessIS5_ESaISt4pairIKS5_iEEEi_cold; func0(std::map<std::string,int>,int) [clone] endbr64 mov rbx, rax jmp loc_1353
long long func0(long long a1, long long a2, int a3) { long long v3; // rbx int v4; // r12d const void *v5; // r13 long long v6; // rbp size_t v7; // rbx long long v8; // r15 size_t v9; // r14 size_t v10; // rdx int v11; // eax long long v12; // r14 size_t v13; // r15 size_t v14; // rcx size_t v15; // rdx int v16; // eax long long v17; // r14 size_t v18; // r13 long long v19; // r15 _BYTE *v20; // rax long long v21; // rax long long insert_hint_unique_pos; // rax long long v23; // rdx long long v24; // r13 long long v25; // r8 long long v26; // rdi void *v28; // rdi long long v29; // rax void *v30; // rdi size_t v31; // r13 void *v32; // rcx size_t v33; // rdx int v34; // eax unsigned int v35; // edi long long v36; // r13 long long v38; // [rsp+10h] [rbp-68h] long long v40; // [rsp+20h] [rbp-58h] size_t v41; // [rsp+20h] [rbp-58h] long long v42; // [rsp+20h] [rbp-58h] void *src; // [rsp+28h] [rbp-50h] void *srca; // [rsp+28h] [rbp-50h] _QWORD v45[9]; // [rsp+30h] [rbp-48h] BYREF v45[1] = __readfsqword(0x28u); *(_QWORD *)(a1 + 24) = a1 + 8; v3 = *(_QWORD *)(a2 + 24); *(_DWORD *)(a1 + 8) = 0; *(_QWORD *)(a1 + 16) = 0LL; v38 = a1 + 8; *(_QWORD *)(a1 + 32) = a1 + 8; *(_QWORD *)(a1 + 40) = 0LL; if ( a2 + 8 == v3 ) return a1; while ( 2 ) { v4 = *(_DWORD *)(v3 + 64); if ( v4 < a3 ) goto LABEL_3; v5 = *(const void **)(v3 + 32); v6 = v38; if ( !*(_QWORD *)(a1 + 16) ) goto LABEL_26; v40 = v3; v7 = *(_QWORD *)(v3 + 40); v8 = *(_QWORD *)(a1 + 16); do { while ( 1 ) { v9 = *(_QWORD *)(v8 + 40); v10 = v9; if ( v7 <= v9 ) v10 = v7; if ( v10 ) { v11 = memcmp(*(const void **)(v8 + 32), v5, v10); if ( v11 ) break; } v12 = v9 - v7; if ( v12 >= 0x80000000LL ) goto LABEL_16; if ( v12 > (long long)0xFFFFFFFF7FFFFFFFLL ) { v11 = v12; break; } LABEL_7: v8 = *(_QWORD *)(v8 + 24); if ( !v8 ) goto LABEL_17; } if ( v11 < 0 ) goto LABEL_7; LABEL_16: v6 = v8; v8 = *(_QWORD *)(v8 + 16); } while ( v8 ); LABEL_17: v13 = v7; v3 = v40; if ( v38 == v6 ) goto LABEL_26; v14 = *(_QWORD *)(v6 + 40); v15 = v14; if ( v13 <= v14 ) v15 = v13; if ( v15 ) { v41 = *(_QWORD *)(v6 + 40); v16 = memcmp(v5, *(const void **)(v6 + 32), v15); v14 = v41; if ( v16 ) { LABEL_25: if ( v16 < 0 ) goto LABEL_26; goto LABEL_35; } } if ( (long long)(v13 - v14) >= 0x80000000LL ) goto LABEL_35; if ( (long long)(v13 - v14) > (long long)0xFFFFFFFF7FFFFFFFLL ) { v16 = v13 - v14; goto LABEL_25; } LABEL_26: v17 = v6; v6 = operator new(0x48uLL); v18 = *(_QWORD *)(v3 + 40); v19 = v6 + 32; *(_QWORD *)(v6 + 32) = v6 + 48; v20 = *(_BYTE **)(v3 + 32); v45[0] = v18; src = v20; if ( v18 > 0xF ) { v29 = std::string::_M_create(v19, v45, 0LL); *(_QWORD *)(v6 + 32) = v29; v30 = (void *)v29; *(_QWORD *)(v6 + 48) = v45[0]; goto LABEL_42; } if ( v18 == 1 ) { *(_BYTE *)(v6 + 48) = *v20; LABEL_29: v21 = v6 + 48; } else { if ( !v18 ) goto LABEL_29; v30 = (void *)(v6 + 48); LABEL_42: memcpy(v30, src, v18); v18 = v45[0]; v21 = *(_QWORD *)(v6 + 32); } *(_QWORD *)(v6 + 40) = v18; *(_BYTE *)(v21 + v18) = 0; *(_DWORD *)(v6 + 64) = 0; 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( a1, v17, v19); v24 = insert_hint_unique_pos; v25 = v23; if ( v23 ) { if ( v38 == v23 || insert_hint_unique_pos ) { LABEL_33: v26 = 1LL; goto LABEL_34; } v31 = *(_QWORD *)(v6 + 40); v33 = *(_QWORD *)(v23 + 40); v32 = (void *)v33; if ( v31 <= v33 ) v33 = *(_QWORD *)(v6 + 40); if ( v33 && (srca = v32, v42 = v25, v34 = memcmp(*(const void **)(v6 + 32), *(const void **)(v25 + 32), v33), v25 = v42, v32 = srca, (v35 = v34) != 0) ) { LABEL_50: v26 = v35 >> 31; } else { v36 = v31 - (_QWORD)v32; v26 = 0LL; if ( v36 <= 0x7FFFFFFF ) { if ( v36 < (long long)0xFFFFFFFF80000000LL ) goto LABEL_33; v35 = v36; goto LABEL_50; } } LABEL_34: std::_Rb_tree_insert_and_rebalance(v26, v6, v25, v38); ++*(_QWORD *)(a1 + 40); LABEL_35: *(_DWORD *)(v6 + 64) = v4; } else { v28 = *(void **)(v6 + 32); if ( (void *)(v6 + 48) != v28 ) operator delete(v28, *(_QWORD *)(v6 + 48) + 1LL); operator delete((void *)v6, 0x48uLL); *(_DWORD *)(v24 + 64) = v4; } LABEL_3: v3 = std::_Rb_tree_increment(v3); if ( a2 + 8 != v3 ) continue; return a1; } }
func0: ENDBR64 PUSH R15 LEA RCX,[RDI + 0x8] PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x48 MOV qword ptr [RSP + 0x18],RDI MOV dword ptr [RSP + 0x4],EDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x38],RAX XOR EAX,EAX MOV qword ptr [RDI + 0x18],RCX MOV RBX,qword ptr [RSI + 0x18] LEA RAX,[RSI + 0x8] MOV dword ptr [RDI + 0x8],0x0 MOV qword ptr [RDI + 0x10],0x0 MOV qword ptr [RSP + 0x10],RCX MOV qword ptr [RDI + 0x20],RCX MOV qword ptr [RDI + 0x28],0x0 MOV qword ptr [RSP + 0x8],RAX CMP RAX,RBX JNZ 0x00102206 JMP 0x001023c0 LAB_001021f0: MOV RDI,RBX CALL 0x00101220 MOV RBX,RAX CMP qword ptr [RSP + 0x8],RAX JZ 0x001023c0 LAB_00102206: MOV R12D,dword ptr [RBX + 0x40] MOV EAX,dword ptr [RSP + 0x4] CMP R12D,EAX JL 0x001021f0 MOV RAX,qword ptr [RSP + 0x18] MOV R13,qword ptr [RBX + 0x20] MOV R15,qword ptr [RBX + 0x28] MOV RBP,qword ptr [RSP + 0x10] MOV R14,qword ptr [RAX + 0x10] TEST R14,R14 JZ 0x00102305 MOV qword ptr [RSP + 0x20],RBX MOV RBX,R15 MOV R15,R14 JMP 0x00102249 LAB_00102240: MOV R15,qword ptr [R15 + 0x18] TEST R15,R15 JZ 0x0010229b LAB_00102249: MOV R14,qword ptr [R15 + 0x28] MOV RDI,qword ptr [R15 + 0x20] CMP RBX,R14 MOV RDX,R14 CMOVBE RDX,RBX TEST RDX,RDX JZ 0x0010226c MOV RSI,R13 CALL 0x001011f0 TEST EAX,EAX JNZ 0x0010228b LAB_0010226c: SUB R14,RBX MOV EAX,0x80000000 CMP R14,RAX JGE 0x0010228f MOV RAX,-0x80000001 CMP R14,RAX JLE 0x00102240 MOV EAX,R14D LAB_0010228b: TEST EAX,EAX JS 0x00102240 LAB_0010228f: MOV RBP,R15 MOV R15,qword ptr [R15 + 0x10] TEST R15,R15 JNZ 0x00102249 LAB_0010229b: MOV R15,RBX MOV RBX,qword ptr [RSP + 0x20] CMP qword ptr [RSP + 0x10],RBP JZ 0x00102305 MOV RCX,qword ptr [RBP + 0x28] MOV RSI,qword ptr [RBP + 0x20] CMP R15,RCX MOV RDX,RCX CMOVBE RDX,R15 TEST RDX,RDX JZ 0x001022d7 MOV RDI,R13 MOV qword ptr [RSP + 0x20],RCX CALL 0x001011f0 MOV RCX,qword ptr [RSP + 0x20] TEST EAX,EAX JNZ 0x001022fd LAB_001022d7: MOV R8,R15 MOV EAX,0x80000000 SUB R8,RCX CMP R8,RAX JGE 0x001023b7 MOV RAX,-0x80000001 CMP R8,RAX JLE 0x00102305 MOV EAX,R8D LAB_001022fd: TEST EAX,EAX JNS 0x001023b7 LAB_00102305: MOV EDI,0x48 MOV R14,RBP LAB_0010230d: CALL 0x00101250 MOV RBP,RAX LEA RAX,[RAX + 0x20] MOV R13,qword ptr [RBX + 0x28] MOV R15,RAX LEA RAX,[RBP + 0x30] MOV qword ptr [RSP + 0x20],RAX MOV qword ptr [RBP + 0x20],RAX MOV RAX,qword ptr [RBX + 0x20] MOV qword ptr [RSP + 0x30],R13 MOV qword ptr [RSP + 0x28],RAX CMP R13,0xf JA 0x00102438 CMP R13,0x1 JZ 0x001023f0 TEST R13,R13 JNZ 0x001024da LAB_00102358: MOV RAX,qword ptr [RSP + 0x20] LAB_0010235d: MOV qword ptr [RBP + 0x28],R13 MOV RDI,qword ptr [RSP + 0x18] MOV RDX,R15 MOV RSI,R14 MOV byte ptr [RAX + R13*0x1],0x0 MOV dword ptr [RBP + 0x40],0x0 CALL 0x00102ab0 MOV R13,RAX MOV R8,RDX TEST RDX,RDX JZ 0x00102400 CMP qword ptr [RSP + 0x10],RDX JZ 0x00102398 TEST RAX,RAX JZ 0x00102472 LAB_00102398: MOV EDI,0x1 LAB_0010239d: MOV RCX,qword ptr [RSP + 0x10] MOV RDX,R8 MOV RSI,RBP CALL 0x001011c0 MOV RAX,qword ptr [RSP + 0x18] ADD qword ptr [RAX + 0x28],0x1 LAB_001023b7: MOV dword ptr [RBP + 0x40],R12D JMP 0x001021f0 LAB_001023c0: MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x001024e4 MOV RAX,qword ptr [RSP + 0x18] ADD RSP,0x48 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001023f0: MOVZX EAX,byte ptr [RAX] MOV byte ptr [RBP + 0x30],AL JMP 0x00102358 LAB_00102400: MOV RDI,qword ptr [RBP + 0x20] CMP qword ptr [RSP + 0x20],RDI JZ 0x00102418 MOV RAX,qword ptr [RBP + 0x30] LEA RSI,[RAX + 0x1] CALL 0x00101260 LAB_00102418: MOV RDI,RBP MOV ESI,0x48 MOV RBP,R13 CALL 0x00101260 MOV dword ptr [RBP + 0x40],R12D JMP 0x001021f0 LAB_00102438: LEA RSI,[RSP + 0x30] XOR EDX,EDX MOV RDI,R15 LAB_00102442: CALL 0x00101310 MOV qword ptr [RBP + 0x20],RAX MOV RDI,RAX MOV RAX,qword ptr [RSP + 0x30] MOV qword ptr [RBP + 0x30],RAX LAB_00102457: MOV RSI,qword ptr [RSP + 0x28] MOV RDX,R13 CALL 0x00101240 MOV R13,qword ptr [RSP + 0x30] MOV RAX,qword ptr [RBP + 0x20] JMP 0x0010235d LAB_00102472: MOV R13,qword ptr [RBP + 0x28] MOV RCX,qword ptr [RDX + 0x28] CMP R13,RCX MOV RDX,RCX CMOVBE RDX,R13 TEST RDX,RDX JZ 0x001024b0 MOV RSI,qword ptr [R8 + 0x20] MOV RDI,qword ptr [RBP + 0x20] MOV qword ptr [RSP + 0x28],RCX MOV qword ptr [RSP + 0x20],R8 CALL 0x001011f0 MOV R8,qword ptr [RSP + 0x20] MOV RCX,qword ptr [RSP + 0x28] TEST EAX,EAX MOV EDI,EAX JNZ 0x001024d2 LAB_001024b0: SUB R13,RCX XOR EDI,EDI CMP R13,0x7fffffff JG 0x0010239d CMP R13,-0x80000000 JL 0x00102398 MOV EDI,R13D LAB_001024d2: SHR EDI,0x1f JMP 0x0010239d LAB_001024da: MOV RDI,qword ptr [RSP + 0x20] JMP 0x00102457 LAB_001024e4: CALL 0x00101280
/* func0(std::map<std::string, int, std::less<std::string >, std::allocator<std::pair<std::string const, int> > >, int) */ _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>>> * func0(map param_1,int param_2) { _Rb_tree_node_base *p_Var1; _Rb_tree_node_base *p_Var2; int iVar3; void *__s2; ulong uVar4; ulong uVar5; _Rb_tree_node_base *__src; int iVar6; _Rb_tree_node_base *p_Var7; _Rb_tree_node_base *p_Var8; _Rb_tree_node_base *p_Var9; int in_EDX; ulong uVar10; _Rb_tree_node_base *p_Var11; int4 in_register_00000034; bool bVar12; int4 in_register_0000003c; _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>>> *this; long lVar13; long in_FS_OFFSET; int auVar14 [16]; ulong local_48; long local_40; this = (_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>>> *)CONCAT44(in_register_0000003c,param_1); p_Var1 = (_Rb_tree_node_base *)(this + 8); local_40 = *(long *)(in_FS_OFFSET + 0x28); *(_Rb_tree_node_base **)(this + 0x18) = p_Var1; p_Var7 = *(_Rb_tree_node_base **)(CONCAT44(in_register_00000034,param_2) + 0x18); *(int4 *)(this + 8) = 0; *(int8 *)(this + 0x10) = 0; *(_Rb_tree_node_base **)(this + 0x20) = p_Var1; *(int8 *)(this + 0x28) = 0; do { if ((_Rb_tree_node_base *)(CONCAT44(in_register_00000034,param_2) + 8) == p_Var7) { if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return this; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); } iVar3 = *(int *)(p_Var7 + 0x40); if (in_EDX <= iVar3) { __s2 = *(void **)(p_Var7 + 0x20); uVar4 = *(ulong *)(p_Var7 + 0x28); p_Var8 = *(_Rb_tree_node_base **)(this + 0x10); p_Var11 = p_Var1; if (p_Var8 == (_Rb_tree_node_base *)0x0) { LAB_00102305: /* try { // try from 0010230d to 00102311 has its CatchHandler @ 001024f5 */ p_Var8 = (_Rb_tree_node_base *)operator_new(0x48); uVar4 = *(ulong *)(p_Var7 + 0x28); p_Var2 = p_Var8 + 0x30; *(_Rb_tree_node_base **)(p_Var8 + 0x20) = p_Var2; __src = *(_Rb_tree_node_base **)(p_Var7 + 0x20); local_48 = uVar4; if (uVar4 < 0x10) { p_Var9 = p_Var2; if (uVar4 == 1) { p_Var8[0x30] = *__src; } else if (uVar4 != 0) goto LAB_00102457; } else { /* try { // try from 00102442 to 00102446 has its CatchHandler @ 001024e9 */ p_Var9 = (_Rb_tree_node_base *) std::string::_M_create((ulong *)(p_Var8 + 0x20),(ulong)&local_48); *(_Rb_tree_node_base **)(p_Var8 + 0x20) = p_Var9; *(ulong *)(p_Var8 + 0x30) = local_48; LAB_00102457: memcpy(p_Var9,__src,uVar4); p_Var9 = *(_Rb_tree_node_base **)(p_Var8 + 0x20); } *(ulong *)(p_Var8 + 0x28) = local_48; p_Var9[local_48] = (_Rb_tree_node_base)0x0; *(int4 *)(p_Var8 + 0x40) = 0; 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 (this,(_Rb_tree_const_iterator)p_Var11,(string *)(p_Var8 + 0x20)); p_Var11 = auVar14._8_8_; if (p_Var11 == (_Rb_tree_node_base *)0x0) { if (p_Var2 != *(_Rb_tree_node_base **)(p_Var8 + 0x20)) { operator_delete(*(_Rb_tree_node_base **)(p_Var8 + 0x20),*(long *)(p_Var8 + 0x30) + 1); } operator_delete(p_Var8,0x48); *(int *)(auVar14._0_8_ + 0x40) = iVar3; goto LAB_001021f0; } if ((p_Var1 == p_Var11) || (auVar14._0_8_ != 0)) { LAB_00102398: bVar12 = true; } else { uVar4 = *(ulong *)(p_Var8 + 0x28); uVar5 = *(ulong *)(p_Var11 + 0x28); uVar10 = uVar5; if (uVar4 <= uVar5) { uVar10 = uVar4; } if ((uVar10 == 0) || (iVar6 = memcmp(*(void **)(p_Var8 + 0x20),*(void **)(p_Var11 + 0x20),uVar10), iVar6 == 0)) { lVar13 = uVar4 - uVar5; bVar12 = false; if (0x7fffffff < lVar13) goto LAB_0010239d; if (lVar13 < -0x80000000) goto LAB_00102398; iVar6 = (int)lVar13; } bVar12 = SUB41((uint)iVar6 >> 0x1f,0); } LAB_0010239d: std::_Rb_tree_insert_and_rebalance(bVar12,p_Var8,p_Var11,p_Var1); *(long *)(this + 0x28) = *(long *)(this + 0x28) + 1; } else { do { while( true ) { uVar5 = *(ulong *)(p_Var8 + 0x28); uVar10 = uVar5; if (uVar4 <= uVar5) { uVar10 = uVar4; } if ((uVar10 != 0) && (iVar6 = memcmp(*(void **)(p_Var8 + 0x20),__s2,uVar10), iVar6 != 0) ) break; lVar13 = uVar5 - uVar4; if (lVar13 < 0x80000000) { if (-0x80000001 < lVar13) { iVar6 = (int)lVar13; break; } goto LAB_00102240; } LAB_0010228f: p_Var2 = p_Var8 + 0x10; p_Var11 = p_Var8; p_Var8 = *(_Rb_tree_node_base **)p_Var2; if (*(_Rb_tree_node_base **)p_Var2 == (_Rb_tree_node_base *)0x0) goto LAB_0010229b; } if (-1 < iVar6) goto LAB_0010228f; LAB_00102240: p_Var8 = *(_Rb_tree_node_base **)(p_Var8 + 0x18); } while (p_Var8 != (_Rb_tree_node_base *)0x0); LAB_0010229b: if (p_Var1 == p_Var11) goto LAB_00102305; uVar5 = *(ulong *)(p_Var11 + 0x28); uVar10 = uVar5; if (uVar4 <= uVar5) { uVar10 = uVar4; } p_Var8 = p_Var11; if ((uVar10 == 0) || (iVar6 = memcmp(__s2,*(void **)(p_Var11 + 0x20),uVar10), iVar6 == 0)) { lVar13 = uVar4 - uVar5; if (lVar13 < 0x80000000) { if (lVar13 < -0x80000000) goto LAB_00102305; iVar6 = (int)lVar13; goto LAB_001022fd; } } else { LAB_001022fd: if (iVar6 < 0) goto LAB_00102305; } } *(int *)(p_Var8 + 0x40) = iVar3; } LAB_001021f0: p_Var7 = (_Rb_tree_node_base *)std::_Rb_tree_increment(p_Var7); } while( true ); }
1,108
func0
#include <vector> #include <variant> #include <cassert>
int func0(const std::vector<std::variant<int, std::vector<int>>>& test_tup) { int count = 0; for (const auto& ele : test_tup) { if (std::holds_alternative<std::vector<int>>(ele)) { break; } count++; } return count; }
int main() { // Test case 1: (1, 5, 7, (4, 6), 10) std::vector<std::variant<int, std::vector<int>>> test1 = {1, 5, 7, std::vector<int>{4, 6}, 10}; assert(func0(test1) == 3); // Test case 2: (2, 9, (5, 7), 11) std::vector<std::variant<int, std::vector<int>>> test2 = {2, 9, std::vector<int>{5, 7}, 11}; assert(func0(test2) == 2); // Test case 3: (11, 15, 5, 8, (2, 3), 8) std::vector<std::variant<int, std::vector<int>>> test3 = {11, 15, 5, 8, std::vector<int>{2, 3}, 8}; assert(func0(test3) == 4); return 0; }
O0
cpp
func0(std::vector<std::variant<int, std::vector<int, std::allocator<int> > >, std::allocator<std::variant<int, 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,-0x2c(%rbp) mov -0x38(%rbp),%rax mov %rax,-0x18(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 1b10 <_ZNKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE5beginEv> mov %rax,-0x28(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 1b68 <_ZNKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE3endEv> mov %rax,-0x20(%rbp) lea -0x20(%rbp),%rdx lea -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1bc0 <_ZN9__gnu_cxxneIPKSt7variantIJiSt6vectorIiSaIiEEEES2_IS5_SaIS5_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_> test %al,%al je 1321 <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x98> lea -0x28(%rbp),%rax mov %rax,%rdi callq 1c24 <_ZNK9__gnu_cxx17__normal_iteratorIPKSt7variantIJiSt6vectorIiSaIiEEEES2_IS5_SaIS5_EEEdeEv> mov %rax,-0x10(%rbp) mov -0x10(%rbp),%rax mov %rax,%rdi callq 1c68 <_ZSt17holds_alternativeISt6vectorIiSaIiEEJiS2_EEbRKSt7variantIJDpT0_EE> test %al,%al jne 1320 <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x97> addl $0x1,-0x2c(%rbp) lea -0x28(%rbp),%rax mov %rax,%rdi callq 1c00 <_ZN9__gnu_cxx17__normal_iteratorIPKSt7variantIJiSt6vectorIiSaIiEEEES2_IS5_SaIS5_EEEppEv> jmp 12d7 <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x4e> mov -0x2c(%rbp),%eax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 1338 <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0xaf> callq 1150 <__stack_chk_fail@plt> leaveq retq
_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE: 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_2C], 0 mov rax, [rbp+var_38] mov [rbp+var_18], rax mov rax, [rbp+var_18] mov rdi, rax call _ZNKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE5beginEv; std::vector<std::variant<int,std::vector<int>>>::begin(void) mov [rbp+var_28], rax mov rax, [rbp+var_18] mov rdi, rax call _ZNKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE3endEv; std::vector<std::variant<int,std::vector<int>>>::end(void) mov [rbp+var_20], rax jmp short loc_1329 loc_12F9: lea rax, [rbp+var_28] mov rdi, rax call _ZNK9__gnu_cxx17__normal_iteratorIPKSt7variantIJiSt6vectorIiSaIiEEEES2_IS5_SaIS5_EEEdeEv; __gnu_cxx::__normal_iterator<std::variant<int,std::vector<int>> const*,std::vector<std::variant<int,std::vector<int>>>>::operator*(void) mov [rbp+var_10], rax mov rax, [rbp+var_10] mov rdi, rax call _ZSt17holds_alternativeISt6vectorIiSaIiEEJiS2_EEbRKSt7variantIJDpT0_EE; std::holds_alternative<std::vector<int>,int,std::vector<int>>(std::variant<int,std::vector<int>> const&) test al, al jnz short loc_1342 add [rbp+var_2C], 1 lea rax, [rbp+var_28] mov rdi, rax call _ZN9__gnu_cxx17__normal_iteratorIPKSt7variantIJiSt6vectorIiSaIiEEEES2_IS5_SaIS5_EEEppEv; __gnu_cxx::__normal_iterator<std::variant<int,std::vector<int>> const*,std::vector<std::variant<int,std::vector<int>>>>::operator++(void) loc_1329: lea rdx, [rbp+var_20] lea rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call _ZN9__gnu_cxxneIPKSt7variantIJiSt6vectorIiSaIiEEEES2_IS5_SaIS5_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_; __gnu_cxx::operator!=<std::variant<int,std::vector<int>> const*,std::vector<std::variant<int,std::vector<int>>>>(__gnu_cxx::__normal_iterator<std::variant<int,std::vector<int>> const*,std::vector<std::variant<int,std::vector<int>>>> const&,__gnu_cxx::__normal_iterator<std::variant<int,std::vector<int>> const*,std::vector<std::variant<int,std::vector<int>>>> const&) test al, al jnz short loc_12F9 jmp short loc_1343 loc_1342: nop loc_1343: mov eax, [rbp+var_2C] mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_135A call ___stack_chk_fail locret_135A: leave retn
long long func0(long long a1) { unsigned int v2; // [rsp+14h] [rbp-2Ch] long long v3; // [rsp+18h] [rbp-28h] BYREF _QWORD v4[2]; // [rsp+20h] [rbp-20h] BYREF long long v5; // [rsp+30h] [rbp-10h] unsigned long long v6; // [rsp+38h] [rbp-8h] v6 = __readfsqword(0x28u); v2 = 0; v4[1] = a1; v3 = std::vector<std::variant<int,std::vector<int>>>::begin(a1); v4[0] = std::vector<std::variant<int,std::vector<int>>>::end(a1); while ( (unsigned __int8)__gnu_cxx::operator!=<std::variant<int,std::vector<int>> const*,std::vector<std::variant<int,std::vector<int>>>>( &v3, v4) ) { v5 = __gnu_cxx::__normal_iterator<std::variant<int,std::vector<int>> const*,std::vector<std::variant<int,std::vector<int>>>>::operator*(&v3); if ( (unsigned __int8)std::holds_alternative<std::vector<int>,int,std::vector<int>>(v5) ) break; ++v2; __gnu_cxx::__normal_iterator<std::variant<int,std::vector<int>> const*,std::vector<std::variant<int,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 + -0x2c],0x0 MOV RAX,qword ptr [RBP + -0x38] MOV qword ptr [RBP + -0x18],RAX MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101d36 MOV qword ptr [RBP + -0x28],RAX MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101d82 MOV qword ptr [RBP + -0x20],RAX JMP 0x00101329 LAB_001012f9: LEA RAX,[RBP + -0x28] MOV RDI,RAX CALL 0x00101e36 MOV qword ptr [RBP + -0x10],RAX MOV RAX,qword ptr [RBP + -0x10] MOV RDI,RAX CALL 0x00101e4b TEST AL,AL JNZ 0x00101342 ADD dword ptr [RBP + -0x2c],0x1 LEA RAX,[RBP + -0x28] MOV RDI,RAX CALL 0x00101e12 LAB_00101329: LEA RDX,[RBP + -0x20] LEA RAX,[RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x00101dd2 TEST AL,AL JNZ 0x001012f9 JMP 0x00101343 LAB_00101342: NOP LAB_00101343: MOV EAX,dword ptr [RBP + -0x2c] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x0010135a CALL 0x00101170 LAB_0010135a: LEAVE RET
/* func0(std::vector<std::variant<int, std::vector<int, std::allocator<int> > >, std::allocator<std::variant<int, std::vector<int, std::allocator<int> > > > > const&) */ int func0(vector *param_1) { bool bVar1; long in_FS_OFFSET; int local_34; int8 local_30; int8 local_28; vector<std::variant<int,std::vector<int,std::allocator<int>>>,std::allocator<std::variant<int,std::vector<int,std::allocator<int>>>>> *local_20; variant *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_34 = 0; local_20 = (vector<std::variant<int,std::vector<int,std::allocator<int>>>,std::allocator<std::variant<int,std::vector<int,std::allocator<int>>>>> *)param_1; local_30 = std:: vector<std::variant<int,std::vector<int,std::allocator<int>>>,std::allocator<std::variant<int,std::vector<int,std::allocator<int>>>>> ::begin((vector<std::variant<int,std::vector<int,std::allocator<int>>>,std::allocator<std::variant<int,std::vector<int,std::allocator<int>>>>> *)param_1); local_28 = std:: vector<std::variant<int,std::vector<int,std::allocator<int>>>,std::allocator<std::variant<int,std::vector<int,std::allocator<int>>>>> ::end(local_20); while (bVar1 = operator!=((__normal_iterator *)&local_30,(__normal_iterator *)&local_28), bVar1) { local_18 = (variant *) __normal_iterator<std::variant<int,std::vector<int,std::allocator<int>>>const*,std::vector<std::variant<int,std::vector<int,std::allocator<int>>>,std::allocator<std::variant<int,std::vector<int,std::allocator<int>>>>>> ::operator*((__normal_iterator<std::variant<int,std::vector<int,std::allocator<int>>>const*,std::vector<std::variant<int,std::vector<int,std::allocator<int>>>,std::allocator<std::variant<int,std::vector<int,std::allocator<int>>>>>> *)&local_30); bVar1 = std:: holds_alternative<std::vector<int,std::allocator<int>>,int,std::vector<int,std::allocator<int>>> (local_18); if (bVar1) break; local_34 = local_34 + 1; __normal_iterator<std::variant<int,std::vector<int,std::allocator<int>>>const*,std::vector<std::variant<int,std::vector<int,std::allocator<int>>>,std::allocator<std::variant<int,std::vector<int,std::allocator<int>>>>>> ::operator++((__normal_iterator<std::variant<int,std::vector<int,std::allocator<int>>>const*,std::vector<std::variant<int,std::vector<int,std::allocator<int>>>,std::allocator<std::variant<int,std::vector<int,std::allocator<int>>>>>> *)&local_30); } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_34; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,109
func0
#include <vector> #include <variant> #include <cassert>
int func0(const std::vector<std::variant<int, std::vector<int>>>& test_tup) { int count = 0; for (const auto& ele : test_tup) { if (std::holds_alternative<std::vector<int>>(ele)) { break; } count++; } return count; }
int main() { // Test case 1: (1, 5, 7, (4, 6), 10) std::vector<std::variant<int, std::vector<int>>> test1 = {1, 5, 7, std::vector<int>{4, 6}, 10}; assert(func0(test1) == 3); // Test case 2: (2, 9, (5, 7), 11) std::vector<std::variant<int, std::vector<int>>> test2 = {2, 9, std::vector<int>{5, 7}, 11}; assert(func0(test2) == 2); // Test case 3: (11, 15, 5, 8, (2, 3), 8) std::vector<std::variant<int, std::vector<int>>> test3 = {11, 15, 5, 8, std::vector<int>{2, 3}, 8}; assert(func0(test3) == 4); return 0; }
O1
cpp
func0(std::vector<std::variant<int, std::vector<int, std::allocator<int> > >, std::allocator<std::variant<int, std::vector<int, std::allocator<int> > > > > const&): endbr64 mov (%rdi),%rax mov 0x8(%rdi),%rcx cmp %rcx,%rax je 12d3 <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x2a> mov $0x0,%edx cmpb $0x1,0x18(%rax) je 12d0 <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x27> add $0x1,%edx add $0x20,%rax cmp %rax,%rcx jne 12be <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x15> mov %edx,%eax retq mov $0x0,%edx jmp 12d0 <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x27>
_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE: endbr64 mov rax, [rdi] mov rcx, [rdi+8] cmp rcx, rax jz short loc_12D3 mov edx, 0 loc_12BE: cmp byte ptr [rax+18h], 1 jz short loc_12D0 add edx, 1 add rax, 20h ; ' ' cmp rcx, rax jnz short loc_12BE loc_12D0: mov eax, edx retn loc_12D3: mov edx, 0 jmp short loc_12D0
long long func0(long long *a1) { long long v1; // rax long long v2; // rcx unsigned int v3; // edx v1 = *a1; v2 = a1[1]; if ( v2 == *a1 ) { return 0; } else { v3 = 0; do { if ( *(_BYTE *)(v1 + 24) == 1 ) break; ++v3; v1 += 32LL; } while ( v2 != v1 ); } return v3; }
func0: ENDBR64 MOV RAX,qword ptr [RDI] MOV RCX,qword ptr [RDI + 0x8] CMP RCX,RAX JZ 0x001012d3 MOV EDX,0x0 LAB_001012be: CMP byte ptr [RAX + 0x18],0x1 JZ 0x001012d0 ADD EDX,0x1 ADD RAX,0x20 CMP RCX,RAX JNZ 0x001012be LAB_001012d0: MOV EAX,EDX RET LAB_001012d3: MOV EDX,0x0 JMP 0x001012d0
/* func0(std::vector<std::variant<int, std::vector<int, std::allocator<int> > >, std::allocator<std::variant<int, std::vector<int, std::allocator<int> > > > > const&) */ int func0(vector *param_1) { long lVar1; int iVar2; lVar1 = *(long *)param_1; if (*(long *)(param_1 + 8) == lVar1) { iVar2 = 0; } else { iVar2 = 0; do { if (*(char *)(lVar1 + 0x18) == '\x01') { return iVar2; } iVar2 = iVar2 + 1; lVar1 = lVar1 + 0x20; } while (*(long *)(param_1 + 8) != lVar1); } return iVar2; }
1,110
func0
#include <vector> #include <variant> #include <cassert>
int func0(const std::vector<std::variant<int, std::vector<int>>>& test_tup) { int count = 0; for (const auto& ele : test_tup) { if (std::holds_alternative<std::vector<int>>(ele)) { break; } count++; } return count; }
int main() { // Test case 1: (1, 5, 7, (4, 6), 10) std::vector<std::variant<int, std::vector<int>>> test1 = {1, 5, 7, std::vector<int>{4, 6}, 10}; assert(func0(test1) == 3); // Test case 2: (2, 9, (5, 7), 11) std::vector<std::variant<int, std::vector<int>>> test2 = {2, 9, std::vector<int>{5, 7}, 11}; assert(func0(test2) == 2); // Test case 3: (11, 15, 5, 8, (2, 3), 8) std::vector<std::variant<int, std::vector<int>>> test3 = {11, 15, 5, 8, std::vector<int>{2, 3}, 8}; assert(func0(test3) == 4); return 0; }
O2
cpp
func0(std::vector<std::variant<int, std::vector<int, std::allocator<int> > >, std::allocator<std::variant<int, std::vector<int, std::allocator<int> > > > > const&): endbr64 mov (%rdi),%rax mov 0x8(%rdi),%rdx xor %r8d,%r8d cmp %rdx,%rax je 18cb <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x2b> nopl 0x0(%rax,%rax,1) cmpb $0x1,0x18(%rax) je 18cb <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x2b> add $0x20,%rax add $0x1,%r8d cmp %rax,%rdx jne 18b8 <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x18> mov %r8d,%eax retq
_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE: endbr64 mov rax, [rdi] mov rcx, [rdi+8] xor edx, edx cmp rcx, rax jnz short loc_1A04 jmp short loc_1A0A loc_19F8: add rax, 20h ; ' ' add edx, 1 cmp rcx, rax jz short loc_1A0A loc_1A04: cmp byte ptr [rax+18h], 1 jnz short loc_19F8 loc_1A0A: mov eax, edx retn
long long func0(long long *a1) { long long v1; // rax long long v2; // rcx unsigned int v3; // edx v1 = *a1; v2 = a1[1]; v3 = 0; if ( v2 != *a1 ) { do { if ( *(_BYTE *)(v1 + 24) == 1 ) break; v1 += 32LL; ++v3; } while ( v2 != v1 ); } return v3; }
func0: ENDBR64 MOV RAX,qword ptr [RDI] MOV RCX,qword ptr [RDI + 0x8] XOR EDX,EDX CMP RCX,RAX JNZ 0x00101a04 JMP 0x00101a0a LAB_001019f8: ADD RAX,0x20 ADD EDX,0x1 CMP RCX,RAX JZ 0x00101a0a LAB_00101a04: CMP byte ptr [RAX + 0x18],0x1 JNZ 0x001019f8 LAB_00101a0a: MOV EAX,EDX RET
/* func0(std::vector<std::variant<int, std::vector<int, std::allocator<int> > >, std::allocator<std::variant<int, std::vector<int, std::allocator<int> > > > > const&) */ int func0(vector *param_1) { long lVar1; int iVar2; iVar2 = 0; for (lVar1 = *(long *)param_1; (*(long *)(param_1 + 8) != lVar1 && (*(char *)(lVar1 + 0x18) != '\x01')); lVar1 = lVar1 + 0x20 ) { iVar2 = iVar2 + 1; } return iVar2; }
1,111
func0
#include <vector> #include <variant> #include <cassert>
int func0(const std::vector<std::variant<int, std::vector<int>>>& test_tup) { int count = 0; for (const auto& ele : test_tup) { if (std::holds_alternative<std::vector<int>>(ele)) { break; } count++; } return count; }
int main() { // Test case 1: (1, 5, 7, (4, 6), 10) std::vector<std::variant<int, std::vector<int>>> test1 = {1, 5, 7, std::vector<int>{4, 6}, 10}; assert(func0(test1) == 3); // Test case 2: (2, 9, (5, 7), 11) std::vector<std::variant<int, std::vector<int>>> test2 = {2, 9, std::vector<int>{5, 7}, 11}; assert(func0(test2) == 2); // Test case 3: (11, 15, 5, 8, (2, 3), 8) std::vector<std::variant<int, std::vector<int>>> test3 = {11, 15, 5, 8, std::vector<int>{2, 3}, 8}; assert(func0(test3) == 4); return 0; }
O3
cpp
func0(std::vector<std::variant<int, std::vector<int, std::allocator<int> > >, std::allocator<std::variant<int, std::vector<int, std::allocator<int> > > > > const&): endbr64 mov (%rdi),%rax mov 0x8(%rdi),%rdx xor %r8d,%r8d cmp %rdx,%rax je 18cb <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x2b> nopl 0x0(%rax,%rax,1) cmpb $0x1,0x18(%rax) je 18cb <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x2b> add $0x20,%rax add $0x1,%r8d cmp %rax,%rdx jne 18b8 <_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE+0x18> mov %r8d,%eax retq
_Z5func0RKSt6vectorISt7variantIJiS_IiSaIiEEEESaIS3_EE: endbr64 mov rax, [rdi] mov rcx, [rdi+8] xor edx, edx cmp rcx, rax jnz short loc_1BF4 jmp short loc_1BFA loc_1BE8: add rax, 20h ; ' ' add edx, 1 cmp rcx, rax jz short loc_1BFA loc_1BF4: cmp byte ptr [rax+18h], 1 jnz short loc_1BE8 loc_1BFA: mov eax, edx retn
long long func0(long long *a1) { long long v1; // rax long long v2; // rcx unsigned int v3; // edx v1 = *a1; v2 = a1[1]; v3 = 0; if ( v2 != *a1 ) { do { if ( *(_BYTE *)(v1 + 24) == 1 ) break; v1 += 32LL; ++v3; } while ( v2 != v1 ); } return v3; }
func0: ENDBR64 MOV RAX,qword ptr [RDI] MOV RCX,qword ptr [RDI + 0x8] XOR EDX,EDX CMP RCX,RAX JNZ 0x00101bf4 JMP 0x00101bfa LAB_00101be8: ADD RAX,0x20 ADD EDX,0x1 CMP RCX,RAX JZ 0x00101bfa LAB_00101bf4: CMP byte ptr [RAX + 0x18],0x1 JNZ 0x00101be8 LAB_00101bfa: MOV EAX,EDX RET
/* func0(std::vector<std::variant<int, std::vector<int, std::allocator<int> > >, std::allocator<std::variant<int, std::vector<int, std::allocator<int> > > > > const&) */ int func0(vector *param_1) { long lVar1; int iVar2; iVar2 = 0; for (lVar1 = *(long *)param_1; (*(long *)(param_1 + 8) != lVar1 && (*(char *)(lVar1 + 0x18) != '\x01')); lVar1 = lVar1 + 0x20 ) { iVar2 = iVar2 + 1; } return iVar2; }
1,112
func0
#include <assert.h>
int func0(int n) { return 4 * n * n - 3 * n; }
int main() { assert(func0(3) == 27); assert(func0(7) == 175); assert(func0(10) == 370); return 0; }
O0
cpp
func0(int): endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov -0x4(%rbp),%eax imul %eax,%eax lea 0x0(,%rax,4),%edx mov -0x4(%rbp),%eax mov %eax,%ecx shl $0x2,%eax sub %eax,%ecx mov %ecx,%eax add %edx,%eax pop %rbp retq
_Z5func0i: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov eax, [rbp+var_4] imul eax, eax lea ecx, ds:0[rax*4] mov eax, [rbp+var_4] mov edx, eax shl eax, 2 sub edx, eax lea eax, [rcx+rdx] pop rbp retn
long long func0(int a1) { return (unsigned int)(4 * a1 * a1 - 3 * a1); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV EAX,dword ptr [RBP + -0x4] IMUL EAX,EAX LEA ECX,[RAX*0x4] MOV EAX,dword ptr [RBP + -0x4] MOV EDX,EAX SHL EAX,0x2 SUB EDX,EAX LEA EAX,[RCX + RDX*0x1] POP RBP RET
/* func0(int) */ int func0(int param_1) { return param_1 * param_1 * 4 + param_1 * -3; }
1,113
func0
#include <assert.h>
int func0(int n) { return 4 * n * n - 3 * n; }
int main() { assert(func0(3) == 27); assert(func0(7) == 175); assert(func0(10) == 370); return 0; }
O1
cpp
func0(int): endbr64 mov %edi,%eax imul %edi,%eax lea 0x0(,%rdi,4),%edx sub %edx,%edi lea (%rdi,%rax,4),%eax retq
_Z5func0i: endbr64 mov eax, edi imul eax, edi lea edx, ds:0[rdi*4] sub edi, edx lea eax, [rdi+rax*4] retn
long long func0(int a1) { return (unsigned int)(-3 * a1 + 4 * a1 * a1); }
func0: ENDBR64 MOV EAX,EDI IMUL EAX,EDI LEA EDX,[RDI*0x4] SUB EDI,EDX LEA EAX,[RDI + RAX*0x4] RET
/* func0(int) */ int func0(int param_1) { return param_1 * -3 + param_1 * param_1 * 4; }
1,114
func0
#include <assert.h>
int func0(int n) { return 4 * n * n - 3 * n; }
int main() { assert(func0(3) == 27); assert(func0(7) == 175); assert(func0(10) == 370); return 0; }
O2
cpp
func0(int): endbr64 mov %edi,%eax lea 0x0(,%rdi,4),%edx imul %edi,%eax sub %edx,%edi lea (%rdi,%rax,4),%eax retq nopw %cs:0x0(%rax,%rax,1)
_Z5func0i: endbr64 mov eax, edi lea edx, ds:0[rdi*4] imul eax, edi sub edi, edx lea eax, [rdi+rax*4] retn
long long func0(int a1) { return (unsigned int)(-3 * a1 + 4 * a1 * a1); }
func0: ENDBR64 MOV EAX,EDI LEA EDX,[RDI*0x4] IMUL EAX,EDI SUB EDI,EDX LEA EAX,[RDI + RAX*0x4] RET
/* func0(int) */ int func0(int param_1) { return param_1 * -3 + param_1 * param_1 * 4; }
1,115
func0
#include <assert.h>
int func0(int n) { return 4 * n * n - 3 * n; }
int main() { assert(func0(3) == 27); assert(func0(7) == 175); assert(func0(10) == 370); return 0; }
O3
cpp
func0(int): endbr64 mov %edi,%eax lea 0x0(,%rdi,4),%edx imul %edi,%eax sub %edx,%edi lea (%rdi,%rax,4),%eax retq nopw %cs:0x0(%rax,%rax,1)
_Z5func0i: endbr64 mov eax, edi lea edx, ds:0[rdi*4] imul eax, edi sub edi, edx lea eax, [rdi+rax*4] retn
long long func0(int a1) { return (unsigned int)(-3 * a1 + 4 * a1 * a1); }
func0: ENDBR64 MOV EAX,EDI LEA EDX,[RDI*0x4] IMUL EAX,EDI SUB EDI,EDX LEA EAX,[RDI + RAX*0x4] RET
/* func0(int) */ int func0(int param_1) { return param_1 * -3 + param_1 * param_1 * 4; }
1,116
func0
#include <vector> #include <assert.h>
std::pair<bool, int> func0(const std::vector<int>& dlist, int item) { int pos = 0; bool found = false; while (pos < dlist.size() && !found) { if (dlist[pos] == item) { found = true; } else { pos++; } } return {found, pos}; }
int main() { assert(func0({11, 23, 58, 31, 56, 77, 43, 12, 65, 19}, 31) == std::make_pair(true, 3)); assert(func0({12, 32, 45, 62, 35, 47, 44, 61}, 61) == std::make_pair(true, 7)); assert(func0({9, 10, 17, 19, 22, 39, 48, 56}, 48) == std::make_pair(true, 6)); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> > const&, int): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x38,%rsp mov %rdi,-0x38(%rbp) mov %esi,-0x3c(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax movl $0x0,-0x24(%rbp) movb $0x0,-0x25(%rbp) mov -0x24(%rbp),%eax movslq %eax,%rbx mov -0x38(%rbp),%rax mov %rax,%rdi callq 172e <_ZNKSt6vectorIiSaIiEE4sizeEv> cmp %rax,%rbx jae 1280 <_Z5func0RKSt6vectorIiSaIiEEi+0x57> movzbl -0x25(%rbp),%eax xor $0x1,%eax test %al,%al je 1280 <_Z5func0RKSt6vectorIiSaIiEEi+0x57> mov $0x1,%eax jmp 1285 <_Z5func0RKSt6vectorIiSaIiEEi+0x5c> mov $0x0,%eax test %al,%al je 12bb <_Z5func0RKSt6vectorIiSaIiEEi+0x92> mov -0x24(%rbp),%eax movslq %eax,%rdx mov -0x38(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1756 <_ZNKSt6vectorIiSaIiEEixEm> mov (%rax),%eax cmp %eax,-0x3c(%rbp) sete %al test %al,%al je 12b0 <_Z5func0RKSt6vectorIiSaIiEEi+0x87> movb $0x1,-0x25(%rbp) jmp 1257 <_Z5func0RKSt6vectorIiSaIiEEi+0x2e> mov -0x24(%rbp),%eax add $0x1,%eax mov %eax,-0x24(%rbp) jmp 1257 <_Z5func0RKSt6vectorIiSaIiEEi+0x2e> lea -0x24(%rbp),%rdx lea -0x25(%rbp),%rcx lea -0x20(%rbp),%rax mov %rcx,%rsi mov %rax,%rdi callq 177a <_ZNSt4pairIbiEC1IRbRiLb1EEEOT_OT0_> mov -0x20(%rbp),%rax mov -0x18(%rbp),%rcx xor %fs:0x28,%rcx je 12ea <_Z5func0RKSt6vectorIiSaIiEEi+0xc1> callq 1110 <__stack_chk_fail@plt> add $0x38,%rsp pop %rbx pop %rbp retq
_Z5func0RKSt6vectorIiSaIiEEi: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 38h mov [rbp+var_38], rdi mov [rbp+var_3C], esi mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax mov [rbp+var_24], 0 mov [rbp+var_25], 0 jmp short loc_12A9 loc_1279: mov eax, [rbp+var_24] movsxd rdx, eax mov rax, [rbp+var_38] mov rsi, rdx mov rdi, rax call _ZNKSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] cmp [rbp+var_3C], eax setz al test al, al jz short loc_12A0 mov [rbp+var_25], 1 jmp short loc_12A9 loc_12A0: mov eax, [rbp+var_24] add eax, 1 mov [rbp+var_24], eax loc_12A9: mov eax, [rbp+var_24] movsxd rbx, eax mov rax, [rbp+var_38] mov rdi, rax call _ZNKSt6vectorIiSaIiEE4sizeEv; std::vector<int>::size(void) cmp rbx, rax jnb short loc_12D2 movzx eax, [rbp+var_25] xor eax, 1 test al, al jz short loc_12D2 mov eax, 1 jmp short loc_12D7 loc_12D2: mov eax, 0 loc_12D7: test al, al jnz short loc_1279 lea rdx, [rbp+var_24] lea rcx, [rbp+var_25] lea rax, [rbp+var_20] mov rsi, rcx mov rdi, rax call _ZNSt4pairIbiEC2IRbRiLb1EEEOT_OT0_; std::pair<bool,int>::pair<bool &,int &,true>(bool &,int &) mov rax, [rbp+var_20] mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_130A call ___stack_chk_fail loc_130A: mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, int a2) { char v4; // [rsp+1Bh] [rbp-25h] BYREF int v5; // [rsp+1Ch] [rbp-24h] BYREF _QWORD v6[3]; // [rsp+20h] [rbp-20h] BYREF v6[1] = __readfsqword(0x28u); v5 = 0; v4 = 0; while ( v5 < (unsigned long long)std::vector<int>::size(a1) && v4 != 1 ) { if ( a2 == *(_DWORD *)std::vector<int>::operator[](a1, v5) ) v4 = 1; else ++v5; } std::pair<bool,int>::pair<bool &,int &,true>(v6, &v4, &v5); return v6[0]; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x38 MOV qword ptr [RBP + -0x38],RDI MOV dword ptr [RBP + -0x3c],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV dword ptr [RBP + -0x24],0x0 MOV byte ptr [RBP + -0x25],0x0 JMP 0x001012a9 LAB_00101279: MOV EAX,dword ptr [RBP + -0x24] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x38] MOV RSI,RDX MOV RDI,RAX CALL 0x001017ca MOV EAX,dword ptr [RAX] CMP dword ptr [RBP + -0x3c],EAX SETZ AL TEST AL,AL JZ 0x001012a0 MOV byte ptr [RBP + -0x25],0x1 JMP 0x001012a9 LAB_001012a0: MOV EAX,dword ptr [RBP + -0x24] ADD EAX,0x1 MOV dword ptr [RBP + -0x24],EAX LAB_001012a9: MOV EAX,dword ptr [RBP + -0x24] MOVSXD RBX,EAX MOV RAX,qword ptr [RBP + -0x38] MOV RDI,RAX CALL 0x001017a2 CMP RBX,RAX JNC 0x001012d2 MOVZX EAX,byte ptr [RBP + -0x25] XOR EAX,0x1 TEST AL,AL JZ 0x001012d2 MOV EAX,0x1 JMP 0x001012d7 LAB_001012d2: MOV EAX,0x0 LAB_001012d7: TEST AL,AL JNZ 0x00101279 LEA RDX,[RBP + -0x24] LEA RCX,[RBP + -0x25] LEA RAX,[RBP + -0x20] MOV RSI,RCX MOV RDI,RAX CALL 0x001017ee MOV RAX,qword ptr [RBP + -0x20] MOV RDX,qword ptr [RBP + -0x18] SUB RDX,qword ptr FS:[0x28] JZ 0x0010130a CALL 0x00101130 LAB_0010130a: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::vector<int, std::allocator<int> > const&, int) */ int8 func0(vector *param_1,int param_2) { bool bVar1; int *piVar2; ulong uVar3; ulong uVar4; long in_FS_OFFSET; bool local_2d; int local_2c; int8 local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_2c = 0; local_2d = false; while( true ) { uVar4 = (ulong)local_2c; uVar3 = std::vector<int,std::allocator<int>>::size((vector<int,std::allocator<int>> *)param_1); if ((uVar4 < uVar3) && (local_2d != true)) { bVar1 = true; } else { bVar1 = false; } if (!bVar1) break; piVar2 = (int *)std::vector<int,std::allocator<int>>::operator[] ((vector<int,std::allocator<int>> *)param_1,(long)local_2c); if (param_2 == *piVar2) { local_2d = true; } else { local_2c = local_2c + 1; } } std::pair<bool,int>::pair<bool&,int&,true>((pair<bool,int> *)&local_28,&local_2d,&local_2c); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_28; }
1,117
func0
#include <vector> #include <assert.h>
std::pair<bool, int> func0(const std::vector<int>& dlist, int item) { int pos = 0; bool found = false; while (pos < dlist.size() && !found) { if (dlist[pos] == item) { found = true; } else { pos++; } } return {found, pos}; }
int main() { assert(func0({11, 23, 58, 31, 56, 77, 43, 12, 65, 19}, 31) == std::make_pair(true, 3)); assert(func0({12, 32, 45, 62, 35, 47, 44, 61}, 61) == std::make_pair(true, 7)); assert(func0({9, 10, 17, 19, 22, 39, 48, 56}, 48) == std::make_pair(true, 6)); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> > const&, int): endbr64 push %rbx mov (%rdi),%r11 mov 0x8(%rdi),%r9 sub %r11,%r9 sar $0x2,%r9 mov $0x0,%edx mov $0x0,%ebx mov $0x1,%r10d mov %edx,%eax cmp %rdx,%r9 setbe %dil lea (%r11,%rdx,4),%r8 mov %ebx,%ecx test %dil,%dil jne 1252 <_Z5func0RKSt6vectorIiSaIiEEi+0x49> test %cl,%cl jne 1252 <_Z5func0RKSt6vectorIiSaIiEEi+0x49> mov %r10d,%ecx cmp %esi,(%r8) je 123b <_Z5func0RKSt6vectorIiSaIiEEi+0x32> add $0x1,%rdx jmp 122c <_Z5func0RKSt6vectorIiSaIiEEi+0x23> shl $0x20,%rax and $0x1,%ecx or %rcx,%rax pop %rbx retq
_Z5func0RKSt6vectorIiSaIiEEi: endbr64 mov r8, [rdi] mov rdi, [rdi+8] sub rdi, r8 sar rdi, 2 mov edx, 0 mov r10d, 0 mov r9d, 1 jmp short loc_1232 loc_122E: add rdx, 1 loc_1232: cmp rdx, rdi setnb cl mov eax, r10d loc_123B: test cl, cl jnz short loc_124E test al, al jnz short loc_124E mov eax, r9d cmp [r8+rdx*4], esi jnz short loc_122E jmp short loc_123B loc_124E: shl rdx, 20h and eax, 1 or rax, rdx retn
unsigned long long func0(long long *a1, int a2) { long long v2; // r8 unsigned long long v3; // rdi unsigned long long v4; // rdx char v5; // al v2 = *a1; v3 = (a1[1] - *a1) >> 2; v4 = 0LL; LABEL_3: v5 = 0; while ( v4 < v3 && !v5 ) { v5 = 1; if ( *(_DWORD *)(v2 + 4 * v4) != a2 ) { ++v4; goto LABEL_3; } } return (v4 << 32) | v5 & 1; }
func0: ENDBR64 MOV R8,qword ptr [RDI] MOV RDI,qword ptr [RDI + 0x8] SUB RDI,R8 SAR RDI,0x2 MOV EDX,0x0 MOV R10D,0x0 MOV R9D,0x1 JMP 0x00101232 LAB_0010122e: ADD RDX,0x1 LAB_00101232: CMP RDX,RDI SETNC CL MOV EAX,R10D LAB_0010123b: TEST CL,CL JNZ 0x0010124e TEST AL,AL JNZ 0x0010124e MOV EAX,R9D CMP dword ptr [R8 + RDX*0x4],ESI JNZ 0x0010122e JMP 0x0010123b LAB_0010124e: SHL RDX,0x20 AND EAX,0x1 OR RAX,RDX RET
/* func0(std::vector<int, std::allocator<int> > const&, int) */ ulong func0(vector *param_1,int param_2) { bool bVar1; ulong uVar2; uVar2 = 0; do { bVar1 = false; do { if (((ulong)(*(long *)(param_1 + 8) - *(long *)param_1 >> 2) <= uVar2) || (bVar1)) { return (ulong)bVar1 | uVar2 << 0x20; } bVar1 = true; } while (*(int *)(*(long *)param_1 + uVar2 * 4) == param_2); uVar2 = uVar2 + 1; } while( true ); }
1,118
func0
#include <vector> #include <assert.h>
std::pair<bool, int> func0(const std::vector<int>& dlist, int item) { int pos = 0; bool found = false; while (pos < dlist.size() && !found) { if (dlist[pos] == item) { found = true; } else { pos++; } } return {found, pos}; }
int main() { assert(func0({11, 23, 58, 31, 56, 77, 43, 12, 65, 19}, 31) == std::make_pair(true, 3)); assert(func0({12, 32, 45, 62, 35, 47, 44, 61}, 61) == std::make_pair(true, 7)); assert(func0({9, 10, 17, 19, 22, 39, 48, 56}, 48) == std::make_pair(true, 6)); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> > const&, int): endbr64 mov (%rdi),%rcx mov 0x8(%rdi),%rdi sub %rcx,%rdi sar $0x2,%rdi je 14a0 <_Z5func0RKSt6vectorIiSaIiEEi+0x50> xor %edx,%edx nopw %cs:0x0(%rax,%rax,1) mov %edx,%eax cmp %esi,(%rcx,%rdx,4) je 1490 <_Z5func0RKSt6vectorIiSaIiEEi+0x40> lea 0x1(%rdx),%eax add $0x1,%rdx cmp %rdi,%rdx jne 1470 <_Z5func0RKSt6vectorIiSaIiEEi+0x20> xor %edx,%edx shl $0x20,%rax and $0x1,%edx or %rdx,%rax retq mov $0x1,%edx shl $0x20,%rax and $0x1,%edx or %rdx,%rax retq xor %edx,%edx xor %eax,%eax jmp 1495 <_Z5func0RKSt6vectorIiSaIiEEi+0x45> nopw %cs:0x0(%rax,%rax,1)
_Z5func0RKSt6vectorIiSaIiEEi: endbr64 mov rax, [rdi] mov rcx, [rdi+8] xor edx, edx sub rcx, rax sar rcx, 2 cmp rdx, rcx jz short loc_13EA loc_13D9: lea rdi, [rdx+1] cmp esi, [rax+rdx*4] jz short loc_13F0 mov rdx, rdi cmp rdx, rcx jnz short loc_13D9 loc_13EA: xor eax, eax jmp short loc_13F5 loc_13F0: mov eax, 1 loc_13F5: shl rdx, 20h or rax, rdx retn
long long func0(long long *a1, int a2) { long long v2; // rax long long v3; // rdx long long v4; // rcx long long v5; // rdi long long v6; // rax v2 = *a1; v3 = 0LL; v4 = (a1[1] - *a1) >> 2; if ( v4 ) { while ( 1 ) { v5 = v3 + 1; if ( a2 == *(_DWORD *)(v2 + 4 * v3) ) break; ++v3; if ( v5 == v4 ) goto LABEL_4; } v6 = 1LL; } else { LABEL_4: v6 = 0LL; } return (v3 << 32) | v6; }
func0: ENDBR64 MOV RAX,qword ptr [RDI] MOV RCX,qword ptr [RDI + 0x8] XOR EDX,EDX SUB RCX,RAX SAR RCX,0x2 CMP RDX,RCX JZ 0x001013ea LAB_001013d9: LEA RDI,[RDX + 0x1] CMP ESI,dword ptr [RAX + RDX*0x4] JZ 0x001013f0 MOV RDX,RDI CMP RDX,RCX JNZ 0x001013d9 LAB_001013ea: XOR EAX,EAX JMP 0x001013f5 LAB_001013f0: MOV EAX,0x1 LAB_001013f5: SHL RDX,0x20 OR RAX,RDX RET
/* func0(std::vector<int, std::allocator<int> > const&, int) */ ulong func0(vector *param_1,int param_2) { ulong uVar1; long lVar2; long lVar3; long lVar4; lVar3 = 0; lVar2 = *(long *)(param_1 + 8) - *(long *)param_1 >> 2; lVar4 = lVar3; if (lVar2 != 0) { do { lVar3 = lVar4 + 1; if (param_2 == *(int *)(*(long *)param_1 + lVar4 * 4)) { uVar1 = 1; goto LAB_001013f5; } lVar4 = lVar3; } while (lVar3 != lVar2); } uVar1 = 0; lVar4 = lVar3; LAB_001013f5: return uVar1 | lVar4 << 0x20; }
1,119
func0
#include <vector> #include <assert.h>
std::pair<bool, int> func0(const std::vector<int>& dlist, int item) { int pos = 0; bool found = false; while (pos < dlist.size() && !found) { if (dlist[pos] == item) { found = true; } else { pos++; } } return {found, pos}; }
int main() { assert(func0({11, 23, 58, 31, 56, 77, 43, 12, 65, 19}, 31) == std::make_pair(true, 3)); assert(func0({12, 32, 45, 62, 35, 47, 44, 61}, 61) == std::make_pair(true, 7)); assert(func0({9, 10, 17, 19, 22, 39, 48, 56}, 48) == std::make_pair(true, 6)); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> > const&, int): endbr64 mov (%rdi),%rcx mov 0x8(%rdi),%rdi sub %rcx,%rdi sar $0x2,%rdi je 1440 <_Z5func0RKSt6vectorIiSaIiEEi+0x50> xor %edx,%edx nopw %cs:0x0(%rax,%rax,1) mov %edx,%eax cmp %esi,(%rcx,%rdx,4) je 1430 <_Z5func0RKSt6vectorIiSaIiEEi+0x40> lea 0x1(%rdx),%eax add $0x1,%rdx cmp %rdi,%rdx jne 1410 <_Z5func0RKSt6vectorIiSaIiEEi+0x20> xor %edx,%edx shl $0x20,%rax and $0x1,%edx or %rdx,%rax retq mov $0x1,%edx shl $0x20,%rax and $0x1,%edx or %rdx,%rax retq xor %edx,%edx xor %eax,%eax jmp 1435 <_Z5func0RKSt6vectorIiSaIiEEi+0x45> nopw %cs:0x0(%rax,%rax,1)
_Z5func0RKSt6vectorIiSaIiEEi: endbr64 mov rcx, [rdi] mov rax, [rdi+8] xor edx, edx sub rax, rcx sar rax, 2 cmp rdx, rax jz short loc_141A loc_1409: lea rdi, [rdx+1] cmp [rcx+rdx*4], esi jz short loc_1420 mov rdx, rdi cmp rdx, rax jnz short loc_1409 loc_141A: xor eax, eax jmp short loc_1425 loc_1420: mov eax, 1 loc_1425: shl rdx, 20h and eax, 1 or rax, rdx retn
long long func0(long long *a1, int a2) { long long v2; // rcx long long v3; // rdx long long v4; // rax long long v5; // rdi char v6; // al v2 = *a1; v3 = 0LL; v4 = (a1[1] - *a1) >> 2; if ( v4 ) { while ( 1 ) { v5 = v3 + 1; if ( *(_DWORD *)(v2 + 4 * v3) == a2 ) break; ++v3; if ( v5 == v4 ) goto LABEL_4; } v6 = 1; } else { LABEL_4: v6 = 0; } return (v3 << 32) | v6 & 1; }
func0: ENDBR64 MOV RCX,qword ptr [RDI] MOV RAX,qword ptr [RDI + 0x8] XOR EDX,EDX SUB RAX,RCX SAR RAX,0x2 CMP RDX,RAX JZ 0x0010141a LAB_00101409: LEA RDI,[RDX + 0x1] CMP dword ptr [RCX + RDX*0x4],ESI JZ 0x00101420 MOV RDX,RDI CMP RDX,RAX JNZ 0x00101409 LAB_0010141a: XOR EAX,EAX JMP 0x00101425 LAB_00101420: MOV EAX,0x1 LAB_00101425: SHL RDX,0x20 AND EAX,0x1 OR RAX,RDX RET
/* func0(std::vector<int, std::allocator<int> > const&, int) */ ulong func0(vector *param_1,int param_2) { uint uVar1; long lVar2; long lVar3; long lVar4; lVar3 = 0; lVar2 = *(long *)(param_1 + 8) - *(long *)param_1 >> 2; lVar4 = lVar3; if (lVar2 != 0) { do { lVar3 = lVar4 + 1; if (*(int *)(*(long *)param_1 + lVar4 * 4) == param_2) { uVar1 = 1; goto LAB_00101425; } lVar4 = lVar3; } while (lVar3 != lVar2); } uVar1 = 0; lVar4 = lVar3; LAB_00101425: return (ulong)uVar1 | lVar4 << 0x20; }
1,120
func0
#include <iostream> #include <vector> #include <set> #include <assert.h>
bool func0(std::vector<int> test_list) { std::set<int> unique_elements(test_list.begin(), test_list.end()); if (test_list.size() > unique_elements.size()) { return false; } return true; }
int main() { assert(func0({1, 2, 3}) == true); assert(func0({1, 2, 1, 2}) == false); assert(func0({1, 2, 3, 4, 5}) == true); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> >): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x58,%rsp mov %rdi,-0x58(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax mov -0x58(%rbp),%rax mov %rax,%rdi callq 17b2 <_ZNSt6vectorIiSaIiEE3endEv> mov %rax,%rbx mov -0x58(%rbp),%rax mov %rax,%rdi callq 1766 <_ZNSt6vectorIiSaIiEE5beginEv> mov %rax,%rcx lea -0x50(%rbp),%rax mov %rbx,%rdx mov %rcx,%rsi mov %rax,%rdi callq 1842 <_ZNSt3setIiSt4lessIiESaIiEEC1IN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiS2_EEEEET_SB_> mov -0x58(%rbp),%rax mov %rax,%rdi callq 1916 <_ZNKSt6vectorIiSaIiEE4sizeEv> mov %rax,%rbx lea -0x50(%rbp),%rax mov %rax,%rdi callq 193e <_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv> cmp %rax,%rbx seta %al test %al,%al je 1345 <_Z5func0St6vectorIiSaIiEE+0x7c> mov $0x0,%ebx jmp 134a <_Z5func0St6vectorIiSaIiEE+0x81> mov $0x1,%ebx lea -0x50(%rbp),%rax mov %rax,%rdi callq 1746 <_ZNSt3setIiSt4lessIiESaIiEED1Ev> mov %ebx,%eax mov -0x18(%rbp),%rdx xor %fs:0x28,%rdx je 136c <_Z5func0St6vectorIiSaIiEE+0xa3> callq 11a0 <__stack_chk_fail@plt> add $0x58,%rsp pop %rbx pop %rbp retq
_Z5func0St6vectorIiSaIiEE: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 58h mov [rbp+var_58], rdi mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax mov rax, [rbp+var_58] mov rdi, rax call _ZNSt6vectorIiSaIiEE3endEv; std::vector<int>::end(void) mov rbx, rax mov rax, [rbp+var_58] mov rdi, rax call _ZNSt6vectorIiSaIiEE5beginEv; std::vector<int>::begin(void) mov rcx, rax lea rax, [rbp+var_50] mov rdx, rbx mov rsi, rcx mov rdi, rax call _ZNSt3setIiSt4lessIiESaIiEEC2IN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiS2_EEEEET_SB_; std::set<int>::set<__gnu_cxx::__normal_iterator<int *,std::vector<int>>>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,__gnu_cxx::__normal_iterator<int *,std::vector<int>>) mov rax, [rbp+var_58] mov rdi, rax call _ZNKSt6vectorIiSaIiEE4sizeEv; std::vector<int>::size(void) mov rbx, rax lea rax, [rbp+var_50] mov rdi, rax call _ZNKSt3setIiSt4lessIiESaIiEE4sizeEv; std::set<int>::size(void) cmp rax, rbx setb al test al, al jz short loc_1325 mov ebx, 0 jmp short loc_132A loc_1325: mov ebx, 1 loc_132A: lea rax, [rbp+var_50] mov rdi, rax call _ZNSt3setIiSt4lessIiESaIiEED2Ev; std::set<int>::~set() mov eax, ebx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_134C call ___stack_chk_fail loc_134C: mov rbx, [rbp+var_8] leave retn
long long func0(long long a1) { long long v1; // rbx long long v2; // rax unsigned long long v3; // rbx _BYTE v5[56]; // [rsp+10h] [rbp-50h] BYREF unsigned long long v6; // [rsp+48h] [rbp-18h] v6 = __readfsqword(0x28u); v1 = std::vector<int>::end(a1); v2 = std::vector<int>::begin(a1); std::set<int>::set<__gnu_cxx::__normal_iterator<int *,std::vector<int>>>(v5, v2, v1); v3 = std::vector<int>::size(a1); LODWORD(v3) = std::set<int>::size(v5) >= v3; std::set<int>::~set(v5); return (unsigned int)v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x58 MOV qword ptr [RBP + -0x58],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV RAX,qword ptr [RBP + -0x58] MOV RDI,RAX CALL 0x00101788 MOV RBX,RAX MOV RAX,qword ptr [RBP + -0x58] MOV RDI,RAX CALL 0x0010173c MOV RCX,RAX LEA RAX,[RBP + -0x50] MOV RDX,RBX MOV RSI,RCX MOV RDI,RAX CALL 0x00101820 MOV RAX,qword ptr [RBP + -0x58] MOV RDI,RAX CALL 0x001018d4 MOV RBX,RAX LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001018fc CMP RAX,RBX SETC AL TEST AL,AL JZ 0x00101325 MOV EBX,0x0 JMP 0x0010132a LAB_00101325: MOV EBX,0x1 LAB_0010132a: LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x0010171c MOV EAX,EBX MOV RDX,qword ptr [RBP + -0x18] SUB RDX,qword ptr FS:[0x28] JZ 0x0010134c CALL 0x00101190 LAB_0010134c: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::vector<int, std::allocator<int> >) */ bool func0(vector param_1) { __normal_iterator _Var1; __normal_iterator _Var2; ulong uVar3; ulong uVar4; int4 in_register_0000003c; vector<int,std::allocator<int>> *this; long in_FS_OFFSET; set<int,std::less<int>,std::allocator<int>> local_58 [56]; long local_20; this = (vector<int,std::allocator<int>> *)CONCAT44(in_register_0000003c,param_1); local_20 = *(long *)(in_FS_OFFSET + 0x28); _Var1 = std::vector<int,std::allocator<int>>::end(this); _Var2 = std::vector<int,std::allocator<int>>::begin(this); std::set<int,std::less<int>,std::allocator<int>>:: set<__normal_iterator<int*,std::vector<int,std::allocator<int>>>>(local_58,_Var2,_Var1); uVar3 = std::vector<int,std::allocator<int>>::size(this); uVar4 = std::set<int,std::less<int>,std::allocator<int>>::size(local_58); std::set<int,std::less<int>,std::allocator<int>>::~set(local_58); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return uVar3 <= uVar4; }
1,121
func0
#include <iostream> #include <vector> #include <set> #include <assert.h>
bool func0(std::vector<int> test_list) { std::set<int> unique_elements(test_list.begin(), test_list.end()); if (test_list.size() > unique_elements.size()) { return false; } return true; }
int main() { assert(func0({1, 2, 3}) == true); assert(func0({1, 2, 1, 2}) == false); assert(func0({1, 2, 3, 4, 5}) == true); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> >): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x58,%rsp mov %rdi,%r12 mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax mov 0x8(%rdi),%r14 mov (%rdi),%rbx movl $0x0,0x18(%rsp) movq $0x0,0x20(%rsp) lea 0x18(%rsp),%rax mov %rax,0x28(%rsp) mov %rax,0x30(%rsp) movq $0x0,0x38(%rsp) cmp %rbx,%r14 je 1388 <_Z5func0St6vectorIiSaIiEE+0xdf> lea 0x10(%rsp),%rax mov %rax,0x8(%rsp) jmp 1347 <_Z5func0St6vectorIiSaIiEE+0x9e> mov 0x20(%rdx),%eax cmp %eax,(%rbx) setl %bpl jmp 137c <_Z5func0St6vectorIiSaIiEE+0xd3> mov %rax,%rsi mov (%r15),%eax mov %eax,0x20(%rsi) lea 0x18(%rsp),%rcx movzbl %bpl,%edi mov %r13,%rdx callq 1100 <_ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_@plt> addq $0x1,0x38(%rsp) add $0x4,%rbx cmp %rbx,%r14 je 1388 <_Z5func0St6vectorIiSaIiEE+0xdf> mov %rbx,%r15 lea 0x18(%rsp),%rsi mov %rbx,%rdx mov 0x8(%rsp),%rdi callq 1798 <_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIiERKi> mov %rdx,%r13 test %rdx,%rdx je 133e <_Z5func0St6vectorIiSaIiEE+0x95> test %rax,%rax setne %bpl lea 0x18(%rsp),%rax cmp %rax,%rdx sete %dil or %dil,%bpl je 1313 <_Z5func0St6vectorIiSaIiEE+0x6a> mov $0x28,%edi callq 1170 <_Znwm@plt> jmp 131e <_Z5func0St6vectorIiSaIiEE+0x75> mov 0x8(%r12),%rax sub (%r12),%rax sar $0x2,%rax cmp %rax,0x38(%rsp) setae %bl lea 0x10(%rsp),%rdi mov 0x20(%rsp),%rsi callq 16d4 <_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE8_M_eraseEPSt13_Rb_tree_nodeIiE> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 13eb <_Z5func0St6vectorIiSaIiEE+0x142> mov %ebx,%eax add $0x58,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq endbr64 mov %rax,%rbx lea 0x10(%rsp),%rdi mov 0x20(%rsp),%rsi callq 16d4 <_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE8_M_eraseEPSt13_Rb_tree_nodeIiE> mov %rbx,%rdi callq 11b0 <_Unwind_Resume@plt> callq 1190 <__stack_chk_fail@plt>
_Z5func0St6vectorIiSaIiEE: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 58h mov [rsp+88h+var_80], rdi mov rax, fs:28h mov [rsp+88h+var_40], rax xor eax, eax mov r14, [rdi+8] mov rbx, [rdi] mov [rsp+88h+var_70], 0 mov [rsp+88h+var_68], 0 lea rax, [rsp+88h+var_70] mov [rsp+88h+var_60], rax mov [rsp+88h+var_58], rax mov [rsp+88h+var_50], 0 cmp r14, rbx jz short loc_133F lea r15, [rsp+88h+var_78] jmp short loc_1301 loc_12CC: mov eax, [rdx+20h] cmp [rbx], eax setl r12b jmp short loc_1333 loc_12D7: mov rsi, rax mov eax, [r13+0] mov [rsi+20h], eax lea rcx, [rsp+88h+var_70] movzx edi, r12b mov rdx, rbp 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+88h+var_50], 1 loc_12F8: add rbx, 4 cmp r14, rbx jz short loc_133F loc_1301: mov r13, rbx lea rsi, [rsp+88h+var_70] mov rdx, rbx mov rdi, r15 call _ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIiERKi; std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<int>,int const&) mov rbp, rdx test rdx, rdx jz short loc_12F8 test rax, rax setnz r12b lea rax, [rsp+88h+var_70] cmp rdx, rax setz al or r12b, al jz short loc_12CC loc_1333: mov edi, 28h ; '('; unsigned __int64 call __Znwm; operator new(ulong) jmp short loc_12D7 loc_133F: mov rcx, [rsp+88h+var_80] mov rax, [rcx+8] sub rax, [rcx] sar rax, 2 cmp [rsp+88h+var_50], rax setnb bl lea rdi, [rsp+88h+var_78] mov rsi, [rsp+88h+var_68] call _ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE8_M_eraseEPSt13_Rb_tree_nodeIiE; std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_erase(std::_Rb_tree_node<int> *) mov rax, [rsp+88h+var_40] sub rax, fs:28h jnz short loc_13BA mov eax, ebx add rsp, 58h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn endbr64 mov rbx, rax lea rdi, [rsp+arg_8] mov rsi, [rsp+arg_18] call _ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE8_M_eraseEPSt13_Rb_tree_nodeIiE; std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_erase(std::_Rb_tree_node<int> *) mov rax, [rsp+arg_40] sub rax, fs:28h jz short loc_13B2 call ___stack_chk_fail loc_13B2: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume loc_13BA: call ___stack_chk_fail
long long func0(long long a1) { _DWORD *v1; // r14 _DWORD *v2; // rbx long long insert_hint_unique_pos; // rax int *v4; // rdx int *v5; // rbp bool v6; // r12 long long v7; // rax _BYTE v9[8]; // [rsp+10h] [rbp-78h] BYREF int v10; // [rsp+18h] [rbp-70h] BYREF long long v11; // [rsp+20h] [rbp-68h] int *v12; // [rsp+28h] [rbp-60h] int *v13; // [rsp+30h] [rbp-58h] unsigned long long i; // [rsp+38h] [rbp-50h] unsigned long long v15; // [rsp+48h] [rbp-40h] v15 = __readfsqword(0x28u); v1 = *(_DWORD **)(a1 + 8); v2 = *(_DWORD **)a1; v10 = 0; v11 = 0LL; v12 = &v10; v13 = &v10; for ( i = 0LL; v1 != v2; ++v2 ) { insert_hint_unique_pos = std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_get_insert_hint_unique_pos( v9, &v10, v2); v5 = v4; if ( v4 ) { v6 = v4 == &v10 || insert_hint_unique_pos != 0; if ( !v6 ) v6 = *v2 < v4[8]; v7 = operator new(0x28uLL); *(_DWORD *)(v7 + 32) = *v2; std::_Rb_tree_insert_and_rebalance(v6, v7, v5, &v10); ++i; } } LOBYTE(v2) = i >= (long long)(*(_QWORD *)(a1 + 8) - *(_QWORD *)a1) >> 2; std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_erase(v9, v11); return (unsigned int)v2; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x58 MOV qword ptr [RSP + 0x8],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV R14,qword ptr [RDI + 0x8] MOV RBX,qword ptr [RDI] MOV dword ptr [RSP + 0x18],0x0 MOV qword ptr [RSP + 0x20],0x0 LEA RAX,[RSP + 0x18] MOV qword ptr [RSP + 0x28],RAX MOV qword ptr [RSP + 0x30],RAX MOV qword ptr [RSP + 0x38],0x0 CMP R14,RBX JZ 0x0010133f LEA R15,[RSP + 0x10] JMP 0x00101301 LAB_001012cc: MOV EAX,dword ptr [RDX + 0x20] CMP dword ptr [RBX],EAX SETL R12B JMP 0x00101333 LAB_001012d7: MOV RSI,RAX MOV EAX,dword ptr [R13] MOV dword ptr [RSI + 0x20],EAX LEA RCX,[RSP + 0x18] MOVZX EDI,R12B MOV RDX,RBP CALL 0x001010e0 ADD qword ptr [RSP + 0x38],0x1 LAB_001012f8: ADD RBX,0x4 CMP R14,RBX JZ 0x0010133f LAB_00101301: MOV R13,RBX LEA RSI,[RSP + 0x18] MOV RDX,RBX MOV RDI,R15 CALL 0x0010179e MOV RBP,RDX TEST RDX,RDX JZ 0x001012f8 TEST RAX,RAX SETNZ R12B LEA RAX,[RSP + 0x18] CMP RDX,RAX SETZ AL OR R12B,AL JZ 0x001012cc LAB_00101333: MOV EDI,0x28 LAB_00101338: CALL 0x00101130 JMP 0x001012d7 LAB_0010133f: MOV RCX,qword ptr [RSP + 0x8] MOV RAX,qword ptr [RCX + 0x8] SUB RAX,qword ptr [RCX] SAR RAX,0x2 CMP qword ptr [RSP + 0x38],RAX SETNC BL LEA RDI,[RSP + 0x10] MOV RSI,qword ptr [RSP + 0x20] CALL 0x001016ce MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x001013ba MOV EAX,EBX ADD RSP,0x58 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001013ba: CALL 0x00101160
/* func0(std::vector<int, std::allocator<int> >) */ ulong func0(vector param_1) { int *piVar1; _Rb_tree_node_base *p_Var2; _Rb_tree_node_base *p_Var3; int *piVar4; int4 in_register_0000003c; long *plVar5; bool bVar6; long in_FS_OFFSET; bool bVar7; int auVar8 [16]; _Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>> local_78 [8]; int4 local_70 [2]; _Rb_tree_node *local_68; int4 *local_60; int4 *local_58; ulong local_50; long local_40; plVar5 = (long *)CONCAT44(in_register_0000003c,param_1); local_40 = *(long *)(in_FS_OFFSET + 0x28); piVar1 = (int *)plVar5[1]; piVar4 = (int *)*plVar5; local_70[0] = 0; local_68 = (_Rb_tree_node *)0x0; local_60 = local_70; local_50 = 0; local_58 = local_60; if (piVar1 != piVar4) { do { auVar8 = std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>:: _M_get_insert_hint_unique_pos(local_78,(_Rb_tree_const_iterator)local_70,piVar4); p_Var3 = auVar8._8_8_; if (p_Var3 != (_Rb_tree_node_base *)0x0) { bVar7 = auVar8._0_8_ != 0; bVar6 = bVar7 || p_Var3 == (_Rb_tree_node_base *)local_70; if (!bVar7 && p_Var3 != (_Rb_tree_node_base *)local_70) { bVar6 = *piVar4 < *(int *)(p_Var3 + 0x20); } /* try { // try from 00101338 to 0010133c has its CatchHandler @ 00101387 */ p_Var2 = (_Rb_tree_node_base *)operator_new(0x28); *(int *)(p_Var2 + 0x20) = *piVar4; std::_Rb_tree_insert_and_rebalance(bVar6,p_Var2,p_Var3,(_Rb_tree_node_base *)local_70); local_50 = local_50 + 1; } piVar4 = piVar4 + 1; } while (piVar1 != piVar4); } bVar6 = (ulong)(plVar5[1] - *plVar5 >> 2) <= local_50; std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_erase (local_78,local_68); if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return CONCAT71((int7)((ulong)piVar4 >> 8),bVar6) & 0xffffffff; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,122
func0
#include <iostream> #include <vector> #include <set> #include <assert.h>
bool func0(std::vector<int> test_list) { std::set<int> unique_elements(test_list.begin(), test_list.end()); if (test_list.size() > unique_elements.size()) { return false; } return true; }
int main() { assert(func0({1, 2, 3}) == true); assert(func0({1, 2, 1, 2}) == false); assert(func0({1, 2, 3, 4, 5}) == true); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> >): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x58,%rsp mov 0x8(%rdi),%r15 mov (%rdi),%rbx mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax lea 0x18(%rsp),%r13 movl $0x0,0x18(%rsp) movq $0x0,0x20(%rsp) mov %r13,0x28(%rsp) mov %r13,0x30(%rsp) movq $0x0,0x38(%rsp) cmp %rbx,%r15 je 1608 <_Z5func0St6vectorIiSaIiEE+0x128> mov %rdi,%rbp lea 0x10(%rsp),%r14 jmp 1579 <_Z5func0St6vectorIiSaIiEE+0x99> nopl (%rax) mov $0x28,%edi callq 1170 <_Znwm@plt> mov %rax,%rsi mov (%rbx),%eax movzbl 0xf(%rsp),%edi mov %r13,%rcx mov %r12,%rdx mov %eax,0x20(%rsi) callq 1100 <_ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_@plt> addq $0x1,0x38(%rsp) add $0x4,%rbx cmp %rbx,%r15 je 15b8 <_Z5func0St6vectorIiSaIiEE+0xd8> mov %rbx,%rdx mov %r13,%rsi mov %r14,%rdi callq 17d0 <_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIiERKi> mov %rdx,%r12 test %rdx,%rdx je 1570 <_Z5func0St6vectorIiSaIiEE+0x90> test %rax,%rax setne %al cmp %r13,%rdx sete %dil or %dil,%al mov %al,0xf(%rsp) jne 1548 <_Z5func0St6vectorIiSaIiEE+0x68> mov 0x20(%rdx),%eax cmp %eax,(%rbx) setl 0xf(%rsp) jmp 1548 <_Z5func0St6vectorIiSaIiEE+0x68> nopl 0x0(%rax) mov 0x0(%rbp),%rbx mov 0x8(%rbp),%rax mov 0x38(%rsp),%rdx mov 0x20(%rsp),%rsi sub %rbx,%rax mov %r14,%rdi sar $0x2,%rax cmp %rdx,%rax setbe %r12b callq 16f0 <_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE8_M_eraseEPSt13_Rb_tree_nodeIiE> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 1616 <_Z5func0St6vectorIiSaIiEE+0x136> add $0x58,%rsp mov %r12d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopw 0x0(%rax,%rax,1) mov %rbx,%rax xor %esi,%esi lea 0x10(%rsp),%r14 xor %edx,%edx jmp 15ca <_Z5func0St6vectorIiSaIiEE+0xea> callq 1190 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 11c0 <_Z5func0St6vectorIiSaIiEE.cold> nopw 0x0(%rax,%rax,1)
_Z5func0St6vectorIiSaIiEE: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 58h mov r14, [rdi+8] mov rbp, [rdi] mov [rsp+88h+var_80], rdi lea r13, [rsp+88h+var_70] mov rax, fs:28h mov [rsp+88h+var_40], rax xor eax, eax mov [rsp+88h+var_70], 0 mov [rsp+88h+var_68], 0 mov [rsp+88h+var_60], r13 mov [rsp+88h+var_58], r13 mov [rsp+88h+var_50], 0 cmp r14, rbp jz loc_1800 lea rax, [rsp+88h+var_78] xor r12d, r12d mov [rsp+88h+var_88], rax nop dword ptr [rax+00h] loc_16F0: mov r15d, [rbp+0] test r12, r12 jz short loc_1710 mov rbx, [rsp+88h+var_58] cmp r15d, [rbx+20h] jg loc_17F0 nop dword ptr [rax+rax+00000000h] loc_1710: mov rdi, [rsp+88h+var_88] mov esi, r15d call _ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE24_M_get_insert_unique_posERKi_isra_0; std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_get_insert_unique_pos(int const&) [clone] mov rbx, rdx test rdx, rdx jz short loc_176A test rax, rax setnz al loc_172A: cmp rbx, r13 setz r12b or r12b, al jz loc_17E0 loc_173A: mov edi, 28h ; '('; unsigned __int64 call __Znwm; operator new(ulong) mov rsi, rax mov eax, [rbp+0] movzx edi, r12b mov rcx, r13 mov rdx, rbx mov [rsi+20h], 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&) mov rax, [rsp+88h+var_50] lea r12, [rax+1] mov [rsp+88h+var_50], r12 loc_176A: add rbp, 4 cmp r14, rbp jnz loc_16F0 mov rcx, [rsp+88h+var_80] mov rbx, [rsp+88h+var_68] mov rax, [rcx+8] sub rax, [rcx] sar rax, 2 cmp r12, rax setnb bpl test rbx, rbx jz short loc_17B7 loc_1798: mov rdi, [rbx+18h] call _ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE8_M_eraseEPSt13_Rb_tree_nodeIiE_isra_0; std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_erase(std::_Rb_tree_node<int> *) [clone] mov rdi, rbx; void * mov rbx, [rbx+10h] mov esi, 28h ; '('; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) test rbx, rbx jnz short loc_1798 loc_17B7: mov rax, [rsp+88h+var_40] sub rax, fs:28h jnz short loc_1807 add rsp, 58h mov eax, ebp pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_17E0: cmp r15d, [rbx+20h] setl r12b jmp loc_173A loc_17F0: xor eax, eax jmp loc_172A loc_1800: mov ebp, 1 jmp short loc_17B7 loc_1807: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0St6vectorIiSaIiEE_cold; func0(std::vector<int>) [clone]
long long func0(signed int **a1) { signed int *v1; // r14 signed int *v2; // rbp unsigned long long v3; // r12 signed int v4; // r15d int *v5; // rbx long long insert_unique_pos; // rax int *v7; // rdx bool v8; // al bool v9; // r12 long long v10; // rax _QWORD *v11; // rbx void *v12; // rdi _BYTE v14[8]; // [rsp+10h] [rbp-78h] BYREF int v15; // [rsp+18h] [rbp-70h] BYREF void *v16; // [rsp+20h] [rbp-68h] int *v17; // [rsp+28h] [rbp-60h] int *v18; // [rsp+30h] [rbp-58h] long long v19; // [rsp+38h] [rbp-50h] unsigned long long v20; // [rsp+48h] [rbp-40h] v1 = a1[1]; v2 = *a1; v20 = __readfsqword(0x28u); v15 = 0; v16 = 0LL; v17 = &v15; v18 = &v15; v19 = 0LL; if ( v1 == v2 ) { LODWORD(v2) = 1; return (unsigned int)v2; } v3 = 0LL; do { v4 = *v2; if ( v3 && (v5 = v18, v4 > v18[8]) ) { v8 = 0; } else { insert_unique_pos = std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_get_insert_unique_pos( v14, (unsigned int)v4); v5 = v7; if ( !v7 ) goto LABEL_10; v8 = insert_unique_pos != 0; } v9 = v8 || v5 == &v15; if ( !v9 ) v9 = v4 < v5[8]; v10 = operator new(0x28uLL); *(_DWORD *)(v10 + 32) = *v2; std::_Rb_tree_insert_and_rebalance(v9, v10, v5, &v15); v3 = ++v19; LABEL_10: ++v2; } while ( v1 != v2 ); v11 = v16; LOBYTE(v2) = v3 >= a1[1] - *a1; if ( v16 ) { do { std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_erase(v11[3]); v12 = v11; v11 = (_QWORD *)v11[2]; operator delete(v12, 0x28uLL); } while ( v11 ); } return (unsigned int)v2; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x58 MOV R14,qword ptr [RDI + 0x8] MOV RBP,qword ptr [RDI] MOV qword ptr [RSP + 0x8],RDI LEA R13,[RSP + 0x18] MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX MOV dword ptr [RSP + 0x18],0x0 MOV qword ptr [RSP + 0x20],0x0 MOV qword ptr [RSP + 0x28],R13 MOV qword ptr [RSP + 0x30],R13 MOV qword ptr [RSP + 0x38],0x0 CMP R14,RBP JZ 0x00101800 LEA RAX,[RSP + 0x10] XOR R12D,R12D MOV qword ptr [RSP],RAX NOP dword ptr [RAX] LAB_001016f0: MOV R15D,dword ptr [RBP] TEST R12,R12 JZ 0x00101710 MOV RBX,qword ptr [RSP + 0x30] CMP R15D,dword ptr [RBX + 0x20] JG 0x001017f0 NOP dword ptr [RAX + RAX*0x1] LAB_00101710: MOV RDI,qword ptr [RSP] MOV ESI,R15D CALL 0x00101420 MOV RBX,RDX TEST RDX,RDX JZ 0x0010176a TEST RAX,RAX SETNZ AL LAB_0010172a: CMP RBX,R13 SETZ R12B OR R12B,AL JZ 0x001017e0 LAB_0010173a: MOV EDI,0x28 LAB_0010173f: CALL 0x00101110 MOV RSI,RAX MOV EAX,dword ptr [RBP] MOVZX EDI,R12B MOV RCX,R13 MOV RDX,RBX MOV dword ptr [RSI + 0x20],EAX CALL 0x001010d0 MOV RAX,qword ptr [RSP + 0x38] LEA R12,[RAX + 0x1] MOV qword ptr [RSP + 0x38],R12 LAB_0010176a: ADD RBP,0x4 CMP R14,RBP JNZ 0x001016f0 MOV RCX,qword ptr [RSP + 0x8] MOV RBX,qword ptr [RSP + 0x20] MOV RAX,qword ptr [RCX + 0x8] SUB RAX,qword ptr [RCX] SAR RAX,0x2 CMP R12,RAX SETNC BPL TEST RBX,RBX JZ 0x001017b7 LAB_00101798: MOV RDI,qword ptr [RBX + 0x18] CALL 0x001014b0 MOV RDI,RBX MOV RBX,qword ptr [RBX + 0x10] MOV ESI,0x28 CALL 0x00101120 TEST RBX,RBX JNZ 0x00101798 LAB_001017b7: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101807 ADD RSP,0x58 MOV EAX,EBP POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001017e0: CMP R15D,dword ptr [RBX + 0x20] SETL R12B JMP 0x0010173a LAB_001017f0: XOR EAX,EAX JMP 0x0010172a LAB_00101800: MOV EBP,0x1 JMP 0x001017b7 LAB_00101807: CALL 0x00101140
/* func0(std::vector<int, std::allocator<int> >) */ ulong func0(vector param_1) { uint uVar1; uint *puVar2; void *pvVar3; void *pvVar4; _Rb_tree_node_base *p_Var5; _Rb_tree_node_base *p_Var6; uint *puVar7; ulong uVar8; int4 in_register_0000003c; long *plVar9; long in_FS_OFFSET; bool bVar10; int auVar11 [16]; _Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>> local_78 [8]; int4 local_70 [2]; void *local_68; _Rb_tree_node_base *local_60; _Rb_tree_node_base *local_58; ulong local_50; long local_40; plVar9 = (long *)CONCAT44(in_register_0000003c,param_1); puVar2 = (uint *)plVar9[1]; puVar7 = (uint *)*plVar9; local_40 = *(long *)(in_FS_OFFSET + 0x28); local_70[0] = 0; local_68 = (void *)0x0; local_50 = 0; local_60 = (_Rb_tree_node_base *)local_70; local_58 = (_Rb_tree_node_base *)local_70; if (puVar2 == puVar7) { uVar8 = 1; } else { uVar8 = 0; do { uVar1 = *puVar7; if ((uVar8 == 0) || ((int)uVar1 <= *(int *)(local_58 + 0x20))) { auVar11 = std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>:: _M_get_insert_unique_pos(local_78,(int *)(ulong)uVar1); if (auVar11._8_8_ != (_Rb_tree_node_base *)0x0) { bVar10 = auVar11._0_8_ != 0; p_Var6 = auVar11._8_8_; goto LAB_0010172a; } } else { bVar10 = false; p_Var6 = local_58; LAB_0010172a: bVar10 = (bool)(p_Var6 == (_Rb_tree_node_base *)local_70 | bVar10); if (bVar10 == false) { bVar10 = (int)uVar1 < *(int *)(p_Var6 + 0x20); } /* try { // try from 0010173f to 00101743 has its CatchHandler @ 0010180c */ p_Var5 = (_Rb_tree_node_base *)operator_new(0x28); *(uint *)(p_Var5 + 0x20) = *puVar7; std::_Rb_tree_insert_and_rebalance(bVar10,p_Var5,p_Var6,(_Rb_tree_node_base *)local_70); uVar8 = local_50 + 1; local_50 = uVar8; } puVar7 = puVar7 + 1; } while (puVar2 != puVar7); uVar8 = CONCAT71((int7)((ulong)puVar7 >> 8),(ulong)(plVar9[1] - *plVar9 >> 2) <= uVar8); pvVar4 = local_68; while (pvVar4 != (void *)0x0) { std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_erase (*(_Rb_tree_node **)((long)pvVar4 + 0x18)); pvVar3 = *(void **)((long)pvVar4 + 0x10); operator_delete(pvVar4,0x28); pvVar4 = pvVar3; } } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar8 & 0xffffffff; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,123
func0
#include <iostream> #include <vector> #include <set> #include <assert.h>
bool func0(std::vector<int> test_list) { std::set<int> unique_elements(test_list.begin(), test_list.end()); if (test_list.size() > unique_elements.size()) { return false; } return true; }
int main() { assert(func0({1, 2, 3}) == true); assert(func0({1, 2, 1, 2}) == false); assert(func0({1, 2, 3, 4, 5}) == true); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> >): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x48,%rsp mov 0x8(%rdi),%r15 mov (%rdi),%rbx mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax lea 0x8(%rsp),%r14 movl $0x0,0x8(%rsp) movq $0x0,0x10(%rsp) mov %r14,0x18(%rsp) mov %r14,0x20(%rsp) movq $0x0,0x28(%rsp) cmp %rbx,%r15 je 1650 <_Z5func0St6vectorIiSaIiEE+0x1b0> mov %rdi,%r13 xor %ebp,%ebp test %rbp,%rbp je 1513 <_Z5func0St6vectorIiSaIiEE+0x73> mov 0x20(%rsp),%r12 mov (%rbx),%eax cmp %eax,0x20(%r12) jl 155b <_Z5func0St6vectorIiSaIiEE+0xbb> mov 0x10(%rsp),%r12 test %r12,%r12 je 1620 <_Z5func0St6vectorIiSaIiEE+0x180> mov (%rbx),%esi jmp 153a <_Z5func0St6vectorIiSaIiEE+0x9a> nopl (%rax) mov 0x10(%r12),%rax mov $0x1,%edx test %rax,%rax je 154f <_Z5func0St6vectorIiSaIiEE+0xaf> mov %rax,%r12 mov 0x20(%r12),%ecx cmp %ecx,%esi jl 1528 <_Z5func0St6vectorIiSaIiEE+0x88> mov 0x18(%r12),%rax xor %edx,%edx test %rax,%rax jne 1537 <_Z5func0St6vectorIiSaIiEE+0x97> test %dl,%dl jne 1623 <_Z5func0St6vectorIiSaIiEE+0x183> cmp %ecx,%esi jle 1598 <_Z5func0St6vectorIiSaIiEE+0xf8> mov $0x1,%ebp cmp %r14,%r12 jne 1608 <_Z5func0St6vectorIiSaIiEE+0x168> mov $0x28,%edi callq 1150 <_Znwm@plt> mov %rax,%rsi mov (%rbx),%eax movzbl %bpl,%edi mov %r14,%rcx mov %r12,%rdx mov %eax,0x20(%rsi) callq 10f0 <_ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_@plt> mov 0x28(%rsp),%rax lea 0x1(%rax),%rbp mov %rbp,0x28(%rsp) add $0x4,%rbx cmp %rbx,%r15 jne 1500 <_Z5func0St6vectorIiSaIiEE+0x60> mov 0x8(%r13),%rax sub 0x0(%r13),%rax sar $0x2,%rax mov 0x10(%rsp),%rbx cmp %rbp,%rax setbe %r12b test %rbx,%rbx je 15e2 <_Z5func0St6vectorIiSaIiEE+0x142> mov %rsp,%rbp mov 0x18(%rbx),%rsi mov %rbp,%rdi callq 1720 <_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE8_M_eraseEPSt13_Rb_tree_nodeIiE> mov %rbx,%rdi mov 0x10(%rbx),%rbx callq 1140 <_ZdlPv@plt> test %rbx,%rbx jne 15c5 <_Z5func0St6vectorIiSaIiEE+0x125> mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 1658 <_Z5func0St6vectorIiSaIiEE+0x1b8> add $0x48,%rsp mov %r12d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) mov 0x20(%r12),%eax cmp %eax,(%rbx) setl %bpl jmpq 1569 <_Z5func0St6vectorIiSaIiEE+0xc9> nopl 0x0(%rax,%rax,1) mov %r14,%r12 cmp 0x18(%rsp),%r12 je 155b <_Z5func0St6vectorIiSaIiEE+0xbb> mov %r12,%rdi callq 1160 <_ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base@plt> mov (%rbx),%ecx cmp %ecx,0x20(%rax) jge 1598 <_Z5func0St6vectorIiSaIiEE+0xf8> jmpq 155b <_Z5func0St6vectorIiSaIiEE+0xbb> nopw %cs:0x0(%rax,%rax,1) mov $0x1,%r12d jmp 15e2 <_Z5func0St6vectorIiSaIiEE+0x142> callq 1170 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 11a0 <_Z5func0St6vectorIiSaIiEE.cold> nopl 0x0(%rax)
_Z5func0St6vectorIiSaIiEE: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 58h mov r13, [rdi+8] mov rbp, [rdi] mov rax, fs:28h mov [rsp+88h+var_40], rax xor eax, eax lea r12, [rsp+88h+var_70] mov [rsp+88h+var_70], 0 mov [rsp+88h+var_68], 0 mov [rsp+88h+var_60], r12 mov [rsp+88h+var_58], r12 mov [rsp+88h+var_50], 0 cmp r13, rbp jz loc_17B5 mov r14, rdi xor r15d, r15d nop dword ptr [rax+00000000h] loc_1658: mov ecx, [rbp+0] test r15, r15 jz loc_1720 mov rbx, [rsp+88h+var_58] cmp ecx, [rbx+20h] jle loc_1720 loc_1672: mov r15d, 1 cmp rbx, r12 jnz loc_1770 loc_1681: mov edi, 28h ; '('; unsigned __int64 call __Znwm; operator new(ulong) mov rsi, rax mov eax, [rbp+0] movzx edi, r15b mov rcx, r12 mov rdx, rbx mov [rsi+20h], 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&) mov rax, [rsp+88h+var_50] lea r15, [rax+1] mov [rsp+88h+var_50], r15 loc_16B1: add rbp, 4 cmp r13, rbp jnz short loc_1658 mov rax, [r14+8] sub rax, [r14] sar rax, 2 mov rbx, [rsp+88h+var_68] cmp r15, rax setnb bpl test rbx, rbx jz short loc_16F5 loc_16D6: mov rdi, [rbx+18h] call _ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE8_M_eraseEPSt13_Rb_tree_nodeIiE_isra_0; std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_erase(std::_Rb_tree_node<int> *) [clone] mov rdi, rbx; void * mov rbx, [rbx+10h] mov esi, 28h ; '('; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) test rbx, rbx jnz short loc_16D6 loc_16F5: mov rax, [rsp+88h+var_40] sub rax, fs:28h jnz loc_17BF add rsp, 58h mov eax, ebp pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1720: mov rbx, [rsp+88h+var_68] test rbx, rbx jnz short loc_1733 jmp short loc_17A0 loc_1730: mov rbx, rax loc_1733: mov edx, [rbx+20h] mov rax, [rbx+18h] cmp ecx, edx cmovl rax, [rbx+10h] setl sil test rax, rax jnz short loc_1730 test sil, sil jnz short loc_1780 loc_174F: cmp ecx, edx jle loc_16B1 mov r15d, 1 cmp rbx, r12 jz loc_1681 nop word ptr [rax+rax+00000000h] loc_1770: cmp ecx, [rbx+20h] setl r15b jmp loc_1681 loc_1780: cmp [rsp+88h+var_60], rbx jz loc_1672 loc_178B: mov rdi, rbx mov [rsp+88h+var_7C], ecx call __ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base; std::_Rb_tree_decrement(std::_Rb_tree_node_base *) mov ecx, [rsp+88h+var_7C] mov edx, [rax+20h] jmp short loc_174F loc_17A0: mov rbx, r12 cmp [rsp+88h+var_60], r12 jnz short loc_178B mov r15d, 1 jmp loc_1681 loc_17B5: mov ebp, 1 jmp loc_16F5 loc_17BF: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0St6vectorIiSaIiEE_cold; func0(std::vector<int>) [clone]
long long func0(int **a1) { int *v1; // r13 int *v2; // rbp unsigned long long v3; // r15 int v4; // ecx int *v5; // rbx bool v6; // r15 long long v7; // rax _QWORD *v8; // rbx void *v9; // rdi int v11; // edx int *v12; // rax long long v13; // rax int v14; // [rsp+Ch] [rbp-7Ch] int v15; // [rsp+18h] [rbp-70h] BYREF void *v16; // [rsp+20h] [rbp-68h] int *v17; // [rsp+28h] [rbp-60h] int *v18; // [rsp+30h] [rbp-58h] long long v19; // [rsp+38h] [rbp-50h] unsigned long long v20; // [rsp+48h] [rbp-40h] v1 = a1[1]; v2 = *a1; v20 = __readfsqword(0x28u); v15 = 0; v16 = 0LL; v17 = &v15; v18 = &v15; v19 = 0LL; if ( v1 == v2 ) { LODWORD(v2) = 1; return (unsigned int)v2; } v3 = 0LL; do { v4 = *v2; if ( v3 ) { v5 = v18; if ( v4 > v18[8] ) { LABEL_5: v6 = 1; if ( v5 != &v15 ) goto LABEL_20; goto LABEL_6; } } v5 = (int *)v16; if ( !v16 ) { v5 = &v15; if ( v17 == &v15 ) { v6 = 1; goto LABEL_6; } goto LABEL_22; } while ( 1 ) { v11 = v5[8]; v12 = (int *)*((_QWORD *)v5 + 3); if ( v4 < v11 ) v12 = (int *)*((_QWORD *)v5 + 2); if ( !v12 ) break; v5 = v12; } if ( v4 < v11 ) { if ( v17 == v5 ) goto LABEL_5; LABEL_22: v14 = *v2; v13 = std::_Rb_tree_decrement(v5); v4 = v14; v11 = *(_DWORD *)(v13 + 32); } if ( v4 > v11 ) { v6 = 1; if ( v5 != &v15 ) LABEL_20: v6 = v4 < v5[8]; LABEL_6: v7 = operator new(0x28uLL); *(_DWORD *)(v7 + 32) = *v2; std::_Rb_tree_insert_and_rebalance(v6, v7, v5, &v15); v3 = ++v19; } ++v2; } while ( v1 != v2 ); v8 = v16; LOBYTE(v2) = v3 >= a1[1] - *a1; if ( v16 ) { do { std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_erase(v8[3]); v9 = v8; v8 = (_QWORD *)v8[2]; operator delete(v9, 0x28uLL); } while ( v8 ); } return (unsigned int)v2; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x58 MOV R13,qword ptr [RDI + 0x8] MOV RBP,qword ptr [RDI] MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x48],RAX XOR EAX,EAX LEA R12,[RSP + 0x18] MOV dword ptr [RSP + 0x18],0x0 MOV qword ptr [RSP + 0x20],0x0 MOV qword ptr [RSP + 0x28],R12 MOV qword ptr [RSP + 0x30],R12 MOV qword ptr [RSP + 0x38],0x0 CMP R13,RBP JZ 0x001017b5 MOV R14,RDI XOR R15D,R15D NOP dword ptr [RAX] LAB_00101658: MOV ECX,dword ptr [RBP] TEST R15,R15 JZ 0x00101720 MOV RBX,qword ptr [RSP + 0x30] CMP ECX,dword ptr [RBX + 0x20] JLE 0x00101720 LAB_00101672: MOV R15D,0x1 CMP RBX,R12 JNZ 0x00101770 LAB_00101681: MOV EDI,0x28 LAB_00101686: CALL 0x00101110 MOV RSI,RAX MOV EAX,dword ptr [RBP] MOVZX EDI,R15B MOV RCX,R12 MOV RDX,RBX MOV dword ptr [RSI + 0x20],EAX CALL 0x001010d0 MOV RAX,qword ptr [RSP + 0x38] LEA R15,[RAX + 0x1] MOV qword ptr [RSP + 0x38],R15 LAB_001016b1: ADD RBP,0x4 CMP R13,RBP JNZ 0x00101658 MOV RAX,qword ptr [R14 + 0x8] SUB RAX,qword ptr [R14] SAR RAX,0x2 MOV RBX,qword ptr [RSP + 0x20] CMP R15,RAX SETNC BPL TEST RBX,RBX JZ 0x001016f5 LAB_001016d6: MOV RDI,qword ptr [RBX + 0x18] CALL 0x00101420 MOV RDI,RBX MOV RBX,qword ptr [RBX + 0x10] MOV ESI,0x28 CALL 0x00101120 TEST RBX,RBX JNZ 0x001016d6 LAB_001016f5: MOV RAX,qword ptr [RSP + 0x48] SUB RAX,qword ptr FS:[0x28] JNZ 0x001017bf ADD RSP,0x58 MOV EAX,EBP POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101720: MOV RBX,qword ptr [RSP + 0x20] TEST RBX,RBX JNZ 0x00101733 JMP 0x001017a0 LAB_00101730: MOV RBX,RAX LAB_00101733: MOV EDX,dword ptr [RBX + 0x20] MOV RAX,qword ptr [RBX + 0x18] CMP ECX,EDX CMOVL RAX,qword ptr [RBX + 0x10] SETL SIL TEST RAX,RAX JNZ 0x00101730 TEST SIL,SIL JNZ 0x00101780 LAB_0010174f: CMP ECX,EDX JLE 0x001016b1 MOV R15D,0x1 CMP RBX,R12 JZ 0x00101681 NOP word ptr CS:[RAX + RAX*0x1] LAB_00101770: CMP ECX,dword ptr [RBX + 0x20] SETL R15B JMP 0x00101681 LAB_00101780: CMP qword ptr [RSP + 0x28],RBX JZ 0x00101672 LAB_0010178b: MOV RDI,RBX MOV dword ptr [RSP + 0xc],ECX CALL 0x00101130 MOV ECX,dword ptr [RSP + 0xc] MOV EDX,dword ptr [RAX + 0x20] JMP 0x0010174f LAB_001017a0: MOV RBX,R12 CMP qword ptr [RSP + 0x28],R12 JNZ 0x0010178b MOV R15D,0x1 JMP 0x00101681 LAB_001017b5: MOV EBP,0x1 JMP 0x001016f5 LAB_001017bf: CALL 0x00101140
/* func0(std::vector<int, std::allocator<int> >) */ ulong func0(vector param_1) { int iVar1; int *piVar2; _Rb_tree_node_base *p_Var3; long lVar4; int iVar5; _Rb_tree_node_base *p_Var6; int *piVar7; ulong uVar8; int4 in_register_0000003c; long *plVar9; bool bVar10; long in_FS_OFFSET; int4 local_70 [2]; _Rb_tree_node_base *local_68; _Rb_tree_node_base *local_60; _Rb_tree_node_base *local_58; ulong local_50; long local_40; plVar9 = (long *)CONCAT44(in_register_0000003c,param_1); piVar2 = (int *)plVar9[1]; piVar7 = (int *)*plVar9; local_40 = *(long *)(in_FS_OFFSET + 0x28); local_70[0] = 0; local_68 = (_Rb_tree_node_base *)0x0; local_50 = 0; local_60 = (_Rb_tree_node_base *)local_70; local_58 = (_Rb_tree_node_base *)local_70; if (piVar2 == piVar7) { uVar8 = 1; } else { uVar8 = 0; do { iVar1 = *piVar7; if ((uVar8 == 0) || (p_Var6 = local_58, iVar1 <= *(int *)(local_58 + 0x20))) { p_Var3 = local_68; if (local_68 != (_Rb_tree_node_base *)0x0) { do { p_Var6 = p_Var3; iVar5 = *(int *)(p_Var6 + 0x20); p_Var3 = *(_Rb_tree_node_base **)(p_Var6 + 0x18); if (iVar1 < iVar5) { p_Var3 = *(_Rb_tree_node_base **)(p_Var6 + 0x10); } } while (p_Var3 != (_Rb_tree_node_base *)0x0); if (iVar5 <= iVar1) goto LAB_0010174f; if (local_60 != p_Var6) goto LAB_0010178b; goto LAB_00101672; } p_Var6 = (_Rb_tree_node_base *)local_70; if (local_60 == (_Rb_tree_node_base *)local_70) { bVar10 = true; goto LAB_00101681; } LAB_0010178b: lVar4 = std::_Rb_tree_decrement(p_Var6); iVar5 = *(int *)(lVar4 + 0x20); LAB_0010174f: if (iVar5 < iVar1) { bVar10 = true; if (p_Var6 == (_Rb_tree_node_base *)local_70) goto LAB_00101681; goto LAB_00101770; } } else { LAB_00101672: bVar10 = true; if (p_Var6 != (_Rb_tree_node_base *)local_70) { LAB_00101770: bVar10 = iVar1 < *(int *)(p_Var6 + 0x20); } LAB_00101681: /* try { // try from 00101686 to 0010168a has its CatchHandler @ 001017c4 */ p_Var3 = (_Rb_tree_node_base *)operator_new(0x28); *(int *)(p_Var3 + 0x20) = *piVar7; std::_Rb_tree_insert_and_rebalance(bVar10,p_Var3,p_Var6,(_Rb_tree_node_base *)local_70); uVar8 = local_50 + 1; local_50 = uVar8; } piVar7 = piVar7 + 1; } while (piVar2 != piVar7); uVar8 = CONCAT71((int7)((ulong)piVar7 >> 8),(ulong)(plVar9[1] - *plVar9 >> 2) <= uVar8); p_Var6 = local_68; while (p_Var6 != (_Rb_tree_node_base *)0x0) { std::_Rb_tree<int,int,std::_Identity<int>,std::less<int>,std::allocator<int>>::_M_erase (*(_Rb_tree_node **)(p_Var6 + 0x18)); p_Var3 = *(_Rb_tree_node_base **)(p_Var6 + 0x10); operator_delete(p_Var6,0x28); p_Var6 = p_Var3; } } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar8 & 0xffffffff; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,124
func0
#include <vector> #include <cassert>
std::vector<int> func0(const std::vector<int>& nums1, const std::vector<int>& nums2) { std::vector<int> result; for (size_t i = 0; i < nums1.size(); ++i) { result.push_back(nums1[i] - nums2[i]); } return result; }
int main() { assert((func0({1, 2, 3}, {4, 5, 6}) == std::vector<int>{-3, -3, -3})); assert((func0({1, 2}, {3, 4}) == std::vector<int>{-2, -2})); assert((func0({90, 120}, {50, 70}) == std::vector<int>{40, 50})); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x48,%rsp mov %rdi,-0x38(%rbp) mov %rsi,-0x40(%rbp) mov %rdx,-0x48(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax mov -0x38(%rbp),%rax mov %rax,%rdi callq 1b68 <_ZNSt6vectorIiSaIiEEC1Ev> movq $0x0,-0x20(%rbp) mov -0x40(%rbp),%rax mov %rax,%rdi callq 1c6e <_ZNKSt6vectorIiSaIiEE4sizeEv> cmp %rax,-0x20(%rbp) setb %al test %al,%al je 1305 <_Z5func0RKSt6vectorIiSaIiEES3_+0xbc> mov -0x20(%rbp),%rdx mov -0x40(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1c96 <_ZNKSt6vectorIiSaIiEEixEm> mov (%rax),%ebx mov -0x20(%rbp),%rdx mov -0x48(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1c96 <_ZNKSt6vectorIiSaIiEEixEm> mov (%rax),%eax sub %eax,%ebx mov %ebx,%eax mov %eax,-0x24(%rbp) lea -0x24(%rbp),%rdx mov -0x38(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1cba <_ZNSt6vectorIiSaIiEE9push_backEOi> addq $0x1,-0x20(%rbp) jmp 1285 <_Z5func0RKSt6vectorIiSaIiEES3_+0x3c> endbr64 mov %rax,%rbx mov -0x38(%rbp),%rax mov %rax,%rdi callq 1c26 <_ZNSt6vectorIiSaIiEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 1150 <_Unwind_Resume@plt> mov -0x18(%rbp),%rax xor %fs:0x28,%rax je 131a <_Z5func0RKSt6vectorIiSaIiEES3_+0xd1> callq 1130 <__stack_chk_fail@plt> mov -0x38(%rbp),%rax add $0x48,%rsp pop %rbx pop %rbp retq
_Z5func0RKSt6vectorIiSaIiEES3_: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 48h mov [rbp+var_38], rdi mov [rbp+var_40], rsi mov [rbp+var_48], rdx mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax mov rax, [rbp+var_38] mov rdi, rax call _ZNSt6vectorIiSaIiEEC2Ev; std::vector<int>::vector(void) mov [rbp+var_20], 0 jmp short loc_12F0 loc_12A7: mov rdx, [rbp+var_20] mov rax, [rbp+var_40] mov rsi, rdx mov rdi, rax call _ZNKSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov ebx, [rax] mov rdx, [rbp+var_20] mov rax, [rbp+var_48] mov rsi, rdx mov rdi, rax call _ZNKSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] sub ebx, eax mov edx, ebx mov [rbp+var_24], edx lea rdx, [rbp+var_24] mov rax, [rbp+var_38] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEE9push_backEOi; std::vector<int>::push_back(int &&) add [rbp+var_20], 1 loc_12F0: mov rax, [rbp+var_40] mov rdi, rax call _ZNKSt6vectorIiSaIiEE4sizeEv; std::vector<int>::size(void) cmp [rbp+var_20], rax setb al test al, al jnz short loc_12A7 jmp short loc_133B endbr64 mov rbx, rax mov rax, [rbp+var_38] mov rdi, rax call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() mov rax, rbx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_1333 call ___stack_chk_fail loc_1333: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_133B: mov rax, [rbp+var_18] sub rax, fs:28h jz short loc_134F call ___stack_chk_fail loc_134F: mov rax, [rbp+var_38] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, long long a2, long long a3) { int v3; // ebx unsigned long long v4; // rax int v7; // [rsp+2Ch] [rbp-24h] BYREF unsigned long long i; // [rsp+30h] [rbp-20h] unsigned long long v9; // [rsp+38h] [rbp-18h] v9 = __readfsqword(0x28u); std::vector<int>::vector(a1); for ( i = 0LL; ; ++i ) { v4 = std::vector<int>::size(a2); if ( i >= v4 ) break; v3 = *(_DWORD *)std::vector<int>::operator[](a2, i); v7 = v3 - *(_DWORD *)std::vector<int>::operator[](a3, i); std::vector<int>::push_back(a1, &v7); } return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x48 MOV qword ptr [RBP + -0x38],RDI MOV qword ptr [RBP + -0x40],RSI MOV qword ptr [RBP + -0x48],RDX MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX MOV RAX,qword ptr [RBP + -0x38] MOV RDI,RAX CALL 0x00101c04 MOV qword ptr [RBP + -0x20],0x0 JMP 0x001012f0 LAB_001012a7: MOV RDX,qword ptr [RBP + -0x20] MOV RAX,qword ptr [RBP + -0x40] MOV RSI,RDX MOV RDI,RAX CALL 0x00101d2a MOV EBX,dword ptr [RAX] MOV RDX,qword ptr [RBP + -0x20] MOV RAX,qword ptr [RBP + -0x48] MOV RSI,RDX MOV RDI,RAX CALL 0x00101d2a MOV EAX,dword ptr [RAX] SUB EBX,EAX MOV EDX,EBX MOV dword ptr [RBP + -0x24],EDX LEA RDX,[RBP + -0x24] MOV RAX,qword ptr [RBP + -0x38] MOV RSI,RDX MOV RDI,RAX LAB_001012e6: CALL 0x00101d4e ADD qword ptr [RBP + -0x20],0x1 LAB_001012f0: MOV RAX,qword ptr [RBP + -0x40] MOV RDI,RAX CALL 0x00101d02 CMP qword ptr [RBP + -0x20],RAX SETC AL TEST AL,AL JNZ 0x001012a7 JMP 0x0010133b LAB_0010133b: MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x0010134f CALL 0x00101150 LAB_0010134f: MOV RAX,qword ptr [RBP + -0x38] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&) */ vector * func0(vector *param_1,vector *param_2) { int iVar1; int *piVar2; ulong uVar3; vector<int,std::allocator<int>> *in_RDX; long in_FS_OFFSET; int local_2c; ulong 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 = 0; while( true ) { uVar3 = std::vector<int,std::allocator<int>>::size((vector<int,std::allocator<int>> *)param_2); if (uVar3 <= local_28) break; piVar2 = (int *)std::vector<int,std::allocator<int>>::operator[] ((vector<int,std::allocator<int>> *)param_2,local_28); iVar1 = *piVar2; piVar2 = (int *)std::vector<int,std::allocator<int>>::operator[](in_RDX,local_28); local_2c = iVar1 - *piVar2; /* try { // try from 001012e6 to 001012ea has its CatchHandler @ 00101309 */ std::vector<int,std::allocator<int>>::push_back ((vector<int,std::allocator<int>> *)param_1,&local_2c); local_28 = local_28 + 1; } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
1,125
func0
#include <vector> #include <cassert>
std::vector<int> func0(const std::vector<int>& nums1, const std::vector<int>& nums2) { std::vector<int> result; for (size_t i = 0; i < nums1.size(); ++i) { result.push_back(nums1[i] - nums2[i]); } return result; }
int main() { assert((func0({1, 2, 3}, {4, 5, 6}) == std::vector<int>{-3, -3, -3})); assert((func0({1, 2}, {3, 4}) == std::vector<int>{-2, -2})); assert((func0({90, 120}, {50, 70}) == std::vector<int>{40, 50})); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&): endbr64 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x10,%rsp mov %rdi,%rbp mov %rdx,%r13 mov %fs:0x28,%rax mov %rax,0x8(%rsp) xor %eax,%eax movq $0x0,(%rdi) movq $0x0,0x8(%rdi) movq $0x0,0x10(%rdi) mov (%rsi),%rdx cmp %rdx,0x8(%rsi) je 1300 <_Z5func0RKSt6vectorIiSaIiEES3_+0xb7> mov %rsi,%r12 mov $0x0,%ebx lea 0x4(%rsp),%r14 jmp 12c2 <_Z5func0RKSt6vectorIiSaIiEES3_+0x79> mov %r14,%rdx mov %rbp,%rdi callq 18cc <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> add $0x1,%rbx mov (%r12),%rdx mov 0x8(%r12),%rax sub %rdx,%rax sar $0x2,%rax cmp %rax,%rbx jae 1300 <_Z5func0RKSt6vectorIiSaIiEES3_+0xb7> mov 0x0(%r13),%rcx mov (%rdx,%rbx,4),%eax sub (%rcx,%rbx,4),%eax mov %eax,0x4(%rsp) mov 0x8(%rbp),%rsi cmp 0x10(%rbp),%rsi je 129e <_Z5func0RKSt6vectorIiSaIiEES3_+0x55> mov %eax,(%rsi) addq $0x4,0x8(%rbp) jmp 12a9 <_Z5func0RKSt6vectorIiSaIiEES3_+0x60> endbr64 mov %rax,%rbx mov 0x0(%rbp),%rdi test %rdi,%rdi je 12f8 <_Z5func0RKSt6vectorIiSaIiEES3_+0xaf> callq 1110 <_ZdlPv@plt> mov %rbx,%rdi callq 1150 <_Unwind_Resume@plt> mov 0x8(%rsp),%rax xor %fs:0x28,%rax jne 1320 <_Z5func0RKSt6vectorIiSaIiEES3_+0xd7> mov %rbp,%rax add $0x10,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq callq 1130 <__stack_chk_fail@plt>
_Z5func0RKSt6vectorIiSaIiEES3_: endbr64 push r14 push r13 push r12 push rbp push rbx sub rsp, 10h mov rbp, rdi mov r13, rdx mov rax, fs:28h mov [rsp+38h+var_30], rax xor eax, eax mov qword ptr [rdi], 0 mov qword ptr [rdi+8], 0 mov qword ptr [rdi+10h], 0 mov rdx, [rsi] cmp rdx, [rsi+8] jz loc_1313 mov r12, rsi mov ebx, 0 lea r14, [rsp+38h+var_34] jmp short loc_12C6 loc_12A2: mov rdx, r14 mov rdi, rbp call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int &&) loc_12AD: add rbx, 1 mov rdx, [r12] mov rax, [r12+8] sub rax, rdx sar rax, 2 cmp rbx, rax jnb short loc_1313 loc_12C6: mov rcx, [r13+0] mov eax, [rdx+rbx*4] sub eax, [rcx+rbx*4] mov [rsp+38h+var_34], eax mov rsi, [rbp+8] cmp rsi, [rbp+10h] jz short loc_12A2 mov [rsi], eax add qword ptr [rbp+8], 4 jmp short loc_12AD 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_130B call ___stack_chk_fail loc_130B: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume loc_1313: mov rax, [rsp+38h+var_30] sub rax, fs:28h jnz short loc_1333 mov rax, rbp add rsp, 10h pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_1333: call ___stack_chk_fail
_QWORD * func0(_QWORD *a1, long long *a2, _QWORD *a3) { long long v4; // rdx unsigned long long v6; // rbx int v7; // eax int *v8; // rsi int v10; // [rsp+4h] [rbp-34h] BYREF unsigned long long v11; // [rsp+8h] [rbp-30h] v11 = __readfsqword(0x28u); *a1 = 0LL; a1[1] = 0LL; a1[2] = 0LL; v4 = *a2; if ( *a2 != a2[1] ) { v6 = 0LL; do { v7 = *(_DWORD *)(v4 + 4 * v6) - *(_DWORD *)(*a3 + 4 * v6); v10 = v7; v8 = (int *)a1[1]; if ( v8 == (int *)a1[2] ) { std::vector<int>::_M_realloc_insert<int>(a1, v8, &v10); } else { *v8 = v7; a1[1] += 4LL; } ++v6; v4 = *a2; } while ( v6 < (a2[1] - *a2) >> 2 ); } return a1; }
func0: ENDBR64 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x10 MOV RBP,RDI MOV R13,RDX 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 RDX,qword ptr [RSI] CMP RDX,qword ptr [RSI + 0x8] JZ 0x00101313 MOV R12,RSI MOV EBX,0x0 LEA R14,[RSP + 0x4] JMP 0x001012c6 LAB_001012a2: MOV RDX,R14 MOV RDI,RBP LAB_001012a8: CALL 0x001018fc LAB_001012ad: ADD RBX,0x1 MOV RDX,qword ptr [R12] MOV RAX,qword ptr [R12 + 0x8] SUB RAX,RDX SAR RAX,0x2 CMP RBX,RAX JNC 0x00101313 LAB_001012c6: MOV RCX,qword ptr [R13] MOV EAX,dword ptr [RDX + RBX*0x4] SUB EAX,dword ptr [RCX + RBX*0x4] MOV dword ptr [RSP + 0x4],EAX MOV RSI,qword ptr [RBP + 0x8] CMP RSI,qword ptr [RBP + 0x10] JZ 0x001012a2 MOV dword ptr [RSI],EAX ADD qword ptr [RBP + 0x8],0x4 JMP 0x001012ad LAB_00101313: MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101333 MOV RAX,RBP ADD RSP,0x10 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_00101333: CALL 0x00101130
/* func0(std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&) */ vector * func0(vector *param_1,vector *param_2) { int *piVar1; long *in_RDX; long lVar2; ulong uVar3; long in_FS_OFFSET; int local_34; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); *(int8 *)param_1 = 0; *(int8 *)(param_1 + 8) = 0; *(int8 *)(param_1 + 0x10) = 0; lVar2 = *(long *)param_2; if (lVar2 != *(long *)(param_2 + 8)) { uVar3 = 0; do { local_34 = *(int *)(lVar2 + uVar3 * 4) - *(int *)(*in_RDX + uVar3 * 4); piVar1 = *(int **)(param_1 + 8); if (piVar1 == *(int **)(param_1 + 0x10)) { /* try { // try from 001012a8 to 001012ac has its CatchHandler @ 001012e7 */ std::vector<int,std::allocator<int>>::_M_realloc_insert<int> ((vector<int,std::allocator<int>> *)param_1,(__normal_iterator)piVar1,&local_34); } else { *piVar1 = local_34; *(long *)(param_1 + 8) = *(long *)(param_1 + 8) + 4; } uVar3 = uVar3 + 1; lVar2 = *(long *)param_2; } while (uVar3 < (ulong)(*(long *)(param_2 + 8) - lVar2 >> 2)); } if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,126
func0
#include <vector> #include <cassert>
std::vector<int> func0(const std::vector<int>& nums1, const std::vector<int>& nums2) { std::vector<int> result; for (size_t i = 0; i < nums1.size(); ++i) { result.push_back(nums1[i] - nums2[i]); } return result; }
int main() { assert((func0({1, 2, 3}, {4, 5, 6}) == std::vector<int>{-3, -3, -3})); assert((func0({1, 2}, {3, 4}) == std::vector<int>{-2, -2})); assert((func0({90, 120}, {50, 70}) == std::vector<int>{40, 50})); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&): endbr64 push %r14 push %r13 mov %rdx,%r13 push %r12 mov %rdi,%r12 push %rbp push %rbx sub $0x10,%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),%rdx cmp 0x8(%rsi),%rdx je 17a0 <_Z5func0RKSt6vectorIiSaIiEES3_+0xb0> mov %rsi,%rbp xor %edi,%edi xor %esi,%esi xor %ebx,%ebx lea 0x4(%rsp),%r14 jmp 177d <_Z5func0RKSt6vectorIiSaIiEES3_+0x8d> nopw %cs:0x0(%rax,%rax,1) mov %eax,(%rsi) add $0x4,%rsi mov %rsi,0x8(%r12) mov 0x0(%rbp),%rdx mov 0x8(%rbp),%rax add $0x1,%rbx sub %rdx,%rax sar $0x2,%rax cmp %rax,%rbx jae 17a0 <_Z5func0RKSt6vectorIiSaIiEES3_+0xb0> mov 0x8(%r12),%rsi mov 0x10(%r12),%rdi mov 0x0(%r13),%rcx mov (%rdx,%rbx,4),%eax sub (%rcx,%rbx,4),%eax mov %eax,0x4(%rsp) cmp %rdi,%rsi jne 1750 <_Z5func0RKSt6vectorIiSaIiEES3_+0x60> mov %r14,%rdx mov %r12,%rdi callq 18f0 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> jmp 175b <_Z5func0RKSt6vectorIiSaIiEES3_+0x6b> nopl (%rax) mov 0x8(%rsp),%rax xor %fs:0x28,%rax jne 17c0 <_Z5func0RKSt6vectorIiSaIiEES3_+0xd0> add $0x10,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq callq 1130 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 1160 <_Z5func0RKSt6vectorIiSaIiEES3_.cold> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
_Z5func0RKSt6vectorIiSaIiEES3_: endbr64 push r14 pxor xmm0, xmm0 push r13 mov r13, rdx push r12 push rbp mov rbp, rdi push rbx sub rsp, 10h mov rax, fs:28h mov [rsp+38h+var_30], rax xor eax, eax movups xmmword ptr [rdi], xmm0 mov rdx, [rsi] mov qword ptr [rdi+10h], 0 cmp [rsi+8], rdx jz short loc_17A0 mov r12, rsi xor edi, edi xor esi, esi xor ebx, ebx lea r14, [rsp+38h+var_34] jmp short loc_1777 loc_1750: mov [rsi], eax add rsi, 4 mov [rbp+8], rsi loc_175A: mov rax, [r12+8] add rbx, 1 sub rax, rdx sar rax, 2 cmp rbx, rax jnb short loc_17A0 mov rsi, [rbp+8] mov rdi, [rbp+10h] loc_1777: mov rcx, [r13+0] mov eax, [rdx+rbx*4] sub eax, [rcx+rbx*4] mov [rsp+38h+var_34], eax cmp rsi, rdi jnz short loc_1750 mov rdx, r14 mov rdi, rbp call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int &&) mov rdx, [r12] jmp short loc_175A loc_17A0: mov rax, [rsp+38h+var_30] sub rax, fs:28h jnz short loc_17C0 add rsp, 10h mov rax, rbp pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_17C0: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0RKSt6vectorIiSaIiEES3__cold; func0(std::vector<int> const&,std::vector<int> const&) [clone]
long long func0(long long a1, long long *a2, _QWORD *a3) { long long v5; // rdx int *v7; // rdi int *v8; // rsi long long v9; // rbx int v10; // eax int v12; // [rsp+0h] [rbp-34h] BYREF unsigned long long v13; // [rsp+4h] [rbp-30h] v13 = __readfsqword(0x28u); *(_OWORD *)a1 = 0LL; v5 = *a2; *(_QWORD *)(a1 + 16) = 0LL; if ( a2[1] != v5 ) { v7 = 0LL; v8 = 0LL; v9 = 0LL; while ( 1 ) { v10 = *(_DWORD *)(v5 + 4 * v9) - *(_DWORD *)(*a3 + 4 * v9); v12 = v10; if ( v8 == v7 ) { std::vector<int>::_M_realloc_insert<int>(a1, v8, &v12); v5 = *a2; } else { *v8 = v10; *(_QWORD *)(a1 + 8) = v8 + 1; } if ( ++v9 >= (unsigned long long)((a2[1] - v5) >> 2) ) break; v8 = *(int **)(a1 + 8); v7 = *(int **)(a1 + 16); } } return a1; }
func0: ENDBR64 PUSH R14 PXOR XMM0,XMM0 PUSH R13 MOV R13,RDX PUSH R12 PUSH RBP MOV RBP,RDI PUSH RBX SUB RSP,0x10 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x8],RAX XOR EAX,EAX MOVUPS xmmword ptr [RDI],XMM0 MOV RDX,qword ptr [RSI] MOV qword ptr [RDI + 0x10],0x0 CMP qword ptr [RSI + 0x8],RDX JZ 0x001017a0 MOV R12,RSI XOR EDI,EDI XOR ESI,ESI XOR EBX,EBX LEA R14,[RSP + 0x4] JMP 0x00101777 LAB_00101750: MOV dword ptr [RSI],EAX ADD RSI,0x4 MOV qword ptr [RBP + 0x8],RSI LAB_0010175a: MOV RAX,qword ptr [R12 + 0x8] ADD RBX,0x1 SUB RAX,RDX SAR RAX,0x2 CMP RBX,RAX JNC 0x001017a0 MOV RSI,qword ptr [RBP + 0x8] MOV RDI,qword ptr [RBP + 0x10] LAB_00101777: MOV RCX,qword ptr [R13] MOV EAX,dword ptr [RDX + RBX*0x4] SUB EAX,dword ptr [RCX + RBX*0x4] MOV dword ptr [RSP + 0x4],EAX CMP RSI,RDI JNZ 0x00101750 MOV RDX,R14 MOV RDI,RBP LAB_00101790: CALL 0x001018f0 MOV RDX,qword ptr [R12] JMP 0x0010175a LAB_001017a0: MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x001017c0 ADD RSP,0x10 MOV RAX,RBP POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_001017c0: CALL 0x00101130
/* func0(std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&) */ vector * func0(vector *param_1,vector *param_2) { long *in_RDX; long lVar1; ulong uVar2; int *piVar3; int *piVar4; long in_FS_OFFSET; int local_34; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); *(int (*) [16])param_1 = (int [16])0x0; lVar1 = *(long *)param_2; *(int8 *)(param_1 + 0x10) = 0; if (*(long *)(param_2 + 8) != lVar1) { piVar4 = (int *)0x0; piVar3 = (int *)0x0; uVar2 = 0; while( true ) { local_34 = *(int *)(lVar1 + uVar2 * 4) - *(int *)(*in_RDX + uVar2 * 4); if (piVar3 == piVar4) { /* try { // try from 00101790 to 00101794 has its CatchHandler @ 001017c5 */ std::vector<int,std::allocator<int>>::_M_realloc_insert<int> ((vector<int,std::allocator<int>> *)param_1,(__normal_iterator)piVar3,&local_34); lVar1 = *(long *)param_2; } else { *piVar3 = local_34; *(int **)(param_1 + 8) = piVar3 + 1; } uVar2 = uVar2 + 1; if ((ulong)(*(long *)(param_2 + 8) - lVar1 >> 2) <= uVar2) break; piVar3 = *(int **)(param_1 + 8); piVar4 = *(int **)(param_1 + 0x10); } } if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,127
func0
#include <vector> #include <cassert>
std::vector<int> func0(const std::vector<int>& nums1, const std::vector<int>& nums2) { std::vector<int> result; for (size_t i = 0; i < nums1.size(); ++i) { result.push_back(nums1[i] - nums2[i]); } return result; }
int main() { assert((func0({1, 2, 3}, {4, 5, 6}) == std::vector<int>{-3, -3, -3})); assert((func0({1, 2}, {3, 4}) == std::vector<int>{-2, -2})); assert((func0({90, 120}, {50, 70}) == std::vector<int>{40, 50})); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&): endbr64 push %r14 pxor %xmm0,%xmm0 push %r13 mov %rdx,%r13 push %r12 mov %rdi,%r12 push %rbp push %rbx sub $0x10,%rsp mov %fs:0x28,%rax mov %rax,0x8(%rsp) xor %eax,%eax movq $0x0,0x10(%rdi) movups %xmm0,(%rdi) mov (%rsi),%rdx cmp 0x8(%rsi),%rdx je 17f0 <_Z5func0RKSt6vectorIiSaIiEES3_+0xa0> mov %rsi,%rbp xor %edi,%edi xor %esi,%esi xor %ebx,%ebx lea 0x4(%rsp),%r14 jmp 17cd <_Z5func0RKSt6vectorIiSaIiEES3_+0x7d> xchg %ax,%ax mov %eax,(%rsi) add $0x4,%rsi mov %rsi,0x8(%r12) mov 0x0(%rbp),%rdx mov 0x8(%rbp),%rax add $0x1,%rbx sub %rdx,%rax sar $0x2,%rax cmp %rax,%rbx jae 17f0 <_Z5func0RKSt6vectorIiSaIiEES3_+0xa0> mov 0x8(%r12),%rsi mov 0x10(%r12),%rdi mov 0x0(%r13),%rcx mov (%rdx,%rbx,4),%eax sub (%rcx,%rbx,4),%eax mov %eax,0x4(%rsp) cmp %rdi,%rsi jne 17a0 <_Z5func0RKSt6vectorIiSaIiEES3_+0x50> mov %r14,%rdx mov %r12,%rdi callq 1880 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> jmp 17ab <_Z5func0RKSt6vectorIiSaIiEES3_+0x5b> nopl (%rax) mov 0x8(%rsp),%rax xor %fs:0x28,%rax jne 1810 <_Z5func0RKSt6vectorIiSaIiEES3_+0xc0> add $0x10,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq callq 1130 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 1175 <_Z5func0RKSt6vectorIiSaIiEES3_.cold> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
_Z5func0RKSt6vectorIiSaIiEES3_: endbr64 push r14 pxor xmm0, xmm0 push r13 mov r13, rdx push r12 push rbp mov rbp, rdi push rbx sub rsp, 10h mov rax, fs:28h mov [rsp+38h+var_30], rax xor eax, eax movups xmmword ptr [rdi], xmm0 mov rdx, [rsi] mov qword ptr [rdi+10h], 0 cmp [rsi+8], rdx jz short loc_17A0 mov r12, rsi xor edi, edi xor esi, esi xor ebx, ebx lea r14, [rsp+38h+var_34] jmp short loc_1777 loc_1750: mov [rsi], eax add rsi, 4 mov [rbp+8], rsi loc_175A: mov rax, [r12+8] add rbx, 1 sub rax, rdx sar rax, 2 cmp rbx, rax jnb short loc_17A0 mov rsi, [rbp+8] mov rdi, [rbp+10h] loc_1777: mov rcx, [r13+0] mov eax, [rdx+rbx*4] sub eax, [rcx+rbx*4] mov [rsp+38h+var_34], eax cmp rsi, rdi jnz short loc_1750 mov rdx, r14 mov rdi, rbp call _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_; std::vector<int>::_M_realloc_insert<int>(__gnu_cxx::__normal_iterator<int *,std::vector<int>>,int &&) mov rdx, [r12] jmp short loc_175A loc_17A0: mov rax, [rsp+38h+var_30] sub rax, fs:28h jnz short loc_17C0 add rsp, 10h mov rax, rbp pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_17C0: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0RKSt6vectorIiSaIiEES3__cold; func0(std::vector<int> const&,std::vector<int> const&) [clone]
long long func0(long long a1, long long *a2, _QWORD *a3) { long long v5; // rdx int *v7; // rdi int *v8; // rsi long long v9; // rbx int v10; // eax int v12; // [rsp+0h] [rbp-34h] BYREF unsigned long long v13; // [rsp+4h] [rbp-30h] v13 = __readfsqword(0x28u); *(_OWORD *)a1 = 0LL; v5 = *a2; *(_QWORD *)(a1 + 16) = 0LL; if ( a2[1] != v5 ) { v7 = 0LL; v8 = 0LL; v9 = 0LL; while ( 1 ) { v10 = *(_DWORD *)(v5 + 4 * v9) - *(_DWORD *)(*a3 + 4 * v9); v12 = v10; if ( v8 == v7 ) { std::vector<int>::_M_realloc_insert<int>(a1, v8, &v12); v5 = *a2; } else { *v8 = v10; *(_QWORD *)(a1 + 8) = v8 + 1; } if ( ++v9 >= (unsigned long long)((a2[1] - v5) >> 2) ) break; v8 = *(int **)(a1 + 8); v7 = *(int **)(a1 + 16); } } return a1; }
func0: ENDBR64 PUSH R14 PXOR XMM0,XMM0 PUSH R13 MOV R13,RDX PUSH R12 PUSH RBP MOV RBP,RDI PUSH RBX SUB RSP,0x10 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x8],RAX XOR EAX,EAX MOVUPS xmmword ptr [RDI],XMM0 MOV RDX,qword ptr [RSI] MOV qword ptr [RDI + 0x10],0x0 CMP qword ptr [RSI + 0x8],RDX JZ 0x001017a0 MOV R12,RSI XOR EDI,EDI XOR ESI,ESI XOR EBX,EBX LEA R14,[RSP + 0x4] JMP 0x00101777 LAB_00101750: MOV dword ptr [RSI],EAX ADD RSI,0x4 MOV qword ptr [RBP + 0x8],RSI LAB_0010175a: MOV RAX,qword ptr [R12 + 0x8] ADD RBX,0x1 SUB RAX,RDX SAR RAX,0x2 CMP RBX,RAX JNC 0x001017a0 MOV RSI,qword ptr [RBP + 0x8] MOV RDI,qword ptr [RBP + 0x10] LAB_00101777: MOV RCX,qword ptr [R13] MOV EAX,dword ptr [RDX + RBX*0x4] SUB EAX,dword ptr [RCX + RBX*0x4] MOV dword ptr [RSP + 0x4],EAX CMP RSI,RDI JNZ 0x00101750 MOV RDX,R14 MOV RDI,RBP LAB_00101790: CALL 0x001018f0 MOV RDX,qword ptr [R12] JMP 0x0010175a LAB_001017a0: MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x001017c0 ADD RSP,0x10 MOV RAX,RBP POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_001017c0: CALL 0x00101130
/* func0(std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&) */ vector * func0(vector *param_1,vector *param_2) { long *in_RDX; long lVar1; ulong uVar2; int *piVar3; int *piVar4; long in_FS_OFFSET; int local_34; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); *(int (*) [16])param_1 = (int [16])0x0; lVar1 = *(long *)param_2; *(int8 *)(param_1 + 0x10) = 0; if (*(long *)(param_2 + 8) != lVar1) { piVar4 = (int *)0x0; piVar3 = (int *)0x0; uVar2 = 0; while( true ) { local_34 = *(int *)(lVar1 + uVar2 * 4) - *(int *)(*in_RDX + uVar2 * 4); if (piVar3 == piVar4) { /* try { // try from 00101790 to 00101794 has its CatchHandler @ 001017c5 */ std::vector<int,std::allocator<int>>::_M_realloc_insert<int> ((vector<int,std::allocator<int>> *)param_1,(__normal_iterator)piVar3,&local_34); lVar1 = *(long *)param_2; } else { *piVar3 = local_34; *(int **)(param_1 + 8) = piVar3 + 1; } uVar2 = uVar2 + 1; if ((ulong)(*(long *)(param_2 + 8) - lVar1 >> 2) <= uVar2) break; piVar3 = *(int **)(param_1 + 8); piVar4 = *(int **)(param_1 + 0x10); } } if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,128
func0
#include <iostream> #include <assert.h>
bool func0(int n) { for (int i = 0; i < 10; ++i) { int temp = n; int count = 0; while (temp) { if (temp % 10 == i) { count++; } if (count > i) { return false; } temp /= 10; } } return true; }
int main() { assert(func0(1234) == true); assert(func0(51241) == false); assert(func0(321) == true); return 0; }
O0
cpp
func0(int): endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) movl $0x0,-0xc(%rbp) cmpl $0x9,-0xc(%rbp) jg 121f <_Z5func0i+0x96> mov -0x14(%rbp),%eax mov %eax,-0x8(%rbp) movl $0x0,-0x4(%rbp) cmpl $0x0,-0x8(%rbp) je 1216 <_Z5func0i+0x8d> mov -0x8(%rbp),%ecx movslq %ecx,%rax imul $0x66666667,%rax,%rax shr $0x20,%rax mov %eax,%edx sar $0x2,%edx mov %ecx,%eax sar $0x1f,%eax sub %eax,%edx mov %edx,%eax shl $0x2,%eax add %edx,%eax add %eax,%eax sub %eax,%ecx mov %ecx,%edx cmp %edx,-0xc(%rbp) jne 11e7 <_Z5func0i+0x5e> addl $0x1,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0xc(%rbp),%eax jle 11f6 <_Z5func0i+0x6d> mov $0x0,%eax jmp 1224 <_Z5func0i+0x9b> mov -0x8(%rbp),%eax movslq %eax,%rdx imul $0x66666667,%rdx,%rdx shr $0x20,%rdx sar $0x2,%edx sar $0x1f,%eax sub %eax,%edx mov %edx,%eax mov %eax,-0x8(%rbp) jmp 11ae <_Z5func0i+0x25> addl $0x1,-0xc(%rbp) jmpq 119b <_Z5func0i+0x12> mov $0x1,%eax pop %rbp retq
_Z5func0i: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_C], 0 jmp short loc_11D6 loc_115D: mov eax, [rbp+var_14] mov [rbp+var_8], eax mov [rbp+var_4], 0 jmp short loc_11CC loc_116C: mov ecx, [rbp+var_8] movsxd rax, ecx imul rax, 66666667h shr rax, 20h mov edx, eax sar edx, 2 mov eax, ecx sar eax, 1Fh sub edx, eax mov eax, edx shl eax, 2 add eax, edx add eax, eax sub ecx, eax mov edx, ecx cmp [rbp+var_C], edx jnz short loc_119F add [rbp+var_4], 1 loc_119F: mov eax, [rbp+var_4] cmp eax, [rbp+var_C] jle short loc_11AE mov eax, 0 jmp short loc_11E1 loc_11AE: mov eax, [rbp+var_8] movsxd rdx, eax imul rdx, 66666667h shr rdx, 20h mov ecx, edx sar ecx, 2 cdq mov eax, ecx sub eax, edx mov [rbp+var_8], eax loc_11CC: cmp [rbp+var_8], 0 jnz short loc_116C add [rbp+var_C], 1 loc_11D6: cmp [rbp+var_C], 9 jle short loc_115D mov eax, 1 loc_11E1: pop rbp retn
long long func0(int a1) { int i; // [rsp+8h] [rbp-Ch] int v3; // [rsp+Ch] [rbp-8h] int v4; // [rsp+10h] [rbp-4h] for ( i = 0; i <= 9; ++i ) { v3 = a1; v4 = 0; while ( v3 ) { if ( i == v3 % 10 ) ++v4; if ( v4 > i ) return 0LL; v3 /= 10; } } return 1LL; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0xc],0x0 JMP 0x001011d6 LAB_0010115d: MOV EAX,dword ptr [RBP + -0x14] MOV dword ptr [RBP + -0x8],EAX MOV dword ptr [RBP + -0x4],0x0 JMP 0x001011cc LAB_0010116c: MOV ECX,dword ptr [RBP + -0x8] MOVSXD RAX,ECX IMUL RAX,RAX,0x66666667 SHR RAX,0x20 MOV EDX,EAX SAR EDX,0x2 MOV EAX,ECX SAR EAX,0x1f SUB EDX,EAX MOV EAX,EDX SHL EAX,0x2 ADD EAX,EDX ADD EAX,EAX SUB ECX,EAX MOV EDX,ECX CMP dword ptr [RBP + -0xc],EDX JNZ 0x0010119f ADD dword ptr [RBP + -0x4],0x1 LAB_0010119f: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0xc] JLE 0x001011ae MOV EAX,0x0 JMP 0x001011e1 LAB_001011ae: MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX IMUL RDX,RDX,0x66666667 SHR RDX,0x20 MOV ECX,EDX SAR ECX,0x2 CDQ MOV EAX,ECX SUB EAX,EDX MOV dword ptr [RBP + -0x8],EAX LAB_001011cc: CMP dword ptr [RBP + -0x8],0x0 JNZ 0x0010116c ADD dword ptr [RBP + -0xc],0x1 LAB_001011d6: CMP dword ptr [RBP + -0xc],0x9 JLE 0x0010115d MOV EAX,0x1 LAB_001011e1: POP RBP RET
/* func0(int) */ int8 func0(int param_1) { int local_14; int local_10; int local_c; local_14 = 0; do { if (9 < local_14) { return 1; } local_c = 0; for (local_10 = param_1; local_10 != 0; local_10 = local_10 / 10) { if (local_14 == local_10 % 10) { local_c = local_c + 1; } if (local_14 < local_c) { return 0; } } local_14 = local_14 + 1; } while( true ); }
1,129
func0
#include <iostream> #include <assert.h>
bool func0(int n) { for (int i = 0; i < 10; ++i) { int temp = n; int count = 0; while (temp) { if (temp % 10 == i) { count++; } if (count > i) { return false; } temp /= 10; } } return true; }
int main() { assert(func0(1234) == true); assert(func0(51241) == false); assert(func0(321) == true); return 0; }
O1
cpp
func0(int): endbr64 mov $0x0,%esi mov %edi,%r8d test %edi,%edi je 11e8 <_Z5func0i+0x5f> mov %r8d,%edx mov $0x0,%ecx movslq %edx,%rax imul $0x66666667,%rax,%rax sar $0x22,%rax mov %edx,%r9d sar $0x1f,%r9d sub %r9d,%eax lea (%rax,%rax,4),%eax add %eax,%eax mov %edx,%r10d sub %eax,%r10d cmp %esi,%r10d sete %al movzbl %al,%eax add %eax,%ecx cmp %esi,%ecx jg 11f6 <_Z5func0i+0x6d> movslq %edx,%rax imul $0x66666667,%rax,%rax sar $0x22,%rax sub %r9d,%eax mov %eax,%edx jne 11a1 <_Z5func0i+0x18> add $0x1,%esi cmp $0xa,%esi jne 1195 <_Z5func0i+0xc> mov $0x1,%eax retq mov $0x0,%eax retq
_Z5func0i: endbr64 mov esi, 0 loc_1152: mov edx, edi mov ecx, 0 test edi, edi jz short loc_11A6 loc_115D: movsxd rax, edx imul rax, 66666667h sar rax, 22h mov r8d, edx sar r8d, 1Fh sub eax, r8d lea eax, [rax+rax*4] add eax, eax mov r8d, edx sub r8d, eax cmp r8d, esi setz al movzx eax, al add ecx, eax cmp ecx, esi jg short loc_11B4 movsxd rax, edx imul rax, 66666667h sar rax, 22h sar edx, 1Fh sub eax, edx mov edx, eax jnz short loc_115D loc_11A6: add esi, 1 cmp esi, 0Ah jnz short loc_1152 mov eax, 1 retn loc_11B4: mov eax, 0 retn
long long func0(int a1) { int v1; // esi int v2; // edx int v3; // ecx v1 = 0; while ( 1 ) { v2 = a1; v3 = 0; if ( a1 ) break; LABEL_5: if ( ++v1 == 10 ) return 1LL; } while ( 1 ) { v3 += v2 % 10 == v1; if ( v3 > v1 ) return 0LL; v2 /= 10; if ( !v2 ) goto LABEL_5; } }
func0: ENDBR64 MOV ESI,0x0 LAB_00101152: MOV EDX,EDI MOV ECX,0x0 TEST EDI,EDI JZ 0x001011a6 LAB_0010115d: MOVSXD RAX,EDX IMUL RAX,RAX,0x66666667 SAR RAX,0x22 MOV R8D,EDX SAR R8D,0x1f SUB EAX,R8D LEA EAX,[RAX + RAX*0x4] ADD EAX,EAX MOV R8D,EDX SUB R8D,EAX CMP R8D,ESI SETZ AL MOVZX EAX,AL ADD ECX,EAX CMP ECX,ESI JG 0x001011b4 MOVSXD RAX,EDX IMUL RAX,RAX,0x66666667 SAR RAX,0x22 SAR EDX,0x1f SUB EAX,EDX MOV EDX,EAX JNZ 0x0010115d LAB_001011a6: ADD ESI,0x1 CMP ESI,0xa JNZ 0x00101152 MOV EAX,0x1 RET LAB_001011b4: MOV EAX,0x0 RET
/* func0(int) */ int8 func0(int param_1) { int iVar1; int iVar2; int iVar3; iVar3 = 0; do { iVar1 = 0; iVar2 = param_1; if (param_1 != 0) { do { iVar1 = iVar1 + (uint)(iVar2 % 10 == iVar3); if (iVar3 < iVar1) { return 0; } iVar2 = iVar2 / 10; } while (iVar2 != 0); } iVar3 = iVar3 + 1; } while (iVar3 != 10); return 1; }
1,130
func0
#include <iostream> #include <assert.h>
bool func0(int n) { for (int i = 0; i < 10; ++i) { int temp = n; int count = 0; while (temp) { if (temp % 10 == i) { count++; } if (count > i) { return false; } temp /= 10; } } return true; }
int main() { assert(func0(1234) == true); assert(func0(51241) == false); assert(func0(321) == true); return 0; }
O2
cpp
func0(int): endbr64 xor %r8d,%r8d test %edi,%edi je 13a0 <_Z5func0i+0x50> mov %edi,%edx xor %esi,%esi jmp 136e <_Z5func0i+0x1e> nopl 0x0(%rax) mov %eax,%edx test %eax,%eax je 13a0 <_Z5func0i+0x50> movslq %edx,%rax mov %edx,%ecx imul $0x66666667,%rax,%rax sar $0x1f,%ecx sar $0x22,%rax sub %ecx,%eax lea (%rax,%rax,4),%ecx add %ecx,%ecx sub %ecx,%edx cmp %r8d,%edx sete %dl movzbl %dl,%edx add %edx,%esi cmp %r8d,%esi jle 1368 <_Z5func0i+0x18> xor %eax,%eax retq nopl (%rax) add $0x1,%r8d cmp $0xa,%r8d jne 1357 <_Z5func0i+0x7> mov $0x1,%eax retq
_Z5func0i: endbr64 xor r8d, r8d test edi, edi jz short loc_1250 loc_11FB: mov edx, edi xor esi, esi jmp short loc_120E loc_1208: mov edx, eax test eax, eax jz short loc_1240 loc_120E: movsxd rax, edx mov ecx, edx imul rax, 66666667h sar ecx, 1Fh sar rax, 22h sub eax, ecx lea ecx, [rax+rax*4] add ecx, ecx sub edx, ecx cmp edx, r8d setz dl movzx edx, dl add esi, edx cmp r8d, esi jge short loc_1208 xor eax, eax retn loc_1240: add r8d, 1 cmp r8d, 0Ah jnz short loc_11FB loc_124A: mov eax, 1 retn loc_1250: add r8d, 1 cmp r8d, 0Ah jnz short loc_1250 jmp short loc_124A
long long func0(int a1) { int v1; // r8d int v2; // edx int v3; // esi int v4; // eax v1 = 0; if ( a1 ) { do { v2 = a1; v3 = 0; do { v4 = v2 / 10; v3 += v2 % 10 == v1; if ( v1 < v3 ) return 0LL; v2 /= 10; } while ( v4 ); ++v1; } while ( v1 != 10 ); } else { do ++v1; while ( v1 != 10 ); } return 1LL; }
func0: ENDBR64 XOR R8D,R8D TEST EDI,EDI JZ 0x00101250 LAB_001011fb: MOV EDX,EDI XOR ESI,ESI JMP 0x0010120e LAB_00101208: MOV EDX,EAX TEST EAX,EAX JZ 0x00101240 LAB_0010120e: MOVSXD RAX,EDX MOV ECX,EDX IMUL RAX,RAX,0x66666667 SAR ECX,0x1f SAR RAX,0x22 SUB EAX,ECX LEA ECX,[RAX + RAX*0x4] ADD ECX,ECX SUB EDX,ECX CMP EDX,R8D SETZ DL MOVZX EDX,DL ADD ESI,EDX CMP R8D,ESI JGE 0x00101208 XOR EAX,EAX RET LAB_00101240: ADD R8D,0x1 CMP R8D,0xa JNZ 0x001011fb LAB_0010124a: MOV EAX,0x1 RET LAB_00101250: ADD R8D,0x1 CMP R8D,0xa JNZ 0x00101250 JMP 0x0010124a
/* func0(int) */ int8 func0(int param_1) { int iVar1; int iVar2; int iVar3; int iVar4; iVar4 = 0; if (param_1 == 0) { do { iVar4 = iVar4 + 1; } while (iVar4 != 10); } else { do { iVar3 = 0; iVar2 = param_1; do { iVar1 = iVar2 / 10; iVar3 = iVar3 + (uint)(iVar2 % 10 == iVar4); if (iVar4 < iVar3) { return 0; } iVar2 = iVar1; } while (iVar1 != 0); iVar4 = iVar4 + 1; } while (iVar4 != 10); } return 1; }
1,131
func0
#include <iostream> #include <assert.h>
bool func0(int n) { for (int i = 0; i < 10; ++i) { int temp = n; int count = 0; while (temp) { if (temp % 10 == i) { count++; } if (count > i) { return false; } temp /= 10; } } return true; }
int main() { assert(func0(1234) == true); assert(func0(51241) == false); assert(func0(321) == true); return 0; }
O3
cpp
func0(int): endbr64 xor %r8d,%r8d test %edi,%edi je 12b0 <_Z5func0i+0x50> mov %edi,%edx xor %esi,%esi jmp 127e <_Z5func0i+0x1e> nopl 0x0(%rax) mov %eax,%edx test %eax,%eax je 12b0 <_Z5func0i+0x50> movslq %edx,%rax mov %edx,%ecx imul $0x66666667,%rax,%rax sar $0x1f,%ecx sar $0x22,%rax sub %ecx,%eax lea (%rax,%rax,4),%ecx add %ecx,%ecx sub %ecx,%edx cmp %r8d,%edx sete %dl movzbl %dl,%edx add %edx,%esi cmp %r8d,%esi jle 1278 <_Z5func0i+0x18> xor %eax,%eax retq nopl (%rax) add $0x1,%r8d cmp $0xa,%r8d jne 1267 <_Z5func0i+0x7> mov $0x1,%eax retq
_Z5func0i: endbr64 xor r8d, r8d test edi, edi jz short loc_1220 loc_11CB: mov edx, edi xor esi, esi jmp short loc_11DE loc_11D8: mov edx, eax test eax, eax jz short loc_1210 loc_11DE: movsxd rax, edx mov ecx, edx imul rax, 66666667h sar ecx, 1Fh sar rax, 22h sub eax, ecx lea ecx, [rax+rax*4] add ecx, ecx sub edx, ecx cmp edx, r8d setz dl movzx edx, dl add esi, edx cmp r8d, esi jge short loc_11D8 xor eax, eax retn loc_1210: add r8d, 1 cmp r8d, 0Ah jnz short loc_11CB loc_121A: mov eax, 1 retn loc_1220: add r8d, 1 cmp r8d, 0Ah jnz short loc_1220 jmp short loc_121A
long long func0(int a1) { int v1; // r8d int v2; // edx int v3; // esi int v4; // eax v1 = 0; if ( a1 ) { do { v2 = a1; v3 = 0; do { v4 = v2 / 10; v3 += v2 % 10 == v1; if ( v1 < v3 ) return 0LL; v2 /= 10; } while ( v4 ); ++v1; } while ( v1 != 10 ); } else { do ++v1; while ( v1 != 10 ); } return 1LL; }
func0: ENDBR64 XOR R8D,R8D TEST EDI,EDI JZ 0x00101220 LAB_001011cb: MOV EDX,EDI XOR ESI,ESI JMP 0x001011de LAB_001011d8: MOV EDX,EAX TEST EAX,EAX JZ 0x00101210 LAB_001011de: MOVSXD RAX,EDX MOV ECX,EDX IMUL RAX,RAX,0x66666667 SAR ECX,0x1f SAR RAX,0x22 SUB EAX,ECX LEA ECX,[RAX + RAX*0x4] ADD ECX,ECX SUB EDX,ECX CMP EDX,R8D SETZ DL MOVZX EDX,DL ADD ESI,EDX CMP R8D,ESI JGE 0x001011d8 XOR EAX,EAX RET LAB_00101210: ADD R8D,0x1 CMP R8D,0xa JNZ 0x001011cb LAB_0010121a: MOV EAX,0x1 RET LAB_00101220: ADD R8D,0x1 CMP R8D,0xa JNZ 0x00101220 JMP 0x0010121a
/* func0(int) */ int8 func0(int param_1) { int iVar1; int iVar2; int iVar3; int iVar4; iVar4 = 0; if (param_1 == 0) { do { iVar4 = iVar4 + 1; } while (iVar4 != 10); } else { do { iVar3 = 0; iVar2 = param_1; do { iVar1 = iVar2 / 10; iVar3 = iVar3 + (uint)(iVar2 % 10 == iVar4); if (iVar4 < iVar3) { return 0; } iVar2 = iVar1; } while (iVar1 != 0); iVar4 = iVar4 + 1; } while (iVar4 != 10); } return 1; }
1,132
func0
#include <vector> #include <string> #include <assert.h> template<typename T>
bool func0(const std::vector<T>& list, const T& element) { for (const auto& v : list) { if (v != element) { return false; } } return true; }
int main() { assert(func0(std::vector<std::string>{"green", "orange", "black", "white"}, std::string("blue")) == false); assert(func0(std::vector<int>{1, 2, 3, 4}, 7) == false); assert(func0(std::vector<std::string>{"green", "green", "green", "green"}, std::string("green")) == true); return 0; }
O0
cpp
bool func0<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<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 sub $0x40,%rsp mov %rdi,-0x38(%rbp) mov %rsi,-0x40(%rbp) mov %fs:0x28,%rax mov %rax,-0x8(%rbp) xor %eax,%eax mov -0x38(%rbp),%rax mov %rax,-0x18(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 3508 <_ZNKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE5beginEv> mov %rax,-0x28(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 3560 <_ZNKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE3endEv> mov %rax,-0x20(%rbp) lea -0x20(%rbp),%rdx lea -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 35b8 <_ZN9__gnu_cxxneIPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESH_> test %al,%al je 3096 <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x9e> lea -0x28(%rbp),%rax mov %rax,%rdi callq 361c <_ZNK9__gnu_cxx17__normal_iteratorIPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEdeEv> mov %rax,-0x10(%rbp) mov -0x40(%rbp),%rdx mov -0x10(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 3631 <_ZStneIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_> test %al,%al je 3088 <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x90> mov $0x0,%eax jmp 309b <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0xa3> lea -0x28(%rbp),%rax mov %rax,%rdi callq 35f8 <_ZN9__gnu_cxx17__normal_iteratorIPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEppEv> jmp 3043 <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x4b> mov $0x1,%eax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 30af <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0xb7> callq 2340 <__stack_chk_fail@plt> leaveq retq
_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_: endbr64 push rbp mov rbp, rsp sub rsp, 40h mov [rbp+var_38], rdi mov [rbp+var_40], rsi mov rax, fs:28h mov [rbp+var_8], rax xor eax, eax mov rax, [rbp+var_38] mov [rbp+var_18], rax mov rax, [rbp+var_18] mov rdi, rax call _ZNKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE5beginEv; std::vector<std::string>::begin(void) mov [rbp+var_28], rax mov rax, [rbp+var_18] mov rdi, rax call _ZNKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE3endEv; std::vector<std::string>::end(void) mov [rbp+var_20], rax jmp short loc_2FE1 loc_2FA7: lea rax, [rbp+var_28] mov rdi, rax call _ZNK9__gnu_cxx17__normal_iteratorIPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEdeEv; __gnu_cxx::__normal_iterator<std::string const*,std::vector<std::string>>::operator*(void) mov [rbp+var_10], rax mov rdx, [rbp+var_40] mov rax, [rbp+var_10] mov rsi, rdx mov rdi, rax call _ZStneIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_; std::operator!=<char>(std::string const&,std::string const&) test al, al jz short loc_2FD5 mov eax, 0 jmp short loc_2FFD loc_2FD5: lea rax, [rbp+var_28] mov rdi, rax call _ZN9__gnu_cxx17__normal_iteratorIPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEppEv; __gnu_cxx::__normal_iterator<std::string const*,std::vector<std::string>>::operator++(void) loc_2FE1: lea rdx, [rbp+var_20] lea rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call _ZN9__gnu_cxxneIPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESH_; __gnu_cxx::operator!=<std::string const*,std::vector<std::string>>(__gnu_cxx::__normal_iterator<std::string const*,std::vector<std::string>> const&,__gnu_cxx::__normal_iterator<std::string const*,std::vector<std::string>> const&) test al, al jnz short loc_2FA7 mov eax, 1 loc_2FFD: mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_3011 call ___stack_chk_fail locret_3011: leave retn
long long func0<std::string>(long long a1, long long a2) { long long v3; // [rsp+18h] [rbp-28h] BYREF _QWORD v4[2]; // [rsp+20h] [rbp-20h] BYREF long long v5; // [rsp+30h] [rbp-10h] unsigned long long v6; // [rsp+38h] [rbp-8h] v6 = __readfsqword(0x28u); v4[1] = a1; v3 = std::vector<std::string>::begin(a1); v4[0] = std::vector<std::string>::end(a1); while ( (unsigned __int8)__gnu_cxx::operator!=<std::string const*,std::vector<std::string>>(&v3, v4) ) { v5 = __gnu_cxx::__normal_iterator<std::string const*,std::vector<std::string>>::operator*(&v3); if ( (unsigned __int8)std::operator!=<char>(v5, a2) ) return 0LL; __gnu_cxx::__normal_iterator<std::string const*,std::vector<std::string>>::operator++(&v3); } return 1LL; }
func0<std::string>: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x40 MOV qword ptr [RBP + -0x38],RDI MOV qword ptr [RBP + -0x40],RSI 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 + -0x18],RAX MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x0010358a MOV qword ptr [RBP + -0x28],RAX MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x001035d6 MOV qword ptr [RBP + -0x20],RAX JMP 0x00102fe1 LAB_00102fa7: LEA RAX,[RBP + -0x28] MOV RDI,RAX CALL 0x0010368a MOV qword ptr [RBP + -0x10],RAX MOV RDX,qword ptr [RBP + -0x40] MOV RAX,qword ptr [RBP + -0x10] MOV RSI,RDX MOV RDI,RAX CALL 0x0010369f TEST AL,AL JZ 0x00102fd5 MOV EAX,0x0 JMP 0x00102ffd LAB_00102fd5: LEA RAX,[RBP + -0x28] MOV RDI,RAX CALL 0x00103666 LAB_00102fe1: LEA RDX,[RBP + -0x20] LEA RAX,[RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x00103626 TEST AL,AL JNZ 0x00102fa7 MOV EAX,0x1 LAB_00102ffd: MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x00103011 CALL 0x00102330 LAB_00103011: LEAVE RET
/* bool func0<std::string >(std::vector<std::string, std::allocator<std::string > > const&, std::string const&) */ bool func0<std::string>(vector *param_1,string *param_2) { bool bVar1; long in_FS_OFFSET; int8 local_30; int8 local_28; vector<std::string,std::allocator<std::string>> *local_20; string *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_20 = (vector<std::string,std::allocator<std::string>> *)param_1; local_30 = std::vector<std::string,std::allocator<std::string>>::begin ((vector<std::string,std::allocator<std::string>> *)param_1); local_28 = std::vector<std::string,std::allocator<std::string>>::end(local_20); do { bVar1 = operator!=((__normal_iterator *)&local_30,(__normal_iterator *)&local_28); if (!bVar1) { bVar1 = true; LAB_00102ffd: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return bVar1; } local_18 = (string *) __normal_iterator<std::string_const*,std::vector<std::string,std::allocator<std::string>>> ::operator*((__normal_iterator<std::string_const*,std::vector<std::string,std::allocator<std::string>>> *)&local_30); bVar1 = std::operator!=(local_18,param_2); if (bVar1) { bVar1 = false; goto LAB_00102ffd; } __normal_iterator<std::string_const*,std::vector<std::string,std::allocator<std::string>>>:: operator++((__normal_iterator<std::string_const*,std::vector<std::string,std::allocator<std::string>>> *)&local_30); } while( true ); }
1,133
func0
#include <vector> #include <string> #include <assert.h> template<typename T>
bool func0(const std::vector<T>& list, const T& element) { for (const auto& v : list) { if (v != element) { return false; } } return true; }
int main() { assert(func0(std::vector<std::string>{"green", "orange", "black", "white"}, std::string("blue")) == false); assert(func0(std::vector<int>{1, 2, 3, 4}, 7) == false); assert(func0(std::vector<std::string>{"green", "green", "green", "green"}, std::string("green")) == true); return 0; }
O1
cpp
bool func0<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<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 %r13 push %r12 push %rbp push %rbx sub $0x8,%rsp mov (%rdi),%rbx mov 0x8(%rdi),%rbp cmp %rbp,%rbx je 197d <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x61> mov %rsi,%r13 mov 0x8(%rsi),%r12 jmp 195d <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x41> mov 0x0(%r13),%rsi mov (%rbx),%rdi test %rdx,%rdx je 1954 <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x38> callq 1120 <memcmp@plt> test %eax,%eax jne 1984 <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x68> add $0x20,%rbx cmp %rbx,%rbp je 1976 <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x5a> mov 0x8(%rbx),%rdx cmp %r12,%rdx je 193f <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x23> mov $0x0,%eax add $0x8,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq mov $0x1,%eax jmp 196b <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x4f> mov $0x1,%eax jmp 196b <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x4f> mov $0x0,%eax jmp 196b <_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_+0x4f> nopl 0x0(%rax,%rax,1)
_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov rbx, [rdi] mov rbp, [rdi+8] cmp rbp, rbx jz short loc_1B03 mov r13, rsi mov r12, [rsi+8] jmp short loc_1AE3 loc_1AC5: test rdx, rdx jz short loc_1ADA mov rsi, [r13+0]; s2 mov rdi, [rbx]; s1 call _memcmp test eax, eax jnz short loc_1B0A loc_1ADA: add rbx, 20h ; ' ' cmp rbp, rbx jz short loc_1AFC loc_1AE3: mov rdx, [rbx+8]; n cmp rdx, r12 jz short loc_1AC5 mov eax, 0 loc_1AF1: add rsp, 8 pop rbx pop rbp pop r12 pop r13 retn loc_1AFC: mov eax, 1 jmp short loc_1AF1 loc_1B03: mov eax, 1 jmp short loc_1AF1 loc_1B0A: mov eax, 0 jmp short loc_1AF1
long long func0<std::string>(long long *a1, long long a2) { long long v2; // rbx long long v3; // rbp long long v4; // r12 size_t v5; // rdx v2 = *a1; v3 = a1[1]; if ( v3 == *a1 ) return 1LL; v4 = *(_QWORD *)(a2 + 8); while ( 1 ) { v5 = *(_QWORD *)(v2 + 8); if ( v5 != v4 ) return 0LL; if ( v5 && memcmp(*(const void **)v2, *(const void **)a2, v5) ) break; v2 += 32LL; if ( v3 == v2 ) return 1LL; } return 0LL; }
func0<std::string>: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBX,qword ptr [RDI] MOV RBP,qword ptr [RDI + 0x8] CMP RBP,RBX JZ 0x00101b03 MOV R13,RSI MOV R12,qword ptr [RSI + 0x8] JMP 0x00101ae3 LAB_00101ac5: TEST RDX,RDX JZ 0x00101ada MOV RSI,qword ptr [R13] MOV RDI,qword ptr [RBX] CALL 0x00101150 TEST EAX,EAX JNZ 0x00101b0a LAB_00101ada: ADD RBX,0x20 CMP RBP,RBX JZ 0x00101afc LAB_00101ae3: MOV RDX,qword ptr [RBX + 0x8] CMP RDX,R12 JZ 0x00101ac5 MOV EAX,0x0 LAB_00101af1: ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET LAB_00101afc: MOV EAX,0x1 JMP 0x00101af1 LAB_00101b03: MOV EAX,0x1 JMP 0x00101af1 LAB_00101b0a: MOV EAX,0x0 JMP 0x00101af1
/* bool func0<std::string >(std::vector<std::string, std::allocator<std::string > > const&, std::string const&) */ bool func0<std::string>(vector *param_1,string *param_2) { int8 *puVar1; size_t sVar2; size_t __n; int iVar3; int8 *puVar4; puVar4 = *(int8 **)param_1; puVar1 = *(int8 **)(param_1 + 8); if (puVar1 != puVar4) { sVar2 = *(size_t *)(param_2 + 8); do { __n = puVar4[1]; if (__n != sVar2) { return false; } if ((__n != 0) && (iVar3 = memcmp((void *)*puVar4,*(void **)param_2,__n), iVar3 != 0)) { return false; } puVar4 = puVar4 + 4; } while (puVar1 != puVar4); } return true; }
1,134
func0
#include <vector> #include <string> #include <assert.h> template<typename T>
bool func0(const std::vector<T>& list, const T& element) { for (const auto& v : list) { if (v != element) { return false; } } return true; }
int main() { assert(func0(std::vector<std::string>{"green", "orange", "black", "white"}, std::string("blue")) == false); assert(func0(std::vector<int>{1, 2, 3, 4}, 7) == false); assert(func0(std::vector<std::string>{"green", "green", "green", "green"}, std::string("green")) == true); return 0; }
O2
cpp
_Z5func0INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEbRKSt6vectorIT_SaIS7_EERKS7_: endbr64 push r13 push r12 push rbp push rbx sub rsp, 8 mov rbx, [rdi] mov r12, [rdi+8] cmp r12, rbx jz short loc_18A1 mov rbp, [rsi+8] mov r13, rsi nop dword ptr [rax+00000000h] loc_1868: cmp [rbx+8], rbp jz short loc_1880 loc_186E: add rsp, 8 xor eax, eax pop rbx pop rbp pop r12 pop r13 retn loc_1880: test rbp, rbp jz short loc_1898 mov rsi, [r13+0]; s2 mov rdi, [rbx]; s1 mov rdx, rbp; n call _memcmp test eax, eax jnz short loc_186E loc_1898: add rbx, 20h ; ' ' cmp r12, rbx jnz short loc_1868 loc_18A1: add rsp, 8 mov eax, 1 pop rbx pop rbp pop r12 pop r13 retn
long long func0<std::string>(long long *a1, long long a2) { long long v2; // rbx long long v3; // r12 size_t v4; // rbp v2 = *a1; v3 = a1[1]; if ( v3 == *a1 ) return 1LL; v4 = *(_QWORD *)(a2 + 8); while ( *(_QWORD *)(v2 + 8) == v4 && (!v4 || !memcmp(*(const void **)v2, *(const void **)a2, v4)) ) { v2 += 32LL; if ( v3 == v2 ) return 1LL; } return 0LL; }
func0<std::string>: ENDBR64 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x8 MOV RBX,qword ptr [RDI] MOV R12,qword ptr [RDI + 0x8] CMP R12,RBX JZ 0x001018a1 MOV RBP,qword ptr [RSI + 0x8] MOV R13,RSI NOP dword ptr [RAX] LAB_00101868: CMP qword ptr [RBX + 0x8],RBP JZ 0x00101880 LAB_0010186e: ADD RSP,0x8 XOR EAX,EAX POP RBX POP RBP POP R12 POP R13 RET LAB_00101880: TEST RBP,RBP JZ 0x00101898 MOV RSI,qword ptr [R13] MOV RDI,qword ptr [RBX] MOV RDX,RBP CALL 0x00101150 TEST EAX,EAX JNZ 0x0010186e LAB_00101898: ADD RBX,0x20 CMP R12,RBX JNZ 0x00101868 LAB_001018a1: ADD RSP,0x8 MOV EAX,0x1 POP RBX POP RBP POP R12 POP R13 RET
/* bool func0<std::string >(std::vector<std::string, std::allocator<std::string > > const&, std::string const&) */ bool func0<std::string>(vector *param_1,string *param_2) { int8 *puVar1; size_t __n; int iVar2; int8 *puVar3; puVar3 = *(int8 **)param_1; puVar1 = *(int8 **)(param_1 + 8); if (puVar1 != puVar3) { __n = *(size_t *)(param_2 + 8); do { if (puVar3[1] != __n) { return false; } if ((__n != 0) && (iVar2 = memcmp((void *)*puVar3,*(void **)param_2,__n), iVar2 != 0)) { return false; } puVar3 = puVar3 + 4; } while (puVar1 != puVar3); } return true; }
1,135
func0
#include <vector> #include <string> #include <assert.h> template<typename T>
bool func0(const std::vector<T>& list, const T& element) { for (const auto& v : list) { if (v != element) { return false; } } return true; }
int main() { assert(func0(std::vector<std::string>{"green", "orange", "black", "white"}, std::string("blue")) == false); assert(func0(std::vector<int>{1, 2, 3, 4}, 7) == false); assert(func0(std::vector<std::string>{"green", "green", "green", "green"}, std::string("green")) == true); return 0; }
O3
cpp
1,136
func0
#include <iostream> #include <regex> #include <string> #include <cassert>
std::string func0(const std::string &text) { std::regex pattern("ab{2,3}"); if (std::regex_search(text, pattern)) { return "Found a match!"; } else { return "Not matched!"; } }
int main() { assert(func0("ac") == "Not matched!"); assert(func0("dc") == "Not matched!"); assert(func0("abbbba") == "Found a match!"); 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 $0x58,%rsp mov %rdi,-0x58(%rbp) mov %rsi,-0x60(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax lea -0x40(%rbp),%rax mov $0x10,%edx lea 0x2b3ec(%rip),%rsi mov %rax,%rdi callq 7170 <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEEC1EPKcNSt15regex_constants18syntax_option_typeE> lea -0x40(%rbp),%rcx mov -0x60(%rbp),%rax mov $0x0,%edx mov %rcx,%rsi mov %rax,%rdi callq 722d <_ZSt12regex_searchISt11char_traitsIcESaIcEcNSt7__cxx1112regex_traitsIcEEEbRKNS3_12basic_stringIT1_T_T0_EERKNS3_11basic_regexIS7_T2_EENSt15regex_constants15match_flag_typeE> test %al,%al je 5cf2 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x89> lea -0x41(%rbp),%rax mov %rax,%rdi callq 5af0 <_ZNSaIcEC1Ev@plt> lea -0x41(%rbp),%rdx mov -0x58(%rbp),%rax lea 0x2b3b5(%rip),%rsi mov %rax,%rdi callq 727e <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_> lea -0x41(%rbp),%rax mov %rax,%rdi callq 58f0 <_ZNSaIcED1Ev@plt> jmp 5d21 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xb8> lea -0x41(%rbp),%rax mov %rax,%rdi callq 5af0 <_ZNSaIcEC1Ev@plt> lea -0x41(%rbp),%rdx mov -0x58(%rbp),%rax lea 0x2b393(%rip),%rsi mov %rax,%rdi callq 727e <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_> lea -0x41(%rbp),%rax mov %rax,%rdi callq 58f0 <_ZNSaIcED1Ev@plt> lea -0x40(%rbp),%rax mov %rax,%rdi callq 71fa <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED1Ev> mov -0x18(%rbp),%rax xor %fs:0x28,%rax je 5d8b <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x122> jmp 5d86 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x11d> endbr64 mov %rax,%rbx lea -0x41(%rbp),%rax mov %rax,%rdi callq 58f0 <_ZNSaIcED1Ev@plt> jmp 5d6f <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x106> endbr64 mov %rax,%rbx lea -0x41(%rbp),%rax mov %rax,%rdi callq 58f0 <_ZNSaIcED1Ev@plt> jmp 5d6f <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x106> endbr64 mov %rax,%rbx lea -0x40(%rbp),%rax mov %rax,%rdi callq 71fa <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 5ae0 <_Unwind_Resume@plt> callq 5940 <__stack_chk_fail@plt> mov -0x58(%rbp),%rax add $0x58,%rsp pop %rbx pop %rbp retq
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: 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_40] mov edx, 10h lea rcx, aAb23; "ab{2,3}" 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) lea rcx, [rbp+var_40] mov rax, [rbp+var_70] mov edx, 0 mov rsi, rcx mov rdi, rax call _ZSt12regex_searchISt11char_traitsIcESaIcEcNSt7__cxx1112regex_traitsIcEEEbRKNS3_12basic_stringIT1_T_T0_EERKNS3_11basic_regexIS7_T2_EENSt15regex_constants15match_flag_typeE; std::regex_search<std::char_traits<char>,std::allocator<char>,char,std::regex_traits<char>>(std::string const&,std::basic_regex<char,std::regex_traits<char>> const&,std::regex_constants::match_flag_type) test al, al jz short loc_4B96 lea rax, [rbp+var_51] mov [rbp+var_50], rax nop nop lea rdx, [rbp+var_51] mov rax, [rbp+var_68] lea rcx, aFoundAMatch; "Found a match!" mov rsi, rcx mov rdi, rax call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_; std::string::basic_string<std::allocator<char>>(char const*,std::allocator<char> const&) lea rax, [rbp+var_51] mov rdi, rax call _ZNSt15__new_allocatorIcED2Ev; std::__new_allocator<char>::~__new_allocator() jmp short loc_4BC7 loc_4B96: lea rax, [rbp+var_51] mov [rbp+var_48], rax nop nop lea rdx, [rbp+var_51] mov rax, [rbp+var_68] lea rcx, aNotMatched; "Not matched!" mov rsi, rcx mov rdi, rax call _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_; std::string::basic_string<std::allocator<char>>(char const*,std::allocator<char> const&) lea rax, [rbp+var_51] mov rdi, rax call _ZNSt15__new_allocatorIcED2Ev; std::__new_allocator<char>::~__new_allocator() nop loc_4BC7: 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, [rbp+var_18] sub rax, fs:28h jz short loc_4C47 jmp short loc_4C42 endbr64 mov rbx, rax lea rax, [rbp+var_51] mov rdi, rax call _ZNSt15__new_allocatorIcED2Ev; std::__new_allocator<char>::~__new_allocator() nop jmp short loc_4C17 endbr64 mov rbx, rax lea rax, [rbp+var_51] mov rdi, rax call _ZNSt15__new_allocatorIcED2Ev; std::__new_allocator<char>::~__new_allocator() nop jmp short loc_4C17 endbr64 mov rbx, rax loc_4C17: 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_4C3A call ___stack_chk_fail loc_4C3A: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_4C42: call ___stack_chk_fail loc_4C47: mov rax, [rbp+var_68] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, long long a2) { char v3; // [rsp+1Fh] [rbp-51h] BYREF char *v4; // [rsp+20h] [rbp-50h] char *v5; // [rsp+28h] [rbp-48h] _BYTE v6[40]; // [rsp+30h] [rbp-40h] BYREF unsigned long long v7; // [rsp+58h] [rbp-18h] v7 = __readfsqword(0x28u); std::basic_regex<char,std::regex_traits<char>>::basic_regex(v6, "ab{2,3}", 16LL); if ( (unsigned __int8)std::regex_search<std::char_traits<char>,std::allocator<char>,char,std::regex_traits<char>>( a2, v6, 0LL) ) { v4 = &v3; std::string::basic_string<std::allocator<char>>(a1, "Found a match!", &v3); } else { v5 = &v3; std::string::basic_string<std::allocator<char>>(a1, "Not matched!", &v3); } std::__new_allocator<char>::~__new_allocator(&v3); std::basic_regex<char,std::regex_traits<char>>::~basic_regex(v6); 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 + -0x40] MOV EDX,0x10 LEA RCX,[0x132051] MOV RSI,RCX MOV RDI,RAX LAB_00104b43: CALL 0x001061ba LEA RCX,[RBP + -0x40] MOV RAX,qword ptr [RBP + -0x70] MOV EDX,0x0 MOV RSI,RCX MOV RDI,RAX LAB_00104b5b: CALL 0x0010628b TEST AL,AL JZ 0x00104b96 LEA RAX,[RBP + -0x51] MOV qword ptr [RBP + -0x50],RAX NOP NOP LEA RDX,[RBP + -0x51] MOV RAX,qword ptr [RBP + -0x68] LEA RCX,[0x132059] MOV RSI,RCX MOV RDI,RAX LAB_00104b83: CALL 0x001062dc LEA RAX,[RBP + -0x51] MOV RDI,RAX CALL 0x00106424 JMP 0x00104bc7 LAB_00104b96: LEA RAX,[RBP + -0x51] MOV qword ptr [RBP + -0x48],RAX NOP NOP LEA RDX,[RBP + -0x51] MOV RAX,qword ptr [RBP + -0x68] LEA RCX,[0x132068] MOV RSI,RCX MOV RDI,RAX LAB_00104bb5: CALL 0x001062dc LEA RAX,[RBP + -0x51] MOV RDI,RAX CALL 0x00106424 NOP LAB_00104bc7: LEA RAX,[RBP + -0x40] MOV RDI,RAX CALL 0x00106258 MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x00104c47 JMP 0x00104c42 LAB_00104c42: CALL 0x00104840 LAB_00104c47: MOV RAX,qword ptr [RBP + -0x68] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::string const&) */ string * func0(string *param_1) { bool bVar1; string *in_RSI; long in_FS_OFFSET; allocator local_59; allocator *local_58; allocator *local_50; regex local_48 [40]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); std::regex::basic_regex(local_48,"ab{2,3}",0x10); /* try { // try from 00104b5b to 00104b5f has its CatchHandler @ 00104c10 */ bVar1 = std:: regex_search<std::char_traits<char>,std::allocator<char>,char,std::regex_traits<char>> (in_RSI,local_48,0); if (bVar1) { local_58 = &local_59; /* try { // try from 00104b83 to 00104b87 has its CatchHandler @ 00104be4 */ std::string::string<std::allocator<char>>(param_1,"Found a match!",&local_59); std::__new_allocator<char>::~__new_allocator((__new_allocator<char> *)&local_59); } else { local_50 = &local_59; /* try { // try from 00104bb5 to 00104bb9 has its CatchHandler @ 00104bfa */ std::string::string<std::allocator<char>>(param_1,"Not matched!",&local_59); std::__new_allocator<char>::~__new_allocator((__new_allocator<char> *)&local_59); } 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; }
1,137
func0
#include <iostream> #include <regex> #include <string> #include <cassert>
std::string func0(const std::string &text) { std::regex pattern("ab{2,3}"); if (std::regex_search(text, pattern)) { return "Found a match!"; } else { return "Not matched!"; } }
int main() { assert(func0("ac") == "Not matched!"); assert(func0("dc") == "Not matched!"); assert(func0("abbbba") == "Found a match!"); 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 $0x58,%rsp mov %rdi,%rbx mov %rsi,%rbp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax lea 0x20(%rsp),%r13 mov %r13,%rdi callq 4730 <_ZNSt6localeC1Ev@plt> movl $0x10,(%rsp) lea 0x8(%rsp),%r12 mov %r13,%rsi mov %r12,%rdi callq 44d0 <_ZNSt6localeC1ERKS_@plt> lea 0x10(%rsp),%rdi mov (%rsp),%r8d mov %r12,%rcx lea 0x14e3a(%rip),%rdx lea -0x7(%rdx),%rsi callq 1819d <_ZNSt8__detail13__compile_nfaINSt7__cxx1112regex_traitsIcEEPKcEENSt9enable_ifIXsrNS_20__is_contiguous_iterIT0_EE5valueESt10shared_ptrIKNS_4_NFAIT_EEEE4typeES8_S8_RKNSC_11locale_typeENSt15regex_constants18syntax_option_typeE> jmp 48b2 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x89> endbr64 mov %rax,%rbx lea 0x8(%rsp),%rdi callq 4660 <_ZNSt6localeD1Ev@plt> lea 0x20(%rsp),%rdi callq 4660 <_ZNSt6localeD1Ev@plt> mov %rbx,%rdi callq 46c0 <_Unwind_Resume@plt> lea 0x20(%rsp),%r12 mov %r12,%rdi callq 4660 <_ZNSt6localeD1Ev@plt> mov 0x0(%rbp),%rdi mov %rdi,%rsi add 0x8(%rbp),%rsi movq $0x0,0x20(%rsp) movq $0x0,0x28(%rsp) movq $0x0,0x30(%rsp) movq $0x0,0x38(%rsp) mov %rsp,%rcx mov $0x0,%r8d mov %r12,%rdx callq cce2 <_ZNSt8__detail17__regex_algo_implIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEEcNS5_12regex_traitsIcEELNS_20_RegexExecutorPolicyE0ELb0EEEbT_SI_RNS5_13match_resultsISI_T0_EERKNS5_11basic_regexIT1_T2_EENSt15regex_constants15match_flag_typeE> mov %eax,%ebp mov 0x20(%rsp),%rdi test %rdi,%rdi je 4910 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xe7> callq 4570 <_ZdlPv@plt> test %bpl,%bpl jne 4957 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x12e> lea 0x10(%rbx),%rax mov %rax,(%rbx) lea 0x14db7(%rip),%rdx lea -0xc(%rdx),%rsi mov %rbx,%rdi callq 5858 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag> jmp 4971 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x148> endbr64 mov %rax,%rbx mov 0x20(%rsp),%rdi test %rdi,%rdi je 4947 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x11e> callq 4570 <_ZdlPv@plt> mov %rsp,%rdi callq 57d4 <_ZNSt7__cxx1111basic_regexIcNS_12regex_traitsIcEEED1Ev> mov %rbx,%rdi callq 46c0 <_Unwind_Resume@plt> lea 0x10(%rbx),%rax mov %rax,(%rbx) lea 0x14d68(%rip),%rdx lea -0xe(%rdx),%rsi mov %rbx,%rdi callq 5858 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag> mov 0x18(%rsp),%rbp test %rbp,%rbp je 4994 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x16b> cmpq $0x0,0x1a645(%rip) je 49bc <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x193> mov $0xffffffff,%eax lock xadd %eax,0x8(%rbp) cmp $0x1,%eax je 49c7 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x19e> lea 0x8(%rsp),%rdi callq 4660 <_ZNSt6localeD1Ev@plt> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 4a0d <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1e4> mov %rbx,%rax add $0x58,%rsp pop %rbx pop %rbp pop %r12 pop %r13 retq mov 0x8(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0x8(%rbp) jmp 498f <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x166> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x10(%rax) cmpq $0x0,0x1a5ef(%rip) je 49f6 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1cd> mov $0xffffffff,%eax lock xadd %eax,0xc(%rbp) cmp $0x1,%eax jne 4994 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x16b> mov 0x0(%rbp),%rax mov %rbp,%rdi callq *0x18(%rax) jmp 4994 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x16b> mov 0xc(%rbp),%eax lea -0x1(%rax),%edx mov %edx,0xc(%rbp) jmp 49e5 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1bc> endbr64 mov %rax,%rbx jmpq 4947 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x11e> callq 45d0 <__stack_chk_fail@plt>
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push rbp mov rbp, rsp push r14 push r12 push rbx sub rsp, 58h mov rbx, rdi mov r14, rsi mov rax, fs:28h mov [rbp+var_28], rax xor eax, eax lea r12, [rbp+var_70] lea rdi, [rbp+var_68]; this call __ZNSt6localeC1Ev; std::locale::locale(void) mov [rbp+var_60], 0 mov [rbp+var_58], 0 mov ecx, 10h lea rdx, aAb23+7; "" lea rsi, [rdx-7] 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_4880 endbr64 mov rbx, rax mov rdi, [rbp+var_58] test rdi, rdi jz short loc_485B call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release(void) loc_485B: lea rdi, [rbp+var_68]; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rbp+var_28] sub rax, fs:28h jz short loc_4878 call ___stack_chk_fail loc_4878: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume loc_4880: mov rdi, [r14] mov rsi, rdi add rsi, [r14+8] mov [rbp+var_50], 0 mov [rbp+var_48], 0 mov [rbp+var_40], 0 mov [rbp+var_38], 0 lea rcx, [rbp+var_70] lea rdx, [rbp+var_50] sub rsp, 8 push 0 mov r9d, 0 mov r8d, 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) mov r12d, eax add rsp, 10h mov rdi, [rbp+var_50]; void * test rdi, rdi jz short loc_48E5 mov rsi, [rbp+var_40] sub rsi, rdi; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_48E5: test r12b, r12b jnz short loc_4937 lea rax, [rbx+10h] mov [rbx], rax lea rdx, aNotMatched+0Ch; "" lea rsi, [rdx-0Ch] mov rdi, rbx 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_4951 endbr64 mov rbx, rax lea rdi, [rbp+var_50] 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() loc_4916: lea rdi, [rbp+var_70] 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 loc_49F2 call ___stack_chk_fail loc_4937: lea rax, [rbx+10h] mov [rbx], rax lea rdx, aFoundAMatch+0Eh; "" lea rsi, [rdx-0Eh] mov rdi, rbx 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) loc_4951: mov rax, [rbp+var_58] mov rdi, rax test rax, rax jz short loc_498B lea rcx, [rax+8] mov rdx, [rax+8] mov rax, 100000001h cmp rdx, rax jz short loc_49B1 cmp cs:__libc_single_threaded@GLIBC_2_32, 0 jz short loc_49D4 mov eax, [rdi+8] lea edx, [rax-1] mov [rdi+8], edx loc_4986: cmp eax, 1 jz short loc_49DF loc_498B: lea rdi, [rbp+var_68]; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rbp+var_28] sub rax, fs:28h jnz short loc_49FA mov rax, rbx lea rsp, [rbp-18h] pop rbx pop r12 pop r14 pop rbp retn loc_49B1: 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_498B loc_49D4: mov eax, 0FFFFFFFFh lock xadd [rcx], eax jmp short loc_4986 loc_49DF: 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_498B endbr64 mov rbx, rax jmp loc_4916 loc_49F2: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume loc_49FA: call ___stack_chk_fail
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R14 PUSH R12 PUSH RBX SUB RSP,0x58 MOV RBX,RDI MOV R14,RSI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x28],RAX XOR EAX,EAX LEA R12,[RBP + -0x70] LEA RDI,[RBP + -0x68] CALL 0x001046f0 MOV qword ptr [RBP + -0x60],0x0 MOV qword ptr [RBP + -0x58],0x0 MOV ECX,0x10 LEA RDX,[0x11960a] LEA RSI,[RDX + -0x7] MOV RDI,R12 LAB_0010483f: CALL 0x0011689c JMP 0x00104880 LAB_00104880: MOV RDI,qword ptr [R14] MOV RSI,RDI ADD RSI,qword ptr [R14 + 0x8] MOV qword ptr [RBP + -0x50],0x0 MOV qword ptr [RBP + -0x48],0x0 MOV qword ptr [RBP + -0x40],0x0 MOV qword ptr [RBP + -0x38],0x0 LEA RCX,[RBP + -0x70] LEA RDX,[RBP + -0x50] SUB RSP,0x8 PUSH 0x0 MOV R9D,0x0 MOV R8D,0x0 LAB_001048c4: CALL 0x0010db35 MOV R12D,EAX ADD RSP,0x10 MOV RDI,qword ptr [RBP + -0x50] TEST RDI,RDI JZ 0x001048e5 MOV RSI,qword ptr [RBP + -0x40] SUB RSI,RDI CALL 0x00104540 LAB_001048e5: TEST R12B,R12B JNZ 0x00104937 LEA RAX,[RBX + 0x10] MOV qword ptr [RBX],RAX LEA RDX,[0x119626] LEA RSI,[RDX + -0xc] MOV RDI,RBX LAB_001048ff: CALL 0x00105abc JMP 0x00104951 LAB_00104937: LEA RAX,[RBX + 0x10] MOV qword ptr [RBX],RAX LEA RDX,[0x119619] LEA RSI,[RDX + -0xe] MOV RDI,RBX CALL 0x00105abc LAB_00104951: MOV RAX,qword ptr [RBP + -0x58] MOV RDI,RAX TEST RAX,RAX JZ 0x0010498b LEA RCX,[RAX + 0x8] MOV RDX,qword ptr [RAX + 0x8] MOV RAX,0x100000001 CMP RDX,RAX JZ 0x001049b1 CMP byte ptr [0x0011f460],0x0 JZ 0x001049d4 MOV EAX,dword ptr [RDI + 0x8] LEA EDX,[RAX + -0x1] MOV dword ptr [RDI + 0x8],EDX LAB_00104986: CMP EAX,0x1 JZ 0x001049df LAB_0010498b: LEA RDI,[RBP + -0x68] CALL 0x00104630 MOV RAX,qword ptr [RBP + -0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x001049fa MOV RAX,RBX LEA RSP,[RBP + -0x18] POP RBX POP R12 POP R14 POP RBP RET LAB_001049b1: 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 0x0010498b LAB_001049d4: MOV EAX,0xffffffff XADD.LOCK dword ptr [RCX],EAX JMP 0x00104986 LAB_001049df: CALL 0x00105938 JMP 0x0010498b LAB_001049fa: CALL 0x00104580
/* 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; bool bVar3; int iVar4; int8 *in_RSI; long in_FS_OFFSET; regex local_78 [8]; int local_70 [8]; int8 local_68; _Sp_counted_base<(_Lock_policy)2> *local_60; void *local_58; int8 local_50; long local_48; int8 local_40; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); std::locale::locale(local_70); local_68 = 0; local_60 = (_Sp_counted_base<(_Lock_policy)2> *)0x0; /* try { // try from 0010483f to 00104843 has its CatchHandler @ 00104846 */ std::regex::_M_compile(local_78,"ab{2,3}","",0x10); local_58 = (void *)0x0; local_50 = 0; local_48 = 0; local_40 = 0; /* try { // try from 001048c4 to 001048c8 has its CatchHandler @ 00104906 */ bVar3 = 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)*in_RSI,(__normal_iterator)*in_RSI + (int)in_RSI[1], (match_results *)&local_58,local_78,0,0,false); if (local_58 != (void *)0x0) { operator_delete(local_58,local_48 - (long)local_58); } if (bVar3) { *(string **)param_1 = param_1 + 0x10; std::string::_M_construct<char_const*>((char *)param_1,"Found a match!",0x119619); } else { *(string **)param_1 = param_1 + 0x10; /* try { // try from 001048ff to 00104950 has its CatchHandler @ 001049e6 */ std::string::_M_construct<char_const*>((char *)param_1,"Not matched!",0x119626); } p_Var2 = local_60; if (local_60 != (_Sp_counted_base<(_Lock_policy)2> *)0x0) { p_Var1 = local_60 + 8; if (*(long *)(local_60 + 8) == 0x100000001) { *(int4 *)(local_60 + 8) = 0; *(int4 *)(local_60 + 0xc) = 0; (**(code **)(*(long *)local_60 + 0x10))(); (**(code **)(*(long *)p_Var2 + 0x18))(p_Var2); } else { if (__libc_single_threaded == '\0') { LOCK(); iVar4 = *(int *)p_Var1; *(int *)p_Var1 = *(int *)p_Var1 + -1; UNLOCK(); } else { iVar4 = *(int *)(local_60 + 8); *(int *)(local_60 + 8) = iVar4 + -1; } if (iVar4 == 1) { std::_Sp_counted_base<(_Lock_policy)2>::_M_release_last_use_cold(local_60); } } } std::locale::~locale(local_70); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,138
func0
#include <iostream> #include <regex> #include <string> #include <cassert>
std::string func0(const std::string &text) { std::regex pattern("ab{2,3}"); if (std::regex_search(text, pattern)) { return "Found a match!"; } else { return "Not matched!"; } }
int main() { assert(func0("ac") == "Not matched!"); assert(func0("dc") == "Not matched!"); assert(func0("abbbba") == "Found a match!"); 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 $0x50,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax lea 0x20(%rsp),%r13 lea 0x8(%rsp),%rbp mov %r13,%rdi callq 4750 <_ZNSt6localeC1Ev@plt> mov %r13,%rsi mov %rbp,%rdi movl $0x10,(%rsp) callq 44f0 <_ZNSt6localeC1ERKS_@plt> lea 0x15b0d(%rip),%rdx mov (%rsp),%r8d mov %rbp,%rcx lea 0x10(%rsp),%rdi lea -0x7(%rdx),%rsi callq 19540 <_ZNSt8__detail13__compile_nfaINSt7__cxx1112regex_traitsIcEEPKcEENSt9enable_ifIXsrNS_20__is_contiguous_iterIT0_EE5valueESt10shared_ptrIKNS_4_NFAIT_EEEE4typeES8_S8_RKNSC_11locale_typeENSt15regex_constants18syntax_option_typeE> mov %r13,%rdi mov %rsp,%r14 callq 4680 <_ZNSt6localeD1Ev@plt> mov (%rbx),%rdi mov 0x8(%rbx),%rsi xor %r8d,%r8d movq $0x0,0x20(%rsp) mov %r14,%rcx mov %r13,%rdx movq $0x0,0x28(%rsp) add %rdi,%rsi movq $0x0,0x30(%rsp) movq $0x0,0x38(%rsp) callq caf0 <_ZNSt8__detail17__regex_algo_implIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEEcNS5_12regex_traitsIcEELNS_20_RegexExecutorPolicyE0ELb0EEEbT_SI_RNS5_13match_resultsISI_T0_EERKNS5_11basic_regexIT1_T2_EENSt15regex_constants15match_flag_typeE> mov 0x20(%rsp),%rdi mov %eax,%ebx test %rdi,%rdi je 4c1e <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xbe> callq 4590 <_ZdlPv@plt> lea 0x10(%r12),%rax test %bl,%bl je 4c90 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x130> mov %rax,(%r12) lea 0x15a9b(%rip),%rdx mov %r12,%rdi lea -0xe(%rdx),%rsi callq 5a80 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag> mov 0x18(%rsp),%r13 test %r13,%r13 je 4c68 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x108> mov 0x1c361(%rip),%rbx test %rbx,%rbx je 4cb0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x150> mov $0xffffffff,%eax lock xadd %eax,0x8(%r13) cmp $0x1,%eax je 4cc0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x160> nopl 0x0(%rax) mov %rbp,%rdi callq 4680 <_ZNSt6localeD1Ev@plt> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 4cfd <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x19d> add $0x50,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq mov %rax,(%r12) lea 0x15a3f(%rip),%rdx mov %r12,%rdi lea -0xc(%rdx),%rsi callq 5a80 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag> jmp 4c3e <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xde> nopl 0x0(%rax) mov 0x8(%r13),%eax lea -0x1(%rax),%edx mov %edx,0x8(%r13) cmp $0x1,%eax jne 4c68 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x108> mov 0x0(%r13),%rax mov %r13,%rdi callq *0x10(%rax) test %rbx,%rbx je 4cf0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x190> mov $0xffffffff,%eax lock xadd %eax,0xc(%r13) cmp $0x1,%eax jne 4c68 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x108> mov 0x0(%r13),%rax mov %r13,%rdi callq *0x18(%rax) jmpq 4c68 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x108> xchg %ax,%ax mov 0xc(%r13),%eax lea -0x1(%rax),%edx mov %edx,0xc(%r13) jmp 4cda <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x17a> callq 45f0 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 47c3 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold> endbr64 mov %rax,%r12 jmpq 47e2 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold+0x1f> endbr64 mov %rax,%rbp jmpq 47d2 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold+0xf> nopw %cs: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_70] push r12 lea r12, [rbp+var_68] push rbx mov rbx, rdi mov rdi, r12; this sub rsp, 50h mov rax, fs:28h mov [rbp+var_28], rax xor eax, eax call __ZNSt6localeC1Ev; std::locale::locale(void) lea rdx, aAb23+7; "" pxor xmm0, xmm0 mov rdi, r13 mov ecx, 10h lea rsi, [rdx-7] movaps [rbp+var_60], 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) pxor xmm0, xmm0 sub rsp, 8 mov rdi, [r14] mov rsi, [r14+8] movaps xmmword ptr [rbp+var_50], xmm0 lea rax, [rbp+var_50] xor r9d, r9d xor r8d, r8d movaps [rbp+var_40], xmm0 add rsi, rdi mov rcx, r13 mov rdx, rax push 0 mov r14, rax 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) mov rdi, [rbp+var_50]; void * mov r13d, eax pop rax pop rdx test rdi, rdi jz short loc_4C06 mov rsi, qword ptr [rbp+var_40] sub rsi, rdi; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_4C06: test r13b, r13b jz loc_4CB0 mov rcx, 206120646E756F46h lea rax, [rbx+10h] mov qword ptr [rbx+8], 0Eh mov [rbx+10h], rcx mov rcx, 21686374616D2061h mov [rbx], rax mov [rbx+16h], rcx mov byte ptr [rbx+1Eh], 0 loc_4C3E: mov rax, qword ptr [rbp+var_60+8] mov rdi, rax test rax, rax jz short loc_4C80 mov rdx, [rax+8] lea rcx, [rax+8] mov rax, 100000001h cmp rdx, rax jz short loc_4CE0 cmp cs:__libc_single_threaded@GLIBC_2_32, 0 jz loc_4D00 mov eax, [rdi+8] lea edx, [rax-1] mov [rdi+8], edx loc_4C77: cmp eax, 1 jz loc_4D10 loc_4C80: mov rdi, r12; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rbp+var_28] sub rax, fs:28h jnz loc_4D1A lea rsp, [rbp-20h] mov rax, rbx pop rbx pop r12 pop r13 pop r14 pop rbp retn loc_4CB0: lea rax, [rbx+10h] mov dword ptr [rbx+18h], 21646568h mov rcx, 6374616D20746F4Eh mov [rbx], rax mov [rbx+10h], rcx mov qword ptr [rbx+8], 0Ch mov byte ptr [rbx+1Ch], 0 jmp loc_4C3E loc_4CE0: 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_4C80 loc_4D00: mov eax, 0FFFFFFFFh lock xadd [rcx], eax jmp loc_4C77 loc_4D10: 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_4C80 loc_4D1A: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE_cold; func0(std::string const&) [clone] endbr64 mov rbx, rax jmp loc_378E
long long func0(long long a1, long long *a2) { long long v3; // rdi long long v4; // rsi long long v5; // rsi char v6; // r13 long long v7; // rdi long long v8; // rdx volatile signed __int32 *v9; // rcx signed __int32 v10; // eax long long v12; // rax _BYTE v13[8]; // [rsp+0h] [rbp-70h] BYREF _BYTE v14[8]; // [rsp+8h] [rbp-68h] BYREF __int128 v15; // [rsp+10h] [rbp-60h] void *v16[2]; // [rsp+20h] [rbp-50h] BYREF __int128 v17; // [rsp+30h] [rbp-40h] unsigned long long v18; // [rsp+48h] [rbp-28h] v18 = __readfsqword(0x28u); std::locale::locale((std::locale *)v14); v15 = 0LL; std::basic_regex<char,std::regex_traits<char>>::_M_compile(v13, "ab{2,3}", "", 16LL); v3 = *a2; v4 = a2[1]; *(_OWORD *)v16 = 0LL; v17 = 0LL; v5 = v3 + v4; v6 = 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>>( v3, v5, (unsigned int)v16, (unsigned int)v13, 0, 0, 0); if ( v16[0] ) { v5 = v17 - (unsigned long long)v16[0]; operator delete(v16[0], v17 - (unsigned long long)v16[0]); } if ( v6 ) { *(_QWORD *)(a1 + 8) = 14LL; strcpy((char *)(a1 + 16), "Found a match!"); *(_QWORD *)a1 = a1 + 16; } else { *(_QWORD *)a1 = a1 + 16; strcpy((char *)(a1 + 16), "Not matched!"); *(_QWORD *)(a1 + 8) = 12LL; } v7 = *((_QWORD *)&v15 + 1); if ( *((_QWORD *)&v15 + 1) ) { v8 = *(_QWORD *)(*((_QWORD *)&v15 + 1) + 8LL); v9 = (volatile signed __int32 *)(*((_QWORD *)&v15 + 1) + 8LL); if ( v8 == 0x100000001LL ) { v12 = **((_QWORD **)&v15 + 1); *(_QWORD *)(*((_QWORD *)&v15 + 1) + 8LL) = 0LL; (*(void ( **)(long long, long long, long long, volatile signed __int32 *))(v12 + 16))( v7, v5, 0x100000001LL, v9); (*(void ( **)(long long))(*(_QWORD *)v7 + 24LL))(v7); } else { if ( _libc_single_threaded ) { v10 = *(_DWORD *)(*((_QWORD *)&v15 + 1) + 8LL); v8 = (unsigned int)(v10 - 1); *(_DWORD *)(*((_QWORD *)&v15 + 1) + 8LL) = v8; } else { v10 = _InterlockedExchangeAdd(v9, 0xFFFFFFFF); } if ( v10 == 1 ) std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold(v7, v5, v8, v9); } } std::locale::~locale((std::locale *)v14); return a1; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R14 MOV R14,RSI PUSH R13 LEA R13,[RBP + -0x70] PUSH R12 LEA R12,[RBP + -0x68] PUSH RBX MOV RBX,RDI MOV RDI,R12 SUB RSP,0x50 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x28],RAX XOR EAX,EAX CALL 0x001036d0 LEA RDX,[0x11860a] PXOR XMM0,XMM0 MOV RDI,R13 MOV ECX,0x10 LEA RSI,[RDX + -0x7] MOVAPS xmmword ptr [RBP + -0x60],XMM0 LAB_00104bb3: CALL 0x001175b0 PXOR XMM0,XMM0 SUB RSP,0x8 MOV RDI,qword ptr [R14] MOV RSI,qword ptr [R14 + 0x8] MOVAPS xmmword ptr [RBP + -0x50],XMM0 LEA RAX,[RBP + -0x50] XOR R9D,R9D XOR R8D,R8D MOVAPS xmmword ptr [RBP + -0x40],XMM0 ADD RSI,RDI MOV RCX,R13 MOV RDX,RAX PUSH 0x0 MOV R14,RAX LAB_00104be7: CALL 0x0010ce20 MOV RDI,qword ptr [RBP + -0x50] MOV R13D,EAX POP RAX POP RDX TEST RDI,RDI JZ 0x00104c06 MOV RSI,qword ptr [RBP + -0x40] SUB RSI,RDI CALL 0x00103540 LAB_00104c06: TEST R13B,R13B JZ 0x00104cb0 MOV RCX,0x206120646e756f46 LEA RAX,[RBX + 0x10] MOV qword ptr [RBX + 0x8],0xe MOV qword ptr [RBX + 0x10],RCX MOV RCX,0x21686374616d2061 MOV qword ptr [RBX],RAX MOV qword ptr [RBX + 0x16],RCX MOV byte ptr [RBX + 0x1e],0x0 LAB_00104c3e: MOV RAX,qword ptr [RBP + -0x58] MOV RDI,RAX TEST RAX,RAX JZ 0x00104c80 MOV RDX,qword ptr [RAX + 0x8] LEA RCX,[RAX + 0x8] MOV RAX,0x100000001 CMP RDX,RAX JZ 0x00104ce0 CMP byte ptr [0x0011e460],0x0 JZ 0x00104d00 MOV EAX,dword ptr [RDI + 0x8] LEA EDX,[RAX + -0x1] MOV dword ptr [RDI + 0x8],EDX LAB_00104c77: CMP EAX,0x1 JZ 0x00104d10 LAB_00104c80: MOV RDI,R12 CALL 0x00103620 MOV RAX,qword ptr [RBP + -0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x00104d1a LEA RSP,[RBP + -0x20] MOV RAX,RBX POP RBX POP R12 POP R13 POP R14 POP RBP RET LAB_00104cb0: LEA RAX,[RBX + 0x10] MOV dword ptr [RBX + 0x18],0x21646568 MOV RCX,0x6374616d20746f4e MOV qword ptr [RBX],RAX MOV qword ptr [RBX + 0x10],RCX MOV qword ptr [RBX + 0x8],0xc MOV byte ptr [RBX + 0x1c],0x0 JMP 0x00104c3e LAB_00104ce0: 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 0x00104c80 LAB_00104d00: MOV EAX,0xffffffff XADD.LOCK dword ptr [RCX],EAX JMP 0x00104c77 LAB_00104d10: CALL 0x00105fc0 JMP 0x00104c80 LAB_00104d1a: CALL 0x00103580
/* func0(std::string const&) */ string * func0(string *param_1) { _Sp_counted_base<(_Lock_policy)2> *p_Var1; int8 uVar2; bool bVar3; int iVar4; int8 *in_RSI; long in_FS_OFFSET; regex local_78 [8]; int local_70 [8]; int local_68 [16]; int local_58 [16]; int local_48 [16]; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); std::locale::locale(local_70); local_68 = (int [16])0x0; /* try { // try from 00104bb3 to 00104bb7 has its CatchHandler @ 00104d2b */ std::regex::_M_compile(local_78,"ab{2,3}","",0x10); local_58 = (int [16])0x0; local_48 = (int [16])0x0; /* try { // try from 00104be7 to 00104beb has its CatchHandler @ 00104d1f */ bVar3 = 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)*in_RSI,(int)in_RSI[1] + (__normal_iterator)*in_RSI, (match_results *)local_58,local_78,0,0,false); if ((void *)local_58._0_8_ != (void *)0x0) { operator_delete((void *)local_58._0_8_,local_48._0_8_ - local_58._0_8_); } if (bVar3) { *(int8 *)(param_1 + 8) = 0xe; *(int8 *)(param_1 + 0x10) = 0x206120646e756f46; *(string **)param_1 = param_1 + 0x10; *(int8 *)(param_1 + 0x16) = 0x21686374616d2061; param_1[0x1e] = (string)0x0; } else { *(int4 *)(param_1 + 0x18) = 0x21646568; *(string **)param_1 = param_1 + 0x10; *(int8 *)(param_1 + 0x10) = 0x6374616d20746f4e; *(int8 *)(param_1 + 8) = 0xc; param_1[0x1c] = (string)0x0; } uVar2 = local_68._8_8_; if ((_Sp_counted_base<(_Lock_policy)2> *)local_68._8_8_ != (_Sp_counted_base<(_Lock_policy)2> *)0x0) { p_Var1 = (_Sp_counted_base<(_Lock_policy)2> *)(local_68._8_8_ + 8); if (*(long *)(local_68._8_8_ + 8) == 0x100000001) { *(int8 *)(local_68._8_8_ + 8) = 0; (**(code **)(*(long *)local_68._8_8_ + 0x10))(); (**(code **)(*(long *)uVar2 + 0x18))(uVar2); } else { if (__libc_single_threaded == '\0') { LOCK(); iVar4 = *(int *)p_Var1; *(int *)p_Var1 = *(int *)p_Var1 + -1; UNLOCK(); } else { iVar4 = *(int *)(local_68._8_8_ + 8); *(int *)(local_68._8_8_ + 8) = iVar4 + -1; } if (iVar4 == 1) { std::_Sp_counted_base<(_Lock_policy)2>::_M_release_last_use_cold ((_Sp_counted_base<(_Lock_policy)2> *)local_68._8_8_); } } } std::locale::~locale(local_70); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,139
func0
#include <iostream> #include <regex> #include <string> #include <cassert>
std::string func0(const std::string &text) { std::regex pattern("ab{2,3}"); if (std::regex_search(text, pattern)) { return "Found a match!"; } else { return "Not matched!"; } }
int main() { assert(func0("ac") == "Not matched!"); assert(func0("dc") == "Not matched!"); assert(func0("abbbba") == "Found a match!"); 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 $0x50,%rsp mov %fs:0x28,%rax mov %rax,0x48(%rsp) xor %eax,%eax lea 0x20(%rsp),%r13 lea 0x8(%rsp),%rbp mov %r13,%rdi callq 47b0 <_ZNSt6localeC1Ev@plt> mov %r13,%rsi mov %rbp,%rdi movl $0x10,(%rsp) callq 4530 <_ZNSt6localeC1ERKS_@plt> lea 0x161cd(%rip),%rdx mov (%rsp),%r8d mov %rbp,%rcx lea 0x10(%rsp),%rdi lea -0x7(%rdx),%rsi callq 199a0 <_ZNSt8__detail13__compile_nfaINSt7__cxx1112regex_traitsIcEEPKcEENSt9enable_ifIXsrNS_20__is_contiguous_iterIT0_EE5valueESt10shared_ptrIKNS_4_NFAIT_EEEE4typeES8_S8_RKNSC_11locale_typeENSt15regex_constants18syntax_option_typeE> mov %r13,%rdi mov %rsp,%r14 callq 46e0 <_ZNSt6localeD1Ev@plt> mov (%rbx),%rdi mov 0x8(%rbx),%rsi pxor %xmm0,%xmm0 xor %r8d,%r8d mov %r14,%rcx mov %r13,%rdx movaps %xmm0,0x20(%rsp) add %rdi,%rsi movaps %xmm0,0x30(%rsp) callq cf90 <_ZNSt8__detail17__regex_algo_implIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEEcNS5_12regex_traitsIcEELNS_20_RegexExecutorPolicyE0ELb0EEEbT_SI_RNS5_13match_resultsISI_T0_EERKNS5_11basic_regexIT1_T2_EENSt15regex_constants15match_flag_typeE> mov 0x20(%rsp),%rdi mov %eax,%ebx test %rdi,%rdi je 5578 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xa8> callq 45e0 <_ZdlPv@plt> lea 0x10(%r12),%rax test %bl,%bl je 5610 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x140> movabs $0x206120646e756f46,%rcx mov $0x2168,%edx mov %rax,(%r12) mov %rcx,0x10(%r12) movl $0x6374616d,0x8(%rax) mov %dx,0xc(%rax) movq $0xe,0x8(%r12) movb $0x0,0x1e(%r12) mov 0x18(%rsp),%r13 test %r13,%r13 je 55e0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x110> mov 0x1ca00(%rip),%rbx test %rbx,%rbx je 5640 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x170> mov $0xffffffff,%eax lock xadd %eax,0x8(%r13) cmp $0x1,%eax je 5650 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x180> nopl (%rax) mov %rbp,%rdi callq 46e0 <_ZNSt6localeD1Ev@plt> mov 0x48(%rsp),%rax xor %fs:0x28,%rax jne 5695 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1c5> add $0x50,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq nopl 0x0(%rax) movabs $0x6374616d20746f4e,%rdx mov %rax,(%r12) mov %rdx,0x10(%r12) movl $0x21646568,0x8(%rax) movq $0xc,0x8(%r12) movb $0x0,0x1c(%r12) jmpq 55b7 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xe7> xchg %ax,%ax mov 0x8(%r13),%eax lea -0x1(%rax),%edx mov %edx,0x8(%r13) cmp $0x1,%eax jne 55e0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x110> mov 0x0(%r13),%rax mov %r13,%rdi callq *0x10(%rax) test %rbx,%rbx je 5688 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1b8> mov $0xffffffff,%eax lock xadd %eax,0xc(%r13) cmp $0x1,%eax jne 55e0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x110> mov 0x0(%r13),%rax mov %r13,%rdi callq *0x18(%rax) jmpq 55e0 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x110> nopw 0x0(%rax,%rax,1) mov 0xc(%r13),%eax lea -0x1(%rax),%edx mov %edx,0xc(%r13) jmp 566a <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x19a> callq 4640 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 4836 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold> endbr64 mov %rax,%r12 jmpq 4855 <_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE.cold+0x1f> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
_Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: endbr64 push r15 mov r15, rsi push r14 push r13 push r12 push rbp push rbx mov rbx, rdi sub rsp, 2B8h mov rax, fs:28h mov [rsp+2E8h+var_40], rax xor eax, eax lea r14, [rsp+2E8h+var_2A0] mov rdi, r14; this call __ZNSt6localeC1Ev; std::locale::locale(void) lea rdx, aAb23+7; "" pxor xmm0, xmm0 lea rdi, [rsp+2E8h+var_1D8] mov r8d, 10h mov rcx, r14 lea rsi, [rdx-7] movaps [rsp+2E8h+var_298], xmm0 call _ZNSt8__detail9_CompilerINSt7__cxx1112regex_traitsIcEEEC2EPKcS6_RKSt6localeNSt15regex_constants18syntax_option_typeE; std::__detail::_Compiler<std::regex_traits<char>>::_Compiler(char const*,char const*,std::locale const&,std::regex_constants::syntax_option_type) movdqa xmm0, [rsp+2E8h+var_D8] mov rdi, qword ptr [rsp+2E8h+var_298+8] pxor xmm1, xmm1 movaps [rsp+2E8h+var_D8], xmm1 movaps [rsp+2E8h+var_298], xmm0 test rdi, rdi jz short loc_5CFE call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release(void) loc_5CFE: mov rdi, [rsp+2E8h+var_A8] mov [rsp+2E8h+var_2A8], 10h test rdi, rdi jz short loc_5D64 mov rax, [rsp+2E8h+var_60] mov rbp, [rsp+2E8h+var_80] lea r12, [rax+8] cmp rbp, r12 jnb short loc_5D4F nop dword ptr [rax+00h] loc_5D30: mov rdi, [rbp+0]; void * mov esi, 1F8h; unsigned __int64 add rbp, 8 call __ZdlPvm; operator delete(void *,ulong) cmp rbp, r12 jb short loc_5D30 mov rdi, [rsp+2E8h+var_A8]; void * loc_5D4F: mov rax, [rsp+2E8h+var_A0] lea rsi, ds:0[rax*8]; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_5D64: lea rdi, [rsp+2E8h+var_C8] call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv; std::string::_M_dispose(void) mov rdi, qword ptr [rsp+2E8h+var_D8+8] test rdi, rdi jz short loc_5D83 call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release(void) loc_5D83: lea rdi, [rsp+2E8h+var_108] call __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv; std::string::_M_dispose(void) pxor xmm0, xmm0 mov r13, [r15] mov rbp, [r15+8] mov rax, qword ptr [rsp+2E8h+var_298] movaps [rsp+2E8h+var_288], xmm0 movaps [rsp+2E8h+var_278], xmm0 test rax, rax jz loc_6210 mov rax, [rax+28h] lea r15, [rsp+2E8h+var_288] lea r12, [rsp+2E8h+var_268] mov qword ptr [rsp+2E8h+var_278+8], r13 mov rdx, r12 mov rdi, r15 mov byte ptr [rsp+2E8h+var_258], 0 lea esi, [rax+3] lea rax, [rsp+2E8h+var_2A8] movaps [rsp+2E8h+var_268], xmm0 mov [rsp+2E8h+var_2D8], rax call _ZNSt6vectorINSt7__cxx119sub_matchIN9__gnu_cxx17__normal_iteratorIPKcNS0_12basic_stringIcSt11char_traitsIcESaIcEEEEEEESaISC_EE14_M_fill_assignEmRKSC_; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::_M_fill_assign(ulong,std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>> const&) mov rcx, qword ptr [rsp+2E8h+var_298] add rbp, r13 movq xmm1, r13 mov rsi, 0AAAAAAAAAAAAAAABh movq xmm2, rbp pxor xmm0, xmm0 mov rdx, [rcx+40h] sub rdx, [rcx+38h] punpcklqdq xmm1, xmm2 mov [rsp+2E8h+var_230], rcx mov rax, rdx mov [rsp+2E8h+var_228], r15 sar rax, 4 movaps [rsp+2E8h+var_268], xmm0 imul rax, rsi lea rsi, [rsp+2E8h+var_2A8] test byte ptr [rsp+2E8h+var_2A8+1], 4 movaps [rsp+2E8h+var_258], xmm0 mov [rsp+2E8h+var_2D8], rsi mov [rsp+2E8h+var_238], rsi mov [rsp+2E8h+n], rax movaps [rsp+2E8h+var_248], xmm1 jnz loc_6038 test rdx, rdx js loc_639F mov [rsp+2E8h+var_210], 0 movups xmmword ptr [rsp+2E8h+var_220], xmm0 jz loc_6340 shl rax, 4 mov rdi, rax; unsigned __int64 mov [rsp+2E8h+n], rax call __Znwm; operator new(ulong) mov rdx, [rsp+2E8h+n] mov [rsp+2E8h+var_220], rax add rdx, rax mov [rsp+2E8h+var_210], rdx xchg ax, ax loc_5EC0: mov qword ptr [rax], 0 add rax, 10h mov dword ptr [rax-8], 0 cmp rax, rdx jnz short loc_5EC0 mov rcx, [rsp+2E8h+var_230] mov rsi, [rsp+2E8h+var_228] loc_5EE7: mov rax, [rcx+20h] mov rdi, r12 mov [rsp+2E8h+var_220+8], rdx mov qword ptr [rsp+2E8h+var_208+8], 0 mov qword ptr [rsp+2E8h+var_208], rax mov rax, qword ptr [rsp+2E8h+var_248] mov dword ptr [rsp+2E8h+var_1F8], 0 mov qword ptr [rsp+2E8h+var_258+8], rax mov byte ptr [rsp+2E8h+var_1F8+4], 0 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 rdx, qword ptr [rsp+2E8h+var_208] mov esi, 1 mov rdi, r12 call _ZNSt8__detail9_ExecutorIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEENS5_12regex_traitsIcEELb1EE6_M_dfsENSH_11_Match_modeEl; std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,true>::_M_dfs(std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,true>::_Match_mode,long) cmp byte ptr [rsp+2E8h+var_1F8+4], 0 jnz loc_6288 mov eax, dword ptr [rsp+2E8h+var_1F8] test al, 40h jnz short loc_5FDD or al, 80h mov dword ptr [rsp+2E8h+var_1F8], eax jmp short loc_5FCB loc_5F70: mov rsi, [rsp+2E8h+var_228] add rax, 1 mov rdi, r12 mov byte ptr [rsp+2E8h+var_1F8+4], 0 mov qword ptr [rsp+2E8h+var_248], rax mov qword ptr [rsp+2E8h+var_258+8], rax mov qword ptr [rsp+2E8h+var_208+8], 0 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 rdx, qword ptr [rsp+2E8h+var_208] mov esi, 1 mov rdi, r12 call _ZNSt8__detail9_ExecutorIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEENS5_12regex_traitsIcEELb1EE6_M_dfsENSH_11_Match_modeEl; std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,true>::_M_dfs(std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,true>::_Match_mode,long) cmp byte ptr [rsp+2E8h+var_1F8+4], 0 jnz loc_6288 loc_5FCB: mov rax, qword ptr [rsp+2E8h+var_248] cmp rax, qword ptr [rsp+2E8h+var_248+8] jnz short loc_5F70 loc_5FDD: mov rdi, [rsp+2E8h+var_220]; void * test rdi, rdi jz short loc_5FFA mov rsi, [rsp+2E8h+var_210] sub rsi, rdi; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_5FFA: mov rdi, r12 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() loc_6002: lea rdx, [rsp+2E8h+var_2C8] mov esi, 3 mov rdi, r15 mov [rsp+2E8h+var_2B8], 0 mov [rsp+2E8h+var_2C0], rbp mov [rsp+2E8h+var_2C8], rbp call _ZNSt6vectorINSt7__cxx119sub_matchIN9__gnu_cxx17__normal_iteratorIPKcNS0_12basic_stringIcSt11char_traitsIcESaIcEEEEEEESaISC_EE14_M_fill_assignEmRKSC_; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::_M_fill_assign(ulong,std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>> const&) mov rdi, r15 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_621A loc_6038: test rdx, rdx js loc_63BE cmp [rsp+2E8h+n], 0 movups xmmword ptr [rsp+2E8h+var_220], xmm0 mov [rsp+2E8h+var_210], 0 jz loc_6368 shl rax, 4 mov rdi, rax; unsigned __int64 mov [rsp+2E8h+n], rax call __Znwm; operator new(ulong) mov rdx, [rsp+2E8h+n] mov [rsp+2E8h+var_220], rax add rdx, rax mov [rsp+2E8h+var_210], rdx nop word ptr [rax+rax+00h] loc_6090: mov qword ptr [rax], 0 add rax, 10h mov dword ptr [rax-8], 0 cmp rax, rdx jnz short loc_6090 mov rcx, [rsp+2E8h+var_230] mov rsi, 0AAAAAAAAAAAAAAABh mov rax, [rcx+40h] sub rax, [rcx+38h] sar rax, 4 imul rax, rsi mov [rsp+2E8h+n], rax mov rdi, rax; unsigned __int64 loc_60D1: mov rax, [rcx+20h] pxor xmm0, xmm0 mov [rsp+2E8h+var_220+8], rdx mov [rsp+2E8h+var_1F8], 0 mov [rsp+2E8h+var_2D0], rax movaps [rsp+2E8h+var_208], xmm0 call __Znam; operator new[](ulong) mov rcx, rax mov rax, [rsp+2E8h+n] sub rax, 1 js short loc_611F mov rdx, [rsp+2E8h+n]; n mov rdi, rcx; s xor esi, esi; c call _memset mov rcx, rax loc_611F: mov rax, [rsp+2E8h+var_2D0] mov rdi, r12 mov [rsp+2E8h+var_1F0], rcx mov [rsp+2E8h+var_1E0], 0 mov [rsp+2E8h+var_1E8], rax mov rax, qword ptr [rsp+2E8h+var_248] mov qword ptr [rsp+2E8h+var_258+8], rax call _ZNSt8__detail9_ExecutorIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEENS5_12regex_traitsIcEELb0EE16_M_main_dispatchENSH_11_Match_modeESt17integral_constantIbLb0EE_constprop_0; std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,false>::_M_main_dispatch(std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,false>::_Match_mode,std::integral_constant<bool,false>) [clone] mov byte ptr [rsp+2E8h+n], al test al, al jnz loc_6390 mov eax, [rsp+2E8h+var_1E0] test al, 40h jnz short loc_61B6 or al, 80h mov [rsp+2E8h+var_1E0], eax jmp short loc_61A4 loc_6180: add rax, 1 mov rdi, r12 mov qword ptr [rsp+2E8h+var_248], rax mov qword ptr [rsp+2E8h+var_258+8], rax call _ZNSt8__detail9_ExecutorIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS5_9sub_matchISB_EEENS5_12regex_traitsIcEELb0EE16_M_main_dispatchENSH_11_Match_modeESt17integral_constantIbLb0EE_constprop_0; std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,false>::_M_main_dispatch(std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,false>::_Match_mode,std::integral_constant<bool,false>) [clone] test al, al jnz loc_6390 loc_61A4: mov rax, qword ptr [rsp+2E8h+var_248] cmp rax, qword ptr [rsp+2E8h+var_248+8] jnz short loc_6180 loc_61B6: mov rdi, [rsp+2E8h+var_1F0]; void * test rdi, rdi jz short loc_61C8 call __ZdaPv; operator delete[](void *) loc_61C8: lea rdi, [rsp+2E8h+var_208] call _ZNSt6vectorISt4pairIlS_INSt7__cxx119sub_matchIN9__gnu_cxx17__normal_iteratorIPKcNS1_12basic_stringIcSt11char_traitsIcESaIcEEEEEEESaISD_EEESaISG_EED2Ev; std::vector<std::pair<long,std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>>>::~vector() mov rdi, [rsp+2E8h+var_220]; void * test rdi, rdi jz short loc_61F2 mov rsi, [rsp+2E8h+var_210] sub rsi, rdi; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_61F2: mov rdi, r12 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() cmp byte ptr [rsp+2E8h+n], 0 jnz loc_62AD jmp loc_6002 loc_6210: lea rdi, [rsp+2E8h+var_288] 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() loc_621A: lea rax, [rbx+10h] mov dword ptr [rbx+18h], 21646568h mov rcx, 6374616D20746F4Eh mov [rbx], rax mov [rbx+10h], rcx mov qword ptr [rbx+8], 0Ch mov byte ptr [rbx+1Ch], 0 loc_6242: mov rdi, qword ptr [rsp+2E8h+var_298+8] test rdi, rdi jz short loc_6251 call _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv; std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release(void) loc_6251: mov rdi, r14; this call __ZNSt6localeD1Ev; std::locale::~locale() mov rax, [rsp+2E8h+var_40] sub rax, fs:28h jnz loc_639A add rsp, 2B8h mov rax, rbx pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_6288: mov rdi, [rsp+2E8h+var_220]; void * test rdi, rdi jz short loc_62A5 mov rsi, [rsp+2E8h+var_210] sub rsi, rdi; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_62A5: mov rdi, r12 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() loc_62AD: mov rcx, qword ptr [rsp+2E8h+var_288] mov rdx, qword ptr [rsp+2E8h+var_288+8] mov rax, rcx cmp rcx, rdx jz short loc_62D6 nop loc_62C0: cmp byte ptr [rax+10h], 0 jnz short loc_62CD mov [rax+8], rbp mov [rax], rbp loc_62CD: add rax, 18h cmp rdx, rax jnz short loc_62C0 loc_62D6: mov [rdx-30h], r13 lea rax, [rdx-18h] lea rsi, [rdx-30h] mov rdx, [rcx] mov rdi, r15 mov [rsi+8], rdx cmp rdx, r13 mov rdx, [rcx+8] setnz byte ptr [rsi+10h] mov [rax], rdx cmp rdx, rbp mov [rax+8], rbp setnz byte ptr [rax+10h] 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() lea rax, [rbx+10h] mov byte ptr [rbx+1Eh], 0 mov rcx, 206120646E756F46h mov [rbx+10h], rcx mov rcx, 21686374616D2061h mov [rbx], rax mov [rbx+16h], rcx mov qword ptr [rbx+8], 0Eh jmp loc_6242 loc_6340: mov [rsp+2E8h+var_220], 0 mov rsi, r15 xor edx, edx mov [rsp+2E8h+var_210], 0 jmp loc_5EE7 loc_6368: mov [rsp+2E8h+var_220], 0 xor edx, edx mov rdi, rax mov [rsp+2E8h+var_210], 0 jmp loc_60D1 loc_6390: mov byte ptr [rsp+2E8h+n], 1 jmp loc_61B6 loc_639A: call ___stack_chk_fail loc_639F: mov rax, [rsp+2E8h+var_40] sub rax, fs:28h jnz short loc_63DD lea rdi, aCannotCreateSt_0; "cannot create std::vector larger than m"... call __ZSt20__throw_length_errorPKc; std::__throw_length_error(char const*) loc_63BE: mov rax, [rsp+2E8h+var_40] sub rax, fs:28h jnz short loc_63E2 lea rdi, aCannotCreateSt_0; "cannot create std::vector larger than m"... call __ZSt20__throw_length_errorPKc; std::__throw_length_error(char const*) loc_63DD: call ___stack_chk_fail loc_63E2: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE_cold; func0(std::string const&) [clone] endbr64 mov rbx, rax jmp loc_47FF endbr64 mov rbx, rax jmp loc_47D2 endbr64 mov rbx, rax jmp loc_483B endbr64 mov rbx, rax jmp loc_4855 endbr64 mov rbx, rax jmp loc_4862 endbr64 mov rbx, rax jmp loc_486F
long long func0(long long a1, unsigned long long *a2) { __m128i v3; // xmm0 long long v4; // rdi void *v5; // rdi void **v6; // rbp unsigned long long v7; // r12 void *v8; // rdi unsigned long long v9; // r13 unsigned long long v10; // rbp long long v11; // rax long long v12; // rcx unsigned long long v13; // rbp long long v14; // rdx unsigned long long v15; // rax _QWORD *v16; // rax _QWORD *v17; // rdx __int128 *v18; // rsi unsigned long long v19; // rax int v20; // eax _QWORD *v21; // rax _QWORD *v22; // rdx unsigned long long v23; // rdi long long v24; // rax void *v25; // rcx int v26; // eax _QWORD *v28; // rcx __int128 i; // rax long long v30; // rsi bool v31; // zf unsigned long long n; // [rsp+8h] [rbp-2E0h] size_t nb; // [rsp+8h] [rbp-2E0h] size_t nc; // [rsp+8h] [rbp-2E0h] char na; // [rsp+8h] [rbp-2E0h] long long v36; // [rsp+18h] [rbp-2D0h] _QWORD v37[4]; // [rsp+20h] [rbp-2C8h] BYREF int v38; // [rsp+40h] [rbp-2A8h] BYREF char v39[8]; // [rsp+48h] [rbp-2A0h] BYREF __m128i v40; // [rsp+50h] [rbp-298h] __int128 v41; // [rsp+60h] [rbp-288h] BYREF __int128 v42; // [rsp+70h] [rbp-278h] __int128 v43; // [rsp+80h] [rbp-268h] BYREF __int128 v44; // [rsp+90h] [rbp-258h] __m128i v45; // [rsp+A0h] [rbp-248h] int *v46; // [rsp+B0h] [rbp-238h] long long v47; // [rsp+B8h] [rbp-230h] __int128 *v48; // [rsp+C0h] [rbp-228h] void *v49[2]; // [rsp+C8h] [rbp-220h] char *v50; // [rsp+D8h] [rbp-210h] __int128 v51; // [rsp+E0h] [rbp-208h] BYREF long long v52; // [rsp+F0h] [rbp-1F8h] void *v53; // [rsp+F8h] [rbp-1F0h] long long v54; // [rsp+100h] [rbp-1E8h] int v55; // [rsp+108h] [rbp-1E0h] char v56[208]; // [rsp+110h] [rbp-1D8h] BYREF char v57[48]; // [rsp+1E0h] [rbp-108h] BYREF __m128i v58; // [rsp+210h] [rbp-D8h] BYREF char v59[32]; // [rsp+220h] [rbp-C8h] BYREF void *v60; // [rsp+240h] [rbp-A8h] long long v61; // [rsp+248h] [rbp-A0h] unsigned long long v62; // [rsp+268h] [rbp-80h] long long v63; // [rsp+288h] [rbp-60h] unsigned long long v64; // [rsp+2A8h] [rbp-40h] v64 = __readfsqword(0x28u); std::locale::locale((std::locale *)v39); v40 = 0LL; std::__detail::_Compiler<std::regex_traits<char>>::_Compiler(v56, "ab{2,3}", "", v39, 16LL); v3 = _mm_load_si128(&v58); v4 = v40.m128i_i64[1]; v58 = 0LL; v40 = v3; if ( v4 ) std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release(); v5 = v60; v38 = 16; if ( v60 ) { v6 = (void **)v62; v7 = v63 + 8; if ( v62 < v63 + 8 ) { do { v8 = *v6++; operator delete(v8, 0x1F8uLL); } while ( (unsigned long long)v6 < v7 ); v5 = v60; } operator delete(v5, 8 * v61); } std::string::_M_dispose(v59); if ( v58.m128i_i64[1] ) std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release(); std::string::_M_dispose(v57); v9 = *a2; v10 = a2[1]; v41 = 0LL; v42 = 0LL; if ( !v40.m128i_i64[0] ) { std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v41); goto LABEL_45; } v11 = *(_QWORD *)(v40.m128i_i64[0] + 40); *((_QWORD *)&v42 + 1) = v9; LOBYTE(v44) = 0; v43 = 0LL; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::_M_fill_assign( &v41, (unsigned int)(v11 + 3), &v43); v12 = v40.m128i_i64[0]; v13 = v9 + v10; v14 = *(_QWORD *)(v40.m128i_i64[0] + 64) - *(_QWORD *)(v40.m128i_i64[0] + 56); v47 = v40.m128i_i64[0]; v48 = &v41; v43 = 0LL; v15 = 0xAAAAAAAAAAAAAAABLL * (v14 >> 4); v44 = 0LL; v46 = &v38; n = v15; v45 = _mm_unpacklo_epi64((__m128i)v9, (__m128i)v13); if ( (v38 & 0x400) != 0 ) { if ( v14 < 0 ) std::__throw_length_error("cannot create std::vector larger than max_size()"); *(_OWORD *)v49 = 0LL; v50 = 0LL; if ( v15 ) { nc = 0x1555555555555556LL * (v14 >> 4); v21 = (_QWORD *)operator new(nc * 8); v49[0] = v21; v22 = &v21[nc]; v50 = (char *)&v21[nc]; do { *v21 = 0LL; v21 += 2; *((_DWORD *)v21 - 2) = 0; } while ( v21 != v22 ); v12 = v47; n = 0xAAAAAAAAAAAAAAABLL * ((long long)(*(_QWORD *)(v47 + 64) - *(_QWORD *)(v47 + 56)) >> 4); v23 = n; } else { v49[0] = 0LL; v22 = 0LL; v23 = 0LL; v50 = 0LL; } v24 = *(_QWORD *)(v12 + 32); v49[1] = v22; v52 = 0LL; v36 = v24; v51 = 0LL; v25 = (void *)operator new[](v23); if ( (long long)(n - 1) >= 0 ) v25 = memset(v25, 0, n); v53 = v25; v55 = 0; v54 = v36; *((_QWORD *)&v44 + 1) = v45.m128i_i64[0]; na = std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,false>::_M_main_dispatch(&v43); if ( na ) { LABEL_59: na = 1; } else { v26 = v55; if ( (v55 & 0x40) == 0 ) { LOBYTE(v26) = v55 | 0x80; v55 = v26; while ( v45.m128i_i64[0] != v45.m128i_i64[1] ) { *((_QWORD *)&v44 + 1) = ++v45.m128i_i64[0]; if ( (unsigned __int8)std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,false>::_M_main_dispatch(&v43) ) goto LABEL_59; } } } if ( v53 ) operator delete[](v53); std::vector<std::pair<long,std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>>>::~vector(&v51); if ( v49[0] ) operator delete(v49[0], v50 - (char *)v49[0]); std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v43); if ( !na ) goto LABEL_25; } else { if ( v14 < 0 ) std::__throw_length_error("cannot create std::vector larger than max_size()"); v50 = 0LL; *(_OWORD *)v49 = 0LL; if ( v14 ) { nb = 0x1555555555555556LL * (v14 >> 4); v16 = (_QWORD *)operator new(nb * 8); v49[0] = v16; v17 = &v16[nb]; v50 = (char *)&v16[nb]; do { *v16 = 0LL; v16 += 2; *((_DWORD *)v16 - 2) = 0; } while ( v16 != v17 ); v12 = v47; v18 = v48; } else { v49[0] = 0LL; v18 = &v41; v17 = 0LL; v50 = 0LL; } v19 = *(_QWORD *)(v12 + 32); v49[1] = v17; v51 = v19; LODWORD(v52) = 0; *((_QWORD *)&v44 + 1) = v45.m128i_i64[0]; BYTE4(v52) = 0; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::operator=(&v43, v18); std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,true>::_M_dfs( &v43, 1LL, v51); if ( !BYTE4(v52) ) { v20 = v52; if ( (v52 & 0x40) == 0 ) { LOBYTE(v20) = v52 | 0x80; LODWORD(v52) = v20; while ( v45.m128i_i64[0] != v45.m128i_i64[1] ) { BYTE4(v52) = 0; *((_QWORD *)&v44 + 1) = ++v45.m128i_i64[0]; *((_QWORD *)&v51 + 1) = 0LL; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::operator=(&v43, v48); std::__detail::_Executor<__gnu_cxx::__normal_iterator<char const*,std::string>,std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>,std::regex_traits<char>,true>::_M_dfs( &v43, 1LL, v51); if ( BYTE4(v52) ) goto LABEL_49; } } if ( v49[0] ) operator delete(v49[0], v50 - (char *)v49[0]); std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v43); LABEL_25: v37[2] = 0LL; v37[1] = v13; v37[0] = v13; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::_M_fill_assign(&v41, 3LL, v37); std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v41); LABEL_45: *(_QWORD *)a1 = a1 + 16; strcpy((char *)(a1 + 16), "Not matched!"); *(_QWORD *)(a1 + 8) = 12LL; goto LABEL_46; } LABEL_49: if ( v49[0] ) operator delete(v49[0], v50 - (char *)v49[0]); std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v43); } v28 = (_QWORD *)v41; for ( i = v41; *((_QWORD *)&i + 1) != (_QWORD)i; *(_QWORD *)&i = i + 24 ) { if ( !*(_BYTE *)(i + 16) ) { *(_QWORD *)(i + 8) = v13; *(_QWORD *)i = v13; } } *(_QWORD *)(*((_QWORD *)&i + 1) - 48LL) = v9; *(_QWORD *)&i = *((_QWORD *)&i + 1) - 24LL; v30 = *((_QWORD *)&i + 1) - 48LL; *((_QWORD *)&i + 1) = *v28; *(_QWORD *)(v30 + 8) = *v28; v31 = *((_QWORD *)&i + 1) == v9; *((_QWORD *)&i + 1) = v28[1]; *(_BYTE *)(v30 + 16) = !v31; *(_QWORD *)i = *((_QWORD *)&i + 1); *(_QWORD *)(i + 8) = v13; *(_BYTE *)(i + 16) = *((_QWORD *)&i + 1) != v13; std::vector<std::sub_match<__gnu_cxx::__normal_iterator<char const*,std::string>>>::~vector(&v41); strcpy((char *)(a1 + 16), "Found a match!"); *(_QWORD *)a1 = a1 + 16; *(_QWORD *)(a1 + 8) = 14LL; LABEL_46: if ( v40.m128i_i64[1] ) std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release(); std::locale::~locale((std::locale *)v39); return a1; }
func0: ENDBR64 PUSH R15 MOV R15,RSI PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX MOV RBX,RDI SUB RSP,0x2b8 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x2a8],RAX XOR EAX,EAX LEA R14,[RSP + 0x48] MOV RDI,R14 CALL 0x00104730 LEA RDX,[0x11a64f] PXOR XMM0,XMM0 LEA RDI,[RSP + 0x110] MOV R8D,0x10 MOV RCX,R14 LEA RSI,[RDX + -0x7] MOVAPS xmmword ptr [RSP + 0x50],XMM0 LAB_00105cd0: CALL 0x00118b20 MOVDQA XMM0,xmmword ptr [RSP + 0x210] MOV RDI,qword ptr [RSP + 0x58] PXOR XMM1,XMM1 MOVAPS xmmword ptr [RSP + 0x210],XMM1 MOVAPS xmmword ptr [RSP + 0x50],XMM0 TEST RDI,RDI JZ 0x00105cfe CALL 0x00107680 LAB_00105cfe: MOV RDI,qword ptr [RSP + 0x240] MOV dword ptr [RSP + 0x40],0x10 TEST RDI,RDI JZ 0x00105d64 MOV RAX,qword ptr [RSP + 0x288] MOV RBP,qword ptr [RSP + 0x268] LEA R12,[RAX + 0x8] CMP RBP,R12 JNC 0x00105d4f NOP dword ptr [RAX] LAB_00105d30: MOV RDI,qword ptr [RBP] MOV ESI,0x1f8 ADD RBP,0x8 CALL 0x001045a0 CMP RBP,R12 JC 0x00105d30 MOV RDI,qword ptr [RSP + 0x240] LAB_00105d4f: MOV RAX,qword ptr [RSP + 0x248] LEA RSI,[RAX*0x8] CALL 0x001045a0 LAB_00105d64: LEA RDI,[RSP + 0x220] CALL 0x00104620 MOV RDI,qword ptr [RSP + 0x218] TEST RDI,RDI JZ 0x00105d83 CALL 0x00107680 LAB_00105d83: LEA RDI,[RSP + 0x1e0] CALL 0x00104620 PXOR XMM0,XMM0 MOV R13,qword ptr [R15] MOV RBP,qword ptr [R15 + 0x8] MOV RAX,qword ptr [RSP + 0x50] MOVAPS xmmword ptr [RSP + 0x60],XMM0 MOVAPS xmmword ptr [RSP + 0x70],XMM0 TEST RAX,RAX JZ 0x00106210 MOV RAX,qword ptr [RAX + 0x28] LEA R15,[RSP + 0x60] LEA R12,[RSP + 0x80] MOV qword ptr [RSP + 0x78],R13 MOV RDX,R12 MOV RDI,R15 MOV byte ptr [RSP + 0x90],0x0 LEA ESI,[RAX + 0x3] LEA RAX,[RSP + 0x40] MOVAPS xmmword ptr [RSP + 0x80],XMM0 MOV qword ptr [RSP + 0x10],RAX LAB_00105dec: CALL 0x00108d60 MOV RCX,qword ptr [RSP + 0x50] ADD RBP,R13 MOVQ XMM1,R13 MOV RSI,-0x5555555555555555 MOVQ XMM2,RBP PXOR XMM0,XMM0 MOV RDX,qword ptr [RCX + 0x40] SUB RDX,qword ptr [RCX + 0x38] PUNPCKLQDQ XMM1,XMM2 MOV qword ptr [RSP + 0xb8],RCX MOV RAX,RDX MOV qword ptr [RSP + 0xc0],R15 SAR RAX,0x4 MOVAPS xmmword ptr [RSP + 0x80],XMM0 IMUL RAX,RSI LEA RSI,[RSP + 0x40] TEST byte ptr [RSP + 0x41],0x4 MOVAPS xmmword ptr [RSP + 0x90],XMM0 MOV qword ptr [RSP + 0x10],RSI MOV qword ptr [RSP + 0xb0],RSI MOV qword ptr [RSP + 0x8],RAX MOVAPS xmmword ptr [RSP + 0xa0],XMM1 JNZ 0x00106038 TEST RDX,RDX JS 0x0010639f MOV qword ptr [RSP + 0xd8],0x0 MOVUPS xmmword ptr [RSP + 0xc8],XMM0 JZ 0x00106340 SHL RAX,0x4 MOV RDI,RAX MOV qword ptr [RSP + 0x8],RAX LAB_00105ea1: CALL 0x00104590 MOV RDX,qword ptr [RSP + 0x8] MOV qword ptr [RSP + 0xc8],RAX ADD RDX,RAX MOV qword ptr [RSP + 0xd8],RDX NOP LAB_00105ec0: MOV qword ptr [RAX],0x0 ADD RAX,0x10 MOV dword ptr [RAX + -0x8],0x0 CMP RAX,RDX JNZ 0x00105ec0 MOV RCX,qword ptr [RSP + 0xb8] MOV RSI,qword ptr [RSP + 0xc0] LAB_00105ee7: MOV RAX,qword ptr [RCX + 0x20] MOV RDI,R12 MOV qword ptr [RSP + 0xd0],RDX MOV qword ptr [RSP + 0xe8],0x0 MOV qword ptr [RSP + 0xe0],RAX MOV RAX,qword ptr [RSP + 0xa0] MOV dword ptr [RSP + 0xf0],0x0 MOV qword ptr [RSP + 0x98],RAX MOV byte ptr [RSP + 0xf4],0x0 LAB_00105f2d: CALL 0x00105010 MOV RDX,qword ptr [RSP + 0xe0] MOV ESI,0x1 MOV RDI,R12 CALL 0x00111b70 CMP byte ptr [RSP + 0xf4],0x0 JNZ 0x00106288 MOV EAX,dword ptr [RSP + 0xf0] TEST AL,0x40 JNZ 0x00105fdd OR AL,0x80 MOV dword ptr [RSP + 0xf0],EAX JMP 0x00105fcb LAB_00105f70: MOV RSI,qword ptr [RSP + 0xc0] ADD RAX,0x1 MOV RDI,R12 MOV byte ptr [RSP + 0xf4],0x0 MOV qword ptr [RSP + 0xa0],RAX MOV qword ptr [RSP + 0x98],RAX MOV qword ptr [RSP + 0xe8],0x0 CALL 0x00105010 MOV RDX,qword ptr [RSP + 0xe0] MOV ESI,0x1 MOV RDI,R12 CALL 0x00111b70 CMP byte ptr [RSP + 0xf4],0x0 JNZ 0x00106288 LAB_00105fcb: MOV RAX,qword ptr [RSP + 0xa0] CMP RAX,qword ptr [RSP + 0xa8] JNZ 0x00105f70 LAB_00105fdd: MOV RDI,qword ptr [RSP + 0xc8] TEST RDI,RDI JZ 0x00105ffa MOV RSI,qword ptr [RSP + 0xd8] SUB RSI,RDI CALL 0x001045a0 LAB_00105ffa: MOV RDI,R12 CALL 0x00107900 LAB_00106002: LEA RDX,[RSP + 0x20] MOV ESI,0x3 MOV RDI,R15 MOV qword ptr [RSP + 0x30],0x0 MOV qword ptr [RSP + 0x28],RBP MOV qword ptr [RSP + 0x20],RBP LAB_00106022: CALL 0x00108d60 MOV RDI,R15 CALL 0x00107900 JMP 0x0010621a LAB_00106038: TEST RDX,RDX JS 0x001063be CMP qword ptr [RSP + 0x8],0x0 MOVUPS xmmword ptr [RSP + 0xc8],XMM0 MOV qword ptr [RSP + 0xd8],0x0 JZ 0x00106368 SHL RAX,0x4 MOV RDI,RAX MOV qword ptr [RSP + 0x8],RAX LAB_0010606d: CALL 0x00104590 MOV RDX,qword ptr [RSP + 0x8] MOV qword ptr [RSP + 0xc8],RAX ADD RDX,RAX MOV qword ptr [RSP + 0xd8],RDX NOP word ptr [RAX + RAX*0x1] LAB_00106090: MOV qword ptr [RAX],0x0 ADD RAX,0x10 MOV dword ptr [RAX + -0x8],0x0 CMP RAX,RDX JNZ 0x00106090 MOV RCX,qword ptr [RSP + 0xb8] MOV RSI,-0x5555555555555555 MOV RAX,qword ptr [RCX + 0x40] SUB RAX,qword ptr [RCX + 0x38] SAR RAX,0x4 IMUL RAX,RSI MOV qword ptr [RSP + 0x8],RAX MOV RDI,RAX LAB_001060d1: MOV RAX,qword ptr [RCX + 0x20] PXOR XMM0,XMM0 MOV qword ptr [RSP + 0xd0],RDX MOV qword ptr [RSP + 0xf0],0x0 MOV qword ptr [RSP + 0x18],RAX MOVAPS xmmword ptr [RSP + 0xe0],XMM0 LAB_001060fa: CALL 0x001043c0 MOV RCX,RAX MOV RAX,qword ptr [RSP + 0x8] SUB RAX,0x1 JS 0x0010611f MOV RDX,qword ptr [RSP + 0x8] MOV RDI,RCX XOR ESI,ESI CALL 0x001044d0 MOV RCX,RAX LAB_0010611f: MOV RAX,qword ptr [RSP + 0x18] MOV RDI,R12 MOV qword ptr [RSP + 0xf8],RCX MOV dword ptr [RSP + 0x108],0x0 MOV qword ptr [RSP + 0x100],RAX MOV RAX,qword ptr [RSP + 0xa0] MOV qword ptr [RSP + 0x98],RAX LAB_00106152: CALL 0x00105540 MOV byte ptr [RSP + 0x8],AL TEST AL,AL JNZ 0x00106390 MOV EAX,dword ptr [RSP + 0x108] TEST AL,0x40 JNZ 0x001061b6 OR AL,0x80 MOV dword ptr [RSP + 0x108],EAX JMP 0x001061a4 LAB_00106180: ADD RAX,0x1 MOV RDI,R12 MOV qword ptr [RSP + 0xa0],RAX MOV qword ptr [RSP + 0x98],RAX CALL 0x00105540 TEST AL,AL JNZ 0x00106390 LAB_001061a4: MOV RAX,qword ptr [RSP + 0xa0] CMP RAX,qword ptr [RSP + 0xa8] JNZ 0x00106180 LAB_001061b6: MOV RDI,qword ptr [RSP + 0xf8] TEST RDI,RDI JZ 0x001061c8 CALL 0x00104640 LAB_001061c8: LEA RDI,[RSP + 0xe0] CALL 0x001086a0 MOV RDI,qword ptr [RSP + 0xc8] TEST RDI,RDI JZ 0x001061f2 MOV RSI,qword ptr [RSP + 0xd8] SUB RSI,RDI CALL 0x001045a0 LAB_001061f2: MOV RDI,R12 CALL 0x00107900 CMP byte ptr [RSP + 0x8],0x0 JNZ 0x001062ad JMP 0x00106002 LAB_00106210: LEA RDI,[RSP + 0x60] CALL 0x00107900 LAB_0010621a: LEA RAX,[RBX + 0x10] MOV dword ptr [RBX + 0x18],0x21646568 MOV RCX,0x6374616d20746f4e MOV qword ptr [RBX],RAX MOV qword ptr [RBX + 0x10],RCX MOV qword ptr [RBX + 0x8],0xc MOV byte ptr [RBX + 0x1c],0x0 LAB_00106242: MOV RDI,qword ptr [RSP + 0x58] TEST RDI,RDI JZ 0x00106251 CALL 0x00107680 LAB_00106251: MOV RDI,R14 CALL 0x00104680 MOV RAX,qword ptr [RSP + 0x2a8] SUB RAX,qword ptr FS:[0x28] JNZ 0x0010639a ADD RSP,0x2b8 MOV RAX,RBX POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00106288: MOV RDI,qword ptr [RSP + 0xc8] TEST RDI,RDI JZ 0x001062a5 MOV RSI,qword ptr [RSP + 0xd8] SUB RSI,RDI CALL 0x001045a0 LAB_001062a5: MOV RDI,R12 CALL 0x00107900 LAB_001062ad: MOV RCX,qword ptr [RSP + 0x60] MOV RDX,qword ptr [RSP + 0x68] MOV RAX,RCX CMP RCX,RDX JZ 0x001062d6 NOP LAB_001062c0: CMP byte ptr [RAX + 0x10],0x0 JNZ 0x001062cd MOV qword ptr [RAX + 0x8],RBP MOV qword ptr [RAX],RBP LAB_001062cd: ADD RAX,0x18 CMP RDX,RAX JNZ 0x001062c0 LAB_001062d6: MOV qword ptr [RDX + -0x30],R13 LEA RAX,[RDX + -0x18] LEA RSI,[RDX + -0x30] MOV RDX,qword ptr [RCX] MOV RDI,R15 MOV qword ptr [RSI + 0x8],RDX CMP RDX,R13 MOV RDX,qword ptr [RCX + 0x8] SETNZ byte ptr [RSI + 0x10] MOV qword ptr [RAX],RDX CMP RDX,RBP MOV qword ptr [RAX + 0x8],RBP SETNZ byte ptr [RAX + 0x10] CALL 0x00107900 LEA RAX,[RBX + 0x10] MOV byte ptr [RBX + 0x1e],0x0 MOV RCX,0x206120646e756f46 MOV qword ptr [RBX + 0x10],RCX MOV RCX,0x21686374616d2061 MOV qword ptr [RBX],RAX MOV qword ptr [RBX + 0x16],RCX MOV qword ptr [RBX + 0x8],0xe JMP 0x00106242 LAB_00106340: MOV qword ptr [RSP + 0xc8],0x0 MOV RSI,R15 XOR EDX,EDX MOV qword ptr [RSP + 0xd8],0x0 JMP 0x00105ee7 LAB_00106368: MOV qword ptr [RSP + 0xc8],0x0 XOR EDX,EDX MOV RDI,RAX MOV qword ptr [RSP + 0xd8],0x0 JMP 0x001060d1 LAB_00106390: MOV byte ptr [RSP + 0x8],0x1 JMP 0x001061b6 LAB_0010639a: CALL 0x001045e0 LAB_0010639f: MOV RAX,qword ptr [RSP + 0x2a8] SUB RAX,qword ptr FS:[0x28] JNZ 0x001063dd LEA RDI,[0x11a1a0] LAB_001063b9: CALL 0x001044b0 LAB_001063be: MOV RAX,qword ptr [RSP + 0x2a8] SUB RAX,qword ptr FS:[0x28] JNZ 0x001063e2 LEA RDI,[0x11a1a0] LAB_001063d8: CALL 0x001044b0 LAB_001063dd: CALL 0x001045e0 LAB_001063e2: CALL 0x001045e0
/* func0(std::string const&) */ string * func0(string *param_1) { ulong uVar1; int8 uVar2; ulong uVar3; int auVar4 [16]; bool bVar5; char cVar6; long lVar7; int8 *puVar8; int8 *puVar9; ulong uVar10; ulong *puVar11; long lVar12; ulong uVar13; ulong *in_RSI; uint *puVar14; _Match_mode _Var15; long in_FS_OFFSET; ulong local_2c8; ulong local_2c0; int8 local_2b8; uint local_2a8 [2]; locale local_2a0 [2]; int local_298 [16]; int local_288 [16]; int local_278 [16]; vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> local_268 [16]; int local_258 [8]; ulong uStack_250; ulong local_248; ulong uStack_240; uint *local_238; long local_230; vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> *local_228; int local_220 [16]; int8 *local_210; int local_208 [16]; int8 local_1f8; void *local_1f0; int8 local_1e8; uint local_1e0; _Compiler<std::regex_traits<char>> local_1d8 [256]; int local_d8 [48]; void *local_a8; long local_a0; int8 *local_80; long local_60; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); std::locale::locale(local_2a0); local_298 = (int [16])0x0; /* try { // try from 00105cd0 to 00105cd4 has its CatchHandler @ 001063f3 */ std::__detail::_Compiler<std::regex_traits<char>>::_Compiler (local_1d8,"ab{2,3}","",local_2a0,0x10); auVar4 = local_d8._0_16_; uVar2 = local_298._8_8_; local_d8._0_16_ = (int [16])0x0; local_298 = auVar4; if ((_Sp_counted_base<(_Lock_policy)2> *)uVar2 != (_Sp_counted_base<(_Lock_policy)2> *)0x0) { std::_Sp_counted_base<(_Lock_policy)2>::_M_release((_Sp_counted_base<(_Lock_policy)2> *)uVar2); } local_2a8[0] = 0x10; if (local_a8 != (void *)0x0) { for (puVar9 = local_80; puVar9 < (int8 *)(local_60 + 8U); puVar9 = puVar9 + 1) { operator_delete((void *)*puVar9,0x1f8); } operator_delete(local_a8,local_a0 * 8); } std::string::_M_dispose(); if ((_Sp_counted_base<(_Lock_policy)2> *)local_d8._8_8_ != (_Sp_counted_base<(_Lock_policy)2> *)0x0) { std::_Sp_counted_base<(_Lock_policy)2>::_M_release ((_Sp_counted_base<(_Lock_policy)2> *)local_d8._8_8_); } std::string::_M_dispose(); uVar1 = *in_RSI; uVar13 = in_RSI[1]; local_288 = (int [16])0x0; local_278 = (int [16])0x0; if (local_298._0_8_ == 0) { 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_288); LAB_0010621a: *(int4 *)(param_1 + 0x18) = 0x21646568; *(string **)param_1 = param_1 + 0x10; *(int8 *)(param_1 + 0x10) = 0x6374616d20746f4e; *(int8 *)(param_1 + 8) = 0xc; param_1[0x1c] = (string)0x0; } else { local_278._8_8_ = 0; local_278._0_8_ = uVar1; local_278 = local_278 << 0x40; auVar4[0xf] = 0; auVar4._0_15_ = stack0xfffffffffffffda9; _local_258 = auVar4 << 8; local_268[0] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[1] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[2] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[3] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[4] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[5] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[6] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[7] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[8] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[9] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[10] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[0xb] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[0xc] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[0xd] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[0xe] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[0xf] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; /* try { // try from 00105dec to 00105df0 has its CatchHandler @ 001063ff */ std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::_M_fill_assign((vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> *)local_288,(ulong)((int)*(int8 *)(local_298._0_8_ + 0x28) + 3), (sub_match *)local_268); uVar13 = uVar13 + uVar1; lVar12 = *(long *)(local_298._0_8_ + 0x40) - *(long *)(local_298._0_8_ + 0x38); local_230 = local_298._0_8_; lVar7 = lVar12 >> 4; local_268[0] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[1] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[2] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[3] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[4] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[5] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[6] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[7] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[8] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[9] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[10] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[0xb] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[0xc] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[0xd] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[0xe] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; local_268[0xf] = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> )0x0; puVar14 = local_2a8; _local_258 = (int [16])0x0; local_258 = (int [8])0x0; local_248 = uVar1; uStack_240 = uVar13; local_238 = puVar14; local_228 = (vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> *)local_288; if ((local_2a8[0] & 0x400) == 0) { if (lVar12 < 0) { if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } /* WARNING: Subroutine does not return */ /* try { // try from 001063b9 to 001063bd has its CatchHandler @ 00106423 */ std::__throw_length_error("cannot create std::vector larger than max_size()"); } local_210 = (int8 *)0x0; local_220 = (int [16])0x0; if (lVar12 == 0) { local_220._0_8_ = (int8 *)0x0; local_210 = (int8 *)0x0; } else { /* try { // try from 00105ea1 to 00105ea5 has its CatchHandler @ 00106423 */ local_220._0_8_ = operator_new(lVar7 * -0x5555555555555550); local_210 = (int8 *)(local_220._0_8_ + lVar7 * -0xaaaaaaaaaaaaaaa * 8); puVar9 = (int8 *)local_220._0_8_; do { *puVar9 = 0; puVar8 = puVar9 + 2; *(int4 *)(puVar9 + 1) = 0; puVar9 = puVar8; } while (puVar8 != local_210); } local_220._8_8_ = local_210; local_208._8_8_ = 0; local_208._0_8_ = *(ulong *)(local_230 + 0x20); uStack_250 = local_248; local_1f8 = (ulong)local_1f8._5_3_ << 0x28; /* try { // try from 00105f2d to 00105fbc has its CatchHandler @ 0010642f */ std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::operator=(local_268,(vector *)local_228); std::__detail:: _Executor<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,std::regex_traits<char>,true> ::_M_dfs((_Executor<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,std::regex_traits<char>,true> *)local_268,1,local_208._0_8_); if (local_1f8._4_1_ == '\0') { if ((local_1f8 & 0x40) != 0) { LAB_00105fdd: if ((void *)local_220._0_8_ != (void *)0x0) { operator_delete((void *)local_220._0_8_,(long)local_210 - local_220._0_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_268); goto LAB_00106002; } local_1f8 = local_1f8 | 0x80; do { if (local_248 == uStack_240) goto LAB_00105fdd; local_248 = local_248 + 1; local_1f8._0_5_ = (uint5)(uint)local_1f8; uStack_250 = local_248; local_208._8_8_ = 0; std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::operator=(local_268,(vector *)local_228); std::__detail:: _Executor<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,std::regex_traits<char>,true> ::_M_dfs((_Executor<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,std::regex_traits<char>,true> *)local_268,1,local_208._0_8_); } while (local_1f8._4_1_ == '\0'); } if ((void *)local_220._0_8_ != (void *)0x0) { operator_delete((void *)local_220._0_8_,(long)local_210 - local_220._0_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_268); } else { if (lVar12 < 0) { if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } /* WARNING: Subroutine does not return */ /* try { // try from 001063d8 to 001063dc has its CatchHandler @ 00106417 */ std::__throw_length_error("cannot create std::vector larger than max_size()"); } local_220 = (int [16])0x0; local_210 = (int8 *)0x0; if (lVar7 * -0x5555555555555555 == 0) { local_220._0_8_ = (int8 *)0x0; local_210 = (int8 *)0x0; uVar10 = 0; } else { /* try { // try from 0010606d to 00106071 has its CatchHandler @ 00106417 */ local_220._0_8_ = operator_new(lVar7 * -0x5555555555555550); local_210 = (int8 *)(local_220._0_8_ + lVar7 * -0xaaaaaaaaaaaaaaa * 8); puVar9 = (int8 *)local_220._0_8_; do { *puVar9 = 0; puVar8 = puVar9 + 2; *(int4 *)(puVar9 + 1) = 0; puVar9 = puVar8; } while (puVar8 != local_210); puVar14 = (uint *)0xaaaaaaaaaaaaaaab; uVar10 = (*(long *)(local_230 + 0x40) - *(long *)(local_230 + 0x38) >> 4) * -0x5555555555555555; } uVar2 = *(int8 *)(local_230 + 0x20); local_220._8_8_ = local_210; local_1f8 = 0; local_208 = (int [16])0x0; /* try { // try from 001060fa to 001060fe has its CatchHandler @ 0010640b */ local_1f0 = operator_new__(uVar10); if (-1 < (long)(uVar10 - 1)) { puVar14 = (uint *)0x0; local_1f0 = memset(local_1f0,0,uVar10); } local_1e0 = 0; uStack_250 = local_248; _Var15 = (_Match_mode)local_268; local_1e8 = uVar2; /* try { // try from 00106152 to 0010619b has its CatchHandler @ 001063e7 */ cVar6 = std::__detail:: _Executor<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,std::regex_traits<char>,false> ::_M_main_dispatch(_Var15,(integral_constant)puVar14); if (cVar6 == '\0') { bVar5 = false; if ((local_1e0 & 0x40) == 0) { local_1e0 = local_1e0 | 0x80; do { if (local_248 == uStack_240) goto LAB_001061b6; local_248 = local_248 + 1; uStack_250 = local_248; cVar6 = std::__detail:: _Executor<__normal_iterator<char_const*,std::string>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>,std::regex_traits<char>,false> ::_M_main_dispatch(_Var15,(integral_constant)puVar14); } while (cVar6 == '\0'); goto LAB_00106390; } } else { LAB_00106390: bVar5 = true; } LAB_001061b6: if (local_1f0 != (void *)0x0) { operator_delete__(local_1f0); } std:: vector<std::pair<long,std::vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>>>,std::allocator<std::pair<long,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::pair<long,std::vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>>>,std::allocator<std::pair<long,std::vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>>>>> *)local_208); if ((void *)local_220._0_8_ != (void *)0x0) { operator_delete((void *)local_220._0_8_,(long)local_210 - local_220._0_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_268); if (!bVar5) { LAB_00106002: local_2b8 = 0; local_2c8 = uVar13; local_2c0 = uVar13; /* try { // try from 00106022 to 00106026 has its CatchHandler @ 001063ff */ std:: vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> ::_M_fill_assign((vector<std::sub_match<__normal_iterator<char_const*,std::string>>,std::allocator<std::sub_match<__normal_iterator<char_const*,std::string>>>> *)local_288,3,(sub_match *)&local_2c8); 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_288); goto LAB_0010621a; } } for (puVar11 = (ulong *)local_288._0_8_; puVar11 != (ulong *)local_288._8_8_; puVar11 = puVar11 + 3) { if (*(char *)(puVar11 + 2) == '\0') { puVar11[1] = uVar13; *puVar11 = uVar13; } } *(ulong *)(local_288._8_8_ + -0x30) = uVar1; uVar10 = *(ulong *)local_288._0_8_; *(ulong *)(local_288._8_8_ + -0x28) = uVar10; uVar3 = *(ulong *)(local_288._0_8_ + 8); *(bool *)(local_288._8_8_ + -0x20) = uVar10 != uVar1; *(ulong *)(local_288._8_8_ + -0x18) = uVar3; *(ulong *)(local_288._8_8_ + -0x10) = uVar13; *(bool *)(local_288._8_8_ + -8) = uVar3 != uVar13; 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_288); param_1[0x1e] = (string)0x0; *(int8 *)(param_1 + 0x10) = 0x206120646e756f46; *(string **)param_1 = param_1 + 0x10; *(int8 *)(param_1 + 0x16) = 0x21686374616d2061; *(int8 *)(param_1 + 8) = 0xe; } if ((_Sp_counted_base<(_Lock_policy)2> *)local_298._8_8_ != (_Sp_counted_base<(_Lock_policy)2> *)0x0) { std::_Sp_counted_base<(_Lock_policy)2>::_M_release ((_Sp_counted_base<(_Lock_policy)2> *)local_298._8_8_); } std::locale::~locale(local_2a0); if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
1,140
func0
#include <vector> #include <climits> #include <assert.h>
int func0(std::vector<int>& a, int n, int k) { int max_so_far = INT_MIN; int max_ending_here = 0; for (int i = 0; i < n * k; i++) { max_ending_here = max_ending_here + a[i % n]; if (max_so_far < max_ending_here) { max_so_far = max_ending_here; } if (max_ending_here < 0) { max_ending_here = 0; } } return max_so_far; }
int main() { std::vector<int> v1 = {10, 20, -30, -1}; std::vector<int> v2 = {-1, 10, 20}; std::vector<int> v3 = {-1, -2, -3}; assert(func0(v1, 4, 3) == 30); assert(func0(v2, 3, 2) == 59); assert(func0(v3, 3, 3) == -1); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> >&, int, int): endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) mov %edx,-0x20(%rbp) movl $0x80000000,-0xc(%rbp) movl $0x0,-0x8(%rbp) movl $0x0,-0x4(%rbp) mov -0x1c(%rbp),%eax imul -0x20(%rbp),%eax cmp %eax,-0x4(%rbp) jge 12a1 <_Z5func0RSt6vectorIiSaIiEEii+0x78> mov -0x4(%rbp),%eax cltd idivl -0x1c(%rbp) mov %edx,%eax movslq %eax,%rdx mov -0x18(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1590 <_ZNSt6vectorIiSaIiEEixEm> mov (%rax),%eax add %eax,-0x8(%rbp) mov -0xc(%rbp),%eax cmp -0x8(%rbp),%eax jge 128e <_Z5func0RSt6vectorIiSaIiEEii+0x65> mov -0x8(%rbp),%eax mov %eax,-0xc(%rbp) cmpl $0x0,-0x8(%rbp) jns 129b <_Z5func0RSt6vectorIiSaIiEEii+0x72> movl $0x0,-0x8(%rbp) addl $0x1,-0x4(%rbp) jmp 1254 <_Z5func0RSt6vectorIiSaIiEEii+0x2b> mov -0xc(%rbp),%eax leaveq retq
_Z5func0RSt6vectorIiSaIiEEii: endbr64 push rbp mov rbp, rsp sub rsp, 20h mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_20], edx mov [rbp+var_C], 80000000h mov [rbp+var_8], 0 mov [rbp+var_4], 0 jmp short loc_12B5 loc_1276: mov eax, [rbp+var_4] cdq idiv [rbp+var_1C] mov eax, edx movsxd rdx, eax mov rax, [rbp+var_18] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] add [rbp+var_8], eax mov eax, [rbp+var_C] cmp eax, [rbp+var_8] jge short loc_12A4 mov eax, [rbp+var_8] mov [rbp+var_C], eax loc_12A4: cmp [rbp+var_8], 0 jns short loc_12B1 mov [rbp+var_8], 0 loc_12B1: add [rbp+var_4], 1 loc_12B5: mov eax, [rbp+var_1C] imul eax, [rbp+var_20] cmp [rbp+var_4], eax jl short loc_1276 mov eax, [rbp+var_C] leave retn
long long func0(long long a1, int a2, int a3) { unsigned int v5; // [rsp+14h] [rbp-Ch] int v6; // [rsp+18h] [rbp-8h] int i; // [rsp+1Ch] [rbp-4h] v5 = 0x80000000; v6 = 0; for ( i = 0; i < a3 * a2; ++i ) { v6 += *(_DWORD *)std::vector<int>::operator[](a1, i % a2); if ( (int)v5 < v6 ) v5 = v6; if ( v6 < 0 ) v6 = 0; } return v5; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0x20],EDX MOV dword ptr [RBP + -0xc],0x80000000 MOV dword ptr [RBP + -0x8],0x0 MOV dword ptr [RBP + -0x4],0x0 JMP 0x001012b5 LAB_00101276: MOV EAX,dword ptr [RBP + -0x4] CDQ IDIV dword ptr [RBP + -0x1c] MOV EAX,EDX MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x18] MOV RSI,RDX MOV RDI,RAX CALL 0x001015e2 MOV EAX,dword ptr [RAX] ADD dword ptr [RBP + -0x8],EAX MOV EAX,dword ptr [RBP + -0xc] CMP EAX,dword ptr [RBP + -0x8] JGE 0x001012a4 MOV EAX,dword ptr [RBP + -0x8] MOV dword ptr [RBP + -0xc],EAX LAB_001012a4: CMP dword ptr [RBP + -0x8],0x0 JNS 0x001012b1 MOV dword ptr [RBP + -0x8],0x0 LAB_001012b1: ADD dword ptr [RBP + -0x4],0x1 LAB_001012b5: MOV EAX,dword ptr [RBP + -0x1c] IMUL EAX,dword ptr [RBP + -0x20] CMP dword ptr [RBP + -0x4],EAX JL 0x00101276 MOV EAX,dword ptr [RBP + -0xc] LEAVE RET
/* func0(std::vector<int, std::allocator<int> >&, int, int) */ int func0(vector *param_1,int param_2,int param_3) { int *piVar1; int4 local_14; int4 local_10; int4 local_c; local_14 = -0x80000000; local_10 = 0; for (local_c = 0; local_c < param_2 * param_3; local_c = local_c + 1) { piVar1 = (int *)std::vector<int,std::allocator<int>>::operator[] ((vector<int,std::allocator<int>> *)param_1,(long)(local_c % param_2)) ; local_10 = local_10 + *piVar1; if (local_14 < local_10) { local_14 = local_10; } if (local_10 < 0) { local_10 = 0; } } return local_14; }
1,141
func0
#include <vector> #include <climits> #include <assert.h>
int func0(std::vector<int>& a, int n, int k) { int max_so_far = INT_MIN; int max_ending_here = 0; for (int i = 0; i < n * k; i++) { max_ending_here = max_ending_here + a[i % n]; if (max_so_far < max_ending_here) { max_so_far = max_ending_here; } if (max_ending_here < 0) { max_ending_here = 0; } } return max_so_far; }
int main() { std::vector<int> v1 = {10, 20, -30, -1}; std::vector<int> v2 = {-1, 10, 20}; std::vector<int> v3 = {-1, -2, -3}; assert(func0(v1, 4, 3) == 30); assert(func0(v2, 3, 2) == 59); assert(func0(v3, 3, 3) == -1); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> >&, int, int): endbr64 imul %esi,%edx mov %edx,%r9d test %edx,%edx jle 1259 <_Z5func0RSt6vectorIiSaIiEEii+0x50> mov (%rdi),%r11 mov $0x0,%edi mov $0x0,%ecx mov $0x80000000,%r8d mov $0x0,%r10d mov %edi,%eax cltd idiv %esi movslq %edx,%rdx mov %ecx,%eax add (%r11,%rdx,4),%eax cmp %eax,%r8d cmovl %eax,%r8d test %eax,%eax cmovs %r10d,%eax mov %eax,%ecx add $0x1,%edi cmp %r9d,%edi jne 1230 <_Z5func0RSt6vectorIiSaIiEEii+0x27> mov %r8d,%eax retq mov $0x80000000,%r8d jmp 1255 <_Z5func0RSt6vectorIiSaIiEEii+0x4c>
_Z5func0RSt6vectorIiSaIiEEii: endbr64 imul edx, esi mov r9d, edx test edx, edx jle short loc_1257 mov r10, [rdi] mov edi, 0 mov ecx, 0 mov r8d, 80000000h loc_122A: mov eax, edi cdq idiv esi movsxd rdx, edx mov eax, ecx add eax, [r10+rdx*4] cmp r8d, eax cmovl r8d, eax test eax, eax mov edx, 0 mov ecx, edx cmovns ecx, eax add edi, 1 cmp edi, r9d jnz short loc_122A loc_1253: mov eax, r8d retn loc_1257: mov r8d, 80000000h jmp short loc_1253
long long func0(long long *a1, int a2, int a3) { long long v3; // r10 int v4; // edi int v5; // ecx unsigned int v6; // r8d int v7; // eax if ( a2 * a3 <= 0 ) { return 0x80000000; } else { v3 = *a1; v4 = 0; v5 = 0; v6 = 0x80000000; do { v7 = *(_DWORD *)(v3 + 4LL * (v4 % a2)) + v5; if ( (int)v6 < v7 ) v6 = *(_DWORD *)(v3 + 4LL * (v4 % a2)) + v5; v5 = 0; if ( v7 >= 0 ) v5 = v7; ++v4; } while ( v4 != a2 * a3 ); } return v6; }
func0: ENDBR64 IMUL EDX,ESI MOV R9D,EDX TEST EDX,EDX JLE 0x00101257 MOV R10,qword ptr [RDI] MOV EDI,0x0 MOV ECX,0x0 MOV R8D,0x80000000 LAB_0010122a: MOV EAX,EDI CDQ IDIV ESI MOVSXD RDX,EDX MOV EAX,ECX ADD EAX,dword ptr [R10 + RDX*0x4] CMP R8D,EAX CMOVL R8D,EAX TEST EAX,EAX MOV EDX,0x0 MOV ECX,EDX CMOVNS ECX,EAX ADD EDI,0x1 CMP EDI,R9D JNZ 0x0010122a LAB_00101253: MOV EAX,R8D RET LAB_00101257: MOV R8D,0x80000000 JMP 0x00101253
/* func0(std::vector<int, std::allocator<int> >&, int, int) */ int func0(vector *param_1,int param_2,int param_3) { int iVar1; int iVar2; int iVar3; int iVar4; if (param_3 * param_2 < 1) { iVar4 = -0x80000000; } else { iVar3 = 0; iVar2 = 0; iVar4 = -0x80000000; do { iVar1 = iVar2 + *(int *)(*(long *)param_1 + (long)(iVar3 % param_2) * 4); if (iVar4 < iVar1) { iVar4 = iVar1; } iVar2 = 0; if (-1 < iVar1) { iVar2 = iVar1; } iVar3 = iVar3 + 1; } while (iVar3 != param_3 * param_2); } return iVar4; }
1,142
func0
#include <vector> #include <climits> #include <assert.h>
int func0(std::vector<int>& a, int n, int k) { int max_so_far = INT_MIN; int max_ending_here = 0; for (int i = 0; i < n * k; i++) { max_ending_here = max_ending_here + a[i % n]; if (max_so_far < max_ending_here) { max_so_far = max_ending_here; } if (max_ending_here < 0) { max_ending_here = 0; } } return max_so_far; }
int main() { std::vector<int> v1 = {10, 20, -30, -1}; std::vector<int> v2 = {-1, 10, 20}; std::vector<int> v3 = {-1, -2, -3}; assert(func0(v1, 4, 3) == 30); assert(func0(v2, 3, 2) == 59); assert(func0(v3, 3, 3) == -1); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> >&, int, int): endbr64 imul %esi,%edx mov %edx,%r9d test %edx,%edx jle 14e0 <_Z5func0RSt6vectorIiSaIiEEii+0x50> mov (%rdi),%r11 xor %ecx,%ecx xor %edi,%edi mov $0x80000000,%r8d xor %r10d,%r10d xchg %ax,%ax mov %edi,%eax cltd idiv %esi movslq %edx,%rdx mov (%r11,%rdx,4),%eax add %ecx,%eax cmp %eax,%r8d cmovl %eax,%r8d test %eax,%eax cmovs %r10d,%eax add $0x1,%edi mov %eax,%ecx cmp %r9d,%edi jne 14b0 <_Z5func0RSt6vectorIiSaIiEEii+0x20> mov %r8d,%eax retq nopl 0x0(%rax) mov $0x80000000,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
_Z5func0RSt6vectorIiSaIiEEii: endbr64 imul edx, esi mov r9d, edx test edx, edx jle short loc_14D0 mov r10, [rdi] xor ecx, ecx xor edi, edi mov r8d, 80000000h nop dword ptr [rax+rax+00h] loc_14A0: mov eax, edi cdq idiv esi movsxd rdx, edx mov eax, [r10+rdx*4] add eax, ecx cmp r8d, eax cmovl r8d, eax xor edx, edx test eax, eax mov ecx, edx cmovns ecx, eax add edi, 1 cmp edi, r9d jnz short loc_14A0 mov eax, r8d retn loc_14D0: mov r8d, 80000000h mov eax, r8d retn
long long func0(long long *a1, int a2, int a3) { long long v3; // r10 int v4; // ecx int v5; // edi unsigned int v6; // r8d int v7; // eax if ( a2 * a3 <= 0 ) return 0x80000000LL; v3 = *a1; v4 = 0; v5 = 0; v6 = 0x80000000; do { v7 = v4 + *(_DWORD *)(v3 + 4LL * (v5 % a2)); if ( (int)v6 < v7 ) v6 = v4 + *(_DWORD *)(v3 + 4LL * (v5 % a2)); v4 = 0; if ( v7 >= 0 ) v4 = v7; ++v5; } while ( v5 != a2 * a3 ); return v6; }
func0: ENDBR64 IMUL EDX,ESI MOV R9D,EDX TEST EDX,EDX JLE 0x001014d0 MOV R10,qword ptr [RDI] XOR ECX,ECX XOR EDI,EDI MOV R8D,0x80000000 NOP dword ptr [RAX + RAX*0x1] LAB_001014a0: MOV EAX,EDI CDQ IDIV ESI MOVSXD RDX,EDX MOV EAX,dword ptr [R10 + RDX*0x4] ADD EAX,ECX CMP R8D,EAX CMOVL R8D,EAX XOR EDX,EDX TEST EAX,EAX MOV ECX,EDX CMOVNS ECX,EAX ADD EDI,0x1 CMP EDI,R9D JNZ 0x001014a0 MOV EAX,R8D RET LAB_001014d0: MOV R8D,0x80000000 MOV EAX,R8D RET
/* func0(std::vector<int, std::allocator<int> >&, int, int) */ int func0(vector *param_1,int param_2,int param_3) { int iVar1; int iVar2; int iVar3; int iVar4; if (0 < param_3 * param_2) { iVar2 = 0; iVar3 = 0; iVar4 = -0x80000000; do { iVar1 = *(int *)(*(long *)param_1 + (long)(iVar3 % param_2) * 4) + iVar2; if (iVar4 < iVar1) { iVar4 = iVar1; } iVar2 = 0; if (-1 < iVar1) { iVar2 = iVar1; } iVar3 = iVar3 + 1; } while (iVar3 != param_3 * param_2); return iVar4; } return -0x80000000; }
1,143
func0
#include <vector> #include <climits> #include <assert.h>
int func0(std::vector<int>& a, int n, int k) { int max_so_far = INT_MIN; int max_ending_here = 0; for (int i = 0; i < n * k; i++) { max_ending_here = max_ending_here + a[i % n]; if (max_so_far < max_ending_here) { max_so_far = max_ending_here; } if (max_ending_here < 0) { max_ending_here = 0; } } return max_so_far; }
int main() { std::vector<int> v1 = {10, 20, -30, -1}; std::vector<int> v2 = {-1, 10, 20}; std::vector<int> v3 = {-1, -2, -3}; assert(func0(v1, 4, 3) == 30); assert(func0(v2, 3, 2) == 59); assert(func0(v3, 3, 3) == -1); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> >&, int, int): endbr64 imul %esi,%edx mov %edx,%r9d test %edx,%edx jle 15a0 <_Z5func0RSt6vectorIiSaIiEEii+0x50> mov (%rdi),%r11 xor %ecx,%ecx xor %edi,%edi mov $0x80000000,%r8d xor %r10d,%r10d xchg %ax,%ax mov %edi,%eax cltd idiv %esi movslq %edx,%rdx mov (%r11,%rdx,4),%eax add %ecx,%eax cmp %eax,%r8d cmovl %eax,%r8d test %eax,%eax cmovs %r10d,%eax add $0x1,%edi mov %eax,%ecx cmp %r9d,%edi jne 1570 <_Z5func0RSt6vectorIiSaIiEEii+0x20> mov %r8d,%eax retq nopl 0x0(%rax) mov $0x80000000,%r8d mov %r8d,%eax retq nopw 0x0(%rax,%rax,1)
_Z5func0RSt6vectorIiSaIiEEii: endbr64 imul edx, esi mov r9d, edx test edx, edx jle short loc_1620 mov r10, [rdi] xor ecx, ecx xor edi, edi mov r8d, 80000000h nop dword ptr [rax+rax+00h] loc_15F0: mov eax, edi cdq idiv esi movsxd rdx, edx mov eax, [r10+rdx*4] add eax, ecx cmp r8d, eax cmovl r8d, eax xor edx, edx test eax, eax mov ecx, edx cmovns ecx, eax add edi, 1 cmp edi, r9d jnz short loc_15F0 mov eax, r8d retn loc_1620: mov r8d, 80000000h mov eax, r8d retn
long long func0(long long *a1, int a2, int a3) { long long v3; // r10 int v4; // ecx int v5; // edi unsigned int v6; // r8d int v7; // eax if ( a2 * a3 <= 0 ) return 0x80000000LL; v3 = *a1; v4 = 0; v5 = 0; v6 = 0x80000000; do { v7 = v4 + *(_DWORD *)(v3 + 4LL * (v5 % a2)); if ( (int)v6 < v7 ) v6 = v4 + *(_DWORD *)(v3 + 4LL * (v5 % a2)); v4 = 0; if ( v7 >= 0 ) v4 = v7; ++v5; } while ( v5 != a2 * a3 ); return v6; }
func0: ENDBR64 IMUL EDX,ESI MOV R9D,EDX TEST EDX,EDX JLE 0x00101620 MOV R10,qword ptr [RDI] XOR ECX,ECX XOR EDI,EDI MOV R8D,0x80000000 NOP dword ptr [RAX + RAX*0x1] LAB_001015f0: MOV EAX,EDI CDQ IDIV ESI MOVSXD RDX,EDX MOV EAX,dword ptr [R10 + RDX*0x4] ADD EAX,ECX CMP R8D,EAX CMOVL R8D,EAX XOR EDX,EDX TEST EAX,EAX MOV ECX,EDX CMOVNS ECX,EAX ADD EDI,0x1 CMP EDI,R9D JNZ 0x001015f0 MOV EAX,R8D RET LAB_00101620: MOV R8D,0x80000000 MOV EAX,R8D RET
/* func0(std::vector<int, std::allocator<int> >&, int, int) */ int func0(vector *param_1,int param_2,int param_3) { int iVar1; int iVar2; int iVar3; int iVar4; if (0 < param_3 * param_2) { iVar2 = 0; iVar3 = 0; iVar4 = -0x80000000; do { iVar1 = *(int *)(*(long *)param_1 + (long)(iVar3 % param_2) * 4) + iVar2; if (iVar4 < iVar1) { iVar4 = iVar1; } iVar2 = 0; if (-1 < iVar1) { iVar2 = iVar1; } iVar3 = iVar3 + 1; } while (iVar3 != param_3 * param_2); return iVar4; } return -0x80000000; }
1,144
func0
#include <cassert>
int func0(int n) { return static_cast<int>(2*n*(n+1)*(2*n+1)/3); }
int main() { assert(func0(2) == 20); assert(func0(3) == 56); assert(func0(4) == 120); return 0; }
O0
cpp
func0(int): endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x4(%rbp) mov -0x4(%rbp),%eax add $0x1,%eax imul -0x4(%rbp),%eax mov -0x4(%rbp),%edx add %edx,%edx add $0x1,%edx imul %edx,%eax add %eax,%eax movslq %eax,%rdx imul $0x55555556,%rdx,%rdx shr $0x20,%rdx sar $0x1f,%eax mov %edx,%ecx sub %eax,%ecx mov %ecx,%eax pop %rbp retq
_Z5func0i: endbr64 push rbp mov rbp, rsp mov [rbp+var_4], edi mov eax, [rbp+var_4] add eax, 1 imul eax, [rbp+var_4] mov edx, [rbp+var_4] add edx, edx add edx, 1 imul eax, edx add eax, eax movsxd rdx, eax imul rdx, 55555556h shr rdx, 20h sar eax, 1Fh sub edx, eax mov eax, edx pop rbp retn
long long func0(int a1) { return (unsigned int)(2 * (2 * a1 + 1) * a1 * (a1 + 1) / 3); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x4],EDI MOV EAX,dword ptr [RBP + -0x4] ADD EAX,0x1 IMUL EAX,dword ptr [RBP + -0x4] MOV EDX,dword ptr [RBP + -0x4] ADD EDX,EDX ADD EDX,0x1 IMUL EAX,EDX ADD EAX,EAX MOVSXD RDX,EAX IMUL RDX,RDX,0x55555556 SHR RDX,0x20 SAR EAX,0x1f SUB EDX,EAX MOV EAX,EDX POP RBP RET
/* func0(int) */ int func0(int param_1) { return ((param_1 + 1) * param_1 * (param_1 * 2 + 1) * 2) / 3; }
1,145
func0
#include <cassert>
int func0(int n) { return static_cast<int>(2*n*(n+1)*(2*n+1)/3); }
int main() { assert(func0(2) == 20); assert(func0(3) == 56); assert(func0(4) == 120); return 0; }
O1
cpp
func0(int): endbr64 lea 0x1(%rdi),%edx imul %edi,%edx lea 0x1(%rdi,%rdi,1),%eax imul %eax,%edx add %edx,%edx movslq %edx,%rax imul $0x55555556,%rax,%rax shr $0x20,%rax sar $0x1f,%edx sub %edx,%eax retq
_Z5func0i: endbr64 lea edx, [rdi+1] imul edx, edi lea eax, [rdi+rdi+1] imul edx, eax add edx, edx movsxd rax, edx imul rax, 55555556h shr rax, 20h sar edx, 1Fh sub eax, edx retn
long long func0(int a1) { return (unsigned int)(2 * (2 * a1 + 1) * a1 * (a1 + 1) / 3); }
func0: ENDBR64 LEA EDX,[RDI + 0x1] IMUL EDX,EDI LEA EAX,[RDI + RDI*0x1 + 0x1] IMUL EDX,EAX ADD EDX,EDX MOVSXD RAX,EDX IMUL RAX,RAX,0x55555556 SHR RAX,0x20 SAR EDX,0x1f SUB EAX,EDX RET
/* func0(int) */ int func0(int param_1) { return ((param_1 + 1) * param_1 * (param_1 * 2 + 1) * 2) / 3; }
1,146
func0
#include <cassert>
int func0(int n) { return static_cast<int>(2*n*(n+1)*(2*n+1)/3); }
int main() { assert(func0(2) == 20); assert(func0(3) == 56); assert(func0(4) == 120); return 0; }
O2
cpp
func0(int): endbr64 lea 0x1(%rdi),%edx lea 0x1(%rdi,%rdi,1),%eax imul %edi,%edx imul %eax,%edx add %edx,%edx movslq %edx,%rax sar $0x1f,%edx imul $0x55555556,%rax,%rax shr $0x20,%rax sub %edx,%eax retq nopw 0x0(%rax,%rax,1)
_Z5func0i: endbr64 lea edx, [rdi+1] lea eax, [rdi+rdi+1] imul edx, edi imul edx, eax add edx, edx movsxd rax, edx sar edx, 1Fh imul rax, 55555556h shr rax, 20h sub eax, edx retn
long long func0(int a1) { return (unsigned int)(2 * (2 * a1 + 1) * a1 * (a1 + 1) / 3); }
func0: ENDBR64 LEA EDX,[RDI + 0x1] LEA EAX,[RDI + RDI*0x1 + 0x1] IMUL EDX,EDI IMUL EDX,EAX ADD EDX,EDX MOVSXD RAX,EDX SAR EDX,0x1f IMUL RAX,RAX,0x55555556 SHR RAX,0x20 SUB EAX,EDX RET
/* func0(int) */ int func0(int param_1) { return ((param_1 + 1) * param_1 * (param_1 * 2 + 1) * 2) / 3; }
1,147
func0
#include <cassert>
int func0(int n) { return static_cast<int>(2*n*(n+1)*(2*n+1)/3); }
int main() { assert(func0(2) == 20); assert(func0(3) == 56); assert(func0(4) == 120); return 0; }
O3
cpp
func0(int): endbr64 lea 0x1(%rdi),%edx lea 0x1(%rdi,%rdi,1),%eax imul %edi,%edx imul %eax,%edx add %edx,%edx movslq %edx,%rax sar $0x1f,%edx imul $0x55555556,%rax,%rax shr $0x20,%rax sub %edx,%eax retq nopw 0x0(%rax,%rax,1)
_Z5func0i: endbr64 lea edx, [rdi+1] lea eax, [rdi+rdi+1] imul edx, edi imul edx, eax add edx, edx movsxd rax, edx sar edx, 1Fh imul rax, 55555556h shr rax, 20h sub eax, edx retn
long long func0(int a1) { return (unsigned int)(2 * (2 * a1 + 1) * a1 * (a1 + 1) / 3); }
func0: ENDBR64 LEA EDX,[RDI + 0x1] LEA EAX,[RDI + RDI*0x1 + 0x1] IMUL EDX,EDI IMUL EDX,EAX ADD EDX,EDX MOVSXD RAX,EDX SAR EDX,0x1f IMUL RAX,RAX,0x55555556 SHR RAX,0x20 SUB EAX,EDX RET
/* func0(int) */ int func0(int param_1) { return ((param_1 + 1) * param_1 * (param_1 * 2 + 1) * 2) / 3; }
1,148
func0
#include <assert.h> #include <vector>
int func0(const std::vector<int>& arr, int N, int P) { int current_element = 0; for (int i = 0; i < N; ++i) { if ((arr[i] * arr[i]) % P == 1) { current_element += 1; } } return current_element; }
int main() { assert(func0({1, 6, 4, 5}, 4, 7) == 2); assert(func0({1, 3, 8, 12, 12}, 5, 13) == 3); assert(func0({2, 3, 4, 5}, 4, 6) == 1); return 0; }
O0
cpp
func0(std::vector<int, std::allocator<int> > const&, int, int): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x28,%rsp mov %rdi,-0x28(%rbp) mov %esi,-0x2c(%rbp) mov %edx,-0x30(%rbp) movl $0x0,-0x18(%rbp) movl $0x0,-0x14(%rbp) mov -0x14(%rbp),%eax cmp -0x2c(%rbp),%eax jge 12a1 <_Z5func0RKSt6vectorIiSaIiEEii+0x78> mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1570 <_ZNKSt6vectorIiSaIiEEixEm> mov (%rax),%ebx mov -0x14(%rbp),%eax movslq %eax,%rdx mov -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1570 <_ZNKSt6vectorIiSaIiEEixEm> mov (%rax),%eax imul %ebx,%eax cltd idivl -0x30(%rbp) mov %edx,%eax cmp $0x1,%eax sete %al test %al,%al je 129b <_Z5func0RKSt6vectorIiSaIiEEii+0x72> addl $0x1,-0x18(%rbp) addl $0x1,-0x14(%rbp) jmp 124e <_Z5func0RKSt6vectorIiSaIiEEii+0x25> mov -0x18(%rbp),%eax add $0x28,%rsp pop %rbx pop %rbp retq
_Z5func0RKSt6vectorIiSaIiEEii: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 28h mov [rbp+var_28], rdi mov [rbp+var_2C], esi mov [rbp+var_30], edx mov [rbp+var_18], 0 mov [rbp+var_14], 0 jmp short loc_12B9 loc_1270: mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call _ZNKSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov ebx, [rax] mov eax, [rbp+var_14] movsxd rdx, eax mov rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call _ZNKSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] imul eax, ebx cdq idiv [rbp+var_30] mov eax, edx cmp eax, 1 setz al test al, al jz short loc_12B5 add [rbp+var_18], 1 loc_12B5: add [rbp+var_14], 1 loc_12B9: mov eax, [rbp+var_14] cmp eax, [rbp+var_2C] jl short loc_1270 mov eax, [rbp+var_18] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, int a2, int a3) { int v3; // ebx unsigned int v6; // [rsp+18h] [rbp-18h] int i; // [rsp+1Ch] [rbp-14h] v6 = 0; for ( i = 0; i < a2; ++i ) { v3 = *(_DWORD *)std::vector<int>::operator[](a1, i); if ( v3 * *(_DWORD *)std::vector<int>::operator[](a1, i) % a3 == 1 ) ++v6; } return v6; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x28 MOV qword ptr [RBP + -0x28],RDI MOV dword ptr [RBP + -0x2c],ESI MOV dword ptr [RBP + -0x30],EDX MOV dword ptr [RBP + -0x18],0x0 MOV dword ptr [RBP + -0x14],0x0 JMP 0x001012b9 LAB_00101270: MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x001015f2 MOV EBX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x14] MOVSXD RDX,EAX MOV RAX,qword ptr [RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x001015f2 MOV EAX,dword ptr [RAX] IMUL EAX,EBX CDQ IDIV dword ptr [RBP + -0x30] MOV EAX,EDX CMP EAX,0x1 SETZ AL TEST AL,AL JZ 0x001012b5 ADD dword ptr [RBP + -0x18],0x1 LAB_001012b5: ADD dword ptr [RBP + -0x14],0x1 LAB_001012b9: MOV EAX,dword ptr [RBP + -0x14] CMP EAX,dword ptr [RBP + -0x2c] JL 0x00101270 MOV EAX,dword ptr [RBP + -0x18] MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(std::vector<int, std::allocator<int> > const&, int, int) */ int func0(vector *param_1,int param_2,int param_3) { int iVar1; int *piVar2; int4 local_20; int4 local_1c; local_20 = 0; for (local_1c = 0; local_1c < param_2; local_1c = local_1c + 1) { piVar2 = (int *)std::vector<int,std::allocator<int>>::operator[] ((vector<int,std::allocator<int>> *)param_1,(long)local_1c); iVar1 = *piVar2; piVar2 = (int *)std::vector<int,std::allocator<int>>::operator[] ((vector<int,std::allocator<int>> *)param_1,(long)local_1c); if ((*piVar2 * iVar1) % param_3 == 1) { local_20 = local_20 + 1; } } return local_20; }
1,149
func0
#include <assert.h> #include <vector>
int func0(const std::vector<int>& arr, int N, int P) { int current_element = 0; for (int i = 0; i < N; ++i) { if ((arr[i] * arr[i]) % P == 1) { current_element += 1; } } return current_element; }
int main() { assert(func0({1, 6, 4, 5}, 4, 7) == 2); assert(func0({1, 3, 8, 12, 12}, 5, 13) == 3); assert(func0({2, 3, 4, 5}, 4, 6) == 1); return 0; }
O1
cpp
func0(std::vector<int, std::allocator<int> > const&, int, int): endbr64 mov %edx,%r8d test %esi,%esi jle 1244 <_Z5func0RKSt6vectorIiSaIiEEii+0x3b> mov (%rdi),%rcx lea -0x1(%rsi),%eax lea 0x4(%rcx,%rax,4),%rdi mov $0x0,%esi mov (%rcx),%eax imul %eax,%eax cltd idiv %r8d cmp $0x1,%edx sete %al movzbl %al,%eax add %eax,%esi add $0x4,%rcx cmp %rdi,%rcx jne 1224 <_Z5func0RKSt6vectorIiSaIiEEii+0x1b> mov %esi,%eax retq mov $0x0,%esi jmp 1241 <_Z5func0RKSt6vectorIiSaIiEEii+0x38>
_Z5func0RKSt6vectorIiSaIiEEii: endbr64 mov r8d, edx test esi, esi jle short loc_1243 mov rcx, [rdi] movsxd rsi, esi lea rdi, [rcx+rsi*4] mov esi, 0 loc_1223: mov eax, [rcx] imul eax, eax cdq idiv r8d cmp edx, 1 setz al movzx eax, al add esi, eax add rcx, 4 cmp rcx, rdi jnz short loc_1223 loc_1240: mov eax, esi retn loc_1243: mov esi, 0 jmp short loc_1240
long long func0(_DWORD **a1, int a2, int a3) { _DWORD *v3; // rcx long long v4; // rdi unsigned int v5; // esi if ( a2 <= 0 ) { return 0; } else { v3 = *a1; v4 = (long long)&(*a1)[a2]; v5 = 0; do { v5 += *v3 * *v3 % a3 == 1; ++v3; } while ( v3 != (_DWORD *)v4 ); } return v5; }
func0: ENDBR64 MOV R8D,EDX TEST ESI,ESI JLE 0x00101243 MOV RCX,qword ptr [RDI] MOVSXD RSI,ESI LEA RDI,[RCX + RSI*0x4] MOV ESI,0x0 LAB_00101223: MOV EAX,dword ptr [RCX] IMUL EAX,EAX CDQ IDIV R8D CMP EDX,0x1 SETZ AL MOVZX EAX,AL ADD ESI,EAX ADD RCX,0x4 CMP RCX,RDI JNZ 0x00101223 LAB_00101240: MOV EAX,ESI RET LAB_00101243: MOV ESI,0x0 JMP 0x00101240
/* func0(std::vector<int, std::allocator<int> > const&, int, int) */ int func0(vector *param_1,int param_2,int param_3) { int *piVar1; int *piVar2; int iVar3; if (param_2 < 1) { iVar3 = 0; } else { piVar2 = *(int **)param_1; piVar1 = piVar2 + param_2; iVar3 = 0; do { iVar3 = iVar3 + (uint)((*piVar2 * *piVar2) % param_3 == 1); piVar2 = piVar2 + 1; } while (piVar2 != piVar1); } return iVar3; }
1,150
func0
#include <assert.h> #include <vector>
int func0(const std::vector<int>& arr, int N, int P) { int current_element = 0; for (int i = 0; i < N; ++i) { if ((arr[i] * arr[i]) % P == 1) { current_element += 1; } } return current_element; }
int main() { assert(func0({1, 6, 4, 5}, 4, 7) == 2); assert(func0({1, 3, 8, 12, 12}, 5, 13) == 3); assert(func0({2, 3, 4, 5}, 4, 6) == 1); return 0; }
O2
cpp
func0(std::vector<int, std::allocator<int> > const&, int, int): endbr64 mov %edx,%r8d test %esi,%esi jle 1478 <_Z5func0RKSt6vectorIiSaIiEEii+0x48> mov (%rdi),%rax lea -0x1(%rsi),%edx xor %r9d,%r9d lea 0x4(%rax),%rcx lea (%rcx,%rdx,4),%rsi jmp 1454 <_Z5func0RKSt6vectorIiSaIiEEii+0x24> xchg %ax,%ax add $0x4,%rcx mov (%rax),%eax imul %eax,%eax cltd idiv %r8d xor %eax,%eax cmp $0x1,%edx sete %al add %eax,%r9d mov %rcx,%rax cmp %rsi,%rcx jne 1450 <_Z5func0RKSt6vectorIiSaIiEEii+0x20> mov %r9d,%eax retq nopl 0x0(%rax) xor %r9d,%r9d mov %r9d,%eax retq
_Z5func0RKSt6vectorIiSaIiEEii: endbr64 mov r8d, edx test esi, esi jle short loc_13D0 mov rcx, [rdi] movsxd rsi, esi lea rdi, [rcx+rsi*4] xor esi, esi nop word ptr [rax+rax+00000000h] loc_13B0: mov eax, [rcx] imul eax, eax cdq idiv r8d xor eax, eax cmp edx, 1 setz al add rcx, 4 add esi, eax cmp rdi, rcx jnz short loc_13B0 mov eax, esi retn loc_13D0: xor esi, esi mov eax, esi retn
long long func0(_DWORD **a1, int a2, int a3) { _DWORD *v3; // rcx long long v4; // rdi unsigned int v5; // esi int v6; // eax if ( a2 <= 0 ) return 0LL; v3 = *a1; v4 = (long long)&(*a1)[a2]; v5 = 0; do { v6 = *v3 * *v3 % a3 == 1; ++v3; v5 += v6; } while ( (_DWORD *)v4 != v3 ); return v5; }
func0: ENDBR64 MOV R8D,EDX TEST ESI,ESI JLE 0x001013d0 MOV RCX,qword ptr [RDI] MOVSXD RSI,ESI LEA RDI,[RCX + RSI*0x4] XOR ESI,ESI NOP word ptr [RAX + RAX*0x1] LAB_001013b0: MOV EAX,dword ptr [RCX] IMUL EAX,EAX CDQ IDIV R8D XOR EAX,EAX CMP EDX,0x1 SETZ AL ADD RCX,0x4 ADD ESI,EAX CMP RDI,RCX JNZ 0x001013b0 MOV EAX,ESI RET LAB_001013d0: XOR ESI,ESI MOV EAX,ESI RET
/* func0(std::vector<int, std::allocator<int> > const&, int, int) */ int func0(vector *param_1,int param_2,int param_3) { int *piVar1; int iVar2; int *piVar3; int iVar4; if (0 < param_2) { piVar3 = *(int **)param_1; piVar1 = piVar3 + param_2; iVar4 = 0; do { iVar2 = *piVar3; piVar3 = piVar3 + 1; iVar4 = iVar4 + (uint)((iVar2 * iVar2) % param_3 == 1); } while (piVar1 != piVar3); return iVar4; } return 0; }
1,151
func0
#include <assert.h> #include <vector>
int func0(const std::vector<int>& arr, int N, int P) { int current_element = 0; for (int i = 0; i < N; ++i) { if ((arr[i] * arr[i]) % P == 1) { current_element += 1; } } return current_element; }
int main() { assert(func0({1, 6, 4, 5}, 4, 7) == 2); assert(func0({1, 3, 8, 12, 12}, 5, 13) == 3); assert(func0({2, 3, 4, 5}, 4, 6) == 1); return 0; }
O3
cpp
func0(std::vector<int, std::allocator<int> > const&, int, int): endbr64 mov %edx,%r8d test %esi,%esi jle 1658 <_Z5func0RKSt6vectorIiSaIiEEii+0x48> mov (%rdi),%rax lea -0x1(%rsi),%edx xor %r9d,%r9d lea 0x4(%rax),%rcx lea (%rcx,%rdx,4),%rsi jmp 1634 <_Z5func0RKSt6vectorIiSaIiEEii+0x24> xchg %ax,%ax add $0x4,%rcx mov (%rax),%eax imul %eax,%eax cltd idiv %r8d xor %eax,%eax cmp $0x1,%edx sete %al add %eax,%r9d mov %rcx,%rax cmp %rcx,%rsi jne 1630 <_Z5func0RKSt6vectorIiSaIiEEii+0x20> mov %r9d,%eax retq nopl 0x0(%rax) xor %r9d,%r9d mov %r9d,%eax retq
_Z5func0RKSt6vectorIiSaIiEEii: endbr64 mov r8d, edx test esi, esi jle short loc_1650 mov rcx, [rdi] movsxd rsi, esi lea rdi, [rcx+rsi*4] xor esi, esi nop word ptr [rax+rax+00000000h] loc_1630: mov eax, [rcx] imul eax, eax cdq idiv r8d xor eax, eax cmp edx, 1 setz al add rcx, 4 add esi, eax cmp rdi, rcx jnz short loc_1630 mov eax, esi retn loc_1650: xor esi, esi mov eax, esi retn
long long func0(_DWORD **a1, int a2, int a3) { _DWORD *v3; // rcx long long v4; // rdi unsigned int v5; // esi int v6; // eax if ( a2 <= 0 ) return 0LL; v3 = *a1; v4 = (long long)&(*a1)[a2]; v5 = 0; do { v6 = *v3 * *v3 % a3 == 1; ++v3; v5 += v6; } while ( (_DWORD *)v4 != v3 ); return v5; }
func0: ENDBR64 MOV R8D,EDX TEST ESI,ESI JLE 0x00101650 MOV RCX,qword ptr [RDI] MOVSXD RSI,ESI LEA RDI,[RCX + RSI*0x4] XOR ESI,ESI NOP word ptr [RAX + RAX*0x1] LAB_00101630: MOV EAX,dword ptr [RCX] IMUL EAX,EAX CDQ IDIV R8D XOR EAX,EAX CMP EDX,0x1 SETZ AL ADD RCX,0x4 ADD ESI,EAX CMP RDI,RCX JNZ 0x00101630 MOV EAX,ESI RET LAB_00101650: XOR ESI,ESI MOV EAX,ESI RET
/* func0(std::vector<int, std::allocator<int> > const&, int, int) */ int func0(vector *param_1,int param_2,int param_3) { int *piVar1; int iVar2; int *piVar3; int iVar4; if (0 < param_2) { piVar3 = *(int **)param_1; piVar1 = piVar3 + param_2; iVar4 = 0; do { iVar2 = *piVar3; piVar3 = piVar3 + 1; iVar4 = iVar4 + (uint)((iVar2 * iVar2) % param_3 == 1); } while (piVar1 != piVar3); return iVar4; } return 0; }
1,152
func0
#include <assert.h>
int func0(int N) { int hund1 = N / 100; int hund4 = N / 400; int leap = N >> 2; int ordd = N - leap; if (hund1) { ordd += hund1; leap -= hund1; } if (hund4) { ordd -= hund4; leap += hund4; } int days = ordd + leap * 2; int odd = days % 7; return odd; }
int main() { assert(func0(100) == 5); assert(func0(50) == 6); assert(func0(75) == 2); return 0; }
O0
cpp
func0(int): endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x24(%rbp) mov -0x24(%rbp),%eax movslq %eax,%rdx imul $0x51eb851f,%rdx,%rdx shr $0x20,%rdx sar $0x5,%edx sar $0x1f,%eax sub %eax,%edx mov %edx,%eax mov %eax,-0x10(%rbp) mov -0x24(%rbp),%eax movslq %eax,%rdx imul $0x51eb851f,%rdx,%rdx shr $0x20,%rdx sar $0x7,%edx sar $0x1f,%eax sub %eax,%edx mov %edx,%eax mov %eax,-0xc(%rbp) mov -0x24(%rbp),%eax sar $0x2,%eax mov %eax,-0x18(%rbp) mov -0x24(%rbp),%eax sub -0x18(%rbp),%eax mov %eax,-0x14(%rbp) cmpl $0x0,-0x10(%rbp) je 11b4 <_Z5func0i+0x6b> mov -0x10(%rbp),%eax add %eax,-0x14(%rbp) mov -0x10(%rbp),%eax sub %eax,-0x18(%rbp) cmpl $0x0,-0xc(%rbp) je 11c6 <_Z5func0i+0x7d> mov -0xc(%rbp),%eax sub %eax,-0x14(%rbp) mov -0xc(%rbp),%eax add %eax,-0x18(%rbp) mov -0x18(%rbp),%eax lea (%rax,%rax,1),%edx mov -0x14(%rbp),%eax add %edx,%eax mov %eax,-0x8(%rbp) mov -0x8(%rbp),%eax movslq %eax,%rdx imul $0xffffffff92492493,%rdx,%rdx shr $0x20,%rdx add %eax,%edx mov %edx,%ecx sar $0x2,%ecx cltd sub %edx,%ecx mov %ecx,%edx shl $0x3,%edx sub %ecx,%edx sub %edx,%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax pop %rbp retq
_Z5func0i: endbr64 push rbp mov rbp, rsp mov [rbp+var_24], edi mov eax, [rbp+var_24] movsxd rdx, eax imul rdx, 51EB851Fh shr rdx, 20h mov ecx, edx sar ecx, 5 cdq mov eax, ecx sub eax, edx mov [rbp+var_10], eax mov eax, [rbp+var_24] movsxd rdx, eax imul rdx, 51EB851Fh shr rdx, 20h mov ecx, edx sar ecx, 7 cdq mov eax, ecx sub eax, edx mov [rbp+var_C], eax mov eax, [rbp+var_24] sar eax, 2 mov [rbp+var_18], eax mov eax, [rbp+var_24] sub eax, [rbp+var_18] mov [rbp+var_14], eax cmp [rbp+var_10], 0 jz short loc_11B4 mov eax, [rbp+var_10] add [rbp+var_14], eax mov eax, [rbp+var_10] sub [rbp+var_18], eax loc_11B4: cmp [rbp+var_C], 0 jz short loc_11C6 mov eax, [rbp+var_C] sub [rbp+var_14], eax mov eax, [rbp+var_C] add [rbp+var_18], eax loc_11C6: mov eax, [rbp+var_18] lea edx, [rax+rax] mov eax, [rbp+var_14] add eax, edx mov [rbp+var_8], eax mov eax, [rbp+var_8] movsxd rdx, eax imul rdx, 0FFFFFFFF92492493h shr rdx, 20h add edx, eax mov ecx, edx sar ecx, 2 cdq sub ecx, edx mov edx, ecx shl edx, 3 sub edx, ecx sub eax, edx mov [rbp+var_4], eax mov eax, [rbp+var_4] pop rbp retn
long long func0(int a1) { int v2; // [rsp+Ch] [rbp-18h] int v3; // [rsp+10h] [rbp-14h] int v4; // [rsp+14h] [rbp-10h] int v5; // [rsp+18h] [rbp-Ch] v4 = a1 / 100; v5 = a1 / 400; v2 = a1 >> 2; v3 = a1 - (a1 >> 2); if ( a1 / 100 ) { v3 += v4; v2 -= v4; } if ( v5 ) { v3 -= v5; v2 += v5; } return (unsigned int)((2 * v2 + v3) % 7); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x24],EDI MOV EAX,dword ptr [RBP + -0x24] MOVSXD RDX,EAX IMUL RDX,RDX,0x51eb851f SHR RDX,0x20 MOV ECX,EDX SAR ECX,0x5 CDQ MOV EAX,ECX SUB EAX,EDX MOV dword ptr [RBP + -0x10],EAX MOV EAX,dword ptr [RBP + -0x24] MOVSXD RDX,EAX IMUL RDX,RDX,0x51eb851f SHR RDX,0x20 MOV ECX,EDX SAR ECX,0x7 CDQ MOV EAX,ECX SUB EAX,EDX MOV dword ptr [RBP + -0xc],EAX MOV EAX,dword ptr [RBP + -0x24] SAR EAX,0x2 MOV dword ptr [RBP + -0x18],EAX MOV EAX,dword ptr [RBP + -0x24] SUB EAX,dword ptr [RBP + -0x18] MOV dword ptr [RBP + -0x14],EAX CMP dword ptr [RBP + -0x10],0x0 JZ 0x001011b4 MOV EAX,dword ptr [RBP + -0x10] ADD dword ptr [RBP + -0x14],EAX MOV EAX,dword ptr [RBP + -0x10] SUB dword ptr [RBP + -0x18],EAX LAB_001011b4: CMP dword ptr [RBP + -0xc],0x0 JZ 0x001011c6 MOV EAX,dword ptr [RBP + -0xc] SUB dword ptr [RBP + -0x14],EAX MOV EAX,dword ptr [RBP + -0xc] ADD dword ptr [RBP + -0x18],EAX LAB_001011c6: MOV EAX,dword ptr [RBP + -0x18] LEA EDX,[RAX + RAX*0x1] MOV EAX,dword ptr [RBP + -0x14] ADD EAX,EDX MOV dword ptr [RBP + -0x8],EAX MOV EAX,dword ptr [RBP + -0x8] MOVSXD RDX,EAX IMUL RDX,RDX,-0x6db6db6d SHR RDX,0x20 ADD EDX,EAX MOV ECX,EDX SAR ECX,0x2 CDQ SUB ECX,EDX MOV EDX,ECX SHL EDX,0x3 SUB EDX,ECX SUB EAX,EDX MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] POP RBP RET
/* func0(int) */ int func0(int param_1) { int iVar1; int iVar2; int4 local_20; int4 local_1c; iVar1 = param_1 / 100; iVar2 = param_1 / 400; local_20 = param_1 >> 2; local_1c = param_1 - local_20; if (iVar1 != 0) { local_1c = local_1c + iVar1; local_20 = local_20 - iVar1; } if (iVar2 != 0) { local_1c = local_1c - iVar2; local_20 = local_20 + iVar2; } return (local_1c + local_20 * 2) % 7; }
1,153
func0
#include <assert.h>
int func0(int N) { int hund1 = N / 100; int hund4 = N / 400; int leap = N >> 2; int ordd = N - leap; if (hund1) { ordd += hund1; leap -= hund1; } if (hund4) { ordd -= hund4; leap += hund4; } int days = ordd + leap * 2; int odd = days % 7; return odd; }
int main() { assert(func0(100) == 5); assert(func0(50) == 6); assert(func0(75) == 2); return 0; }
O1
cpp
func0(int): endbr64 movslq %edi,%rax imul $0x51eb851f,%rax,%rax mov %rax,%rsi sar $0x25,%rsi mov %rsi,%rcx mov %edi,%esi sar $0x1f,%esi sar $0x27,%rax sub %esi,%eax mov %edi,%edx sar $0x2,%edx sub %edx,%edi sub %esi,%ecx je 115b <_Z5func0i+0x32> add %ecx,%edi sub %ecx,%edx test %eax,%eax je 1163 <_Z5func0i+0x3a> sub %eax,%edi add %eax,%edx lea (%rdi,%rdx,2),%edx movslq %edx,%rax imul $0xffffffff92492493,%rax,%rax shr $0x20,%rax add %edx,%eax sar $0x2,%eax mov %edx,%ecx sar $0x1f,%ecx sub %ecx,%eax lea 0x0(,%rax,8),%ecx sub %eax,%ecx mov %edx,%eax sub %ecx,%eax retq
_Z5func0i: endbr64 movsxd rax, edi imul rax, 51EB851Fh mov rsi, rax sar rsi, 25h mov rcx, rsi mov esi, edi sar esi, 1Fh sar rax, 27h sub eax, esi mov edx, edi sar edx, 2 sub edi, edx sub ecx, esi jz short loc_115B add edi, ecx sub edx, ecx loc_115B: test eax, eax jz short loc_1163 sub edi, eax add edx, eax loc_1163: lea edx, [rdi+rdx*2] movsxd rax, edx imul rax, 0FFFFFFFF92492493h shr rax, 20h add eax, edx sar eax, 2 mov ecx, edx sar ecx, 1Fh sub eax, ecx lea ecx, ds:0[rax*8] sub ecx, eax mov eax, edx sub eax, ecx retn
long long func0(int a1) { int v2; // eax int v3; // edx int v4; // edi int v5; // ecx v2 = a1 / 400; v3 = a1 >> 2; v4 = a1 - (a1 >> 2); v5 = a1 / 100; if ( a1 / 100 ) { v4 += v5; v3 -= v5; } if ( v2 ) { v4 -= v2; v3 += v2; } return (unsigned int)((v4 + 2 * v3) % 7); }
func0: ENDBR64 MOVSXD RAX,EDI IMUL RAX,RAX,0x51eb851f MOV RSI,RAX SAR RSI,0x25 MOV RCX,RSI MOV ESI,EDI SAR ESI,0x1f SAR RAX,0x27 SUB EAX,ESI MOV EDX,EDI SAR EDX,0x2 SUB EDI,EDX SUB ECX,ESI JZ 0x0010115b ADD EDI,ECX SUB EDX,ECX LAB_0010115b: TEST EAX,EAX JZ 0x00101163 SUB EDI,EAX ADD EDX,EAX LAB_00101163: LEA EDX,[RDI + RDX*0x2] MOVSXD RAX,EDX IMUL RAX,RAX,-0x6db6db6d SHR RAX,0x20 ADD EAX,EDX SAR EAX,0x2 MOV ECX,EDX SAR ECX,0x1f SUB EAX,ECX LEA ECX,[RAX*0x8] SUB ECX,EAX MOV EAX,EDX SUB EAX,ECX RET
/* func0(int) */ int func0(int param_1) { int iVar1; int iVar2; int iVar3; int iVar4; iVar2 = param_1 / 100; iVar1 = param_1 / 400; iVar3 = param_1 >> 2; iVar4 = param_1 - iVar3; if (iVar2 != 0) { iVar4 = iVar4 + iVar2; iVar3 = iVar3 - iVar2; } if (iVar1 != 0) { iVar4 = iVar4 - iVar1; iVar3 = iVar3 + iVar1; } return (iVar4 + iVar3 * 2) % 7; }
1,154
func0
#include <assert.h>
int func0(int N) { int hund1 = N / 100; int hund4 = N / 400; int leap = N >> 2; int ordd = N - leap; if (hund1) { ordd += hund1; leap -= hund1; } if (hund4) { ordd -= hund4; leap += hund4; } int days = ordd + leap * 2; int odd = days % 7; return odd; }
int main() { assert(func0(100) == 5); assert(func0(50) == 6); assert(func0(75) == 2); return 0; }
O2
cpp
func0(int): endbr64 movslq %edi,%rax mov %edi,%edx imul $0x51eb851f,%rax,%rax sar $0x2,%edx mov %rax,%rsi sar $0x27,%rax sar $0x25,%rsi mov %rsi,%rcx mov %edi,%esi sub %edx,%edi sar $0x1f,%esi sub %esi,%eax sub %esi,%ecx je 1172 <_Z5func0i+0x32> add %ecx,%edi sub %ecx,%edx test %eax,%eax je 117a <_Z5func0i+0x3a> sub %eax,%edi add %eax,%edx lea (%rdi,%rdx,2),%edx movslq %edx,%rax mov %edx,%ecx imul $0xffffffff92492493,%rax,%rax sar $0x1f,%ecx shr $0x20,%rax add %edx,%eax sar $0x2,%eax sub %ecx,%eax lea 0x0(,%rax,8),%ecx sub %eax,%ecx mov %edx,%eax sub %ecx,%eax retq nopw %cs:0x0(%rax,%rax,1)
_Z5func0i: endbr64 movsxd rax, edi mov edx, edi imul rax, 51EB851Fh sar edx, 2 mov rsi, rax sar rax, 27h sar rsi, 25h mov rcx, rsi mov esi, edi sub edi, edx sar esi, 1Fh sub eax, esi sub ecx, esi jz short loc_1172 add edi, ecx sub edx, ecx loc_1172: test eax, eax jz short loc_117A sub edi, eax add edx, eax loc_117A: lea edx, [rdi+rdx*2] movsxd rax, edx mov ecx, edx imul rax, 0FFFFFFFF92492493h sar ecx, 1Fh shr rax, 20h add eax, edx sar eax, 2 sub eax, ecx lea ecx, ds:0[rax*8] sub ecx, eax mov eax, edx sub eax, ecx retn
long long func0(int a1) { int v1; // edx long long v2; // rax int v5; // edi int v6; // eax int v7; // ecx v1 = a1 >> 2; v2 = (1374389535LL * a1) >> 39; v5 = a1 - (a1 >> 2); v6 = v2 - (a1 >> 31); v7 = a1 / 100; if ( a1 / 100 ) { v5 += v7; v1 -= v7; } if ( v6 ) { v5 -= v6; v1 += v6; } return (unsigned int)((v5 + 2 * v1) % 7); }
func0: ENDBR64 MOVSXD RAX,EDI MOV EDX,EDI IMUL RAX,RAX,0x51eb851f SAR EDX,0x2 MOV RSI,RAX SAR RAX,0x27 SAR RSI,0x25 MOV RCX,RSI MOV ESI,EDI SUB EDI,EDX SAR ESI,0x1f SUB EAX,ESI SUB ECX,ESI JZ 0x00101172 ADD EDI,ECX SUB EDX,ECX LAB_00101172: TEST EAX,EAX JZ 0x0010117a SUB EDI,EAX ADD EDX,EAX LAB_0010117a: LEA EDX,[RDI + RDX*0x2] MOVSXD RAX,EDX MOV ECX,EDX IMUL RAX,RAX,-0x6db6db6d SAR ECX,0x1f SHR RAX,0x20 ADD EAX,EDX SAR EAX,0x2 SUB EAX,ECX LEA ECX,[RAX*0x8] SUB ECX,EAX MOV EAX,EDX SUB EAX,ECX RET
/* func0(int) */ int func0(int param_1) { int iVar1; int iVar2; int iVar3; int iVar4; iVar3 = param_1 >> 2; iVar1 = param_1 / 400; iVar2 = param_1 / 100; iVar4 = param_1 - iVar3; if (iVar2 != 0) { iVar4 = iVar4 + iVar2; iVar3 = iVar3 - iVar2; } if (iVar1 != 0) { iVar4 = iVar4 - iVar1; iVar3 = iVar3 + iVar1; } return (iVar4 + iVar3 * 2) % 7; }
1,155
func0
#include <assert.h>
int func0(int N) { int hund1 = N / 100; int hund4 = N / 400; int leap = N >> 2; int ordd = N - leap; if (hund1) { ordd += hund1; leap -= hund1; } if (hund4) { ordd -= hund4; leap += hund4; } int days = ordd + leap * 2; int odd = days % 7; return odd; }
int main() { assert(func0(100) == 5); assert(func0(50) == 6); assert(func0(75) == 2); return 0; }
O3
cpp
func0(int): endbr64 movslq %edi,%rax mov %edi,%edx imul $0x51eb851f,%rax,%rax sar $0x2,%edx mov %rax,%rsi sar $0x27,%rax sar $0x25,%rsi mov %rsi,%rcx mov %edi,%esi sub %edx,%edi sar $0x1f,%esi sub %esi,%eax sub %esi,%ecx je 1172 <_Z5func0i+0x32> add %ecx,%edi sub %ecx,%edx test %eax,%eax je 117a <_Z5func0i+0x3a> sub %eax,%edi add %eax,%edx lea (%rdi,%rdx,2),%edx movslq %edx,%rax mov %edx,%ecx imul $0xffffffff92492493,%rax,%rax sar $0x1f,%ecx shr $0x20,%rax add %edx,%eax sar $0x2,%eax sub %ecx,%eax lea 0x0(,%rax,8),%ecx sub %eax,%ecx mov %edx,%eax sub %ecx,%eax retq nopw %cs:0x0(%rax,%rax,1)
_Z5func0i: endbr64 movsxd rax, edi mov edx, edi imul rax, 51EB851Fh sar edx, 2 mov rsi, rax sar rax, 27h sar rsi, 25h mov rcx, rsi mov esi, edi sub edi, edx sar esi, 1Fh sub eax, esi sub ecx, esi jz short loc_1172 add edi, ecx sub edx, ecx loc_1172: test eax, eax jz short loc_117A sub edi, eax add edx, eax loc_117A: lea edx, [rdi+rdx*2] movsxd rax, edx mov ecx, edx imul rax, 0FFFFFFFF92492493h sar ecx, 1Fh shr rax, 20h add eax, edx sar eax, 2 sub eax, ecx lea ecx, ds:0[rax*8] sub ecx, eax mov eax, edx sub eax, ecx retn
long long func0(int a1) { int v1; // edx long long v2; // rax int v5; // edi int v6; // eax int v7; // ecx v1 = a1 >> 2; v2 = (1374389535LL * a1) >> 39; v5 = a1 - (a1 >> 2); v6 = v2 - (a1 >> 31); v7 = a1 / 100; if ( a1 / 100 ) { v5 += v7; v1 -= v7; } if ( v6 ) { v5 -= v6; v1 += v6; } return (unsigned int)((v5 + 2 * v1) % 7); }
func0: ENDBR64 MOVSXD RAX,EDI MOV EDX,EDI IMUL RAX,RAX,0x51eb851f SAR EDX,0x2 MOV RSI,RAX SAR RAX,0x27 SAR RSI,0x25 MOV RCX,RSI MOV ESI,EDI SUB EDI,EDX SAR ESI,0x1f SUB EAX,ESI SUB ECX,ESI JZ 0x00101172 ADD EDI,ECX SUB EDX,ECX LAB_00101172: TEST EAX,EAX JZ 0x0010117a SUB EDI,EAX ADD EDX,EAX LAB_0010117a: LEA EDX,[RDI + RDX*0x2] MOVSXD RAX,EDX MOV ECX,EDX IMUL RAX,RAX,-0x6db6db6d SAR ECX,0x1f SHR RAX,0x20 ADD EAX,EDX SAR EAX,0x2 SUB EAX,ECX LEA ECX,[RAX*0x8] SUB ECX,EAX MOV EAX,EDX SUB EAX,ECX RET
/* func0(int) */ int func0(int param_1) { int iVar1; int iVar2; int iVar3; int iVar4; iVar3 = param_1 >> 2; iVar1 = param_1 / 400; iVar2 = param_1 / 100; iVar4 = param_1 - iVar3; if (iVar2 != 0) { iVar4 = iVar4 + iVar2; iVar3 = iVar3 - iVar2; } if (iVar1 != 0) { iVar4 = iVar4 - iVar1; iVar3 = iVar3 + iVar1; } return (iVar4 + iVar3 * 2) % 7; }
1,156
func0
#include <iostream> #include <vector> #include <cassert>
std::pair<int, std::vector<int>> func0(const std::vector<std::vector<int>>& list1) { int max_length = 0; std::vector<int> max_list; for (const auto& sublist : list1) { if (sublist.size() > max_length) { max_length = sublist.size(); max_list = sublist; } } return std::make_pair(max_length, max_list); }
int main() { assert(func0({{0}, {1, 3}, {5, 7}, {9, 11}, {13, 15, 17}}) == std::make_pair(3, std::vector<int>{13, 15, 17})); assert(func0({{1}, {5, 7}, {10, 12, 14, 15}}) == std::make_pair(4, std::vector<int>{10, 12, 14, 15})); assert(func0({{5}, {15, 20, 25}}) == std::make_pair(3, std::vector<int>{15, 20, 25})); return 0; }
O0
cpp
func0(std::vector<std::vector<int, std::allocator<int> >, std::allocator<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 movl $0x0,-0x54(%rbp) lea -0x30(%rbp),%rax mov %rax,%rdi callq 22e4 <_ZNSt6vectorIiSaIiEEC1Ev> mov -0x70(%rbp),%rax mov %rax,-0x40(%rbp) mov -0x40(%rbp),%rax mov %rax,%rdi callq 240e <_ZNKSt6vectorIS_IiSaIiEESaIS1_EE5beginEv> mov %rax,-0x50(%rbp) mov -0x40(%rbp),%rax mov %rax,%rdi callq 2466 <_ZNKSt6vectorIS_IiSaIiEESaIS1_EE3endEv> mov %rax,-0x48(%rbp) lea -0x48(%rbp),%rdx lea -0x50(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 24be <_ZN9__gnu_cxxneIPKSt6vectorIiSaIiEES1_IS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_> test %al,%al je 13bb <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xd2> lea -0x50(%rbp),%rax mov %rax,%rdi callq 2522 <_ZNK9__gnu_cxx17__normal_iteratorIPKSt6vectorIiSaIiEES1_IS3_SaIS3_EEEdeEv> mov %rax,-0x38(%rbp) mov -0x38(%rbp),%rax mov %rax,%rdi callq 2538 <_ZNKSt6vectorIiSaIiEE4sizeEv> mov -0x54(%rbp),%edx movslq %edx,%rdx cmp %rdx,%rax seta %al test %al,%al je 13ad <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xc4> mov -0x38(%rbp),%rax mov %rax,%rdi callq 2538 <_ZNKSt6vectorIiSaIiEE4sizeEv> mov %eax,-0x54(%rbp) mov -0x38(%rbp),%rdx lea -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 256e <_ZNSt6vectorIiSaIiEEaSERKS1_> lea -0x50(%rbp),%rax mov %rax,%rdi callq 24fe <_ZN9__gnu_cxx17__normal_iteratorIPKSt6vectorIiSaIiEES1_IS3_SaIS3_EEEppEv> jmp 1348 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x5f> mov -0x68(%rbp),%rax lea -0x30(%rbp),%rdx lea -0x54(%rbp),%rcx mov %rcx,%rsi mov %rax,%rdi callq 2888 <_ZSt9make_pairIRiRSt6vectorIiSaIiEEESt4pairINSt17__decay_and_stripIT_E6__typeENS6_IT0_E6__typeEEOS7_OSA_> lea -0x30(%rbp),%rax mov %rax,%rdi callq 23c6 <_ZNSt6vectorIiSaIiEED1Ev> mov -0x18(%rbp),%rax xor %fs:0x28,%rax je 1414 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x12b> jmp 140f <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x126> endbr64 mov %rax,%rbx lea -0x30(%rbp),%rax mov %rax,%rdi callq 23c6 <_ZNSt6vectorIiSaIiEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 11f0 <_Unwind_Resume@plt> callq 11a0 <__stack_chk_fail@plt> mov -0x68(%rbp),%rax add $0x68,%rsp pop %rbx pop %rbp retq
_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE: 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 mov [rbp+var_54], 0 lea rax, [rbp+var_30] mov rdi, rax call _ZNSt6vectorIiSaIiEEC2Ev; std::vector<int>::vector(void) mov rax, [rbp+var_70] mov [rbp+var_40], rax mov rax, [rbp+var_40] mov rdi, rax call _ZNKSt6vectorIS_IiSaIiEESaIS1_EE5beginEv; std::vector<std::vector<int>>::begin(void) mov [rbp+var_50], rax mov rax, [rbp+var_40] mov rdi, rax call _ZNKSt6vectorIS_IiSaIiEESaIS1_EE3endEv; std::vector<std::vector<int>>::end(void) mov [rbp+var_48], rax jmp short loc_1384 loc_132A: lea rax, [rbp+var_50] mov rdi, rax call _ZNK9__gnu_cxx17__normal_iteratorIPKSt6vectorIiSaIiEES1_IS3_SaIS3_EEEdeEv; __gnu_cxx::__normal_iterator<std::vector<int> const*,std::vector<std::vector<int>>>::operator*(void) mov [rbp+var_38], rax mov rax, [rbp+var_38] mov rdi, rax call _ZNKSt6vectorIiSaIiEE4sizeEv; std::vector<int>::size(void) mov edx, [rbp+var_54] movsxd rdx, edx cmp rdx, rax setb al test al, al jz short loc_1378 mov rax, [rbp+var_38] mov rdi, rax call _ZNKSt6vectorIiSaIiEE4sizeEv; std::vector<int>::size(void) mov [rbp+var_54], eax mov rdx, [rbp+var_38] lea rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEaSERKS1_; std::vector<int>::operator=(std::vector<int> const&) loc_1378: lea rax, [rbp+var_50] mov rdi, rax call _ZN9__gnu_cxx17__normal_iteratorIPKSt6vectorIiSaIiEES1_IS3_SaIS3_EEEppEv; __gnu_cxx::__normal_iterator<std::vector<int> const*,std::vector<std::vector<int>>>::operator++(void) loc_1384: lea rdx, [rbp+var_48] lea rax, [rbp+var_50] mov rsi, rdx mov rdi, rax call _ZN9__gnu_cxxneIPKSt6vectorIiSaIiEES1_IS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_; __gnu_cxx::operator!=<std::vector<int> const*,std::vector<std::vector<int>>>(__gnu_cxx::__normal_iterator<std::vector<int> const*,std::vector<std::vector<int>>> const&,__gnu_cxx::__normal_iterator<std::vector<int> const*,std::vector<std::vector<int>>> const&) test al, al jnz short loc_132A mov rax, [rbp+var_68] lea rdx, [rbp+var_30] lea rcx, [rbp+var_54] mov rsi, rcx mov rdi, rax call _ZSt9make_pairIRiRSt6vectorIiSaIiEEESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS6_INS7_IT0_E4typeEE6__typeEEOS8_OSD_; std::make_pair<int &,std::vector<int> &>(int &&&,std::vector<int> &&&) nop lea rax, [rbp+var_30] mov rdi, rax call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() nop mov rax, [rbp+var_18] sub rax, fs:28h jz short loc_1408 jmp short loc_1403 endbr64 mov rbx, rax lea rax, [rbp+var_30] mov rdi, rax call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() mov rax, rbx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_13FB call ___stack_chk_fail loc_13FB: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_1403: call ___stack_chk_fail loc_1408: mov rax, [rbp+var_68] mov rbx, [rbp+var_8] leave retn
long long func0(long long a1, long long a2) { int v3; // [rsp+1Ch] [rbp-54h] BYREF long long v4; // [rsp+20h] [rbp-50h] BYREF _QWORD v5[2]; // [rsp+28h] [rbp-48h] BYREF long long v6; // [rsp+38h] [rbp-38h] _BYTE v7[24]; // [rsp+40h] [rbp-30h] BYREF unsigned long long v8; // [rsp+58h] [rbp-18h] v8 = __readfsqword(0x28u); v3 = 0; std::vector<int>::vector(v7); v5[1] = a2; v4 = std::vector<std::vector<int>>::begin(a2); v5[0] = std::vector<std::vector<int>>::end(a2); while ( (unsigned __int8)__gnu_cxx::operator!=<std::vector<int> const*,std::vector<std::vector<int>>>(&v4, v5) ) { v6 = __gnu_cxx::__normal_iterator<std::vector<int> const*,std::vector<std::vector<int>>>::operator*(&v4); if ( v3 < (unsigned long long)std::vector<int>::size(v6) ) { v3 = std::vector<int>::size(v6); std::vector<int>::operator=(v7, v6); } __gnu_cxx::__normal_iterator<std::vector<int> const*,std::vector<std::vector<int>>>::operator++(&v4); } std::make_pair<int &,std::vector<int> &>(a1, &v3, v7); std::vector<int>::~vector(v7); 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 MOV dword ptr [RBP + -0x54],0x0 LEA RAX,[RBP + -0x30] MOV RDI,RAX CALL 0x0010228c MOV RAX,qword ptr [RBP + -0x70] MOV qword ptr [RBP + -0x40],RAX MOV RAX,qword ptr [RBP + -0x40] MOV RDI,RAX CALL 0x001023ae MOV qword ptr [RBP + -0x50],RAX MOV RAX,qword ptr [RBP + -0x40] MOV RDI,RAX CALL 0x001023fa MOV qword ptr [RBP + -0x48],RAX JMP 0x00101384 LAB_0010132a: LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x001024ae MOV qword ptr [RBP + -0x38],RAX MOV RAX,qword ptr [RBP + -0x38] MOV RDI,RAX CALL 0x001024c4 MOV EDX,dword ptr [RBP + -0x54] MOVSXD RDX,EDX CMP RDX,RAX SETC AL TEST AL,AL JZ 0x00101378 MOV RAX,qword ptr [RBP + -0x38] MOV RDI,RAX CALL 0x001024c4 MOV dword ptr [RBP + -0x54],EAX MOV RDX,qword ptr [RBP + -0x38] LEA RAX,[RBP + -0x30] MOV RSI,RDX MOV RDI,RAX LAB_00101373: CALL 0x001024ec LAB_00101378: LEA RAX,[RBP + -0x50] MOV RDI,RAX CALL 0x0010248a LAB_00101384: LEA RDX,[RBP + -0x48] LEA RAX,[RBP + -0x50] MOV RSI,RDX MOV RDI,RAX CALL 0x0010244a TEST AL,AL JNZ 0x0010132a MOV RAX,qword ptr [RBP + -0x68] LEA RDX,[RBP + -0x30] LEA RCX,[RBP + -0x54] MOV RSI,RCX MOV RDI,RAX CALL 0x001028f6 NOP LEA RAX,[RBP + -0x30] MOV RDI,RAX CALL 0x00102354 NOP MOV RAX,qword ptr [RBP + -0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x00101408 JMP 0x00101403 LAB_00101403: CALL 0x00101190 LAB_00101408: MOV RAX,qword ptr [RBP + -0x68] 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) { bool bVar1; ulong uVar2; vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>> *in_RSI; long in_FS_OFFSET; int local_5c; int8 local_58; int8 local_50; vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>> *local_48; vector<int,std::allocator<int>> *local_40; vector<int,std::allocator<int>> local_38 [24]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_5c = 0; std::vector<int,std::allocator<int>>::vector(local_38); local_48 = in_RSI; local_58 = std:: vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>> ::begin(in_RSI); local_50 = std:: vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>> ::end(local_48); while( true ) { bVar1 = operator!=((__normal_iterator *)&local_58,(__normal_iterator *)&local_50); if (!bVar1) break; local_40 = (vector<int,std::allocator<int>> *) __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_58); uVar2 = std::vector<int,std::allocator<int>>::size(local_40); if ((ulong)(long)local_5c < uVar2) { local_5c = std::vector<int,std::allocator<int>>::size(local_40); /* try { // try from 00101373 to 001013b1 has its CatchHandler @ 001013d1 */ std::vector<int,std::allocator<int>>::operator=(local_38,(vector *)local_40); } __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_58); } std::make_pair<int&,std::vector<int,std::allocator<int>>&>((int *)param_1,(vector *)&local_5c); std::vector<int,std::allocator<int>>::~vector(local_38); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return param_1; }
1,157
func0
#include <iostream> #include <vector> #include <cassert>
std::pair<int, std::vector<int>> func0(const std::vector<std::vector<int>>& list1) { int max_length = 0; std::vector<int> max_list; for (const auto& sublist : list1) { if (sublist.size() > max_length) { max_length = sublist.size(); max_list = sublist; } } return std::make_pair(max_length, max_list); }
int main() { assert(func0({{0}, {1, 3}, {5, 7}, {9, 11}, {13, 15, 17}}) == std::make_pair(3, std::vector<int>{13, 15, 17})); assert(func0({{1}, {5, 7}, {10, 12, 14, 15}}) == std::make_pair(4, std::vector<int>{10, 12, 14, 15})); assert(func0({{5}, {15, 20, 25}}) == std::make_pair(3, std::vector<int>{15, 20, 25})); return 0; }
O1
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 push %rbp push %rbx sub $0x20,%rsp mov %rdi,%r12 mov %fs:0x28,%rax mov %rax,0x18(%rsp) xor %eax,%eax movq $0x0,(%rsp) movq $0x0,0x8(%rsp) movq $0x0,0x10(%rsp) mov (%rsi),%rbx mov 0x8(%rsi),%r13 cmp %r13,%rbx je 1387 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x7e> mov $0x0,%ebp mov %rsp,%r14 jmp 1365 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x5c> add $0x18,%rbx cmp %rbx,%r13 je 138c <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x83> mov 0x8(%rbx),%rax sub (%rbx),%rax sar $0x2,%rax movslq %ebp,%rdx cmp %rax,%rdx jae 135c <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x53> mov %eax,%ebp mov %rbx,%rsi mov %r14,%rdi callq 1c44 <_ZNSt6vectorIiSaIiEEaSERKS1_> jmp 135c <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x53> mov $0x0,%ebp mov %ebp,(%r12) mov 0x8(%rsp),%rbx sub (%rsp),%rbx movq $0x0,0x8(%r12) movq $0x0,0x10(%r12) movq $0x0,0x18(%r12) mov %rbx,%rax sar $0x2,%rax je 1463 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x15a> movabs $0x1fffffffffffffff,%rdx cmp %rdx,%rax ja 13da <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xd1> mov %rbx,%rdi callq 11b0 <_Znwm@plt> jmp 13fc <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xf3> callq 1130 <_ZSt17__throw_bad_allocv@plt> endbr64 mov %rax,%rbx mov (%rsp),%rdi test %rdi,%rdi je 13f4 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xeb> callq 11a0 <_ZdlPv@plt> mov %rbx,%rdi callq 1210 <_Unwind_Resume@plt> mov %rax,%rbp mov %rbp,0x8(%r12) mov %rbp,0x10(%r12) add %rbp,%rbx mov %rbx,0x18(%r12) mov 0x8(%rsp),%rax mov (%rsp),%rbx mov %rax,%r13 sub %rbx,%r13 cmp %rbx,%rax je 146a <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x161> mov %r13,%rdx mov %rbx,%rsi mov %rbp,%rdi callq 11f0 <memmove@plt> add %r13,%rbp mov %rbp,0x10(%r12) mov %rbx,%rdi callq 11a0 <_ZdlPv@plt> mov 0x18(%rsp),%rax xor %fs:0x28,%rax jne 1479 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x170> mov %r12,%rax add $0x20,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq mov $0x0,%ebp jmp 13ff <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xf6> add %r13,%rbp mov %rbp,0x10(%r12) test %rbx,%rbx je 1443 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x13a> jmp 143b <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x132> callq 11c0 <__stack_chk_fail@plt>
_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE: endbr64 push r14 push r13 push r12 push rbp push rbx sub rsp, 20h mov r12, rdi mov rax, fs:28h mov [rsp+48h+var_30], rax xor eax, eax mov [rsp+48h+src], 0 mov [rsp+48h+var_40], 0 mov [rsp+48h+var_38], 0 mov rbx, [rsi] mov r13, [rsi+8] cmp r13, rbx jz short loc_1347 mov ebp, 0 mov r14, rsp jmp short loc_1325 loc_131C: add rbx, 18h cmp r13, rbx jz short loc_134C loc_1325: mov rax, [rbx+8] sub rax, [rbx] sar rax, 2 movsxd rdx, ebp cmp rdx, rax jnb short loc_131C mov ebp, eax mov rsi, rbx mov rdi, r14 call _ZNSt6vectorIiSaIiEEaSERKS1_; std::vector<int>::operator=(std::vector<int> const&) jmp short loc_131C loc_1347: mov ebp, 0 loc_134C: mov [r12], ebp mov rbp, [rsp+48h+src] mov qword ptr [r12+8], 0 mov qword ptr [r12+10h], 0 mov qword ptr [r12+18h], 0 mov rbx, [rsp+48h+var_40] sub rbx, rbp jz loc_143F mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbx jb short loc_1396 mov rdi, rbx; unsigned __int64 call __Znwm; operator new(ulong) jmp short loc_13D4 loc_1396: mov rax, [rsp+48h+var_30] sub rax, fs:28h jnz short loc_13CF call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) endbr64 mov rbx, rax mov rdi, rsp call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() mov rax, [rsp+48h+var_30] sub rax, fs:28h jz short loc_1437 call ___stack_chk_fail loc_13CF: call ___stack_chk_fail loc_13D4: mov rdi, rax; dest mov [r12+8], rax mov [r12+10h], rax lea r13, [rax+rbx] mov [r12+18h], r13 cmp rbx, 4 jle short loc_1430 mov rdx, rbx; n mov rsi, rbp; src call _memmove loc_13FB: mov [r12+10h], r13 mov rsi, [rsp+48h+var_38] sub rsi, rbp; unsigned __int64 loc_1408: mov rdi, rbp; void * call __ZdlPvm; operator delete(void *,ulong) loc_1410: mov rax, [rsp+48h+var_30] sub rax, fs:28h jnz short loc_1469 mov rax, r12 add rsp, 20h pop rbx pop rbp pop r12 pop r13 pop r14 retn loc_1430: mov eax, [rbp+0] mov [rdi], eax jmp short loc_13FB loc_1437: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume loc_143F: mov qword ptr [r12+8], 0 mov qword ptr [r12+18h], 0 mov qword ptr [r12+10h], 0 test rbp, rbp jz short loc_1410 mov rsi, [rsp+48h+var_38] sub rsi, rbp jmp short loc_1408 loc_1469: call ___stack_chk_fail
long long func0(long long a1, long long a2) { _QWORD *v2; // rbx _QWORD *v3; // r13 int v4; // ebp char *v5; // rbp signed long long v6; // rbx _DWORD *v7; // rax struct _Unwind_Exception *v8; // rbx char *v9; // r13 unsigned long long v10; // rsi void *src; // [rsp+0h] [rbp-48h] BYREF char *v13; // [rsp+8h] [rbp-40h] long long v14; // [rsp+10h] [rbp-38h] unsigned long long v15; // [rsp+18h] [rbp-30h] v15 = __readfsqword(0x28u); src = 0LL; v13 = 0LL; v14 = 0LL; v2 = *(_QWORD **)a2; v3 = *(_QWORD **)(a2 + 8); if ( v3 == *(_QWORD **)a2 ) { v4 = 0; } else { v4 = 0; do { if ( v4 < (unsigned long long)((long long)(v2[1] - *v2) >> 2) ) { v4 = (long long)(v2[1] - *v2) >> 2; std::vector<int>::operator=(&src, v2); } v2 += 3; } while ( v3 != v2 ); } *(_DWORD *)a1 = v4; v5 = (char *)src; *(_QWORD *)(a1 + 8) = 0LL; *(_QWORD *)(a1 + 16) = 0LL; *(_QWORD *)(a1 + 24) = 0LL; v6 = v13 - v5; if ( v13 == v5 ) { *(_QWORD *)(a1 + 8) = 0LL; *(_QWORD *)(a1 + 24) = 0LL; *(_QWORD *)(a1 + 16) = 0LL; if ( !v5 ) return a1; v10 = v14 - (_QWORD)v5; } else { if ( (unsigned long long)v6 > 0x7FFFFFFFFFFFFFFCLL ) { v8 = (struct _Unwind_Exception *)std::__throw_bad_array_new_length(); std::vector<int>::~vector(&src); _Unwind_Resume(v8); } v7 = (_DWORD *)operator new(v13 - v5); *(_QWORD *)(a1 + 8) = v7; *(_QWORD *)(a1 + 16) = v7; v9 = (char *)v7 + v6; *(_QWORD *)(a1 + 24) = (char *)v7 + v6; if ( v6 <= 4 ) *v7 = *(_DWORD *)v5; else memmove(v7, v5, v6); *(_QWORD *)(a1 + 16) = v9; v10 = v14 - (_QWORD)v5; } operator delete(v5, v10); return a1; }
func0: ENDBR64 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x20 MOV R12,RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x18],RAX XOR EAX,EAX MOV qword ptr [RSP],0x0 MOV qword ptr [RSP + 0x8],0x0 MOV qword ptr [RSP + 0x10],0x0 MOV RBX,qword ptr [RSI] MOV R13,qword ptr [RSI + 0x8] CMP R13,RBX JZ 0x00101347 MOV EBP,0x0 MOV R14,RSP JMP 0x00101325 LAB_0010131c: ADD RBX,0x18 CMP R13,RBX JZ 0x0010134c LAB_00101325: MOV RAX,qword ptr [RBX + 0x8] SUB RAX,qword ptr [RBX] SAR RAX,0x2 MOVSXD RDX,EBP CMP RDX,RAX JNC 0x0010131c MOV EBP,EAX MOV RSI,RBX MOV RDI,R14 LAB_00101340: CALL 0x00101d5a JMP 0x0010131c LAB_00101347: MOV EBP,0x0 LAB_0010134c: MOV dword ptr [R12],EBP MOV RBP,qword ptr [RSP] MOV qword ptr [R12 + 0x8],0x0 MOV qword ptr [R12 + 0x10],0x0 MOV qword ptr [R12 + 0x18],0x0 MOV RBX,qword ptr [RSP + 0x8] SUB RBX,RBP JZ 0x0010143f MOV RAX,0x7ffffffffffffffc CMP RAX,RBX JC 0x00101396 MOV RDI,RBX CALL 0x00101170 JMP 0x001013d4 LAB_00101396: MOV RAX,qword ptr [RSP + 0x18] SUB RAX,qword ptr FS:[0x28] JNZ 0x001013cf CALL 0x00101150 LAB_001013ab: ENDBR64 MOV RBX,RAX MOV RDI,RSP CALL 0x00101d34 MOV RAX,qword ptr [RSP + 0x18] SUB RAX,qword ptr FS:[0x28] JZ 0x00101437 CALL 0x00101190 LAB_001013cf: CALL 0x00101190 LAB_001013d4: MOV RDI,RAX MOV qword ptr [R12 + 0x8],RAX MOV qword ptr [R12 + 0x10],RAX LEA R13,[RAX + RBX*0x1] MOV qword ptr [R12 + 0x18],R13 CMP RBX,0x4 JLE 0x00101430 MOV RDX,RBX MOV RSI,RBP CALL 0x001011b0 LAB_001013fb: MOV qword ptr [R12 + 0x10],R13 MOV RSI,qword ptr [RSP + 0x10] SUB RSI,RBP LAB_00101408: MOV RDI,RBP CALL 0x00101180 LAB_00101410: MOV RAX,qword ptr [RSP + 0x18] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101469 MOV RAX,R12 ADD RSP,0x20 POP RBX POP RBP POP R12 POP R13 POP R14 RET LAB_00101430: MOV EAX,dword ptr [RBP] MOV dword ptr [RDI],EAX JMP 0x001013fb LAB_00101437: MOV RDI,RBX LAB_0010143a: CALL 0x001011d0 LAB_0010143f: MOV qword ptr [R12 + 0x8],0x0 MOV qword ptr [R12 + 0x18],0x0 MOV qword ptr [R12 + 0x10],0x0 TEST RBP,RBP JZ 0x00101410 MOV RSI,qword ptr [RSP + 0x10] SUB RSI,RBP JMP 0x00101408 LAB_00101469: CALL 0x00101190
/* 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; int iVar2; ulong uVar3; int4 *__dest; int8 uVar4; vector *pvVar5; long *in_RSI; long in_FS_OFFSET; int4 *local_48; long local_40; long local_38; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); local_48 = (int4 *)0x0; local_40 = 0; local_38 = 0; pvVar5 = (vector *)*in_RSI; pvVar1 = (vector *)in_RSI[1]; if (pvVar1 == pvVar5) { iVar2 = 0; } else { iVar2 = 0; do { uVar3 = *(long *)(pvVar5 + 8) - *(long *)pvVar5 >> 2; if ((ulong)(long)iVar2 < uVar3) { iVar2 = (int)uVar3; /* try { // try from 00101340 to 001013aa has its CatchHandler @ 001013ab */ std::vector<int,std::allocator<int>>::operator= ((vector<int,std::allocator<int>> *)&local_48,pvVar5); } pvVar5 = pvVar5 + 0x18; } while (pvVar1 != pvVar5); } __src = local_48; *(int *)param_1 = iVar2; *(int8 *)(param_1 + 8) = 0; *(int8 *)(param_1 + 0x10) = 0; *(int8 *)(param_1 + 0x18) = 0; uVar3 = local_40 - (long)local_48; if (uVar3 == 0) { *(int8 *)(param_1 + 8) = 0; *(int8 *)(param_1 + 0x18) = 0; *(int8 *)(param_1 + 0x10) = 0; if (local_48 == (int4 *)0x0) goto LAB_00101410; uVar3 = local_38 - (long)local_48; } else { if (0x7ffffffffffffffc < uVar3) { 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 @ 00101340 with catch @ 001013ab */ std::vector<int,std::allocator<int>>::~vector((vector<int,std::allocator<int>> *)&local_48); if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } /* WARNING: Subroutine does not return */ _Unwind_Resume(uVar4); } __dest = (int4 *)operator_new(uVar3); *(int4 **)(param_1 + 8) = __dest; *(int4 **)(param_1 + 0x10) = __dest; *(ulong *)(param_1 + 0x18) = (long)__dest + uVar3; if ((long)uVar3 < 5) { *__dest = *__src; } else { memmove(__dest,__src,uVar3); } *(ulong *)(param_1 + 0x10) = (long)__dest + uVar3; uVar3 = local_38 - (long)__src; } operator_delete(__src,uVar3); LAB_00101410: if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,158
func0
#include <iostream> #include <vector> #include <cassert>
std::pair<int, std::vector<int>> func0(const std::vector<std::vector<int>>& list1) { int max_length = 0; std::vector<int> max_list; for (const auto& sublist : list1) { if (sublist.size() > max_length) { max_length = sublist.size(); max_list = sublist; } } return std::make_pair(max_length, max_list); }
int main() { assert(func0({{0}, {1, 3}, {5, 7}, {9, 11}, {13, 15, 17}}) == std::make_pair(3, std::vector<int>{13, 15, 17})); assert(func0({{1}, {5, 7}, {10, 12, 14, 15}}) == std::make_pair(4, std::vector<int>{10, 12, 14, 15})); assert(func0({{5}, {15, 20, 25}}) == std::make_pair(3, std::vector<int>{15, 20, 25})); return 0; }
O2
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 sub $0x20,%rsp mov (%rsi),%rbx mov 0x8(%rsi),%r13 mov %fs:0x28,%rax mov %rax,0x18(%rsp) xor %eax,%eax movq $0x0,(%rsp) movq $0x0,0x8(%rsp) movq $0x0,0x10(%rsp) cmp %r13,%rbx je 1cc8 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x158> xor %ebp,%ebp mov %rsp,%r14 jmp 1bd1 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x61> nopl 0x0(%rax) add $0x18,%rbx cmp %rbx,%r13 je 1bfa <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x8a> mov 0x8(%rbx),%rax sub (%rbx),%rax movslq %ebp,%rdx sar $0x2,%rax cmp %rax,%rdx jae 1bc8 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x58> mov %rbx,%rsi mov %r14,%rdi mov %eax,%ebp callq 1d00 <_ZNSt6vectorIiSaIiEEaSERKS1_> add $0x18,%rbx cmp %rbx,%r13 jne 1bd1 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x61> mov 0x8(%rsp),%rax mov (%rsp),%r13 mov %ebp,(%r12) movq $0x0,0x8(%r12) movq $0x0,0x10(%r12) mov %rax,%rbx movq $0x0,0x18(%r12) sub %r13,%rbx mov %rbx,%rdx sar $0x2,%rdx je 1cd5 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x165> movabs $0x1fffffffffffffff,%rax cmp %rax,%rdx ja 1cdc <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x16c> mov %rbx,%rdi callq 11b0 <_Znwm@plt> mov %rax,%rdi mov 0x8(%rsp),%rax mov (%rsp),%r13 mov %rax,%rdx sub %r13,%rdx add %rdi,%rbx mov %rdi,0x8(%r12) mov %rbx,0x18(%r12) lea (%rdi,%rdx,1),%rbx mov %rdi,0x10(%r12) cmp %r13,%rax je 1cb8 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x148> mov %r13,%rsi callq 11f0 <memmove@plt> mov %rbx,0x10(%r12) mov %r13,%rdi callq 11a0 <_ZdlPv@plt> mov 0x18(%rsp),%rax xor %fs:0x28,%rax jne 1ce1 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x171> add $0x20,%rsp mov %r12,%rax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 retq nopw 0x0(%rax,%rax,1) mov %rbx,0x10(%r12) test %r13,%r13 je 1c92 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x122> jmp 1c8a <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x11a> nopl 0x0(%rax) movl $0x0,(%rdi) xor %ebx,%ebx xor %eax,%eax xor %r13d,%r13d mov %rbx,%rdx xor %edi,%edi jmp 1c62 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xf2> callq 1130 <_ZSt17__throw_bad_allocv@plt> callq 11c0 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 1220 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE.cold> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax)
_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE: endbr64 push r15 pxor xmm0, xmm0 push r14 xor r14d, r14d push r13 xor r13d, r13d push r12 push rbp push rbx sub rsp, 48h mov rbx, [rsi] mov r15, [rsi+8] mov [rsp+78h+var_70], rdi mov rax, fs:28h mov [rsp+78h+var_40], rax xor eax, eax movaps [rsp+78h+var_58], xmm0 mov [rsp+78h+var_48], 0 cmp r15, rbx jnz short loc_1B89 jmp loc_1DB8 loc_1B80: add rbx, 18h cmp r15, rbx jz short loc_1C01 loc_1B89: mov rdx, [rbx+8] mov r12, [rbx] movsxd rcx, r13d mov rbp, rdx sub rbp, r12 mov rax, rbp sar rax, 2 cmp rcx, rax jnb short loc_1B80 mov r13d, eax mov rax, [rsp+78h+var_48] sub rax, r14 mov [rsp+78h+var_68], rax cmp rax, rbp jb loc_1D10 mov r8, qword ptr [rsp+78h+var_58+8] mov rcx, r8 sub rcx, r14 cmp rcx, rbp jb loc_1CB8 cmp rbp, 4 jle loc_1DFD mov rdx, rbp; n mov rsi, r12; src mov rdi, r14; dest call _memmove loc_1BEA: add rbp, r14 mov qword ptr [rsp+78h+var_58+8], rbp nop word ptr [rax+rax+00h] loc_1BF8: add rbx, 18h cmp r15, rbx jnz short loc_1B89 loc_1C01: mov rax, [rsp+78h+var_70] mov rbx, qword ptr [rsp+78h+var_58+8] pxor xmm0, xmm0 mov [rax], r13d mov qword ptr [rax+18h], 0 movups xmmword ptr [rax+8], xmm0 sub rbx, r14 jz loc_1D80 mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbx jb loc_1E0F mov rdi, rbx; unsigned __int64 call __Znwm; operator new(ulong) mov r15, [rsp+78h+var_70] movq xmm0, rax lea rbp, [rax+rbx] mov rdi, rax; dest punpcklqdq xmm0, xmm0 mov r12, [rsp+78h+var_48] mov [r15+18h], rbp movups xmmword ptr [r15+8], xmm0 cmp rbx, 4 jle loc_1E44 mov rdx, rbx; n mov rsi, r14; src call _memcpy mov [r15+10h], rbp loc_1C7E: mov rsi, r12 sub rsi, r14; unsigned __int64 loc_1C84: mov rdi, r14; void * call __ZdlPvm; operator delete(void *,ulong) loc_1C8C: mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz loc_1E5D mov rax, [rsp+78h+var_70] add rsp, 48h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1CB8: cmp rcx, 4 jle loc_1DDB mov rdx, rcx; n mov rsi, r12; src mov rdi, r14; dest mov [rsp+78h+dest], r8 mov [rsp+78h+var_68], rcx call _memmove mov rdx, [rbx+8] mov r12, [rbx] mov rcx, [rsp+78h+var_68] mov r8, [rsp+78h+dest] loc_1CEB: lea rsi, [r12+rcx]; src sub rdx, rsi; n cmp rdx, 4 jle loc_1DED mov rdi, r8; dest call _memmove jmp loc_1BEA loc_1D10: mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbp jb loc_1E2F mov rdi, rbp; unsigned __int64 call __Znwm; operator new(ulong) mov rcx, rax cmp rbp, 4 jz loc_1E24 mov rdx, rbp; n mov rsi, r12; src mov rdi, rax; dest call _memmove mov rcx, rax loc_1D49: test r14, r14 jz short loc_1D65 mov rsi, [rsp+78h+var_68]; unsigned __int64 mov rdi, r14; void * mov [rsp+78h+dest], rcx call __ZdlPvm; operator delete(void *,ulong) mov rcx, [rsp+78h+dest] loc_1D65: add rbp, rcx mov qword ptr [rsp+78h+var_58], rcx mov r14, rcx mov [rsp+78h+var_48], rbp mov qword ptr [rsp+78h+var_58+8], rbp jmp loc_1BF8 loc_1D80: mov qword ptr [rax+8], 0 xor ebp, ebp mov qword ptr [rax+18h], 0 loc_1D92: mov rax, [rsp+78h+var_70] mov [rax+10h], rbp test r14, r14 jz loc_1C8C mov rsi, [rsp+78h+var_48] sub rsi, r14 jmp loc_1C84 loc_1DB8: mov dword ptr [rdi], 0 mov qword ptr [rdi+8], 0 mov qword ptr [rdi+10h], 0 mov qword ptr [rdi+18h], 0 jmp loc_1C8C loc_1DDB: jnz loc_1CEB mov eax, [r12] mov [r14], eax jmp loc_1CEB loc_1DED: jnz loc_1BEA mov eax, [rsi] mov [r8], eax jmp loc_1BEA loc_1DFD: jnz loc_1BEA mov eax, [r12] mov [r14], eax jmp loc_1BEA loc_1E0F: mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz short loc_1E5D call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) loc_1E24: mov eax, [r12] mov [rcx], eax jmp loc_1D49 loc_1E2F: mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz short loc_1E5D call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) loc_1E44: jnz loc_1D92 mov eax, [r14] mov [rdi], eax mov rax, [rsp+78h+var_70] mov [rax+10h], rbp jmp loc_1C7E loc_1E5D: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE_cold; func0(std::vector<std::vector<int>> const&) [clone]
_DWORD * func0(_DWORD *a1, char ***a2) { _DWORD *v2; // r14 int v3; // r13d char **v4; // rbx char **v5; // r15 char *v6; // rdx char *v7; // r12 signed long long v8; // rbp _DWORD *v9; // r8 long long v10; // rcx _DWORD *v11; // rax bool v12; // zf unsigned long long v13; // rsi char *v15; // rsi signed long long v16; // rdx _DWORD *v17; // rax void *v18; // rcx _DWORD *v19; // [rsp+0h] [rbp-70h] unsigned long long v20; // [rsp+8h] [rbp-68h] _DWORD *dest; // [rsp+10h] [rbp-60h] __int128 v22; // [rsp+18h] [rbp-58h] char *v23; // [rsp+28h] [rbp-48h] v2 = 0LL; v3 = 0; v4 = *a2; v5 = a2[1]; v19 = a1; v22 = 0LL; v23 = 0LL; if ( v5 == *a2 ) { *a1 = 0; *((_QWORD *)a1 + 1) = 0LL; *((_QWORD *)a1 + 2) = 0LL; *((_QWORD *)a1 + 3) = 0LL; } else { LABEL_4: while ( 1 ) { v6 = v4[1]; v7 = *v4; v8 = v6 - *v4; if ( v3 < (unsigned long long)(v8 >> 2) ) break; v4 += 3; if ( v5 == v4 ) { while ( 1 ) { *v19 = v3; *((_QWORD *)v19 + 3) = 0LL; *(_OWORD *)(v19 + 2) = 0LL; v4 = (char **)(*((_QWORD *)&v22 + 1) - (_QWORD)v2); if ( *((_QWORD *)&v22 + 1) == (_QWORD)v2 ) { *((_QWORD *)v19 + 1) = 0LL; v8 = 0LL; *((_QWORD *)v19 + 3) = 0LL; goto LABEL_29; } if ( (unsigned long long)v4 <= 0x7FFFFFFFFFFFFFFCLL ) break; std::__throw_bad_array_new_length(); LABEL_38: *(_DWORD *)v18 = *(_DWORD *)v7; LABEL_25: if ( v2 ) { a1 = v2; dest = v18; operator delete(v2, v20); v18 = dest; } v8 += (signed long long)v18; v2 = v18; v23 = (char *)v8; *((_QWORD *)&v22 + 1) = v8; LABEL_10: v4 += 3; if ( v5 != v4 ) goto LABEL_4; } v11 = (_DWORD *)operator new((unsigned long long)v4); v8 = (signed long long)v4 + (_QWORD)v11; a1 = v11; v7 = v23; *((_QWORD *)v19 + 3) = (char *)v4 + (_QWORD)v11; *(__m128i *)(v19 + 2) = _mm_unpacklo_epi64((__m128i)(unsigned long long)v11, (__m128i)(unsigned long long)v11); v12 = v4 == (char **)&byte_4; if ( (long long)v4 <= 4 ) goto LABEL_40; memcpy(v11, v2, (size_t)v4); *((_QWORD *)v19 + 2) = v8; LABEL_15: v13 = v7 - (char *)v2; LABEL_16: operator delete(v2, v13); return v19; } } v3 = v8 >> 2; v20 = v23 - (char *)v2; if ( v23 - (char *)v2 >= (unsigned long long)v8 ) { v9 = (_DWORD *)*((_QWORD *)&v22 + 1); v10 = *((_QWORD *)&v22 + 1) - (_QWORD)v2; if ( *((_QWORD *)&v22 + 1) - (_QWORD)v2 < (unsigned long long)v8 ) { if ( v10 <= 4 ) { if ( v10 == 4 ) *v2 = *(_DWORD *)v7; } else { a1 = v2; v20 = *((_QWORD *)&v22 + 1) - (_QWORD)v2; memmove(v2, v7, *((_QWORD *)&v22 + 1) - (_QWORD)v2); v6 = v4[1]; v7 = *v4; v10 = *((_QWORD *)&v22 + 1) - (_QWORD)v2; v9 = (_DWORD *)*((_QWORD *)&v22 + 1); } v15 = &v7[v10]; v16 = v6 - &v7[v10]; if ( v16 <= 4 ) { if ( v16 == 4 ) *v9 = *(_DWORD *)v15; } else { a1 = v9; memmove(v9, v15, v16); } } else if ( v8 <= 4 ) { if ( v8 == 4 ) *v2 = *(_DWORD *)v7; } else { a1 = v2; memmove(v2, v7, v8); } v8 += (signed long long)v2; *((_QWORD *)&v22 + 1) = v8; goto LABEL_10; } if ( (unsigned long long)v8 <= 0x7FFFFFFFFFFFFFFCLL ) { a1 = (_DWORD *)(v4[1] - *v4); v17 = (_DWORD *)operator new(v8); v18 = v17; if ( v8 != 4 ) { a1 = v17; v18 = memmove(v17, v7, v8); goto LABEL_25; } goto LABEL_38; } std::__throw_bad_array_new_length(); LABEL_40: if ( v12 ) { *a1 = *v2; *((_QWORD *)v19 + 2) = v8; goto LABEL_15; } LABEL_29: *((_QWORD *)v19 + 2) = v8; if ( v2 ) { v13 = v23 - (char *)v2; goto LABEL_16; } } return v19; }
func0: ENDBR64 PUSH R15 PXOR XMM0,XMM0 PUSH R14 XOR R14D,R14D PUSH R13 XOR R13D,R13D PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x48 MOV RBX,qword ptr [RSI] MOV R15,qword ptr [RSI + 0x8] MOV qword ptr [RSP + 0x8],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x38],RAX XOR EAX,EAX MOVAPS xmmword ptr [RSP + 0x20],XMM0 MOV qword ptr [RSP + 0x30],0x0 CMP R15,RBX JNZ 0x00101b89 JMP 0x00101db8 LAB_00101b80: ADD RBX,0x18 CMP R15,RBX JZ 0x00101c01 LAB_00101b89: MOV RDX,qword ptr [RBX + 0x8] MOV R12,qword ptr [RBX] MOVSXD RCX,R13D MOV RBP,RDX SUB RBP,R12 MOV RAX,RBP SAR RAX,0x2 CMP RCX,RAX JNC 0x00101b80 MOV R13D,EAX MOV RAX,qword ptr [RSP + 0x30] SUB RAX,R14 MOV qword ptr [RSP + 0x10],RAX CMP RAX,RBP JC 0x00101d10 MOV R8,qword ptr [RSP + 0x28] MOV RCX,R8 SUB RCX,R14 CMP RCX,RBP JC 0x00101cb8 CMP RBP,0x4 JLE 0x00101dfd MOV RDX,RBP MOV RSI,R12 MOV RDI,R14 CALL 0x001011d0 LAB_00101bea: ADD RBP,R14 MOV qword ptr [RSP + 0x28],RBP NOP word ptr [RAX + RAX*0x1] LAB_00101bf8: ADD RBX,0x18 CMP R15,RBX JNZ 0x00101b89 LAB_00101c01: MOV RAX,qword ptr [RSP + 0x8] MOV RBX,qword ptr [RSP + 0x28] PXOR XMM0,XMM0 MOV dword ptr [RAX],R13D MOV qword ptr [RAX + 0x18],0x0 MOVUPS xmmword ptr [RAX + 0x8],XMM0 SUB RBX,R14 JZ 0x00101d80 MOV RAX,0x7ffffffffffffffc CMP RAX,RBX JC 0x00101e0f MOV RDI,RBX LAB_00101c3d: CALL 0x00101190 MOV R15,qword ptr [RSP + 0x8] MOVQ XMM0,RAX LEA RBP,[RAX + RBX*0x1] MOV RDI,RAX PUNPCKLQDQ XMM0,XMM0 MOV R12,qword ptr [RSP + 0x30] MOV qword ptr [R15 + 0x18],RBP MOVUPS xmmword ptr [R15 + 0x8],XMM0 CMP RBX,0x4 JLE 0x00101e44 MOV RDX,RBX MOV RSI,R14 CALL 0x00101180 MOV qword ptr [R15 + 0x10],RBP LAB_00101c7e: MOV RSI,R12 SUB RSI,R14 LAB_00101c84: MOV RDI,R14 CALL 0x001011a0 LAB_00101c8c: MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101e5d MOV RAX,qword ptr [RSP + 0x8] ADD RSP,0x48 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101cb8: CMP RCX,0x4 JLE 0x00101ddb MOV RDX,RCX MOV RSI,R12 MOV RDI,R14 MOV qword ptr [RSP + 0x18],R8 MOV qword ptr [RSP + 0x10],RCX CALL 0x001011d0 MOV RDX,qword ptr [RBX + 0x8] MOV R12,qword ptr [RBX] MOV RCX,qword ptr [RSP + 0x10] MOV R8,qword ptr [RSP + 0x18] LAB_00101ceb: LEA RSI,[R12 + RCX*0x1] SUB RDX,RSI CMP RDX,0x4 JLE 0x00101ded MOV RDI,R8 CALL 0x001011d0 JMP 0x00101bea LAB_00101d10: MOV RAX,0x7ffffffffffffffc CMP RAX,RBP JC 0x00101e2f MOV RDI,RBP CALL 0x00101190 MOV RCX,RAX CMP RBP,0x4 JZ 0x00101e24 MOV RDX,RBP MOV RSI,R12 MOV RDI,RAX CALL 0x001011d0 MOV RCX,RAX LAB_00101d49: TEST R14,R14 JZ 0x00101d65 MOV RSI,qword ptr [RSP + 0x10] MOV RDI,R14 MOV qword ptr [RSP + 0x18],RCX CALL 0x001011a0 MOV RCX,qword ptr [RSP + 0x18] LAB_00101d65: ADD RBP,RCX MOV qword ptr [RSP + 0x20],RCX MOV R14,RCX MOV qword ptr [RSP + 0x30],RBP MOV qword ptr [RSP + 0x28],RBP JMP 0x00101bf8 LAB_00101d80: MOV qword ptr [RAX + 0x8],0x0 XOR EBP,EBP MOV qword ptr [RAX + 0x18],0x0 LAB_00101d92: MOV RAX,qword ptr [RSP + 0x8] MOV qword ptr [RAX + 0x10],RBP TEST R14,R14 JZ 0x00101c8c MOV RSI,qword ptr [RSP + 0x30] SUB RSI,R14 JMP 0x00101c84 LAB_00101db8: MOV dword ptr [RDI],0x0 MOV qword ptr [RDI + 0x8],0x0 MOV qword ptr [RDI + 0x10],0x0 MOV qword ptr [RDI + 0x18],0x0 JMP 0x00101c8c LAB_00101ddb: JNZ 0x00101ceb MOV EAX,dword ptr [R12] MOV dword ptr [R14],EAX JMP 0x00101ceb LAB_00101ded: JNZ 0x00101bea MOV EAX,dword ptr [RSI] MOV dword ptr [R8],EAX JMP 0x00101bea LAB_00101dfd: JNZ 0x00101bea MOV EAX,dword ptr [R12] MOV dword ptr [R14],EAX JMP 0x00101bea LAB_00101e0f: MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101e5d CALL 0x00101170 LAB_00101e24: MOV EAX,dword ptr [R12] MOV dword ptr [RCX],EAX JMP 0x00101d49 LAB_00101e2f: MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101e5d CALL 0x00101170 LAB_00101e44: JNZ 0x00101d92 MOV EAX,dword ptr [R14] MOV dword ptr [RDI],EAX MOV RAX,qword ptr [RSP + 0x8] MOV qword ptr [RAX + 0x10],RBP JMP 0x00101c7e LAB_00101e5d: CALL 0x001011b0
/* 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; vector *pvVar2; long lVar3; int iVar4; vector *__dest; vector *__dest_00; long lVar5; size_t __n; vector *__n_00; vector *__n_01; int8 *in_RSI; ulong uVar6; vector *__dest_01; vector *__src; long in_FS_OFFSET; int uVar7; vector *local_68; vector *pvStack_50; vector *local_48; __dest_01 = (vector *)0x0; iVar4 = 0; __n_00 = (vector *)*in_RSI; pvVar2 = (vector *)in_RSI[1]; lVar3 = *(long *)(in_FS_OFFSET + 0x28); pvStack_50 = (vector *)0x0; local_48 = (vector *)0x0; __dest = param_1; if (pvVar2 != __n_00) { do { lVar5 = *(long *)(__n_00 + 8); __src = *(vector **)__n_00; __dest_00 = (vector *)(long)iVar4; __n_01 = (vector *)(lVar5 - (long)__src); pvVar1 = __src; if (__dest_00 < (vector *)((long)__n_01 >> 2)) { iVar4 = (int)(vector *)((long)__n_01 >> 2); local_68 = local_48 + -(long)__dest_01; if (local_68 < __n_01) goto LAB_00101d10; __dest_00 = pvStack_50 + -(long)__dest_01; if (__dest_00 < __n_01) { if ((long)__dest_00 < 5) { if (__dest_00 == (vector *)0x4) { *(int4 *)__dest_01 = *(int4 *)__src; } } else { __dest = __dest_01; memmove(__dest_01,__src,(size_t)__dest_00); lVar5 = *(long *)(__n_00 + 8); __src = *(vector **)__n_00; local_68 = __dest_00; } pvVar1 = __src + (long)__dest_00; __n = lVar5 - (long)pvVar1; if ((long)__n < 5) { if (__n == 4) { *(int4 *)pvStack_50 = *(int4 *)pvVar1; } } else { memmove(pvStack_50,pvVar1,__n); __dest = pvStack_50; } } else if ((long)__n_01 < 5) { if (__n_01 == (vector *)0x4) { *(int4 *)__dest_01 = *(int4 *)__src; } } else { __dest = __dest_01; memmove(__dest_01,__src,(size_t)__n_01); } __n_01 = __n_01 + (long)__dest_01; pvVar1 = __src; pvStack_50 = __n_01; } while (__src = local_48, __n_00 = __n_00 + 0x18, local_48 = __src, pvVar2 == __n_00) { *(int *)param_1 = iVar4; *(int8 *)(param_1 + 0x18) = 0; *(int (*) [16])(param_1 + 8) = (int [16])0x0; __n_00 = pvStack_50 + -(long)__dest_01; if (__n_00 == (vector *)0x0) { *(int8 *)(param_1 + 8) = 0; __n_01 = (vector *)0x0; *(int8 *)(param_1 + 0x18) = 0; goto LAB_00101d92; } if (__n_00 < (vector *)0x7ffffffffffffffd) { /* try { // try from 00101c3d to 00101e43 has its CatchHandler @ 00101e62 */ __dest = (vector *)operator_new((ulong)__n_00); __n_01 = __dest + (long)__n_00; *(vector **)(param_1 + 0x18) = __n_01; *(vector **)(param_1 + 8) = __dest; *(vector **)(param_1 + 0x10) = __dest; uVar7 = __n_00 == (vector *)0x4; if ((long)__n_00 < 5) goto LAB_00101e44; memcpy(__dest,__dest_01,(size_t)__n_00); *(vector **)(param_1 + 0x10) = __n_01; goto LAB_00101c7e; } if (lVar3 != *(long *)(in_FS_OFFSET + 0x28)) goto LAB_00101e5d; std::__throw_bad_array_new_length(); __src = pvVar1; LAB_00101e24: *(int4 *)__dest_00 = *(int4 *)__src; LAB_00101d49: if (__dest_01 != (vector *)0x0) { operator_delete(__dest_01,(ulong)local_68); __dest = __dest_01; } __n_01 = __n_01 + (long)__dest_00; pvVar1 = __src; __dest_01 = __dest_00; local_48 = __n_01; pvStack_50 = __n_01; } } while( true ); } *(int4 *)param_1 = 0; *(int8 *)(param_1 + 8) = 0; *(int8 *)(param_1 + 0x10) = 0; *(int8 *)(param_1 + 0x18) = 0; LAB_00101c8c: if (lVar3 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } LAB_00101e5d: /* WARNING: Subroutine does not return */ __stack_chk_fail(); LAB_00101d10: if (__n_01 < (vector *)0x7ffffffffffffffd) { __dest = __n_01; __dest_00 = (vector *)operator_new((ulong)__n_01); if (__n_01 == (vector *)0x4) goto LAB_00101e24; __dest = __dest_00; __dest_00 = (vector *)memmove(__dest_00,__src,(size_t)__n_01); goto LAB_00101d49; } uVar7 = lVar3 == *(long *)(in_FS_OFFSET + 0x28); if (!(bool)uVar7) goto LAB_00101e5d; std::__throw_bad_array_new_length(); LAB_00101e44: if ((bool)uVar7) { *(int4 *)__dest = *(int4 *)__dest_01; *(vector **)(param_1 + 0x10) = __n_01; LAB_00101c7e: uVar6 = (long)__src - (long)__dest_01; } else { LAB_00101d92: *(vector **)(param_1 + 0x10) = __n_01; if (__dest_01 == (vector *)0x0) goto LAB_00101c8c; uVar6 = (long)local_48 - (long)__dest_01; } operator_delete(__dest_01,uVar6); goto LAB_00101c8c; }
1,159
func0
#include <iostream> #include <vector> #include <cassert>
std::pair<int, std::vector<int>> func0(const std::vector<std::vector<int>>& list1) { int max_length = 0; std::vector<int> max_list; for (const auto& sublist : list1) { if (sublist.size() > max_length) { max_length = sublist.size(); max_list = sublist; } } return std::make_pair(max_length, max_list); }
int main() { assert(func0({{0}, {1, 3}, {5, 7}, {9, 11}, {13, 15, 17}}) == std::make_pair(3, std::vector<int>{13, 15, 17})); assert(func0({{1}, {5, 7}, {10, 12, 14, 15}}) == std::make_pair(4, std::vector<int>{10, 12, 14, 15})); assert(func0({{5}, {15, 20, 25}}) == std::make_pair(3, std::vector<int>{15, 20, 25})); return 0; }
O3
cpp
func0(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x38,%rsp mov 0x8(%rsi),%rax mov (%rsi),%rbx mov %rdi,0x10(%rsp) mov %rax,(%rsp) cmp %rax,%rbx je 1e08 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x288> movq $0x0,0x8(%rsp) xor %ecx,%ecx xor %r15d,%r15d xor %r14d,%r14d jmp 1bca <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x4a> xchg %ax,%ax add $0x18,%rbx cmp %rbx,(%rsp) je 1c48 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0xc8> mov 0x8(%rbx),%r12 mov (%rbx),%rbp movslq %r14d,%rdx mov %r12,%r13 sub %rbp,%r13 mov %r13,%rax sar $0x2,%rax cmp %rax,%rdx jae 1bc0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x40> mov %rcx,%rdx mov %eax,%r14d sub %r15,%rdx sar $0x2,%rdx cmp %rdx,%rax ja 1d60 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x1e0> mov 0x8(%rsp),%rdx lea (%r15,%r13,1),%r8 sub %r15,%rdx mov %rdx,%rsi sar $0x2,%rsi cmp %rsi,%rax ja 1ce8 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x168> mov %r8,0x8(%rsp) cmp %r12,%rbp je 1bc0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x40> mov %r13,%rdx mov %rbp,%rsi mov %r15,%rdi mov %rcx,0x18(%rsp) callq 11f0 <memmove@plt> add $0x18,%rbx mov 0x18(%rsp),%rcx cmp %rbx,(%rsp) jne 1bca <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x4a> nopl 0x0(%rax) mov 0x8(%rsp),%r12 mov 0x10(%rsp),%rax pxor %xmm0,%xmm0 sub %r15,%r12 mov %r14d,(%rax) movq $0x0,0x18(%rax) movups %xmm0,0x8(%rax) mov %r12,%rax sar $0x2,%rax je 1df8 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x278> movabs $0x1fffffffffffffff,%rdx cmp %rdx,%rax ja 1e30 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x2b0> mov %r12,%rdi callq 11b0 <_Znwm@plt> mov %rax,%rdi lea (%rax,%r12,1),%rbx mov 0x10(%rsp),%r14 movq %rdi,%xmm0 punpcklqdq %xmm0,%xmm0 mov %rbx,0x18(%r14) movups %xmm0,0x8(%r14) cmp 0x8(%rsp),%r15 je 1dd8 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x258> mov %r12,%rdx mov %r15,%rsi callq 1180 <memcpy@plt> mov %rbx,0x10(%r14) mov %r15,%rdi callq 11a0 <_ZdlPv@plt> mov 0x10(%rsp),%rax add $0x38,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax) test %rdx,%rdx je 1d1d <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x19d> mov %rbp,%rsi mov %r15,%rdi mov %r8,0x28(%rsp) mov %rcx,0x20(%rsp) mov %rdx,0x18(%rsp) callq 11f0 <memmove@plt> mov 0x8(%rbx),%r12 mov (%rbx),%rbp mov 0x28(%rsp),%r8 mov 0x20(%rsp),%rcx mov 0x18(%rsp),%rdx lea 0x0(%rbp,%rdx,1),%rsi cmp %rsi,%r12 je 1dc8 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x248> mov 0x8(%rsp),%rdi mov %r12,%rdx mov %r8,0x20(%rsp) sub %rsi,%rdx mov %rcx,0x18(%rsp) callq 11f0 <memmove@plt> mov 0x20(%rsp),%r8 mov 0x18(%rsp),%rcx mov %r8,0x8(%rsp) jmpq 1bc0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x40> nopl 0x0(%rax) test %rax,%rax je 1df0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x270> movabs $0x1fffffffffffffff,%rcx cmp %rcx,%rax ja 1e2b <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x2ab> mov %r13,%rdi callq 11b0 <_Znwm@plt> mov %rax,%r8 cmp %r12,%rbp je 1d9d <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x21d> mov %r8,%rdi mov %r13,%rdx mov %rbp,%rsi callq 1180 <memcpy@plt> mov %rax,%r8 test %r15,%r15 je 1db4 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x234> mov %r15,%rdi mov %r8,0x8(%rsp) callq 11a0 <_ZdlPv@plt> mov 0x8(%rsp),%r8 lea (%r8,%r13,1),%rcx mov %r8,%r15 mov %rcx,0x8(%rsp) jmpq 1bc0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x40> nopl (%rax) mov %r8,0x8(%rsp) jmpq 1bc0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x40> nopw 0x0(%rax,%rax,1) mov %rbx,0x10(%r14) test %r15,%r15 je 1cd0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x150> jmpq 1cc8 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x148> nopw 0x0(%rax,%rax,1) xor %r8d,%r8d jmp 1d87 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x207> nopl (%rax) mov %r12,%rbx xor %edi,%edi jmpq 1c97 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x117> nopw 0x0(%rax,%rax,1) pxor %xmm0,%xmm0 movl $0x0,(%rdi) movups %xmm0,0x8(%rdi) movq $0x0,0x18(%rdi) movq $0x0,0x10(%rdi) jmpq 1cd0 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE+0x150> callq 1130 <_ZSt17__throw_bad_allocv@plt> callq 1130 <_ZSt17__throw_bad_allocv@plt> endbr64 mov %rax,%rbp jmpq 1235 <_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE.cold> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
_Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE: endbr64 push r15 pxor xmm0, xmm0 push r14 xor r14d, r14d push r13 xor r13d, r13d push r12 push rbp push rbx sub rsp, 48h mov rbx, [rsi] mov r15, [rsi+8] mov [rsp+78h+var_70], rdi mov rax, fs:28h mov [rsp+78h+var_40], rax xor eax, eax movaps [rsp+78h+var_58], xmm0 mov [rsp+78h+var_48], 0 cmp r15, rbx jnz short loc_1C3D jmp loc_1E68 loc_1C30: add rbx, 18h cmp r15, rbx jz loc_1CED loc_1C3D: mov rdx, [rbx+8] mov r12, [rbx] movsxd rcx, r13d mov rbp, rdx sub rbp, r12 mov rax, rbp sar rax, 2 cmp rcx, rax jnb short loc_1C30 mov r13d, eax mov rax, [rsp+78h+var_48] sub rax, r14 mov [rsp+78h+var_68], rax cmp rax, rbp jb loc_1DA0 mov r8, qword ptr [rsp+78h+var_58+8] mov rcx, r8 sub rcx, r14 cmp rcx, rbp jnb loc_1E10 cmp rcx, 4 jle loc_1E9B mov rdx, rcx; n mov rsi, r12; src mov rdi, r14; dest mov [rsp+78h+dest], r8 mov [rsp+78h+var_68], rcx call _memmove mov rdx, [rbx+8] mov r12, [rbx] mov rcx, [rsp+78h+var_68] mov r8, [rsp+78h+dest] loc_1CB9: lea rsi, [r12+rcx]; src sub rdx, rsi; n cmp rdx, 4 jle loc_1E8B mov rdi, r8; dest call _memmove loc_1CD2: add rbp, r14 mov qword ptr [rsp+78h+var_58+8], rbp nop word ptr [rax+rax+00h] loc_1CE0: add rbx, 18h cmp r15, rbx jnz loc_1C3D loc_1CED: mov rax, [rsp+78h+var_70] mov rbx, qword ptr [rsp+78h+var_58+8] pxor xmm0, xmm0 mov [rax], r13d mov qword ptr [rax+18h], 0 movups xmmword ptr [rax+8], xmm0 sub rbx, r14 jz loc_1E30 mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbx jb loc_1EAD mov rdi, rbx; unsigned __int64 call __Znwm; operator new(ulong) mov r15, [rsp+78h+var_70] movq xmm0, rax lea rbp, [rax+rbx] mov rdi, rax; dest punpcklqdq xmm0, xmm0 mov r12, [rsp+78h+var_48] mov [r15+18h], rbp movups xmmword ptr [r15+8], xmm0 cmp rbx, 4 jle loc_1EF4 mov rdx, rbx; n mov rsi, r14; src call _memcpy mov [r15+10h], rbp loc_1D6A: mov rsi, r12 sub rsi, r14; unsigned __int64 loc_1D70: mov rdi, r14; void * call __ZdlPvm; operator delete(void *,ulong) loc_1D78: mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz loc_1F0D mov rax, [rsp+78h+var_70] add rsp, 48h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1DA0: mov rax, 7FFFFFFFFFFFFFFCh cmp rax, rbp jb loc_1EDF mov rdi, rbp; unsigned __int64 call __Znwm; operator new(ulong) mov rcx, rax cmp rbp, 4 jz loc_1EC2 mov rdx, rbp; n mov rsi, r12; src mov rdi, rax; dest call _memmove mov rcx, rax loc_1DD9: test r14, r14 jz short loc_1DF5 mov rsi, [rsp+78h+var_68]; unsigned __int64 mov rdi, r14; void * mov [rsp+78h+dest], rcx call __ZdlPvm; operator delete(void *,ulong) mov rcx, [rsp+78h+dest] loc_1DF5: add rbp, rcx mov qword ptr [rsp+78h+var_58], rcx mov r14, rcx mov [rsp+78h+var_48], rbp mov qword ptr [rsp+78h+var_58+8], rbp jmp loc_1CE0 loc_1E10: cmp rbp, 4 jle loc_1ECD mov rdx, rbp; n mov rsi, r12; src mov rdi, r14; dest call _memmove jmp loc_1CD2 loc_1E30: mov qword ptr [rax+8], 0 xor ebp, ebp mov qword ptr [rax+18h], 0 loc_1E42: mov rax, [rsp+78h+var_70] mov [rax+10h], rbp test r14, r14 jz loc_1D78 mov rsi, [rsp+78h+var_48] sub rsi, r14 jmp loc_1D70 loc_1E68: mov dword ptr [rdi], 0 mov qword ptr [rdi+8], 0 mov qword ptr [rdi+10h], 0 mov qword ptr [rdi+18h], 0 jmp loc_1D78 loc_1E8B: jnz loc_1CD2 mov eax, [rsi] mov [r8], eax jmp loc_1CD2 loc_1E9B: jnz loc_1CB9 mov eax, [r12] mov [r14], eax jmp loc_1CB9 loc_1EAD: mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz short loc_1F0D call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) loc_1EC2: mov eax, [r12] mov [rcx], eax jmp loc_1DD9 loc_1ECD: jnz loc_1CD2 mov eax, [r12] mov [r14], eax jmp loc_1CD2 loc_1EDF: mov rax, [rsp+78h+var_40] sub rax, fs:28h jnz short loc_1F0D call __ZSt28__throw_bad_array_new_lengthv; std::__throw_bad_array_new_length(void) loc_1EF4: jnz loc_1E42 mov eax, [r14] mov [rdi], eax mov rax, [rsp+78h+var_70] mov [rax+10h], rbp jmp loc_1D6A loc_1F0D: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0RKSt6vectorIS_IiSaIiEESaIS1_EE_cold; func0(std::vector<std::vector<int>> const&) [clone]
_DWORD * func0(_DWORD *a1, char ***a2) { _DWORD *v2; // r14 int v3; // r13d char **v4; // rbx char **v5; // r15 char *v6; // rdx char *v7; // r12 signed long long v8; // rbp _DWORD *v9; // r8 long long v10; // rcx char *v11; // rsi signed long long v12; // rdx _DWORD *v13; // rax bool v14; // zf unsigned long long v15; // rsi _DWORD *v17; // rax void *v18; // rcx _DWORD *v19; // [rsp+0h] [rbp-70h] unsigned long long v20; // [rsp+8h] [rbp-68h] _DWORD *dest; // [rsp+10h] [rbp-60h] __int128 v22; // [rsp+18h] [rbp-58h] char *v23; // [rsp+28h] [rbp-48h] v2 = 0LL; v3 = 0; v4 = *a2; v5 = a2[1]; v19 = a1; v22 = 0LL; v23 = 0LL; if ( v5 == *a2 ) { *a1 = 0; *((_QWORD *)a1 + 1) = 0LL; *((_QWORD *)a1 + 2) = 0LL; *((_QWORD *)a1 + 3) = 0LL; } else { LABEL_4: while ( 1 ) { v6 = v4[1]; v7 = *v4; v8 = v6 - *v4; if ( v3 < (unsigned long long)(v8 >> 2) ) break; v4 += 3; if ( v5 == v4 ) { while ( 1 ) { *v19 = v3; *((_QWORD *)v19 + 3) = 0LL; *(_OWORD *)(v19 + 2) = 0LL; v4 = (char **)(*((_QWORD *)&v22 + 1) - (_QWORD)v2); if ( *((_QWORD *)&v22 + 1) == (_QWORD)v2 ) { *((_QWORD *)v19 + 1) = 0LL; v8 = 0LL; *((_QWORD *)v19 + 3) = 0LL; goto LABEL_29; } if ( (unsigned long long)v4 <= 0x7FFFFFFFFFFFFFFCLL ) break; std::__throw_bad_array_new_length(); LABEL_36: *(_DWORD *)v18 = *(_DWORD *)v7; LABEL_23: if ( v2 ) { a1 = v2; dest = v18; operator delete(v2, v20); v18 = dest; } v8 += (signed long long)v18; v2 = v18; v23 = (char *)v8; *((_QWORD *)&v22 + 1) = v8; LABEL_12: v4 += 3; if ( v5 != v4 ) goto LABEL_4; } v13 = (_DWORD *)operator new((unsigned long long)v4); v8 = (signed long long)v4 + (_QWORD)v13; a1 = v13; v7 = v23; *((_QWORD *)v19 + 3) = (char *)v4 + (_QWORD)v13; *(__m128i *)(v19 + 2) = _mm_unpacklo_epi64((__m128i)(unsigned long long)v13, (__m128i)(unsigned long long)v13); v14 = v4 == (char **)&byte_4; if ( (long long)v4 <= 4 ) goto LABEL_40; memcpy(v13, v2, (size_t)v4); *((_QWORD *)v19 + 2) = v8; LABEL_17: v15 = v7 - (char *)v2; LABEL_18: operator delete(v2, v15); return v19; } } v3 = v8 >> 2; v20 = v23 - (char *)v2; if ( v23 - (char *)v2 >= (unsigned long long)v8 ) { v9 = (_DWORD *)*((_QWORD *)&v22 + 1); v10 = *((_QWORD *)&v22 + 1) - (_QWORD)v2; if ( *((_QWORD *)&v22 + 1) - (_QWORD)v2 >= (unsigned long long)v8 ) { if ( v8 <= 4 ) { if ( v8 == 4 ) *v2 = *(_DWORD *)v7; } else { a1 = v2; memmove(v2, v7, v8); } } else { if ( v10 <= 4 ) { if ( v10 == 4 ) *v2 = *(_DWORD *)v7; } else { a1 = v2; v20 = *((_QWORD *)&v22 + 1) - (_QWORD)v2; memmove(v2, v7, *((_QWORD *)&v22 + 1) - (_QWORD)v2); v6 = v4[1]; v7 = *v4; v10 = *((_QWORD *)&v22 + 1) - (_QWORD)v2; v9 = (_DWORD *)*((_QWORD *)&v22 + 1); } v11 = &v7[v10]; v12 = v6 - &v7[v10]; if ( v12 <= 4 ) { if ( v12 == 4 ) *v9 = *(_DWORD *)v11; } else { a1 = v9; memmove(v9, v11, v12); } } v8 += (signed long long)v2; *((_QWORD *)&v22 + 1) = v8; goto LABEL_12; } if ( (unsigned long long)v8 <= 0x7FFFFFFFFFFFFFFCLL ) { a1 = (_DWORD *)(v4[1] - *v4); v17 = (_DWORD *)operator new(v8); v18 = v17; if ( v8 != 4 ) { a1 = v17; v18 = memmove(v17, v7, v8); goto LABEL_23; } goto LABEL_36; } std::__throw_bad_array_new_length(); LABEL_40: if ( v14 ) { *a1 = *v2; *((_QWORD *)v19 + 2) = v8; goto LABEL_17; } LABEL_29: *((_QWORD *)v19 + 2) = v8; if ( v2 ) { v15 = v23 - (char *)v2; goto LABEL_18; } } return v19; }
func0: ENDBR64 PUSH R15 PXOR XMM0,XMM0 PUSH R14 XOR R14D,R14D PUSH R13 XOR R13D,R13D PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x48 MOV RBX,qword ptr [RSI] MOV R15,qword ptr [RSI + 0x8] MOV qword ptr [RSP + 0x8],RDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x38],RAX XOR EAX,EAX MOVAPS xmmword ptr [RSP + 0x20],XMM0 MOV qword ptr [RSP + 0x30],0x0 CMP R15,RBX JNZ 0x00101c3d JMP 0x00101e68 LAB_00101c30: ADD RBX,0x18 CMP R15,RBX JZ 0x00101ced LAB_00101c3d: MOV RDX,qword ptr [RBX + 0x8] MOV R12,qword ptr [RBX] MOVSXD RCX,R13D MOV RBP,RDX SUB RBP,R12 MOV RAX,RBP SAR RAX,0x2 CMP RCX,RAX JNC 0x00101c30 MOV R13D,EAX MOV RAX,qword ptr [RSP + 0x30] SUB RAX,R14 MOV qword ptr [RSP + 0x10],RAX CMP RAX,RBP JC 0x00101da0 MOV R8,qword ptr [RSP + 0x28] MOV RCX,R8 SUB RCX,R14 CMP RCX,RBP JNC 0x00101e10 CMP RCX,0x4 JLE 0x00101e9b MOV RDX,RCX MOV RSI,R12 MOV RDI,R14 MOV qword ptr [RSP + 0x18],R8 MOV qword ptr [RSP + 0x10],RCX CALL 0x001011d0 MOV RDX,qword ptr [RBX + 0x8] MOV R12,qword ptr [RBX] MOV RCX,qword ptr [RSP + 0x10] MOV R8,qword ptr [RSP + 0x18] LAB_00101cb9: LEA RSI,[R12 + RCX*0x1] SUB RDX,RSI CMP RDX,0x4 JLE 0x00101e8b MOV RDI,R8 CALL 0x001011d0 LAB_00101cd2: ADD RBP,R14 MOV qword ptr [RSP + 0x28],RBP NOP word ptr [RAX + RAX*0x1] LAB_00101ce0: ADD RBX,0x18 CMP R15,RBX JNZ 0x00101c3d LAB_00101ced: MOV RAX,qword ptr [RSP + 0x8] MOV RBX,qword ptr [RSP + 0x28] PXOR XMM0,XMM0 MOV dword ptr [RAX],R13D MOV qword ptr [RAX + 0x18],0x0 MOVUPS xmmword ptr [RAX + 0x8],XMM0 SUB RBX,R14 JZ 0x00101e30 MOV RAX,0x7ffffffffffffffc CMP RAX,RBX JC 0x00101ead MOV RDI,RBX LAB_00101d29: CALL 0x00101190 MOV R15,qword ptr [RSP + 0x8] MOVQ XMM0,RAX LEA RBP,[RAX + RBX*0x1] MOV RDI,RAX PUNPCKLQDQ XMM0,XMM0 MOV R12,qword ptr [RSP + 0x30] MOV qword ptr [R15 + 0x18],RBP MOVUPS xmmword ptr [R15 + 0x8],XMM0 CMP RBX,0x4 JLE 0x00101ef4 MOV RDX,RBX MOV RSI,R14 CALL 0x00101180 MOV qword ptr [R15 + 0x10],RBP LAB_00101d6a: MOV RSI,R12 SUB RSI,R14 LAB_00101d70: MOV RDI,R14 CALL 0x001011a0 LAB_00101d78: MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101f0d MOV RAX,qword ptr [RSP + 0x8] ADD RSP,0x48 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101da0: MOV RAX,0x7ffffffffffffffc CMP RAX,RBP JC 0x00101edf MOV RDI,RBP CALL 0x00101190 MOV RCX,RAX CMP RBP,0x4 JZ 0x00101ec2 MOV RDX,RBP MOV RSI,R12 MOV RDI,RAX CALL 0x001011d0 MOV RCX,RAX LAB_00101dd9: TEST R14,R14 JZ 0x00101df5 MOV RSI,qword ptr [RSP + 0x10] MOV RDI,R14 MOV qword ptr [RSP + 0x18],RCX CALL 0x001011a0 MOV RCX,qword ptr [RSP + 0x18] LAB_00101df5: ADD RBP,RCX MOV qword ptr [RSP + 0x20],RCX MOV R14,RCX MOV qword ptr [RSP + 0x30],RBP MOV qword ptr [RSP + 0x28],RBP JMP 0x00101ce0 LAB_00101e10: CMP RBP,0x4 JLE 0x00101ecd MOV RDX,RBP MOV RSI,R12 MOV RDI,R14 CALL 0x001011d0 JMP 0x00101cd2 LAB_00101e30: MOV qword ptr [RAX + 0x8],0x0 XOR EBP,EBP MOV qword ptr [RAX + 0x18],0x0 LAB_00101e42: MOV RAX,qword ptr [RSP + 0x8] MOV qword ptr [RAX + 0x10],RBP TEST R14,R14 JZ 0x00101d78 MOV RSI,qword ptr [RSP + 0x30] SUB RSI,R14 JMP 0x00101d70 LAB_00101e68: MOV dword ptr [RDI],0x0 MOV qword ptr [RDI + 0x8],0x0 MOV qword ptr [RDI + 0x10],0x0 MOV qword ptr [RDI + 0x18],0x0 JMP 0x00101d78 LAB_00101e8b: JNZ 0x00101cd2 MOV EAX,dword ptr [RSI] MOV dword ptr [R8],EAX JMP 0x00101cd2 LAB_00101e9b: JNZ 0x00101cb9 MOV EAX,dword ptr [R12] MOV dword ptr [R14],EAX JMP 0x00101cb9 LAB_00101ead: MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101f0d CALL 0x00101170 LAB_00101ec2: MOV EAX,dword ptr [R12] MOV dword ptr [RCX],EAX JMP 0x00101dd9 LAB_00101ecd: JNZ 0x00101cd2 MOV EAX,dword ptr [R12] MOV dword ptr [R14],EAX JMP 0x00101cd2 LAB_00101edf: MOV RAX,qword ptr [RSP + 0x38] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101f0d CALL 0x00101170 LAB_00101ef4: JNZ 0x00101e42 MOV EAX,dword ptr [R14] MOV dword ptr [RDI],EAX MOV RAX,qword ptr [RSP + 0x8] MOV qword ptr [RAX + 0x10],RBP JMP 0x00101d6a LAB_00101f0d: CALL 0x001011b0
/* 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; vector *pvVar2; long lVar3; int iVar4; vector *__dest; vector *__dest_00; long lVar5; size_t __n; vector *__n_00; vector *__n_01; int8 *in_RSI; ulong uVar6; vector *__dest_01; vector *__src; long in_FS_OFFSET; int uVar7; vector *local_68; vector *pvStack_50; vector *local_48; __dest_01 = (vector *)0x0; iVar4 = 0; __n_00 = (vector *)*in_RSI; pvVar2 = (vector *)in_RSI[1]; lVar3 = *(long *)(in_FS_OFFSET + 0x28); pvStack_50 = (vector *)0x0; local_48 = (vector *)0x0; __dest = param_1; if (pvVar2 != __n_00) { do { lVar5 = *(long *)(__n_00 + 8); __src = *(vector **)__n_00; __dest_00 = (vector *)(long)iVar4; __n_01 = (vector *)(lVar5 - (long)__src); pvVar1 = __src; if (__dest_00 < (vector *)((long)__n_01 >> 2)) { iVar4 = (int)(vector *)((long)__n_01 >> 2); local_68 = local_48 + -(long)__dest_01; if (local_68 < __n_01) goto LAB_00101da0; __dest_00 = pvStack_50 + -(long)__dest_01; if (__dest_00 < __n_01) { if ((long)__dest_00 < 5) { if (__dest_00 == (vector *)0x4) { *(int4 *)__dest_01 = *(int4 *)__src; } } else { __dest = __dest_01; memmove(__dest_01,__src,(size_t)__dest_00); lVar5 = *(long *)(__n_00 + 8); __src = *(vector **)__n_00; local_68 = __dest_00; } pvVar1 = __src + (long)__dest_00; __n = lVar5 - (long)pvVar1; if ((long)__n < 5) { if (__n == 4) { *(int4 *)pvStack_50 = *(int4 *)pvVar1; } } else { memmove(pvStack_50,pvVar1,__n); __dest = pvStack_50; } } else if ((long)__n_01 < 5) { if (__n_01 == (vector *)0x4) { *(int4 *)__dest_01 = *(int4 *)__src; } } else { __dest = __dest_01; memmove(__dest_01,__src,(size_t)__n_01); } __n_01 = __n_01 + (long)__dest_01; pvVar1 = __src; pvStack_50 = __n_01; } while (__src = local_48, __n_00 = __n_00 + 0x18, local_48 = __src, pvVar2 == __n_00) { *(int *)param_1 = iVar4; *(int8 *)(param_1 + 0x18) = 0; *(int (*) [16])(param_1 + 8) = (int [16])0x0; __n_00 = pvStack_50 + -(long)__dest_01; if (__n_00 == (vector *)0x0) { *(int8 *)(param_1 + 8) = 0; __n_01 = (vector *)0x0; *(int8 *)(param_1 + 0x18) = 0; goto LAB_00101e42; } if (__n_00 < (vector *)0x7ffffffffffffffd) { /* try { // try from 00101d29 to 00101ef3 has its CatchHandler @ 00101f12 */ __dest = (vector *)operator_new((ulong)__n_00); __n_01 = __dest + (long)__n_00; *(vector **)(param_1 + 0x18) = __n_01; *(vector **)(param_1 + 8) = __dest; *(vector **)(param_1 + 0x10) = __dest; uVar7 = __n_00 == (vector *)0x4; if ((long)__n_00 < 5) goto LAB_00101ef4; memcpy(__dest,__dest_01,(size_t)__n_00); *(vector **)(param_1 + 0x10) = __n_01; goto LAB_00101d6a; } if (lVar3 != *(long *)(in_FS_OFFSET + 0x28)) goto LAB_00101f0d; std::__throw_bad_array_new_length(); __src = pvVar1; LAB_00101ec2: *(int4 *)__dest_00 = *(int4 *)__src; LAB_00101dd9: if (__dest_01 != (vector *)0x0) { operator_delete(__dest_01,(ulong)local_68); __dest = __dest_01; } __n_01 = __n_01 + (long)__dest_00; pvVar1 = __src; __dest_01 = __dest_00; local_48 = __n_01; pvStack_50 = __n_01; } } while( true ); } *(int4 *)param_1 = 0; *(int8 *)(param_1 + 8) = 0; *(int8 *)(param_1 + 0x10) = 0; *(int8 *)(param_1 + 0x18) = 0; LAB_00101d78: if (lVar3 == *(long *)(in_FS_OFFSET + 0x28)) { return param_1; } LAB_00101f0d: /* WARNING: Subroutine does not return */ __stack_chk_fail(); LAB_00101da0: if (__n_01 < (vector *)0x7ffffffffffffffd) { __dest = __n_01; __dest_00 = (vector *)operator_new((ulong)__n_01); if (__n_01 == (vector *)0x4) goto LAB_00101ec2; __dest = __dest_00; __dest_00 = (vector *)memmove(__dest_00,__src,(size_t)__n_01); goto LAB_00101dd9; } uVar7 = lVar3 == *(long *)(in_FS_OFFSET + 0x28); if (!(bool)uVar7) goto LAB_00101f0d; std::__throw_bad_array_new_length(); LAB_00101ef4: if ((bool)uVar7) { *(int4 *)__dest = *(int4 *)__dest_01; *(vector **)(param_1 + 0x10) = __n_01; LAB_00101d6a: uVar6 = (long)__src - (long)__dest_01; } else { LAB_00101e42: *(vector **)(param_1 + 0x10) = __n_01; if (__dest_01 == (vector *)0x0) goto LAB_00101d78; uVar6 = (long)local_48 - (long)__dest_01; } operator_delete(__dest_01,uVar6); goto LAB_00101d78; }
1,160
func0
#include <vector> #include <cassert>
int func0(int n, int k) { if (n == 0) return 0; std::vector<int> dp(n + 1, 0); int mod = 1000000007; dp[1] = k; if (n > 1) dp[2] = k * k; for (int i = 3; i <= n; ++i) { dp[i] = ((k - 1) * (dp[i - 1] + dp[i - 2])) % mod; } return dp[n]; }
int main() { assert(func0(2, 4) == 16); assert(func0(3, 2) == 6); assert(func0(4, 4) == 228); return 0; }
O0
cpp
func0(int, int): endbr64 push %rbp mov %rsp,%rbp push %r12 push %rbx sub $0x40,%rsp mov %edi,-0x44(%rbp) mov %esi,-0x48(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax cmpl $0x0,-0x44(%rbp) jne 123d <_Z5func0ii+0x34> mov $0x0,%ebx jmpq 134d <_Z5func0ii+0x144> lea -0x3d(%rbp),%rax mov %rax,%rdi callq 1436 <_ZNSaIiEC1Ev> movl $0x0,-0x3c(%rbp) mov -0x44(%rbp),%eax add $0x1,%eax movslq %eax,%rsi lea -0x3d(%rbp),%rcx lea -0x3c(%rbp),%rdx lea -0x30(%rbp),%rax mov %rax,%rdi callq 1476 <_ZNSt6vectorIiSaIiEEC1EmRKiRKS0_> lea -0x3d(%rbp),%rax mov %rax,%rdi callq 1456 <_ZNSaIiED1Ev> movl $0x3b9aca07,-0x34(%rbp) mov -0x48(%rbp),%ebx lea -0x30(%rbp),%rax mov $0x1,%esi mov %rax,%rdi callq 1546 <_ZNSt6vectorIiSaIiEEixEm> mov %ebx,(%rax) cmpl $0x1,-0x44(%rbp) jle 12b7 <_Z5func0ii+0xae> mov -0x48(%rbp),%eax imul %eax,%eax mov %eax,%ebx lea -0x30(%rbp),%rax mov $0x2,%esi mov %rax,%rdi callq 1546 <_ZNSt6vectorIiSaIiEEixEm> mov %ebx,(%rax) movl $0x3,-0x38(%rbp) mov -0x38(%rbp),%eax cmp -0x44(%rbp),%eax jg 132a <_Z5func0ii+0x121> mov -0x48(%rbp),%eax lea -0x1(%rax),%r12d mov -0x38(%rbp),%eax sub $0x1,%eax movslq %eax,%rdx lea -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1546 <_ZNSt6vectorIiSaIiEEixEm> mov (%rax),%ebx mov -0x38(%rbp),%eax sub $0x2,%eax movslq %eax,%rdx lea -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1546 <_ZNSt6vectorIiSaIiEEixEm> mov (%rax),%eax add %ebx,%eax imul %r12d,%eax cltd idivl -0x34(%rbp) mov %edx,%ebx mov -0x38(%rbp),%eax movslq %eax,%rdx lea -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1546 <_ZNSt6vectorIiSaIiEEixEm> mov %ebx,(%rax) addl $0x1,-0x38(%rbp) jmp 12be <_Z5func0ii+0xb5> mov -0x44(%rbp),%eax movslq %eax,%rdx lea -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1546 <_ZNSt6vectorIiSaIiEEixEm> mov (%rax),%ebx lea -0x30(%rbp),%rax mov %rax,%rdi callq 14fe <_ZNSt6vectorIiSaIiEED1Ev> mov %ebx,%eax mov -0x18(%rbp),%rcx xor %fs:0x28,%rcx je 1383 <_Z5func0ii+0x17a> jmp 137e <_Z5func0ii+0x175> endbr64 mov %rax,%rbx lea -0x3d(%rbp),%rax mov %rax,%rdi callq 1456 <_ZNSaIiED1Ev> mov %rbx,%rax mov %rax,%rdi callq 1110 <_Unwind_Resume@plt> callq 1100 <__stack_chk_fail@plt> add $0x40,%rsp pop %rbx pop %r12 pop %rbp retq
_Z5func0ii: endbr64 push rbp mov rbp, rsp push r12 push rbx sub rsp, 50h mov [rbp+var_54], edi mov [rbp+var_58], esi mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax cmp [rbp+var_54], 0 jnz short loc_125D mov ebx, 0 jmp loc_136C loc_125D: lea rax, [rbp+var_45] mov [rbp+var_38], rax nop nop mov [rbp+var_44], 0 mov eax, [rbp+var_54] add eax, 1 movsxd rsi, eax lea rcx, [rbp+var_45] lea rdx, [rbp+var_44] lea rax, [rbp+var_30] mov rdi, rax call _ZNSt6vectorIiSaIiEEC2EmRKiRKS0_; std::vector<int>::vector(ulong,int const&,std::allocator<int> const&) lea rax, [rbp+var_45] mov rdi, rax call _ZNSt15__new_allocatorIiED2Ev; std::__new_allocator<int>::~__new_allocator() nop mov [rbp+var_3C], 3B9ACA07h mov ebx, [rbp+var_58] lea rax, [rbp+var_30] mov esi, 1 mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov [rax], ebx cmp [rbp+var_54], 1 jle short loc_12D6 mov eax, [rbp+var_58] imul eax, eax mov ebx, eax lea rax, [rbp+var_30] mov esi, 2 mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov [rax], ebx loc_12D6: mov [rbp+var_40], 3 jmp short loc_1341 loc_12DF: mov eax, [rbp+var_58] lea ebx, [rax-1] mov eax, [rbp+var_40] sub eax, 1 movsxd rdx, eax lea rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov r12d, [rax] mov eax, [rbp+var_40] sub eax, 2 movsxd rdx, eax lea rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov eax, [rax] add eax, r12d imul eax, ebx cdq idiv [rbp+var_3C] mov ebx, edx mov eax, [rbp+var_40] movsxd rdx, eax lea rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov [rax], ebx add [rbp+var_40], 1 loc_1341: mov eax, [rbp+var_40] cmp eax, [rbp+var_54] jle short loc_12DF mov eax, [rbp+var_54] movsxd rdx, eax lea rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEEixEm; std::vector<int>::operator[](ulong) mov ebx, [rax] lea rax, [rbp+var_30] mov rdi, rax call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() loc_136C: mov eax, ebx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_13B7 jmp short loc_13B2 endbr64 mov rbx, rax lea rax, [rbp+var_45] mov rdi, rax call _ZNSt15__new_allocatorIiED2Ev; std::__new_allocator<int>::~__new_allocator() nop mov rax, rbx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_13AA call ___stack_chk_fail loc_13AA: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_13B2: call ___stack_chk_fail loc_13B7: add rsp, 50h pop rbx pop r12 pop rbp retn
long long func0(int a1, int a2) { unsigned int v2; // ebx int v3; // r12d _DWORD *v4; // rax int v5; // ebx char v7; // [rsp+1Bh] [rbp-45h] BYREF int v8; // [rsp+1Ch] [rbp-44h] BYREF int i; // [rsp+20h] [rbp-40h] int v10; // [rsp+24h] [rbp-3Ch] char *v11; // [rsp+28h] [rbp-38h] _BYTE v12[24]; // [rsp+30h] [rbp-30h] BYREF unsigned long long v13; // [rsp+48h] [rbp-18h] v13 = __readfsqword(0x28u); if ( a1 ) { v11 = &v7; v8 = 0; std::vector<int>::vector(v12, a1 + 1, &v8, &v7); std::__new_allocator<int>::~__new_allocator(&v7); v10 = 1000000007; *(_DWORD *)std::vector<int>::operator[](v12, 1LL) = a2; if ( a1 > 1 ) *(_DWORD *)std::vector<int>::operator[](v12, 2LL) = a2 * a2; for ( i = 3; i <= a1; ++i ) { v3 = *(_DWORD *)std::vector<int>::operator[](v12, i - 1); v4 = (_DWORD *)std::vector<int>::operator[](v12, i - 2); v5 = (a2 - 1) * (v3 + *v4) % v10; *(_DWORD *)std::vector<int>::operator[](v12, i) = v5; } v2 = *(_DWORD *)std::vector<int>::operator[](v12, a1); std::vector<int>::~vector(v12); } else { return 0; } return v2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH R12 PUSH RBX SUB RSP,0x50 MOV dword ptr [RBP + -0x54],EDI MOV dword ptr [RBP + -0x58],ESI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX CMP dword ptr [RBP + -0x54],0x0 JNZ 0x0010125d MOV EBX,0x0 JMP 0x0010136c LAB_0010125d: LEA RAX,[RBP + -0x45] MOV qword ptr [RBP + -0x38],RAX NOP NOP MOV dword ptr [RBP + -0x44],0x0 MOV EAX,dword ptr [RBP + -0x54] ADD EAX,0x1 MOVSXD RSI,EAX LEA RCX,[RBP + -0x45] LEA RDX,[RBP + -0x44] LEA RAX,[RBP + -0x30] MOV RDI,RAX LAB_00101286: CALL 0x00101498 LEA RAX,[RBP + -0x45] MOV RDI,RAX CALL 0x0010159c NOP MOV dword ptr [RBP + -0x3c],0x3b9aca07 MOV EBX,dword ptr [RBP + -0x58] LEA RAX,[RBP + -0x30] MOV ESI,0x1 MOV RDI,RAX CALL 0x00101578 MOV dword ptr [RAX],EBX CMP dword ptr [RBP + -0x54],0x1 JLE 0x001012d6 MOV EAX,dword ptr [RBP + -0x58] IMUL EAX,EAX MOV EBX,EAX LEA RAX,[RBP + -0x30] MOV ESI,0x2 MOV RDI,RAX CALL 0x00101578 MOV dword ptr [RAX],EBX LAB_001012d6: MOV dword ptr [RBP + -0x40],0x3 JMP 0x00101341 LAB_001012df: MOV EAX,dword ptr [RBP + -0x58] LEA EBX,[RAX + -0x1] MOV EAX,dword ptr [RBP + -0x40] SUB EAX,0x1 MOVSXD RDX,EAX LEA RAX,[RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00101578 MOV R12D,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x40] SUB EAX,0x2 MOVSXD RDX,EAX LEA RAX,[RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00101578 MOV EAX,dword ptr [RAX] ADD EAX,R12D IMUL EAX,EBX CDQ IDIV dword ptr [RBP + -0x3c] MOV EBX,EDX MOV EAX,dword ptr [RBP + -0x40] MOVSXD RDX,EAX LEA RAX,[RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00101578 MOV dword ptr [RAX],EBX ADD dword ptr [RBP + -0x40],0x1 LAB_00101341: MOV EAX,dword ptr [RBP + -0x40] CMP EAX,dword ptr [RBP + -0x54] JLE 0x001012df MOV EAX,dword ptr [RBP + -0x54] MOVSXD RDX,EAX LEA RAX,[RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x00101578 MOV EBX,dword ptr [RAX] LEA RAX,[RBP + -0x30] MOV RDI,RAX CALL 0x0010151e LAB_0010136c: MOV EAX,EBX MOV RDX,qword ptr [RBP + -0x18] SUB RDX,qword ptr FS:[0x28] JZ 0x001013b7 JMP 0x001013b2 LAB_001013b2: CALL 0x00101120 LAB_001013b7: ADD RSP,0x50 POP RBX POP R12 POP RBP RET
/* func0(int, int) */ int4 func0(int param_1,int param_2) { int *piVar1; int4 *puVar2; int iVar3; int4 uVar4; long in_FS_OFFSET; allocator local_4d; int local_4c; int local_48; int local_44; allocator *local_40; vector<int,std::allocator<int>> local_38 [24]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); if (param_1 == 0) { uVar4 = 0; } else { local_40 = &local_4d; local_4c = 0; /* try { // try from 00101286 to 0010128a has its CatchHandler @ 0010137f */ std::vector<int,std::allocator<int>>::vector(local_38,(long)(param_1 + 1),&local_4c,&local_4d); std::__new_allocator<int>::~__new_allocator((__new_allocator<int> *)&local_4d); local_44 = 0x3b9aca07; piVar1 = (int *)std::vector<int,std::allocator<int>>::operator[](local_38,1); *piVar1 = param_2; if (1 < param_1) { piVar1 = (int *)std::vector<int,std::allocator<int>>::operator[](local_38,2); *piVar1 = param_2 * param_2; } for (local_48 = 3; local_48 <= param_1; local_48 = local_48 + 1) { piVar1 = (int *)std::vector<int,std::allocator<int>>::operator[] (local_38,(long)(local_48 + -1)); iVar3 = *piVar1; piVar1 = (int *)std::vector<int,std::allocator<int>>::operator[] (local_38,(long)(local_48 + -2)); iVar3 = ((*piVar1 + iVar3) * (param_2 + -1)) % local_44; piVar1 = (int *)std::vector<int,std::allocator<int>>::operator[](local_38,(long)local_48); *piVar1 = iVar3; } puVar2 = (int4 *)std::vector<int,std::allocator<int>>::operator[](local_38,(long)param_1); uVar4 = *puVar2; std::vector<int,std::allocator<int>>::~vector(local_38); } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return uVar4; }
1,161
func0
#include <vector> #include <cassert>
int func0(int n, int k) { if (n == 0) return 0; std::vector<int> dp(n + 1, 0); int mod = 1000000007; dp[1] = k; if (n > 1) dp[2] = k * k; for (int i = 3; i <= n; ++i) { dp[i] = ((k - 1) * (dp[i - 1] + dp[i - 2])) % mod; } return dp[n]; }
int main() { assert(func0(2, 4) == 16); assert(func0(3, 2) == 6); assert(func0(4, 4) == 228); return 0; }
O1
cpp
func0(int, int): endbr64 push %r12 push %rbp push %rbx mov %edi,%ebx test %edi,%edi jne 11be <_Z5func0ii+0x15> mov %ebx,%eax pop %rbx pop %rbp pop %r12 retq mov %esi,%ebp lea 0x1(%rdi),%ecx movslq %ecx,%rcx movabs $0x1fffffffffffffff,%rax cmp %rax,%rcx ja 1270 <_Z5func0ii+0xc7> test %rcx,%rcx je 127c <_Z5func0ii+0xd3> lea 0x0(,%rcx,4),%r12 mov %r12,%rdi callq 10b0 <_Znwm@plt> mov %rax,%rdi lea (%rax,%r12,1),%rcx mov %rax,%rdx movl $0x0,(%rdx) add $0x4,%rdx cmp %rdx,%rcx jne 11fc <_Z5func0ii+0x53> mov %ebp,0x4(%rdi) cmp $0x1,%ebx jle 121b <_Z5func0ii+0x72> mov %ebp,%eax imul %ebp,%eax mov %eax,0x8(%rdi) cmp $0x2,%ebx jle 1260 <_Z5func0ii+0xb7> lea 0x4(%rdi),%rsi lea -0x3(%rbx),%eax lea 0x8(%rdi,%rax,4),%r8 sub $0x1,%ebp mov (%rsi),%edx add 0x4(%rsi),%edx imul %ebp,%edx movslq %edx,%rcx imul $0x44b82f99,%rcx,%rcx sar $0x3c,%rcx mov %edx,%eax sar $0x1f,%eax sub %eax,%ecx imul $0x3b9aca07,%ecx,%ecx sub %ecx,%edx mov %edx,0x8(%rsi) add $0x4,%rsi cmp %r8,%rsi jne 122f <_Z5func0ii+0x86> movslq %ebx,%rbx mov (%rdi,%rbx,4),%ebx callq 10a0 <_ZdlPv@plt> jmpq 11b7 <_Z5func0ii+0xe> lea 0xd91(%rip),%rdi callq 1080 <_ZSt20__throw_length_errorPKc@plt> mov %esi,0x4 mov $0x0,%edi jmp 1260 <_Z5func0ii+0xb7>
_Z5func0ii: endbr64 push r12 push rbp push rbx mov ebx, edi test edi, edi jnz short loc_11BE loc_11B7: mov eax, ebx pop rbx pop rbp pop r12 retn loc_11BE: mov r12d, esi lea ebp, [rdi+1] movsxd rbp, ebp mov rax, rbp shr rax, 3Dh jnz loc_126F test rbp, rbp jz loc_127B shl rbp, 2 mov rdi, rbp; unsigned __int64 call __Znwm; operator new(ulong) mov rdi, rax; void * lea rdx, [rax+rbp] loc_11F0: mov dword ptr [rax], 0 add rax, 4 cmp rax, rdx jnz short loc_11F0 mov [rdi+4], r12d cmp ebx, 1 jle short loc_125C mov eax, r12d imul eax, r12d mov [rdi+8], eax cmp ebx, 2 jle short loc_125C lea rcx, [rdi+4] lea eax, [rbx-3] lea rsi, [rdi+rax*4+8] sub r12d, 1 loc_1227: mov eax, [rcx] add eax, [rcx+4] imul eax, r12d movsxd rdx, eax imul rdx, 44B82F99h sar rdx, 3Ch mov r8d, eax sar r8d, 1Fh sub edx, r8d imul edx, 3B9ACA07h sub eax, edx mov [rcx+8], eax add rcx, 4 cmp rsi, rcx jnz short loc_1227 loc_125C: movsxd rbx, ebx mov ebx, [rdi+rbx*4] mov rsi, rbp; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) jmp loc_11B7 loc_126F: lea rdi, aCannotCreateSt; "cannot create std::vector larger than m"... call __ZSt20__throw_length_errorPKc; std::__throw_length_error(char const*) loc_127B: mov dword ptr ds:byte_4, esi mov edi, 0 jmp short loc_125C
// write access to const memory has been detected, the output may be wrong! long long func0(int a1, int a2) { int v2; // ebx unsigned long long v4; // rbp _DWORD *v5; // rax _DWORD *v6; // rdi _DWORD *v7; // rdx _DWORD *v8; // rcx v2 = a1; if ( a1 ) { v4 = a1 + 1; if ( v4 >> 61 ) std::__throw_length_error("cannot create std::vector larger than max_size()"); if ( a1 == -1 ) { *(_DWORD *)&byte_4 = a2; v6 = 0LL; } else { v4 *= 4LL; v5 = (_DWORD *)operator new(v4); v6 = v5; v7 = (_DWORD *)((char *)v5 + v4); do *v5++ = 0; while ( v5 != v7 ); v6[1] = a2; if ( v2 > 1 ) { v6[2] = a2 * a2; if ( v2 > 2 ) { v8 = v6 + 1; do { v8[2] = (a2 - 1) * (v8[1] + *v8) % 1000000007; ++v8; } while ( &v6[v2 - 3 + 2] != v8 ); } } } v2 = v6[v2]; operator delete(v6, v4); } return (unsigned int)v2; }
func0: ENDBR64 PUSH R12 PUSH RBP PUSH RBX MOV EBX,EDI TEST EDI,EDI JNZ 0x001011be LAB_001011b7: MOV EAX,EBX POP RBX POP RBP POP R12 RET LAB_001011be: MOV R12D,ESI LEA EBP,[RDI + 0x1] MOVSXD RBP,EBP MOV RAX,RBP SHR RAX,0x3d JNZ 0x0010126f TEST RBP,RBP JZ 0x0010127b SHL RBP,0x2 MOV RDI,RBP CALL 0x001010a0 MOV RDI,RAX LEA RDX,[RAX + RBP*0x1] LAB_001011f0: MOV dword ptr [RAX],0x0 ADD RAX,0x4 CMP RAX,RDX JNZ 0x001011f0 MOV dword ptr [RDI + 0x4],R12D CMP EBX,0x1 JLE 0x0010125c MOV EAX,R12D IMUL EAX,R12D MOV dword ptr [RDI + 0x8],EAX CMP EBX,0x2 JLE 0x0010125c LEA RCX,[RDI + 0x4] LEA EAX,[RBX + -0x3] LEA RSI,[RDI + RAX*0x4 + 0x8] SUB R12D,0x1 LAB_00101227: MOV EAX,dword ptr [RCX] ADD EAX,dword ptr [RCX + 0x4] IMUL EAX,R12D MOVSXD RDX,EAX IMUL RDX,RDX,0x44b82f99 SAR RDX,0x3c MOV R8D,EAX SAR R8D,0x1f SUB EDX,R8D IMUL EDX,EDX,0x3b9aca07 SUB EAX,EDX MOV dword ptr [RCX + 0x8],EAX ADD RCX,0x4 CMP RSI,RCX JNZ 0x00101227 LAB_0010125c: MOVSXD RBX,EBX MOV EBX,dword ptr [RDI + RBX*0x4] MOV RSI,RBP CALL 0x001010b0 JMP 0x001011b7 LAB_0010126f: LEA RDI,[0x102008] CALL 0x00101080 LAB_0010127b: MOV dword ptr [0x00000004],ESI MOV EDI,0x0 JMP 0x0010125c
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ /* func0(int, int) */ int4 func0(int param_1,int param_2) { int4 uVar1; int4 *puVar2; int4 *puVar3; int *piVar4; ulong uVar5; ulong uVar6; if (param_1 == 0) { return 0; } uVar5 = (ulong)(param_1 + 1); if (uVar5 >> 0x3d == 0) { if (uVar5 != 0) { uVar6 = uVar5 * 4; puVar2 = (int4 *)operator_new(uVar6); puVar3 = puVar2; do { *puVar3 = 0; puVar3 = puVar3 + 1; } while (puVar3 != puVar2 + uVar5); puVar2[1] = param_2; uVar5 = uVar6; if ((1 < param_1) && (puVar2[2] = param_2 * param_2, 2 < param_1)) { piVar4 = puVar2 + 1; do { piVar4[2] = ((*piVar4 + piVar4[1]) * (param_2 + -1)) % 0x3b9aca07; piVar4 = piVar4 + 1; } while (puVar2 + (ulong)(param_1 - 3) + 2 != piVar4); } goto LAB_0010125c; } } else { std::__throw_length_error("cannot create std::vector larger than max_size()"); } puVar2 = (int4 *)0x0; _DAT_00000004 = param_2; LAB_0010125c: uVar1 = puVar2[param_1]; operator_delete(puVar2,uVar5); return uVar1; }
1,162
func0
#include <vector> #include <cassert>
int func0(int n, int k) { if (n == 0) return 0; std::vector<int> dp(n + 1, 0); int mod = 1000000007; dp[1] = k; if (n > 1) dp[2] = k * k; for (int i = 3; i <= n; ++i) { dp[i] = ((k - 1) * (dp[i - 1] + dp[i - 2])) % mod; } return dp[n]; }
int main() { assert(func0(2, 4) == 16); assert(func0(3, 2) == 6); assert(func0(4, 4) == 228); return 0; }
O2
cpp
func0(int, int) [clone .part.0]: movabs $0x1fffffffffffffff,%rax push %r12 push %rbp push %rbx lea 0x1(%rdi),%ebx movslq %ebx,%rbx cmp %rax,%rbx ja 133d <_Z5func0ii.part.0+0xdd> test %rbx,%rbx je 1330 <_Z5func0ii.part.0+0xd0> shl $0x2,%rbx mov %edi,%ebp mov %esi,%r12d mov %rbx,%rdi callq 10b0 <_Znwm@plt> mov %rax,%rdi lea (%rax,%rbx,1),%rax mov %rdi,%rdx nopl 0x0(%rax) movl $0x0,(%rdx) add $0x4,%rdx cmp %rdx,%rax jne 12a8 <_Z5func0ii.part.0+0x48> mov %r12d,0x4(%rdi) cmp $0x1,%ebp jle 1315 <_Z5func0ii.part.0+0xb5> mov %r12d,%eax imul %r12d,%eax mov %eax,0x8(%rdi) cmp $0x2,%ebp jle 1315 <_Z5func0ii.part.0+0xb5> lea -0x3(%rbp),%eax lea -0x1(%r12),%r9d lea 0x4(%rdi),%rsi lea 0x8(%rdi,%rax,4),%rax mov (%rsi),%edx add 0x4(%rsi),%edx add $0x4,%rsi imul %r9d,%edx movslq %edx,%rcx mov %edx,%r8d imul $0x44b82f99,%rcx,%rcx sar $0x1f,%r8d sar $0x3c,%rcx sub %r8d,%ecx imul $0x3b9aca07,%ecx,%ecx sub %ecx,%edx mov %edx,0x4(%rsi) cmp %rsi,%rax jne 12e0 <_Z5func0ii.part.0+0x80> mov -0x4(%rdi,%rbx,1),%r12d callq 10a0 <_ZdlPv@plt> pop %rbx pop %rbp mov %r12d,%eax pop %r12 retq nopw 0x0(%rax,%rax,1) movl $0x0,0x4 ud2 lea 0xcc4(%rip),%rdi callq 1080 <_ZSt20__throw_length_errorPKc@plt> nopl 0x0(%rax)
_Z5func0ii_part_0: push r12 push rbp lea ebp, [rdi+1] movsxd rbp, ebp push rbx mov rax, rbp shr rax, 3Dh jnz loc_134D test rbp, rbp jz loc_1340 shl rbp, 2 mov r12d, edi mov ebx, esi mov rdi, rbp; unsigned __int64 call __Znwm; operator new(ulong) mov rdx, rbp; n xor esi, esi; c mov rdi, rax; s call _memset mov [rax+4], ebx mov rdi, rax; void * cmp r12d, 1 jz short loc_1324 mov eax, ebx imul eax, ebx mov [rdi+8], eax cmp r12d, 2 jz short loc_1324 lea edx, [r12-3] lea r9d, [rbx-1] lea rcx, [rdi+0Ch] lea r8, [rdi+rdx*4+10h] nop word ptr [rax+rax+00h] loc_12F0: lea edx, [rbx+rax] mov ebx, eax add rcx, 4 imul edx, r9d movsxd rax, edx mov esi, edx imul rax, 44B82F99h sar esi, 1Fh sar rax, 3Ch sub eax, esi imul esi, eax, 3B9ACA07h mov eax, edx sub eax, esi mov [rcx-4], eax cmp r8, rcx jnz short loc_12F0 loc_1324: mov ebx, [rdi+rbp-4] mov rsi, rbp; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) mov eax, ebx pop rbx pop rbp pop r12 retn loc_1340: mov dword ptr ds:byte_4, 0 ud2 loc_134D: lea rdi, aCannotCreateSt; "cannot create std::vector larger than m"... call __ZSt20__throw_length_errorPKc; std::__throw_length_error(char const*)
// write access to const memory has been detected, the output may be wrong! long long func0(int a1, int a2) { unsigned long long v2; // rbp int v4; // ebx void *v5; // rax _DWORD *v6; // rax _DWORD *v7; // rdi int v8; // eax _DWORD *v9; // rcx int v10; // edx unsigned int v11; // ebx if ( (unsigned long long)(a1 + 1) >> 61 ) std::__throw_length_error("cannot create std::vector larger than max_size()"); if ( a1 == -1 ) { *(_DWORD *)&byte_4 = 0; BUG(); } v2 = 4LL * (a1 + 1); v4 = a2; v5 = (void *)operator new(v2); v6 = memset(v5, 0, v2); v6[1] = a2; v7 = v6; if ( a1 != 1 ) { v8 = a2 * a2; v7[2] = a2 * a2; if ( a1 != 2 ) { v9 = v7 + 3; do { v10 = v4 + v8; v4 = v8; ++v9; v8 = (a2 - 1) * v10 % 1000000007; *(v9 - 1) = v8; } while ( &v7[a1 - 3 + 4] != v9 ); } } v11 = v7[v2 / 4 - 1]; operator delete(v7, v2); return v11; }
func0: PUSH R12 PUSH RBP LEA EBP,[RDI + 0x1] MOVSXD RBP,EBP PUSH RBX MOV RAX,RBP SHR RAX,0x3d JNZ 0x0010134d TEST RBP,RBP JZ 0x00101340 SHL RBP,0x2 MOV R12D,EDI MOV EBX,ESI MOV RDI,RBP CALL 0x001010c0 MOV RDX,RBP XOR ESI,ESI MOV RDI,RAX CALL 0x001010a0 MOV dword ptr [RAX + 0x4],EBX MOV RDI,RAX CMP R12D,0x1 JZ 0x00101324 MOV EAX,EBX IMUL EAX,EBX MOV dword ptr [RDI + 0x8],EAX CMP R12D,0x2 JZ 0x00101324 LEA EDX,[R12 + -0x3] LEA R9D,[RBX + -0x1] LEA RCX,[RDI + 0xc] LEA R8,[RDI + RDX*0x4 + 0x10] NOP word ptr [RAX + RAX*0x1] LAB_001012f0: LEA EDX,[RBX + RAX*0x1] MOV EBX,EAX ADD RCX,0x4 IMUL EDX,R9D MOVSXD RAX,EDX MOV ESI,EDX IMUL RAX,RAX,0x44b82f99 SAR ESI,0x1f SAR RAX,0x3c SUB EAX,ESI IMUL ESI,EAX,0x3b9aca07 MOV EAX,EDX SUB EAX,ESI MOV dword ptr [RCX + -0x4],EAX CMP R8,RCX JNZ 0x001012f0 LAB_00101324: MOV EBX,dword ptr [RDI + RBP*0x1 + -0x4] MOV RSI,RBP CALL 0x001010d0 MOV EAX,EBX POP RBX POP RBP POP R12 RET LAB_00101340: MOV dword ptr [0x00000004],0x0 UD2 LAB_0010134d: LEA RDI,[0x102008] CALL 0x00101090 NOP dword ptr [RAX]
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ /* func0(int, int) [clone .part.0] */ ulong func0(int param_1,int param_2) { uint uVar1; code *pcVar2; int iVar3; int iVar4; void *pvVar5; int *piVar6; int *piVar7; int iVar8; ulong uVar9; uVar9 = (ulong)(param_1 + 1); if (uVar9 >> 0x3d != 0) { iVar4 = 0x102008; std::__throw_length_error("cannot create std::vector larger than max_size()"); if (iVar4 == 0) { return 0; } uVar9 = func0(iVar4,param_2); return uVar9; } if (uVar9 != 0) { uVar9 = uVar9 * 4; pvVar5 = operator_new(uVar9); pvVar5 = memset(pvVar5,0,uVar9); *(int *)((long)pvVar5 + 4) = param_2; if (param_1 != 1) { *(int *)((long)pvVar5 + 8) = param_2 * param_2; if (param_1 != 2) { piVar6 = (int *)((long)pvVar5 + 0xc); iVar4 = param_2 * param_2; iVar8 = param_2; do { iVar3 = iVar4; piVar7 = piVar6 + 1; iVar4 = ((iVar8 + iVar3) * (param_2 + -1)) % 0x3b9aca07; *piVar6 = iVar4; piVar6 = piVar7; iVar8 = iVar3; } while ((int *)((long)pvVar5 + (ulong)(param_1 - 3) * 4 + 0x10) != piVar7); } } uVar1 = *(uint *)((long)pvVar5 + (uVar9 - 4)); operator_delete(pvVar5,uVar9); return (ulong)uVar1; } _DAT_00000004 = 0; /* WARNING: Does not return */ pcVar2 = (code *)invalidInstructionException(); (*pcVar2)(); }
1,163
func0
#include <vector> #include <cassert>
int func0(int n, int k) { if (n == 0) return 0; std::vector<int> dp(n + 1, 0); int mod = 1000000007; dp[1] = k; if (n > 1) dp[2] = k * k; for (int i = 3; i <= n; ++i) { dp[i] = ((k - 1) * (dp[i - 1] + dp[i - 2])) % mod; } return dp[n]; }
int main() { assert(func0(2, 4) == 16); assert(func0(3, 2) == 6); assert(func0(4, 4) == 228); return 0; }
O3
cpp
func0(int, int) [clone .part.0]: movabs $0x1fffffffffffffff,%rax push %r12 push %rbp lea 0x1(%rdi),%ebp movslq %ebp,%rbp push %rbx cmp %rax,%rbp ja 13d4 <_Z5func0ii.part.0+0x154> test %rbp,%rbp je 13c0 <_Z5func0ii.part.0+0x140> shl $0x2,%rbp mov %edi,%ebx mov %esi,%r12d mov %rbp,%rdi callq 10d0 <_Znwm@plt> mov %rbp,%rdx xor %esi,%esi mov %rax,%rdi callq 10a0 <memset@plt> mov %r12d,0x4(%rax) mov %rax,%rdi cmp $0x1,%ebx jle 13a4 <_Z5func0ii.part.0+0x124> mov %r12d,%eax imul %r12d,%eax mov %eax,0x8(%rdi) cmp $0x2,%ebx jle 13a4 <_Z5func0ii.part.0+0x124> lea -0x1(%r12),%r8d cmp $0x4,%ebx jle 13cd <_Z5func0ii.part.0+0x14d> lea -0x5(%rbx),%edx mov $0x5,%r9d shr %edx lea 0x7(%rdx,%rdx,1),%r10 lea (%rax,%r12,1),%edx imul %r8d,%edx movslq %edx,%r12 mov %edx,%ecx imul $0x44b82f99,%r12,%r12 sar $0x1f,%ecx sar $0x3c,%r12 sub %ecx,%r12d imul $0x3b9aca07,%r12d,%r12d sub %r12d,%edx mov %edx,-0x8(%rdi,%r9,4) mov %edx,%r12d lea (%rdx,%rax,1),%edx imul %r8d,%edx movslq %edx,%rax mov %edx,%ecx imul $0x44b82f99,%rax,%rax sar $0x1f,%ecx sar $0x3c,%rax sub %ecx,%eax movslq %r9d,%rcx imul $0x3b9aca07,%eax,%eax sub %eax,%edx mov %edx,-0x4(%rdi,%r9,4) add $0x2,%r9 mov %edx,%eax cmp %r9,%r10 jne 1305 <_Z5func0ii.part.0+0x85> nopl 0x0(%rax) mov -0x4(%rdi,%rcx,4),%eax add -0x8(%rdi,%rcx,4),%eax imul %r8d,%eax movslq %eax,%rdx mov %eax,%esi imul $0x44b82f99,%rdx,%rdx sar $0x1f,%esi sar $0x3c,%rdx sub %esi,%edx imul $0x3b9aca07,%edx,%edx sub %edx,%eax mov %eax,(%rdi,%rcx,4) add $0x1,%rcx cmp %ecx,%ebx jge 1370 <_Z5func0ii.part.0+0xf0> mov -0x4(%rdi,%rbp,1),%r12d callq 10c0 <_ZdlPv@plt> pop %rbx pop %rbp mov %r12d,%eax pop %r12 retq nopw %cs:0x0(%rax,%rax,1) movl $0x0,0x4 ud2 mov $0x3,%ecx jmp 1370 <_Z5func0ii.part.0+0xf0> lea 0xc2d(%rip),%rdi callq 1090 <_ZSt20__throw_length_errorPKc@plt>
_Z5func0ii_part_0: push r12 push rbp lea ebp, [rdi+1] movsxd rbp, ebp push rbx mov rax, rbp shr rax, 3Dh jnz loc_13D4 test rbp, rbp jz loc_13C0 shl rbp, 2 mov ebx, edi mov r12d, esi mov rdi, rbp; unsigned __int64 call __Znwm; operator new(ulong) mov rdx, rbp; n xor esi, esi; c mov rdi, rax; s call _memset mov [rax+4], r12d mov rdi, rax; void * cmp ebx, 1 jz loc_13A6 mov eax, r12d imul eax, r12d mov [rdi+8], eax cmp ebx, 2 jz loc_13A6 lea esi, [r12-1] cmp ebx, 4 jle loc_13CD lea edx, [rbx-5] mov r8d, 5 shr edx, 1 lea r9d, [rdx+rdx] add r9, 7 loc_1302: lea edx, [rax+r12] imul edx, esi movsxd r12, edx mov ecx, edx imul r12, 44B82F99h sar ecx, 1Fh sar r12, 3Ch sub r12d, ecx imul ecx, r12d, 3B9ACA07h sub edx, ecx mov [rdi+r8*4-8], edx mov r12d, edx lea edx, [rdx+rax] imul edx, esi movsxd rax, edx mov ecx, edx imul rax, 44B82F99h sar ecx, 1Fh sar rax, 3Ch sub eax, ecx imul ecx, eax, 3B9ACA07h mov eax, edx sub eax, ecx mov rcx, r8 mov [rdi+r8*4-4], eax add r8, 2 cmp r9, r8 jnz short loc_1302 loc_1366: movsxd rcx, ecx nop dword ptr [rax+00000000h] loc_1370: mov eax, [rdi+rcx*4-4] add eax, [rdi+rcx*4-8] imul eax, esi movsxd rdx, eax mov r8d, eax imul rdx, 44B82F99h sar r8d, 1Fh sar rdx, 3Ch sub edx, r8d imul edx, 3B9ACA07h sub eax, edx mov [rdi+rcx*4], eax add rcx, 1 cmp ebx, ecx jge short loc_1370 loc_13A6: mov ebx, [rdi+rbp-4] mov rsi, rbp; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) mov eax, ebx pop rbx pop rbp pop r12 retn loc_13C0: mov dword ptr ds:byte_4, 0 ud2 loc_13CD: mov ecx, 3 jmp short loc_1366 loc_13D4: lea rdi, aCannotCreateSt; "cannot create std::vector larger than m"... call __ZSt20__throw_length_errorPKc; std::__throw_length_error(char const*)
// write access to const memory has been detected, the output may be wrong! long long func0(int a1, int a2) { unsigned long long v2; // rbp int v4; // r12d void *v5; // rax _DWORD *v6; // rax _DWORD *v7; // rdi int v8; // eax int v9; // esi long long v10; // r8 int v11; // edx long long v12; // rcx unsigned int v13; // ebx if ( (unsigned long long)(a1 + 1) >> 61 ) std::__throw_length_error("cannot create std::vector larger than max_size()"); if ( a1 == -1 ) { *(_DWORD *)&byte_4 = 0; BUG(); } v2 = 4LL * (a1 + 1); v4 = a2; v5 = (void *)operator new(v2); v6 = memset(v5, 0, v2); v6[1] = a2; v7 = v6; if ( a1 != 1 ) { v8 = a2 * a2; v7[2] = a2 * a2; if ( a1 != 2 ) { v9 = a2 - 1; if ( a1 <= 4 ) { LODWORD(v12) = 3; } else { v10 = 5LL; do { v11 = v9 * (v8 + v4) % 1000000007; v7[v10 - 2] = v11; v4 = v11; v8 = v9 * (v11 + v8) % 1000000007; LODWORD(v12) = v10; v7[v10 - 1] = v8; v10 += 2LL; } while ( 2 * ((unsigned int)(a1 - 5) >> 1) + 7LL != v10 ); } v12 = (int)v12; do { v7[v12] = v9 * (v7[v12 - 2] + v7[v12 - 1]) % 1000000007; ++v12; } while ( a1 >= (int)v12 ); } } v13 = v7[v2 / 4 - 1]; operator delete(v7, v2); return v13; }
func0: PUSH R12 PUSH RBP LEA EBP,[RDI + 0x1] MOVSXD RBP,EBP PUSH RBX MOV RAX,RBP SHR RAX,0x3d JNZ 0x001013d4 TEST RBP,RBP JZ 0x001013c0 SHL RBP,0x2 MOV EBX,EDI MOV R12D,ESI MOV RDI,RBP CALL 0x001010c0 MOV RDX,RBP XOR ESI,ESI MOV RDI,RAX CALL 0x001010a0 MOV dword ptr [RAX + 0x4],R12D MOV RDI,RAX CMP EBX,0x1 JZ 0x001013a6 MOV EAX,R12D IMUL EAX,R12D MOV dword ptr [RDI + 0x8],EAX CMP EBX,0x2 JZ 0x001013a6 LEA ESI,[R12 + -0x1] CMP EBX,0x4 JLE 0x001013cd LEA EDX,[RBX + -0x5] MOV R8D,0x5 SHR EDX,0x1 LEA R9D,[RDX + RDX*0x1] ADD R9,0x7 LAB_00101302: LEA EDX,[RAX + R12*0x1] IMUL EDX,ESI MOVSXD R12,EDX MOV ECX,EDX IMUL R12,R12,0x44b82f99 SAR ECX,0x1f SAR R12,0x3c SUB R12D,ECX IMUL ECX,R12D,0x3b9aca07 SUB EDX,ECX MOV dword ptr [RDI + R8*0x4 + -0x8],EDX MOV R12D,EDX LEA EDX,[RDX + RAX*0x1] IMUL EDX,ESI MOVSXD RAX,EDX MOV ECX,EDX IMUL RAX,RAX,0x44b82f99 SAR ECX,0x1f SAR RAX,0x3c SUB EAX,ECX IMUL ECX,EAX,0x3b9aca07 MOV EAX,EDX SUB EAX,ECX MOV RCX,R8 MOV dword ptr [RDI + R8*0x4 + -0x4],EAX ADD R8,0x2 CMP R9,R8 JNZ 0x00101302 LAB_00101366: MOVSXD RCX,ECX NOP dword ptr [RAX] LAB_00101370: MOV EAX,dword ptr [RDI + RCX*0x4 + -0x4] ADD EAX,dword ptr [RDI + RCX*0x4 + -0x8] IMUL EAX,ESI MOVSXD RDX,EAX MOV R8D,EAX IMUL RDX,RDX,0x44b82f99 SAR R8D,0x1f SAR RDX,0x3c SUB EDX,R8D IMUL EDX,EDX,0x3b9aca07 SUB EAX,EDX MOV dword ptr [RDI + RCX*0x4],EAX ADD RCX,0x1 CMP EBX,ECX JGE 0x00101370 LAB_001013a6: MOV EBX,dword ptr [RDI + RBP*0x1 + -0x4] MOV RSI,RBP CALL 0x001010d0 MOV EAX,EBX POP RBX POP RBP POP R12 RET LAB_001013c0: MOV dword ptr [0x00000004],0x0 UD2 LAB_001013cd: MOV ECX,0x3 JMP 0x00101366 LAB_001013d4: LEA RDI,[0x102008] CALL 0x00101090
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ /* func0(int, int) [clone .part.0] */ ulong func0(int param_1,int param_2) { int iVar1; uint uVar2; code *pcVar3; int iVar4; void *pvVar5; int iVar6; ulong uVar7; long lVar8; uVar7 = (ulong)(param_1 + 1); if (uVar7 >> 0x3d != 0) { iVar4 = 0x102008; std::__throw_length_error("cannot create std::vector larger than max_size()"); if (iVar4 == 0) { return 0; } uVar7 = func0(iVar4,param_2); return uVar7; } if (uVar7 != 0) { uVar7 = uVar7 * 4; pvVar5 = operator_new(uVar7); pvVar5 = memset(pvVar5,0,uVar7); *(int *)((long)pvVar5 + 4) = param_2; if (param_1 != 1) { iVar4 = param_2 * param_2; *(int *)((long)pvVar5 + 8) = iVar4; if (param_1 != 2) { iVar1 = param_2 + -1; if (param_1 < 5) { iVar6 = 3; } else { lVar8 = 5; do { param_2 = ((iVar4 + param_2) * iVar1) % 0x3b9aca07; *(int *)((long)pvVar5 + lVar8 * 4 + -8) = param_2; iVar4 = ((param_2 + iVar4) * iVar1) % 0x3b9aca07; iVar6 = (int)lVar8; *(int *)((long)pvVar5 + lVar8 * 4 + -4) = iVar4; lVar8 = lVar8 + 2; } while ((ulong)(param_1 - 5U & 0xfffffffe) + 7 != lVar8); } lVar8 = (long)iVar6; do { *(int *)((long)pvVar5 + lVar8 * 4) = ((*(int *)((long)pvVar5 + lVar8 * 4 + -4) + *(int *)((long)pvVar5 + lVar8 * 4 + -8)) * iVar1) % 0x3b9aca07; lVar8 = lVar8 + 1; } while ((int)lVar8 <= param_1); } } uVar2 = *(uint *)((long)pvVar5 + (uVar7 - 4)); operator_delete(pvVar5,uVar7); return (ulong)uVar2; } _DAT_00000004 = 0; /* WARNING: Does not return */ pcVar3 = (code *)invalidInstructionException(); (*pcVar3)(); }
1,164
func0
#include <assert.h>
int func0(int n, int m) { int q = n / m; return q; }
int main() { assert(func0(10, 3) == 3); assert(func0(4, 2) == 2); assert(func0(20, 5) == 4); return 0; }
O0
cpp
func0(int, int): endbr64 push %rbp mov %rsp,%rbp mov %edi,-0x14(%rbp) mov %esi,-0x18(%rbp) mov -0x14(%rbp),%eax cltd idivl -0x18(%rbp) mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax pop %rbp retq
_Z5func0ii: endbr64 push rbp mov rbp, rsp mov [rbp+var_14], edi mov [rbp+var_18], esi mov eax, [rbp+var_14] cdq idiv [rbp+var_18] mov [rbp+var_4], eax mov eax, [rbp+var_4] pop rbp retn
long long func0(int a1, int a2) { return (unsigned int)(a1 / a2); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV dword ptr [RBP + -0x14],EDI MOV dword ptr [RBP + -0x18],ESI MOV EAX,dword ptr [RBP + -0x14] CDQ IDIV dword ptr [RBP + -0x18] MOV dword ptr [RBP + -0x4],EAX MOV EAX,dword ptr [RBP + -0x4] POP RBP RET
/* func0(int, int) */ int func0(int param_1,int param_2) { return param_1 / param_2; }
1,165
func0
#include <assert.h>
int func0(int n, int m) { int q = n / m; return q; }
int main() { assert(func0(10, 3) == 3); assert(func0(4, 2) == 2); assert(func0(20, 5) == 4); return 0; }
O1
cpp
func0(int, int): endbr64 mov %edi,%eax cltd idiv %esi retq
_Z5func0ii: endbr64 mov eax, edi cdq idiv esi retn
long long func0(int a1, int a2) { return (unsigned int)(a1 / a2); }
func0: ENDBR64 MOV EAX,EDI CDQ IDIV ESI RET
/* func0(int, int) */ int [16] func0(int param_1,int param_2) { int auVar1 [16]; auVar1._0_8_ = (long)param_1 / (long)param_2 & 0xffffffff; auVar1._8_8_ = (long)param_1 % (long)param_2 & 0xffffffff; return auVar1; }
1,166
func0
#include <assert.h>
int func0(int n, int m) { int q = n / m; return q; }
int main() { assert(func0(10, 3) == 3); assert(func0(4, 2) == 2); assert(func0(20, 5) == 4); return 0; }
O2
cpp
func0(int, int): endbr64 mov %edi,%eax cltd idiv %esi retq nopw 0x0(%rax,%rax,1)
_Z5func0ii: endbr64 mov eax, edi cdq idiv esi retn
long long func0(int a1, int a2) { return (unsigned int)(a1 / a2); }
func0: ENDBR64 MOV EAX,EDI CDQ IDIV ESI RET
/* func0(int, int) */ int [16] func0(int param_1,int param_2) { int auVar1 [16]; auVar1._0_8_ = (long)param_1 / (long)param_2 & 0xffffffff; auVar1._8_8_ = (long)param_1 % (long)param_2 & 0xffffffff; return auVar1; }
1,167
func0
#include <assert.h>
int func0(int n, int m) { int q = n / m; return q; }
int main() { assert(func0(10, 3) == 3); assert(func0(4, 2) == 2); assert(func0(20, 5) == 4); return 0; }
O3
cpp
func0(int, int): endbr64 mov %edi,%eax cltd idiv %esi retq nopw 0x0(%rax,%rax,1)
_Z5func0ii: endbr64 mov eax, edi cdq idiv esi retn
long long func0(int a1, int a2) { return (unsigned int)(a1 / a2); }
func0: ENDBR64 MOV EAX,EDI CDQ IDIV ESI RET
/* func0(int, int) */ int [16] func0(int param_1,int param_2) { int auVar1 [16]; auVar1._0_8_ = (long)param_1 / (long)param_2 & 0xffffffff; auVar1._8_8_ = (long)param_1 % (long)param_2 & 0xffffffff; return auVar1; }
1,168
func0
#include <cmath> #include <cassert>
double func0(double w, double h) { double s = sqrt((w * w) + (h * h)); return s; }
int main() { assert(func0(7, 8) == 10.63014581273465); assert(func0(3, 4) == 5); assert(func0(7, 15) == 16.55294535724685); return 0; }
O0
cpp
func0(double, double): endbr64 push %rbp mov %rsp,%rbp sub $0x20,%rsp movsd %xmm0,-0x18(%rbp) movsd %xmm1,-0x20(%rbp) movsd -0x18(%rbp),%xmm0 movapd %xmm0,%xmm1 mulsd %xmm0,%xmm1 movsd -0x20(%rbp),%xmm0 mulsd %xmm0,%xmm0 addsd %xmm1,%xmm0 callq 1070 <sqrt@plt> movq %xmm0,%rax mov %rax,-0x8(%rbp) movsd -0x8(%rbp),%xmm0 leaveq retq
_Z5func0dd: endbr64 push rbp mov rbp, rsp sub rsp, 20h movsd [rbp+var_18], xmm0 movsd [rbp+var_20], xmm1 movsd xmm0, [rbp+var_18] movapd xmm1, xmm0 mulsd xmm1, xmm0 movsd xmm0, [rbp+var_20] mulsd xmm0, xmm0 addsd xmm1, xmm0 movq rax, xmm1 movq xmm0, rax; x call _sqrt movq rax, xmm0 mov [rbp+var_8], rax movsd xmm0, [rbp+var_8] leave retn
long long func0(double a1, double a2) { return sqrt(a1 * a1 + a2 * a2); }
func0: ENDBR64 PUSH RBP MOV RBP,RSP SUB RSP,0x20 MOVSD qword ptr [RBP + -0x18],XMM0 MOVSD qword ptr [RBP + -0x20],XMM1 MOVSD XMM0,qword ptr [RBP + -0x18] MOVAPD XMM1,XMM0 MULSD XMM1,XMM0 MOVSD XMM0,qword ptr [RBP + -0x20] MULSD XMM0,XMM0 ADDSD XMM1,XMM0 MOVQ RAX,XMM1 MOVQ XMM0,RAX CALL 0x00101070 MOVQ RAX,XMM0 MOV qword ptr [RBP + -0x8],RAX MOVSD XMM0,qword ptr [RBP + -0x8] LEAVE RET
/* func0(double, double) */ double func0(double param_1,double param_2) { double dVar1; dVar1 = sqrt(param_1 * param_1 + param_2 * param_2); return dVar1; }
1,169
func0
#include <cmath> #include <cassert>
double func0(double w, double h) { double s = sqrt((w * w) + (h * h)); return s; }
int main() { assert(func0(7, 8) == 10.63014581273465); assert(func0(3, 4) == 5); assert(func0(7, 15) == 16.55294535724685); return 0; }
O1
cpp
func0(double, double): endbr64 sub $0x18,%rsp mulsd %xmm0,%xmm0 mulsd %xmm1,%xmm1 addsd %xmm1,%xmm0 movapd %xmm0,%xmm2 sqrtsd %xmm2,%xmm2 movsd %xmm2,0x8(%rsp) pxor %xmm1,%xmm1 ucomisd %xmm0,%xmm1 ja 1180 <_Z5func0dd+0x37> movsd 0x8(%rsp),%xmm0 add $0x18,%rsp retq callq 1050 <sqrt@plt> jmp 1175 <_Z5func0dd+0x2c>
_Z5func0dd: endbr64 mulsd xmm0, xmm0 mulsd xmm1, xmm1 addsd xmm0, xmm1 sqrtsd xmm0, xmm0 retn
double func0(double a1, double a2) { return sqrt(a1 * a1 + a2 * a2); }
func0: ENDBR64 MULSD XMM0,XMM0 MULSD XMM1,XMM1 ADDSD XMM0,XMM1 SQRTSD XMM0,XMM0 RET
/* func0(double, double) */ double func0(double param_1,double param_2) { return SQRT(param_1 * param_1 + param_2 * param_2); }
1,170
func0
#include <cmath> #include <cassert>
double func0(double w, double h) { double s = sqrt((w * w) + (h * h)); return s; }
int main() { assert(func0(7, 8) == 10.63014581273465); assert(func0(3, 4) == 5); assert(func0(7, 15) == 16.55294535724685); return 0; }
O2
cpp
func0(double, double): endbr64 mulsd %xmm1,%xmm1 mulsd %xmm0,%xmm0 addsd %xmm1,%xmm0 pxor %xmm1,%xmm1 ucomisd %xmm0,%xmm1 movapd %xmm0,%xmm2 sqrtsd %xmm2,%xmm2 ja 1187 <_Z5func0dd+0x27> movapd %xmm2,%xmm0 retq sub $0x18,%rsp movsd %xmm2,0x8(%rsp) callq 1050 <sqrt@plt> movsd 0x8(%rsp),%xmm2 add $0x18,%rsp movapd %xmm2,%xmm0 retq nopw %cs:0x0(%rax,%rax,1)
_Z5func0dd: endbr64 mulsd xmm1, xmm1 mulsd xmm0, xmm0 addsd xmm0, xmm1 sqrtsd xmm0, xmm0 retn
double func0(double a1, double a2) { return sqrt(a1 * a1 + a2 * a2); }
func0: ENDBR64 MULSD XMM1,XMM1 MULSD XMM0,XMM0 ADDSD XMM0,XMM1 SQRTSD XMM0,XMM0 RET
/* func0(double, double) */ double func0(double param_1,double param_2) { return SQRT(param_1 * param_1 + param_2 * param_2); }
1,171
func0
#include <cmath> #include <cassert>
double func0(double w, double h) { double s = sqrt((w * w) + (h * h)); return s; }
int main() { assert(func0(7, 8) == 10.63014581273465); assert(func0(3, 4) == 5); assert(func0(7, 15) == 16.55294535724685); return 0; }
O3
cpp
func0(double, double): endbr64 mulsd %xmm1,%xmm1 mulsd %xmm0,%xmm0 addsd %xmm1,%xmm0 pxor %xmm1,%xmm1 ucomisd %xmm0,%xmm1 movapd %xmm0,%xmm2 sqrtsd %xmm2,%xmm2 ja 1187 <_Z5func0dd+0x27> movapd %xmm2,%xmm0 retq sub $0x18,%rsp movsd %xmm2,0x8(%rsp) callq 1050 <sqrt@plt> movsd 0x8(%rsp),%xmm2 add $0x18,%rsp movapd %xmm2,%xmm0 retq nopw %cs:0x0(%rax,%rax,1)
_Z5func0dd: endbr64 mulsd xmm1, xmm1 mulsd xmm0, xmm0 addsd xmm0, xmm1 sqrtsd xmm0, xmm0 retn
double func0(double a1, double a2) { return sqrt(a1 * a1 + a2 * a2); }
func0: ENDBR64 MULSD XMM1,XMM1 MULSD XMM0,XMM0 ADDSD XMM0,XMM1 SQRTSD XMM0,XMM0 RET
/* func0(double, double) */ double func0(double param_1,double param_2) { return SQRT(param_1 * param_1 + param_2 * param_2); }
1,172
func0
#include <iostream> #include <vector> #include <cassert> #include <typeinfo> #include <any> #include <climits>
int func0(std::vector<std::any> listval) { int max_val = INT_MIN; for (auto& item : listval) { if (item.type() == typeid(int)) { int val = std::any_cast<int>(item); if (val > max_val) { max_val = val; } } } return max_val; }
int main() { assert(func0({ "Python", 3, 2, 4, 5, "version" }) == 5); assert(func0({ "Python", 15, 20, 25 }) == 25); assert(func0({ "Python", 30, 20, 40, 50, "version" }) == 50); return 0; }
O0
cpp
func0(std::vector<std::any, std::allocator<std::any> >): 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 $0x80000000,-0x30(%rbp) mov -0x38(%rbp),%rax mov %rax,-0x18(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 1d6e <_ZNSt6vectorISt3anySaIS0_EE5beginEv> mov %rax,-0x28(%rbp) mov -0x18(%rbp),%rax mov %rax,%rdi callq 1dba <_ZNSt6vectorISt3anySaIS0_EE3endEv> mov %rax,-0x20(%rbp) lea -0x20(%rbp),%rdx lea -0x28(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1e0a <_ZN9__gnu_cxxneIPSt3anySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_> test %al,%al je 1408 <_Z5func0St6vectorISt3anySaIS0_EE+0xbf> lea -0x28(%rbp),%rax mov %rax,%rdi callq 1e6e <_ZNK9__gnu_cxx17__normal_iteratorIPSt3anySt6vectorIS1_SaIS1_EEEdeEv> mov %rax,-0x10(%rbp) mov -0x10(%rbp),%rax mov %rax,%rdi callq 1d00 <_ZNKSt3any4typeEv> lea 0x488f(%rip),%rsi mov %rax,%rdi callq 1a98 <_ZNKSt9type_infoeqERKS_> test %al,%al je 13fa <_Z5func0St6vectorISt3anySaIS0_EE+0xb1> mov -0x10(%rbp),%rax mov %rax,%rdi callq 1e83 <_ZSt8any_castIiET_RSt3any> mov %eax,-0x2c(%rbp) mov -0x2c(%rbp),%eax cmp -0x30(%rbp),%eax jle 13fa <_Z5func0St6vectorISt3anySaIS0_EE+0xb1> mov -0x2c(%rbp),%eax mov %eax,-0x30(%rbp) lea -0x28(%rbp),%rax mov %rax,%rdi callq 1e4a <_ZN9__gnu_cxx17__normal_iteratorIPSt3anySt6vectorIS1_SaIS1_EEEppEv> jmp 1397 <_Z5func0St6vectorISt3anySaIS0_EE+0x4e> mov -0x30(%rbp),%eax mov -0x8(%rbp),%rcx xor %fs:0x28,%rcx je 141f <_Z5func0St6vectorISt3anySaIS0_EE+0xd6> callq 11e0 <__stack_chk_fail@plt> leaveq retq
_Z5func0St6vectorISt3anySaIS0_EE: 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_30], 80000000h mov rax, [rbp+var_38] mov [rbp+var_18], rax mov rax, [rbp+var_18] mov rdi, rax call _ZNSt6vectorISt3anySaIS0_EE5beginEv; std::vector<std::any>::begin(void) mov [rbp+var_28], rax mov rax, [rbp+var_18] mov rdi, rax call _ZNSt6vectorISt3anySaIS0_EE3endEv; std::vector<std::any>::end(void) mov [rbp+var_20], rax jmp short loc_13B7 loc_1359: lea rax, [rbp+var_28] mov rdi, rax call _ZNK9__gnu_cxx17__normal_iteratorIPSt3anySt6vectorIS1_SaIS1_EEEdeEv; __gnu_cxx::__normal_iterator<std::any *,std::vector<std::any>>::operator*(void) mov [rbp+var_10], rax mov rax, [rbp+var_10] mov rdi, rax; this call _ZNKSt3any4typeEv; std::any::type(void) mov rdx, rax lea rax, _ZTIi@CXXABI_1_3 mov rsi, rax mov rdi, rdx call _ZNKSt9type_infoeqERKS_; std::type_info::operator==(std::type_info const&) test al, al jz short loc_13AB mov rax, [rbp+var_10] mov rdi, rax call _ZSt8any_castIiET_RSt3any; std::any_cast<int>(std::any &) mov [rbp+var_2C], eax mov eax, [rbp+var_2C] cmp eax, [rbp+var_30] jle short loc_13AB mov eax, [rbp+var_2C] mov [rbp+var_30], eax loc_13AB: lea rax, [rbp+var_28] mov rdi, rax call _ZN9__gnu_cxx17__normal_iteratorIPSt3anySt6vectorIS1_SaIS1_EEEppEv; __gnu_cxx::__normal_iterator<std::any *,std::vector<std::any>>::operator++(void) loc_13B7: lea rdx, [rbp+var_20] lea rax, [rbp+var_28] mov rsi, rdx mov rdi, rax call _ZN9__gnu_cxxneIPSt3anySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_; __gnu_cxx::operator!=<std::any *,std::vector<std::any>>(__gnu_cxx::__normal_iterator<std::any *,std::vector<std::any>> const&,__gnu_cxx::__normal_iterator<std::any *,std::vector<std::any>> const&) test al, al jnz short loc_1359 mov eax, [rbp+var_30] mov rdx, [rbp+var_8] sub rdx, fs:28h jz short locret_13E5 call ___stack_chk_fail locret_13E5: leave retn
long long func0(long long a1) { long long v1; // rax unsigned int v3; // [rsp+10h] [rbp-30h] signed int v4; // [rsp+14h] [rbp-2Ch] long long v5; // [rsp+18h] [rbp-28h] BYREF _QWORD v6[2]; // [rsp+20h] [rbp-20h] BYREF std::any *v7; // [rsp+30h] [rbp-10h] unsigned long long v8; // [rsp+38h] [rbp-8h] v8 = __readfsqword(0x28u); v3 = 0x80000000; v6[1] = a1; v5 = std::vector<std::any>::begin(a1); v6[0] = std::vector<std::any>::end(a1); while ( (unsigned __int8)__gnu_cxx::operator!=<std::any *,std::vector<std::any>>(&v5, v6) ) { v7 = (std::any *)__gnu_cxx::__normal_iterator<std::any *,std::vector<std::any>>::operator*(&v5); v1 = std::any::type(v7); if ( (unsigned __int8)std::type_info::operator==(v1, &`typeinfo for'int) ) { v4 = std::any_cast<int>(v7); if ( v4 > (int)v3 ) v3 = v4; } __gnu_cxx::__normal_iterator<std::any *,std::vector<std::any>>::operator++(&v5); } return v3; }
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 + -0x30],0x80000000 MOV RAX,qword ptr [RBP + -0x38] MOV qword ptr [RBP + -0x18],RAX MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101eb2 MOV qword ptr [RBP + -0x28],RAX MOV RAX,qword ptr [RBP + -0x18] MOV RDI,RAX CALL 0x00101efe MOV qword ptr [RBP + -0x20],RAX JMP 0x001013b7 LAB_00101359: LEA RAX,[RBP + -0x28] MOV RDI,RAX CALL 0x00101fb2 MOV qword ptr [RBP + -0x10],RAX MOV RAX,qword ptr [RBP + -0x10] MOV RDI,RAX CALL 0x00101e44 MOV RDX,RAX LEA RAX,[0x104c60] MOV RSI,RAX MOV RDI,RDX CALL 0x00101b54 TEST AL,AL JZ 0x001013ab MOV RAX,qword ptr [RBP + -0x10] MOV RDI,RAX CALL 0x00101fc7 MOV dword ptr [RBP + -0x2c],EAX MOV EAX,dword ptr [RBP + -0x2c] CMP EAX,dword ptr [RBP + -0x30] JLE 0x001013ab MOV EAX,dword ptr [RBP + -0x2c] MOV dword ptr [RBP + -0x30],EAX LAB_001013ab: LEA RAX,[RBP + -0x28] MOV RDI,RAX CALL 0x00101f8e LAB_001013b7: LEA RDX,[RBP + -0x20] LEA RAX,[RBP + -0x28] MOV RSI,RDX MOV RDI,RAX CALL 0x00101f4e TEST AL,AL JNZ 0x00101359 MOV EAX,dword ptr [RBP + -0x30] MOV RDX,qword ptr [RBP + -0x8] SUB RDX,qword ptr FS:[0x28] JZ 0x001013e5 CALL 0x001011b0 LAB_001013e5: LEAVE RET
/* func0(std::vector<std::any, std::allocator<std::any> >) */ int func0(vector param_1) { char cVar1; bool bVar2; int iVar3; type_info *this; int4 in_register_0000003c; long in_FS_OFFSET; int local_38; int8 local_30; int8 local_28; vector<std::any,std::allocator<std::any>> *local_20; any *local_18; long local_10; local_20 = (vector<std::any,std::allocator<std::any>> *)CONCAT44(in_register_0000003c,param_1); local_10 = *(long *)(in_FS_OFFSET + 0x28); local_38 = -0x80000000; local_30 = std::vector<std::any,std::allocator<std::any>>::begin(local_20); local_28 = std::vector<std::any,std::allocator<std::any>>::end(local_20); while( true ) { bVar2 = operator!=((__normal_iterator *)&local_30,(__normal_iterator *)&local_28); if (!bVar2) break; local_18 = (any *)__normal_iterator<std::any*,std::vector<std::any,std::allocator<std::any>>>:: operator*((__normal_iterator<std::any*,std::vector<std::any,std::allocator<std::any>>> *)&local_30); this = (type_info *)std::any::type(local_18); cVar1 = std::type_info::operator==(this,(type_info *)int::typeinfo); if (cVar1 != '\0') { iVar3 = std::any_cast<int>(local_18); if (local_38 < iVar3) { local_38 = iVar3; } } __normal_iterator<std::any*,std::vector<std::any,std::allocator<std::any>>>::operator++ ((__normal_iterator<std::any*,std::vector<std::any,std::allocator<std::any>>> *) &local_30); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_38; }
1,173
func0
#include <iostream> #include <vector> #include <cassert> #include <typeinfo> #include <any> #include <climits>
int func0(std::vector<std::any> listval) { int max_val = INT_MIN; for (auto& item : listval) { if (item.type() == typeid(int)) { int val = std::any_cast<int>(item); if (val > max_val) { max_val = val; } } } return max_val; }
int main() { assert(func0({ "Python", 3, 2, 4, 5, "version" }) == 5); assert(func0({ "Python", 15, 20, 25 }) == 25); assert(func0({ "Python", 30, 20, 40, 50, "version" }) == 50); return 0; }
O1
cpp
func0(std::vector<std::any, std::allocator<std::any> >): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov %fs:0x28,%rax mov %rax,0x8(%rsp) xor %eax,%eax mov (%rdi),%rbx mov 0x8(%rdi),%r14 cmp %r14,%rbx je 1460 <_Z5func0St6vectorISt3anySaIS0_EE+0x137> mov $0x80000000,%r15d lea 0x2988(%rip),%r13 mov %rsp,%r12 jmp 139e <_Z5func0St6vectorISt3anySaIS0_EE+0x75> mov %r12,%rdx mov %rbp,%rsi mov $0x0,%edi callq *0x0(%rbp) mov (%rsp),%rax test %rax,%rax je 1436 <_Z5func0St6vectorISt3anySaIS0_EE+0x10d> mov (%rax),%eax cmp %eax,%r15d cmovl %eax,%r15d add $0x10,%rbx cmp %rbx,%r14 je 1466 <_Z5func0St6vectorISt3anySaIS0_EE+0x13d> mov %rbx,%rbp mov (%rbx),%rcx mov %r13,%rax test %rcx,%rcx je 13bd <_Z5func0St6vectorISt3anySaIS0_EE+0x94> mov %r12,%rdx mov %rbx,%rsi mov $0x1,%edi callq *%rcx mov (%rsp),%rax mov 0x8(%rax),%rdi cmp 0x2900(%rip),%rdi je 13df <_Z5func0St6vectorISt3anySaIS0_EE+0xb6> cmpb $0x2a,(%rdi) je 1391 <_Z5func0St6vectorISt3anySaIS0_EE+0x68> mov 0x28f2(%rip),%rsi callq 11d0 <strcmp@plt> test %eax,%eax jne 1391 <_Z5func0St6vectorISt3anySaIS0_EE+0x68> mov 0x0(%rbp),%rax lea 0x578(%rip),%rsi cmp %rsi,%rax je 136d <_Z5func0St6vectorISt3anySaIS0_EE+0x44> mov %r13,%rdx test %rax,%rax je 140c <_Z5func0St6vectorISt3anySaIS0_EE+0xe3> mov %r12,%rdx mov %rbp,%rsi mov $0x1,%edi callq *%rax mov (%rsp),%rdx mov 0x8(%rdx),%rdi cmp %rdi,0x28b1(%rip) je 136d <_Z5func0St6vectorISt3anySaIS0_EE+0x44> cmpb $0x2a,(%rdi) je 1436 <_Z5func0St6vectorISt3anySaIS0_EE+0x10d> mov 0x289f(%rip),%rsi callq 11d0 <strcmp@plt> test %eax,%eax je 136d <_Z5func0St6vectorISt3anySaIS0_EE+0x44> mov $0x8,%edi callq 1150 <__cxa_allocate_exception@plt> mov %rax,%rdi lea 0x2846(%rip),%rax mov %rax,(%rdi) lea 0x564(%rip),%rdx lea 0x28a5(%rip),%rsi callq 1220 <__cxa_throw@plt> mov $0x80000000,%r15d mov 0x8(%rsp),%rax xor %fs:0x28,%rax jne 1488 <_Z5func0St6vectorISt3anySaIS0_EE+0x15f> mov %r15d,%eax add $0x18,%rsp pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq callq 11c0 <__stack_chk_fail@plt>
_Z5func0St6vectorISt3anySaIS0_EE: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 18h mov rax, fs:28h mov [rsp+48h+var_40], rax xor eax, eax mov rbx, [rdi] mov r13, [rdi+8] cmp r13, rbx jz loc_13F7 mov r14d, 80000000h mov r15, rsp jmp short loc_131F loc_1306: mov eax, [r12+8] cmp r14d, eax cmovl r14d, eax loc_1312: add rbx, 10h cmp r13, rbx jz loc_13FD loc_131F: mov r12, rbx mov rcx, [rbx] lea rax, _ZTIv@CXXABI_1_3 test rcx, rcx jz short loc_1342 mov rdx, r15 mov rsi, rbx mov edi, 1 call rcx mov rax, [rsp+48h+var_48] loc_1342: mov rdi, [rax+8]; s1 mov rbp, cs:qword_3CE8 cmp rdi, rbp jz short loc_136F cmp byte ptr [rdi], 2Ah ; '*' jz short loc_1312 cmp byte ptr [rbp+0], 2Ah ; '*' setz sil movzx esi, sil add rsi, rbp; s2 call _strcmp test eax, eax jnz short loc_1312 loc_136F: mov rax, [r12] lea rdx, _ZNSt3any17_Manager_internalIiE9_S_manageENS_3_OpEPKS_PNS_4_ArgE; std::any::_Manager_internal<int>::_S_manage(std::any::_Op,std::any const*,std::any::_Arg *) cmp rax, rdx jz short loc_1306 lea rdx, _ZTIv@CXXABI_1_3 test rax, rax jz short loc_139C mov rdx, r15 mov rsi, r12 mov edi, 1 call rax mov rdx, [rsp+48h+var_48] loc_139C: mov rdi, [rdx+8]; s1 cmp rbp, rdi jz loc_1306 cmp byte ptr [rdi], 2Ah ; '*' jz short loc_13CB cmp byte ptr [rbp+0], 2Ah ; '*' setz al movzx eax, al add rbp, rax mov rsi, rbp; s2 call _strcmp test eax, eax jz loc_1306 loc_13CB: mov edi, 8; thrown_size call ___cxa_allocate_exception mov rdi, rax; void * lea rax, off_3CB0 mov [rdi], rax mov rax, [rsp+48h+var_40] sub rax, fs:28h jz short loc_141F call ___stack_chk_fail loc_13F7: mov r14d, 80000000h loc_13FD: mov rax, [rsp+48h+var_40] sub rax, fs:28h jnz short loc_1432 mov eax, r14d add rsp, 18h pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_141F: lea rdx, _ZNSt12bad_any_castD2Ev; void (*)(void *) lea rsi, _ZTISt12bad_any_cast; lptinfo call ___cxa_throw loc_1432: call ___stack_chk_fail
long long func0(long long *a1) { long long v1; // rbx long long v2; // r13 unsigned int v3; // r14d void *v4; // rax int *v5; // rdi void ( *v6)(long long, long long, _QWORD *); // rax void *v7; // rdx int *v8; // rdi _QWORD *exception; // rdi _QWORD v11[9]; // [rsp+0h] [rbp-48h] BYREF v11[1] = __readfsqword(0x28u); v1 = *a1; v2 = a1[1]; if ( v2 == *a1 ) { return 0x80000000; } else { v3 = 0x80000000; do { v4 = &`typeinfo for'void; if ( *(_QWORD *)v1 ) { (*(void ( **)(long long, long long, _QWORD *))v1)(1LL, v1, v11); v4 = (void *)v11[0]; } v5 = (int *)*((_QWORD *)v4 + 1); if ( v5 == &dword_0 || *(_BYTE *)v5 != 42 && !strcmp((const char *)v5, (const char *)&dword_0) ) { v6 = *(void ( **)(long long, long long, _QWORD *))v1; if ( *(long long ( **)())v1 != std::any::_Manager_internal<int>::_S_manage ) { v7 = &`typeinfo for'void; if ( v6 ) { v6(1LL, v1, v11); v7 = (void *)v11[0]; } v8 = (int *)*((_QWORD *)v7 + 1); if ( &dword_0 != v8 && (*(_BYTE *)v8 == 42 || strcmp((const char *)v8, (const char *)&dword_0)) ) { exception = __cxa_allocate_exception(8uLL); *exception = off_3CB0; __cxa_throw( exception, (struct type_info *)&`typeinfo for'std::bad_any_cast, std::bad_any_cast::~bad_any_cast); } } if ( (signed int)v3 < *(_DWORD *)(v1 + 8) ) v3 = *(_DWORD *)(v1 + 8); } v1 += 16LL; } while ( v2 != v1 ); } return v3; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x8],RAX XOR EAX,EAX MOV RBX,qword ptr [RDI] MOV R13,qword ptr [RDI + 0x8] CMP R13,RBX JZ 0x001013f7 MOV R14D,0x80000000 MOV R15,RSP JMP 0x0010131f LAB_00101306: MOV EAX,dword ptr [R12 + 0x8] CMP R14D,EAX CMOVL R14D,EAX LAB_00101312: ADD RBX,0x10 CMP R13,RBX JZ 0x001013fd LAB_0010131f: MOV R12,RBX MOV RCX,qword ptr [RBX] LEA RAX,[0x103d20] TEST RCX,RCX JZ 0x00101342 MOV RDX,R15 MOV RSI,RBX MOV EDI,0x1 CALL RCX MOV RAX,qword ptr [RSP] LAB_00101342: MOV RDI,qword ptr [RAX + 0x8] MOV RBP,qword ptr [0x00103ce8] CMP RDI,RBP JZ 0x0010136f CMP byte ptr [RDI],0x2a JZ 0x00101312 CMP byte ptr [RBP],0x2a SETZ SIL MOVZX ESI,SIL ADD RSI,RBP CALL 0x00101180 TEST EAX,EAX JNZ 0x00101312 LAB_0010136f: MOV RAX,qword ptr [R12] LEA RDX,[0x101928] CMP RAX,RDX JZ 0x00101306 LEA RDX,[0x103d20] TEST RAX,RAX JZ 0x0010139c MOV RDX,R15 MOV RSI,R12 MOV EDI,0x1 CALL RAX MOV RDX,qword ptr [RSP] LAB_0010139c: MOV RDI,qword ptr [RDX + 0x8] CMP RBP,RDI JZ 0x00101306 CMP byte ptr [RDI],0x2a JZ 0x001013cb CMP byte ptr [RBP],0x2a SETZ AL MOVZX EAX,AL ADD RBP,RAX MOV RSI,RBP CALL 0x00101180 TEST EAX,EAX JZ 0x00101306 LAB_001013cb: MOV EDI,0x8 CALL 0x00101120 MOV RDI,RAX LEA RAX,[0x103cb0] MOV qword ptr [RDI],RAX MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JZ 0x0010141f CALL 0x00101170 LAB_001013f7: MOV R14D,0x80000000 LAB_001013fd: MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101432 MOV EAX,R14D ADD RSP,0x18 POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_0010141f: LEA RDX,[0x101984] LEA RSI,[0x103d30] LAB_0010142d: CALL 0x001011c0 LAB_00101432: CALL 0x00101170
/* func0(std::vector<std::any, std::allocator<std::any> >) */ int func0(vector param_1) { int8 *puVar1; char *pcVar2; code *pcVar3; int8 uVar4; int iVar5; int1 *puVar6; int8 *puVar7; int4 in_register_0000003c; int iVar8; long in_FS_OFFSET; int1 *local_48; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); puVar7 = *(int8 **)CONCAT44(in_register_0000003c,param_1); puVar1 = (int8 *)((long *)CONCAT44(in_register_0000003c,param_1))[1]; if (puVar1 == puVar7) { iVar8 = -0x80000000; } else { iVar8 = -0x80000000; do { puVar6 = void::typeinfo; if ((code *)*puVar7 != (code *)0x0) { (*(code *)*puVar7)(1,puVar7,&local_48); puVar6 = local_48; } uVar4 = int::typeinfo._8_8_; pcVar2 = *(char **)(puVar6 + 8); if (pcVar2 == (char *)int::typeinfo._8_8_) { LAB_0010136f: pcVar3 = (code *)*puVar7; if (pcVar3 != std::any::_Manager_internal<int>::_S_manage) { puVar6 = void::typeinfo; if (pcVar3 != (code *)0x0) { (*pcVar3)(1,puVar7,&local_48); puVar6 = local_48; } pcVar2 = *(char **)(puVar6 + 8); if ((char *)uVar4 != pcVar2) { if (*pcVar2 == '*') { LAB_001013cb: puVar7 = (int8 *)__cxa_allocate_exception(8); *puVar7 = &PTR__bad_any_cast_00103cb0; if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } /* WARNING: Subroutine does not return */ __cxa_throw(puVar7,&std::bad_any_cast::typeinfo,std::bad_any_cast::~bad_any_cast); } iVar5 = strcmp(pcVar2,(char *)(uVar4 + (ulong)(*(char *)uVar4 == '*'))); if (iVar5 != 0) goto LAB_001013cb; } } if (iVar8 < *(int *)(puVar7 + 1)) { iVar8 = *(int *)(puVar7 + 1); } } else if (*pcVar2 != '*') { iVar5 = strcmp(pcVar2,(char *)((ulong)(*(char *)int::typeinfo._8_8_ == '*') + int::typeinfo._8_8_)); if (iVar5 == 0) goto LAB_0010136f; } puVar7 = puVar7 + 2; } while (puVar1 != puVar7); } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar8; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,174
func0
#include <iostream> #include <vector> #include <cassert> #include <typeinfo> #include <any> #include <climits>
int func0(std::vector<std::any> listval) { int max_val = INT_MIN; for (auto& item : listval) { if (item.type() == typeid(int)) { int val = std::any_cast<int>(item); if (val > max_val) { max_val = val; } } } return max_val; }
int main() { assert(func0({ "Python", 3, 2, 4, 5, "version" }) == 5); assert(func0({ "Python", 15, 20, 25 }) == 25); assert(func0({ "Python", 30, 20, 40, 50, "version" }) == 50); return 0; }
O2
cpp
func0(std::vector<std::any, std::allocator<std::any> >): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov (%rdi),%rcx mov 0x8(%rdi),%r14 mov %fs:0x28,%rax mov %rax,0x8(%rsp) xor %eax,%eax cmp %r14,%rcx je 1888 <_Z5func0St6vectorISt3anySaIS0_EE+0x128> mov 0x252f(%rip),%rbx mov %rcx,%r15 mov $0x80000000,%r12d mov %rsp,%rbp lea 0x2544(%rip),%r13 nopl 0x0(%rax) mov (%r15),%r8 mov %r13,%rax test %r8,%r8 je 17cd <_Z5func0St6vectorISt3anySaIS0_EE+0x6d> mov %rbp,%rdx mov %r15,%rsi mov $0x1,%edi callq *%r8 mov (%rsp),%rax mov 0x8(%rax),%rdi cmp %rbx,%rdi je 17e7 <_Z5func0St6vectorISt3anySaIS0_EE+0x87> cmpb $0x2a,(%rdi) je 1854 <_Z5func0St6vectorISt3anySaIS0_EE+0xf4> mov %rbx,%rsi callq 11d0 <strcmp@plt> test %eax,%eax jne 1854 <_Z5func0St6vectorISt3anySaIS0_EE+0xf4> mov (%r15),%rax lea 0x13f(%rip),%rcx cmp %rcx,%rax je 1834 <_Z5func0St6vectorISt3anySaIS0_EE+0xd4> mov %r13,%rdx test %rax,%rax je 180f <_Z5func0St6vectorISt3anySaIS0_EE+0xaf> mov %rbp,%rdx mov %r15,%rsi mov $0x1,%edi callq *%rax mov (%rsp),%rdx mov 0x8(%rdx),%rdi cmp %rdi,%rbx je 1831 <_Z5func0St6vectorISt3anySaIS0_EE+0xd1> cmpb $0x2a,(%rdi) je 1240 <_Z5func0St6vectorISt3anySaIS0_EE.cold> mov %rbx,%rsi callq 11d0 <strcmp@plt> test %eax,%eax jne 1240 <_Z5func0St6vectorISt3anySaIS0_EE.cold> mov (%r15),%rax mov %rbp,%rdx mov %r15,%rsi xor %edi,%edi callq *%rax mov (%rsp),%rax test %rax,%rax je 1240 <_Z5func0St6vectorISt3anySaIS0_EE.cold> mov (%rax),%eax cmp %eax,%r12d cmovl %eax,%r12d add $0x10,%r15 cmp %r15,%r14 jne 17b0 <_Z5func0St6vectorISt3anySaIS0_EE+0x50> mov 0x8(%rsp),%rax xor %fs:0x28,%rax jne 1890 <_Z5func0St6vectorISt3anySaIS0_EE+0x130> add $0x18,%rsp mov %r12d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax,%rax,1) mov $0x80000000,%r12d jmp 1861 <_Z5func0St6vectorISt3anySaIS0_EE+0x101> callq 11c0 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1)
_Z5func0St6vectorISt3anySaIS0_EE: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 18h mov rcx, [rdi] mov r12, [rdi+8] mov rax, fs:28h mov [rsp+48h+var_40], rax xor eax, eax cmp r12, rcx jz loc_17F0 mov rbx, cs:qword_3CE8 mov r15, rcx mov r13d, 80000000h mov r14, rsp lea rbp, _ZTIv@CXXABI_1_3 nop dword ptr [rax+00h] loc_16E0: mov r8, [r15] mov rax, rbp test r8, r8 jz short loc_16FD mov rdx, r14 mov rsi, r15 mov edi, 1 call r8 mov rax, [rsp+48h+var_48] loc_16FD: mov rdi, [rax+8]; s1 cmp rbx, rdi jz short loc_1720 cmp byte ptr [rdi], 2Ah ; '*' jz short loc_177B xor esi, esi cmp byte ptr [rbx], 2Ah ; '*' setz sil add rsi, rbx; s2 call _strcmp test eax, eax jnz short loc_177B loc_1720: mov rax, [r15] lea rcx, _ZNSt3any17_Manager_internalIiE9_S_manageENS_3_OpEPKS_PNS_4_ArgE; std::any::_Manager_internal<int>::_S_manage(std::any::_Op,std::any const*,std::any::_Arg *) cmp rax, rcx jz short loc_1770 mov rdx, rbp test rax, rax jz short loc_1748 mov rdx, r14 mov rsi, r15 mov edi, 1 call rax mov rdx, [rsp+48h+var_48] loc_1748: mov rdi, [rdx+8]; s1 cmp rbx, rdi jz short loc_1770 cmp byte ptr [rdi], 2Ah ; '*' jz short loc_17B0 xor esi, esi cmp byte ptr [rbx], 2Ah ; '*' setz sil add rsi, rbx; s2 call _strcmp test eax, eax jnz short loc_17B0 nop dword ptr [rax+rax+00h] loc_1770: mov eax, [r15+8] cmp r13d, eax cmovl r13d, eax loc_177B: add r15, 10h cmp r12, r15 jnz loc_16E0 loc_1788: mov rax, [rsp+48h+var_40] sub rax, fs:28h jnz short loc_17F8 add rsp, 18h mov eax, r13d pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_17B0: mov edi, 8; thrown_size call ___cxa_allocate_exception mov rdi, rax; void * lea rax, off_3CB0 mov [rdi], rax mov rax, [rsp+48h+var_40] sub rax, fs:28h jnz short loc_17F8 lea rdx, _ZNSt12bad_any_castD2Ev; void (*)(void *) lea rsi, _ZTISt12bad_any_cast; lptinfo call ___cxa_throw loc_17F0: mov r13d, 80000000h jmp short loc_1788 loc_17F8: call ___stack_chk_fail
long long func0(long long *a1) { long long v1; // rcx long long v2; // r12 long long v3; // r15 unsigned int v4; // r13d void *v5; // rax int *v6; // rdi void ( *v7)(long long, long long, _QWORD *); // rax void *v8; // rdx int *v9; // rdi _QWORD *exception; // rdi _QWORD v12[9]; // [rsp+0h] [rbp-48h] BYREF v1 = *a1; v2 = a1[1]; v12[1] = __readfsqword(0x28u); if ( v2 == v1 ) { return 0x80000000; } else { v3 = v1; v4 = 0x80000000; do { v5 = &`typeinfo for'void; if ( *(_QWORD *)v3 ) { (*(void ( **)(long long, long long, _QWORD *))v3)(1LL, v3, v12); v5 = (void *)v12[0]; } v6 = (int *)*((_QWORD *)v5 + 1); if ( &dword_0 == v6 || *(_BYTE *)v6 != 42 && !strcmp((const char *)v6, (const char *)&dword_0) ) { v7 = *(void ( **)(long long, long long, _QWORD *))v3; if ( *(long long ( **)())v3 != std::any::_Manager_internal<int>::_S_manage ) { v8 = &`typeinfo for'void; if ( v7 ) { v7(1LL, v3, v12); v8 = (void *)v12[0]; } v9 = (int *)*((_QWORD *)v8 + 1); if ( &dword_0 != v9 && (*(_BYTE *)v9 == 42 || strcmp((const char *)v9, (const char *)&dword_0)) ) { exception = __cxa_allocate_exception(8uLL); *exception = off_3CB0; __cxa_throw( exception, (struct type_info *)&`typeinfo for'std::bad_any_cast, std::bad_any_cast::~bad_any_cast); } } if ( (signed int)v4 < *(_DWORD *)(v3 + 8) ) v4 = *(_DWORD *)(v3 + 8); } v3 += 16LL; } while ( v2 != v3 ); } return v4; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV RCX,qword ptr [RDI] MOV R12,qword ptr [RDI + 0x8] MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x8],RAX XOR EAX,EAX CMP R12,RCX JZ 0x001017f0 MOV RBX,qword ptr [0x00103ce8] MOV R15,RCX MOV R13D,0x80000000 MOV R14,RSP LEA RBP,[0x103d20] NOP dword ptr [RAX] LAB_001016e0: MOV R8,qword ptr [R15] MOV RAX,RBP TEST R8,R8 JZ 0x001016fd MOV RDX,R14 MOV RSI,R15 MOV EDI,0x1 CALL R8 MOV RAX,qword ptr [RSP] LAB_001016fd: MOV RDI,qword ptr [RAX + 0x8] CMP RBX,RDI JZ 0x00101720 CMP byte ptr [RDI],0x2a JZ 0x0010177b XOR ESI,ESI CMP byte ptr [RBX],0x2a SETZ SIL ADD RSI,RBX CALL 0x00101180 TEST EAX,EAX JNZ 0x0010177b LAB_00101720: MOV RAX,qword ptr [R15] LEA RCX,[0x1018d0] CMP RAX,RCX JZ 0x00101770 MOV RDX,RBP TEST RAX,RAX JZ 0x00101748 MOV RDX,R14 MOV RSI,R15 MOV EDI,0x1 CALL RAX MOV RDX,qword ptr [RSP] LAB_00101748: MOV RDI,qword ptr [RDX + 0x8] CMP RBX,RDI JZ 0x00101770 CMP byte ptr [RDI],0x2a JZ 0x001017b0 XOR ESI,ESI CMP byte ptr [RBX],0x2a SETZ SIL ADD RSI,RBX CALL 0x00101180 TEST EAX,EAX JNZ 0x001017b0 NOP dword ptr [RAX + RAX*0x1] LAB_00101770: MOV EAX,dword ptr [R15 + 0x8] CMP R13D,EAX CMOVL R13D,EAX LAB_0010177b: ADD R15,0x10 CMP R12,R15 JNZ 0x001016e0 LAB_00101788: MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x001017f8 ADD RSP,0x18 MOV EAX,R13D POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_001017b0: MOV EDI,0x8 CALL 0x00101120 MOV RDI,RAX LEA RAX,[0x103cb0] MOV qword ptr [RDI],RAX MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x001017f8 LEA RDX,[0x101810] LEA RSI,[0x103d30] LAB_001017e5: CALL 0x001011c0 LAB_001017f0: MOV R13D,0x80000000 JMP 0x00101788 LAB_001017f8: CALL 0x00101170
/* func0(std::vector<std::any, std::allocator<std::any> >) */ int func0(vector param_1) { int8 *puVar1; char *pcVar2; code *pcVar3; int8 uVar4; int iVar5; int1 *puVar6; int8 *puVar7; int4 in_register_0000003c; int iVar8; long in_FS_OFFSET; int1 *local_48; long local_40; uVar4 = int::typeinfo._8_8_; puVar7 = *(int8 **)CONCAT44(in_register_0000003c,param_1); puVar1 = (int8 *)((long *)CONCAT44(in_register_0000003c,param_1))[1]; local_40 = *(long *)(in_FS_OFFSET + 0x28); if (puVar1 == puVar7) { iVar8 = -0x80000000; } else { iVar8 = -0x80000000; do { puVar6 = void::typeinfo; if ((code *)*puVar7 != (code *)0x0) { (*(code *)*puVar7)(1,puVar7,&local_48); puVar6 = local_48; } pcVar2 = *(char **)(puVar6 + 8); if (((char *)uVar4 == pcVar2) || ((*pcVar2 != '*' && (iVar5 = strcmp(pcVar2,(char *)((ulong)(*(char *)uVar4 == '*') + uVar4)), iVar5 == 0)))) { pcVar3 = (code *)*puVar7; if (pcVar3 != std::any::_Manager_internal<int>::_S_manage) { puVar6 = void::typeinfo; if (pcVar3 != (code *)0x0) { (*pcVar3)(1,puVar7,&local_48); puVar6 = local_48; } pcVar2 = *(char **)(puVar6 + 8); if (((char *)uVar4 != pcVar2) && ((*pcVar2 == '*' || (iVar5 = strcmp(pcVar2,(char *)((ulong)(*(char *)uVar4 == '*') + uVar4)), iVar5 != 0)) )) { puVar7 = (int8 *)__cxa_allocate_exception(8); *puVar7 = &PTR__bad_any_cast_00103cb0; if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __cxa_throw(puVar7,&std::bad_any_cast::typeinfo,std::bad_any_cast::~bad_any_cast); } goto LAB_001017f8; } } if (iVar8 < *(int *)(puVar7 + 1)) { iVar8 = *(int *)(puVar7 + 1); } } puVar7 = puVar7 + 2; } while (puVar1 != puVar7); } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar8; } LAB_001017f8: /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,175
func0
#include <iostream> #include <vector> #include <cassert> #include <typeinfo> #include <any> #include <climits>
int func0(std::vector<std::any> listval) { int max_val = INT_MIN; for (auto& item : listval) { if (item.type() == typeid(int)) { int val = std::any_cast<int>(item); if (val > max_val) { max_val = val; } } } return max_val; }
int main() { assert(func0({ "Python", 3, 2, 4, 5, "version" }) == 5); assert(func0({ "Python", 15, 20, 25 }) == 25); assert(func0({ "Python", 30, 20, 40, 50, "version" }) == 50); return 0; }
O3
cpp
func0(std::vector<std::any, std::allocator<std::any> >): endbr64 push %r15 push %r14 push %r13 push %r12 push %rbp push %rbx sub $0x18,%rsp mov (%rdi),%rcx mov 0x8(%rdi),%r14 mov %fs:0x28,%rax mov %rax,0x8(%rsp) xor %eax,%eax cmp %r14,%rcx je 18d8 <_Z5func0St6vectorISt3anySaIS0_EE+0x128> mov 0x24df(%rip),%rbx mov %rcx,%r15 mov $0x80000000,%r12d mov %rsp,%rbp lea 0x24f4(%rip),%r13 nopl 0x0(%rax) mov (%r15),%r8 mov %r13,%rax test %r8,%r8 je 181d <_Z5func0St6vectorISt3anySaIS0_EE+0x6d> mov %rbp,%rdx mov %r15,%rsi mov $0x1,%edi callq *%r8 mov (%rsp),%rax mov 0x8(%rax),%rdi cmp %rbx,%rdi je 1837 <_Z5func0St6vectorISt3anySaIS0_EE+0x87> cmpb $0x2a,(%rdi) je 18a4 <_Z5func0St6vectorISt3anySaIS0_EE+0xf4> mov %rbx,%rsi callq 11d0 <strcmp@plt> test %eax,%eax jne 18a4 <_Z5func0St6vectorISt3anySaIS0_EE+0xf4> mov (%r15),%rax lea 0x13f(%rip),%rcx cmp %rcx,%rax je 1884 <_Z5func0St6vectorISt3anySaIS0_EE+0xd4> mov %r13,%rdx test %rax,%rax je 185f <_Z5func0St6vectorISt3anySaIS0_EE+0xaf> mov %rbp,%rdx mov %r15,%rsi mov $0x1,%edi callq *%rax mov (%rsp),%rdx mov 0x8(%rdx),%rdi cmp %rdi,%rbx je 1881 <_Z5func0St6vectorISt3anySaIS0_EE+0xd1> cmpb $0x2a,(%rdi) je 1240 <_Z5func0St6vectorISt3anySaIS0_EE.cold> mov %rbx,%rsi callq 11d0 <strcmp@plt> test %eax,%eax jne 1240 <_Z5func0St6vectorISt3anySaIS0_EE.cold> mov (%r15),%rax mov %rbp,%rdx mov %r15,%rsi xor %edi,%edi callq *%rax mov (%rsp),%rax test %rax,%rax je 1240 <_Z5func0St6vectorISt3anySaIS0_EE.cold> mov (%rax),%eax cmp %eax,%r12d cmovl %eax,%r12d add $0x10,%r15 cmp %r15,%r14 jne 1800 <_Z5func0St6vectorISt3anySaIS0_EE+0x50> mov 0x8(%rsp),%rax xor %fs:0x28,%rax jne 18e0 <_Z5func0St6vectorISt3anySaIS0_EE+0x130> add $0x18,%rsp mov %r12d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl 0x0(%rax,%rax,1) mov $0x80000000,%r12d jmp 18b1 <_Z5func0St6vectorISt3anySaIS0_EE+0x101> callq 11c0 <__stack_chk_fail@plt> nopw %cs:0x0(%rax,%rax,1)
_Z5func0St6vectorISt3anySaIS0_EE: endbr64 push r15 push r14 push r13 push r12 push rbp push rbx sub rsp, 18h mov rcx, [rdi] mov r12, [rdi+8] mov rax, fs:28h mov [rsp+48h+var_40], rax xor eax, eax cmp r12, rcx jz loc_1860 mov rbx, cs:qword_3CE8 mov r15, rcx mov r13d, 80000000h mov r14, rsp lea rbp, _ZTIv@CXXABI_1_3 nop dword ptr [rax+00h] loc_1750: mov r8, [r15] mov rax, rbp test r8, r8 jz short loc_176D mov rdx, r14 mov rsi, r15 mov edi, 1 call r8 mov rax, [rsp+48h+var_48] loc_176D: mov rdi, [rax+8]; s1 cmp rbx, rdi jz short loc_1798 cmp byte ptr [rdi], 2Ah ; '*' jz loc_182B xor esi, esi cmp byte ptr [rbx], 2Ah ; '*' setz sil add rsi, rbx; s2 call _strcmp test eax, eax jnz loc_182B loc_1798: mov rax, [r15] lea rcx, _ZNSt3any17_Manager_internalIiE9_S_manageENS_3_OpEPKS_PNS_4_ArgE; std::any::_Manager_internal<int>::_S_manage(std::any::_Op,std::any const*,std::any::_Arg *) cmp rax, rcx jz short loc_1820 mov rdx, rbp test rax, rax jz short loc_17C0 mov rdx, r14 mov rsi, r15 mov edi, 1 call rax mov rdx, [rsp+48h+var_48] loc_17C0: mov rdi, [rdx+8]; s1 cmp rbx, rdi jz short loc_1820 cmp byte ptr [rdi], 2Ah ; '*' jz short loc_17E3 xor esi, esi cmp byte ptr [rbx], 2Ah ; '*' setz sil add rsi, rbx; s2 call _strcmp test eax, eax jz short loc_1820 loc_17E3: mov edi, 8; thrown_size call ___cxa_allocate_exception mov rdi, rax; void * lea rax, off_3CB0 mov [rdi], rax mov rax, [rsp+48h+var_40] sub rax, fs:28h jnz short loc_1868 lea rdx, _ZNSt12bad_any_castD2Ev; void (*)(void *) lea rsi, _ZTISt12bad_any_cast; lptinfo call ___cxa_throw loc_1820: mov eax, [r15+8] cmp r13d, eax cmovl r13d, eax loc_182B: add r15, 10h cmp r12, r15 jnz loc_1750 loc_1838: mov rax, [rsp+48h+var_40] sub rax, fs:28h jnz short loc_1868 add rsp, 18h mov eax, r13d pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 retn loc_1860: mov r13d, 80000000h jmp short loc_1838 loc_1868: call ___stack_chk_fail
long long func0(long long *a1) { long long v1; // rcx long long v2; // r12 long long v3; // r15 unsigned int v4; // r13d void *v5; // rax int *v6; // rdi void ( *v7)(long long, long long, _QWORD *); // rax void *v8; // rdx int *v9; // rdi _QWORD *exception; // rdi _QWORD v12[9]; // [rsp+0h] [rbp-48h] BYREF v1 = *a1; v2 = a1[1]; v12[1] = __readfsqword(0x28u); if ( v2 == v1 ) { return 0x80000000; } else { v3 = v1; v4 = 0x80000000; do { v5 = &`typeinfo for'void; if ( *(_QWORD *)v3 ) { (*(void ( **)(long long, long long, _QWORD *))v3)(1LL, v3, v12); v5 = (void *)v12[0]; } v6 = (int *)*((_QWORD *)v5 + 1); if ( &dword_0 == v6 || *(_BYTE *)v6 != 42 && !strcmp((const char *)v6, (const char *)&dword_0) ) { v7 = *(void ( **)(long long, long long, _QWORD *))v3; if ( *(long long ( **)())v3 != std::any::_Manager_internal<int>::_S_manage ) { v8 = &`typeinfo for'void; if ( v7 ) { v7(1LL, v3, v12); v8 = (void *)v12[0]; } v9 = (int *)*((_QWORD *)v8 + 1); if ( &dword_0 != v9 && (*(_BYTE *)v9 == 42 || strcmp((const char *)v9, (const char *)&dword_0)) ) { exception = __cxa_allocate_exception(8uLL); *exception = off_3CB0; __cxa_throw( exception, (struct type_info *)&`typeinfo for'std::bad_any_cast, std::bad_any_cast::~bad_any_cast); } } if ( (signed int)v4 < *(_DWORD *)(v3 + 8) ) v4 = *(_DWORD *)(v3 + 8); } v3 += 16LL; } while ( v2 != v3 ); } return v4; }
func0: ENDBR64 PUSH R15 PUSH R14 PUSH R13 PUSH R12 PUSH RBP PUSH RBX SUB RSP,0x18 MOV RCX,qword ptr [RDI] MOV R12,qword ptr [RDI + 0x8] MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x8],RAX XOR EAX,EAX CMP R12,RCX JZ 0x00101860 MOV RBX,qword ptr [0x00103ce8] MOV R15,RCX MOV R13D,0x80000000 MOV R14,RSP LEA RBP,[0x103d20] NOP dword ptr [RAX] LAB_00101750: MOV R8,qword ptr [R15] MOV RAX,RBP TEST R8,R8 JZ 0x0010176d MOV RDX,R14 MOV RSI,R15 MOV EDI,0x1 CALL R8 MOV RAX,qword ptr [RSP] LAB_0010176d: MOV RDI,qword ptr [RAX + 0x8] CMP RBX,RDI JZ 0x00101798 CMP byte ptr [RDI],0x2a JZ 0x0010182b XOR ESI,ESI CMP byte ptr [RBX],0x2a SETZ SIL ADD RSI,RBX CALL 0x00101180 TEST EAX,EAX JNZ 0x0010182b LAB_00101798: MOV RAX,qword ptr [R15] LEA RCX,[0x1018f0] CMP RAX,RCX JZ 0x00101820 MOV RDX,RBP TEST RAX,RAX JZ 0x001017c0 MOV RDX,R14 MOV RSI,R15 MOV EDI,0x1 CALL RAX MOV RDX,qword ptr [RSP] LAB_001017c0: MOV RDI,qword ptr [RDX + 0x8] CMP RBX,RDI JZ 0x00101820 CMP byte ptr [RDI],0x2a JZ 0x001017e3 XOR ESI,ESI CMP byte ptr [RBX],0x2a SETZ SIL ADD RSI,RBX CALL 0x00101180 TEST EAX,EAX JZ 0x00101820 LAB_001017e3: MOV EDI,0x8 CALL 0x00101120 MOV RDI,RAX LEA RAX,[0x103cb0] MOV qword ptr [RDI],RAX MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101868 LEA RDX,[0x101960] LEA RSI,[0x103d30] LAB_00101818: CALL 0x001011c0 LAB_00101820: MOV EAX,dword ptr [R15 + 0x8] CMP R13D,EAX CMOVL R13D,EAX LAB_0010182b: ADD R15,0x10 CMP R12,R15 JNZ 0x00101750 LAB_00101838: MOV RAX,qword ptr [RSP + 0x8] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101868 ADD RSP,0x18 MOV EAX,R13D POP RBX POP RBP POP R12 POP R13 POP R14 POP R15 RET LAB_00101860: MOV R13D,0x80000000 JMP 0x00101838 LAB_00101868: CALL 0x00101170
/* func0(std::vector<std::any, std::allocator<std::any> >) */ int func0(vector param_1) { int8 *puVar1; char *pcVar2; code *pcVar3; int8 uVar4; int iVar5; int1 *puVar6; int8 *puVar7; int4 in_register_0000003c; int iVar8; long in_FS_OFFSET; int1 *local_48; long local_40; uVar4 = int::typeinfo._8_8_; puVar7 = *(int8 **)CONCAT44(in_register_0000003c,param_1); puVar1 = (int8 *)((long *)CONCAT44(in_register_0000003c,param_1))[1]; local_40 = *(long *)(in_FS_OFFSET + 0x28); if (puVar1 == puVar7) { iVar8 = -0x80000000; } else { iVar8 = -0x80000000; do { puVar6 = void::typeinfo; if ((code *)*puVar7 != (code *)0x0) { (*(code *)*puVar7)(1,puVar7,&local_48); puVar6 = local_48; } pcVar2 = *(char **)(puVar6 + 8); if ((char *)uVar4 == pcVar2) { LAB_00101798: pcVar3 = (code *)*puVar7; if (pcVar3 != std::any::_Manager_internal<int>::_S_manage) { puVar6 = void::typeinfo; if (pcVar3 != (code *)0x0) { (*pcVar3)(1,puVar7,&local_48); puVar6 = local_48; } pcVar2 = *(char **)(puVar6 + 8); if ((char *)uVar4 != pcVar2) { if (*pcVar2 != '*') { iVar5 = strcmp(pcVar2,(char *)((ulong)(*(char *)uVar4 == '*') + uVar4)); if (iVar5 == 0) goto LAB_00101820; } puVar7 = (int8 *)__cxa_allocate_exception(8); *puVar7 = &PTR__bad_any_cast_00103cb0; if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __cxa_throw(puVar7,&std::bad_any_cast::typeinfo,std::bad_any_cast::~bad_any_cast); } goto LAB_00101868; } } LAB_00101820: if (iVar8 < *(int *)(puVar7 + 1)) { iVar8 = *(int *)(puVar7 + 1); } } else if (*pcVar2 != '*') { iVar5 = strcmp(pcVar2,(char *)((ulong)(*(char *)uVar4 == '*') + uVar4)); if (iVar5 == 0) goto LAB_00101798; } puVar7 = puVar7 + 2; } while (puVar1 != puVar7); } if (local_40 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar8; } LAB_00101868: /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,176
func0
#include <iostream> #include <vector> #include <cassert>
int func0(int number) { std::vector<int> divisors; divisors.push_back(1); for (int i = 2; i < number; i++) { if (number % i == 0) { divisors.push_back(i); } } int sum = 0; for (auto div : divisors) { sum += div; } return sum; }
int main() { assert(func0(8) == 7); assert(func0(12) == 16); assert(func0(7) == 1); return 0; }
O0
cpp
func0(int): endbr64 push %rbp mov %rsp,%rbp push %rbx sub $0x58,%rsp mov %edi,-0x54(%rbp) mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax lea -0x30(%rbp),%rax mov %rax,%rdi callq 14f6 <_ZNSt6vectorIiSaIiEEC1Ev> movl $0x1,-0x40(%rbp) lea -0x40(%rbp),%rdx lea -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 15fc <_ZNSt6vectorIiSaIiEE9push_backEOi> movl $0x2,-0x40(%rbp) mov -0x40(%rbp),%eax cmp %eax,-0x54(%rbp) jle 12ea <_Z5func0i+0x81> mov -0x40(%rbp),%ecx mov -0x54(%rbp),%eax cltd idiv %ecx mov %edx,%eax test %eax,%eax jne 12df <_Z5func0i+0x76> lea -0x40(%rbp),%rdx lea -0x30(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 1632 <_ZNSt6vectorIiSaIiEE9push_backERKi> mov -0x40(%rbp),%eax add $0x1,%eax mov %eax,-0x40(%rbp) jmp 12b5 <_Z5func0i+0x4c> movl $0x0,-0x50(%rbp) lea -0x30(%rbp),%rax mov %rax,-0x38(%rbp) mov -0x38(%rbp),%rax mov %rax,%rdi callq 16b2 <_ZNSt6vectorIiSaIiEE5beginEv> mov %rax,-0x48(%rbp) mov -0x38(%rbp),%rax mov %rax,%rdi callq 16fe <_ZNSt6vectorIiSaIiEE3endEv> mov %rax,-0x40(%rbp) lea -0x40(%rbp),%rdx lea -0x48(%rbp),%rax mov %rdx,%rsi mov %rax,%rdi callq 174e <_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_> test %al,%al je 1355 <_Z5func0i+0xec> lea -0x48(%rbp),%rax mov %rax,%rdi callq 17b2 <_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv> mov (%rax),%eax mov %eax,-0x4c(%rbp) mov -0x4c(%rbp),%eax add %eax,-0x50(%rbp) lea -0x48(%rbp),%rax mov %rax,%rdi callq 178e <_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv> jmp 1319 <_Z5func0i+0xb0> mov -0x50(%rbp),%ebx lea -0x30(%rbp),%rax mov %rax,%rdi callq 15b4 <_ZNSt6vectorIiSaIiEED1Ev> mov %ebx,%eax mov -0x18(%rbp),%rcx xor %fs:0x28,%rcx je 139a <_Z5func0i+0x131> jmp 1395 <_Z5func0i+0x12c> endbr64 mov %rax,%rbx lea -0x30(%rbp),%rax mov %rax,%rdi callq 15b4 <_ZNSt6vectorIiSaIiEED1Ev> mov %rbx,%rax mov %rax,%rdi callq 1170 <_Unwind_Resume@plt> callq 1140 <__stack_chk_fail@plt> add $0x58,%rsp pop %rbx pop %rbp retq
_Z5func0i: endbr64 push rbp mov rbp, rsp push rbx sub rsp, 58h mov [rbp+var_54], edi mov rax, fs:28h mov [rbp+var_18], rax xor eax, eax lea rax, [rbp+var_30] mov rdi, rax call _ZNSt6vectorIiSaIiEEC2Ev; std::vector<int>::vector(void) mov dword ptr [rbp+var_40], 1 lea rdx, [rbp+var_40] lea rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEE9push_backEOi; std::vector<int>::push_back(int &&) mov dword ptr [rbp+var_40], 2 jmp short loc_12C4 loc_1297: mov ecx, dword ptr [rbp+var_40] mov eax, [rbp+var_54] cdq idiv ecx mov ecx, edx mov eax, ecx test eax, eax jnz short loc_12BB lea rdx, [rbp+var_40] lea rax, [rbp+var_30] mov rsi, rdx mov rdi, rax call _ZNSt6vectorIiSaIiEE9push_backERKi; std::vector<int>::push_back(int const&) loc_12BB: mov eax, dword ptr [rbp+var_40] add eax, 1 mov dword ptr [rbp+var_40], eax loc_12C4: mov eax, dword ptr [rbp+var_40] cmp [rbp+var_54], eax jg short loc_1297 mov [rbp+var_50], 0 lea rax, [rbp+var_30] mov [rbp+var_38], rax mov rax, [rbp+var_38] mov rdi, rax call _ZNSt6vectorIiSaIiEE5beginEv; std::vector<int>::begin(void) mov [rbp+var_48], rax mov rax, [rbp+var_38] mov rdi, rax call _ZNSt6vectorIiSaIiEE3endEv; std::vector<int>::end(void) mov [rbp+var_40], rax jmp short loc_1320 loc_12FD: lea rax, [rbp+var_48] 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_4C], eax mov eax, [rbp+var_4C] add [rbp+var_50], eax lea rax, [rbp+var_48] mov rdi, rax call _ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv; __gnu_cxx::__normal_iterator<int *,std::vector<int>>::operator++(void) loc_1320: lea rdx, [rbp+var_40] lea rax, [rbp+var_48] 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_12FD mov ebx, [rbp+var_50] lea rax, [rbp+var_30] mov rdi, rax call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() mov eax, ebx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_1390 jmp short loc_138B endbr64 mov rbx, rax lea rax, [rbp+var_30] mov rdi, rax call _ZNSt6vectorIiSaIiEED2Ev; std::vector<int>::~vector() mov rax, rbx mov rdx, [rbp+var_18] sub rdx, fs:28h jz short loc_1383 call ___stack_chk_fail loc_1383: mov rdi, rax; struct _Unwind_Exception * call __Unwind_Resume loc_138B: call ___stack_chk_fail loc_1390: mov rbx, [rbp+var_8] leave retn
long long func0(int a1) { unsigned int v2; // [rsp+10h] [rbp-50h] long long v3; // [rsp+18h] [rbp-48h] BYREF long long v4; // [rsp+20h] [rbp-40h] BYREF _BYTE *v5; // [rsp+28h] [rbp-38h] _BYTE v6[24]; // [rsp+30h] [rbp-30h] BYREF unsigned long long v7; // [rsp+48h] [rbp-18h] v7 = __readfsqword(0x28u); std::vector<int>::vector(v6); LODWORD(v4) = 1; std::vector<int>::push_back(v6, &v4); LODWORD(v4) = 2; while ( a1 > (int)v4 ) { if ( !(a1 % (int)v4) ) std::vector<int>::push_back(v6, &v4); LODWORD(v4) = v4 + 1; } v2 = 0; v5 = v6; v3 = std::vector<int>::begin(v6); v4 = std::vector<int>::end(v5); while ( (unsigned __int8)__gnu_cxx::operator!=<int *,std::vector<int>>(&v3, &v4) ) { v2 += *(_DWORD *)__gnu_cxx::__normal_iterator<int *,std::vector<int>>::operator*(&v3); __gnu_cxx::__normal_iterator<int *,std::vector<int>>::operator++(&v3); } std::vector<int>::~vector(v6); return v2; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP PUSH RBX SUB RSP,0x58 MOV dword ptr [RBP + -0x54],EDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RBP + -0x18],RAX XOR EAX,EAX LEA RAX,[RBP + -0x30] MOV RDI,RAX CALL 0x001014a8 MOV dword ptr [RBP + -0x40],0x1 LEA RDX,[RBP + -0x40] LEA RAX,[RBP + -0x30] MOV RSI,RDX MOV RDI,RAX LAB_00101289: CALL 0x001015a6 MOV dword ptr [RBP + -0x40],0x2 JMP 0x001012c4 LAB_00101297: MOV ECX,dword ptr [RBP + -0x40] MOV EAX,dword ptr [RBP + -0x54] CDQ IDIV ECX MOV ECX,EDX MOV EAX,ECX TEST EAX,EAX JNZ 0x001012bb LEA RDX,[RBP + -0x40] LEA RAX,[RBP + -0x30] MOV RSI,RDX MOV RDI,RAX CALL 0x001015dc LAB_001012bb: MOV EAX,dword ptr [RBP + -0x40] ADD EAX,0x1 MOV dword ptr [RBP + -0x40],EAX LAB_001012c4: MOV EAX,dword ptr [RBP + -0x40] CMP dword ptr [RBP + -0x54],EAX JG 0x00101297 MOV dword ptr [RBP + -0x50],0x0 LEA RAX,[RBP + -0x30] MOV qword ptr [RBP + -0x38],RAX MOV RAX,qword ptr [RBP + -0x38] MOV RDI,RAX CALL 0x001016a8 MOV qword ptr [RBP + -0x48],RAX MOV RAX,qword ptr [RBP + -0x38] MOV RDI,RAX CALL 0x001016f4 MOV qword ptr [RBP + -0x40],RAX JMP 0x00101320 LAB_001012fd: LEA RAX,[RBP + -0x48] MOV RDI,RAX CALL 0x001017a8 MOV EAX,dword ptr [RAX] MOV dword ptr [RBP + -0x4c],EAX MOV EAX,dword ptr [RBP + -0x4c] ADD dword ptr [RBP + -0x50],EAX LEA RAX,[RBP + -0x48] MOV RDI,RAX CALL 0x00101784 LAB_00101320: LEA RDX,[RBP + -0x40] LEA RAX,[RBP + -0x48] MOV RSI,RDX MOV RDI,RAX CALL 0x00101744 TEST AL,AL JNZ 0x001012fd MOV EBX,dword ptr [RBP + -0x50] LEA RAX,[RBP + -0x30] MOV RDI,RAX CALL 0x0010154c MOV EAX,EBX MOV RDX,qword ptr [RBP + -0x18] SUB RDX,qword ptr FS:[0x28] JZ 0x00101390 JMP 0x0010138b LAB_0010138b: CALL 0x00101130 LAB_00101390: MOV RBX,qword ptr [RBP + -0x8] LEAVE RET
/* func0(int) */ int func0(int param_1) { bool bVar1; int *piVar2; long in_FS_OFFSET; int local_58; int8 local_50; int8 local_48; vector<int,std::allocator<int>> *local_40; 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_38); local_48._0_4_ = 1; /* try { // try from 00101289 to 001012ba has its CatchHandler @ 00101359 */ std::vector<int,std::allocator<int>>::push_back(local_38,(int *)&local_48); local_48 = CONCAT44(local_48._4_4_,2); while ((int)local_48 < param_1) { if (param_1 % (int)local_48 == 0) { std::vector<int,std::allocator<int>>::push_back(local_38,(int *)&local_48); } local_48 = CONCAT44(local_48._4_4_,(int)local_48 + 1); } local_58 = 0; local_40 = local_38; local_50 = std::vector<int,std::allocator<int>>::begin(local_40); local_48 = std::vector<int,std::allocator<int>>::end(local_40); while( true ) { bVar1 = operator!=((__normal_iterator *)&local_50,(__normal_iterator *)&local_48); if (!bVar1) break; piVar2 = (int *)__normal_iterator<int*,std::vector<int,std::allocator<int>>>::operator* ((__normal_iterator<int*,std::vector<int,std::allocator<int>>> *) &local_50); local_58 = local_58 + *piVar2; __normal_iterator<int*,std::vector<int,std::allocator<int>>>::operator++ ((__normal_iterator<int*,std::vector<int,std::allocator<int>>> *)&local_50); } std::vector<int,std::allocator<int>>::~vector(local_38); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return local_58; }
1,177
func0
#include <iostream> #include <vector> #include <cassert>
int func0(int number) { std::vector<int> divisors; divisors.push_back(1); for (int i = 2; i < number; i++) { if (number % i == 0) { divisors.push_back(i); } } int sum = 0; for (auto div : divisors) { sum += div; } return sum; }
int main() { assert(func0(8) == 7); assert(func0(12) == 16); assert(func0(7) == 1); return 0; }
O1
cpp
func0(int): endbr64 push %rbp push %rbx sub $0x38,%rsp mov %edi,%ebx mov %fs:0x28,%rax mov %rax,0x28(%rsp) xor %eax,%eax movq $0x0,0x10(%rsp) movq $0x0,0x18(%rsp) movq $0x0,0x20(%rsp) mov $0x4,%edi callq 1130 <_Znwm@plt> movl $0x1,(%rax) lea 0x4(%rax),%rdx mov %rax,0x10(%rsp) mov %rdx,0x18(%rsp) mov %rdx,0x20(%rsp) movl $0x2,0xc(%rsp) cmp $0x2,%ebx jle 1317 <_Z5func0i+0xae> mov $0x2,%ecx lea 0xc(%rsp),%rbp jmp 12f8 <_Z5func0i+0x8f> lea 0x10(%rsp),%rdi mov %rbp,%rdx callq 1456 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> mov 0xc(%rsp),%eax lea 0x1(%rax),%ecx mov %ecx,0xc(%rsp) cmp %ebx,%ecx jge 1317 <_Z5func0i+0xae> mov %ebx,%eax cltd idiv %ecx test %edx,%edx jne 12e9 <_Z5func0i+0x80> mov 0x18(%rsp),%rsi cmp 0x20(%rsp),%rsi je 12dc <_Z5func0i+0x73> mov %ecx,(%rsi) addq $0x4,0x18(%rsp) jmp 12e9 <_Z5func0i+0x80> mov 0x10(%rsp),%rdi mov 0x18(%rsp),%rdx cmp %rdx,%rdi je 135c <_Z5func0i+0xf3> mov %rdi,%rax mov $0x0,%ebx add (%rax),%ebx add $0x4,%rax cmp %rax,%rdx jne 132e <_Z5func0i+0xc5> test %rdi,%rdi je 1343 <_Z5func0i+0xda> callq 1120 <_ZdlPv@plt> mov 0x28(%rsp),%rax xor %fs:0x28,%rax jne 1381 <_Z5func0i+0x118> mov %ebx,%eax add $0x38,%rsp pop %rbx pop %rbp retq mov $0x0,%ebx jmp 1339 <_Z5func0i+0xd0> endbr64 mov %rax,%rbx mov 0x10(%rsp),%rdi test %rdi,%rdi je 1379 <_Z5func0i+0x110> callq 1120 <_ZdlPv@plt> mov %rbx,%rdi callq 1170 <_Unwind_Resume@plt> callq 1140 <__stack_chk_fail@plt>
_Z5func0i: endbr64 push rbp push rbx sub rsp, 38h mov ebp, edi mov rax, fs:28h mov [rsp+48h+var_20], rax xor eax, eax mov [rsp+48h+var_38], 0 mov [rsp+48h+var_30], 0 mov [rsp+48h+var_28], 0 mov edi, 4; unsigned __int64 call __Znwm; operator new(ulong) mov dword ptr [rax], 1 lea rdx, [rax+4] mov [rsp+48h+var_38], rax mov [rsp+48h+var_30], rdx mov [rsp+48h+var_28], rdx mov [rsp+48h+var_3C], 2 cmp ebp, 2 jle short loc_12D3 mov ebx, 2 jmp short loc_12B1 loc_1297: lea rdx, [rsp+48h+var_3C] lea rdi, [rsp+48h+var_38] 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&) loc_12A6: add ebx, 1 mov [rsp+48h+var_3C], ebx cmp ebx, ebp jz short loc_12D3 loc_12B1: mov eax, ebp cdq idiv ebx test edx, edx jnz short loc_12A6 mov rsi, [rsp+48h+var_30] cmp rsi, [rsp+48h+var_28] jz short loc_1297 mov [rsi], ebx add rsi, 4 mov [rsp+48h+var_30], rsi jmp short loc_12A6 loc_12D3: mov rdi, [rsp+48h+var_38]; void * mov rdx, [rsp+48h+var_30] cmp rdx, rdi jz short loc_1320 mov rax, rdi mov ebx, 0 loc_12EA: add ebx, [rax] add rax, 4 cmp rax, rdx jnz short loc_12EA loc_12F5: test rdi, rdi jz short loc_1307 mov rsi, [rsp+48h+var_28] sub rsi, rdi; unsigned __int64 call __ZdlPvm; operator delete(void *,ulong) loc_1307: mov rax, [rsp+48h+var_20] sub rax, fs:28h jnz short loc_1362 mov eax, ebx add rsp, 38h pop rbx pop rbp retn loc_1320: mov ebx, 0 jmp short loc_12F5 endbr64 mov rbx, rax mov rdi, [rsp+arg_8]; void * mov rsi, [rsp+arg_18] sub rsi, rdi; unsigned __int64 test rdi, rdi jz short loc_1345 call __ZdlPvm; operator delete(void *,ulong) loc_1345: mov rax, [rsp+arg_20] sub rax, fs:28h jz short loc_135A call ___stack_chk_fail loc_135A: mov rdi, rbx; struct _Unwind_Exception * call __Unwind_Resume loc_1362: call ___stack_chk_fail
long long func0(int a1) { int *v1; // rax int i; // ebx int *v3; // rsi int *v4; // rax unsigned int v5; // ebx int v7; // [rsp+Ch] [rbp-3Ch] BYREF void *v8; // [rsp+10h] [rbp-38h] BYREF int *v9; // [rsp+18h] [rbp-30h] int *v10; // [rsp+20h] [rbp-28h] unsigned long long v11; // [rsp+28h] [rbp-20h] v11 = __readfsqword(0x28u); v1 = (int *)operator new(4uLL); *v1 = 1; v8 = v1; v9 = v1 + 1; v10 = v1 + 1; v7 = 2; if ( a1 > 2 ) { for ( i = 2; i != a1; v7 = i ) { if ( !(a1 % i) ) { v3 = v9; if ( v9 == v10 ) { std::vector<int>::_M_realloc_insert<int const&>(&v8, v9, &v7); } else { *v9 = i; v9 = v3 + 1; } } ++i; } } if ( v9 == v8 ) { v5 = 0; } else { v4 = (int *)v8; v5 = 0; do v5 += *v4++; while ( v4 != v9 ); } if ( v8 ) operator delete(v8, (char *)v10 - (_BYTE *)v8); return v5; }
func0: ENDBR64 PUSH RBP PUSH RBX SUB RSP,0x38 MOV EBP,EDI MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x28],RAX XOR EAX,EAX MOV qword ptr [RSP + 0x10],0x0 MOV qword ptr [RSP + 0x18],0x0 MOV qword ptr [RSP + 0x20],0x0 MOV EDI,0x4 LAB_00101265: CALL 0x001010f0 MOV dword ptr [RAX],0x1 LEA RDX,[RAX + 0x4] MOV qword ptr [RSP + 0x10],RAX MOV qword ptr [RSP + 0x18],RDX MOV qword ptr [RSP + 0x20],RDX MOV dword ptr [RSP + 0xc],0x2 CMP EBP,0x2 JLE 0x001012d3 MOV EBX,0x2 JMP 0x001012b1 LAB_00101297: LEA RDX,[RSP + 0xc] LEA RDI,[RSP + 0x10] CALL 0x00101404 LAB_001012a6: ADD EBX,0x1 MOV dword ptr [RSP + 0xc],EBX CMP EBX,EBP JZ 0x001012d3 LAB_001012b1: MOV EAX,EBP CDQ IDIV EBX TEST EDX,EDX JNZ 0x001012a6 MOV RSI,qword ptr [RSP + 0x18] CMP RSI,qword ptr [RSP + 0x20] JZ 0x00101297 MOV dword ptr [RSI],EBX ADD RSI,0x4 MOV qword ptr [RSP + 0x18],RSI JMP 0x001012a6 LAB_001012d3: MOV RDI,qword ptr [RSP + 0x10] MOV RDX,qword ptr [RSP + 0x18] CMP RDX,RDI JZ 0x00101320 MOV RAX,RDI MOV EBX,0x0 LAB_001012ea: ADD EBX,dword ptr [RAX] ADD RAX,0x4 CMP RAX,RDX JNZ 0x001012ea LAB_001012f5: TEST RDI,RDI JZ 0x00101307 MOV RSI,qword ptr [RSP + 0x20] SUB RSI,RDI CALL 0x00101100 LAB_00101307: MOV RAX,qword ptr [RSP + 0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101362 MOV EAX,EBX ADD RSP,0x38 POP RBX POP RBP RET LAB_00101320: MOV EBX,0x0 JMP 0x001012f5 LAB_00101362: CALL 0x00101110
/* func0(int) */ int func0(int param_1) { int *piVar1; int iVar2; long in_FS_OFFSET; int local_3c; int *local_38; int *local_30; int *local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_38 = (int *)0x0; local_30 = (int *)0x0; local_28 = (int *)0x0; /* try { // try from 00101265 to 001012a5 has its CatchHandler @ 00101327 */ local_38 = (int *)operator_new(4); *local_38 = 1; local_30 = local_38 + 1; local_3c = 2; local_28 = local_30; if (2 < param_1) { do { iVar2 = local_3c; if (param_1 % local_3c == 0) { if (local_30 == local_28) { std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)&local_38,(__normal_iterator)local_30, &local_3c); } else { *local_30 = local_3c; local_30 = local_30 + 1; } } local_3c = iVar2 + 1; } while (local_3c != param_1); } if (local_30 == local_38) { iVar2 = 0; } else { iVar2 = 0; piVar1 = local_38; do { iVar2 = iVar2 + *piVar1; piVar1 = piVar1 + 1; } while (piVar1 != local_30); } if (local_38 != (int *)0x0) { operator_delete(local_38,(long)local_28 - (long)local_38); } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return iVar2; }
1,178
func0
#include <iostream> #include <vector> #include <cassert>
int func0(int number) { std::vector<int> divisors; divisors.push_back(1); for (int i = 2; i < number; i++) { if (number % i == 0) { divisors.push_back(i); } } int sum = 0; for (auto div : divisors) { sum += div; } return sum; }
int main() { assert(func0(8) == 7); assert(func0(12) == 16); assert(func0(7) == 1); return 0; }
O2
cpp
func0(int): endbr64 push %r15 xor %esi,%esi push %r14 push %r13 push %r12 push %rbp mov %edi,%ebp push %rbx sub $0x48,%rsp mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax lea 0x1c(%rsp),%rdx lea 0x20(%rsp),%rdi movq $0x0,0x20(%rsp) movq $0x0,0x28(%rsp) movq $0x0,0x30(%rsp) movl $0x1,0x1c(%rsp) callq 1580 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> mov 0x20(%rsp),%r12 mov 0x28(%rsp),%r14 cmp $0x2,%ebp jle 141a <_Z5func0i+0xaa> movabs $0x1fffffffffffffff,%r15 mov $0x2,%ebx jmp 13f7 <_Z5func0i+0x87> nopl 0x0(%rax,%rax,1) add $0x1,%ebx cmp %ebp,%ebx je 141a <_Z5func0i+0xaa> mov %ebp,%eax cltd idiv %ebx test %edx,%edx jne 13f0 <_Z5func0i+0x80> cmp 0x30(%rsp),%r14 je 1470 <_Z5func0i+0x100> mov %ebx,(%r14) add $0x4,%r14 add $0x1,%ebx mov %r14,0x28(%rsp) cmp %ebp,%ebx jne 13f7 <_Z5func0i+0x87> cmp %r12,%r14 je 1538 <_Z5func0i+0x1c8> mov %r12,%rax xor %r13d,%r13d nopl 0x0(%rax) add (%rax),%r13d add $0x4,%rax cmp %rax,%r14 jne 1430 <_Z5func0i+0xc0> test %r12,%r12 je 1449 <_Z5func0i+0xd9> mov %r12,%rdi callq 1120 <_ZdlPv@plt> mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 1554 <_Z5func0i+0x1e4> add $0x48,%rsp mov %r13d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq sub %r12,%r14 mov %r14,%rax mov %r14,%r13 sar $0x2,%rax cmp %r15,%rax je 1559 <_Z5func0i+0x1e9> test %rax,%rax je 1528 <_Z5func0i+0x1b8> movabs $0x7ffffffffffffffc,%r14 lea (%rax,%rax,1),%rdx cmp %rdx,%rax jbe 1518 <_Z5func0i+0x1a8> mov %r14,%rdi callq 1130 <_Znwm@plt> mov %rax,%rcx lea (%rax,%r14,1),%r8 mov %ebx,(%rcx,%r13,1) lea 0x4(%rcx,%r13,1),%r14 test %r13,%r13 jg 14e0 <_Z5func0i+0x170> test %r12,%r12 jne 14f9 <_Z5func0i+0x189> mov %rcx,0x20(%rsp) mov %rcx,%r12 mov %r14,0x28(%rsp) mov %r8,0x30(%rsp) jmpq 13f0 <_Z5func0i+0x80> nopl 0x0(%rax,%rax,1) mov %rcx,%rdi mov %r13,%rdx mov %r12,%rsi mov %r8,(%rsp) callq 1160 <memmove@plt> mov (%rsp),%r8 mov %rax,%rcx mov %r12,%rdi mov %r8,0x8(%rsp) mov %rcx,(%rsp) callq 1120 <_ZdlPv@plt> mov 0x8(%rsp),%r8 mov (%rsp),%rcx jmp 14c4 <_Z5func0i+0x154> nopl (%rax) test %rdx,%rdx jne 1540 <_Z5func0i+0x1d0> xor %r8d,%r8d xor %ecx,%ecx jmp 14b1 <_Z5func0i+0x141> nopl 0x0(%rax) mov $0x4,%r14d jmpq 14a2 <_Z5func0i+0x132> nopl 0x0(%rax,%rax,1) xor %r13d,%r13d jmpq 143c <_Z5func0i+0xcc> cmp %r15,%rdx cmova %r15,%rdx lea 0x0(,%rdx,4),%r14 jmpq 14a2 <_Z5func0i+0x132> callq 1140 <__stack_chk_fail@plt> lea 0xaa4(%rip),%rdi callq 10e0 <_ZSt20__throw_length_errorPKc@plt> endbr64 mov %rax,%rbp jmpq 1180 <_Z5func0i.cold> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
_Z5func0i: endbr64 push rbp pxor xmm0, xmm0 mov ebp, edi mov edi, 4; unsigned __int64 push rbx sub rsp, 38h mov rax, fs:28h mov [rsp+48h+var_20], rax xor eax, eax movaps xmmword ptr [rsp+48h+var_38], xmm0 mov [rsp+48h+var_28], 0 call __Znwm; operator new(ulong) lea rcx, [rax+4] mov dword ptr [rax], 1 mov ebx, 2 mov [rsp+48h+var_38], rax mov rsi, rcx mov [rsp+48h+var_38+8], rcx mov [rsp+48h+var_28], rcx mov [rsp+48h+var_3C], 2 cmp ebp, 2 jg short loc_138B jmp loc_1420 loc_1380: add ebx, 1 mov [rsp+48h+var_3C], ebx cmp ebx, ebp jz short loc_13AF loc_138B: mov eax, ebp cdq idiv ebx test edx, edx jnz short loc_1380 cmp rsi, rcx jz short loc_1400 mov [rcx], ebx add rcx, 4 add ebx, 1 mov [rsp+48h+var_38+8], rcx mov [rsp+48h+var_3C], ebx cmp ebx, ebp jnz short loc_138B loc_13AF: mov rax, [rsp+48h+var_38] sub rsi, rax; unsigned __int64 cmp rcx, rax jz short loc_1430 loc_13BC: mov rdx, rax xor ebx, ebx nop dword ptr [rax+00000000h] loc_13C8: add ebx, [rdx] add rdx, 4 cmp rcx, rdx jnz short loc_13C8 loc_13D3: test rax, rax jz short loc_13E0 mov rdi, rax; void * call __ZdlPvm; operator delete(void *,ulong) loc_13E0: mov rax, [rsp+48h+var_20] sub rax, fs:28h jnz short loc_1434 add rsp, 38h mov eax, ebx pop rbx pop rbp retn loc_1400: lea rdx, [rsp+48h+var_3C] lea rdi, [rsp+48h+var_38] 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 rcx, [rsp+48h+var_38+8] mov rsi, [rsp+48h+var_28] jmp loc_1380 loc_1420: mov esi, 4 jmp short loc_13BC loc_1430: xor ebx, ebx jmp short loc_13D3 loc_1434: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0i_cold; func0(int) [clone]
long long func0(int a1) { char *v1; // rax char *v2; // rcx int v3; // ebx char *v4; // rsi char *v5; // rdx unsigned int v6; // ebx unsigned long long v8; // rsi int v9; // [rsp+Ch] [rbp-3Ch] BYREF void *v10[2]; // [rsp+10h] [rbp-38h] BYREF char *v11; // [rsp+20h] [rbp-28h] unsigned long long v12; // [rsp+28h] [rbp-20h] v12 = __readfsqword(0x28u); v1 = (char *)operator new(4uLL); v2 = v1 + 4; *(_DWORD *)v1 = 1; v3 = 2; v10[0] = v1; v4 = v1 + 4; v10[1] = v1 + 4; v11 = v1 + 4; v9 = 2; if ( a1 <= 2 ) { v8 = 4LL; LABEL_8: v5 = v1; v6 = 0; do { v6 += *(_DWORD *)v5; v5 += 4; } while ( v2 != v5 ); goto LABEL_10; } do { while ( a1 % v3 ) { LABEL_3: v9 = ++v3; if ( v3 == a1 ) goto LABEL_7; } if ( v4 == v2 ) { std::vector<int>::_M_realloc_insert<int const&>(v10, v4, &v9); v2 = (char *)v10[1]; v4 = v11; goto LABEL_3; } *(_DWORD *)v2 = v3; v2 += 4; ++v3; v10[1] = v2; v9 = v3; } while ( v3 != a1 ); LABEL_7: v1 = (char *)v10[0]; v8 = v4 - (char *)v10[0]; if ( v2 != v10[0] ) goto LABEL_8; v6 = 0; LABEL_10: if ( v1 ) operator delete(v1, v8); return v6; }
func0: ENDBR64 PUSH RBP PXOR XMM0,XMM0 MOV EBP,EDI MOV EDI,0x4 PUSH RBX SUB RSP,0x38 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x28],RAX XOR EAX,EAX MOVAPS xmmword ptr [RSP + 0x10],XMM0 MOV qword ptr [RSP + 0x20],0x0 LAB_00101343: CALL 0x001010f0 LEA RCX,[RAX + 0x4] MOV dword ptr [RAX],0x1 MOV EBX,0x2 MOV qword ptr [RSP + 0x10],RAX MOV RSI,RCX MOV qword ptr [RSP + 0x18],RCX MOV qword ptr [RSP + 0x20],RCX MOV dword ptr [RSP + 0xc],0x2 CMP EBP,0x2 JG 0x0010138b JMP 0x00101420 LAB_00101380: ADD EBX,0x1 MOV dword ptr [RSP + 0xc],EBX CMP EBX,EBP JZ 0x001013af LAB_0010138b: MOV EAX,EBP CDQ IDIV EBX TEST EDX,EDX JNZ 0x00101380 CMP RSI,RCX JZ 0x00101400 MOV dword ptr [RCX],EBX ADD RCX,0x4 ADD EBX,0x1 MOV qword ptr [RSP + 0x18],RCX MOV dword ptr [RSP + 0xc],EBX CMP EBX,EBP JNZ 0x0010138b LAB_001013af: MOV RAX,qword ptr [RSP + 0x10] SUB RSI,RAX CMP RCX,RAX JZ 0x00101430 LAB_001013bc: MOV RDX,RAX XOR EBX,EBX NOP dword ptr [RAX] LAB_001013c8: ADD EBX,dword ptr [RDX] ADD RDX,0x4 CMP RCX,RDX JNZ 0x001013c8 LAB_001013d3: TEST RAX,RAX JZ 0x001013e0 MOV RDI,RAX CALL 0x00101100 LAB_001013e0: MOV RAX,qword ptr [RSP + 0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x00101434 ADD RSP,0x38 MOV EAX,EBX POP RBX POP RBP RET LAB_00101400: LEA RDX,[RSP + 0xc] LEA RDI,[RSP + 0x10] CALL 0x00101450 MOV RCX,qword ptr [RSP + 0x18] MOV RSI,qword ptr [RSP + 0x20] JMP 0x00101380 LAB_00101420: MOV ESI,0x4 JMP 0x001013bc LAB_00101430: XOR EBX,EBX JMP 0x001013d3 LAB_00101434: CALL 0x00101110
/* func0(int) */ int func0(int param_1) { int *piVar1; int *piVar2; int iVar3; ulong uVar4; long in_FS_OFFSET; int local_3c; int local_38 [16]; int *local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_38 = (int [16])0x0; local_28 = (int *)0x0; /* try { // try from 00101343 to 0010140e has its CatchHandler @ 00101439 */ local_38._0_8_ = operator_new(4); piVar1 = (int *)(local_38._0_8_ + 4); *(int *)local_38._0_8_ = 1; local_3c = 2; piVar2 = piVar1; local_28 = piVar1; local_38._8_8_ = piVar1; if (param_1 < 3) { uVar4 = 4; } else { LAB_0010138b: do { iVar3 = local_3c; if (param_1 % local_3c == 0) { if (piVar2 != piVar1) { *piVar1 = local_3c; piVar1 = piVar1 + 1; local_3c = local_3c + 1; local_38._8_8_ = piVar1; if (local_3c == param_1) break; goto LAB_0010138b; } std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)local_38,(__normal_iterator)piVar2,&local_3c); piVar1 = (int *)local_38._8_8_; piVar2 = local_28; } local_3c = iVar3 + 1; } while (local_3c != param_1); local_3c = iVar3 + 1; uVar4 = (long)piVar2 - local_38._0_8_; if (piVar1 == (int *)local_38._0_8_) { iVar3 = 0; goto LAB_001013d3; } } iVar3 = 0; piVar2 = (int *)local_38._0_8_; do { iVar3 = iVar3 + *piVar2; piVar2 = piVar2 + 1; } while (piVar1 != piVar2); LAB_001013d3: if ((int *)local_38._0_8_ != (int *)0x0) { operator_delete((void *)local_38._0_8_,uVar4); } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar3; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,179
func0
#include <iostream> #include <vector> #include <cassert>
int func0(int number) { std::vector<int> divisors; divisors.push_back(1); for (int i = 2; i < number; i++) { if (number % i == 0) { divisors.push_back(i); } } int sum = 0; for (auto div : divisors) { sum += div; } return sum; }
int main() { assert(func0(8) == 7); assert(func0(12) == 16); assert(func0(7) == 1); return 0; }
O3
cpp
func0(int): endbr64 push %r15 pxor %xmm0,%xmm0 xor %esi,%esi push %r14 push %r13 push %r12 push %rbp mov %edi,%ebp push %rbx sub $0x48,%rsp mov %fs:0x28,%rax mov %rax,0x38(%rsp) xor %eax,%eax lea 0x1c(%rsp),%rdx lea 0x20(%rsp),%rdi movq $0x0,0x30(%rsp) movl $0x1,0x1c(%rsp) movaps %xmm0,0x20(%rsp) callq 1610 <_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_> mov 0x20(%rsp),%r12 mov 0x28(%rsp),%r14 cmp $0x2,%ebp jle 140e <_Z5func0i+0x9e> movabs $0x1fffffffffffffff,%r15 mov $0x2,%ebx jmp 13e7 <_Z5func0i+0x77> add $0x1,%ebx cmp %ebp,%ebx je 140e <_Z5func0i+0x9e> mov %ebp,%eax cltd idiv %ebx test %edx,%edx jne 13e0 <_Z5func0i+0x70> cmp %r14,0x30(%rsp) je 14f0 <_Z5func0i+0x180> mov %ebx,(%r14) add $0x4,%r14 add $0x1,%ebx mov %r14,0x28(%rsp) cmp %ebp,%ebx jne 13e7 <_Z5func0i+0x77> cmp %r14,%r12 je 15c0 <_Z5func0i+0x250> lea -0x4(%r14),%rdx mov %r12,%rax movabs $0x3ffffffffffffffc,%rsi sub %r12,%rdx shr $0x2,%rdx lea 0x1(%rdx),%rcx test %rsi,%rdx je 15c8 <_Z5func0i+0x258> mov %rcx,%rdx pxor %xmm0,%xmm0 shr $0x2,%rdx shl $0x4,%rdx add %r12,%rdx xchg %ax,%ax movdqu (%rax),%xmm2 add $0x10,%rax paddd %xmm2,%xmm0 cmp %rdx,%rax jne 1450 <_Z5func0i+0xe0> movdqa %xmm0,%xmm1 mov %rcx,%rdx psrldq $0x8,%xmm1 and $0xfffffffffffffffc,%rdx paddd %xmm1,%xmm0 lea (%r12,%rdx,4),%rax movdqa %xmm0,%xmm1 psrldq $0x4,%xmm1 paddd %xmm1,%xmm0 movd %xmm0,%r13d cmp %rcx,%rdx je 14ba <_Z5func0i+0x14a> lea 0x4(%rax),%rdx add (%rax),%r13d cmp %rdx,%r14 je 14ba <_Z5func0i+0x14a> lea 0x8(%rax),%rdx add 0x4(%rax),%r13d cmp %rdx,%r14 je 14ba <_Z5func0i+0x14a> lea 0xc(%rax),%rdx add 0x8(%rax),%r13d cmp %rdx,%r14 je 14ba <_Z5func0i+0x14a> add 0xc(%rax),%r13d test %r12,%r12 je 14c7 <_Z5func0i+0x157> mov %r12,%rdi callq 1120 <_ZdlPv@plt> mov 0x38(%rsp),%rax xor %fs:0x28,%rax jne 15f0 <_Z5func0i+0x280> add $0x48,%rsp mov %r13d,%eax pop %rbx pop %rbp pop %r12 pop %r13 pop %r14 pop %r15 retq nopl (%rax) sub %r12,%r14 mov %r14,%rax mov %r14,%r13 sar $0x2,%rax cmp %r15,%rax je 15e4 <_Z5func0i+0x274> test %rax,%rax je 15b0 <_Z5func0i+0x240> movabs $0x7ffffffffffffffc,%r14 lea (%rax,%rax,1),%rdx cmp %rdx,%rax jbe 15a0 <_Z5func0i+0x230> mov %r14,%rdi callq 1130 <_Znwm@plt> mov %rax,%rcx lea (%rax,%r14,1),%r8 mov %ebx,(%rcx,%r13,1) lea 0x4(%rcx,%r13,1),%r14 test %r13,%r13 jg 1568 <_Z5func0i+0x1f8> test %r12,%r12 jne 1581 <_Z5func0i+0x211> movq %rcx,%xmm0 movq %r14,%xmm3 mov %r8,0x30(%rsp) mov %rcx,%r12 punpcklqdq %xmm3,%xmm0 movaps %xmm0,0x20(%rsp) jmpq 13e0 <_Z5func0i+0x70> nopl 0x0(%rax) mov %rcx,%rdi mov %r13,%rdx mov %r12,%rsi mov %r8,(%rsp) callq 1160 <memmove@plt> mov (%rsp),%r8 mov %rax,%rcx mov %r12,%rdi mov %rcx,0x8(%rsp) mov %r8,(%rsp) callq 1120 <_ZdlPv@plt> mov 0x8(%rsp),%rcx mov (%rsp),%r8 jmp 1544 <_Z5func0i+0x1d4> nopl (%rax) test %rdx,%rdx jne 15d0 <_Z5func0i+0x260> xor %r8d,%r8d xor %ecx,%ecx jmp 1531 <_Z5func0i+0x1c1> nopl 0x0(%rax) mov $0x4,%r14d jmpq 1522 <_Z5func0i+0x1b2> nopl 0x0(%rax,%rax,1) xor %r13d,%r13d jmpq 14ba <_Z5func0i+0x14a> xor %r13d,%r13d jmpq 1490 <_Z5func0i+0x120> cmp %r15,%rdx cmova %r15,%rdx lea 0x0(,%rdx,4),%r14 jmpq 1522 <_Z5func0i+0x1b2> lea 0xa19(%rip),%rdi callq 10e0 <_ZSt20__throw_length_errorPKc@plt> callq 1140 <__stack_chk_fail@plt> endbr64 mov %rax,%rbp jmpq 1180 <_Z5func0i.cold> nopw %cs:0x0(%rax,%rax,1) nopl 0x0(%rax,%rax,1)
_Z5func0i: endbr64 push rbp pxor xmm0, xmm0 mov ebp, edi mov edi, 4; unsigned __int64 push rbx sub rsp, 38h mov rax, fs:28h mov [rsp+48h+var_20], rax xor eax, eax movaps xmmword ptr [rsp+48h+var_38], xmm0 mov [rsp+48h+var_28], 0 call __Znwm; operator new(ulong) lea rcx, [rax+4] mov [rsp+48h+var_38], rax mov rdi, rax mov ebx, 2 mov dword ptr [rax], 1 mov rsi, rcx mov [rsp+48h+var_38+8], rcx mov [rsp+48h+var_28], rcx mov [rsp+48h+var_3C], 2 cmp ebp, 2 jg short loc_138B jmp loc_14A0 loc_1380: add ebx, 1 mov [rsp+48h+var_3C], ebx cmp ebx, ebp jz short loc_13B3 loc_138B: mov eax, ebp cdq idiv ebx test edx, edx jnz short loc_1380 cmp rsi, rcx jz loc_1478 mov [rcx], ebx add rcx, 4 add ebx, 1 mov [rsp+48h+var_38+8], rcx mov [rsp+48h+var_3C], ebx cmp ebx, ebp jnz short loc_138B loc_13B3: mov rdi, [rsp+48h+var_38]; void * sub rsi, rdi; unsigned __int64 cmp rcx, rdi jz loc_14B0 loc_13C4: lea rdx, [rcx-4] mov rax, rdi sub rdx, rdi mov r8, rdx shr r8, 2 add r8, 1 cmp rdx, 8 jbe loc_14B4 mov rdx, r8 pxor xmm0, xmm0 shr rdx, 2 shl rdx, 4 add rdx, rdi nop dword ptr [rax] loc_13F8: movdqu xmm2, xmmword ptr [rax] add rax, 10h paddd xmm0, xmm2 cmp rax, rdx jnz short loc_13F8 movdqa xmm1, xmm0 mov rax, r8 psrldq xmm1, 8 and rax, 0FFFFFFFFFFFFFFFCh and r8d, 3 paddd xmm0, xmm1 lea rax, [rdi+rax*4] movdqa xmm1, xmm0 psrldq xmm1, 4 paddd xmm0, xmm1 movd ebx, xmm0 jz short loc_1452 loc_1438: lea rdx, [rax+4] add ebx, [rax] cmp rcx, rdx jz short loc_1452 lea rdx, [rax+8] add ebx, [rax+4] cmp rcx, rdx jz short loc_1452 add ebx, [rax+8] loc_1452: test rdi, rdi jz short loc_145C call __ZdlPvm; operator delete(void *,ulong) loc_145C: mov rax, [rsp+48h+var_20] sub rax, fs:28h jnz short loc_14B8 add rsp, 38h mov eax, ebx pop rbx pop rbp retn loc_1478: lea rdx, [rsp+48h+var_3C] lea rdi, [rsp+48h+var_38] 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 rcx, [rsp+48h+var_38+8] mov rsi, [rsp+48h+var_28] jmp loc_1380 loc_14A0: mov esi, 4 jmp loc_13C4 loc_14B0: xor ebx, ebx jmp short loc_1452 loc_14B4: xor ebx, ebx jmp short loc_1438 loc_14B8: call ___stack_chk_fail endbr64 mov rbx, rax jmp _Z5func0i_cold; func0(int) [clone]
long long func0(int a1) { _DWORD *v2; // rax unsigned long long *v3; // rcx __m128i *v4; // rdi int v5; // ebx unsigned long long *v6; // rsi const __m128i *v7; // rax unsigned long long v8; // r8 __m128i v9; // xmm0 __m128i v10; // xmm2 __m128i v11; // xmm0 unsigned int v12; // ebx unsigned long long v14; // rsi int v15; // [rsp+Ch] [rbp-3Ch] BYREF void *v16[2]; // [rsp+10h] [rbp-38h] BYREF unsigned long long *v17; // [rsp+20h] [rbp-28h] unsigned long long v18; // [rsp+28h] [rbp-20h] v18 = __readfsqword(0x28u); v2 = (_DWORD *)operator new(4uLL); v3 = (unsigned long long *)(v2 + 1); v16[0] = v2; v4 = (__m128i *)v2; v5 = 2; *v2 = 1; v6 = (unsigned long long *)(v2 + 1); v16[1] = v2 + 1; v17 = (unsigned long long *)(v2 + 1); v15 = 2; if ( a1 <= 2 ) { v14 = 4LL; goto LABEL_8; } do { while ( a1 % v5 ) { LABEL_3: v15 = ++v5; if ( v5 == a1 ) goto LABEL_7; } if ( v6 == v3 ) { std::vector<int>::_M_realloc_insert<int const&>(v16, v6, &v15); v3 = (unsigned long long *)v16[1]; v6 = v17; goto LABEL_3; } *(_DWORD *)v3 = v5; v3 = (unsigned long long *)((char *)v3 + 4); ++v5; v16[1] = v3; v15 = v5; } while ( v5 != a1 ); LABEL_7: v4 = (__m128i *)v16[0]; v14 = (char *)v6 - (char *)v16[0]; if ( v3 == v16[0] ) { v12 = 0; } else { LABEL_8: v7 = v4; v8 = ((unsigned long long)((char *)v3 - 4 - (char *)v4) >> 2) + 1; if ( (unsigned long long)((char *)v3 - 4 - (char *)v4) <= 8 ) { v12 = 0; LABEL_12: v12 += v7->m128i_i32[0]; if ( v3 != (unsigned long long *)((char *)v7->m128i_i64 + 4) ) { v12 += v7->m128i_u32[1]; if ( v3 != &v7->m128i_u64[1] ) v12 += v7->m128i_u32[2]; } } else { v9 = 0LL; do { v10 = _mm_loadu_si128(v7++); v9 = _mm_add_epi32(v9, v10); } while ( v7 != &v4[v8 >> 2] ); v11 = _mm_add_epi32(v9, _mm_srli_si128(v9, 8)); v7 = (__m128i *)((char *)v4 + 4 * (v8 & 0xFFFFFFFFFFFFFFFCLL)); v12 = _mm_cvtsi128_si32(_mm_add_epi32(v11, _mm_srli_si128(v11, 4))); if ( (v8 & 3) != 0 ) goto LABEL_12; } } if ( v4 ) operator delete(v4, v14); return v12; }
func0: ENDBR64 PUSH RBP PXOR XMM0,XMM0 MOV EBP,EDI MOV EDI,0x4 PUSH RBX SUB RSP,0x38 MOV RAX,qword ptr FS:[0x28] MOV qword ptr [RSP + 0x28],RAX XOR EAX,EAX MOVAPS xmmword ptr [RSP + 0x10],XMM0 MOV qword ptr [RSP + 0x20],0x0 LAB_00101343: CALL 0x001010f0 LEA RCX,[RAX + 0x4] MOV qword ptr [RSP + 0x10],RAX MOV RDI,RAX MOV EBX,0x2 MOV dword ptr [RAX],0x1 MOV RSI,RCX MOV qword ptr [RSP + 0x18],RCX MOV qword ptr [RSP + 0x20],RCX MOV dword ptr [RSP + 0xc],0x2 CMP EBP,0x2 JG 0x0010138b JMP 0x001014a0 LAB_00101380: ADD EBX,0x1 MOV dword ptr [RSP + 0xc],EBX CMP EBX,EBP JZ 0x001013b3 LAB_0010138b: MOV EAX,EBP CDQ IDIV EBX TEST EDX,EDX JNZ 0x00101380 CMP RSI,RCX JZ 0x00101478 MOV dword ptr [RCX],EBX ADD RCX,0x4 ADD EBX,0x1 MOV qword ptr [RSP + 0x18],RCX MOV dword ptr [RSP + 0xc],EBX CMP EBX,EBP JNZ 0x0010138b LAB_001013b3: MOV RDI,qword ptr [RSP + 0x10] SUB RSI,RDI CMP RCX,RDI JZ 0x001014b0 LAB_001013c4: LEA RDX,[RCX + -0x4] MOV RAX,RDI SUB RDX,RDI MOV R8,RDX SHR R8,0x2 ADD R8,0x1 CMP RDX,0x8 JBE 0x001014b4 MOV RDX,R8 PXOR XMM0,XMM0 SHR RDX,0x2 SHL RDX,0x4 ADD RDX,RDI NOP dword ptr [RAX] LAB_001013f8: MOVDQU XMM2,xmmword ptr [RAX] ADD RAX,0x10 PADDD XMM0,XMM2 CMP RAX,RDX JNZ 0x001013f8 MOVDQA XMM1,XMM0 MOV RAX,R8 PSRLDQ XMM1,0x8 AND RAX,-0x4 AND R8D,0x3 PADDD XMM0,XMM1 LEA RAX,[RDI + RAX*0x4] MOVDQA XMM1,XMM0 PSRLDQ XMM1,0x4 PADDD XMM0,XMM1 MOVD EBX,XMM0 JZ 0x00101452 LAB_00101438: LEA RDX,[RAX + 0x4] ADD EBX,dword ptr [RAX] CMP RCX,RDX JZ 0x00101452 LEA RDX,[RAX + 0x8] ADD EBX,dword ptr [RAX + 0x4] CMP RCX,RDX JZ 0x00101452 ADD EBX,dword ptr [RAX + 0x8] LAB_00101452: TEST RDI,RDI JZ 0x0010145c CALL 0x00101100 LAB_0010145c: MOV RAX,qword ptr [RSP + 0x28] SUB RAX,qword ptr FS:[0x28] JNZ 0x001014b8 ADD RSP,0x38 MOV EAX,EBX POP RBX POP RBP RET LAB_00101478: LEA RDX,[RSP + 0xc] LEA RDI,[RSP + 0x10] CALL 0x001014d0 MOV RCX,qword ptr [RSP + 0x18] MOV RSI,qword ptr [RSP + 0x20] JMP 0x00101380 LAB_001014a0: MOV ESI,0x4 JMP 0x001013c4 LAB_001014b0: XOR EBX,EBX JMP 0x00101452 LAB_001014b4: XOR EBX,EBX JMP 0x00101438 LAB_001014b8: CALL 0x00101110
/* func0(int) */ int func0(int param_1) { int iVar1; int *piVar2; int *piVar3; int *piVar4; int *piVar5; int *piVar6; ulong uVar7; ulong uVar8; ulong uVar9; long in_FS_OFFSET; int iVar10; int iVar11; int iVar12; int iVar13; int local_3c; int local_38 [16]; int *local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_38 = (int [16])0x0; local_28 = (int *)0x0; /* try { // try from 00101343 to 00101486 has its CatchHandler @ 001014bd */ local_38._0_8_ = operator_new(4); piVar6 = (int *)(local_38._0_8_ + 4); *(int *)local_38._0_8_ = 1; local_3c = 2; piVar5 = piVar6; local_28 = piVar6; local_38._8_8_ = piVar6; if (param_1 < 3) { uVar8 = 4; } else { LAB_0010138b: do { iVar10 = local_3c; if (param_1 % local_3c == 0) { if (piVar5 != piVar6) { *piVar6 = local_3c; piVar6 = piVar6 + 1; local_3c = local_3c + 1; local_38._8_8_ = piVar6; if (local_3c == param_1) break; goto LAB_0010138b; } std::vector<int,std::allocator<int>>::_M_realloc_insert<int_const&> ((vector<int,std::allocator<int>> *)local_38,(__normal_iterator)piVar5,&local_3c); piVar6 = (int *)local_38._8_8_; piVar5 = local_28; } local_3c = iVar10 + 1; } while (local_3c != param_1); local_3c = iVar10 + 1; uVar8 = (long)piVar5 - local_38._0_8_; if (piVar6 == (int *)local_38._0_8_) { iVar10 = 0; goto LAB_00101452; } } uVar7 = (long)piVar6 + (-4 - local_38._0_8_); uVar9 = (uVar7 >> 2) + 1; if (uVar7 < 9) { iVar10 = 0; piVar5 = (int *)local_38._0_8_; } else { iVar10 = 0; iVar11 = 0; iVar12 = 0; iVar13 = 0; piVar5 = (int *)local_38._0_8_; do { iVar1 = *piVar5; piVar2 = piVar5 + 1; piVar3 = piVar5 + 2; piVar4 = piVar5 + 3; piVar5 = piVar5 + 4; iVar10 = iVar10 + iVar1; iVar11 = iVar11 + *piVar2; iVar12 = iVar12 + *piVar3; iVar13 = iVar13 + *piVar4; } while (piVar5 != (int *)(local_38._0_8_ + (uVar9 & 0xfffffffffffffffc) * 4)); iVar10 = iVar10 + iVar12 + iVar11 + iVar13; piVar5 = (int *)(local_38._0_8_ + (uVar9 & 0xfffffffffffffffc) * 4); if ((uVar9 & 3) == 0) goto LAB_00101452; } iVar10 = iVar10 + *piVar5; if ((piVar6 != piVar5 + 1) && (iVar10 = iVar10 + piVar5[1], piVar6 != piVar5 + 2)) { iVar10 = iVar10 + piVar5[2]; } LAB_00101452: if ((int *)local_38._0_8_ != (int *)0x0) { operator_delete((void *)local_38._0_8_,uVar8); } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar10; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }
1,180
func0
#include <iostream> #include <cassert>
int func0(int arr[], int n) { int inv_count = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (arr[i] > arr[j]) { inv_count += 1; } } } return inv_count; }
int main() { int arr1[] = {1, 20, 6, 4, 5}; assert(func0(arr1, 5) == 5); int arr2[] = {1, 2, 1}; assert(func0(arr2, 3) == 1); int arr3[] = {1, 2, 5, 6, 1}; assert(func0(arr3, 5) == 3); return 0; }
O0
cpp
func0(int*, int): endbr64 push %rbp mov %rsp,%rbp mov %rdi,-0x18(%rbp) mov %esi,-0x1c(%rbp) movl $0x0,-0xc(%rbp) movl $0x0,-0x8(%rbp) mov -0x8(%rbp),%eax cmp -0x1c(%rbp),%eax jge 121f <_Z5func0Pii+0x76> mov -0x8(%rbp),%eax add $0x1,%eax mov %eax,-0x4(%rbp) mov -0x4(%rbp),%eax cmp -0x1c(%rbp),%eax jge 1219 <_Z5func0Pii+0x70> mov -0x8(%rbp),%eax cltq lea 0x0(,%rax,4),%rdx mov -0x18(%rbp),%rax add %rdx,%rax mov (%rax),%edx mov -0x4(%rbp),%eax cltq lea 0x0(,%rax,4),%rcx mov -0x18(%rbp),%rax add %rcx,%rax mov (%rax),%eax cmp %eax,%edx jle 1213 <_Z5func0Pii+0x6a> addl $0x1,-0xc(%rbp) addl $0x1,-0x4(%rbp) jmp 11d7 <_Z5func0Pii+0x2e> addl $0x1,-0x8(%rbp) jmp 11c6 <_Z5func0Pii+0x1d> mov -0xc(%rbp),%eax pop %rbp retq
_Z5func0Pii: endbr64 push rbp mov rbp, rsp mov [rbp+var_18], rdi mov [rbp+var_1C], esi mov [rbp+var_C], 0 mov [rbp+var_8], 0 jmp short loc_11D7 loc_1188: mov eax, [rbp+var_8] add eax, 1 mov [rbp+var_4], eax jmp short loc_11CB loc_1193: mov eax, [rbp+var_8] cdqe lea rdx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rdx mov edx, [rax] mov eax, [rbp+var_4] cdqe lea rcx, ds:0[rax*4] mov rax, [rbp+var_18] add rax, rcx mov eax, [rax] cmp edx, eax jle short loc_11C7 add [rbp+var_C], 1 loc_11C7: add [rbp+var_4], 1 loc_11CB: mov eax, [rbp+var_4] cmp eax, [rbp+var_1C] jl short loc_1193 add [rbp+var_8], 1 loc_11D7: mov eax, [rbp+var_8] cmp eax, [rbp+var_1C] jl short loc_1188 mov eax, [rbp+var_C] pop rbp retn
long long func0(int *a1, int a2) { unsigned int v3; // [rsp+10h] [rbp-Ch] int i; // [rsp+14h] [rbp-8h] int j; // [rsp+18h] [rbp-4h] v3 = 0; for ( i = 0; i < a2; ++i ) { for ( j = i + 1; j < a2; ++j ) { if ( a1[i] > a1[j] ) ++v3; } } return v3; }
func0: ENDBR64 PUSH RBP MOV RBP,RSP MOV qword ptr [RBP + -0x18],RDI MOV dword ptr [RBP + -0x1c],ESI MOV dword ptr [RBP + -0xc],0x0 MOV dword ptr [RBP + -0x8],0x0 JMP 0x001011d7 LAB_00101188: MOV EAX,dword ptr [RBP + -0x8] ADD EAX,0x1 MOV dword ptr [RBP + -0x4],EAX JMP 0x001011cb LAB_00101193: MOV EAX,dword ptr [RBP + -0x8] CDQE LEA RDX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RDX MOV EDX,dword ptr [RAX] MOV EAX,dword ptr [RBP + -0x4] CDQE LEA RCX,[RAX*0x4] MOV RAX,qword ptr [RBP + -0x18] ADD RAX,RCX MOV EAX,dword ptr [RAX] CMP EDX,EAX JLE 0x001011c7 ADD dword ptr [RBP + -0xc],0x1 LAB_001011c7: ADD dword ptr [RBP + -0x4],0x1 LAB_001011cb: MOV EAX,dword ptr [RBP + -0x4] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101193 ADD dword ptr [RBP + -0x8],0x1 LAB_001011d7: MOV EAX,dword ptr [RBP + -0x8] CMP EAX,dword ptr [RBP + -0x1c] JL 0x00101188 MOV EAX,dword ptr [RBP + -0xc] POP RBP RET
/* func0(int*, int) */ int func0(int *param_1,int param_2) { int local_14; int local_10; int local_c; local_14 = 0; for (local_10 = 0; local_c = local_10, local_10 < param_2; local_10 = local_10 + 1) { while (local_c = local_c + 1, local_c < param_2) { if (param_1[local_c] < param_1[local_10]) { local_14 = local_14 + 1; } } } return local_14; }
1,181
func0
#include <iostream> #include <cassert>
int func0(int arr[], int n) { int inv_count = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (arr[i] > arr[j]) { inv_count += 1; } } } return inv_count; }
int main() { int arr1[] = {1, 20, 6, 4, 5}; assert(func0(arr1, 5) == 5); int arr2[] = {1, 2, 1}; assert(func0(arr2, 3) == 1); int arr3[] = {1, 2, 5, 6, 1}; assert(func0(arr3, 5) == 3); return 0; }
O1
cpp
func0(int*, int): endbr64 test %esi,%esi jle 11eb <_Z5func0Pii+0x42> lea -0x1(%rsi),%r9d add $0x1,%r9 mov $0x1,%r8d mov $0x0,%ecx jmp 11dc <_Z5func0Pii+0x33> add $0x1,%rax cmp %eax,%esi jle 11d8 <_Z5func0Pii+0x2f> cmp (%rdi,%rax,4),%edx jle 11c6 <_Z5func0Pii+0x1d> add $0x1,%ecx jmp 11c6 <_Z5func0Pii+0x1d> add $0x1,%r8 cmp %r9,%r8 je 11f0 <_Z5func0Pii+0x47> mov -0x4(%rdi,%r8,4),%edx mov %r8,%rax jmp 11ce <_Z5func0Pii+0x25> mov $0x0,%ecx mov %ecx,%eax retq
_Z5func0Pii: endbr64 test esi, esi jle short loc_11B1 mov r9d, esi movsxd r10, esi mov r8d, 1 mov ecx, 0 jmp short loc_11A2 loc_1184: add rax, 1 cmp esi, eax jle short loc_1196 loc_118C: cmp edx, [rdi+rax*4] jle short loc_1184 add ecx, 1 jmp short loc_1184 loc_1196: lea rax, [r8+1] cmp r8, r10 jz short loc_11B6 mov r8, rax loc_11A2: cmp r8, r9 jz short loc_11B6 mov edx, [rdi+r8*4-4] mov rax, r8 jmp short loc_118C loc_11B1: mov ecx, 0 loc_11B6: mov eax, ecx retn
long long func0(int *a1, int a2) { long long v2; // r8 unsigned int v3; // ecx long long v4; // rax if ( a2 <= 0 ) { return 0; } else { v2 = 1LL; v3 = 0; while ( v2 != a2 ) { v4 = v2; do { if ( a1[v2 - 1] > a1[v4] ) ++v3; ++v4; } while ( a2 > (int)v4 ); if ( v2 == a2 ) break; ++v2; } } return v3; }
func0: ENDBR64 TEST ESI,ESI JLE 0x001011b1 MOV R9D,ESI MOVSXD R10,ESI MOV R8D,0x1 MOV ECX,0x0 JMP 0x001011a2 LAB_00101184: ADD RAX,0x1 CMP ESI,EAX JLE 0x00101196 LAB_0010118c: CMP EDX,dword ptr [RDI + RAX*0x4] JLE 0x00101184 ADD ECX,0x1 JMP 0x00101184 LAB_00101196: LEA RAX,[R8 + 0x1] CMP R8,R10 JZ 0x001011b6 MOV R8,RAX LAB_001011a2: CMP R8,R9 JZ 0x001011b6 MOV EDX,dword ptr [RDI + R8*0x4 + -0x4] MOV RAX,R8 JMP 0x0010118c LAB_001011b1: MOV ECX,0x0 LAB_001011b6: MOV EAX,ECX RET
/* func0(int*, int) */ int func0(int *param_1,int param_2) { ulong uVar1; int iVar2; ulong uVar3; bool bVar4; if (param_2 < 1) { iVar2 = 0; } else { iVar2 = 0; uVar3 = 1; do { if (uVar3 == (uint)param_2) { return iVar2; } uVar1 = uVar3; do { if (param_1[uVar1] < param_1[uVar3 - 1]) { iVar2 = iVar2 + 1; } uVar1 = uVar1 + 1; } while ((int)uVar1 < param_2); bVar4 = uVar3 != (long)param_2; uVar3 = uVar3 + 1; } while (bVar4); } return iVar2; }