#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ flood(short *, float *, int, int, int, unsigned char *, int,
                         int **);
scalar_t__ fmatrix(int, int);
int /*<<< orphan*/ free(float *);
int /*<<< orphan*/ free_fmatrix(float **, int);
int /*<<< orphan*/ free_imatrix(int **, int);
int /*<<< orphan*/ getJ(unsigned char *, int, int, int, float *, int, int,
                        short *, unsigned char *, int);
int /*<<< orphan*/ getJT(unsigned char *, int, int, int, float *, int, int,
                         short *, unsigned char *, int);
int getrmap2(short *, float *, int, int, int, int, int, unsigned char *,
             int **);
int /*<<< orphan*/ getthreshJ(int, float *, short *, unsigned char *, float *,
                              float *, int, int /*<<< orphan*/, int *);
scalar_t__ imatrix(int, int);
int /*<<< orphan*/ removehole(short *, int, int, int, unsigned char *);
int track(short *, float *, float *, int, int, int, float **, float,
          unsigned char *, int /*<<< orphan*/, int, float **, int);
int segment1(unsigned char *cmap, int N, int nt, int ny, int nx, int *offset,
             int *step, short *rmap, unsigned char *rmap0, int oldTR, int i,
             float MINRSIZE, int redo, int tt) {
  float *J, *JT, **threshJ1, **threshJ2;
  int j, TR, **done, alldone, datasize, it, imgsize, l;
  imgsize = ny * nx;
  datasize = nt * ny * nx;
  J = (float *)calloc(datasize, sizeof(float));
  for (it = 0; it < nt; it++)
    getJ(cmap + it * imgsize, N, ny, nx, J + it * imgsize, offset[i], step[i],
         rmap + it * imgsize, rmap0 + it * imgsize, oldTR);
  if (nt > 1) {
    JT = (float *)calloc(datasize - imgsize, sizeof(float));
    for (it = 0; it < nt - 1; it++) {
      getJT(cmap + it * imgsize, N, ny, nx, JT + it * imgsize, offset[1],
            step[1], rmap + it * imgsize, rmap0 + it * imgsize, oldTR);
    }
  }
  done = (int **)imatrix(nt, oldTR + 1);
  threshJ1 = (float **)fmatrix(nt, oldTR + 1);
  threshJ2 = (float **)fmatrix(nt, oldTR + 1);
  for (it = 0; it < nt; it++) {
    getthreshJ(imgsize, J + it * imgsize, rmap + it * imgsize,
               rmap0 + it * imgsize, threshJ1[it], threshJ2[it], oldTR, 0,
               done[it]);
  }
  TR = track(rmap, J, JT, nt, ny, nx, threshJ1, MINRSIZE, rmap0, 0, tt,
             threshJ2, oldTR);
  free_fmatrix(threshJ1, nt);
  free_fmatrix(threshJ2, nt);
  if (nt > 1)
    free(JT);
  removehole(rmap, nt, ny, nx, rmap0);
  alldone = getrmap2(rmap, J, nt, ny, nx, TR, oldTR, rmap0, done);
  if (alldone < nt * oldTR) {
    removehole(rmap, nt, ny, nx, rmap0);
    for (j = i - 1; j >= (((i - 2) > (1)) ? (i - 2) : (1)); j--) {
      for (it = 0; it < nt; it++)
        getJ(cmap + it * imgsize, N, ny, nx, J + it * imgsize, offset[j],
             step[j], rmap + it * imgsize, rmap0 + it * imgsize, oldTR);
      alldone = getrmap2(rmap, J, nt, ny, nx, TR, oldTR, rmap0, done);
      if (alldone == nt * oldTR)
        break;
      removehole(rmap, nt, ny, nx, rmap0);
    }
    flood(rmap, J, nt, ny, nx, rmap0, oldTR, done);
  }
  free_imatrix(done, nt);
  free(J);
  return TR;
}


