#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*/ error(char *);
double pow(int, unsigned int);
double geompdf(unsigned k, double p) {
  if (p <= 0 || p > 1)
    error("Parameter lambda is smaller than 0.");
  if (k < 0)
    return 0.0;
  return pow(1 - p, k) * p;
}


x86 assembly (clang, -O0):
<geompdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jae    1155 <geompdf+0x35>
movsd  -0x18(%rbp),%xmm0
movsd  0xeb5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1161 <geompdf+0x41>
lea    0xeac(%rip),%rdi
call   1030 <error@plt>
cmpl   $0x0,-0xc(%rbp)
jae    1178 <geompdf+0x58>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    119b <geompdf+0x7b>
movsd  0xe80(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
mov    -0xc(%rbp),%esi
call   1040 <pow@plt>
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geompdf>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
movsd  %xmm0,0x8(%rsp)
jae    1141 <geompdf+0x21>
ucomisd 0xec1(%rip),%xmm0
jbe    1153 <geompdf+0x33>
lea    0xec0(%rip),%rdi
call   1030 <error@plt>
movsd  0x8(%rsp),%xmm0
movsd  0xea5(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
mov    %ebx,%esi
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Parameter lambda is smaller than 0.\00"
define double @geompdf(i32 %0, double %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %4
store double %1, double* %5
%6 = load double, double* %5
%7 = fcmp ole double %6, 0.000000e+00
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load double, double* %5
%10 = fcmp ogt double %9, 1.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %8, %2
%12 = call i32 @error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = load i32, i32* %4
%15 = icmp ult i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store double 0.000000e+00, double* %3
br label %25
17: ; preds = %13
%18 = load double, double* %5
%19 = fsub double 1.000000e+00, %18
%20 = fptosi double %19 to i32
%21 = load i32, i32* %4
%22 = call double @pow(i32 %20, i32 %21)
%23 = load double, double* %5
%24 = fmul double %22, %23
store double %24, double* %3
br label %25
25: ; preds = %17, %16
%26 = load double, double* %3
ret double %26
}

LLVM IR (-O2):
@.str = [36 x i8] c"Parameter lambda is smaller than 0.\00"
define double @geompdf(i32 %0, double %1) {
%3 = fcmp ole double %1, 0.000000e+00
%4 = fcmp ogt double %1, 1.000000e+00
%5 = or i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = fsub double 1.000000e+00, %1
%10 = fptosi double %9 to i32
%11 = tail call double @pow(i32 %10, i32 %0)
%12 = fmul double %11, %1
ret double %12
}