// File: /workspace/github_c_makefile_star2_O0/jech[P]shncpd/dhcpv4.c
// Function: dhcpv4_receive
int
dhcpv4_receive()
{
    int i, rc, buflen;
    const char broadcast_addr[4] = {255, 255, 255, 255};
    struct sockaddr_in from, to;
    int dontroute = 1;
    int bufsiz = 1500;
    unsigned char buf[bufsiz];
    unsigned char myaddr[4];
    struct dhcpv4_request req;
    struct interface *interface;
    struct prefix_list *pl = NULL, *dns = NULL;
    int ifindex = -1;
    unsigned char netmask[4];
    struct iovec iov[1];
    struct msghdr msg;
    int cmsglen = 100;
    char cmsgbuf[cmsglen];
    struct cmsghdr *cmsg = (struct cmsghdr*)cmsgbuf;

    iov[0].iov_base = buf;
    iov[0].iov_len = bufsiz;
    memset(&msg, 0, sizeof(msg));
    msg.msg_name = &from;
    msg.msg_namelen = sizeof(from);
    msg.msg_iov = iov;
    msg.msg_iovlen = 1;
    msg.msg_control = cmsg;
    msg.msg_controllen = cmsglen;

    rc = recvmsg(dhcpv4_socket, &msg, 0);

    if(rc < 0)
        return -1;

    if(from.sin_family != AF_INET || msg.msg_namelen < sizeof(from))
        return -1;

    buflen = rc;

    cmsg = CMSG_FIRSTHDR(&msg);
    while(cmsg != NULL) {
        if ((cmsg->cmsg_level == IPPROTO_IP) &&
            (cmsg->cmsg_type == IP_PKTINFO)) {
            struct in_pktinfo *info = (struct in_pktinfo*)CMSG_DATA(cmsg);
            ifindex = info->ipi_ifindex;
            break;
        }
        cmsg = CMSG_NXTHDR(&msg, cmsg);
    }

    interface = ifindex > 0 ? find_interface(ifindex) : NULL;

    if(interface == NULL)
        return -1;

    rc = interface_v4(interface, myaddr);
    if(rc <= 0) {
        return -1;
    }

    for(i = 0; i < interface->numassigned; i++) {
        struct assigned_prefix *ap = &interface->assigned[i];
        struct prefix_list *ppl;

        if(!ap->applied || !prefix_v4(&ap->assigned))
            continue;

        ppl = prefix_list_cons_prefix(pl, &ap->assigned);
        if(ppl != NULL)
            pl = ppl;
    }

    memset(&req, 0, sizeof(req));
    rc = dhcpv4_parse(buf, buflen, &req);
    if(rc < 0)
        return -1;

    debugf("   DHCPv4 (type %d) on %s", req.type, interface->ifname);

    if(user_class_match(req.uc, req.uclen, "HOMENET") ||
       (memcmp(req.sid, zeroes, 4) != 0 && memcmp(req.sid, myaddr, 4) != 0)) {
        debugf(" (ignored)\n");
        goto done;
    }

    debugf("\n");

    memset(&to, 0, sizeof(to));
    to.sin_family = AF_INET;
    if(memcmp(req.giaddr, zeroes, 4) != 0) {
        memcpy(&to.sin_addr, req.giaddr, 4);
        dontroute = 0;
    } else if(!req.broadcast && memcmp(req.ciaddr, zeroes, 4) != 0) {
        memcpy(&to.sin_addr, req.ciaddr, 4);
    } else {
        memcpy(&to.sin_addr, broadcast_addr, 4);
    }
    to.sin_port = htons(68);

    if(!interface_dhcpv4(interface))
        goto nak;

    dns = all_dhcp_data(0, 1, 0);

    switch(req.type) {
    case 1:                     /* DHCPDISCOVER */
    case 3: {                   /* DHCPREQUEST */
        struct lease *lease = NULL;
        unsigned char cip[4];
        int have_cip;
        time_t lease_end;

        if(req.type == 1)
            memcpy(cip, req.ip, 4);
        else if(memcmp(req.ciaddr, zeroes, 4) != 0)
            memcpy(cip, req.ciaddr, 4);
        else
            memcpy(cip, req.ip, 4);

        have_cip = memcmp(cip, zeroes, 4) != 0;

        if(req.type == 3 && !have_cip)
            goto nak;

        if(req.type == 1) {
            lease = find_matching_lease(req.cid, req.cidlen, req.chaddr, pl);
            if(lease && !prefix_list_within_v4(lease->ip, pl))
                lease = NULL;
        }

        if(lease == NULL && have_cip) {
            if(prefix_list_within_v4(cip, pl)) {
                lease = find_lease(cip, req.type == 1);
                if(lease && !lease_expired(lease) &&
                   !lease_match(req.cid, req.cidlen, req.chaddr, lease)) {
                    lease = NULL;
                }
            } else {
                lease = NULL;
            }
        }

        if(lease == NULL) {
            if(req.type == 3)
                goto nak;
            rc = generate_v4(cip, netmask, pl);
            if(rc < 0)
                goto nak;
            lease = find_lease(cip, 1);
        } else {
            rc = compute_netmask(netmask, lease->ip, pl);
            if(rc < 0)
                goto nak;
        }

        if(lease == NULL)
            goto nak;

        memcpy(lease->chaddr, req.chaddr, 16);
        lease->ifindex = ifindex;
        lease_end = req.type == 1 ? now.tv_sec : now.tv_sec + LEASE_TIME + 10;
        if(lease->end < lease_end) {
            lease->end = lease_end;
        }
        free(lease->cid);
        lease->cidlen = req.cidlen;
        lease->cid = req.cid;
        req.cid = NULL;

        rc = dhcpv4_send(dhcpv4_socket, &to, dontroute,
                         req.type == 1 ? 2 : 5, req.xid, req.chaddr, myaddr,
                         lease->ip, ifindex, netmask, dns, LEASE_TIME);
        if(rc < 0)
            perror("dhcpv4_send");
        break;
    }
    case 4: {                   /* DHCPDECLINE */
        struct lease *lease = find_lease(req.ip, 0);
        fprintf(stderr, "Received DHCPDECLINE");
        if(lease && lease->end >= now.tv_sec) {
            fprintf(stderr, " (already assigned).\n");
        } else if(lease && lease->end >= now.tv_sec - LEASE_TIME) {
            fprintf(stderr, " (marking as used).\n");
            free(lease->cid);
            lease->cid = NULL;
            lease->cidlen = 0;
            req.cid = NULL;
            memset(lease->chaddr, 0, 16);
            lease->end = now.tv_sec + LEASE_TIME;
        } else {
            fprintf(stderr, " (ignored).\n");
        }
        break;
    }
    case 7: {                   /* DHCPRELEASE */
        struct lease *lease =
            find_matching_lease(req.cid, req.cidlen, req.chaddr, NULL);
        if(lease)
            lease->end = now.tv_sec;
        break;
    }
    case 8: {                   /* DHCPINFORM */
        rc = dhcpv4_send(dhcpv4_socket, &to, dontroute,
                         5, req.xid, req.chaddr, myaddr,
                         NULL, ifindex, NULL, dns, 0);
        if(rc < 0)
            perror("dhcpv4_send");
        break;
    }
    }

    goto done;

 nak:
    /* NAK is always sent to broadcast address, except in relay case. */
    if(memcmp(req.giaddr, zeroes, 4) == 0)
        memcpy(&to.sin_addr, broadcast_addr, 4);
    if(req.type == 3)
        dhcpv4_send(dhcpv4_socket, &to, dontroute, 6, req.xid, req.chaddr,
                    myaddr, req.ip, ifindex,
                    NULL, NULL, 0);
 done:
    free(req.cid);
    free(req.uc);
    destroy_prefix_list(dns);
    destroy_prefix_list(pl);
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x1a0, %rsp            # imm = 0x1A0
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x48(%rbp)
movl $0x5dc, -0x4c(%rbp)     # imm = 0x5DC
movl -0x4c(%rbp), %eax
movl %eax, %ecx
movq %rsp, %rax
movq %rax, -0x58(%rbp)
movq %rcx, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rax
subq %rdx, %rax
movq %rax, -0x190(%rbp)
movq %rax, %rsp
movq %rcx, -0x60(%rbp)
movq $0x0, -0xd0(%rbp)
movq $0x0, -0xd8(%rbp)
movl $0xffffffff, -0xdc(%rbp) # imm = 0xFFFFFFFF
movl $0x64, -0x12c(%rbp)
movl -0x12c(%rbp), %ecx
movl %ecx, %edx
movq %rdx, %rsi
addq $0xf, %rsi
andq $-0x10, %rsi
movq %rsp, %rcx
subq %rsi, %rcx
movq %rcx, %rsp
movq %rdx, -0x138(%rbp)
movq %rcx, -0x140(%rbp)
movq %rax, -0xf0(%rbp)
movslq -0x4c(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0x128(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x2170
leaq -0x34(%rbp), %rax
movq %rax, -0x128(%rbp)
movl $0x10, -0x120(%rbp)
leaq -0xf0(%rbp), %rax
movq %rax, -0x118(%rbp)
movq $0x1, -0x110(%rbp)
movq -0x140(%rbp), %rax
movq %rax, -0x108(%rbp)
movslq -0x12c(%rbp), %rax
movq %rax, -0x100(%rbp)
movl 0xc109(%rip), %edi      # 0x16200
leaq -0x128(%rbp), %rsi
xorl %edx, %edx
callq 0x22a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xa124
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x144(%rbp)
jmp 0xabb3
movzwl -0x34(%rbp), %eax
cmpl $0x2, %eax
jne 0xa139
movl -0x120(%rbp), %eax
cmpq $0x10, %rax
jae 0xa14f
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x144(%rbp)
jmp 0xabb3
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
cmpq $0x10, -0x100(%rbp)
jb 0xa16f
movq -0x108(%rbp), %rax
movq %rax, -0x198(%rbp)
jmp 0xa17a
xorl %eax, %eax
movq %rax, -0x198(%rbp)
jmp 0xa17a
movq -0x198(%rbp), %rax
movq %rax, -0x140(%rbp)
cmpq $0x0, -0x140(%rbp)
je 0xa1eb
movq -0x140(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0xa1cf
movq -0x140(%rbp), %rax
cmpl $0x8, 0xc(%rax)
jne 0xa1cf
movq -0x140(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xdc(%rbp)
jmp 0xa1eb
movq -0x140(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0x2360
movq %rax, -0x140(%rbp)
jmp 0xa188
cmpl $0x0, -0xdc(%rbp)
jle 0xa208
movl -0xdc(%rbp), %edi
callq 0x4470
movq %rax, -0x1a0(%rbp)
jmp 0xa213
xorl %eax, %eax
movq %rax, -0x1a0(%rbp)
jmp 0xa213
movq -0x1a0(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xc8(%rbp)
jne 0xa241
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x144(%rbp)
jmp 0xabb3
movq -0xc8(%rbp), %rdi
leaq -0x64(%rbp), %rsi
callq 0xd180
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jg 0xa270
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x144(%rbp)
jmp 0xabb3
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0xc8(%rbp), %rcx
cmpl 0x68(%rcx), %eax
jge 0xa311
movq -0xc8(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x18(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
je 0xa2c9
movq -0x158(%rbp), %rdi
addq $0x1c, %rdi
callq 0xcfe0
cmpl $0x0, %eax
jne 0xa2cb
jmp 0xa303
movq -0xd0(%rbp), %rdi
movq -0x158(%rbp), %rsi
addq $0x1c, %rsi
callq 0xc300
movq %rax, -0x160(%rbp)
cmpq $0x0, -0x160(%rbp)
je 0xa301
movq -0x160(%rbp), %rax
movq %rax, -0xd0(%rbp)
jmp 0xa303
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xa277
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x58, %edx
callq 0x2170
movq -0x190(%rbp), %rdi
movl -0x20(%rbp), %esi
leaq -0xc0(%rbp), %rdx
callq 0xabd0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xa359
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x144(%rbp)
jmp 0xabb3
jmp 0xa35b
leaq 0xbf06(%rip), %rax      # 0x16268
cmpl $0x2, (%rax)
jl 0xa38a
movl -0xc0(%rbp), %edx
movq -0xc8(%rbp), %rax
movq (%rax), %rcx
movl $0x2, %edi
leaq 0x8b9f(%rip), %rsi      # 0x12f22
movb $0x0, %al
callq 0xfda0
jmp 0xa38c
jmp 0xa38e
movq -0x78(%rbp), %rdi
movl -0x70(%rbp), %esi
leaq 0x8ba0(%rip), %rdx      # 0x12f3c
callq 0xb0f0
cmpl $0x0, %eax
jne 0xa3e0
leaq -0xc0(%rbp), %rax
addq $0x30, %rax
movl (%rax), %eax
testl %eax, %eax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0xa40a
leaq -0xc0(%rbp), %rax
addq $0x30, %rax
leaq -0x64(%rbp), %rcx
movl (%rcx), %ecx
movl (%rax), %eax
subl %ecx, %eax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0xa40a
jmp 0xa3e2
leaq 0xbe7f(%rip), %rax      # 0x16268
cmpl $0x2, (%rax)
jl 0xa401
movl $0x2, %edi
leaq 0x8b4a(%rip), %rsi      # 0x12f44
movb $0x0, %al
callq 0xfda0
jmp 0xa403
jmp 0xa405
jmp 0xab75
jmp 0xa40c
leaq 0xbe55(%rip), %rax      # 0x16268
cmpl $0x2, (%rax)
jl 0xa42b
movl $0x2, %edi
leaq 0x85c1(%rip), %rsi      # 0x129e5
movb $0x0, %al
callq 0xfda0
jmp 0xa42d
jmp 0xa42f
leaq -0x44(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2170
movw $0x2, -0x44(%rbp)
leaq -0xc0(%rbp), %rax
addq $0x18, %rax
movl (%rax), %eax
testl %eax, %eax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0xa471
movl -0xa8(%rbp), %eax
movl %eax, -0x40(%rbp)
movl $0x0, -0x48(%rbp)
jmp 0xa4a7
cmpl $0x0, -0xbc(%rbp)
jne 0xa49f
leaq -0xc0(%rbp), %rax
addq $0xc, %rax
movl (%rax), %eax
testl %eax, %eax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0xa49f
movl -0xb4(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0xa4a5
movl -0x24(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0xa4a7
movl $0x44, %edi
callq 0x2100
movw %ax, -0x42(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x9c90
cmpl $0x0, %eax
jne 0xa4cb
jmp 0xaad5
movl $0x1, %esi
xorl %edx, %edx
movl %edx, %edi
callq 0x54d0
movq %rax, -0xd8(%rbp)
movl -0xc0(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x1a8(%rbp)
subl $0x7, %eax
ja 0xaad0
movq -0x1a8(%rbp), %rax
leaq 0x8940(%rip), %rcx      # 0x12e48
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x0, -0x168(%rbp)
cmpl $0x1, -0xc0(%rbp)
jne 0xa533
movl -0x94(%rbp), %eax
movl %eax, -0x16c(%rbp)
jmp 0xa569
leaq -0xc0(%rbp), %rax
addq $0xc, %rax
movl (%rax), %eax
testl %eax, %eax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0xa55b
movl -0xb4(%rbp), %eax
movl %eax, -0x16c(%rbp)
jmp 0xa567
movl -0x94(%rbp), %eax
movl %eax, -0x16c(%rbp)
jmp 0xa569
leaq -0x16c(%rbp), %rax
movl (%rax), %eax
testl %eax, %eax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x170(%rbp)
cmpl $0x3, -0xc0(%rbp)
jne 0xa5a2
cmpl $0x0, -0x170(%rbp)
jne 0xa5a2
jmp 0xaad5
cmpl $0x1, -0xc0(%rbp)
jne 0xa602
movq -0x88(%rbp), %rdi
movl -0x80(%rbp), %esi
leaq -0xc0(%rbp), %rdx
addq $0x1c, %rdx
movq -0xd0(%rbp), %rcx
callq 0xb190
movq %rax, -0x168(%rbp)
cmpq $0x0, -0x168(%rbp)
je 0xa600
movq -0x168(%rbp), %rdi
movq -0xd0(%rbp), %rsi
callq 0xc980
cmpl $0x0, %eax
jne 0xa600
movq $0x0, -0x168(%rbp)
jmp 0xa602
cmpq $0x0, -0x168(%rbp)
jne 0xa6b2
cmpl $0x0, -0x170(%rbp)
je 0xa6b2
leaq -0x16c(%rbp), %rdi
movq -0xd0(%rbp), %rsi
callq 0xc980
cmpl $0x0, %eax
je 0xa6a5
leaq -0x16c(%rbp), %rdi
cmpl $0x1, -0xc0(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %esi
callq 0x9b00
movq %rax, -0x168(%rbp)
cmpq $0x0, -0x168(%rbp)
je 0xa6a3
movq -0x168(%rbp), %rdi
callq 0xb240
cmpl $0x0, %eax
jne 0xa6a3
movq -0x88(%rbp), %rdi
movl -0x80(%rbp), %esi
leaq -0xc0(%rbp), %rdx
addq $0x1c, %rdx
movq -0x168(%rbp), %rcx
callq 0xb270
cmpl $0x0, %eax
jne 0xa6a3
movq $0x0, -0x168(%rbp)
jmp 0xa6b0
movq $0x0, -0x168(%rbp)
jmp 0xa6b2
cmpq $0x0, -0x168(%rbp)
jne 0xa70c
cmpl $0x3, -0xc0(%rbp)
jne 0xa6ca
jmp 0xaad5
leaq -0x16c(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
movq -0xd0(%rbp), %rdx
callq 0xb310
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xa6f2
jmp 0xaad5
leaq -0x16c(%rbp), %rdi
movl $0x1, %esi
callq 0x9b00
movq %rax, -0x168(%rbp)
jmp 0xa736
leaq -0xe0(%rbp), %rdi
movq -0x168(%rbp), %rsi
movq -0xd0(%rbp), %rdx
callq 0xb440
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xa734
jmp 0xaad5
jmp 0xa736
cmpq $0x0, -0x168(%rbp)
jne 0xa745
jmp 0xaad5
movq -0x168(%rbp), %rax
movq -0xa4(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x9c(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0xdc(%rbp), %ecx
movq -0x168(%rbp), %rax
movl %ecx, 0x4(%rax)
cmpl $0x1, -0xc0(%rbp)
jne 0xa78e
leaq 0xbafe(%rip), %rax      # 0x16280
movq (%rax), %rax
movq %rax, -0x1b0(%rbp)
jmp 0xa7a9
leaq 0xbaeb(%rip), %rax      # 0x16280
movq (%rax), %rax
addq $0x708, %rax            # imm = 0x708
addq $0xa, %rax
movq %rax, -0x1b0(%rbp)
movq -0x1b0(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x168(%rbp), %rax
movq 0x28(%rax), %rax
cmpq -0x178(%rbp), %rax
jge 0xa7dd
movq -0x178(%rbp), %rcx
movq -0x168(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x168(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2040
movl -0x80(%rbp), %ecx
movq -0x168(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x88(%rbp), %rcx
movq -0x168(%rbp), %rax
movq %rcx, 0x18(%rax)
movq $0x0, -0x88(%rbp)
movl 0xb9e3(%rip), %edi      # 0x16200
movl -0x48(%rbp), %edx
movl -0xc0(%rbp), %esi
movl $0x5, %ecx
movl $0x2, %eax
cmpl $0x1, %esi
cmovel %eax, %ecx
leaq -0xc0(%rbp), %r8
addq $0x8, %r8
leaq -0xc0(%rbp), %r9
addq $0x1c, %r9
leaq -0x64(%rbp), %r14
movq -0x168(%rbp), %rbx
movl -0xdc(%rbp), %r11d
leaq -0xe0(%rbp), %r10
movq -0xd8(%rbp), %rax
leaq -0x44(%rbp), %rsi
subq $0x30, %rsp
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movl $0x708, 0x28(%rsp)      # imm = 0x708
callq 0xb550
addq $0x30, %rsp
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xa8b2
leaq 0x86a3(%rip), %rdi      # 0x12f50
callq 0x2300
jmp 0xaad0
leaq -0xc0(%rbp), %rdi
addq $0x2c, %rdi
xorl %esi, %esi
callq 0x9b00
movq %rax, -0x180(%rbp)
movq 0xb721(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x867b(%rip), %rsi      # 0x12f5c
movb $0x0, %al
callq 0x21f0
cmpq $0x0, -0x180(%rbp)
je 0xa926
movq -0x180(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0xb97c(%rip), %rcx      # 0x16280
cmpq (%rcx), %rax
jl 0xa926
movq 0xb6e8(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x8657(%rip), %rsi      # 0x12f71
movb $0x0, %al
callq 0x21f0
jmp 0xa9f8
cmpq $0x0, -0x180(%rbp)
je 0xa9de
movq -0x180(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0xb93a(%rip), %rcx      # 0x16280
movq (%rcx), %rcx
subq $0x708, %rcx            # imm = 0x708
cmpq %rcx, %rax
jl 0xa9de
movq 0xb698(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x861d(%rip), %rsi      # 0x12f87
movb $0x0, %al
callq 0x21f0
movq -0x180(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2040
movq -0x180(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x180(%rbp), %rax
movl $0x0, 0x20(%rax)
movq $0x0, -0x88(%rbp)
movq -0x180(%rbp), %rdi
addq $0x8, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2170
leaq 0xb8b9(%rip), %rax      # 0x16280
movq (%rax), %rcx
addq $0x708, %rcx            # imm = 0x708
movq -0x180(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0xa9f6
movq 0xb613(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x85ad(%rip), %rsi      # 0x12f9c
movb $0x0, %al
callq 0x21f0
jmp 0xa9f8
jmp 0xaad0
movq -0x88(%rbp), %rdi
movl -0x80(%rbp), %esi
leaq -0xc0(%rbp), %rdx
addq $0x1c, %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0xb190
movq %rax, -0x188(%rbp)
cmpq $0x0, -0x188(%rbp)
je 0xaa41
leaq 0xb84d(%rip), %rax      # 0x16280
movq (%rax), %rcx
movq -0x188(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0xaad0
movl 0xb7b4(%rip), %edi      # 0x16200
movl -0x48(%rbp), %edx
leaq -0xc0(%rbp), %r8
addq $0x8, %r8
leaq -0xc0(%rbp), %r9
addq $0x1c, %r9
leaq -0x64(%rbp), %r11
movl -0xdc(%rbp), %r10d
movq -0xd8(%rbp), %rax
leaq -0x44(%rbp), %rsi
movl $0x5, %ecx
xorl %ebx, %ebx
xorl %ebx, %ebx
subq $0x30, %rsp
movq %r11, (%rsp)
movq $0x0, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movl $0x0, 0x28(%rsp)
callq 0xb550
addq $0x30, %rsp
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xaace
leaq 0x8487(%rip), %rdi      # 0x12f50
callq 0x2300
jmp 0xaad0
jmp 0xab75
leaq -0xc0(%rbp), %rax
addq $0x18, %rax
movl (%rax), %eax
testl %eax, %eax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xaaf5
movl -0x24(%rbp), %eax
movl %eax, -0x40(%rbp)
cmpl $0x3, -0xc0(%rbp)
jne 0xab73
movl 0xb6fc(%rip), %edi      # 0x16200
movl -0x48(%rbp), %edx
leaq -0xc0(%rbp), %r8
addq $0x8, %r8
leaq -0xc0(%rbp), %r9
addq $0x1c, %r9
leaq -0x64(%rbp), %r11
leaq -0xc0(%rbp), %r10
addq $0x2c, %r10
movl -0xdc(%rbp), %eax
leaq -0x44(%rbp), %rsi
movl $0x6, %ecx
xorl %ebx, %ebx
xorl %ebx, %ebx
subq $0x30, %rsp
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x0, 0x28(%rsp)
callq 0xb550
addq $0x30, %rsp
jmp 0xab75
movq -0x88(%rbp), %rdi
callq 0x2040
movq -0x78(%rbp), %rdi
callq 0x2040
movq -0xd8(%rbp), %rdi
callq 0xc2d0
movq -0xd0(%rbp), %rdi
callq 0xc2d0
movl $0x1, -0x14(%rbp)
movl $0x1, -0x144(%rbp)
movq -0x58(%rbp), %rax
movq %rax, %rsp
movl -0x14(%rbp), %eax
leaq -0x10(%rbp), %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)