#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 pow(double const, double const);
int sqrt(double const);
double fk_prime(const double p, const double pk, const double rhok,
                const double Ak, const double Bk, const double ak,
                const double z, const double g) {
  if (p > pk) {
    return (1 - (p - pk) / (2 * (Bk + p))) * sqrt(Ak / (p + Bk));
  } else {
    return 1. / (ak * rhok) * pow(p / pk, -z - 1. / g);
  }
}


x86 assembly (clang, -O0):
<fk_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  %xmm6,-0x40(%rbp)
movsd  %xmm7,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11c4 <fk_prime+0xa4>
movsd  -0x10(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
addsd  -0x10(%rbp),%xmm2
movsd  0xe8c(%rip),%xmm0
mulsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xe74(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  -0x50(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    122d <fk_prime+0x10d>
movsd  -0x38(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  0xe2a(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xdf3(%rip),%xmm2
divsd  -0x48(%rbp),%xmm2
subsd  %xmm2,%xmm1
call   1030 <pow@plt>
movsd  -0x58(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fk_prime>:
push   %rax
ucomisd %xmm1,%xmm0
jbe    115b <fk_prime+0x3b>
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
addsd  %xmm0,%xmm4
divsd  %xmm4,%xmm3
addsd  %xmm4,%xmm4
divsd  %xmm4,%xmm2
movsd  0xeb9(%rip),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm3,%xmm0
call   1040 <sqrt@plt>
jmp    1191 <fk_prime+0x71>
mulsd  %xmm5,%xmm2
movsd  0xe99(%rip),%xmm3
movapd %xmm3,%xmm4
divsd  %xmm2,%xmm4
movsd  %xmm4,(%rsp)
divsd  %xmm1,%xmm0
xorpd  0xe90(%rip),%xmm6
divsd  %xmm7,%xmm3
subsd  %xmm3,%xmm6
movapd %xmm6,%xmm1
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @fk_prime(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store double %0, double* %10
store double %1, double* %11
store double %2, double* %12
store double %3, double* %13
store double %4, double* %14
store double %5, double* %15
store double %6, double* %16
store double %7, double* %17
%18 = load double, double* %10
%19 = load double, double* %11
%20 = fcmp ogt double %18, %19
br i1 %20, label %21, label %39
21: ; preds = %8
%22 = load double, double* %10
%23 = load double, double* %11
%24 = fsub double %22, %23
%25 = load double, double* %14
%26 = load double, double* %10
%27 = fadd double %25, %26
%28 = fmul double 2.000000e+00, %27
%29 = fdiv double %24, %28
%30 = fsub double 1.000000e+00, %29
%31 = load double, double* %13
%32 = load double, double* %10
%33 = load double, double* %14
%34 = fadd double %32, %33
%35 = fdiv double %31, %34
%36 = call i32 @sqrt(double %35)
%37 = sitofp i32 %36 to double
%38 = fmul double %30, %37
store double %38, double* %9
br label %55
39: ; preds = %8
%40 = load double, double* %15
%41 = load double, double* %12
%42 = fmul double %40, %41
%43 = fdiv double 1.000000e+00, %42
%44 = load double, double* %10
%45 = load double, double* %11
%46 = fdiv double %44, %45
%47 = load double, double* %16
%48 = fneg double %47
%49 = load double, double* %17
%50 = fdiv double 1.000000e+00, %49
%51 = fsub double %48, %50
%52 = call i32 @pow(double %46, double %51)
%53 = sitofp i32 %52 to double
%54 = fmul double %43, %53
store double %54, double* %9
br label %55
55: ; preds = %39, %21
%56 = load double, double* %9
ret double %56
}

LLVM IR (-O2):
define double @fk_prime(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = fcmp ogt double %0, %1
br i1 %9, label %10, label %18
10: ; preds = %8
%11 = fsub double %0, %1
%12 = fadd double %0, %4
%13 = fmul double %12, 2.000000e+00
%14 = fdiv double %11, %13
%15 = fsub double 1.000000e+00, %14
%16 = fdiv double %3, %12
%17 = tail call i32 @sqrt(double %16)
br label %26
18: ; preds = %8
%19 = fmul double %2, %5
%20 = fdiv double 1.000000e+00, %19
%21 = fdiv double %0, %1
%22 = fneg double %6
%23 = fdiv double 1.000000e+00, %7
%24 = fsub double %22, %23
%25 = tail call i32 @pow(double %21, double %24)
br label %26
26: ; preds = %18, %10
%27 = phi i32 [ %25, %18 ], [ %17, %10 ]
%28 = phi double [ %20, %18 ], [ %15, %10 ]
%29 = sitofp i32 %27 to double
%30 = fmul double %28, %29
ret double %30
}