#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 /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  freopen("input.txt", "w", stdout);
  srand(time(NULL));
  for (int i = 5000; i <= 5000; i += 5) {
    printf("%d\n", i);
    for (int j = 0; j < i; j++) {
      printf("%4d%4d\n", rand() % 100 + 1, rand() % 100 + 1);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
lea    0xe91(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1040 <freopen@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x1388,-0x8(%rbp)
cmpl   $0x1388,-0x8(%rbp)
jg     121c <main+0xcc>
mov    -0x8(%rbp),%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1209 <main+0xb9>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
mov    -0x10(%rbp),%esi
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b7 <main+0x67>
jmp    120e <main+0xbe>
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
jmp    1192 <main+0x42>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
lea    0xe9c(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1040 <freopen@plt>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xe87(%rip),%rdi
mov    $0x1388,%ebx
mov    $0x1388,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe73(%rip),%r14
nopl   (%rax)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0x1,%ebp
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edx
add    $0x1,%edx
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0xffffffff,%ebx
jne    11a0 <main+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [8 x i8] c"%4d%4d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* @stdout
%5 = call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 @time(i32* null)
%7 = call i32 @srand(i32 %6)
store i32 5000, i32* %2
br label %8
8: ; preds = %30, %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 5000
br i1 %10, label %11, label %33
11: ; preds = %8
%12 = load i32, i32* %2
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %12)
store i32 0, i32* %3
br label %14
14: ; preds = %26, %11
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = call i32 (...) @rand()
%20 = srem i32 %19, 100
%21 = add nsw i32 %20, 1
%22 = call i32 (...) @rand()
%23 = srem i32 %22, 100
%24 = add nsw i32 %23, 1
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %24)
br label %26
26: ; preds = %18
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %14
29: ; preds = %14
br label %30
30: ; preds = %29
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 5
store i32 %32, i32* %2
br label %8
33: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [8 x i8] c"%4d%4d\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 5000)
br label %7
6: ; preds = %7
ret i32 0
7: ; preds = %0, %7
%8 = phi i32 [ 0, %0 ], [ %16, %7 ]
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 100
%11 = add nsw i32 %10, 1
%12 = tail call i32 (...) @rand()
%13 = srem i32 %12, 100
%14 = add nsw i32 %13, 1
%15 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %14)
%16 = add nuw nsw i32 %8, 1
%17 = icmp eq i32 %16, 5000
br i1 %17, label %6, label %7
}