#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 */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
main() {
  float a, b, result;
  char operator;
  printf("Bitte Zahl 1 eingeben: ");
  scanf("%f", &a);
  printf("Bitte Zahl 2 eingeben: ");
  scanf("%f", &b);
  printf("Bitte Operator eingeben: ");
  scanf("%c", &operator);
  operator= getchar();
  switch (operator) {
  case '+':
    printf("\nResultat: %.2f\n", a + b);
    break;
  case '-':
    printf("\nResultat: %.2f\n", a - b);
    break;
  case '*':
    printf("\nResultat: %.2f\n", a * b);
    break;
  case '/':
    printf("\nResultat: %.2f\n", a / b);
    break;
  default:
    printf("\nFehler, bitte starten sie neu!\n");
    break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x21(%rbp)
call   1030 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xed6(%rip),%rdi
mov    %rdi,-0x30(%rbp)
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x21(%rbp),%al
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x21(%rbp),%al
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x21(%rbp),%al
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xec6(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x21(%rbp),%al
call   1040 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x5,%eax
ja     1261 <main+0x131>
mov    -0x20(%rbp),%rax
lea    0xe2c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    126f <main+0x13f>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe55(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    126f <main+0x13f>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe34(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    126f <main+0x13f>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe13(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    126f <main+0x13f>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed6(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0x7(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0x7(%rsp)
movsbl %al,%eax
add    $0xffffffd6,%eax
cmp    $0x5,%eax
ja     11e9 <main+0xa9>
lea    0xe3c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0xc(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
jmp    1211 <main+0xd1>
movss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
jmp    1211 <main+0xd1>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
jmp    1223 <main+0xe3>
movss  0xc(%rsp),%xmm0
subss  0x8(%rsp),%xmm0
jmp    1211 <main+0xd1>
movss  0xc(%rsp),%xmm0
divss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Bitte Zahl 1 eingeben: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [24 x i8] c"Bitte Zahl 2 eingeben: \00"
@.str.3 = [26 x i8] c"Bitte Operator eingeben: \00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [17 x i8] c"\0AResultat: %.2f\0A\00"
@.str.6 = [33 x i8] c"\0AFehler, bitte starten sie neu!\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 ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %5)
%12 = call signext i8 (...) @getchar()
store i8 %12, i8* %5
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
switch i32 %14, label %39 [
i32 43, label %15
i32 45, label %21
i32 42, label %27
i32 47, label %33
]
15: ; preds = %0
%16 = load float, float* %2
%17 = load float, float* %3
%18 = fadd float %16, %17
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double %19)
br label %41
21: ; preds = %0
%22 = load float, float* %2
%23 = load float, float* %3
%24 = fsub float %22, %23
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double %25)
br label %41
27: ; preds = %0
%28 = load float, float* %2
%29 = load float, float* %3
%30 = fmul float %28, %29
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double %31)
br label %41
33: ; preds = %0
%34 = load float, float* %2
%35 = load float, float* %3
%36 = fdiv float %34, %35
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double %37)
br label %41
39: ; preds = %0
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %41
41: ; preds = %39, %33, %27, %21, %15
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@.str = [24 x i8] c"Bitte Zahl 1 eingeben: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [24 x i8] c"Bitte Zahl 2 eingeben: \00"
@.str.3 = [26 x i8] c"Bitte Operator eingeben: \00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [17 x i8] c"\0AResultat: %.2f\0A\00"
@str = [32 x i8] c"\0AFehler, bitte starten sie neu!\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 ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%12 = call signext i8 (...) @getchar()
store i8 %12, i8* %3
%13 = sext i8 %12 to i32
switch i32 %13, label %38 [
i32 43, label %14
i32 45, label %20
i32 42, label %26
i32 47, label %32
]
14: ; preds = %0
%15 = load float, float* %1
%16 = load float, float* %2
%17 = fadd float %15, %16
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double %18)
br label %40
20: ; preds = %0
%21 = load float, float* %1
%22 = load float, float* %2
%23 = fsub float %21, %22
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double %24)
br label %40
26: ; preds = %0
%27 = load float, float* %1
%28 = load float, float* %2
%29 = fmul float %27, %28
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double %30)
br label %40
32: ; preds = %0
%33 = load float, float* %1
%34 = load float, float* %2
%35 = fdiv float %33, %34
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double %36)
br label %40
38: ; preds = %0
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %40
40: ; preds = %38, %32, %26, %20, %14
ret i32 0
}