#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 *, double *, char *, double *);
int main() {
  double n1, n2, apotelesma;
  char praksi;
  printf("Dwse arithmo praksi arithmo\n");
  scanf("%lf %c %lf", &n1, &praksi, &n2);
  if (praksi == '+') {
    apotelesma = n1 + n2;
    printf("apotelesma= %.2f\n", apotelesma);
  } else if (praksi == '-') {
    apotelesma = n1 - n2;
    printf("apotelesma= %.2f\n", apotelesma);
  } else if (praksi == '*') {
    apotelesma = n1 * n2;
    printf("apotelesma= %.2f\n", apotelesma);
  } else if (praksi == '/') {
    if (n2 == 0) {
      printf("Adynati praksi\n");
    } else {
      apotelesma = n1 / n2;
      printf("apotelesma= %.2f\n", apotelesma);
    }
  } else
    printf("Edwses lathos praksi\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x21(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0x21(%rbp),%eax
cmp    $0x2b,%eax
jne    1189 <main+0x69>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xeab(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    126d <main+0x14d>
movsbl -0x21(%rbp),%eax
cmp    $0x2d,%eax
jne    11bd <main+0x9d>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe77(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1268 <main+0x148>
movsbl -0x21(%rbp),%eax
cmp    $0x2a,%eax
jne    11f1 <main+0xd1>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe43(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1263 <main+0x143>
movsbl -0x21(%rbp),%eax
cmp    $0x2f,%eax
jne    1250 <main+0x130>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1229 <main+0x109>
jp     1229 <main+0x109>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124b <main+0x12b>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xde4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    125e <main+0x13e>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1263 <main+0x143>
jmp    1268 <main+0x148>
jmp    126d <main+0x14d>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xed1(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x7(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1050 <scanf@plt>
mov    0x7(%rsp),%al
add    $0xd6,%al
cmp    $0x5,%al
ja     1194 <main+0x64>
movzbl %al,%eax
lea    0xe91(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
jmp    11d5 <main+0xa5>
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
jmp    11d5 <main+0xa5>
lea    0xeb6(%rip),%rdi
jmp    11c4 <main+0x94>
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
jmp    11d5 <main+0xa5>
movsd  0x8(%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    11cb <main+0x9b>
jp     11cb <main+0x9b>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
jmp    11e3 <main+0xb3>
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
lea    0xe47(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str.1 = [11 x i8] c"%lf %c %lf\00"
@.str.2 = [18 x i8] c"apotelesma= %.2f\0A\00"
@str = [28 x i8] c"Dwse arithmo praksi arithmo\00"
@str.5 = [21 x i8] c"Edwses lathos praksi\00"
@str.6 = [15 x i8] c"Adynati praksi\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca i8
%4 = bitcast double* %1 to i8*
%5 = bitcast double* %2 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 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), double* %1, i8* %3, double* %2)
%8 = load i8, i8* %3
switch i8 %8, label %33 [
i8 43, label %9
i8 45, label %14
i8 42, label %19
i8 47, label %24
]
9: ; preds = %0
%10 = load double, double* %1
%11 = load double, double* %2
%12 = fadd double %10, %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %12)
br label %35
14: ; preds = %0
%15 = load double, double* %1
%16 = load double, double* %2
%17 = fsub double %15, %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %17)
br label %35
19: ; preds = %0
%20 = load double, double* %1
%21 = load double, double* %2
%22 = fmul double %20, %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %22)
br label %35
24: ; preds = %0
%25 = load double, double* %2
%26 = fcmp oeq double %25, 0.000000e+00
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.6, i64 0, i64 0))
br label %35
29: ; preds = %24
%30 = load double, double* %1
%31 = fdiv double %30, %25
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %31)
br label %35
33: ; preds = %0
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.5, i64 0, i64 0))
br label %35
35: ; preds = %14, %33, %29, %27, %19, %9
ret i32 0
}