// File: /workspace/github_cpp_makefile_star2_O3/npazosmendez[P]branchsearch/branchsearch.cpp
// Function: get_branches(bool)
vector<branch_t> get_branches(bool locals_only){
    unordered_map<string, branch_t> branches;
    branch_t branch;
    vector<string> out_lines;

    run_command("git branch -l", &out_lines);
    for(string& branch_name : out_lines){
        branch.name = regex_replace(branch_name, std::regex("(^ +)|(\\* )|\n"), "");
        branch.local = true;
        branch.remote = false;
        branches[branch.name] = branch;
    }

    if(not locals_only){
        run_command("git branch -r", &out_lines);
        for(string& branch_name : out_lines){
            branch_name = regex_replace(branch_name, std::regex("(^ +)|(\\* )|\n"), "");
            // remove remote's name
            branch_name = branch_name.substr(branch_name.find('/')+1, branch_name.size());
            if(!branches.count(branch_name)){
                branch.name = branch_name;
                branch.local = false;
            branches[branch_name] = branch;
            }
            branches[branch_name].remote = true;
        }
    }

    vector<branch_t> res;
    for(auto &key_val : branches) if(key_val.second.local) res.push_back(key_val.second);
    for(auto &key_val : branches) if(!key_val.second.local) res.push_back(key_val.second);
    return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %esi, %ebx
movq %rdi, -0x50(%rbp)
leaq -0xd0(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq -0x98(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movq %rax, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1162e(%rip), %rsi     # 0x16115
leaq 0x11634(%rip), %rdx     # 0x16122
leaq -0x48(%rbp), %rdi
callq 0x658e
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movl $0x1, %edx
callq 0x48d6
movl %ebx, -0x5c(%rbp)
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4b25
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4300
movq -0x80(%rbp), %r15
movq -0x78(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq %rax, %r15
je 0x4c02
leaq -0xc8(%rbp), %r12
leaq -0x48(%rbp), %r14
leaq -0xa8(%rbp), %rbx
movq %r12, %rdi
leaq 0x115cd(%rip), %rsi     # 0x16123
movl $0x10, %edx
callq 0x5dce
leaq -0x38(%rbp), %r13
movq %r13, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movb $0x0, -0x38(%rbp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
movl $0x0, (%rsp)
movq %r14, %rdi
movq %r12, %rcx
leaq 0x115bd(%rip), %r8      # 0x1614f
xorl %r9d, %r9d
callq 0x11e9e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4400
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x4bba
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4300
movq %r12, %rdi
callq 0x5e3a
movw $0x1, -0x88(%rbp)
leaq -0x100(%rbp), %rdi
movq %rbx, %rsi
callq 0x14b82
movq %rax, %r13
movq %rax, %rdi
movq %rbx, %rsi
callq 0x41e0
movzwl -0x88(%rbp), %eax
movw %ax, 0x20(%r13)
addq $0x20, %r15
cmpq -0x58(%rbp), %r15
jne 0x4b4c
cmpb $0x0, -0x5c(%rbp)
jne 0x4da3
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
movq %rax, (%rdi)
leaq 0x11513(%rip), %rsi     # 0x16131
leaq 0x11519(%rip), %rdx     # 0x1613e
callq 0x658e
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movl $0x1, %edx
callq 0x48d6
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4c55
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4300
movq -0x80(%rbp), %r14
movq -0x78(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq %rax, %r14
je 0x4da3
leaq -0xc8(%rbp), %r12
leaq -0x48(%rbp), %r15
leaq -0x100(%rbp), %r13
movq %r12, %rdi
leaq 0x1149d(%rip), %rsi     # 0x16123
movl $0x10, %edx
callq 0x5dce
leaq -0x38(%rbp), %rbx
movq %rbx, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movb $0x0, -0x38(%rbp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movl $0x0, (%rsp)
movq %r15, %rdi
movq %r12, %rcx
leaq 0x1148d(%rip), %r8      # 0x1614f
xorl %r9d, %r9d
callq 0x11e9e
movq %r14, %rdi
movq %r15, %rsi
callq 0x4400
movq -0x48(%rbp), %rdi
cmpq %rbx, %rdi
je 0x4cea
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4300
movq %r12, %rdi
callq 0x5e3a
movq %r14, %rdi
movl $0x2f, %esi
xorl %edx, %edx
callq 0x4450
leaq 0x1(%rax), %rdx
movq 0x8(%r14), %rcx
movq %r15, %rdi
movq %r14, %rsi
callq 0x4330
movq %r14, %rdi
movq %r15, %rsi
callq 0x4400
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4d38
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4300
movq %r13, %rdi
movq %r14, %rsi
callq 0x14ffc
testq %rax, %rax
jne 0x4d86
leaq -0xa8(%rbp), %rdi
movq %r14, %rsi
callq 0x41e0
movb $0x0, -0x88(%rbp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x14b82
movq %rax, %rbx
movq %rax, %rdi
leaq -0xa8(%rbp), %rsi
callq 0x41e0
movzwl -0x88(%rbp), %eax
movw %ax, 0x20(%rbx)
movq %r13, %rdi
movq %r14, %rsi
callq 0x14b82
movb $0x1, 0x21(%rax)
addq $0x20, %r14
cmpq -0x58(%rbp), %r14
jne 0x4c7c
xorps %xmm0, %xmm0
movq -0x50(%rbp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq -0xf0(%rbp), %rbx
testq %rbx, %rbx
je 0x4e00
cmpb $0x1, 0x48(%rbx)
jne 0x4dd4
leaq 0x28(%rbx), %rsi
movq -0x50(%rbp), %rdi
callq 0x5e64
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x4dc1
movq -0xf0(%rbp), %rbx
testq %rbx, %rbx
je 0x4e00
cmpb $0x0, 0x48(%rbx)
jne 0x4dfb
leaq 0x28(%rbx), %rsi
movq -0x50(%rbp), %rdi
callq 0x5e64
movq (%rbx), %rbx
jmp 0x4de3
leaq -0x80(%rbp), %rdi
callq 0x5d60
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x4e2b
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x4300
leaq -0x100(%rbp), %rdi
callq 0x612e
movq -0x50(%rbp), %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4e51
jmp 0x4ebd
movq %rax, %r14
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4ec0
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4300
jmp 0x4ec0
jmp 0x4ebd
jmp 0x4e85
jmp 0x4ebd
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %rbx, %rdi
jne 0x4ea1
jmp 0x4ead
jmp 0x4ebd
movq %rax, %r14
movq -0x50(%rbp), %rdi
callq 0x5ec8
jmp 0x4ec0
jmp 0x4ebd
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x4ead
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4300
leaq -0xc8(%rbp), %rdi
callq 0x5e3a
jmp 0x4ec0
jmp 0x4ebd
movq %rax, %r14
leaq -0x80(%rbp), %rdi
callq 0x5d60
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x4eeb
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x4300
leaq -0x100(%rbp), %rdi
callq 0x612e
movq %r14, %rdi
callq 0x4580