// File: /workspace/github_c_makefile_star2_O2/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 0x532f
leaq 0x458d(%rip), %rdi      # 0x98ba
jmp 0x533f
cmpq $0x40001, %r15          # imm = 0x40001
jb 0x5362
leaq 0x458b(%rip), %rdi      # 0x98ca
xorl %eax, %eax
callq 0x5170
callq 0x2090
andl $0x0, (%rax)
pushq $-0x1
popq %rbx
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)
pushq $0x10
popq %rdi
callq 0x21d0
pushq $-0x1
popq %rbx
testq %rax, %rax
je 0x5351
movq %r13, (%rax)
movq %r12, 0x8(%rax)
leaq (%r15,%r14), %r13
addq $0x9, %r13
leaq 0xec(%rip), %rdx        # 0x547b
movq (%rsp), %rdi
movq %r13, %rsi
movq %rax, 0x8(%rsp)
movq %rax, %rcx
callq 0x5f07
testq %rax, %rax
je 0x5446
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 0x545c
movq (%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x6129
testl %eax, %eax
je 0x5455
movq 0x8(%rsp), %rdi
callq 0x2040
jmp 0x5351
xorl %ebx, %ebx
jmp 0x5351
leaq 0x4479(%rip), %rdi      # 0x98dc
leaq 0x4483(%rip), %rsi      # 0x98ed
leaq 0x44b0(%rip), %rcx      # 0x9921
movl $0xb8, %edx
callq 0x2140