; assembly | /* r2dec pseudo code output */ | /* balber_berdecoder.t/none @ 0x458070 */ | #include | | uint16_t rotate_left16 (uint16_t value, uint32_t count) { | const uint16_t mask = (CHAR_BIT * sizeof (value)) - 1; | count &= mask; | return (value << count) | (value >> (-count & mask)); | } | ; (fcn) method.BloombergLP::balber::BerUtil_DatetimeImpUtil.putCompactBinaryDatetimeTzValue_std::__1::basic_streambuf_char__std::__1::char_traits_char_____int__long_long__int__BloombergLP::balber::BerEncoderOptions_const_ () | uint64_t method_BloombergLP::balber::BerUtil_DatetimeImpUtil_putCompactBinaryDatetimeTzValue_std::_1::basic_streambuf_char_std::_1::char_traits_char_int_long_long_int_BloombergLP::balber::BerEncoderOptions_const_ (signed int64_t arg4, int64_t arg3, int64_t arg2, int64_t arg1) { | int64_t var_ch; | int64_t var_fh; | void * s; | int64_t var_20h; | rcx = arg4; | rdx = arg3; | rsi = arg2; | rdi = arg1; | /* BloombergLP::balber::BerUtil_DatetimeImpUtil::putCompactBinaryDatetimeTzValue(std::__1::basic_streambuf >*, int, long long, int, BloombergLP::balber::BerEncoderOptions const*) */ 0x00458070 push rbp | 0x00458071 push r15 | 0x00458073 push r14 | 0x00458075 push r13 | 0x00458077 push r12 | 0x00458079 push rbx | 0x0045807a sub rsp, 0x28 | 0x0045807e mov ebp, esi | 0x00458080 lea eax, [rbp + 0x59f] | eax = rbp + 0x59f; 0x00458086 mov r14d, 0xffffffff | r14d = 0xffffffff; 0x0045808c cmp eax, 0xb3e | | if (eax > 0xb3e) { 0x00458091 ja 0x45823e | goto label_1; | } 0x00458097 mov r12d, ecx | r12d = ecx; 0x0045809a mov r15, rdx | r15 = rdx; 0x0045809d mov rbx, rdi | rbx = rdi; 0x004580a0 cmp ecx, 4 | | if (ecx <= 4) { 0x004580a3 jg 0x4580bc | 0x004580a5 mov rax, qword [rbx + 0x30] | rax = *((rbx + 0x30)); 0x004580a9 cmp rax, qword [rbx + 0x38] | | if (rax != *((rbx + 0x38))) { 0x004580ad je 0x4580fc | 0x004580af lea rcx, [rax + 1] | rcx = rax + 1; 0x004580b3 mov qword [rbx + 0x30], rcx | *((rbx + 0x30)) = rcx; 0x004580b7 mov byte [rax], 7 | *(rax) = 7; 0x004580ba jmp 0x458113 | | } else { 0x004580bc lea esi, [r12 + 2] | 0x004580c1 mov rdi, rbx | 0x004580c4 call 0x453da0 | eax = BloombergLP::balber::BerUtil_LengthImpUtil::putLength(std::_1::basic_streambuf>*,int) (rbx, r12 + 2); 0x004580c9 test eax, eax | | if (eax != 0) { 0x004580cb jne 0x45823e | goto label_1; | } 0x004580d1 rol bp, 8 | bp = rotate_left16 (bp, 8); 0x004580d5 mov word [rsp + 0x10], bp | *((rsp + 0x10)) = bp; 0x004580da mov rax, qword [rbx] | rax = *(rbx); 0x004580dd lea rsi, [rsp + 0x10] | rsi = rsp + 0x10; 0x004580e2 mov edx, 2 | edx = 2; 0x004580e7 mov rdi, rbx | rdi = rbx; 0x004580ea call qword [rax + 0x60] | rax = uint64_t (*rax + 0x60)() (); 0x004580ed cmp rax, 2 | | if (rax == 2) { 0x004580f1 je 0x4581d7 | goto label_2; | } 0x004580f7 jmp 0x45823e | goto label_1; | } 0x004580fc mov rax, qword [rbx] | rax = *(rbx); 0x004580ff mov rdi, rbx | rdi = rbx; 0x00458102 mov esi, 7 | esi = 7; 0x00458107 call qword [rax + 0x68] | eax = uint64_t (*rax + 0x68)() (); 0x0045810a cmp eax, 7 | | if (eax != 7) { 0x0045810d jne 0x45823e | goto label_1; | } | } 0x00458113 rol bp, 8 | bp = rotate_left16 (bp, 8); 0x00458117 mov word [rsp + 0x10], bp | *((rsp + 0x10)) = bp; 0x0045811c mov rax, qword [rbx] | rax = *(rbx); 0x0045811f lea rsi, [rsp + 0x10] | rsi = rsp + 0x10; 0x00458124 mov edx, 2 | edx = 2; 0x00458129 mov rdi, rbx | rdi = rbx; 0x0045812c call qword [rax + 0x60] | rax = uint64_t (*rax + 0x60)() (); 0x0045812f cmp rax, 2 | | if (rax != 2) { 0x00458133 jne 0x45823e | goto label_1; | } 0x00458139 mov qword [rsp + 0x20], r15 | *((rsp + 0x20)) = r15; 0x0045813e sar r15, 0x3f | r15 >>= 0x3f; 0x00458142 mov ebp, 5 | 0x00458147 sub ebp, r12d | ebp -= r12d; 0x0045814a lea ecx, [rbp + 0xf] | ecx = rbp + 0xf; 0x0045814d test ebp, ebp | 0x0045814f cmovns ecx, ebp | __asm ("cmovns ecx, ebp"); 0x00458152 mov dword [rsp + 0xc], ecx | *((rsp + 0xc)) = ecx; 0x00458156 movsxd rdx, ebp | rdx = (int64_t) ebp; 0x00458159 movzx esi, r15b | esi = (int32_t) r15b; 0x0045815d lea rdi, [rsp + 0x10] | 0x00458162 call 0x4041f0 | memset (rsp + 0x10, rsi, rdx); 0x00458167 mov eax, 0x14 | eax = 0x14; 0x0045816c sub eax, r12d | eax -= r12d; 0x0045816f cmp eax, 0x1f | | if (eax < 0x1f) { 0x00458172 jb 0x4581b0 | goto label_3; | } 0x00458174 mov r15d, dword [rsp + 0xc] | r15d = *((rsp + 0xc)); 0x00458179 sar r15d, 4 | r15d >>= 4; 0x0045817d lea r13, [rsp + 0x10] | r13 = rsp + 0x10; 0x00458182 nop word cs:[rax + rax] | 0x0045818c nop dword [rax] | | do { 0x00458190 mov rax, qword [rbx] | rax = *(rbx); 0x00458193 mov edx, 0x10 | edx = 0x10; 0x00458198 mov rdi, rbx | rdi = rbx; 0x0045819b mov rsi, r13 | rsi = r13; 0x0045819e call qword [rax + 0x60] | rax = uint64_t (*rax + 0x60)() (); 0x004581a1 cmp rax, 0x10 | | if (rax != 0x10) { 0x004581a5 jne 0x45823e | goto label_1; | } 0x004581ab dec r15d | r15d--; 0x004581ae jne 0x458190 | | } while (r15d != 0); | label_3: 0x004581b0 mov eax, dword [rsp + 0xc] | eax = *((rsp + 0xc)); 0x004581b4 and eax, 0xfffffff0 | eax &= 0xfffffff0; 0x004581b7 sub ebp, eax | ebp -= eax; 0x004581b9 movsxd rbp, ebp | rbp = (int64_t) ebp; 0x004581bc mov rax, qword [rbx] | rax = *(rbx); 0x004581bf lea rsi, [rsp + 0x10] | rsi = rsp + 0x10; 0x004581c4 mov rdi, rbx | rdi = rbx; 0x004581c7 mov rdx, rbp | rdx = rbp; 0x004581ca call qword [rax + 0x60] | rax = uint64_t (*rax + 0x60)() (); 0x004581cd cmp rax, rbp | 0x004581d0 mov r15, qword [rsp + 0x20] | r15 = *((rsp + 0x20)); | if (rax != rbp) { 0x004581d5 jne 0x45823e | goto label_1; | } | label_2: 0x004581d7 mov qword [rsp + 0x10], r15 | *((rsp + 0x10)) = r15; 0x004581dc mov r14d, 0xffffffff | r14d = 0xffffffff; 0x004581e2 test r12d, r12d | | if (r12d <= 0) { 0x004581e5 jle 0x45823e | goto label_1; | } 0x004581e7 cmp r12d, 8 | | if (r12d > 8) { 0x004581eb ja 0x45823e | goto label_1; | } 0x004581ed mov ebp, r12d | 0x004581f0 jmp 0x458215 | | while (rcx != *((rbx + 0x38))) { 0x00458200 lea rdx, [rcx + 1] | rdx = rcx + 1; 0x00458204 mov qword [rbx + 0x30], rdx | *((rbx + 0x30)) = rdx; 0x00458208 mov byte [rcx], al | *(rcx) = al; | label_0: 0x0045820a dec rbp | rbp--; 0x0045820d lea eax, [rbp + 1] | eax = rbp + 1; 0x00458210 cmp eax, 1 | | if (eax <= 1) { 0x00458213 jle 0x45823b | goto label_4; | } 0x00458215 movzx eax, byte [rsp + rbp + 0xf] | eax = *((rsp + rbp + 0xf)); 0x0045821a mov rcx, qword [rbx + 0x30] | rcx = *((rbx + 0x30)); 0x0045821e cmp rcx, qword [rbx + 0x38] | 0x00458222 jne 0x458200 | | } 0x00458224 movzx r15d, al | r15d = (int32_t) al; 0x00458228 mov rax, qword [rbx] | rax = *(rbx); 0x0045822b mov rdi, rbx | rdi = rbx; 0x0045822e mov esi, r15d | esi = r15d; 0x00458231 call qword [rax + 0x68] | eax = uint64_t (*rax + 0x68)() (); 0x00458234 cmp eax, r15d | | if (eax == r15d) { 0x00458237 je 0x45820a | goto label_0; | } 0x00458239 jmp 0x45823e | goto label_1; | label_4: 0x0045823b xor r14d, r14d | r14d = 0; | label_1: 0x0045823e mov eax, r14d | eax = r14d; 0x00458241 add rsp, 0x28 | 0x00458245 pop rbx | 0x00458246 pop r12 | 0x00458248 pop r13 | 0x0045824a pop r14 | 0x0045824c pop r15 | 0x0045824e pop rbp | 0x0045824f ret | return rax; | }