double pdtri(k, y)
int k;
double y;
{
  double v;
  if ((k < 0) || (y < 0.0) || (y >= 1.0)) {
    mtherr("pdtri", 1);
    return (0.0);
  }
  v = k + 1;
  v = igami(v, y);
  return (v);
}


x86 assembly (clang, -O0):
<pdtri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     115f <pdtri+0x3f>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     115f <pdtri+0x3f>
movsd  -0x18(%rbp),%xmm0
movsd  0xeab(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     117f <pdtri+0x5f>
lea    0xea2(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <mtherr@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b2 <pdtri+0x92>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    $0x2,%al
call   1030 <igami@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdtri>:
push   %rax
ucomisd 0xed7(%rip),%xmm0
jae    1157 <pdtri+0x37>
test   %edi,%edi
js     1157 <pdtri+0x37>
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     1157 <pdtri+0x37>
add    $0x1,%edi
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
mov    $0x2,%al
call   1030 <igami@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret
lea    0xeaa(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <mtherr@plt>
xorpd  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"pdtri\00"
define double @pdtri(i32 %0, double %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %4
store double %1, double* %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %2
%10 = load double, double* %5
%11 = fcmp olt double %10, 0.000000e+00
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load double, double* %5
%14 = fcmp oge double %13, 1.000000e+00
br i1 %14, label %15, label %17
15: ; preds = %12, %9, %2
%16 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
store double 0.000000e+00, double* %3
br label %26
17: ; preds = %12
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
%20 = sitofp i32 %19 to double
store double %20, double* %6
%21 = load double, double* %6
%22 = load double, double* %5
%23 = call i32 (double, double, ...) bitcast (i32 (...)* @igami to i32 (double, double, ...)*)(double %21, double %22)
%24 = sitofp i32 %23 to double
store double %24, double* %6
%25 = load double, double* %6
store double %25, double* %3
br label %26
26: ; preds = %17, %15
%27 = load double, double* %3
ret double %27
}

LLVM IR (-O2):
@.str = [6 x i8] c"pdtri\00"
define double @pdtri(i32 %0, double %1) {
%3 = icmp slt i32 %0, 0
%4 = fcmp olt double %1, 0.000000e+00
%5 = or i1 %3, %4
%6 = fcmp oge double %1, 1.000000e+00
%7 = or i1 %6, %5
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
br label %15
10: ; preds = %2
%11 = add nuw nsw i32 %0, 1
%12 = sitofp i32 %11 to double
%13 = tail call i32 (double, double, ...) bitcast (i32 (...)* @igami to i32 (double, double, ...)*)(double %12, double %1)
%14 = sitofp i32 %13 to double
br label %15
15: ; preds = %10, %8
%16 = phi double [ 0.000000e+00, %8 ], [ %14, %10 ]
ret double %16
}