#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*/ ceil(double);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
double floor(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, double *);
int main(int argc, char *argv[]) {
  double f, f1, f2, x;
  int s;
  printf("\nPlease Input x value:\n\n");
  s = scanf("%lf", &x);
  if (s != 1 && argc == 2) {
    x = atoi(argv[1]);
  } else if (s != 1) {
    printf("ERROR: inputs");
    exit(0);
  }
  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);
  printf("floor %g\n", floor(ceil(10.8)));
  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)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
je     11c2 <main+0x62>
cmpl   $0x2,-0x8(%rbp)
jne    11c2 <main+0x62>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
movsd  %xmm0,-0x30(%rbp)
jmp    11e6 <main+0x86>
cmpl   $0x1,-0x34(%rbp)
je     11e1 <main+0x81>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
jmp    11e6 <main+0x86>
movsd  -0x30(%rbp),%xmm0
movsd  0xe35(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe18(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdfb(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xde2(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdc4(%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    0xdf3(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xdef(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xde8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xde2(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xd50(%rip),%xmm0
call   1030 <ceil@plt>
mov    %eax,%edi
call   1080 <floor@plt>
lea    0xdcb(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
lea    0xea2(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0x2,%ebp
jne    11b3 <main+0x43>
cmp    $0x1,%eax
je     11b3 <main+0x43>
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
movsd  %xmm0,0x8(%rsp)
jmp    11c2 <main+0x52>
cmp    $0x1,%eax
jne    1292 <main+0x122>
movsd  0x8(%rsp),%xmm0
movsd  0xe36(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe2e(%rip),%xmm1
movsd  0xe2e(%rip),%xmm2
addsd  %xmm0,%xmm2
unpcklpd %xmm2,%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm1,%xmm2
addpd  0xe22(%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    0xe1b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe1c(%rip),%rdi
movaps 0x10(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe15(%rip),%rdi
movaps 0x20(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe0f(%rip),%rdi
movaps 0x30(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0xda9(%rip),%xmm0
call   1040 <ceil@plt>
mov    %eax,%edi
call   1090 <floor@plt>
lea    0xdf3(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xd9b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>

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 = [14 x i8] c"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.7 = [10 x i8] c"floor %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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %9)
store i32 %12, i32* %10
%13 = load i32, i32* %10
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %23
15: ; preds = %2
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call double @atoi(i8* %21)
store double %22, double* %9
br label %30
23: ; preds = %15, %2
%24 = load i32, i32* %10
%25 = icmp ne i32 %24, 1
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 @exit(i32 0)
unreachable
29: ; preds = %23
br label %30
30: ; preds = %29, %18
%31 = load double, double* %9
%32 = fsub double %31, 2.000000e+00
%33 = load double, double* %9
%34 = call double @llvm.fmuladd.f64(double %32, double %33, double 1.000000e+00)
%35 = load double, double* %9
%36 = call double @llvm.fmuladd.f64(double %34, double %35, double -6.300000e+00)
store double %36, double* %7
%37 = load double, double* %9
%38 = fadd double %37, 5.005000e-02
%39 = load double, double* %9
%40 = call double @llvm.fmuladd.f64(double %38, double %39, double -3.140000e+00)
store double %40, double* %8
%41 = load double, double* %7
%42 = load double, double* %8
%43 = fdiv double %41, %42
store double %43, double* %6
%44 = load double, double* %9
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %44)
%46 = load double, double* %7
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %46)
%48 = load double, double* %8
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %48)
%50 = load double, double* %6
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double %50)
%52 = call i32 @ceil(double 1.080000e+01)
%53 = call double @floor(i32 %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), double %53)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [14 x i8] c"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.7 = [10 x i8] c"floor %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 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%7 = icmp ne i32 %6, 1
%8 = icmp eq i32 %0, 2
%9 = and i1 %8, %7
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call double @atoi(i8* %12)
store double %13, double* %3
br label %20
14: ; preds = %2
br i1 %7, label %17, label %15
15: ; preds = %14
%16 = load double, double* %3
br label %20
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %15, %10
%21 = phi double [ %16, %15 ], [ %13, %10 ]
%22 = fadd double %21, -2.000000e+00
%23 = call double @llvm.fmuladd.f64(double %22, double %21, double 1.000000e+00)
%24 = fadd double %21, 5.005000e-02
%25 = insertelement <2 x double> poison, double %23, i64 0
%26 = insertelement <2 x double> %25, double %24, i64 1
%27 = insertelement <2 x double> poison, double %21, i64 0
%28 = shufflevector <2 x double> %27, <2 x double> poison, <2 x i32> zeroinitializer
%29 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %26, <2 x double> %28, <2 x double> <double -6.300000e+00, double -3.140000e+00>)
%30 = extractelement <2 x double> %29, i64 0
%31 = extractelement <2 x double> %29, i64 1
%32 = fdiv double %30, %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %21)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %30)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %31)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double %32)
%37 = call i32 @ceil(double 1.080000e+01)
%38 = call double @floor(i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), double %38)
ret i32 0
}