// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movl $0x98, %edi
callq 0x34c0
testq %rax, %rax
je 0x63c5
movq %rax, %rbx
movq %r13, %rdi
callq 0x35e0
movq %rax, (%rbx)
testq %rax, %rax
je 0x63bd
movq %rax, %r13
movq %r12, %rdi
callq 0x35e0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x63b5
movq %rax, %r12
movq %r15, %rdi
callq 0x35e0
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x638f
movq %r14, 0x18(%rbx)
movaps 0xb3de(%rip), %xmm0     # 0x11730
movups %xmm0, 0x20(%rbx)
xorps %xmm0, %xmm0
movhps 0xb410(%rip), %xmm0     # xmm0 = xmm0[0,1],mem[0,1]
movups %xmm0, 0x30(%rbx)
movabsq $0x407f400000000000, %rax # imm = 0x407F400000000000
movq %rax, 0x50(%rbx)
movq %rbx, %rdi
addq $0x40, %rdi
callq 0x54fc
testl %eax, %eax
je 0x63d4
movq 0x10(%rbx), %rdi
callq 0x3450
movq 0x8(%rbx), %r12
movq %r12, %rdi
callq 0x3190
leaq 0x1223a(%rip), %rcx     # 0x185d8
movq (%rcx), %rcx
movq %r12, %rdi
movq %rax, %rsi
callq *%rcx
movq 0x8(%rbx), %rdi
callq 0x3450
movq (%rbx), %r13
movq %r13, %rdi
callq 0x3450
movq %rbx, %rdi
callq 0x3450
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movaps 0xb365(%rip), %xmm0     # 0x11740
movups %xmm0, 0x88(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x58(%rbx)
leaq 0x78(%rip), %rdi        # 0x6468
leaq 0xbd(%rip), %rsi        # 0x64b4
movq %rbx, %rdx
callq 0x838c
movq %rax, 0x70(%rbx)
testq %rax, %rax
je 0x6382
movq $0x0, 0x68(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x78(%rbx)
jmp 0x63c7