#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 */
unsigned char UCHAR_MAX;
double UINT_MAX;
int USHRT_MAX;
int const _p3dHuangYagerThresholding_yager16(int, int, int);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ p3dGetElapsedTime_min();
int /*<<< orphan*/ p3dGetElapsedTime_sec();
int /*<<< orphan*/ p3dResetStartTime();
int p3dHuangYagerThresholding_16(unsigned short *in_im, unsigned char *out_im,
                                 const int dimx, const int dimy, const int dimz,
                                 unsigned short *thresh,
                                 int (*wr_log)(const char *, ...),
                                 int (*wr_progress)(const int, ...)) {
  double *S, *Sbar, *W, *Wbar;
  double *hist, *F, maxv = 0.0, delta, sum, minsum;
  int i, t, tbest = -1, u0, u1;
  int start, end;
  int ct;
  if (wr_log != NULL) {
    p3dResetStartTime();
    wr_log("Pore3D - Thresholding image according to Huang's method...");
  }
  if (((hist = (double *)calloc((USHRT_MAX + 1), sizeof(double))) == NULL)) {
    goto MEM_ERROR;
  };
  if (((S = (double *)malloc(sizeof(double) * (USHRT_MAX + 1))) == NULL)) {
    goto MEM_ERROR;
  };
  if (((Sbar = (double *)malloc(sizeof(double) * (USHRT_MAX + 1))) == NULL)) {
    goto MEM_ERROR;
  };
  if (((W = (double *)malloc(sizeof(double) * (USHRT_MAX + 1))) == NULL)) {
    goto MEM_ERROR;
  };
  if (((Wbar = (double *)malloc(sizeof(double) * (USHRT_MAX + 1))) == NULL)) {
    goto MEM_ERROR;
  };
  if (((F = (double *)malloc(sizeof(double) * (USHRT_MAX + 1))) == NULL)) {
    goto MEM_ERROR;
  };
  for (ct = 0; ct < (dimx * dimy * dimz); ct++)
    hist[in_im[ct]] = hist[in_im[ct]] + 1.0;
  S[0] = hist[0];
  W[0] = 0;
  for (i = 1; i <= USHRT_MAX; i++) {
    S[i] = S[i - 1] + hist[i];
    W[i] = i * hist[i] + W[i - 1];
  }
  Sbar[USHRT_MAX] = 0;
  Wbar[USHRT_MAX] = 0;
  for (i = (USHRT_MAX - 1); i >= 0; i--) {
    Sbar[i] = Sbar[i + 1] + hist[i + 1];
    Wbar[i] = Wbar[i + 1] + (i + 1) * hist[i + 1];
  }
  for (t = 1; t < USHRT_MAX; t++) {
    if (hist[t] == 0.0)
      continue;
    if (S[t] == 0.0)
      continue;
    if (Sbar[t] == 0.0)
      continue;
    u0 = (int)(W[t] / S[t] + 0.5);
    u1 = (int)(Wbar[t] / Sbar[t] + 0.5);
    F[t] = _p3dHuangYagerThresholding_yager16(u0, u1, t) / (dimx * dimy * dimz);
    if (F[t] > maxv)
      maxv = F[t];
    if (tbest < 0)
      tbest = t;
    else if (F[t] < F[tbest])
      tbest = t;
  }
  delta = F[tbest] + (maxv - F[tbest]) * 0.05;
  start = (int)(tbest - delta);
  if (start <= 0)
    start = 1;
  end = (int)(tbest + delta);
  if (end >= USHRT_MAX)
    end = (USHRT_MAX - 1);
  minsum = UINT_MAX;
  for (i = start; i <= end; i++) {
    sum = hist[i - 1] + hist[i] + hist[i + 1];
    if (sum < minsum) {
      t = i;
      minsum = sum;
    }
  }
  *thresh = (unsigned short)t;
#pragma omp parallel for
  for (ct = 0; ct < (dimx * dimy * dimz); ct++)
    out_im[ct] = (in_im[ct] > (*thresh)) ? UCHAR_MAX : 0;
  free(hist);
  free(S);
  free(Sbar);
  free(W);
  free(Wbar);
  free(F);
  if (wr_log != NULL) {
    wr_log("\tDetermined threshold: %d.", *thresh);
    wr_log("Pore3D - Image thresholded successfully in %dm%0.3fs.",
           p3dGetElapsedTime_min(), p3dGetElapsedTime_sec());
  }
  return 2;
MEM_ERROR:
  if (wr_log != NULL) {
    wr_log("Pore3D - Not enough (contiguous) memory. Program will exit.");
  }
  free(hist);
  free(S);
  free(Sbar);
  free(W);
  free(Wbar);
  free(F);
  return (int)0;
}


