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);
  void nrerror(char error_text[]);
  float gamser, gammcf, gln;
  if (x < 0.0 || a <= 0.0)
    nrerror("invalid arguments in routine gammp ");
  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     117a <gammp+0x4a>
lea    0xe93(%rip),%rdi
call   1030 <nrerror@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe6c(%rip),%xmm2
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    11c8 <gammp+0x98>
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    11fd <gammp+0xcd>
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  0xe10(%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    $0x28,%rsp
cvtss2sd %xmm1,%xmm3
xorps  %xmm2,%xmm2
ucomiss %xmm0,%xmm2
jae    1145 <gammp+0x15>
ucomiss %xmm1,%xmm2
jbe    1175 <gammp+0x45>
lea    0xec0(%rip),%rdi
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0xc(%rsp)
movsd  %xmm3,0x20(%rsp)
call   1030 <nrerror@plt>
movsd  0x20(%rsp),%xmm3
movss  0xc(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
addsd  0xe7c(%rip),%xmm2
ucomisd %xmm3,%xmm2
jbe    11a4 <gammp+0x74>
lea    0x1c(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1040 <gser@plt>
movss  0x1c(%rsp),%xmm0
add    $0x28,%rsp
ret
lea    0x18(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1050 <gcf@plt>
movss  0xe4d(%rip),%xmm0
subss  0x18(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"invalid arguments in routine gammp \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 %17
16: ; preds = %12, %2
br label %17
17: ; preds = %16, %12
%18 = load float, float* %5
%19 = fpext float %18 to double
%20 = load float, float* %4
%21 = fpext float %20 to double
%22 = fadd double %21, 1.000000e+00
%23 = fcmp olt double %19, %22
br i1 %23, label %24, label %28
24: ; preds = %17
%25 = load float, float* %4
%26 = load float, float* %5
%27 = load float, float* %6
store float %27, float* %3
br label %35
28: ; preds = %17
%29 = load float, float* %4
%30 = load float, float* %5
%31 = load float, float* %7
%32 = fpext float %31 to double
%33 = fsub double 1.000000e+00, %32
%34 = fptrunc double %33 to float
store float %34, float* %3
br label %35
35: ; preds = %28, %24
%36 = load float, float* %3
ret float %36
}

LLVM IR (-O2):
@.str = [36 x i8] c"invalid arguments in routine gammp \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 = fpext float %1 to double
%10 = fcmp uge float %1, 0.000000e+00
%11 = fcmp ugt float %0, 0.000000e+00
%12 = and i1 %11, %10
br i1 %12, label %14, label %13
13: ; preds = %2
tail call void @nrerror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %2, %13
%15 = fpext float %0 to double
%16 = fadd double %15, 1.000000e+00
%17 = fcmp ogt double %16, %9
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = load float, float* %3
br label %23
20: ; preds = %14
%21 = load float, float* %4
%22 = fsub float 1.000000e+00, %21
br label %23
23: ; preds = %20, %18
%24 = phi float [ %19, %18 ], [ %22, %20 ]
ret float %24
}