#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 exp(double);
int /*<<< orphan*/ gcf(double *, double, double, double *);
int /*<<< orphan*/ gser(double *, double, double, double *);
double gamm_inc(double a, double x) {
  double gamser, gammcf, gln;
  assert(x >= 0.);
  assert(a > 0.);
  if (x < (a + 1.0)) {
    gser(&gamser, a, x, &gln);
    return exp(gln) * gamser;
  } else {
    gcf(&gammcf, a, x, &gln);
    return exp(gln) * (1.0 - gammcf);
  }
}


x86 assembly (clang, -O0):
<gamm_inc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x18(%rbp),%xmm1
movsd  0xe6f(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11d0 <gamm_inc+0x90>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <gser@plt>
movsd  -0x30(%rbp),%xmm0
call   1040 <exp@plt>
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1207 <gamm_inc+0xc7>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <gcf@plt>
movsd  -0x30(%rbp),%xmm0
call   1040 <exp@plt>
movsd  0xe07(%rip),%xmm1
subsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gamm_inc>:
sub    $0x28,%rsp
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm0,%xmm0
xor    %edi,%edi
ucomisd %xmm0,%xmm1
setae  %dil
call   1030 <assert@plt>
xor    %edi,%edi
movsd  0x18(%rsp),%xmm0
ucomisd 0xe95(%rip),%xmm0
seta   %dil
call   1030 <assert@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0xe70(%rip),%xmm2
addsd  %xmm0,%xmm2
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
ucomisd %xmm1,%xmm2
jbe    11bf <gamm_inc+0x7f>
call   1050 <gser@plt>
movsd  0x8(%rsp),%xmm0
call   1040 <exp@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x28,%rsp
ret
call   1060 <gcf@plt>
movsd  0x8(%rsp),%xmm0
call   1040 <exp@plt>
movapd %xmm0,%xmm1
movsd  0xe25(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @gamm_inc(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
%9 = load double, double* %5
%10 = fcmp oge double %9, 0.000000e+00
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load double, double* %4
%14 = fcmp ogt double %13, 0.000000e+00
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load double, double* %5
%18 = load double, double* %4
%19 = fadd double %18, 1.000000e+00
%20 = fcmp olt double %17, %19
br i1 %20, label %21, label %29
21: ; preds = %2
%22 = load double, double* %4
%23 = load double, double* %5
%24 = call i32 @gser(double* %6, double %22, double %23, double* %8)
%25 = load double, double* %8
%26 = call double @exp(double %25)
%27 = load double, double* %6
%28 = fmul double %26, %27
store double %28, double* %3
br label %38
29: ; preds = %2
%30 = load double, double* %4
%31 = load double, double* %5
%32 = call i32 @gcf(double* %7, double %30, double %31, double* %8)
%33 = load double, double* %8
%34 = call double @exp(double %33)
%35 = load double, double* %7
%36 = fsub double 1.000000e+00, %35
%37 = fmul double %34, %36
store double %37, double* %3
br label %38
38: ; preds = %29, %21
%39 = load double, double* %3
ret double %39
}

LLVM IR (-O2):
define double @gamm_inc(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = bitcast double* %3 to i8*
%7 = bitcast double* %4 to i8*
%8 = bitcast double* %5 to i8*
%9 = fcmp oge double %1, 0.000000e+00
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = fcmp ogt double %0, 0.000000e+00
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = fadd double %0, 1.000000e+00
%16 = fcmp ogt double %15, %1
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = call i32 @gser(double* %3, double %0, double %1, double* %5)
%19 = load double, double* %5
%20 = call double @exp(double %19)
%21 = load double, double* %3
%22 = fmul double %20, %21
br label %30
23: ; preds = %2
%24 = call i32 @gcf(double* %4, double %0, double %1, double* %5)
%25 = load double, double* %5
%26 = call double @exp(double %25)
%27 = load double, double* %4
%28 = fsub double 1.000000e+00, %27
%29 = fmul double %26, %28
br label %30
30: ; preds = %23, %17
%31 = phi double [ %22, %17 ], [ %29, %23 ]
ret double %31
}