#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 /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int sscanf(char *, char *, int *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  int number;
  int numLines;
  int i, j;
  srand(time(NULL));
  if (argc == 2) {
    if (sscanf(argv[1], "%d", &numLines) < 1) {
      return -1;
    }
    for (i = 0; i < numLines; i++) {
      for (j = 1; j < 10 - 1; j++) {
        number = rand();
        printf("%d ", number);
      }
      number = rand();
      printf("%d", number);
      printf("\n");
    }
  } else {
    FILE *fp;
    fp = fopen("file01", "w");
    for (i = 0; i < 1000; i++) {
      for (j = 1; j < 10 - 1; j++) {
        number = rand();
        fprintf(fp, "%d ", number);
      }
      number = rand();
      fprintf(fp, "%d", number);
      fprintf(fp, "\n");
    }
    fclose(fp);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
cmpl   $0x2,-0x8(%rbp)
jne    1266 <main+0xe6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe41(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jge    11dd <main+0x5d>
movl   $0xffffffff,-0x4(%rbp)
jmp    131e <main+0x19e>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1261 <main+0xe1>
movl   $0x1,-0x20(%rbp)
cmpl   $0x9,-0x20(%rbp)
jge    122a <main+0xaa>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11f7 <main+0x77>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e4 <main+0x64>
jmp    1317 <main+0x197>
lea    0xd9c(%rip),%rdi
lea    0xd9c(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    130e <main+0x18e>
movl   $0x1,-0x20(%rbp)
cmpl   $0x9,-0x20(%rbp)
jge    12cf <main+0x14f>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    %eax,-0x14(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xd49(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1298 <main+0x118>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    %eax,-0x14(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xd19(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xd0e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1284 <main+0x104>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
cmp    $0x2,%ebp
jne    12c7 <main+0x127>
mov    0x8(%rbx),%rdi
lea    0xe32(%rip),%rsi
lea    0x4(%rsp),%rdx
call   10a0 <sscanf@plt>
test   %eax,%eax
jle    13d9 <main+0x239>
cmpl   $0x0,0x4(%rsp)
jle    13d4 <main+0x234>
xor    %r14d,%r14d
lea    0xe0e(%rip),%rbx
lea    0xe04(%rip),%r15
xor    %ebp,%ebp
xchg   %ax,%ax
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     1200 <main+0x60>
jmp    13df <main+0x23f>
lea    0xd39(%rip),%rdi
lea    0xd39(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbx
mov    $0x3e8,%ebp
lea    0xd1a(%rip),%r14
lea    0xd10(%rip),%r15
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
add    $0xffffffff,%ebp
jne    12f0 <main+0x150>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %r14d,%r14d
jmp    13df <main+0x23f>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [7 x i8] c"file01\00"
@.str.4 = [2 x i8] c"w\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 i32
%9 = alloca i32
%10 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 @time(i32* null)
%12 = call i32 @srand(i32 %11)
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %47
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%20 = icmp slt i32 %19, 1
br i1 %20, label %21, label %22
21: ; preds = %15
store i32 -1, i32* %3
br label %78
22: ; preds = %15
store i32 0, i32* %8
br label %23
23: ; preds = %43, %22
%24 = load i32, i32* %8
%25 = load i32, i32* %7
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %46
27: ; preds = %23
store i32 1, i32* %9
br label %28
28: ; preds = %35, %27
%29 = load i32, i32* %9
%30 = icmp slt i32 %29, 9
br i1 %30, label %31, label %38
31: ; preds = %28
%32 = call i32 (...) @rand()
store i32 %32, i32* %6
%33 = load i32, i32* %6
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %31
%36 = load i32, i32* %9
%37 = add nsw i32 %36, 1
store i32 %37, i32* %9
br label %28
38: ; preds = %28
%39 = call i32 (...) @rand()
store i32 %39, i32* %6
%40 = load i32, i32* %6
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %38
%44 = load i32, i32* %8
%45 = add nsw i32 %44, 1
store i32 %45, i32* %8
br label %23
46: ; preds = %23
br label %77
47: ; preds = %2
%48 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %48, i32** %10
store i32 0, i32* %8
br label %49
49: ; preds = %71, %47
%50 = load i32, i32* %8
%51 = icmp slt i32 %50, 1000
br i1 %51, label %52, label %74
52: ; preds = %49
store i32 1, i32* %9
br label %53
53: ; preds = %61, %52
%54 = load i32, i32* %9
%55 = icmp slt i32 %54, 9
br i1 %55, label %56, label %64
56: ; preds = %53
%57 = call i32 (...) @rand()
store i32 %57, i32* %6
%58 = load i32*, i32** %10
%59 = load i32, i32* %6
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %56
%62 = load i32, i32* %9
%63 = add nsw i32 %62, 1
store i32 %63, i32* %9
br label %53
64: ; preds = %53
%65 = call i32 (...) @rand()
store i32 %65, i32* %6
%66 = load i32*, i32** %10
%67 = load i32, i32* %6
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %67)
%69 = load i32*, i32** %10
%70 = call i32 (i32*, i8*, ...) @fprintf(i32* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %71
71: ; preds = %64
%72 = load i32, i32* %8
%73 = add nsw i32 %72, 1
store i32 %73, i32* %8
br label %49
74: ; preds = %49
%75 = load i32*, i32** %10
%76 = call i32 @fclose(i32* %75)
br label %77
77: ; preds = %74, %46
store i32 0, i32* %3
br label %78
78: ; preds = %77, %21
%79 = load i32, i32* %3
ret i32 %79
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.3 = [7 x i8] c"file01\00"
@.str.4 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
%7 = icmp eq i32 %0, 2
br i1 %7, label %8, label %40
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = icmp slt i32 %11, 1
br i1 %12, label %67, label %13
13: ; preds = %8
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %67
16: ; preds = %13, %16
%17 = phi i32 [ %37, %16 ], [ 0, %13 ]
%18 = call i32 (...) @rand()
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = call i32 (...) @rand()
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 (...) @rand()
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i32 (...) @rand()
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 (...) @rand()
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = call i32 (...) @rand()
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = call i32 (...) @rand()
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = call i32 (...) @rand()
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = call i32 (...) @rand()
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = call i32 @putchar(i32 10)
%37 = add nuw nsw i32 %17, 1
%38 = load i32, i32* %3
%39 = icmp slt i32 %37, %38
br i1 %39, label %16, label %67
40: ; preds = %2
%41 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %40, %42
%43 = phi i32 [ 0, %40 ], [ %63, %42 ]
%44 = tail call i32 (...) @rand()
%45 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = tail call i32 (...) @rand()
%47 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = tail call i32 (...) @rand()
%49 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = tail call i32 (...) @rand()
%51 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = tail call i32 (...) @rand()
%53 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = tail call i32 (...) @rand()
%55 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %54)
%56 = tail call i32 (...) @rand()
%57 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = tail call i32 (...) @rand()
%59 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %58)
%60 = tail call i32 (...) @rand()
%61 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %60)
%62 = tail call i32 @fputc(i32 10, i32* %41)
%63 = add nuw nsw i32 %43, 1
%64 = icmp eq i32 %63, 1000
br i1 %64, label %65, label %42
65: ; preds = %42
%66 = tail call i32 @fclose(i32* %41)
br label %67
67: ; preds = %16, %13, %65, %8
%68 = phi i32 [ -1, %8 ], [ 0, %65 ], [ 0, %13 ], [ 0, %16 ]
ret i32 %68
}