; assembly | /* r2dec pseudo code output */ | /* bslstl_ostringstream.t/none @ 0x421e80 */ | #include | ; (fcn) method.bsl::basic_stringbuf_wchar_t__std::__1::char_traits_wchar_t___BloombergLP::bsltf::StdStatefulAllocator_wchar_t__true__true__false__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_false_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) */ 0x00421e80 push rbx | 0x00421e81 cmp edx, 1 | | if (edx == 1) { 0x00421e84 jne 0x421e9b | 0x00421e86 mov eax, ecx | eax = ecx; 0x00421e88 and eax, 0x18 | eax &= 0x18; 0x00421e8b mov r8, 0xffffffffffffffff | r8 = 0xffffffffffffffff; 0x00421e92 cmp eax, 0x18 | | if (eax == 0x18) { 0x00421e95 je 0x4220c5 | goto label_0; | } | } 0x00421e9b mov r8, 0xffffffffffffffff | r8 = 0xffffffffffffffff; 0x00421ea2 test cl, 8 | | if ((cl & 8) != 0) { 0x00421ea5 je 0x421f67 | 0x00421eab test byte [rdi + 0x78], 8 | | if ((*((rdi + 0x78)) & 8) == 0) { 0x00421eaf je 0x421f67 | goto label_1; | } 0x00421eb5 cmp edx, 2 | | if (edx != 2) { 0x00421eb8 je 0x421ed1 | 0x00421eba cmp edx, 1 | | if (edx != 1) { 0x00421ebd je 0x421ef6 | 0x00421ebf test edx, edx | | if (edx == 0) { 0x00421ec1 jne 0x421f04 | 0x00421ec3 lea r9, [rsi*4] | r9 = rsi*4; 0x00421ecb add r9, qword [rdi + 0x10] | r9 += *((rdi + 0x10)); 0x00421ecf jmp 0x421f07 | | } else { 0x00421ed1 mov rax, qword [rdi + 0x30] | rax = *((rdi + 0x30)); 0x00421ed5 mov r8, qword [rdi + 0x70] | r8 = *((rdi + 0x70)); 0x00421ed9 sub rax, qword [rdi + 0x28] | rax -= *((rdi + 0x28)); 0x00421edd sar rax, 2 | rax >>= 2; 0x00421ee1 cmp r8, rax | | if (r8 >= rax) { 0x00421ee4 cmovge rax, r8 | rax = r8; | } 0x00421ee8 shl rax, 2 | rax <<= 2; 0x00421eec add rax, qword [rdi + 0x10] | rax += *((rdi + 0x10)); 0x00421ef0 lea r9, [rax + rsi*4] | r9 = rax + rsi*4; 0x00421ef4 jmp 0x421f07 | 0x00421ef6 lea r9, [rsi*4] | r9 = rsi*4; 0x00421efe add r9, qword [rdi + 0x18] | r9 += *((rdi + 0x18)); 0x00421f02 jmp 0x421f07 | | } else { | } else { 0x00421f04 xor r9d, r9d | r9d = 0; | } | } | } 0x00421f07 mov r10, qword [rdi + 0x10] | r10 = *((rdi + 0x10)); 0x00421f0b mov r8, 0xffffffffffffffff | r8 = 0xffffffffffffffff; 0x00421f12 cmp r9, r10 | | if (r9 < r10) { 0x00421f15 jb 0x4220c5 | goto label_0; | } 0x00421f1b mov rbx, qword [rdi + 0x30] | rbx = *((rdi + 0x30)); 0x00421f1f mov r11, qword [rdi + 0x70] | r11 = *((rdi + 0x70)); 0x00421f23 sub rbx, qword [rdi + 0x28] | rbx -= *((rdi + 0x28)); 0x00421f27 sar rbx, 2 | rbx >>= 2; 0x00421f2b cmp r11, rbx | | if (r11 >= rbx) { 0x00421f2e cmovge rbx, r11 | rbx = r11; | } 0x00421f32 lea rax, [r10 + rbx*4] | rax = r10 + rbx*4; 0x00421f36 cmp r9, rax | | if (r9 > rax) { 0x00421f39 ja 0x4220c5 | goto label_0; | } 0x00421f3f lea r8, [rdi + 0x40] | r8 = rdi + 0x40; 0x00421f43 cmp qword [rdi + 0x60], 5 | | if (*((rdi + 0x60)) != 5) { 0x00421f48 je 0x421f4d | 0x00421f4a mov r8, qword [r8] | r8 = *(r8); | } 0x00421f4d lea rax, [r8 + rbx*4] | rax = r8 + rbx*4; 0x00421f51 mov qword [rdi + 0x10], r8 | *((rdi + 0x10)) = r8; 0x00421f55 mov qword [rdi + 0x18], r9 | *((rdi + 0x18)) = r9; 0x00421f59 mov qword [rdi + 0x20], rax | *((rdi + 0x20)) = rax; 0x00421f5d sub r9, r8 | r9 -= r8; 0x00421f60 sar r9, 2 | r9 >>= 2; 0x00421f64 mov r8, r9 | r8 = r9; | } | label_1: 0x00421f67 test cl, 0x10 | | if ((cl & 0x10) != 0) { 0x00421f6a je 0x4220c5 | 0x00421f70 test byte [rdi + 0x78], 0x10 | | if ((*((rdi + 0x78)) & 0x10) == 0) { 0x00421f74 je 0x4220c5 | goto label_0; | } 0x00421f7a cmp edx, 2 | | if (edx != 2) { 0x00421f7d je 0x421f92 | 0x00421f7f cmp edx, 1 | | if (edx != 1) { 0x00421f82 je 0x421fb6 | 0x00421f84 test edx, edx | | if (edx == 0) { 0x00421f86 jne 0x421fc0 | 0x00421f88 shl rsi, 2 | rsi <<= 2; 0x00421f8c add rsi, qword [rdi + 0x28] | rsi += *((rdi + 0x28)); 0x00421f90 jmp 0x421fc2 | | } else { 0x00421f92 mov rax, qword [rdi + 0x28] | rax = *((rdi + 0x28)); 0x00421f96 mov rcx, qword [rdi + 0x30] | rcx = *((rdi + 0x30)); 0x00421f9a sub rcx, rax | rcx -= rax; 0x00421f9d sar rcx, 2 | rcx >>= 2; 0x00421fa1 mov rdx, qword [rdi + 0x70] | rdx = *((rdi + 0x70)); 0x00421fa5 cmp rdx, rcx | | if (rdx >= rcx) { 0x00421fa8 cmovge rcx, rdx | rcx = rdx; | } 0x00421fac lea rax, [rax + rcx*4] | rax = rax + rcx*4; 0x00421fb0 lea rsi, [rax + rsi*4] | rsi = rax + rsi*4; 0x00421fb4 jmp 0x421fc2 | 0x00421fb6 shl rsi, 2 | rsi <<= 2; 0x00421fba add rsi, qword [rdi + 0x30] | rsi += *((rdi + 0x30)); 0x00421fbe jmp 0x421fc2 | | } else { | } else { 0x00421fc0 xor esi, esi | esi = 0; | } | } | } 0x00421fc2 mov rax, qword [rdi + 0x28] | rax = *((rdi + 0x28)); 0x00421fc6 mov r8, 0xffffffffffffffff | r8 = 0xffffffffffffffff; 0x00421fcd cmp rsi, rax | | if (rsi < rax) { 0x00421fd0 jb 0x4220c5 | goto label_0; | } 0x00421fd6 mov rcx, qword [rdi + 0x30] | rcx = *((rdi + 0x30)); 0x00421fda mov rdx, qword [rdi + 0x70] | rdx = *((rdi + 0x70)); 0x00421fde sub rcx, rax | rcx -= rax; 0x00421fe1 sar rcx, 2 | rcx >>= 2; 0x00421fe5 cmp rdx, rcx | | if (rdx >= rcx) { 0x00421fe8 cmovge rcx, rdx | rcx = rdx; | } 0x00421fec lea rax, [rax + rcx*4] | rax = rax + rcx*4; 0x00421ff0 cmp rsi, rax | | if (rsi > rax) { 0x00421ff3 ja 0x4220c5 | goto label_0; | } 0x00421ff9 lea r9, [rdi + 0x40] | r9 = rdi + 0x40; 0x00421ffd cmp qword [rdi + 0x60], 5 | | if (*((rdi + 0x60)) != 5) { 0x00422002 je 0x422007 | 0x00422004 mov r9, qword [r9] | r9 = *(r9); | } 0x00422007 mov rcx, qword [rdi + 0x58] | rcx = *((rdi + 0x58)); 0x0042200b mov rax, rsi | rax = rsi; 0x0042200e sub rax, r9 | rax -= r9; 0x00422011 mov r8, rax | r8 = rax; 0x00422014 sar r8, 2 | r8 >>= 2; 0x00422018 lea rcx, [r9 + rcx*4] | rcx = r9 + rcx*4; 0x0042201c mov qword [rdi + 0x30], r9 | *((rdi + 0x30)) = r9; 0x00422020 mov qword [rdi + 0x28], r9 | *((rdi + 0x28)) = r9; 0x00422024 mov qword [rdi + 0x38], rcx | *((rdi + 0x38)) = rcx; 0x00422028 movabs rcx, 0x1fffffffd | rcx = 0x1fffffffd; 0x00422032 cmp rax, rcx | | if (rax >= rcx) { 0x00422035 jl 0x4220b2 | 0x00422037 mov rcx, r9 | rcx = r9; 0x0042203a sub rcx, rsi | rcx -= rsi; 0x0042203d cmp rcx, rax | | if (rcx <= rax) { 0x00422040 cmovle rcx, rax | rcx = rax; | } 0x00422044 mov rsi, rcx | rsi = rcx; 0x00422047 shr rsi, 2 | rsi >>= 2; 0x0042204b shr rcx, 3 | rcx >>= 3; 0x0042204f cmp rcx, 0x7fffffff | 0x00422056 mov eax, 0xfffffffe | eax = 0xfffffffe; | if (rcx < 0x7fffffff) { 0x0042205b cmovb rax, rsi | rax = rsi; | } 0x0042205f neg rax | rax = -rax; 0x00422062 lea rcx, [rsi + rax + 0x7ffffffe] | rcx = rsi + rax + 0x7ffffffe; 0x0042206a movabs rdx, 0x200000005 | rdx = 0x200000005; 0x00422074 mov rax, rcx | rax = rcx; 0x00422077 mul rdx | rdx:rax = rax * rdx; 0x0042207a sub rcx, rdx | rcx -= rdx; 0x0042207d shr rcx, 1 | rcx >>= 1; 0x00422080 add rcx, rdx | rcx += rdx; 0x00422083 shr rcx, 0x1e | rcx >>= 0x1e; 0x00422087 mov rax, rcx | rax = rcx; 0x0042208a shl rax, 0x1f | rax <<= 0x1f; 0x0042208e sub rax, rcx | rax -= rcx; 0x00422091 lea rcx, [r9 + rax*4] | rcx = r9 + rax*4; 0x00422095 movabs r9, 0x1fffffffc | r9 = 0x1fffffffc; 0x0042209f add r9, rcx | r9 += rcx; 0x004220a2 sub rsi, rax | rsi -= rax; 0x004220a5 add rsi, 0xffffffff80000001 | rsi += 0xffffffff80000001; 0x004220ac mov qword [rdi + 0x30], r9 | *((rdi + 0x30)) = r9; 0x004220b0 jmp 0x4220b5 | | } else { 0x004220b2 mov rsi, r8 | rsi = r8; | } 0x004220b5 test rsi, rsi | | if (rsi == 0) { 0x004220b8 je 0x4220c5 | goto label_0; | } 0x004220ba movsxd rax, esi | rax = (int64_t) esi; 0x004220bd lea rax, [r9 + rax*4] | rax = r9 + rax*4; 0x004220c1 mov qword [rdi + 0x30], rax | *((rdi + 0x30)) = rax; | } | label_0: 0x004220c5 xor eax, eax | eax = 0; 0x004220c7 mov rdx, r8 | rdx = r8; 0x004220ca pop rbx | 0x004220cb ret | return rax; | }