#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 RAND_MAX;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ generateSets(int *, int *, int);
int /*<<< orphan*/ getchar();
int *malloc(int);
int /*<<< orphan*/ printf(char *);
int rand;
long simStableLife(int, int *, int, int);
int /*<<< orphan*/ sortSetLives(long **);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
main() {
  printf("LongLife by compucat (c) August 2015\n");
  int i, j, k;
  int chunkSize = 5;
  int *setMemory, *chunkMemory;
  long int setLives[160000][2];
  chunkMemory = malloc(sizeof(int) * 20 * chunkSize * chunkSize);
  if (chunkMemory == NULL) {
    printf("Fatal error: not enough memory for new chunks. LongLife "
           "aborted.\nPress Enter to exit.");
    getchar();
    exit(1);
  }
  setMemory = malloc(sizeof(int) * 160000 * chunkSize * 2 * chunkSize * 2);
  if (setMemory == NULL) {
    printf("Fatal error: not enough memory for new sets. LongLife "
           "aborted.\nPress Enter to exit.");
    getchar();
    exit(1);
  }
  srand(time(NULL));
  for (i = 0; i < 20; i++)
    for (j = 0; j < chunkSize; j++)
      for (k = 0; k < chunkSize; k++)
        (chunkMemory[chunkSize * chunkSize * 4 * i + chunkSize * 2 * j + k]) =
            (rand > (RAND_MAX / 2));
  while (chunkSize < 20) {
    generateSets(setMemory, chunkMemory, chunkSize);
    for (i = 0; i < 160000; i++)
      setLives[i][1] = i;
    for (i = 0; i < 160000; i++)
      setLives[i][0] = simStableLife(chunkSize * 2, setMemory, i, chunkSize);
    sortSetLives(setLives);
    free(chunkMemory);
    chunkSize = chunkSize * 2;
    chunkMemory = malloc(sizeof(int) * 20 * chunkSize * chunkSize);
    if (chunkMemory == NULL) {
      printf("Fatal error: not enough memory for new chunks. LongLife "
             "aborted.\nPress Enter to exit.");
      getchar();
      exit(1);
    }
    for (i = 0; i < 10; i++)
      for (j = 0; j < chunkSize; j++)
        for (k = 0; k < chunkSize; k++)
          (chunkMemory[chunkSize * chunkSize * 4 * i + chunkSize * 2 * j + k]) =
              (setMemory[chunkSize * chunkSize * 4 * setLives[i][1] +
                         chunkSize * 2 * j + k]);
    for (i = 10; i < 20; i++)
      for (j = 0; j < chunkSize; j++)
        for (k = 0; k < chunkSize; k++)
          (chunkMemory[chunkSize * chunkSize * 4 * i + chunkSize * 2 * j + k]) =
              (rand > (RAND_MAX / 2));
    free(setMemory);
    setMemory = malloc(sizeof(int) * 160000 * chunkSize * 2 * chunkSize * 2);
    if (setMemory == NULL) {
      printf("Fatal error: not enough memory for new sets. LongLife "
             "aborted.\nPress Enter to exit.");
      getchar();
      exit(1);
    }
  }
  FILE *out = fopen("LongLifeOutput.txt", "a");
  printf("Done! Writing file output...");
  fprintf(out,
          "***LongLife by compucat (c) August 2015 output***\n\nAttempted to "
          "find %dx%d patterns\n\nDue to algorithm limitations, found %dx%d "
          "patterns\n\n",
          20, 20, chunkSize, chunkSize);
  for (i = 0; i < 10; i++) {
    fprintf(out, "***Pattern %d***\n\n", i + 1);
    for (j = 0; j < chunkSize; j++) {
      for (k = 0; k < chunkSize; k++) {
        if ((chunkMemory[chunkSize * chunkSize * 4 * i + chunkSize * 2 * j +
                         k]) == 1)
          fprintf(out, "*");
        else
          fprintf(out, " ");
      }
      fprintf(out, "\n");
    }
    fprintf(out, "\n");
  }
  fprintf(out, "***End LongLife output***\n\n");
  fclose(out);
  printf("Done! Press Enter to exit...");
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x271040,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe17(%rip),%rdi
call   1050 <printf@plt>
movl   $0x5,-0x14(%rbp)
movslq -0x14(%rbp),%rax
imul   $0x50,%rax,%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1238 <main+0x68>
lea    0xe04(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
movslq -0x14(%rbp),%rax
imul   $0x9c400,%rax,%rax
shl    $0x1,%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
shl    $0x1,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1286 <main+0xb6>
lea    0xe0c(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10c0 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    135a <main+0x18a>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1347 <main+0x177>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1334 <main+0x164>
mov    0x2d04(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x27103c(%rbp)
mov    0x2d05(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x27103c(%rbp),%eax
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%edx
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
shl    $0x2,%ecx
imul   -0x8(%rbp),%ecx
mov    -0x14(%rbp),%esi
shl    $0x1,%esi
imul   -0xc(%rbp),%esi
add    %esi,%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    12c1 <main+0xf1>
jmp    1339 <main+0x169>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12ae <main+0xde>
jmp    134c <main+0x17c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    129d <main+0xcd>
jmp    135f <main+0x18f>
cmpl   $0x14,-0x14(%rbp)
jge    1659 <main+0x489>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1080 <generateSets@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x27100,-0x8(%rbp)
jge    13b5 <main+0x1e5>
movslq -0x8(%rbp),%rcx
movslq -0x8(%rbp),%rdx
lea    -0x271030(%rbp),%rax
shl    $0x4,%rdx
add    %rdx,%rax
mov    %rcx,0x8(%rax)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1380 <main+0x1b0>
movl   $0x0,-0x8(%rbp)
cmpl   $0x27100,-0x8(%rbp)
jge    1404 <main+0x234>
mov    -0x14(%rbp),%edi
shl    $0x1,%edi
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1060 <simStableLife@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rdx
lea    -0x271030(%rbp),%rax
shl    $0x4,%rdx
add    %rdx,%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    13bc <main+0x1ec>
lea    -0x271030(%rbp),%rdi
call   1090 <sortSetLives@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
imul   $0x50,%rax,%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1465 <main+0x295>
lea    0xbd7(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1539 <main+0x369>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1526 <main+0x356>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1513 <main+0x343>
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movslq -0x8(%rbp),%rsi
lea    -0x271030(%rbp),%rdx
shl    $0x4,%rsi
add    %rsi,%rdx
imul   0x8(%rdx),%rcx
mov    -0x14(%rbp),%edx
shl    $0x1,%edx
imul   -0xc(%rbp),%edx
movslq %edx,%rdx
add    %rdx,%rcx
movslq -0x10(%rbp),%rdx
add    %rdx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
shl    $0x2,%ecx
imul   -0x8(%rbp),%ecx
mov    -0x14(%rbp),%esi
shl    $0x1,%esi
imul   -0xc(%rbp),%esi
add    %esi,%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1490 <main+0x2c0>
jmp    1518 <main+0x348>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    147d <main+0x2ad>
jmp    152b <main+0x35b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    146c <main+0x29c>
movl   $0xa,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    15fd <main+0x42d>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    15ea <main+0x41a>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    15d7 <main+0x407>
mov    0x2a61(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x271040(%rbp)
mov    0x2a62(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x271040(%rbp),%eax
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%edx
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
shl    $0x2,%ecx
imul   -0x8(%rbp),%ecx
mov    -0x14(%rbp),%esi
shl    $0x1,%esi
imul   -0xc(%rbp),%esi
add    %esi,%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1564 <main+0x394>
jmp    15dc <main+0x40c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1551 <main+0x381>
jmp    15ef <main+0x41f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1540 <main+0x370>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movslq -0x14(%rbp),%rax
imul   $0x9c400,%rax,%rax
shl    $0x1,%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
shl    $0x1,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1654 <main+0x484>
lea    0xa3e(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    135f <main+0x18f>
lea    0xa70(%rip),%rdi
lea    0xa7c(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x271038(%rbp)
lea    0xa6b(%rip),%rdi
call   1050 <printf@plt>
mov    -0x271038(%rbp),%rdi
mov    -0x14(%rbp),%r8d
mov    -0x14(%rbp),%r9d
lea    0xa6d(%rip),%rsi
mov    $0x14,%ecx
mov    %ecx,%edx
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    17ab <main+0x5db>
mov    -0x271038(%rbp),%rdi
mov    -0x8(%rbp),%edx
add    $0x1,%edx
lea    0xac4(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1788 <main+0x5b8>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1765 <main+0x595>
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
shl    $0x2,%ecx
imul   -0x8(%rbp),%ecx
mov    -0x14(%rbp),%edx
shl    $0x1,%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    173d <main+0x56d>
mov    -0x271038(%rbp),%rdi
lea    0xa6e(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    1752 <main+0x582>
mov    -0x271038(%rbp),%rdi
lea    0xa56(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    1757 <main+0x587>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    16e9 <main+0x519>
mov    -0x271038(%rbp),%rdi
lea    0xa2a(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    16d6 <main+0x506>
mov    -0x271038(%rbp),%rdi
lea    0xa07(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    16aa <main+0x4da>
mov    -0x271038(%rbp),%rdi
lea    0x9ea(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x271038(%rbp),%rdi
call   1040 <fclose@plt>
lea    0x9ec(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x271040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x271078,%rsp
lea    0xf8a(%rip),%rdi
call   1040 <puts@plt>
mov    $0x7d0,%edi
call   1100 <malloc@plt>
test   %rax,%rax
je     17d6 <main+0x5c6>
mov    %rax,%rbp
mov    $0x3d09000,%edi
call   1100 <malloc@plt>
test   %rax,%rax
je     17cd <main+0x5bd>
mov    %rax,%r15
xor    %edi,%edi
call   10f0 <time@plt>
mov    %eax,%edi
call   1090 <srand@plt>
mov    0x2d6a(%rip),%rdx
mov    0x2d73(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
xor    %eax,%eax
cmp    %ecx,(%rdx)
setg   %al
movd   %eax,%xmm0
pshufd $0x0,%xmm0,%xmm0
mov    $0xb0,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movdqu %xmm0,-0xb0(%rbp,%rcx,1)
ff ff
mov    %eax,-0xa0(%rbp,%rcx,1)
movdqu %xmm0,-0x88(%rbp,%rcx,1)
ff ff
mov    %eax,-0x78(%rbp,%rcx,1)
movdqu %xmm0,-0x60(%rbp,%rcx,1)
mov    %eax,-0x50(%rbp,%rcx,1)
movdqu %xmm0,-0x38(%rbp,%rcx,1)
mov    %eax,-0x28(%rbp,%rcx,1)
movdqu %xmm0,-0x10(%rbp,%rcx,1)
mov    %eax,0x0(%rbp,%rcx,1)
add    $0x190,%rcx
cmp    $0x1ff0,%rcx
jne    12a0 <main+0x90>
mov    $0x5,%r12d
lea    0x70(%rsp),%r13
jmp    132f <main+0x11f>
nopl   0x0(%rax,%rax,1)
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
imul   $0x4e2000,0x34(%rsp),%edi
call   1100 <malloc@plt>
mov    %rax,%r15
mov    0x1c(%rsp),%eax
mov    %eax,%r12d
test   %r15,%r15
lea    0x70(%rsp),%r13
je     17cd <main+0x5bd>
cmp    $0x13,%r12d
ja     1681 <main+0x471>
mov    %r15,%rdi
mov    %rbp,0x8(%rsp)
mov    %rbp,%rsi
mov    %r12d,%edx
call   10a0 <generateSets@plt>
lea    0xb8(%rsp),%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %rcx,-0x40(%rax)
lea    0x1(%rcx),%rdx
mov    %rdx,-0x30(%rax)
lea    0x2(%rcx),%rdx
mov    %rdx,-0x20(%rax)
lea    0x3(%rcx),%rdx
mov    %rdx,-0x10(%rax)
lea    0x4(%rcx),%rdx
mov    %rdx,(%rax)
add    $0x50,%rax
add    $0x5,%rcx
cmp    $0x27100,%rcx
jne    1360 <main+0x150>
lea    (%r12,%r12,1),%r14d
mov    %r13,%rbp
xor    %ebx,%ebx
nopl   (%rax)
mov    %r14d,%edi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %r12d,%ecx
call   1070 <simStableLife@plt>
mov    %rax,0x0(%rbp)
add    $0x1,%rbx
add    $0x10,%rbp
cmp    $0x27100,%rbx
jne    13a0 <main+0x190>
mov    %r13,%rdi
call   10b0 <sortSetLives@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %r14d,%eax
imul   %r12d,%eax
mov    %eax,0x34(%rsp)
shl    $0x5,%eax
lea    (%rax,%rax,4),%edi
call   1100 <malloc@plt>
test   %rax,%rax
je     17d6 <main+0x5c6>
mov    %r14d,%ecx
imul   %ecx,%ecx
shl    $0x2,%ecx
mov    %r12,0x20(%rsp)
mov    %r12d,%ebp
lea    0x0(,%rbp,8),%rbx
mov    %r14d,0x1c(%rsp)
mov    %r14d,%r13d
mov    %rbp,%rsi
shl    $0x4,%rsi
mov    %r15,0x38(%rsp)
lea    (%r15,%rsi,1),%rdi
mov    %rdi,0x58(%rsp)
mov    %rbp,0x48(%rsp)
shl    $0x5,%rbp
add    %rax,%rsi
mov    %rcx,0x40(%rsp)
lea    0x0(,%rcx,4),%rcx
mov    %rcx,0x50(%rsp)
mov    %rax,0x8(%rsp)
mov    %rax,%r14
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rsi,0x10(%rsp)
mov    %rcx,0x60(%rsp)
mov    %rcx,%rax
shl    $0x4,%rax
mov    0x78(%rsp,%rax,1),%rax
imul   0x40(%rsp),%rax
mov    0x58(%rsp),%rcx
lea    (%rcx,%rax,4),%rcx
mov    %rcx,0x28(%rsp)
mov    0x38(%rsp),%rcx
lea    (%rcx,%rax,4),%rax
mov    %rax,0x68(%rsp)
mov    %r13,%r15
xor    %r12d,%r12d
xchg   %ax,%ax
lea    (%r14,%r12,1),%rdi
mov    0x68(%rsp),%rax
lea    (%rax,%r12,1),%rsi
mov    %rbx,%rdx
call   10e0 <memcpy@plt>
mov    0x10(%rsp),%rax
lea    (%rax,%r12,1),%rdi
mov    0x28(%rsp),%rax
lea    (%rax,%r12,1),%rsi
mov    %rbx,%rdx
call   10e0 <memcpy@plt>
add    %rbp,%r12
add    $0xfffffffffffffffe,%r15
jne    14a0 <main+0x290>
mov    0x60(%rsp),%rcx
add    $0x1,%rcx
mov    0x50(%rsp),%rax
mov    0x10(%rsp),%rsi
add    %rax,%rsi
add    %rax,%r14
cmp    $0xa,%rcx
jne    1460 <main+0x250>
mov    0x2ae6(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
xor    %eax,%eax
mov    0x2ac2(%rip),%rdx
cmp    %ecx,(%rdx)
setg   %al
mov    0x48(%rsp),%rcx
and    $0xfffffffe,%ecx
lea    (%rcx,%rcx,1),%r14
add    $0xfffffffffffffffc,%r14
mov    %r14,%r10
shr    $0x2,%r10
add    $0x1,%r10
mov    %r13d,%esi
and    $0xfffffffc,%esi
movd   %eax,%xmm0
pshufd $0x0,%xmm0,%xmm0
mov    %r10d,%r15d
and    $0x7,%r15d
and    $0xfffffffffffffff8,%r10
mov    0x8(%rsp),%rbp
lea    0x70(%rbp),%r11
mov    0x20(%rsp),%r9
mov    %r9d,%ecx
imul   %ecx,%ecx
shl    $0x5,%ecx
lea    (%rcx,%rcx,4),%ebx
shl    $0x2,%r9d
mov    %r15,%rdi
shl    $0x4,%rdi
mov    $0xa,%ecx
jmp    1598 <main+0x388>
nopl   0x0(%rax)
mov    0x28(%rsp),%ecx
add    $0x1,%ecx
mov    0x10(%rsp),%ebx
add    0x40(%rsp),%ebx
cmp    $0x14,%ecx
je     1300 <main+0xf0>
mov    %ecx,0x28(%rsp)
mov    %ebx,0x10(%rsp)
xor    %r12d,%r12d
jmp    15bc <main+0x3ac>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r12
add    %r9d,%ebx
cmp    %r13,%r12
je     1580 <main+0x370>
movslq %ebx,%r8
cmpl   $0x4,0x1c(%rsp)
jae    15d0 <main+0x3c0>
xor    %ecx,%ecx
jmp    165f <main+0x44f>
nopl   (%rax)
cmp    $0x1c,%r14
jae    15e0 <main+0x3d0>
xor    %ebp,%ebp
jmp    1629 <main+0x419>
nopw   0x0(%rax,%rax,1)
lea    (%r11,%r8,4),%rcx
mov    %r10,%rdx
xor    %ebp,%ebp
nopl   0x0(%rax)
movdqu %xmm0,-0x70(%rcx,%rbp,4)
movdqu %xmm0,-0x60(%rcx,%rbp,4)
movdqu %xmm0,-0x50(%rcx,%rbp,4)
movdqu %xmm0,-0x40(%rcx,%rbp,4)
movdqu %xmm0,-0x30(%rcx,%rbp,4)
movdqu %xmm0,-0x20(%rcx,%rbp,4)
movdqu %xmm0,-0x10(%rcx,%rbp,4)
movdqu %xmm0,(%rcx,%rbp,4)
add    $0x20,%rbp
add    $0xfffffffffffffff8,%rdx
jne    15f0 <main+0x3e0>
test   %r15,%r15
je     164e <main+0x43e>
add    %r8,%rbp
mov    0x8(%rsp),%rcx
lea    (%rcx,%rbp,4),%rcx
xor    %edx,%edx
nopl   0x0(%rax)
movdqu %xmm0,(%rcx,%rdx,1)
add    $0x10,%rdx
cmp    %rdx,%rdi
jne    1640 <main+0x430>
mov    %rsi,%rcx
cmp    %r13,%rsi
mov    0x8(%rsp),%rbp
je     15b0 <main+0x3a0>
lea    0x0(,%r8,4),%rdx
add    %rbp,%rdx
nopw   0x0(%rax,%rax,1)
mov    %eax,(%rdx,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%r13
jne    1670 <main+0x460>
jmp    15b0 <main+0x3a0>
lea    0xa22(%rip),%rdi
lea    0xa2e(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%r14
lea    0xa21(%rip),%rdi
call   1060 <printf@plt>
lea    0xa32(%rip),%rsi
mov    %r14,%rdi
mov    $0x14,%edx
mov    $0x14,%ecx
mov    %r12d,%r8d
mov    %r12d,%r9d
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r12d,%ebx
imul   %r12d,%r12d
shl    $0x2,%r12d
shl    $0x2,%r12
lea    0x0(,%rbx,8),%r15
xor    %edx,%edx
mov    %r12,0x20(%rsp)
jmp    1713 <main+0x503>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
mov    0x8(%rsp),%rbp
mov    0x20(%rsp),%r12
add    %r12,%rbp
mov    0x10(%rsp),%edx
cmp    $0xa,%edx
je     1785 <main+0x575>
add    $0x1,%edx
mov    %r14,%rdi
lea    0xa46(%rip),%rsi
mov    %edx,0x10(%rsp)
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %rbp,0x8(%rsp)
xor    %r13d,%r13d
jmp    1759 <main+0x549>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
add    $0x1,%r13
add    %r15,%rbp
cmp    %rbx,%r13
je     16f0 <main+0x4e0>
xor    %r12d,%r12d
jmp    1771 <main+0x561>
xchg   %ax,%ax
mov    %r14,%rsi
call   1080 <fputc@plt>
add    $0x1,%r12
cmp    %r12,%rbx
je     1740 <main+0x530>
cmpl   $0x1,0x0(%rbp,%r12,4)
mov    $0x2a,%edi
je     1760 <main+0x550>
mov    $0x20,%edi
jmp    1760 <main+0x550>
lea    0x9ed(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1130 <fwrite@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
lea    0x9e8(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
call   10c0 <getchar@plt>
xor    %eax,%eax
add    $0x271078,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x882(%rip),%rdi
jmp    17dd <main+0x5cd>
lea    0x823(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
call   10c0 <getchar@plt>
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"LongLife by compucat (c) August 2015\0A\00"
@.str.1 = [86 x i8] c"Fatal error: not enough memory for new chunks. LongLife aborted.\0APress Enter to exit.\00"
@.str.2 = [84 x i8] c"Fatal error: not enough memory for new sets. LongLife aborted.\0APress Enter to exit.\00"
@rand = global i32 0
@RAND_MAX = global i32 0
@.str.3 = [19 x i8] c"LongLifeOutput.txt\00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [29 x i8] c"Done! Writing file output...\00"
@.str.6 = [138 x i8] c"***LongLife by compucat (c) August 2015 output***\0A\0AAttempted to find %dx%d patterns\0A\0ADue to algorithm limitations, found %dx%d patterns\0A\0A\00"
@.str.7 = [19 x i8] c"***Pattern %d***\0A\0A\00"
@.str.8 = [2 x i8] c"*\00"
@.str.9 = [2 x i8] c" \00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [28 x i8] c"***End LongLife output***\0A\0A\00"
@.str.12 = [29 x i8] c"Done! Press Enter to exit...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [160000 x [2 x i64]]
%9 = alloca i32*
store i32 0, i32* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 5, i32* %5
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = mul i64 80, %12
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = mul i64 %13, %15
%17 = trunc i64 %16 to i32
%18 = call i32* @malloc(i32 %17)
store i32* %18, i32** %7
%19 = load i32*, i32** %7
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %25
21: ; preds = %0
%22 = call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 (...) @getchar()
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %0
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = mul i64 640000, %27
%29 = mul i64 %28, 2
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = mul i64 %29, %31
%33 = mul i64 %32, 2
%34 = trunc i64 %33 to i32
%35 = call i32* @malloc(i32 %34)
store i32* %35, i32** %6
%36 = load i32*, i32** %6
%37 = icmp eq i32* %36, null
br i1 %37, label %38, label %42
38: ; preds = %25
%39 = call i32 @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.2, i64 0, i64 0))
%40 = call i32 (...) @getchar()
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %25
%43 = call i32 @time(i32* null)
%44 = call i32 @srand(i32 %43)
store i32 0, i32* %2
br label %45
45: ; preds = %88, %42
%46 = load i32, i32* %2
%47 = icmp slt i32 %46, 20
br i1 %47, label %48, label %91
48: ; preds = %45
store i32 0, i32* %3
br label %49
49: ; preds = %84, %48
%50 = load i32, i32* %3
%51 = load i32, i32* %5
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %87
53: ; preds = %49
store i32 0, i32* %4
br label %54
54: ; preds = %80, %53
%55 = load i32, i32* %4
%56 = load i32, i32* %5
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %83
58: ; preds = %54
%59 = load i32, i32* @rand
%60 = load i32, i32* @RAND_MAX
%61 = sdiv i32 %60, 2
%62 = icmp sgt i32 %59, %61
%63 = zext i1 %62 to i32
%64 = load i32*, i32** %7
%65 = load i32, i32* %5
%66 = load i32, i32* %5
%67 = mul nsw i32 %65, %66
%68 = mul nsw i32 %67, 4
%69 = load i32, i32* %2
%70 = mul nsw i32 %68, %69
%71 = load i32, i32* %5
%72 = mul nsw i32 %71, 2
%73 = load i32, i32* %3
%74 = mul nsw i32 %72, %73
%75 = add nsw i32 %70, %74
%76 = load i32, i32* %4
%77 = add nsw i32 %75, %76
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i32, i32* %64, i64 %78
store i32 %63, i32* %79
br label %80
80: ; preds = %58
%81 = load i32, i32* %4
%82 = add nsw i32 %81, 1
store i32 %82, i32* %4
br label %54
83: ; preds = %54
br label %84
84: ; preds = %83
%85 = load i32, i32* %3
%86 = add nsw i32 %85, 1
store i32 %86, i32* %3
br label %49
87: ; preds = %49
br label %88
88: ; preds = %87
%89 = load i32, i32* %2
%90 = add nsw i32 %89, 1
store i32 %90, i32* %2
br label %45
91: ; preds = %45
br label %92
92: ; preds = %284, %91
%93 = load i32, i32* %5
%94 = icmp slt i32 %93, 20
br i1 %94, label %95, label %285
95: ; preds = %92
%96 = load i32*, i32** %6
%97 = load i32*, i32** %7
%98 = load i32, i32* %5
%99 = call i32 @generateSets(i32* %96, i32* %97, i32 %98)
store i32 0, i32* %2
br label %100
100: ; preds = %110, %95
%101 = load i32, i32* %2
%102 = icmp slt i32 %101, 160000
br i1 %102, label %103, label %113
103: ; preds = %100
%104 = load i32, i32* %2
%105 = sext i32 %104 to i64
%106 = load i32, i32* %2
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [160000 x [2 x i64]], [160000 x [2 x i64]]* %8, i64 0, i64 %107
%109 = getelementptr inbounds [2 x i64], [2 x i64]* %108, i64 0, i64 1
store i64 %105, i64* %109
br label %110
110: ; preds = %103
%111 = load i32, i32* %2
%112 = add nsw i32 %111, 1
store i32 %112, i32* %2
br label %100
113: ; preds = %100
store i32 0, i32* %2
br label %114
114: ; preds = %128, %113
%115 = load i32, i32* %2
%116 = icmp slt i32 %115, 160000
br i1 %116, label %117, label %131
117: ; preds = %114
%118 = load i32, i32* %5
%119 = mul nsw i32 %118, 2
%120 = load i32*, i32** %6
%121 = load i32, i32* %2
%122 = load i32, i32* %5
%123 = call i64 @simStableLife(i32 %119, i32* %120, i32 %121, i32 %122)
%124 = load i32, i32* %2
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds [160000 x [2 x i64]], [160000 x [2 x i64]]* %8, i64 0, i64 %125
%127 = getelementptr inbounds [2 x i64], [2 x i64]* %126, i64 0, i64 0
store i64 %123, i64* %127
br label %128
128: ; preds = %117
%129 = load i32, i32* %2
%130 = add nsw i32 %129, 1
store i32 %130, i32* %2
br label %114
131: ; preds = %114
%132 = getelementptr inbounds [160000 x [2 x i64]], [160000 x [2 x i64]]* %8, i64 0, i64 0
%133 = bitcast [2 x i64]* %132 to i64**
%134 = call i32 @sortSetLives(i64** %133)
%135 = load i32*, i32** %7
%136 = call i32 @free(i32* %135)
%137 = load i32, i32* %5
%138 = mul nsw i32 %137, 2
store i32 %138, i32* %5
%139 = load i32, i32* %5
%140 = sext i32 %139 to i64
%141 = mul i64 80, %140
%142 = load i32, i32* %5
%143 = sext i32 %142 to i64
%144 = mul i64 %141, %143
%145 = trunc i64 %144 to i32
%146 = call i32* @malloc(i32 %145)
store i32* %146, i32** %7
%147 = load i32*, i32** %7
%148 = icmp eq i32* %147, null
br i1 %148, label %149, label %153
149: ; preds = %131
%150 = call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.1, i64 0, i64 0))
%151 = call i32 (...) @getchar()
%152 = call i32 @exit(i32 1)
unreachable
153: ; preds = %131
store i32 0, i32* %2
br label %154
154: ; preds = %215, %153
%155 = load i32, i32* %2
%156 = icmp slt i32 %155, 10
br i1 %156, label %157, label %218
157: ; preds = %154
store i32 0, i32* %3
br label %158
158: ; preds = %211, %157
%159 = load i32, i32* %3
%160 = load i32, i32* %5
%161 = icmp slt i32 %159, %160
br i1 %161, label %162, label %214
162: ; preds = %158
store i32 0, i32* %4
br label %163
163: ; preds = %207, %162
%164 = load i32, i32* %4
%165 = load i32, i32* %5
%166 = icmp slt i32 %164, %165
br i1 %166, label %167, label %210
167: ; preds = %163
%168 = load i32*, i32** %6
%169 = load i32, i32* %5
%170 = load i32, i32* %5
%171 = mul nsw i32 %169, %170
%172 = mul nsw i32 %171, 4
%173 = sext i32 %172 to i64
%174 = load i32, i32* %2
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds [160000 x [2 x i64]], [160000 x [2 x i64]]* %8, i64 0, i64 %175
%177 = getelementptr inbounds [2 x i64], [2 x i64]* %176, i64 0, i64 1
%178 = load i64, i64* %177
%179 = mul nsw i64 %173, %178
%180 = load i32, i32* %5
%181 = mul nsw i32 %180, 2
%182 = load i32, i32* %3
%183 = mul nsw i32 %181, %182
%184 = sext i32 %183 to i64
%185 = add nsw i64 %179, %184
%186 = load i32, i32* %4
%187 = sext i32 %186 to i64
%188 = add nsw i64 %185, %187
%189 = getelementptr inbounds i32, i32* %168, i64 %188
%190 = load i32, i32* %189
%191 = load i32*, i32** %7
%192 = load i32, i32* %5
%193 = load i32, i32* %5
%194 = mul nsw i32 %192, %193
%195 = mul nsw i32 %194, 4
%196 = load i32, i32* %2
%197 = mul nsw i32 %195, %196
%198 = load i32, i32* %5
%199 = mul nsw i32 %198, 2
%200 = load i32, i32* %3
%201 = mul nsw i32 %199, %200
%202 = add nsw i32 %197, %201
%203 = load i32, i32* %4
%204 = add nsw i32 %202, %203
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds i32, i32* %191, i64 %205
store i32 %190, i32* %206
br label %207
207: ; preds = %167
%208 = load i32, i32* %4
%209 = add nsw i32 %208, 1
store i32 %209, i32* %4
br label %163
210: ; preds = %163
br label %211
211: ; preds = %210
%212 = load i32, i32* %3
%213 = add nsw i32 %212, 1
store i32 %213, i32* %3
br label %158
214: ; preds = %158
br label %215
215: ; preds = %214
%216 = load i32, i32* %2
%217 = add nsw i32 %216, 1
store i32 %217, i32* %2
br label %154
218: ; preds = %154
store i32 10, i32* %2
br label %219
219: ; preds = %262, %218
%220 = load i32, i32* %2
%221 = icmp slt i32 %220, 20
br i1 %221, label %222, label %265
222: ; preds = %219
store i32 0, i32* %3
br label %223
223: ; preds = %258, %222
%224 = load i32, i32* %3
%225 = load i32, i32* %5
%226 = icmp slt i32 %224, %225
br i1 %226, label %227, label %261
227: ; preds = %223
store i32 0, i32* %4
br label %228
228: ; preds = %254, %227
%229 = load i32, i32* %4
%230 = load i32, i32* %5
%231 = icmp slt i32 %229, %230
br i1 %231, label %232, label %257
232: ; preds = %228
%233 = load i32, i32* @rand
%234 = load i32, i32* @RAND_MAX
%235 = sdiv i32 %234, 2
%236 = icmp sgt i32 %233, %235
%237 = zext i1 %236 to i32
%238 = load i32*, i32** %7
%239 = load i32, i32* %5
%240 = load i32, i32* %5
%241 = mul nsw i32 %239, %240
%242 = mul nsw i32 %241, 4
%243 = load i32, i32* %2
%244 = mul nsw i32 %242, %243
%245 = load i32, i32* %5
%246 = mul nsw i32 %245, 2
%247 = load i32, i32* %3
%248 = mul nsw i32 %246, %247
%249 = add nsw i32 %244, %248
%250 = load i32, i32* %4
%251 = add nsw i32 %249, %250
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds i32, i32* %238, i64 %252
store i32 %237, i32* %253
br label %254
254: ; preds = %232
%255 = load i32, i32* %4
%256 = add nsw i32 %255, 1
store i32 %256, i32* %4
br label %228
257: ; preds = %228
br label %258
258: ; preds = %257
%259 = load i32, i32* %3
%260 = add nsw i32 %259, 1
store i32 %260, i32* %3
br label %223
261: ; preds = %223
br label %262
262: ; preds = %261
%263 = load i32, i32* %2
%264 = add nsw i32 %263, 1
store i32 %264, i32* %2
br label %219
265: ; preds = %219
%266 = load i32*, i32** %6
%267 = call i32 @free(i32* %266)
%268 = load i32, i32* %5
%269 = sext i32 %268 to i64
%270 = mul i64 640000, %269
%271 = mul i64 %270, 2
%272 = load i32, i32* %5
%273 = sext i32 %272 to i64
%274 = mul i64 %271, %273
%275 = mul i64 %274, 2
%276 = trunc i64 %275 to i32
%277 = call i32* @malloc(i32 %276)
store i32* %277, i32** %6
%278 = load i32*, i32** %6
%279 = icmp eq i32* %278, null
br i1 %279, label %280, label %284
280: ; preds = %265
%281 = call i32 @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.2, i64 0, i64 0))
%282 = call i32 (...) @getchar()
%283 = call i32 @exit(i32 1)
unreachable
284: ; preds = %265
br label %92
285: ; preds = %92
%286 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 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* %286, i32** %9
%287 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%288 = load i32*, i32** %9
%289 = load i32, i32* %5
%290 = load i32, i32* %5
%291 = call i32 (i32*, i8*, ...) @fprintf(i32* %288, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.6, i64 0, i64 0), i32 20, i32 20, i32 %289, i32 %290)
store i32 0, i32* %2
br label %292
292: ; preds = %347, %285
%293 = load i32, i32* %2
%294 = icmp slt i32 %293, 10
br i1 %294, label %295, label %350
295: ; preds = %292
%296 = load i32*, i32** %9
%297 = load i32, i32* %2
%298 = add nsw i32 %297, 1
%299 = call i32 (i32*, i8*, ...) @fprintf(i32* %296, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %298)
store i32 0, i32* %3
br label %300
300: ; preds = %341, %295
%301 = load i32, i32* %3
%302 = load i32, i32* %5
%303 = icmp slt i32 %301, %302
br i1 %303, label %304, label %344
304: ; preds = %300
store i32 0, i32* %4
br label %305
305: ; preds = %335, %304
%306 = load i32, i32* %4
%307 = load i32, i32* %5
%308 = icmp slt i32 %306, %307
br i1 %308, label %309, label %338
309: ; preds = %305
%310 = load i32*, i32** %7
%311 = load i32, i32* %5
%312 = load i32, i32* %5
%313 = mul nsw i32 %311, %312
%314 = mul nsw i32 %313, 4
%315 = load i32, i32* %2
%316 = mul nsw i32 %314, %315
%317 = load i32, i32* %5
%318 = mul nsw i32 %317, 2
%319 = load i32, i32* %3
%320 = mul nsw i32 %318, %319
%321 = add nsw i32 %316, %320
%322 = load i32, i32* %4
%323 = add nsw i32 %321, %322
%324 = sext i32 %323 to i64
%325 = getelementptr inbounds i32, i32* %310, i64 %324
%326 = load i32, i32* %325
%327 = icmp eq i32 %326, 1
br i1 %327, label %328, label %331
328: ; preds = %309
%329 = load i32*, i32** %9
%330 = call i32 (i32*, i8*, ...) @fprintf(i32* %329, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %334
331: ; preds = %309
%332 = load i32*, i32** %9
%333 = call i32 (i32*, i8*, ...) @fprintf(i32* %332, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %334
334: ; preds = %331, %328
br label %335
335: ; preds = %334
%336 = load i32, i32* %4
%337 = add nsw i32 %336, 1
store i32 %337, i32* %4
br label %305
338: ; preds = %305
%339 = load i32*, i32** %9
%340 = call i32 (i32*, i8*, ...) @fprintf(i32* %339, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %341
341: ; preds = %338
%342 = load i32, i32* %3
%343 = add nsw i32 %342, 1
store i32 %343, i32* %3
br label %300
344: ; preds = %300
%345 = load i32*, i32** %9
%346 = call i32 (i32*, i8*, ...) @fprintf(i32* %345, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %347
347: ; preds = %344
%348 = load i32, i32* %2
%349 = add nsw i32 %348, 1
store i32 %349, i32* %2
br label %292
350: ; preds = %292
%351 = load i32*, i32** %9
%352 = call i32 (i32*, i8*, ...) @fprintf(i32* %351, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0))
%353 = load i32*, i32** %9
%354 = call i32 @fclose(i32* %353)
%355 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0))
%356 = call i32 (...) @getchar()
%357 = load i32, i32* %1
ret i32 %357
}

LLVM IR (-O2):
@.str.1 = [86 x i8] c"Fatal error: not enough memory for new chunks. LongLife aborted.\0APress Enter to exit.\00"
@.str.2 = [84 x i8] c"Fatal error: not enough memory for new sets. LongLife aborted.\0APress Enter to exit.\00"
@rand = global i32 0
@RAND_MAX = global i32 0
@.str.3 = [19 x i8] c"LongLifeOutput.txt\00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [29 x i8] c"Done! Writing file output...\00"
@.str.6 = [138 x i8] c"***LongLife by compucat (c) August 2015 output***\0A\0AAttempted to find %dx%d patterns\0A\0ADue to algorithm limitations, found %dx%d patterns\0A\0A\00"
@.str.7 = [19 x i8] c"***Pattern %d***\0A\0A\00"
@.str.11 = [28 x i8] c"***End LongLife output***\0A\0A\00"
@.str.12 = [29 x i8] c"Done! Press Enter to exit...\00"
@str = [37 x i8] c"LongLife by compucat (c) August 2015\00"
define i32 @main() {
%1 = alloca [160000 x [2 x i64]]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%3 = bitcast [160000 x [2 x i64]]* %1 to i8*
%4 = tail call i32* @malloc(i32 2000)
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (...) @getchar()
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = tail call i32* @malloc(i32 64000000)
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 (...) @getchar()
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %10
%18 = tail call i32 @time(i32* null)
%19 = tail call i32 @srand(i32 %18)
%20 = load i32, i32* @rand
%21 = load i32, i32* @RAND_MAX
%22 = sdiv i32 %21, 2
%23 = icmp sgt i32 %20, %22
%24 = zext i1 %23 to i32
%25 = insertelement <4 x i32> poison, i32 %24, i64 0
%26 = shufflevector <4 x i32> %25, <4 x i32> poison, <4 x i32> zeroinitializer
%27 = insertelement <4 x i32> poison, i32 %24, i64 0
%28 = shufflevector <4 x i32> %27, <4 x i32> poison, <4 x i32> zeroinitializer
%29 = insertelement <4 x i32> poison, i32 %24, i64 0
%30 = shufflevector <4 x i32> %29, <4 x i32> poison, <4 x i32> zeroinitializer
%31 = insertelement <4 x i32> poison, i32 %24, i64 0
%32 = shufflevector <4 x i32> %31, <4 x i32> poison, <4 x i32> zeroinitializer
%33 = insertelement <4 x i32> poison, i32 %24, i64 0
%34 = shufflevector <4 x i32> %33, <4 x i32> poison, <4 x i32> zeroinitializer
br label %35
35: ; preds = %17, %35
%36 = phi i64 [ 0, %17 ], [ %62, %35 ]
%37 = mul nuw nsw i64 %36, 100
%38 = getelementptr inbounds i32, i32* %4, i64 %37
%39 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> %26, <4 x i32>* %39
%40 = add nuw nsw i64 %37, 4
%41 = getelementptr inbounds i32, i32* %4, i64 %40
store i32 %24, i32* %41
%42 = add nuw nsw i64 %37, 10
%43 = getelementptr inbounds i32, i32* %4, i64 %42
%44 = bitcast i32* %43 to <4 x i32>*
store <4 x i32> %28, <4 x i32>* %44
%45 = add nuw nsw i64 %37, 14
%46 = getelementptr inbounds i32, i32* %4, i64 %45
store i32 %24, i32* %46
%47 = add nuw nsw i64 %37, 20
%48 = getelementptr inbounds i32, i32* %4, i64 %47
%49 = bitcast i32* %48 to <4 x i32>*
store <4 x i32> %30, <4 x i32>* %49
%50 = add nuw nsw i64 %37, 24
%51 = getelementptr inbounds i32, i32* %4, i64 %50
store i32 %24, i32* %51
%52 = add nuw nsw i64 %37, 30
%53 = getelementptr inbounds i32, i32* %4, i64 %52
%54 = bitcast i32* %53 to <4 x i32>*
store <4 x i32> %32, <4 x i32>* %54
%55 = add nuw nsw i64 %37, 34
%56 = getelementptr inbounds i32, i32* %4, i64 %55
store i32 %24, i32* %56
%57 = add nuw nsw i64 %37, 40
%58 = getelementptr inbounds i32, i32* %4, i64 %57
%59 = bitcast i32* %58 to <4 x i32>*
store <4 x i32> %34, <4 x i32>* %59
%60 = add nuw nsw i64 %37, 44
%61 = getelementptr inbounds i32, i32* %4, i64 %60
store i32 %24, i32* %61
%62 = add nuw nsw i64 %36, 1
%63 = icmp eq i64 %62, 20
br i1 %63, label %64, label %35
64: ; preds = %35
%65 = bitcast [160000 x [2 x i64]]* %1 to i64**
br label %66
66: ; preds = %64, %237
%67 = phi i32 [ %74, %237 ], [ 5, %64 ]
%68 = phi i32* [ %240, %237 ], [ %11, %64 ]
%69 = phi i32* [ %100, %237 ], [ %4, %64 ]
%70 = icmp ult i32 %67, 20
br i1 %70, label %71, label %246
71: ; preds = %66
%72 = call i32 @generateSets(i32* %68, i32* %69, i32 %67)
br label %75
73: ; preds = %75
%74 = shl nsw i32 %67, 1
br label %88
75: ; preds = %75, %71
%76 = phi i64 [ 0, %71 ], [ %86, %75 ]
%77 = getelementptr inbounds [160000 x [2 x i64]], [160000 x [2 x i64]]* %1, i64 0, i64 %76, i64 1
store i64 %76, i64* %77
%78 = add nuw nsw i64 %76, 1
%79 = getelementptr inbounds [160000 x [2 x i64]], [160000 x [2 x i64]]* %1, i64 0, i64 %78, i64 1
store i64 %78, i64* %79
%80 = add nuw nsw i64 %76, 2
%81 = getelementptr inbounds [160000 x [2 x i64]], [160000 x [2 x i64]]* %1, i64 0, i64 %80, i64 1
store i64 %80, i64* %81
%82 = add nuw nsw i64 %76, 3
%83 = getelementptr inbounds [160000 x [2 x i64]], [160000 x [2 x i64]]* %1, i64 0, i64 %82, i64 1
store i64 %82, i64* %83
%84 = add nuw nsw i64 %76, 4
%85 = getelementptr inbounds [160000 x [2 x i64]], [160000 x [2 x i64]]* %1, i64 0, i64 %84, i64 1
store i64 %84, i64* %85
%86 = add nuw nsw i64 %76, 5
%87 = icmp eq i64 %86, 160000
br i1 %87, label %73, label %75
88: ; preds = %73, %88
%89 = phi i64 [ 0, %73 ], [ %93, %88 ]
%90 = trunc i64 %89 to i32
%91 = call i64 @simStableLife(i32 %74, i32* %68, i32 %90, i32 %67)
%92 = getelementptr inbounds [160000 x [2 x i64]], [160000 x [2 x i64]]* %1, i64 0, i64 %89, i64 0
store i64 %91, i64* %92
%93 = add nuw nsw i64 %89, 1
%94 = icmp eq i64 %93, 160000
br i1 %94, label %95, label %88
95: ; preds = %88
%96 = call i32 @sortSetLives(i64** %65)
%97 = call i32 @free(i32* %69)
%98 = mul i32 %74, %67
%99 = mul i32 %98, 160
%100 = call i32* @malloc(i32 %99)
%101 = icmp eq i32* %100, null
br i1 %101, label %110, label %102
102: ; preds = %95
%103 = mul i32 %74, %74
%104 = shl nsw i32 %103, 2
%105 = zext i32 %104 to i64
%106 = zext i32 %67 to i64
%107 = shl nuw nsw i64 %106, 2
%108 = shl nuw nsw i64 %106, 3
%109 = zext i32 %74 to i64
br label %135
110: ; preds = %95
%111 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str.1, i64 0, i64 0))
%112 = call i32 (...) @getchar()
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %160
%115 = load i32, i32* @rand
%116 = load i32, i32* @RAND_MAX
%117 = sdiv i32 %116, 2
%118 = icmp sgt i32 %115, %117
%119 = zext i1 %118 to i32
%120 = zext i32 %74 to i64
%121 = shl nuw nsw i64 %106, 1
%122 = and i64 %121, 8589934588
%123 = add nsw i64 %122, -4
%124 = lshr exact i64 %123, 2
%125 = add nuw nsw i64 %124, 1
%126 = icmp ult i32 %74, 4
%127 = and i64 %109, 4294967292
%128 = insertelement <4 x i32> poison, i32 %119, i64 0
%129 = shufflevector <4 x i32> %128, <4 x i32> poison, <4 x i32> zeroinitializer
%130 = and i64 %125, 7
%131 = icmp ult i64 %123, 28
%132 = and i64 %125, 9223372036854775800
%133 = icmp eq i64 %130, 0
%134 = icmp eq i64 %127, %109
br label %163
135: ; preds = %160, %102
%136 = phi i64 [ 0, %102 ], [ %161, %160 ]
%137 = mul nuw nsw i64 %136, %105
%138 = getelementptr inbounds [160000 x [2 x i64]], [160000 x [2 x i64]]* %1, i64 0, i64 %136, i64 1
%139 = load i64, i64* %138
%140 = mul nsw i64 %139, %105
br label %141
141: ; preds = %141, %135
%142 = phi i64 [ 0, %135 ], [ %158, %141 ]
%143 = mul nuw nsw i64 %107, %142
%144 = add nuw nsw i64 %137, %143
%145 = getelementptr i32, i32* %100, i64 %144
%146 = bitcast i32* %145 to i8*
%147 = add i64 %143, %140
%148 = getelementptr i32, i32* %68, i64 %147
%149 = bitcast i32* %148 to i8*
%150 = or i64 %142, 1
%151 = mul nuw nsw i64 %107, %150
%152 = add nuw nsw i64 %137, %151
%153 = getelementptr i32, i32* %100, i64 %152
%154 = bitcast i32* %153 to i8*
%155 = add i64 %151, %140
%156 = getelementptr i32, i32* %68, i64 %155
%157 = bitcast i32* %156 to i8*
%158 = add nuw nsw i64 %142, 2
%159 = icmp eq i64 %158, %109
br i1 %159, label %160, label %141
160: ; preds = %141
%161 = add nuw nsw i64 %136, 1
%162 = icmp eq i64 %161, 10
br i1 %162, label %114, label %135
163: ; preds = %234, %114
%164 = phi i32 [ 10, %114 ], [ %235, %234 ]
%165 = mul i32 %103, %164
br label %166
166: ; preds = %231, %163
%167 = phi i64 [ 0, %163 ], [ %232, %231 ]
%168 = trunc i64 %167 to i32
%169 = mul nuw nsw i32 %67, %168
%170 = add nuw nsw i32 %169, %165
%171 = shl i32 %170, 2
%172 = sext i32 %171 to i64
br i1 %126, label %223, label %173
173: ; preds = %166
br i1 %131, label %211, label %174
174: ; preds = %173, %174
%175 = phi i64 [ %208, %174 ], [ 0, %173 ]
%176 = phi i64 [ %209, %174 ], [ 0, %173 ]
%177 = add nuw nsw i64 %175, %172
%178 = getelementptr inbounds i32, i32* %100, i64 %177
%179 = bitcast i32* %178 to <4 x i32>*
store <4 x i32> %129, <4 x i32>* %179
%180 = or i64 %175, 4
%181 = add nuw nsw i64 %180, %172
%182 = getelementptr inbounds i32, i32* %100, i64 %181
%183 = bitcast i32* %182 to <4 x i32>*
store <4 x i32> %129, <4 x i32>* %183
%184 = or i64 %175, 8
%185 = add nuw nsw i64 %184, %172
%186 = getelementptr inbounds i32, i32* %100, i64 %185
%187 = bitcast i32* %186 to <4 x i32>*
store <4 x i32> %129, <4 x i32>* %187
%188 = or i64 %175, 12
%189 = add nuw nsw i64 %188, %172
%190 = getelementptr inbounds i32, i32* %100, i64 %189
%191 = bitcast i32* %190 to <4 x i32>*
store <4 x i32> %129, <4 x i32>* %191
%192 = or i64 %175, 16
%193 = add nuw nsw i64 %192, %172
%194 = getelementptr inbounds i32, i32* %100, i64 %193
%195 = bitcast i32* %194 to <4 x i32>*
store <4 x i32> %129, <4 x i32>* %195
%196 = or i64 %175, 20
%197 = add nuw nsw i64 %196, %172
%198 = getelementptr inbounds i32, i32* %100, i64 %197
%199 = bitcast i32* %198 to <4 x i32>*
store <4 x i32> %129, <4 x i32>* %199
%200 = or i64 %175, 24
%201 = add nuw nsw i64 %200, %172
%202 = getelementptr inbounds i32, i32* %100, i64 %201
%203 = bitcast i32* %202 to <4 x i32>*
store <4 x i32> %129, <4 x i32>* %203
%204 = or i64 %175, 28
%205 = add nuw nsw i64 %204, %172
%206 = getelementptr inbounds i32, i32* %100, i64 %205
%207 = bitcast i32* %206 to <4 x i32>*
store <4 x i32> %129, <4 x i32>* %207
%208 = add nuw i64 %175, 32
%209 = add i64 %176, 8
%210 = icmp eq i64 %209, %132
br i1 %210, label %211, label %174
211: ; preds = %174, %173
%212 = phi i64 [ 0, %173 ], [ %208, %174 ]
br i1 %133, label %222, label %213
213: ; preds = %211, %213
%214 = phi i64 [ %219, %213 ], [ %212, %211 ]
%215 = phi i64 [ %220, %213 ], [ 0, %211 ]
%216 = add nuw nsw i64 %214, %172
%217 = getelementptr inbounds i32, i32* %100, i64 %216
%218 = bitcast i32* %217 to <4 x i32>*
store <4 x i32> %129, <4 x i32>* %218
%219 = add nuw i64 %214, 4
%220 = add i64 %215, 1
%221 = icmp eq i64 %220, %130
br i1 %221, label %222, label %213
222: ; preds = %213, %211
br i1 %134, label %231, label %223
223: ; preds = %166, %222
%224 = phi i64 [ 0, %166 ], [ %127, %222 ]
br label %225
225: ; preds = %223, %225
%226 = phi i64 [ %229, %225 ], [ %224, %223 ]
%227 = add nuw nsw i64 %226, %172
%228 = getelementptr inbounds i32, i32* %100, i64 %227
store i32 %119, i32* %228
%229 = add nuw nsw i64 %226, 1
%230 = icmp eq i64 %229, %120
br i1 %230, label %231, label %225
231: ; preds = %225, %222
%232 = add nuw nsw i64 %167, 1
%233 = icmp eq i64 %232, %120
br i1 %233, label %234, label %166
234: ; preds = %231
%235 = add nuw nsw i32 %164, 1
%236 = icmp eq i32 %235, 20
br i1 %236, label %237, label %163
237: ; preds = %234
%238 = call i32 @free(i32* %68)
%239 = mul i32 %98, 5120000
%240 = call i32* @malloc(i32 %239)
%241 = icmp eq i32* %240, null
br i1 %241, label %242, label %66
242: ; preds = %237
%243 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @.str.2, i64 0, i64 0))
%244 = call i32 (...) @getchar()
%245 = call i32 @exit(i32 1)
unreachable
246: ; preds = %66
%247 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%248 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%249 = call i32 (i32*, i8*, ...) @fprintf(i32* %247, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.6, i64 0, i64 0), i32 20, i32 20, i32 %67, i32 %67)
%250 = shl i32 %67, 2
%251 = zext i32 %67 to i64
br label %252
252: ; preds = %246, %278
%253 = phi i32 [ 0, %246 ], [ %254, %278 ]
%254 = add nuw nsw i32 %253, 1
%255 = call i32 (i32*, i8*, ...) @fprintf(i32* %247, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %254)
%256 = mul nuw nsw i32 %250, %253
br label %257
257: ; preds = %252, %274
%258 = phi i64 [ 0, %252 ], [ %276, %274 ]
%259 = trunc i64 %258 to i32
%260 = shl nuw i32 %259, 1
%261 = add nuw nsw i32 %260, %256
%262 = mul i32 %261, %67
%263 = zext i32 %262 to i64
br label %264
264: ; preds = %257, %264
%265 = phi i64 [ 0, %257 ], [ %272, %264 ]
%266 = add nuw nsw i64 %265, %263
%267 = getelementptr inbounds i32, i32* %69, i64 %266
%268 = load i32, i32* %267
%269 = icmp eq i32 %268, 1
%270 = select i1 %269, i32 42, i32 32
%271 = call i32 @fputc(i32 %270, i32* %247)
%272 = add nuw nsw i64 %265, 1
%273 = icmp eq i64 %272, %251
br i1 %273, label %274, label %264
274: ; preds = %264
%275 = call i32 @fputc(i32 10, i32* %247)
%276 = add nuw nsw i64 %258, 1
%277 = icmp eq i64 %276, %251
br i1 %277, label %278, label %257
278: ; preds = %274
%279 = call i32 @fputc(i32 10, i32* %247)
%280 = icmp eq i32 %254, 10
br i1 %280, label %281, label %252
281: ; preds = %278
%282 = call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i64 27, i64 1, i32* %247)
%283 = call i32 @fclose(i32* %247)
%284 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0))
%285 = call i32 (...) @getchar()
ret i32 0
}