; assembly | /* r2dec pseudo code output */ | /* bdlde_charconvertutf16.t/assume @ 0x42e180 */ | #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) { | 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) */ 0x0042e180 push rbp | 0x0042e181 push r15 | 0x0042e183 push r14 | 0x0042e185 push r13 | 0x0042e187 push r12 | 0x0042e189 push rbx | 0x0042e18a push rax | 0x0042e18b mov r13d, r8d | r13d = r8d; 0x0042e18e mov r14, rcx | r14 = rcx; 0x0042e191 mov r15, rsi | r15 = rsi; 0x0042e194 mov r12, rdi | r12 = rdi; 0x0042e197 lea rbx, [rsi + rdx*2] | rbx = rsi + rdx*2; 0x0042e19b xor ebp, ebp | ebp = 0; 0x0042e19d test r9d, r9d | | if (r9d == 0) { 0x0042e1a0 je 0x42e275 | goto label_8; | } 0x0042e1a6 test rdx, rdx | | if (rdx <= 0) { 0x0042e1a9 jle 0x42e245 | goto label_9; | } 0x0042e1af mov rax, r15 | rax = r15; 0x0042e1b2 jmp 0x42e1d6 | goto label_10; | label_0: 0x0042e1c0 cmp edx, 0x800 | 0x0042e1c6 sbb rbp, 0 | 0x0042e1ca add rbp, 3 | rbp += 3; | do { | label_2: 0x0042e1ce mov rax, rcx | rax = rcx; 0x0042e1d1 cmp rcx, rbx | | if (rcx >= rbx) { 0x0042e1d4 jae 0x42e245 | goto label_9; | } | label_10: 0x0042e1d6 movzx ecx, word [rax] | ecx = *(rax); 0x0042e1d9 rol cx, 8 | cx = rotate_left16 (cx, 8); 0x0042e1dd cmp cx, 0x7f | | if (cx > 0x7f) { 0x0042e1e1 ja 0x42e1f0 | goto label_11; | } 0x0042e1e3 add rax, 2 | rax += 2; 0x0042e1e7 inc rbp | rbp++; | label_1: 0x0042e1ea mov rcx, rax | rcx = rax; 0x0042e1ed jmp 0x42e1ce | | } while (1); | label_11: 0x0042e1f0 movzx edx, cx | edx = (int32_t) cx; 0x0042e1f3 mov esi, edx | esi = edx; 0x0042e1f5 and esi, 0xf800 | esi &= 0xf800; 0x0042e1fb lea rcx, [rax + 2] | rcx = rax + 2; 0x0042e1ff cmp esi, 0xd800 | | if (esi != 0xd800) { 0x0042e205 jne 0x42e1c0 | goto label_0; | } 0x0042e207 cmp rcx, rbx | | if (rcx < rbx) { 0x0042e20a jae 0x42e240 | 0x0042e20c and edx, 0xfc00 | edx &= 0xfc00; 0x0042e212 cmp edx, 0xd800 | | if (edx != 0xd800) { 0x0042e218 jne 0x42e240 | goto label_12; | } 0x0042e21a movzx edx, word [rcx] | edx = *(rcx); 0x0042e21d and edx, 0xfc | edx &= 0xfc; 0x0042e223 cmp edx, 0xdc | | if (edx != 0xdc) { 0x0042e229 jne 0x42e240 | goto label_12; | } 0x0042e22b add rax, 4 | rax += 4; 0x0042e22f add rbp, 4 | rbp += 4; 0x0042e233 jmp 0x42e1ea | goto label_1; | } | label_12: 0x0042e240 inc rbp | rbp++; 0x0042e243 jmp 0x42e1ce | goto label_2; | label_9: 0x0042e245 inc rbp | rbp++; 0x0042e248 mov al, byte [r12] | al = *(r12); 0x0042e24c test al, 1 | | if ((al & 1) != 0) { 0x0042e24e jne 0x42e32d | goto label_13; | } 0x0042e254 movzx ecx, al | ecx = (int32_t) al; 0x0042e257 shr rcx, 1 | rcx >>= 1; 0x0042e25a cmp rbp, rcx | | if (rbp > rcx) { 0x0042e25d ja 0x42e33b | goto label_14; | } | label_6: 0x0042e263 test al, 1 | | if ((al & 1) != 0) { 0x0042e265 jne 0x42e354 | goto label_15; | } | label_7: 0x0042e26b lea rdi, [r12 + 1] | rdi = r12 + 1; 0x0042e270 jmp 0x42e359 | goto label_16; | label_8: 0x0042e275 test rdx, rdx | | if (rdx <= 0) { 0x0042e278 jle 0x42e315 | goto label_17; | } 0x0042e27e mov rax, r15 | rax = r15; 0x0042e281 jmp 0x42e2a6 | goto label_18; | label_3: 0x0042e290 cmp edx, 0x800 | 0x0042e296 sbb rbp, 0 | 0x0042e29a add rbp, 3 | rbp += 3; | do { | label_5: 0x0042e29e mov rax, rcx | rax = rcx; 0x0042e2a1 cmp rcx, rbx | | if (rcx >= rbx) { 0x0042e2a4 jae 0x42e315 | goto label_17; | } | label_18: 0x0042e2a6 movzx edx, word [rax] | edx = *(rax); 0x0042e2a9 cmp edx, 0x7f | | if (edx > 0x7f) { 0x0042e2ac ja 0x42e2c0 | goto label_19; | } 0x0042e2ae add rax, 2 | rax += 2; 0x0042e2b2 inc rbp | rbp++; | label_4: 0x0042e2b5 mov rcx, rax | rcx = rax; 0x0042e2b8 jmp 0x42e29e | | } while (1); | label_19: 0x0042e2c0 mov esi, edx | esi = edx; 0x0042e2c2 and esi, 0xf800 | esi &= 0xf800; 0x0042e2c8 lea rcx, [rax + 2] | rcx = rax + 2; 0x0042e2cc cmp esi, 0xd800 | | if (esi != 0xd800) { 0x0042e2d2 jne 0x42e290 | goto label_3; | } 0x0042e2d4 cmp rcx, rbx | | if (rcx < rbx) { 0x0042e2d7 jae 0x42e310 | 0x0042e2d9 and edx, 0xfc00 | edx &= 0xfc00; 0x0042e2df cmp edx, 0xd800 | | if (edx != 0xd800) { 0x0042e2e5 jne 0x42e310 | goto label_20; | } 0x0042e2e7 movzx edx, word [rcx] | edx = *(rcx); 0x0042e2ea and edx, 0xfc00 | edx &= 0xfc00; 0x0042e2f0 cmp edx, 0xdc00 | | if (edx != 0xdc00) { 0x0042e2f6 jne 0x42e310 | goto label_20; | } 0x0042e2f8 add rax, 4 | rax += 4; 0x0042e2fc add rbp, 4 | rbp += 4; 0x0042e300 jmp 0x42e2b5 | goto label_4; | } | label_20: 0x0042e310 inc rbp | rbp++; 0x0042e313 jmp 0x42e29e | goto label_5; | label_17: 0x0042e315 inc rbp | rbp++; 0x0042e318 mov al, byte [r12] | al = *(r12); 0x0042e31c test al, 1 | | if ((al & 1) != 0) { 0x0042e31e jne 0x42e370 | goto label_21; | } 0x0042e320 movzx ecx, al | ecx = (int32_t) al; 0x0042e323 shr rcx, 1 | rcx >>= 1; 0x0042e326 cmp rbp, rcx | | if (rbp > rcx) { 0x0042e329 ja 0x42e37a | goto label_22; | } 0x0042e32b jmp 0x42e38b | goto label_23; | label_13: 0x0042e32d mov rcx, qword [r12 + 8] | rcx = *((r12 + 8)); 0x0042e332 cmp rbp, rcx | | if (rbp <= rcx) { 0x0042e335 jbe 0x42e263 | goto label_6; | } | label_14: 0x0042e33b mov rdi, r12 | rdi = r12; 0x0042e33e mov rsi, rbp | rsi = rbp; 0x0042e341 xor edx, edx | edx = 0; 0x0042e343 call 0x403a30 | std::_1::basic_string,std::_1::allocator>::resize(unsigned long,char) (); 0x0042e348 mov al, byte [r12] | al = *(r12); 0x0042e34c test al, 1 | | if ((al & 1) == 0) { 0x0042e34e je 0x42e26b | goto label_7; | } | label_15: 0x0042e354 mov rdi, qword [r12 + 0x10] | rdi = *((r12 + 0x10)); | label_16: 0x0042e359 movsx r9d, r13b | r9d = (int32_t) r13b; 0x0042e35d mov r8, rsp | r8 = rsp; 0x0042e360 mov rsi, r15 | rsi = r15; 0x0042e363 mov rdx, rbx | rdx = rbx; 0x0042e366 mov rcx, r14 | rcx = r14; 0x0042e369 call 0x433280 | int(anonymousnamespace)::localUtf16ToUtf8,(anonymousnamespace)::Swapper>(char*,(anonymousnamespace)::NoOpCapacity,unsignedshortconst*,(anonymousnamespace)::Utf16::PtrBasedEnd,(anonymousnamespace)::Swapper,unsigned long*,unsigned long*,char) (); 0x0042e36e jmp 0x42e3b0 | goto label_24; | label_21: 0x0042e370 mov rcx, qword [r12 + 8] | rcx = *((r12 + 8)); 0x0042e375 cmp rbp, rcx | | if (rbp > rcx) { 0x0042e378 jbe 0x42e38b | | label_22: 0x0042e37a mov rdi, r12 | rdi = r12; 0x0042e37d mov rsi, rbp | rsi = rbp; 0x0042e380 xor edx, edx | edx = 0; 0x0042e382 call 0x403a30 | std::_1::basic_string,std::_1::allocator>::resize(unsigned long,char) (); 0x0042e387 mov al, byte [r12] | al = *(r12); | } | label_23: 0x0042e38b test al, 1 | | if ((al & 1) == 0) { 0x0042e38d jne 0x42e396 | 0x0042e38f lea rdi, [r12 + 1] | rdi = r12 + 1; 0x0042e394 jmp 0x42e39b | | } else { 0x0042e396 mov rdi, qword [r12 + 0x10] | rdi = *((r12 + 0x10)); | } 0x0042e39b movsx r9d, r13b | r9d = (int32_t) r13b; 0x0042e39f mov r8, rsp | r8 = rsp; 0x0042e3a2 mov rsi, r15 | rsi = r15; 0x0042e3a5 mov rdx, rbx | rdx = rbx; 0x0042e3a8 mov rcx, r14 | rcx = r14; 0x0042e3ab call 0x4330f0 | eax = int(anonymousnamespace)::localUtf16ToUtf8,(anonymousnamespace)::NoOpSwapper>(char*,(anonymousnamespace)::NoOpCapacity,unsignedshortconst*,(anonymousnamespace)::Utf16::PtrBasedEnd,(anonymousnamespace)::NoOpSwapper,unsigned long*,unsigned long*,char) (); | label_24: 0x0042e3b0 mov ebx, eax | ebx = eax; 0x0042e3b2 mov rsi, qword [rsp] | rsi = *(rsp); 0x0042e3b6 cmp rsi, rbp | 0x0042e3b9 dec rsi | rsi--; 0x0042e3bc mov rdi, r12 | rdi = r12; 0x0042e3bf xor edx, edx | edx = 0; 0x0042e3c1 call 0x403a30 | std::_1::basic_string,std::_1::allocator>::resize(unsigned long,char) (); 0x0042e3c6 mov eax, ebx | eax = ebx; 0x0042e3c8 add rsp, 8 | 0x0042e3cc pop rbx | 0x0042e3cd pop r12 | 0x0042e3cf pop r13 | 0x0042e3d1 pop r14 | 0x0042e3d3 pop r15 | 0x0042e3d5 pop rbp | 0x0042e3d6 ret | return rax; | }