// File: fulhax[P]ncpamixer/src/ui/tab.cpp
// Function: Tab::draw()
void Tab::draw()
{
    if (object == nullptr) {
        return;
    }

    int baseY = 0;
    int current_block = 0;
    int BLOCK_SIZE = getBlockSize();

    total_blocks = (ui.height - 2) / BLOCK_SIZE;
    int blocks_drawn = 0;

    bool more_up = false;
    bool more_down = false;

    for (auto &i : *object) {
        if (current_block <= selected_block - total_blocks) {
            current_block++;
            more_up = true;
            continue;
        }

        if (blocks_drawn >= total_blocks) {
            more_down = true;
            break;
        }

        blocks_drawn++;

        float perc = static_cast<float>(i.second->volume) /
                     (PA_VOLUME_NORM * 1.5f);

        if (has_volume) {
            if (ui.static_bar) {
                volumeBar(ui.width, ui.height, 0, baseY + 3, perc, perc);
            } else {
                volumeBar(ui.width, ui.height, 0, baseY + 3, perc, i.second->peak);
            }
        } else { // Configuration
            if (i.first == selected_index) {
                wattron(ui.window, COLOR_PAIR(COLOR_SELECTED));
            } else {
                wattron(ui.window, COLOR_PAIR(COLOR_DEFAULT));
            }

            if (i.second->active_attribute != nullptr) {
                mvwaddstr(
                    ui.window,
                    baseY + 3,
                    3,
                    i.second->active_attribute->description
                );
                borderBox(ui.width - 2, 2, 1, baseY + 2);
            }

            if (i.first == selected_index) {
                wattroff(ui.window, COLOR_PAIR(COLOR_SELECTED));
            } else {
                wattroff(ui.window, COLOR_PAIR(COLOR_DEFAULT));
            }
        }

        if (current_block == selected_block) {
            wattron(ui.window, COLOR_PAIR(COLOR_SELECTED));
        } else {
            wattron(ui.window, COLOR_PAIR(COLOR_DEFAULT));
        }

        char label[255] = {0};
        std::string app = {0};

        int toggle_len = 0;

        if (toggle != nullptr) {
            auto rel = toggle->find(i.second->getRelation());

            if (rel != toggle->end()) {
                char *name = rel->second->name;

                if (name != nullptr) {
                    unsigned int len = strlen(name);
                    unsigned int sink_pos = ui.width - 1 - len;

                    mvwaddstr(
                        ui.window,
                        baseY + 1,
                        sink_pos,
                        name
                    );

                    toggle_len += strlen(name);
                }
            }
        } else {
            if (i.second->active_attribute != nullptr && has_volume) {
                unsigned int len = strlen(
                                       i.second->active_attribute->description
                                   );

                unsigned int sink_pos = ui.width - 1 - len;

                mvwaddstr(
                    ui.window,
                    baseY + 1,
                    sink_pos,
                    i.second->active_attribute->description
                );

                toggle_len += strlen(i.second->active_attribute->description);
            }
        }

        const char *app_name = i.second->getAppName();

        if (app_name != nullptr && strlen(i.second->getAppName()) > 0) {
            app = std::string(i.second->getAppName()) + ": " +
                  std::string(i.second->name);
        } else {
            app = i.second->name;
        }

        if (i.second->is_default) {
            app = ui.indicator + app;
        }

        bool dots = false;

        while (1) {
            if (has_volume) {
                if (i.second->mute) {
                    snprintf(
                        label,
                        sizeof(label),
                        "%s%s (muted)",
                        app.c_str(),
                        (dots) ? "..." : ""
                    );
                } else {
                    snprintf(
                        label,
                        sizeof(label),
                        "%s%s (%d%%)",
                        app.c_str(),
                        (dots) ? "..." : "",
                        static_cast<int>(perc * (1.5f * 100.f) + 0.1f)
                    );
                }
            } else {
                snprintf(
                    label,
                    sizeof(label),
                    "%s%s",
                    app.c_str(),
                    (dots) ? "..." : ""
                );
            }

            int output_len = strlen(label);
            int volume_len = (has_volume) ? 4 : 1;

            if ((output_len + toggle_len + volume_len) > ui.width) {
                if (app.length() > 0) {
                    app.resize(app.length() - 1);
                } else {
                    break;
                }

                dots = true;
            } else {
                break;
            }
        }

        mvwaddstr(ui.window, baseY + 1, 1, label);

        if (current_block == selected_block) {
            wattroff(ui.window, COLOR_PAIR(COLOR_SELECTED));
        } else {
            wattroff(ui.window, COLOR_PAIR(COLOR_DEFAULT));
        }

        baseY += BLOCK_SIZE;
        current_block++;
    }

    if (more_up) {
        mvwaddstr(
            ui.window,
            0,
            (ui.width / 2) - 4,
            "\u2191\u2191\u2191\u2191"
        );
    }

    if (more_down) {
        mvwaddstr(
            ui.window,
            ui.height - 2,
            (ui.width / 2) - 4,
            "\u2193\u2193\u2193\u2193"
        );
    }
}

