// File: /workspace/github_cpp_makefile_star2_O1/demon386[P]git-store/main.cpp
// Function: process_write_cmd(boost::program_options::variables_map const&)
void process_write_cmd(const po::variables_map& options) {
    if (!options.count("subargs")) {
        return;
    }
    auto subargs = options["subargs"].as<std::vector<std::string>>();
    if (subargs.size() == 0) {
        return;
    }
    auto subargs_str = boost::algorithm::join(subargs, " ");
    int ret = 0;
    ret = subprocess::run_cmd("git reset --mixed");
    if (ret != 0) {
        return;
    }

    if (subargs.size() == 1 && !fs::is_directory(subargs_str)
            && !options.count("tree")) {
        std::cout << "hashing blob object" << std::endl;
        ret = subprocess::run_cmd("git hash-object -w " + subargs_str);
    } else {
        std::cout << "hashing tree" << std::endl;
        ret = subprocess::run_cmd("git add " + subargs_str);
        if (ret != 0) {
            return;
        }
        ret = subprocess::run_cmd("git write-tree && git reset --mixed");
    }
    if (ret == 0) {
        if (options.count("delete")) {
            // @todo: check file is inside git repo.
            // to avoid accidently delete files under / or things like that.
            subprocess::run_cmd("rm -rf " + subargs_str);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x9341(%rip), %rsi      # 0x36e8b
leaq 0x9341(%rip), %rdx      # 0x36e92
leaq -0x48(%rbp), %rdi
callq 0xf97e
leaq 0x10(%r14), %r13
leaq -0x48(%rbp), %rsi
movq %r13, %rdi
callq 0x2586a
movq %rax, %r15
leaq 0x18(%r14), %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x2db7f
callq 0xb430
cmpq %rbx, %r15
je 0x2df1c
leaq -0x48(%rbp), %rdi
movq %r12, (%rdi)
leaq 0x92f5(%rip), %rsi      # 0x36e8b
leaq 0x92f5(%rip), %rdx      # 0x36e92
callq 0xf97e
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x24f3e
movq %rax, %rdi
callq 0x31577
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x1100e
movq %r13, -0x70(%rbp)
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x2dbd7
callq 0xb430
movq -0x88(%rbp), %r12
movq -0x80(%rbp), %r13
cmpq %r12, %r13
je 0x2df10
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movq (%r12), %rcx
movq 0x8(%r12), %r8
xorl %esi, %esi
xorl %edx, %edx
callq 0xb4f0
addq $0x20, %r12
cmpq %r13, %r12
je 0x2dc5f
leaq 0x588d(%rip), %r14      # 0x334b1
leaq -0x48(%rbp), %r15
movq -0x40(%rbp), %rsi
movl $0x1, %r8d
movq %r15, %rdi
xorl %edx, %edx
movq %r14, %rcx
callq 0xb4f0
movq -0x40(%rbp), %rsi
movq (%r12), %rcx
movq 0x8(%r12), %r8
movq %r15, %rdi
xorl %edx, %edx
callq 0xb4f0
addq $0x20, %r12
cmpq %r13, %r12
jne 0x2dc28
leaq -0x98(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x935a(%rip), %rsi      # 0x36fcc
leaq 0x9364(%rip), %rdx      # 0x36fdd
leaq -0xa8(%rbp), %rdi
callq 0xf97e
leaq -0xa8(%rbp), %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0x2d97b
movl %eax, %r14d
movq (%r15), %rdi
cmpq %r12, %rdi
movq %rbx, %r13
je 0x2dcac
callq 0xb430
testl %r14d, %r14d
jne 0x2defe
movq -0x80(%rbp), %r14
subq -0x88(%rbp), %r14
cmpq $0x20, %r14
jne 0x2dcf3
leaq -0xa8(%rbp), %rdi
movq %r12, (%rdi)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
callq 0xfa18
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
callq 0x28975
cmpl $0x3, %eax
jne 0x2dcfa
xorl %eax, %eax
xorl %r15d, %r15d
jmp 0x2dd38
leaq -0xb8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x92a0(%rip), %rsi      # 0x36fac
leaq 0x929d(%rip), %rdx      # 0x36fb0
leaq -0xc8(%rbp), %rdi
callq 0xf97e
leaq -0xc8(%rbp), %rsi
movq -0x70(%rbp), %rdi
callq 0x2586a
cmpq %r13, %rax
sete %r15b
movb $0x1, %al
testb %al, %al
je 0x2dd51
leaq -0xb8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2dd51
callq 0xb430
cmpq $0x20, %r14
jne 0x2dd68
movq -0xa8(%rbp), %rdi
cmpq %r12, %rdi
je 0x2dd68
callq 0xb430
testb %r15b, %r15b
je 0x2de7a
movq 0x1e240(%rip), %r14     # 0x4bfb8
leaq 0x91fd(%rip), %rsi      # 0x36f7c
movl $0x13, %edx
movq %r14, %rdi
callq 0xb500
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0xb440
movsbl %al, %esi
movq 0x1e20e(%rip), %rdi     # 0x4bfb8
callq 0xb040
movq %rax, %rdi
callq 0xb320
leaq 0x91d2(%rip), %rsi      # 0x36f90
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x1739d
leaq -0x68(%rbp), %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0x2d97b
movl %eax, %r14d
movq (%r15), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2ddf0
callq 0xb430
testl %r14d, %r14d
jne 0x2defe
leaq -0x58(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x91d6(%rip), %rsi      # 0x36fde
leaq 0x91d5(%rip), %rdx      # 0x36fe4
leaq -0x68(%rbp), %rdi
callq 0xf97e
leaq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdi
callq 0x2586a
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r14, %rdi
je 0x2de36
callq 0xb430
cmpq %r13, %rbx
je 0x2defe
leaq 0x919f(%rip), %rsi      # 0x36fe5
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x1739d
leaq -0x68(%rbp), %rbx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x2d97b
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x2defe
callq 0xb430
jmp 0x2defe
movq 0x1e137(%rip), %r14     # 0x4bfb8
leaq 0x911c(%rip), %rsi      # 0x36fa4
movl $0xc, %edx
movq %r14, %rdi
callq 0xb500
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0xb440
movsbl %al, %esi
movq 0x1e105(%rip), %rdi     # 0x4bfb8
callq 0xb040
movq %rax, %rdi
callq 0xb320
leaq 0x90ea(%rip), %rsi      # 0x36fb1
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x1739d
leaq -0x68(%rbp), %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0x2d97b
movl %eax, %r14d
movq (%r15), %rdi
leaq -0x58(%rbp), %r12
cmpq %r12, %rdi
je 0x2def9
callq 0xb430
testl %r14d, %r14d
je 0x2df2e
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2df10
callq 0xb430
leaq -0x88(%rbp), %rdi
callq 0xe51e
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x68(%rbp), %rdi
movq %r12, (%rdi)
leaq 0x907e(%rip), %rsi      # 0x36fba
leaq 0x909a(%rip), %rdx      # 0x36fdd
callq 0xf97e
movq %r15, %rdi
movl $0x1, %esi
callq 0x2d97b
movl %eax, %r14d
movq (%r15), %rdi
cmpq %r12, %rdi
jne 0x2ddeb
jmp 0x2ddf0
jmp 0x2dfd5
jmp 0x2dfd5
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0x2df9c
callq 0xb430
jmp 0x2df9c
jmp 0x2df99
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r14, %rdi
jne 0x2dfa8
jmp 0x2dfd8
jmp 0x2dfd5
jmp 0x2dfd5
jmp 0x2dfd5
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r12, %rdi
je 0x2dfd8
callq 0xb430
jmp 0x2dfd8
jmp 0x2dfd5
jmp 0x2dfd5
jmp 0x2dfd5
jmp 0x2dfd5
jmp 0x2dfbb
jmp 0x2dfc0
movq %rax, %rbx
jmp 0x2dff6
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x2dff6
callq 0xb430
jmp 0x2dff6
jmp 0x2dfd5
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2dfea
callq 0xb430
leaq -0x88(%rbp), %rdi
callq 0xe51e
movq %rbx, %rdi
callq 0xb7f0