#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 */
scalar_t__ SIM_power_draincap(double, int, int);
int SIM_power_gatecap(double, int /*<<< orphan*/);
double SIM_rr_arbiter_req_cap(double length) {
  double Ctotal = 0;
  Ctotal += 2 * SIM_power_gatecap((5.4 * 0.0875) + (30.5 * 0.0875), 0);
  Ctotal += SIM_power_draincap((5.0 * 0.0875), 1, 1) +
            SIM_power_draincap((10.0 * 0.0875), 0, 1) +
            SIM_power_gatecap((5.0 * 0.0875) + (10.0 * 0.0875), 0);
  Ctotal += length * ((4.4e-15 * ((172.2157) * (0.0875 * 0.0875))) / 16);
  return Ctotal;
}


x86 assembly (clang, -O0):
<SIM_rr_arbiter_req_cap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xee3(%rip),%xmm0
xor    %edi,%edi
call   1040 <SIM_power_gatecap@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xebb(%rip),%xmm0
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <SIM_power_draincap@plt>
mov    %rax,-0x20(%rbp)
movsd  0xe9b(%rip),%xmm0
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <SIM_power_draincap@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
movsd  0xe71(%rip),%xmm0
xor    %edi,%edi
call   1040 <SIM_power_gatecap@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe35(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SIM_rr_arbiter_req_cap>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
movsd  0xecb(%rip),%xmm0
xor    %edi,%edi
call   1040 <SIM_power_gatecap@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xeb5(%rip),%xmm0
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <SIM_power_draincap@plt>
mov    %rax,%r14
movsd  0xea3(%rip),%xmm0
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <SIM_power_draincap@plt>
mov    %rax,%rbx
add    %r14,%rbx
movsd  0xe91(%rip),%xmm0
xor    %edi,%edi
call   1040 <SIM_power_gatecap@plt>
cltq
add    %rbx,%rax
cvtsi2sd %rax,%xmm1
addsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  0xe74(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @SIM_rr_arbiter_req_cap(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 0.000000e+00, double* %3
%4 = call i32 @SIM_power_gatecap(double 3.141250e+00, i32 0)
%5 = mul nsw i32 2, %4
%6 = sitofp i32 %5 to double
%7 = load double, double* %3
%8 = fadd double %7, %6
store double %8, double* %3
%9 = call i64 @SIM_power_draincap(double 4.375000e-01, i32 1, i32 1)
%10 = call i64 @SIM_power_draincap(double 8.750000e-01, i32 0, i32 1)
%11 = add nsw i64 %9, %10
%12 = call i32 @SIM_power_gatecap(double 1.312500e+00, i32 0)
%13 = sext i32 %12 to i64
%14 = add nsw i64 %11, %13
%15 = sitofp i64 %14 to double
%16 = load double, double* %3
%17 = fadd double %16, %15
store double %17, double* %3
%18 = load double, double* %2
%19 = load double, double* %3
%20 = call double @llvm.fmuladd.f64(double %18, double 0x3CBA20B16915269B, double %19)
store double %20, double* %3
%21 = load double, double* %3
ret double %21
}

LLVM IR (-O2):
define double @SIM_rr_arbiter_req_cap(double %0) {
%2 = tail call i32 @SIM_power_gatecap(double 3.141250e+00, i32 0)
%3 = shl nsw i32 %2, 1
%4 = sitofp i32 %3 to double
%5 = tail call i64 @SIM_power_draincap(double 4.375000e-01, i32 1, i32 1)
%6 = tail call i64 @SIM_power_draincap(double 8.750000e-01, i32 0, i32 1)
%7 = add nsw i64 %6, %5
%8 = tail call i32 @SIM_power_gatecap(double 1.312500e+00, i32 0)
%9 = sext i32 %8 to i64
%10 = add nsw i64 %7, %9
%11 = sitofp i64 %10 to double
%12 = fadd double %4, %11
%13 = tail call double @llvm.fmuladd.f64(double %0, double 0x3CBA20B16915269B, double %12)
ret double %13
}