// File: /workspace/github_c_makefile_star2_O0/containers[P]conmon/src/conn_sock.c
// Function: read_remote_sock
static gboolean read_remote_sock(struct remote_sock_s *sock)
{
	ssize_t num_read;

	/* There is still data in the buffer.  */
	if (sock->remaining) {
		sock->data_ready = true;
		return G_SOURCE_REMOVE;
	}

	if (SOCK_IS_STREAM(sock->sock_type)) {
		num_read = read(sock->fd, sock->buf, CONN_SOCK_BUF_SIZE);
	} else {
		num_read = recvfrom(sock->fd, sock->buf, CONN_SOCK_BUF_SIZE, 0, NULL, NULL);
	}

	if (num_read < 0)
		return G_SOURCE_CONTINUE;

	if (num_read == 0)
		return terminate_remote_sock(sock);

	/* num_read > 0 */
	sock->remaining = num_read;
	sock->off = 0;

	if (SOCK_IS_NOTIFY(sock->sock_type)) {
		/* We pass a limited amount of safe messages here, as some existing or
		   future ones could be security sensitive */
		const char *passon_line[] = {
			"READY=1", "RELOADING=1", "STOPPING=1", "WATCHDOG=1", "WATCHDOG=trigger",
		};
		const char *passon_prefix[] = {
			"STATUS=",
			"ERRNO=",
			"BUSERROR=",
			"MONOTONIC_USEC=",
		};
		char **lines;

		sock->buf[num_read] = '\0';
		lines = g_strsplit_set(sock->buf, "\n\r", -1);
		sock->remaining = 0;

		for (size_t i = 0; lines[i] != NULL; i++) {
			const char *line = lines[i];
			gboolean pass_line = FALSE;

			for (size_t j = 0; j < G_N_ELEMENTS(passon_line); j++) {
				if (strcmp(line, passon_line[j]) == 0) {
					pass_line = TRUE;
					break;
				}
			}

			for (size_t j = 0; !pass_line && j < G_N_ELEMENTS(passon_prefix); j++) {
				if (g_str_has_prefix(line, passon_prefix[j])) {
					pass_line = TRUE;
					break;
				}
			}

			/* This will always fit in sock->buf as we only pass through exact
			   bytes from an existing sock->buf */
			if (pass_line) {
				if (sock->remaining > 0)
					sock->buf[sock->remaining++] = '\n';

				memcpy(sock->buf + sock->remaining, line, strlen(line));
				sock->remaining += strlen(line);
			}
		}
		g_strfreev(lines);
	}

	if (sock->remaining)
		sock_try_write_to_local_sock(sock);

	/* Not everything was written, let's wait for the fd to be ready.  */
	if (sock->remaining)
		schedule_local_sock_write(sock->dest);
	return G_SOURCE_CONTINUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xbab1
movq -0x10(%rbp), %rax
movl $0x1, 0x14(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xbdb9
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0xbad9
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x30, %rsi
movl $0x8000, %edx           # imm = 0x8000
callq 0x4230
movq %rax, -0x18(%rbp)
jmp 0xbb09
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x30, %rsi
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %r8
movl $0x8000, %edx           # imm = 0x8000
xorl %ecx, %ecx
xorl %eax, %eax
movl %eax, %r9d
callq 0x46e0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jge 0xbb1c
movl $0x1, -0x4(%rbp)
jmp 0xbdb9
cmpq $0x0, -0x18(%rbp)
jne 0xbb34
movq -0x10(%rbp), %rdi
callq 0xbdd0
movl %eax, -0x4(%rbp)
jmp 0xbdb9
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0xbd86
leaq -0x50(%rbp), %rdi
leaq 0xa20c(%rip), %rsi      # 0x15d70
movl $0x28, %edx
callq 0x48b0
movq 0xa22b(%rip), %rax      # 0x15da0
movq %rax, -0x70(%rbp)
movq 0xa228(%rip), %rax      # 0x15da8
movq %rax, -0x68(%rbp)
movq 0xa225(%rip), %rax      # 0x15db0
movq %rax, -0x60(%rbp)
movq 0xa222(%rip), %rax      # 0x15db8
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movb $0x0, 0x30(%rax,%rcx)
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
leaq 0x613a(%rip), %rsi      # 0x11cf0
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4110
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x20(%rax)
movq $0x0, -0x80(%rbp)
movq -0x78(%rbp), %rax
movq -0x80(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0xbd7d
movq -0x78(%rbp), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x88(%rbp)
movl $0x0, -0x8c(%rbp)
movq $0x0, -0x98(%rbp)
cmpq $0x5, -0x98(%rbp)
jae 0xbc5c
movq -0x88(%rbp), %rdi
movq -0x98(%rbp), %rax
movq -0x50(%rbp,%rax,8), %rsi
callq 0x4620
cmpl $0x0, %eax
jne 0xbc46
movl $0x1, -0x8c(%rbp)
jmp 0xbc5c
jmp 0xbc48
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0xbc13
movq $0x0, -0xa0(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x8c(%rbp)
movb %al, -0xa1(%rbp)
jne 0xbc89
cmpq $0x4, -0xa0(%rbp)
setb %al
movb %al, -0xa1(%rbp)
movb -0xa1(%rbp), %al
testb $0x1, %al
jne 0xbc95
jmp 0xbcd4
movq -0x88(%rbp), %rdi
movq -0xa0(%rbp), %rax
movq -0x70(%rbp,%rax,8), %rsi
callq 0x45b0
cmpl $0x0, %eax
je 0xbcbe
movl $0x1, -0x8c(%rbp)
jmp 0xbcd4
jmp 0xbcc0
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0xbc67
cmpl $0x0, -0x8c(%rbp)
je 0xbd6a
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jbe 0xbd08
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rdx
movq 0x20(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x20(%rdx)
movb $0xa, 0x30(%rax,%rcx)
movq -0x10(%rbp), %rax
addq $0x30, %rax
movq -0x10(%rbp), %rcx
addq 0x20(%rcx), %rax
movq %rax, -0xb8(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x88(%rbp), %rdi
callq 0x4360
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movq %rax, %rdx
callq 0x48b0
movq -0x88(%rbp), %rdi
callq 0x4360
movq %rax, %rcx
movq -0x10(%rbp), %rax
addq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
jmp 0xbd6c
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0xbbd8
movq -0x78(%rbp), %rdi
callq 0x47b0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xbd9a
movq -0x10(%rbp), %rdi
callq 0xbec0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xbdb2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xb320
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)