; assembly | /* r2dec pseudo code output */ | /* bslstl_ostringstream.t/none @ 0x421310 */ | #include | ; (fcn) method.bsl::basic_stringbuf_wchar_t__std::__1::char_traits_wchar_t___BloombergLP::bsltf::StdStatefulAllocator_wchar_t__true__true__true__true___.seekoff_long_long__std::__1::ios_base::seekdir__unsigned_int_ () | int64_t method_bsl::basic_stringbuf_wchar_t_std::_1::char_traits_wchar_t_BloombergLP::bsltf::StdStatefulAllocator_wchar_t_true_true_true_true_seekoff_long_long_std::_1::ios_base::seekdir_unsigned_int_ (int64_t arg4, uint32_t arg3, int64_t arg2, uint32_t arg1) { | rcx = arg4; | rdx = arg3; | rsi = arg2; | rdi = arg1; | /* bsl::basic_stringbuf, BloombergLP::bsltf::StdStatefulAllocator >::seekoff(long long, std::__1::ios_base::seekdir, unsigned int) */ 0x00421310 push rbx | 0x00421311 cmp edx, 1 | | if (edx == 1) { 0x00421314 jne 0x42132b | 0x00421316 mov eax, ecx | eax = ecx; 0x00421318 and eax, 0x18 | eax &= 0x18; 0x0042131b mov r8, 0xffffffffffffffff | r8 = 0xffffffffffffffff; 0x00421322 cmp eax, 0x18 | | if (eax == 0x18) { 0x00421325 je 0x421555 | goto label_0; | } | } 0x0042132b mov r8, 0xffffffffffffffff | r8 = 0xffffffffffffffff; 0x00421332 test cl, 8 | | if ((cl & 8) != 0) { 0x00421335 je 0x4213f7 | 0x0042133b test byte [rdi + 0x78], 8 | | if ((*((rdi + 0x78)) & 8) == 0) { 0x0042133f je 0x4213f7 | goto label_1; | } 0x00421345 cmp edx, 2 | | if (edx != 2) { 0x00421348 je 0x421361 | 0x0042134a cmp edx, 1 | | if (edx != 1) { 0x0042134d je 0x421386 | 0x0042134f test edx, edx | | if (edx == 0) { 0x00421351 jne 0x421394 | 0x00421353 lea r9, [rsi*4] | r9 = rsi*4; 0x0042135b add r9, qword [rdi + 0x10] | r9 += *((rdi + 0x10)); 0x0042135f jmp 0x421397 | | } else { 0x00421361 mov rax, qword [rdi + 0x30] | rax = *((rdi + 0x30)); 0x00421365 mov r8, qword [rdi + 0x70] | r8 = *((rdi + 0x70)); 0x00421369 sub rax, qword [rdi + 0x28] | rax -= *((rdi + 0x28)); 0x0042136d sar rax, 2 | rax >>= 2; 0x00421371 cmp r8, rax | | if (r8 >= rax) { 0x00421374 cmovge rax, r8 | rax = r8; | } 0x00421378 shl rax, 2 | rax <<= 2; 0x0042137c add rax, qword [rdi + 0x10] | rax += *((rdi + 0x10)); 0x00421380 lea r9, [rax + rsi*4] | r9 = rax + rsi*4; 0x00421384 jmp 0x421397 | 0x00421386 lea r9, [rsi*4] | r9 = rsi*4; 0x0042138e add r9, qword [rdi + 0x18] | r9 += *((rdi + 0x18)); 0x00421392 jmp 0x421397 | | } else { | } else { 0x00421394 xor r9d, r9d | r9d = 0; | } | } | } 0x00421397 mov r10, qword [rdi + 0x10] | r10 = *((rdi + 0x10)); 0x0042139b mov r8, 0xffffffffffffffff | r8 = 0xffffffffffffffff; 0x004213a2 cmp r9, r10 | | if (r9 < r10) { 0x004213a5 jb 0x421555 | goto label_0; | } 0x004213ab mov rbx, qword [rdi + 0x30] | rbx = *((rdi + 0x30)); 0x004213af mov r11, qword [rdi + 0x70] | r11 = *((rdi + 0x70)); 0x004213b3 sub rbx, qword [rdi + 0x28] | rbx -= *((rdi + 0x28)); 0x004213b7 sar rbx, 2 | rbx >>= 2; 0x004213bb cmp r11, rbx | | if (r11 >= rbx) { 0x004213be cmovge rbx, r11 | rbx = r11; | } 0x004213c2 lea rax, [r10 + rbx*4] | rax = r10 + rbx*4; 0x004213c6 cmp r9, rax | | if (r9 > rax) { 0x004213c9 ja 0x421555 | goto label_0; | } 0x004213cf lea r8, [rdi + 0x40] | r8 = rdi + 0x40; 0x004213d3 cmp qword [rdi + 0x60], 5 | | if (*((rdi + 0x60)) != 5) { 0x004213d8 je 0x4213dd | 0x004213da mov r8, qword [r8] | r8 = *(r8); | } 0x004213dd lea rax, [r8 + rbx*4] | rax = r8 + rbx*4; 0x004213e1 mov qword [rdi + 0x10], r8 | *((rdi + 0x10)) = r8; 0x004213e5 mov qword [rdi + 0x18], r9 | *((rdi + 0x18)) = r9; 0x004213e9 mov qword [rdi + 0x20], rax | *((rdi + 0x20)) = rax; 0x004213ed sub r9, r8 | r9 -= r8; 0x004213f0 sar r9, 2 | r9 >>= 2; 0x004213f4 mov r8, r9 | r8 = r9; | } | label_1: 0x004213f7 test cl, 0x10 | | if ((cl & 0x10) != 0) { 0x004213fa je 0x421555 | 0x00421400 test byte [rdi + 0x78], 0x10 | | if ((*((rdi + 0x78)) & 0x10) == 0) { 0x00421404 je 0x421555 | goto label_0; | } 0x0042140a cmp edx, 2 | | if (edx != 2) { 0x0042140d je 0x421422 | 0x0042140f cmp edx, 1 | | if (edx != 1) { 0x00421412 je 0x421446 | 0x00421414 test edx, edx | | if (edx == 0) { 0x00421416 jne 0x421450 | 0x00421418 shl rsi, 2 | rsi <<= 2; 0x0042141c add rsi, qword [rdi + 0x28] | rsi += *((rdi + 0x28)); 0x00421420 jmp 0x421452 | | } else { 0x00421422 mov rax, qword [rdi + 0x28] | rax = *((rdi + 0x28)); 0x00421426 mov rcx, qword [rdi + 0x30] | rcx = *((rdi + 0x30)); 0x0042142a sub rcx, rax | rcx -= rax; 0x0042142d sar rcx, 2 | rcx >>= 2; 0x00421431 mov rdx, qword [rdi + 0x70] | rdx = *((rdi + 0x70)); 0x00421435 cmp rdx, rcx | | if (rdx >= rcx) { 0x00421438 cmovge rcx, rdx | rcx = rdx; | } 0x0042143c lea rax, [rax + rcx*4] | rax = rax + rcx*4; 0x00421440 lea rsi, [rax + rsi*4] | rsi = rax + rsi*4; 0x00421444 jmp 0x421452 | 0x00421446 shl rsi, 2 | rsi <<= 2; 0x0042144a add rsi, qword [rdi + 0x30] | rsi += *((rdi + 0x30)); 0x0042144e jmp 0x421452 | | } else { | } else { 0x00421450 xor esi, esi | esi = 0; | } | } | } 0x00421452 mov rax, qword [rdi + 0x28] | rax = *((rdi + 0x28)); 0x00421456 mov r8, 0xffffffffffffffff | r8 = 0xffffffffffffffff; 0x0042145d cmp rsi, rax | | if (rsi < rax) { 0x00421460 jb 0x421555 | goto label_0; | } 0x00421466 mov rcx, qword [rdi + 0x30] | rcx = *((rdi + 0x30)); 0x0042146a mov rdx, qword [rdi + 0x70] | rdx = *((rdi + 0x70)); 0x0042146e sub rcx, rax | rcx -= rax; 0x00421471 sar rcx, 2 | rcx >>= 2; 0x00421475 cmp rdx, rcx | | if (rdx >= rcx) { 0x00421478 cmovge rcx, rdx | rcx = rdx; | } 0x0042147c lea rax, [rax + rcx*4] | rax = rax + rcx*4; 0x00421480 cmp rsi, rax | | if (rsi > rax) { 0x00421483 ja 0x421555 | goto label_0; | } 0x00421489 lea r9, [rdi + 0x40] | r9 = rdi + 0x40; 0x0042148d cmp qword [rdi + 0x60], 5 | | if (*((rdi + 0x60)) != 5) { 0x00421492 je 0x421497 | 0x00421494 mov r9, qword [r9] | r9 = *(r9); | } 0x00421497 mov rcx, qword [rdi + 0x58] | rcx = *((rdi + 0x58)); 0x0042149b mov rax, rsi | rax = rsi; 0x0042149e sub rax, r9 | rax -= r9; 0x004214a1 mov r8, rax | r8 = rax; 0x004214a4 sar r8, 2 | r8 >>= 2; 0x004214a8 lea rcx, [r9 + rcx*4] | rcx = r9 + rcx*4; 0x004214ac mov qword [rdi + 0x30], r9 | *((rdi + 0x30)) = r9; 0x004214b0 mov qword [rdi + 0x28], r9 | *((rdi + 0x28)) = r9; 0x004214b4 mov qword [rdi + 0x38], rcx | *((rdi + 0x38)) = rcx; 0x004214b8 movabs rcx, 0x1fffffffd | rcx = 0x1fffffffd; 0x004214c2 cmp rax, rcx | | if (rax >= rcx) { 0x004214c5 jl 0x421542 | 0x004214c7 mov rcx, r9 | rcx = r9; 0x004214ca sub rcx, rsi | rcx -= rsi; 0x004214cd cmp rcx, rax | | if (rcx <= rax) { 0x004214d0 cmovle rcx, rax | rcx = rax; | } 0x004214d4 mov rsi, rcx | rsi = rcx; 0x004214d7 shr rsi, 2 | rsi >>= 2; 0x004214db shr rcx, 3 | rcx >>= 3; 0x004214df cmp rcx, 0x7fffffff | 0x004214e6 mov eax, 0xfffffffe | eax = 0xfffffffe; | if (rcx < 0x7fffffff) { 0x004214eb cmovb rax, rsi | rax = rsi; | } 0x004214ef neg rax | rax = -rax; 0x004214f2 lea rcx, [rsi + rax + 0x7ffffffe] | rcx = rsi + rax + 0x7ffffffe; 0x004214fa movabs rdx, 0x200000005 | rdx = 0x200000005; 0x00421504 mov rax, rcx | rax = rcx; 0x00421507 mul rdx | rdx:rax = rax * rdx; 0x0042150a sub rcx, rdx | rcx -= rdx; 0x0042150d shr rcx, 1 | rcx >>= 1; 0x00421510 add rcx, rdx | rcx += rdx; 0x00421513 shr rcx, 0x1e | rcx >>= 0x1e; 0x00421517 mov rax, rcx | rax = rcx; 0x0042151a shl rax, 0x1f | rax <<= 0x1f; 0x0042151e sub rax, rcx | rax -= rcx; 0x00421521 lea rcx, [r9 + rax*4] | rcx = r9 + rax*4; 0x00421525 movabs r9, 0x1fffffffc | r9 = 0x1fffffffc; 0x0042152f add r9, rcx | r9 += rcx; 0x00421532 sub rsi, rax | rsi -= rax; 0x00421535 add rsi, 0xffffffff80000001 | rsi += 0xffffffff80000001; 0x0042153c mov qword [rdi + 0x30], r9 | *((rdi + 0x30)) = r9; 0x00421540 jmp 0x421545 | | } else { 0x00421542 mov rsi, r8 | rsi = r8; | } 0x00421545 test rsi, rsi | | if (rsi == 0) { 0x00421548 je 0x421555 | goto label_0; | } 0x0042154a movsxd rax, esi | rax = (int64_t) esi; 0x0042154d lea rax, [r9 + rax*4] | rax = r9 + rax*4; 0x00421551 mov qword [rdi + 0x30], rax | *((rdi + 0x30)) = rax; | } | label_0: 0x00421555 xor eax, eax | eax = 0; 0x00421557 mov rdx, r8 | rdx = r8; 0x0042155a pop rbx | 0x0042155b ret | return rax; | }