#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*/ erro(char *);
int ranf();
double randompar(int i, int n) {
  if (i > n)
    erro("random Argument Error: i > n");
  n -= i;
  n = (n + 1.0) * ranf();
  return (i + n);
}


x86 assembly (clang, -O0):
<randompar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1146 <randompar+0x26>
lea    0xec7(%rip),%rdi
call   1030 <erro@plt>
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <ranf@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randompar>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
sub    %edi,%ebp
jge    1137 <randompar+0x17>
lea    0xed6(%rip),%rdi
call   1030 <erro@plt>
cvtsi2sd %ebp,%xmm0
addsd  0xebd(%rip),%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <ranf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
cvttsd2si %xmm0,%eax
add    %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"random Argument Error: i > n\00"
define double @randompar(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @erro(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, %11
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to double
%16 = fadd double %15, 1.000000e+00
%17 = call i32 (...) @ranf()
%18 = sitofp i32 %17 to double
%19 = fmul double %16, %18
%20 = fptosi double %19 to i32
store i32 %20, i32* %4
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = add nsw i32 %21, %22
%24 = sitofp i32 %23 to double
ret double %24
}

LLVM IR (-O2):
@.str = [29 x i8] c"random Argument Error: i > n\00"
define double @randompar(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, %0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @erro(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = sub nsw i32 %1, %0
%8 = sitofp i32 %7 to double
%9 = fadd double %8, 1.000000e+00
%10 = tail call i32 (...) @ranf()
%11 = sitofp i32 %10 to double
%12 = fmul double %9, %11
%13 = fptosi double %12 to i32
%14 = add nsw i32 %13, %0
%15 = sitofp i32 %14 to double
ret double %15
}