// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request_queue.c
// Function: runqueue
static int
runqueue(struct dynamodb_request_queue * Q)
{
	struct request * R;
	struct timeval tnow;

	/* Increase burst capacity. */
	if (monoclock_get(&tnow))
		goto err0;
	Q->bucket_cap += timeval_diff(Q->bucket_cap_lastbump, tnow) *
	    Q->cappers;
	Q->bucket_cap_lastbump = tnow;

	/* Send requests as long as we have enough capacity. */
	while (((double)(Q->inflight + 1) * Q->mu_capperreq <= Q->maxburst_cap) &&
	    ((double)(Q->inflight + 1) * Q->mu_capperreq <= Q->bucket_cap)) {
		/* Find the highest-priority request in the queue. */
		R = ptrheap_getmin(Q->reqs);

		/* Nothing left to send? */
		if ((R == NULL) || (R->timeout_cookie != NULL))
			break;

		/* Send the highest-priority request. */
		if (sendreq(Q, R))
			goto err0;
	}

	/* Do we need to (re)start the capacity-accumulation timer? */
	if ((Q->timer_cookie == NULL) &&
	    ((double)(Q->inflight + 1) * Q->mu_capperreq > Q->bucket_cap)) {
		if ((Q->timer_cookie = events_timer_register_double(
		        poke_timer, Q, Q->spercap)) == NULL)
			goto err0;
	}

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x28(%rsp), %rdi
callq 0x54fc
testl %eax, %eax
je 0x6715
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x67eb
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
subq 0x40(%rbx), %rax
cvtsi2sd %rax, %xmm0
subq 0x48(%rbx), %rcx
cvtsi2sd %rcx, %xmm1
mulsd 0xad8f(%rip), %xmm1     # 0x114c8
addsd %xmm0, %xmm1
mulsd 0x28(%rbx), %xmm1
addsd 0x38(%rbx), %xmm1
movsd %xmm1, 0x38(%rbx)
movups 0x28(%rsp), %xmm0
movups %xmm0, 0x40(%rbx)
movq 0x68(%rbx), %rax
incq %rax
movq %rax, %xmm1
punpckldq 0xafe7(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xafef(%rip), %xmm1     # 0x11760
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x20(%rbx), %xmm0
movsd 0x50(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jae 0x67fc
xorl %ebp, %ebp
cmpq $0x0, 0x58(%rbx)
jne 0x67eb
movq 0x68(%rbx), %rax
incq %rax
movq %rax, %xmm0
punpckldq 0xafa6(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xafae(%rip), %xmm0     # 0x11760
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x20(%rbx), %xmm1
ucomisd 0x38(%rbx), %xmm1
jbe 0x67eb
movsd 0x30(%rbx), %xmm0
leaq 0x1ed(%rip), %rdi       # 0x69c3
movq %rbx, %rsi
callq 0x5339
movq %rax, 0x58(%rbx)
testq %rax, %rax
je 0x670b
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1cd(%rip), %r14       # 0x69d0
leaq 0x233(%rip), %r13       # 0x6a3d
movsd 0x38(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jb 0x678d
movq 0x70(%rbx), %rdi
callq 0x86b0
testq %rax, %rax
je 0x678d
movq %rax, %r12
cmpq $0x0, 0x58(%rax)
jne 0x678d
movq 0x18(%rbx), %rdi
callq 0x7d0d
leaq 0x40(%r12), %r15
movq %rax, 0x40(%r12)
movq %r12, %rdi
addq $0x68, %rdi
callq 0x54fc
testl %eax, %eax
jne 0x6969
movq 0x60(%r12), %rcx
movsd 0xaf1b(%rip), %xmm3     # 0x11788
movapd %xmm3, %xmm0
cmpq $0x13, %rcx
ja 0x68b7
movsd 0x90(%rbx), %xmm1
mulsd 0xaf09(%rip), %xmm1     # 0x11790
movl $0x1, %eax
shll %cl, %eax
movsd 0x88(%rbx), %xmm2
mulsd 0xaefa(%rip), %xmm2     # 0x11798
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
addsd %xmm1, %xmm2
mulsd %xmm2, %xmm0
ucomisd %xmm3, %xmm0
jbe 0x68b7
movapd %xmm3, %xmm0
incq %rcx
movq %rcx, 0x60(%r12)
movq %r14, %rdi
movq %r12, %rsi
callq 0x5339
movq %rax, 0x58(%r12)
testq %rax, %rax
je 0x69af
incq 0x68(%rbx)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rcx
movq 0x8(%r12), %r8
movq 0x10(%r12), %r9
movups 0x18(%r12), %xmm0
movq %r12, 0x18(%rsp)
movq %r13, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, %rdi
callq 0xc952
movq %rax, 0x50(%r12)
testq %rax, %rax
je 0x698c
movq 0x70(%rbx), %rdi
movq 0x88(%r12), %rsi
callq 0x88e3
movq 0x68(%rbx), %rax
incq %rax
movq %rax, %xmm1
punpckldq 0xae14(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xae1c(%rip), %xmm1     # 0x11760
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x20(%rbx), %xmm0
movsd 0x50(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jae 0x680a
jmp 0x678d
callq 0x3040
cmpl $0x0, (%rax)
je 0x69a1
movq %rax, %rbx
leaq 0xae43(%rip), %rdi      # 0x117c0
xorl %eax, %eax
callq 0x57b8
movl $0x0, (%rbx)
jmp 0x69af
movq 0x58(%r12), %rdi
callq 0x536e
movq $0x0, 0x58(%r12)
jmp 0x69af
leaq 0xae18(%rip), %rdi      # 0x117c0
xorl %eax, %eax
callq 0x58d7
movq (%r15), %rdi
callq 0xbf6e
movq $0x0, (%r15)
jmp 0x670b