// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request_queue.c
// Function: sendreq
static int
sendreq(struct dynamodb_request_queue * Q, struct request * R)
{
	double timeo;

	/* Get a target address. */
	R->addrs[0] = serverpool_pick(Q->SP);

	/* Record start time. */
	if (monoclock_get(&R->t_start)) {
		warnp("monoclock_get");
		goto err1;
	}

	/*
	 * Compute a timeout; we start with a timeout equal to the mean times
	 * 1.5 plus four times the mean difference then double for each retry
	 * until we hit a maximum of 15 seconds.  This is the same as TCP
	 * except for the factor of 1.5; we include that due to TCP-over-TCP
	 * issues, since the loss of a single TCP segment will result in at
	 * least one extra network RTT.
	 */
	if (R->ntries < 20) {
		timeo = (Q->tmu * 1.5 + Q->tmud * 4) * (1 << R->ntries);
		if (timeo > 15.0)
			timeo = 15.0;
	} else {
		timeo = 15.0;
	}
	R->ntries++;

	/* Time out if we take too long. */
	if ((R->timeout_cookie =
	    events_timer_register_double(callback_timeout, R, timeo)) == NULL)
		goto err1;

	/* Send the request. */
	Q->inflight++;
	if ((R->http_cookie = dynamodb_request(R->addrs, Q->key_id,
	    Q->key_secret, Q->region, R->op, R->body, R->bodylen, R->maxrlen,
	    callback_reqdone, R)) == NULL)
		goto err2;

	/* The priority of this request has changed. */
	ptrheap_increase(Q->reqs, R->rc);

	/* Success! */
	return (0);

err2:
	events_timer_cancel(R->timeout_cookie);
	R->timeout_cookie = NULL;
err1:
	sock_addr_free(R->addrs[0]);
	R->addrs[0] = NULL;

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x48, %rsp
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xabb0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x20(%rbp), %rdi
addq $0x68, %rdi
callq 0x6300
cmpl $0x0, %eax
je 0x8bc7
jmp 0x8b8d
callq 0x3040
cmpl $0x0, (%rax)
je 0x8bb2
leaq 0x15d92(%rip), %rdi     # 0x1e930
movb $0x0, %al
callq 0x66e0
callq 0x3040
movl $0x0, (%rax)
jmp 0x8bc0
leaq 0x15d77(%rip), %rdi     # 0x1e930
movb $0x0, %al
callq 0x6930
jmp 0x8bc2
jmp 0x8d43
movq -0x20(%rbp), %rax
cmpq $0x14, 0x60(%rax)
jae 0x8c42
movq -0x18(%rbp), %rax
movsd 0x88(%rax), %xmm0
movq -0x18(%rbp), %rax
movsd 0x15cee(%rip), %xmm1    # 0x1e8d8
mulsd 0x90(%rax), %xmm1
movsd 0x15cd6(%rip), %xmm2    # 0x1e8d0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
movl %eax, %ecx
movl $0x1, %eax
shll %cl, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
movsd 0x15c9b(%rip), %xmm1    # 0x1e8c8
ucomisd %xmm1, %xmm0
jbe 0x8c40
movsd 0x15c8d(%rip), %xmm0    # 0x1e8c8
movsd %xmm0, -0x28(%rbp)
jmp 0x8c4f
movsd 0x15c7e(%rip), %xmm0    # 0x1e8c8
movsd %xmm0, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rax)
movq -0x20(%rbp), %rsi
movsd -0x28(%rbp), %xmm0
leaq 0x131(%rip), %rdi       # 0x8da0
callq 0x5fc0
movq -0x20(%rbp), %rcx
movq %rax, 0x58(%rcx)
cmpq $0x0, %rax
jne 0x8c87
jmp 0x8d43
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x68(%rax)
movq -0x20(%rbp), %rdi
addq $0x40, %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %r8
movq -0x20(%rbp), %rax
movq 0x10(%rax), %r9
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rbx
movq -0x20(%rbp), %rax
movq 0x20(%rax), %r11
movq -0x20(%rbp), %rax
leaq 0x14f(%rip), %r10       # 0x8e30
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x12ba0
movq -0x20(%rbp), %rcx
movq %rax, 0x50(%rcx)
cmpq $0x0, %rax
jne 0x8d09
jmp 0x8d2a
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rsi
callq 0xbf70
movl $0x0, -0xc(%rbp)
jmp 0x8d63
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x6020
movq -0x20(%rbp), %rax
movq $0x0, 0x58(%rax)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x11a60
movq -0x20(%rbp), %rax
movq $0x0, 0x40(%rax)
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl -0xc(%rbp), %eax
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)