#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 *, float *, char *, float *);
int main() {
  float a, c;
  char b;
  float result;
  int ok = 0;
  do {
    ok = 1;
    a = c = result = 0.0f;
    printf("Dwste thn praksh me th morfh:\n (arithmos) (praksh) (arithmos), "
           "xwris tis parentheseis kai pieste enter\n");
    scanf("%f %c %f", &a, &b, &c);
    switch (b) {
    case '+': {
      result = a + c;
      break;
    }
    case '*': {
      result = a * c;
      break;
    }
    case '/': {
      if (c == 0) {
        printf("Diairesh me to 0! Parakalw ksanaprospathiste ->\n");
        ok = 0;
        break;
      }
      result = a / c;
      break;
    }
    default: {
      printf("Dwsate lathos praksh! Parakalw ksanaprospathiste ->\n");
      ok = 0;
      break;
    }
    }
  } while (!ok);
  printf("To apotelesma einai %f %c %f = %f \n", a, b, c, result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xd(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0xd(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x2a,%eax
je     11c3 <main+0xa3>
jmp    118d <main+0x6d>
mov    -0x1c(%rbp),%eax
sub    $0x2b,%eax
je     11af <main+0x8f>
jmp    119e <main+0x7e>
mov    -0x1c(%rbp),%eax
sub    $0x2f,%eax
je     11d7 <main+0xb7>
jmp    121c <main+0xfc>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1231 <main+0x111>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1231 <main+0x111>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1208 <main+0xe8>
jp     1208 <main+0xe8>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
jmp    1231 <main+0x111>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1231 <main+0x111>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
jmp    1236 <main+0x116>
cmpl   $0x0,-0x18(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1136 <main+0x16>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsbl -0xd(%rbp),%esi
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x14(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe6a(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%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    0xeec(%rip),%r14
lea    0xeb8(%rip),%r15
lea    0x14(%rsp),%r12
lea    0xf(%rsp),%r13
lea    0x10(%rsp),%rbx
lea    0xf66(%rip),%rbp
jmp    118d <main+0x5d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  0x10(%rsp),%xmm1
ucomiss 0xe83(%rip),%xmm1
lea    0xf14(%rip),%rdi
jne    11e2 <main+0xb2>
jp     11e2 <main+0xb2>
call   1030 <puts@plt>
movl   $0x0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%esi
cmp    $0x2f,%esi
je     1170 <main+0x40>
cmp    $0x2a,%esi
je     11f1 <main+0xc1>
mov    %rbp,%rdi
cmp    $0x2b,%esi
jne    1188 <main+0x58>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movaps %xmm0,%xmm2
addss  %xmm1,%xmm2
jmp    1204 <main+0xd4>
movss  0x14(%rsp),%xmm0
movaps %xmm0,%xmm2
divss  %xmm1,%xmm2
jmp    1204 <main+0xd4>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movaps %xmm0,%xmm2
mulss  %xmm1,%xmm2
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
lea    0xdf6(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [104 x i8] c"Dwste thn praksh me th morfh:\0A (arithmos) (praksh) (arithmos), xwris tis parentheseis kai pieste enter\0A\00"
@.str.1 = [9 x i8] c"%f %c %f\00"
@.str.2 = [49 x i8] c"Diairesh me to 0! Parakalw ksanaprospathiste ->\0A\00"
@.str.3 = [53 x i8] c"Dwsate lathos praksh! Parakalw ksanaprospathiste ->\0A\00"
@.str.4 = [36 x i8] c"To apotelesma einai %f %c %f = %f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i8
%5 = alloca float
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
br label %7
7: ; preds = %32, %0
store i32 1, i32* %6
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %2, i8* %4, float* %3)
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
switch i32 %11, label %29 [
i32 43, label %12
i32 42, label %16
i32 47, label %20
]
12: ; preds = %7
%13 = load float, float* %2
%14 = load float, float* %3
%15 = fadd float %13, %14
store float %15, float* %5
br label %31
16: ; preds = %7
%17 = load float, float* %2
%18 = load float, float* %3
%19 = fmul float %17, %18
store float %19, float* %5
br label %31
20: ; preds = %7
%21 = load float, float* %3
%22 = fcmp oeq float %21, 0.000000e+00
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %31
25: ; preds = %20
%26 = load float, float* %2
%27 = load float, float* %3
%28 = fdiv float %26, %27
store float %28, float* %5
br label %31
29: ; preds = %7
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
br label %31
31: ; preds = %29, %25, %23, %16, %12
br label %32
32: ; preds = %31
%33 = load i32, i32* %6
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
br i1 %35, label %7, label %36
36: ; preds = %32
%37 = load float, float* %2
%38 = fpext float %37 to double
%39 = load i8, i8* %4
%40 = sext i8 %39 to i32
%41 = load float, float* %3
%42 = fpext float %41 to double
%43 = load float, float* %5
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), double %38, i32 %40, double %42, double %44)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%f %c %f\00"
@.str.4 = [36 x i8] c"To apotelesma einai %f %c %f = %f \0A\00"
@str = [103 x i8] c"Dwste thn praksh me th morfh:\0A (arithmos) (praksh) (arithmos), xwris tis parentheseis kai pieste enter\00"
@str.5 = [48 x i8] c"Diairesh me to 0! Parakalw ksanaprospathiste ->\00"
@str.6 = [52 x i8] c"Dwsate lathos praksh! Parakalw ksanaprospathiste ->\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca i8
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
br label %6
6: ; preds = %25, %0
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %1
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %1, i8* %3, float* %2)
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
switch i32 %10, label %25 [
i32 43, label %11
i32 42, label %15
i32 47, label %19
]
11: ; preds = %6
%12 = load float, float* %1
%13 = load float, float* %2
%14 = fadd float %12, %13
br label %28
15: ; preds = %6
%16 = load float, float* %1
%17 = load float, float* %2
%18 = fmul float %16, %17
br label %28
19: ; preds = %6
%20 = load float, float* %2
%21 = fcmp oeq float %20, 0.000000e+00
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load float, float* %1
%24 = fdiv float %23, %20
br label %28
25: ; preds = %6, %19
%26 = phi i8* [ getelementptr inbounds ([48 x i8], [48 x i8]* @str.5, i64 0, i64 0), %19 ], [ getelementptr inbounds ([52 x i8], [52 x i8]* @str.6, i64 0, i64 0), %6 ]
%27 = call i32 @puts(i8* dereferenceable(1) %26)
br label %6
28: ; preds = %22, %15, %11
%29 = phi float [ %13, %11 ], [ %17, %15 ], [ %20, %22 ]
%30 = phi float [ %12, %11 ], [ %16, %15 ], [ %23, %22 ]
%31 = phi float [ %14, %11 ], [ %18, %15 ], [ %24, %22 ]
%32 = sext i8 %9 to i32
%33 = fpext float %30 to double
%34 = fpext float %29 to double
%35 = fpext float %31 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), double %33, i32 %32, double %34, double %35)
ret i32 0
}