#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*/ fgets(char *, int, int /*<<< orphan*/);
char **get_grid(int, int);
scalar_t__ malloc(int);
char **mutate(int, int, char **);
int /*<<< orphan*/ print_grid(int, int, char **);
int /*<<< orphan*/ printf(char *, ...);
size_t read_file(char *, char **);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ write_file(char *, char *, size_t);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("This program requires a file name and no other parameters to "
           "start.\n\n");
    return (1);
  }
  char *grid_text;
  size_t bytes_read = read_file(argv[1], &grid_text);
  int x = grid_text[0];
  int y = grid_text[1];
  char **grid = get_grid(x, y);
  printf("Beginning with grid size %d, %d.\n\n", x, y);
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++) {
      grid[i][j] = *(grid_text + (i * y) + j + 2);
    }
  }
  print_grid(x, y, grid);
  while (1) {
    char fn[5];
    printf("Press q to quit, w to save to disk,\n");
    printf("n to iterate multple times, or any other\n");
    printf("key to continue to the next generation.\n");
    fgets(fn, 5, stdin);
    printf("-------------------------\n");
    switch (fn[0]) {
    case 'q':
      return 0;
    case 'w':
      printf("Enter a filename: ");
      char filename[254];
      fgets(filename, 254, stdin);
      char *contents = (char *)malloc(sizeof(char) * ((x * y) + 2));
      for (int i = 0; i < x; ++i) {
        for (int j = 0; j < y; ++j) {
          contents[i * y + j] = grid[i][j];
        }
      }
      for (int i = (x * y) + 2; i > 1; --i) {
        contents[i] = contents[i - 2];
      }
      contents[0] = x;
      contents[1] = y;
      write_file(filename, contents, bytes_read);
      break;
    case 'n':
      printf("How many iterations? ");
      int num = 0;
      char buf[5];
      fgets(buf, 5, stdin);
      num = atoi(buf);
      printf("Iterating %d times.\n\n", num);
      for (int i = 0; i < num; ++i) {
        grid = mutate(x, y, grid);
        print_grid(x, y, grid);
      }
      break;
    default:
      grid = mutate(x, y, grid);
      print_grid(x, y, grid);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11cd <main+0x3d>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    158b <main+0x3fb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <read_file@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1090 <get_grid@plt>
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    128d <main+0xfd>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    127a <main+0xea>
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x28(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
mov    0x2(%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x38(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1234 <main+0xa4>
jmp    127f <main+0xef>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1221 <main+0x91>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1050 <print_grid@plt>
lea    0xdc6(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x169(%rbp)
call   1030 <printf@plt>
mov    -0x169(%rbp),%al
lea    0xdd1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x169(%rbp),%al
lea    0xde9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2d0d(%rip),%rax
mov    (%rax),%edx
lea    -0x3d(%rbp),%rdi
mov    $0x5,%esi
call   1060 <fgets@plt>
mov    -0x169(%rbp),%al
lea    0xde9(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x3d(%rbp),%eax
mov    %eax,-0x168(%rbp)
sub    $0x6e,%eax
je     14b5 <main+0x325>
jmp    1315 <main+0x185>
mov    -0x168(%rbp),%eax
sub    $0x71,%eax
je     133d <main+0x1ad>
jmp    1329 <main+0x199>
mov    -0x168(%rbp),%eax
sub    $0x77,%eax
je     1349 <main+0x1b9>
jmp    1564 <main+0x3d4>
movl   $0x0,-0x4(%rbp)
jmp    158b <main+0x3fb>
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x140(%rbp),%rdi
mov    0x2c83(%rip),%rax
mov    (%rax),%edx
mov    $0xfe,%esi
call   1060 <fgets@plt>
mov    -0x24(%rbp),%eax
imul   -0x28(%rbp),%eax
add    $0x2,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x148(%rbp)
movl   $0x0,-0x14c(%rbp)
mov    -0x14c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1424 <main+0x294>
movl   $0x0,-0x150(%rbp)
mov    -0x150(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    140b <main+0x27b>
mov    -0x30(%rbp),%rax
movslq -0x14c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x150(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x148(%rbp),%rax
mov    -0x14c(%rbp),%ecx
imul   -0x28(%rbp),%ecx
add    -0x150(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x150(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x150(%rbp)
jmp    13b2 <main+0x222>
jmp    1410 <main+0x280>
mov    -0x14c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14c(%rbp)
jmp    1399 <main+0x209>
mov    -0x24(%rbp),%eax
imul   -0x28(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x154(%rbp)
cmpl   $0x1,-0x154(%rbp)
jle    147c <main+0x2ec>
mov    -0x148(%rbp),%rax
mov    -0x154(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x148(%rbp),%rax
movslq -0x154(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x154(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x154(%rbp)
jmp    1434 <main+0x2a4>
mov    -0x24(%rbp),%eax
mov    %al,%cl
mov    -0x148(%rbp),%rax
mov    %cl,(%rax)
mov    -0x28(%rbp),%eax
mov    %al,%cl
mov    -0x148(%rbp),%rax
mov    %cl,0x1(%rax)
lea    -0x140(%rbp),%rdi
mov    -0x148(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <write_file@plt>
jmp    1586 <main+0x3f6>
lea    0xc53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x158(%rbp)
lea    -0x15d(%rbp),%rdi
mov    0x2b0d(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
call   1060 <fgets@plt>
lea    -0x15d(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x158(%rbp)
mov    -0x158(%rbp),%esi
lea    0xc1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x164(%rbp)
mov    -0x164(%rbp),%eax
cmp    -0x158(%rbp),%eax
jge    155f <main+0x3cf>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   10b0 <mutate@plt>
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1050 <print_grid@plt>
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1517 <main+0x387>
jmp    1586 <main+0x3f6>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   10b0 <mutate@plt>
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1050 <print_grid@plt>
jmp    129c <main+0x10c>
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
cmp    $0x2,%edi
jne    12e4 <main+0x144>
mov    0x8(%rsi),%rdi
lea    0x10(%rsp),%rsi
call   1080 <read_file@plt>
mov    %rax,0x100(%rsp)
mov    0x10(%rsp),%rax
movsbl (%rax),%r12d
mov    0x1(%rax),%r14b
movsbl %r14b,%ebp
mov    %r12d,%edi
mov    %ebp,%esi
call   10a0 <get_grid@plt>
mov    %rax,%r15
lea    0xe0b(%rip),%rdi
mov    %r12d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
movsbq %bpl,%r11
mov    %r12d,%ebx
mov    %ebp,0x2c(%rsp)
mov    %ebp,%r13d
test   %r12d,%r12d
jle    12fa <main+0x15a>
lea    -0x1(%r13),%r8
mov    %r13d,%r9d
and    $0x3,%r9d
mov    %r13d,%r10d
and    $0xfffffffc,%r10d
xor    %esi,%esi
xor    %edi,%edi
jmp    1240 <main+0xa0>
add    $0x1,%rdi
add    %r11,%rsi
cmp    %rbx,%rdi
je     12fa <main+0x15a>
test   %r14b,%r14b
jle    1230 <main+0x90>
xor    %eax,%eax
cmp    $0x3,%r8
jb     12ac <main+0x10c>
nopl   (%rax)
mov    0x10(%rsp),%rcx
add    %rsi,%rcx
movzbl 0x2(%rax,%rcx,1),%ecx
mov    (%r15,%rdi,8),%rdx
mov    %cl,(%rdx,%rax,1)
mov    0x10(%rsp),%rcx
add    %rsi,%rcx
movzbl 0x3(%rax,%rcx,1),%ecx
mov    (%r15,%rdi,8),%rdx
mov    %cl,0x1(%rdx,%rax,1)
mov    0x10(%rsp),%rcx
add    %rsi,%rcx
movzbl 0x4(%rax,%rcx,1),%ecx
mov    (%r15,%rdi,8),%rdx
mov    %cl,0x2(%rdx,%rax,1)
mov    0x10(%rsp),%rcx
add    %rsi,%rcx
movzbl 0x5(%rax,%rcx,1),%ecx
mov    (%r15,%rdi,8),%rdx
mov    %cl,0x3(%rdx,%rax,1)
add    $0x4,%rax
cmp    %rax,%r10
jne    1250 <main+0xb0>
test   %r9,%r9
je     1230 <main+0x90>
mov    %r9,%rcx
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rbp
add    %rsi,%rbp
movzbl 0x2(%rax,%rbp,1),%edx
mov    (%r15,%rdi,8),%rbp
mov    %dl,0x0(%rbp,%rax,1)
add    $0x1,%rax
add    $0xffffffffffffffff,%rcx
jne    12c0 <main+0x120>
jmp    1230 <main+0x90>
lea    0xe06(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    18ce <main+0x72e>
mov    %rbx,0xf0(%rsp)
mov    %r11,0xf8(%rsp)
mov    %r14b,0xf(%rsp)
mov    $0xfffffffe,%r14d
mov    %r12d,%edi
mov    0x2c(%rsp),%ebx
mov    %ebx,%esi
mov    %r15,%rdx
call   1060 <print_grid@plt>
mov    %ebx,%edx
imul   %r12d,%edx
lea    0x2(%rdx),%esi
cmp    $0x2,%rsi
mov    $0x2,%ecx
cmovl  %rsi,%rcx
mov    %rsi,%rdi
sub    %rcx,%rdi
lea    0x1(%rsi),%rbp
lea    (%rcx,%rdx,1),%rax
sub    %rsi,%rax
mov    %rax,0xc0(%rsp)
mov    %rbp,%rax
mov    %rbp,0xc8(%rsp)
mov    %rcx,%rax
mov    %rcx,0xd8(%rsp)
sub    %rcx,%rbp
lea    -0x1(%r13),%rax
mov    %rax,0xe8(%rsp)
lea    -0x10(%rbp),%rax
mov    %rax,0x98(%rsp)
shr    $0x4,%rax
add    $0x1,%rax
mov    %r13d,%ecx
and    $0x3,%ecx
mov    %rcx,0xe0(%rsp)
and    $0xfffffffc,%r13d
cmp    %edi,%edx
setb   %r8b
mov    %rdi,%rcx
shr    $0x20,%rcx
setne  %cl
or     %r8b,%cl
mov    %cl,0xe(%rsp)
neg    %rdi
mov    %rdi,0x58(%rsp)
mov    %rbp,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %eax,%edi
and    $0x3,%edi
and    $0xfffffffffffffffc,%rax
mov    %rax,0x88(%rsp)
mov    %rsi,%rax
mov    %rcx,0x50(%rsp)
sub    %rcx,%rax
mov    %rax,0x80(%rsp)
mov    %rbp,%rax
mov    %rbp,0x18(%rsp)
and    $0xfffffffffffffffc,%rbp
mov    %rsi,%rax
sub    %rbp,%rax
mov    %rax,0xb0(%rsp)
mov    %rdi,0x90(%rsp)
shl    $0x4,%rdi
mov    %rdi,0x40(%rsp)
mov    %rbp,0xb8(%rsp)
neg    %rbp
mov    %rbp,0xa8(%rsp)
mov    %rdx,0x60(%rsp)
lea    0x1(%rdx),%rax
mov    %rax,0xd0(%rsp)
lea    -0xf(%rsi),%rax
mov    %rax,0x48(%rsp)
lea    -0x20(%rsi,%r14,1),%rax
mov    %rax,0x78(%rsp)
lea    -0x10(%rsi,%r14,1),%rax
mov    %rax,0x70(%rsp)
lea    -0x30(%rsi,%r14,1),%rax
mov    %rax,0x68(%rsp)
lea    (%rsi,%r14,1),%rax
mov    %rax,0x30(%rsp)
mov    %rsi,0x20(%rsp)
lea    -0x3(%rsi),%rax
mov    %rax,0xa0(%rsp)
jmp    149f <main+0x2ff>
nopl   0x0(%rax)
mov    %r12b,(%rax)
mov    %r8b,0x1(%rax)
lea    0x110(%rsp),%rdi
mov    %rax,%rsi
mov    0x100(%rsp),%rdx
call   1050 <write_file@plt>
lea    0xbbc(%rip),%rbp
mov    %rbp,%rdi
call   1030 <puts@plt>
lea    0xbd1(%rip),%rdi
call   1030 <puts@plt>
lea    0xbee(%rip),%rdi
call   1030 <puts@plt>
mov    0x2b1b(%rip),%rax
mov    (%rax),%edx
lea    0x3b(%rsp),%rdi
mov    $0x5,%esi
call   1070 <fgets@plt>
lea    0xbf2(%rip),%rdi
call   1030 <puts@plt>
movsbl 0x3b(%rsp),%eax
cmp    $0x6e,%eax
je     1530 <main+0x390>
cmp    $0x77,%eax
je     15c0 <main+0x420>
cmp    $0x71,%eax
je     18cc <main+0x72c>
mov    %r12d,%edi
mov    %ebx,%esi
mov    %r15,%rdx
call   10c0 <mutate@plt>
mov    %rax,%r15
mov    %r12d,%edi
mov    %ebx,%esi
mov    %rax,%rdx
call   1060 <print_grid@plt>
jmp    14a6 <main+0x306>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xaff(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2aa3(%rip),%rax
mov    (%rax),%edx
lea    0x10b(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x5,%esi
call   1070 <fgets@plt>
mov    %rbp,%rdi
call   10b0 <atoi@plt>
mov    %eax,%r14d
lea    0xade(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xae4(%rip),%rbp
test   %r14d,%r14d
jle    14a6 <main+0x306>
nopw   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %ebx,%esi
mov    %r15,%rdx
call   10c0 <mutate@plt>
mov    %rax,%r15
mov    %r12d,%edi
mov    %ebx,%esi
mov    %rax,%rdx
call   1060 <print_grid@plt>
add    $0xffffffff,%r14d
jne    1590 <main+0x3f0>
jmp    14a6 <main+0x306>
nopl   0x0(%rax,%rax,1)
lea    0xa5c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2a13(%rip),%rax
mov    (%rax),%edx
lea    0x110(%rsp),%rdi
mov    $0xfe,%esi
call   1070 <fgets@plt>
mov    0x20(%rsp),%rdi
call   1090 <malloc@plt>
test   %r12b,%r12b
mov    0xf(%rsp),%r8b
mov    0xf8(%rsp),%r9
mov    0xf0(%rsp),%r10
mov    0xe8(%rsp),%r11
mov    0xe0(%rsp),%r14
jle    16c0 <main+0x520>
lea    0x3(%rax),%rcx
mov    %rax,%rdx
xor    %esi,%esi
jmp    1643 <main+0x4a3>
nopl   0x0(%rax)
add    $0x1,%rsi
add    %r9,%rcx
add    %r9,%rdx
cmp    %r10,%rsi
je     16c0 <main+0x520>
test   %r8b,%r8b
jle    1630 <main+0x490>
xor    %edi,%edi
cmp    $0x3,%r11
jb     168c <main+0x4ec>
mov    (%r15,%rsi,8),%rbp
movzbl 0x0(%rbp,%rdi,1),%ebx
mov    %bl,-0x3(%rcx,%rdi,1)
mov    (%r15,%rsi,8),%rbp
movzbl 0x1(%rbp,%rdi,1),%ebx
mov    %bl,-0x2(%rcx,%rdi,1)
mov    (%r15,%rsi,8),%rbp
movzbl 0x2(%rbp,%rdi,1),%ebx
mov    %bl,-0x1(%rcx,%rdi,1)
mov    (%r15,%rsi,8),%rbp
movzbl 0x3(%rbp,%rdi,1),%ebx
mov    %bl,(%rcx,%rdi,1)
add    $0x4,%rdi
cmp    %rdi,%r13
jne    1650 <main+0x4b0>
test   %r14,%r14
je     1630 <main+0x490>
mov    %r14,%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15,%rsi,8),%rbx
movzbl (%rbx,%rdi,1),%ebx
mov    %bl,(%rdx,%rdi,1)
add    $0x1,%rdi
add    $0xffffffffffffffff,%rbp
jne    16a0 <main+0x500>
jmp    1630 <main+0x490>
nopw   0x0(%rax,%rax,1)
cmpl   $0x0,0x60(%rsp)
mov    0x2c(%rsp),%ebx
mov    $0xfffffffe,%ebp
js     1480 <main+0x2e0>
mov    0x20(%rsp),%rcx
cmpq   $0x4,0x18(%rsp)
jb     18b0 <main+0x710>
mov    0x20(%rsp),%rsi
lea    (%rax,%rsi,1),%rcx
mov    0x58(%rsp),%rdx
add    %rcx,%rdx
cmp    %rcx,%rdx
seta   %cl
or     0xe(%rsp),%cl
mov    %rsi,%rcx
jne    18b0 <main+0x710>
mov    0x60(%rsp),%rcx
lea    (%rax,%rcx,1),%rdx
mov    0x58(%rsp),%rcx
lea    (%rdx,%rcx,1),%rsi
mov    0x20(%rsp),%rcx
cmp    %rdx,%rsi
ja     18b0 <main+0x710>
mov    0xd8(%rsp),%rcx
add    %rax,%rcx
mov    0xd0(%rsp),%rdx
add    %rax,%rdx
cmp    %rdx,%rcx
jae    176a <main+0x5ca>
mov    0xc8(%rsp),%rcx
lea    (%rax,%rcx,1),%rdx
mov    0xc0(%rsp),%rcx
lea    (%rax,%rcx,1),%rsi
mov    0x20(%rsp),%rcx
cmp    %rdx,%rsi
jb     18b0 <main+0x710>
cmpq   $0x10,0x18(%rsp)
jae    1779 <main+0x5d9>
xor    %edx,%edx
jmp    185c <main+0x6bc>
cmpq   $0x30,0x98(%rsp)
jae    1788 <main+0x5e8>
xor    %ecx,%ecx
jmp    17f4 <main+0x654>
mov    0x48(%rsp),%rcx
lea    (%rax,%rcx,1),%rdx
mov    0x88(%rsp),%rsi
xor    %ecx,%ecx
mov    0x78(%rsp),%r10
mov    0x70(%rsp),%r11
mov    0x68(%rsp),%r14
mov    0x30(%rsp),%r9
nop
lea    (%r9,%rcx,1),%edi
movups -0xf(%rax,%rdi,1),%xmm0
movups %xmm0,(%rdx,%rcx,1)
lea    (%r11,%rcx,1),%edi
movups -0xf(%rax,%rdi,1),%xmm0
movups %xmm0,-0x10(%rdx,%rcx,1)
lea    (%r10,%rcx,1),%edi
movups -0xf(%rax,%rdi,1),%xmm0
movups %xmm0,-0x20(%rdx,%rcx,1)
lea    (%r14,%rcx,1),%edi
movups -0xf(%rax,%rdi,1),%xmm0
movups %xmm0,-0x30(%rdx,%rcx,1)
add    $0xffffffffffffffc0,%rcx
add    $0xfffffffffffffffc,%rsi
jne    17b0 <main+0x610>
neg    %rcx
mov    0x40(%rsp),%r9
cmpq   $0x0,0x90(%rsp)
je     1838 <main+0x698>
mov    0x48(%rsp),%rdx
add    %rax,%rdx
sub    %rcx,%rdx
mov    0x30(%rsp),%rsi
sub    %rcx,%rsi
xor    %ecx,%ecx
nopl   0x0(%rax)
lea    (%rsi,%rcx,1),%edi
movups -0xf(%rax,%rdi,1),%xmm0
movups %xmm0,(%rdx,%rcx,1)
add    $0xfffffffffffffff0,%rcx
mov    %r9,%rdi
add    %rcx,%rdi
jne    1820 <main+0x680>
mov    0x50(%rsp),%rcx
cmp    %rcx,0x18(%rsp)
je     1480 <main+0x2e0>
mov    0x50(%rsp),%rdx
mov    0x80(%rsp),%rcx
testb  $0xc,0x18(%rsp)
je     18b0 <main+0x710>
neg    %rdx
mov    %rax,%r9
add    0xa0(%rsp),%r9
mov    0xa8(%rsp),%rdi
mov    0x30(%rsp),%rcx
nopw   0x0(%rax,%rax,1)
lea    (%rcx,%rdx,1),%esi
mov    -0x3(%rax,%rsi,1),%esi
mov    %esi,(%r9,%rdx,1)
add    $0xfffffffffffffffc,%rdx
cmp    %rdx,%rdi
jne    1880 <main+0x6e0>
mov    0xb0(%rsp),%rcx
mov    0xb8(%rsp),%rdx
cmp    %rdx,0x18(%rsp)
je     1480 <main+0x2e0>
nop
lea    (%rcx,%rbp,1),%edx
movzbl (%rax,%rdx,1),%edx
mov    %dl,(%rax,%rcx,1)
lea    -0x1(%rcx),%rdx
cmp    $0x2,%rcx
mov    %rdx,%rcx
jg     18b0 <main+0x710>
jmp    1480 <main+0x2e0>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [70 x i8] c"This program requires a file name and no other parameters to start.\0A\0A\00"
@.str.1 = [35 x i8] c"Beginning with grid size %d, %d.\0A\0A\00"
@.str.2 = [37 x i8] c"Press q to quit, w to save to disk,\0A\00"
@.str.3 = [42 x i8] c"n to iterate multple times, or any other\0A\00"
@.str.4 = [41 x i8] c"key to continue to the next generation.\0A\00"
@stdin = global i32 0
@.str.5 = [27 x i8] c"-------------------------\0A\00"
@.str.6 = [19 x i8] c"Enter a filename: \00"
@.str.7 = [22 x i8] c"How many iterations? \00"
@.str.8 = [22 x i8] c"Iterating %d times.\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8**
%11 = alloca i32
%12 = alloca i32
%13 = alloca [5 x i8]
%14 = alloca [254 x i8]
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca [5 x i8]
%21 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 2
br i1 %23, label %24, label %26
24: ; preds = %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %217
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i64 @read_file(i8* %29, i8** %6)
store i64 %30, i64* %7
%31 = load i8*, i8** %6
%32 = getelementptr inbounds i8, i8* %31, i64 0
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
store i32 %34, i32* %8
%35 = load i8*, i8** %6
%36 = getelementptr inbounds i8, i8* %35, i64 1
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
store i32 %38, i32* %9
%39 = load i32, i32* %8
%40 = load i32, i32* %9
%41 = call i8** @get_grid(i32 %39, i32 %40)
store i8** %41, i8*** %10
%42 = load i32, i32* %8
%43 = load i32, i32* %9
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %42, i32 %43)
store i32 0, i32* %11
br label %45
45: ; preds = %78, %26
%46 = load i32, i32* %11
%47 = load i32, i32* %8
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %81
49: ; preds = %45
store i32 0, i32* %12
br label %50
50: ; preds = %74, %49
%51 = load i32, i32* %12
%52 = load i32, i32* %9
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %77
54: ; preds = %50
%55 = load i8*, i8** %6
%56 = load i32, i32* %11
%57 = load i32, i32* %9
%58 = mul nsw i32 %56, %57
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %55, i64 %59
%61 = load i32, i32* %12
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %60, i64 %62
%64 = getelementptr inbounds i8, i8* %63, i64 2
%65 = load i8, i8* %64
%66 = load i8**, i8*** %10
%67 = load i32, i32* %11
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %66, i64 %68
%70 = load i8*, i8** %69
%71 = load i32, i32* %12
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %70, i64 %72
store i8 %65, i8* %73
br label %74
74: ; preds = %54
%75 = load i32, i32* %12
%76 = add nsw i32 %75, 1
store i32 %76, i32* %12
br label %50
77: ; preds = %50
br label %78
78: ; preds = %77
%79 = load i32, i32* %11
%80 = add nsw i32 %79, 1
store i32 %80, i32* %11
br label %45
81: ; preds = %45
%82 = load i32, i32* %8
%83 = load i32, i32* %9
%84 = load i8**, i8*** %10
%85 = call i32 @print_grid(i32 %82, i32 %83, i8** %84)
br label %86
86: ; preds = %81, %216
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
%90 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%91 = load i32, i32* @stdin
%92 = call i32 @fgets(i8* %90, i32 5, i32 %91)
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%94 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
switch i32 %96, label %207 [
i32 113, label %97
i32 119, label %98
i32 110, label %181
]
97: ; preds = %86
store i32 0, i32* %3
br label %217
98: ; preds = %86
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%100 = getelementptr inbounds [254 x i8], [254 x i8]* %14, i64 0, i64 0
%101 = load i32, i32* @stdin
%102 = call i32 @fgets(i8* %100, i32 254, i32 %101)
%103 = load i32, i32* %8
%104 = load i32, i32* %9
%105 = mul nsw i32 %103, %104
%106 = add nsw i32 %105, 2
%107 = sext i32 %106 to i64
%108 = mul i64 1, %107
%109 = trunc i64 %108 to i32
%110 = call i64 @malloc(i32 %109)
%111 = inttoptr i64 %110 to i8*
store i8* %111, i8** %15
store i32 0, i32* %16
br label %112
112: ; preds = %143, %98
%113 = load i32, i32* %16
%114 = load i32, i32* %8
%115 = icmp slt i32 %113, %114
br i1 %115, label %116, label %146
116: ; preds = %112
store i32 0, i32* %17
br label %117
117: ; preds = %139, %116
%118 = load i32, i32* %17
%119 = load i32, i32* %9
%120 = icmp slt i32 %118, %119
br i1 %120, label %121, label %142
121: ; preds = %117
%122 = load i8**, i8*** %10
%123 = load i32, i32* %16
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i8*, i8** %122, i64 %124
%126 = load i8*, i8** %125
%127 = load i32, i32* %17
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i8, i8* %126, i64 %128
%130 = load i8, i8* %129
%131 = load i8*, i8** %15
%132 = load i32, i32* %16
%133 = load i32, i32* %9
%134 = mul nsw i32 %132, %133
%135 = load i32, i32* %17
%136 = add nsw i32 %134, %135
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i8, i8* %131, i64 %137
store i8 %130, i8* %138
br label %139
139: ; preds = %121
%140 = load i32, i32* %17
%141 = add nsw i32 %140, 1
store i32 %141, i32* %17
br label %117
142: ; preds = %117
br label %143
143: ; preds = %142
%144 = load i32, i32* %16
%145 = add nsw i32 %144, 1
store i32 %145, i32* %16
br label %112
146: ; preds = %112
%147 = load i32, i32* %8
%148 = load i32, i32* %9
%149 = mul nsw i32 %147, %148
%150 = add nsw i32 %149, 2
store i32 %150, i32* %18
br label %151
151: ; preds = %165, %146
%152 = load i32, i32* %18
%153 = icmp sgt i32 %152, 1
br i1 %153, label %154, label %168
154: ; preds = %151
%155 = load i8*, i8** %15
%156 = load i32, i32* %18
%157 = sub nsw i32 %156, 2
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds i8, i8* %155, i64 %158
%160 = load i8, i8* %159
%161 = load i8*, i8** %15
%162 = load i32, i32* %18
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds i8, i8* %161, i64 %163
store i8 %160, i8* %164
br label %165
165: ; preds = %154
%166 = load i32, i32* %18
%167 = add nsw i32 %166, -1
store i32 %167, i32* %18
br label %151
168: ; preds = %151
%169 = load i32, i32* %8
%170 = trunc i32 %169 to i8
%171 = load i8*, i8** %15
%172 = getelementptr inbounds i8, i8* %171, i64 0
store i8 %170, i8* %172
%173 = load i32, i32* %9
%174 = trunc i32 %173 to i8
%175 = load i8*, i8** %15
%176 = getelementptr inbounds i8, i8* %175, i64 1
store i8 %174, i8* %176
%177 = getelementptr inbounds [254 x i8], [254 x i8]* %14, i64 0, i64 0
%178 = load i8*, i8** %15
%179 = load i64, i64* %7
%180 = call i32 @write_file(i8* %177, i8* %178, i64 %179)
br label %216
181: ; preds = %86
%182 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %19
%183 = getelementptr inbounds [5 x i8], [5 x i8]* %20, i64 0, i64 0
%184 = load i32, i32* @stdin
%185 = call i32 @fgets(i8* %183, i32 5, i32 %184)
%186 = getelementptr inbounds [5 x i8], [5 x i8]* %20, i64 0, i64 0
%187 = call i32 @atoi(i8* %186)
store i32 %187, i32* %19
%188 = load i32, i32* %19
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 %188)
store i32 0, i32* %21
br label %190
190: ; preds = %203, %181
%191 = load i32, i32* %21
%192 = load i32, i32* %19
%193 = icmp slt i32 %191, %192
br i1 %193, label %194, label %206
194: ; preds = %190
%195 = load i32, i32* %8
%196 = load i32, i32* %9
%197 = load i8**, i8*** %10
%198 = call i8** @mutate(i32 %195, i32 %196, i8** %197)
store i8** %198, i8*** %10
%199 = load i32, i32* %8
%200 = load i32, i32* %9
%201 = load i8**, i8*** %10
%202 = call i32 @print_grid(i32 %199, i32 %200, i8** %201)
br label %203
203: ; preds = %194
%204 = load i32, i32* %21
%205 = add nsw i32 %204, 1
store i32 %205, i32* %21
br label %190
206: ; preds = %190
br label %216
207: ; preds = %86
%208 = load i32, i32* %8
%209 = load i32, i32* %9
%210 = load i8**, i8*** %10
%211 = call i8** @mutate(i32 %208, i32 %209, i8** %210)
store i8** %211, i8*** %10
%212 = load i32, i32* %8
%213 = load i32, i32* %9
%214 = load i8**, i8*** %10
%215 = call i32 @print_grid(i32 %212, i32 %213, i8** %214)
br label %216
216: ; preds = %207, %206, %168
br label %86
217: ; preds = %97, %24
%218 = load i32, i32* %3
ret i32 %218
}

LLVM IR (-O2):
@.str.1 = [35 x i8] c"Beginning with grid size %d, %d.\0A\0A\00"
@stdin = global i32 0
@.str.6 = [19 x i8] c"Enter a filename: \00"
@.str.7 = [22 x i8] c"How many iterations? \00"
@.str.8 = [22 x i8] c"Iterating %d times.\0A\0A\00"
@str = [36 x i8] c"Press q to quit, w to save to disk,\00"
@str.9 = [41 x i8] c"n to iterate multple times, or any other\00"
@str.10 = [40 x i8] c"key to continue to the next generation.\00"
@str.11 = [26 x i8] c"-------------------------\00"
@str.12 = [69 x i8] c"This program requires a file name and no other parameters to start.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca [5 x i8]
%5 = alloca [254 x i8]
%6 = alloca [5 x i8]
%7 = icmp eq i32 %0, 2
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str.12, i64 0, i64 0))
br label %360
10: ; preds = %2
%11 = bitcast i8** %3 to i8*
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @read_file(i8* %13, i8** %3)
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = getelementptr inbounds i8, i8* %15, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = call i8** @get_grid(i32 %17, i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %20)
%23 = icmp sgt i8 %16, 0
br i1 %23, label %26, label %24
24: ; preds = %10
%25 = sext i8 %19 to i64
br label %41
26: ; preds = %10
%27 = icmp sgt i8 %19, 0
%28 = sext i8 %19 to i64
%29 = zext i32 %17 to i64
%30 = zext i32 %20 to i64
%31 = add nsw i64 %30, -1
%32 = and i64 %30, 3
%33 = icmp ult i64 %31, 3
%34 = and i64 %30, 4294967292
%35 = icmp eq i64 %32, 0
br label %36
36: ; preds = %26, %111
%37 = phi i64 [ 0, %26 ], [ %112, %111 ]
br i1 %27, label %38, label %111
38: ; preds = %36
%39 = mul nsw i64 %37, %28
%40 = getelementptr inbounds i8*, i8** %21, i64 %37
br i1 %33, label %96, label %114
41: ; preds = %111, %24
%42 = phi i64 [ %25, %24 ], [ %28, %111 ]
%43 = call i32 @print_grid(i32 %17, i32 %20, i8** %21)
%44 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%45 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%46 = getelementptr inbounds [254 x i8], [254 x i8]* %5, i64 0, i64 0
%47 = mul nsw i32 %20, %17
%48 = add nsw i32 %47, 2
%49 = icmp sgt i8 %19, 0
%50 = icmp sgt i32 %47, -1
%51 = zext i32 %48 to i64
%52 = zext i32 %17 to i64
%53 = zext i32 %20 to i64
%54 = call i64 @llvm.smin.i64(i64 %51, i64 2)
%55 = sub nsw i64 %51, %54
%56 = zext i32 %47 to i64
%57 = call i64 @llvm.smin.i64(i64 %51, i64 2)
%58 = add nuw nsw i64 %51, 1
%59 = zext i32 %47 to i64
%60 = add nuw nsw i64 %57, %59
%61 = sub nsw i64 %60, %51
%62 = add nuw nsw i64 %59, 1
%63 = add nuw nsw i64 %51, 1
%64 = call i64 @llvm.smin.i64(i64 %51, i64 2)
%65 = sub nsw i64 %63, %64
%66 = call i64 @llvm.smin.i64(i64 %51, i64 2)
%67 = sub nsw i64 %63, %66
%68 = add nsw i64 %53, -1
%69 = add nsw i64 %65, -16
%70 = lshr i64 %69, 4
%71 = add nuw nsw i64 %70, 1
%72 = and i64 %53, 3
%73 = icmp ult i64 %68, 3
%74 = and i64 %53, 4294967292
%75 = icmp eq i64 %72, 0
%76 = icmp ult i64 %65, 4
%77 = trunc i64 %55 to i32
%78 = icmp ult i32 %47, %77
%79 = icmp ugt i64 %55, 4294967295
%80 = or i1 %78, %79
%81 = sub nsw i64 0, %55
%82 = sub nsw i64 0, %55
%83 = icmp ult i64 %65, 16
%84 = and i64 %65, -16
%85 = and i64 %71, 3
%86 = icmp ult i64 %69, 48
%87 = and i64 %71, 2305843009213693948
%88 = icmp eq i64 %85, 0
%89 = icmp eq i64 %65, %84
%90 = sub nsw i64 %51, %84
%91 = and i64 %65, 12
%92 = icmp eq i64 %91, 0
%93 = and i64 %67, -4
%94 = sub nsw i64 %51, %93
%95 = icmp eq i64 %67, %93
br label %151
96: ; preds = %114, %38
%97 = phi i64 [ 0, %38 ], [ %148, %114 ]
br i1 %35, label %111, label %98
98: ; preds = %96, %98
%99 = phi i64 [ %108, %98 ], [ %97, %96 ]
%100 = phi i64 [ %109, %98 ], [ 0, %96 ]
%101 = load i8*, i8** %3
%102 = getelementptr inbounds i8, i8* %101, i64 %39
%103 = getelementptr inbounds i8, i8* %102, i64 2
%104 = getelementptr inbounds i8, i8* %103, i64 %99
%105 = load i8, i8* %104
%106 = load i8*, i8** %40
%107 = getelementptr inbounds i8, i8* %106, i64 %99
store i8 %105, i8* %107
%108 = add nuw nsw i64 %99, 1
%109 = add i64 %100, 1
%110 = icmp eq i64 %109, %32
br i1 %110, label %111, label %98
111: ; preds = %96, %98, %36
%112 = add nuw nsw i64 %37, 1
%113 = icmp eq i64 %112, %29
br i1 %113, label %41, label %36
114: ; preds = %38, %114
%115 = phi i64 [ %148, %114 ], [ 0, %38 ]
%116 = phi i64 [ %149, %114 ], [ 0, %38 ]
%117 = load i8*, i8** %3
%118 = getelementptr inbounds i8, i8* %117, i64 %39
%119 = getelementptr inbounds i8, i8* %118, i64 2
%120 = getelementptr inbounds i8, i8* %119, i64 %115
%121 = load i8, i8* %120
%122 = load i8*, i8** %40
%123 = getelementptr inbounds i8, i8* %122, i64 %115
store i8 %121, i8* %123
%124 = or i64 %115, 1
%125 = load i8*, i8** %3
%126 = getelementptr inbounds i8, i8* %125, i64 %39
%127 = getelementptr inbounds i8, i8* %126, i64 2
%128 = getelementptr inbounds i8, i8* %127, i64 %124
%129 = load i8, i8* %128
%130 = load i8*, i8** %40
%131 = getelementptr inbounds i8, i8* %130, i64 %124
store i8 %129, i8* %131
%132 = or i64 %115, 2
%133 = load i8*, i8** %3
%134 = getelementptr inbounds i8, i8* %133, i64 %39
%135 = getelementptr inbounds i8, i8* %134, i64 2
%136 = getelementptr inbounds i8, i8* %135, i64 %132
%137 = load i8, i8* %136
%138 = load i8*, i8** %40
%139 = getelementptr inbounds i8, i8* %138, i64 %132
store i8 %137, i8* %139
%140 = or i64 %115, 3
%141 = load i8*, i8** %3
%142 = getelementptr inbounds i8, i8* %141, i64 %39
%143 = getelementptr inbounds i8, i8* %142, i64 2
%144 = getelementptr inbounds i8, i8* %143, i64 %140
%145 = load i8, i8* %144
%146 = load i8*, i8** %40
%147 = getelementptr inbounds i8, i8* %146, i64 %140
store i8 %145, i8* %147
%148 = add nuw nsw i64 %115, 4
%149 = add i64 %116, 4
%150 = icmp eq i64 %149, %34
br i1 %150, label %96, label %114
151: ; preds = %357, %41
%152 = phi i8** [ %21, %41 ], [ %358, %357 ]
%153 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%154 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.9, i64 0, i64 0))
%155 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.10, i64 0, i64 0))
%156 = load i32, i32* @stdin
%157 = call i32 @fgets(i8* %44, i32 5, i32 %156)
%158 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.11, i64 0, i64 0))
%159 = load i8, i8* %44
%160 = sext i8 %159 to i32
switch i32 %160, label %354 [
i32 113, label %359
i32 119, label %161
i32 110, label %340
]
161: ; preds = %151
%162 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%163 = load i32, i32* @stdin
%164 = call i32 @fgets(i8* %46, i32 254, i32 %163)
%165 = call i64 @malloc(i32 %48)
%166 = inttoptr i64 %165 to i8*
br i1 %23, label %278, label %167
167: ; preds = %296, %161
br i1 %50, label %168, label %328
168: ; preds = %167
br i1 %76, label %276, label %169
169: ; preds = %168
%170 = getelementptr i8, i8* %166, i64 %51
%171 = getelementptr i8, i8* %170, i64 %81
%172 = icmp ugt i8* %171, %170
%173 = getelementptr i8, i8* %166, i64 %56
%174 = getelementptr i8, i8* %173, i64 %82
%175 = icmp ugt i8* %174, %173
%176 = or i1 %80, %172
%177 = or i1 %176, %175
br i1 %177, label %276, label %178
178: ; preds = %169
%179 = getelementptr i8, i8* %166, i64 %57
%180 = getelementptr i8, i8* %166, i64 %58
%181 = getelementptr i8, i8* %166, i64 %61
%182 = getelementptr i8, i8* %166, i64 %62
%183 = icmp ult i8* %179, %182
%184 = icmp ult i8* %181, %180
%185 = and i1 %183, %184
br i1 %185, label %276, label %186
186: ; preds = %178
br i1 %83, label %259, label %187
187: ; preds = %186
br i1 %86, label %238, label %188
188: ; preds = %187
%189 = getelementptr inbounds i8, i8* %166, i64 -15
%190 = getelementptr inbounds i8, i8* %166, i64 -15
%191 = getelementptr inbounds i8, i8* %166, i64 -15
%192 = getelementptr inbounds i8, i8* %166, i64 -15
%193 = getelementptr inbounds i8, i8* %166, i64 -15
%194 = getelementptr inbounds i8, i8* %166, i64 -15
%195 = getelementptr inbounds i8, i8* %166, i64 -15
%196 = getelementptr inbounds i8, i8* %166, i64 -15
br label %197
197: ; preds = %197, %188
%198 = phi i64 [ 0, %188 ], [ %235, %197 ]
%199 = phi i64 [ 0, %188 ], [ %236, %197 ]
%200 = sub i64 %51, %198
%201 = add i64 %200, 4294967294
%202 = and i64 %201, 4294967295
%203 = getelementptr inbounds i8, i8* %189, i64 %202
%204 = bitcast i8* %203 to <16 x i8>*
%205 = load <16 x i8>, <16 x i8>* %204
%206 = getelementptr inbounds i8, i8* %190, i64 %200
%207 = bitcast i8* %206 to <16 x i8>*
store <16 x i8> %205, <16 x i8>* %207
%208 = or i64 %198, 16
%209 = sub i64 %51, %208
%210 = add i64 %209, 4294967294
%211 = and i64 %210, 4294967295
%212 = getelementptr inbounds i8, i8* %191, i64 %211
%213 = bitcast i8* %212 to <16 x i8>*
%214 = load <16 x i8>, <16 x i8>* %213
%215 = getelementptr inbounds i8, i8* %192, i64 %209
%216 = bitcast i8* %215 to <16 x i8>*
store <16 x i8> %214, <16 x i8>* %216
%217 = or i64 %198, 32
%218 = sub i64 %51, %217
%219 = add i64 %218, 4294967294
%220 = and i64 %219, 4294967295
%221 = getelementptr inbounds i8, i8* %193, i64 %220
%222 = bitcast i8* %221 to <16 x i8>*
%223 = load <16 x i8>, <16 x i8>* %222
%224 = getelementptr inbounds i8, i8* %194, i64 %218
%225 = bitcast i8* %224 to <16 x i8>*
store <16 x i8> %223, <16 x i8>* %225
%226 = or i64 %198, 48
%227 = sub i64 %51, %226
%228 = add i64 %227, 4294967294
%229 = and i64 %228, 4294967295
%230 = getelementptr inbounds i8, i8* %195, i64 %229
%231 = bitcast i8* %230 to <16 x i8>*
%232 = load <16 x i8>, <16 x i8>* %231
%233 = getelementptr inbounds i8, i8* %196, i64 %227
%234 = bitcast i8* %233 to <16 x i8>*
store <16 x i8> %232, <16 x i8>* %234
%235 = add nuw i64 %198, 64
%236 = add i64 %199, 4
%237 = icmp eq i64 %236, %87
br i1 %237, label %238, label %197
238: ; preds = %197, %187
%239 = phi i64 [ 0, %187 ], [ %235, %197 ]
br i1 %88, label %257, label %240
240: ; preds = %238
%241 = getelementptr inbounds i8, i8* %166, i64 -15
%242 = getelementptr inbounds i8, i8* %166, i64 -15
br label %243
243: ; preds = %243, %240
%244 = phi i64 [ %239, %240 ], [ %254, %243 ]
%245 = phi i64 [ 0, %240 ], [ %255, %243 ]
%246 = sub i64 %51, %244
%247 = add i64 %246, 4294967294
%248 = and i64 %247, 4294967295
%249 = getelementptr inbounds i8, i8* %241, i64 %248
%250 = bitcast i8* %249 to <16 x i8>*
%251 = load <16 x i8>, <16 x i8>* %250
%252 = getelementptr inbounds i8, i8* %242, i64 %246
%253 = bitcast i8* %252 to <16 x i8>*
store <16 x i8> %251, <16 x i8>* %253
%254 = add nuw i64 %244, 16
%255 = add i64 %245, 1
%256 = icmp eq i64 %255, %85
br i1 %256, label %257, label %243
257: ; preds = %243, %238
br i1 %89, label %328, label %258
258: ; preds = %257
br i1 %92, label %276, label %259
259: ; preds = %186, %258
%260 = phi i64 [ %84, %258 ], [ 0, %186 ]
%261 = getelementptr inbounds i8, i8* %166, i64 -3
%262 = getelementptr inbounds i8, i8* %166, i64 -3
br label %263
263: ; preds = %263, %259
%264 = phi i64 [ %260, %259 ], [ %273, %263 ]
%265 = sub i64 %51, %264
%266 = add i64 %265, 4294967294
%267 = and i64 %266, 4294967295
%268 = getelementptr inbounds i8, i8* %261, i64 %267
%269 = bitcast i8* %268 to <4 x i8>*
%270 = load <4 x i8>, <4 x i8>* %269
%271 = getelementptr inbounds i8, i8* %262, i64 %265
%272 = bitcast i8* %271 to <4 x i8>*
store <4 x i8> %270, <4 x i8>* %272
%273 = add nuw i64 %264, 4
%274 = icmp eq i64 %273, %93
br i1 %274, label %275, label %263
275: ; preds = %263
br i1 %95, label %328, label %276
276: ; preds = %178, %169, %168, %258, %275
%277 = phi i64 [ %51, %168 ], [ %51, %178 ], [ %51, %169 ], [ %90, %258 ], [ %94, %275 ]
br label %331
278: ; preds = %161, %296
%279 = phi i64 [ %297, %296 ], [ 0, %161 ]
br i1 %49, label %280, label %296
280: ; preds = %278
%281 = getelementptr inbounds i8*, i8** %152, i64 %279
%282 = mul nsw i64 %279, %42
br i1 %73, label %283, label %299
283: ; preds = %299, %280
%284 = phi i64 [ 0, %280 ], [ %325, %299 ]
br i1 %75, label %296, label %285
285: ; preds = %283, %285
%286 = phi i64 [ %293, %285 ], [ %284, %283 ]
%287 = phi i64 [ %294, %285 ], [ 0, %283 ]
%288 = load i8*, i8** %281
%289 = getelementptr inbounds i8, i8* %288, i64 %286
%290 = load i8, i8* %289
%291 = add nsw i64 %286, %282
%292 = getelementptr inbounds i8, i8* %166, i64 %291
store i8 %290, i8* %292
%293 = add nuw nsw i64 %286, 1
%294 = add i64 %287, 1
%295 = icmp eq i64 %294, %72
br i1 %295, label %296, label %285
296: ; preds = %283, %285, %278
%297 = add nuw nsw i64 %279, 1
%298 = icmp eq i64 %297, %52
br i1 %298, label %167, label %278
299: ; preds = %280, %299
%300 = phi i64 [ %325, %299 ], [ 0, %280 ]
%301 = phi i64 [ %326, %299 ], [ 0, %280 ]
%302 = load i8*, i8** %281
%303 = getelementptr inbounds i8, i8* %302, i64 %300
%304 = load i8, i8* %303
%305 = add nsw i64 %300, %282
%306 = getelementptr inbounds i8, i8* %166, i64 %305
store i8 %304, i8* %306
%307 = or i64 %300, 1
%308 = load i8*, i8** %281
%309 = getelementptr inbounds i8, i8* %308, i64 %307
%310 = load i8, i8* %309
%311 = add nsw i64 %307, %282
%312 = getelementptr inbounds i8, i8* %166, i64 %311
store i8 %310, i8* %312
%313 = or i64 %300, 2
%314 = load i8*, i8** %281
%315 = getelementptr inbounds i8, i8* %314, i64 %313
%316 = load i8, i8* %315
%317 = add nsw i64 %313, %282
%318 = getelementptr inbounds i8, i8* %166, i64 %317
store i8 %316, i8* %318
%319 = or i64 %300, 3
%320 = load i8*, i8** %281
%321 = getelementptr inbounds i8, i8* %320, i64 %319
%322 = load i8, i8* %321
%323 = add nsw i64 %319, %282
%324 = getelementptr inbounds i8, i8* %166, i64 %323
store i8 %322, i8* %324
%325 = add nuw nsw i64 %300, 4
%326 = add i64 %301, 4
%327 = icmp eq i64 %326, %74
br i1 %327, label %283, label %299
328: ; preds = %331, %257, %275, %167
store i8 %16, i8* %166
%329 = getelementptr inbounds i8, i8* %166, i64 1
store i8 %19, i8* %329
%330 = call i32 @write_file(i8* %46, i8* %166, i64 %14)
br label %357
331: ; preds = %276, %331
%332 = phi i64 [ %338, %331 ], [ %277, %276 ]
%333 = add i64 %332, 4294967294
%334 = and i64 %333, 4294967295
%335 = getelementptr inbounds i8, i8* %166, i64 %334
%336 = load i8, i8* %335
%337 = getelementptr inbounds i8, i8* %166, i64 %332
store i8 %336, i8* %337
%338 = add nsw i64 %332, -1
%339 = icmp sgt i64 %332, 2
br i1 %339, label %331, label %328
340: ; preds = %151
%341 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%342 = load i32, i32* @stdin
%343 = call i32 @fgets(i8* %45, i32 5, i32 %342)
%344 = call i32 @atoi(i8* %45)
%345 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 %344)
%346 = icmp sgt i32 %344, 0
br i1 %346, label %347, label %357
347: ; preds = %340, %347
%348 = phi i32 [ %352, %347 ], [ 0, %340 ]
%349 = phi i8** [ %350, %347 ], [ %152, %340 ]
%350 = call i8** @mutate(i32 %17, i32 %20, i8** %349)
%351 = call i32 @print_grid(i32 %17, i32 %20, i8** %350)
%352 = add nuw nsw i32 %348, 1
%353 = icmp eq i32 %352, %344
br i1 %353, label %357, label %347
354: ; preds = %151
%355 = call i8** @mutate(i32 %17, i32 %20, i8** %152)
%356 = call i32 @print_grid(i32 %17, i32 %20, i8** %355)
br label %357
357: ; preds = %347, %340, %328, %354
%358 = phi i8** [ %355, %354 ], [ %152, %328 ], [ %152, %340 ], [ %350, %347 ]
br label %151
359: ; preds = %151
br label %360
360: ; preds = %359, %8
%361 = phi i32 [ 1, %8 ], [ 0, %359 ]
ret i32 %361
}