// File: /workspace/github_c_makefile_star2_O3/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 0x2568
callq 0x5e20
cmpl $0x1, %ebp
jg 0x2592
movq 0x8a84(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq (%rbx), %rdx
leaq 0x4a83(%rip), %rsi      # 0x7004
xorl %eax, %eax
callq 0x21c0
movl $0x1, %edi
callq 0x22b0
movq 0x8(%rbx), %r14
movq $0x0, (%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x14(%rsp)
movups %xmm0, 0x20(%rsp)
movq %r14, %rdi
callq 0x4e1c
testq %rax, %rax
jne 0x25d7
callq 0x2090
cmpl $0x0, (%rax)
jne 0x25f3
leaq 0x4a47(%rip), %rdi      # 0x7010
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x5fbf
jmp 0x2655
movq %rax, %rbx
cmpq $0x0, (%rax)
jne 0x2612
leaq 0x4a4c(%rip), %rdi      # 0x7033
movq %r14, %rsi
xorl %eax, %eax
callq 0x5fbf
jmp 0x263e
movq %rax, %r15
leaq 0x4a13(%rip), %rdi      # 0x7010
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x5ea0
movl $0x0, (%r15)
jmp 0x2655
leaq 0xba(%rip), %rsi        # 0x26d3
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x3d64
movq %rax, 0x18(%r14)
testq %rax, %rax
jne 0x2662
leaq 0x4a16(%rip), %rdi      # 0x704d
xorl %eax, %eax
callq 0x5fbf
callq 0x2090
movl $0x0, (%rax)
movq %rbx, %rdi
callq 0x552e
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x2040
jmp 0x2588
leaq 0x14(%rsp), %rdi
callq 0x2bb9
testl %eax, %eax
jne 0x2688
movq %rbx, %rdi
callq 0x552e
movq (%rsp), %rdi
callq 0x2040
xorl %edi, %edi
callq 0x22b0
leaq 0x49cf(%rip), %rdi      # 0x705e
xorl %eax, %eax
callq 0x5fbf
callq 0x2090
movl $0x0, (%rax)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x26b0
callq 0x3e0e
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x26bf
callq 0x4967
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x2649
callq 0x4418
jmp 0x2649