#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void Arquivo_Test(char *nome) {
  int i;
  FILE *f = fopen(nome, "w");
  srand(time(NULL));
  for (i = 1; i < 57666666; i++)
    fprintf(f, "%d\n", rand());
  fprintf(f, "%d", rand());
  fclose(f);
}


x86 assembly (clang, -O0):
<Arquivo_Test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x36fec6a,-0xc(%rbp)
jge    11d3 <Arquivo_Test+0x73>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1080 <rand@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
lea    0xe42(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1197 <Arquivo_Test+0x37>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1080 <rand@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xe17(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Arquivo_Test>:
push   %rbp
push   %r14
push   %rbx
lea    0xe95(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x36fec69,%ebp
lea    0xe75(%rip),%r14
nopl   (%rax)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1050 <fprintf@plt>
add    $0xffffffff,%ebp
jne    1190 <Arquivo_Test+0x30>
xor    %eax,%eax
call   1080 <rand@plt>
lea    0xe4f(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   1050 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [3 x i8] c"%d\00"
define void @Arquivo_Test(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = call i32 @time(i32* null)
%8 = call i32 @srand(i32 %7)
store i32 1, i32* %3
br label %9
9: ; preds = %16, %1
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 57666666
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32*, i32** %4
%14 = call i32 (...) @rand()
%15 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %12
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %9
19: ; preds = %9
%20 = load i32*, i32** %4
%21 = call i32 (...) @rand()
%22 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = load i32*, i32** %4
%24 = call i32 @fclose(i32* %23)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [3 x i8] c"%d\00"
define void @Arquivo_Test(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
br label %5
5: ; preds = %1, %5
%6 = phi i32 [ 1, %1 ], [ %9, %5 ]
%7 = tail call i32 (...) @rand()
%8 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = add nuw nsw i32 %6, 1
%10 = icmp eq i32 %9, 57666666
br i1 %10, label %11, label %5
11: ; preds = %5
%12 = tail call i32 (...) @rand()
%13 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = tail call i32 @fclose(i32* %2)
ret void
}