; assembly | /* r2dec pseudo code output */ | /* balber_berutil.t/assume @ 0x4775a0 */ | #include | ; (fcn) method.BloombergLP::bdldfp::DecimalImpUtil.format_char__int__BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType32__BloombergLP::bdldfp::DecimalFormatConfig_const_ () | int64_t method_BloombergLP::bdldfp::DecimalImpUtil_format_char_int_BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType32_BloombergLP::bdldfp::DecimalFormatConfig_const_ (int64_t arg4, int64_t arg3, int64_t arg2, int64_t arg1) { | int64_t var_fh; | int64_t var_10h; | uint32_t var_14h; | int64_t var_18h; | 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::ValueType32, BloombergLP::bdldfp::DecimalFormatConfig const&) */ 0x004775a0 push rbp | 0x004775a1 push r15 | 0x004775a3 push r14 | 0x004775a5 push r13 | 0x004775a7 push r12 | 0x004775a9 push rbx | 0x004775aa sub rsp, 0x58 | 0x004775ae mov r15, rcx | r15 = rcx; 0x004775b1 mov ebp, edx | 0x004775b3 mov r13d, esi | r13d = esi; 0x004775b6 mov qword [rsp + 0x18], rdi | *((rsp + 0x18)) = rdi; 0x004775bb mov edi, edx | edi = edx; 0x004775bd call 0x4851a0 | _bid32_class (); 0x004775c2 cdqe | rax = (int64_t) eax; 0x004775c4 mov eax, dword [rax*4 + 0x50a110] | eax = *((rax*4 + 0x50a110)); 0x004775cb test ebp, ebp | | if (ebp >= 0) { 0x004775cd js 0x4775dd | 0x004775cf cmp dword [r15 + 8], 0 | | if (*((r15 + 8)) == 0) { 0x004775d4 je 0x4775ec | goto label_0; | } 0x004775d6 mov byte [rsp + 0xf], 0x2b | *((rsp + 0xf)) = 0x2b; 0x004775db jmp 0x4775e2 | | } else { 0x004775dd mov byte [rsp + 0xf], 0x2d | *((rsp + 0xf)) = 0x2d; | } 0x004775e2 mov edx, 1 | edx = 1; 0x004775e7 mov r14b, 1 | r14b = 1; 0x004775ea jmp 0x4775f6 | goto label_1; | label_0: 0x004775ec mov byte [rsp + 0xf], 0x2b | *((rsp + 0xf)) = 0x2b; 0x004775f1 xor r14d, r14d | r14d = 0; 0x004775f4 xor edx, edx | edx = 0; | label_1: 0x004775f6 mov dword [rsp + 0x14], r13d | *((rsp + 0x14)) = r13d; 0x004775fb sub r13d, edx | r13d -= edx; 0x004775fe mov r12d, edx | r12d = edx; 0x00477601 add r12, qword [rsp + 0x18] | r12 += *((rsp + 0x18)); 0x00477606 lea ecx, [rax - 2] | ecx = rax - 2; 0x00477609 cmp ecx, 3 | | if (ecx < 3) { 0x0047760c jae 0x477642 | 0x0047760e mov ebx, edx | ebx = edx; 0x00477610 cmp dword [r15 + 4], 2 | | if (*((r15 + 4)) == 2) { 0x00477615 je 0x47765b | goto label_2; | } 0x00477617 mov edi, ebp | 0x00477619 call 0x476640 | eax = BloombergLP::bdldfp::DecimalImpUtil::normalize(BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType32) (ebp); 0x0047761e mov ebp, eax | 0x00477620 mov eax, dword [r15 + 4] | eax = *((r15 + 4)); 0x00477624 cmp eax, 2 | | if (eax == 2) { 0x00477627 je 0x47765b | goto label_2; | } 0x00477629 mov rdi, r12 | rdi = r12; 0x0047762c mov esi, r13d | esi = r13d; 0x0047762f mov edx, ebp | edx = ebp; 0x00477631 mov rcx, r15 | rcx = r15; 0x00477634 cmp eax, 1 | | if (eax == 1) { 0x00477637 je 0x477760 | goto label_3; | } 0x0047763d jmp 0x477778 | goto label_4; | } 0x00477642 test eax, eax | | if (eax != 0) { 0x00477644 je 0x47769c | 0x00477646 xor ebp, ebp | ebp = 0; 0x00477648 cmp eax, 1 | | if (eax != 1) { 0x0047764b jne 0x477781 | goto label_5; | } 0x00477651 mov dword [rsp + 0x10], edx | *((rsp + 0x10)) = edx; 0x00477655 mov rbx, qword [r15 + 0x10] | rbx = *((r15 + 0x10)); 0x00477659 jmp 0x4776b9 | goto label_6; | label_2: 0x0047765b mov edi, ebp | edi = ebp; 0x0047765d call 0x4851a0 | _bid32_class (); 0x00477662 mov eax, ebp | eax = ebp; 0x00477664 and eax, 0x60000000 | eax &= 0x60000000; 0x00477669 cmp eax, 0x60000000 | | if (eax == 0x60000000) { 0x0047766e jne 0x4776e8 | 0x00477670 mov edx, ebp | edx = ebp; 0x00477672 and edx, 0x78000000 | edx &= 0x78000000; 0x00477678 mov ecx, ebp | ecx = ebp; 0x0047767a and ecx, 0x1fffff | ecx &= 0x1fffff; 0x00477680 or ecx, 0x800000 | ecx |= 0x800000; 0x00477686 mov eax, ebp | eax = ebp; 0x00477688 shr eax, 0x15 | eax >>= 0x15; 0x0047768b movzx esi, al | esi = (int32_t) al; 0x0047768e lea eax, [rsi - 0x65] | eax = rsi - 0x65; 0x00477691 cmp edx, 0x78000000 | | if (edx == 0x78000000) { 0x00477697 cmove eax, esi | eax = esi; | } 0x0047769a jmp 0x4776fb | | } else { 0x0047769c mov dword [rsp + 0x10], edx | *((rsp + 0x10)) = edx; 0x004776a0 mov edi, ebp | edi = ebp; 0x004776a2 call 0x4851a0 | eax = _bid32_class (); 0x004776a7 lea rcx, [r15 + 0x18] | rcx = r15 + 0x18; 0x004776ab add r15, 0x20 | r15 += 0x20; 0x004776af cmp eax, 1 | | if (eax == 1) { 0x004776b2 cmove r15, rcx | r15 = rcx; | } 0x004776b6 mov rbx, qword [r15] | rbx = *(r15); | label_6: 0x004776b9 mov rdi, rbx | 0x004776bc call 0x404760 | rax = strlen (*(r15)); 0x004776c1 mov rbp, rax | 0x004776c4 movsxd rax, r13d | rax = (int64_t) r13d; 0x004776c7 cmp rbp, rax | | if (rbp <= rax) { 0x004776ca jg 0x4776df | 0x004776cc test rbp, rbp | | if (rbp == 0) { 0x004776cf je 0x4776df | goto label_7; | } 0x004776d1 mov rdi, r12 | 0x004776d4 mov rsi, rbx | 0x004776d7 mov rdx, rbp | 0x004776da call 0x404970 | memmove (r12, rbx, rbp); | } | label_7: 0x004776df mov edx, dword [rsp + 0x10] | edx = *((rsp + 0x10)); 0x004776e3 jmp 0x477781 | goto label_5; | } 0x004776e8 mov eax, ebp | eax = ebp; 0x004776ea shr eax, 0x17 | eax >>= 0x17; 0x004776ed movzx eax, al | eax = (int32_t) al; 0x004776f0 add eax, 0xffffff9b | eax += 0xffffff9b; 0x004776f3 mov ecx, ebp | ecx = ebp; 0x004776f5 and ecx, 0x7fffff | ecx &= 0x7fffff; | } 0x004776fb mov edx, 0xffffffff | edx = 0xffffffff; 0x00477700 mov esi, 0xcccccccd | esi = 0xcccccccd; 0x00477705 nop word cs:[rax + rax] | 0x0047770f nop | | do { 0x00477710 mov edi, ecx | edi = ecx; 0x00477712 imul rdi, rsi | rdi *= rsi; 0x00477716 shr rdi, 0x23 | rdi >>= 0x23; 0x0047771a inc edx | edx++; 0x0047771c cmp ecx, 9 | 0x0047771f mov ecx, edi | ecx = edi; 0x00477721 ja 0x477710 | | } while (ecx > 9); 0x00477723 movups xmm0, xmmword [r15] | __asm ("movups xmm0, xmmword [r15]"); 0x00477727 movups xmm1, xmmword [r15 + 0x10] | __asm ("movups xmm1, xmmword [r15 + 0x10]"); 0x0047772c movups xmm2, xmmword [r15 + 0x20] | __asm ("movups xmm2, xmmword [r15 + 0x20]"); 0x00477731 movaps xmmword [rsp + 0x40], xmm2 | *((rsp + 0x40)) = xmm2; 0x00477736 movaps xmmword [rsp + 0x30], xmm1 | *((rsp + 0x30)) = xmm1; 0x0047773b movaps xmmword [rsp + 0x20], xmm0 | *((rsp + 0x20)) = xmm0; 0x00477740 test eax, eax | | if (eax <= 0) { 0x00477742 jg 0x477767 | 0x00477744 lea ecx, [rax + rdx + 1] | ecx = rax + rdx + 1; 0x00477748 cmp ecx, 0xfffffffb | | if (ecx >= 0xfffffffb) { 0x0047774b jl 0x477767 | 0x0047774d neg eax | eax = -eax; 0x0047774f mov dword [rsp + 0x20], eax | *((rsp + 0x20)) = eax; 0x00477753 lea rcx, [rsp + 0x20] | 0x00477758 mov rdi, r12 | 0x0047775b mov esi, r13d | 0x0047775e mov edx, ebp | | label_3: 0x00477760 call 0x478630 | intBloombergLP::bdldfp::(anonymousnamespace)::formatFixed(char*,int,BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType32,BloombergLP::bdldfp::DecimalFormatConfigconst&) (r12, r13d, ebp, rsp + 0x20); 0x00477765 jmp 0x47777d | | } | } else { 0x00477767 mov dword [rsp + 0x20], edx | *((rsp + 0x20)) = edx; 0x0047776b lea rcx, [rsp + 0x20] | 0x00477770 mov rdi, r12 | 0x00477773 mov esi, r13d | 0x00477776 mov edx, ebp | | label_4: 0x00477778 call 0x478210 | eax = intBloombergLP::bdldfp::(anonymousnamespace)::formatScientific(char*,int,BloombergLP::bdldfp::DecimalImpUtil_IntelDfp::ValueType32,BloombergLP::bdldfp::DecimalFormatConfigconst&) (r12, r13d, ebp, rsp + 0x20); | } 0x0047777d mov ebp, eax | 0x0047777f mov edx, ebx | edx = ebx; | label_5: 0x00477781 add ebp, edx | ebp += edx; 0x00477783 cmp ebp, dword [rsp + 0x14] | 0x00477787 setg al | al = (ebp > *((rsp + 0x14))) ? 1 : 0; 0x0047778a xor r14b, 1 | r14b ^= 1; 0x0047778e or r14b, al | r14b |= al; | if (r14b == 0) { 0x00477791 jne 0x47779e | 0x00477793 mov rax, qword [rsp + 0x18] | rax = *((rsp + 0x18)); 0x00477798 mov cl, byte [rsp + 0xf] | cl = *((rsp + 0xf)); 0x0047779c mov byte [rax], cl | *(rax) = cl; | } 0x0047779e mov eax, ebp | eax = ebp; 0x004777a0 add rsp, 0x58 | 0x004777a4 pop rbx | 0x004777a5 pop r12 | 0x004777a7 pop r13 | 0x004777a9 pop r14 | 0x004777ab pop r15 | 0x004777ad pop rbp | 0x004777ae ret | return rax; | }