#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 integerrng(int, int);
double log(double);
void CO_select_forward_0(double *prob, int *n1, int *n2, int N_population) {
  *n1 = integerrng(1, N_population);
  *n2 = integerrng(1, N_population - 1);
  if (*n2 >= *n1)
    (*n2)++;
  *prob = -log((double)N_population - 1) - log((double)N_population);
}


x86 assembly (clang, -O0):
<CO_select_forward_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    $0x1,%edi
call   1030 <integerrng@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%esi
sub    $0x1,%esi
mov    $0x1,%edi
call   1030 <integerrng@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jl     1181 <CO_select_forward_0+0x61>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  0xe72(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1040 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CO_select_forward_0>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%ebx
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r14
mov    $0x1,%edi
mov    %ecx,%esi
call   1030 <integerrng@plt>
mov    %eax,(%r12)
lea    -0x1(%rbx),%esi
mov    $0x1,%edi
call   1030 <integerrng@plt>
mov    %eax,(%r15)
cmp    (%r12),%eax
jl     1162 <CO_select_forward_0+0x42>
add    $0x1,%eax
mov    %eax,(%r15)
cvtsi2sd %ebx,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xe8c(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1040 <log@plt>
xorpd  0xe8b(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <log@plt>
movapd 0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @CO_select_forward_0(double* %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca double*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
store double* %0, double** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = call i32 @integerrng(i32 1, i32 %9)
%11 = load i32*, i32** %6
store i32 %10, i32* %11
%12 = load i32, i32* %8
%13 = sub nsw i32 %12, 1
%14 = call i32 @integerrng(i32 1, i32 %13)
%15 = load i32*, i32** %7
store i32 %14, i32* %15
%16 = load i32*, i32** %7
%17 = load i32, i32* %16
%18 = load i32*, i32** %6
%19 = load i32, i32* %18
%20 = icmp sge i32 %17, %19
br i1 %20, label %21, label %25
21: ; preds = %4
%22 = load i32*, i32** %7
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
store i32 %24, i32* %22
br label %25
25: ; preds = %21, %4
%26 = load i32, i32* %8
%27 = sitofp i32 %26 to double
%28 = fsub double %27, 1.000000e+00
%29 = call double @log(double %28)
%30 = fneg double %29
%31 = load i32, i32* %8
%32 = sitofp i32 %31 to double
%33 = call double @log(double %32)
%34 = fsub double %30, %33
%35 = load double*, double** %5
store double %34, double* %35
ret void
}

LLVM IR (-O2):
define void @CO_select_forward_0(double* nocapture writeonly %0, i32* nocapture %1, i32* nocapture writeonly %2, i32 %3) {
%5 = tail call i32 @integerrng(i32 1, i32 %3)
store i32 %5, i32* %1
%6 = add nsw i32 %3, -1
%7 = tail call i32 @integerrng(i32 1, i32 %6)
store i32 %7, i32* %2
%8 = load i32, i32* %1
%9 = icmp slt i32 %7, %8
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = add nsw i32 %7, 1
store i32 %11, i32* %2
br label %12
12: ; preds = %10, %4
%13 = sitofp i32 %3 to double
%14 = fadd double %13, -1.000000e+00
%15 = tail call double @log(double %14)
%16 = fneg double %15
%17 = tail call double @log(double %13)
%18 = fsub double %16, %17
store double %18, double* %0
ret void
}