#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, int);
int rand();
int main() {
  FILE *arquivo = fopen("bat.txt", "w");
  int i = 0;
  for (i = 1; i < 145; i++) {
    fprintf(arquivo, "['%d', %d, %d],\n", i, rand() % 50 + 100,
            rand() % 50 + 60);
  }
  fclose(arquivo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x91,-0x14(%rbp)
jge    11de <main+0x9e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x32,%ecx
cltd
idiv   %ecx
add    $0x64,%edx
mov    %edx,-0x1c(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
mov    $0x32,%esi
cltd
idiv   %esi
mov    %edx,%r8d
mov    -0x18(%rbp),%edx
add    $0x3c,%r8d
lea    0xe3f(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1174 <main+0x34>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeb2(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r15
mov    $0x1,%ebp
lea    0xea1(%rip),%r14
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x32,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebx
add    $0x64,%ebx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x32,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r8d
add    $0x3c,%r8d
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1040 <fprintf@plt>
add    $0x1,%ebp
cmp    $0x91,%ebp
jne    1170 <main+0x30>
mov    %r15,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"bat.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [17 x i8] c"['%d', %d, %d],\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 1, %0 ], [ %11, %2 ]
%4 = tail call i32 (...) @rand()
%5 = srem i32 %4, 50
%6 = add nsw i32 %5, 100
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 50
%9 = add nsw i32 %8, 60
%10 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %6, i32 %9)
%11 = add nuw nsw i32 %3, 1
%12 = icmp eq i32 %11, 145
br i1 %12, label %13, label %2
13: ; preds = %2
%14 = tail call i32 @fclose(i32* %1)
ret i32 0
}