#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 */
double div(float, float);
double minus(float, float);
double mul(float, float);
double plus(float, float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float c, d;
  printf(" Input a  number, please? ");
  scanf("%f", &c);
  printf(" Input a  number2, please?  ");
  scanf("%f", &d);
  printf(" c + d = %.4f     %e\n", plus(c, d), plus(c, d));
  printf(" c - d = %.4f     %e\n", minus(c, d), minus(c, d));
  printf(" c * d = %.4f     %e\n", mul(c, d), mul(c, d));
  if (d == 0)
    printf(" Unknown.\n");
  else
    printf(" c / d = %.4f     %e\n", div(c, d), div(c, d));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe97(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe79(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <plus@plt>
movsd  %xmm0,-0x28(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <plus@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
lea    0xe5e(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1040 <minus@plt>
movsd  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1040 <minus@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
lea    0xe3b(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1080 <mul@plt>
movsd  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1080 <mul@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
lea    0xe18(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1280 <main+0x120>
jp     1280 <main+0x120>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12b9 <main+0x159>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <div@plt>
movsd  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <div@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
lea    0xdd6(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe91(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <scanf@plt>
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1080 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1030 <plus@plt>
movsd  %xmm0,0x8(%rsp)
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1030 <plus@plt>
movaps %xmm0,%xmm1
lea    0xe5b(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
call   1060 <printf@plt>
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1050 <minus@plt>
movsd  %xmm0,0x8(%rsp)
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1050 <minus@plt>
movaps %xmm0,%xmm1
lea    0xe34(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
call   1060 <printf@plt>
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1090 <mul@plt>
movsd  %xmm0,0x8(%rsp)
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1090 <mul@plt>
movaps %xmm0,%xmm1
lea    0xe0d(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
call   1060 <printf@plt>
movss  (%rsp),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jne    1284 <main+0x114>
jp     1284 <main+0x114>
lea    0xe16(%rip),%rdi
call   1040 <puts@plt>
jmp    12bc <main+0x14c>
movss  0x4(%rsp),%xmm0
call   1070 <div@plt>
movsd  %xmm0,0x8(%rsp)
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1070 <div@plt>
movaps %xmm0,%xmm1
lea    0xdce(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c" Input a number, please? \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [29 x i8] c" Input a number2, please? \00"
@.str.3 = [22 x i8] c" c + d = %.4f %e\0A\00"
@.str.4 = [22 x i8] c" c - d = %.4f %e\0A\00"
@.str.5 = [22 x i8] c" c * d = %.4f %e\0A\00"
@.str.6 = [11 x i8] c" Unknown.\0A\00"
@.str.7 = [22 x i8] c" c / d = %.4f %e\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%8 = load float, float* %2
%9 = load float, float* %3
%10 = call double @plus(float %8, float %9)
%11 = load float, float* %2
%12 = load float, float* %3
%13 = call double @plus(float %11, float %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), double %10, double %13)
%15 = load float, float* %2
%16 = load float, float* %3
%17 = call double @minus(float %15, float %16)
%18 = load float, float* %2
%19 = load float, float* %3
%20 = call double @minus(float %18, float %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %17, double %20)
%22 = load float, float* %2
%23 = load float, float* %3
%24 = call double @mul(float %22, float %23)
%25 = load float, float* %2
%26 = load float, float* %3
%27 = call double @mul(float %25, float %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %24, double %27)
%29 = load float, float* %3
%30 = fcmp oeq float %29, 0.000000e+00
br i1 %30, label %31, label %33
31: ; preds = %0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %41
33: ; preds = %0
%34 = load float, float* %2
%35 = load float, float* %3
%36 = call double @div(float %34, float %35)
%37 = load float, float* %2
%38 = load float, float* %3
%39 = call double @div(float %37, float %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), double %36, double %39)
br label %41
41: ; preds = %33, %31
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c" Input a number, please? \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [29 x i8] c" Input a number2, please? \00"
@.str.3 = [22 x i8] c" c + d = %.4f %e\0A\00"
@.str.4 = [22 x i8] c" c - d = %.4f %e\0A\00"
@.str.5 = [22 x i8] c" c * d = %.4f %e\0A\00"
@.str.7 = [22 x i8] c" c / d = %.4f %e\0A\00"
@str = [10 x i8] c" Unknown.\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = load float, float* %1
%10 = load float, float* %2
%11 = call double @plus(float %9, float %10)
%12 = load float, float* %1
%13 = load float, float* %2
%14 = call double @plus(float %12, float %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), double %11, double %14)
%16 = load float, float* %1
%17 = load float, float* %2
%18 = call double @minus(float %16, float %17)
%19 = load float, float* %1
%20 = load float, float* %2
%21 = call double @minus(float %19, float %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %18, double %21)
%23 = load float, float* %1
%24 = load float, float* %2
%25 = call double @mul(float %23, float %24)
%26 = load float, float* %1
%27 = load float, float* %2
%28 = call double @mul(float %26, float %27)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %25, double %28)
%30 = load float, float* %2
%31 = fcmp oeq float %30, 0.000000e+00
br i1 %31, label %32, label %34
32: ; preds = %0
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %41
34: ; preds = %0
%35 = load float, float* %1
%36 = call double @div(float %35, float %30)
%37 = load float, float* %1
%38 = load float, float* %2
%39 = call double @div(float %37, float %38)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), double %36, double %39)
br label %41
41: ; preds = %34, %32
ret i32 0
}