// File: /workspace/github_cpp_makefile_star2_O3/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 $0x88, %rsp
movq %rdi, %r14
leaq -0x58(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x9ac5(%rip), %rsi      # 0x36e8b
leaq 0x9ac5(%rip), %rdx      # 0x36e92
leaq -0x68(%rbp), %rdi
callq 0xf8ee
leaq 0x10(%r14), %r13
leaq -0x68(%rbp), %rsi
movq %r13, %rdi
callq 0x2563c
movq %rax, %r15
leaq 0x18(%r14), %rbx
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x2d3fb
callq 0xb430
cmpq %rbx, %r15
je 0x2d73a
leaq -0x68(%rbp), %rdi
movq %r12, (%rdi)
leaq 0x9a79(%rip), %rsi      # 0x36e8b
leaq 0x9a79(%rip), %rdx      # 0x36e92
callq 0xf8ee
leaq -0x68(%rbp), %rsi
movq %r14, %rdi
callq 0x24d1c
movq %rax, %rdi
callq 0x30d53
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x10f46
movq %r13, -0x70(%rbp)
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x2d453
callq 0xb430
movq -0x88(%rbp), %r12
movq -0x80(%rbp), %r13
cmpq %r12, %r13
je 0x2d72e
leaq -0x68(%rbp), %rdi
leaq -0x58(%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 0x2d4db
leaq 0x6011(%rip), %r14      # 0x334b1
leaq -0x68(%rbp), %r15
movq -0x60(%rbp), %rsi
movl $0x1, %r8d
movq %r15, %rdi
xorl %edx, %edx
movq %r14, %rcx
callq 0xb4f0
movq -0x60(%rbp), %rsi
movq (%r12), %rcx
movq 0x8(%r12), %r8
movq %r15, %rdi
xorl %edx, %edx
callq 0xb4f0
addq $0x20, %r12
cmpq %r13, %r12
jne 0x2d4a4
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x9ae1(%rip), %rsi      # 0x36fcc
leaq 0x9aeb(%rip), %rdx      # 0x36fdd
leaq -0x48(%rbp), %rdi
callq 0xf8ee
leaq -0x48(%rbp), %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0x2d1f7
movl %eax, %r14d
movq (%r15), %rdi
cmpq %r12, %rdi
leaq -0x58(%rbp), %r12
movq %rbx, %r13
je 0x2d523
callq 0xb430
testl %r14d, %r14d
jne 0x2d720
movq -0x80(%rbp), %rax
subq -0x88(%rbp), %rax
cmpq $0x20, %rax
jne 0x2d65c
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
movq %rax, (%rdi)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
callq 0xf98c
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x2869d
cmpl $0x3, %eax
jne 0x2d571
xorl %r15d, %r15d
jmp 0x2d5be
leaq -0x98(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x9a29(%rip), %rsi      # 0x36fac
leaq 0x9a26(%rip), %rdx      # 0x36fb0
leaq -0xa8(%rbp), %rdi
callq 0xf8ee
leaq -0xa8(%rbp), %rsi
movq -0x70(%rbp), %rdi
callq 0x2563c
cmpq %r13, %rax
sete %r15b
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x2d5be
callq 0xb430
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2d5d0
callq 0xb430
testb %r15b, %r15b
je 0x2d65c
movq 0x1e9d8(%rip), %r14     # 0x4bfb8
leaq 0x9995(%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 0x1e9a6(%rip), %rdi     # 0x4bfb8
callq 0xb040
movq %rax, %rdi
callq 0xb320
leaq 0x996a(%rip), %rsi      # 0x36f90
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x17287
leaq -0x48(%rbp), %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0x2d1f7
movl %eax, %r14d
movq (%r15), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
jne 0x2d716
jmp 0x2d71b
movq 0x1e955(%rip), %r14     # 0x4bfb8
leaq 0x993a(%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 0x1e923(%rip), %rdi     # 0x4bfb8
callq 0xb040
movq %rax, %rdi
callq 0xb320
leaq 0x9908(%rip), %rsi      # 0x36fb1
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x17287
leaq -0x48(%rbp), %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0x2d1f7
movl %eax, %r14d
movq (%r15), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2d6db
callq 0xb430
testl %r14d, %r14d
jne 0x2d720
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rbx
movq %rbx, (%rdi)
leaq 0x98c8(%rip), %rsi      # 0x36fba
leaq 0x98e4(%rip), %rdx      # 0x36fdd
callq 0xf8ee
movq %r15, %rdi
movl $0x1, %esi
callq 0x2d1f7
movl %eax, %r14d
movq (%r15), %rdi
cmpq %rbx, %rdi
je 0x2d71b
callq 0xb430
testl %r14d, %r14d
je 0x2d74c
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x2d72e
callq 0xb430
leaq -0x88(%rbp), %rdi
callq 0xe470
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
movq %rax, (%rdi)
leaq 0x9880(%rip), %rsi      # 0x36fde
leaq 0x987f(%rip), %rdx      # 0x36fe4
callq 0xf8ee
leaq -0x48(%rbp), %rsi
movq -0x70(%rbp), %rdi
callq 0x2563c
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2d78c
callq 0xb430
cmpq %r13, %rbx
je 0x2d720
leaq 0x984d(%rip), %rsi      # 0x36fe5
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x17287
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x2d1f7
movq (%rbx), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2d720
callq 0xb430
jmp 0x2d720
jmp 0x2d831
jmp 0x2d7f2
jmp 0x2d831
jmp 0x2d831
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x2d7f5
callq 0xb430
jmp 0x2d7f5
jmp 0x2d7f2
jmp 0x2d831
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2d834
callq 0xb430
jmp 0x2d834
jmp 0x2d831
jmp 0x2d831
jmp 0x2d831
jmp 0x2d831
jmp 0x2d831
jmp 0x2d817
jmp 0x2d81c
movq %rax, %rbx
jmp 0x2d852
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x2d852
callq 0xb430
jmp 0x2d852
jmp 0x2d831
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2d846
callq 0xb430
leaq -0x88(%rbp), %rdi
callq 0xe470
movq %rbx, %rdi
callq 0xb7f0