// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x6300
cmpl $0x0, %eax
je 0x896f
jmp 0x8b40
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq 0x40(%rcx), %rax
cvtsi2sd %rax, %xmm1
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
subq 0x48(%rcx), %rax
cvtsi2sd %rax, %xmm0
movsd 0x15b0f(%rip), %xmm2    # 0x1e4a8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movsd 0x28(%rax), %xmm2
movq -0x10(%rbp), %rax
movsd 0x38(%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rax)
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, 0x40(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
incq %rax
movq %rax, %xmm1
movaps 0x15f25(%rip), %xmm0    # 0x1e910
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x15f29(%rip), %xmm0    # 0x1e920
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movq -0x10(%rbp), %rax
mulsd 0x20(%rax), %xmm1
movq -0x10(%rbp), %rax
movsd 0x50(%rax), %xmm0
xorl %eax, %eax
ucomisd %xmm1, %xmm0
movb %al, -0x29(%rbp)
jb 0x8a71
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
incq %rax
movq %rax, %xmm1
movaps 0x15ed6(%rip), %xmm0    # 0x1e910
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x15eda(%rip), %xmm0    # 0x1e920
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movq -0x10(%rbp), %rax
mulsd 0x20(%rax), %xmm1
movq -0x10(%rbp), %rax
movsd 0x38(%rax), %xmm0
ucomisd %xmm1, %xmm0
setae %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x8a7a
jmp 0x8abb
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdi
callq 0xbbd0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x8a9d
movq -0x18(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x8a9f
jmp 0x8abb
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x8b50
cmpl $0x0, %eax
je 0x8ab6
jmp 0x8b40
jmp 0x89d4
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x8b37
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
incq %rax
movq %rax, %xmm0
movaps 0x15e33(%rip), %xmm1    # 0x1e910
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x15e37(%rip), %xmm1    # 0x1e920
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
mulsd 0x20(%rax), %xmm0
movq -0x10(%rbp), %rax
ucomisd 0x38(%rax), %xmm0
jbe 0x8b37
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movsd 0x30(%rax), %xmm0
leaq 0x250(%rip), %rdi       # 0x8d70
callq 0x5fc0
movq -0x10(%rbp), %rcx
movq %rax, 0x58(%rcx)
cmpq $0x0, %rax
jne 0x8b35
jmp 0x8b40
jmp 0x8b37
movl $0x0, -0x4(%rbp)
jmp 0x8b47
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq