// File: /workspace/github_c_makefile_star2_O0/jech[P]shncpd/prefix.c
// Function: parse_prefix
int
parse_prefix(const char *string, struct prefix *p)
{
    char buf[INET6_ADDRSTRLEN];
    int rc, plen;
    char *slash;
    struct in_addr ina;
    struct in6_addr ina6;

    memset(p, 0, sizeof(struct prefix));

    if(strcmp(string, "default") == 0) {
        return 1;
    }

    strncpy(buf, string, INET6_ADDRSTRLEN);
    buf[INET6_ADDRSTRLEN - 1] = '\0';

    slash = strchr(buf, '/');
    if(slash == NULL) {
        plen = -1;
    } else {
        char *end;
        plen = strtol(slash + 1, &end, 0);
        if(*end != '\0' || plen < 0 || plen > 128)
            return -1;
        *slash = '\0';
    }

    rc = inet_pton(AF_INET, buf, &ina);
    if(rc > 0) {
        memcpy(&p->p, v4prefix, 12);
        memcpy((char*)&p->p + 12, &ina, 4);
        p->plen = plen < 0 ? 128 : plen + 96;
    } else {
        rc = inet_pton(AF_INET6, buf, &ina6);
        if(rc < 1)
            return -1;
        memcpy(&p->p, &ina6, 16);
        p->plen = plen < 0 ? 128 : plen;
    }
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x1c, %edx
callq 0x2170
movq -0x10(%rbp), %rdi
leaq 0x6f3b(%rip), %rsi      # 0x13069
callq 0x21e0
cmpl $0x0, %eax
jne 0xc144
movl $0x1, -0x4(%rbp)
jmp 0xc295
leaq -0x50(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x2e, %edx
callq 0x2070
movb $0x0, -0x23(%rbp)
leaq -0x50(%rbp), %rdi
movl $0x2f, %esi
callq 0x2120
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0xc17c
movl $0xffffffff, -0x58(%rbp) # imm = 0xFFFFFFFF
jmp 0xc1c0
movq -0x60(%rbp), %rdi
addq $0x1, %rdi
leaq -0x80(%rbp), %rsi
xorl %edx, %edx
callq 0x2220
movl %eax, -0x58(%rbp)
movq -0x80(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xc1ad
cmpl $0x0, -0x58(%rbp)
jl 0xc1ad
cmpl $0x80, -0x58(%rbp)
jle 0xc1b9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc295
movq -0x60(%rbp), %rax
movb $0x0, (%rax)
leaq -0x50(%rbp), %rsi
movl $0x2, %edi
leaq -0x64(%rbp), %rdx
callq 0x2240
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
jle 0xc22c
movq -0x18(%rbp), %rax
movq 0x712a(%rip), %rcx      # 0x13310
movq %rcx, (%rax)
movl 0x7129(%rip), %ecx      # 0x13318
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl -0x64(%rbp), %ecx
movl %ecx, 0xc(%rax)
cmpl $0x0, -0x58(%rbp)
jge 0xc20f
movl $0x80, %eax
movl %eax, -0x84(%rbp)
jmp 0xc21b
movl -0x58(%rbp), %eax
addl $0x60, %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x10(%rax)
jmp 0xc28e
leaq -0x50(%rbp), %rsi
movl $0xa, %edi
leaq -0x74(%rbp), %rdx
callq 0x2240
movl %eax, -0x54(%rbp)
cmpl $0x1, -0x54(%rbp)
jge 0xc250
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc295
movq -0x18(%rbp), %rax
movq -0x74(%rbp), %rcx
movq %rcx, (%rax)
movq -0x6c(%rbp), %rcx
movq %rcx, 0x8(%rax)
cmpl $0x0, -0x58(%rbp)
jge 0xc276
movl $0x80, %eax
movl %eax, -0x88(%rbp)
jmp 0xc27f
movl -0x58(%rbp), %eax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x10(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)