#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 */
double RAND_MAX;
int /*<<< orphan*/ printf(char *, float, int);
long random();
int /*<<< orphan*/ srandom(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  int max = 20, min = -80;
  srandom((unsigned)time(NULL));
  long rand = random();
  float i = (float)rand / (RAND_MAX + 1.0) * (max - min) + min;
  int j = rand % (max - min + 1) + min;
  printf("%f, %d\n", i, j);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
movl   $0xffffffb0,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
mov    $0x0,%al
call   1060 <random@plt>
mov    %rax,-0x18(%rbp)
cvtsi2ssq -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe76(%rip),%xmm1
mov    0x2e57(%rip),%rax
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm2
cvtsi2sdl -0xc(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cqto
idiv   %rcx
movslq -0xc(%rbp),%rax
add    %rax,%rdx
mov    %edx,%eax
mov    %eax,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
mov    -0x20(%rbp),%esi
lea    0xe1f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rax,%rsi
cvtsi2ss %rax,%xmm0
mov    0x2e83(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xe8f(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
divsd  %xmm1,%xmm0
mulsd  0xe87(%rip),%xmm0
addsd  0xe87(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movabs $0xa237c32b16cfd773,%rcx
c3 37 a2
mov    %rsi,%rax
imul   %rcx
add    %rsi,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0x6,%rdx
add    %eax,%edx
imul   $0x65,%edx,%eax
sub    %eax,%esi
add    $0xffffffb0,%esi
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
@.str = [8 x i8] c"%f, %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca float
%6 = alloca i32
store i32 0, i32* %1
store i32 20, i32* %2
store i32 -80, i32* %3
%7 = call i64 @time(i32* null)
%8 = trunc i64 %7 to i32
%9 = call i32 @srandom(i32 %8)
%10 = call i64 (...) @random()
store i64 %10, i64* %4
%11 = load i64, i64* %4
%12 = sitofp i64 %11 to float
%13 = fpext float %12 to double
%14 = load double, double* @RAND_MAX
%15 = fadd double %14, 1.000000e+00
%16 = fdiv double %13, %15
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = sub nsw i32 %17, %18
%20 = sitofp i32 %19 to double
%21 = load i32, i32* %3
%22 = sitofp i32 %21 to double
%23 = call double @llvm.fmuladd.f64(double %16, double %20, double %22)
%24 = fptrunc double %23 to float
store float %24, float* %5
%25 = load i64, i64* %4
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = sub nsw i32 %26, %27
%29 = add nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = srem i64 %25, %30
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = add nsw i64 %31, %33
%35 = trunc i64 %34 to i32
store i32 %35, i32* %6
%36 = load float, float* %5
%37 = load i32, i32* %6
%38 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float %36, i32 %37)
ret i32 0
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
@.str = [8 x i8] c"%f, %d\0A\00"
define i32 @main() {
%1 = tail call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @srandom(i32 %2)
%4 = tail call i64 (...) @random()
%5 = sitofp i64 %4 to float
%6 = fpext float %5 to double
%7 = load double, double* @RAND_MAX
%8 = fadd double %7, 1.000000e+00
%9 = fdiv double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double 1.000000e+02, double -8.000000e+01)
%11 = fptrunc double %10 to float
%12 = srem i64 %4, 101
%13 = trunc i64 %12 to i32
%14 = add nsw i32 %13, -80
%15 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float %11, i32 %14)
ret i32 0
}