#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
double gamma_help_1(double, double, char const *);
double gamma_help_2(double, double, char const *);
int /*<<< orphan*/ stderr;
double incomplete_gamma(double a, double x, const char *prompt) {
  if (x < 0 || a <= 0) {
    fprintf(stderr,
            "%s: IMPLEMENTATION ERROR! (Invalid argument in function "
            "\"incomplete_gamma\")\n",
            prompt);
    exit(4);
  }
  if (x < (a + 1))
    return gamma_help_1(a, x, prompt);
  else
    return 1 - gamma_help_2(a, x, prompt);
}


x86 assembly (clang, -O0):
<incomplete_gamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     1172 <incomplete_gamma+0x32>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1195 <incomplete_gamma+0x55>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe82(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x4,%edi
call   1060 <exit@plt>
movsd  -0x18(%rbp),%xmm1
movsd  0xe5e(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ce <incomplete_gamma+0x8e>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x20(%rbp),%rdi
call   1050 <gamma_help_1@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11f5 <incomplete_gamma+0xb5>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x20(%rbp),%rdi
call   1030 <gamma_help_2@plt>
movaps %xmm0,%xmm1
movsd  0xe14(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<incomplete_gamma>:
push   %rax
mov    %rdi,%rdx
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
jae    1186 <incomplete_gamma+0x46>
ucomisd %xmm1,%xmm2
ja     1186 <incomplete_gamma+0x46>
movsd  0xea4(%rip),%xmm2
addsd  %xmm0,%xmm2
mov    %rdx,%rdi
ucomisd %xmm1,%xmm2
jbe    116f <incomplete_gamma+0x2f>
pop    %rax
jmp    1050 <gamma_help_1@plt>
call   1030 <gamma_help_2@plt>
movsd  0xe84(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
lea    0xe72(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x4,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [77 x i8] c"%s: IMPLEMENTATION ERROR! (Invalid argument in function \22incomplete_gamma\22)\0A\00"
define double @incomplete_gamma(double %0, double %1, i8* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i8*
store double %0, double* %5
store double %1, double* %6
store i8* %2, i8** %7
%8 = load double, double* %6
%9 = fcmp olt double %8, 0.000000e+00
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load double, double* %5
%12 = fcmp ole double %11, 0.000000e+00
br i1 %12, label %13, label %18
13: ; preds = %10, %3
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %7
%16 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 4)
unreachable
18: ; preds = %10
%19 = load double, double* %6
%20 = load double, double* %5
%21 = fadd double %20, 1.000000e+00
%22 = fcmp olt double %19, %21
br i1 %22, label %23, label %28
23: ; preds = %18
%24 = load double, double* %5
%25 = load double, double* %6
%26 = load i8*, i8** %7
%27 = call double @gamma_help_1(double %24, double %25, i8* %26)
store double %27, double* %4
br label %34
28: ; preds = %18
%29 = load double, double* %5
%30 = load double, double* %6
%31 = load i8*, i8** %7
%32 = call double @gamma_help_2(double %29, double %30, i8* %31)
%33 = fsub double 1.000000e+00, %32
store double %33, double* %4
br label %34
34: ; preds = %28, %23
%35 = load double, double* %4
ret double %35
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [77 x i8] c"%s: IMPLEMENTATION ERROR! (Invalid argument in function \22incomplete_gamma\22)\0A\00"
define double @incomplete_gamma(double %0, double %1, i8* %2) {
%4 = fcmp olt double %1, 0.000000e+00
%5 = fcmp ole double %0, 0.000000e+00
%6 = or i1 %5, %4
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0), i8* %2)
%10 = tail call i32 @exit(i32 4)
unreachable
11: ; preds = %3
%12 = fadd double %0, 1.000000e+00
%13 = fcmp ogt double %12, %1
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call double @gamma_help_1(double %0, double %1, i8* %2)
br label %19
16: ; preds = %11
%17 = tail call double @gamma_help_2(double %0, double %1, i8* %2)
%18 = fsub double 1.000000e+00, %17
br label %19
19: ; preds = %16, %14
%20 = phi double [ %15, %14 ], [ %18, %16 ]
ret double %20
}