#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*/ Mid_post(char *, char *);
double Postcount(char *);
int /*<<< orphan*/ ReadFile(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
void main() {
  char expression[400], Bexpression[400];
  char c;
  int i = 0, j = 0;
  while (1) {
    i = 0;
    j = 0;
    printf("--> ");
    c = getchar();
    while (c != '#') {
      expression[j] = c;
      j++;
      c = getchar();
    }
    getchar();
    expression[j] = '#';
    expression[j + 1] = '\0';
    if (strcmp(expression, "exit#") == 0) {
      exit(0);
    } else if (expression[0] == 'r' && expression[1] == 'e' &&
               expression[2] == 'a' && expression[3] == 'd') {
      ReadFile(expression);
    } else if (strcmp(expression, "clear#") == 0) {
      system("cls");
      continue;
    }
    Mid_post(expression, Bexpression);
    if (strcmp(Bexpression, "input") == 0) {
      continue;
    }
    printf("Expression:   ");
    while (Bexpression[i] != '\0') {
      if (Bexpression[i] != ' ')
        printf("%c", Bexpression[i]);
      i++;
    }
    printf("\n           =  %-f\n", Postcount(Bexpression));
  }
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x330,%rsp
movl   $0x0,-0x328(%rbp)
movl   $0x0,-0x32c(%rbp)
movl   $0x0,-0x328(%rbp)
movl   $0x0,-0x32c(%rbp)
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %al,-0x321(%rbp)
movsbl -0x321(%rbp),%eax
cmp    $0x23,%eax
je     1213 <main+0x93>
mov    -0x321(%rbp),%cl
movslq -0x32c(%rbp),%rax
mov    %cl,-0x190(%rbp,%rax,1)
mov    -0x32c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x32c(%rbp)
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %al,-0x321(%rbp)
jmp    11ce <main+0x4e>
mov    $0x0,%al
call   1070 <getchar@plt>
movslq -0x32c(%rbp),%rax
movb   $0x23,-0x190(%rbp,%rax,1)
23
mov    -0x32c(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x190(%rbp,%rax,1)
lea    -0x190(%rbp),%rdi
lea    0xdbb(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1260 <main+0xe0>
xor    %edi,%edi
call   1090 <exit@plt>
movsbl -0x190(%rbp),%eax
cmp    $0x72,%eax
jne    12b1 <main+0x131>
movsbl -0x18f(%rbp),%eax
cmp    $0x65,%eax
jne    12b1 <main+0x131>
movsbl -0x18e(%rbp),%eax
cmp    $0x61,%eax
jne    12b1 <main+0x131>
movsbl -0x18d(%rbp),%eax
cmp    $0x64,%eax
jne    12b1 <main+0x131>
lea    -0x190(%rbp),%rdi
call   1030 <ReadFile@plt>
jmp    12e4 <main+0x164>
lea    -0x190(%rbp),%rdi
lea    0xd4c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12df <main+0x15f>
lea    0xd3d(%rip),%rdi
call   1040 <system@plt>
jmp    119f <main+0x1f>
jmp    12e4 <main+0x164>
jmp    12e9 <main+0x169>
lea    -0x190(%rbp),%rdi
lea    -0x320(%rbp),%rsi
call   10a0 <Mid_post@plt>
lea    -0x320(%rbp),%rdi
lea    0xd0c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    131e <main+0x19e>
jmp    119f <main+0x1f>
lea    0xcf7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x328(%rbp),%rax
movsbl -0x320(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     138d <main+0x20d>
movslq -0x328(%rbp),%rax
movsbl -0x320(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
je     1379 <main+0x1f9>
movslq -0x328(%rbp),%rax
movsbl -0x320(%rbp,%rax,1),%esi
ff
lea    0xcb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x328(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x328(%rbp)
jmp    132c <main+0x1ac>
lea    -0x320(%rbp),%rdi
call   1080 <Postcount@plt>
lea    0xc8e(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    119f <main+0x1f>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x328,%rsp
lea    0xe58(%rip),%r14
lea    0xe56(%rip),%r15
mov    %rsp,%rbx
lea    0x190(%rsp),%r12
lea    0xe55(%rip),%r13
jmp    11d0 <main+0x40>
lea    0xe48(%rip),%rdi
call   1050 <system@plt>
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
mov    $0x0,%ebp
cmp    $0x23,%al
je     1202 <main+0x72>
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %al,(%rsp,%rbp,1)
add    $0x1,%rbp
xor    %eax,%eax
call   1080 <getchar@plt>
cmp    $0x23,%al
jne    11f0 <main+0x60>
xor    %eax,%eax
call   1080 <getchar@plt>
mov    %ebp,%eax
movw   $0x23,(%rsp,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12c2 <main+0x132>
movdqa (%rsp),%xmm0
movd   %xmm0,%eax
mov    %rbx,%rdi
cmp    $0x64616572,%eax
jne    1240 <main+0xb0>
call   1040 <ReadFile@plt>
jmp    1255 <main+0xc5>
nop
lea    0xdc4(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11c3 <main+0x33>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10b0 <Mid_post@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11d0 <main+0x40>
lea    0xda1(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rbp
jmp    1299 <main+0x109>
nopw   0x0(%rax,%rax,1)
call   1030 <putchar@plt>
add    $0x1,%rbp
movsbl 0x0(%rbp),%edi
cmp    $0x20,%edi
je     1295 <main+0x105>
test   %dil,%dil
jne    1290 <main+0x100>
mov    %r12,%rdi
call   1090 <Postcount@plt>
lea    0xd75(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
jmp    11d0 <main+0x40>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"--> \00"
@.str.1 = [6 x i8] c"exit#\00"
@.str.2 = [7 x i8] c"clear#\00"
@.str.3 = [4 x i8] c"cls\00"
@.str.4 = [6 x i8] c"input\00"
@.str.5 = [15 x i8] c"Expression: \00"
@.str.6 = [3 x i8] c"%c\00"
@.str.7 = [20 x i8] c"\0A = %-f\0A\00"
define void @main() {
%1 = alloca [400 x i8]
%2 = alloca [400 x i8]
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %0, %62, %73, %100
store i32 0, i32* %4
store i32 0, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = call signext i8 (...) @getchar()
store i8 %8, i8* %3
br label %9
9: ; preds = %13, %6
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 35
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = load i8, i8* %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 %16
store i8 %14, i8* %17
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
%20 = call signext i8 (...) @getchar()
store i8 %20, i8* %3
br label %9
21: ; preds = %9
%22 = call signext i8 (...) @getchar()
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 %24
store i8 35, i8* %25
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 %28
store i8 0, i8* %29
%30 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 0
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %21
%34 = call i32 @exit(i32 0)
unreachable
35: ; preds = %21
%36 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 0
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 114
br i1 %39, label %40, label %58
40: ; preds = %35
%41 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 1
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 101
br i1 %44, label %45, label %58
45: ; preds = %40
%46 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 2
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 97
br i1 %49, label %50, label %58
50: ; preds = %45
%51 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 3
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %53, 100
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 0
%57 = call i32 @ReadFile(i8* %56)
br label %65
58: ; preds = %50, %45, %40, %35
%59 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 0
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %6
64: ; preds = %58
br label %65
65: ; preds = %64, %55
br label %66
66: ; preds = %65
%67 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 0
%68 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%69 = call i32 @Mid_post(i8* %67, i8* %68)
%70 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%71 = call i64 @strcmp(i8* %70, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %66
br label %6
74: ; preds = %66
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %76
76: ; preds = %97, %74
%77 = load i32, i32* %4
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 %78
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %100
83: ; preds = %76
%84 = load i32, i32* %4
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 %85
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = icmp ne i32 %88, 32
br i1 %89, label %90, label %97
90: ; preds = %83
%91 = load i32, i32* %4
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 %92
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %95)
br label %97
97: ; preds = %90, %83
%98 = load i32, i32* %4
%99 = add nsw i32 %98, 1
store i32 %99, i32* %4
br label %76
100: ; preds = %76
%101 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%102 = call double @Postcount(i8* %101)
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), double %102)
br label %6
}

LLVM IR (-O2):
@.str = [5 x i8] c"--> \00"
@.str.1 = [6 x i8] c"exit#\00"
@.str.2 = [7 x i8] c"clear#\00"
@.str.3 = [4 x i8] c"cls\00"
@.str.4 = [6 x i8] c"input\00"
@.str.5 = [15 x i8] c"Expression: \00"
@.str.7 = [20 x i8] c"\0A = %-f\0A\00"
define void @main() {
%1 = alloca [400 x i8]
%2 = alloca [400 x i8]
%3 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%5 = bitcast [400 x i8]* %1 to <4 x i8>*
br label %6
6: ; preds = %43, %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = call signext i8 (...) @getchar()
%9 = icmp eq i8 %8, 35
br i1 %9, label %19, label %10
10: ; preds = %6, %10
%11 = phi i64 [ %14, %10 ], [ 0, %6 ]
%12 = phi i8 [ %15, %10 ], [ %8, %6 ]
%13 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 %11
store i8 %12, i8* %13
%14 = add nuw i64 %11, 1
%15 = call signext i8 (...) @getchar()
%16 = icmp eq i8 %15, 35
br i1 %16, label %17, label %10
17: ; preds = %10
%18 = trunc i64 %14 to i32
br label %19
19: ; preds = %17, %6
%20 = phi i32 [ 0, %6 ], [ %18, %17 ]
%21 = call signext i8 (...) @getchar()
%22 = zext i32 %20 to i64
%23 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 %22
store i8 35, i8* %23
%24 = add nuw nsw i32 %20, 1
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 %25
store i8 0, i8* %26
%27 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %19
%30 = call i32 @exit(i32 0)
unreachable
31: ; preds = %19
%32 = load <4 x i8>, <4 x i8>* %5
%33 = freeze <4 x i8> %32
%34 = bitcast <4 x i8> %33 to i32
%35 = icmp eq i32 %34, 1684104562
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 @ReadFile(i8* %3)
br label %44
38: ; preds = %31
%39 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %41, %59, %44
br label %6
44: ; preds = %36, %38
%45 = call i32 @Mid_post(i8* %3, i8* %4)
%46 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %43, label %48
48: ; preds = %44
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %50
50: ; preds = %57, %48
%51 = phi i64 [ %58, %57 ], [ 0, %48 ]
%52 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 %51
%53 = load i8, i8* %52
switch i8 %53, label %54 [
i8 0, label %59
i8 32, label %57
]
54: ; preds = %50
%55 = sext i8 %53 to i32
%56 = call i32 @putchar(i32 %55)
br label %57
57: ; preds = %50, %54
%58 = add nuw i64 %51, 1
br label %50
59: ; preds = %50
%60 = call double @Postcount(i8* %4)
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), double %60)
br label %43
}