#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 */
scalar_t__ atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free_board(unsigned char **, unsigned int, unsigned int);
unsigned char **init_board(unsigned int, unsigned int);
int /*<<< orphan*/ load_board(unsigned char **, unsigned int, unsigned int,
                              int /*<<< orphan*/ *);
int /*<<< orphan*/ print_help();
int /*<<< orphan*/ print_version();
int /*<<< orphan*/ process_board(unsigned char **, unsigned int, unsigned int,
                                 unsigned int, char const *, int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ validate_actionsCount(unsigned int);
int /*<<< orphan*/ validate_cols(unsigned int);
int /*<<< orphan*/ validate_rows(unsigned int);
main(int argc, char *argv[]) {
  char const *fileName;
  char const *outputFileName;
  unsigned int actionsCount;
  unsigned int rows;
  unsigned int cols;
  unsigned char **board;
  bool screen = 0;
  if (argc == 2) {
    char *arg = argv[1];
    if (strcmp(arg, "-h") == 0 || strcmp(arg, "--help") == 0) {
      print_help();
      return 0;
    } else if (strcmp(arg, "-v") == 0 || strcmp(arg, "--version") == 0) {
      print_version();
      return 0;
    } else {
      fprintf(stderr, "Invalid parameter!\n");
      exit(1);
    }
  } else if (argc != 5 && argc != 7 && argc != 6) {
    fprintf(stderr, "Wrong number of parameters!\n");
    exit(1);
  } else {
    fileName = argv[4];
    actionsCount = (int)atoi(argv[1]);
    validate_actionsCount(actionsCount);
    rows = (int)atoi(argv[2]);
    validate_rows(rows);
    cols = (int)atoi(argv[3]);
    validate_cols(cols);
    outputFileName = fileName;
    if (argc == 7) {
      if (strcmp(argv[5], "-o") == 0) {
        outputFileName = argv[6];
      } else {
        fprintf(stderr, "Invalid parameter!\n");
        exit(1);
      }
    }
    if (argc == 6) {
      if (strcmp(argv[5], "-s") == 0) {
        screen = 1;
      } else {
        fprintf(stderr, "Invalid parameter!\n");
        exit(1);
      }
    }
  }
  FILE *file = fopen(fileName, "r");
  if (file == NULL) {
    fprintf(stderr, "Error while opening input file\n");
    exit(1);
  }
  board = init_board(rows, cols);
  load_board(board, rows, cols, file);
  fclose(file);
  process_board(board, rows, cols, actionsCount, outputFileName, screen);
  free_board(board, rows, cols);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    12d0 <main+0xe0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     1257 <main+0x67>
mov    -0x48(%rbp),%rdi
lea    0xdbb(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    126a <main+0x7a>
mov    $0x0,%al
call   1100 <print_help@plt>
movl   $0x0,-0x4(%rbp)
jmp    14c1 <main+0x2d1>
mov    -0x48(%rbp),%rdi
lea    0xd95(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     129e <main+0xae>
mov    -0x48(%rbp),%rdi
lea    0xd7e(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    12b1 <main+0xc1>
mov    $0x0,%al
call   1040 <print_version@plt>
movl   $0x0,-0x4(%rbp)
jmp    14c1 <main+0x2d1>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
lea    0xd56(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
cmpl   $0x5,-0x8(%rbp)
je     130d <main+0x11d>
cmpl   $0x7,-0x8(%rbp)
je     130d <main+0x11d>
cmpl   $0x6,-0x8(%rbp)
je     130d <main+0x11d>
mov    0x2ceb(%rip),%rax
mov    (%rax),%edi
lea    0xd2d(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
call   1030 <validate_actionsCount@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edi
call   1090 <validate_rows@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
call   10a0 <validate_cols@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x7,-0x8(%rbp)
jne    13c6 <main+0x1d6>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0xcc6(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    13a2 <main+0x1b2>
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    13c1 <main+0x1d1>
mov    0x2c37(%rip),%rax
mov    (%rax),%edi
lea    0xc65(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    13c6 <main+0x1d6>
cmpl   $0x6,-0x8(%rbp)
jne    141e <main+0x22e>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0xc6c(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    13fa <main+0x20a>
movl   $0x1,-0x3c(%rbp)
jmp    1419 <main+0x229>
mov    0x2bdf(%rip),%rax
mov    (%rax),%edi
lea    0xc0d(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    141e <main+0x22e>
jmp    1423 <main+0x233>
jmp    1428 <main+0x238>
mov    -0x18(%rbp),%rdi
lea    0xc1b(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1466 <main+0x276>
mov    0x2b92(%rip),%rax
mov    (%rax),%edi
lea    0xbf9(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   1080 <init_board@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x50(%rbp),%rcx
call   1070 <load_board@plt>
mov    -0x50(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x3c(%rbp),%r9d
call   1060 <process_board@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   10e0 <free_board@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    -0x5(%rbp),%eax
cmp    $0x3,%eax
jae    1290 <main+0xa0>
mov    0x8(%rbx),%rdi
mov    0x20(%rbx),%r14
call   10f0 <atoi@plt>
mov    %rax,%r12
mov    %r12d,%edi
call   1030 <validate_actionsCount@plt>
mov    0x10(%rbx),%rdi
call   10f0 <atoi@plt>
mov    %rax,%r15
mov    %r15d,%edi
call   1090 <validate_rows@plt>
mov    0x18(%rbx),%rdi
call   10f0 <atoi@plt>
mov    %rax,%r13
mov    %r13d,%edi
call   10a0 <validate_cols@plt>
cmp    $0x6,%ebp
mov    %r12,0x10(%rsp)
je     1301 <main+0x111>
movl   $0x0,0xc(%rsp)
cmp    $0x7,%ebp
jne    1336 <main+0x146>
mov    0x28(%rbx),%rdi
lea    0xdcf(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    1321 <main+0x131>
mov    0x30(%rbx),%r12
jmp    1339 <main+0x149>
cmp    $0x2,%ebp
jne    13cc <main+0x1dc>
mov    0x8(%rbx),%rbx
lea    0xd5c(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     13b1 <main+0x1c1>
lea    0xd47(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     13b1 <main+0x1c1>
lea    0xd36(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     12f5 <main+0x105>
lea    0xd25(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    1321 <main+0x131>
xor    %eax,%eax
call   1040 <print_version@plt>
jmp    13a0 <main+0x1b0>
mov    0x28(%rbx),%rdi
lea    0xd3f(%rip),%rsi
call   10b0 <strcmp@plt>
movl   $0x1,0xc(%rsp)
mov    %r14,%r12
test   %rax,%rax
je     1339 <main+0x149>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
lea    0xce6(%rip),%rsi
jmp    13dc <main+0x1ec>
mov    %r14,%r12
lea    0xd0e(%rip),%rsi
mov    %r14,%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     13ba <main+0x1ca>
mov    %rax,%rbp
mov    %r15d,%edi
mov    %r13d,%esi
call   1080 <init_board@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %rbp,%rcx
call   1070 <load_board@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r13d,%edx
mov    0x10(%rsp),%rcx
mov    %r12,%r8
mov    0xc(%rsp),%r9d
call   1060 <process_board@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r13d,%edx
call   10e0 <free_board@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1100 <print_help@plt>
jmp    13a0 <main+0x1b0>
mov    0x2c1f(%rip),%rax
mov    (%rax),%edi
lea    0xc86(%rip),%rsi
jmp    13dc <main+0x1ec>
mov    0x2c0d(%rip),%rax
mov    (%rax),%edi
lea    0xc4f(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [3 x i8] c"-v\00"
@.str.3 = [10 x i8] c"--version\00"
@stderr = global i32 0
@.str.4 = [20 x i8] c"Invalid parameter!\0A\00"
@.str.5 = [29 x i8] c"Wrong number of parameters!\0A\00"
@.str.6 = [3 x i8] c"-o\00"
@.str.7 = [3 x i8] c"-s\00"
@.str.8 = [2 x i8] c"r\00"
@.str.9 = [32 x i8] c"Error while opening input file\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8**
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %12
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %44
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
store i8* %20, i8** %13
%21 = load i8*, i8** %13
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %17
%25 = load i8*, i8** %13
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24, %17
%29 = call i32 (...) @print_help()
store i32 0, i32* %3
br label %148
30: ; preds = %24
%31 = load i8*, i8** %13
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load i8*, i8** %13
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34, %30
%39 = call i32 (...) @print_version()
store i32 0, i32* %3
br label %148
40: ; preds = %34
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %2
%45 = load i32, i32* %4
%46 = icmp ne i32 %45, 5
br i1 %46, label %47, label %57
47: ; preds = %44
%48 = load i32, i32* %4
%49 = icmp ne i32 %48, 7
br i1 %49, label %50, label %57
50: ; preds = %47
%51 = load i32, i32* %4
%52 = icmp ne i32 %51, 6
br i1 %52, label %53, label %57
53: ; preds = %50
%54 = load i32, i32* @stderr
%55 = call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %50, %47, %44
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 4
%60 = load i8*, i8** %59
store i8* %60, i8** %6
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 1
%63 = load i8*, i8** %62
%64 = call i64 @atoi(i8* %63)
%65 = trunc i64 %64 to i32
store i32 %65, i32* %8
%66 = load i32, i32* %8
%67 = call i32 @validate_actionsCount(i32 %66)
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 2
%70 = load i8*, i8** %69
%71 = call i64 @atoi(i8* %70)
%72 = trunc i64 %71 to i32
store i32 %72, i32* %9
%73 = load i32, i32* %9
%74 = call i32 @validate_rows(i32 %73)
%75 = load i8**, i8*** %5
%76 = getelementptr inbounds i8*, i8** %75, i64 3
%77 = load i8*, i8** %76
%78 = call i64 @atoi(i8* %77)
%79 = trunc i64 %78 to i32
store i32 %79, i32* %10
%80 = load i32, i32* %10
%81 = call i32 @validate_cols(i32 %80)
%82 = load i8*, i8** %6
store i8* %82, i8** %7
%83 = load i32, i32* %4
%84 = icmp eq i32 %83, 7
br i1 %84, label %85, label %100
85: ; preds = %57
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 5
%88 = load i8*, i8** %87
%89 = call i64 @strcmp(i8* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %95
91: ; preds = %85
%92 = load i8**, i8*** %5
%93 = getelementptr inbounds i8*, i8** %92, i64 6
%94 = load i8*, i8** %93
store i8* %94, i8** %7
br label %99
95: ; preds = %85
%96 = load i32, i32* @stderr
%97 = call i32 @fprintf(i32 %96, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%98 = call i32 @exit(i32 1)
unreachable
99: ; preds = %91
br label %100
100: ; preds = %99, %57
%101 = load i32, i32* %4
%102 = icmp eq i32 %101, 6
br i1 %102, label %103, label %115
103: ; preds = %100
%104 = load i8**, i8*** %5
%105 = getelementptr inbounds i8*, i8** %104, i64 5
%106 = load i8*, i8** %105
%107 = call i64 @strcmp(i8* %106, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%108 = icmp eq i64 %107, 0
br i1 %108, label %109, label %110
109: ; preds = %103
store i32 1, i32* %12
br label %114
110: ; preds = %103
%111 = load i32, i32* @stderr
%112 = call i32 @fprintf(i32 %111, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %109
br label %115
115: ; preds = %114, %100
br label %116
116: ; preds = %115
br label %117
117: ; preds = %116
%118 = load i8*, i8** %6
%119 = call i32* @fopen(i8* %118, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %119, i32** %14
%120 = load i32*, i32** %14
%121 = icmp eq i32* %120, null
br i1 %121, label %122, label %126
122: ; preds = %117
%123 = load i32, i32* @stderr
%124 = call i32 @fprintf(i32 %123, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
%125 = call i32 @exit(i32 1)
unreachable
126: ; preds = %117
%127 = load i32, i32* %9
%128 = load i32, i32* %10
%129 = call i8** @init_board(i32 %127, i32 %128)
store i8** %129, i8*** %11
%130 = load i8**, i8*** %11
%131 = load i32, i32* %9
%132 = load i32, i32* %10
%133 = load i32*, i32** %14
%134 = call i32 @load_board(i8** %130, i32 %131, i32 %132, i32* %133)
%135 = load i32*, i32** %14
%136 = call i32 @fclose(i32* %135)
%137 = load i8**, i8*** %11
%138 = load i32, i32* %9
%139 = load i32, i32* %10
%140 = load i32, i32* %8
%141 = load i8*, i8** %7
%142 = load i32, i32* %12
%143 = call i32 @process_board(i8** %137, i32 %138, i32 %139, i32 %140, i8* %141, i32 %142)
%144 = load i8**, i8*** %11
%145 = load i32, i32* %9
%146 = load i32, i32* %10
%147 = call i32 @free_board(i8** %144, i32 %145, i32 %146)
store i32 0, i32* %3
br label %148
148: ; preds = %126, %38, %28
%149 = load i32, i32* %3
ret i32 %149
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [3 x i8] c"-v\00"
@.str.3 = [10 x i8] c"--version\00"
@stderr = global i32 0
@.str.4 = [20 x i8] c"Invalid parameter!\0A\00"
@.str.5 = [29 x i8] c"Wrong number of parameters!\0A\00"
@.str.6 = [3 x i8] c"-o\00"
@.str.7 = [3 x i8] c"-s\00"
@.str.8 = [2 x i8] c"r\00"
@.str.9 = [32 x i8] c"Error while opening input file\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %25 [
i32 2, label %3
i32 7, label %29
i32 6, label %29
i32 5, label %29
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8, %3
%12 = tail call i32 (...) @print_help()
br label %83
13: ; preds = %8
%14 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16, %13
%20 = tail call i32 (...) @print_version()
br label %83
21: ; preds = %16
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %2
%26 = load i32, i32* @stderr
%27 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%28 = tail call i32 @exit(i32 1)
unreachable
29: ; preds = %2, %2, %2
%30 = getelementptr inbounds i8*, i8** %1, i64 4
%31 = load i8*, i8** %30
%32 = getelementptr inbounds i8*, i8** %1, i64 1
%33 = load i8*, i8** %32
%34 = tail call i64 @atoi(i8* %33)
%35 = trunc i64 %34 to i32
%36 = tail call i32 @validate_actionsCount(i32 %35)
%37 = getelementptr inbounds i8*, i8** %1, i64 2
%38 = load i8*, i8** %37
%39 = tail call i64 @atoi(i8* %38)
%40 = trunc i64 %39 to i32
%41 = tail call i32 @validate_rows(i32 %40)
%42 = getelementptr inbounds i8*, i8** %1, i64 3
%43 = load i8*, i8** %42
%44 = tail call i64 @atoi(i8* %43)
%45 = trunc i64 %44 to i32
%46 = tail call i32 @validate_cols(i32 %45)
switch i32 %0, label %68 [
i32 7, label %47
i32 6, label %59
]
47: ; preds = %29
%48 = getelementptr inbounds i8*, i8** %1, i64 5
%49 = load i8*, i8** %48
%50 = tail call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %47
%53 = getelementptr inbounds i8*, i8** %1, i64 6
%54 = load i8*, i8** %53
br label %68
55: ; preds = %47
%56 = load i32, i32* @stderr
%57 = tail call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%58 = tail call i32 @exit(i32 1)
unreachable
59: ; preds = %29
%60 = getelementptr inbounds i8*, i8** %1, i64 5
%61 = load i8*, i8** %60
%62 = tail call i64 @strcmp(i8* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %68, label %64
64: ; preds = %59
%65 = load i32, i32* @stderr
%66 = tail call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%67 = tail call i32 @exit(i32 1)
unreachable
68: ; preds = %29, %52, %59
%69 = phi i8* [ %31, %59 ], [ %54, %52 ], [ %31, %29 ]
%70 = phi i32 [ 1, %59 ], [ 0, %52 ], [ 0, %29 ]
%71 = tail call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%72 = icmp eq i32* %71, null
br i1 %72, label %73, label %77
73: ; preds = %68
%74 = load i32, i32* @stderr
%75 = tail call i32 @fprintf(i32 %74, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
%76 = tail call i32 @exit(i32 1)
unreachable
77: ; preds = %68
%78 = tail call i8** @init_board(i32 %40, i32 %45)
%79 = tail call i32 @load_board(i8** %78, i32 %40, i32 %45, i32* %71)
%80 = tail call i32 @fclose(i32* %71)
%81 = tail call i32 @process_board(i8** %78, i32 %40, i32 %45, i32 %35, i8* %69, i32 %70)
%82 = tail call i32 @free_board(i8** %78, i32 %40, i32 %45)
br label %83
83: ; preds = %11, %19, %77
ret i32 0
}