#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 */
int SIM_power_draincap(int, int, int);
int SIM_power_gatecap(int, int /*<<< orphan*/);
double SIM_omflip_stg_cap(double length) {
  double Ctotal = 0;
  Ctotal += SIM_power_draincap((6 * ((0.8 * 0.0875) * 0.5)), 1, 1) +
            SIM_power_draincap((6 * ((0.8 * 0.0875) * 0.5)), 0, 1);
  Ctotal += SIM_power_draincap((3 * ((0.8 * 0.0875) * 0.5)), 1, 1) +
            SIM_power_draincap((6 * ((0.8 * 0.0875) * 0.5)), 0, 1) +
            SIM_power_gatecap(
                (3 * ((0.8 * 0.0875) * 0.5)) + (6 * ((0.8 * 0.0875) * 0.5)), 0);
  Ctotal +=
      (((4.4e-15 * ((172.2157) * (0.0875 * 0.0875))) / 16) * 5.2277) * length;
  Ctotal += 2 * SIM_power_draincap((6 * ((0.8 * 0.0875) * 0.5)), 1, 1) +
            SIM_power_draincap((6 * ((0.8 * 0.0875) * 0.5)), 0, 1);
  return Ctotal;
}


x86 assembly (clang, -O0):
<SIM_omflip_stg_cap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xor    %edi,%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <SIM_power_draincap@plt>
mov    %eax,-0x20(%rbp)
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1030 <SIM_power_draincap@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
xor    %edi,%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <SIM_power_draincap@plt>
mov    %eax,-0x1c(%rbp)
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1030 <SIM_power_draincap@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <SIM_power_gatecap@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe3e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xor    %edi,%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <SIM_power_draincap@plt>
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1030 <SIM_power_draincap@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SIM_omflip_stg_cap>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <SIM_power_draincap@plt>
mov    %eax,%ebx
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <SIM_power_draincap@plt>
add    %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <SIM_power_draincap@plt>
mov    %eax,%ebx
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <SIM_power_draincap@plt>
mov    %eax,%ebp
add    %ebx,%ebp
xor    %edi,%edi
xor    %esi,%esi
call   1040 <SIM_power_gatecap@plt>
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0xe59(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <SIM_power_draincap@plt>
mov    %eax,%ebx
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <SIM_power_draincap@plt>
lea    (%rax,%rbx,2),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @SIM_omflip_stg_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_draincap(i32 0, i32 1, i32 1)
%5 = call i32 @SIM_power_draincap(i32 0, i32 0, i32 1)
%6 = add nsw i32 %4, %5
%7 = sitofp i32 %6 to double
%8 = load double, double* %3
%9 = fadd double %8, %7
store double %9, double* %3
%10 = call i32 @SIM_power_draincap(i32 0, i32 1, i32 1)
%11 = call i32 @SIM_power_draincap(i32 0, i32 0, i32 1)
%12 = add nsw i32 %10, %11
%13 = call i32 @SIM_power_gatecap(i32 0, i32 0)
%14 = add nsw i32 %12, %13
%15 = sitofp i32 %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 0x3CE112CF5FD1CE25, double %18, double %19)
store double %20, double* %3
%21 = call i32 @SIM_power_draincap(i32 0, i32 1, i32 1)
%22 = mul nsw i32 2, %21
%23 = call i32 @SIM_power_draincap(i32 0, i32 0, i32 1)
%24 = add nsw i32 %22, %23
%25 = sitofp i32 %24 to double
%26 = load double, double* %3
%27 = fadd double %26, %25
store double %27, double* %3
%28 = load double, double* %3
ret double %28
}

LLVM IR (-O2):
define double @SIM_omflip_stg_cap(double %0) {
%2 = tail call i32 @SIM_power_draincap(i32 0, i32 1, i32 1)
%3 = tail call i32 @SIM_power_draincap(i32 0, i32 0, i32 1)
%4 = add nsw i32 %3, %2
%5 = sitofp i32 %4 to double
%6 = tail call i32 @SIM_power_draincap(i32 0, i32 1, i32 1)
%7 = tail call i32 @SIM_power_draincap(i32 0, i32 0, i32 1)
%8 = add nsw i32 %7, %6
%9 = tail call i32 @SIM_power_gatecap(i32 0, i32 0)
%10 = add nsw i32 %8, %9
%11 = sitofp i32 %10 to double
%12 = fadd double %5, %11
%13 = tail call double @llvm.fmuladd.f64(double %0, double 0x3CE112CF5FD1CE25, double %12)
%14 = tail call i32 @SIM_power_draincap(i32 0, i32 1, i32 1)
%15 = shl nsw i32 %14, 1
%16 = tail call i32 @SIM_power_draincap(i32 0, i32 0, i32 1)
%17 = add nsw i32 %15, %16
%18 = sitofp i32 %17 to double
%19 = fadd double %13, %18
ret double %19
}