#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
void Associa_Valores_Array(int *Ptr, int Dim) {
  int i = 0;
  time_t t;
  srand((unsigned)time(&t));
  for (; i < Dim; i++)
    *(Ptr + i) = rand() % 1000;
  return;
}


x86 assembly (clang, -O0):
<Associa_Valores_Array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118a <Associa_Valores_Array+0x5a>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1156 <Associa_Valores_Array+0x26>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Associa_Valores_Array>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %rdi,%r14
lea    0xc(%rsp),%rdi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
test   %ebp,%ebp
jle    1192 <Associa_Valores_Array+0x62>
mov    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <Associa_Valores_Array+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @Associa_Valores_Array(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%7 = call i64 @time(i32* %6)
%8 = trunc i64 %7 to i32
%9 = call i32 @srand(i32 %8)
br label %10
10: ; preds = %21, %2
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 1000
%17 = load i32*, i32** %3
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
store i32 %16, i32* %20
br label %21
21: ; preds = %14
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %10
24: ; preds = %10
ret void
}

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