// File: hariguchi[P]rtacl/unitTest.cpp
// Function: v6sockTest()
static void
v6sockTest()
{
    rtacl::db<rtacl::ipv6a>    acl;
    rtacl::entry<rtacl::ipv6a> rtaclEnt;
    rtacl::sockItem<sockaddr_in6> sKey;
    std::unique_ptr<rtacl::sockEnt<sockaddr_in6> > pEnt[10];
    rtacl::tuple<rtacl::ipv6a>& min = rtaclEnt.first.min_corner();
    rtacl::tuple<rtacl::ipv6a>& max = rtaclEnt.first.max_corner();

    sockaddr_in6 siSrc;
    sockaddr_in6 siDst;
    memset(&siSrc, 0, sizeof(siSrc));
    memset(&siDst, 0, sizeof(siDst));
    siSrc.sin6_family = AF_INET6;
    siDst.sin6_family = AF_INET6;

    /*
     * Add ACL entries
     */
    size_t i;
    for (i = 0; i < elementsof(pEnt); ++i) {
        pEnt[i].reset(new rtacl::sockEnt<sockaddr_in6>);
        assert(pEnt[i].get());

        rtacl::sockItem<sockaddr_in6>& smin = pEnt[i]->getMin();
        rtacl::sockItem<sockaddr_in6>& smax = pEnt[i]->getMax();
        u32 a = 0x0a0a0a00 + (i * 20);

        /*
         * minimum (lower bound)
         */
        siSrc.sin6_addr.s6_addr[0] = 0x20;
        siSrc.sin6_addr.s6_addr[1] = 0x01;
        siSrc.sin6_addr.s6_addr[6] = 0x11;
        siSrc.sin6_addr.s6_addr[7] = 0x11;
        *((u32*)(siSrc.sin6_addr.s6_addr + 12)) = htonl(a);
        siSrc.sin6_port        = htons(0);
        memset(siDst.sin6_addr.s6_addr, 0, sizeof(siDst.sin6_addr.s6_addr));
        siDst.sin6_port        = htons(80);
        smin.set(siSrc, siDst, 6, 0);

        /*
         * maximum (upper bound)
         */
        *((u32*)(siSrc.sin6_addr.s6_addr + 12)) = htonl(a + 10);
        siSrc.sin6_port = htons(65535);
        memset(siDst.sin6_addr.s6_addr,
               0xff, sizeof(siDst.sin6_addr.s6_addr));
        siDst.sin6_port = htons(80);
        smax.set(siSrc, siDst, 6, 0xff);

        acl.makeMin(smin.getSrc(), smin.getDst(),
                    smin.getProto(), smin.getDSCP(), min);
        acl.makeMax(smax.getSrc(), smax.getDst(),
                    smax.getProto(), smax.getDSCP(), max);
        rtaclEnt.second = reinterpret_cast<uintptr_t>(pEnt[i].get());
        acl.insert(rtaclEnt);
    }
    std::cout << (bfmt("size: %ld, i: %ld\n") % acl.size() % i).str();
    assert(i == acl.size());

    /*
     * Show all ACL entries
     */
    rtacl::result<rtacl::ipv6a> r = acl.dump();
    for (auto it : r) {
        showRTaclEnt<rtacl::ipv6a, sockaddr_in6>(it.first, it.second);
    }
    /*
     * ACL match test (match)
     */
    for (i = 0; i < elementsof(pEnt); ++i) {
        /*
         * Source key
         */
        u32 a = 0x0a0a0a00 + (i * 20) + 2;
        siSrc.sin6_addr.s6_addr[0] = 0x20;
        siSrc.sin6_addr.s6_addr[1] = 0x01;
        siSrc.sin6_addr.s6_addr[6] = 0x11;
        siSrc.sin6_addr.s6_addr[7] = 0x11;
        u32 na = htonl(a);
        memcpy(siSrc.sin6_addr.s6_addr + 12, &na, sizeof(na));
        siSrc.sin6_port = htons(0x1234);
        siDst.sin6_port = htons(80);
        sKey.set(siSrc, siDst, 6, 0);
        /*
         * Destination key
         */
        siDst.sin6_addr.s6_addr[0]  = 0x20;
        siDst.sin6_addr.s6_addr[1]  = 0x00;
        siDst.sin6_addr.s6_addr[2]  = 0x00;
        siDst.sin6_addr.s6_addr[3]  = 0x01;
        siDst.sin6_addr.s6_addr[15] = 0x01;
        memset(siDst.sin6_addr.s6_addr + 4, 0, 11);
        sKey.set(siSrc, siDst, 6, 0);

        rtacl::tuple<rtacl::ipv6a> rtaclKey;
        acl.makeKey(sKey.getSrc(), sKey.getDst(),
                    sKey.getProto(), sKey.getDSCP(), rtaclKey);
        rtacl::result<rtacl::ipv6a> result = acl.find(rtaclKey);
        if (result.size() != 1) {
            std::cout << "Error: no match. key: ";
            showSockItem(sKey);
        }
        int j = 0;
        for (auto r : result) {
            assert(reinterpret_cast<uintptr_t>(pEnt[i].get()) == r.second);
            std::cout << (bfmt("pEnt: %p, result: 0x%lx\n")
                          % pEnt[i].get()
                          % r.second).str();
            ++j;
        }
    }

    /*
     * ACL match test (unmatch)
     */
    for (i = 0; i < elementsof(pEnt); ++i) {
        /*
         * Source key
         */
        u32 a = 0x0a0a0a00 + (i * 20) - 1;
        siSrc.sin6_addr.s6_addr[0] = 0x20;
        siSrc.sin6_addr.s6_addr[1] = 0x01;
        siSrc.sin6_addr.s6_addr[6] = 0x11;
        siSrc.sin6_addr.s6_addr[7] = 0x11;
        u32 na = htonl(a);
        memcpy(siSrc.sin6_addr.s6_addr + 12, &na, sizeof(na));
        siSrc.sin6_port = htons(0x1234);
        siDst.sin6_port = htons(80);
        sKey.set(siSrc, siDst, 6, 0);
        /*
         * Destination key
         */
        siDst.sin6_addr.s6_addr[0]  = 0x20;
        siDst.sin6_addr.s6_addr[1]  = 0x00;
        siDst.sin6_addr.s6_addr[2]  = 0x00;
        siDst.sin6_addr.s6_addr[3]  = 0x01;
        siDst.sin6_addr.s6_addr[15] = 0x01;
        memset(siDst.sin6_addr.s6_addr + 4, 0, 11);
        sKey.set(siSrc, siDst, 6, 0);

        rtacl::tuple<rtacl::ipv6a> rtaclKey;
        acl.makeKey(sKey.getSrc(), sKey.getDst(),
                    sKey.getProto(), sKey.getDSCP(), rtaclKey);
        rtacl::result<rtacl::ipv6a> result = acl.find(rtaclKey);
        if (result.size() == 0) {
            std::cout << "no match (correct): key: ";
            showSockItem(sKey);
        } else {
            std::cout << "Error: matched: key: ";
            showSockItem(sKey);
            for (auto it : result) {
                showRTaclEnt<rtacl::ipv6a, sockaddr_in6>(it.first, it.second);
            }
        }
    }
    /*
     * Remove ACL entries
     */
    for (i = 0; i < elementsof(pEnt); ++i) {
        rtacl::sockItem<sockaddr_in6>& smin = pEnt[i]->getMin();
        rtacl::sockItem<sockaddr_in6>& smax = pEnt[i]->getMax();
        acl.makeMin(smin.getSrc(), smin.getDst(),
                    smin.getProto(), smin.getDSCP(), min);
        acl.makeMax(smax.getSrc(), smax.getDst(),
                    smax.getProto(), smax.getDSCP(), max);
        rtaclEnt.second = reinterpret_cast<uintptr_t>(pEnt[i].get());
        bool rc = acl.remove(rtaclEnt);
        if (rc) {
            std::cout << (bfmt("size: %2ld: ") % acl.size()).str();

            sKey = smin;
            sKey.getSrc().sin6_addr.s6_addr[15] += 1;

            rtacl::tuple<rtacl::ipv6a> rtaclKey;
            acl.makeKey(sKey.getSrc(), sKey.getDst(),
                        sKey.getProto(), sKey.getDSCP(), rtaclKey);

            rtacl::result<rtacl::ipv6a> result = acl.find(rtaclKey);
            if (result.size() == 0) {
                std::cout << "no match (correct): key: ";
                showSockItem(sKey);
            } else {
                std::cout << "Error: matched: key: ";
                showSockItem(sKey);
                for (auto it : result) {
                    showRTaclEnt<rtacl::ipv6a,
                                 sockaddr_in6>(it.first, it.second);
                }
            }
        } else {
            std::cout << "Error: failed to remove acl entry: ";
            showRTaclEnt<rtacl::ipv6a,
                         sockaddr_in6>(rtaclEnt.first, rtaclEnt.second);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1620, %rsp           # imm = 0x1620
leaq -0x20(%rbp), %rdi
callq 0x2e230
leaq -0x270(%rbp), %rdi
callq 0x2e2b0
jmp 0x86f2
leaq -0x2d0(%rbp), %rdi
callq 0x2e2f0
jmp 0x8700
leaq -0x320(%rbp), %rax
movq %rax, %rcx
addq $0x50, %rcx
movq %rcx, -0x1450(%rbp)
movq %rax, -0x1448(%rbp)
movq -0x1448(%rbp), %rdi
movq %rdi, -0x1458(%rbp)
callq 0x2e3c0
movq -0x1458(%rbp), %rax
movq -0x1450(%rbp), %rcx
addq $0x8, %rax
cmpq %rcx, %rax
movq %rax, -0x1448(%rbp)
jne 0x871c
leaq -0x270(%rbp), %rdi
callq 0x2e3f0
movq %rax, -0x1460(%rbp)
jmp 0x8762
movq -0x1460(%rbp), %rax
movq %rax, -0x328(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x2e400
movq %rax, -0x1468(%rbp)
jmp 0x8785
movq -0x1468(%rbp), %rax
movq %rax, -0x330(%rbp)
leaq -0x34c(%rbp), %rdi
xorl %esi, %esi
movl $0x1c, %edx
callq 0x51b0
leaq -0x368(%rbp), %rdi
xorl %esi, %esi
movl $0x1c, %edx
callq 0x51b0
movw $0xa, -0x34c(%rbp)
movw $0xa, -0x368(%rbp)
movq $0x0, -0x370(%rbp)
movq -0x370(%rbp), %rax
movq %rax, -0x1478(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x2e420
movq %rax, -0x1470(%rbp)
jmp 0x87f9
movq -0x1478(%rbp), %rax
movq -0x1470(%rbp), %rcx
cmpq %rcx, %rax
jae 0x8baa
movq -0x370(%rbp), %rax
leaq -0x320(%rbp,%rax,8), %rax
movq %rax, -0x1488(%rbp)
movl $0xb0, %edi
callq 0x5360
movq %rax, -0x1480(%rbp)
jmp 0x8839
movq -0x1480(%rbp), %rdi
callq 0x2e460
jmp 0x8847
movq -0x1480(%rbp), %rsi
movq -0x1488(%rbp), %rdi
callq 0x2e430
movq -0x370(%rbp), %rax
leaq -0x320(%rbp), %rdi
shlq $0x3, %rax
addq %rax, %rdi
callq 0x2e490
cmpq $0x0, %rax
je 0x887c
jmp 0x88f1
leaq 0x5e74a(%rip), %rdi     # 0x66fcd
leaq 0x471d6(%rip), %rsi     # 0x4fa60
movl $0xf0, %edx
leaq 0x5e745(%rip), %rcx     # 0x66fdb
callq 0x5220
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x9afc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x9ab0
movq -0x1480(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
movl $0xb0, %esi
callq 0x5370
jmp 0x9ab0
movq -0x370(%rbp), %rax
leaq -0x320(%rbp,%rax,8), %rdi
callq 0x2e4c0
movq %rax, %rdi
callq 0x2e4e0
movq %rax, -0x1490(%rbp)
jmp 0x8916
movq -0x1490(%rbp), %rax
movq %rax, -0x378(%rbp)
movq -0x370(%rbp), %rax
leaq -0x320(%rbp,%rax,8), %rdi
callq 0x2e4c0
movq %rax, %rdi
callq 0x2e4f0
movq %rax, -0x1498(%rbp)
jmp 0x8949
movq -0x1498(%rbp), %rax
movq %rax, -0x380(%rbp)
movl -0x370(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %ecx
movl %ecx, %eax
leal 0xa0a0a00(,%rax,4), %eax
movl %eax, -0x384(%rbp)
movb $0x20, -0x344(%rbp)
movb $0x1, -0x343(%rbp)
movb $0x11, -0x33e(%rbp)
movb $0x11, -0x33d(%rbp)
movl -0x384(%rbp), %edi
callq 0x5280
movl %eax, -0x338(%rbp)
xorl %edi, %edi
movl %edi, -0x149c(%rbp)
callq 0x5040
movw %ax, -0x34a(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0x360(%rbp)
movl $0x50, %edi
callq 0x5040
movl -0x149c(%rbp), %r8d
movw %ax, -0x366(%rbp)
movq -0x378(%rbp), %rdi
leaq -0x34c(%rbp), %rsi
leaq -0x368(%rbp), %rdx
movl $0x6, %ecx
callq 0x2e510
jmp 0x89f5
movl -0x384(%rbp), %edi
addl $0xa, %edi
callq 0x5280
movl %eax, -0x338(%rbp)
movl $0xffff, %edi           # imm = 0xFFFF
callq 0x5040
movw %ax, -0x34a(%rbp)
pcmpeqd %xmm0, %xmm0
movups %xmm0, -0x360(%rbp)
movl $0x50, %edi
callq 0x5040
movw %ax, -0x366(%rbp)
movq -0x380(%rbp), %rdi
leaq -0x34c(%rbp), %rsi
leaq -0x368(%rbp), %rdx
movl $0x6, %ecx
movl $0xff, %r8d
callq 0x2e510
jmp 0x8a5d
movq -0x378(%rbp), %rdi
callq 0x2e5e0
movq %rax, -0x14a8(%rbp)
jmp 0x8a72
movq -0x378(%rbp), %rdi
callq 0x2e5f0
movq %rax, -0x14b0(%rbp)
jmp 0x8a87
movq -0x378(%rbp), %rdi
callq 0x2e610
movb %al, -0x14b1(%rbp)
jmp 0x8a9b
movq -0x378(%rbp), %rdi
callq 0x2e630
movb %al, -0x14b2(%rbp)
jmp 0x8aaf
movq -0x14b0(%rbp), %rdx
movq -0x14a8(%rbp), %rsi
movb -0x14b2(%rbp), %al
movb -0x14b1(%rbp), %cl
movq -0x328(%rbp), %r9
movzbl %cl, %ecx
movzbl %al, %r8d
leaq -0x20(%rbp), %rdi
callq 0x2e580
jmp 0x8ae2
movq -0x380(%rbp), %rdi
callq 0x2e5e0
movq %rax, -0x14c0(%rbp)
jmp 0x8af7
movq -0x380(%rbp), %rdi
callq 0x2e5f0
movq %rax, -0x14c8(%rbp)
jmp 0x8b0c
movq -0x380(%rbp), %rdi
callq 0x2e610
movb %al, -0x14c9(%rbp)
jmp 0x8b20
movq -0x380(%rbp), %rdi
callq 0x2e630
movb %al, -0x14ca(%rbp)
jmp 0x8b34
movq -0x14c8(%rbp), %rdx
movq -0x14c0(%rbp), %rsi
movb -0x14ca(%rbp), %al
movb -0x14c9(%rbp), %cl
movq -0x330(%rbp), %r9
movzbl %cl, %ecx
movzbl %al, %r8d
leaq -0x20(%rbp), %rdi
callq 0x2e650
jmp 0x8b67
movq -0x370(%rbp), %rax
leaq -0x320(%rbp,%rax,8), %rdi
callq 0x2e490
movq %rax, -0x30(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x2e6b0
jmp 0x8b91
jmp 0x8b93
movq -0x370(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x370(%rbp)
jmp 0x87d6
leaq 0x46e8c(%rip), %rsi     # 0x4fa3d
leaq -0x488(%rbp), %rdi
callq 0xa390
jmp 0x8bbf
leaq -0x20(%rbp), %rdi
callq 0x2e6e0
movq %rax, -0x14d8(%rbp)
jmp 0x8bd1
movq -0x14d8(%rbp), %rax
movq %rax, -0x490(%rbp)
leaq -0x488(%rbp), %rdi
leaq -0x490(%rbp), %rsi
callq 0xa510
movq %rax, -0x14e0(%rbp)
jmp 0x8bfb
movq -0x14e0(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0xa560
movq %rax, -0x14e8(%rbp)
jmp 0x8c17
movq -0x14e8(%rbp), %rsi
leaq -0x3a8(%rbp), %rdi
callq 0xa590
jmp 0x8c2c
movq 0xa8385(%rip), %rdi     # 0xb0fb8
leaq -0x3a8(%rbp), %rsi
callq 0x52f0
jmp 0x8c41
leaq -0x3a8(%rbp), %rdi
callq 0x51e0
leaq -0x488(%rbp), %rdi
callq 0xa7e0
movq -0x370(%rbp), %rax
movq %rax, -0x14f8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x2e6e0
movq %rax, -0x14f0(%rbp)
jmp 0x8c79
movq -0x14f8(%rbp), %rax
movq -0x14f0(%rbp), %rcx
cmpq %rcx, %rax
jne 0x8c8e
jmp 0x8cf0
leaq 0x46dbb(%rip), %rdi     # 0x4fa50
leaq 0x46dc4(%rip), %rsi     # 0x4fa60
movl $0x115, %edx            # imm = 0x115
leaq 0x5e333(%rip), %rcx     # 0x66fdb
callq 0x5220
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x8cdf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0x51e0
leaq -0x488(%rbp), %rdi
callq 0xa7e0
jmp 0x9ab0
leaq -0x4a8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x2e700
jmp 0x8d02
leaq -0x4a8(%rbp), %rax
movq %rax, -0x4b0(%rbp)
movq -0x4b0(%rbp), %rdi
callq 0x2e810
movq %rax, -0x4b8(%rbp)
movq -0x4b0(%rbp), %rdi
callq 0x2e840
movq %rax, -0x4c0(%rbp)
leaq -0x4b8(%rbp), %rdi
leaq -0x4c0(%rbp), %rsi
callq 0x2e870
testb $0x1, %al
jne 0x8d4f
jmp 0x8dad
leaq -0x4b8(%rbp), %rdi
callq 0x2e8b0
movq %rax, %rsi
leaq -0x710(%rbp), %rdi
movq %rdi, -0x1500(%rbp)
callq 0x2e8d0
movq -0x1500(%rbp), %rdi
movq -0x4d0(%rbp), %rsi
callq 0x9ef0
jmp 0x8d86
jmp 0x8d88
leaq -0x4b8(%rbp), %rdi
callq 0x2e910
jmp 0x8d36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x9aa4
movq $0x0, -0x370(%rbp)
movq -0x370(%rbp), %rax
movq %rax, -0x1510(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x2e420
movq %rax, -0x1508(%rbp)
jmp 0x8ddb
movq -0x1510(%rbp), %rax
movq -0x1508(%rbp), %rcx
cmpq %rcx, %rax
jae 0x91d6
movl -0x370(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %ecx
movl %ecx, %eax
leal 0xa0a0a02(,%rax,4), %eax
movl %eax, -0x714(%rbp)
movb $0x20, -0x344(%rbp)
movb $0x1, -0x343(%rbp)
movb $0x11, -0x33e(%rbp)
movb $0x11, -0x33d(%rbp)
movl -0x714(%rbp), %edi
callq 0x5280
movl %eax, -0x718(%rbp)
movl -0x718(%rbp), %eax
movl %eax, -0x338(%rbp)
movl $0x1234, %edi           # imm = 0x1234
callq 0x5040
movw %ax, -0x34a(%rbp)
movl $0x50, %edi
callq 0x5040
movw %ax, -0x366(%rbp)
leaq -0x2d0(%rbp), %rdi
leaq -0x34c(%rbp), %rsi
leaq -0x368(%rbp), %rdx
movl $0x6, %ecx
xorl %r8d, %r8d
callq 0x2e510
jmp 0x8e8b
movb $0x20, -0x360(%rbp)
movb $0x0, -0x35f(%rbp)
movb $0x0, -0x35e(%rbp)
movb $0x1, -0x35d(%rbp)
movb $0x1, -0x351(%rbp)
movl $0x0, -0x355(%rbp)
movq $0x0, -0x35c(%rbp)
leaq -0x2d0(%rbp), %rdi
leaq -0x34c(%rbp), %rsi
leaq -0x368(%rbp), %rdx
movl $0x6, %ecx
xorl %r8d, %r8d
callq 0x2e510
jmp 0x8ee7
leaq -0x840(%rbp), %rdi
callq 0x2e930
leaq -0x2d0(%rbp), %rdi
callq 0x2e5e0
movq %rax, -0x1518(%rbp)
jmp 0x8f08
leaq -0x2d0(%rbp), %rdi
callq 0x2e5f0
movq %rax, -0x1520(%rbp)
jmp 0x8f1d
leaq -0x2d0(%rbp), %rdi
callq 0x2e610
movb %al, -0x1521(%rbp)
jmp 0x8f31
leaq -0x2d0(%rbp), %rdi
callq 0x2e630
movb %al, -0x1522(%rbp)
jmp 0x8f45
movq -0x1520(%rbp), %rdx
movq -0x1518(%rbp), %rsi
movb -0x1522(%rbp), %al
movb -0x1521(%rbp), %cl
movzbl %cl, %ecx
movzbl %al, %r8d
leaq -0x20(%rbp), %rdi
leaq -0x840(%rbp), %r9
callq 0x2e980
jmp 0x8f78
leaq -0x858(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x840(%rbp), %rdx
callq 0x2e9e0
jmp 0x8f91
leaq -0x858(%rbp), %rdi
callq 0x2eb90
cmpq $0x1, %rax
je 0x8fdf
movq 0xa800e(%rip), %rdi     # 0xb0fb8
leaq 0x46ae2(%rip), %rsi     # 0x4fa93
callq 0x5350
jmp 0x8fb8
leaq -0x2d0(%rbp), %rdi
callq 0xa060
jmp 0x8fc6
jmp 0x8fdf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x91c5
movl $0x0, -0x85c(%rbp)
leaq -0x858(%rbp), %rax
movq %rax, -0x868(%rbp)
movq -0x868(%rbp), %rdi
callq 0x2e810
movq %rax, -0x870(%rbp)
movq -0x868(%rbp), %rdi
callq 0x2e840
movq %rax, -0x878(%rbp)
leaq -0x870(%rbp), %rdi
leaq -0x878(%rbp), %rsi
callq 0x2e870
testb $0x1, %al
jne 0x9039
jmp 0x91a2
leaq -0x870(%rbp), %rdi
callq 0x2e8b0
movq %rax, %rsi
leaq -0xad0(%rbp), %rdi
callq 0x2e8d0
movq -0x370(%rbp), %rax
leaq -0x320(%rbp), %rdi
shlq $0x3, %rax
addq %rax, %rdi
callq 0x2e490
cmpq -0x890(%rbp), %rax
jne 0x9079
jmp 0x9098
leaq 0x5de33(%rip), %rdi     # 0x66eb3
leaq 0x469d9(%rip), %rsi     # 0x4fa60
movl $0x144, %edx            # imm = 0x144
leaq 0x5df48(%rip), %rcx     # 0x66fdb
callq 0x5220
leaq 0x5de4b(%rip), %rsi     # 0x66eea
leaq -0xbd0(%rbp), %rdi
callq 0xa390
jmp 0x90ad
movq -0x370(%rbp), %rax
leaq -0x320(%rbp,%rax,8), %rdi
callq 0x2e490
movq %rax, -0xbd8(%rbp)
leaq -0xbd0(%rbp), %rdi
leaq -0xbd8(%rbp), %rsi
callq 0x2ebc0
movq %rax, -0x1530(%rbp)
jmp 0x90e4
movq -0x1530(%rbp), %rdi
leaq -0x890(%rbp), %rsi
callq 0xa560
movq %rax, -0x1538(%rbp)
jmp 0x9100
movq -0x1538(%rbp), %rsi
leaq -0xaf0(%rbp), %rdi
callq 0xa590
jmp 0x9115
movq 0xa7e9c(%rip), %rdi     # 0xb0fb8
leaq -0xaf0(%rbp), %rsi
callq 0x52f0
jmp 0x912a
leaq -0xaf0(%rbp), %rdi
callq 0x51e0
leaq -0xbd0(%rbp), %rdi
callq 0xa7e0
movl -0x85c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x85c(%rbp)
leaq -0x870(%rbp), %rdi
callq 0x2e910
jmp 0x901d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x9194
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
leaq -0xaf0(%rbp), %rdi
callq 0x51e0
leaq -0xbd0(%rbp), %rdi
callq 0xa7e0
jmp 0x91c5
leaq -0x858(%rbp), %rdi
callq 0x2ebf0
movq -0x370(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x370(%rbp)
jmp 0x8db8
leaq -0x858(%rbp), %rdi
callq 0x2ebf0
jmp 0x9aa4
movq $0x0, -0x370(%rbp)
movq -0x370(%rbp), %rax
movq %rax, -0x1548(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x2e420
movq %rax, -0x1540(%rbp)
jmp 0x9204
movq -0x1548(%rbp), %rax
movq -0x1540(%rbp), %rcx
cmpq %rcx, %rax
jae 0x94f3
movl -0x370(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %ecx
movl %ecx, %eax
leal 0xa0a09ff(,%rax,4), %eax
movl %eax, -0xbdc(%rbp)
movb $0x20, -0x344(%rbp)
movb $0x1, -0x343(%rbp)
movb $0x11, -0x33e(%rbp)
movb $0x11, -0x33d(%rbp)
movl -0xbdc(%rbp), %edi
callq 0x5280
movl %eax, -0xbe0(%rbp)
movl -0xbe0(%rbp), %eax
movl %eax, -0x338(%rbp)
movl $0x1234, %edi           # imm = 0x1234
callq 0x5040
movw %ax, -0x34a(%rbp)
movl $0x50, %edi
callq 0x5040
movw %ax, -0x366(%rbp)
leaq -0x2d0(%rbp), %rdi
leaq -0x34c(%rbp), %rsi
leaq -0x368(%rbp), %rdx
movl $0x6, %ecx
xorl %r8d, %r8d
callq 0x2e510
jmp 0x92b4
movb $0x20, -0x360(%rbp)
movb $0x0, -0x35f(%rbp)
movb $0x0, -0x35e(%rbp)
movb $0x1, -0x35d(%rbp)
movb $0x1, -0x351(%rbp)
movl $0x0, -0x355(%rbp)
movq $0x0, -0x35c(%rbp)
leaq -0x2d0(%rbp), %rdi
leaq -0x34c(%rbp), %rsi
leaq -0x368(%rbp), %rdx
movl $0x6, %ecx
xorl %r8d, %r8d
callq 0x2e510
jmp 0x9310
leaq -0xd00(%rbp), %rdi
callq 0x2e930
leaq -0x2d0(%rbp), %rdi
callq 0x2e5e0
movq %rax, -0x1550(%rbp)
jmp 0x9331
leaq -0x2d0(%rbp), %rdi
callq 0x2e5f0
movq %rax, -0x1558(%rbp)
jmp 0x9346
leaq -0x2d0(%rbp), %rdi
callq 0x2e610
movb %al, -0x1559(%rbp)
jmp 0x935a
leaq -0x2d0(%rbp), %rdi
callq 0x2e630
movb %al, -0x155a(%rbp)
jmp 0x936e
movq -0x1558(%rbp), %rdx
movq -0x1550(%rbp), %rsi
movb -0x155a(%rbp), %al
movb -0x1559(%rbp), %cl
movzbl %cl, %ecx
movzbl %al, %r8d
leaq -0x20(%rbp), %rdi
leaq -0xd00(%rbp), %r9
callq 0x2e980
jmp 0x93a1
leaq -0xd18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0xd00(%rbp), %rdx
callq 0x2e9e0
jmp 0x93ba
leaq -0xd18(%rbp), %rdi
callq 0x2eb90
cmpq $0x0, %rax
jne 0x9417
movq 0xa7be5(%rip), %rdi     # 0xb0fb8
leaq 0x46719(%rip), %rsi     # 0x4faf3
callq 0x5350
jmp 0x93e1
leaq -0x2d0(%rbp), %rdi
callq 0xa060
jmp 0x93ef
jmp 0x94d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
leaq -0xd18(%rbp), %rdi
callq 0x2ebf0
jmp 0x9aa4
movq 0xa7b9a(%rip), %rdi     # 0xb0fb8
leaq 0x466e8(%rip), %rsi     # 0x4fb0d
callq 0x5350
jmp 0x942c
leaq -0x2d0(%rbp), %rdi
callq 0xa060
jmp 0x943a
leaq -0xd18(%rbp), %rax
movq %rax, -0xd20(%rbp)
movq -0xd20(%rbp), %rdi
callq 0x2e810
movq %rax, -0xd28(%rbp)
movq -0xd20(%rbp), %rdi
callq 0x2e840
movq %rax, -0xd30(%rbp)
leaq -0xd28(%rbp), %rdi
leaq -0xd30(%rbp), %rsi
callq 0x2e870
testb $0x1, %al
jne 0x9487
jmp 0x94ce
leaq -0xd28(%rbp), %rdi
callq 0x2e8b0
movq %rax, %rsi
leaq -0xf80(%rbp), %rdi
movq %rdi, -0x1568(%rbp)
callq 0x2e8d0
movq -0x1568(%rbp), %rdi
movq -0xd40(%rbp), %rsi
callq 0x9ef0
jmp 0x94be
jmp 0x94c0
leaq -0xd28(%rbp), %rdi
callq 0x2e910
jmp 0x946e
jmp 0x94d0
leaq -0xd18(%rbp), %rdi
callq 0x2ebf0
movq -0x370(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x370(%rbp)
jmp 0x91e1
movq $0x0, -0x370(%rbp)
movq -0x370(%rbp), %rax
movq %rax, -0x1578(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x2e420
movq %rax, -0x1570(%rbp)
jmp 0x9521
movq -0x1578(%rbp), %rax
movq -0x1570(%rbp), %rcx
cmpq %rcx, %rax
jae 0x9a3c
movq -0x370(%rbp), %rax
leaq -0x320(%rbp,%rax,8), %rdi
callq 0x2e4c0
movq %rax, %rdi
callq 0x2e4e0
movq %rax, -0x1580(%rbp)
jmp 0x955d
movq -0x1580(%rbp), %rax
movq %rax, -0xf88(%rbp)
movq -0x370(%rbp), %rax
leaq -0x320(%rbp,%rax,8), %rdi
callq 0x2e4c0
movq %rax, %rdi
callq 0x2e4f0
movq %rax, -0x1588(%rbp)
jmp 0x9590
movq -0x1588(%rbp), %rax
movq %rax, -0xf90(%rbp)
movq -0xf88(%rbp), %rdi
callq 0x2e5e0
movq %rax, -0x1590(%rbp)
jmp 0x95b3
movq -0xf88(%rbp), %rdi
callq 0x2e5f0
movq %rax, -0x1598(%rbp)
jmp 0x95c8
movq -0xf88(%rbp), %rdi
callq 0x2e610
movb %al, -0x1599(%rbp)
jmp 0x95dc
movq -0xf88(%rbp), %rdi
callq 0x2e630
movb %al, -0x159a(%rbp)
jmp 0x95f0
movq -0x1598(%rbp), %rdx
movq -0x1590(%rbp), %rsi
movb -0x159a(%rbp), %al
movb -0x1599(%rbp), %cl
movq -0x328(%rbp), %r9
movzbl %cl, %ecx
movzbl %al, %r8d
leaq -0x20(%rbp), %rdi
callq 0x2e580
jmp 0x9623
movq -0xf90(%rbp), %rdi
callq 0x2e5e0
movq %rax, -0x15a8(%rbp)
jmp 0x9638
movq -0xf90(%rbp), %rdi
callq 0x2e5f0
movq %rax, -0x15b0(%rbp)
jmp 0x964d
movq -0xf90(%rbp), %rdi
callq 0x2e610
movb %al, -0x15b1(%rbp)
jmp 0x9661
movq -0xf90(%rbp), %rdi
callq 0x2e630
movb %al, -0x15b2(%rbp)
jmp 0x9675
movq -0x15b0(%rbp), %rdx
movq -0x15a8(%rbp), %rsi
movb -0x15b2(%rbp), %al
movb -0x15b1(%rbp), %cl
movq -0x330(%rbp), %r9
movzbl %cl, %ecx
movzbl %al, %r8d
leaq -0x20(%rbp), %rdi
callq 0x2e650
jmp 0x96a8
movq -0x370(%rbp), %rax
leaq -0x320(%rbp,%rax,8), %rdi
callq 0x2e490
movq %rax, -0x30(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x2ec50
movb %al, -0x15b3(%rbp)
jmp 0x96d8
movb -0x15b3(%rbp), %al
andb $0x1, %al
movb %al, -0xf91(%rbp)
testb $0x1, -0xf91(%rbp)
je 0x99fa
leaq 0x46431(%rip), %rsi     # 0x4fb2b
leaq -0x1098(%rbp), %rdi
callq 0xa390
jmp 0x9708
leaq -0x20(%rbp), %rdi
callq 0x2e6e0
movq %rax, -0x15c0(%rbp)
jmp 0x971a
movq -0x15c0(%rbp), %rax
movq %rax, -0x10a0(%rbp)
leaq -0x1098(%rbp), %rdi
leaq -0x10a0(%rbp), %rsi
callq 0xa510
movq %rax, -0x15c8(%rbp)
jmp 0x9744
movq -0x15c8(%rbp), %rsi
leaq -0xfb8(%rbp), %rdi
callq 0xa590
jmp 0x9759
movq 0xa7858(%rip), %rdi     # 0xb0fb8
leaq -0xfb8(%rbp), %rsi
callq 0x52f0
jmp 0x976e
leaq -0xfb8(%rbp), %rdi
callq 0x51e0
leaq -0x1098(%rbp), %rdi
callq 0xa7e0
movq -0xf88(%rbp), %rax
movl 0x40(%rax), %ecx
movl %ecx, -0x290(%rbp)
movaps (%rax), %xmm0
movaps 0x10(%rax), %xmm1
movaps 0x20(%rax), %xmm2
movaps 0x30(%rax), %xmm3
movaps %xmm3, -0x2a0(%rbp)
movaps %xmm2, -0x2b0(%rbp)
movaps %xmm1, -0x2c0(%rbp)
movaps %xmm0, -0x2d0(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x2e5e0
movq %rax, -0x15d0(%rbp)
jmp 0x97d6
movq -0x15d0(%rbp), %rax
movb 0x17(%rax), %cl
incb %cl
movb %cl, 0x17(%rax)
leaq -0x11c0(%rbp), %rdi
callq 0x2e930
leaq -0x2d0(%rbp), %rdi
callq 0x2e5e0
movq %rax, -0x15d8(%rbp)
jmp 0x9806
leaq -0x2d0(%rbp), %rdi
callq 0x2e5f0
movq %rax, -0x15e0(%rbp)
jmp 0x981b
leaq -0x2d0(%rbp), %rdi
callq 0x2e610
movb %al, -0x15e1(%rbp)
jmp 0x982f
leaq -0x2d0(%rbp), %rdi
callq 0x2e630
movb %al, -0x15e2(%rbp)
jmp 0x9843
movq -0x15e0(%rbp), %rdx
movq -0x15d8(%rbp), %rsi
movb -0x15e2(%rbp), %al
movb -0x15e1(%rbp), %cl
movzbl %cl, %ecx
movzbl %al, %r8d
leaq -0x20(%rbp), %rdi
leaq -0x11c0(%rbp), %r9
callq 0x2e980
jmp 0x9876
leaq -0x11d8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x11c0(%rbp), %rdx
callq 0x2e9e0
jmp 0x988f
leaq -0x11d8(%rbp), %rdi
callq 0x2eb90
cmpq $0x0, %rax
jne 0x9933
movq 0xa770c(%rip), %rdi     # 0xb0fb8
leaq 0x46240(%rip), %rsi     # 0x4faf3
callq 0x5350
jmp 0x98ba
leaq -0x2d0(%rbp), %rdi
callq 0xa060
jmp 0x98c8
jmp 0x99ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x98ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
leaq -0xfb8(%rbp), %rdi
callq 0x51e0
leaq -0x1098(%rbp), %rdi
callq 0xa7e0
jmp 0x9aa4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
leaq -0x11d8(%rbp), %rdi
callq 0x2ebf0
jmp 0x9aa4
movq 0xa767e(%rip), %rdi     # 0xb0fb8
leaq 0x461cc(%rip), %rsi     # 0x4fb0d
callq 0x5350
jmp 0x9948
leaq -0x2d0(%rbp), %rdi
callq 0xa060
jmp 0x9956
leaq -0x11d8(%rbp), %rax
movq %rax, -0x11e0(%rbp)
movq -0x11e0(%rbp), %rdi
callq 0x2e810
movq %rax, -0x11e8(%rbp)
movq -0x11e0(%rbp), %rdi
callq 0x2e840
movq %rax, -0x11f0(%rbp)
leaq -0x11e8(%rbp), %rdi
leaq -0x11f0(%rbp), %rsi
callq 0x2e870
testb $0x1, %al
jne 0x99a3
jmp 0x99ea
leaq -0x11e8(%rbp), %rdi
callq 0x2e8b0
movq %rax, %rsi
leaq -0x1440(%rbp), %rdi
movq %rdi, -0x15f0(%rbp)
callq 0x2e8d0
movq -0x15f0(%rbp), %rdi
movq -0x1200(%rbp), %rsi
callq 0x9ef0
jmp 0x99da
jmp 0x99dc
leaq -0x11e8(%rbp), %rdi
callq 0x2e910
jmp 0x998a
jmp 0x99ec
leaq -0x11d8(%rbp), %rdi
callq 0x2ebf0
jmp 0x9a23
movq 0xa75b7(%rip), %rdi     # 0xb0fb8
leaq 0x5d4fb(%rip), %rsi     # 0x66f03
callq 0x5350
jmp 0x9a0f
movq -0x30(%rbp), %rsi
leaq -0x270(%rbp), %rdi
callq 0x9ef0
jmp 0x9a21
jmp 0x9a23
jmp 0x9a25
movq -0x370(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x370(%rbp)
jmp 0x94fe
leaq -0x4a8(%rbp), %rdi
callq 0x2ebf0
leaq -0x320(%rbp), %rax
movq %rax, -0x1600(%rbp)
addq $0x50, %rax
movq %rax, -0x15f8(%rbp)
movq -0x15f8(%rbp), %rdi
addq $-0x8, %rdi
movq %rdi, -0x1608(%rbp)
callq 0x2ec80
movq -0x1600(%rbp), %rcx
movq -0x1608(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x15f8(%rbp)
jne 0x9a61
leaq -0x20(%rbp), %rdi
callq 0x2ecd0
addq $0x1620, %rsp           # imm = 0x1620
popq %rbp
retq
leaq -0x4a8(%rbp), %rdi
callq 0x2ebf0
leaq -0x320(%rbp), %rax
movq %rax, -0x1618(%rbp)
addq $0x50, %rax
movq %rax, -0x1610(%rbp)
movq -0x1610(%rbp), %rdi
addq $-0x8, %rdi
movq %rdi, -0x1620(%rbp)
callq 0x2ec80
movq -0x1618(%rbp), %rcx
movq -0x1620(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x1610(%rbp)
jne 0x9ac9
jmp 0x9afc
leaq -0x20(%rbp), %rdi
callq 0x2ecd0
movq -0x278(%rbp), %rdi
callq 0x5640
nopw %cs:(%rax,%rax)