// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movl %edi, %ebp
movq (%rsi), %rdi
testq %rdi, %rdi
je 0x2448
callq 0x541c
cmpl $0x1, %ebp
jg 0x2470
movq 0x8ba4(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq (%rbx), %rdx
leaq 0x4ba3(%rip), %rsi      # 0x7004
xorl %eax, %eax
callq 0x21c0
pushq $0x1
popq %rdi
callq 0x22b0
movq 0x8(%rbx), %r14
andq $0x0, (%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x14(%rsp)
movups %xmm0, 0x20(%rsp)
movq %r14, %rdi
callq 0x45a4
testq %rax, %rax
jne 0x24b2
callq 0x2090
cmpl $0x0, (%rax)
jne 0x24ce
leaq 0x4b6c(%rip), %rdi      # 0x7010
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x5628
jmp 0x252a
movq %rax, %rbx
cmpq $0x0, (%rax)
jne 0x24ea
leaq 0x4b71(%rip), %rdi      # 0x7033
movq %r14, %rsi
xorl %eax, %eax
callq 0x5628
jmp 0x2516
movq %rax, %r15
leaq 0x4b38(%rip), %rdi      # 0x7010
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x5499
andl $0x0, (%r15)
jmp 0x252a
leaq 0xb4(%rip), %rsi        # 0x25a5
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x3928
movq %rax, 0x18(%r14)
testq %rax, %rax
jne 0x2537
leaq 0x4b3e(%rip), %rdi      # 0x704d
xorl %eax, %eax
callq 0x5628
callq 0x2090
andl $0x0, (%rax)
movq %rbx, %rdi
callq 0x4ba3
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x2040
jmp 0x2468
leaq 0x14(%rsp), %rdi
callq 0x2a4b
testl %eax, %eax
jne 0x255d
movq %rbx, %rdi
callq 0x4ba3
movq (%rsp), %rdi
callq 0x2040
xorl %edi, %edi
callq 0x22b0
leaq 0x4afa(%rip), %rdi      # 0x705e
xorl %eax, %eax
callq 0x5628
callq 0x2090
andl $0x0, (%rax)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x2582
callq 0x39cf
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2591
callq 0x4323
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x251e
callq 0x3faf
jmp 0x251e