// File: /workspace/github_c_makefile_star2_O0/igaw[P]jitterdebugger/jitterdebugger.c
// Function: store_network
static void store_network(struct record_data *rec)
{
	struct latency_sample sp[SAMPLES_PER_PACKET];
	struct addrinfo hints, *res, *tmp;
	struct sockaddr *sa;
	socklen_t salen;
	int err, sk, len;
	unsigned int i, c;
	struct stats *s = rec->stats;
	struct timespec ts;
	uint64_t val;

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

	err = getaddrinfo(rec->server, rec->port, &hints, &res);
	if (err < 0)
		err_handler(err, "getaddrinfo()");

	tmp = res;
	do {
		sk = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
		if (sk >= 0)
			break;
		res = res->ai_next;
	} while (res);
	if (sk < 0)
		err_handler(ENOENT, "no server");

	sa = malloc(res->ai_addrlen);
	memcpy(sa, res->ai_addr, res->ai_addrlen);
	salen = res->ai_addrlen;

	freeaddrinfo(tmp);

	err = fcntl(sk, F_SETFL, O_NONBLOCK, 1);
	if (err < 0)
		err_handler(errno, "fcntl");

	c = 0;
	while (!READ_ONCE(jd_shutdown)) {
		for (i = 0; i < num_threads; i++) {
			while (!ringbuffer_read(s[i].rb, &ts, &val)) {
				sp[c].cpuid = i;
				memcpy(&sp[c].ts, &ts, sizeof(sp[c].ts));
				memcpy(&sp[c].val, &val, sizeof(sp[c].val));
				if (c == SAMPLES_PER_PACKET - 1) {
					len = sendto(sk, (const void *)sp, sizeof(sp), 0,
						sa, salen);
					if (len < 0)
						perror("sendto");
					c = 0;
				} else
					c++;
			}
		}

		usleep(DEFAULT_INTERVAL);
	}

	close(sk);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x610, %rsp            # imm = 0x610
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x5e8(%rbp)
leaq -0x5b0(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2180
movl $0x0, -0x5ac(%rbp)
movl $0x2, -0x5a8(%rbp)
movl $0x11, -0x5a4(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x5b0(%rbp), %rdx
leaq -0x5b8(%rbp), %rcx
callq 0x23e0
movl %eax, -0x5d0(%rbp)
cmpl $0x0, -0x5d0(%rbp)
jge 0x4766
jmp 0x4742
movl -0x5d0(%rbp), %edi
leaq 0x2671(%rip), %rsi      # 0x6dc0
leaq 0x1c8a(%rip), %rdx      # 0x63e0
leaq 0x267a(%rip), %rcx      # 0x6dd7
movb $0x0, %al
callq 0x4d50
jmp 0x4766
movq -0x5b8(%rbp), %rax
movq %rax, -0x5c0(%rbp)
movq -0x5b8(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x5b8(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x5b8(%rbp), %rax
movl 0xc(%rax), %edx
callq 0x2470
movl %eax, -0x5d4(%rbp)
cmpl $0x0, -0x5d4(%rbp)
jl 0x47a8
jmp 0x47c4
movq -0x5b8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x5b8(%rbp)
cmpq $0x0, -0x5b8(%rbp)
jne 0x4774
cmpl $0x0, -0x5d4(%rbp)
jge 0x47f2
jmp 0x47cf
movl $0x2, %edi
leaq 0x260a(%rip), %rsi      # 0x6de5
leaq 0x1bfe(%rip), %rdx      # 0x63e0
leaq 0x25ee(%rip), %rcx      # 0x6dd7
movb $0x0, %al
callq 0x4d50
jmp 0x47f2
movq -0x5b8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edi
callq 0x2290
movq %rax, -0x5c8(%rbp)
movq -0x5c8(%rbp), %rdi
movq -0x5b8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x5b8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
callq 0x2280
movq -0x5b8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x5cc(%rbp)
movq -0x5c0(%rbp), %rdi
callq 0x2460
movl -0x5d4(%rbp), %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
movl $0x1, %ecx
movb $0x0, %al
callq 0x20c0
movl %eax, -0x5d0(%rbp)
cmpl $0x0, -0x5d0(%rbp)
jge 0x489b
jmp 0x4876
callq 0x2060
movl (%rax), %edi
leaq 0x2574(%rip), %rsi      # 0x6df8
leaq 0x1b55(%rip), %rdx      # 0x63e0
leaq 0x2545(%rip), %rcx      # 0x6dd7
movb $0x0, %al
callq 0x4d50
jmp 0x489b
movl $0x0, -0x5e0(%rbp)
movl 0x2719(%rip), %eax      # 0x6fc4
movl %eax, -0x604(%rbp)
movl 0x4bed(%rip), %eax      # 0x94a4
movl %eax, -0x604(%rbp)
movl -0x604(%rbp), %eax
movl %eax, -0x608(%rbp)
cmpl $0x0, -0x608(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x48de
jmp 0x4a41
movl $0x0, -0x5dc(%rbp)
movl -0x5dc(%rbp), %eax
cmpl 0x4bac(%rip), %eax      # 0x94a0
jae 0x4a32
jmp 0x48fc
movq -0x5e8(%rbp), %rax
movl -0x5dc(%rbp), %ecx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq 0x48(%rax), %rdi
leaq -0x5f8(%rbp), %rsi
leaq -0x600(%rbp), %rdx
callq 0x4c50
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x4938
jmp 0x4a1c
movl -0x5dc(%rbp), %ecx
movl -0x5e0(%rbp), %eax
movl %eax, %edx
leaq -0x580(%rbp), %rax
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x5e0(%rbp), %eax
movl %eax, %ecx
leaq -0x580(%rbp), %rax
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq -0x5f8(%rbp), %rcx
movq %rcx, 0x4(%rax)
movq -0x5f0(%rbp), %rcx
movq %rcx, 0xc(%rax)
movl -0x5e0(%rbp), %eax
movl %eax, %ecx
leaq -0x580(%rbp), %rax
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq -0x600(%rbp), %rcx
movq %rcx, 0x14(%rax)
cmpl $0x31, -0x5e0(%rbp)
jne 0x4a08
movl -0x5d4(%rbp), %edi
leaq -0x580(%rbp), %rsi
movq -0x5c8(%rbp), %rax
movq %rax, -0x610(%rbp)
movl -0x5cc(%rbp), %r9d
movq -0x610(%rbp), %r8
movl $0x578, %edx            # imm = 0x578
xorl %ecx, %ecx
callq 0x21a0
movl %eax, -0x5d8(%rbp)
cmpl $0x0, -0x5d8(%rbp)
jge 0x49fc
leaq 0x2410(%rip), %rdi      # 0x6e07
callq 0x2330
movl $0x0, -0x5e0(%rbp)
jmp 0x4a17
movl -0x5e0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5e0(%rbp)
jmp 0x48fc
jmp 0x4a1e
movl -0x5dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5dc(%rbp)
jmp 0x48e8
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x2450
jmp 0x48a5
movl -0x5d4(%rbp), %edi
callq 0x21c0
addq $0x610, %rsp            # imm = 0x610
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop