#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 random_int(int, int);
int /*<<< orphan*/ random_seed();
void sort_rnd_data_fill(int *data, int length, int min, int max) {
  int i = 0;
  random_seed();
  while (i < length) {
    data[i] = random_int(min, max);
    i++;
  }
}


x86 assembly (clang, -O0):
<sort_rnd_data_fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <random_seed@plt>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1175 <sort_rnd_data_fill+0x55>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <random_int@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1143 <sort_rnd_data_fill+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort_rnd_data_fill>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r12d
mov    %esi,%r15d
mov    %rdi,%r13
xor    %eax,%eax
call   1040 <random_seed@plt>
test   %r15d,%r15d
jle    1169 <sort_rnd_data_fill+0x49>
mov    %r15d,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %r14d,%esi
call   1030 <random_int@plt>
mov    %eax,0x0(%r13,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <sort_rnd_data_fill+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @sort_rnd_data_fill(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = 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
%10 = call i32 (...) @random_seed()
br label %11
11: ; preds = %15, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %25
15: ; preds = %11
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = call i32 @random_int(i32 %16, i32 %17)
%19 = load i32*, i32** %5
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
store i32 %18, i32* %22
%23 = load i32, i32* %9
%24 = add nsw i32 %23, 1
store i32 %24, i32* %9
br label %11
25: ; preds = %11
ret void
}

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