; assembly | /* r2dec pseudo code output */ | /* bslmt_fastpostsemaphore.t/none @ 0x4074a0 */ | #include | ; (fcn) method.int_BloombergLP::bslmt::ChronoUtil::timedWait_BloombergLP::bslmt::FastPostSemaphore__std::__1::chrono::steady_clock__std::__1::chrono::duration_long_long__std::__1.ratio_1l__1000000000l______BloombergLP::bslmt::FastPostSemaphore__std::__1::chrono () | int64_t method_int_BloombergLP::bslmt::ChronoUtil::timedWait_BloombergLP::bslmt::FastPostSemaphore_std::_1::chrono::steady_clock_std::_1::chrono::duration_long_long_std::_1_ratio_1l_1000000000l_BloombergLP::bslmt::FastPostSemaphore_std::_1::chrono (int32_t arg2, uint32_t arg1) { | int64_t var_8h; | int64_t var_18h; | int64_t var_20h; | rsi = arg2; | rdi = arg1; | /* int BloombergLP::bslmt::ChronoUtil::timedWait > >(BloombergLP::bslmt::FastPostSemaphore*, std::__1::chrono::time_point > > const&) */ 0x004074a0 push rbp | 0x004074a1 push r15 | 0x004074a3 push r14 | 0x004074a5 push r13 | 0x004074a7 push r12 | 0x004074a9 push rbx | 0x004074aa sub rsp, 0x28 | 0x004074ae mov rbp, rsi | 0x004074b1 mov r13, rdi | r13 = rdi; 0x004074b4 cmp dword [rdi + 0x60], 1 | | if (*((rdi + 0x60)) == 1) { 0x004074b8 jne 0x407549 | 0x004074be mov rcx, qword [rbp] | rcx = *(rbp); 0x004074c2 movabs rdx, 0x112e0be826d694b3 | rdx = 0x112e0be826d694b3; 0x004074cc mov rax, rcx | rax = rcx; 0x004074cf imul rdx | rdx:rax = rax * rdx; 0x004074d2 mov rax, rdx | rax = rdx; 0x004074d5 shr rax, 0x3f | rax >>= 0x3f; 0x004074d9 sar rdx, 0x1a | rdx >>= 0x1a; 0x004074dd add rdx, rax | rdx += rax; 0x004074e0 imul eax, edx, 0xc4653600 | eax = edx * 0xc4653600; 0x004074e6 mov qword [rsp], rdx | *(rsp) = rdx; 0x004074ea lea esi, [rax + rcx + 0x3b9ac9ff] | esi = rax + rcx + 0x3b9ac9ff; 0x004074f1 add eax, ecx | eax += ecx; 0x004074f3 cmp esi, 0x773593ff | | if (esi >= 0x773593ff) { 0x004074f9 jb 0x407523 | 0x004074fb cdqe | rax = (int64_t) eax; 0x004074fd imul rcx, rax, 0x44b82fa1 | rcx = rax * 0x44b82fa1; 0x00407504 mov rsi, rcx | rsi = rcx; 0x00407507 shr rsi, 0x3f | rsi >>= 0x3f; 0x0040750b sar rcx, 0x3c | rcx >>= 0x3c; 0x0040750f add ecx, esi | ecx += esi; 0x00407511 movsxd rcx, ecx | rcx = (int64_t) ecx; 0x00407514 add rdx, rcx | rdx += rcx; 0x00407517 mov qword [rsp], rdx | *(rsp) = rdx; 0x0040751b imul ecx, ecx, 0x3b9aca00 | ecx *= 0x3b9aca00; 0x00407521 sub eax, ecx | eax -= ecx; | } 0x00407523 mov dword [rsp + 8], eax | *((rsp + 8)) = eax; 0x00407527 test rdx, rdx | | if (rdx <= 0) { 0x0040752a jle 0x40763f | goto label_0; | } 0x00407530 test eax, eax | | if (eax >= 0) { 0x00407532 jns 0x407658 | goto label_1; | } 0x00407538 dec rdx | rdx--; 0x0040753b mov qword [rsp], rdx | *(rsp) = rdx; 0x0040753f add eax, 0x3b9aca00 | eax += 0x3b9aca00; 0x00407544 jmp 0x407654 | goto label_2; | } 0x00407549 call 0x4028a0 | rax = std::_1::chrono::steady_clock::now() (); 0x0040754e mov r14d, 0xfffffffe | r14d = 0xfffffffe; 0x00407554 cmp rax, qword [rbp] | | if (rax >= *(rbp)) { 0x00407558 jge 0x4076f5 | goto label_3; | } 0x0040755e mov rbx, rax | rbx = rax; 0x00407561 movabs r12, 0x112e0be826d694b3 | r12 = 0x112e0be826d694b3; 0x0040756b lea r15, [rsp + 0x18] | r15 = rsp + 0x18; | do { 0x00407570 mov eax, dword [r13 + 0x60] | eax = *((r13 + 0x60)); 0x00407574 test eax, eax | | if (eax != 0) { 0x00407576 je 0x407590 | 0x00407578 cmp eax, 1 | | if (eax != 1) { 0x0040757b jne 0x4075a0 | goto label_4; | } 0x0040757d call 0x422240 | BloombergLP::bsls::SystemTime::nowMonotonicClock() (); 0x00407582 jmp 0x407595 | | } else { 0x00407590 call 0x4222d0 | eax = BloombergLP::bsls::SystemTime::nowRealtimeClock() (); | } 0x00407595 jmp 0x4075a4 | goto label_5; | label_4: 0x004075a0 xor edx, edx | edx = 0; 0x004075a2 xor eax, eax | eax = 0; | label_5: 0x004075a4 mov qword [rsp + 0x18], rax | *((rsp + 0x18)) = rax; 0x004075a9 mov dword [rsp + 0x20], edx | *((rsp + 0x20)) = edx; 0x004075ad mov rcx, qword [rbp] | rcx = *(rbp); 0x004075b1 sub rcx, rbx | rcx -= rbx; 0x004075b4 mov rax, rcx | rax = rcx; 0x004075b7 imul r12 | rdx:rax = rax * r12; 0x004075ba mov rax, rdx | rax = rdx; 0x004075bd shr rax, 0x3f | rax >>= 0x3f; 0x004075c1 sar rdx, 0x1a | rdx >>= 0x1a; 0x004075c5 add rdx, rax | rdx += rax; 0x004075c8 imul eax, edx, 0xc4653600 | eax = edx * 0xc4653600; 0x004075ce add ecx, eax | ecx += eax; 0x004075d0 mov rdi, r15 | 0x004075d3 mov rsi, rdx | 0x004075d6 mov edx, ecx | 0x004075d8 call 0x4223f0 | rax = BloombergLP::bsls::TimeInterval::addInterval(long long,int) (r15, rdx, ecx); 0x004075dd movups xmm0, xmmword [rax] | __asm ("movups xmm0, xmmword [rax]"); 0x004075e0 movaps xmmword [rsp], xmm0 | *(rsp) = xmm0; 0x004075e4 mov rax, 0xfffffffff0000000 | rax = 0xfffffffff0000000; 0x004075eb lock xadd qword [r13], rax | __asm ("lock xadd qword [r13], rax"); 0x004075f1 test eax, 0x1000000 | | if ((eax & 0x1000000) != 0) { 0x004075f6 jne 0x407697 | goto label_6; | } 0x004075fc lea rdx, [rax - 0x10000000] | rdx = rax - 0x10000000; 0x00407603 mov rcx, rdx | rcx = rdx; 0x00407606 sar rcx, 0x1c | rcx >>= 0x1c; 0x0040760a and eax, 0xffffff | eax &= 0xffffff; 0x0040760f cmp rcx, rax | | if (rcx >= rax) { 0x00407612 jge 0x4076f2 | goto label_7; | } 0x00407618 mov rdi, r13 | 0x0040761b mov rsi, rsp | 0x0040761e call 0x406df0 | eax = BloombergLP::bslmt::FastPostSemaphoreImpl::timedWaitSlowPath(BloombergLP::bsls::TimeIntervalconst&,long long) (r13, rsp, rdx); 0x00407623 cmp eax, 0xfffffffe | | if (eax != 0xfffffffe) { 0x00407626 jne 0x407692 | goto label_8; | } 0x00407628 call 0x4028a0 | rax = std::_1::chrono::steady_clock::now() (); 0x0040762d mov rbx, rax | rbx = rax; 0x00407630 cmp rax, qword [rbp] | 0x00407634 jl 0x407570 | | } while (rax < *(rbp)); 0x0040763a jmp 0x4076f5 | goto label_3; | label_0: 0x0040763f test eax, eax | | if (eax > 0) { 0x00407641 jle 0x407658 | 0x00407643 test rdx, rdx | | if (rdx == 0) { 0x00407646 je 0x407658 | goto label_1; | } 0x00407648 inc rdx | rdx++; 0x0040764b mov qword [rsp], rdx | *(rsp) = rdx; 0x0040764f add eax, 0xc4653600 | eax += 0xc4653600; | label_2: 0x00407654 mov dword [rsp + 8], eax | *((rsp + 8)) = eax; | } | label_1: 0x00407658 mov rax, 0xfffffffff0000000 | rax = 0xfffffffff0000000; 0x0040765f lock xadd qword [r13], rax | __asm ("lock xadd qword [r13], rax"); 0x00407665 test eax, 0x1000000 | | if ((eax & 0x1000000) == 0) { 0x0040766a jne 0x407697 | 0x0040766c lea rdx, [rax - 0x10000000] | rdx = rax - 0x10000000; 0x00407673 mov rcx, rdx | rcx = rdx; 0x00407676 sar rcx, 0x1c | rcx >>= 0x1c; 0x0040767a and eax, 0xffffff | eax &= 0xffffff; 0x0040767f xor r14d, r14d | r14d = 0; 0x00407682 cmp rcx, rax | | if (rcx >= rax) { 0x00407685 jge 0x4076f5 | goto label_3; | } 0x00407687 mov rsi, rsp | 0x0040768a mov rdi, r13 | 0x0040768d call 0x406df0 | eax = BloombergLP::bslmt::FastPostSemaphoreImpl::timedWaitSlowPath(BloombergLP::bsls::TimeIntervalconst&,long long) (r13, rsp, rdx); | label_8: 0x00407692 mov r14d, eax | r14d = eax; 0x00407695 jmp 0x4076f5 | | } else { | label_6: 0x00407697 mov eax, 0x10000000 | eax = 0x10000000; 0x0040769c lock xadd qword [r13], rax | __asm ("lock xadd qword [r13], rax"); 0x004076a2 mov r14d, 0xffffffff | r14d = 0xffffffff; 0x004076a8 test eax, 0xffffff | | if ((eax & 0xffffff) == 0) { 0x004076ad je 0x4076f5 | goto label_3; | } 0x004076af mov ecx, eax | ecx = eax; 0x004076b1 and ecx, 0x1000000 | ecx &= 0x1000000; 0x004076b7 test rcx, rcx | | if (rcx != 0) { 0x004076ba jne 0x4076f5 | goto label_3; | } 0x004076bc add rax, 0x10000000 | rax += 0x10000000; 0x004076c2 and rax, 0xfffffffff0000000 | rax &= 0xfffffffff0000000; 0x004076c8 cmp rax, 0x10000000 | | if (rax != 0x10000000) { 0x004076ce jne 0x4076f5 | goto label_3; | } 0x004076d0 lea rbx, [r13 + 8] | rbx = r13 + 8; 0x004076d4 mov rdi, rbx | rdi = rbx; 0x004076d7 call 0x402970 | pthread_mutex_lock (); 0x004076dc mov rdi, rbx | rdi = rbx; 0x004076df call 0x4029e0 | pthread_mutex_unlock (); 0x004076e4 add r13, 0x30 | r13 += 0x30; 0x004076e8 mov rdi, r13 | rdi = r13; 0x004076eb call 0x4026b0 | pthread_cond_signal (); 0x004076f0 jmp 0x4076f5 | goto label_3; | label_7: 0x004076f2 xor r14d, r14d | r14d = 0; | } | label_3: 0x004076f5 mov eax, r14d | eax = r14d; 0x004076f8 add rsp, 0x28 | 0x004076fc pop rbx | 0x004076fd pop r12 | 0x004076ff pop r13 | 0x00407701 pop r14 | 0x00407703 pop r15 | 0x00407705 pop rbp | 0x00407706 ret | return rax; | }