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

	/* Working variables. */
	struct sock_addr ** sas_t;
	struct timeval begin, end;
	double duration_s;
	char * buffer;
	int socket;
	size_t to_send;

	WARNP_INIT;

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

	/* Allocate and fill buffer to send. */
	if ((buffer = malloc(buflen)) == NULL) {
		warnp("Out of memory");
		goto err0;
	}
	memset(buffer, 0, buflen);

	/* Initialize count. */
	to_send = count;

	/* 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 ((socket = sock_connect(sas_t)) == -1) {
		warnp("sock_connect");
		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;
	}

	/* Get beginning time. */
	if (monoclock_get(&begin)) {
		warn0("monoclock_get");
		goto err3;
	}

	/* Send data. */
	while (to_send > 0) {
		if (write(socket, buffer, buflen) != (ssize_t)buflen) {
			warnp("write failed");
			goto err3;
		}
		to_send--;
	}

	/* We're not going to send anything else. */
	if (shutdown(socket, SHUT_WR)) {
		warnp("shutdown");
		goto err3;
	}

	/*
	 * The server should not send any data back, but attempting to read
	 * will detect when the other end of the socket is closed.
	 */
	if (read(socket, buffer, 1) != 0) {
		warnp("read");
		goto err3;
	}

	/* Get ending time. */
	if (monoclock_get(&end)) {
		warn0("monoclock_get");
		goto err3;
	}

	/* Print duration and speed. */
	duration_s = timeval_diff(begin, end);
	printf("%zu\t%zu\t%.4f\t%.2f\n", buflen, count, duration_s,
	    (double)(buflen * count) / duration_s / 1e6);

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

	/* Success! */
	exit(0);

err3:
	if (close(socket))
		warnp("close");
err2:
	sock_addr_freelist(sas_t);
err1:
	free(buffer);
