; assembly | /* r2dec pseudo code output */ | /* bdlde_charconvertutf16.t/none @ 0x42e040 */ | #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::bdlde::CharConvertUtf16.utf16ToUtf8_std::__1::basic_string_char__std::__1::char_traits_char___std::__1::allocator_char_____unsigned_short_const__unsigned_long__unsigned_long__char__BloombergLP::bdlde::ByteOrder::Enum_ () | int64_t method_BloombergLP::bdlde::CharConvertUtf16_utf16ToUtf8_std::_1::basic_string_char_std::_1::char_traits_char_std::_1::allocator_char_unsigned_short_const_unsigned_long_unsigned_long_char_BloombergLP::bdlde::ByteOrder::Enum_ (int64_t arg6, int64_t arg5, int64_t arg4, int64_t arg3, int64_t arg2, int64_t arg1) { | int64_t var_8h; | r9 = arg6; | r8 = arg5; | rcx = arg4; | rdx = arg3; | rsi = arg2; | rdi = arg1; | /* BloombergLP::bdlde::CharConvertUtf16::utf16ToUtf8(std::__1::basic_string, std::__1::allocator >*, unsigned short const*, unsigned long, unsigned long*, char, BloombergLP::bdlde::ByteOrder::Enum) */ 0x0042e040 push rbp | 0x0042e041 push r15 | 0x0042e043 push r14 | 0x0042e045 push r12 | 0x0042e047 push rbx | 0x0042e048 sub rsp, 0x10 | 0x0042e04c mov ebp, r8d | 0x0042e04f mov r14, rcx | r14 = rcx; 0x0042e052 mov r15, rsi | r15 = rsi; 0x0042e055 mov r12, rdi | r12 = rdi; 0x0042e058 lea rbx, [rsi + rdx*2] | rbx = rsi + rdx*2; 0x0042e05c xor esi, esi | esi = 0; 0x0042e05e test r9d, r9d | | if (r9d == 0) { 0x0042e061 je 0x42e12a | goto label_8; | } 0x0042e067 test rdx, rdx | | if (rdx <= 0) { 0x0042e06a jle 0x42e0fa | goto label_9; | } 0x0042e070 mov rax, r15 | rax = r15; 0x0042e073 jmp 0x42e096 | goto label_10; | label_0: 0x0042e080 cmp edx, 0x800 | 0x0042e086 sbb rsi, 0 | 0x0042e08a add rsi, 3 | rsi += 3; | do { | label_2: 0x0042e08e mov rax, rcx | rax = rcx; 0x0042e091 cmp rcx, rbx | | if (rcx >= rbx) { 0x0042e094 jae 0x42e0fa | goto label_9; | } | label_10: 0x0042e096 movzx ecx, word [rax] | ecx = *(rax); 0x0042e099 rol cx, 8 | cx = rotate_left16 (cx, 8); 0x0042e09d cmp cx, 0x7f | | if (cx > 0x7f) { 0x0042e0a1 ja 0x42e0b0 | goto label_11; | } 0x0042e0a3 add rax, 2 | rax += 2; 0x0042e0a7 inc rsi | rsi++; | label_1: 0x0042e0aa mov rcx, rax | rcx = rax; 0x0042e0ad jmp 0x42e08e | | } while (1); | label_11: 0x0042e0b0 movzx edx, cx | edx = (int32_t) cx; 0x0042e0b3 mov edi, edx | edi = edx; 0x0042e0b5 and edi, 0xf800 | edi &= 0xf800; 0x0042e0bb lea rcx, [rax + 2] | rcx = rax + 2; 0x0042e0bf cmp edi, 0xd800 | | if (edi != 0xd800) { 0x0042e0c5 jne 0x42e080 | goto label_0; | } 0x0042e0c7 cmp rcx, rbx | | if (rcx < rbx) { 0x0042e0ca jae 0x42e0f5 | 0x0042e0cc and edx, 0xfc00 | edx &= 0xfc00; 0x0042e0d2 cmp edx, 0xd800 | | if (edx != 0xd800) { 0x0042e0d8 jne 0x42e0f5 | goto label_12; | } 0x0042e0da movzx edx, word [rcx] | edx = *(rcx); 0x0042e0dd and edx, 0xfc | edx &= 0xfc; 0x0042e0e3 cmp edx, 0xdc | | if (edx != 0xdc) { 0x0042e0e9 jne 0x42e0f5 | goto label_12; | } 0x0042e0eb add rax, 4 | rax += 4; 0x0042e0ef add rsi, 4 | rsi += 4; 0x0042e0f3 jmp 0x42e0aa | goto label_1; | } | label_12: 0x0042e0f5 inc rsi | rsi++; 0x0042e0f8 jmp 0x42e08e | goto label_2; | label_9: 0x0042e0fa inc rsi | rsi++; 0x0042e0fd mov al, byte [r12] | al = *(r12); 0x0042e101 test al, 1 | | if ((al & 1) != 0) { 0x0042e103 jne 0x42e1cf | goto label_13; | } 0x0042e109 movzx ecx, al | ecx = (int32_t) al; 0x0042e10c shr rcx, 1 | rcx >>= 1; 0x0042e10f cmp rsi, rcx | | if (rsi > rcx) { 0x0042e112 ja 0x42e1dd | goto label_14; | } | label_6: 0x0042e118 test al, 1 | | if ((al & 1) != 0) { 0x0042e11a jne 0x42e1f3 | goto label_15; | } | label_7: 0x0042e120 lea rdi, [r12 + 1] | rdi = r12 + 1; 0x0042e125 jmp 0x42e1f8 | goto label_16; | label_8: 0x0042e12a test rdx, rdx | | if (rdx <= 0) { 0x0042e12d jle 0x42e1b7 | goto label_17; | } 0x0042e133 mov rax, r15 | rax = r15; 0x0042e136 jmp 0x42e156 | goto label_18; | label_3: 0x0042e140 cmp edx, 0x800 | 0x0042e146 sbb rsi, 0 | 0x0042e14a add rsi, 3 | rsi += 3; | do { | label_5: 0x0042e14e mov rax, rcx | rax = rcx; 0x0042e151 cmp rcx, rbx | | if (rcx >= rbx) { 0x0042e154 jae 0x42e1b7 | goto label_17; | } | label_18: 0x0042e156 movzx edx, word [rax] | edx = *(rax); 0x0042e159 cmp edx, 0x7f | | if (edx > 0x7f) { 0x0042e15c ja 0x42e170 | goto label_19; | } 0x0042e15e add rax, 2 | rax += 2; 0x0042e162 inc rsi | rsi++; | label_4: 0x0042e165 mov rcx, rax | rcx = rax; 0x0042e168 jmp 0x42e14e | | } while (1); | label_19: 0x0042e170 mov edi, edx | edi = edx; 0x0042e172 and edi, 0xf800 | edi &= 0xf800; 0x0042e178 lea rcx, [rax + 2] | rcx = rax + 2; 0x0042e17c cmp edi, 0xd800 | | if (edi != 0xd800) { 0x0042e182 jne 0x42e140 | goto label_3; | } 0x0042e184 cmp rcx, rbx | | if (rcx < rbx) { 0x0042e187 jae 0x42e1b2 | 0x0042e189 and edx, 0xfc00 | edx &= 0xfc00; 0x0042e18f cmp edx, 0xd800 | | if (edx != 0xd800) { 0x0042e195 jne 0x42e1b2 | goto label_20; | } 0x0042e197 movzx edx, word [rcx] | edx = *(rcx); 0x0042e19a and edx, 0xfc00 | edx &= 0xfc00; 0x0042e1a0 cmp edx, 0xdc00 | | if (edx != 0xdc00) { 0x0042e1a6 jne 0x42e1b2 | goto label_20; | } 0x0042e1a8 add rax, 4 | rax += 4; 0x0042e1ac add rsi, 4 | rsi += 4; 0x0042e1b0 jmp 0x42e165 | goto label_4; | } | label_20: 0x0042e1b2 inc rsi | rsi++; 0x0042e1b5 jmp 0x42e14e | goto label_5; | label_17: 0x0042e1b7 inc rsi | rsi++; 0x0042e1ba mov al, byte [r12] | al = *(r12); 0x0042e1be test al, 1 | | if ((al & 1) != 0) { 0x0042e1c0 jne 0x42e211 | goto label_21; | } 0x0042e1c2 movzx ecx, al | ecx = (int32_t) al; 0x0042e1c5 shr rcx, 1 | rcx >>= 1; 0x0042e1c8 cmp rsi, rcx | | if (rsi > rcx) { 0x0042e1cb ja 0x42e21b | goto label_22; | } 0x0042e1cd jmp 0x42e229 | goto label_23; | label_13: 0x0042e1cf mov rcx, qword [r12 + 8] | rcx = *((r12 + 8)); 0x0042e1d4 cmp rsi, rcx | | if (rsi <= rcx) { 0x0042e1d7 jbe 0x42e118 | goto label_6; | } | label_14: 0x0042e1dd mov rdi, r12 | rdi = r12; 0x0042e1e0 xor edx, edx | edx = 0; 0x0042e1e2 call 0x403a30 | std::_1::basic_string,std::_1::allocator>::resize(unsigned long,char) (); 0x0042e1e7 mov al, byte [r12] | al = *(r12); 0x0042e1eb test al, 1 | | if ((al & 1) == 0) { 0x0042e1ed je 0x42e120 | goto label_7; | } | label_15: 0x0042e1f3 mov rdi, qword [r12 + 0x10] | rdi = *((r12 + 0x10)); | label_16: 0x0042e1f8 movsx r9d, bpl | r9d = (int32_t) bpl; 0x0042e1fc lea r8, [rsp + 8] | r8 = rsp + 8; 0x0042e201 mov rsi, r15 | rsi = r15; 0x0042e204 mov rdx, rbx | rdx = rbx; 0x0042e207 mov rcx, r14 | rcx = r14; 0x0042e20a call 0x433060 | int(anonymousnamespace)::localUtf16ToUtf8,(anonymousnamespace)::Swapper>(char*,(anonymousnamespace)::NoOpCapacity,unsignedshortconst*,(anonymousnamespace)::Utf16::PtrBasedEnd,(anonymousnamespace)::Swapper,unsigned long*,unsigned long*,char) (); 0x0042e20f jmp 0x42e250 | goto label_24; | label_21: 0x0042e211 mov rcx, qword [r12 + 8] | rcx = *((r12 + 8)); 0x0042e216 cmp rsi, rcx | | if (rsi > rcx) { 0x0042e219 jbe 0x42e229 | | label_22: 0x0042e21b mov rdi, r12 | rdi = r12; 0x0042e21e xor edx, edx | edx = 0; 0x0042e220 call 0x403a30 | std::_1::basic_string,std::_1::allocator>::resize(unsigned long,char) (); 0x0042e225 mov al, byte [r12] | al = *(r12); | } | label_23: 0x0042e229 test al, 1 | | if ((al & 1) == 0) { 0x0042e22b jne 0x42e234 | 0x0042e22d lea rdi, [r12 + 1] | rdi = r12 + 1; 0x0042e232 jmp 0x42e239 | | } else { 0x0042e234 mov rdi, qword [r12 + 0x10] | rdi = *((r12 + 0x10)); | } 0x0042e239 movsx r9d, bpl | r9d = (int32_t) bpl; 0x0042e23d lea r8, [rsp + 8] | r8 = rsp + 8; 0x0042e242 mov rsi, r15 | rsi = r15; 0x0042e245 mov rdx, rbx | rdx = rbx; 0x0042e248 mov rcx, r14 | rcx = r14; 0x0042e24b call 0x432ed0 | eax = int(anonymousnamespace)::localUtf16ToUtf8,(anonymousnamespace)::NoOpSwapper>(char*,(anonymousnamespace)::NoOpCapacity,unsignedshortconst*,(anonymousnamespace)::Utf16::PtrBasedEnd,(anonymousnamespace)::NoOpSwapper,unsigned long*,unsigned long*,char) (); | label_24: 0x0042e250 mov ebx, eax | ebx = eax; 0x0042e252 mov rsi, qword [rsp + 8] | rsi = *((rsp + 8)); 0x0042e257 dec rsi | rsi--; 0x0042e25a mov rdi, r12 | rdi = r12; 0x0042e25d xor edx, edx | edx = 0; 0x0042e25f call 0x403a30 | std::_1::basic_string,std::_1::allocator>::resize(unsigned long,char) (); 0x0042e264 mov eax, ebx | eax = ebx; 0x0042e266 add rsp, 0x10 | 0x0042e26a pop rbx | 0x0042e26b pop r12 | 0x0042e26d pop r14 | 0x0042e26f pop r15 | 0x0042e271 pop rbp | 0x0042e272 ret | return rax; | }