; assembly | /* r2dec pseudo code output */ | /* balber_berutil.t/assume @ 0x4777b0 */ | #include | ; (fcn) method.BloombergLP::bdldfp::DecimalImpUtil.format_char__int__BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType64__BloombergLP::bdldfp::DecimalFormatConfig_const_ () | int64_t method_BloombergLP::bdldfp::DecimalImpUtil_format_char_int_BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType64_BloombergLP::bdldfp::DecimalFormatConfig_const_ (int64_t arg4, int64_t arg3, int64_t arg2, int64_t arg1) { | int64_t var_bh; | int64_t var_ch; | int64_t var_10h; | uint32_t var_1ch; | int64_t var_20h; | int64_t var_30h; | int64_t var_40h; | rcx = arg4; | rdx = arg3; | rsi = arg2; | rdi = arg1; | /* BloombergLP::bdldfp::DecimalImpUtil::format(char*, int, BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType64, BloombergLP::bdldfp::DecimalFormatConfig const&) */ 0x004777b0 push rbp | 0x004777b1 push r15 | 0x004777b3 push r14 | 0x004777b5 push r13 | 0x004777b7 push r12 | 0x004777b9 push rbx | 0x004777ba sub rsp, 0x58 | 0x004777be mov r15, rcx | r15 = rcx; 0x004777c1 mov rbp, rdx | 0x004777c4 mov r13d, esi | r13d = esi; 0x004777c7 mov r14, rdi | r14 = rdi; 0x004777ca mov rdi, rdx | rdi = rdx; 0x004777cd call 0x489c30 | _bid64_class (); 0x004777d2 cdqe | rax = (int64_t) eax; 0x004777d4 mov eax, dword [rax*4 + 0x50a110] | eax = *((rax*4 + 0x50a110)); 0x004777db test rbp, rbp | | if (rbp >= 0) { 0x004777de js 0x4777ee | 0x004777e0 cmp dword [r15 + 8], 0 | | if (*((r15 + 8)) == 0) { 0x004777e5 je 0x4777fc | goto label_0; | } 0x004777e7 mov byte [rsp + 0xb], 0x2b | *((rsp + 0xb)) = 0x2b; 0x004777ec jmp 0x4777f3 | | } else { 0x004777ee mov byte [rsp + 0xb], 0x2d | *((rsp + 0xb)) = 0x2d; | } 0x004777f3 mov esi, 1 | esi = 1; 0x004777f8 mov dl, 1 | dl = 1; 0x004777fa jmp 0x477805 | goto label_1; | label_0: 0x004777fc mov byte [rsp + 0xb], 0x2b | *((rsp + 0xb)) = 0x2b; 0x00477801 xor edx, edx | edx = 0; 0x00477803 xor esi, esi | esi = 0; | label_1: 0x00477805 mov dword [rsp + 0x1c], r13d | *((rsp + 0x1c)) = r13d; 0x0047780a sub r13d, esi | r13d -= esi; 0x0047780d mov r12d, esi | r12d = esi; 0x00477810 add r12, r14 | r12 += r14; 0x00477813 lea ecx, [rax - 2] | ecx = rax - 2; 0x00477816 cmp ecx, 3 | | if (ecx < 3) { 0x00477819 jae 0x47785b | 0x0047781b mov dword [rsp + 0xc], esi | *((rsp + 0xc)) = esi; 0x0047781f mov ebx, edx | ebx = edx; 0x00477821 cmp dword [r15 + 4], 2 | | if (*((r15 + 4)) == 2) { 0x00477826 je 0x47787f | goto label_2; | } 0x00477828 mov rdi, rbp | 0x0047782b call 0x476940 | rax = BloombergLP::bdldfp::DecimalImpUtil::normalize(BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType64) (rbp); 0x00477830 mov rbp, rax | 0x00477833 mov eax, dword [r15 + 4] | eax = *((r15 + 4)); 0x00477837 cmp eax, 2 | | if (eax == 2) { 0x0047783a je 0x47787f | goto label_2; | } 0x0047783c mov rdi, r12 | rdi = r12; 0x0047783f mov esi, r13d | esi = r13d; 0x00477842 mov rdx, rbp | rdx = rbp; 0x00477845 mov rcx, r15 | rcx = r15; 0x00477848 cmp eax, 1 | | if (eax != 1) { 0x0047784b jne 0x4779ea | goto label_3; | } 0x00477851 call 0x478de0 | eax = intBloombergLP::bdldfp::(anonymousnamespace)::formatFixed(char*,int,BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType64,BloombergLP::bdldfp::DecimalFormatConfigconst&) (rdi, rsi, rdx, rcx); 0x00477856 jmp 0x4779ef | goto label_4; | } 0x0047785b test eax, eax | | if (eax != 0) { 0x0047785d je 0x4778ed | 0x00477863 xor ebp, ebp | ebp = 0; 0x00477865 cmp eax, 1 | | if (eax != 1) { 0x00477868 jne 0x4779f7 | goto label_5; | } 0x0047786e mov dword [rsp + 0xc], esi | *((rsp + 0xc)) = esi; 0x00477872 mov dword [rsp + 0x10], edx | *((rsp + 0x10)) = edx; 0x00477876 mov rbx, qword [r15 + 0x10] | rbx = *((r15 + 0x10)); 0x0047787a jmp 0x47790f | goto label_6; | label_2: 0x0047787f mov qword [rsp + 0x10], r14 | *((rsp + 0x10)) = r14; 0x00477884 movabs r14, 0x1fffffffffffff | r14 = 0x1fffffffffffff; 0x0047788e mov rdi, rbp | rdi = rbp; 0x00477891 call 0x489c30 | _bid64_class (); 0x00477896 movabs rax, 0x6000000000000000 | rax = 0x6000000000000000; 0x004778a0 mov rcx, rbp | rcx = rbp; 0x004778a3 and rcx, rax | rcx &= rax; 0x004778a6 cmp rcx, rax | | if (rcx == rax) { 0x004778a9 jne 0x47793e | 0x004778af movabs rax, 0x7800000000000000 | rax = 0x7800000000000000; 0x004778b9 mov rdx, rbp | rdx = rbp; 0x004778bc and rdx, rax | rdx &= rax; 0x004778bf movabs rcx, 0x7ffffffffffff | rcx = 0x7ffffffffffff; 0x004778c9 and rcx, rbp | rcx &= rbp; 0x004778cc inc r14 | r14++; 0x004778cf or r14, rcx | r14 |= rcx; 0x004778d2 mov rsi, rbp | rsi = rbp; 0x004778d5 shr rsi, 0x33 | rsi >>= 0x33; 0x004778d9 and esi, 0x3ff | esi &= 0x3ff; 0x004778df lea ecx, [rsi - 0x18e] | ecx = rsi - 0x18e; 0x004778e5 cmp rdx, rax | | if (rdx == rax) { 0x004778e8 cmove ecx, esi | ecx = esi; | } 0x004778eb jmp 0x477954 | | } else { 0x004778ed mov dword [rsp + 0xc], esi | *((rsp + 0xc)) = esi; 0x004778f1 mov dword [rsp + 0x10], edx | *((rsp + 0x10)) = edx; 0x004778f5 mov rdi, rbp | rdi = rbp; 0x004778f8 call 0x489c30 | eax = _bid64_class (); 0x004778fd lea rcx, [r15 + 0x18] | rcx = r15 + 0x18; 0x00477901 add r15, 0x20 | r15 += 0x20; 0x00477905 cmp eax, 1 | | if (eax == 1) { 0x00477908 cmove r15, rcx | r15 = rcx; | } 0x0047790c mov rbx, qword [r15] | rbx = *(r15); | label_6: 0x0047790f mov rdi, rbx | 0x00477912 call 0x404760 | rax = strlen (*(r15)); 0x00477917 mov rbp, rax | 0x0047791a movsxd rax, r13d | rax = (int64_t) r13d; 0x0047791d cmp rbp, rax | | if (rbp <= rax) { 0x00477920 jg 0x477935 | 0x00477922 test rbp, rbp | | if (rbp == 0) { 0x00477925 je 0x477935 | goto label_7; | } 0x00477927 mov rdi, r12 | 0x0047792a mov rsi, rbx | 0x0047792d mov rdx, rbp | 0x00477930 call 0x404970 | rax = memmove (r12, rbx, rbp); | } | label_7: 0x00477935 mov edx, dword [rsp + 0x10] | edx = *((rsp + 0x10)); 0x00477939 jmp 0x4779f3 | goto label_8; | } 0x0047793e mov rcx, rbp | rcx = rbp; 0x00477941 shr rcx, 0x35 | rcx >>= 0x35; 0x00477945 and ecx, 0x3ff | ecx &= 0x3ff; 0x0047794b add ecx, 0xfffffe72 | ecx += 0xfffffe72; 0x00477951 and r14, rbp | r14 &= rbp; | } 0x00477954 mov esi, 0xffffffff | esi = 0xffffffff; 0x00477959 movabs rdi, 0xcccccccccccccccd | rdi = 0xcccccccccccccccd; 0x00477963 nop word cs:[rax + rax] | 0x0047796d nop dword [rax] | | do { 0x00477970 mov rax, r14 | rax = r14; 0x00477973 mul rdi | rdx:rax = rax * rdi; 0x00477976 shr rdx, 3 | rdx >>= 3; 0x0047797a inc esi | esi++; 0x0047797c cmp r14, 9 | 0x00477980 mov r14, rdx | r14 = rdx; 0x00477983 ja 0x477970 | | } while (r14 > 9); 0x00477985 movups xmm0, xmmword [r15] | __asm ("movups xmm0, xmmword [r15]"); 0x00477989 movups xmm1, xmmword [r15 + 0x10] | __asm ("movups xmm1, xmmword [r15 + 0x10]"); 0x0047798e movups xmm2, xmmword [r15 + 0x20] | __asm ("movups xmm2, xmmword [r15 + 0x20]"); 0x00477993 movaps xmmword [rsp + 0x40], xmm2 | *((rsp + 0x40)) = xmm2; 0x00477998 movaps xmmword [rsp + 0x30], xmm1 | *((rsp + 0x30)) = xmm1; 0x0047799d movaps xmmword [rsp + 0x20], xmm0 | *((rsp + 0x20)) = xmm0; 0x004779a2 test ecx, ecx | | if (ecx <= 0) { 0x004779a4 jg 0x4779ca | 0x004779a6 lea eax, [rcx + rsi + 1] | eax = rcx + rsi + 1; 0x004779aa cmp eax, 0xfffffffb | | if (eax >= 0xfffffffb) { 0x004779ad jl 0x4779ca | 0x004779af neg ecx | ecx = -ecx; 0x004779b1 mov dword [rsp + 0x20], ecx | *((rsp + 0x20)) = ecx; 0x004779b5 lea rcx, [rsp + 0x20] | 0x004779ba mov rdi, r12 | 0x004779bd mov esi, r13d | 0x004779c0 mov rdx, rbp | 0x004779c3 call 0x478de0 | intBloombergLP::bdldfp::(anonymousnamespace)::formatFixed(char*,int,BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType64,BloombergLP::bdldfp::DecimalFormatConfigconst&) (r12, r13d, rbp, rsp + 0x20); 0x004779c8 jmp 0x4779e1 | | } | } else { 0x004779ca mov dword [rsp + 0x20], esi | *((rsp + 0x20)) = esi; 0x004779ce lea rcx, [rsp + 0x20] | 0x004779d3 mov rdi, r12 | 0x004779d6 mov esi, r13d | 0x004779d9 mov rdx, rbp | 0x004779dc call 0x478a90 | eax = intBloombergLP::bdldfp::(anonymousnamespace)::formatScientific(char*,int,BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType64,BloombergLP::bdldfp::DecimalFormatConfigconst&) (r12, r13d, rbp, rsp + 0x20); | } 0x004779e1 mov ebp, eax | 0x004779e3 mov r14, qword [rsp + 0x10] | r14 = *((rsp + 0x10)); 0x004779e8 jmp 0x4779f1 | goto label_9; | label_3: 0x004779ea call 0x478a90 | eax = intBloombergLP::bdldfp::(anonymousnamespace)::formatScientific(char*,int,BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType64,BloombergLP::bdldfp::DecimalFormatConfigconst&) (rdi, rsi, rdx, rcx); | label_4: 0x004779ef mov ebp, eax | | label_9: 0x004779f1 mov edx, ebx | edx = ebx; | label_8: 0x004779f3 mov esi, dword [rsp + 0xc] | esi = *((rsp + 0xc)); | label_5: 0x004779f7 add ebp, esi | ebp += esi; 0x004779f9 cmp ebp, dword [rsp + 0x1c] | 0x004779fd setg al | al = (ebp > *((rsp + 0x1c))) ? 1 : 0; 0x00477a00 xor dl, 1 | dl ^= 1; 0x00477a03 or dl, al | dl |= al; | if (dl == 0) { 0x00477a05 jne 0x477a0e | 0x00477a07 mov al, byte [rsp + 0xb] | al = *((rsp + 0xb)); 0x00477a0b mov byte [r14], al | *(r14) = al; | } 0x00477a0e mov eax, ebp | eax = ebp; 0x00477a10 add rsp, 0x58 | 0x00477a14 pop rbx | 0x00477a15 pop r12 | 0x00477a17 pop r13 | 0x00477a19 pop r14 | 0x00477a1b pop r15 | 0x00477a1d pop rbp | 0x00477a1e ret | return rax; | }