; assembly | /* r2dec pseudo code output */ | /* bdlde_charconvertutf16.t/assume @ 0x42df50 */ | #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_bsl::basic_string_char__std::__1::char_traits_char___bsl::allocator_char_____unsigned_short_const__unsigned_long__unsigned_long__char__BloombergLP::bdlde::ByteOrder::Enum_ () | int64_t method_BloombergLP::bdlde::CharConvertUtf16_utf16ToUtf8_bsl::basic_string_char_std::_1::char_traits_char_bsl::allocator_char_unsigned_short_const_unsigned_long_unsigned_long_char_BloombergLP::bdlde::ByteOrder::Enum_ (int64_t arg6, int64_t arg5, char * arg4, char * arg3, uint32_t arg2, char * arg1) { | r9 = arg6; | r8 = arg5; | rcx = arg4; | rdx = arg3; | rsi = arg2; | rdi = arg1; | /* BloombergLP::bdlde::CharConvertUtf16::utf16ToUtf8(bsl::basic_string, bsl::allocator >*, unsigned short const*, unsigned long, unsigned long*, char, BloombergLP::bdlde::ByteOrder::Enum) */ 0x0042df50 push rbp | 0x0042df51 push r15 | 0x0042df53 push r14 | 0x0042df55 push r13 | 0x0042df57 push r12 | 0x0042df59 push rbx | 0x0042df5a push rax | 0x0042df5b mov r13d, r8d | r13d = r8d; 0x0042df5e mov r14, rcx | r14 = rcx; 0x0042df61 mov r15, rsi | r15 = rsi; 0x0042df64 mov r12, rdi | r12 = rdi; 0x0042df67 lea rbx, [rsi + rdx*2] | rbx = rsi + rdx*2; 0x0042df6b xor ebp, ebp | ebp = 0; 0x0042df6d test r9d, r9d | | if (r9d == 0) { 0x0042df70 je 0x42e04a | goto label_6; | } 0x0042df76 test rdx, rdx | | if (rdx <= 0) { 0x0042df79 jle 0x42e015 | goto label_7; | } 0x0042df7f mov rax, r15 | rax = r15; 0x0042df82 jmp 0x42dfa6 | goto label_8; | label_0: 0x0042df90 cmp edx, 0x800 | 0x0042df96 sbb rbp, 0 | 0x0042df9a add rbp, 3 | rbp += 3; | do { | label_2: 0x0042df9e mov rax, rcx | rax = rcx; 0x0042dfa1 cmp rcx, rbx | | if (rcx >= rbx) { 0x0042dfa4 jae 0x42e015 | goto label_7; | } | label_8: 0x0042dfa6 movzx ecx, word [rax] | ecx = *(rax); 0x0042dfa9 rol cx, 8 | cx = rotate_left16 (cx, 8); 0x0042dfad cmp cx, 0x7f | | if (cx > 0x7f) { 0x0042dfb1 ja 0x42dfc0 | goto label_9; | } 0x0042dfb3 add rax, 2 | rax += 2; 0x0042dfb7 inc rbp | rbp++; | label_1: 0x0042dfba mov rcx, rax | rcx = rax; 0x0042dfbd jmp 0x42df9e | | } while (1); | label_9: 0x0042dfc0 movzx edx, cx | edx = (int32_t) cx; 0x0042dfc3 mov esi, edx | esi = edx; 0x0042dfc5 and esi, 0xf800 | esi &= 0xf800; 0x0042dfcb lea rcx, [rax + 2] | rcx = rax + 2; 0x0042dfcf cmp esi, 0xd800 | | if (esi != 0xd800) { 0x0042dfd5 jne 0x42df90 | goto label_0; | } 0x0042dfd7 cmp rcx, rbx | | if (rcx < rbx) { 0x0042dfda jae 0x42e010 | 0x0042dfdc and edx, 0xfc00 | edx &= 0xfc00; 0x0042dfe2 cmp edx, 0xd800 | | if (edx != 0xd800) { 0x0042dfe8 jne 0x42e010 | goto label_10; | } 0x0042dfea movzx edx, word [rcx] | edx = *(rcx); 0x0042dfed and edx, 0xfc | edx &= 0xfc; 0x0042dff3 cmp edx, 0xdc | | if (edx != 0xdc) { 0x0042dff9 jne 0x42e010 | goto label_10; | } 0x0042dffb add rax, 4 | rax += 4; 0x0042dfff add rbp, 4 | rbp += 4; 0x0042e003 jmp 0x42dfba | goto label_1; | } | label_10: 0x0042e010 inc rbp | rbp++; 0x0042e013 jmp 0x42df9e | goto label_2; | label_7: 0x0042e015 inc rbp | rbp++; 0x0042e018 cmp rbp, qword [r12 + 0x18] | | if (rbp > *((r12 + 0x18))) { 0x0042e01d jbe 0x42e036 | 0x0042e01f cmp rbp, 0xffffffffffffffff | | if (rbp == -1) { 0x0042e023 je 0x42e16f | goto label_11; | } 0x0042e029 mov rdi, r12 | 0x0042e02c mov rsi, rbp | 0x0042e02f xor edx, edx | 0x0042e031 call 0x437da0 | bsl::basic_string,bsl::allocator>::privateResizeRaw(unsigned long,char) (r12, rbp, 0); | } 0x0042e036 cmp qword [r12 + 0x20], 0x17 | | if (*((r12 + 0x20)) != 0x17) { 0x0042e03c jne 0x42e10f | goto label_12; | } 0x0042e042 mov rdi, r12 | rdi = r12; 0x0042e045 jmp 0x42e113 | goto label_13; | label_6: 0x0042e04a test rdx, rdx | | if (rdx <= 0) { 0x0042e04d jle 0x42e0e5 | goto label_14; | } 0x0042e053 mov rax, r15 | rax = r15; 0x0042e056 jmp 0x42e076 | goto label_15; | label_3: 0x0042e060 cmp edx, 0x800 | 0x0042e066 sbb rbp, 0 | 0x0042e06a add rbp, 3 | rbp += 3; | do { | label_5: 0x0042e06e mov rax, rcx | rax = rcx; 0x0042e071 cmp rcx, rbx | | if (rcx >= rbx) { 0x0042e074 jae 0x42e0e5 | goto label_14; | } | label_15: 0x0042e076 movzx edx, word [rax] | edx = *(rax); 0x0042e079 cmp edx, 0x7f | | if (edx > 0x7f) { 0x0042e07c ja 0x42e090 | goto label_16; | } 0x0042e07e add rax, 2 | rax += 2; 0x0042e082 inc rbp | rbp++; | label_4: 0x0042e085 mov rcx, rax | rcx = rax; 0x0042e088 jmp 0x42e06e | | } while (1); | label_16: 0x0042e090 mov esi, edx | esi = edx; 0x0042e092 and esi, 0xf800 | esi &= 0xf800; 0x0042e098 lea rcx, [rax + 2] | rcx = rax + 2; 0x0042e09c cmp esi, 0xd800 | | if (esi != 0xd800) { 0x0042e0a2 jne 0x42e060 | goto label_3; | } 0x0042e0a4 cmp rcx, rbx | | if (rcx < rbx) { 0x0042e0a7 jae 0x42e0e0 | 0x0042e0a9 and edx, 0xfc00 | edx &= 0xfc00; 0x0042e0af cmp edx, 0xd800 | | if (edx != 0xd800) { 0x0042e0b5 jne 0x42e0e0 | goto label_17; | } 0x0042e0b7 movzx edx, word [rcx] | edx = *(rcx); 0x0042e0ba and edx, 0xfc00 | edx &= 0xfc00; 0x0042e0c0 cmp edx, 0xdc00 | | if (edx != 0xdc00) { 0x0042e0c6 jne 0x42e0e0 | goto label_17; | } 0x0042e0c8 add rax, 4 | rax += 4; 0x0042e0cc add rbp, 4 | rbp += 4; 0x0042e0d0 jmp 0x42e085 | goto label_4; | } | label_17: 0x0042e0e0 inc rbp | rbp++; 0x0042e0e3 jmp 0x42e06e | goto label_5; | label_14: 0x0042e0e5 inc rbp | rbp++; 0x0042e0e8 cmp rbp, qword [r12 + 0x18] | | if (rbp > *((r12 + 0x18))) { 0x0042e0ed jbe 0x42e102 | 0x0042e0ef cmp rbp, 0xffffffffffffffff | | if (rbp == -1) { 0x0042e0f3 je 0x42e16f | goto label_11; | } 0x0042e0f5 mov rdi, r12 | 0x0042e0f8 mov rsi, rbp | 0x0042e0fb xor edx, edx | 0x0042e0fd call 0x437da0 | bsl::basic_string,bsl::allocator>::privateResizeRaw(unsigned long,char) (r12, rbp, 0); | } 0x0042e102 cmp qword [r12 + 0x20], 0x17 | | if (*((r12 + 0x20)) == 0x17) { 0x0042e108 jne 0x42e12a | 0x0042e10a mov rdi, r12 | rdi = r12; 0x0042e10d jmp 0x42e12e | goto label_18; | label_12: 0x0042e10f mov rdi, qword [r12] | rdi = *(r12); | label_13: 0x0042e113 movsx r9d, r13b | r9d = (int32_t) r13b; 0x0042e117 mov r8, rsp | r8 = rsp; 0x0042e11a mov rsi, r15 | rsi = r15; 0x0042e11d mov rdx, rbx | rdx = rbx; 0x0042e120 mov rcx, r14 | rcx = r14; 0x0042e123 call 0x433280 | int(anonymousnamespace)::localUtf16ToUtf8,(anonymousnamespace)::Swapper>(char*,(anonymousnamespace)::NoOpCapacity,unsignedshortconst*,(anonymousnamespace)::Utf16::PtrBasedEnd,(anonymousnamespace)::Swapper,unsigned long*,unsigned long*,char) (); 0x0042e128 jmp 0x42e143 | | } else { 0x0042e12a mov rdi, qword [r12] | rdi = *(r12); | label_18: 0x0042e12e movsx r9d, r13b | r9d = (int32_t) r13b; 0x0042e132 mov r8, rsp | r8 = rsp; 0x0042e135 mov rsi, r15 | rsi = r15; 0x0042e138 mov rdx, rbx | rdx = rbx; 0x0042e13b mov rcx, r14 | rcx = r14; 0x0042e13e call 0x4330f0 | eax = int(anonymousnamespace)::localUtf16ToUtf8,(anonymousnamespace)::NoOpSwapper>(char*,(anonymousnamespace)::NoOpCapacity,unsignedshortconst*,(anonymousnamespace)::Utf16::PtrBasedEnd,(anonymousnamespace)::NoOpSwapper,unsigned long*,unsigned long*,char) (); | } 0x0042e143 mov ebx, eax | ebx = eax; 0x0042e145 mov rsi, qword [rsp] | rsi = *(rsp); 0x0042e149 cmp rsi, rbp | 0x0042e14c test rsi, rsi | | if (rsi != 0) { 0x0042e14f je 0x42e16f | 0x0042e151 dec rsi | rsi--; 0x0042e154 mov rdi, r12 | 0x0042e157 xor edx, edx | 0x0042e159 call 0x437da0 | bsl::basic_string,bsl::allocator>::privateResizeRaw(unsigned long,char) (r12, rsi, 0); 0x0042e15e mov eax, ebx | eax = ebx; 0x0042e160 add rsp, 8 | 0x0042e164 pop rbx | 0x0042e165 pop r12 | 0x0042e167 pop r13 | 0x0042e169 pop r14 | 0x0042e16b pop r15 | 0x0042e16d pop rbp | 0x0042e16e ret | return rax; | } | label_11: 0x0042e16f mov edi, 0x45f5e2 | 0x0042e174 call 0x435460 | return BloombergLP::bslstl::StdExceptUtil::throwLengthError(char const*) ("string<...>::resize(n): string too long"); | }