// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../lib/proto_s3/proto_s3_client.c
// Function: proto_s3_request_get
int
proto_s3_request_get(struct wire_requestqueue * Q, const char * bucket,
    const char * object, size_t maxlen,
    int (* callback)(void *, int, size_t, const uint8_t *), void * cookie)
{
	struct get_cookie * C;
	uint8_t *rbuf, *p;
	size_t rlen;

	/* Validate bucket and object name lengths. */
	if ((strlen(bucket) > 255) || (strlen(object) > 255)) {
		warn0("Bucket or object name is too long");
		goto err0;
	}

	/* Validate maxlen. */
	if (maxlen > PROTO_S3_MAXLEN) {
		warn0("Maximum GET length is too long");
		goto err0;
	}

	/* Bake a cookie. */
	if ((C = malloc(sizeof(struct get_cookie))) == NULL)
		goto err0;
	C->callback = callback;
	C->cookie = cookie;

	/* Compute request packet size. */
	rlen = 6 + strlen(bucket) + strlen(object) + 4;

	/* Start writing a request. */
	if ((p = rbuf =
	    wire_requestqueue_add_getbuf(Q, rlen, callback_get, C)) == NULL)
		goto err1;

	/* Construct request. */
	be32enc(p, PROTO_S3_GET);
	p += 4;
	*p++ = (uint8_t)strlen(bucket);
	memcpy(p, bucket, strlen(bucket));
	p += strlen(bucket);
	*p++ = (uint8_t)strlen(object);
	memcpy(p, object, strlen(object));
	p += strlen(object);
	be32enc(p, (uint32_t)maxlen);

	/* Finish writing request. */
	if (wire_requestqueue_add_done(Q, rbuf, rlen))
		goto err1;

	/* Success! */
	return (0);

err1:
	free(C);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, (%rsp)
movq %r8, %r14
movq %rcx, %rbp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, 0x8(%rsp)
movq %rsi, %rdi
callq 0x2110
cmpq $0xff, %rax
ja 0x45df
movq %rax, %rbx
movq %r12, %rdi
callq 0x2110
cmpq $0x100, %rax            # imm = 0x100
jb 0x460e
leaq 0x5e8f(%rip), %rdi      # 0xa475
xorl %eax, %eax
callq 0x4233
callq 0x2090
movl $0x0, (%rax)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq %r12, 0x20(%rsp)
movl $0x80000001, %eax       # imm = 0x80000001
cmpq %rax, %rbp
jb 0x4629
leaq 0x5e87(%rip), %rdi      # 0xa4ae
jmp 0x45e6
movq %rbp, 0x18(%rsp)
movl $0x10, %edi
callq 0x2200
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x45fd
movq %r14, (%rax)
movq (%rsp), %rcx
movq %rcx, 0x8(%rax)
addq %rbx, %r15
addq $0xa, %r15
leaq 0xd6(%rip), %rdx        # 0x4731
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %rax, (%rsp)
movq %rax, %rcx
callq 0x5295
testq %rax, %rax
je 0x471c
movq %rax, %r12
movl $0x10000100, (%rax)     # imm = 0x10000100
movq %r13, %rdi
callq 0x2110
leaq 0x5(%r12), %rbx
movb %al, 0x4(%r12)
movq %r13, %rdi
callq 0x2110
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x21e0
movq %r13, %rdi
callq 0x2110
movq %rax, %rbx
addq %r12, %rax
addq $0x5, %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x2110
leaq (%r12,%rbx), %r14
addq $0x6, %r14
movb %al, 0x5(%r12,%rbx)
movq %r13, %rdi
callq 0x2110
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x21e0
movq %r13, %rdi
callq 0x2110
movq 0x18(%rsp), %rcx
bswapl %ecx
movq 0x10(%rsp), %rdx
movl %ecx, 0x1(%rax,%rdx)
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x5571
testl %eax, %eax
je 0x472a
movq (%rsp), %rdi
callq 0x2040
jmp 0x45fd
xorl %ebp, %ebp
jmp 0x45fd