#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 fc_rand_debug(int, char *, int, char *);
int floor(double);
int api_utilities_random(int min, int max) {
  double roll =
      ((double)(fc_rand_debug((0xFFFFFFFF), "fc_rand", 31,
                              "/scratch/repos/new/home/jordi_armengol_estape/"
                              "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                              "HossainKhademian/FreeCivAndroid/refs/heads/"
                              "master/server/scripting/api_utilities.c") %
                0xFFFFFFFF) /
       (double)0xFFFFFFFF);
  return (min + floor(roll * (max - min + 1)));
}


x86 assembly (clang, -O0):
<api_utilities_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xed3(%rip),%rsi
lea    0xed4(%rip),%rcx
mov    $0xffffffff,%edi
mov    $0x1f,%edx
call   1030 <fc_rand_debug@plt>
xor    %ecx,%ecx
mov    %eax,%edx
sub    $0xffffffff,%edx
cmove  %ecx,%eax
cvtsi2sd %rax,%xmm0
movsd  0xe9e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
call   1040 <floor@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<api_utilities_random>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xeda(%rip),%rsi
lea    0xedb(%rip),%rcx
mov    $0xffffffff,%edi
mov    $0x1f,%edx
call   1030 <fc_rand_debug@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
cmovne %eax,%ecx
cvtsi2sd %rcx,%xmm1
divsd  0xea7(%rip),%xmm1
sub    %ebx,%ebp
add    $0x1,%ebp
cvtsi2sd %ebp,%xmm0
mulsd  %xmm1,%xmm0
call   1040 <floor@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"fc_rand\00"
@.str.1 = [173 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/HossainKhademian/FreeCivAndroid/refs/heads/master/server/scripting/api_utilities.c\00"
define i32 @api_utilities_random(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 @fc_rand_debug(i32 -1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 31, i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str.1, i64 0, i64 0))
%7 = urem i32 %6, -1
%8 = uitofp i32 %7 to double
%9 = fdiv double %8, 0x41EFFFFFFFE00000
store double %9, double* %5
%10 = load i32, i32* %3
%11 = load double, double* %5
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = sub nsw i32 %12, %13
%15 = add nsw i32 %14, 1
%16 = sitofp i32 %15 to double
%17 = fmul double %11, %16
%18 = call i32 @floor(double %17)
%19 = add nsw i32 %10, %18
ret i32 %19
}

LLVM IR (-O2):
@.str = [8 x i8] c"fc_rand\00"
@.str.1 = [173 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/HossainKhademian/FreeCivAndroid/refs/heads/master/server/scripting/api_utilities.c\00"
define i32 @api_utilities_random(i32 %0, i32 %1) {
%3 = tail call i32 @fc_rand_debug(i32 -1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 31, i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32 %3, -1
%5 = select i1 %4, i32 0, i32 %3
%6 = uitofp i32 %5 to double
%7 = fdiv double %6, 0x41EFFFFFFFE00000
%8 = sub i32 1, %0
%9 = add i32 %8, %1
%10 = sitofp i32 %9 to double
%11 = fmul double %7, %10
%12 = tail call i32 @floor(double %11)
%13 = add nsw i32 %12, %0
ret i32 %13
}