// File: /workspace/github_cpp_makefile_star2_O2/establishment[P]sandman/src/bin.cpp
// Function: ParseCommandLineArguments(int, char**)
ProcessConfig ParseCommandLineArguments(int argc, char** argv) {
    CommandLineConfig config;
    auto options = AddOptions(config);

    vector<string> positional;
    options.add_options()("positional", " -- run command", cxxopts::value<vector<string>>(positional));

    options.parse_positional("positional");
    try {
        options.parse(argc, argv);

        if (options.count("help")) {
            std::cout << options.help({"", "Config", "Time", "Memory", "Redirects", "Rules"}) << std::endl;
            exit(0);
        }
    } catch (const cxxopts::option_not_exists_exception& e) {
        auto GetOption = [](const string& exception_message) {
            string result = "";
            bool quoted = false;
            for (char32_t  c : exception_message) {
                if (c == 4294967266) {
                    quoted = false;
                }               

                if (quoted) {
                    result += c;
                }

                if (c == 4294967192) {
                    quoted = true;
                }
            }

            return result;
        };
        
        
        std::cout << e.what() << u8". Did you mean ‘" << ClosestOption(GetOption(e.what())) << u8"’?\n";
        exit(1);
    } catch (const cxxopts::OptionException& e) {
        std::cout << "error parsing options: " << e.what() << "\n";
        exit(1);
    }

    ProcessConfig p_config;
    p_config = config;
   
    if (options.count("interactive")) {
        p_config.swapPipeOpenOrder = true;
    }

    if (options.count("full-env")) {
        p_config.environment.passEnvironment = true;
    }

    if (options.count("share-net")) {
        p_config.shareNetwork = true;
    }

    if (options.count("init")) {
        p_config.mode = ProcessConfig::kInit;
    }

    if (options.count("run")) {
        p_config.mode = ProcessConfig::kRun;
    }

    if (options.count("cleanup")) {
        p_config.mode = ProcessConfig::kCleanup;
    }

    /// convert times to ms
    p_config.cpuTimeLimitMs = 1000.0 * config.cpuTimeLimitS;
    p_config.wallTimeLimitMs = 1000.0 * config.wallTimeLimitS;
    p_config.extraTimeMs = 1000.0 * config.extraTimeS;

    /// add positional arguments
    for (const string& word : positional) {
        p_config.runCommand += "\"" + word + "\"" + " ";
    }

    return p_config;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x468, %rsp            # imm = 0x468
movq %rdi, 0x10(%rsp)
movl %esi, 0x4c(%rsp)
movq %rdx, 0x168(%rsp)
leaq 0x2e0(%rsp), %rbx
movq %rbx, %rdi
callq 0x41164
leaq 0x1e8(%rsp), %rdi
movq %rbx, %rsi
callq 0x3c8c2
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
andq $0x0, 0x80(%rsp)
leaq 0x1b132(%rip), %rsi     # 0x5b148
leaq 0x1c8(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x40b24
leaq 0xa8(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
leaq 0x1c8(%rsp), %rdx
callq 0x41e54
leaq 0x1bdf7(%rip), %rsi     # 0x5be43
leaq 0x20(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x40b24
leaq 0x1bdec(%rip), %rsi     # 0x5be4e
leaq 0x50(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x40b24
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x421ee
leaq 0x178(%rsp), %rbx
leaq 0x98(%rsp), %r15
movapd -0x8(%r15), %xmm0
movapd %xmm0, -0x8(%rbx)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x8(%r15)
leaq 0x1b099(%rip), %rsi     # 0x5b148
leaq 0x1a8(%rsp), %rdi
leaq 0xd(%rsp), %rdx
callq 0x40b24
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0x170(%rsp), %rcx
leaq 0x1a8(%rsp), %r8
callq 0x41ec8
leaq 0x1a8(%rsp), %rdi
callq 0x37958
movq %rbx, %rdi
callq 0x4b0a0
movq %r15, %rdi
callq 0x4b0a0
leaq 0x50(%rsp), %rdi
callq 0x37958
leaq 0x20(%rsp), %rdi
callq 0x37958
leaq 0xb0(%rsp), %rdi
callq 0x37958
leaq 0x1c8(%rsp), %rdi
callq 0x37958
leaq 0x1bd09(%rip), %rsi     # 0x5be43
leaq 0x188(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x40b24
leaq 0x1e8(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0x4226c
leaq 0x188(%rsp), %rdi
callq 0x37958
leaq 0x1e8(%rsp), %rdi
leaq 0x4c(%rsp), %rsi
leaq 0x168(%rsp), %rdx
callq 0x422e6
leaq 0x1bcac(%rip), %rsi     # 0x5be3e
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x40b24
leaq 0x1e8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x42b6e
movl %eax, %ebx
leaq 0xa8(%rsp), %rdi
callq 0x37958
testl %ebx, %ebx
jne 0x40529
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x41164
leaq 0x2e0(%rsp), %rsi
movq %rbx, %rdi
callq 0x41668
leaq 0x1b50e(%rip), %rsi     # 0x5b702
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x40b24
leaq 0x1e8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x42b6e
movl %eax, %ebx
leaq 0xa8(%rsp), %rdi
callq 0x37958
testl %ebx, %ebx
je 0x4023a
movq 0x10(%rsp), %rax
movb $0x1, 0xe4(%rax)
leaq 0x1b4cd(%rip), %rsi     # 0x5b70e
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x40b24
leaq 0x1e8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x42b6e
movl %eax, %ebx
leaq 0xa8(%rsp), %rdi
callq 0x37958
testl %ebx, %ebx
je 0x4028a
movq 0x10(%rsp), %rax
movl $0x1, 0x10c(%rax)
leaq 0x1b4bb(%rip), %rsi     # 0x5b74c
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x40b24
leaq 0x1e8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x42b6e
movl %eax, %ebx
leaq 0xa8(%rsp), %rdi
callq 0x37958
testl %ebx, %ebx
je 0x402da
movq 0x10(%rsp), %rax
movl $0x1, 0xe0(%rax)
leaq 0x1baf8(%rip), %rsi     # 0x5bdd9
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x40b24
leaq 0x1e8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x42b6e
movl %eax, %ebx
leaq 0xa8(%rsp), %rdi
callq 0x37958
testl %ebx, %ebx
je 0x40326
movq 0x10(%rsp), %rax
movl $0x1, (%rax)
leaq 0x1bbe5(%rip), %rsi     # 0x5bf12
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x40b24
leaq 0x1e8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x42b6e
movl %eax, %ebx
leaq 0xa8(%rsp), %rdi
callq 0x37958
testl %ebx, %ebx
je 0x40372
movq 0x10(%rsp), %rax
movl $0x2, (%rax)
leaq 0x1b3e7(%rip), %rsi     # 0x5b760
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x40b24
leaq 0x1e8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x42b6e
movl %eax, %ebx
leaq 0xa8(%rsp), %rdi
callq 0x37958
testl %ebx, %ebx
movq 0x10(%rsp), %rsi
je 0x403be
movl $0x3, (%rsi)
movsd 0x1ac9a(%rip), %xmm0    # 0x5b060
movsd 0x448(%rsp), %xmm2
mulsd %xmm0, %xmm2
movsd 0x1ac8d(%rip), %xmm1    # 0x5b068
cvttsd2si %xmm2, %rax
subsd %xmm1, %xmm2
cvttsd2si %xmm2, %rcx
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x30(%rsi)
movsd 0x450(%rsp), %xmm2
mulsd %xmm0, %xmm2
cvttsd2si %xmm2, %rax
subsd %xmm1, %xmm2
cvttsd2si %xmm2, %rcx
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
orq %rax, %rdx
mulsd 0x458(%rsp), %xmm0
movq %rdx, 0x38(%rsi)
cvttsd2si %xmm0, %rax
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x40(%rsi)
movq 0x70(%rsp), %r14
movq 0x78(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0xe8(%rsi), %rax
movq %rax, 0xa0(%rsp)
leaq 0x1af5e(%rip), %r15     # 0x5b3d1
leaq 0x50(%rsp), %r13
leaq 0x20(%rsp), %rbp
leaq 0xa8(%rsp), %rbx
cmpq 0x40(%rsp), %r14
je 0x404ee
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x40e90
movq %rbp, %rdi
movq %r13, %rsi
movq %r15, %r12
movq %r15, %rdx
callq 0x40dbd
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x1c0d7(%rip), %rdx     # 0x5c58f
callq 0x40dbd
movq 0xa0(%rsp), %rdi
movq %rbx, %rsi
callq 0x37910
movq %rbx, %rdi
callq 0x37958
movq %rbp, %rdi
callq 0x37958
movq %r13, %rdi
callq 0x37958
addq $0x20, %r14
movq %r12, %r15
jmp 0x40485
leaq 0x70(%rsp), %rdi
callq 0x41050
leaq 0x1e8(%rsp), %rdi
callq 0x4222c
leaq 0x2e0(%rsp), %rdi
callq 0x42d14
movq 0x10(%rsp), %rax
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1ac18(%rip), %rsi     # 0x5b148
leaq 0xa8(%rsp), %rbx
leaq 0x90(%rsp), %rdx
movq %rbx, %rdi
callq 0x40b24
leaq 0xc8(%rsp), %r15
leaq 0x1b232(%rip), %rsi     # 0x5b789
leaq 0xc(%rsp), %rdx
movq %r15, %rdi
callq 0x40b24
leaq 0xe8(%rsp), %r15
leaq 0x1b33d(%rip), %rsi     # 0x5b8b0
leaq 0xf(%rsp), %rdx
movq %r15, %rdi
callq 0x40b24
leaq 0x108(%rsp), %r15
leaq 0x1b3d5(%rip), %rsi     # 0x5b964
leaq 0xe(%rsp), %rdx
movq %r15, %rdi
callq 0x40b24
leaq 0x128(%rsp), %r15
leaq 0x1b437(%rip), %rsi     # 0x5b9e2
leaq 0xd(%rsp), %rdx
movq %r15, %rdi
callq 0x40b24
leaq 0x148(%rsp), %r15
leaq 0x1adb8(%rip), %rsi     # 0x5b37f
leaq 0x1f(%rsp), %rdx
movq %r15, %rdi
callq 0x40b24
leaq 0x50(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
pushq $0x6
popq %rdx
leaq 0x1e(%rsp), %rcx
callq 0x41c40
leaq 0x20(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x42b92
movq 0x3395c(%rip), %rdi     # 0x73f68
leaq 0x20(%rsp), %rsi
callq 0x373d0
movq %rax, %rdi
callq 0x37200
leaq 0x20(%rsp), %rdi
callq 0x37958
leaq 0x50(%rsp), %rdi
callq 0x41050
movl $0xa0, %ebx
leaq (%rsp,%rbx), %rdi
addq $0xa8, %rdi
callq 0x37958
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x40637
xorl %edi, %edi
callq 0x37570
movq %rdx, %r12
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x37958
jmp 0x40670
movq %rdx, %r12
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x41050
jmp 0x40682
movq %rdx, %r12
movq %rax, %r14
movl $0xa0, %r13d
leaq (%rsp,%r13), %rdi
addq $0xa8, %rdi
callq 0x37958
addq $-0x20, %r13
cmpq $-0x20, %r13
jne 0x40688
movb $0x1, %al
jmp 0x406b6
jmp 0x406ae
jmp 0x406ae
jmp 0x406ae
jmp 0x406ae
movq %rdx, %r12
movq %rax, %r14
xorl %eax, %eax
cmpq %r15, %rbx
sete %cl
testb %al, %al
jne 0x40738
testb %cl, %cl
jne 0x40738
addq $-0x20, %r15
movq %r15, %rdi
callq 0x37958
cmpq %rbx, %r15
jne 0x406c4
jmp 0x40738
jmp 0x40732
jmp 0x406fc
jmp 0x4098c
jmp 0x406fc
jmp 0x4098c
jmp 0x406fc
jmp 0x4098c
jmp 0x406fc
jmp 0x4098c
jmp 0x406fc
jmp 0x4098c
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
jmp 0x409ba
jmp 0x4098c
jmp 0x4098c
jmp 0x40970
movq %rdx, %r12
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
callq 0x37958
jmp 0x40738
jmp 0x40732
movq %rdx, %r12
movq %rax, %r14
cmpl $0x2, %r12d
jne 0x40805
movq %r14, %rdi
callq 0x37180
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq 0x3380b(%rip), %rdi     # 0x73f68
movq %rax, %rsi
callq 0x37450
leaq 0x1b70a(%rip), %rsi     # 0x5be76
movq %rax, %rdi
callq 0x37450
movq %rax, 0x40(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
leaq 0x50(%rsp), %rdi
leaq 0xc(%rsp), %rdx
movq %rax, %rsi
callq 0x40b24
leaq 0x1a9ad(%rip), %rsi     # 0x5b148
leaq 0x20(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x40b24
movl $0xffffff98, %eax       # imm = 0xFFFFFF98
movq 0x50(%rsp), %r12
movq 0x58(%rsp), %r13
xorl %ebp, %ebp
leaq 0x4a(%rax), %rbx
xorl %r14d, %r14d
cmpq %rbp, %r13
je 0x4085b
movsbq (%r12,%rbp), %rax
movl %eax, %r15d
cmpq %rbx, %r15
setne %cl
andb %cl, %r14b
cmpb $0x1, %r14b
jne 0x407f2
movsbl %al, %esi
leaq 0x20(%rsp), %rdi
callq 0x373a0
movl $0xffffff98, %eax       # imm = 0xFFFFFF98
cmpl %eax, %r15d
sete %al
orb %al, %r14b
incq %rbp
jmp 0x407c5
cmpl $0x1, %r12d
jne 0x409c9
movq %r14, %rdi
callq 0x37180
movq %rax, %rbx
movq 0x33747(%rip), %rdi     # 0x73f68
leaq 0x1b636(%rip), %rsi     # 0x5be5e
callq 0x37450
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x37450
leaq 0x1bd6b(%rip), %rsi     # 0x5c5b6
movq %rax, %rdi
callq 0x37450
pushq $0x1
popq %rdi
callq 0x37570
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x3c638
leaq 0xa8(%rsp), %rsi
movq 0x40(%rsp), %rdi
callq 0x373d0
leaq 0x1b603(%rip), %rsi     # 0x5be89
movq %rax, %rdi
callq 0x37450
leaq 0xa8(%rsp), %rdi
callq 0x37958
leaq 0x20(%rsp), %rdi
callq 0x37958
leaq 0x50(%rsp), %rdi
callq 0x37958
jmp 0x40853
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
callq 0x37958
jmp 0x408c8
jmp 0x408c5
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x37958
jmp 0x408d7
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x37958
jmp 0x4097d
jmp 0x4097a
movq %rax, %r14
callq 0x37780
jmp 0x409c9
movq %rax, %r14
leaq 0x188(%rsp), %rdi
jmp 0x40964
jmp 0x40970
movq %rax, %r14
leaq 0x1a8(%rsp), %rdi
callq 0x37958
jmp 0x4091c
movq %rax, %r14
movq %rbx, %rdi
callq 0x4b0a0
movq %r15, %rdi
callq 0x4b0a0
jmp 0x40931
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x37958
jmp 0x40940
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x37958
jmp 0x4094f
movq %rax, %r14
leaq 0xb0(%rsp), %rdi
callq 0x37958
leaq 0x1c8(%rsp), %rdi
callq 0x37958
jmp 0x409c9
movq %rax, %r14
jmp 0x4095c
movq %rax, %r14
jmp 0x409c9
movq %rax, %r14
jmp 0x409e0
movq %rax, %r14
callq 0x37780
jmp 0x409c9
movq %rax, %rdi
callq 0x42d08
movq %rax, %r14
jmp 0x409bf
movq %rax, %r14
jmp 0x409b5
movq %rax, %r14
jmp 0x409ab
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
callq 0x37958
leaq 0x20(%rsp), %rdi
callq 0x37958
leaq 0x50(%rsp), %rdi
callq 0x37958
movq 0x10(%rsp), %rdi
callq 0x42d14
leaq 0x70(%rsp), %rdi
callq 0x41050
leaq 0x1e8(%rsp), %rdi
callq 0x4222c
leaq 0x2e0(%rsp), %rdi
callq 0x42d14
movq %r14, %rdi
callq 0x377f0