#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 atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, double *);
int main(int argc, char *argv[]) {
  double f, f1, f2, x;
  int s;
  if (argc != 2) {
    printf("\nPlease Input x value:\n\n");
    s = scanf("%lf", &x);
    if (s != 1)
      printf("&MAIN ERROR: Inputs");
  } else
    x = atoi(argv[1]);
  f1 = ((x - 2) * x + 1) * x - 6.3;
  f2 = (x + 0.05005) * x - 3.14;
  f = f1 / f2;
  printf("\nx value = %g\n", x);
  printf("f1(x) = %g ", f1);
  printf(" f2(x) = %g\n", f2);
  printf("f(x) = %g\n", f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     118e <main+0x5e>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <scanf@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
je     1189 <main+0x59>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a0 <main+0x70>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe73(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe56(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe39(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe20(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe02(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xe37(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xe33(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xe2c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe26(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
cmp    $0x2,%edi
jne    115a <main+0x1a>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
movsd  %xmm0,0x8(%rsp)
jmp    118a <main+0x4a>
lea    0xf1a(%rip),%rdi
call   1030 <puts@plt>
lea    0xec3(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     118a <main+0x4a>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0xe68(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe60(%rip),%xmm1
movsd  0xe60(%rip),%xmm2
addsd  %xmm0,%xmm2
unpcklpd %xmm2,%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm1,%xmm2
addpd  0xe54(%rip),%xmm2
movapd %xmm2,0x10(%rsp)
movapd %xmm2,%xmm3
unpckhpd %xmm2,%xmm3
movapd %xmm3,0x20(%rsp)
movapd %xmm2,%xmm1
divsd  %xmm3,%xmm1
movapd %xmm1,0x30(%rsp)
lea    0xe53(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe54(%rip),%rdi
movaps 0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe4d(%rip),%rdi
movaps 0x20(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe47(%rip),%rdi
movaps 0x30(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0APlease Input x value:\0A\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [20 x i8] c"&MAIN ERROR: Inputs\00"
@.str.3 = [15 x i8] c"\0Ax value = %g\0A\00"
@.str.4 = [12 x i8] c"f1(x) = %g \00"
@.str.5 = [13 x i8] c" f2(x) = %g\0A\00"
@.str.6 = [11 x i8] c"f(x) = %g\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %9)
store i32 %15, i32* %10
%16 = load i32, i32* %10
%17 = icmp ne i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %13
br label %26
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call double @atoi(i8* %24)
store double %25, double* %9
br label %26
26: ; preds = %21, %20
%27 = load double, double* %9
%28 = fsub double %27, 2.000000e+00
%29 = load double, double* %9
%30 = call double @llvm.fmuladd.f64(double %28, double %29, double 1.000000e+00)
%31 = load double, double* %9
%32 = call double @llvm.fmuladd.f64(double %30, double %31, double -6.300000e+00)
store double %32, double* %7
%33 = load double, double* %9
%34 = fadd double %33, 5.005000e-02
%35 = load double, double* %9
%36 = call double @llvm.fmuladd.f64(double %34, double %35, double -3.140000e+00)
store double %36, double* %8
%37 = load double, double* %7
%38 = load double, double* %8
%39 = fdiv double %37, %38
store double %39, double* %6
%40 = load double, double* %9
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %40)
%42 = load double, double* %7
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %42)
%44 = load double, double* %8
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %44)
%46 = load double, double* %6
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double %46)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [20 x i8] c"&MAIN ERROR: Inputs\00"
@.str.3 = [15 x i8] c"\0Ax value = %g\0A\00"
@.str.4 = [12 x i8] c"f1(x) = %g \00"
@.str.5 = [13 x i8] c" f2(x) = %g\0A\00"
@.str.6 = [11 x i8] c"f(x) = %g\0A\00"
@str = [24 x i8] c"\0APlease Input x value:\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%9 = icmp eq i32 %8, 1
br i1 %9, label %16, label %10
10: ; preds = %6
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %16
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call double @atoi(i8* %14)
store double %15, double* %3
br label %16
16: ; preds = %6, %10, %12
%17 = load double, double* %3
%18 = fadd double %17, -2.000000e+00
%19 = call double @llvm.fmuladd.f64(double %18, double %17, double 1.000000e+00)
%20 = fadd double %17, 5.005000e-02
%21 = insertelement <2 x double> poison, double %19, i64 0
%22 = insertelement <2 x double> %21, double %20, i64 1
%23 = insertelement <2 x double> poison, double %17, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %24, <2 x double> <double -6.300000e+00, double -3.140000e+00>)
%26 = extractelement <2 x double> %25, i64 0
%27 = extractelement <2 x double> %25, i64 1
%28 = fdiv double %26, %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %17)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %26)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %27)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double %28)
ret i32 0
}