// File: /workspace/github_c_makefile_star2_O0/igaw[P]jitterdebugger/jittersamples.c
// Function: dump_samples
static void dump_samples(const char *port)
{
	struct addrinfo hints, *res, *tmp;
	struct latency_sample sp[SAMPLES_PER_PACKET];
	ssize_t len;
	size_t wlen;
	int err, sk;

	bzero(&hints, sizeof(struct addrinfo));
	hints.ai_flags = AI_PASSIVE;
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_DGRAM;
	hints.ai_protocol = IPPROTO_UDP;

	err = getaddrinfo(NULL, port, &hints, &res);
	if (err < 0)
		err_handler(errno, "getaddrinfo()");

	tmp = res;
	do {
		sk = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
		if (sk < 0)
			continue;
		err = bind(sk, res->ai_addr, res->ai_addrlen);
		if (err == 0)
			break;

		close(sk);
		res = res->ai_next;
	} while(res);

	freeaddrinfo(tmp);

	while (1) {
		len = recvfrom(sk, sp, sizeof(sp), 0, NULL, NULL);
		if (len != sizeof(sp)) {
			warn_handler("UDP packet has wrong size\n");
			continue;
		}
		wlen = fwrite(sp, sizeof(sp), 1, stdout);
		if (wlen != sizeof(sp))
			err_handler(errno, "fwrite()");
	}

	close(sk);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5f0, %rsp            # imm = 0x5F0
movq %rdi, -0x8(%rbp)
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20f0
movl $0x1, -0x38(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x2, -0x30(%rbp)
movl $0x11, -0x2c(%rbp)
movq -0x8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
leaq -0x38(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x2230
movl %eax, -0x5d4(%rbp)
cmpl $0x0, -0x5d4(%rbp)
jge 0x39c6
jmp 0x39a1
callq 0x2040
movl (%rax), %edi
leaq 0xb64(%rip), %rsi       # 0x4513
leaq 0x9f0(%rip), %rdx       # 0x43a6
leaq 0xb6d(%rip), %rcx       # 0x452a
movb $0x0, %al
callq 0x2670
jmp 0x39c6
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x40(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x40(%rbp), %rax
movl 0xc(%rax), %edx
callq 0x2270
movl %eax, -0x5d8(%rbp)
cmpl $0x0, -0x5d8(%rbp)
jge 0x39f9
jmp 0x3a49
movl -0x5d8(%rbp), %edi
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x5e0(%rbp)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x5e0(%rbp), %rsi
callq 0x21b0
movl %eax, -0x5d4(%rbp)
cmpl $0x0, -0x5d4(%rbp)
jne 0x3a32
jmp 0x3a54
movl -0x5d8(%rbp), %edi
callq 0x2100
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x39ce
movq -0x48(%rbp), %rdi
callq 0x2260
movl -0x5d8(%rbp), %edi
leaq -0x5c0(%rbp), %rsi
movq $0x0, -0x5e8(%rbp)
movq -0x5e8(%rbp), %r8
movl $0x578, %edx            # imm = 0x578
xorl %ecx, %ecx
xorl %eax, %eax
movl %eax, %r9d
callq 0x2190
movq %rax, -0x5c8(%rbp)
cmpq $0x578, -0x5c8(%rbp) # imm = 0x578
je 0x3ac1
jmp 0x3aa3
leaq 0xa8d(%rip), %rdi       # 0x4537
leaq 0x8f5(%rip), %rsi       # 0x43a6
leaq 0xa72(%rip), %rdx       # 0x452a
movb $0x0, %al
callq 0x2760
jmp 0x3a5d
leaq -0x5c0(%rbp), %rdi
movq 0x24f9(%rip), %rax      # 0x5fc8
movq (%rax), %rcx
movl $0x578, %esi            # imm = 0x578
movl $0x1, %edx
callq 0x2220
movq %rax, -0x5d0(%rbp)
cmpq $0x578, -0x5d0(%rbp) # imm = 0x578
je 0x3b1c
jmp 0x3af7
callq 0x2040
movl (%rax), %edi
leaq 0xa57(%rip), %rsi       # 0x455c
leaq 0x89a(%rip), %rdx       # 0x43a6
leaq 0xa17(%rip), %rcx       # 0x452a
movb $0x0, %al
callq 0x2670
jmp 0x3b1c
jmp 0x3a5d
nopw %cs:(%rax,%rax)