#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 get_seed();
int rand();
int /*<<< orphan*/ srand(unsigned int);
void rand_multi_int(int num, int *result, int min, int max) {
  int i = 0;
  int range = max - min;
  unsigned int seed = get_seed();
  int temp = 0;
  srand(seed);
  for (i = 0; i < num; i++) {
    temp = rand() % range;
    result[i] = temp + min;
  }
}


x86 assembly (clang, -O0):
<rand_multi_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <get_seed@plt>
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x24(%rbp),%edi
call   1030 <srand@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ae <rand_multi_int+0x7e>
mov    $0x0,%al
call   1050 <rand@plt>
cltd
idivl  -0x20(%rbp)
mov    %edx,-0x28(%rbp)
mov    -0x28(%rbp),%edx
add    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1175 <rand_multi_int+0x45>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_multi_int>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r13d
mov    %edx,%r12d
mov    %rsi,%r14
mov    %edi,%r15d
xor    %eax,%eax
call   1040 <get_seed@plt>
mov    %eax,%edi
call   1030 <srand@plt>
test   %r15d,%r15d
jle    118b <rand_multi_int+0x5b>
sub    %r12d,%r13d
mov    %r15d,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <rand@plt>
cltd
idiv   %r13d
add    %r12d,%edx
mov    %edx,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <rand_multi_int+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @rand_multi_int(i32 %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
%13 = load i32, i32* %8
%14 = load i32, i32* %7
%15 = sub nsw i32 %13, %14
store i32 %15, i32* %10
%16 = call i32 (...) @get_seed()
store i32 %16, i32* %11
store i32 0, i32* %12
%17 = load i32, i32* %11
%18 = call i32 @srand(i32 %17)
store i32 0, i32* %9
br label %19
19: ; preds = %34, %4
%20 = load i32, i32* %9
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %37
23: ; preds = %19
%24 = call i32 (...) @rand()
%25 = load i32, i32* %10
%26 = srem i32 %24, %25
store i32 %26, i32* %12
%27 = load i32, i32* %12
%28 = load i32, i32* %7
%29 = add nsw i32 %27, %28
%30 = load i32*, i32** %6
%31 = load i32, i32* %9
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
store i32 %29, i32* %33
br label %34
34: ; preds = %23
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %19
37: ; preds = %19
ret void
}

LLVM IR (-O2):
define void @rand_multi_int(i32 %0, i32* nocapture writeonly %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %3, %2
%6 = tail call i32 (...) @get_seed()
%7 = tail call i32 @srand(i32 %6)
%8 = icmp sgt i32 %0, 0
br i1 %8, label %9, label %19
9: ; preds = %4
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %17, %11 ]
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, %5
%15 = add nsw i32 %14, %2
%16 = getelementptr inbounds i32, i32* %1, i64 %12
store i32 %15, i32* %16
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %10
br i1 %18, label %19, label %11
19: ; preds = %11, %4
ret void
}