// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request_queue.c
// Function: dynamodb_request_queue
int
dynamodb_request_queue(struct dynamodb_request_queue * Q, int prio,
    const char * op, const char * body, size_t maxrlen, const char * logstr,
    int (* callback)(void *, struct http_response *, const char *),
    void * cookie)
{
	struct request * R;

	/* Allocate and fill request structure. */
	if ((R = malloc(sizeof(struct request))) == NULL)
		goto err0;
	R->Q = Q;
	R->op = op;
	R->body = (const uint8_t *)body;
	R->bodylen = strlen(body);
	R->maxrlen = maxrlen;
	R->callback = callback;
	R->cookie = cookie;
	R->http_cookie = NULL;
	R->timeout_cookie = NULL;
	R->addrs[0] = NULL;
	R->addrs[1] = NULL;
	R->prio = prio;
	R->reqnum = Q->reqnum++;
	R->rc = 0;
	R->ntries = 0;

	/* Duplicate the additional logging data. */
	if (logstr != NULL) {
		if ((R->logstr = strdup(logstr)) == NULL)
			goto err1;
	} else {
		R->logstr = NULL;
	}

	/* Add the request to the queue. */
	if (ptrheap_add(Q->reqs, R))
		goto err2;

	/* Poke the request queue if necessary. */
	if (poke(Q))
		goto err3;

	/* Success! */
	return (0);

err3:
	ptrheap_delete(Q->reqs, R->rc);
err2:
	free(R->logstr);
err1:
	free(R);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0x90, %edi
callq 0x34c0
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x8600
jmp 0x875b
movq -0x10(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rdi
callq 0x31a0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
movq 0x10(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x30(%rax)
movq 0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x58(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x48(%rax)
movl -0x14(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x78(%rax)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x78(%rax)
movq -0x40(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x88(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x60(%rax)
cmpq $0x0, -0x38(%rbp)
je 0x86f0
movq -0x38(%rbp), %rdi
callq 0x35f0
movq -0x40(%rbp), %rcx
movq %rax, 0x28(%rcx)
cmpq $0x0, %rax
jne 0x86ee
jmp 0x8752
jmp 0x86fc
movq -0x40(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdi
movq -0x40(%rbp), %rsi
callq 0xba20
cmpl $0x0, %eax
je 0x8714
jmp 0x8745
movq -0x10(%rbp), %rdi
callq 0x8770
cmpl $0x0, %eax
je 0x8724
jmp 0x872d
movl $0x0, -0x4(%rbp)
jmp 0x8762
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdi
movq -0x40(%rbp), %rax
movq 0x88(%rax), %rsi
callq 0xbc20
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x3460
movq -0x40(%rbp), %rdi
callq 0x3460
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)