#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*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  FILE *file;
  int r;
  int c;
  int p;
  int i = 0, row = 0, col = 0, pln = 0;
  if (argc != 4) {
    fputs("usage: <x> <y> <z>\n", stderr);
    exit(EXIT_FAILURE);
  }
  r = (int)strtol(argv[1], NULL, 10);
  c = (int)strtol(argv[2], NULL, 10);
  p = (int)strtol(argv[2], NULL, 10);
  file = fopen("initial_condition.txt", "w");
  if (file == NULL) {
    fputs("initial_condition.txt", stderr);
    fputs(" could not be opened.\n", stderr);
    exit(EXIT_FAILURE);
  }
  srand(time(0));
  for (row = 0; row < r; row++) {
    for (col = 0; col < c; col++) {
      for (pln = 0; pln < p; pln++) {
        if (rand() % 2 == 0)
          fputc('0', file);
        else
          fputc('1', file);
      }
    }
  }
  fclose(file);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11ef <main+0x5f>
mov    0x2e0d(%rip),%rax
mov    (%rax),%esi
lea    0xe24(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,-0x24(%rbp)
lea    0xdd3(%rip),%rdi
lea    0xde2(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1294 <main+0x104>
mov    0x2d7d(%rip),%rax
mov    (%rax),%esi
lea    0xda8(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2d68(%rip),%rax
mov    (%rax),%esi
lea    0xdab(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    134d <main+0x1bd>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    133a <main+0x1aa>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1327 <main+0x197>
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1306 <main+0x176>
mov    -0x18(%rbp),%rsi
mov    $0x30,%edi
call   1050 <fputc@plt>
jmp    1314 <main+0x184>
mov    -0x18(%rbp),%rsi
mov    $0x31,%edi
call   1050 <fputc@plt>
jmp    1319 <main+0x189>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12cf <main+0x13f>
jmp    132c <main+0x19c>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12bc <main+0x12c>
jmp    133f <main+0x1af>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12a9 <main+0x119>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2c73(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    128d <main+0xfd>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,%rbp
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,%r15
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,%r12
lea    0xe2d(%rip),%rdi
lea    0xe3c(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     129f <main+0x10f>
mov    %rax,%rbx
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
test   %ebp,%ebp
jle    126d <main+0xdd>
xor    %r13d,%r13d
mov    %rbp,(%rsp)
jmp    122d <main+0x9d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r13d
mov    (%rsp),%rbp
cmp    %ebp,%r13d
je     126d <main+0xdd>
test   %r15d,%r15d
jle    1220 <main+0x90>
xor    %ebp,%ebp
jmp    1248 <main+0xb8>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %r15d,%ebp
je     1220 <main+0x90>
test   %r12d,%r12d
jle    1240 <main+0xb0>
mov    %r12d,%r14d
xor    %eax,%eax
call   10b0 <rand@plt>
and    $0x1,%eax
lea    0x30(%rax),%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
add    $0xffffffff,%r14d
jne    1250 <main+0xc0>
jmp    1240 <main+0xb0>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    0x2d54(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d4c(%rip),%rax
mov    (%rax),%esi
lea    0xd63(%rip),%rdi
jmp    12bd <main+0x12d>
mov    0x2d3a(%rip),%rbx
mov    (%rbx),%esi
lea    0xd65(%rip),%rdi
call   1040 <fputs@plt>
mov    (%rbx),%esi
lea    0xd6f(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2d0f(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"usage: <x> <y> <z>\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [22 x i8] c"initial_condition.txt\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [23 x i8] c" could not be opened.\0A\00"
@EXIT_SUCCESS = global i32 0
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
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 4
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = call i32 @fputs(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @strtol(i8* %24, i32* null, i32 10)
%26 = trunc i64 %25 to i32
store i32 %26, i32* %7
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
%30 = call i64 @strtol(i8* %29, i32* null, i32 10)
%31 = trunc i64 %30 to i32
store i32 %31, i32* %8
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = call i64 @strtol(i8* %34, i32* null, i32 10)
%36 = trunc i64 %35 to i32
store i32 %36, i32* %9
%37 = call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %37, i32** %6
%38 = load i32*, i32** %6
%39 = icmp eq i32* %38, null
br i1 %39, label %40, label %47
40: ; preds = %21
%41 = load i32, i32* @stderr
%42 = call i32 @fputs(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = load i32, i32* @stderr
%44 = call i32 @fputs(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %43)
%45 = load i32, i32* @EXIT_FAILURE
%46 = call i32 @exit(i32 %45)
unreachable
47: ; preds = %21
%48 = call i32 @time(i32 0)
%49 = call i32 @srand(i32 %48)
store i32 0, i32* %11
br label %50
50: ; preds = %83, %47
%51 = load i32, i32* %11
%52 = load i32, i32* %7
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %86
54: ; preds = %50
store i32 0, i32* %12
br label %55
55: ; preds = %79, %54
%56 = load i32, i32* %12
%57 = load i32, i32* %8
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %82
59: ; preds = %55
store i32 0, i32* %13
br label %60
60: ; preds = %75, %59
%61 = load i32, i32* %13
%62 = load i32, i32* %9
%63 = icmp slt i32 %61, %62
br i1 %63, label %64, label %78
64: ; preds = %60
%65 = call i32 (...) @rand()
%66 = srem i32 %65, 2
%67 = icmp eq i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %64
%69 = load i32*, i32** %6
%70 = call i32 @fputc(i8 signext 48, i32* %69)
br label %74
71: ; preds = %64
%72 = load i32*, i32** %6
%73 = call i32 @fputc(i8 signext 49, i32* %72)
br label %74
74: ; preds = %71, %68
br label %75
75: ; preds = %74
%76 = load i32, i32* %13
%77 = add nsw i32 %76, 1
store i32 %77, i32* %13
br label %60
78: ; preds = %60
br label %79
79: ; preds = %78
%80 = load i32, i32* %12
%81 = add nsw i32 %80, 1
store i32 %81, i32* %12
br label %55
82: ; preds = %55
br label %83
83: ; preds = %82
%84 = load i32, i32* %11
%85 = add nsw i32 %84, 1
store i32 %85, i32* %11
br label %50
86: ; preds = %50
%87 = load i32*, i32** %6
%88 = call i32 @fclose(i32* %87)
%89 = load i32, i32* @EXIT_SUCCESS
ret i32 %89
}

LLVM IR (-O2):
@.str = [20 x i8] c"usage: <x> <y> <z>\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [22 x i8] c"initial_condition.txt\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [23 x i8] c" could not be opened.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @strtol(i8* nocapture %11, i32* null, i32 10)
%13 = trunc i64 %12 to i32
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i64 @strtol(i8* nocapture %15, i32* null, i32 10)
%17 = trunc i64 %16 to i32
%18 = load i8*, i8** %14
%19 = tail call i64 @strtol(i8* nocapture %18, i32* null, i32 10)
%20 = trunc i64 %19 to i32
%21 = tail call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %30
23: ; preds = %9
%24 = load i32, i32* @stderr
%25 = tail call i32 @fputs(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* @stderr
%27 = tail call i32 @fputs(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32, i32* @EXIT_FAILURE
%29 = tail call i32 @exit(i32 %28)
unreachable
30: ; preds = %9
%31 = tail call i32 @time(i32 0)
%32 = tail call i32 @srand(i32 %31)
%33 = icmp sgt i32 %13, 0
br i1 %33, label %34, label %56
34: ; preds = %30
%35 = icmp sgt i32 %17, 0
%36 = icmp sgt i32 %20, 0
br label %37
37: ; preds = %34, %53
%38 = phi i32 [ 0, %34 ], [ %54, %53 ]
br i1 %35, label %39, label %53
39: ; preds = %37, %50
%40 = phi i32 [ %51, %50 ], [ 0, %37 ]
br i1 %36, label %41, label %50
41: ; preds = %39, %41
%42 = phi i32 [ %48, %41 ], [ 0, %39 ]
%43 = tail call i32 (...) @rand()
%44 = and i32 %43, 1
%45 = icmp eq i32 %44, 0
%46 = select i1 %45, i8 48, i8 49
%47 = tail call i32 @fputc(i8 signext %46, i32* %21)
%48 = add nuw nsw i32 %42, 1
%49 = icmp eq i32 %48, %20
br i1 %49, label %50, label %41
50: ; preds = %41, %39
%51 = add nuw nsw i32 %40, 1
%52 = icmp eq i32 %51, %17
br i1 %52, label %53, label %39
53: ; preds = %50, %37
%54 = add nuw nsw i32 %38, 1
%55 = icmp eq i32 %54, %13
br i1 %55, label %56, label %37
56: ; preds = %53, %30
%57 = tail call i32 @fclose(i32* %21)
%58 = load i32, i32* @EXIT_SUCCESS
ret i32 %58
}