// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/posix/init.c
// Function: create_routing_pipe
static void create_routing_pipe(void)
{
	int fd[2], pipe_opts;

	if (pipe(fd) < 0) {
		printf("Could not create a pipe to '%s': %s\n", policy_routing_script, strerror(errno));
		exit(EXIT_FAILURE);
	}

	if ((policy_routing_script_pid = fork()) < 0) {

		printf("Could not fork to execute '%s': %s\n", policy_routing_script, strerror(errno));
		exit(EXIT_FAILURE);

	/* parent */
	} else if (policy_routing_script_pid > 0) {

		close(fd[0]);
		policy_routing_pipe = fd[1];

		/* make pipe non blocking */
		pipe_opts = fcntl(policy_routing_pipe, F_GETFL, 0);
		fcntl(policy_routing_pipe, F_SETFL, pipe_opts | O_NONBLOCK);

	/* child */
	} else {

		close(fd[1]);

		if (fd[0] != STDIN_FILENO) {

			if (dup2(fd[0], STDIN_FILENO) != STDIN_FILENO) {
				printf("Could not dup2 to redirect stdin to '%s'\n", policy_routing_script);
				exit(EXIT_FAILURE);
			}

			close(fd[0]);

		}

		signal(SIGINT, SIG_IGN);
		signal(SIGTERM, SIG_IGN);
		signal(SIGPIPE, SIG_IGN);

		if (execl("/bin/sh", "/bin/sh", "-c", policy_routing_script, NULL) < 0)
			printf("Could not execute '%s': %s\n", policy_routing_script, strerror(errno));

	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq -0x8(%rbp), %rdi
callq 0x2230
cmpl $0x0, %eax
jge 0xe4ef
leaq 0xcebb(%rip), %rax      # 0x1b378
movq (%rax), %rax
movq %rax, -0x18(%rbp)
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq -0x18(%rbp), %rsi
movq %rax, %rdx
leaq 0x8bd7(%rip), %rdi      # 0x170b5
movb $0x0, %al
callq 0x21a0
movl $0x1, %edi
callq 0x2470
callq 0x24d0
leaq 0xcf25(%rip), %rcx      # 0x1b420
movl %eax, (%rcx)
cmpl $0x0, %eax
jge 0xe53b
leaq 0xce6f(%rip), %rax      # 0x1b378
movq (%rax), %rax
movq %rax, -0x20(%rbp)
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq -0x20(%rbp), %rsi
movq %rax, %rdx
leaq 0x8bb0(%rip), %rdi      # 0x170da
movb $0x0, %al
callq 0x21a0
movl $0x1, %edi
callq 0x2470
leaq 0xcede(%rip), %rax      # 0x1b420
cmpl $0x0, (%rax)
jle 0xe598
movl -0x8(%rbp), %edi
callq 0x2210
movl -0x4(%rbp), %ecx
leaq 0xce27(%rip), %rax      # 0x1b380
movl %ecx, (%rax)
leaq 0xce1e(%rip), %rax      # 0x1b380
movl (%rax), %edi
movl $0x3, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x20e0
movl %eax, -0xc(%rbp)
leaq 0xce04(%rip), %rax      # 0x1b380
movl (%rax), %edi
movl -0xc(%rbp), %edx
orl $0x800, %edx            # imm = 0x800
movl $0x4, %esi
movb $0x0, %al
callq 0x20e0
jmp 0xe669
movl -0x4(%rbp), %edi
callq 0x2210
cmpl $0x0, -0x8(%rbp)
je 0xe5df
movl -0x8(%rbp), %edi
xorl %esi, %esi
callq 0x2180
cmpl $0x0, %eax
je 0xe5d7
leaq 0xcdbc(%rip), %rax      # 0x1b378
movq (%rax), %rsi
leaq 0x8b38(%rip), %rdi      # 0x170fe
movb $0x0, %al
callq 0x21a0
movl $0x1, %edi
callq 0x2470
movl -0x8(%rbp), %edi
callq 0x2210
movl $0x2, %edi
movl $0x1, %esi
callq 0x2290
movl $0xf, %edi
movl $0x1, %esi
callq 0x2290
movl $0xd, %edi
movl $0x1, %esi
callq 0x2290
leaq 0xcd65(%rip), %rax      # 0x1b378
movq (%rax), %rcx
leaq 0x8b0b(%rip), %rsi      # 0x17128
leaq 0x8b0c(%rip), %rdx      # 0x17130
xorl %eax, %eax
movl %eax, %r8d
movq %rsi, %rdi
movb $0x0, %al
callq 0x24b0
cmpl $0x0, %eax
jge 0xe667
leaq 0xcd39(%rip), %rax      # 0x1b378
movq (%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq -0x28(%rbp), %rsi
movq %rax, %rdx
leaq 0x8ad3(%rip), %rdi      # 0x17133
movb $0x0, %al
callq 0x21a0
jmp 0xe669
jmp 0xe66b
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)