#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*/ printf(char *, float, float);
float gammp(float a, float x) {
  void gcf(float *gammcf, float a, float x, float *gln);
  void gser(float *gamser, float a, float x, float *gln);
  float gamser, gammcf, gln;
  if (x < 0.0 || a <= 0.0) {
    printf("Error(gammp):invalid arguments a=%f x=%f\n", a, x);
    return (0);
  }
  if (x < (a + 1.0)) {
    gser(&gamser, a, x, &gln);
    return (gamser);
  } else {
    gcf(&gammcf, a, x, &gln);
    return (1.0 - gammcf);
  }
}


x86 assembly (clang, -O0):
<gammp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     116e <gammp+0x3e>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     1191 <gammp+0x61>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1214 <gammp+0xe4>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe55(%rip),%xmm2
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    11df <gammp+0xaf>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <gser@plt>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1214 <gammp+0xe4>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <gcf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdf9(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gammp>:
sub    $0x18,%rsp
xorps  %xmm2,%xmm2
ucomiss %xmm0,%xmm2
jae    1177 <gammp+0x47>
xorps  %xmm2,%xmm2
ucomiss %xmm1,%xmm2
ja     1177 <gammp+0x47>
xorps  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm2
cvtss2sd %xmm0,%xmm3
addsd  0xea9(%rip),%xmm3
ucomisd %xmm2,%xmm3
jbe    118b <gammp+0x5b>
lea    0x14(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1040 <gser@plt>
movss  0x14(%rsp),%xmm0
add    $0x18,%rsp
ret
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
add    $0x18,%rsp
ret
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1050 <gcf@plt>
movss  0xe66(%rip),%xmm0
subss  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Error(gammp):invalid arguments a=%f x=%f\0A\00"
define float @gammp(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %4
store float %1, float* %5
%9 = load float, float* %5
%10 = fpext float %9 to double
%11 = fcmp olt double %10, 0.000000e+00
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = load float, float* %4
%14 = fpext float %13 to double
%15 = fcmp ole double %14, 0.000000e+00
br i1 %15, label %16, label %20
16: ; preds = %12, %2
%17 = load float, float* %4
%18 = load float, float* %5
%19 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), float %17, float %18)
store float 0.000000e+00, float* %3
br label %38
20: ; preds = %12
%21 = load float, float* %5
%22 = fpext float %21 to double
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = fadd double %24, 1.000000e+00
%26 = fcmp olt double %22, %25
br i1 %26, label %27, label %31
27: ; preds = %20
%28 = load float, float* %4
%29 = load float, float* %5
%30 = load float, float* %6
store float %30, float* %3
br label %38
31: ; preds = %20
%32 = load float, float* %4
%33 = load float, float* %5
%34 = load float, float* %7
%35 = fpext float %34 to double
%36 = fsub double 1.000000e+00, %35
%37 = fptrunc double %36 to float
store float %37, float* %3
br label %38
38: ; preds = %31, %27, %16
%39 = load float, float* %3
ret float %39
}

LLVM IR (-O2):
@.str = [42 x i8] c"Error(gammp):invalid arguments a=%f x=%f\0A\00"
define float @gammp(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = bitcast float* %3 to i8*
%7 = bitcast float* %4 to i8*
%8 = bitcast float* %5 to i8*
%9 = fcmp uge float %1, 0.000000e+00
%10 = fcmp ugt float %0, 0.000000e+00
%11 = and i1 %10, %9
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), float %0, float %1)
br label %24
14: ; preds = %2
%15 = fpext float %1 to double
%16 = fpext float %0 to double
%17 = fadd double %16, 1.000000e+00
%18 = fcmp ogt double %17, %15
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = load float, float* %3
br label %24
21: ; preds = %14
%22 = load float, float* %4
%23 = fsub float 1.000000e+00, %22
br label %24
24: ; preds = %21, %19, %12
%25 = phi float [ 0.000000e+00, %12 ], [ %20, %19 ], [ %23, %21 ]
ret float %25
}