#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 */
struct timeval {
  int /*<<< orphan*/ tv_usec;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, long, ...);
int random();
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int sscanf(char *, char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *fout;
  int num_file;
  long file_size, wsize;
  long line;
  char fname[30];
  int i, tmp;
  struct timeval seed;
  assert(9999 < 10000);
  if (argc != 3) {
    fprintf(stderr, "usage: %s num_of_file file_size(MB)\n", argv[0]);
    return 1;
  }
  if (sscanf(argv[1], "%d", &num_file) != 1) {
  usage1:
    fprintf(stderr, "Number of file should be >= 0, <= %d\n", 9999);
    return 1;
  }
  if ((num_file <= 0) || (num_file > 9999))
    goto usage1;
  if (sscanf(argv[2], "%ld", &file_size) != 1) {
  usage2:
    fprintf(stderr, "File size should be >= 0, <= %d\n", (32 * 1024));
    return 1;
  }
  if ((file_size <= 0) || (file_size > (32 * 1024)))
    goto usage2;
  printf("Generate %d files (%ldMB - ", num_file, file_size);
  file_size *= (1024 * 1024);
  printf("%ld Bytes)\n", file_size);
  gettimeofday(&seed, NULL);
  srandom(seed.tv_usec);
  while (num_file) {
    sprintf(fname, "/tmp/file_%04d", num_file);
    if ((fout = fopen(fname, "wt")) == NULL) {
      perror(fname);
      return 1;
    }
    line = 0;
    wsize = 0;
    while (wsize < (file_size - 100)) {
      tmp = fprintf(fout, "%04d-%08lX: ", num_file, line);
      wsize += tmp;
      tmp = 1 + (random() % 16);
      for (i = 0; i < tmp; i++)
        fprintf(fout, "%04d", num_file);
      fputc(10, fout);
      wsize += (tmp * 4) + 1;
      line++;
    }
    tmp = fprintf(fout, "%04d-%08lX: ", num_file, line);
    for (i = 0; i < (file_size - wsize - tmp - 1); i++)
      fputc('-', fout);
    fputc(10, fout);
    fclose(fout);
    num_file--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1080 <assert@plt>
cmpl   $0x3,-0x8(%rbp)
je     1215 <main+0x55>
mov    0x2def(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdfe(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14df <main+0x31f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe01(%rip),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   10b0 <sscanf@plt>
cmp    $0x1,%eax
je     1266 <main+0xa6>
jmp    123d <main+0x7d>
mov    0x2d9c(%rip),%rax
movslq (%rax),%rdi
lea    0xdda(%rip),%rsi
mov    $0x270f,%edx
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14df <main+0x31f>
cmpl   $0x0,-0x1c(%rbp)
jle    127d <main+0xbd>
cmpl   $0x270f,-0x1c(%rbp)
jle    1282 <main+0xc2>
jmp    123d <main+0x7d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdbd(%rip),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   10b0 <sscanf@plt>
cmp    $0x1,%eax
je     12d3 <main+0x113>
jmp    12aa <main+0xea>
mov    0x2d2f(%rip),%rax
movslq (%rax),%rdi
lea    0xd97(%rip),%rsi
mov    $0x8000,%edx
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14df <main+0x31f>
cmpq   $0x0,-0x28(%rbp)
jle    12ec <main+0x12c>
cmpq   $0x8000,-0x28(%rbp)
jle    12f1 <main+0x131>
jmp    12aa <main+0xea>
movslq -0x1c(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rax
shl    $0x14,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
mov    -0x70(%rbp),%edi
call   1030 <srandom@plt>
cmpl   $0x0,-0x1c(%rbp)
je     14d8 <main+0x318>
lea    -0x60(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xd49(%rip),%rsi
call   10e0 <sprintf@plt>
lea    -0x60(%rbp),%rdi
lea    0xd48(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    138a <main+0x1ca>
lea    -0x60(%rbp),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    14df <main+0x31f>
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    $0x64,%rcx
cmp    %rcx,%rax
jge    1454 <main+0x294>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x38(%rbp),%rcx
lea    0xcec(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    %eax,-0x68(%rbp)
movslq -0x68(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   10a0 <random@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x68(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x68(%rbp),%eax
jge    1422 <main+0x262>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xc98(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    13f3 <main+0x233>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1070 <fputc@plt>
mov    -0x68(%rbp),%eax
shl    $0x2,%eax
add    $0x1,%eax
cltq
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    139a <main+0x1da>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x38(%rbp),%rcx
lea    0xc47(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    %eax,-0x68(%rbp)
movl   $0x0,-0x64(%rbp)
movslq -0x64(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    -0x30(%rbp),%rcx
movslq -0x68(%rbp),%rdx
sub    %rdx,%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jge    14b3 <main+0x2f3>
mov    -0x18(%rbp),%rsi
mov    $0x2d,%edi
call   1070 <fputc@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1477 <main+0x2b7>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1070 <fputc@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    133a <main+0x17a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%edi
call   1080 <assert@plt>
cmp    $0x3,%ebp
jne    1226 <main+0x66>
mov    0x8(%rbx),%rdi
lea    0xe38(%rip),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   10b0 <sscanf@plt>
cmp    $0x1,%eax
jne    120e <main+0x4e>
mov    $0xffffd8f0,%eax
add    0xc(%rsp),%eax
cmp    $0xffffd8f1,%eax
jae    1243 <main+0x83>
mov    0x2dcb(%rip),%rax
movslq (%rax),%rdi
lea    0xe09(%rip),%rsi
mov    $0x270f,%edx
jmp    1289 <main+0xc9>
mov    0x2db3(%rip),%rax
movslq (%rax),%rdi
mov    (%rbx),%rdx
lea    0xdc6(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1290 <main+0xd0>
mov    0x10(%rbx),%rdi
lea    0xe00(%rip),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   10b0 <sscanf@plt>
cmp    $0x1,%eax
jne    1273 <main+0xb3>
mov    0x10(%rsp),%rdx
lea    -0x8001(%rdx),%rax
cmp    $0xffffffffffff8000,%rax
jae    12a6 <main+0xe6>
mov    0x2d66(%rip),%rax
movslq (%rax),%rdi
lea    0xdce(%rip),%rsi
mov    $0x8000,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movslq 0xc(%rsp),%rsi
lea    0xdc1(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rsi
shl    $0x14,%rsi
mov    %rsi,0x10(%rsp)
lea    0xdbf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x18(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x18(%rsp),%edi
call   1030 <srandom@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
je     1295 <main+0xd5>
lea    0xdaa(%rip),%r12
jmp    1328 <main+0x168>
nopl   (%rax)
mov    $0xa,%edi
mov    %rbp,%rsi
call   1070 <fputc@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    0xc(%rsp),%edx
xor    %ebp,%ebp
add    $0xffffffff,%edx
mov    %edx,0xc(%rsp)
je     1295 <main+0xd5>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
lea    0xd64(%rip),%rsi
call   10e0 <sprintf@plt>
mov    %rbx,%rdi
lea    0xd64(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1463 <main+0x2a3>
mov    %rax,%rbp
cmpq   $0x65,0x10(%rsp)
jl     1400 <main+0x240>
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    139e <main+0x1de>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %rbp,%rsi
call   1070 <fputc@plt>
shl    $0x2,%r15d
movslq %r15d,%rax
lea    (%rax,%r13,1),%rbx
add    $0x5,%rbx
add    $0x1,%r14
mov    0x10(%rsp),%rax
add    $0xffffffffffffff9c,%rax
cmp    %rax,%rbx
jge    1405 <main+0x245>
mov    0xc(%rsp),%edx
mov    %rbp,%rdi
lea    0xd01(%rip),%rsi
mov    %r14,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
movslq %eax,%r13
add    %rbx,%r13
xor    %eax,%eax
call   10a0 <random@plt>
mov    %eax,%r15d
lea    0xf(%r15),%eax
test   %r15d,%r15d
cmovns %r15d,%eax
and    $0xfffffff0,%eax
sub    %eax,%r15d
js     1370 <main+0x1b0>
lea    0x1(%r15),%ebx
nopl   (%rax)
mov    0xc(%rsp),%edx
mov    %rbp,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
add    $0xffffffff,%ebx
jne    13e0 <main+0x220>
jmp    1370 <main+0x1b0>
nopl   0x0(%rax,%rax,1)
xor    %ebx,%ebx
xor    %r14d,%r14d
mov    0xc(%rsp),%edx
mov    %rbp,%rdi
lea    0xc9a(%rip),%rsi
mov    %r14,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
movslq %eax,%r14
add    %rbx,%r14
not    %r14
mov    0x10(%rsp),%rax
add    %r14,%rax
test   %rax,%rax
jle    1300 <main+0x140>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    $0x2d,%edi
mov    %rbp,%rsi
call   1070 <fputc@plt>
add    $0x1,%rbx
mov    0x10(%rsp),%rax
add    %r14,%rax
cmp    %rbx,%rax
jg     1440 <main+0x280>
jmp    1300 <main+0x140>
lea    0x20(%rsp),%rdi
call   10d0 <perror@plt>
jmp    1290 <main+0xd0>

LLVM IR (-O0):
%struct.timeval = type { i32 }
@stderr = global i32 0
@.str = [37 x i8] c"usage: %s num_of_file file_size(MB)\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [38 x i8] c"Number of file should be >= 0, <= %d\0A\00"
@.str.3 = [4 x i8] c"%ld\00"
@.str.4 = [33 x i8] c"File size should be >= 0, <= %d\0A\00"
@.str.5 = [28 x i8] c"Generate %d files (%ldMB - \00"
@.str.6 = [12 x i8] c"%ld Bytes)\0A\00"
@.str.7 = [15 x i8] c"/tmp/file_%04d\00"
@.str.8 = [3 x i8] c"wt\00"
@.str.9 = [13 x i8] c"%04d-%08lX: \00"
@.str.10 = [5 x i8] c"%04d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca [30 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca %struct.timeval
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = call i32 @assert(i32 1)
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 3
br i1 %17, label %18, label %26
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %24)
store i32 1, i32* %3
br label %160
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 (i8*, i8*, ...) @sscanf(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%31 = icmp ne i32 %30, 1
br i1 %31, label %32, label %38
32: ; preds = %26
br label %33
33: ; preds = %44, %32
%34 = load i32, i32* @stderr
%35 = sext i32 %34 to i64
%36 = inttoptr i64 %35 to i32*
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 9999)
store i32 1, i32* %3
br label %160
38: ; preds = %26
%39 = load i32, i32* %7
%40 = icmp sle i32 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %38
%42 = load i32, i32* %7
%43 = icmp sgt i32 %42, 9999
br i1 %43, label %44, label %45
44: ; preds = %41, %38
br label %33
45: ; preds = %41
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
%49 = call i32 (i8*, i8*, ...) @sscanf(i8* %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64* %8)
%50 = icmp ne i32 %49, 1
br i1 %50, label %51, label %57
51: ; preds = %45
br label %52
52: ; preds = %63, %51
%53 = load i32, i32* @stderr
%54 = sext i32 %53 to i64
%55 = inttoptr i64 %54 to i32*
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %55, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 32768)
store i32 1, i32* %3
br label %160
57: ; preds = %45
%58 = load i64, i64* %8
%59 = icmp sle i64 %58, 0
br i1 %59, label %63, label %60
60: ; preds = %57
%61 = load i64, i64* %8
%62 = icmp sgt i64 %61, 32768
br i1 %62, label %63, label %64
63: ; preds = %60, %57
br label %52
64: ; preds = %60
%65 = load i32, i32* %7
%66 = sext i32 %65 to i64
%67 = load i64, i64* %8
%68 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i64 %66, i64 %67)
%69 = load i64, i64* %8
%70 = mul nsw i64 %69, 1048576
store i64 %70, i64* %8
%71 = load i64, i64* %8
%72 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i64 %71)
%73 = call i32 @gettimeofday(%struct.timeval* %14, i32* null)
%74 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
%75 = load i32, i32* %74
%76 = call i32 @srandom(i32 %75)
br label %77
77: ; preds = %152, %64
%78 = load i32, i32* %7
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %159
80: ; preds = %77
%81 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 0
%82 = load i32, i32* %7
%83 = call i32 @sprintf(i8* %81, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %82)
%84 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 0
%85 = call i32* @fopen(i8* %84, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
store i32* %85, i32** %6
%86 = icmp eq i32* %85, null
br i1 %86, label %87, label %90
87: ; preds = %80
%88 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 0
%89 = call i32 @perror(i8* %88)
store i32 1, i32* %3
br label %160
90: ; preds = %80
store i64 0, i64* %10
store i64 0, i64* %9
br label %91
91: ; preds = %119, %90
%92 = load i64, i64* %9
%93 = load i64, i64* %8
%94 = sub nsw i64 %93, 100
%95 = icmp slt i64 %92, %94
br i1 %95, label %96, label %130
96: ; preds = %91
%97 = load i32*, i32** %6
%98 = load i32, i32* %7
%99 = load i64, i64* %10
%100 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %98, i64 %99)
store i32 %100, i32* %13
%101 = load i32, i32* %13
%102 = sext i32 %101 to i64
%103 = load i64, i64* %9
%104 = add nsw i64 %103, %102
store i64 %104, i64* %9
%105 = call i32 (...) @random()
%106 = srem i32 %105, 16
%107 = add nsw i32 1, %106
store i32 %107, i32* %13
store i32 0, i32* %12
br label %108
108: ; preds = %116, %96
%109 = load i32, i32* %12
%110 = load i32, i32* %13
%111 = icmp slt i32 %109, %110
br i1 %111, label %112, label %119
112: ; preds = %108
%113 = load i32*, i32** %6
%114 = load i32, i32* %7
%115 = call i32 (i32*, i8*, ...) @fprintf(i32* %113, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 %114)
br label %116
116: ; preds = %112
%117 = load i32, i32* %12
%118 = add nsw i32 %117, 1
store i32 %118, i32* %12
br label %108
119: ; preds = %108
%120 = load i32*, i32** %6
%121 = call i32 @fputc(i32 10, i32* %120)
%122 = load i32, i32* %13
%123 = mul nsw i32 %122, 4
%124 = add nsw i32 %123, 1
%125 = sext i32 %124 to i64
%126 = load i64, i64* %9
%127 = add nsw i64 %126, %125
store i64 %127, i64* %9
%128 = load i64, i64* %10
%129 = add nsw i64 %128, 1
store i64 %129, i64* %10
br label %91
130: ; preds = %91
%131 = load i32*, i32** %6
%132 = load i32, i32* %7
%133 = load i64, i64* %10
%134 = call i32 (i32*, i8*, ...) @fprintf(i32* %131, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %132, i64 %133)
store i32 %134, i32* %13
store i32 0, i32* %12
br label %135
135: ; preds = %149, %130
%136 = load i32, i32* %12
%137 = sext i32 %136 to i64
%138 = load i64, i64* %8
%139 = load i64, i64* %9
%140 = sub nsw i64 %138, %139
%141 = load i32, i32* %13
%142 = sext i32 %141 to i64
%143 = sub nsw i64 %140, %142
%144 = sub nsw i64 %143, 1
%145 = icmp slt i64 %137, %144
br i1 %145, label %146, label %152
146: ; preds = %135
%147 = load i32*, i32** %6
%148 = call i32 @fputc(i32 45, i32* %147)
br label %149
149: ; preds = %146
%150 = load i32, i32* %12
%151 = add nsw i32 %150, 1
store i32 %151, i32* %12
br label %135
152: ; preds = %135
%153 = load i32*, i32** %6
%154 = call i32 @fputc(i32 10, i32* %153)
%155 = load i32*, i32** %6
%156 = call i32 @fclose(i32* %155)
%157 = load i32, i32* %7
%158 = add nsw i32 %157, -1
store i32 %158, i32* %7
br label %77
159: ; preds = %77
store i32 0, i32* %3
br label %160
160: ; preds = %159, %87, %52, %33, %18
%161 = load i32, i32* %3
ret i32 %161
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@stderr = global i32 0
@.str = [37 x i8] c"usage: %s num_of_file file_size(MB)\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [38 x i8] c"Number of file should be >= 0, <= %d\0A\00"
@.str.3 = [4 x i8] c"%ld\00"
@.str.4 = [33 x i8] c"File size should be >= 0, <= %d\0A\00"
@.str.5 = [28 x i8] c"Generate %d files (%ldMB - \00"
@.str.6 = [12 x i8] c"%ld Bytes)\0A\00"
@.str.7 = [15 x i8] c"/tmp/file_%04d\00"
@.str.8 = [3 x i8] c"wt\00"
@.str.9 = [13 x i8] c"%04d-%08lX: \00"
@.str.10 = [5 x i8] c"%04d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca [30 x i8]
%6 = alloca %struct.timeval
%7 = bitcast i32* %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%10 = bitcast %struct.timeval* %6 to i8*
%11 = tail call i32 @assert(i32 1)
%12 = icmp eq i32 %0, 3
br i1 %12, label %19, label %13
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load i8*, i8** %1
%18 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %120
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = call i32 (i8*, i8*, ...) @sscanf(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%23 = icmp eq i32 %22, 1
br i1 %23, label %29, label %24
24: ; preds = %29, %19
%25 = load i32, i32* @stderr
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i32*
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 9999)
br label %120
29: ; preds = %19
%30 = load i32, i32* %3
%31 = add i32 %30, -10000
%32 = icmp ult i32 %31, -9999
br i1 %32, label %24, label %33
33: ; preds = %29
%34 = getelementptr inbounds i8*, i8** %1, i64 2
%35 = load i8*, i8** %34
%36 = call i32 (i8*, i8*, ...) @sscanf(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64* %4)
%37 = icmp eq i32 %36, 1
br i1 %37, label %43, label %38
38: ; preds = %43, %33
%39 = load i32, i32* @stderr
%40 = sext i32 %39 to i64
%41 = inttoptr i64 %40 to i32*
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 32768)
br label %120
43: ; preds = %33
%44 = load i64, i64* %4
%45 = add i64 %44, -32769
%46 = icmp ult i64 %45, -32768
br i1 %46, label %38, label %47
47: ; preds = %43
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i64 %49, i64 %44)
%51 = load i64, i64* %4
%52 = shl nsw i64 %51, 20
store i64 %52, i64* %4
%53 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i64 %52)
%54 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%55 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 0
%56 = load i32, i32* %55
%57 = call i32 @srandom(i32 %56)
%58 = load i32, i32* %3
%59 = icmp eq i32 %58, 0
br i1 %59, label %120, label %60
60: ; preds = %47, %114
%61 = phi i32 [ %118, %114 ], [ %58, %47 ]
%62 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %61)
%63 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%64 = icmp eq i32* %63, null
br i1 %64, label %68, label %65
65: ; preds = %60
%66 = load i64, i64* %4
%67 = icmp sgt i64 %66, 100
br i1 %67, label %70, label %96
68: ; preds = %60
%69 = call i32 @perror(i8* %9)
br label %120
70: ; preds = %65, %86
%71 = phi i64 [ %92, %86 ], [ 0, %65 ]
%72 = phi i64 [ %91, %86 ], [ 0, %65 ]
%73 = load i32, i32* %3
%74 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %73, i64 %71)
%75 = sext i32 %74 to i64
%76 = add nsw i64 %72, %75
%77 = call i32 (...) @random()
%78 = srem i32 %77, 16
%79 = icmp slt i32 %78, 0
br i1 %79, label %86, label %80
80: ; preds = %70, %80
%81 = phi i32 [ %84, %80 ], [ 0, %70 ]
%82 = load i32, i32* %3
%83 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 %82)
%84 = add nuw nsw i32 %81, 1
%85 = icmp eq i32 %81, %78
br i1 %85, label %86, label %80
86: ; preds = %80, %70
%87 = call i32 @fputc(i32 10, i32* %63)
%88 = shl nsw i32 %78, 2
%89 = add nsw i32 %88, 5
%90 = sext i32 %89 to i64
%91 = add nsw i64 %76, %90
%92 = add nuw nsw i64 %71, 1
%93 = load i64, i64* %4
%94 = add nsw i64 %93, -100
%95 = icmp slt i64 %91, %94
br i1 %95, label %70, label %96
96: ; preds = %86, %65
%97 = phi i64 [ 0, %65 ], [ %91, %86 ]
%98 = phi i64 [ 0, %65 ], [ %92, %86 ]
%99 = load i32, i32* %3
%100 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %99, i64 %98)
%101 = sext i32 %100 to i64
%102 = add i64 %97, %101
%103 = xor i64 %102, -1
%104 = load i64, i64* %4
%105 = add i64 %104, %103
%106 = icmp sgt i64 %105, 0
br i1 %106, label %107, label %114
107: ; preds = %96, %107
%108 = phi i64 [ %110, %107 ], [ 0, %96 ]
%109 = call i32 @fputc(i32 45, i32* %63)
%110 = add nuw nsw i64 %108, 1
%111 = load i64, i64* %4
%112 = add i64 %111, %103
%113 = icmp sgt i64 %112, %110
br i1 %113, label %107, label %114
114: ; preds = %107, %96
%115 = call i32 @fputc(i32 10, i32* %63)
%116 = call i32 @fclose(i32* %63)
%117 = load i32, i32* %3
%118 = add nsw i32 %117, -1
store i32 %118, i32* %3
%119 = icmp eq i32 %118, 0
br i1 %119, label %120, label %60
120: ; preds = %114, %47, %68, %38, %24, %13
%121 = phi i32 [ 1, %13 ], [ 1, %24 ], [ 1, %38 ], [ 1, %68 ], [ 0, %47 ], [ 0, %114 ]
ret i32 %121
}