// File: /workspace/github_cpp_makefile_star2_O1/npazosmendez[P]branchsearch/branchsearch.cpp
// Function: print_window(char*, std::vector<branch_t*, std::allocator<branch_t*>>, int)
void print_window(char* regex_value, vector<branch_t*> filtered_branches, int selected_branch){
    erase();

    // selection may be out of range because of new regex
    int lines = filtered_branches.size();
    if(lines && selected_branch >= lines) selected_branch = lines - 1;

    init_pair(1, -1, -1);
    init_pair(2, COLOR_RED, -1);

    // print regex
    printw("regex: %s | %d\n\n", regex_value, lines);

    // print branches
    int i = 0;
    for (; i < filtered_branches.size() && i < max_branch_shown; ++i){
        addstr("  ");
        if(i == selected_branch) attrset(COLOR_PAIR(2));
        addstr(filtered_branches[i]->name.c_str());
        if(filtered_branches[i]->remote && not filtered_branches[i]->local)
            addstr(" [R]");
        addstr("\n");
        if(i == selected_branch) attrset(COLOR_PAIR(1));
    }
    if(i < filtered_branches.size()) addstr("...");

    // marker on selected branch
    if(lines > 0) mvaddstr(selected_branch + 2, 0, ">");
    refresh();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r13d
movq %rsi, %r15
movq %rdi, %r12
callq 0x4360
movq 0x8(%r15), %rbx
subq (%r15), %rbx
shrq $0x3, %rbx
leal -0x1(%rbx), %eax
cmpl %r13d, %ebx
cmovgl %r13d, %eax
cmpl $0x1, %ebx
cmovbl %r13d, %eax
movl %eax, -0x2c(%rbp)
movl $0x1, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4060
movl $0x2, %edi
movl $0x1, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4060
leaq 0x111d6(%rip), %rdi     # 0x1613f
movq %r12, %rsi
movq %rbx, -0x38(%rbp)
movl %ebx, %edx
xorl %eax, %eax
callq 0x42f0
movq 0x8(%r15), %rax
cmpq (%r15), %rax
setne %al
je 0x5066
cmpl $0x0, 0x1a390(%rip)     # 0x1f320
jle 0x5066
movl -0x2c(%rbp), %ebx
negq %rbx
movl $0x1, %r12d
movq 0x1a007(%rip), %r14     # 0x1efb0
leaq (%rbx,%r12), %r13
movq (%r14), %rdi
leaq 0x11199(%rip), %rsi     # 0x16150
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4110
cmpq $0x1, %r13
jne 0x4fd4
movq (%r14), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x4370
movq (%r14), %rdi
movq (%r15), %rax
movq -0x8(%rax,%r12,8), %rax
movq (%rax), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4110
movq (%r15), %rax
movq -0x8(%rax,%r12,8), %rax
cmpb $0x1, 0x21(%rax)
jne 0x5014
cmpb $0x0, 0x20(%rax)
jne 0x5014
movq (%r14), %rdi
leaq 0x11149(%rip), %rsi     # 0x16153
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4110
movq (%r14), %rdi
leaq 0x11130(%rip), %rsi     # 0x1614e
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4110
cmpq $0x1, %r13
jne 0x503b
movq (%r14), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x4370
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x3, %rax
cmpq %r12, %rax
seta %al
jbe 0x5066
leaq 0x1(%r12), %rcx
movslq 0x1a2c6(%rip), %rdx     # 0x1f320
cmpq %rdx, %r12
movq %rcx, %r12
jl 0x4fa9
testb %al, %al
je 0x5085
movq 0x19f3f(%rip), %rax     # 0x1efb0
movq (%rax), %rdi
leaq 0x110dd(%rip), %rsi     # 0x16158
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4110
cmpl $0x0, -0x38(%rbp)
jle 0x50bb
movq 0x19f1e(%rip), %rbx     # 0x1efb0
movq (%rbx), %rdi
movl -0x2c(%rbp), %esi
addl $0x2, %esi
xorl %edx, %edx
callq 0x4340
cmpl $-0x1, %eax
je 0x50bb
movq (%rbx), %rdi
leaq 0x110ab(%rip), %rsi     # 0x1615c
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4110
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4550