// File: /workspace/github_c_makefile_star2_O0/unixlab[P]cloudflare-udp-ping/udpserver.c
// Function: thread_loop
static void thread_loop(void *userdata)
{
	struct state *state = userdata;

	while (1) {
		int flags = state->polling ? MSG_DONTWAIT : 0;
		int r = recvmsg(state->fd, &state->msg, flags);
		if (r <= 0 && (errno == EAGAIN || errno == EWOULDBLOCK ||
			       errno == EINTR)) {
			continue;
		}
		if (r == 0 && state->polling) {
			continue;
		}

		if (r <= 0) {
			PFATAL("recvmmsg()");
		}

		struct msghdr *msg = &state->msg;
		msg->msg_iov->iov_len = r;

		int s = sendmsg(state->fd, &state->msg, 0);
		if (s != r) {
			PFATAL("sendmmsg()");
		}
		msg->msg_iov->iov_len = MTU_SIZE;
		msg->msg_controllen = sizeof(state->pktinfo);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
xorl %eax, %eax
movl $0x40, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x28, %rsi
movl -0x14(%rbp), %edx
callq 0x45f670
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jg 0x401b9a
callq 0x405f50
cmpl $0xb, (%rax)
je 0x401b98
callq 0x405f50
cmpl $0xb, (%rax)
je 0x401b98
callq 0x405f50
cmpl $0x4, (%rax)
jne 0x401b9a
jmp 0x401b44
cmpl $0x0, -0x18(%rbp)
jne 0x401bac
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x401bac
jmp 0x401b44
cmpl $0x0, -0x18(%rbp)
jg 0x401c26
jmp 0x401bb4
movq $0x4e77c8, %rax         # imm = 0x4E77C8
movq (%rax), %rdi
leaq 0xb25eb(%rip), %rsi     # 0x4b41b0
movb $0x0, %al
callq 0x40d850
movq $0x4e77c8, %rax         # imm = 0x4E77C8
movq (%rax), %rdi
leaq 0xb25f1(%rip), %rsi     # 0x4b41ce
leaq 0xb2604(%rip), %rdx     # 0x4b41e8
leaq 0xb24e2(%rip), %rcx     # 0x4b40cd
movl $0x41, %r8d
movb $0x0, %al
callq 0x40d850
leaq 0xb25f5(%rip), %rdi     # 0x4b41f4
callq 0x40db30
movq $0x4e77c8, %rax         # imm = 0x4E77C8
movq (%rax), %rdi
leaq 0xb2e75(%rip), %rsi     # 0x4b4a8a
movb $0x0, %al
callq 0x40d850
movl $0x1, %edi
callq 0x40c7b0
movq -0x10(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x20(%rbp)
movslq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x28, %rsi
xorl %edx, %edx
callq 0x45f720
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x18(%rbp), %eax
je 0x401cd6
jmp 0x401c64
movq $0x4e77c8, %rax         # imm = 0x4E77C8
movq (%rax), %rdi
leaq 0xb2591(%rip), %rsi     # 0x4b4206
movb $0x0, %al
callq 0x40d850
movq $0x4e77c8, %rax         # imm = 0x4E77C8
movq (%rax), %rdi
leaq 0xb2541(%rip), %rsi     # 0x4b41ce
leaq 0xb2554(%rip), %rdx     # 0x4b41e8
leaq 0xb2432(%rip), %rcx     # 0x4b40cd
movl $0x49, %r8d
movb $0x0, %al
callq 0x40d850
leaq 0xb2545(%rip), %rdi     # 0x4b41f4
callq 0x40db30
movq $0x4e77c8, %rax         # imm = 0x4E77C8
movq (%rax), %rdi
leaq 0xb2dc5(%rip), %rsi     # 0x4b4a8a
movb $0x0, %al
callq 0x40d850
movl $0x1, %edi
callq 0x40c7b0
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq $0x780, 0x8(%rax)       # imm = 0x780
movq -0x20(%rbp), %rax
movq $0x1000, 0x28(%rax)     # imm = 0x1000
jmp 0x401b44
nopw (%rax,%rax)