#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_in_cap(double length) {
  double Ctotal = 0;
  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_in_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,-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  0xe72(%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_in_cap>:
push   %rbp
push   %rbx
push   %rax
movsd  %xmm0,(%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
movsd  (%rsp),%xmm1
mulsd  0xe94(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%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  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @SIM_omflip_in_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 = call i32 @SIM_power_gatecap(i32 0, i32 0)
%8 = add nsw i32 %6, %7
%9 = sitofp i32 %8 to double
%10 = load double, double* %3
%11 = fadd double %10, %9
store double %11, double* %3
%12 = load double, double* %2
%13 = load double, double* %3
%14 = call double @llvm.fmuladd.f64(double 0x3CE112CF5FD1CE25, double %12, double %13)
store double %14, double* %3
%15 = call i32 @SIM_power_draincap(i32 0, i32 1, i32 1)
%16 = mul nsw i32 2, %15
%17 = call i32 @SIM_power_draincap(i32 0, i32 0, i32 1)
%18 = add nsw i32 %16, %17
%19 = sitofp i32 %18 to double
%20 = load double, double* %3
%21 = fadd double %20, %19
store double %21, double* %3
%22 = load double, double* %3
ret double %22
}

LLVM IR (-O2):
define double @SIM_omflip_in_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 = tail call i32 @SIM_power_gatecap(i32 0, i32 0)
%6 = add nsw i32 %4, %5
%7 = sitofp i32 %6 to double
%8 = tail call double @llvm.fmuladd.f64(double %0, double 0x3CE112CF5FD1CE25, double %7)
%9 = tail call i32 @SIM_power_draincap(i32 0, i32 1, i32 1)
%10 = shl nsw i32 %9, 1
%11 = tail call i32 @SIM_power_draincap(i32 0, i32 0, i32 1)
%12 = add nsw i32 %10, %11
%13 = sitofp i32 %12 to double
%14 = fadd double %8, %13
ret double %14
}