// File: /workspace/github_c_makefile_star2_O1/mohuangrui[P]ArtraCFD/calculator.c
// Function: RunCalculator
int RunCalculator(void)
{
    CalcVar theVar = {
        .t = 0.0,
        .x = 0.0,
        .y = 0.0,
        .z = 0.0,
        .ans = 0.0,
        .pi = PI,
    };
    ShowInfo("Session");
    ShowInfo("*                   Expression Calculator                  *\n");
    ShowInfo("*                     <By Huangrui Mo>                     *\n");
    ShowInfo("*    Copyright (C) Huangrui Mo <huangrui.mo@gmail.com>     *\n");
    ShowInfo("Session");
    ShowInfo("Enter 'help' for more information\n");
    ShowInfo("Session");
    String str = {'\0'}; /* store the input information */
    while (1) {
        ShowInfo("\nCalc << ");
        ParseCommand(fgets(str, sizeof str, stdin));
        ShowInfo("\n");
        if (0 == strncmp(str, "help", sizeof str)) {
            ShowInfo("Options:\n");
            ShowInfo("[help]       show this information\n");
            ShowInfo("[set]        set variable values\n");
            ShowInfo("[math expr]  compute math expression\n");
            ShowInfo("[manual]     show user manual\n");
            ShowInfo("[exit]       return\n");
            continue;
        }
        if (0 == strncmp(str, "set", sizeof str)) {
            SetVariable(&theVar);
            continue;
        }
        if (0 == strncmp(str, "manual", sizeof str)) {
            ShowCalcManual();
            continue;
        }
        if ('\0' == str[0]) {
            continue;
        }
        if (0 == strncmp(str, "exit", sizeof str)) {
            ShowInfo("Session");
            return 0;
        }
        /* if non of above is true, then compute the expression */
        ComputeExpression(&theVar, str);
        ShowInfo("ans = %.6g\n", theVar.ans);
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rcx
movaps %xmm0, 0x10(%rcx)
movaps %xmm0, (%rcx)
movaps %xmm0, -0x10(%rcx)
leaq 0x1a9f5(%rip), %rax     # 0x1d648
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rcx)
leaq 0x176c2(%rip), %rbx     # 0x1a325
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9051
leaq 0x176b9(%rip), %rdi     # 0x1a32d
xorl %eax, %eax
callq 0x9051
leaq 0x176e9(%rip), %rdi     # 0x1a36b
xorl %eax, %eax
callq 0x9051
leaq 0x17719(%rip), %rdi     # 0x1a3a9
xorl %eax, %eax
callq 0x9051
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9051
leaq 0x1773f(%rip), %rdi     # 0x1a3e7
xorl %eax, %eax
callq 0x9051
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9051
leaq 0x30(%rsp), %r14
movl $0xc8, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x20d0
leaq 0x17736(%rip), %r13     # 0x1a40a
movq 0x222fd(%rip), %r12     # 0x24fd8
leaq 0x1c283(%rip), %rbp     # 0x1ef65
movl $0x706c6568, %ebx       # imm = 0x706C6568
movq %r13, %rdi
xorl %eax, %eax
callq 0x9051
movq (%r12), %rdx
movq %r14, %rdi
movl $0xc8, %esi
callq 0x2120
movq %rax, %rdi
callq 0x8e6c
movq %rbp, %rdi
xorl %eax, %eax
callq 0x9051
movl 0x30(%rsp), %eax
xorl %ebx, %eax
movzbl 0x34(%rsp), %ecx
orl %eax, %ecx
je 0x2ddf
cmpl $0x746573, 0x30(%rsp)   # imm = 0x746573
jne 0x2e31
leaq 0x1ad42(%rip), %rdi     # 0x1da7e
callq 0x8fb6
movq %rax, %r15
leaq 0x17b09(%rip), %rdi     # 0x1a854
xorl %eax, %eax
callq 0x9051
movq (%r12), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r15, %rdx
movq %rsp, %rcx
xorl %eax, %eax
callq 0x941f
leaq 0x17aea(%rip), %rdi     # 0x1a859
xorl %eax, %eax
callq 0x9051
movq (%r12), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r15, %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x941f
leaq 0x17ac9(%rip), %rdi     # 0x1a85e
xorl %eax, %eax
callq 0x9051
movq (%r12), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r15, %rdx
leaq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x941f
leaq 0x17aa8(%rip), %rdi     # 0x1a863
xorl %eax, %eax
callq 0x9051
movq (%r12), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r15, %rdx
leaq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x941f
jmp 0x2ce7
leaq 0x17633(%rip), %rdi     # 0x1a419
xorl %eax, %eax
callq 0x9051
leaq 0x1762f(%rip), %rdi     # 0x1a423
xorl %eax, %eax
callq 0x9051
leaq 0x17645(%rip), %rdi     # 0x1a447
xorl %eax, %eax
callq 0x9051
leaq 0x17659(%rip), %rdi     # 0x1a469
xorl %eax, %eax
callq 0x9051
leaq 0x17671(%rip), %rdi     # 0x1a48f
xorl %eax, %eax
callq 0x9051
leaq 0x17682(%rip), %rdi     # 0x1a4ae
jmp 0x2edb
movl 0x30(%rsp), %eax
movl $0x756e616d, %ecx       # imm = 0x756E616D
xorl %ecx, %eax
movl 0x33(%rsp), %ecx
movl $0x6c6175, %edx         # imm = 0x6C6175
xorl %edx, %ecx
orl %eax, %ecx
je 0x2e8e
cmpb $0x0, 0x30(%rsp)
je 0x2ce7
movl 0x30(%rsp), %eax
movl $0x74697865, %ecx       # imm = 0x74697865
xorl %ecx, %eax
movzbl 0x34(%rsp), %ecx
orl %eax, %ecx
je 0x2ee7
movq %rsp, %rdi
movq %r14, %rsi
callq 0x2f09
movsd 0x20(%rsp), %xmm0
leaq 0x1764d(%rip), %rdi     # 0x1a4cf
movb $0x1, %al
callq 0x9051
jmp 0x2ce7
leaq 0x1786e(%rip), %rdi     # 0x1a703
xorl %eax, %eax
callq 0x9051
leaq 0x17885(%rip), %rdi     # 0x1a728
xorl %eax, %eax
callq 0x9051
leaq 0x178cb(%rip), %rdi     # 0x1a77c
xorl %eax, %eax
callq 0x9051
leaq 0x17911(%rip), %rdi     # 0x1a7d0
xorl %eax, %eax
callq 0x9051
leaq 0x17926(%rip), %rdi     # 0x1a7f3
xorl %eax, %eax
callq 0x9051
leaq 0x17931(%rip), %rdi     # 0x1a80c
xorl %eax, %eax
callq 0x9051
jmp 0x2ce7
leaq 0x17437(%rip), %rdi     # 0x1a325
xorl %eax, %eax
callq 0x9051
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq