#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(void) {
  float num1, num2, result;
  char praxi;
  printf("Doste praxi sti morfi: arithmos praxi arithmos\n");
  printf("Doste + gia prosthesi, - gia afairesh, * gia pollaplasiasmo, / gia "
         "diairesh.\n");
  printf("Px. 123.45 * 2.3\n");
  scanf("%f %c %f", &num1, &praxi, &num2);
  if (praxi == '/' && num2 == 0) {
    printf("Den mporei na ginei diairesh me to mhden.\n");
    return 0;
  }
  switch (praxi) {
  case '+':
    result = num1 + num2;
    break;
  case '-':
    result = num1 - num2;
    break;
  case '*':
    result = num1 * num2;
    break;
  case '/':
    result = num1 / num2;
    break;
  default:
    printf("Lathos symbolo praxis, doste + gia prosthesi, - gia afairesh, \n");
    printf("* gia pollaplasiasmo, / gia diairesh.\n");
    return 0;
  }
  printf("Apotelesma: %.2f\n", result);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf48(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x11(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x2f,%eax
jne    11af <main+0x8f>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11af <main+0x8f>
jp     11af <main+0x8f>
lea    0xf15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    126f <main+0x14f>
movsbl -0x11(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x5,%eax
ja     1229 <main+0x109>
mov    -0x20(%rbp),%rax
lea    0xe30(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1251 <main+0x131>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1251 <main+0x131>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1251 <main+0x131>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1251 <main+0x131>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    126f <main+0x14f>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xebb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5c(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xf(%rsp),%rdx
lea    0x14(%rsp),%rcx
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%eax
movss  0x14(%rsp),%xmm0
cmp    $0x2f,%eax
jne    11a0 <main+0x70>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11a0 <main+0x70>
jp     11a0 <main+0x70>
lea    0xf6b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
add    $0xffffffd6,%eax
cmp    $0x5,%eax
ja     11c8 <main+0x98>
lea    0xe51(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mulss  0x10(%rsp),%xmm0
jmp    11f6 <main+0xc6>
addss  0x10(%rsp),%xmm0
jmp    11f6 <main+0xc6>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeae(%rip),%rdi
jmp    1194 <main+0x64>
movss  0x10(%rsp),%xmm1
subss  %xmm0,%xmm1
jmp    11f3 <main+0xc3>
movss  0x10(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe20(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Doste praxi sti morfi: arithmos praxi arithmos\0A\00"
@.str.1 = [78 x i8] c"Doste + gia prosthesi, - gia afairesh, * gia pollaplasiasmo, / gia diairesh.\0A\00"
@.str.2 = [18 x i8] c"Px. 123.45 * 2.3\0A\00"
@.str.3 = [9 x i8] c"%f %c %f\00"
@.str.4 = [43 x i8] c"Den mporei na ginei diairesh me to mhden.\0A\00"
@.str.5 = [64 x i8] c"Lathos symbolo praxis, doste + gia prosthesi, - gia afairesh, \0A\00"
@.str.6 = [39 x i8] c"* gia pollaplasiasmo, / gia diairesh.\0A\00"
@.str.7 = [18 x i8] c"Apotelesma: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i8
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), float* %2, i8* %5, float* %3)
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 47
br i1 %12, label %13, label %18
13: ; preds = %0
%14 = load float, float* %3
%15 = fcmp oeq float %14, 0.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %1
br label %44
18: ; preds = %13, %0
%19 = load i8, i8* %5
%20 = sext i8 %19 to i32
switch i32 %20, label %37 [
i32 43, label %21
i32 45, label %25
i32 42, label %29
i32 47, label %33
]
21: ; preds = %18
%22 = load float, float* %2
%23 = load float, float* %3
%24 = fadd float %22, %23
store float %24, float* %4
br label %40
25: ; preds = %18
%26 = load float, float* %2
%27 = load float, float* %3
%28 = fsub float %26, %27
store float %28, float* %4
br label %40
29: ; preds = %18
%30 = load float, float* %2
%31 = load float, float* %3
%32 = fmul float %30, %31
store float %32, float* %4
br label %40
33: ; preds = %18
%34 = load float, float* %2
%35 = load float, float* %3
%36 = fdiv float %34, %35
store float %36, float* %4
br label %40
37: ; preds = %18
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.5, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %1
br label %44
40: ; preds = %33, %29, %25, %21
%41 = load float, float* %4
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), double %42)
store i32 1, i32* %1
br label %44
44: ; preds = %40, %37, %16
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@.str.3 = [9 x i8] c"%f %c %f\00"
@.str.7 = [18 x i8] c"Apotelesma: %.2f\0A\00"
@str = [47 x i8] c"Doste praxi sti morfi: arithmos praxi arithmos\00"
@str.8 = [77 x i8] c"Doste + gia prosthesi, - gia afairesh, * gia pollaplasiasmo, / gia diairesh.\00"
@str.9 = [17 x i8] c"Px. 123.45 * 2.3\00"
@str.10 = [63 x i8] c"Lathos symbolo praxis, doste + gia prosthesi, - gia afairesh, \00"
@str.11 = [38 x i8] c"* gia pollaplasiasmo, / gia diairesh.\00"
@str.12 = [42 x i8] c"Den mporei na ginei diairesh me to mhden.\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.8, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), float* %1, i8* %3, float* %2)
%10 = load i8, i8* %3
%11 = icmp eq i8 %10, 47
%12 = load float, float* %2
%13 = fcmp oeq float %12, 0.000000e+00
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.12, i64 0, i64 0))
br label %38
17: ; preds = %0
%18 = sext i8 %10 to i32
switch i32 %18, label %31 [
i32 43, label %19
i32 45, label %22
i32 42, label %25
i32 47, label %28
]
19: ; preds = %17
%20 = load float, float* %1
%21 = fadd float %12, %20
br label %34
22: ; preds = %17
%23 = load float, float* %1
%24 = fsub float %23, %12
br label %34
25: ; preds = %17
%26 = load float, float* %1
%27 = fmul float %12, %26
br label %34
28: ; preds = %17
%29 = load float, float* %1
%30 = fdiv float %29, %12
br label %34
31: ; preds = %17
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.10, i64 0, i64 0))
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.11, i64 0, i64 0))
br label %38
34: ; preds = %28, %25, %22, %19
%35 = phi float [ %30, %28 ], [ %27, %25 ], [ %24, %22 ], [ %21, %19 ]
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), double %36)
br label %38
38: ; preds = %34, %31, %15
%39 = phi i32 [ 0, %15 ], [ 0, %31 ], [ 1, %34 ]
ret i32 %39
}