// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a8, %rsp            # imm = 0x7A8
movq %rsp, %r13
leaq 0x1c0(%rsp), %rax
leaq 0x140(%rsp), %rcx
movq %rax, (%rcx)
movq $0x5dc, 0x8(%rcx)       # imm = 0x5DC
xorps %xmm0, %xmm0
leaq 0x108(%rsp), %rsi
movups %xmm0, 0x8(%rsi)
movups %xmm0, 0x18(%rsi)
movups %xmm0, 0x28(%rsi)
leaq 0xf8(%rsp), %rax
movq %rax, (%rsi)
movl $0x10, 0x8(%rsi)
movq %rcx, 0x10(%rsi)
movq $0x1, 0x18(%rsi)
leaq 0x150(%rsp), %rax
movq %rax, 0x20(%rsi)
movq $0x64, 0x28(%rsi)
movl 0x9eda(%rip), %edi      # 0x111f8
xorl %edx, %edx
callq 0x22a0
movq %rax, %r12
pushq $-0x1
popq %rbp
testl %r12d, %r12d
js 0x7e22
cmpw $0x2, 0xf8(%rsp)
jne 0x7e22
cmpl $0x10, 0x110(%rsp)
jb 0x7e22
cmpq $0x10, 0x130(%rsp)
jb 0x7366
movq 0x128(%rsp), %rax
jmp 0x7368
xorl %eax, %eax
leaq 0x108(%rsp), %rbx
testq %rax, %rax
je 0x7e22
cmpl $0x0, 0x8(%rax)
jne 0x7385
cmpl $0x8, 0xc(%rax)
je 0x7392
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2350
jmp 0x7370
movl 0x10(%rax), %ebx
testl %ebx, %ebx
jle 0x7e22
movl %ebx, %edi
callq 0x38f4
testq %rax, %rax
je 0x7e1f
movq %rax, %r15
leaq 0x24(%rsp), %rsi
movq %rax, %rdi
callq 0x8ddf
testl %eax, %eax
jle 0x7e1f
movq %rbx, 0xa8(%rsp)
movq %r13, 0x28(%rsp)
pushq $0x3c
popq %rbx
xorl %r13d, %r13d
movq $0x0, 0x8(%rsp)
movslq 0x68(%r15), %rax
cmpq %rax, %r13
jge 0x7433
movq 0x60(%r15), %rax
cmpl $0x0, (%rax,%rbx)
je 0x742a
leaq (%rax,%rbx), %r14
addq $-0x20, %r14
movq %r14, %rdi
callq 0x8d1b
testl %eax, %eax
je 0x742a
movq %r15, %rbp
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x863f
testq %rax, %rax
cmovneq %rax, %r15
movq %r15, 0x8(%rsp)
movq %rbp, %r15
incq %r13
addq $0x70, %rbx
jmp 0x73e1
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
andq $0x0, 0xa0(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
xorl %edx, %edx
cmpl $0xec, %r12d
jl 0x7cdc
cmpb $0x1, 0x1c0(%rsp)
movq 0x28(%rsp), %r13
jne 0x79ff
cmpb $0x1, 0x1c1(%rsp)
jne 0x79ff
cmpb $0x6, 0x1c2(%rsp)
movl $0x0, %r8d
jne 0x7ded
xorl %edx, %edx
cmpl $0xf0, %r12d
jb 0x79ff
cmpl $0x63538263, 0x2ac(%rsp) # imm = 0x63538263
movl $0x0, %r8d
jne 0x7ded
leaq 0x1dc(%rsp), %r11
movl -0x18(%r11), %eax
movl %eax, 0xd4(%rsp)
movzbl -0x12(%r11), %eax
shrl $0x7, %eax
movl %eax, 0xd0(%rsp)
movups -0x10(%r11), %xmm1
pushq $0x1
popq %rax
subl %r12d, %eax
movq %rax, 0xf0(%rsp)
leaq 0x1c2(%rsp), %rdi
movl $0xf0, %ecx
pushq $-0x1
popq %rdx
movl $0x0, 0x48(%rsp)
movl $0x0, 0x44(%rsp)
movq $0x0, 0x18(%rsp)
xorl %r8d, %r8d
movl $0x0, 0x40(%rsp)
xorl %r9d, %r9d
movl %r12d, %eax
subl %ecx, %eax
movslq %ecx, %rcx
leaq (%rdi,%rcx), %rsi
movl %ecx, %r14d
xorl %ebx, %ebx
leal (%r14,%rbx), %ecx
cmpl %r12d, %ecx
jge 0x7de8
testl %eax, %eax
jle 0x79d3
movzbl -0x2(%rsi,%rbx), %ecx
testl %ecx, %ecx
jne 0x756a
incq %rbx
decl %eax
jmp 0x7545
cmpl $0xff, %ecx
je 0x771f
movq 0xf0(%rsp), %rsi
movq %rdi, %rbp
leal (%rsi,%r14), %edi
movl %ebx, %esi
addl %edi, %esi
je 0x79d3
movq %rbp, %rdi
movslq %r14d, %rsi
addq %rbp, %rsi
movzbl -0x1(%rbx,%rsi), %esi
movq %rsi, %r10
addl $0x2, %esi
cmpl %esi, %eax
jb 0x79d3
cmpl $0x4d, %ecx
je 0x769a
cmpl $0x35, %ecx
je 0x75ec
cmpl $0x36, %ecx
je 0x7681
cmpl $0x3d, %ecx
je 0x7605
cmpl $0x32, %ecx
jne 0x7710
cmpl $0x4, %r10d
jne 0x7de8
movslq %r14d, %rax
addq %rdi, %rax
movl (%rbx,%rax), %eax
movl %eax, 0x48(%rsp)
jmp 0x7710
cmpl $0x1, %r10d
jne 0x7de8
movslq %r14d, %rax
addq %rdi, %rax
movzbl (%rbx,%rax), %edx
jmp 0x7710
movaps %xmm1, 0xe0(%rsp)
movl %edx, 0x34(%rsp)
movl %r9d, 0xcc(%rsp)
movq %r8, 0x38(%rsp)
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
jne 0x7dde
movq %r10, 0xc0(%rsp)
movq %r10, %rdi
callq 0x2250
testq %rax, %rax
je 0x7ddc
movslq %r14d, %rsi
addq %rbp, %rsi
addq %rbx, %rsi
movq %rax, %rdi
movq %rax, 0x18(%rsp)
movq 0xc0(%rsp), %rbp
movq %rbp, %rdx
callq 0x2220
leaq 0x1c2(%rsp), %rdi
movl %ebp, 0x40(%rsp)
movq 0x38(%rsp), %r8
movl 0xcc(%rsp), %r9d
jmp 0x76f9
cmpl $0x4, %r10d
jne 0x7de8
movslq %r14d, %rax
addq %rdi, %rax
movl (%rbx,%rax), %eax
movl %eax, 0x44(%rsp)
jmp 0x7710
movaps %xmm1, 0xe0(%rsp)
movl %edx, 0x34(%rsp)
testq %r8, %r8
jne 0x7de8
movq %r10, 0xc0(%rsp)
movq %r10, %rdi
callq 0x2250
testq %rax, %rax
je 0x7de5
movq %rax, %rdi
movslq %r14d, %rsi
addq %rbp, %rsi
addq %rbx, %rsi
movq 0xc0(%rsp), %rbp
movq %rbp, %rdx
movq %rdi, 0x38(%rsp)
callq 0x2220
leaq 0x1c2(%rsp), %rdi
movq 0x38(%rsp), %r8
movl %ebp, %r9d
movl 0x34(%rsp), %edx
leaq 0x1dc(%rsp), %r11
movaps 0xe0(%rsp), %xmm1
movq %rbp, %r10
addl %r10d, %r14d
leal (%rbx,%r14), %ecx
addl $0x2, %ecx
jmp 0x7534
movl %edx, 0x50(%rsp)
movl 0xd0(%rsp), %eax
movl %eax, 0x54(%rsp)
movups (%r11), %xmm0
movups %xmm0, 0x6c(%rsp)
movl 0xd4(%rsp), %eax
movl %eax, 0x58(%rsp)
movups %xmm1, 0x5c(%rsp)
movl 0x48(%rsp), %eax
movl %eax, 0x7c(%rsp)
movl 0x44(%rsp), %eax
movl %eax, 0x80(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x88(%rsp)
movl 0x40(%rsp), %eax
movl %eax, 0x90(%rsp)
movq %r8, 0x98(%rsp)
movl %r9d, 0xa0(%rsp)
leaq 0x9acf(%rip), %rax      # 0x11258
cmpl $0x2, (%rax)
jge 0x7a07
xorl %r12d, %r12d
pushq $0x7
popq %rbp
leal 0x8(%r12), %eax
cmpl %r9d, %eax
jge 0x77dd
movl %r12d, %edi
movzbl (%r8,%rdi), %r13d
cmpl $0x7, %r13d
jne 0x77d5
addq %r8, %rdi
incq %rdi
leaq 0x5607(%rip), %rsi      # 0xcdc4
movq %rbp, %rdx
movq %r8, %rbx
movl %r9d, %r14d
callq 0x2270
movl %r14d, %r9d
movq %rbx, %r8
testl %eax, %eax
je 0x77f5
addl %r13d, %r12d
incl %r12d
jmp 0x7798
cmpl $0x0, 0x80(%rsp)
je 0x7843
leaq 0x6c(%rsp), %rax
movl 0x14(%rax), %eax
cmpl 0x24(%rsp), %eax
je 0x7843
leaq 0x9a5c(%rip), %rax      # 0x11258
cmpl $0x2, (%rax)
jge 0x7bbf
xorl %r15d, %r15d
movq 0x28(%rsp), %r13
movq 0x8(%rsp), %rbx
movq 0x88(%rsp), %rdi
callq 0x2040
movq 0x98(%rsp), %rdi
callq 0x2040
movq %r15, %rdi
callq 0x8624
movq %rbx, %rdi
callq 0x8624
pushq $0x1
jmp 0x7e21
leaq 0x9a0e(%rip), %rax      # 0x11258
cmpl $0x2, (%rax)
jge 0x7cc6
andl $0x0, 0xbc(%rsp)
andq $0x0, 0xb4(%rsp)
movw $0x2, 0xb0(%rsp)
movl 0x68(%rsp), %eax
xorl %ebx, %ebx
testl %eax, %eax
jne 0x7895
xorl %ecx, %ecx
cmpl 0x54(%rsp), %ecx
movl $0x0, %eax
sbbl %eax, %eax
movl 0x5c(%rsp), %edx
cmpl $0x1, %edx
sbbl %ecx, %ecx
orl %edx, %eax
orl %ecx, %eax
pushq $0x1
popq %rbx
movl %eax, 0xb4(%rsp)
movw $0x4400, 0xb2(%rsp)     # imm = 0x4400
movq %r15, %rdi
callq 0x70af
testl %eax, %eax
movq 0x28(%rsp), %r13
je 0x795d
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %edx, %edx
callq 0x42f7
movq %rax, %r15
movl 0x50(%rsp), %eax
leal -0x1(%rax), %ecx
cmpl $0x7, %ecx
ja 0x780d
leaq 0x5467(%rip), %rdx      # 0xcd48
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x1, %eax
je 0x78f7
movl 0x5c(%rsp), %ecx
testl %ecx, %ecx
jne 0x78fb
movl 0x7c(%rsp), %ecx
movl %ecx, 0x14(%rsp)
movl 0x14(%rsp), %r12d
movl %eax, %ecx
xorl $0x3, %ecx
orl %r12d, %ecx
je 0x7960
cmpl $0x1, %eax
jne 0x7a9b
movq 0x88(%rsp), %rdi
movl 0x90(%rsp), %esi
leaq 0x6c(%rsp), %rdx
movq 0x8(%rsp), %r14
movq %r14, %rcx
callq 0x7e39
testq %rax, %rax
je 0x7a9b
movq %rax, %rbp
movq %rax, %rdi
movq %r14, %rsi
callq 0x8985
xorl %r14d, %r14d
testl %eax, %eax
cmovneq %rbp, %r14
jmp 0x7a9e
xorl %r15d, %r15d
cmpl $0x0, 0x68(%rsp)
jne 0x796f
orl $-0x1, 0xb4(%rsp)
cmpl $0x3, 0x50(%rsp)
jne 0x780d
subq $0x30, %rsp
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movq 0xd8(%rsp), %rax
movl %eax, 0x8(%rsp)
leaq 0xac(%rsp), %rax
movq %rax, (%rsp)
andl $0x0, 0x20(%rsp)
leaq 0xe0(%rsp), %rdi
pushq $0x6
popq %rdx
leaq 0x54(%rsp), %r9
movl %ebx, %esi
leaq 0x88(%rsp), %rcx
leaq 0x9c(%rsp), %r8
callq 0x7fc2
addq $0x30, %rsp
jmp 0x780d
movq 0x961e(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0x5233(%rip), %rdi      # 0xcc17
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
movq %r8, %rbx
callq 0x2340
movq 0x18(%rsp), %rdx
movq %rbx, %r8
jmp 0x7ded
xorl %r8d, %r8d
jmp 0x7ded
movq (%r15), %rcx
leaq 0x5399(%rip), %rsi      # 0xcdaa
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x23c0
movq 0x98(%rsp), %r8
movl 0xa0(%rsp), %r9d
jmp 0x7792
subq $0x8, %rsp
leaq 0xb8(%rsp), %rdi
pushq $0x5
popq %rdx
leaq 0x2c(%rsp), %r9
movl %ebx, %esi
leaq 0x60(%rsp), %rcx
leaq 0x74(%rsp), %r8
pushq $0x0
pushq %r15
pushq $0x0
pushq 0xc8(%rsp)
pushq $0x0
jmp 0x7ca4
movq 0x88(%rsp), %rdi
movl 0x90(%rsp), %esi
leaq 0x6c(%rsp), %rdx
xorl %ecx, %ecx
callq 0x7e39
testq %rax, %rax
je 0x780d
leaq 0x97e1(%rip), %rcx      # 0x11270
movq (%rcx), %rcx
movq %rcx, 0x28(%rax)
jmp 0x780d
xorl %r14d, %r14d
testl %r12d, %r12d
setne %al
testq %r14, %r14
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x7bd8
leaq 0x14(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x8985
testl %eax, %eax
je 0x7b1d
xorl %esi, %esi
cmpl $0x1, 0x50(%rsp)
sete %sil
leaq 0x14(%rsp), %rdi
callq 0x6fdd
testq %rax, %rax
je 0x7b1d
movq %rax, %r14
movq 0x28(%rax), %rax
leaq 0x9780(%rip), %rcx      # 0x11270
cmpq (%rcx), %rax
jl 0x7be1
movq 0x88(%rsp), %rdi
movl 0x90(%rsp), %esi
leaq 0x6c(%rsp), %rdx
movq %r14, %rcx
callq 0x7ed6
testl %eax, %eax
jne 0x7be1
cmpl $0x3, 0x50(%rsp)
je 0x7960
xorl %ebp, %ebp
pushq $0x14
popq %r12
leaq 0xdc(%rsp), %r14
cmpl $0x2, %ebp
je 0x7960
subl $0x1, %r12d
jb 0x7bb4
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x8d3c
testl %eax, %eax
js 0x7960
movq %r14, %rdi
xorl %esi, %esi
callq 0x6fdd
testq %rax, %rax
je 0x7b7e
cmpl $0x1, %ebp
jne 0x7b3f
movq 0x28(%rax), %rax
leaq 0x96f7(%rip), %rcx      # 0x11270
cmpq (%rcx), %rax
jge 0x7b3f
leaq 0xd8(%rsp), %rdi
movq %r14, %rsi
movq 0x8(%rsp), %rdx
callq 0x7f31
cmpl $0x1e, %eax
ja 0x7b3f
movl 0xdc(%rsp), %edx
movl %edx, %esi
bswapl %esi
movb $0x1e, %cl
subb %al, %cl
shrl %cl, %esi
testb $0x3, %sil
je 0x7b3f
jmp 0x7d2c
incl %ebp
pushq $0x14
popq %r12
jmp 0x7b36
leaq 0x5206(%rip), %rsi      # 0xcdcc
xorl %r15d, %r15d
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x23c0
jmp 0x7808
testq %r14, %r14
je 0x7b1d
leaq 0x4c(%rsp), %rdi
movq %r14, %rsi
movq 0x8(%rsp), %rdx
callq 0x7f31
testl %eax, %eax
js 0x7960
leaq 0x6c(%rsp), %rax
movups (%rax), %xmm0
movups %xmm0, 0x8(%r14)
movq 0xa8(%rsp), %rax
movl %eax, 0x4(%r14)
leaq 0x9655(%rip), %rax      # 0x11270
movq (%rax), %rcx
leaq 0x712(%rcx), %rax
cmpl $0x1, 0x50(%rsp)
cmoveq %rcx, %rax
cmpq %rax, 0x28(%r14)
jge 0x7c38
movq %rax, 0x28(%r14)
movq 0x18(%r14), %rdi
callq 0x2040
movl 0x90(%rsp), %eax
movl %eax, 0x20(%r14)
movq 0x88(%rsp), %rax
movq %rax, 0x18(%r14)
andq $0x0, 0x88(%rsp)
xorl %eax, %eax
cmpl $0x1, 0x50(%rsp)
setne %al
leal (%rax,%rax,2), %edx
addl $0x2, %edx
subq $0x8, %rsp
leaq 0x54(%rsp), %rax
leaq 0xb8(%rsp), %rdi
leaq 0x2c(%rsp), %r9
movl %ebx, %esi
leaq 0x60(%rsp), %rcx
leaq 0x74(%rsp), %r8
pushq $0x708                  # imm = 0x708
pushq %r15
pushq %rax
pushq 0xc8(%rsp)
pushq %r14
callq 0x7fc2
addq $0x30, %rsp
testl %eax, %eax
jns 0x780d
leaq 0x511c(%rip), %rdi      # 0xcdd8
callq 0x22f0
jmp 0x780d
leaq 0x4c1c(%rip), %rsi      # 0xc8e9
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x23c0
jmp 0x7853
xorl %r8d, %r8d
movq 0x28(%rsp), %r13
jmp 0x7ded
leaq 0x7c(%rsp), %rdi
xorl %esi, %esi
callq 0x6fdd
movq %rax, %r14
movq 0x92f9(%rip), %r12      # 0x10ff8
movq (%r12), %rcx
leaq 0x50da(%rip), %rdi      # 0xcde4
pushq $0x14
popq %rsi
pushq $0x1
popq %rdx
callq 0x2340
testq %r14, %r14
jne 0x7d57
movq (%r12), %rcx
leaq 0x50ff(%rip), %rdi      # 0xce24
pushq $0xc
jmp 0x7dce
leaq 0x14(%rsp), %rdi
movl %edx, (%rdi)
movl 0xd8(%rsp), %eax
movl %eax, 0x4c(%rsp)
pushq $0x1
popq %rsi
callq 0x6fdd
movq %rax, %r14
testq %rax, %rax
jne 0x7bfb
jmp 0x7960
movq 0x28(%r14), %rax
leaq 0x950e(%rip), %rbx      # 0x11270
movq (%rbx), %rcx
cmpq %rcx, %rax
jge 0x7dc1
addq $-0x708, %rcx           # imm = 0xF8F8
cmpq %rcx, %rax
jl 0x7d1a
movq (%r12), %rcx
leaq 0x508e(%rip), %rdi      # 0xce0f
pushq $0x14
popq %rsi
pushq $0x1
popq %rdx
callq 0x2340
movq 0x18(%r14), %rdi
callq 0x2040
andq $0x0, 0x18(%r14)
andl $0x0, 0x20(%r14)
andq $0x0, 0x88(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r14)
movl $0x708, %eax            # imm = 0x708
addq (%rbx), %rax
movq %rax, 0x28(%r14)
jmp 0x7808
movq (%r12), %rcx
leaq 0x502d(%rip), %rdi      # 0xcdf9
pushq $0x15
popq %rsi
pushq $0x1
popq %rdx
callq 0x2340
jmp 0x7808
xorl %edx, %edx
movq 0x38(%rsp), %r8
jmp 0x7ded
xorl %r8d, %r8d
movq 0x18(%rsp), %rdx
movq 0x9204(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
movq %rdx, %r14
leaq 0x5030(%rip), %rdi      # 0xce31
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
movq %r8, %rbx
callq 0x2340
movq %r14, %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
pushq $-0x1
popq %rbp
movq %r13, %rsp
movl %ebp, %eax
addq $0x7a8, %rsp            # imm = 0x7A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq