#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void cmxx_elim(int *nbod, int *nbig, double *m, double **x, double **v,
               double **s, double *rho, double *rceh, double **ngf,
               double *stat, char **id, char mem[200], int lmem[200],
               FILE *outfile) {
  int elim[2000] = {0};
  int nelim = 0;
  int nbigelim = 0;
  for (int j = 1; j < *nbod; j++) {
    if (stat[j] < 0) {
      elim[nelim] = j;
      nelim++;
      if (j <= *nbig) {
        nbigelim++;
      }
    }
  }
  elim[nelim] = *nbod + 1;
  for (int k = 0; k < nelim; k++) {
    for (int j = elim[k] - k; j < elim[k + 1] - k; j++) {
      const int l = j + k;
      x[j][0] = x[l][0];
      x[j][1] = x[l][1];
      x[j][2] = x[l][2];
      v[j][0] = v[l][0];
      v[j][1] = v[l][1];
      v[j][2] = v[l][2];
      m[j] = m[l];
      s[j][0] = s[l][0];
      s[j][1] = s[l][1];
      s[j][2] = s[l][2];
      rho[j] = rho[l];
      rceh[j] = rceh[l];
      stat[j] = stat[l];
      strncpy(id[j], id[l], sizeof(char) * 8);
      ngf[j][0] = ngf[l][0];
      ngf[j][1] = ngf[l][1];
      ngf[j][2] = ngf[l][2];
      ngf[j][3] = ngf[l][3];
    }
  }
  *nbod -= nelim;
  *nbig -= nbigelim;
  if (*nbig < 1) {
    puts("Simulation concluded - no massive bodies remain.\n");
    fclose(outfile);
    exit(EXIT_SUCCESS);
  }
}


