// File: fulhax[P]ncpamixer/src/ui/tab.cpp
// Function: Tab::dropDown(int, int, std::map<unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>, unsigned int, unsigned int, unsigned int)
uint32_t Tab::dropDown(
    int x,
    int y,
    std::map<uint32_t, std::string> objects,
    uint32_t current,
    uint32_t width,
    uint32_t height
)
{
    if (objects.empty()) {
        return -1;
    }

    bool autowidth = false;
    bool autoheight = false;

    if (width == 0) {
        autowidth = true;
    }

    if (height == 0) {
        autoheight = true;
    }

    uint32_t selected = 0;

    std::vector<ITEM *> items;
    MENU *menu = 0;
    WINDOW *menu_win = 0;

    for (auto &i : objects) {
        ITEM *item = new_item(i.second.c_str(), nullptr);
        set_item_opts(item, O_SELECTABLE);
        set_item_userptr(item, static_cast<void*>(&i));

        items.push_back(item);

        if (i.first == current) {
            selected = items.size() - 1;
        }

        if (autowidth) {
            width = (width < strlen(i.second.c_str()) + 3) ?
                    strlen(i.second.c_str()) :
                    width;
        }

        if (autoheight) {
            height = (height < 5) ? height + 1 : 5;
        }
    }

    items.push_back(new_item(nullptr, nullptr));
    menu = new_menu(&items[0]);

    if (x < 0) {
        x = ui.width - (width + 2);
    }

    menu_win = newwin(height + 2, width + 2, y, x);
    keypad(menu_win, true);

    set_menu_win(menu, menu_win);
    set_menu_sub(menu, derwin(menu_win, height + 1, width, 1, 1));
    set_menu_format(menu, height, 1);

    wbkgd(menu_win, COLOR_PAIR(COLOR_BORDER));
    //set_menu_back(menu, COLOR_PAIR(7));
    set_menu_fore(menu, COLOR_PAIR(COLOR_DROPDOWN_SELECTED));
    set_menu_grey(menu, COLOR_PAIR(COLOR_DROPDOWN_UNSELECTED));

    //set_menu_mark(menu, "* ");
    set_menu_mark(menu, "");
    menu_opts_on(menu, O_ONEVALUE);
    menu_opts_off(menu, O_SHOWDESC);
    menu_opts_off(menu, O_NONCYCLIC);

    box(menu_win, 0, 0);

    post_menu(menu);
    set_current_item(menu, items[selected]);

    wrefresh(menu_win);

    bool selecting = true;

    while (selecting) {
        int input = wgetch(menu_win);

        if (input == ERR) {
            continue;
        }

#ifdef KEY_MOUSE
        if (input == KEY_MOUSE) {
            MEVENT mevent;
            int ok;

            ok = getmouse(&mevent);
            if (ok != OK) {
                continue;
            }

            if (mevent.bstate & BUTTON1_PRESSED) {
                if (mevent.y < y || mevent.y > y + (int)height + 1 ||
                    mevent.x < x || mevent.x > x + (int)width + 1) {
                    clrtoeol();

                    ITEM *item = current_item(menu);
                    selected = static_cast<std::pair<uint32_t, std::string>*>(
                                   item_userptr(item)
                               )->first;

                    selecting = false;
                    continue;
                }
            }

            if (mevent.y == y || mevent.y == y + (int)height + 1 ||
                mevent.x == x || mevent.x == x + (int)width + 1) {
                continue;
            }

            if (mevent.bstate & BUTTON1_PRESSED) {
                int top = top_row(menu);
                int idx = mevent.y - y - 1 + top;
                ITEM** its = menu_items(menu);
                int itc = item_count(menu);
                if (idx < itc) {
                    ITEM* item = its[idx];
                    set_current_item(menu, item);
                    selected = static_cast<std::pair<uint32_t, std::string>*>(
                                   item_userptr(item)
                               )->first;
                }

                selecting = false;
                continue;
            }
#if NCURSES_MOUSE_VERSION > 1
            else if (mevent.bstate & BUTTON4_PRESSED) {
                menu_driver(menu, REQ_UP_ITEM);
            } else if (mevent.bstate & BUTTON5_PRESSED) {
                menu_driver(menu, REQ_DOWN_ITEM);
            }
#endif
        }
#endif

        if (input == KEY_RESIZE) {
            selecting = false;
            continue;
        }

        std::string key = std::to_string(input);
        
        std::string event = config.getString(("keycode." +  key).c_str(), "unbound");

        if (!strcmp("unbound", event.c_str())) {
            continue;
        }

        if (!strcmp("select", event.c_str())) {
            clrtoeol();

            ITEM *item = current_item(menu);
            selected = static_cast<std::pair<uint32_t, std::string>*>(
                            item_userptr(item)
                       )->first;

            selecting = false;
        } else if (!strcmp("move_down", event.c_str())) {
            menu_driver(menu, REQ_DOWN_ITEM);
        } else if (!strcmp("move_up", event.c_str())) {
            menu_driver(menu, REQ_UP_ITEM);
        } else if (!strcmp("page_up", event.c_str())) {
            menu_driver(menu, REQ_SCR_UPAGE);
        } else if (!strcmp("page_down", event.c_str())) {
            menu_driver(menu, REQ_SCR_DPAGE);
        } else if (!strcmp("quit", event.c_str())) {
            selecting = false;
        }

        wrefresh(menu_win);
    }

    unpost_menu(menu);
    free_menu(menu);

    for (auto i : items) {
        if (i != nullptr)
            free_item(i);
    }

    items.clear();
    refresh();

    return selected;
}

