#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 *);
int main(void) {
  float x;
  float y;
  float p;
  float s;
  float total;
  printf("Enter a number for x: ");
  scanf("%f", &x);
  printf("Enter a number for y: ");
  scanf("%f", &y);
  p = x * y;
  s = x + y;
  total = (s * s) + (p * (s - x) * p + y);
  printf("\n\n");
  printf("Number entered for x:  \t\t\t%10.2f\n", x);
  printf("Number entered for y:  \t\t\t%10.2f\n", y);
  printf("If p = x * y, then p is: \t\t%10.2f\n", p);
  printf("If s = x + y, then s is: \t\t%10.2f\n", s);
  printf("Total of s^2 + (p * (s - x) * p + y): \t%10.2f\n", total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm3
subss  -0x8(%rbp),%xmm3
mulss  %xmm3,%xmm1
movss  -0x10(%rbp),%xmm4
movss  -0xc(%rbp),%xmm3
mulss  %xmm4,%xmm1
addss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe51(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe67(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe73(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecd(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movaps %xmm0,%xmm3
addss  %xmm1,%xmm3
movaps %xmm3,%xmm2
movss  %xmm3,0x18(%rsp)
subss  %xmm0,%xmm2
mulss  %xmm1,%xmm0
movss  %xmm0,0x14(%rsp)
mulss  %xmm0,%xmm2
mulss  %xmm0,%xmm2
addss  %xmm1,%xmm2
movaps %xmm3,%xmm0
mulss  %xmm3,%xmm0
addss  %xmm2,%xmm0
movss  %xmm0,0x1c(%rsp)
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe65(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe85(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter a number for x: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [23 x i8] c"Enter a number for y: \00"
@.str.3 = [3 x i8] c"\0A\0A\00"
@.str.4 = [34 x i8] c"Number entered for x: \09\09\09%10.2f\0A\00"
@.str.5 = [34 x i8] c"Number entered for y: \09\09\09%10.2f\0A\00"
@.str.6 = [35 x i8] c"If p = x * y, then p is: \09\09%10.2f\0A\00"
@.str.7 = [35 x i8] c"If s = x + y, then s is: \09\09%10.2f\0A\00"
@.str.8 = [47 x i8] c"Total of s^2 + (p * (s - x) * p + y): \09%10.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%11 = load float, float* %2
%12 = load float, float* %3
%13 = fmul float %11, %12
store float %13, float* %4
%14 = load float, float* %2
%15 = load float, float* %3
%16 = fadd float %14, %15
store float %16, float* %5
%17 = load float, float* %5
%18 = load float, float* %5
%19 = load float, float* %4
%20 = load float, float* %5
%21 = load float, float* %2
%22 = fsub float %20, %21
%23 = fmul float %19, %22
%24 = load float, float* %4
%25 = load float, float* %3
%26 = call float @llvm.fmuladd.f32(float %23, float %24, float %25)
%27 = call float @llvm.fmuladd.f32(float %17, float %18, float %26)
store float %27, float* %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%29 = load float, float* %2
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double %30)
%32 = load float, float* %3
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), double %33)
%35 = load float, float* %4
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), double %36)
%38 = load float, float* %5
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), double %39)
%41 = load float, float* %6
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), double %42)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter a number for x: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [23 x i8] c"Enter a number for y: \00"
@.str.4 = [34 x i8] c"Number entered for x: \09\09\09%10.2f\0A\00"
@.str.5 = [34 x i8] c"Number entered for y: \09\09\09%10.2f\0A\00"
@.str.6 = [35 x i8] c"If p = x * y, then p is: \09\09%10.2f\0A\00"
@.str.7 = [35 x i8] c"If s = x + y, then s is: \09\09%10.2f\0A\00"
@.str.8 = [47 x i8] c"Total of s^2 + (p * (s - x) * p + y): \09%10.2f\0A\00"
@str = [2 x i8] c"\0A\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 ([23 x i8], [23 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 ([23 x i8], [23 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 = fmul float %9, %10
%12 = fadd float %9, %10
%13 = fsub float %12, %9
%14 = fmul float %11, %13
%15 = call float @llvm.fmuladd.f32(float %14, float %11, float %10)
%16 = call float @llvm.fmuladd.f32(float %12, float %12, float %15)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%18 = load float, float* %1
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double %19)
%21 = load float, float* %2
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), double %22)
%24 = fpext float %11 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), double %24)
%26 = fpext float %12 to double
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), double %26)
%28 = fpext float %16 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), double %28)
ret i32 0
}