// File: /workspace/github_cpp_makefile_star2_O2/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 $0xd8, %rsp
movl %esi, %ebx
movq %rdi, -0x30(%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), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movaps %xmm0, -0x60(%rbp)
andq $0x0, -0x50(%rbp)
leaq 0xf7f2(%rip), %rsi      # 0x14115
leaq -0x80(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x5542
movl %ebx, -0x3c(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x60(%rbp), %rsi
pushq $0x1
popq %rdx
callq 0x4764
leaq -0xf0(%rbp), %r13
leaq -0x80(%rbp), %r15
movq %r15, %rdi
callq 0x41a0
movq -0x60(%rbp), %r12
movq -0x58(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0xc8(%rbp), %r14
leaq -0xa8(%rbp), %rbx
cmpq -0x38(%rbp), %r12
je 0x49e7
movq %r14, %rdi
leaq 0xf7a0(%rip), %rsi      # 0x14123
pushq $0x10
popq %rdx
callq 0x56ce
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
leaq 0xf7b4(%rip), %rcx      # 0x1414f
xorl %r8d, %r8d
callq 0x567d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4410
movq %r15, %rdi
callq 0x41a0
movq %r14, %rdi
callq 0x5738
movw $0x1, -0x88(%rbp)
leaq -0x100(%rbp), %rdi
movq %rbx, %rsi
callq 0x12c70
movq %rax, %rdi
movq %rbx, %rsi
callq 0x575c
addq $0x20, %r12
jmp 0x4973
cmpb $0x0, -0x3c(%rbp)
je 0x4a74
xorps %xmm0, %xmm0
movq -0x30(%rbp), %rax
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq %r13, %rbx
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x4a34
cmpb $0x1, 0x48(%rbx)
jne 0x4a03
leaq 0x28(%rbx), %rsi
movq -0x30(%rbp), %rdi
callq 0x5780
jmp 0x4a03
cmpb $0x0, 0x48(%r13)
jne 0x4a34
leaq 0x28(%r13), %rsi
movq -0x30(%rbp), %rdi
callq 0x5780
movq (%r13), %r13
testq %r13, %r13
jne 0x4a20
leaq -0x60(%rbp), %rdi
callq 0x5652
leaq -0xa8(%rbp), %rdi
callq 0x41a0
leaq -0x100(%rbp), %rdi
callq 0x59d8
movq -0x30(%rbp), %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf6b6(%rip), %rsi      # 0x14131
leaq -0x80(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x5542
leaq -0x80(%rbp), %rdi
leaq -0x60(%rbp), %rsi
pushq $0x1
popq %rdx
callq 0x4764
leaq -0x80(%rbp), %r14
movq %r14, %rdi
callq 0x41a0
movq -0x60(%rbp), %r15
movq -0x58(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0xc8(%rbp), %rbx
leaq -0x100(%rbp), %r12
cmpq -0x38(%rbp), %r15
je 0x49f1
movq %rbx, %rdi
leaq 0xf64e(%rip), %rsi      # 0x14123
pushq $0x10
popq %rdx
callq 0x56ce
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
leaq 0xf662(%rip), %rcx      # 0x1414f
xorl %r8d, %r8d
callq 0x567d
movq %r15, %rdi
movq %r14, %rsi
callq 0x4410
movq %r14, %rdi
callq 0x41a0
movq %rbx, %rdi
callq 0x5738
movq %r15, %rdi
pushq $0x2f
popq %rsi
xorl %edx, %edx
callq 0x4470
leaq 0x1(%rax), %rdx
movq 0x8(%r15), %rcx
movq %r14, %rdi
movq %r15, %rsi
callq 0x4340
movq %r15, %rdi
movq %r14, %rsi
callq 0x4410
movq %r14, %rdi
callq 0x41a0
movq %r12, %rdi
movq %r15, %rsi
callq 0x13138
testq %rax, %rax
jne 0x4b83
leaq -0xa8(%rbp), %rdi
movq %r15, %rsi
callq 0x41f0
movb $0x0, -0x88(%rbp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x12c70
movq %rax, %rdi
leaq -0xa8(%rbp), %rsi
callq 0x575c
movq %r12, %rdi
movq %r15, %rsi
callq 0x12c70
movb $0x1, 0x21(%rax)
addq $0x20, %r15
jmp 0x4ac1
jmp 0x4b9f
jmp 0x4bda
movq %rax, %r14
leaq -0x80(%rbp), %rdi
callq 0x41a0
jmp 0x4bdd
jmp 0x4bda
jmp 0x4bc7
jmp 0x4bda
jmp 0x4bda
jmp 0x4bb7
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x57bc
jmp 0x4bdd
jmp 0x4bda
movq %rax, %r14
leaq -0xc8(%rbp), %rdi
callq 0x5738
jmp 0x4bdd
jmp 0x4bda
movq %rax, %r14
leaq -0x60(%rbp), %rdi
callq 0x5652
leaq -0xa8(%rbp), %rdi
callq 0x41a0
leaq -0x100(%rbp), %rdi
callq 0x59d8
movq %r14, %rdi
callq 0x45a0