// File: /workspace/github_c_makefile_star2_O0/jech[P]shncpd/local.c
// Function: run_local_script
int
run_local_script(int up)
{
    pid_t pid;
    if(local_script == NULL || local_script[0] == '\0')
        return 0;

    debugf("Calling local configuration script (%d).\n", up);

    pid = fork();
    if(pid < 0)
        return pid;

    if(pid == 0) {
        char buf[20];
        snprintf(buf, 20, "%d", debug_level);
        setenv("HNCP_DEBUG_LEVEL", buf, 1);
        if(up) {
            struct prefix_list *pl;
            pl = all_dhcp_data(0, 1, 0);
            set_config_var("HNCP_IPv4_NAMESERVERS", pl, 1);
            destroy_prefix_list(pl);
            pl = all_dhcp_data(0, 0, 1);
            set_config_var("HNCP_IPv6_NAMESERVERS", pl, 0);
            destroy_prefix_list(pl);
            pl = all_dhcp_data(1, 1, 0);
            set_config_var("HNCP_IPv4_NTP_SERVERS", pl, 1);
            destroy_prefix_list(pl);
            pl = all_dhcp_data(1, 0, 1);
            set_config_var("HNCP_IPv6_NTP_SERVERS", pl, 0);
            destroy_prefix_list(pl);
        }
        execl(local_script, local_script, up ? "up" : "down" , NULL);
        perror("exec(local_script)");
        exit(42);
    } else {
        int status;
    again:
        pid = waitpid(pid, &status, 0);
        if(pid < 0) {
            if(errno == EINTR)
                goto again;
            perror("wait");
            return -1;
        } else if(!WIFEXITED(status)) {
            fprintf(stderr, "Configuration script died violently (%d)\n",
                    status);
            return 0;
        } else if(WEXITSTATUS(status) != 0) {
            fprintf(stderr, "Configuration script erred out %d\n",
                    WEXITSTATUS(status));
            return 0;
        }
        return 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
cmpq $0x0, 0xb835(%rip)      # 0x1a4a8
je 0xec84
movq 0xb82c(%rip), %rax      # 0x1a4a8
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xec90
movl $0x0, -0x4(%rbp)
jmp 0xeeca
jmp 0xec92
leaq 0x75cf(%rip), %rax      # 0x16268
cmpl $0x2, (%rax)
jl 0xecb4
movl -0x8(%rbp), %edx
movl $0x2, %edi
leaq 0x4673(%rip), %rsi      # 0x13320
movb $0x0, %al
callq 0xfda0
jmp 0xecb6
callq 0x23a0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0xeccf
movl -0xc(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xeeca
cmpl $0x0, -0xc(%rbp)
jne 0xee19
leaq -0x20(%rbp), %rdi
leaq 0x7584(%rip), %rax      # 0x16268
movl (%rax), %ecx
movl $0x14, %esi
leaq 0x3da3(%rip), %rdx      # 0x12a95
movb $0x0, %al
callq 0x2140
leaq -0x20(%rbp), %rsi
leaq 0x4646(%rip), %rdi      # 0x1334a
movl $0x1, %edx
callq 0x20c0
cmpl $0x0, -0x8(%rbp)
je 0xedd2
xorl %edx, %edx
movl $0x1, %esi
movl %edx, %edi
callq 0x54d0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
leaq 0x4626(%rip), %rdi      # 0x1335b
movl $0x1, %edx
callq 0xeee0
movq -0x28(%rbp), %rdi
callq 0xc2d0
xorl %esi, %esi
movl $0x1, %edx
movl %esi, %edi
callq 0x54d0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
leaq 0x460c(%rip), %rdi      # 0x13371
xorl %edx, %edx
callq 0xeee0
movq -0x28(%rbp), %rdi
callq 0xc2d0
movl $0x1, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x54d0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
leaq 0x45f5(%rip), %rdi      # 0x13387
movl $0x1, %edx
callq 0xeee0
movq -0x28(%rbp), %rdi
callq 0xc2d0
movl $0x1, %edx
xorl %esi, %esi
movl %edx, %edi
callq 0x54d0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
leaq 0x45db(%rip), %rdi      # 0x1339d
xorl %edx, %edx
callq 0xeee0
movq -0x28(%rbp), %rdi
callq 0xc2d0
movq 0xb6cf(%rip), %rdi      # 0x1a4a8
movq 0xb6c8(%rip), %rsi      # 0x1a4a8
movl -0x8(%rbp), %ecx
leaq 0x45cc(%rip), %rdx      # 0x133b6
leaq 0x45c2(%rip), %rax      # 0x133b3
cmpl $0x0, %ecx
cmovneq %rax, %rdx
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x2380
leaq 0x45b1(%rip), %rdi      # 0x133bb
callq 0x2300
movl $0x2a, %edi
callq 0x2340
jmp 0xee1b
movl -0xc(%rbp), %edi
leaq -0x2c(%rbp), %rsi
xorl %edx, %edx
callq 0x22e0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0xee53
callq 0x2050
cmpl $0x4, (%rax)
jne 0xee3e
jmp 0xee1b
leaq 0x4589(%rip), %rdi      # 0x133ce
callq 0x2300
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xeeca
movl -0x2c(%rbp), %eax
andl $0x7f, %eax
cmpl $0x0, %eax
je 0xee82
movq 0x7193(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
movl -0x2c(%rbp), %edx
leaq 0x4561(%rip), %rsi      # 0x133d3
movb $0x0, %al
callq 0x21f0
movl $0x0, -0x4(%rbp)
jmp 0xeeca
movl -0x2c(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
cmpl $0x0, %eax
je 0xeebf
movq 0x715f(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
movl -0x2c(%rbp), %edx
andl $0xff00, %edx           # imm = 0xFF00
sarl $0x8, %edx
leaq 0x454e(%rip), %rsi      # 0x133fd
movb $0x0, %al
callq 0x21f0
movl $0x0, -0x4(%rbp)
jmp 0xeeca
jmp 0xeec1
jmp 0xeec3
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)