// File: /workspace/github_cpp_makefile_star2_O3/sus304[P]ForRocket/src/ForRocket.cpp
// Function: main
int main(int argc, char* argv[]) {
    // arg parse
    //////////////////////////////////////////////
    bool enable_msg = true;
    bool enable_minimum_damp = false;

    std::vector<int> json_index;
    for (int i=1; i < argc; ++i) {
        std::string str = argv[i];
        if (str.rfind(".json") != std::string::npos) {
            json_index.push_back(i);
            continue;
        }
        if (str.find("--") != std::string::npos) {
            if (str == "--help") {
                std::cout << "ForRocket v" << program_ver << " (release: " << release_date << ")"  << std::endl;
                forrocket::DisplayHelp();
                return 0;
            }
            if (str == "--version") {
                std::cout << "ForRocket version:" << program_ver << " (release: " << release_date << ")" << std::endl;
                return 0;
            }
            if (str == "--quite") {
                enable_msg = false;
            }
        }
        if (str.find("-") != std::string::npos) {
            if (str.find('h') != std::string::npos) {
                std::cout << "ForRocket v" << program_ver << " (release: " << release_date << ")"  << std::endl;
                forrocket::DisplayHelp();
                return 0;
            }
            if (str.find('v') != std::string::npos) {
                std::cout << "ForRocket version:" << program_ver << " (release: " << release_date << ")"  << std::endl;
                return 0;
            }
            if (str.find('q') != std::string::npos) {
                enable_msg = false;
            }
            if (str.find('m') != std::string::npos) {
                enable_minimum_damp = true;
            }
        }
    }
    
    if (json_index.size() == 0) {
        std::cerr << "Error! missing argument json file.";
        return 1;
    }
    if (json_index.size() != 1) {
        std::cerr << "Error! too many argument json file.";
        return 1;
    }

    if (enable_msg) std::cout << "ForRocket v" << program_ver << " Contact." << std::endl;
    
    // Timer Start
    auto start = std::chrono::system_clock::now();

    // Solver Run
    //////////////////////////////////////////////
    if (enable_msg) std::cout << "Solver Start." << std::endl;
    forrocket::TrajectorySolver solver(argv[json_index[0]]);
    solver.Solve();
    if (enable_msg) std::cout << "Solver Terminate." << std::endl;
    if (enable_msg) std::cout << "Export Result ..." << std::endl;
    solver.DumpResult(enable_minimum_damp);
    if (enable_msg) std::cout << "Export Compleate." << std::endl;

    // Timer Stop
    auto end = std::chrono::system_clock::now();
    auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
    if (enable_msg) {
        if (msec > 10000) {
            std::cout << "Running Time: " << msec / 1000 << " sec" << std::endl;
        } else {
            std::cout << "Running Time: " << msec << " msec" << std::endl;
        }
    }

    if (enable_msg) std::cout << "Good Day." << std::endl;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x1, 0x8(%rsp)
cmpl $0x1, %edi
jle 0x359dc
movq %rsi, %rbx
movl %edi, %ebp
movl $0x1, %eax
movb $0x1, 0x7(%rsp)
movq $0x0, 0x28(%rsp)
leaq 0x50(%rsp), %r14
leaq 0xf(%rsp), %r15
leaq 0x1ac4(%rip), %r12      # 0x37038
cltq
movq (%rbx,%rax,8), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x35e5e
movl $0x5, %ecx
movq %r14, %rdi
movq %r12, %rsi
movq $-0x1, %rdx
callq 0x5480
cmpq $-0x1, %rax
je 0x355cc
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x35718
movl 0x8(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
movl $0x4, %r13d
jmp 0x35987
movl $0x2, %ecx
movq %r14, %rdi
leaq 0x8232(%rip), %rsi      # 0x3d80d
xorl %edx, %edx
callq 0x55c0
cmpq $-0x1, %rax
je 0x3562e
movq %r14, %rdi
leaq 0x821e(%rip), %rsi      # 0x3d810
callq 0x5110
testl %eax, %eax
je 0x35732
movq %r14, %rdi
leaq 0x8226(%rip), %rsi      # 0x3d82f
callq 0x5110
testl %eax, %eax
je 0x357e0
movq %r14, %rdi
leaq 0x822c(%rip), %rsi      # 0x3d84c
callq 0x5110
testl %eax, %eax
setne %al
andb %al, 0x7(%rsp)
xorl %r13d, %r13d
movl $0x1, %ecx
movq %r14, %rdi
leaq 0x81ce(%rip), %rsi      # 0x3d80e
xorl %edx, %edx
callq 0x55c0
cmpq $-0x1, %rax
je 0x35987
movq %r14, %rdi
movl $0x68, %esi
xorl %edx, %edx
callq 0x5430
cmpq $-0x1, %rax
je 0x35889
movl $0xb, %edx
movq 0x13952(%rip), %rdi     # 0x48fc8
leaq 0x819a(%rip), %rsi      # 0x3d817
callq 0x53b0
movq 0x141af(%rip), %rsi     # 0x49838
movq 0x141b0(%rip), %rdx     # 0x49840
movq 0x13931(%rip), %rdi     # 0x48fc8
callq 0x53b0
movq %rax, %r13
movl $0xb, %edx
movq %rax, %rdi
leaq 0x8175(%rip), %rsi      # 0x3d823
callq 0x53b0
movq 0x1419e(%rip), %rsi     # 0x49858
movq 0x1419f(%rip), %rdx     # 0x49860
movq %r13, %rdi
callq 0x53b0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7da1(%rip), %rsi      # 0x3d47c
callq 0x53b0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r13, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5250
movl $0x1, %r13d
callq 0x7370
jmp 0x35987
movl $0x4, %r13d
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x35ed0
jmp 0x35987
movl $0xb, %edx
movq 0x1388a(%rip), %rdi     # 0x48fc8
leaq 0x80d2(%rip), %rsi      # 0x3d817
callq 0x53b0
movq 0x140e7(%rip), %rsi     # 0x49838
movq 0x140e8(%rip), %rdx     # 0x49840
movq 0x13869(%rip), %rdi     # 0x48fc8
callq 0x53b0
movq %rax, %r13
movl $0xb, %edx
movq %rax, %rdi
leaq 0x80ad(%rip), %rsi      # 0x3d823
callq 0x53b0
movq 0x140d6(%rip), %rsi     # 0x49858
movq 0x140d7(%rip), %rdx     # 0x49860
movq %r13, %rdi
callq 0x53b0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7cd9(%rip), %rsi      # 0x3d47c
callq 0x53b0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r13, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5250
movl $0x1, %r13d
callq 0x7370
jmp 0x35987
movl $0x12, %edx
movq 0x137dc(%rip), %rdi     # 0x48fc8
leaq 0x8046(%rip), %rsi      # 0x3d839
callq 0x53b0
movq 0x14039(%rip), %rsi     # 0x49838
movq 0x1403a(%rip), %rdx     # 0x49840
movq 0x137bb(%rip), %rdi     # 0x48fc8
callq 0x53b0
movq %rax, %r13
movl $0xb, %edx
movq %rax, %rdi
leaq 0x7fff(%rip), %rsi      # 0x3d823
callq 0x53b0
movq 0x14028(%rip), %rsi     # 0x49858
movq 0x14029(%rip), %rdx     # 0x49860
movq %r13, %rdi
callq 0x53b0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7c2b(%rip), %rsi      # 0x3d47c
callq 0x53b0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r13, %rdi
callq 0x5040
movl $0x1, %r13d
movq %rax, %rdi
callq 0x5250
jmp 0x35987
movq %r14, %rdi
movl $0x76, %esi
xorl %edx, %edx
callq 0x5430
cmpq $-0x1, %rax
je 0x35948
movl $0x12, %edx
movq 0x1371a(%rip), %rdi     # 0x48fc8
leaq 0x7f84(%rip), %rsi      # 0x3d839
callq 0x53b0
movq 0x13f77(%rip), %rsi     # 0x49838
movq 0x13f78(%rip), %rdx     # 0x49840
movq 0x136f9(%rip), %rdi     # 0x48fc8
callq 0x53b0
movq %rax, %r13
movl $0xb, %edx
movq %rax, %rdi
leaq 0x7f3d(%rip), %rsi      # 0x3d823
callq 0x53b0
movq 0x13f66(%rip), %rsi     # 0x49858
movq 0x13f67(%rip), %rdx     # 0x49860
movq %r13, %rdi
callq 0x53b0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7b69(%rip), %rsi      # 0x3d47c
callq 0x53b0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r13, %rdi
callq 0x5040
movl $0x1, %r13d
movq %rax, %rdi
callq 0x5250
jmp 0x35987
xorl %r13d, %r13d
movq %r14, %rdi
movl $0x71, %esi
xorl %edx, %edx
callq 0x5430
cmpq $-0x1, %rax
sete %al
andb %al, 0x7(%rsp)
movq %r14, %rdi
movl $0x6d, %esi
xorl %edx, %edx
callq 0x5430
cmpq $-0x1, %rax
setne %al
movq 0x28(%rsp), %rcx
orb %al, %cl
movq %rcx, 0x28(%rsp)
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x359a3
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5350
testb $0x3, %r13b
jne 0x35dbe
movl 0x8(%rsp), %eax
incl %eax
movl %eax, 0x8(%rsp)
cmpl %ebp, %eax
jl 0x35574
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x2, %rax
cmpq $0x1, %rax
je 0x359fe
testq %rax, %rax
jne 0x35acd
movl $0x22, %edx
leaq 0x7e6c(%rip), %rsi      # 0x3d854
movl $0x1, %ebx
movq 0x135fc(%rip), %rdi     # 0x48ff0
callq 0x53b0
jmp 0x35dc0
movb 0x7(%rsp), %bpl
testb $0x1, %bpl
je 0x35ade
movq 0x135b4(%rip), %rdi     # 0x48fc8
leaq 0x7dfc(%rip), %rsi      # 0x3d817
movl $0xb, %edx
callq 0x53b0
movq 0x13e0c(%rip), %rsi     # 0x49838
movq 0x13e0d(%rip), %rdx     # 0x49840
movq 0x1358e(%rip), %rdi     # 0x48fc8
callq 0x53b0
movq %rax, %r14
leaq 0x7e52(%rip), %rsi      # 0x3d89b
movl $0x9, %edx
movq %rax, %rdi
callq 0x53b0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5250
callq 0x5070
movq %rax, %r14
movq 0x1353c(%rip), %r15     # 0x48fc8
leaq 0x7e12(%rip), %rsi      # 0x3d8a5
movl $0xd, %edx
movq %r15, %rdi
callq 0x53b0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq 0x1350a(%rip), %rdi     # 0x48fc8
callq 0x5040
movq %rax, %rdi
callq 0x5250
jmp 0x35ae6
movl $0x23, %edx
leaq 0x7d9e(%rip), %rsi      # 0x3d877
jmp 0x359e8
callq 0x5070
movq %rax, %r14
movq 0x10(%rsp), %rax
movslq (%rax), %rax
movq (%rbx,%rax,8), %rsi
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x35e5e
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x31770
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x35b2b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x50(%rsp), %rdi
callq 0x32d2a
testb $0x1, %bpl
je 0x35bcb
movq 0x13482(%rip), %rbx     # 0x48fc8
leaq 0x7d66(%rip), %rsi      # 0x3d8b3
movl $0x11, %edx
movq %rbx, %rdi
callq 0x53b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq 0x13450(%rip), %rdi     # 0x48fc8
callq 0x5040
movq %rax, %rdi
callq 0x5250
movq 0x1343c(%rip), %rbx     # 0x48fc8
leaq 0x7d32(%rip), %rsi      # 0x3d8c5
movl $0x11, %edx
movq %rbx, %rdi
callq 0x53b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq 0x1340a(%rip), %rdi     # 0x48fc8
callq 0x5040
movq %rax, %rdi
callq 0x5250
movzbl 0x28(%rsp), %esi
andl $0x1, %esi
leaq 0x50(%rsp), %rdi
callq 0x32f2e
testb $0x1, %bpl
je 0x35cd4
movq 0x133da(%rip), %rbx     # 0x48fc8
leaq 0x7ce2(%rip), %rsi      # 0x3d8d7
movl $0x11, %edx
movq %rbx, %rdi
callq 0x53b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq 0x133a8(%rip), %rdi     # 0x48fc8
callq 0x5040
movq %rax, %rdi
callq 0x5250
callq 0x5070
movq %rax, %rcx
subq %r14, %rcx
movabsq $0x431bde82d7b634db, %rdx # imm = 0x431BDE82D7B634DB
movq %rcx, %rax
imulq %rdx
movq %rdx, %rbx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x12, %rbx
addq %rax, %rbx
movabsq $0x2541b2640, %rax      # imm = 0x2541B2640
cmpq %rax, %rcx
jl 0x35cde
movq 0x13359(%rip), %rdi     # 0x48fc8
leaq 0x7c73(%rip), %rsi      # 0x3d8e9
movl $0xe, %edx
callq 0x53b0
shrq $0x3, %rbx
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
movq %rbx, %rax
mulq %rcx
shrq $0x4, %rdx
movq 0x13329(%rip), %rdi     # 0x48fc8
movq %rdx, %rsi
callq 0x5320
movq %rax, %rbx
leaq 0x7c47(%rip), %rsi      # 0x3d8f8
movl $0x4, %edx
movq %rax, %rdi
callq 0x53b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5330
jmp 0x35d30
callq 0x5070
jmp 0x35d89
movq 0x132e3(%rip), %rdi     # 0x48fc8
leaq 0x7bfd(%rip), %rsi      # 0x3d8e9
movl $0xe, %edx
callq 0x53b0
movq 0x132cb(%rip), %rdi     # 0x48fc8
movq %rbx, %rsi
callq 0x5320
movq %rax, %rbx
leaq 0x7bee(%rip), %rsi      # 0x3d8fd
movl $0x5, %edx
movq %rax, %rdi
callq 0x53b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5250
movq 0x1327e(%rip), %rbx     # 0x48fc8
leaq 0x7bb2(%rip), %rsi      # 0x3d903
movl $0x9, %edx
movq %rbx, %rdi
callq 0x53b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq 0x1324c(%rip), %rdi     # 0x48fc8
callq 0x5040
movq %rax, %rdi
callq 0x5250
leaq 0xd8(%rsp), %rdi
callq 0x33566
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
callq 0x33646
movq -0x28(%rbx), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x35dbe
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5350
xorl %ebx, %ebx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x35dd7
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5350
movl %ebx, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x35e3e
movq 0x40(%rsp), %rsi
jmp 0x35e36
jmp 0x35e1a
jmp 0x35e1a
jmp 0x35e09
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x35e9c
jmp 0x35e3e
jmp 0x35e1a
movq %rax, %rbx
jmp 0x35e3e
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x35e3e
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5350
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x35e55
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5350
movq %rbx, %rdi
callq 0x55e0
nop