// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/perftests/dynamodb_request/main.c
// Function: main
int
main(int argc, char * argv[])
{
	char * key_id;
	char * key_secret;
	struct sock_addr ** sas;
	const char * body;
	int done;

	WARNP_INIT;

	/* Sanity-check. */
	if (argc != 2) {
		fprintf(stderr, "usage: test_dynamodb %s\n", "<keyfile>");
		exit(1);
	}

	/* Read AWS keys. */
	if (aws_readkeys(argv[1], &key_id, &key_secret)) {
		warnp("Failure reading AWS keys");
		exit(1);
	}

	/* Resolve target addresses. */
	if ((sas = sock_resolve("dynamodb.us-east-1.amazonaws.com:443")) == NULL) {
		warnp("Cannot resolve DynamoDB DNS");
		exit(1);
	}

	/* Send DescribeTable request. */
	body = "{ \"TableName\": \"kivaloo-testing\" }";
	done = 0;
	(void)dynamodb_request(sas, key_id, key_secret, "us-east-1",
	    "DescribeTable", (const uint8_t *)body, strlen(body), 1024,
	    donereq, &done);

	/* Wait for request to complete. */
	if (events_spin(&done)) {
		warnp("Error in event loop");
		exit(1);
	}

	/* Send PutItem request. */
	body = "{"
		"\"TableName\": \"kivaloo-testing\","
		"\"ReturnConsumedCapacity\": \"TOTAL\","
		"\"Item\": {"
		    "\"K\": { \"S\": \"key\" },"
		    "\"V\": { \"B\": \"dmFsdWUK\" }"
		"}"
	    "}";
	done = 0;
	(void)dynamodb_request(sas, key_id, key_secret, "us-east-1",
	    "PutItem", (const uint8_t *)body, strlen(body), 1024,
	    donereq, &done);

	/* Wait for request to complete. */
	if (events_spin(&done)) {
		warnp("Error in event loop");
		exit(1);
	}

	/* Send GetItem request. */
	body = "{"
		"\"TableName\": \"kivaloo-testing\","
		"\"ReturnConsumedCapacity\": \"TOTAL\","
		"\"Key\": {"
		    "\"K\": { \"S\": \"key\" }"
		"}"
	    "}";
	done = 0;
	(void)dynamodb_request(sas, key_id, key_secret, "us-east-1",
	    "GetItem", (const uint8_t *)body, strlen(body), 1024,
	    donereq, &done);

	/* Wait for request to complete. */
	if (events_spin(&done)) {
		warnp("Error in event loop");
		exit(1);
	}

	/* Free address structures. */
	sock_addr_freelist(sas);

	/* Success! */
	exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x26af
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x6d00
jmp 0x26b1
cmpl $0x2, -0x8(%rbp)
je 0x26e0
movq 0x1c922(%rip), %rax     # 0x1efe0
movq (%rax), %rdi
leaq 0x1593c(%rip), %rsi     # 0x18004
leaq 0x1594e(%rip), %rdx     # 0x1801d
movb $0x0, %al
callq 0x2470
movl $0x1, %edi
callq 0x23d0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x18(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq 0x2b50
cmpl $0x0, %eax
je 0x273b
jmp 0x26fc
callq 0x2040
cmpl $0x0, (%rax)
je 0x2721
leaq 0x1591a(%rip), %rdi     # 0x18027
movb $0x0, %al
callq 0x6dc0
callq 0x2040
movl $0x0, (%rax)
jmp 0x272f
leaq 0x158ff(%rip), %rdi     # 0x18027
movb $0x0, %al
callq 0x7010
jmp 0x2731
movl $0x1, %edi
callq 0x23d0
leaq 0x158fe(%rip), %rdi     # 0x18040
callq 0x5150
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x2792
jmp 0x2753
callq 0x2040
cmpl $0x0, (%rax)
je 0x2778
leaq 0x15901(%rip), %rdi     # 0x18065
movb $0x0, %al
callq 0x6dc0
callq 0x2040
movl $0x0, (%rax)
jmp 0x2786
leaq 0x158e6(%rip), %rdi     # 0x18065
movb $0x0, %al
callq 0x7010
jmp 0x2788
movl $0x1, %edi
callq 0x23d0
leaq 0x158e8(%rip), %rax     # 0x18081
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2160
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %r9
movq %rax, %r11
leaq 0x158bd(%rip), %rcx     # 0x180a4
leaq 0x158c0(%rip), %r8      # 0x180ae
leaq 0x23b(%rip), %r10       # 0x2a30
leaq -0x34(%rbp), %rax
movq %r11, (%rsp)
movq $0x400, 0x8(%rsp)       # imm = 0x400
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x73d0
leaq -0x34(%rbp), %rdi
callq 0x3200
cmpl $0x0, %eax
je 0x2864
jmp 0x2825
callq 0x2040
cmpl $0x0, (%rax)
je 0x284a
leaq 0x15886(%rip), %rdi     # 0x180bc
movb $0x0, %al
callq 0x6dc0
callq 0x2040
movl $0x0, (%rax)
jmp 0x2858
leaq 0x1586b(%rip), %rdi     # 0x180bc
movb $0x0, %al
callq 0x7010
jmp 0x285a
movl $0x1, %edi
callq 0x23d0
leaq 0x15865(%rip), %rax     # 0x180d0
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2160
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x60(%rbp), %r9
movq %rax, %r11
leaq 0x157eb(%rip), %rcx     # 0x180a4
leaq 0x1588a(%rip), %r8      # 0x1814a
leaq 0x169(%rip), %r10       # 0x2a30
leaq -0x34(%rbp), %rax
movq %r11, (%rsp)
movq $0x400, 0x8(%rsp)       # imm = 0x400
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x73d0
leaq -0x34(%rbp), %rdi
callq 0x3200
cmpl $0x0, %eax
je 0x2936
jmp 0x28f7
callq 0x2040
cmpl $0x0, (%rax)
je 0x291c
leaq 0x157b4(%rip), %rdi     # 0x180bc
movb $0x0, %al
callq 0x6dc0
callq 0x2040
movl $0x0, (%rax)
jmp 0x292a
leaq 0x15799(%rip), %rdi     # 0x180bc
movb $0x0, %al
callq 0x7010
jmp 0x292c
movl $0x1, %edi
callq 0x23d0
leaq 0x15815(%rip), %rax     # 0x18152
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2160
movq -0x98(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq -0x80(%rbp), %r9
movq %rax, %r11
leaq 0x15707(%rip), %rcx     # 0x180a4
leaq 0x1580e(%rip), %r8      # 0x181b2
leaq 0x85(%rip), %r10        # 0x2a30
leaq -0x34(%rbp), %rax
movq %r11, (%rsp)
movq $0x400, 0x8(%rsp)       # imm = 0x400
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x73d0
leaq -0x34(%rbp), %rdi
callq 0x3200
cmpl $0x0, %eax
je 0x2a1a
jmp 0x29db
callq 0x2040
cmpl $0x0, (%rax)
je 0x2a00
leaq 0x156d0(%rip), %rdi     # 0x180bc
movb $0x0, %al
callq 0x6dc0
callq 0x2040
movl $0x0, (%rax)
jmp 0x2a0e
leaq 0x156b5(%rip), %rdi     # 0x180bc
movb $0x0, %al
callq 0x7010
jmp 0x2a10
movl $0x1, %edi
callq 0x23d0
movq -0x28(%rbp), %rdi
callq 0x5d80
xorl %edi, %edi
callq 0x23d0
nopw (%rax,%rax)