// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request.c
// Function: dynamodb_request_extracterror
int
dynamodb_request_extracterror(struct http_response * res, char ** errstr)
{
	const uint8_t * buf = res->body;
	const uint8_t * end = res->body + res->bodylen;
	size_t len;

	/* Look for __type. */
	buf = json_find(buf, end, "__type");

	/*
	 * We should be pointing at the opening double-quote of a string;
	 * move past it.
	 */
	if (buf[0] != '"')
		goto bad;
	buf++;

	/* Find a '#' inside the double-quoted string and move past it. */
	for ( ; ; buf++) {
		if ((buf == end) || (buf[0] == '"'))
			goto bad;
		if (buf[0] == '#')
			break;
	}
	buf++;

	/* Find a '"' ending the double-quoted string. */
	for (len = 0; ; len++) {
		if (&buf[len] == end)
			goto bad;
		if (buf[len] == '"')
			break;
	}

	/* Duplicate the error string. */
	if ((*errstr = malloc(len + 1)) == NULL)
		goto err0;
	memcpy(*errstr, buf, len);
	(*errstr)[len] = '\0';

	/* Success! */
	return (0);

bad:
	warn0("DynamoDB sent HTTP 400 response without valid error string!");
	if ((*errstr = strdup("ErrorNotSpecified")) == NULL)
		goto err0;

	/* We successfully parsed; not our fault DynamoDB gave us garbage. */
	return (0);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
addq 0x18(%rcx), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq 0xd3da(%rip), %rdx      # 0x1fe39
callq 0x104a0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x22, %eax
je 0x12a79
jmp 0x12b4d
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
je 0x12a9b
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x22, %eax
jne 0x12aa0
jmp 0x12b4d
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x23, %eax
jne 0x12aae
jmp 0x12abe
jmp 0x12ab0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x12a85
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rax
addq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0x12ae2
jmp 0x12b4d
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x22, %eax
jne 0x12af5
jmp 0x12b05
jmp 0x12af7
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12ad2
movq -0x30(%rbp), %rdi
addq $0x1, %rdi
callq 0x34c0
movq -0x18(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x12b21
jmp 0x12b8c
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x32c0
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x4(%rbp)
jmp 0x12b93
jmp 0x12b4f
leaq 0xd2ea(%rip), %rdi      # 0x1fe40
movb $0x0, %al
callq 0x6930
callq 0x3040
movl $0x0, (%rax)
leaq 0xd30d(%rip), %rdi      # 0x1fe7c
callq 0x35f0
movq -0x18(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x12b83
jmp 0x12b8c
movl $0x0, -0x4(%rbp)
jmp 0x12b93
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)