// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_kv.c
// Function: dynamodb_kv_put
char *
dynamodb_kv_put(const char * table, const char * key,
    const uint8_t * buf, size_t len)
{
	/**
	 * The body of a PutItem request (with spaces added) is:
	 * { "TableName": "TABLE",
	 *   "Item": {
	 *     "K": { "S": "KEY" },
	 *     "V": { "B": "BASE64VALUE" }
	 *   },
	 *   "ReturnConsumedCapacity": "TOTAL"
	 * }
	 */
	const char * s1 = "{\"TableName\":\"";
	const char * s2 = "\",\"Item\":{\"K\":{\"S\":\"";
	const char * s3 = "\"},\"V\":{\"B\":\"";
	const char * s4 = "\"}},\"ReturnConsumedCapacity\":\"TOTAL\"}";
	size_t slen = strlen(s1) + strlen(table) + strlen(s2) + strlen(key) +
	    strlen(s3) + b64len(len) + strlen(s4);
	size_t spos = 0;
	char * s;

	/* Allocate request string. */
	if ((s = malloc(slen + 1)) == NULL)
		goto done;

	/* Construct the request, piece by piece. */
	COPYANDINCR(s, spos, s1);
	COPYANDINCR(s, spos, table);
	COPYANDINCR(s, spos, s2);
	COPYANDINCR(s, spos, key);
	COPYANDINCR(s, spos, s3);
	b64encode(buf, &s[spos], len);
	spos += b64len(len);
	COPYANDINCR(s, spos, s4);
	s[spos] = '\0';

	/* Check that we got the buffer size right. */
	assert(slen == spos);

done:
	/* Return string (or NULL if allocation failed). */
	return (s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq 0x179e3(%rip), %rax     # 0x1e575
movq %rax, -0x28(%rbp)
leaq 0x179e7(%rip), %rax     # 0x1e584
movq %rax, -0x30(%rbp)
leaq 0x179f1(%rip), %rax     # 0x1e599
movq %rax, -0x38(%rbp)
leaq 0x179f4(%rip), %rax     # 0x1e5a7
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
callq 0x31a0
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
callq 0x31a0
movq %rax, %rcx
movq -0x88(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rdi
callq 0x31a0
movq %rax, %rcx
movq -0x80(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
callq 0x31a0
movq %rax, %rcx
movq -0x78(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rdi
callq 0x31a0
movq %rax, %rcx
movq -0x70(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
addq $0x2, %rax
movl $0x3, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq -0x68(%rbp), %rax
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rdi
callq 0x31a0
movq %rax, %rcx
movq -0x60(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x48(%rbp), %rdi
addq $0x1, %rdi
callq 0x34c0
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
jne 0x6c85
jmp 0x6eb7
jmp 0x6c87
movq -0x58(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x28(%rbp), %rdi
callq 0x31a0
movq -0x98(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq %rax, %rdx
callq 0x32c0
movq -0x28(%rbp), %rdi
callq 0x31a0
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x6cd3
movq -0x58(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x31a0
movq -0xa8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movq %rax, %rdx
callq 0x32c0
movq -0x8(%rbp), %rdi
callq 0x31a0
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x6d1f
movq -0x58(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x30(%rbp), %rdi
callq 0x31a0
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movq %rax, %rdx
callq 0x32c0
movq -0x30(%rbp), %rdi
callq 0x31a0
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x6d6b
movq -0x58(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x31a0
movq -0xc8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq %rax, %rdx
callq 0x32c0
movq -0x10(%rbp), %rdi
callq 0x31a0
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x6db7
movq -0x58(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x38(%rbp), %rdi
callq 0x31a0
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rsi
movq %rax, %rdx
callq 0x32c0
movq -0x38(%rbp), %rdi
callq 0x31a0
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
movq -0x58(%rbp), %rsi
addq -0x50(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x101a0
movq -0x20(%rbp), %rax
addq $0x2, %rax
movl $0x3, %ecx
xorl %edx, %edx
divq %rcx
shlq $0x2, %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x40(%rbp), %rdi
callq 0x31a0
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq %rax, %rdx
callq 0x32c0
movq -0x40(%rbp), %rdi
callq 0x31a0
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x6e96
jmp 0x6eb5
leaq 0x17730(%rip), %rdi     # 0x1e5cd
leaq 0x17736(%rip), %rsi     # 0x1e5da
movl $0x3d, %edx
leaq 0x17748(%rip), %rcx     # 0x1e5f8
callq 0x3240
jmp 0x6eb7
movq -0x58(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)