// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]spiped/perftests/recv-zeros/main.c
// Function: main
int
main(int argc, char ** argv)
{
	/* Command-line parameters. */
	const char * addr = NULL;
	size_t buflen;

	/* Working variables. */
	struct sock_addr * sa;
	int socket;
	int socket_recv;
	char * buffer;
	ssize_t r;

	WARNP_INIT;

	/* Parse command-line arguments. */
	if (argc < 3) {
		warn0("usage: %s ADDRESS BUFLEN", argv[0]);
		goto err0;
	}
	addr = argv[1];
	if (PARSENUM(&buflen, argv[2], 1, SSIZE_MAX)) {
		warnp("parsenum");
		goto err0;
	}

	/* Allocate buffer. */
	if ((buffer = malloc(buflen)) == NULL) {
		warnp("malloc");
		goto err0;
	}

	/* Resolve the address. */
	if ((sa = sock_resolve_one(addr, 0)) == NULL) {
		warn0("sock_resolve_one");
		goto err1;
	}

	/* Create a socket, bind it, mark it as listening. */
	if ((socket = sock_listener(sa)) == -1) {
		warn0("sock_listener");
		goto err2;
	}

	/* Make it blocking. */
	if (fcntl(socket, F_SETFL,
	    fcntl(socket, F_GETFL, 0) & (~O_NONBLOCK)) == -1) {
		warnp("Cannot make connection blocking");
		goto err3;
	}

	/* Accept a connection. */
	if ((socket_recv = accept(socket, NULL, NULL)) == -1) {
		warnp("accept");
		goto err3;
	}

	/* Receive data, but do nothing with it. */
	do {
		r = recv(socket_recv, buffer, buflen, MSG_WAITALL);
	} while (r == (ssize_t)buflen);
	if (r == -1) {
		warnp("recv");
		goto err4;
	}

	/* Close the connection. */
	if (close(socket_recv)) {
		warnp("close");
		goto err3;
	}

	/* Clean up. */
	if (close(socket)) {
		warnp("close");
		goto err2;
	}
	sock_addr_free(sa);
	free(buffer);

	/* Success! */
	exit(0);

err4:
	if (close(socket_recv))
		warnp("close");
err3:
	if (close(socket))
		warnp("close");
err2:
	sock_addr_free(sa);
err1:
	free(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)
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x1414
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x36a0
jmp 0x1416
cmpl $0x3, -0x8(%rbp)
jge 0x1443
jmp 0x141e
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0x2bec(%rip), %rdi      # 0x4018
movb $0x0, %al
callq 0x39b0
callq 0x10a0
movl $0x0, (%rax)
jmp 0x18c5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
callq 0x10a0
movl $0x0, (%rax)
movq $0x1, -0x20(%rbp)
movq -0x20(%rbp), %rax
shrq %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jbe 0x14c3
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movsd 0x2b85(%rip), %xmm0     # 0x4008
movsd 0x2b85(%rip), %xmm1     # 0x4010
movsd %xmm1, -0x48(%rbp)
xorl %esi, %esi
callq 0x18d0
movsd -0x48(%rbp), %xmm1
movaps %xmm0, %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0x1553
movq $-0x1, -0x20(%rbp)
xorl %eax, %eax
testb $0x1, %al
jne 0x14d3
jmp 0x151f
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rdx
xorl %eax, %eax
movl $0x1, %ecx
cmpq $0x0, %rdx
cmovbel %ecx, %eax
movslq %eax, %rsi
movq -0x20(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq $0x0, %rcx
cmovbeq %rax, %rdx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x1980
movq %rax, -0x20(%rbp)
movq %rax, -0x50(%rbp)
jmp 0x154f
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rcx
movl $0x1, %esi
movabsq $0x7fffffffffffffff, %rdx # imm = 0x7FFFFFFFFFFFFFFF
xorl %r9d, %r9d
movl %r9d, %r8d
callq 0x1a40
movq %rax, -0x20(%rbp)
xorl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
callq 0x10a0
cmpl $0x0, (%rax)
je 0x1599
jmp 0x155f
callq 0x10a0
cmpl $0x0, (%rax)
je 0x1584
leaq 0x2ac1(%rip), %rdi      # 0x4031
movb $0x0, %al
callq 0x3760
callq 0x10a0
movl $0x0, (%rax)
jmp 0x1592
leaq 0x2aa6(%rip), %rdi      # 0x4031
movb $0x0, %al
callq 0x39b0
jmp 0x1594
jmp 0x18c5
movq -0x20(%rbp), %rdi
callq 0x11e0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x15e8
jmp 0x15ae
callq 0x10a0
cmpl $0x0, (%rax)
je 0x15d3
leaq 0x2a7b(%rip), %rdi      # 0x403a
movb $0x0, %al
callq 0x3760
callq 0x10a0
movl $0x0, (%rax)
jmp 0x15e1
leaq 0x2a60(%rip), %rdi      # 0x403a
movb $0x0, %al
callq 0x39b0
jmp 0x15e3
jmp 0x18c5
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x2550
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x161d
jmp 0x15ff
leaq 0x2a3b(%rip), %rdi      # 0x4041
movb $0x0, %al
callq 0x39b0
callq 0x10a0
movl $0x0, (%rax)
jmp 0x18bc
movq -0x28(%rbp), %rdi
callq 0x2780
movl %eax, -0x2c(%rbp)
cmpl $-0x1, %eax
jne 0x164e
jmp 0x1630
leaq 0x2a1b(%rip), %rdi      # 0x4052
movb $0x0, %al
callq 0x39b0
callq 0x10a0
movl $0x0, (%rax)
jmp 0x18b3
movl -0x2c(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x2c(%rbp), %edi
movl $0x3, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x10f0
movl -0x54(%rbp), %edi
movl %eax, %edx
andl $0xfffff7ff, %edx       # imm = 0xFFFFF7FF
movl $0x4, %esi
movb $0x0, %al
callq 0x10f0
cmpl $-0x1, %eax
jne 0x16bd
jmp 0x1683
callq 0x10a0
cmpl $0x0, (%rax)
je 0x16a8
leaq 0x29cc(%rip), %rdi      # 0x4060
movb $0x0, %al
callq 0x3760
callq 0x10a0
movl $0x0, (%rax)
jmp 0x16b6
leaq 0x29b1(%rip), %rdi      # 0x4060
movb $0x0, %al
callq 0x39b0
jmp 0x16b8
jmp 0x186b
movl -0x2c(%rbp), %edi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x1250
movl %eax, -0x30(%rbp)
cmpl $-0x1, %eax
jne 0x1710
jmp 0x16d6
callq 0x10a0
cmpl $0x0, (%rax)
je 0x16fb
leaq 0x2999(%rip), %rdi      # 0x4080
movb $0x0, %al
callq 0x3760
callq 0x10a0
movl $0x0, (%rax)
jmp 0x1709
leaq 0x297e(%rip), %rdi      # 0x4080
movb $0x0, %al
callq 0x39b0
jmp 0x170b
jmp 0x186b
jmp 0x1712
movl -0x30(%rbp), %edi
movq -0x38(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x1060
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0x1712
cmpq $-0x1, -0x40(%rbp)
jne 0x1778
jmp 0x173e
callq 0x10a0
cmpl $0x0, (%rax)
je 0x1763
leaq 0x2938(%rip), %rdi      # 0x4087
movb $0x0, %al
callq 0x3760
callq 0x10a0
movl $0x0, (%rax)
jmp 0x1771
leaq 0x291d(%rip), %rdi      # 0x4087
movb $0x0, %al
callq 0x39b0
jmp 0x1773
jmp 0x1823
movl -0x30(%rbp), %edi
callq 0x1170
cmpl $0x0, %eax
je 0x17c1
jmp 0x1787
callq 0x10a0
cmpl $0x0, (%rax)
je 0x17ac
leaq 0x28f4(%rip), %rdi      # 0x408c
movb $0x0, %al
callq 0x3760
callq 0x10a0
movl $0x0, (%rax)
jmp 0x17ba
leaq 0x28d9(%rip), %rdi      # 0x408c
movb $0x0, %al
callq 0x39b0
jmp 0x17bc
jmp 0x186b
movl -0x2c(%rbp), %edi
callq 0x1170
cmpl $0x0, %eax
je 0x180a
jmp 0x17d0
callq 0x10a0
cmpl $0x0, (%rax)
je 0x17f5
leaq 0x28ab(%rip), %rdi      # 0x408c
movb $0x0, %al
callq 0x3760
callq 0x10a0
movl $0x0, (%rax)
jmp 0x1803
leaq 0x2890(%rip), %rdi      # 0x408c
movb $0x0, %al
callq 0x39b0
jmp 0x1805
jmp 0x18b3
movq -0x28(%rbp), %rdi
callq 0x26f0
movq -0x38(%rbp), %rdi
callq 0x1040
xorl %edi, %edi
callq 0x1270
movl -0x30(%rbp), %edi
callq 0x1170
cmpl $0x0, %eax
je 0x1869
jmp 0x1832
callq 0x10a0
cmpl $0x0, (%rax)
je 0x1857
leaq 0x2849(%rip), %rdi      # 0x408c
movb $0x0, %al
callq 0x3760
callq 0x10a0
movl $0x0, (%rax)
jmp 0x1865
leaq 0x282e(%rip), %rdi      # 0x408c
movb $0x0, %al
callq 0x39b0
jmp 0x1867
jmp 0x1869
jmp 0x186b
movl -0x2c(%rbp), %edi
callq 0x1170
cmpl $0x0, %eax
je 0x18b1
jmp 0x187a
callq 0x10a0
cmpl $0x0, (%rax)
je 0x189f
leaq 0x2801(%rip), %rdi      # 0x408c
movb $0x0, %al
callq 0x3760
callq 0x10a0
movl $0x0, (%rax)
jmp 0x18ad
leaq 0x27e6(%rip), %rdi      # 0x408c
movb $0x0, %al
callq 0x39b0
jmp 0x18af
jmp 0x18b1
jmp 0x18b3
movq -0x28(%rbp), %rdi
callq 0x26f0
movq -0x38(%rbp), %rdi
callq 0x1040
movl $0x1, %edi
callq 0x1270
nop