// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request_queue.c
// Function: dynamodb_request_queue_init
struct dynamodb_request_queue *
dynamodb_request_queue_init(const char * key_id, const char * key_secret,
    const char * region, struct serverpool * SP)
{
	struct dynamodb_request_queue * Q;

	/* Allocate a request queue structure. */
	if ((Q = malloc(sizeof(struct dynamodb_request_queue))) == NULL)
		goto err0;

	/* Copy in strings. */
	if ((Q->key_id = strdup(key_id)) == NULL)
		goto err1;
	if ((Q->key_secret = strdup(key_secret)) == NULL)
		goto err2;
	if ((Q->region = strdup(region)) == NULL)
		goto err3;

	/* Record the server pool to draw IP addresses from. */
	Q->SP = SP;

	/*
	 * Initialize rate-limiting parameters.  The initial bucket capacity
	 * is set to 300 seconds of 50k capacity units per second; this
	 * allows an effectively unlimited burst until the first "capacity
	 * exceeded" warning is seen, after which bucket_cap is limited to
	 * 300 seconds of provisioned capacity.
	 */
	Q->mu_capperreq = 1.0;
	Q->bucket_cap = 300.0 * 50000.0;
	dynamodb_request_queue_setcapacity(Q, 0);
	if (monoclock_get(&Q->bucket_cap_lastbump))
		goto err4;

	/* Initialize request timeout statistics to conservative values. */
	Q->tmu = 1.0;
	Q->tmud = 0.25;

	/* We have no pending events. */
	Q->timer_cookie = NULL;
	Q->immediate_cookie = NULL;

	/* No requests yet. */
	if ((Q->reqs = ptrheap_init(compar, setreccookie, Q)) == NULL)
		goto err4;
	Q->reqnum = 0;
	Q->inflight = 0;

	/* No log file yet. */
	Q->logfile = NULL;

	/* Success! */
	return (Q);

err4:
	free(Q->region);
err3:
	insecure_memzero(Q->key_secret, strlen(Q->key_secret));
	free(Q->key_secret);
err2:
	free(Q->key_id);
err1:
	free(Q);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x98, %edi
callq 0x34c0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x8221
jmp 0x83b2
movq -0x10(%rbp), %rdi
callq 0x35f0
movq -0x30(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x823c
jmp 0x83a9
movq -0x18(%rbp), %rdi
callq 0x35f0
movq -0x30(%rbp), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0x8258
jmp 0x839d
movq -0x20(%rbp), %rdi
callq 0x35f0
movq -0x30(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0x8274
jmp 0x836b
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movsd 0x16214(%rip), %xmm0    # 0x1e4a0
movsd %xmm0, 0x20(%rax)
movq -0x30(%rbp), %rax
movsd 0x1660b(%rip), %xmm0    # 0x1e8a8
movsd %xmm0, 0x38(%rax)
movq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x83d0
movq -0x30(%rbp), %rdi
addq $0x40, %rdi
callq 0x6300
cmpl $0x0, %eax
je 0x82c6
jmp 0x835e
movq -0x30(%rbp), %rax
movsd 0x161ce(%rip), %xmm0    # 0x1e4a0
movsd %xmm0, 0x88(%rax)
movq -0x30(%rbp), %rax
movsd 0x165ca(%rip), %xmm0    # 0x1e8b0
movsd %xmm0, 0x90(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x58(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x60(%rax)
movq -0x30(%rbp), %rdx
leaq 0x16f(%rip), %rdi       # 0x8480
leaq 0x228(%rip), %rsi       # 0x8540
callq 0xb680
movq -0x30(%rbp), %rcx
movq %rax, 0x70(%rcx)
cmpq $0x0, %rax
jne 0x832d
jmp 0x835e
movq -0x30(%rbp), %rax
movq $0x0, 0x78(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x68(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x80(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x83ba
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3460
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x31a0
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x8570
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3460
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x3460
movq -0x30(%rbp), %rdi
callq 0x3460
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)