// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movl %edi, %ebp
movq (%rsi), %rdi
testq %rdi, %rdi
je 0x2566
callq 0x5dd8
cmpl $0x1, %ebp
jg 0x2590
movq 0x8a86(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq (%rbx), %rdx
leaq 0x4a85(%rip), %rsi      # 0x7004
xorl %eax, %eax
callq 0x21c0
movl $0x1, %edi
callq 0x22b0
movq 0x8(%rbx), %r14
movq $0x0, 0x8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x1c(%rsp)
movups %xmm0, 0x28(%rsp)
movq %r14, %rdi
callq 0x4db0
testq %rax, %rax
jne 0x25d4
callq 0x2090
cmpl $0x0, (%rax)
jne 0x25f0
leaq 0x4a48(%rip), %rdi      # 0x7010
movq %r14, %rsi
xorl %eax, %eax
callq 0x5f77
jmp 0x264d
movq %rax, %rbx
cmpq $0x0, (%rax)
jne 0x260c
leaq 0x4a4f(%rip), %rdi      # 0x7033
movq %r14, %rsi
xorl %eax, %eax
callq 0x5f77
jmp 0x263a
movq %rax, %rbx
leaq 0x4a16(%rip), %rdi      # 0x7010
movq %r14, %rsi
xorl %eax, %eax
callq 0x5e58
movl $0x0, (%rbx)
jmp 0x264d
leaq 0xbb(%rip), %rsi        # 0x26ce
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x3d30
movq %rax, 0x18(%r14)
testq %rax, %rax
jne 0x265c
leaq 0x4a1a(%rip), %rdi      # 0x704d
xorl %eax, %eax
callq 0x5f77
callq 0x2090
movl $0x0, (%rax)
movq %rbx, %rdi
callq 0x54c7
movq 0x8(%rsp), %rdi
callq 0x2040
jmp 0x2586
leaq 0x1c(%rsp), %rdi
callq 0x2bc1
testl %eax, %eax
jne 0x2683
movq %rbx, %rdi
callq 0x54c7
movq 0x8(%rsp), %rdi
callq 0x2040
xorl %edi, %edi
callq 0x22b0
leaq 0x49d4(%rip), %rdi      # 0x705e
xorl %eax, %eax
callq 0x5f77
callq 0x2090
movl $0x0, (%rax)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x26ab
callq 0x3dda
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x26ba
callq 0x4912
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x2645
callq 0x43e3
jmp 0x2645