// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20d0
leaq 0x24826(%rip), %rax     # 0x277a8
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x215ee(%rip), %rdi     # 0x24580
movb $0x0, %al
callq 0xbcf0
leaq 0x215e8(%rip), %rdi     # 0x24588
movb $0x0, %al
callq 0xbcf0
leaq 0x21618(%rip), %rdi     # 0x245c6
movb $0x0, %al
callq 0xbcf0
leaq 0x21648(%rip), %rdi     # 0x24604
movb $0x0, %al
callq 0xbcf0
leaq 0x215b6(%rip), %rdi     # 0x24580
movb $0x0, %al
callq 0xbcf0
leaq 0x2166a(%rip), %rdi     # 0x24642
movb $0x0, %al
callq 0xbcf0
leaq 0x2159a(%rip), %rdi     # 0x24580
movb $0x0, %al
callq 0xbcf0
leaq -0x100(%rbp), %rdi
xorl %esi, %esi
movl $0xc8, %edx
callq 0x20d0
leaq 0x2165e(%rip), %rdi     # 0x24665
movb $0x0, %al
callq 0xbcf0
leaq -0x100(%rbp), %rdi
movq 0x2bfbc(%rip), %rax     # 0x2efd8
movq (%rax), %rdx
movl $0xc8, %esi
callq 0x2110
movq %rax, %rdi
callq 0xb940
leaq 0x25d2b(%rip), %rdi     # 0x28d63
movb $0x0, %al
callq 0xbcf0
leaq -0x100(%rbp), %rdi
leaq 0x21622(%rip), %rsi     # 0x2466f
movl $0xc8, %edx
callq 0x2050
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x30b8
leaq 0x2160e(%rip), %rdi     # 0x24674
movb $0x0, %al
callq 0xbcf0
leaq 0x2160a(%rip), %rdi     # 0x2467e
movb $0x0, %al
callq 0xbcf0
leaq 0x21620(%rip), %rdi     # 0x246a2
movb $0x0, %al
callq 0xbcf0
leaq 0x21634(%rip), %rdi     # 0x246c4
movb $0x0, %al
callq 0xbcf0
leaq 0x2164c(%rip), %rdi     # 0x246ea
movb $0x0, %al
callq 0xbcf0
leaq 0x2165d(%rip), %rdi     # 0x24709
movb $0x0, %al
callq 0xbcf0
jmp 0x3000
leaq -0x100(%rbp), %rdi
leaq 0x21658(%rip), %rsi     # 0x2471e
movl $0xc8, %edx
callq 0x2050
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x30e6
leaq -0x30(%rbp), %rdi
callq 0x3190
jmp 0x3000
leaq -0x100(%rbp), %rdi
leaq 0x2162e(%rip), %rsi     # 0x24722
movl $0xc8, %edx
callq 0x2050
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x3110
callq 0x3270
jmp 0x3000
movsbl -0x100(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x3122
jmp 0x3000
leaq -0x100(%rbp), %rdi
leaq 0x215f9(%rip), %rsi     # 0x24729
movl $0xc8, %edx
callq 0x2050
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x315b
leaq 0x21437(%rip), %rdi     # 0x24580
movb $0x0, %al
callq 0xbcf0
xorl %eax, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
leaq -0x100(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x32d0
movsd -0x10(%rbp), %xmm0
leaq 0x215b7(%rip), %rdi     # 0x2472e
movb $0x1, %al
callq 0xbcf0
jmp 0x3000
nopw %cs:(%rax,%rax)