// File: /workspace/github_c_makefile_star2_O2/mohuangrui[P]ArtraCFD/program_entrance.c
// Function: EnterProgram
int EnterProgram(int argc, char *argv[], Control *control, Space *space)
{
    /*
     * Loop through command line to process options
     * The procedure main takes two arguments: argc and argv. The parameter
     * argc is the number of arguments on the command line (including the
     * program name). The array argv contains the actual arguments.
     * A standard command-line format has the form:
     * command options file1 file2 file3 ...
     * Options are preceded by a dash (-) and are usually a single letter.
     * If the option takes a parameter, it follows the letter with a space.
     * A while loop is used to cycle through the command-line options.
     * One argument always exists: the program name. The expression
     * (argc > 1) checks for additional arguments. The first one is
     * numbered 1. The first character of the first argument is argv[1][0].
     * If this is a dash, there is an option. The switch statement is used
     * to decode the options.
     */
    while ((1 < argc) && ('-' == argv[1][0])) { /* options present */
        if (3 > argc) { /* not enough arguments */
            ShowError("empty entry after: %s\n", argv[1]);
            exit(EXIT_FAILURE);
        }
        switch (argv[1][1]) { /* argv[1][1] is the actual option character */
            /* run mode: -m [gui], [serial], [omp], [mpi], [gpu] */
            case 'm':
                ++argv;
                --argc;
                if (0 == strcmp(argv[1], "gui")) {
                    control->runMode = 'i';
                    break;
                }
                if (0 == strcmp(argv[1], "serial")) {
                    control->runMode = 's';
                    break;
                }
                if (0 == strcmp(argv[1], "omp")) {
                    control->runMode = 'o';
                    break;
                }
                if (0 == strcmp(argv[1], "mpi")) {
                    control->runMode = 'm';
                    break;
                }
                if (0 == strcmp(argv[1], "gpu")) {
                    control->runMode = 'g';
                    break;
                }
                ShowError("bad option: %s\n", argv[1]);
                exit(EXIT_FAILURE);
                /* number of processors: -n nx*ny*nz */
            case 'n':
                ++argv;
                --argc;
                Sscanf(argv[1], 3, "%d*%d*%d", &(control->proc[X]),
                        &(control->proc[Y]), &(control->proc[Z]));
                break;
            default:
                ShowError("bad option: %s\n", argv[1]);
                exit(EXIT_FAILURE);
        }
        /* adjust argument list and count to consume an option */
        ++argv;
        --argc;
    }
    /* check information left */
    if (1 != argc) {
        ShowWarning("unidentified arguments ignored: %s...\n", argv[1]);
    }
    /* configure program according to inputted options */
    ConfigureProgram(control, space);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rcx, 0x8(%rsp)
movq %rsi, %r12
movl %edi, %ebp
leaq 0x4(%rdx), %r14
leaq 0x8(%rdx), %rbx
movq %rdx, (%rsp)
leaq 0xc(%rdx), %r15
addq $0x10, %r12
cmpl $0x2, %ebp
jl 0x15133
movq -0x8(%r12), %rsi
cmpb $0x2d, (%rsi)
jne 0x1513d
cmpl $0x2, %ebp
je 0x15451
movzbl 0x1(%rsi), %eax
cmpl $0x6e, %eax
je 0x150e9
cmpl $0x6d, %eax
jne 0x1545a
movq (%r12), %r13
movq %r13, %rdi
leaq 0x9a76(%rip), %rsi      # 0x1eafd
callq 0x2140
testl %eax, %eax
je 0x15109
movq %r13, %rdi
leaq 0x9a67(%rip), %rsi      # 0x1eb01
callq 0x2140
testl %eax, %eax
je 0x15112
movq %r13, %rdi
leaq 0x9a5b(%rip), %rsi      # 0x1eb08
callq 0x2140
testl %eax, %eax
je 0x1511b
movq %r13, %rdi
leaq 0x9a4c(%rip), %rsi      # 0x1eb0c
callq 0x2140
testl %eax, %eax
je 0x15124
movq %r13, %rdi
leaq 0x9a3d(%rip), %rsi      # 0x1eb10
callq 0x2140
testl %eax, %eax
jne 0x15485
movq (%rsp), %rax
movb $0x67, (%rax)
jmp 0x1512b
movq (%r12), %rdi
pushq $0x3
popq %rsi
leaq 0x9a2d(%rip), %rdx      # 0x1eb24
movq %r14, %rcx
movq %rbx, %r8
movq %r15, %r9
xorl %eax, %eax
callq 0x8927
jmp 0x1512b
movq (%rsp), %rax
movb $0x69, (%rax)
jmp 0x1512b
movq (%rsp), %rax
movb $0x73, (%rax)
jmp 0x1512b
movq (%rsp), %rax
movb $0x6f, (%rax)
jmp 0x1512b
movq (%rsp), %rax
movb $0x6d, (%rax)
addl $-0x2, %ebp
jmp 0x15043
cmpl $0x1, %ebp
je 0x1514b
movq -0x8(%r12), %rsi
leaq 0x99e9(%rip), %rdi      # 0x1eb2d
xorl %eax, %eax
callq 0x84d1
movq (%rsp), %rax
movsbl (%rax), %eax
addl $-0x67, %eax
rorl %eax
leal -0x3(%rax), %ecx
cmpl $0x2, %ecx
jb 0x153d7
cmpl $0x6, %eax
je 0x15414
cmpl $0x1, %eax
jne 0x1543d
leaq 0x31a9(%rip), %rbx      # 0x18325
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8643
leaq 0x99c7(%rip), %rdi      # 0x1eb54
xorl %eax, %eax
callq 0x8643
leaq 0x31d0(%rip), %rdi      # 0x1836b
xorl %eax, %eax
callq 0x8643
leaq 0x3200(%rip), %rdi      # 0x183a9
xorl %eax, %eax
callq 0x8643
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8643
leaq 0x3226(%rip), %rdi      # 0x183e7
xorl %eax, %eax
callq 0x8643
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8643
leaq 0x10(%rsp), %r15
movl $0xc8, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x20d0
leaq 0x99a5(%rip), %r12      # 0x1eb92
movq 0xede4(%rip), %r14      # 0x23fd8
leaq 0x7cda(%rip), %r13      # 0x1ced5
leaq 0x3212(%rip), %rbp      # 0x18414
pushq $0x5
popq %rbx
movq %r12, %rdi
xorl %eax, %eax
callq 0x8643
movq (%r14), %rdx
movq %r15, %rdi
movl $0xc8, %esi
callq 0x2120
movq %rax, %rdi
callq 0x841c
movq %r13, %rdi
xorl %eax, %eax
callq 0x8643
movq %r15, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x2190
testl %eax, %eax
je 0x152ea
movq %r15, %rdi
leaq 0x9a42(%rip), %rsi      # 0x1ec93
movq %rbx, %rdx
callq 0x2190
testl %eax, %eax
je 0x1534a
movq %r15, %rdi
leaq 0x9a53(%rip), %rsi      # 0x1ecbe
movq %rbx, %rdx
callq 0x2190
testl %eax, %eax
je 0x15358
movq %r15, %rdi
leaq 0x323e(%rip), %rsi      # 0x184c3
pushq $0x7
popq %rdx
callq 0x2190
testl %eax, %eax
je 0x15362
cmpb $0x0, 0x10(%rsp)
je 0x15205
movq %r15, %rdi
leaq 0x9a19(%rip), %rsi      # 0x1ecc3
pushq $0x6
popq %rdx
callq 0x2190
testl %eax, %eax
je 0x153ff
movq %r15, %rdi
leaq 0x3206(%rip), %rsi      # 0x184ca
movq %rbx, %rdx
callq 0x2190
testl %eax, %eax
je 0x15470
leaq 0x99ee(%rip), %rdi      # 0x1ecc9
movq %r15, %rsi
xorl %eax, %eax
callq 0x84d1
jmp 0x15205
leaq 0x98af(%rip), %rdi      # 0x1eba0
xorl %eax, %eax
callq 0x8643
leaq 0x98be(%rip), %rdi      # 0x1ebbd
xorl %eax, %eax
callq 0x8643
leaq 0x98d1(%rip), %rdi      # 0x1ebde
xorl %eax, %eax
callq 0x8643
leaq 0x98ef(%rip), %rdi      # 0x1ec0a
xorl %eax, %eax
callq 0x8643
leaq 0x990e(%rip), %rdi      # 0x1ec37
xorl %eax, %eax
callq 0x8643
leaq 0x9928(%rip), %rdi      # 0x1ec5f
xorl %eax, %eax
callq 0x8643
leaq 0x9936(%rip), %rdi      # 0x1ec7b
jmp 0x153cb
callq 0x37d8
leaq 0x9942(%rip), %rdi      # 0x1ec98
jmp 0x153cb
callq 0x2c00
jmp 0x15205
leaq 0x9975(%rip), %rdi      # 0x1ecde
xorl %eax, %eax
callq 0x8643
leaq 0x998a(%rip), %rdi      # 0x1ed01
xorl %eax, %eax
callq 0x8643
leaq 0x9987(%rip), %rdi      # 0x1ed0c
xorl %eax, %eax
callq 0x8643
leaq 0x99a9(%rip), %rdi      # 0x1ed3c
xorl %eax, %eax
callq 0x8643
leaq 0x99a5(%rip), %rdi      # 0x1ed46
xorl %eax, %eax
callq 0x8643
leaq 0x99d7(%rip), %rdi      # 0x1ed86
xorl %eax, %eax
callq 0x8643
leaq 0x9a07(%rip), %rdi      # 0x1edc4
xorl %eax, %eax
callq 0x8643
leaq 0x9a01(%rip), %rdi      # 0x1edcc
xorl %eax, %eax
callq 0x8643
jmp 0x15205
movl (%r14), %eax
movq 0x8(%rsp), %rcx
movl %eax, 0x420(%rcx)
movl (%rbx), %eax
movl %eax, 0x424(%rcx)
movl (%r15), %eax
movl %eax, 0x428(%rcx)
imull (%r14), %eax
imull (%rbx), %eax
jmp 0x15437
movq (%rsp), %rax
movb $0x73, (%rax)
leaq 0x2f18(%rip), %rdi      # 0x18325
xorl %eax, %eax
callq 0x8643
movabsq $0x100000001, %rax      # imm = 0x100000001
movq 0x8(%rsp), %rcx
movq %rax, 0x420(%rcx)
movl $0x1, 0x428(%rcx)
pushq $0x1
popq %rax
movl %eax, 0x42c(%rcx)
xorl %eax, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x968e(%rip), %rdi      # 0x1eae6
jmp 0x15461
leaq 0x96b3(%rip), %rdi      # 0x1eb14
xorl %eax, %eax
callq 0x856a
pushq $0x1
popq %rdi
callq 0x2200
leaq 0x2eae(%rip), %rdi      # 0x18325
xorl %eax, %eax
callq 0x8643
xorl %edi, %edi
callq 0x2200
leaq 0x9688(%rip), %rdi      # 0x1eb14
movq %r13, %rsi
jmp 0x15461
nopl (%rax)