#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 *, ...);
void main() {
  char a;
  float b, c, d;
  printf("dwse arithmo praji arithmo \n");
  scanf("%f %c %f", &b, &a, &c);
  if (a == '+') {
    d = b + c;
    printf("Apotelesma= %f\n", d);
  } else if (a == '-') {
    d = b - c;
    printf("Apotelesma= %f\n", d);
  } else if (a == '*') {
    d = b * c;
    printf("Apotelesma= %f\n", d);
  } else {
    while (c == 0) {
      printf(
          "edoses 0 gia diaireti, parakalw dwse ton diaireti diaforo tou 0\n");
      scanf("%f", &c);
    }
    d = b / c;
    printf("Apotelesma= %f\n", d);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x1(%rbp),%rdx
lea    -0xc(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x2b,%eax
jne    1188 <main+0x68>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeaa(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1269 <main+0x149>
movsbl -0x1(%rbp),%eax
cmp    $0x2d,%eax
jne    11c0 <main+0xa0>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe72(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1264 <main+0x144>
movsbl -0x1(%rbp),%eax
cmp    $0x2a,%eax
jne    11f8 <main+0xd8>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    125f <main+0x13f>
jmp    11fd <main+0xdd>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1239 <main+0x119>
jp     1239 <main+0x119>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdfa(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    11fd <main+0xdd>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdce(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1264 <main+0x144>
jmp    1269 <main+0x149>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x7(%rsp),%rdx
lea    0x8(%rsp),%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x7(%rsp),%al
cmp    $0x2a,%al
je     1180 <main+0x50>
cmp    $0x2b,%al
je     118e <main+0x5e>
cmp    $0x2d,%al
jne    119c <main+0x6c>
movss  0xc(%rsp),%xmm0
subss  0x8(%rsp),%xmm0
jmp    11ef <main+0xbf>
movss  0xc(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
jmp    11ef <main+0xbf>
movss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
jmp    11ef <main+0xbf>
movss  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jne    11e5 <main+0xb5>
jp     11e5 <main+0xb5>
lea    0xe82(%rip),%r14
lea    0xe4c(%rip),%r15
lea    0x8(%rsp),%rbx
nop
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
movss  0x8(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jne    11e5 <main+0xb5>
jnp    11c0 <main+0x90>
movss  0xc(%rsp),%xmm0
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [29 x i8] c"dwse arithmo praji arithmo \0A\00"
@.str.1 = [9 x i8] c"%f %c %f\00"
@.str.2 = [16 x i8] c"Apotelesma= %f\0A\00"
@.str.3 = [65 x i8] c"edoses 0 gia diaireti, parakalw dwse ton diaireti diaforo tou 0\0A\00"
@.str.4 = [3 x i8] c"%f\00"
define void @main() {
%1 = alloca i8
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %2, i8* %1, float* %3)
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 43
br i1 %9, label %10, label %17
10: ; preds = %0
%11 = load float, float* %2
%12 = load float, float* %3
%13 = fadd float %11, %12
store float %13, float* %4
%14 = load float, float* %4
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %15)
br label %55
17: ; preds = %0
%18 = load i8, i8* %1
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 45
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load float, float* %2
%23 = load float, float* %3
%24 = fsub float %22, %23
store float %24, float* %4
%25 = load float, float* %4
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %26)
br label %54
28: ; preds = %17
%29 = load i8, i8* %1
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 42
br i1 %31, label %32, label %39
32: ; preds = %28
%33 = load float, float* %2
%34 = load float, float* %3
%35 = fmul float %33, %34
store float %35, float* %4
%36 = load float, float* %4
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %37)
br label %53
39: ; preds = %28
br label %40
40: ; preds = %43, %39
%41 = load float, float* %3
%42 = fcmp oeq float %41, 0.000000e+00
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0))
%45 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
br label %40
46: ; preds = %40
%47 = load float, float* %2
%48 = load float, float* %3
%49 = fdiv float %47, %48
store float %49, float* %4
%50 = load float, float* %4
%51 = fpext float %50 to double
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %51)
br label %53
53: ; preds = %46, %32
br label %54
54: ; preds = %53, %21
br label %55
55: ; preds = %54, %10
ret void
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%f %c %f\00"
@.str.2 = [16 x i8] c"Apotelesma= %f\0A\00"
@.str.4 = [3 x i8] c"%f\00"
@str = [28 x i8] c"dwse arithmo praji arithmo \00"
@str.5 = [64 x i8] c"edoses 0 gia diaireti, parakalw dwse ton diaireti diaforo tou 0\00"
define void @main() {
%1 = alloca i8
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %2 to i8*
%5 = bitcast float* %3 to i8*
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%7 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %2, i8* %1, float* %3)
%8 = load i8, i8* %1
switch i8 %8, label %9 [
i8 43, label %12
i8 45, label %16
i8 42, label %20
]
9: ; preds = %0
%10 = load float, float* %3
%11 = fcmp oeq float %10, 0.000000e+00
br i1 %11, label %24, label %29
12: ; preds = %0
%13 = load float, float* %2
%14 = load float, float* %3
%15 = fadd float %13, %14
br label %33
16: ; preds = %0
%17 = load float, float* %2
%18 = load float, float* %3
%19 = fsub float %17, %18
br label %33
20: ; preds = %0
%21 = load float, float* %2
%22 = load float, float* %3
%23 = fmul float %21, %22
br label %33
24: ; preds = %9, %24
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.5, i64 0, i64 0))
%26 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%27 = load float, float* %3
%28 = fcmp oeq float %27, 0.000000e+00
br i1 %28, label %24, label %29
29: ; preds = %24, %9
%30 = phi float [ %10, %9 ], [ %27, %24 ]
%31 = load float, float* %2
%32 = fdiv float %31, %30
br label %33
33: ; preds = %16, %29, %20, %12
%34 = phi float [ %19, %16 ], [ %32, %29 ], [ %23, %20 ], [ %15, %12 ]
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %35)
ret void
}