#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char **);
scalar_t__ strcmp(char *, char *);
int main(void) {
  printf("----SCIENTIFIC CALCULATOR----\n\n");
  printf("Enter QUIT to stop\n");
  char str[20];
  double answer;
  while (1) {
    printf("Enter a command: ");
    scanf("%s", &str);
    if (strcmp(str, "QUIT") == 0)
      break;
    else if (strcmp(str, "Quit") == 0)
      break;
    else if (strcmp(str, "quit") == 0)
      break;
    printf("%lf\n", answer);
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xed2(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x20(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1198 <main+0x68>
jmp    11f8 <main+0xc8>
lea    -0x20(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b7 <main+0x87>
jmp    11f8 <main+0xc8>
lea    -0x20(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11d6 <main+0xa6>
jmp    11f8 <main+0xc8>
jmp    11db <main+0xab>
jmp    11e0 <main+0xb0>
movsd  -0x28(%rbp),%xmm0
lea    0xe6c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    115b <main+0x2b>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe97(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1213 <main+0xd3>
lea    0xe79(%rip),%r14
mov    %rsp,%rbx
lea    0xe74(%rip),%r15
lea    0xe4e(%rip),%r13
lea    0xe59(%rip),%rbp
lea    0xe55(%rip),%r12
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1213 <main+0xd3>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1213 <main+0xd3>
lea    0xe3d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11c0 <main+0x80>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"----SCIENTIFIC CALCULATOR----\0A\0A\00"
@.str.1 = [20 x i8] c"Enter QUIT to stop\0A\00"
@.str.2 = [18 x i8] c"Enter a command: \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [5 x i8] c"QUIT\00"
@.str.5 = [5 x i8] c"Quit\00"
@.str.6 = [5 x i8] c"quit\00"
@.str.7 = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %0, %26
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%8 = bitcast [20 x i8]* %2 to i8**
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %8)
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %6
br label %29
14: ; preds = %6
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
br label %29
19: ; preds = %14
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %19
br label %29
24: ; preds = %19
br label %25
25: ; preds = %24
br label %26
26: ; preds = %25
%27 = load double, double* %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), double %27)
br label %6
29: ; preds = %23, %18, %13
ret i32 1
}

LLVM IR (-O2):
@.str.2 = [18 x i8] c"Enter a command: \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [5 x i8] c"QUIT\00"
@.str.5 = [5 x i8] c"Quit\00"
@.str.6 = [5 x i8] c"quit\00"
@.str.7 = [5 x i8] c"%lf\0A\00"
@str = [31 x i8] c"----SCIENTIFIC CALCULATOR----\0A\00"
@str.8 = [19 x i8] c"Enter QUIT to stop\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.8, i64 0, i64 0))
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%6 = bitcast [20 x i8]* %1 to i8**
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %6)
%8 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %22, label %10
10: ; preds = %0, %16
%11 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %22, label %13
13: ; preds = %10
%14 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), double undef)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %6)
%20 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %10
22: ; preds = %16, %10, %13, %0
ret i32 1
}