x86 assembly (clang, -O0):
<p3dHuangYagerThresholding_16>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0xffffffff,-0x8c(%rbp)
ff ff ff
cmpq   $0x0,0x10(%rbp)
je     11c9 <p3dHuangYagerThresholding_16+0x59>
mov    $0x0,%al
call   1080 <p3dResetStartTime@plt>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   *0x10(%rbp)
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,-0x58(%rbp)
cmp    $0x0,%rax
jne    11f2 <p3dHuangYagerThresholding_16+0x82>
jmp    195a <p3dHuangYagerThresholding_16+0x7ea>
mov    0x2de7(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    121e <p3dHuangYagerThresholding_16+0xae>
jmp    195a <p3dHuangYagerThresholding_16+0x7ea>
mov    0x2dbb(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    124a <p3dHuangYagerThresholding_16+0xda>
jmp    195a <p3dHuangYagerThresholding_16+0x7ea>
mov    0x2d8f(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1276 <p3dHuangYagerThresholding_16+0x106>
jmp    195a <p3dHuangYagerThresholding_16+0x7ea>
mov    0x2d63(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
jne    12a2 <p3dHuangYagerThresholding_16+0x132>
jmp    195a <p3dHuangYagerThresholding_16+0x7ea>
mov    0x2d37(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x60(%rbp)
cmp    $0x0,%rax
jne    12ce <p3dHuangYagerThresholding_16+0x15e>
jmp    195a <p3dHuangYagerThresholding_16+0x7ea>
movl   $0x0,-0xa0(%rbp)
mov    -0xa0(%rbp),%eax
mov    -0x1c(%rbp),%ecx
imul   -0x20(%rbp),%ecx
imul   -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    133d <p3dHuangYagerThresholding_16+0x1cd>
mov    -0x58(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0xa0(%rbp),%rdx
movzwl (%rcx,%rdx,2),%ecx
movsd  0xd04(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0xa0(%rbp),%rdx
movzwl (%rcx,%rdx,2),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xa0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
jmp    12d8 <p3dHuangYagerThresholding_16+0x168>
mov    -0x58(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    0x2c71(%rip),%rcx
cmp    (%rcx),%eax
jg     1405 <p3dHuangYagerThresholding_16+0x295>
mov    -0x38(%rbp),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x84(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
cvtsi2sdl -0x84(%rbp),%xmm0
ff
mov    -0x58(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x48(%rbp),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1362 <p3dHuangYagerThresholding_16+0x1f2>
mov    -0x40(%rbp),%rax
mov    0x2bd0(%rip),%rcx
movslq (%rcx),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%rax
mov    0x2bba(%rip),%rcx
movslq (%rcx),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x2ba8(%rip),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x84(%rbp)
cmpl   $0x0,-0x84(%rbp)
jl     14ed <p3dHuangYagerThresholding_16+0x37d>
mov    -0x40(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x84(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
mov    -0x58(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x84(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x84(%rbp)
jmp    1443 <p3dHuangYagerThresholding_16+0x2d3>
movl   $0x1,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    0x2adc(%rip),%rcx
cmp    (%rcx),%eax
jge    16cb <p3dHuangYagerThresholding_16+0x55b>
mov    -0x58(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1534 <p3dHuangYagerThresholding_16+0x3c4>
jp     1534 <p3dHuangYagerThresholding_16+0x3c4>
jmp    16b7 <p3dHuangYagerThresholding_16+0x547>
mov    -0x38(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    155c <p3dHuangYagerThresholding_16+0x3ec>
jp     155c <p3dHuangYagerThresholding_16+0x3ec>
jmp    16b7 <p3dHuangYagerThresholding_16+0x547>
mov    -0x40(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1584 <p3dHuangYagerThresholding_16+0x414>
jp     1584 <p3dHuangYagerThresholding_16+0x414>
jmp    16b7 <p3dHuangYagerThresholding_16+0x547>
mov    -0x48(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x88(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
movsd  0xa5c(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x90(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x88(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
movsd  0xa26(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x94(%rbp)
mov    -0x90(%rbp),%edi
mov    -0x94(%rbp),%esi
mov    -0x88(%rbp),%edx
call   1030 <_p3dHuangYagerThresholding_yager16@plt>
mov    -0x1c(%rbp),%ecx
imul   -0x20(%rbp),%ecx
imul   -0x24(%rbp),%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
mov    -0x60(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x68(%rbp),%xmm0
jbe    1659 <p3dHuangYagerThresholding_16+0x4e9>
mov    -0x60(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
cmpl   $0x0,-0x8c(%rbp)
jge    1677 <p3dHuangYagerThresholding_16+0x507>
mov    -0x88(%rbp),%eax
mov    %eax,-0x8c(%rbp)
jmp    16b2 <p3dHuangYagerThresholding_16+0x542>
mov    -0x60(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x60(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    16ad <p3dHuangYagerThresholding_16+0x53d>
mov    -0x88(%rbp),%eax
mov    %eax,-0x8c(%rbp)
jmp    16b2 <p3dHuangYagerThresholding_16+0x542>
jmp    16b7 <p3dHuangYagerThresholding_16+0x547>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    14f7 <p3dHuangYagerThresholding_16+0x387>
mov    -0x60(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x68(%rbp),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x8c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  0x908(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
cvtsi2sdl -0x8c(%rbp),%xmm0
ff
subsd  -0x70(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x98(%rbp)
cmpl   $0x0,-0x98(%rbp)
jg     1733 <p3dHuangYagerThresholding_16+0x5c3>
movl   $0x1,-0x98(%rbp)
cvtsi2sdl -0x8c(%rbp),%xmm0
ff
addsd  -0x70(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
mov    0x2889(%rip),%rcx
cmp    (%rcx),%eax
jl     1771 <p3dHuangYagerThresholding_16+0x601>
mov    0x287a(%rip),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    0x2860(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x98(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x9c(%rbp),%eax
jg     1821 <p3dHuangYagerThresholding_16+0x6b1>
mov    -0x58(%rbp),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x84(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1808 <p3dHuangYagerThresholding_16+0x698>
mov    -0x84(%rbp),%eax
mov    %eax,-0x88(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    180d <p3dHuangYagerThresholding_16+0x69d>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    178d <p3dHuangYagerThresholding_16+0x61d>
mov    -0x88(%rbp),%eax
mov    %ax,%cx
mov    -0x30(%rbp),%rax
mov    %cx,(%rax)
movl   $0x0,-0xa0(%rbp)
mov    -0xa0(%rbp),%eax
mov    -0x1c(%rbp),%ecx
imul   -0x20(%rbp),%ecx
imul   -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    18be <p3dHuangYagerThresholding_16+0x74e>
mov    -0x10(%rbp),%rax
movslq -0xa0(%rbp),%rcx
movzwl (%rax,%rcx,2),%eax
mov    -0x30(%rbp),%rcx
movzwl (%rcx),%ecx
cmp    %ecx,%eax
jle    1887 <p3dHuangYagerThresholding_16+0x717>
mov    0x2777(%rip),%rax
movzbl (%rax),%eax
mov    %eax,-0xa4(%rbp)
jmp    1894 <p3dHuangYagerThresholding_16+0x724>
xor    %eax,%eax
mov    %eax,-0xa4(%rbp)
jmp    1894 <p3dHuangYagerThresholding_16+0x724>
mov    -0xa4(%rbp),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0xa0(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xa0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
jmp    183b <p3dHuangYagerThresholding_16+0x6cb>
mov    -0x58(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x48(%rbp),%rdi
call   1040 <free@plt>
mov    -0x50(%rbp),%rdi
call   1040 <free@plt>
mov    -0x60(%rbp),%rdi
call   1040 <free@plt>
cmpq   $0x0,0x10(%rbp)
je     194e <p3dHuangYagerThresholding_16+0x7de>
mov    0x10(%rbp),%rcx
mov    -0x30(%rbp),%rax
movzwl (%rax),%esi
lea    0x742(%rip),%rdi
mov    $0x0,%al
call   *%rcx
mov    0x10(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    $0x0,%al
call   1070 <p3dGetElapsedTime_min@plt>
mov    %eax,-0xb4(%rbp)
mov    $0x0,%al
call   1050 <p3dGetElapsedTime_sec@plt>
mov    -0xb4(%rbp),%esi
mov    -0xb0(%rbp),%rcx
mov    %eax,%edx
lea    0x724(%rip),%rdi
mov    $0x0,%al
call   *%rcx
movl   $0x2,-0x4(%rbp)
jmp    19ae <p3dHuangYagerThresholding_16+0x83e>
cmpq   $0x0,0x10(%rbp)
je     1971 <p3dHuangYagerThresholding_16+0x801>
lea    0x738(%rip),%rdi
mov    $0x0,%al
call   *0x10(%rbp)
mov    -0x58(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x48(%rbp),%rdi
call   1040 <free@plt>
mov    -0x50(%rbp),%rdi
call   1040 <free@plt>
mov    -0x60(%rbp),%rdi
call   1040 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p3dHuangYagerThresholding_16>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,0x60(%rsp)
mov    %r8d,%r14d
mov    %ecx,%ebp
mov    %edx,%r13d
mov    %rsi,0x30(%rsp)
mov    %rdi,0x70(%rsp)
mov    0xb0(%rsp),%rbx
test   %rbx,%rbx
je     11b4 <p3dHuangYagerThresholding_16+0x44>
xor    %eax,%eax
call   1080 <p3dResetStartTime@plt>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   *%rbx
mov    0x2e25(%rip),%r15
mov    (%r15),%edi
add    $0x1,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%r12
test   %rax,%rax
je     12ae <p3dHuangYagerThresholding_16+0x13e>
mov    (%r15),%eax
lea    0x8(,%rax,8),%edi
call   1090 <malloc@plt>
mov    %rax,0x38(%rsp)
test   %rax,%rax
je     12b0 <p3dHuangYagerThresholding_16+0x140>
mov    (%r15),%eax
lea    0x8(,%rax,8),%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     12b4 <p3dHuangYagerThresholding_16+0x144>
mov    %rax,0x18(%rsp)
mov    (%r15),%eax
lea    0x8(,%rax,8),%edi
call   1090 <malloc@plt>
mov    %rax,0x48(%rsp)
test   %rax,%rax
je     12bd <p3dHuangYagerThresholding_16+0x14d>
mov    (%r15),%eax
lea    0x8(,%rax,8),%edi
call   1090 <malloc@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     12c1 <p3dHuangYagerThresholding_16+0x151>
mov    (%r15),%eax
lea    0x8(,%rax,8),%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     12cb <p3dHuangYagerThresholding_16+0x15b>
mov    %rax,%r15
imul   %r13d,%ebp
imul   %r14d,%ebp
mov    %ebp,%r10d
mov    %ebp,0x5c(%rsp)
test   %ebp,%ebp
mov    0x60(%rsp),%r13
mov    0x48(%rsp),%rbp
mov    0x30(%rsp),%r8
mov    0x18(%rsp),%r9
mov    0x70(%rsp),%r14
mov    0x38(%rsp),%rbx
jle    13ed <p3dHuangYagerThresholding_16+0x27d>
lea    -0x1(%r10),%rcx
mov    %r10d,%eax
and    $0x3,%eax
cmp    $0x3,%rcx
jae    1336 <p3dHuangYagerThresholding_16+0x1c6>
xor    %ecx,%ecx
jmp    13b0 <p3dHuangYagerThresholding_16+0x240>
jmp    12da <p3dHuangYagerThresholding_16+0x16a>
xor    %ebx,%ebx
jmp    12da <p3dHuangYagerThresholding_16+0x16a>
xor    %eax,%eax
mov    %rax,0x18(%rsp)
jmp    12d5 <p3dHuangYagerThresholding_16+0x165>
xor    %ebp,%ebp
jmp    12d5 <p3dHuangYagerThresholding_16+0x165>
xor    %r15d,%r15d
mov    0x48(%rsp),%rbp
jmp    12d5 <p3dHuangYagerThresholding_16+0x165>
mov    0x48(%rsp),%rbp
mov    0x10(%rsp),%r15
mov    0x38(%rsp),%rbx
mov    0xb0(%rsp),%rcx
test   %rcx,%rcx
je     12f2 <p3dHuangYagerThresholding_16+0x182>
lea    0xdee(%rip),%rdi
xor    %eax,%eax
call   *%rcx
mov    %r12,%rdi
call   1040 <free@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
mov    0x18(%rsp),%rdi
call   1040 <free@plt>
mov    %rbp,%rdi
call   1040 <free@plt>
mov    %r15,%rdi
call   1040 <free@plt>
xor    %ebx,%ebx
xor    %edi,%edi
call   1040 <free@plt>
mov    %ebx,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r10d,%edx
and    $0xfffffffc,%edx
xor    %ecx,%ecx
movsd  0xcba(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
movzwl (%r14,%rcx,2),%esi
movsd  (%r12,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rsi,8)
movzwl 0x2(%r14,%rcx,2),%esi
movsd  (%r12,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rsi,8)
movzwl 0x4(%r14,%rcx,2),%esi
movsd  (%r12,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rsi,8)
movzwl 0x6(%r14,%rcx,2),%esi
movsd  (%r12,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rsi,8)
add    $0x4,%rcx
cmp    %rcx,%rdx
jne    1350 <p3dHuangYagerThresholding_16+0x1e0>
test   %rax,%rax
je     13ed <p3dHuangYagerThresholding_16+0x27d>
lea    (%r14,%rcx,2),%rcx
xor    %edx,%edx
movsd  0xc3d(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzwl (%rcx,%rdx,2),%esi
movsd  (%r12,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rsi,8)
add    $0x1,%rdx
cmp    %rdx,%rax
jne    13d0 <p3dHuangYagerThresholding_16+0x260>
movsd  (%r12),%xmm0
movsd  %xmm0,(%rbx)
movq   $0x0,0x0(%rbp)
mov    0x2bda(%rip),%rax
movslq (%rax),%rsi
test   %rsi,%rsi
mov    %r15,0x50(%rsp)
jle    1478 <p3dHuangYagerThresholding_16+0x308>
mov    %esi,%edi
lea    0x1(%rdi),%rax
lea    0x8(,%rdi,8),%rcx
add    %rbp,%rcx
cmp    %rcx,%rbx
jae    14a1 <p3dHuangYagerThresholding_16+0x331>
lea    (%rbx,%rdi,8),%rcx
add    $0x8,%rcx
cmp    %rcx,%rbp
jae    14a1 <p3dHuangYagerThresholding_16+0x331>
mov    $0x1,%ecx
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%rbx,%rcx,8),%xmm0
addsd  (%r12,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  (%r12,%rcx,8),%xmm0
addsd  -0x8(%rbp,%rcx,8),%xmm0
movsd  %xmm0,0x0(%rbp,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1440 <p3dHuangYagerThresholding_16+0x2d0>
jmp    154d <p3dHuangYagerThresholding_16+0x3dd>
movq   $0x0,(%r9,%rsi,8)
mov    0x10(%rsp),%rax
movq   $0x0,(%rax,%rsi,8)
mov    $0xffffffff,%r11d
mov    $0x1,%ebp
xorpd  %xmm5,%xmm5
jmp    19da <p3dHuangYagerThresholding_16+0x86a>
mov    %eax,%edx
movsd  (%rbx),%xmm0
movsd  0x0(%rbp),%xmm1
add    $0xffffffffffffffff,%rax
mov    $0x1,%ecx
cmp    $0x2,%edx
je     1527 <p3dHuangYagerThresholding_16+0x3b7>
mov    %rdi,%r11
mov    %rax,%rdx
and    $0xfffffffffffffffe,%rdx
mov    $0x1,%ecx
nopl   0x0(%rax)
addsd  (%r12,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
xorps  %xmm2,%xmm2
cvtsi2sd %ecx,%xmm2
mulsd  (%r12,%rcx,8),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x0(%rbp,%rcx,8)
addsd  0x8(%r12,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
lea    0x1(%rcx),%rdi
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
mulsd  0x8(%r12,%rcx,8),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rbp,%rcx,8)
add    $0x2,%rcx
cmp    %rdx,%rdi
jne    14d0 <p3dHuangYagerThresholding_16+0x360>
mov    %r11,%rdi
test   $0x1,%al
je     154d <p3dHuangYagerThresholding_16+0x3dd>
addsd  (%r12,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  (%r12,%rcx,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x0(%rbp,%rcx,8)
movq   $0x0,(%r9,%rsi,8)
mov    0x10(%rsp),%rax
movq   $0x0,(%rax,%rsi,8)
mov    $0xffffffff,%r11d
mov    $0x1,%ebp
xorpd  %xmm5,%xmm5
test   %esi,%esi
jle    19da <p3dHuangYagerThresholding_16+0x86a>
cmp    $0x1,%esi
mov    %r10,0x40(%rsp)
jne    1590 <p3dHuangYagerThresholding_16+0x420>
mov    %rdi,%rax
mov    0x10(%rsp),%r10
jmp    1880 <p3dHuangYagerThresholding_16+0x710>
lea    -0x1(%rdi),%rcx
lea    -0x1(%rsi),%r9d
mov    $0x8,%edx
mov    %rcx,%rax
mul    %rdx
seto   %dl
cmp    %ecx,%r9d
jb     1d2f <p3dHuangYagerThresholding_16+0xbbf>
mov    %rdi,0x20(%rsp)
mov    %rcx,0x68(%rsp)
shr    $0x20,%rcx
jne    1868 <p3dHuangYagerThresholding_16+0x6f8>
mov    0x18(%rsp),%rcx
lea    (%rcx,%r9,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     1868 <p3dHuangYagerThresholding_16+0x6f8>
test   %dl,%dl
jne    1868 <p3dHuangYagerThresholding_16+0x6f8>
mov    0x10(%rsp),%rcx
lea    (%rcx,%r9,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     1868 <p3dHuangYagerThresholding_16+0x6f8>
test   %dl,%dl
mov    0x20(%rsp),%rdi
jne    1d2f <p3dHuangYagerThresholding_16+0xbbf>
mov    0x18(%rsp),%rcx
lea    (%rcx,%rdi,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     1868 <p3dHuangYagerThresholding_16+0x6f8>
test   %dl,%dl
jne    1868 <p3dHuangYagerThresholding_16+0x6f8>
mov    0x20(%rsp),%rcx
lea    (%r12,%rcx,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     1868 <p3dHuangYagerThresholding_16+0x6f8>
test   %dl,%dl
jne    1868 <p3dHuangYagerThresholding_16+0x6f8>
mov    0x10(%rsp),%rcx
mov    0x20(%rsp),%rdi
lea    (%rcx,%rdi,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     1868 <p3dHuangYagerThresholding_16+0x6f8>
test   %dl,%dl
jne    1868 <p3dHuangYagerThresholding_16+0x6f8>
lea    0x1(%r9),%rax
mov    0x20(%rsp),%rbx
sub    %rbx,%rax
mov    0x18(%rsp),%rdx
lea    (%rdx,%rax,8),%rdi
lea    (%rdx,%r9,8),%r8
add    $0x8,%r8
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
lea    0x8(%rcx,%r9,8),%r15
lea    0x8(%rdx),%r9
lea    0x8(%rdx,%rbx,8),%r11
lea    0x8(%r12),%rdx
lea    (%r12,%rbx,8),%r10
add    $0x8,%r10
lea    (%rcx,%rbx,8),%rbx
add    $0x8,%rbx
cmp    %r15,%rdi
setb   0xf(%rsp)
cmp    %r8,%rax
setb   0xe(%rsp)
cmp    %r11,%rdi
setb   0x2f(%rsp)
cmp    %r8,%r9
setb   0x2e(%rsp)
cmp    %r10,%rdi
setb   0x2c(%rsp)
cmp    %r8,%rdx
setb   0x2b(%rsp)
cmp    %rbx,%rdi
lea    0x8(%rcx),%rdi
setb   0x2d(%rsp)
cmp    %r8,%rdi
setb   0x2a(%rsp)
cmp    %r11,%rax
setb   %r8b
cmp    %r15,%r9
setb   %r9b
cmp    %r10,%rax
setb   %r10b
cmp    %r15,%rdx
setb   %dl
cmp    %rbx,%rax
setb   %bl
cmp    %r15,%rdi
setb   %cl
mov    0xe(%rsp),%al
test   %al,0xf(%rsp)
jne    1d37 <p3dHuangYagerThresholding_16+0xbc7>
mov    %cl,0xe(%rsp)
mov    %dl,0xf(%rsp)
mov    0x2d(%rsp),%al
mov    0x2e(%rsp),%cl
and    %cl,0x2f(%rsp)
jne    1d37 <p3dHuangYagerThresholding_16+0xbc7>
mov    %ebx,%edi
mov    %r9d,%edx
mov    0x2b(%rsp),%cl
and    %cl,0x2c(%rsp)
mov    0x50(%rsp),%r15
mov    0x18(%rsp),%r9
mov    0x38(%rsp),%rbx
mov    $0xffffffff,%r11d
mov    0x20(%rsp),%rcx
jne    1d1d <p3dHuangYagerThresholding_16+0xbad>
and    0x2a(%rsp),%al
jne    1d1d <p3dHuangYagerThresholding_16+0xbad>
and    %dl,%r8b
jne    1d1d <p3dHuangYagerThresholding_16+0xbad>
and    0xf(%rsp),%r10b
mov    0x30(%rsp),%r8
jne    1c0f <p3dHuangYagerThresholding_16+0xa9f>
and    0xe(%rsp),%dil
jne    1c0f <p3dHuangYagerThresholding_16+0xa9f>
mov    %ecx,%r15d
and    $0xfffffffe,%r15d
mov    %ecx,%eax
and    $0x1,%eax
movd   %esi,%xmm0
pshufd $0x50,%xmm0,%xmm0
paddd  0x85f(%rip),%xmm0
mov    %r15,%rdx
neg    %rdx
mov    0x10(%rsp),%r10
mov    %rcx,%r11
mov    0x68(%rsp),%rcx
lea    (%r10,%rcx,8),%rbx
lea    (%r12,%rcx,8),%rdi
lea    (%r9,%rcx,8),%r8
mov    $0xffffffff,%ecx
add    %r11,%rcx
mov    %r9,%r11
xor    %r9d,%r9d
movdqa 0x83a(%rip),%xmm1
lea    (%rcx,%r9,1),%r13d
movupd (%r8,%r9,8),%xmm2
movupd (%rdi,%r9,8),%xmm3
addpd  %xmm2,%xmm3
movupd %xmm3,-0x8(%r11,%r13,8)
movupd (%rbx,%r9,8),%xmm2
cvtdq2pd %xmm0,%xmm3
movupd (%rdi,%r9,8),%xmm4
shufpd $0x1,%xmm3,%xmm3
mulpd  %xmm4,%xmm3
addpd  %xmm2,%xmm3
movupd %xmm3,-0x8(%r10,%r13,8)
paddd  %xmm1,%xmm0
add    $0xfffffffffffffffe,%r9
cmp    %r9,%rdx
jne    17f6 <p3dHuangYagerThresholding_16+0x686>
cmp    0x20(%rsp),%r15
mov    0x60(%rsp),%r13
mov    0x30(%rsp),%r8
mov    0x50(%rsp),%r15
mov    %r11,%r9
mov    0x38(%rsp),%rbx
mov    $0xffffffff,%r11d
jne    1880 <p3dHuangYagerThresholding_16+0x710>
jmp    18ba <p3dHuangYagerThresholding_16+0x74a>
mov    0x20(%rsp),%rax
mov    0x10(%rsp),%r10
mov    0x18(%rsp),%r9
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rax),%rcx
movsd  (%r9,%rax,8),%xmm0
addsd  (%r12,%rax,8),%xmm0
mov    %ecx,%edx
movsd  %xmm0,(%r9,%rdx,8)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%r12,%rax,8),%xmm0
addsd  (%r10,%rax,8),%xmm0
movsd  %xmm0,(%r10,%rdx,8)
cmp    $0x1,%rax
mov    %rcx,%rax
ja     1880 <p3dHuangYagerThresholding_16+0x710>
cmp    $0x2,%esi
mov    0x40(%rsp),%r10
jl     19da <p3dHuangYagerThresholding_16+0x86a>
xorpd  %xmm2,%xmm2
mov    $0xffffffff,%r11d
mov    $0x1,%ebp
xorpd  %xmm5,%xmm5
jmp    1917 <p3dHuangYagerThresholding_16+0x7a7>
movapd %xmm0,%xmm5
mov    %ebp,%r11d
mov    0x30(%rsp),%r8
mov    0x40(%rsp),%r10
mov    0x18(%rsp),%r9
xorpd  %xmm2,%xmm2
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
mov    0x26d5(%rip),%rax
movslq (%rax),%rsi
cmp    %rsi,%rbp
jge    19da <p3dHuangYagerThresholding_16+0x86a>
movsd  (%r12,%rbp,8),%xmm0
ucomisd %xmm2,%xmm0
jne    1925 <p3dHuangYagerThresholding_16+0x7b5>
jnp    1900 <p3dHuangYagerThresholding_16+0x790>
movsd  (%rbx,%rbp,8),%xmm1
ucomisd %xmm2,%xmm1
jne    1932 <p3dHuangYagerThresholding_16+0x7c2>
jnp    1900 <p3dHuangYagerThresholding_16+0x790>
movsd  (%r9,%rbp,8),%xmm0
ucomisd %xmm2,%xmm0
jne    1940 <p3dHuangYagerThresholding_16+0x7d0>
jnp    1900 <p3dHuangYagerThresholding_16+0x790>
mov    0x48(%rsp),%rax
movsd  (%rax,%rbp,8),%xmm2
divsd  %xmm1,%xmm2
movsd  0x6b2(%rip),%xmm3
addsd  %xmm3,%xmm2
cvttsd2si %xmm2,%edi
mov    0x10(%rsp),%rax
movsd  (%rax,%rbp,8),%xmm1
divsd  %xmm0,%xmm1
addsd  %xmm3,%xmm1
cvttsd2si %xmm1,%esi
mov    %ebp,%edx
movsd  %xmm5,0x60(%rsp)
mov    %r11d,%r15d
call   1030 <_p3dHuangYagerThresholding_yager16@plt>
mov    %r15d,%r11d
mov    0x50(%rsp),%r15
cltd
idivl  0x5c(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  %xmm1,(%r15,%rbp,8)
movapd %xmm1,%xmm0
maxsd  0x60(%rsp),%xmm0
test   %r11d,%r11d
js     18dd <p3dHuangYagerThresholding_16+0x76d>
mov    %r11d,%eax
movsd  (%r15,%rax,8),%xmm2
ucomisd %xmm1,%xmm2
mov    0x30(%rsp),%r8
mov    0x40(%rsp),%r10
movapd %xmm0,%xmm5
jbe    18ee <p3dHuangYagerThresholding_16+0x77e>
mov    %ebp,%r11d
jmp    18ee <p3dHuangYagerThresholding_16+0x77e>
movslq %r11d,%rax
movsd  (%r15,%rax,8),%xmm0
subsd  %xmm0,%xmm5
mulsd  0x621(%rip),%xmm5
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  %xmm0,%xmm5
movapd %xmm1,%xmm0
subsd  %xmm5,%xmm0
cvttsd2si %xmm0,%eax
test   %eax,%eax
mov    $0x1,%edx
cmovg  %eax,%edx
addsd  %xmm1,%xmm5
cvttsd2si %xmm5,%ecx
lea    -0x1(%rsi),%eax
cmp    %ecx,%esi
cmovg  %ecx,%eax
cmp    %eax,%edx
jle    1a2b <p3dHuangYagerThresholding_16+0x8bb>
mov    %ebp,%edx
jmp    1ad3 <p3dHuangYagerThresholding_16+0x963>
mov    0x25a6(%rip),%rcx
movsd  (%rcx),%xmm0
mov    %edx,%ecx
add    $0x1,%eax
mov    %eax,%edi
sub    %edx,%edi
mov    %rcx,%rsi
not    %rsi
test   $0x1,%dil
jne    1a4d <p3dHuangYagerThresholding_16+0x8dd>
jmp    1a76 <p3dHuangYagerThresholding_16+0x906>
movsd  -0x8(%r12,%rcx,8),%xmm1
addsd  (%r12,%rcx,8),%xmm1
addsd  0x8(%r12,%rcx,8),%xmm1
add    $0x1,%rcx
ucomisd %xmm1,%xmm0
minsd  %xmm0,%xmm1
cmova  %edx,%ebp
mov    %ebp,%edx
movapd %xmm1,%xmm0
add    %rax,%rsi
je     1ad3 <p3dHuangYagerThresholding_16+0x963>
nopl   0x0(%rax,%rax,1)
movsd  (%r12,%rcx,8),%xmm1
movsd  -0x8(%r12,%rcx,8),%xmm2
addsd  %xmm1,%xmm2
lea    0x1(%rcx),%rsi
mov    %esi,%edx
addsd  (%r12,%rdx,8),%xmm2
ucomisd %xmm2,%xmm0
mov    %ecx,%edx
cmovbe %ebp,%edx
addsd  0x8(%r12,%rcx,8),%xmm1
add    $0x2,%rcx
mov    %ecx,%edi
addsd  (%r12,%rdi,8),%xmm1
minsd  %xmm0,%xmm2
ucomisd %xmm1,%xmm2
minsd  %xmm2,%xmm1
cmova  %esi,%edx
mov    %edx,%ebp
movapd %xmm1,%xmm0
cmp    %rax,%rcx
jne    1a80 <p3dHuangYagerThresholding_16+0x910>
mov    %dx,0x0(%r13)
mov    0x5c(%rsp),%esi
test   %esi,%esi
mov    0x48(%rsp),%rbp
jle    1c55 <p3dHuangYagerThresholding_16+0xae5>
xor    %ecx,%ecx
cmp    %dx,(%r14)
mov    0x24fa(%rip),%rax
movzbl (%rax),%edx
cmovbe %ecx,%edx
mov    %dl,(%r8)
cmp    $0x1,%esi
je     1c55 <p3dHuangYagerThresholding_16+0xae5>
lea    -0x1(%r10),%r9
mov    $0x1,%ecx
cmp    $0x10,%r9
jb     1c26 <p3dHuangYagerThresholding_16+0xab6>
lea    0x1(%r8),%rdx
lea    (%r8,%r10,1),%rbp
lea    0x2(%r13),%rsi
lea    0x2(%r14),%rdi
cmp    %rsi,%rdx
mov    %r10,%rsi
setb   %r10b
cmp    %r13,%rbp
seta   %r11b
mov    %rsi,0x40(%rsp)
lea    (%r14,%rsi,2),%rsi
cmp    %rsi,%rdx
setb   %dl
cmp    %rdi,%rbp
seta   %dil
cmp    %rax,%r8
setb   %sil
cmp    %rax,%rbp
seta   %r8b
test   %r11b,%r10b
jne    1c17 <p3dHuangYagerThresholding_16+0xaa7>
and    %dil,%dl
mov    0x48(%rsp),%rbp
jne    1c1c <p3dHuangYagerThresholding_16+0xaac>
and    %r8b,%sil
mov    0x30(%rsp),%r8
mov    0x40(%rsp),%r10
jne    1c26 <p3dHuangYagerThresholding_16+0xab6>
mov    %r9,%rsi
and    $0xfffffffffffffff0,%rsi
lea    0x1(%rsi),%rcx
movzwl 0x0(%r13),%edx
movd   %edx,%xmm0
pshuflw $0x0,%xmm0,%xmm0
pshufd $0x0,%xmm0,%xmm0
movzbl (%rax),%edx
movd   %edx,%xmm1
punpcklbw %xmm1,%xmm1
pshuflw $0x0,%xmm1,%xmm1
xor    %edi,%edi
movdqa 0x47e(%rip),%xmm2
pxor   %xmm2,%xmm0
movdqu 0x2(%r14,%rdi,2),%xmm3
movdqu 0x12(%r14,%rdi,2),%xmm4
pxor   %xmm2,%xmm3
pcmpgtw %xmm0,%xmm3
packsswb %xmm3,%xmm3
pxor   %xmm2,%xmm4
pcmpgtw %xmm0,%xmm4
packsswb %xmm4,%xmm4
pand   %xmm1,%xmm3
pand   %xmm1,%xmm4
punpcklqdq %xmm4,%xmm3
movdqu %xmm3,0x1(%r8,%rdi,1)
add    $0x10,%rdi
cmp    %rdi,%rsi
jne    1bc6 <p3dHuangYagerThresholding_16+0xa56>
cmp    %rsi,%r9
jne    1c26 <p3dHuangYagerThresholding_16+0xab6>
jmp    1c55 <p3dHuangYagerThresholding_16+0xae5>
mov    %rcx,%rax
jmp    1586 <p3dHuangYagerThresholding_16+0x416>
mov    0x48(%rsp),%rbp
mov    0x30(%rsp),%r8
mov    0x40(%rsp),%r10
mov    %rcx,%rdx
not    %rdx
test   $0x1,%r10b
jne    1c4c <p3dHuangYagerThresholding_16+0xadc>
movzwl (%r14,%rcx,2),%esi
xor    %edi,%edi
cmp    0x0(%r13),%si
movzbl (%rax),%esi
cmovbe %edi,%esi
mov    %sil,(%r8,%rcx,1)
add    $0x1,%rcx
add    %r10,%rdx
jne    1cf2 <p3dHuangYagerThresholding_16+0xb82>
mov    %r12,%rdi
call   1040 <free@plt>
mov    0x38(%rsp),%rdi
call   1040 <free@plt>
mov    0x18(%rsp),%rdi
call   1040 <free@plt>
mov    %rbp,%rdi
call   1040 <free@plt>
mov    0x10(%rsp),%rdi
call   1040 <free@plt>
mov    0x50(%rsp),%rdi
call   1040 <free@plt>
mov    $0x2,%ebx
mov    0xb0(%rsp),%r14
test   %r14,%r14
je     1325 <p3dHuangYagerThresholding_16+0x1b5>
movzwl 0x0(%r13),%esi
lea    0x3dc(%rip),%rdi
xor    %eax,%eax
call   *%r14
xor    %eax,%eax
call   1070 <p3dGetElapsedTime_min@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <p3dGetElapsedTime_sec@plt>
lea    0x3db(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   *%r14
jmp    1325 <p3dHuangYagerThresholding_16+0x1b5>
nopl   0x0(%rax)
mov    %dl,0x1(%r8,%rcx,1)
add    $0x2,%rcx
cmp    %rcx,%r10
je     1c55 <p3dHuangYagerThresholding_16+0xae5>
movzwl (%r14,%rcx,2),%esi
xor    %edx,%edx
cmp    0x0(%r13),%si
ja     1d04 <p3dHuangYagerThresholding_16+0xb94>
xor    %esi,%esi
jmp    1d07 <p3dHuangYagerThresholding_16+0xb97>
movzbl (%rax),%esi
mov    %sil,(%r8,%rcx,1)
movzwl 0x2(%r14,%rcx,2),%esi
cmp    0x0(%r13),%si
jbe    1ce0 <p3dHuangYagerThresholding_16+0xb70>
movzbl (%rax),%edx
jmp    1ce0 <p3dHuangYagerThresholding_16+0xb70>
mov    %rcx,%rax
mov    0x10(%rsp),%r10
mov    0x30(%rsp),%r8
jmp    1880 <p3dHuangYagerThresholding_16+0x710>
mov    %rdi,%rax
jmp    186d <p3dHuangYagerThresholding_16+0x6fd>
mov    0x20(%rsp),%rax
mov    0x10(%rsp),%r10
mov    0x30(%rsp),%r8
mov    0x50(%rsp),%r15
mov    0x18(%rsp),%r9
mov    0x38(%rsp),%rbx
mov    $0xffffffff,%r11d
jmp    1880 <p3dHuangYagerThresholding_16+0x710>

LLVM IR (-O0):
@.str = [59 x i8] c"Pore3D - Thresholding image according to Huang's method...\00"
@USHRT_MAX = global i32 0
@UINT_MAX = global double 0.000000e+00
@UCHAR_MAX = global i8 0
@.str.1 = [27 x i8] c"\09Determined threshold: %d.\00"
@.str.2 = [54 x i8] c"Pore3D - Image thresholded successfully in %dm%0.3fs.\00"
@.str.3 = [60 x i8] c"Pore3D - Not enough (contiguous) memory. Program will exit.\00"
define i32 @p3dHuangYagerThresholding_16(i16* %0, i8* %1, i32 %2, i32 %3, i32 %4, i16* %5, i32 (i8*, ...)* %6, i32 (i32, ...)* %7) {
%9 = alloca i32
%10 = alloca i16*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i16*
%16 = alloca i32 (i8*, ...)*
%17 = alloca i32 (i32, ...)*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
store i16* %0, i16** %10
store i8* %1, i8** %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i16* %5, i16** %15
store i32 (i8*, ...)* %6, i32 (i8*, ...)** %16
store i32 (i32, ...)* %7, i32 (i32, ...)** %17
store double 0.000000e+00, double* %24
store i32 -1, i32* %30
%36 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%37 = icmp ne i32 (i8*, ...)* %36, null
br i1 %37, label %38, label %42
38: ; preds = %8
%39 = call i32 (...) @p3dResetStartTime()
%40 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%41 = call i32 (i8*, ...) %40(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
br label %42
42: ; preds = %38, %8
%43 = load i32, i32* @USHRT_MAX
%44 = add nsw i32 %43, 1
%45 = call i64 @calloc(i32 %44, i32 8)
%46 = inttoptr i64 %45 to double*
store double* %46, double** %22
%47 = icmp eq double* %46, null
br i1 %47, label %48, label %49
48: ; preds = %42
br label %477
49: ; preds = %42
%50 = load i32, i32* @USHRT_MAX
%51 = add nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = mul i64 8, %52
%54 = trunc i64 %53 to i32
%55 = call i64 @malloc(i32 %54)
%56 = inttoptr i64 %55 to double*
store double* %56, double** %18
%57 = icmp eq double* %56, null
br i1 %57, label %58, label %59
58: ; preds = %49
br label %477
59: ; preds = %49
%60 = load i32, i32* @USHRT_MAX
%61 = add nsw i32 %60, 1
%62 = sext i32 %61 to i64
%63 = mul i64 8, %62
%64 = trunc i64 %63 to i32
%65 = call i64 @malloc(i32 %64)
%66 = inttoptr i64 %65 to double*
store double* %66, double** %19
%67 = icmp eq double* %66, null
br i1 %67, label %68, label %69
68: ; preds = %59
br label %477
69: ; preds = %59
%70 = load i32, i32* @USHRT_MAX
%71 = add nsw i32 %70, 1
%72 = sext i32 %71 to i64
%73 = mul i64 8, %72
%74 = trunc i64 %73 to i32
%75 = call i64 @malloc(i32 %74)
%76 = inttoptr i64 %75 to double*
store double* %76, double** %20
%77 = icmp eq double* %76, null
br i1 %77, label %78, label %79
78: ; preds = %69
br label %477
79: ; preds = %69
%80 = load i32, i32* @USHRT_MAX
%81 = add nsw i32 %80, 1
%82 = sext i32 %81 to i64
%83 = mul i64 8, %82
%84 = trunc i64 %83 to i32
%85 = call i64 @malloc(i32 %84)
%86 = inttoptr i64 %85 to double*
store double* %86, double** %21
%87 = icmp eq double* %86, null
br i1 %87, label %88, label %89
88: ; preds = %79
br label %477
89: ; preds = %79
%90 = load i32, i32* @USHRT_MAX
%91 = add nsw i32 %90, 1
%92 = sext i32 %91 to i64
%93 = mul i64 8, %92
%94 = trunc i64 %93 to i32
%95 = call i64 @malloc(i32 %94)
%96 = inttoptr i64 %95 to double*
store double* %96, double** %23
%97 = icmp eq double* %96, null
br i1 %97, label %98, label %99
98: ; preds = %89
br label %477
99: ; preds = %89
store i32 0, i32* %35
br label %100
100: ; preds = %127, %99
%101 = load i32, i32* %35
%102 = load i32, i32* %12
%103 = load i32, i32* %13
%104 = mul nsw i32 %102, %103
%105 = load i32, i32* %14
%106 = mul nsw i32 %104, %105
%107 = icmp slt i32 %101, %106
br i1 %107, label %108, label %130
108: ; preds = %100
%109 = load double*, double** %22
%110 = load i16*, i16** %10
%111 = load i32, i32* %35
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i16, i16* %110, i64 %112
%114 = load i16, i16* %113
%115 = zext i16 %114 to i64
%116 = getelementptr inbounds double, double* %109, i64 %115
%117 = load double, double* %116
%118 = fadd double %117, 1.000000e+00
%119 = load double*, double** %22
%120 = load i16*, i16** %10
%121 = load i32, i32* %35
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i16, i16* %120, i64 %122
%124 = load i16, i16* %123
%125 = zext i16 %124 to i64
%126 = getelementptr inbounds double, double* %119, i64 %125
store double %118, double* %126
br label %127
127: ; preds = %108
%128 = load i32, i32* %35
%129 = add nsw i32 %128, 1
store i32 %129, i32* %35
br label %100
130: ; preds = %100
%131 = load double*, double** %22
%132 = getelementptr inbounds double, double* %131, i64 0
%133 = load double, double* %132
%134 = load double*, double** %18
%135 = getelementptr inbounds double, double* %134, i64 0
store double %133, double* %135
%136 = load double*, double** %20
%137 = getelementptr inbounds double, double* %136, i64 0
store double 0.000000e+00, double* %137
store i32 1, i32* %28
br label %138
138: ; preds = %177, %130
%139 = load i32, i32* %28
%140 = load i32, i32* @USHRT_MAX
%141 = icmp sle i32 %139, %140
br i1 %141, label %142, label %180
142: ; preds = %138
%143 = load double*, double** %18
%144 = load i32, i32* %28
%145 = sub nsw i32 %144, 1
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds double, double* %143, i64 %146
%148 = load double, double* %147
%149 = load double*, double** %22
%150 = load i32, i32* %28
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds double, double* %149, i64 %151
%153 = load double, double* %152
%154 = fadd double %148, %153
%155 = load double*, double** %18
%156 = load i32, i32* %28
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds double, double* %155, i64 %157
store double %154, double* %158
%159 = load i32, i32* %28
%160 = sitofp i32 %159 to double
%161 = load double*, double** %22
%162 = load i32, i32* %28
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds double, double* %161, i64 %163
%165 = load double, double* %164
%166 = load double*, double** %20
%167 = load i32, i32* %28
%168 = sub nsw i32 %167, 1
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double, double* %166, i64 %169
%171 = load double, double* %170
%172 = call double @llvm.fmuladd.f64(double %160, double %165, double %171)
%173 = load double*, double** %20
%174 = load i32, i32* %28
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds double, double* %173, i64 %175
store double %172, double* %176
br label %177
177: ; preds = %142
%178 = load i32, i32* %28
%179 = add nsw i32 %178, 1
store i32 %179, i32* %28
br label %138
180: ; preds = %138
%181 = load double*, double** %19
%182 = load i32, i32* @USHRT_MAX
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds double, double* %181, i64 %183
store double 0.000000e+00, double* %184
%185 = load double*, double** %21
%186 = load i32, i32* @USHRT_MAX
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds double, double* %185, i64 %187
store double 0.000000e+00, double* %188
%189 = load i32, i32* @USHRT_MAX
%190 = sub nsw i32 %189, 1
store i32 %190, i32* %28
br label %191
191: ; preds = %232, %180
%192 = load i32, i32* %28
%193 = icmp sge i32 %192, 0
br i1 %193, label %194, label %235
194: ; preds = %191
%195 = load double*, double** %19
%196 = load i32, i32* %28
%197 = add nsw i32 %196, 1
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds double, double* %195, i64 %198
%200 = load double, double* %199
%201 = load double*, double** %22
%202 = load i32, i32* %28
%203 = add nsw i32 %202, 1
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds double, double* %201, i64 %204
%206 = load double, double* %205
%207 = fadd double %200, %206
%208 = load double*, double** %19
%209 = load i32, i32* %28
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds double, double* %208, i64 %210
store double %207, double* %211
%212 = load double*, double** %21
%213 = load i32, i32* %28
%214 = add nsw i32 %213, 1
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds double, double* %212, i64 %215
%217 = load double, double* %216
%218 = load i32, i32* %28
%219 = add nsw i32 %218, 1
%220 = sitofp i32 %219 to double
%221 = load double*, double** %22
%222 = load i32, i32* %28
%223 = add nsw i32 %222, 1
%224 = sext i32 %223 to i64
%225 = getelementptr inbounds double, double* %221, i64 %224
%226 = load double, double* %225
%227 = call double @llvm.fmuladd.f64(double %220, double %226, double %217)
%228 = load double*, double** %21
%229 = load i32, i32* %28
%230 = sext i32 %229 to i64
%231 = getelementptr inbounds double, double* %228, i64 %230
store double %227, double* %231
br label %232
232: ; preds = %194
%233 = load i32, i32* %28
%234 = add nsw i32 %233, -1
store i32 %234, i32* %28
br label %191
235: ; preds = %191
store i32 1, i32* %29
br label %236
236: ; preds = %340, %235
%237 = load i32, i32* %29
%238 = load i32, i32* @USHRT_MAX
%239 = icmp slt i32 %237, %238
br i1 %239, label %240, label %343
240: ; preds = %236
%241 = load double*, double** %22
%242 = load i32, i32* %29
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds double, double* %241, i64 %243
%245 = load double, double* %244
%246 = fcmp oeq double %245, 0.000000e+00
br i1 %246, label %247, label %248
247: ; preds = %240
br label %340
248: ; preds = %240
%249 = load double*, double** %18
%250 = load i32, i32* %29
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds double, double* %249, i64 %251
%253 = load double, double* %252
%254 = fcmp oeq double %253, 0.000000e+00
br i1 %254, label %255, label %256
255: ; preds = %248
br label %340
256: ; preds = %248
%257 = load double*, double** %19
%258 = load i32, i32* %29
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds double, double* %257, i64 %259
%261 = load double, double* %260
%262 = fcmp oeq double %261, 0.000000e+00
br i1 %262, label %263, label %264
263: ; preds = %256
br label %340
264: ; preds = %256
%265 = load double*, double** %20
%266 = load i32, i32* %29
%267 = sext i32 %266 to i64
%268 = getelementptr inbounds double, double* %265, i64 %267
%269 = load double, double* %268
%270 = load double*, double** %18
%271 = load i32, i32* %29
%272 = sext i32 %271 to i64
%273 = getelementptr inbounds double, double* %270, i64 %272
%274 = load double, double* %273
%275 = fdiv double %269, %274
%276 = fadd double %275, 5.000000e-01
%277 = fptosi double %276 to i32
store i32 %277, i32* %31
%278 = load double*, double** %21
%279 = load i32, i32* %29
%280 = sext i32 %279 to i64
%281 = getelementptr inbounds double, double* %278, i64 %280
%282 = load double, double* %281
%283 = load double*, double** %19
%284 = load i32, i32* %29
%285 = sext i32 %284 to i64
%286 = getelementptr inbounds double, double* %283, i64 %285
%287 = load double, double* %286
%288 = fdiv double %282, %287
%289 = fadd double %288, 5.000000e-01
%290 = fptosi double %289 to i32
store i32 %290, i32* %32
%291 = load i32, i32* %31
%292 = load i32, i32* %32
%293 = load i32, i32* %29
%294 = call i32 @_p3dHuangYagerThresholding_yager16(i32 %291, i32 %292, i32 %293)
%295 = load i32, i32* %12
%296 = load i32, i32* %13
%297 = mul nsw i32 %295, %296
%298 = load i32, i32* %14
%299 = mul nsw i32 %297, %298
%300 = sdiv i32 %294, %299
%301 = sitofp i32 %300 to double
%302 = load double*, double** %23
%303 = load i32, i32* %29
%304 = sext i32 %303 to i64
%305 = getelementptr inbounds double, double* %302, i64 %304
store double %301, double* %305
%306 = load double*, double** %23
%307 = load i32, i32* %29
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds double, double* %306, i64 %308
%310 = load double, double* %309
%311 = load double, double* %24
%312 = fcmp ogt double %310, %311
br i1 %312, label %313, label %319
313: ; preds = %264
%314 = load double*, double** %23
%315 = load i32, i32* %29
%316 = sext i32 %315 to i64
%317 = getelementptr inbounds double, double* %314, i64 %316
%318 = load double, double* %317
store double %318, double* %24
br label %319
319: ; preds = %313, %264
%320 = load i32, i32* %30
%321 = icmp slt i32 %320, 0
br i1 %321, label %322, label %324
322: ; preds = %319
%323 = load i32, i32* %29
store i32 %323, i32* %30
br label %339
324: ; preds = %319
%325 = load double*, double** %23
%326 = load i32, i32* %29
%327 = sext i32 %326 to i64
%328 = getelementptr inbounds double, double* %325, i64 %327
%329 = load double, double* %328
%330 = load double*, double** %23
%331 = load i32, i32* %30
%332 = sext i32 %331 to i64
%333 = getelementptr inbounds double, double* %330, i64 %332
%334 = load double, double* %333
%335 = fcmp olt double %329, %334
br i1 %335, label %336, label %338
336: ; preds = %324
%337 = load i32, i32* %29
store i32 %337, i32* %30
br label %338
338: ; preds = %336, %324
br label %339
339: ; preds = %338, %322
br label %340
340: ; preds = %339, %263, %255, %247
%341 = load i32, i32* %29
%342 = add nsw i32 %341, 1
store i32 %342, i32* %29
br label %236
343: ; preds = %236
%344 = load double*, double** %23
%345 = load i32, i32* %30
%346 = sext i32 %345 to i64
%347 = getelementptr inbounds double, double* %344, i64 %346
%348 = load double, double* %347
%349 = load double, double* %24
%350 = load double*, double** %23
%351 = load i32, i32* %30
%352 = sext i32 %351 to i64
%353 = getelementptr inbounds double, double* %350, i64 %352
%354 = load double, double* %353
%355 = fsub double %349, %354
%356 = call double @llvm.fmuladd.f64(double %355, double 5.000000e-02, double %348)
store double %356, double* %25
%357 = load i32, i32* %30
%358 = sitofp i32 %357 to double
%359 = load double, double* %25
%360 = fsub double %358, %359
%361 = fptosi double %360 to i32
store i32 %361, i32* %33
%362 = load i32, i32* %33
%363 = icmp sle i32 %362, 0
br i1 %363, label %364, label %365
364: ; preds = %343
store i32 1, i32* %33
br label %365
365: ; preds = %364, %343
%366 = load i32, i32* %30
%367 = sitofp i32 %366 to double
%368 = load double, double* %25
%369 = fadd double %367, %368
%370 = fptosi double %369 to i32
store i32 %370, i32* %34
%371 = load i32, i32* %34
%372 = load i32, i32* @USHRT_MAX
%373 = icmp sge i32 %371, %372
br i1 %373, label %374, label %377
374: ; preds = %365
%375 = load i32, i32* @USHRT_MAX
%376 = sub nsw i32 %375, 1
store i32 %376, i32* %34
br label %377
377: ; preds = %374, %365
%378 = load double, double* @UINT_MAX
store double %378, double* %27
%379 = load i32, i32* %33
store i32 %379, i32* %28
br label %380
380: ; preds = %411, %377
%381 = load i32, i32* %28
%382 = load i32, i32* %34
%383 = icmp sle i32 %381, %382
br i1 %383, label %384, label %414
384: ; preds = %380
%385 = load double*, double** %22
%386 = load i32, i32* %28
%387 = sub nsw i32 %386, 1
%388 = sext i32 %387 to i64
%389 = getelementptr inbounds double, double* %385, i64 %388
%390 = load double, double* %389
%391 = load double*, double** %22
%392 = load i32, i32* %28
%393 = sext i32 %392 to i64
%394 = getelementptr inbounds double, double* %391, i64 %393
%395 = load double, double* %394
%396 = fadd double %390, %395
%397 = load double*, double** %22
%398 = load i32, i32* %28
%399 = add nsw i32 %398, 1
%400 = sext i32 %399 to i64
%401 = getelementptr inbounds double, double* %397, i64 %400
%402 = load double, double* %401
%403 = fadd double %396, %402
store double %403, double* %26
%404 = load double, double* %26
%405 = load double, double* %27
%406 = fcmp olt double %404, %405
br i1 %406, label %407, label %410
407: ; preds = %384
%408 = load i32, i32* %28
store i32 %408, i32* %29
%409 = load double, double* %26
store double %409, double* %27
br label %410
410: ; preds = %407, %384
br label %411
411: ; preds = %410
%412 = load i32, i32* %28
%413 = add nsw i32 %412, 1
store i32 %413, i32* %28
br label %380
414: ; preds = %380
%415 = load i32, i32* %29
%416 = trunc i32 %415 to i16
%417 = load i16*, i16** %15
store i16 %416, i16* %417
store i32 0, i32* %35
br label %418
418: ; preds = %448, %414
%419 = load i32, i32* %35
%420 = load i32, i32* %12
%421 = load i32, i32* %13
%422 = mul nsw i32 %420, %421
%423 = load i32, i32* %14
%424 = mul nsw i32 %422, %423
%425 = icmp slt i32 %419, %424
br i1 %425, label %426, label %451
426: ; preds = %418
%427 = load i16*, i16** %10
%428 = load i32, i32* %35
%429 = sext i32 %428 to i64
%430 = getelementptr inbounds i16, i16* %427, i64 %429
%431 = load i16, i16* %430
%432 = zext i16 %431 to i32
%433 = load i16*, i16** %15
%434 = load i16, i16* %433
%435 = zext i16 %434 to i32
%436 = icmp sgt i32 %432, %435
br i1 %436, label %437, label %440
437: ; preds = %426
%438 = load i8, i8* @UCHAR_MAX
%439 = zext i8 %438 to i32
br label %441
440: ; preds = %426
br label %441
441: ; preds = %440, %437
%442 = phi i32 [ %439, %437 ], [ 0, %440 ]
%443 = trunc i32 %442 to i8
%444 = load i8*, i8** %11
%445 = load i32, i32* %35
%446 = sext i32 %445 to i64
%447 = getelementptr inbounds i8, i8* %444, i64 %446
store i8 %443, i8* %447
br label %448
448: ; preds = %441
%449 = load i32, i32* %35
%450 = add nsw i32 %449, 1
store i32 %450, i32* %35
br label %418
451: ; preds = %418
%452 = load double*, double** %22
%453 = call i32 @free(double* %452)
%454 = load double*, double** %18
%455 = call i32 @free(double* %454)
%456 = load double*, double** %19
%457 = call i32 @free(double* %456)
%458 = load double*, double** %20
%459 = call i32 @free(double* %458)
%460 = load double*, double** %21
%461 = call i32 @free(double* %460)
%462 = load double*, double** %23
%463 = call i32 @free(double* %462)
%464 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%465 = icmp ne i32 (i8*, ...)* %464, null
br i1 %465, label %466, label %476
466: ; preds = %451
%467 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%468 = load i16*, i16** %15
%469 = load i16, i16* %468
%470 = zext i16 %469 to i32
%471 = call i32 (i8*, ...) %467(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %470)
%472 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%473 = call i32 (...) @p3dGetElapsedTime_min()
%474 = call i32 (...) @p3dGetElapsedTime_sec()
%475 = call i32 (i8*, ...) %472(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i32 %473, i32 %474)
br label %476
476: ; preds = %466, %451
store i32 2, i32* %9
br label %496
477: ; preds = %98, %88, %78, %68, %58, %48
%478 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%479 = icmp ne i32 (i8*, ...)* %478, null
br i1 %479, label %480, label %483
480: ; preds = %477
%481 = load i32 (i8*, ...)*, i32 (i8*, ...)** %16
%482 = call i32 (i8*, ...) %481(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
br label %483
483: ; preds = %480, %477
%484 = load double*, double** %22
%485 = call i32 @free(double* %484)
%486 = load double*, double** %18
%487 = call i32 @free(double* %486)
%488 = load double*, double** %19
%489 = call i32 @free(double* %488)
%490 = load double*, double** %20
%491 = call i32 @free(double* %490)
%492 = load double*, double** %21
%493 = call i32 @free(double* %492)
%494 = load double*, double** %23
%495 = call i32 @free(double* %494)
store i32 0, i32* %9
br label %496
496: ; preds = %483, %476
%497 = load i32, i32* %9
ret i32 %497
}

LLVM IR (-O2):
@.str = [59 x i8] c"Pore3D - Thresholding image according to Huang's method...\00"
@USHRT_MAX = global i32 0
@UINT_MAX = global double 0.000000e+00
@UCHAR_MAX = global i8 0
@.str.1 = [27 x i8] c"\09Determined threshold: %d.\00"
@.str.2 = [54 x i8] c"Pore3D - Image thresholded successfully in %dm%0.3fs.\00"
@.str.3 = [60 x i8] c"Pore3D - Not enough (contiguous) memory. Program will exit.\00"
define i32 @p3dHuangYagerThresholding_16(i16* nocapture %0, i8* nocapture writeonly %1, i32 %2, i32 %3, i32 %4, i16* nocapture %5, i32 (i8*, ...)* %6, i32 (i32, ...)* nocapture readnone %7) {
%9 = bitcast i16* %5 to i8*
%10 = icmp eq i32 (i8*, ...)* %6, null
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = tail call i32 (...) @p3dResetStartTime()
%13 = tail call i32 (i8*, ...) %6(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %11, %8
%15 = load i32, i32* @USHRT_MAX
%16 = add nsw i32 %15, 1
%17 = tail call i64 @calloc(i32 %16, i32 8)
%18 = inttoptr i64 %17 to double*
%19 = icmp eq i64 %17, 0
br i1 %19, label %629, label %20
20: ; preds = %14
%21 = load i32, i32* @USHRT_MAX
%22 = shl i32 %21, 3
%23 = add i32 %22, 8
%24 = tail call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to double*
%26 = inttoptr i64 %24 to i8*
%27 = icmp eq i64 %24, 0
br i1 %27, label %629, label %28
28: ; preds = %20
%29 = load i32, i32* @USHRT_MAX
%30 = shl i32 %29, 3
%31 = add i32 %30, 8
%32 = tail call i64 @malloc(i32 %31)
%33 = inttoptr i64 %32 to double*
%34 = icmp eq i64 %32, 0
br i1 %34, label %629, label %35
35: ; preds = %28
%36 = load i32, i32* @USHRT_MAX
%37 = shl i32 %36, 3
%38 = add i32 %37, 8
%39 = tail call i64 @malloc(i32 %38)
%40 = inttoptr i64 %39 to double*
%41 = inttoptr i64 %39 to i8*
%42 = icmp eq i64 %39, 0
br i1 %42, label %629, label %43
43: ; preds = %35
%44 = load i32, i32* @USHRT_MAX
%45 = shl i32 %44, 3
%46 = add i32 %45, 8
%47 = tail call i64 @malloc(i32 %46)
%48 = inttoptr i64 %47 to double*
%49 = icmp eq i64 %47, 0
br i1 %49, label %629, label %50
50: ; preds = %43
%51 = load i32, i32* @USHRT_MAX
%52 = shl i32 %51, 3
%53 = add i32 %52, 8
%54 = tail call i64 @malloc(i32 %53)
%55 = inttoptr i64 %54 to double*
%56 = icmp eq i64 %54, 0
br i1 %56, label %629, label %57
57: ; preds = %50
%58 = mul nsw i32 %3, %2
%59 = mul i32 %58, %4
%60 = icmp sgt i32 %59, 0
br i1 %60, label %61, label %116
61: ; preds = %57
%62 = zext i32 %59 to i64
%63 = add nsw i64 %62, -1
%64 = and i64 %62, 3
%65 = icmp ult i64 %63, 3
br i1 %65, label %101, label %66
66: ; preds = %61
%67 = and i64 %62, 4294967292
br label %68
68: ; preds = %68, %66
%69 = phi i64 [ 0, %66 ], [ %98, %68 ]
%70 = phi i64 [ 0, %66 ], [ %99, %68 ]
%71 = getelementptr inbounds i16, i16* %0, i64 %69
%72 = load i16, i16* %71
%73 = zext i16 %72 to i64
%74 = getelementptr inbounds double, double* %18, i64 %73
%75 = load double, double* %74
%76 = fadd double %75, 1.000000e+00
store double %76, double* %74
%77 = or i64 %69, 1
%78 = getelementptr inbounds i16, i16* %0, i64 %77
%79 = load i16, i16* %78
%80 = zext i16 %79 to i64
%81 = getelementptr inbounds double, double* %18, i64 %80
%82 = load double, double* %81
%83 = fadd double %82, 1.000000e+00
store double %83, double* %81
%84 = or i64 %69, 2
%85 = getelementptr inbounds i16, i16* %0, i64 %84
%86 = load i16, i16* %85
%87 = zext i16 %86 to i64
%88 = getelementptr inbounds double, double* %18, i64 %87
%89 = load double, double* %88
%90 = fadd double %89, 1.000000e+00
store double %90, double* %88
%91 = or i64 %69, 3
%92 = getelementptr inbounds i16, i16* %0, i64 %91
%93 = load i16, i16* %92
%94 = zext i16 %93 to i64
%95 = getelementptr inbounds double, double* %18, i64 %94
%96 = load double, double* %95
%97 = fadd double %96, 1.000000e+00
store double %97, double* %95
%98 = add nuw nsw i64 %69, 4
%99 = add i64 %70, 4
%100 = icmp eq i64 %99, %67
br i1 %100, label %101, label %68
101: ; preds = %68, %61
%102 = phi i64 [ 0, %61 ], [ %98, %68 ]
%103 = icmp eq i64 %64, 0
br i1 %103, label %116, label %104
104: ; preds = %101, %104
%105 = phi i64 [ %113, %104 ], [ %102, %101 ]
%106 = phi i64 [ %114, %104 ], [ 0, %101 ]
%107 = getelementptr inbounds i16, i16* %0, i64 %105
%108 = load i16, i16* %107
%109 = zext i16 %108 to i64
%110 = getelementptr inbounds double, double* %18, i64 %109
%111 = load double, double* %110
%112 = fadd double %111, 1.000000e+00
store double %112, double* %110
%113 = add nuw nsw i64 %105, 1
%114 = add i64 %106, 1
%115 = icmp eq i64 %114, %64
br i1 %115, label %116, label %104
116: ; preds = %101, %104, %57
%117 = load double, double* %18
store double %117, double* %25
store double 0.000000e+00, double* %40
%118 = load i32, i32* @USHRT_MAX
%119 = icmp slt i32 %118, 1
br i1 %119, label %120, label %124
120: ; preds = %116
%121 = sext i32 %118 to i64
%122 = getelementptr inbounds double, double* %33, i64 %121
store double 0.000000e+00, double* %122
%123 = getelementptr inbounds double, double* %48, i64 %121
store double 0.000000e+00, double* %123
br label %426
124: ; preds = %116
%125 = add nuw i32 %118, 1
%126 = zext i32 %125 to i64
%127 = getelementptr double, double* %25, i64 %126
%128 = bitcast double* %127 to i8*
%129 = getelementptr double, double* %40, i64 %126
%130 = bitcast double* %129 to i8*
%131 = icmp ult i8* %26, %130
%132 = icmp ult i8* %41, %128
%133 = and i1 %131, %132
br i1 %133, label %134, label %152
134: ; preds = %124, %134
%135 = phi i64 [ %150, %134 ], [ 1, %124 ]
%136 = add nsw i64 %135, -1
%137 = getelementptr inbounds double, double* %25, i64 %136
%138 = load double, double* %137
%139 = getelementptr inbounds double, double* %18, i64 %135
%140 = load double, double* %139
%141 = fadd double %138, %140
%142 = getelementptr inbounds double, double* %25, i64 %135
store double %141, double* %142
%143 = trunc i64 %135 to i32
%144 = sitofp i32 %143 to double
%145 = load double, double* %139
%146 = getelementptr inbounds double, double* %40, i64 %136
%147 = load double, double* %146
%148 = tail call double @llvm.fmuladd.f64(double %144, double %145, double %147)
%149 = getelementptr inbounds double, double* %40, i64 %135
store double %148, double* %149
%150 = add nuw nsw i64 %135, 1
%151 = icmp eq i64 %150, %126
br i1 %151, label %202, label %134
152: ; preds = %124
%153 = load double, double* %25
%154 = load double, double* %40
%155 = add nsw i64 %126, -1
%156 = and i64 %155, 1
%157 = icmp eq i32 %125, 2
br i1 %157, label %187, label %158
158: ; preds = %152
%159 = and i64 %155, -2
br label %160
160: ; preds = %160, %158
%161 = phi double [ %154, %158 ], [ %182, %160 ]
%162 = phi double [ %153, %158 ], [ %177, %160 ]
%163 = phi i64 [ 1, %158 ], [ %184, %160 ]
%164 = phi i64 [ 0, %158 ], [ %185, %160 ]
%165 = getelementptr inbounds double, double* %18, i64 %163
%166 = load double, double* %165
%167 = fadd double %162, %166
%168 = getelementptr inbounds double, double* %25, i64 %163
store double %167, double* %168
%169 = trunc i64 %163 to i32
%170 = sitofp i32 %169 to double
%171 = load double, double* %165
%172 = tail call double @llvm.fmuladd.f64(double %170, double %171, double %161)
%173 = getelementptr inbounds double, double* %40, i64 %163
store double %172, double* %173
%174 = add nuw nsw i64 %163, 1
%175 = getelementptr inbounds double, double* %18, i64 %174
%176 = load double, double* %175
%177 = fadd double %167, %176
%178 = getelementptr inbounds double, double* %25, i64 %174
store double %177, double* %178
%179 = trunc i64 %174 to i32
%180 = sitofp i32 %179 to double
%181 = load double, double* %175
%182 = tail call double @llvm.fmuladd.f64(double %180, double %181, double %172)
%183 = getelementptr inbounds double, double* %40, i64 %174
store double %182, double* %183
%184 = add nuw nsw i64 %163, 2
%185 = add i64 %164, 2
%186 = icmp eq i64 %185, %159
br i1 %186, label %187, label %160
187: ; preds = %160, %152
%188 = phi double [ %154, %152 ], [ %182, %160 ]
%189 = phi double [ %153, %152 ], [ %177, %160 ]
%190 = phi i64 [ 1, %152 ], [ %184, %160 ]
%191 = icmp eq i64 %156, 0
br i1 %191, label %202, label %192
192: ; preds = %187
%193 = getelementptr inbounds double, double* %18, i64 %190
%194 = load double, double* %193
%195 = fadd double %189, %194
%196 = getelementptr inbounds double, double* %25, i64 %190
store double %195, double* %196
%197 = trunc i64 %190 to i32
%198 = sitofp i32 %197 to double
%199 = load double, double* %193
%200 = tail call double @llvm.fmuladd.f64(double %198, double %199, double %188)
%201 = getelementptr inbounds double, double* %40, i64 %190
store double %200, double* %201
br label %202
202: ; preds = %192, %187, %134
%203 = sext i32 %118 to i64
%204 = getelementptr inbounds double, double* %33, i64 %203
store double 0.000000e+00, double* %204
%205 = getelementptr inbounds double, double* %48, i64 %203
store double 0.000000e+00, double* %205
%206 = icmp sgt i32 %118, 0
br i1 %206, label %207, label %426
207: ; preds = %202
%208 = zext i32 %118 to i64
%209 = icmp eq i32 %118, 1
br i1 %209, label %355, label %210
210: ; preds = %207
%211 = add nsw i64 %208, -1
%212 = add i32 %118, -1
%213 = trunc i64 %211 to i32
%214 = icmp ult i32 %212, %213
%215 = icmp ugt i64 %211, 4294967295
%216 = or i1 %214, %215
%217 = zext i32 %212 to i64
%218 = getelementptr double, double* %33, i64 %217
%219 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %211, i64 8)
%220 = extractvalue { i64, i1 } %219, 0
%221 = extractvalue { i64, i1 } %219, 1
%222 = bitcast double* %218 to i8*
%223 = sub i64 0, %220
%224 = getelementptr i8, i8* %222, i64 %223
%225 = icmp ugt i8* %224, %222
%226 = or i1 %225, %221
%227 = getelementptr double, double* %48, i64 %217
%228 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %211, i64 8)
%229 = extractvalue { i64, i1 } %228, 0
%230 = extractvalue { i64, i1 } %228, 1
%231 = bitcast double* %227 to i8*
%232 = sub i64 0, %229
%233 = getelementptr i8, i8* %231, i64 %232
%234 = icmp ugt i8* %233, %231
%235 = or i1 %234, %230
%236 = getelementptr double, double* %33, i64 %208
%237 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %211, i64 8)
%238 = extractvalue { i64, i1 } %237, 0
%239 = extractvalue { i64, i1 } %237, 1
%240 = bitcast double* %236 to i8*
%241 = sub i64 0, %238
%242 = getelementptr i8, i8* %240, i64 %241
%243 = icmp ugt i8* %242, %240
%244 = or i1 %243, %239
%245 = getelementptr double, double* %18, i64 %208
%246 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %211, i64 8)
%247 = extractvalue { i64, i1 } %246, 0
%248 = extractvalue { i64, i1 } %246, 1
%249 = bitcast double* %245 to i8*
%250 = sub i64 0, %247
%251 = getelementptr i8, i8* %249, i64 %250
%252 = icmp ugt i8* %251, %249
%253 = or i1 %252, %248
%254 = getelementptr double, double* %48, i64 %208
%255 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %211, i64 8)
%256 = extractvalue { i64, i1 } %255, 0
%257 = extractvalue { i64, i1 } %255, 1
%258 = bitcast double* %254 to i8*
%259 = sub i64 0, %256
%260 = getelementptr i8, i8* %258, i64 %259
%261 = icmp ugt i8* %260, %258
%262 = or i1 %261, %257
%263 = or i1 %216, %226
%264 = or i1 %263, %235
%265 = or i1 %264, %244
%266 = or i1 %265, %253
%267 = or i1 %266, %262
br i1 %267, label %355, label %268
268: ; preds = %210
%269 = add i32 %118, -1
%270 = zext i32 %269 to i64
%271 = add nuw nsw i64 %270, 1
%272 = sub nsw i64 %271, %208
%273 = getelementptr double, double* %33, i64 %272
%274 = add nuw nsw i64 %270, 1
%275 = getelementptr double, double* %33, i64 %274
%276 = getelementptr double, double* %48, i64 %272
%277 = getelementptr double, double* %48, i64 %274
%278 = getelementptr double, double* %33, i64 1
%279 = add nuw nsw i64 %208, 1
%280 = getelementptr double, double* %33, i64 %279
%281 = getelementptr double, double* %18, i64 1
%282 = getelementptr double, double* %18, i64 %279
%283 = getelementptr double, double* %48, i64 1
%284 = getelementptr double, double* %48, i64 %279
%285 = icmp ult double* %273, %277
%286 = icmp ult double* %276, %275
%287 = and i1 %285, %286
%288 = icmp ult double* %273, %280
%289 = icmp ult double* %278, %275
%290 = and i1 %288, %289
%291 = or i1 %287, %290
%292 = icmp ult double* %273, %282
%293 = icmp ult double* %281, %275
%294 = and i1 %292, %293
%295 = or i1 %291, %294
%296 = icmp ult double* %273, %284
%297 = icmp ult double* %283, %275
%298 = and i1 %296, %297
%299 = or i1 %295, %298
%300 = icmp ult double* %276, %280
%301 = icmp ult double* %278, %277
%302 = and i1 %300, %301
%303 = or i1 %299, %302
%304 = icmp ult double* %276, %282
%305 = icmp ult double* %281, %277
%306 = and i1 %304, %305
%307 = or i1 %303, %306
%308 = icmp ult double* %276, %284
%309 = icmp ult double* %283, %277
%310 = and i1 %308, %309
%311 = or i1 %307, %310
br i1 %311, label %355, label %312
312: ; preds = %268
%313 = and i64 %208, 4294967294
%314 = and i64 %208, 1
%315 = insertelement <2 x i32> poison, i32 %118, i64 0
%316 = shufflevector <2 x i32> %315, <2 x i32> poison, <2 x i32> zeroinitializer
%317 = add <2 x i32> %316, <i32 0, i32 -1>
%318 = getelementptr inbounds double, double* %33, i64 -1
%319 = getelementptr inbounds double, double* %18, i64 -1
%320 = getelementptr inbounds double, double* %33, i64 -1
%321 = getelementptr inbounds double, double* %48, i64 -1
%322 = getelementptr inbounds double, double* %48, i64 -1
br label %323
323: ; preds = %323, %312
%324 = phi i64 [ 0, %312 ], [ %350, %323 ]
%325 = phi <2 x i32> [ %317, %312 ], [ %351, %323 ]
%326 = sub i64 %208, %324
%327 = add i64 %326, 4294967295
%328 = getelementptr inbounds double, double* %318, i64 %326
%329 = bitcast double* %328 to <2 x double>*
%330 = load <2 x double>, <2 x double>* %329
%331 = getelementptr inbounds double, double* %319, i64 %326
%332 = bitcast double* %331 to <2 x double>*
%333 = load <2 x double>, <2 x double>* %332
%334 = fadd <2 x double> %330, %333
%335 = and i64 %327, 4294967295
%336 = getelementptr inbounds double, double* %320, i64 %335
%337 = bitcast double* %336 to <2 x double>*
store <2 x double> %334, <2 x double>* %337
%338 = getelementptr inbounds double, double* %321, i64 %326
%339 = bitcast double* %338 to <2 x double>*
%340 = load <2 x double>, <2 x double>* %339
%341 = shufflevector <2 x double> %340, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%342 = sitofp <2 x i32> %325 to <2 x double>
%343 = bitcast double* %331 to <2 x double>*
%344 = load <2 x double>, <2 x double>* %343
%345 = shufflevector <2 x double> %344, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%346 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %342, <2 x double> %345, <2 x double> %341)
%347 = shufflevector <2 x double> %346, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%348 = getelementptr inbounds double, double* %322, i64 %335
%349 = bitcast double* %348 to <2 x double>*
store <2 x double> %347, <2 x double>* %349
%350 = add nuw i64 %324, 2
%351 = add <2 x i32> %325, <i32 -2, i32 -2>
%352 = icmp eq i64 %350, %313
br i1 %352, label %353, label %323
353: ; preds = %323
%354 = icmp eq i64 %313, %208
br i1 %354, label %357, label %355
355: ; preds = %268, %210, %207, %353
%356 = phi i64 [ %208, %268 ], [ %208, %210 ], [ %208, %207 ], [ %314, %353 ]
br label %359
357: ; preds = %359, %353
%358 = icmp sgt i32 %118, 1
br i1 %358, label %377, label %426
359: ; preds = %355, %359
%360 = phi i64 [ %361, %359 ], [ %356, %355 ]
%361 = add nsw i64 %360, -1
%362 = getelementptr inbounds double, double* %33, i64 %360
%363 = load double, double* %362
%364 = getelementptr inbounds double, double* %18, i64 %360
%365 = load double, double* %364
%366 = fadd double %363, %365
%367 = and i64 %361, 4294967295
%368 = getelementptr inbounds double, double* %33, i64 %367
store double %366, double* %368
%369 = getelementptr inbounds double, double* %48, i64 %360
%370 = load double, double* %369
%371 = trunc i64 %360 to i32
%372 = sitofp i32 %371 to double
%373 = load double, double* %364
%374 = tail call double @llvm.fmuladd.f64(double %372, double %373, double %370)
%375 = getelementptr inbounds double, double* %48, i64 %367
store double %374, double* %375
%376 = icmp ugt i64 %360, 1
br i1 %376, label %359, label %357
377: ; preds = %357, %417
%378 = phi i64 [ %420, %417 ], [ 1, %357 ]
%379 = phi i32 [ %419, %417 ], [ -1, %357 ]
%380 = phi double [ %418, %417 ], [ 0.000000e+00, %357 ]
%381 = getelementptr inbounds double, double* %18, i64 %378
%382 = load double, double* %381
%383 = fcmp oeq double %382, 0.000000e+00
br i1 %383, label %417, label %384
384: ; preds = %377
%385 = getelementptr inbounds double, double* %25, i64 %378
%386 = load double, double* %385
%387 = fcmp oeq double %386, 0.000000e+00
br i1 %387, label %417, label %388
388: ; preds = %384
%389 = getelementptr inbounds double, double* %33, i64 %378
%390 = load double, double* %389
%391 = fcmp oeq double %390, 0.000000e+00
br i1 %391, label %417, label %392
392: ; preds = %388
%393 = getelementptr inbounds double, double* %40, i64 %378
%394 = load double, double* %393
%395 = fdiv double %394, %386
%396 = fadd double %395, 5.000000e-01
%397 = fptosi double %396 to i32
%398 = getelementptr inbounds double, double* %48, i64 %378
%399 = load double, double* %398
%400 = fdiv double %399, %390
%401 = fadd double %400, 5.000000e-01
%402 = fptosi double %401 to i32
%403 = trunc i64 %378 to i32
%404 = tail call i32 @_p3dHuangYagerThresholding_yager16(i32 %397, i32 %402, i32 %403)
%405 = sdiv i32 %404, %59
%406 = sitofp i32 %405 to double
%407 = getelementptr inbounds double, double* %55, i64 %378
store double %406, double* %407
%408 = fcmp olt double %380, %406
%409 = select i1 %408, double %406, double %380
%410 = icmp slt i32 %379, 0
br i1 %410, label %417, label %411
411: ; preds = %392
%412 = zext i32 %379 to i64
%413 = getelementptr inbounds double, double* %55, i64 %412
%414 = load double, double* %413
%415 = fcmp ogt double %414, %406
br i1 %415, label %416, label %417
416: ; preds = %411
br label %417
417: ; preds = %392, %416, %411, %388, %384, %377
%418 = phi double [ %380, %377 ], [ %380, %384 ], [ %380, %388 ], [ %409, %416 ], [ %409, %411 ], [ %409, %392 ]
%419 = phi i32 [ %379, %377 ], [ %379, %384 ], [ %379, %388 ], [ %403, %416 ], [ %379, %411 ], [ %403, %392 ]
%420 = add nuw nsw i64 %378, 1
%421 = load i32, i32* @USHRT_MAX
%422 = sext i32 %421 to i64
%423 = icmp slt i64 %420, %422
br i1 %423, label %377, label %424
424: ; preds = %417
%425 = trunc i64 %420 to i32
br label %426
426: ; preds = %202, %120, %424, %357
%427 = phi double [ 0.000000e+00, %357 ], [ %418, %424 ], [ 0.000000e+00, %120 ], [ 0.000000e+00, %202 ]
%428 = phi i32 [ 1, %357 ], [ %425, %424 ], [ 1, %120 ], [ 1, %202 ]
%429 = phi i32 [ -1, %357 ], [ %419, %424 ], [ -1, %120 ], [ -1, %202 ]
%430 = phi i32 [ %118, %357 ], [ %421, %424 ], [ %118, %120 ], [ %118, %202 ]
%431 = sext i32 %429 to i64
%432 = getelementptr inbounds double, double* %55, i64 %431
%433 = load double, double* %432
%434 = fsub double %427, %433
%435 = tail call double @llvm.fmuladd.f64(double %434, double 5.000000e-02, double %433)
%436 = sitofp i32 %429 to double
%437 = fsub double %436, %435
%438 = fptosi double %437 to i32
%439 = icmp sgt i32 %438, 1
%440 = select i1 %439, i32 %438, i32 1
%441 = fadd double %435, %436
%442 = fptosi double %441 to i32
%443 = icmp sgt i32 %430, %442
%444 = add nsw i32 %430, -1
%445 = select i1 %443, i32 %442, i32 %444
%446 = icmp sgt i32 %440, %445
br i1 %446, label %511, label %447
447: ; preds = %426
%448 = load double, double* @UINT_MAX
%449 = zext i32 %440 to i64
%450 = add nsw i32 %445, 1
%451 = zext i32 %450 to i64
%452 = sub nsw i64 %451, %449
%453 = xor i64 %449, -1
%454 = and i64 %452, 1
%455 = icmp eq i64 %454, 0
br i1 %455, label %470, label %456
456: ; preds = %447
%457 = add nsw i64 %449, -1
%458 = getelementptr inbounds double, double* %18, i64 %457
%459 = load double, double* %458
%460 = getelementptr inbounds double, double* %18, i64 %449
%461 = load double, double* %460
%462 = fadd double %459, %461
%463 = add nuw nsw i64 %449, 1
%464 = getelementptr inbounds double, double* %18, i64 %463
%465 = load double, double* %464
%466 = fadd double %462, %465
%467 = fcmp olt double %466, %448
%468 = select i1 %467, double %466, double %448
%469 = select i1 %467, i32 %440, i32 %428
br label %470
470: ; preds = %456, %447
%471 = phi i32 [ undef, %447 ], [ %469, %456 ]
%472 = phi i64 [ %449, %447 ], [ %463, %456 ]
%473 = phi i32 [ %428, %447 ], [ %469, %456 ]
%474 = phi double [ %448, %447 ], [ %468, %456 ]
%475 = sub nsw i64 0, %451
%476 = icmp eq i64 %453, %475
br i1 %476, label %511, label %477
477: ; preds = %470, %477
%478 = phi i64 [ %501, %477 ], [ %472, %470 ]
%479 = phi i32 [ %509, %477 ], [ %473, %470 ]
%480 = phi double [ %507, %477 ], [ %474, %470 ]
%481 = add nsw i64 %478, -1
%482 = getelementptr inbounds double, double* %18, i64 %481
%483 = load double, double* %482
%484 = getelementptr inbounds double, double* %18, i64 %478
%485 = load double, double* %484
%486 = fadd double %483, %485
%487 = add nuw nsw i64 %478, 1
%488 = and i64 %487, 4294967295
%489 = getelementptr inbounds double, double* %18, i64 %488
%490 = load double, double* %489
%491 = fadd double %486, %490
%492 = fcmp olt double %491, %480
%493 = select i1 %492, double %491, double %480
%494 = trunc i64 %478 to i32
%495 = select i1 %492, i32 %494, i32 %479
%496 = getelementptr inbounds double, double* %18, i64 %478
%497 = load double, double* %496
%498 = getelementptr inbounds double, double* %18, i64 %487
%499 = load double, double* %498
%500 = fadd double %497, %499
%501 = add nuw nsw i64 %478, 2
%502 = and i64 %501, 4294967295
%503 = getelementptr inbounds double, double* %18, i64 %502
%504 = load double, double* %503
%505 = fadd double %500, %504
%506 = fcmp olt double %505, %493
%507 = select i1 %506, double %505, double %493
%508 = trunc i64 %487 to i32
%509 = select i1 %506, i32 %508, i32 %495
%510 = icmp eq i64 %501, %451
br i1 %510, label %511, label %477
511: ; preds = %470, %477, %426
%512 = phi i32 [ %428, %426 ], [ %471, %470 ], [ %509, %477 ]
%513 = trunc i32 %512 to i16
store i16 %513, i16* %5
br i1 %60, label %514, label %615
514: ; preds = %511
%515 = zext i32 %59 to i64
%516 = load i16, i16* %0
%517 = icmp ugt i16 %516, %513
%518 = load i8, i8* @UCHAR_MAX
%519 = select i1 %517, i8 %518, i8 0
store i8 %519, i8* %1
%520 = icmp eq i32 %59, 1
br i1 %520, label %615, label %521
521: ; preds = %514
%522 = add nsw i64 %515, -1
%523 = icmp ult i64 %522, 16
br i1 %523, label %578, label %524
524: ; preds = %521
%525 = getelementptr i8, i8* %1, i64 1
%526 = getelementptr i8, i8* %1, i64 %515
%527 = getelementptr i16, i16* %5, i64 1
%528 = bitcast i16* %527 to i8*
%529 = getelementptr i16, i16* %0, i64 1
%530 = bitcast i16* %529 to i8*
%531 = getelementptr i16, i16* %0, i64 %515
%532 = bitcast i16* %531 to i8*
%533 = icmp ult i8* %525, %528
%534 = icmp ugt i8* %526, %9
%535 = and i1 %533, %534
%536 = icmp ult i8* %525, %532
%537 = icmp ugt i8* %526, %530
%538 = and i1 %536, %537
%539 = or i1 %535, %538
%540 = icmp ult i8* %1, @UCHAR_MAX
%541 = icmp ugt i8* %526, @UCHAR_MAX
%542 = and i1 %540, %541
%543 = or i1 %539, %542
br i1 %543, label %578, label %544
544: ; preds = %524
%545 = and i64 %522, -16
%546 = or i64 %545, 1
%547 = load i16, i16* %5
%548 = insertelement <8 x i16> poison, i16 %547, i64 0
%549 = shufflevector <8 x i16> %548, <8 x i16> poison, <8 x i32> zeroinitializer
%550 = insertelement <8 x i16> poison, i16 %547, i64 0
%551 = shufflevector <8 x i16> %550, <8 x i16> poison, <8 x i32> zeroinitializer
%552 = load i8, i8* @UCHAR_MAX
%553 = insertelement <8 x i8> poison, i8 %552, i64 0
%554 = shufflevector <8 x i8> %553, <8 x i8> poison, <8 x i32> zeroinitializer
%555 = insertelement <8 x i8> poison, i8 %552, i64 0
%556 = shufflevector <8 x i8> %555, <8 x i8> poison, <8 x i32> zeroinitializer
br label %557
557: ; preds = %557, %544
%558 = phi i64 [ 0, %544 ], [ %574, %557 ]
%559 = or i64 %558, 1
%560 = getelementptr inbounds i16, i16* %0, i64 %559
%561 = bitcast i16* %560 to <8 x i16>*
%562 = load <8 x i16>, <8 x i16>* %561
%563 = getelementptr inbounds i16, i16* %560, i64 8
%564 = bitcast i16* %563 to <8 x i16>*
%565 = load <8 x i16>, <8 x i16>* %564
%566 = icmp ugt <8 x i16> %562, %549
%567 = icmp ugt <8 x i16> %565, %551
%568 = select <8 x i1> %566, <8 x i8> %554, <8 x i8> zeroinitializer
%569 = select <8 x i1> %567, <8 x i8> %556, <8 x i8> zeroinitializer
%570 = getelementptr inbounds i8, i8* %1, i64 %559
%571 = bitcast i8* %570 to <8 x i8>*
store <8 x i8> %568, <8 x i8>* %571
%572 = getelementptr inbounds i8, i8* %570, i64 8
%573 = bitcast i8* %572 to <8 x i8>*
store <8 x i8> %569, <8 x i8>* %573
%574 = add nuw i64 %558, 16
%575 = icmp eq i64 %574, %545
br i1 %575, label %576, label %557
576: ; preds = %557
%577 = icmp eq i64 %522, %545
br i1 %577, label %615, label %578
578: ; preds = %524, %521, %576
%579 = phi i64 [ 1, %524 ], [ 1, %521 ], [ %546, %576 ]
%580 = xor i64 %579, -1
%581 = and i64 %515, 1
%582 = icmp eq i64 %581, 0
br i1 %582, label %583, label %592
583: ; preds = %578
%584 = load i16, i16* %5
%585 = getelementptr inbounds i16, i16* %0, i64 %579
%586 = load i16, i16* %585
%587 = icmp ugt i16 %586, %584
%588 = load i8, i8* @UCHAR_MAX
%589 = select i1 %587, i8 %588, i8 0
%590 = getelementptr inbounds i8, i8* %1, i64 %579
store i8 %589, i8* %590
%591 = add nuw nsw i64 %579, 1
br label %592
592: ; preds = %583, %578
%593 = phi i64 [ %579, %578 ], [ %591, %583 ]
%594 = sub nsw i64 0, %515
%595 = icmp eq i64 %580, %594
br i1 %595, label %615, label %596
596: ; preds = %592, %596
%597 = phi i64 [ %613, %596 ], [ %593, %592 ]
%598 = load i16, i16* %5
%599 = getelementptr inbounds i16, i16* %0, i64 %597
%600 = load i16, i16* %599
%601 = icmp ugt i16 %600, %598
%602 = load i8, i8* @UCHAR_MAX
%603 = select i1 %601, i8 %602, i8 0
%604 = getelementptr inbounds i8, i8* %1, i64 %597
store i8 %603, i8* %604
%605 = add nuw nsw i64 %597, 1
%606 = load i16, i16* %5
%607 = getelementptr inbounds i16, i16* %0, i64 %605
%608 = load i16, i16* %607
%609 = icmp ugt i16 %608, %606
%610 = load i8, i8* @UCHAR_MAX
%611 = select i1 %609, i8 %610, i8 0
%612 = getelementptr inbounds i8, i8* %1, i64 %605
store i8 %611, i8* %612
%613 = add nuw nsw i64 %597, 2
%614 = icmp eq i64 %613, %515
br i1 %614, label %615, label %596
615: ; preds = %592, %596, %514, %576, %511
%616 = tail call i32 @free(double* %18)
%617 = tail call i32 @free(double* %25)
%618 = tail call i32 @free(double* %33)
%619 = tail call i32 @free(double* %40)
%620 = tail call i32 @free(double* %48)
%621 = tail call i32 @free(double* %55)
br i1 %10, label %643, label %622
622: ; preds = %615
%623 = load i16, i16* %5
%624 = zext i16 %623 to i32
%625 = tail call i32 (i8*, ...) %6(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %624)
%626 = tail call i32 (...) @p3dGetElapsedTime_min()
%627 = tail call i32 (...) @p3dGetElapsedTime_sec()
%628 = tail call i32 (i8*, ...) %6(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i32 %626, i32 %627)
br label %643
629: ; preds = %50, %43, %35, %28, %20, %14
%630 = phi double* [ undef, %14 ], [ undef, %20 ], [ undef, %28 ], [ undef, %35 ], [ null, %43 ], [ %48, %50 ]
%631 = phi double* [ undef, %14 ], [ undef, %20 ], [ undef, %28 ], [ null, %35 ], [ %40, %43 ], [ %40, %50 ]
%632 = phi double* [ undef, %14 ], [ undef, %20 ], [ null, %28 ], [ %33, %35 ], [ %33, %43 ], [ %33, %50 ]
%633 = phi double* [ undef, %14 ], [ null, %20 ], [ %25, %28 ], [ %25, %35 ], [ %25, %43 ], [ %25, %50 ]
br i1 %10, label %636, label %634
634: ; preds = %629
%635 = tail call i32 (i8*, ...) %6(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
br label %636
636: ; preds = %634, %629
%637 = tail call i32 @free(double* %18)
%638 = tail call i32 @free(double* %633)
%639 = tail call i32 @free(double* %632)
%640 = tail call i32 @free(double* %631)
%641 = tail call i32 @free(double* %630)
%642 = tail call i32 @free(double* null)
br label %643
643: ; preds = %615, %622, %636
%644 = phi i32 [ 0, %636 ], [ 2, %622 ], [ 2, %615 ]
ret i32 %644
}