// File: /workspace/github_c_makefile_star2_O1/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 0x54d0
testl %eax, %eax
je 0x688c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x6962
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
subq 0x40(%rbx), %rax
cvtsi2sd %rax, %xmm0
subq 0x48(%rbx), %rcx
cvtsi2sd %rcx, %xmm1
mulsd 0xac18(%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 0xb000(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xb008(%rip), %xmm1     # 0x118f0
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 0x6973
xorl %ebp, %ebp
cmpq $0x0, 0x58(%rbx)
jne 0x6962
movq 0x68(%rbx), %rax
incq %rax
movq %rax, %xmm0
punpckldq 0xafbf(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xafc7(%rip), %xmm0     # 0x118f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x20(%rbx), %xmm1
ucomisd 0x38(%rbx), %xmm1
jbe 0x6962
movsd 0x30(%rbx), %xmm0
leaq 0x1ed(%rip), %rdi       # 0x6b3a
movq %rbx, %rsi
callq 0x5314
movq %rax, 0x58(%rbx)
testq %rax, %rax
je 0x6882
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1cd(%rip), %r14       # 0x6b47
leaq 0x233(%rip), %r13       # 0x6bb4
movsd 0x38(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jb 0x6904
movq 0x70(%rbx), %rdi
callq 0x881f
testq %rax, %rax
je 0x6904
movq %rax, %r12
cmpq $0x0, 0x58(%rax)
jne 0x6904
movq 0x18(%rbx), %rdi
callq 0x7e79
leaq 0x40(%r12), %r15
movq %rax, 0x40(%r12)
movq %r12, %rdi
addq $0x68, %rdi
callq 0x54d0
testl %eax, %eax
jne 0x6ae0
movq 0x60(%r12), %rcx
movsd 0xaf2c(%rip), %xmm3     # 0x11910
movapd %xmm3, %xmm0
cmpq $0x13, %rcx
ja 0x6a2e
movsd 0x90(%rbx), %xmm1
mulsd 0xaf1a(%rip), %xmm1     # 0x11918
movl $0x1, %eax
shll %cl, %eax
movsd 0x88(%rbx), %xmm2
mulsd 0xaf0b(%rip), %xmm2     # 0x11920
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
addsd %xmm1, %xmm2
mulsd %xmm2, %xmm0
ucomisd %xmm3, %xmm0
jbe 0x6a2e
movapd %xmm3, %xmm0
incq %rcx
movq %rcx, 0x60(%r12)
movq %r14, %rdi
movq %r12, %rsi
callq 0x5314
movq %rax, 0x58(%r12)
testq %rax, %rax
je 0x6b26
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 0xcaca
movq %rax, 0x50(%r12)
testq %rax, %rax
je 0x6b03
movq 0x70(%rbx), %rdi
movq 0x88(%r12), %rsi
callq 0x8a4c
movq 0x68(%rbx), %rax
incq %rax
movq %rax, %xmm1
punpckldq 0xae2d(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xae35(%rip), %xmm1     # 0x118f0
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 0x6981
jmp 0x6904
callq 0x3040
cmpl $0x0, (%rax)
je 0x6b18
movq %rax, %rbx
leaq 0xae54(%rip), %rdi      # 0x11948
xorl %eax, %eax
callq 0x578c
movl $0x0, (%rbx)
jmp 0x6b26
movq 0x58(%r12), %rdi
callq 0x5349
movq $0x0, 0x58(%r12)
jmp 0x6b26
leaq 0xae29(%rip), %rdi      # 0x11948
xorl %eax, %eax
callq 0x58ab
movq (%r15), %rdi
callq 0xc0c7
movq $0x0, (%r15)
jmp 0x6882