#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 rand();
int /*<<< orphan*/ salvarTXT(int *, char *, int);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
void gerarNumeros() {
  int i, x;
  int vetCem[100];
  int vetMil[1000];
  int vetDezMil[10000];
  int vetCemMil[100000];
  srand((unsigned)time(NULL));
  for (i = 0; i < 100; i++) {
    x = rand() % 100000;
    vetCem[i] = x;
  }
  salvarTXT(vetCem, "vetorCem.txt", 100);
  for (i = 0; i < 1000; i++) {
    x = rand() % 100000;
    vetMil[i] = x;
  }
  salvarTXT(vetMil, "vetorMil.txt", 1000);
  for (i = 0; i < 10000; i++) {
    x = rand() % 100000;
    vetDezMil[i] = x;
  }
  salvarTXT(vetDezMil, "vetorDezMil.txt", 10000);
  for (i = 0; i < 100000; i++) {
    x = rand() % 100000;
    vetCemMil[i] = x;
  }
  salvarTXT(vetCemMil, "vetorCemMil.txt", 100000);
}


x86 assembly (clang, -O0):
<gerarNumeros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6c800,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    119a <gerarNumeros+0x5a>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x186a0,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
movslq -0x4(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <gerarNumeros+0x22>
lea    -0x1a0(%rbp),%rdi
lea    0xe58(%rip),%rsi
mov    $0x64,%edx
call   1050 <salvarTXT@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x3e8,-0x4(%rbp)
jge    11f4 <gerarNumeros+0xb4>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x186a0,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
movslq -0x4(%rbp),%rax
mov    %ecx,-0x1140(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11b9 <gerarNumeros+0x79>
lea    -0x1140(%rbp),%rdi
lea    0xe0b(%rip),%rsi
mov    $0x3e8,%edx
call   1050 <salvarTXT@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x2710,-0x4(%rbp)
jge    124e <gerarNumeros+0x10e>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x186a0,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
movslq -0x4(%rbp),%rax
mov    %ecx,-0xad80(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1213 <gerarNumeros+0xd3>
lea    -0xad80(%rbp),%rdi
lea    0xdbe(%rip),%rsi
mov    $0x2710,%edx
call   1050 <salvarTXT@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x186a0,-0x4(%rbp)
jge    12a8 <gerarNumeros+0x168>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x186a0,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
movslq -0x4(%rbp),%rax
mov    %ecx,-0x6c800(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    126d <gerarNumeros+0x12d>
lea    -0x6c800(%rbp),%rdi
lea    0xd74(%rip),%rsi
mov    $0x186a0,%edx
call   1050 <salvarTXT@plt>
add    $0x6c800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gerarNumeros>:
push   %rbx
sub    $0x6c7f0,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x14f8b589,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2d,%rcx
add    %edx,%ecx
imul   $0x186a0,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    1160 <gerarNumeros+0x20>
lea    0xe67(%rip),%rsi
mov    %rsp,%rdi
mov    $0x64,%edx
call   1050 <salvarTXT@plt>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x14f8b589,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2d,%rcx
add    %edx,%ecx
imul   $0x186a0,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x190(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x3e8,%rbx
jne    11b0 <gerarNumeros+0x70>
lea    0xe1d(%rip),%rsi
lea    0x190(%rsp),%rdi
mov    $0x3e8,%edx
call   1050 <salvarTXT@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x14f8b589,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2d,%rcx
add    %edx,%ecx
imul   $0x186a0,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x1130(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x2710,%rbx
jne    1210 <gerarNumeros+0xd0>
lea    0xdca(%rip),%rsi
lea    0x1130(%rsp),%rdi
mov    $0x2710,%edx
call   1050 <salvarTXT@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x14f8b589,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2d,%rcx
add    %edx,%ecx
imul   $0x186a0,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0xad70(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    1270 <gerarNumeros+0x130>
lea    0xd7a(%rip),%rsi
lea    0xad70(%rsp),%rdi
mov    $0x186a0,%edx
call   1050 <salvarTXT@plt>
add    $0x6c7f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"vetorCem.txt\00"
@.str.1 = [13 x i8] c"vetorMil.txt\00"
@.str.2 = [16 x i8] c"vetorDezMil.txt\00"
@.str.3 = [16 x i8] c"vetorCemMil.txt\00"
define void @gerarNumeros() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i32]
%4 = alloca [1000 x i32]
%5 = alloca [10000 x i32]
%6 = alloca [100000 x i32]
%7 = call i64 @time(i32* null)
%8 = trunc i64 %7 to i32
%9 = call i32 @srand(i32 %8)
store i32 0, i32* %1
br label %10
10: ; preds = %20, %0
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 100
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = call i32 (...) @rand()
%15 = srem i32 %14, 100000
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = load i32, i32* %1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %18
store i32 %16, i32* %19
br label %20
20: ; preds = %13
%21 = load i32, i32* %1
%22 = add nsw i32 %21, 1
store i32 %22, i32* %1
br label %10
23: ; preds = %10
%24 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%25 = call i32 @salvarTXT(i32* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 100)
store i32 0, i32* %1
br label %26
26: ; preds = %36, %23
%27 = load i32, i32* %1
%28 = icmp slt i32 %27, 1000
br i1 %28, label %29, label %39
29: ; preds = %26
%30 = call i32 (...) @rand()
%31 = srem i32 %30, 100000
store i32 %31, i32* %2
%32 = load i32, i32* %2
%33 = load i32, i32* %1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 %34
store i32 %32, i32* %35
br label %36
36: ; preds = %29
%37 = load i32, i32* %1
%38 = add nsw i32 %37, 1
store i32 %38, i32* %1
br label %26
39: ; preds = %26
%40 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 0
%41 = call i32 @salvarTXT(i32* %40, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 1000)
store i32 0, i32* %1
br label %42
42: ; preds = %52, %39
%43 = load i32, i32* %1
%44 = icmp slt i32 %43, 10000
br i1 %44, label %45, label %55
45: ; preds = %42
%46 = call i32 (...) @rand()
%47 = srem i32 %46, 100000
store i32 %47, i32* %2
%48 = load i32, i32* %2
%49 = load i32, i32* %1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [10000 x i32], [10000 x i32]* %5, i64 0, i64 %50
store i32 %48, i32* %51
br label %52
52: ; preds = %45
%53 = load i32, i32* %1
%54 = add nsw i32 %53, 1
store i32 %54, i32* %1
br label %42
55: ; preds = %42
%56 = getelementptr inbounds [10000 x i32], [10000 x i32]* %5, i64 0, i64 0
%57 = call i32 @salvarTXT(i32* %56, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 10000)
store i32 0, i32* %1
br label %58
58: ; preds = %68, %55
%59 = load i32, i32* %1
%60 = icmp slt i32 %59, 100000
br i1 %60, label %61, label %71
61: ; preds = %58
%62 = call i32 (...) @rand()
%63 = srem i32 %62, 100000
store i32 %63, i32* %2
%64 = load i32, i32* %2
%65 = load i32, i32* %1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [100000 x i32], [100000 x i32]* %6, i64 0, i64 %66
store i32 %64, i32* %67
br label %68
68: ; preds = %61
%69 = load i32, i32* %1
%70 = add nsw i32 %69, 1
store i32 %70, i32* %1
br label %58
71: ; preds = %58
%72 = getelementptr inbounds [100000 x i32], [100000 x i32]* %6, i64 0, i64 0
%73 = call i32 @salvarTXT(i32* %72, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 100000)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"vetorCem.txt\00"
@.str.1 = [13 x i8] c"vetorMil.txt\00"
@.str.2 = [16 x i8] c"vetorDezMil.txt\00"
@.str.3 = [16 x i8] c"vetorCemMil.txt\00"
define void @gerarNumeros() {
%1 = alloca [100 x i32]
%2 = alloca [1000 x i32]
%3 = alloca [10000 x i32]
%4 = alloca [100000 x i32]
%5 = bitcast [100 x i32]* %1 to i8*
%6 = bitcast [1000 x i32]* %2 to i8*
%7 = bitcast [10000 x i32]* %3 to i8*
%8 = bitcast [100000 x i32]* %4 to i8*
%9 = tail call i64 @time(i32* null)
%10 = trunc i64 %9 to i32
%11 = tail call i32 @srand(i32 %10)
br label %12
12: ; preds = %0, %12
%13 = phi i64 [ 0, %0 ], [ %17, %12 ]
%14 = tail call i32 (...) @rand()
%15 = srem i32 %14, 100000
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %13
store i32 %15, i32* %16
%17 = add nuw nsw i64 %13, 1
%18 = icmp eq i64 %17, 100
br i1 %18, label %19, label %12
19: ; preds = %12
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%21 = call i32 @salvarTXT(i32* %20, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 100)
br label %22
22: ; preds = %19, %22
%23 = phi i64 [ 0, %19 ], [ %27, %22 ]
%24 = call i32 (...) @rand()
%25 = srem i32 %24, 100000
%26 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %23
store i32 %25, i32* %26
%27 = add nuw nsw i64 %23, 1
%28 = icmp eq i64 %27, 1000
br i1 %28, label %29, label %22
29: ; preds = %22
%30 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%31 = call i32 @salvarTXT(i32* %30, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 1000)
br label %32
32: ; preds = %29, %32
%33 = phi i64 [ 0, %29 ], [ %37, %32 ]
%34 = call i32 (...) @rand()
%35 = srem i32 %34, 100000
%36 = getelementptr inbounds [10000 x i32], [10000 x i32]* %3, i64 0, i64 %33
store i32 %35, i32* %36
%37 = add nuw nsw i64 %33, 1
%38 = icmp eq i64 %37, 10000
br i1 %38, label %39, label %32
39: ; preds = %32
%40 = getelementptr inbounds [10000 x i32], [10000 x i32]* %3, i64 0, i64 0
%41 = call i32 @salvarTXT(i32* %40, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 10000)
br label %42
42: ; preds = %39, %42
%43 = phi i64 [ 0, %39 ], [ %47, %42 ]
%44 = call i32 (...) @rand()
%45 = srem i32 %44, 100000
%46 = getelementptr inbounds [100000 x i32], [100000 x i32]* %4, i64 0, i64 %43
store i32 %45, i32* %46
%47 = add nuw nsw i64 %43, 1
%48 = icmp eq i64 %47, 100000
br i1 %48, label %49, label %42
49: ; preds = %42
%50 = getelementptr inbounds [100000 x i32], [100000 x i32]* %4, i64 0, i64 0
%51 = call i32 @salvarTXT(i32* %50, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 100000)
ret void
}