x86 assembly (clang, -O0):
<segment1>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0xa8,%rsp
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
mov    %edx,-0x28(%rbp)
mov    %ecx,-0x2c(%rbp)
mov    %r8d,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movss  %xmm0,-0x3c(%rbp)
mov    -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x28(%rbp),%eax
imul   -0x2c(%rbp),%eax
imul   -0x30(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x78(%rbp),%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    12de <segment1+0x10e>
mov    -0x20(%rbp),%rdi
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x24(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    -0x48(%rbp),%r8
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%r8
mov    -0x38(%rbp),%rax
movslq 0x30(%rbp),%r9
mov    (%rax,%r9,4),%r9d
mov    0x10(%rbp),%rax
movslq 0x30(%rbp),%r10
mov    (%rax,%r10,4),%ebx
mov    0x18(%rbp),%r11
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
shl    $0x1,%rax
add    %rax,%r11
mov    0x20(%rbp),%r10
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
add    %rax,%r10
mov    0x28(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <getJ@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1242 <segment1+0x72>
cmpl   $0x1,-0x28(%rbp)
jle    13a0 <segment1+0x1d0>
mov    -0x78(%rbp),%edi
sub    -0x80(%rbp),%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    139b <segment1+0x1cb>
mov    -0x20(%rbp),%rdi
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x24(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    -0x50(%rbp),%r8
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%r8
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%r9d
mov    0x10(%rbp),%rax
mov    0x4(%rax),%ebx
mov    0x18(%rbp),%r11
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
shl    $0x1,%rax
add    %rax,%r11
mov    0x20(%rbp),%r10
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
add    %rax,%r10
mov    0x28(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1060 <getJT@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1303 <segment1+0x133>
jmp    13a0 <segment1+0x1d0>
mov    -0x28(%rbp),%edi
mov    0x28(%rbp),%esi
add    $0x1,%esi
call   1050 <imatrix@plt>
mov    %rax,-0x70(%rbp)
mov    -0x28(%rbp),%edi
mov    0x28(%rbp),%esi
add    $0x1,%esi
call   10b0 <fmatrix@plt>
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%edi
mov    0x28(%rbp),%esi
add    $0x1,%esi
call   10b0 <fmatrix@plt>
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1473 <segment1+0x2a3>
mov    -0x80(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
mov    0x18(%rbp),%rdx
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
shl    $0x1,%rax
add    %rax,%rdx
mov    0x20(%rbp),%rcx
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
add    %rax,%rcx
mov    -0x58(%rbp),%rax
movslq -0x7c(%rbp),%r8
mov    (%rax,%r8,8),%r8
mov    -0x60(%rbp),%rax
movslq -0x7c(%rbp),%r9
mov    (%rax,%r9,8),%r9
mov    0x28(%rbp),%r10d
mov    -0x70(%rbp),%rax
movslq -0x7c(%rbp),%r11
mov    (%rax,%r11,8),%rax
xor    %r11d,%r11d
mov    %r10d,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1090 <getthreshJ@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    13dd <segment1+0x20d>
mov    0x18(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0x30(%rbp),%r9d
mov    -0x58(%rbp),%r14
movss  -0x3c(%rbp),%xmm0
mov    0x20(%rbp),%rbx
mov    0x40(%rbp),%r11d
mov    -0x60(%rbp),%r10
mov    0x28(%rbp),%eax
xor    %r15d,%r15d
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
movl   $0x0,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %eax,0x28(%rsp)
call   10d0 <track@plt>
mov    %eax,-0x68(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1070 <free_fmatrix@plt>
mov    -0x60(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1070 <free_fmatrix@plt>
cmpl   $0x1,-0x28(%rbp)
jle    14f7 <segment1+0x327>
mov    -0x50(%rbp),%rdi
call   1040 <free@plt>
mov    0x18(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    0x20(%rbp),%r8
call   10e0 <removehole@plt>
mov    0x18(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x68(%rbp),%r9d
mov    0x28(%rbp),%r11d
mov    0x20(%rbp),%r10
mov    -0x70(%rbp),%rax
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   10c0 <getrmap2@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    -0x28(%rbp),%ecx
imul   0x28(%rbp),%ecx
cmp    %ecx,%eax
jge    1705 <segment1+0x535>
mov    0x18(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    0x20(%rbp),%r8
call   10e0 <removehole@plt>
mov    0x30(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    0x30(%rbp),%eax
sub    $0x2,%eax
cmp    $0x1,%eax
jle    159f <segment1+0x3cf>
mov    0x30(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8c(%rbp)
jmp    15af <segment1+0x3df>
mov    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    15af <segment1+0x3df>
mov    -0x88(%rbp),%eax
mov    -0x8c(%rbp),%ecx
cmp    %ecx,%eax
jl     16d9 <segment1+0x509>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1666 <segment1+0x496>
mov    -0x20(%rbp),%rdi
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x24(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    -0x48(%rbp),%r8
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%r8
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%r9
mov    (%rax,%r9,4),%r9d
mov    0x10(%rbp),%rax
movslq -0x64(%rbp),%r10
mov    (%rax,%r10,4),%ebx
mov    0x18(%rbp),%r11
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
shl    $0x1,%rax
add    %rax,%r11
mov    0x20(%rbp),%r10
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
add    %rax,%r10
mov    0x28(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <getJ@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    15ca <segment1+0x3fa>
mov    0x18(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x68(%rbp),%r9d
mov    0x28(%rbp),%r11d
mov    0x20(%rbp),%r10
mov    -0x70(%rbp),%rax
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   10c0 <getrmap2@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    -0x28(%rbp),%ecx
imul   0x28(%rbp),%ecx
cmp    %ecx,%eax
jne    16b5 <segment1+0x4e5>
jmp    16d9 <segment1+0x509>
mov    0x18(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    0x20(%rbp),%r8
call   10e0 <removehole@plt>
mov    -0x64(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x64(%rbp)
jmp    1576 <segment1+0x3a6>
mov    0x18(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    0x20(%rbp),%r9
mov    0x28(%rbp),%r10d
mov    -0x70(%rbp),%rax
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
call   10f0 <flood@plt>
mov    -0x70(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   10a0 <free_imatrix@plt>
mov    -0x48(%rbp),%rdi
call   1040 <free@plt>
mov    -0x68(%rbp),%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<segment1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
movss  %xmm0,0x60(%rsp)
mov    %r9,0x58(%rsp)
mov    %edx,%r12d
mov    %esi,0x34(%rsp)
mov    %rdi,%r14
mov    0xe0(%rsp),%ebx
mov    0xd8(%rsp),%r15d
mov    0xd0(%rsp),%r13
mov    %r8d,0xc(%rsp)
mov    %r8d,%ebp
mov    %ecx,0x8(%rsp)
imul   %ecx,%ebp
mov    %ebp,%edi
imul   %edx,%edi
mov    %edi,0x20(%rsp)
mov    $0x4,%esi
call   1080 <calloc@plt>
test   %r12d,%r12d
mov    %r12,0x50(%rsp)
mov    %ebp,0x38(%rsp)
mov    %rax,0x18(%rsp)
mov    %r14,0x80(%rsp)
jle    1393 <segment1+0x1c3>
movslq %ebx,%rcx
mov    %rcx,0x28(%rsp)
movslq %ebp,%r15
mov    %r12d,%r12d
lea    0x0(,%r15,4),%rdx
lea    (%r15,%r15,1),%rsi
mov    %r13,%rbx
mov    0xc8(%rsp),%r13
mov    %rax,%rbp
mov    %rdx,0x10(%rsp)
mov    %rsi,0x40(%rsp)
mov    0x28(%rsp),%rax
mov    0x58(%rsp),%rdx
mov    (%rdx,%rax,4),%r9d
mov    0xc0(%rsp),%rdx
mov    (%rdx,%rax,4),%r10d
mov    %r14,%rdi
mov    0x34(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %rbp,%r8
mov    0xd8(%rsp),%eax
push   %rax
push   %rbx
push   %r13
push   %r10
call   1030 <getJ@plt>
mov    0x60(%rsp),%rsi
mov    0x30(%rsp),%rdx
add    $0x20,%rsp
add    %r15,%r14
add    %rdx,%rbp
add    %rsi,%r13
add    %r15,%rbx
add    $0xffffffffffffffff,%r12
jne    1280 <segment1+0xb0>
mov    0x50(%rsp),%r12
cmp    $0x2,%r12d
setge  %al
jl     139d <segment1+0x1cd>
mov    %eax,0x48(%rsp)
mov    0x20(%rsp),%edi
sub    0x38(%rsp),%edi
mov    $0x4,%esi
mov    %r15,%r13
call   1080 <calloc@plt>
mov    %rax,%rbp
lea    -0x1(%r12),%r14d
mov    0xd0(%rsp),%r15
mov    0xc8(%rsp),%r12
mov    %rax,0x78(%rsp)
mov    0x80(%rsp),%rbx
xchg   %ax,%ax
mov    0x58(%rsp),%rax
mov    0x4(%rax),%r9d
mov    0xc0(%rsp),%rax
mov    0x4(%rax),%r10d
mov    %rbx,%rdi
mov    0x34(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %rbp,%r8
mov    0xd8(%rsp),%eax
push   %rax
push   %r15
push   %r12
push   %r10
call   1060 <getJT@plt>
add    $0x20,%rsp
add    %r13,%rbx
add    0x10(%rsp),%rbp
add    0x40(%rsp),%r12
add    %r13,%r15
add    $0xffffffffffffffff,%r14
jne    1330 <segment1+0x160>
mov    0xd8(%rsp),%r15d
mov    0x50(%rsp),%r12
jmp    13af <segment1+0x1df>
movl   $0x0,0x48(%rsp)
jmp    13af <segment1+0x1df>
movl   $0x0,0x48(%rsp)
mov    0xd8(%rsp),%ebp
mov    %rbp,%r15
lea    0x1(%r15),%ebx
mov    %r12d,%edi
mov    %ebx,%esi
call   1050 <imatrix@plt>
mov    %rax,%r13
mov    %r12d,%edi
mov    %ebx,%esi
call   10b0 <fmatrix@plt>
mov    %rax,0x10(%rsp)
mov    %r12d,%edi
mov    %ebx,%esi
call   10b0 <fmatrix@plt>
mov    %rax,%r10
test   %r12d,%r12d
mov    %r15,%r11
mov    %r13,0x28(%rsp)
jle    148b <segment1+0x2bb>
movslq 0x38(%rsp),%rax
mov    0x50(%rsp),%ecx
mov    %rcx,0x20(%rsp)
lea    0x0(,%rax,4),%rcx
mov    %rcx,0x70(%rsp)
mov    %rax,0x40(%rsp)
add    %rax,%rax
mov    %rax,0x68(%rsp)
xor    %r15d,%r15d
mov    0xd0(%rsp),%rbx
mov    0xc8(%rsp),%rbp
mov    0x18(%rsp),%r14
nopl   (%rax)
mov    0x10(%rsp),%rax
mov    (%rax,%r15,8),%r8
mov    (%r10,%r15,8),%r9
sub    $0x8,%rsp
mov    0x40(%rsp),%edi
mov    %r14,%rsi
mov    %rbp,%rdx
mov    %rbx,%rcx
push   0x0(%r13,%r15,8)
push   $0x0
push   %r11
mov    %r10,%r13
mov    %r11,%r12
call   1090 <getthreshJ@plt>
mov    %r12,%r11
mov    %r13,%r10
mov    0x48(%rsp),%r13
add    $0x20,%rsp
add    $0x1,%r15
add    0x70(%rsp),%r14
add    0x68(%rsp),%rbp
add    0x40(%rsp),%rbx
cmp    %r15,0x20(%rsp)
jne    1430 <segment1+0x260>
mov    0xc8(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    0x78(%rsp),%rdx
mov    0x50(%rsp),%r14
mov    %r14d,%ecx
mov    0x8(%rsp),%r12d
mov    %r12d,%r8d
mov    0xc(%rsp),%r13d
mov    %r13d,%r9d
movss  0x60(%rsp),%xmm0
push   %r11
push   %r10
mov    0x100(%rsp),%eax
push   %rax
push   $0x0
mov    0xf0(%rsp),%rbp
push   %rbp
mov    0x38(%rsp),%rbx
push   %rbx
mov    %r10,%r15
call   10d0 <track@plt>
add    $0x30,%rsp
mov    %eax,0x20(%rsp)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1070 <free_fmatrix@plt>
mov    %r15,%rdi
mov    %r14d,%esi
call   1070 <free_fmatrix@plt>
cmpb   $0x0,0x48(%rsp)
je     150f <segment1+0x33f>
mov    0x78(%rsp),%rdi
call   1040 <free@plt>
mov    0xc8(%rsp),%r15
mov    %r15,%rdi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    %rbp,%r8
call   10e0 <removehole@plt>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    0x20(%rsp),%rsi
mov    %r14d,%edx
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    0x28(%rsp),%r9d
push   0x30(%rsp)
push   %rbp
mov    0xf0(%rsp),%ebx
push   %rbx
call   10c0 <getrmap2@plt>
add    $0x20,%rsp
mov    %ebx,%ecx
mov    0x18(%rsp),%rbx
imul   %r14d,%ecx
mov    %ecx,0x70(%rsp)
cmp    %ecx,%eax
jge    173a <segment1+0x56a>
mov    %r15,%rdi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    %rbp,%r8
call   10e0 <removehole@plt>
mov    0xe0(%rsp),%ecx
cmp    $0x4,%ecx
mov    $0x3,%eax
cmovge %ecx,%eax
add    $0xfffffffe,%eax
cmp    %ecx,%eax
jge    170e <segment1+0x53e>
movslq 0x38(%rsp),%rdx
movslq %ecx,%rbx
mov    %eax,%eax
mov    %rax,0x60(%rsp)
mov    %r14d,%eax
mov    %rax,0x48(%rsp)
lea    0x0(,%rdx,4),%rax
mov    %rax,0x38(%rsp)
mov    %rdx,0x40(%rsp)
lea    (%rdx,%rdx,1),%rax
mov    %rax,0x68(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
add    $0xffffffffffffffff,%rbx
mov    %rbx,0x10(%rsp)
test   %r14d,%r14d
mov    %r13d,%r8d
mov    0xd8(%rsp),%eax
mov    %rax,%r10
mov    %r12d,%ecx
mov    0x58(%rsp),%rdx
mov    0xc0(%rsp),%rdi
mov    0x68(%rsp),%r14
jle    16a5 <segment1+0x4d5>
mov    0x48(%rsp),%r15
mov    0xd0(%rsp),%r12
mov    0xc8(%rsp),%r13
mov    0x18(%rsp),%rbp
mov    0x80(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp),%rax
mov    (%rdx,%rax,4),%r9d
mov    (%rdi,%rax,4),%eax
mov    %rbx,%rdi
mov    0x34(%rsp),%esi
mov    %ecx,%edx
mov    %r8d,%ecx
mov    %rbp,%r8
push   %r10
push   %r12
push   %r13
push   %rax
call   1030 <getJ@plt>
mov    0x58(%rsp),%rsi
mov    0x60(%rsp),%rax
mov    0xe0(%rsp),%rdi
mov    0x78(%rsp),%rdx
mov    0x28(%rsp),%ecx
mov    0xf8(%rsp),%r10d
mov    0x2c(%rsp),%r8d
add    $0x20,%rsp
add    %rax,%rbx
add    %rsi,%rbp
add    %r14,%r13
add    %rax,%r12
add    $0xffffffffffffffff,%r15
jne    1640 <segment1+0x470>
sub    $0x8,%rsp
mov    0xd0(%rsp),%r15
mov    %r15,%rdi
mov    0x20(%rsp),%rsi
mov    0x58(%rsp),%r14
mov    %r14d,%edx
mov    %ecx,%r12d
mov    %r8d,%r13d
mov    0x28(%rsp),%r9d
push   0x30(%rsp)
mov    0xe0(%rsp),%rbp
push   %rbp
push   %r10
call   10c0 <getrmap2@plt>
add    $0x20,%rsp
cmp    0x70(%rsp),%eax
mov    0x10(%rsp),%rbx
je     170e <segment1+0x53e>
mov    %r15,%rdi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    %rbp,%r8
call   10e0 <removehole@plt>
cmp    0x60(%rsp),%rbx
jg     15e0 <segment1+0x410>
mov    %r15,%rdi
mov    0x18(%rsp),%rbx
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    %rbp,%r9
push   0x28(%rsp)
mov    0xe0(%rsp),%eax
push   %rax
call   10f0 <flood@plt>
add    $0x10,%rsp
mov    0x28(%rsp),%rdi
mov    %r14d,%esi
call   10a0 <free_imatrix@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
mov    0x20(%rsp),%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @segment1(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* nocapture %5, i32* nocapture %6, i16* %7, i8* %8, i32 %9, i32 %10, float %11, i32 %12, i32 %13) {
%15 = mul i32 %4, %3
%16 = mul i32 %15, %2
%17 = tail call i64 @calloc(i32 %16, i32 4)
%18 = inttoptr i64 %17 to float*
%19 = icmp sgt i32 %2, 0
br i1 %19, label %20, label %61
20: ; preds = %14
%21 = sext i32 %10 to i64
%22 = getelementptr inbounds i32, i32* %5, i64 %21
%23 = getelementptr inbounds i32, i32* %6, i64 %21
%24 = sext i32 %15 to i64
%25 = zext i32 %2 to i64
br label %26
26: ; preds = %20, %26
%27 = phi i64 [ 0, %20 ], [ %36, %26 ]
%28 = mul nsw i64 %27, %24
%29 = getelementptr inbounds i8, i8* %0, i64 %28
%30 = getelementptr inbounds float, float* %18, i64 %28
%31 = load i32, i32* %22
%32 = load i32, i32* %23
%33 = getelementptr inbounds i16, i16* %7, i64 %28
%34 = getelementptr inbounds i8, i8* %8, i64 %28
%35 = tail call i32 @getJ(i8* %29, i32 %1, i32 %3, i32 %4, float* %30, i32 %31, i32 %32, i16* %33, i8* %34, i32 %9)
%36 = add nuw nsw i64 %27, 1
%37 = icmp eq i64 %36, %25
br i1 %37, label %38, label %26
38: ; preds = %26
%39 = icmp sgt i32 %2, 1
br i1 %39, label %40, label %61
40: ; preds = %38
%41 = sub nsw i32 %16, %15
%42 = tail call i64 @calloc(i32 %41, i32 4)
%43 = inttoptr i64 %42 to float*
%44 = add nsw i32 %2, -1
%45 = getelementptr inbounds i32, i32* %5, i64 1
%46 = getelementptr inbounds i32, i32* %6, i64 1
%47 = sext i32 %15 to i64
%48 = zext i32 %44 to i64
br label %49
49: ; preds = %40, %49
%50 = phi i64 [ 0, %40 ], [ %59, %49 ]
%51 = mul nsw i64 %50, %47
%52 = getelementptr inbounds i8, i8* %0, i64 %51
%53 = getelementptr inbounds float, float* %43, i64 %51
%54 = load i32, i32* %45
%55 = load i32, i32* %46
%56 = getelementptr inbounds i16, i16* %7, i64 %51
%57 = getelementptr inbounds i8, i8* %8, i64 %51
%58 = tail call i32 @getJT(i8* %52, i32 %1, i32 %3, i32 %4, float* %53, i32 %54, i32 %55, i16* %56, i8* %57, i32 %9)
%59 = add nuw nsw i64 %50, 1
%60 = icmp eq i64 %59, %48
br i1 %60, label %61, label %49
61: ; preds = %49, %14, %38
%62 = phi i1 [ false, %38 ], [ false, %14 ], [ %39, %49 ]
%63 = phi float* [ undef, %38 ], [ undef, %14 ], [ %43, %49 ]
%64 = add nsw i32 %9, 1
%65 = tail call i64 @imatrix(i32 %2, i32 %64)
%66 = inttoptr i64 %65 to i32**
%67 = tail call i64 @fmatrix(i32 %2, i32 %64)
%68 = inttoptr i64 %67 to float**
%69 = tail call i64 @fmatrix(i32 %2, i32 %64)
%70 = inttoptr i64 %69 to float**
br i1 %19, label %71, label %89
71: ; preds = %61
%72 = sext i32 %15 to i64
%73 = zext i32 %2 to i64
br label %74
74: ; preds = %71, %74
%75 = phi i64 [ 0, %71 ], [ %87, %74 ]
%76 = mul nsw i64 %75, %72
%77 = getelementptr inbounds float, float* %18, i64 %76
%78 = getelementptr inbounds i16, i16* %7, i64 %76
%79 = getelementptr inbounds i8, i8* %8, i64 %76
%80 = getelementptr inbounds float*, float** %68, i64 %75
%81 = load float*, float** %80
%82 = getelementptr inbounds float*, float** %70, i64 %75
%83 = load float*, float** %82
%84 = getelementptr inbounds i32*, i32** %66, i64 %75
%85 = load i32*, i32** %84
%86 = tail call i32 @getthreshJ(i32 %15, float* %77, i16* %78, i8* %79, float* %81, float* %83, i32 %9, i32 0, i32* %85)
%87 = add nuw nsw i64 %75, 1
%88 = icmp eq i64 %87, %73
br i1 %88, label %89, label %74
89: ; preds = %74, %61
%90 = tail call i32 @track(i16* %7, float* %18, float* %63, i32 %2, i32 %3, i32 %4, float** %68, float %11, i8* %8, i32 0, i32 %13, float** %70, i32 %9)
%91 = tail call i32 @free_fmatrix(float** %68, i32 %2)
%92 = tail call i32 @free_fmatrix(float** %70, i32 %2)
br i1 %62, label %93, label %95
93: ; preds = %89
%94 = tail call i32 @free(float* %63)
br label %95
95: ; preds = %93, %89
%96 = tail call i32 @removehole(i16* %7, i32 %2, i32 %3, i32 %4, i8* %8)
%97 = tail call i32 @getrmap2(i16* %7, float* %18, i32 %2, i32 %3, i32 %4, i32 %90, i32 %9, i8* %8, i32** %66)
%98 = mul nsw i32 %9, %2
%99 = icmp slt i32 %97, %98
br i1 %99, label %100, label %137
100: ; preds = %95
%101 = tail call i32 @removehole(i16* %7, i32 %2, i32 %3, i32 %4, i8* %8)
%102 = icmp sgt i32 %10, 3
%103 = select i1 %102, i32 %10, i32 3
%104 = add nsw i32 %103, -2
%105 = icmp slt i32 %104, %10
br i1 %105, label %106, label %135
106: ; preds = %100
%107 = sext i32 %15 to i64
%108 = sext i32 %10 to i64
%109 = zext i32 %104 to i64
%110 = zext i32 %2 to i64
br label %111
111: ; preds = %106, %132
%112 = phi i64 [ %108, %106 ], [ %113, %132 ]
%113 = add nsw i64 %112, -1
br i1 %19, label %114, label %129
114: ; preds = %111
%115 = getelementptr inbounds i32, i32* %5, i64 %113
%116 = getelementptr inbounds i32, i32* %6, i64 %113
br label %117
117: ; preds = %114, %117
%118 = phi i64 [ 0, %114 ], [ %127, %117 ]
%119 = mul nsw i64 %118, %107
%120 = getelementptr inbounds i8, i8* %0, i64 %119
%121 = getelementptr inbounds float, float* %18, i64 %119
%122 = load i32, i32* %115
%123 = load i32, i32* %116
%124 = getelementptr inbounds i16, i16* %7, i64 %119
%125 = getelementptr inbounds i8, i8* %8, i64 %119
%126 = tail call i32 @getJ(i8* %120, i32 %1, i32 %3, i32 %4, float* %121, i32 %122, i32 %123, i16* %124, i8* %125, i32 %9)
%127 = add nuw nsw i64 %118, 1
%128 = icmp eq i64 %127, %110
br i1 %128, label %129, label %117
129: ; preds = %117, %111
%130 = tail call i32 @getrmap2(i16* %7, float* %18, i32 %2, i32 %3, i32 %4, i32 %90, i32 %9, i8* %8, i32** %66)
%131 = icmp eq i32 %130, %98
br i1 %131, label %135, label %132
132: ; preds = %129
%133 = tail call i32 @removehole(i16* %7, i32 %2, i32 %3, i32 %4, i8* %8)
%134 = icmp sgt i64 %113, %109
br i1 %134, label %111, label %135
135: ; preds = %132, %129, %100
%136 = tail call i32 @flood(i16* %7, float* %18, i32 %2, i32 %3, i32 %4, i8* %8, i32 %9, i32** %66)
br label %137
137: ; preds = %135, %95
%138 = tail call i32 @free_imatrix(i32** %66, i32 %2)
%139 = tail call i32 @free(float* %18)
ret i32 %90
}