// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../lib/proto_dynamodb_kv/proto_dynamodb_kv_client.c
// Function: proto_dynamodb_kv_request_put
int
proto_dynamodb_kv_request_put(struct wire_requestqueue * Q, const char * key,
    const uint8_t * buf, size_t buflen,
    int (* callback)(void *, int), void * cookie)
{
	struct status_cookie * C;
	uint8_t *rbuf, *p;
	size_t rlen;

	/* Validate key length. */
	if (strlen(key) > 255) {
		warn0("Key is too long");
		goto err0;
	}

	/* Validate value length. */
	if (buflen > 256 * 1024) {
		warn0("Value is too long");
		goto err0;
	}

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

	/* Compute request packet size. */
	rlen = 4 + 1 + strlen(key) + 4 + buflen;

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

	/* Construct request. */
	be32enc(p, PROTO_DDBKV_PUT);
	p += 4;
	*p++ = (uint8_t)strlen(key);
	memcpy(p, key, strlen(key));
	p += strlen(key);
	be32enc(p, (uint32_t)buflen);
	p += 4;
	memcpy(p, buf, buflen);
	p += buflen;

	/* Sanity check. */
	assert(p == &rbuf[rlen]);

	/* 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 $0x18, %rsp
movq %r9, %r12
movq %r8, %r13
movq %rcx, %r15
movq %rdx, 0x10(%rsp)
movq %rsi, %rbp
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x20f0
cmpq $0x100, %rax            # imm = 0x100
jb 0x58d3
leaq 0x5047(%rip), %rdi      # 0xa918
jmp 0x58e3
cmpq $0x40001, %r15          # imm = 0x40001
jb 0x590b
leaq 0x5045(%rip), %rdi      # 0xa928
xorl %eax, %eax
callq 0x5773
callq 0x2090
movl $0x0, (%rax)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, (%rsp)
movl $0x10, %edi
callq 0x21d0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x58fa
movq %r13, (%rax)
movq %r12, 0x8(%rax)
leaq (%r15,%r14), %r13
addq $0x9, %r13
leaq 0xec(%rip), %rdx        # 0x5a28
movq (%rsp), %rdi
movq %r13, %rsi
movq %rax, 0x8(%rsp)
movq %rax, %rcx
callq 0x65ed
testq %rax, %rax
je 0x59f3
movq %rax, %r12
movl $0x10100, (%rax)        # imm = 0x10100
movq %rbp, %rdi
callq 0x20f0
leaq 0x5(%r12), %r14
movb %al, 0x4(%r12)
movq %rbp, %rdi
callq 0x20f0
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x21b0
movq %rbp, %rdi
callq 0x20f0
leaq (%r12,%rax), %r14
addq $0x5, %r14
movl %r15d, %ecx
rolw $0x8, %cx
movw %cx, 0x7(%r12,%rax)
movl %r15d, %ecx
shrl $0x10, %ecx
movb %cl, 0x6(%r12,%rax)
movb $0x0, 0x5(%r12,%rax)
leaq (%r12,%rax), %rdi
addq $0x9, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x21b0
leaq (%r15,%r14), %rax
addq $0x4, %rax
movq %r12, %rcx
addq %r13, %rcx
cmpq %rcx, %rax
jne 0x5a09
movq (%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x68c9
testl %eax, %eax
je 0x5a02
movq 0x8(%rsp), %rdi
callq 0x2040
jmp 0x58fa
xorl %ebx, %ebx
jmp 0x58fa
leaq 0x4f2a(%rip), %rdi      # 0xa93a
leaq 0x4f34(%rip), %rsi      # 0xa94b
leaq 0x4f61(%rip), %rcx      # 0xa97f
movl $0xb8, %edx
callq 0x2140