#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 pow(double, double);
double value(double x, double n, double val) {
  double a = 897.0;
  double d = -3.0;
  double f =
      a + d * x * (1 - pow(x, n - 1)) / (1 - x) - (a + d * (n - 1)) * pow(x, n);
  f /= 1 - x;
  return f - val;
}


x86 assembly (clang, -O0):
<value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe94(%rip),%xmm2
subsd  %xmm2,%xmm1
call   1030 <pow@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x48(%rbp),%xmm0
movsd  0xe76(%rip),%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe66(%rip),%xmm2
subsd  -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  0xe3d(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <pow@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xde4(%rip),%xmm1
subsd  -0x8(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<value>:
sub    $0x38,%rsp
movsd  %xmm2,0x30(%rsp)
movsd  %xmm1,0x28(%rsp)
movsd  %xmm0,0x18(%rsp)
movapd %xmm0,%xmm2
mulsd  0xece(%rip),%xmm2
movsd  %xmm2,0x8(%rsp)
movsd  0xec8(%rip),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
movapd %xmm2,%xmm1
call   1030 <pow@plt>
movsd  0xeb5(%rip),%xmm2
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
movsd  0x18(%rsp),%xmm0
subsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
divsd  %xmm2,%xmm1
movsd  0xe93(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x10(%rsp),%xmm1
mulsd  0xe63(%rip),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x28(%rsp),%xmm1
call   1030 <pow@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  0x8(%rsp),%xmm1
subsd  0x30(%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @value(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
store double 8.970000e+02, double* %7
store double -3.000000e+00, double* %8
%10 = load double, double* %7
%11 = load double, double* %8
%12 = load double, double* %4
%13 = fmul double %11, %12
%14 = load double, double* %4
%15 = load double, double* %5
%16 = fsub double %15, 1.000000e+00
%17 = call double @pow(double %14, double %16)
%18 = fsub double 1.000000e+00, %17
%19 = fmul double %13, %18
%20 = load double, double* %4
%21 = fsub double 1.000000e+00, %20
%22 = fdiv double %19, %21
%23 = fadd double %10, %22
%24 = load double, double* %7
%25 = load double, double* %8
%26 = load double, double* %5
%27 = fsub double %26, 1.000000e+00
%28 = call double @llvm.fmuladd.f64(double %25, double %27, double %24)
%29 = load double, double* %4
%30 = load double, double* %5
%31 = call double @pow(double %29, double %30)
%32 = fneg double %28
%33 = call double @llvm.fmuladd.f64(double %32, double %31, double %23)
store double %33, double* %9
%34 = load double, double* %4
%35 = fsub double 1.000000e+00, %34
%36 = load double, double* %9
%37 = fdiv double %36, %35
store double %37, double* %9
%38 = load double, double* %9
%39 = load double, double* %6
%40 = fsub double %38, %39
ret double %40
}

LLVM IR (-O2):
define double @value(double %0, double %1, double %2) {
%4 = fmul double %0, 3.000000e+00
%5 = fadd double %1, -1.000000e+00
%6 = tail call double @pow(double %0, double %5)
%7 = fsub double 1.000000e+00, %6
%8 = fmul double %4, %7
%9 = fsub double 1.000000e+00, %0
%10 = fdiv double %8, %9
%11 = fsub double 8.970000e+02, %10
%12 = tail call double @llvm.fmuladd.f64(double %5, double -3.000000e+00, double 8.970000e+02)
%13 = tail call double @pow(double %0, double %1)
%14 = fneg double %12
%15 = tail call double @llvm.fmuladd.f64(double %14, double %13, double %11)
%16 = fdiv double %15, %9
%17 = fsub double %16, %2
ret double %17
}