#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 estimate_dynamicCeff(double, double);
double estimate_dynamicffCeff(double, double);
double estimate_gininvCeff(int);
double estimate_sdinvCeff(double);
double estimate_dynamiclogicCeff(double kinvb, double krep, double knor,
                                 double fi, double fld, double nrep,
                                 unsigned Ngates, unsigned Nlw) {
  double ginmininvCeff, sdinvCeff, invbCeff, repCeff;
  double dynamicCeff, dynamicffCeff;
  double Ceff;
  ginmininvCeff = estimate_gininvCeff(1.);
  sdinvCeff = estimate_sdinvCeff(kinvb);
  invbCeff = (kinvb * ginmininvCeff + sdinvCeff);
  sdinvCeff = estimate_sdinvCeff(krep);
  repCeff = (krep * ginmininvCeff + sdinvCeff);
  dynamicCeff = estimate_dynamicCeff(knor, fi);
  dynamicffCeff = estimate_dynamicffCeff(knor, fld);
  Ceff = (double)Ngates * (dynamicCeff + dynamicffCeff) +
         (double)Nlw * invbCeff + (double)Nlw * nrep * repCeff;
  return Ceff;
}


x86 assembly (clang, -O0):
<estimate_dynamiclogicCeff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
mov    %edi,-0x34(%rbp)
mov    %esi,-0x38(%rbp)
mov    $0x1,%edi
call   1060 <estimate_gininvCeff@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <estimate_sdinvCeff@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <estimate_sdinvCeff@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1040 <estimate_dynamicCeff@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1030 <estimate_dynamicffCeff@plt>
movsd  %xmm0,-0x68(%rbp)
mov    -0x34(%rbp),%eax
cvtsi2sd %rax,%xmm1
movsd  -0x60(%rbp),%xmm3
movsd  -0x68(%rbp),%xmm0
addsd  %xmm0,%xmm3
mov    -0x38(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  -0x50(%rbp),%xmm4
movaps %xmm0,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  -0x30(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<estimate_dynamiclogicCeff>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
movsd  %xmm5,0x30(%rsp)
movsd  %xmm4,0x28(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1060 <estimate_gininvCeff@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1050 <estimate_sdinvCeff@plt>
movsd  (%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <estimate_sdinvCeff@plt>
movsd  0x10(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1040 <estimate_dynamicCeff@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
call   1030 <estimate_dynamicffCeff@plt>
mov    %ebp,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
addsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
mov    %ebx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movsd  (%rsp),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
movsd  0x30(%rsp),%xmm2
mulsd  %xmm1,%xmm2
mulsd  0x10(%rsp),%xmm2
addsd  %xmm2,%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @estimate_dynamiclogicCeff(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6, i32 %7) {
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
store double %0, double* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%24 = call double @estimate_gininvCeff(i32 1)
store double %24, double* %17
%25 = load double, double* %9
%26 = call double @estimate_sdinvCeff(double %25)
store double %26, double* %18
%27 = load double, double* %9
%28 = load double, double* %17
%29 = load double, double* %18
%30 = call double @llvm.fmuladd.f64(double %27, double %28, double %29)
store double %30, double* %19
%31 = load double, double* %10
%32 = call double @estimate_sdinvCeff(double %31)
store double %32, double* %18
%33 = load double, double* %10
%34 = load double, double* %17
%35 = load double, double* %18
%36 = call double @llvm.fmuladd.f64(double %33, double %34, double %35)
store double %36, double* %20
%37 = load double, double* %11
%38 = load double, double* %12
%39 = call double @estimate_dynamicCeff(double %37, double %38)
store double %39, double* %21
%40 = load double, double* %11
%41 = load double, double* %13
%42 = call double @estimate_dynamicffCeff(double %40, double %41)
store double %42, double* %22
%43 = load i32, i32* %15
%44 = uitofp i32 %43 to double
%45 = load double, double* %21
%46 = load double, double* %22
%47 = fadd double %45, %46
%48 = load i32, i32* %16
%49 = uitofp i32 %48 to double
%50 = load double, double* %19
%51 = fmul double %49, %50
%52 = call double @llvm.fmuladd.f64(double %44, double %47, double %51)
%53 = load i32, i32* %16
%54 = uitofp i32 %53 to double
%55 = load double, double* %14
%56 = fmul double %54, %55
%57 = load double, double* %20
%58 = call double @llvm.fmuladd.f64(double %56, double %57, double %52)
store double %58, double* %23
%59 = load double, double* %23
ret double %59
}

LLVM IR (-O2):
define double @estimate_dynamiclogicCeff(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6, i32 %7) {
%9 = tail call double @estimate_gininvCeff(i32 1)
%10 = tail call double @estimate_sdinvCeff(double %0)
%11 = tail call double @llvm.fmuladd.f64(double %0, double %9, double %10)
%12 = tail call double @estimate_sdinvCeff(double %1)
%13 = tail call double @llvm.fmuladd.f64(double %1, double %9, double %12)
%14 = tail call double @estimate_dynamicCeff(double %2, double %3)
%15 = tail call double @estimate_dynamicffCeff(double %2, double %4)
%16 = uitofp i32 %6 to double
%17 = fadd double %14, %15
%18 = uitofp i32 %7 to double
%19 = fmul double %11, %18
%20 = tail call double @llvm.fmuladd.f64(double %16, double %17, double %19)
%21 = fmul double %18, %5
%22 = tail call double @llvm.fmuladd.f64(double %21, double %13, double %20)
ret double %22
}