#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 atoi(char *);
int /*<<< orphan*/ destroy(int *, int *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ init(int, int, int **, int **);
int /*<<< orphan*/ print(int, int, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ update(int, int, int *, int *);
int main(int argc, char **argv) {
  if (argc < 3) {
    printf("usage: main [Nrows] [Ncolumns]\n");
    exit(1);
  }
  int Nrows = atoi(argv[1]);
  int Ncolumns = atoi(argv[2]);
  int *board, *newboard;
  init(Nrows, Ncolumns, &board, &newboard);
  int Nit = 400, it;
  for (it = 0; it < Nit; ++it) {
    update(Nrows, Ncolumns, board, newboard);
    update(Nrows, Ncolumns, newboard, board);
    print(Nrows, Ncolumns, board);
  }
  destroy(board, newboard);
  exit(0);
  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)
cmpl   $0x3,-0x8(%rbp)
jge    11a6 <main+0x36>
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1070 <init@plt>
movl   $0x190,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1236 <main+0xc6>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <update@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <update@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1050 <print@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11e7 <main+0x77>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <destroy@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jg     1193 <main+0x23>
lea    0xe7c(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebp
mov    %rsp,%rdx
lea    0x8(%rsp),%rcx
mov    %r14d,%edi
mov    %eax,%esi
call   1070 <init@plt>
mov    $0x190,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <update@plt>
mov    0x8(%rsp),%rdx
mov    (%rsp),%rcx
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <update@plt>
mov    (%rsp),%rdx
mov    %r14d,%edi
mov    %ebp,%esi
call   1050 <print@plt>
add    $0xffffffff,%ebx
jne    11d0 <main+0x60>
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1060 <destroy@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"usage: main [Nrows] [Ncolumns]\0A\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
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %6
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %7
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = call i32 @init(i32 %26, i32 %27, i32** %8, i32** %9)
store i32 400, i32* %10
store i32 0, i32* %11
br label %29
29: ; preds = %48, %17
%30 = load i32, i32* %11
%31 = load i32, i32* %10
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %51
33: ; preds = %29
%34 = load i32, i32* %6
%35 = load i32, i32* %7
%36 = load i32*, i32** %8
%37 = load i32*, i32** %9
%38 = call i32 @update(i32 %34, i32 %35, i32* %36, i32* %37)
%39 = load i32, i32* %6
%40 = load i32, i32* %7
%41 = load i32*, i32** %9
%42 = load i32*, i32** %8
%43 = call i32 @update(i32 %39, i32 %40, i32* %41, i32* %42)
%44 = load i32, i32* %6
%45 = load i32, i32* %7
%46 = load i32*, i32** %8
%47 = call i32 @print(i32 %44, i32 %45, i32* %46)
br label %48
48: ; preds = %33
%49 = load i32, i32* %11
%50 = add nsw i32 %49, 1
store i32 %50, i32* %11
br label %29
51: ; preds = %29
%52 = load i32*, i32** %8
%53 = load i32*, i32** %9
%54 = call i32 @destroy(i32* %52, i32* %53)
%55 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [31 x i8] c"usage: main [Nrows] [Ncolumns]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = bitcast i32** %3 to i8*
%17 = bitcast i32** %4 to i8*
%18 = call i32 @init(i32 %12, i32 %15, i32** %3, i32** %4)
br label %19
19: ; preds = %9, %19
%20 = phi i32 [ 0, %9 ], [ %29, %19 ]
%21 = load i32*, i32** %3
%22 = load i32*, i32** %4
%23 = call i32 @update(i32 %12, i32 %15, i32* %21, i32* %22)
%24 = load i32*, i32** %4
%25 = load i32*, i32** %3
%26 = call i32 @update(i32 %12, i32 %15, i32* %24, i32* %25)
%27 = load i32*, i32** %3
%28 = call i32 @print(i32 %12, i32 %15, i32* %27)
%29 = add nuw nsw i32 %20, 1
%30 = icmp eq i32 %29, 400
br i1 %30, label %31, label %19
31: ; preds = %19
%32 = load i32*, i32** %3
%33 = load i32*, i32** %4
%34 = call i32 @destroy(i32* %32, i32* %33)
%35 = call i32 @exit(i32 0)
unreachable
}