#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() {
  char symbolo;
  float num1, num2;
  printf("dwse arithmo praji arithmo\n");
  scanf("%f %c %f", &num1, &symbolo, &num2);
  switch (symbolo) {
  case '+':
    printf("apotelesma = %.2f\n", num1 + num2);
    break;
  case '-':
    printf("apotelesma = %.2f\n", num1 - num2);
    break;
  case '*':
    printf("apotelesma = %.2f\n", num1 * num2);
    break;
  case '/':
    if (num2 != 0) {
      printf("apotelesma = %.2f\n", num1 / num2);
      break;
    }
  default:
    printf("Error!");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x5(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     1224 <main+0x104>
mov    -0x18(%rbp),%rax
lea    0xe8a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1232 <main+0x112>
movss  -0xc(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe88(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1232 <main+0x112>
movss  -0xc(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe67(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1232 <main+0x112>
movss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11fe <main+0xde>
jp     11fe <main+0xde>
jmp    121f <main+0xff>
movss  -0xc(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1232 <main+0x112>
jmp    1224 <main+0x104>
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
lea    0xed1(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0xf(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%eax
add    $0xffffffd6,%eax
cmp    $0x5,%eax
ja     11d7 <main+0xa7>
lea    0xe91(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0x14(%rsp),%xmm0
mulss  0x10(%rsp),%xmm0
jmp    11a0 <main+0x70>
movss  0x14(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
jmp    11a0 <main+0x70>
movss  0x14(%rsp),%xmm0
subss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11e5 <main+0xb5>
movss  0x10(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11c4 <main+0x94>
jnp    11d7 <main+0xa7>
movss  0x14(%rsp),%xmm1
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
jmp    11a4 <main+0x74>
lea    0xe56(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"dwse arithmo praji arithmo\0A\00"
@.str.1 = [9 x i8] c"%f %c %f\00"
@.str.2 = [19 x i8] c"apotelesma = %.2f\0A\00"
@.str.3 = [7 x i8] c"Error!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 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* %3, i8* %2, float* %4)
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
switch i32 %8, label %37 [
i32 43, label %9
i32 45, label %15
i32 42, label %21
i32 47, label %27
]
9: ; preds = %0
%10 = load float, float* %3
%11 = load float, float* %4
%12 = fadd float %10, %11
%13 = fpext float %12 to double
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %13)
br label %39
15: ; preds = %0
%16 = load float, float* %3
%17 = load float, float* %4
%18 = fsub float %16, %17
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %19)
br label %39
21: ; preds = %0
%22 = load float, float* %3
%23 = load float, float* %4
%24 = fmul float %22, %23
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %25)
br label %39
27: ; preds = %0
%28 = load float, float* %4
%29 = fcmp une float %28, 0.000000e+00
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = load float, float* %3
%32 = load float, float* %4
%33 = fdiv float %31, %32
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %34)
br label %39
36: ; preds = %27
br label %37
37: ; preds = %0, %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %37, %30, %21, %15, %9
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%f %c %f\00"
@.str.2 = [19 x i8] c"apotelesma = %.2f\0A\00"
@.str.3 = [7 x i8] c"Error!\00"
@str = [27 x i8] c"dwse arithmo praji arithmo\00"
define i32 @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 ([27 x i8], [27 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* %2, i8* %1, float* %3)
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
switch i32 %9, label %36 [
i32 43, label %10
i32 45, label %16
i32 42, label %22
i32 47, label %28
]
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* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %14)
br label %38
16: ; preds = %0
%17 = load float, float* %2
%18 = load float, float* %3
%19 = fsub float %17, %18
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %20)
br label %38
22: ; preds = %0
%23 = load float, float* %2
%24 = load float, float* %3
%25 = fmul float %23, %24
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %26)
br label %38
28: ; preds = %0
%29 = load float, float* %3
%30 = fcmp une float %29, 0.000000e+00
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load float, float* %2
%33 = fdiv float %32, %29
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %34)
br label %38
36: ; preds = %28, %0
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %38
38: ; preds = %36, %31, %22, %16, %10
ret i32 0
}