x86 assembly (clang, -O0):
<cmxx_elim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f90,%rsp
mov    0x48(%rbp),%rax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    -0x1f70(%rbp),%rdi
xor    %esi,%esi
mov    $0x1f40,%edx
call   1060 <memset@plt>
movl   $0x0,-0x1f74(%rbp)
movl   $0x0,-0x1f78(%rbp)
movl   $0x1,-0x1f7c(%rbp)
mov    -0x1f7c(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    1251 <cmxx_elim+0x101>
mov    0x28(%rbp),%rax
movslq -0x1f7c(%rbp),%rcx
xorps  %xmm0,%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    1238 <cmxx_elim+0xe8>
mov    -0x1f7c(%rbp),%ecx
movslq -0x1f74(%rbp),%rax
mov    %ecx,-0x1f70(%rbp,%rax,4)
mov    -0x1f74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f74(%rbp)
mov    -0x1f7c(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jg     1233 <cmxx_elim+0xe3>
mov    -0x1f78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f78(%rbp)
jmp    1238 <cmxx_elim+0xe8>
jmp    123d <cmxx_elim+0xed>
mov    -0x1f7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f7c(%rbp)
jmp    11c4 <cmxx_elim+0x74>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
movslq -0x1f74(%rbp),%rax
mov    %ecx,-0x1f70(%rbp,%rax,4)
movl   $0x0,-0x1f80(%rbp)
mov    -0x1f80(%rbp),%eax
cmp    -0x1f74(%rbp),%eax
jge    15ac <cmxx_elim+0x45c>
movslq -0x1f80(%rbp),%rax
mov    -0x1f70(%rbp,%rax,4),%eax
sub    -0x1f80(%rbp),%eax
mov    %eax,-0x1f84(%rbp)
mov    -0x1f84(%rbp),%eax
mov    -0x1f80(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    -0x1f70(%rbp,%rcx,4),%ecx
sub    -0x1f80(%rbp),%ecx
cmp    %ecx,%eax
jge    1593 <cmxx_elim+0x443>
mov    -0x1f84(%rbp),%eax
add    -0x1f80(%rbp),%eax
mov    %eax,-0x1f88(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x28(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x8(%rax),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x28(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x10(%rax),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x30(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x10(%rax),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,0x10(%rax)
mov    0x10(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x18(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x18(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x28(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x28(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x30(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x30(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
mov    0x20(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  (%rax),%xmm0
mov    0x20(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,(%rax)
mov    0x20(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x8(%rax),%xmm0
mov    0x20(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,0x8(%rax)
mov    0x20(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x10(%rax),%xmm0
mov    0x20(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,0x10(%rax)
mov    0x20(%rbp),%rax
movslq -0x1f88(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x18(%rax),%xmm0
mov    0x20(%rbp),%rax
movslq -0x1f84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x1f84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f84(%rbp)
jmp    129e <cmxx_elim+0x14e>
jmp    1598 <cmxx_elim+0x448>
mov    -0x1f80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f80(%rbp)
jmp    1272 <cmxx_elim+0x122>
mov    -0x1f74(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
mov    -0x1f78(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x1,(%rax)
jge    15fc <cmxx_elim+0x4ac>
lea    0xa20(%rip),%rdi
call   1040 <puts@plt>
mov    0x48(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x29eb(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
add    $0x1f90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmxx_elim>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1ff8,%rsp
mov    %r9,%r15
mov    %r8,%rbp
mov    %rcx,0x30(%rsp)
mov    %rdx,0x18(%rsp)
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xb0(%rsp),%rdi
xor    %ebx,%ebx
mov    $0x1f40,%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    (%r14),%r9d
cmp    $0x2,%r9d
jl     149b <cmxx_elim+0x34b>
mov    %rbp,0x28(%rsp)
mov    0x2048(%rsp),%rbp
lea    -0x1(%r9),%r8
cmp    $0x2,%r9d
jne    14d7 <cmxx_elim+0x387>
xor    %ebx,%ebx
mov    $0x1,%ecx
xor    %edx,%edx
mov    0x18(%rsp),%r13
test   $0x1,%r8b
je     11f1 <cmxx_elim+0xa1>
xorpd  %xmm0,%xmm0
ucomisd 0x0(%rbp,%rcx,8),%xmm0
jbe    11f1 <cmxx_elim+0xa1>
movslq %ebx,%rbx
mov    %ecx,0xb0(%rsp,%rbx,4)
add    $0x1,%ebx
movslq (%r12),%rax
xor    %edi,%edi
cmp    %rax,%rcx
setle  %dil
add    %edi,%edx
lea    0x1(%r9),%ecx
movslq %ebx,%rax
mov    %ecx,0xb0(%rsp,%rax,4)
test   %eax,%eax
jle    14b5 <cmxx_elim+0x365>
mov    %edx,0x24(%rsp)
mov    %r14,0x60(%rsp)
mov    %r12,0x68(%rsp)
mov    0x2050(%rsp),%r14
mov    0x2040(%rsp),%r8
mov    0x2038(%rsp),%r9
mov    %r15,%rcx
mov    0x2030(%rsp),%r15
mov    %rbx,0x58(%rsp)
mov    %ebx,%eax
mov    %rax,0x70(%rsp)
mov    0xb0(%rsp),%eax
mov    %rax,0x10(%rsp)
mov    %r8,%r11
mov    %r14,%r10
mov    %rbp,%rdi
mov    %r9,%rsi
mov    %r15,%rdx
mov    %rcx,0x80(%rsp)
mov    %rcx,%rax
mov    %r13,%rcx
mov    0x28(%rsp),%rbx
mov    %rbx,0x38(%rsp)
xor    %ebx,%ebx
mov    0x30(%rsp),%r12
mov    %r12,0x40(%rsp)
movl   $0x0,0xc(%rsp)
jmp    12d7 <cmxx_elim+0x187>
nopl   (%rax)
addl   $0xffffffff,0xc(%rsp)
addq   $0x8,0x40(%rsp)
addq   $0x8,0x38(%rsp)
mov    0x50(%rsp),%rcx
add    $0x8,%rcx
mov    0x48(%rsp),%rax
add    $0x8,%rax
add    $0x8,%rdx
add    $0x8,%rsi
add    $0x8,%rdi
add    $0x8,%r10
add    $0x8,%r11
mov    0x78(%rsp),%rbx
cmp    0x70(%rsp),%rbx
je     149f <cmxx_elim+0x34f>
mov    %rax,0x48(%rsp)
mov    %rcx,0x50(%rsp)
mov    %rbx,%rcx
mov    0x10(%rsp),%rax
add    $0x1,%rbx
mov    %rbx,0x78(%rsp)
movslq 0xb4(%rsp,%rcx,4),%rbx
mov    %rbx,0x10(%rsp)
cmp    %ebx,%eax
jge    1290 <cmxx_elim+0x140>
mov    0x10(%rsp),%rbx
sub    %rcx,%rbx
mov    %rbx,0x88(%rsp)
add    0xc(%rsp),%eax
movslq %eax,%rbx
mov    %r10,0xa8(%rsp)
mov    %rdi,0xa0(%rsp)
mov    %rsi,0x98(%rsp)
mov    %rdx,0x90(%rsp)
nopw   0x0(%rax,%rax,1)
mov    0x40(%rsp),%rax
mov    (%rax,%rbx,8),%rax
movsd  (%rax),%xmm0
mov    (%r12,%rbx,8),%rcx
movsd  %xmm0,(%rcx)
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rcx)
movsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rcx)
mov    0x38(%rsp),%rax
mov    (%rax,%rbx,8),%rax
movsd  (%rax),%xmm0
mov    0x28(%rsp),%rcx
mov    (%rcx,%rbx,8),%rcx
movsd  %xmm0,(%rcx)
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rcx)
movsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rcx)
mov    0x50(%rsp),%rax
movsd  (%rax,%rbx,8),%xmm0
movsd  %xmm0,0x0(%r13,%rbx,8)
mov    0x48(%rsp),%rax
mov    (%rax,%rbx,8),%rax
movsd  (%rax),%xmm0
mov    0x80(%rsp),%rcx
mov    (%rcx,%rbx,8),%rcx
movsd  %xmm0,(%rcx)
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rcx)
movsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rcx)
movsd  (%rdx,%rbx,8),%xmm0
movsd  %xmm0,(%r15,%rbx,8)
movsd  (%rsi,%rbx,8),%xmm0
movsd  %xmm0,(%r9,%rbx,8)
movsd  (%rdi,%rbx,8),%xmm0
movsd  %xmm0,0x0(%rbp,%rbx,8)
mov    %r14,%r13
mov    (%r14,%rbx,8),%rdi
mov    (%r10,%rbx,8),%rsi
mov    $0x8,%edx
mov    %r8,%r12
mov    %r9,%r14
mov    %r11,%r15
call   1030 <strncpy@plt>
mov    0xa8(%rsp),%r10
mov    %r15,%r11
mov    0x2030(%rsp),%r15
mov    %r14,%r9
mov    0xa0(%rsp),%rdi
mov    %r12,%r8
mov    0x90(%rsp),%rdx
mov    0x98(%rsp),%rsi
mov    %r13,%r14
mov    0x18(%rsp),%r13
mov    0x30(%rsp),%r12
mov    (%r11,%rbx,8),%rax
movsd  (%rax),%xmm0
mov    (%r8,%rbx,8),%rcx
movsd  %xmm0,(%rcx)
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rcx)
movsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rcx)
movsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rcx)
add    $0x1,%rbx
cmp    0x88(%rsp),%rbx
jl     1340 <cmxx_elim+0x1f0>
jmp    1290 <cmxx_elim+0x140>
xor    %edx,%edx
jmp    14b5 <cmxx_elim+0x365>
mov    0x60(%rsp),%r14
mov    (%r14),%r9d
mov    0x68(%rsp),%r12
mov    0x58(%rsp),%rbx
mov    0x24(%rsp),%edx
sub    %ebx,%r9d
mov    %r9d,(%r14)
sub    %edx,(%r12)
jle    1561 <cmxx_elim+0x411>
add    $0x1ff8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r8,%r10
and    $0xfffffffffffffffe,%r10
neg    %r10
xor    %ebx,%ebx
mov    $0x1,%ecx
xorpd  %xmm0,%xmm0
xor    %edx,%edx
mov    0x18(%rsp),%r13
jmp    1516 <cmxx_elim+0x3c6>
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%r10,%rcx,1),%rdi
add    $0x2,%rdi
add    $0x2,%rcx
cmp    $0x1,%rdi
je     11c3 <cmxx_elim+0x73>
ucomisd 0x0(%rbp,%rcx,8),%xmm0
jbe    1539 <cmxx_elim+0x3e9>
movslq %ebx,%rbx
mov    %ecx,0xb0(%rsp,%rbx,4)
add    $0x1,%ebx
movslq (%r12),%rdi
xor    %eax,%eax
cmp    %rdi,%rcx
setle  %al
add    %eax,%edx
ucomisd 0x8(%rbp,%rcx,8),%xmm0
jbe    1500 <cmxx_elim+0x3b0>
movslq %ebx,%rbx
lea    0x1(%rcx),%edi
mov    %edi,0xb0(%rsp,%rbx,4)
add    $0x1,%ebx
movslq (%r12),%rdi
xor    %eax,%eax
cmp    %rdi,%rcx
setl   %al
add    %eax,%edx
jmp    1500 <cmxx_elim+0x3b0>
mov    0x2068(%rsp),%rbx
lea    0xa90(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x2a5c(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"Simulation concluded - no massive bodies remain.\0A\00"
@EXIT_SUCCESS = global i32 0
define void @cmxx_elim(i32* %0, i32* %1, double* %2, double** %3, double** %4, double** %5, double* %6, double* %7, double** %8, double* %9, i8** %10, i8* %11, i32* %12, i32* %13) {
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca double*
%18 = alloca double**
%19 = alloca double**
%20 = alloca double**
%21 = alloca double*
%22 = alloca double*
%23 = alloca double**
%24 = alloca double*
%25 = alloca i8**
%26 = alloca i8*
%27 = alloca i32*
%28 = alloca i32*
%29 = alloca [2000 x i32]
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
store i32* %0, i32** %15
store i32* %1, i32** %16
store double* %2, double** %17
store double** %3, double*** %18
store double** %4, double*** %19
store double** %5, double*** %20
store double* %6, double** %21
store double* %7, double** %22
store double** %8, double*** %23
store double* %9, double** %24
store i8** %10, i8*** %25
store i8* %11, i8** %26
store i32* %12, i32** %27
store i32* %13, i32** %28
%36 = bitcast [2000 x i32]* %29 to i8*
store i32 0, i32* %30
store i32 0, i32* %31
store i32 1, i32* %32
br label %37
37: ; preds = %65, %14
%38 = load i32, i32* %32
%39 = load i32*, i32** %15
%40 = load i32, i32* %39
%41 = icmp slt i32 %38, %40
br i1 %41, label %42, label %68
42: ; preds = %37
%43 = load double*, double** %24
%44 = load i32, i32* %32
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
%48 = fcmp olt double %47, 0.000000e+00
br i1 %48, label %49, label %64
49: ; preds = %42
%50 = load i32, i32* %32
%51 = load i32, i32* %30
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [2000 x i32], [2000 x i32]* %29, i64 0, i64 %52
store i32 %50, i32* %53
%54 = load i32, i32* %30
%55 = add nsw i32 %54, 1
store i32 %55, i32* %30
%56 = load i32, i32* %32
%57 = load i32*, i32** %16
%58 = load i32, i32* %57
%59 = icmp sle i32 %56, %58
br i1 %59, label %60, label %63
60: ; preds = %49
%61 = load i32, i32* %31
%62 = add nsw i32 %61, 1
store i32 %62, i32* %31
br label %63
63: ; preds = %60, %49
br label %64
64: ; preds = %63, %42
br label %65
65: ; preds = %64
%66 = load i32, i32* %32
%67 = add nsw i32 %66, 1
store i32 %67, i32* %32
br label %37
68: ; preds = %37
%69 = load i32*, i32** %15
%70 = load i32, i32* %69
%71 = add nsw i32 %70, 1
%72 = load i32, i32* %30
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [2000 x i32], [2000 x i32]* %29, i64 0, i64 %73
store i32 %71, i32* %74
store i32 0, i32* %33
br label %75
75: ; preds = %320, %68
%76 = load i32, i32* %33
%77 = load i32, i32* %30
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %323
79: ; preds = %75
%80 = load i32, i32* %33
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [2000 x i32], [2000 x i32]* %29, i64 0, i64 %81
%83 = load i32, i32* %82
%84 = load i32, i32* %33
%85 = sub nsw i32 %83, %84
store i32 %85, i32* %34
br label %86
86: ; preds = %316, %79
%87 = load i32, i32* %34
%88 = load i32, i32* %33
%89 = add nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [2000 x i32], [2000 x i32]* %29, i64 0, i64 %90
%92 = load i32, i32* %91
%93 = load i32, i32* %33
%94 = sub nsw i32 %92, %93
%95 = icmp slt i32 %87, %94
br i1 %95, label %96, label %319
96: ; preds = %86
%97 = load i32, i32* %34
%98 = load i32, i32* %33
%99 = add nsw i32 %97, %98
store i32 %99, i32* %35
%100 = load double**, double*** %18
%101 = load i32, i32* %35
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double*, double** %100, i64 %102
%104 = load double*, double** %103
%105 = getelementptr inbounds double, double* %104, i64 0
%106 = load double, double* %105
%107 = load double**, double*** %18
%108 = load i32, i32* %34
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds double*, double** %107, i64 %109
%111 = load double*, double** %110
%112 = getelementptr inbounds double, double* %111, i64 0
store double %106, double* %112
%113 = load double**, double*** %18
%114 = load i32, i32* %35
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double*, double** %113, i64 %115
%117 = load double*, double** %116
%118 = getelementptr inbounds double, double* %117, i64 1
%119 = load double, double* %118
%120 = load double**, double*** %18
%121 = load i32, i32* %34
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds double*, double** %120, i64 %122
%124 = load double*, double** %123
%125 = getelementptr inbounds double, double* %124, i64 1
store double %119, double* %125
%126 = load double**, double*** %18
%127 = load i32, i32* %35
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds double*, double** %126, i64 %128
%130 = load double*, double** %129
%131 = getelementptr inbounds double, double* %130, i64 2
%132 = load double, double* %131
%133 = load double**, double*** %18
%134 = load i32, i32* %34
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds double*, double** %133, i64 %135
%137 = load double*, double** %136
%138 = getelementptr inbounds double, double* %137, i64 2
store double %132, double* %138
%139 = load double**, double*** %19
%140 = load i32, i32* %35
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds double*, double** %139, i64 %141
%143 = load double*, double** %142
%144 = getelementptr inbounds double, double* %143, i64 0
%145 = load double, double* %144
%146 = load double**, double*** %19
%147 = load i32, i32* %34
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double*, double** %146, i64 %148
%150 = load double*, double** %149
%151 = getelementptr inbounds double, double* %150, i64 0
store double %145, double* %151
%152 = load double**, double*** %19
%153 = load i32, i32* %35
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds double*, double** %152, i64 %154
%156 = load double*, double** %155
%157 = getelementptr inbounds double, double* %156, i64 1
%158 = load double, double* %157
%159 = load double**, double*** %19
%160 = load i32, i32* %34
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds double*, double** %159, i64 %161
%163 = load double*, double** %162
%164 = getelementptr inbounds double, double* %163, i64 1
store double %158, double* %164
%165 = load double**, double*** %19
%166 = load i32, i32* %35
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds double*, double** %165, i64 %167
%169 = load double*, double** %168
%170 = getelementptr inbounds double, double* %169, i64 2
%171 = load double, double* %170
%172 = load double**, double*** %19
%173 = load i32, i32* %34
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double*, double** %172, i64 %174
%176 = load double*, double** %175
%177 = getelementptr inbounds double, double* %176, i64 2
store double %171, double* %177
%178 = load double*, double** %17
%179 = load i32, i32* %35
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds double, double* %178, i64 %180
%182 = load double, double* %181
%183 = load double*, double** %17
%184 = load i32, i32* %34
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds double, double* %183, i64 %185
store double %182, double* %186
%187 = load double**, double*** %20
%188 = load i32, i32* %35
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds double*, double** %187, i64 %189
%191 = load double*, double** %190
%192 = getelementptr inbounds double, double* %191, i64 0
%193 = load double, double* %192
%194 = load double**, double*** %20
%195 = load i32, i32* %34
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds double*, double** %194, i64 %196
%198 = load double*, double** %197
%199 = getelementptr inbounds double, double* %198, i64 0
store double %193, double* %199
%200 = load double**, double*** %20
%201 = load i32, i32* %35
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds double*, double** %200, i64 %202
%204 = load double*, double** %203
%205 = getelementptr inbounds double, double* %204, i64 1
%206 = load double, double* %205
%207 = load double**, double*** %20
%208 = load i32, i32* %34
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds double*, double** %207, i64 %209
%211 = load double*, double** %210
%212 = getelementptr inbounds double, double* %211, i64 1
store double %206, double* %212
%213 = load double**, double*** %20
%214 = load i32, i32* %35
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds double*, double** %213, i64 %215
%217 = load double*, double** %216
%218 = getelementptr inbounds double, double* %217, i64 2
%219 = load double, double* %218
%220 = load double**, double*** %20
%221 = load i32, i32* %34
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds double*, double** %220, i64 %222
%224 = load double*, double** %223
%225 = getelementptr inbounds double, double* %224, i64 2
store double %219, double* %225
%226 = load double*, double** %21
%227 = load i32, i32* %35
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds double, double* %226, i64 %228
%230 = load double, double* %229
%231 = load double*, double** %21
%232 = load i32, i32* %34
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds double, double* %231, i64 %233
store double %230, double* %234
%235 = load double*, double** %22
%236 = load i32, i32* %35
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds double, double* %235, i64 %237
%239 = load double, double* %238
%240 = load double*, double** %22
%241 = load i32, i32* %34
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds double, double* %240, i64 %242
store double %239, double* %243
%244 = load double*, double** %24
%245 = load i32, i32* %35
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds double, double* %244, i64 %246
%248 = load double, double* %247
%249 = load double*, double** %24
%250 = load i32, i32* %34
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds double, double* %249, i64 %251
store double %248, double* %252
%253 = load i8**, i8*** %25
%254 = load i32, i32* %34
%255 = sext i32 %254 to i64
%256 = getelementptr inbounds i8*, i8** %253, i64 %255
%257 = load i8*, i8** %256
%258 = load i8**, i8*** %25
%259 = load i32, i32* %35
%260 = sext i32 %259 to i64
%261 = getelementptr inbounds i8*, i8** %258, i64 %260
%262 = load i8*, i8** %261
%263 = call i32 @strncpy(i8* %257, i8* %262, i32 8)
%264 = load double**, double*** %23
%265 = load i32, i32* %35
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds double*, double** %264, i64 %266
%268 = load double*, double** %267
%269 = getelementptr inbounds double, double* %268, i64 0
%270 = load double, double* %269
%271 = load double**, double*** %23
%272 = load i32, i32* %34
%273 = sext i32 %272 to i64
%274 = getelementptr inbounds double*, double** %271, i64 %273
%275 = load double*, double** %274
%276 = getelementptr inbounds double, double* %275, i64 0
store double %270, double* %276
%277 = load double**, double*** %23
%278 = load i32, i32* %35
%279 = sext i32 %278 to i64
%280 = getelementptr inbounds double*, double** %277, i64 %279
%281 = load double*, double** %280
%282 = getelementptr inbounds double, double* %281, i64 1
%283 = load double, double* %282
%284 = load double**, double*** %23
%285 = load i32, i32* %34
%286 = sext i32 %285 to i64
%287 = getelementptr inbounds double*, double** %284, i64 %286
%288 = load double*, double** %287
%289 = getelementptr inbounds double, double* %288, i64 1
store double %283, double* %289
%290 = load double**, double*** %23
%291 = load i32, i32* %35
%292 = sext i32 %291 to i64
%293 = getelementptr inbounds double*, double** %290, i64 %292
%294 = load double*, double** %293
%295 = getelementptr inbounds double, double* %294, i64 2
%296 = load double, double* %295
%297 = load double**, double*** %23
%298 = load i32, i32* %34
%299 = sext i32 %298 to i64
%300 = getelementptr inbounds double*, double** %297, i64 %299
%301 = load double*, double** %300
%302 = getelementptr inbounds double, double* %301, i64 2
store double %296, double* %302
%303 = load double**, double*** %23
%304 = load i32, i32* %35
%305 = sext i32 %304 to i64
%306 = getelementptr inbounds double*, double** %303, i64 %305
%307 = load double*, double** %306
%308 = getelementptr inbounds double, double* %307, i64 3
%309 = load double, double* %308
%310 = load double**, double*** %23
%311 = load i32, i32* %34
%312 = sext i32 %311 to i64
%313 = getelementptr inbounds double*, double** %310, i64 %312
%314 = load double*, double** %313
%315 = getelementptr inbounds double, double* %314, i64 3
store double %309, double* %315
br label %316
316: ; preds = %96
%317 = load i32, i32* %34
%318 = add nsw i32 %317, 1
store i32 %318, i32* %34
br label %86
319: ; preds = %86
br label %320
320: ; preds = %319
%321 = load i32, i32* %33
%322 = add nsw i32 %321, 1
store i32 %322, i32* %33
br label %75
323: ; preds = %75
%324 = load i32, i32* %30
%325 = load i32*, i32** %15
%326 = load i32, i32* %325
%327 = sub nsw i32 %326, %324
store i32 %327, i32* %325
%328 = load i32, i32* %31
%329 = load i32*, i32** %16
%330 = load i32, i32* %329
%331 = sub nsw i32 %330, %328
store i32 %331, i32* %329
%332 = load i32*, i32** %16
%333 = load i32, i32* %332
%334 = icmp slt i32 %333, 1
br i1 %334, label %335, label %341
335: ; preds = %323
%336 = call i32 @puts(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%337 = load i32*, i32** %28
%338 = call i32 @fclose(i32* %337)
%339 = load i32, i32* @EXIT_SUCCESS
%340 = call i32 @exit(i32 %339)
unreachable
341: ; preds = %323
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"Simulation concluded - no massive bodies remain.\0A\00"
@EXIT_SUCCESS = global i32 0
define void @cmxx_elim(i32* nocapture %0, i32* nocapture %1, double* nocapture %2, double** nocapture %3, double** nocapture %4, double** nocapture %5, double* nocapture %6, double* nocapture %7, double** nocapture %8, double* nocapture %9, i8** nocapture %10, i8* nocapture readnone %11, i32* nocapture readnone %12, i32* nocapture %13) {
%15 = alloca [2000 x i32]
%16 = bitcast [2000 x i32]* %15 to i8*
%17 = load i32, i32* %0
%18 = icmp sgt i32 %17, 1
br i1 %18, label %19, label %104
19: ; preds = %14
%20 = zext i32 %17 to i64
%21 = add nsw i64 %20, -1
%22 = and i64 %21, 1
%23 = icmp eq i32 %17, 2
br i1 %23, label %26, label %24
24: ; preds = %19
%25 = and i64 %21, -2
br label %58
26: ; preds = %93, %19
%27 = phi i32 [ undef, %19 ], [ %94, %93 ]
%28 = phi i32 [ undef, %19 ], [ %95, %93 ]
%29 = phi i64 [ 1, %19 ], [ %96, %93 ]
%30 = phi i32 [ 0, %19 ], [ %95, %93 ]
%31 = phi i32 [ 0, %19 ], [ %94, %93 ]
%32 = icmp eq i64 %22, 0
br i1 %32, label %47, label %33
33: ; preds = %26
%34 = getelementptr inbounds double, double* %9, i64 %29
%35 = load double, double* %34
%36 = fcmp olt double %35, 0.000000e+00
br i1 %36, label %37, label %47
37: ; preds = %33
%38 = sext i32 %30 to i64
%39 = getelementptr inbounds [2000 x i32], [2000 x i32]* %15, i64 0, i64 %38
%40 = trunc i64 %29 to i32
store i32 %40, i32* %39
%41 = add nsw i32 %30, 1
%42 = load i32, i32* %1
%43 = sext i32 %42 to i64
%44 = icmp sle i64 %29, %43
%45 = zext i1 %44 to i32
%46 = add nsw i32 %31, %45
br label %47
47: ; preds = %33, %37, %26
%48 = phi i32 [ %27, %26 ], [ %31, %33 ], [ %46, %37 ]
%49 = phi i32 [ %28, %26 ], [ %30, %33 ], [ %41, %37 ]
%50 = add nsw i32 %17, 1
%51 = sext i32 %49 to i64
%52 = getelementptr inbounds [2000 x i32], [2000 x i32]* %15, i64 0, i64 %51
store i32 %50, i32* %52
%53 = icmp sgt i32 %49, 0
br i1 %53, label %54, label %104
54: ; preds = %47
%55 = zext i32 %49 to i64
%56 = getelementptr inbounds [2000 x i32], [2000 x i32]* %15, i64 0, i64 0
%57 = load i32, i32* %56
br label %112
58: ; preds = %93, %24
%59 = phi i64 [ 1, %24 ], [ %96, %93 ]
%60 = phi i32 [ 0, %24 ], [ %95, %93 ]
%61 = phi i32 [ 0, %24 ], [ %94, %93 ]
%62 = phi i64 [ 0, %24 ], [ %97, %93 ]
%63 = getelementptr inbounds double, double* %9, i64 %59
%64 = load double, double* %63
%65 = fcmp olt double %64, 0.000000e+00
br i1 %65, label %66, label %76
66: ; preds = %58
%67 = sext i32 %60 to i64
%68 = getelementptr inbounds [2000 x i32], [2000 x i32]* %15, i64 0, i64 %67
%69 = trunc i64 %59 to i32
store i32 %69, i32* %68
%70 = add nsw i32 %60, 1
%71 = load i32, i32* %1
%72 = sext i32 %71 to i64
%73 = icmp sle i64 %59, %72
%74 = zext i1 %73 to i32
%75 = add nsw i32 %61, %74
br label %76
76: ; preds = %66, %58
%77 = phi i32 [ %61, %58 ], [ %75, %66 ]
%78 = phi i32 [ %60, %58 ], [ %70, %66 ]
%79 = add nuw nsw i64 %59, 1
%80 = getelementptr inbounds double, double* %9, i64 %79
%81 = load double, double* %80
%82 = fcmp olt double %81, 0.000000e+00
br i1 %82, label %83, label %93
83: ; preds = %76
%84 = sext i32 %78 to i64
%85 = getelementptr inbounds [2000 x i32], [2000 x i32]* %15, i64 0, i64 %84
%86 = trunc i64 %79 to i32
store i32 %86, i32* %85
%87 = add nsw i32 %78, 1
%88 = load i32, i32* %1
%89 = sext i32 %88 to i64
%90 = icmp slt i64 %59, %89
%91 = zext i1 %90 to i32
%92 = add nsw i32 %77, %91
br label %93
93: ; preds = %83, %76
%94 = phi i32 [ %77, %76 ], [ %92, %83 ]
%95 = phi i32 [ %78, %76 ], [ %87, %83 ]
%96 = add nuw nsw i64 %59, 2
%97 = add i64 %62, 2
%98 = icmp eq i64 %97, %25
br i1 %98, label %26, label %58
99: ; preds = %125, %112
%100 = add nsw i32 %115, -1
%101 = icmp eq i64 %116, %55
br i1 %101, label %102, label %112
102: ; preds = %99
%103 = load i32, i32* %0
br label %104
104: ; preds = %14, %102, %47
%105 = phi i32 [ %49, %102 ], [ %49, %47 ], [ 0, %14 ]
%106 = phi i32 [ %48, %102 ], [ %48, %47 ], [ 0, %14 ]
%107 = phi i32 [ %103, %102 ], [ %17, %47 ], [ %17, %14 ]
%108 = sub nsw i32 %107, %105
store i32 %108, i32* %0
%109 = load i32, i32* %1
%110 = sub nsw i32 %109, %106
store i32 %110, i32* %1
%111 = icmp slt i32 %110, 1
br i1 %111, label %194, label %199
112: ; preds = %54, %99
%113 = phi i32 [ %57, %54 ], [ %118, %99 ]
%114 = phi i64 [ 0, %54 ], [ %116, %99 ]
%115 = phi i32 [ 0, %54 ], [ %100, %99 ]
%116 = add nuw nsw i64 %114, 1
%117 = getelementptr inbounds [2000 x i32], [2000 x i32]* %15, i64 0, i64 %116
%118 = load i32, i32* %117
%119 = sext i32 %118 to i64
%120 = sub nsw i64 %119, %114
%121 = icmp slt i32 %113, %118
br i1 %121, label %122, label %99
122: ; preds = %112
%123 = add i32 %113, %115
%124 = sext i32 %123 to i64
br label %125
125: ; preds = %122, %125
%126 = phi i64 [ %124, %122 ], [ %192, %125 ]
%127 = add nsw i64 %126, %114
%128 = getelementptr inbounds double*, double** %3, i64 %127
%129 = load double*, double** %128
%130 = load double, double* %129
%131 = getelementptr inbounds double*, double** %3, i64 %126
%132 = load double*, double** %131
store double %130, double* %132
%133 = getelementptr inbounds double, double* %129, i64 1
%134 = load double, double* %133
%135 = getelementptr inbounds double, double* %132, i64 1
store double %134, double* %135
%136 = getelementptr inbounds double, double* %129, i64 2
%137 = load double, double* %136
%138 = getelementptr inbounds double, double* %132, i64 2
store double %137, double* %138
%139 = getelementptr inbounds double*, double** %4, i64 %127
%140 = load double*, double** %139
%141 = load double, double* %140
%142 = getelementptr inbounds double*, double** %4, i64 %126
%143 = load double*, double** %142
store double %141, double* %143
%144 = getelementptr inbounds double, double* %140, i64 1
%145 = load double, double* %144
%146 = getelementptr inbounds double, double* %143, i64 1
store double %145, double* %146
%147 = getelementptr inbounds double, double* %140, i64 2
%148 = load double, double* %147
%149 = getelementptr inbounds double, double* %143, i64 2
store double %148, double* %149
%150 = getelementptr inbounds double, double* %2, i64 %127
%151 = load double, double* %150
%152 = getelementptr inbounds double, double* %2, i64 %126
store double %151, double* %152
%153 = getelementptr inbounds double*, double** %5, i64 %127
%154 = load double*, double** %153
%155 = load double, double* %154
%156 = getelementptr inbounds double*, double** %5, i64 %126
%157 = load double*, double** %156
store double %155, double* %157
%158 = getelementptr inbounds double, double* %154, i64 1
%159 = load double, double* %158
%160 = getelementptr inbounds double, double* %157, i64 1
store double %159, double* %160
%161 = getelementptr inbounds double, double* %154, i64 2
%162 = load double, double* %161
%163 = getelementptr inbounds double, double* %157, i64 2
store double %162, double* %163
%164 = getelementptr inbounds double, double* %6, i64 %127
%165 = load double, double* %164
%166 = getelementptr inbounds double, double* %6, i64 %126
store double %165, double* %166
%167 = getelementptr inbounds double, double* %7, i64 %127
%168 = load double, double* %167
%169 = getelementptr inbounds double, double* %7, i64 %126
store double %168, double* %169
%170 = getelementptr inbounds double, double* %9, i64 %127
%171 = load double, double* %170
%172 = getelementptr inbounds double, double* %9, i64 %126
store double %171, double* %172
%173 = getelementptr inbounds i8*, i8** %10, i64 %126
%174 = load i8*, i8** %173
%175 = getelementptr inbounds i8*, i8** %10, i64 %127
%176 = load i8*, i8** %175
%177 = tail call i32 @strncpy(i8* %174, i8* %176, i32 8)
%178 = getelementptr inbounds double*, double** %8, i64 %127
%179 = load double*, double** %178
%180 = load double, double* %179
%181 = getelementptr inbounds double*, double** %8, i64 %126
%182 = load double*, double** %181
store double %180, double* %182
%183 = getelementptr inbounds double, double* %179, i64 1
%184 = load double, double* %183
%185 = getelementptr inbounds double, double* %182, i64 1
store double %184, double* %185
%186 = getelementptr inbounds double, double* %179, i64 2
%187 = load double, double* %186
%188 = getelementptr inbounds double, double* %182, i64 2
store double %187, double* %188
%189 = getelementptr inbounds double, double* %179, i64 3
%190 = load double, double* %189
%191 = getelementptr inbounds double, double* %182, i64 3
store double %190, double* %191
%192 = add nsw i64 %126, 1
%193 = icmp slt i64 %192, %120
br i1 %193, label %125, label %99
194: ; preds = %104
%195 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%196 = tail call i32 @fclose(i32* %13)
%197 = load i32, i32* @EXIT_SUCCESS
%198 = tail call i32 @exit(i32 %197)
unreachable
199: ; preds = %104
ret void
}