#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *, char *, float *);
int main() {
  float a, b;
  char ch;
  printf("Dwse arithmo praji arithmo: ");
  scanf("%f %c %f", &a, &ch, &b);
  if (ch == '+') {
    printf("apotelesma %f", a + b);
  } else if (ch == '-') {
    printf("apotelesma %f", a - b);
  } else if (ch == '*') {
    printf("apotelesma %f", a * b);
  } else if ((ch == '/') && (b != 0)) {
    printf("apotelesma %f", a / b);
  } else if ((ch == '/') && (b == 0)) {
    printf("Sfalma! Diairesi me to mhden!");
    exit(1);
  } else {
    printf("Lathos praji");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xd(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0x2b,%eax
jne    1193 <main+0x63>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1297 <main+0x167>
movsbl -0xd(%rbp),%eax
cmp    $0x2d,%eax
jne    11c1 <main+0x91>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe71(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1292 <main+0x162>
movsbl -0xd(%rbp),%eax
cmp    $0x2a,%eax
jne    11ef <main+0xbf>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe43(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    128d <main+0x15d>
movsbl -0xd(%rbp),%eax
cmp    $0x2f,%eax
jne    1239 <main+0x109>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1218 <main+0xe8>
jp     1218 <main+0xe8>
jmp    1239 <main+0x109>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1288 <main+0x158>
movsbl -0xd(%rbp),%eax
cmp    $0x2f,%eax
jne    1275 <main+0x145>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1275 <main+0x145>
jp     1275 <main+0x145>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1288 <main+0x158>
jmp    128d <main+0x15d>
jmp    1292 <main+0x162>
jmp    1297 <main+0x167>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0xf(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1040 <scanf@plt>
mov    0xf(%rsp),%al
cmp    $0x2a,%al
je     117b <main+0x4b>
cmp    $0x2d,%al
je     1189 <main+0x59>
cmp    $0x2b,%al
jne    11ae <main+0x7e>
movss  0x14(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
jmp    1195 <main+0x65>
movss  0x14(%rsp),%xmm0
mulss  0x10(%rsp),%xmm0
jmp    1195 <main+0x65>
movss  0x14(%rsp),%xmm0
subss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe86(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
movss  0x10(%rsp),%xmm0
cmp    $0x2f,%al
jne    11d5 <main+0xa5>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11c2 <main+0x92>
jnp    11d5 <main+0xa5>
movss  0x14(%rsp),%xmm1
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
jmp    1199 <main+0x69>
cmp    $0x2f,%al
jne    11e3 <main+0xb3>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11e3 <main+0xb3>
jnp    11f3 <main+0xc3>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11a7 <main+0x77>
lea    0xe3a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Dwse arithmo praji arithmo: \00"
@.str.1 = [9 x i8] c"%f %c %f\00"
@.str.2 = [14 x i8] c"apotelesma %f\00"
@.str.3 = [30 x i8] c"Sfalma! Diairesi me to mhden!\00"
@.str.4 = [13 x i8] c"Lathos praji\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %2, i8* %4, float* %3)
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 43
br i1 %9, label %10, label %16
10: ; preds = %0
%11 = load float, float* %2
%12 = load float, float* %3
%13 = fadd float %11, %12
%14 = fpext float %13 to double
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %14)
br label %65
16: ; preds = %0
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 45
br i1 %19, label %20, label %26
20: ; preds = %16
%21 = load float, float* %2
%22 = load float, float* %3
%23 = fsub float %21, %22
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %24)
br label %64
26: ; preds = %16
%27 = load i8, i8* %4
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 42
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = load float, float* %2
%32 = load float, float* %3
%33 = fmul float %31, %32
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %34)
br label %63
36: ; preds = %26
%37 = load i8, i8* %4
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 47
br i1 %39, label %40, label %49
40: ; preds = %36
%41 = load float, float* %3
%42 = fcmp une float %41, 0.000000e+00
br i1 %42, label %43, label %49
43: ; preds = %40
%44 = load float, float* %2
%45 = load float, float* %3
%46 = fdiv float %44, %45
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %47)
br label %62
49: ; preds = %40, %36
%50 = load i8, i8* %4
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 47
br i1 %52, label %53, label %59
53: ; preds = %49
%54 = load float, float* %3
%55 = fcmp oeq float %54, 0.000000e+00
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %53, %49
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %61
61: ; preds = %59
br label %62
62: ; preds = %61, %43
br label %63
63: ; preds = %62, %30
br label %64
64: ; preds = %63, %20
br label %65
65: ; preds = %64, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Dwse arithmo praji arithmo: \00"
@.str.1 = [9 x i8] c"%f %c %f\00"
@.str.2 = [14 x i8] c"apotelesma %f\00"
@.str.3 = [30 x i8] c"Sfalma! Diairesi me to mhden!\00"
@.str.4 = [13 x i8] c"Lathos praji\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*
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %1, i8* %3, float* %2)
%8 = load i8, i8* %3
switch i8 %8, label %27 [
i8 43, label %9
i8 45, label %15
i8 42, label %21
]
9: ; preds = %0
%10 = load float, float* %1
%11 = load float, float* %2
%12 = fadd float %10, %11
%13 = fpext float %12 to double
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %13)
br label %45
15: ; preds = %0
%16 = load float, float* %1
%17 = load float, float* %2
%18 = fsub float %16, %17
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %19)
br label %45
21: ; preds = %0
%22 = load float, float* %1
%23 = load float, float* %2
%24 = fmul float %22, %23
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %25)
br label %45
27: ; preds = %0
%28 = icmp eq i8 %8, 47
%29 = load float, float* %2
%30 = fcmp une float %29, 0.000000e+00
%31 = select i1 %28, i1 %30, i1 false
br i1 %31, label %32, label %37
32: ; preds = %27
%33 = load float, float* %1
%34 = fdiv float %33, %29
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %35)
br label %45
37: ; preds = %27
%38 = fcmp oeq float %29, 0.000000e+00
%39 = select i1 %28, i1 %38, i1 false
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %37
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %45
45: ; preds = %15, %32, %43, %21, %9
ret i32 0
}