err0:
	/* Failure! */
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x244f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x4c80
jmp 0x2451
cmpl $0x4, -0x8(%rbp)
je 0x247e
jmp 0x2459
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0x3be9(%rip), %rdi      # 0x6050
movb $0x0, %al
callq 0x4f90
callq 0x2090
movl $0x0, (%rax)
jmp 0x2b7a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
callq 0x2090
movl $0x0, (%rax)
movq $0x1, -0x20(%rbp)
movq -0x20(%rbp), %rax
shrq %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jbe 0x24fe
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movsd 0x3b4a(%rip), %xmm0     # 0x6008
movsd 0x3b4a(%rip), %xmm1     # 0x6010
movsd %xmm1, -0x78(%rbp)
xorl %esi, %esi
callq 0x2b90
movsd -0x78(%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 0x258e
movq $-0x1, -0x20(%rbp)
xorl %eax, %eax
testb $0x1, %al
jne 0x250e
jmp 0x255a
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 0x2c40
movq %rax, -0x20(%rbp)
movq %rax, -0x80(%rbp)
jmp 0x258a
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 0x2d00
movq %rax, -0x20(%rbp)
xorl %eax, %eax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
callq 0x2090
cmpl $0x0, (%rax)
je 0x25d4
jmp 0x259a
callq 0x2090
cmpl $0x0, (%rax)
je 0x25bf
leaq 0x3ac4(%rip), %rdi      # 0x606f
movb $0x0, %al
callq 0x4d40
callq 0x2090
movl $0x0, (%rax)
jmp 0x25cd
leaq 0x3aa9(%rip), %rdi      # 0x606f
movb $0x0, %al
callq 0x4f90
jmp 0x25cf
jmp 0x2b7a
callq 0x2090
movl $0x0, (%rax)
movq $0x1, -0x28(%rbp)
movq -0x28(%rbp), %rax
shrq %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jbe 0x2646
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movsd 0x3a00(%rip), %xmm0     # 0x6008
movsd 0x3a08(%rip), %xmm1     # 0x6018
xorl %esi, %esi
callq 0x2b90
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x39e2(%rip), %xmm1     # 0x6010
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0x26d9
movq $-0x1, -0x28(%rbp)
xorl %eax, %eax
testb $0x1, %al
jne 0x2656
jmp 0x26a2
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rdx
xorl %eax, %eax
movl $0x1, %ecx
cmpq $0x0, %rdx
cmovbel %ecx, %eax
movslq %eax, %rsi
movq -0x28(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
movq $-0x1, %rax
cmpq $0x0, %rcx
cmovbeq %rax, %rdx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x2c40
movq %rax, -0x28(%rbp)
movq %rax, -0x88(%rbp)
jmp 0x26d2
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rcx
movl $0x1, %esi
movq $-0x1, %rdx
xorl %r9d, %r9d
movl %r9d, %r8d
callq 0x2d00
movq %rax, -0x28(%rbp)
xorl %eax, %eax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
callq 0x2090
cmpl $0x0, (%rax)
je 0x271f
jmp 0x26e5
callq 0x2090
cmpl $0x0, (%rax)
je 0x270a
leaq 0x3979(%rip), %rdi      # 0x606f
movb $0x0, %al
callq 0x4d40
callq 0x2090
movl $0x0, (%rax)
jmp 0x2718
leaq 0x395e(%rip), %rdi      # 0x606f
movb $0x0, %al
callq 0x4f90
jmp 0x271a
jmp 0x2b7a
movq -0x20(%rbp), %rdi
callq 0x2220
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
jne 0x276e
jmp 0x2734
callq 0x2090
cmpl $0x0, (%rax)
je 0x2759
leaq 0x3933(%rip), %rdi      # 0x6078
movb $0x0, %al
callq 0x4d40
callq 0x2090
movl $0x0, (%rax)
jmp 0x2767
leaq 0x3918(%rip), %rdi      # 0x6078
movb $0x0, %al
callq 0x4f90
jmp 0x2769
jmp 0x2b7a
movq -0x60(%rbp), %rdi
movq -0x20(%rbp), %rdx
xorl %esi, %esi
callq 0x2190
movq -0x28(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
callq 0x30e0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x27dc
jmp 0x279a
callq 0x2090
cmpl $0x0, (%rax)
je 0x27c3
movq -0x18(%rbp), %rsi
leaq 0x38d7(%rip), %rdi      # 0x6086
movb $0x0, %al
callq 0x4d40
callq 0x2090
movl $0x0, (%rax)
jmp 0x27d5
movq -0x18(%rbp), %rsi
leaq 0x38b8(%rip), %rdi      # 0x6086
movb $0x0, %al
callq 0x4f90
jmp 0x27d7
jmp 0x2b71
movq -0x30(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x280a
jmp 0x27e8
movq -0x18(%rbp), %rsi
leaq 0x38b6(%rip), %rdi      # 0x60a9
movb $0x0, %al
callq 0x4f90
callq 0x2090
movl $0x0, (%rax)
jmp 0x2b68
movq -0x30(%rbp), %rdi
callq 0x3fb0
movl %eax, -0x64(%rbp)
cmpl $-0x1, %eax
jne 0x2857
jmp 0x281d
callq 0x2090
cmpl $0x0, (%rax)
je 0x2842
leaq 0x3895(%rip), %rdi      # 0x60c3
movb $0x0, %al
callq 0x4d40
callq 0x2090
movl $0x0, (%rax)
jmp 0x2850
leaq 0x387a(%rip), %rdi      # 0x60c3
movb $0x0, %al
callq 0x4f90
jmp 0x2852
jmp 0x2b68
movl -0x64(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x64(%rbp), %edi
movl $0x3, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x20e0
movl -0x8c(%rbp), %edi
movl %eax, %edx
andl $0xfffff7ff, %edx       # imm = 0xFFFFF7FF
movl $0x4, %esi
movb $0x0, %al
callq 0x20e0
cmpl $-0x1, %eax
jne 0x28cc
jmp 0x2892
callq 0x2090
cmpl $0x0, (%rax)
je 0x28b7
leaq 0x382d(%rip), %rdi      # 0x60d0
movb $0x0, %al
callq 0x4d40
callq 0x2090
movl $0x0, (%rax)
jmp 0x28c5
leaq 0x3812(%rip), %rdi      # 0x60d0
movb $0x0, %al
callq 0x4f90
jmp 0x28c7
jmp 0x2b20
leaq -0x40(%rbp), %rdi
callq 0x2dc0
cmpl $0x0, %eax
je 0x28fa
jmp 0x28dc
leaq 0x380d(%rip), %rdi      # 0x60f0
movb $0x0, %al
callq 0x4f90
callq 0x2090
movl $0x0, (%rax)
jmp 0x2b20
jmp 0x28fc
cmpq $0x0, -0x70(%rbp)
jbe 0x2963
movl -0x64(%rbp), %edi
movq -0x60(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x2100
cmpq -0x20(%rbp), %rax
je 0x2955
jmp 0x291b
callq 0x2090
cmpl $0x0, (%rax)
je 0x2940
leaq 0x37d2(%rip), %rdi      # 0x60fe
movb $0x0, %al
callq 0x4d40
callq 0x2090
movl $0x0, (%rax)
jmp 0x294e
leaq 0x37b7(%rip), %rdi      # 0x60fe
movb $0x0, %al
callq 0x4f90
jmp 0x2950
jmp 0x2b20
movq -0x70(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x28fc
movl -0x64(%rbp), %edi
movl $0x1, %esi
callq 0x2110
cmpl $0x0, %eax
je 0x29b1
jmp 0x2977
callq 0x2090
cmpl $0x0, (%rax)
je 0x299c
leaq 0x3783(%rip), %rdi      # 0x610b
movb $0x0, %al
callq 0x4d40
callq 0x2090
movl $0x0, (%rax)
jmp 0x29aa
leaq 0x3768(%rip), %rdi      # 0x610b
movb $0x0, %al
callq 0x4f90
jmp 0x29ac
jmp 0x2b20
movl -0x64(%rbp), %edi
movq -0x60(%rbp), %rsi
movl $0x1, %edx
callq 0x21c0
cmpq $0x0, %rax
je 0x2a04
jmp 0x29ca
callq 0x2090
cmpl $0x0, (%rax)
je 0x29ef
leaq 0x3739(%rip), %rdi      # 0x6114
movb $0x0, %al
callq 0x4d40
callq 0x2090
movl $0x0, (%rax)
jmp 0x29fd
leaq 0x371e(%rip), %rdi      # 0x6114
movb $0x0, %al
callq 0x4f90
jmp 0x29ff
jmp 0x2b20
leaq -0x50(%rbp), %rdi
callq 0x2dc0
cmpl $0x0, %eax
je 0x2a32
jmp 0x2a14
leaq 0x36d5(%rip), %rdi      # 0x60f0
movb $0x0, %al
callq 0x4f90
callq 0x2090
movl $0x0, (%rax)
jmp 0x2b20
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rcx
subq %rsi, %rdx
cvtsi2sd %rdx, %xmm1
subq %rcx, %rax
cvtsi2sd %rax, %xmm0
movsd 0x35ce(%rip), %xmm2     # 0x6028
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movsd -0x58(%rbp), %xmm0
movq %rsi, %rax
imulq %rdx, %rax
movq %rax, %xmm1
movaps 0x35a9(%rip), %xmm2     # 0x6030
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x35ad(%rip), %xmm2     # 0x6040
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd -0x58(%rbp), %xmm1
movsd 0x3571(%rip), %xmm2     # 0x6020
divsd %xmm2, %xmm1
leaq 0x365f(%rip), %rdi      # 0x6119
movb $0x2, %al
callq 0x2150
movl -0x64(%rbp), %edi
callq 0x21a0
cmpl $0x0, %eax
je 0x2b07
jmp 0x2ad0
callq 0x2090
cmpl $0x0, (%rax)
je 0x2af5
leaq 0x364b(%rip), %rdi      # 0x612c
movb $0x0, %al
callq 0x4d40
callq 0x2090
movl $0x0, (%rax)
jmp 0x2b03
leaq 0x3630(%rip), %rdi      # 0x612c
movb $0x0, %al
callq 0x4f90
jmp 0x2b05
jmp 0x2b68
movq -0x30(%rbp), %rdi
callq 0x3d10
movq -0x60(%rbp), %rdi
callq 0x2040
xorl %edi, %edi
callq 0x22b0
movl -0x64(%rbp), %edi
callq 0x21a0
cmpl $0x0, %eax
je 0x2b66
jmp 0x2b2f
callq 0x2090
cmpl $0x0, (%rax)
je 0x2b54
leaq 0x35ec(%rip), %rdi      # 0x612c
movb $0x0, %al
callq 0x4d40
callq 0x2090
movl $0x0, (%rax)
jmp 0x2b62
leaq 0x35d1(%rip), %rdi      # 0x612c
movb $0x0, %al
callq 0x4f90
jmp 0x2b64
jmp 0x2b66
jmp 0x2b68
movq -0x30(%rbp), %rdi
callq 0x3d10
movq -0x60(%rbp), %rdi
callq 0x2040
movl $0x1, %edi
callq 0x22b0
nopw %cs:(%rax,%rax)