// File: /workspace/github_c_makefile_star2_O3/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 0x58db
leaq 0x504f(%rip), %rdi      # 0xa928
jmp 0x58eb
cmpq $0x40001, %r15          # imm = 0x40001
jb 0x5913
leaq 0x504d(%rip), %rdi      # 0xa938
xorl %eax, %eax
callq 0x577b
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 0x5902
movq %r13, (%rax)
movq %r12, 0x8(%rax)
leaq (%r15,%r14), %r13
addq $0x9, %r13
leaq 0xec(%rip), %rdx        # 0x5a30
movq (%rsp), %rdi
movq %r13, %rsi
movq %rax, 0x8(%rsp)
movq %rax, %rcx
callq 0x6602
testq %rax, %rax
je 0x59fb
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 0x5a11
movq (%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x68fd
testl %eax, %eax
je 0x5a0a
movq 0x8(%rsp), %rdi
callq 0x2040
jmp 0x5902
xorl %ebx, %ebx
jmp 0x5902
leaq 0x4f32(%rip), %rdi      # 0xa94a
leaq 0x4f3c(%rip), %rsi      # 0xa95b
leaq 0x4f69(%rip), %rcx      # 0xa98f
movl $0xb8, %edx
callq 0x2140