#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 */
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int even_power(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  clock_t tic = clock();
  int x, n;
  double poly = 0.0f;
  printf("enter the x value: ");
  scanf("%d", &x);
  poly = 3 * even_power(x, 5) + 2 * even_power(x, 4) - 5 * even_power(x, 3) -
         even_power(x, 2) + 7 * even_power(x, 1) - 6 * even_power(x, 0);
  printf("%.2lf\n", poly);
  clock_t toc = clock();
  printf("elapsed: %f seconds\n", (double)(toc - tic) / CLOCKS_PER_SEC);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   1050 <even_power@plt>
imul   $0x3,%eax,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1050 <even_power@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x3,%esi
call   1050 <even_power@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
imul   $0x5,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x2,%esi
call   1050 <even_power@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1050 <even_power@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
imul   $0x7,%ecx,%ecx
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <even_power@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
imul   $0x6,%ecx,%ecx
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xdf6(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
sub    -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2da1(%rip),%rax
divsd  (%rax),%xmm0
lea    0xdcc(%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   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%r14
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
mov    $0x5,%esi
call   1050 <even_power@plt>
lea    (%rax,%rax,2),%ebp
mov    0xc(%rsp),%edi
mov    $0x4,%esi
call   1050 <even_power@plt>
lea    0x0(%rbp,%rax,2),%ebp
mov    0xc(%rsp),%edi
mov    $0x3,%esi
call   1050 <even_power@plt>
lea    (%rax,%rax,4),%eax
sub    %eax,%ebp
mov    0xc(%rsp),%edi
mov    $0x2,%esi
call   1050 <even_power@plt>
sub    %eax,%ebp
mov    0xc(%rsp),%edi
mov    $0x1,%esi
call   1050 <even_power@plt>
lea    0x0(,%rax,8),%ebx
sub    %eax,%ebx
add    %ebp,%ebx
mov    0xc(%rsp),%edi
xor    %esi,%esi
call   1050 <even_power@plt>
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ebx
cvtsi2sd %ebx,%xmm0
lea    0xe2a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <clock@plt>
sub    %r14,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x2ddb(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe06(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"enter the x value: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"%.2lf\0A\00"
@.str.3 = [21 x i8] c"elapsed: %f seconds\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca i64
store i32 0, i32* %1
%7 = call i64 (...) @clock()
store i64 %7, i64* %2
store double 0.000000e+00, double* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = call i32 @even_power(i32 %10, i32 5)
%12 = mul nsw i32 3, %11
%13 = load i32, i32* %3
%14 = call i32 @even_power(i32 %13, i32 4)
%15 = mul nsw i32 2, %14
%16 = add nsw i32 %12, %15
%17 = load i32, i32* %3
%18 = call i32 @even_power(i32 %17, i32 3)
%19 = mul nsw i32 5, %18
%20 = sub nsw i32 %16, %19
%21 = load i32, i32* %3
%22 = call i32 @even_power(i32 %21, i32 2)
%23 = sub nsw i32 %20, %22
%24 = load i32, i32* %3
%25 = call i32 @even_power(i32 %24, i32 1)
%26 = mul nsw i32 7, %25
%27 = add nsw i32 %23, %26
%28 = load i32, i32* %3
%29 = call i32 @even_power(i32 %28, i32 0)
%30 = mul nsw i32 6, %29
%31 = sub nsw i32 %27, %30
%32 = sitofp i32 %31 to double
store double %32, double* %5
%33 = load double, double* %5
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %33)
%35 = call i64 (...) @clock()
store i64 %35, i64* %6
%36 = load i64, i64* %6
%37 = load i64, i64* %2
%38 = sub nsw i64 %36, %37
%39 = sitofp i64 %38 to double
%40 = load double, double* @CLOCKS_PER_SEC
%41 = fdiv double %39, %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), double %41)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"enter the x value: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"%.2lf\0A\00"
@.str.3 = [21 x i8] c"elapsed: %f seconds\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main() {
%1 = alloca i32
%2 = tail call i64 (...) @clock()
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 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), i32* %1)
%6 = load i32, i32* %1
%7 = call i32 @even_power(i32 %6, i32 5)
%8 = mul nsw i32 %7, 3
%9 = load i32, i32* %1
%10 = call i32 @even_power(i32 %9, i32 4)
%11 = shl nsw i32 %10, 1
%12 = add nsw i32 %11, %8
%13 = load i32, i32* %1
%14 = call i32 @even_power(i32 %13, i32 3)
%15 = mul i32 %14, -5
%16 = add i32 %12, %15
%17 = load i32, i32* %1
%18 = call i32 @even_power(i32 %17, i32 2)
%19 = sub i32 %16, %18
%20 = load i32, i32* %1
%21 = call i32 @even_power(i32 %20, i32 1)
%22 = mul nsw i32 %21, 7
%23 = add nsw i32 %19, %22
%24 = load i32, i32* %1
%25 = call i32 @even_power(i32 %24, i32 0)
%26 = mul i32 %25, -6
%27 = add i32 %23, %26
%28 = sitofp i32 %27 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %28)
%30 = call i64 (...) @clock()
%31 = sub nsw i64 %30, %2
%32 = sitofp i64 %31 to double
%33 = load double, double* @CLOCKS_PER_SEC
%34 = fdiv double %32, %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), double %34)
ret i32 0
}