// Assembly:
subq $0x248, %rsp            # imm = 0x248
movq %rdx, 0xa8(%rsp)
movl %edi, %eax
movq 0xa8(%rsp), %rdi
movq %rdi, 0xb0(%rsp)
movl %eax, 0x240(%rsp)
movl %esi, 0x23c(%rsp)
movq %rdi, 0x230(%rsp)
movl %ecx, 0x22c(%rsp)
movl %r8d, 0x228(%rsp)
movl %r9d, 0x224(%rsp)
callq 0x1b560
testb $0x1, %al
jne 0x19fc9
jmp 0x19fd9
movl $0xffffffff, 0x244(%rsp) # imm = 0xFFFFFFFF
jmp 0x1ac35
movb $0x0, 0x223(%rsp)
movb $0x0, 0x222(%rsp)
cmpl $0x0, 0x228(%rsp)
jne 0x19ffb
movb $0x1, 0x223(%rsp)
cmpl $0x0, 0x224(%rsp)
jne 0x1a00d
movb $0x1, 0x222(%rsp)
movl $0x0, 0x21c(%rsp)
leaq 0x200(%rsp), %rdi
callq 0x1b580
movq 0xb0(%rsp), %rax
movq $0x0, 0x1f8(%rsp)
movq $0x0, 0x1f0(%rsp)
movq %rax, 0x1e8(%rsp)
movq 0x1e8(%rsp), %rdi
callq 0x1b590
movq %rax, 0x1e0(%rsp)
movq 0x1e8(%rsp), %rdi
callq 0x1b5c0
movq %rax, 0x1d8(%rsp)
leaq 0x1e0(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x1b5f0
testb $0x1, %al
jne 0x1a095
jmp 0x1a247
leaq 0x1e0(%rsp), %rdi
callq 0x1b610
movq %rax, 0x1d0(%rsp)
movq 0x1d0(%rsp), %rdi
addq $0x8, %rdi
callq 0x72e0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x76d0
movq %rax, 0xa0(%rsp)
jmp 0x1a0d1
movq 0xa0(%rsp), %rax
movq %rax, 0x1c8(%rsp)
movq 0x1c8(%rsp), %rdi
movl $0x1, %esi
callq 0x7d60
jmp 0x1a0f5
movq 0x1c8(%rsp), %rdi
movq 0x1d0(%rsp), %rsi
callq 0x72b0
jmp 0x1a10c
leaq 0x200(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x1b630
jmp 0x1a123
movq 0x1d0(%rsp), %rax
movl (%rax), %eax
cmpl 0x22c(%rsp), %eax
jne 0x1a169
leaq 0x200(%rsp), %rdi
callq 0x1b6a0
subq $0x1, %rax
movl %eax, 0x21c(%rsp)
jmp 0x1a169
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0x1ac26
testb $0x1, 0x223(%rsp)
je 0x1a1f0
movl 0x228(%rsp), %eax
movq %rax, 0x98(%rsp)
movq 0x1d0(%rsp), %rdi
addq $0x8, %rdi
callq 0x72e0
movq %rax, %rdi
callq 0x7310
movq %rax, %rcx
movq 0x98(%rsp), %rax
addq $0x3, %rcx
cmpq %rcx, %rax
jae 0x1a1d2
movq 0x1d0(%rsp), %rdi
addq $0x8, %rdi
callq 0x72e0
movq %rax, %rdi
callq 0x7310
movq %rax, 0x90(%rsp)
jmp 0x1a1e1
movl 0x228(%rsp), %eax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
movl %eax, 0x228(%rsp)
testb $0x1, 0x222(%rsp)
je 0x1a233
cmpl $0x5, 0x224(%rsp)
jae 0x1a217
movl 0x224(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x1a225
movl $0x5, %eax
movl %eax, 0x8c(%rsp)
jmp 0x1a225
movl 0x8c(%rsp), %eax
movl %eax, 0x224(%rsp)
jmp 0x1a235
leaq 0x1e0(%rsp), %rdi
callq 0x1b6c0
jmp 0x1a077
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x76d0
movq %rax, 0x80(%rsp)
jmp 0x1a25d
movq 0x80(%rsp), %rax
movq %rax, 0x1b0(%rsp)
leaq 0x200(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x1b6f0
jmp 0x1a284
xorl %eax, %eax
movl %eax, %esi
leaq 0x200(%rsp), %rdi
callq 0x1b720
movq %rax, %rdi
callq 0x7410
movq %rax, 0x78(%rsp)
jmp 0x1a2a4
movq 0x78(%rsp), %rax
movq %rax, 0x1f8(%rsp)
cmpl $0x0, 0x240(%rsp)
jge 0x1a2d8
leaq 0x11636(%rip), %rax     # 0x2b8f8
movl 0x8(%rax), %eax
movl 0x228(%rsp), %ecx
addl $0x2, %ecx
subl %ecx, %eax
movl %eax, 0x240(%rsp)
movl 0x224(%rsp), %edi
addl $0x2, %edi
movl 0x228(%rsp), %esi
addl $0x2, %esi
movl 0x23c(%rsp), %edx
movl 0x240(%rsp), %ecx
callq 0x76e0
movq %rax, 0x70(%rsp)
jmp 0x1a306
movq 0x70(%rsp), %rax
movq %rax, 0x1f0(%rsp)
movq 0x1f0(%rsp), %rdi
movl $0x1, %esi
callq 0x7270
jmp 0x1a327
movq 0x1f8(%rsp), %rdi
movq 0x1f0(%rsp), %rsi
callq 0x7490
jmp 0x1a33e
movq 0x1f8(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x1f0(%rsp), %rdi
movl 0x224(%rsp), %esi
incl %esi
movl 0x228(%rsp), %edx
movl $0x1, %r8d
movl %r8d, %ecx
callq 0x7550
movq %rax, 0x68(%rsp)
jmp 0x1a378
movq 0x68(%rsp), %rsi
movq 0x60(%rsp), %rdi
callq 0x70b0
jmp 0x1a389
movq 0x1f8(%rsp), %rdi
movl 0x224(%rsp), %esi
movl $0x1, %edx
callq 0x7870
jmp 0x1a3a4
movq 0x1f0(%rsp), %rdi
movl $0xd00, %esi            # imm = 0xD00
callq 0x7b90
jmp 0x1a3b8
movq 0x1f8(%rsp), %rdi
movl $0xb00, %esi            # imm = 0xB00
callq 0x7200
jmp 0x1a3cc
movq 0x1f8(%rsp), %rdi
movl $0xc00, %esi            # imm = 0xC00
callq 0x7120
jmp 0x1a3e0
movq 0x1f8(%rsp), %rdi
leaq 0x610c(%rip), %rsi      # 0x204fb
callq 0x72a0
jmp 0x1a3f6
movq 0x1f8(%rsp), %rdi
movl $0x1, %esi
callq 0x7d00
jmp 0x1a40a
movq 0x1f8(%rsp), %rdi
movl $0x2, %esi
callq 0x7c60
jmp 0x1a41e
movq 0x1f8(%rsp), %rdi
movl $0x20, %esi
callq 0x7c60
jmp 0x1a432
movq 0x1f0(%rsp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x7cf0
jmp 0x1a445
movq 0x1f8(%rsp), %rdi
callq 0x79c0
jmp 0x1a454
movq 0x1f8(%rsp), %rax
movq %rax, 0x58(%rsp)
movl 0x21c(%rsp), %eax
movl %eax, %esi
leaq 0x200(%rsp), %rdi
callq 0x1b720
movq 0x58(%rsp), %rdi
movq (%rax), %rsi
callq 0x7130
jmp 0x1a486
movq 0x1f0(%rsp), %rdi
callq 0x77b0
jmp 0x1a495
movb $0x1, 0x1af(%rsp)
testb $0x1, 0x1af(%rsp)
je 0x1ab32
movq 0x1f0(%rsp), %rdi
callq 0x7260
movl %eax, 0x54(%rsp)
jmp 0x1a4be
movl 0x54(%rsp), %eax
movl %eax, 0x1a8(%rsp)
cmpl $-0x1, 0x1a8(%rsp)
jne 0x1a4d5
jmp 0x1a49d
cmpl $0x199, 0x1a8(%rsp) # imm = 0x199
jne 0x1a79f
leaq 0x194(%rsp), %rdi
callq 0x7b50
movl %eax, 0x50(%rsp)
jmp 0x1a4f9
movl 0x50(%rsp), %eax
movl %eax, 0x190(%rsp)
cmpl $0x0, 0x190(%rsp)
je 0x1a510
jmp 0x1a49d
movl 0x1a4(%rsp), %eax
andq $0x2, %rax
cmpq $0x0, %rax
je 0x1a5e0
movl 0x19c(%rsp), %eax
cmpl 0x23c(%rsp), %eax
jl 0x1a57d
movl 0x19c(%rsp), %eax
movl 0x23c(%rsp), %ecx
addl 0x224(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jg 0x1a57d
movl 0x198(%rsp), %eax
cmpl 0x240(%rsp), %eax
jl 0x1a57d
movl 0x198(%rsp), %eax
movl 0x240(%rsp), %ecx
addl 0x228(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jle 0x1a5de
movq 0x10a14(%rip), %rax     # 0x2af98
movq (%rax), %rdi
callq 0x7720
jmp 0x1a58e
movq 0x1f8(%rsp), %rdi
callq 0x7a70
movq %rax, 0x48(%rsp)
jmp 0x1a5a2
movq 0x48(%rsp), %rax
movq %rax, 0x188(%rsp)
movq 0x188(%rsp), %rdi
callq 0x7ae0
movq %rax, 0x40(%rsp)
jmp 0x1a5c3
movq 0x40(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x21c(%rsp)
movb $0x0, 0x1af(%rsp)
jmp 0x1a49d
jmp 0x1a5e0
movl 0x19c(%rsp), %eax
cmpl 0x23c(%rsp), %eax
je 0x1a638
movl 0x19c(%rsp), %eax
movl 0x23c(%rsp), %ecx
addl 0x224(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
je 0x1a638
movl 0x198(%rsp), %eax
cmpl 0x240(%rsp), %eax
je 0x1a638
movl 0x198(%rsp), %eax
movl 0x240(%rsp), %ecx
addl 0x228(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1a63d
jmp 0x1a49d
movl 0x1a4(%rsp), %eax
andq $0x2, %rax
cmpq $0x0, %rax
je 0x1a747
movq 0x1f8(%rsp), %rdi
callq 0x7910
movl %eax, 0x3c(%rsp)
jmp 0x1a665
movl 0x3c(%rsp), %eax
movl %eax, 0x184(%rsp)
movl 0x19c(%rsp), %edx
movl 0x23c(%rsp), %eax
subl %eax, %edx
movl 0x184(%rsp), %eax
movl %eax, %ecx
movl %edx, %eax
leal -0x1(%rax,%rcx), %eax
movl %eax, 0x180(%rsp)
movq 0x1f8(%rsp), %rdi
callq 0x71a0
movq %rax, 0x30(%rsp)
jmp 0x1a6aa
movq 0x30(%rsp), %rax
movq %rax, 0x178(%rsp)
movq 0x1f8(%rsp), %rdi
callq 0x7350
movl %eax, 0x2c(%rsp)
jmp 0x1a6ca
movl 0x2c(%rsp), %eax
movl %eax, 0x174(%rsp)
movl 0x180(%rsp), %eax
cmpl 0x174(%rsp), %eax
jge 0x1a73a
movq 0x178(%rsp), %rax
movslq 0x180(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x168(%rsp)
movq 0x1f8(%rsp), %rdi
movq 0x168(%rsp), %rsi
callq 0x7130
jmp 0x1a718
movq 0x168(%rsp), %rdi
callq 0x7ae0
movq %rax, 0x20(%rsp)
jmp 0x1a72c
movq 0x20(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x21c(%rsp)
movb $0x0, 0x1af(%rsp)
jmp 0x1a49d
movl 0x1a4(%rsp), %eax
andq $0x10000, %rax          # imm = 0x10000
cmpq $0x0, %rax
je 0x1a770
movq 0x1f8(%rsp), %rdi
movl $0x202, %esi            # imm = 0x202
callq 0x75a0
jmp 0x1a76e
jmp 0x1a79b
movl 0x1a4(%rsp), %eax
andq $0x200000, %rax         # imm = 0x200000
cmpq $0x0, %rax
je 0x1a799
movq 0x1f8(%rsp), %rdi
movl $0x203, %esi            # imm = 0x203
callq 0x75a0
jmp 0x1a797
jmp 0x1a799
jmp 0x1a79b
jmp 0x1a79d
jmp 0x1a79f
cmpl $0x19a, 0x1a8(%rsp) # imm = 0x19A
jne 0x1a7b9
movb $0x0, 0x1af(%rsp)
jmp 0x1a49d
movl 0x1a8(%rsp), %esi
leaq 0x148(%rsp), %rdi
callq 0x10a50
jmp 0x1a7cf
leaq 0x712d(%rip), %rsi      # 0x21903
leaq 0x108(%rsp), %rdi
leaq 0x148(%rsp), %rdx
callq 0x170b0
jmp 0x1a7ed
leaq 0x108(%rsp), %rdi
callq 0x72e0
movq %rax, 0x10(%rsp)
leaq 0xe7(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x7c50
movq 0x18(%rsp), %rdx
leaq 0x70d3(%rip), %rsi      # 0x218f0
leaq 0xe8(%rsp), %rdi
callq 0x10940
jmp 0x1a82c
movq 0x10(%rsp), %rdx
leaq 0x11068(%rip), %rsi     # 0x2b8a0
leaq 0x128(%rsp), %rdi
leaq 0xe8(%rsp), %rcx
callq 0x10150
jmp 0x1a84f
leaq 0xe8(%rsp), %rdi
callq 0x7480
leaq 0xe7(%rsp), %rdi
callq 0x7760
leaq 0x108(%rsp), %rdi
callq 0x7480
leaq 0x128(%rsp), %rdi
callq 0x72e0
movq %rax, %rsi
leaq 0x7063(%rip), %rdi      # 0x218f0
callq 0x7980
cmpl $0x0, %eax
jne 0x1a916
movl $0x4, 0xe0(%rsp)
jmp 0x1aaef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0x1ab20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0x1a8f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x7480
leaq 0xe7(%rsp), %rdi
callq 0x7760
leaq 0x108(%rsp), %rdi
callq 0x7480
jmp 0x1ab20
leaq 0x128(%rsp), %rdi
callq 0x72e0
movq %rax, %rsi
leaq 0x71b4(%rip), %rdi      # 0x21ae1
callq 0x7980
cmpl $0x0, %eax
jne 0x1a9c0
movq 0x10656(%rip), %rax     # 0x2af98
movq (%rax), %rdi
callq 0x7720
jmp 0x1a94c
movq 0x1f8(%rsp), %rdi
callq 0x7a70
movq %rax, 0x8(%rsp)
jmp 0x1a960
movq 0x8(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x7ae0
movq %rax, (%rsp)
jmp 0x1a980
movq (%rsp), %rax
movl (%rax), %eax
movl %eax, 0x21c(%rsp)
movb $0x0, 0x1af(%rsp)
jmp 0x1aad5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0x128(%rsp), %rdi
callq 0x7480
jmp 0x1ab20
leaq 0x128(%rsp), %rdi
callq 0x72e0
movq %rax, %rsi
leaq 0x7026(%rip), %rdi      # 0x219fd
callq 0x7980
cmpl $0x0, %eax
jne 0x1a9fa
movq 0x1f8(%rsp), %rdi
movl $0x203, %esi            # imm = 0x203
callq 0x75a0
jmp 0x1a9f5
jmp 0x1aad3
leaq 0x128(%rsp), %rdi
callq 0x72e0
movq %rax, %rsi
leaq 0x6fe4(%rip), %rdi      # 0x219f5
callq 0x7980
cmpl $0x0, %eax
jne 0x1aa34
movq 0x1f8(%rsp), %rdi
movl $0x202, %esi            # imm = 0x202
callq 0x75a0
jmp 0x1aa2f
jmp 0x1aad1
leaq 0x128(%rsp), %rdi
callq 0x72e0
movq %rax, %rsi
leaq 0x709d(%rip), %rdi      # 0x21ae8
callq 0x7980
cmpl $0x0, %eax
jne 0x1aa6b
movq 0x1f8(%rsp), %rdi
movl $0x207, %esi            # imm = 0x207
callq 0x75a0
jmp 0x1aa69
jmp 0x1aacf
leaq 0x128(%rsp), %rdi
callq 0x72e0
movq %rax, %rsi
leaq 0x706e(%rip), %rdi      # 0x21af0
callq 0x7980
cmpl $0x0, %eax
jne 0x1aaa2
movq 0x1f8(%rsp), %rdi
movl $0x206, %esi            # imm = 0x206
callq 0x75a0
jmp 0x1aaa0
jmp 0x1aacd
leaq 0x128(%rsp), %rdi
callq 0x72e0
movq %rax, %rsi
leaq 0x6e53(%rip), %rdi      # 0x2190c
callq 0x7980
cmpl $0x0, %eax
jne 0x1aacb
movb $0x0, 0x1af(%rsp)
jmp 0x1aacd
jmp 0x1aacf
jmp 0x1aad1
jmp 0x1aad3
jmp 0x1aad5
movq 0x1f0(%rsp), %rdi
callq 0x77b0
jmp 0x1aae4
movl $0x0, 0xe0(%rsp)
leaq 0x128(%rsp), %rdi
callq 0x7480
leaq 0x148(%rsp), %rdi
callq 0x7480
movl 0xe0(%rsp), %eax
testl %eax, %eax
je 0x1ab1b
jmp 0x1ab16
jmp 0x1a49d
jmp 0x1a49d
leaq 0x148(%rsp), %rdi
callq 0x7480
jmp 0x1ac26
movq 0x1f8(%rsp), %rdi
callq 0x7530
jmp 0x1ab41
movq 0x1f8(%rsp), %rdi
callq 0x7230
jmp 0x1ab50
leaq 0x200(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0xd0(%rsp), %rdi
callq 0x1b740
movq %rax, 0xc8(%rsp)
movq 0xd0(%rsp), %rdi
callq 0x1b770
movq %rax, 0xc0(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x1b7a0
testb $0x1, %al
jne 0x1aba5
jmp 0x1abea
leaq 0xc8(%rsp), %rdi
callq 0x1b7e0
movq (%rax), %rax
movq %rax, 0xb8(%rsp)
cmpq $0x0, 0xb8(%rsp)
je 0x1abd9
movq 0xb8(%rsp), %rdi
callq 0x7830
jmp 0x1abd7
jmp 0x1abd9
jmp 0x1abdb
leaq 0xc8(%rsp), %rdi
callq 0x1b7f0
jmp 0x1ab8a
leaq 0x200(%rsp), %rdi
callq 0x1b810
callq 0x7bb0
jmp 0x1abfe
movl 0x21c(%rsp), %eax
movl %eax, 0x244(%rsp)
movl $0x1, 0xe0(%rsp)
leaq 0x200(%rsp), %rdi
callq 0x1b830
jmp 0x1ac35
leaq 0x200(%rsp), %rdi
callq 0x1b830
jmp 0x1ac44
movl 0x244(%rsp), %eax
addq $0x248, %rsp            # imm = 0x248
retq
movq 0x1c0(%rsp), %rdi
callq 0x7c40
nopw %cs:(%rax,%rax)