#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 /*<<< orphan*/ assert(int);
double cfrac(double, double);
double exp(double);
double log(double);
double upperGamma(double n, double x) {
  assert((n > 0) && (x > 0));
  return cfrac(n, x) * exp(n * log(x) - x);
}


x86 assembly (clang, -O0):
<upperGamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x11(%rbp)
jbe    117b <upperGamma+0x3b>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <cfrac@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<upperGamma>:
sub    $0x18,%rsp
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
seta   %al
ucomisd %xmm2,%xmm1
seta   %cl
and    %al,%cl
movzbl %cl,%edi
call   1040 <assert@plt>
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
call   1030 <cfrac@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1060 <log@plt>
mulsd  0x8(%rsp),%xmm0
subsd  (%rsp),%xmm0
call   1050 <exp@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @upperGamma(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fcmp ogt double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load double, double* %4
%9 = fcmp ogt double %8, 0.000000e+00
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load double, double* %3
%15 = load double, double* %4
%16 = call double @cfrac(double %14, double %15)
%17 = load double, double* %3
%18 = load double, double* %4
%19 = call double @log(double %18)
%20 = load double, double* %4
%21 = fneg double %20
%22 = call double @llvm.fmuladd.f64(double %17, double %19, double %21)
%23 = call double @exp(double %22)
%24 = fmul double %16, %23
ret double %24
}

LLVM IR (-O2):
define double @upperGamma(double %0, double %1) {
%3 = fcmp ogt double %0, 0.000000e+00
%4 = fcmp ogt double %1, 0.000000e+00
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call double @cfrac(double %0, double %1)
%9 = tail call double @log(double %1)
%10 = fneg double %1
%11 = tail call double @llvm.fmuladd.f64(double %0, double %9, double %10)
%12 = tail call double @exp(double %11)
%13 = fmul double %8, %12
ret double %13
}