#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 *, double *, double *, double *);
int main() {
  double a, b, c, d;
  printf("Please input four float numbers:");
  scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
  printf("The result is %lf\n", (a + b) * (a - b) + c / d);
  return 0;
}


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    0xedd(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
divsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
lea    0xeab(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    0x20(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1040 <scanf@plt>
movsd  0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm0
movapd %xmm1,%xmm2
addsd  %xmm0,%xmm2
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
movsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
lea    0xeac(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Please input four float numbers:\00"
@.str.1 = [16 x i8] c"%lf %lf %lf %lf\00"
@.str.2 = [19 x i8] c"The result is %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3, double* %4, double* %5)
%8 = load double, double* %2
%9 = load double, double* %3
%10 = fadd double %8, %9
%11 = load double, double* %2
%12 = load double, double* %3
%13 = fsub double %11, %12
%14 = load double, double* %4
%15 = load double, double* %5
%16 = fdiv double %14, %15
%17 = call double @llvm.fmuladd.f64(double %10, double %13, double %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Please input four float numbers:\00"
@.str.1 = [16 x i8] c"%lf %lf %lf %lf\00"
@.str.2 = [19 x i8] c"The result is %lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3, double* %4)
%11 = load double, double* %1
%12 = load double, double* %2
%13 = fadd double %11, %12
%14 = fsub double %11, %12
%15 = load double, double* %3
%16 = load double, double* %4
%17 = fdiv double %15, %16
%18 = call double @llvm.fmuladd.f64(double %13, double %14, double %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %18)
ret i32 0
}