// Assembly:
subq $0x328, %rsp            # imm = 0x328
movq %rdi, 0x320(%rsp)
movq 0x320(%rsp), %rax
movq %rax, 0x98(%rsp)
cmpq $0x0, 0x10(%rax)
jne 0x1736b
jmp 0x180eb
movq 0x98(%rsp), %rdi
movl $0x0, 0x31c(%rsp)
movl $0x0, 0x318(%rsp)
callq 0x172e0
movl %eax, 0x314(%rsp)
leaq 0x1455c(%rip), %rax     # 0x2b8f8
movl 0xc(%rax), %eax
subl $0x2, %eax
cltd
idivl 0x314(%rsp)
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x24(%rax)
movl $0x0, 0x310(%rsp)
movb $0x0, 0x30f(%rsp)
movb $0x0, 0x30e(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x300(%rsp)
movq 0x300(%rsp), %rdi
callq 0xd1b0
movq %rax, 0x2f8(%rsp)
movq 0x300(%rsp), %rdi
callq 0xd200
movq %rax, 0x2f0(%rsp)
leaq 0x2f8(%rsp), %rdi
leaq 0x2f0(%rsp), %rsi
callq 0xd1e0
testb $0x1, %al
jne 0x17426
jmp 0x18034
leaq 0x2f8(%rsp), %rdi
callq 0xd360
movq 0x98(%rsp), %rdx
movq %rax, 0x2e8(%rsp)
movl 0x318(%rsp), %eax
movl 0x20(%rdx), %ecx
subl 0x24(%rdx), %ecx
cmpl %ecx, %eax
jg 0x17472
movl 0x318(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x318(%rsp)
movb $0x1, 0x30f(%rsp)
jmp 0x18010
movq 0x98(%rsp), %rcx
movl 0x310(%rsp), %eax
cmpl 0x24(%rcx), %eax
jl 0x17493
movb $0x1, 0x30e(%rsp)
jmp 0x18034
movq 0x98(%rsp), %rax
movl 0x310(%rsp), %ecx
incl %ecx
movl %ecx, 0x310(%rsp)
movq 0x2e8(%rsp), %rcx
movq 0x8(%rcx), %rcx
movl 0x214(%rcx), %ecx
cvtsi2ss %rcx, %xmm0
movss 0xa49e(%rip), %xmm1     # 0x21968
divss %xmm1, %xmm0
movss %xmm0, 0x2e4(%rsp)
testb $0x1, 0x8(%rax)
je 0x17571
leaq 0x14410(%rip), %rax     # 0x2b8f8
testb $0x1, 0x103(%rax)
je 0x1752a
leaq 0x14400(%rip), %rax     # 0x2b8f8
movl 0x8(%rax), %edi
leaq 0x143f6(%rip), %rax     # 0x2b8f8
movl 0xc(%rax), %esi
movl 0x31c(%rsp), %ecx
addl $0x3, %ecx
movss 0x2e4(%rsp), %xmm0
movss 0x2e4(%rsp), %xmm1
xorl %edx, %edx
callq 0x18100
jmp 0x1756c
leaq 0x143c7(%rip), %rax     # 0x2b8f8
movl 0x8(%rax), %edi
leaq 0x143bd(%rip), %rax     # 0x2b8f8
movl 0xc(%rax), %esi
movl 0x31c(%rsp), %ecx
addl $0x3, %ecx
movss 0x2e4(%rsp), %xmm0
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rax
movss 0x228(%rax), %xmm1
xorl %edx, %edx
callq 0x18100
jmp 0x1769a
movq 0x98(%rsp), %rcx
movq 0x2e8(%rsp), %rax
movl (%rax), %eax
cmpl 0xc(%rcx), %eax
jne 0x175a3
leaq 0x14369(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
movl $0xa00, %esi            # imm = 0xA00
xorl %eax, %eax
movl %eax, %edx
callq 0x7360
jmp 0x175bc
leaq 0x1434e(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
movl $0x900, %esi            # imm = 0x900
xorl %eax, %eax
movl %eax, %edx
callq 0x7360
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x230(%rax)
je 0x1764d
leaq 0x1431f(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
movl 0x31c(%rsp), %esi
addl $0x3, %esi
movl $0x3, %edx
callq 0x76f0
cmpl $-0x1, %eax
jne 0x175f8
jmp 0x17627
leaq 0x142f9(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x230(%rax), %rsi
addq $0x107, %rsi            # imm = 0x107
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7220
leaq 0x142ca(%rip), %rax     # 0x2b8f8
movl 0x8(%rax), %edi
subl $0x2, %edi
movl 0x31c(%rsp), %ecx
addl $0x2, %ecx
movl $0x2, %esi
movl $0x1, %edx
callq 0x184b0
movq 0x98(%rsp), %rcx
movq 0x2e8(%rsp), %rax
movl (%rax), %eax
cmpl 0xc(%rcx), %eax
jne 0x1767f
leaq 0x1428d(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
movl $0xa00, %esi            # imm = 0xA00
xorl %eax, %eax
movl %eax, %edx
callq 0x78b0
jmp 0x17698
leaq 0x14272(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
movl $0x900, %esi            # imm = 0x900
xorl %eax, %eax
movl %eax, %edx
callq 0x78b0
jmp 0x1769a
movq 0x98(%rsp), %rcx
movl 0x318(%rsp), %eax
cmpl 0x20(%rcx), %eax
jne 0x176c9
leaq 0x14243(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
movl $0xa00, %esi            # imm = 0xA00
xorl %eax, %eax
movl %eax, %edx
callq 0x7360
jmp 0x176e2
leaq 0x14228(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
movl $0x900, %esi            # imm = 0x900
xorl %eax, %eax
movl %eax, %edx
callq 0x7360
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movups %xmm0, 0x2cf(%rsp)
movaps %xmm0, 0x2c0(%rsp)
movaps %xmm0, 0x2b0(%rsp)
movaps %xmm0, 0x2a0(%rsp)
movaps %xmm0, 0x290(%rsp)
movaps %xmm0, 0x280(%rsp)
movaps %xmm0, 0x270(%rsp)
movaps %xmm0, 0x260(%rsp)
movaps %xmm0, 0x250(%rsp)
movaps %xmm0, 0x240(%rsp)
movaps %xmm0, 0x230(%rsp)
movaps %xmm0, 0x220(%rsp)
movaps %xmm0, 0x210(%rsp)
movaps %xmm0, 0x200(%rsp)
movaps %xmm0, 0x1f0(%rsp)
movaps %xmm0, 0x1e0(%rsp)
movb $0x0, 0x1af(%rsp)
leaq 0x1af(%rsp), %rax
movq %rax, 0x1b0(%rsp)
movq $0x1, 0x1b8(%rsp)
leaq 0x1ae(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x7c50
movq 0x90(%rsp), %rcx
movq 0x1b0(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
leaq 0x1c0(%rsp), %rdi
callq 0x77c0
jmp 0x177cd
leaq 0x1ae(%rsp), %rdi
callq 0x7760
movq 0x98(%rsp), %rax
movl $0x0, 0x198(%rsp)
cmpq $0x0, 0x18(%rax)
je 0x1799d
movq 0x98(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, 0x7c(%rsp)
jmp 0x17824
movq 0x70(%rsp), %rdi
movl 0x7c(%rsp), %eax
movl %eax, 0x18c(%rsp)
leaq 0x18c(%rsp), %rsi
callq 0xd330
movq %rax, 0x68(%rsp)
jmp 0x17848
movq 0x98(%rsp), %rax
movq 0x68(%rsp), %rcx
movq %rcx, 0x190(%rsp)
movq 0x18(%rax), %rdi
callq 0xd200
movq %rax, 0x180(%rsp)
leaq 0x190(%rsp), %rdi
leaq 0x180(%rsp), %rsi
callq 0xd1e0
testb $0x1, %al
jne 0x1788c
jmp 0x17998
leaq 0x190(%rsp), %rdi
callq 0xd230
movq 0x8(%rax), %rax
addq $0x10, %rax
movq %rax, 0x178(%rsp)
cmpq $0x0, 0x178(%rsp)
je 0x17996
movq 0x178(%rsp), %rdi
callq 0x7310
movl %eax, 0x174(%rsp)
leaq 0x14025(%rip), %rax     # 0x2b8f8
movl 0x8(%rax), %edx
movl 0x174(%rsp), %ecx
notl %ecx
addl %edx, %ecx
movl %ecx, 0x170(%rsp)
movq 0x10(%rax), %rdi
movl 0x31c(%rsp), %esi
incl %esi
movl 0x170(%rsp), %edx
callq 0x76f0
movl %eax, 0x64(%rsp)
jmp 0x17907
movl 0x64(%rsp), %eax
cmpl $-0x1, %eax
jne 0x17912
jmp 0x17933
leaq 0x13fdf(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
movq 0x178(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7220
jmp 0x17931
jmp 0x17933
movq 0x178(%rsp), %rdi
callq 0x7310
movq %rax, %rcx
movslq 0x198(%rsp), %rax
addq %rcx, %rax
movl %eax, 0x198(%rsp)
jmp 0x17996
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a0(%rsp)
movl %eax, 0x19c(%rsp)
leaq 0x1ae(%rsp), %rdi
callq 0x7760
jmp 0x180f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a0(%rsp)
movl %eax, 0x19c(%rsp)
jmp 0x18022
jmp 0x17998
jmp 0x17a9e
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x230(%rax)
je 0x17a9c
movq 0x98(%rsp), %rax
testb $0x1, 0x8(%rax)
je 0x17a9c
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x230(%rax), %rdi
addq $0x107, %rdi            # imm = 0x107
callq 0x7310
movl %eax, 0x16c(%rsp)
leaq 0x13f02(%rip), %rax     # 0x2b8f8
movl 0x8(%rax), %edx
movl 0x16c(%rsp), %ecx
notl %ecx
addl %edx, %ecx
movl %ecx, 0x168(%rsp)
movq 0x10(%rax), %rdi
movl 0x31c(%rsp), %esi
incl %esi
movl 0x168(%rsp), %edx
callq 0x76f0
movl %eax, 0x60(%rsp)
jmp 0x17a2a
movl 0x60(%rsp), %eax
cmpl $-0x1, %eax
jne 0x17a35
jmp 0x17a68
leaq 0x13ebc(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x230(%rax), %rsi
addq $0x107, %rsi            # imm = 0x107
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7220
jmp 0x17a66
jmp 0x17a68
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x230(%rax), %rdi
addq $0x107, %rdi            # imm = 0x107
callq 0x7310
movq %rax, %rcx
movslq 0x198(%rsp), %rax
addq %rcx, %rax
movl %eax, 0x198(%rsp)
jmp 0x17a9e
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, 0x58(%rsp)
jmp 0x17aba
movq 0x58(%rsp), %rax
movq %rax, 0x160(%rsp)
cmpq $0x0, 0x160(%rsp)
je 0x17cce
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, 0x50(%rsp)
jmp 0x17af2
movq 0x50(%rsp), %rdi
callq 0x7310
cmpq $0x0, %rax
jbe 0x17cce
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, 0x48(%rsp)
jmp 0x17b22
leaq 0xff(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x7c50
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rdx
leaq 0x100(%rsp), %rdi
callq 0x10940
jmp 0x17b4d
leaq 0x9e48(%rip), %rdx      # 0x2199c
leaq 0x120(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x1b030
jmp 0x17b6b
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rax
addq $0x10, %rax
movq %rax, 0x30(%rsp)
leaq 0xd7(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x7c50
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
leaq 0xd8(%rsp), %rdi
callq 0x10940
jmp 0x17bab
leaq 0x140(%rsp), %rdi
leaq 0x120(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x1af40
jmp 0x17bca
leaq 0x1c0(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x7860
leaq 0x140(%rsp), %rdi
callq 0x7480
leaq 0xd8(%rsp), %rdi
callq 0x7480
leaq 0xd7(%rsp), %rdi
callq 0x7760
leaq 0x120(%rsp), %rdi
callq 0x7480
leaq 0x100(%rsp), %rdi
callq 0x7480
leaq 0xff(%rsp), %rdi
callq 0x7760
jmp 0x17cef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a0(%rsp)
movl %eax, 0x19c(%rsp)
jmp 0x17cbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a0(%rsp)
movl %eax, 0x19c(%rsp)
jmp 0x17caf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a0(%rsp)
movl %eax, 0x19c(%rsp)
jmp 0x17c95
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a0(%rsp)
movl %eax, 0x19c(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x7480
leaq 0xd7(%rsp), %rdi
callq 0x7760
leaq 0x120(%rsp), %rdi
callq 0x7480
leaq 0x100(%rsp), %rdi
callq 0x7480
leaq 0xff(%rsp), %rdi
callq 0x7760
jmp 0x18022
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rsi
addq $0x10, %rsi
leaq 0x1c0(%rsp), %rdi
callq 0x7920
jmp 0x17ced
jmp 0x17cef
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rax
testb $0x1, 0x20e(%rax)
je 0x17d4b
leaq 0x13bed(%rip), %rsi     # 0x2b8f8
addq $0xe0, %rsi
leaq 0xb0(%rsp), %rdi
leaq 0x1c0(%rsp), %rdx
callq 0x1b080
jmp 0x17d29
leaq 0x1c0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x7860
leaq 0xb0(%rsp), %rdi
callq 0x7480
movb $0x0, 0xaf(%rsp)
jmp 0x17d55
movq 0x98(%rsp), %rax
testb $0x1, 0x8(%rax)
je 0x17e48
movq 0x2e8(%rsp), %rax
movq 0x8(%rax), %rax
testb $0x1, 0x218(%rax)
je 0x17dcf
leaq 0x1e0(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x72e0
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movb 0xaf(%rsp), %dl
leaq 0x874f(%rip), %r8       # 0x204fb
leaq 0x9bf9(%rip), %rax      # 0x219ac
testb $0x1, %dl
cmovneq %rax, %r8
movl $0xff, %esi
leaq 0x9bd9(%rip), %rdx      # 0x2199f
movb $0x0, %al
callq 0x7b20
jmp 0x17e46
leaq 0x1e0(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x72e0
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movb 0xaf(%rsp), %dl
leaq 0x86fc(%rip), %r8       # 0x204fb
leaq 0x9ba6(%rip), %rax      # 0x219ac
testb $0x1, %dl
cmovneq %rax, %r8
movss 0x2e4(%rsp), %xmm0
movss 0x9b4e(%rip), %xmm1     # 0x2196c
mulss %xmm1, %xmm0
movss 0x9b46(%rip), %xmm1     # 0x21970
addss %xmm1, %xmm0
cvttss2si %xmm0, %r9d
movl $0xff, %esi
leaq 0x9b71(%rip), %rdx      # 0x219b0
movb $0x0, %al
callq 0x7b20
jmp 0x17e99
leaq 0x1e0(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x72e0
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movb 0xaf(%rsp), %dl
leaq 0x8683(%rip), %r8       # 0x204fb
leaq 0x9b2d(%rip), %rax      # 0x219ac
testb $0x1, %dl
cmovneq %rax, %r8
movl $0xff, %esi
leaq 0x9b2a(%rip), %rdx      # 0x219bc
movb $0x0, %al
callq 0x7b20
leaq 0x1e0(%rsp), %rdi
callq 0x7310
movq %rax, %rcx
movq 0x98(%rsp), %rax
movl %ecx, 0xa8(%rsp)
movb 0x8(%rax), %dl
movl $0x1, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, 0xa4(%rsp)
movl 0xa8(%rsp), %eax
addl 0x198(%rsp), %eax
addl 0xa4(%rsp), %eax
leaq 0x13a0a(%rip), %rcx     # 0x2b8f8
cmpl 0x8(%rcx), %eax
jle 0x17f38
leaq 0x1c0(%rsp), %rdi
callq 0x7a20
cmpq $0x0, %rax
jbe 0x17f2c
leaq 0x1c0(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x7a20
movq 0x10(%rsp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x7930
jmp 0x17f2a
jmp 0x17f2e
jmp 0x17f3f
movb $0x1, 0xaf(%rsp)
jmp 0x17f3a
jmp 0x17f3f
jmp 0x17d53
leaq 0x139b2(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
movl 0x31c(%rsp), %esi
incl %esi
movl $0x1, %edx
callq 0x76f0
movl %eax, 0xc(%rsp)
jmp 0x17f63
movl 0xc(%rsp), %eax
cmpl $-0x1, %eax
jne 0x17f6e
jmp 0x17f8f
leaq 0x13983(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
leaq 0x1e0(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7220
jmp 0x17f8d
jmp 0x17f8f
movq 0x98(%rsp), %rcx
movl 0x318(%rsp), %eax
cmpl 0x20(%rcx), %eax
jne 0x17fc0
leaq 0x1394e(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0xa00, %esi            # imm = 0xA00
callq 0x78b0
jmp 0x17fbe
jmp 0x17fdd
leaq 0x13931(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x900, %esi            # imm = 0x900
callq 0x78b0
jmp 0x17fdb
jmp 0x17fdd
movl 0x314(%rsp), %eax
addl 0x31c(%rsp), %eax
movl %eax, 0x31c(%rsp)
movl 0x318(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x318(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x7480
leaq 0x2f8(%rsp), %rdi
callq 0xd380
jmp 0x17408
leaq 0x1c0(%rsp), %rdi
callq 0x7480
jmp 0x180f3
testb $0x1, 0x30f(%rsp)
je 0x1808a
leaq 0x138b3(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
leaq 0x138a8(%rip), %rax     # 0x2b8f8
movl 0x8(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %edx
subl $0x4, %edx
xorl %esi, %esi
callq 0x76f0
cmpl $-0x1, %eax
jne 0x1806e
jmp 0x1808a
leaq 0x13883(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
leaq 0x9941(%rip), %rsi      # 0x219c1
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7220
testb $0x1, 0x30e(%rsp)
je 0x180eb
leaq 0x1385d(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
leaq 0x13852(%rip), %rax     # 0x2b8f8
movl 0xc(%rax), %esi
subl $0x2, %esi
leaq 0x13845(%rip), %rax     # 0x2b8f8
movl 0x8(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %edx
subl $0x4, %edx
callq 0x76f0
cmpl $-0x1, %eax
jne 0x180cf
jmp 0x180eb
leaq 0x13822(%rip), %rax     # 0x2b8f8
movq 0x10(%rax), %rdi
leaq 0x98ed(%rip), %rsi      # 0x219ce
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7220
addq $0x328, %rsp            # imm = 0x328
retq
movq 0x1a0(%rsp), %rdi
callq 0x7c40