#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ stdin;
int main(void) {
  float num1, num2, result;
  char sign;
  printf("%s", "Enter the first number: ");
  scanf("%f", &num1);
  printf("%s", "Enter the Second number: ");
  scanf("%f", &num2);
  printf("%s", "Enter the Operation sign: ");
  fflush(stdin);
  scanf("%c", &sign);
  switch (sign) {
  case '+':
    result = num1 + num2;
    break;
  case '-':
    result = num1 - num2;
    break;
  case '*':
    result = num1 * num2;
    break;
  case '/':
    result = num1 / num2;
    break;
  default:
    printf("%s\n", "Please enter an appropriate input next time! Thank!");
  }
  printf(
      "\nThe result of first number %c second number is: %.2f %c %.2f = %.2f\n",
      sign, num1, sign, num2, result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    %rdi,-0x30(%rbp)
lea    0xeca(%rip),%rsi
xor    %eax,%eax
mov    %al,-0x21(%rbp)
call   1030 <printf@plt>
mov    -0x21(%rbp),%al
lea    0xecf(%rip),%rdi
mov    %rdi,-0x38(%rbp)
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x21(%rbp),%al
lea    0xeb7(%rip),%rsi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x21(%rbp),%al
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x21(%rbp),%al
lea    0xeae(%rip),%rsi
call   1030 <printf@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x21(%rbp),%al
lea    0xeac(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x11(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x5,%eax
ja     1243 <main+0x113>
mov    -0x20(%rbp),%rax
lea    0xe16(%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    1258 <main+0x128>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1258 <main+0x128>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1258 <main+0x128>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1258 <main+0x128>
lea    0xe25(%rip),%rdi
lea    0xe22(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x11(%rbp),%esi
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsbl -0x11(%rbp),%edx
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe25(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeca(%rip),%r14
lea    0xec6(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xece(%rip),%rbx
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xebb(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xeb5(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xeb1(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movsbl 0xf(%rsp),%eax
add    $0xffffffd6,%eax
cmp    $0x5,%eax
ja     1218 <main+0xd8>
lea    0xe25(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movaps %xmm0,%xmm2
mulss  %xmm1,%xmm2
mov    $0x2a,%edx
jmp    1269 <main+0x129>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movaps %xmm0,%xmm2
addss  %xmm1,%xmm2
mov    $0x2b,%edx
jmp    1269 <main+0x129>
lea    0xe50(%rip),%rdi
call   1030 <puts@plt>
movsbl 0xf(%rsp),%edx
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
jmp    1269 <main+0x129>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
mov    $0x2d,%edx
jmp    1269 <main+0x129>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movaps %xmm0,%xmm2
divss  %xmm1,%xmm2
mov    $0x2f,%edx
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
lea    0xe27(%rip),%rdi
mov    %edx,%esi
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [25 x i8] c"Enter the first number: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [26 x i8] c"Enter the Second number: \00"
@.str.4 = [27 x i8] c"Enter the Operation sign: \00"
@stdin = global i32 0
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [52 x i8] c"Please enter an appropriate input next time! Thank!\00"
@.str.8 = [70 x i8] c"\0AThe result of first number %c second number is: %.2f %c %.2f = %.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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%11 = load i32, i32* @stdin
%12 = call i32 @fflush(i32 %11)
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%14 = load i8, i8* %5
%15 = sext i8 %14 to i32
switch i32 %15, label %32 [
i32 43, label %16
i32 45, label %20
i32 42, label %24
i32 47, label %28
]
16: ; preds = %0
%17 = load float, float* %2
%18 = load float, float* %3
%19 = fadd float %17, %18
store float %19, float* %4
br label %34
20: ; preds = %0
%21 = load float, float* %2
%22 = load float, float* %3
%23 = fsub float %21, %22
store float %23, float* %4
br label %34
24: ; preds = %0
%25 = load float, float* %2
%26 = load float, float* %3
%27 = fmul float %25, %26
store float %27, float* %4
br label %34
28: ; preds = %0
%29 = load float, float* %2
%30 = load float, float* %3
%31 = fdiv float %29, %30
store float %31, float* %4
br label %34
32: ; preds = %0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0))
br label %34
34: ; preds = %32, %28, %24, %20, %16
%35 = load i8, i8* %5
%36 = sext i8 %35 to i32
%37 = load float, float* %2
%38 = fpext float %37 to double
%39 = load i8, i8* %5
%40 = sext i8 %39 to i32
%41 = load float, float* %3
%42 = fpext float %41 to double
%43 = load float, float* %4
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.8, i64 0, i64 0), i32 %36, double %38, i32 %40, double %42, double %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [25 x i8] c"Enter the first number: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [26 x i8] c"Enter the Second number: \00"
@.str.4 = [27 x i8] c"Enter the Operation sign: \00"
@stdin = global i32 0
@.str.5 = [3 x i8] c"%c\00"
@.str.7 = [52 x i8] c"Please enter an appropriate input next time! Thank!\00"
@.str.8 = [70 x i8] c"\0AThe result of first number %c second number is: %.2f %c %.2f = %.2f\0A\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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%11 = load i32, i32* @stdin
%12 = call i32 @fflush(i32 %11)
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
switch i32 %15, label %32 [
i32 43, label %16
i32 45, label %20
i32 42, label %24
i32 47, label %28
]
16: ; preds = %0
%17 = load float, float* %1
%18 = load float, float* %2
%19 = fadd float %17, %18
br label %38
20: ; preds = %0
%21 = load float, float* %1
%22 = load float, float* %2
%23 = fsub float %21, %22
br label %38
24: ; preds = %0
%25 = load float, float* %1
%26 = load float, float* %2
%27 = fmul float %25, %26
br label %38
28: ; preds = %0
%29 = load float, float* %1
%30 = load float, float* %2
%31 = fdiv float %29, %30
br label %38
32: ; preds = %0
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0))
%34 = load i8, i8* %3
%35 = load float, float* %1
%36 = load float, float* %2
%37 = sext i8 %34 to i32
br label %38
38: ; preds = %32, %28, %24, %20, %16
%39 = phi i32 [ %37, %32 ], [ 47, %28 ], [ 42, %24 ], [ 45, %20 ], [ 43, %16 ]
%40 = phi float [ %36, %32 ], [ %30, %28 ], [ %26, %24 ], [ %22, %20 ], [ %18, %16 ]
%41 = phi float [ %35, %32 ], [ %29, %28 ], [ %25, %24 ], [ %21, %20 ], [ %17, %16 ]
%42 = phi float [ undef, %32 ], [ %31, %28 ], [ %27, %24 ], [ %23, %20 ], [ %19, %16 ]
%43 = fpext float %41 to double
%44 = fpext float %40 to double
%45 = fpext float %42 to double
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.8, i64 0, i64 0), i32 %39, double %43, i32 %39, double %44, double %45)
ret i32 0
}