#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 f_calculate(int);
int /*<<< orphan*/ printf(char *);
int main() {
  printf("------------------------------------------------------|\n");
  printf("|Calculation Program                                  |\n");
  printf("|                                                     |\n");
  printf("|Use:                                                 |\n");
  printf("|Input a triad formated as follows                    |\n");
  printf("|NUMBER FORMULA NUMBER                                |\n");
  printf("|Formula: + for addition, - for deduction             |\n");
  printf("| * for multiplication and  / for division            |\n");
  printf("|Be careful. Only one space is allowed between them   |\n");
  printf("|Example 0.75 * -2                                    |\n");
  printf("|-----------------------------------------------------|\n");
  printf("\n");
  int i = 0;
  while (i == 0) {
    int ret;
    ret = f_calculate(i);
    i = ret;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
call   1030 <printf@plt>
lea    0xf24(%rip),%rdi
call   1030 <printf@plt>
lea    0xf51(%rip),%rdi
call   1030 <printf@plt>
lea    0xf7e(%rip),%rdi
call   1030 <printf@plt>
lea    0xfab(%rip),%rdi
call   1030 <printf@plt>
lea    0xfd8(%rip),%rdi
call   1030 <printf@plt>
lea    0x1005(%rip),%rdi
call   1030 <printf@plt>
lea    0x1032(%rip),%rdi
call   1030 <printf@plt>
lea    0x105f(%rip),%rdi
call   1030 <printf@plt>
lea    0x108c(%rip),%rdi
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11e6 <main+0xc6>
mov    -0x8(%rbp),%edi
call   1040 <f_calculate@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11c6 <main+0xa6>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
lea    0xef4(%rip),%rdi
call   1040 <puts@plt>
lea    0xf20(%rip),%rdi
call   1040 <puts@plt>
lea    0xf4c(%rip),%rdi
call   1040 <puts@plt>
lea    0xf78(%rip),%rdi
call   1040 <puts@plt>
lea    0xfa4(%rip),%rdi
call   1040 <puts@plt>
lea    0xfd0(%rip),%rdi
call   1040 <puts@plt>
lea    0xffc(%rip),%rdi
call   1040 <puts@plt>
lea    0x1028(%rip),%rdi
call   1040 <puts@plt>
lea    0x1054(%rip),%rdi
call   1040 <puts@plt>
lea    0x1080(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
nop
xor    %edi,%edi
call   1050 <f_calculate@plt>
test   %eax,%eax
je     11c0 <main+0x90>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [57 x i8] c"------------------------------------------------------|\0A\00"
@.str.1 = [57 x i8] c"|Calculation Program |\0A\00"
@.str.2 = [57 x i8] c"| |\0A\00"
@.str.3 = [57 x i8] c"|Use: |\0A\00"
@.str.4 = [57 x i8] c"|Input a triad formated as follows |\0A\00"
@.str.5 = [57 x i8] c"|NUMBER FORMULA NUMBER |\0A\00"
@.str.6 = [57 x i8] c"|Formula: + for addition, - for deduction |\0A\00"
@.str.7 = [57 x i8] c"| * for multiplication and / for division |\0A\00"
@.str.8 = [57 x i8] c"|Be careful. Only one space is allowed between them |\0A\00"
@.str.9 = [57 x i8] c"|Example 0.75 * -2 |\0A\00"
@.str.10 = [57 x i8] c"|-----------------------------------------------------|\0A\00"
@.str.11 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.10, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %2
br label %16
16: ; preds = %19, %0
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %2
%21 = call i32 @f_calculate(i32 %20)
store i32 %21, i32* %3
%22 = load i32, i32* %3
store i32 %22, i32* %2
br label %16
23: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@str = [56 x i8] c"------------------------------------------------------|\00"
@str.12 = [56 x i8] c"|Calculation Program |\00"
@str.13 = [56 x i8] c"| |\00"
@str.14 = [56 x i8] c"|Use: |\00"
@str.15 = [56 x i8] c"|Input a triad formated as follows |\00"
@str.16 = [56 x i8] c"|NUMBER FORMULA NUMBER |\00"
@str.17 = [56 x i8] c"|Formula: + for addition, - for deduction |\00"
@str.18 = [56 x i8] c"| * for multiplication and / for division |\00"
@str.19 = [56 x i8] c"|Be careful. Only one space is allowed between them |\00"
@str.20 = [56 x i8] c"|Example 0.75 * -2 |\00"
@str.21 = [56 x i8] c"|-----------------------------------------------------|\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.12, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.13, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.14, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.15, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.16, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.17, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.18, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.19, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.20, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.21, i64 0, i64 0))
%12 = tail call i32 @putchar(i32 10)
br label %13
13: ; preds = %0, %13
%14 = tail call i32 @f_calculate(i32 0)
%15 = icmp eq i32 %14, 0
br i1 %15, label %13, label %16
16: ; preds = %13
ret i32 0
}