#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 */
unsigned int RAND_MAX;
int getpid();
unsigned int rand();
int /*<<< orphan*/ srand(int);
int time(int /*<<< orphan*/ *);
int randomRange(int Min, int Max) {
  srand(time(NULL) + getpid());
  int diff = Max - Min;
  srand(getpid() * time(NULL));
  return (int)(((unsigned int)(diff + 1) / RAND_MAX) * rand() + Min);
}


x86 assembly (clang, -O0):
<randomRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x18(%rbp),%edi
add    %eax,%edi
call   1040 <srand@plt>
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    -0x14(%rbp),%edi
imul   %eax,%edi
call   1040 <srand@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    0x2e49(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
add    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomRange>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %edi,%r14d
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
add    %eax,%ebx
mov    %ebx,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1050 <time@plt>
imul   %eax,%ebx
mov    %ebx,%edi
call   1040 <srand@plt>
sub    %r14d,%ebp
add    $0x1,%ebp
mov    0x2e5f(%rip),%rcx
mov    %ebp,%eax
xor    %edx,%edx
divl   (%rcx)
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <rand@plt>
imul   %ebx,%eax
add    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @randomRange(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 @time(i32* null)
%7 = call i32 (...) @getpid()
%8 = add nsw i32 %6, %7
%9 = call i32 @srand(i32 %8)
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = sub nsw i32 %10, %11
store i32 %12, i32* %5
%13 = call i32 (...) @getpid()
%14 = call i32 @time(i32* null)
%15 = mul nsw i32 %13, %14
%16 = call i32 @srand(i32 %15)
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
%19 = load i32, i32* @RAND_MAX
%20 = udiv i32 %18, %19
%21 = call i32 (...) @rand()
%22 = mul i32 %20, %21
%23 = load i32, i32* %3
%24 = add i32 %22, %23
ret i32 %24
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @randomRange(i32 %0, i32 %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 (...) @getpid()
%5 = add nsw i32 %4, %3
%6 = tail call i32 @srand(i32 %5)
%7 = tail call i32 (...) @getpid()
%8 = tail call i32 @time(i32* null)
%9 = mul nsw i32 %8, %7
%10 = tail call i32 @srand(i32 %9)
%11 = sub i32 1, %0
%12 = add i32 %11, %1
%13 = load i32, i32* @RAND_MAX
%14 = udiv i32 %12, %13
%15 = tail call i32 (...) @rand()
%16 = mul i32 %15, %14
%17 = add i32 %16, %0
ret i32 %17
}