// File: 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
subq $0x290, %rsp            # imm = 0x290
movq %rdi, -0x228(%rbp)
movb %sil, %al
movq %rdi, %rcx
movq %rcx, -0x220(%rbp)
movq %rdi, -0x8(%rbp)
andb $0x1, %al
movb %al, -0x9(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x7770
leaq -0x70(%rbp), %rdi
callq 0x7790
leaq -0x88(%rbp), %rdi
callq 0x72e0
leaq -0xa9(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x5790
movq -0x218(%rbp), %rdx
leaq 0x3149e(%rip), %rsi     # 0x371a5
leaq -0xa8(%rbp), %rdi
callq 0x7330
jmp 0x5d15
leaq -0xa8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movl $0x1, %edx
callq 0x59b0
jmp 0x5d2f
leaq -0xa8(%rbp), %rdi
callq 0x52c0
leaq -0xa9(%rbp), %rdi
callq 0x54b0
leaq -0x88(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x73e0
movq %rax, -0xd0(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x7410
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x7440
testb $0x1, %al
jne 0x5d97
jmp 0x5ef1
leaq -0xd0(%rbp), %rdi
callq 0x7480
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x230(%rbp)
leaq 0x313f4(%rip), %rsi     # 0x371b3
leaq -0x120(%rbp), %rdi
movl $0x10, %edx
callq 0x7890
jmp 0x5dd2
movq -0x230(%rbp), %rsi
leaq 0x313ff(%rip), %rcx     # 0x371df
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rdx
xorl %r8d, %r8d
callq 0x77b0
jmp 0x5df8
leaq -0x70(%rbp), %rdi
movq %rdi, -0x240(%rbp)
leaq -0x100(%rbp), %rsi
movq %rsi, -0x248(%rbp)
callq 0x5570
movq -0x248(%rbp), %rdi
callq 0x52c0
leaq -0x120(%rbp), %rdi
callq 0x7930
movq -0x240(%rbp), %rsi
movb $0x1, -0x50(%rbp)
movb $0x0, -0x4f(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x7960
movq %rax, -0x238(%rbp)
jmp 0x5e4f
movq -0x238(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x7990
jmp 0x5e61
jmp 0x5e63
leaq -0xd0(%rbp), %rdi
callq 0x74a0
jmp 0x5d7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x5ea6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x52c0
leaq -0xa9(%rbp), %rdi
callq 0x54b0
jmp 0x636d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x636d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x7930
jmp 0x636d
testb $0x1, -0x9(%rbp)
jne 0x61c0
leaq -0x141(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x5790
movq -0x250(%rbp), %rdx
leaq 0x312a5(%rip), %rsi     # 0x371c1
leaq -0x140(%rbp), %rdi
callq 0x7330
jmp 0x5f2a
leaq -0x140(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movl $0x1, %edx
callq 0x59b0
jmp 0x5f44
leaq -0x140(%rbp), %rdi
callq 0x52c0
leaq -0x141(%rbp), %rdi
callq 0x54b0
leaq -0x88(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rdi
callq 0x73e0
movq %rax, -0x158(%rbp)
movq -0x150(%rbp), %rdi
callq 0x7410
movq %rax, -0x160(%rbp)
leaq -0x158(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x7440
testb $0x1, %al
jne 0x5fac
jmp 0x61be
leaq -0x158(%rbp), %rdi
callq 0x7480
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq 0x311df(%rip), %rsi     # 0x371b3
leaq -0x1a8(%rbp), %rdi
movl $0x10, %edx
callq 0x7890
jmp 0x5fe7
movq -0x258(%rbp), %rsi
leaq 0x311ea(%rip), %rcx     # 0x371df
leaq -0x188(%rbp), %rdi
leaq -0x1a8(%rbp), %rdx
xorl %r8d, %r8d
callq 0x77b0
jmp 0x600d
movq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rsi
movq %rsi, -0x270(%rbp)
callq 0x5570
movq -0x270(%rbp), %rdi
callq 0x52c0
leaq -0x1a8(%rbp), %rdi
callq 0x7930
movq -0x168(%rbp), %rdi
movq %rdi, -0x268(%rbp)
xorl %eax, %eax
movl %eax, %edx
movl $0x2f, %esi
callq 0x55e0
incq %rax
movq %rax, -0x260(%rbp)
movq -0x168(%rbp), %rdi
callq 0x5340
movq -0x268(%rbp), %rsi
movq -0x260(%rbp), %rdx
movq %rax, %rcx
leaq -0x1c8(%rbp), %rdi
callq 0x5450
jmp 0x6090
movq -0x168(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
movq %rsi, -0x280(%rbp)
callq 0x5570
movq -0x280(%rbp), %rdi
callq 0x52c0
movq -0x168(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x79d0
movq %rax, -0x278(%rbp)
jmp 0x60cf
movq -0x278(%rbp), %rax
cmpq $0x0, %rax
jne 0x6189
movq -0x168(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x5060
jmp 0x60f2
movb $0x0, -0x50(%rbp)
movq -0x168(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x7960
movq %rax, -0x288(%rbp)
jmp 0x610f
movq -0x288(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x7990
jmp 0x6121
jmp 0x6189
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x6155
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x52c0
leaq -0x141(%rbp), %rdi
callq 0x54b0
jmp 0x636d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x7930
jmp 0x636d
movq -0x168(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x7960
movq %rax, -0x290(%rbp)
jmp 0x61a2
movq -0x290(%rbp), %rax
movb $0x1, 0x21(%rax)
leaq -0x158(%rbp), %rdi
callq 0x74a0
jmp 0x5f90
jmp 0x61c0
movq -0x228(%rbp), %rdi
movb $0x0, -0x1c9(%rbp)
callq 0x7a00
leaq -0x48(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x1d8(%rbp), %rdi
callq 0x7a20
movq %rax, -0x1e0(%rbp)
movq -0x1d8(%rbp), %rdi
callq 0x7a50
movq %rax, -0x1e8(%rbp)
leaq -0x1e0(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x7a80
testb $0x1, %al
jne 0x621d
jmp 0x628e
leaq -0x1e0(%rbp), %rdi
callq 0x7ab0
movq %rax, -0x1f0(%rbp)
movq -0x1f0(%rbp), %rax
testb $0x1, 0x40(%rax)
je 0x627b
movq -0x228(%rbp), %rdi
movq -0x1f0(%rbp), %rsi
addq $0x20, %rsi
callq 0x7ae0
jmp 0x6256
jmp 0x627b
movq -0x228(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
callq 0x7b80
jmp 0x636d
jmp 0x627d
leaq -0x1e0(%rbp), %rdi
callq 0x7b50
jmp 0x6204
leaq -0x48(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq -0x1f8(%rbp), %rdi
callq 0x7a20
movq %rax, -0x200(%rbp)
movq -0x1f8(%rbp), %rdi
callq 0x7a50
movq %rax, -0x208(%rbp)
leaq -0x200(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x7a80
testb $0x1, %al
jne 0x62d8
jmp 0x6323
leaq -0x200(%rbp), %rdi
callq 0x7ab0
movq %rax, -0x210(%rbp)
movq -0x210(%rbp), %rax
testb $0x1, 0x40(%rax)
jne 0x6313
movq -0x228(%rbp), %rdi
movq -0x210(%rbp), %rsi
addq $0x20, %rsi
callq 0x7ae0
jmp 0x6311
jmp 0x6313
jmp 0x6315
leaq -0x200(%rbp), %rdi
callq 0x7b50
jmp 0x62bf
movb $0x1, -0x1c9(%rbp)
testb $0x1, -0x1c9(%rbp)
jne 0x633f
movq -0x228(%rbp), %rdi
callq 0x7b80
leaq -0x88(%rbp), %rdi
callq 0x7710
leaq -0x70(%rbp), %rdi
callq 0x7be0
leaq -0x48(%rbp), %rdi
callq 0x7c00
movq -0x220(%rbp), %rax
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
leaq -0x88(%rbp), %rdi
callq 0x7710
leaq -0x70(%rbp), %rdi
callq 0x7be0
leaq -0x48(%rbp), %rdi
callq 0x7c00
movq -0xb8(%rbp), %rdi
callq 0x5780
nopw (%rax,%rax)