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

	WARNP_INIT;

	/* Sanity-check. */
	if (argc != 2) {
		fprintf(stderr, "usage: test_s3 %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("s3.us-west-2.amazonaws.com:80")) == NULL) {
		warnp("Cannot resolve S3 DNS");
		exit(1);
	}

	/* Construct PUT request. */
	R.method = "PUT";
	R.bucket = "kivaloo-test";
	R.path = "/nelson";
	R.nheaders = 0;
	R.headers = NULL;
	R.bodylen = strlen("ha-ha\n");
	R.body = (const uint8_t *)"ha-ha\n";

	/* Send PUT request. */
	done = 0;
	(void)s3_request(sas, key_id, key_secret, "us-west-2",
	    &R, 0, donereq, &done);

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

	/* Convert the PUT into a GET. */
	R.method = "GET";
	R.bucket = "kivaloo-test";
	R.path = "/nelson";
	R.nheaders = 0;
	R.headers = NULL;
	R.bodylen = 0;
	R.body = NULL;

	/* Send PUT request. */
	done = 0;
	(void)s3_request(sas, key_id, key_secret, "us-west-2",
	    &R, 6, 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! */
	return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x255f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x6ac0
jmp 0x2561
cmpl $0x2, -0x8(%rbp)
je 0x2590
movq 0x19a8a(%rip), %rax     # 0x1bff8
movq (%rax), %rdi
leaq 0x13a8c(%rip), %rsi     # 0x16004
leaq 0x13a98(%rip), %rdx     # 0x16017
movb $0x0, %al
callq 0x2260
movl $0x1, %edi
callq 0x23a0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x18(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq 0x2910
cmpl $0x0, %eax
je 0x25eb
jmp 0x25ac
callq 0x20a0
cmpl $0x0, (%rax)
je 0x25d1
leaq 0x13a64(%rip), %rdi     # 0x16021
movb $0x0, %al
callq 0x6b80
callq 0x20a0
movl $0x0, (%rax)
jmp 0x25df
leaq 0x13a49(%rip), %rdi     # 0x16021
movb $0x0, %al
callq 0x6dd0
jmp 0x25e1
movl $0x1, %edi
callq 0x23a0
leaq 0x13a48(%rip), %rdi     # 0x1603a
callq 0x4f10
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
jne 0x2642
jmp 0x2603
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2628
leaq 0x13a44(%rip), %rdi     # 0x16058
movb $0x0, %al
callq 0x6b80
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2636
leaq 0x13a29(%rip), %rdi     # 0x16058
movb $0x0, %al
callq 0x6dd0
jmp 0x2638
movl $0x1, %edi
callq 0x23a0
leaq 0x13a25(%rip), %rax     # 0x1606e
movq %rax, -0x58(%rbp)
leaq 0x13a1e(%rip), %rax     # 0x16072
movq %rax, -0x50(%rbp)
leaq 0x13a20(%rip), %rax     # 0x1607f
movq %rax, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x6, -0x30(%rbp)
leaq 0x13a05(%rip), %rax     # 0x16087
movq %rax, -0x28(%rbp)
movl $0x0, -0x64(%rbp)
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq 0x139ee(%rip), %rcx     # 0x1608e
leaq -0x58(%rbp), %r8
xorl %eax, %eax
movl %eax, %r9d
leaq 0x150(%rip), %r10       # 0x2800
leaq -0x64(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x7010
leaq -0x64(%rbp), %rdi
callq 0x2fc0
cmpl $0x0, %eax
je 0x2711
jmp 0x26d2
callq 0x20a0
cmpl $0x0, (%rax)
je 0x26f7
leaq 0x139b5(%rip), %rdi     # 0x16098
movb $0x0, %al
callq 0x6b80
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2705
leaq 0x1399a(%rip), %rdi     # 0x16098
movb $0x0, %al
callq 0x6dd0
jmp 0x2707
movl $0x1, %edi
callq 0x23a0
leaq 0x13994(%rip), %rax     # 0x160ac
movq %rax, -0x58(%rbp)
leaq 0x1394f(%rip), %rax     # 0x16072
movq %rax, -0x50(%rbp)
leaq 0x13951(%rip), %rax     # 0x1607f
movq %rax, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x64(%rbp)
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq 0x13922(%rip), %rcx     # 0x1608e
leaq -0x58(%rbp), %r8
movl $0x6, %r9d
leaq 0x83(%rip), %r10        # 0x2800
leaq -0x64(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x7010
leaq -0x64(%rbp), %rdi
callq 0x2fc0
cmpl $0x0, %eax
je 0x27de
jmp 0x279f
callq 0x20a0
cmpl $0x0, (%rax)
je 0x27c4
leaq 0x138e8(%rip), %rdi     # 0x16098
movb $0x0, %al
callq 0x6b80
callq 0x20a0
movl $0x0, (%rax)
jmp 0x27d2
leaq 0x138cd(%rip), %rdi     # 0x16098
movb $0x0, %al
callq 0x6dd0
jmp 0x27d4
movl $0x1, %edi
callq 0x23a0
movq -0x60(%rbp), %rdi
callq 0x5b40
xorl %eax, %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)