// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]spiped/tests/nc-client/main.c
// Function: main
int
main(int argc, char ** argv)
{
	/* Command-line parameter. */
	const char * addr;

	/* Working variables. */
	struct sock_addr ** sas_t;
	struct senddata send_allocated;
	struct senddata * send = &send_allocated;

	WARNP_INIT;

	/* Parse command-line arguments. */
	if (argc < 2) {
		fprintf(stderr, "%s ADDRESS\n", argv[0]);
		goto err0;
	}
	addr = argv[1];

	/* Initialize cookie. */
	send->buffer = NULL;
	send->conndone = 0;
	send->connect_cookie = NULL;
	send->write_cookie = NULL;
	send->read_cookie = NULL;

	/* Resolve target address. */
	if ((sas_t = sock_resolve(addr)) == NULL) {
		warnp("Error resolving socket address: %s", addr);
		goto err1;
	}
	if (sas_t[0] == NULL) {
		warn0("No addresses found for %s", addr);
		goto err2;
	}

	/* Connect to target. */
	if ((send->connect_cookie = network_connect(sas_t, callback_connected,
	    send)) == NULL) {
		warn0("Error connecting");
		goto err2;
	}

	/* Loop until we're done with the connection. */
	if (events_spin(&send->conndone)) {
		warn0("Error running event loop");
		goto err3;
	}

	/* Clean up. */
	sock_addr_freelist(sas_t);
	free(send->buffer);

	/* Success! */
	exit(0);

err3:
	if (send->connect_cookie != NULL)
		network_connect_cancel(send->connect_cookie);
	if (send->write_cookie != NULL)
		network_write_cancel(send->write_cookie);
	if (send->read_cookie != NULL)
		network_read_cancel(send->read_cookie);
err2:
	sock_addr_freelist(sas_t);
err1:
	free(send->buffer);
err0:
	/* Failure! */
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2484
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x79a0
jmp 0x2486
cmpl $0x2, -0x8(%rbp)
jge 0x24b0
movq 0xbb65(%rip), %rax      # 0xdff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x7b60(%rip), %rsi      # 0xa004
movb $0x0, %al
callq 0x21e0
jmp 0x2667
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x60(%rbp), %rax
movq $0x0, (%rax)
movq -0x60(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x60(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x60(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x60(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x18(%rbp), %rdi
callq 0x5e00
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x254d
jmp 0x250b
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2534
movq -0x18(%rbp), %rsi
leaq 0x7af0(%rip), %rdi      # 0xa010
movb $0x0, %al
callq 0x7a60
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2546
movq -0x18(%rbp), %rsi
leaq 0x7ad1(%rip), %rdi      # 0xa010
movb $0x0, %al
callq 0x7cb0
jmp 0x2548
jmp 0x265b
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x257b
jmp 0x2559
movq -0x18(%rbp), %rsi
leaq 0x7acf(%rip), %rdi      # 0xa033
movb $0x0, %al
callq 0x7cb0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2652
movq -0x20(%rbp), %rdi
movq -0x60(%rbp), %rdx
leaq 0xf6(%rip), %rsi        # 0x2680
callq 0x48a0
movq -0x60(%rbp), %rcx
movq %rax, 0x18(%rcx)
cmpq $0x0, %rax
jne 0x25bd
jmp 0x259f
leaq 0x7aa7(%rip), %rdi      # 0xa04d
movb $0x0, %al
callq 0x7cb0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2652
movq -0x60(%rbp), %rdi
addq $0x14, %rdi
callq 0x2cc0
cmpl $0x0, %eax
je 0x25ec
jmp 0x25d1
leaq 0x7a86(%rip), %rdi      # 0xa05e
movb $0x0, %al
callq 0x7cb0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2608
movq -0x20(%rbp), %rdi
callq 0x6a30
movq -0x60(%rbp), %rax
movq (%rax), %rdi
callq 0x2040
xorl %edi, %edi
callq 0x22e0
movq -0x60(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x2620
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x4a50
movq -0x60(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x2638
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x57d0
movq -0x60(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x2650
movq -0x60(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x51e0
jmp 0x2652
movq -0x20(%rbp), %rdi
callq 0x6a30
movq -0x60(%rbp), %rax
movq (%rax), %rdi
callq 0x2040
movl $0x1, %edi
callq 0x22e0
nopw %cs:(%rax,%rax)